Skip to content

feat(sdk-ts): sessions (session/scoped) + lock down sdk/typescript to the facade-only layout - #1670

Merged
joelteply merged 3 commits into
canaryfrom
feat/sdk-ts-sessions
Jun 17, 2026
Merged

joelteply merged 3 commits into
canaryfrom
feat/sdk-ts-sessions

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What

The TypeScript twin of the merged Rust client surface (continuum-client, #1669), completing the sessions layer on the JS/web/desktop SDK. Mirrors the Rust semantics exactly so the conformance contract holds across both skins.

  • transport.ts — SessionIdentity { userId?, sessionId? } (Uuids as strings at the JSON boundary); Transport.session(); and stampContext(value, contextId) — the shared helper that stamps contextId as an envelope/payload sibling, the twin of CommandClient::stamp_context (objects only; no-op when unscoped; identity is never stamped — kernel-injected, unforgeable client-side).
  • Continuum.session (getter) + Continuum.scoped(contextId) → a scoped Continuum whose commands + events auto-stamp contextId. Same transport + identity, only the context differs.
  • Commands / Events carry the optional contextId and stamp via stampContext.

Conformance dimension 6 (sessions)

Added to Commands.test.ts — the contract the swift/kotlin/rust twins mirror name-for-name: session() surfaces established identity (never fabricated); scoped() auto-stamps contextId into both command envelope and event payload; unscoped stamps nothing (opt-in); scoped carries identity forward and leaves the parent unscoped.

The shape, now real on both skins

connect → session → scoped(context), identical for a browser tab and a persona. A persona's tool executor is just a scoped client.

Caveat

Not run locally (headless box, no node — by design). Written against the live facade API and mirrors the validated Rust (continuum-client: 23 tests green). Runs in CI where node is present.

Next

The persona TsIpcToolExecutor composed as a scoped client → fills tool_context() → acts-loop live (task #15). That one touches the cognition pipeline, so it gets its own careful slice (read PERSONA-COGNITION-PIPELINE.md first).

🤖 Generated with Claude Code

… of the Rust client

The TypeScript twin of the merged Rust client surface (continuum-client #1669),
completing the sessions layer on the JS/web/desktop SDK. Mirrors the Rust
semantics exactly so the conformance contract holds across both:

  - transport.ts: SessionIdentity { userId?, sessionId? } (Uuids as strings at
    the JSON boundary); Transport.session(); and stampContext(value, contextId)
    — the shared helper that stamps contextId as an envelope/payload sibling,
    the twin of CommandClient::stamp_context (only objects; no-op when unscoped;
    identity is NEVER stamped — kernel-injected, unforgeable client-side).
  - Continuum.session (getter) + Continuum.scoped(contextId) → a scoped Continuum
    whose commands + events auto-stamp contextId. Same transport + identity,
    only the context differs.
  - Commands / Events carry the optional contextId and stamp via stampContext.

Conformance dimension 6 (sessions) added to Commands.test.ts — the contract the
swift/kotlin/rust twins mirror name-for-name: session() surfaces established
identity (never fabricated); scoped() auto-stamps contextId into both command
envelope and event payload; unscoped stamps nothing (opt-in); scoped carries
identity forward + leaves the parent unscoped. MockTransport gains session().

Uniform shape now real on BOTH the Rust and TS skins: connect → session →
scoped(context), identical for a browser tab and a persona ([[persona-is-a-client]]).

Not run locally (headless box, no node — by design); written against the live
facade API + mirrors the validated Rust (continuum-client: 23 tests green).
Runs in CI where node is present.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The file is THE SDK conformance SPEC — the authoritative cross-language
specification (addressing, commands, events, handles, timing, sessions; six
dimensions the native twins implement against name-for-name), not a unit test
of Commands.ts. It started as a Commands sketch and kept that name; the name
lied twice — wrong scope (it's the whole facade) and 'test' framed the
load-bearing contract as incidental verification.

'spec' is what it is and what the team already calls it; the .spec.ts suffix
still runs under vitest (the executable specification), so the contract both
documents AND proves itself.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply force-pushed the feat/sdk-ts-sessions branch from ee4b092 to a08f6c5 Compare June 17, 2026 22:52
The folder was two SDKs jammed together: the new thin facade (transport,
Commands, Events, Handle, Continuum, index, conformance spec, generated/) AND a
full DUPLICATE of the legacy RustCoreIPC client (RustCore, RustCoreIPC, the 24
`modules/` mixins, ~12 hand-written wire types, and loose top-level test-*/
benchmark-*/verify-* scripts). Those loose `test-*.ts` scripts are exactly why
a conformance CONTRACT read as "just a test."

The duplicate is orphaned cruft: the canonical legacy client lives at
core/continuum-core/bindings/RustCoreIPC (CLAUDE.md's IPC-mixin location), and
all 108 src/ consumers import it from THERE. Verified nothing in the repo
imports the sdk/typescript copies — the package's public surface (index.ts) and
its only internal consumer (the conformance spec) reference the facade alone.

Removed the orphaned duplicate. sdk/typescript is now ONLY the thin typed client
its package.json describes:
  Continuum.ts · Commands.ts · Events.ts · Handle.ts · transport.ts  (facade)
  conformance.spec.ts                                                (the contract)
  generated/CommandMap.ts                                            (generated types)
  index.ts · package.json · tsconfig.json
Naming is now coherent: PascalCase = class-exporting module; lowercase =
types/util/spec/barrel; generated types isolated under generated/.

No behavior change, no consumer change (the deleted files had zero importers).
The canonical legacy bindings at core/continuum-core/bindings are untouched.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply joelteply changed the title feat(sdk-ts): session() + scoped(context) on the TS facade feat(sdk-ts): sessions (session/scoped) + lock down sdk/typescript to the facade-only layout Jun 17, 2026
@github-actions github-actions Bot added size: XL and removed size: M labels Jun 17, 2026
@joelteply
joelteply merged commit 9cea18b into canary Jun 17, 2026
2 checks passed
@joelteply
joelteply deleted the feat/sdk-ts-sessions branch June 17, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant