@akagilnc/pi-workflow-roles 0.1.5068 → 0.1.5096
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 +429 -383
- package/dist/atomic-write.js +13 -19
- package/dist/auditor-soul.js +2 -1
- package/dist/compliance-transport.js +3 -2
- package/dist/countersign-contracts.js +2 -2
- package/dist/doctor-contracts.js +1 -1
- package/dist/gatekeeper-role.js +14 -35
- package/dist/headless-host/production-host.js +461 -415
- package/dist/inspector-contracts.js +5 -2
- package/dist/merger-contracts.js +1 -1
- package/dist/migrate-book-topology.js +49 -33
- 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/open-tool-schema.js +4 -1
- package/dist/package-contracts/fixer-output.js +1 -1
- package/dist/package-contracts/gatekeeper-output.js +1 -1
- package/dist/package-contracts/judge-output.js +2 -2
- package/dist/package-contracts/navigator-output.js +1 -1
- package/dist/package-contracts/terminating-infrastructure.js +7 -4
- package/dist/packaged-role-registry.js +9 -5
- package/dist/public-cli/countersign-run.js +1 -1
- package/dist/public-cli/invocation.js +6 -3
- package/dist/public-cli/main.js +78 -41
- package/dist/public-cli/settlement.js +20 -1
- package/dist/receipt-delivery-policy.js +9 -2
- package/dist/review-submission.js +19 -8
- package/dist/submission-errors.js +17 -0
- package/dist/submission-ledger.js +18 -6
- 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/compliance-transport.ts +3 -2
- package/src/countersign-contracts.ts +2 -2
- package/src/countersign-role.ts +3 -7
- package/src/diarist-role.ts +2 -2
- package/src/doctor-contracts.ts +1 -1
- package/src/gatekeeper-role.ts +15 -36
- package/src/gleaner-left-role.ts +2 -2
- package/src/inspector-contracts.ts +5 -2
- package/src/inspector-role.ts +1 -1
- package/src/judge-role.ts +14 -22
- 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/open-tool-schema.ts +9 -4
- package/src/package-contracts/fixer-output.ts +1 -1
- package/src/package-contracts/gatekeeper-output.ts +3 -3
- package/src/package-contracts/judge-output.ts +2 -4
- package/src/package-contracts/navigator-output.ts +1 -1
- package/src/package-contracts/terminating-infrastructure.ts +12 -10
- package/src/packaged-role-registry.ts +5 -1
- package/src/public-cli/countersign-run.ts +1 -1
- package/src/public-cli/invocation.ts +6 -3
- package/src/public-cli/settlement.ts +21 -0
- package/src/receipt-delivery-policy.ts +9 -1
- package/src/review-submission.ts +24 -10
- package/src/reviewer-role.ts +3 -3
- package/src/role-runtime-dependencies.ts +1 -5
- package/src/role-runtime.ts +61 -63
- package/src/secretariat-role.ts +3 -3
- package/src/submission-errors.ts +16 -0
- package/src/submission-gate.ts +2 -1
- package/src/submission-ledger.ts +23 -11
- package/src/worker-role.ts +7 -9
|
@@ -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(
|
|
@@ -2165,6 +2165,15 @@ ${serializeReceipt(result.submission)}`;
|
|
|
2165
2165
|
}
|
|
2166
2166
|
return `\u95E8\u4E0B\u7701 ${result.status}\uFF08${result.stage}\uFF09\uFF1A${result.reason}`;
|
|
2167
2167
|
}
|
|
2168
|
+
function unreadableDiscriminatorNotice(field, received) {
|
|
2169
|
+
if (received === void 0) return `\u8BFB\u4E0D\u51FA ${field}`;
|
|
2170
|
+
return `\u8BFB\u4E0D\u51FA ${field}\uFF1A${readableGateItem(received)}`;
|
|
2171
|
+
}
|
|
2172
|
+
function receivedDiscriminator(receipt, field) {
|
|
2173
|
+
if (receipt === null || typeof receipt !== "object" || Array.isArray(receipt)) return void 0;
|
|
2174
|
+
if (!Object.hasOwn(receipt, field)) return void 0;
|
|
2175
|
+
return receipt[field];
|
|
2176
|
+
}
|
|
2168
2177
|
var GatekeeperDecisionError, WorkerCommitReminderError, WorkerPrefixReminderError, WorkerUnfinishedReasonReminderError, ParentQueueReaskError;
|
|
2169
2178
|
var init_submission_errors = __esm({
|
|
2170
2179
|
"src/submission-errors.ts"() {
|
|
@@ -3141,7 +3150,10 @@ function openToolObjectFromUnion(schema) {
|
|
|
3141
3150
|
}
|
|
3142
3151
|
function openToolObject(schema) {
|
|
3143
3152
|
const object = Type2.Object(
|
|
3144
|
-
Object.fromEntries(Object.entries(schema.properties).map(([name, declaration]) => [
|
|
3153
|
+
Object.fromEntries(Object.entries(schema.properties).map(([name, declaration]) => [
|
|
3154
|
+
name,
|
|
3155
|
+
Type2.Optional(described(name, declaration))
|
|
3156
|
+
])),
|
|
3145
3157
|
{ additionalProperties: true }
|
|
3146
3158
|
);
|
|
3147
3159
|
object.required = [];
|
|
@@ -3161,13 +3173,15 @@ function withTerminatingOutputDeclarations(schema) {
|
|
|
3161
3173
|
...baseProperties ?? {},
|
|
3162
3174
|
...baseProperties?.ticketNumber === void 0 ? {
|
|
3163
3175
|
ticketNumber: Type3.Unknown({
|
|
3164
|
-
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"
|
|
3165
3177
|
})
|
|
3166
3178
|
} : {},
|
|
3167
3179
|
[INFRASTRUCTURE_FAILURE_DECLARATION_KEY]: infrastructureFailureDeclarationSchema.properties[INFRASTRUCTURE_FAILURE_DECLARATION_KEY]
|
|
3168
3180
|
};
|
|
3169
3181
|
const object = Type3.Object(properties, { additionalProperties: true });
|
|
3170
|
-
|
|
3182
|
+
const incoming = schema.required;
|
|
3183
|
+
const preserved = Array.isArray(incoming) ? incoming.filter((key) => typeof key === "string" && Object.hasOwn(properties, key)) : [];
|
|
3184
|
+
object.required = preserved;
|
|
3171
3185
|
return object;
|
|
3172
3186
|
}
|
|
3173
3187
|
function isInfrastructureFailureDeclaration(parameters) {
|
|
@@ -3216,12 +3230,12 @@ var init_terminating_infrastructure = __esm({
|
|
|
3216
3230
|
infrastructureFailureNested = Type3.Object(
|
|
3217
3231
|
{
|
|
3218
3232
|
[INFRASTRUCTURE_FAILURE_DIAGNOSTIC_KEY]: Type3.Unknown({
|
|
3219
|
-
description: "\
|
|
3233
|
+
description: "\u57FA\u7840\u8BBE\u65BD\u5931\u8D25\u8BCA\u65AD\u5B57\u7B26\u4E32\u3002"
|
|
3220
3234
|
})
|
|
3221
3235
|
},
|
|
3222
3236
|
{
|
|
3223
3237
|
additionalProperties: true,
|
|
3224
|
-
description: "\u57FA\u7840\u8BBE\u65BD\u771F\u5B9E\u5931\u8D25\
|
|
3238
|
+
description: "\u4EC5\u57FA\u7840\u8BBE\u65BD\u771F\u5B9E\u5931\u8D25\u65F6\u51FA\u73B0\u3002"
|
|
3225
3239
|
}
|
|
3226
3240
|
);
|
|
3227
3241
|
infrastructureFailureNested.required = [];
|
|
@@ -3246,7 +3260,7 @@ var init_gatekeeper_output = __esm({
|
|
|
3246
3260
|
gatekeeperDecisionSchema = openToolObject(
|
|
3247
3261
|
Type4.Object({
|
|
3248
3262
|
status: Type4.Unknown({
|
|
3249
|
-
description: "dispatch | pass
|
|
3263
|
+
description: "dispatch | pass"
|
|
3250
3264
|
}),
|
|
3251
3265
|
officer: Type4.Unknown({
|
|
3252
3266
|
description: "status \u4E3A dispatch \u65F6\u4E3A inspector | notary"
|
|
@@ -3315,7 +3329,7 @@ var init_navigator_output = __esm({
|
|
|
3315
3329
|
openToolObject(
|
|
3316
3330
|
Type5.Object({
|
|
3317
3331
|
prose: Type5.Unknown({
|
|
3318
|
-
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"
|
|
3319
3333
|
})
|
|
3320
3334
|
})
|
|
3321
3335
|
)
|
|
@@ -3325,51 +3339,41 @@ var init_navigator_output = __esm({
|
|
|
3325
3339
|
|
|
3326
3340
|
// src/review-submission.ts
|
|
3327
3341
|
import { Type as Type6 } from "typebox";
|
|
3328
|
-
var REVIEW_SUBMISSION_OUTPUT_TOOL_NAME, reviewSubmissionSchema;
|
|
3342
|
+
var REVIEW_SUBMISSION_OUTPUT_TOOL_NAME, REVIEW_QUEUE_WORDS, REVIEW_QUEUE_STATUSES, reviewSubmissionSchema;
|
|
3329
3343
|
var init_review_submission = __esm({
|
|
3330
3344
|
"src/review-submission.ts"() {
|
|
3331
3345
|
"use strict";
|
|
3332
|
-
init_open_tool_schema();
|
|
3333
3346
|
init_terminating_infrastructure();
|
|
3334
3347
|
REVIEW_SUBMISSION_OUTPUT_TOOL_NAME = "ak_submission_output";
|
|
3348
|
+
REVIEW_QUEUE_WORDS = ["converged", "continue", "escalate"];
|
|
3349
|
+
REVIEW_QUEUE_STATUSES = new Set(REVIEW_QUEUE_WORDS);
|
|
3335
3350
|
reviewSubmissionSchema = withTerminatingOutputDeclarations(
|
|
3336
|
-
|
|
3337
|
-
Type6.
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
})
|
|
3351
|
-
|
|
3351
|
+
Type6.Object({
|
|
3352
|
+
status: Type6.Union(
|
|
3353
|
+
[
|
|
3354
|
+
Type6.Literal(REVIEW_QUEUE_WORDS[0]),
|
|
3355
|
+
Type6.Literal(REVIEW_QUEUE_WORDS[1]),
|
|
3356
|
+
Type6.Literal(REVIEW_QUEUE_WORDS[2])
|
|
3357
|
+
],
|
|
3358
|
+
{
|
|
3359
|
+
description: "\u5BA1\u6838\u5E2D\u672C\u8F6E\u88C1\u51B3\u7684\u5224\u522B\u72B6\u6001\u3002"
|
|
3360
|
+
}
|
|
3361
|
+
),
|
|
3362
|
+
findings: Type6.Optional(Type6.Unknown({ description: "\u5BA1\u6838\u53D1\u73B0\uFF0C\u539F\u6837\u7559\u5B58" })),
|
|
3363
|
+
reason: Type6.Optional(Type6.Unknown({ description: "\u4E0A\u5448\u7406\u7531" })),
|
|
3364
|
+
violations: Type6.Optional(Type6.Unknown({ description: "\u8FDD\u89C4\u6761\u76EE" })),
|
|
3365
|
+
conflicts: Type6.Optional(Type6.Unknown({ description: "\u5F85\u51B3\u51B2\u7A81" })),
|
|
3366
|
+
fix: Type6.Optional(Type6.Unknown({ description: "continue \u65F6\u7684\u8865\u6551\u8BF4\u660E\uFF1B\u53EF\u5199 summary \u6458\u8981\uFF0C\u5176\u4F59\u5185\u5BB9\u539F\u6837\u7559\u5B58" })),
|
|
3367
|
+
classes: Type6.Optional(Type6.Unknown({ description: "\u5DF2\u88C1\u51B3 finding \u7C7B\uFF1B\u53EF\u8BF4\u660E name\u3001owner\u3001boundary\u3001disposition\uFF0C\u539F\u6837\u7559\u5B58" })),
|
|
3368
|
+
note: Type6.Optional(Type6.Unknown({ description: "\u88C1\u51B3\u9644\u6CE8" })),
|
|
3369
|
+
evidence: Type6.Optional(Type6.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
3370
|
+
decisionGate: Type6.Optional(Type6.Unknown({ description: "\u9700\u4EBA\u6743\u5A01\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879\uFF1B\u53EF\u8BF4\u660E question\u3001options\uFF0C\u539F\u6837\u7559\u5B58" }))
|
|
3371
|
+
}, { additionalProperties: true })
|
|
3352
3372
|
);
|
|
3353
3373
|
}
|
|
3354
3374
|
});
|
|
3355
3375
|
|
|
3356
3376
|
// src/package-contracts/judge-output.ts
|
|
3357
|
-
function validateAcceptedJudgeDetails(verdict) {
|
|
3358
|
-
if (verdict === null || typeof verdict !== "object" || Array.isArray(verdict)) throw new Error("Judge verdict has no execution discriminator");
|
|
3359
|
-
let status;
|
|
3360
|
-
try {
|
|
3361
|
-
status = verdict.status;
|
|
3362
|
-
} catch {
|
|
3363
|
-
throw new Error("Judge verdict has no execution discriminator");
|
|
3364
|
-
}
|
|
3365
|
-
if (typeof status !== "string") {
|
|
3366
|
-
throw new Error("Judge verdict has no execution discriminator");
|
|
3367
|
-
}
|
|
3368
|
-
if (["converged", "continue", "escalate"].includes(status)) {
|
|
3369
|
-
return verdict;
|
|
3370
|
-
}
|
|
3371
|
-
throw new Error("Judge verdict has no execution discriminator");
|
|
3372
|
-
}
|
|
3373
3377
|
var JUDGE_OUTPUT_TOOL_NAME;
|
|
3374
3378
|
var init_judge_output = __esm({
|
|
3375
3379
|
"src/package-contracts/judge-output.ts"() {
|
|
@@ -3425,7 +3429,7 @@ var init_fixer_output = __esm({
|
|
|
3425
3429
|
});
|
|
3426
3430
|
classResultSchema = Type7.Union([completedClassResultSchema, refusedClassResultSchema]);
|
|
3427
3431
|
completedClassResultsSchema = Type7.Array(completedClassResultSchema);
|
|
3428
|
-
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";
|
|
3429
3433
|
fixerOutputVariants = Type7.Union([
|
|
3430
3434
|
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }) }),
|
|
3431
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" }) }),
|
|
@@ -3585,7 +3589,7 @@ var init_doctor_contracts = __esm({
|
|
|
3585
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 })
|
|
3586
3590
|
]);
|
|
3587
3591
|
caseIdentity = Type9.Object({ issueNumber: Type9.Optional(Type9.Integer()), runsPath: nonblank }, { additionalProperties: true });
|
|
3588
|
-
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";
|
|
3589
3593
|
doctorSubmissionVariants = Type9.Union([
|
|
3590
3594
|
Type9.Object({
|
|
3591
3595
|
status: Type9.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
|
|
@@ -3711,7 +3715,7 @@ var init_merger_contracts = __esm({
|
|
|
3711
3715
|
resolutionScope: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
|
|
3712
3716
|
authorizedChecks: Type10.Array(checkSchema)
|
|
3713
3717
|
}, { additionalProperties: false });
|
|
3714
|
-
MERGER_STATUS_DESCRIPTION = "completed | escalate
|
|
3718
|
+
MERGER_STATUS_DESCRIPTION = "completed | escalate";
|
|
3715
3719
|
mergerOutputVariants = Type10.Union([
|
|
3716
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 }),
|
|
3717
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 })
|
|
@@ -3732,7 +3736,7 @@ var init_merger_contracts = __esm({
|
|
|
3732
3736
|
});
|
|
3733
3737
|
|
|
3734
3738
|
// src/notary-contracts.ts
|
|
3735
|
-
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;
|
|
3736
3740
|
var init_notary_contracts = __esm({
|
|
3737
3741
|
"src/notary-contracts.ts"() {
|
|
3738
3742
|
"use strict";
|
|
@@ -3752,7 +3756,6 @@ var init_notary_contracts = __esm({
|
|
|
3752
3756
|
type: "string"
|
|
3753
3757
|
}
|
|
3754
3758
|
};
|
|
3755
|
-
NOTARY_FIXED_KICKOFF = "\u7B26\u5B9D\u90CE\u6848\u5377\u5DF2\u53D7\u7406\uFF1B\u6765\u6E90 run \u5B9A\u4F4D\u89C1\u4F1A\u8BDD\u6750\u6599\u3002";
|
|
3756
3759
|
notaryOutputSchema = reviewSubmissionSchema;
|
|
3757
3760
|
}
|
|
3758
3761
|
});
|
|
@@ -4249,21 +4252,24 @@ var init_packaged_role_registry = __esm({
|
|
|
4249
4252
|
"souls/notary.md",
|
|
4250
4253
|
"souls/audit-law.md",
|
|
4251
4254
|
"souls/ticket-law.md",
|
|
4252
|
-
"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"
|
|
4253
4257
|
];
|
|
4254
4258
|
INSPECTOR_SESSION_MATERIALS = [
|
|
4255
4259
|
"CLAUDE.md",
|
|
4256
4260
|
"souls/inspector.md",
|
|
4257
4261
|
"souls/audit-law.md",
|
|
4258
4262
|
"souls/quality-law.md",
|
|
4259
|
-
"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"
|
|
4260
4265
|
];
|
|
4261
4266
|
AUDITOR_PUBLIC_SESSION_MATERIALS = [
|
|
4262
4267
|
"CLAUDE.md",
|
|
4263
4268
|
"souls/judge-auditor.md",
|
|
4264
4269
|
"souls/doctor-auditor.md",
|
|
4265
4270
|
"souls/audit-law.md",
|
|
4266
|
-
"souls/quality-law.md"
|
|
4271
|
+
"souls/quality-law.md",
|
|
4272
|
+
"docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"
|
|
4267
4273
|
];
|
|
4268
4274
|
PUBLIC_ROLE_RECORDS = [
|
|
4269
4275
|
{
|
|
@@ -4291,7 +4297,8 @@ var init_packaged_role_registry = __esm({
|
|
|
4291
4297
|
"souls/judge.md",
|
|
4292
4298
|
"souls/audit-law.md",
|
|
4293
4299
|
"souls/quality-law.md",
|
|
4294
|
-
"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"
|
|
4295
4302
|
]
|
|
4296
4303
|
},
|
|
4297
4304
|
{
|
|
@@ -4569,7 +4576,7 @@ var init_packaged_role_registry = __esm({
|
|
|
4569
4576
|
activationStage: "load-and-install",
|
|
4570
4577
|
receiptStatusKey: "status",
|
|
4571
4578
|
// #924: 公用《票面法》三席同装
|
|
4572
|
-
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"]
|
|
4573
4580
|
},
|
|
4574
4581
|
{
|
|
4575
4582
|
role: "secretariat",
|
|
@@ -4935,10 +4942,7 @@ function readRecord(value) {
|
|
|
4935
4942
|
return value;
|
|
4936
4943
|
}
|
|
4937
4944
|
function reviewQueueStatus(status) {
|
|
4938
|
-
|
|
4939
|
-
if (status === "continue") return "continue";
|
|
4940
|
-
if (status === "escalate") return "escalate";
|
|
4941
|
-
return void 0;
|
|
4945
|
+
return REVIEW_QUEUE_STATUSES.has(status) ? status : void 0;
|
|
4942
4946
|
}
|
|
4943
4947
|
function projectOfficerDecision(officer, decision, fallbackStatus) {
|
|
4944
4948
|
const receipt = retainedReceipt(decision);
|
|
@@ -4951,7 +4955,7 @@ function projectOfficerDecision(officer, decision, fallbackStatus) {
|
|
|
4951
4955
|
if (queueStatus === "continue" || queueStatus === "escalate") {
|
|
4952
4956
|
return { status: queueStatus, officer, receipt };
|
|
4953
4957
|
}
|
|
4954
|
-
return { status: "needs_reask", officer, receipt };
|
|
4958
|
+
return { status: "needs_reask", officer, receipt, receivedStatus: status };
|
|
4955
4959
|
}
|
|
4956
4960
|
function thisCourtOfficerPayloads(terminal) {
|
|
4957
4961
|
const outcome = terminal?.roleOutcome;
|
|
@@ -5037,18 +5041,20 @@ function projectOfficerTerminal(officer, summoned) {
|
|
|
5037
5041
|
summoned
|
|
5038
5042
|
);
|
|
5039
5043
|
}
|
|
5044
|
+
const receipt = thisCourt.length > 0 ? thisCourt[thisCourt.length - 1] : retainedReceipt(outcome);
|
|
5040
5045
|
return withOfficerRunId(
|
|
5041
5046
|
{
|
|
5042
5047
|
status: "needs_reask",
|
|
5043
5048
|
officer,
|
|
5044
5049
|
// This-court receipt only (#879).
|
|
5045
|
-
receipt
|
|
5050
|
+
receipt,
|
|
5051
|
+
receivedStatus: receivedDiscriminator(receipt, "status")
|
|
5046
5052
|
},
|
|
5047
5053
|
summoned
|
|
5048
5054
|
);
|
|
5049
5055
|
}
|
|
5050
|
-
function officerConclusionReask(
|
|
5051
|
-
return
|
|
5056
|
+
function officerConclusionReask(received) {
|
|
5057
|
+
return unreadableDiscriminatorNotice("status", received);
|
|
5052
5058
|
}
|
|
5053
5059
|
async function projectGatekeeperRun(options) {
|
|
5054
5060
|
const officer = gateOfficerForSubject(options.subject);
|
|
@@ -5084,7 +5090,7 @@ async function projectGatekeeperRun(options) {
|
|
|
5084
5090
|
summoned
|
|
5085
5091
|
};
|
|
5086
5092
|
}
|
|
5087
|
-
var GATE_OFFICER_BY_SUBJECT, GATEKEEPER_TOOL_SPEC
|
|
5093
|
+
var GATE_OFFICER_BY_SUBJECT, GATEKEEPER_TOOL_SPEC;
|
|
5088
5094
|
var init_gatekeeper_role = __esm({
|
|
5089
5095
|
"src/gatekeeper-role.ts"() {
|
|
5090
5096
|
"use strict";
|
|
@@ -5106,11 +5112,10 @@ var init_gatekeeper_role = __esm({
|
|
|
5106
5112
|
GATEKEEPER_TOOL_SPEC = {
|
|
5107
5113
|
name: GATEKEEPER_OUTPUT_TOOL_NAME,
|
|
5108
5114
|
label: "\u95E8\u4E0B\u7701\u51B3\u8BAE",
|
|
5109
|
-
description: "\u95E8\u4E0B\u7701\u7EC8\u5C40\u51B3\u8BAE\
|
|
5115
|
+
description: "\u95E8\u4E0B\u7701\u7EC8\u5C40\u51B3\u8BAE\u3002status \u4E3A dispatch \u6216 pass\u3002",
|
|
5110
5116
|
promptSnippet: "\u95E8\u4E0B\u7701\u51B3\u8BAE",
|
|
5111
5117
|
parameters: gatekeeperOutputSchema
|
|
5112
5118
|
};
|
|
5113
|
-
OFFICER_CONCLUSION_REASK = "\u4E0A\u6B21\u4EA4\u5377\u7684 status \u4E0D\u662F converged\u3001continue\u3001escalate \u4E09\u6001\u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u8F93\u51FA\uFF0Cstatus \u5199\u660E\u5176\u4E00\uFF1Bcontinue \u6216 escalate \u7684\u8BDD\u5C31\u662F\u7ED9\u5BF9\u65B9\u770B\u7684\u539F\u6587\u3002";
|
|
5114
5119
|
}
|
|
5115
5120
|
});
|
|
5116
5121
|
|
|
@@ -5123,10 +5128,10 @@ __export(session_assistant_usage_exports, {
|
|
|
5123
5128
|
});
|
|
5124
5129
|
import { join as join9 } from "node:path";
|
|
5125
5130
|
async function readAssistantUsageFromSessionFile(sessionFile) {
|
|
5126
|
-
const { readFile:
|
|
5131
|
+
const { readFile: readFile26 } = await import("node:fs/promises");
|
|
5127
5132
|
let text;
|
|
5128
5133
|
try {
|
|
5129
|
-
text = await
|
|
5134
|
+
text = await readFile26(sessionFile, "utf8");
|
|
5130
5135
|
} catch (error) {
|
|
5131
5136
|
if (error?.code === "ENOENT") return void 0;
|
|
5132
5137
|
throw error;
|
|
@@ -6427,7 +6432,7 @@ async function runComplianceAudit(options) {
|
|
|
6427
6432
|
const summoned = await summon(subject, runDirectory, options.signal, reask, submission);
|
|
6428
6433
|
const decision = await projectAuditorTerminal(summoned);
|
|
6429
6434
|
if (decision.status === "received") {
|
|
6430
|
-
reask =
|
|
6435
|
+
reask = officerConclusionReask(receivedDiscriminator(decision.reply, "status"));
|
|
6431
6436
|
continue;
|
|
6432
6437
|
}
|
|
6433
6438
|
return decision;
|
|
@@ -6439,6 +6444,7 @@ var init_compliance_transport = __esm({
|
|
|
6439
6444
|
"use strict";
|
|
6440
6445
|
init_auditor_dossier_tool();
|
|
6441
6446
|
init_gatekeeper_role();
|
|
6447
|
+
init_submission_errors();
|
|
6442
6448
|
init_terminal();
|
|
6443
6449
|
init_readable_gate_item();
|
|
6444
6450
|
AUDITOR_DOSSIER_PROMPT = "\u5377\u5B97\u6307\u9488\uFF1A";
|
|
@@ -11795,13 +11801,16 @@ function admittedTransportPromptKind(admitted) {
|
|
|
11795
11801
|
function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
11796
11802
|
const kind = admittedTransportPromptKind(admitted);
|
|
11797
11803
|
if (kind === "fixed-kickoff") {
|
|
11798
|
-
|
|
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");
|
|
11799
11808
|
}
|
|
11800
11809
|
if (kind === "baseline") {
|
|
11801
11810
|
if (admitted.baseRevision === void 0) {
|
|
11802
11811
|
throw new Error("baseline transport prompt is missing the bound revision");
|
|
11803
11812
|
}
|
|
11804
|
-
const lines2 = [
|
|
11813
|
+
const lines2 = [admitted.baseRevision];
|
|
11805
11814
|
if (!admitted.instructionEmpty) {
|
|
11806
11815
|
lines2.push("", admitted.instruction);
|
|
11807
11816
|
}
|
|
@@ -13382,10 +13391,10 @@ function pairGateRounds(volumes) {
|
|
|
13382
13391
|
return rounds.sort((a, b) => a.officerStartedAt.localeCompare(b.officerStartedAt)).map((round, index) => ({ ...round, roundIndex: index + 1 }));
|
|
13383
13392
|
}
|
|
13384
13393
|
async function resolveOfficerSessionFromPointerFile(pointerPath) {
|
|
13385
|
-
const { readFile:
|
|
13394
|
+
const { readFile: readFile26 } = await import("node:fs/promises");
|
|
13386
13395
|
let raw;
|
|
13387
13396
|
try {
|
|
13388
|
-
raw = JSON.parse(await
|
|
13397
|
+
raw = JSON.parse(await readFile26(pointerPath, "utf8"));
|
|
13389
13398
|
} catch (error) {
|
|
13390
13399
|
throw new Error(
|
|
13391
13400
|
`direct officer run pointer unreadable in ${pointerPath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -13919,17 +13928,20 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
13919
13928
|
});
|
|
13920
13929
|
let result;
|
|
13921
13930
|
try {
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13931
|
+
const reviewEscalate = tool.name === REVIEW_SUBMISSION_OUTPUT_TOOL_NAME && infrastructureFailureDiagnostic(params) !== void 0 && params !== null && typeof params === "object" && !Array.isArray(params) && params.status === "escalate";
|
|
13932
|
+
if (!reviewEscalate) {
|
|
13933
|
+
failOnInfrastructureFailureDeclaration(
|
|
13934
|
+
params,
|
|
13935
|
+
{
|
|
13936
|
+
failInfrastructure(error, ctx) {
|
|
13937
|
+
failInfrastructure2(error, ctx);
|
|
13938
|
+
}
|
|
13939
|
+
},
|
|
13940
|
+
context,
|
|
13941
|
+
toolCallId,
|
|
13942
|
+
tool.bounceInfrastructureDeclaration
|
|
13943
|
+
);
|
|
13944
|
+
}
|
|
13933
13945
|
result = await tool.execute(toolCallId, params, signal, update, context);
|
|
13934
13946
|
} catch (error) {
|
|
13935
13947
|
if (isCorrectableExecuteError(error)) {
|
|
@@ -14008,6 +14020,7 @@ var init_submission_ledger = __esm({
|
|
|
14008
14020
|
init_run_lifecycle();
|
|
14009
14021
|
init_submission_correctable_error();
|
|
14010
14022
|
init_terminating_infrastructure();
|
|
14023
|
+
init_review_submission();
|
|
14011
14024
|
}
|
|
14012
14025
|
});
|
|
14013
14026
|
|
|
@@ -14136,9 +14149,10 @@ var init_auditor_soul = __esm({
|
|
|
14136
14149
|
"CLAUDE.md",
|
|
14137
14150
|
"souls/judge-auditor.md",
|
|
14138
14151
|
"souls/audit-law.md",
|
|
14139
|
-
"souls/quality-law.md"
|
|
14152
|
+
"souls/quality-law.md",
|
|
14153
|
+
"docs/adr/0057-schema-narrowing-cuts-the-required-set-not-the-declared-set.md"
|
|
14140
14154
|
],
|
|
14141
|
-
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"]
|
|
14142
14156
|
};
|
|
14143
14157
|
}
|
|
14144
14158
|
});
|
|
@@ -14667,7 +14681,7 @@ function resolveLifecycleInvocationPrincipal(entries, expected) {
|
|
|
14667
14681
|
}
|
|
14668
14682
|
return { invocationId: marker.invocationId, resume: true };
|
|
14669
14683
|
}
|
|
14670
|
-
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;
|
|
14671
14685
|
var init_navigator_invocation_identity = __esm({
|
|
14672
14686
|
"src/navigator-invocation-identity.ts"() {
|
|
14673
14687
|
"use strict";
|
|
@@ -14675,6 +14689,7 @@ var init_navigator_invocation_identity = __esm({
|
|
|
14675
14689
|
init_uuidv7();
|
|
14676
14690
|
init_work_subject_identity();
|
|
14677
14691
|
NAVIGATOR_INVOCATION_ENTRY = "ak-navigator-invocation";
|
|
14692
|
+
NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY = "ak-navigator-route-playbook-failure";
|
|
14678
14693
|
NAVIGATOR_INFRASTRUCTURE_FAILURE_KIND = "role_infrastructure_failure";
|
|
14679
14694
|
NAVIGATOR_INFRASTRUCTURE_FAILURE_KEYS = [
|
|
14680
14695
|
"kind",
|
|
@@ -14768,17 +14783,25 @@ function createReceiptDeliveryPolicy() {
|
|
|
14768
14783
|
if (accepted) return "accepted";
|
|
14769
14784
|
return deliveryTurns < RECEIPT_DELIVERY_TURN_LIMIT ? "request-delivery" : "no-receipt";
|
|
14770
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
|
+
},
|
|
14771
14795
|
facts(binding) {
|
|
14772
14796
|
return noReceiptLifecycleFacts({ terminalToolCalled, rejectedReceipts: [...rejectedReceipts], deliveryTurns, ...binding });
|
|
14773
14797
|
}
|
|
14774
14798
|
};
|
|
14775
14799
|
}
|
|
14776
|
-
var RECEIPT_DELIVERY_TURN_LIMIT,
|
|
14800
|
+
var RECEIPT_DELIVERY_TURN_LIMIT, NO_RECEIPT_LIFECYCLE_ENTRY_TYPE;
|
|
14777
14801
|
var init_receipt_delivery_policy = __esm({
|
|
14778
14802
|
"src/receipt-delivery-policy.ts"() {
|
|
14779
14803
|
"use strict";
|
|
14780
14804
|
RECEIPT_DELIVERY_TURN_LIMIT = 2;
|
|
14781
|
-
RECEIPT_DELIVERY_PROMPT = "\u672C\u4F1A\u8BDD\u5C1A\u65E0\u5DF2\u63A5\u53D7\u7684 typed \u56DE\u6267\u3002";
|
|
14782
14805
|
NO_RECEIPT_LIFECYCLE_ENTRY_TYPE = "ak-no-receipt-lifecycle";
|
|
14783
14806
|
}
|
|
14784
14807
|
});
|
|
@@ -15899,7 +15922,23 @@ async function withOptionalGateProjection(base, sessionDirectory, gateContext =
|
|
|
15899
15922
|
}
|
|
15900
15923
|
return attachEngineDetourToolUsage(next, sessionDirectory, gateContext);
|
|
15901
15924
|
}
|
|
15925
|
+
function routePlaybookFailureMessage(entries) {
|
|
15926
|
+
for (let i = entries.length - 1; i >= 0; i -= 1) {
|
|
15927
|
+
const entry = entries[i];
|
|
15928
|
+
if (entry?.type !== "custom" || entry.customType !== NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY) continue;
|
|
15929
|
+
const data = entry.data;
|
|
15930
|
+
if (!isRecord12(data) || typeof data.message !== "string" || data.message.trim() === "") return void 0;
|
|
15931
|
+
return data.message;
|
|
15932
|
+
}
|
|
15933
|
+
return void 0;
|
|
15934
|
+
}
|
|
15902
15935
|
function extractNavigatorFact(entries) {
|
|
15936
|
+
const fact = extractNavigatorAttendanceFact(entries);
|
|
15937
|
+
if (fact.advisoryDiagnostic !== void 0) return fact;
|
|
15938
|
+
const message = routePlaybookFailureMessage(entries);
|
|
15939
|
+
return message === void 0 ? fact : { ...fact, advisoryDiagnostic: message };
|
|
15940
|
+
}
|
|
15941
|
+
function extractNavigatorAttendanceFact(entries) {
|
|
15903
15942
|
const terminal = findLatestDurablePackagedRoleTerminal(entries);
|
|
15904
15943
|
if (terminal === void 0) {
|
|
15905
15944
|
return {
|
|
@@ -16675,10 +16714,10 @@ function presentFailureTerminal(terminal, io) {
|
|
|
16675
16714
|
}
|
|
16676
16715
|
function defaultNavigatorGraceSleep() {
|
|
16677
16716
|
let timer;
|
|
16678
|
-
const sleep2 = ((ms) => new Promise((
|
|
16717
|
+
const sleep2 = ((ms) => new Promise((resolve22) => {
|
|
16679
16718
|
timer = setTimeout(() => {
|
|
16680
16719
|
timer = void 0;
|
|
16681
|
-
|
|
16720
|
+
resolve22();
|
|
16682
16721
|
}, ms);
|
|
16683
16722
|
}));
|
|
16684
16723
|
sleep2.cancel = () => {
|
|
@@ -16690,7 +16729,7 @@ function defaultNavigatorGraceSleep() {
|
|
|
16690
16729
|
return sleep2;
|
|
16691
16730
|
}
|
|
16692
16731
|
function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2 = defaultNavigatorGraceSleep()) {
|
|
16693
|
-
return new Promise((
|
|
16732
|
+
return new Promise((resolve22, reject) => {
|
|
16694
16733
|
let settled = false;
|
|
16695
16734
|
const finish = (action) => {
|
|
16696
16735
|
if (settled) return;
|
|
@@ -16699,11 +16738,11 @@ function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2
|
|
|
16699
16738
|
action();
|
|
16700
16739
|
};
|
|
16701
16740
|
void work.then(
|
|
16702
|
-
(value) => finish(() =>
|
|
16741
|
+
(value) => finish(() => resolve22({ status: "done", value })),
|
|
16703
16742
|
(error) => finish(() => reject(error))
|
|
16704
16743
|
);
|
|
16705
16744
|
void sleep2(graceMs).then(() => {
|
|
16706
|
-
finish(() =>
|
|
16745
|
+
finish(() => resolve22({ status: "timeout" }));
|
|
16707
16746
|
});
|
|
16708
16747
|
});
|
|
16709
16748
|
}
|
|
@@ -18746,7 +18785,7 @@ async function runCountersignCourtDiaristStation(admitted, env, io, afterTicketN
|
|
|
18746
18785
|
for (const ticketNumber of refreshTickets.slice(completedIndex + 1)) {
|
|
18747
18786
|
const outcome = await invokeCourtDiarist(
|
|
18748
18787
|
{
|
|
18749
|
-
instruction:
|
|
18788
|
+
instruction: admitted.instruction,
|
|
18750
18789
|
projectRoot: admitted.projectRoot,
|
|
18751
18790
|
failureLabel: `ticket #${ticketNumber}`,
|
|
18752
18791
|
correlationId: admitted.runId,
|
|
@@ -19493,8 +19532,8 @@ var init_atomic_write = __esm({
|
|
|
19493
19532
|
import { open as open3, readFile as readFile18, unlink as unlink5 } from "node:fs/promises";
|
|
19494
19533
|
import { dirname as dirname19, join as join36 } from "node:path";
|
|
19495
19534
|
function sleep(ms) {
|
|
19496
|
-
return new Promise((
|
|
19497
|
-
setTimeout(
|
|
19535
|
+
return new Promise((resolve22) => {
|
|
19536
|
+
setTimeout(resolve22, ms);
|
|
19498
19537
|
});
|
|
19499
19538
|
}
|
|
19500
19539
|
async function withAnalystLibraryIndexLock(ledgerHome, fn) {
|
|
@@ -23008,7 +23047,7 @@ init_engine_detour();
|
|
|
23008
23047
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
23009
23048
|
import { appendFile as appendFile3, mkdir as mkdir5, writeFile as writeFile11 } from "node:fs/promises";
|
|
23010
23049
|
import { createServer } from "node:net";
|
|
23011
|
-
import { dirname as
|
|
23050
|
+
import { dirname as dirname23, join as join45 } from "node:path";
|
|
23012
23051
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
23013
23052
|
|
|
23014
23053
|
// src/submission-gate.ts
|
|
@@ -23094,7 +23133,7 @@ async function requireSubmissionGate(options) {
|
|
|
23094
23133
|
};
|
|
23095
23134
|
}
|
|
23096
23135
|
if (gatekeeper.status === "needs_reask") {
|
|
23097
|
-
reask = officerConclusionReask(
|
|
23136
|
+
reask = officerConclusionReask(gatekeeper.receivedStatus);
|
|
23098
23137
|
continue;
|
|
23099
23138
|
}
|
|
23100
23139
|
if (gatekeeper.status === "transport_failure") {
|
|
@@ -23123,7 +23162,7 @@ init_submission_ledger();
|
|
|
23123
23162
|
init_collector_ledger();
|
|
23124
23163
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
23125
23164
|
import { readFileSync as readFileSync6, writeSync as writeSync3 } from "node:fs";
|
|
23126
|
-
import { join as
|
|
23165
|
+
import { join as join44 } from "node:path";
|
|
23127
23166
|
import { Value as Value5 } from "typebox/value";
|
|
23128
23167
|
|
|
23129
23168
|
// src/activation-trace.ts
|
|
@@ -23269,6 +23308,9 @@ function durableSessionPointer(sessionManager) {
|
|
|
23269
23308
|
// src/activation-ledger.ts
|
|
23270
23309
|
init_activation_ledger_topology();
|
|
23271
23310
|
|
|
23311
|
+
// src/role-runtime.ts
|
|
23312
|
+
init_session_opening_materials();
|
|
23313
|
+
|
|
23272
23314
|
// src/stderr-jsonl.ts
|
|
23273
23315
|
import { writeSync } from "node:fs";
|
|
23274
23316
|
var STDERR_JSONL_WRITE_RETRY_LIMIT = 100;
|
|
@@ -23602,10 +23644,10 @@ var collectorOpenWaitWindowArgsSchema = Type15.Object({
|
|
|
23602
23644
|
}, { additionalProperties: true });
|
|
23603
23645
|
var collectorBindTargetArgsSchema = Type15.Object({
|
|
23604
23646
|
prNumber: Type15.Optional(Type15.Unknown({
|
|
23605
|
-
description: "\
|
|
23647
|
+
description: "\u672C\u4ED3 PR \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002"
|
|
23606
23648
|
})),
|
|
23607
23649
|
issueNumber: Type15.Optional(Type15.Unknown({
|
|
23608
|
-
description: "\
|
|
23650
|
+
description: "\u672C\u4ED3 issue \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002"
|
|
23609
23651
|
}))
|
|
23610
23652
|
}, { additionalProperties: true });
|
|
23611
23653
|
var collectorFindingItemDeclaration = (() => {
|
|
@@ -23623,7 +23665,7 @@ var collectorFindingItemDeclaration = (() => {
|
|
|
23623
23665
|
},
|
|
23624
23666
|
{
|
|
23625
23667
|
additionalProperties: true,
|
|
23626
|
-
description: "\u5355\u6761 finding \u6307\u9488\uFF1AevidenceId
|
|
23668
|
+
description: "\u5355\u6761 finding \u6307\u9488\uFF1AevidenceId\uFF0C\u4EE5\u53CA\u53EF\u9009 category\u3001summary\u3002"
|
|
23627
23669
|
}
|
|
23628
23670
|
);
|
|
23629
23671
|
item.required = [];
|
|
@@ -23634,11 +23676,11 @@ var collectorOutputBaseSchema = openToolObject(
|
|
|
23634
23676
|
// No root type:array — host must not shape-reject non-array findings (#676 C).
|
|
23635
23677
|
// Nested item declarations ride `items` for registration preservation (ADR 0057).
|
|
23636
23678
|
findings: Type15.Unsafe({
|
|
23637
|
-
description: "\u672C\u6B21\u6536\u96C6\u5230\u7684\u9010\u6761 findings\
|
|
23679
|
+
description: "\u672C\u6B21\u6536\u96C6\u5230\u7684\u9010\u6761 findings \u6307\u9488\u3002",
|
|
23638
23680
|
items: collectorFindingItemDeclaration
|
|
23639
23681
|
}),
|
|
23640
23682
|
unfinishedReasons: Type15.Unknown({
|
|
23641
|
-
description: "\u672A\u5B8C\u6210\u539F\u56E0\
|
|
23683
|
+
description: "\u672A\u5B8C\u6210\u539F\u56E0\u3002"
|
|
23642
23684
|
})
|
|
23643
23685
|
})
|
|
23644
23686
|
);
|
|
@@ -23953,7 +23995,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
23953
23995
|
pi.registerTool({
|
|
23954
23996
|
name: COLLECTOR_BIND_TARGET_TOOL,
|
|
23955
23997
|
label: "\u901A\u8FDB\u53F8\u8BA4\u7968\u7ED1\u5B9A",
|
|
23956
|
-
description: "\
|
|
23998
|
+
description: "\u7ED1\u5B9A\u672C\u4ED3\u552F\u4E00 PR \u76EE\u6807\u3002",
|
|
23957
23999
|
promptSnippet: "\u7ED1\u5B9A\u89D2\u8272\u5224\u5B9A\u7684 issue/PR \u76EE\u6807",
|
|
23958
24000
|
parameters: bindSchema,
|
|
23959
24001
|
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
@@ -24030,7 +24072,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24030
24072
|
pi.registerTool({
|
|
24031
24073
|
name: COLLECTOR_OBSERVE_TOOL,
|
|
24032
24074
|
label: "\u901A\u8FDB\u53F8\u89C2\u5BDF",
|
|
24033
|
-
description: "\u6293\u53D6\u914D\u7F6E\u76EE\u6807\u7684
|
|
24075
|
+
description: "\u6293\u53D6\u914D\u7F6E\u76EE\u6807\u7684 GitHub PR \u8BC1\u636E\u3002",
|
|
24034
24076
|
promptSnippet: "\u6293\u53D6\u914D\u7F6E\u76EE\u6807 PR \u8BC1\u636E",
|
|
24035
24077
|
parameters: observeSchema,
|
|
24036
24078
|
async execute(toolCallId, _params, signal, _onUpdate, ctx) {
|
|
@@ -24060,7 +24102,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24060
24102
|
pi.registerTool({
|
|
24061
24103
|
name: COLLECTOR_READ_TOOL,
|
|
24062
24104
|
label: "\u901A\u8FDB\u53F8\u5F00\u5377",
|
|
24063
|
-
description: "\u6309 evidenceId \u5F00\u5377\u8BFB\u53D6\u4E00\u6761\u5DF2\u89C2\u6D4B\u6750\u6599\u7684\u5168\u91CF\u6B63\u6587\u4E0E\u6307\u9488\
|
|
24105
|
+
description: "\u6309 evidenceId \u5F00\u5377\u8BFB\u53D6\u4E00\u6761\u5DF2\u89C2\u6D4B\u6750\u6599\u7684\u5168\u91CF\u6B63\u6587\u4E0E\u6307\u9488\u3002",
|
|
24064
24106
|
promptSnippet: "\u6309\u6307\u9488\u5F00\u5377\u8BFB\u6750\u6599",
|
|
24065
24107
|
parameters: readSchema,
|
|
24066
24108
|
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
@@ -24090,7 +24132,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24090
24132
|
pi.registerTool({
|
|
24091
24133
|
name: COLLECTOR_REQUEST_TOOL,
|
|
24092
24134
|
label: "\u901A\u8FDB\u53F8\u8BF7\u6C42",
|
|
24093
|
-
description: "\
|
|
24135
|
+
description: "\u53D1\u4E00\u6B21\u8BF7\u6C42\u3002",
|
|
24094
24136
|
promptSnippet: "\u53D1\u4E00\u6B21\u8BC4\u5BA1\u8BF7\u6C42",
|
|
24095
24137
|
parameters: requestSchema,
|
|
24096
24138
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
@@ -24209,7 +24251,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24209
24251
|
pi.registerTool({
|
|
24210
24252
|
name: COLLECTOR_WAIT_TOOL,
|
|
24211
24253
|
label: "\u901A\u8FDB\u53F8\u7B49\u5F85",
|
|
24212
|
-
description: "\
|
|
24254
|
+
description: "\u7B49\u5F85\u3002\u5B9E\u9645\u7761\u7720\u4E0D\u8D85\u8FC7\u5269\u4F59\u7B49\u5F85\u7A97\u3002",
|
|
24213
24255
|
promptSnippet: "\u7B49\u5F85\u7A97\u5185\u7B49\u5F85",
|
|
24214
24256
|
parameters: waitSchema,
|
|
24215
24257
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
@@ -24239,7 +24281,7 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24239
24281
|
pi.registerTool({
|
|
24240
24282
|
name: COLLECTOR_OUTPUT_TOOL,
|
|
24241
24283
|
label: "\u901A\u8FDB\u53F8\u8F93\u51FA",
|
|
24242
|
-
description: "\
|
|
24284
|
+
description: "\u63D0\u4EA4\u901A\u8FDB\u53F8\u56DE\u6267\u3002",
|
|
24243
24285
|
promptSnippet: "\u63D0\u4EA4\u901A\u8FDB\u53F8\u56DE\u6267",
|
|
24244
24286
|
parameters: outputSchema,
|
|
24245
24287
|
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
@@ -24504,7 +24546,7 @@ var gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
|
|
|
24504
24546
|
openToolObject(
|
|
24505
24547
|
Type16.Object({
|
|
24506
24548
|
status: Type16.Unknown({
|
|
24507
|
-
description: "completed
|
|
24549
|
+
description: "completed"
|
|
24508
24550
|
}),
|
|
24509
24551
|
findings: Type16.Array(
|
|
24510
24552
|
Type16.Object(
|
|
@@ -24555,7 +24597,7 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
|
24555
24597
|
openToolObject(
|
|
24556
24598
|
Type17.Object({
|
|
24557
24599
|
status: Type17.Unknown({
|
|
24558
|
-
description: "completed | escalate
|
|
24600
|
+
description: "completed | escalate"
|
|
24559
24601
|
}),
|
|
24560
24602
|
ticketNumber: Type17.Optional(
|
|
24561
24603
|
Type17.Unknown({
|
|
@@ -24641,7 +24683,7 @@ var secretariatVerdictSchema = withTerminatingOutputDeclarations(
|
|
|
24641
24683
|
Type18.Object(
|
|
24642
24684
|
{
|
|
24643
24685
|
secretariatStatus: Type18.Unknown({
|
|
24644
|
-
description: "converged | escalate
|
|
24686
|
+
description: "converged | escalate"
|
|
24645
24687
|
}),
|
|
24646
24688
|
ticketNumber: Type18.Optional(
|
|
24647
24689
|
Type18.Number({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
|
|
@@ -24665,7 +24707,7 @@ secretariatVerdictSchema.required = [];
|
|
|
24665
24707
|
var SECRETARIAT_OUTPUT_TOOL_SPEC = {
|
|
24666
24708
|
name: SECRETARIAT_OUTPUT_TOOL_NAME,
|
|
24667
24709
|
label: "\u4E2D\u4E66\u7701\u8F93\u51FA",
|
|
24668
|
-
description: "\u4E2D\u4E66\u7701\u7EC8\u5C40\u56DE\u6267\
|
|
24710
|
+
description: "\u4E2D\u4E66\u7701\u7EC8\u5C40\u56DE\u6267\u3002",
|
|
24669
24711
|
promptSnippet: "\u4E2D\u4E66\u7701\u7EC8\u5C40\u56DE\u6267",
|
|
24670
24712
|
parameters: secretariatVerdictSchema
|
|
24671
24713
|
};
|
|
@@ -24721,13 +24763,14 @@ import { createHash as createHash9 } from "node:crypto";
|
|
|
24721
24763
|
init_navigator_invocation_identity();
|
|
24722
24764
|
init_packaged_role_registry();
|
|
24723
24765
|
init_activation_ledger_topology();
|
|
24724
|
-
import { resolve as
|
|
24766
|
+
import { resolve as resolve18 } from "node:path";
|
|
24725
24767
|
import "@earendil-works/pi-coding-agent";
|
|
24726
24768
|
import { Type as Type20 } from "typebox";
|
|
24727
24769
|
|
|
24728
24770
|
// src/navigator-public-session.ts
|
|
24729
24771
|
init_sitian_facade();
|
|
24730
|
-
import {
|
|
24772
|
+
import { existsSync as existsSync13 } from "node:fs";
|
|
24773
|
+
import { basename as basename10 } from "node:path";
|
|
24731
24774
|
|
|
24732
24775
|
// src/navigator-session-contracts.ts
|
|
24733
24776
|
import { Type as Type19 } from "typebox";
|
|
@@ -24917,6 +24960,113 @@ async function resolveNavigatorSeatSelection(context) {
|
|
|
24917
24960
|
init_host_contracts();
|
|
24918
24961
|
init_cli_errors();
|
|
24919
24962
|
init_packaged_role_registry();
|
|
24963
|
+
|
|
24964
|
+
// src/navigator-work-base.ts
|
|
24965
|
+
init_atomic_write();
|
|
24966
|
+
import { existsSync as existsSync12, realpathSync as realpathSync4 } from "node:fs";
|
|
24967
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
24968
|
+
import { basename as basename9, dirname as dirname21, join as join42, resolve as resolve17 } from "node:path";
|
|
24969
|
+
var NAVIGATOR_WORK_CONTEXT_BASENAME = "work-context.json";
|
|
24970
|
+
function navigatorWorkContextFile(sessionDir) {
|
|
24971
|
+
return join42(sessionDir, NAVIGATOR_WORK_CONTEXT_BASENAME);
|
|
24972
|
+
}
|
|
24973
|
+
function isNavigatorWorkContextFile(path) {
|
|
24974
|
+
const resolved = resolve17(path);
|
|
24975
|
+
if (basename9(resolved) !== NAVIGATOR_WORK_CONTEXT_BASENAME) return false;
|
|
24976
|
+
const nest = dirname21(resolved);
|
|
24977
|
+
if (!/^[0-9a-f]{32}$/.test(basename9(nest))) return false;
|
|
24978
|
+
return basename9(dirname21(nest)) === "navigator";
|
|
24979
|
+
}
|
|
24980
|
+
function canonicalNavigatorWorkContextFile(path) {
|
|
24981
|
+
if (!isNavigatorWorkContextFile(path)) return void 0;
|
|
24982
|
+
try {
|
|
24983
|
+
const real = realpathSync4(path);
|
|
24984
|
+
return isNavigatorWorkContextFile(real) ? real : void 0;
|
|
24985
|
+
} catch {
|
|
24986
|
+
return void 0;
|
|
24987
|
+
}
|
|
24988
|
+
}
|
|
24989
|
+
async function persistNavigatorWorkBase(sessionDir, body) {
|
|
24990
|
+
if (sessionDir.trim() === "" || !existsSync12(sessionDir)) return void 0;
|
|
24991
|
+
if (body.authority.trim() === "") return void 0;
|
|
24992
|
+
const path = navigatorWorkContextFile(sessionDir);
|
|
24993
|
+
const next = `${JSON.stringify({ subject: body.subject, authority: body.authority })}
|
|
24994
|
+
`;
|
|
24995
|
+
try {
|
|
24996
|
+
const current = await readFile23(path, "utf8");
|
|
24997
|
+
if (current === next) return path;
|
|
24998
|
+
} catch (error) {
|
|
24999
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
|
|
25000
|
+
throw error;
|
|
25001
|
+
}
|
|
25002
|
+
}
|
|
25003
|
+
await writeFileAtomically(path, next);
|
|
25004
|
+
return path;
|
|
25005
|
+
}
|
|
25006
|
+
async function readNavigatorWorkBase(path) {
|
|
25007
|
+
const canonical = canonicalNavigatorWorkContextFile(path);
|
|
25008
|
+
if (canonical === void 0) return void 0;
|
|
25009
|
+
let text;
|
|
25010
|
+
try {
|
|
25011
|
+
text = await readFile23(canonical, "utf8");
|
|
25012
|
+
} catch (error) {
|
|
25013
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
25014
|
+
return void 0;
|
|
25015
|
+
}
|
|
25016
|
+
throw error;
|
|
25017
|
+
}
|
|
25018
|
+
let parsed;
|
|
25019
|
+
try {
|
|
25020
|
+
parsed = JSON.parse(text);
|
|
25021
|
+
} catch {
|
|
25022
|
+
return void 0;
|
|
25023
|
+
}
|
|
25024
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
25025
|
+
const record4 = parsed;
|
|
25026
|
+
if (typeof record4.subject !== "string" || typeof record4.authority !== "string") return void 0;
|
|
25027
|
+
if (record4.authority.trim() === "") return void 0;
|
|
25028
|
+
return { subject: record4.subject, authority: record4.authority };
|
|
25029
|
+
}
|
|
25030
|
+
function jsonObjectFromPrompt(prompt) {
|
|
25031
|
+
const head = prompt.trimStart().split("\n\n", 1)[0] ?? "";
|
|
25032
|
+
if (!head.startsWith("{")) return void 0;
|
|
25033
|
+
try {
|
|
25034
|
+
const parsed = JSON.parse(head);
|
|
25035
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
25036
|
+
return parsed;
|
|
25037
|
+
} catch {
|
|
25038
|
+
return void 0;
|
|
25039
|
+
}
|
|
25040
|
+
}
|
|
25041
|
+
function workContextPathFromPrompt(prompt) {
|
|
25042
|
+
const record4 = jsonObjectFromPrompt(prompt);
|
|
25043
|
+
const path = record4?.workContextPath;
|
|
25044
|
+
if (typeof path !== "string" || path.trim() === "") return void 0;
|
|
25045
|
+
return isNavigatorWorkContextFile(path) ? path : void 0;
|
|
25046
|
+
}
|
|
25047
|
+
function attachWorkContextPointer(text, workContextPath) {
|
|
25048
|
+
const record4 = jsonObjectFromPrompt(text);
|
|
25049
|
+
if (record4 === void 0) return text;
|
|
25050
|
+
if (typeof record4.workContextPath === "string" && record4.workContextPath.trim() !== "") return text;
|
|
25051
|
+
const head = text.trimStart().split("\n\n", 1)[0] ?? "";
|
|
25052
|
+
const rest = text.trimStart().slice(head.length);
|
|
25053
|
+
return `${JSON.stringify({ ...record4, workContextPath })}${rest}`;
|
|
25054
|
+
}
|
|
25055
|
+
async function loadNavigatorWorkBaseSuffix(prompt) {
|
|
25056
|
+
const path = workContextPathFromPrompt(prompt);
|
|
25057
|
+
if (path === void 0) return void 0;
|
|
25058
|
+
const body = await readNavigatorWorkBase(path);
|
|
25059
|
+
if (body === void 0) return void 0;
|
|
25060
|
+
return `<work_subject>
|
|
25061
|
+
${body.subject}
|
|
25062
|
+
</work_subject>
|
|
25063
|
+
|
|
25064
|
+
<controlling_authority>
|
|
25065
|
+
${body.authority}
|
|
25066
|
+
</controlling_authority>`;
|
|
25067
|
+
}
|
|
25068
|
+
|
|
25069
|
+
// src/navigator-public-session.ts
|
|
24920
25070
|
async function resolveNavigatorLedgerHome(context) {
|
|
24921
25071
|
const { tryHomeFromAkRolesPath: tryHomeFromAkRolesPath2 } = await Promise.resolve().then(() => (init_activation_ledger_topology(), activation_ledger_topology_exports));
|
|
24922
25072
|
const runDirectory = runDirectoryFromHostContext(context);
|
|
@@ -24936,7 +25086,7 @@ function exactRecord2(value) {
|
|
|
24936
25086
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24937
25087
|
}
|
|
24938
25088
|
function runIdFromNavigatorDirectory(runDirectory) {
|
|
24939
|
-
const entry =
|
|
25089
|
+
const entry = basename10(runDirectory);
|
|
24940
25090
|
const suffix = "@navigator";
|
|
24941
25091
|
if (!entry.endsWith(suffix)) return void 0;
|
|
24942
25092
|
const runId = entry.slice(0, entry.length - suffix.length);
|
|
@@ -24980,6 +25130,7 @@ function createNativeNavigatorSessionFactory(deps) {
|
|
|
24980
25130
|
});
|
|
24981
25131
|
let providerFailure;
|
|
24982
25132
|
let noReceipt;
|
|
25133
|
+
let routePlaybookReadFailure;
|
|
24983
25134
|
let disposed = false;
|
|
24984
25135
|
let hostRunId = readNavigatorHostRunPointer(sessionManager.getEntries());
|
|
24985
25136
|
const summon = deps?.summonPublicRole ?? (async (options) => {
|
|
@@ -24993,13 +25144,16 @@ function createNativeNavigatorSessionFactory(deps) {
|
|
|
24993
25144
|
}
|
|
24994
25145
|
providerFailure = void 0;
|
|
24995
25146
|
noReceipt = void 0;
|
|
25147
|
+
routePlaybookReadFailure = void 0;
|
|
24996
25148
|
try {
|
|
24997
25149
|
const summonHome = await resolveNavigatorLedgerHome(context);
|
|
24998
25150
|
if (disposed) return;
|
|
24999
25151
|
const resumeRunId = hostRunId;
|
|
25152
|
+
const workContextPath = navigatorWorkContextFile(sessionManager.getSessionDir());
|
|
25153
|
+
const argvText = existsSync13(workContextPath) ? attachWorkContextPointer(text, workContextPath) : text;
|
|
25000
25154
|
const baseSummon = {
|
|
25001
25155
|
role: "navigator",
|
|
25002
|
-
argv: [
|
|
25156
|
+
argv: [argvText],
|
|
25003
25157
|
cwd: context.cwd,
|
|
25004
25158
|
...summonHome === void 0 ? {} : { home: summonHome },
|
|
25005
25159
|
...context.signal === void 0 ? {} : { signal: context.signal }
|
|
@@ -25020,6 +25174,8 @@ function createNativeNavigatorSessionFactory(deps) {
|
|
|
25020
25174
|
}
|
|
25021
25175
|
}
|
|
25022
25176
|
if (disposed) return;
|
|
25177
|
+
const playbookFailure = summoned.terminal?.navigator?.advisoryDiagnostic;
|
|
25178
|
+
routePlaybookReadFailure = typeof playbookFailure === "string" && playbookFailure.trim() !== "" ? playbookFailure : void 0;
|
|
25023
25179
|
const outcome = summoned.terminal?.roleOutcome;
|
|
25024
25180
|
if (outcome === void 0) {
|
|
25025
25181
|
const detail = summoned.stderr?.trim() || `exit ${summoned.exitCode}`;
|
|
@@ -25078,6 +25234,7 @@ function createNativeNavigatorSessionFactory(deps) {
|
|
|
25078
25234
|
},
|
|
25079
25235
|
providerFailure: () => providerFailure,
|
|
25080
25236
|
noReceipt: () => noReceipt,
|
|
25237
|
+
routePlaybookReadFailure: () => routePlaybookReadFailure,
|
|
25081
25238
|
appendEntry: (customType, data) => {
|
|
25082
25239
|
sessionManager.appendCustomEntry(customType, data);
|
|
25083
25240
|
try {
|
|
@@ -25117,7 +25274,6 @@ init_work_subject_identity();
|
|
|
25117
25274
|
init_receipt_delivery_policy();
|
|
25118
25275
|
init_navigator_output();
|
|
25119
25276
|
var NAVIGATOR_EVENT_TYPE = "ak-navigator-attendance";
|
|
25120
|
-
var NAVIGATOR_PREPARE_ACCEPTED_TEXT = "\u6E38\u5955\u4F7F\u51C6\u5907\u5DF2\u63A5\u53D7";
|
|
25121
25277
|
function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
|
|
25122
25278
|
if (roleInput !== void 0 && roleInput.trim() !== "") return roleInput;
|
|
25123
25279
|
if (fileAuthority !== void 0 && fileAuthority.trim() !== "") return fileAuthority;
|
|
@@ -25126,10 +25282,9 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
|
|
|
25126
25282
|
var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
|
|
25127
25283
|
var prepareSchema = Type20.Object({
|
|
25128
25284
|
prose: Type20.Optional(Type20.Unknown({
|
|
25129
|
-
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002
|
|
25285
|
+
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002"
|
|
25130
25286
|
}))
|
|
25131
25287
|
}, { additionalProperties: true });
|
|
25132
|
-
var CONTEXT_ENTRY = "ak-navigator-context";
|
|
25133
25288
|
var INVOCATION_ENTRY = NAVIGATOR_INVOCATION_ENTRY;
|
|
25134
25289
|
var SETTLEMENT_ENTRY = "ak-navigator-settlement";
|
|
25135
25290
|
function exactRecord3(value) {
|
|
@@ -25169,7 +25324,7 @@ function navigatorSubjectKey(subjectRoot, subject, provenance = "role_input") {
|
|
|
25169
25324
|
}
|
|
25170
25325
|
function navigatorSubjectKeyForInput(subjectRoot, reference, cwd = process.cwd()) {
|
|
25171
25326
|
if (issueRoot(subjectRoot) !== void 0 || !subjectRoot.includes("/.ak/work/")) return subjectRoot;
|
|
25172
|
-
const resolvedReference =
|
|
25327
|
+
const resolvedReference = resolve18(cwd, reference);
|
|
25173
25328
|
const marker = "/runs/";
|
|
25174
25329
|
if (resolvedReference.includes(marker)) {
|
|
25175
25330
|
return subjectRoot;
|
|
@@ -25184,12 +25339,12 @@ function createNavigatorPrepareTool(onOutput) {
|
|
|
25184
25339
|
parameters: prepareSchema,
|
|
25185
25340
|
async execute(_id, value) {
|
|
25186
25341
|
onOutput(value);
|
|
25187
|
-
return { content: [
|
|
25342
|
+
return { content: [], details: value, terminate: true };
|
|
25188
25343
|
}
|
|
25189
25344
|
};
|
|
25190
25345
|
}
|
|
25191
25346
|
function formatNavigatorReport(report) {
|
|
25192
|
-
const playbookFailure = report.routePlaybookReadFailure === void 0 ? [] : [
|
|
25347
|
+
const playbookFailure = report.routePlaybookReadFailure === void 0 ? [] : [report.routePlaybookReadFailure];
|
|
25193
25348
|
if (report.disposition === "no-advice") return playbookFailure.join("\n");
|
|
25194
25349
|
if (report.disposition === "unavailable") {
|
|
25195
25350
|
return [...playbookFailure, ...report.unavailableReason ? [report.unavailableReason] : []].join("\n");
|
|
@@ -25215,28 +25370,15 @@ function createNavigatorAttendance(options) {
|
|
|
25215
25370
|
let settlementTail = Promise.resolve();
|
|
25216
25371
|
let settlementFailure;
|
|
25217
25372
|
let preparationFailure;
|
|
25218
|
-
let
|
|
25373
|
+
let observedRoutePlaybookFailure;
|
|
25219
25374
|
let disposed = false;
|
|
25220
25375
|
let closing;
|
|
25221
25376
|
const nestCancel = new AbortController();
|
|
25222
|
-
let warmedHelp;
|
|
25223
25377
|
const sessionHostContext = () => {
|
|
25224
25378
|
const parentSignal = options.context.signal;
|
|
25225
25379
|
const signal = parentSignal === void 0 ? nestCancel.signal : AbortSignal.any([nestCancel.signal, parentSignal]);
|
|
25226
25380
|
return { ...options.context, signal };
|
|
25227
25381
|
};
|
|
25228
|
-
const loadLiveHelp = async () => {
|
|
25229
|
-
try {
|
|
25230
|
-
return await Promise.all(
|
|
25231
|
-
NAVIGATOR_TARGETS.map(async ({ role }) => ({
|
|
25232
|
-
role,
|
|
25233
|
-
help: await options.loadRoleHelp(role)
|
|
25234
|
-
}))
|
|
25235
|
-
);
|
|
25236
|
-
} catch (error) {
|
|
25237
|
-
throw navigatorUnavailableError("transport", error);
|
|
25238
|
-
}
|
|
25239
|
-
};
|
|
25240
25382
|
const unavailable = (invocationId, reason) => {
|
|
25241
25383
|
const failure2 = reason instanceof NavigatorUnavailableError ? reason : navigatorUnavailableError("unknown", reason);
|
|
25242
25384
|
return {
|
|
@@ -25246,7 +25388,6 @@ function createNavigatorAttendance(options) {
|
|
|
25246
25388
|
unavailableCause: failure2.unavailableCause
|
|
25247
25389
|
};
|
|
25248
25390
|
};
|
|
25249
|
-
let routePlaybookSettlement;
|
|
25250
25391
|
let prepareBoundSettlement;
|
|
25251
25392
|
const loadMaterialsAndSession = async (invocationId) => {
|
|
25252
25393
|
if (contextError !== void 0) throw navigatorUnavailableError("context", contextError);
|
|
@@ -25256,30 +25397,6 @@ function createNavigatorAttendance(options) {
|
|
|
25256
25397
|
new Error("controlling authority content was not supplied as typed work context")
|
|
25257
25398
|
);
|
|
25258
25399
|
}
|
|
25259
|
-
let soul;
|
|
25260
|
-
let modelSetting;
|
|
25261
|
-
let help;
|
|
25262
|
-
let routePlaybook = "";
|
|
25263
|
-
routePlaybookReadFailure = void 0;
|
|
25264
|
-
const soulPromise = (async () => {
|
|
25265
|
-
try {
|
|
25266
|
-
const text = (await options.loadSoul()).trim();
|
|
25267
|
-
if (!text) throw new Error("Navigator soul is empty");
|
|
25268
|
-
return text;
|
|
25269
|
-
} catch (error) {
|
|
25270
|
-
throw navigatorUnavailableError("context", error);
|
|
25271
|
-
}
|
|
25272
|
-
})();
|
|
25273
|
-
const routePlaybookPromise = (async () => {
|
|
25274
|
-
if (options.loadRoutePlaybook === void 0) return "";
|
|
25275
|
-
try {
|
|
25276
|
-
return await options.loadRoutePlaybook();
|
|
25277
|
-
} catch (error) {
|
|
25278
|
-
routePlaybookReadFailure = error instanceof Error ? error.message : String(error);
|
|
25279
|
-
return "";
|
|
25280
|
-
}
|
|
25281
|
-
})();
|
|
25282
|
-
routePlaybookSettlement = routePlaybookPromise.then(() => void 0);
|
|
25283
25400
|
const modelPromise = (async () => {
|
|
25284
25401
|
try {
|
|
25285
25402
|
const resolved = await resolveNavigatorSeatSelection(options.context);
|
|
@@ -25289,23 +25406,13 @@ function createNavigatorAttendance(options) {
|
|
|
25289
25406
|
throw navigatorUnavailableError("model", error);
|
|
25290
25407
|
}
|
|
25291
25408
|
})();
|
|
25292
|
-
const
|
|
25293
|
-
warmedHelp = void 0;
|
|
25294
|
-
[soul, routePlaybook, modelSetting, help] = await Promise.all([
|
|
25295
|
-
soulPromise,
|
|
25296
|
-
routePlaybookPromise,
|
|
25297
|
-
modelPromise,
|
|
25298
|
-
helpPromise
|
|
25299
|
-
]);
|
|
25409
|
+
const modelSetting = await modelPromise;
|
|
25300
25410
|
let model;
|
|
25301
25411
|
try {
|
|
25302
25412
|
model = parseNavigatorModelSetting(modelSetting);
|
|
25303
25413
|
} catch (error) {
|
|
25304
25414
|
throw navigatorUnavailableError("model", error);
|
|
25305
25415
|
}
|
|
25306
|
-
const helpContext = help.map(({ role, help: text }) => `<role_help role="${role}">
|
|
25307
|
-
${text}
|
|
25308
|
-
</role_help>`).join("\n");
|
|
25309
25416
|
const tool = createNavigatorPrepareTool((value) => {
|
|
25310
25417
|
outputSink?.(value);
|
|
25311
25418
|
});
|
|
@@ -25350,9 +25457,9 @@ ${text}
|
|
|
25350
25457
|
}
|
|
25351
25458
|
if (disposed) throw navigatorUnavailableError("session", new Error("Navigator attendance was disposed"));
|
|
25352
25459
|
if (session === void 0) throw new Error("Navigator session was not created");
|
|
25353
|
-
return
|
|
25460
|
+
return session;
|
|
25354
25461
|
};
|
|
25355
|
-
const prepare = async (
|
|
25462
|
+
const prepare = async (existingSession) => {
|
|
25356
25463
|
const boundSettlement = prepareBoundSettlement;
|
|
25357
25464
|
prepareBoundSettlement = void 0;
|
|
25358
25465
|
const invocationId = invocationPrincipal;
|
|
@@ -25369,73 +25476,19 @@ ${text}
|
|
|
25369
25476
|
const merged = [prior, next].filter((part) => part.trim() !== "").join("\n\n");
|
|
25370
25477
|
output = { prose: merged };
|
|
25371
25478
|
};
|
|
25372
|
-
const
|
|
25373
|
-
|
|
25374
|
-
const
|
|
25375
|
-
|
|
25376
|
-
|
|
25377
|
-
|
|
25378
|
-
|
|
25379
|
-
...boundSettlement === void 0 ? {} : { currentSettlement: boundSettlement },
|
|
25380
|
-
publicSettlementHistory,
|
|
25381
|
-
liveRoleHelp: help
|
|
25382
|
-
};
|
|
25383
|
-
activeSession.appendEntry(CONTEXT_ENTRY, projection);
|
|
25384
|
-
const request = boundSettlement === void 0 ? [
|
|
25385
|
-
"\u672C\u8F6E\u4E3A\u5F85\u547D\u8F6E\u3002",
|
|
25386
|
-
`<navigator_soul>
|
|
25387
|
-
${soul}
|
|
25388
|
-
</navigator_soul>`,
|
|
25389
|
-
...routePlaybookReadFailure === void 0 ? [`<route_playbook>
|
|
25390
|
-
${routePlaybook}
|
|
25391
|
-
</route_playbook>`] : ["\u53EF\u9009\u8DEF\u7EBF\u624B\u518C\u672A\u80FD\u8BFB\u53D6\u3002"],
|
|
25392
|
-
`<work_subject>
|
|
25393
|
-
${subject}
|
|
25394
|
-
</work_subject>`,
|
|
25395
|
-
`<controlling_authority>
|
|
25396
|
-
${authority}
|
|
25397
|
-
</controlling_authority>`,
|
|
25398
|
-
`<current_role>
|
|
25399
|
-
${JSON.stringify({ role: options.role, phase: options.phase })}
|
|
25400
|
-
</current_role>`,
|
|
25401
|
-
`<public_settlement_history>
|
|
25402
|
-
${JSON.stringify(projection.publicSettlementHistory)}
|
|
25403
|
-
</public_settlement_history>`,
|
|
25404
|
-
`<live_role_help>
|
|
25405
|
-
${helpContext}
|
|
25406
|
-
</live_role_help>`
|
|
25407
|
-
].join("\n\n") : [
|
|
25408
|
-
"\u672C\u8F6E\u4E3A\u7ED3\u7B97\u6295\u5582\u8F6E\u3002",
|
|
25409
|
-
`<navigator_soul>
|
|
25410
|
-
${soul}
|
|
25411
|
-
</navigator_soul>`,
|
|
25412
|
-
...routePlaybookReadFailure === void 0 ? [`<route_playbook>
|
|
25413
|
-
${routePlaybook}
|
|
25414
|
-
</route_playbook>`] : ["\u53EF\u9009\u8DEF\u7EBF\u624B\u518C\u672A\u80FD\u8BFB\u53D6\u3002"],
|
|
25415
|
-
`<work_subject>
|
|
25416
|
-
${subject}
|
|
25417
|
-
</work_subject>`,
|
|
25418
|
-
`<controlling_authority>
|
|
25419
|
-
${authority}
|
|
25420
|
-
</controlling_authority>`,
|
|
25421
|
-
`<current_role>
|
|
25422
|
-
${JSON.stringify({ role: options.role, phase: options.phase })}
|
|
25423
|
-
</current_role>`,
|
|
25424
|
-
`<current_settlement>
|
|
25425
|
-
${JSON.stringify(boundSettlement)}
|
|
25426
|
-
</current_settlement>`,
|
|
25427
|
-
`<public_settlement_history>
|
|
25428
|
-
${JSON.stringify(projection.publicSettlementHistory)}
|
|
25429
|
-
</public_settlement_history>`,
|
|
25430
|
-
`<live_role_help>
|
|
25431
|
-
${helpContext}
|
|
25432
|
-
</live_role_help>`
|
|
25433
|
-
].join("\n\n");
|
|
25479
|
+
const activeSession = existingSession ?? await loadMaterialsAndSession(invocationId);
|
|
25480
|
+
if (boundSettlement === void 0) return void 0;
|
|
25481
|
+
const request = JSON.stringify({
|
|
25482
|
+
...boundSettlement,
|
|
25483
|
+
invocationId,
|
|
25484
|
+
subjectKey
|
|
25485
|
+
});
|
|
25434
25486
|
try {
|
|
25435
25487
|
try {
|
|
25436
25488
|
if (disposed) throw navigatorUnavailableError("session", new Error("Navigator attendance was disposed"));
|
|
25437
25489
|
const delivery = createReceiptDeliveryPolicy();
|
|
25438
25490
|
const promptAllowingRejectedPrepare = async (text, deliveryRequest) => {
|
|
25491
|
+
await persistNavigatorWorkBase(activeSession.recordPointer(), { subject, authority });
|
|
25439
25492
|
const entryStart = activeSession.entries().length;
|
|
25440
25493
|
prepareBatchRejected = false;
|
|
25441
25494
|
let promptFailure;
|
|
@@ -25466,7 +25519,7 @@ ${helpContext}
|
|
|
25466
25519
|
await promptAllowingRejectedPrepare(request, false);
|
|
25467
25520
|
if (boundSettlement !== void 0) {
|
|
25468
25521
|
while (output === void 0 && prepareBatchRejected && delivery.nextAction() === "request-delivery") {
|
|
25469
|
-
await promptAllowingRejectedPrepare(
|
|
25522
|
+
await promptAllowingRejectedPrepare(JSON.stringify(delivery.deliveryState()), true);
|
|
25470
25523
|
}
|
|
25471
25524
|
if (output === void 0 && delivery.nextAction() === "request-delivery") {
|
|
25472
25525
|
while (delivery.nextAction() === "request-delivery") {
|
|
@@ -25506,6 +25559,8 @@ ${helpContext}
|
|
|
25506
25559
|
preparedProse = normalizePrepareProse(output);
|
|
25507
25560
|
return preparedProse;
|
|
25508
25561
|
} finally {
|
|
25562
|
+
const playbookFailure = activeSession.routePlaybookReadFailure?.();
|
|
25563
|
+
observedRoutePlaybookFailure = typeof playbookFailure === "string" && playbookFailure.trim() !== "" ? playbookFailure : void 0;
|
|
25509
25564
|
outputSink = void 0;
|
|
25510
25565
|
}
|
|
25511
25566
|
};
|
|
@@ -25523,16 +25578,6 @@ ${helpContext}
|
|
|
25523
25578
|
contextError = next.contextError;
|
|
25524
25579
|
return closing2;
|
|
25525
25580
|
},
|
|
25526
|
-
/**
|
|
25527
|
-
* Start live-help subprocesses during activation without beginning full
|
|
25528
|
-
* preparation. Next prepare() consumes the warm result; a later prepare
|
|
25529
|
-
* reloads so live help edits remain visible.
|
|
25530
|
-
*/
|
|
25531
|
-
warmHelp() {
|
|
25532
|
-
if (disposed || warmedHelp !== void 0 || preparation !== void 0) return;
|
|
25533
|
-
warmedHelp = loadLiveHelp();
|
|
25534
|
-
void warmedHelp.catch(() => void 0);
|
|
25535
|
-
},
|
|
25536
25581
|
prepare() {
|
|
25537
25582
|
if (disposed || preparation !== void 0) return;
|
|
25538
25583
|
preparationFailure = void 0;
|
|
@@ -25547,9 +25592,6 @@ ${helpContext}
|
|
|
25547
25592
|
isPreparing() {
|
|
25548
25593
|
return preparationInFlight;
|
|
25549
25594
|
},
|
|
25550
|
-
knownRoutePlaybookReadFailure() {
|
|
25551
|
-
return routePlaybookReadFailure;
|
|
25552
|
-
},
|
|
25553
25595
|
settle(settlement) {
|
|
25554
25596
|
const next = settlementTail.then(() => settleOnce(settlement));
|
|
25555
25597
|
settlementTail = next.catch((error) => {
|
|
@@ -25576,6 +25618,7 @@ ${helpContext}
|
|
|
25576
25618
|
};
|
|
25577
25619
|
async function settleOnce(settlement) {
|
|
25578
25620
|
if (disposed) return;
|
|
25621
|
+
observedRoutePlaybookFailure = void 0;
|
|
25579
25622
|
const invocationId = activeInvocationId ?? invocationPrincipal;
|
|
25580
25623
|
let report;
|
|
25581
25624
|
if (sessionReady !== void 0) {
|
|
@@ -25614,10 +25657,10 @@ ${helpContext}
|
|
|
25614
25657
|
}
|
|
25615
25658
|
} else {
|
|
25616
25659
|
if (session !== void 0) preparationFailure = void 0;
|
|
25617
|
-
let
|
|
25660
|
+
let coldSession;
|
|
25618
25661
|
if (session === void 0 && preparationFailure === void 0) {
|
|
25619
25662
|
try {
|
|
25620
|
-
|
|
25663
|
+
coldSession = await loadMaterialsAndSession(invocationId);
|
|
25621
25664
|
} catch (error) {
|
|
25622
25665
|
preparationFailure = error;
|
|
25623
25666
|
}
|
|
@@ -25625,7 +25668,7 @@ ${helpContext}
|
|
|
25625
25668
|
session?.appendEntry(SETTLEMENT_ENTRY, settlementFact);
|
|
25626
25669
|
if (preparationFailure === void 0) {
|
|
25627
25670
|
prepareBoundSettlement = settlement;
|
|
25628
|
-
preparation = prepare(
|
|
25671
|
+
preparation = prepare(coldSession);
|
|
25629
25672
|
void preparation.catch((error) => {
|
|
25630
25673
|
preparationFailure = error;
|
|
25631
25674
|
});
|
|
@@ -25644,9 +25687,8 @@ ${helpContext}
|
|
|
25644
25687
|
report = { disposition: "no-advice" };
|
|
25645
25688
|
}
|
|
25646
25689
|
}
|
|
25647
|
-
|
|
25648
|
-
|
|
25649
|
-
report = { ...report, routePlaybookReadFailure };
|
|
25690
|
+
if (observedRoutePlaybookFailure !== void 0) {
|
|
25691
|
+
report = { ...report, routePlaybookReadFailure: observedRoutePlaybookFailure };
|
|
25650
25692
|
}
|
|
25651
25693
|
const event = {
|
|
25652
25694
|
version: 1,
|
|
@@ -25673,8 +25715,6 @@ ${helpContext}
|
|
|
25673
25715
|
sessionReady = void 0;
|
|
25674
25716
|
preparedProse = void 0;
|
|
25675
25717
|
preparationFailure = void 0;
|
|
25676
|
-
routePlaybookSettlement = void 0;
|
|
25677
|
-
routePlaybookReadFailure = void 0;
|
|
25678
25718
|
}
|
|
25679
25719
|
}
|
|
25680
25720
|
|
|
@@ -25691,12 +25731,7 @@ init_submission_errors();
|
|
|
25691
25731
|
init_audit_escalation();
|
|
25692
25732
|
init_readable_gate_item();
|
|
25693
25733
|
init_judge_output();
|
|
25694
|
-
var JUDGE_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "continue", "escalate"]);
|
|
25695
|
-
var JUDGE_STATUS_REASK = "status \u4E0D\u662F converged\u3001continue\u3001escalate \u4E09\u6001\u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
25696
25734
|
var judgeVerdictSchema = reviewSubmissionSchema;
|
|
25697
|
-
function validateVerdict(verdict) {
|
|
25698
|
-
return validateAcceptedJudgeDetails(verdict);
|
|
25699
|
-
}
|
|
25700
25735
|
function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
25701
25736
|
let soul;
|
|
25702
25737
|
let lifecycleRegistered = false;
|
|
@@ -25709,24 +25744,23 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
25709
25744
|
pi.registerTool({
|
|
25710
25745
|
name: JUDGE_OUTPUT_TOOL_NAME,
|
|
25711
25746
|
label: "\u5927\u7406\u5BFA\u8F93\u51FA",
|
|
25712
|
-
description: "\u63D0\u4EA4\u5927\u7406\u5BFA\u7EC8\u5C40\u5224\u8BCD\
|
|
25747
|
+
description: "\u63D0\u4EA4\u5927\u7406\u5BFA\u7EC8\u5C40\u5224\u8BCD\u3002",
|
|
25713
25748
|
promptSnippet: "\u63D0\u4EA4\u5927\u7406\u5BFA\u7EC8\u5C40\u5224\u8BCD",
|
|
25714
25749
|
parameters: judgeVerdictSchema,
|
|
25715
25750
|
async execute(toolCallId, parameters, signal, _onUpdate, ctx) {
|
|
25716
25751
|
if (soul === void 0) throw new Error("\u5927\u7406\u5BFA\u804C\u5206\u672A\u88C5\u8F7D");
|
|
25717
25752
|
const rawStatus = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) && typeof parameters.status === "string" ? parameters.status : void 0;
|
|
25718
|
-
if (rawStatus === void 0 || !
|
|
25719
|
-
|
|
25753
|
+
if (rawStatus === void 0 || !REVIEW_QUEUE_STATUSES.has(rawStatus)) {
|
|
25754
|
+
const received = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) ? parameters.status : void 0;
|
|
25755
|
+
throw new ParentQueueReaskError(unreadableDiscriminatorNotice("status", received));
|
|
25720
25756
|
}
|
|
25721
25757
|
if (rawStatus === "escalate") {
|
|
25722
|
-
const verdict2 = validateVerdict(parameters);
|
|
25723
25758
|
return {
|
|
25724
25759
|
content: [],
|
|
25725
|
-
details:
|
|
25760
|
+
details: parameters,
|
|
25726
25761
|
terminate: true
|
|
25727
25762
|
};
|
|
25728
25763
|
}
|
|
25729
|
-
const verdict = validateVerdict(parameters);
|
|
25730
25764
|
let draftPass;
|
|
25731
25765
|
try {
|
|
25732
25766
|
const obtainedDraftPass = await pi.requireSubmissionGate({
|
|
@@ -25742,7 +25776,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
25742
25776
|
if (draftPass?.status === "continue") {
|
|
25743
25777
|
return {
|
|
25744
25778
|
content: [{ type: "text", text: readableGateItem(draftPass.receipt) }],
|
|
25745
|
-
details:
|
|
25779
|
+
details: parameters,
|
|
25746
25780
|
terminate: false
|
|
25747
25781
|
};
|
|
25748
25782
|
}
|
|
@@ -25759,18 +25793,18 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
25759
25793
|
if (compliancePass?.status === "continue") {
|
|
25760
25794
|
return {
|
|
25761
25795
|
content: [draftPass, compliancePass].filter((pass) => pass !== void 0).map((pass) => ({ type: "text", text: readableGateItem(pass.receipt) })),
|
|
25762
|
-
details:
|
|
25796
|
+
details: parameters,
|
|
25763
25797
|
terminate: false
|
|
25764
25798
|
};
|
|
25765
25799
|
}
|
|
25766
25800
|
return {
|
|
25767
25801
|
content: [draftPass, compliancePass].filter((pass) => pass !== void 0).map((pass) => ({ type: "text", text: readableGateItem(pass.receipt) })),
|
|
25768
|
-
details:
|
|
25802
|
+
details: parameters,
|
|
25769
25803
|
terminate: true
|
|
25770
25804
|
};
|
|
25771
25805
|
} catch (error) {
|
|
25772
25806
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
25773
|
-
return projectGatekeeperEscalation(error.result,
|
|
25807
|
+
return projectGatekeeperEscalation(error.result, parameters);
|
|
25774
25808
|
}
|
|
25775
25809
|
throw error;
|
|
25776
25810
|
}
|
|
@@ -25805,9 +25839,9 @@ var reviewerAmendmentsSchema = Type21.Object({
|
|
|
25805
25839
|
}))
|
|
25806
25840
|
}, {
|
|
25807
25841
|
additionalProperties: true,
|
|
25808
|
-
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
|
|
25842
|
+
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"
|
|
25809
25843
|
});
|
|
25810
|
-
var REVIEWER_STATUS_DESCRIPTION = "completed | refused
|
|
25844
|
+
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";
|
|
25811
25845
|
var reviewerOutputVariants = Type21.Union([
|
|
25812
25846
|
Type21.Object({
|
|
25813
25847
|
status: Type21.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
|
|
@@ -25836,7 +25870,7 @@ function createReviewerRoleRuntime(pi, dependencies, _hostActions) {
|
|
|
25836
25870
|
pi.registerTool({
|
|
25837
25871
|
name: REVIEWER_OUTPUT_TOOL_NAME,
|
|
25838
25872
|
label: "\u5FA1\u53F2\u53F0\u8F93\u51FA",
|
|
25839
|
-
description: "\u63D0\u4EA4\u5FA1\u53F2\u53F0\u7EC8\u5C40\u56DE\u6267\u3002
|
|
25873
|
+
description: "\u63D0\u4EA4\u5FA1\u53F2\u53F0\u7EC8\u5C40\u56DE\u6267\u3002",
|
|
25840
25874
|
promptSnippet: "\u63D0\u4EA4\u5FA1\u53F2\u53F0\u7EC8\u5C40\u56DE\u6267",
|
|
25841
25875
|
parameters: reviewerOutputSchema,
|
|
25842
25876
|
async execute(_id, parameters) {
|
|
@@ -25876,8 +25910,8 @@ init_sitian_facade();
|
|
|
25876
25910
|
init_submission_errors();
|
|
25877
25911
|
init_submission_errors();
|
|
25878
25912
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
25879
|
-
import { existsSync as
|
|
25880
|
-
import { resolve as
|
|
25913
|
+
import { existsSync as existsSync14, lstatSync as lstatSync3, readdirSync as readdirSync3, readFileSync as readFileSync5, rmdirSync, rmSync } from "node:fs";
|
|
25914
|
+
import { resolve as resolve19 } from "node:path";
|
|
25881
25915
|
var WORKER_SUBMISSION_GATE_RECORD_KIND = WORKER_SUBMISSION_GATE_KIND;
|
|
25882
25916
|
var WORKER_COMMIT_BASELINE_ENTRY_TYPE = "commit-baseline";
|
|
25883
25917
|
var WORKER_COMMIT_REMINDER_BOUNCE_ENTRY_TYPE = "commit-reminder-bounce";
|
|
@@ -25907,7 +25941,7 @@ function statusOf(error) {
|
|
|
25907
25941
|
return typeof error === "object" && error !== null && "status" in error ? error.status : void 0;
|
|
25908
25942
|
}
|
|
25909
25943
|
function tryGetAll(file, key) {
|
|
25910
|
-
if (!
|
|
25944
|
+
if (!existsSync14(file)) return [];
|
|
25911
25945
|
try {
|
|
25912
25946
|
const out = gitFile(file, ["--get-all", key]);
|
|
25913
25947
|
return out.length === 0 ? [] : out.split("\n");
|
|
@@ -25917,7 +25951,7 @@ function tryGetAll(file, key) {
|
|
|
25917
25951
|
}
|
|
25918
25952
|
}
|
|
25919
25953
|
function ownedHook(path) {
|
|
25920
|
-
if (!
|
|
25954
|
+
if (!existsSync14(path)) return false;
|
|
25921
25955
|
return readFileSync5(path, "utf8").includes(HOOK_MARKER);
|
|
25922
25956
|
}
|
|
25923
25957
|
function escapeGitConfigValueRegex(value) {
|
|
@@ -25926,7 +25960,7 @@ function escapeGitConfigValueRegex(value) {
|
|
|
25926
25960
|
function unsetOwnedHooksPath(file) {
|
|
25927
25961
|
const owned = [];
|
|
25928
25962
|
for (const value of tryGetAll(file, "core.hooksPath")) {
|
|
25929
|
-
if (!ownedHook(
|
|
25963
|
+
if (!ownedHook(resolve19(value, HOOK_FILE))) continue;
|
|
25930
25964
|
try {
|
|
25931
25965
|
gitFile(file, [
|
|
25932
25966
|
"--unset-all",
|
|
@@ -25941,15 +25975,15 @@ function unsetOwnedHooksPath(file) {
|
|
|
25941
25975
|
return owned;
|
|
25942
25976
|
}
|
|
25943
25977
|
function rmOwnedDir(dir) {
|
|
25944
|
-
const hookPath =
|
|
25978
|
+
const hookPath = resolve19(dir, HOOK_FILE);
|
|
25945
25979
|
if (!ownedHook(hookPath)) return;
|
|
25946
25980
|
rmSync(hookPath, { force: true });
|
|
25947
|
-
if (
|
|
25981
|
+
if (existsSync14(dir) && readdirSync3(dir).length === 0) rmdirSync(dir);
|
|
25948
25982
|
}
|
|
25949
25983
|
function linkedGitDirs(commonDir) {
|
|
25950
|
-
const root =
|
|
25951
|
-
if (!
|
|
25952
|
-
return readdirSync3(root).map((name) =>
|
|
25984
|
+
const root = resolve19(commonDir, "worktrees");
|
|
25985
|
+
if (!existsSync14(root)) return [];
|
|
25986
|
+
return readdirSync3(root).map((name) => resolve19(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
|
|
25953
25987
|
}
|
|
25954
25988
|
function uninstallPackageWorkerHooks(cwd) {
|
|
25955
25989
|
let inside;
|
|
@@ -25963,14 +25997,14 @@ function uninstallPackageWorkerHooks(cwd) {
|
|
|
25963
25997
|
const clear = (configFile) => {
|
|
25964
25998
|
for (const hooks of unsetOwnedHooksPath(configFile)) rmOwnedDir(hooks);
|
|
25965
25999
|
};
|
|
25966
|
-
clear(
|
|
25967
|
-
clear(
|
|
25968
|
-
rmOwnedDir(
|
|
25969
|
-
const legacy =
|
|
26000
|
+
clear(resolve19(commonDir, "config"));
|
|
26001
|
+
clear(resolve19(commonDir, "config.worktree"));
|
|
26002
|
+
rmOwnedDir(resolve19(commonDir, HOOKS_DIR));
|
|
26003
|
+
const legacy = resolve19(commonDir, "hooks", HOOK_FILE);
|
|
25970
26004
|
if (ownedHook(legacy)) rmSync(legacy, { force: true });
|
|
25971
26005
|
for (const gitDir of linkedGitDirs(commonDir)) {
|
|
25972
|
-
clear(
|
|
25973
|
-
rmOwnedDir(
|
|
26006
|
+
clear(resolve19(gitDir, "config.worktree"));
|
|
26007
|
+
rmOwnedDir(resolve19(gitDir, HOOKS_DIR));
|
|
25974
26008
|
}
|
|
25975
26009
|
}
|
|
25976
26010
|
function isRecord17(value) {
|
|
@@ -26132,7 +26166,7 @@ function fixerBashSeatbeltDenyReason(matched) {
|
|
|
26132
26166
|
}
|
|
26133
26167
|
|
|
26134
26168
|
// src/worker-role.ts
|
|
26135
|
-
var CODER_STATUS_DESCRIPTION = "planned | completed | refused | partially_completed | unfinished
|
|
26169
|
+
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";
|
|
26136
26170
|
var coderOutputVariants = Type22.Union([
|
|
26137
26171
|
Type22.Object({
|
|
26138
26172
|
status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
@@ -26192,14 +26226,13 @@ var WORKER_ROUTING_STATUSES = /* @__PURE__ */ new Set([
|
|
|
26192
26226
|
"partially_completed",
|
|
26193
26227
|
"unfinished"
|
|
26194
26228
|
]);
|
|
26195
|
-
var WORKER_STATUS_REASK = "status \u4E0D\u662F planned\u3001completed\u3001refused\u3001partially_completed\u3001unfinished \u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
26196
26229
|
function workerStatusOf(output) {
|
|
26197
26230
|
return isRecord18(output) && typeof output.status === "string" ? output.status : void 0;
|
|
26198
26231
|
}
|
|
26199
26232
|
function requireReadableWorkerStatus(output) {
|
|
26200
26233
|
const status = workerStatusOf(output);
|
|
26201
26234
|
if (status === void 0 || !WORKER_ROUTING_STATUSES.has(status)) {
|
|
26202
|
-
throw new ParentQueueReaskError(
|
|
26235
|
+
throw new ParentQueueReaskError(unreadableDiscriminatorNotice("status", isRecord18(output) ? output.status : void 0));
|
|
26203
26236
|
}
|
|
26204
26237
|
return status;
|
|
26205
26238
|
}
|
|
@@ -26276,7 +26309,7 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26276
26309
|
pi.registerTool({
|
|
26277
26310
|
name: FIXER_OUTPUT_TOOL_NAME,
|
|
26278
26311
|
label: "\u4FEE\u5185\u53F8\u8F93\u51FA",
|
|
26279
|
-
description: "\u63D0\u4EA4\u4FEE\u5185\u53F8\u7EC8\u5C40\u56DE\u6267\
|
|
26312
|
+
description: "\u63D0\u4EA4\u4FEE\u5185\u53F8\u7EC8\u5C40\u56DE\u6267\u3002",
|
|
26280
26313
|
promptSnippet: "\u63D0\u4EA4\u4FEE\u5185\u53F8\u7EC8\u5C40\u56DE\u6267",
|
|
26281
26314
|
parameters: fixerOutputSchema,
|
|
26282
26315
|
async execute(toolCallId, parameters, _signal, _onUpdate, ctx) {
|
|
@@ -26403,7 +26436,7 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26403
26436
|
pi.registerTool({
|
|
26404
26437
|
name: CODER_OUTPUT_TOOL_NAME,
|
|
26405
26438
|
label: "\u5C06\u4F5C\u76D1\u8F93\u51FA",
|
|
26406
|
-
description: "\u63D0\u4EA4\u5C06\u4F5C\u76D1\u7EC8\u5C40\u56DE\u6267\
|
|
26439
|
+
description: "\u63D0\u4EA4\u5C06\u4F5C\u76D1\u7EC8\u5C40\u56DE\u6267\u3002",
|
|
26407
26440
|
promptSnippet: "\u63D0\u4EA4\u5C06\u4F5C\u76D1\u7EC8\u5C40\u56DE\u6267",
|
|
26408
26441
|
parameters: coderOutputSchema,
|
|
26409
26442
|
async execute(toolCallId, parameters, _signal, _onUpdate, ctx2) {
|
|
@@ -26542,6 +26575,7 @@ ${JSON.stringify(admitted)}
|
|
|
26542
26575
|
init_navigator_invocation_identity();
|
|
26543
26576
|
init_gatekeeper_role();
|
|
26544
26577
|
init_submission_errors();
|
|
26578
|
+
init_review_submission();
|
|
26545
26579
|
init_doctor_contracts();
|
|
26546
26580
|
init_doctor_evidence();
|
|
26547
26581
|
init_engine_detour();
|
|
@@ -26729,25 +26763,6 @@ var ROLE_FLAG = {
|
|
|
26729
26763
|
type: "string"
|
|
26730
26764
|
}
|
|
26731
26765
|
};
|
|
26732
|
-
function formatNavigatorRoleHelp(role) {
|
|
26733
|
-
const metadata = packagedRoleMetadata(role);
|
|
26734
|
-
const lines = [
|
|
26735
|
-
`Usage: ak-role ${role}`,
|
|
26736
|
-
ROLE_FLAG.definition.description
|
|
26737
|
-
];
|
|
26738
|
-
const inputFlag = packagedRoleInputFlag(role);
|
|
26739
|
-
if (inputFlag !== void 0) {
|
|
26740
|
-
lines.push(` --${inputFlag} <value> ${role} input material`);
|
|
26741
|
-
}
|
|
26742
|
-
const phaseFlag = packagedRolePhaseFlag(role);
|
|
26743
|
-
if (phaseFlag !== void 0 && metadata !== void 0) {
|
|
26744
|
-
lines.push(
|
|
26745
|
-
` --${phaseFlag} <value> ${role} phase: ${metadata.phases.filter((p) => p !== null).join(" | ")}`
|
|
26746
|
-
);
|
|
26747
|
-
}
|
|
26748
|
-
lines.push(`Public next-command form: ak-role ${role}`);
|
|
26749
|
-
return lines.join("\n");
|
|
26750
|
-
}
|
|
26751
26766
|
function abortContext(ctx) {
|
|
26752
26767
|
ctx.abort();
|
|
26753
26768
|
}
|
|
@@ -26908,7 +26923,7 @@ function createGatekeeperRoleRuntime(roleHost, dependencies) {
|
|
|
26908
26923
|
);
|
|
26909
26924
|
}
|
|
26910
26925
|
function createNavigatorRoleRuntime(roleHost, dependencies) {
|
|
26911
|
-
|
|
26926
|
+
const base = createFiledOfficerRuntime(
|
|
26912
26927
|
roleHost,
|
|
26913
26928
|
{
|
|
26914
26929
|
role: "navigator",
|
|
@@ -26917,6 +26932,42 @@ function createNavigatorRoleRuntime(roleHost, dependencies) {
|
|
|
26917
26932
|
},
|
|
26918
26933
|
dependencies
|
|
26919
26934
|
);
|
|
26935
|
+
let playbookBound = false;
|
|
26936
|
+
return {
|
|
26937
|
+
async activate() {
|
|
26938
|
+
await base.activate();
|
|
26939
|
+
if (playbookBound) return;
|
|
26940
|
+
playbookBound = true;
|
|
26941
|
+
const loadRoutePlaybook = dependencies.loadRoutePlaybook ?? (() => readPackageMaterial("resources/navigator-route-playbook.md"));
|
|
26942
|
+
let playbookRead;
|
|
26943
|
+
roleHost.on("before_agent_start", async (event) => {
|
|
26944
|
+
const basePrompt = typeof event.systemPrompt === "string" ? event.systemPrompt : "";
|
|
26945
|
+
const parts = [];
|
|
26946
|
+
try {
|
|
26947
|
+
playbookRead ??= loadRoutePlaybook();
|
|
26948
|
+
const content = await playbookRead;
|
|
26949
|
+
dependencies.recordRoutePlaybookReadFailure?.(void 0);
|
|
26950
|
+
if (content.trim() !== "") parts.push(content);
|
|
26951
|
+
} catch (error) {
|
|
26952
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
26953
|
+
if (message.trim() !== "") {
|
|
26954
|
+
dependencies.recordRoutePlaybookReadFailure?.(message);
|
|
26955
|
+
parts.push(message);
|
|
26956
|
+
}
|
|
26957
|
+
}
|
|
26958
|
+
const prompt = typeof event.prompt === "string" ? event.prompt : "";
|
|
26959
|
+
const work = await loadNavigatorWorkBaseSuffix(prompt);
|
|
26960
|
+
if (work !== void 0 && work.trim() !== "") parts.push(work);
|
|
26961
|
+
if (parts.length === 0) return;
|
|
26962
|
+
const text = parts.join("\n\n");
|
|
26963
|
+
return {
|
|
26964
|
+
systemPrompt: basePrompt.trim() === "" ? text : `${basePrompt}
|
|
26965
|
+
|
|
26966
|
+
${text}`
|
|
26967
|
+
};
|
|
26968
|
+
});
|
|
26969
|
+
}
|
|
26970
|
+
};
|
|
26920
26971
|
}
|
|
26921
26972
|
function createAuditorRoleRuntime(roleHost, dependencies) {
|
|
26922
26973
|
const base = createFiledOfficerRuntime(
|
|
@@ -26960,7 +27011,7 @@ function readDiaristTicketAssertion(submitted) {
|
|
|
26960
27011
|
function readRoleRunCoordinates(ctx, label) {
|
|
26961
27012
|
const runDirectory = runDirectoryFromHostContext(ctx);
|
|
26962
27013
|
if (runDirectory === void 0) throw new Error(`${label} requires AK_ROLE_RUN_DIR`);
|
|
26963
|
-
const admittedPath =
|
|
27014
|
+
const admittedPath = join44(runDirectory, "admitted-request.json");
|
|
26964
27015
|
const admitted = JSON.parse(readFileSync6(admittedPath, "utf8"));
|
|
26965
27016
|
if (typeof admitted.projectRoot !== "string" || admitted.projectRoot.trim() === "") {
|
|
26966
27017
|
throw new Error(`${label} admitted-request missing projectRoot (${admittedPath})`);
|
|
@@ -26984,7 +27035,6 @@ function readDiaristRunCoordinates(ctx) {
|
|
|
26984
27035
|
}
|
|
26985
27036
|
var DIARIST_BOUNDS_REASK = "\u8FB9\u754C\u65E0\u6CD5\u4F7F\u7528\u3002\u8BF7\u91CD\u4EA4 sessions\uFF1A\u6BCF\u5377 path + ranges\uFF0C\u6BCF\u7AEF\u4EE5\u539F\u751F id \u6216\u672C\u8F6E\u884C\u53F7\u4E8C\u9009\u4E00\u6307\u540D\u3002";
|
|
26986
27037
|
var DIARIST_ROUTING_STATUSES = /* @__PURE__ */ new Set(["completed", "escalate"]);
|
|
26987
|
-
var DIARIST_STATUS_REASK = "status \u4E0D\u662F completed\u3001escalate \u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
26988
27038
|
function createDiaristRoleRuntime(roleHost, dependencies) {
|
|
26989
27039
|
return createFiledOfficerRuntime(
|
|
26990
27040
|
roleHost,
|
|
@@ -26996,7 +27046,7 @@ function createDiaristRoleRuntime(roleHost, dependencies) {
|
|
|
26996
27046
|
const submitted = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) ? parameters : void 0;
|
|
26997
27047
|
const status = submitted?.status;
|
|
26998
27048
|
if (typeof status !== "string" || !DIARIST_ROUTING_STATUSES.has(status)) {
|
|
26999
|
-
throw new ParentQueueReaskError(
|
|
27049
|
+
throw new ParentQueueReaskError(unreadableDiscriminatorNotice("status", submitted?.status));
|
|
27000
27050
|
}
|
|
27001
27051
|
if (status === "escalate") return parameters;
|
|
27002
27052
|
const assertion = readDiaristTicketAssertion(submitted);
|
|
@@ -27036,10 +27086,7 @@ ${error.message}`
|
|
|
27036
27086
|
dependencies
|
|
27037
27087
|
);
|
|
27038
27088
|
}
|
|
27039
|
-
var COUNTERSIGN_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "continue", "escalate"]);
|
|
27040
|
-
var COUNTERSIGN_STATUS_REASK = "status \u4E0D\u662F converged\u3001continue\u3001escalate \u4E09\u6001\u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
27041
27089
|
var SECRETARIAT_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "escalate"]);
|
|
27042
|
-
var SECRETARIAT_STATUS_REASK = "secretariatStatus \u4E0D\u662F converged\u3001escalate \u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
27043
27090
|
function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
27044
27091
|
const beforeAccept = hostActions !== void 0 ? async ({ toolCallId, parameters, signal, ctx }) => {
|
|
27045
27092
|
if (roleHost.requireSubmissionGate === void 0) {
|
|
@@ -27050,7 +27097,9 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27050
27097
|
const record4 = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) ? parameters : void 0;
|
|
27051
27098
|
const status = record4 !== void 0 && typeof record4.secretariatStatus === "string" ? record4.secretariatStatus : void 0;
|
|
27052
27099
|
if (status === void 0 || !SECRETARIAT_QUEUE_STATUSES.has(status)) {
|
|
27053
|
-
throw new ParentQueueReaskError(
|
|
27100
|
+
throw new ParentQueueReaskError(
|
|
27101
|
+
unreadableDiscriminatorNotice("secretariatStatus", record4?.secretariatStatus)
|
|
27102
|
+
);
|
|
27054
27103
|
}
|
|
27055
27104
|
if (status === "escalate") {
|
|
27056
27105
|
return void 0;
|
|
@@ -27144,8 +27193,8 @@ function createCountersignRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27144
27193
|
const beforeAccept = hostActions !== void 0 ? async ({ toolCallId, parameters, signal, ctx }) => {
|
|
27145
27194
|
const record4 = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) ? parameters : void 0;
|
|
27146
27195
|
const status = record4 !== void 0 && typeof record4.status === "string" ? record4.status : void 0;
|
|
27147
|
-
if (status === void 0 || !
|
|
27148
|
-
throw new ParentQueueReaskError(
|
|
27196
|
+
if (status === void 0 || !REVIEW_QUEUE_STATUSES.has(status)) {
|
|
27197
|
+
throw new ParentQueueReaskError(unreadableDiscriminatorNotice("status", record4?.status));
|
|
27149
27198
|
}
|
|
27150
27199
|
if (status === "escalate") {
|
|
27151
27200
|
return void 0;
|
|
@@ -27302,13 +27351,11 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27302
27351
|
const raced = await raceNavigatorGrace(settlePromise, NAVIGATOR_POST_ROLE_GRACE_MS);
|
|
27303
27352
|
if (raced.status !== "timeout") return;
|
|
27304
27353
|
if (pendingNavigatorPresentation === void 0) {
|
|
27305
|
-
const routePlaybookReadFailure = attendance.knownRoutePlaybookReadFailure?.();
|
|
27306
27354
|
const report = {
|
|
27307
27355
|
disposition: "unavailable",
|
|
27308
27356
|
unavailableReason: "Navigator exceeded post-role delivery grace",
|
|
27309
27357
|
unavailableSource: "unknown",
|
|
27310
|
-
unavailableCause: "unknown"
|
|
27311
|
-
...routePlaybookReadFailure === void 0 ? {} : { routePlaybookReadFailure }
|
|
27358
|
+
unavailableCause: "unknown"
|
|
27312
27359
|
};
|
|
27313
27360
|
const event = {
|
|
27314
27361
|
version: 1,
|
|
@@ -27319,8 +27366,7 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27319
27366
|
subjectKey: workContext?.subjectKey ?? "",
|
|
27320
27367
|
unavailableReason: "Navigator exceeded post-role delivery grace",
|
|
27321
27368
|
unavailableSource: "unknown",
|
|
27322
|
-
unavailableCause: "unknown"
|
|
27323
|
-
...routePlaybookReadFailure === void 0 ? {} : { routePlaybookReadFailure }
|
|
27369
|
+
unavailableCause: "unknown"
|
|
27324
27370
|
};
|
|
27325
27371
|
pendingNavigatorPresentation = { event, report };
|
|
27326
27372
|
}
|
|
@@ -27531,7 +27577,7 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27531
27577
|
}
|
|
27532
27578
|
envelopeHost.sendMessage({
|
|
27533
27579
|
customType: "ak-receipt-delivery-prompt",
|
|
27534
|
-
content:
|
|
27580
|
+
content: JSON.stringify(receiptDelivery.deliveryState()),
|
|
27535
27581
|
display: false
|
|
27536
27582
|
}, { triggerTurn: true, deliverAs: "followUp" });
|
|
27537
27583
|
} else if (receiptDelivery.nextAction() === "no-receipt" && !noReceiptRecorded) {
|
|
@@ -27695,7 +27741,12 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27695
27741
|
loadSoul: () => requireRoleSoul("gatekeeper")
|
|
27696
27742
|
});
|
|
27697
27743
|
const navigator = createNavigatorRoleRuntime(roleHost, {
|
|
27698
|
-
loadSoul: () => requireRoleSoul("navigator")
|
|
27744
|
+
loadSoul: () => requireRoleSoul("navigator"),
|
|
27745
|
+
recordRoutePlaybookReadFailure: (message) => {
|
|
27746
|
+
envelopeHost.appendEntry(NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY, {
|
|
27747
|
+
message: message ?? ""
|
|
27748
|
+
});
|
|
27749
|
+
}
|
|
27699
27750
|
});
|
|
27700
27751
|
const auditor = createAuditorRoleRuntime(roleHost, {
|
|
27701
27752
|
loadSoul: () => requireRoleSoul("auditor")
|
|
@@ -28002,7 +28053,6 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
28002
28053
|
pendingNavigatorPresentation = { event: navigatorEvent, report };
|
|
28003
28054
|
}
|
|
28004
28055
|
});
|
|
28005
|
-
navigatorAttendance.warmHelp?.();
|
|
28006
28056
|
if (navigatorWorkContext.contextError === void 0 && navigatorWorkContext.subjectProvenance !== "placeholder") {
|
|
28007
28057
|
navigatorAttendance.prepare();
|
|
28008
28058
|
}
|
|
@@ -28035,11 +28085,11 @@ init_submission_correctable_error();
|
|
|
28035
28085
|
init_navigator_invocation_identity();
|
|
28036
28086
|
init_serialize_thrown_value();
|
|
28037
28087
|
async function listen(server, path) {
|
|
28038
|
-
await new Promise((
|
|
28088
|
+
await new Promise((resolve22, reject) => {
|
|
28039
28089
|
server.once("error", reject);
|
|
28040
28090
|
server.listen(path, () => {
|
|
28041
28091
|
server.off("error", reject);
|
|
28042
|
-
|
|
28092
|
+
resolve22();
|
|
28043
28093
|
});
|
|
28044
28094
|
});
|
|
28045
28095
|
}
|
|
@@ -28074,8 +28124,8 @@ async function prepareRoleEnvelope(options) {
|
|
|
28074
28124
|
const hostAbort = new AbortController();
|
|
28075
28125
|
const runId = request.runDirectory.split("/").filter(Boolean).at(-1) ?? randomUUID9();
|
|
28076
28126
|
await mkdir5(request.runDirectory, { recursive: true });
|
|
28077
|
-
let sessionFile = options.sessionFile ??
|
|
28078
|
-
await mkdir5(
|
|
28127
|
+
let sessionFile = options.sessionFile ?? join45(request.runDirectory, "session", "session.jsonl");
|
|
28128
|
+
await mkdir5(dirname23(sessionFile), { recursive: true });
|
|
28079
28129
|
if (request.continuation.kind !== "resume") {
|
|
28080
28130
|
try {
|
|
28081
28131
|
await writeFile11(
|
|
@@ -28125,7 +28175,7 @@ async function prepareRoleEnvelope(options) {
|
|
|
28125
28175
|
getLeafEntry: () => sessionEntries.at(-1),
|
|
28126
28176
|
getLeafId: () => runId,
|
|
28127
28177
|
getEntries: () => sessionEntries,
|
|
28128
|
-
getSessionDir: () =>
|
|
28178
|
+
getSessionDir: () => dirname23(sessionFile),
|
|
28129
28179
|
getSessionFile: () => sessionFile,
|
|
28130
28180
|
getHeader: () => ({ type: "session", id: runId }),
|
|
28131
28181
|
setSessionFile(path) {
|
|
@@ -28483,8 +28533,8 @@ async function prepareRoleEnvelope(options) {
|
|
|
28483
28533
|
try {
|
|
28484
28534
|
const closeAll = server.closeAllConnections;
|
|
28485
28535
|
if (typeof closeAll === "function") closeAll.call(server);
|
|
28486
|
-
await new Promise((
|
|
28487
|
-
server.close((error) => error ? reject(error) :
|
|
28536
|
+
await new Promise((resolve22, reject) => {
|
|
28537
|
+
server.close((error) => error ? reject(error) : resolve22());
|
|
28488
28538
|
});
|
|
28489
28539
|
} catch (error) {
|
|
28490
28540
|
cleanupFailures.push(error);
|
|
@@ -28614,15 +28664,15 @@ async function prepareRoleEnvelope(options) {
|
|
|
28614
28664
|
|
|
28615
28665
|
// src/role-runtime-dependencies.ts
|
|
28616
28666
|
init_collector_github();
|
|
28617
|
-
import { readFile as
|
|
28618
|
-
import { join as
|
|
28667
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
28668
|
+
import { join as join46 } from "node:path";
|
|
28619
28669
|
init_doctor_evidence();
|
|
28620
28670
|
|
|
28621
28671
|
// src/navigator-work-context.ts
|
|
28622
28672
|
init_doctor_evidence();
|
|
28623
28673
|
init_host_contracts();
|
|
28624
|
-
import { readFile as
|
|
28625
|
-
import { resolve as
|
|
28674
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
28675
|
+
import { resolve as resolve20 } from "node:path";
|
|
28626
28676
|
init_notary_source_run();
|
|
28627
28677
|
init_packaged_role_registry();
|
|
28628
28678
|
init_invocation();
|
|
@@ -28630,12 +28680,12 @@ function navigatorInputReference(getFlag, role) {
|
|
|
28630
28680
|
if (getFlag === void 0) return void 0;
|
|
28631
28681
|
const name = packagedRoleInputFlag(role);
|
|
28632
28682
|
const value = name === void 0 ? void 0 : getFlag(name);
|
|
28633
|
-
return typeof value === "string" && value !== "" ?
|
|
28683
|
+
return typeof value === "string" && value !== "" ? resolve20(value) : void 0;
|
|
28634
28684
|
}
|
|
28635
28685
|
async function loadNavigatorWorkContext(options) {
|
|
28636
28686
|
const reference = navigatorInputReference(options.getFlag, options.role);
|
|
28637
28687
|
const subjectMode = packagedNavigatorSubject(options.role);
|
|
28638
|
-
const input = reference === void 0 || subjectMode === "case" || subjectMode === "source-run" ? void 0 : await
|
|
28688
|
+
const input = reference === void 0 || subjectMode === "case" || subjectMode === "source-run" ? void 0 : await readFile24(reference, "utf8");
|
|
28639
28689
|
const subjectRoot = subjectPath(reference ?? options.context.sessionManager.getSessionDir(), options.context.cwd);
|
|
28640
28690
|
let subjectKey = reference === void 0 ? subjectRoot : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
|
|
28641
28691
|
let subject = input ?? `work subject: ${subjectKey}`;
|
|
@@ -28652,7 +28702,7 @@ async function loadNavigatorWorkContext(options) {
|
|
|
28652
28702
|
}
|
|
28653
28703
|
const publicRunDir = runDirectoryFromHostContext(options.context);
|
|
28654
28704
|
const currentSessionDir = options.context.sessionManager.getSessionDir();
|
|
28655
|
-
const isBoundPublicRun = publicRunDir !== void 0 &&
|
|
28705
|
+
const isBoundPublicRun = publicRunDir !== void 0 && resolve20(currentSessionDir) === resolve20(publicRunDir, "session");
|
|
28656
28706
|
if (subjectMode === "public-instruction" && isBoundPublicRun) {
|
|
28657
28707
|
let admitted;
|
|
28658
28708
|
try {
|
|
@@ -28685,14 +28735,14 @@ async function loadNavigatorWorkContext(options) {
|
|
|
28685
28735
|
}
|
|
28686
28736
|
const workRoot = subjectRoot.includes("/.ak/work/") ? subjectRoot : void 0;
|
|
28687
28737
|
const authorityFiles = workRoot === void 0 ? [] : [
|
|
28688
|
-
|
|
28689
|
-
|
|
28690
|
-
|
|
28738
|
+
resolve20(workRoot, "authority.md"),
|
|
28739
|
+
resolve20(workRoot, "authority.txt"),
|
|
28740
|
+
resolve20(workRoot, "design-v2/owner-direction.md")
|
|
28691
28741
|
];
|
|
28692
28742
|
let authorityMaterial;
|
|
28693
28743
|
for (const path of authorityFiles) {
|
|
28694
28744
|
try {
|
|
28695
|
-
const content = await
|
|
28745
|
+
const content = await readFile24(path, "utf8");
|
|
28696
28746
|
if (content.trim() !== "") {
|
|
28697
28747
|
authorityMaterial = content;
|
|
28698
28748
|
break;
|
|
@@ -28729,21 +28779,20 @@ function loadRegisteredRoleSoul(role) {
|
|
|
28729
28779
|
return usesSubjectSoul(role) ? loadAuditorSoulFromSubjectInput() : loadMainRoleSessionMaterials(role);
|
|
28730
28780
|
}
|
|
28731
28781
|
function createRoleRuntimeDependencies(packageRoot) {
|
|
28732
|
-
const
|
|
28733
|
-
const collectorHandbookSeedPath = join45(packageRoot, "resources/collector-bot-handbook.md");
|
|
28782
|
+
const collectorHandbookSeedPath = join46(packageRoot, "resources/collector-bot-handbook.md");
|
|
28734
28783
|
const doctorAuditor = createPiDoctorAuditor();
|
|
28735
28784
|
const navigatorSessionFactory = createNativeNavigatorSessionFactory();
|
|
28736
28785
|
return {
|
|
28737
28786
|
packageRoot,
|
|
28738
28787
|
loadRoleReferenceMaterials: loadPackagedRoleReferenceMaterials,
|
|
28739
28788
|
loadRoleSoul: loadRegisteredRoleSoul,
|
|
28740
|
-
loadFixPacket: (path) =>
|
|
28741
|
-
loadCoderTask: (path) =>
|
|
28742
|
-
loadCollectorHandbookSeed: () =>
|
|
28789
|
+
loadFixPacket: (path) => readFile25(path, "utf8"),
|
|
28790
|
+
loadCoderTask: (path) => readFile25(path, "utf8"),
|
|
28791
|
+
loadCollectorHandbookSeed: () => readFile25(collectorHandbookSeedPath, "utf8"),
|
|
28743
28792
|
createCollectorTransport: () => createGhCollectorGitHubTransport(),
|
|
28744
28793
|
loadDoctorCase,
|
|
28745
28794
|
loadNotarySourceRun: loadNotarySourceRunLocator,
|
|
28746
|
-
loadMergerInput: async (path) => JSON.parse(await
|
|
28795
|
+
loadMergerInput: async (path) => JSON.parse(await readFile25(path, "utf8")),
|
|
28747
28796
|
// #590: doctor compliance still on disposeCompliance path; judge→auditor is gate queue (#756).
|
|
28748
28797
|
auditDoctorCompliance: (options) => doctorAuditor(options),
|
|
28749
28798
|
loadNavigatorWorkContext: (options) => loadNavigatorWorkContext({
|
|
@@ -28759,9 +28808,6 @@ function createRoleRuntimeDependencies(packageRoot) {
|
|
|
28759
28808
|
subject: options.subject,
|
|
28760
28809
|
authority: options.authority,
|
|
28761
28810
|
invocationId: options.invocationId,
|
|
28762
|
-
loadSoul: () => loadRegisteredRoleSoul("navigator"),
|
|
28763
|
-
loadRoutePlaybook: () => readFile24(navigatorRoutePlaybookPath, "utf8"),
|
|
28764
|
-
loadRoleHelp: async (role) => formatNavigatorRoleHelp(role),
|
|
28765
28811
|
createSession: navigatorSessionFactory,
|
|
28766
28812
|
...options.contextError === void 0 ? {} : { contextError: options.contextError },
|
|
28767
28813
|
onEvent: options.onEvent
|
|
@@ -28773,9 +28819,9 @@ function createRoleRuntimeDependencies(packageRoot) {
|
|
|
28773
28819
|
init_session_identity();
|
|
28774
28820
|
|
|
28775
28821
|
// src/acp-host/description.ts
|
|
28776
|
-
import { join as
|
|
28822
|
+
import { join as join47 } from "node:path";
|
|
28777
28823
|
function resolveAcpBinary(description, operatorHome) {
|
|
28778
|
-
return
|
|
28824
|
+
return join47(operatorHome, ...description.binaryFromHome);
|
|
28779
28825
|
}
|
|
28780
28826
|
function acpStdioArgs(description, model, seat) {
|
|
28781
28827
|
const { prefix, suffix, modelFlag, thinkingFlag } = description.argv;
|
|
@@ -28824,7 +28870,7 @@ function hostAbortedError(message = "host aborted") {
|
|
|
28824
28870
|
function raceAgainstHostAbort(work, abortSignal, message = "host aborted") {
|
|
28825
28871
|
if (abortSignal?.aborted) return Promise.reject(hostAbortedError(message));
|
|
28826
28872
|
if (abortSignal === void 0) return work;
|
|
28827
|
-
return new Promise((
|
|
28873
|
+
return new Promise((resolve22, reject) => {
|
|
28828
28874
|
let settled = false;
|
|
28829
28875
|
const onAbort = () => {
|
|
28830
28876
|
if (settled) return;
|
|
@@ -28839,7 +28885,7 @@ function raceAgainstHostAbort(work, abortSignal, message = "host aborted") {
|
|
|
28839
28885
|
if (settled) return;
|
|
28840
28886
|
settled = true;
|
|
28841
28887
|
abortSignal.removeEventListener("abort", onAbort);
|
|
28842
|
-
|
|
28888
|
+
resolve22(value);
|
|
28843
28889
|
},
|
|
28844
28890
|
(error) => {
|
|
28845
28891
|
if (settled) return;
|
|
@@ -29091,8 +29137,8 @@ function connectAcpStdio(options) {
|
|
|
29091
29137
|
request(method, params) {
|
|
29092
29138
|
if (closed) return Promise.reject(terminalError ?? acpError("acp-connection-closed", "ACP connection is closed"));
|
|
29093
29139
|
const id = ++nextId;
|
|
29094
|
-
return new Promise((
|
|
29095
|
-
pending.set(id, { resolve:
|
|
29140
|
+
return new Promise((resolve22, reject) => {
|
|
29141
|
+
pending.set(id, { resolve: resolve22, reject });
|
|
29096
29142
|
child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}
|
|
29097
29143
|
`, (error) => {
|
|
29098
29144
|
if (error === null || error === void 0) return;
|
|
@@ -29119,7 +29165,7 @@ function connectAcpStdio(options) {
|
|
|
29119
29165
|
settleClosed(acpError("acp-connection-closed", "ACP connection is closed"));
|
|
29120
29166
|
child.stdin.end();
|
|
29121
29167
|
child.kill("SIGTERM");
|
|
29122
|
-
await new Promise((
|
|
29168
|
+
await new Promise((resolve22) => child.once("close", () => resolve22()));
|
|
29123
29169
|
}
|
|
29124
29170
|
});
|
|
29125
29171
|
}
|
|
@@ -29341,12 +29387,12 @@ function createAcpRoleTurnHost(config) {
|
|
|
29341
29387
|
// src/acp-host/seat-profile-soul.ts
|
|
29342
29388
|
import { constants as constants3 } from "node:fs";
|
|
29343
29389
|
import { access as access4, copyFile, lstat as lstat8, mkdir as mkdir6, readlink, symlink as symlink2, unlink as unlink6 } from "node:fs/promises";
|
|
29344
|
-
import { dirname as
|
|
29390
|
+
import { dirname as dirname24, join as join48, relative as relative3, resolve as resolve21 } from "node:path";
|
|
29345
29391
|
function seatProfileName(spec, role) {
|
|
29346
29392
|
return `${spec.namePrefix}${role}`;
|
|
29347
29393
|
}
|
|
29348
29394
|
function packageRoleSoulPath(packageRoot, role) {
|
|
29349
|
-
return
|
|
29395
|
+
return join48(packageRoot, "souls", `${role}.md`);
|
|
29350
29396
|
}
|
|
29351
29397
|
async function pathExists2(path) {
|
|
29352
29398
|
try {
|
|
@@ -29359,20 +29405,20 @@ async function pathExists2(path) {
|
|
|
29359
29405
|
async function ensureSeatProfileSoul(options) {
|
|
29360
29406
|
const { spec, operatorHome, packageRoot, role } = options;
|
|
29361
29407
|
const profileName = seatProfileName(spec, role);
|
|
29362
|
-
const soulTarget =
|
|
29408
|
+
const soulTarget = resolve21(packageRoleSoulPath(packageRoot, role));
|
|
29363
29409
|
if (!await pathExists2(soulTarget)) {
|
|
29364
29410
|
throw new Error(`packaged role soul missing: ${soulTarget}`);
|
|
29365
29411
|
}
|
|
29366
|
-
const profilesRoot =
|
|
29367
|
-
const profileDir =
|
|
29368
|
-
const hostRoot =
|
|
29369
|
-
const soulPath =
|
|
29412
|
+
const profilesRoot = join48(operatorHome, ...spec.profilesRootFromHome);
|
|
29413
|
+
const profileDir = join48(profilesRoot, profileName);
|
|
29414
|
+
const hostRoot = dirname24(profilesRoot);
|
|
29415
|
+
const soulPath = join48(profileDir, spec.soulFileName);
|
|
29370
29416
|
if (!await pathExists2(profileDir)) {
|
|
29371
29417
|
await mkdir6(profileDir, { recursive: true });
|
|
29372
29418
|
for (const name of ["auth.json", ".env", "config.yaml"]) {
|
|
29373
|
-
const source =
|
|
29419
|
+
const source = join48(hostRoot, name);
|
|
29374
29420
|
if (!await pathExists2(source)) continue;
|
|
29375
|
-
await copyFile(source,
|
|
29421
|
+
await copyFile(source, join48(profileDir, name));
|
|
29376
29422
|
}
|
|
29377
29423
|
} else {
|
|
29378
29424
|
await mkdir6(profileDir, { recursive: true });
|