Skip to content

fix(sdk): type recallManual per method, drop mixed-item union (WALM-163) - #908

Open
HoangDucBach wants to merge 1 commit into
devfrom
wyner/walm-163-bug-recallmanualresult-union-does-not-match-runtime-per
Open

HoangDucBach wants to merge 1 commit into
devfrom
wyner/walm-163-bug-recallmanualresult-union-does-not-match-runtime-per

Conversation

@HoangDucBach

@HoangDucBach HoangDucBach commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

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 now Promise<RecallManualHitResult> (blob_id + distance, no text).
  • MemWalManual.recallManual() is now Promise<RecallManualMemoryResult> (always has text).
  • The old mixed-item RecallManualResult union 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 | memory narrowing (or a cast) in strict TypeScript.

Scope

TypeScript SDK types + docs. Runtime unchanged.

Out of scope

  • Python (already hits-only)
  • MCP
  • Relayer

How was this tested?

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not applicable

Commands: npm test --prefix packages/sdk (121 passed; includes hits-only / decrypted .d.ts assertions)

Verify

  • const hits = await memwal.recallManual({ vector }) — hits.results[0].blob_id / .distance type-check without 'text' in hit
  • const mems = await manual.recallManual(query) — mems.results[0].text type-checks
  • Omit and the old mixed (RecallManualHit | RecallManualMemory)[] is gone from dist/types.d.ts

Risks

Types-only. RecallManualResult remains exported as a deprecated alias so existing imports compile; method return types are the split shapes.

Author checklist

  • I ran the relevant tests (npm test --prefix packages/sdk)
  • I did not bump the unpublished 0.1.7 changelog
  • No secrets committed

Relayer hits and client decrypted memories were one union, so callers had to narrow a shape that never mixed at runtime.
@HoangDucBach
HoangDucBach requested a review from ducnmm September 14, 2026 01:20

@ducnmm ducnmm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread packages/sdk/CHANGELOG.md
- 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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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:.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants