@akagilnc/pi-workflow-roles 0.1.2152 → 0.1.2157
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/public-cli/main.js +455 -360
- package/package.json +1 -1
- package/src/public-cli/auto-resume.ts +100 -0
- package/src/public-cli/coder-run.ts +34 -29
- package/src/public-cli/fixer-run.ts +31 -30
- package/src/public-cli/judge-run.ts +32 -28
- package/src/public-cli/merger-run.ts +31 -29
- package/src/public-cli/reviewer-run.ts +31 -30
- package/src/public-cli/run-lifecycle.ts +43 -25
- package/src/public-cli/terminal.ts +8 -0
package/dist/public-cli/main.js
CHANGED
|
@@ -18714,7 +18714,7 @@ var init_typed_provider_http = __esm({
|
|
|
18714
18714
|
});
|
|
18715
18715
|
|
|
18716
18716
|
// src/public-cli/run-lifecycle.ts
|
|
18717
|
-
import { lstat as lstat2, open, readdir as readdir2, readFile as readFile8, unlink as unlink3, writeFile as writeFile4 } from "node:fs/promises";
|
|
18717
|
+
import { chmod, lstat as lstat2, open, readdir as readdir2, readFile as readFile8, unlink as unlink3, writeFile as writeFile4 } from "node:fs/promises";
|
|
18718
18718
|
import { join as join10 } from "node:path";
|
|
18719
18719
|
function isV1ResumableProvider(provider) {
|
|
18720
18720
|
return V1_RESUMABLE_PROVIDERS.includes(provider);
|
|
@@ -18885,7 +18885,17 @@ async function acquireRunWriterLease(runDirectory) {
|
|
|
18885
18885
|
if (released) return;
|
|
18886
18886
|
released = true;
|
|
18887
18887
|
await handle.close().catch(() => void 0);
|
|
18888
|
-
|
|
18888
|
+
try {
|
|
18889
|
+
await unlink3(lockPath);
|
|
18890
|
+
} catch (error) {
|
|
18891
|
+
if (error.code === "EACCES") {
|
|
18892
|
+
try {
|
|
18893
|
+
await chmod(runDirectory, 493);
|
|
18894
|
+
await unlink3(lockPath);
|
|
18895
|
+
} catch {
|
|
18896
|
+
}
|
|
18897
|
+
}
|
|
18898
|
+
}
|
|
18889
18899
|
}
|
|
18890
18900
|
};
|
|
18891
18901
|
} catch (error) {
|
|
@@ -18944,12 +18954,6 @@ async function loadResumableRunRecord(home, runId) {
|
|
|
18944
18954
|
if (run === void 0) {
|
|
18945
18955
|
throw new CliUsageError(`unknown role run id: ${runId}`);
|
|
18946
18956
|
}
|
|
18947
|
-
if (run.state === "terminal") {
|
|
18948
|
-
throw new CliUsageError(`role run is already terminal: ${runId}`);
|
|
18949
|
-
}
|
|
18950
|
-
if (run.state !== "resumable" || run.resumable === void 0) {
|
|
18951
|
-
throw new CliUsageError(`role run is not resumable: ${runId}`);
|
|
18952
|
-
}
|
|
18953
18957
|
if (!await isSessionPrincipalAvailable(run.sessionFile)) {
|
|
18954
18958
|
throw new CliUsageError(
|
|
18955
18959
|
`role run Pi session principal is unavailable: ${runId}`
|
|
@@ -19063,7 +19067,7 @@ async function loadResumableRunRecord(home, runId) {
|
|
|
19063
19067
|
}
|
|
19064
19068
|
return {
|
|
19065
19069
|
run,
|
|
19066
|
-
observation: run.resumable,
|
|
19070
|
+
...run.resumable === void 0 ? {} : { observation: run.resumable },
|
|
19067
19071
|
admittedFields: {
|
|
19068
19072
|
instruction,
|
|
19069
19073
|
instructionEmpty,
|
|
@@ -19106,7 +19110,7 @@ async function loadResumableJudgeRun(home, runId) {
|
|
|
19106
19110
|
return {
|
|
19107
19111
|
admitted,
|
|
19108
19112
|
run: loaded.run,
|
|
19109
|
-
observation: loaded.observation
|
|
19113
|
+
...loaded.observation === void 0 ? {} : { observation: loaded.observation }
|
|
19110
19114
|
};
|
|
19111
19115
|
}
|
|
19112
19116
|
async function loadResumableCoderRun(home, runId) {
|
|
@@ -19152,7 +19156,7 @@ async function loadResumableCoderRun(home, runId) {
|
|
|
19152
19156
|
return {
|
|
19153
19157
|
admitted,
|
|
19154
19158
|
run: loaded.run,
|
|
19155
|
-
observation: loaded.observation
|
|
19159
|
+
...loaded.observation === void 0 ? {} : { observation: loaded.observation }
|
|
19156
19160
|
};
|
|
19157
19161
|
}
|
|
19158
19162
|
async function loadResumableFixerRun(home, runId) {
|
|
@@ -19201,7 +19205,7 @@ async function loadResumableFixerRun(home, runId) {
|
|
|
19201
19205
|
return {
|
|
19202
19206
|
admitted,
|
|
19203
19207
|
run: loaded.run,
|
|
19204
|
-
observation: loaded.observation
|
|
19208
|
+
...loaded.observation === void 0 ? {} : { observation: loaded.observation }
|
|
19205
19209
|
};
|
|
19206
19210
|
}
|
|
19207
19211
|
async function loadResumableReviewerRun(home, runId) {
|
|
@@ -19236,7 +19240,7 @@ async function loadResumableReviewerRun(home, runId) {
|
|
|
19236
19240
|
return {
|
|
19237
19241
|
admitted,
|
|
19238
19242
|
run: loaded.run,
|
|
19239
|
-
observation: loaded.observation
|
|
19243
|
+
...loaded.observation === void 0 ? {} : { observation: loaded.observation }
|
|
19240
19244
|
};
|
|
19241
19245
|
}
|
|
19242
19246
|
async function loadResumableMergerRun(home, runId) {
|
|
@@ -19282,7 +19286,7 @@ async function loadResumableMergerRun(home, runId) {
|
|
|
19282
19286
|
return {
|
|
19283
19287
|
admitted,
|
|
19284
19288
|
run: loaded.run,
|
|
19285
|
-
observation: loaded.observation
|
|
19289
|
+
...loaded.observation === void 0 ? {} : { observation: loaded.observation }
|
|
19286
19290
|
};
|
|
19287
19291
|
}
|
|
19288
19292
|
async function peekRoleRunRole(home, runId) {
|
|
@@ -19291,7 +19295,7 @@ async function peekRoleRunRole(home, runId) {
|
|
|
19291
19295
|
const run = await readRoleRunState(runDirectory);
|
|
19292
19296
|
return run?.role;
|
|
19293
19297
|
}
|
|
19294
|
-
var V1_RESUMABLE_PROVIDERS, RESUME_TRANSPORT_ENVELOPE, RUN_STATE_FILE, WRITER_LOCK_FILE, RunWriterLeaseHeldError;
|
|
19298
|
+
var V1_RESUMABLE_PROVIDERS, AUTO_RESUME_LIMIT, RESUME_TRANSPORT_ENVELOPE, RUN_STATE_FILE, WRITER_LOCK_FILE, RunWriterLeaseHeldError;
|
|
19295
19299
|
var init_run_lifecycle = __esm({
|
|
19296
19300
|
"src/public-cli/run-lifecycle.ts"() {
|
|
19297
19301
|
"use strict";
|
|
@@ -19301,6 +19305,7 @@ var init_run_lifecycle = __esm({
|
|
|
19301
19305
|
init_typed_provider_http();
|
|
19302
19306
|
init_invocation();
|
|
19303
19307
|
V1_RESUMABLE_PROVIDERS = ["openai-codex", "xai"];
|
|
19308
|
+
AUTO_RESUME_LIMIT = 2;
|
|
19304
19309
|
RESUME_TRANSPORT_ENVELOPE = "[ak-role:resume-continue]";
|
|
19305
19310
|
RUN_STATE_FILE = "run-state.json";
|
|
19306
19311
|
WRITER_LOCK_FILE = "writer.lock";
|
|
@@ -19314,6 +19319,176 @@ var init_run_lifecycle = __esm({
|
|
|
19314
19319
|
}
|
|
19315
19320
|
});
|
|
19316
19321
|
|
|
19322
|
+
// src/public-command-renderer.ts
|
|
19323
|
+
function renderPublicAkRoleCommand(target) {
|
|
19324
|
+
if (!PUBLIC_CALLABLE_ROLES2.has(target.role)) return void 0;
|
|
19325
|
+
const role = target.role;
|
|
19326
|
+
if (target.phase === null || target.phase === void 0) {
|
|
19327
|
+
return `ak-role ${role}`;
|
|
19328
|
+
}
|
|
19329
|
+
if (role === "coder" || role === "fixer") {
|
|
19330
|
+
return `ak-role ${role} ${target.phase}`;
|
|
19331
|
+
}
|
|
19332
|
+
return `ak-role ${role}`;
|
|
19333
|
+
}
|
|
19334
|
+
var PUBLIC_CALLABLE_ROLES2;
|
|
19335
|
+
var init_public_command_renderer = __esm({
|
|
19336
|
+
"src/public-command-renderer.ts"() {
|
|
19337
|
+
"use strict";
|
|
19338
|
+
init_packaged_role_registry();
|
|
19339
|
+
PUBLIC_CALLABLE_ROLES2 = new Set(
|
|
19340
|
+
PACKAGED_ROLE_REGISTRY.map((entry) => entry.role)
|
|
19341
|
+
);
|
|
19342
|
+
}
|
|
19343
|
+
});
|
|
19344
|
+
|
|
19345
|
+
// src/public-cli/command-renderer.ts
|
|
19346
|
+
var init_command_renderer = __esm({
|
|
19347
|
+
"src/public-cli/command-renderer.ts"() {
|
|
19348
|
+
"use strict";
|
|
19349
|
+
init_public_command_renderer();
|
|
19350
|
+
}
|
|
19351
|
+
});
|
|
19352
|
+
|
|
19353
|
+
// src/public-cli/terminal.ts
|
|
19354
|
+
function encodeTerminalField(value) {
|
|
19355
|
+
return JSON.stringify(value);
|
|
19356
|
+
}
|
|
19357
|
+
function jsonSafeComplianceCandidate(value) {
|
|
19358
|
+
return value === void 0 ? JSON_SAFE_UNDEFINED_ARGUMENT : value;
|
|
19359
|
+
}
|
|
19360
|
+
function isLawfulTypedTerminalOutcome(outcome) {
|
|
19361
|
+
return outcome.kind === "accepted" || outcome.kind === "audit_escalation" || outcome.kind === "no_receipt";
|
|
19362
|
+
}
|
|
19363
|
+
function exitCodeForTerminalOutcome(outcome) {
|
|
19364
|
+
return isLawfulTypedTerminalOutcome(outcome) ? 0 : 1;
|
|
19365
|
+
}
|
|
19366
|
+
function buildResidualIncompleteTerminalOutcome(input) {
|
|
19367
|
+
return {
|
|
19368
|
+
kind: "incomplete",
|
|
19369
|
+
role: input.role,
|
|
19370
|
+
status: "incomplete",
|
|
19371
|
+
decision: "no-usable-result",
|
|
19372
|
+
candidate: input.candidate,
|
|
19373
|
+
diagnostic: input.diagnostic,
|
|
19374
|
+
acceptedReceipt: false,
|
|
19375
|
+
decisiveFacts: {
|
|
19376
|
+
decision: "no-usable-result",
|
|
19377
|
+
candidate: input.candidate,
|
|
19378
|
+
diagnostic: input.diagnostic,
|
|
19379
|
+
acceptedReceipt: false
|
|
19380
|
+
}
|
|
19381
|
+
};
|
|
19382
|
+
}
|
|
19383
|
+
function buildAuditIncompleteTerminalOutcome(input) {
|
|
19384
|
+
const roleCandidate = jsonSafeComplianceCandidate(input.roleCandidate);
|
|
19385
|
+
const audit = {
|
|
19386
|
+
...input.audit,
|
|
19387
|
+
candidate: jsonSafeComplianceCandidate(input.audit.candidate)
|
|
19388
|
+
};
|
|
19389
|
+
return {
|
|
19390
|
+
kind: "audit_incomplete",
|
|
19391
|
+
role: input.role,
|
|
19392
|
+
status: "audit-incomplete",
|
|
19393
|
+
decision: "no-usable-decision",
|
|
19394
|
+
roleCandidate,
|
|
19395
|
+
audit,
|
|
19396
|
+
acceptedReceipt: false,
|
|
19397
|
+
decisiveFacts: {
|
|
19398
|
+
decision: "no-usable-decision",
|
|
19399
|
+
roleCandidate,
|
|
19400
|
+
auditCandidate: audit.candidate,
|
|
19401
|
+
auditObservation: audit.observation,
|
|
19402
|
+
observationKind: audit.observation.kind,
|
|
19403
|
+
observationType: audit.observation.kind === "non-object-arguments" ? audit.observation.type : audit.observation.kind === "object-status-unreadable" ? audit.observation.status : audit.observation.kind === "missing-subject" ? audit.observation.subject : audit.observation.kind,
|
|
19404
|
+
acceptedReceipt: false
|
|
19405
|
+
}
|
|
19406
|
+
};
|
|
19407
|
+
}
|
|
19408
|
+
function redactExactRunId(text, runId) {
|
|
19409
|
+
if (runId.length === 0) return text;
|
|
19410
|
+
if (!text.includes(runId)) return text;
|
|
19411
|
+
return text.split(runId).join(REDACTED_RUN_ID_TOKEN);
|
|
19412
|
+
}
|
|
19413
|
+
function recommendationNavigatorFact(input) {
|
|
19414
|
+
void input.modelCommand;
|
|
19415
|
+
const command = renderPublicAkRoleCommand(input.next);
|
|
19416
|
+
if (command === void 0) {
|
|
19417
|
+
return {
|
|
19418
|
+
disposition: "unavailable",
|
|
19419
|
+
source: "unknown",
|
|
19420
|
+
reason: `recommended role is not a public callable seat: ${input.next.role}`
|
|
19421
|
+
};
|
|
19422
|
+
}
|
|
19423
|
+
return {
|
|
19424
|
+
disposition: "recommendation",
|
|
19425
|
+
next: input.next,
|
|
19426
|
+
reason: input.reason,
|
|
19427
|
+
command,
|
|
19428
|
+
...input.route === void 0 ? {} : { route: input.route },
|
|
19429
|
+
...input.advisoryDiagnostic === void 0 ? {} : { advisoryDiagnostic: input.advisoryDiagnostic }
|
|
19430
|
+
};
|
|
19431
|
+
}
|
|
19432
|
+
function formatTerminalResult(result2) {
|
|
19433
|
+
const lines = [];
|
|
19434
|
+
lines.push("role outcome status");
|
|
19435
|
+
const outcomeStatus = result2.roleOutcome.kind === "failure" ? result2.roleOutcome.cause : result2.roleOutcome.status;
|
|
19436
|
+
lines.push(
|
|
19437
|
+
`${result2.roleOutcome.role} ${result2.roleOutcome.kind} ${encodeTerminalField(outcomeStatus)}`
|
|
19438
|
+
);
|
|
19439
|
+
if (result2.roleOutcome.kind === "failure") {
|
|
19440
|
+
lines.push(
|
|
19441
|
+
`diagnostic ${encodeTerminalField(result2.roleOutcome.diagnostic)}`
|
|
19442
|
+
);
|
|
19443
|
+
}
|
|
19444
|
+
const facts = result2.roleOutcome.decisiveFacts;
|
|
19445
|
+
for (const [key, value] of Object.entries(facts)) {
|
|
19446
|
+
if (value === void 0) continue;
|
|
19447
|
+
const rendered = typeof value === "string" ? value : JSON.stringify(value);
|
|
19448
|
+
lines.push(`fact ${encodeTerminalField(key)} ${encodeTerminalField(rendered)}`);
|
|
19449
|
+
}
|
|
19450
|
+
lines.push(`navigator ${result2.navigator.disposition}`);
|
|
19451
|
+
if (result2.navigator.advisoryDiagnostic !== void 0) {
|
|
19452
|
+
lines.push(`navigator-advisory ${encodeTerminalField(result2.navigator.advisoryDiagnostic)}`);
|
|
19453
|
+
}
|
|
19454
|
+
if (result2.navigator.disposition === "recommendation") {
|
|
19455
|
+
lines.push(
|
|
19456
|
+
`next ${result2.navigator.next.role} ${result2.navigator.next.phase ?? "none"}`
|
|
19457
|
+
);
|
|
19458
|
+
lines.push(`reason ${encodeTerminalField(result2.navigator.reason)}`);
|
|
19459
|
+
lines.push(`command ${encodeTerminalField(result2.navigator.command)}`);
|
|
19460
|
+
} else if (result2.navigator.disposition === "unavailable") {
|
|
19461
|
+
lines.push(
|
|
19462
|
+
`unavailable ${result2.navigator.source} ${encodeTerminalField(result2.navigator.reason)}`
|
|
19463
|
+
);
|
|
19464
|
+
}
|
|
19465
|
+
for (const artifact of result2.artifacts) {
|
|
19466
|
+
lines.push(`artifact ${artifact.kind} ${encodeTerminalField(artifact.path)}`);
|
|
19467
|
+
}
|
|
19468
|
+
if (result2.resume !== void 0) {
|
|
19469
|
+
lines.push(`resume ${encodeTerminalField(result2.resume.command)}`);
|
|
19470
|
+
} else if (result2.runId !== void 0) {
|
|
19471
|
+
lines.push(`run ${encodeTerminalField(result2.runId)}`);
|
|
19472
|
+
}
|
|
19473
|
+
if (result2.autoResumeCount !== void 0) {
|
|
19474
|
+
lines.push(`autoResumeCount ${encodeTerminalField(String(result2.autoResumeCount))}`);
|
|
19475
|
+
}
|
|
19476
|
+
return `${lines.join("\n")}
|
|
19477
|
+
`;
|
|
19478
|
+
}
|
|
19479
|
+
var JSON_SAFE_UNDEFINED_ARGUMENT, REDACTED_RUN_ID_TOKEN;
|
|
19480
|
+
var init_terminal = __esm({
|
|
19481
|
+
"src/public-cli/terminal.ts"() {
|
|
19482
|
+
"use strict";
|
|
19483
|
+
init_command_renderer();
|
|
19484
|
+
JSON_SAFE_UNDEFINED_ARGUMENT = Object.freeze({
|
|
19485
|
+
kind: "json-safe-sentinel",
|
|
19486
|
+
type: "undefined"
|
|
19487
|
+
});
|
|
19488
|
+
REDACTED_RUN_ID_TOKEN = "[run-id]";
|
|
19489
|
+
}
|
|
19490
|
+
});
|
|
19491
|
+
|
|
19317
19492
|
// src/auditor-soul.ts
|
|
19318
19493
|
import { fileURLToPath } from "node:url";
|
|
19319
19494
|
var AUDITOR_SOUL_ROLES, auditorSoulPaths;
|
|
@@ -19656,223 +19831,56 @@ function bindCurrentDurableTerminalToMarker(entries) {
|
|
|
19656
19831
|
if (isInvocationMarkerEntry(entries[i])) {
|
|
19657
19832
|
markerIndex = i;
|
|
19658
19833
|
break;
|
|
19659
|
-
}
|
|
19660
|
-
}
|
|
19661
|
-
if (markerIndex < 0) {
|
|
19662
|
-
return { kind: "unbound", terminal };
|
|
19663
|
-
}
|
|
19664
|
-
const marker = parseInvocationMarkerIdentity(entries[markerIndex]?.data);
|
|
19665
|
-
if (marker === void 0) {
|
|
19666
|
-
return { kind: "unbound", terminal };
|
|
19667
|
-
}
|
|
19668
|
-
let windowEnd = entries.length;
|
|
19669
|
-
for (let i = markerIndex + 1; i < entries.length; i += 1) {
|
|
19670
|
-
if (isInvocationMarkerEntry(entries[i])) {
|
|
19671
|
-
windowEnd = i;
|
|
19672
|
-
break;
|
|
19673
|
-
}
|
|
19674
|
-
}
|
|
19675
|
-
let durableCount = 0;
|
|
19676
|
-
for (let i = markerIndex + 1; i < windowEnd; i += 1) {
|
|
19677
|
-
if (durableTerminalAt(entries, i) !== void 0) durableCount += 1;
|
|
19678
|
-
}
|
|
19679
|
-
if (durableCount !== 1) return { kind: "ambiguous" };
|
|
19680
|
-
if (terminal.index <= markerIndex || terminal.index >= windowEnd) {
|
|
19681
|
-
return { kind: "ambiguous" };
|
|
19682
|
-
}
|
|
19683
|
-
return {
|
|
19684
|
-
kind: "bound",
|
|
19685
|
-
terminal,
|
|
19686
|
-
marker: { ...marker, index: markerIndex }
|
|
19687
|
-
};
|
|
19688
|
-
}
|
|
19689
|
-
function isReceiptSettlementBindingClear(entries) {
|
|
19690
|
-
return bindCurrentDurableTerminalToMarker(entries).kind !== "ambiguous";
|
|
19691
|
-
}
|
|
19692
|
-
var NAVIGATOR_INVOCATION_ENTRY, NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND, NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS, PACKAGED_ROLE_OUTPUT_TOOLS;
|
|
19693
|
-
var init_navigator_invocation_identity = __esm({
|
|
19694
|
-
"src/navigator-invocation-identity.ts"() {
|
|
19695
|
-
"use strict";
|
|
19696
|
-
init_packaged_role_registry();
|
|
19697
|
-
init_uuidv7();
|
|
19698
|
-
init_work_subject_identity();
|
|
19699
|
-
NAVIGATOR_INVOCATION_ENTRY = "ak-navigator-invocation";
|
|
19700
|
-
NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND = "role_infrastructure_failure";
|
|
19701
|
-
NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS = [
|
|
19702
|
-
"kind",
|
|
19703
|
-
"source",
|
|
19704
|
-
"reasonCode"
|
|
19705
|
-
];
|
|
19706
|
-
PACKAGED_ROLE_OUTPUT_TOOLS = new Map(
|
|
19707
|
-
PACKAGED_ROLE_REGISTRY.map((entry) => [entry.outputTool, entry.role])
|
|
19708
|
-
);
|
|
19709
|
-
}
|
|
19710
|
-
});
|
|
19711
|
-
|
|
19712
|
-
// src/public-command-renderer.ts
|
|
19713
|
-
function renderPublicAkRoleCommand(target) {
|
|
19714
|
-
if (!PUBLIC_CALLABLE_ROLES2.has(target.role)) return void 0;
|
|
19715
|
-
const role = target.role;
|
|
19716
|
-
if (target.phase === null || target.phase === void 0) {
|
|
19717
|
-
return `ak-role ${role}`;
|
|
19718
|
-
}
|
|
19719
|
-
if (role === "coder" || role === "fixer") {
|
|
19720
|
-
return `ak-role ${role} ${target.phase}`;
|
|
19721
|
-
}
|
|
19722
|
-
return `ak-role ${role}`;
|
|
19723
|
-
}
|
|
19724
|
-
var PUBLIC_CALLABLE_ROLES2;
|
|
19725
|
-
var init_public_command_renderer = __esm({
|
|
19726
|
-
"src/public-command-renderer.ts"() {
|
|
19727
|
-
"use strict";
|
|
19728
|
-
init_packaged_role_registry();
|
|
19729
|
-
PUBLIC_CALLABLE_ROLES2 = new Set(
|
|
19730
|
-
PACKAGED_ROLE_REGISTRY.map((entry) => entry.role)
|
|
19731
|
-
);
|
|
19732
|
-
}
|
|
19733
|
-
});
|
|
19734
|
-
|
|
19735
|
-
// src/public-cli/command-renderer.ts
|
|
19736
|
-
var init_command_renderer = __esm({
|
|
19737
|
-
"src/public-cli/command-renderer.ts"() {
|
|
19738
|
-
"use strict";
|
|
19739
|
-
init_public_command_renderer();
|
|
19740
|
-
}
|
|
19741
|
-
});
|
|
19742
|
-
|
|
19743
|
-
// src/public-cli/terminal.ts
|
|
19744
|
-
function encodeTerminalField(value) {
|
|
19745
|
-
return JSON.stringify(value);
|
|
19746
|
-
}
|
|
19747
|
-
function jsonSafeComplianceCandidate(value) {
|
|
19748
|
-
return value === void 0 ? JSON_SAFE_UNDEFINED_ARGUMENT : value;
|
|
19749
|
-
}
|
|
19750
|
-
function isLawfulTypedTerminalOutcome(outcome) {
|
|
19751
|
-
return outcome.kind === "accepted" || outcome.kind === "audit_escalation" || outcome.kind === "no_receipt";
|
|
19752
|
-
}
|
|
19753
|
-
function exitCodeForTerminalOutcome(outcome) {
|
|
19754
|
-
return isLawfulTypedTerminalOutcome(outcome) ? 0 : 1;
|
|
19755
|
-
}
|
|
19756
|
-
function buildResidualIncompleteTerminalOutcome(input) {
|
|
19757
|
-
return {
|
|
19758
|
-
kind: "incomplete",
|
|
19759
|
-
role: input.role,
|
|
19760
|
-
status: "incomplete",
|
|
19761
|
-
decision: "no-usable-result",
|
|
19762
|
-
candidate: input.candidate,
|
|
19763
|
-
diagnostic: input.diagnostic,
|
|
19764
|
-
acceptedReceipt: false,
|
|
19765
|
-
decisiveFacts: {
|
|
19766
|
-
decision: "no-usable-result",
|
|
19767
|
-
candidate: input.candidate,
|
|
19768
|
-
diagnostic: input.diagnostic,
|
|
19769
|
-
acceptedReceipt: false
|
|
19770
|
-
}
|
|
19771
|
-
};
|
|
19772
|
-
}
|
|
19773
|
-
function buildAuditIncompleteTerminalOutcome(input) {
|
|
19774
|
-
const roleCandidate = jsonSafeComplianceCandidate(input.roleCandidate);
|
|
19775
|
-
const audit = {
|
|
19776
|
-
...input.audit,
|
|
19777
|
-
candidate: jsonSafeComplianceCandidate(input.audit.candidate)
|
|
19778
|
-
};
|
|
19779
|
-
return {
|
|
19780
|
-
kind: "audit_incomplete",
|
|
19781
|
-
role: input.role,
|
|
19782
|
-
status: "audit-incomplete",
|
|
19783
|
-
decision: "no-usable-decision",
|
|
19784
|
-
roleCandidate,
|
|
19785
|
-
audit,
|
|
19786
|
-
acceptedReceipt: false,
|
|
19787
|
-
decisiveFacts: {
|
|
19788
|
-
decision: "no-usable-decision",
|
|
19789
|
-
roleCandidate,
|
|
19790
|
-
auditCandidate: audit.candidate,
|
|
19791
|
-
auditObservation: audit.observation,
|
|
19792
|
-
observationKind: audit.observation.kind,
|
|
19793
|
-
observationType: audit.observation.kind === "non-object-arguments" ? audit.observation.type : audit.observation.kind === "object-status-unreadable" ? audit.observation.status : audit.observation.kind === "missing-subject" ? audit.observation.subject : audit.observation.kind,
|
|
19794
|
-
acceptedReceipt: false
|
|
19795
|
-
}
|
|
19796
|
-
};
|
|
19797
|
-
}
|
|
19798
|
-
function redactExactRunId(text, runId) {
|
|
19799
|
-
if (runId.length === 0) return text;
|
|
19800
|
-
if (!text.includes(runId)) return text;
|
|
19801
|
-
return text.split(runId).join(REDACTED_RUN_ID_TOKEN);
|
|
19802
|
-
}
|
|
19803
|
-
function recommendationNavigatorFact(input) {
|
|
19804
|
-
void input.modelCommand;
|
|
19805
|
-
const command = renderPublicAkRoleCommand(input.next);
|
|
19806
|
-
if (command === void 0) {
|
|
19807
|
-
return {
|
|
19808
|
-
disposition: "unavailable",
|
|
19809
|
-
source: "unknown",
|
|
19810
|
-
reason: `recommended role is not a public callable seat: ${input.next.role}`
|
|
19811
|
-
};
|
|
19812
|
-
}
|
|
19813
|
-
return {
|
|
19814
|
-
disposition: "recommendation",
|
|
19815
|
-
next: input.next,
|
|
19816
|
-
reason: input.reason,
|
|
19817
|
-
command,
|
|
19818
|
-
...input.route === void 0 ? {} : { route: input.route },
|
|
19819
|
-
...input.advisoryDiagnostic === void 0 ? {} : { advisoryDiagnostic: input.advisoryDiagnostic }
|
|
19820
|
-
};
|
|
19821
|
-
}
|
|
19822
|
-
function formatTerminalResult(result2) {
|
|
19823
|
-
const lines = [];
|
|
19824
|
-
lines.push("role outcome status");
|
|
19825
|
-
const outcomeStatus = result2.roleOutcome.kind === "failure" ? result2.roleOutcome.cause : result2.roleOutcome.status;
|
|
19826
|
-
lines.push(
|
|
19827
|
-
`${result2.roleOutcome.role} ${result2.roleOutcome.kind} ${encodeTerminalField(outcomeStatus)}`
|
|
19828
|
-
);
|
|
19829
|
-
if (result2.roleOutcome.kind === "failure") {
|
|
19830
|
-
lines.push(
|
|
19831
|
-
`diagnostic ${encodeTerminalField(result2.roleOutcome.diagnostic)}`
|
|
19832
|
-
);
|
|
19834
|
+
}
|
|
19833
19835
|
}
|
|
19834
|
-
|
|
19835
|
-
|
|
19836
|
-
if (value === void 0) continue;
|
|
19837
|
-
const rendered = typeof value === "string" ? value : JSON.stringify(value);
|
|
19838
|
-
lines.push(`fact ${encodeTerminalField(key)} ${encodeTerminalField(rendered)}`);
|
|
19836
|
+
if (markerIndex < 0) {
|
|
19837
|
+
return { kind: "unbound", terminal };
|
|
19839
19838
|
}
|
|
19840
|
-
|
|
19841
|
-
if (
|
|
19842
|
-
|
|
19839
|
+
const marker = parseInvocationMarkerIdentity(entries[markerIndex]?.data);
|
|
19840
|
+
if (marker === void 0) {
|
|
19841
|
+
return { kind: "unbound", terminal };
|
|
19843
19842
|
}
|
|
19844
|
-
|
|
19845
|
-
|
|
19846
|
-
|
|
19847
|
-
|
|
19848
|
-
|
|
19849
|
-
|
|
19850
|
-
} else if (result2.navigator.disposition === "unavailable") {
|
|
19851
|
-
lines.push(
|
|
19852
|
-
`unavailable ${result2.navigator.source} ${encodeTerminalField(result2.navigator.reason)}`
|
|
19853
|
-
);
|
|
19843
|
+
let windowEnd = entries.length;
|
|
19844
|
+
for (let i = markerIndex + 1; i < entries.length; i += 1) {
|
|
19845
|
+
if (isInvocationMarkerEntry(entries[i])) {
|
|
19846
|
+
windowEnd = i;
|
|
19847
|
+
break;
|
|
19848
|
+
}
|
|
19854
19849
|
}
|
|
19855
|
-
|
|
19856
|
-
|
|
19850
|
+
let durableCount = 0;
|
|
19851
|
+
for (let i = markerIndex + 1; i < windowEnd; i += 1) {
|
|
19852
|
+
if (durableTerminalAt(entries, i) !== void 0) durableCount += 1;
|
|
19857
19853
|
}
|
|
19858
|
-
if (
|
|
19859
|
-
|
|
19860
|
-
|
|
19861
|
-
lines.push(`run ${encodeTerminalField(result2.runId)}`);
|
|
19854
|
+
if (durableCount !== 1) return { kind: "ambiguous" };
|
|
19855
|
+
if (terminal.index <= markerIndex || terminal.index >= windowEnd) {
|
|
19856
|
+
return { kind: "ambiguous" };
|
|
19862
19857
|
}
|
|
19863
|
-
return
|
|
19864
|
-
|
|
19858
|
+
return {
|
|
19859
|
+
kind: "bound",
|
|
19860
|
+
terminal,
|
|
19861
|
+
marker: { ...marker, index: markerIndex }
|
|
19862
|
+
};
|
|
19865
19863
|
}
|
|
19866
|
-
|
|
19867
|
-
|
|
19868
|
-
|
|
19864
|
+
function isReceiptSettlementBindingClear(entries) {
|
|
19865
|
+
return bindCurrentDurableTerminalToMarker(entries).kind !== "ambiguous";
|
|
19866
|
+
}
|
|
19867
|
+
var NAVIGATOR_INVOCATION_ENTRY, NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND, NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS, PACKAGED_ROLE_OUTPUT_TOOLS;
|
|
19868
|
+
var init_navigator_invocation_identity = __esm({
|
|
19869
|
+
"src/navigator-invocation-identity.ts"() {
|
|
19869
19870
|
"use strict";
|
|
19870
|
-
|
|
19871
|
-
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19871
|
+
init_packaged_role_registry();
|
|
19872
|
+
init_uuidv7();
|
|
19873
|
+
init_work_subject_identity();
|
|
19874
|
+
NAVIGATOR_INVOCATION_ENTRY = "ak-navigator-invocation";
|
|
19875
|
+
NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND = "role_infrastructure_failure";
|
|
19876
|
+
NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS = [
|
|
19877
|
+
"kind",
|
|
19878
|
+
"source",
|
|
19879
|
+
"reasonCode"
|
|
19880
|
+
];
|
|
19881
|
+
PACKAGED_ROLE_OUTPUT_TOOLS = new Map(
|
|
19882
|
+
PACKAGED_ROLE_REGISTRY.map((entry) => [entry.outputTool, entry.role])
|
|
19883
|
+
);
|
|
19876
19884
|
}
|
|
19877
19885
|
});
|
|
19878
19886
|
|
|
@@ -22480,6 +22488,87 @@ var init_settlement = __esm({
|
|
|
22480
22488
|
}
|
|
22481
22489
|
});
|
|
22482
22490
|
|
|
22491
|
+
// src/public-cli/auto-resume.ts
|
|
22492
|
+
async function runWithAutoResumeLoop(options) {
|
|
22493
|
+
let autoResumeAttempts = 0;
|
|
22494
|
+
let isFirst = true;
|
|
22495
|
+
let currentExtraArgs = options.buildInitialArgs();
|
|
22496
|
+
while (true) {
|
|
22497
|
+
let lease;
|
|
22498
|
+
try {
|
|
22499
|
+
lease = await acquireRunWriterLease(options.admitted.runDirectory);
|
|
22500
|
+
} catch (error) {
|
|
22501
|
+
if (error instanceof RunWriterLeaseHeldError) {
|
|
22502
|
+
presentStructuralRejection(error, options.io);
|
|
22503
|
+
return { exitCode: 2 };
|
|
22504
|
+
}
|
|
22505
|
+
throw error;
|
|
22506
|
+
}
|
|
22507
|
+
const result2 = await options.dispatch(currentExtraArgs, lease, isFirst, dummyIo);
|
|
22508
|
+
const terminal = result2.terminal;
|
|
22509
|
+
if (terminal !== void 0) {
|
|
22510
|
+
terminal.autoResumeCount = autoResumeAttempts;
|
|
22511
|
+
}
|
|
22512
|
+
const lawful = terminal !== void 0 && isLawfulTypedTerminalOutcome(terminal.roleOutcome);
|
|
22513
|
+
if (lawful) {
|
|
22514
|
+
if (terminal !== void 0) {
|
|
22515
|
+
options.io.stdout(formatTerminalResult(terminal));
|
|
22516
|
+
}
|
|
22517
|
+
return result2;
|
|
22518
|
+
}
|
|
22519
|
+
if (terminal !== void 0 && (terminal.roleOutcome.kind === "incomplete" || terminal.roleOutcome.kind === "audit_incomplete")) {
|
|
22520
|
+
if (terminal.roleOutcome.kind === "audit_incomplete") {
|
|
22521
|
+
options.io.stdout(formatTerminalResult(terminal));
|
|
22522
|
+
} else {
|
|
22523
|
+
options.io.stdout(formatTerminalResult(terminal));
|
|
22524
|
+
}
|
|
22525
|
+
return result2;
|
|
22526
|
+
}
|
|
22527
|
+
if (terminal !== void 0 && terminal.roleOutcome.kind === "failure") {
|
|
22528
|
+
const terminalJson = JSON.stringify(terminal);
|
|
22529
|
+
if (terminalJson.includes("retentionFailure") || terminalJson.includes("ComplianceResponseRetentionError")) {
|
|
22530
|
+
presentFailureTerminal(terminal, options.io);
|
|
22531
|
+
return result2;
|
|
22532
|
+
}
|
|
22533
|
+
}
|
|
22534
|
+
if (autoResumeAttempts >= AUTO_RESUME_LIMIT) {
|
|
22535
|
+
if (terminal !== void 0) {
|
|
22536
|
+
if (terminal.roleOutcome.kind === "failure" || terminal.roleOutcome.kind === "no_receipt") {
|
|
22537
|
+
presentFailureTerminal(terminal, options.io);
|
|
22538
|
+
} else {
|
|
22539
|
+
options.io.stdout(formatTerminalResult(terminal));
|
|
22540
|
+
}
|
|
22541
|
+
}
|
|
22542
|
+
return result2;
|
|
22543
|
+
}
|
|
22544
|
+
if (!await isSessionPrincipalAvailable(options.admitted.sessionFile)) {
|
|
22545
|
+
if (terminal !== void 0) {
|
|
22546
|
+
if (terminal.roleOutcome.kind === "failure" || terminal.roleOutcome.kind === "no_receipt") {
|
|
22547
|
+
presentFailureTerminal(terminal, options.io);
|
|
22548
|
+
} else {
|
|
22549
|
+
options.io.stdout(formatTerminalResult(terminal));
|
|
22550
|
+
}
|
|
22551
|
+
}
|
|
22552
|
+
return result2;
|
|
22553
|
+
}
|
|
22554
|
+
autoResumeAttempts++;
|
|
22555
|
+
currentExtraArgs = options.buildResumeArgs();
|
|
22556
|
+
isFirst = false;
|
|
22557
|
+
}
|
|
22558
|
+
}
|
|
22559
|
+
var dummyIo;
|
|
22560
|
+
var init_auto_resume = __esm({
|
|
22561
|
+
"src/public-cli/auto-resume.ts"() {
|
|
22562
|
+
"use strict";
|
|
22563
|
+
init_run_lifecycle();
|
|
22564
|
+
init_terminal();
|
|
22565
|
+
init_settlement();
|
|
22566
|
+
dummyIo = { stdout: () => {
|
|
22567
|
+
}, stderr: () => {
|
|
22568
|
+
} };
|
|
22569
|
+
}
|
|
22570
|
+
});
|
|
22571
|
+
|
|
22483
22572
|
// src/public-cli/coder-run.ts
|
|
22484
22573
|
import { writeFile as writeFile6 } from "node:fs/promises";
|
|
22485
22574
|
import { join as join12 } from "node:path";
|
|
@@ -22723,16 +22812,6 @@ async function runPublicCoder(argv, env, io, parseCoderArgv2) {
|
|
|
22723
22812
|
throw error;
|
|
22724
22813
|
}
|
|
22725
22814
|
await markRunAdmitted(admitted);
|
|
22726
|
-
let lease;
|
|
22727
|
-
try {
|
|
22728
|
-
lease = await acquireRunWriterLease(admitted.runDirectory);
|
|
22729
|
-
} catch (error) {
|
|
22730
|
-
if (error instanceof RunWriterLeaseHeldError) {
|
|
22731
|
-
presentStructuralRejection(error, io);
|
|
22732
|
-
return { exitCode: 2 };
|
|
22733
|
-
}
|
|
22734
|
-
throw error;
|
|
22735
|
-
}
|
|
22736
22815
|
let methodProvenance;
|
|
22737
22816
|
if (admitted.phase === "apply") {
|
|
22738
22817
|
try {
|
|
@@ -22742,7 +22821,6 @@ async function runPublicCoder(argv, env, io, parseCoderArgv2) {
|
|
|
22742
22821
|
);
|
|
22743
22822
|
methodProvenance = material.provenance;
|
|
22744
22823
|
} catch (error) {
|
|
22745
|
-
await lease.release();
|
|
22746
22824
|
return await presentControlledFailure2(
|
|
22747
22825
|
admitted,
|
|
22748
22826
|
{
|
|
@@ -22756,23 +22834,32 @@ async function runPublicCoder(argv, env, io, parseCoderArgv2) {
|
|
|
22756
22834
|
);
|
|
22757
22835
|
}
|
|
22758
22836
|
}
|
|
22759
|
-
|
|
22760
|
-
packageRoot: env.packageRoot,
|
|
22761
|
-
...env.model === void 0 ? {} : { model: env.model },
|
|
22762
|
-
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
22763
|
-
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
22764
|
-
});
|
|
22765
|
-
return await dispatchAdmittedCoder({
|
|
22837
|
+
return runWithAutoResumeLoop({
|
|
22766
22838
|
admitted,
|
|
22767
|
-
env: {
|
|
22768
|
-
...env,
|
|
22769
|
-
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
22770
|
-
},
|
|
22771
22839
|
io,
|
|
22772
|
-
|
|
22773
|
-
|
|
22774
|
-
|
|
22775
|
-
|
|
22840
|
+
buildInitialArgs: () => buildCoderActivationExtraArgs(admitted, {
|
|
22841
|
+
packageRoot: env.packageRoot,
|
|
22842
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
22843
|
+
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
22844
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
22845
|
+
}),
|
|
22846
|
+
buildResumeArgs: () => buildCoderResumeActivationExtraArgs(admitted, {
|
|
22847
|
+
packageRoot: env.packageRoot,
|
|
22848
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
22849
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
22850
|
+
}),
|
|
22851
|
+
dispatch: (extraArgs, lease, isFirst, attemptIo) => dispatchAdmittedCoder({
|
|
22852
|
+
admitted,
|
|
22853
|
+
env: {
|
|
22854
|
+
...env,
|
|
22855
|
+
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
22856
|
+
},
|
|
22857
|
+
io: attemptIo,
|
|
22858
|
+
extraArgs,
|
|
22859
|
+
lease,
|
|
22860
|
+
...methodProvenance === void 0 ? {} : { methodProvenance },
|
|
22861
|
+
...isFirst && env.engine !== void 0 ? { effectiveEngine: env.engine } : {}
|
|
22862
|
+
})
|
|
22776
22863
|
});
|
|
22777
22864
|
}
|
|
22778
22865
|
async function runPublicCoderResume(argv, env, io) {
|
|
@@ -22840,7 +22927,7 @@ async function runPublicCoderResume(argv, env, io) {
|
|
|
22840
22927
|
...env.model === void 0 ? {} : { model: env.model },
|
|
22841
22928
|
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
22842
22929
|
});
|
|
22843
|
-
|
|
22930
|
+
const result2 = await dispatchAdmittedCoder({
|
|
22844
22931
|
admitted,
|
|
22845
22932
|
env: {
|
|
22846
22933
|
...env,
|
|
@@ -22851,6 +22938,10 @@ async function runPublicCoderResume(argv, env, io) {
|
|
|
22851
22938
|
lease,
|
|
22852
22939
|
...methodProvenance === void 0 ? {} : { methodProvenance }
|
|
22853
22940
|
});
|
|
22941
|
+
if (result2.terminal !== void 0) {
|
|
22942
|
+
result2.terminal.autoResumeCount = 0;
|
|
22943
|
+
}
|
|
22944
|
+
return result2;
|
|
22854
22945
|
}
|
|
22855
22946
|
var init_coder_run = __esm({
|
|
22856
22947
|
"src/public-cli/coder-run.ts"() {
|
|
@@ -22864,6 +22955,7 @@ var init_coder_run = __esm({
|
|
|
22864
22955
|
init_config2();
|
|
22865
22956
|
init_public_run_credentials();
|
|
22866
22957
|
init_run_lifecycle();
|
|
22958
|
+
init_auto_resume();
|
|
22867
22959
|
init_settlement();
|
|
22868
22960
|
}
|
|
22869
22961
|
});
|
|
@@ -23611,21 +23703,10 @@ async function runPublicFixer(argv, env, io, parseFixerArgv2) {
|
|
|
23611
23703
|
throw error;
|
|
23612
23704
|
}
|
|
23613
23705
|
await markRunAdmitted(admitted);
|
|
23614
|
-
let lease;
|
|
23615
|
-
try {
|
|
23616
|
-
lease = await acquireRunWriterLease(admitted.runDirectory);
|
|
23617
|
-
} catch (error) {
|
|
23618
|
-
if (error instanceof RunWriterLeaseHeldError) {
|
|
23619
|
-
presentStructuralRejection(error, io);
|
|
23620
|
-
return { exitCode: 2 };
|
|
23621
|
-
}
|
|
23622
|
-
throw error;
|
|
23623
|
-
}
|
|
23624
23706
|
let methodMaterial;
|
|
23625
23707
|
try {
|
|
23626
23708
|
methodMaterial = await loadFixerMethodMaterial(env.packageRoot);
|
|
23627
23709
|
} catch (error) {
|
|
23628
|
-
await lease.release();
|
|
23629
23710
|
return await presentControlledFailure5(
|
|
23630
23711
|
admitted,
|
|
23631
23712
|
{
|
|
@@ -23637,24 +23718,32 @@ async function runPublicFixer(argv, env, io, parseFixerArgv2) {
|
|
|
23637
23718
|
io
|
|
23638
23719
|
);
|
|
23639
23720
|
}
|
|
23640
|
-
|
|
23641
|
-
packageRoot: env.packageRoot,
|
|
23642
|
-
...env.model === void 0 ? {} : { model: env.model },
|
|
23643
|
-
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
23644
|
-
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
23645
|
-
});
|
|
23646
|
-
return await dispatchAdmittedFixer({
|
|
23721
|
+
return runWithAutoResumeLoop({
|
|
23647
23722
|
admitted,
|
|
23648
|
-
env: {
|
|
23649
|
-
...env,
|
|
23650
|
-
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
23651
|
-
},
|
|
23652
23723
|
io,
|
|
23653
|
-
|
|
23654
|
-
|
|
23655
|
-
|
|
23656
|
-
|
|
23657
|
-
|
|
23724
|
+
buildInitialArgs: () => buildFixerActivationExtraArgs(admitted, {
|
|
23725
|
+
packageRoot: env.packageRoot,
|
|
23726
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
23727
|
+
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
23728
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
23729
|
+
}),
|
|
23730
|
+
buildResumeArgs: () => buildFixerResumeActivationExtraArgs(admitted, {
|
|
23731
|
+
packageRoot: env.packageRoot,
|
|
23732
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
23733
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
23734
|
+
}),
|
|
23735
|
+
dispatch: (extraArgs, lease, isFirst, attemptIo) => dispatchAdmittedFixer({
|
|
23736
|
+
admitted,
|
|
23737
|
+
env: {
|
|
23738
|
+
...env,
|
|
23739
|
+
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
23740
|
+
},
|
|
23741
|
+
io: attemptIo,
|
|
23742
|
+
extraArgs,
|
|
23743
|
+
lease,
|
|
23744
|
+
methodMaterial,
|
|
23745
|
+
...isFirst && env.engine !== void 0 ? { effectiveEngine: env.engine } : {}
|
|
23746
|
+
})
|
|
23658
23747
|
});
|
|
23659
23748
|
}
|
|
23660
23749
|
async function runPublicFixerResume(argv, env, io) {
|
|
@@ -23715,7 +23804,7 @@ async function runPublicFixerResume(argv, env, io) {
|
|
|
23715
23804
|
...env.model === void 0 ? {} : { model: env.model },
|
|
23716
23805
|
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
23717
23806
|
});
|
|
23718
|
-
|
|
23807
|
+
const result2 = await dispatchAdmittedFixer({
|
|
23719
23808
|
admitted,
|
|
23720
23809
|
env: {
|
|
23721
23810
|
...env,
|
|
@@ -23726,6 +23815,8 @@ async function runPublicFixerResume(argv, env, io) {
|
|
|
23726
23815
|
lease,
|
|
23727
23816
|
methodMaterial
|
|
23728
23817
|
});
|
|
23818
|
+
if (result2.terminal !== void 0) result2.terminal.autoResumeCount = 0;
|
|
23819
|
+
return result2;
|
|
23729
23820
|
}
|
|
23730
23821
|
var init_fixer_run = __esm({
|
|
23731
23822
|
"src/public-cli/fixer-run.ts"() {
|
|
@@ -23739,6 +23830,7 @@ var init_fixer_run = __esm({
|
|
|
23739
23830
|
init_config2();
|
|
23740
23831
|
init_public_run_credentials();
|
|
23741
23832
|
init_run_lifecycle();
|
|
23833
|
+
init_auto_resume();
|
|
23742
23834
|
init_settlement();
|
|
23743
23835
|
}
|
|
23744
23836
|
});
|
|
@@ -23990,33 +24082,30 @@ async function runPublicJudge(argv, env, io, parseJudgeArgv2) {
|
|
|
23990
24082
|
throw error;
|
|
23991
24083
|
}
|
|
23992
24084
|
await markRunAdmitted(admitted);
|
|
23993
|
-
|
|
23994
|
-
try {
|
|
23995
|
-
lease = await acquireRunWriterLease(admitted.runDirectory);
|
|
23996
|
-
} catch (error) {
|
|
23997
|
-
if (error instanceof RunWriterLeaseHeldError) {
|
|
23998
|
-
presentStructuralRejection(error, io);
|
|
23999
|
-
return { exitCode: 2 };
|
|
24000
|
-
}
|
|
24001
|
-
throw error;
|
|
24002
|
-
}
|
|
24003
|
-
const extraArgs = buildJudgeActivationExtraArgs(admitted, {
|
|
24004
|
-
packageRoot: env.packageRoot,
|
|
24005
|
-
...env.model === void 0 ? {} : { model: env.model },
|
|
24006
|
-
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
24007
|
-
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24008
|
-
});
|
|
24009
|
-
return await dispatchAdmittedJudge({
|
|
24085
|
+
return runWithAutoResumeLoop({
|
|
24010
24086
|
admitted,
|
|
24011
|
-
env: {
|
|
24012
|
-
...env,
|
|
24013
|
-
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
24014
|
-
},
|
|
24015
24087
|
io,
|
|
24016
|
-
|
|
24017
|
-
|
|
24018
|
-
|
|
24019
|
-
|
|
24088
|
+
buildInitialArgs: () => buildJudgeActivationExtraArgs(admitted, {
|
|
24089
|
+
packageRoot: env.packageRoot,
|
|
24090
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
24091
|
+
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
24092
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24093
|
+
}),
|
|
24094
|
+
buildResumeArgs: () => buildJudgeResumeActivationExtraArgs(admitted, {
|
|
24095
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
24096
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24097
|
+
}),
|
|
24098
|
+
dispatch: (extraArgs, lease, isFirst, attemptIo) => dispatchAdmittedJudge({
|
|
24099
|
+
admitted,
|
|
24100
|
+
env: {
|
|
24101
|
+
...env,
|
|
24102
|
+
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
24103
|
+
},
|
|
24104
|
+
io: attemptIo,
|
|
24105
|
+
extraArgs,
|
|
24106
|
+
lease,
|
|
24107
|
+
...isFirst && env.engine !== void 0 ? { effectiveEngine: env.engine } : {}
|
|
24108
|
+
})
|
|
24020
24109
|
});
|
|
24021
24110
|
}
|
|
24022
24111
|
async function runPublicResume(argv, env, io) {
|
|
@@ -24060,7 +24149,7 @@ async function runPublicResume(argv, env, io) {
|
|
|
24060
24149
|
...env.model === void 0 ? {} : { model: env.model },
|
|
24061
24150
|
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24062
24151
|
});
|
|
24063
|
-
|
|
24152
|
+
const result2 = await dispatchAdmittedJudge({
|
|
24064
24153
|
admitted,
|
|
24065
24154
|
env: {
|
|
24066
24155
|
...env,
|
|
@@ -24070,6 +24159,10 @@ async function runPublicResume(argv, env, io) {
|
|
|
24070
24159
|
extraArgs,
|
|
24071
24160
|
lease
|
|
24072
24161
|
});
|
|
24162
|
+
if (result2.terminal !== void 0) {
|
|
24163
|
+
result2.terminal.autoResumeCount = 0;
|
|
24164
|
+
}
|
|
24165
|
+
return result2;
|
|
24073
24166
|
}
|
|
24074
24167
|
var init_judge_run = __esm({
|
|
24075
24168
|
"src/public-cli/judge-run.ts"() {
|
|
@@ -24082,6 +24175,7 @@ var init_judge_run = __esm({
|
|
|
24082
24175
|
init_config2();
|
|
24083
24176
|
init_public_run_credentials();
|
|
24084
24177
|
init_run_lifecycle();
|
|
24178
|
+
init_auto_resume();
|
|
24085
24179
|
init_settlement();
|
|
24086
24180
|
}
|
|
24087
24181
|
});
|
|
@@ -24419,21 +24513,10 @@ async function runPublicMerger(argv, env, io, parseMergerArgv2) {
|
|
|
24419
24513
|
throw error;
|
|
24420
24514
|
}
|
|
24421
24515
|
await markRunAdmitted(admitted);
|
|
24422
|
-
let lease;
|
|
24423
|
-
try {
|
|
24424
|
-
lease = await acquireRunWriterLease(admitted.runDirectory);
|
|
24425
|
-
} catch (error) {
|
|
24426
|
-
if (error instanceof RunWriterLeaseHeldError) {
|
|
24427
|
-
presentStructuralRejection(error, io);
|
|
24428
|
-
return { exitCode: 2 };
|
|
24429
|
-
}
|
|
24430
|
-
throw error;
|
|
24431
|
-
}
|
|
24432
24516
|
let methodMaterial;
|
|
24433
24517
|
try {
|
|
24434
24518
|
methodMaterial = await loadMergerMethodMaterial(env.packageRoot);
|
|
24435
24519
|
} catch (error) {
|
|
24436
|
-
await lease.release();
|
|
24437
24520
|
return await presentControlledFailure7(
|
|
24438
24521
|
admitted,
|
|
24439
24522
|
{
|
|
@@ -24446,23 +24529,32 @@ async function runPublicMerger(argv, env, io, parseMergerArgv2) {
|
|
|
24446
24529
|
io
|
|
24447
24530
|
);
|
|
24448
24531
|
}
|
|
24449
|
-
|
|
24450
|
-
packageRoot: env.packageRoot,
|
|
24451
|
-
...env.model === void 0 ? {} : { model: env.model },
|
|
24452
|
-
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
24453
|
-
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24454
|
-
});
|
|
24455
|
-
return await dispatchAdmittedMerger({
|
|
24532
|
+
return runWithAutoResumeLoop({
|
|
24456
24533
|
admitted,
|
|
24457
|
-
env: {
|
|
24458
|
-
...env,
|
|
24459
|
-
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
24460
|
-
},
|
|
24461
24534
|
io,
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24535
|
+
buildInitialArgs: () => buildMergerActivationExtraArgs(admitted, {
|
|
24536
|
+
packageRoot: env.packageRoot,
|
|
24537
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
24538
|
+
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
24539
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24540
|
+
}),
|
|
24541
|
+
buildResumeArgs: () => buildMergerResumeActivationExtraArgs(admitted, {
|
|
24542
|
+
packageRoot: env.packageRoot,
|
|
24543
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
24544
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24545
|
+
}),
|
|
24546
|
+
dispatch: (extraArgs, lease, isFirst, attemptIo) => dispatchAdmittedMerger({
|
|
24547
|
+
admitted,
|
|
24548
|
+
env: {
|
|
24549
|
+
...env,
|
|
24550
|
+
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
24551
|
+
},
|
|
24552
|
+
io: attemptIo,
|
|
24553
|
+
extraArgs,
|
|
24554
|
+
lease,
|
|
24555
|
+
methodMaterial,
|
|
24556
|
+
...isFirst && env.engine !== void 0 ? { effectiveEngine: env.engine } : {}
|
|
24557
|
+
})
|
|
24466
24558
|
});
|
|
24467
24559
|
}
|
|
24468
24560
|
async function runPublicMergerResume(argv, env, io) {
|
|
@@ -24524,7 +24616,7 @@ async function runPublicMergerResume(argv, env, io) {
|
|
|
24524
24616
|
...env.model === void 0 ? {} : { model: env.model },
|
|
24525
24617
|
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24526
24618
|
});
|
|
24527
|
-
|
|
24619
|
+
const result2 = await dispatchAdmittedMerger({
|
|
24528
24620
|
admitted,
|
|
24529
24621
|
env: {
|
|
24530
24622
|
...env,
|
|
@@ -24535,6 +24627,8 @@ async function runPublicMergerResume(argv, env, io) {
|
|
|
24535
24627
|
lease,
|
|
24536
24628
|
methodMaterial
|
|
24537
24629
|
});
|
|
24630
|
+
if (result2.terminal !== void 0) result2.terminal.autoResumeCount = 0;
|
|
24631
|
+
return result2;
|
|
24538
24632
|
}
|
|
24539
24633
|
var init_merger_run = __esm({
|
|
24540
24634
|
"src/public-cli/merger-run.ts"() {
|
|
@@ -24551,6 +24645,7 @@ var init_merger_run = __esm({
|
|
|
24551
24645
|
init_config2();
|
|
24552
24646
|
init_public_run_credentials();
|
|
24553
24647
|
init_run_lifecycle();
|
|
24648
|
+
init_auto_resume();
|
|
24554
24649
|
init_settlement();
|
|
24555
24650
|
}
|
|
24556
24651
|
});
|
|
@@ -24835,21 +24930,10 @@ async function runPublicReviewer(argv, env, io, parseReviewerArgv2) {
|
|
|
24835
24930
|
throw error;
|
|
24836
24931
|
}
|
|
24837
24932
|
await markRunAdmitted(admitted);
|
|
24838
|
-
let lease;
|
|
24839
|
-
try {
|
|
24840
|
-
lease = await acquireRunWriterLease(admitted.runDirectory);
|
|
24841
|
-
} catch (error) {
|
|
24842
|
-
if (error instanceof RunWriterLeaseHeldError) {
|
|
24843
|
-
presentStructuralRejection(error, io);
|
|
24844
|
-
return { exitCode: 2 };
|
|
24845
|
-
}
|
|
24846
|
-
throw error;
|
|
24847
|
-
}
|
|
24848
24933
|
let methodMaterial;
|
|
24849
24934
|
try {
|
|
24850
24935
|
methodMaterial = await loadReviewerMethodMaterial(env.packageRoot);
|
|
24851
24936
|
} catch (error) {
|
|
24852
|
-
await lease.release();
|
|
24853
24937
|
return await presentControlledFailure8(
|
|
24854
24938
|
admitted,
|
|
24855
24939
|
{
|
|
@@ -24861,24 +24945,32 @@ async function runPublicReviewer(argv, env, io, parseReviewerArgv2) {
|
|
|
24861
24945
|
io
|
|
24862
24946
|
);
|
|
24863
24947
|
}
|
|
24864
|
-
|
|
24865
|
-
packageRoot: env.packageRoot,
|
|
24866
|
-
...env.model === void 0 ? {} : { model: env.model },
|
|
24867
|
-
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
24868
|
-
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24869
|
-
});
|
|
24870
|
-
return await dispatchAdmittedReviewer({
|
|
24948
|
+
return runWithAutoResumeLoop({
|
|
24871
24949
|
admitted,
|
|
24872
|
-
env: {
|
|
24873
|
-
...env,
|
|
24874
|
-
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
24875
|
-
},
|
|
24876
24950
|
io,
|
|
24877
|
-
|
|
24878
|
-
|
|
24879
|
-
|
|
24880
|
-
|
|
24881
|
-
|
|
24951
|
+
buildInitialArgs: () => buildReviewerActivationExtraArgs(admitted, {
|
|
24952
|
+
packageRoot: env.packageRoot,
|
|
24953
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
24954
|
+
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
24955
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24956
|
+
}),
|
|
24957
|
+
buildResumeArgs: () => buildReviewerResumeActivationExtraArgs(admitted, {
|
|
24958
|
+
packageRoot: env.packageRoot,
|
|
24959
|
+
...env.model === void 0 ? {} : { model: env.model },
|
|
24960
|
+
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24961
|
+
}),
|
|
24962
|
+
dispatch: (extraArgs, lease, isFirst, attemptIo) => dispatchAdmittedReviewer({
|
|
24963
|
+
admitted,
|
|
24964
|
+
env: {
|
|
24965
|
+
...env,
|
|
24966
|
+
...admitted.correlationId === void 0 ? {} : { correlationId: admitted.correlationId }
|
|
24967
|
+
},
|
|
24968
|
+
io: attemptIo,
|
|
24969
|
+
extraArgs,
|
|
24970
|
+
lease,
|
|
24971
|
+
methodMaterial,
|
|
24972
|
+
...isFirst && env.engine !== void 0 ? { effectiveEngine: env.engine } : {}
|
|
24973
|
+
})
|
|
24882
24974
|
});
|
|
24883
24975
|
}
|
|
24884
24976
|
async function runPublicReviewerResume(argv, env, io) {
|
|
@@ -24939,7 +25031,7 @@ async function runPublicReviewerResume(argv, env, io) {
|
|
|
24939
25031
|
...env.model === void 0 ? {} : { model: env.model },
|
|
24940
25032
|
...env.extraPiArgs === void 0 ? {} : { extraPiArgs: env.extraPiArgs }
|
|
24941
25033
|
});
|
|
24942
|
-
|
|
25034
|
+
const result2 = await dispatchAdmittedReviewer({
|
|
24943
25035
|
admitted,
|
|
24944
25036
|
env: {
|
|
24945
25037
|
...env,
|
|
@@ -24950,6 +25042,8 @@ async function runPublicReviewerResume(argv, env, io) {
|
|
|
24950
25042
|
lease,
|
|
24951
25043
|
methodMaterial
|
|
24952
25044
|
});
|
|
25045
|
+
if (result2.terminal !== void 0) result2.terminal.autoResumeCount = 0;
|
|
25046
|
+
return result2;
|
|
24953
25047
|
}
|
|
24954
25048
|
var init_reviewer_run = __esm({
|
|
24955
25049
|
"src/public-cli/reviewer-run.ts"() {
|
|
@@ -24963,6 +25057,7 @@ var init_reviewer_run = __esm({
|
|
|
24963
25057
|
init_config2();
|
|
24964
25058
|
init_public_run_credentials();
|
|
24965
25059
|
init_run_lifecycle();
|
|
25060
|
+
init_auto_resume();
|
|
24966
25061
|
init_settlement();
|
|
24967
25062
|
}
|
|
24968
25063
|
});
|