@drisp/protocol 0.6.0 → 0.6.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.
- package/dist/chunk-HMYWICNI.js +202 -0
- package/dist/domain-B-kg2pa_.d.ts +376 -0
- package/dist/index.d.ts +2 -377
- package/dist/index.js +153 -319
- package/dist/v2.d.ts +1283 -0
- package/dist/v2.js +613 -0
- package/package.json +56 -51
- package/schema/v2/checkpoint.json +566 -0
- package/schema/v2/client.json +479 -0
- package/schema/v2/command.json +388 -0
- package/schema/v2/connectAlreadyConnected.json +30 -0
- package/schema/v2/connectApproveRequest.json +26 -0
- package/schema/v2/connectCode.json +20 -0
- package/schema/v2/connectCodeRequest.json +13 -0
- package/schema/v2/connectDenyRequest.json +15 -0
- package/schema/v2/connectPending.json +33 -0
- package/schema/v2/connectPollRequest.json +15 -0
- package/schema/v2/connectRedeem.json +52 -0
- package/schema/v2/connectRedeemRequest.json +39 -0
- package/schema/v2/connectStart.json +37 -0
- package/schema/v2/connectStartRequest.json +33 -0
- package/schema/v2/grant.json +337 -0
- package/schema/v2/permissionAnswer.json +26 -0
- package/schema/v2/run.json +620 -0
- package/schema/v2/runner.json +1090 -0
- package/schema/v2/runnerAdoptRequest.json +13 -0
- package/schema/v2/runnerDisconnect.json +20 -0
- package/schema/v2/runnerDisconnectPreview.json +58 -0
- package/schema/v2/runnerDisconnectRequest.json +13 -0
- package/schema/v2/runnerList.json +459 -0
- package/schema/v2/runnerUpdateRequest.json +29 -0
- package/schema/v2/teamDefaultRequest.json +63 -0
package/dist/index.js
CHANGED
|
@@ -1,386 +1,220 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AssignmentRejectedReasonSchema,
|
|
3
|
+
AttachmentSchema,
|
|
4
|
+
ExhaustedCapSchema,
|
|
5
|
+
HardFailureCodeSchema,
|
|
6
|
+
InstalledWorkflowSchema,
|
|
7
|
+
InstalledWorkflowSourceSchema,
|
|
8
|
+
InterruptionSchema,
|
|
9
|
+
RunSchema,
|
|
10
|
+
RunSpecSchema,
|
|
11
|
+
RunStatusSchema,
|
|
12
|
+
RuntimeDecisionSchema,
|
|
13
|
+
RuntimeIntentSchema,
|
|
14
|
+
TurnContinuationSchema,
|
|
15
|
+
TurnOutcomeSchema,
|
|
16
|
+
TurnSchema
|
|
17
|
+
} from "./chunk-HMYWICNI.js";
|
|
18
|
+
|
|
1
19
|
// src/version.ts
|
|
2
20
|
var PROTOCOL_VERSION = 1;
|
|
3
21
|
|
|
4
|
-
// src/
|
|
22
|
+
// src/events.ts
|
|
5
23
|
import { z } from "zod";
|
|
6
|
-
var
|
|
7
|
-
"running",
|
|
8
|
-
"awaiting_attention",
|
|
9
|
-
"completed",
|
|
10
|
-
"blocked",
|
|
11
|
-
"exhausted",
|
|
12
|
-
"failed",
|
|
13
|
-
"cancelled"
|
|
14
|
-
]);
|
|
15
|
-
var RunSchema = z.object({
|
|
16
|
-
runId: z.string(),
|
|
17
|
-
/** The durable Athena Session this Run belongs to. */
|
|
18
|
-
athenaSessionId: z.string(),
|
|
19
|
-
workflowName: z.string().optional(),
|
|
20
|
-
/** What the Run was asked to do — the `**Goal**` its Run section records. */
|
|
21
|
-
goal: z.string().optional(),
|
|
22
|
-
/** Index of the most recent Turn (0 before Turn 1). */
|
|
23
|
-
iteration: z.int().nonnegative(),
|
|
24
|
-
maxIterations: z.int().positive().optional(),
|
|
25
|
-
status: RunStatusSchema,
|
|
26
|
-
stopReason: z.string().optional(),
|
|
27
|
-
/** Vendor session id of the Run's most recent Agent Session (ADR 0014). */
|
|
28
|
-
adapterSessionId: z.string().optional(),
|
|
29
|
-
startedAt: z.number(),
|
|
30
|
-
endedAt: z.number().optional()
|
|
31
|
-
});
|
|
32
|
-
var TurnContinuationSchema = z.discriminatedUnion("mode", [
|
|
33
|
-
z.object({ mode: z.literal("fresh") }),
|
|
34
|
-
z.object({ mode: z.literal("resume"), handle: z.string() }),
|
|
35
|
-
z.object({ mode: z.literal("reuse-current") })
|
|
36
|
-
]);
|
|
37
|
-
var TurnOutcomeSchema = z.discriminatedUnion("kind", [
|
|
38
|
-
z.object({ kind: z.literal("continue") }),
|
|
39
|
-
z.object({
|
|
40
|
-
kind: z.literal("stop"),
|
|
41
|
-
status: RunStatusSchema,
|
|
42
|
-
stopReason: z.string().optional()
|
|
43
|
-
}),
|
|
44
|
-
z.object({
|
|
45
|
-
kind: z.literal("suspend"),
|
|
46
|
-
status: RunStatusSchema,
|
|
47
|
-
stopReason: z.string()
|
|
48
|
-
})
|
|
49
|
-
]);
|
|
50
|
-
var TurnSchema = z.object({
|
|
24
|
+
var RunStreamEventSchema = z.object({
|
|
51
25
|
runId: z.string(),
|
|
52
|
-
/** 1-based Iteration of this Turn within its Run. */
|
|
53
|
-
iteration: z.int().positive(),
|
|
54
|
-
continuation: TurnContinuationSchema,
|
|
55
|
-
/** Vendor session id of the Agent Session this Turn ran in, once known. */
|
|
56
|
-
adapterSessionId: z.string().optional(),
|
|
57
|
-
startedAt: z.number(),
|
|
58
|
-
endedAt: z.number().optional(),
|
|
59
|
-
outcome: TurnOutcomeSchema.optional()
|
|
60
|
-
});
|
|
61
|
-
var HardFailureCodeSchema = z.enum([
|
|
62
|
-
"auth",
|
|
63
|
-
"billing",
|
|
64
|
-
"invalid_request",
|
|
65
|
-
"model_not_found",
|
|
66
|
-
"unclassified"
|
|
67
|
-
]);
|
|
68
|
-
var ExhaustedCapSchema = z.enum([
|
|
69
|
-
"retry",
|
|
70
|
-
"nudge",
|
|
71
|
-
"iterations",
|
|
72
|
-
"handover",
|
|
73
|
-
"tokens"
|
|
74
|
-
]);
|
|
75
|
-
var interruptionBase = {
|
|
76
|
-
/** Human-readable summary of why the Run parked. */
|
|
77
|
-
message: z.string()
|
|
78
|
-
};
|
|
79
|
-
var InterruptionSchema = z.discriminatedUnion("kind", [
|
|
80
|
-
z.object({
|
|
81
|
-
...interruptionBase,
|
|
82
|
-
kind: z.literal("blocked"),
|
|
83
|
-
/** The `: reason` suffix of `NEEDS_HUMAN[: reason]`, when given. */
|
|
84
|
-
reason: z.string().optional()
|
|
85
|
-
}),
|
|
86
|
-
z.object({
|
|
87
|
-
...interruptionBase,
|
|
88
|
-
kind: z.literal("question"),
|
|
89
|
-
/**
|
|
90
|
-
* The pending request an `answer` frame must address. Absent when the
|
|
91
|
-
* runner interrupted the Turn instead of leaving the question waiting
|
|
92
|
-
* (an unattended Workflow Run kills the Agent Session on a question,
|
|
93
|
-
* so there is no request left to answer); such a Run is woken with a
|
|
94
|
-
* `steer` carrying the human's guidance.
|
|
95
|
-
*/
|
|
96
|
-
requestId: z.string().optional(),
|
|
97
|
-
question: z.string().optional()
|
|
98
|
-
}),
|
|
99
|
-
z.object({
|
|
100
|
-
...interruptionBase,
|
|
101
|
-
kind: z.literal("hard_failure"),
|
|
102
|
-
code: HardFailureCodeSchema
|
|
103
|
-
}),
|
|
104
|
-
z.object({
|
|
105
|
-
...interruptionBase,
|
|
106
|
-
kind: z.literal("cap_exhausted"),
|
|
107
|
-
cap: ExhaustedCapSchema,
|
|
108
|
-
limit: z.int().positive().optional(),
|
|
109
|
-
/** Structured policy decision. Older senders may supply only cap/message. */
|
|
110
|
-
resource: z.object({
|
|
111
|
-
cause: z.enum(["tokens", "iterations", "context", "restart"]),
|
|
112
|
-
limit: z.number().nonnegative(),
|
|
113
|
-
used: z.number().nonnegative(),
|
|
114
|
-
detail: z.string().optional(),
|
|
115
|
-
checkpointPath: z.string().optional(),
|
|
116
|
-
fresh: z.boolean()
|
|
117
|
-
}).optional()
|
|
118
|
-
})
|
|
119
|
-
]);
|
|
120
|
-
var RunSpecSchema = z.looseObject({
|
|
121
|
-
prompt: z.string().optional(),
|
|
122
|
-
athenaSessionId: z.string().optional(),
|
|
123
|
-
adapterResumeSessionId: z.string().optional(),
|
|
124
|
-
sessionId: z.string().optional(),
|
|
125
|
-
projectDir: z.string().optional(),
|
|
126
|
-
workflow: z.looseObject({
|
|
127
|
-
source: z.string().optional(),
|
|
128
|
-
ref: z.string().optional(),
|
|
129
|
-
version: z.string().optional()
|
|
130
|
-
}).optional(),
|
|
131
|
-
harness: z.string().optional(),
|
|
132
|
-
env: z.record(z.string(), z.string()).optional(),
|
|
133
|
-
timeoutSec: z.number().optional(),
|
|
134
|
-
/** Per-run callback channel minted by the hub; both or neither. */
|
|
135
|
-
callbackWsUrl: z.string().optional(),
|
|
136
|
-
callbackToken: z.string().optional()
|
|
137
|
-
});
|
|
138
|
-
var RuntimeIntentSchema = z.discriminatedUnion("kind", [
|
|
139
|
-
z.object({ kind: z.literal("permission_allow") }),
|
|
140
|
-
z.object({ kind: z.literal("permission_deny"), reason: z.string() }),
|
|
141
|
-
z.object({
|
|
142
|
-
kind: z.literal("question_answer"),
|
|
143
|
-
answers: z.record(z.string(), z.string())
|
|
144
|
-
}),
|
|
145
|
-
z.object({ kind: z.literal("pre_tool_allow") }),
|
|
146
|
-
z.object({ kind: z.literal("pre_tool_deny"), reason: z.string() }),
|
|
147
|
-
z.object({ kind: z.literal("stop_block"), reason: z.string() }),
|
|
148
|
-
z.object({ kind: z.literal("compact_block"), reason: z.string() })
|
|
149
|
-
]);
|
|
150
|
-
var RuntimeDecisionSchema = z.object({
|
|
151
|
-
type: z.enum(["passthrough", "block", "json"]),
|
|
152
|
-
source: z.enum(["user", "timeout", "rule"]),
|
|
153
|
-
intent: RuntimeIntentSchema.optional(),
|
|
154
|
-
reason: z.string().optional(),
|
|
155
|
-
data: z.unknown().optional()
|
|
156
|
-
});
|
|
157
|
-
var AttachmentSchema = z.object({
|
|
158
|
-
runnerId: z.string(),
|
|
159
|
-
name: z.string().optional(),
|
|
160
|
-
slug: z.string().optional(),
|
|
161
|
-
executionTarget: z.string().optional(),
|
|
162
|
-
remoteInstanceId: z.string().optional()
|
|
163
|
-
});
|
|
164
|
-
var InstalledWorkflowSourceSchema = z.discriminatedUnion("kind", [
|
|
165
|
-
z.object({ kind: z.literal("builtin") }),
|
|
166
|
-
z.object({ kind: z.literal("marketplace-remote"), ref: z.string() }),
|
|
167
|
-
z.object({
|
|
168
|
-
kind: z.literal("marketplace-local"),
|
|
169
|
-
repoDir: z.string(),
|
|
170
|
-
workflowName: z.string()
|
|
171
|
-
}),
|
|
172
|
-
z.object({ kind: z.literal("filesystem"), path: z.string() }),
|
|
173
|
-
z.object({ kind: z.literal("unknown") })
|
|
174
|
-
]);
|
|
175
|
-
var InstalledWorkflowSchema = z.object({
|
|
176
|
-
name: z.string().min(1),
|
|
177
|
-
version: z.string().optional(),
|
|
178
|
-
source: InstalledWorkflowSourceSchema
|
|
179
|
-
});
|
|
180
|
-
var AssignmentRejectedReasonSchema = z.enum([
|
|
181
|
-
"local_capacity",
|
|
182
|
-
"duplicate",
|
|
183
|
-
"malformed_assignment",
|
|
184
|
-
"workspace_unresolved",
|
|
185
|
-
"workspace_invalid"
|
|
186
|
-
]);
|
|
187
|
-
|
|
188
|
-
// src/events.ts
|
|
189
|
-
import { z as z2 } from "zod";
|
|
190
|
-
var RunStreamEventSchema = z2.object({
|
|
191
|
-
runId: z2.string(),
|
|
192
26
|
/** Runner-local order within the Run. */
|
|
193
|
-
seq:
|
|
194
|
-
ts:
|
|
195
|
-
kind:
|
|
196
|
-
payload:
|
|
197
|
-
});
|
|
198
|
-
var FeedEventLevelSchema =
|
|
199
|
-
var FeedEventCauseSchema =
|
|
200
|
-
parent_event_id:
|
|
201
|
-
hook_request_id:
|
|
202
|
-
tool_use_id:
|
|
203
|
-
transcript_path:
|
|
204
|
-
});
|
|
205
|
-
var FeedEventSchema =
|
|
206
|
-
event_id:
|
|
207
|
-
seq:
|
|
208
|
-
ts:
|
|
209
|
-
session_id:
|
|
27
|
+
seq: z.int().nonnegative(),
|
|
28
|
+
ts: z.number(),
|
|
29
|
+
kind: z.string(),
|
|
30
|
+
payload: z.unknown().optional()
|
|
31
|
+
});
|
|
32
|
+
var FeedEventLevelSchema = z.enum(["debug", "info", "warn", "error"]);
|
|
33
|
+
var FeedEventCauseSchema = z.object({
|
|
34
|
+
parent_event_id: z.string().optional(),
|
|
35
|
+
hook_request_id: z.string().optional(),
|
|
36
|
+
tool_use_id: z.string().optional(),
|
|
37
|
+
transcript_path: z.string().optional()
|
|
38
|
+
});
|
|
39
|
+
var FeedEventSchema = z.looseObject({
|
|
40
|
+
event_id: z.string(),
|
|
41
|
+
seq: z.int().nonnegative(),
|
|
42
|
+
ts: z.number(),
|
|
43
|
+
session_id: z.string(),
|
|
210
44
|
/** A Feed Run id (`{session_id}:R{n}`) — unrelated to a Workflow Run id. */
|
|
211
|
-
run_id:
|
|
212
|
-
prompt_id:
|
|
213
|
-
effort_level:
|
|
214
|
-
kind:
|
|
45
|
+
run_id: z.string(),
|
|
46
|
+
prompt_id: z.string().optional(),
|
|
47
|
+
effort_level: z.string().optional(),
|
|
48
|
+
kind: z.string(),
|
|
215
49
|
level: FeedEventLevelSchema,
|
|
216
|
-
actor_id:
|
|
50
|
+
actor_id: z.string(),
|
|
217
51
|
cause: FeedEventCauseSchema.optional(),
|
|
218
|
-
title:
|
|
219
|
-
body:
|
|
220
|
-
ui:
|
|
221
|
-
collapsed_default:
|
|
222
|
-
pin:
|
|
223
|
-
badge:
|
|
52
|
+
title: z.string(),
|
|
53
|
+
body: z.string().optional(),
|
|
54
|
+
ui: z.object({
|
|
55
|
+
collapsed_default: z.boolean().optional(),
|
|
56
|
+
pin: z.boolean().optional(),
|
|
57
|
+
badge: z.string().optional()
|
|
224
58
|
}).optional(),
|
|
225
|
-
display:
|
|
226
|
-
data:
|
|
227
|
-
raw:
|
|
59
|
+
display: z.object({ title: z.string().optional() }).optional(),
|
|
60
|
+
data: z.unknown(),
|
|
61
|
+
raw: z.unknown().optional()
|
|
228
62
|
});
|
|
229
63
|
var PHASE_FEED_EVENT_KIND = "phase";
|
|
230
|
-
var PhaseEventSchema =
|
|
64
|
+
var PhaseEventSchema = z.object({
|
|
231
65
|
/** The Workflow Run id (not a Feed Run id). */
|
|
232
|
-
runId:
|
|
66
|
+
runId: z.string(),
|
|
233
67
|
/** 1-based Iteration of the Turn whose Journal named this step. */
|
|
234
|
-
turn:
|
|
235
|
-
step:
|
|
236
|
-
stepIndex:
|
|
237
|
-
stepTotal:
|
|
68
|
+
turn: z.int().positive(),
|
|
69
|
+
step: z.string().min(1),
|
|
70
|
+
stepIndex: z.int().positive().optional(),
|
|
71
|
+
stepTotal: z.int().positive().optional()
|
|
238
72
|
});
|
|
239
73
|
var PhaseFeedEventSchema = FeedEventSchema.extend({
|
|
240
|
-
kind:
|
|
74
|
+
kind: z.literal(PHASE_FEED_EVENT_KIND),
|
|
241
75
|
data: PhaseEventSchema
|
|
242
76
|
});
|
|
243
|
-
var FeedOriginSchema =
|
|
244
|
-
var FeedEnvelopeSchema =
|
|
245
|
-
instanceId:
|
|
246
|
-
athenaSessionId:
|
|
247
|
-
runId:
|
|
77
|
+
var FeedOriginSchema = z.enum(["local", "dashboard"]);
|
|
78
|
+
var FeedEnvelopeSchema = z.object({
|
|
79
|
+
instanceId: z.string(),
|
|
80
|
+
athenaSessionId: z.string(),
|
|
81
|
+
runId: z.string(),
|
|
248
82
|
origin: FeedOriginSchema,
|
|
249
|
-
eventId:
|
|
250
|
-
feedSeq:
|
|
251
|
-
emittedAt:
|
|
83
|
+
eventId: z.string(),
|
|
84
|
+
feedSeq: z.int().nonnegative(),
|
|
85
|
+
emittedAt: z.number(),
|
|
252
86
|
feedEvent: FeedEventSchema
|
|
253
87
|
});
|
|
254
88
|
|
|
255
89
|
// src/frames.ts
|
|
256
|
-
import { z as
|
|
90
|
+
import { z as z2 } from "zod";
|
|
257
91
|
var runStartBody = {
|
|
258
|
-
runId:
|
|
92
|
+
runId: z2.string(),
|
|
259
93
|
runSpec: RunSpecSchema.optional(),
|
|
260
94
|
/**
|
|
261
95
|
* The runner this assignment is bound to — top-level so the CLI can route
|
|
262
96
|
* to the right Attachment without inspecting `runSpec`. Absent from hubs
|
|
263
97
|
* that use single-runtime semantics.
|
|
264
98
|
*/
|
|
265
|
-
runnerId:
|
|
99
|
+
runnerId: z2.string().optional()
|
|
266
100
|
};
|
|
267
101
|
var answerBody = {
|
|
268
|
-
athenaSessionId:
|
|
269
|
-
requestId:
|
|
102
|
+
athenaSessionId: z2.string(),
|
|
103
|
+
requestId: z2.string(),
|
|
270
104
|
decision: RuntimeDecisionSchema
|
|
271
105
|
};
|
|
272
106
|
var stopBody = {
|
|
273
|
-
runId:
|
|
274
|
-
runnerId:
|
|
107
|
+
runId: z2.string(),
|
|
108
|
+
runnerId: z2.string().optional()
|
|
275
109
|
};
|
|
276
|
-
var PingFrameSchema =
|
|
277
|
-
type:
|
|
278
|
-
ts:
|
|
110
|
+
var PingFrameSchema = z2.object({
|
|
111
|
+
type: z2.literal("ping"),
|
|
112
|
+
ts: z2.number()
|
|
279
113
|
});
|
|
280
|
-
var PongFrameSchema =
|
|
281
|
-
type:
|
|
282
|
-
ts:
|
|
114
|
+
var PongFrameSchema = z2.object({
|
|
115
|
+
type: z2.literal("pong"),
|
|
116
|
+
ts: z2.number()
|
|
283
117
|
});
|
|
284
|
-
var AssignmentAcceptedFrameSchema =
|
|
285
|
-
type:
|
|
286
|
-
runId:
|
|
118
|
+
var AssignmentAcceptedFrameSchema = z2.object({
|
|
119
|
+
type: z2.literal("assignment_accepted"),
|
|
120
|
+
runId: z2.string()
|
|
287
121
|
});
|
|
288
|
-
var AssignmentRejectedFrameSchema =
|
|
289
|
-
type:
|
|
290
|
-
runId:
|
|
122
|
+
var AssignmentRejectedFrameSchema = z2.object({
|
|
123
|
+
type: z2.literal("assignment_rejected"),
|
|
124
|
+
runId: z2.string(),
|
|
291
125
|
reason: AssignmentRejectedReasonSchema,
|
|
292
|
-
message:
|
|
126
|
+
message: z2.string().optional()
|
|
293
127
|
});
|
|
294
|
-
var DecisionAckFrameSchema =
|
|
295
|
-
type:
|
|
296
|
-
athenaSessionId:
|
|
297
|
-
requestId:
|
|
128
|
+
var DecisionAckFrameSchema = z2.object({
|
|
129
|
+
type: z2.literal("decision_ack"),
|
|
130
|
+
athenaSessionId: z2.string(),
|
|
131
|
+
requestId: z2.string()
|
|
298
132
|
});
|
|
299
|
-
var FeedAckFrameSchema =
|
|
300
|
-
type:
|
|
301
|
-
deliverySeq:
|
|
302
|
-
eventId:
|
|
133
|
+
var FeedAckFrameSchema = z2.object({
|
|
134
|
+
type: z2.literal("feed_ack"),
|
|
135
|
+
deliverySeq: z2.int().nonnegative().optional(),
|
|
136
|
+
eventId: z2.string().optional()
|
|
303
137
|
});
|
|
304
|
-
var AttachmentsChangedFrameSchema =
|
|
305
|
-
type:
|
|
306
|
-
attachments:
|
|
138
|
+
var AttachmentsChangedFrameSchema = z2.object({
|
|
139
|
+
type: z2.literal("attachments.changed"),
|
|
140
|
+
attachments: z2.array(AttachmentSchema)
|
|
307
141
|
});
|
|
308
|
-
var ErrorFrameSchema =
|
|
309
|
-
type:
|
|
310
|
-
code:
|
|
311
|
-
message:
|
|
142
|
+
var ErrorFrameSchema = z2.object({
|
|
143
|
+
type: z2.literal("error"),
|
|
144
|
+
code: z2.string(),
|
|
145
|
+
message: z2.string().optional()
|
|
312
146
|
});
|
|
313
|
-
var JobAssignmentFrameSchema =
|
|
314
|
-
type:
|
|
147
|
+
var JobAssignmentFrameSchema = z2.object({
|
|
148
|
+
type: z2.literal("job_assignment"),
|
|
315
149
|
...runStartBody
|
|
316
150
|
});
|
|
317
|
-
var DashboardDecisionFrameSchema =
|
|
318
|
-
type:
|
|
151
|
+
var DashboardDecisionFrameSchema = z2.object({
|
|
152
|
+
type: z2.literal("dashboard_decision"),
|
|
319
153
|
...answerBody
|
|
320
154
|
});
|
|
321
|
-
var CancelFrameSchema =
|
|
322
|
-
type:
|
|
155
|
+
var CancelFrameSchema = z2.object({
|
|
156
|
+
type: z2.literal("cancel"),
|
|
323
157
|
...stopBody
|
|
324
158
|
});
|
|
325
|
-
var RunEventFrameSchema =
|
|
326
|
-
type:
|
|
159
|
+
var RunEventFrameSchema = z2.object({
|
|
160
|
+
type: z2.literal("run_event"),
|
|
327
161
|
...RunStreamEventSchema.shape
|
|
328
162
|
});
|
|
329
|
-
var FeedEventFrameSchema =
|
|
330
|
-
type:
|
|
163
|
+
var FeedEventFrameSchema = z2.object({
|
|
164
|
+
type: z2.literal("feed_event"),
|
|
331
165
|
/** Runner-local outbox order, used only for delivery retry. */
|
|
332
|
-
deliverySeq:
|
|
166
|
+
deliverySeq: z2.int().nonnegative(),
|
|
333
167
|
envelope: FeedEnvelopeSchema
|
|
334
168
|
});
|
|
335
|
-
var HelloFrameSchema =
|
|
336
|
-
type:
|
|
337
|
-
protocolVersion:
|
|
338
|
-
role:
|
|
339
|
-
instanceId:
|
|
340
|
-
agent:
|
|
341
|
-
capabilities:
|
|
342
|
-
workflows:
|
|
343
|
-
});
|
|
344
|
-
var WorkflowsChangedFrameSchema =
|
|
345
|
-
type:
|
|
346
|
-
workflows:
|
|
347
|
-
});
|
|
348
|
-
var RunStartFrameSchema =
|
|
349
|
-
type:
|
|
169
|
+
var HelloFrameSchema = z2.object({
|
|
170
|
+
type: z2.literal("hello"),
|
|
171
|
+
protocolVersion: z2.int().positive(),
|
|
172
|
+
role: z2.enum(["runner", "hub"]).optional(),
|
|
173
|
+
instanceId: z2.string().optional(),
|
|
174
|
+
agent: z2.object({ name: z2.string(), version: z2.string().optional() }).optional(),
|
|
175
|
+
capabilities: z2.array(z2.string()).optional(),
|
|
176
|
+
workflows: z2.array(InstalledWorkflowSchema).optional()
|
|
177
|
+
});
|
|
178
|
+
var WorkflowsChangedFrameSchema = z2.object({
|
|
179
|
+
type: z2.literal("workflows.changed"),
|
|
180
|
+
workflows: z2.array(InstalledWorkflowSchema)
|
|
181
|
+
});
|
|
182
|
+
var RunStartFrameSchema = z2.object({
|
|
183
|
+
type: z2.literal("run.start"),
|
|
350
184
|
...runStartBody
|
|
351
185
|
});
|
|
352
|
-
var AnswerFrameSchema =
|
|
353
|
-
type:
|
|
186
|
+
var AnswerFrameSchema = z2.object({
|
|
187
|
+
type: z2.literal("answer"),
|
|
354
188
|
...answerBody
|
|
355
189
|
});
|
|
356
|
-
var StopFrameSchema =
|
|
357
|
-
type:
|
|
190
|
+
var StopFrameSchema = z2.object({
|
|
191
|
+
type: z2.literal("stop"),
|
|
358
192
|
...stopBody
|
|
359
193
|
});
|
|
360
|
-
var SteerFrameSchema =
|
|
361
|
-
type:
|
|
362
|
-
runId:
|
|
363
|
-
athenaSessionId:
|
|
364
|
-
text:
|
|
194
|
+
var SteerFrameSchema = z2.object({
|
|
195
|
+
type: z2.literal("steer"),
|
|
196
|
+
runId: z2.string(),
|
|
197
|
+
athenaSessionId: z2.string().optional(),
|
|
198
|
+
text: z2.string().min(1)
|
|
365
199
|
});
|
|
366
|
-
var NeedsHumanFrameSchema =
|
|
367
|
-
type:
|
|
368
|
-
runId:
|
|
369
|
-
athenaSessionId:
|
|
200
|
+
var NeedsHumanFrameSchema = z2.object({
|
|
201
|
+
type: z2.literal("needs_human"),
|
|
202
|
+
runId: z2.string(),
|
|
203
|
+
athenaSessionId: z2.string().optional(),
|
|
370
204
|
interruption: InterruptionSchema
|
|
371
205
|
});
|
|
372
|
-
var RunStreamEventFrameSchema =
|
|
373
|
-
type:
|
|
374
|
-
stream:
|
|
206
|
+
var RunStreamEventFrameSchema = z2.object({
|
|
207
|
+
type: z2.literal("event"),
|
|
208
|
+
stream: z2.literal("run"),
|
|
375
209
|
...RunStreamEventSchema.shape
|
|
376
210
|
});
|
|
377
|
-
var FeedStreamEventFrameSchema =
|
|
378
|
-
type:
|
|
379
|
-
stream:
|
|
380
|
-
deliverySeq:
|
|
211
|
+
var FeedStreamEventFrameSchema = z2.object({
|
|
212
|
+
type: z2.literal("event"),
|
|
213
|
+
stream: z2.literal("feed"),
|
|
214
|
+
deliverySeq: z2.int().nonnegative(),
|
|
381
215
|
envelope: FeedEnvelopeSchema
|
|
382
216
|
});
|
|
383
|
-
var EventFrameSchema =
|
|
217
|
+
var EventFrameSchema = z2.discriminatedUnion("stream", [
|
|
384
218
|
RunStreamEventFrameSchema,
|
|
385
219
|
FeedStreamEventFrameSchema
|
|
386
220
|
]);
|
|
@@ -394,7 +228,7 @@ var unchangedFrames = [
|
|
|
394
228
|
AttachmentsChangedFrameSchema,
|
|
395
229
|
ErrorFrameSchema
|
|
396
230
|
];
|
|
397
|
-
var LegacyFrameSchema =
|
|
231
|
+
var LegacyFrameSchema = z2.discriminatedUnion("type", [
|
|
398
232
|
JobAssignmentFrameSchema,
|
|
399
233
|
DashboardDecisionFrameSchema,
|
|
400
234
|
CancelFrameSchema,
|
|
@@ -402,7 +236,7 @@ var LegacyFrameSchema = z3.discriminatedUnion("type", [
|
|
|
402
236
|
FeedEventFrameSchema,
|
|
403
237
|
...unchangedFrames
|
|
404
238
|
]);
|
|
405
|
-
var CanonicalFrameSchema =
|
|
239
|
+
var CanonicalFrameSchema = z2.discriminatedUnion("type", [
|
|
406
240
|
HelloFrameSchema,
|
|
407
241
|
RunStartFrameSchema,
|
|
408
242
|
AnswerFrameSchema,
|
|
@@ -413,7 +247,7 @@ var CanonicalFrameSchema = z3.discriminatedUnion("type", [
|
|
|
413
247
|
EventFrameSchema,
|
|
414
248
|
...unchangedFrames
|
|
415
249
|
]);
|
|
416
|
-
var FrameSchema =
|
|
250
|
+
var FrameSchema = z2.discriminatedUnion("type", [
|
|
417
251
|
JobAssignmentFrameSchema,
|
|
418
252
|
DashboardDecisionFrameSchema,
|
|
419
253
|
CancelFrameSchema,
|
|
@@ -511,7 +345,7 @@ function toLegacyFrame(frame) {
|
|
|
511
345
|
}
|
|
512
346
|
|
|
513
347
|
// src/jsonSchema.ts
|
|
514
|
-
import { z as
|
|
348
|
+
import { z as z3 } from "zod";
|
|
515
349
|
var JSON_SCHEMA_SOURCES = {
|
|
516
350
|
frame: FrameSchema,
|
|
517
351
|
"canonical-frame": CanonicalFrameSchema,
|
|
@@ -535,7 +369,7 @@ function jsonSchemaId(name) {
|
|
|
535
369
|
function buildJsonSchemas() {
|
|
536
370
|
const out = {};
|
|
537
371
|
for (const name of Object.keys(JSON_SCHEMA_SOURCES)) {
|
|
538
|
-
const generated =
|
|
372
|
+
const generated = z3.toJSONSchema(JSON_SCHEMA_SOURCES[name], {
|
|
539
373
|
target: "draft-2020-12",
|
|
540
374
|
unrepresentable: "any"
|
|
541
375
|
});
|