@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.
Files changed (3) hide show
  1. package/dist/v2.d.ts +597 -1
  2. package/dist/v2.js +511 -311
  3. 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 z2 } from "zod";
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 = z2.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
309
+ var runArtifactNameSchema = z3.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
124
310
  var runArtifactMaxBytes = 64 * 1024;
125
- var secretEnvironmentSchema = z2.record(
126
- 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_]+)$/),
127
- 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]+)$/)
128
314
  );
129
- var permissionAnswerSchema = z2.strictObject({
130
- kind: z2.literal("permission"),
131
- decision: z2.enum(["allow", "deny"]),
132
- 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()
133
319
  });
134
- var id = z2.string().min(1).max(160);
135
- 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);
136
322
  var positive = sequence.refine((n) => n > 0);
137
- var timestamp = z2.iso.datetime();
138
- var scopeSchema = z2.discriminatedUnion("visibility", [
139
- z2.strictObject({ visibility: z2.literal("organization") }),
140
- 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 })
141
327
  ]);
142
- var installedWorkflowsSchema = z2.array(InstalledWorkflowSchema).max(256);
143
- var harnessSchema = z2.enum(["claude-code", "codex"]);
144
- var harnessReadinessSchema = z2.strictObject({ installed: z2.boolean(), signedIn: z2.boolean() });
145
- 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({
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 = z2.strictObject({
161
- interruptionId: id,
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: z2.enum(["permission", "question", "guidance", "recovery", "waiting"]),
165
- message: z2.string().max(16384),
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: z2.enum(["orchestrator"]).optional(),
168
- requestId: id.optional()
353
+ respondent: z3.enum(["orchestrator"]).optional(),
354
+ requestId: id2.optional()
169
355
  });
170
- var workflowIdentitySchema = z2.strictObject({
171
- name: z2.string().min(1).max(128),
172
- 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()
173
359
  });
174
- var buildCloseReasonSchema = z2.enum([
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 = z2.enum([
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: id,
199
- attemptId: id,
384
+ runId: id2,
385
+ attemptId: id2,
200
386
  executionRevision: positive,
201
387
  emittedAt: timestamp
202
388
  };
203
- var runUsageSchema = z2.strictObject({ counted: sequence, cacheRead: sequence });
389
+ var runUsageSchema = z3.strictObject({ counted: sequence, cacheRead: sequence });
204
390
  var reportedUsage = { usage: runUsageSchema.optional() };
205
- var controlRecordSchema = z2.discriminatedUnion("kind", [
391
+ var controlRecordSchema = z3.discriminatedUnion("kind", [
206
392
  /** Instance-scoped, not tied to a Run: the full replacement inventory of installed Workflows. */
207
- z2.strictObject({ kind: z2.literal("workflows.changed"), workflows: installedWorkflowsSchema }),
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
- z2.strictObject({ kind: z2.literal("readiness.changed"), readiness: runnerReadinessSchema }),
210
- z2.strictObject({ kind: z2.literal("assignment.accepted"), runId: id, attemptId: id }),
211
- z2.strictObject({
212
- kind: z2.literal("assignment.rejected"),
213
- runId: id,
214
- attemptId: id,
215
- 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)
216
402
  }),
217
- z2.strictObject({
218
- kind: z2.literal("run.started"),
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
- z2.strictObject({ kind: z2.literal("run.resumed"), ...factIdentity }),
224
- z2.strictObject({
225
- kind: z2.literal("run.attention"),
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: z2.enum(["held", "released"]),
414
+ occupancy: z3.enum(["held", "released"]),
229
415
  historyThrough: sequence,
230
- continuation: z2.discriminatedUnion("kind", [
231
- z2.strictObject({ kind: z2.literal("live_request") }),
232
- z2.strictObject({ kind: z2.literal("local_checkpoint"), checkpointId: id }),
233
- z2.strictObject({ kind: z2.literal("portable_checkpoint"), checkpointId: id }),
234
- 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) })
235
421
  ]),
236
422
  ...reportedUsage
237
423
  }),
238
- z2.strictObject({
239
- kind: z2.literal("run.finished"),
424
+ z3.strictObject({
425
+ kind: z3.literal("run.finished"),
240
426
  ...factIdentity,
241
- status: z2.enum(["completed", "failed", "cancelled"]),
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: z2.literal(true).optional(),
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
- z2.strictObject({ kind: z2.literal("run.usage"), runId: id, attemptId: id, ...runUsageSchema.shape }),
257
- z2.strictObject({ kind: z2.literal("command.applied"), runId: id, attemptId: id, commandId: id }),
258
- z2.strictObject({
259
- kind: z2.literal("command.rejected"),
260
- runId: id,
261
- attemptId: id,
262
- commandId: id,
263
- 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)
264
450
  }),
265
- 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 })
266
452
  ]);
267
- var repositoryRefSchema = z2.string().min(1).max(512).regex(
453
+ var repositoryRefSchema = z3.string().min(1).max(512).regex(
268
454
  /^(?![-/])(?!.*\.\.)(?!.*@\{)(?!.*(?:^|\/)\.)(?!.*\.lock(?:\/|$))(?!.*\/\/)[^\x00-\x20\x7f~^:?*\[\\]+(?<![/.])$/
269
455
  );
270
- var repositoryWorkingDirectorySchema = z2.string().min(1).max(1024).regex(
456
+ var repositoryWorkingDirectorySchema = z3.string().min(1).max(1024).regex(
271
457
  /^(?:\.|(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))(?!.*(?:^|\/)\.git(?:\/|$))[^\x00-\x1f\x7f\\:]+(?<!\/))$/
272
458
  );
273
459
  var repositoryIdentity = {
274
- repositoryId: z2.number().int().positive().max(Number.MAX_SAFE_INTEGER),
275
- installationId: z2.number().int().positive().max(Number.MAX_SAFE_INTEGER),
276
- owner: z2.string().min(1).max(100).regex(/^[a-zA-Z0-9][a-zA-Z0-9-]*$/),
277
- 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_.-]+$/)
278
464
  };
279
- var repositoryBindingSchema = z2.strictObject({
280
- id,
281
- label: z2.string().min(1).max(160),
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: z2.array(z2.string().min(1).max(8192)).max(16),
471
+ setupCommands: z3.array(z3.string().min(1).max(8192)).max(16),
286
472
  revision: positive,
287
- enabled: z2.boolean()
473
+ enabled: z3.boolean()
288
474
  });
289
- var repositorySourceSchema = z2.strictObject({
290
- bindingId: id,
475
+ var repositorySourceSchema = z3.strictObject({
476
+ bindingId: id2,
291
477
  ...repositoryIdentity,
292
478
  ref: repositoryRefSchema,
293
- commitSha: z2.string().regex(/^[0-9a-f]{40}$/),
479
+ commitSha: z3.string().regex(/^[0-9a-f]{40}$/),
294
480
  branch: repositoryRefSchema,
295
481
  workingDirectory: repositoryWorkingDirectorySchema,
296
- setupCommands: z2.array(z2.string().min(1).max(8192)).max(16),
482
+ setupCommands: z3.array(z3.string().min(1).max(8192)).max(16),
297
483
  configRevision: positive
298
484
  });
299
- var workflowSourceSchema = z2.string().max(201).regex(/^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*$/);
300
- var workflowReferenceSchema = z2.union([
301
- z2.string().max(512),
302
- z2.strictObject({
303
- 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_-]*$/),
304
490
  source: workflowSourceSchema.optional(),
305
- ref: z2.string().min(1).max(512).optional(),
306
- 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()
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 = z2.strictObject({
313
- prompt: z2.string().min(1).max(131072),
314
- 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),
315
501
  harness: harnessSchema,
316
502
  workflow: workflowReferenceSchema.optional(),
317
503
  repository: repositorySourceSchema.optional()
318
504
  });
319
- var runKeySchema = z2.string().min(1).max(160);
320
- var delegationSchema = z2.strictObject({
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: z2.number().int().min(1).max(64).optional(),
323
- tokenBudget: z2.number().int().positive().max(Number.MAX_SAFE_INTEGER)
324
- });
325
- var tokenCapSchema = z2.number().int().positive().max(Number.MAX_SAFE_INTEGER);
326
- var runParentIntentSchema = z2.strictObject({ runId: id, tokenCap: tokenCapSchema.optional() });
327
- var runParentSchema = z2.strictObject({ runId: id, tokenCap: tokenCapSchema });
328
- var commandSchema = z2.strictObject({
329
- commandId: id,
330
- hubEpoch: id,
331
- runId: id,
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: z2.discriminatedUnion("kind", [
334
- z2.strictObject({
335
- kind: z2.literal("start"),
336
- sessionId: id,
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: id.optional(),
342
- computeProfileId: id.optional(),
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
- z2.strictObject({ kind: z2.literal("cancel") }),
352
- z2.strictObject({ kind: z2.literal("abandon") }),
353
- z2.strictObject({ kind: z2.literal("steer"), text: z2.string().min(1).max(131072) }),
354
- z2.strictObject({
355
- kind: z2.literal("answer"),
356
- 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,
357
543
  expectedInterruptionRevision: positive,
358
- requestId: id.optional(),
359
- answer: z2.json()
544
+ requestId: id2.optional(),
545
+ answer: z3.json()
360
546
  }),
361
- z2.strictObject({
362
- kind: z2.literal("resume"),
363
- interruptionId: id,
364
- guidance: z2.string().max(131072).optional()
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
- z2.strictObject({
372
- kind: z2.literal("setBudget"),
557
+ z3.strictObject({
558
+ kind: z3.literal("setBudget"),
373
559
  tokenBudget: delegationSchema.shape.tokenBudget,
374
- resume: z2.boolean().optional()
560
+ resume: z3.boolean().optional()
375
561
  })
376
562
  ])
377
563
  });
378
- var deliveredCommandSchema = commandSchema.extend({ orchestratorRunId: id.optional() });
379
- var grantSchema = z2.strictObject({
380
- commandId: id,
381
- hubEpoch: id,
382
- runId: id,
383
- sessionId: id,
384
- runnerId: id,
385
- installationId: id,
386
- 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,
387
573
  generation: positive,
388
574
  baseExecutionRevision: sequence,
389
575
  baseHistorySeq: sequence,
390
576
  cloudHistoryThrough: sequence,
391
- purpose: z2.enum(["start", "resume"]),
577
+ purpose: z3.enum(["start", "resume"]),
392
578
  spec: runSpecSchema,
393
- continuation: z2.json().optional(),
579
+ continuation: z3.json().optional(),
394
580
  /** Authenticated source of a delegated continuation; absence retains member semantics. */
395
- orchestratorRunId: id.optional(),
581
+ orchestratorRunId: id2.optional(),
396
582
  /** A new Run in a durable conversation; never resumes the predecessor's lifecycle. */
397
- previousRun: z2.strictObject({
398
- runId: id,
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: z2.literal("abandoned").optional(),
403
- 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()
404
590
  }).optional(),
405
- 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(),
406
592
  /** This attempt's delegation token: only for a Run started with `delegation`, only to a `run_delegation_v1` Runner. */
407
- delegationToken: z2.string().min(32).max(256).optional(),
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: z2.literal(true).optional()
597
+ reportUsage: z3.literal(true).optional()
412
598
  });
413
- var historyRecordSchema = z2.strictObject({
414
- eventId: id,
415
- attemptId: id,
599
+ var historyRecordSchema = z3.strictObject({
600
+ eventId: id2,
601
+ attemptId: id2,
416
602
  emittedAt: timestamp,
417
- kind: z2.string().min(1).max(128),
418
- data: z2.json()
419
- });
420
- var runnerFrameSchema = z2.discriminatedUnion("type", [
421
- z2.strictObject({
422
- type: z2.literal("hello"),
423
- role: z2.literal("runner"),
424
- protocol: z2.strictObject({ major: z2.literal(2), minor: sequence }),
425
- runnerId: id,
426
- installationId: id,
427
- softwareVersion: z2.string().max(128),
428
- 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),
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: z2.strictObject({ firstRetainedSeq: positive, lastProducedSeq: sequence })
619
+ control: z3.strictObject({ firstRetainedSeq: positive, lastProducedSeq: sequence })
434
620
  }),
435
- z2.strictObject({
436
- type: z2.literal("control.batch"),
621
+ z3.strictObject({
622
+ type: z3.literal("control.batch"),
437
623
  firstSeq: positive,
438
- records: z2.array(controlRecordSchema).min(1).max(128)
624
+ records: z3.array(controlRecordSchema).min(1).max(128)
439
625
  }),
440
- z2.strictObject({
441
- type: z2.literal("history.batch"),
442
- runId: id,
626
+ z3.strictObject({
627
+ type: z3.literal("history.batch"),
628
+ runId: id2,
443
629
  firstSeq: positive,
444
- records: z2.array(historyRecordSchema).min(1).max(128)
630
+ records: z3.array(historyRecordSchema).min(1).max(128)
445
631
  }),
446
- z2.strictObject({ type: z2.literal("ping"), nonce: id }),
447
- z2.strictObject({
448
- type: z2.literal("reconcile.page"),
449
- 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"),
450
636
  page: sequence.default(0),
451
- complete: z2.boolean(),
452
- runs: z2.array(
453
- z2.strictObject({
454
- runId: id,
455
- attemptId: id,
637
+ complete: z3.boolean(),
638
+ runs: z3.array(
639
+ z3.strictObject({
640
+ runId: id2,
641
+ attemptId: id2,
456
642
  executionRevision: sequence,
457
- phase: z2.enum(["admitted", "prepared", "executing", "parked", "terminal", "recovery"])
643
+ phase: z3.enum(["admitted", "prepared", "executing", "parked", "terminal", "recovery"])
458
644
  })
459
645
  ).max(128)
460
646
  })
461
647
  ]);
462
- var runViewSchema = z2.object({
463
- runId: id,
464
- sessionId: id,
465
- runnerId: id,
466
- computeProfileId: id.optional(),
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: z2.string().max(160).optional(),
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: z2.object({
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: z2.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional()
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: z2.object({
486
- status: z2.enum(["running", "awaiting_attention", "completed", "failed", "cancelled"]),
671
+ execution: z3.object({
672
+ status: z3.enum(["running", "awaiting_attention", "completed", "failed", "cancelled"]),
487
673
  revision: positive,
488
- attemptId: id,
489
- occupancy: z2.enum(["held", "released"]),
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: z2.enum(["queued", "dispatching", "admitted", "idle"]),
495
- closed: z2.boolean(),
496
- closeReason: z2.string().optional(),
497
- cancellation: id.optional(),
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: z2.boolean().optional(),
501
- canAbandon: z2.boolean().optional(),
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: 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()
506
692
  });
507
- var clientFrameSchema = z2.discriminatedUnion("type", [
508
- z2.strictObject({ type: z2.literal("watch"), hubEpoch: id, runIds: z2.array(id).max(100) }),
509
- z2.strictObject({ type: z2.literal("watch.ack"), subscriptionId: id, through: sequence }),
510
- z2.strictObject({ type: z2.literal("command.submit"), command: commandSchema }),
511
- 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 })
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 = z2.string().min(1).max(4096).refine(
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 = z2.strictObject({
526
- version: z2.literal(1),
527
- checkpointId: z2.string().min(1),
528
- orgId: z2.string().min(1),
529
- phase: z2.enum(["parked", "terminal"]),
530
- runId: z2.string().min(1),
531
- sessionId: z2.string().min(1),
532
- sourceAttemptId: z2.string().min(1),
533
- executionRevision: z2.number().int().positive().max(Number.MAX_SAFE_INTEGER),
534
- historyProduced: z2.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
535
- 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),
536
722
  grant: grantSchema,
537
- gitHead: z2.string().regex(/^[0-9a-f]{40,64}$/),
538
- gitBase: z2.string().regex(/^[0-9a-f]{40,64}$/).optional(),
539
- gitBundle: z2.string(),
540
- indexPatch: z2.string(),
541
- files: z2.array(
542
- 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() })
543
729
  ).max(1e5),
544
- deleted: z2.array(checkpointPathSchema).max(1e5),
545
- sessionRows: z2.array(z2.strictObject({ kind: z2.string(), id: z2.string(), payload: z2.string() })),
546
- history: z2.array(
547
- 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 })
548
734
  )
549
735
  });
550
736
  var connectCodeAlphabet = "ABCDEFGHJKMNPQRSTUVWXYZ23456789";
551
- var connectCodeSchema = z2.string().regex(/^[A-HJKMNP-Z2-9]{8}$/);
552
- var connectCodeRequestSchema = z2.strictObject({ hubEpoch: z2.string() });
553
- 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({
554
740
  code: connectCodeSchema,
555
741
  expiresAt: sequence
556
742
  });
557
- var connectRedeemRequestSchema = z2.strictObject({
558
- code: z2.string().min(8).max(16),
559
- installationId: id,
560
- hostname: z2.string().min(1).max(255),
561
- os: z2.string().min(1).max(64),
562
- softwareVersion: z2.string().min(1).max(128)
563
- });
564
- var connectRedeemResponseSchema = z2.strictObject({
565
- orgId: id,
566
- hubEpoch: z2.string(),
567
- runnerId: id,
568
- installationId: id,
569
- name: z2.string(),
570
- token: z2.string().min(32),
571
- 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,
572
758
  expiresAt: sequence
573
759
  });
574
- var connectAlreadyConnectedSchema = z2.strictObject({
575
- error: z2.literal("runner_already_connected"),
576
- orgId: id,
577
- runnerId: id,
578
- 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()
579
765
  });
580
- var audienceSchema = z2.enum(["personal", "team"]);
581
- var runnerListEntrySchema = z2.object({
582
- id,
583
- online: z2.number(),
584
- capacity: z2.number(),
585
- managed: z2.number(),
586
- draining: z2.number(),
587
- stopped: z2.number(),
588
- name: z2.string().nullable(),
589
- 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(),
590
776
  audience: audienceSchema.nullable(),
591
- softwareVersion: z2.string().nullable(),
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: z2.boolean().optional(),
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: z2.boolean().optional(),
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: z2.boolean().optional()
799
+ needsOwner: z3.boolean().optional()
614
800
  });
615
- var teamDefaultSchema = z2.discriminatedUnion("kind", [
616
- z2.strictObject({ kind: z2.literal("runner"), runnerId: id }),
617
- 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 })
618
804
  ]);
619
- var teamDefaultRequestSchema = z2.strictObject({
620
- hubEpoch: z2.string(),
805
+ var teamDefaultRequestSchema = z3.strictObject({
806
+ hubEpoch: z3.string(),
621
807
  teamDefault: teamDefaultSchema.nullable()
622
808
  });
623
- var runnerUpdateRequestSchema = z2.strictObject({
624
- hubEpoch: z2.string(),
625
- name: z2.string().max(100).optional(),
626
- 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(),
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 = z2.union([
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
- z2.strictObject({ via: z2.literal("personal"), runnerId: id }),
635
- z2.strictObject({ via: z2.literal("team_default"), runnerId: id }),
636
- 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 }),
637
823
  /** `runner_needs_owner`: the Team default is a Runner paused because the member who connected it left. */
638
- 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"]) })
639
825
  ]);
640
- var runnerListSchema = z2.object({
641
- capabilities: z2.record(z2.string(), z2.boolean()).optional(),
642
- 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(),
643
829
  /** Who the list was filtered for: a member sees their own and Team Runners, an admin every Runner. */
644
- viewer: z2.object({ userId: z2.string(), admin: z2.boolean() }).optional(),
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: z2.string().optional(),
649
- runners: z2.array(runnerListEntrySchema),
650
- profiles: z2.array(z2.object({
651
- id: z2.string(),
652
- label: z2.string(),
653
- projectDir: z2.string(),
654
- 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(),
655
841
  /** Marketplace refs baked into the profile's image; absent when the profile declares none. */
656
- workflows: z2.array(z2.string()).optional(),
657
- workflowSources: z2.array(z2.string()).optional()
842
+ workflows: z3.array(z3.string()).optional(),
843
+ workflowSources: z3.array(z3.string()).optional()
658
844
  }))
659
845
  });
660
- var runnerDisconnectRequestSchema = z2.strictObject({ hubEpoch: z2.string() });
846
+ var runnerDisconnectRequestSchema = z3.strictObject({ hubEpoch: z3.string() });
661
847
  var hubEpochRequestSchema = runnerDisconnectRequestSchema;
662
- var runnerDisconnectPreviewSchema = z2.object({
663
- runnerId: id,
664
- name: z2.string().nullable(),
665
- runs: z2.array(z2.object({
666
- runId: id,
667
- 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(),
668
854
  /** Working: executing now. Parked: waiting for a person, Runner released. Queued: not started yet. */
669
- state: z2.enum(["working", "parked", "queued"])
855
+ state: z3.enum(["working", "parked", "queued"])
670
856
  })),
671
- hiddenRuns: z2.number().int().nonnegative()
857
+ hiddenRuns: z3.number().int().nonnegative()
672
858
  });
673
- var runnerDisconnectResponseSchema = z2.object({
674
- disconnected: z2.literal(true),
859
+ var runnerDisconnectResponseSchema = z3.object({
860
+ disconnected: z3.literal(true),
675
861
  /** How many Runs were Stopped with the reason `runner_disconnected`. */
676
- stoppedRuns: z2.number().int().nonnegative()
862
+ stoppedRuns: z3.number().int().nonnegative()
677
863
  });
678
864
  var runnerAdoptRequestSchema = hubEpochRequestSchema;
679
865
  var connectStartRequestSchema = connectRedeemRequestSchema.omit({ code: true });
680
- var connectStartResponseSchema = z2.strictObject({
866
+ var connectStartResponseSchema = z3.strictObject({
681
867
  /** The machine's secret for polling; never shown. */
682
- deviceCode: z2.string().min(32).max(160),
868
+ deviceCode: z3.string().min(32).max(160),
683
869
  code: connectCodeSchema,
684
870
  expiresAt: sequence,
685
- intervalSec: z2.number().int().positive(),
871
+ intervalSec: z3.number().int().positive(),
686
872
  /** The web console page that approves `code`. */
687
- verificationUrl: z2.string().url()
873
+ verificationUrl: z3.string().url()
688
874
  });
689
- var connectPollRequestSchema = z2.strictObject({ deviceCode: z2.string().min(32).max(160) });
690
- var connectPendingResponseSchema = z2.strictObject({
691
- hostname: z2.string(),
692
- os: z2.string(),
693
- 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(),
694
880
  requestedAt: sequence,
695
881
  expiresAt: sequence
696
882
  });
697
- var connectApproveRequestSchema = z2.strictObject({
698
- code: z2.string().min(8).max(16),
883
+ var connectApproveRequestSchema = z3.strictObject({
884
+ code: z3.string().min(8).max(16),
699
885
  audience: audienceSchema,
700
- hubEpoch: z2.string().optional()
886
+ hubEpoch: z3.string().optional()
701
887
  });
702
- var connectDenyRequestSchema = z2.strictObject({ code: z2.string().min(8).max(16) });
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,