@drisp/protocol 0.8.6 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/v2.d.ts CHANGED
@@ -23,8 +23,8 @@ declare function forecastOfCap(declaredCap: number): number;
23
23
  */
24
24
  declare function attemptForecast(declaredCap: number): number;
25
25
  /**
26
- * One attempt of a child: its declared cap, whether it has closed, and the counted tokens it reported, if any. No
27
- * caller passes `spent` yet: the CLI and the Hub count forecasts until reported usage feeds the rule (DRI-246).
26
+ * One attempt of a child: its declared cap, whether it has closed, and the counted tokens (cache reads excluded) its
27
+ * Runner reported, if any. An older Runner never reports, so its attempts count their forecast.
28
28
  */
29
29
  type BudgetAttempt = {
30
30
  tokenCap: number;
@@ -34,7 +34,9 @@ type BudgetAttempt = {
34
34
  /**
35
35
  * What one attempt holds against the budget: a closed attempt (finished, failed, cancelled) what it reported, else its
36
36
  * forecast; a running or queued one the larger of its forecast and what it reported, so a resumed attempt never counts
37
- * the same tokens twice and an overrun counts once reported.
37
+ * the same tokens twice and an overrun counts once reported. Never more than its own positive declared cap: a Run
38
+ * reports a little past its cap before it is stopped, and the rule must stay looser than the cap sum it replaces, so
39
+ * the Hub never refuses a start the declared-cap rule accepted.
38
40
  */
39
41
  declare function attemptCost(attempt: BudgetAttempt): number;
40
42
  /**
@@ -105,6 +107,8 @@ declare const workflowInstallCapability = "workflow_install_v1";
105
107
  * token to the agent as `DRISP_RUN_TOKEN`. A start with `delegation` is never sent to a runner without it.
106
108
  */
107
109
  declare const runDelegationCapability = "run_delegation_v1";
110
+ /** Authenticated Orchestrator guidance retains its source in prompts and history. */
111
+ declare const orchestratorGuidanceCapability = "orchestrator_guidance_v1";
108
112
  /**
109
113
  * The runner takes grants marked `reportUsage` (protocol minor 3, root ADR-0011) and, for those only, reports the
110
114
  * Run's usage: on `run.attention` and `run.finished`, and as `run.usage` while it executes. A Hub that does not know
@@ -196,6 +200,9 @@ declare const interruptionSchema: z.ZodObject<{
196
200
  waiting: "waiting";
197
201
  }>;
198
202
  message: z.ZodString;
203
+ respondent: z.ZodOptional<z.ZodEnum<{
204
+ orchestrator: "orchestrator";
205
+ }>>;
199
206
  requestId: z.ZodOptional<z.ZodString>;
200
207
  }, z.core.$strict>;
201
208
  /** The Workflow a Run resolved on its runner: the registry name and, when the Workflow declares one, its version. */
@@ -321,6 +328,9 @@ declare const controlRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
321
328
  waiting: "waiting";
322
329
  }>;
323
330
  message: z.ZodString;
331
+ respondent: z.ZodOptional<z.ZodEnum<{
332
+ orchestrator: "orchestrator";
333
+ }>>;
324
334
  requestId: z.ZodOptional<z.ZodString>;
325
335
  }, z.core.$strict>;
326
336
  occupancy: z.ZodEnum<{
@@ -476,7 +486,7 @@ declare const runSpecSchema: z.ZodObject<{
476
486
  declare const runKeySchema: z.ZodString;
477
487
  /** A member start's grant to start, limit and stop its own children (root ADR-0008). */
478
488
  declare const delegationSchema: z.ZodObject<{
479
- maxChildren: z.ZodNumber;
489
+ maxChildren: z.ZodOptional<z.ZodNumber>;
480
490
  tokenBudget: z.ZodNumber;
481
491
  }, z.core.$strict>;
482
492
  /** A child's parent and declared token cap. Required on a delegated start; the Hub refuses it without `tokenCap`. */
@@ -535,7 +545,83 @@ declare const commandSchema: z.ZodObject<{
535
545
  }, z.core.$strict>;
536
546
  key: z.ZodOptional<z.ZodString>;
537
547
  delegation: z.ZodOptional<z.ZodObject<{
538
- maxChildren: z.ZodNumber;
548
+ maxChildren: z.ZodOptional<z.ZodNumber>;
549
+ tokenBudget: z.ZodNumber;
550
+ }, z.core.$strict>>;
551
+ parent: z.ZodOptional<z.ZodObject<{
552
+ runId: z.ZodString;
553
+ tokenCap: z.ZodOptional<z.ZodNumber>;
554
+ }, z.core.$strict>>;
555
+ }, z.core.$strict>, z.ZodObject<{
556
+ kind: z.ZodLiteral<"cancel">;
557
+ }, z.core.$strict>, z.ZodObject<{
558
+ kind: z.ZodLiteral<"abandon">;
559
+ }, z.core.$strict>, z.ZodObject<{
560
+ kind: z.ZodLiteral<"steer">;
561
+ text: z.ZodString;
562
+ }, z.core.$strict>, z.ZodObject<{
563
+ kind: z.ZodLiteral<"answer">;
564
+ interruptionId: z.ZodString;
565
+ expectedInterruptionRevision: z.ZodNumber;
566
+ requestId: z.ZodOptional<z.ZodString>;
567
+ answer: z.ZodJSONSchema;
568
+ }, z.core.$strict>, z.ZodObject<{
569
+ kind: z.ZodLiteral<"resume">;
570
+ interruptionId: z.ZodString;
571
+ guidance: z.ZodOptional<z.ZodString>;
572
+ }, z.core.$strict>, z.ZodObject<{
573
+ kind: z.ZodLiteral<"setBudget">;
574
+ tokenBudget: z.ZodNumber;
575
+ resume: z.ZodOptional<z.ZodBoolean>;
576
+ }, z.core.$strict>], "kind">;
577
+ }, z.core.$strict>;
578
+ /** Hub-authored provenance, never accepted on a client-submitted command. */
579
+ declare const deliveredCommandSchema: z.ZodObject<{
580
+ commandId: z.ZodString;
581
+ hubEpoch: z.ZodString;
582
+ runId: z.ZodString;
583
+ expectedRecordRevision: z.ZodOptional<z.ZodNumber>;
584
+ intent: z.ZodDiscriminatedUnion<[z.ZodObject<{
585
+ kind: z.ZodLiteral<"start">;
586
+ sessionId: z.ZodString;
587
+ runnerId: z.ZodOptional<z.ZodString>;
588
+ computeProfileId: z.ZodOptional<z.ZodString>;
589
+ scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
590
+ visibility: z.ZodLiteral<"organization">;
591
+ }, z.core.$strict>, z.ZodObject<{
592
+ visibility: z.ZodLiteral<"private">;
593
+ ownerUserId: z.ZodString;
594
+ }, z.core.$strict>], "visibility">;
595
+ spec: z.ZodObject<{
596
+ prompt: z.ZodString;
597
+ projectDir: z.ZodString;
598
+ harness: z.ZodEnum<{
599
+ "claude-code": "claude-code";
600
+ codex: "codex";
601
+ }>;
602
+ workflow: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
603
+ name: z.ZodString;
604
+ source: z.ZodOptional<z.ZodString>;
605
+ ref: z.ZodOptional<z.ZodString>;
606
+ version: z.ZodOptional<z.ZodString>;
607
+ }, z.core.$strict>]>>;
608
+ repository: z.ZodOptional<z.ZodObject<{
609
+ ref: z.ZodString;
610
+ commitSha: z.ZodString;
611
+ branch: z.ZodString;
612
+ workingDirectory: z.ZodString;
613
+ setupCommands: z.ZodArray<z.ZodString>;
614
+ configRevision: z.ZodNumber;
615
+ repositoryId: z.ZodNumber;
616
+ installationId: z.ZodNumber;
617
+ owner: z.ZodString;
618
+ name: z.ZodString;
619
+ bindingId: z.ZodString;
620
+ }, z.core.$strict>>;
621
+ }, z.core.$strict>;
622
+ key: z.ZodOptional<z.ZodString>;
623
+ delegation: z.ZodOptional<z.ZodObject<{
624
+ maxChildren: z.ZodOptional<z.ZodNumber>;
539
625
  tokenBudget: z.ZodNumber;
540
626
  }, z.core.$strict>>;
541
627
  parent: z.ZodOptional<z.ZodObject<{
@@ -564,7 +650,9 @@ declare const commandSchema: z.ZodObject<{
564
650
  tokenBudget: z.ZodNumber;
565
651
  resume: z.ZodOptional<z.ZodBoolean>;
566
652
  }, z.core.$strict>], "kind">;
653
+ orchestratorRunId: z.ZodOptional<z.ZodString>;
567
654
  }, z.core.$strict>;
655
+ type DeliveredCommand = z.infer<typeof deliveredCommandSchema>;
568
656
  declare const grantSchema: z.ZodObject<{
569
657
  commandId: z.ZodString;
570
658
  hubEpoch: z.ZodString;
@@ -609,6 +697,7 @@ declare const grantSchema: z.ZodObject<{
609
697
  }, z.core.$strict>>;
610
698
  }, z.core.$strict>;
611
699
  continuation: z.ZodOptional<z.ZodJSONSchema>;
700
+ orchestratorRunId: z.ZodOptional<z.ZodString>;
612
701
  previousRun: z.ZodOptional<z.ZodObject<{
613
702
  runId: z.ZodString;
614
703
  executionRevision: z.ZodNumber;
@@ -758,6 +847,9 @@ declare const runnerFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
758
847
  waiting: "waiting";
759
848
  }>;
760
849
  message: z.ZodString;
850
+ respondent: z.ZodOptional<z.ZodEnum<{
851
+ orchestrator: "orchestrator";
852
+ }>>;
761
853
  requestId: z.ZodOptional<z.ZodString>;
762
854
  }, z.core.$strict>;
763
855
  occupancy: z.ZodEnum<{
@@ -889,7 +981,7 @@ declare const runViewSchema: z.ZodObject<{
889
981
  tokenCap: z.ZodNumber;
890
982
  }, z.core.$strict>>;
891
983
  delegation: z.ZodOptional<z.ZodObject<{
892
- maxChildren: z.ZodNumber;
984
+ maxChildren: z.ZodOptional<z.ZodNumber>;
893
985
  tokenBudget: z.ZodNumber;
894
986
  }, z.core.$strip>>;
895
987
  usage: z.ZodOptional<z.ZodObject<{
@@ -927,6 +1019,9 @@ declare const runViewSchema: z.ZodObject<{
927
1019
  waiting: "waiting";
928
1020
  }>;
929
1021
  message: z.ZodString;
1022
+ respondent: z.ZodOptional<z.ZodEnum<{
1023
+ orchestrator: "orchestrator";
1024
+ }>>;
930
1025
  requestId: z.ZodOptional<z.ZodString>;
931
1026
  }, z.core.$strict>>;
932
1027
  }, z.core.$strip>>;
@@ -979,7 +1074,7 @@ declare const runViewSchema: z.ZodObject<{
979
1074
  }, z.core.$strict>;
980
1075
  key: z.ZodOptional<z.ZodString>;
981
1076
  delegation: z.ZodOptional<z.ZodObject<{
982
- maxChildren: z.ZodNumber;
1077
+ maxChildren: z.ZodOptional<z.ZodNumber>;
983
1078
  tokenBudget: z.ZodNumber;
984
1079
  }, z.core.$strict>>;
985
1080
  parent: z.ZodOptional<z.ZodObject<{
@@ -1078,7 +1173,7 @@ declare const clientFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1078
1173
  }, z.core.$strict>;
1079
1174
  key: z.ZodOptional<z.ZodString>;
1080
1175
  delegation: z.ZodOptional<z.ZodObject<{
1081
- maxChildren: z.ZodNumber;
1176
+ maxChildren: z.ZodOptional<z.ZodNumber>;
1082
1177
  tokenBudget: z.ZodNumber;
1083
1178
  }, z.core.$strict>>;
1084
1179
  parent: z.ZodOptional<z.ZodObject<{
@@ -1173,6 +1268,7 @@ declare const checkpointSchema: z.ZodObject<{
1173
1268
  }, z.core.$strict>>;
1174
1269
  }, z.core.$strict>;
1175
1270
  continuation: z.ZodOptional<z.ZodJSONSchema>;
1271
+ orchestratorRunId: z.ZodOptional<z.ZodString>;
1176
1272
  previousRun: z.ZodOptional<z.ZodObject<{
1177
1273
  runId: z.ZodString;
1178
1274
  executionRevision: z.ZodNumber;
@@ -1552,4 +1648,4 @@ type ConnectPendingResponse = z.infer<typeof connectPendingResponseSchema>;
1552
1648
  type TeamDefault = z.infer<typeof teamDefaultSchema>;
1553
1649
  type RunsGoTo = z.infer<typeof runsGoToSchema>;
1554
1650
 
1555
- export { type Audience, type BudgetAttempt, type BuildCloseReason, CALIBRATION_MIN_RUNS, CALIBRATION_WINDOW_DAYS, type Calibration, type CalibrationSample, type Checkpoint, type ClassCalibration, type Command, type ConnectAlreadyConnected, type ConnectPendingResponse, type ConnectRedeemRequest, type ConnectRedeemResponse, type ConnectStartRequest, type ConnectStartResponse, type ControlRecord, type Delegation, type ExecutionFact, type Grant, type Harness, type HarnessReadiness, type HistoryRecord, type InstalledWorkflow, type RepositoryBinding, type RepositorySource, type RunCloseReason, type RunParent, type RunUsage, type RunView, type RunnerAdoptRequest, type RunnerDisconnectPreview, type RunnerDisconnectResponse, type RunnerFrame, type RunnerList, type RunnerListEntry, type RunnerReadiness, type RunsGoTo, SIZE_CLASS_CAPS, SIZE_CLASS_FORECASTS, type Scope, type SizeClass, type TeamDefault, type WorkflowIdentity, type WorkflowInstallReference, type WorkflowReference, abandonedConversationContinuationCapability, attemptCost, attemptForecast, audienceSchema, budgetCheck, buildCloseReasonSchema, calibrate, calibrationSchema, canonicalJson, checkpointPathSchema, checkpointSchema, classOfCap, clientFrameSchema, commandSchema, connectAlreadyConnectedSchema, connectApproveRequestSchema, connectCodeAlphabet, connectCodeRequestSchema, connectCodeResponseSchema, connectCodeSchema, connectDenyRequestSchema, connectPendingResponseSchema, connectPollRequestSchema, connectRedeemRequestSchema, connectRedeemResponseSchema, connectStartRequestSchema, connectStartResponseSchema, controlRecordSchema, conversationContinuationCapability, delegationSchema, delegationTokenPrefix, forecastOfCap, forecastOfClass, grantSchema, harnessReadinessSchema, harnessSchema, historyRecordSchema, hubEpochRequestSchema, installReference, installedWorkflowsSchema, interruptionSchema, permissionAnswerSchema, protocolVersion, readableHistory, readinessFixCommand, repositoryAccessCapability, repositoryBindingSchema, repositoryRefSchema, repositorySourceSchema, repositoryWorkingDirectorySchema, runArtifactMaxBytes, runArtifactNameSchema, runCloseReasonSchema, runDelegationCapability, runKeySchema, runParentIntentSchema, runParentSchema, runSpecSchema, runUsageCapability, runUsageSchema, runViewSchema, runnerAdoptRequestSchema, runnerDisconnectPreviewSchema, runnerDisconnectRequestSchema, runnerDisconnectResponseSchema, runnerFrameSchema, runnerListEntrySchema, runnerListSchema, runnerReadinessSchema, runnerUpdateCommand, runnerUpdateRequestSchema, runsGoToSchema, sameWorkflow, scopeSchema, secretEnvironmentSchema, sequence, teamDefaultRequestSchema, teamDefaultSchema, workflowIdentitySchema, workflowInstallCapability, workflowName, workflowReferenceSchema, workflowSourceSchema };
1651
+ export { type Audience, type BudgetAttempt, type BuildCloseReason, CALIBRATION_MIN_RUNS, CALIBRATION_WINDOW_DAYS, type Calibration, type CalibrationSample, type Checkpoint, type ClassCalibration, type Command, type ConnectAlreadyConnected, type ConnectPendingResponse, type ConnectRedeemRequest, type ConnectRedeemResponse, type ConnectStartRequest, type ConnectStartResponse, type ControlRecord, type Delegation, type DeliveredCommand, type ExecutionFact, type Grant, type Harness, type HarnessReadiness, type HistoryRecord, type InstalledWorkflow, type RepositoryBinding, type RepositorySource, type RunCloseReason, type RunParent, type RunUsage, type RunView, type RunnerAdoptRequest, type RunnerDisconnectPreview, type RunnerDisconnectResponse, type RunnerFrame, type RunnerList, type RunnerListEntry, type RunnerReadiness, type RunsGoTo, SIZE_CLASS_CAPS, SIZE_CLASS_FORECASTS, type Scope, type SizeClass, type TeamDefault, type WorkflowIdentity, type WorkflowInstallReference, type WorkflowReference, abandonedConversationContinuationCapability, attemptCost, attemptForecast, audienceSchema, budgetCheck, buildCloseReasonSchema, calibrate, calibrationSchema, canonicalJson, checkpointPathSchema, checkpointSchema, classOfCap, clientFrameSchema, commandSchema, connectAlreadyConnectedSchema, connectApproveRequestSchema, connectCodeAlphabet, connectCodeRequestSchema, connectCodeResponseSchema, connectCodeSchema, connectDenyRequestSchema, connectPendingResponseSchema, connectPollRequestSchema, connectRedeemRequestSchema, connectRedeemResponseSchema, connectStartRequestSchema, connectStartResponseSchema, controlRecordSchema, conversationContinuationCapability, delegationSchema, delegationTokenPrefix, deliveredCommandSchema, forecastOfCap, forecastOfClass, grantSchema, harnessReadinessSchema, harnessSchema, historyRecordSchema, hubEpochRequestSchema, installReference, installedWorkflowsSchema, interruptionSchema, orchestratorGuidanceCapability, permissionAnswerSchema, protocolVersion, readableHistory, readinessFixCommand, repositoryAccessCapability, repositoryBindingSchema, repositoryRefSchema, repositorySourceSchema, repositoryWorkingDirectorySchema, runArtifactMaxBytes, runArtifactNameSchema, runCloseReasonSchema, runDelegationCapability, runKeySchema, runParentIntentSchema, runParentSchema, runSpecSchema, runUsageCapability, runUsageSchema, runViewSchema, runnerAdoptRequestSchema, runnerDisconnectPreviewSchema, runnerDisconnectRequestSchema, runnerDisconnectResponseSchema, runnerFrameSchema, runnerListEntrySchema, runnerListSchema, runnerReadinessSchema, runnerUpdateCommand, runnerUpdateRequestSchema, runsGoToSchema, sameWorkflow, scopeSchema, secretEnvironmentSchema, sequence, teamDefaultRequestSchema, teamDefaultSchema, workflowIdentitySchema, workflowInstallCapability, workflowName, workflowReferenceSchema, workflowSourceSchema };
package/dist/v2.js CHANGED
@@ -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);
@@ -117,6 +117,7 @@ var abandonedConversationContinuationCapability = "abandoned_conversation_contin
117
117
  var repositoryAccessCapability = "repository_checkout_v1";
118
118
  var workflowInstallCapability = "workflow_install_v1";
119
119
  var runDelegationCapability = "run_delegation_v1";
120
+ var orchestratorGuidanceCapability = "orchestrator_guidance_v1";
120
121
  var runUsageCapability = "run_usage_v1";
121
122
  var delegationTokenPrefix = "drisp_dlg_";
122
123
  var runArtifactNameSchema = z2.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
@@ -162,6 +163,8 @@ var interruptionSchema = z2.strictObject({
162
163
  /** `waiting` (root ADR-0008) is non-human: a Run parked until one of its children closes or parks. */
163
164
  kind: z2.enum(["permission", "question", "guidance", "recovery", "waiting"]),
164
165
  message: z2.string().max(16384),
166
+ /** Explicit technical question for a parent; absent always reserves the answer to a member. */
167
+ respondent: z2.enum(["orchestrator"]).optional(),
165
168
  requestId: id.optional()
166
169
  });
167
170
  var workflowIdentitySchema = z2.strictObject({
@@ -315,7 +318,8 @@ var runSpecSchema = z2.strictObject({
315
318
  });
316
319
  var runKeySchema = z2.string().min(1).max(160);
317
320
  var delegationSchema = z2.strictObject({
318
- maxChildren: z2.number().int().min(1).max(8),
321
+ // Omitted: follow the Runner capacity. An explicit value is a per-Build ceiling.
322
+ maxChildren: z2.number().int().min(1).max(64).optional(),
319
323
  tokenBudget: z2.number().int().positive().max(Number.MAX_SAFE_INTEGER)
320
324
  });
321
325
  var tokenCapSchema = z2.number().int().positive().max(Number.MAX_SAFE_INTEGER);
@@ -371,6 +375,7 @@ var commandSchema = z2.strictObject({
371
375
  })
372
376
  ])
373
377
  });
378
+ var deliveredCommandSchema = commandSchema.extend({ orchestratorRunId: id.optional() });
374
379
  var grantSchema = z2.strictObject({
375
380
  commandId: id,
376
381
  hubEpoch: id,
@@ -386,6 +391,8 @@ var grantSchema = z2.strictObject({
386
391
  purpose: z2.enum(["start", "resume"]),
387
392
  spec: runSpecSchema,
388
393
  continuation: z2.json().optional(),
394
+ /** Authenticated source of a delegated continuation; absence retains member semantics. */
395
+ orchestratorRunId: id.optional(),
389
396
  /** A new Run in a durable conversation; never resumes the predecessor's lifecycle. */
390
397
  previousRun: z2.strictObject({
391
398
  runId: id,
@@ -466,7 +473,11 @@ var runViewSchema = z2.object({
466
473
  * Not strict, unlike the start intent's: a Hub keeps more on the Run's delegation (`initialTokenBudget`) than it
467
474
  * shows, and a client never refuses a view for a field it does not read.
468
475
  */
469
- delegation: z2.object(delegationSchema.shape).optional(),
476
+ delegation: z2.object({
477
+ ...delegationSchema.shape,
478
+ // 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()
480
+ }).optional(),
470
481
  /** The largest cumulative usage the Run's Runner reported; absent until one does (an older Runner never does). */
471
482
  usage: runUsageSchema.optional(),
472
483
  /** Resolved by the runner at start; absent until the Run starts and for runners that predate reporting. */
@@ -725,6 +736,7 @@ export {
725
736
  conversationContinuationCapability,
726
737
  delegationSchema,
727
738
  delegationTokenPrefix,
739
+ deliveredCommandSchema,
728
740
  forecastOfCap,
729
741
  forecastOfClass,
730
742
  grantSchema,
@@ -735,6 +747,7 @@ export {
735
747
  installReference,
736
748
  installedWorkflowsSchema,
737
749
  interruptionSchema,
750
+ orchestratorGuidanceCapability,
738
751
  permissionAnswerSchema,
739
752
  protocolVersion,
740
753
  readableHistory,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drisp/protocol",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "description": "Wire contract between a drisp runner and the hub: zod schemas, inferred types, and JSON Schema for the instance-socket frames, Run, Turn, Interruption, and the event stream",
5
5
  "repository": {
6
6
  "type": "git",
@@ -265,6 +265,11 @@
265
265
  "continuation": {
266
266
  "$ref": "#/$defs/__schema0"
267
267
  },
268
+ "orchestratorRunId": {
269
+ "type": "string",
270
+ "minLength": 1,
271
+ "maxLength": 160
272
+ },
268
273
  "previousRun": {
269
274
  "type": "object",
270
275
  "properties": {
@@ -305,7 +305,7 @@
305
305
  "maxChildren": {
306
306
  "type": "integer",
307
307
  "minimum": 1,
308
- "maximum": 8
308
+ "maximum": 64
309
309
  },
310
310
  "tokenBudget": {
311
311
  "type": "integer",
@@ -314,7 +314,6 @@
314
314
  }
315
315
  },
316
316
  "required": [
317
- "maxChildren",
318
317
  "tokenBudget"
319
318
  ],
320
319
  "additionalProperties": false
@@ -242,7 +242,7 @@
242
242
  "maxChildren": {
243
243
  "type": "integer",
244
244
  "minimum": 1,
245
- "maximum": 8
245
+ "maximum": 64
246
246
  },
247
247
  "tokenBudget": {
248
248
  "type": "integer",
@@ -251,7 +251,6 @@
251
251
  }
252
252
  },
253
253
  "required": [
254
- "maxChildren",
255
254
  "tokenBudget"
256
255
  ],
257
256
  "additionalProperties": false
@@ -0,0 +1,458 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "commandId": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "maxLength": 160
9
+ },
10
+ "hubEpoch": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "maxLength": 160
14
+ },
15
+ "runId": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "maxLength": 160
19
+ },
20
+ "expectedRecordRevision": {
21
+ "type": "integer",
22
+ "minimum": 0,
23
+ "maximum": 9007199254740991
24
+ },
25
+ "intent": {
26
+ "oneOf": [
27
+ {
28
+ "type": "object",
29
+ "properties": {
30
+ "kind": {
31
+ "type": "string",
32
+ "const": "start"
33
+ },
34
+ "sessionId": {
35
+ "type": "string",
36
+ "minLength": 1,
37
+ "maxLength": 160
38
+ },
39
+ "runnerId": {
40
+ "type": "string",
41
+ "minLength": 1,
42
+ "maxLength": 160
43
+ },
44
+ "computeProfileId": {
45
+ "type": "string",
46
+ "minLength": 1,
47
+ "maxLength": 160
48
+ },
49
+ "scope": {
50
+ "oneOf": [
51
+ {
52
+ "type": "object",
53
+ "properties": {
54
+ "visibility": {
55
+ "type": "string",
56
+ "const": "organization"
57
+ }
58
+ },
59
+ "required": [
60
+ "visibility"
61
+ ],
62
+ "additionalProperties": false
63
+ },
64
+ {
65
+ "type": "object",
66
+ "properties": {
67
+ "visibility": {
68
+ "type": "string",
69
+ "const": "private"
70
+ },
71
+ "ownerUserId": {
72
+ "type": "string",
73
+ "minLength": 1,
74
+ "maxLength": 160
75
+ }
76
+ },
77
+ "required": [
78
+ "visibility",
79
+ "ownerUserId"
80
+ ],
81
+ "additionalProperties": false
82
+ }
83
+ ]
84
+ },
85
+ "spec": {
86
+ "type": "object",
87
+ "properties": {
88
+ "prompt": {
89
+ "type": "string",
90
+ "minLength": 1,
91
+ "maxLength": 131072
92
+ },
93
+ "projectDir": {
94
+ "type": "string",
95
+ "minLength": 1,
96
+ "maxLength": 4096
97
+ },
98
+ "harness": {
99
+ "type": "string",
100
+ "enum": [
101
+ "claude-code",
102
+ "codex"
103
+ ]
104
+ },
105
+ "workflow": {
106
+ "anyOf": [
107
+ {
108
+ "type": "string",
109
+ "maxLength": 512
110
+ },
111
+ {
112
+ "type": "object",
113
+ "properties": {
114
+ "name": {
115
+ "type": "string",
116
+ "minLength": 1,
117
+ "maxLength": 128,
118
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
119
+ },
120
+ "source": {
121
+ "type": "string",
122
+ "maxLength": 201,
123
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]*\\/[A-Za-z0-9][A-Za-z0-9_.-]*$"
124
+ },
125
+ "ref": {
126
+ "type": "string",
127
+ "minLength": 1,
128
+ "maxLength": 512
129
+ },
130
+ "version": {
131
+ "type": "string",
132
+ "minLength": 1,
133
+ "maxLength": 128,
134
+ "pattern": "^\\d[A-Za-z0-9_.+-]*$"
135
+ }
136
+ },
137
+ "required": [
138
+ "name"
139
+ ],
140
+ "additionalProperties": false
141
+ }
142
+ ]
143
+ },
144
+ "repository": {
145
+ "type": "object",
146
+ "properties": {
147
+ "bindingId": {
148
+ "type": "string",
149
+ "minLength": 1,
150
+ "maxLength": 160
151
+ },
152
+ "repositoryId": {
153
+ "type": "integer",
154
+ "exclusiveMinimum": 0,
155
+ "maximum": 9007199254740991
156
+ },
157
+ "installationId": {
158
+ "type": "integer",
159
+ "exclusiveMinimum": 0,
160
+ "maximum": 9007199254740991
161
+ },
162
+ "owner": {
163
+ "type": "string",
164
+ "minLength": 1,
165
+ "maxLength": 100,
166
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-]*$"
167
+ },
168
+ "name": {
169
+ "type": "string",
170
+ "minLength": 1,
171
+ "maxLength": 100,
172
+ "pattern": "^(?!\\.{1,2}$)[a-zA-Z0-9_.-]+$"
173
+ },
174
+ "ref": {
175
+ "type": "string",
176
+ "minLength": 1,
177
+ "maxLength": 512,
178
+ "pattern": "^(?![-/])(?!.*\\.\\.)(?!.*@\\{)(?!.*(?:^|\\/)\\.)(?!.*\\.lock(?:\\/|$))(?!.*\\/\\/)[^\\x00-\\x20\\x7f~^:?*\\[\\\\]+(?<![/.])$"
179
+ },
180
+ "commitSha": {
181
+ "type": "string",
182
+ "pattern": "^[0-9a-f]{40}$"
183
+ },
184
+ "branch": {
185
+ "type": "string",
186
+ "minLength": 1,
187
+ "maxLength": 512,
188
+ "pattern": "^(?![-/])(?!.*\\.\\.)(?!.*@\\{)(?!.*(?:^|\\/)\\.)(?!.*\\.lock(?:\\/|$))(?!.*\\/\\/)[^\\x00-\\x20\\x7f~^:?*\\[\\\\]+(?<![/.])$"
189
+ },
190
+ "workingDirectory": {
191
+ "type": "string",
192
+ "minLength": 1,
193
+ "maxLength": 1024,
194
+ "pattern": "^(?:\\.|(?!\\/)(?!.*(?:^|\\/)\\.\\.?(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))[^\\x00-\\x1f\\x7f\\\\:]+(?<!\\/))$"
195
+ },
196
+ "setupCommands": {
197
+ "maxItems": 16,
198
+ "type": "array",
199
+ "items": {
200
+ "type": "string",
201
+ "minLength": 1,
202
+ "maxLength": 8192
203
+ }
204
+ },
205
+ "configRevision": {
206
+ "type": "integer",
207
+ "minimum": 0,
208
+ "maximum": 9007199254740991
209
+ }
210
+ },
211
+ "required": [
212
+ "bindingId",
213
+ "repositoryId",
214
+ "installationId",
215
+ "owner",
216
+ "name",
217
+ "ref",
218
+ "commitSha",
219
+ "branch",
220
+ "workingDirectory",
221
+ "setupCommands",
222
+ "configRevision"
223
+ ],
224
+ "additionalProperties": false
225
+ }
226
+ },
227
+ "required": [
228
+ "prompt",
229
+ "projectDir",
230
+ "harness"
231
+ ],
232
+ "additionalProperties": false
233
+ },
234
+ "key": {
235
+ "type": "string",
236
+ "minLength": 1,
237
+ "maxLength": 160
238
+ },
239
+ "delegation": {
240
+ "type": "object",
241
+ "properties": {
242
+ "maxChildren": {
243
+ "type": "integer",
244
+ "minimum": 1,
245
+ "maximum": 64
246
+ },
247
+ "tokenBudget": {
248
+ "type": "integer",
249
+ "exclusiveMinimum": 0,
250
+ "maximum": 9007199254740991
251
+ }
252
+ },
253
+ "required": [
254
+ "tokenBudget"
255
+ ],
256
+ "additionalProperties": false
257
+ },
258
+ "parent": {
259
+ "type": "object",
260
+ "properties": {
261
+ "runId": {
262
+ "type": "string",
263
+ "minLength": 1,
264
+ "maxLength": 160
265
+ },
266
+ "tokenCap": {
267
+ "type": "integer",
268
+ "exclusiveMinimum": 0,
269
+ "maximum": 9007199254740991
270
+ }
271
+ },
272
+ "required": [
273
+ "runId"
274
+ ],
275
+ "additionalProperties": false
276
+ }
277
+ },
278
+ "required": [
279
+ "kind",
280
+ "sessionId",
281
+ "scope",
282
+ "spec"
283
+ ],
284
+ "additionalProperties": false
285
+ },
286
+ {
287
+ "type": "object",
288
+ "properties": {
289
+ "kind": {
290
+ "type": "string",
291
+ "const": "cancel"
292
+ }
293
+ },
294
+ "required": [
295
+ "kind"
296
+ ],
297
+ "additionalProperties": false
298
+ },
299
+ {
300
+ "type": "object",
301
+ "properties": {
302
+ "kind": {
303
+ "type": "string",
304
+ "const": "abandon"
305
+ }
306
+ },
307
+ "required": [
308
+ "kind"
309
+ ],
310
+ "additionalProperties": false
311
+ },
312
+ {
313
+ "type": "object",
314
+ "properties": {
315
+ "kind": {
316
+ "type": "string",
317
+ "const": "steer"
318
+ },
319
+ "text": {
320
+ "type": "string",
321
+ "minLength": 1,
322
+ "maxLength": 131072
323
+ }
324
+ },
325
+ "required": [
326
+ "kind",
327
+ "text"
328
+ ],
329
+ "additionalProperties": false
330
+ },
331
+ {
332
+ "type": "object",
333
+ "properties": {
334
+ "kind": {
335
+ "type": "string",
336
+ "const": "answer"
337
+ },
338
+ "interruptionId": {
339
+ "type": "string",
340
+ "minLength": 1,
341
+ "maxLength": 160
342
+ },
343
+ "expectedInterruptionRevision": {
344
+ "type": "integer",
345
+ "minimum": 0,
346
+ "maximum": 9007199254740991
347
+ },
348
+ "requestId": {
349
+ "type": "string",
350
+ "minLength": 1,
351
+ "maxLength": 160
352
+ },
353
+ "answer": {
354
+ "$ref": "#/$defs/__schema0"
355
+ }
356
+ },
357
+ "required": [
358
+ "kind",
359
+ "interruptionId",
360
+ "expectedInterruptionRevision",
361
+ "answer"
362
+ ],
363
+ "additionalProperties": false
364
+ },
365
+ {
366
+ "type": "object",
367
+ "properties": {
368
+ "kind": {
369
+ "type": "string",
370
+ "const": "resume"
371
+ },
372
+ "interruptionId": {
373
+ "type": "string",
374
+ "minLength": 1,
375
+ "maxLength": 160
376
+ },
377
+ "guidance": {
378
+ "type": "string",
379
+ "maxLength": 131072
380
+ }
381
+ },
382
+ "required": [
383
+ "kind",
384
+ "interruptionId"
385
+ ],
386
+ "additionalProperties": false
387
+ },
388
+ {
389
+ "type": "object",
390
+ "properties": {
391
+ "kind": {
392
+ "type": "string",
393
+ "const": "setBudget"
394
+ },
395
+ "tokenBudget": {
396
+ "type": "integer",
397
+ "exclusiveMinimum": 0,
398
+ "maximum": 9007199254740991
399
+ },
400
+ "resume": {
401
+ "type": "boolean"
402
+ }
403
+ },
404
+ "required": [
405
+ "kind",
406
+ "tokenBudget"
407
+ ],
408
+ "additionalProperties": false
409
+ }
410
+ ]
411
+ },
412
+ "orchestratorRunId": {
413
+ "type": "string",
414
+ "minLength": 1,
415
+ "maxLength": 160
416
+ }
417
+ },
418
+ "required": [
419
+ "commandId",
420
+ "hubEpoch",
421
+ "runId",
422
+ "intent"
423
+ ],
424
+ "additionalProperties": false,
425
+ "$defs": {
426
+ "__schema0": {
427
+ "anyOf": [
428
+ {
429
+ "type": "string"
430
+ },
431
+ {
432
+ "type": "number"
433
+ },
434
+ {
435
+ "type": "boolean"
436
+ },
437
+ {
438
+ "type": "null"
439
+ },
440
+ {
441
+ "type": "array",
442
+ "items": {
443
+ "$ref": "#/$defs/__schema0"
444
+ }
445
+ },
446
+ {
447
+ "type": "object",
448
+ "propertyNames": {
449
+ "type": "string"
450
+ },
451
+ "additionalProperties": {
452
+ "$ref": "#/$defs/__schema0"
453
+ }
454
+ }
455
+ ]
456
+ }
457
+ }
458
+ }
@@ -216,6 +216,11 @@
216
216
  "continuation": {
217
217
  "$ref": "#/$defs/__schema0"
218
218
  },
219
+ "orchestratorRunId": {
220
+ "type": "string",
221
+ "minLength": 1,
222
+ "maxLength": 160
223
+ },
219
224
  "previousRun": {
220
225
  "type": "object",
221
226
  "properties": {
@@ -97,8 +97,8 @@
97
97
  "properties": {
98
98
  "maxChildren": {
99
99
  "type": "integer",
100
- "minimum": 1,
101
- "maximum": 8
100
+ "exclusiveMinimum": 0,
101
+ "maximum": 9007199254740991
102
102
  },
103
103
  "tokenBudget": {
104
104
  "type": "integer",
@@ -107,7 +107,6 @@
107
107
  }
108
108
  },
109
109
  "required": [
110
- "maxChildren",
111
110
  "tokenBudget"
112
111
  ],
113
112
  "additionalProperties": false
@@ -220,6 +219,12 @@
220
219
  "type": "string",
221
220
  "maxLength": 16384
222
221
  },
222
+ "respondent": {
223
+ "type": "string",
224
+ "enum": [
225
+ "orchestrator"
226
+ ]
227
+ },
223
228
  "requestId": {
224
229
  "type": "string",
225
230
  "minLength": 1,
@@ -488,7 +493,7 @@
488
493
  "maxChildren": {
489
494
  "type": "integer",
490
495
  "minimum": 1,
491
- "maximum": 8
496
+ "maximum": 64
492
497
  },
493
498
  "tokenBudget": {
494
499
  "type": "integer",
@@ -497,7 +502,6 @@
497
502
  }
498
503
  },
499
504
  "required": [
500
- "maxChildren",
501
505
  "tokenBudget"
502
506
  ],
503
507
  "additionalProperties": false
@@ -622,6 +622,12 @@
622
622
  "type": "string",
623
623
  "maxLength": 16384
624
624
  },
625
+ "respondent": {
626
+ "type": "string",
627
+ "enum": [
628
+ "orchestrator"
629
+ ]
630
+ },
625
631
  "requestId": {
626
632
  "type": "string",
627
633
  "minLength": 1,