@akagilnc/pi-workflow-roles 0.1.5096 → 0.1.5124
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/acp-host/production-host.js +197 -33
- package/dist/headless-host/production-host.js +197 -33
- package/dist/public-cli/cli.js +24 -1
- package/dist/public-cli/instruction-seat-run.js +8 -6
- package/dist/public-cli/main.js +6704 -6540
- package/dist/public-cli/post-admission.js +125 -26
- package/dist/public-cli/settlement.js +28 -4
- package/package.json +1 -1
- package/resources/engines/opencode.md +9 -4
- package/src/public-cli/cli-io.ts +2 -0
- package/src/public-cli/cli.ts +38 -4
- package/src/public-cli/instruction-seat-run.ts +10 -6
- package/src/public-cli/invocation.ts +6 -1
- package/src/public-cli/post-admission.ts +189 -34
- package/src/public-cli/settlement.ts +37 -4
|
@@ -14837,6 +14837,7 @@ __export(settlement_exports, {
|
|
|
14837
14837
|
projectThrownFailureLeaf: () => projectThrownFailureLeaf,
|
|
14838
14838
|
publishFailureArtifacts: () => publishFailureArtifacts,
|
|
14839
14839
|
publishSeatAcceptedArtifacts: () => publishSeatAcceptedArtifacts,
|
|
14840
|
+
publishedFailureErrorPath: () => publishedFailureErrorPath,
|
|
14840
14841
|
raceNavigatorGrace: () => raceNavigatorGrace,
|
|
14841
14842
|
readCollectorInfrastructureFailure: () => readCollectorInfrastructureFailure,
|
|
14842
14843
|
readEngineDetourInfrastructureFailure: () => readEngineDetourInfrastructureFailure,
|
|
@@ -14845,6 +14846,7 @@ __export(settlement_exports, {
|
|
|
14845
14846
|
resolveAuditedRunnerFailureResolution: () => resolveAuditedRunnerFailureResolution,
|
|
14846
14847
|
resolveAuditedRunnerKnownFailure: () => resolveAuditedRunnerKnownFailure,
|
|
14847
14848
|
resolveControlledFailureResumeObservation: () => resolveControlledFailureResumeObservation,
|
|
14849
|
+
rewritePublishedFailureErrorPath: () => rewritePublishedFailureErrorPath,
|
|
14848
14850
|
seatKnownFailureResolver: () => seatKnownFailureResolver,
|
|
14849
14851
|
settleFailureTerminalResult: () => settleFailureTerminalResult,
|
|
14850
14852
|
settleHostEndedNoReceipt: () => settleHostEndedNoReceipt,
|
|
@@ -14938,10 +14940,13 @@ function withSubmissions(terminal, submissions) {
|
|
|
14938
14940
|
}
|
|
14939
14941
|
async function attachRecordedSubmissions(admitted, terminal, scope) {
|
|
14940
14942
|
void scope;
|
|
14941
|
-
|
|
14943
|
+
const result = withSubmissions(
|
|
14942
14944
|
terminal,
|
|
14943
14945
|
await recordedSubmissionPayloads(admitted, void 0)
|
|
14944
14946
|
);
|
|
14947
|
+
const errorPath = privateFailureErrorPaths.get(terminal);
|
|
14948
|
+
if (errorPath !== void 0) privateFailureErrorPaths.set(result, errorPath);
|
|
14949
|
+
return result;
|
|
14945
14950
|
}
|
|
14946
14951
|
async function settleHostEndedNoReceipt(admitted, authority, scope) {
|
|
14947
14952
|
const facts = noReceiptLifecycleFacts({
|
|
@@ -14973,6 +14978,18 @@ async function settleHostEndedNoReceipt(admitted, authority, scope) {
|
|
|
14973
14978
|
function coordinatesFromAdmitted(authority, admitted) {
|
|
14974
14979
|
return authority.decode(admitted.principal);
|
|
14975
14980
|
}
|
|
14981
|
+
function publishedFailureErrorPath(terminal) {
|
|
14982
|
+
return privateFailureErrorPaths.get(terminal);
|
|
14983
|
+
}
|
|
14984
|
+
function rewritePublishedFailureErrorPath(terminal, oldRunDirectory, newRunDirectory) {
|
|
14985
|
+
const errorPath = privateFailureErrorPaths.get(terminal);
|
|
14986
|
+
if (errorPath !== void 0) {
|
|
14987
|
+
privateFailureErrorPaths.set(
|
|
14988
|
+
terminal,
|
|
14989
|
+
rewriteRunDirectoryPathValue(errorPath, oldRunDirectory, newRunDirectory)
|
|
14990
|
+
);
|
|
14991
|
+
}
|
|
14992
|
+
}
|
|
14976
14993
|
function conciseChildDiagnostic(stderr, fallback) {
|
|
14977
14994
|
const trimmed = stderr.trim();
|
|
14978
14995
|
return trimmed.length > 0 ? stderr : fallback;
|
|
@@ -16494,7 +16511,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
|
|
|
16494
16511
|
error.publicationAttempts = issues;
|
|
16495
16512
|
throw error;
|
|
16496
16513
|
}
|
|
16497
|
-
async function publishFailureArtifacts(admitted, failure2, authority) {
|
|
16514
|
+
async function publishFailureArtifacts(admitted, failure2, authority, onErrorPublished) {
|
|
16498
16515
|
const { sessionDirectory, sessionFile } = coordinatesFromAdmitted(authority, admitted);
|
|
16499
16516
|
const { baseDir, attempt: baseAttempt } = await resolveFailureArtifactsBase(
|
|
16500
16517
|
admitted.runDirectory
|
|
@@ -16556,6 +16573,7 @@ async function publishFailureArtifacts(admitted, failure2, authority) {
|
|
|
16556
16573
|
errorPayloadBase,
|
|
16557
16574
|
priorIssues
|
|
16558
16575
|
);
|
|
16576
|
+
onErrorPublished?.(errorWrite.path);
|
|
16559
16577
|
const evidencePayload = {
|
|
16560
16578
|
runId: admitted.runId,
|
|
16561
16579
|
sessionDirectory,
|
|
@@ -16638,7 +16656,8 @@ async function settleFailureTerminalResult(admitted, failure2, authority, option
|
|
|
16638
16656
|
}
|
|
16639
16657
|
}
|
|
16640
16658
|
const navigator = await extractNavigatorFactFromAdmittedSession(sessionFile);
|
|
16641
|
-
const artifacts = await publishFailureArtifacts(admitted, failure2, authority);
|
|
16659
|
+
const artifacts = await publishFailureArtifacts(admitted, failure2, authority, options.onErrorPublished);
|
|
16660
|
+
const errorPath = artifacts.find((artifact) => artifact.kind === "error")?.path;
|
|
16642
16661
|
const decisiveFacts = {
|
|
16643
16662
|
...failure2.cause === void 0 ? {} : { cause: failure2.cause },
|
|
16644
16663
|
diagnostic: failure2.diagnostic
|
|
@@ -16660,7 +16679,7 @@ async function settleFailureTerminalResult(admitted, failure2, authority, option
|
|
|
16660
16679
|
diagnostic: failure2.diagnostic,
|
|
16661
16680
|
decisiveFacts
|
|
16662
16681
|
};
|
|
16663
|
-
|
|
16682
|
+
const terminal = await withOptionalGateProjection(
|
|
16664
16683
|
{
|
|
16665
16684
|
roleOutcome: roleOutcome2,
|
|
16666
16685
|
navigator,
|
|
@@ -16670,6 +16689,8 @@ async function settleFailureTerminalResult(admitted, failure2, authority, option
|
|
|
16670
16689
|
sessionDirectory,
|
|
16671
16690
|
detourGateContext(admitted, options)
|
|
16672
16691
|
);
|
|
16692
|
+
if (errorPath !== void 0) privateFailureErrorPaths.set(terminal, errorPath);
|
|
16693
|
+
return terminal;
|
|
16673
16694
|
}
|
|
16674
16695
|
const roleOutcome = {
|
|
16675
16696
|
kind: "failure",
|
|
@@ -16698,6 +16719,7 @@ function presentFailureTerminal(terminal, io) {
|
|
|
16698
16719
|
}
|
|
16699
16720
|
io.stdout(formatTerminalResult(terminal));
|
|
16700
16721
|
if (terminal.roleOutcome.kind === "failure") {
|
|
16722
|
+
if (io.omitFailureStderrDiagnostic) return;
|
|
16701
16723
|
io.stderr(formatFailureStderrDiagnostic({
|
|
16702
16724
|
...terminal.roleOutcome.cause === void 0 ? {} : { cause: terminal.roleOutcome.cause },
|
|
16703
16725
|
diagnostic: terminal.roleOutcome.diagnostic
|
|
@@ -16746,7 +16768,7 @@ function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2
|
|
|
16746
16768
|
});
|
|
16747
16769
|
});
|
|
16748
16770
|
}
|
|
16749
|
-
var NAVIGATOR_POST_ROLE_GRACE_MS, COLLECTOR_INFRASTRUCTURE_TOOLS, COLLECTOR_INFRASTRUCTURE_FAILURE_SPEC, ENGINE_DETOUR_INFRASTRUCTURE_FAILURE_SPEC, RUNNER_FAILURE_POLICY, ATTEMPT_HISTORY_ENTRY_TYPE, EMPTY_ARTIFACT_FACE;
|
|
16771
|
+
var privateFailureErrorPaths, NAVIGATOR_POST_ROLE_GRACE_MS, COLLECTOR_INFRASTRUCTURE_TOOLS, COLLECTOR_INFRASTRUCTURE_FAILURE_SPEC, ENGINE_DETOUR_INFRASTRUCTURE_FAILURE_SPEC, RUNNER_FAILURE_POLICY, ATTEMPT_HISTORY_ENTRY_TYPE, EMPTY_ARTIFACT_FACE;
|
|
16750
16772
|
var init_settlement = __esm({
|
|
16751
16773
|
"src/public-cli/settlement.ts"() {
|
|
16752
16774
|
"use strict";
|
|
@@ -16773,9 +16795,11 @@ var init_settlement = __esm({
|
|
|
16773
16795
|
init_navigator_invocation_identity();
|
|
16774
16796
|
init_receipt_delivery_policy();
|
|
16775
16797
|
init_role_run_placement();
|
|
16798
|
+
init_role_run_relocation();
|
|
16776
16799
|
init_run_terminal_artifacts();
|
|
16777
16800
|
init_invocation();
|
|
16778
16801
|
init_terminal();
|
|
16802
|
+
privateFailureErrorPaths = /* @__PURE__ */ new WeakMap();
|
|
16779
16803
|
NAVIGATOR_POST_ROLE_GRACE_MS = 1e4;
|
|
16780
16804
|
COLLECTOR_INFRASTRUCTURE_TOOLS = /* @__PURE__ */ new Set([
|
|
16781
16805
|
COLLECTOR_OBSERVE_TOOL,
|
|
@@ -17418,6 +17442,11 @@ function projectRelocatedTurnIdentity(request, result, admitted, relocation) {
|
|
|
17418
17442
|
}
|
|
17419
17443
|
}
|
|
17420
17444
|
if (result.terminal !== void 0) {
|
|
17445
|
+
rewritePublishedFailureErrorPath(
|
|
17446
|
+
result.terminal,
|
|
17447
|
+
relocation.oldRunDirectory,
|
|
17448
|
+
relocation.newRunDirectory
|
|
17449
|
+
);
|
|
17421
17450
|
for (const artifact of result.terminal.artifacts) {
|
|
17422
17451
|
artifact.path = rewrite(artifact.path);
|
|
17423
17452
|
}
|
|
@@ -17531,18 +17560,23 @@ async function presentControlledFailure2(admitted, failureInput, adapters, autho
|
|
|
17531
17560
|
if (persistRunState && !failureInput.skipRunStateWrite) {
|
|
17532
17561
|
await persistReturnedRunState(admitted, authority);
|
|
17533
17562
|
}
|
|
17534
|
-
|
|
17535
|
-
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
{
|
|
17541
|
-
|
|
17542
|
-
...failureInput.invocationScopeId === void 0 || failureInput.invocationScopeId.length === 0 ? {} : { invocationScopeId: failureInput.invocationScopeId }
|
|
17563
|
+
let publishedErrorPath;
|
|
17564
|
+
let terminal;
|
|
17565
|
+
try {
|
|
17566
|
+
const settled = await settleFailureTerminalResult(admitted, failure2, authority, {
|
|
17567
|
+
...resumable ? { resume: { command: renderResumeCommand(admitted.runId) } } : {},
|
|
17568
|
+
...failureInput.invocationScopeId === void 0 || failureInput.invocationScopeId.length === 0 ? {} : { invocationScopeId: failureInput.invocationScopeId },
|
|
17569
|
+
onErrorPublished: (path) => {
|
|
17570
|
+
publishedErrorPath = path;
|
|
17543
17571
|
}
|
|
17544
|
-
)
|
|
17545
|
-
|
|
17572
|
+
});
|
|
17573
|
+
terminal = await attachRecordedSubmissions(admitted, settled);
|
|
17574
|
+
} catch (error) {
|
|
17575
|
+
if (io.omitFailureStderrDiagnostic && publishedErrorPath !== void 0) {
|
|
17576
|
+
writeResumeFailurePointer(io, publishedErrorPath);
|
|
17577
|
+
}
|
|
17578
|
+
throw error;
|
|
17579
|
+
}
|
|
17546
17580
|
presentFailureTerminal(terminal, io);
|
|
17547
17581
|
return {
|
|
17548
17582
|
exitCode: exitCodeForTerminalOutcome(terminal.roleOutcome),
|
|
@@ -17636,7 +17670,10 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
17636
17670
|
if (relocation !== void 0) {
|
|
17637
17671
|
projectRelocatedTurnIdentity(request, result, admitted, relocation);
|
|
17638
17672
|
}
|
|
17639
|
-
|
|
17673
|
+
const afterDispatchRelocation = adapters.afterDispatch === void 0 ? void 0 : await adapters.afterDispatch(admitted, lease);
|
|
17674
|
+
if (afterDispatchRelocation !== void 0) {
|
|
17675
|
+
projectRelocatedTurnIdentity(request, result, admitted, afterDispatchRelocation);
|
|
17676
|
+
}
|
|
17640
17677
|
return result;
|
|
17641
17678
|
} catch (error) {
|
|
17642
17679
|
if (result.terminal !== void 0) {
|
|
@@ -18083,16 +18120,28 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
18083
18120
|
try {
|
|
18084
18121
|
loaded = await input.load(request);
|
|
18085
18122
|
} catch (error) {
|
|
18086
|
-
|
|
18087
|
-
|
|
18088
|
-
|
|
18123
|
+
const usageError = error instanceof CliUsageError;
|
|
18124
|
+
const recorded = await pointExistingRunFailure(
|
|
18125
|
+
input.env.home,
|
|
18126
|
+
request.runId,
|
|
18127
|
+
input.env.principalAuthority,
|
|
18128
|
+
input.io,
|
|
18129
|
+
error
|
|
18130
|
+
);
|
|
18131
|
+
if (!recorded) {
|
|
18132
|
+
if (usageError) {
|
|
18133
|
+
presentStructuralRejection(error, input.io);
|
|
18134
|
+
return { exitCode: 2 };
|
|
18135
|
+
}
|
|
18136
|
+
throw error;
|
|
18089
18137
|
}
|
|
18090
|
-
|
|
18138
|
+
return { exitCode: usageError ? 2 : 1 };
|
|
18091
18139
|
}
|
|
18092
18140
|
let adapters = input.adapters;
|
|
18093
18141
|
if (input.afterAdmittedLoad !== void 0) {
|
|
18094
18142
|
const prepared = await input.afterAdmittedLoad(loaded.admitted);
|
|
18095
18143
|
if (prepared.kind === "terminal") {
|
|
18144
|
+
showResumeErrorPointer(input.io, prepared.exitCode, prepared.terminal);
|
|
18096
18145
|
return {
|
|
18097
18146
|
exitCode: prepared.exitCode,
|
|
18098
18147
|
admitted: prepared.admitted,
|
|
@@ -18218,22 +18267,110 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
18218
18267
|
})
|
|
18219
18268
|
});
|
|
18220
18269
|
}
|
|
18221
|
-
|
|
18270
|
+
const resumed = await runPostAdmissionManualResume({
|
|
18222
18271
|
admitted: loaded.admitted,
|
|
18223
18272
|
env,
|
|
18224
|
-
io: input.io,
|
|
18273
|
+
io: { ...input.io, omitFailureStderrDiagnostic: true },
|
|
18225
18274
|
adapters,
|
|
18226
18275
|
...input.effectiveEngine === void 0 ? {} : { effectiveEngine: input.effectiveEngine },
|
|
18227
18276
|
buildRequestAfterLease
|
|
18228
18277
|
});
|
|
18278
|
+
showResumeErrorPointer(input.io, resumed.exitCode, resumed.terminal);
|
|
18279
|
+
return resumed;
|
|
18229
18280
|
} catch (error) {
|
|
18230
|
-
if (error instanceof
|
|
18231
|
-
|
|
18232
|
-
|
|
18281
|
+
if (error instanceof TurnDispatchedFailure) throw error;
|
|
18282
|
+
await presentResumeFailurePointer(
|
|
18283
|
+
input.io,
|
|
18284
|
+
error,
|
|
18285
|
+
(failure2) => writeResumeDiagnosticFile(
|
|
18286
|
+
loaded.admitted.runDirectory,
|
|
18287
|
+
loaded.admitted.runId,
|
|
18288
|
+
failure2,
|
|
18289
|
+
loaded.admitted.role
|
|
18290
|
+
)
|
|
18291
|
+
);
|
|
18292
|
+
return { exitCode: error instanceof CliUsageError ? 2 : 1 };
|
|
18293
|
+
}
|
|
18294
|
+
}
|
|
18295
|
+
async function pointExistingRunFailure(home, runId, authority, io, thrown) {
|
|
18296
|
+
let foundRunDirectory;
|
|
18297
|
+
try {
|
|
18298
|
+
foundRunDirectory = await findRunDirectoryById(home, runId);
|
|
18299
|
+
} catch {
|
|
18300
|
+
return false;
|
|
18301
|
+
}
|
|
18302
|
+
if (foundRunDirectory === void 0) return false;
|
|
18303
|
+
const runDirectory = foundRunDirectory;
|
|
18304
|
+
let record4;
|
|
18305
|
+
try {
|
|
18306
|
+
record4 = await readRoleRunState(runDirectory, authority);
|
|
18307
|
+
} catch {
|
|
18308
|
+
await presentResumeFailurePointer(
|
|
18309
|
+
io,
|
|
18310
|
+
thrown,
|
|
18311
|
+
(failure2) => writeResumeDiagnosticFile(runDirectory, runId, failure2)
|
|
18312
|
+
);
|
|
18313
|
+
return true;
|
|
18314
|
+
}
|
|
18315
|
+
if (record4 === void 0) return false;
|
|
18316
|
+
await presentResumeFailurePointer(
|
|
18317
|
+
io,
|
|
18318
|
+
thrown,
|
|
18319
|
+
(failure2) => writeResumeDiagnosticFile(runDirectory, runId, failure2, record4.role)
|
|
18320
|
+
);
|
|
18321
|
+
return true;
|
|
18322
|
+
}
|
|
18323
|
+
async function presentLocatedResumeFailure(home, runId, authority, io, thrown) {
|
|
18324
|
+
return await pointExistingRunFailure(home, runId, authority, io, thrown);
|
|
18325
|
+
}
|
|
18326
|
+
function writeResumeFailurePointer(io, errorPath) {
|
|
18327
|
+
io.stderr(formatCliDiagnostic(`\u7EED\u8DD1\u5931\u8D25\uFF0C\u5F53\u6B21\u9519\u8BEF\u8BB0\u5F55\uFF1A${errorPath}`));
|
|
18328
|
+
}
|
|
18329
|
+
function showResumeErrorPointer(io, exitCode, terminal) {
|
|
18330
|
+
if (exitCode === 0 || terminal === void 0) return;
|
|
18331
|
+
const publishedError = terminal.artifacts.find((artifact) => artifact.kind === "error")?.path ?? publishedFailureErrorPath(terminal);
|
|
18332
|
+
if (publishedError !== void 0) writeResumeFailurePointer(io, publishedError);
|
|
18333
|
+
}
|
|
18334
|
+
async function presentResumeFailurePointer(io, thrown, publish) {
|
|
18335
|
+
const failure2 = classifyPostAdmissionFailure({
|
|
18336
|
+
timedOut: false,
|
|
18337
|
+
code: null,
|
|
18338
|
+
stderr: "",
|
|
18339
|
+
thrown
|
|
18340
|
+
});
|
|
18341
|
+
try {
|
|
18342
|
+
writeResumeFailurePointer(io, await publish(failure2));
|
|
18343
|
+
} catch (publishError) {
|
|
18344
|
+
const cause = {
|
|
18345
|
+
publishError: formatErrorCauseDetail(publishError)
|
|
18346
|
+
};
|
|
18347
|
+
if (thrown instanceof Error && thrown.cause !== void 0) {
|
|
18348
|
+
cause.thrownCause = formatErrorCauseDetail(thrown.cause);
|
|
18233
18349
|
}
|
|
18234
|
-
|
|
18350
|
+
presentStructuralRejection({
|
|
18351
|
+
message: thrown instanceof Error ? thrown.message : String(thrown),
|
|
18352
|
+
cause
|
|
18353
|
+
}, io);
|
|
18235
18354
|
}
|
|
18236
18355
|
}
|
|
18356
|
+
async function writeResumeDiagnosticFile(runDirectory, runId, failure2, role) {
|
|
18357
|
+
const dir = await ensureRealArtifactsDirectory(runDirectory);
|
|
18358
|
+
const path = join33(dir, `resume-diagnostic-${randomUUID6()}.json`);
|
|
18359
|
+
await writeFile9(
|
|
18360
|
+
path,
|
|
18361
|
+
`${JSON.stringify({
|
|
18362
|
+
runId,
|
|
18363
|
+
...role === void 0 ? {} : { role },
|
|
18364
|
+
diagnostic: failure2.diagnostic,
|
|
18365
|
+
...failure2.cause === void 0 ? {} : { cause: failure2.cause },
|
|
18366
|
+
...failure2.identity === void 0 ? {} : { identity: failure2.identity },
|
|
18367
|
+
...failure2.details === void 0 ? {} : { details: failure2.details }
|
|
18368
|
+
}, null, 2)}
|
|
18369
|
+
`,
|
|
18370
|
+
{ encoding: "utf8", flag: "wx" }
|
|
18371
|
+
);
|
|
18372
|
+
return path;
|
|
18373
|
+
}
|
|
18237
18374
|
async function runPostAdmissionOneShot(input) {
|
|
18238
18375
|
return await runPostAdmissionResumable({
|
|
18239
18376
|
admitted: input.admitted,
|
|
@@ -18864,11 +19001,11 @@ function isBoardTicketSeat(seat) {
|
|
|
18864
19001
|
}
|
|
18865
19002
|
async function bindAndRelocateDiarist(admitted, authority, lease) {
|
|
18866
19003
|
const boardTicket = await readBoardTicketNumber(admitted.runDirectory);
|
|
18867
|
-
if (boardTicket === void 0) return;
|
|
19004
|
+
if (boardTicket === void 0) return void 0;
|
|
18868
19005
|
if (admitted.ticketNumber === void 0) {
|
|
18869
19006
|
await bindAdmittedTicketNumber(admitted, boardTicket);
|
|
18870
19007
|
}
|
|
18871
|
-
await relocateAdmittedRunToTicket(admitted, authority, lease);
|
|
19008
|
+
return await relocateAdmittedRunToTicket(admitted, authority, lease);
|
|
18872
19009
|
}
|
|
18873
19010
|
function seatAdapters(admitted, env) {
|
|
18874
19011
|
const record4 = roleRecord(admitted.role);
|
|
@@ -18887,8 +19024,8 @@ function seatAdapters(admitted, env) {
|
|
|
18887
19024
|
await bindAndRelocateDiarist(seat, env.principalAuthority, lease);
|
|
18888
19025
|
},
|
|
18889
19026
|
afterDispatch: async (seat, lease) => {
|
|
18890
|
-
if (!isBoardTicketSeat(seat)) return;
|
|
18891
|
-
await bindAndRelocateDiarist(seat, env.principalAuthority, lease);
|
|
19027
|
+
if (!isBoardTicketSeat(seat)) return void 0;
|
|
19028
|
+
return await bindAndRelocateDiarist(seat, env.principalAuthority, lease);
|
|
18892
19029
|
}
|
|
18893
19030
|
} : {}
|
|
18894
19031
|
};
|
|
@@ -19450,7 +19587,9 @@ async function continueParentAfterChild(parentRunId, child, env, io) {
|
|
|
19450
19587
|
return { exitCode: 0, admitted, terminal: refresh.terminal };
|
|
19451
19588
|
}
|
|
19452
19589
|
}
|
|
19453
|
-
|
|
19590
|
+
const result = await dispatchAdmitted(admitted, env, { ...io, omitFailureStderrDiagnostic: true });
|
|
19591
|
+
showResumeErrorPointer(io, result.exitCode, result.terminal);
|
|
19592
|
+
return result;
|
|
19454
19593
|
}
|
|
19455
19594
|
var init_instruction_seat_run = __esm({
|
|
19456
19595
|
"src/public-cli/instruction-seat-run.ts"() {
|
|
@@ -22317,6 +22456,7 @@ function commandNeedsProcessCancel(argv) {
|
|
|
22317
22456
|
}
|
|
22318
22457
|
async function runAkRole(argv, env) {
|
|
22319
22458
|
const io = env.io ?? defaultIo();
|
|
22459
|
+
let resumeFailureContext;
|
|
22320
22460
|
try {
|
|
22321
22461
|
env = {
|
|
22322
22462
|
...env,
|
|
@@ -22389,11 +22529,16 @@ async function runAkRole(argv, env) {
|
|
|
22389
22529
|
env = { ...env, freshSummons: true };
|
|
22390
22530
|
}
|
|
22391
22531
|
if (parsed.command === "resume") {
|
|
22532
|
+
const resumeRequest = parseResumeRequest(parsed.args);
|
|
22533
|
+
resumeFailureContext = {
|
|
22534
|
+
home,
|
|
22535
|
+
runId: resumeRequest.runId,
|
|
22536
|
+
authority: env.principalAuthority ?? piDurablePrincipalAuthority
|
|
22537
|
+
};
|
|
22392
22538
|
const agentDir = resolveAgentDir(env, home);
|
|
22393
22539
|
const cwd = env.cwd ?? process.cwd();
|
|
22394
22540
|
const config = await loadAndValidateConfig(home, env.packageRoot);
|
|
22395
22541
|
const credentials = env.credentials ?? await loadCredentialProviders(agentDir);
|
|
22396
|
-
const resumeRequest = parseResumeRequest(parsed.args);
|
|
22397
22542
|
const resumeRole = await peekRoleRunRole(home, resumeRequest.runId);
|
|
22398
22543
|
const seatRole = resumeRole ?? "judge";
|
|
22399
22544
|
const seat = resolveEffectiveSeat(
|
|
@@ -22418,6 +22563,11 @@ async function runAkRole(argv, env) {
|
|
|
22418
22563
|
let current = result;
|
|
22419
22564
|
while (current.exitCode === 0 && current.admitted?.correlationId !== void 0 && current.terminal?.roleOutcome.kind === "accepted" && !courtDiaristEscalated(current.terminal.roleOutcome)) {
|
|
22420
22565
|
const parentRunId = current.admitted.correlationId;
|
|
22566
|
+
resumeFailureContext = {
|
|
22567
|
+
home,
|
|
22568
|
+
runId: parentRunId,
|
|
22569
|
+
authority: env.principalAuthority ?? piDurablePrincipalAuthority
|
|
22570
|
+
};
|
|
22421
22571
|
const parentRole = await peekRoleRunRole(home, parentRunId);
|
|
22422
22572
|
if (parentRole === void 0) break;
|
|
22423
22573
|
const parentSeat = resolveEffectiveSeat(config, parentRole, credentials, invocationFromParsed(parsed));
|
|
@@ -22460,6 +22610,18 @@ async function runAkRole(argv, env) {
|
|
|
22460
22610
|
}
|
|
22461
22611
|
throw new CliUsageError(`unknown command: ${parsed.command}`);
|
|
22462
22612
|
} catch (error) {
|
|
22613
|
+
if (resumeFailureContext !== void 0 && !(error instanceof TurnDispatchedFailure) && await presentLocatedResumeFailure(
|
|
22614
|
+
resumeFailureContext.home,
|
|
22615
|
+
resumeFailureContext.runId,
|
|
22616
|
+
resumeFailureContext.authority,
|
|
22617
|
+
io,
|
|
22618
|
+
error
|
|
22619
|
+
)) {
|
|
22620
|
+
return {
|
|
22621
|
+
exitCode: error instanceof CliUsageError ? 2 : 1,
|
|
22622
|
+
...error instanceof HostSelectionError ? { hostFailure: error.failure } : {}
|
|
22623
|
+
};
|
|
22624
|
+
}
|
|
22463
22625
|
if (error instanceof HostSelectionError) {
|
|
22464
22626
|
io.stderr(formatCliDiagnostic(formatHostSelectionFailure(error.failure)));
|
|
22465
22627
|
return { exitCode: 1, hostFailure: error.failure };
|
|
@@ -22497,10 +22659,12 @@ var init_cli = __esm({
|
|
|
22497
22659
|
init_registry();
|
|
22498
22660
|
init_cli_errors();
|
|
22499
22661
|
init_machine_method_skills();
|
|
22662
|
+
init_post_admission();
|
|
22500
22663
|
init_role_turn_host();
|
|
22501
22664
|
init_role_turn_host_resolution();
|
|
22502
22665
|
init_invocation();
|
|
22503
22666
|
init_option_definitions();
|
|
22667
|
+
init_auto_resume();
|
|
22504
22668
|
init_instruction_seat_run();
|
|
22505
22669
|
init_countersign_run();
|
|
22506
22670
|
init_analyst_run();
|