@sammorrowdrums/mcpi-protocol 0.85.0-bootstrap.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,gBAAgB,GAAa,CAAC;AAO3C,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AActG,eAAO,MAAM,eAAe,yBAAmD,CAAC;AAEhF,eAAO,MAAM,mBAAmB,mLAQ9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE/D,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,mJAM7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE7D,eAAO,MAAM,cAAc;;;EAGzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AAErD,eAAO,MAAM,eAAe;;;;;EAK1B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;EAY9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE/D,eAAO,MAAM,iBAAiB;;;EAG5B,CAAC;AACH,eAAO,MAAM,qBAAqB;;;;EAIhC,CAAC;AACH,eAAO,MAAM,kBAAkB;;;;EAI7B,CAAC;AACH,eAAO,MAAM,qBAAqB;;;;;EAKhC,CAAC;AACH,eAAO,MAAM,iBAAiB;;;;;;;IAAsD,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK9B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC3D,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACrE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACrE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC","sourcesContent":["import Type, { type Static } from \"typebox\";\n\nexport const PROTOCOL_VERSION = 1 as const;\n\nconst IdSchema = Type.String({ minLength: 1 });\nconst TimestampSchema = Type.Integer({ minimum: 0 });\nconst StrictObject = <const T extends Parameters<typeof Type.Object>[0]>(properties: T) =>\n\tType.Object(properties, { additionalProperties: false });\n\nexport type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };\nconst JsonValueRecursiveSchema = Type.Cyclic(\n\t{\n\t\tJsonValue: Type.Union([\n\t\t\tType.Null(),\n\t\t\tType.Boolean(),\n\t\t\tType.Number(),\n\t\t\tType.String(),\n\t\t\tType.Array(Type.Ref(\"JsonValue\")),\n\t\t\tType.Record(Type.String(), Type.Ref(\"JsonValue\")),\n\t\t]),\n\t},\n\t\"JsonValue\",\n);\nexport const JsonValueSchema = Type.Unsafe<JsonValue>(JsonValueRecursiveSchema);\n\nexport const ThinkingLevelSchema = Type.Union([\n\tType.Literal(\"off\"),\n\tType.Literal(\"minimal\"),\n\tType.Literal(\"low\"),\n\tType.Literal(\"medium\"),\n\tType.Literal(\"high\"),\n\tType.Literal(\"xhigh\"),\n\tType.Literal(\"max\"),\n]);\nexport type ThinkingLevel = Static<typeof ThinkingLevelSchema>;\n\n/** Matches AgentHarnessPhase so adapters do not need a second phase vocabulary. */\nexport const SessionPhaseSchema = Type.Union([\n\tType.Literal(\"idle\"),\n\tType.Literal(\"turn\"),\n\tType.Literal(\"compaction\"),\n\tType.Literal(\"branch_summary\"),\n\tType.Literal(\"retry\"),\n]);\nexport type SessionPhase = Static<typeof SessionPhaseSchema>;\n\nexport const ModelRefSchema = StrictObject({\n\tprovider: IdSchema,\n\tid: IdSchema,\n});\nexport type ModelRef = Static<typeof ModelRefSchema>;\n\nexport const ModelCostSchema = StrictObject({\n\tinput: Type.Number({ minimum: 0 }),\n\toutput: Type.Number({ minimum: 0 }),\n\tcacheRead: Type.Number({ minimum: 0 }),\n\tcacheWrite: Type.Number({ minimum: 0 }),\n});\n\nexport const ModelMetadataSchema = StrictObject({\n\tprovider: IdSchema,\n\tid: IdSchema,\n\tname: Type.String({ minLength: 1 }),\n\tapi: IdSchema,\n\treasoning: Type.Boolean(),\n\tinput: Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")])),\n\tcontextWindow: Type.Integer({ minimum: 1 }),\n\tmaxTokens: Type.Integer({ minimum: 1 }),\n\tcost: ModelCostSchema,\n\tsupportedThinkingLevels: Type.Array(ThinkingLevelSchema, { minItems: 1 }),\n\tauthenticated: Type.Boolean(),\n});\nexport type ModelMetadata = Static<typeof ModelMetadataSchema>;\n\nexport const TextContentSchema = StrictObject({\n\ttype: Type.Literal(\"text\"),\n\ttext: Type.String(),\n});\nexport const ThinkingContentSchema = StrictObject({\n\ttype: Type.Literal(\"thinking\"),\n\tthinking: Type.String(),\n\tredacted: Type.Optional(Type.Boolean()),\n});\nexport const ImageContentSchema = StrictObject({\n\ttype: Type.Literal(\"image\"),\n\tdata: Type.String(),\n\tmimeType: Type.String({ minLength: 1 }),\n});\nexport const ToolCallContentSchema = StrictObject({\n\ttype: Type.Literal(\"toolCall\"),\n\ttoolCallId: IdSchema,\n\ttoolName: IdSchema,\n\tinput: JsonValueSchema,\n});\nexport const UserContentSchema = Type.Union([TextContentSchema, ImageContentSchema]);\nexport const AssistantContentSchema = Type.Union([TextContentSchema, ThinkingContentSchema, ToolCallContentSchema]);\nexport const ToolContentSchema = Type.Union([TextContentSchema, ImageContentSchema]);\nexport type TextContent = Static<typeof TextContentSchema>;\nexport type ThinkingContent = Static<typeof ThinkingContentSchema>;\nexport type ImageContent = Static<typeof ImageContentSchema>;\nexport type ToolCallContent = Static<typeof ToolCallContentSchema>;\n\nexport const UsageSchema = StrictObject({\n\tinput: Type.Integer({ minimum: 0 }),\n\toutput: Type.Integer({ minimum: 0 }),\n\tcacheRead: Type.Integer({ minimum: 0 }),\n\tcacheWrite: Type.Integer({ minimum: 0 }),\n\treasoning: Type.Optional(Type.Integer({ minimum: 0 })),\n\ttotalTokens: Type.Integer({ minimum: 0 }),\n\tcost: StrictObject({\n\t\tinput: Type.Number({ minimum: 0 }),\n\t\toutput: Type.Number({ minimum: 0 }),\n\t\tcacheRead: Type.Number({ minimum: 0 }),\n\t\tcacheWrite: Type.Number({ minimum: 0 }),\n\t\ttotal: Type.Number({ minimum: 0 }),\n\t}),\n});\nexport type Usage = Static<typeof UsageSchema>;\n\nexport const UserTranscriptItemSchema = StrictObject({\n\tid: IdSchema,\n\trole: Type.Literal(\"user\"),\n\tcontent: Type.Array(UserContentSchema),\n\ttimestamp: TimestampSchema,\n});\nconst AssistantTranscriptItemProperties = {\n\tid: IdSchema,\n\trole: Type.Literal(\"assistant\"),\n\tcontent: Type.Array(AssistantContentSchema),\n\tmodel: ModelRefSchema,\n\tresponseModel: Type.Optional(Type.String({ minLength: 1 })),\n\tusage: Type.Optional(UsageSchema),\n\ttimestamp: TimestampSchema,\n} as const;\nconst StreamingAssistantTranscriptItemSchema = StrictObject({\n\t...AssistantTranscriptItemProperties,\n\tstatus: Type.Literal(\"streaming\"),\n});\nconst CompleteAssistantTranscriptItemSchema = StrictObject({\n\t...AssistantTranscriptItemProperties,\n\tstatus: Type.Literal(\"complete\"),\n\tstopReason: Type.Union([Type.Literal(\"stop\"), Type.Literal(\"length\"), Type.Literal(\"toolUse\")]),\n});\nconst ErrorAssistantTranscriptItemSchema = StrictObject({\n\t...AssistantTranscriptItemProperties,\n\tstatus: Type.Literal(\"error\"),\n\tstopReason: Type.Literal(\"error\"),\n\terrorMessage: Type.Optional(Type.String({ minLength: 1 })),\n});\nconst AbortedAssistantTranscriptItemSchema = StrictObject({\n\t...AssistantTranscriptItemProperties,\n\tstatus: Type.Literal(\"aborted\"),\n\tstopReason: Type.Literal(\"aborted\"),\n\terrorMessage: Type.Optional(Type.String()),\n});\nexport const AssistantTranscriptItemSchema = Type.Union([\n\tStreamingAssistantTranscriptItemSchema,\n\tCompleteAssistantTranscriptItemSchema,\n\tErrorAssistantTranscriptItemSchema,\n\tAbortedAssistantTranscriptItemSchema,\n]);\nconst ToolTranscriptItemProperties = {\n\tid: IdSchema,\n\trole: Type.Literal(\"tool\"),\n\ttoolCallId: IdSchema,\n\ttoolName: IdSchema,\n\tinput: JsonValueSchema,\n\tcontent: Type.Array(ToolContentSchema),\n\tdetails: Type.Optional(JsonValueSchema),\n\tusage: Type.Optional(UsageSchema),\n\ttimestamp: TimestampSchema,\n} as const;\nconst RunningToolTranscriptItemSchema = StrictObject({\n\t...ToolTranscriptItemProperties,\n\tstatus: Type.Literal(\"running\"),\n\tisError: Type.Literal(false),\n});\nconst CompleteToolTranscriptItemSchema = StrictObject({\n\t...ToolTranscriptItemProperties,\n\tstatus: Type.Literal(\"complete\"),\n\tisError: Type.Literal(false),\n});\nconst ErrorToolTranscriptItemSchema = StrictObject({\n\t...ToolTranscriptItemProperties,\n\tstatus: Type.Literal(\"error\"),\n\tisError: Type.Literal(true),\n});\nexport const ToolTranscriptItemSchema = Type.Union([\n\tRunningToolTranscriptItemSchema,\n\tCompleteToolTranscriptItemSchema,\n\tErrorToolTranscriptItemSchema,\n]);\nexport const TranscriptItemSchema = Type.Union([\n\tUserTranscriptItemSchema,\n\tAssistantTranscriptItemSchema,\n\tToolTranscriptItemSchema,\n]);\nexport type UserTranscriptItem = Static<typeof UserTranscriptItemSchema>;\nexport type AssistantTranscriptItem = Static<typeof AssistantTranscriptItemSchema>;\nexport type ToolTranscriptItem = Static<typeof ToolTranscriptItemSchema>;\nexport type TranscriptItem = Static<typeof TranscriptItemSchema>;\n\n/** Normalized incremental activity. Snapshots remain authoritative. */\nexport const TranscriptProgressSchema = Type.Union([\n\tStrictObject({\n\t\ttype: Type.Literal(\"item_started\"),\n\t\titem: TranscriptItemSchema,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"assistant_delta\"),\n\t\tmessageId: IdSchema,\n\t\tcontentIndex: Type.Integer({ minimum: 0 }),\n\t\tkind: Type.Union([Type.Literal(\"text\"), Type.Literal(\"thinking\"), Type.Literal(\"toolCall\")]),\n\t\tdelta: Type.String(),\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"item_updated\"),\n\t\titem: Type.Union([AssistantTranscriptItemSchema, ToolTranscriptItemSchema]),\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"item_finished\"),\n\t\titem: Type.Union([\n\t\t\tCompleteAssistantTranscriptItemSchema,\n\t\t\tErrorAssistantTranscriptItemSchema,\n\t\t\tAbortedAssistantTranscriptItemSchema,\n\t\t\tCompleteToolTranscriptItemSchema,\n\t\t\tErrorToolTranscriptItemSchema,\n\t\t]),\n\t}),\n]);\nexport type TranscriptProgress = Static<typeof TranscriptProgressSchema>;\n\nexport const SessionMetadataSchema = StrictObject({\n\tid: IdSchema,\n\tcreatedAt: TimestampSchema,\n\tupdatedAt: Type.Optional(TimestampSchema),\n\tparentSessionId: Type.Optional(IdSchema),\n\tsessionName: Type.Optional(Type.String()),\n\tcwd: Type.Optional(Type.String({ minLength: 1 })),\n});\nexport const SessionSnapshotSchema = StrictObject({\n\tid: IdSchema,\n\tname: Type.Optional(Type.String()),\n\tcwd: Type.String({ minLength: 1 }),\n\tcreatedAt: TimestampSchema,\n\tupdatedAt: TimestampSchema,\n\tphase: SessionPhaseSchema,\n\tmodel: ModelRefSchema,\n\tthinkingLevel: ThinkingLevelSchema,\n\tattached: Type.Boolean(),\n\tlocked: Type.Boolean(),\n\trevision: Type.Integer({ minimum: 0 }),\n\ttranscript: Type.Array(TranscriptItemSchema),\n\tqueuedSteer: Type.Array(UserTranscriptItemSchema),\n\tqueuedSteerCount: Type.Integer({ minimum: 0 }),\n});\nexport type SessionMetadata = Static<typeof SessionMetadataSchema>;\nexport type SessionSnapshot = Static<typeof SessionSnapshotSchema>;\n\nexport const ServerSnapshotSchema = StrictObject({\n\tserverId: IdSchema,\n\tprotocolVersion: Type.Literal(PROTOCOL_VERSION),\n\trevision: Type.Integer({ minimum: 0 }),\n\tsessions: Type.Array(SessionMetadataSchema),\n\tmodels: Type.Array(ModelMetadataSchema),\n});\nexport type ServerSnapshot = Static<typeof ServerSnapshotSchema>;\n\nexport const ProtocolErrorCodeSchema = Type.Union([\n\tType.Literal(\"version\"),\n\tType.Literal(\"busy\"),\n\tType.Literal(\"session_locked\"),\n\tType.Literal(\"not_found\"),\n\tType.Literal(\"invalid_request\"),\n\tType.Literal(\"not_implemented\"),\n\tType.Literal(\"internal_error\"),\n]);\nexport const ProtocolErrorSchema = StrictObject({\n\tcode: ProtocolErrorCodeSchema,\n\tmessage: Type.String(),\n\tdetails: Type.Optional(JsonValueSchema),\n});\nexport type ProtocolErrorCode = Static<typeof ProtocolErrorCodeSchema>;\nexport type ProtocolError = Static<typeof ProtocolErrorSchema>;\n\nconst PromptPayloadProperties = {\n\tsessionId: IdSchema,\n\ttext: Type.String(),\n} as const;\n\nexport const ListCommandSchema = StrictObject({ command: Type.Literal(\"list\") });\nexport const CreateCommandSchema = StrictObject({\n\tcommand: Type.Literal(\"create\"),\n\tcwd: Type.Optional(Type.String({ minLength: 1 })),\n\tname: Type.Optional(Type.String()),\n\tmodel: Type.Optional(ModelRefSchema),\n\tthinkingLevel: Type.Optional(ThinkingLevelSchema),\n});\nexport const AttachCommandSchema = StrictObject({ command: Type.Literal(\"attach\"), sessionId: IdSchema });\nexport const DetachCommandSchema = StrictObject({ command: Type.Literal(\"detach\"), sessionId: IdSchema });\nexport const PromptCommandSchema = StrictObject({ command: Type.Literal(\"prompt\"), ...PromptPayloadProperties });\nexport const SteerCommandSchema = StrictObject({ command: Type.Literal(\"steer\"), ...PromptPayloadProperties });\nexport const AbortCommandSchema = StrictObject({ command: Type.Literal(\"abort\"), sessionId: IdSchema });\nexport const SetModelCommandSchema = StrictObject({\n\tcommand: Type.Literal(\"set_model\"),\n\tsessionId: IdSchema,\n\tmodel: ModelRefSchema,\n});\nexport const SetThinkingCommandSchema = StrictObject({\n\tcommand: Type.Literal(\"set_thinking\"),\n\tsessionId: IdSchema,\n\tthinkingLevel: ThinkingLevelSchema,\n});\nexport const CommandSchema = Type.Union([\n\tListCommandSchema,\n\tCreateCommandSchema,\n\tAttachCommandSchema,\n\tDetachCommandSchema,\n\tPromptCommandSchema,\n\tSteerCommandSchema,\n\tAbortCommandSchema,\n\tSetModelCommandSchema,\n\tSetThinkingCommandSchema,\n]);\nexport type Command = Static<typeof CommandSchema>;\nexport type CommandName = Command[\"command\"];\n\nexport const CreateResultSchema = StrictObject({\n\tcommand: Type.Literal(\"create\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const AttachResultSchema = StrictObject({\n\tcommand: Type.Literal(\"attach\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const PromptResultSchema = StrictObject({\n\tcommand: Type.Literal(\"prompt\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const SteerResultSchema = StrictObject({\n\tcommand: Type.Literal(\"steer\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const AbortResultSchema = StrictObject({\n\tcommand: Type.Literal(\"abort\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const SetModelResultSchema = StrictObject({\n\tcommand: Type.Literal(\"set_model\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const SetThinkingResultSchema = StrictObject({\n\tcommand: Type.Literal(\"set_thinking\"),\n\tsession: SessionSnapshotSchema,\n});\n\nexport const ListResultSchema = StrictObject({\n\tcommand: Type.Literal(\"list\"),\n\tsessions: Type.Array(SessionMetadataSchema),\n});\nexport const DetachResultSchema = StrictObject({\n\tcommand: Type.Literal(\"detach\"),\n\tsessionId: IdSchema,\n});\nexport const CommandResultSchema = Type.Union([\n\tListResultSchema,\n\tCreateResultSchema,\n\tAttachResultSchema,\n\tDetachResultSchema,\n\tPromptResultSchema,\n\tSteerResultSchema,\n\tAbortResultSchema,\n\tSetModelResultSchema,\n\tSetThinkingResultSchema,\n]);\nexport type CommandResult = Static<typeof CommandResultSchema>;\n\nexport type ResultForCommand<TCommand extends Command> = TCommand[\"command\"] extends \"list\"\n\t? Static<typeof ListResultSchema>\n\t: TCommand[\"command\"] extends \"detach\"\n\t\t? Static<typeof DetachResultSchema>\n\t\t: Extract<CommandResult, { command: TCommand[\"command\"] }>;\n\n/** Must be the first frame sent by a client. Version is intentionally an integer, not a coercible string. */\nexport const ClientHelloSchema = StrictObject({\n\ttype: Type.Literal(\"hello\"),\n\tversion: Type.Integer({ minimum: 0 }),\n});\nexport type ClientHello = Static<typeof ClientHelloSchema>;\n\nexport const RequestEnvelopeSchema = StrictObject({\n\ttype: Type.Literal(\"request\"),\n\tid: IdSchema,\n\trequest: CommandSchema,\n});\nexport type RequestEnvelope = Static<typeof RequestEnvelopeSchema>;\nexport const ClientMessageSchema = Type.Union([ClientHelloSchema, RequestEnvelopeSchema]);\nexport type ClientMessage = Static<typeof ClientMessageSchema>;\n\nexport const ServerEventSchema = Type.Union([\n\tStrictObject({ type: Type.Literal(\"server_snapshot\"), snapshot: ServerSnapshotSchema }),\n\tStrictObject({ type: Type.Literal(\"session_snapshot\"), snapshot: SessionSnapshotSchema }),\n\tStrictObject({\n\t\ttype: Type.Literal(\"session_progress\"),\n\t\tsessionId: IdSchema,\n\t\tprogress: TranscriptProgressSchema,\n\t}),\n\tStrictObject({ type: Type.Literal(\"session_removed\"), sessionId: IdSchema }),\n]);\nexport type ServerEvent = Static<typeof ServerEventSchema>;\n\nexport const ServerHelloSchema = StrictObject({\n\ttype: Type.Literal(\"hello\"),\n\tversion: Type.Literal(PROTOCOL_VERSION),\n\tconnectionId: IdSchema,\n\tsnapshot: ServerSnapshotSchema,\n});\nexport const ServerHelloErrorSchema = StrictObject({\n\ttype: Type.Literal(\"hello_error\"),\n\terror: ProtocolErrorSchema,\n});\nexport const ResponseEnvelopeSchema = Type.Union([\n\tStrictObject({\n\t\ttype: Type.Literal(\"response\"),\n\t\tid: IdSchema,\n\t\tok: Type.Literal(true),\n\t\tresult: CommandResultSchema,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"response\"),\n\t\tid: IdSchema,\n\t\tok: Type.Literal(false),\n\t\terror: ProtocolErrorSchema,\n\t}),\n]);\nexport const EventEnvelopeSchema = StrictObject({\n\ttype: Type.Literal(\"event\"),\n\tevent: ServerEventSchema,\n});\nexport const ServerMessageSchema = Type.Union([\n\tServerHelloSchema,\n\tServerHelloErrorSchema,\n\tResponseEnvelopeSchema,\n\tEventEnvelopeSchema,\n]);\nexport type ServerHello = Static<typeof ServerHelloSchema>;\nexport type ServerHelloError = Static<typeof ServerHelloErrorSchema>;\nexport type ResponseEnvelope = Static<typeof ResponseEnvelopeSchema>;\nexport type EventEnvelope = Static<typeof EventEnvelopeSchema>;\nexport type ServerMessage = Static<typeof ServerMessageSchema>;\n"]}
@@ -0,0 +1,386 @@
1
+ import Type from "typebox";
2
+ export const PROTOCOL_VERSION = 1;
3
+ const IdSchema = Type.String({ minLength: 1 });
4
+ const TimestampSchema = Type.Integer({ minimum: 0 });
5
+ const StrictObject = (properties) => Type.Object(properties, { additionalProperties: false });
6
+ const JsonValueRecursiveSchema = Type.Cyclic({
7
+ JsonValue: Type.Union([
8
+ Type.Null(),
9
+ Type.Boolean(),
10
+ Type.Number(),
11
+ Type.String(),
12
+ Type.Array(Type.Ref("JsonValue")),
13
+ Type.Record(Type.String(), Type.Ref("JsonValue")),
14
+ ]),
15
+ }, "JsonValue");
16
+ export const JsonValueSchema = Type.Unsafe(JsonValueRecursiveSchema);
17
+ export const ThinkingLevelSchema = Type.Union([
18
+ Type.Literal("off"),
19
+ Type.Literal("minimal"),
20
+ Type.Literal("low"),
21
+ Type.Literal("medium"),
22
+ Type.Literal("high"),
23
+ Type.Literal("xhigh"),
24
+ Type.Literal("max"),
25
+ ]);
26
+ /** Matches AgentHarnessPhase so adapters do not need a second phase vocabulary. */
27
+ export const SessionPhaseSchema = Type.Union([
28
+ Type.Literal("idle"),
29
+ Type.Literal("turn"),
30
+ Type.Literal("compaction"),
31
+ Type.Literal("branch_summary"),
32
+ Type.Literal("retry"),
33
+ ]);
34
+ export const ModelRefSchema = StrictObject({
35
+ provider: IdSchema,
36
+ id: IdSchema,
37
+ });
38
+ export const ModelCostSchema = StrictObject({
39
+ input: Type.Number({ minimum: 0 }),
40
+ output: Type.Number({ minimum: 0 }),
41
+ cacheRead: Type.Number({ minimum: 0 }),
42
+ cacheWrite: Type.Number({ minimum: 0 }),
43
+ });
44
+ export const ModelMetadataSchema = StrictObject({
45
+ provider: IdSchema,
46
+ id: IdSchema,
47
+ name: Type.String({ minLength: 1 }),
48
+ api: IdSchema,
49
+ reasoning: Type.Boolean(),
50
+ input: Type.Array(Type.Union([Type.Literal("text"), Type.Literal("image")])),
51
+ contextWindow: Type.Integer({ minimum: 1 }),
52
+ maxTokens: Type.Integer({ minimum: 1 }),
53
+ cost: ModelCostSchema,
54
+ supportedThinkingLevels: Type.Array(ThinkingLevelSchema, { minItems: 1 }),
55
+ authenticated: Type.Boolean(),
56
+ });
57
+ export const TextContentSchema = StrictObject({
58
+ type: Type.Literal("text"),
59
+ text: Type.String(),
60
+ });
61
+ export const ThinkingContentSchema = StrictObject({
62
+ type: Type.Literal("thinking"),
63
+ thinking: Type.String(),
64
+ redacted: Type.Optional(Type.Boolean()),
65
+ });
66
+ export const ImageContentSchema = StrictObject({
67
+ type: Type.Literal("image"),
68
+ data: Type.String(),
69
+ mimeType: Type.String({ minLength: 1 }),
70
+ });
71
+ export const ToolCallContentSchema = StrictObject({
72
+ type: Type.Literal("toolCall"),
73
+ toolCallId: IdSchema,
74
+ toolName: IdSchema,
75
+ input: JsonValueSchema,
76
+ });
77
+ export const UserContentSchema = Type.Union([TextContentSchema, ImageContentSchema]);
78
+ export const AssistantContentSchema = Type.Union([TextContentSchema, ThinkingContentSchema, ToolCallContentSchema]);
79
+ export const ToolContentSchema = Type.Union([TextContentSchema, ImageContentSchema]);
80
+ export const UsageSchema = StrictObject({
81
+ input: Type.Integer({ minimum: 0 }),
82
+ output: Type.Integer({ minimum: 0 }),
83
+ cacheRead: Type.Integer({ minimum: 0 }),
84
+ cacheWrite: Type.Integer({ minimum: 0 }),
85
+ reasoning: Type.Optional(Type.Integer({ minimum: 0 })),
86
+ totalTokens: Type.Integer({ minimum: 0 }),
87
+ cost: StrictObject({
88
+ input: Type.Number({ minimum: 0 }),
89
+ output: Type.Number({ minimum: 0 }),
90
+ cacheRead: Type.Number({ minimum: 0 }),
91
+ cacheWrite: Type.Number({ minimum: 0 }),
92
+ total: Type.Number({ minimum: 0 }),
93
+ }),
94
+ });
95
+ export const UserTranscriptItemSchema = StrictObject({
96
+ id: IdSchema,
97
+ role: Type.Literal("user"),
98
+ content: Type.Array(UserContentSchema),
99
+ timestamp: TimestampSchema,
100
+ });
101
+ const AssistantTranscriptItemProperties = {
102
+ id: IdSchema,
103
+ role: Type.Literal("assistant"),
104
+ content: Type.Array(AssistantContentSchema),
105
+ model: ModelRefSchema,
106
+ responseModel: Type.Optional(Type.String({ minLength: 1 })),
107
+ usage: Type.Optional(UsageSchema),
108
+ timestamp: TimestampSchema,
109
+ };
110
+ const StreamingAssistantTranscriptItemSchema = StrictObject({
111
+ ...AssistantTranscriptItemProperties,
112
+ status: Type.Literal("streaming"),
113
+ });
114
+ const CompleteAssistantTranscriptItemSchema = StrictObject({
115
+ ...AssistantTranscriptItemProperties,
116
+ status: Type.Literal("complete"),
117
+ stopReason: Type.Union([Type.Literal("stop"), Type.Literal("length"), Type.Literal("toolUse")]),
118
+ });
119
+ const ErrorAssistantTranscriptItemSchema = StrictObject({
120
+ ...AssistantTranscriptItemProperties,
121
+ status: Type.Literal("error"),
122
+ stopReason: Type.Literal("error"),
123
+ errorMessage: Type.Optional(Type.String({ minLength: 1 })),
124
+ });
125
+ const AbortedAssistantTranscriptItemSchema = StrictObject({
126
+ ...AssistantTranscriptItemProperties,
127
+ status: Type.Literal("aborted"),
128
+ stopReason: Type.Literal("aborted"),
129
+ errorMessage: Type.Optional(Type.String()),
130
+ });
131
+ export const AssistantTranscriptItemSchema = Type.Union([
132
+ StreamingAssistantTranscriptItemSchema,
133
+ CompleteAssistantTranscriptItemSchema,
134
+ ErrorAssistantTranscriptItemSchema,
135
+ AbortedAssistantTranscriptItemSchema,
136
+ ]);
137
+ const ToolTranscriptItemProperties = {
138
+ id: IdSchema,
139
+ role: Type.Literal("tool"),
140
+ toolCallId: IdSchema,
141
+ toolName: IdSchema,
142
+ input: JsonValueSchema,
143
+ content: Type.Array(ToolContentSchema),
144
+ details: Type.Optional(JsonValueSchema),
145
+ usage: Type.Optional(UsageSchema),
146
+ timestamp: TimestampSchema,
147
+ };
148
+ const RunningToolTranscriptItemSchema = StrictObject({
149
+ ...ToolTranscriptItemProperties,
150
+ status: Type.Literal("running"),
151
+ isError: Type.Literal(false),
152
+ });
153
+ const CompleteToolTranscriptItemSchema = StrictObject({
154
+ ...ToolTranscriptItemProperties,
155
+ status: Type.Literal("complete"),
156
+ isError: Type.Literal(false),
157
+ });
158
+ const ErrorToolTranscriptItemSchema = StrictObject({
159
+ ...ToolTranscriptItemProperties,
160
+ status: Type.Literal("error"),
161
+ isError: Type.Literal(true),
162
+ });
163
+ export const ToolTranscriptItemSchema = Type.Union([
164
+ RunningToolTranscriptItemSchema,
165
+ CompleteToolTranscriptItemSchema,
166
+ ErrorToolTranscriptItemSchema,
167
+ ]);
168
+ export const TranscriptItemSchema = Type.Union([
169
+ UserTranscriptItemSchema,
170
+ AssistantTranscriptItemSchema,
171
+ ToolTranscriptItemSchema,
172
+ ]);
173
+ /** Normalized incremental activity. Snapshots remain authoritative. */
174
+ export const TranscriptProgressSchema = Type.Union([
175
+ StrictObject({
176
+ type: Type.Literal("item_started"),
177
+ item: TranscriptItemSchema,
178
+ }),
179
+ StrictObject({
180
+ type: Type.Literal("assistant_delta"),
181
+ messageId: IdSchema,
182
+ contentIndex: Type.Integer({ minimum: 0 }),
183
+ kind: Type.Union([Type.Literal("text"), Type.Literal("thinking"), Type.Literal("toolCall")]),
184
+ delta: Type.String(),
185
+ }),
186
+ StrictObject({
187
+ type: Type.Literal("item_updated"),
188
+ item: Type.Union([AssistantTranscriptItemSchema, ToolTranscriptItemSchema]),
189
+ }),
190
+ StrictObject({
191
+ type: Type.Literal("item_finished"),
192
+ item: Type.Union([
193
+ CompleteAssistantTranscriptItemSchema,
194
+ ErrorAssistantTranscriptItemSchema,
195
+ AbortedAssistantTranscriptItemSchema,
196
+ CompleteToolTranscriptItemSchema,
197
+ ErrorToolTranscriptItemSchema,
198
+ ]),
199
+ }),
200
+ ]);
201
+ export const SessionMetadataSchema = StrictObject({
202
+ id: IdSchema,
203
+ createdAt: TimestampSchema,
204
+ updatedAt: Type.Optional(TimestampSchema),
205
+ parentSessionId: Type.Optional(IdSchema),
206
+ sessionName: Type.Optional(Type.String()),
207
+ cwd: Type.Optional(Type.String({ minLength: 1 })),
208
+ });
209
+ export const SessionSnapshotSchema = StrictObject({
210
+ id: IdSchema,
211
+ name: Type.Optional(Type.String()),
212
+ cwd: Type.String({ minLength: 1 }),
213
+ createdAt: TimestampSchema,
214
+ updatedAt: TimestampSchema,
215
+ phase: SessionPhaseSchema,
216
+ model: ModelRefSchema,
217
+ thinkingLevel: ThinkingLevelSchema,
218
+ attached: Type.Boolean(),
219
+ locked: Type.Boolean(),
220
+ revision: Type.Integer({ minimum: 0 }),
221
+ transcript: Type.Array(TranscriptItemSchema),
222
+ queuedSteer: Type.Array(UserTranscriptItemSchema),
223
+ queuedSteerCount: Type.Integer({ minimum: 0 }),
224
+ });
225
+ export const ServerSnapshotSchema = StrictObject({
226
+ serverId: IdSchema,
227
+ protocolVersion: Type.Literal(PROTOCOL_VERSION),
228
+ revision: Type.Integer({ minimum: 0 }),
229
+ sessions: Type.Array(SessionMetadataSchema),
230
+ models: Type.Array(ModelMetadataSchema),
231
+ });
232
+ export const ProtocolErrorCodeSchema = Type.Union([
233
+ Type.Literal("version"),
234
+ Type.Literal("busy"),
235
+ Type.Literal("session_locked"),
236
+ Type.Literal("not_found"),
237
+ Type.Literal("invalid_request"),
238
+ Type.Literal("not_implemented"),
239
+ Type.Literal("internal_error"),
240
+ ]);
241
+ export const ProtocolErrorSchema = StrictObject({
242
+ code: ProtocolErrorCodeSchema,
243
+ message: Type.String(),
244
+ details: Type.Optional(JsonValueSchema),
245
+ });
246
+ const PromptPayloadProperties = {
247
+ sessionId: IdSchema,
248
+ text: Type.String(),
249
+ };
250
+ export const ListCommandSchema = StrictObject({ command: Type.Literal("list") });
251
+ export const CreateCommandSchema = StrictObject({
252
+ command: Type.Literal("create"),
253
+ cwd: Type.Optional(Type.String({ minLength: 1 })),
254
+ name: Type.Optional(Type.String()),
255
+ model: Type.Optional(ModelRefSchema),
256
+ thinkingLevel: Type.Optional(ThinkingLevelSchema),
257
+ });
258
+ export const AttachCommandSchema = StrictObject({ command: Type.Literal("attach"), sessionId: IdSchema });
259
+ export const DetachCommandSchema = StrictObject({ command: Type.Literal("detach"), sessionId: IdSchema });
260
+ export const PromptCommandSchema = StrictObject({ command: Type.Literal("prompt"), ...PromptPayloadProperties });
261
+ export const SteerCommandSchema = StrictObject({ command: Type.Literal("steer"), ...PromptPayloadProperties });
262
+ export const AbortCommandSchema = StrictObject({ command: Type.Literal("abort"), sessionId: IdSchema });
263
+ export const SetModelCommandSchema = StrictObject({
264
+ command: Type.Literal("set_model"),
265
+ sessionId: IdSchema,
266
+ model: ModelRefSchema,
267
+ });
268
+ export const SetThinkingCommandSchema = StrictObject({
269
+ command: Type.Literal("set_thinking"),
270
+ sessionId: IdSchema,
271
+ thinkingLevel: ThinkingLevelSchema,
272
+ });
273
+ export const CommandSchema = Type.Union([
274
+ ListCommandSchema,
275
+ CreateCommandSchema,
276
+ AttachCommandSchema,
277
+ DetachCommandSchema,
278
+ PromptCommandSchema,
279
+ SteerCommandSchema,
280
+ AbortCommandSchema,
281
+ SetModelCommandSchema,
282
+ SetThinkingCommandSchema,
283
+ ]);
284
+ export const CreateResultSchema = StrictObject({
285
+ command: Type.Literal("create"),
286
+ session: SessionSnapshotSchema,
287
+ });
288
+ export const AttachResultSchema = StrictObject({
289
+ command: Type.Literal("attach"),
290
+ session: SessionSnapshotSchema,
291
+ });
292
+ export const PromptResultSchema = StrictObject({
293
+ command: Type.Literal("prompt"),
294
+ session: SessionSnapshotSchema,
295
+ });
296
+ export const SteerResultSchema = StrictObject({
297
+ command: Type.Literal("steer"),
298
+ session: SessionSnapshotSchema,
299
+ });
300
+ export const AbortResultSchema = StrictObject({
301
+ command: Type.Literal("abort"),
302
+ session: SessionSnapshotSchema,
303
+ });
304
+ export const SetModelResultSchema = StrictObject({
305
+ command: Type.Literal("set_model"),
306
+ session: SessionSnapshotSchema,
307
+ });
308
+ export const SetThinkingResultSchema = StrictObject({
309
+ command: Type.Literal("set_thinking"),
310
+ session: SessionSnapshotSchema,
311
+ });
312
+ export const ListResultSchema = StrictObject({
313
+ command: Type.Literal("list"),
314
+ sessions: Type.Array(SessionMetadataSchema),
315
+ });
316
+ export const DetachResultSchema = StrictObject({
317
+ command: Type.Literal("detach"),
318
+ sessionId: IdSchema,
319
+ });
320
+ export const CommandResultSchema = Type.Union([
321
+ ListResultSchema,
322
+ CreateResultSchema,
323
+ AttachResultSchema,
324
+ DetachResultSchema,
325
+ PromptResultSchema,
326
+ SteerResultSchema,
327
+ AbortResultSchema,
328
+ SetModelResultSchema,
329
+ SetThinkingResultSchema,
330
+ ]);
331
+ /** Must be the first frame sent by a client. Version is intentionally an integer, not a coercible string. */
332
+ export const ClientHelloSchema = StrictObject({
333
+ type: Type.Literal("hello"),
334
+ version: Type.Integer({ minimum: 0 }),
335
+ });
336
+ export const RequestEnvelopeSchema = StrictObject({
337
+ type: Type.Literal("request"),
338
+ id: IdSchema,
339
+ request: CommandSchema,
340
+ });
341
+ export const ClientMessageSchema = Type.Union([ClientHelloSchema, RequestEnvelopeSchema]);
342
+ export const ServerEventSchema = Type.Union([
343
+ StrictObject({ type: Type.Literal("server_snapshot"), snapshot: ServerSnapshotSchema }),
344
+ StrictObject({ type: Type.Literal("session_snapshot"), snapshot: SessionSnapshotSchema }),
345
+ StrictObject({
346
+ type: Type.Literal("session_progress"),
347
+ sessionId: IdSchema,
348
+ progress: TranscriptProgressSchema,
349
+ }),
350
+ StrictObject({ type: Type.Literal("session_removed"), sessionId: IdSchema }),
351
+ ]);
352
+ export const ServerHelloSchema = StrictObject({
353
+ type: Type.Literal("hello"),
354
+ version: Type.Literal(PROTOCOL_VERSION),
355
+ connectionId: IdSchema,
356
+ snapshot: ServerSnapshotSchema,
357
+ });
358
+ export const ServerHelloErrorSchema = StrictObject({
359
+ type: Type.Literal("hello_error"),
360
+ error: ProtocolErrorSchema,
361
+ });
362
+ export const ResponseEnvelopeSchema = Type.Union([
363
+ StrictObject({
364
+ type: Type.Literal("response"),
365
+ id: IdSchema,
366
+ ok: Type.Literal(true),
367
+ result: CommandResultSchema,
368
+ }),
369
+ StrictObject({
370
+ type: Type.Literal("response"),
371
+ id: IdSchema,
372
+ ok: Type.Literal(false),
373
+ error: ProtocolErrorSchema,
374
+ }),
375
+ ]);
376
+ export const EventEnvelopeSchema = StrictObject({
377
+ type: Type.Literal("event"),
378
+ event: ServerEventSchema,
379
+ });
380
+ export const ServerMessageSchema = Type.Union([
381
+ ServerHelloSchema,
382
+ ServerHelloErrorSchema,
383
+ ResponseEnvelopeSchema,
384
+ EventEnvelopeSchema,
385
+ ]);
386
+ //# sourceMappingURL=sch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;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,YAAY,CAAC;IAClD,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IACjC,KAAK,EAAE,mBAAmB;CAC1B,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,KAAK,CAAC;IAChD,YAAY,CAAC;QACZ,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QAC9B,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QACtB,MAAM,EAAE,mBAAmB;KAC3B,CAAC;IACF,YAAY,CAAC;QACZ,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QAC9B,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACvB,KAAK,EAAE,mBAAmB;KAC1B,CAAC;CACF,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC;IAC/C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC3B,KAAK,EAAE,iBAAiB;CACxB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC;IAC7C,iBAAiB;IACjB,sBAAsB;IACtB,sBAAsB;IACtB,mBAAmB;CACnB,CAAC,CAAC","sourcesContent":["import Type, { type Static } from \"typebox\";\n\nexport const PROTOCOL_VERSION = 1 as const;\n\nconst IdSchema = Type.String({ minLength: 1 });\nconst TimestampSchema = Type.Integer({ minimum: 0 });\nconst StrictObject = <const T extends Parameters<typeof Type.Object>[0]>(properties: T) =>\n\tType.Object(properties, { additionalProperties: false });\n\nexport type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };\nconst JsonValueRecursiveSchema = Type.Cyclic(\n\t{\n\t\tJsonValue: Type.Union([\n\t\t\tType.Null(),\n\t\t\tType.Boolean(),\n\t\t\tType.Number(),\n\t\t\tType.String(),\n\t\t\tType.Array(Type.Ref(\"JsonValue\")),\n\t\t\tType.Record(Type.String(), Type.Ref(\"JsonValue\")),\n\t\t]),\n\t},\n\t\"JsonValue\",\n);\nexport const JsonValueSchema = Type.Unsafe<JsonValue>(JsonValueRecursiveSchema);\n\nexport const ThinkingLevelSchema = Type.Union([\n\tType.Literal(\"off\"),\n\tType.Literal(\"minimal\"),\n\tType.Literal(\"low\"),\n\tType.Literal(\"medium\"),\n\tType.Literal(\"high\"),\n\tType.Literal(\"xhigh\"),\n\tType.Literal(\"max\"),\n]);\nexport type ThinkingLevel = Static<typeof ThinkingLevelSchema>;\n\n/** Matches AgentHarnessPhase so adapters do not need a second phase vocabulary. */\nexport const SessionPhaseSchema = Type.Union([\n\tType.Literal(\"idle\"),\n\tType.Literal(\"turn\"),\n\tType.Literal(\"compaction\"),\n\tType.Literal(\"branch_summary\"),\n\tType.Literal(\"retry\"),\n]);\nexport type SessionPhase = Static<typeof SessionPhaseSchema>;\n\nexport const ModelRefSchema = StrictObject({\n\tprovider: IdSchema,\n\tid: IdSchema,\n});\nexport type ModelRef = Static<typeof ModelRefSchema>;\n\nexport const ModelCostSchema = StrictObject({\n\tinput: Type.Number({ minimum: 0 }),\n\toutput: Type.Number({ minimum: 0 }),\n\tcacheRead: Type.Number({ minimum: 0 }),\n\tcacheWrite: Type.Number({ minimum: 0 }),\n});\n\nexport const ModelMetadataSchema = StrictObject({\n\tprovider: IdSchema,\n\tid: IdSchema,\n\tname: Type.String({ minLength: 1 }),\n\tapi: IdSchema,\n\treasoning: Type.Boolean(),\n\tinput: Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")])),\n\tcontextWindow: Type.Integer({ minimum: 1 }),\n\tmaxTokens: Type.Integer({ minimum: 1 }),\n\tcost: ModelCostSchema,\n\tsupportedThinkingLevels: Type.Array(ThinkingLevelSchema, { minItems: 1 }),\n\tauthenticated: Type.Boolean(),\n});\nexport type ModelMetadata = Static<typeof ModelMetadataSchema>;\n\nexport const TextContentSchema = StrictObject({\n\ttype: Type.Literal(\"text\"),\n\ttext: Type.String(),\n});\nexport const ThinkingContentSchema = StrictObject({\n\ttype: Type.Literal(\"thinking\"),\n\tthinking: Type.String(),\n\tredacted: Type.Optional(Type.Boolean()),\n});\nexport const ImageContentSchema = StrictObject({\n\ttype: Type.Literal(\"image\"),\n\tdata: Type.String(),\n\tmimeType: Type.String({ minLength: 1 }),\n});\nexport const ToolCallContentSchema = StrictObject({\n\ttype: Type.Literal(\"toolCall\"),\n\ttoolCallId: IdSchema,\n\ttoolName: IdSchema,\n\tinput: JsonValueSchema,\n});\nexport const UserContentSchema = Type.Union([TextContentSchema, ImageContentSchema]);\nexport const AssistantContentSchema = Type.Union([TextContentSchema, ThinkingContentSchema, ToolCallContentSchema]);\nexport const ToolContentSchema = Type.Union([TextContentSchema, ImageContentSchema]);\nexport type TextContent = Static<typeof TextContentSchema>;\nexport type ThinkingContent = Static<typeof ThinkingContentSchema>;\nexport type ImageContent = Static<typeof ImageContentSchema>;\nexport type ToolCallContent = Static<typeof ToolCallContentSchema>;\n\nexport const UsageSchema = StrictObject({\n\tinput: Type.Integer({ minimum: 0 }),\n\toutput: Type.Integer({ minimum: 0 }),\n\tcacheRead: Type.Integer({ minimum: 0 }),\n\tcacheWrite: Type.Integer({ minimum: 0 }),\n\treasoning: Type.Optional(Type.Integer({ minimum: 0 })),\n\ttotalTokens: Type.Integer({ minimum: 0 }),\n\tcost: StrictObject({\n\t\tinput: Type.Number({ minimum: 0 }),\n\t\toutput: Type.Number({ minimum: 0 }),\n\t\tcacheRead: Type.Number({ minimum: 0 }),\n\t\tcacheWrite: Type.Number({ minimum: 0 }),\n\t\ttotal: Type.Number({ minimum: 0 }),\n\t}),\n});\nexport type Usage = Static<typeof UsageSchema>;\n\nexport const UserTranscriptItemSchema = StrictObject({\n\tid: IdSchema,\n\trole: Type.Literal(\"user\"),\n\tcontent: Type.Array(UserContentSchema),\n\ttimestamp: TimestampSchema,\n});\nconst AssistantTranscriptItemProperties = {\n\tid: IdSchema,\n\trole: Type.Literal(\"assistant\"),\n\tcontent: Type.Array(AssistantContentSchema),\n\tmodel: ModelRefSchema,\n\tresponseModel: Type.Optional(Type.String({ minLength: 1 })),\n\tusage: Type.Optional(UsageSchema),\n\ttimestamp: TimestampSchema,\n} as const;\nconst StreamingAssistantTranscriptItemSchema = StrictObject({\n\t...AssistantTranscriptItemProperties,\n\tstatus: Type.Literal(\"streaming\"),\n});\nconst CompleteAssistantTranscriptItemSchema = StrictObject({\n\t...AssistantTranscriptItemProperties,\n\tstatus: Type.Literal(\"complete\"),\n\tstopReason: Type.Union([Type.Literal(\"stop\"), Type.Literal(\"length\"), Type.Literal(\"toolUse\")]),\n});\nconst ErrorAssistantTranscriptItemSchema = StrictObject({\n\t...AssistantTranscriptItemProperties,\n\tstatus: Type.Literal(\"error\"),\n\tstopReason: Type.Literal(\"error\"),\n\terrorMessage: Type.Optional(Type.String({ minLength: 1 })),\n});\nconst AbortedAssistantTranscriptItemSchema = StrictObject({\n\t...AssistantTranscriptItemProperties,\n\tstatus: Type.Literal(\"aborted\"),\n\tstopReason: Type.Literal(\"aborted\"),\n\terrorMessage: Type.Optional(Type.String()),\n});\nexport const AssistantTranscriptItemSchema = Type.Union([\n\tStreamingAssistantTranscriptItemSchema,\n\tCompleteAssistantTranscriptItemSchema,\n\tErrorAssistantTranscriptItemSchema,\n\tAbortedAssistantTranscriptItemSchema,\n]);\nconst ToolTranscriptItemProperties = {\n\tid: IdSchema,\n\trole: Type.Literal(\"tool\"),\n\ttoolCallId: IdSchema,\n\ttoolName: IdSchema,\n\tinput: JsonValueSchema,\n\tcontent: Type.Array(ToolContentSchema),\n\tdetails: Type.Optional(JsonValueSchema),\n\tusage: Type.Optional(UsageSchema),\n\ttimestamp: TimestampSchema,\n} as const;\nconst RunningToolTranscriptItemSchema = StrictObject({\n\t...ToolTranscriptItemProperties,\n\tstatus: Type.Literal(\"running\"),\n\tisError: Type.Literal(false),\n});\nconst CompleteToolTranscriptItemSchema = StrictObject({\n\t...ToolTranscriptItemProperties,\n\tstatus: Type.Literal(\"complete\"),\n\tisError: Type.Literal(false),\n});\nconst ErrorToolTranscriptItemSchema = StrictObject({\n\t...ToolTranscriptItemProperties,\n\tstatus: Type.Literal(\"error\"),\n\tisError: Type.Literal(true),\n});\nexport const ToolTranscriptItemSchema = Type.Union([\n\tRunningToolTranscriptItemSchema,\n\tCompleteToolTranscriptItemSchema,\n\tErrorToolTranscriptItemSchema,\n]);\nexport const TranscriptItemSchema = Type.Union([\n\tUserTranscriptItemSchema,\n\tAssistantTranscriptItemSchema,\n\tToolTranscriptItemSchema,\n]);\nexport type UserTranscriptItem = Static<typeof UserTranscriptItemSchema>;\nexport type AssistantTranscriptItem = Static<typeof AssistantTranscriptItemSchema>;\nexport type ToolTranscriptItem = Static<typeof ToolTranscriptItemSchema>;\nexport type TranscriptItem = Static<typeof TranscriptItemSchema>;\n\n/** Normalized incremental activity. Snapshots remain authoritative. */\nexport const TranscriptProgressSchema = Type.Union([\n\tStrictObject({\n\t\ttype: Type.Literal(\"item_started\"),\n\t\titem: TranscriptItemSchema,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"assistant_delta\"),\n\t\tmessageId: IdSchema,\n\t\tcontentIndex: Type.Integer({ minimum: 0 }),\n\t\tkind: Type.Union([Type.Literal(\"text\"), Type.Literal(\"thinking\"), Type.Literal(\"toolCall\")]),\n\t\tdelta: Type.String(),\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"item_updated\"),\n\t\titem: Type.Union([AssistantTranscriptItemSchema, ToolTranscriptItemSchema]),\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"item_finished\"),\n\t\titem: Type.Union([\n\t\t\tCompleteAssistantTranscriptItemSchema,\n\t\t\tErrorAssistantTranscriptItemSchema,\n\t\t\tAbortedAssistantTranscriptItemSchema,\n\t\t\tCompleteToolTranscriptItemSchema,\n\t\t\tErrorToolTranscriptItemSchema,\n\t\t]),\n\t}),\n]);\nexport type TranscriptProgress = Static<typeof TranscriptProgressSchema>;\n\nexport const SessionMetadataSchema = StrictObject({\n\tid: IdSchema,\n\tcreatedAt: TimestampSchema,\n\tupdatedAt: Type.Optional(TimestampSchema),\n\tparentSessionId: Type.Optional(IdSchema),\n\tsessionName: Type.Optional(Type.String()),\n\tcwd: Type.Optional(Type.String({ minLength: 1 })),\n});\nexport const SessionSnapshotSchema = StrictObject({\n\tid: IdSchema,\n\tname: Type.Optional(Type.String()),\n\tcwd: Type.String({ minLength: 1 }),\n\tcreatedAt: TimestampSchema,\n\tupdatedAt: TimestampSchema,\n\tphase: SessionPhaseSchema,\n\tmodel: ModelRefSchema,\n\tthinkingLevel: ThinkingLevelSchema,\n\tattached: Type.Boolean(),\n\tlocked: Type.Boolean(),\n\trevision: Type.Integer({ minimum: 0 }),\n\ttranscript: Type.Array(TranscriptItemSchema),\n\tqueuedSteer: Type.Array(UserTranscriptItemSchema),\n\tqueuedSteerCount: Type.Integer({ minimum: 0 }),\n});\nexport type SessionMetadata = Static<typeof SessionMetadataSchema>;\nexport type SessionSnapshot = Static<typeof SessionSnapshotSchema>;\n\nexport const ServerSnapshotSchema = StrictObject({\n\tserverId: IdSchema,\n\tprotocolVersion: Type.Literal(PROTOCOL_VERSION),\n\trevision: Type.Integer({ minimum: 0 }),\n\tsessions: Type.Array(SessionMetadataSchema),\n\tmodels: Type.Array(ModelMetadataSchema),\n});\nexport type ServerSnapshot = Static<typeof ServerSnapshotSchema>;\n\nexport const ProtocolErrorCodeSchema = Type.Union([\n\tType.Literal(\"version\"),\n\tType.Literal(\"busy\"),\n\tType.Literal(\"session_locked\"),\n\tType.Literal(\"not_found\"),\n\tType.Literal(\"invalid_request\"),\n\tType.Literal(\"not_implemented\"),\n\tType.Literal(\"internal_error\"),\n]);\nexport const ProtocolErrorSchema = StrictObject({\n\tcode: ProtocolErrorCodeSchema,\n\tmessage: Type.String(),\n\tdetails: Type.Optional(JsonValueSchema),\n});\nexport type ProtocolErrorCode = Static<typeof ProtocolErrorCodeSchema>;\nexport type ProtocolError = Static<typeof ProtocolErrorSchema>;\n\nconst PromptPayloadProperties = {\n\tsessionId: IdSchema,\n\ttext: Type.String(),\n} as const;\n\nexport const ListCommandSchema = StrictObject({ command: Type.Literal(\"list\") });\nexport const CreateCommandSchema = StrictObject({\n\tcommand: Type.Literal(\"create\"),\n\tcwd: Type.Optional(Type.String({ minLength: 1 })),\n\tname: Type.Optional(Type.String()),\n\tmodel: Type.Optional(ModelRefSchema),\n\tthinkingLevel: Type.Optional(ThinkingLevelSchema),\n});\nexport const AttachCommandSchema = StrictObject({ command: Type.Literal(\"attach\"), sessionId: IdSchema });\nexport const DetachCommandSchema = StrictObject({ command: Type.Literal(\"detach\"), sessionId: IdSchema });\nexport const PromptCommandSchema = StrictObject({ command: Type.Literal(\"prompt\"), ...PromptPayloadProperties });\nexport const SteerCommandSchema = StrictObject({ command: Type.Literal(\"steer\"), ...PromptPayloadProperties });\nexport const AbortCommandSchema = StrictObject({ command: Type.Literal(\"abort\"), sessionId: IdSchema });\nexport const SetModelCommandSchema = StrictObject({\n\tcommand: Type.Literal(\"set_model\"),\n\tsessionId: IdSchema,\n\tmodel: ModelRefSchema,\n});\nexport const SetThinkingCommandSchema = StrictObject({\n\tcommand: Type.Literal(\"set_thinking\"),\n\tsessionId: IdSchema,\n\tthinkingLevel: ThinkingLevelSchema,\n});\nexport const CommandSchema = Type.Union([\n\tListCommandSchema,\n\tCreateCommandSchema,\n\tAttachCommandSchema,\n\tDetachCommandSchema,\n\tPromptCommandSchema,\n\tSteerCommandSchema,\n\tAbortCommandSchema,\n\tSetModelCommandSchema,\n\tSetThinkingCommandSchema,\n]);\nexport type Command = Static<typeof CommandSchema>;\nexport type CommandName = Command[\"command\"];\n\nexport const CreateResultSchema = StrictObject({\n\tcommand: Type.Literal(\"create\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const AttachResultSchema = StrictObject({\n\tcommand: Type.Literal(\"attach\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const PromptResultSchema = StrictObject({\n\tcommand: Type.Literal(\"prompt\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const SteerResultSchema = StrictObject({\n\tcommand: Type.Literal(\"steer\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const AbortResultSchema = StrictObject({\n\tcommand: Type.Literal(\"abort\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const SetModelResultSchema = StrictObject({\n\tcommand: Type.Literal(\"set_model\"),\n\tsession: SessionSnapshotSchema,\n});\nexport const SetThinkingResultSchema = StrictObject({\n\tcommand: Type.Literal(\"set_thinking\"),\n\tsession: SessionSnapshotSchema,\n});\n\nexport const ListResultSchema = StrictObject({\n\tcommand: Type.Literal(\"list\"),\n\tsessions: Type.Array(SessionMetadataSchema),\n});\nexport const DetachResultSchema = StrictObject({\n\tcommand: Type.Literal(\"detach\"),\n\tsessionId: IdSchema,\n});\nexport const CommandResultSchema = Type.Union([\n\tListResultSchema,\n\tCreateResultSchema,\n\tAttachResultSchema,\n\tDetachResultSchema,\n\tPromptResultSchema,\n\tSteerResultSchema,\n\tAbortResultSchema,\n\tSetModelResultSchema,\n\tSetThinkingResultSchema,\n]);\nexport type CommandResult = Static<typeof CommandResultSchema>;\n\nexport type ResultForCommand<TCommand extends Command> = TCommand[\"command\"] extends \"list\"\n\t? Static<typeof ListResultSchema>\n\t: TCommand[\"command\"] extends \"detach\"\n\t\t? Static<typeof DetachResultSchema>\n\t\t: Extract<CommandResult, { command: TCommand[\"command\"] }>;\n\n/** Must be the first frame sent by a client. Version is intentionally an integer, not a coercible string. */\nexport const ClientHelloSchema = StrictObject({\n\ttype: Type.Literal(\"hello\"),\n\tversion: Type.Integer({ minimum: 0 }),\n});\nexport type ClientHello = Static<typeof ClientHelloSchema>;\n\nexport const RequestEnvelopeSchema = StrictObject({\n\ttype: Type.Literal(\"request\"),\n\tid: IdSchema,\n\trequest: CommandSchema,\n});\nexport type RequestEnvelope = Static<typeof RequestEnvelopeSchema>;\nexport const ClientMessageSchema = Type.Union([ClientHelloSchema, RequestEnvelopeSchema]);\nexport type ClientMessage = Static<typeof ClientMessageSchema>;\n\nexport const ServerEventSchema = Type.Union([\n\tStrictObject({ type: Type.Literal(\"server_snapshot\"), snapshot: ServerSnapshotSchema }),\n\tStrictObject({ type: Type.Literal(\"session_snapshot\"), snapshot: SessionSnapshotSchema }),\n\tStrictObject({\n\t\ttype: Type.Literal(\"session_progress\"),\n\t\tsessionId: IdSchema,\n\t\tprogress: TranscriptProgressSchema,\n\t}),\n\tStrictObject({ type: Type.Literal(\"session_removed\"), sessionId: IdSchema }),\n]);\nexport type ServerEvent = Static<typeof ServerEventSchema>;\n\nexport const ServerHelloSchema = StrictObject({\n\ttype: Type.Literal(\"hello\"),\n\tversion: Type.Literal(PROTOCOL_VERSION),\n\tconnectionId: IdSchema,\n\tsnapshot: ServerSnapshotSchema,\n});\nexport const ServerHelloErrorSchema = StrictObject({\n\ttype: Type.Literal(\"hello_error\"),\n\terror: ProtocolErrorSchema,\n});\nexport const ResponseEnvelopeSchema = Type.Union([\n\tStrictObject({\n\t\ttype: Type.Literal(\"response\"),\n\t\tid: IdSchema,\n\t\tok: Type.Literal(true),\n\t\tresult: CommandResultSchema,\n\t}),\n\tStrictObject({\n\t\ttype: Type.Literal(\"response\"),\n\t\tid: IdSchema,\n\t\tok: Type.Literal(false),\n\t\terror: ProtocolErrorSchema,\n\t}),\n]);\nexport const EventEnvelopeSchema = StrictObject({\n\ttype: Type.Literal(\"event\"),\n\tevent: ServerEventSchema,\n});\nexport const ServerMessageSchema = Type.Union([\n\tServerHelloSchema,\n\tServerHelloErrorSchema,\n\tResponseEnvelopeSchema,\n\tEventEnvelopeSchema,\n]);\nexport type ServerHello = Static<typeof ServerHelloSchema>;\nexport type ServerHelloError = Static<typeof ServerHelloErrorSchema>;\nexport type ResponseEnvelope = Static<typeof ResponseEnvelopeSchema>;\nexport type EventEnvelope = Static<typeof EventEnvelopeSchema>;\nexport type ServerMessage = Static<typeof ServerMessageSchema>;\n"]}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@sammorrowdrums/mcpi-protocol",
3
+ "version": "0.85.0-bootstrap.0",
4
+ "description": "Transport-neutral CBOR protocol for remote mcpi sessions",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "scripts": {
20
+ "clean": "shx rm -rf dist",
21
+ "build": "tsgo -p tsconfig.build.json",
22
+ "test": "vitest --run",
23
+ "prepublishOnly": "npm run clean && npm run build"
24
+ },
25
+ "keywords": [
26
+ "mcpi",
27
+ "protocol",
28
+ "cbor",
29
+ "binary",
30
+ "framing"
31
+ ],
32
+ "author": "Earendil Works",
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/SamMorrowDrums/mcpi.git",
37
+ "directory": "packages/protocol"
38
+ },
39
+ "homepage": "https://github.com/SamMorrowDrums/mcpi/tree/main/packages/protocol#readme",
40
+ "bugs": {
41
+ "url": "https://github.com/SamMorrowDrums/mcpi/issues"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public",
45
+ "registry": "https://registry.npmjs.org/"
46
+ },
47
+ "engines": {
48
+ "node": ">=22.19.0"
49
+ },
50
+ "dependencies": {
51
+ "typebox": "1.3.7"
52
+ },
53
+ "devDependencies": {
54
+ "shx": "0.4.0",
55
+ "vitest": "4.1.9"
56
+ }
57
+ }