@drisp/protocol 0.6.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v2.d.ts +128 -4
- package/dist/v2.js +68 -5
- package/package.json +1 -1
- package/schema/v2/checkpoint.json +25 -0
- package/schema/v2/client.json +44 -0
- package/schema/v2/command.json +44 -0
- package/schema/v2/grant.json +25 -0
- package/schema/v2/run.json +91 -1
- package/schema/v2/runner.json +11 -1
package/dist/v2.d.ts
CHANGED
|
@@ -6,13 +6,23 @@ declare function readableHistory(records: HistoryRecord[]): HistoryRecord[];
|
|
|
6
6
|
|
|
7
7
|
declare const protocolVersion: {
|
|
8
8
|
readonly major: 2;
|
|
9
|
-
readonly minor:
|
|
9
|
+
readonly minor: 2;
|
|
10
10
|
};
|
|
11
11
|
declare const conversationContinuationCapability = "conversation_continuation";
|
|
12
12
|
declare const abandonedConversationContinuationCapability = "abandoned_conversation_continuation";
|
|
13
13
|
declare const repositoryAccessCapability = "repository_checkout_v1";
|
|
14
14
|
/** The runner can install a Workflow named by a Run's install reference before it starts. */
|
|
15
15
|
declare const workflowInstallCapability = "workflow_install_v1";
|
|
16
|
+
/**
|
|
17
|
+
* The runner takes grants carrying `delegationToken` and `parent` (protocol minor 2, root ADR-0008) and hands the
|
|
18
|
+
* token to the agent as `DRISP_RUN_TOKEN`. A start with `delegation` is never sent to a runner without it.
|
|
19
|
+
*/
|
|
20
|
+
declare const runDelegationCapability = "run_delegation_v1";
|
|
21
|
+
/** The prefix of every delegation token; the Hub keeps only its digest. */
|
|
22
|
+
declare const delegationTokenPrefix = "drisp_dlg_";
|
|
23
|
+
/** A `run.artifact` history record's `name`, and the most its `json` may take serialized. */
|
|
24
|
+
declare const runArtifactNameSchema: z.ZodString;
|
|
25
|
+
declare const runArtifactMaxBytes: number;
|
|
16
26
|
/** Deployment-approved secret references, never secret values or process-control variables. */
|
|
17
27
|
declare const secretEnvironmentSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
18
28
|
declare const permissionAnswerSchema: z.ZodObject<{
|
|
@@ -90,6 +100,7 @@ declare const interruptionSchema: z.ZodObject<{
|
|
|
90
100
|
question: "question";
|
|
91
101
|
guidance: "guidance";
|
|
92
102
|
recovery: "recovery";
|
|
103
|
+
waiting: "waiting";
|
|
93
104
|
}>;
|
|
94
105
|
message: z.ZodString;
|
|
95
106
|
requestId: z.ZodOptional<z.ZodString>;
|
|
@@ -100,6 +111,40 @@ declare const workflowIdentitySchema: z.ZodObject<{
|
|
|
100
111
|
version: z.ZodOptional<z.ZodString>;
|
|
101
112
|
}, z.core.$strict>;
|
|
102
113
|
type WorkflowIdentity = z.infer<typeof workflowIdentitySchema>;
|
|
114
|
+
/** A Runner's close reasons for a Build Run: a child refused at bootstrap, or an approval marker with no question. */
|
|
115
|
+
declare const buildCloseReasonSchema: z.ZodEnum<{
|
|
116
|
+
workflow_template_mismatch: "workflow_template_mismatch";
|
|
117
|
+
child_project_dir_invalid: "child_project_dir_invalid";
|
|
118
|
+
build_not_approved: "build_not_approved";
|
|
119
|
+
approval_question_missing: "approval_question_missing";
|
|
120
|
+
}>;
|
|
121
|
+
type BuildCloseReason = z.infer<typeof buildCloseReasonSchema>;
|
|
122
|
+
/**
|
|
123
|
+
* Every close reason a Hub gives a Run view's `closeReason`: its own, and the Runner's Build ones it stores from
|
|
124
|
+
* `run.finished.reason`. The view keeps `closeReason` an open string, so a newer Hub's reasons still decode; the app
|
|
125
|
+
* words each of these (apps/macos Kit `BuildStrings.closeReasons`), and a Kit test fails on one it does not word.
|
|
126
|
+
*/
|
|
127
|
+
declare const runCloseReasonSchema: z.ZodEnum<{
|
|
128
|
+
workflow_template_mismatch: "workflow_template_mismatch";
|
|
129
|
+
child_project_dir_invalid: "child_project_dir_invalid";
|
|
130
|
+
build_not_approved: "build_not_approved";
|
|
131
|
+
approval_question_missing: "approval_question_missing";
|
|
132
|
+
execution_terminal: "execution_terminal";
|
|
133
|
+
cancelled_before_start: "cancelled_before_start";
|
|
134
|
+
admission_failed: "admission_failed";
|
|
135
|
+
abandoned: "abandoned";
|
|
136
|
+
managed_startup_timeout: "managed_startup_timeout";
|
|
137
|
+
runner_disconnected: "runner_disconnected";
|
|
138
|
+
runner_needs_owner: "runner_needs_owner";
|
|
139
|
+
runner_not_available: "runner_not_available";
|
|
140
|
+
runner_upgrade_required: "runner_upgrade_required";
|
|
141
|
+
legacy_succeeded: "legacy_succeeded";
|
|
142
|
+
legacy_failed: "legacy_failed";
|
|
143
|
+
legacy_cancelled: "legacy_cancelled";
|
|
144
|
+
legacy_timeout: "legacy_timeout";
|
|
145
|
+
legacy_force_failed: "legacy_force_failed";
|
|
146
|
+
}>;
|
|
147
|
+
type RunCloseReason = z.infer<typeof runCloseReasonSchema>;
|
|
103
148
|
declare const controlRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
104
149
|
kind: z.ZodLiteral<"workflows.changed">;
|
|
105
150
|
workflows: z.ZodArray<z.ZodObject<{
|
|
@@ -167,6 +212,7 @@ declare const controlRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
167
212
|
question: "question";
|
|
168
213
|
guidance: "guidance";
|
|
169
214
|
recovery: "recovery";
|
|
215
|
+
waiting: "waiting";
|
|
170
216
|
}>;
|
|
171
217
|
message: z.ZodString;
|
|
172
218
|
requestId: z.ZodOptional<z.ZodString>;
|
|
@@ -201,6 +247,12 @@ declare const controlRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
201
247
|
}>;
|
|
202
248
|
historyThrough: z.ZodNumber;
|
|
203
249
|
workspaceUnavailable: z.ZodOptional<z.ZodLiteral<true>>;
|
|
250
|
+
reason: z.ZodOptional<z.ZodEnum<{
|
|
251
|
+
workflow_template_mismatch: "workflow_template_mismatch";
|
|
252
|
+
child_project_dir_invalid: "child_project_dir_invalid";
|
|
253
|
+
build_not_approved: "build_not_approved";
|
|
254
|
+
approval_question_missing: "approval_question_missing";
|
|
255
|
+
}>>;
|
|
204
256
|
runId: z.ZodString;
|
|
205
257
|
attemptId: z.ZodString;
|
|
206
258
|
executionRevision: z.ZodNumber;
|
|
@@ -304,6 +356,24 @@ declare const runSpecSchema: z.ZodObject<{
|
|
|
304
356
|
bindingId: z.ZodString;
|
|
305
357
|
}, z.core.$strict>>;
|
|
306
358
|
}, z.core.$strict>;
|
|
359
|
+
/** What a Run is for, e.g. `plan:<linearProjectId>`; at most one non-closed Run holds a key (`key_busy`). */
|
|
360
|
+
declare const runKeySchema: z.ZodString;
|
|
361
|
+
/** A member start's grant to start, limit and stop its own children (root ADR-0008). */
|
|
362
|
+
declare const delegationSchema: z.ZodObject<{
|
|
363
|
+
maxChildren: z.ZodNumber;
|
|
364
|
+
tokenBudget: z.ZodNumber;
|
|
365
|
+
}, z.core.$strict>;
|
|
366
|
+
/** A child's parent and declared token cap. Required on a delegated start; the Hub refuses it without `tokenCap`. */
|
|
367
|
+
declare const runParentIntentSchema: z.ZodObject<{
|
|
368
|
+
runId: z.ZodString;
|
|
369
|
+
tokenCap: z.ZodOptional<z.ZodNumber>;
|
|
370
|
+
}, z.core.$strict>;
|
|
371
|
+
declare const runParentSchema: z.ZodObject<{
|
|
372
|
+
runId: z.ZodString;
|
|
373
|
+
tokenCap: z.ZodNumber;
|
|
374
|
+
}, z.core.$strict>;
|
|
375
|
+
type Delegation = z.infer<typeof delegationSchema>;
|
|
376
|
+
type RunParent = z.infer<typeof runParentSchema>;
|
|
307
377
|
declare const commandSchema: z.ZodObject<{
|
|
308
378
|
commandId: z.ZodString;
|
|
309
379
|
hubEpoch: z.ZodString;
|
|
@@ -347,6 +417,15 @@ declare const commandSchema: z.ZodObject<{
|
|
|
347
417
|
bindingId: z.ZodString;
|
|
348
418
|
}, z.core.$strict>>;
|
|
349
419
|
}, z.core.$strict>;
|
|
420
|
+
key: z.ZodOptional<z.ZodString>;
|
|
421
|
+
delegation: z.ZodOptional<z.ZodObject<{
|
|
422
|
+
maxChildren: z.ZodNumber;
|
|
423
|
+
tokenBudget: z.ZodNumber;
|
|
424
|
+
}, z.core.$strict>>;
|
|
425
|
+
parent: z.ZodOptional<z.ZodObject<{
|
|
426
|
+
runId: z.ZodString;
|
|
427
|
+
tokenCap: z.ZodOptional<z.ZodNumber>;
|
|
428
|
+
}, z.core.$strict>>;
|
|
350
429
|
}, z.core.$strict>, z.ZodObject<{
|
|
351
430
|
kind: z.ZodLiteral<"cancel">;
|
|
352
431
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -424,6 +503,11 @@ declare const grantSchema: z.ZodObject<{
|
|
|
424
503
|
checkpointId: z.ZodString;
|
|
425
504
|
checksum: z.ZodString;
|
|
426
505
|
}, z.core.$strict>>;
|
|
506
|
+
delegationToken: z.ZodOptional<z.ZodString>;
|
|
507
|
+
parent: z.ZodOptional<z.ZodObject<{
|
|
508
|
+
runId: z.ZodString;
|
|
509
|
+
tokenCap: z.ZodNumber;
|
|
510
|
+
}, z.core.$strict>>;
|
|
427
511
|
}, z.core.$strict>;
|
|
428
512
|
declare const historyRecordSchema: z.ZodObject<{
|
|
429
513
|
eventId: z.ZodString;
|
|
@@ -546,6 +630,7 @@ declare const runnerFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
546
630
|
question: "question";
|
|
547
631
|
guidance: "guidance";
|
|
548
632
|
recovery: "recovery";
|
|
633
|
+
waiting: "waiting";
|
|
549
634
|
}>;
|
|
550
635
|
message: z.ZodString;
|
|
551
636
|
requestId: z.ZodOptional<z.ZodString>;
|
|
@@ -580,6 +665,12 @@ declare const runnerFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
580
665
|
}>;
|
|
581
666
|
historyThrough: z.ZodNumber;
|
|
582
667
|
workspaceUnavailable: z.ZodOptional<z.ZodLiteral<true>>;
|
|
668
|
+
reason: z.ZodOptional<z.ZodEnum<{
|
|
669
|
+
workflow_template_mismatch: "workflow_template_mismatch";
|
|
670
|
+
child_project_dir_invalid: "child_project_dir_invalid";
|
|
671
|
+
build_not_approved: "build_not_approved";
|
|
672
|
+
approval_question_missing: "approval_question_missing";
|
|
673
|
+
}>>;
|
|
583
674
|
runId: z.ZodString;
|
|
584
675
|
attemptId: z.ZodString;
|
|
585
676
|
executionRevision: z.ZodNumber;
|
|
@@ -657,6 +748,15 @@ declare const runViewSchema: z.ZodObject<{
|
|
|
657
748
|
}, z.core.$strict>], "visibility">;
|
|
658
749
|
recordRevision: z.ZodNumber;
|
|
659
750
|
label: z.ZodOptional<z.ZodString>;
|
|
751
|
+
key: z.ZodOptional<z.ZodString>;
|
|
752
|
+
parent: z.ZodOptional<z.ZodObject<{
|
|
753
|
+
runId: z.ZodString;
|
|
754
|
+
tokenCap: z.ZodNumber;
|
|
755
|
+
}, z.core.$strict>>;
|
|
756
|
+
delegation: z.ZodOptional<z.ZodObject<{
|
|
757
|
+
maxChildren: z.ZodNumber;
|
|
758
|
+
tokenBudget: z.ZodNumber;
|
|
759
|
+
}, z.core.$strict>>;
|
|
660
760
|
workflow: z.ZodOptional<z.ZodObject<{
|
|
661
761
|
name: z.ZodString;
|
|
662
762
|
version: z.ZodOptional<z.ZodString>;
|
|
@@ -685,6 +785,7 @@ declare const runViewSchema: z.ZodObject<{
|
|
|
685
785
|
question: "question";
|
|
686
786
|
guidance: "guidance";
|
|
687
787
|
recovery: "recovery";
|
|
788
|
+
waiting: "waiting";
|
|
688
789
|
}>;
|
|
689
790
|
message: z.ZodString;
|
|
690
791
|
requestId: z.ZodOptional<z.ZodString>;
|
|
@@ -737,6 +838,15 @@ declare const runViewSchema: z.ZodObject<{
|
|
|
737
838
|
bindingId: z.ZodString;
|
|
738
839
|
}, z.core.$strict>>;
|
|
739
840
|
}, z.core.$strict>;
|
|
841
|
+
key: z.ZodOptional<z.ZodString>;
|
|
842
|
+
delegation: z.ZodOptional<z.ZodObject<{
|
|
843
|
+
maxChildren: z.ZodNumber;
|
|
844
|
+
tokenBudget: z.ZodNumber;
|
|
845
|
+
}, z.core.$strict>>;
|
|
846
|
+
parent: z.ZodOptional<z.ZodObject<{
|
|
847
|
+
runId: z.ZodString;
|
|
848
|
+
tokenCap: z.ZodOptional<z.ZodNumber>;
|
|
849
|
+
}, z.core.$strict>>;
|
|
740
850
|
}, z.core.$strict>, z.ZodObject<{
|
|
741
851
|
kind: z.ZodLiteral<"cancel">;
|
|
742
852
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -823,6 +933,15 @@ declare const clientFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
823
933
|
bindingId: z.ZodString;
|
|
824
934
|
}, z.core.$strict>>;
|
|
825
935
|
}, z.core.$strict>;
|
|
936
|
+
key: z.ZodOptional<z.ZodString>;
|
|
937
|
+
delegation: z.ZodOptional<z.ZodObject<{
|
|
938
|
+
maxChildren: z.ZodNumber;
|
|
939
|
+
tokenBudget: z.ZodNumber;
|
|
940
|
+
}, z.core.$strict>>;
|
|
941
|
+
parent: z.ZodOptional<z.ZodObject<{
|
|
942
|
+
runId: z.ZodString;
|
|
943
|
+
tokenCap: z.ZodOptional<z.ZodNumber>;
|
|
944
|
+
}, z.core.$strict>>;
|
|
826
945
|
}, z.core.$strict>, z.ZodObject<{
|
|
827
946
|
kind: z.ZodLiteral<"cancel">;
|
|
828
947
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -921,6 +1040,11 @@ declare const checkpointSchema: z.ZodObject<{
|
|
|
921
1040
|
checkpointId: z.ZodString;
|
|
922
1041
|
checksum: z.ZodString;
|
|
923
1042
|
}, z.core.$strict>>;
|
|
1043
|
+
delegationToken: z.ZodOptional<z.ZodString>;
|
|
1044
|
+
parent: z.ZodOptional<z.ZodObject<{
|
|
1045
|
+
runId: z.ZodString;
|
|
1046
|
+
tokenCap: z.ZodNumber;
|
|
1047
|
+
}, z.core.$strict>>;
|
|
924
1048
|
}, z.core.$strict>;
|
|
925
1049
|
gitHead: z.ZodString;
|
|
926
1050
|
gitBase: z.ZodOptional<z.ZodString>;
|
|
@@ -1092,8 +1216,8 @@ declare const runsGoToSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
1092
1216
|
}, z.core.$strict>, z.ZodObject<{
|
|
1093
1217
|
via: z.ZodLiteral<"none">;
|
|
1094
1218
|
reason: z.ZodEnum<{
|
|
1095
|
-
no_runner_available: "no_runner_available";
|
|
1096
1219
|
runner_needs_owner: "runner_needs_owner";
|
|
1220
|
+
no_runner_available: "no_runner_available";
|
|
1097
1221
|
}>;
|
|
1098
1222
|
}, z.core.$strict>]>;
|
|
1099
1223
|
declare const runnerListSchema: z.ZodObject<{
|
|
@@ -1122,8 +1246,8 @@ declare const runnerListSchema: z.ZodObject<{
|
|
|
1122
1246
|
}, z.core.$strict>, z.ZodObject<{
|
|
1123
1247
|
via: z.ZodLiteral<"none">;
|
|
1124
1248
|
reason: z.ZodEnum<{
|
|
1125
|
-
no_runner_available: "no_runner_available";
|
|
1126
1249
|
runner_needs_owner: "runner_needs_owner";
|
|
1250
|
+
no_runner_available: "no_runner_available";
|
|
1127
1251
|
}>;
|
|
1128
1252
|
}, z.core.$strict>]>>;
|
|
1129
1253
|
minimumRunnerVersion: z.ZodOptional<z.ZodString>;
|
|
@@ -1280,4 +1404,4 @@ type ConnectPendingResponse = z.infer<typeof connectPendingResponseSchema>;
|
|
|
1280
1404
|
type TeamDefault = z.infer<typeof teamDefaultSchema>;
|
|
1281
1405
|
type RunsGoTo = z.infer<typeof runsGoToSchema>;
|
|
1282
1406
|
|
|
1283
|
-
export { type Audience, type Checkpoint, type Command, type ConnectAlreadyConnected, type ConnectPendingResponse, type ConnectRedeemRequest, type ConnectRedeemResponse, type ConnectStartRequest, type ConnectStartResponse, type ControlRecord, type ExecutionFact, type Grant, type Harness, type HarnessReadiness, type HistoryRecord, type InstalledWorkflow, type RepositoryBinding, type RepositorySource, type RunView, type RunnerAdoptRequest, type RunnerDisconnectPreview, type RunnerDisconnectResponse, type RunnerFrame, type RunnerList, type RunnerListEntry, type RunnerReadiness, type RunsGoTo, type Scope, type TeamDefault, type WorkflowIdentity, type WorkflowInstallReference, type WorkflowReference, abandonedConversationContinuationCapability, audienceSchema, canonicalJson, checkpointPathSchema, checkpointSchema, clientFrameSchema, commandSchema, connectAlreadyConnectedSchema, connectApproveRequestSchema, connectCodeAlphabet, connectCodeRequestSchema, connectCodeResponseSchema, connectCodeSchema, connectDenyRequestSchema, connectPendingResponseSchema, connectPollRequestSchema, connectRedeemRequestSchema, connectRedeemResponseSchema, connectStartRequestSchema, connectStartResponseSchema, controlRecordSchema, conversationContinuationCapability, grantSchema, harnessReadinessSchema, harnessSchema, historyRecordSchema, hubEpochRequestSchema, installReference, installedWorkflowsSchema, interruptionSchema, permissionAnswerSchema, protocolVersion, readableHistory, readinessFixCommand, repositoryAccessCapability, repositoryBindingSchema, repositoryRefSchema, repositorySourceSchema, repositoryWorkingDirectorySchema, runSpecSchema, runViewSchema, runnerAdoptRequestSchema, runnerDisconnectPreviewSchema, runnerDisconnectRequestSchema, runnerDisconnectResponseSchema, runnerFrameSchema, runnerListEntrySchema, runnerListSchema, runnerReadinessSchema, runnerUpdateCommand, runnerUpdateRequestSchema, runsGoToSchema, sameWorkflow, scopeSchema, secretEnvironmentSchema, sequence, teamDefaultRequestSchema, teamDefaultSchema, workflowIdentitySchema, workflowInstallCapability, workflowName, workflowReferenceSchema, workflowSourceSchema };
|
|
1407
|
+
export { type Audience, type BuildCloseReason, type Checkpoint, 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 RunView, type RunnerAdoptRequest, type RunnerDisconnectPreview, type RunnerDisconnectResponse, type RunnerFrame, type RunnerList, type RunnerListEntry, type RunnerReadiness, type RunsGoTo, type Scope, type TeamDefault, type WorkflowIdentity, type WorkflowInstallReference, type WorkflowReference, abandonedConversationContinuationCapability, audienceSchema, buildCloseReasonSchema, canonicalJson, checkpointPathSchema, checkpointSchema, clientFrameSchema, commandSchema, connectAlreadyConnectedSchema, connectApproveRequestSchema, connectCodeAlphabet, connectCodeRequestSchema, connectCodeResponseSchema, connectCodeSchema, connectDenyRequestSchema, connectPendingResponseSchema, connectPollRequestSchema, connectRedeemRequestSchema, connectRedeemResponseSchema, connectStartRequestSchema, connectStartResponseSchema, controlRecordSchema, conversationContinuationCapability, delegationSchema, delegationTokenPrefix, 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, 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
|
@@ -48,11 +48,15 @@ function readableHistory(records) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// src/v2.ts
|
|
51
|
-
var protocolVersion = { major: 2, minor:
|
|
51
|
+
var protocolVersion = { major: 2, minor: 2 };
|
|
52
52
|
var conversationContinuationCapability = "conversation_continuation";
|
|
53
53
|
var abandonedConversationContinuationCapability = "abandoned_conversation_continuation";
|
|
54
54
|
var repositoryAccessCapability = "repository_checkout_v1";
|
|
55
55
|
var workflowInstallCapability = "workflow_install_v1";
|
|
56
|
+
var runDelegationCapability = "run_delegation_v1";
|
|
57
|
+
var delegationTokenPrefix = "drisp_dlg_";
|
|
58
|
+
var runArtifactNameSchema = z.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
|
|
59
|
+
var runArtifactMaxBytes = 64 * 1024;
|
|
56
60
|
var secretEnvironmentSchema = z.record(
|
|
57
61
|
z.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_]+)$/),
|
|
58
62
|
z.string().regex(/^projects\/[a-zA-Z0-9-]+\/secrets\/[a-zA-Z0-9_-]+\/versions\/(?:latest|[0-9]+)$/)
|
|
@@ -91,7 +95,8 @@ var runnerUpdateCommand = "npm i -g @drisp/cli";
|
|
|
91
95
|
var interruptionSchema = z.strictObject({
|
|
92
96
|
interruptionId: id,
|
|
93
97
|
revision: positive,
|
|
94
|
-
|
|
98
|
+
/** `waiting` (root ADR-0008) is non-human: a Run parked until one of its children closes or parks. */
|
|
99
|
+
kind: z.enum(["permission", "question", "guidance", "recovery", "waiting"]),
|
|
95
100
|
message: z.string().max(16384),
|
|
96
101
|
requestId: id.optional()
|
|
97
102
|
});
|
|
@@ -99,6 +104,29 @@ var workflowIdentitySchema = z.strictObject({
|
|
|
99
104
|
name: z.string().min(1).max(128),
|
|
100
105
|
version: z.string().min(1).max(128).optional()
|
|
101
106
|
});
|
|
107
|
+
var buildCloseReasonSchema = z.enum([
|
|
108
|
+
"workflow_template_mismatch",
|
|
109
|
+
"child_project_dir_invalid",
|
|
110
|
+
"build_not_approved",
|
|
111
|
+
"approval_question_missing"
|
|
112
|
+
]);
|
|
113
|
+
var runCloseReasonSchema = z.enum([
|
|
114
|
+
"execution_terminal",
|
|
115
|
+
"cancelled_before_start",
|
|
116
|
+
"admission_failed",
|
|
117
|
+
"abandoned",
|
|
118
|
+
"managed_startup_timeout",
|
|
119
|
+
"runner_disconnected",
|
|
120
|
+
"runner_needs_owner",
|
|
121
|
+
"runner_not_available",
|
|
122
|
+
"runner_upgrade_required",
|
|
123
|
+
"legacy_succeeded",
|
|
124
|
+
"legacy_failed",
|
|
125
|
+
"legacy_cancelled",
|
|
126
|
+
"legacy_timeout",
|
|
127
|
+
"legacy_force_failed",
|
|
128
|
+
...buildCloseReasonSchema.options
|
|
129
|
+
]);
|
|
102
130
|
var factIdentity = {
|
|
103
131
|
runId: id,
|
|
104
132
|
attemptId: id,
|
|
@@ -143,7 +171,12 @@ var controlRecordSchema = z.discriminatedUnion("kind", [
|
|
|
143
171
|
status: z.enum(["completed", "failed", "cancelled"]),
|
|
144
172
|
historyThrough: sequence,
|
|
145
173
|
/** No setup/harness executed and no workspace was produced; safe to retire without export. */
|
|
146
|
-
workspaceUnavailable: z.literal(true).optional()
|
|
174
|
+
workspaceUnavailable: z.literal(true).optional(),
|
|
175
|
+
/**
|
|
176
|
+
* Why a Build Run failed, as its close reason (docs/specs/build-orchestrator.md). Sent only for a grant with
|
|
177
|
+
* `parent` or `delegationToken`, which only a Hub that knows this field issues.
|
|
178
|
+
*/
|
|
179
|
+
reason: buildCloseReasonSchema.optional()
|
|
147
180
|
}),
|
|
148
181
|
z.strictObject({ kind: z.literal("command.applied"), runId: id, attemptId: id, commandId: id }),
|
|
149
182
|
z.strictObject({
|
|
@@ -207,6 +240,14 @@ var runSpecSchema = z.strictObject({
|
|
|
207
240
|
workflow: workflowReferenceSchema.optional(),
|
|
208
241
|
repository: repositorySourceSchema.optional()
|
|
209
242
|
});
|
|
243
|
+
var runKeySchema = z.string().min(1).max(160);
|
|
244
|
+
var delegationSchema = z.strictObject({
|
|
245
|
+
maxChildren: z.number().int().min(1).max(8),
|
|
246
|
+
tokenBudget: z.number().int().positive().max(Number.MAX_SAFE_INTEGER)
|
|
247
|
+
});
|
|
248
|
+
var tokenCapSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
249
|
+
var runParentIntentSchema = z.strictObject({ runId: id, tokenCap: tokenCapSchema.optional() });
|
|
250
|
+
var runParentSchema = z.strictObject({ runId: id, tokenCap: tokenCapSchema });
|
|
210
251
|
var commandSchema = z.strictObject({
|
|
211
252
|
commandId: id,
|
|
212
253
|
hubEpoch: id,
|
|
@@ -223,7 +264,12 @@ var commandSchema = z.strictObject({
|
|
|
223
264
|
runnerId: id.optional(),
|
|
224
265
|
computeProfileId: id.optional(),
|
|
225
266
|
scope: scopeSchema,
|
|
226
|
-
spec: runSpecSchema
|
|
267
|
+
spec: runSpecSchema,
|
|
268
|
+
key: runKeySchema.optional(),
|
|
269
|
+
/** Member starts only. */
|
|
270
|
+
delegation: delegationSchema.optional(),
|
|
271
|
+
/** Delegated starts only, and required on them. */
|
|
272
|
+
parent: runParentIntentSchema.optional()
|
|
227
273
|
}),
|
|
228
274
|
z.strictObject({ kind: z.literal("cancel") }),
|
|
229
275
|
z.strictObject({ kind: z.literal("abandon") }),
|
|
@@ -266,7 +312,11 @@ var grantSchema = z.strictObject({
|
|
|
266
312
|
closeReason: z.literal("abandoned").optional(),
|
|
267
313
|
checkpoint: z.strictObject({ checkpointId: id, checksum: z.string().regex(/^[a-f0-9]{64}$/) }).optional()
|
|
268
314
|
}).optional(),
|
|
269
|
-
checkpoint: z.strictObject({ checkpointId: id, checksum: z.string().regex(/^[a-f0-9]{64}$/) }).optional()
|
|
315
|
+
checkpoint: z.strictObject({ checkpointId: id, checksum: z.string().regex(/^[a-f0-9]{64}$/) }).optional(),
|
|
316
|
+
/** This attempt's delegation token: only for a Run started with `delegation`, only to a `run_delegation_v1` Runner. */
|
|
317
|
+
delegationToken: z.string().min(32).max(256).optional(),
|
|
318
|
+
/** Copied from the start intent of a delegated child. */
|
|
319
|
+
parent: runParentSchema.optional()
|
|
270
320
|
});
|
|
271
321
|
var historyRecordSchema = z.strictObject({
|
|
272
322
|
eventId: id,
|
|
@@ -325,6 +375,9 @@ var runViewSchema = z.object({
|
|
|
325
375
|
scope: scopeSchema,
|
|
326
376
|
recordRevision: positive,
|
|
327
377
|
label: z.string().max(160).optional(),
|
|
378
|
+
key: runKeySchema.optional(),
|
|
379
|
+
parent: runParentSchema.optional(),
|
|
380
|
+
delegation: delegationSchema.optional(),
|
|
328
381
|
/** Resolved by the runner at start; absent until the Run starts and for runners that predate reporting. */
|
|
329
382
|
workflow: workflowIdentitySchema.optional(),
|
|
330
383
|
execution: z.object({
|
|
@@ -548,6 +601,7 @@ var connectDenyRequestSchema = z.strictObject({ code: z.string().min(8).max(16)
|
|
|
548
601
|
export {
|
|
549
602
|
abandonedConversationContinuationCapability,
|
|
550
603
|
audienceSchema,
|
|
604
|
+
buildCloseReasonSchema,
|
|
551
605
|
canonicalJson,
|
|
552
606
|
checkpointPathSchema,
|
|
553
607
|
checkpointSchema,
|
|
@@ -568,6 +622,8 @@ export {
|
|
|
568
622
|
connectStartResponseSchema,
|
|
569
623
|
controlRecordSchema,
|
|
570
624
|
conversationContinuationCapability,
|
|
625
|
+
delegationSchema,
|
|
626
|
+
delegationTokenPrefix,
|
|
571
627
|
grantSchema,
|
|
572
628
|
harnessReadinessSchema,
|
|
573
629
|
harnessSchema,
|
|
@@ -585,6 +641,13 @@ export {
|
|
|
585
641
|
repositoryRefSchema,
|
|
586
642
|
repositorySourceSchema,
|
|
587
643
|
repositoryWorkingDirectorySchema,
|
|
644
|
+
runArtifactMaxBytes,
|
|
645
|
+
runArtifactNameSchema,
|
|
646
|
+
runCloseReasonSchema,
|
|
647
|
+
runDelegationCapability,
|
|
648
|
+
runKeySchema,
|
|
649
|
+
runParentIntentSchema,
|
|
650
|
+
runParentSchema,
|
|
588
651
|
runSpecSchema,
|
|
589
652
|
runViewSchema,
|
|
590
653
|
runnerAdoptRequestSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drisp/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
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",
|
|
@@ -332,6 +332,31 @@
|
|
|
332
332
|
"checksum"
|
|
333
333
|
],
|
|
334
334
|
"additionalProperties": false
|
|
335
|
+
},
|
|
336
|
+
"delegationToken": {
|
|
337
|
+
"type": "string",
|
|
338
|
+
"minLength": 32,
|
|
339
|
+
"maxLength": 256
|
|
340
|
+
},
|
|
341
|
+
"parent": {
|
|
342
|
+
"type": "object",
|
|
343
|
+
"properties": {
|
|
344
|
+
"runId": {
|
|
345
|
+
"type": "string",
|
|
346
|
+
"minLength": 1,
|
|
347
|
+
"maxLength": 160
|
|
348
|
+
},
|
|
349
|
+
"tokenCap": {
|
|
350
|
+
"type": "integer",
|
|
351
|
+
"exclusiveMinimum": 0,
|
|
352
|
+
"maximum": 9007199254740991
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"required": [
|
|
356
|
+
"runId",
|
|
357
|
+
"tokenCap"
|
|
358
|
+
],
|
|
359
|
+
"additionalProperties": false
|
|
335
360
|
}
|
|
336
361
|
},
|
|
337
362
|
"required": [
|
package/schema/v2/client.json
CHANGED
|
@@ -293,6 +293,50 @@
|
|
|
293
293
|
"harness"
|
|
294
294
|
],
|
|
295
295
|
"additionalProperties": false
|
|
296
|
+
},
|
|
297
|
+
"key": {
|
|
298
|
+
"type": "string",
|
|
299
|
+
"minLength": 1,
|
|
300
|
+
"maxLength": 160
|
|
301
|
+
},
|
|
302
|
+
"delegation": {
|
|
303
|
+
"type": "object",
|
|
304
|
+
"properties": {
|
|
305
|
+
"maxChildren": {
|
|
306
|
+
"type": "integer",
|
|
307
|
+
"minimum": 1,
|
|
308
|
+
"maximum": 8
|
|
309
|
+
},
|
|
310
|
+
"tokenBudget": {
|
|
311
|
+
"type": "integer",
|
|
312
|
+
"exclusiveMinimum": 0,
|
|
313
|
+
"maximum": 9007199254740991
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"required": [
|
|
317
|
+
"maxChildren",
|
|
318
|
+
"tokenBudget"
|
|
319
|
+
],
|
|
320
|
+
"additionalProperties": false
|
|
321
|
+
},
|
|
322
|
+
"parent": {
|
|
323
|
+
"type": "object",
|
|
324
|
+
"properties": {
|
|
325
|
+
"runId": {
|
|
326
|
+
"type": "string",
|
|
327
|
+
"minLength": 1,
|
|
328
|
+
"maxLength": 160
|
|
329
|
+
},
|
|
330
|
+
"tokenCap": {
|
|
331
|
+
"type": "integer",
|
|
332
|
+
"exclusiveMinimum": 0,
|
|
333
|
+
"maximum": 9007199254740991
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
"required": [
|
|
337
|
+
"runId"
|
|
338
|
+
],
|
|
339
|
+
"additionalProperties": false
|
|
296
340
|
}
|
|
297
341
|
},
|
|
298
342
|
"required": [
|
package/schema/v2/command.json
CHANGED
|
@@ -230,6 +230,50 @@
|
|
|
230
230
|
"harness"
|
|
231
231
|
],
|
|
232
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": 8
|
|
246
|
+
},
|
|
247
|
+
"tokenBudget": {
|
|
248
|
+
"type": "integer",
|
|
249
|
+
"exclusiveMinimum": 0,
|
|
250
|
+
"maximum": 9007199254740991
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"required": [
|
|
254
|
+
"maxChildren",
|
|
255
|
+
"tokenBudget"
|
|
256
|
+
],
|
|
257
|
+
"additionalProperties": false
|
|
258
|
+
},
|
|
259
|
+
"parent": {
|
|
260
|
+
"type": "object",
|
|
261
|
+
"properties": {
|
|
262
|
+
"runId": {
|
|
263
|
+
"type": "string",
|
|
264
|
+
"minLength": 1,
|
|
265
|
+
"maxLength": 160
|
|
266
|
+
},
|
|
267
|
+
"tokenCap": {
|
|
268
|
+
"type": "integer",
|
|
269
|
+
"exclusiveMinimum": 0,
|
|
270
|
+
"maximum": 9007199254740991
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"required": [
|
|
274
|
+
"runId"
|
|
275
|
+
],
|
|
276
|
+
"additionalProperties": false
|
|
233
277
|
}
|
|
234
278
|
},
|
|
235
279
|
"required": [
|
package/schema/v2/grant.json
CHANGED
|
@@ -283,6 +283,31 @@
|
|
|
283
283
|
"checksum"
|
|
284
284
|
],
|
|
285
285
|
"additionalProperties": false
|
|
286
|
+
},
|
|
287
|
+
"delegationToken": {
|
|
288
|
+
"type": "string",
|
|
289
|
+
"minLength": 32,
|
|
290
|
+
"maxLength": 256
|
|
291
|
+
},
|
|
292
|
+
"parent": {
|
|
293
|
+
"type": "object",
|
|
294
|
+
"properties": {
|
|
295
|
+
"runId": {
|
|
296
|
+
"type": "string",
|
|
297
|
+
"minLength": 1,
|
|
298
|
+
"maxLength": 160
|
|
299
|
+
},
|
|
300
|
+
"tokenCap": {
|
|
301
|
+
"type": "integer",
|
|
302
|
+
"exclusiveMinimum": 0,
|
|
303
|
+
"maximum": 9007199254740991
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"required": [
|
|
307
|
+
"runId",
|
|
308
|
+
"tokenCap"
|
|
309
|
+
],
|
|
310
|
+
"additionalProperties": false
|
|
286
311
|
}
|
|
287
312
|
},
|
|
288
313
|
"required": [
|
package/schema/v2/run.json
CHANGED
|
@@ -67,6 +67,51 @@
|
|
|
67
67
|
"type": "string",
|
|
68
68
|
"maxLength": 160
|
|
69
69
|
},
|
|
70
|
+
"key": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"minLength": 1,
|
|
73
|
+
"maxLength": 160
|
|
74
|
+
},
|
|
75
|
+
"parent": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"runId": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"minLength": 1,
|
|
81
|
+
"maxLength": 160
|
|
82
|
+
},
|
|
83
|
+
"tokenCap": {
|
|
84
|
+
"type": "integer",
|
|
85
|
+
"exclusiveMinimum": 0,
|
|
86
|
+
"maximum": 9007199254740991
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"required": [
|
|
90
|
+
"runId",
|
|
91
|
+
"tokenCap"
|
|
92
|
+
],
|
|
93
|
+
"additionalProperties": false
|
|
94
|
+
},
|
|
95
|
+
"delegation": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"properties": {
|
|
98
|
+
"maxChildren": {
|
|
99
|
+
"type": "integer",
|
|
100
|
+
"minimum": 1,
|
|
101
|
+
"maximum": 8
|
|
102
|
+
},
|
|
103
|
+
"tokenBudget": {
|
|
104
|
+
"type": "integer",
|
|
105
|
+
"exclusiveMinimum": 0,
|
|
106
|
+
"maximum": 9007199254740991
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": [
|
|
110
|
+
"maxChildren",
|
|
111
|
+
"tokenBudget"
|
|
112
|
+
],
|
|
113
|
+
"additionalProperties": false
|
|
114
|
+
},
|
|
70
115
|
"workflow": {
|
|
71
116
|
"type": "object",
|
|
72
117
|
"properties": {
|
|
@@ -147,7 +192,8 @@
|
|
|
147
192
|
"permission",
|
|
148
193
|
"question",
|
|
149
194
|
"guidance",
|
|
150
|
-
"recovery"
|
|
195
|
+
"recovery",
|
|
196
|
+
"waiting"
|
|
151
197
|
]
|
|
152
198
|
},
|
|
153
199
|
"message": {
|
|
@@ -410,6 +456,50 @@
|
|
|
410
456
|
"harness"
|
|
411
457
|
],
|
|
412
458
|
"additionalProperties": false
|
|
459
|
+
},
|
|
460
|
+
"key": {
|
|
461
|
+
"type": "string",
|
|
462
|
+
"minLength": 1,
|
|
463
|
+
"maxLength": 160
|
|
464
|
+
},
|
|
465
|
+
"delegation": {
|
|
466
|
+
"type": "object",
|
|
467
|
+
"properties": {
|
|
468
|
+
"maxChildren": {
|
|
469
|
+
"type": "integer",
|
|
470
|
+
"minimum": 1,
|
|
471
|
+
"maximum": 8
|
|
472
|
+
},
|
|
473
|
+
"tokenBudget": {
|
|
474
|
+
"type": "integer",
|
|
475
|
+
"exclusiveMinimum": 0,
|
|
476
|
+
"maximum": 9007199254740991
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
"required": [
|
|
480
|
+
"maxChildren",
|
|
481
|
+
"tokenBudget"
|
|
482
|
+
],
|
|
483
|
+
"additionalProperties": false
|
|
484
|
+
},
|
|
485
|
+
"parent": {
|
|
486
|
+
"type": "object",
|
|
487
|
+
"properties": {
|
|
488
|
+
"runId": {
|
|
489
|
+
"type": "string",
|
|
490
|
+
"minLength": 1,
|
|
491
|
+
"maxLength": 160
|
|
492
|
+
},
|
|
493
|
+
"tokenCap": {
|
|
494
|
+
"type": "integer",
|
|
495
|
+
"exclusiveMinimum": 0,
|
|
496
|
+
"maximum": 9007199254740991
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
"required": [
|
|
500
|
+
"runId"
|
|
501
|
+
],
|
|
502
|
+
"additionalProperties": false
|
|
413
503
|
}
|
|
414
504
|
},
|
|
415
505
|
"required": [
|
package/schema/v2/runner.json
CHANGED
|
@@ -614,7 +614,8 @@
|
|
|
614
614
|
"permission",
|
|
615
615
|
"question",
|
|
616
616
|
"guidance",
|
|
617
|
-
"recovery"
|
|
617
|
+
"recovery",
|
|
618
|
+
"waiting"
|
|
618
619
|
]
|
|
619
620
|
},
|
|
620
621
|
"message": {
|
|
@@ -777,6 +778,15 @@
|
|
|
777
778
|
"workspaceUnavailable": {
|
|
778
779
|
"type": "boolean",
|
|
779
780
|
"const": true
|
|
781
|
+
},
|
|
782
|
+
"reason": {
|
|
783
|
+
"type": "string",
|
|
784
|
+
"enum": [
|
|
785
|
+
"workflow_template_mismatch",
|
|
786
|
+
"child_project_dir_invalid",
|
|
787
|
+
"build_not_approved",
|
|
788
|
+
"approval_question_missing"
|
|
789
|
+
]
|
|
780
790
|
}
|
|
781
791
|
},
|
|
782
792
|
"required": [
|