Skip to content

Commit 944c0ef

Browse files
committed
improvement(contracts): generate mothership stream types from go side schema
1 parent 77301c2 commit 944c0ef

File tree

4 files changed

+173
-168
lines changed

4 files changed

+173
-168
lines changed
Lines changed: 150 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,165 @@
11
// AUTO-GENERATED FILE. DO NOT EDIT.
2-
// Source: copilot/copilot/contracts/mothership-stream-v1.contract.json
3-
4-
export const MOTHERSHIP_STREAM_V1_SCHEMA_VERSION = 1 as const
5-
export const MOTHERSHIP_STREAM_V1_CONTRACT_NAME = 'mothership-stream-v1' as const
2+
//
63

4+
/**
5+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
6+
* via the `definition` "MothershipStreamV1EventType".
7+
*/
78
export type MothershipStreamV1EventType =
8-
| 'session'
9-
| 'text'
10-
| 'tool'
11-
| 'span'
12-
| 'resource'
13-
| 'run'
14-
| 'error'
15-
| 'complete'
16-
export type MothershipStreamV1SessionKind = 'trace' | 'chat' | 'title' | 'start'
17-
export type MothershipStreamV1TextChannel = 'assistant' | 'thinking'
18-
export type MothershipStreamV1ToolExecutor = 'go' | 'sim' | 'client'
19-
export type MothershipStreamV1ToolMode = 'sync' | 'async'
20-
export type MothershipStreamV1ToolPhase = 'call' | 'result'
21-
export type MothershipStreamV1ToolOutcome =
22-
| 'success'
23-
| 'error'
24-
| 'cancelled'
25-
| 'skipped'
26-
| 'rejected'
9+
| "session"
10+
| "text"
11+
| "tool"
12+
| "span"
13+
| "resource"
14+
| "run"
15+
| "error"
16+
| "complete";
17+
/**
18+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
19+
* via the `definition` "MothershipStreamV1SessionKind".
20+
*/
21+
export type MothershipStreamV1SessionKind = "trace" | "chat" | "title" | "start";
22+
/**
23+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
24+
* via the `definition` "MothershipStreamV1TextChannel".
25+
*/
26+
export type MothershipStreamV1TextChannel = "assistant" | "thinking";
27+
/**
28+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
29+
* via the `definition` "MothershipStreamV1ToolExecutor".
30+
*/
31+
export type MothershipStreamV1ToolExecutor = "go" | "sim" | "client";
32+
/**
33+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
34+
* via the `definition` "MothershipStreamV1ToolMode".
35+
*/
36+
export type MothershipStreamV1ToolMode = "sync" | "async";
37+
/**
38+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
39+
* via the `definition` "MothershipStreamV1ToolPhase".
40+
*/
41+
export type MothershipStreamV1ToolPhase = "call" | "result";
42+
/**
43+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
44+
* via the `definition` "MothershipStreamV1ToolOutcome".
45+
*/
46+
export type MothershipStreamV1ToolOutcome = "success" | "error" | "cancelled" | "skipped" | "rejected";
47+
/**
48+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
49+
* via the `definition` "MothershipStreamV1AsyncToolRecordStatus".
50+
*/
2751
export type MothershipStreamV1AsyncToolRecordStatus =
28-
| 'pending'
29-
| 'running'
30-
| 'completed'
31-
| 'failed'
32-
| 'cancelled'
33-
| 'delivered'
34-
export type MothershipStreamV1RunKind =
35-
| 'checkpoint_pause'
36-
| 'resumed'
37-
| 'compaction_start'
38-
| 'compaction_done'
39-
export type MothershipStreamV1SpanKind = 'subagent'
40-
export type MothershipStreamV1ResourceOp = 'upsert' | 'remove'
41-
42-
export interface MothershipStreamV1Scope {
43-
lane: 'main' | 'subagent'
44-
agentId?: string
45-
parentToolCallId?: string
46-
}
52+
| "pending"
53+
| "running"
54+
| "completed"
55+
| "failed"
56+
| "cancelled"
57+
| "delivered";
58+
/**
59+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
60+
* via the `definition` "MothershipStreamV1RunKind".
61+
*/
62+
export type MothershipStreamV1RunKind = "checkpoint_pause" | "resumed" | "compaction_start" | "compaction_done";
63+
/**
64+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
65+
* via the `definition` "MothershipStreamV1SpanKind".
66+
*/
67+
export type MothershipStreamV1SpanKind = "subagent";
68+
/**
69+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
70+
* via the `definition` "MothershipStreamV1ResourceOp".
71+
*/
72+
export type MothershipStreamV1ResourceOp = "upsert" | "remove";
4773

74+
/**
75+
* Shared execution-oriented mothership stream contract from Go to Sim.
76+
*/
4877
export interface MothershipStreamV1EventEnvelope {
49-
v: typeof MOTHERSHIP_STREAM_V1_SCHEMA_VERSION
50-
type: MothershipStreamV1EventType
51-
seq: number
52-
ts: string
53-
stream: {
54-
streamId: string
55-
chatId?: string
56-
cursor?: string
57-
}
58-
trace?: { requestId: string; spanId?: string }
59-
scope?: MothershipStreamV1Scope
60-
payload: Record<string, unknown>
78+
v: 1;
79+
type: MothershipStreamV1EventType;
80+
seq: number;
81+
ts: string;
82+
stream: MothershipStreamV1StreamRef;
83+
trace?: MothershipStreamV1Trace;
84+
scope?: MothershipStreamV1StreamScope;
85+
payload: {
86+
[k: string]: unknown;
87+
};
6188
}
62-
89+
/**
90+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
91+
* via the `definition` "MothershipStreamV1StreamRef".
92+
*/
93+
export interface MothershipStreamV1StreamRef {
94+
streamId: string;
95+
chatId?: string;
96+
cursor?: string;
97+
}
98+
/**
99+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
100+
* via the `definition` "MothershipStreamV1Trace".
101+
*/
102+
export interface MothershipStreamV1Trace {
103+
requestId: string;
104+
spanId?: string;
105+
}
106+
/**
107+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
108+
* via the `definition` "MothershipStreamV1StreamScope".
109+
*/
110+
export interface MothershipStreamV1StreamScope {
111+
lane: "main" | "subagent";
112+
agentId?: string;
113+
parentToolCallId?: string;
114+
}
115+
/**
116+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
117+
* via the `definition` "MothershipStreamV1StreamCursor".
118+
*/
119+
export interface MothershipStreamV1StreamCursor {
120+
streamId: string;
121+
cursor: string;
122+
seq: number;
123+
}
124+
/**
125+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
126+
* via the `definition` "MothershipStreamV1ToolCallDescriptor".
127+
*/
63128
export interface MothershipStreamV1ToolCallDescriptor {
64-
toolCallId: string
65-
toolName: string
66-
arguments: Record<string, unknown>
67-
executor: MothershipStreamV1ToolExecutor
68-
mode: MothershipStreamV1ToolMode
69-
phase: MothershipStreamV1ToolPhase
70-
requiresConfirmation?: boolean
129+
toolCallId: string;
130+
toolName: string;
131+
arguments: {
132+
[k: string]: unknown;
133+
};
134+
executor: MothershipStreamV1ToolExecutor;
135+
mode: MothershipStreamV1ToolMode;
136+
phase: MothershipStreamV1ToolPhase;
137+
requiresConfirmation?: boolean;
71138
}
72-
139+
/**
140+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
141+
* via the `definition` "MothershipStreamV1ToolResultPayload".
142+
*/
73143
export interface MothershipStreamV1ToolResultPayload {
74-
success: boolean
75-
output?: unknown
76-
error?: string
144+
success: boolean;
145+
output?: unknown;
146+
error?: string;
77147
}
78-
148+
/**
149+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
150+
* via the `definition` "MothershipStreamV1ResumeToolResult".
151+
*/
79152
export interface MothershipStreamV1ResumeToolResult {
80-
toolCallId: string
81-
success: boolean
82-
output?: unknown
83-
error?: string
153+
toolCallId: string;
154+
success: boolean;
155+
output?: unknown;
156+
error?: string;
84157
}
85-
158+
/**
159+
* This interface was referenced by `MothershipStreamV1EventEnvelope`'s JSON-Schema
160+
* via the `definition` "MothershipStreamV1ResumeRequest".
161+
*/
86162
export interface MothershipStreamV1ResumeRequest {
87-
checkpointId: string
88-
results: MothershipStreamV1ResumeToolResult[]
163+
checkpointId: string;
164+
results: MothershipStreamV1ResumeToolResult[];
89165
}

bun.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"@octokit/rest": "^21.0.0",
4141
"glob": "13.0.0",
4242
"husky": "9.1.7",
43+
"json-schema-to-typescript": "15.0.4",
4344
"lint-staged": "16.0.0",
4445
"turbo": "2.8.20"
4546
},

0 commit comments

Comments
 (0)