@wizardingcode/shibaox-schemas 0.1.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,15 @@
1
+ import { z } from 'zod';
2
+ export declare const CatalogEntrySchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ type: z.ZodEnum<{
5
+ team: "team";
6
+ workflow: "workflow";
7
+ skill: "skill";
8
+ plugin: "plugin";
9
+ mcp: "mcp";
10
+ tool: "tool";
11
+ }>;
12
+ description: z.ZodString;
13
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
14
+ }, z.core.$strip>;
15
+ export type CatalogEntry = z.infer<typeof CatalogEntrySchema>;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { Id } from './common.js';
3
+ export const CatalogEntrySchema = z.object({
4
+ id: Id,
5
+ type: z.enum(['team', 'workflow', 'skill', 'plugin', 'mcp', 'tool']),
6
+ description: z.string().min(1).max(200),
7
+ tags: z.array(z.string()).default([]),
8
+ });
9
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,EAAE;IACN,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACpE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACtC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ export declare const Id: z.ZodString;
3
+ export declare const ModelTierSchema: z.ZodEnum<{
4
+ strong: "strong";
5
+ cheap: "cheap";
6
+ local: "local";
7
+ decision: "decision";
8
+ }>;
9
+ export type ModelTier = z.infer<typeof ModelTierSchema>;
10
+ /** One turn of a conversation with the orchestrator (what the dashboard sends as `messages`). */
11
+ export declare const ChatMessageSchema: z.ZodObject<{
12
+ role: z.ZodEnum<{
13
+ user: "user";
14
+ assistant: "assistant";
15
+ }>;
16
+ content: z.ZodString;
17
+ summary: z.ZodOptional<z.ZodBoolean>;
18
+ }, z.core.$strip>;
19
+ export type ChatMessage = z.infer<typeof ChatMessageSchema>;
package/dist/common.js ADDED
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export const Id = z
3
+ .string()
4
+ .min(1)
5
+ .regex(/^[a-z0-9][a-z0-9:_-]*$/i, 'ids use letters, digits, - _ :');
6
+ export const ModelTierSchema = z.enum(['strong', 'cheap', 'local', 'decision']);
7
+ /** One turn of a conversation with the orchestrator (what the dashboard sends as `messages`). */
8
+ export const ChatMessageSchema = z.object({
9
+ role: z.enum(['user', 'assistant']),
10
+ content: z.string(),
11
+ /** A condensation of older turns the daemon folded away (one per conversation, first). */
12
+ summary: z.boolean().optional(),
13
+ });
14
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;KAChB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,KAAK,CAAC,yBAAyB,EAAE,gCAAgC,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AAGhF,iGAAiG;AACjG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,0FAA0F;IAC1F,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC"}
@@ -0,0 +1,360 @@
1
+ import { z } from 'zod';
2
+ export declare const CostSchema: z.ZodObject<{
3
+ usd: z.ZodNumber;
4
+ inputTokens: z.ZodDefault<z.ZodNumber>;
5
+ outputTokens: z.ZodDefault<z.ZodNumber>;
6
+ }, z.core.$strip>;
7
+ export type Cost = z.infer<typeof CostSchema>;
8
+ export declare const CheckResultSchema: z.ZodObject<{
9
+ name: z.ZodString;
10
+ type: z.ZodEnum<{
11
+ code: "code";
12
+ human: "human";
13
+ tests: "tests";
14
+ lint: "lint";
15
+ review: "review";
16
+ jev: "jev";
17
+ judge: "judge";
18
+ mock: "mock";
19
+ }>;
20
+ passed: z.ZodBoolean;
21
+ skipped: z.ZodDefault<z.ZodBoolean>;
22
+ evidence: z.ZodString;
23
+ suggestion: z.ZodOptional<z.ZodString>;
24
+ confidence: z.ZodOptional<z.ZodNumber>;
25
+ cost: z.ZodOptional<z.ZodObject<{
26
+ usd: z.ZodNumber;
27
+ inputTokens: z.ZodDefault<z.ZodNumber>;
28
+ outputTokens: z.ZodDefault<z.ZodNumber>;
29
+ }, z.core.$strip>>;
30
+ }, z.core.$strip>;
31
+ export type CheckResult = z.infer<typeof CheckResultSchema>;
32
+ export declare const GateReportSchema: z.ZodObject<{
33
+ gates: z.ZodArray<z.ZodString>;
34
+ passed: z.ZodBoolean;
35
+ checks: z.ZodArray<z.ZodObject<{
36
+ name: z.ZodString;
37
+ type: z.ZodEnum<{
38
+ code: "code";
39
+ human: "human";
40
+ tests: "tests";
41
+ lint: "lint";
42
+ review: "review";
43
+ jev: "jev";
44
+ judge: "judge";
45
+ mock: "mock";
46
+ }>;
47
+ passed: z.ZodBoolean;
48
+ skipped: z.ZodDefault<z.ZodBoolean>;
49
+ evidence: z.ZodString;
50
+ suggestion: z.ZodOptional<z.ZodString>;
51
+ confidence: z.ZodOptional<z.ZodNumber>;
52
+ cost: z.ZodOptional<z.ZodObject<{
53
+ usd: z.ZodNumber;
54
+ inputTokens: z.ZodDefault<z.ZodNumber>;
55
+ outputTokens: z.ZodDefault<z.ZodNumber>;
56
+ }, z.core.$strip>>;
57
+ }, z.core.$strip>>;
58
+ cost: z.ZodOptional<z.ZodObject<{
59
+ usd: z.ZodNumber;
60
+ inputTokens: z.ZodDefault<z.ZodNumber>;
61
+ outputTokens: z.ZodDefault<z.ZodNumber>;
62
+ }, z.core.$strip>>;
63
+ }, z.core.$strip>;
64
+ export type GateReport = z.infer<typeof GateReportSchema>;
65
+ export declare const RunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
66
+ type: z.ZodLiteral<"RunCreated">;
67
+ workflow: z.ZodString;
68
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
69
+ budgetUsd: z.ZodOptional<z.ZodNumber>;
70
+ workspace: z.ZodString;
71
+ workflowSnapshot: z.ZodOptional<z.ZodObject<{
72
+ workflow: z.ZodString;
73
+ team: z.ZodOptional<z.ZodString>;
74
+ description: z.ZodOptional<z.ZodString>;
75
+ conversation: z.ZodOptional<z.ZodBoolean>;
76
+ start: z.ZodString;
77
+ nodes: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
78
+ type: z.ZodLiteral<"task">;
79
+ role: z.ZodString;
80
+ instruction: z.ZodOptional<z.ZodString>;
81
+ next: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strip>, z.ZodObject<{
83
+ type: z.ZodLiteral<"code">;
84
+ command: z.ZodString;
85
+ timeout_ms: z.ZodDefault<z.ZodNumber>;
86
+ next: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strip>, z.ZodObject<{
88
+ type: z.ZodLiteral<"human">;
89
+ action: z.ZodString;
90
+ prompt: z.ZodOptional<z.ZodString>;
91
+ next: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strip>, z.ZodObject<{
93
+ type: z.ZodLiteral<"decide">;
94
+ by: z.ZodString;
95
+ question: z.ZodOptional<z.ZodString>;
96
+ options: z.ZodArray<z.ZodString>;
97
+ next: z.ZodRecord<z.ZodString, z.ZodString>;
98
+ }, z.core.$strip>, z.ZodObject<{
99
+ type: z.ZodLiteral<"gate">;
100
+ gates: z.ZodArray<z.ZodString>;
101
+ on_pass: z.ZodString;
102
+ on_fail: z.ZodString;
103
+ max_retries: z.ZodDefault<z.ZodNumber>;
104
+ }, z.core.$strip>, z.ZodObject<{
105
+ type: z.ZodLiteral<"git">;
106
+ action: z.ZodEnum<{
107
+ commit: "commit";
108
+ pr: "pr";
109
+ merge: "merge";
110
+ }>;
111
+ message: z.ZodOptional<z.ZodString>;
112
+ base: z.ZodOptional<z.ZodString>;
113
+ tests: z.ZodOptional<z.ZodString>;
114
+ timeout_ms: z.ZodDefault<z.ZodNumber>;
115
+ next: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$strip>, z.ZodObject<{
117
+ type: z.ZodLiteral<"parallel">;
118
+ branches: z.ZodArray<z.ZodString>;
119
+ join: z.ZodString;
120
+ }, z.core.$strip>], "type">>;
121
+ }, z.core.$strip>>;
122
+ adapter: z.ZodOptional<z.ZodString>;
123
+ workspaceMode: z.ZodOptional<z.ZodEnum<{
124
+ inplace: "inplace";
125
+ worktree: "worktree";
126
+ }>>;
127
+ project: z.ZodOptional<z.ZodString>;
128
+ branch: z.ZodOptional<z.ZodString>;
129
+ baseBranch: z.ZodOptional<z.ZodString>;
130
+ orgRoot: z.ZodOptional<z.ZodString>;
131
+ parentRunId: z.ZodOptional<z.ZodString>;
132
+ origin: z.ZodOptional<z.ZodString>;
133
+ model: z.ZodOptional<z.ZodString>;
134
+ runId: z.ZodString;
135
+ at: z.ZodString;
136
+ }, z.core.$strip>, z.ZodObject<{
137
+ type: z.ZodLiteral<"RunStarted">;
138
+ runId: z.ZodString;
139
+ at: z.ZodString;
140
+ }, z.core.$strip>, z.ZodObject<{
141
+ type: z.ZodLiteral<"SessionStarted">;
142
+ runtime: z.ZodString;
143
+ sessionId: z.ZodString;
144
+ nodeId: z.ZodString;
145
+ runId: z.ZodString;
146
+ at: z.ZodString;
147
+ }, z.core.$strip>, z.ZodObject<{
148
+ type: z.ZodLiteral<"ToolApprovalRequested">;
149
+ approvalId: z.ZodString;
150
+ role: z.ZodString;
151
+ tool: z.ZodLiteral<"Bash">;
152
+ program: z.ZodString;
153
+ category: z.ZodEnum<{
154
+ push: "push";
155
+ deploy: "deploy";
156
+ }>;
157
+ command: z.ZodString;
158
+ argvHash: z.ZodString;
159
+ nodeId: z.ZodString;
160
+ runId: z.ZodString;
161
+ at: z.ZodString;
162
+ }, z.core.$strip>, z.ZodObject<{
163
+ type: z.ZodLiteral<"ToolApprovalResolved">;
164
+ approvalId: z.ZodString;
165
+ approved: z.ZodBoolean;
166
+ note: z.ZodOptional<z.ZodString>;
167
+ via: z.ZodEnum<{
168
+ cli: "cli";
169
+ telegram: "telegram";
170
+ api: "api";
171
+ auto: "auto";
172
+ }>;
173
+ nodeId: z.ZodString;
174
+ runId: z.ZodString;
175
+ at: z.ZodString;
176
+ }, z.core.$strip>, z.ZodObject<{
177
+ type: z.ZodLiteral<"NodeSuspended">;
178
+ sessionId: z.ZodOptional<z.ZodString>;
179
+ approvalId: z.ZodString;
180
+ cost: z.ZodOptional<z.ZodObject<{
181
+ usd: z.ZodNumber;
182
+ inputTokens: z.ZodDefault<z.ZodNumber>;
183
+ outputTokens: z.ZodDefault<z.ZodNumber>;
184
+ }, z.core.$strip>>;
185
+ nodeId: z.ZodString;
186
+ runId: z.ZodString;
187
+ at: z.ZodString;
188
+ }, z.core.$strip>, z.ZodObject<{
189
+ type: z.ZodLiteral<"NodeStarted">;
190
+ nodeId: z.ZodString;
191
+ runId: z.ZodString;
192
+ at: z.ZodString;
193
+ }, z.core.$strip>, z.ZodObject<{
194
+ type: z.ZodLiteral<"NodeCompleted">;
195
+ output: z.ZodUnknown;
196
+ summary: z.ZodDefault<z.ZodString>;
197
+ cost: z.ZodOptional<z.ZodObject<{
198
+ usd: z.ZodNumber;
199
+ inputTokens: z.ZodDefault<z.ZodNumber>;
200
+ outputTokens: z.ZodDefault<z.ZodNumber>;
201
+ }, z.core.$strip>>;
202
+ nodeId: z.ZodString;
203
+ runId: z.ZodString;
204
+ at: z.ZodString;
205
+ }, z.core.$strip>, z.ZodObject<{
206
+ type: z.ZodLiteral<"NodeFailed">;
207
+ error: z.ZodString;
208
+ cost: z.ZodOptional<z.ZodObject<{
209
+ usd: z.ZodNumber;
210
+ inputTokens: z.ZodDefault<z.ZodNumber>;
211
+ outputTokens: z.ZodDefault<z.ZodNumber>;
212
+ }, z.core.$strip>>;
213
+ nodeId: z.ZodString;
214
+ runId: z.ZodString;
215
+ at: z.ZodString;
216
+ }, z.core.$strip>, z.ZodObject<{
217
+ type: z.ZodLiteral<"GatePassed">;
218
+ report: z.ZodObject<{
219
+ gates: z.ZodArray<z.ZodString>;
220
+ passed: z.ZodBoolean;
221
+ checks: z.ZodArray<z.ZodObject<{
222
+ name: z.ZodString;
223
+ type: z.ZodEnum<{
224
+ code: "code";
225
+ human: "human";
226
+ tests: "tests";
227
+ lint: "lint";
228
+ review: "review";
229
+ jev: "jev";
230
+ judge: "judge";
231
+ mock: "mock";
232
+ }>;
233
+ passed: z.ZodBoolean;
234
+ skipped: z.ZodDefault<z.ZodBoolean>;
235
+ evidence: z.ZodString;
236
+ suggestion: z.ZodOptional<z.ZodString>;
237
+ confidence: z.ZodOptional<z.ZodNumber>;
238
+ cost: z.ZodOptional<z.ZodObject<{
239
+ usd: z.ZodNumber;
240
+ inputTokens: z.ZodDefault<z.ZodNumber>;
241
+ outputTokens: z.ZodDefault<z.ZodNumber>;
242
+ }, z.core.$strip>>;
243
+ }, z.core.$strip>>;
244
+ cost: z.ZodOptional<z.ZodObject<{
245
+ usd: z.ZodNumber;
246
+ inputTokens: z.ZodDefault<z.ZodNumber>;
247
+ outputTokens: z.ZodDefault<z.ZodNumber>;
248
+ }, z.core.$strip>>;
249
+ }, z.core.$strip>;
250
+ cost: z.ZodOptional<z.ZodObject<{
251
+ usd: z.ZodNumber;
252
+ inputTokens: z.ZodDefault<z.ZodNumber>;
253
+ outputTokens: z.ZodDefault<z.ZodNumber>;
254
+ }, z.core.$strip>>;
255
+ nodeId: z.ZodString;
256
+ runId: z.ZodString;
257
+ at: z.ZodString;
258
+ }, z.core.$strip>, z.ZodObject<{
259
+ type: z.ZodLiteral<"GateFailed">;
260
+ report: z.ZodObject<{
261
+ gates: z.ZodArray<z.ZodString>;
262
+ passed: z.ZodBoolean;
263
+ checks: z.ZodArray<z.ZodObject<{
264
+ name: z.ZodString;
265
+ type: z.ZodEnum<{
266
+ code: "code";
267
+ human: "human";
268
+ tests: "tests";
269
+ lint: "lint";
270
+ review: "review";
271
+ jev: "jev";
272
+ judge: "judge";
273
+ mock: "mock";
274
+ }>;
275
+ passed: z.ZodBoolean;
276
+ skipped: z.ZodDefault<z.ZodBoolean>;
277
+ evidence: z.ZodString;
278
+ suggestion: z.ZodOptional<z.ZodString>;
279
+ confidence: z.ZodOptional<z.ZodNumber>;
280
+ cost: z.ZodOptional<z.ZodObject<{
281
+ usd: z.ZodNumber;
282
+ inputTokens: z.ZodDefault<z.ZodNumber>;
283
+ outputTokens: z.ZodDefault<z.ZodNumber>;
284
+ }, z.core.$strip>>;
285
+ }, z.core.$strip>>;
286
+ cost: z.ZodOptional<z.ZodObject<{
287
+ usd: z.ZodNumber;
288
+ inputTokens: z.ZodDefault<z.ZodNumber>;
289
+ outputTokens: z.ZodDefault<z.ZodNumber>;
290
+ }, z.core.$strip>>;
291
+ }, z.core.$strip>;
292
+ rework: z.ZodString;
293
+ cost: z.ZodOptional<z.ZodObject<{
294
+ usd: z.ZodNumber;
295
+ inputTokens: z.ZodDefault<z.ZodNumber>;
296
+ outputTokens: z.ZodDefault<z.ZodNumber>;
297
+ }, z.core.$strip>>;
298
+ nodeId: z.ZodString;
299
+ runId: z.ZodString;
300
+ at: z.ZodString;
301
+ }, z.core.$strip>, z.ZodObject<{
302
+ type: z.ZodLiteral<"DecisionMade">;
303
+ choice: z.ZodString;
304
+ confidence: z.ZodOptional<z.ZodNumber>;
305
+ cost: z.ZodOptional<z.ZodObject<{
306
+ usd: z.ZodNumber;
307
+ inputTokens: z.ZodDefault<z.ZodNumber>;
308
+ outputTokens: z.ZodDefault<z.ZodNumber>;
309
+ }, z.core.$strip>>;
310
+ nodeId: z.ZodString;
311
+ runId: z.ZodString;
312
+ at: z.ZodString;
313
+ }, z.core.$strip>, z.ZodObject<{
314
+ type: z.ZodLiteral<"HumanRequested">;
315
+ action: z.ZodString;
316
+ prompt: z.ZodString;
317
+ nodeId: z.ZodString;
318
+ runId: z.ZodString;
319
+ at: z.ZodString;
320
+ }, z.core.$strip>, z.ZodObject<{
321
+ type: z.ZodLiteral<"HumanResponded">;
322
+ approved: z.ZodBoolean;
323
+ note: z.ZodOptional<z.ZodString>;
324
+ nodeId: z.ZodString;
325
+ runId: z.ZodString;
326
+ at: z.ZodString;
327
+ }, z.core.$strip>, z.ZodObject<{
328
+ type: z.ZodLiteral<"BudgetWarning">;
329
+ spentUsd: z.ZodNumber;
330
+ limitUsd: z.ZodNumber;
331
+ runId: z.ZodString;
332
+ at: z.ZodString;
333
+ }, z.core.$strip>, z.ZodObject<{
334
+ type: z.ZodLiteral<"BudgetExceeded">;
335
+ spentUsd: z.ZodNumber;
336
+ limitUsd: z.ZodNumber;
337
+ nodeId: z.ZodOptional<z.ZodString>;
338
+ cost: z.ZodOptional<z.ZodObject<{
339
+ usd: z.ZodNumber;
340
+ inputTokens: z.ZodDefault<z.ZodNumber>;
341
+ outputTokens: z.ZodDefault<z.ZodNumber>;
342
+ }, z.core.$strip>>;
343
+ runId: z.ZodString;
344
+ at: z.ZodString;
345
+ }, z.core.$strip>, z.ZodObject<{
346
+ type: z.ZodLiteral<"RunResumed">;
347
+ budgetUsd: z.ZodOptional<z.ZodNumber>;
348
+ runId: z.ZodString;
349
+ at: z.ZodString;
350
+ }, z.core.$strip>, z.ZodObject<{
351
+ type: z.ZodLiteral<"RunCompleted">;
352
+ runId: z.ZodString;
353
+ at: z.ZodString;
354
+ }, z.core.$strip>, z.ZodObject<{
355
+ type: z.ZodLiteral<"RunCancelled">;
356
+ reason: z.ZodString;
357
+ runId: z.ZodString;
358
+ at: z.ZodString;
359
+ }, z.core.$strip>], "type">;
360
+ export type RunEvent = z.infer<typeof RunEventSchema>;
package/dist/events.js ADDED
@@ -0,0 +1,147 @@
1
+ import { z } from 'zod';
2
+ import { WorkflowSchema } from './workflow.js';
3
+ export const CostSchema = z.object({
4
+ usd: z.number().min(0),
5
+ inputTokens: z.number().int().min(0).default(0),
6
+ outputTokens: z.number().int().min(0).default(0),
7
+ });
8
+ export const CheckResultSchema = z.object({
9
+ name: z.string(),
10
+ type: z.enum(['code', 'tests', 'lint', 'review', 'jev', 'judge', 'human', 'mock']),
11
+ passed: z.boolean(),
12
+ skipped: z.boolean().default(false),
13
+ evidence: z.string(),
14
+ suggestion: z.string().optional(),
15
+ confidence: z.number().min(0).max(1).optional(),
16
+ cost: CostSchema.optional(),
17
+ });
18
+ export const GateReportSchema = z.object({
19
+ gates: z.array(z.string()),
20
+ passed: z.boolean(),
21
+ checks: z.array(CheckResultSchema),
22
+ cost: CostSchema.optional(),
23
+ });
24
+ const base = { runId: z.string(), at: z.string() };
25
+ const node = { ...base, nodeId: z.string() };
26
+ export const RunEventSchema = z.discriminatedUnion('type', [
27
+ z.object({
28
+ ...base,
29
+ type: z.literal('RunCreated'),
30
+ workflow: z.string(),
31
+ input: z.record(z.string(), z.unknown()),
32
+ budgetUsd: z.number().positive().optional(),
33
+ workspace: z.string(),
34
+ workflowSnapshot: WorkflowSchema.optional(),
35
+ adapter: z.string().optional(),
36
+ workspaceMode: z.enum(['inplace', 'worktree']).optional(),
37
+ /** The main checkout the run was started for (the worktree's source for `worktree` runs). */
38
+ project: z.string().optional(),
39
+ /** The run's worktree branch (`worktree` runs only). */
40
+ branch: z.string().optional(),
41
+ /** The branch the project was on when the run started: where `git merge` nodes land. */
42
+ baseBranch: z.string().optional(),
43
+ /** The org directory the run was submitted with (recorded since phase 2A). */
44
+ orgRoot: z.string().optional(),
45
+ /** The run that dispatched this one (a workflow started by the orchestrator). */
46
+ parentRunId: z.string().optional(),
47
+ /** Who asked for the run when it was not the CLI or the dashboard: `schedule:<id>`, `telegram:<chatId>`. */
48
+ origin: z.string().optional(),
49
+ /** A model ref (`provider/model`) chosen for this run, over the org's routing. */
50
+ model: z.string().optional(),
51
+ }),
52
+ z.object({ ...base, type: z.literal('RunStarted') }),
53
+ z.object({
54
+ ...node,
55
+ type: z.literal('SessionStarted'),
56
+ runtime: z.string(),
57
+ sessionId: z.string(),
58
+ }),
59
+ z.object({
60
+ ...node,
61
+ type: z.literal('ToolApprovalRequested'),
62
+ approvalId: z.string(),
63
+ role: z.string(),
64
+ tool: z.literal('Bash'),
65
+ program: z.string(),
66
+ category: z.enum(['push', 'deploy']),
67
+ command: z.string(),
68
+ argvHash: z.string(),
69
+ }),
70
+ z.object({
71
+ ...node,
72
+ type: z.literal('ToolApprovalResolved'),
73
+ approvalId: z.string(),
74
+ approved: z.boolean(),
75
+ note: z.string().optional(),
76
+ via: z.enum(['cli', 'telegram', 'api', 'auto']),
77
+ }),
78
+ z.object({
79
+ ...node,
80
+ type: z.literal('NodeSuspended'),
81
+ sessionId: z.string().optional(),
82
+ approvalId: z.string(),
83
+ /** What the suspended attempt cost (counted by the reducer like any other cost). */
84
+ cost: CostSchema.optional(),
85
+ }),
86
+ z.object({ ...node, type: z.literal('NodeStarted') }),
87
+ z.object({
88
+ ...node,
89
+ type: z.literal('NodeCompleted'),
90
+ output: z.unknown(),
91
+ summary: z.string().default(''),
92
+ cost: CostSchema.optional(),
93
+ }),
94
+ z.object({
95
+ ...node,
96
+ type: z.literal('NodeFailed'),
97
+ error: z.string(),
98
+ cost: CostSchema.optional(),
99
+ }),
100
+ z.object({
101
+ ...node,
102
+ type: z.literal('GatePassed'),
103
+ report: GateReportSchema,
104
+ cost: CostSchema.optional(),
105
+ }),
106
+ z.object({
107
+ ...node,
108
+ type: z.literal('GateFailed'),
109
+ report: GateReportSchema,
110
+ rework: z.string(),
111
+ cost: CostSchema.optional(),
112
+ }),
113
+ z.object({
114
+ ...node,
115
+ type: z.literal('DecisionMade'),
116
+ choice: z.string(),
117
+ confidence: z.number().min(0).max(1).optional(),
118
+ cost: CostSchema.optional(),
119
+ }),
120
+ z.object({ ...node, type: z.literal('HumanRequested'), action: z.string(), prompt: z.string() }),
121
+ z.object({
122
+ ...node,
123
+ type: z.literal('HumanResponded'),
124
+ approved: z.boolean(),
125
+ note: z.string().optional(),
126
+ }),
127
+ z.object({
128
+ ...base,
129
+ type: z.literal('BudgetWarning'),
130
+ spentUsd: z.number(),
131
+ limitUsd: z.number(),
132
+ }),
133
+ z.object({
134
+ ...base,
135
+ type: z.literal('BudgetExceeded'),
136
+ spentUsd: z.number(),
137
+ limitUsd: z.number(),
138
+ /** The task stopped by its runtime's budget cap; it goes back to pending and re-runs on resume. */
139
+ nodeId: z.string().optional(),
140
+ /** What that stopped attempt cost. */
141
+ cost: CostSchema.optional(),
142
+ }),
143
+ z.object({ ...base, type: z.literal('RunResumed'), budgetUsd: z.number().positive().optional() }),
144
+ z.object({ ...base, type: z.literal('RunCompleted') }),
145
+ z.object({ ...base, type: z.literal('RunCancelled'), reason: z.string() }),
146
+ ]);
147
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[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QACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;KACrB,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,IAAI;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;QACjC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,mGAAmG;QACnG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC7B,sCAAsC;QACtC,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE;KAC5B,CAAC;IACF,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IACjG,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;IACtD,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;CAC3E,CAAC,CAAC"}
package/dist/gate.d.ts ADDED
@@ -0,0 +1,91 @@
1
+ import { z } from 'zod';
2
+ export declare const CheckSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ type: z.ZodLiteral<"code">;
4
+ command: z.ZodString;
5
+ timeout_ms: z.ZodDefault<z.ZodNumber>;
6
+ name: z.ZodString;
7
+ }, z.core.$strip>, z.ZodObject<{
8
+ type: z.ZodLiteral<"tests">;
9
+ timeout_ms: z.ZodDefault<z.ZodNumber>;
10
+ name: z.ZodString;
11
+ }, z.core.$strip>, z.ZodObject<{
12
+ type: z.ZodLiteral<"lint">;
13
+ command: z.ZodOptional<z.ZodString>;
14
+ timeout_ms: z.ZodDefault<z.ZodNumber>;
15
+ name: z.ZodString;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ type: z.ZodLiteral<"review">;
18
+ criteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ name: z.ZodString;
20
+ }, z.core.$strip>, z.ZodObject<{
21
+ type: z.ZodLiteral<"jev">;
22
+ question: z.ZodString;
23
+ kind: z.ZodDefault<z.ZodEnum<{
24
+ noul: "noul";
25
+ score: "score";
26
+ }>>;
27
+ threshold: z.ZodDefault<z.ZodNumber>;
28
+ name: z.ZodString;
29
+ }, z.core.$strip>, z.ZodObject<{
30
+ type: z.ZodLiteral<"judge">;
31
+ role: z.ZodString;
32
+ rubric: z.ZodString;
33
+ name: z.ZodString;
34
+ }, z.core.$strip>, z.ZodObject<{
35
+ type: z.ZodLiteral<"human">;
36
+ prompt: z.ZodString;
37
+ name: z.ZodString;
38
+ }, z.core.$strip>, z.ZodObject<{
39
+ type: z.ZodLiteral<"mock">;
40
+ passes: z.ZodBoolean;
41
+ evidence: z.ZodDefault<z.ZodString>;
42
+ name: z.ZodString;
43
+ }, z.core.$strip>], "type">;
44
+ export type Check = z.infer<typeof CheckSchema>;
45
+ export declare const GateSchema: z.ZodObject<{
46
+ gate: z.ZodString;
47
+ description: z.ZodOptional<z.ZodString>;
48
+ checks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
49
+ type: z.ZodLiteral<"code">;
50
+ command: z.ZodString;
51
+ timeout_ms: z.ZodDefault<z.ZodNumber>;
52
+ name: z.ZodString;
53
+ }, z.core.$strip>, z.ZodObject<{
54
+ type: z.ZodLiteral<"tests">;
55
+ timeout_ms: z.ZodDefault<z.ZodNumber>;
56
+ name: z.ZodString;
57
+ }, z.core.$strip>, z.ZodObject<{
58
+ type: z.ZodLiteral<"lint">;
59
+ command: z.ZodOptional<z.ZodString>;
60
+ timeout_ms: z.ZodDefault<z.ZodNumber>;
61
+ name: z.ZodString;
62
+ }, z.core.$strip>, z.ZodObject<{
63
+ type: z.ZodLiteral<"review">;
64
+ criteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
+ name: z.ZodString;
66
+ }, z.core.$strip>, z.ZodObject<{
67
+ type: z.ZodLiteral<"jev">;
68
+ question: z.ZodString;
69
+ kind: z.ZodDefault<z.ZodEnum<{
70
+ noul: "noul";
71
+ score: "score";
72
+ }>>;
73
+ threshold: z.ZodDefault<z.ZodNumber>;
74
+ name: z.ZodString;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ type: z.ZodLiteral<"judge">;
77
+ role: z.ZodString;
78
+ rubric: z.ZodString;
79
+ name: z.ZodString;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ type: z.ZodLiteral<"human">;
82
+ prompt: z.ZodString;
83
+ name: z.ZodString;
84
+ }, z.core.$strip>, z.ZodObject<{
85
+ type: z.ZodLiteral<"mock">;
86
+ passes: z.ZodBoolean;
87
+ evidence: z.ZodDefault<z.ZodString>;
88
+ name: z.ZodString;
89
+ }, z.core.$strip>], "type">>;
90
+ }, z.core.$strip>;
91
+ export type Gate = z.infer<typeof GateSchema>;