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