fix(sdk): type recallManual per method, drop mixed-item union (WALM-163) - #908
HoangDucBach wants to merge 1 commit into
Conversation
Relayer hits and client decrypted memories were one union, so callers had to narrow a shape that never mixed at runtime.
ducnmm
left a comment
There was a problem hiding this comment.
Summary
The type split is correct for WALM-163 / GH #298: MemWal.recallManual() is RecallManualHitResult (no text), MemWalManual.recallManual() is RecallManualMemoryResult, and RecallManualResult is a deprecated alias of those two result types rather than a mixed-item array. Tests pin the emitted .d.ts. Version stays unpublished 0.1.7 (dev > main 0.1.6) — no bump. The landing defect is dump: packages/sdk/CHANGELOG.md has the WALM-163 bullet under ## 0.1.7, but docs/sdk/changelog.mdx does not (intro/answer: neither).
Issue counts by severity
- bugs: 1
- suggestions: 0
- nits: 0
| - Declare `engines.node >= 20.0.0`, matching `memwal-mcp` and `openclaw-memory-memwal`. The SDK was the only published package without a floor. (WALM-599) | ||
| - Empty-body 401s now use the same AUTH_REJECTED troubleshooting message as credential 401s instead of telling callers to run `memwal_login`. Headless SDK clients do not have that MCP tool. | ||
| - `account.ts` and `manual.ts` PTBs use typed `tx.pure` helpers instead of the legacy untyped moveCall argument syntax that fails under modern `@mysten/sui`. | ||
| - `MemWal.recallManual()` is typed as hits-only (`RecallManualHitResult`, no `text`). `MemWalManual.recallManual()` is typed as decrypted memories (`RecallManualMemoryResult`). The old `RecallManualResult` mixed-item union is a deprecated alias of those two result types. (#298, WALM-163) |
There was a problem hiding this comment.
[bug] WALM-163 is under unpublished ## 0.1.7 here, but docs/sdk/changelog.mdx has no matching bullet (and the 0.1.7 intro/answer: still omit it). origin/dev is already 0.1.7 vs origin/main 0.1.6 — do not bump.
Suggestion: Copy this bullet into docs/sdk/changelog.mdx under existing ## 0.1.7, and mention the type split in that release's intro + frontmatter answer:.
Ticket
WALM-163 — https://linear.app/mysten-labs/issue/WALM-163/bug-recallmanualresult-union-does-not-match-runtime-per-method-shape
GH #298 — #298
What changed?
MemWal.recallManual()is nowPromise<RecallManualHitResult>(blob_id + distance, notext).MemWalManual.recallManual()is nowPromise<RecallManualMemoryResult>(always hastext).RecallManualResultunion is a deprecated alias of those two result types.Why is this needed?
Callers of a single method always get one shape at runtime. The union forced
hit | memorynarrowing (or a cast) in strict TypeScript.Scope
TypeScript SDK types + docs. Runtime unchanged.
Out of scope
How was this tested?
Commands:
npm test --prefix packages/sdk(121 passed; includes hits-only / decrypted.d.tsassertions)Verify
const hits = await memwal.recallManual({ vector })—hits.results[0].blob_id/.distancetype-check without'text' in hitconst mems = await manual.recallManual(query)—mems.results[0].texttype-checks(RecallManualHit | RecallManualMemory)[]is gone fromdist/types.d.tsRisks
Types-only.
RecallManualResultremains exported as a deprecated alias so existing imports compile; method return types are the split shapes.Author checklist
npm test --prefix packages/sdk)