@akagilnc/pi-workflow-roles 0.1.5079 → 0.1.5122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-host/production-host.js +545 -334
- package/dist/atomic-write.js +13 -19
- package/dist/auditor-soul.js +2 -1
- package/dist/doctor-contracts.js +1 -1
- package/dist/gatekeeper-role.js +2 -16
- package/dist/headless-host/production-host.js +577 -366
- package/dist/merger-contracts.js +1 -1
- package/dist/migrate-book-topology.js +18 -14
- package/dist/navigator-attendance.js +28 -143
- package/dist/navigator-invocation-identity.js +2 -0
- package/dist/navigator-public-session.js +13 -1
- package/dist/navigator-work-base.js +113 -0
- package/dist/notary-contracts.js +0 -2
- package/dist/package-contracts/fixer-output.js +1 -1
- package/dist/package-contracts/gatekeeper-output.js +1 -1
- package/dist/package-contracts/navigator-output.js +1 -1
- package/dist/package-contracts/terminating-infrastructure.js +3 -3
- package/dist/packaged-role-registry.js +9 -5
- package/dist/public-cli/cli.js +24 -1
- package/dist/public-cli/countersign-run.js +1 -1
- package/dist/public-cli/instruction-seat-run.js +8 -6
- package/dist/public-cli/invocation.js +6 -3
- package/dist/public-cli/main.js +6711 -6523
- package/dist/public-cli/post-admission.js +125 -26
- package/dist/public-cli/settlement.js +48 -5
- package/dist/receipt-delivery-policy.js +9 -2
- package/dist/review-submission.js +3 -3
- package/docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md +9 -0
- package/extensions/role-runtime.ts +0 -27
- package/package.json +2 -1
- package/resources/836-deleted-machine-instruction-inventory.md +3 -3
- package/resources/collector-bot-handbook.md +4 -0
- package/resources/navigator-route-playbook.md +4 -6
- package/scripts/build-package.mjs +4 -0
- package/souls/coder-output-guide.md +1 -0
- package/src/auditor-soul.ts +2 -1
- package/src/collector-role.ts +6 -7
- package/src/collector-tool-schemas.ts +5 -5
- package/src/diarist-role.ts +2 -2
- package/src/doctor-contracts.ts +1 -1
- package/src/gatekeeper-role.ts +1 -18
- package/src/gleaner-left-role.ts +2 -2
- package/src/inspector-role.ts +1 -1
- package/src/judge-role.ts +1 -1
- package/src/merger-contracts.ts +1 -1
- package/src/navigator-attendance.ts +38 -164
- package/src/navigator-invocation-identity.ts +2 -0
- package/src/navigator-public-session.ts +17 -1
- package/src/navigator-role.ts +4 -0
- package/src/navigator-session-contracts.ts +2 -0
- package/src/navigator-work-base.ts +123 -0
- package/src/notary-contracts.ts +0 -4
- package/src/package-contracts/fixer-output.ts +1 -1
- package/src/package-contracts/gatekeeper-output.ts +3 -3
- package/src/package-contracts/navigator-output.ts +1 -1
- package/src/package-contracts/terminating-infrastructure.ts +3 -6
- package/src/packaged-role-registry.ts +5 -1
- package/src/public-cli/cli-io.ts +2 -0
- package/src/public-cli/cli.ts +38 -4
- package/src/public-cli/countersign-run.ts +1 -1
- package/src/public-cli/instruction-seat-run.ts +10 -6
- package/src/public-cli/invocation.ts +12 -4
- package/src/public-cli/post-admission.ts +189 -34
- package/src/public-cli/settlement.ts +58 -4
- package/src/receipt-delivery-policy.ts +9 -1
- package/src/review-submission.ts +3 -3
- package/src/reviewer-role.ts +3 -3
- package/src/role-runtime-dependencies.ts +1 -5
- package/src/role-runtime.ts +52 -38
- package/src/secretariat-role.ts +3 -3
- package/src/worker-role.ts +3 -3
|
@@ -62,7 +62,7 @@ async function spawnEngineDetourOnce(input) {
|
|
|
62
62
|
}
|
|
63
63
|
const command = input.argv[0];
|
|
64
64
|
const args = input.argv.slice(1);
|
|
65
|
-
return await new Promise((
|
|
65
|
+
return await new Promise((resolve22, reject) => {
|
|
66
66
|
let settled = false;
|
|
67
67
|
const signal = input.signal;
|
|
68
68
|
const child = spawn(command, args, {
|
|
@@ -92,7 +92,7 @@ async function spawnEngineDetourOnce(input) {
|
|
|
92
92
|
if (signal !== void 0) {
|
|
93
93
|
signal.removeEventListener("abort", onAbort);
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
resolve22(result);
|
|
96
96
|
};
|
|
97
97
|
const onAbort = () => {
|
|
98
98
|
fail4(signal !== void 0 ? abortReasonError(signal) : new Error("aborted"));
|
|
@@ -1172,12 +1172,12 @@ function createSystemCollectorClock() {
|
|
|
1172
1172
|
return {
|
|
1173
1173
|
wallNow: () => /* @__PURE__ */ new Date(),
|
|
1174
1174
|
monoNow: () => Number(process.hrtime.bigint() - start) / 1e6,
|
|
1175
|
-
sleep: (ms, signal) => new Promise((
|
|
1175
|
+
sleep: (ms, signal) => new Promise((resolve22, reject) => {
|
|
1176
1176
|
if (signal?.aborted) {
|
|
1177
1177
|
reject(signal.reason ?? new Error("aborted"));
|
|
1178
1178
|
return;
|
|
1179
1179
|
}
|
|
1180
|
-
const timer = setTimeout(
|
|
1180
|
+
const timer = setTimeout(resolve22, ms);
|
|
1181
1181
|
const onAbort = () => {
|
|
1182
1182
|
clearTimeout(timer);
|
|
1183
1183
|
reject(signal?.reason ?? new Error("aborted"));
|
|
@@ -1863,7 +1863,7 @@ function normalizeReviewComment(raw) {
|
|
|
1863
1863
|
function createGhApiRunner(options = {}) {
|
|
1864
1864
|
const spawnImpl = options.spawnImpl ?? spawn2;
|
|
1865
1865
|
return async (args, runOptions = {}) => {
|
|
1866
|
-
return await new Promise((
|
|
1866
|
+
return await new Promise((resolve22, reject) => {
|
|
1867
1867
|
const signal = runOptions.signal;
|
|
1868
1868
|
if (signal?.aborted) {
|
|
1869
1869
|
reject(signal.reason ?? new Error("aborted"));
|
|
@@ -1936,11 +1936,11 @@ function createGhApiRunner(options = {}) {
|
|
|
1936
1936
|
const value = line2.slice(idx + 1).trim();
|
|
1937
1937
|
headers[name] = value;
|
|
1938
1938
|
}
|
|
1939
|
-
|
|
1939
|
+
resolve22({ status, headers, bodyText });
|
|
1940
1940
|
return;
|
|
1941
1941
|
}
|
|
1942
1942
|
if (code === 0) {
|
|
1943
|
-
|
|
1943
|
+
resolve22({ status: 200, headers: {}, bodyText: stdout });
|
|
1944
1944
|
return;
|
|
1945
1945
|
}
|
|
1946
1946
|
const failure2 = new Error(
|
|
@@ -3173,7 +3173,7 @@ function withTerminatingOutputDeclarations(schema) {
|
|
|
3173
3173
|
...baseProperties ?? {},
|
|
3174
3174
|
...baseProperties?.ticketNumber === void 0 ? {
|
|
3175
3175
|
ticketNumber: Type3.Unknown({
|
|
3176
|
-
description: "\u53EF\u9009\u672C\u7968\u53F7\
|
|
3176
|
+
description: "\u53EF\u9009\u672C\u7968\u53F7\u3002\u5C1A\u672A\u7ED1\u5B9A\u65F6\u7531\u89D2\u8272\u5728\u65E2\u6709\u56DE\u6267\u4E2D\u7533\u62A5\u3002"
|
|
3177
3177
|
})
|
|
3178
3178
|
} : {},
|
|
3179
3179
|
[INFRASTRUCTURE_FAILURE_DECLARATION_KEY]: infrastructureFailureDeclarationSchema.properties[INFRASTRUCTURE_FAILURE_DECLARATION_KEY]
|
|
@@ -3230,12 +3230,12 @@ var init_terminating_infrastructure = __esm({
|
|
|
3230
3230
|
infrastructureFailureNested = Type3.Object(
|
|
3231
3231
|
{
|
|
3232
3232
|
[INFRASTRUCTURE_FAILURE_DIAGNOSTIC_KEY]: Type3.Unknown({
|
|
3233
|
-
description: "\
|
|
3233
|
+
description: "\u57FA\u7840\u8BBE\u65BD\u5931\u8D25\u8BCA\u65AD\u5B57\u7B26\u4E32\u3002"
|
|
3234
3234
|
})
|
|
3235
3235
|
},
|
|
3236
3236
|
{
|
|
3237
3237
|
additionalProperties: true,
|
|
3238
|
-
description: "\u57FA\u7840\u8BBE\u65BD\u771F\u5B9E\u5931\u8D25\
|
|
3238
|
+
description: "\u4EC5\u57FA\u7840\u8BBE\u65BD\u771F\u5B9E\u5931\u8D25\u65F6\u51FA\u73B0\u3002"
|
|
3239
3239
|
}
|
|
3240
3240
|
);
|
|
3241
3241
|
infrastructureFailureNested.required = [];
|
|
@@ -3260,7 +3260,7 @@ var init_gatekeeper_output = __esm({
|
|
|
3260
3260
|
gatekeeperDecisionSchema = openToolObject(
|
|
3261
3261
|
Type4.Object({
|
|
3262
3262
|
status: Type4.Unknown({
|
|
3263
|
-
description: "dispatch | pass
|
|
3263
|
+
description: "dispatch | pass"
|
|
3264
3264
|
}),
|
|
3265
3265
|
officer: Type4.Unknown({
|
|
3266
3266
|
description: "status \u4E3A dispatch \u65F6\u4E3A inspector | notary"
|
|
@@ -3329,7 +3329,7 @@ var init_navigator_output = __esm({
|
|
|
3329
3329
|
openToolObject(
|
|
3330
3330
|
Type5.Object({
|
|
3331
3331
|
prose: Type5.Unknown({
|
|
3332
|
-
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7B49\u7ED3\u6784\u5316\u5B57\u6BB5\u3002
|
|
3332
|
+
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7B49\u7ED3\u6784\u5316\u5B57\u6BB5\u3002"
|
|
3333
3333
|
})
|
|
3334
3334
|
})
|
|
3335
3335
|
)
|
|
@@ -3356,7 +3356,7 @@ var init_review_submission = __esm({
|
|
|
3356
3356
|
Type6.Literal(REVIEW_QUEUE_WORDS[2])
|
|
3357
3357
|
],
|
|
3358
3358
|
{
|
|
3359
|
-
description: "\u5BA1\u6838\
|
|
3359
|
+
description: "\u5BA1\u6838\u5E2D\u672C\u8F6E\u88C1\u51B3\u7684\u5224\u522B\u72B6\u6001\u3002"
|
|
3360
3360
|
}
|
|
3361
3361
|
),
|
|
3362
3362
|
findings: Type6.Optional(Type6.Unknown({ description: "\u5BA1\u6838\u53D1\u73B0\uFF0C\u539F\u6837\u7559\u5B58" })),
|
|
@@ -3429,7 +3429,7 @@ var init_fixer_output = __esm({
|
|
|
3429
3429
|
});
|
|
3430
3430
|
classResultSchema = Type7.Union([completedClassResultSchema, refusedClassResultSchema]);
|
|
3431
3431
|
completedClassResultsSchema = Type7.Array(completedClassResultSchema);
|
|
3432
|
-
FIXER_STATUS_DESCRIPTION = "planned | completed | refused | unfinished | partially_completed
|
|
3432
|
+
FIXER_STATUS_DESCRIPTION = "planned | completed | refused | unfinished | partially_completed\u3002unfinished \u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u81F4\u672C\u5C40\u672A\u5B8C\u6210\u65F6\u53EF\u7528\uFF0C\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002";
|
|
3433
3433
|
fixerOutputVariants = Type7.Union([
|
|
3434
3434
|
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }) }),
|
|
3435
3435
|
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), remainingScope: Type7.String({ description: "\u4F9D\u6CD5\u4E0D\u80FD\u5B8C\u6210\u7684\u5DE5\u4F5C\u8303\u56F4" }), blocker: Type7.Unsafe({ ...blockerSchema, description: "\u5408\u6CD5\u963B\u65AD\u5B8C\u6210\u7684 blocker" }) }),
|
|
@@ -3589,7 +3589,7 @@ var init_doctor_contracts = __esm({
|
|
|
3589
3589
|
Type9.Object({ targetKey: nonblank, targetKind: Type9.Optional(Type9.Union(assetKinds.map((kind) => Type9.Literal(kind)))), assetEvidence: Type9.Optional(Type9.Object({ targetKey: nonblank, targetKind: Type9.Optional(Type9.Union(assetKinds.map((kind) => Type9.Literal(kind)))), evidenceId: nonblank }, { additionalProperties: true })), ...findingBody }, { additionalProperties: true })
|
|
3590
3590
|
]);
|
|
3591
3591
|
caseIdentity = Type9.Object({ issueNumber: Type9.Optional(Type9.Integer()), runsPath: nonblank }, { additionalProperties: true });
|
|
3592
|
-
DOCTOR_STATUS_DESCRIPTION = "completed | refused
|
|
3592
|
+
DOCTOR_STATUS_DESCRIPTION = "completed | refused\u3002completed \u5141\u8BB8\u7A7A findings\uFF1Brefused \u4EC5\u5F53\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u6848\u8BC1\u8BCD";
|
|
3593
3593
|
doctorSubmissionVariants = Type9.Union([
|
|
3594
3594
|
Type9.Object({
|
|
3595
3595
|
status: Type9.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
|
|
@@ -3715,7 +3715,7 @@ var init_merger_contracts = __esm({
|
|
|
3715
3715
|
resolutionScope: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
|
|
3716
3716
|
authorizedChecks: Type10.Array(checkSchema)
|
|
3717
3717
|
}, { additionalProperties: false });
|
|
3718
|
-
MERGER_STATUS_DESCRIPTION = "completed | escalate
|
|
3718
|
+
MERGER_STATUS_DESCRIPTION = "completed | escalate";
|
|
3719
3719
|
mergerOutputVariants = Type10.Union([
|
|
3720
3720
|
Type10.Object({ status: Type10.Unknown({ description: MERGER_STATUS_DESCRIPTION }), attemptId: Type10.String({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }), report: Type10.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), mergeCommitId: Type10.String({ description: "\u5B8C\u6210\u5408\u5E76 commit object ID" }) }, { additionalProperties: false }),
|
|
3721
3721
|
Type10.Object({ status: Type10.Unknown({ description: MERGER_STATUS_DESCRIPTION }), attemptId: Type10.String({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }), diagnosis: Type10.String({ description: "\u5408\u5E76\u65E0\u6CD5\u6216\u4E0D\u5E94\u7531\u672C\u5E2D\u5B8C\u6210\u7684\u539F\u56E0\uFF08\u542B\u65E0\u8FDB\u884C\u4E2D\u5408\u5E76\u3001\u65E0\u6D3B\u53EF\u5E72\u3001\u9700\u65B0\u7684\u4EA7\u54C1/\u6743\u529B\u51B3\u5B9A\uFF09" }), report: Type10.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }) }, { additionalProperties: false })
|
|
@@ -3736,7 +3736,7 @@ var init_merger_contracts = __esm({
|
|
|
3736
3736
|
});
|
|
3737
3737
|
|
|
3738
3738
|
// src/notary-contracts.ts
|
|
3739
|
-
var NOTARY_OUTPUT_TOOL_NAME, NOTARY_SOURCE_RUN_FLAG, NOTARY_TICKET_FLAG,
|
|
3739
|
+
var NOTARY_OUTPUT_TOOL_NAME, NOTARY_SOURCE_RUN_FLAG, NOTARY_TICKET_FLAG, notaryOutputSchema;
|
|
3740
3740
|
var init_notary_contracts = __esm({
|
|
3741
3741
|
"src/notary-contracts.ts"() {
|
|
3742
3742
|
"use strict";
|
|
@@ -3756,7 +3756,6 @@ var init_notary_contracts = __esm({
|
|
|
3756
3756
|
type: "string"
|
|
3757
3757
|
}
|
|
3758
3758
|
};
|
|
3759
|
-
NOTARY_FIXED_KICKOFF = "\u7B26\u5B9D\u90CE\u6848\u5377\u5DF2\u53D7\u7406\uFF1B\u6765\u6E90 run \u5B9A\u4F4D\u89C1\u4F1A\u8BDD\u6750\u6599\u3002";
|
|
3760
3759
|
notaryOutputSchema = reviewSubmissionSchema;
|
|
3761
3760
|
}
|
|
3762
3761
|
});
|
|
@@ -4253,21 +4252,24 @@ var init_packaged_role_registry = __esm({
|
|
|
4253
4252
|
"souls/notary.md",
|
|
4254
4253
|
"souls/audit-law.md",
|
|
4255
4254
|
"souls/ticket-law.md",
|
|
4256
|
-
"souls/gate-output-guide.md"
|
|
4255
|
+
"souls/gate-output-guide.md",
|
|
4256
|
+
"docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"
|
|
4257
4257
|
];
|
|
4258
4258
|
INSPECTOR_SESSION_MATERIALS = [
|
|
4259
4259
|
"CLAUDE.md",
|
|
4260
4260
|
"souls/inspector.md",
|
|
4261
4261
|
"souls/audit-law.md",
|
|
4262
4262
|
"souls/quality-law.md",
|
|
4263
|
-
"souls/gate-output-guide.md"
|
|
4263
|
+
"souls/gate-output-guide.md",
|
|
4264
|
+
"docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"
|
|
4264
4265
|
];
|
|
4265
4266
|
AUDITOR_PUBLIC_SESSION_MATERIALS = [
|
|
4266
4267
|
"CLAUDE.md",
|
|
4267
4268
|
"souls/judge-auditor.md",
|
|
4268
4269
|
"souls/doctor-auditor.md",
|
|
4269
4270
|
"souls/audit-law.md",
|
|
4270
|
-
"souls/quality-law.md"
|
|
4271
|
+
"souls/quality-law.md",
|
|
4272
|
+
"docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"
|
|
4271
4273
|
];
|
|
4272
4274
|
PUBLIC_ROLE_RECORDS = [
|
|
4273
4275
|
{
|
|
@@ -4295,7 +4297,8 @@ var init_packaged_role_registry = __esm({
|
|
|
4295
4297
|
"souls/judge.md",
|
|
4296
4298
|
"souls/audit-law.md",
|
|
4297
4299
|
"souls/quality-law.md",
|
|
4298
|
-
"souls/judge-output-guide.md"
|
|
4300
|
+
"souls/judge-output-guide.md",
|
|
4301
|
+
"docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"
|
|
4299
4302
|
]
|
|
4300
4303
|
},
|
|
4301
4304
|
{
|
|
@@ -4573,7 +4576,7 @@ var init_packaged_role_registry = __esm({
|
|
|
4573
4576
|
activationStage: "load-and-install",
|
|
4574
4577
|
receiptStatusKey: "status",
|
|
4575
4578
|
// #924: 公用《票面法》三席同装
|
|
4576
|
-
sessionMaterials: ["CLAUDE.md", "souls/countersign.md", "souls/ticket-law.md", "resources/countersign-ticket-issue.md"]
|
|
4579
|
+
sessionMaterials: ["CLAUDE.md", "souls/countersign.md", "souls/ticket-law.md", "resources/countersign-ticket-issue.md", "docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"]
|
|
4577
4580
|
},
|
|
4578
4581
|
{
|
|
4579
4582
|
role: "secretariat",
|
|
@@ -5109,7 +5112,7 @@ var init_gatekeeper_role = __esm({
|
|
|
5109
5112
|
GATEKEEPER_TOOL_SPEC = {
|
|
5110
5113
|
name: GATEKEEPER_OUTPUT_TOOL_NAME,
|
|
5111
5114
|
label: "\u95E8\u4E0B\u7701\u51B3\u8BAE",
|
|
5112
|
-
description: "\u95E8\u4E0B\u7701\u7EC8\u5C40\u51B3\u8BAE\
|
|
5115
|
+
description: "\u95E8\u4E0B\u7701\u7EC8\u5C40\u51B3\u8BAE\u3002status \u4E3A dispatch \u6216 pass\u3002",
|
|
5113
5116
|
promptSnippet: "\u95E8\u4E0B\u7701\u51B3\u8BAE",
|
|
5114
5117
|
parameters: gatekeeperOutputSchema
|
|
5115
5118
|
};
|
|
@@ -5125,10 +5128,10 @@ __export(session_assistant_usage_exports, {
|
|
|
5125
5128
|
});
|
|
5126
5129
|
import { join as join9 } from "node:path";
|
|
5127
5130
|
async function readAssistantUsageFromSessionFile(sessionFile) {
|
|
5128
|
-
const { readFile:
|
|
5131
|
+
const { readFile: readFile26 } = await import("node:fs/promises");
|
|
5129
5132
|
let text;
|
|
5130
5133
|
try {
|
|
5131
|
-
text = await
|
|
5134
|
+
text = await readFile26(sessionFile, "utf8");
|
|
5132
5135
|
} catch (error) {
|
|
5133
5136
|
if (error?.code === "ENOENT") return void 0;
|
|
5134
5137
|
throw error;
|
|
@@ -11798,13 +11801,16 @@ function admittedTransportPromptKind(admitted) {
|
|
|
11798
11801
|
function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
11799
11802
|
const kind = admittedTransportPromptKind(admitted);
|
|
11800
11803
|
if (kind === "fixed-kickoff") {
|
|
11801
|
-
|
|
11804
|
+
if (admitted.sourceRunPath === void 0 || admitted.sourceRunPath.trim() === "") {
|
|
11805
|
+
throw new Error("fixed-kickoff transport prompt is missing the source run pointer");
|
|
11806
|
+
}
|
|
11807
|
+
return appendEngineSessionMaterial([admitted.sourceRunPath], engineMaterial).join("\n");
|
|
11802
11808
|
}
|
|
11803
11809
|
if (kind === "baseline") {
|
|
11804
11810
|
if (admitted.baseRevision === void 0) {
|
|
11805
11811
|
throw new Error("baseline transport prompt is missing the bound revision");
|
|
11806
11812
|
}
|
|
11807
|
-
const lines2 = [
|
|
11813
|
+
const lines2 = [admitted.baseRevision];
|
|
11808
11814
|
if (!admitted.instructionEmpty) {
|
|
11809
11815
|
lines2.push("", admitted.instruction);
|
|
11810
11816
|
}
|
|
@@ -13385,10 +13391,10 @@ function pairGateRounds(volumes) {
|
|
|
13385
13391
|
return rounds.sort((a, b) => a.officerStartedAt.localeCompare(b.officerStartedAt)).map((round, index) => ({ ...round, roundIndex: index + 1 }));
|
|
13386
13392
|
}
|
|
13387
13393
|
async function resolveOfficerSessionFromPointerFile(pointerPath) {
|
|
13388
|
-
const { readFile:
|
|
13394
|
+
const { readFile: readFile26 } = await import("node:fs/promises");
|
|
13389
13395
|
let raw;
|
|
13390
13396
|
try {
|
|
13391
|
-
raw = JSON.parse(await
|
|
13397
|
+
raw = JSON.parse(await readFile26(pointerPath, "utf8"));
|
|
13392
13398
|
} catch (error) {
|
|
13393
13399
|
throw new Error(
|
|
13394
13400
|
`direct officer run pointer unreadable in ${pointerPath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -14143,9 +14149,10 @@ var init_auditor_soul = __esm({
|
|
|
14143
14149
|
"CLAUDE.md",
|
|
14144
14150
|
"souls/judge-auditor.md",
|
|
14145
14151
|
"souls/audit-law.md",
|
|
14146
|
-
"souls/quality-law.md"
|
|
14152
|
+
"souls/quality-law.md",
|
|
14153
|
+
"docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"
|
|
14147
14154
|
],
|
|
14148
|
-
doctor: ["CLAUDE.md", "souls/doctor-auditor.md"]
|
|
14155
|
+
doctor: ["CLAUDE.md", "souls/doctor-auditor.md", "docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"]
|
|
14149
14156
|
};
|
|
14150
14157
|
}
|
|
14151
14158
|
});
|
|
@@ -14674,7 +14681,7 @@ function resolveLifecycleInvocationPrincipal(entries, expected) {
|
|
|
14674
14681
|
}
|
|
14675
14682
|
return { invocationId: marker.invocationId, resume: true };
|
|
14676
14683
|
}
|
|
14677
|
-
var NAVIGATOR_INVOCATION_ENTRY, NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND, NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS, NAVIGATOR_INFRASTRUCTURE_FAILURE_EVIDENCE_KEYS, PACKAGED_ROLE_OUTPUT_TOOLS;
|
|
14684
|
+
var NAVIGATOR_INVOCATION_ENTRY, NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY, NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND, NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS, NAVIGATOR_INFRASTRUCTURE_FAILURE_EVIDENCE_KEYS, PACKAGED_ROLE_OUTPUT_TOOLS;
|
|
14678
14685
|
var init_navigator_invocation_identity = __esm({
|
|
14679
14686
|
"src/navigator-invocation-identity.ts"() {
|
|
14680
14687
|
"use strict";
|
|
@@ -14682,6 +14689,7 @@ var init_navigator_invocation_identity = __esm({
|
|
|
14682
14689
|
init_uuidv7();
|
|
14683
14690
|
init_work_subject_identity();
|
|
14684
14691
|
NAVIGATOR_INVOCATION_ENTRY = "ak-navigator-invocation";
|
|
14692
|
+
NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY = "ak-navigator-route-playbook-failure";
|
|
14685
14693
|
NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND = "role_infrastructure_failure";
|
|
14686
14694
|
NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS = [
|
|
14687
14695
|
"kind",
|
|
@@ -14775,17 +14783,25 @@ function createReceiptDeliveryPolicy() {
|
|
|
14775
14783
|
if (accepted) return "accepted";
|
|
14776
14784
|
return deliveryTurns < RECEIPT_DELIVERY_TURN_LIMIT ? "request-delivery" : "no-receipt";
|
|
14777
14785
|
},
|
|
14786
|
+
/** Current typed delivery facts. No prose. */
|
|
14787
|
+
deliveryState() {
|
|
14788
|
+
return {
|
|
14789
|
+
terminalToolCalled,
|
|
14790
|
+
rejectedReceipts: rejectedReceipts.map((item) => ({ ...item })),
|
|
14791
|
+
deliveryTurns,
|
|
14792
|
+
acceptedReceipt: false
|
|
14793
|
+
};
|
|
14794
|
+
},
|
|
14778
14795
|
facts(binding) {
|
|
14779
14796
|
return noReceiptLifecycleFacts({ terminalToolCalled, rejectedReceipts: [...rejectedReceipts], deliveryTurns, ...binding });
|
|
14780
14797
|
}
|
|
14781
14798
|
};
|
|
14782
14799
|
}
|
|
14783
|
-
var RECEIPT_DELIVERY_TURN_LIMIT,
|
|
14800
|
+
var RECEIPT_DELIVERY_TURN_LIMIT, NO_RECEIPT_LIFECYCLE_ENTRY_TYPE;
|
|
14784
14801
|
var init_receipt_delivery_policy = __esm({
|
|
14785
14802
|
"src/receipt-delivery-policy.ts"() {
|
|
14786
14803
|
"use strict";
|
|
14787
14804
|
RECEIPT_DELIVERY_TURN_LIMIT = 2;
|
|
14788
|
-
RECEIPT_DELIVERY_PROMPT = "\u672C\u4F1A\u8BDD\u5C1A\u65E0\u5DF2\u63A5\u53D7\u7684 typed \u56DE\u6267\u3002";
|
|
14789
14805
|
NO_RECEIPT_LIFECYCLE_ENTRY_TYPE = "ak-no-receipt-lifecycle";
|
|
14790
14806
|
}
|
|
14791
14807
|
});
|
|
@@ -14821,6 +14837,7 @@ __export(settlement_exports, {
|
|
|
14821
14837
|
projectThrownFailureLeaf: () => projectThrownFailureLeaf,
|
|
14822
14838
|
publishFailureArtifacts: () => publishFailureArtifacts,
|
|
14823
14839
|
publishSeatAcceptedArtifacts: () => publishSeatAcceptedArtifacts,
|
|
14840
|
+
publishedFailureErrorPath: () => publishedFailureErrorPath,
|
|
14824
14841
|
raceNavigatorGrace: () => raceNavigatorGrace,
|
|
14825
14842
|
readCollectorInfrastructureFailure: () => readCollectorInfrastructureFailure,
|
|
14826
14843
|
readEngineDetourInfrastructureFailure: () => readEngineDetourInfrastructureFailure,
|
|
@@ -14829,6 +14846,7 @@ __export(settlement_exports, {
|
|
|
14829
14846
|
resolveAuditedRunnerFailureResolution: () => resolveAuditedRunnerFailureResolution,
|
|
14830
14847
|
resolveAuditedRunnerKnownFailure: () => resolveAuditedRunnerKnownFailure,
|
|
14831
14848
|
resolveControlledFailureResumeObservation: () => resolveControlledFailureResumeObservation,
|
|
14849
|
+
rewritePublishedFailureErrorPath: () => rewritePublishedFailureErrorPath,
|
|
14832
14850
|
seatKnownFailureResolver: () => seatKnownFailureResolver,
|
|
14833
14851
|
settleFailureTerminalResult: () => settleFailureTerminalResult,
|
|
14834
14852
|
settleHostEndedNoReceipt: () => settleHostEndedNoReceipt,
|
|
@@ -14922,10 +14940,13 @@ function withSubmissions(terminal, submissions) {
|
|
|
14922
14940
|
}
|
|
14923
14941
|
async function attachRecordedSubmissions(admitted, terminal, scope) {
|
|
14924
14942
|
void scope;
|
|
14925
|
-
|
|
14943
|
+
const result = withSubmissions(
|
|
14926
14944
|
terminal,
|
|
14927
14945
|
await recordedSubmissionPayloads(admitted, void 0)
|
|
14928
14946
|
);
|
|
14947
|
+
const errorPath = privateFailureErrorPaths.get(terminal);
|
|
14948
|
+
if (errorPath !== void 0) privateFailureErrorPaths.set(result, errorPath);
|
|
14949
|
+
return result;
|
|
14929
14950
|
}
|
|
14930
14951
|
async function settleHostEndedNoReceipt(admitted, authority, scope) {
|
|
14931
14952
|
const facts = noReceiptLifecycleFacts({
|
|
@@ -14957,6 +14978,18 @@ async function settleHostEndedNoReceipt(admitted, authority, scope) {
|
|
|
14957
14978
|
function coordinatesFromAdmitted(authority, admitted) {
|
|
14958
14979
|
return authority.decode(admitted.principal);
|
|
14959
14980
|
}
|
|
14981
|
+
function publishedFailureErrorPath(terminal) {
|
|
14982
|
+
return privateFailureErrorPaths.get(terminal);
|
|
14983
|
+
}
|
|
14984
|
+
function rewritePublishedFailureErrorPath(terminal, oldRunDirectory, newRunDirectory) {
|
|
14985
|
+
const errorPath = privateFailureErrorPaths.get(terminal);
|
|
14986
|
+
if (errorPath !== void 0) {
|
|
14987
|
+
privateFailureErrorPaths.set(
|
|
14988
|
+
terminal,
|
|
14989
|
+
rewriteRunDirectoryPathValue(errorPath, oldRunDirectory, newRunDirectory)
|
|
14990
|
+
);
|
|
14991
|
+
}
|
|
14992
|
+
}
|
|
14960
14993
|
function conciseChildDiagnostic(stderr, fallback) {
|
|
14961
14994
|
const trimmed = stderr.trim();
|
|
14962
14995
|
return trimmed.length > 0 ? stderr : fallback;
|
|
@@ -15906,7 +15939,23 @@ async function withOptionalGateProjection(base, sessionDirectory, gateContext =
|
|
|
15906
15939
|
}
|
|
15907
15940
|
return attachEngineDetourToolUsage(next, sessionDirectory, gateContext);
|
|
15908
15941
|
}
|
|
15942
|
+
function routePlaybookFailureMessage(entries) {
|
|
15943
|
+
for (let i = entries.length - 1; i >= 0; i -= 1) {
|
|
15944
|
+
const entry = entries[i];
|
|
15945
|
+
if (entry?.type !== "custom" || entry.customType !== NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY) continue;
|
|
15946
|
+
const data = entry.data;
|
|
15947
|
+
if (!isRecord12(data) || typeof data.message !== "string" || data.message.trim() === "") return void 0;
|
|
15948
|
+
return data.message;
|
|
15949
|
+
}
|
|
15950
|
+
return void 0;
|
|
15951
|
+
}
|
|
15909
15952
|
function extractNavigatorFact(entries) {
|
|
15953
|
+
const fact = extractNavigatorAttendanceFact(entries);
|
|
15954
|
+
if (fact.advisoryDiagnostic !== void 0) return fact;
|
|
15955
|
+
const message = routePlaybookFailureMessage(entries);
|
|
15956
|
+
return message === void 0 ? fact : { ...fact, advisoryDiagnostic: message };
|
|
15957
|
+
}
|
|
15958
|
+
function extractNavigatorAttendanceFact(entries) {
|
|
15910
15959
|
const terminal = findLatestDurablePackagedRoleTerminal(entries);
|
|
15911
15960
|
if (terminal === void 0) {
|
|
15912
15961
|
return {
|
|
@@ -16462,7 +16511,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
|
|
|
16462
16511
|
error.publicationAttempts = issues;
|
|
16463
16512
|
throw error;
|
|
16464
16513
|
}
|
|
16465
|
-
async function publishFailureArtifacts(admitted, failure2, authority) {
|
|
16514
|
+
async function publishFailureArtifacts(admitted, failure2, authority, onErrorPublished) {
|
|
16466
16515
|
const { sessionDirectory, sessionFile } = coordinatesFromAdmitted(authority, admitted);
|
|
16467
16516
|
const { baseDir, attempt: baseAttempt } = await resolveFailureArtifactsBase(
|
|
16468
16517
|
admitted.runDirectory
|
|
@@ -16524,6 +16573,7 @@ async function publishFailureArtifacts(admitted, failure2, authority) {
|
|
|
16524
16573
|
errorPayloadBase,
|
|
16525
16574
|
priorIssues
|
|
16526
16575
|
);
|
|
16576
|
+
onErrorPublished?.(errorWrite.path);
|
|
16527
16577
|
const evidencePayload = {
|
|
16528
16578
|
runId: admitted.runId,
|
|
16529
16579
|
sessionDirectory,
|
|
@@ -16606,7 +16656,8 @@ async function settleFailureTerminalResult(admitted, failure2, authority, option
|
|
|
16606
16656
|
}
|
|
16607
16657
|
}
|
|
16608
16658
|
const navigator = await extractNavigatorFactFromAdmittedSession(sessionFile);
|
|
16609
|
-
const artifacts = await publishFailureArtifacts(admitted, failure2, authority);
|
|
16659
|
+
const artifacts = await publishFailureArtifacts(admitted, failure2, authority, options.onErrorPublished);
|
|
16660
|
+
const errorPath = artifacts.find((artifact) => artifact.kind === "error")?.path;
|
|
16610
16661
|
const decisiveFacts = {
|
|
16611
16662
|
...failure2.cause === void 0 ? {} : { cause: failure2.cause },
|
|
16612
16663
|
diagnostic: failure2.diagnostic
|
|
@@ -16628,7 +16679,7 @@ async function settleFailureTerminalResult(admitted, failure2, authority, option
|
|
|
16628
16679
|
diagnostic: failure2.diagnostic,
|
|
16629
16680
|
decisiveFacts
|
|
16630
16681
|
};
|
|
16631
|
-
|
|
16682
|
+
const terminal = await withOptionalGateProjection(
|
|
16632
16683
|
{
|
|
16633
16684
|
roleOutcome: roleOutcome2,
|
|
16634
16685
|
navigator,
|
|
@@ -16638,6 +16689,8 @@ async function settleFailureTerminalResult(admitted, failure2, authority, option
|
|
|
16638
16689
|
sessionDirectory,
|
|
16639
16690
|
detourGateContext(admitted, options)
|
|
16640
16691
|
);
|
|
16692
|
+
if (errorPath !== void 0) privateFailureErrorPaths.set(terminal, errorPath);
|
|
16693
|
+
return terminal;
|
|
16641
16694
|
}
|
|
16642
16695
|
const roleOutcome = {
|
|
16643
16696
|
kind: "failure",
|
|
@@ -16666,6 +16719,7 @@ function presentFailureTerminal(terminal, io) {
|
|
|
16666
16719
|
}
|
|
16667
16720
|
io.stdout(formatTerminalResult(terminal));
|
|
16668
16721
|
if (terminal.roleOutcome.kind === "failure") {
|
|
16722
|
+
if (io.omitFailureStderrDiagnostic) return;
|
|
16669
16723
|
io.stderr(formatFailureStderrDiagnostic({
|
|
16670
16724
|
...terminal.roleOutcome.cause === void 0 ? {} : { cause: terminal.roleOutcome.cause },
|
|
16671
16725
|
diagnostic: terminal.roleOutcome.diagnostic
|
|
@@ -16682,10 +16736,10 @@ function presentFailureTerminal(terminal, io) {
|
|
|
16682
16736
|
}
|
|
16683
16737
|
function defaultNavigatorGraceSleep() {
|
|
16684
16738
|
let timer;
|
|
16685
|
-
const sleep2 = ((ms) => new Promise((
|
|
16739
|
+
const sleep2 = ((ms) => new Promise((resolve22) => {
|
|
16686
16740
|
timer = setTimeout(() => {
|
|
16687
16741
|
timer = void 0;
|
|
16688
|
-
|
|
16742
|
+
resolve22();
|
|
16689
16743
|
}, ms);
|
|
16690
16744
|
}));
|
|
16691
16745
|
sleep2.cancel = () => {
|
|
@@ -16697,7 +16751,7 @@ function defaultNavigatorGraceSleep() {
|
|
|
16697
16751
|
return sleep2;
|
|
16698
16752
|
}
|
|
16699
16753
|
function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2 = defaultNavigatorGraceSleep()) {
|
|
16700
|
-
return new Promise((
|
|
16754
|
+
return new Promise((resolve22, reject) => {
|
|
16701
16755
|
let settled = false;
|
|
16702
16756
|
const finish = (action) => {
|
|
16703
16757
|
if (settled) return;
|
|
@@ -16706,15 +16760,15 @@ function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2
|
|
|
16706
16760
|
action();
|
|
16707
16761
|
};
|
|
16708
16762
|
void work.then(
|
|
16709
|
-
(value) => finish(() =>
|
|
16763
|
+
(value) => finish(() => resolve22({ status: "done", value })),
|
|
16710
16764
|
(error) => finish(() => reject(error))
|
|
16711
16765
|
);
|
|
16712
16766
|
void sleep2(graceMs).then(() => {
|
|
16713
|
-
finish(() =>
|
|
16767
|
+
finish(() => resolve22({ status: "timeout" }));
|
|
16714
16768
|
});
|
|
16715
16769
|
});
|
|
16716
16770
|
}
|
|
16717
|
-
var NAVIGATOR_POST_ROLE_GRACE_MS, COLLECTOR_INFRASTRUCTURE_TOOLS, COLLECTOR_INFRASTRUCTURE_FAILURE_SPEC, ENGINE_DETOUR_INFRASTRUCTURE_FAILURE_SPEC, RUNNER_FAILURE_POLICY, ATTEMPT_HISTORY_ENTRY_TYPE, EMPTY_ARTIFACT_FACE;
|
|
16771
|
+
var privateFailureErrorPaths, NAVIGATOR_POST_ROLE_GRACE_MS, COLLECTOR_INFRASTRUCTURE_TOOLS, COLLECTOR_INFRASTRUCTURE_FAILURE_SPEC, ENGINE_DETOUR_INFRASTRUCTURE_FAILURE_SPEC, RUNNER_FAILURE_POLICY, ATTEMPT_HISTORY_ENTRY_TYPE, EMPTY_ARTIFACT_FACE;
|
|
16718
16772
|
var init_settlement = __esm({
|
|
16719
16773
|
"src/public-cli/settlement.ts"() {
|
|
16720
16774
|
"use strict";
|
|
@@ -16741,9 +16795,11 @@ var init_settlement = __esm({
|
|
|
16741
16795
|
init_navigator_invocation_identity();
|
|
16742
16796
|
init_receipt_delivery_policy();
|
|
16743
16797
|
init_role_run_placement();
|
|
16798
|
+
init_role_run_relocation();
|
|
16744
16799
|
init_run_terminal_artifacts();
|
|
16745
16800
|
init_invocation();
|
|
16746
16801
|
init_terminal();
|
|
16802
|
+
privateFailureErrorPaths = /* @__PURE__ */ new WeakMap();
|
|
16747
16803
|
NAVIGATOR_POST_ROLE_GRACE_MS = 1e4;
|
|
16748
16804
|
COLLECTOR_INFRASTRUCTURE_TOOLS = /* @__PURE__ */ new Set([
|
|
16749
16805
|
COLLECTOR_OBSERVE_TOOL,
|
|
@@ -17386,6 +17442,11 @@ function projectRelocatedTurnIdentity(request, result, admitted, relocation) {
|
|
|
17386
17442
|
}
|
|
17387
17443
|
}
|
|
17388
17444
|
if (result.terminal !== void 0) {
|
|
17445
|
+
rewritePublishedFailureErrorPath(
|
|
17446
|
+
result.terminal,
|
|
17447
|
+
relocation.oldRunDirectory,
|
|
17448
|
+
relocation.newRunDirectory
|
|
17449
|
+
);
|
|
17389
17450
|
for (const artifact of result.terminal.artifacts) {
|
|
17390
17451
|
artifact.path = rewrite(artifact.path);
|
|
17391
17452
|
}
|
|
@@ -17499,18 +17560,23 @@ async function presentControlledFailure2(admitted, failureInput, adapters, autho
|
|
|
17499
17560
|
if (persistRunState && !failureInput.skipRunStateWrite) {
|
|
17500
17561
|
await persistReturnedRunState(admitted, authority);
|
|
17501
17562
|
}
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
|
|
17506
|
-
|
|
17507
|
-
|
|
17508
|
-
{
|
|
17509
|
-
|
|
17510
|
-
...failureInput.invocationScopeId === void 0 || failureInput.invocationScopeId.length === 0 ? {} : { invocationScopeId: failureInput.invocationScopeId }
|
|
17563
|
+
let publishedErrorPath;
|
|
17564
|
+
let terminal;
|
|
17565
|
+
try {
|
|
17566
|
+
const settled = await settleFailureTerminalResult(admitted, failure2, authority, {
|
|
17567
|
+
...resumable ? { resume: { command: renderResumeCommand(admitted.runId) } } : {},
|
|
17568
|
+
...failureInput.invocationScopeId === void 0 || failureInput.invocationScopeId.length === 0 ? {} : { invocationScopeId: failureInput.invocationScopeId },
|
|
17569
|
+
onErrorPublished: (path) => {
|
|
17570
|
+
publishedErrorPath = path;
|
|
17511
17571
|
}
|
|
17512
|
-
)
|
|
17513
|
-
|
|
17572
|
+
});
|
|
17573
|
+
terminal = await attachRecordedSubmissions(admitted, settled);
|
|
17574
|
+
} catch (error) {
|
|
17575
|
+
if (io.omitFailureStderrDiagnostic && publishedErrorPath !== void 0) {
|
|
17576
|
+
writeResumeFailurePointer(io, publishedErrorPath);
|
|
17577
|
+
}
|
|
17578
|
+
throw error;
|
|
17579
|
+
}
|
|
17514
17580
|
presentFailureTerminal(terminal, io);
|
|
17515
17581
|
return {
|
|
17516
17582
|
exitCode: exitCodeForTerminalOutcome(terminal.roleOutcome),
|
|
@@ -17604,7 +17670,10 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
17604
17670
|
if (relocation !== void 0) {
|
|
17605
17671
|
projectRelocatedTurnIdentity(request, result, admitted, relocation);
|
|
17606
17672
|
}
|
|
17607
|
-
|
|
17673
|
+
const afterDispatchRelocation = adapters.afterDispatch === void 0 ? void 0 : await adapters.afterDispatch(admitted, lease);
|
|
17674
|
+
if (afterDispatchRelocation !== void 0) {
|
|
17675
|
+
projectRelocatedTurnIdentity(request, result, admitted, afterDispatchRelocation);
|
|
17676
|
+
}
|
|
17608
17677
|
return result;
|
|
17609
17678
|
} catch (error) {
|
|
17610
17679
|
if (result.terminal !== void 0) {
|
|
@@ -18051,16 +18120,28 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
18051
18120
|
try {
|
|
18052
18121
|
loaded = await input.load(request);
|
|
18053
18122
|
} catch (error) {
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18123
|
+
const usageError = error instanceof CliUsageError;
|
|
18124
|
+
const recorded = await pointExistingRunFailure(
|
|
18125
|
+
input.env.home,
|
|
18126
|
+
request.runId,
|
|
18127
|
+
input.env.principalAuthority,
|
|
18128
|
+
input.io,
|
|
18129
|
+
error
|
|
18130
|
+
);
|
|
18131
|
+
if (!recorded) {
|
|
18132
|
+
if (usageError) {
|
|
18133
|
+
presentStructuralRejection(error, input.io);
|
|
18134
|
+
return { exitCode: 2 };
|
|
18135
|
+
}
|
|
18136
|
+
throw error;
|
|
18057
18137
|
}
|
|
18058
|
-
|
|
18138
|
+
return { exitCode: usageError ? 2 : 1 };
|
|
18059
18139
|
}
|
|
18060
18140
|
let adapters = input.adapters;
|
|
18061
18141
|
if (input.afterAdmittedLoad !== void 0) {
|
|
18062
18142
|
const prepared = await input.afterAdmittedLoad(loaded.admitted);
|
|
18063
18143
|
if (prepared.kind === "terminal") {
|
|
18144
|
+
showResumeErrorPointer(input.io, prepared.exitCode, prepared.terminal);
|
|
18064
18145
|
return {
|
|
18065
18146
|
exitCode: prepared.exitCode,
|
|
18066
18147
|
admitted: prepared.admitted,
|
|
@@ -18186,22 +18267,110 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
18186
18267
|
})
|
|
18187
18268
|
});
|
|
18188
18269
|
}
|
|
18189
|
-
|
|
18270
|
+
const resumed = await runPostAdmissionManualResume({
|
|
18190
18271
|
admitted: loaded.admitted,
|
|
18191
18272
|
env,
|
|
18192
|
-
io: input.io,
|
|
18273
|
+
io: { ...input.io, omitFailureStderrDiagnostic: true },
|
|
18193
18274
|
adapters,
|
|
18194
18275
|
...input.effectiveEngine === void 0 ? {} : { effectiveEngine: input.effectiveEngine },
|
|
18195
18276
|
buildRequestAfterLease
|
|
18196
18277
|
});
|
|
18278
|
+
showResumeErrorPointer(input.io, resumed.exitCode, resumed.terminal);
|
|
18279
|
+
return resumed;
|
|
18197
18280
|
} catch (error) {
|
|
18198
|
-
if (error instanceof
|
|
18199
|
-
|
|
18200
|
-
|
|
18281
|
+
if (error instanceof TurnDispatchedFailure) throw error;
|
|
18282
|
+
await presentResumeFailurePointer(
|
|
18283
|
+
input.io,
|
|
18284
|
+
error,
|
|
18285
|
+
(failure2) => writeResumeDiagnosticFile(
|
|
18286
|
+
loaded.admitted.runDirectory,
|
|
18287
|
+
loaded.admitted.runId,
|
|
18288
|
+
failure2,
|
|
18289
|
+
loaded.admitted.role
|
|
18290
|
+
)
|
|
18291
|
+
);
|
|
18292
|
+
return { exitCode: error instanceof CliUsageError ? 2 : 1 };
|
|
18293
|
+
}
|
|
18294
|
+
}
|
|
18295
|
+
async function pointExistingRunFailure(home, runId, authority, io, thrown) {
|
|
18296
|
+
let foundRunDirectory;
|
|
18297
|
+
try {
|
|
18298
|
+
foundRunDirectory = await findRunDirectoryById(home, runId);
|
|
18299
|
+
} catch {
|
|
18300
|
+
return false;
|
|
18301
|
+
}
|
|
18302
|
+
if (foundRunDirectory === void 0) return false;
|
|
18303
|
+
const runDirectory = foundRunDirectory;
|
|
18304
|
+
let record4;
|
|
18305
|
+
try {
|
|
18306
|
+
record4 = await readRoleRunState(runDirectory, authority);
|
|
18307
|
+
} catch {
|
|
18308
|
+
await presentResumeFailurePointer(
|
|
18309
|
+
io,
|
|
18310
|
+
thrown,
|
|
18311
|
+
(failure2) => writeResumeDiagnosticFile(runDirectory, runId, failure2)
|
|
18312
|
+
);
|
|
18313
|
+
return true;
|
|
18314
|
+
}
|
|
18315
|
+
if (record4 === void 0) return false;
|
|
18316
|
+
await presentResumeFailurePointer(
|
|
18317
|
+
io,
|
|
18318
|
+
thrown,
|
|
18319
|
+
(failure2) => writeResumeDiagnosticFile(runDirectory, runId, failure2, record4.role)
|
|
18320
|
+
);
|
|
18321
|
+
return true;
|
|
18322
|
+
}
|
|
18323
|
+
async function presentLocatedResumeFailure(home, runId, authority, io, thrown) {
|
|
18324
|
+
return await pointExistingRunFailure(home, runId, authority, io, thrown);
|
|
18325
|
+
}
|
|
18326
|
+
function writeResumeFailurePointer(io, errorPath) {
|
|
18327
|
+
io.stderr(formatCliDiagnostic(`\u7EED\u8DD1\u5931\u8D25\uFF0C\u5F53\u6B21\u9519\u8BEF\u8BB0\u5F55\uFF1A${errorPath}`));
|
|
18328
|
+
}
|
|
18329
|
+
function showResumeErrorPointer(io, exitCode, terminal) {
|
|
18330
|
+
if (exitCode === 0 || terminal === void 0) return;
|
|
18331
|
+
const publishedError = terminal.artifacts.find((artifact) => artifact.kind === "error")?.path ?? publishedFailureErrorPath(terminal);
|
|
18332
|
+
if (publishedError !== void 0) writeResumeFailurePointer(io, publishedError);
|
|
18333
|
+
}
|
|
18334
|
+
async function presentResumeFailurePointer(io, thrown, publish) {
|
|
18335
|
+
const failure2 = classifyPostAdmissionFailure({
|
|
18336
|
+
timedOut: false,
|
|
18337
|
+
code: null,
|
|
18338
|
+
stderr: "",
|
|
18339
|
+
thrown
|
|
18340
|
+
});
|
|
18341
|
+
try {
|
|
18342
|
+
writeResumeFailurePointer(io, await publish(failure2));
|
|
18343
|
+
} catch (publishError) {
|
|
18344
|
+
const cause = {
|
|
18345
|
+
publishError: formatErrorCauseDetail(publishError)
|
|
18346
|
+
};
|
|
18347
|
+
if (thrown instanceof Error && thrown.cause !== void 0) {
|
|
18348
|
+
cause.thrownCause = formatErrorCauseDetail(thrown.cause);
|
|
18201
18349
|
}
|
|
18202
|
-
|
|
18350
|
+
presentStructuralRejection({
|
|
18351
|
+
message: thrown instanceof Error ? thrown.message : String(thrown),
|
|
18352
|
+
cause
|
|
18353
|
+
}, io);
|
|
18203
18354
|
}
|
|
18204
18355
|
}
|
|
18356
|
+
async function writeResumeDiagnosticFile(runDirectory, runId, failure2, role) {
|
|
18357
|
+
const dir = await ensureRealArtifactsDirectory(runDirectory);
|
|
18358
|
+
const path = join33(dir, `resume-diagnostic-${randomUUID6()}.json`);
|
|
18359
|
+
await writeFile9(
|
|
18360
|
+
path,
|
|
18361
|
+
`${JSON.stringify({
|
|
18362
|
+
runId,
|
|
18363
|
+
...role === void 0 ? {} : { role },
|
|
18364
|
+
diagnostic: failure2.diagnostic,
|
|
18365
|
+
...failure2.cause === void 0 ? {} : { cause: failure2.cause },
|
|
18366
|
+
...failure2.identity === void 0 ? {} : { identity: failure2.identity },
|
|
18367
|
+
...failure2.details === void 0 ? {} : { details: failure2.details }
|
|
18368
|
+
}, null, 2)}
|
|
18369
|
+
`,
|
|
18370
|
+
{ encoding: "utf8", flag: "wx" }
|
|
18371
|
+
);
|
|
18372
|
+
return path;
|
|
18373
|
+
}
|
|
18205
18374
|
async function runPostAdmissionOneShot(input) {
|
|
18206
18375
|
return await runPostAdmissionResumable({
|
|
18207
18376
|
admitted: input.admitted,
|
|
@@ -18753,7 +18922,7 @@ async function runCountersignCourtDiaristStation(admitted, env, io, afterTicketN
|
|
|
18753
18922
|
for (const ticketNumber of refreshTickets.slice(completedIndex + 1)) {
|
|
18754
18923
|
const outcome = await invokeCourtDiarist(
|
|
18755
18924
|
{
|
|
18756
|
-
instruction:
|
|
18925
|
+
instruction: admitted.instruction,
|
|
18757
18926
|
projectRoot: admitted.projectRoot,
|
|
18758
18927
|
failureLabel: `ticket #${ticketNumber}`,
|
|
18759
18928
|
correlationId: admitted.runId,
|
|
@@ -18832,11 +19001,11 @@ function isBoardTicketSeat(seat) {
|
|
|
18832
19001
|
}
|
|
18833
19002
|
async function bindAndRelocateDiarist(admitted, authority, lease) {
|
|
18834
19003
|
const boardTicket = await readBoardTicketNumber(admitted.runDirectory);
|
|
18835
|
-
if (boardTicket === void 0) return;
|
|
19004
|
+
if (boardTicket === void 0) return void 0;
|
|
18836
19005
|
if (admitted.ticketNumber === void 0) {
|
|
18837
19006
|
await bindAdmittedTicketNumber(admitted, boardTicket);
|
|
18838
19007
|
}
|
|
18839
|
-
await relocateAdmittedRunToTicket(admitted, authority, lease);
|
|
19008
|
+
return await relocateAdmittedRunToTicket(admitted, authority, lease);
|
|
18840
19009
|
}
|
|
18841
19010
|
function seatAdapters(admitted, env) {
|
|
18842
19011
|
const record4 = roleRecord(admitted.role);
|
|
@@ -18855,8 +19024,8 @@ function seatAdapters(admitted, env) {
|
|
|
18855
19024
|
await bindAndRelocateDiarist(seat, env.principalAuthority, lease);
|
|
18856
19025
|
},
|
|
18857
19026
|
afterDispatch: async (seat, lease) => {
|
|
18858
|
-
if (!isBoardTicketSeat(seat)) return;
|
|
18859
|
-
await bindAndRelocateDiarist(seat, env.principalAuthority, lease);
|
|
19027
|
+
if (!isBoardTicketSeat(seat)) return void 0;
|
|
19028
|
+
return await bindAndRelocateDiarist(seat, env.principalAuthority, lease);
|
|
18860
19029
|
}
|
|
18861
19030
|
} : {}
|
|
18862
19031
|
};
|
|
@@ -19418,7 +19587,9 @@ async function continueParentAfterChild(parentRunId, child, env, io) {
|
|
|
19418
19587
|
return { exitCode: 0, admitted, terminal: refresh.terminal };
|
|
19419
19588
|
}
|
|
19420
19589
|
}
|
|
19421
|
-
|
|
19590
|
+
const result = await dispatchAdmitted(admitted, env, { ...io, omitFailureStderrDiagnostic: true });
|
|
19591
|
+
showResumeErrorPointer(io, result.exitCode, result.terminal);
|
|
19592
|
+
return result;
|
|
19422
19593
|
}
|
|
19423
19594
|
var init_instruction_seat_run = __esm({
|
|
19424
19595
|
"src/public-cli/instruction-seat-run.ts"() {
|
|
@@ -19500,8 +19671,8 @@ var init_atomic_write = __esm({
|
|
|
19500
19671
|
import { open as open3, readFile as readFile18, unlink as unlink5 } from "node:fs/promises";
|
|
19501
19672
|
import { dirname as dirname19, join as join36 } from "node:path";
|
|
19502
19673
|
function sleep(ms) {
|
|
19503
|
-
return new Promise((
|
|
19504
|
-
setTimeout(
|
|
19674
|
+
return new Promise((resolve22) => {
|
|
19675
|
+
setTimeout(resolve22, ms);
|
|
19505
19676
|
});
|
|
19506
19677
|
}
|
|
19507
19678
|
async function withAnalystLibraryIndexLock(ledgerHome, fn) {
|
|
@@ -22285,6 +22456,7 @@ function commandNeedsProcessCancel(argv) {
|
|
|
22285
22456
|
}
|
|
22286
22457
|
async function runAkRole(argv, env) {
|
|
22287
22458
|
const io = env.io ?? defaultIo();
|
|
22459
|
+
let resumeFailureContext;
|
|
22288
22460
|
try {
|
|
22289
22461
|
env = {
|
|
22290
22462
|
...env,
|
|
@@ -22357,11 +22529,16 @@ async function runAkRole(argv, env) {
|
|
|
22357
22529
|
env = { ...env, freshSummons: true };
|
|
22358
22530
|
}
|
|
22359
22531
|
if (parsed.command === "resume") {
|
|
22532
|
+
const resumeRequest = parseResumeRequest(parsed.args);
|
|
22533
|
+
resumeFailureContext = {
|
|
22534
|
+
home,
|
|
22535
|
+
runId: resumeRequest.runId,
|
|
22536
|
+
authority: env.principalAuthority ?? piDurablePrincipalAuthority
|
|
22537
|
+
};
|
|
22360
22538
|
const agentDir = resolveAgentDir(env, home);
|
|
22361
22539
|
const cwd = env.cwd ?? process.cwd();
|
|
22362
22540
|
const config = await loadAndValidateConfig(home, env.packageRoot);
|
|
22363
22541
|
const credentials = env.credentials ?? await loadCredentialProviders(agentDir);
|
|
22364
|
-
const resumeRequest = parseResumeRequest(parsed.args);
|
|
22365
22542
|
const resumeRole = await peekRoleRunRole(home, resumeRequest.runId);
|
|
22366
22543
|
const seatRole = resumeRole ?? "judge";
|
|
22367
22544
|
const seat = resolveEffectiveSeat(
|
|
@@ -22386,6 +22563,11 @@ async function runAkRole(argv, env) {
|
|
|
22386
22563
|
let current = result;
|
|
22387
22564
|
while (current.exitCode === 0 && current.admitted?.correlationId !== void 0 && current.terminal?.roleOutcome.kind === "accepted" && !courtDiaristEscalated(current.terminal.roleOutcome)) {
|
|
22388
22565
|
const parentRunId = current.admitted.correlationId;
|
|
22566
|
+
resumeFailureContext = {
|
|
22567
|
+
home,
|
|
22568
|
+
runId: parentRunId,
|
|
22569
|
+
authority: env.principalAuthority ?? piDurablePrincipalAuthority
|
|
22570
|
+
};
|
|
22389
22571
|
const parentRole = await peekRoleRunRole(home, parentRunId);
|
|
22390
22572
|
if (parentRole === void 0) break;
|
|
22391
22573
|
const parentSeat = resolveEffectiveSeat(config, parentRole, credentials, invocationFromParsed(parsed));
|
|
@@ -22428,6 +22610,18 @@ async function runAkRole(argv, env) {
|
|
|
22428
22610
|
}
|
|
22429
22611
|
throw new CliUsageError(`unknown command: ${parsed.command}`);
|
|
22430
22612
|
} catch (error) {
|
|
22613
|
+
if (resumeFailureContext !== void 0 && !(error instanceof TurnDispatchedFailure) && await presentLocatedResumeFailure(
|
|
22614
|
+
resumeFailureContext.home,
|
|
22615
|
+
resumeFailureContext.runId,
|
|
22616
|
+
resumeFailureContext.authority,
|
|
22617
|
+
io,
|
|
22618
|
+
error
|
|
22619
|
+
)) {
|
|
22620
|
+
return {
|
|
22621
|
+
exitCode: error instanceof CliUsageError ? 2 : 1,
|
|
22622
|
+
...error instanceof HostSelectionError ? { hostFailure: error.failure } : {}
|
|
22623
|
+
};
|
|
22624
|
+
}
|
|
22431
22625
|
if (error instanceof HostSelectionError) {
|
|
22432
22626
|
io.stderr(formatCliDiagnostic(formatHostSelectionFailure(error.failure)));
|
|
22433
22627
|
return { exitCode: 1, hostFailure: error.failure };
|
|
@@ -22465,10 +22659,12 @@ var init_cli = __esm({
|
|
|
22465
22659
|
init_registry();
|
|
22466
22660
|
init_cli_errors();
|
|
22467
22661
|
init_machine_method_skills();
|
|
22662
|
+
init_post_admission();
|
|
22468
22663
|
init_role_turn_host();
|
|
22469
22664
|
init_role_turn_host_resolution();
|
|
22470
22665
|
init_invocation();
|
|
22471
22666
|
init_option_definitions();
|
|
22667
|
+
init_auto_resume();
|
|
22472
22668
|
init_instruction_seat_run();
|
|
22473
22669
|
init_countersign_run();
|
|
22474
22670
|
init_analyst_run();
|
|
@@ -23015,7 +23211,7 @@ init_engine_detour();
|
|
|
23015
23211
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
23016
23212
|
import { appendFile as appendFile3, mkdir as mkdir5, writeFile as writeFile11 } from "node:fs/promises";
|
|
23017
23213
|
import { createServer } from "node:net";
|
|
23018
|
-
import { dirname as
|
|
23214
|
+
import { dirname as dirname23, join as join45 } from "node:path";
|
|
23019
23215
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
23020
23216
|
|
|
23021
23217
|
// src/submission-gate.ts
|
|
@@ -23130,7 +23326,7 @@ init_submission_ledger();
|
|
|
23130
23326
|
init_collector_ledger();
|
|
23131
23327
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
23132
23328
|
import { readFileSync as readFileSync6, writeSync as writeSync3 } from "node:fs";
|
|
23133
|
-
import { join as
|
|
23329
|
+
import { join as join44 } from "node:path";
|
|
23134
23330
|
import { Value as Value5 } from "typebox/value";
|
|
23135
23331
|
|
|
23136
23332
|
// src/activation-trace.ts
|
|
@@ -23276,6 +23472,9 @@ function durableSessionPointer(sessionManager) {
|
|
|
23276
23472
|
// src/activation-ledger.ts
|
|
23277
23473
|
init_activation_ledger_topology();
|
|
23278
23474
|
|
|
23475
|
+
// src/role-runtime.ts
|
|
23476
|
+
init_session_opening_materials();
|
|
23477
|
+
|
|
23279
23478
|
// src/stderr-jsonl.ts
|
|
23280
23479
|
import { writeSync } from "node:fs";
|
|
23281
23480
|
var STDERR_JSONL_WRITE_RETRY_LIMIT = 100;
|
|
@@ -23609,10 +23808,10 @@ var collectorOpenWaitWindowArgsSchema = Type15.Object({
|
|
|
23609
23808
|
}, { additionalProperties: true });
|
|
23610
23809
|
var collectorBindTargetArgsSchema = Type15.Object({
|
|
23611
23810
|
prNumber: Type15.Optional(Type15.Unknown({
|
|
23612
|
-
description: "\
|
|
23811
|
+
description: "\u672C\u4ED3 PR \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002"
|
|
23613
23812
|
})),
|
|
23614
23813
|
issueNumber: Type15.Optional(Type15.Unknown({
|
|
23615
|
-
description: "\
|
|
23814
|
+
description: "\u672C\u4ED3 issue \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002"
|
|
23616
23815
|
}))
|
|
23617
23816
|
}, { additionalProperties: true });
|
|
23618
23817
|
var collectorFindingItemDeclaration = (() => {
|
|
@@ -23630,7 +23829,7 @@ var collectorFindingItemDeclaration = (() => {
|
|
|
23630
23829
|
},
|
|
23631
23830
|
{
|
|
23632
23831
|
additionalProperties: true,
|
|
23633
|
-
description: "\u5355\u6761 finding \u6307\u9488\uFF1AevidenceId
|
|
23832
|
+
description: "\u5355\u6761 finding \u6307\u9488\uFF1AevidenceId\uFF0C\u4EE5\u53CA\u53EF\u9009 category\u3001summary\u3002"
|
|
23634
23833
|
}
|
|
23635
23834
|
);
|
|
23636
23835
|
item.required = [];
|
|
@@ -23641,11 +23840,11 @@ var collectorOutputBaseSchema = openToolObject(
|
|
|
23641
23840
|
// No root type:array — host must not shape-reject non-array findings (#676 C).
|
|
23642
23841
|
// Nested item declarations ride `items` for registration preservation (ADR 0057).
|
|
23643
23842
|
findings: Type15.Unsafe({
|
|
23644
|
-
description: "\u672C\u6B21\u6536\u96C6\u5230\u7684\u9010\u6761 findings\
|
|
23843
|
+
description: "\u672C\u6B21\u6536\u96C6\u5230\u7684\u9010\u6761 findings \u6307\u9488\u3002",
|
|
23645
23844
|
items: collectorFindingItemDeclaration
|
|
23646
23845
|
}),
|
|
23647
23846
|
unfinishedReasons: Type15.Unknown({
|
|
23648
|
-
description: "\u672A\u5B8C\u6210\u539F\u56E0\
|
|
23847
|
+
description: "\u672A\u5B8C\u6210\u539F\u56E0\u3002"
|
|
23649
23848
|
})
|
|
23650
23849
|
})
|
|
23651
23850
|
);
|
|
@@ -23960,7 +24159,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
23960
24159
|
pi.registerTool({
|
|
23961
24160
|
name: COLLECTOR_BIND_TARGET_TOOL,
|
|
23962
24161
|
label: "\u901A\u8FDB\u53F8\u8BA4\u7968\u7ED1\u5B9A",
|
|
23963
|
-
description: "\
|
|
24162
|
+
description: "\u7ED1\u5B9A\u672C\u4ED3\u552F\u4E00 PR \u76EE\u6807\u3002",
|
|
23964
24163
|
promptSnippet: "\u7ED1\u5B9A\u89D2\u8272\u5224\u5B9A\u7684 issue/PR \u76EE\u6807",
|
|
23965
24164
|
parameters: bindSchema,
|
|
23966
24165
|
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
@@ -24037,7 +24236,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24037
24236
|
pi.registerTool({
|
|
24038
24237
|
name: COLLECTOR_OBSERVE_TOOL,
|
|
24039
24238
|
label: "\u901A\u8FDB\u53F8\u89C2\u5BDF",
|
|
24040
|
-
description: "\u6293\u53D6\u914D\u7F6E\u76EE\u6807\u7684
|
|
24239
|
+
description: "\u6293\u53D6\u914D\u7F6E\u76EE\u6807\u7684 GitHub PR \u8BC1\u636E\u3002",
|
|
24041
24240
|
promptSnippet: "\u6293\u53D6\u914D\u7F6E\u76EE\u6807 PR \u8BC1\u636E",
|
|
24042
24241
|
parameters: observeSchema,
|
|
24043
24242
|
async execute(toolCallId, _params, signal, _onUpdate, ctx) {
|
|
@@ -24067,7 +24266,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24067
24266
|
pi.registerTool({
|
|
24068
24267
|
name: COLLECTOR_READ_TOOL,
|
|
24069
24268
|
label: "\u901A\u8FDB\u53F8\u5F00\u5377",
|
|
24070
|
-
description: "\u6309 evidenceId \u5F00\u5377\u8BFB\u53D6\u4E00\u6761\u5DF2\u89C2\u6D4B\u6750\u6599\u7684\u5168\u91CF\u6B63\u6587\u4E0E\u6307\u9488\
|
|
24269
|
+
description: "\u6309 evidenceId \u5F00\u5377\u8BFB\u53D6\u4E00\u6761\u5DF2\u89C2\u6D4B\u6750\u6599\u7684\u5168\u91CF\u6B63\u6587\u4E0E\u6307\u9488\u3002",
|
|
24071
24270
|
promptSnippet: "\u6309\u6307\u9488\u5F00\u5377\u8BFB\u6750\u6599",
|
|
24072
24271
|
parameters: readSchema,
|
|
24073
24272
|
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
@@ -24097,7 +24296,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24097
24296
|
pi.registerTool({
|
|
24098
24297
|
name: COLLECTOR_REQUEST_TOOL,
|
|
24099
24298
|
label: "\u901A\u8FDB\u53F8\u8BF7\u6C42",
|
|
24100
|
-
description: "\
|
|
24299
|
+
description: "\u53D1\u4E00\u6B21\u8BF7\u6C42\u3002",
|
|
24101
24300
|
promptSnippet: "\u53D1\u4E00\u6B21\u8BC4\u5BA1\u8BF7\u6C42",
|
|
24102
24301
|
parameters: requestSchema,
|
|
24103
24302
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
@@ -24216,7 +24415,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24216
24415
|
pi.registerTool({
|
|
24217
24416
|
name: COLLECTOR_WAIT_TOOL,
|
|
24218
24417
|
label: "\u901A\u8FDB\u53F8\u7B49\u5F85",
|
|
24219
|
-
description: "\
|
|
24418
|
+
description: "\u7B49\u5F85\u3002\u5B9E\u9645\u7761\u7720\u4E0D\u8D85\u8FC7\u5269\u4F59\u7B49\u5F85\u7A97\u3002",
|
|
24220
24419
|
promptSnippet: "\u7B49\u5F85\u7A97\u5185\u7B49\u5F85",
|
|
24221
24420
|
parameters: waitSchema,
|
|
24222
24421
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
@@ -24246,7 +24445,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24246
24445
|
pi.registerTool({
|
|
24247
24446
|
name: COLLECTOR_OUTPUT_TOOL,
|
|
24248
24447
|
label: "\u901A\u8FDB\u53F8\u8F93\u51FA",
|
|
24249
|
-
description: "\
|
|
24448
|
+
description: "\u63D0\u4EA4\u901A\u8FDB\u53F8\u56DE\u6267\u3002",
|
|
24250
24449
|
promptSnippet: "\u63D0\u4EA4\u901A\u8FDB\u53F8\u56DE\u6267",
|
|
24251
24450
|
parameters: outputSchema,
|
|
24252
24451
|
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
@@ -24511,7 +24710,7 @@ var gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
|
|
|
24511
24710
|
openToolObject(
|
|
24512
24711
|
Type16.Object({
|
|
24513
24712
|
status: Type16.Unknown({
|
|
24514
|
-
description: "completed
|
|
24713
|
+
description: "completed"
|
|
24515
24714
|
}),
|
|
24516
24715
|
findings: Type16.Array(
|
|
24517
24716
|
Type16.Object(
|
|
@@ -24562,7 +24761,7 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
|
24562
24761
|
openToolObject(
|
|
24563
24762
|
Type17.Object({
|
|
24564
24763
|
status: Type17.Unknown({
|
|
24565
|
-
description: "completed | escalate
|
|
24764
|
+
description: "completed | escalate"
|
|
24566
24765
|
}),
|
|
24567
24766
|
ticketNumber: Type17.Optional(
|
|
24568
24767
|
Type17.Unknown({
|
|
@@ -24648,7 +24847,7 @@ var secretariatVerdictSchema = withTerminatingOutputDeclarations(
|
|
|
24648
24847
|
Type18.Object(
|
|
24649
24848
|
{
|
|
24650
24849
|
secretariatStatus: Type18.Unknown({
|
|
24651
|
-
description: "converged | escalate
|
|
24850
|
+
description: "converged | escalate"
|
|
24652
24851
|
}),
|
|
24653
24852
|
ticketNumber: Type18.Optional(
|
|
24654
24853
|
Type18.Number({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
|
|
@@ -24672,7 +24871,7 @@ secretariatVerdictSchema.required = [];
|
|
|
24672
24871
|
var SECRETARIAT_OUTPUT_TOOL_SPEC = {
|
|
24673
24872
|
name: SECRETARIAT_OUTPUT_TOOL_NAME,
|
|
24674
24873
|
label: "\u4E2D\u4E66\u7701\u8F93\u51FA",
|
|
24675
|
-
description: "\u4E2D\u4E66\u7701\u7EC8\u5C40\u56DE\u6267\
|
|
24874
|
+
description: "\u4E2D\u4E66\u7701\u7EC8\u5C40\u56DE\u6267\u3002",
|
|
24676
24875
|
promptSnippet: "\u4E2D\u4E66\u7701\u7EC8\u5C40\u56DE\u6267",
|
|
24677
24876
|
parameters: secretariatVerdictSchema
|
|
24678
24877
|
};
|
|
@@ -24728,13 +24927,14 @@ import { createHash as createHash9 } from "node:crypto";
|
|
|
24728
24927
|
init_navigator_invocation_identity();
|
|
24729
24928
|
init_packaged_role_registry();
|
|
24730
24929
|
init_activation_ledger_topology();
|
|
24731
|
-
import { resolve as
|
|
24930
|
+
import { resolve as resolve18 } from "node:path";
|
|
24732
24931
|
import "@earendil-works/pi-coding-agent";
|
|
24733
24932
|
import { Type as Type20 } from "typebox";
|
|
24734
24933
|
|
|
24735
24934
|
// src/navigator-public-session.ts
|
|
24736
24935
|
init_sitian_facade();
|
|
24737
|
-
import {
|
|
24936
|
+
import { existsSync as existsSync13 } from "node:fs";
|
|
24937
|
+
import { basename as basename10 } from "node:path";
|
|
24738
24938
|
|
|
24739
24939
|
// src/navigator-session-contracts.ts
|
|
24740
24940
|
import { Type as Type19 } from "typebox";
|
|
@@ -24924,6 +25124,113 @@ async function resolveNavigatorSeatSelection(context) {
|
|
|
24924
25124
|
init_host_contracts();
|
|
24925
25125
|
init_cli_errors();
|
|
24926
25126
|
init_packaged_role_registry();
|
|
25127
|
+
|
|
25128
|
+
// src/navigator-work-base.ts
|
|
25129
|
+
init_atomic_write();
|
|
25130
|
+
import { existsSync as existsSync12, realpathSync as realpathSync4 } from "node:fs";
|
|
25131
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
25132
|
+
import { basename as basename9, dirname as dirname21, join as join42, resolve as resolve17 } from "node:path";
|
|
25133
|
+
var NAVIGATOR_WORK_CONTEXT_BASENAME = "work-context.json";
|
|
25134
|
+
function navigatorWorkContextFile(sessionDir) {
|
|
25135
|
+
return join42(sessionDir, NAVIGATOR_WORK_CONTEXT_BASENAME);
|
|
25136
|
+
}
|
|
25137
|
+
function isNavigatorWorkContextFile(path) {
|
|
25138
|
+
const resolved = resolve17(path);
|
|
25139
|
+
if (basename9(resolved) !== NAVIGATOR_WORK_CONTEXT_BASENAME) return false;
|
|
25140
|
+
const nest = dirname21(resolved);
|
|
25141
|
+
if (!/^[0-9a-f]{32}$/.test(basename9(nest))) return false;
|
|
25142
|
+
return basename9(dirname21(nest)) === "navigator";
|
|
25143
|
+
}
|
|
25144
|
+
function canonicalNavigatorWorkContextFile(path) {
|
|
25145
|
+
if (!isNavigatorWorkContextFile(path)) return void 0;
|
|
25146
|
+
try {
|
|
25147
|
+
const real = realpathSync4(path);
|
|
25148
|
+
return isNavigatorWorkContextFile(real) ? real : void 0;
|
|
25149
|
+
} catch {
|
|
25150
|
+
return void 0;
|
|
25151
|
+
}
|
|
25152
|
+
}
|
|
25153
|
+
async function persistNavigatorWorkBase(sessionDir, body) {
|
|
25154
|
+
if (sessionDir.trim() === "" || !existsSync12(sessionDir)) return void 0;
|
|
25155
|
+
if (body.authority.trim() === "") return void 0;
|
|
25156
|
+
const path = navigatorWorkContextFile(sessionDir);
|
|
25157
|
+
const next = `${JSON.stringify({ subject: body.subject, authority: body.authority })}
|
|
25158
|
+
`;
|
|
25159
|
+
try {
|
|
25160
|
+
const current = await readFile23(path, "utf8");
|
|
25161
|
+
if (current === next) return path;
|
|
25162
|
+
} catch (error) {
|
|
25163
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
|
|
25164
|
+
throw error;
|
|
25165
|
+
}
|
|
25166
|
+
}
|
|
25167
|
+
await writeFileAtomically(path, next);
|
|
25168
|
+
return path;
|
|
25169
|
+
}
|
|
25170
|
+
async function readNavigatorWorkBase(path) {
|
|
25171
|
+
const canonical = canonicalNavigatorWorkContextFile(path);
|
|
25172
|
+
if (canonical === void 0) return void 0;
|
|
25173
|
+
let text;
|
|
25174
|
+
try {
|
|
25175
|
+
text = await readFile23(canonical, "utf8");
|
|
25176
|
+
} catch (error) {
|
|
25177
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
25178
|
+
return void 0;
|
|
25179
|
+
}
|
|
25180
|
+
throw error;
|
|
25181
|
+
}
|
|
25182
|
+
let parsed;
|
|
25183
|
+
try {
|
|
25184
|
+
parsed = JSON.parse(text);
|
|
25185
|
+
} catch {
|
|
25186
|
+
return void 0;
|
|
25187
|
+
}
|
|
25188
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
25189
|
+
const record4 = parsed;
|
|
25190
|
+
if (typeof record4.subject !== "string" || typeof record4.authority !== "string") return void 0;
|
|
25191
|
+
if (record4.authority.trim() === "") return void 0;
|
|
25192
|
+
return { subject: record4.subject, authority: record4.authority };
|
|
25193
|
+
}
|
|
25194
|
+
function jsonObjectFromPrompt(prompt) {
|
|
25195
|
+
const head = prompt.trimStart().split("\n\n", 1)[0] ?? "";
|
|
25196
|
+
if (!head.startsWith("{")) return void 0;
|
|
25197
|
+
try {
|
|
25198
|
+
const parsed = JSON.parse(head);
|
|
25199
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
25200
|
+
return parsed;
|
|
25201
|
+
} catch {
|
|
25202
|
+
return void 0;
|
|
25203
|
+
}
|
|
25204
|
+
}
|
|
25205
|
+
function workContextPathFromPrompt(prompt) {
|
|
25206
|
+
const record4 = jsonObjectFromPrompt(prompt);
|
|
25207
|
+
const path = record4?.workContextPath;
|
|
25208
|
+
if (typeof path !== "string" || path.trim() === "") return void 0;
|
|
25209
|
+
return isNavigatorWorkContextFile(path) ? path : void 0;
|
|
25210
|
+
}
|
|
25211
|
+
function attachWorkContextPointer(text, workContextPath) {
|
|
25212
|
+
const record4 = jsonObjectFromPrompt(text);
|
|
25213
|
+
if (record4 === void 0) return text;
|
|
25214
|
+
if (typeof record4.workContextPath === "string" && record4.workContextPath.trim() !== "") return text;
|
|
25215
|
+
const head = text.trimStart().split("\n\n", 1)[0] ?? "";
|
|
25216
|
+
const rest = text.trimStart().slice(head.length);
|
|
25217
|
+
return `${JSON.stringify({ ...record4, workContextPath })}${rest}`;
|
|
25218
|
+
}
|
|
25219
|
+
async function loadNavigatorWorkBaseSuffix(prompt) {
|
|
25220
|
+
const path = workContextPathFromPrompt(prompt);
|
|
25221
|
+
if (path === void 0) return void 0;
|
|
25222
|
+
const body = await readNavigatorWorkBase(path);
|
|
25223
|
+
if (body === void 0) return void 0;
|
|
25224
|
+
return `<work_subject>
|
|
25225
|
+
${body.subject}
|
|
25226
|
+
</work_subject>
|
|
25227
|
+
|
|
25228
|
+
<controlling_authority>
|
|
25229
|
+
${body.authority}
|
|
25230
|
+
</controlling_authority>`;
|
|
25231
|
+
}
|
|
25232
|
+
|
|
25233
|
+
// src/navigator-public-session.ts
|
|
24927
25234
|
async function resolveNavigatorLedgerHome(context) {
|
|
24928
25235
|
const { tryHomeFromAkRolesPath: tryHomeFromAkRolesPath2 } = await Promise.resolve().then(() => (init_activation_ledger_topology(), activation_ledger_topology_exports));
|
|
24929
25236
|
const runDirectory = runDirectoryFromHostContext(context);
|
|
@@ -24943,7 +25250,7 @@ function exactRecord2(value) {
|
|
|
24943
25250
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24944
25251
|
}
|
|
24945
25252
|
function runIdFromNavigatorDirectory(runDirectory) {
|
|
24946
|
-
const entry =
|
|
25253
|
+
const entry = basename10(runDirectory);
|
|
24947
25254
|
const suffix = "@navigator";
|
|
24948
25255
|
if (!entry.endsWith(suffix)) return void 0;
|
|
24949
25256
|
const runId = entry.slice(0, entry.length - suffix.length);
|
|
@@ -24987,6 +25294,7 @@ function createNativeNavigatorSessionFactory(deps) {
|
|
|
24987
25294
|
});
|
|
24988
25295
|
let providerFailure;
|
|
24989
25296
|
let noReceipt;
|
|
25297
|
+
let routePlaybookReadFailure;
|
|
24990
25298
|
let disposed = false;
|
|
24991
25299
|
let hostRunId = readNavigatorHostRunPointer(sessionManager.getEntries());
|
|
24992
25300
|
const summon = deps?.summonPublicRole ?? (async (options) => {
|
|
@@ -25000,13 +25308,16 @@ function createNativeNavigatorSessionFactory(deps) {
|
|
|
25000
25308
|
}
|
|
25001
25309
|
providerFailure = void 0;
|
|
25002
25310
|
noReceipt = void 0;
|
|
25311
|
+
routePlaybookReadFailure = void 0;
|
|
25003
25312
|
try {
|
|
25004
25313
|
const summonHome = await resolveNavigatorLedgerHome(context);
|
|
25005
25314
|
if (disposed) return;
|
|
25006
25315
|
const resumeRunId = hostRunId;
|
|
25316
|
+
const workContextPath = navigatorWorkContextFile(sessionManager.getSessionDir());
|
|
25317
|
+
const argvText = existsSync13(workContextPath) ? attachWorkContextPointer(text, workContextPath) : text;
|
|
25007
25318
|
const baseSummon = {
|
|
25008
25319
|
role: "navigator",
|
|
25009
|
-
argv: [
|
|
25320
|
+
argv: [argvText],
|
|
25010
25321
|
cwd: context.cwd,
|
|
25011
25322
|
...summonHome === void 0 ? {} : { home: summonHome },
|
|
25012
25323
|
...context.signal === void 0 ? {} : { signal: context.signal }
|
|
@@ -25027,6 +25338,8 @@ function createNativeNavigatorSessionFactory(deps) {
|
|
|
25027
25338
|
}
|
|
25028
25339
|
}
|
|
25029
25340
|
if (disposed) return;
|
|
25341
|
+
const playbookFailure = summoned.terminal?.navigator?.advisoryDiagnostic;
|
|
25342
|
+
routePlaybookReadFailure = typeof playbookFailure === "string" && playbookFailure.trim() !== "" ? playbookFailure : void 0;
|
|
25030
25343
|
const outcome = summoned.terminal?.roleOutcome;
|
|
25031
25344
|
if (outcome === void 0) {
|
|
25032
25345
|
const detail = summoned.stderr?.trim() || `exit ${summoned.exitCode}`;
|
|
@@ -25085,6 +25398,7 @@ function createNativeNavigatorSessionFactory(deps) {
|
|
|
25085
25398
|
},
|
|
25086
25399
|
providerFailure: () => providerFailure,
|
|
25087
25400
|
noReceipt: () => noReceipt,
|
|
25401
|
+
routePlaybookReadFailure: () => routePlaybookReadFailure,
|
|
25088
25402
|
appendEntry: (customType, data) => {
|
|
25089
25403
|
sessionManager.appendCustomEntry(customType, data);
|
|
25090
25404
|
try {
|
|
@@ -25124,7 +25438,6 @@ init_work_subject_identity();
|
|
|
25124
25438
|
init_receipt_delivery_policy();
|
|
25125
25439
|
init_navigator_output();
|
|
25126
25440
|
var NAVIGATOR_EVENT_TYPE = "ak-navigator-attendance";
|
|
25127
|
-
var NAVIGATOR_PREPARE_ACCEPTED_TEXT = "\u6E38\u5955\u4F7F\u51C6\u5907\u5DF2\u63A5\u53D7";
|
|
25128
25441
|
function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
|
|
25129
25442
|
if (roleInput !== void 0 && roleInput.trim() !== "") return roleInput;
|
|
25130
25443
|
if (fileAuthority !== void 0 && fileAuthority.trim() !== "") return fileAuthority;
|
|
@@ -25133,10 +25446,9 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
|
|
|
25133
25446
|
var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
|
|
25134
25447
|
var prepareSchema = Type20.Object({
|
|
25135
25448
|
prose: Type20.Optional(Type20.Unknown({
|
|
25136
|
-
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002
|
|
25449
|
+
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002"
|
|
25137
25450
|
}))
|
|
25138
25451
|
}, { additionalProperties: true });
|
|
25139
|
-
var CONTEXT_ENTRY = "ak-navigator-context";
|
|
25140
25452
|
var INVOCATION_ENTRY = NAVIGATOR_INVOCATION_ENTRY;
|
|
25141
25453
|
var SETTLEMENT_ENTRY = "ak-navigator-settlement";
|
|
25142
25454
|
function exactRecord3(value) {
|
|
@@ -25176,7 +25488,7 @@ function navigatorSubjectKey(subjectRoot, subject, provenance = "role_input") {
|
|
|
25176
25488
|
}
|
|
25177
25489
|
function navigatorSubjectKeyForInput(subjectRoot, reference, cwd = process.cwd()) {
|
|
25178
25490
|
if (issueRoot(subjectRoot) !== void 0 || !subjectRoot.includes("/.ak/work/")) return subjectRoot;
|
|
25179
|
-
const resolvedReference =
|
|
25491
|
+
const resolvedReference = resolve18(cwd, reference);
|
|
25180
25492
|
const marker = "/runs/";
|
|
25181
25493
|
if (resolvedReference.includes(marker)) {
|
|
25182
25494
|
return subjectRoot;
|
|
@@ -25191,12 +25503,12 @@ function createNavigatorPrepareTool(onOutput) {
|
|
|
25191
25503
|
parameters: prepareSchema,
|
|
25192
25504
|
async execute(_id, value) {
|
|
25193
25505
|
onOutput(value);
|
|
25194
|
-
return { content: [
|
|
25506
|
+
return { content: [], details: value, terminate: true };
|
|
25195
25507
|
}
|
|
25196
25508
|
};
|
|
25197
25509
|
}
|
|
25198
25510
|
function formatNavigatorReport(report) {
|
|
25199
|
-
const playbookFailure = report.routePlaybookReadFailure === void 0 ? [] : [
|
|
25511
|
+
const playbookFailure = report.routePlaybookReadFailure === void 0 ? [] : [report.routePlaybookReadFailure];
|
|
25200
25512
|
if (report.disposition === "no-advice") return playbookFailure.join("\n");
|
|
25201
25513
|
if (report.disposition === "unavailable") {
|
|
25202
25514
|
return [...playbookFailure, ...report.unavailableReason ? [report.unavailableReason] : []].join("\n");
|
|
@@ -25222,28 +25534,15 @@ function createNavigatorAttendance(options) {
|
|
|
25222
25534
|
let settlementTail = Promise.resolve();
|
|
25223
25535
|
let settlementFailure;
|
|
25224
25536
|
let preparationFailure;
|
|
25225
|
-
let
|
|
25537
|
+
let observedRoutePlaybookFailure;
|
|
25226
25538
|
let disposed = false;
|
|
25227
25539
|
let closing;
|
|
25228
25540
|
const nestCancel = new AbortController();
|
|
25229
|
-
let warmedHelp;
|
|
25230
25541
|
const sessionHostContext = () => {
|
|
25231
25542
|
const parentSignal = options.context.signal;
|
|
25232
25543
|
const signal = parentSignal === void 0 ? nestCancel.signal : AbortSignal.any([nestCancel.signal, parentSignal]);
|
|
25233
25544
|
return { ...options.context, signal };
|
|
25234
25545
|
};
|
|
25235
|
-
const loadLiveHelp = async () => {
|
|
25236
|
-
try {
|
|
25237
|
-
return await Promise.all(
|
|
25238
|
-
NAVIGATOR_TARGETS.map(async ({ role }) => ({
|
|
25239
|
-
role,
|
|
25240
|
-
help: await options.loadRoleHelp(role)
|
|
25241
|
-
}))
|
|
25242
|
-
);
|
|
25243
|
-
} catch (error) {
|
|
25244
|
-
throw navigatorUnavailableError("transport", error);
|
|
25245
|
-
}
|
|
25246
|
-
};
|
|
25247
25546
|
const unavailable = (invocationId, reason) => {
|
|
25248
25547
|
const failure2 = reason instanceof NavigatorUnavailableError ? reason : navigatorUnavailableError("unknown", reason);
|
|
25249
25548
|
return {
|
|
@@ -25253,7 +25552,6 @@ function createNavigatorAttendance(options) {
|
|
|
25253
25552
|
unavailableCause: failure2.unavailableCause
|
|
25254
25553
|
};
|
|
25255
25554
|
};
|
|
25256
|
-
let routePlaybookSettlement;
|
|
25257
25555
|
let prepareBoundSettlement;
|
|
25258
25556
|
const loadMaterialsAndSession = async (invocationId) => {
|
|
25259
25557
|
if (contextError !== void 0) throw navigatorUnavailableError("context", contextError);
|
|
@@ -25263,30 +25561,6 @@ function createNavigatorAttendance(options) {
|
|
|
25263
25561
|
new Error("controlling authority content was not supplied as typed work context")
|
|
25264
25562
|
);
|
|
25265
25563
|
}
|
|
25266
|
-
let soul;
|
|
25267
|
-
let modelSetting;
|
|
25268
|
-
let help;
|
|
25269
|
-
let routePlaybook = "";
|
|
25270
|
-
routePlaybookReadFailure = void 0;
|
|
25271
|
-
const soulPromise = (async () => {
|
|
25272
|
-
try {
|
|
25273
|
-
const text = (await options.loadSoul()).trim();
|
|
25274
|
-
if (!text) throw new Error("Navigator soul is empty");
|
|
25275
|
-
return text;
|
|
25276
|
-
} catch (error) {
|
|
25277
|
-
throw navigatorUnavailableError("context", error);
|
|
25278
|
-
}
|
|
25279
|
-
})();
|
|
25280
|
-
const routePlaybookPromise = (async () => {
|
|
25281
|
-
if (options.loadRoutePlaybook === void 0) return "";
|
|
25282
|
-
try {
|
|
25283
|
-
return await options.loadRoutePlaybook();
|
|
25284
|
-
} catch (error) {
|
|
25285
|
-
routePlaybookReadFailure = error instanceof Error ? error.message : String(error);
|
|
25286
|
-
return "";
|
|
25287
|
-
}
|
|
25288
|
-
})();
|
|
25289
|
-
routePlaybookSettlement = routePlaybookPromise.then(() => void 0);
|
|
25290
25564
|
const modelPromise = (async () => {
|
|
25291
25565
|
try {
|
|
25292
25566
|
const resolved = await resolveNavigatorSeatSelection(options.context);
|
|
@@ -25296,23 +25570,13 @@ function createNavigatorAttendance(options) {
|
|
|
25296
25570
|
throw navigatorUnavailableError("model", error);
|
|
25297
25571
|
}
|
|
25298
25572
|
})();
|
|
25299
|
-
const
|
|
25300
|
-
warmedHelp = void 0;
|
|
25301
|
-
[soul, routePlaybook, modelSetting, help] = await Promise.all([
|
|
25302
|
-
soulPromise,
|
|
25303
|
-
routePlaybookPromise,
|
|
25304
|
-
modelPromise,
|
|
25305
|
-
helpPromise
|
|
25306
|
-
]);
|
|
25573
|
+
const modelSetting = await modelPromise;
|
|
25307
25574
|
let model;
|
|
25308
25575
|
try {
|
|
25309
25576
|
model = parseNavigatorModelSetting(modelSetting);
|
|
25310
25577
|
} catch (error) {
|
|
25311
25578
|
throw navigatorUnavailableError("model", error);
|
|
25312
25579
|
}
|
|
25313
|
-
const helpContext = help.map(({ role, help: text }) => `<role_help role="${role}">
|
|
25314
|
-
${text}
|
|
25315
|
-
</role_help>`).join("\n");
|
|
25316
25580
|
const tool = createNavigatorPrepareTool((value) => {
|
|
25317
25581
|
outputSink?.(value);
|
|
25318
25582
|
});
|
|
@@ -25357,9 +25621,9 @@ ${text}
|
|
|
25357
25621
|
}
|
|
25358
25622
|
if (disposed) throw navigatorUnavailableError("session", new Error("Navigator attendance was disposed"));
|
|
25359
25623
|
if (session === void 0) throw new Error("Navigator session was not created");
|
|
25360
|
-
return
|
|
25624
|
+
return session;
|
|
25361
25625
|
};
|
|
25362
|
-
const prepare = async (
|
|
25626
|
+
const prepare = async (existingSession) => {
|
|
25363
25627
|
const boundSettlement = prepareBoundSettlement;
|
|
25364
25628
|
prepareBoundSettlement = void 0;
|
|
25365
25629
|
const invocationId = invocationPrincipal;
|
|
@@ -25376,73 +25640,19 @@ ${text}
|
|
|
25376
25640
|
const merged = [prior, next].filter((part) => part.trim() !== "").join("\n\n");
|
|
25377
25641
|
output = { prose: merged };
|
|
25378
25642
|
};
|
|
25379
|
-
const
|
|
25380
|
-
|
|
25381
|
-
const
|
|
25382
|
-
|
|
25383
|
-
|
|
25384
|
-
|
|
25385
|
-
|
|
25386
|
-
...boundSettlement === void 0 ? {} : { currentSettlement: boundSettlement },
|
|
25387
|
-
publicSettlementHistory,
|
|
25388
|
-
liveRoleHelp: help
|
|
25389
|
-
};
|
|
25390
|
-
activeSession.appendEntry(CONTEXT_ENTRY, projection);
|
|
25391
|
-
const request = boundSettlement === void 0 ? [
|
|
25392
|
-
"\u672C\u8F6E\u4E3A\u5F85\u547D\u8F6E\u3002",
|
|
25393
|
-
`<navigator_soul>
|
|
25394
|
-
${soul}
|
|
25395
|
-
</navigator_soul>`,
|
|
25396
|
-
...routePlaybookReadFailure === void 0 ? [`<route_playbook>
|
|
25397
|
-
${routePlaybook}
|
|
25398
|
-
</route_playbook>`] : ["\u53EF\u9009\u8DEF\u7EBF\u624B\u518C\u672A\u80FD\u8BFB\u53D6\u3002"],
|
|
25399
|
-
`<work_subject>
|
|
25400
|
-
${subject}
|
|
25401
|
-
</work_subject>`,
|
|
25402
|
-
`<controlling_authority>
|
|
25403
|
-
${authority}
|
|
25404
|
-
</controlling_authority>`,
|
|
25405
|
-
`<current_role>
|
|
25406
|
-
${JSON.stringify({ role: options.role, phase: options.phase })}
|
|
25407
|
-
</current_role>`,
|
|
25408
|
-
`<public_settlement_history>
|
|
25409
|
-
${JSON.stringify(projection.publicSettlementHistory)}
|
|
25410
|
-
</public_settlement_history>`,
|
|
25411
|
-
`<live_role_help>
|
|
25412
|
-
${helpContext}
|
|
25413
|
-
</live_role_help>`
|
|
25414
|
-
].join("\n\n") : [
|
|
25415
|
-
"\u672C\u8F6E\u4E3A\u7ED3\u7B97\u6295\u5582\u8F6E\u3002",
|
|
25416
|
-
`<navigator_soul>
|
|
25417
|
-
${soul}
|
|
25418
|
-
</navigator_soul>`,
|
|
25419
|
-
...routePlaybookReadFailure === void 0 ? [`<route_playbook>
|
|
25420
|
-
${routePlaybook}
|
|
25421
|
-
</route_playbook>`] : ["\u53EF\u9009\u8DEF\u7EBF\u624B\u518C\u672A\u80FD\u8BFB\u53D6\u3002"],
|
|
25422
|
-
`<work_subject>
|
|
25423
|
-
${subject}
|
|
25424
|
-
</work_subject>`,
|
|
25425
|
-
`<controlling_authority>
|
|
25426
|
-
${authority}
|
|
25427
|
-
</controlling_authority>`,
|
|
25428
|
-
`<current_role>
|
|
25429
|
-
${JSON.stringify({ role: options.role, phase: options.phase })}
|
|
25430
|
-
</current_role>`,
|
|
25431
|
-
`<current_settlement>
|
|
25432
|
-
${JSON.stringify(boundSettlement)}
|
|
25433
|
-
</current_settlement>`,
|
|
25434
|
-
`<public_settlement_history>
|
|
25435
|
-
${JSON.stringify(projection.publicSettlementHistory)}
|
|
25436
|
-
</public_settlement_history>`,
|
|
25437
|
-
`<live_role_help>
|
|
25438
|
-
${helpContext}
|
|
25439
|
-
</live_role_help>`
|
|
25440
|
-
].join("\n\n");
|
|
25643
|
+
const activeSession = existingSession ?? await loadMaterialsAndSession(invocationId);
|
|
25644
|
+
if (boundSettlement === void 0) return void 0;
|
|
25645
|
+
const request = JSON.stringify({
|
|
25646
|
+
...boundSettlement,
|
|
25647
|
+
invocationId,
|
|
25648
|
+
subjectKey
|
|
25649
|
+
});
|
|
25441
25650
|
try {
|
|
25442
25651
|
try {
|
|
25443
25652
|
if (disposed) throw navigatorUnavailableError("session", new Error("Navigator attendance was disposed"));
|
|
25444
25653
|
const delivery = createReceiptDeliveryPolicy();
|
|
25445
25654
|
const promptAllowingRejectedPrepare = async (text, deliveryRequest) => {
|
|
25655
|
+
await persistNavigatorWorkBase(activeSession.recordPointer(), { subject, authority });
|
|
25446
25656
|
const entryStart = activeSession.entries().length;
|
|
25447
25657
|
prepareBatchRejected = false;
|
|
25448
25658
|
let promptFailure;
|
|
@@ -25473,7 +25683,7 @@ ${helpContext}
|
|
|
25473
25683
|
await promptAllowingRejectedPrepare(request, false);
|
|
25474
25684
|
if (boundSettlement !== void 0) {
|
|
25475
25685
|
while (output === void 0 && prepareBatchRejected && delivery.nextAction() === "request-delivery") {
|
|
25476
|
-
await promptAllowingRejectedPrepare(
|
|
25686
|
+
await promptAllowingRejectedPrepare(JSON.stringify(delivery.deliveryState()), true);
|
|
25477
25687
|
}
|
|
25478
25688
|
if (output === void 0 && delivery.nextAction() === "request-delivery") {
|
|
25479
25689
|
while (delivery.nextAction() === "request-delivery") {
|
|
@@ -25513,6 +25723,8 @@ ${helpContext}
|
|
|
25513
25723
|
preparedProse = normalizePrepareProse(output);
|
|
25514
25724
|
return preparedProse;
|
|
25515
25725
|
} finally {
|
|
25726
|
+
const playbookFailure = activeSession.routePlaybookReadFailure?.();
|
|
25727
|
+
observedRoutePlaybookFailure = typeof playbookFailure === "string" && playbookFailure.trim() !== "" ? playbookFailure : void 0;
|
|
25516
25728
|
outputSink = void 0;
|
|
25517
25729
|
}
|
|
25518
25730
|
};
|
|
@@ -25530,16 +25742,6 @@ ${helpContext}
|
|
|
25530
25742
|
contextError = next.contextError;
|
|
25531
25743
|
return closing2;
|
|
25532
25744
|
},
|
|
25533
|
-
/**
|
|
25534
|
-
* Start live-help subprocesses during activation without beginning full
|
|
25535
|
-
* preparation. Next prepare() consumes the warm result; a later prepare
|
|
25536
|
-
* reloads so live help edits remain visible.
|
|
25537
|
-
*/
|
|
25538
|
-
warmHelp() {
|
|
25539
|
-
if (disposed || warmedHelp !== void 0 || preparation !== void 0) return;
|
|
25540
|
-
warmedHelp = loadLiveHelp();
|
|
25541
|
-
void warmedHelp.catch(() => void 0);
|
|
25542
|
-
},
|
|
25543
25745
|
prepare() {
|
|
25544
25746
|
if (disposed || preparation !== void 0) return;
|
|
25545
25747
|
preparationFailure = void 0;
|
|
@@ -25554,9 +25756,6 @@ ${helpContext}
|
|
|
25554
25756
|
isPreparing() {
|
|
25555
25757
|
return preparationInFlight;
|
|
25556
25758
|
},
|
|
25557
|
-
knownRoutePlaybookReadFailure() {
|
|
25558
|
-
return routePlaybookReadFailure;
|
|
25559
|
-
},
|
|
25560
25759
|
settle(settlement) {
|
|
25561
25760
|
const next = settlementTail.then(() => settleOnce(settlement));
|
|
25562
25761
|
settlementTail = next.catch((error) => {
|
|
@@ -25583,6 +25782,7 @@ ${helpContext}
|
|
|
25583
25782
|
};
|
|
25584
25783
|
async function settleOnce(settlement) {
|
|
25585
25784
|
if (disposed) return;
|
|
25785
|
+
observedRoutePlaybookFailure = void 0;
|
|
25586
25786
|
const invocationId = activeInvocationId ?? invocationPrincipal;
|
|
25587
25787
|
let report;
|
|
25588
25788
|
if (sessionReady !== void 0) {
|
|
@@ -25621,10 +25821,10 @@ ${helpContext}
|
|
|
25621
25821
|
}
|
|
25622
25822
|
} else {
|
|
25623
25823
|
if (session !== void 0) preparationFailure = void 0;
|
|
25624
|
-
let
|
|
25824
|
+
let coldSession;
|
|
25625
25825
|
if (session === void 0 && preparationFailure === void 0) {
|
|
25626
25826
|
try {
|
|
25627
|
-
|
|
25827
|
+
coldSession = await loadMaterialsAndSession(invocationId);
|
|
25628
25828
|
} catch (error) {
|
|
25629
25829
|
preparationFailure = error;
|
|
25630
25830
|
}
|
|
@@ -25632,7 +25832,7 @@ ${helpContext}
|
|
|
25632
25832
|
session?.appendEntry(SETTLEMENT_ENTRY, settlementFact);
|
|
25633
25833
|
if (preparationFailure === void 0) {
|
|
25634
25834
|
prepareBoundSettlement = settlement;
|
|
25635
|
-
preparation = prepare(
|
|
25835
|
+
preparation = prepare(coldSession);
|
|
25636
25836
|
void preparation.catch((error) => {
|
|
25637
25837
|
preparationFailure = error;
|
|
25638
25838
|
});
|
|
@@ -25651,9 +25851,8 @@ ${helpContext}
|
|
|
25651
25851
|
report = { disposition: "no-advice" };
|
|
25652
25852
|
}
|
|
25653
25853
|
}
|
|
25654
|
-
|
|
25655
|
-
|
|
25656
|
-
report = { ...report, routePlaybookReadFailure };
|
|
25854
|
+
if (observedRoutePlaybookFailure !== void 0) {
|
|
25855
|
+
report = { ...report, routePlaybookReadFailure: observedRoutePlaybookFailure };
|
|
25657
25856
|
}
|
|
25658
25857
|
const event = {
|
|
25659
25858
|
version: 1,
|
|
@@ -25680,8 +25879,6 @@ ${helpContext}
|
|
|
25680
25879
|
sessionReady = void 0;
|
|
25681
25880
|
preparedProse = void 0;
|
|
25682
25881
|
preparationFailure = void 0;
|
|
25683
|
-
routePlaybookSettlement = void 0;
|
|
25684
|
-
routePlaybookReadFailure = void 0;
|
|
25685
25882
|
}
|
|
25686
25883
|
}
|
|
25687
25884
|
|
|
@@ -25711,7 +25908,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
25711
25908
|
pi.registerTool({
|
|
25712
25909
|
name: JUDGE_OUTPUT_TOOL_NAME,
|
|
25713
25910
|
label: "\u5927\u7406\u5BFA\u8F93\u51FA",
|
|
25714
|
-
description: "\u63D0\u4EA4\u5927\u7406\u5BFA\u7EC8\u5C40\u5224\u8BCD\
|
|
25911
|
+
description: "\u63D0\u4EA4\u5927\u7406\u5BFA\u7EC8\u5C40\u5224\u8BCD\u3002",
|
|
25715
25912
|
promptSnippet: "\u63D0\u4EA4\u5927\u7406\u5BFA\u7EC8\u5C40\u5224\u8BCD",
|
|
25716
25913
|
parameters: judgeVerdictSchema,
|
|
25717
25914
|
async execute(toolCallId, parameters, signal, _onUpdate, ctx) {
|
|
@@ -25806,9 +26003,9 @@ var reviewerAmendmentsSchema = Type21.Object({
|
|
|
25806
26003
|
}))
|
|
25807
26004
|
}, {
|
|
25808
26005
|
additionalProperties: true,
|
|
25809
|
-
description: "\u5DF2\u8FD0\u884C lens \u7684 amendments \u627F\u8F7D candidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict \u7684\u5B8C\u6574\u62A5\u544A\uFF08\u975E\u4EC5 verdict \u884C\uFF09\uFF1B\u663E\u5F0F\u5355\u8F74\u65F6\u53E6\u4E00\u8F74\u53EF\u7701\u7565\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u5BF9\u5E94 lens \u5B57\u6BB5\u3002
|
|
26006
|
+
description: "\u5DF2\u8FD0\u884C lens \u7684 amendments \u627F\u8F7D candidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict \u7684\u5B8C\u6574\u62A5\u544A\uFF08\u975E\u4EC5 verdict \u884C\uFF09\uFF1B\u663E\u5F0F\u5355\u8F74\u65F6\u53E6\u4E00\u8F74\u53EF\u7701\u7565\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u5BF9\u5E94 lens \u5B57\u6BB5\u3002"
|
|
25810
26007
|
});
|
|
25811
|
-
var REVIEWER_STATUS_DESCRIPTION = "completed | refused
|
|
26008
|
+
var REVIEWER_STATUS_DESCRIPTION = "completed | refused\u3002\u4E24\u79CD\u6B63\u5E38 lens verdict\uFF08completeness / correctness\uFF09\u5747 completed\uFF1Bhard-stop \u4E0E usage error \u4E3A refused\uFF08\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u8FDB\u6240\u9009 lens amendments\uFF09\u3002";
|
|
25812
26009
|
var reviewerOutputVariants = Type21.Union([
|
|
25813
26010
|
Type21.Object({
|
|
25814
26011
|
status: Type21.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
|
|
@@ -25837,7 +26034,7 @@ function createReviewerRoleRuntime(pi, dependencies, _hostActions) {
|
|
|
25837
26034
|
pi.registerTool({
|
|
25838
26035
|
name: REVIEWER_OUTPUT_TOOL_NAME,
|
|
25839
26036
|
label: "\u5FA1\u53F2\u53F0\u8F93\u51FA",
|
|
25840
|
-
description: "\u63D0\u4EA4\u5FA1\u53F2\u53F0\u7EC8\u5C40\u56DE\u6267\u3002
|
|
26037
|
+
description: "\u63D0\u4EA4\u5FA1\u53F2\u53F0\u7EC8\u5C40\u56DE\u6267\u3002",
|
|
25841
26038
|
promptSnippet: "\u63D0\u4EA4\u5FA1\u53F2\u53F0\u7EC8\u5C40\u56DE\u6267",
|
|
25842
26039
|
parameters: reviewerOutputSchema,
|
|
25843
26040
|
async execute(_id, parameters) {
|
|
@@ -25877,8 +26074,8 @@ init_sitian_facade();
|
|
|
25877
26074
|
init_submission_errors();
|
|
25878
26075
|
init_submission_errors();
|
|
25879
26076
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
25880
|
-
import { existsSync as
|
|
25881
|
-
import { resolve as
|
|
26077
|
+
import { existsSync as existsSync14, lstatSync as lstatSync3, readdirSync as readdirSync3, readFileSync as readFileSync5, rmdirSync, rmSync } from "node:fs";
|
|
26078
|
+
import { resolve as resolve19 } from "node:path";
|
|
25882
26079
|
var WORKER_SUBMISSION_GATE_RECORD_KIND = WORKER_SUBMISSION_GATE_KIND;
|
|
25883
26080
|
var WORKER_COMMIT_BASELINE_ENTRY_TYPE = "commit-baseline";
|
|
25884
26081
|
var WORKER_COMMIT_REMINDER_BOUNCE_ENTRY_TYPE = "commit-reminder-bounce";
|
|
@@ -25908,7 +26105,7 @@ function statusOf(error) {
|
|
|
25908
26105
|
return typeof error === "object" && error !== null && "status" in error ? error.status : void 0;
|
|
25909
26106
|
}
|
|
25910
26107
|
function tryGetAll(file, key) {
|
|
25911
|
-
if (!
|
|
26108
|
+
if (!existsSync14(file)) return [];
|
|
25912
26109
|
try {
|
|
25913
26110
|
const out = gitFile(file, ["--get-all", key]);
|
|
25914
26111
|
return out.length === 0 ? [] : out.split("\n");
|
|
@@ -25918,7 +26115,7 @@ function tryGetAll(file, key) {
|
|
|
25918
26115
|
}
|
|
25919
26116
|
}
|
|
25920
26117
|
function ownedHook(path) {
|
|
25921
|
-
if (!
|
|
26118
|
+
if (!existsSync14(path)) return false;
|
|
25922
26119
|
return readFileSync5(path, "utf8").includes(HOOK_MARKER);
|
|
25923
26120
|
}
|
|
25924
26121
|
function escapeGitConfigValueRegex(value) {
|
|
@@ -25927,7 +26124,7 @@ function escapeGitConfigValueRegex(value) {
|
|
|
25927
26124
|
function unsetOwnedHooksPath(file) {
|
|
25928
26125
|
const owned = [];
|
|
25929
26126
|
for (const value of tryGetAll(file, "core.hooksPath")) {
|
|
25930
|
-
if (!ownedHook(
|
|
26127
|
+
if (!ownedHook(resolve19(value, HOOK_FILE))) continue;
|
|
25931
26128
|
try {
|
|
25932
26129
|
gitFile(file, [
|
|
25933
26130
|
"--unset-all",
|
|
@@ -25942,15 +26139,15 @@ function unsetOwnedHooksPath(file) {
|
|
|
25942
26139
|
return owned;
|
|
25943
26140
|
}
|
|
25944
26141
|
function rmOwnedDir(dir) {
|
|
25945
|
-
const hookPath =
|
|
26142
|
+
const hookPath = resolve19(dir, HOOK_FILE);
|
|
25946
26143
|
if (!ownedHook(hookPath)) return;
|
|
25947
26144
|
rmSync(hookPath, { force: true });
|
|
25948
|
-
if (
|
|
26145
|
+
if (existsSync14(dir) && readdirSync3(dir).length === 0) rmdirSync(dir);
|
|
25949
26146
|
}
|
|
25950
26147
|
function linkedGitDirs(commonDir) {
|
|
25951
|
-
const root =
|
|
25952
|
-
if (!
|
|
25953
|
-
return readdirSync3(root).map((name) =>
|
|
26148
|
+
const root = resolve19(commonDir, "worktrees");
|
|
26149
|
+
if (!existsSync14(root)) return [];
|
|
26150
|
+
return readdirSync3(root).map((name) => resolve19(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
|
|
25954
26151
|
}
|
|
25955
26152
|
function uninstallPackageWorkerHooks(cwd) {
|
|
25956
26153
|
let inside;
|
|
@@ -25964,14 +26161,14 @@ function uninstallPackageWorkerHooks(cwd) {
|
|
|
25964
26161
|
const clear = (configFile) => {
|
|
25965
26162
|
for (const hooks of unsetOwnedHooksPath(configFile)) rmOwnedDir(hooks);
|
|
25966
26163
|
};
|
|
25967
|
-
clear(
|
|
25968
|
-
clear(
|
|
25969
|
-
rmOwnedDir(
|
|
25970
|
-
const legacy =
|
|
26164
|
+
clear(resolve19(commonDir, "config"));
|
|
26165
|
+
clear(resolve19(commonDir, "config.worktree"));
|
|
26166
|
+
rmOwnedDir(resolve19(commonDir, HOOKS_DIR));
|
|
26167
|
+
const legacy = resolve19(commonDir, "hooks", HOOK_FILE);
|
|
25971
26168
|
if (ownedHook(legacy)) rmSync(legacy, { force: true });
|
|
25972
26169
|
for (const gitDir of linkedGitDirs(commonDir)) {
|
|
25973
|
-
clear(
|
|
25974
|
-
rmOwnedDir(
|
|
26170
|
+
clear(resolve19(gitDir, "config.worktree"));
|
|
26171
|
+
rmOwnedDir(resolve19(gitDir, HOOKS_DIR));
|
|
25975
26172
|
}
|
|
25976
26173
|
}
|
|
25977
26174
|
function isRecord17(value) {
|
|
@@ -26133,7 +26330,7 @@ function fixerBashSeatbeltDenyReason(matched) {
|
|
|
26133
26330
|
}
|
|
26134
26331
|
|
|
26135
26332
|
// src/worker-role.ts
|
|
26136
|
-
var CODER_STATUS_DESCRIPTION = "planned | completed | refused | partially_completed | unfinished
|
|
26333
|
+
var CODER_STATUS_DESCRIPTION = "planned | completed | refused | partially_completed | unfinished\u3002unfinished\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u81F4\u672C\u5C40\u672A\u5B8C\u6210\u3002";
|
|
26137
26334
|
var coderOutputVariants = Type22.Union([
|
|
26138
26335
|
Type22.Object({
|
|
26139
26336
|
status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
@@ -26276,7 +26473,7 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26276
26473
|
pi.registerTool({
|
|
26277
26474
|
name: FIXER_OUTPUT_TOOL_NAME,
|
|
26278
26475
|
label: "\u4FEE\u5185\u53F8\u8F93\u51FA",
|
|
26279
|
-
description: "\u63D0\u4EA4\u4FEE\u5185\u53F8\u7EC8\u5C40\u56DE\u6267\
|
|
26476
|
+
description: "\u63D0\u4EA4\u4FEE\u5185\u53F8\u7EC8\u5C40\u56DE\u6267\u3002",
|
|
26280
26477
|
promptSnippet: "\u63D0\u4EA4\u4FEE\u5185\u53F8\u7EC8\u5C40\u56DE\u6267",
|
|
26281
26478
|
parameters: fixerOutputSchema,
|
|
26282
26479
|
async execute(toolCallId, parameters, _signal, _onUpdate, ctx) {
|
|
@@ -26403,7 +26600,7 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26403
26600
|
pi.registerTool({
|
|
26404
26601
|
name: CODER_OUTPUT_TOOL_NAME,
|
|
26405
26602
|
label: "\u5C06\u4F5C\u76D1\u8F93\u51FA",
|
|
26406
|
-
description: "\u63D0\u4EA4\u5C06\u4F5C\u76D1\u7EC8\u5C40\u56DE\u6267\
|
|
26603
|
+
description: "\u63D0\u4EA4\u5C06\u4F5C\u76D1\u7EC8\u5C40\u56DE\u6267\u3002",
|
|
26407
26604
|
promptSnippet: "\u63D0\u4EA4\u5C06\u4F5C\u76D1\u7EC8\u5C40\u56DE\u6267",
|
|
26408
26605
|
parameters: coderOutputSchema,
|
|
26409
26606
|
async execute(toolCallId, parameters, _signal, _onUpdate, ctx2) {
|
|
@@ -26730,25 +26927,6 @@ var ROLE_FLAG = {
|
|
|
26730
26927
|
type: "string"
|
|
26731
26928
|
}
|
|
26732
26929
|
};
|
|
26733
|
-
function formatNavigatorRoleHelp(role) {
|
|
26734
|
-
const metadata = packagedRoleMetadata(role);
|
|
26735
|
-
const lines = [
|
|
26736
|
-
`Usage: ak-role ${role}`,
|
|
26737
|
-
ROLE_FLAG.definition.description
|
|
26738
|
-
];
|
|
26739
|
-
const inputFlag = packagedRoleInputFlag(role);
|
|
26740
|
-
if (inputFlag !== void 0) {
|
|
26741
|
-
lines.push(` --${inputFlag} <value> ${role} input material`);
|
|
26742
|
-
}
|
|
26743
|
-
const phaseFlag = packagedRolePhaseFlag(role);
|
|
26744
|
-
if (phaseFlag !== void 0 && metadata !== void 0) {
|
|
26745
|
-
lines.push(
|
|
26746
|
-
` --${phaseFlag} <value> ${role} phase: ${metadata.phases.filter((p) => p !== null).join(" | ")}`
|
|
26747
|
-
);
|
|
26748
|
-
}
|
|
26749
|
-
lines.push(`Public next-command form: ak-role ${role}`);
|
|
26750
|
-
return lines.join("\n");
|
|
26751
|
-
}
|
|
26752
26930
|
function abortContext(ctx) {
|
|
26753
26931
|
ctx.abort();
|
|
26754
26932
|
}
|
|
@@ -26909,7 +27087,7 @@ function createGatekeeperRoleRuntime(roleHost, dependencies) {
|
|
|
26909
27087
|
);
|
|
26910
27088
|
}
|
|
26911
27089
|
function createNavigatorRoleRuntime(roleHost, dependencies) {
|
|
26912
|
-
|
|
27090
|
+
const base = createFiledOfficerRuntime(
|
|
26913
27091
|
roleHost,
|
|
26914
27092
|
{
|
|
26915
27093
|
role: "navigator",
|
|
@@ -26918,6 +27096,42 @@ function createNavigatorRoleRuntime(roleHost, dependencies) {
|
|
|
26918
27096
|
},
|
|
26919
27097
|
dependencies
|
|
26920
27098
|
);
|
|
27099
|
+
let playbookBound = false;
|
|
27100
|
+
return {
|
|
27101
|
+
async activate() {
|
|
27102
|
+
await base.activate();
|
|
27103
|
+
if (playbookBound) return;
|
|
27104
|
+
playbookBound = true;
|
|
27105
|
+
const loadRoutePlaybook = dependencies.loadRoutePlaybook ?? (() => readPackageMaterial("resources/navigator-route-playbook.md"));
|
|
27106
|
+
let playbookRead;
|
|
27107
|
+
roleHost.on("before_agent_start", async (event) => {
|
|
27108
|
+
const basePrompt = typeof event.systemPrompt === "string" ? event.systemPrompt : "";
|
|
27109
|
+
const parts = [];
|
|
27110
|
+
try {
|
|
27111
|
+
playbookRead ??= loadRoutePlaybook();
|
|
27112
|
+
const content = await playbookRead;
|
|
27113
|
+
dependencies.recordRoutePlaybookReadFailure?.(void 0);
|
|
27114
|
+
if (content.trim() !== "") parts.push(content);
|
|
27115
|
+
} catch (error) {
|
|
27116
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
27117
|
+
if (message.trim() !== "") {
|
|
27118
|
+
dependencies.recordRoutePlaybookReadFailure?.(message);
|
|
27119
|
+
parts.push(message);
|
|
27120
|
+
}
|
|
27121
|
+
}
|
|
27122
|
+
const prompt = typeof event.prompt === "string" ? event.prompt : "";
|
|
27123
|
+
const work = await loadNavigatorWorkBaseSuffix(prompt);
|
|
27124
|
+
if (work !== void 0 && work.trim() !== "") parts.push(work);
|
|
27125
|
+
if (parts.length === 0) return;
|
|
27126
|
+
const text = parts.join("\n\n");
|
|
27127
|
+
return {
|
|
27128
|
+
systemPrompt: basePrompt.trim() === "" ? text : `${basePrompt}
|
|
27129
|
+
|
|
27130
|
+
${text}`
|
|
27131
|
+
};
|
|
27132
|
+
});
|
|
27133
|
+
}
|
|
27134
|
+
};
|
|
26921
27135
|
}
|
|
26922
27136
|
function createAuditorRoleRuntime(roleHost, dependencies) {
|
|
26923
27137
|
const base = createFiledOfficerRuntime(
|
|
@@ -26961,7 +27175,7 @@ function readDiaristTicketAssertion(submitted) {
|
|
|
26961
27175
|
function readRoleRunCoordinates(ctx, label) {
|
|
26962
27176
|
const runDirectory = runDirectoryFromHostContext(ctx);
|
|
26963
27177
|
if (runDirectory === void 0) throw new Error(`${label} requires AK_ROLE_RUN_DIR`);
|
|
26964
|
-
const admittedPath =
|
|
27178
|
+
const admittedPath = join44(runDirectory, "admitted-request.json");
|
|
26965
27179
|
const admitted = JSON.parse(readFileSync6(admittedPath, "utf8"));
|
|
26966
27180
|
if (typeof admitted.projectRoot !== "string" || admitted.projectRoot.trim() === "") {
|
|
26967
27181
|
throw new Error(`${label} admitted-request missing projectRoot (${admittedPath})`);
|
|
@@ -27301,13 +27515,11 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27301
27515
|
const raced = await raceNavigatorGrace(settlePromise, NAVIGATOR_POST_ROLE_GRACE_MS);
|
|
27302
27516
|
if (raced.status !== "timeout") return;
|
|
27303
27517
|
if (pendingNavigatorPresentation === void 0) {
|
|
27304
|
-
const routePlaybookReadFailure = attendance.knownRoutePlaybookReadFailure?.();
|
|
27305
27518
|
const report = {
|
|
27306
27519
|
disposition: "unavailable",
|
|
27307
27520
|
unavailableReason: "Navigator exceeded post-role delivery grace",
|
|
27308
27521
|
unavailableSource: "unknown",
|
|
27309
|
-
unavailableCause: "unknown"
|
|
27310
|
-
...routePlaybookReadFailure === void 0 ? {} : { routePlaybookReadFailure }
|
|
27522
|
+
unavailableCause: "unknown"
|
|
27311
27523
|
};
|
|
27312
27524
|
const event = {
|
|
27313
27525
|
version: 1,
|
|
@@ -27318,8 +27530,7 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27318
27530
|
subjectKey: workContext?.subjectKey ?? "",
|
|
27319
27531
|
unavailableReason: "Navigator exceeded post-role delivery grace",
|
|
27320
27532
|
unavailableSource: "unknown",
|
|
27321
|
-
unavailableCause: "unknown"
|
|
27322
|
-
...routePlaybookReadFailure === void 0 ? {} : { routePlaybookReadFailure }
|
|
27533
|
+
unavailableCause: "unknown"
|
|
27323
27534
|
};
|
|
27324
27535
|
pendingNavigatorPresentation = { event, report };
|
|
27325
27536
|
}
|
|
@@ -27530,7 +27741,7 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27530
27741
|
}
|
|
27531
27742
|
envelopeHost.sendMessage({
|
|
27532
27743
|
customType: "ak-receipt-delivery-prompt",
|
|
27533
|
-
content:
|
|
27744
|
+
content: JSON.stringify(receiptDelivery.deliveryState()),
|
|
27534
27745
|
display: false
|
|
27535
27746
|
}, { triggerTurn: true, deliverAs: "followUp" });
|
|
27536
27747
|
} else if (receiptDelivery.nextAction() === "no-receipt" && !noReceiptRecorded) {
|
|
@@ -27694,7 +27905,12 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27694
27905
|
loadSoul: () => requireRoleSoul("gatekeeper")
|
|
27695
27906
|
});
|
|
27696
27907
|
const navigator = createNavigatorRoleRuntime(roleHost, {
|
|
27697
|
-
loadSoul: () => requireRoleSoul("navigator")
|
|
27908
|
+
loadSoul: () => requireRoleSoul("navigator"),
|
|
27909
|
+
recordRoutePlaybookReadFailure: (message) => {
|
|
27910
|
+
envelopeHost.appendEntry(NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY, {
|
|
27911
|
+
message: message ?? ""
|
|
27912
|
+
});
|
|
27913
|
+
}
|
|
27698
27914
|
});
|
|
27699
27915
|
const auditor = createAuditorRoleRuntime(roleHost, {
|
|
27700
27916
|
loadSoul: () => requireRoleSoul("auditor")
|
|
@@ -28001,7 +28217,6 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
28001
28217
|
pendingNavigatorPresentation = { event: navigatorEvent, report };
|
|
28002
28218
|
}
|
|
28003
28219
|
});
|
|
28004
|
-
navigatorAttendance.warmHelp?.();
|
|
28005
28220
|
if (navigatorWorkContext.contextError === void 0 && navigatorWorkContext.subjectProvenance !== "placeholder") {
|
|
28006
28221
|
navigatorAttendance.prepare();
|
|
28007
28222
|
}
|
|
@@ -28034,11 +28249,11 @@ init_submission_correctable_error();
|
|
|
28034
28249
|
init_navigator_invocation_identity();
|
|
28035
28250
|
init_serialize_thrown_value();
|
|
28036
28251
|
async function listen(server, path) {
|
|
28037
|
-
await new Promise((
|
|
28252
|
+
await new Promise((resolve22, reject) => {
|
|
28038
28253
|
server.once("error", reject);
|
|
28039
28254
|
server.listen(path, () => {
|
|
28040
28255
|
server.off("error", reject);
|
|
28041
|
-
|
|
28256
|
+
resolve22();
|
|
28042
28257
|
});
|
|
28043
28258
|
});
|
|
28044
28259
|
}
|
|
@@ -28073,8 +28288,8 @@ async function prepareRoleEnvelope(options) {
|
|
|
28073
28288
|
const hostAbort = new AbortController();
|
|
28074
28289
|
const runId = request.runDirectory.split("/").filter(Boolean).at(-1) ?? randomUUID9();
|
|
28075
28290
|
await mkdir5(request.runDirectory, { recursive: true });
|
|
28076
|
-
let sessionFile = options.sessionFile ??
|
|
28077
|
-
await mkdir5(
|
|
28291
|
+
let sessionFile = options.sessionFile ?? join45(request.runDirectory, "session", "session.jsonl");
|
|
28292
|
+
await mkdir5(dirname23(sessionFile), { recursive: true });
|
|
28078
28293
|
if (request.continuation.kind !== "resume") {
|
|
28079
28294
|
try {
|
|
28080
28295
|
await writeFile11(
|
|
@@ -28124,7 +28339,7 @@ async function prepareRoleEnvelope(options) {
|
|
|
28124
28339
|
getLeafEntry: () => sessionEntries.at(-1),
|
|
28125
28340
|
getLeafId: () => runId,
|
|
28126
28341
|
getEntries: () => sessionEntries,
|
|
28127
|
-
getSessionDir: () =>
|
|
28342
|
+
getSessionDir: () => dirname23(sessionFile),
|
|
28128
28343
|
getSessionFile: () => sessionFile,
|
|
28129
28344
|
getHeader: () => ({ type: "session", id: runId }),
|
|
28130
28345
|
setSessionFile(path) {
|
|
@@ -28482,8 +28697,8 @@ async function prepareRoleEnvelope(options) {
|
|
|
28482
28697
|
try {
|
|
28483
28698
|
const closeAll = server.closeAllConnections;
|
|
28484
28699
|
if (typeof closeAll === "function") closeAll.call(server);
|
|
28485
|
-
await new Promise((
|
|
28486
|
-
server.close((error) => error ? reject(error) :
|
|
28700
|
+
await new Promise((resolve22, reject) => {
|
|
28701
|
+
server.close((error) => error ? reject(error) : resolve22());
|
|
28487
28702
|
});
|
|
28488
28703
|
} catch (error) {
|
|
28489
28704
|
cleanupFailures.push(error);
|
|
@@ -28613,15 +28828,15 @@ async function prepareRoleEnvelope(options) {
|
|
|
28613
28828
|
|
|
28614
28829
|
// src/role-runtime-dependencies.ts
|
|
28615
28830
|
init_collector_github();
|
|
28616
|
-
import { readFile as
|
|
28617
|
-
import { join as
|
|
28831
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
28832
|
+
import { join as join46 } from "node:path";
|
|
28618
28833
|
init_doctor_evidence();
|
|
28619
28834
|
|
|
28620
28835
|
// src/navigator-work-context.ts
|
|
28621
28836
|
init_doctor_evidence();
|
|
28622
28837
|
init_host_contracts();
|
|
28623
|
-
import { readFile as
|
|
28624
|
-
import { resolve as
|
|
28838
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
28839
|
+
import { resolve as resolve20 } from "node:path";
|
|
28625
28840
|
init_notary_source_run();
|
|
28626
28841
|
init_packaged_role_registry();
|
|
28627
28842
|
init_invocation();
|
|
@@ -28629,12 +28844,12 @@ function navigatorInputReference(getFlag, role) {
|
|
|
28629
28844
|
if (getFlag === void 0) return void 0;
|
|
28630
28845
|
const name = packagedRoleInputFlag(role);
|
|
28631
28846
|
const value = name === void 0 ? void 0 : getFlag(name);
|
|
28632
|
-
return typeof value === "string" && value !== "" ?
|
|
28847
|
+
return typeof value === "string" && value !== "" ? resolve20(value) : void 0;
|
|
28633
28848
|
}
|
|
28634
28849
|
async function loadNavigatorWorkContext(options) {
|
|
28635
28850
|
const reference = navigatorInputReference(options.getFlag, options.role);
|
|
28636
28851
|
const subjectMode = packagedNavigatorSubject(options.role);
|
|
28637
|
-
const input = reference === void 0 || subjectMode === "case" || subjectMode === "source-run" ? void 0 : await
|
|
28852
|
+
const input = reference === void 0 || subjectMode === "case" || subjectMode === "source-run" ? void 0 : await readFile24(reference, "utf8");
|
|
28638
28853
|
const subjectRoot = subjectPath(reference ?? options.context.sessionManager.getSessionDir(), options.context.cwd);
|
|
28639
28854
|
let subjectKey = reference === void 0 ? subjectRoot : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
|
|
28640
28855
|
let subject = input ?? `work subject: ${subjectKey}`;
|
|
@@ -28651,7 +28866,7 @@ async function loadNavigatorWorkContext(options) {
|
|
|
28651
28866
|
}
|
|
28652
28867
|
const publicRunDir = runDirectoryFromHostContext(options.context);
|
|
28653
28868
|
const currentSessionDir = options.context.sessionManager.getSessionDir();
|
|
28654
|
-
const isBoundPublicRun = publicRunDir !== void 0 &&
|
|
28869
|
+
const isBoundPublicRun = publicRunDir !== void 0 && resolve20(currentSessionDir) === resolve20(publicRunDir, "session");
|
|
28655
28870
|
if (subjectMode === "public-instruction" && isBoundPublicRun) {
|
|
28656
28871
|
let admitted;
|
|
28657
28872
|
try {
|
|
@@ -28684,14 +28899,14 @@ async function loadNavigatorWorkContext(options) {
|
|
|
28684
28899
|
}
|
|
28685
28900
|
const workRoot = subjectRoot.includes("/.ak/work/") ? subjectRoot : void 0;
|
|
28686
28901
|
const authorityFiles = workRoot === void 0 ? [] : [
|
|
28687
|
-
|
|
28688
|
-
|
|
28689
|
-
|
|
28902
|
+
resolve20(workRoot, "authority.md"),
|
|
28903
|
+
resolve20(workRoot, "authority.txt"),
|
|
28904
|
+
resolve20(workRoot, "design-v2/owner-direction.md")
|
|
28690
28905
|
];
|
|
28691
28906
|
let authorityMaterial;
|
|
28692
28907
|
for (const path of authorityFiles) {
|
|
28693
28908
|
try {
|
|
28694
|
-
const content = await
|
|
28909
|
+
const content = await readFile24(path, "utf8");
|
|
28695
28910
|
if (content.trim() !== "") {
|
|
28696
28911
|
authorityMaterial = content;
|
|
28697
28912
|
break;
|
|
@@ -28728,21 +28943,20 @@ function loadRegisteredRoleSoul(role) {
|
|
|
28728
28943
|
return usesSubjectSoul(role) ? loadAuditorSoulFromSubjectInput() : loadMainRoleSessionMaterials(role);
|
|
28729
28944
|
}
|
|
28730
28945
|
function createRoleRuntimeDependencies(packageRoot) {
|
|
28731
|
-
const
|
|
28732
|
-
const collectorHandbookSeedPath = join45(packageRoot, "resources/collector-bot-handbook.md");
|
|
28946
|
+
const collectorHandbookSeedPath = join46(packageRoot, "resources/collector-bot-handbook.md");
|
|
28733
28947
|
const doctorAuditor = createPiDoctorAuditor();
|
|
28734
28948
|
const navigatorSessionFactory = createNativeNavigatorSessionFactory();
|
|
28735
28949
|
return {
|
|
28736
28950
|
packageRoot,
|
|
28737
28951
|
loadRoleReferenceMaterials: loadPackagedRoleReferenceMaterials,
|
|
28738
28952
|
loadRoleSoul: loadRegisteredRoleSoul,
|
|
28739
|
-
loadFixPacket: (path) =>
|
|
28740
|
-
loadCoderTask: (path) =>
|
|
28741
|
-
loadCollectorHandbookSeed: () =>
|
|
28953
|
+
loadFixPacket: (path) => readFile25(path, "utf8"),
|
|
28954
|
+
loadCoderTask: (path) => readFile25(path, "utf8"),
|
|
28955
|
+
loadCollectorHandbookSeed: () => readFile25(collectorHandbookSeedPath, "utf8"),
|
|
28742
28956
|
createCollectorTransport: () => createGhCollectorGitHubTransport(),
|
|
28743
28957
|
loadDoctorCase,
|
|
28744
28958
|
loadNotarySourceRun: loadNotarySourceRunLocator,
|
|
28745
|
-
loadMergerInput: async (path) => JSON.parse(await
|
|
28959
|
+
loadMergerInput: async (path) => JSON.parse(await readFile25(path, "utf8")),
|
|
28746
28960
|
// #590: doctor compliance still on disposeCompliance path; judge→auditor is gate queue (#756).
|
|
28747
28961
|
auditDoctorCompliance: (options) => doctorAuditor(options),
|
|
28748
28962
|
loadNavigatorWorkContext: (options) => loadNavigatorWorkContext({
|
|
@@ -28758,9 +28972,6 @@ function createRoleRuntimeDependencies(packageRoot) {
|
|
|
28758
28972
|
subject: options.subject,
|
|
28759
28973
|
authority: options.authority,
|
|
28760
28974
|
invocationId: options.invocationId,
|
|
28761
|
-
loadSoul: () => loadRegisteredRoleSoul("navigator"),
|
|
28762
|
-
loadRoutePlaybook: () => readFile24(navigatorRoutePlaybookPath, "utf8"),
|
|
28763
|
-
loadRoleHelp: async (role) => formatNavigatorRoleHelp(role),
|
|
28764
28975
|
createSession: navigatorSessionFactory,
|
|
28765
28976
|
...options.contextError === void 0 ? {} : { contextError: options.contextError },
|
|
28766
28977
|
onEvent: options.onEvent
|
|
@@ -28772,9 +28983,9 @@ function createRoleRuntimeDependencies(packageRoot) {
|
|
|
28772
28983
|
init_session_identity();
|
|
28773
28984
|
|
|
28774
28985
|
// src/acp-host/description.ts
|
|
28775
|
-
import { join as
|
|
28986
|
+
import { join as join47 } from "node:path";
|
|
28776
28987
|
function resolveAcpBinary(description, operatorHome) {
|
|
28777
|
-
return
|
|
28988
|
+
return join47(operatorHome, ...description.binaryFromHome);
|
|
28778
28989
|
}
|
|
28779
28990
|
function acpStdioArgs(description, model, seat) {
|
|
28780
28991
|
const { prefix, suffix, modelFlag, thinkingFlag } = description.argv;
|
|
@@ -28823,7 +29034,7 @@ function hostAbortedError(message = "host aborted") {
|
|
|
28823
29034
|
function raceAgainstHostAbort(work, abortSignal, message = "host aborted") {
|
|
28824
29035
|
if (abortSignal?.aborted) return Promise.reject(hostAbortedError(message));
|
|
28825
29036
|
if (abortSignal === void 0) return work;
|
|
28826
|
-
return new Promise((
|
|
29037
|
+
return new Promise((resolve22, reject) => {
|
|
28827
29038
|
let settled = false;
|
|
28828
29039
|
const onAbort = () => {
|
|
28829
29040
|
if (settled) return;
|
|
@@ -28838,7 +29049,7 @@ function raceAgainstHostAbort(work, abortSignal, message = "host aborted") {
|
|
|
28838
29049
|
if (settled) return;
|
|
28839
29050
|
settled = true;
|
|
28840
29051
|
abortSignal.removeEventListener("abort", onAbort);
|
|
28841
|
-
|
|
29052
|
+
resolve22(value);
|
|
28842
29053
|
},
|
|
28843
29054
|
(error) => {
|
|
28844
29055
|
if (settled) return;
|
|
@@ -29090,8 +29301,8 @@ function connectAcpStdio(options) {
|
|
|
29090
29301
|
request(method, params) {
|
|
29091
29302
|
if (closed) return Promise.reject(terminalError ?? acpError("acp-connection-closed", "ACP connection is closed"));
|
|
29092
29303
|
const id = ++nextId;
|
|
29093
|
-
return new Promise((
|
|
29094
|
-
pending.set(id, { resolve:
|
|
29304
|
+
return new Promise((resolve22, reject) => {
|
|
29305
|
+
pending.set(id, { resolve: resolve22, reject });
|
|
29095
29306
|
child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}
|
|
29096
29307
|
`, (error) => {
|
|
29097
29308
|
if (error === null || error === void 0) return;
|
|
@@ -29118,7 +29329,7 @@ function connectAcpStdio(options) {
|
|
|
29118
29329
|
settleClosed(acpError("acp-connection-closed", "ACP connection is closed"));
|
|
29119
29330
|
child.stdin.end();
|
|
29120
29331
|
child.kill("SIGTERM");
|
|
29121
|
-
await new Promise((
|
|
29332
|
+
await new Promise((resolve22) => child.once("close", () => resolve22()));
|
|
29122
29333
|
}
|
|
29123
29334
|
});
|
|
29124
29335
|
}
|
|
@@ -29340,12 +29551,12 @@ function createAcpRoleTurnHost(config) {
|
|
|
29340
29551
|
// src/acp-host/seat-profile-soul.ts
|
|
29341
29552
|
import { constants as constants3 } from "node:fs";
|
|
29342
29553
|
import { access as access4, copyFile, lstat as lstat8, mkdir as mkdir6, readlink, symlink as symlink2, unlink as unlink6 } from "node:fs/promises";
|
|
29343
|
-
import { dirname as
|
|
29554
|
+
import { dirname as dirname24, join as join48, relative as relative3, resolve as resolve21 } from "node:path";
|
|
29344
29555
|
function seatProfileName(spec, role) {
|
|
29345
29556
|
return `${spec.namePrefix}${role}`;
|
|
29346
29557
|
}
|
|
29347
29558
|
function packageRoleSoulPath(packageRoot, role) {
|
|
29348
|
-
return
|
|
29559
|
+
return join48(packageRoot, "souls", `${role}.md`);
|
|
29349
29560
|
}
|
|
29350
29561
|
async function pathExists2(path) {
|
|
29351
29562
|
try {
|
|
@@ -29358,20 +29569,20 @@ async function pathExists2(path) {
|
|
|
29358
29569
|
async function ensureSeatProfileSoul(options) {
|
|
29359
29570
|
const { spec, operatorHome, packageRoot, role } = options;
|
|
29360
29571
|
const profileName = seatProfileName(spec, role);
|
|
29361
|
-
const soulTarget =
|
|
29572
|
+
const soulTarget = resolve21(packageRoleSoulPath(packageRoot, role));
|
|
29362
29573
|
if (!await pathExists2(soulTarget)) {
|
|
29363
29574
|
throw new Error(`packaged role soul missing: ${soulTarget}`);
|
|
29364
29575
|
}
|
|
29365
|
-
const profilesRoot =
|
|
29366
|
-
const profileDir =
|
|
29367
|
-
const hostRoot =
|
|
29368
|
-
const soulPath =
|
|
29576
|
+
const profilesRoot = join48(operatorHome, ...spec.profilesRootFromHome);
|
|
29577
|
+
const profileDir = join48(profilesRoot, profileName);
|
|
29578
|
+
const hostRoot = dirname24(profilesRoot);
|
|
29579
|
+
const soulPath = join48(profileDir, spec.soulFileName);
|
|
29369
29580
|
if (!await pathExists2(profileDir)) {
|
|
29370
29581
|
await mkdir6(profileDir, { recursive: true });
|
|
29371
29582
|
for (const name of ["auth.json", ".env", "config.yaml"]) {
|
|
29372
|
-
const source =
|
|
29583
|
+
const source = join48(hostRoot, name);
|
|
29373
29584
|
if (!await pathExists2(source)) continue;
|
|
29374
|
-
await copyFile(source,
|
|
29585
|
+
await copyFile(source, join48(profileDir, name));
|
|
29375
29586
|
}
|
|
29376
29587
|
} else {
|
|
29377
29588
|
await mkdir6(profileDir, { recursive: true });
|