@akagilnc/pi-workflow-roles 0.1.4980 → 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 +438 -456
- package/dist/analyst-gate-cycles-read.js +16 -11
- package/dist/analyst-metric-families/gate-cycles.js +2 -2
- package/dist/audit-escalation.js +4 -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 +20 -41
- package/dist/headless-host/production-host.js +438 -456
- 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 +90 -86
- package/dist/public-cli/option-definitions.js +2 -2
- package/dist/public-cli/settlement.js +11 -11
- package/dist/review-submission.js +20 -0
- package/dist/submission-errors.js +2 -2
- package/dist/submission-ledger.js +14 -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 +8 -8
- 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 +30 -55
- 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 +29 -49
- 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 +13 -14
- 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 +13 -3
- package/src/ticket-trajectory.ts +9 -4
- package/src/worker-role.ts +16 -2
|
@@ -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;
|
|
@@ -13557,8 +13548,8 @@ function isAuditEscalationResult(value) {
|
|
|
13557
13548
|
}
|
|
13558
13549
|
async function disposeComplianceDecision(decision, handlers, deliveredOutput) {
|
|
13559
13550
|
switch (decision.status) {
|
|
13560
|
-
case "
|
|
13561
|
-
return await handlers.
|
|
13551
|
+
case "converged":
|
|
13552
|
+
return await handlers.converged(decision.usage);
|
|
13562
13553
|
case "no-receipt":
|
|
13563
13554
|
if (handlers.noReceipt === void 0) {
|
|
13564
13555
|
throw new Error("Compliance no-receipt projection handler is unavailable");
|
|
@@ -13575,8 +13566,8 @@ async function disposeComplianceDecision(decision, handlers, deliveredOutput) {
|
|
|
13575
13566
|
decision,
|
|
13576
13567
|
decision.usage === void 0 ? {} : { usage: decision.usage }
|
|
13577
13568
|
);
|
|
13578
|
-
case "
|
|
13579
|
-
return await handlers.
|
|
13569
|
+
case "continue":
|
|
13570
|
+
return await handlers.continue(decision.violations);
|
|
13580
13571
|
case "escalate":
|
|
13581
13572
|
return await handlers.escalate(
|
|
13582
13573
|
projectAuditEscalation(decision, deliveredOutput)
|
|
@@ -13918,7 +13909,14 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
13918
13909
|
return {
|
|
13919
13910
|
...host,
|
|
13920
13911
|
registerTool(tool) {
|
|
13921
|
-
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
|
+
}
|
|
13922
13920
|
if (role === void 0) return host.registerTool(tool);
|
|
13923
13921
|
host.registerTool({
|
|
13924
13922
|
...tool,
|
|
@@ -13996,6 +13994,7 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
13996
13994
|
await projectClosure(closed2, context);
|
|
13997
13995
|
return result;
|
|
13998
13996
|
}
|
|
13997
|
+
if (result.terminate === false) return result;
|
|
13999
13998
|
const closed = {
|
|
14000
13999
|
role,
|
|
14001
14000
|
kind: "accepted",
|
|
@@ -14851,7 +14850,7 @@ function markerMatchesExpectedIdentity(marker, expected) {
|
|
|
14851
14850
|
}
|
|
14852
14851
|
function classifyPackagedRoleTerminalResult(message) {
|
|
14853
14852
|
if (typeof message.toolName !== "string") return { kind: "nonterminal" };
|
|
14854
|
-
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" };
|
|
14855
14854
|
const hasInfraBase = hasNavigatorInfrastructureFailureBase(message.details);
|
|
14856
14855
|
const infraFact = hasInfraBase ? buildNavigatorInfrastructureFailureFact() : void 0;
|
|
14857
14856
|
if (message.isError === true) {
|
|
@@ -14868,12 +14867,14 @@ function durableTerminalAt(entries, index) {
|
|
|
14868
14867
|
const entry = entries[index];
|
|
14869
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;
|
|
14870
14869
|
if (typeof message?.toolName !== "string") return void 0;
|
|
14871
|
-
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);
|
|
14872
14872
|
if (role === void 0) return void 0;
|
|
14873
14873
|
const classification = classifyPackagedRoleTerminalResult(message);
|
|
14874
14874
|
if (classification.kind !== "accepted" && classification.kind !== "infrastructure") {
|
|
14875
14875
|
return void 0;
|
|
14876
14876
|
}
|
|
14877
|
+
if (entry?.type === "message" && classification.kind === "accepted" && !LEGACY_REVIEW_OUTPUT_ROLES.has(message.toolName)) return void 0;
|
|
14877
14878
|
return {
|
|
14878
14879
|
index,
|
|
14879
14880
|
role,
|
|
@@ -14942,7 +14943,7 @@ var init_navigator_invocation_identity = __esm({
|
|
|
14942
14943
|
"reason"
|
|
14943
14944
|
];
|
|
14944
14945
|
PACKAGED_ROLE_OUTPUT_TOOLS = new Map(
|
|
14945
|
-
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]
|
|
14946
14947
|
);
|
|
14947
14948
|
}
|
|
14948
14949
|
});
|
|
@@ -16553,15 +16554,14 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
16553
16554
|
let thisAttemptHasSeatSuccess = false;
|
|
16554
16555
|
let residual;
|
|
16555
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
|
+
}
|
|
16556
16561
|
const message = entries[index]?.message;
|
|
16557
16562
|
if (message?.role !== "toolResult") continue;
|
|
16558
16563
|
if (message.toolName !== spec.toolName) continue;
|
|
16559
|
-
if (message.isError === false)
|
|
16560
|
-
if (boundRoleToolCallForResult(entries, index, message, spec.toolName) !== void 0) {
|
|
16561
|
-
thisAttemptHasSeatSuccess = true;
|
|
16562
|
-
}
|
|
16563
|
-
continue;
|
|
16564
|
-
}
|
|
16564
|
+
if (message.isError === false) continue;
|
|
16565
16565
|
if (residual === void 0) {
|
|
16566
16566
|
residual = boundErroredToolCandidate(
|
|
16567
16567
|
entries,
|
|
@@ -16572,7 +16572,7 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
16572
16572
|
}
|
|
16573
16573
|
}
|
|
16574
16574
|
const roleOutcome = await sealedLedgerOutcome(admitted, spec.role, scope);
|
|
16575
|
-
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)) {
|
|
16576
16576
|
const navigator = extractNavigatorFact(entries);
|
|
16577
16577
|
const artifacts = await publishDeclaredSeatArtifacts(
|
|
16578
16578
|
admitted,
|
|
@@ -18781,7 +18781,7 @@ function isRecord14(value) {
|
|
|
18781
18781
|
}
|
|
18782
18782
|
function isEscalatePayload(payload) {
|
|
18783
18783
|
if (!isRecord14(payload)) return false;
|
|
18784
|
-
return payload.status === "escalate"
|
|
18784
|
+
return payload.status === "escalate";
|
|
18785
18785
|
}
|
|
18786
18786
|
function courtDiaristPayloadRows(roleOutcome, submissions) {
|
|
18787
18787
|
if (roleOutcome === void 0) return submissions ?? [];
|
|
@@ -21013,8 +21013,8 @@ function emptyAccum() {
|
|
|
21013
21013
|
function absorbRound(accum, round) {
|
|
21014
21014
|
accum.rounds += 1;
|
|
21015
21015
|
accum.wallSum += round.officerWallMs;
|
|
21016
|
-
if (round.status === "bounce") accum.bounceCount += 1;
|
|
21017
|
-
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;
|
|
21018
21018
|
}
|
|
21019
21019
|
function finishOfficer(officer, accum) {
|
|
21020
21020
|
return {
|
|
@@ -21416,7 +21416,7 @@ var init_analyst_page = __esm({
|
|
|
21416
21416
|
|
|
21417
21417
|
// src/analyst-entry.ts
|
|
21418
21418
|
import { readFile as readFile21 } from "node:fs/promises";
|
|
21419
|
-
import { Type as
|
|
21419
|
+
import { Type as Type11 } from "typebox";
|
|
21420
21420
|
function isMissingPathError7(error) {
|
|
21421
21421
|
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
21422
21422
|
}
|
|
@@ -21623,16 +21623,16 @@ var init_analyst_entry = __esm({
|
|
|
21623
21623
|
}
|
|
21624
21624
|
}
|
|
21625
21625
|
};
|
|
21626
|
-
analystSweepModeInputSchema =
|
|
21626
|
+
analystSweepModeInputSchema = Type11.Object(
|
|
21627
21627
|
{
|
|
21628
|
-
mode:
|
|
21629
|
-
mergedPullRequests:
|
|
21630
|
-
|
|
21628
|
+
mode: Type11.Literal("sweep"),
|
|
21629
|
+
mergedPullRequests: Type11.Array(
|
|
21630
|
+
Type11.Object(
|
|
21631
21631
|
{
|
|
21632
|
-
projectRoot:
|
|
21632
|
+
projectRoot: Type11.String(),
|
|
21633
21633
|
/** 排除后改动行数 — omit or 0 → typed 空缺; finite ≥ 0 only. */
|
|
21634
|
-
changedLines:
|
|
21635
|
-
|
|
21634
|
+
changedLines: Type11.Optional(
|
|
21635
|
+
Type11.Number({ minimum: 0, maximum: Number.MAX_VALUE })
|
|
21636
21636
|
)
|
|
21637
21637
|
},
|
|
21638
21638
|
{ additionalProperties: false }
|
|
@@ -23193,7 +23193,7 @@ import { createServer } from "node:net";
|
|
|
23193
23193
|
import { dirname as dirname23, join as join45 } from "node:path";
|
|
23194
23194
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
23195
23195
|
|
|
23196
|
-
// src/
|
|
23196
|
+
// src/submission-gate.ts
|
|
23197
23197
|
init_archivist_record_entry();
|
|
23198
23198
|
init_gatekeeper_role();
|
|
23199
23199
|
init_session_assistant_usage();
|
|
@@ -23216,7 +23216,7 @@ function createDefaultGateOfficerSummon(options) {
|
|
|
23216
23216
|
};
|
|
23217
23217
|
}
|
|
23218
23218
|
function bookDirectOfficerPointer(context, officer, result, summoned) {
|
|
23219
|
-
if (result.status !== "
|
|
23219
|
+
if (result.status !== "converged" && result.status !== "continue" && result.status !== "escalate" && result.status !== "needs_reask" && result.status !== "transport_failure") {
|
|
23220
23220
|
return;
|
|
23221
23221
|
}
|
|
23222
23222
|
const parentFile = context.sessionManager?.getSessionFile?.();
|
|
@@ -23232,7 +23232,7 @@ function bookDirectOfficerPointer(context, officer, result, summoned) {
|
|
|
23232
23232
|
...typeof summoned.runDirectory === "string" && summoned.runDirectory.trim() !== "" ? { runDirectory: summoned.runDirectory } : {}
|
|
23233
23233
|
});
|
|
23234
23234
|
}
|
|
23235
|
-
async function
|
|
23235
|
+
async function requireSubmissionGate(options) {
|
|
23236
23236
|
let reask;
|
|
23237
23237
|
const summonOfficer = options.summonOfficer ?? createDefaultGateOfficerSummon({
|
|
23238
23238
|
cwd: options.context.cwd ?? process.cwd()
|
|
@@ -23259,8 +23259,17 @@ async function requireGatekeeperPass(options) {
|
|
|
23259
23259
|
options.hostActions.failInfrastructure(error, options.context, options.toolCallId);
|
|
23260
23260
|
}
|
|
23261
23261
|
}
|
|
23262
|
-
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") {
|
|
23263
23271
|
return {
|
|
23272
|
+
status: "continue",
|
|
23264
23273
|
officer: projected.officer,
|
|
23265
23274
|
receipt: gatekeeper.receipt,
|
|
23266
23275
|
...typeof gatekeeper.runId === "string" && gatekeeper.runId.trim() !== "" ? { runId: gatekeeper.runId } : {}
|
|
@@ -23413,18 +23422,18 @@ import { join as join44 } from "node:path";
|
|
|
23413
23422
|
import { Value as Value5 } from "typebox/value";
|
|
23414
23423
|
|
|
23415
23424
|
// src/activation-trace.ts
|
|
23416
|
-
import { Type as
|
|
23417
|
-
var causeSchema =
|
|
23418
|
-
identity:
|
|
23419
|
-
name:
|
|
23420
|
-
message:
|
|
23421
|
-
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 }))
|
|
23422
23431
|
}, { additionalProperties: false });
|
|
23423
|
-
var activationTraceRecordSchema =
|
|
23424
|
-
role:
|
|
23425
|
-
stageId:
|
|
23426
|
-
status:
|
|
23427
|
-
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" }),
|
|
23428
23437
|
cause: causeSchema
|
|
23429
23438
|
}, { additionalProperties: false });
|
|
23430
23439
|
var activationCauseEvidence = 0;
|
|
@@ -23579,28 +23588,28 @@ function writeStderrJsonlRecord(record4, write = writeSync) {
|
|
|
23579
23588
|
|
|
23580
23589
|
// src/tool-execution-observation.ts
|
|
23581
23590
|
import { writeSync as writeSync2 } from "node:fs";
|
|
23582
|
-
import { Type as
|
|
23591
|
+
import { Type as Type13 } from "typebox";
|
|
23583
23592
|
import { Value as Value3 } from "typebox/value";
|
|
23584
23593
|
var TOOL_EXECUTION_UPDATE_THROTTLE_MS = 3e4;
|
|
23585
23594
|
var observationBase = {
|
|
23586
|
-
role:
|
|
23587
|
-
toolCallId:
|
|
23588
|
-
toolName:
|
|
23589
|
-
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" })
|
|
23590
23599
|
};
|
|
23591
|
-
var toolExecutionObservationRecordSchema =
|
|
23592
|
-
|
|
23600
|
+
var toolExecutionObservationRecordSchema = Type13.Union([
|
|
23601
|
+
Type13.Object({
|
|
23593
23602
|
...observationBase,
|
|
23594
|
-
event:
|
|
23603
|
+
event: Type13.Literal("tool_execution_start")
|
|
23595
23604
|
}, { additionalProperties: true }),
|
|
23596
|
-
|
|
23605
|
+
Type13.Object({
|
|
23597
23606
|
...observationBase,
|
|
23598
|
-
event:
|
|
23607
|
+
event: Type13.Literal("tool_execution_update")
|
|
23599
23608
|
}, { additionalProperties: true }),
|
|
23600
|
-
|
|
23609
|
+
Type13.Object({
|
|
23601
23610
|
...observationBase,
|
|
23602
|
-
event:
|
|
23603
|
-
isError:
|
|
23611
|
+
event: Type13.Literal("tool_execution_end"),
|
|
23612
|
+
isError: Type13.Boolean()
|
|
23604
23613
|
}, { additionalProperties: true })
|
|
23605
23614
|
]);
|
|
23606
23615
|
function validateToolExecutionObservationRecord(record4) {
|
|
@@ -23697,10 +23706,10 @@ init_engine_material();
|
|
|
23697
23706
|
init_engine_detour();
|
|
23698
23707
|
init_engine_detour_usage();
|
|
23699
23708
|
init_run_terminal_artifacts();
|
|
23700
|
-
import { Type as
|
|
23701
|
-
var engineDetourArgsSchema =
|
|
23709
|
+
import { Type as Type14 } from "typebox";
|
|
23710
|
+
var engineDetourArgsSchema = Type14.Object(
|
|
23702
23711
|
{
|
|
23703
|
-
argv:
|
|
23712
|
+
argv: Type14.Array(Type14.String({ minLength: 1 }), {
|
|
23704
23713
|
minItems: 1,
|
|
23705
23714
|
description: "\u9996\u9879\u4E3A PATH \u4E2D\u7684\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u5176\u4F59\u9879\u4E3A\u53C2\u6570\u3002"
|
|
23706
23715
|
})
|
|
@@ -23847,63 +23856,63 @@ import { join as join42, sep as sep6 } from "node:path";
|
|
|
23847
23856
|
// src/collector-tool-schemas.ts
|
|
23848
23857
|
init_open_tool_schema();
|
|
23849
23858
|
init_terminating_infrastructure();
|
|
23850
|
-
import { Type as
|
|
23851
|
-
var collectorObserveArgsSchema =
|
|
23852
|
-
var collectorRequestArgsSchema =
|
|
23853
|
-
requestId:
|
|
23859
|
+
import { Type as Type15 } from "typebox";
|
|
23860
|
+
var collectorObserveArgsSchema = Type15.Object({}, { additionalProperties: true });
|
|
23861
|
+
var collectorRequestArgsSchema = Type15.Object({
|
|
23862
|
+
requestId: Type15.String({
|
|
23854
23863
|
minLength: 1,
|
|
23855
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"
|
|
23856
23865
|
}),
|
|
23857
|
-
snapshotId:
|
|
23866
|
+
snapshotId: Type15.String({ minLength: 1, description: "\u6700\u65B0\u7559\u5B58\u89C2\u5BDF\u5FEB\u7167" }),
|
|
23858
23867
|
// #836 r16 class 3: body.minLength deleted — manifest-configured requestId
|
|
23859
23868
|
// ignores body, and the unknown-requestId non-empty condition is a real
|
|
23860
23869
|
// branch in src/collector-ledger.ts:922-951, not a provider shape gate.
|
|
23861
|
-
body:
|
|
23870
|
+
body: Type15.Optional(Type15.String({
|
|
23862
23871
|
description: "\u89D2\u8272\u5224\u5B9A\u7684\u8BF7\u6C42\u6B63\u6587\uFF1Brequest-manifest \u672A\u6536\u5F55\u8BE5 requestId \u65F6\u5FC5\u586B"
|
|
23863
23872
|
}))
|
|
23864
23873
|
}, { additionalProperties: true });
|
|
23865
23874
|
var COLLECTOR_HANDBOOK_MAX_BYTES = 64 * 1024;
|
|
23866
|
-
var collectorHandbookWriteArgsSchema =
|
|
23867
|
-
scope:
|
|
23868
|
-
|
|
23869
|
-
|
|
23875
|
+
var collectorHandbookWriteArgsSchema = Type15.Object({
|
|
23876
|
+
scope: Type15.Union([
|
|
23877
|
+
Type15.Literal("general"),
|
|
23878
|
+
Type15.Literal("repo")
|
|
23870
23879
|
], { description: "general\uFF1D\u901A\u7528\u624B\u518C\uFF1Brepo\uFF1D\u5F53\u524D\u4ED3\u5E93\u5DEE\u5F02" }),
|
|
23871
|
-
body:
|
|
23880
|
+
body: Type15.String({
|
|
23872
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`
|
|
23873
23882
|
})
|
|
23874
23883
|
}, { additionalProperties: true });
|
|
23875
|
-
var collectorReadArgsSchema =
|
|
23876
|
-
evidenceId:
|
|
23884
|
+
var collectorReadArgsSchema = Type15.Object({
|
|
23885
|
+
evidenceId: Type15.String({ minLength: 1, description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u8BC1\u636E id\uFF08evidenceId\uFF09" })
|
|
23877
23886
|
}, { additionalProperties: true });
|
|
23878
|
-
var collectorWaitArgsSchema =
|
|
23879
|
-
durationMs:
|
|
23887
|
+
var collectorWaitArgsSchema = Type15.Object({
|
|
23888
|
+
durationMs: Type15.Integer({
|
|
23880
23889
|
minimum: 1,
|
|
23881
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"
|
|
23882
23891
|
})
|
|
23883
23892
|
}, { additionalProperties: true });
|
|
23884
|
-
var collectorOpenWaitWindowArgsSchema =
|
|
23885
|
-
startedAt:
|
|
23893
|
+
var collectorOpenWaitWindowArgsSchema = Type15.Object({
|
|
23894
|
+
startedAt: Type15.Optional(Type15.String({
|
|
23886
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"
|
|
23887
23896
|
}))
|
|
23888
23897
|
}, { additionalProperties: true });
|
|
23889
|
-
var collectorBindTargetArgsSchema =
|
|
23890
|
-
prNumber:
|
|
23898
|
+
var collectorBindTargetArgsSchema = Type15.Object({
|
|
23899
|
+
prNumber: Type15.Optional(Type15.Unknown({
|
|
23891
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"
|
|
23892
23901
|
})),
|
|
23893
|
-
issueNumber:
|
|
23902
|
+
issueNumber: Type15.Optional(Type15.Unknown({
|
|
23894
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"
|
|
23895
23904
|
}))
|
|
23896
23905
|
}, { additionalProperties: true });
|
|
23897
23906
|
var collectorFindingItemDeclaration = (() => {
|
|
23898
|
-
const item =
|
|
23907
|
+
const item = Type15.Object(
|
|
23899
23908
|
{
|
|
23900
|
-
evidenceId:
|
|
23909
|
+
evidenceId: Type15.Unknown({
|
|
23901
23910
|
description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u6307\u9488\uFF08\u5FC5\u586B\u8BED\u4E49\uFF09"
|
|
23902
23911
|
}),
|
|
23903
|
-
category:
|
|
23912
|
+
category: Type15.Unknown({
|
|
23904
23913
|
description: "\u7B80\u77ED\u5F52\u7C7B\u6807\u7B7E\uFF0C\u4E0D\u662F\u6458\u8981"
|
|
23905
23914
|
}),
|
|
23906
|
-
summary:
|
|
23915
|
+
summary: Type15.Unknown({
|
|
23907
23916
|
description: "\u54EA\u4E2A bot\u3001\u4EC0\u4E48\u95EE\u9898\u7684\u6458\u8981\uFF1B\u4E0D\u8A8A\u6284\u6B63\u6587"
|
|
23908
23917
|
})
|
|
23909
23918
|
},
|
|
@@ -23916,14 +23925,14 @@ var collectorFindingItemDeclaration = (() => {
|
|
|
23916
23925
|
return item;
|
|
23917
23926
|
})();
|
|
23918
23927
|
var collectorOutputBaseSchema = openToolObject(
|
|
23919
|
-
|
|
23928
|
+
Type15.Object({
|
|
23920
23929
|
// No root type:array — host must not shape-reject non-array findings (#676 C).
|
|
23921
23930
|
// Nested item declarations ride `items` for registration preservation (ADR 0057).
|
|
23922
|
-
findings:
|
|
23931
|
+
findings: Type15.Unsafe({
|
|
23923
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",
|
|
23924
23933
|
items: collectorFindingItemDeclaration
|
|
23925
23934
|
}),
|
|
23926
|
-
unfinishedReasons:
|
|
23935
|
+
unfinishedReasons: Type15.Unknown({
|
|
23927
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"
|
|
23928
23937
|
})
|
|
23929
23938
|
})
|
|
@@ -24553,7 +24562,6 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
24553
24562
|
// src/doctor-role.ts
|
|
24554
24563
|
init_audit_escalation();
|
|
24555
24564
|
init_compliance_transport();
|
|
24556
|
-
init_submission_errors();
|
|
24557
24565
|
init_dossier_resolution();
|
|
24558
24566
|
init_readable_gate_item();
|
|
24559
24567
|
init_doctor_contracts();
|
|
@@ -24615,7 +24623,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
|
|
|
24615
24623
|
host.failInfrastructure(error, ctx, id);
|
|
24616
24624
|
}
|
|
24617
24625
|
const acceptedDetails = testimony;
|
|
24618
|
-
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) => {
|
|
24619
24627
|
try {
|
|
24620
24628
|
appendCandidate(ctx, { version: 1, testimony, cost: active2.patient.cost, auditNoReceipt, readRecord: active2.store.readRecord(), patientIdentity: active2.patient.identity });
|
|
24621
24629
|
} catch (error) {
|
|
@@ -24624,9 +24632,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
|
|
|
24624
24632
|
return { content: [], details: acceptedDetails, terminate: true, ...usageProjection };
|
|
24625
24633
|
}, received: () => {
|
|
24626
24634
|
throw new Error("\u5BA1\u5211\u9662\u975E\u4E09\u6001\u5E94\u4EA4 runComplianceAudit \u91CD\u95EE\u8BF4\u8BDD\u8005");
|
|
24627
|
-
},
|
|
24628
|
-
throw new GatekeeperDecisionError({ status: "bounce", officer: "auditor", receipt: audit.status === "bounce" ? audit.receipt ?? violations : violations });
|
|
24629
|
-
}, 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) => {
|
|
24630
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);
|
|
24631
24637
|
} }, acceptedDetails);
|
|
24632
24638
|
} });
|
|
@@ -24724,7 +24730,7 @@ function createNotaryRoleRuntime(pi, dependencies, host) {
|
|
|
24724
24730
|
pi.registerTool({
|
|
24725
24731
|
name: NOTARY_OUTPUT_TOOL_NAME,
|
|
24726
24732
|
label: "\u7B26\u5B9D\u90CE\u8F93\u51FA",
|
|
24727
|
-
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",
|
|
24728
24734
|
promptSnippet: "\u63D0\u4EA4\u7B26\u5B9D\u90CE\u51B3\u8BAE",
|
|
24729
24735
|
parameters: notaryOutputSchema,
|
|
24730
24736
|
async execute(toolCallId, parameters, _signal, _onUpdate, ctx) {
|
|
@@ -24768,36 +24774,10 @@ function createNotaryRoleRuntime(pi, dependencies, host) {
|
|
|
24768
24774
|
init_notary_contracts();
|
|
24769
24775
|
|
|
24770
24776
|
// src/countersign-role.ts
|
|
24771
|
-
|
|
24777
|
+
init_review_submission();
|
|
24772
24778
|
init_countersign_contracts();
|
|
24773
24779
|
init_countersign_contracts();
|
|
24774
|
-
|
|
24775
|
-
var countersignVerdictSchema = withTerminatingOutputDeclarations(
|
|
24776
|
-
Type17.Object(
|
|
24777
|
-
{
|
|
24778
|
-
countersignStatus: Type17.Unknown({ description: "converged | continue | escalate\u3002\u975E\u4E09\u6001\u65F6\u8BF7\u91CD\u8BFB\u540E\u91CD\u4EA4\uFF0C\u52FF\u6539\u6807\u3002" }),
|
|
24779
|
-
fix: Type17.Optional(
|
|
24780
|
-
Type17.Object(
|
|
24781
|
-
{ summary: Type17.Optional(Type17.String({ description: "\u9000\u56DE\u6458\u8981" })) },
|
|
24782
|
-
{ additionalProperties: true, description: "\u9000\u56DE\u8BF4\u660E" }
|
|
24783
|
-
)
|
|
24784
|
-
),
|
|
24785
|
-
note: Type17.Optional(Type17.String({ description: "\u9644\u6CE8" })),
|
|
24786
|
-
evidence: Type17.Optional(Type17.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
24787
|
-
decisionGate: Type17.Optional(
|
|
24788
|
-
Type17.Object(
|
|
24789
|
-
{
|
|
24790
|
-
question: Type17.Optional(Type17.String()),
|
|
24791
|
-
options: Type17.Optional(Type17.Array(Type17.String()))
|
|
24792
|
-
},
|
|
24793
|
-
{ additionalProperties: true, description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
24794
|
-
)
|
|
24795
|
-
)
|
|
24796
|
-
},
|
|
24797
|
-
{ additionalProperties: true }
|
|
24798
|
-
)
|
|
24799
|
-
);
|
|
24800
|
-
countersignVerdictSchema.required = [];
|
|
24780
|
+
var countersignVerdictSchema = reviewSubmissionSchema;
|
|
24801
24781
|
var COUNTERSIGN_TOOL_SPEC = {
|
|
24802
24782
|
name: COUNTERSIGN_OUTPUT_TOOL_NAME,
|
|
24803
24783
|
label: "\u7ED9\u4E8B\u4E2D\u8F93\u51FA",
|
|
@@ -24811,18 +24791,18 @@ init_open_tool_schema();
|
|
|
24811
24791
|
init_terminating_infrastructure();
|
|
24812
24792
|
init_gleaner_left_contracts();
|
|
24813
24793
|
init_gleaner_left_contracts();
|
|
24814
|
-
import { Type as
|
|
24794
|
+
import { Type as Type16 } from "typebox";
|
|
24815
24795
|
var gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
|
|
24816
24796
|
openToolObject(
|
|
24817
|
-
|
|
24818
|
-
status:
|
|
24797
|
+
Type16.Object({
|
|
24798
|
+
status: Type16.Unknown({
|
|
24819
24799
|
description: "completed \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
24820
24800
|
}),
|
|
24821
|
-
findings:
|
|
24822
|
-
|
|
24801
|
+
findings: Type16.Array(
|
|
24802
|
+
Type16.Object(
|
|
24823
24803
|
{
|
|
24824
|
-
pointer:
|
|
24825
|
-
statement:
|
|
24804
|
+
pointer: Type16.Optional(Type16.String({ description: "\u6587\u4EF6/\u884C\u6307\u9488" })),
|
|
24805
|
+
statement: Type16.Optional(Type16.String({ description: "\u7591\u70B9\u9648\u8FF0" }))
|
|
24826
24806
|
},
|
|
24827
24807
|
{ additionalProperties: true, description: "\u4E00\u6761\u5F39\u7AE0" }
|
|
24828
24808
|
),
|
|
@@ -24843,29 +24823,13 @@ var GLEANER_LEFT_TOOL_SPEC = {
|
|
|
24843
24823
|
init_gleaner_left_contracts();
|
|
24844
24824
|
|
|
24845
24825
|
// src/inspector-role.ts
|
|
24846
|
-
|
|
24847
|
-
init_terminating_infrastructure();
|
|
24826
|
+
init_review_submission();
|
|
24848
24827
|
init_inspector_contracts();
|
|
24849
|
-
|
|
24850
|
-
var inspectorOutputSchema = withTerminatingOutputDeclarations(
|
|
24851
|
-
openToolObject(
|
|
24852
|
-
Type19.Object({
|
|
24853
|
-
status: Type19.Unknown({
|
|
24854
|
-
description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
24855
|
-
}),
|
|
24856
|
-
findings: Type19.Unknown({
|
|
24857
|
-
description: "\u968F\u4EA4\u5377\u7559\u5B58\u7684\u95EE\u9898\u8BB0\u5F55"
|
|
24858
|
-
}),
|
|
24859
|
-
reason: Type19.Optional(Type19.Unknown({
|
|
24860
|
-
description: "status \u4E3A escalate \u65F6\u7684\u4E0A\u5448\u7406\u7531"
|
|
24861
|
-
}))
|
|
24862
|
-
})
|
|
24863
|
-
)
|
|
24864
|
-
);
|
|
24828
|
+
var inspectorOutputSchema = reviewSubmissionSchema;
|
|
24865
24829
|
var INSPECTOR_TOOL_SPEC = {
|
|
24866
24830
|
name: INSPECTOR_OUTPUT_TOOL_NAME,
|
|
24867
24831
|
label: "\u53F0\u9662\u8F93\u51FA",
|
|
24868
|
-
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",
|
|
24869
24833
|
promptSnippet: "\u53F0\u9662\u7EC8\u5C40\u56DE\u6267",
|
|
24870
24834
|
parameters: inspectorOutputSchema
|
|
24871
24835
|
};
|
|
@@ -24878,44 +24842,44 @@ init_open_tool_schema();
|
|
|
24878
24842
|
init_terminating_infrastructure();
|
|
24879
24843
|
init_diarist_contracts();
|
|
24880
24844
|
init_diarist_contracts();
|
|
24881
|
-
import { Type as
|
|
24845
|
+
import { Type as Type17 } from "typebox";
|
|
24882
24846
|
var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
24883
24847
|
openToolObject(
|
|
24884
|
-
|
|
24885
|
-
status:
|
|
24848
|
+
Type17.Object({
|
|
24849
|
+
status: Type17.Unknown({
|
|
24886
24850
|
description: "completed | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
24887
24851
|
}),
|
|
24888
|
-
ticketNumber:
|
|
24889
|
-
|
|
24852
|
+
ticketNumber: Type17.Optional(
|
|
24853
|
+
Type17.Unknown({
|
|
24890
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"
|
|
24891
24855
|
})
|
|
24892
24856
|
),
|
|
24893
|
-
courtTicketNumbers:
|
|
24894
|
-
|
|
24857
|
+
courtTicketNumbers: Type17.Optional(
|
|
24858
|
+
Type17.Unknown({
|
|
24895
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"
|
|
24896
24860
|
})
|
|
24897
24861
|
),
|
|
24898
|
-
reason:
|
|
24899
|
-
|
|
24862
|
+
reason: Type17.Optional(
|
|
24863
|
+
Type17.String({
|
|
24900
24864
|
description: "status \u4E3A escalate \u65F6\uFF1A\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u7684\u539F\u56E0"
|
|
24901
24865
|
})
|
|
24902
24866
|
),
|
|
24903
|
-
sessions:
|
|
24904
|
-
|
|
24905
|
-
|
|
24867
|
+
sessions: Type17.Optional(
|
|
24868
|
+
Type17.Array(
|
|
24869
|
+
Type17.Object(
|
|
24906
24870
|
{
|
|
24907
|
-
path:
|
|
24908
|
-
|
|
24871
|
+
path: Type17.Optional(
|
|
24872
|
+
Type17.String({ description: "\u4F1A\u8BDD\u5377\u7EDD\u5BF9\u6216\u53EF\u8BFB\u8DEF\u5F84" })
|
|
24909
24873
|
),
|
|
24910
|
-
ranges:
|
|
24911
|
-
|
|
24912
|
-
|
|
24874
|
+
ranges: Type17.Optional(
|
|
24875
|
+
Type17.Array(
|
|
24876
|
+
Type17.Object(
|
|
24913
24877
|
{
|
|
24914
|
-
from:
|
|
24915
|
-
|
|
24878
|
+
from: Type17.Optional(
|
|
24879
|
+
Type17.Object(
|
|
24916
24880
|
{
|
|
24917
|
-
id:
|
|
24918
|
-
line:
|
|
24881
|
+
id: Type17.Optional(Type17.String()),
|
|
24882
|
+
line: Type17.Optional(Type17.Unknown())
|
|
24919
24883
|
},
|
|
24920
24884
|
{
|
|
24921
24885
|
additionalProperties: true,
|
|
@@ -24923,11 +24887,11 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
|
24923
24887
|
}
|
|
24924
24888
|
)
|
|
24925
24889
|
),
|
|
24926
|
-
to:
|
|
24927
|
-
|
|
24890
|
+
to: Type17.Optional(
|
|
24891
|
+
Type17.Object(
|
|
24928
24892
|
{
|
|
24929
|
-
id:
|
|
24930
|
-
line:
|
|
24893
|
+
id: Type17.Optional(Type17.String()),
|
|
24894
|
+
line: Type17.Optional(Type17.Unknown())
|
|
24931
24895
|
},
|
|
24932
24896
|
{
|
|
24933
24897
|
additionalProperties: true,
|
|
@@ -24964,23 +24928,23 @@ var DIARIST_TOOL_SPEC = {
|
|
|
24964
24928
|
init_terminating_infrastructure();
|
|
24965
24929
|
init_secretariat_contracts();
|
|
24966
24930
|
init_secretariat_contracts();
|
|
24967
|
-
import { Type as
|
|
24931
|
+
import { Type as Type18 } from "typebox";
|
|
24968
24932
|
var secretariatVerdictSchema = withTerminatingOutputDeclarations(
|
|
24969
|
-
|
|
24933
|
+
Type18.Object(
|
|
24970
24934
|
{
|
|
24971
|
-
secretariatStatus:
|
|
24935
|
+
secretariatStatus: Type18.Unknown({
|
|
24972
24936
|
description: "converged | escalate\uFF08\u7EC8\u5C40\u5F62\u72B6\u6307\u5F15\uFF0C\u975E\u95F8\uFF09"
|
|
24973
24937
|
}),
|
|
24974
|
-
ticketNumber:
|
|
24975
|
-
|
|
24938
|
+
ticketNumber: Type18.Optional(
|
|
24939
|
+
Type18.Number({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
|
|
24976
24940
|
),
|
|
24977
|
-
note:
|
|
24978
|
-
evidence:
|
|
24979
|
-
decisionGate:
|
|
24980
|
-
|
|
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(
|
|
24981
24945
|
{
|
|
24982
|
-
question:
|
|
24983
|
-
options:
|
|
24946
|
+
question: Type18.Optional(Type18.String()),
|
|
24947
|
+
options: Type18.Optional(Type18.Array(Type18.String()))
|
|
24984
24948
|
},
|
|
24985
24949
|
{ additionalProperties: true, description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
24986
24950
|
)
|
|
@@ -25039,7 +25003,7 @@ init_auditor_output();
|
|
|
25039
25003
|
var AUDITOR_TOOL_SPEC = {
|
|
25040
25004
|
name: AUDITOR_OUTPUT_TOOL_NAME,
|
|
25041
25005
|
label: "\u5BA1\u5211\u9662\u8F93\u51FA",
|
|
25042
|
-
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\
|
|
25006
|
+
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\uFF0Cstatus \u4E3A converged\u3001continue \u6216 escalate\u3002",
|
|
25043
25007
|
promptSnippet: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267",
|
|
25044
25008
|
parameters: auditorOutputSchema
|
|
25045
25009
|
};
|
|
@@ -25051,14 +25015,14 @@ init_packaged_role_registry();
|
|
|
25051
25015
|
init_activation_ledger_topology();
|
|
25052
25016
|
import { resolve as resolve17 } from "node:path";
|
|
25053
25017
|
import "@earendil-works/pi-coding-agent";
|
|
25054
|
-
import { Type as
|
|
25018
|
+
import { Type as Type20 } from "typebox";
|
|
25055
25019
|
|
|
25056
25020
|
// src/navigator-public-session.ts
|
|
25057
25021
|
init_sitian_facade();
|
|
25058
25022
|
import { basename as basename11 } from "node:path";
|
|
25059
25023
|
|
|
25060
25024
|
// src/navigator-session-contracts.ts
|
|
25061
|
-
import { Type as
|
|
25025
|
+
import { Type as Type19 } from "typebox";
|
|
25062
25026
|
import { Value as Value4 } from "typebox/value";
|
|
25063
25027
|
var NAVIGATOR_PREPARE_TOOL_NAME = "ak_navigator_prepare";
|
|
25064
25028
|
var NAVIGATOR_UNAVAILABLE_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -25166,26 +25130,26 @@ function navigatorProviderFailureFromPublicTerminal(outcome) {
|
|
|
25166
25130
|
if (typed !== void 0) return { source: typed, cause: typed };
|
|
25167
25131
|
return { source: "unknown", cause: "unknown" };
|
|
25168
25132
|
}
|
|
25169
|
-
var navigatorProviderFailureSchema =
|
|
25170
|
-
source:
|
|
25171
|
-
|
|
25172
|
-
|
|
25173
|
-
|
|
25174
|
-
|
|
25175
|
-
|
|
25176
|
-
|
|
25177
|
-
|
|
25178
|
-
|
|
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")
|
|
25179
25143
|
]),
|
|
25180
|
-
cause:
|
|
25181
|
-
|
|
25182
|
-
|
|
25183
|
-
|
|
25184
|
-
|
|
25185
|
-
|
|
25186
|
-
|
|
25187
|
-
|
|
25188
|
-
|
|
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")
|
|
25189
25153
|
])
|
|
25190
25154
|
}, { additionalProperties: false });
|
|
25191
25155
|
function parseNavigatorModelSetting(value) {
|
|
@@ -25452,8 +25416,8 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
|
|
|
25452
25416
|
return void 0;
|
|
25453
25417
|
}
|
|
25454
25418
|
var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
|
|
25455
|
-
var prepareSchema =
|
|
25456
|
-
prose:
|
|
25419
|
+
var prepareSchema = Type20.Object({
|
|
25420
|
+
prose: Type20.Optional(Type20.Unknown({
|
|
25457
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"
|
|
25458
25422
|
}))
|
|
25459
25423
|
}, { additionalProperties: true });
|
|
@@ -26014,46 +25978,14 @@ init_packaged_role_registry();
|
|
|
26014
25978
|
init_audit_escalation();
|
|
26015
25979
|
|
|
26016
25980
|
// src/judge-role.ts
|
|
26017
|
-
|
|
25981
|
+
init_review_submission();
|
|
26018
25982
|
init_submission_errors();
|
|
26019
25983
|
init_audit_escalation();
|
|
26020
25984
|
init_readable_gate_item();
|
|
26021
25985
|
init_judge_output();
|
|
26022
|
-
import { Type as Type24 } from "typebox";
|
|
26023
25986
|
var JUDGE_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "continue", "escalate"]);
|
|
26024
|
-
var JUDGE_STATUS_REASK = "
|
|
26025
|
-
var judgeVerdictSchema =
|
|
26026
|
-
Type24.Object(
|
|
26027
|
-
{
|
|
26028
|
-
judgeStatus: Type24.Unknown({ description: "converged | continue | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }),
|
|
26029
|
-
fix: Type24.Optional(
|
|
26030
|
-
Type24.Object(
|
|
26031
|
-
{ summary: Type24.Optional(Type24.String({ description: "continue \u65F6\u7684\u8865\u6551\u6458\u8981" })) },
|
|
26032
|
-
{ additionalProperties: true, description: "continue \u65F6\u7684\u8865\u6551\u8BF4\u660E" }
|
|
26033
|
-
)
|
|
26034
|
-
),
|
|
26035
|
-
classes: Type24.Optional(Type24.Array(Type24.Object({
|
|
26036
|
-
name: Type24.Optional(Type24.String()),
|
|
26037
|
-
owner: Type24.Optional(Type24.String()),
|
|
26038
|
-
boundary: Type24.Optional(Type24.String()),
|
|
26039
|
-
disposition: Type24.Optional(Type24.String())
|
|
26040
|
-
}, { additionalProperties: true }), { description: "\u5DF2\u88C1\u51B3 finding \u7C7B\u53CA\u5176 owner \u4E0E\u4FEE\u7406\u8FB9\u754C" })),
|
|
26041
|
-
note: Type24.Optional(Type24.String({ description: "\u53EF\u9009\u88C1\u51B3\u9644\u6CE8" })),
|
|
26042
|
-
evidence: Type24.Optional(Type24.Unknown({ description: "\u7559\u5B58\u7684\u88C1\u51B3\u8BC1\u636E" })),
|
|
26043
|
-
decisionGate: Type24.Optional(
|
|
26044
|
-
Type24.Object(
|
|
26045
|
-
{
|
|
26046
|
-
question: Type24.Optional(Type24.String()),
|
|
26047
|
-
options: Type24.Optional(Type24.Array(Type24.String()))
|
|
26048
|
-
},
|
|
26049
|
-
{ additionalProperties: true, description: "\u9700\u4EBA\u6743\u5A01\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
26050
|
-
)
|
|
26051
|
-
)
|
|
26052
|
-
},
|
|
26053
|
-
{ additionalProperties: true }
|
|
26054
|
-
)
|
|
26055
|
-
);
|
|
26056
|
-
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;
|
|
26057
25989
|
function validateVerdict(verdict) {
|
|
26058
25990
|
return validateAcceptedJudgeDetails(verdict);
|
|
26059
25991
|
}
|
|
@@ -26074,7 +26006,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26074
26006
|
parameters: judgeVerdictSchema,
|
|
26075
26007
|
async execute(toolCallId, parameters, signal, _onUpdate, ctx) {
|
|
26076
26008
|
if (soul === void 0) throw new Error("\u5927\u7406\u5BFA\u804C\u5206\u672A\u88C5\u8F7D");
|
|
26077
|
-
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;
|
|
26078
26010
|
if (rawStatus === void 0 || !JUDGE_QUEUE_STATUSES.has(rawStatus)) {
|
|
26079
26011
|
throw new ParentQueueReaskError(JUDGE_STATUS_REASK);
|
|
26080
26012
|
}
|
|
@@ -26089,7 +26021,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26089
26021
|
const verdict = validateVerdict(parameters);
|
|
26090
26022
|
let draftPass;
|
|
26091
26023
|
try {
|
|
26092
|
-
const obtainedDraftPass = await pi.
|
|
26024
|
+
const obtainedDraftPass = await pi.requireSubmissionGate({
|
|
26093
26025
|
context: ctx,
|
|
26094
26026
|
subject: { kind: "judge_draft" },
|
|
26095
26027
|
...signal === void 0 ? {} : { signal },
|
|
@@ -26099,8 +26031,15 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26099
26031
|
submission: parameters
|
|
26100
26032
|
});
|
|
26101
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
|
+
}
|
|
26102
26041
|
if (draftPass !== void 0) hostActions.bindPriorGatePass(toolCallId, draftPass.receipt);
|
|
26103
|
-
const compliancePass = await pi.
|
|
26042
|
+
const compliancePass = await pi.requireSubmissionGate({
|
|
26104
26043
|
context: ctx,
|
|
26105
26044
|
subject: { kind: "judge_compliance" },
|
|
26106
26045
|
...signal === void 0 ? {} : { signal },
|
|
@@ -26109,6 +26048,13 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26109
26048
|
// #879: same parent payload for 审刑院; not recovered from session latest.
|
|
26110
26049
|
submission: parameters
|
|
26111
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
|
+
}
|
|
26112
26058
|
return {
|
|
26113
26059
|
content: [draftPass, compliancePass].filter((pass) => pass !== void 0).map((pass) => ({ type: "text", text: readableGateItem(pass.receipt) })),
|
|
26114
26060
|
details: verdict,
|
|
@@ -26141,12 +26087,12 @@ ${soul}
|
|
|
26141
26087
|
init_open_tool_schema();
|
|
26142
26088
|
init_terminating_infrastructure();
|
|
26143
26089
|
init_reviewer_output();
|
|
26144
|
-
import { Type as
|
|
26145
|
-
var reviewerAmendmentsSchema =
|
|
26146
|
-
completeness:
|
|
26090
|
+
import { Type as Type21 } from "typebox";
|
|
26091
|
+
var reviewerAmendmentsSchema = Type21.Object({
|
|
26092
|
+
completeness: Type21.Optional(Type21.String({
|
|
26147
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"
|
|
26148
26094
|
})),
|
|
26149
|
-
correctness:
|
|
26095
|
+
correctness: Type21.Optional(Type21.String({
|
|
26150
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"
|
|
26151
26097
|
}))
|
|
26152
26098
|
}, {
|
|
@@ -26154,15 +26100,15 @@ var reviewerAmendmentsSchema = Type25.Object({
|
|
|
26154
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"
|
|
26155
26101
|
});
|
|
26156
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";
|
|
26157
|
-
var reviewerOutputVariants =
|
|
26158
|
-
|
|
26159
|
-
status:
|
|
26160
|
-
amendments:
|
|
26103
|
+
var reviewerOutputVariants = Type21.Union([
|
|
26104
|
+
Type21.Object({
|
|
26105
|
+
status: Type21.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
|
|
26106
|
+
amendments: Type21.Optional(reviewerAmendmentsSchema)
|
|
26161
26107
|
}, { additionalProperties: false }),
|
|
26162
|
-
|
|
26163
|
-
status:
|
|
26164
|
-
diagnostic:
|
|
26165
|
-
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)
|
|
26166
26112
|
}, { additionalProperties: false })
|
|
26167
26113
|
]);
|
|
26168
26114
|
var reviewerOutputSchema = withTerminatingOutputDeclarations(
|
|
@@ -26221,7 +26167,7 @@ init_submission_errors();
|
|
|
26221
26167
|
init_worker_output();
|
|
26222
26168
|
init_fixer_output();
|
|
26223
26169
|
init_fixer_packet();
|
|
26224
|
-
import { Type as
|
|
26170
|
+
import { Type as Type22 } from "typebox";
|
|
26225
26171
|
|
|
26226
26172
|
// src/worker-submission-gates.ts
|
|
26227
26173
|
init_archivist_record_entry();
|
|
@@ -26486,20 +26432,20 @@ function fixerBashSeatbeltDenyReason(matched) {
|
|
|
26486
26432
|
|
|
26487
26433
|
// src/worker-role.ts
|
|
26488
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";
|
|
26489
|
-
var coderOutputVariants =
|
|
26490
|
-
|
|
26491
|
-
status:
|
|
26492
|
-
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" })
|
|
26493
26439
|
}, { additionalProperties: false }),
|
|
26494
|
-
|
|
26495
|
-
status:
|
|
26496
|
-
report:
|
|
26440
|
+
Type22.Object({
|
|
26441
|
+
status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26442
|
+
report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
|
|
26497
26443
|
}, { additionalProperties: false }),
|
|
26498
|
-
|
|
26499
|
-
status:
|
|
26500
|
-
report:
|
|
26501
|
-
remainingScope:
|
|
26502
|
-
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({
|
|
26503
26449
|
minLength: 1,
|
|
26504
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"
|
|
26505
26451
|
}))
|
|
@@ -26629,7 +26575,7 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26629
26575
|
);
|
|
26630
26576
|
let pass;
|
|
26631
26577
|
try {
|
|
26632
|
-
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.
|
|
26578
|
+
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.requireSubmissionGate({
|
|
26633
26579
|
context: ctx,
|
|
26634
26580
|
subject: { kind: "worker_completion" },
|
|
26635
26581
|
..._signal === void 0 ? {} : { signal: _signal },
|
|
@@ -26644,6 +26590,13 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26644
26590
|
}
|
|
26645
26591
|
throw error;
|
|
26646
26592
|
}
|
|
26593
|
+
if (pass?.status === "continue") {
|
|
26594
|
+
return {
|
|
26595
|
+
content: [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
26596
|
+
details: output,
|
|
26597
|
+
terminate: false
|
|
26598
|
+
};
|
|
26599
|
+
}
|
|
26647
26600
|
const acceptedDetails = output;
|
|
26648
26601
|
return {
|
|
26649
26602
|
content: pass === void 0 ? [] : [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
@@ -26773,7 +26726,7 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26773
26726
|
);
|
|
26774
26727
|
let pass;
|
|
26775
26728
|
try {
|
|
26776
|
-
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.
|
|
26729
|
+
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.requireSubmissionGate({
|
|
26777
26730
|
context: ctx2,
|
|
26778
26731
|
subject: { kind: "worker_completion" },
|
|
26779
26732
|
..._signal === void 0 ? {} : { signal: _signal },
|
|
@@ -26788,6 +26741,13 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26788
26741
|
}
|
|
26789
26742
|
throw error;
|
|
26790
26743
|
}
|
|
26744
|
+
if (pass?.status === "continue") {
|
|
26745
|
+
return {
|
|
26746
|
+
content: [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
26747
|
+
details: output,
|
|
26748
|
+
terminate: false
|
|
26749
|
+
};
|
|
26750
|
+
}
|
|
26791
26751
|
const acceptedDetails = output;
|
|
26792
26752
|
return {
|
|
26793
26753
|
content: pass === void 0 ? [] : [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
@@ -27195,6 +27155,13 @@ function createFiledOfficerRuntime(roleHost, spec, dependencies) {
|
|
|
27195
27155
|
if (isAuditEscalationProjection(projected)) {
|
|
27196
27156
|
return { content: [], details: projected, terminate: true };
|
|
27197
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
|
+
}
|
|
27198
27165
|
const pass = spec.relayGatePass === true && projected !== null && typeof projected === "object" && "officer" in projected && "receipt" in projected ? projected : void 0;
|
|
27199
27166
|
return {
|
|
27200
27167
|
content: pass === void 0 || pass.receipt === void 0 ? [] : [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
@@ -27387,12 +27354,12 @@ ${error.message}`
|
|
|
27387
27354
|
);
|
|
27388
27355
|
}
|
|
27389
27356
|
var COUNTERSIGN_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "continue", "escalate"]);
|
|
27390
|
-
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";
|
|
27391
27358
|
var SECRETARIAT_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "escalate"]);
|
|
27392
27359
|
var SECRETARIAT_STATUS_REASK = "secretariatStatus \u4E0D\u662F converged\u3001escalate \u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
27393
27360
|
function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
27394
27361
|
const beforeAccept = hostActions !== void 0 ? async ({ toolCallId, parameters, signal, ctx }) => {
|
|
27395
|
-
if (roleHost.
|
|
27362
|
+
if (roleHost.requireSubmissionGate === void 0) {
|
|
27396
27363
|
const error = new Error("host cannot mount the secretariat submission gate");
|
|
27397
27364
|
error.name = "InfrastructureFailure";
|
|
27398
27365
|
return hostActions.failInfrastructure(error, ctx, toolCallId);
|
|
@@ -27406,7 +27373,7 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27406
27373
|
return void 0;
|
|
27407
27374
|
}
|
|
27408
27375
|
try {
|
|
27409
|
-
const pass = await roleHost.
|
|
27376
|
+
const pass = await roleHost.requireSubmissionGate({
|
|
27410
27377
|
context: ctx,
|
|
27411
27378
|
subject: { kind: "secretariat_verdict" },
|
|
27412
27379
|
...signal === void 0 ? {} : { signal },
|
|
@@ -27415,7 +27382,7 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27415
27382
|
// #879: this-turn typed payload — identity-bound at submit site.
|
|
27416
27383
|
submission: parameters
|
|
27417
27384
|
});
|
|
27418
|
-
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) {
|
|
27419
27386
|
const {
|
|
27420
27387
|
SECRETARIAT_GATE_OFFICER_ENTRY_TYPE: SECRETARIAT_GATE_OFFICER_ENTRY_TYPE2
|
|
27421
27388
|
} = await Promise.resolve().then(() => (init_secretariat_contracts(), secretariat_contracts_exports));
|
|
@@ -27493,20 +27460,20 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27493
27460
|
function createCountersignRoleRuntime(roleHost, dependencies, hostActions) {
|
|
27494
27461
|
const beforeAccept = hostActions !== void 0 ? async ({ toolCallId, parameters, signal, ctx }) => {
|
|
27495
27462
|
const record4 = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) ? parameters : void 0;
|
|
27496
|
-
const status = record4 !== void 0 && typeof record4.
|
|
27463
|
+
const status = record4 !== void 0 && typeof record4.status === "string" ? record4.status : void 0;
|
|
27497
27464
|
if (status === void 0 || !COUNTERSIGN_QUEUE_STATUSES.has(status)) {
|
|
27498
27465
|
throw new ParentQueueReaskError(COUNTERSIGN_STATUS_REASK);
|
|
27499
27466
|
}
|
|
27500
27467
|
if (status === "escalate") {
|
|
27501
27468
|
return void 0;
|
|
27502
27469
|
}
|
|
27503
|
-
if (roleHost.
|
|
27470
|
+
if (roleHost.requireSubmissionGate === void 0) {
|
|
27504
27471
|
const error = new Error("host cannot mount the countersign gate");
|
|
27505
27472
|
error.name = "InfrastructureFailure";
|
|
27506
27473
|
return hostActions.failInfrastructure(error, ctx, toolCallId);
|
|
27507
27474
|
}
|
|
27508
27475
|
try {
|
|
27509
|
-
return await roleHost.
|
|
27476
|
+
return await roleHost.requireSubmissionGate({
|
|
27510
27477
|
context: ctx,
|
|
27511
27478
|
subject: { kind: "countersign_verdict" },
|
|
27512
27479
|
...signal === void 0 ? {} : { signal },
|
|
@@ -27557,7 +27524,15 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27557
27524
|
};
|
|
27558
27525
|
const roleHost = createSubmissionLedgerHost(
|
|
27559
27526
|
envelopeHost.host,
|
|
27560
|
-
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
|
+
}, [])),
|
|
27561
27536
|
failInfrastructure,
|
|
27562
27537
|
async (closed, context) => projectClosedSubmission(closed, context)
|
|
27563
27538
|
);
|
|
@@ -28560,9 +28535,9 @@ async function prepareRoleEnvelope(options) {
|
|
|
28560
28535
|
getActiveTools() {
|
|
28561
28536
|
return [...preferredTools];
|
|
28562
28537
|
},
|
|
28563
|
-
async
|
|
28538
|
+
async requireSubmissionGate(gateOptions) {
|
|
28564
28539
|
const packageRoot = typeof options.dependencies.packageRoot === "string" ? options.dependencies.packageRoot : void 0;
|
|
28565
|
-
return
|
|
28540
|
+
return requireSubmissionGate({
|
|
28566
28541
|
context: gateOptions.context,
|
|
28567
28542
|
subject: gateOptions.subject,
|
|
28568
28543
|
...gateOptions.signal === void 0 ? {} : { signal: gateOptions.signal },
|
|
@@ -28616,7 +28591,7 @@ async function prepareRoleEnvelope(options) {
|
|
|
28616
28591
|
const record4 = details;
|
|
28617
28592
|
if (record4.cause === "infrastructure") return;
|
|
28618
28593
|
if (record4.kind === "role_infrastructure_failure") return;
|
|
28619
|
-
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;
|
|
28620
28595
|
if (code === void 0) return;
|
|
28621
28596
|
rejection = {
|
|
28622
28597
|
code,
|
|
@@ -28625,7 +28600,7 @@ async function prepareRoleEnvelope(options) {
|
|
|
28625
28600
|
};
|
|
28626
28601
|
}
|
|
28627
28602
|
function textDiagnostic(content) {
|
|
28628
|
-
const text = content.
|
|
28603
|
+
const text = content.filter((part) => part.type === "text").map((part) => part.text).join("\n\n");
|
|
28629
28604
|
return text.trim().length > 0 ? text : void 0;
|
|
28630
28605
|
}
|
|
28631
28606
|
function rememberInfrastructureFailure(details, content) {
|
|
@@ -28742,6 +28717,13 @@ async function prepareRoleEnvelope(options) {
|
|
|
28742
28717
|
details: result.details,
|
|
28743
28718
|
isError: false
|
|
28744
28719
|
});
|
|
28720
|
+
if (result.terminate === false) {
|
|
28721
|
+
rejection = {
|
|
28722
|
+
code: "continue",
|
|
28723
|
+
toolCallIds: [toolCallId],
|
|
28724
|
+
message: textDiagnostic(projected.content) ?? "continue"
|
|
28725
|
+
};
|
|
28726
|
+
}
|
|
28745
28727
|
return { content: projected.content, isError: projected.isError };
|
|
28746
28728
|
} catch (error) {
|
|
28747
28729
|
let content;
|