@akagilnc/pi-workflow-roles 0.1.3891 → 0.1.3898
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 +32 -78
- package/dist/headless-host/production-host.js +32 -78
- package/dist/public-cli/doctor-run.js +1 -1
- package/dist/public-cli/judge-run.js +1 -1
- package/dist/public-cli/main.js +194 -280
- package/dist/public-cli/post-admission.js +57 -98
- package/dist/public-cli/run-lifecycle.js +3 -3
- package/dist/public-cli/settlement.js +47 -47
- package/dist/public-cli/turn-request.js +3 -0
- package/dist/submission-ledger.js +7 -8
- package/package.json +1 -1
- package/src/host-contracts.ts +2 -3
- package/src/public-cli/coder-run.ts +34 -52
- package/src/public-cli/collector-run.ts +2 -1
- package/src/public-cli/doctor-run.ts +2 -1
- package/src/public-cli/fixer-run.ts +35 -50
- package/src/public-cli/judge-run.ts +2 -1
- package/src/public-cli/merger-run.ts +36 -51
- package/src/public-cli/post-admission.ts +104 -132
- package/src/public-cli/reviewer-run.ts +35 -50
- package/src/public-cli/run-lifecycle.ts +3 -3
- package/src/public-cli/settlement.ts +49 -28
- package/src/public-cli/turn-request.ts +5 -0
- package/src/submission-ledger.ts +7 -7
|
@@ -10579,7 +10579,6 @@ async function readSealedSubmission(cwd, runId, homeOrScope) {
|
|
|
10579
10579
|
const scoped = recordsForAttempt(owned, scope.attemptId);
|
|
10580
10580
|
for (let index = scoped.length - 1; index >= 0; index -= 1) {
|
|
10581
10581
|
const record4 = scoped[index];
|
|
10582
|
-
if (record4?.kind === "post-seal-anomaly") return void 0;
|
|
10583
10582
|
if (record4?.kind !== "sealed") continue;
|
|
10584
10583
|
const payload = record4.payload;
|
|
10585
10584
|
if (payload?.type === "sealed" && isAcceptedProjection(payload.projection)) return payload.projection;
|
|
@@ -15609,8 +15608,8 @@ async function readLawfulSettlementEntries(sessionFile) {
|
|
|
15609
15608
|
throw error instanceof Error && error.knownCause === "session" ? error : sessionReadFailure(error, "session unreadable");
|
|
15610
15609
|
}
|
|
15611
15610
|
}
|
|
15612
|
-
async function readLawfulJudgeRoleOutcome(admitted, authority) {
|
|
15613
|
-
const sealed = await sealedLedgerOutcome(admitted);
|
|
15611
|
+
async function readLawfulJudgeRoleOutcome(admitted, authority, scope) {
|
|
15612
|
+
const sealed = await sealedLedgerOutcome(admitted, scope);
|
|
15614
15613
|
if (sealed?.role === "judge") {
|
|
15615
15614
|
const details = sealed.decisiveFacts;
|
|
15616
15615
|
return {
|
|
@@ -15621,10 +15620,10 @@ async function readLawfulJudgeRoleOutcome(admitted, authority) {
|
|
|
15621
15620
|
decisiveFacts: withAuditNoReceiptFacts(details)
|
|
15622
15621
|
};
|
|
15623
15622
|
}
|
|
15624
|
-
return auditEscalationLedgerOutcome(admitted, "judge");
|
|
15623
|
+
return auditEscalationLedgerOutcome(admitted, "judge", scope);
|
|
15625
15624
|
}
|
|
15626
|
-
async function settleLawfulJudgeTerminalResult(admitted, authority) {
|
|
15627
|
-
const roleOutcome = await readLawfulJudgeRoleOutcome(admitted, authority);
|
|
15625
|
+
async function settleLawfulJudgeTerminalResult(admitted, authority, scope) {
|
|
15626
|
+
const roleOutcome = await readLawfulJudgeRoleOutcome(admitted, authority, scope);
|
|
15628
15627
|
if (roleOutcome === void 0) return void 0;
|
|
15629
15628
|
const coordinates = coordinatesFromAdmitted(authority, admitted);
|
|
15630
15629
|
const entries = await readLawfulSettlementEntries(coordinates.sessionFile) ?? [];
|
|
@@ -15644,8 +15643,8 @@ async function settleLawfulJudgeTerminalResult(admitted, authority) {
|
|
|
15644
15643
|
coordinates.sessionDirectory
|
|
15645
15644
|
);
|
|
15646
15645
|
}
|
|
15647
|
-
async function trySettleJudgeTerminalResult(admitted, authority) {
|
|
15648
|
-
return settleLawfulJudgeTerminalResult(admitted, authority);
|
|
15646
|
+
async function trySettleJudgeTerminalResult(admitted, authority, scope) {
|
|
15647
|
+
return settleLawfulJudgeTerminalResult(admitted, authority, scope);
|
|
15649
15648
|
}
|
|
15650
15649
|
async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
|
|
15651
15650
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
@@ -15697,13 +15696,13 @@ async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, option
|
|
|
15697
15696
|
{ kind: "evidence", path: evidencePath }
|
|
15698
15697
|
];
|
|
15699
15698
|
}
|
|
15700
|
-
async function settleLawfulDoctorTerminalResult(admitted, authority) {
|
|
15701
|
-
const sealed = await sealedLedgerOutcome(admitted);
|
|
15699
|
+
async function settleLawfulDoctorTerminalResult(admitted, authority, scope) {
|
|
15700
|
+
const sealed = await sealedLedgerOutcome(admitted, scope);
|
|
15702
15701
|
const coordinates = coordinatesFromAdmitted(authority, admitted);
|
|
15703
15702
|
const { sessionDirectory, sessionFile } = coordinates;
|
|
15704
15703
|
const entries = await readLawfulSettlementEntries(sessionFile) ?? [];
|
|
15705
15704
|
if (sealed?.role !== "doctor") {
|
|
15706
|
-
const escalation = await auditEscalationLedgerOutcome(admitted, "doctor");
|
|
15705
|
+
const escalation = await auditEscalationLedgerOutcome(admitted, "doctor", scope);
|
|
15707
15706
|
if (escalation === void 0) return void 0;
|
|
15708
15707
|
const artifacts2 = await publishDoctorArtifacts(admitted, escalation, coordinates);
|
|
15709
15708
|
return withOptionalGateProjection(
|
|
@@ -15751,8 +15750,8 @@ async function settleLawfulDoctorTerminalResult(admitted, authority) {
|
|
|
15751
15750
|
sessionDirectory
|
|
15752
15751
|
);
|
|
15753
15752
|
}
|
|
15754
|
-
async function trySettleDoctorTerminalResult(admitted, authority) {
|
|
15755
|
-
return settleLawfulDoctorTerminalResult(admitted, authority);
|
|
15753
|
+
async function trySettleDoctorTerminalResult(admitted, authority, scope) {
|
|
15754
|
+
return settleLawfulDoctorTerminalResult(admitted, authority, scope);
|
|
15756
15755
|
}
|
|
15757
15756
|
function currentAttemptStartIndex(entries) {
|
|
15758
15757
|
for (let i = entries.length - 1; i >= 0; i -= 1) {
|
|
@@ -16872,7 +16871,8 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
|
|
|
16872
16871
|
continuation: {
|
|
16873
16872
|
kind: "resume",
|
|
16874
16873
|
prompt
|
|
16875
|
-
}
|
|
16874
|
+
},
|
|
16875
|
+
...request.message === void 0 ? {} : { courtAttemptId: randomUUID5() }
|
|
16876
16876
|
};
|
|
16877
16877
|
}
|
|
16878
16878
|
function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
|
|
@@ -16907,14 +16907,25 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
16907
16907
|
}
|
|
16908
16908
|
throw error;
|
|
16909
16909
|
}
|
|
16910
|
+
let adapters = input.adapters;
|
|
16911
|
+
if (input.afterAdmittedLoad !== void 0) {
|
|
16912
|
+
const prepared = await input.afterAdmittedLoad(loaded.admitted);
|
|
16913
|
+
if (prepared.kind === "terminal") {
|
|
16914
|
+
return {
|
|
16915
|
+
exitCode: prepared.exitCode,
|
|
16916
|
+
admitted: prepared.admitted,
|
|
16917
|
+
terminal: prepared.terminal
|
|
16918
|
+
};
|
|
16919
|
+
}
|
|
16920
|
+
adapters = prepared.adapters;
|
|
16921
|
+
}
|
|
16910
16922
|
try {
|
|
16911
16923
|
return await runPostAdmissionManualResume({
|
|
16912
16924
|
admitted: loaded.admitted,
|
|
16913
16925
|
env: input.env,
|
|
16914
16926
|
io: input.io,
|
|
16915
|
-
adapters
|
|
16927
|
+
adapters,
|
|
16916
16928
|
...input.effectiveEngine === void 0 ? {} : { effectiveEngine: input.effectiveEngine },
|
|
16917
|
-
forceContinuation: true,
|
|
16918
16929
|
buildRequestAfterLease: async () => {
|
|
16919
16930
|
let openCourtAttemptId;
|
|
16920
16931
|
let admittedForBuild = loaded.admitted;
|
|
@@ -16966,7 +16977,7 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
16966
16977
|
}
|
|
16967
16978
|
}
|
|
16968
16979
|
let turnRequest = await input.buildTurnRequest(admittedForBuild, request);
|
|
16969
|
-
if (openCourtAttemptId !== void 0 || request.summons !== void 0) {
|
|
16980
|
+
if (openCourtAttemptId !== void 0 || request.summons !== void 0 || request.message !== void 0) {
|
|
16970
16981
|
const courtAttemptId = openCourtAttemptId ?? (turnRequest.courtAttemptId !== void 0 && turnRequest.courtAttemptId.length > 0 ? turnRequest.courtAttemptId : randomUUID5());
|
|
16971
16982
|
turnRequest = { ...turnRequest, courtAttemptId };
|
|
16972
16983
|
if (openCourtAttemptId === void 0) {
|
|
@@ -17039,38 +17050,6 @@ async function runPostAdmissionResumable(input) {
|
|
|
17039
17050
|
})
|
|
17040
17051
|
});
|
|
17041
17052
|
}
|
|
17042
|
-
async function presentSealedAcceptedManualResumeIfAny(input) {
|
|
17043
|
-
const { admitted, env, io, adapters, shouldPresent } = input;
|
|
17044
|
-
try {
|
|
17045
|
-
const existing = await adapters.trySettle(admitted, env.principalAuthority);
|
|
17046
|
-
if (existing !== void 0 && existing.roleOutcome.kind === "accepted" && shouldPresent(existing)) {
|
|
17047
|
-
existing.autoResumeCount = 0;
|
|
17048
|
-
io.stdout(formatTerminalResult(existing));
|
|
17049
|
-
return {
|
|
17050
|
-
exitCode: exitCodeForTerminalOutcome(existing.roleOutcome),
|
|
17051
|
-
admitted,
|
|
17052
|
-
terminal: existing
|
|
17053
|
-
};
|
|
17054
|
-
}
|
|
17055
|
-
} catch (error) {
|
|
17056
|
-
const disposition = await sealedAcceptanceRedispatchDisposition(admitted);
|
|
17057
|
-
if (disposition.kind === "block") {
|
|
17058
|
-
return await presentControlledFailure(
|
|
17059
|
-
admitted,
|
|
17060
|
-
{
|
|
17061
|
-
timedOut: false,
|
|
17062
|
-
code: null,
|
|
17063
|
-
stderr: "",
|
|
17064
|
-
thrown: disposition.reason === "authority-failed" ? disposition.cause : error
|
|
17065
|
-
},
|
|
17066
|
-
adapters,
|
|
17067
|
-
env.principalAuthority,
|
|
17068
|
-
io
|
|
17069
|
-
);
|
|
17070
|
-
}
|
|
17071
|
-
}
|
|
17072
|
-
return void 0;
|
|
17073
|
-
}
|
|
17074
17053
|
async function runPostAdmissionManualResume(input) {
|
|
17075
17054
|
const {
|
|
17076
17055
|
admitted,
|
|
@@ -17078,25 +17057,10 @@ async function runPostAdmissionManualResume(input) {
|
|
|
17078
17057
|
io,
|
|
17079
17058
|
adapters,
|
|
17080
17059
|
effectiveEngine,
|
|
17081
|
-
forceContinuation,
|
|
17082
17060
|
buildRequestAfterLease
|
|
17083
17061
|
} = input;
|
|
17084
17062
|
let request = input.request;
|
|
17085
17063
|
const effectiveModel = env.model;
|
|
17086
|
-
const shouldPresent = adapters.shouldPresentSettled ?? ((terminal) => isLawfulTypedTerminalOutcome(terminal.roleOutcome));
|
|
17087
|
-
const sealedIdempotenceInput = {
|
|
17088
|
-
admitted,
|
|
17089
|
-
env,
|
|
17090
|
-
io,
|
|
17091
|
-
adapters,
|
|
17092
|
-
shouldPresent
|
|
17093
|
-
};
|
|
17094
|
-
if (forceContinuation !== true && request !== void 0) {
|
|
17095
|
-
const presented = await presentSealedAcceptedManualResumeIfAny(
|
|
17096
|
-
sealedIdempotenceInput
|
|
17097
|
-
);
|
|
17098
|
-
if (presented !== void 0) return presented;
|
|
17099
|
-
}
|
|
17100
17064
|
let lease;
|
|
17101
17065
|
let staleWriterLeaseReclaimed;
|
|
17102
17066
|
try {
|
|
@@ -17123,17 +17087,6 @@ async function runPostAdmissionManualResume(input) {
|
|
|
17123
17087
|
);
|
|
17124
17088
|
}
|
|
17125
17089
|
request = await buildRequestAfterLease();
|
|
17126
|
-
if (request.courtAttemptId === void 0 || request.courtAttemptId.length === 0) {
|
|
17127
|
-
const presented = await presentSealedAcceptedManualResumeIfAny(
|
|
17128
|
-
sealedIdempotenceInput
|
|
17129
|
-
);
|
|
17130
|
-
if (presented !== void 0) {
|
|
17131
|
-
return {
|
|
17132
|
-
...presented,
|
|
17133
|
-
...staleWriterLeaseReclaimed === true ? { staleWriterLeaseReclaimed: true } : {}
|
|
17134
|
-
};
|
|
17135
|
-
}
|
|
17136
|
-
}
|
|
17137
17090
|
}
|
|
17138
17091
|
handedOffToDispatch = true;
|
|
17139
17092
|
const result = await dispatchPostAdmissionTurn({
|
|
@@ -17198,7 +17151,8 @@ function projectRoleTurnRequest(admitted, roleDetails, options) {
|
|
|
17198
17151
|
agentDir: options.agentDir,
|
|
17199
17152
|
runDirectory: admitted.runDirectory,
|
|
17200
17153
|
...options.correlationId === void 0 || options.correlationId.trim() === "" ? {} : { correlationId: options.correlationId },
|
|
17201
|
-
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
|
|
17154
|
+
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs },
|
|
17155
|
+
...options.courtAttemptId === void 0 || options.courtAttemptId.length === 0 ? {} : { courtAttemptId: options.courtAttemptId }
|
|
17202
17156
|
};
|
|
17203
17157
|
}
|
|
17204
17158
|
var init_turn_request = __esm({
|
|
@@ -17851,7 +17805,7 @@ function buildJudgeTurnRequest(admitted, options) {
|
|
|
17851
17805
|
}
|
|
17852
17806
|
function judgeAdapters() {
|
|
17853
17807
|
return {
|
|
17854
|
-
trySettle: (admitted, authority) => trySettleJudgeTerminalResult(admitted, authority),
|
|
17808
|
+
trySettle: (admitted, authority, scope) => trySettleJudgeTerminalResult(admitted, authority, scope),
|
|
17855
17809
|
resolveRunnerKnownFailure: async ({ result, sessionFile }) => {
|
|
17856
17810
|
const infrastructureFailure = await readEngineDetourInfrastructureFailure(sessionFile);
|
|
17857
17811
|
return result.knownFailure ?? (infrastructureFailure === void 0 ? void 0 : {
|
|
@@ -18018,7 +17972,7 @@ async function runPublicDoctor(argv, env, io, parseDoctorArgv2) {
|
|
|
18018
17972
|
}
|
|
18019
17973
|
function doctorAdapters() {
|
|
18020
17974
|
return {
|
|
18021
|
-
trySettle: (admitted, authority) => trySettleDoctorTerminalResult(admitted, authority),
|
|
17975
|
+
trySettle: (admitted, authority, scope) => trySettleDoctorTerminalResult(admitted, authority, scope),
|
|
18022
17976
|
shouldPresentSettled: (terminal) => isLawfulTypedTerminalOutcome(terminal.roleOutcome)
|
|
18023
17977
|
};
|
|
18024
17978
|
}
|
|
@@ -10500,7 +10500,6 @@ async function readSealedSubmission(cwd, runId, homeOrScope) {
|
|
|
10500
10500
|
const scoped = recordsForAttempt(owned, scope.attemptId);
|
|
10501
10501
|
for (let index = scoped.length - 1; index >= 0; index -= 1) {
|
|
10502
10502
|
const record4 = scoped[index];
|
|
10503
|
-
if (record4?.kind === "post-seal-anomaly") return void 0;
|
|
10504
10503
|
if (record4?.kind !== "sealed") continue;
|
|
10505
10504
|
const payload = record4.payload;
|
|
10506
10505
|
if (payload?.type === "sealed" && isAcceptedProjection(payload.projection)) return payload.projection;
|
|
@@ -15223,8 +15222,8 @@ async function readLawfulSettlementEntries(sessionFile) {
|
|
|
15223
15222
|
throw error instanceof Error && error.knownCause === "session" ? error : sessionReadFailure(error, "session unreadable");
|
|
15224
15223
|
}
|
|
15225
15224
|
}
|
|
15226
|
-
async function readLawfulJudgeRoleOutcome(admitted, authority) {
|
|
15227
|
-
const sealed = await sealedLedgerOutcome(admitted);
|
|
15225
|
+
async function readLawfulJudgeRoleOutcome(admitted, authority, scope) {
|
|
15226
|
+
const sealed = await sealedLedgerOutcome(admitted, scope);
|
|
15228
15227
|
if (sealed?.role === "judge") {
|
|
15229
15228
|
const details = sealed.decisiveFacts;
|
|
15230
15229
|
return {
|
|
@@ -15235,10 +15234,10 @@ async function readLawfulJudgeRoleOutcome(admitted, authority) {
|
|
|
15235
15234
|
decisiveFacts: withAuditNoReceiptFacts(details)
|
|
15236
15235
|
};
|
|
15237
15236
|
}
|
|
15238
|
-
return auditEscalationLedgerOutcome(admitted, "judge");
|
|
15237
|
+
return auditEscalationLedgerOutcome(admitted, "judge", scope);
|
|
15239
15238
|
}
|
|
15240
|
-
async function settleLawfulJudgeTerminalResult(admitted, authority) {
|
|
15241
|
-
const roleOutcome = await readLawfulJudgeRoleOutcome(admitted, authority);
|
|
15239
|
+
async function settleLawfulJudgeTerminalResult(admitted, authority, scope) {
|
|
15240
|
+
const roleOutcome = await readLawfulJudgeRoleOutcome(admitted, authority, scope);
|
|
15242
15241
|
if (roleOutcome === void 0) return void 0;
|
|
15243
15242
|
const coordinates = coordinatesFromAdmitted(authority, admitted);
|
|
15244
15243
|
const entries = await readLawfulSettlementEntries(coordinates.sessionFile) ?? [];
|
|
@@ -15258,8 +15257,8 @@ async function settleLawfulJudgeTerminalResult(admitted, authority) {
|
|
|
15258
15257
|
coordinates.sessionDirectory
|
|
15259
15258
|
);
|
|
15260
15259
|
}
|
|
15261
|
-
async function trySettleJudgeTerminalResult(admitted, authority) {
|
|
15262
|
-
return settleLawfulJudgeTerminalResult(admitted, authority);
|
|
15260
|
+
async function trySettleJudgeTerminalResult(admitted, authority, scope) {
|
|
15261
|
+
return settleLawfulJudgeTerminalResult(admitted, authority, scope);
|
|
15263
15262
|
}
|
|
15264
15263
|
async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
|
|
15265
15264
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
@@ -15311,13 +15310,13 @@ async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, option
|
|
|
15311
15310
|
{ kind: "evidence", path: evidencePath }
|
|
15312
15311
|
];
|
|
15313
15312
|
}
|
|
15314
|
-
async function settleLawfulDoctorTerminalResult(admitted, authority) {
|
|
15315
|
-
const sealed = await sealedLedgerOutcome(admitted);
|
|
15313
|
+
async function settleLawfulDoctorTerminalResult(admitted, authority, scope) {
|
|
15314
|
+
const sealed = await sealedLedgerOutcome(admitted, scope);
|
|
15316
15315
|
const coordinates = coordinatesFromAdmitted(authority, admitted);
|
|
15317
15316
|
const { sessionDirectory, sessionFile } = coordinates;
|
|
15318
15317
|
const entries = await readLawfulSettlementEntries(sessionFile) ?? [];
|
|
15319
15318
|
if (sealed?.role !== "doctor") {
|
|
15320
|
-
const escalation = await auditEscalationLedgerOutcome(admitted, "doctor");
|
|
15319
|
+
const escalation = await auditEscalationLedgerOutcome(admitted, "doctor", scope);
|
|
15321
15320
|
if (escalation === void 0) return void 0;
|
|
15322
15321
|
const artifacts2 = await publishDoctorArtifacts(admitted, escalation, coordinates);
|
|
15323
15322
|
return withOptionalGateProjection(
|
|
@@ -15365,8 +15364,8 @@ async function settleLawfulDoctorTerminalResult(admitted, authority) {
|
|
|
15365
15364
|
sessionDirectory
|
|
15366
15365
|
);
|
|
15367
15366
|
}
|
|
15368
|
-
async function trySettleDoctorTerminalResult(admitted, authority) {
|
|
15369
|
-
return settleLawfulDoctorTerminalResult(admitted, authority);
|
|
15367
|
+
async function trySettleDoctorTerminalResult(admitted, authority, scope) {
|
|
15368
|
+
return settleLawfulDoctorTerminalResult(admitted, authority, scope);
|
|
15370
15369
|
}
|
|
15371
15370
|
function currentAttemptStartIndex(entries) {
|
|
15372
15371
|
for (let i = entries.length - 1; i >= 0; i -= 1) {
|
|
@@ -16486,7 +16485,8 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
|
|
|
16486
16485
|
continuation: {
|
|
16487
16486
|
kind: "resume",
|
|
16488
16487
|
prompt
|
|
16489
|
-
}
|
|
16488
|
+
},
|
|
16489
|
+
...request.message === void 0 ? {} : { courtAttemptId: randomUUID5() }
|
|
16490
16490
|
};
|
|
16491
16491
|
}
|
|
16492
16492
|
function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
|
|
@@ -16521,14 +16521,25 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
16521
16521
|
}
|
|
16522
16522
|
throw error;
|
|
16523
16523
|
}
|
|
16524
|
+
let adapters = input.adapters;
|
|
16525
|
+
if (input.afterAdmittedLoad !== void 0) {
|
|
16526
|
+
const prepared = await input.afterAdmittedLoad(loaded.admitted);
|
|
16527
|
+
if (prepared.kind === "terminal") {
|
|
16528
|
+
return {
|
|
16529
|
+
exitCode: prepared.exitCode,
|
|
16530
|
+
admitted: prepared.admitted,
|
|
16531
|
+
terminal: prepared.terminal
|
|
16532
|
+
};
|
|
16533
|
+
}
|
|
16534
|
+
adapters = prepared.adapters;
|
|
16535
|
+
}
|
|
16524
16536
|
try {
|
|
16525
16537
|
return await runPostAdmissionManualResume({
|
|
16526
16538
|
admitted: loaded.admitted,
|
|
16527
16539
|
env: input.env,
|
|
16528
16540
|
io: input.io,
|
|
16529
|
-
adapters
|
|
16541
|
+
adapters,
|
|
16530
16542
|
...input.effectiveEngine === void 0 ? {} : { effectiveEngine: input.effectiveEngine },
|
|
16531
|
-
forceContinuation: true,
|
|
16532
16543
|
buildRequestAfterLease: async () => {
|
|
16533
16544
|
let openCourtAttemptId;
|
|
16534
16545
|
let admittedForBuild = loaded.admitted;
|
|
@@ -16580,7 +16591,7 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
16580
16591
|
}
|
|
16581
16592
|
}
|
|
16582
16593
|
let turnRequest = await input.buildTurnRequest(admittedForBuild, request);
|
|
16583
|
-
if (openCourtAttemptId !== void 0 || request.summons !== void 0) {
|
|
16594
|
+
if (openCourtAttemptId !== void 0 || request.summons !== void 0 || request.message !== void 0) {
|
|
16584
16595
|
const courtAttemptId = openCourtAttemptId ?? (turnRequest.courtAttemptId !== void 0 && turnRequest.courtAttemptId.length > 0 ? turnRequest.courtAttemptId : randomUUID5());
|
|
16585
16596
|
turnRequest = { ...turnRequest, courtAttemptId };
|
|
16586
16597
|
if (openCourtAttemptId === void 0) {
|
|
@@ -16653,38 +16664,6 @@ async function runPostAdmissionResumable(input) {
|
|
|
16653
16664
|
})
|
|
16654
16665
|
});
|
|
16655
16666
|
}
|
|
16656
|
-
async function presentSealedAcceptedManualResumeIfAny(input) {
|
|
16657
|
-
const { admitted, env, io, adapters, shouldPresent } = input;
|
|
16658
|
-
try {
|
|
16659
|
-
const existing = await adapters.trySettle(admitted, env.principalAuthority);
|
|
16660
|
-
if (existing !== void 0 && existing.roleOutcome.kind === "accepted" && shouldPresent(existing)) {
|
|
16661
|
-
existing.autoResumeCount = 0;
|
|
16662
|
-
io.stdout(formatTerminalResult(existing));
|
|
16663
|
-
return {
|
|
16664
|
-
exitCode: exitCodeForTerminalOutcome(existing.roleOutcome),
|
|
16665
|
-
admitted,
|
|
16666
|
-
terminal: existing
|
|
16667
|
-
};
|
|
16668
|
-
}
|
|
16669
|
-
} catch (error) {
|
|
16670
|
-
const disposition = await sealedAcceptanceRedispatchDisposition(admitted);
|
|
16671
|
-
if (disposition.kind === "block") {
|
|
16672
|
-
return await presentControlledFailure(
|
|
16673
|
-
admitted,
|
|
16674
|
-
{
|
|
16675
|
-
timedOut: false,
|
|
16676
|
-
code: null,
|
|
16677
|
-
stderr: "",
|
|
16678
|
-
thrown: disposition.reason === "authority-failed" ? disposition.cause : error
|
|
16679
|
-
},
|
|
16680
|
-
adapters,
|
|
16681
|
-
env.principalAuthority,
|
|
16682
|
-
io
|
|
16683
|
-
);
|
|
16684
|
-
}
|
|
16685
|
-
}
|
|
16686
|
-
return void 0;
|
|
16687
|
-
}
|
|
16688
16667
|
async function runPostAdmissionManualResume(input) {
|
|
16689
16668
|
const {
|
|
16690
16669
|
admitted,
|
|
@@ -16692,25 +16671,10 @@ async function runPostAdmissionManualResume(input) {
|
|
|
16692
16671
|
io,
|
|
16693
16672
|
adapters,
|
|
16694
16673
|
effectiveEngine,
|
|
16695
|
-
forceContinuation,
|
|
16696
16674
|
buildRequestAfterLease
|
|
16697
16675
|
} = input;
|
|
16698
16676
|
let request = input.request;
|
|
16699
16677
|
const effectiveModel = env.model;
|
|
16700
|
-
const shouldPresent = adapters.shouldPresentSettled ?? ((terminal) => isLawfulTypedTerminalOutcome(terminal.roleOutcome));
|
|
16701
|
-
const sealedIdempotenceInput = {
|
|
16702
|
-
admitted,
|
|
16703
|
-
env,
|
|
16704
|
-
io,
|
|
16705
|
-
adapters,
|
|
16706
|
-
shouldPresent
|
|
16707
|
-
};
|
|
16708
|
-
if (forceContinuation !== true && request !== void 0) {
|
|
16709
|
-
const presented = await presentSealedAcceptedManualResumeIfAny(
|
|
16710
|
-
sealedIdempotenceInput
|
|
16711
|
-
);
|
|
16712
|
-
if (presented !== void 0) return presented;
|
|
16713
|
-
}
|
|
16714
16678
|
let lease;
|
|
16715
16679
|
let staleWriterLeaseReclaimed;
|
|
16716
16680
|
try {
|
|
@@ -16737,17 +16701,6 @@ async function runPostAdmissionManualResume(input) {
|
|
|
16737
16701
|
);
|
|
16738
16702
|
}
|
|
16739
16703
|
request = await buildRequestAfterLease();
|
|
16740
|
-
if (request.courtAttemptId === void 0 || request.courtAttemptId.length === 0) {
|
|
16741
|
-
const presented = await presentSealedAcceptedManualResumeIfAny(
|
|
16742
|
-
sealedIdempotenceInput
|
|
16743
|
-
);
|
|
16744
|
-
if (presented !== void 0) {
|
|
16745
|
-
return {
|
|
16746
|
-
...presented,
|
|
16747
|
-
...staleWriterLeaseReclaimed === true ? { staleWriterLeaseReclaimed: true } : {}
|
|
16748
|
-
};
|
|
16749
|
-
}
|
|
16750
|
-
}
|
|
16751
16704
|
}
|
|
16752
16705
|
handedOffToDispatch = true;
|
|
16753
16706
|
const result = await dispatchPostAdmissionTurn({
|
|
@@ -16812,7 +16765,8 @@ function projectRoleTurnRequest(admitted, roleDetails, options) {
|
|
|
16812
16765
|
agentDir: options.agentDir,
|
|
16813
16766
|
runDirectory: admitted.runDirectory,
|
|
16814
16767
|
...options.correlationId === void 0 || options.correlationId.trim() === "" ? {} : { correlationId: options.correlationId },
|
|
16815
|
-
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
|
|
16768
|
+
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs },
|
|
16769
|
+
...options.courtAttemptId === void 0 || options.courtAttemptId.length === 0 ? {} : { courtAttemptId: options.courtAttemptId }
|
|
16816
16770
|
};
|
|
16817
16771
|
}
|
|
16818
16772
|
var init_turn_request = __esm({
|
|
@@ -17465,7 +17419,7 @@ function buildJudgeTurnRequest(admitted, options) {
|
|
|
17465
17419
|
}
|
|
17466
17420
|
function judgeAdapters() {
|
|
17467
17421
|
return {
|
|
17468
|
-
trySettle: (admitted, authority) => trySettleJudgeTerminalResult(admitted, authority),
|
|
17422
|
+
trySettle: (admitted, authority, scope) => trySettleJudgeTerminalResult(admitted, authority, scope),
|
|
17469
17423
|
resolveRunnerKnownFailure: async ({ result, sessionFile }) => {
|
|
17470
17424
|
const infrastructureFailure = await readEngineDetourInfrastructureFailure(sessionFile);
|
|
17471
17425
|
return result.knownFailure ?? (infrastructureFailure === void 0 ? void 0 : {
|
|
@@ -17632,7 +17586,7 @@ async function runPublicDoctor(argv, env, io, parseDoctorArgv2) {
|
|
|
17632
17586
|
}
|
|
17633
17587
|
function doctorAdapters() {
|
|
17634
17588
|
return {
|
|
17635
|
-
trySettle: (admitted, authority) => trySettleDoctorTerminalResult(admitted, authority),
|
|
17589
|
+
trySettle: (admitted, authority, scope) => trySettleDoctorTerminalResult(admitted, authority, scope),
|
|
17636
17590
|
shouldPresentSettled: (terminal) => isLawfulTypedTerminalOutcome(terminal.roleOutcome)
|
|
17637
17591
|
};
|
|
17638
17592
|
}
|
|
@@ -63,7 +63,7 @@ export async function runPublicDoctor(argv, env, io, parseDoctorArgv) {
|
|
|
63
63
|
}
|
|
64
64
|
function doctorAdapters() {
|
|
65
65
|
return {
|
|
66
|
-
trySettle: (admitted, authority) => trySettleDoctorTerminalResult(admitted, authority),
|
|
66
|
+
trySettle: (admitted, authority, scope) => trySettleDoctorTerminalResult(admitted, authority, scope),
|
|
67
67
|
shouldPresentSettled: (terminal) => isLawfulTypedTerminalOutcome(terminal.roleOutcome),
|
|
68
68
|
};
|
|
69
69
|
}
|
|
@@ -11,7 +11,7 @@ export function buildJudgeTurnRequest(admitted, options) {
|
|
|
11
11
|
}
|
|
12
12
|
function judgeAdapters() {
|
|
13
13
|
return {
|
|
14
|
-
trySettle: (admitted, authority) => trySettleJudgeTerminalResult(admitted, authority),
|
|
14
|
+
trySettle: (admitted, authority, scope) => trySettleJudgeTerminalResult(admitted, authority, scope),
|
|
15
15
|
resolveRunnerKnownFailure: async ({ result, sessionFile }) => {
|
|
16
16
|
const infrastructureFailure = await readEngineDetourInfrastructureFailure(sessionFile);
|
|
17
17
|
return (result.knownFailure ??
|