codex-workflow-v2 2.0.0-beta.12.9 → 2.0.0-beta.13
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/README.md +58 -16
- package/dist/reviewer-runtime-build.json +1092 -0
- package/dist/src/alpha6/check-support-anchor.d.ts +24 -0
- package/dist/src/alpha6/check-support-anchor.js +102 -0
- package/dist/src/alpha6/check-support-anchor.js.map +1 -0
- package/dist/src/alpha6/component-owner.d.ts +28 -0
- package/dist/src/alpha6/component-owner.js +95 -0
- package/dist/src/alpha6/component-owner.js.map +1 -0
- package/dist/src/alpha6/downstream-proof.js +4 -2
- package/dist/src/alpha6/downstream-proof.js.map +1 -1
- package/dist/src/alpha6/mechanical-feasibility.js +42 -12
- package/dist/src/alpha6/mechanical-feasibility.js.map +1 -1
- package/dist/src/alpha6/milestone.d.ts +6 -2
- package/dist/src/alpha6/milestone.js +164 -10
- package/dist/src/alpha6/milestone.js.map +1 -1
- package/dist/src/alpha6/npm-check-contract.d.ts +11 -0
- package/dist/src/alpha6/npm-check-contract.js +36 -0
- package/dist/src/alpha6/npm-check-contract.js.map +1 -0
- package/dist/src/alpha6/plan-integrity.js +157 -27
- package/dist/src/alpha6/plan-integrity.js.map +1 -1
- package/dist/src/alpha6/plan-risk.js +3 -1
- package/dist/src/alpha6/plan-risk.js.map +1 -1
- package/dist/src/alpha6/remediation-cause.d.ts +13 -0
- package/dist/src/alpha6/remediation-cause.js +77 -0
- package/dist/src/alpha6/remediation-cause.js.map +1 -0
- package/dist/src/alpha6/remediation.d.ts +15 -4
- package/dist/src/alpha6/remediation.js +430 -67
- package/dist/src/alpha6/remediation.js.map +1 -1
- package/dist/src/alpha6/review.js +34 -4
- package/dist/src/alpha6/review.js.map +1 -1
- package/dist/src/artifacts.js +6 -0
- package/dist/src/artifacts.js.map +1 -1
- package/dist/src/cli-actions.d.ts +25 -0
- package/dist/src/cli-actions.js +109 -0
- package/dist/src/cli-actions.js.map +1 -0
- package/dist/src/cli.js +216 -258
- package/dist/src/cli.js.map +1 -1
- package/dist/src/contracts.d.ts +166 -5
- package/dist/src/credential-transport.d.ts +38 -0
- package/dist/src/credential-transport.js +156 -0
- package/dist/src/credential-transport.js.map +1 -0
- package/dist/src/dependency-provenance.d.ts +23 -2
- package/dist/src/dependency-provenance.js +221 -34
- package/dist/src/dependency-provenance.js.map +1 -1
- package/dist/src/domain/completed-step-carryover.d.ts +13 -0
- package/dist/src/domain/completed-step-carryover.js +71 -0
- package/dist/src/domain/completed-step-carryover.js.map +1 -0
- package/dist/src/domain/validation.d.ts +9 -1
- package/dist/src/domain/validation.js +86 -0
- package/dist/src/domain/validation.js.map +1 -1
- package/dist/src/gateway-handshake.d.ts +11 -0
- package/dist/src/gateway-handshake.js +92 -0
- package/dist/src/gateway-handshake.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lifecycle/corrective-replan-binding-manifest.d.ts +5 -0
- package/dist/src/lifecycle/corrective-replan-binding-manifest.js +9 -0
- package/dist/src/lifecycle/corrective-replan-binding-manifest.js.map +1 -1
- package/dist/src/lifecycle/corrective-replan.js +1 -1
- package/dist/src/lifecycle/corrective-replan.js.map +1 -1
- package/dist/src/lifecycle/semantic-registry.js +1 -1
- package/dist/src/observation.js +1 -2
- package/dist/src/observation.js.map +1 -1
- package/dist/src/observed-routes.d.ts +114 -0
- package/dist/src/observed-routes.js +545 -0
- package/dist/src/observed-routes.js.map +1 -0
- package/dist/src/operational-contract.d.ts +26 -0
- package/dist/src/operational-contract.js +94 -0
- package/dist/src/operational-contract.js.map +1 -0
- package/dist/src/reviewer.d.ts +218 -8
- package/dist/src/reviewer.js +927 -25
- package/dist/src/reviewer.js.map +1 -1
- package/dist/src/state/corrective-replan-executor.js +18 -15
- package/dist/src/state/corrective-replan-executor.js.map +1 -1
- package/dist/src/state/corrective-replan-public.js +35 -10
- package/dist/src/state/corrective-replan-public.js.map +1 -1
- package/dist/src/state/corrective-replan-transaction.js +12 -4
- package/dist/src/state/corrective-replan-transaction.js.map +1 -1
- package/dist/src/state/corrective-yield-transaction.js +11 -2
- package/dist/src/state/corrective-yield-transaction.js.map +1 -1
- package/dist/src/state/lock.d.ts +1 -0
- package/dist/src/state/lock.js +24 -0
- package/dist/src/state/lock.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/src/workflow.d.ts +65 -4
- package/dist/src/workflow.js +1704 -155
- package/dist/src/workflow.js.map +1 -1
- package/docs/autonomy-guardrails.md +41 -14
- package/docs/delegated-approval.md +6 -1
- package/docs/development-flow.md +42 -12
- package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
- package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
- package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
- package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +181 -22
- package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +148 -26
- package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +326 -52
- package/docs/problem-briefs/01-pre-implementation-integrity.md +11 -7
- package/docs/problem-briefs/04-task-dependency-and-structural-replacement-integrity.md +13 -6
- package/docs/problem-briefs/README.md +11 -11
- package/docs/release.md +83 -9
- package/docs/updating-existing-project.md +205 -0
- package/docs/validation-report.md +156 -99
- package/package.json +12 -3
- package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +42 -1
- package/schemas/authorization-event.schema.json +10 -3
- package/schemas/corrective-decision-event.schema.json +164 -9
- package/schemas/corrective-replan-credentials.private.schema.json +4 -2
- package/schemas/milestone-scope-change-event.schema.json +25 -1
- package/schemas/remediation-event.schema.json +17 -1
- package/schemas/review-result.schema.json +1 -0
- package/schemas/step-review-event.schema.json +15 -0
- package/schemas/task.schema.json +61 -1
- package/schemas/transition-definition.schema.json +8 -0
package/dist/src/cli.js
CHANGED
|
@@ -4,102 +4,21 @@ import path from 'node:path';
|
|
|
4
4
|
import process from 'node:process';
|
|
5
5
|
import { defaultTaskWorkerActor } from './alpha6/handoff.js';
|
|
6
6
|
import { assertCliSuccessCredentialSafety, projectCliErrorMessage, projectCliErrorValue, UnsafeCredentialOutputError, } from './credential-output.js';
|
|
7
|
+
import { assertNoLegacyCredentialArguments, consumeCredentialReference, issueCredentialReference, resolveCredentialReference, } from './credential-transport.js';
|
|
7
8
|
import { integrationDiagnostics } from './diagnostics.js';
|
|
8
9
|
import { WorkflowError } from './errors.js';
|
|
9
10
|
import { prepareGraphView } from './graph.js';
|
|
10
11
|
import { migrateState } from './migration.js';
|
|
11
12
|
import { changedFiles, currentBranch, isClean, resolveRepositoryIdentity } from './repository.js';
|
|
12
13
|
import { launchStrictReviewer } from './reviewer.js';
|
|
13
|
-
import { WorkflowService } from './workflow.js';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
const CLI_ACTIONS = {
|
|
17
|
-
gateway: ['handshake'],
|
|
18
|
-
update: [
|
|
19
|
-
'preflight',
|
|
20
|
-
'rescue-preflight',
|
|
21
|
-
'dependency-provenance-preflight',
|
|
22
|
-
'dependency-provenance-recover',
|
|
23
|
-
'historical-step-dependency-preflight',
|
|
24
|
-
'historical-step-dependency-recover',
|
|
25
|
-
'downstream-proof-dependency-preflight',
|
|
26
|
-
'downstream-proof-dependency-recover',
|
|
27
|
-
'downstream-proof-replan-update-preflight',
|
|
28
|
-
'downstream-proof-replan-dependency-preflight',
|
|
29
|
-
'downstream-proof-replan-dependency-recover',
|
|
30
|
-
],
|
|
31
|
-
delegation: ['prepare', 'grant', 'list', 'show', 'revoke'],
|
|
32
|
-
'project-memory': ['scan', 'show', 'status', 'approve', 'reconcile'],
|
|
33
|
-
state: ['migrate', 'adoption-prepare', 'adoption-apply'],
|
|
34
|
-
graph: ['prepare', 'status', 'refresh-request', 'bind', 'fallback'],
|
|
35
|
-
discovery: ['start', 'update', 'show', 'materialize'],
|
|
36
|
-
task: [
|
|
37
|
-
'show',
|
|
38
|
-
'replacement-materialize',
|
|
39
|
-
'plan-set',
|
|
40
|
-
'knowledge-rebind',
|
|
41
|
-
'context-refresh',
|
|
42
|
-
'authorize',
|
|
43
|
-
'plan-risk-audit',
|
|
44
|
-
'start',
|
|
45
|
-
'run',
|
|
46
|
-
'step-complete',
|
|
47
|
-
'submit',
|
|
48
|
-
'review-record',
|
|
49
|
-
'review-launch',
|
|
50
|
-
'review-packet',
|
|
51
|
-
'review-sealed-record',
|
|
52
|
-
'step-review',
|
|
53
|
-
'step-review-packet',
|
|
54
|
-
'step-review-record',
|
|
55
|
-
'corrective-decision-recover',
|
|
56
|
-
'remediation-mode-recover',
|
|
57
|
-
'plan-integrity-recover',
|
|
58
|
-
'downstream-proof-recover',
|
|
59
|
-
'downstream-proof-replan-recover',
|
|
60
|
-
'stop-override-prepare',
|
|
61
|
-
'stop-override-apply',
|
|
62
|
-
'corrective-decision',
|
|
63
|
-
'corrective-yield',
|
|
64
|
-
'corrective-yield-recover',
|
|
65
|
-
'corrective-replan-prepare',
|
|
66
|
-
'corrective-replan-confirm',
|
|
67
|
-
'corrective-replan-execute',
|
|
68
|
-
'corrective-replan-recover',
|
|
69
|
-
'historical-step-provenance-preflight',
|
|
70
|
-
'historical-step-provenance-recover',
|
|
71
|
-
'handoff',
|
|
72
|
-
'handoff-prepare',
|
|
73
|
-
'handoff-replace',
|
|
74
|
-
'handoff-show',
|
|
75
|
-
'claim',
|
|
76
|
-
'writer-credential-replace',
|
|
77
|
-
'handback',
|
|
78
|
-
'handback-create',
|
|
79
|
-
'result-set',
|
|
80
|
-
'accept',
|
|
81
|
-
'sync-base',
|
|
82
|
-
'merge',
|
|
83
|
-
'merge-confirm',
|
|
84
|
-
],
|
|
85
|
-
milestone: [
|
|
86
|
-
'recover',
|
|
87
|
-
'show',
|
|
88
|
-
'progress',
|
|
89
|
-
'plan-set',
|
|
90
|
-
'scope-change-prepare',
|
|
91
|
-
'scope-change-apply',
|
|
92
|
-
'autonomy-prepare',
|
|
93
|
-
'autonomy-grant',
|
|
94
|
-
'autonomy-evolve',
|
|
95
|
-
'authorize',
|
|
96
|
-
'validate',
|
|
97
|
-
'accept',
|
|
98
|
-
'cancel',
|
|
99
|
-
],
|
|
100
|
-
locks: ['inspect', 'repair'],
|
|
101
|
-
};
|
|
14
|
+
import { WorkflowService, } from './workflow.js';
|
|
15
|
+
import { gatewayHandshake } from './gateway-handshake.js';
|
|
16
|
+
import { CLI_ACTIONS } from './cli-actions.js';
|
|
102
17
|
const CLI_HELP_SPECS = {
|
|
18
|
+
'milestone remediation-materialize': {
|
|
19
|
+
requiredOptions: ['--id', '--expected-revision', '--task', '--expected-task-revision', '--file'],
|
|
20
|
+
optionalOptions: ['--repo', '--json'],
|
|
21
|
+
},
|
|
103
22
|
'update dependency-provenance-preflight': {
|
|
104
23
|
requiredOptions: ['--id'],
|
|
105
24
|
optionalOptions: ['--repo', '--json'],
|
|
@@ -144,6 +63,18 @@ const CLI_HELP_SPECS = {
|
|
|
144
63
|
requiredOptions: ['--id', '--expected-revision', '--actor', '--reason'],
|
|
145
64
|
optionalOptions: ['--repo', '--json'],
|
|
146
65
|
},
|
|
66
|
+
'update plan-integrity-update-preflight': {
|
|
67
|
+
requiredOptions: ['--id'],
|
|
68
|
+
optionalOptions: ['--repo', '--json'],
|
|
69
|
+
},
|
|
70
|
+
'update plan-integrity-dependency-preflight': {
|
|
71
|
+
requiredOptions: ['--id'],
|
|
72
|
+
optionalOptions: ['--repo', '--json'],
|
|
73
|
+
},
|
|
74
|
+
'update plan-integrity-dependency-recover': {
|
|
75
|
+
requiredOptions: ['--id', '--expected-revision', '--actor', '--reason'],
|
|
76
|
+
optionalOptions: ['--repo', '--json'],
|
|
77
|
+
},
|
|
147
78
|
'milestone progress': {
|
|
148
79
|
requiredOptions: ['--id'],
|
|
149
80
|
optionalOptions: ['--repo', '--json'],
|
|
@@ -166,22 +97,34 @@ const CLI_HELP_SPECS = {
|
|
|
166
97
|
},
|
|
167
98
|
'task handoff-replace': {
|
|
168
99
|
requiredOptions: ['--id', '--expected-revision', '--actor', '--target-actor', '--reason'],
|
|
169
|
-
optionalOptions: ['--delegation-grant', '--expires-at', '--repo', '--json'],
|
|
100
|
+
optionalOptions: ['--writer-credential-ref', '--delegation-grant', '--expires-at', '--repo', '--json'],
|
|
101
|
+
},
|
|
102
|
+
'task handoff': {
|
|
103
|
+
requiredOptions: ['--id', '--expected-revision', '--actor', '--reason'],
|
|
104
|
+
optionalOptions: ['--target-actor', '--writer-credential-ref', '--delegation-grant', '--expires-at', '--repo', '--json'],
|
|
105
|
+
},
|
|
106
|
+
'task handoff-prepare': {
|
|
107
|
+
requiredOptions: ['--id', '--expected-revision', '--actor', '--reason'],
|
|
108
|
+
optionalOptions: ['--target-actor', '--writer-credential-ref', '--delegation-grant', '--expires-at', '--repo', '--json'],
|
|
109
|
+
},
|
|
110
|
+
'task claim': {
|
|
111
|
+
requiredOptions: ['--id', '--expected-revision', '--actor', '--claim-credential-ref'],
|
|
112
|
+
optionalOptions: ['--writer-credential-ref', '--repo', '--json'],
|
|
170
113
|
},
|
|
171
114
|
'task writer-credential-replace': {
|
|
172
115
|
requiredOptions: ['--id', '--expected-revision', '--actor'],
|
|
173
116
|
optionalOptions: ['--repo', '--json'],
|
|
174
117
|
},
|
|
175
118
|
'task corrective-yield': {
|
|
176
|
-
requiredOptions: ['--id', '--expected-revision', '--actor', '--writer-
|
|
119
|
+
requiredOptions: ['--id', '--expected-revision', '--actor', '--writer-credential-ref', '--reason'],
|
|
177
120
|
optionalOptions: ['--repo', '--json'],
|
|
178
121
|
},
|
|
179
122
|
'task plan-integrity-recover': {
|
|
180
123
|
requiredOptions: ['--id', '--step', '--expected-revision', '--actor'],
|
|
181
|
-
optionalOptions: ['--writer-
|
|
124
|
+
optionalOptions: ['--writer-credential-ref', '--repo', '--json'],
|
|
182
125
|
},
|
|
183
126
|
'task downstream-proof-recover': {
|
|
184
|
-
requiredOptions: ['--id', '--expected-revision', '--actor', '--writer-
|
|
127
|
+
requiredOptions: ['--id', '--expected-revision', '--actor', '--writer-credential-ref', '--reason'],
|
|
185
128
|
optionalOptions: ['--repo', '--json'],
|
|
186
129
|
},
|
|
187
130
|
'task downstream-proof-replan-recover': {
|
|
@@ -226,38 +169,38 @@ const CLI_HELP_SPECS = {
|
|
|
226
169
|
},
|
|
227
170
|
'task run': {
|
|
228
171
|
requiredOptions: ['--id', '--step', '--expected-revision'],
|
|
229
|
-
optionalOptions: ['--owner', '--writer-
|
|
172
|
+
optionalOptions: ['--owner', '--writer-credential-ref', '--repo', '--json'],
|
|
230
173
|
},
|
|
231
174
|
'task step-complete': {
|
|
232
|
-
requiredOptions: ['--id', '--step', '--expected-revision', '--writer-
|
|
175
|
+
requiredOptions: ['--id', '--step', '--expected-revision', '--writer-credential-ref'],
|
|
233
176
|
optionalOptions: ['--note', '--actor', '--repo', '--json'],
|
|
234
177
|
},
|
|
235
178
|
'task submit': {
|
|
236
|
-
requiredOptions: ['--id', '--expected-revision', '--writer-
|
|
179
|
+
requiredOptions: ['--id', '--expected-revision', '--writer-credential-ref'],
|
|
237
180
|
optionalOptions: ['--actor', '--repo', '--json'],
|
|
238
181
|
},
|
|
239
182
|
'task review-launch': {
|
|
240
183
|
requiredOptions: ['--id', '--expected-revision'],
|
|
241
|
-
optionalOptions: ['--actor', '--writer-
|
|
184
|
+
optionalOptions: ['--actor', '--writer-credential-ref', '--repo', '--json'],
|
|
242
185
|
},
|
|
243
186
|
'task review-packet': {
|
|
244
|
-
requiredOptions: ['--id', '--expected-revision'],
|
|
187
|
+
requiredOptions: ['--id', '--expected-revision', '--review-mode'],
|
|
245
188
|
optionalOptions: ['--repo', '--json'],
|
|
246
189
|
},
|
|
247
190
|
'task review-sealed-record': {
|
|
248
191
|
requiredOptions: ['--id', '--expected-revision', '--actor', '--file'],
|
|
249
|
-
optionalOptions: ['--writer-
|
|
192
|
+
optionalOptions: ['--writer-credential-ref', '--repo', '--json'],
|
|
250
193
|
},
|
|
251
194
|
'task step-review-packet': {
|
|
252
|
-
requiredOptions: ['--id', '--step', '--expected-revision'],
|
|
195
|
+
requiredOptions: ['--id', '--step', '--expected-revision', '--review-mode'],
|
|
253
196
|
optionalOptions: ['--repo', '--json'],
|
|
254
197
|
},
|
|
255
198
|
'task step-review-record': {
|
|
256
199
|
requiredOptions: ['--id', '--step', '--expected-revision', '--actor', '--file'],
|
|
257
|
-
optionalOptions: ['--writer-
|
|
200
|
+
optionalOptions: ['--writer-credential-ref', '--repo', '--json'],
|
|
258
201
|
},
|
|
259
202
|
'task result-set': {
|
|
260
|
-
requiredOptions: ['--id', '--expected-revision', '--summary', '--writer-
|
|
203
|
+
requiredOptions: ['--id', '--expected-revision', '--summary', '--writer-credential-ref'],
|
|
261
204
|
optionalOptions: ['--actor', '--limitation', '--repo', '--json'],
|
|
262
205
|
},
|
|
263
206
|
'task accept': {
|
|
@@ -265,11 +208,11 @@ const CLI_HELP_SPECS = {
|
|
|
265
208
|
optionalOptions: ['--actor', '--delegation-grant', '--repo', '--json'],
|
|
266
209
|
},
|
|
267
210
|
'task merge': {
|
|
268
|
-
requiredOptions: ['--id', '--expected-revision', '--writer-
|
|
211
|
+
requiredOptions: ['--id', '--expected-revision', '--writer-credential-ref'],
|
|
269
212
|
optionalOptions: ['--actor', '--repo', '--json'],
|
|
270
213
|
},
|
|
271
214
|
'task merge-confirm': {
|
|
272
|
-
requiredOptions: ['--id', '--expected-revision', '--writer-
|
|
215
|
+
requiredOptions: ['--id', '--expected-revision', '--writer-credential-ref'],
|
|
273
216
|
optionalOptions: ['--actor', '--repo', '--json'],
|
|
274
217
|
},
|
|
275
218
|
};
|
|
@@ -298,6 +241,13 @@ function parseArguments(argv) {
|
|
|
298
241
|
function option(args, name) {
|
|
299
242
|
return args.options.get(name)?.at(-1);
|
|
300
243
|
}
|
|
244
|
+
function reviewMode(args) {
|
|
245
|
+
const value = required(args, 'review-mode');
|
|
246
|
+
if (value !== 'ordinary' && value !== 'security') {
|
|
247
|
+
throw new WorkflowError('INVALID_ARGUMENT', '--review-mode must be ordinary or security.');
|
|
248
|
+
}
|
|
249
|
+
return value;
|
|
250
|
+
}
|
|
301
251
|
function cliHelp(args) {
|
|
302
252
|
const [noun, action] = args.positionals;
|
|
303
253
|
if (!noun) {
|
|
@@ -319,9 +269,11 @@ function cliHelp(args) {
|
|
|
319
269
|
command: noun,
|
|
320
270
|
usage: noun === 'next'
|
|
321
271
|
? 'codex-workflow next [--task <task-id>] [--repo <path>] [--json]'
|
|
322
|
-
:
|
|
272
|
+
: noun === 'status'
|
|
273
|
+
? 'codex-workflow status [--full] [--repo <path>] [--json]'
|
|
274
|
+
: `codex-workflow ${noun} [--repo <path>] [--json]`,
|
|
323
275
|
requiredOptions: [],
|
|
324
|
-
optionalOptions: [...taskSelector, '--repo', '--json'],
|
|
276
|
+
optionalOptions: [...taskSelector, ...(noun === 'status' ? ['--full'] : []), '--repo', '--json'],
|
|
325
277
|
exactOptionContractAvailable: true,
|
|
326
278
|
};
|
|
327
279
|
}
|
|
@@ -421,67 +373,70 @@ function stdinJson() {
|
|
|
421
373
|
function repository(args) {
|
|
422
374
|
return path.resolve(option(args, 'repo') ?? '.');
|
|
423
375
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
'
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
376
|
+
const WRITER_CREDENTIAL_ACTIONS = [
|
|
377
|
+
'task run',
|
|
378
|
+
'task step-complete',
|
|
379
|
+
'task submit',
|
|
380
|
+
'task review-record',
|
|
381
|
+
'task review-launch',
|
|
382
|
+
'task review-sealed-record',
|
|
383
|
+
'task step-review',
|
|
384
|
+
'task step-review-record',
|
|
385
|
+
'task corrective-decision-recover',
|
|
386
|
+
'task remediation-mode-recover',
|
|
387
|
+
'task plan-integrity-recover',
|
|
388
|
+
'task downstream-proof-recover',
|
|
389
|
+
'task corrective-decision',
|
|
390
|
+
'task corrective-yield',
|
|
391
|
+
'task handoff',
|
|
392
|
+
'task handoff-prepare',
|
|
393
|
+
'task handoff-replace',
|
|
394
|
+
'task claim',
|
|
395
|
+
'task handback',
|
|
396
|
+
'task handback-create',
|
|
397
|
+
'task result-set',
|
|
398
|
+
'task merge',
|
|
399
|
+
'task merge-confirm',
|
|
400
|
+
];
|
|
401
|
+
function credentialToken(workflow, repo, args, kind, action, entityId, actor, requiredReference) {
|
|
402
|
+
const optionName = kind === 'writer-lease' ? 'writer-credential-ref' : 'claim-credential-ref';
|
|
403
|
+
const reference = option(args, optionName);
|
|
404
|
+
if (!reference) {
|
|
405
|
+
if (requiredReference) {
|
|
406
|
+
throw new WorkflowError('INVALID_ARGUMENT', `Missing required option --${optionName}.`);
|
|
407
|
+
}
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
const identity = resolveRepositoryIdentity(repo);
|
|
411
|
+
return resolveCredentialReference({
|
|
412
|
+
stateRoot: workflow.store.root,
|
|
413
|
+
projectId: identity.projectId,
|
|
414
|
+
reference,
|
|
415
|
+
kind,
|
|
416
|
+
entityId,
|
|
417
|
+
actor,
|
|
418
|
+
action,
|
|
419
|
+
}).token;
|
|
420
|
+
}
|
|
421
|
+
function writerCredentialReceipt(workflow, repo, taskId, actor, token, expiresAt) {
|
|
422
|
+
const identity = resolveRepositoryIdentity(repo);
|
|
423
|
+
return issueCredentialReference({
|
|
424
|
+
stateRoot: workflow.store.root,
|
|
425
|
+
projectId: identity.projectId,
|
|
426
|
+
entityId: taskId,
|
|
427
|
+
actor,
|
|
428
|
+
kind: 'writer-lease',
|
|
429
|
+
token,
|
|
430
|
+
allowedActions: WRITER_CREDENTIAL_ACTIONS,
|
|
431
|
+
expiresAt,
|
|
432
|
+
oneTime: false,
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
function consumeCredentialOption(workflow, repo, args, optionName) {
|
|
436
|
+
const reference = option(args, optionName);
|
|
437
|
+
if (!reference)
|
|
438
|
+
return;
|
|
439
|
+
consumeCredentialReference(workflow.store.root, resolveRepositoryIdentity(repo).projectId, reference);
|
|
485
440
|
}
|
|
486
441
|
async function dispatch(args) {
|
|
487
442
|
const [noun, action] = args.positionals;
|
|
@@ -489,13 +444,7 @@ async function dispatch(args) {
|
|
|
489
444
|
return cliHelp(args);
|
|
490
445
|
const repo = repository(args);
|
|
491
446
|
if (noun === 'gateway' && action === 'handshake') {
|
|
492
|
-
return
|
|
493
|
-
packageName: PACKAGE_NAME,
|
|
494
|
-
packageVersion: PACKAGE_VERSION,
|
|
495
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
496
|
-
stateSchemaVersion: STATE_SCHEMA_VERSION,
|
|
497
|
-
capabilities: workflowCapabilities(),
|
|
498
|
-
};
|
|
447
|
+
return gatewayHandshake();
|
|
499
448
|
}
|
|
500
449
|
const workflow = new WorkflowService();
|
|
501
450
|
if (noun === 'doctor') {
|
|
@@ -520,7 +469,7 @@ async function dispatch(args) {
|
|
|
520
469
|
};
|
|
521
470
|
}
|
|
522
471
|
if (noun === 'status')
|
|
523
|
-
return workflow.status(repo);
|
|
472
|
+
return args.options.has('full') ? workflow.status(repo) : workflow.compactStatus(repo);
|
|
524
473
|
if (noun === 'next')
|
|
525
474
|
return workflow.next(repo, option(args, 'task') ?? null);
|
|
526
475
|
if (noun === 'update' && action === 'preflight')
|
|
@@ -561,6 +510,15 @@ async function dispatch(args) {
|
|
|
561
510
|
if (noun === 'update' && action === 'downstream-proof-replan-dependency-recover') {
|
|
562
511
|
return workflow.recoverDownstreamProofReplanDependencyProvenance(repo, required(args, 'id'), revision(args), required(args, 'actor'), required(args, 'reason'));
|
|
563
512
|
}
|
|
513
|
+
if (noun === 'update' && action === 'plan-integrity-update-preflight') {
|
|
514
|
+
return workflow.planIntegrityUpdatePreflight(repo, required(args, 'id'));
|
|
515
|
+
}
|
|
516
|
+
if (noun === 'update' && action === 'plan-integrity-dependency-preflight') {
|
|
517
|
+
return workflow.planIntegrityDependencyRecoveryPreflight(repo, required(args, 'id'));
|
|
518
|
+
}
|
|
519
|
+
if (noun === 'update' && action === 'plan-integrity-dependency-recover') {
|
|
520
|
+
return workflow.recoverPlanIntegrityDependencyProvenance(repo, required(args, 'id'), revision(args), required(args, 'actor'), required(args, 'reason'));
|
|
521
|
+
}
|
|
564
522
|
if (noun === 'delegation' && action === 'prepare') {
|
|
565
523
|
return workflow.prepareDelegation(repo, jsonFile(args));
|
|
566
524
|
}
|
|
@@ -721,7 +679,9 @@ async function dispatch(args) {
|
|
|
721
679
|
return workflow.startTask(repo, required(args, 'id'), revision(args), owner);
|
|
722
680
|
}
|
|
723
681
|
if (noun === 'task' && action === 'run') {
|
|
724
|
-
const
|
|
682
|
+
const taskId = required(args, 'id');
|
|
683
|
+
const owner = option(args, 'owner') ?? 'worker';
|
|
684
|
+
const outcome = workflow.runStep(repo, taskId, required(args, 'step'), revision(args), owner, credentialToken(workflow, repo, args, 'writer-lease', 'task run', taskId, owner, false));
|
|
725
685
|
const { writerToken, ...envelope } = outcome.envelope;
|
|
726
686
|
if (outcome.writerCredential.disposition === 'issued' && !writerToken) {
|
|
727
687
|
throw new WorkflowError('STATE_CORRUPT', 'Fresh task run credential issuance did not return its protocol-v1 writer token.');
|
|
@@ -732,16 +692,7 @@ async function dispatch(args) {
|
|
|
732
692
|
return {
|
|
733
693
|
writerCredential: { disposition: outcome.writerCredential.disposition },
|
|
734
694
|
...(writerToken ? {
|
|
735
|
-
|
|
736
|
-
token: writerToken,
|
|
737
|
-
kind: 'writer-lease',
|
|
738
|
-
owner: outcome.lease.owner,
|
|
739
|
-
action: 'task step-complete',
|
|
740
|
-
option: '--writer-token',
|
|
741
|
-
source: 'task run',
|
|
742
|
-
sensitive: true,
|
|
743
|
-
oneTime: false,
|
|
744
|
-
},
|
|
695
|
+
writerCredentialReference: writerCredentialReceipt(workflow, repo, taskId, outcome.lease.owner, writerToken, outcome.lease.expiresAt),
|
|
745
696
|
} : {}),
|
|
746
697
|
task: outcome.task,
|
|
747
698
|
lease: outcome.lease,
|
|
@@ -749,14 +700,16 @@ async function dispatch(args) {
|
|
|
749
700
|
};
|
|
750
701
|
}
|
|
751
702
|
if (noun === 'task' && action === 'step-complete') {
|
|
752
|
-
|
|
703
|
+
const taskId = required(args, 'id');
|
|
704
|
+
return workflow.completeStep(repo, taskId, required(args, 'step'), revision(args), credentialToken(workflow, repo, args, 'writer-lease', 'task step-complete', taskId, option(args, 'actor') ?? null, true), repeated(args, 'note'), option(args, 'actor'));
|
|
753
705
|
}
|
|
754
706
|
if (noun === 'task' && action === 'submit') {
|
|
755
|
-
|
|
707
|
+
const taskId = required(args, 'id');
|
|
708
|
+
return workflow.submitTask(repo, taskId, revision(args), credentialToken(workflow, repo, args, 'writer-lease', 'task submit', taskId, option(args, 'actor') ?? null, true), option(args, 'actor'));
|
|
756
709
|
}
|
|
757
710
|
if (noun === 'task' && action === 'review-record') {
|
|
758
711
|
const review = jsonFile(args);
|
|
759
|
-
return workflow.recordReview(repo, required(args, 'id'), revision(args), review, option(args, 'actor'),
|
|
712
|
+
return workflow.recordReview(repo, required(args, 'id'), revision(args), review, option(args, 'actor'), credentialToken(workflow, repo, args, 'writer-lease', 'task review-record', required(args, 'id'), option(args, 'actor') ?? null, false));
|
|
760
713
|
}
|
|
761
714
|
if (noun === 'task' && action === 'review-launch') {
|
|
762
715
|
const identity = resolveRepositoryIdentity(repo);
|
|
@@ -773,37 +726,45 @@ async function dispatch(args) {
|
|
|
773
726
|
const launch = launchStrictReviewer(identity.repositoryRoot, task, workflow.store.taskRoot(task.projectId, task.id), envelope);
|
|
774
727
|
// The independent reviewer identity belongs to the strict reviewer payload. CLI --actor
|
|
775
728
|
// remains the lifecycle mutation actor, such as the current C1 claimant.
|
|
776
|
-
const saved = workflow.recordReview(repo, id, expectedRevision, launch.review, option(args, 'actor'),
|
|
729
|
+
const saved = workflow.recordReview(repo, id, expectedRevision, launch.review, option(args, 'actor'), credentialToken(workflow, repo, args, 'writer-lease', 'task review-launch', id, option(args, 'actor') ?? null, false));
|
|
777
730
|
return { launch, task: saved };
|
|
778
731
|
}
|
|
779
732
|
if (noun === 'task' && action === 'review-packet') {
|
|
780
|
-
return workflow.prepareExternalTaskReview(repo, required(args, 'id'), revision(args));
|
|
733
|
+
return workflow.prepareExternalTaskReview(repo, required(args, 'id'), revision(args), reviewMode(args));
|
|
781
734
|
}
|
|
782
735
|
if (noun === 'task' && action === 'review-sealed-record') {
|
|
783
|
-
return workflow.recordExternalTaskReview(repo, required(args, 'id'), revision(args), jsonFile(args), required(args, 'actor'),
|
|
736
|
+
return workflow.recordExternalTaskReview(repo, required(args, 'id'), revision(args), jsonFile(args), required(args, 'actor'), credentialToken(workflow, repo, args, 'writer-lease', 'task review-sealed-record', required(args, 'id'), required(args, 'actor'), false));
|
|
784
737
|
}
|
|
785
738
|
if (noun === 'task' && action === 'step-review') {
|
|
786
739
|
// Strict Step Review launches and records the isolated reviewer inside Core. CLI --actor
|
|
787
740
|
// remains the lifecycle actor from next, typically the active C1 claimant.
|
|
788
|
-
return workflow.reviewStep(repo, required(args, 'id'), required(args, 'step'), revision(args), undefined, option(args, 'actor'),
|
|
741
|
+
return workflow.reviewStep(repo, required(args, 'id'), required(args, 'step'), revision(args), undefined, option(args, 'actor'), credentialToken(workflow, repo, args, 'writer-lease', 'task step-review', required(args, 'id'), option(args, 'actor') ?? null, false));
|
|
789
742
|
}
|
|
790
743
|
if (noun === 'task' && action === 'step-review-packet') {
|
|
791
|
-
return workflow.prepareExternalStepReview(repo, required(args, 'id'), required(args, 'step'), revision(args));
|
|
744
|
+
return workflow.prepareExternalStepReview(repo, required(args, 'id'), required(args, 'step'), revision(args), reviewMode(args));
|
|
792
745
|
}
|
|
793
746
|
if (noun === 'task' && action === 'step-review-record') {
|
|
794
|
-
return workflow.recordExternalStepReview(repo, required(args, 'id'), required(args, 'step'), revision(args), jsonFile(args), required(args, 'actor'),
|
|
747
|
+
return workflow.recordExternalStepReview(repo, required(args, 'id'), required(args, 'step'), revision(args), jsonFile(args), required(args, 'actor'), credentialToken(workflow, repo, args, 'writer-lease', 'task step-review-record', required(args, 'id'), required(args, 'actor'), false));
|
|
795
748
|
}
|
|
796
749
|
if (noun === 'task' && action === 'corrective-decision-recover') {
|
|
797
|
-
|
|
750
|
+
const taskId = required(args, 'id');
|
|
751
|
+
const actor = required(args, 'actor');
|
|
752
|
+
return workflow.recoverStepCorrectiveDecision(repo, taskId, required(args, 'step'), revision(args), actor, credentialToken(workflow, repo, args, 'writer-lease', 'task corrective-decision-recover', taskId, actor, false));
|
|
798
753
|
}
|
|
799
754
|
if (noun === 'task' && action === 'remediation-mode-recover') {
|
|
800
|
-
|
|
755
|
+
const taskId = required(args, 'id');
|
|
756
|
+
const actor = required(args, 'actor');
|
|
757
|
+
return workflow.recoverRemediationMode(repo, taskId, required(args, 'step'), revision(args), actor, credentialToken(workflow, repo, args, 'writer-lease', 'task remediation-mode-recover', taskId, actor, false));
|
|
801
758
|
}
|
|
802
759
|
if (noun === 'task' && action === 'plan-integrity-recover') {
|
|
803
|
-
|
|
760
|
+
const taskId = required(args, 'id');
|
|
761
|
+
const actor = required(args, 'actor');
|
|
762
|
+
return workflow.recoverPlanIntegrity(repo, taskId, required(args, 'step'), revision(args), actor, credentialToken(workflow, repo, args, 'writer-lease', 'task plan-integrity-recover', taskId, actor, false));
|
|
804
763
|
}
|
|
805
764
|
if (noun === 'task' && action === 'downstream-proof-recover') {
|
|
806
|
-
|
|
765
|
+
const taskId = required(args, 'id');
|
|
766
|
+
const actor = required(args, 'actor');
|
|
767
|
+
return workflow.recoverDownstreamProof(repo, taskId, revision(args), actor, credentialToken(workflow, repo, args, 'writer-lease', 'task downstream-proof-recover', taskId, actor, true), required(args, 'reason'));
|
|
807
768
|
}
|
|
808
769
|
if (noun === 'task' && action === 'downstream-proof-replan-recover') {
|
|
809
770
|
return workflow.recoverDownstreamProofReplan(repo, required(args, 'id'), revision(args), required(args, 'actor'), required(args, 'reason'));
|
|
@@ -815,10 +776,15 @@ async function dispatch(args) {
|
|
|
815
776
|
return workflow.applyTaskStopOverride(repo, required(args, 'id'), required(args, 'step'), revision(args), required(args, 'actor'), required(args, 'reason'), required(args, 'confirmation-code'));
|
|
816
777
|
}
|
|
817
778
|
if (noun === 'task' && action === 'corrective-decision') {
|
|
818
|
-
|
|
779
|
+
const taskId = required(args, 'id');
|
|
780
|
+
return workflow.recordStepCorrectiveDecision(repo, taskId, required(args, 'step'), revision(args), jsonFile(args), option(args, 'actor'), credentialToken(workflow, repo, args, 'writer-lease', 'task corrective-decision', taskId, option(args, 'actor') ?? null, false));
|
|
819
781
|
}
|
|
820
782
|
if (noun === 'task' && action === 'corrective-yield') {
|
|
821
|
-
|
|
783
|
+
const taskId = required(args, 'id');
|
|
784
|
+
const actor = required(args, 'actor');
|
|
785
|
+
const outcome = workflow.executeCorrectiveYield(repo, taskId, revision(args), actor, credentialToken(workflow, repo, args, 'writer-lease', 'task corrective-yield', taskId, actor, true), required(args, 'reason'));
|
|
786
|
+
consumeCredentialOption(workflow, repo, args, 'writer-credential-ref');
|
|
787
|
+
return outcome;
|
|
822
788
|
}
|
|
823
789
|
if (noun === 'task' && action === 'corrective-yield-recover') {
|
|
824
790
|
return workflow.recoverCorrectiveYield(repo, required(args, 'id'), required(args, 'transaction-id'));
|
|
@@ -837,21 +803,27 @@ async function dispatch(args) {
|
|
|
837
803
|
}
|
|
838
804
|
if (noun === 'task' && (action === 'handoff' || action === 'handoff-prepare' || action === 'handoff-replace')) {
|
|
839
805
|
const replacePending = action === 'handoff-replace';
|
|
840
|
-
const
|
|
806
|
+
const taskId = required(args, 'id');
|
|
807
|
+
const actor = required(args, 'actor');
|
|
808
|
+
const targetActor = replacePending
|
|
841
809
|
? required(args, 'target-actor')
|
|
842
|
-
: option(args, 'target-actor') ?? defaultTaskWorkerActor(
|
|
810
|
+
: option(args, 'target-actor') ?? defaultTaskWorkerActor(taskId);
|
|
811
|
+
const outcome = workflow.handoffTask(repo, taskId, revision(args), actor, targetActor, required(args, 'reason'), credentialToken(workflow, repo, args, 'writer-lease', `task ${action}`, taskId, actor, false), option(args, 'delegation-grant') ?? null, option(args, 'expires-at') ?? null, replacePending);
|
|
812
|
+
consumeCredentialOption(workflow, repo, args, 'writer-credential-ref');
|
|
843
813
|
const { claimToken, ...bundle } = outcome.bundle;
|
|
814
|
+
const identity = resolveRepositoryIdentity(repo);
|
|
844
815
|
return {
|
|
845
|
-
|
|
846
|
-
|
|
816
|
+
claimCredentialReference: issueCredentialReference({
|
|
817
|
+
stateRoot: workflow.store.root,
|
|
818
|
+
projectId: identity.projectId,
|
|
819
|
+
entityId: taskId,
|
|
820
|
+
actor: outcome.bundle.delegate,
|
|
847
821
|
kind: 'claim-token',
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
source: replacePending ? 'task handoff-replace' : 'task handoff-prepare',
|
|
852
|
-
sensitive: true,
|
|
822
|
+
token: claimToken,
|
|
823
|
+
allowedActions: ['task claim'],
|
|
824
|
+
expiresAt: outcome.bundle.expiresAt,
|
|
853
825
|
oneTime: true,
|
|
854
|
-
},
|
|
826
|
+
}),
|
|
855
827
|
task: outcome.task,
|
|
856
828
|
event: outcome.event,
|
|
857
829
|
bundle,
|
|
@@ -861,20 +833,15 @@ async function dispatch(args) {
|
|
|
861
833
|
return workflow.showTaskHandoff(repo, required(args, 'id'));
|
|
862
834
|
}
|
|
863
835
|
if (noun === 'task' && action === 'claim') {
|
|
864
|
-
const
|
|
836
|
+
const taskId = required(args, 'id');
|
|
837
|
+
const actor = required(args, 'actor');
|
|
838
|
+
const claimToken = credentialToken(workflow, repo, args, 'claim-token', 'task claim', taskId, actor, true);
|
|
839
|
+
const outcome = workflow.claimTask(repo, taskId, revision(args), actor, claimToken, credentialToken(workflow, repo, args, 'writer-lease', 'task claim', taskId, actor, false));
|
|
840
|
+
consumeCredentialOption(workflow, repo, args, 'claim-credential-ref');
|
|
865
841
|
return {
|
|
866
842
|
writerCredential: { disposition: outcome.writerCredential.disposition },
|
|
867
843
|
...(outcome.writerCredential.disposition === 'issued' ? {
|
|
868
|
-
|
|
869
|
-
token: outcome.writerCredential.token,
|
|
870
|
-
kind: 'writer-lease',
|
|
871
|
-
owner: outcome.lease.owner,
|
|
872
|
-
action: 'task run',
|
|
873
|
-
option: '--writer-token',
|
|
874
|
-
source: 'task claim',
|
|
875
|
-
sensitive: true,
|
|
876
|
-
oneTime: false,
|
|
877
|
-
},
|
|
844
|
+
writerCredentialReference: writerCredentialReceipt(workflow, repo, taskId, outcome.lease.owner, outcome.writerCredential.token, outcome.lease.expiresAt),
|
|
878
845
|
} : {}),
|
|
879
846
|
task: outcome.task,
|
|
880
847
|
event: outcome.event,
|
|
@@ -882,27 +849,30 @@ async function dispatch(args) {
|
|
|
882
849
|
};
|
|
883
850
|
}
|
|
884
851
|
if (noun === 'task' && action === 'writer-credential-replace') {
|
|
885
|
-
const
|
|
852
|
+
const taskId = required(args, 'id');
|
|
853
|
+
const actor = required(args, 'actor');
|
|
854
|
+
const outcome = workflow.replaceClaimedWriterCredential(repo, taskId, revision(args), actor);
|
|
886
855
|
return {
|
|
887
856
|
writerCredential: { disposition: outcome.writerCredential.disposition },
|
|
888
|
-
|
|
889
|
-
token: outcome.writerCredential.token,
|
|
890
|
-
kind: 'writer-lease',
|
|
891
|
-
source: 'task writer-credential-replace',
|
|
892
|
-
sensitive: true,
|
|
893
|
-
oneTime: false,
|
|
894
|
-
},
|
|
857
|
+
writerCredentialReference: writerCredentialReceipt(workflow, repo, taskId, outcome.lease.owner, outcome.writerCredential.token, outcome.lease.expiresAt),
|
|
895
858
|
task: outcome.task,
|
|
896
859
|
lease: outcome.lease,
|
|
897
860
|
};
|
|
898
861
|
}
|
|
899
862
|
if (noun === 'task' && (action === 'handback' || action === 'handback-create')) {
|
|
900
|
-
|
|
863
|
+
const taskId = required(args, 'id');
|
|
864
|
+
const actor = required(args, 'actor');
|
|
865
|
+
const outcome = workflow.handbackTask(repo, taskId, revision(args), actor, required(args, 'reason'), credentialToken(workflow, repo, args, 'writer-lease', `task ${action}`, taskId, actor, false), repeated(args, 'limitation'), action === 'handback-create'
|
|
901
866
|
? required(args, 'recommended-next')
|
|
902
867
|
: option(args, 'recommended-next') ?? 'Coordinator reviews the terminal Task result and recorded evidence.');
|
|
868
|
+
consumeCredentialOption(workflow, repo, args, 'writer-credential-ref');
|
|
869
|
+
return outcome;
|
|
903
870
|
}
|
|
904
871
|
if (noun === 'task' && action === 'result-set') {
|
|
905
|
-
|
|
872
|
+
const taskId = required(args, 'id');
|
|
873
|
+
const outcome = workflow.setTaskResult(repo, taskId, revision(args), required(args, 'summary'), repeated(args, 'limitation'), credentialToken(workflow, repo, args, 'writer-lease', 'task result-set', taskId, option(args, 'actor') ?? null, true), option(args, 'actor'));
|
|
874
|
+
consumeCredentialOption(workflow, repo, args, 'writer-credential-ref');
|
|
875
|
+
return outcome;
|
|
906
876
|
}
|
|
907
877
|
if (noun === 'task' && action === 'accept') {
|
|
908
878
|
return workflow.acceptTask(repo, required(args, 'id'), revision(args), option(args, 'actor') ?? 'user', option(args, 'delegation-grant') ?? null);
|
|
@@ -911,10 +881,16 @@ async function dispatch(args) {
|
|
|
911
881
|
return workflow.syncTaskBase(repo, required(args, 'id'), revision(args));
|
|
912
882
|
}
|
|
913
883
|
if (noun === 'task' && action === 'merge') {
|
|
914
|
-
|
|
884
|
+
const taskId = required(args, 'id');
|
|
885
|
+
const outcome = workflow.mergeTask(repo, taskId, revision(args), credentialToken(workflow, repo, args, 'writer-lease', 'task merge', taskId, option(args, 'actor') ?? null, true), option(args, 'actor'));
|
|
886
|
+
consumeCredentialOption(workflow, repo, args, 'writer-credential-ref');
|
|
887
|
+
return outcome;
|
|
915
888
|
}
|
|
916
889
|
if (noun === 'task' && action === 'merge-confirm') {
|
|
917
|
-
|
|
890
|
+
const taskId = required(args, 'id');
|
|
891
|
+
const outcome = workflow.confirmExternalMerge(repo, taskId, revision(args), credentialToken(workflow, repo, args, 'writer-lease', 'task merge-confirm', taskId, option(args, 'actor') ?? null, true), option(args, 'actor'));
|
|
892
|
+
consumeCredentialOption(workflow, repo, args, 'writer-credential-ref');
|
|
893
|
+
return outcome;
|
|
918
894
|
}
|
|
919
895
|
if (noun === 'milestone' && action === 'show') {
|
|
920
896
|
const identity = resolveRepositoryIdentity(repo);
|
|
@@ -926,6 +902,9 @@ async function dispatch(args) {
|
|
|
926
902
|
if (noun === 'milestone' && action === 'plan-set') {
|
|
927
903
|
return workflow.setMilestonePlan(repo, required(args, 'id'), revision(args), jsonFile(args));
|
|
928
904
|
}
|
|
905
|
+
if (noun === 'milestone' && action === 'remediation-materialize') {
|
|
906
|
+
return workflow.materializeAuditedRemediationTask(repo, required(args, 'id'), revision(args), required(args, 'task'), positiveIntegerOption(args, 'expected-task-revision'), jsonFile(args));
|
|
907
|
+
}
|
|
929
908
|
if (noun === 'milestone' && action === 'scope-change-prepare') {
|
|
930
909
|
return workflow.prepareMilestoneScopeChange(repo, required(args, 'id'), revision(args), jsonFile(args), required(args, 'actor'));
|
|
931
910
|
}
|
|
@@ -965,30 +944,8 @@ async function dispatch(args) {
|
|
|
965
944
|
hint: 'Use doctor, status, next, update preflight, state <action>, delegation <action>, project-memory <action>, discovery <action>, task <action>, milestone <action>, or locks <action>.',
|
|
966
945
|
});
|
|
967
946
|
}
|
|
968
|
-
function credentialAllowancesForResult(
|
|
969
|
-
|
|
970
|
-
if (!isRecord(value))
|
|
971
|
-
return [];
|
|
972
|
-
if (noun === 'task' && (action === 'run' || action === 'claim' || action === 'writer-credential-replace')) {
|
|
973
|
-
const disposition = isRecord(value.writerCredential) ? value.writerCredential.disposition : null;
|
|
974
|
-
const receipt = isRecord(value.writerLeaseReceipt) ? value.writerLeaseReceipt : null;
|
|
975
|
-
if (disposition === 'issued'
|
|
976
|
-
&& receipt?.kind === 'writer-lease'
|
|
977
|
-
&& receipt.source === `task ${action}`
|
|
978
|
-
&& receipt.sensitive === true) {
|
|
979
|
-
return [{ path: '$.writerLeaseReceipt.token' }];
|
|
980
|
-
}
|
|
981
|
-
return [];
|
|
982
|
-
}
|
|
983
|
-
if (noun === 'task' && (action === 'handoff' || action === 'handoff-prepare' || action === 'handoff-replace')) {
|
|
984
|
-
const receipt = isRecord(value.credentialHandoff) ? value.credentialHandoff : null;
|
|
985
|
-
if (receipt?.kind === 'claim-token'
|
|
986
|
-
&& receipt.source === (action === 'handoff-replace' ? 'task handoff-replace' : 'task handoff-prepare')
|
|
987
|
-
&& receipt.sensitive === true
|
|
988
|
-
&& receipt.oneTime === true) {
|
|
989
|
-
return [{ path: '$.credentialHandoff.token' }];
|
|
990
|
-
}
|
|
991
|
-
}
|
|
947
|
+
function credentialAllowancesForResult(_args, _value) {
|
|
948
|
+
// Beta 13 has no CLI issuance allowance: the host receives reference metadata only.
|
|
992
949
|
return [];
|
|
993
950
|
}
|
|
994
951
|
function rawCredentialInputs(argv) {
|
|
@@ -1012,6 +969,7 @@ async function main() {
|
|
|
1012
969
|
const sensitiveInputs = rawCredentialInputs(argv);
|
|
1013
970
|
try {
|
|
1014
971
|
const args = parseArguments(argv);
|
|
972
|
+
assertNoLegacyCredentialArguments(new Set(args.options.keys()));
|
|
1015
973
|
const value = await dispatch(args);
|
|
1016
974
|
assertCliSuccessCredentialSafety(value, credentialAllowancesForResult(args, value), sensitiveInputs);
|
|
1017
975
|
process.stdout.write(`${JSON.stringify({ ok: true, value }, null, 2)}\n`);
|