feat(sdk): add bootstrapState + listMessagesDirect + memfsStartup#54
feat(sdk): add bootstrapState + listMessagesDirect + memfsStartup#54
Conversation
…ption - types.ts: add BootstrapStateOptions, BootstrapStateResult types; add memfsStartup option to CreateSessionOptions and InternalSessionOptions - transport.ts: forward memfsStartup as --memfs-startup CLI flag - session.ts: add Session.bootstrapState() — single-round-trip cold-open API - index.ts: export new types; add standalone listMessagesDirect() for sessionless prefetch with memfs skip + minimal overhead - tests: 11 new tests (transport arg forwarding, type shapes, protocol contract) 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta <noreply@letta.com>
cpfiffer
left a comment
There was a problem hiding this comment.
Reviewed the full diff. Three features: bootstrapState(), listMessagesDirect(), and memfsStartup transport option.
Looks good overall. Clean separation, thorough tests, types are well-documented. A few observations:
1. listMessagesDirect creates and tears down a full session for a single API call.
That's a fresh CLI subprocess spawn, initialize, control request, close. For a "prefetch" use case this is fine, but worth noting in docs that it's not cheap. The memfsStartup: "skip" and skillSources: [] options help a lot -- good call.
2. bootstrapState depends on CLI-side bootstrap_session_state protocol.
The PR notes say "depends on letta-code headless protocol additions." This means the SDK side will silently hang or error if the CLI doesn't support this control request yet. There's no version check or feature detection. If someone upgrades the SDK without upgrading letta-code, bootstrapState() will time out. Consider adding a note in the JSDoc about the minimum letta-code version, or at least a clear error message if the response shape is unexpected.
3. Mock transport tests are protocol-shape tests, not behavioral tests.
The bootstrapState: protocol logic via mock tests verify the subtype string constant and CLI arg building, but don't actually test the request-response flow through session.bootstrapState(). The makeMockTransport helper is defined but never used. This is fine if live integration tests cover the real path, but worth noting the gap.
4. memfsStartup type is "blocking" | "background" | "skip" -- consistent naming.
Good. The CLI flag mapping in buildCliArgs is straightforward.
5. No changes to transformMessage or stream handling.
This PR is purely additive APIs + transport args. No risk to existing stream behavior.
No blocking issues. Approve with the suggestion to document the minimum letta-code version dependency for bootstrapState.
Summary
Notes
Validation