@deepseek-ai/dsh-tool-cordis 0.1.2-alpha.5 → 0.1.3-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +430 -204
  2. package/package.json +15 -15
package/lib/index.js CHANGED
@@ -47,8 +47,8 @@ const SERVICE_API = [
47
47
  parameters: []
48
48
  },
49
49
  {
50
- signature: "create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Agent",
51
- description: "Create an agent and session under one caller-supplied identity, owned by the accessing fiber. Constructor-driven config calls mint a fresh combined id before entering this boundary.",
50
+ signature: "async create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Promise<Agent>",
51
+ description: "Create an agent and session under one caller-supplied identity, owned by the accessing fiber. Constructor-driven config calls mint a fresh combined id before entering this boundary. When a persistence backend is mounted, the session's durable identity and any seed are stored before publication.",
52
52
  parameters: [
53
53
  {
54
54
  name: "id",
@@ -464,7 +464,7 @@ const SERVICE_API = [
464
464
  description: "exact live sending Team member."
465
465
  }, {
466
466
  name: "request",
467
- description: "target name, content, scheduling mode, and pre-queue cancellation."
467
+ description: "target name, content, and pre-queue cancellation."
468
468
  }],
469
469
  returns: "durable message identity and immediate-delivery observation."
470
470
  },
@@ -653,6 +653,35 @@ const SERVICE_API = [
653
653
  }],
654
654
  returns: "durable normalized attachment references in the same order after every member succeeds."
655
655
  },
656
+ {
657
+ signature: "async admitPromptContent( content: readonly AttachmentAdmissionPart[], ): Promise<AdmittedPromptContentPart[]>",
658
+ description: "Admit one Host prompt and replace each uploaded image with its durable reference. Text and durable file references pass through unchanged. A prompt without image parts performs no storage operation.",
659
+ parameters: [{
660
+ name: "content",
661
+ description: "prompt parts in message order after file receipt resolution."
662
+ }],
663
+ returns: "admitted prompt parts in the same order as `content`.",
664
+ throws: ["AttachmentError when the image batch is refused."]
665
+ },
666
+ {
667
+ signature: "admitEncodedFile(input: EncodedFileAttachment): Promise<FileAttachmentRef>",
668
+ description: "Decode and durably commit one canonical base64 file upload.",
669
+ parameters: [{
670
+ name: "input",
671
+ description: "canonical base64 bytes and optional display name."
672
+ }],
673
+ returns: "the durable content-addressed file reference.",
674
+ throws: ["AttachmentError when the encoding or storage operation is refused."]
675
+ },
676
+ {
677
+ signature: "isAttachmentError(error: unknown): error is AttachmentError",
678
+ description: "Identify a failure emitted by this attachment capability by its stable code.",
679
+ parameters: [{
680
+ name: "error",
681
+ description: "value caught from an attachment operation."
682
+ }],
683
+ returns: "whether the value is an attachment failure."
684
+ },
656
685
  {
657
686
  signature: "abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>",
658
687
  description: "Validate and durably commit one image before its owning session event is appended. The returned reference describes the persisted normalized image. When normalization reduces the raster, its `originalDimensions` records the orientation-applied input dimensions.",
@@ -685,6 +714,46 @@ const SERVICE_API = [
685
714
  returns: "an absolute host path, or undefined when this backend is not host-file-backed.",
686
715
  throws: ["an AttachmentError when the durable reference is invalid."]
687
716
  },
717
+ {
718
+ signature: "saveFile(input: SaveFileAttachment): Promise<FileAttachmentRef>",
719
+ description: "Durably commit one file byte-for-byte before its owning session event is appended. Files carry no admission limits: any byte content and length is accepted, and the stored object is the exact submitted bytes. Backends without verbatim file storage keep this default rejection.",
720
+ parameters: [{
721
+ name: "input",
722
+ description: "exact bytes and optional display name."
723
+ }],
724
+ returns: "the durable content-addressed file reference."
725
+ },
726
+ {
727
+ signature: "saveFileStream(input: SaveFileStreamAttachment): Promise<FileAttachmentRef>",
728
+ description: "Durably commit one file byte-for-byte from bounded chunks. Providers must apply backpressure and must not collect the complete file in memory. Backends without streamed verbatim storage keep this default rejection.",
729
+ parameters: [{
730
+ name: "input",
731
+ description: "ordered exact bytes, optional cancellation, and display name."
732
+ }],
733
+ returns: "the durable content-addressed file reference."
734
+ },
735
+ {
736
+ signature: "async *readFileStream( ref: FileAttachmentRef, signal?: AbortSignal, ): AsyncIterable<Uint8Array>",
737
+ description: "Read and verify one verbatim stored file as bounded chunks. Providers must not collect the complete file in memory. Backends without verbatim file reads keep this default rejection.",
738
+ parameters: [{
739
+ name: "ref",
740
+ description: "durable reference from the session log."
741
+ }, {
742
+ name: "signal",
743
+ description: "optional cancellation for backend reads and verification work."
744
+ }],
745
+ returns: "exact file bytes in order; integrity failures reject the iteration."
746
+ },
747
+ {
748
+ signature: "fileHostPath(ref: FileAttachmentRef): string | undefined",
749
+ description: "Locate the verbatim stored file object in the harness host filesystem.",
750
+ parameters: [{
751
+ name: "ref",
752
+ description: "durable file reference."
753
+ }],
754
+ returns: "an absolute host path, or undefined when this backend is not host-file-backed.",
755
+ throws: ["an AttachmentError when the durable reference is invalid."]
756
+ },
688
757
  {
689
758
  signature: "readImageRequest( ref: ImageAttachmentRef, policy: ImageRequestPolicy, signal?: AbortSignal, ): Promise<RequestImageAttachment>",
690
759
  description: "Generate or read one deterministic model-request version from the stored normalized image.",
@@ -854,6 +923,15 @@ const SERVICE_API = [
854
923
  }],
855
924
  returns: "the exact effect disposer that unregisters this definition."
856
925
  },
926
+ {
927
+ signature: "registerFileReceiptResolver(resolver: CommandFileReceiptResolver): () => void",
928
+ description: "Register the sole authority that resolves staged file receipts for command submissions.",
929
+ parameters: [{
930
+ name: "resolver",
931
+ description: "Session-aware receipt resolver."
932
+ }],
933
+ returns: "disposer that removes this exact resolver."
934
+ },
857
935
  {
858
936
  signature: "@Remote list(agent: Agent): readonly CommandDescriptor[]",
859
937
  description: "List the effective immutable command descriptors for one agent.",
@@ -876,8 +954,8 @@ const SERVICE_API = [
876
954
  returns: "the scoped shadow or global definition."
877
955
  },
878
956
  {
879
- signature: "@Remote async execute( agent: Agent, line: string, images: readonly EncodedImageAttachment[], signal: AbortSignal, ): Promise<CommandExecution | undefined>",
880
- description: "Parse and execute a known command without sending it to the model.\n\nA resolved command's lifecycle is logged: `command/run` is appended before the handler is invoked and `command/done` after settlement (a thrown or aborted handler settles as `kind: 'error'`). Both are direct log-only appends — no turn wraps them, and persistence drains them at ordinary checkpoints. Admission misses (syntax or unknown name) log nothing — they never entered a handler. A `command/run` append failure fails the execution loud; a `command/done` append failure on the handler-failure path is contained so the handler's own error stays the reported failure.\n\nImage admission is enforced here, not in the composer: images sent to a command that does not declare `input.images`, an absent attachment store, and an exceeded attachment limit each settle as an error result before the handler runs, and a rejected batch publishes no durable object.",
957
+ signature: "@Remote async execute( agent: Agent, line: string, submittedAttachments: readonly CommandSubmitAttachment[], signal: AbortSignal, ): Promise<CommandExecution | undefined>",
958
+ description: "Parse and execute a known command without sending it to the model.\n\nA resolved command's lifecycle is logged: `command/run` is appended before the handler is invoked and `command/done` after settlement (a thrown or aborted handler settles as `kind: 'error'`). Both are direct log-only appends — no turn wraps them, and persistence drains them at ordinary checkpoints. Admission misses (syntax or unknown name) log nothing — they never entered a handler. A `command/run` append failure fails the execution loud; a `command/done` append failure on the handler-failure path is contained so the handler's own error stays the reported failure.\n\nAttachment admission is enforced here, not in the composer: attachments sent to a command that does not declare `input.attachments`, an absent attachment store, and an exceeded image limit each settle as an error result before the handler runs. Validation rejection starts no attachment writes; a storage failure can leave only unreachable content-addressed objects for deferred collection.",
881
959
  parameters: [
882
960
  {
883
961
  name: "agent",
@@ -888,8 +966,8 @@ const SERVICE_API = [
888
966
  description: "complete slash-command line."
889
967
  },
890
968
  {
891
- name: "images",
892
- description: "base64-encoded composer images accompanying the line, in submission order; empty for a plain invocation."
969
+ name: "submittedAttachments",
970
+ description: "encoded images and staged file receipts accompanying the line, in submission order; empty for a plain invocation."
893
971
  },
894
972
  {
895
973
  name: "signal",
@@ -1220,6 +1298,92 @@ const SERVICE_API = [
1220
1298
  returns: "deterministic path-only candidates."
1221
1299
  }]
1222
1300
  },
1301
+ {
1302
+ key: "fileUploads",
1303
+ summary: "Host service owning upload storage and Agent-scoped staged receipts.",
1304
+ description: "Host service owning upload storage and Agent-scoped staged receipts.",
1305
+ methods: [
1306
+ {
1307
+ signature: "registerAgentResolver(resolve: AgentResolver): () => void",
1308
+ description: "Register the ordinary-Session resolver used when a raw upload addresses a cold Session.",
1309
+ parameters: [{
1310
+ name: "resolve",
1311
+ description: "resolver that returns the exact live Agent or throws a Remote error."
1312
+ }],
1313
+ returns: "disposer removing this resolver."
1314
+ },
1315
+ {
1316
+ signature: "@Remote('upload') upload(agent: Agent, request: EncodedFileUploadRequest, signal: AbortSignal): Promise<FileUploadValue>",
1317
+ description: "Persist one encoded upload and stage it under the Agent receiver selected by Typert.",
1318
+ parameters: [
1319
+ {
1320
+ name: "agent",
1321
+ description: "receiving Agent resolved from the Remote Agent scope."
1322
+ },
1323
+ {
1324
+ name: "request",
1325
+ description: "canonical base64 bytes and optional display name."
1326
+ },
1327
+ {
1328
+ name: "signal",
1329
+ description: "caller cancellation before storage begins."
1330
+ }
1331
+ ],
1332
+ returns: "the staged receipt and durable file reference."
1333
+ },
1334
+ {
1335
+ signature: "async uploadStream(request: { readonly sessionId: SessionId readonly data: AsyncIterable<Uint8Array> readonly signal?: AbortSignal readonly name?: string }): Promise<FileUploadValue>",
1336
+ description: "Persist raw chunks for one Session without aggregating the upload.",
1337
+ parameters: [{
1338
+ name: "request",
1339
+ description: "Session identity, ordered bytes, cancellation, and optional display name."
1340
+ }],
1341
+ returns: "the staged receipt and durable file reference."
1342
+ },
1343
+ {
1344
+ signature: "resolve(agent: Agent, receiptId: FileUploadReceiptId): FileAttachmentRef | undefined",
1345
+ description: "Resolve one staged receipt inside its receiving Agent scope.",
1346
+ parameters: [{
1347
+ name: "agent",
1348
+ description: "receiving Agent."
1349
+ }, {
1350
+ name: "receiptId",
1351
+ description: "opaque receipt minted for one completed upload."
1352
+ }],
1353
+ returns: "durable file reference, or `undefined` for an unknown or foreign receipt."
1354
+ },
1355
+ {
1356
+ signature: "bindPrompt( agent: Agent, receiptIds: readonly FileUploadReceiptId[], requestId: string, ): PromptFileBinding",
1357
+ description: "Bind receipts while one prompt enters an Agent inbox. Disposal restores every prior binding unless the caller commits successful delivery.",
1358
+ parameters: [
1359
+ {
1360
+ name: "agent",
1361
+ description: "receiving Agent."
1362
+ },
1363
+ {
1364
+ name: "receiptIds",
1365
+ description: "distinct staged receipts referenced by the prompt."
1366
+ },
1367
+ {
1368
+ name: "requestId",
1369
+ description: "prompt identity later observed in queue or history."
1370
+ }
1371
+ ],
1372
+ returns: "binding kept after commit until queue or history observation retires its receipts."
1373
+ },
1374
+ {
1375
+ signature: "retirePrompt(agent: Agent, requestId: string): void",
1376
+ description: "Retire every receipt accepted by one removed queue occurrence.",
1377
+ parameters: [{
1378
+ name: "agent",
1379
+ description: "receiving Agent."
1380
+ }, {
1381
+ name: "requestId",
1382
+ description: "prompt identity carried by the queue occurrence."
1383
+ }]
1384
+ }
1385
+ ]
1386
+ },
1223
1387
  {
1224
1388
  key: "fs",
1225
1389
  summary: "Abstract filesystem provider.",
@@ -1826,6 +1990,15 @@ const SERVICE_API = [
1826
1990
  }],
1827
1991
  returns: "the owning adapter's image pricing for the route, when declared."
1828
1992
  },
1993
+ {
1994
+ signature: "fileRequestText(ref: FileAttachmentRef): string",
1995
+ description: "Resolve the exact text one durable file occurrence contributes to every provider request in the current execution environment.",
1996
+ parameters: [{
1997
+ name: "ref",
1998
+ description: "durable verbatim file reference from model history."
1999
+ }],
2000
+ returns: "the same deterministic handle text used at adapter dispatch."
2001
+ },
1829
2002
  {
1830
2003
  signature: "async listModels(provider: string): Promise<LlmModelInfo[]>",
1831
2004
  description: "Discover models advertised by one registered provider. Catalog membership is advisory and never changes routing or request validation.",
@@ -1916,35 +2089,35 @@ const SERVICE_API = [
1916
2089
  },
1917
2090
  {
1918
2091
  key: "messageFeedback",
1919
- summary: "Storage-domain sidecar service.",
1920
- description: "Storage-domain sidecar service. It inspects persisted Session history and never creates or resumes an Agent or Session.",
2092
+ summary: "Session-log service; cold operations never construct a Session or Agent.",
2093
+ description: "Session-log service; cold operations never construct a Session or Agent.",
1921
2094
  methods: [
1922
2095
  {
1923
- signature: "@Remote('list') async list(request: MessageFeedbackListRequest): Promise<MessageFeedbackListResult>",
1924
- description: "Read feedback belonging to the current persisted Session lifecycle. A stale row from a reused Session id is invisible.",
2096
+ signature: "@Remote('list') list(request: MessageFeedbackListRequest): Promise<MessageFeedbackListResult>",
2097
+ description: "Read current feedback from the canonical log.",
1925
2098
  parameters: [{
1926
2099
  name: "request",
1927
- description: "Session identity to inspect and list."
2100
+ description: "Session to inspect."
1928
2101
  }],
1929
- returns: "current immutable items or `session-not-found`."
2102
+ returns: "immutable items or a definite persistence miss."
1930
2103
  },
1931
2104
  {
1932
2105
  signature: "@Remote('put') put(request: MessageFeedbackPutRequest): Promise<MessageFeedbackPutResult>",
1933
- description: "Create or replace feedback for one derived append-origin assistant message. Every request must match the addressed item's current version; a matching no-op returns the stored item without changing its revision.",
2106
+ description: "Create or replace feedback after checking its current version. Matching no-ops retain the version and append no event.",
1934
2107
  parameters: [{
1935
2108
  name: "request",
1936
- description: "target, desired value, and observed item version."
2109
+ description: "Target, desired value, and observed item version."
1937
2110
  }],
1938
- returns: "the committed item or an explicit business failure."
2111
+ returns: "the durable item or an explicit business failure."
1939
2112
  },
1940
2113
  {
1941
2114
  signature: "@Remote('delete') delete(request: MessageFeedbackDeleteRequest): Promise<MessageFeedbackDeleteResult>",
1942
- description: "Delete one feedback item. Absence is successful regardless of the supplied version; an existing item requires an exact version match.",
2115
+ description: "Delete one item after checking its version; absence succeeds without an event.",
1943
2116
  parameters: [{
1944
2117
  name: "request",
1945
2118
  description: "Session, message, and observed item version."
1946
2119
  }],
1947
- returns: "the stable absent postcondition, or an explicit failure."
2120
+ returns: "the stable absent postcondition or an explicit failure."
1948
2121
  }
1949
2122
  ]
1950
2123
  },
@@ -2253,7 +2426,7 @@ const SERVICE_API = [
2253
2426
  name: "signal",
2254
2427
  description: "cancellation owned by the Remote stream carrier."
2255
2428
  }],
2256
- returns: "a complete opening snapshot followed by gap-free event frames."
2429
+ returns: "a complete opening snapshot followed by gap-free durable event frames and optional cursorless assistant-stream frames."
2257
2430
  },
2258
2431
  {
2259
2432
  signature: "@Remote({ mode: 'stream' }) control(signal: AbortSignal): AsyncIterable<SessionControlFrame>",
@@ -2292,147 +2465,69 @@ const SERVICE_API = [
2292
2465
  },
2293
2466
  {
2294
2467
  key: "sessionPersistence",
2295
- summary: "Durable append-only session storage.",
2296
- description: "Durable append-only session storage. Implementations preserve contiguous, losslessly JSON-serializable events; append resolves only after durability, and load balances a complete interrupted tail without rewriting committed events.",
2468
+ summary: "Durable append-only session storage addressed through per-session handles.",
2469
+ description: "Durable append-only session storage addressed through per-session handles.\n\nStorage semantics shared by every backend: events are contiguous from seq 0 and never rewritten; a torn physical tail is never returned to a reader and is truncated by the write path before its first append; reads validate current-format records only and refuse unknown vocabulary fail-closed. `append` persists best-effort; `flush` — per handle or service-wide — is the durability barrier.\n\nVisibility: a created session is observable through `stat`/`list`/`open` in this process from the moment `create` resolves, even while a backend defers physical materialization (a pure optimization); other processes see the session only once it materializes, and a session that never materialized before a crash never existed. `SessionHandle.flush` forces materialization.\n\nFreshness: once an `append` or `flush` resolves, reads started afterwards on this backend instance observe at least that prefix.",
2297
2470
  methods: [
2298
2471
  {
2299
- signature: "abstract locate(meta: SessionHeader): SessionLocation | undefined",
2300
- description: "Resolve this backend's independent local artifact for a session without reading, creating, flushing, or otherwise materializing it. A backend that does not own one artifact per Session returns `undefined`.",
2301
- parameters: [{
2302
- name: "meta",
2303
- description: "the immutable session header whose artifact is requested."
2304
- }],
2305
- returns: "the backend-specific absolute location, when one exists."
2306
- },
2307
- {
2308
- signature: "abstract readonly supportsRawArtifacts: boolean",
2309
- description: "Whether this backend exposes one verbatim raw artifact per session. A backend that declares `true` must override readRaw.",
2310
- parameters: []
2311
- },
2312
- {
2313
- signature: "readRaw(_id: SessionId, signal?: AbortSignal): Promise<SessionRawArtifact | undefined>",
2314
- description: "Read a session's backend-owned artifact text verbatim — the exact durable bytes the backend wrote (decoded from its physical encoding, e.g. a decompressed JSONL). The returned `content` is the raw text, not a reconstruction from parsed events, so it preserves backend-specific serialization (chunk packing, key order, line breaks). Callers first test supportsRawArtifacts; `undefined` then means only that the requested session has no materialized artifact.",
2315
- parameters: [{
2316
- name: "_id",
2317
- description: "the persisted session to read (unused by the default: no per-session artifact)."
2318
- }, {
2319
- name: "signal",
2320
- description: "optional cancellation for backend read work."
2321
- }],
2322
- returns: "the raw artifact plus its parsed header, or `undefined` when the session is absent.",
2323
- throws: ["when this backend does not expose per-session raw artifacts."]
2324
- },
2325
- {
2326
- signature: "abstract create(meta: SessionHeader, inheritedEventCount?: SessionLogOffset): Promise<void>",
2327
- description: "Register a new session's metadata. A backend MAY defer the physical write until the first append (lazy materialization), in which case a created-but-never-appended session is absent from list — abandoned sessions leave nothing behind.",
2328
- parameters: [{
2329
- name: "meta",
2330
- description: "the immutable header (id, version, cwd, lineage) to record."
2331
- }, {
2332
- name: "inheritedEventCount",
2333
- description: "exact fork-inherited prefix length. Required for a seeded header and omitted only for an unseeded header."
2334
- }]
2335
- },
2336
- {
2337
- signature: "ensureMaterialized(_session: Session): Promise<void>",
2338
- description: "Ensure a live session has a durable header even when it has no events. Ordinary sessions remain lazily materialized; lifecycle frontends call this only when an empty session itself is a durable resumable resource.",
2339
- parameters: [{
2340
- name: "_session",
2341
- description: "exact live session whose registered header is materialized."
2342
- }]
2343
- },
2344
- {
2345
- signature: "abstract append(id: SessionId, events: readonly SessionEvent[]): Promise<void>",
2346
- description: "Durably persist a batch of events. Honors the append-only and contiguous- seq contracts: the first event's `seq` MUST equal the stored next-seq (after `load` has durably closed any interrupted turn). Rejects non-JSON- serializable `event.data` with an error naming the offending event type. A seeded session's first materializing batch must reach its complete inherited prefix.",
2347
- parameters: [{
2348
- name: "id",
2349
- description: "the session the batch belongs to."
2350
- }, {
2351
- name: "events",
2352
- description: "the contiguous batch to persist, in seq order."
2353
- }]
2354
- },
2355
- {
2356
- signature: "async prepare(id: SessionId, signal?: AbortSignal): Promise<SessionPreparation>",
2357
- description: "Prepare the exact unpublished Session used by resume. Implementations may reuse object graphs retained by an earlier inspect after confirming their durable revision is still current; disposal releases an unpublished reservation. Revision retries require the durable log to remain unchanged for one read/check round trip; continuous external writers may delay completion.",
2358
- parameters: [{
2359
- name: "id",
2360
- description: "persisted session to prepare."
2361
- }, {
2362
- name: "signal",
2363
- description: "optional cancellation for preparation work."
2364
- }],
2365
- returns: "one owned unpublished Session preparation."
2366
- },
2367
- {
2368
- signature: "abstract load(id: SessionId): Promise<SessionInspection>",
2369
- description: "Load an immutable balanced logical view and commit any required cold recovery. A complete interrupted final turn is preserved and durably closed with missing tool errors plus any open step and turn boundaries; only a torn final record is discarded. Unknown versions and corruption in the committed prefix reject. Implementations MUST NOT crash-repair an identity still bound to a live Session: a balanced live log may return as a durable snapshot, while an open live turn rejects. Returned values may be shared with immutable live or prepared state and must not be mutated. Revision-based implementations may wait for one stable read/check round trip.",
2472
+ signature: "abstract create(header: SessionHeader, options?: SessionPersistenceCreateOptions): Promise<SessionHandle>",
2473
+ description: "Create a new stored session and take its write ownership.",
2370
2474
  parameters: [{
2371
- name: "id",
2372
- description: "the persisted session to reload."
2373
- }],
2374
- returns: "the header and a log ending on a balanced `turn/end`."
2375
- },
2376
- {
2377
- signature: "abstract inspect(id: SessionId, signal?: AbortSignal): Promise<SessionInspection>",
2378
- description: "Inspect an immutable logical session without committing recovery or publishing it. A cold complete interrupted turn receives synthetic closers in memory and a torn physical tail remains untouched. An already-live Session instead yields its current immutable snapshot, which may contain an open turn and its `session/end-seed` boundary. Coordinator-backed implementations retain the exact cold unpublished Session for bounded reuse by a later prepare. A stale ready source is reloaded; a source already committing or reserved for resume remains exclusive, and inspection may borrow its immutable view. Callers borrow only the immutable header and log. Continuous external writers may delay revision convergence.",
2379
- parameters: [{
2380
- name: "id",
2381
- description: "the persisted session to inspect."
2475
+ name: "header",
2476
+ description: "the immutable header (id, version, cwd, lineage) to store."
2382
2477
  }, {
2383
- name: "signal",
2384
- description: "optional cancellation for queued and backend read work."
2385
- }],
2386
- returns: "the validated header and current logical event log."
2387
- },
2388
- {
2389
- signature: "abstract borrowSession(id: SessionId, signal?: AbortSignal): Promise<BorrowedSessionSource>",
2390
- description: "Borrow one exact inspection while retaining any reusable prepared source. A cold observation must pin the exact prepared Session that a later prepare reserves. Implementations must not degrade this operation to a detached inspect result.",
2391
- parameters: [{
2392
- name: "id",
2393
- description: "persisted session to observe."
2394
- }, {
2395
- name: "signal",
2396
- description: "optional cancellation for preparation work."
2478
+ name: "options",
2479
+ description: "optional cancellation."
2397
2480
  }],
2398
- returns: "a disposable immutable observation."
2481
+ returns: "a `write` handle owned by the caller; close it to release ownership.",
2482
+ throws: ["{SessionAlreadyExistsError} when the id already exists."]
2399
2483
  },
2400
2484
  {
2401
- signature: "abstract readFrom(id: SessionId, fromSeq: SessionLogOffset, signal?: AbortSignal): Promise<SessionEventSuffix>",
2402
- description: "Read the stored events from `fromSeq` onward — the read-from-seq primitive for read models that resume from a watermark (e.g. a persisted projection cache folding only the tail past its checkpoint). Unlike inspect, it is a detached physical suffix read: no preparation cache, torn-tail truncation, synthetic closers, or coordinator-state publication. Only events from the valid contiguous stored prefix are returned, so a torn fragment never reaches the caller. `fromSeq` at or beyond the stored prefix returns an empty event list (never an error). A backend whose medium can seek by seq may read only the suffix; sequential media such as JSONL still parse the whole artifact and skip forward. The primitive bounds what is returned and refolded, not every backend's physical read.",
2485
+ signature: "abstract open(id: SessionId, access: SessionAccess, options?: SessionPersistenceOpenOptions): Promise<SessionHandle>",
2486
+ description: "Open an existing stored session.\n\n`read` never takes ownership and works while another handle (or process) holds write ownership. `write` atomically claims single-writer ownership; an existing active owner rejects.",
2403
2487
  parameters: [
2404
2488
  {
2405
2489
  name: "id",
2406
- description: "the persisted session to read."
2490
+ description: "the stored session to open."
2407
2491
  },
2408
2492
  {
2409
- name: "fromSeq",
2410
- description: "first event offset to include."
2493
+ name: "access",
2494
+ description: "`read` or `write`."
2411
2495
  },
2412
2496
  {
2413
- name: "signal",
2414
- description: "optional cancellation for queued and backend read work."
2497
+ name: "options",
2498
+ description: "optional cancellation."
2415
2499
  }
2416
2500
  ],
2417
- returns: "storage metadata, the requested offset, and stored events with `seq >= fromSeq`."
2501
+ returns: "the open handle.",
2502
+ throws: ["{SessionPersistenceNotFoundError} when the session does not exist.", "{SessionAlreadyOwnedError} for `write` when ownership is taken."]
2503
+ },
2504
+ {
2505
+ signature: "abstract flush(): Promise<void>",
2506
+ description: "Flush every active write handle owned by this service instance in one durability barrier: each handle's routed live events drain durably and its session materializes, exactly as that handle's own `SessionHandle.flush` would. Read handles buffer nothing and are untouched. A handle closed concurrently counts as flushed — close itself drains durably.",
2507
+ parameters: [],
2508
+ returns: "resolution once every write handle active at the call has flushed.",
2509
+ throws: ["{AggregateError} naming each session whose flush failed; the remaining handles still flush."]
2418
2510
  },
2419
2511
  {
2420
- signature: "abstract list(signal?: AbortSignal): Promise<SessionHeader[]>",
2421
- description: "Lightweight listing from metadata, without a full-log parse.",
2512
+ signature: "abstract stat(id: SessionId, options?: SessionPersistenceStatOptions): Promise<SessionPersistenceSnapshot | undefined>",
2513
+ description: "Observe one stored session without reading its event log or taking ownership.\n\nThe snapshot's `revision` is an opaque change token comparable only against revisions from the same service instance and session id: equal revisions may be treated as an unchanged log; unequal revisions promise nothing. Write-ownership churn does not change a revision. It exists for derived read-model caches keyed off `stat`/`list`; it plays no part in open, read, or resume.",
2422
2514
  parameters: [{
2423
- name: "signal",
2424
- description: "optional cancellation for backend listing work."
2515
+ name: "id",
2516
+ description: "the stored session to observe."
2517
+ }, {
2518
+ name: "options",
2519
+ description: "optional cancellation."
2425
2520
  }],
2426
- returns: "one header per materialized session."
2521
+ returns: "the snapshot, or `undefined` when the session does not exist."
2427
2522
  },
2428
2523
  {
2429
- signature: "abstract listSnapshots(signal?: AbortSignal): Promise<SessionPersistenceSnapshot[]>",
2430
- description: "List materialized sessions with cheap per-log change tokens.\n\nRepeated observations of an unchanged log return the same revision. A successful mutating load repair changes the next listed revision. Revisions also distinguish independently backed stores so backend-local counters cannot compare equal across different persistence sources.",
2524
+ signature: "abstract list(options?: SessionPersistenceListOptions): Promise<readonly SessionPersistenceSnapshot[]>",
2525
+ description: "List every stored session visible to this process, in no promised order.",
2431
2526
  parameters: [{
2432
- name: "signal",
2433
- description: "optional cancellation for backend snapshot-listing work."
2527
+ name: "options",
2528
+ description: "optional cancellation."
2434
2529
  }],
2435
- returns: "one header and opaque revision per materialized session without loading full logs."
2530
+ returns: "one snapshot per stored session."
2436
2531
  }
2437
2532
  ]
2438
2533
  },
@@ -2460,6 +2555,18 @@ const SERVICE_API = [
2460
2555
  ],
2461
2556
  returns: "the cut (`asOfSeq` = lowest served-row watermark), or `undefined` when no usable row exists for this lifecycle."
2462
2557
  },
2558
+ {
2559
+ signature: "cachedPredecessorTitle( meta: SessionHeader, inheritedEventCount: SessionLogOffset, ): ProjectionSnapshot | undefined",
2560
+ description: "Read only a predecessor checkpoint's title as a zero-I/O listing hint.\n\nThe authoritative Session header supplies the lifecycle identity. A cache checkpoint can lag that log but cannot lead it because writes flush the log first, so a matching predecessor title is a genuine (possibly stale) fact from this Session. The registry still requires the current title projection's row version and schema. No other predecessor projection is exposed: format normalization can change their current meaning, and the strict cachedSnapshot / hydration paths continue to reject them.",
2561
+ parameters: [{
2562
+ name: "meta",
2563
+ description: "authoritative listed Session header."
2564
+ }, {
2565
+ name: "inheritedEventCount",
2566
+ description: "exact inherited cut completing the lifecycle identity."
2567
+ }],
2568
+ returns: "a title-only checkpoint view with `asOfSeq: -1`, or `undefined` when the record is current, newer, unrelated, missing, or incompatible with the title unit. The sentinel avoids reusing a sequence that a cardinality-changing Session migration may have remapped."
2569
+ },
2463
2570
  {
2464
2571
  signature: "hydratePrepared( session: Session, events: readonly SessionEvent[], ): ProjectionSnapshot",
2465
2572
  description: "Hydrate projection cells for an already-prepared Session without another persistence read. The cache seeds matching rows; the supplied exact log advances every unit to the observation cut. No checkpoint is written because the logical observation may contain recovery events not yet durable.",
@@ -2586,7 +2693,7 @@ const SERVICE_API = [
2586
2693
  name: "checkpoint",
2587
2694
  description: "persisted rows for one session (possibly stale or empty)."
2588
2695
  }],
2589
- returns: "the seq to hand the persistence `readFrom`, or `undefined` when no unit is registered (no read needed — {@link restore} would serve empty values regardless)."
2696
+ returns: "the offset for the stored-log suffix read (`SessionHandle.read`), or `undefined` when no unit is registered (no read needed — {@link restore} would serve empty values regardless)."
2590
2697
  },
2591
2698
  {
2592
2699
  signature: "viewCheckpoint( checkpoint: ProjectionCheckpoint, keys?: readonly Extract<keyof SessionProjectionMap, string>[], ): Partial<SessionProjectionMap>",
@@ -2602,7 +2709,7 @@ const SERVICE_API = [
2602
2709
  },
2603
2710
  {
2604
2711
  signature: "restore( checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq: SessionLogOffset, header: SessionHeader, inheritedEventCount: SessionLogOffset, ): { snapshot: ProjectionSnapshot; checkpoint: ProjectionCheckpoint }",
2605
- description: "Cold read: fold every persisted unit over a stored log suffix, seeding each from its checkpoint row when usable — the one read recipe (cached state + forward tail replay + `view`) applied without a live `Session`. Call with the events returned by a persistence `readFrom(id, restoreFloor(checkpoint))` and that same floor as `baseSeq`; the floor's one-below anchor makes the supplied end honest, so a shrunk log is detected here. A row is usable iff its `ver` matches the live unit's `stateVersion`, it does not predate `baseSeq` (`seq >= baseSeq - 1`), and it does not claim events past the supplied end (`seq <= endSeq`); an unusable row is discarded and its key refolds from `init` — which is only sound over the full log, so a discarded row with `baseSeq > 0` throws (the caller re-reads from seq 0, e.g. after a crash-repair truncation shrank the log below a row's watermark).",
2712
+ description: "Cold read: fold every persisted unit over a stored log suffix, seeding each from its checkpoint row when usable — the one read recipe (cached state + forward tail replay + `view`) applied without a live `Session`. Call with the stored events at or past `restoreFloor(checkpoint)` (a `SessionHandle.read` slice) and that same floor as `baseSeq`; the floor's one-below anchor makes the supplied end honest, so a shrunk log is detected here. A row is usable iff its `ver` matches the live unit's `stateVersion`, it does not predate `baseSeq` (`seq >= baseSeq - 1`), and it does not claim events past the supplied end (`seq <= endSeq`); an unusable row is discarded and its key refolds from `init` — which is only sound over the full log, so a discarded row with `baseSeq > 0` throws (the caller re-reads from seq 0, e.g. after a crash-repair truncation shrank the log below a row's watermark).",
2606
2713
  parameters: [
2607
2714
  {
2608
2715
  name: "checkpoint",
@@ -2880,7 +2987,7 @@ const SERVICE_API = [
2880
2987
  },
2881
2988
  {
2882
2989
  signature: "async prepare( agent: Agent, content: ContentBlock[], references: SessionReferenceInput[], signal?: AbortSignal, ): Promise<PreparedReferencedMessage>",
2883
- description: "Snapshot all references for one accepted direct message and return one aggregated durable context.",
2990
+ description: "Snapshot all references for one accepted direct message and return one aggregated durable context. Automatic budgets use the last assembled route, or agent options before any assembly. Missing model capacity or adapter uses 64 KiB; other metadata lookup failures and cancellation reject preparation. Truncated previews include omission facts and a full-snapshot spill locator, or an explicit unavailable notice. Cancellation prevents context publication, including when storage completes after cancellation.",
2884
2991
  parameters: [
2885
2992
  {
2886
2993
  name: "agent",
@@ -2906,7 +3013,7 @@ const SERVICE_API = [
2906
3013
  {
2907
3014
  key: "sessions",
2908
3015
  summary: "In-memory session store (`ctx.sessions`).",
2909
- description: "In-memory session store (`ctx.sessions`).\n\nPersistence is intentionally not implemented here — persistence plugins subscribe to `session/event` and flush on `session/flush` / dispose.",
3016
+ description: "In-memory session store (`ctx.sessions`).\n\nPersistence is intentionally not implemented here — the agent lifecycle attaches a session-log writer to each published session's write handle; a session published outside that lifecycle persists nothing.",
2910
3017
  methods: [
2911
3018
  {
2912
3019
  signature: "create(id?: SessionId, options?: CreateSessionOptions): Session",
@@ -2929,7 +3036,7 @@ const SERVICE_API = [
2929
3036
  description: "the session id; omitted, the store mints `session-<n>`."
2930
3037
  }, {
2931
3038
  name: "options",
2932
- description: "seed events and/or creation metadata for the header. With `seedSource: 'persistence'`, metadata and events must be fresh detached graphs whose ownership transfers to this call: they are validated and frozen in place through {@link Session.fromRestore}, so the caller must retain no mutable aliases."
3039
+ description: "seed events and/or creation metadata for the header. With `eventState`, every seed event is either independently owned or any shared value is deeply frozen; {@link Session.fromRestore} validates and adopts those values without copying or freezing them."
2933
3040
  }],
2934
3041
  returns: "the constructed session, NOT yet in the store.",
2935
3042
  throws: ["if a session with `id` already exists, metadata is not a plain lossless-JSON record with valid scalar fields, or `meta.cwd` is a non-absolute path."]
@@ -3024,7 +3131,7 @@ const SERVICE_API = [
3024
3131
  methods: [
3025
3132
  {
3026
3133
  signature: "abstract readonly sharing: SessionTelemetrySharingStatus",
3027
- description: "Deployment-selected session-sharing policy, disclosed for acknowledgement surfaces that report whether recorded feedback leaves the process. Every backend must disclose its policy; a consumer renders \"not configured\" only when no telemetry service is mounted. The seam owns this vocabulary so the disclosure is backend-independent.",
3134
+ description: "Deployment-selected sharing mode, independent of SDK delivery.",
3028
3135
  parameters: []
3029
3136
  },
3030
3137
  {
@@ -3666,10 +3773,10 @@ const SERVICE_API = [
3666
3773
  },
3667
3774
  {
3668
3775
  signature: "@Remote('prompt') async prompt(request: SubagentPromptRequest, signal: AbortSignal): Promise<SubagentPromptReceipt>",
3669
- description: "Deliver one browser-authored message to a continuable child through the exact live direct parent, retaining the caller-minted request identity and validated browser zone on the accepted message. Success identifies the message the child's FIFO inbox accepted; later execution is independent of this call. Image parts are admitted and persisted through the attachment store before delivery, and the child's model must accept image input.",
3776
+ description: "Deliver one browser-authored message to a continuable child through the exact live direct parent, retaining the caller-minted request identity and validated browser zone on the accepted message. Success identifies the message the child's inbox accepted; later execution is independent of this call. Queue delivery targets a later turn; steer delivery targets the nearest step and retains the Agent loop's best-effort fallback semantics. Image parts are admitted and persisted through the attachment store before delivery, and the child's model must accept image input.",
3670
3777
  parameters: [{
3671
3778
  name: "request",
3672
- description: "durable address, minted identity, content, and optional browser zone."
3779
+ description: "durable address, delivery, minted identity, content, and optional browser zone."
3673
3780
  }, {
3674
3781
  name: "signal",
3675
3782
  description: "carrier cancellation, owning the call until inbox acceptance."
@@ -3738,7 +3845,7 @@ const SERVICE_API = [
3738
3845
  {
3739
3846
  key: "subprocess",
3740
3847
  summary: "Abstract subprocess service.",
3741
- description: "Abstract subprocess service. Subclass, implement spawn, and load the subclass as a plugin — it registers as `ctx.subprocess` (one implementation per context; loading a second throws, which is cordis' standard duplicate-service behavior).\n\nImplementations must honor these semantics:\n\n- Executable paths belong to one execution world shared with the mounted filesystem provider.\n- spawn returns immediately with a live handle; `done` resolves at process close with exit facts and rejects only for spawn-level failures.\n- Collect-mode readers are offset-based and non-consuming, so independent readers never consume one another's output; lossy reads report truncation and the spill file holding the complete stream when one exists. Piped streams are handed to the caller raw and never buffered here.\n- SubprocessHandle.terminate (and the spec's abort signal) escalates SIGTERM→grace→SIGKILL — the only termination verb — tree-scoped on every platform. SubprocessHandle.waitForExit observes whole-tree liveness, so a consumer-owned teardown ladder can hold each tier on real quiescence.\n- Disposal of the service terminates all still-running managed processes and awaits their exit.\n- spawnTerminal owns terminal allocation, text transport, foreground groups, signalling, and whole-session quiescence behind one awaited termination method; readiness and persistent-shell policy stay in the PTY consumer. Its output stream ends after queued terminal output when the top-level process exits.",
3848
+ description: "Abstract subprocess service. Subclass, implement spawn, and load the subclass as a plugin — it registers as `ctx.subprocess` (one implementation per context; loading a second throws, which is cordis' standard duplicate-service behavior).\n\nImplementations must honor these semantics:\n\n- Executable paths belong to one execution world shared with the mounted filesystem provider.\n- spawn returns a live handle synchronously. Target identity remains provider-private; `done` resolves with the spawned command's exit facts and may reject for spawn or provider failures.\n- Collect-mode readers are offset-based and non-consuming, so independent readers never consume one another's output; lossy reads report truncation and the spill file holding the complete stream when one exists. Piped streams are handed to the caller raw and never buffered here.\n- SubprocessHandle.terminate (and the spec's abort signal) starts the provider's documented procedure against its managed range. SubprocessHandle.waitForExit observes that same range so a consumer-owned teardown ladder can hold each tier on real quiescence; each provider documents its signalling and observability limits.\n- Disposal of the service terminates all still-running managed processes and awaits their exit.\n- spawnTerminal owns terminal allocation, text transport, foreground groups, signalling, and whole-session quiescence behind one awaited termination method; readiness and persistent-shell policy stay in the PTY consumer. Its output stream ends after queued terminal output when the top-level process exits.",
3742
3849
  methods: [
3743
3850
  {
3744
3851
  signature: "abstract resolveExecutable( command: string, env?: Readonly<Record<string, string>>, signal?: AbortSignal, ): Promise<string>",
@@ -3766,11 +3873,12 @@ const SERVICE_API = [
3766
3873
  name: "spec",
3767
3874
  description: "argv, directory, stdio dispositions, grace, cancellation, and environment."
3768
3875
  }],
3769
- returns: "the live process handle (streams/readers, signalling, outcome promise)."
3876
+ returns: "the live process handle (streams/readers, signalling, outcome promise).",
3877
+ throws: ["synchronously when pre-aborted or when argv, cwd, environment, or grace is invalid before handle creation."]
3770
3878
  },
3771
3879
  {
3772
3880
  signature: "abstract spawnTerminal(spec: SubprocessTerminalSpawnSpec): Promise<SubprocessTerminalHandle>",
3773
- description: "Allocate a real terminal and start one owned process session. This is the only non-pipe process primitive: implementations own terminal byte I/O, foreground groups, signals, and complete session-tree cleanup.",
3881
+ description: "Allocate a real terminal and start one owned process session. This is the only non-pipe process primitive: implementations own terminal byte I/O, foreground groups, signals, and whole-session quiescence.",
3774
3882
  parameters: [{
3775
3883
  name: "spec",
3776
3884
  description: "fully specified argv, cwd, environment, dimensions, grace, and allocation cancellation."
@@ -4541,10 +4649,10 @@ const SERVICE_API = [
4541
4649
  methods: [
4542
4650
  {
4543
4651
  signature: "async create(path: string, title?: string): Promise<Workspace>",
4544
- description: "Create or reuse a workspace for an existing directory. The path is canonicalized through `fs.realpath`; a nonexistent path rejects with the original error and a non-directory rejects. Repeated calls for the same canonical path return the existing entity without changing its title. A newly created workspace is prepended to the durable registry order. Different canonical paths may share a display title.",
4652
+ description: "Create or reuse a workspace for an existing directory. The fully qualified path is canonicalized through `fs.realpath`; a relative, nonexistent, or non-directory path rejects. Repeated calls for the same canonical path return the existing entity without changing its title. A newly created workspace is prepended to the durable registry order. Different canonical paths may share a display title.",
4545
4653
  parameters: [{
4546
4654
  name: "path",
4547
- description: "Existing directory to own, in any path spelling."
4655
+ description: "Existing directory to own, in a fully qualified path spelling."
4548
4656
  }, {
4549
4657
  name: "title",
4550
4658
  description: "Display title used only when a new record is created."
@@ -4601,7 +4709,7 @@ const SERVICE_API = [
4601
4709
  description: "Resolve by canonical directory path without creating or mutating a workspace. A missing path rejects during `realpath`; an existing unowned directory returns `undefined`.",
4602
4710
  parameters: [{
4603
4711
  name: "path",
4604
- description: "Existing directory path in any spelling."
4712
+ description: "Existing directory path in a fully qualified spelling."
4605
4713
  }],
4606
4714
  returns: "the workspace owning the canonical path, when one exists."
4607
4715
  }
@@ -4635,6 +4743,17 @@ const EVENT_API = [
4635
4743
  description: "the preset recorded by the committed selection."
4636
4744
  }]
4637
4745
  },
4746
+ {
4747
+ name: "agent/assistant-stream",
4748
+ mode: "emit",
4749
+ signature: "'agent/assistant-stream'(this: Scoped<Agent>, payload: { agent: Agent; frame: AssistantStreamFrame }): void",
4750
+ summary: "Process-local assistant-stream publication.",
4751
+ description: "Process-local assistant-stream publication. Chunk frames are transient; the loop appends one final v2 `assistant/message` or `assistant/attempt` with the same stream before a committed end frame.",
4752
+ parameters: [{
4753
+ name: "payload",
4754
+ description: ".frame - one ordered start, chunk, or end publication. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent."
4755
+ }]
4756
+ },
4638
4757
  {
4639
4758
  name: "agent/created",
4640
4759
  mode: "emit",
@@ -4963,6 +5082,17 @@ const EVENT_API = [
4963
5082
  description: "domain, table (`''` for global), key (`''` for global), operation discriminant, and on `put` the new snapshot."
4964
5083
  }]
4965
5084
  },
5085
+ {
5086
+ name: "feedback/committed",
5087
+ mode: "parallel",
5088
+ signature: "'feedback/committed'(inspection: SessionInspection): void",
5089
+ summary: "Observe a durable cold feedback mutation without publishing a live Session.",
5090
+ description: "Observe a durable cold feedback mutation without publishing a live Session. Observers run before write ownership is released and must not await another message-feedback operation for this Session. The payload is borrowed read-only; deep-clone it before transferring ownership (for example, to Session.fromRestore).",
5091
+ parameters: [{
5092
+ name: "inspection",
5093
+ description: "committed canonical prefix, including the feedback as its last event."
5094
+ }]
5095
+ },
4966
5096
  {
4967
5097
  name: "fs/edit-intent",
4968
5098
  mode: "waterfall",
@@ -5392,6 +5522,10 @@ const TYPE_API = [
5392
5522
  name: "AdapterRegistrationHandle",
5393
5523
  declaration: "export interface AdapterRegistrationHandle {\n (): void;\n replace(providers: string[]): void;\n}"
5394
5524
  },
5525
+ {
5526
+ name: "AdmittedPromptContentPart",
5527
+ declaration: "export type AdmittedPromptContentPart = {\n readonly type: 'text';\n readonly text: string;\n} | {\n readonly type: 'image';\n readonly attachment: ImageAttachmentRef;\n} | {\n readonly type: 'file';\n readonly attachment: FileAttachmentRef;\n};"
5528
+ },
5395
5529
  {
5396
5530
  name: "Agent",
5397
5531
  declaration: "export interface Agent {\n readonly id: SessionId;\n}"
@@ -5440,6 +5574,10 @@ const TYPE_API = [
5440
5574
  name: "AgentPresetRow",
5441
5575
  declaration: "export interface AgentPresetRow {\n readonly id: string;\n readonly trust: PresetTrust;\n readonly isDefault: boolean;\n readonly name?: string;\n readonly description?: string;\n readonly broken?: string;\n}"
5442
5576
  },
5577
+ {
5578
+ name: "AgentResolver",
5579
+ declaration: "export type AgentResolver = (sessionId: SessionId) => Promise<Agent>;"
5580
+ },
5443
5581
  {
5444
5582
  name: "AgentSetup",
5445
5583
  declaration: "export type AgentSetup = (agentCtx: Context) => AgentSetupCommit | Promise<AgentSetupCommit | void> | void;"
@@ -5528,6 +5666,26 @@ const TYPE_API = [
5528
5666
  name: "AssistantProvenance",
5529
5667
  declaration: "export interface AssistantProvenance {\n provider: string;\n model: string;\n replayState?: unknown;\n}"
5530
5668
  },
5669
+ {
5670
+ name: "AssistantStreamFrame",
5671
+ declaration: "export type AssistantStreamFrame = {\n readonly type: 'start';\n readonly attemptId: LlmAttemptId;\n readonly revision: number;\n readonly turn: number;\n readonly step: number;\n} | {\n readonly type: 'chunk';\n readonly attemptId: LlmAttemptId;\n readonly revision: number;\n readonly index: number;\n readonly time: number;\n readonly chunk: StreamChunk;\n} | {\n readonly type: 'end';\n readonly attemptId: LlmAttemptId;\n readonly revision: number;\n readonly index: number;\n readonly outcome: {\n readonly kind: 'committed';\n readonly eventType: 'assistant/message' | 'assistant/attempt';\n readonly seq: SessionSeq;\n } | {\n readonly kind: 'abandoned';\n };\n};"
5672
+ },
5673
+ {
5674
+ name: "AssistantStreamRecord",
5675
+ declaration: "export type AssistantStreamRecord = {\n readonly type: 'text-chunks';\n readonly time0: number;\n readonly index: number;\n readonly dt: readonly number[];\n readonly texts: readonly string[];\n} | {\n readonly type: 'reasoning-chunks';\n readonly time0: number;\n readonly index: number;\n readonly dt: readonly number[];\n readonly texts: readonly string[];\n} | {\n readonly type: 'tool-call-chunks';\n readonly time0: number;\n readonly index: number;\n readonly dt: readonly number[];\n readonly id: ToolCallId;\n readonly name?: string;\n readonly args: readonly string[];\n} | {\n readonly type: 'chunk';\n readonly time: number;\n readonly chunk: StreamChunk;\n};"
5676
+ },
5677
+ {
5678
+ name: "AttachmentAdmissionPart",
5679
+ declaration: "export type AttachmentAdmissionPart = PromptContentPart | {\n readonly type: 'file';\n readonly attachment: FileAttachmentRef;\n};"
5680
+ },
5681
+ {
5682
+ name: "AttachmentError",
5683
+ declaration: "export class AttachmentError extends Error {\n readonly code: AttachmentErrorCode;\n constructor(message: string, code: AttachmentErrorCode, options?: ErrorOptions);\n}"
5684
+ },
5685
+ {
5686
+ name: "AttachmentErrorCode",
5687
+ declaration: "export type AttachmentErrorCode = typeof ATTACHMENT_ERROR_CODES[number];"
5688
+ },
5531
5689
  {
5532
5690
  name: "AttachmentId",
5533
5691
  declaration: "export type AttachmentId = Branded<'AttachmentId'>;"
@@ -5596,10 +5754,6 @@ const TYPE_API = [
5596
5754
  name: "BashEnvVariableInfo",
5597
5755
  declaration: "export interface BashEnvVariableInfo extends BashEnvVariable {\n contributor: string;\n key: DshEnvironmentKey;\n}"
5598
5756
  },
5599
- {
5600
- name: "BorrowedSessionSource",
5601
- declaration: "export type BorrowedSessionSource = Disposable & ({\n readonly source: 'prepared';\n readonly inspection: SessionInspection;\n readonly revision: SessionPersistenceRevision;\n readonly preparedSession: Session;\n} | {\n readonly source: 'live';\n readonly inspection: SessionInspection;\n});"
5602
- },
5603
5757
  {
5604
5758
  name: "Branded",
5605
5759
  declaration: "export type Branded<B extends string> = string & {\n readonly [BRAND]: B;\n};"
@@ -5608,14 +5762,6 @@ const TYPE_API = [
5608
5762
  name: "BrandedNumber",
5609
5763
  declaration: "export type BrandedNumber<B extends string> = number & {\n readonly [BRAND]: B;\n};"
5610
5764
  },
5611
- {
5612
- name: "ChunkRow",
5613
- declaration: "export type ChunkRow = {\n type: 'text-chunks';\n seq0: SessionSeqType;\n time0: number;\n data: TextRunData;\n} | {\n type: 'reasoning-chunks';\n seq0: SessionSeqType;\n time0: number;\n data: TextRunData;\n} | {\n type: 'tool-call-chunks';\n seq0: SessionSeqType;\n time0: number;\n data: ToolCallRunData;\n};"
5614
- },
5615
- {
5616
- name: "ChunkRowEvent",
5617
- declaration: "export type ChunkRowEvent = {\n [Kind in ChunkRow['type']]: {\n readonly type: `chunkrow/${Kind}`;\n readonly seq: number;\n readonly time: number;\n readonly data: Extract<ChunkRow, {\n readonly type: Kind;\n }>['data'];\n };\n}[ChunkRow['type']];"
5618
- },
5619
5765
  {
5620
5766
  name: "ClientArtifactBaseline",
5621
5767
  declaration: "export interface ClientArtifactBaseline {\n readonly path: string;\n readonly mtimeMs: number;\n readonly size: number;\n}"
@@ -5664,22 +5810,30 @@ const TYPE_API = [
5664
5810
  name: "CommandExecution",
5665
5811
  declaration: "export interface CommandExecution {\n readonly commandId: CommandId;\n readonly result: CommandResult;\n}"
5666
5812
  },
5813
+ {
5814
+ name: "CommandFileReceiptResolver",
5815
+ declaration: "export type CommandFileReceiptResolver = (agent: Agent, receiptId: string) => FileAttachmentRef | undefined;"
5816
+ },
5667
5817
  {
5668
5818
  name: "CommandId",
5669
5819
  declaration: "export type CommandId = Branded<'CommandId'>;"
5670
5820
  },
5671
5821
  {
5672
5822
  name: "CommandInputDescriptor",
5673
- declaration: "export interface CommandInputDescriptor {\n readonly hint: string;\n readonly images?: boolean;\n}"
5823
+ declaration: "export interface CommandInputDescriptor {\n readonly hint: string;\n readonly attachments?: boolean;\n}"
5674
5824
  },
5675
5825
  {
5676
5826
  name: "CommandInvocation",
5677
- declaration: "export interface CommandInvocation {\n readonly commandId: CommandId;\n readonly agent: Agent;\n readonly rawInput: string;\n readonly attachments: readonly ImageBlock[];\n readonly signal: AbortSignal;\n}"
5827
+ declaration: "export interface CommandInvocation {\n readonly commandId: CommandId;\n readonly agent: Agent;\n readonly rawInput: string;\n readonly attachments: readonly (ImageBlock | FileBlock)[];\n readonly signal: AbortSignal;\n}"
5678
5828
  },
5679
5829
  {
5680
5830
  name: "CommandResult",
5681
5831
  declaration: "export type CommandResult = {\n readonly kind: 'success';\n readonly text?: string;\n readonly sourceEventSeq?: SessionSeq;\n} | {\n readonly kind: 'error';\n readonly text: string;\n};"
5682
5832
  },
5833
+ {
5834
+ name: "CommandSubmitAttachment",
5835
+ declaration: "export type CommandSubmitAttachment = ({\n readonly type: 'image';\n} & EncodedImageAttachment) | {\n readonly type: 'file';\n readonly receiptId: string;\n};"
5836
+ },
5683
5837
  {
5684
5838
  name: "CompactionAgentContext",
5685
5839
  declaration: "export interface CompactionAgentContext {\n session: Session;\n options: {\n provider?: string;\n model?: string;\n };\n}"
@@ -5710,7 +5864,7 @@ const TYPE_API = [
5710
5864
  },
5711
5865
  {
5712
5866
  name: "ContentBlockMap",
5713
- declaration: "export interface ContentBlockMap {\n 'text': TextBlock;\n 'reasoning': ReasoningBlock;\n 'image': ImageBlock;\n 'tool-call': ToolCallBlock;\n 'tool-result': ToolResultBlock;\n}"
5867
+ declaration: "export interface ContentBlockMap {\n 'text': TextBlock;\n 'reasoning': ReasoningBlock;\n 'image': ImageBlock;\n 'file': FileBlock;\n 'tool-call': ToolCallBlock;\n 'tool-result': ToolResultBlock;\n}"
5714
5868
  },
5715
5869
  {
5716
5870
  name: "ContentBlockType",
@@ -5980,6 +6134,14 @@ const TYPE_API = [
5980
6134
  name: "EditGoalRequest",
5981
6135
  declaration: "export interface EditGoalRequest {\n readonly objective?: string;\n readonly maxGoalRounds?: number;\n}"
5982
6136
  },
6137
+ {
6138
+ name: "EncodedFileAttachment",
6139
+ declaration: "export interface EncodedFileAttachment {\n data: string;\n name?: string;\n}"
6140
+ },
6141
+ {
6142
+ name: "EncodedFileUploadRequest",
6143
+ declaration: "export interface EncodedFileUploadRequest {\n readonly data: string;\n readonly name?: string;\n}"
6144
+ },
5983
6145
  {
5984
6146
  name: "EncodedImageAttachment",
5985
6147
  declaration: "export interface EncodedImageAttachment {\n mediaType: ImageMediaType;\n data: string;\n name?: string;\n}"
@@ -5992,6 +6154,14 @@ const TYPE_API = [
5992
6154
  name: "FiberState",
5993
6155
  declaration: "export type FiberState = FiberStateEnum;"
5994
6156
  },
6157
+ {
6158
+ name: "FileAttachmentRef",
6159
+ declaration: "export interface FileAttachmentRef {\n attachmentId: AttachmentId;\n name: string;\n bytes: number;\n}"
6160
+ },
6161
+ {
6162
+ name: "FileBlock",
6163
+ declaration: "export interface FileBlock {\n type: 'file';\n attachment: FileAttachmentRef;\n}"
6164
+ },
5995
6165
  {
5996
6166
  name: "FileDiff",
5997
6167
  declaration: "export interface FileDiff {\n path: string;\n oldText: string | null;\n newText: string;\n}"
@@ -6004,6 +6174,14 @@ const TYPE_API = [
6004
6174
  name: "FileReferenceCandidate",
6005
6175
  declaration: "export interface FileReferenceCandidate {\n path: string;\n kind: 'file' | 'directory';\n}"
6006
6176
  },
6177
+ {
6178
+ name: "FileUploadReceiptId",
6179
+ declaration: "export type FileUploadReceiptId = Branded<'file-upload-receipt-id'>;"
6180
+ },
6181
+ {
6182
+ name: "FileUploadValue",
6183
+ declaration: "export interface FileUploadValue {\n readonly receiptId: FileUploadReceiptId;\n readonly file: FileAttachmentRef;\n}"
6184
+ },
6007
6185
  {
6008
6186
  name: "FinishReason",
6009
6187
  declaration: "export type FinishReason = FinishReasonMap[keyof FinishReasonMap];"
@@ -6264,6 +6442,10 @@ const TYPE_API = [
6264
6442
  name: "LlmAdapter",
6265
6443
  declaration: "export abstract class LlmAdapter {\n providerInfo(provider: string): LlmProviderInfo;\n providerRetryPolicy(_provider: string): ResolvedRetryPolicy | undefined;\n imageRequestPricing(_provider: string, _model: string): LlmImageRequestPricing | undefined;\n listModels(_provider: string): Promise<readonly LlmModelInfo[]>;\n resolveModel(provider: string, model: string, _signal?: AbortSignal): Promise<LlmResolvedModelInfo>;\n async prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;\n abstract stream(options: GenerateOptions): AsyncIterable<StreamChunk>;\n}"
6266
6444
  },
6445
+ {
6446
+ name: "LlmAttemptId",
6447
+ declaration: "export type LlmAttemptId = Branded<'LlmAttemptId'>;"
6448
+ },
6267
6449
  {
6268
6450
  name: "LlmCallConfig",
6269
6451
  declaration: "export interface LlmCallConfig {\n provider: string;\n model: string;\n reasoningEffort?: ReasoningEffortId;\n temperature?: number;\n maxTokens?: number;\n stop?: string[];\n}"
@@ -6322,7 +6504,7 @@ const TYPE_API = [
6322
6504
  },
6323
6505
  {
6324
6506
  name: "LlmRuntime",
6325
- declaration: "export class LlmRuntime extends TypertRemoteService {\n constructor(ctx: Context);\n registerAdapter(providers: string[], adapter: LlmAdapter): AdapterRegistrationHandle;\n @Remote\n listProviders(): LlmProviderInfo[];\n registerConfigurableProviders(entries: readonly LlmConfigurableProvider[]): DirectoryRegistrationHandle;\n @Remote\n listConfigurableProviders(): LlmConfigurableProvider[];\n registerModelDiscovery(settingsNs: string, discover: (request: LlmModelDiscoveryRequest, signal?: AbortSignal) => Promise<readonly LlmDiscoveredModel[]>): () => void;\n async discoverModels(settingsNs: string, request: LlmModelDiscoveryRequest, signal?: AbortSignal): Promise<LlmDiscoveredModel[]>;\n @Remote('discoverModels')\n async remoteDiscoverModels(settingsNs: string, request: LlmModelDiscoveryRequest, signal: AbortSignal): Promise<LlmDiscoveredModel[]>;\n providerRetryPolicy(provider: string): ResolvedRetryPolicy;\n imageRequestPricing(provider: string, model: string): LlmImageRequestPricing | undefined;\n async listModels(provider: string): Promise<LlmModelInfo[]>;\n async resolveModelInfo(provider: string, model: string, signal?: AbortSignal): Promise<LlmResolvedModelInfo>;\n async resolveCallConfig(config: LlmCallConfig, signal?: AbortSignal): Promise<LlmCallConfig>;\n async prepareCall(config: LlmCallConfig, signal?: AbortSignal): Promise<PreparedLlmCall>;\n stream(options: GenerateOptions): AsyncIterable<StreamChunk>;\n}"
6507
+ declaration: "export class LlmRuntime extends TypertRemoteService {\n constructor(ctx: Context);\n registerAdapter(providers: string[], adapter: LlmAdapter): AdapterRegistrationHandle;\n @Remote\n listProviders(): LlmProviderInfo[];\n registerConfigurableProviders(entries: readonly LlmConfigurableProvider[]): DirectoryRegistrationHandle;\n @Remote\n listConfigurableProviders(): LlmConfigurableProvider[];\n registerModelDiscovery(settingsNs: string, discover: (request: LlmModelDiscoveryRequest, signal?: AbortSignal) => Promise<readonly LlmDiscoveredModel[]>): () => void;\n async discoverModels(settingsNs: string, request: LlmModelDiscoveryRequest, signal?: AbortSignal): Promise<LlmDiscoveredModel[]>;\n @Remote('discoverModels')\n async remoteDiscoverModels(settingsNs: string, request: LlmModelDiscoveryRequest, signal: AbortSignal): Promise<LlmDiscoveredModel[]>;\n providerRetryPolicy(provider: string): ResolvedRetryPolicy;\n imageRequestPricing(provider: string, model: string): LlmImageRequestPricing | undefined;\n fileRequestText(ref: FileAttachmentRef): string;\n async listModels(provider: string): Promise<LlmModelInfo[]>;\n async resolveModelInfo(provider: string, model: string, signal?: AbortSignal): Promise<LlmResolvedModelInfo>;\n async resolveCallConfig(config: LlmCallConfig, signal?: AbortSignal): Promise<LlmCallConfig>;\n async prepareCall(config: LlmCallConfig, signal?: AbortSignal): Promise<PreparedLlmCall>;\n stream(options: GenerateOptions) /* …truncated — full shape in source */"
6326
6508
  },
6327
6509
  {
6328
6510
  name: "LspHover",
@@ -6538,7 +6720,7 @@ const TYPE_API = [
6538
6720
  },
6539
6721
  {
6540
6722
  name: "PrepareSessionOptions",
6541
- declaration: "export type PrepareSessionOptions = (CreateSessionOptions & {\n readonly seedSource?: undefined;\n}) | RestoredSessionOptions;"
6723
+ declaration: "export type PrepareSessionOptions = (CreateSessionOptions & {\n readonly eventState?: undefined;\n}) | RestoredSessionOptions;"
6542
6724
  },
6543
6725
  {
6544
6726
  name: "PresetOption",
@@ -6592,6 +6774,10 @@ const TYPE_API = [
6592
6774
  name: "PromptContextOrderName",
6593
6775
  declaration: "export type PromptContextOrderName = keyof typeof CONTEXT_ORDERS;"
6594
6776
  },
6777
+ {
6778
+ name: "PromptFileBinding",
6779
+ declaration: "export interface PromptFileBinding extends Disposable {\n commit(): void;\n}"
6780
+ },
6595
6781
  {
6596
6782
  name: "PromptSection",
6597
6783
  declaration: "export interface PromptSection {\n readonly name: string;\n readonly order: number;\n readonly text: string | ((context: AssembleContext) => string);\n readonly complete?: boolean;\n}"
@@ -6702,7 +6888,7 @@ const TYPE_API = [
6702
6888
  },
6703
6889
  {
6704
6890
  name: "RestoredSessionOptions",
6705
- declaration: "export interface RestoredSessionOptions {\n readonly seed: SessionEvent[];\n readonly meta: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n readonly seedSource: 'persistence';\n}"
6891
+ declaration: "export interface RestoredSessionOptions {\n readonly seed: SessionEvent[];\n readonly meta: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n readonly eventState: SessionSeedEventState;\n}"
6706
6892
  },
6707
6893
  {
6708
6894
  name: "ResumeAgentOptions",
@@ -6732,6 +6918,14 @@ const TYPE_API = [
6732
6918
  name: "SandboxPolicyRequest",
6733
6919
  declaration: "export interface SandboxPolicyRequest {\n session?: Session;\n mode?: SandboxMode;\n}"
6734
6920
  },
6921
+ {
6922
+ name: "SaveFileAttachment",
6923
+ declaration: "export interface SaveFileAttachment {\n data: Uint8Array;\n name?: string;\n}"
6924
+ },
6925
+ {
6926
+ name: "SaveFileStreamAttachment",
6927
+ declaration: "export interface SaveFileStreamAttachment {\n data: AsyncIterable<Uint8Array>;\n signal?: AbortSignal;\n name?: string;\n}"
6928
+ },
6735
6929
  {
6736
6930
  name: "SaveImageAttachment",
6737
6931
  declaration: "export interface SaveImageAttachment {\n data: Uint8Array;\n mediaType: ImageMediaType;\n name?: string;\n}"
@@ -6778,7 +6972,7 @@ const TYPE_API = [
6778
6972
  },
6779
6973
  {
6780
6974
  name: "SendTeamMessageRequest",
6781
- declaration: "export interface SendTeamMessageRequest {\n readonly target: string;\n readonly content: ContentBlock[];\n readonly delivery: 'quiet' | 'wakeup';\n readonly signal: AbortSignal;\n}"
6975
+ declaration: "export interface SendTeamMessageRequest {\n readonly target: string;\n readonly content: ContentBlock[];\n readonly signal: AbortSignal;\n}"
6782
6976
  },
6783
6977
  {
6784
6978
  name: "SendTeamMessageResult",
@@ -6786,12 +6980,28 @@ const TYPE_API = [
6786
6980
  },
6787
6981
  {
6788
6982
  name: "Session",
6789
- declaration: "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n static create(id: SessionId, seed?: readonly SessionEvent[], header?: SessionHeader, inheritedEventCount?: SessionLogOffset): Session;\n static fromRestore(id: SessionId, seed: readonly SessionEvent[], header: SessionHeader, inheritedEventCount: SessionLogOffset): Session;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [\n opts: SurfaceIntent\n ] : [\n ]): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
6983
+ declaration: "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n static create(id: SessionId, seed?: readonly SessionEvent[], header?: SessionHeader, inheritedEventCount?: SessionLogOffset): Session;\n static fromRestore(id: SessionId, seed: readonly SessionEvent[], header: SessionHeader, inheritedEventCount: SessionLogOffset, eventState: SessionSeedEventState): Session;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [\n opts: SurfaceIntent<T>\n ] : [\n ]): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
6984
+ },
6985
+ {
6986
+ name: "SessionAccess",
6987
+ declaration: "export type SessionAccess = 'read' | 'write';"
6790
6988
  },
6791
6989
  {
6792
6990
  name: "SessionAddress",
6793
6991
  declaration: "export type SessionAddress = {\n readonly kind: 'session';\n readonly sessionId: SessionId;\n} | {\n readonly kind: 'subagent';\n readonly parentSessionId: SessionId;\n readonly childSessionId: SessionId;\n readonly mode: 'one-shot' | 'continuable';\n};"
6794
6992
  },
6993
+ {
6994
+ name: "SessionAssistantStreamAttempt",
6995
+ declaration: "export interface SessionAssistantStreamAttempt {\n readonly attemptId: LlmAttemptId;\n readonly startedAfterSeq: SessionSeqCursor;\n readonly turn: number;\n readonly step: number;\n readonly nextIndex: number;\n readonly stream: readonly JsonValue[];\n}"
6996
+ },
6997
+ {
6998
+ name: "SessionAssistantStreamBaseline",
6999
+ declaration: "export interface SessionAssistantStreamBaseline {\n readonly revision: number;\n readonly activeAttempt?: SessionAssistantStreamAttempt;\n}"
7000
+ },
7001
+ {
7002
+ name: "SessionAssistantStreamFrame",
7003
+ declaration: "export type SessionAssistantStreamFrame = {\n readonly type: 'start';\n readonly attemptId: LlmAttemptId;\n readonly revision: number;\n readonly startedAfterSeq: SessionSeqCursor;\n readonly turn: number;\n readonly step: number;\n} | {\n readonly type: 'chunk';\n readonly attemptId: LlmAttemptId;\n readonly revision: number;\n readonly index: number;\n readonly time: number;\n readonly chunk: JsonValue;\n} | {\n readonly type: 'end';\n readonly attemptId: LlmAttemptId;\n readonly revision: number;\n readonly index: number;\n readonly outcome: {\n readonly kind: 'committed';\n readonly eventType: 'assistant/message' | 'assistant/attempt';\n readonly seq: number;\n } | {\n readonly kind: 'abandoned';\n };\n};"
7004
+ },
6795
7005
  {
6796
7006
  name: "SessionAttachmentRequest",
6797
7007
  declaration: "export interface SessionAttachmentRequest {\n readonly sessionId: SessionId;\n readonly attachmentId: AttachmentIdType;\n}"
@@ -6812,10 +7022,6 @@ const TYPE_API = [
6812
7022
  name: "SessionCancelValue",
6813
7023
  declaration: "export interface SessionCancelValue {\n readonly accepted: true;\n}"
6814
7024
  },
6815
- {
6816
- name: "SessionChunkRun",
6817
- declaration: "export interface SessionChunkRun {\n readonly type: 'chunks';\n readonly event: ChunkRowEvent;\n}"
6818
- },
6819
7025
  {
6820
7026
  name: "SessionControlBaseline",
6821
7027
  declaration: "export interface SessionControlBaseline {\n readonly queues: Readonly<Record<SessionId, readonly SessionQueuedItem[]>>;\n readonly jobs: Readonly<Record<SessionId, readonly SessionJob[]>>;\n readonly projections: Readonly<Record<SessionId, SessionProjectionBaseline>>;\n}"
@@ -6842,7 +7048,7 @@ const TYPE_API = [
6842
7048
  },
6843
7049
  {
6844
7050
  name: "SessionEventMap",
6845
- declaration: "export interface SessionEventMap {\n 'turn/start': {\n turn: number;\n };\n 'turn/end': {\n turn: number;\n reason: TurnEndReason;\n };\n 'step/start': {\n turn: number;\n step: number;\n };\n 'step/end': {\n turn: number;\n step: number;\n };\n 'user/message': UserMessage;\n 'assistant/chunk': {\n turn: number;\n step: number;\n chunk: StreamChunk;\n };\n 'assistant/message': {\n turn: number;\n step: number;\n message: AssistantMessage;\n usage?: TokenUsage;\n interrupted?: true;\n };\n 'tool/call': {\n turn: number;\n step: number;\n callId: ToolCallId;\n name: string;\n arguments: string;\n };\n 'tool/result': {\n turn: number;\n step: number;\n message: ToolResultMessage;\n error?: {\n name: string;\n code: string;\n };\n meta?: JsonValue;\n };\n 'request/header': {\n header: EpochHeader;\n reason: RequestHeaderReason;\n startsSeries?: true;\n };\n 'request/context': RequestContext;\n 'session/end-seed': Record<string, never>;\n}"
7051
+ declaration: "export interface SessionEventMap {\n 'turn/start': {\n turn: number;\n };\n 'turn/end': {\n turn: number;\n reason: TurnEndReason;\n };\n 'step/start': {\n turn: number;\n step: number;\n };\n 'step/end': {\n turn: number;\n step: number;\n };\n 'user/message': UserMessage;\n 'assistant/message': {\n turn: number;\n step: number;\n message: AssistantMessage;\n stream: AssistantStreamRecord[];\n usage?: TokenUsage;\n interrupted?: true;\n };\n 'assistant/attempt': {\n turn: number;\n step: number;\n stream: AssistantStreamRecord[];\n };\n 'tool/call': {\n turn: number;\n step: number;\n callId: ToolCallId;\n name: string;\n arguments: string;\n };\n 'tool/result': {\n turn: number;\n step: number;\n message: ToolResultMessage;\n error?: {\n name: string;\n code: string;\n };\n meta?: JsonValue;\n };\n 'request/header': {\n header: EpochHeader;\n reason: RequestHeaderReason;\n startsSeries?: true;\n };\n 'request/context': RequestContext;\n 'session/end-seed': {\n inherited?: true;\n };\n}"
6846
7052
  },
6847
7053
  {
6848
7054
  name: "SessionEventMetadataFilter",
@@ -6876,10 +7082,6 @@ const TYPE_API = [
6876
7082
  name: "SessionEventSearchRequest",
6877
7083
  declaration: "export interface SessionEventSearchRequest {\n sessionId: SessionId;\n query: string;\n filters?: readonly SessionEventMetadataFilter[];\n limit?: number;\n cursor?: SessionSearchCursor;\n}"
6878
7084
  },
6879
- {
6880
- name: "SessionEventSuffix",
6881
- declaration: "export interface SessionEventSuffix extends SessionStorageMetadata {\n readonly fromSeq: SessionLogOffset;\n readonly events: readonly SessionEvent[];\n}"
6882
- },
6883
7085
  {
6884
7086
  name: "SessionEventSurface",
6885
7087
  declaration: "export type SessionEventSurface = 'current' | 'shadowed' | 'log-only';"
@@ -6906,11 +7108,11 @@ const TYPE_API = [
6906
7108
  },
6907
7109
  {
6908
7110
  name: "SessionFollowFrame",
6909
- declaration: "export type SessionFollowFrame = {\n readonly type: 'snapshot';\n readonly header: SessionWireHeader;\n readonly cursor: number;\n readonly records: readonly SessionHistoryRecord[];\n readonly hasMore: boolean;\n readonly projections: SessionProjectionBaseline;\n} | SessionEventEntry;"
7111
+ declaration: "export type SessionFollowFrame = {\n readonly type: 'snapshot';\n readonly header: SessionWireHeader;\n readonly cursor: number;\n readonly records: readonly SessionHistoryRecord[];\n readonly hasMore: boolean;\n readonly projections: SessionProjectionBaseline;\n readonly assistantStream?: SessionAssistantStreamBaseline;\n} | SessionEventEntry | {\n readonly type: 'assistant-stream';\n readonly frame: SessionAssistantStreamFrame;\n};"
6910
7112
  },
6911
7113
  {
6912
7114
  name: "SessionFollowRequest",
6913
- declaration: "export interface SessionFollowRequest {\n readonly address: SessionAddress;\n readonly maxMessages?: number;\n}"
7115
+ declaration: "export interface SessionFollowRequest {\n readonly address: SessionAddress;\n readonly maxMessages?: number;\n readonly assistantStream?: true;\n}"
6914
7116
  },
6915
7117
  {
6916
7118
  name: "SessionForkRequest",
@@ -6924,13 +7126,33 @@ const TYPE_API = [
6924
7126
  name: "SessionForkValue",
6925
7127
  declaration: "export interface SessionForkValue {\n readonly sessionId: SessionId;\n}"
6926
7128
  },
7129
+ {
7130
+ name: "SessionHandle",
7131
+ declaration: "export interface SessionHandle extends AsyncDisposable {\n readonly id: SessionId;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n readonly access: SessionAccess;\n read(offset?: number, length?: number, options?: SessionHandleReadOptions): Promise<SessionHandleReadResult>;\n append(events: readonly SessionEvent[], options?: SessionHandleAppendOptions): Promise<void>;\n flush(options?: SessionHandleFlushOptions): Promise<void>;\n close(): Promise<void>;\n}"
7132
+ },
7133
+ {
7134
+ name: "SessionHandleAppendOptions",
7135
+ declaration: "export interface SessionHandleAppendOptions {\n readonly signal?: AbortSignal;\n}"
7136
+ },
7137
+ {
7138
+ name: "SessionHandleFlushOptions",
7139
+ declaration: "export interface SessionHandleFlushOptions {\n readonly signal?: AbortSignal;\n}"
7140
+ },
7141
+ {
7142
+ name: "SessionHandleReadOptions",
7143
+ declaration: "export interface SessionHandleReadOptions {\n readonly signal?: AbortSignal;\n}"
7144
+ },
7145
+ {
7146
+ name: "SessionHandleReadResult",
7147
+ declaration: "export interface SessionHandleReadResult {\n readonly eventState: SessionSeedEventState;\n readonly events: readonly SessionEvent[];\n}"
7148
+ },
6927
7149
  {
6928
7150
  name: "SessionHeader",
6929
- declaration: "export interface SessionHeader {\n readonly version: number;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
7151
+ declaration: "export interface SessionHeader {\n readonly version: typeof SESSION_FORMAT_VERSION;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
6930
7152
  },
6931
7153
  {
6932
7154
  name: "SessionHistoryRecord",
6933
- declaration: "export type SessionHistoryRecord = SessionEventEntry | SessionChunkRun;"
7155
+ declaration: "export type SessionHistoryRecord = SessionEventEntry;"
6934
7156
  },
6935
7157
  {
6936
7158
  name: "SessionId",
@@ -6960,10 +7182,6 @@ const TYPE_API = [
6960
7182
  name: "SessionListValue",
6961
7183
  declaration: "export interface SessionListValue {\n readonly items: readonly SessionSummary[];\n}"
6962
7184
  },
6963
- {
6964
- name: "SessionLocation",
6965
- declaration: "export interface SessionLocation {\n readonly kind: string;\n readonly path: string;\n}"
6966
- },
6967
7185
  {
6968
7186
  name: "SessionLogOffset",
6969
7187
  declaration: "export type SessionLogOffset = BrandedNumber<'SessionLogOffset'>;"
@@ -6974,7 +7192,7 @@ const TYPE_API = [
6974
7192
  },
6975
7193
  {
6976
7194
  name: "SessionObservation",
6977
- declaration: "export interface SessionObservation extends Disposable {\n readonly source: 'live' | 'prepared';\n readonly header: SessionHeader;\n readonly events: readonly SessionEvent[];\n readonly inheritedEventCount: SessionLogOffsetType;\n readonly cursor: SessionSeqCursor;\n readonly revision?: SessionPersistenceRevision;\n readonly projections?: ProjectionSnapshot;\n retain(): SessionObservation;\n}"
7195
+ declaration: "export interface SessionObservation extends Disposable {\n readonly source: 'live' | 'prepared';\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffsetType;\n readonly events: readonly SessionEvent[];\n readonly cursor: SessionSeqCursor;\n readonly revision?: SessionPersistenceRevision;\n readonly projections?: ProjectionSnapshot;\n retain(): SessionObservation;\n}"
6978
7196
  },
6979
7197
  {
6980
7198
  name: "SessionObservationOptions",
@@ -6996,21 +7214,29 @@ const TYPE_API = [
6996
7214
  name: "SessionPageRequest",
6997
7215
  declaration: "export interface SessionPageRequest {\n readonly address: SessionAddress;\n readonly throughSeq: number;\n readonly beforeSeq?: number;\n readonly maxMessages?: number;\n}"
6998
7216
  },
7217
+ {
7218
+ name: "SessionPersistenceCreateOptions",
7219
+ declaration: "export interface SessionPersistenceCreateOptions {\n readonly signal?: AbortSignal;\n readonly inheritedEventCount?: SessionLogOffset;\n}"
7220
+ },
7221
+ {
7222
+ name: "SessionPersistenceListOptions",
7223
+ declaration: "export interface SessionPersistenceListOptions {\n readonly signal?: AbortSignal;\n}"
7224
+ },
7225
+ {
7226
+ name: "SessionPersistenceOpenOptions",
7227
+ declaration: "export interface SessionPersistenceOpenOptions {\n readonly signal?: AbortSignal;\n}"
7228
+ },
6999
7229
  {
7000
7230
  name: "SessionPersistenceRevision",
7001
7231
  declaration: "export type SessionPersistenceRevision = Branded<'SessionPersistenceRevision'>;"
7002
7232
  },
7003
7233
  {
7004
7234
  name: "SessionPersistenceSnapshot",
7005
- declaration: "export interface SessionPersistenceSnapshot {\n header: SessionHeader;\n revision: SessionPersistenceRevision;\n}"
7006
- },
7007
- {
7008
- name: "SessionPreparation",
7009
- declaration: "export class SessionPreparation implements Disposable {\n readonly session: Session;\n static create(session: Session, options?: SessionPreparationOptions): SessionPreparation;\n [Symbol.dispose](): void;\n}"
7235
+ declaration: "export interface SessionPersistenceSnapshot {\n readonly header: SessionHeader;\n readonly revision: SessionPersistenceRevision;\n readonly eventCount?: number;\n readonly sizeBytes?: number;\n}"
7010
7236
  },
7011
7237
  {
7012
- name: "SessionPreparationOptions",
7013
- declaration: "export interface SessionPreparationOptions {\n readonly release?: () => void;\n}"
7238
+ name: "SessionPersistenceStatOptions",
7239
+ declaration: "export interface SessionPersistenceStatOptions {\n readonly signal?: AbortSignal;\n}"
7014
7240
  },
7015
7241
  {
7016
7242
  name: "SessionProjectionBaseline",
@@ -7052,10 +7278,6 @@ const TYPE_API = [
7052
7278
  name: "SessionQueuedItem",
7053
7279
  declaration: "export interface SessionQueuedItem {\n readonly id: MessageId;\n readonly placement: 'queued' | 'steering' | 'context';\n readonly rpcId?: SessionRequestId;\n readonly message: {\n readonly id: MessageId;\n readonly content: readonly JsonValue[];\n };\n}"
7054
7280
  },
7055
- {
7056
- name: "SessionRawArtifact",
7057
- declaration: "export interface SessionRawArtifact extends SessionStorageMetadata {\n readonly filename: string;\n readonly content: string;\n}"
7058
- },
7059
7281
  {
7060
7282
  name: "SessionRecord",
7061
7283
  declaration: "export interface SessionRecord {\n header: SessionHeader;\n live: boolean;\n persisted: boolean;\n}"
@@ -7116,6 +7338,10 @@ const TYPE_API = [
7116
7338
  name: "SessionSearchValue",
7117
7339
  declaration: "export interface SessionSearchValue {\n readonly items: readonly SessionSearchItem[];\n readonly hasMore: boolean;\n}"
7118
7340
  },
7341
+ {
7342
+ name: "SessionSeedEventState",
7343
+ declaration: "export type SessionSeedEventState = 'detached' | 'shared-frozen';"
7344
+ },
7119
7345
  {
7120
7346
  name: "SessionSelectModelRequest",
7121
7347
  declaration: "export interface SessionSelectModelRequest extends ModelSelection {\n readonly sessionId: SessionId;\n}"
@@ -7222,7 +7448,7 @@ const TYPE_API = [
7222
7448
  },
7223
7449
  {
7224
7450
  name: "SessionWireHeader",
7225
- declaration: "export interface SessionWireHeader {\n readonly version: number;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly seedLength?: number;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
7451
+ declaration: "export interface SessionWireHeader {\n readonly version: number;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
7226
7452
  },
7227
7453
  {
7228
7454
  name: "SessionWireSurfaceOp",
@@ -7394,7 +7620,7 @@ const TYPE_API = [
7394
7620
  },
7395
7621
  {
7396
7622
  name: "SpillSource",
7397
- declaration: "export interface SpillSource {\n toolName: string;\n callId: ToolCallId;\n label: string;\n}"
7623
+ declaration: "export type SpillSource = {\n kind: 'tool';\n toolName: string;\n callId: ToolCallId;\n label: string;\n} | {\n kind: 'session-reference';\n sessionId: SessionId;\n label: string;\n};"
7398
7624
  },
7399
7625
  {
7400
7626
  name: "StorageBackend",
@@ -7446,7 +7672,7 @@ const TYPE_API = [
7446
7672
  },
7447
7673
  {
7448
7674
  name: "SubagentPromptRequest",
7449
- declaration: "export interface SubagentPromptRequest {\n readonly requestId: SubagentPromptRequestId;\n readonly parentSessionId: SessionId;\n readonly childSessionId: SessionId;\n readonly mode: 'continuable';\n readonly content: readonly PromptContentPart[];\n readonly clientTimeZone?: string;\n}"
7675
+ declaration: "export interface SubagentPromptRequest {\n readonly requestId: SubagentPromptRequestId;\n readonly parentSessionId: SessionId;\n readonly childSessionId: SessionId;\n readonly mode: 'continuable';\n readonly delivery: 'queue' | 'steer';\n readonly content: readonly PromptContentPart[];\n readonly clientTimeZone?: string;\n}"
7450
7676
  },
7451
7677
  {
7452
7678
  name: "SubagentPromptRequestId",
@@ -7506,7 +7732,7 @@ const TYPE_API = [
7506
7732
  },
7507
7733
  {
7508
7734
  name: "SubprocessHandle",
7509
- declaration: "export interface SubprocessHandle {\n readonly pid: number;\n readonly stdin: Writable | undefined;\n readonly stdout: Readable | undefined;\n readonly stderr: Readable | undefined;\n readonly collected: SubprocessCollectedOutputs;\n readonly done: Promise<SubprocessOutcome>;\n terminate(): void;\n waitForExit(signal?: AbortSignal): Promise<boolean>;\n}"
7735
+ declaration: "export interface SubprocessHandle {\n readonly stdin: Writable | undefined;\n readonly stdout: Readable | undefined;\n readonly stderr: Readable | undefined;\n readonly collected: SubprocessCollectedOutputs;\n readonly done: Promise<SubprocessOutcome>;\n terminate(): void;\n waitForExit(signal?: AbortSignal): Promise<boolean>;\n}"
7510
7736
  },
7511
7737
  {
7512
7738
  name: "SubprocessOutcome",
@@ -7562,7 +7788,7 @@ const TYPE_API = [
7562
7788
  },
7563
7789
  {
7564
7790
  name: "SurfaceIntent",
7565
- declaration: "export interface SurfaceIntent {\n surfaceOp: SurfaceOp;\n sourceEventSeqs?: SessionSeq[];\n}"
7791
+ declaration: "export type SurfaceIntent<T extends SurfaceEventType = SurfaceEventType> = {\n surfaceOp: SurfaceOp;\n} & (T extends 'assistant/message' ? {\n sourceEventSeqs?: never;\n} : {\n sourceEventSeqs?: SessionSeq[];\n});"
7566
7792
  },
7567
7793
  {
7568
7794
  name: "SurfaceOp",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-tool-cordis",
3
3
  "description": "Self-referential cordis toolset: inspect the live runtime, mount and dispose model-written plugins",
4
- "version": "0.1.2-alpha.5",
4
+ "version": "0.1.3-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,24 +27,24 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
- "@deepseek-ai/dsh-cordis-host-runner": "^0.1.2-alpha.5",
31
- "@deepseek-ai/dsh-agent": "^0.1.2-alpha.5",
32
- "@deepseek-ai/dsh-llm": "^0.1.2-alpha.5",
33
- "@deepseek-ai/dsh-scope": "^0.1.2-alpha.5",
34
- "@deepseek-ai/dsh-session": "^0.1.2-alpha.5",
35
- "@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.5",
36
- "@deepseek-ai/dsh-tools": "^0.1.2-alpha.5",
30
+ "@deepseek-ai/dsh-cordis-host-runner": "^0.1.3-alpha.2",
31
+ "@deepseek-ai/dsh-agent": "^0.1.3-alpha.2",
32
+ "@deepseek-ai/dsh-llm": "^0.1.3-alpha.2",
33
+ "@deepseek-ai/dsh-scope": "^0.1.3-alpha.2",
34
+ "@deepseek-ai/dsh-session": "^0.1.3-alpha.2",
35
+ "@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2",
36
+ "@deepseek-ai/dsh-tools": "^0.1.3-alpha.2",
37
37
  "@deepseek-ai/cordis": "^4.0.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
41
- "@deepseek-ai/dsh-cordis-host-runner": "^0.1.2-alpha.5",
42
- "@deepseek-ai/dsh-llm": "^0.1.2-alpha.5",
43
- "@deepseek-ai/dsh-scope": "^0.1.2-alpha.5",
44
- "@deepseek-ai/dsh-session": "^0.1.2-alpha.5",
45
- "@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.5",
46
- "@deepseek-ai/dsh-agent": "^0.1.2-alpha.5",
47
- "@deepseek-ai/dsh-tools": "^0.1.2-alpha.5",
41
+ "@deepseek-ai/dsh-agent": "^0.1.3-alpha.2",
42
+ "@deepseek-ai/dsh-llm": "^0.1.3-alpha.2",
43
+ "@deepseek-ai/dsh-scope": "^0.1.3-alpha.2",
44
+ "@deepseek-ai/dsh-session": "^0.1.3-alpha.2",
45
+ "@deepseek-ai/dsh-cordis-host-runner": "^0.1.3-alpha.2",
46
+ "@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2",
47
+ "@deepseek-ai/dsh-tools": "^0.1.3-alpha.2",
48
48
  "@deepseek-ai/cordis": "^4.0.2"
49
49
  }
50
50
  }