@ccmsg/protocol 1.11.0 → 1.12.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccmsg/protocol",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Wire contract (schema + types + op attribute table) shared by the ccmsg daemon and web UI",
5
5
  "license": "MIT",
6
6
  "author": "kawaz",
@@ -1,6 +1,6 @@
1
1
  import { type Static, type TSchema, Type } from "@sinclair/typebox";
2
2
  import { request, response } from "../envelope.ts";
3
- import { Timestamp } from "../identifiers.ts";
3
+ import { Sid, Timestamp } from "../identifiers.ts";
4
4
 
5
5
  /** The vocabulary a transcript is read in: item types, the shape one item
6
6
  * takes, the ledger of ids they carry, and the named selections a person dumps
@@ -396,6 +396,32 @@ export type DumpIdEntry = Static<typeof DumpIdEntry>;
396
396
  export const DumpIds = Type.Array(DumpIdEntry, { $id: "DumpIds" });
397
397
  export type DumpIds = Static<typeof DumpIds>;
398
398
 
399
+ /** The file a dump is written to.
400
+ *
401
+ * The reply to a dump names a path rather than carrying the items, so the file
402
+ * is where they actually travel — which makes its shape as much a part of the
403
+ * contract as the reply is: a successor session handed the path, or a client
404
+ * that fetches it, would otherwise be reading a format nothing states. It
405
+ * repeats what it was asked for, because a file outlives the request that made
406
+ * it and has to say on its own what it is a dump of and what was left out. */
407
+ export const SessionDumpFile = Type.Object(
408
+ {
409
+ sid: Sid,
410
+ /** The agent the dump is of, absent when it is of the session itself. */
411
+ agent_id: Type.Optional(Type.String()),
412
+ written_at: Timestamp,
413
+ /** The selection as applied: presets expanded and exclusions kept in
414
+ * place, so the file states what it holds without the instance's config
415
+ * having to be read beside it. */
416
+ types: Type.Array(TranscriptItemSelector),
417
+ /** Oldest first, as the transcript had them. */
418
+ items: Type.Array(TranscriptItem),
419
+ ids: DumpIds,
420
+ },
421
+ { $id: "SessionDumpFile" },
422
+ );
423
+ export type SessionDumpFile = Static<typeof SessionDumpFile>;
424
+
399
425
  /** A selection an operator named and can ask for by name.
400
426
  *
401
427
  * Presets are configured on the instance rather than fixed here, because what
@@ -48,6 +48,7 @@ import type {
48
48
  import type {
49
49
  DumpPresetsReadRequest,
50
50
  DumpPresetsReadResponse,
51
+ SessionDumpFile,
51
52
  TranscriptItem,
52
53
  } from "../control/dump.ts";
53
54
  import type {
@@ -163,7 +164,7 @@ export const SESSION_DUMP_WRITE_REQUEST: Static<typeof SessionDumpWriteRequest>
163
164
  export const SESSION_DUMP_WRITE_RESPONSE: Static<typeof SessionDumpWriteResponse> = {
164
165
  ok: true,
165
166
  request_id,
166
- path: "/transcripts/6f1a2b3c.dump.md",
167
+ path: "/transcripts/6f1a2b3c.dump.json",
167
168
  instance,
168
169
  entries: { thinking: 41, "tool:Bash": 62, "tool:Read": 25 },
169
170
  ids: [
@@ -180,6 +181,16 @@ export const SESSION_DUMP_WRITE_RESPONSE: Static<typeof SessionDumpWriteResponse
180
181
  bytes: 65_536,
181
182
  };
182
183
 
184
+ /** The file the reply above names, holding the items themselves. */
185
+ export const SESSION_DUMP_FILE: Static<typeof SessionDumpFile> = {
186
+ sid,
187
+ agent_id: "a471372f2",
188
+ written_at: FIXTURE_NOW,
189
+ types: ["tool:Read", "tool:Write", "tool:Edit", "tool:Glob", "thinking"],
190
+ items: [],
191
+ ids: [{ kind: "agent", id: "a471372f2", label: "dump-kinds-design", status: "ok" }],
192
+ };
193
+
183
194
  export const DUMP_PRESETS_READ_REQUEST: Static<typeof DumpPresetsReadRequest> = {
184
195
  request_id,
185
196
  op: "dump_presets_read",