@akagilnc/pi-workflow-roles 0.1.5845 → 0.1.5855
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/acp-host/production-host.js +348 -1254
- package/dist/acp-host/role-turn-host.js +4 -98
- package/dist/headless-host/production-host.js +15731 -16582
- package/dist/headless-host/role-turn-host.js +6 -31
- package/dist/migrate-book-topology.js +31 -16
- package/dist/navigator-attendance.js +54 -404
- package/dist/navigator-invocation-identity.js +0 -2
- package/dist/navigator-lookup-host.js +41 -0
- package/dist/navigator-lookup.js +68 -0
- package/dist/navigator-route-table.js +42 -0
- package/dist/package-contracts/navigator-output.js +3 -11
- package/dist/packaged-role-registry.js +3 -27
- package/dist/public-cli/instruction-seat-run.js +4 -1
- package/dist/public-cli/invocation.js +13 -26
- package/dist/public-cli/main.js +286 -114
- package/dist/public-cli/option-definitions.js +24 -4
- package/dist/public-cli/post-admission.js +0 -9
- package/dist/public-cli/role-seat-runtime.js +14 -0
- package/dist/public-cli/settlement.js +14 -40
- package/dist/public-cli/terminal.js +1 -8
- package/dist/public-cli/turn-request.js +0 -3
- package/dist/public-role-summons.js +0 -1
- package/dist/receipt-delivery-policy.js +0 -23
- package/dist/role-runtime-dependencies.js +4 -11
- package/dist/role-runtime.js +18 -194
- package/dist/submission-ledger.js +19 -15
- package/dist/ticket-progress.js +23 -5
- package/extensions/role-runtime.ts +0 -16
- package/package.json +1 -1
- package/scripts/build-package.mjs +3 -7
- package/src/acp-host/role-turn-host.ts +8 -97
- package/src/headless-host/description.ts +0 -2
- package/src/headless-host/role-turn-host.ts +7 -32
- package/src/host-contracts.ts +5 -7
- package/src/navigator-attendance.ts +86 -549
- package/src/navigator-invocation-identity.ts +0 -2
- package/src/navigator-lookup-host.ts +45 -0
- package/src/navigator-lookup.ts +98 -0
- package/src/navigator-route-table.ts +92 -0
- package/src/package-contracts/navigator-output.ts +4 -15
- package/src/packaged-role-registry.ts +3 -32
- package/src/public-cli/instruction-seat-run.ts +3 -0
- package/src/public-cli/invocation.ts +18 -30
- package/src/public-cli/option-definitions.ts +25 -4
- package/src/public-cli/post-admission.ts +0 -11
- package/src/public-cli/role-seat-runtime.ts +14 -0
- package/src/public-cli/settlement.ts +23 -51
- package/src/public-cli/terminal.ts +3 -18
- package/src/public-cli/turn-request.ts +0 -5
- package/src/public-role-summons.ts +0 -8
- package/src/receipt-delivery-policy.ts +0 -21
- package/src/role-runtime-dependencies.ts +4 -11
- package/src/role-runtime.ts +19 -210
- package/src/submission-ledger.ts +23 -16
- package/src/ticket-progress.ts +32 -5
- package/dist/navigator-public-session.js +0 -205
- package/dist/navigator-role.js +0 -6
- package/dist/navigator-session-contracts.js +0 -227
- package/dist/navigator-work-context.js +0 -72
- package/resources/navigator-route-playbook.md +0 -33
- package/src/navigator-public-session.ts +0 -305
- package/src/navigator-role.ts +0 -15
- package/src/navigator-session-contracts.ts +0 -320
- package/src/navigator-work-context.ts +0 -97
package/dist/public-cli/main.js
CHANGED
|
@@ -9202,6 +9202,9 @@ var init_navigator_output = __esm({
|
|
|
9202
9202
|
}),
|
|
9203
9203
|
byStatus: typebox_exports.Unknown({
|
|
9204
9204
|
description: "\u6309\u4E3B\u8859\u95E8\u7ED3\u5C40 status \u9884\u5199\u7684\u6563\u6587\u5EFA\u8BAE\u3002\u952E\u4E3A status \u5B57\u9762\u91CF\uFF0C\u503C\u4E3A\u5EFA\u8BAE\u6B63\u6587\u3002\u7ED3\u7B97\u65F6\u4EE3\u7801\u53EA\u6309\u5B9E\u9645 status \u53D6\u5BF9\u5E94\u539F\u6587\uFF0C\u4E0D\u89E3\u6790\u5EFA\u8BAE\u8BED\u4E49\u3002"
|
|
9205
|
+
}),
|
|
9206
|
+
byRole: typebox_exports.Unknown({
|
|
9207
|
+
description: "\u6574\u5F20\u8DEF\u7EBF\u8868\uFF1A\u952E\u4E3A\u8859\u95E8\u89D2\u8272\uFF0C\u503C\u4E3A\u8BE5\u8859\u95E8 status \u2192 \u5EFA\u8BAE\u3002\u76F4\u63A5\u5165\u53E3\u4E0D\u7ED9\u89D2\u8272\u65F6\u4F7F\u7528\u3002"
|
|
9205
9208
|
})
|
|
9206
9209
|
};
|
|
9207
9210
|
navigatorAdviceBodySchema = openToolObject(typebox_exports.Object(navigatorAdviceFields));
|
|
@@ -9695,15 +9698,12 @@ __export(packaged_role_registry_exports, {
|
|
|
9695
9698
|
packagedGateSummon: () => packagedGateSummon,
|
|
9696
9699
|
packagedMethodSkillNames: () => packagedMethodSkillNames,
|
|
9697
9700
|
packagedModelParent: () => packagedModelParent,
|
|
9698
|
-
packagedNavigatorSubject: () => packagedNavigatorSubject,
|
|
9699
9701
|
packagedProjectsTargetBindRejection: () => packagedProjectsTargetBindRejection,
|
|
9700
9702
|
packagedProvinceConfig: () => packagedProvinceConfig,
|
|
9701
|
-
packagedPublicInstructionSubject: () => packagedPublicInstructionSubject,
|
|
9702
9703
|
packagedRebindSourceOnResume: () => packagedRebindSourceOnResume,
|
|
9703
9704
|
packagedResumeSourcePath: () => packagedResumeSourcePath,
|
|
9704
9705
|
packagedRoleAcceptedOutputTool: () => packagedRoleAcceptedOutputTool,
|
|
9705
9706
|
packagedRoleActivationFlags: () => packagedRoleActivationFlags,
|
|
9706
|
-
packagedRoleInputFlag: () => packagedRoleInputFlag,
|
|
9707
9707
|
packagedRoleMetadata: () => packagedRoleMetadata,
|
|
9708
9708
|
packagedRoleOutputTool: () => packagedRoleOutputTool,
|
|
9709
9709
|
packagedRolePhaseFlag: () => packagedRolePhaseFlag,
|
|
@@ -9751,9 +9751,6 @@ function packagedRoleActivationFlags(role) {
|
|
|
9751
9751
|
if (record === void 0 || !("activationFlags" in record)) return [];
|
|
9752
9752
|
return record.activationFlags;
|
|
9753
9753
|
}
|
|
9754
|
-
function packagedRoleInputFlag(role) {
|
|
9755
|
-
return packagedRoleActivationFlags(role).find((spec) => spec.binds === "input")?.flag;
|
|
9756
|
-
}
|
|
9757
9754
|
function packagedRolePhaseFlag(role) {
|
|
9758
9755
|
return packagedRoleActivationFlags(role).find((spec) => spec.binds === "phase")?.flag;
|
|
9759
9756
|
}
|
|
@@ -9809,11 +9806,6 @@ function packagedAuditToolName(role) {
|
|
|
9809
9806
|
if (record === void 0 || !("auditTool" in record)) return void 0;
|
|
9810
9807
|
return record.auditTool;
|
|
9811
9808
|
}
|
|
9812
|
-
function packagedPublicInstructionSubject(role) {
|
|
9813
|
-
return typeof role === "string" && PUBLIC_ROLE_RECORDS.some(
|
|
9814
|
-
(record) => "navigatorSubject" in record && record.navigatorSubject === "public-instruction" && record.role === role
|
|
9815
|
-
);
|
|
9816
|
-
}
|
|
9817
9809
|
function packagedResumeSourcePath(role) {
|
|
9818
9810
|
const record = packagedRoleMetadata(role);
|
|
9819
9811
|
return record !== void 0 && "resumeSourcePath" in record && record.resumeSourcePath === true;
|
|
@@ -9822,11 +9814,6 @@ function packagedProjectsTargetBindRejection(role) {
|
|
|
9822
9814
|
const record = packagedRoleMetadata(role);
|
|
9823
9815
|
return record !== void 0 && "projectTargetBindRejection" in record && record.projectTargetBindRejection === true;
|
|
9824
9816
|
}
|
|
9825
|
-
function packagedNavigatorSubject(role) {
|
|
9826
|
-
const record = packagedRoleMetadata(role);
|
|
9827
|
-
if (record !== void 0 && "navigatorSubject" in record) return record.navigatorSubject;
|
|
9828
|
-
return "file";
|
|
9829
|
-
}
|
|
9830
9817
|
function packagedBoardPlacement(role) {
|
|
9831
9818
|
const record = packagedRoleMetadata(role);
|
|
9832
9819
|
if (record === void 0 || !("boardPlacement" in record)) return void 0;
|
|
@@ -9920,8 +9907,6 @@ var init_packaged_role_registry = __esm({
|
|
|
9920
9907
|
settlement: "sealed",
|
|
9921
9908
|
/** Factory board: court until another station has started, then marshal. */
|
|
9922
9909
|
boardPlacement: "judge-history",
|
|
9923
|
-
/** Navigator subject is the public admitted instruction when the run is bound. */
|
|
9924
|
-
navigatorSubject: "public-instruction",
|
|
9925
9910
|
activationStage: "load-and-install",
|
|
9926
9911
|
receiptStatusKey: "status",
|
|
9927
9912
|
sessionMaterials: [
|
|
@@ -9950,8 +9935,6 @@ var init_packaged_role_registry = __esm({
|
|
|
9950
9935
|
reportPhase: true
|
|
9951
9936
|
},
|
|
9952
9937
|
boardPlacement: "marshal",
|
|
9953
|
-
/** #1168: dispatch is first message; navigator reads admitted instruction. */
|
|
9954
|
-
navigatorSubject: "public-instruction",
|
|
9955
9938
|
activationFlags: [
|
|
9956
9939
|
{ field: "phase", flag: "ak-fixer-phase", binds: "phase" }
|
|
9957
9940
|
],
|
|
@@ -9980,8 +9963,6 @@ var init_packaged_role_registry = __esm({
|
|
|
9980
9963
|
artifactFace: {
|
|
9981
9964
|
reportPhase: true
|
|
9982
9965
|
},
|
|
9983
|
-
/** #1168: dispatch is first message; navigator reads admitted instruction. */
|
|
9984
|
-
navigatorSubject: "public-instruction",
|
|
9985
9966
|
activationFlags: [
|
|
9986
9967
|
{ field: "phase", flag: "ak-coder-phase", binds: "phase" }
|
|
9987
9968
|
],
|
|
@@ -10075,8 +10056,6 @@ var init_packaged_role_registry = __esm({
|
|
|
10075
10056
|
artifactFace: {
|
|
10076
10057
|
doctorReportFacts: true
|
|
10077
10058
|
},
|
|
10078
|
-
/** Navigator subject is the doctor case, not the case-path file bytes. */
|
|
10079
|
-
navigatorSubject: "case",
|
|
10080
10059
|
activationFlags: [
|
|
10081
10060
|
{ field: "casePath", from: "caseRunsPath", flag: "ak-doctor-case", binds: "input" }
|
|
10082
10061
|
],
|
|
@@ -10131,8 +10110,6 @@ var init_packaged_role_registry = __esm({
|
|
|
10131
10110
|
gateStageLabel: "\u7B26\u5B9D\u90CE",
|
|
10132
10111
|
/** Gate summon binds --source-run and keeps dialogue off the argv. */
|
|
10133
10112
|
gateSummon: "source-run",
|
|
10134
|
-
/** Navigator subject is the source-run locator, not the path file bytes. */
|
|
10135
|
-
navigatorSubject: "source-run",
|
|
10136
10113
|
activationFlags: [
|
|
10137
10114
|
{ field: "sourceRun", from: "sourceRunPath", flag: "ak-notary-source-run", binds: "input" },
|
|
10138
10115
|
{ field: "ticketNumber", flag: "ak-notary-ticket-number" }
|
|
@@ -10270,12 +10247,14 @@ var init_packaged_role_registry = __esm({
|
|
|
10270
10247
|
role: "navigator",
|
|
10271
10248
|
inCallAutoResume: false,
|
|
10272
10249
|
presentSettled: "always",
|
|
10273
|
-
summonResume:
|
|
10250
|
+
summonResume: false,
|
|
10274
10251
|
admission: "instruction",
|
|
10275
10252
|
sameParent: "none",
|
|
10276
10253
|
phases: [null],
|
|
10277
10254
|
outputTool: NAVIGATOR_OUTPUT_TOOL_NAME,
|
|
10278
10255
|
settlement: "accepted",
|
|
10256
|
+
/** #1192: structured target seat for the lookup run; no host flag (no host runs it). */
|
|
10257
|
+
activationFlags: [{ field: "forRole" }],
|
|
10279
10258
|
activationStage: "load-and-install",
|
|
10280
10259
|
sessionMaterials: ["CLAUDE.md", "souls/navigator.md"]
|
|
10281
10260
|
},
|
|
@@ -11629,11 +11608,7 @@ function currentReplyRows(terminal) {
|
|
|
11629
11608
|
return outcome?.kind === "accepted" || outcome?.kind === "audit_escalation" ? outcome.payloads ?? [] : [];
|
|
11630
11609
|
}
|
|
11631
11610
|
function adviceNavigatorFact(input) {
|
|
11632
|
-
return {
|
|
11633
|
-
disposition: "advice",
|
|
11634
|
-
prose: input.prose,
|
|
11635
|
-
...input.advisoryDiagnostic === void 0 ? {} : { advisoryDiagnostic: input.advisoryDiagnostic }
|
|
11636
|
-
};
|
|
11611
|
+
return { disposition: "advice", prose: input.prose };
|
|
11637
11612
|
}
|
|
11638
11613
|
function formatTerminalResult(result) {
|
|
11639
11614
|
const lines = [];
|
|
@@ -11663,9 +11638,6 @@ function formatTerminalResult(result) {
|
|
|
11663
11638
|
}
|
|
11664
11639
|
}
|
|
11665
11640
|
lines.push(`navigator ${result.navigator.disposition}`);
|
|
11666
|
-
if (result.navigator.advisoryDiagnostic !== void 0) {
|
|
11667
|
-
lines.push(`navigator-advisory ${encodeTerminalField(result.navigator.advisoryDiagnostic)}`);
|
|
11668
|
-
}
|
|
11669
11641
|
if (result.navigator.disposition === "advice") {
|
|
11670
11642
|
lines.push(`prose ${encodeTerminalField(result.navigator.prose)}`);
|
|
11671
11643
|
} else if (result.navigator.disposition === "unavailable") {
|
|
@@ -12055,29 +12027,6 @@ function createReceiptDeliveryPolicy(limit) {
|
|
|
12055
12027
|
deliveryTurns += 1;
|
|
12056
12028
|
spend();
|
|
12057
12029
|
},
|
|
12058
|
-
/**
|
|
12059
|
-
* Stop asking. The issued count stays whatever was actually sent (#1132 —
|
|
12060
|
-
* do not fill the remainder up to the ceiling).
|
|
12061
|
-
*/
|
|
12062
|
-
closeBudget() {
|
|
12063
|
-
closed = true;
|
|
12064
|
-
},
|
|
12065
|
-
/**
|
|
12066
|
-
* A nested session settled without an accepted receipt. Close so this layer
|
|
12067
|
-
* does not open another prompt on that session. The issued count stays the
|
|
12068
|
-
* larger of the two seams: a nested zero must not wipe prompts this layer
|
|
12069
|
-
* already sent, and adding the two counts would bill one send twice.
|
|
12070
|
-
*/
|
|
12071
|
-
recordNestedNoReceipt(facts) {
|
|
12072
|
-
if (typeof facts.terminalToolCalled === "boolean") {
|
|
12073
|
-
terminalToolCalled = terminalToolCalled || facts.terminalToolCalled;
|
|
12074
|
-
}
|
|
12075
|
-
if (facts.rejectedReceipts !== void 0) {
|
|
12076
|
-
rejectedReceipts.push(...facts.rejectedReceipts);
|
|
12077
|
-
}
|
|
12078
|
-
if (facts.deliveryTurns !== void 0) deliveryTurns = Math.max(deliveryTurns, facts.deliveryTurns);
|
|
12079
|
-
closed = true;
|
|
12080
|
-
},
|
|
12081
12030
|
nextAction() {
|
|
12082
12031
|
if (accepted) return "accepted";
|
|
12083
12032
|
if (closed) return "no-receipt";
|
|
@@ -12972,6 +12921,7 @@ var init_terminating_tools = __esm({
|
|
|
12972
12921
|
});
|
|
12973
12922
|
|
|
12974
12923
|
// src/ticket-progress.ts
|
|
12924
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
12975
12925
|
import {
|
|
12976
12926
|
appendFileSync as appendFileSync2,
|
|
12977
12927
|
existsSync as existsSync2,
|
|
@@ -13036,11 +12986,102 @@ function nextRoundFromLines(lines, seat, lens) {
|
|
|
13036
12986
|
const base = max + 1;
|
|
13037
12987
|
return want === void 0 ? String(base) : `${base}.${want}`;
|
|
13038
12988
|
}
|
|
12989
|
+
function nextLegReceiptIndex(runDirectory) {
|
|
12990
|
+
const dir = join11(runDirectory, RECEIPTS_DIRNAME);
|
|
12991
|
+
if (!existsSync2(dir)) return 1;
|
|
12992
|
+
let max = 0;
|
|
12993
|
+
for (const name of readdirSync2(dir)) {
|
|
12994
|
+
const match = /^(\d+)\.json$/.exec(name);
|
|
12995
|
+
if (match === null) continue;
|
|
12996
|
+
const n = Number(match[1]);
|
|
12997
|
+
if (Number.isSafeInteger(n) && n > max) max = n;
|
|
12998
|
+
}
|
|
12999
|
+
return max + 1;
|
|
13000
|
+
}
|
|
13001
|
+
function statusAndSummaryFromPayload(seat, payload) {
|
|
13002
|
+
if (!isRecord(payload)) return {};
|
|
13003
|
+
const toolName = packagedRoleOutputTool(seat);
|
|
13004
|
+
const status = toolName !== void 0 && isTerminatingToolName(toolName) ? acceptedFacts(toolName, payload).status : void 0;
|
|
13005
|
+
const summary = typeof payload.summary === "string" ? payload.summary : void 0;
|
|
13006
|
+
return {
|
|
13007
|
+
...status === void 0 ? {} : { status },
|
|
13008
|
+
...summary === void 0 ? {} : { summary }
|
|
13009
|
+
};
|
|
13010
|
+
}
|
|
13011
|
+
function captureWorktreeHead(projectRoot) {
|
|
13012
|
+
try {
|
|
13013
|
+
const result = spawnSync3("git", ["rev-parse", "HEAD"], {
|
|
13014
|
+
cwd: projectRoot,
|
|
13015
|
+
encoding: "utf8",
|
|
13016
|
+
maxBuffer: 1024 * 1024
|
|
13017
|
+
});
|
|
13018
|
+
if (result.error != null) {
|
|
13019
|
+
const err = result.error;
|
|
13020
|
+
const detail = err instanceof Error ? err.stack ?? err.message : String(err);
|
|
13021
|
+
return { head: "", fault: `git rev-parse HEAD spawn failed cwd=${projectRoot}: ${detail}` };
|
|
13022
|
+
}
|
|
13023
|
+
if (result.status !== 0) {
|
|
13024
|
+
const detail = [result.stderr, result.stdout].map((part) => typeof part === "string" ? part.trim() : "").filter((part) => part !== "").join(" | ");
|
|
13025
|
+
const status = result.status === null ? "null" : String(result.status);
|
|
13026
|
+
const signal = result.signal == null ? "" : ` signal=${result.signal}`;
|
|
13027
|
+
return {
|
|
13028
|
+
head: "",
|
|
13029
|
+
fault: detail === "" ? `git rev-parse HEAD failed (status=${status}${signal}) cwd=${projectRoot}` : `git rev-parse HEAD failed (status=${status}${signal}) cwd=${projectRoot}: ${detail}`
|
|
13030
|
+
};
|
|
13031
|
+
}
|
|
13032
|
+
return { head: (result.stdout ?? "").trim() };
|
|
13033
|
+
} catch (error) {
|
|
13034
|
+
const message = error instanceof Error ? error.stack ?? error.message : String(error);
|
|
13035
|
+
return { head: "", fault: `git rev-parse HEAD threw cwd=${projectRoot}: ${message}` };
|
|
13036
|
+
}
|
|
13037
|
+
}
|
|
13039
13038
|
function lensFromRunDirectory(runDirectory, role) {
|
|
13040
13039
|
if (role !== "reviewer") return void 0;
|
|
13041
13040
|
const lens = readPageSync(runDirectory, "admitted")?.lens;
|
|
13042
13041
|
return lens === "completeness" || lens === "correctness" ? lens : void 0;
|
|
13043
13042
|
}
|
|
13043
|
+
function landTicketProgress(input) {
|
|
13044
|
+
const { runDirectory } = input;
|
|
13045
|
+
const subjectDirectory = subjectDirectoryOfRun(runDirectory);
|
|
13046
|
+
if (subjectDirectory === void 0) return void 0;
|
|
13047
|
+
const lens = input.lens === "completeness" || input.lens === "correctness" ? input.lens : lensFromRunDirectory(runDirectory, input.role);
|
|
13048
|
+
const leaf = basename7(runDirectory);
|
|
13049
|
+
const unbound = basename7(subjectDirectory) === "unbound";
|
|
13050
|
+
const progressPath = unbound ? join11(runDirectory, LEG_PROGRESS_FILENAME) : join11(subjectDirectory, CURRENT_FILENAME);
|
|
13051
|
+
const receiptIndex = nextLegReceiptIndex(runDirectory);
|
|
13052
|
+
const relativePath = `runs/${leaf}/${RECEIPTS_DIRNAME}/${receiptIndex}.json`;
|
|
13053
|
+
const absolutePath = join11(subjectDirectory, relativePath);
|
|
13054
|
+
mkdirSync3(dirname7(absolutePath), { recursive: true });
|
|
13055
|
+
writeFileSync2(absolutePath, `${JSON.stringify(input.accepted, null, 2)}
|
|
13056
|
+
`, "utf8");
|
|
13057
|
+
if (!unbound) {
|
|
13058
|
+
relocateTicketProgressForLeg({ runDirectory });
|
|
13059
|
+
}
|
|
13060
|
+
const existing = unbound ? readProgressFile(progressPath) : readTicketProgressLines(subjectDirectory);
|
|
13061
|
+
const round = unbound ? "" : nextRoundFromLines(existing, input.role, lens);
|
|
13062
|
+
const sessionRelative = input.sessionFile === void 0 ? "" : relative2(subjectDirectory, input.sessionFile).split(sep3).join("/");
|
|
13063
|
+
const { status, summary } = statusAndSummaryFromPayload(input.role, input.accepted);
|
|
13064
|
+
const instruction = input.instruction;
|
|
13065
|
+
const line2 = {
|
|
13066
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13067
|
+
seat: input.role,
|
|
13068
|
+
round,
|
|
13069
|
+
instruction,
|
|
13070
|
+
head: input.sealHead.head,
|
|
13071
|
+
...status === void 0 ? {} : { status },
|
|
13072
|
+
...summary === void 0 ? {} : { summary },
|
|
13073
|
+
receipt: relativePath,
|
|
13074
|
+
session: sessionRelative
|
|
13075
|
+
};
|
|
13076
|
+
mkdirSync3(dirname7(progressPath), { recursive: true });
|
|
13077
|
+
appendFileSync2(progressPath, `${JSON.stringify(line2)}
|
|
13078
|
+
`, "utf8");
|
|
13079
|
+
if (input.sealHead.fault !== void 0) {
|
|
13080
|
+
process.stderr.write(`${input.sealHead.fault}
|
|
13081
|
+
`);
|
|
13082
|
+
}
|
|
13083
|
+
return line2;
|
|
13084
|
+
}
|
|
13044
13085
|
function relocateTicketProgressForLeg(input) {
|
|
13045
13086
|
if (isUnboundRunDirectory(input.runDirectory)) return;
|
|
13046
13087
|
const subjectDirectory = subjectDirectoryOfRun(input.runDirectory);
|
|
@@ -13083,7 +13124,7 @@ function relocateTicketProgressForLeg(input) {
|
|
|
13083
13124
|
);
|
|
13084
13125
|
rmSync3(stagedPath, { force: true });
|
|
13085
13126
|
}
|
|
13086
|
-
var CURRENT_FILENAME, LEG_PROGRESS_FILENAME;
|
|
13127
|
+
var CURRENT_FILENAME, RECEIPTS_DIRNAME, LEG_PROGRESS_FILENAME;
|
|
13087
13128
|
var init_ticket_progress = __esm({
|
|
13088
13129
|
"src/ticket-progress.ts"() {
|
|
13089
13130
|
"use strict";
|
|
@@ -13096,6 +13137,7 @@ var init_ticket_progress = __esm({
|
|
|
13096
13137
|
init_sitian_reader();
|
|
13097
13138
|
init_unknown_value();
|
|
13098
13139
|
CURRENT_FILENAME = "current.jsonl";
|
|
13140
|
+
RECEIPTS_DIRNAME = "receipts";
|
|
13099
13141
|
LEG_PROGRESS_FILENAME = "progress.jsonl";
|
|
13100
13142
|
}
|
|
13101
13143
|
});
|
|
@@ -13874,7 +13916,7 @@ function renderHumanOwnerOptionLines(owner, locale2 = "en") {
|
|
|
13874
13916
|
}
|
|
13875
13917
|
return lines;
|
|
13876
13918
|
}
|
|
13877
|
-
var ANALYST_REQUIRE_ANY_OF, ANALYST_DEFAULT_MODE, REJECTED_PUBLIC_SPELLINGS, GLOBAL_OPTIONS, SHARED_PROJECT_SEMANTICS, SHARED_ATTACH_SEMANTICS, SHARED_PHASE_SEMANTICS, GLEANER_LEFT_OPTIONS, AUDITOR_OPTIONS, CODER_OPTIONS, FIXER_OPTIONS, REVIEWER_OPTIONS, COLLECTOR_OPTIONS, DOCTOR_OPTIONS, NOTARY_OPTIONS, INSPECTOR_OPTIONS, MERGER_OPTIONS, ANALYST_OPTIONS, SEAT_OPTION_ROWS, PUBLIC_OPTION_TABLE, PUBLIC_ROLE_OPTION_OWNERS, PUBLIC_NAVIGATOR_HELP_NOTE, TOP_LEVEL_HELP, ROLE_COMMAND_HELP, SUPPORT_COMMAND_HELP, PUBLIC_COMMAND_HELP;
|
|
13919
|
+
var ANALYST_REQUIRE_ANY_OF, ANALYST_DEFAULT_MODE, REJECTED_PUBLIC_SPELLINGS, GLOBAL_OPTIONS, SHARED_PROJECT_SEMANTICS, SHARED_ATTACH_SEMANTICS, SHARED_PHASE_SEMANTICS, GLEANER_LEFT_OPTIONS, AUDITOR_OPTIONS, CODER_OPTIONS, FIXER_OPTIONS, REVIEWER_OPTIONS, COLLECTOR_OPTIONS, DOCTOR_OPTIONS, NAVIGATOR_OPTIONS, NOTARY_OPTIONS, INSPECTOR_OPTIONS, MERGER_OPTIONS, ANALYST_OPTIONS, SEAT_OPTION_ROWS, PUBLIC_OPTION_TABLE, PUBLIC_ROLE_OPTION_OWNERS, PUBLIC_NAVIGATOR_HELP_NOTE, TOP_LEVEL_HELP, ROLE_COMMAND_HELP, SUPPORT_COMMAND_HELP, PUBLIC_COMMAND_HELP;
|
|
13878
13920
|
var init_option_definitions = __esm({
|
|
13879
13921
|
"src/public-cli/option-definitions.ts"() {
|
|
13880
13922
|
"use strict";
|
|
@@ -14222,6 +14264,23 @@ var init_option_definitions = __esm({
|
|
|
14222
14264
|
}
|
|
14223
14265
|
}
|
|
14224
14266
|
];
|
|
14267
|
+
NAVIGATOR_OPTIONS = [
|
|
14268
|
+
...projectAndAttach("navigator"),
|
|
14269
|
+
{
|
|
14270
|
+
id: "role",
|
|
14271
|
+
owner: "navigator",
|
|
14272
|
+
canonical: "--role",
|
|
14273
|
+
aliases: [],
|
|
14274
|
+
valueMetavar: "role",
|
|
14275
|
+
required: false,
|
|
14276
|
+
repeatable: false,
|
|
14277
|
+
form: "option",
|
|
14278
|
+
description: {
|
|
14279
|
+
en: "Optional seat whose status \u2192 advice rows to show; omitted shows the whole table. The instruction text is not read.",
|
|
14280
|
+
zh: "\u53EF\u9009\u8859\u95E8\u89D2\u8272\uFF1A\u53EA\u663E\u793A\u8BE5\u8859\u95E8\u7684 status \u2192 \u5EFA\u8BAE\uFF1B\u7F3A\u7701\u663E\u793A\u6574\u5F20\u8868\u3002instruction \u6B63\u6587\u4E0D\u8BFB\u3002"
|
|
14281
|
+
}
|
|
14282
|
+
}
|
|
14283
|
+
];
|
|
14225
14284
|
NOTARY_OPTIONS = [
|
|
14226
14285
|
bindOwner("notary", SHARED_PROJECT_SEMANTICS),
|
|
14227
14286
|
{
|
|
@@ -14415,14 +14474,15 @@ var init_option_definitions = __esm({
|
|
|
14415
14474
|
merger: MERGER_OPTIONS,
|
|
14416
14475
|
notary: NOTARY_OPTIONS,
|
|
14417
14476
|
auditor: AUDITOR_OPTIONS,
|
|
14418
|
-
inspector: INSPECTOR_OPTIONS
|
|
14477
|
+
inspector: INSPECTOR_OPTIONS,
|
|
14478
|
+
navigator: NAVIGATOR_OPTIONS
|
|
14419
14479
|
};
|
|
14420
14480
|
PUBLIC_OPTION_TABLE = publicOptionTable();
|
|
14421
14481
|
PUBLIC_ROLE_OPTION_OWNERS = [
|
|
14422
14482
|
...PUBLIC_CALLABLE_ROLES,
|
|
14423
14483
|
"analyst"
|
|
14424
14484
|
];
|
|
14425
|
-
PUBLIC_NAVIGATOR_HELP_NOTE = "Navigator also attends automatically on top-level public entry legs;
|
|
14485
|
+
PUBLIC_NAVIGATOR_HELP_NOTE = "Navigator also attends automatically on top-level public entry legs; the sidecar and direct `ak-role navigator` calls read the same status \u2192 advice table, with no model call.";
|
|
14426
14486
|
TOP_LEVEL_HELP = {
|
|
14427
14487
|
command: "top",
|
|
14428
14488
|
summary: "public role CLI",
|
|
@@ -14536,10 +14596,11 @@ var init_option_definitions = __esm({
|
|
|
14536
14596
|
},
|
|
14537
14597
|
navigator: {
|
|
14538
14598
|
command: "navigator",
|
|
14539
|
-
summary: "Direct Navigator (\u6E38\u5955\u4F7F)
|
|
14540
|
-
usage: ["ak-role navigator [options] [instruction]"],
|
|
14599
|
+
summary: "Direct Navigator (\u6E38\u5955\u4F7F) status \u2192 next-station advice table lookup; no model call.",
|
|
14600
|
+
usage: ["ak-role navigator [--role <role>] [options] [instruction]"],
|
|
14541
14601
|
examples: [
|
|
14542
|
-
|
|
14602
|
+
"ak-role navigator",
|
|
14603
|
+
"ak-role navigator --role coder"
|
|
14543
14604
|
]
|
|
14544
14605
|
},
|
|
14545
14606
|
auditor: {
|
|
@@ -15039,6 +15100,17 @@ function assignPublicSeatOption(owner, taken, fields) {
|
|
|
15039
15100
|
fields.subject = subject;
|
|
15040
15101
|
return;
|
|
15041
15102
|
}
|
|
15103
|
+
case "role": {
|
|
15104
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
15105
|
+
const known = PUBLIC_CALLABLE_ROLES.find((role) => role === raw);
|
|
15106
|
+
if (known === void 0) {
|
|
15107
|
+
throw new CliUsageError(
|
|
15108
|
+
`${owner} --role must be one of ${PUBLIC_CALLABLE_ROLES.join("|")}, got ${value ?? "(missing)"}`
|
|
15109
|
+
);
|
|
15110
|
+
}
|
|
15111
|
+
fields.forRole = known;
|
|
15112
|
+
return;
|
|
15113
|
+
}
|
|
15042
15114
|
case "source-run": {
|
|
15043
15115
|
const text = typeof value === "string" ? value : "";
|
|
15044
15116
|
if (text.trim() === "") {
|
|
@@ -15170,7 +15242,8 @@ function parsePublicSeatArgv(owner, args) {
|
|
|
15170
15242
|
...fields.baseRevision === void 0 ? {} : { baseRevision: fields.baseRevision },
|
|
15171
15243
|
...fields.lens === void 0 ? {} : { lens: fields.lens },
|
|
15172
15244
|
...packagedEmitsAuthorityRefs(owner) ? { authorityRefs: fields.authorityRefs } : {},
|
|
15173
|
-
...fields.subject === void 0 ? {} : { subject: fields.subject }
|
|
15245
|
+
...fields.subject === void 0 ? {} : { subject: fields.subject },
|
|
15246
|
+
...fields.forRole === void 0 ? {} : { forRole: fields.forRole }
|
|
15174
15247
|
};
|
|
15175
15248
|
}
|
|
15176
15249
|
function requireOptionPath(flag, value) {
|
|
@@ -15283,7 +15356,8 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
15283
15356
|
...shared,
|
|
15284
15357
|
instruction,
|
|
15285
15358
|
attachmentPaths,
|
|
15286
|
-
...project
|
|
15359
|
+
...project,
|
|
15360
|
+
...parsed.forRole === void 0 ? {} : { admittedFields: { forRole: parsed.forRole } }
|
|
15287
15361
|
}
|
|
15288
15362
|
);
|
|
15289
15363
|
case "court-materials":
|
|
@@ -16083,6 +16157,7 @@ var init_invocation = __esm({
|
|
|
16083
16157
|
init_notary_source_run();
|
|
16084
16158
|
init_cli_errors();
|
|
16085
16159
|
init_option_definitions();
|
|
16160
|
+
init_registry();
|
|
16086
16161
|
init_unknown_value();
|
|
16087
16162
|
}
|
|
16088
16163
|
});
|
|
@@ -16272,6 +16347,38 @@ async function readSubmissionAttemptId(cwd, runId, toolCallId, homeOrScope) {
|
|
|
16272
16347
|
async function readRecordedSubmissions(cwd, runId, homeOrScope) {
|
|
16273
16348
|
return (await readRecordedSubmissionRows(cwd, runId, homeOrScope)).map((row) => row.accepted);
|
|
16274
16349
|
}
|
|
16350
|
+
function sealAcceptedSubmission(options) {
|
|
16351
|
+
const runId = runIdFromRunDirectory(options.runDirectory);
|
|
16352
|
+
if (runId === void 0) throw new Error("\u63D0\u4EA4\u8D26\u9700\u8981\u5DF2\u53D7\u7406\u7684 run \u8EAB\u4EFD");
|
|
16353
|
+
const attemptId = options.courtAttemptId ?? `${runId}:initial`;
|
|
16354
|
+
const sealHead = captureWorktreeHead(options.cwd);
|
|
16355
|
+
const sessionParent = sessionFileOf(options.runDirectory);
|
|
16356
|
+
const home = options.home ?? tryHomeFromAkRolesPath(sessionParent);
|
|
16357
|
+
sitianReport({
|
|
16358
|
+
level: "event",
|
|
16359
|
+
kind: "sealed",
|
|
16360
|
+
subject: { runId, attemptId },
|
|
16361
|
+
payload: {
|
|
16362
|
+
type: "sealed",
|
|
16363
|
+
attemptId,
|
|
16364
|
+
toolCallId: options.toolCallId,
|
|
16365
|
+
role: options.role,
|
|
16366
|
+
accepted: options.accepted
|
|
16367
|
+
},
|
|
16368
|
+
source: "role-runtime",
|
|
16369
|
+
cwd: options.cwd,
|
|
16370
|
+
...home !== void 0 ? { home } : {},
|
|
16371
|
+
sessionParent
|
|
16372
|
+
});
|
|
16373
|
+
landTicketProgress({
|
|
16374
|
+
runDirectory: options.runDirectory,
|
|
16375
|
+
role: options.role,
|
|
16376
|
+
accepted: options.accepted,
|
|
16377
|
+
sealHead,
|
|
16378
|
+
sessionFile: void 0,
|
|
16379
|
+
instruction: options.instruction ?? ""
|
|
16380
|
+
});
|
|
16381
|
+
}
|
|
16275
16382
|
var init_submission_ledger = __esm({
|
|
16276
16383
|
"src/submission-ledger.ts"() {
|
|
16277
16384
|
"use strict";
|
|
@@ -16610,7 +16717,7 @@ function findLatestDurablePackagedRoleTerminal(entries) {
|
|
|
16610
16717
|
}
|
|
16611
16718
|
return void 0;
|
|
16612
16719
|
}
|
|
16613
|
-
var NAVIGATOR_INVOCATION_ENTRY,
|
|
16720
|
+
var NAVIGATOR_INVOCATION_ENTRY, NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND, NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS, PACKAGED_ROLE_OUTPUT_TOOLS;
|
|
16614
16721
|
var init_navigator_invocation_identity = __esm({
|
|
16615
16722
|
"src/navigator-invocation-identity.ts"() {
|
|
16616
16723
|
"use strict";
|
|
@@ -16619,7 +16726,6 @@ var init_navigator_invocation_identity = __esm({
|
|
|
16619
16726
|
init_unknown_value();
|
|
16620
16727
|
init_work_subject_identity();
|
|
16621
16728
|
NAVIGATOR_INVOCATION_ENTRY = "ak-navigator-invocation";
|
|
16622
|
-
NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY = "ak-navigator-route-playbook-failure";
|
|
16623
16729
|
NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND = "role_infrastructure_failure";
|
|
16624
16730
|
NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS = [
|
|
16625
16731
|
"kind",
|
|
@@ -16894,7 +17000,7 @@ async function settleNoReceiptTerminal(admitted, authority, scope, facts) {
|
|
|
16894
17000
|
}
|
|
16895
17001
|
return attachEngineDetourToolUsage({
|
|
16896
17002
|
roleOutcome,
|
|
16897
|
-
navigator: await extractNavigatorFactFromAdmittedSession(
|
|
17003
|
+
navigator: isNavigatorSeat(admitted.role) ? NAVIGATOR_SEAT_OWN_FACT : await extractNavigatorFactFromAdmittedSession(
|
|
16898
17004
|
coordinates.sessionFile,
|
|
16899
17005
|
admitted.runDirectory,
|
|
16900
17006
|
scope
|
|
@@ -17153,7 +17259,6 @@ async function appendRunAttemptHistory(source, outcome) {
|
|
|
17153
17259
|
}
|
|
17154
17260
|
function parseNavigatorAttendanceDetails(details) {
|
|
17155
17261
|
const disposition = details.disposition;
|
|
17156
|
-
const advisoryDiagnostic = typeof details.routePlaybookReadFailure === "string" ? { advisoryDiagnostic: details.routePlaybookReadFailure } : {};
|
|
17157
17262
|
if (disposition === "advice" || disposition === "recommendation") {
|
|
17158
17263
|
let prose;
|
|
17159
17264
|
if (typeof details.prose === "string" && details.prose.trim() !== "") {
|
|
@@ -17173,29 +17278,19 @@ function parseNavigatorAttendanceDetails(details) {
|
|
|
17173
17278
|
}
|
|
17174
17279
|
}
|
|
17175
17280
|
if (prose === void 0 || prose.trim() === "") {
|
|
17176
|
-
return {
|
|
17177
|
-
disposition: "no-advice",
|
|
17178
|
-
...advisoryDiagnostic
|
|
17179
|
-
};
|
|
17281
|
+
return { disposition: "no-advice" };
|
|
17180
17282
|
}
|
|
17181
|
-
return adviceNavigatorFact({
|
|
17182
|
-
prose,
|
|
17183
|
-
...advisoryDiagnostic
|
|
17184
|
-
});
|
|
17283
|
+
return adviceNavigatorFact({ prose });
|
|
17185
17284
|
}
|
|
17186
17285
|
if (disposition === "unavailable") {
|
|
17187
17286
|
return {
|
|
17188
17287
|
disposition: "unavailable",
|
|
17189
|
-
...advisoryDiagnostic,
|
|
17190
17288
|
source: typeof details.unavailableSource === "string" ? details.unavailableSource : "unknown",
|
|
17191
17289
|
reason: typeof details.unavailableReason === "string" ? details.unavailableReason : "Navigator unavailable"
|
|
17192
17290
|
};
|
|
17193
17291
|
}
|
|
17194
17292
|
if (disposition === "no-advice" || disposition === "arrival" || disposition === "silence") {
|
|
17195
|
-
return {
|
|
17196
|
-
disposition: "no-advice",
|
|
17197
|
-
...advisoryDiagnostic
|
|
17198
|
-
};
|
|
17293
|
+
return { disposition: "no-advice" };
|
|
17199
17294
|
}
|
|
17200
17295
|
return {
|
|
17201
17296
|
disposition: "unavailable",
|
|
@@ -17247,23 +17342,7 @@ function detourUsageContext(admitted, scope) {
|
|
|
17247
17342
|
...scope?.notePackageFault === void 0 ? {} : { notePackageFault: scope.notePackageFault }
|
|
17248
17343
|
};
|
|
17249
17344
|
}
|
|
17250
|
-
function routePlaybookFailureMessage(entries) {
|
|
17251
|
-
for (let i = entries.length - 1; i >= 0; i -= 1) {
|
|
17252
|
-
const entry = entries[i];
|
|
17253
|
-
if (entry?.type !== "custom" || entry.customType !== NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY) continue;
|
|
17254
|
-
const data = entry.data;
|
|
17255
|
-
if (!isRecord(data) || typeof data.message !== "string" || data.message.trim() === "") return void 0;
|
|
17256
|
-
return data.message;
|
|
17257
|
-
}
|
|
17258
|
-
return void 0;
|
|
17259
|
-
}
|
|
17260
17345
|
function extractNavigatorFact(entries) {
|
|
17261
|
-
const fact = extractNavigatorAttendanceFact(entries);
|
|
17262
|
-
if (fact.advisoryDiagnostic !== void 0) return fact;
|
|
17263
|
-
const message = routePlaybookFailureMessage(entries);
|
|
17264
|
-
return message === void 0 ? fact : { ...fact, advisoryDiagnostic: message };
|
|
17265
|
-
}
|
|
17266
|
-
function extractNavigatorAttendanceFact(entries) {
|
|
17267
17346
|
const terminal = findLatestDurablePackagedRoleTerminal(entries);
|
|
17268
17347
|
if (terminal === void 0) {
|
|
17269
17348
|
return {
|
|
@@ -17408,7 +17487,7 @@ async function finishLawfulSeat(admitted, coordinates, entries, roleOutcome, sco
|
|
|
17408
17487
|
const artifacts = scope?.previewOnly === true ? [] : await publishDeclaredSeatTerminal(admitted, roleOutcome, coordinates, entries, scope);
|
|
17409
17488
|
const terminal = await attachEngineDetourToolUsage({
|
|
17410
17489
|
roleOutcome,
|
|
17411
|
-
navigator: extractNavigatorFact(entries),
|
|
17490
|
+
navigator: isNavigatorSeat(admitted.role) ? NAVIGATOR_SEAT_OWN_FACT : extractNavigatorFact(entries),
|
|
17412
17491
|
artifacts,
|
|
17413
17492
|
runId: admitted.runId,
|
|
17414
17493
|
...submissionToolCallId === void 0 || submissionToolCallId.length === 0 ? {} : { submissionToolCallId }
|
|
@@ -17532,7 +17611,7 @@ async function publishFailureTerminal(admitted, failure, coordinates, onErrorPub
|
|
|
17532
17611
|
async function settleFailureTerminalResult(admitted, failure, authority, options = {}) {
|
|
17533
17612
|
const coordinates = coordinatesFromAdmitted(authority, admitted);
|
|
17534
17613
|
const { sessionDirectory, sessionFile } = coordinates;
|
|
17535
|
-
const navigator = await extractNavigatorFactFromAdmittedSession(
|
|
17614
|
+
const navigator = isNavigatorSeat(admitted.role) ? NAVIGATOR_SEAT_OWN_FACT : await extractNavigatorFactFromAdmittedSession(
|
|
17536
17615
|
sessionFile,
|
|
17537
17616
|
admitted.runDirectory,
|
|
17538
17617
|
options
|
|
@@ -17638,7 +17717,7 @@ function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2
|
|
|
17638
17717
|
});
|
|
17639
17718
|
});
|
|
17640
17719
|
}
|
|
17641
|
-
var LifecycleReadFailure, NAVIGATOR_POST_ROLE_GRACE_MS, ATTEMPT_HISTORY_ENTRY_TYPE, EMPTY_ARTIFACT_FACE;
|
|
17720
|
+
var LifecycleReadFailure, NAVIGATOR_POST_ROLE_GRACE_MS, ATTEMPT_HISTORY_ENTRY_TYPE, NAVIGATOR_SEAT_OWN_FACT, EMPTY_ARTIFACT_FACE;
|
|
17642
17721
|
var init_settlement = __esm({
|
|
17643
17722
|
"src/public-cli/settlement.ts"() {
|
|
17644
17723
|
"use strict";
|
|
@@ -17672,6 +17751,7 @@ var init_settlement = __esm({
|
|
|
17672
17751
|
};
|
|
17673
17752
|
NAVIGATOR_POST_ROLE_GRACE_MS = 1e4;
|
|
17674
17753
|
ATTEMPT_HISTORY_ENTRY_TYPE = "ak_run_attempt_history";
|
|
17754
|
+
NAVIGATOR_SEAT_OWN_FACT = { disposition: "no-advice" };
|
|
17675
17755
|
EMPTY_ARTIFACT_FACE = {};
|
|
17676
17756
|
}
|
|
17677
17757
|
});
|
|
@@ -18221,6 +18301,93 @@ var init_role_turn_host = __esm({
|
|
|
18221
18301
|
}
|
|
18222
18302
|
});
|
|
18223
18303
|
|
|
18304
|
+
// src/navigator-route-table.ts
|
|
18305
|
+
function navigatorRowsForRole(role) {
|
|
18306
|
+
return NAVIGATOR_ROUTE_TABLE[role] ?? {};
|
|
18307
|
+
}
|
|
18308
|
+
function navigatorFullTable() {
|
|
18309
|
+
return NAVIGATOR_ROUTE_TABLE;
|
|
18310
|
+
}
|
|
18311
|
+
var DISPOSE_BY_VERDICT, ESCALATE_TO_OWNER, DISPATCH_WORKER, SETTLED_TO_JUDGE, RESUME_SAME_WORKER, ROUTE_ROWS, NAVIGATOR_ROUTE_TABLE;
|
|
18312
|
+
var init_navigator_route_table = __esm({
|
|
18313
|
+
"src/navigator-route-table.ts"() {
|
|
18314
|
+
"use strict";
|
|
18315
|
+
DISPOSE_BY_VERDICT = "\u6309\u5224\u8BCD\u5904\u7F6E";
|
|
18316
|
+
ESCALATE_TO_OWNER = "\u5448\u965B\u4E0B\u88C1\u51B3";
|
|
18317
|
+
DISPATCH_WORKER = "\u6D3E\u5C06\u4F5C\u76D1\u5F00\u5DE5";
|
|
18318
|
+
SETTLED_TO_JUDGE = "\u53EF\u9001\u5927\u7406\u5BFA\u5BA1\u8BA1";
|
|
18319
|
+
RESUME_SAME_WORKER = "\u7EED\u4FEE\uFF0C\u52FF\u9001\u5927\u7406\u5BFA";
|
|
18320
|
+
ROUTE_ROWS = {
|
|
18321
|
+
secretariat: { converged: DISPATCH_WORKER, escalate: ESCALATE_TO_OWNER },
|
|
18322
|
+
countersign: { converged: DISPATCH_WORKER, continue: DISPOSE_BY_VERDICT, escalate: ESCALATE_TO_OWNER },
|
|
18323
|
+
notary: { converged: "\u6309\u6D41\u7A0B\u8FDB\u4E0B\u4E00\u7AD9", continue: DISPOSE_BY_VERDICT, escalate: ESCALATE_TO_OWNER },
|
|
18324
|
+
inspector: { converged: "\u6309\u6D41\u7A0B\u8FDB\u4E0B\u4E00\u7AD9", continue: DISPOSE_BY_VERDICT, escalate: ESCALATE_TO_OWNER },
|
|
18325
|
+
coder: {
|
|
18326
|
+
completed: "\u6D3E\u5FA1\u53F2\u53F0",
|
|
18327
|
+
partially_completed: SETTLED_TO_JUDGE,
|
|
18328
|
+
refused: SETTLED_TO_JUDGE,
|
|
18329
|
+
unfinished: RESUME_SAME_WORKER
|
|
18330
|
+
},
|
|
18331
|
+
fixer: {
|
|
18332
|
+
completed: "\u76F4\u56DE\u5927\u7406\u5BFA\u590D\u5BA1",
|
|
18333
|
+
partially_completed: SETTLED_TO_JUDGE,
|
|
18334
|
+
refused: SETTLED_TO_JUDGE,
|
|
18335
|
+
unfinished: RESUME_SAME_WORKER
|
|
18336
|
+
},
|
|
18337
|
+
reviewer: { completed: "\u6D3E\u5927\u7406\u5BFA\u88C1\u51B3", refused: "\u5448\u8C03\u7528\u8005\u5904\u7F6E" },
|
|
18338
|
+
judge: {
|
|
18339
|
+
converged: "\u8C03\u7528\u8005\u5408\u5E76\u3001\u5173\u7968",
|
|
18340
|
+
continue: DISPOSE_BY_VERDICT,
|
|
18341
|
+
escalate: ESCALATE_TO_OWNER
|
|
18342
|
+
},
|
|
18343
|
+
gatekeeper: { dispatch: "\u53EC\u6240\u70B9\u540D\u7684\u5B98\u5458", pass: "\u653E\u884C\uFF0C\u8FDB\u4E0B\u4E00\u7AD9" },
|
|
18344
|
+
merger: { completed: "\u8C03\u7528\u8005\u6536\u5C3E\u3001\u5173\u7968", escalate: ESCALATE_TO_OWNER },
|
|
18345
|
+
diarist: { completed: "\u7EE7\u7EED\u540E\u7EED\u8859\u95E8", escalate: ESCALATE_TO_OWNER }
|
|
18346
|
+
};
|
|
18347
|
+
NAVIGATOR_ROUTE_TABLE = ROUTE_ROWS;
|
|
18348
|
+
}
|
|
18349
|
+
});
|
|
18350
|
+
|
|
18351
|
+
// src/navigator-lookup-host.ts
|
|
18352
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
18353
|
+
function targetRole(forRole) {
|
|
18354
|
+
const known = PACKAGED_ROLE_REGISTRY.find(({ role }) => role === forRole);
|
|
18355
|
+
if (known === void 0) throw new Error(`navigator lookup: unknown role ${forRole}`);
|
|
18356
|
+
return known.role;
|
|
18357
|
+
}
|
|
18358
|
+
function createNavigatorLookupHost() {
|
|
18359
|
+
return {
|
|
18360
|
+
async executeTurn(request) {
|
|
18361
|
+
const { activation } = request;
|
|
18362
|
+
if (activation.role !== "navigator") {
|
|
18363
|
+
throw new Error(`navigator lookup host cannot run ${activation.role}`);
|
|
18364
|
+
}
|
|
18365
|
+
const accepted = activation.forRole === void 0 ? { byRole: navigatorFullTable() } : { byStatus: navigatorRowsForRole(targetRole(activation.forRole)) };
|
|
18366
|
+
sealAcceptedSubmission({
|
|
18367
|
+
runDirectory: request.runDirectory,
|
|
18368
|
+
cwd: request.cwd,
|
|
18369
|
+
home: request.home,
|
|
18370
|
+
role: "navigator",
|
|
18371
|
+
accepted,
|
|
18372
|
+
instruction: request.continuation.prompt,
|
|
18373
|
+
toolCallId: `navigator-lookup:${randomUUID5()}`,
|
|
18374
|
+
...request.courtAttemptId === void 0 ? {} : { courtAttemptId: request.courtAttemptId }
|
|
18375
|
+
});
|
|
18376
|
+
return { code: 0, stderr: "", timedOut: false };
|
|
18377
|
+
}
|
|
18378
|
+
};
|
|
18379
|
+
}
|
|
18380
|
+
var NAVIGATOR_LOOKUP_HOST;
|
|
18381
|
+
var init_navigator_lookup_host = __esm({
|
|
18382
|
+
"src/navigator-lookup-host.ts"() {
|
|
18383
|
+
"use strict";
|
|
18384
|
+
init_navigator_route_table();
|
|
18385
|
+
init_packaged_role_registry();
|
|
18386
|
+
init_submission_ledger();
|
|
18387
|
+
NAVIGATOR_LOOKUP_HOST = "lookup";
|
|
18388
|
+
}
|
|
18389
|
+
});
|
|
18390
|
+
|
|
18224
18391
|
// src/public-cli/load-production-acp-host.ts
|
|
18225
18392
|
import { existsSync as existsSync7 } from "node:fs";
|
|
18226
18393
|
import { join as join17 } from "node:path";
|
|
@@ -18386,6 +18553,15 @@ __export(role_seat_runtime_exports, {
|
|
|
18386
18553
|
openRoleSeatRuntime: () => openRoleSeatRuntime
|
|
18387
18554
|
});
|
|
18388
18555
|
function openRoleSeatRuntime(input) {
|
|
18556
|
+
if (isNavigatorSeat(input.role)) {
|
|
18557
|
+
input.afterHost?.();
|
|
18558
|
+
return {
|
|
18559
|
+
ok: true,
|
|
18560
|
+
roleTurnHost: createNavigatorLookupHost(),
|
|
18561
|
+
hostAdapters: [],
|
|
18562
|
+
host: NAVIGATOR_LOOKUP_HOST
|
|
18563
|
+
};
|
|
18564
|
+
}
|
|
18389
18565
|
const hostAdapters = composeRoleTurnHostAdapters(
|
|
18390
18566
|
input.resolution,
|
|
18391
18567
|
input.principalAuthority
|
|
@@ -18416,6 +18592,8 @@ var init_role_seat_runtime = __esm({
|
|
|
18416
18592
|
"src/public-cli/role-seat-runtime.ts"() {
|
|
18417
18593
|
"use strict";
|
|
18418
18594
|
init_engine_material();
|
|
18595
|
+
init_navigator_lookup_host();
|
|
18596
|
+
init_packaged_role_registry();
|
|
18419
18597
|
init_config2();
|
|
18420
18598
|
init_host_providers();
|
|
18421
18599
|
init_role_turn_host_resolution();
|
|
@@ -19164,7 +19342,6 @@ function projectRoleTurnRequest(admitted, roleDetails, options) {
|
|
|
19164
19342
|
...options.courtAttemptId === void 0 || options.courtAttemptId.length === 0 ? {} : { courtAttemptId: options.courtAttemptId },
|
|
19165
19343
|
...options.invocationScopeId === void 0 || options.invocationScopeId.length === 0 ? {} : { invocationScopeId: options.invocationScopeId },
|
|
19166
19344
|
...options.stationChild === void 0 ? {} : { stationChild: options.stationChild },
|
|
19167
|
-
...options.navigatorByStatusPrepare === void 0 ? {} : { navigatorByStatusPrepare: options.navigatorByStatusPrepare },
|
|
19168
19345
|
...options.deliveryRequestLimit === void 0 ? {} : { deliveryRequestLimit: options.deliveryRequestLimit },
|
|
19169
19346
|
...options.host === void 0 || options.host.trim() === "" ? {} : { host: options.host.trim() }
|
|
19170
19347
|
};
|
|
@@ -19470,6 +19647,7 @@ async function reaskUnreadablePostSubmissionStatus(admitted, terminal, env, io,
|
|
|
19470
19647
|
}
|
|
19471
19648
|
async function reaskMissingTicketOnce(admitted, terminal, env, io) {
|
|
19472
19649
|
if ((env.ticketReasksSpent ?? 0) >= 1) return { kind: "none" };
|
|
19650
|
+
if (isNavigatorSeat(admitted.role)) return { kind: "none" };
|
|
19473
19651
|
if (admitted.ticketNumber !== void 0) return { kind: "none" };
|
|
19474
19652
|
if (!isUnboundRunDirectory(admitted.runDirectory)) return { kind: "none" };
|
|
19475
19653
|
if (terminal?.roleOutcome.kind !== "accepted" && terminal?.roleOutcome.kind !== "audit_escalation") {
|
|
@@ -21010,7 +21188,6 @@ async function summonPublicRole(options) {
|
|
|
21010
21188
|
// Nested court stations keep station-child semantics; dual-lens
|
|
21011
21189
|
// ordinary Reviewer axes opt out (#946 / ADR 0082).
|
|
21012
21190
|
...options.stationChild === false ? {} : { stationChild: true },
|
|
21013
|
-
...options.navigatorByStatusPrepare === true ? { navigatorByStatusPrepare: true } : {},
|
|
21014
21191
|
// Forward composition-root adapters so nested stations (e.g.
|
|
21015
21192
|
// secretariat → diarist) select the same faux/production table (#924).
|
|
21016
21193
|
...options.hostAdapters === void 0 ? {} : { hostAdapters: options.hostAdapters },
|
|
@@ -22432,7 +22609,7 @@ var init_run_lifecycle = __esm({
|
|
|
22432
22609
|
});
|
|
22433
22610
|
|
|
22434
22611
|
// src/public-cli/post-admission.ts
|
|
22435
|
-
import { randomUUID as
|
|
22612
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
22436
22613
|
function describeCaughtError(error) {
|
|
22437
22614
|
if (error instanceof Error) {
|
|
22438
22615
|
const code = error.code;
|
|
@@ -23056,9 +23233,6 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
23056
23233
|
if (env.stationChild !== void 0) {
|
|
23057
23234
|
turnRequest = { ...turnRequest, stationChild: env.stationChild };
|
|
23058
23235
|
}
|
|
23059
|
-
if (env.navigatorByStatusPrepare === true) {
|
|
23060
|
-
turnRequest = { ...turnRequest, navigatorByStatusPrepare: true };
|
|
23061
|
-
}
|
|
23062
23236
|
if (typeof env.host === "string" && env.host.trim() !== "") {
|
|
23063
23237
|
turnRequest = { ...turnRequest, host: env.host.trim() };
|
|
23064
23238
|
}
|
|
@@ -23317,7 +23491,6 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
|
|
|
23317
23491
|
prompt
|
|
23318
23492
|
},
|
|
23319
23493
|
...env.stationChild === void 0 ? {} : { stationChild: env.stationChild },
|
|
23320
|
-
...env.navigatorByStatusPrepare === true ? { navigatorByStatusPrepare: true } : {},
|
|
23321
23494
|
// #1132: one configured ceiling, already resolved by the caller (#422).
|
|
23322
23495
|
deliveryRequestLimit: deliveryLimitFromConfig(env.autoResumeLimit)
|
|
23323
23496
|
};
|
|
@@ -23330,7 +23503,6 @@ function roleTurnOptions(env, admitted, continuation) {
|
|
|
23330
23503
|
...correlationId === void 0 || correlationId.trim() === "" ? {} : { correlationId },
|
|
23331
23504
|
continuation,
|
|
23332
23505
|
...env.stationChild === void 0 ? {} : { stationChild: env.stationChild },
|
|
23333
|
-
...env.navigatorByStatusPrepare === true ? { navigatorByStatusPrepare: true } : {},
|
|
23334
23506
|
// #1132: one configured ceiling, already resolved by the caller (#422).
|
|
23335
23507
|
deliveryRequestLimit: deliveryLimitFromConfig(env.autoResumeLimit)
|
|
23336
23508
|
};
|
|
@@ -23456,7 +23628,7 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
23456
23628
|
}
|
|
23457
23629
|
}
|
|
23458
23630
|
if (openCourtAttemptId !== void 0 || request.summons !== void 0) {
|
|
23459
|
-
const courtAttemptId = openCourtAttemptId ?? (turnRequest.courtAttemptId !== void 0 && turnRequest.courtAttemptId.length > 0 ? turnRequest.courtAttemptId :
|
|
23631
|
+
const courtAttemptId = openCourtAttemptId ?? (turnRequest.courtAttemptId !== void 0 && turnRequest.courtAttemptId.length > 0 ? turnRequest.courtAttemptId : randomUUID6());
|
|
23460
23632
|
turnRequest = { ...turnRequest, courtAttemptId };
|
|
23461
23633
|
if (openCourtAttemptId === void 0) {
|
|
23462
23634
|
const court = {
|
|
@@ -29654,12 +29826,12 @@ var init_analyst_book_key = __esm({
|
|
|
29654
29826
|
});
|
|
29655
29827
|
|
|
29656
29828
|
// src/atomic-write.ts
|
|
29657
|
-
import { randomUUID as
|
|
29829
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
29658
29830
|
import { rename as rename2, rm, writeFile as writeFile4 } from "node:fs/promises";
|
|
29659
29831
|
import { dirname as dirname15, join as join24 } from "node:path";
|
|
29660
29832
|
async function writeFileAtomically(destination, contents, options) {
|
|
29661
29833
|
const parent = dirname15(destination);
|
|
29662
|
-
const temporary = join24(parent, `.atomic-write-${
|
|
29834
|
+
const temporary = join24(parent, `.atomic-write-${randomUUID7()}.tmp`);
|
|
29663
29835
|
try {
|
|
29664
29836
|
await writeFile4(temporary, contents, options);
|
|
29665
29837
|
await rename2(temporary, destination);
|