@akagilnc/pi-workflow-roles 0.1.4977 → 0.1.4989
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 +460 -462
- package/dist/analyst-gate-cycles-read.js +16 -11
- package/dist/analyst-metric-families/gate-cycles.js +2 -2
- package/dist/audit-escalation.js +19 -4
- package/dist/compliance-transport.js +2 -2
- package/dist/countersign-contracts.js +6 -5
- package/dist/doctor-evidence.js +2 -1
- package/dist/gatekeeper-role.js +22 -43
- package/dist/headless-host/production-host.js +460 -462
- package/dist/inspector-contracts.js +3 -2
- package/dist/migrate-book-topology.js +59 -54
- package/dist/navigator-invocation-identity.js +6 -4
- package/dist/notary-contracts.js +3 -19
- package/dist/package-contracts/auditor-output.js +4 -19
- package/dist/package-contracts/judge-output.js +6 -5
- package/dist/package-contracts/terminating-tools.js +9 -3
- package/dist/packaged-role-registry.js +10 -12
- package/dist/public-cli/countersign-run.js +1 -1
- package/dist/public-cli/main.js +95 -87
- package/dist/public-cli/option-definitions.js +2 -2
- package/dist/public-cli/settlement.js +15 -12
- package/dist/review-submission.js +20 -0
- package/dist/submission-errors.js +2 -2
- package/dist/submission-ledger.js +16 -2
- package/package.json +1 -1
- package/souls/doctor-auditor.md +1 -1
- package/souls/fixer-auditor.md +4 -4
- package/souls/gate-output-guide.md +2 -2
- package/souls/inspector.md +1 -1
- package/souls/judge-auditor.md +2 -2
- package/souls/notary.md +1 -1
- package/souls/quality-law.md +1 -1
- package/src/analyst-gate-cycles-read.ts +17 -9
- package/src/analyst-metric-families/gate-cycles.ts +2 -2
- package/src/audit-escalation.ts +27 -7
- package/src/auditor-role.ts +1 -1
- package/src/compliance-transport.ts +7 -7
- package/src/countersign-contracts.ts +10 -8
- package/src/countersign-role.ts +6 -35
- package/src/doctor-evidence.ts +2 -1
- package/src/doctor-role.ts +1 -2
- package/src/gatekeeper-role.ts +32 -57
- package/src/host-contracts.ts +4 -3
- package/src/inspector-contracts.ts +7 -6
- package/src/inspector-role.ts +3 -20
- package/src/judge-role.ts +31 -51
- package/src/navigator-invocation-identity.ts +16 -4
- package/src/notary-contracts.ts +8 -26
- package/src/notary-role.ts +1 -1
- package/src/package-contracts/auditor-output.ts +6 -27
- package/src/package-contracts/judge-output.ts +10 -8
- package/src/package-contracts/terminating-tools.ts +9 -3
- package/src/packaged-role-registry.ts +12 -13
- package/src/pi/adapter.ts +6 -5
- package/src/public-cli/countersign-run.ts +1 -1
- package/src/public-cli/option-definitions.ts +2 -2
- package/src/public-cli/settlement.ts +18 -15
- package/src/review-submission.ts +29 -0
- package/src/role-envelope.ts +17 -9
- package/src/role-runtime.ts +32 -15
- package/src/submission-errors.ts +6 -6
- package/src/{gatekeeper-pass-envelope.ts → submission-gate.ts} +29 -16
- package/src/submission-ledger.ts +18 -3
- package/src/ticket-trajectory.ts +9 -4
- package/src/worker-role.ts +19 -5
|
@@ -2155,7 +2155,7 @@ function serializeReceipt(receipt) {
|
|
|
2155
2155
|
return readableGateItem(receipt);
|
|
2156
2156
|
}
|
|
2157
2157
|
function gatekeeperNonPassMessage(result) {
|
|
2158
|
-
if (result.status === "
|
|
2158
|
+
if (result.status === "continue" || result.status === "escalate") {
|
|
2159
2159
|
return serializeReceipt(result.receipt);
|
|
2160
2160
|
}
|
|
2161
2161
|
if (result.status === "transport_failure") {
|
|
@@ -3323,19 +3323,49 @@ var init_navigator_output = __esm({
|
|
|
3323
3323
|
}
|
|
3324
3324
|
});
|
|
3325
3325
|
|
|
3326
|
+
// src/review-submission.ts
|
|
3327
|
+
import { Type as Type6 } from "typebox";
|
|
3328
|
+
var REVIEW_SUBMISSION_OUTPUT_TOOL_NAME, reviewSubmissionSchema;
|
|
3329
|
+
var init_review_submission = __esm({
|
|
3330
|
+
"src/review-submission.ts"() {
|
|
3331
|
+
"use strict";
|
|
3332
|
+
init_open_tool_schema();
|
|
3333
|
+
init_terminating_infrastructure();
|
|
3334
|
+
REVIEW_SUBMISSION_OUTPUT_TOOL_NAME = "ak_submission_output";
|
|
3335
|
+
reviewSubmissionSchema = withTerminatingOutputDeclarations(
|
|
3336
|
+
openToolObject(
|
|
3337
|
+
Type6.Object({
|
|
3338
|
+
status: Type6.Optional(Type6.Unknown({
|
|
3339
|
+
description: "converged | continue | escalate \u2014 \u975E\u4E09\u6001\u65F6\u8BF7\u91CD\u8BFB\u540E\u91CD\u4EA4\uFF0C\u52FF\u6539\u6807\u3002"
|
|
3340
|
+
})),
|
|
3341
|
+
findings: Type6.Optional(Type6.Unknown({ description: "\u5BA1\u6838\u53D1\u73B0\uFF0C\u539F\u6837\u7559\u5B58" })),
|
|
3342
|
+
reason: Type6.Optional(Type6.Unknown({ description: "\u4E0A\u5448\u7406\u7531" })),
|
|
3343
|
+
violations: Type6.Optional(Type6.Unknown({ description: "\u8FDD\u89C4\u6761\u76EE" })),
|
|
3344
|
+
conflicts: Type6.Optional(Type6.Unknown({ description: "\u5F85\u51B3\u51B2\u7A81" })),
|
|
3345
|
+
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" })),
|
|
3346
|
+
classes: Type6.Optional(Type6.Unknown({ description: "\u5DF2\u88C1\u51B3 finding \u7C7B\uFF1B\u53EF\u8BF4\u660E name\u3001owner\u3001boundary\u3001disposition\uFF0C\u539F\u6837\u7559\u5B58" })),
|
|
3347
|
+
note: Type6.Optional(Type6.Unknown({ description: "\u88C1\u51B3\u9644\u6CE8" })),
|
|
3348
|
+
evidence: Type6.Optional(Type6.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
3349
|
+
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" }))
|
|
3350
|
+
})
|
|
3351
|
+
)
|
|
3352
|
+
);
|
|
3353
|
+
}
|
|
3354
|
+
});
|
|
3355
|
+
|
|
3326
3356
|
// src/package-contracts/judge-output.ts
|
|
3327
3357
|
function validateAcceptedJudgeDetails(verdict) {
|
|
3328
3358
|
if (verdict === null || typeof verdict !== "object" || Array.isArray(verdict)) throw new Error("Judge verdict has no execution discriminator");
|
|
3329
|
-
let
|
|
3359
|
+
let status;
|
|
3330
3360
|
try {
|
|
3331
|
-
|
|
3361
|
+
status = verdict.status;
|
|
3332
3362
|
} catch {
|
|
3333
3363
|
throw new Error("Judge verdict has no execution discriminator");
|
|
3334
3364
|
}
|
|
3335
|
-
if (typeof
|
|
3365
|
+
if (typeof status !== "string") {
|
|
3336
3366
|
throw new Error("Judge verdict has no execution discriminator");
|
|
3337
3367
|
}
|
|
3338
|
-
if (["converged", "continue", "escalate"].includes(
|
|
3368
|
+
if (["converged", "continue", "escalate"].includes(status)) {
|
|
3339
3369
|
return verdict;
|
|
3340
3370
|
}
|
|
3341
3371
|
throw new Error("Judge verdict has no execution discriminator");
|
|
@@ -3344,7 +3374,8 @@ var JUDGE_OUTPUT_TOOL_NAME;
|
|
|
3344
3374
|
var init_judge_output = __esm({
|
|
3345
3375
|
"src/package-contracts/judge-output.ts"() {
|
|
3346
3376
|
"use strict";
|
|
3347
|
-
|
|
3377
|
+
init_review_submission();
|
|
3378
|
+
JUDGE_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
3348
3379
|
}
|
|
3349
3380
|
});
|
|
3350
3381
|
|
|
@@ -3358,7 +3389,7 @@ var init_reviewer_output = __esm({
|
|
|
3358
3389
|
});
|
|
3359
3390
|
|
|
3360
3391
|
// src/package-contracts/fixer-output.ts
|
|
3361
|
-
import { Type as
|
|
3392
|
+
import { Type as Type7 } from "typebox";
|
|
3362
3393
|
function validateFixerOutput(value, _phase) {
|
|
3363
3394
|
return value;
|
|
3364
3395
|
}
|
|
@@ -3369,39 +3400,39 @@ var init_fixer_output = __esm({
|
|
|
3369
3400
|
init_open_tool_schema();
|
|
3370
3401
|
init_terminating_infrastructure();
|
|
3371
3402
|
FIXER_OUTPUT_TOOL_NAME = "ak_fixer_output";
|
|
3372
|
-
transportString =
|
|
3373
|
-
authorityBlockerSchema =
|
|
3374
|
-
prerequisiteBlockerSchema =
|
|
3375
|
-
blockerSchema =
|
|
3376
|
-
exceptionSchema =
|
|
3377
|
-
testEvidenceSchema =
|
|
3378
|
-
contract:
|
|
3379
|
-
minimumNecessaryCost:
|
|
3380
|
-
measuredDuration:
|
|
3403
|
+
transportString = Type7.String();
|
|
3404
|
+
authorityBlockerSchema = Type7.Object({ cause: Type7.Optional(Type7.Literal("authority_violation")), evidence: Type7.Optional(transportString) });
|
|
3405
|
+
prerequisiteBlockerSchema = Type7.Object({ cause: Type7.Optional(Type7.Literal("prerequisite_unmet")), prerequisiteId: Type7.Optional(transportString), evidence: Type7.Optional(transportString) });
|
|
3406
|
+
blockerSchema = Type7.Union([authorityBlockerSchema, prerequisiteBlockerSchema]);
|
|
3407
|
+
exceptionSchema = Type7.Object({ where: Type7.Optional(transportString), reason: Type7.Optional(transportString) });
|
|
3408
|
+
testEvidenceSchema = Type7.Object({
|
|
3409
|
+
contract: Type7.Optional(Type7.String({ description: "\u6D4B\u8BD5\u6539\u52A8\u6240\u8BC1\u660E\u7684\u5951\u7EA6" })),
|
|
3410
|
+
minimumNecessaryCost: Type7.Optional(Type7.String({ description: "\u6D4B\u8BD5\u6539\u52A8\u7684\u4E00\u884C\u6700\u5C0F\u5FC5\u8981\u6210\u672C" })),
|
|
3411
|
+
measuredDuration: Type7.Optional(Type7.String({ description: "\u805A\u7126\u9A8C\u8BC1\u5B9E\u6D4B\u65F6\u957F" }))
|
|
3381
3412
|
}, { description: "\u6D4B\u8BD5\u8BC1\u636E\u6761\uFF1Bdiff \u542B\u6D4B\u8BD5\u6539\u52A8\u65F6\u63D0\u4EA4\uFF1B\u673A\u5668\u4E0D\u6838\u9A8C\u3002" });
|
|
3382
|
-
completedClassResultSchema =
|
|
3383
|
-
name:
|
|
3384
|
-
disposition:
|
|
3385
|
-
searchScope:
|
|
3386
|
-
exceptions:
|
|
3387
|
-
commitSha:
|
|
3413
|
+
completedClassResultSchema = Type7.Object({
|
|
3414
|
+
name: Type7.Optional(transportString),
|
|
3415
|
+
disposition: Type7.Optional(Type7.Literal("completed")),
|
|
3416
|
+
searchScope: Type7.Optional(transportString),
|
|
3417
|
+
exceptions: Type7.Optional(Type7.Array(exceptionSchema)),
|
|
3418
|
+
commitSha: Type7.Optional(transportString)
|
|
3388
3419
|
});
|
|
3389
|
-
refusedClassResultSchema =
|
|
3390
|
-
name:
|
|
3391
|
-
disposition:
|
|
3392
|
-
remainingScope:
|
|
3393
|
-
blocker:
|
|
3420
|
+
refusedClassResultSchema = Type7.Object({
|
|
3421
|
+
name: Type7.Optional(transportString),
|
|
3422
|
+
disposition: Type7.Optional(Type7.Literal("refused")),
|
|
3423
|
+
remainingScope: Type7.Optional(transportString),
|
|
3424
|
+
blocker: Type7.Optional(blockerSchema)
|
|
3394
3425
|
});
|
|
3395
|
-
classResultSchema =
|
|
3396
|
-
completedClassResultsSchema =
|
|
3426
|
+
classResultSchema = Type7.Union([completedClassResultSchema, refusedClassResultSchema]);
|
|
3427
|
+
completedClassResultsSchema = Type7.Array(completedClassResultSchema);
|
|
3397
3428
|
FIXER_STATUS_DESCRIPTION = "planned | completed | refused | unfinished | partially_completed \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\uFF1Bunfinished \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";
|
|
3398
|
-
fixerOutputVariants =
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3429
|
+
fixerOutputVariants = Type7.Union([
|
|
3430
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }) }),
|
|
3431
|
+
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" }) }),
|
|
3432
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), remainingScope: Type7.String({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }), reason: Type7.Optional(Type7.String({ minLength: 1, description: "\u963B\u65AD\u539F\u56E0\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u3002\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002" })), classResults: Type7.Optional(Type7.Unsafe({ ...completedClassResultsSchema, description: "\u672C\u5C40\u5DF2\u5B8C\u6210\u7684 class \u7ED3\u7B97" })), testEvidence: Type7.Optional(testEvidenceSchema) }),
|
|
3433
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type7.Array(classResultSchema, { description: "\u5DF2\u5B8C\u6210\u7684 class \u7ED3\u7B97" }), testEvidence: Type7.Optional(testEvidenceSchema) }),
|
|
3434
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type7.Array(classResultSchema, { description: "\u5404\u7C7B\u62D2\u7EDD\u7ED3\u7B97" }) }),
|
|
3435
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type7.Array(classResultSchema, { description: "\u5404\u7C7B\u5B8C\u6210\u6216\u62D2\u7EDD\u7ED3\u7B97" }), testEvidence: Type7.Optional(testEvidenceSchema) })
|
|
3405
3436
|
]);
|
|
3406
3437
|
fixerOutputSchema = withTerminatingOutputDeclarations(
|
|
3407
3438
|
openToolObjectFromUnion(fixerOutputVariants)
|
|
@@ -3410,7 +3441,7 @@ var init_fixer_output = __esm({
|
|
|
3410
3441
|
});
|
|
3411
3442
|
|
|
3412
3443
|
// src/package-contracts/fixer-packet.ts
|
|
3413
|
-
import { Type as
|
|
3444
|
+
import { Type as Type8 } from "typebox";
|
|
3414
3445
|
import { Value } from "typebox/value";
|
|
3415
3446
|
function causeMessage(cause) {
|
|
3416
3447
|
if (cause instanceof Error) return cause.message;
|
|
@@ -3470,11 +3501,11 @@ var init_fixer_packet = __esm({
|
|
|
3470
3501
|
"src/package-contracts/fixer-packet.ts"() {
|
|
3471
3502
|
"use strict";
|
|
3472
3503
|
FIXER_PREREQUISITE_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._-]*$";
|
|
3473
|
-
fixerPrerequisiteSchema =
|
|
3474
|
-
id:
|
|
3475
|
-
requirement:
|
|
3504
|
+
fixerPrerequisiteSchema = Type8.Object({
|
|
3505
|
+
id: Type8.String({ pattern: FIXER_PREREQUISITE_ID_PATTERN }),
|
|
3506
|
+
requirement: Type8.String({ pattern: "\\S" })
|
|
3476
3507
|
}, { additionalProperties: false });
|
|
3477
|
-
fixerPrerequisitesSchema =
|
|
3508
|
+
fixerPrerequisitesSchema = Type8.Array(fixerPrerequisiteSchema);
|
|
3478
3509
|
FixerPacketValidationError = class extends Error {
|
|
3479
3510
|
code = "AK_INVALID_FIX_PACKET";
|
|
3480
3511
|
constructor(cause) {
|
|
@@ -3515,7 +3546,7 @@ var init_canonical_json = __esm({
|
|
|
3515
3546
|
});
|
|
3516
3547
|
|
|
3517
3548
|
// src/doctor-contracts.ts
|
|
3518
|
-
import { Type as
|
|
3549
|
+
import { Type as Type9 } from "typebox";
|
|
3519
3550
|
function validateDoctorSubmissionShape(value) {
|
|
3520
3551
|
return value;
|
|
3521
3552
|
}
|
|
@@ -3534,43 +3565,43 @@ var init_doctor_contracts = __esm({
|
|
|
3534
3565
|
DOCTOR_AUDIT_TOOL_NAME = "ak_doctor_audit_decision";
|
|
3535
3566
|
DOCTOR_OUTPUT_TOOL_DESCRIPTION = "\u63D0\u4EA4\u552F\u4E00\u7EC8\u5C40\u5355\u6848\u8BC1\u8BCD\uFF1Bcompleted \u5141\u8BB8\u7A7A findings\u3002";
|
|
3536
3567
|
DOCTOR_TARGET_KINDS = ["law", "gate", "template", "station", "seat"];
|
|
3537
|
-
nonblank =
|
|
3538
|
-
evidenceIds =
|
|
3539
|
-
guardrail =
|
|
3540
|
-
lastRealBite =
|
|
3541
|
-
|
|
3542
|
-
|
|
3568
|
+
nonblank = Type9.Optional(Type9.String());
|
|
3569
|
+
evidenceIds = Type9.Optional(Type9.Array(Type9.String()));
|
|
3570
|
+
guardrail = Type9.Object({ answer: Type9.Optional(Type9.Boolean()), evidenceIds, explanation: nonblank }, { additionalProperties: true });
|
|
3571
|
+
lastRealBite = Type9.Union([
|
|
3572
|
+
Type9.Object({ kind: Type9.Optional(Type9.Literal("actual")), targetKey: nonblank, evidenceId: nonblank }, { additionalProperties: true }),
|
|
3573
|
+
Type9.Object({ kind: Type9.Optional(Type9.Literal("noRealBite")), targetKey: nonblank, eligibleEvidenceIds: evidenceIds }, { additionalProperties: true })
|
|
3543
3574
|
]);
|
|
3544
3575
|
assetKinds = DOCTOR_TARGET_KINDS;
|
|
3545
3576
|
findingBody = {
|
|
3546
3577
|
evidenceIds,
|
|
3547
|
-
disposition:
|
|
3548
|
-
guardrails:
|
|
3549
|
-
prescription:
|
|
3550
|
-
lastRealBite:
|
|
3578
|
+
disposition: Type9.Optional(Type9.Union([Type9.Literal("keep"), Type9.Literal("thin"), Type9.Literal("delete")])),
|
|
3579
|
+
guardrails: Type9.Optional(Type9.Object({ reproducibleFailure: guardrail, owningSeamOrInvariant: guardrail, deletionOrSimplificationSuffices: guardrail }, { additionalProperties: true })),
|
|
3580
|
+
prescription: Type9.Optional(Type9.Object({ kind: Type9.Optional(Type9.Union([Type9.Literal("retain"), Type9.Literal("delete"), Type9.Literal("simplify"), Type9.Literal("patch"), Type9.Literal("addMechanism")])), recommendation: nonblank, necessityExplanation: nonblank }, { additionalProperties: true })),
|
|
3581
|
+
lastRealBite: Type9.Optional(lastRealBite)
|
|
3551
3582
|
};
|
|
3552
|
-
finding =
|
|
3553
|
-
|
|
3554
|
-
|
|
3583
|
+
finding = Type9.Union([
|
|
3584
|
+
Type9.Object({ targetKey: nonblank, observation: nonblank, evidenceIds }, { additionalProperties: true }),
|
|
3585
|
+
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 })
|
|
3555
3586
|
]);
|
|
3556
|
-
caseIdentity =
|
|
3587
|
+
caseIdentity = Type9.Object({ issueNumber: Type9.Optional(Type9.Integer()), runsPath: nonblank }, { additionalProperties: true });
|
|
3557
3588
|
DOCTOR_STATUS_DESCRIPTION = "completed | refused \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\uFF1Bcompleted \u5141\u8BB8\u7A7A findings\uFF1Brefused \u4EC5\u5F53\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u6848\u8BC1\u8BCD";
|
|
3558
|
-
doctorSubmissionVariants =
|
|
3559
|
-
|
|
3560
|
-
status:
|
|
3561
|
-
case:
|
|
3562
|
-
findings:
|
|
3589
|
+
doctorSubmissionVariants = Type9.Union([
|
|
3590
|
+
Type9.Object({
|
|
3591
|
+
status: Type9.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
|
|
3592
|
+
case: Type9.Unsafe({ ...caseIdentity, description: "\u7559\u5B58\u592A\u533B\u7F72\u6848\u8EAB\u4EFD" }),
|
|
3593
|
+
findings: Type9.Array(finding, { description: "\u53EF\u7A7A\u6216\u4EC5\u542B\u975E\u5904\u65B9\u6848\u89C2\u5BDF\uFF1B\u7F3A\u53EF\u590D\u7528\u8D44\u4EA7\u6216 bounded-bite \u8BC1\u636E\u53EA\u6392\u9664\u5BF9\u5E94\u8D44\u4EA7\u5904\u65B9" })
|
|
3563
3594
|
}, { additionalProperties: false, description: "\u5355\u6848\u8BC1\u8BCD\uFF0C\u4E0D\u8981\u6C42\u4EFB\u4F55\u5904\u65B9\u6216\u53EF\u590D\u7528 finding" }),
|
|
3564
|
-
|
|
3565
|
-
status:
|
|
3566
|
-
reason:
|
|
3567
|
-
missingEvidence:
|
|
3595
|
+
Type9.Object({
|
|
3596
|
+
status: Type9.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
|
|
3597
|
+
reason: Type9.String({ description: "\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u8BC1\u8BCD\u7684\u539F\u56E0" }),
|
|
3598
|
+
missingEvidence: Type9.Array(Type9.Object({ need: nonblank, targetKeys: evidenceIds }, { additionalProperties: true }), { description: "\u5982\u5B9E\u8BC1\u8BCD\u6240\u9700\u800C\u5C1A\u7F3A\u7684\u8BC1\u636E" })
|
|
3568
3599
|
}, { additionalProperties: false, description: "\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u6848\u8BC1\u8BCD" })
|
|
3569
3600
|
]);
|
|
3570
3601
|
doctorSubmissionSchema = withTerminatingOutputDeclarations(
|
|
3571
3602
|
openToolObjectFromUnion(doctorSubmissionVariants)
|
|
3572
3603
|
);
|
|
3573
|
-
doctorEvidenceReadSchema =
|
|
3604
|
+
doctorEvidenceReadSchema = Type9.Object({ evidenceId: Type9.String({ minLength: 1, description: "\u5F85\u8BFB\u7559\u5B58\u8BC1\u636E\u6807\u8BC6" }), offset: Type9.Optional(Type9.Integer({ minimum: 0, description: "\u8D77\u59CB\u5B57\u8282\u504F\u79FB\uFF08\u4ECE 0 \u8BA1\uFF09" })), limit: Type9.Optional(Type9.Integer({ minimum: 1, description: "\u8FD4\u56DE\u5B57\u8282\u6570\uFF08\u65E0\u4E0A\u9650\uFF09" })) }, { additionalProperties: true });
|
|
3574
3605
|
DoctorEvidenceStore = class {
|
|
3575
3606
|
constructor(patient) {
|
|
3576
3607
|
this.patient = patient;
|
|
@@ -3639,7 +3670,7 @@ var init_exact_utf8 = __esm({
|
|
|
3639
3670
|
});
|
|
3640
3671
|
|
|
3641
3672
|
// src/merger-contracts.ts
|
|
3642
|
-
import { Type as
|
|
3673
|
+
import { Type as Type10 } from "typebox";
|
|
3643
3674
|
function fail3(message = "Merger input violates its exact contract") {
|
|
3644
3675
|
throw new MergerInputContractError(message);
|
|
3645
3676
|
}
|
|
@@ -3669,21 +3700,21 @@ var init_merger_contracts = __esm({
|
|
|
3669
3700
|
init_exact_utf8();
|
|
3670
3701
|
init_open_tool_schema();
|
|
3671
3702
|
init_terminating_infrastructure();
|
|
3672
|
-
materialSchema =
|
|
3673
|
-
checkSchema =
|
|
3674
|
-
mergerInputSchema =
|
|
3675
|
-
attemptId:
|
|
3676
|
-
targetObjectId:
|
|
3677
|
-
sourceObjectId:
|
|
3678
|
-
materials:
|
|
3679
|
-
expectedConflictPaths:
|
|
3680
|
-
resolutionScope:
|
|
3681
|
-
authorizedChecks:
|
|
3703
|
+
materialSchema = Type10.Object({ bytesBase64: Type10.String(), sha256: Type10.String() }, { additionalProperties: false });
|
|
3704
|
+
checkSchema = Type10.Object({ name: Type10.String({ minLength: 1 }), argv: Type10.Array(Type10.String({ minLength: 1 }), { minItems: 1 }) }, { additionalProperties: false });
|
|
3705
|
+
mergerInputSchema = Type10.Object({
|
|
3706
|
+
attemptId: Type10.String({ minLength: 1, description: "\u5BF9\u8D26 attempt \u8EAB\u4EFD\uFF08transport\uFF09" }),
|
|
3707
|
+
targetObjectId: Type10.String({ description: "\u6750\u6599\uFF1Atarget parent OID\uFF1B\u53EF\u7A7A" }),
|
|
3708
|
+
sourceObjectId: Type10.String({ description: "\u6750\u6599\uFF1Asource parent OID\uFF1B\u53EF\u7A7A" }),
|
|
3709
|
+
materials: Type10.Object({ task: materialSchema, authority: materialSchema, targetIntent: materialSchema, sourceIntent: materialSchema }, { additionalProperties: false }),
|
|
3710
|
+
expectedConflictPaths: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u5F53\u524D\u672A\u5408\u5E76\u8DEF\u5F84\uFF1B\u53EF\u7A7A" }),
|
|
3711
|
+
resolutionScope: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
|
|
3712
|
+
authorizedChecks: Type10.Array(checkSchema)
|
|
3682
3713
|
}, { additionalProperties: false });
|
|
3683
3714
|
MERGER_STATUS_DESCRIPTION = "completed | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8";
|
|
3684
|
-
mergerOutputVariants =
|
|
3685
|
-
|
|
3686
|
-
|
|
3715
|
+
mergerOutputVariants = Type10.Union([
|
|
3716
|
+
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
|
+
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 })
|
|
3687
3718
|
]);
|
|
3688
3719
|
mergerOutputSchema = withTerminatingOutputDeclarations(openToolObjectFromUnion(mergerOutputVariants));
|
|
3689
3720
|
MERGER_OUTPUT_TOOL_NAME = "ak_merger_output";
|
|
@@ -3701,14 +3732,12 @@ var init_merger_contracts = __esm({
|
|
|
3701
3732
|
});
|
|
3702
3733
|
|
|
3703
3734
|
// src/notary-contracts.ts
|
|
3704
|
-
import { Type as Type10 } from "typebox";
|
|
3705
3735
|
var NOTARY_OUTPUT_TOOL_NAME, NOTARY_SOURCE_RUN_FLAG, NOTARY_TICKET_FLAG, NOTARY_FIXED_KICKOFF, notaryOutputSchema;
|
|
3706
3736
|
var init_notary_contracts = __esm({
|
|
3707
3737
|
"src/notary-contracts.ts"() {
|
|
3708
3738
|
"use strict";
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
NOTARY_OUTPUT_TOOL_NAME = "ak_notary_output";
|
|
3739
|
+
init_review_submission();
|
|
3740
|
+
NOTARY_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
3712
3741
|
NOTARY_SOURCE_RUN_FLAG = {
|
|
3713
3742
|
name: "ak-notary-source-run",
|
|
3714
3743
|
definition: {
|
|
@@ -3724,21 +3753,7 @@ var init_notary_contracts = __esm({
|
|
|
3724
3753
|
}
|
|
3725
3754
|
};
|
|
3726
3755
|
NOTARY_FIXED_KICKOFF = "\u7B26\u5B9D\u90CE\u6848\u5377\u5DF2\u53D7\u7406\uFF1B\u6765\u6E90 run \u5B9A\u4F4D\u89C1\u4F1A\u8BDD\u6750\u6599\u3002";
|
|
3727
|
-
notaryOutputSchema =
|
|
3728
|
-
openToolObject(
|
|
3729
|
-
Type10.Object({
|
|
3730
|
-
status: Type10.Unknown({
|
|
3731
|
-
description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
3732
|
-
}),
|
|
3733
|
-
findings: Type10.Unknown({
|
|
3734
|
-
description: "string[] findings\uFF0C\u968F pass\u3001bounce \u6216 escalate \u7559\u5B58"
|
|
3735
|
-
}),
|
|
3736
|
-
reason: Type10.Optional(Type10.Unknown({
|
|
3737
|
-
description: "status \u4E3A escalate \u65F6\u7684\u4E0A\u5448\u7406\u7531"
|
|
3738
|
-
}))
|
|
3739
|
-
})
|
|
3740
|
-
)
|
|
3741
|
-
);
|
|
3756
|
+
notaryOutputSchema = reviewSubmissionSchema;
|
|
3742
3757
|
}
|
|
3743
3758
|
});
|
|
3744
3759
|
|
|
@@ -3747,7 +3762,8 @@ var COUNTERSIGN_OUTPUT_TOOL_NAME;
|
|
|
3747
3762
|
var init_countersign_contracts = __esm({
|
|
3748
3763
|
"src/countersign-contracts.ts"() {
|
|
3749
3764
|
"use strict";
|
|
3750
|
-
|
|
3765
|
+
init_review_submission();
|
|
3766
|
+
COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
3751
3767
|
}
|
|
3752
3768
|
});
|
|
3753
3769
|
|
|
@@ -3772,7 +3788,8 @@ var INSPECTOR_OUTPUT_TOOL_NAME, INSPECTOR_SOURCE_RUN_FLAG;
|
|
|
3772
3788
|
var init_inspector_contracts = __esm({
|
|
3773
3789
|
"src/inspector-contracts.ts"() {
|
|
3774
3790
|
"use strict";
|
|
3775
|
-
|
|
3791
|
+
init_review_submission();
|
|
3792
|
+
INSPECTOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
3776
3793
|
INSPECTOR_SOURCE_RUN_FLAG = {
|
|
3777
3794
|
name: "ak-inspector-source-run",
|
|
3778
3795
|
definition: {
|
|
@@ -3784,32 +3801,13 @@ var init_inspector_contracts = __esm({
|
|
|
3784
3801
|
});
|
|
3785
3802
|
|
|
3786
3803
|
// src/package-contracts/auditor-output.ts
|
|
3787
|
-
import { Type as Type11 } from "typebox";
|
|
3788
3804
|
var AUDITOR_OUTPUT_TOOL_NAME, auditorOutputSchema;
|
|
3789
3805
|
var init_auditor_output = __esm({
|
|
3790
3806
|
"src/package-contracts/auditor-output.ts"() {
|
|
3791
3807
|
"use strict";
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
auditorOutputSchema = withTerminatingOutputDeclarations(
|
|
3796
|
-
openToolObject(
|
|
3797
|
-
Type11.Object({
|
|
3798
|
-
status: Type11.Unknown({
|
|
3799
|
-
description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
3800
|
-
}),
|
|
3801
|
-
violations: Type11.Optional(Type11.Unknown({
|
|
3802
|
-
description: "status \u4E3A bounce \u65F6\u7684\u8FDD\u89C4\u6761\u76EE"
|
|
3803
|
-
})),
|
|
3804
|
-
conflicts: Type11.Optional(Type11.Unknown({
|
|
3805
|
-
description: "status \u4E3A escalate \u65F6\u7684\u51B2\u7A81"
|
|
3806
|
-
})),
|
|
3807
|
-
decisionGate: Type11.Optional(Type11.Unknown({
|
|
3808
|
-
description: "status \u4E3A escalate \u65F6\u7684\u51B3\u7B56\u95F8"
|
|
3809
|
-
}))
|
|
3810
|
-
})
|
|
3811
|
-
)
|
|
3812
|
-
);
|
|
3808
|
+
init_review_submission();
|
|
3809
|
+
AUDITOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
3810
|
+
auditorOutputSchema = reviewSubmissionSchema;
|
|
3813
3811
|
}
|
|
3814
3812
|
});
|
|
3815
3813
|
|
|
@@ -4028,6 +4026,7 @@ var packaged_role_registry_exports = {};
|
|
|
4028
4026
|
__export(packaged_role_registry_exports, {
|
|
4029
4027
|
AUDITOR_PUBLIC_SESSION_MATERIALS: () => AUDITOR_PUBLIC_SESSION_MATERIALS,
|
|
4030
4028
|
INSPECTOR_SESSION_MATERIALS: () => INSPECTOR_SESSION_MATERIALS,
|
|
4029
|
+
LEGACY_REVIEW_OUTPUT_ROLES: () => LEGACY_REVIEW_OUTPUT_ROLES,
|
|
4031
4030
|
NOTARY_SESSION_MATERIALS: () => NOTARY_SESSION_MATERIALS,
|
|
4032
4031
|
PACKAGED_ROLE_REGISTRY: () => PACKAGED_ROLE_REGISTRY,
|
|
4033
4032
|
PUBLIC_ROLE_RECORDS: () => PUBLIC_ROLE_RECORDS,
|
|
@@ -4044,7 +4043,6 @@ __export(packaged_role_registry_exports, {
|
|
|
4044
4043
|
packagedBoardPlacement: () => packagedBoardPlacement,
|
|
4045
4044
|
packagedDurableOfficerEntry: () => packagedDurableOfficerEntry,
|
|
4046
4045
|
packagedEmitsAuthorityRefs: () => packagedEmitsAuthorityRefs,
|
|
4047
|
-
packagedGateDecision: () => packagedGateDecision,
|
|
4048
4046
|
packagedGateStageLabel: () => packagedGateStageLabel,
|
|
4049
4047
|
packagedGateSummon: () => packagedGateSummon,
|
|
4050
4048
|
packagedMethodLoadFailureCause: () => packagedMethodLoadFailureCause,
|
|
@@ -4211,14 +4209,7 @@ function packagedGateSummon(role) {
|
|
|
4211
4209
|
if (record4 !== void 0 && "gateSummon" in record4) return record4.gateSummon;
|
|
4212
4210
|
return "pointer";
|
|
4213
4211
|
}
|
|
4214
|
-
|
|
4215
|
-
const record4 = packagedRoleMetadata(role);
|
|
4216
|
-
if (record4 !== void 0 && "gateDecision" in record4 && record4.gateDecision === "countersign-status") {
|
|
4217
|
-
return "countersign-status";
|
|
4218
|
-
}
|
|
4219
|
-
return "three-state";
|
|
4220
|
-
}
|
|
4221
|
-
var NOTARY_SESSION_MATERIALS, INSPECTOR_SESSION_MATERIALS, AUDITOR_PUBLIC_SESSION_MATERIALS, PUBLIC_ROLE_RECORDS, PACKAGED_ROLE_REGISTRY;
|
|
4212
|
+
var LEGACY_REVIEW_OUTPUT_ROLES, NOTARY_SESSION_MATERIALS, INSPECTOR_SESSION_MATERIALS, AUDITOR_PUBLIC_SESSION_MATERIALS, PUBLIC_ROLE_RECORDS, PACKAGED_ROLE_REGISTRY;
|
|
4222
4213
|
var init_packaged_role_registry = __esm({
|
|
4223
4214
|
"src/packaged-role-registry.ts"() {
|
|
4224
4215
|
"use strict";
|
|
@@ -4239,6 +4230,13 @@ var init_packaged_role_registry = __esm({
|
|
|
4239
4230
|
init_diarist_contracts();
|
|
4240
4231
|
init_secretariat_contracts();
|
|
4241
4232
|
init_judge_auditor();
|
|
4233
|
+
LEGACY_REVIEW_OUTPUT_ROLES = /* @__PURE__ */ new Map([
|
|
4234
|
+
["ak_judge_output", "judge"],
|
|
4235
|
+
["ak_notary_output", "notary"],
|
|
4236
|
+
["ak_countersign_output", "countersign"],
|
|
4237
|
+
["ak_inspector_output", "inspector"],
|
|
4238
|
+
["ak_auditor_output", "auditor"]
|
|
4239
|
+
]);
|
|
4242
4240
|
NOTARY_SESSION_MATERIALS = [
|
|
4243
4241
|
"CLAUDE.md",
|
|
4244
4242
|
"souls/notary.md",
|
|
@@ -4280,7 +4278,7 @@ var init_packaged_role_registry = __esm({
|
|
|
4280
4278
|
/** Navigator subject is the public admitted instruction when the run is bound. */
|
|
4281
4279
|
navigatorSubject: "public-instruction",
|
|
4282
4280
|
activationStage: "load-and-install",
|
|
4283
|
-
receiptStatusKey: "
|
|
4281
|
+
receiptStatusKey: "status",
|
|
4284
4282
|
sessionMaterials: [
|
|
4285
4283
|
"CLAUDE.md",
|
|
4286
4284
|
"souls/judge.md",
|
|
@@ -4562,15 +4560,13 @@ var init_packaged_role_registry = __esm({
|
|
|
4562
4560
|
outputTool: COUNTERSIGN_OUTPUT_TOOL_NAME,
|
|
4563
4561
|
settlement: "accepted",
|
|
4564
4562
|
gateStageLabel: "\u7ED9\u4E8B\u4E2D",
|
|
4565
|
-
/** Gate queue reads countersignStatus, not the shared three-state status. */
|
|
4566
|
-
gateDecision: "countersign-status",
|
|
4567
4563
|
/** Gate summon carries the parent payload as the instruction and a parent run id. */
|
|
4568
4564
|
gateSummon: "parent-instruction",
|
|
4569
4565
|
activationFlags: [
|
|
4570
4566
|
{ field: "ticketNumber" }
|
|
4571
4567
|
],
|
|
4572
4568
|
activationStage: "load-and-install",
|
|
4573
|
-
receiptStatusKey: "
|
|
4569
|
+
receiptStatusKey: "status",
|
|
4574
4570
|
// #924: 公用《票面法》三席同装
|
|
4575
4571
|
sessionMaterials: ["CLAUDE.md", "souls/countersign.md", "souls/ticket-law.md"]
|
|
4576
4572
|
},
|
|
@@ -4936,32 +4932,22 @@ function readRecord(value) {
|
|
|
4936
4932
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
4937
4933
|
return value;
|
|
4938
4934
|
}
|
|
4939
|
-
function
|
|
4940
|
-
if (status === "converged") return "
|
|
4941
|
-
if (status === "continue") return "
|
|
4935
|
+
function reviewQueueStatus(status) {
|
|
4936
|
+
if (status === "converged") return "converged";
|
|
4937
|
+
if (status === "continue") return "continue";
|
|
4942
4938
|
if (status === "escalate") return "escalate";
|
|
4943
4939
|
return void 0;
|
|
4944
4940
|
}
|
|
4945
4941
|
function projectOfficerDecision(officer, decision, fallbackStatus) {
|
|
4946
4942
|
const receipt = retainedReceipt(decision);
|
|
4947
4943
|
const record4 = readRecord(decision);
|
|
4948
|
-
if (packagedGateDecision(officer) === "countersign-status") {
|
|
4949
|
-
const countersignStatus = record4 !== void 0 && typeof record4.countersignStatus === "string" ? record4.countersignStatus : void 0;
|
|
4950
|
-
const status2 = typeof countersignStatus === "string" ? gateStatusFromCountersign(countersignStatus) : void 0;
|
|
4951
|
-
if (status2 === "pass") {
|
|
4952
|
-
return { status: "pass", officer, receipt };
|
|
4953
|
-
}
|
|
4954
|
-
if (status2 === "bounce" || status2 === "escalate") {
|
|
4955
|
-
return { status: status2, officer, receipt };
|
|
4956
|
-
}
|
|
4957
|
-
return { status: "needs_reask", officer, receipt };
|
|
4958
|
-
}
|
|
4959
4944
|
const status = (record4 !== void 0 && typeof record4.status === "string" ? record4.status : void 0) ?? fallbackStatus;
|
|
4960
|
-
|
|
4961
|
-
|
|
4945
|
+
const queueStatus = typeof status === "string" ? reviewQueueStatus(status) : void 0;
|
|
4946
|
+
if (queueStatus === "converged") {
|
|
4947
|
+
return { status: "converged", officer, receipt };
|
|
4962
4948
|
}
|
|
4963
|
-
if (
|
|
4964
|
-
return { status, officer, receipt };
|
|
4949
|
+
if (queueStatus === "continue" || queueStatus === "escalate") {
|
|
4950
|
+
return { status: queueStatus, officer, receipt };
|
|
4965
4951
|
}
|
|
4966
4952
|
return { status: "needs_reask", officer, receipt };
|
|
4967
4953
|
}
|
|
@@ -4993,7 +4979,7 @@ function officerRunIdFromSummoned(summoned) {
|
|
|
4993
4979
|
return void 0;
|
|
4994
4980
|
}
|
|
4995
4981
|
function withOfficerRunId(result, summoned) {
|
|
4996
|
-
if (result.status !== "
|
|
4982
|
+
if (result.status !== "converged" && result.status !== "continue" && result.status !== "escalate" && result.status !== "needs_reask") {
|
|
4997
4983
|
return result;
|
|
4998
4984
|
}
|
|
4999
4985
|
if (typeof result.runId === "string" && result.runId.trim() !== "") return result;
|
|
@@ -5060,7 +5046,7 @@ function projectOfficerTerminal(officer, summoned) {
|
|
|
5060
5046
|
);
|
|
5061
5047
|
}
|
|
5062
5048
|
function officerConclusionReask(officer) {
|
|
5063
|
-
return
|
|
5049
|
+
return OFFICER_CONCLUSION_REASK;
|
|
5064
5050
|
}
|
|
5065
5051
|
async function projectGatekeeperRun(options) {
|
|
5066
5052
|
const officer = gateOfficerForSubject(options.subject);
|
|
@@ -5096,7 +5082,7 @@ async function projectGatekeeperRun(options) {
|
|
|
5096
5082
|
summoned
|
|
5097
5083
|
};
|
|
5098
5084
|
}
|
|
5099
|
-
var GATE_OFFICER_BY_SUBJECT, GATEKEEPER_TOOL_SPEC, OFFICER_CONCLUSION_REASK
|
|
5085
|
+
var GATE_OFFICER_BY_SUBJECT, GATEKEEPER_TOOL_SPEC, OFFICER_CONCLUSION_REASK;
|
|
5100
5086
|
var init_gatekeeper_role = __esm({
|
|
5101
5087
|
"src/gatekeeper-role.ts"() {
|
|
5102
5088
|
"use strict";
|
|
@@ -5104,6 +5090,7 @@ var init_gatekeeper_role = __esm({
|
|
|
5104
5090
|
init_packaged_role_registry();
|
|
5105
5091
|
init_submission_errors();
|
|
5106
5092
|
init_inspector_contracts();
|
|
5093
|
+
init_review_submission();
|
|
5107
5094
|
init_gatekeeper_output();
|
|
5108
5095
|
init_run_terminal_artifacts();
|
|
5109
5096
|
init_submission_errors();
|
|
@@ -5121,8 +5108,7 @@ var init_gatekeeper_role = __esm({
|
|
|
5121
5108
|
promptSnippet: "\u95E8\u4E0B\u7701\u51B3\u8BAE",
|
|
5122
5109
|
parameters: gatekeeperOutputSchema
|
|
5123
5110
|
};
|
|
5124
|
-
OFFICER_CONCLUSION_REASK = "\u4E0A\u6B21\u4EA4\u5377\u7684\
|
|
5125
|
-
COUNTERSIGN_CONCLUSION_REASK = "\u4E0A\u6B21\u4EA4\u5377\u7684 countersignStatus \u4E0D\u662F converged\u3001continue\u3001escalate \u4E09\u6001\u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u8F93\u51FA\uFF0CcountersignStatus \u5199\u660E\u5176\u4E00\uFF1B\u5C01\u9A73\u6216\u4E0A\u5448\u7684\u8BDD\u5C31\u662F\u7ED9\u5BF9\u65B9\u770B\u7684\u539F\u6587\u3002";
|
|
5111
|
+
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";
|
|
5126
5112
|
}
|
|
5127
5113
|
});
|
|
5128
5114
|
|
|
@@ -6355,8 +6341,8 @@ function tryReadComplianceCandidate(arguments_, usage) {
|
|
|
6355
6341
|
}
|
|
6356
6342
|
const args = arguments_;
|
|
6357
6343
|
const status = args.status;
|
|
6358
|
-
if (status === "
|
|
6359
|
-
if (status === "
|
|
6344
|
+
if (status === "converged") return { status, receipt: arguments_, ...usage === void 0 ? {} : { usage } };
|
|
6345
|
+
if (status === "continue") return { status, violations: readListField(args.violations), receipt: arguments_, ...usage === void 0 ? {} : { usage } };
|
|
6360
6346
|
if (status === "escalate") {
|
|
6361
6347
|
return {
|
|
6362
6348
|
status,
|
|
@@ -6599,7 +6585,8 @@ function validateAcceptedDetails(_toolName, details) {
|
|
|
6599
6585
|
function acceptedFacts(toolName, details) {
|
|
6600
6586
|
const record4 = details;
|
|
6601
6587
|
const entry = PACKAGED_ROLE_REGISTRY.find((candidate) => candidate.outputTool === toolName);
|
|
6602
|
-
const
|
|
6588
|
+
const legacyRole = LEGACY_REVIEW_OUTPUT_ROLES.get(toolName);
|
|
6589
|
+
const statusKey = legacyRole === "judge" || legacyRole === "countersign" ? `${legacyRole}Status` : entry !== void 0 && "receiptStatusKey" in entry ? entry.receiptStatusKey : "status";
|
|
6603
6590
|
const status = typeof record4[statusKey] === "string" ? record4[statusKey] : void 0;
|
|
6604
6591
|
const commitKey = entry !== void 0 && "receiptCommitKey" in entry ? entry.receiptCommitKey : void 0;
|
|
6605
6592
|
const commitWhen = entry !== void 0 && "receiptCommitWhen" in entry ? entry.receiptCommitWhen : void 0;
|
|
@@ -6630,7 +6617,10 @@ var init_terminating_tools = __esm({
|
|
|
6630
6617
|
init_diarist_contracts();
|
|
6631
6618
|
init_secretariat_contracts();
|
|
6632
6619
|
init_worker_output();
|
|
6633
|
-
TERMINATING_TOOL_NAMES =
|
|
6620
|
+
TERMINATING_TOOL_NAMES = [.../* @__PURE__ */ new Set([
|
|
6621
|
+
...PACKAGED_ROLE_REGISTRY.map((entry) => entry.outputTool),
|
|
6622
|
+
...LEGACY_REVIEW_OUTPUT_ROLES.keys()
|
|
6623
|
+
])];
|
|
6634
6624
|
AcceptedDetailsContractError = class extends CorrectableSubmissionError {
|
|
6635
6625
|
code = "accepted_details_contract";
|
|
6636
6626
|
constructor(message, options) {
|
|
@@ -6712,6 +6702,7 @@ function deriveSession(content, id) {
|
|
|
6712
6702
|
let accepted, observedCommit, turns = 0, calls = 0, tokens = 0;
|
|
6713
6703
|
const statuses = [], commits = [];
|
|
6714
6704
|
for (const row of rows) {
|
|
6705
|
+
if (row.type === "custom" && row.customType === "ak-role-submission-closure" && record3(row.data) && row.data.isError === false && typeof row.data.toolName === "string" && isTerminatingToolName(row.data.toolName)) accepted = row;
|
|
6715
6706
|
const message = record3(row.message) ? row.message : void 0;
|
|
6716
6707
|
if (message?.role === "assistant") {
|
|
6717
6708
|
for (const part of Array.isArray(message.content) ? message.content : []) if (record3(part) && part.type === "toolCall") calls++;
|
|
@@ -6729,7 +6720,6 @@ function deriveSession(content, id) {
|
|
|
6729
6720
|
if (error instanceof AcceptedDetailsContractError) continue;
|
|
6730
6721
|
throw error;
|
|
6731
6722
|
}
|
|
6732
|
-
accepted = row;
|
|
6733
6723
|
const facts = acceptedFacts(message.toolName, details);
|
|
6734
6724
|
if (facts.commit && facts.commit !== observedCommit) {
|
|
6735
6725
|
commits.push({ source: id, commit: facts.commit });
|
|
@@ -10445,7 +10435,7 @@ var init_option_definitions = __esm({
|
|
|
10445
10435
|
},
|
|
10446
10436
|
inspector: {
|
|
10447
10437
|
command: "inspector",
|
|
10448
|
-
summary: "Direct Inspector (\u53F0\u9662) complexity and test-quality check;
|
|
10438
|
+
summary: "Direct Inspector (\u53F0\u9662) complexity and test-quality check; converged, continue, or escalate.",
|
|
10449
10439
|
usage: ["ak-role inspector [options] [instruction]"],
|
|
10450
10440
|
examples: [
|
|
10451
10441
|
'ak-role inspector --attach ./change.patch "Review this material."'
|
|
@@ -10469,7 +10459,7 @@ var init_option_definitions = __esm({
|
|
|
10469
10459
|
},
|
|
10470
10460
|
auditor: {
|
|
10471
10461
|
command: "auditor",
|
|
10472
|
-
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit:
|
|
10462
|
+
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit: converged, continue, or escalate.",
|
|
10473
10463
|
usage: ["ak-role auditor --subject <judge|doctor> --source-run <runId@role|path> [options] [instruction]"],
|
|
10474
10464
|
examples: [
|
|
10475
10465
|
'ak-role auditor --subject judge --source-run 01abc\u2026@judge --attach ./dossier "\u5BA1\uFF1A\u672C run \u662F\u5426\u5408\u89C4\u3002"',
|
|
@@ -13220,7 +13210,7 @@ function optionalDispatchReason(raw) {
|
|
|
13220
13210
|
return raw;
|
|
13221
13211
|
}
|
|
13222
13212
|
function isGateTerminatingToolName(toolName) {
|
|
13223
|
-
return DISPATCH_TOOLS.has(toolName) || OFFICER_TOOL_TO_FACE[toolName] !== void 0;
|
|
13213
|
+
return toolName === "ak_submission_output" || DISPATCH_TOOLS.has(toolName) || OFFICER_TOOL_TO_FACE[toolName] !== void 0;
|
|
13224
13214
|
}
|
|
13225
13215
|
function acceptedGateReceiptIds(rows) {
|
|
13226
13216
|
const accepted = /* @__PURE__ */ new Set();
|
|
@@ -13295,7 +13285,7 @@ function extractAllAcceptedGateToolCalls(rows) {
|
|
|
13295
13285
|
}
|
|
13296
13286
|
return out;
|
|
13297
13287
|
}
|
|
13298
|
-
function projectAcceptedGateCall(filePath, rows, call) {
|
|
13288
|
+
function projectAcceptedGateCall(filePath, rows, call, pointerOfficer) {
|
|
13299
13289
|
const span = requireAcceptedGateSpan(intervalRowsForGateCall(rows, call.rowIndex), filePath);
|
|
13300
13290
|
const status = readAcceptedGateStatus(call.args);
|
|
13301
13291
|
const findings = asFindings(call.args?.findings);
|
|
@@ -13322,7 +13312,7 @@ function projectAcceptedGateCall(filePath, rows, call) {
|
|
|
13322
13312
|
...bindingFields
|
|
13323
13313
|
};
|
|
13324
13314
|
}
|
|
13325
|
-
const officer = OFFICER_TOOL_TO_FACE[call.toolName];
|
|
13315
|
+
const officer = call.toolName === "ak_submission_output" ? pointerOfficer : OFFICER_TOOL_TO_FACE[call.toolName];
|
|
13326
13316
|
if (officer === void 0) {
|
|
13327
13317
|
throw new Error(
|
|
13328
13318
|
`accepted gate receipt has unknown officer tool ${call.toolName} in ${filePath}`
|
|
@@ -13340,13 +13330,13 @@ function projectAcceptedGateCall(filePath, rows, call) {
|
|
|
13340
13330
|
...bindingFields
|
|
13341
13331
|
};
|
|
13342
13332
|
}
|
|
13343
|
-
async function classifyAuditorVolume(filePath) {
|
|
13333
|
+
async function classifyAuditorVolume(filePath, pointerOfficer) {
|
|
13344
13334
|
const rows = await readLedgerSessionJsonl(filePath);
|
|
13345
13335
|
const accepted = extractAllAcceptedGateToolCalls(rows);
|
|
13346
13336
|
if (accepted.length === 0) return [];
|
|
13347
13337
|
const volumes = [];
|
|
13348
13338
|
for (const call of accepted) {
|
|
13349
|
-
const projected = projectAcceptedGateCall(filePath, rows, call);
|
|
13339
|
+
const projected = call.toolName === "ak_submission_output" && pointerOfficer === void 0 ? void 0 : projectAcceptedGateCall(filePath, rows, call, pointerOfficer);
|
|
13350
13340
|
if (projected !== void 0) volumes.push(projected);
|
|
13351
13341
|
}
|
|
13352
13342
|
return volumes;
|
|
@@ -13426,7 +13416,8 @@ async function resolveOfficerSessionFromPointerFile(pointerPath) {
|
|
|
13426
13416
|
if (typeof sessionFile !== "string" || sessionFile.trim() === "") {
|
|
13427
13417
|
throw new Error(`direct officer run pointer missing sessionFile in ${pointerPath}`);
|
|
13428
13418
|
}
|
|
13429
|
-
|
|
13419
|
+
const officer = raw.officer === "inspector" || raw.officer === "notary" ? raw.officer : void 0;
|
|
13420
|
+
return { sessionFile, ...officer === void 0 ? {} : { officer } };
|
|
13430
13421
|
}
|
|
13431
13422
|
async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, options = {}) {
|
|
13432
13423
|
const directories = typeof auditorRolesDirectory === "string" ? [auditorRolesDirectory] : auditorRolesDirectory;
|
|
@@ -13446,13 +13437,13 @@ async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, opti
|
|
|
13446
13437
|
for (const name of names) {
|
|
13447
13438
|
const path = join24(directory, name);
|
|
13448
13439
|
const fromPointer = name.endsWith(".pointer.json");
|
|
13449
|
-
const
|
|
13450
|
-
|
|
13440
|
+
const pointer = fromPointer ? await resolveOfficerSessionFromPointerFile(path) : void 0;
|
|
13441
|
+
const sessionPath = pointer?.sessionFile ?? path;
|
|
13451
13442
|
if (fromPointer) {
|
|
13452
13443
|
if (classifiedOfficerSessions.has(sessionPath)) continue;
|
|
13453
13444
|
classifiedOfficerSessions.add(sessionPath);
|
|
13454
13445
|
}
|
|
13455
|
-
const classified = await classifyAuditorVolume(sessionPath);
|
|
13446
|
+
const classified = await classifyAuditorVolume(sessionPath, pointer?.officer);
|
|
13456
13447
|
for (const volume of classified) {
|
|
13457
13448
|
if (options.parentSessionFile !== void 0 && volume.parentSessionFile !== void 0 && volume.parentSessionFile !== options.parentSessionFile) {
|
|
13458
13449
|
continue;
|
|
@@ -13493,7 +13484,8 @@ __export(audit_escalation_exports, {
|
|
|
13493
13484
|
disposeComplianceDecision: () => disposeComplianceDecision,
|
|
13494
13485
|
isAuditEscalationProjection: () => isAuditEscalationProjection,
|
|
13495
13486
|
isAuditEscalationResult: () => isAuditEscalationResult,
|
|
13496
|
-
projectAuditEscalation: () => projectAuditEscalation
|
|
13487
|
+
projectAuditEscalation: () => projectAuditEscalation,
|
|
13488
|
+
projectGatekeeperEscalation: () => projectGatekeeperEscalation
|
|
13497
13489
|
});
|
|
13498
13490
|
function buildAuditEscalationResult(decision, deliveredOutput) {
|
|
13499
13491
|
const auditOwned = {
|
|
@@ -13538,6 +13530,16 @@ function projectAuditEscalation(decision, deliveredOutput) {
|
|
|
13538
13530
|
...decision.usage === void 0 ? {} : { usage: decision.usage }
|
|
13539
13531
|
};
|
|
13540
13532
|
}
|
|
13533
|
+
function projectGatekeeperEscalation(result, deliveredOutput) {
|
|
13534
|
+
const receipt = result.receipt;
|
|
13535
|
+
const record4 = receipt !== null && typeof receipt === "object" && !Array.isArray(receipt) ? receipt : void 0;
|
|
13536
|
+
return projectAuditEscalation({
|
|
13537
|
+
status: "escalate",
|
|
13538
|
+
officer: result.officer,
|
|
13539
|
+
conflicts: receipt,
|
|
13540
|
+
...record4 !== void 0 && Object.hasOwn(record4, "decisionGate") ? { decisionGate: record4.decisionGate } : {}
|
|
13541
|
+
}, deliveredOutput);
|
|
13542
|
+
}
|
|
13541
13543
|
function isAuditEscalationResult(value) {
|
|
13542
13544
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
13543
13545
|
return false;
|
|
@@ -13546,8 +13548,8 @@ function isAuditEscalationResult(value) {
|
|
|
13546
13548
|
}
|
|
13547
13549
|
async function disposeComplianceDecision(decision, handlers, deliveredOutput) {
|
|
13548
13550
|
switch (decision.status) {
|
|
13549
|
-
case "
|
|
13550
|
-
return await handlers.
|
|
13551
|
+
case "converged":
|
|
13552
|
+
return await handlers.converged(decision.usage);
|
|
13551
13553
|
case "no-receipt":
|
|
13552
13554
|
if (handlers.noReceipt === void 0) {
|
|
13553
13555
|
throw new Error("Compliance no-receipt projection handler is unavailable");
|
|
@@ -13564,8 +13566,8 @@ async function disposeComplianceDecision(decision, handlers, deliveredOutput) {
|
|
|
13564
13566
|
decision,
|
|
13565
13567
|
decision.usage === void 0 ? {} : { usage: decision.usage }
|
|
13566
13568
|
);
|
|
13567
|
-
case "
|
|
13568
|
-
return await handlers.
|
|
13569
|
+
case "continue":
|
|
13570
|
+
return await handlers.continue(decision.violations);
|
|
13569
13571
|
case "escalate":
|
|
13570
13572
|
return await handlers.escalate(
|
|
13571
13573
|
projectAuditEscalation(decision, deliveredOutput)
|
|
@@ -13701,6 +13703,7 @@ function rowFromPayload(kind, payload, accepted, roleFallback) {
|
|
|
13701
13703
|
kind,
|
|
13702
13704
|
accepted,
|
|
13703
13705
|
...Object.hasOwn(payload, "auditReceipt") ? { auditReceipt: payload.auditReceipt } : {},
|
|
13706
|
+
...Object.hasOwn(payload, "auditOfficer") ? { auditOfficer: payload.auditOfficer } : {},
|
|
13704
13707
|
...typeof payload.toolCallId === "string" && payload.toolCallId.length > 0 ? { toolCallId: payload.toolCallId } : {}
|
|
13705
13708
|
};
|
|
13706
13709
|
}
|
|
@@ -13906,7 +13909,14 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
13906
13909
|
return {
|
|
13907
13910
|
...host,
|
|
13908
13911
|
registerTool(tool) {
|
|
13909
|
-
const
|
|
13912
|
+
const registeredRole = outputTools.get(tool.name);
|
|
13913
|
+
let role;
|
|
13914
|
+
if (typeof registeredRole === "string") {
|
|
13915
|
+
role = registeredRole;
|
|
13916
|
+
} else if (registeredRole !== void 0) {
|
|
13917
|
+
const activeRole = host.getFlag("ak-role");
|
|
13918
|
+
role = typeof activeRole === "string" && registeredRole.includes(activeRole) ? activeRole : void 0;
|
|
13919
|
+
}
|
|
13910
13920
|
if (role === void 0) return host.registerTool(tool);
|
|
13911
13921
|
host.registerTool({
|
|
13912
13922
|
...tool,
|
|
@@ -13978,11 +13988,13 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
13978
13988
|
outcome: "audit-escalation",
|
|
13979
13989
|
role,
|
|
13980
13990
|
accepted: params,
|
|
13981
|
-
...audit !== void 0 && (Object.hasOwn(audit, "receipt") || Object.hasOwn(audit, "conflicts")) ? { auditReceipt: Object.hasOwn(audit, "receipt") ? audit.receipt : audit.conflicts } : {}
|
|
13991
|
+
...audit !== void 0 && (Object.hasOwn(audit, "receipt") || Object.hasOwn(audit, "conflicts")) ? { auditReceipt: Object.hasOwn(audit, "receipt") ? audit.receipt : audit.conflicts } : {},
|
|
13992
|
+
...audit !== void 0 && Object.hasOwn(audit, "officer") ? { auditOfficer: audit.officer } : {}
|
|
13982
13993
|
});
|
|
13983
13994
|
await projectClosure(closed2, context);
|
|
13984
13995
|
return result;
|
|
13985
13996
|
}
|
|
13997
|
+
if (result.terminate === false) return result;
|
|
13986
13998
|
const closed = {
|
|
13987
13999
|
role,
|
|
13988
14000
|
kind: "accepted",
|
|
@@ -14838,7 +14850,7 @@ function markerMatchesExpectedIdentity(marker, expected) {
|
|
|
14838
14850
|
}
|
|
14839
14851
|
function classifyPackagedRoleTerminalResult(message) {
|
|
14840
14852
|
if (typeof message.toolName !== "string") return { kind: "nonterminal" };
|
|
14841
|
-
if (!PACKAGED_ROLE_OUTPUT_TOOLS.has(message.toolName)) return { kind: "nonterminal" };
|
|
14853
|
+
if (!PACKAGED_ROLE_OUTPUT_TOOLS.has(message.toolName) && message.toolName !== "ak_submission_output") return { kind: "nonterminal" };
|
|
14842
14854
|
const hasInfraBase = hasNavigatorInfrastructureFailureBase(message.details);
|
|
14843
14855
|
const infraFact = hasInfraBase ? buildNavigatorInfrastructureFailureFact() : void 0;
|
|
14844
14856
|
if (message.isError === true) {
|
|
@@ -14855,12 +14867,14 @@ function durableTerminalAt(entries, index) {
|
|
|
14855
14867
|
const entry = entries[index];
|
|
14856
14868
|
const message = entry?.type === "custom" && entry.customType === "ak-role-submission-closure" ? typeof entry.data === "object" && entry.data !== null ? entry.data : void 0 : entry?.type === "message" && entry.message?.role === "toolResult" ? entry.message : void 0;
|
|
14857
14869
|
if (typeof message?.toolName !== "string") return void 0;
|
|
14858
|
-
const
|
|
14870
|
+
const marker = message.toolName === "ak_submission_output" ? entries.slice(0, index).reverse().find(isInvocationMarkerEntry) : void 0;
|
|
14871
|
+
const role = message.toolName === "ak_submission_output" ? parseInvocationMarkerIdentity(marker?.data)?.role ?? "unknown" : PACKAGED_ROLE_OUTPUT_TOOLS.get(message.toolName);
|
|
14859
14872
|
if (role === void 0) return void 0;
|
|
14860
14873
|
const classification = classifyPackagedRoleTerminalResult(message);
|
|
14861
14874
|
if (classification.kind !== "accepted" && classification.kind !== "infrastructure") {
|
|
14862
14875
|
return void 0;
|
|
14863
14876
|
}
|
|
14877
|
+
if (entry?.type === "message" && classification.kind === "accepted" && !LEGACY_REVIEW_OUTPUT_ROLES.has(message.toolName)) return void 0;
|
|
14864
14878
|
return {
|
|
14865
14879
|
index,
|
|
14866
14880
|
role,
|
|
@@ -14929,7 +14943,7 @@ var init_navigator_invocation_identity = __esm({
|
|
|
14929
14943
|
"reason"
|
|
14930
14944
|
];
|
|
14931
14945
|
PACKAGED_ROLE_OUTPUT_TOOLS = new Map(
|
|
14932
|
-
PACKAGED_ROLE_REGISTRY.map((entry) => [entry.outputTool, entry.role])
|
|
14946
|
+
[...PACKAGED_ROLE_REGISTRY.filter((entry) => entry.outputTool !== "ak_submission_output").map((entry) => [entry.outputTool, entry.role]), ...LEGACY_REVIEW_OUTPUT_ROLES]
|
|
14933
14947
|
);
|
|
14934
14948
|
}
|
|
14935
14949
|
});
|
|
@@ -15100,7 +15114,10 @@ function roleOutcomeFromRows(role, rows) {
|
|
|
15100
15114
|
role,
|
|
15101
15115
|
status: "audit_escalation",
|
|
15102
15116
|
payloads,
|
|
15103
|
-
...audited === void 0 ? {} : { decisiveFacts: {
|
|
15117
|
+
...audited === void 0 ? {} : { decisiveFacts: {
|
|
15118
|
+
auditEscalationReceipt: audited.auditReceipt,
|
|
15119
|
+
...Object.hasOwn(audited, "auditOfficer") ? { auditEscalationOfficer: audited.auditOfficer } : {}
|
|
15120
|
+
} }
|
|
15104
15121
|
};
|
|
15105
15122
|
}
|
|
15106
15123
|
return { kind: "accepted", role, payloads };
|
|
@@ -16537,15 +16554,14 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
16537
16554
|
let thisAttemptHasSeatSuccess = false;
|
|
16538
16555
|
let residual;
|
|
16539
16556
|
for (let index = entries.length - 1; index >= scanStart; index -= 1) {
|
|
16557
|
+
const entry = entries[index];
|
|
16558
|
+
if (entry?.type === "custom" && entry.customType === "ak-role-submission-closure" && isRecord13(entry.data) && entry.data.toolName === spec.toolName && classifyPackagedRoleTerminalResult(entry.data).kind === "accepted") {
|
|
16559
|
+
thisAttemptHasSeatSuccess = true;
|
|
16560
|
+
}
|
|
16540
16561
|
const message = entries[index]?.message;
|
|
16541
16562
|
if (message?.role !== "toolResult") continue;
|
|
16542
16563
|
if (message.toolName !== spec.toolName) continue;
|
|
16543
|
-
if (message.isError === false)
|
|
16544
|
-
if (boundRoleToolCallForResult(entries, index, message, spec.toolName) !== void 0) {
|
|
16545
|
-
thisAttemptHasSeatSuccess = true;
|
|
16546
|
-
}
|
|
16547
|
-
continue;
|
|
16548
|
-
}
|
|
16564
|
+
if (message.isError === false) continue;
|
|
16549
16565
|
if (residual === void 0) {
|
|
16550
16566
|
residual = boundErroredToolCandidate(
|
|
16551
16567
|
entries,
|
|
@@ -16556,7 +16572,7 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
16556
16572
|
}
|
|
16557
16573
|
}
|
|
16558
16574
|
const roleOutcome = await sealedLedgerOutcome(admitted, spec.role, scope);
|
|
16559
|
-
if (roleOutcome !== void 0 && (thisAttemptHasSeatSuccess || residual === void 0)) {
|
|
16575
|
+
if (roleOutcome !== void 0 && (thisAttemptHasSeatSuccess || residual === void 0 || scope?.courtAttemptId !== void 0 && scope.courtAttemptId.length > 0)) {
|
|
16560
16576
|
const navigator = extractNavigatorFact(entries);
|
|
16561
16577
|
const artifacts = await publishDeclaredSeatArtifacts(
|
|
16562
16578
|
admitted,
|
|
@@ -18765,7 +18781,7 @@ function isRecord14(value) {
|
|
|
18765
18781
|
}
|
|
18766
18782
|
function isEscalatePayload(payload) {
|
|
18767
18783
|
if (!isRecord14(payload)) return false;
|
|
18768
|
-
return payload.status === "escalate"
|
|
18784
|
+
return payload.status === "escalate";
|
|
18769
18785
|
}
|
|
18770
18786
|
function courtDiaristPayloadRows(roleOutcome, submissions) {
|
|
18771
18787
|
if (roleOutcome === void 0) return submissions ?? [];
|
|
@@ -20997,8 +21013,8 @@ function emptyAccum() {
|
|
|
20997
21013
|
function absorbRound(accum, round) {
|
|
20998
21014
|
accum.rounds += 1;
|
|
20999
21015
|
accum.wallSum += round.officerWallMs;
|
|
21000
|
-
if (round.status === "bounce") accum.bounceCount += 1;
|
|
21001
|
-
if (round.status === "pass") accum.passCount += 1;
|
|
21016
|
+
if (round.status === "bounce" || round.status === "continue") accum.bounceCount += 1;
|
|
21017
|
+
if (round.status === "pass" || round.status === "converged") accum.passCount += 1;
|
|
21002
21018
|
}
|
|
21003
21019
|
function finishOfficer(officer, accum) {
|
|
21004
21020
|
return {
|
|
@@ -21400,7 +21416,7 @@ var init_analyst_page = __esm({
|
|
|
21400
21416
|
|
|
21401
21417
|
// src/analyst-entry.ts
|
|
21402
21418
|
import { readFile as readFile21 } from "node:fs/promises";
|
|
21403
|
-
import { Type as
|
|
21419
|
+
import { Type as Type11 } from "typebox";
|
|
21404
21420
|
function isMissingPathError7(error) {
|
|
21405
21421
|
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
21406
21422
|
}
|
|
@@ -21607,16 +21623,16 @@ var init_analyst_entry = __esm({
|
|
|
21607
21623
|
}
|
|
21608
21624
|
}
|
|
21609
21625
|
};
|
|
21610
|
-
analystSweepModeInputSchema =
|
|
21626
|
+
analystSweepModeInputSchema = Type11.Object(
|
|
21611
21627
|
{
|
|
21612
|
-
mode:
|
|
21613
|
-
mergedPullRequests:
|
|
21614
|
-
|
|
21628
|
+
mode: Type11.Literal("sweep"),
|
|
21629
|
+
mergedPullRequests: Type11.Array(
|
|
21630
|
+
Type11.Object(
|
|
21615
21631
|
{
|
|
21616
|
-
projectRoot:
|
|
21632
|
+
projectRoot: Type11.String(),
|
|
21617
21633
|
/** 排除后改动行数 — omit or 0 → typed 空缺; finite ≥ 0 only. */
|
|
21618
|
-
changedLines:
|
|
21619
|
-
|
|
21634
|
+
changedLines: Type11.Optional(
|
|
21635
|
+
Type11.Number({ minimum: 0, maximum: Number.MAX_VALUE })
|
|
21620
21636
|
)
|
|
21621
21637
|
},
|
|
21622
21638
|
{ additionalProperties: false }
|
|
@@ -23177,7 +23193,7 @@ import { createServer } from "node:net";
|
|
|
23177
23193
|
import { dirname as dirname23, join as join45 } from "node:path";
|
|
23178
23194
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
23179
23195
|
|
|
23180
|
-
// src/
|
|
23196
|
+
// src/submission-gate.ts
|
|
23181
23197
|
init_archivist_record_entry();
|
|
23182
23198
|
init_gatekeeper_role();
|
|
23183
23199
|
init_session_assistant_usage();
|
|
@@ -23200,7 +23216,7 @@ function createDefaultGateOfficerSummon(options) {
|
|
|
23200
23216
|
};
|
|
23201
23217
|
}
|
|
23202
23218
|
function bookDirectOfficerPointer(context, officer, result, summoned) {
|
|
23203
|
-
if (result.status !== "
|
|
23219
|
+
if (result.status !== "converged" && result.status !== "continue" && result.status !== "escalate" && result.status !== "needs_reask" && result.status !== "transport_failure") {
|
|
23204
23220
|
return;
|
|
23205
23221
|
}
|
|
23206
23222
|
const parentFile = context.sessionManager?.getSessionFile?.();
|
|
@@ -23216,7 +23232,7 @@ function bookDirectOfficerPointer(context, officer, result, summoned) {
|
|
|
23216
23232
|
...typeof summoned.runDirectory === "string" && summoned.runDirectory.trim() !== "" ? { runDirectory: summoned.runDirectory } : {}
|
|
23217
23233
|
});
|
|
23218
23234
|
}
|
|
23219
|
-
async function
|
|
23235
|
+
async function requireSubmissionGate(options) {
|
|
23220
23236
|
let reask;
|
|
23221
23237
|
const summonOfficer = options.summonOfficer ?? createDefaultGateOfficerSummon({
|
|
23222
23238
|
cwd: options.context.cwd ?? process.cwd()
|
|
@@ -23243,8 +23259,17 @@ async function requireGatekeeperPass(options) {
|
|
|
23243
23259
|
options.hostActions.failInfrastructure(error, options.context, options.toolCallId);
|
|
23244
23260
|
}
|
|
23245
23261
|
}
|
|
23246
|
-
if (gatekeeper.status === "
|
|
23262
|
+
if (gatekeeper.status === "converged") {
|
|
23263
|
+
return {
|
|
23264
|
+
status: "converged",
|
|
23265
|
+
officer: projected.officer,
|
|
23266
|
+
receipt: gatekeeper.receipt,
|
|
23267
|
+
...typeof gatekeeper.runId === "string" && gatekeeper.runId.trim() !== "" ? { runId: gatekeeper.runId } : {}
|
|
23268
|
+
};
|
|
23269
|
+
}
|
|
23270
|
+
if (gatekeeper.status === "continue") {
|
|
23247
23271
|
return {
|
|
23272
|
+
status: "continue",
|
|
23248
23273
|
officer: projected.officer,
|
|
23249
23274
|
receipt: gatekeeper.receipt,
|
|
23250
23275
|
...typeof gatekeeper.runId === "string" && gatekeeper.runId.trim() !== "" ? { runId: gatekeeper.runId } : {}
|
|
@@ -23397,18 +23422,18 @@ import { join as join44 } from "node:path";
|
|
|
23397
23422
|
import { Value as Value5 } from "typebox/value";
|
|
23398
23423
|
|
|
23399
23424
|
// src/activation-trace.ts
|
|
23400
|
-
import { Type as
|
|
23401
|
-
var causeSchema =
|
|
23402
|
-
identity:
|
|
23403
|
-
name:
|
|
23404
|
-
message:
|
|
23405
|
-
evidenceId:
|
|
23425
|
+
import { Type as Type12 } from "typebox";
|
|
23426
|
+
var causeSchema = Type12.Object({
|
|
23427
|
+
identity: Type12.String({ minLength: 1 }),
|
|
23428
|
+
name: Type12.String({ minLength: 1 }),
|
|
23429
|
+
message: Type12.String(),
|
|
23430
|
+
evidenceId: Type12.Optional(Type12.String({ minLength: 1 }))
|
|
23406
23431
|
}, { additionalProperties: false });
|
|
23407
|
-
var activationTraceRecordSchema =
|
|
23408
|
-
role:
|
|
23409
|
-
stageId:
|
|
23410
|
-
status:
|
|
23411
|
-
timestamp:
|
|
23432
|
+
var activationTraceRecordSchema = Type12.Object({
|
|
23433
|
+
role: Type12.String({ minLength: 1 }),
|
|
23434
|
+
stageId: Type12.String({ pattern: "^[a-z][a-z0-9-]*$" }),
|
|
23435
|
+
status: Type12.Literal("failed"),
|
|
23436
|
+
timestamp: Type12.String({ format: "date-time" }),
|
|
23412
23437
|
cause: causeSchema
|
|
23413
23438
|
}, { additionalProperties: false });
|
|
23414
23439
|
var activationCauseEvidence = 0;
|
|
@@ -23563,28 +23588,28 @@ function writeStderrJsonlRecord(record4, write = writeSync) {
|
|
|
23563
23588
|
|
|
23564
23589
|
// src/tool-execution-observation.ts
|
|
23565
23590
|
import { writeSync as writeSync2 } from "node:fs";
|
|
23566
|
-
import { Type as
|
|
23591
|
+
import { Type as Type13 } from "typebox";
|
|
23567
23592
|
import { Value as Value3 } from "typebox/value";
|
|
23568
23593
|
var TOOL_EXECUTION_UPDATE_THROTTLE_MS = 3e4;
|
|
23569
23594
|
var observationBase = {
|
|
23570
|
-
role:
|
|
23571
|
-
toolCallId:
|
|
23572
|
-
toolName:
|
|
23573
|
-
timestamp:
|
|
23595
|
+
role: Type13.String({ minLength: 1 }),
|
|
23596
|
+
toolCallId: Type13.String({ minLength: 1 }),
|
|
23597
|
+
toolName: Type13.String({ minLength: 1 }),
|
|
23598
|
+
timestamp: Type13.String({ format: "date-time" })
|
|
23574
23599
|
};
|
|
23575
|
-
var toolExecutionObservationRecordSchema =
|
|
23576
|
-
|
|
23600
|
+
var toolExecutionObservationRecordSchema = Type13.Union([
|
|
23601
|
+
Type13.Object({
|
|
23577
23602
|
...observationBase,
|
|
23578
|
-
event:
|
|
23603
|
+
event: Type13.Literal("tool_execution_start")
|
|
23579
23604
|
}, { additionalProperties: true }),
|
|
23580
|
-
|
|
23605
|
+
Type13.Object({
|
|
23581
23606
|
...observationBase,
|
|
23582
|
-
event:
|
|
23607
|
+
event: Type13.Literal("tool_execution_update")
|
|
23583
23608
|
}, { additionalProperties: true }),
|
|
23584
|
-
|
|
23609
|
+
Type13.Object({
|
|
23585
23610
|
...observationBase,
|
|
23586
|
-
event:
|
|
23587
|
-
isError:
|
|
23611
|
+
event: Type13.Literal("tool_execution_end"),
|
|
23612
|
+
isError: Type13.Boolean()
|
|
23588
23613
|
}, { additionalProperties: true })
|
|
23589
23614
|
]);
|
|
23590
23615
|
function validateToolExecutionObservationRecord(record4) {
|
|
@@ -23681,10 +23706,10 @@ init_engine_material();
|
|
|
23681
23706
|
init_engine_detour();
|
|
23682
23707
|
init_engine_detour_usage();
|
|
23683
23708
|
init_run_terminal_artifacts();
|
|
23684
|
-
import { Type as
|
|
23685
|
-
var engineDetourArgsSchema =
|
|
23709
|
+
import { Type as Type14 } from "typebox";
|
|
23710
|
+
var engineDetourArgsSchema = Type14.Object(
|
|
23686
23711
|
{
|
|
23687
|
-
argv:
|
|
23712
|
+
argv: Type14.Array(Type14.String({ minLength: 1 }), {
|
|
23688
23713
|
minItems: 1,
|
|
23689
23714
|
description: "\u9996\u9879\u4E3A PATH \u4E2D\u7684\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u5176\u4F59\u9879\u4E3A\u53C2\u6570\u3002"
|
|
23690
23715
|
})
|
|
@@ -23831,63 +23856,63 @@ import { join as join42, sep as sep6 } from "node:path";
|
|
|
23831
23856
|
// src/collector-tool-schemas.ts
|
|
23832
23857
|
init_open_tool_schema();
|
|
23833
23858
|
init_terminating_infrastructure();
|
|
23834
|
-
import { Type as
|
|
23835
|
-
var collectorObserveArgsSchema =
|
|
23836
|
-
var collectorRequestArgsSchema =
|
|
23837
|
-
requestId:
|
|
23859
|
+
import { Type as Type15 } from "typebox";
|
|
23860
|
+
var collectorObserveArgsSchema = Type15.Object({}, { additionalProperties: true });
|
|
23861
|
+
var collectorRequestArgsSchema = Type15.Object({
|
|
23862
|
+
requestId: Type15.String({
|
|
23838
23863
|
minLength: 1,
|
|
23839
23864
|
description: "\u8BF7\u6C42\u8EAB\u4EFD\uFF08\u914D\u7F6E id \u6216\u89D2\u8272\u5224\u5B9A\u7684\u7A33\u5B9A id\uFF1B\u9996\u5C3E\u65E0\u7A7A\u767D\uFF09"
|
|
23840
23865
|
}),
|
|
23841
|
-
snapshotId:
|
|
23866
|
+
snapshotId: Type15.String({ minLength: 1, description: "\u6700\u65B0\u7559\u5B58\u89C2\u5BDF\u5FEB\u7167" }),
|
|
23842
23867
|
// #836 r16 class 3: body.minLength deleted — manifest-configured requestId
|
|
23843
23868
|
// ignores body, and the unknown-requestId non-empty condition is a real
|
|
23844
23869
|
// branch in src/collector-ledger.ts:922-951, not a provider shape gate.
|
|
23845
|
-
body:
|
|
23870
|
+
body: Type15.Optional(Type15.String({
|
|
23846
23871
|
description: "\u89D2\u8272\u5224\u5B9A\u7684\u8BF7\u6C42\u6B63\u6587\uFF1Brequest-manifest \u672A\u6536\u5F55\u8BE5 requestId \u65F6\u5FC5\u586B"
|
|
23847
23872
|
}))
|
|
23848
23873
|
}, { additionalProperties: true });
|
|
23849
23874
|
var COLLECTOR_HANDBOOK_MAX_BYTES = 64 * 1024;
|
|
23850
|
-
var collectorHandbookWriteArgsSchema =
|
|
23851
|
-
scope:
|
|
23852
|
-
|
|
23853
|
-
|
|
23875
|
+
var collectorHandbookWriteArgsSchema = Type15.Object({
|
|
23876
|
+
scope: Type15.Union([
|
|
23877
|
+
Type15.Literal("general"),
|
|
23878
|
+
Type15.Literal("repo")
|
|
23854
23879
|
], { description: "general\uFF1D\u901A\u7528\u624B\u518C\uFF1Brepo\uFF1D\u5F53\u524D\u4ED3\u5E93\u5DEE\u5F02" }),
|
|
23855
|
-
body:
|
|
23880
|
+
body: Type15.String({
|
|
23856
23881
|
description: `\u624B\u518C\u5168\u6587\uFF08opaque \u5DE5\u4F5C\u8BB0\u5FC6\uFF1B\u6574\u4EFD\u66FF\u6362\uFF1BUTF-8 \u81F3\u591A ${COLLECTOR_HANDBOOK_MAX_BYTES} \u5B57\u8282\uFF09`
|
|
23857
23882
|
})
|
|
23858
23883
|
}, { additionalProperties: true });
|
|
23859
|
-
var collectorReadArgsSchema =
|
|
23860
|
-
evidenceId:
|
|
23884
|
+
var collectorReadArgsSchema = Type15.Object({
|
|
23885
|
+
evidenceId: Type15.String({ minLength: 1, description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u8BC1\u636E id\uFF08evidenceId\uFF09" })
|
|
23861
23886
|
}, { additionalProperties: true });
|
|
23862
|
-
var collectorWaitArgsSchema =
|
|
23863
|
-
durationMs:
|
|
23887
|
+
var collectorWaitArgsSchema = Type15.Object({
|
|
23888
|
+
durationMs: Type15.Integer({
|
|
23864
23889
|
minimum: 1,
|
|
23865
23890
|
description: "\u7B49\u5F85\u6BEB\u79D2\uFF1B\u5B9E\u9645\u7761\u7720\u4E0D\u8D85\u8FC7\u5269\u4F59\u7B49\u5F85\u7A97\uFF08#678\uFF1B\u65E0\u5305\u5185\u5355\u6B21\u4EFB\u610F\u4E0A\u9650\uFF09"
|
|
23866
23891
|
})
|
|
23867
23892
|
}, { additionalProperties: true });
|
|
23868
|
-
var collectorOpenWaitWindowArgsSchema =
|
|
23869
|
-
startedAt:
|
|
23893
|
+
var collectorOpenWaitWindowArgsSchema = Type15.Object({
|
|
23894
|
+
startedAt: Type15.Optional(Type15.String({
|
|
23870
23895
|
description: "\u7B49\u5F85\u7A97\u8D77\u70B9 ISO \u65F6\u95F4\uFF1B\u65B0\u5EFA PR \u7528\u521B\u5EFA\u6210\u529F\u65F6\u523B\uFF1B\u7701\u7565\uFF1D\u73B0\u5728\uFF08\u89E6\u53D1\u9636\u6BB5\u7ED3\u675F\uFF09"
|
|
23871
23896
|
}))
|
|
23872
23897
|
}, { additionalProperties: true });
|
|
23873
|
-
var collectorBindTargetArgsSchema =
|
|
23874
|
-
prNumber:
|
|
23898
|
+
var collectorBindTargetArgsSchema = Type15.Object({
|
|
23899
|
+
prNumber: Type15.Optional(Type15.Unknown({
|
|
23875
23900
|
description: "\u89D2\u8272\u5224\u5B9A\u7684\u672C\u4ED3 PR \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002\u4E0E issueNumber \u4E8C\u9009\u4E00\u6216\u540C\u6307\u552F\u4E00\u76EE\u6807\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
23876
23901
|
})),
|
|
23877
|
-
issueNumber:
|
|
23902
|
+
issueNumber: Type15.Optional(Type15.Unknown({
|
|
23878
23903
|
description: "\u89D2\u8272\u5224\u5B9A\u7684\u672C\u4ED3 issue \u53F7\uFF08\u6B63\u6574\u6570\uFF09\uFF1Bruntime \u7ECF\u7EBF\u4E0A\u5173\u8054\u89E3\u6790\u552F\u4E00 PR\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
23879
23904
|
}))
|
|
23880
23905
|
}, { additionalProperties: true });
|
|
23881
23906
|
var collectorFindingItemDeclaration = (() => {
|
|
23882
|
-
const item =
|
|
23907
|
+
const item = Type15.Object(
|
|
23883
23908
|
{
|
|
23884
|
-
evidenceId:
|
|
23909
|
+
evidenceId: Type15.Unknown({
|
|
23885
23910
|
description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u6307\u9488\uFF08\u5FC5\u586B\u8BED\u4E49\uFF09"
|
|
23886
23911
|
}),
|
|
23887
|
-
category:
|
|
23912
|
+
category: Type15.Unknown({
|
|
23888
23913
|
description: "\u7B80\u77ED\u5F52\u7C7B\u6807\u7B7E\uFF0C\u4E0D\u662F\u6458\u8981"
|
|
23889
23914
|
}),
|
|
23890
|
-
summary:
|
|
23915
|
+
summary: Type15.Unknown({
|
|
23891
23916
|
description: "\u54EA\u4E2A bot\u3001\u4EC0\u4E48\u95EE\u9898\u7684\u6458\u8981\uFF1B\u4E0D\u8A8A\u6284\u6B63\u6587"
|
|
23892
23917
|
})
|
|
23893
23918
|
},
|
|
@@ -23900,14 +23925,14 @@ var collectorFindingItemDeclaration = (() => {
|
|
|
23900
23925
|
return item;
|
|
23901
23926
|
})();
|
|
23902
23927
|
var collectorOutputBaseSchema = openToolObject(
|
|
23903
|
-
|
|
23928
|
+
Type15.Object({
|
|
23904
23929
|
// No root type:array — host must not shape-reject non-array findings (#676 C).
|
|
23905
23930
|
// Nested item declarations ride `items` for registration preservation (ADR 0057).
|
|
23906
|
-
findings:
|
|
23931
|
+
findings: Type15.Unsafe({
|
|
23907
23932
|
description: "\u672C\u6B21\u6536\u96C6\u5230\u7684\u9010\u6761 findings\uFF08\u6307\u9488\u6570\u7EC4\u4E3A\u89C4\u8303\u5F62\uFF09\u3002\u96F6 finding \u7684\u6A21\u677F\u901A\u77E5\u4E0D\u5F97\u8FDB\u5165\uFF1B\u6B63\u5E38\u5B8C\u5DE5\u65E0 finding \u65F6\u7701\u7565\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002",
|
|
23908
23933
|
items: collectorFindingItemDeclaration
|
|
23909
23934
|
}),
|
|
23910
|
-
unfinishedReasons:
|
|
23935
|
+
unfinishedReasons: Type15.Unknown({
|
|
23911
23936
|
description: "\u672A\u5B8C\u6210\u539F\u56E0\u5B57\u7B26\u4E32\u6570\u7EC4\uFF08\u989D\u5EA6/\u6545\u969C/\u7B49\u5F85\u5C4A\u6EE1\u7B49\u73B0\u573A\u4F9D\u636E\uFF09\uFF1B\u4E0D\u5F97\u628A\u672A\u5B8C\u6210\u8868\u8FF0\u4E3A\u65E0\u95EE\u9898\u3002\u65E0\u53EF\u62A5\u544A\u65F6\u7701\u7565\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
23912
23937
|
})
|
|
23913
23938
|
})
|
|
@@ -24537,7 +24562,6 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24537
24562
|
// src/doctor-role.ts
|
|
24538
24563
|
init_audit_escalation();
|
|
24539
24564
|
init_compliance_transport();
|
|
24540
|
-
init_submission_errors();
|
|
24541
24565
|
init_dossier_resolution();
|
|
24542
24566
|
init_readable_gate_item();
|
|
24543
24567
|
init_doctor_contracts();
|
|
@@ -24599,7 +24623,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
|
|
|
24599
24623
|
host.failInfrastructure(error, ctx, id);
|
|
24600
24624
|
}
|
|
24601
24625
|
const acceptedDetails = testimony;
|
|
24602
|
-
return disposeComplianceDecision(audit, {
|
|
24626
|
+
return disposeComplianceDecision(audit, { converged: (usage) => ({ content: audit.status === "converged" && audit.receipt !== void 0 ? [{ type: "text", text: readableGateItem(audit.receipt) }] : [], details: acceptedDetails, terminate: true, ...usage === void 0 ? {} : { usage } }), noReceipt: (auditNoReceipt, usageProjection) => {
|
|
24603
24627
|
try {
|
|
24604
24628
|
appendCandidate(ctx, { version: 1, testimony, cost: active2.patient.cost, auditNoReceipt, readRecord: active2.store.readRecord(), patientIdentity: active2.patient.identity });
|
|
24605
24629
|
} catch (error) {
|
|
@@ -24608,9 +24632,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
|
|
|
24608
24632
|
return { content: [], details: acceptedDetails, terminate: true, ...usageProjection };
|
|
24609
24633
|
}, received: () => {
|
|
24610
24634
|
throw new Error("\u5BA1\u5211\u9662\u975E\u4E09\u6001\u5E94\u4EA4 runComplianceAudit \u91CD\u95EE\u8BF4\u8BDD\u8005");
|
|
24611
|
-
},
|
|
24612
|
-
throw new GatekeeperDecisionError({ status: "bounce", officer: "auditor", receipt: audit.status === "bounce" ? audit.receipt ?? violations : violations });
|
|
24613
|
-
}, escalate: (result) => result, transportFailure: (facts) => {
|
|
24635
|
+
}, continue: (violations) => ({ content: [{ type: "text", text: readableGateItem(audit.status === "continue" ? audit.receipt ?? violations : violations) }], details: acceptedDetails, terminate: false }), escalate: (result) => result, transportFailure: (facts) => {
|
|
24614
24636
|
host.failInfrastructure(Object.assign(new Error(facts.diagnostic), { name: "ComplianceTransportFailure", ...facts.submissions === void 0 && facts.terminal === void 0 ? {} : { submission: facts.submissions ?? facts.terminal } }), ctx, id);
|
|
24615
24637
|
} }, acceptedDetails);
|
|
24616
24638
|
} });
|
|
@@ -24708,7 +24730,7 @@ function createNotaryRoleRuntime(pi, dependencies, host) {
|
|
|
24708
24730
|
pi.registerTool({
|
|
24709
24731
|
name: NOTARY_OUTPUT_TOOL_NAME,
|
|
24710
24732
|
label: "\u7B26\u5B9D\u90CE\u8F93\u51FA",
|
|
24711
|
-
description: "\u63D0\u4EA4\u5F15\u6587\u4FDD\u771F\u4E0E\u7968\u9762\u5BF9\u9F50\u7684
|
|
24733
|
+
description: "\u63D0\u4EA4\u5F15\u6587\u4FDD\u771F\u4E0E\u7968\u9762\u5BF9\u9F50\u7684 converged/continue/escalate \u51B3\u8BAE\u3002",
|
|
24712
24734
|
promptSnippet: "\u63D0\u4EA4\u7B26\u5B9D\u90CE\u51B3\u8BAE",
|
|
24713
24735
|
parameters: notaryOutputSchema,
|
|
24714
24736
|
async execute(toolCallId, parameters, _signal, _onUpdate, ctx) {
|
|
@@ -24752,36 +24774,10 @@ function createNotaryRoleRuntime(pi, dependencies, host) {
|
|
|
24752
24774
|
init_notary_contracts();
|
|
24753
24775
|
|
|
24754
24776
|
// src/countersign-role.ts
|
|
24755
|
-
|
|
24777
|
+
init_review_submission();
|
|
24756
24778
|
init_countersign_contracts();
|
|
24757
24779
|
init_countersign_contracts();
|
|
24758
|
-
|
|
24759
|
-
var countersignVerdictSchema = withTerminatingOutputDeclarations(
|
|
24760
|
-
Type17.Object(
|
|
24761
|
-
{
|
|
24762
|
-
countersignStatus: Type17.Unknown({ description: "converged | continue | escalate\u3002\u975E\u4E09\u6001\u65F6\u8BF7\u91CD\u8BFB\u540E\u91CD\u4EA4\uFF0C\u52FF\u6539\u6807\u3002" }),
|
|
24763
|
-
fix: Type17.Optional(
|
|
24764
|
-
Type17.Object(
|
|
24765
|
-
{ summary: Type17.Optional(Type17.String({ description: "\u9000\u56DE\u6458\u8981" })) },
|
|
24766
|
-
{ additionalProperties: true, description: "\u9000\u56DE\u8BF4\u660E" }
|
|
24767
|
-
)
|
|
24768
|
-
),
|
|
24769
|
-
note: Type17.Optional(Type17.String({ description: "\u9644\u6CE8" })),
|
|
24770
|
-
evidence: Type17.Optional(Type17.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
24771
|
-
decisionGate: Type17.Optional(
|
|
24772
|
-
Type17.Object(
|
|
24773
|
-
{
|
|
24774
|
-
question: Type17.Optional(Type17.String()),
|
|
24775
|
-
options: Type17.Optional(Type17.Array(Type17.String()))
|
|
24776
|
-
},
|
|
24777
|
-
{ additionalProperties: true, description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
24778
|
-
)
|
|
24779
|
-
)
|
|
24780
|
-
},
|
|
24781
|
-
{ additionalProperties: true }
|
|
24782
|
-
)
|
|
24783
|
-
);
|
|
24784
|
-
countersignVerdictSchema.required = [];
|
|
24780
|
+
var countersignVerdictSchema = reviewSubmissionSchema;
|
|
24785
24781
|
var COUNTERSIGN_TOOL_SPEC = {
|
|
24786
24782
|
name: COUNTERSIGN_OUTPUT_TOOL_NAME,
|
|
24787
24783
|
label: "\u7ED9\u4E8B\u4E2D\u8F93\u51FA",
|
|
@@ -24795,18 +24791,18 @@ init_open_tool_schema();
|
|
|
24795
24791
|
init_terminating_infrastructure();
|
|
24796
24792
|
init_gleaner_left_contracts();
|
|
24797
24793
|
init_gleaner_left_contracts();
|
|
24798
|
-
import { Type as
|
|
24794
|
+
import { Type as Type16 } from "typebox";
|
|
24799
24795
|
var gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
|
|
24800
24796
|
openToolObject(
|
|
24801
|
-
|
|
24802
|
-
status:
|
|
24797
|
+
Type16.Object({
|
|
24798
|
+
status: Type16.Unknown({
|
|
24803
24799
|
description: "completed \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
24804
24800
|
}),
|
|
24805
|
-
findings:
|
|
24806
|
-
|
|
24801
|
+
findings: Type16.Array(
|
|
24802
|
+
Type16.Object(
|
|
24807
24803
|
{
|
|
24808
|
-
pointer:
|
|
24809
|
-
statement:
|
|
24804
|
+
pointer: Type16.Optional(Type16.String({ description: "\u6587\u4EF6/\u884C\u6307\u9488" })),
|
|
24805
|
+
statement: Type16.Optional(Type16.String({ description: "\u7591\u70B9\u9648\u8FF0" }))
|
|
24810
24806
|
},
|
|
24811
24807
|
{ additionalProperties: true, description: "\u4E00\u6761\u5F39\u7AE0" }
|
|
24812
24808
|
),
|
|
@@ -24827,29 +24823,13 @@ var GLEANER_LEFT_TOOL_SPEC = {
|
|
|
24827
24823
|
init_gleaner_left_contracts();
|
|
24828
24824
|
|
|
24829
24825
|
// src/inspector-role.ts
|
|
24830
|
-
|
|
24831
|
-
init_terminating_infrastructure();
|
|
24826
|
+
init_review_submission();
|
|
24832
24827
|
init_inspector_contracts();
|
|
24833
|
-
|
|
24834
|
-
var inspectorOutputSchema = withTerminatingOutputDeclarations(
|
|
24835
|
-
openToolObject(
|
|
24836
|
-
Type19.Object({
|
|
24837
|
-
status: Type19.Unknown({
|
|
24838
|
-
description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
24839
|
-
}),
|
|
24840
|
-
findings: Type19.Unknown({
|
|
24841
|
-
description: "\u968F\u4EA4\u5377\u7559\u5B58\u7684\u95EE\u9898\u8BB0\u5F55"
|
|
24842
|
-
}),
|
|
24843
|
-
reason: Type19.Optional(Type19.Unknown({
|
|
24844
|
-
description: "status \u4E3A escalate \u65F6\u7684\u4E0A\u5448\u7406\u7531"
|
|
24845
|
-
}))
|
|
24846
|
-
})
|
|
24847
|
-
)
|
|
24848
|
-
);
|
|
24828
|
+
var inspectorOutputSchema = reviewSubmissionSchema;
|
|
24849
24829
|
var INSPECTOR_TOOL_SPEC = {
|
|
24850
24830
|
name: INSPECTOR_OUTPUT_TOOL_NAME,
|
|
24851
24831
|
label: "\u53F0\u9662\u8F93\u51FA",
|
|
24852
|
-
description: "\u53F0\u9662\u7EC8\u5C40\u56DE\u6267\uFF0C\u72B6\u6001\u4E3A
|
|
24832
|
+
description: "\u53F0\u9662\u7EC8\u5C40\u56DE\u6267\uFF0C\u72B6\u6001\u4E3A converged\u3001continue \u6216 escalate\u3002",
|
|
24853
24833
|
promptSnippet: "\u53F0\u9662\u7EC8\u5C40\u56DE\u6267",
|
|
24854
24834
|
parameters: inspectorOutputSchema
|
|
24855
24835
|
};
|
|
@@ -24862,44 +24842,44 @@ init_open_tool_schema();
|
|
|
24862
24842
|
init_terminating_infrastructure();
|
|
24863
24843
|
init_diarist_contracts();
|
|
24864
24844
|
init_diarist_contracts();
|
|
24865
|
-
import { Type as
|
|
24845
|
+
import { Type as Type17 } from "typebox";
|
|
24866
24846
|
var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
24867
24847
|
openToolObject(
|
|
24868
|
-
|
|
24869
|
-
status:
|
|
24848
|
+
Type17.Object({
|
|
24849
|
+
status: Type17.Unknown({
|
|
24870
24850
|
description: "completed | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
24871
24851
|
}),
|
|
24872
|
-
ticketNumber:
|
|
24873
|
-
|
|
24852
|
+
ticketNumber: Type17.Optional(
|
|
24853
|
+
Type17.Unknown({
|
|
24874
24854
|
description: "\u672C\u5EAD\u5BF9\u8C61\u7968\u53F7\uFF08\u6B63\u6574\u6570\uFF09\u6216 null/\u7701\u7565\uFF1D\u771F\u65E0\u7968\uFF1B\u4E0B\u6E38\u8D70 typed \u952E\uFF1B\u8BA4\u4E0D\u51FA\u7528 status=escalate\uFF0C\u4E0D\u6D17\u6210\u65E0\u5F55\u3002\u673A\u68B0\u5C42\u4E0D\u91CD\u5224\u3002"
|
|
24875
24855
|
})
|
|
24876
24856
|
),
|
|
24877
|
-
courtTicketNumbers:
|
|
24878
|
-
|
|
24857
|
+
courtTicketNumbers: Type17.Optional(
|
|
24858
|
+
Type17.Unknown({
|
|
24879
24859
|
description: "#871 \u672C\u6B21\u5408\u5BA1\u5E94\u5404\u81EA\u6210\u5F55\u7684\u7968\u53F7\u96C6\u5408\uFF08\u6B63\u6574\u6570\u6570\u7EC4\uFF0C\u542B\u4E3B\u7968\uFF09\uFF1B\u5355\u7968\u53EF\u7701\u7565\u3002\u673A\u68B0\u5C42\u53EA\u505A\u7C7B\u578B/\u53BB\u91CD\u6295\u5F71\uFF0C\u4E0D\u4ECE\u6563\u6587\u731C\u7968\u3002"
|
|
24880
24860
|
})
|
|
24881
24861
|
),
|
|
24882
|
-
reason:
|
|
24883
|
-
|
|
24862
|
+
reason: Type17.Optional(
|
|
24863
|
+
Type17.String({
|
|
24884
24864
|
description: "status \u4E3A escalate \u65F6\uFF1A\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u7684\u539F\u56E0"
|
|
24885
24865
|
})
|
|
24886
24866
|
),
|
|
24887
|
-
sessions:
|
|
24888
|
-
|
|
24889
|
-
|
|
24867
|
+
sessions: Type17.Optional(
|
|
24868
|
+
Type17.Array(
|
|
24869
|
+
Type17.Object(
|
|
24890
24870
|
{
|
|
24891
|
-
path:
|
|
24892
|
-
|
|
24871
|
+
path: Type17.Optional(
|
|
24872
|
+
Type17.String({ description: "\u4F1A\u8BDD\u5377\u7EDD\u5BF9\u6216\u53EF\u8BFB\u8DEF\u5F84" })
|
|
24893
24873
|
),
|
|
24894
|
-
ranges:
|
|
24895
|
-
|
|
24896
|
-
|
|
24874
|
+
ranges: Type17.Optional(
|
|
24875
|
+
Type17.Array(
|
|
24876
|
+
Type17.Object(
|
|
24897
24877
|
{
|
|
24898
|
-
from:
|
|
24899
|
-
|
|
24878
|
+
from: Type17.Optional(
|
|
24879
|
+
Type17.Object(
|
|
24900
24880
|
{
|
|
24901
|
-
id:
|
|
24902
|
-
line:
|
|
24881
|
+
id: Type17.Optional(Type17.String()),
|
|
24882
|
+
line: Type17.Optional(Type17.Unknown())
|
|
24903
24883
|
},
|
|
24904
24884
|
{
|
|
24905
24885
|
additionalProperties: true,
|
|
@@ -24907,11 +24887,11 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
|
24907
24887
|
}
|
|
24908
24888
|
)
|
|
24909
24889
|
),
|
|
24910
|
-
to:
|
|
24911
|
-
|
|
24890
|
+
to: Type17.Optional(
|
|
24891
|
+
Type17.Object(
|
|
24912
24892
|
{
|
|
24913
|
-
id:
|
|
24914
|
-
line:
|
|
24893
|
+
id: Type17.Optional(Type17.String()),
|
|
24894
|
+
line: Type17.Optional(Type17.Unknown())
|
|
24915
24895
|
},
|
|
24916
24896
|
{
|
|
24917
24897
|
additionalProperties: true,
|
|
@@ -24948,23 +24928,23 @@ var DIARIST_TOOL_SPEC = {
|
|
|
24948
24928
|
init_terminating_infrastructure();
|
|
24949
24929
|
init_secretariat_contracts();
|
|
24950
24930
|
init_secretariat_contracts();
|
|
24951
|
-
import { Type as
|
|
24931
|
+
import { Type as Type18 } from "typebox";
|
|
24952
24932
|
var secretariatVerdictSchema = withTerminatingOutputDeclarations(
|
|
24953
|
-
|
|
24933
|
+
Type18.Object(
|
|
24954
24934
|
{
|
|
24955
|
-
secretariatStatus:
|
|
24935
|
+
secretariatStatus: Type18.Unknown({
|
|
24956
24936
|
description: "converged | escalate\uFF08\u7EC8\u5C40\u5F62\u72B6\u6307\u5F15\uFF0C\u975E\u95F8\uFF09"
|
|
24957
24937
|
}),
|
|
24958
|
-
ticketNumber:
|
|
24959
|
-
|
|
24938
|
+
ticketNumber: Type18.Optional(
|
|
24939
|
+
Type18.Number({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
|
|
24960
24940
|
),
|
|
24961
|
-
note:
|
|
24962
|
-
evidence:
|
|
24963
|
-
decisionGate:
|
|
24964
|
-
|
|
24941
|
+
note: Type18.Optional(Type18.String({ description: "\u9644\u6CE8" })),
|
|
24942
|
+
evidence: Type18.Optional(Type18.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
24943
|
+
decisionGate: Type18.Optional(
|
|
24944
|
+
Type18.Object(
|
|
24965
24945
|
{
|
|
24966
|
-
question:
|
|
24967
|
-
options:
|
|
24946
|
+
question: Type18.Optional(Type18.String()),
|
|
24947
|
+
options: Type18.Optional(Type18.Array(Type18.String()))
|
|
24968
24948
|
},
|
|
24969
24949
|
{ additionalProperties: true, description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
24970
24950
|
)
|
|
@@ -25023,7 +25003,7 @@ init_auditor_output();
|
|
|
25023
25003
|
var AUDITOR_TOOL_SPEC = {
|
|
25024
25004
|
name: AUDITOR_OUTPUT_TOOL_NAME,
|
|
25025
25005
|
label: "\u5BA1\u5211\u9662\u8F93\u51FA",
|
|
25026
|
-
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\
|
|
25006
|
+
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\uFF0Cstatus \u4E3A converged\u3001continue \u6216 escalate\u3002",
|
|
25027
25007
|
promptSnippet: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267",
|
|
25028
25008
|
parameters: auditorOutputSchema
|
|
25029
25009
|
};
|
|
@@ -25035,14 +25015,14 @@ init_packaged_role_registry();
|
|
|
25035
25015
|
init_activation_ledger_topology();
|
|
25036
25016
|
import { resolve as resolve17 } from "node:path";
|
|
25037
25017
|
import "@earendil-works/pi-coding-agent";
|
|
25038
|
-
import { Type as
|
|
25018
|
+
import { Type as Type20 } from "typebox";
|
|
25039
25019
|
|
|
25040
25020
|
// src/navigator-public-session.ts
|
|
25041
25021
|
init_sitian_facade();
|
|
25042
25022
|
import { basename as basename11 } from "node:path";
|
|
25043
25023
|
|
|
25044
25024
|
// src/navigator-session-contracts.ts
|
|
25045
|
-
import { Type as
|
|
25025
|
+
import { Type as Type19 } from "typebox";
|
|
25046
25026
|
import { Value as Value4 } from "typebox/value";
|
|
25047
25027
|
var NAVIGATOR_PREPARE_TOOL_NAME = "ak_navigator_prepare";
|
|
25048
25028
|
var NAVIGATOR_UNAVAILABLE_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -25150,26 +25130,26 @@ function navigatorProviderFailureFromPublicTerminal(outcome) {
|
|
|
25150
25130
|
if (typed !== void 0) return { source: typed, cause: typed };
|
|
25151
25131
|
return { source: "unknown", cause: "unknown" };
|
|
25152
25132
|
}
|
|
25153
|
-
var navigatorProviderFailureSchema =
|
|
25154
|
-
source:
|
|
25155
|
-
|
|
25156
|
-
|
|
25157
|
-
|
|
25158
|
-
|
|
25159
|
-
|
|
25160
|
-
|
|
25161
|
-
|
|
25162
|
-
|
|
25133
|
+
var navigatorProviderFailureSchema = Type19.Object({
|
|
25134
|
+
source: Type19.Union([
|
|
25135
|
+
Type19.Literal("context"),
|
|
25136
|
+
Type19.Literal("session"),
|
|
25137
|
+
Type19.Literal("model"),
|
|
25138
|
+
Type19.Literal("thinking"),
|
|
25139
|
+
Type19.Literal("auth"),
|
|
25140
|
+
Type19.Literal("quota"),
|
|
25141
|
+
Type19.Literal("transport"),
|
|
25142
|
+
Type19.Literal("unknown")
|
|
25163
25143
|
]),
|
|
25164
|
-
cause:
|
|
25165
|
-
|
|
25166
|
-
|
|
25167
|
-
|
|
25168
|
-
|
|
25169
|
-
|
|
25170
|
-
|
|
25171
|
-
|
|
25172
|
-
|
|
25144
|
+
cause: Type19.Union([
|
|
25145
|
+
Type19.Literal("context"),
|
|
25146
|
+
Type19.Literal("session"),
|
|
25147
|
+
Type19.Literal("model"),
|
|
25148
|
+
Type19.Literal("thinking"),
|
|
25149
|
+
Type19.Literal("auth"),
|
|
25150
|
+
Type19.Literal("quota"),
|
|
25151
|
+
Type19.Literal("transport"),
|
|
25152
|
+
Type19.Literal("unknown")
|
|
25173
25153
|
])
|
|
25174
25154
|
}, { additionalProperties: false });
|
|
25175
25155
|
function parseNavigatorModelSetting(value) {
|
|
@@ -25436,8 +25416,8 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
|
|
|
25436
25416
|
return void 0;
|
|
25437
25417
|
}
|
|
25438
25418
|
var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
|
|
25439
|
-
var prepareSchema =
|
|
25440
|
-
prose:
|
|
25419
|
+
var prepareSchema = Type20.Object({
|
|
25420
|
+
prose: Type20.Optional(Type20.Unknown({
|
|
25441
25421
|
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002\u975E\u53D7\u7406\u95F8"
|
|
25442
25422
|
}))
|
|
25443
25423
|
}, { additionalProperties: true });
|
|
@@ -25998,46 +25978,14 @@ init_packaged_role_registry();
|
|
|
25998
25978
|
init_audit_escalation();
|
|
25999
25979
|
|
|
26000
25980
|
// src/judge-role.ts
|
|
26001
|
-
|
|
25981
|
+
init_review_submission();
|
|
26002
25982
|
init_submission_errors();
|
|
26003
25983
|
init_audit_escalation();
|
|
26004
25984
|
init_readable_gate_item();
|
|
26005
25985
|
init_judge_output();
|
|
26006
|
-
import { Type as Type24 } from "typebox";
|
|
26007
25986
|
var JUDGE_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "continue", "escalate"]);
|
|
26008
|
-
var JUDGE_STATUS_REASK = "
|
|
26009
|
-
var judgeVerdictSchema =
|
|
26010
|
-
Type24.Object(
|
|
26011
|
-
{
|
|
26012
|
-
judgeStatus: Type24.Unknown({ description: "converged | continue | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }),
|
|
26013
|
-
fix: Type24.Optional(
|
|
26014
|
-
Type24.Object(
|
|
26015
|
-
{ summary: Type24.Optional(Type24.String({ description: "continue \u65F6\u7684\u8865\u6551\u6458\u8981" })) },
|
|
26016
|
-
{ additionalProperties: true, description: "continue \u65F6\u7684\u8865\u6551\u8BF4\u660E" }
|
|
26017
|
-
)
|
|
26018
|
-
),
|
|
26019
|
-
classes: Type24.Optional(Type24.Array(Type24.Object({
|
|
26020
|
-
name: Type24.Optional(Type24.String()),
|
|
26021
|
-
owner: Type24.Optional(Type24.String()),
|
|
26022
|
-
boundary: Type24.Optional(Type24.String()),
|
|
26023
|
-
disposition: Type24.Optional(Type24.String())
|
|
26024
|
-
}, { additionalProperties: true }), { description: "\u5DF2\u88C1\u51B3 finding \u7C7B\u53CA\u5176 owner \u4E0E\u4FEE\u7406\u8FB9\u754C" })),
|
|
26025
|
-
note: Type24.Optional(Type24.String({ description: "\u53EF\u9009\u88C1\u51B3\u9644\u6CE8" })),
|
|
26026
|
-
evidence: Type24.Optional(Type24.Unknown({ description: "\u7559\u5B58\u7684\u88C1\u51B3\u8BC1\u636E" })),
|
|
26027
|
-
decisionGate: Type24.Optional(
|
|
26028
|
-
Type24.Object(
|
|
26029
|
-
{
|
|
26030
|
-
question: Type24.Optional(Type24.String()),
|
|
26031
|
-
options: Type24.Optional(Type24.Array(Type24.String()))
|
|
26032
|
-
},
|
|
26033
|
-
{ additionalProperties: true, description: "\u9700\u4EBA\u6743\u5A01\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
26034
|
-
)
|
|
26035
|
-
)
|
|
26036
|
-
},
|
|
26037
|
-
{ additionalProperties: true }
|
|
26038
|
-
)
|
|
26039
|
-
);
|
|
26040
|
-
judgeVerdictSchema.required = [];
|
|
25987
|
+
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";
|
|
25988
|
+
var judgeVerdictSchema = reviewSubmissionSchema;
|
|
26041
25989
|
function validateVerdict(verdict) {
|
|
26042
25990
|
return validateAcceptedJudgeDetails(verdict);
|
|
26043
25991
|
}
|
|
@@ -26058,7 +26006,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26058
26006
|
parameters: judgeVerdictSchema,
|
|
26059
26007
|
async execute(toolCallId, parameters, signal, _onUpdate, ctx) {
|
|
26060
26008
|
if (soul === void 0) throw new Error("\u5927\u7406\u5BFA\u804C\u5206\u672A\u88C5\u8F7D");
|
|
26061
|
-
const rawStatus = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) && typeof parameters.
|
|
26009
|
+
const rawStatus = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) && typeof parameters.status === "string" ? parameters.status : void 0;
|
|
26062
26010
|
if (rawStatus === void 0 || !JUDGE_QUEUE_STATUSES.has(rawStatus)) {
|
|
26063
26011
|
throw new ParentQueueReaskError(JUDGE_STATUS_REASK);
|
|
26064
26012
|
}
|
|
@@ -26073,7 +26021,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26073
26021
|
const verdict = validateVerdict(parameters);
|
|
26074
26022
|
let draftPass;
|
|
26075
26023
|
try {
|
|
26076
|
-
const obtainedDraftPass = await pi.
|
|
26024
|
+
const obtainedDraftPass = await pi.requireSubmissionGate({
|
|
26077
26025
|
context: ctx,
|
|
26078
26026
|
subject: { kind: "judge_draft" },
|
|
26079
26027
|
...signal === void 0 ? {} : { signal },
|
|
@@ -26083,8 +26031,15 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26083
26031
|
submission: parameters
|
|
26084
26032
|
});
|
|
26085
26033
|
draftPass = obtainedDraftPass || void 0;
|
|
26034
|
+
if (draftPass?.status === "continue") {
|
|
26035
|
+
return {
|
|
26036
|
+
content: [{ type: "text", text: readableGateItem(draftPass.receipt) }],
|
|
26037
|
+
details: verdict,
|
|
26038
|
+
terminate: false
|
|
26039
|
+
};
|
|
26040
|
+
}
|
|
26086
26041
|
if (draftPass !== void 0) hostActions.bindPriorGatePass(toolCallId, draftPass.receipt);
|
|
26087
|
-
const compliancePass = await pi.
|
|
26042
|
+
const compliancePass = await pi.requireSubmissionGate({
|
|
26088
26043
|
context: ctx,
|
|
26089
26044
|
subject: { kind: "judge_compliance" },
|
|
26090
26045
|
...signal === void 0 ? {} : { signal },
|
|
@@ -26093,6 +26048,13 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26093
26048
|
// #879: same parent payload for 审刑院; not recovered from session latest.
|
|
26094
26049
|
submission: parameters
|
|
26095
26050
|
});
|
|
26051
|
+
if (compliancePass?.status === "continue") {
|
|
26052
|
+
return {
|
|
26053
|
+
content: [draftPass, compliancePass].filter((pass) => pass !== void 0).map((pass) => ({ type: "text", text: readableGateItem(pass.receipt) })),
|
|
26054
|
+
details: verdict,
|
|
26055
|
+
terminate: false
|
|
26056
|
+
};
|
|
26057
|
+
}
|
|
26096
26058
|
return {
|
|
26097
26059
|
content: [draftPass, compliancePass].filter((pass) => pass !== void 0).map((pass) => ({ type: "text", text: readableGateItem(pass.receipt) })),
|
|
26098
26060
|
details: verdict,
|
|
@@ -26100,7 +26062,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26100
26062
|
};
|
|
26101
26063
|
} catch (error) {
|
|
26102
26064
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
26103
|
-
return
|
|
26065
|
+
return projectGatekeeperEscalation(error.result, verdict);
|
|
26104
26066
|
}
|
|
26105
26067
|
throw error;
|
|
26106
26068
|
}
|
|
@@ -26125,12 +26087,12 @@ ${soul}
|
|
|
26125
26087
|
init_open_tool_schema();
|
|
26126
26088
|
init_terminating_infrastructure();
|
|
26127
26089
|
init_reviewer_output();
|
|
26128
|
-
import { Type as
|
|
26129
|
-
var reviewerAmendmentsSchema =
|
|
26130
|
-
completeness:
|
|
26090
|
+
import { Type as Type21 } from "typebox";
|
|
26091
|
+
var reviewerAmendmentsSchema = Type21.Object({
|
|
26092
|
+
completeness: Type21.Optional(Type21.String({
|
|
26131
26093
|
description: "completeness lens \u5B8C\u6574\u62A5\u544A\uFF1Acandidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict\uFF1B\u975E\u4EC5 verdict \u4E00\u884C\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u82E5\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u4E8E\u6B64"
|
|
26132
26094
|
})),
|
|
26133
|
-
correctness:
|
|
26095
|
+
correctness: Type21.Optional(Type21.String({
|
|
26134
26096
|
description: "correctness lens \u5B8C\u6574\u62A5\u544A\uFF1Acandidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict\uFF1B\u975E\u4EC5 verdict \u4E00\u884C\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u82E5\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u4E8E\u6B64"
|
|
26135
26097
|
}))
|
|
26136
26098
|
}, {
|
|
@@ -26138,15 +26100,15 @@ var reviewerAmendmentsSchema = Type25.Object({
|
|
|
26138
26100
|
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\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
26139
26101
|
});
|
|
26140
26102
|
var REVIEWER_STATUS_DESCRIPTION = "completed | refused \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\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";
|
|
26141
|
-
var reviewerOutputVariants =
|
|
26142
|
-
|
|
26143
|
-
status:
|
|
26144
|
-
amendments:
|
|
26103
|
+
var reviewerOutputVariants = Type21.Union([
|
|
26104
|
+
Type21.Object({
|
|
26105
|
+
status: Type21.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
|
|
26106
|
+
amendments: Type21.Optional(reviewerAmendmentsSchema)
|
|
26145
26107
|
}, { additionalProperties: false }),
|
|
26146
|
-
|
|
26147
|
-
status:
|
|
26148
|
-
diagnostic:
|
|
26149
|
-
amendments:
|
|
26108
|
+
Type21.Object({
|
|
26109
|
+
status: Type21.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
|
|
26110
|
+
diagnostic: Type21.String({ description: "\u62D2\u7EDD\u8BCA\u65AD\u8BF4\u660E\uFF1Bhard-stop\uFF0Fusage error \u539F\u56E0\u8FDB\u6B64\u5B57\u6BB5\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u53E6\u7167\u5F55 amendments" }),
|
|
26111
|
+
amendments: Type21.Optional(reviewerAmendmentsSchema)
|
|
26150
26112
|
}, { additionalProperties: false })
|
|
26151
26113
|
]);
|
|
26152
26114
|
var reviewerOutputSchema = withTerminatingOutputDeclarations(
|
|
@@ -26205,7 +26167,7 @@ init_submission_errors();
|
|
|
26205
26167
|
init_worker_output();
|
|
26206
26168
|
init_fixer_output();
|
|
26207
26169
|
init_fixer_packet();
|
|
26208
|
-
import { Type as
|
|
26170
|
+
import { Type as Type22 } from "typebox";
|
|
26209
26171
|
|
|
26210
26172
|
// src/worker-submission-gates.ts
|
|
26211
26173
|
init_archivist_record_entry();
|
|
@@ -26470,20 +26432,20 @@ function fixerBashSeatbeltDenyReason(matched) {
|
|
|
26470
26432
|
|
|
26471
26433
|
// src/worker-role.ts
|
|
26472
26434
|
var CODER_STATUS_DESCRIPTION = "planned | completed | refused | unfinished \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\uFF1Bcompleted \u56DE\u6267\u542B TDD\u3001\u540C\u6A21\u5F0F\u3001\u5F15\u5165\u56DE\u5F52\u3001\u884C\u4E3A\u4E8B\u5B9E\u56DB\u9879\u8BC1\u636E\uFF1Bunfinished \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";
|
|
26473
|
-
var coderOutputVariants =
|
|
26474
|
-
|
|
26475
|
-
status:
|
|
26476
|
-
report:
|
|
26435
|
+
var coderOutputVariants = Type22.Union([
|
|
26436
|
+
Type22.Object({
|
|
26437
|
+
status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26438
|
+
report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
|
|
26477
26439
|
}, { additionalProperties: false }),
|
|
26478
|
-
|
|
26479
|
-
status:
|
|
26480
|
-
report:
|
|
26440
|
+
Type22.Object({
|
|
26441
|
+
status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26442
|
+
report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
|
|
26481
26443
|
}, { additionalProperties: false }),
|
|
26482
|
-
|
|
26483
|
-
status:
|
|
26484
|
-
report:
|
|
26485
|
-
remainingScope:
|
|
26486
|
-
reason:
|
|
26444
|
+
Type22.Object({
|
|
26445
|
+
status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26446
|
+
report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
|
|
26447
|
+
remainingScope: Type22.String({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
|
|
26448
|
+
reason: Type22.Optional(Type22.String({
|
|
26487
26449
|
minLength: 1,
|
|
26488
26450
|
description: "\u963B\u65AD\u539F\u56E0\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u3002\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002"
|
|
26489
26451
|
}))
|
|
@@ -26613,7 +26575,7 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26613
26575
|
);
|
|
26614
26576
|
let pass;
|
|
26615
26577
|
try {
|
|
26616
|
-
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.
|
|
26578
|
+
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.requireSubmissionGate({
|
|
26617
26579
|
context: ctx,
|
|
26618
26580
|
subject: { kind: "worker_completion" },
|
|
26619
26581
|
..._signal === void 0 ? {} : { signal: _signal },
|
|
@@ -26624,10 +26586,17 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26624
26586
|
}) : void 0;
|
|
26625
26587
|
} catch (error) {
|
|
26626
26588
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
26627
|
-
return
|
|
26589
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
26628
26590
|
}
|
|
26629
26591
|
throw error;
|
|
26630
26592
|
}
|
|
26593
|
+
if (pass?.status === "continue") {
|
|
26594
|
+
return {
|
|
26595
|
+
content: [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
26596
|
+
details: output,
|
|
26597
|
+
terminate: false
|
|
26598
|
+
};
|
|
26599
|
+
}
|
|
26631
26600
|
const acceptedDetails = output;
|
|
26632
26601
|
return {
|
|
26633
26602
|
content: pass === void 0 ? [] : [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
@@ -26757,7 +26726,7 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26757
26726
|
);
|
|
26758
26727
|
let pass;
|
|
26759
26728
|
try {
|
|
26760
|
-
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.
|
|
26729
|
+
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.requireSubmissionGate({
|
|
26761
26730
|
context: ctx2,
|
|
26762
26731
|
subject: { kind: "worker_completion" },
|
|
26763
26732
|
..._signal === void 0 ? {} : { signal: _signal },
|
|
@@ -26768,10 +26737,17 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26768
26737
|
}) : void 0;
|
|
26769
26738
|
} catch (error) {
|
|
26770
26739
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
26771
|
-
return
|
|
26740
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
26772
26741
|
}
|
|
26773
26742
|
throw error;
|
|
26774
26743
|
}
|
|
26744
|
+
if (pass?.status === "continue") {
|
|
26745
|
+
return {
|
|
26746
|
+
content: [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
26747
|
+
details: output,
|
|
26748
|
+
terminate: false
|
|
26749
|
+
};
|
|
26750
|
+
}
|
|
26775
26751
|
const acceptedDetails = output;
|
|
26776
26752
|
return {
|
|
26777
26753
|
content: pass === void 0 ? [] : [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
@@ -27179,6 +27155,13 @@ function createFiledOfficerRuntime(roleHost, spec, dependencies) {
|
|
|
27179
27155
|
if (isAuditEscalationProjection(projected)) {
|
|
27180
27156
|
return { content: [], details: projected, terminate: true };
|
|
27181
27157
|
}
|
|
27158
|
+
if (projected !== null && typeof projected === "object" && "status" in projected && projected.status === "continue" && "receipt" in projected) {
|
|
27159
|
+
return {
|
|
27160
|
+
content: [{ type: "text", text: readableGateItem(projected.receipt) }],
|
|
27161
|
+
details: projected,
|
|
27162
|
+
terminate: false
|
|
27163
|
+
};
|
|
27164
|
+
}
|
|
27182
27165
|
const pass = spec.relayGatePass === true && projected !== null && typeof projected === "object" && "officer" in projected && "receipt" in projected ? projected : void 0;
|
|
27183
27166
|
return {
|
|
27184
27167
|
content: pass === void 0 || pass.receipt === void 0 ? [] : [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
@@ -27371,12 +27354,12 @@ ${error.message}`
|
|
|
27371
27354
|
);
|
|
27372
27355
|
}
|
|
27373
27356
|
var COUNTERSIGN_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "continue", "escalate"]);
|
|
27374
|
-
var COUNTERSIGN_STATUS_REASK = "
|
|
27357
|
+
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";
|
|
27375
27358
|
var SECRETARIAT_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "escalate"]);
|
|
27376
27359
|
var SECRETARIAT_STATUS_REASK = "secretariatStatus \u4E0D\u662F converged\u3001escalate \u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
27377
27360
|
function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
27378
27361
|
const beforeAccept = hostActions !== void 0 ? async ({ toolCallId, parameters, signal, ctx }) => {
|
|
27379
|
-
if (roleHost.
|
|
27362
|
+
if (roleHost.requireSubmissionGate === void 0) {
|
|
27380
27363
|
const error = new Error("host cannot mount the secretariat submission gate");
|
|
27381
27364
|
error.name = "InfrastructureFailure";
|
|
27382
27365
|
return hostActions.failInfrastructure(error, ctx, toolCallId);
|
|
@@ -27390,7 +27373,7 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27390
27373
|
return void 0;
|
|
27391
27374
|
}
|
|
27392
27375
|
try {
|
|
27393
|
-
const pass = await roleHost.
|
|
27376
|
+
const pass = await roleHost.requireSubmissionGate({
|
|
27394
27377
|
context: ctx,
|
|
27395
27378
|
subject: { kind: "secretariat_verdict" },
|
|
27396
27379
|
...signal === void 0 ? {} : { signal },
|
|
@@ -27399,7 +27382,7 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27399
27382
|
// #879: this-turn typed payload — identity-bound at submit site.
|
|
27400
27383
|
submission: parameters
|
|
27401
27384
|
});
|
|
27402
|
-
if (pass !== void 0 && pass !== null && typeof pass === "object" && "receipt" in pass) {
|
|
27385
|
+
if (pass !== void 0 && pass !== null && typeof pass === "object" && pass.status === "converged" && "receipt" in pass) {
|
|
27403
27386
|
const {
|
|
27404
27387
|
SECRETARIAT_GATE_OFFICER_ENTRY_TYPE: SECRETARIAT_GATE_OFFICER_ENTRY_TYPE2
|
|
27405
27388
|
} = await Promise.resolve().then(() => (init_secretariat_contracts(), secretariat_contracts_exports));
|
|
@@ -27477,20 +27460,20 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27477
27460
|
function createCountersignRoleRuntime(roleHost, dependencies, hostActions) {
|
|
27478
27461
|
const beforeAccept = hostActions !== void 0 ? async ({ toolCallId, parameters, signal, ctx }) => {
|
|
27479
27462
|
const record4 = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) ? parameters : void 0;
|
|
27480
|
-
const status = record4 !== void 0 && typeof record4.
|
|
27463
|
+
const status = record4 !== void 0 && typeof record4.status === "string" ? record4.status : void 0;
|
|
27481
27464
|
if (status === void 0 || !COUNTERSIGN_QUEUE_STATUSES.has(status)) {
|
|
27482
27465
|
throw new ParentQueueReaskError(COUNTERSIGN_STATUS_REASK);
|
|
27483
27466
|
}
|
|
27484
27467
|
if (status === "escalate") {
|
|
27485
27468
|
return void 0;
|
|
27486
27469
|
}
|
|
27487
|
-
if (roleHost.
|
|
27470
|
+
if (roleHost.requireSubmissionGate === void 0) {
|
|
27488
27471
|
const error = new Error("host cannot mount the countersign gate");
|
|
27489
27472
|
error.name = "InfrastructureFailure";
|
|
27490
27473
|
return hostActions.failInfrastructure(error, ctx, toolCallId);
|
|
27491
27474
|
}
|
|
27492
27475
|
try {
|
|
27493
|
-
return await roleHost.
|
|
27476
|
+
return await roleHost.requireSubmissionGate({
|
|
27494
27477
|
context: ctx,
|
|
27495
27478
|
subject: { kind: "countersign_verdict" },
|
|
27496
27479
|
...signal === void 0 ? {} : { signal },
|
|
@@ -27541,7 +27524,15 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27541
27524
|
};
|
|
27542
27525
|
const roleHost = createSubmissionLedgerHost(
|
|
27543
27526
|
envelopeHost.host,
|
|
27544
|
-
new Map(PACKAGED_ROLE_REGISTRY.
|
|
27527
|
+
new Map(PACKAGED_ROLE_REGISTRY.reduce((entries, { role, outputTool }) => {
|
|
27528
|
+
const existingIndex = entries.findIndex(([name]) => name === outputTool);
|
|
27529
|
+
if (existingIndex < 0) entries.push([outputTool, role]);
|
|
27530
|
+
else {
|
|
27531
|
+
const previous = entries[existingIndex][1];
|
|
27532
|
+
entries[existingIndex] = [outputTool, [...Array.isArray(previous) ? previous : [previous], role]];
|
|
27533
|
+
}
|
|
27534
|
+
return entries;
|
|
27535
|
+
}, [])),
|
|
27545
27536
|
failInfrastructure,
|
|
27546
27537
|
async (closed, context) => projectClosedSubmission(closed, context)
|
|
27547
27538
|
);
|
|
@@ -28544,9 +28535,9 @@ async function prepareRoleEnvelope(options) {
|
|
|
28544
28535
|
getActiveTools() {
|
|
28545
28536
|
return [...preferredTools];
|
|
28546
28537
|
},
|
|
28547
|
-
async
|
|
28538
|
+
async requireSubmissionGate(gateOptions) {
|
|
28548
28539
|
const packageRoot = typeof options.dependencies.packageRoot === "string" ? options.dependencies.packageRoot : void 0;
|
|
28549
|
-
return
|
|
28540
|
+
return requireSubmissionGate({
|
|
28550
28541
|
context: gateOptions.context,
|
|
28551
28542
|
subject: gateOptions.subject,
|
|
28552
28543
|
...gateOptions.signal === void 0 ? {} : { signal: gateOptions.signal },
|
|
@@ -28600,7 +28591,7 @@ async function prepareRoleEnvelope(options) {
|
|
|
28600
28591
|
const record4 = details;
|
|
28601
28592
|
if (record4.cause === "infrastructure") return;
|
|
28602
28593
|
if (record4.kind === "role_infrastructure_failure") return;
|
|
28603
|
-
const code = typeof record4.code === "string" && record4.code.length > 0 ? record4.code : record4.status === "
|
|
28594
|
+
const code = typeof record4.code === "string" && record4.code.length > 0 ? record4.code : record4.status === "continue" || record4.status === "escalate" || record4.status === "no_receipt" ? record4.status : void 0;
|
|
28604
28595
|
if (code === void 0) return;
|
|
28605
28596
|
rejection = {
|
|
28606
28597
|
code,
|
|
@@ -28609,7 +28600,7 @@ async function prepareRoleEnvelope(options) {
|
|
|
28609
28600
|
};
|
|
28610
28601
|
}
|
|
28611
28602
|
function textDiagnostic(content) {
|
|
28612
|
-
const text = content.
|
|
28603
|
+
const text = content.filter((part) => part.type === "text").map((part) => part.text).join("\n\n");
|
|
28613
28604
|
return text.trim().length > 0 ? text : void 0;
|
|
28614
28605
|
}
|
|
28615
28606
|
function rememberInfrastructureFailure(details, content) {
|
|
@@ -28726,6 +28717,13 @@ async function prepareRoleEnvelope(options) {
|
|
|
28726
28717
|
details: result.details,
|
|
28727
28718
|
isError: false
|
|
28728
28719
|
});
|
|
28720
|
+
if (result.terminate === false) {
|
|
28721
|
+
rejection = {
|
|
28722
|
+
code: "continue",
|
|
28723
|
+
toolCallIds: [toolCallId],
|
|
28724
|
+
message: textDiagnostic(projected.content) ?? "continue"
|
|
28725
|
+
};
|
|
28726
|
+
}
|
|
28729
28727
|
return { content: projected.content, isError: projected.isError };
|
|
28730
28728
|
} catch (error) {
|
|
28731
28729
|
let content;
|