@drisp/protocol 0.8.7 → 0.8.8
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/v2.d.ts +597 -1
- package/dist/v2.js +511 -311
- package/package.json +1 -1
package/dist/v2.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-HMYWICNI.js";
|
|
4
4
|
|
|
5
5
|
// src/v2.ts
|
|
6
|
-
import { z as
|
|
6
|
+
import { z as z3 } from "zod";
|
|
7
7
|
|
|
8
8
|
// src/history.ts
|
|
9
9
|
function readableHistory(records) {
|
|
@@ -110,6 +110,192 @@ function forecastOfClass(sizeClass, calibration) {
|
|
|
110
110
|
return calibration?.[sizeClass]?.forecast ?? SIZE_CLASS_FORECASTS[sizeClass];
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// src/tracker.ts
|
|
114
|
+
import { z as z2 } from "zod";
|
|
115
|
+
var id = z2.string().min(1).max(160);
|
|
116
|
+
var text = z2.string().max(1e5);
|
|
117
|
+
var deliveryEvidenceKindSchema = z2.enum(["pr_opened", "merged", "staging", "qa_started", "qa_passed", "released"]);
|
|
118
|
+
var deliveryStageSchema = z2.strictObject({
|
|
119
|
+
id,
|
|
120
|
+
name: z2.string().trim().min(1).max(100),
|
|
121
|
+
category: z2.enum(["backlog", "unstarted", "started", "completed", "canceled"]),
|
|
122
|
+
behavior: z2.enum(["manual", "agent_start", ...deliveryEvidenceKindSchema.options]).default("manual")
|
|
123
|
+
});
|
|
124
|
+
var deliveryTransitionSchema = z2.strictObject({
|
|
125
|
+
from: id,
|
|
126
|
+
to: id,
|
|
127
|
+
requires: z2.array(deliveryEvidenceKindSchema).default([])
|
|
128
|
+
});
|
|
129
|
+
var deliveryWorkflowSchema = z2.strictObject({
|
|
130
|
+
revision: z2.number().int().nonnegative(),
|
|
131
|
+
stages: z2.array(deliveryStageSchema).min(1).max(100),
|
|
132
|
+
transitions: z2.array(deliveryTransitionSchema).max(1e4),
|
|
133
|
+
attentionColumn: z2.boolean().default(true)
|
|
134
|
+
}).superRefine((workflow, ctx) => {
|
|
135
|
+
const ids = new Set(workflow.stages.map((s) => s.id));
|
|
136
|
+
if (ids.size !== workflow.stages.length) ctx.addIssue({ code: "custom", message: "Duplicate stage ID" });
|
|
137
|
+
const edges = /* @__PURE__ */ new Set();
|
|
138
|
+
for (const edge of workflow.transitions) {
|
|
139
|
+
const key = JSON.stringify([edge.from, edge.to]);
|
|
140
|
+
if (!ids.has(edge.from) || !ids.has(edge.to) || edge.from === edge.to || edges.has(key))
|
|
141
|
+
ctx.addIssue({ code: "custom", message: "Invalid or duplicate transition" });
|
|
142
|
+
edges.add(key);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
function defaultDeliveryWorkflow() {
|
|
146
|
+
const stages = [
|
|
147
|
+
{ id: "backlog", name: "Backlog", category: "backlog", behavior: "manual" },
|
|
148
|
+
{ id: "todo", name: "Todo", category: "unstarted", behavior: "manual" },
|
|
149
|
+
{ id: "progress", name: "In Progress", category: "started", behavior: "agent_start" },
|
|
150
|
+
{ id: "review", name: "In Review", category: "started", behavior: "pr_opened" },
|
|
151
|
+
{ id: "stage-ready", name: "Ready for Staging", category: "started", behavior: "merged" },
|
|
152
|
+
{ id: "staging", name: "In Staging", category: "started", behavior: "staging" },
|
|
153
|
+
{ id: "qa", name: "In QA", category: "started", behavior: "qa_started" },
|
|
154
|
+
{ id: "prod-ready", name: "Ready for Prod", category: "started", behavior: "qa_passed" },
|
|
155
|
+
{ id: "released", name: "Released", category: "completed", behavior: "released" },
|
|
156
|
+
{ id: "canceled", name: "Canceled", category: "canceled", behavior: "manual" },
|
|
157
|
+
{ id: "duplicate", name: "Duplicate", category: "canceled", behavior: "manual" }
|
|
158
|
+
];
|
|
159
|
+
const transitions = stages.slice(1, 9).map((stage, i) => ({
|
|
160
|
+
from: stages[i].id,
|
|
161
|
+
to: stage.id,
|
|
162
|
+
// Recheck the entire delivery path when a revision or staging deployment changes mid-flight.
|
|
163
|
+
requires: stages.slice(0, i + 2).flatMap((s) => deliveryEvidenceKindSchema.safeParse(s.behavior).success ? [s.behavior] : [])
|
|
164
|
+
}));
|
|
165
|
+
for (const stage of stages) {
|
|
166
|
+
for (const target of ["todo", "canceled", "duplicate"]) {
|
|
167
|
+
if (target !== stage.id && !transitions.some((t) => t.from === stage.id && t.to === target))
|
|
168
|
+
transitions.push({ from: stage.id, to: target, requires: [] });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return { revision: 0, stages, transitions, attentionColumn: true };
|
|
172
|
+
}
|
|
173
|
+
var trackerSourceSchema = z2.strictObject({ workspace: id, id, identifier: id, url: z2.string().url() });
|
|
174
|
+
var trackerPlanSchema = z2.strictObject({ id, name: z2.string().trim().min(1).max(200), description: text.default(""), source: trackerSourceSchema.optional() });
|
|
175
|
+
var trackerCommentSchema = z2.strictObject({ id, body: text, author: id, createdAt: z2.number(), sourceId: id.optional() });
|
|
176
|
+
var trackerEvidenceSchema = z2.strictObject({
|
|
177
|
+
id,
|
|
178
|
+
kind: deliveryEvidenceKindSchema,
|
|
179
|
+
revision: id,
|
|
180
|
+
reference: z2.string().min(1).max(2e3),
|
|
181
|
+
deploymentId: id.optional(),
|
|
182
|
+
runId: id.optional(),
|
|
183
|
+
createdAt: z2.number(),
|
|
184
|
+
author: id
|
|
185
|
+
});
|
|
186
|
+
var trackerIssueSchema = z2.strictObject({
|
|
187
|
+
id,
|
|
188
|
+
identifier: id,
|
|
189
|
+
title: z2.string().trim().min(1).max(500),
|
|
190
|
+
description: text,
|
|
191
|
+
stageId: id,
|
|
192
|
+
planId: id.nullable(),
|
|
193
|
+
parentId: id.nullable(),
|
|
194
|
+
assignee: id.nullable(),
|
|
195
|
+
priority: z2.number().int().min(0).max(4),
|
|
196
|
+
labels: z2.array(z2.string().max(100)).max(100),
|
|
197
|
+
blockedBy: z2.array(id).max(100),
|
|
198
|
+
externalBlockers: z2.array(z2.string().max(2e3)).max(100),
|
|
199
|
+
agentEligible: z2.boolean(),
|
|
200
|
+
automationHeld: z2.boolean(),
|
|
201
|
+
revision: id.nullable(),
|
|
202
|
+
attention: z2.strictObject({
|
|
203
|
+
id,
|
|
204
|
+
message: z2.string().trim().min(1).max(1e4),
|
|
205
|
+
runId: id.optional(),
|
|
206
|
+
origin: z2.enum(["manual", "run"]).default("manual")
|
|
207
|
+
}).nullable(),
|
|
208
|
+
threadId: id,
|
|
209
|
+
runIds: z2.array(id),
|
|
210
|
+
comments: z2.array(trackerCommentSchema),
|
|
211
|
+
evidence: z2.array(trackerEvidenceSchema),
|
|
212
|
+
history: z2.array(z2.strictObject({ at: z2.number(), actor: id, action: z2.string(), from: id.optional(), to: id.optional() })),
|
|
213
|
+
source: trackerSourceSchema.optional(),
|
|
214
|
+
sourceAssignee: z2.string().optional(),
|
|
215
|
+
createdAt: z2.number(),
|
|
216
|
+
updatedAt: z2.number(),
|
|
217
|
+
version: z2.number().int().nonnegative()
|
|
218
|
+
});
|
|
219
|
+
var trackerSnapshotSchema = z2.strictObject({
|
|
220
|
+
workflow: deliveryWorkflowSchema,
|
|
221
|
+
issues: z2.array(trackerIssueSchema),
|
|
222
|
+
plans: z2.array(trackerPlanSchema),
|
|
223
|
+
members: z2.array(id)
|
|
224
|
+
});
|
|
225
|
+
var issueFields = {
|
|
226
|
+
title: z2.string().trim().min(1).max(500),
|
|
227
|
+
description: text.default(""),
|
|
228
|
+
planId: id.nullable().default(null),
|
|
229
|
+
parentId: id.nullable().default(null),
|
|
230
|
+
assignee: id.nullable().default(null),
|
|
231
|
+
priority: z2.number().int().min(0).max(4).default(0),
|
|
232
|
+
labels: z2.array(z2.string().max(100)).max(100).default([]),
|
|
233
|
+
blockedBy: z2.array(id).max(100).default([]),
|
|
234
|
+
externalBlockers: z2.array(z2.string().max(2e3)).max(100).default([]),
|
|
235
|
+
agentEligible: z2.boolean().default(false),
|
|
236
|
+
revision: id.nullable().default(null)
|
|
237
|
+
};
|
|
238
|
+
var trackerImportSchema = z2.strictObject({
|
|
239
|
+
workspace: id,
|
|
240
|
+
teamId: id,
|
|
241
|
+
stages: z2.array(deliveryStageSchema).min(1).max(100),
|
|
242
|
+
stageMapping: z2.record(z2.string(), id),
|
|
243
|
+
adoptWorkflow: z2.boolean(),
|
|
244
|
+
plans: z2.array(z2.strictObject({ source: trackerSourceSchema, name: z2.string().min(1).max(200), description: text })).max(500),
|
|
245
|
+
issues: z2.array(z2.strictObject({
|
|
246
|
+
source: trackerSourceSchema,
|
|
247
|
+
title: issueFields.title,
|
|
248
|
+
description: text,
|
|
249
|
+
stageId: id,
|
|
250
|
+
planId: id.nullable(),
|
|
251
|
+
parentId: id.nullable(),
|
|
252
|
+
assignee: id.nullable(),
|
|
253
|
+
sourceAssignee: z2.string().optional(),
|
|
254
|
+
priority: issueFields.priority,
|
|
255
|
+
labels: issueFields.labels,
|
|
256
|
+
blockedBy: z2.array(id).max(100),
|
|
257
|
+
externalBlockers: z2.array(z2.string().max(2e3)).max(100).default([]),
|
|
258
|
+
comments: z2.array(trackerCommentSchema).max(1e3),
|
|
259
|
+
createdAt: z2.number()
|
|
260
|
+
})).max(2e3),
|
|
261
|
+
omissions: z2.array(z2.string().max(2e3)).max(500).default([])
|
|
262
|
+
});
|
|
263
|
+
var trackerOperationSchema = z2.discriminatedUnion("kind", [
|
|
264
|
+
z2.strictObject({ kind: z2.literal("tracker.sync") }),
|
|
265
|
+
z2.strictObject({ kind: z2.literal("issue.create"), id: id.max(147), stageId: id.optional(), ...issueFields }),
|
|
266
|
+
z2.strictObject({ kind: z2.literal("issue.update"), id, version: z2.number().int(), changes: trackerIssueSchema.pick({
|
|
267
|
+
title: true,
|
|
268
|
+
description: true,
|
|
269
|
+
planId: true,
|
|
270
|
+
parentId: true,
|
|
271
|
+
assignee: true,
|
|
272
|
+
priority: true,
|
|
273
|
+
labels: true,
|
|
274
|
+
blockedBy: true,
|
|
275
|
+
externalBlockers: true,
|
|
276
|
+
agentEligible: true,
|
|
277
|
+
revision: true
|
|
278
|
+
}).partial() }),
|
|
279
|
+
z2.strictObject({ kind: z2.literal("plan.save"), ...trackerPlanSchema.shape }),
|
|
280
|
+
z2.strictObject({ kind: z2.literal("workflow.save"), workflow: deliveryWorkflowSchema, replacements: z2.record(z2.string(), id).default({}) }),
|
|
281
|
+
z2.strictObject({ kind: z2.literal("issue.transition"), id, version: z2.number().int(), stageId: id }),
|
|
282
|
+
z2.strictObject({ kind: z2.literal("issue.attention"), id, version: z2.number().int(), message: z2.string().trim().min(1).max(1e4), runId: id.optional() }),
|
|
283
|
+
z2.strictObject({ kind: z2.literal("issue.resolve"), id, version: z2.number().int(), attentionId: id }),
|
|
284
|
+
z2.strictObject({ kind: z2.literal("issue.resume"), id, version: z2.number().int() }),
|
|
285
|
+
z2.strictObject({ kind: z2.literal("issue.revision"), id, version: z2.number().int(), revision: id, runId: id }),
|
|
286
|
+
z2.strictObject({ kind: z2.literal("issue.comment"), id, commentId: id, body: text }),
|
|
287
|
+
z2.strictObject({ kind: z2.literal("issue.evidence"), id, evidenceId: id, evidence: trackerEvidenceSchema.omit({ id: true, author: true, createdAt: true }) }),
|
|
288
|
+
z2.strictObject({ kind: z2.literal("import.preview"), input: trackerImportSchema }),
|
|
289
|
+
z2.strictObject({ kind: z2.literal("import.commit"), previewId: id })
|
|
290
|
+
]);
|
|
291
|
+
var trackerImportPreviewSchema = z2.strictObject({
|
|
292
|
+
previewId: id,
|
|
293
|
+
creates: z2.number().int(),
|
|
294
|
+
skips: z2.number().int(),
|
|
295
|
+
plans: z2.number().int(),
|
|
296
|
+
omissions: z2.array(z2.string())
|
|
297
|
+
});
|
|
298
|
+
|
|
113
299
|
// src/v2.ts
|
|
114
300
|
var protocolVersion = { major: 2, minor: 3 };
|
|
115
301
|
var conversationContinuationCapability = "conversation_continuation";
|
|
@@ -120,29 +306,29 @@ var runDelegationCapability = "run_delegation_v1";
|
|
|
120
306
|
var orchestratorGuidanceCapability = "orchestrator_guidance_v1";
|
|
121
307
|
var runUsageCapability = "run_usage_v1";
|
|
122
308
|
var delegationTokenPrefix = "drisp_dlg_";
|
|
123
|
-
var runArtifactNameSchema =
|
|
309
|
+
var runArtifactNameSchema = z3.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
|
|
124
310
|
var runArtifactMaxBytes = 64 * 1024;
|
|
125
|
-
var secretEnvironmentSchema =
|
|
126
|
-
|
|
127
|
-
|
|
311
|
+
var secretEnvironmentSchema = z3.record(
|
|
312
|
+
z3.string().regex(/^(?:OPENAI_API_KEY|ANTHROPIC_API_KEY|CLAUDE_CODE_OAUTH_TOKEN|NPM_TOKEN|NODE_AUTH_TOKEN|PIP_INDEX_URL|PIP_EXTRA_INDEX_URL|UV_INDEX_URL|DRISP_TEST_[A-Z0-9_]+)$/),
|
|
313
|
+
z3.string().regex(/^projects\/[a-zA-Z0-9-]+\/secrets\/[a-zA-Z0-9_-]+\/versions\/(?:latest|[0-9]+)$/)
|
|
128
314
|
);
|
|
129
|
-
var permissionAnswerSchema =
|
|
130
|
-
kind:
|
|
131
|
-
decision:
|
|
132
|
-
reason:
|
|
315
|
+
var permissionAnswerSchema = z3.strictObject({
|
|
316
|
+
kind: z3.literal("permission"),
|
|
317
|
+
decision: z3.enum(["allow", "deny"]),
|
|
318
|
+
reason: z3.string().max(4096).optional()
|
|
133
319
|
});
|
|
134
|
-
var
|
|
135
|
-
var sequence =
|
|
320
|
+
var id2 = z3.string().min(1).max(160);
|
|
321
|
+
var sequence = z3.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
136
322
|
var positive = sequence.refine((n) => n > 0);
|
|
137
|
-
var timestamp =
|
|
138
|
-
var scopeSchema =
|
|
139
|
-
|
|
140
|
-
|
|
323
|
+
var timestamp = z3.iso.datetime();
|
|
324
|
+
var scopeSchema = z3.discriminatedUnion("visibility", [
|
|
325
|
+
z3.strictObject({ visibility: z3.literal("organization") }),
|
|
326
|
+
z3.strictObject({ visibility: z3.literal("private"), ownerUserId: id2 })
|
|
141
327
|
]);
|
|
142
|
-
var installedWorkflowsSchema =
|
|
143
|
-
var harnessSchema =
|
|
144
|
-
var harnessReadinessSchema =
|
|
145
|
-
var runnerReadinessSchema =
|
|
328
|
+
var installedWorkflowsSchema = z3.array(InstalledWorkflowSchema).max(256);
|
|
329
|
+
var harnessSchema = z3.enum(["claude-code", "codex"]);
|
|
330
|
+
var harnessReadinessSchema = z3.strictObject({ installed: z3.boolean(), signedIn: z3.boolean() });
|
|
331
|
+
var runnerReadinessSchema = z3.strictObject({
|
|
146
332
|
"claude-code": harnessReadinessSchema.optional(),
|
|
147
333
|
codex: harnessReadinessSchema.optional()
|
|
148
334
|
});
|
|
@@ -157,27 +343,27 @@ function readinessFixCommand(harness, readiness) {
|
|
|
157
343
|
return void 0;
|
|
158
344
|
}
|
|
159
345
|
var runnerUpdateCommand = "npm i -g @drisp/cli";
|
|
160
|
-
var interruptionSchema =
|
|
161
|
-
interruptionId:
|
|
346
|
+
var interruptionSchema = z3.strictObject({
|
|
347
|
+
interruptionId: id2,
|
|
162
348
|
revision: positive,
|
|
163
349
|
/** `waiting` (root ADR-0008) is non-human: a Run parked until one of its children closes or parks. */
|
|
164
|
-
kind:
|
|
165
|
-
message:
|
|
350
|
+
kind: z3.enum(["permission", "question", "guidance", "recovery", "waiting"]),
|
|
351
|
+
message: z3.string().max(16384),
|
|
166
352
|
/** Explicit technical question for a parent; absent always reserves the answer to a member. */
|
|
167
|
-
respondent:
|
|
168
|
-
requestId:
|
|
353
|
+
respondent: z3.enum(["orchestrator"]).optional(),
|
|
354
|
+
requestId: id2.optional()
|
|
169
355
|
});
|
|
170
|
-
var workflowIdentitySchema =
|
|
171
|
-
name:
|
|
172
|
-
version:
|
|
356
|
+
var workflowIdentitySchema = z3.strictObject({
|
|
357
|
+
name: z3.string().min(1).max(128),
|
|
358
|
+
version: z3.string().min(1).max(128).optional()
|
|
173
359
|
});
|
|
174
|
-
var buildCloseReasonSchema =
|
|
360
|
+
var buildCloseReasonSchema = z3.enum([
|
|
175
361
|
"workflow_template_mismatch",
|
|
176
362
|
"child_project_dir_invalid",
|
|
177
363
|
"build_not_approved",
|
|
178
364
|
"approval_question_missing"
|
|
179
365
|
]);
|
|
180
|
-
var runCloseReasonSchema =
|
|
366
|
+
var runCloseReasonSchema = z3.enum([
|
|
181
367
|
"execution_terminal",
|
|
182
368
|
"cancelled_before_start",
|
|
183
369
|
"admission_failed",
|
|
@@ -195,53 +381,53 @@ var runCloseReasonSchema = z2.enum([
|
|
|
195
381
|
...buildCloseReasonSchema.options
|
|
196
382
|
]);
|
|
197
383
|
var factIdentity = {
|
|
198
|
-
runId:
|
|
199
|
-
attemptId:
|
|
384
|
+
runId: id2,
|
|
385
|
+
attemptId: id2,
|
|
200
386
|
executionRevision: positive,
|
|
201
387
|
emittedAt: timestamp
|
|
202
388
|
};
|
|
203
|
-
var runUsageSchema =
|
|
389
|
+
var runUsageSchema = z3.strictObject({ counted: sequence, cacheRead: sequence });
|
|
204
390
|
var reportedUsage = { usage: runUsageSchema.optional() };
|
|
205
|
-
var controlRecordSchema =
|
|
391
|
+
var controlRecordSchema = z3.discriminatedUnion("kind", [
|
|
206
392
|
/** Instance-scoped, not tied to a Run: the full replacement inventory of installed Workflows. */
|
|
207
|
-
|
|
393
|
+
z3.strictObject({ kind: z3.literal("workflows.changed"), workflows: installedWorkflowsSchema }),
|
|
208
394
|
/** Instance-scoped, not tied to a Run: the Runner's full Readiness, sent when it changes after hello. */
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
kind:
|
|
213
|
-
runId:
|
|
214
|
-
attemptId:
|
|
215
|
-
reason:
|
|
395
|
+
z3.strictObject({ kind: z3.literal("readiness.changed"), readiness: runnerReadinessSchema }),
|
|
396
|
+
z3.strictObject({ kind: z3.literal("assignment.accepted"), runId: id2, attemptId: id2 }),
|
|
397
|
+
z3.strictObject({
|
|
398
|
+
kind: z3.literal("assignment.rejected"),
|
|
399
|
+
runId: id2,
|
|
400
|
+
attemptId: id2,
|
|
401
|
+
reason: z3.string().max(1024)
|
|
216
402
|
}),
|
|
217
|
-
|
|
218
|
-
kind:
|
|
403
|
+
z3.strictObject({
|
|
404
|
+
kind: z3.literal("run.started"),
|
|
219
405
|
...factIdentity,
|
|
220
406
|
/** Absent from runners that predate Workflow reporting. */
|
|
221
407
|
workflow: workflowIdentitySchema.optional()
|
|
222
408
|
}),
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
kind:
|
|
409
|
+
z3.strictObject({ kind: z3.literal("run.resumed"), ...factIdentity }),
|
|
410
|
+
z3.strictObject({
|
|
411
|
+
kind: z3.literal("run.attention"),
|
|
226
412
|
...factIdentity,
|
|
227
413
|
interruption: interruptionSchema,
|
|
228
|
-
occupancy:
|
|
414
|
+
occupancy: z3.enum(["held", "released"]),
|
|
229
415
|
historyThrough: sequence,
|
|
230
|
-
continuation:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
416
|
+
continuation: z3.discriminatedUnion("kind", [
|
|
417
|
+
z3.strictObject({ kind: z3.literal("live_request") }),
|
|
418
|
+
z3.strictObject({ kind: z3.literal("local_checkpoint"), checkpointId: id2 }),
|
|
419
|
+
z3.strictObject({ kind: z3.literal("portable_checkpoint"), checkpointId: id2 }),
|
|
420
|
+
z3.strictObject({ kind: z3.literal("repair_required"), detail: z3.string().max(4096) })
|
|
235
421
|
]),
|
|
236
422
|
...reportedUsage
|
|
237
423
|
}),
|
|
238
|
-
|
|
239
|
-
kind:
|
|
424
|
+
z3.strictObject({
|
|
425
|
+
kind: z3.literal("run.finished"),
|
|
240
426
|
...factIdentity,
|
|
241
|
-
status:
|
|
427
|
+
status: z3.enum(["completed", "failed", "cancelled"]),
|
|
242
428
|
historyThrough: sequence,
|
|
243
429
|
/** No setup/harness executed and no workspace was produced; safe to retire without export. */
|
|
244
|
-
workspaceUnavailable:
|
|
430
|
+
workspaceUnavailable: z3.literal(true).optional(),
|
|
245
431
|
/**
|
|
246
432
|
* Why a Build Run failed, as its close reason (docs/specs/build-orchestrator.md). Sent only for a grant with
|
|
247
433
|
* `parent` or `delegationToken`, which only a Hub that knows this field issues.
|
|
@@ -253,93 +439,93 @@ var controlRecordSchema = z2.discriminatedUnion("kind", [
|
|
|
253
439
|
* The usage of a Run while it executes, for a grant marked `reportUsage`. Not an execution fact: it carries no
|
|
254
440
|
* execution revision, so it never advances, parks or closes the Run, and never wakes its parent.
|
|
255
441
|
*/
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
kind:
|
|
260
|
-
runId:
|
|
261
|
-
attemptId:
|
|
262
|
-
commandId:
|
|
263
|
-
reason:
|
|
442
|
+
z3.strictObject({ kind: z3.literal("run.usage"), runId: id2, attemptId: id2, ...runUsageSchema.shape }),
|
|
443
|
+
z3.strictObject({ kind: z3.literal("command.applied"), runId: id2, attemptId: id2, commandId: id2 }),
|
|
444
|
+
z3.strictObject({
|
|
445
|
+
kind: z3.literal("command.rejected"),
|
|
446
|
+
runId: id2,
|
|
447
|
+
attemptId: id2,
|
|
448
|
+
commandId: id2,
|
|
449
|
+
reason: z3.string().max(1024)
|
|
264
450
|
}),
|
|
265
|
-
|
|
451
|
+
z3.strictObject({ kind: z3.literal("revoked_not_started"), runId: id2, attemptId: id2 })
|
|
266
452
|
]);
|
|
267
|
-
var repositoryRefSchema =
|
|
453
|
+
var repositoryRefSchema = z3.string().min(1).max(512).regex(
|
|
268
454
|
/^(?![-/])(?!.*\.\.)(?!.*@\{)(?!.*(?:^|\/)\.)(?!.*\.lock(?:\/|$))(?!.*\/\/)[^\x00-\x20\x7f~^:?*\[\\]+(?<![/.])$/
|
|
269
455
|
);
|
|
270
|
-
var repositoryWorkingDirectorySchema =
|
|
456
|
+
var repositoryWorkingDirectorySchema = z3.string().min(1).max(1024).regex(
|
|
271
457
|
/^(?:\.|(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))(?!.*(?:^|\/)\.git(?:\/|$))[^\x00-\x1f\x7f\\:]+(?<!\/))$/
|
|
272
458
|
);
|
|
273
459
|
var repositoryIdentity = {
|
|
274
|
-
repositoryId:
|
|
275
|
-
installationId:
|
|
276
|
-
owner:
|
|
277
|
-
name:
|
|
460
|
+
repositoryId: z3.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
461
|
+
installationId: z3.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
462
|
+
owner: z3.string().min(1).max(100).regex(/^[a-zA-Z0-9][a-zA-Z0-9-]*$/),
|
|
463
|
+
name: z3.string().min(1).max(100).regex(/^(?!\.{1,2}$)[a-zA-Z0-9_.-]+$/)
|
|
278
464
|
};
|
|
279
|
-
var repositoryBindingSchema =
|
|
280
|
-
id,
|
|
281
|
-
label:
|
|
465
|
+
var repositoryBindingSchema = z3.strictObject({
|
|
466
|
+
id: id2,
|
|
467
|
+
label: z3.string().min(1).max(160),
|
|
282
468
|
...repositoryIdentity,
|
|
283
469
|
defaultRef: repositoryRefSchema,
|
|
284
470
|
workingDirectory: repositoryWorkingDirectorySchema,
|
|
285
|
-
setupCommands:
|
|
471
|
+
setupCommands: z3.array(z3.string().min(1).max(8192)).max(16),
|
|
286
472
|
revision: positive,
|
|
287
|
-
enabled:
|
|
473
|
+
enabled: z3.boolean()
|
|
288
474
|
});
|
|
289
|
-
var repositorySourceSchema =
|
|
290
|
-
bindingId:
|
|
475
|
+
var repositorySourceSchema = z3.strictObject({
|
|
476
|
+
bindingId: id2,
|
|
291
477
|
...repositoryIdentity,
|
|
292
478
|
ref: repositoryRefSchema,
|
|
293
|
-
commitSha:
|
|
479
|
+
commitSha: z3.string().regex(/^[0-9a-f]{40}$/),
|
|
294
480
|
branch: repositoryRefSchema,
|
|
295
481
|
workingDirectory: repositoryWorkingDirectorySchema,
|
|
296
|
-
setupCommands:
|
|
482
|
+
setupCommands: z3.array(z3.string().min(1).max(8192)).max(16),
|
|
297
483
|
configRevision: positive
|
|
298
484
|
});
|
|
299
|
-
var workflowSourceSchema =
|
|
300
|
-
var workflowReferenceSchema =
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
name:
|
|
485
|
+
var workflowSourceSchema = z3.string().max(201).regex(/^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*$/);
|
|
486
|
+
var workflowReferenceSchema = z3.union([
|
|
487
|
+
z3.string().max(512),
|
|
488
|
+
z3.strictObject({
|
|
489
|
+
name: z3.string().min(1).max(128).regex(/^[A-Za-z0-9][A-Za-z0-9_-]*$/),
|
|
304
490
|
source: workflowSourceSchema.optional(),
|
|
305
|
-
ref:
|
|
306
|
-
version:
|
|
491
|
+
ref: z3.string().min(1).max(512).optional(),
|
|
492
|
+
version: z3.string().min(1).max(128).regex(/^\d[A-Za-z0-9_.+-]*$/).optional()
|
|
307
493
|
})
|
|
308
494
|
]);
|
|
309
495
|
var workflowName = (workflow) => typeof workflow === "object" ? workflow.name : workflow;
|
|
310
496
|
var installReference = (workflow) => typeof workflow === "object" && workflow.source !== void 0 ? workflow : void 0;
|
|
311
497
|
var sameWorkflow = (a, b) => canonicalJson(a ?? null) === canonicalJson(b ?? null);
|
|
312
|
-
var runSpecSchema =
|
|
313
|
-
prompt:
|
|
314
|
-
projectDir:
|
|
498
|
+
var runSpecSchema = z3.strictObject({
|
|
499
|
+
prompt: z3.string().min(1).max(131072),
|
|
500
|
+
projectDir: z3.string().min(1).max(4096),
|
|
315
501
|
harness: harnessSchema,
|
|
316
502
|
workflow: workflowReferenceSchema.optional(),
|
|
317
503
|
repository: repositorySourceSchema.optional()
|
|
318
504
|
});
|
|
319
|
-
var runKeySchema =
|
|
320
|
-
var delegationSchema =
|
|
505
|
+
var runKeySchema = z3.string().min(1).max(160);
|
|
506
|
+
var delegationSchema = z3.strictObject({
|
|
321
507
|
// Omitted: follow the Runner capacity. An explicit value is a per-Build ceiling.
|
|
322
|
-
maxChildren:
|
|
323
|
-
tokenBudget:
|
|
324
|
-
});
|
|
325
|
-
var tokenCapSchema =
|
|
326
|
-
var runParentIntentSchema =
|
|
327
|
-
var runParentSchema =
|
|
328
|
-
var commandSchema =
|
|
329
|
-
commandId:
|
|
330
|
-
hubEpoch:
|
|
331
|
-
runId:
|
|
508
|
+
maxChildren: z3.number().int().min(1).max(64).optional(),
|
|
509
|
+
tokenBudget: z3.number().int().positive().max(Number.MAX_SAFE_INTEGER)
|
|
510
|
+
});
|
|
511
|
+
var tokenCapSchema = z3.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
512
|
+
var runParentIntentSchema = z3.strictObject({ runId: id2, tokenCap: tokenCapSchema.optional() });
|
|
513
|
+
var runParentSchema = z3.strictObject({ runId: id2, tokenCap: tokenCapSchema });
|
|
514
|
+
var commandSchema = z3.strictObject({
|
|
515
|
+
commandId: id2,
|
|
516
|
+
hubEpoch: id2,
|
|
517
|
+
runId: id2,
|
|
332
518
|
expectedRecordRevision: sequence.optional(),
|
|
333
|
-
intent:
|
|
334
|
-
|
|
335
|
-
kind:
|
|
336
|
-
sessionId:
|
|
519
|
+
intent: z3.discriminatedUnion("kind", [
|
|
520
|
+
z3.strictObject({
|
|
521
|
+
kind: z3.literal("start"),
|
|
522
|
+
sessionId: id2,
|
|
337
523
|
/**
|
|
338
524
|
* Absent: the Hub resolves the Runner member-first (root ADR-0005): the Session's conversation Runner, else
|
|
339
525
|
* the starting member's own ready Personal Runner, else the Team default, else the start is refused.
|
|
340
526
|
*/
|
|
341
|
-
runnerId:
|
|
342
|
-
computeProfileId:
|
|
527
|
+
runnerId: id2.optional(),
|
|
528
|
+
computeProfileId: id2.optional(),
|
|
343
529
|
scope: scopeSchema,
|
|
344
530
|
spec: runSpecSchema,
|
|
345
531
|
key: runKeySchema.optional(),
|
|
@@ -348,167 +534,167 @@ var commandSchema = z2.strictObject({
|
|
|
348
534
|
/** Delegated starts only, and required on them. */
|
|
349
535
|
parent: runParentIntentSchema.optional()
|
|
350
536
|
}),
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
kind:
|
|
356
|
-
interruptionId:
|
|
537
|
+
z3.strictObject({ kind: z3.literal("cancel") }),
|
|
538
|
+
z3.strictObject({ kind: z3.literal("abandon") }),
|
|
539
|
+
z3.strictObject({ kind: z3.literal("steer"), text: z3.string().min(1).max(131072) }),
|
|
540
|
+
z3.strictObject({
|
|
541
|
+
kind: z3.literal("answer"),
|
|
542
|
+
interruptionId: id2,
|
|
357
543
|
expectedInterruptionRevision: positive,
|
|
358
|
-
requestId:
|
|
359
|
-
answer:
|
|
544
|
+
requestId: id2.optional(),
|
|
545
|
+
answer: z3.json()
|
|
360
546
|
}),
|
|
361
|
-
|
|
362
|
-
kind:
|
|
363
|
-
interruptionId:
|
|
364
|
-
guidance:
|
|
547
|
+
z3.strictObject({
|
|
548
|
+
kind: z3.literal("resume"),
|
|
549
|
+
interruptionId: id2,
|
|
550
|
+
guidance: z3.string().max(131072).optional()
|
|
365
551
|
}),
|
|
366
552
|
/**
|
|
367
553
|
* A member rewrites an Orchestrator's `delegation.tokenBudget` (root ADR-0011), never below what its children
|
|
368
554
|
* used. With `resume`, a parked Orchestrator with no live child is resumed when the value is strictly greater.
|
|
369
555
|
* Hub-only: never delivered to a Runner.
|
|
370
556
|
*/
|
|
371
|
-
|
|
372
|
-
kind:
|
|
557
|
+
z3.strictObject({
|
|
558
|
+
kind: z3.literal("setBudget"),
|
|
373
559
|
tokenBudget: delegationSchema.shape.tokenBudget,
|
|
374
|
-
resume:
|
|
560
|
+
resume: z3.boolean().optional()
|
|
375
561
|
})
|
|
376
562
|
])
|
|
377
563
|
});
|
|
378
|
-
var deliveredCommandSchema = commandSchema.extend({ orchestratorRunId:
|
|
379
|
-
var grantSchema =
|
|
380
|
-
commandId:
|
|
381
|
-
hubEpoch:
|
|
382
|
-
runId:
|
|
383
|
-
sessionId:
|
|
384
|
-
runnerId:
|
|
385
|
-
installationId:
|
|
386
|
-
attemptId:
|
|
564
|
+
var deliveredCommandSchema = commandSchema.extend({ orchestratorRunId: id2.optional() });
|
|
565
|
+
var grantSchema = z3.strictObject({
|
|
566
|
+
commandId: id2,
|
|
567
|
+
hubEpoch: id2,
|
|
568
|
+
runId: id2,
|
|
569
|
+
sessionId: id2,
|
|
570
|
+
runnerId: id2,
|
|
571
|
+
installationId: id2,
|
|
572
|
+
attemptId: id2,
|
|
387
573
|
generation: positive,
|
|
388
574
|
baseExecutionRevision: sequence,
|
|
389
575
|
baseHistorySeq: sequence,
|
|
390
576
|
cloudHistoryThrough: sequence,
|
|
391
|
-
purpose:
|
|
577
|
+
purpose: z3.enum(["start", "resume"]),
|
|
392
578
|
spec: runSpecSchema,
|
|
393
|
-
continuation:
|
|
579
|
+
continuation: z3.json().optional(),
|
|
394
580
|
/** Authenticated source of a delegated continuation; absence retains member semantics. */
|
|
395
|
-
orchestratorRunId:
|
|
581
|
+
orchestratorRunId: id2.optional(),
|
|
396
582
|
/** A new Run in a durable conversation; never resumes the predecessor's lifecycle. */
|
|
397
|
-
previousRun:
|
|
398
|
-
runId:
|
|
583
|
+
previousRun: z3.strictObject({
|
|
584
|
+
runId: id2,
|
|
399
585
|
executionRevision: sequence,
|
|
400
586
|
historyProduced: sequence,
|
|
401
587
|
/** Hub-confirmed administrative closure; allows an exact parked predecessor snapshot. */
|
|
402
|
-
closeReason:
|
|
403
|
-
checkpoint:
|
|
588
|
+
closeReason: z3.literal("abandoned").optional(),
|
|
589
|
+
checkpoint: z3.strictObject({ checkpointId: id2, checksum: z3.string().regex(/^[a-f0-9]{64}$/) }).optional()
|
|
404
590
|
}).optional(),
|
|
405
|
-
checkpoint:
|
|
591
|
+
checkpoint: z3.strictObject({ checkpointId: id2, checksum: z3.string().regex(/^[a-f0-9]{64}$/) }).optional(),
|
|
406
592
|
/** This attempt's delegation token: only for a Run started with `delegation`, only to a `run_delegation_v1` Runner. */
|
|
407
|
-
delegationToken:
|
|
593
|
+
delegationToken: z3.string().min(32).max(256).optional(),
|
|
408
594
|
/** Copied from the start intent of a delegated child. */
|
|
409
595
|
parent: runParentSchema.optional(),
|
|
410
596
|
/** The runner reports this attempt's usage: set only for a `run_usage_v1` Runner. */
|
|
411
|
-
reportUsage:
|
|
597
|
+
reportUsage: z3.literal(true).optional()
|
|
412
598
|
});
|
|
413
|
-
var historyRecordSchema =
|
|
414
|
-
eventId:
|
|
415
|
-
attemptId:
|
|
599
|
+
var historyRecordSchema = z3.strictObject({
|
|
600
|
+
eventId: id2,
|
|
601
|
+
attemptId: id2,
|
|
416
602
|
emittedAt: timestamp,
|
|
417
|
-
kind:
|
|
418
|
-
data:
|
|
419
|
-
});
|
|
420
|
-
var runnerFrameSchema =
|
|
421
|
-
|
|
422
|
-
type:
|
|
423
|
-
role:
|
|
424
|
-
protocol:
|
|
425
|
-
runnerId:
|
|
426
|
-
installationId:
|
|
427
|
-
softwareVersion:
|
|
428
|
-
capabilities:
|
|
603
|
+
kind: z3.string().min(1).max(128),
|
|
604
|
+
data: z3.json()
|
|
605
|
+
});
|
|
606
|
+
var runnerFrameSchema = z3.discriminatedUnion("type", [
|
|
607
|
+
z3.strictObject({
|
|
608
|
+
type: z3.literal("hello"),
|
|
609
|
+
role: z3.literal("runner"),
|
|
610
|
+
protocol: z3.strictObject({ major: z3.literal(2), minor: sequence }),
|
|
611
|
+
runnerId: id2,
|
|
612
|
+
installationId: id2,
|
|
613
|
+
softwareVersion: z3.string().max(128),
|
|
614
|
+
capabilities: z3.array(z3.string().max(128)).max(64),
|
|
429
615
|
/** Absent from older runners: the Hub treats the inventory as unknown, never as empty. */
|
|
430
616
|
workflows: installedWorkflowsSchema.optional(),
|
|
431
617
|
/** Absent from older runners, and from a runner that has not finished its first check: unknown, not "not ready". */
|
|
432
618
|
readiness: runnerReadinessSchema.optional(),
|
|
433
|
-
control:
|
|
619
|
+
control: z3.strictObject({ firstRetainedSeq: positive, lastProducedSeq: sequence })
|
|
434
620
|
}),
|
|
435
|
-
|
|
436
|
-
type:
|
|
621
|
+
z3.strictObject({
|
|
622
|
+
type: z3.literal("control.batch"),
|
|
437
623
|
firstSeq: positive,
|
|
438
|
-
records:
|
|
624
|
+
records: z3.array(controlRecordSchema).min(1).max(128)
|
|
439
625
|
}),
|
|
440
|
-
|
|
441
|
-
type:
|
|
442
|
-
runId:
|
|
626
|
+
z3.strictObject({
|
|
627
|
+
type: z3.literal("history.batch"),
|
|
628
|
+
runId: id2,
|
|
443
629
|
firstSeq: positive,
|
|
444
|
-
records:
|
|
630
|
+
records: z3.array(historyRecordSchema).min(1).max(128)
|
|
445
631
|
}),
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
type:
|
|
449
|
-
inventoryId:
|
|
632
|
+
z3.strictObject({ type: z3.literal("ping"), nonce: id2 }),
|
|
633
|
+
z3.strictObject({
|
|
634
|
+
type: z3.literal("reconcile.page"),
|
|
635
|
+
inventoryId: id2.default("single-page"),
|
|
450
636
|
page: sequence.default(0),
|
|
451
|
-
complete:
|
|
452
|
-
runs:
|
|
453
|
-
|
|
454
|
-
runId:
|
|
455
|
-
attemptId:
|
|
637
|
+
complete: z3.boolean(),
|
|
638
|
+
runs: z3.array(
|
|
639
|
+
z3.strictObject({
|
|
640
|
+
runId: id2,
|
|
641
|
+
attemptId: id2,
|
|
456
642
|
executionRevision: sequence,
|
|
457
|
-
phase:
|
|
643
|
+
phase: z3.enum(["admitted", "prepared", "executing", "parked", "terminal", "recovery"])
|
|
458
644
|
})
|
|
459
645
|
).max(128)
|
|
460
646
|
})
|
|
461
647
|
]);
|
|
462
|
-
var runViewSchema =
|
|
463
|
-
runId:
|
|
464
|
-
sessionId:
|
|
465
|
-
runnerId:
|
|
466
|
-
computeProfileId:
|
|
648
|
+
var runViewSchema = z3.object({
|
|
649
|
+
runId: id2,
|
|
650
|
+
sessionId: id2,
|
|
651
|
+
runnerId: id2,
|
|
652
|
+
computeProfileId: id2.optional(),
|
|
467
653
|
scope: scopeSchema,
|
|
468
654
|
recordRevision: positive,
|
|
469
|
-
label:
|
|
655
|
+
label: z3.string().max(160).optional(),
|
|
470
656
|
key: runKeySchema.optional(),
|
|
471
657
|
parent: runParentSchema.optional(),
|
|
472
658
|
/**
|
|
473
659
|
* Not strict, unlike the start intent's: a Hub keeps more on the Run's delegation (`initialTokenBudget`) than it
|
|
474
660
|
* shows, and a client never refuses a view for a field it does not read.
|
|
475
661
|
*/
|
|
476
|
-
delegation:
|
|
662
|
+
delegation: z3.object({
|
|
477
663
|
...delegationSchema.shape,
|
|
478
664
|
// A resolved Runner default may exceed the explicit settings ceiling on configured Runners.
|
|
479
|
-
maxChildren:
|
|
665
|
+
maxChildren: z3.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional()
|
|
480
666
|
}).optional(),
|
|
481
667
|
/** The largest cumulative usage the Run's Runner reported; absent until one does (an older Runner never does). */
|
|
482
668
|
usage: runUsageSchema.optional(),
|
|
483
669
|
/** Resolved by the runner at start; absent until the Run starts and for runners that predate reporting. */
|
|
484
670
|
workflow: workflowIdentitySchema.optional(),
|
|
485
|
-
execution:
|
|
486
|
-
status:
|
|
671
|
+
execution: z3.object({
|
|
672
|
+
status: z3.enum(["running", "awaiting_attention", "completed", "failed", "cancelled"]),
|
|
487
673
|
revision: positive,
|
|
488
|
-
attemptId:
|
|
489
|
-
occupancy:
|
|
674
|
+
attemptId: id2,
|
|
675
|
+
occupancy: z3.enum(["held", "released"]),
|
|
490
676
|
startedAt: timestamp.optional(),
|
|
491
677
|
endedAt: timestamp.optional(),
|
|
492
678
|
interruption: interruptionSchema.optional()
|
|
493
679
|
}).nullable(),
|
|
494
|
-
scheduling:
|
|
495
|
-
closed:
|
|
496
|
-
closeReason:
|
|
497
|
-
cancellation:
|
|
680
|
+
scheduling: z3.enum(["queued", "dispatching", "admitted", "idle"]),
|
|
681
|
+
closed: z3.boolean(),
|
|
682
|
+
closeReason: z3.string().optional(),
|
|
683
|
+
cancellation: id2.optional(),
|
|
498
684
|
pendingResume: commandSchema.shape.intent.optional(),
|
|
499
685
|
/** Derived per viewer; absent on older Hubs. Never grants execution authority. */
|
|
500
|
-
runnerStopped:
|
|
501
|
-
canAbandon:
|
|
686
|
+
runnerStopped: z3.boolean().optional(),
|
|
687
|
+
canAbandon: z3.boolean().optional(),
|
|
502
688
|
historyThrough: sequence,
|
|
503
689
|
expectedHistoryThrough: sequence.optional(),
|
|
504
690
|
createdAt: sequence,
|
|
505
|
-
checkpoint:
|
|
691
|
+
checkpoint: z3.object({ id: id2, state: z3.enum(["pending", "ready"]), checksum: z3.string().optional() }).optional()
|
|
506
692
|
});
|
|
507
|
-
var clientFrameSchema =
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
693
|
+
var clientFrameSchema = z3.discriminatedUnion("type", [
|
|
694
|
+
z3.strictObject({ type: z3.literal("watch"), hubEpoch: id2, runIds: z3.array(id2).max(100) }),
|
|
695
|
+
z3.strictObject({ type: z3.literal("watch.ack"), subscriptionId: id2, through: sequence }),
|
|
696
|
+
z3.strictObject({ type: z3.literal("command.submit"), command: commandSchema }),
|
|
697
|
+
z3.strictObject({ type: z3.literal("ping"), nonce: id2 })
|
|
512
698
|
]);
|
|
513
699
|
function canonicalJson(value) {
|
|
514
700
|
if (value === null || typeof value !== "object") {
|
|
@@ -519,76 +705,76 @@ function canonicalJson(value) {
|
|
|
519
705
|
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
520
706
|
return `{${Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
521
707
|
}
|
|
522
|
-
var checkpointPathSchema =
|
|
708
|
+
var checkpointPathSchema = z3.string().min(1).max(4096).refine(
|
|
523
709
|
(path) => !path.startsWith("/") && !path.includes("\\") && path.split("/").every((part) => part !== "" && part !== "." && part !== ".." && part !== ".git")
|
|
524
710
|
);
|
|
525
|
-
var checkpointSchema =
|
|
526
|
-
version:
|
|
527
|
-
checkpointId:
|
|
528
|
-
orgId:
|
|
529
|
-
phase:
|
|
530
|
-
runId:
|
|
531
|
-
sessionId:
|
|
532
|
-
sourceAttemptId:
|
|
533
|
-
executionRevision:
|
|
534
|
-
historyProduced:
|
|
535
|
-
historyAck:
|
|
711
|
+
var checkpointSchema = z3.strictObject({
|
|
712
|
+
version: z3.literal(1),
|
|
713
|
+
checkpointId: z3.string().min(1),
|
|
714
|
+
orgId: z3.string().min(1),
|
|
715
|
+
phase: z3.enum(["parked", "terminal"]),
|
|
716
|
+
runId: z3.string().min(1),
|
|
717
|
+
sessionId: z3.string().min(1),
|
|
718
|
+
sourceAttemptId: z3.string().min(1),
|
|
719
|
+
executionRevision: z3.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
720
|
+
historyProduced: z3.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
721
|
+
historyAck: z3.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
536
722
|
grant: grantSchema,
|
|
537
|
-
gitHead:
|
|
538
|
-
gitBase:
|
|
539
|
-
gitBundle:
|
|
540
|
-
indexPatch:
|
|
541
|
-
files:
|
|
542
|
-
|
|
723
|
+
gitHead: z3.string().regex(/^[0-9a-f]{40,64}$/),
|
|
724
|
+
gitBase: z3.string().regex(/^[0-9a-f]{40,64}$/).optional(),
|
|
725
|
+
gitBundle: z3.string(),
|
|
726
|
+
indexPatch: z3.string(),
|
|
727
|
+
files: z3.array(
|
|
728
|
+
z3.strictObject({ path: checkpointPathSchema, content: z3.string(), executable: z3.boolean() })
|
|
543
729
|
).max(1e5),
|
|
544
|
-
deleted:
|
|
545
|
-
sessionRows:
|
|
546
|
-
history:
|
|
547
|
-
|
|
730
|
+
deleted: z3.array(checkpointPathSchema).max(1e5),
|
|
731
|
+
sessionRows: z3.array(z3.strictObject({ kind: z3.string(), id: z3.string(), payload: z3.string() })),
|
|
732
|
+
history: z3.array(
|
|
733
|
+
z3.strictObject({ seq: z3.number().int().positive(), record: historyRecordSchema })
|
|
548
734
|
)
|
|
549
735
|
});
|
|
550
736
|
var connectCodeAlphabet = "ABCDEFGHJKMNPQRSTUVWXYZ23456789";
|
|
551
|
-
var connectCodeSchema =
|
|
552
|
-
var connectCodeRequestSchema =
|
|
553
|
-
var connectCodeResponseSchema =
|
|
737
|
+
var connectCodeSchema = z3.string().regex(/^[A-HJKMNP-Z2-9]{8}$/);
|
|
738
|
+
var connectCodeRequestSchema = z3.strictObject({ hubEpoch: z3.string() });
|
|
739
|
+
var connectCodeResponseSchema = z3.strictObject({
|
|
554
740
|
code: connectCodeSchema,
|
|
555
741
|
expiresAt: sequence
|
|
556
742
|
});
|
|
557
|
-
var connectRedeemRequestSchema =
|
|
558
|
-
code:
|
|
559
|
-
installationId:
|
|
560
|
-
hostname:
|
|
561
|
-
os:
|
|
562
|
-
softwareVersion:
|
|
563
|
-
});
|
|
564
|
-
var connectRedeemResponseSchema =
|
|
565
|
-
orgId:
|
|
566
|
-
hubEpoch:
|
|
567
|
-
runnerId:
|
|
568
|
-
installationId:
|
|
569
|
-
name:
|
|
570
|
-
token:
|
|
571
|
-
credentialId:
|
|
743
|
+
var connectRedeemRequestSchema = z3.strictObject({
|
|
744
|
+
code: z3.string().min(8).max(16),
|
|
745
|
+
installationId: id2,
|
|
746
|
+
hostname: z3.string().min(1).max(255),
|
|
747
|
+
os: z3.string().min(1).max(64),
|
|
748
|
+
softwareVersion: z3.string().min(1).max(128)
|
|
749
|
+
});
|
|
750
|
+
var connectRedeemResponseSchema = z3.strictObject({
|
|
751
|
+
orgId: id2,
|
|
752
|
+
hubEpoch: z3.string(),
|
|
753
|
+
runnerId: id2,
|
|
754
|
+
installationId: id2,
|
|
755
|
+
name: z3.string(),
|
|
756
|
+
token: z3.string().min(32),
|
|
757
|
+
credentialId: id2,
|
|
572
758
|
expiresAt: sequence
|
|
573
759
|
});
|
|
574
|
-
var connectAlreadyConnectedSchema =
|
|
575
|
-
error:
|
|
576
|
-
orgId:
|
|
577
|
-
runnerId:
|
|
578
|
-
name:
|
|
760
|
+
var connectAlreadyConnectedSchema = z3.strictObject({
|
|
761
|
+
error: z3.literal("runner_already_connected"),
|
|
762
|
+
orgId: id2,
|
|
763
|
+
runnerId: id2,
|
|
764
|
+
name: z3.string()
|
|
579
765
|
});
|
|
580
|
-
var audienceSchema =
|
|
581
|
-
var runnerListEntrySchema =
|
|
582
|
-
id,
|
|
583
|
-
online:
|
|
584
|
-
capacity:
|
|
585
|
-
managed:
|
|
586
|
-
draining:
|
|
587
|
-
stopped:
|
|
588
|
-
name:
|
|
589
|
-
connectedBy:
|
|
766
|
+
var audienceSchema = z3.enum(["personal", "team"]);
|
|
767
|
+
var runnerListEntrySchema = z3.object({
|
|
768
|
+
id: id2,
|
|
769
|
+
online: z3.number(),
|
|
770
|
+
capacity: z3.number(),
|
|
771
|
+
managed: z3.number(),
|
|
772
|
+
draining: z3.number(),
|
|
773
|
+
stopped: z3.number(),
|
|
774
|
+
name: z3.string().nullable(),
|
|
775
|
+
connectedBy: z3.string().nullable(),
|
|
590
776
|
audience: audienceSchema.nullable(),
|
|
591
|
-
softwareVersion:
|
|
777
|
+
softwareVersion: z3.string().nullable(),
|
|
592
778
|
/** Milliseconds since the epoch of the last hello or disconnect; null before the first connection. */
|
|
593
779
|
lastSeen: sequence.nullable(),
|
|
594
780
|
/** Absent when the runner has not reported an inventory: unknown, not none. */
|
|
@@ -598,108 +784,108 @@ var runnerListEntrySchema = z2.object({
|
|
|
598
784
|
* Runner seen by an admin (who may still Disconnect it), or a Runner a member did not connect. Absent from Hubs
|
|
599
785
|
* older than Audience, like the list's `viewer`, `teamDefault` and `runsGoTo`.
|
|
600
786
|
*/
|
|
601
|
-
readOnly:
|
|
787
|
+
readOnly: z3.boolean().optional(),
|
|
602
788
|
/** What the Runner last reported; absent when it never has (an older runner, or one not yet connected). */
|
|
603
789
|
readiness: runnerReadinessSchema.optional(),
|
|
604
790
|
/**
|
|
605
791
|
* True when the Runner reported a version below the Hub's minimum: it is listed as "Update required" and takes no
|
|
606
792
|
* Runs until it is updated (`runnerUpdateCommand`). Absent from Hubs older than Readiness.
|
|
607
793
|
*/
|
|
608
|
-
updateRequired:
|
|
794
|
+
updateRequired: z3.boolean().optional(),
|
|
609
795
|
/**
|
|
610
796
|
* True while it is paused as "Needs an owner": the member who connected this Team Runner left the Team, so it
|
|
611
797
|
* takes no Runs until an admin adopts it (`/runners/{id}/adopt`) or Disconnects it. Absent from older Hubs.
|
|
612
798
|
*/
|
|
613
|
-
needsOwner:
|
|
799
|
+
needsOwner: z3.boolean().optional()
|
|
614
800
|
});
|
|
615
|
-
var teamDefaultSchema =
|
|
616
|
-
|
|
617
|
-
|
|
801
|
+
var teamDefaultSchema = z3.discriminatedUnion("kind", [
|
|
802
|
+
z3.strictObject({ kind: z3.literal("runner"), runnerId: id2 }),
|
|
803
|
+
z3.strictObject({ kind: z3.literal("profile"), profileId: id2 })
|
|
618
804
|
]);
|
|
619
|
-
var teamDefaultRequestSchema =
|
|
620
|
-
hubEpoch:
|
|
805
|
+
var teamDefaultRequestSchema = z3.strictObject({
|
|
806
|
+
hubEpoch: z3.string(),
|
|
621
807
|
teamDefault: teamDefaultSchema.nullable()
|
|
622
808
|
});
|
|
623
|
-
var runnerUpdateRequestSchema =
|
|
624
|
-
hubEpoch:
|
|
625
|
-
name:
|
|
626
|
-
capacity:
|
|
809
|
+
var runnerUpdateRequestSchema = z3.strictObject({
|
|
810
|
+
hubEpoch: z3.string(),
|
|
811
|
+
name: z3.string().max(100).optional(),
|
|
812
|
+
capacity: z3.number().int().min(1).max(64).optional(),
|
|
627
813
|
audience: audienceSchema.optional()
|
|
628
814
|
}).refine(
|
|
629
815
|
(update) => update.name !== void 0 || update.capacity !== void 0 || update.audience !== void 0,
|
|
630
816
|
{ message: "nothing to update" }
|
|
631
817
|
);
|
|
632
|
-
var runsGoToSchema =
|
|
818
|
+
var runsGoToSchema = z3.union([
|
|
633
819
|
/** The viewer's own Runner: Personal, or one they connected that was widened to Team (DRI-42). */
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
820
|
+
z3.strictObject({ via: z3.literal("personal"), runnerId: id2 }),
|
|
821
|
+
z3.strictObject({ via: z3.literal("team_default"), runnerId: id2 }),
|
|
822
|
+
z3.strictObject({ via: z3.literal("team_default"), profileId: id2 }),
|
|
637
823
|
/** `runner_needs_owner`: the Team default is a Runner paused because the member who connected it left. */
|
|
638
|
-
|
|
824
|
+
z3.strictObject({ via: z3.literal("none"), reason: z3.enum(["no_runner_available", "runner_needs_owner"]) })
|
|
639
825
|
]);
|
|
640
|
-
var runnerListSchema =
|
|
641
|
-
capabilities:
|
|
642
|
-
historyRetentionDays:
|
|
826
|
+
var runnerListSchema = z3.object({
|
|
827
|
+
capabilities: z3.record(z3.string(), z3.boolean()).optional(),
|
|
828
|
+
historyRetentionDays: z3.number().int().positive().nullable().optional(),
|
|
643
829
|
/** Who the list was filtered for: a member sees their own and Team Runners, an admin every Runner. */
|
|
644
|
-
viewer:
|
|
830
|
+
viewer: z3.object({ userId: z3.string(), admin: z3.boolean() }).optional(),
|
|
645
831
|
teamDefault: teamDefaultSchema.nullable().optional(),
|
|
646
832
|
runsGoTo: runsGoToSchema.optional(),
|
|
647
833
|
/** The lowest Runner version this Hub sends Runs to. Absent from Hubs older than Readiness. */
|
|
648
|
-
minimumRunnerVersion:
|
|
649
|
-
runners:
|
|
650
|
-
profiles:
|
|
651
|
-
id:
|
|
652
|
-
label:
|
|
653
|
-
projectDir:
|
|
654
|
-
repositoryRequired:
|
|
834
|
+
minimumRunnerVersion: z3.string().optional(),
|
|
835
|
+
runners: z3.array(runnerListEntrySchema),
|
|
836
|
+
profiles: z3.array(z3.object({
|
|
837
|
+
id: z3.string(),
|
|
838
|
+
label: z3.string(),
|
|
839
|
+
projectDir: z3.string(),
|
|
840
|
+
repositoryRequired: z3.boolean().optional(),
|
|
655
841
|
/** Marketplace refs baked into the profile's image; absent when the profile declares none. */
|
|
656
|
-
workflows:
|
|
657
|
-
workflowSources:
|
|
842
|
+
workflows: z3.array(z3.string()).optional(),
|
|
843
|
+
workflowSources: z3.array(z3.string()).optional()
|
|
658
844
|
}))
|
|
659
845
|
});
|
|
660
|
-
var runnerDisconnectRequestSchema =
|
|
846
|
+
var runnerDisconnectRequestSchema = z3.strictObject({ hubEpoch: z3.string() });
|
|
661
847
|
var hubEpochRequestSchema = runnerDisconnectRequestSchema;
|
|
662
|
-
var runnerDisconnectPreviewSchema =
|
|
663
|
-
runnerId:
|
|
664
|
-
name:
|
|
665
|
-
runs:
|
|
666
|
-
runId:
|
|
667
|
-
label:
|
|
848
|
+
var runnerDisconnectPreviewSchema = z3.object({
|
|
849
|
+
runnerId: id2,
|
|
850
|
+
name: z3.string().nullable(),
|
|
851
|
+
runs: z3.array(z3.object({
|
|
852
|
+
runId: id2,
|
|
853
|
+
label: z3.string().optional(),
|
|
668
854
|
/** Working: executing now. Parked: waiting for a person, Runner released. Queued: not started yet. */
|
|
669
|
-
state:
|
|
855
|
+
state: z3.enum(["working", "parked", "queued"])
|
|
670
856
|
})),
|
|
671
|
-
hiddenRuns:
|
|
857
|
+
hiddenRuns: z3.number().int().nonnegative()
|
|
672
858
|
});
|
|
673
|
-
var runnerDisconnectResponseSchema =
|
|
674
|
-
disconnected:
|
|
859
|
+
var runnerDisconnectResponseSchema = z3.object({
|
|
860
|
+
disconnected: z3.literal(true),
|
|
675
861
|
/** How many Runs were Stopped with the reason `runner_disconnected`. */
|
|
676
|
-
stoppedRuns:
|
|
862
|
+
stoppedRuns: z3.number().int().nonnegative()
|
|
677
863
|
});
|
|
678
864
|
var runnerAdoptRequestSchema = hubEpochRequestSchema;
|
|
679
865
|
var connectStartRequestSchema = connectRedeemRequestSchema.omit({ code: true });
|
|
680
|
-
var connectStartResponseSchema =
|
|
866
|
+
var connectStartResponseSchema = z3.strictObject({
|
|
681
867
|
/** The machine's secret for polling; never shown. */
|
|
682
|
-
deviceCode:
|
|
868
|
+
deviceCode: z3.string().min(32).max(160),
|
|
683
869
|
code: connectCodeSchema,
|
|
684
870
|
expiresAt: sequence,
|
|
685
|
-
intervalSec:
|
|
871
|
+
intervalSec: z3.number().int().positive(),
|
|
686
872
|
/** The web console page that approves `code`. */
|
|
687
|
-
verificationUrl:
|
|
873
|
+
verificationUrl: z3.string().url()
|
|
688
874
|
});
|
|
689
|
-
var connectPollRequestSchema =
|
|
690
|
-
var connectPendingResponseSchema =
|
|
691
|
-
hostname:
|
|
692
|
-
os:
|
|
693
|
-
softwareVersion:
|
|
875
|
+
var connectPollRequestSchema = z3.strictObject({ deviceCode: z3.string().min(32).max(160) });
|
|
876
|
+
var connectPendingResponseSchema = z3.strictObject({
|
|
877
|
+
hostname: z3.string(),
|
|
878
|
+
os: z3.string(),
|
|
879
|
+
softwareVersion: z3.string(),
|
|
694
880
|
requestedAt: sequence,
|
|
695
881
|
expiresAt: sequence
|
|
696
882
|
});
|
|
697
|
-
var connectApproveRequestSchema =
|
|
698
|
-
code:
|
|
883
|
+
var connectApproveRequestSchema = z3.strictObject({
|
|
884
|
+
code: z3.string().min(8).max(16),
|
|
699
885
|
audience: audienceSchema,
|
|
700
|
-
hubEpoch:
|
|
886
|
+
hubEpoch: z3.string().optional()
|
|
701
887
|
});
|
|
702
|
-
var connectDenyRequestSchema =
|
|
888
|
+
var connectDenyRequestSchema = z3.strictObject({ code: z3.string().min(8).max(16) });
|
|
703
889
|
export {
|
|
704
890
|
CALIBRATION_MIN_RUNS,
|
|
705
891
|
CALIBRATION_WINDOW_DAYS,
|
|
@@ -734,9 +920,14 @@ export {
|
|
|
734
920
|
connectStartResponseSchema,
|
|
735
921
|
controlRecordSchema,
|
|
736
922
|
conversationContinuationCapability,
|
|
923
|
+
defaultDeliveryWorkflow,
|
|
737
924
|
delegationSchema,
|
|
738
925
|
delegationTokenPrefix,
|
|
739
926
|
deliveredCommandSchema,
|
|
927
|
+
deliveryEvidenceKindSchema,
|
|
928
|
+
deliveryStageSchema,
|
|
929
|
+
deliveryTransitionSchema,
|
|
930
|
+
deliveryWorkflowSchema,
|
|
740
931
|
forecastOfCap,
|
|
741
932
|
forecastOfClass,
|
|
742
933
|
grantSchema,
|
|
@@ -785,6 +976,15 @@ export {
|
|
|
785
976
|
sequence,
|
|
786
977
|
teamDefaultRequestSchema,
|
|
787
978
|
teamDefaultSchema,
|
|
979
|
+
trackerCommentSchema,
|
|
980
|
+
trackerEvidenceSchema,
|
|
981
|
+
trackerImportPreviewSchema,
|
|
982
|
+
trackerImportSchema,
|
|
983
|
+
trackerIssueSchema,
|
|
984
|
+
trackerOperationSchema,
|
|
985
|
+
trackerPlanSchema,
|
|
986
|
+
trackerSnapshotSchema,
|
|
987
|
+
trackerSourceSchema,
|
|
788
988
|
workflowIdentitySchema,
|
|
789
989
|
workflowInstallCapability,
|
|
790
990
|
workflowName,
|