@akagilnc/pi-workflow-roles 0.1.3644 → 0.1.3652
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 +3089 -2187
- package/dist/activation-ledger-session.js +105 -0
- package/dist/activation-ledger.js +139 -0
- package/dist/activation-trace.js +33 -0
- package/dist/agent-start-materials.js +11 -0
- package/dist/audit-escalation.js +5 -5
- package/dist/auditor-role.js +12 -0
- package/dist/canonical-skill-binding.js +64 -0
- package/dist/collector-identity.js +151 -0
- package/dist/collector-receipt.js +95 -0
- package/dist/collector-role.js +441 -0
- package/dist/compliance-transport.js +11 -57
- package/dist/countersign-role.js +28 -0
- package/dist/diarist-contracts.js +0 -12
- package/dist/diarist-role.js +29 -0
- package/dist/doctor-contracts.js +0 -2
- package/dist/doctor-role.js +74 -0
- package/dist/fixer-bash-seatbelt.js +13 -0
- package/dist/gatekeeper-pass-envelope.js +72 -0
- package/dist/gleaner-left-contracts.js +0 -7
- package/dist/gleaner-left-role.js +26 -0
- package/dist/inspector-contracts.js +0 -4
- package/dist/inspector-role.js +29 -0
- package/dist/judge-role.js +106 -0
- package/dist/merger-role.js +66 -0
- package/dist/navigator-public-session.js +1 -5
- package/dist/navigator-role.js +12 -0
- package/dist/notary-contracts.js +0 -18
- package/dist/notary-role.js +137 -0
- package/dist/oauth-keepalive.js +158 -0
- package/dist/package-contracts/auditor-output.js +0 -13
- package/dist/package-contracts/gatekeeper-output.js +0 -10
- package/dist/package-contracts/judge-output.js +0 -2
- package/dist/package-contracts/navigator-output.js +0 -4
- package/dist/package-contracts/terminating-tools.js +2 -16
- package/dist/packaged-role-registry.js +1 -18
- package/dist/pi/adapter.js +211 -0
- package/dist/pi/role-turn-host.js +0 -2
- package/dist/public-cli/instruction-seat-run.js +2 -6
- package/dist/public-cli/invocation.js +0 -7
- package/dist/public-cli/main.js +138 -735
- package/dist/public-cli/option-definitions.js +0 -14
- package/dist/public-cli/registry.js +1 -2
- package/dist/public-cli/run-lifecycle.js +1 -3
- package/dist/public-cli/settlement.js +66 -537
- package/dist/public-role-summons.js +0 -14
- package/dist/reviewer-child-executor.js +163 -70
- package/dist/reviewer-construction.js +2 -2
- package/dist/reviewer-role.js +159 -0
- package/dist/reviewer-settlement.js +66 -0
- package/dist/role-runtime.js +1394 -0
- package/dist/stderr-jsonl.js +26 -0
- package/dist/tool-execution-observation.js +141 -0
- package/dist/worker-role.js +343 -0
- package/dist/worker-submission-gates.js +305 -0
- package/extensions/role-runtime.ts +1 -2
- package/package.json +1 -1
- package/src/acp-host/production-host.ts +0 -1
- package/src/audit-escalation.ts +9 -9
- package/src/compliance-transport.ts +28 -94
- package/src/diarist-contracts.ts +0 -12
- package/src/doctor-contracts.ts +0 -1
- package/src/doctor-role.ts +2 -2
- package/src/gleaner-left-contracts.ts +0 -9
- package/src/host-contracts.ts +0 -2
- package/src/inspector-contracts.ts +0 -8
- package/src/judge-role.ts +4 -5
- package/src/navigator-public-session.ts +4 -5
- package/src/notary-contracts.ts +0 -18
- package/src/package-contracts/auditor-output.ts +0 -11
- package/src/package-contracts/gatekeeper-output.ts +0 -11
- package/src/package-contracts/judge-output.ts +0 -1
- package/src/package-contracts/navigator-output.ts +0 -3
- package/src/package-contracts/terminating-tools.ts +1 -19
- package/src/packaged-role-registry.ts +1 -19
- package/src/pi/role-turn-host.ts +0 -2
- package/src/public-cli/cli.ts +1 -5
- package/src/public-cli/instruction-seat-run.ts +5 -14
- package/src/public-cli/invocation.ts +3 -21
- package/src/public-cli/option-definitions.ts +0 -16
- package/src/public-cli/registry.ts +1 -2
- package/src/public-cli/run-lifecycle.ts +0 -6
- package/src/public-cli/settlement.ts +58 -572
- package/src/public-cli/terminal.ts +0 -1
- package/src/public-role-summons.ts +0 -15
- package/src/reviewer-child-executor.ts +199 -98
- package/src/reviewer-construction.ts +3 -3
- package/src/role-runtime.ts +1 -33
- package/dist/package-contracts/evidence-child-output.js +0 -34
- package/souls/evidence-child.md +0 -1
- package/src/evidence-child-role.ts +0 -22
- package/src/package-contracts/evidence-child-output.ts +0 -51
package/dist/public-cli/main.js
CHANGED
|
@@ -8396,15 +8396,6 @@ function validateRecordedGatekeeperOutput(value) {
|
|
|
8396
8396
|
}
|
|
8397
8397
|
return projected;
|
|
8398
8398
|
}
|
|
8399
|
-
function gatekeeperDecisiveFacts(output) {
|
|
8400
|
-
const facts = { status: output.status };
|
|
8401
|
-
if (output.status === "dispatch") {
|
|
8402
|
-
facts.officer = output.officer;
|
|
8403
|
-
} else if (Array.isArray(output.findings)) {
|
|
8404
|
-
facts.findingsCount = output.findings.length;
|
|
8405
|
-
}
|
|
8406
|
-
return facts;
|
|
8407
|
-
}
|
|
8408
8399
|
var GATEKEEPER_OUTPUT_TOOL_NAME, gatekeeperDecisionSchema, gatekeeperOutputSchema;
|
|
8409
8400
|
var init_gatekeeper_output = __esm({
|
|
8410
8401
|
"src/package-contracts/gatekeeper-output.ts"() {
|
|
@@ -8448,9 +8439,6 @@ function validateRecordedNavigatorOutput(value) {
|
|
|
8448
8439
|
}
|
|
8449
8440
|
return projected;
|
|
8450
8441
|
}
|
|
8451
|
-
function navigatorDecisiveFacts(output) {
|
|
8452
|
-
return { status: "advice", candidates: output.candidates };
|
|
8453
|
-
}
|
|
8454
8442
|
var NAVIGATOR_OUTPUT_TOOL_NAME, navigatorOutputSchema;
|
|
8455
8443
|
var init_navigator_output = __esm({
|
|
8456
8444
|
"src/package-contracts/navigator-output.ts"() {
|
|
@@ -14896,23 +14884,6 @@ function validateRecordedNotaryOutput(value) {
|
|
|
14896
14884
|
}
|
|
14897
14885
|
return projected;
|
|
14898
14886
|
}
|
|
14899
|
-
function notaryDecisiveFacts(output) {
|
|
14900
|
-
const status = String(output.status);
|
|
14901
|
-
const facts = { status, officer: "notary" };
|
|
14902
|
-
if (status === "pass" || status === "bounce") {
|
|
14903
|
-
const findings = output.findings;
|
|
14904
|
-
facts.findingsCount = Array.isArray(findings) ? findings.length : 0;
|
|
14905
|
-
facts.findings = Array.isArray(findings) ? findings : [];
|
|
14906
|
-
}
|
|
14907
|
-
if (status === "bounce") {
|
|
14908
|
-
facts.disposition = "rewrite";
|
|
14909
|
-
}
|
|
14910
|
-
if (status === "escalate") {
|
|
14911
|
-
const reason = output.reason;
|
|
14912
|
-
if (reason !== void 0) facts.reason = reason;
|
|
14913
|
-
}
|
|
14914
|
-
return facts;
|
|
14915
|
-
}
|
|
14916
14887
|
var NOTARY_OUTPUT_TOOL_NAME, NOTARY_FIXED_KICKOFF, notaryOutputSchema;
|
|
14917
14888
|
var init_notary_contracts = __esm({
|
|
14918
14889
|
"src/notary-contracts.ts"() {
|
|
@@ -14983,12 +14954,6 @@ function validateRecordedGleanerLeftOutput(value) {
|
|
|
14983
14954
|
}
|
|
14984
14955
|
throw new Error("Gleaner-left output has no execution discriminator");
|
|
14985
14956
|
}
|
|
14986
|
-
function gleanerLeftDecisiveFacts(output) {
|
|
14987
|
-
const facts = { status: output.status };
|
|
14988
|
-
const findings = output.findings;
|
|
14989
|
-
if (Array.isArray(findings)) facts.findings = findings;
|
|
14990
|
-
return facts;
|
|
14991
|
-
}
|
|
14992
14957
|
var GLEANER_LEFT_OUTPUT_TOOL_NAME;
|
|
14993
14958
|
var init_gleaner_left_contracts = __esm({
|
|
14994
14959
|
"src/gleaner-left-contracts.ts"() {
|
|
@@ -15013,9 +14978,6 @@ function validateRecordedInspectorOutput(value) {
|
|
|
15013
14978
|
}
|
|
15014
14979
|
throw new Error("Inspector output has no execution discriminator");
|
|
15015
14980
|
}
|
|
15016
|
-
function inspectorDecisiveFacts(output) {
|
|
15017
|
-
return { ...output };
|
|
15018
|
-
}
|
|
15019
14981
|
var INSPECTOR_OUTPUT_TOOL_NAME;
|
|
15020
14982
|
var init_inspector_contracts = __esm({
|
|
15021
14983
|
"src/inspector-contracts.ts"() {
|
|
@@ -15053,17 +15015,6 @@ function validateRecordedAuditorOutput(value) {
|
|
|
15053
15015
|
}
|
|
15054
15016
|
return projected;
|
|
15055
15017
|
}
|
|
15056
|
-
function auditorDecisiveFacts(output) {
|
|
15057
|
-
const facts = { status: output.status };
|
|
15058
|
-
if (output.status === "bounce" && output.violations !== void 0) {
|
|
15059
|
-
facts.violations = output.violations;
|
|
15060
|
-
}
|
|
15061
|
-
if (output.status === "escalate") {
|
|
15062
|
-
if (output.conflicts !== void 0) facts.conflicts = output.conflicts;
|
|
15063
|
-
if (output.decisionGate !== void 0) facts.decisionGate = output.decisionGate;
|
|
15064
|
-
}
|
|
15065
|
-
return facts;
|
|
15066
|
-
}
|
|
15067
15018
|
var AUDITOR_OUTPUT_TOOL_NAME, auditorOutputSchema;
|
|
15068
15019
|
var init_auditor_output = __esm({
|
|
15069
15020
|
"src/package-contracts/auditor-output.ts"() {
|
|
@@ -15093,44 +15044,6 @@ var init_auditor_output = __esm({
|
|
|
15093
15044
|
}
|
|
15094
15045
|
});
|
|
15095
15046
|
|
|
15096
|
-
// src/package-contracts/evidence-child-output.ts
|
|
15097
|
-
function isRecord7(value) {
|
|
15098
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15099
|
-
}
|
|
15100
|
-
function projectLawfulEvidenceChildOutput(value) {
|
|
15101
|
-
if (!isRecord7(value)) return void 0;
|
|
15102
|
-
return { report: Object.hasOwn(value, "report") ? value.report : value };
|
|
15103
|
-
}
|
|
15104
|
-
function validateRecordedEvidenceChildOutput(value) {
|
|
15105
|
-
const projected = projectLawfulEvidenceChildOutput(value);
|
|
15106
|
-
if (projected === void 0) {
|
|
15107
|
-
throw new Error("Evidence-child output is not an object");
|
|
15108
|
-
}
|
|
15109
|
-
return projected;
|
|
15110
|
-
}
|
|
15111
|
-
function evidenceChildDecisiveFacts(output) {
|
|
15112
|
-
return { report: output.report };
|
|
15113
|
-
}
|
|
15114
|
-
var EVIDENCE_CHILD_OUTPUT_TOOL_NAME, evidenceChildOutputSchema;
|
|
15115
|
-
var init_evidence_child_output = __esm({
|
|
15116
|
-
"src/package-contracts/evidence-child-output.ts"() {
|
|
15117
|
-
"use strict";
|
|
15118
|
-
init_build();
|
|
15119
|
-
init_open_tool_schema();
|
|
15120
|
-
init_terminating_infrastructure();
|
|
15121
|
-
EVIDENCE_CHILD_OUTPUT_TOOL_NAME = "ak_evidence_child_output";
|
|
15122
|
-
evidenceChildOutputSchema = withInfrastructureFailureDeclaration(
|
|
15123
|
-
openToolObject(
|
|
15124
|
-
typebox_exports.Object({
|
|
15125
|
-
report: typebox_exports.Unknown({
|
|
15126
|
-
description: "\u53D6\u8BC1\u62A5\u544A\u6B63\u6587 \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
15127
|
-
})
|
|
15128
|
-
})
|
|
15129
|
-
)
|
|
15130
|
-
);
|
|
15131
|
-
}
|
|
15132
|
-
});
|
|
15133
|
-
|
|
15134
15047
|
// src/diarist-contracts.ts
|
|
15135
15048
|
function validateRecordedDiaristOutput(value) {
|
|
15136
15049
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -15147,14 +15060,6 @@ function validateRecordedDiaristOutput(value) {
|
|
|
15147
15060
|
}
|
|
15148
15061
|
throw new Error("Diarist output has no execution discriminator");
|
|
15149
15062
|
}
|
|
15150
|
-
function diaristDecisiveFacts(output) {
|
|
15151
|
-
const facts = { status: output.status };
|
|
15152
|
-
const selections = output.selections;
|
|
15153
|
-
if (Array.isArray(selections)) facts.selections = selections;
|
|
15154
|
-
const sitian = output.sitian;
|
|
15155
|
-
if (sitian !== void 0) facts.sitian = sitian;
|
|
15156
|
-
return facts;
|
|
15157
|
-
}
|
|
15158
15063
|
var DIARIST_OUTPUT_TOOL_NAME, DIARIST_SOURCES_FLAG;
|
|
15159
15064
|
var init_diarist_contracts = __esm({
|
|
15160
15065
|
"src/diarist-contracts.ts"() {
|
|
@@ -15174,7 +15079,7 @@ var init_diarist_contracts = __esm({
|
|
|
15174
15079
|
function packagedRoleMetadata(role) {
|
|
15175
15080
|
return PACKAGED_ROLE_REGISTRY.find((entry) => entry.role === role);
|
|
15176
15081
|
}
|
|
15177
|
-
var NOTARY_SESSION_MATERIALS, INSPECTOR_SESSION_MATERIALS, AUDITOR_PUBLIC_SESSION_MATERIALS,
|
|
15082
|
+
var NOTARY_SESSION_MATERIALS, INSPECTOR_SESSION_MATERIALS, AUDITOR_PUBLIC_SESSION_MATERIALS, PUBLIC_ROLE_RECORDS, PACKAGED_ROLE_REGISTRY;
|
|
15178
15083
|
var init_packaged_role_registry = __esm({
|
|
15179
15084
|
"src/packaged-role-registry.ts"() {
|
|
15180
15085
|
"use strict";
|
|
@@ -15191,7 +15096,6 @@ var init_packaged_role_registry = __esm({
|
|
|
15191
15096
|
init_gleaner_left_contracts();
|
|
15192
15097
|
init_inspector_contracts();
|
|
15193
15098
|
init_auditor_output();
|
|
15194
|
-
init_evidence_child_output();
|
|
15195
15099
|
init_diarist_contracts();
|
|
15196
15100
|
NOTARY_SESSION_MATERIALS = [
|
|
15197
15101
|
"CLAUDE.md",
|
|
@@ -15213,12 +15117,6 @@ var init_packaged_role_registry = __esm({
|
|
|
15213
15117
|
"souls/audit-law.md",
|
|
15214
15118
|
"souls/quality-law.md"
|
|
15215
15119
|
];
|
|
15216
|
-
EVIDENCE_CHILD_SESSION_MATERIALS = [
|
|
15217
|
-
"CLAUDE.md",
|
|
15218
|
-
"souls/evidence-child.md",
|
|
15219
|
-
"souls/audit-law.md",
|
|
15220
|
-
"souls/quality-law.md"
|
|
15221
|
-
];
|
|
15222
15120
|
PUBLIC_ROLE_RECORDS = [
|
|
15223
15121
|
{
|
|
15224
15122
|
role: "judge",
|
|
@@ -15372,7 +15270,7 @@ var init_packaged_role_registry = __esm({
|
|
|
15372
15270
|
activationStage: "load-and-install",
|
|
15373
15271
|
sessionMaterials: ["CLAUDE.md", "souls/navigator.md"]
|
|
15374
15272
|
},
|
|
15375
|
-
// #675: 审刑院
|
|
15273
|
+
// #675: 审刑院 is a role like any other — public ak-role entry. (#744: evidence-child deleted)
|
|
15376
15274
|
{
|
|
15377
15275
|
role: "auditor",
|
|
15378
15276
|
phases: [null],
|
|
@@ -15382,15 +15280,6 @@ var init_packaged_role_registry = __esm({
|
|
|
15382
15280
|
activationStage: "load-and-install",
|
|
15383
15281
|
sessionMaterials: AUDITOR_PUBLIC_SESSION_MATERIALS
|
|
15384
15282
|
},
|
|
15385
|
-
{
|
|
15386
|
-
role: "evidence-child",
|
|
15387
|
-
phases: [null],
|
|
15388
|
-
outputTool: EVIDENCE_CHILD_OUTPUT_TOOL_NAME,
|
|
15389
|
-
inputFlag: void 0,
|
|
15390
|
-
phaseFlag: void 0,
|
|
15391
|
-
activationStage: "load-and-install",
|
|
15392
|
-
sessionMaterials: EVIDENCE_CHILD_SESSION_MATERIALS
|
|
15393
|
-
},
|
|
15394
15283
|
// #708 / ADR 0075 `diarist-is-role`: 起居郎 is a seat like any other. The
|
|
15395
15284
|
// frozen source catalog rides the shared input-flag seam; it is absent for a
|
|
15396
15285
|
// true-unbound summons (no ticket → no diary).
|
|
@@ -15518,9 +15407,8 @@ var init_registry2 = __esm({
|
|
|
15518
15407
|
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "medium" },
|
|
15519
15408
|
{ provider: "xai", model: "grok-4.5", thinking: "high" }
|
|
15520
15409
|
],
|
|
15521
|
-
// #675: auditor
|
|
15410
|
+
// #675: auditor public seat — no package startup; caller configures.
|
|
15522
15411
|
auditor: [],
|
|
15523
|
-
"evidence-child": [],
|
|
15524
15412
|
// #708 `diarist-seat-default`: owner-set initial value; changed in the seat
|
|
15525
15413
|
// table like any other seat. No engine axis, package-default host.
|
|
15526
15414
|
diarist: [{ provider: "xai", model: "grok-4.5", thinking: "medium" }]
|
|
@@ -16258,7 +16146,7 @@ import {
|
|
|
16258
16146
|
writeFileSync
|
|
16259
16147
|
} from "node:fs";
|
|
16260
16148
|
import { basename as basename3, dirname as dirname5, join as join8, resolve as resolve3 } from "node:path";
|
|
16261
|
-
function
|
|
16149
|
+
function isRecord7(value) {
|
|
16262
16150
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16263
16151
|
}
|
|
16264
16152
|
function errorCodeOf(error) {
|
|
@@ -16286,7 +16174,7 @@ function findIdentityPointer(recordFile, identity, kind, level) {
|
|
|
16286
16174
|
if (!trimmed) continue;
|
|
16287
16175
|
try {
|
|
16288
16176
|
const parsed = JSON.parse(trimmed);
|
|
16289
|
-
if (
|
|
16177
|
+
if (isRecord7(parsed) && parsed.identity === identity) {
|
|
16290
16178
|
return { identity, recordFile, kind, level };
|
|
16291
16179
|
}
|
|
16292
16180
|
} catch {
|
|
@@ -16474,7 +16362,7 @@ var init_sitian_appender = __esm({
|
|
|
16474
16362
|
// src/sitian-reader.ts
|
|
16475
16363
|
import { existsSync as existsSync5 } from "node:fs";
|
|
16476
16364
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
16477
|
-
function
|
|
16365
|
+
function isRecord8(value) {
|
|
16478
16366
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16479
16367
|
}
|
|
16480
16368
|
async function readSitianRecords(recordFile) {
|
|
@@ -16490,7 +16378,7 @@ async function readSitianRecords(recordFile) {
|
|
|
16490
16378
|
if (!line2.trim()) continue;
|
|
16491
16379
|
try {
|
|
16492
16380
|
const parsed = JSON.parse(line2);
|
|
16493
|
-
if (
|
|
16381
|
+
if (isRecord8(parsed)) {
|
|
16494
16382
|
records2.push(parsed);
|
|
16495
16383
|
} else {
|
|
16496
16384
|
const typeDesc = parsed === null ? "null" : Array.isArray(parsed) ? "array" : typeof parsed;
|
|
@@ -16627,8 +16515,6 @@ function buildActivationFlagArgs(activation) {
|
|
|
16627
16515
|
return ["--ak-role", "navigator"];
|
|
16628
16516
|
case "auditor":
|
|
16629
16517
|
return ["--ak-role", "auditor"];
|
|
16630
|
-
case "evidence-child":
|
|
16631
|
-
return ["--ak-role", "evidence-child"];
|
|
16632
16518
|
case "diarist":
|
|
16633
16519
|
return [
|
|
16634
16520
|
"--ak-role",
|
|
@@ -16999,14 +16885,12 @@ function validateAcceptedDetails(toolName, details) {
|
|
|
16999
16885
|
[GATEKEEPER_OUTPUT_TOOL_NAME]: ["dispatch", "pass"],
|
|
17000
16886
|
[NAVIGATOR_OUTPUT_TOOL_NAME]: ["advice"],
|
|
17001
16887
|
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
|
|
17002
|
-
[EVIDENCE_CHILD_OUTPUT_TOOL_NAME]: [],
|
|
17003
16888
|
[DIARIST_OUTPUT_TOOL_NAME]: ["completed"]
|
|
17004
16889
|
};
|
|
17005
16890
|
const collectorDiscriminator = toolName === COLLECTOR_OUTPUT_TOOL && Array.isArray(candidate?.groups);
|
|
17006
|
-
const evidenceChildDiscriminator = toolName === EVIDENCE_CHILD_OUTPUT_TOOL_NAME && candidate !== null && typeof candidate === "object" && !Array.isArray(candidate);
|
|
17007
16891
|
const baseDiscriminator = discriminator;
|
|
17008
16892
|
const runtimeBindingMissing = toolName === DOCTOR_OUTPUT_TOOL_NAME && baseDiscriminator === "completed" && !(candidate?.cost !== null && typeof candidate?.cost === "object") || toolName === REVIEWER_OUTPUT_TOOL_NAME && candidate?.version !== 2;
|
|
17009
|
-
if (runtimeBindingMissing || !collectorDiscriminator &&
|
|
16893
|
+
if (runtimeBindingMissing || !collectorDiscriminator && (typeof discriminator !== "string" || !lawfulStatuses[toolName].includes(baseDiscriminator))) {
|
|
17010
16894
|
throw new AcceptedDetailsContractError("terminating receipt has no recognized execution discriminator");
|
|
17011
16895
|
}
|
|
17012
16896
|
try {
|
|
@@ -17039,8 +16923,6 @@ function validateAcceptedDetails(toolName, details) {
|
|
|
17039
16923
|
return validateRecordedNavigatorOutput(details);
|
|
17040
16924
|
case AUDITOR_OUTPUT_TOOL_NAME:
|
|
17041
16925
|
return validateRecordedAuditorOutput(details);
|
|
17042
|
-
case EVIDENCE_CHILD_OUTPUT_TOOL_NAME:
|
|
17043
|
-
return validateRecordedEvidenceChildOutput(details);
|
|
17044
16926
|
case DIARIST_OUTPUT_TOOL_NAME:
|
|
17045
16927
|
return validateRecordedDiaristOutput(details);
|
|
17046
16928
|
}
|
|
@@ -17062,8 +16944,6 @@ function acceptedFacts(toolName, details) {
|
|
|
17062
16944
|
case NAVIGATOR_OUTPUT_TOOL_NAME:
|
|
17063
16945
|
case AUDITOR_OUTPUT_TOOL_NAME:
|
|
17064
16946
|
return { status: details.status };
|
|
17065
|
-
case EVIDENCE_CHILD_OUTPUT_TOOL_NAME:
|
|
17066
|
-
return { status: "report" };
|
|
17067
16947
|
case DIARIST_OUTPUT_TOOL_NAME:
|
|
17068
16948
|
return { status: details.status };
|
|
17069
16949
|
case JUDGE_OUTPUT_TOOL_NAME:
|
|
@@ -17092,7 +16972,6 @@ var init_terminating_tools = __esm({
|
|
|
17092
16972
|
init_gatekeeper_output();
|
|
17093
16973
|
init_navigator_output();
|
|
17094
16974
|
init_auditor_output();
|
|
17095
|
-
init_evidence_child_output();
|
|
17096
16975
|
init_merger_contracts();
|
|
17097
16976
|
init_notary_contracts();
|
|
17098
16977
|
init_countersign_contracts();
|
|
@@ -17115,7 +16994,6 @@ var init_terminating_tools = __esm({
|
|
|
17115
16994
|
GATEKEEPER_OUTPUT_TOOL_NAME,
|
|
17116
16995
|
NAVIGATOR_OUTPUT_TOOL_NAME,
|
|
17117
16996
|
AUDITOR_OUTPUT_TOOL_NAME,
|
|
17118
|
-
EVIDENCE_CHILD_OUTPUT_TOOL_NAME,
|
|
17119
16997
|
DIARIST_OUTPUT_TOOL_NAME
|
|
17120
16998
|
];
|
|
17121
16999
|
AcceptedDetailsContractError = class extends CorrectableSubmissionError {
|
|
@@ -17613,7 +17491,7 @@ async function readRoleRunStateDisk(runDirectory) {
|
|
|
17613
17491
|
if (typeof record4.runId !== "string" || record4.runId.trim() === "") {
|
|
17614
17492
|
return void 0;
|
|
17615
17493
|
}
|
|
17616
|
-
if (record4.role !== "judge" && record4.role !== "coder" && record4.role !== "fixer" && record4.role !== "collector" && record4.role !== "doctor" && record4.role !== "reviewer" && record4.role !== "merger" && record4.role !== "notary" && record4.role !== "countersign" && record4.role !== "gleaner-left" && record4.role !== "inspector" && record4.role !== "gatekeeper" && record4.role !== "navigator" && record4.role !== "auditor" && record4.role !== "
|
|
17494
|
+
if (record4.role !== "judge" && record4.role !== "coder" && record4.role !== "fixer" && record4.role !== "collector" && record4.role !== "doctor" && record4.role !== "reviewer" && record4.role !== "merger" && record4.role !== "notary" && record4.role !== "countersign" && record4.role !== "gleaner-left" && record4.role !== "inspector" && record4.role !== "gatekeeper" && record4.role !== "navigator" && record4.role !== "auditor" && record4.role !== "diarist") {
|
|
17617
17495
|
return void 0;
|
|
17618
17496
|
}
|
|
17619
17497
|
if (record4.state !== "admitted" && record4.state !== "running" && record4.state !== "resumable" && record4.state !== "terminal") {
|
|
@@ -18432,7 +18310,7 @@ async function loadResumableCountersignRun(home, runId, authority) {
|
|
|
18432
18310
|
}
|
|
18433
18311
|
async function loadResumableInstructionSeatRun(home, runId, authority) {
|
|
18434
18312
|
const loaded = await loadResumableRunRecord(home, runId, authority);
|
|
18435
|
-
if (loaded.run.role !== "gatekeeper" && loaded.run.role !== "navigator" && loaded.run.role !== "auditor"
|
|
18313
|
+
if (loaded.run.role !== "gatekeeper" && loaded.run.role !== "navigator" && loaded.run.role !== "auditor") {
|
|
18436
18314
|
throw new CliUsageError(
|
|
18437
18315
|
`role run ${runId} belongs to ${loaded.run.role}, not an instruction seat`
|
|
18438
18316
|
);
|
|
@@ -19024,7 +18902,7 @@ function renderHumanOwnerOptionLines(owner, locale2 = "en") {
|
|
|
19024
18902
|
}
|
|
19025
18903
|
return lines;
|
|
19026
18904
|
}
|
|
19027
|
-
var ANALYST_REQUIRE_ANY_OF, ANALYST_DEFAULT_MODE, REJECTED_PUBLIC_SPELLINGS, GLOBAL_OPTIONS, SHARED_PROJECT_SEMANTICS, SHARED_ATTACH_SEMANTICS, JUDGE_OPTIONS, GLEANER_LEFT_OPTIONS, INSPECTOR_OPTIONS, GATEKEEPER_OPTIONS, NAVIGATOR_OPTIONS, AUDITOR_OPTIONS,
|
|
18905
|
+
var ANALYST_REQUIRE_ANY_OF, ANALYST_DEFAULT_MODE, REJECTED_PUBLIC_SPELLINGS, GLOBAL_OPTIONS, SHARED_PROJECT_SEMANTICS, SHARED_ATTACH_SEMANTICS, JUDGE_OPTIONS, GLEANER_LEFT_OPTIONS, INSPECTOR_OPTIONS, GATEKEEPER_OPTIONS, NAVIGATOR_OPTIONS, AUDITOR_OPTIONS, COUNTERSIGN_OPTIONS, DIARIST_OPTIONS, CODER_OPTIONS, FIXER_OPTIONS, REVIEWER_OPTIONS, COLLECTOR_OPTIONS, DOCTOR_OPTIONS, NOTARY_OPTIONS, MERGER_OPTIONS, ANALYST_OPTIONS, PUBLIC_OPTION_TABLE, PUBLIC_NAVIGATOR_HELP_NOTE, TOP_LEVEL_HELP, ROLE_COMMAND_HELP, SUPPORT_COMMAND_HELP, PUBLIC_COMMAND_HELP;
|
|
19028
18906
|
var init_option_definitions = __esm({
|
|
19029
18907
|
"src/public-cli/option-definitions.ts"() {
|
|
19030
18908
|
"use strict";
|
|
@@ -19229,10 +19107,6 @@ var init_option_definitions = __esm({
|
|
|
19229
19107
|
}
|
|
19230
19108
|
}
|
|
19231
19109
|
];
|
|
19232
|
-
EVIDENCE_CHILD_OPTIONS = [
|
|
19233
|
-
bindOwner("evidence-child", SHARED_PROJECT_SEMANTICS),
|
|
19234
|
-
bindOwner("evidence-child", SHARED_ATTACH_SEMANTICS)
|
|
19235
|
-
];
|
|
19236
19110
|
COUNTERSIGN_OPTIONS = [
|
|
19237
19111
|
bindOwner("countersign", SHARED_PROJECT_SEMANTICS),
|
|
19238
19112
|
bindOwner("countersign", SHARED_ATTACH_SEMANTICS)
|
|
@@ -19587,7 +19461,6 @@ var init_option_definitions = __esm({
|
|
|
19587
19461
|
gatekeeper: GATEKEEPER_OPTIONS,
|
|
19588
19462
|
navigator: NAVIGATOR_OPTIONS,
|
|
19589
19463
|
auditor: AUDITOR_OPTIONS,
|
|
19590
|
-
"evidence-child": EVIDENCE_CHILD_OPTIONS,
|
|
19591
19464
|
diarist: DIARIST_OPTIONS,
|
|
19592
19465
|
analyst: ANALYST_OPTIONS
|
|
19593
19466
|
};
|
|
@@ -19716,14 +19589,6 @@ var init_option_definitions = __esm({
|
|
|
19716
19589
|
'ak-role auditor --subject doctor --source-run 01abc\u2026@doctor "\u5BA1\uFF1A\u592A\u533B\u5019\u9009\u662F\u5426\u5408\u89C4\u3002"'
|
|
19717
19590
|
]
|
|
19718
19591
|
},
|
|
19719
|
-
"evidence-child": {
|
|
19720
|
-
command: "evidence-child",
|
|
19721
|
-
summary: "Direct evidence-child fact gathering; submit one report.",
|
|
19722
|
-
usage: ["ak-role evidence-child [options] [instruction]"],
|
|
19723
|
-
examples: [
|
|
19724
|
-
'ak-role evidence-child "\u67E5\uFF1A\u672C\u5DE5\u4F5C\u6811 diff \u4E0E\u7968\u9762\u662F\u5426\u4E00\u81F4\u3002"'
|
|
19725
|
-
]
|
|
19726
|
-
},
|
|
19727
19592
|
diarist: {
|
|
19728
19593
|
command: "diarist",
|
|
19729
19594
|
summary: "Direct Diarist (\u8D77\u5C45\u90CE) pass: gather and organize this case's decision basis into its \u8D77\u5C45\u5F55.",
|
|
@@ -20142,9 +20007,6 @@ function parseNavigatorArgv(args) {
|
|
|
20142
20007
|
function parseAuditorArgv(args) {
|
|
20143
20008
|
return parseInstructionArgv(args, "auditor");
|
|
20144
20009
|
}
|
|
20145
|
-
function parseEvidenceChildArgv(args) {
|
|
20146
|
-
return parseInstructionArgv(args, "evidence-child");
|
|
20147
|
-
}
|
|
20148
20010
|
function parseDiaristArgv(args) {
|
|
20149
20011
|
return parseInstructionArgv(args, "diarist");
|
|
20150
20012
|
}
|
|
@@ -20370,9 +20232,6 @@ async function admitNavigatorInvocation(options) {
|
|
|
20370
20232
|
async function admitAuditorInvocation(options) {
|
|
20371
20233
|
return admitStandardMaterialInvocation("auditor", options);
|
|
20372
20234
|
}
|
|
20373
|
-
async function admitEvidenceChildInvocation(options) {
|
|
20374
|
-
return admitStandardMaterialInvocation("evidence-child", options);
|
|
20375
|
-
}
|
|
20376
20235
|
async function admitDiaristInvocation(options) {
|
|
20377
20236
|
return admitStandardMaterialInvocation("diarist", options);
|
|
20378
20237
|
}
|
|
@@ -21974,11 +21833,11 @@ function resolvePackagedMethodSkillRoot(packageRoot2, name) {
|
|
|
21974
21833
|
function resolvePackagedMethodSkillPath(packageRoot2, name) {
|
|
21975
21834
|
return join15(resolvePackagedMethodSkillRoot(packageRoot2, name), "SKILL.md");
|
|
21976
21835
|
}
|
|
21977
|
-
function
|
|
21836
|
+
function isRecord9(value) {
|
|
21978
21837
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21979
21838
|
}
|
|
21980
21839
|
function parseProvenance(raw, expectedName) {
|
|
21981
|
-
if (!
|
|
21840
|
+
if (!isRecord9(raw)) {
|
|
21982
21841
|
throw new Error(`Packaged method provenance must be an object for ${expectedName}`);
|
|
21983
21842
|
}
|
|
21984
21843
|
if (raw.name !== expectedName) {
|
|
@@ -21992,7 +21851,7 @@ function parseProvenance(raw, expectedName) {
|
|
|
21992
21851
|
if (typeof raw.packageAdaptation !== "string" || raw.packageAdaptation.trim() === "") {
|
|
21993
21852
|
throw new Error(`Packaged method provenance packageAdaptation must be nonblank`);
|
|
21994
21853
|
}
|
|
21995
|
-
if (!
|
|
21854
|
+
if (!isRecord9(raw.upstream)) {
|
|
21996
21855
|
throw new Error(`Packaged method provenance upstream must be an object`);
|
|
21997
21856
|
}
|
|
21998
21857
|
const upstream = raw.upstream;
|
|
@@ -22019,12 +21878,12 @@ function parseProvenance(raw, expectedName) {
|
|
|
22019
21878
|
`Packaged method provenance upstream must include nonblank tag or version`
|
|
22020
21879
|
);
|
|
22021
21880
|
}
|
|
22022
|
-
if (!
|
|
21881
|
+
if (!isRecord9(raw.files)) {
|
|
22023
21882
|
throw new Error(`Packaged method provenance files must be an object`);
|
|
22024
21883
|
}
|
|
22025
21884
|
const files = {};
|
|
22026
21885
|
for (const [rel, entry] of Object.entries(raw.files)) {
|
|
22027
|
-
if (!
|
|
21886
|
+
if (!isRecord9(entry)) {
|
|
22028
21887
|
throw new Error(`Packaged method provenance file entry must be an object: ${rel}`);
|
|
22029
21888
|
}
|
|
22030
21889
|
if (typeof entry.sha256 !== "string" || !SHA256_RE.test(entry.sha256)) {
|
|
@@ -22183,7 +22042,7 @@ var init_method_skill = __esm({
|
|
|
22183
22042
|
|
|
22184
22043
|
// src/collector-github.ts
|
|
22185
22044
|
import { spawn as spawn3 } from "node:child_process";
|
|
22186
|
-
function
|
|
22045
|
+
function isRecord10(value) {
|
|
22187
22046
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22188
22047
|
}
|
|
22189
22048
|
function requireString(value, label) {
|
|
@@ -22224,25 +22083,25 @@ function commentFailureCause(error) {
|
|
|
22224
22083
|
};
|
|
22225
22084
|
}
|
|
22226
22085
|
function requireUserLogin(raw) {
|
|
22227
|
-
if (!
|
|
22086
|
+
if (!isRecord10(raw) || typeof raw["login"] !== "string") {
|
|
22228
22087
|
throw new Error("GitHub payload missing user.login");
|
|
22229
22088
|
}
|
|
22230
22089
|
return raw["login"];
|
|
22231
22090
|
}
|
|
22232
22091
|
function optionalUserLogin(raw) {
|
|
22233
22092
|
if (raw === null) return null;
|
|
22234
|
-
if (!
|
|
22093
|
+
if (!isRecord10(raw) || typeof raw["login"] !== "string") {
|
|
22235
22094
|
throw new Error("GitHub payload missing user.login");
|
|
22236
22095
|
}
|
|
22237
22096
|
return raw["login"];
|
|
22238
22097
|
}
|
|
22239
22098
|
function machineIdentity(raw) {
|
|
22240
22099
|
const user = raw["user"];
|
|
22241
|
-
if (!
|
|
22100
|
+
if (!isRecord10(user) || typeof user["type"] !== "string" || typeof user["id"] !== "number") {
|
|
22242
22101
|
return null;
|
|
22243
22102
|
}
|
|
22244
22103
|
const app = raw["performed_via_github_app"];
|
|
22245
|
-
const appId =
|
|
22104
|
+
const appId = isRecord10(app) && typeof app["id"] === "number" ? app["id"] : void 0;
|
|
22246
22105
|
return {
|
|
22247
22106
|
userType: user["type"],
|
|
22248
22107
|
userId: user["id"],
|
|
@@ -22250,9 +22109,9 @@ function machineIdentity(raw) {
|
|
|
22250
22109
|
};
|
|
22251
22110
|
}
|
|
22252
22111
|
function normalizePullRequest(raw) {
|
|
22253
|
-
if (!
|
|
22112
|
+
if (!isRecord10(raw)) throw new Error("GitHub pull request payload must be an object");
|
|
22254
22113
|
const head = raw["head"];
|
|
22255
|
-
if (!
|
|
22114
|
+
if (!isRecord10(head) || typeof head["sha"] !== "string" || head["sha"].length === 0) {
|
|
22256
22115
|
throw new Error("GitHub pull request payload missing head.sha");
|
|
22257
22116
|
}
|
|
22258
22117
|
const number = requireNumber(raw["number"], "number");
|
|
@@ -22268,7 +22127,7 @@ function normalizePullRequest(raw) {
|
|
|
22268
22127
|
};
|
|
22269
22128
|
}
|
|
22270
22129
|
function normalizePullRequestReaction(raw) {
|
|
22271
|
-
if (!
|
|
22130
|
+
if (!isRecord10(raw)) throw new Error("GitHub reaction payload must be an object");
|
|
22272
22131
|
return {
|
|
22273
22132
|
id: requireNumber(raw["id"], "reaction.id"),
|
|
22274
22133
|
userLogin: optionalUserLogin(raw["user"]),
|
|
@@ -22279,7 +22138,7 @@ function normalizePullRequestReaction(raw) {
|
|
|
22279
22138
|
};
|
|
22280
22139
|
}
|
|
22281
22140
|
function normalizeReview(raw) {
|
|
22282
|
-
if (!
|
|
22141
|
+
if (!isRecord10(raw)) throw new Error("GitHub review payload must be an object");
|
|
22283
22142
|
return {
|
|
22284
22143
|
id: requireNumber(raw["id"], "review.id"),
|
|
22285
22144
|
...typeof raw["node_id"] === "string" ? { nodeId: raw["node_id"] } : {},
|
|
@@ -22294,7 +22153,7 @@ function normalizeReview(raw) {
|
|
|
22294
22153
|
};
|
|
22295
22154
|
}
|
|
22296
22155
|
function normalizeIssueComment(raw) {
|
|
22297
|
-
if (!
|
|
22156
|
+
if (!isRecord10(raw)) throw new Error("GitHub issue comment payload must be an object");
|
|
22298
22157
|
return {
|
|
22299
22158
|
id: requireNumber(raw["id"], "comment.id"),
|
|
22300
22159
|
userLogin: optionalUserLogin(raw["user"]),
|
|
@@ -22307,7 +22166,7 @@ function normalizeIssueComment(raw) {
|
|
|
22307
22166
|
};
|
|
22308
22167
|
}
|
|
22309
22168
|
function normalizeReviewComment(raw) {
|
|
22310
|
-
if (!
|
|
22169
|
+
if (!isRecord10(raw)) throw new Error("GitHub review comment payload must be an object");
|
|
22311
22170
|
return {
|
|
22312
22171
|
id: requireNumber(raw["id"], "review_comment.id"),
|
|
22313
22172
|
pullRequestReviewId: typeof raw["pull_request_review_id"] === "number" ? raw["pull_request_review_id"] : null,
|
|
@@ -22616,11 +22475,11 @@ function createGhCollectorGitHubTransport(runner = createGhApiRunner()) {
|
|
|
22616
22475
|
if (input.signal?.aborted) {
|
|
22617
22476
|
throw error;
|
|
22618
22477
|
}
|
|
22619
|
-
if (
|
|
22478
|
+
if (isRecord10(error) && error["ambiguousGhFailure"] === true) {
|
|
22620
22479
|
const cause = commentFailureCause(error);
|
|
22621
22480
|
return { kind: "ambiguous_loss", diagnostics: cause.message, cause };
|
|
22622
22481
|
}
|
|
22623
|
-
if (
|
|
22482
|
+
if (isRecord10(error) && error["name"] === "AbortError") {
|
|
22624
22483
|
throw error;
|
|
22625
22484
|
}
|
|
22626
22485
|
throw error;
|
|
@@ -22908,12 +22767,12 @@ function encodeClaudeProjectDir(cwd) {
|
|
|
22908
22767
|
const abs = cwd.startsWith("/") ? cwd : `/${cwd}`;
|
|
22909
22768
|
return abs.replace(/\//g, "-");
|
|
22910
22769
|
}
|
|
22911
|
-
function
|
|
22770
|
+
function isRecord11(value) {
|
|
22912
22771
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22913
22772
|
}
|
|
22914
22773
|
function messageText(message) {
|
|
22915
22774
|
if (typeof message === "string") return message;
|
|
22916
|
-
if (!
|
|
22775
|
+
if (!isRecord11(message)) return "";
|
|
22917
22776
|
const content = message.content;
|
|
22918
22777
|
if (typeof content === "string") return content;
|
|
22919
22778
|
if (!Array.isArray(content)) return "";
|
|
@@ -22923,7 +22782,7 @@ function messageText(message) {
|
|
|
22923
22782
|
parts.push(part);
|
|
22924
22783
|
continue;
|
|
22925
22784
|
}
|
|
22926
|
-
if (!
|
|
22785
|
+
if (!isRecord11(part)) continue;
|
|
22927
22786
|
if (typeof part.text === "string") parts.push(part.text);
|
|
22928
22787
|
else if (typeof part.content === "string") parts.push(part.content);
|
|
22929
22788
|
}
|
|
@@ -23009,9 +22868,9 @@ function readCcSessionBlocks(options) {
|
|
|
23009
22868
|
{ cause: error }
|
|
23010
22869
|
);
|
|
23011
22870
|
}
|
|
23012
|
-
if (!
|
|
22871
|
+
if (!isRecord11(parsed)) continue;
|
|
23013
22872
|
const type = typeof parsed.type === "string" ? parsed.type : "";
|
|
23014
|
-
const queuedCommand = type === "attachment" &&
|
|
22873
|
+
const queuedCommand = type === "attachment" && isRecord11(parsed.attachment) && parsed.attachment.type === "queued_command" && isRecord11(parsed.attachment.origin) && parsed.attachment.origin.kind === "human" && typeof parsed.attachment.prompt === "string" ? parsed.attachment.prompt : void 0;
|
|
23015
22874
|
if (type !== "user" && type !== "assistant" && queuedCommand === void 0) {
|
|
23016
22875
|
continue;
|
|
23017
22876
|
}
|
|
@@ -23235,11 +23094,11 @@ var init_reviewer_pinned_git = __esm({
|
|
|
23235
23094
|
});
|
|
23236
23095
|
|
|
23237
23096
|
// src/ticket-provenance-contracts.ts
|
|
23238
|
-
function
|
|
23097
|
+
function isRecord12(value) {
|
|
23239
23098
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23240
23099
|
}
|
|
23241
23100
|
function projectTicketProvenanceDiagnostic(value) {
|
|
23242
|
-
if (!
|
|
23101
|
+
if (!isRecord12(value)) return void 0;
|
|
23243
23102
|
if (value.recordClass !== TICKET_PROVENANCE_RECORD_CLASS_DIAGNOSTIC) {
|
|
23244
23103
|
return void 0;
|
|
23245
23104
|
}
|
|
@@ -23261,18 +23120,18 @@ function projectTicketProvenanceDiagnostic(value) {
|
|
|
23261
23120
|
};
|
|
23262
23121
|
}
|
|
23263
23122
|
function projectTicketProvenanceEntry(value) {
|
|
23264
|
-
if (!
|
|
23123
|
+
if (!isRecord12(value)) return void 0;
|
|
23265
23124
|
if (value.recordClass === TICKET_PROVENANCE_RECORD_CLASS_DIAGNOSTIC) {
|
|
23266
23125
|
return void 0;
|
|
23267
23126
|
}
|
|
23268
|
-
if (!
|
|
23127
|
+
if (!isRecord12(value.basis)) return void 0;
|
|
23269
23128
|
if (typeof value.basis.method !== "string" || !BASIS_METHODS.has(value.basis.method)) {
|
|
23270
23129
|
return void 0;
|
|
23271
23130
|
}
|
|
23272
23131
|
if (typeof value.sourceKind !== "string" || !SOURCE_KINDS.has(value.sourceKind)) {
|
|
23273
23132
|
return void 0;
|
|
23274
23133
|
}
|
|
23275
|
-
if (!
|
|
23134
|
+
if (!isRecord12(value.sourceRef)) return void 0;
|
|
23276
23135
|
if (typeof value.transcript !== "string" || value.transcript.length === 0) {
|
|
23277
23136
|
return void 0;
|
|
23278
23137
|
}
|
|
@@ -23863,22 +23722,6 @@ var init_auditor_dossier_tool = __esm({
|
|
|
23863
23722
|
}
|
|
23864
23723
|
});
|
|
23865
23724
|
|
|
23866
|
-
// src/shape-unreadable-failure.ts
|
|
23867
|
-
function stampShapeUnreadableDetails(candidate) {
|
|
23868
|
-
return {
|
|
23869
|
-
[SHAPE_UNREADABLE_KEY]: true,
|
|
23870
|
-
candidate,
|
|
23871
|
-
acceptedReceipt: false
|
|
23872
|
-
};
|
|
23873
|
-
}
|
|
23874
|
-
var SHAPE_UNREADABLE_KEY;
|
|
23875
|
-
var init_shape_unreadable_failure = __esm({
|
|
23876
|
-
"src/shape-unreadable-failure.ts"() {
|
|
23877
|
-
"use strict";
|
|
23878
|
-
SHAPE_UNREADABLE_KEY = "shapeUnreadable";
|
|
23879
|
-
}
|
|
23880
|
-
});
|
|
23881
|
-
|
|
23882
23725
|
// src/compliance-transport.ts
|
|
23883
23726
|
var nonblank2, decisionGateSchema, complianceDecisionSchema, AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE, AUDITOR_COMPLIANCE_FAILURE_ENTRY_TYPE;
|
|
23884
23727
|
var init_compliance_transport = __esm({
|
|
@@ -23886,7 +23729,6 @@ var init_compliance_transport = __esm({
|
|
|
23886
23729
|
"use strict";
|
|
23887
23730
|
init_build();
|
|
23888
23731
|
init_auditor_dossier_tool();
|
|
23889
|
-
init_shape_unreadable_failure();
|
|
23890
23732
|
nonblank2 = typebox_exports.String({ minLength: 1, pattern: "\\S" });
|
|
23891
23733
|
decisionGateSchema = typebox_exports.Object({ question: nonblank2, options: typebox_exports.Array(nonblank2, { minItems: 1 }) }, { additionalProperties: false });
|
|
23892
23734
|
complianceDecisionSchema = typebox_exports.Object({ status: typebox_exports.Unknown({ description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }), violations: typebox_exports.Array(nonblank2, { description: "\u89C2\u5BDF\u5230\u7684\u5408\u89C4\u8FDD\u89C4" }), conflicts: typebox_exports.Array(nonblank2, { description: "\u672A\u51B3\u6743\u5A01\u6216\u6267\u884C\u51B2\u7A81" }), decisionGate: typebox_exports.Union([decisionGateSchema, typebox_exports.Null()], { description: "\u5347\u7EA7\u95EE\u9898\u4E0E\u53EF\u9009\u9009\u9879" }) }, { additionalProperties: true, required: [] });
|
|
@@ -23897,7 +23739,7 @@ var init_compliance_transport = __esm({
|
|
|
23897
23739
|
|
|
23898
23740
|
// src/ledger-session-read.ts
|
|
23899
23741
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
23900
|
-
function
|
|
23742
|
+
function isRecord13(value) {
|
|
23901
23743
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23902
23744
|
}
|
|
23903
23745
|
async function readLedgerSessionJsonl(path) {
|
|
@@ -23921,7 +23763,7 @@ async function readLedgerSessionJsonl(path) {
|
|
|
23921
23763
|
}
|
|
23922
23764
|
break;
|
|
23923
23765
|
}
|
|
23924
|
-
if (!
|
|
23766
|
+
if (!isRecord13(row)) {
|
|
23925
23767
|
const kind = row === null ? "null" : Array.isArray(row) ? "array" : typeof row;
|
|
23926
23768
|
throw new LedgerSessionJsonlError(
|
|
23927
23769
|
`complete non-object JSONL record in ${path} at line ${index + 1}: expected object, got ${kind}`,
|
|
@@ -23958,7 +23800,7 @@ function extractSessionModelSequence(rows) {
|
|
|
23958
23800
|
if (row.type === "model_change" && typeof row.modelId === "string") {
|
|
23959
23801
|
push(row.modelId);
|
|
23960
23802
|
}
|
|
23961
|
-
const message =
|
|
23803
|
+
const message = isRecord13(row.message) ? row.message : void 0;
|
|
23962
23804
|
if (message?.role === "assistant" && typeof message.model === "string") {
|
|
23963
23805
|
push(message.model);
|
|
23964
23806
|
}
|
|
@@ -23974,11 +23816,11 @@ function extractSessionToolIntervals(rows) {
|
|
|
23974
23816
|
const openById = /* @__PURE__ */ new Map();
|
|
23975
23817
|
for (const row of rows) {
|
|
23976
23818
|
const rowTimestamp = typeof row.timestamp === "string" ? row.timestamp : void 0;
|
|
23977
|
-
const message =
|
|
23819
|
+
const message = isRecord13(row.message) ? row.message : void 0;
|
|
23978
23820
|
if (message?.role === "assistant" && Array.isArray(message.content)) {
|
|
23979
23821
|
const callTimestamp = typeof message.timestamp === "string" && message.timestamp ? message.timestamp : rowTimestamp;
|
|
23980
23822
|
for (const part of message.content) {
|
|
23981
|
-
if (!
|
|
23823
|
+
if (!isRecord13(part) || part.type !== "toolCall") continue;
|
|
23982
23824
|
if (typeof part.id !== "string" || part.id.length === 0) {
|
|
23983
23825
|
throw new Error("toolCall frame missing string id");
|
|
23984
23826
|
}
|
|
@@ -23991,7 +23833,7 @@ function extractSessionToolIntervals(rows) {
|
|
|
23991
23833
|
if (openById.has(part.id)) {
|
|
23992
23834
|
throw new Error(`duplicate toolCall id ${part.id}`);
|
|
23993
23835
|
}
|
|
23994
|
-
const args =
|
|
23836
|
+
const args = isRecord13(part.arguments) ? part.arguments : void 0;
|
|
23995
23837
|
const command = part.name === "bash" && args !== void 0 && typeof args.command === "string" ? bashCommandFirstLine(args.command) : void 0;
|
|
23996
23838
|
const interval = {
|
|
23997
23839
|
toolCallId: part.id,
|
|
@@ -24077,7 +23919,7 @@ var init_ledger_session_read = __esm({
|
|
|
24077
23919
|
// src/analyst-gate-cycles-read.ts
|
|
24078
23920
|
import { readdir as readdir3 } from "node:fs/promises";
|
|
24079
23921
|
import { join as join19 } from "node:path";
|
|
24080
|
-
function
|
|
23922
|
+
function isRecord14(value) {
|
|
24081
23923
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24082
23924
|
}
|
|
24083
23925
|
function isParentAttemptBindingRow(row) {
|
|
@@ -24108,7 +23950,7 @@ function isGateTerminatingToolName(toolName) {
|
|
|
24108
23950
|
function acceptedGateReceiptIds(rows) {
|
|
24109
23951
|
const accepted = /* @__PURE__ */ new Set();
|
|
24110
23952
|
for (const row of rows) {
|
|
24111
|
-
const message =
|
|
23953
|
+
const message = isRecord14(row.message) ? row.message : void 0;
|
|
24112
23954
|
if (message?.role !== "toolResult") continue;
|
|
24113
23955
|
if (typeof message.toolCallId !== "string" || message.toolCallId.length === 0) continue;
|
|
24114
23956
|
if (message.isError === false) accepted.add(message.toolCallId);
|
|
@@ -24147,7 +23989,7 @@ function nearestAttemptBindingBefore(rows, beforeIndex) {
|
|
|
24147
23989
|
for (let i = beforeIndex - 1; i >= 0; i -= 1) {
|
|
24148
23990
|
const row = rows[i];
|
|
24149
23991
|
if (!isParentAttemptBindingRow(row)) continue;
|
|
24150
|
-
if (!
|
|
23992
|
+
if (!isRecord14(row.data) || !isRecord14(row.data.parent)) continue;
|
|
24151
23993
|
const id = row.data.parent.attemptEntryId;
|
|
24152
23994
|
const sessionFile = row.data.parent.sessionFile;
|
|
24153
23995
|
return {
|
|
@@ -24162,10 +24004,10 @@ function extractAllAcceptedGateToolCalls(rows) {
|
|
|
24162
24004
|
const out = [];
|
|
24163
24005
|
for (let rowIndex = 0; rowIndex < rows.length; rowIndex += 1) {
|
|
24164
24006
|
const row = rows[rowIndex];
|
|
24165
|
-
const message =
|
|
24007
|
+
const message = isRecord14(row.message) ? row.message : void 0;
|
|
24166
24008
|
if (message?.role !== "assistant" || !Array.isArray(message.content)) continue;
|
|
24167
24009
|
for (const part of message.content) {
|
|
24168
|
-
if (!
|
|
24010
|
+
if (!isRecord14(part) || part.type !== "toolCall") continue;
|
|
24169
24011
|
if (typeof part.id !== "string" || part.id.length === 0) continue;
|
|
24170
24012
|
if (typeof part.name !== "string" || part.name.length === 0) continue;
|
|
24171
24013
|
if (!isGateTerminatingToolName(part.name)) continue;
|
|
@@ -24173,7 +24015,7 @@ function extractAllAcceptedGateToolCalls(rows) {
|
|
|
24173
24015
|
const binding = nearestAttemptBindingBefore(rows, rowIndex);
|
|
24174
24016
|
out.push({
|
|
24175
24017
|
toolName: part.name,
|
|
24176
|
-
args:
|
|
24018
|
+
args: isRecord14(part.arguments) ? part.arguments : void 0,
|
|
24177
24019
|
accepted: true,
|
|
24178
24020
|
rowIndex,
|
|
24179
24021
|
...binding
|
|
@@ -24313,7 +24155,7 @@ async function resolveOfficerSessionFromPointerFile(pointerPath) {
|
|
|
24313
24155
|
{ cause: error }
|
|
24314
24156
|
);
|
|
24315
24157
|
}
|
|
24316
|
-
if (!
|
|
24158
|
+
if (!isRecord14(raw) || raw.kind !== "direct-officer-run-pointer" || raw.version !== 1) {
|
|
24317
24159
|
throw new Error(`direct officer run pointer has unknown shape in ${pointerPath}`);
|
|
24318
24160
|
}
|
|
24319
24161
|
const sessionFile = raw.sessionFile;
|
|
@@ -24373,6 +24215,13 @@ var init_analyst_gate_cycles_read = __esm({
|
|
|
24373
24215
|
}
|
|
24374
24216
|
});
|
|
24375
24217
|
|
|
24218
|
+
// src/shape-unreadable-failure.ts
|
|
24219
|
+
var init_shape_unreadable_failure = __esm({
|
|
24220
|
+
"src/shape-unreadable-failure.ts"() {
|
|
24221
|
+
"use strict";
|
|
24222
|
+
}
|
|
24223
|
+
});
|
|
24224
|
+
|
|
24376
24225
|
// src/gatekeeper-role.ts
|
|
24377
24226
|
var MISSING_ARGUMENTS_SUBMISSION;
|
|
24378
24227
|
var init_gatekeeper_role = __esm({
|
|
@@ -24397,14 +24246,14 @@ function isMissingPathError2(error) {
|
|
|
24397
24246
|
function errorText2(error) {
|
|
24398
24247
|
return error instanceof Error ? error.message : String(error);
|
|
24399
24248
|
}
|
|
24400
|
-
function
|
|
24249
|
+
function isRecord15(value) {
|
|
24401
24250
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24402
24251
|
}
|
|
24403
24252
|
function readUsableTerminalArtifactBody(body) {
|
|
24404
24253
|
if (body === null) {
|
|
24405
24254
|
return { ok: false, reason: "terminal artifact JSON value is null" };
|
|
24406
24255
|
}
|
|
24407
|
-
if (!
|
|
24256
|
+
if (!isRecord15(body)) {
|
|
24408
24257
|
return {
|
|
24409
24258
|
ok: false,
|
|
24410
24259
|
reason: `terminal artifact JSON value is not a typed object (${Array.isArray(body) ? "array" : typeof body})`
|
|
@@ -25061,9 +24910,6 @@ function classifyPackagedRoleTerminalResult(message) {
|
|
|
25061
24910
|
}
|
|
25062
24911
|
return { kind: "nonterminal" };
|
|
25063
24912
|
}
|
|
25064
|
-
function isAcceptedPackagedRoleTerminalResult(message) {
|
|
25065
|
-
return classifyPackagedRoleTerminalResult(message).kind === "accepted";
|
|
25066
|
-
}
|
|
25067
24913
|
function durableTerminalAt(entries, index) {
|
|
25068
24914
|
const entry = entries[index];
|
|
25069
24915
|
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;
|
|
@@ -25110,11 +24956,11 @@ var init_navigator_invocation_identity = __esm({
|
|
|
25110
24956
|
});
|
|
25111
24957
|
|
|
25112
24958
|
// src/receipt-delivery-policy.ts
|
|
25113
|
-
function
|
|
24959
|
+
function isRecord16(value) {
|
|
25114
24960
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25115
24961
|
}
|
|
25116
24962
|
function parseNoReceiptLifecycleFacts(input) {
|
|
25117
|
-
if (!
|
|
24963
|
+
if (!isRecord16(input) || typeof input.terminalToolCalled !== "boolean" || input.deliveryTurns !== RECEIPT_DELIVERY_TURN_LIMIT || input.sessionCompletion !== "settled-without-accepted-receipt" || input.acceptedReceipt !== false || typeof input.runPointer !== "string" || input.runPointer.trim() === "" || typeof input.attemptPointer !== "string" || input.attemptPointer.trim() === "" || !Array.isArray(input.rejectedReceipts) || !input.rejectedReceipts.every((item) => isRecord16(item) && typeof item.reason === "string")) {
|
|
25118
24964
|
throw new TypeError("malformed no-receipt lifecycle facts");
|
|
25119
24965
|
}
|
|
25120
24966
|
return {
|
|
@@ -25680,7 +25526,7 @@ async function readSitianRetainedAuditorProviderStop(sessionFile) {
|
|
|
25680
25526
|
const { records: records2 } = await readSitianRecords(recordFile);
|
|
25681
25527
|
for (let i = records2.length - 1; i >= 0; i -= 1) {
|
|
25682
25528
|
const payload = records2[i]?.payload;
|
|
25683
|
-
if (!
|
|
25529
|
+
if (!isRecord17(payload) || !isRecord17(payload.response)) continue;
|
|
25684
25530
|
if (typeof payload.type === "string") continue;
|
|
25685
25531
|
const stop = sessionProviderStopFromAssistant(payload.response);
|
|
25686
25532
|
if (stop !== void 0) return stop;
|
|
@@ -25717,7 +25563,7 @@ async function readBoundEvidenceChildKnownFailure(sessionFile) {
|
|
|
25717
25563
|
throw sessionReadFailure(error, "failed to read discovered evidence-child session");
|
|
25718
25564
|
}
|
|
25719
25565
|
const header = entries.find((entry) => entry.type === "session");
|
|
25720
|
-
if (!
|
|
25566
|
+
if (!isRecord17(header) || header.parentSession !== sessionFile) continue;
|
|
25721
25567
|
const stop = extractSessionProviderStop(entries);
|
|
25722
25568
|
if (stop === void 0) continue;
|
|
25723
25569
|
const primary = knownFailureFromProviderStop(stop);
|
|
@@ -25749,12 +25595,12 @@ async function loadBoundAuditorVolumes(sessionFile) {
|
|
|
25749
25595
|
return firstLine === RESUME_ENVELOPE;
|
|
25750
25596
|
};
|
|
25751
25597
|
const isResumeEnvelope = (msg) => {
|
|
25752
|
-
if (!
|
|
25598
|
+
if (!isRecord17(msg) || msg.role !== "user") return false;
|
|
25753
25599
|
const text = typeof msg.text === "string" ? msg.text : typeof msg.content === "string" ? msg.content : void 0;
|
|
25754
25600
|
if (isResumeEnvelopeBytes(text)) return true;
|
|
25755
25601
|
const content = msg.content;
|
|
25756
25602
|
if (Array.isArray(content)) {
|
|
25757
|
-
return content.some((p) =>
|
|
25603
|
+
return content.some((p) => isRecord17(p) && (isResumeEnvelopeBytes(p.text) || isResumeEnvelopeBytes(p.content)));
|
|
25758
25604
|
}
|
|
25759
25605
|
return false;
|
|
25760
25606
|
};
|
|
@@ -25786,7 +25632,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
|
|
|
25786
25632
|
throw sessionReadFailure(error, "failed to read discovered auditor session");
|
|
25787
25633
|
}
|
|
25788
25634
|
const header = entries.find((entry) => entry.type === "session");
|
|
25789
|
-
if (!
|
|
25635
|
+
if (!isRecord17(header)) continue;
|
|
25790
25636
|
const bindingIndexes = [];
|
|
25791
25637
|
for (let i = 0; i < entries.length; i += 1) {
|
|
25792
25638
|
const entry = entries[i];
|
|
@@ -25800,7 +25646,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
|
|
|
25800
25646
|
end: idx + 1 < bindingIndexes.length ? bindingIndexes[idx + 1] : entries.length
|
|
25801
25647
|
})) : [{ entry: void 0, start: 0, end: entries.length }];
|
|
25802
25648
|
for (const { entry: bindingEntry, start, end } of bindingPasses) {
|
|
25803
|
-
const bindingParent = bindingEntry !== void 0 &&
|
|
25649
|
+
const bindingParent = bindingEntry !== void 0 && isRecord17(bindingEntry.data) && isRecord17(bindingEntry.data.parent) ? bindingEntry.data.parent : void 0;
|
|
25804
25650
|
const attemptEntryId = typeof bindingParent?.attemptEntryId === "string" ? bindingParent.attemptEntryId : void 0;
|
|
25805
25651
|
const attemptEntryIndex = attemptEntryId === void 0 ? -1 : parentEntries.findIndex((entry) => entry.id === attemptEntryId);
|
|
25806
25652
|
const boundSessionFile = typeof bindingParent?.sessionFile === "string" ? bindingParent.sessionFile : typeof header.parentSession === "string" ? header.parentSession : void 0;
|
|
@@ -25827,11 +25673,11 @@ function complianceFailureFromAuditorVolumes(volumes) {
|
|
|
25827
25673
|
if (stop === void 0) continue;
|
|
25828
25674
|
for (let i = entries.length - 1; i >= 0; i -= 1) {
|
|
25829
25675
|
const entry = entries[i];
|
|
25830
|
-
if (entry?.type !== "custom" || entry.customType !== AUDITOR_COMPLIANCE_FAILURE_ENTRY_TYPE || !
|
|
25831
|
-
const parent =
|
|
25832
|
-
const failure =
|
|
25676
|
+
if (entry?.type !== "custom" || entry.customType !== AUDITOR_COMPLIANCE_FAILURE_ENTRY_TYPE || !isRecord17(entry.data)) continue;
|
|
25677
|
+
const parent = isRecord17(entry.data.parent) ? entry.data.parent : void 0;
|
|
25678
|
+
const failure = isRecord17(entry.data.failure) ? entry.data.failure : void 0;
|
|
25833
25679
|
if (parent?.sessionId !== parentId || parent.sessionFile !== sessionFile || parent.attemptEntryId !== attemptEntryId || failure?.cause !== "provider" && failure?.cause !== "unrecognized") continue;
|
|
25834
|
-
const identity =
|
|
25680
|
+
const identity = isRecord17(failure.identity) ? failure.identity : void 0;
|
|
25835
25681
|
return {
|
|
25836
25682
|
cause: failure.cause === "provider" ? "provider" : "unrecognized",
|
|
25837
25683
|
...identity === void 0 ? {} : { identity: {
|
|
@@ -25839,7 +25685,7 @@ function complianceFailureFromAuditorVolumes(volumes) {
|
|
|
25839
25685
|
...typeof identity.code === "string" || typeof identity.code === "number" ? { code: identity.code } : {}
|
|
25840
25686
|
} },
|
|
25841
25687
|
...typeof failure.diagnostic === "string" ? { diagnostic: failure.diagnostic } : {},
|
|
25842
|
-
...
|
|
25688
|
+
...isRecord17(failure.details) ? { details: failure.details } : {}
|
|
25843
25689
|
};
|
|
25844
25690
|
}
|
|
25845
25691
|
}
|
|
@@ -25886,9 +25732,9 @@ function typedFailedTerminatingToolKnownFailure(entries) {
|
|
|
25886
25732
|
if (classification.kind !== "infrastructure") continue;
|
|
25887
25733
|
if (typeof message.toolCallId !== "string" || typeof message.toolName !== "string") continue;
|
|
25888
25734
|
if (boundRoleToolCallForResult(attemptEntries, i, message, message.toolName) === void 0) continue;
|
|
25889
|
-
const textPart = Array.isArray(message.content) ? message.content.find((part) =>
|
|
25890
|
-
const diagnostic =
|
|
25891
|
-
const details =
|
|
25735
|
+
const textPart = Array.isArray(message.content) ? message.content.find((part) => isRecord17(part) && part.type === "text" && typeof part.text === "string") : void 0;
|
|
25736
|
+
const diagnostic = isRecord17(textPart) ? textPart.text : void 0;
|
|
25737
|
+
const details = isRecord17(message.details) ? message.details : classification.fact;
|
|
25892
25738
|
return {
|
|
25893
25739
|
cause: "activation",
|
|
25894
25740
|
identity: { name: message.toolName, code: message.toolCallId },
|
|
@@ -26046,7 +25892,7 @@ function controlledFailureInputFromResolution(resolution) {
|
|
|
26046
25892
|
} : {}
|
|
26047
25893
|
};
|
|
26048
25894
|
}
|
|
26049
|
-
function
|
|
25895
|
+
function isRecord17(value) {
|
|
26050
25896
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26051
25897
|
}
|
|
26052
25898
|
function safelyRead(object, key) {
|
|
@@ -26065,257 +25911,11 @@ function auditNoReceiptDecisiveFact(candidate) {
|
|
|
26065
25911
|
return {};
|
|
26066
25912
|
}
|
|
26067
25913
|
}
|
|
26068
|
-
function
|
|
26069
|
-
|
|
26070
|
-
|
|
26071
|
-
if (typeof projected.value !== "object" || projected.value === null || Array.isArray(projected.value)) {
|
|
26072
|
-
return { auditUnreadable: projected.value };
|
|
26073
|
-
}
|
|
26074
|
-
return { auditUnreadable: projected.value };
|
|
26075
|
-
}
|
|
26076
|
-
function countersignDecisiveFacts(verdict, countersignStatus) {
|
|
26077
|
-
const facts = { countersignStatus };
|
|
26078
|
-
if (countersignStatus === "continue") {
|
|
26079
|
-
const fix = safelyRead(verdict, "fix");
|
|
26080
|
-
if (fix.readable && isRecord18(fix.value)) {
|
|
26081
|
-
const summary = safelyRead(fix.value, "summary");
|
|
26082
|
-
if (summary.readable && typeof summary.value === "string") {
|
|
26083
|
-
facts.fixSummary = summary.value;
|
|
26084
|
-
}
|
|
26085
|
-
}
|
|
26086
|
-
}
|
|
26087
|
-
if (countersignStatus === "escalate") {
|
|
26088
|
-
const gate = safelyRead(verdict, "decisionGate");
|
|
26089
|
-
if (gate.readable && isRecord18(gate.value)) {
|
|
26090
|
-
const question = safelyRead(gate.value, "question");
|
|
26091
|
-
const options = safelyRead(gate.value, "options");
|
|
26092
|
-
if (question.readable && typeof question.value === "string") {
|
|
26093
|
-
facts.decisionQuestion = question.value;
|
|
26094
|
-
}
|
|
26095
|
-
if (options.readable && Array.isArray(options.value)) {
|
|
26096
|
-
facts.decisionOptions = [...options.value];
|
|
26097
|
-
}
|
|
26098
|
-
}
|
|
26099
|
-
}
|
|
26100
|
-
const note = safelyRead(verdict, "note");
|
|
26101
|
-
if (note.readable && note.value !== void 0) facts.note = note.value;
|
|
26102
|
-
const evidence = safelyRead(verdict, "evidence");
|
|
26103
|
-
if (evidence.readable && evidence.value !== void 0) facts.evidence = evidence.value;
|
|
26104
|
-
return facts;
|
|
26105
|
-
}
|
|
26106
|
-
function judgeDecisiveFacts(verdict, judgeStatus) {
|
|
26107
|
-
const facts = {
|
|
26108
|
-
judgeStatus,
|
|
26109
|
-
...auditNoReceiptDecisiveFact(verdict),
|
|
26110
|
-
...auditUnreadableDecisiveFact(verdict)
|
|
26111
|
-
};
|
|
26112
|
-
const statusBase = judgeStatus;
|
|
26113
|
-
if (statusBase === "continue") {
|
|
26114
|
-
const fix = safelyRead(verdict, "fix");
|
|
26115
|
-
if (fix.readable && isRecord18(fix.value)) {
|
|
26116
|
-
const summary = safelyRead(fix.value, "summary");
|
|
26117
|
-
if (summary.readable && typeof summary.value === "string") {
|
|
26118
|
-
facts.fixSummary = summary.value;
|
|
26119
|
-
}
|
|
26120
|
-
}
|
|
26121
|
-
const classes = safelyRead(verdict, "classes");
|
|
26122
|
-
if (classes.readable && Array.isArray(classes.value)) {
|
|
26123
|
-
try {
|
|
26124
|
-
facts.classes = classes.value.map((entry) => {
|
|
26125
|
-
if (!isRecord18(entry)) throw new Error("unreadable Judge class");
|
|
26126
|
-
return {
|
|
26127
|
-
name: entry.name,
|
|
26128
|
-
owner: entry.owner,
|
|
26129
|
-
boundary: entry.boundary,
|
|
26130
|
-
disposition: entry.disposition
|
|
26131
|
-
};
|
|
26132
|
-
});
|
|
26133
|
-
facts.classCount = classes.value.length;
|
|
26134
|
-
} catch {
|
|
26135
|
-
}
|
|
26136
|
-
}
|
|
26137
|
-
}
|
|
26138
|
-
if (statusBase === "escalate") {
|
|
26139
|
-
const gate = safelyRead(verdict, "decisionGate");
|
|
26140
|
-
if (gate.readable && isRecord18(gate.value)) {
|
|
26141
|
-
const question = safelyRead(gate.value, "question");
|
|
26142
|
-
const options = safelyRead(gate.value, "options");
|
|
26143
|
-
if (question.readable && typeof question.value === "string") {
|
|
26144
|
-
facts.decisionQuestion = question.value;
|
|
26145
|
-
}
|
|
26146
|
-
if (options.readable && Array.isArray(options.value)) {
|
|
26147
|
-
facts.decisionOptions = [...options.value];
|
|
26148
|
-
}
|
|
26149
|
-
}
|
|
26150
|
-
}
|
|
26151
|
-
const note = safelyRead(verdict, "note");
|
|
26152
|
-
if (note.readable && note.value !== void 0) facts.note = note.value;
|
|
26153
|
-
const evidence = safelyRead(verdict, "evidence");
|
|
26154
|
-
if (evidence.readable && evidence.value !== void 0) facts.evidence = evidence.value;
|
|
26155
|
-
return facts;
|
|
26156
|
-
}
|
|
26157
|
-
function coderDecisiveFacts(output) {
|
|
26158
|
-
const candidate = output;
|
|
26159
|
-
const status = safelyRead(candidate, "status");
|
|
26160
|
-
const facts = {};
|
|
26161
|
-
if (status.readable && typeof status.value === "string") facts.coderStatus = status.value;
|
|
26162
|
-
const statusBase = status.readable && typeof status.value === "string" ? status.value : void 0;
|
|
26163
|
-
const remainingScope = safelyRead(candidate, "remainingScope");
|
|
26164
|
-
if (statusBase === "unfinished" && remainingScope.readable && typeof remainingScope.value === "string") facts.remainingScope = remainingScope.value;
|
|
26165
|
-
const reason = safelyRead(candidate, "reason");
|
|
26166
|
-
if (statusBase === "unfinished" && reason.readable && typeof reason.value === "string" && reason.value.trim().length > 0) {
|
|
26167
|
-
facts.reason = reason.value;
|
|
26168
|
-
}
|
|
26169
|
-
const report = safelyRead(candidate, "report");
|
|
26170
|
-
if (report.readable && typeof report.value === "string") facts.reportPresent = report.value.trim().length > 0;
|
|
26171
|
-
return facts;
|
|
26172
|
-
}
|
|
26173
|
-
function fixerDecisiveFacts(output) {
|
|
26174
|
-
const candidate = output;
|
|
26175
|
-
const status = safelyRead(candidate, "status");
|
|
26176
|
-
const facts = {};
|
|
26177
|
-
if (status.readable && typeof status.value === "string") facts.fixerStatus = status.value;
|
|
26178
|
-
const statusBase = status.readable && typeof status.value === "string" ? status.value : void 0;
|
|
26179
|
-
const remainingScope = safelyRead(candidate, "remainingScope");
|
|
26180
|
-
if ((statusBase === "unfinished" || statusBase === "refused") && remainingScope.readable && typeof remainingScope.value === "string") facts.remainingScope = remainingScope.value;
|
|
26181
|
-
const reason = safelyRead(candidate, "reason");
|
|
26182
|
-
if (statusBase === "unfinished" && reason.readable && typeof reason.value === "string" && reason.value.trim().length > 0) {
|
|
26183
|
-
facts.reason = reason.value;
|
|
26184
|
-
}
|
|
26185
|
-
const blockerRead = safelyRead(candidate, "blocker");
|
|
26186
|
-
if (statusBase === "refused" && blockerRead.readable && isRecord18(blockerRead.value)) {
|
|
26187
|
-
const cause = safelyRead(blockerRead.value, "cause");
|
|
26188
|
-
if (cause.readable && typeof cause.value === "string") facts.blockerCause = cause.value;
|
|
26189
|
-
const prerequisiteId = safelyRead(blockerRead.value, "prerequisiteId");
|
|
26190
|
-
if (cause.readable && cause.value === "prerequisite_unmet" && prerequisiteId.readable && typeof prerequisiteId.value === "string") facts.prerequisiteId = prerequisiteId.value;
|
|
26191
|
-
}
|
|
26192
|
-
const classResults = safelyRead(candidate, "classResults");
|
|
26193
|
-
if (classResults.readable && Array.isArray(classResults.value)) {
|
|
26194
|
-
const rows = [];
|
|
26195
|
-
const blockers = [];
|
|
26196
|
-
try {
|
|
26197
|
-
for (const entry of classResults.value) {
|
|
26198
|
-
if (!isRecord18(entry)) throw new Error("unreadable class result");
|
|
26199
|
-
const name = safelyRead(entry, "name");
|
|
26200
|
-
const disposition = safelyRead(entry, "disposition");
|
|
26201
|
-
if (!name.readable || !disposition.readable) throw new Error("unreadable class result");
|
|
26202
|
-
rows.push({ name: name.value, disposition: disposition.value });
|
|
26203
|
-
const blocker = safelyRead(entry, "blocker");
|
|
26204
|
-
if (disposition.value === "refused" && blocker.readable && isRecord18(blocker.value)) blockers.push(blocker.value);
|
|
26205
|
-
}
|
|
26206
|
-
facts.classResultCount = rows.length;
|
|
26207
|
-
facts.classDispositions = rows;
|
|
26208
|
-
const causes = blockers.flatMap((blocker) => {
|
|
26209
|
-
const cause = safelyRead(blocker, "cause");
|
|
26210
|
-
return cause.readable && typeof cause.value === "string" ? [cause.value] : [];
|
|
26211
|
-
});
|
|
26212
|
-
if (causes.length > 0) facts.blockerCauses = causes;
|
|
26213
|
-
const prerequisiteIds = blockers.flatMap((blocker) => {
|
|
26214
|
-
const cause = safelyRead(blocker, "cause");
|
|
26215
|
-
const id = safelyRead(blocker, "prerequisiteId");
|
|
26216
|
-
return cause.readable && cause.value === "prerequisite_unmet" && id.readable && typeof id.value === "string" ? [id.value] : [];
|
|
26217
|
-
});
|
|
26218
|
-
if (prerequisiteIds.length > 0) facts.prerequisiteIds = prerequisiteIds;
|
|
26219
|
-
} catch {
|
|
26220
|
-
}
|
|
26221
|
-
}
|
|
26222
|
-
const report = safelyRead(candidate, "report");
|
|
26223
|
-
if (report.readable && typeof report.value === "string") facts.reportPresent = report.value.trim().length > 0;
|
|
26224
|
-
return facts;
|
|
26225
|
-
}
|
|
26226
|
-
function collectorDecisiveFacts(receipt) {
|
|
26227
|
-
const candidate = receipt;
|
|
26228
|
-
const facts = {};
|
|
26229
|
-
for (const key of ["repository", "prNumber", "targetHead", "manifestDigest"]) {
|
|
26230
|
-
const value = safelyRead(candidate, key);
|
|
26231
|
-
if (value.readable && value.value !== void 0) facts[key] = value.value;
|
|
26232
|
-
}
|
|
26233
|
-
const groups = safelyRead(candidate, "groups");
|
|
26234
|
-
if (groups.readable && Array.isArray(groups.value)) {
|
|
26235
|
-
try {
|
|
26236
|
-
facts.groups = groups.value.map((group) => {
|
|
26237
|
-
if (!isRecord18(group)) throw new Error("unreadable Collector group");
|
|
26238
|
-
const identity = safelyRead(group, "identity");
|
|
26239
|
-
const attendance = safelyRead(group, "attendance");
|
|
26240
|
-
const materials = safelyRead(group, "materials");
|
|
26241
|
-
const findings = safelyRead(group, "findings");
|
|
26242
|
-
if (!identity.readable || !attendance.readable || !materials.readable || !Array.isArray(materials.value) || !findings.readable || !Array.isArray(findings.value)) {
|
|
26243
|
-
throw new Error("unreadable Collector group");
|
|
26244
|
-
}
|
|
26245
|
-
return {
|
|
26246
|
-
identity: identity.value,
|
|
26247
|
-
attendance: attendance.value,
|
|
26248
|
-
materialCount: materials.value.length,
|
|
26249
|
-
findingCount: findings.value.length
|
|
26250
|
-
};
|
|
26251
|
-
});
|
|
26252
|
-
} catch {
|
|
26253
|
-
}
|
|
26254
|
-
}
|
|
26255
|
-
return facts;
|
|
26256
|
-
}
|
|
26257
|
-
function doctorDecisiveFacts(output) {
|
|
26258
|
-
const candidate = output;
|
|
26259
|
-
const status = safelyRead(candidate, "status");
|
|
26260
|
-
const facts = {
|
|
26261
|
-
...auditNoReceiptDecisiveFact(candidate),
|
|
26262
|
-
...auditUnreadableDecisiveFact(candidate)
|
|
26263
|
-
};
|
|
26264
|
-
if (status.readable && typeof status.value === "string") facts.doctorStatus = status.value;
|
|
26265
|
-
const statusBase = status.readable && typeof status.value === "string" ? status.value : void 0;
|
|
26266
|
-
if (statusBase === "refused") {
|
|
26267
|
-
const reason = safelyRead(candidate, "reason");
|
|
26268
|
-
if (reason.readable && reason.value !== void 0) facts.reason = reason.value;
|
|
26269
|
-
const missing = safelyRead(candidate, "missingEvidence");
|
|
26270
|
-
if (missing.readable && Array.isArray(missing.value)) facts.missingEvidenceCount = missing.value.length;
|
|
26271
|
-
return facts;
|
|
26272
|
-
}
|
|
26273
|
-
const caseValue = safelyRead(candidate, "case");
|
|
26274
|
-
if (caseValue.readable && isRecord18(caseValue.value)) {
|
|
26275
|
-
const issueNumber = safelyRead(caseValue.value, "issueNumber");
|
|
26276
|
-
const runsPath = safelyRead(caseValue.value, "runsPath");
|
|
26277
|
-
if (issueNumber.readable && issueNumber.value !== void 0) facts.issueNumber = issueNumber.value;
|
|
26278
|
-
if (runsPath.readable && runsPath.value !== void 0) facts.runsPath = runsPath.value;
|
|
26279
|
-
}
|
|
26280
|
-
const findings = safelyRead(candidate, "findings");
|
|
26281
|
-
if (findings.readable && Array.isArray(findings.value)) facts.findingsCount = findings.value.length;
|
|
26282
|
-
return facts;
|
|
26283
|
-
}
|
|
26284
|
-
function reviewerAxes(value) {
|
|
26285
|
-
if (!isRecord18(value)) return [];
|
|
26286
|
-
return ["standards", "spec"].filter((axis) => {
|
|
26287
|
-
const projected = safelyRead(value, axis);
|
|
26288
|
-
return projected.readable && projected.value !== void 0;
|
|
26289
|
-
});
|
|
26290
|
-
}
|
|
26291
|
-
function reviewerDecisiveFacts(output) {
|
|
26292
|
-
const candidate = output;
|
|
26293
|
-
const status = safelyRead(candidate, "status");
|
|
26294
|
-
const outcomes = safelyRead(candidate, "outcomes");
|
|
26295
|
-
const reports = safelyRead(candidate, "reports");
|
|
26296
|
-
const amendments = safelyRead(candidate, "amendments");
|
|
26297
|
-
const axes = reviewerAxes(outcomes.readable ? outcomes.value : void 0);
|
|
26298
|
-
const reportAxes = reviewerAxes(reports.readable ? reports.value : void 0);
|
|
26299
|
-
const amendmentAxes = reviewerAxes(amendments.readable ? amendments.value : void 0);
|
|
26300
|
-
const acceptedBatch = safelyRead(candidate, "acceptedBatch");
|
|
26301
|
-
const specDisposition = safelyRead(candidate, "specDisposition");
|
|
26302
|
-
const facts = {
|
|
26303
|
-
axes,
|
|
26304
|
-
reportAxes,
|
|
26305
|
-
amendmentAxes,
|
|
26306
|
-
acceptedBatchPresent: acceptedBatch.readable && acceptedBatch.value !== void 0,
|
|
25914
|
+
function withAuditNoReceiptFacts(candidate) {
|
|
25915
|
+
return {
|
|
25916
|
+
...candidate,
|
|
26307
25917
|
...auditNoReceiptDecisiveFact(candidate)
|
|
26308
25918
|
};
|
|
26309
|
-
if (status.readable && typeof status.value === "string") facts.reviewerStatus = status.value;
|
|
26310
|
-
if (specDisposition.readable && (specDisposition.value === "launched" || specDisposition.value === "skipped-missing")) {
|
|
26311
|
-
facts.specDisposition = specDisposition.value;
|
|
26312
|
-
}
|
|
26313
|
-
const diagnostic = safelyRead(candidate, "diagnostic");
|
|
26314
|
-
const statusBase = status.readable && typeof status.value === "string" ? status.value : void 0;
|
|
26315
|
-
if (statusBase === "refused" && diagnostic.readable) {
|
|
26316
|
-
facts.diagnosticPresent = typeof diagnostic.value === "string" && diagnostic.value.trim().length > 0;
|
|
26317
|
-
}
|
|
26318
|
-
return facts;
|
|
26319
25919
|
}
|
|
26320
25920
|
function collectorReceiptBindingFailure(diagnostic) {
|
|
26321
25921
|
const error = new Error(diagnostic);
|
|
@@ -26416,7 +26016,7 @@ function boundRoleToolCallForResult(entries, resultIndex, message, outputToolNam
|
|
|
26416
26016
|
const candidateMessage = entries[index]?.message;
|
|
26417
26017
|
if (candidateMessage?.role === "assistant" && Array.isArray(candidateMessage.content)) {
|
|
26418
26018
|
for (const part of candidateMessage.content) {
|
|
26419
|
-
if (!
|
|
26019
|
+
if (!isRecord17(part) || part.type !== "toolCall" || part.id !== callId) {
|
|
26420
26020
|
continue;
|
|
26421
26021
|
}
|
|
26422
26022
|
if (part.name !== outputToolName) return void 0;
|
|
@@ -26488,7 +26088,7 @@ function parseNavigatorAttendanceDetails(details) {
|
|
|
26488
26088
|
const advisoryDiagnostic = typeof details.routePlaybookReadFailure === "string" ? { advisoryDiagnostic: details.routePlaybookReadFailure } : {};
|
|
26489
26089
|
if (disposition === "recommendation") {
|
|
26490
26090
|
const next = details.next;
|
|
26491
|
-
if (!
|
|
26091
|
+
if (!isRecord17(next) || typeof next.role !== "string") {
|
|
26492
26092
|
return {
|
|
26493
26093
|
disposition: "unavailable",
|
|
26494
26094
|
source: "unknown",
|
|
@@ -26496,7 +26096,7 @@ function parseNavigatorAttendanceDetails(details) {
|
|
|
26496
26096
|
};
|
|
26497
26097
|
}
|
|
26498
26098
|
const reason = typeof details.reason === "string" ? details.reason : "";
|
|
26499
|
-
const route = Array.isArray(details.route) ? details.route.filter(
|
|
26099
|
+
const route = Array.isArray(details.route) ? details.route.filter(isRecord17).map((target) => ({
|
|
26500
26100
|
role: String(target.role),
|
|
26501
26101
|
phase: navigatorPhaseValue(target.phase)
|
|
26502
26102
|
})) : void 0;
|
|
@@ -26568,7 +26168,7 @@ async function extractGateFactFromSessionDirectory(sessionDirectory, options = {
|
|
|
26568
26168
|
}
|
|
26569
26169
|
async function withOptionalGateProjection(base, sessionDirectory, gateContext = {}) {
|
|
26570
26170
|
const secondaryEvidence = base.roleOutcome.kind === "failure" ? base.roleOutcome.decisiveFacts.secondaryEvidence : void 0;
|
|
26571
|
-
if (
|
|
26171
|
+
if (isRecord17(secondaryEvidence) && secondaryEvidence.kind === "role_infrastructure_failure" && (secondaryEvidence.stage === "gatekeeper" || secondaryEvidence.stage === "inspector" || secondaryEvidence.stage === "notary")) return base;
|
|
26572
26172
|
const gate = await extractGateFactFromSessionDirectory(sessionDirectory, gateContext);
|
|
26573
26173
|
return gate === void 0 ? base : { ...base, gate };
|
|
26574
26174
|
}
|
|
@@ -26608,7 +26208,7 @@ function extractNavigatorFact(entries) {
|
|
|
26608
26208
|
const entry = entries[i];
|
|
26609
26209
|
if (entry?.type === "custom_message" && entry.customType === "ak-navigator-attendance") {
|
|
26610
26210
|
const details = entry.message?.details ?? entry.details;
|
|
26611
|
-
if (!
|
|
26211
|
+
if (!isRecord17(details)) {
|
|
26612
26212
|
return {
|
|
26613
26213
|
disposition: "unavailable",
|
|
26614
26214
|
source: "unknown",
|
|
@@ -26767,7 +26367,8 @@ async function readLawfulJudgeRoleOutcome(admitted, authority) {
|
|
|
26767
26367
|
kind: "accepted",
|
|
26768
26368
|
role: "judge",
|
|
26769
26369
|
status: sealed.status,
|
|
26770
|
-
|
|
26370
|
+
// #757: sealed details pass through (judgeStatus already on the receipt).
|
|
26371
|
+
decisiveFacts: withAuditNoReceiptFacts(details)
|
|
26771
26372
|
};
|
|
26772
26373
|
}
|
|
26773
26374
|
return auditEscalationLedgerOutcome(admitted, "judge");
|
|
@@ -26799,17 +26400,8 @@ async function trySettleJudgeTerminalResult(admitted, authority) {
|
|
|
26799
26400
|
async function settleLawfulCoderTerminalResult(admitted, authority, options = {}) {
|
|
26800
26401
|
const ledgerOutcome = await closedLedgerOutcome(admitted, "coder");
|
|
26801
26402
|
if (ledgerOutcome === void 0) return void 0;
|
|
26802
|
-
|
|
26803
|
-
|
|
26804
|
-
if (ledgerOutcome.kind === "accepted") {
|
|
26805
|
-
output = validateAcceptedCoderDetails(ledgerOutcome.decisiveFacts);
|
|
26806
|
-
roleOutcome = {
|
|
26807
|
-
kind: "accepted",
|
|
26808
|
-
role: "coder",
|
|
26809
|
-
status: ledgerOutcome.status,
|
|
26810
|
-
decisiveFacts: coderDecisiveFacts(output)
|
|
26811
|
-
};
|
|
26812
|
-
}
|
|
26403
|
+
const roleOutcome = ledgerOutcome;
|
|
26404
|
+
const output = ledgerOutcome.kind === "accepted" ? ledgerOutcome.decisiveFacts : void 0;
|
|
26813
26405
|
const coordinates = coordinatesFromAdmitted(authority, admitted);
|
|
26814
26406
|
const entries = await readLawfulSettlementEntries(coordinates.sessionFile) ?? [];
|
|
26815
26407
|
const navigator = extractNavigatorFact(entries);
|
|
@@ -26919,17 +26511,8 @@ async function publishFixerArtifacts(admitted, roleOutcome, coordinates, options
|
|
|
26919
26511
|
async function settleLawfulFixerTerminalResult(admitted, authority, options) {
|
|
26920
26512
|
const ledgerOutcome = await closedLedgerOutcome(admitted, "fixer");
|
|
26921
26513
|
if (ledgerOutcome === void 0) return void 0;
|
|
26922
|
-
|
|
26923
|
-
|
|
26924
|
-
if (ledgerOutcome.kind === "accepted") {
|
|
26925
|
-
output = validateFixerOutput(ledgerOutcome.decisiveFacts);
|
|
26926
|
-
roleOutcome = {
|
|
26927
|
-
kind: "accepted",
|
|
26928
|
-
role: "fixer",
|
|
26929
|
-
status: ledgerOutcome.status,
|
|
26930
|
-
decisiveFacts: fixerDecisiveFacts(output)
|
|
26931
|
-
};
|
|
26932
|
-
}
|
|
26514
|
+
const roleOutcome = ledgerOutcome;
|
|
26515
|
+
const output = ledgerOutcome.kind === "accepted" ? ledgerOutcome.decisiveFacts : void 0;
|
|
26933
26516
|
const coordinates = coordinatesFromAdmitted(authority, admitted);
|
|
26934
26517
|
const { sessionDirectory, sessionFile } = coordinates;
|
|
26935
26518
|
const entries = await readLawfulSettlementEntries(sessionFile) ?? [];
|
|
@@ -27023,7 +26606,7 @@ async function settleLawfulCollectorTerminalResult(admitted, authority) {
|
|
|
27023
26606
|
const residual = boundErroredToolCandidate(entries, index, message, COLLECTOR_WAIT_TOOL);
|
|
27024
26607
|
if (residual === void 0) continue;
|
|
27025
26608
|
const candidate = residual.candidate;
|
|
27026
|
-
const duration =
|
|
26609
|
+
const duration = isRecord17(candidate) ? candidate.durationMs : void 0;
|
|
27027
26610
|
if (Number.isSafeInteger(duration) && duration >= 1 && duration <= 9e5) {
|
|
27028
26611
|
continue;
|
|
27029
26612
|
}
|
|
@@ -27040,13 +26623,13 @@ async function settleLawfulCollectorTerminalResult(admitted, authority) {
|
|
|
27040
26623
|
}
|
|
27041
26624
|
return void 0;
|
|
27042
26625
|
}
|
|
27043
|
-
const receipt =
|
|
26626
|
+
const receipt = roleOutcome.decisiveFacts;
|
|
27044
26627
|
assertCollectorReceiptMatchesAdmitted(receipt, admitted);
|
|
27045
26628
|
const accepted = {
|
|
27046
26629
|
kind: "accepted",
|
|
27047
26630
|
role: "collector",
|
|
27048
26631
|
status: roleOutcome.status,
|
|
27049
|
-
decisiveFacts:
|
|
26632
|
+
decisiveFacts: { ...roleOutcome.decisiveFacts }
|
|
27050
26633
|
};
|
|
27051
26634
|
const navigator = extractNavigatorFact(entries);
|
|
27052
26635
|
const artifacts = await publishCollectorArtifacts(
|
|
@@ -27137,12 +26720,12 @@ async function settleLawfulDoctorTerminalResult(admitted, authority) {
|
|
|
27137
26720
|
sessionDirectory
|
|
27138
26721
|
);
|
|
27139
26722
|
}
|
|
27140
|
-
const output =
|
|
26723
|
+
const output = sealed.decisiveFacts;
|
|
27141
26724
|
const roleOutcome = {
|
|
27142
26725
|
kind: "accepted",
|
|
27143
26726
|
role: "doctor",
|
|
27144
26727
|
status: sealed.status,
|
|
27145
|
-
decisiveFacts:
|
|
26728
|
+
decisiveFacts: { ...sealed.decisiveFacts }
|
|
27146
26729
|
};
|
|
27147
26730
|
if (String(output.status) === "completed") {
|
|
27148
26731
|
const completedCase = output.case;
|
|
@@ -27203,7 +26786,6 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
27203
26786
|
}
|
|
27204
26787
|
if (roleOutcome?.role !== spec.role) {
|
|
27205
26788
|
const scanStart = currentAttemptStartIndex(entries);
|
|
27206
|
-
let acceptedNonUsable;
|
|
27207
26789
|
for (let index = entries.length - 1; index >= scanStart; index -= 1) {
|
|
27208
26790
|
const message = entries[index]?.message;
|
|
27209
26791
|
if (message?.role !== "toolResult") continue;
|
|
@@ -27214,39 +26796,17 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
27214
26796
|
spec.toolName
|
|
27215
26797
|
);
|
|
27216
26798
|
if (residual !== void 0) {
|
|
26799
|
+
const details = isRecord17(residual.candidate) ? residual.candidate : { candidate: residual.candidate };
|
|
27217
26800
|
return settleFailureTerminalResult(admitted, {
|
|
27218
26801
|
cause: "output",
|
|
27219
26802
|
diagnostic: residual.diagnostic,
|
|
27220
|
-
details
|
|
26803
|
+
details
|
|
27221
26804
|
}, authority);
|
|
27222
26805
|
}
|
|
27223
|
-
if (acceptedNonUsable === void 0 && message.toolName === spec.toolName && isAcceptedPackagedRoleTerminalResult(message)) {
|
|
27224
|
-
if (!spec.tryAcceptDetails(message.details)) {
|
|
27225
|
-
acceptedNonUsable = message.details;
|
|
27226
|
-
}
|
|
27227
|
-
}
|
|
27228
|
-
}
|
|
27229
|
-
if (acceptedNonUsable !== void 0) {
|
|
27230
|
-
return settleFailureTerminalResult(admitted, {
|
|
27231
|
-
cause: "output",
|
|
27232
|
-
diagnostic: spec.nonUsableDiagnostic,
|
|
27233
|
-
details: stampShapeUnreadableDetails(acceptedNonUsable)
|
|
27234
|
-
}, authority);
|
|
27235
26806
|
}
|
|
27236
26807
|
return void 0;
|
|
27237
26808
|
}
|
|
27238
|
-
|
|
27239
|
-
return settleFailureTerminalResult(
|
|
27240
|
-
admitted,
|
|
27241
|
-
{
|
|
27242
|
-
cause: "output",
|
|
27243
|
-
diagnostic: spec.nonUsableDiagnostic,
|
|
27244
|
-
details: stampShapeUnreadableDetails(roleOutcome.decisiveFacts)
|
|
27245
|
-
},
|
|
27246
|
-
authority
|
|
27247
|
-
);
|
|
27248
|
-
}
|
|
27249
|
-
const acceptedOutcome = spec.projectAccepted(roleOutcome);
|
|
26809
|
+
const acceptedOutcome = roleOutcome;
|
|
27250
26810
|
const navigator = extractNavigatorFact(entries);
|
|
27251
26811
|
return withOptionalGateProjection(
|
|
27252
26812
|
{
|
|
@@ -27258,32 +26818,10 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
27258
26818
|
sessionDirectory
|
|
27259
26819
|
);
|
|
27260
26820
|
}
|
|
27261
|
-
function tryAcceptWithValidator(validate) {
|
|
27262
|
-
return (details) => {
|
|
27263
|
-
try {
|
|
27264
|
-
validate(details);
|
|
27265
|
-
return true;
|
|
27266
|
-
} catch {
|
|
27267
|
-
return false;
|
|
27268
|
-
}
|
|
27269
|
-
};
|
|
27270
|
-
}
|
|
27271
26821
|
async function settleLawfulNotaryTerminalResult(admitted, authority, scope) {
|
|
27272
26822
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27273
26823
|
role: "notary",
|
|
27274
|
-
toolName: NOTARY_OUTPUT_TOOL_NAME
|
|
27275
|
-
nonUsableDiagnostic: "\u7B26\u5B9D\u90CE\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
|
|
27276
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedNotaryOutput),
|
|
27277
|
-
projectAccepted: (sealed) => {
|
|
27278
|
-
const output = validateRecordedNotaryOutput(sealed.decisiveFacts);
|
|
27279
|
-
const accepted = {
|
|
27280
|
-
kind: "accepted",
|
|
27281
|
-
role: "notary",
|
|
27282
|
-
status: sealed.status,
|
|
27283
|
-
decisiveFacts: notaryDecisiveFacts(output)
|
|
27284
|
-
};
|
|
27285
|
-
return accepted;
|
|
27286
|
-
}
|
|
26824
|
+
toolName: NOTARY_OUTPUT_TOOL_NAME
|
|
27287
26825
|
}, scope);
|
|
27288
26826
|
}
|
|
27289
26827
|
async function trySettleNotaryTerminalResult(admitted, authority, scope) {
|
|
@@ -27292,19 +26830,7 @@ async function trySettleNotaryTerminalResult(admitted, authority, scope) {
|
|
|
27292
26830
|
async function settleLawfulCountersignTerminalResult(admitted, authority, scope) {
|
|
27293
26831
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27294
26832
|
role: "countersign",
|
|
27295
|
-
toolName: COUNTERSIGN_OUTPUT_TOOL_NAME
|
|
27296
|
-
nonUsableDiagnostic: "\u7ED9\u4E8B\u4E2D\u56DE\u6267\u65E0\u663E\u5F0F \u7F72/\u5C01\u9A73/\u4E0A\u5448",
|
|
27297
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedCountersignOutput),
|
|
27298
|
-
projectAccepted: (sealed) => {
|
|
27299
|
-
const verdict = validateRecordedCountersignOutput(sealed.decisiveFacts);
|
|
27300
|
-
const accepted = {
|
|
27301
|
-
kind: "accepted",
|
|
27302
|
-
role: "countersign",
|
|
27303
|
-
status: sealed.status,
|
|
27304
|
-
decisiveFacts: countersignDecisiveFacts(verdict, sealed.status)
|
|
27305
|
-
};
|
|
27306
|
-
return accepted;
|
|
27307
|
-
}
|
|
26833
|
+
toolName: COUNTERSIGN_OUTPUT_TOOL_NAME
|
|
27308
26834
|
}, scope);
|
|
27309
26835
|
}
|
|
27310
26836
|
async function trySettleCountersignTerminalResult(admitted, authority, scope) {
|
|
@@ -27313,19 +26839,7 @@ async function trySettleCountersignTerminalResult(admitted, authority, scope) {
|
|
|
27313
26839
|
async function settleLawfulGleanerLeftTerminalResult(admitted, authority, scope) {
|
|
27314
26840
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27315
26841
|
role: "gleaner-left",
|
|
27316
|
-
toolName: GLEANER_LEFT_OUTPUT_TOOL_NAME
|
|
27317
|
-
nonUsableDiagnostic: "\u5DE6\u62FE\u9057\u56DE\u6267\u65E0\u663E\u5F0F completed",
|
|
27318
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedGleanerLeftOutput),
|
|
27319
|
-
projectAccepted: (sealed) => {
|
|
27320
|
-
const output = validateRecordedGleanerLeftOutput(sealed.decisiveFacts);
|
|
27321
|
-
const accepted = {
|
|
27322
|
-
kind: "accepted",
|
|
27323
|
-
role: "gleaner-left",
|
|
27324
|
-
status: sealed.status,
|
|
27325
|
-
decisiveFacts: gleanerLeftDecisiveFacts(output)
|
|
27326
|
-
};
|
|
27327
|
-
return accepted;
|
|
27328
|
-
}
|
|
26842
|
+
toolName: GLEANER_LEFT_OUTPUT_TOOL_NAME
|
|
27329
26843
|
}, scope);
|
|
27330
26844
|
}
|
|
27331
26845
|
async function trySettleGleanerLeftTerminalResult(admitted, authority, scope) {
|
|
@@ -27334,19 +26848,7 @@ async function trySettleGleanerLeftTerminalResult(admitted, authority, scope) {
|
|
|
27334
26848
|
async function settleLawfulDiaristTerminalResult(admitted, authority, scope) {
|
|
27335
26849
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27336
26850
|
role: "diarist",
|
|
27337
|
-
toolName: DIARIST_OUTPUT_TOOL_NAME
|
|
27338
|
-
nonUsableDiagnostic: "\u8D77\u5C45\u90CE\u56DE\u6267\u65E0\u663E\u5F0F completed",
|
|
27339
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedDiaristOutput),
|
|
27340
|
-
projectAccepted: (sealed) => {
|
|
27341
|
-
const output = validateRecordedDiaristOutput(sealed.decisiveFacts);
|
|
27342
|
-
const accepted = {
|
|
27343
|
-
kind: "accepted",
|
|
27344
|
-
role: "diarist",
|
|
27345
|
-
status: sealed.status,
|
|
27346
|
-
decisiveFacts: diaristDecisiveFacts(output)
|
|
27347
|
-
};
|
|
27348
|
-
return accepted;
|
|
27349
|
-
}
|
|
26851
|
+
toolName: DIARIST_OUTPUT_TOOL_NAME
|
|
27350
26852
|
}, scope);
|
|
27351
26853
|
}
|
|
27352
26854
|
async function trySettleDiaristTerminalResult(admitted, authority, scope) {
|
|
@@ -27355,19 +26857,7 @@ async function trySettleDiaristTerminalResult(admitted, authority, scope) {
|
|
|
27355
26857
|
async function settleLawfulInspectorTerminalResult(admitted, authority, scope) {
|
|
27356
26858
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27357
26859
|
role: "inspector",
|
|
27358
|
-
toolName: INSPECTOR_OUTPUT_TOOL_NAME
|
|
27359
|
-
nonUsableDiagnostic: "\u5BDF\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
|
|
27360
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedInspectorOutput),
|
|
27361
|
-
projectAccepted: (sealed) => {
|
|
27362
|
-
const output = validateRecordedInspectorOutput(sealed.decisiveFacts);
|
|
27363
|
-
const accepted = {
|
|
27364
|
-
kind: "accepted",
|
|
27365
|
-
role: "inspector",
|
|
27366
|
-
status: sealed.status,
|
|
27367
|
-
decisiveFacts: inspectorDecisiveFacts(output)
|
|
27368
|
-
};
|
|
27369
|
-
return accepted;
|
|
27370
|
-
}
|
|
26860
|
+
toolName: INSPECTOR_OUTPUT_TOOL_NAME
|
|
27371
26861
|
}, scope);
|
|
27372
26862
|
}
|
|
27373
26863
|
async function trySettleInspectorTerminalResult(admitted, authority, scope) {
|
|
@@ -27376,19 +26866,7 @@ async function trySettleInspectorTerminalResult(admitted, authority, scope) {
|
|
|
27376
26866
|
async function settleLawfulGatekeeperTerminalResult(admitted, authority, scope) {
|
|
27377
26867
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27378
26868
|
role: "gatekeeper",
|
|
27379
|
-
toolName: GATEKEEPER_OUTPUT_TOOL_NAME
|
|
27380
|
-
nonUsableDiagnostic: "\u95E8\u4E0B\u7701\u51B3\u8BAE\u65E0\u663E\u5F0F dispatch/pass",
|
|
27381
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedGatekeeperOutput),
|
|
27382
|
-
projectAccepted: (sealed) => {
|
|
27383
|
-
const output = validateRecordedGatekeeperOutput(sealed.decisiveFacts);
|
|
27384
|
-
const accepted = {
|
|
27385
|
-
kind: "accepted",
|
|
27386
|
-
role: "gatekeeper",
|
|
27387
|
-
status: output.status,
|
|
27388
|
-
decisiveFacts: gatekeeperDecisiveFacts(output)
|
|
27389
|
-
};
|
|
27390
|
-
return accepted;
|
|
27391
|
-
}
|
|
26869
|
+
toolName: GATEKEEPER_OUTPUT_TOOL_NAME
|
|
27392
26870
|
}, scope);
|
|
27393
26871
|
}
|
|
27394
26872
|
async function trySettleGatekeeperTerminalResult(admitted, authority, scope) {
|
|
@@ -27397,19 +26875,7 @@ async function trySettleGatekeeperTerminalResult(admitted, authority, scope) {
|
|
|
27397
26875
|
async function settleLawfulNavigatorTerminalResult(admitted, authority, scope) {
|
|
27398
26876
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27399
26877
|
role: "navigator",
|
|
27400
|
-
toolName: NAVIGATOR_OUTPUT_TOOL_NAME
|
|
27401
|
-
nonUsableDiagnostic: "\u6E38\u5955\u4F7F\u56DE\u6267\u65E0\u663E\u5F0F\u8DEF\u7EBF\u5EFA\u8BAE",
|
|
27402
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedNavigatorOutput),
|
|
27403
|
-
projectAccepted: (sealed) => {
|
|
27404
|
-
const output = validateRecordedNavigatorOutput(sealed.decisiveFacts);
|
|
27405
|
-
const accepted = {
|
|
27406
|
-
kind: "accepted",
|
|
27407
|
-
role: "navigator",
|
|
27408
|
-
status: "advice",
|
|
27409
|
-
decisiveFacts: navigatorDecisiveFacts(output)
|
|
27410
|
-
};
|
|
27411
|
-
return accepted;
|
|
27412
|
-
}
|
|
26878
|
+
toolName: NAVIGATOR_OUTPUT_TOOL_NAME
|
|
27413
26879
|
}, scope);
|
|
27414
26880
|
}
|
|
27415
26881
|
async function trySettleNavigatorTerminalResult(admitted, authority, scope) {
|
|
@@ -27418,50 +26884,12 @@ async function trySettleNavigatorTerminalResult(admitted, authority, scope) {
|
|
|
27418
26884
|
async function settleLawfulAuditorTerminalResult(admitted, authority, scope) {
|
|
27419
26885
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27420
26886
|
role: "auditor",
|
|
27421
|
-
toolName: AUDITOR_OUTPUT_TOOL_NAME
|
|
27422
|
-
nonUsableDiagnostic: "\u5BA1\u5211\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
|
|
27423
|
-
// Only pass/bounce/escalate are lawful releases. Unreadable mystery status
|
|
27424
|
-
// fails closed with candidate retained for parent ComplianceCandidateUnreadableError.
|
|
27425
|
-
tryAcceptDetails: (details) => projectLawfulAuditorOutput(details) !== void 0,
|
|
27426
|
-
projectAccepted: (sealed) => {
|
|
27427
|
-
const lawful = projectLawfulAuditorOutput(sealed.decisiveFacts);
|
|
27428
|
-
if (lawful === void 0) {
|
|
27429
|
-
throw new Error("auditor projectAccepted requires lawful pass/bounce/escalate");
|
|
27430
|
-
}
|
|
27431
|
-
const accepted = {
|
|
27432
|
-
kind: "accepted",
|
|
27433
|
-
role: "auditor",
|
|
27434
|
-
status: lawful.status,
|
|
27435
|
-
decisiveFacts: auditorDecisiveFacts(lawful)
|
|
27436
|
-
};
|
|
27437
|
-
return accepted;
|
|
27438
|
-
}
|
|
26887
|
+
toolName: AUDITOR_OUTPUT_TOOL_NAME
|
|
27439
26888
|
}, scope);
|
|
27440
26889
|
}
|
|
27441
26890
|
async function trySettleAuditorTerminalResult(admitted, authority, scope) {
|
|
27442
26891
|
return settleLawfulAuditorTerminalResult(admitted, authority, scope);
|
|
27443
26892
|
}
|
|
27444
|
-
async function settleLawfulEvidenceChildTerminalResult(admitted, authority, scope) {
|
|
27445
|
-
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27446
|
-
role: "evidence-child",
|
|
27447
|
-
toolName: EVIDENCE_CHILD_OUTPUT_TOOL_NAME,
|
|
27448
|
-
nonUsableDiagnostic: "\u53D6\u8BC1\u56DE\u6267\u65E0\u62A5\u544A\u6B63\u6587",
|
|
27449
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedEvidenceChildOutput),
|
|
27450
|
-
projectAccepted: (sealed) => {
|
|
27451
|
-
const output = validateRecordedEvidenceChildOutput(sealed.decisiveFacts);
|
|
27452
|
-
const accepted = {
|
|
27453
|
-
kind: "accepted",
|
|
27454
|
-
role: "evidence-child",
|
|
27455
|
-
status: "report",
|
|
27456
|
-
decisiveFacts: evidenceChildDecisiveFacts(output)
|
|
27457
|
-
};
|
|
27458
|
-
return accepted;
|
|
27459
|
-
}
|
|
27460
|
-
}, scope);
|
|
27461
|
-
}
|
|
27462
|
-
async function trySettleEvidenceChildTerminalResult(admitted, authority, scope) {
|
|
27463
|
-
return settleLawfulEvidenceChildTerminalResult(admitted, authority, scope);
|
|
27464
|
-
}
|
|
27465
26893
|
async function trySettleCoderTerminalResult(admitted, authority, options = {}) {
|
|
27466
26894
|
return settleLawfulCoderTerminalResult(admitted, authority, options);
|
|
27467
26895
|
}
|
|
@@ -27546,12 +26974,12 @@ async function settleLawfulReviewerTerminalResult(admitted, authority, options)
|
|
|
27546
26974
|
const coordinates = coordinatesFromAdmitted(authority, admitted);
|
|
27547
26975
|
const { sessionDirectory, sessionFile } = coordinates;
|
|
27548
26976
|
const entries = await readLawfulSettlementEntries(sessionFile) ?? [];
|
|
27549
|
-
const receipt =
|
|
26977
|
+
const receipt = sealed.decisiveFacts;
|
|
27550
26978
|
const roleOutcome = {
|
|
27551
26979
|
kind: "accepted",
|
|
27552
26980
|
role: "reviewer",
|
|
27553
26981
|
status: sealed.status,
|
|
27554
|
-
decisiveFacts:
|
|
26982
|
+
decisiveFacts: { ...sealed.decisiveFacts }
|
|
27555
26983
|
};
|
|
27556
26984
|
const navigator = extractNavigatorFact(entries);
|
|
27557
26985
|
const methodInvocations = extractReviewerMethodInvocations(entries, {
|
|
@@ -27583,19 +27011,6 @@ async function settleLawfulReviewerTerminalResult(admitted, authority, options)
|
|
|
27583
27011
|
async function trySettleReviewerTerminalResult(admitted, authority, options) {
|
|
27584
27012
|
return settleLawfulReviewerTerminalResult(admitted, authority, options);
|
|
27585
27013
|
}
|
|
27586
|
-
function mergerDecisiveFacts(output) {
|
|
27587
|
-
const candidate = output;
|
|
27588
|
-
const facts = {};
|
|
27589
|
-
const status = safelyRead(candidate, "status");
|
|
27590
|
-
const attemptId = safelyRead(candidate, "attemptId");
|
|
27591
|
-
if (status.readable && typeof status.value === "string") facts.mergerStatus = status.value;
|
|
27592
|
-
if (attemptId.readable && attemptId.value !== void 0) facts.attemptId = attemptId.value;
|
|
27593
|
-
const statusBase = status.readable && typeof status.value === "string" ? status.value : void 0;
|
|
27594
|
-
const decisiveKey = statusBase === "completed" ? "mergeCommitId" : "diagnosis";
|
|
27595
|
-
const decisive = safelyRead(candidate, decisiveKey);
|
|
27596
|
-
if (decisive.readable && decisive.value !== void 0) facts[decisiveKey] = decisive.value;
|
|
27597
|
-
return facts;
|
|
27598
|
-
}
|
|
27599
27014
|
function extractMergerMethodInvocations(entries, options) {
|
|
27600
27015
|
const observed = [];
|
|
27601
27016
|
for (const entry of entries) {
|
|
@@ -27683,31 +27098,27 @@ async function settleLawfulMergerTerminalResult(admitted, authority, options) {
|
|
|
27683
27098
|
if (message?.role !== "toolResult") continue;
|
|
27684
27099
|
const residual = boundErroredToolCandidate(entries, index, message, MERGER_OUTPUT_TOOL_NAME);
|
|
27685
27100
|
if (residual === void 0) continue;
|
|
27686
|
-
const attemptId =
|
|
27101
|
+
const attemptId = isRecord17(residual.candidate) ? safelyRead(residual.candidate, "attemptId") : { readable: true, value: void 0 };
|
|
27687
27102
|
if (!attemptId.readable || attemptId.value !== admitted.runId) continue;
|
|
27688
|
-
|
|
27689
|
-
|
|
27690
|
-
|
|
27691
|
-
|
|
27692
|
-
|
|
27693
|
-
|
|
27694
|
-
|
|
27695
|
-
|
|
27696
|
-
|
|
27697
|
-
|
|
27698
|
-
artifacts: [],
|
|
27699
|
-
runId: admitted.runId
|
|
27700
|
-
};
|
|
27701
|
-
}
|
|
27103
|
+
return {
|
|
27104
|
+
roleOutcome: buildResidualIncompleteTerminalOutcome({
|
|
27105
|
+
role: "merger",
|
|
27106
|
+
candidate: residual.candidate,
|
|
27107
|
+
diagnostic: residual.diagnostic
|
|
27108
|
+
}),
|
|
27109
|
+
navigator: { disposition: "no-advice" },
|
|
27110
|
+
artifacts: [],
|
|
27111
|
+
runId: admitted.runId
|
|
27112
|
+
};
|
|
27702
27113
|
}
|
|
27703
27114
|
return void 0;
|
|
27704
27115
|
}
|
|
27705
|
-
const output =
|
|
27116
|
+
const output = roleOutcome.decisiveFacts;
|
|
27706
27117
|
const accepted = {
|
|
27707
27118
|
kind: "accepted",
|
|
27708
27119
|
role: "merger",
|
|
27709
27120
|
status: roleOutcome.status,
|
|
27710
|
-
decisiveFacts:
|
|
27121
|
+
decisiveFacts: { ...roleOutcome.decisiveFacts }
|
|
27711
27122
|
};
|
|
27712
27123
|
const methodInvocations = extractMergerMethodInvocations(entries, {
|
|
27713
27124
|
allowedLocations: [
|
|
@@ -28041,7 +27452,6 @@ var init_settlement = __esm({
|
|
|
28041
27452
|
init_auditor_soul();
|
|
28042
27453
|
init_doctor_auditor();
|
|
28043
27454
|
init_judge_auditor();
|
|
28044
|
-
init_shape_unreadable_failure();
|
|
28045
27455
|
init_known_failure();
|
|
28046
27456
|
init_reviewer_dispatch_rejection();
|
|
28047
27457
|
init_run_lifecycle();
|
|
@@ -28063,7 +27473,6 @@ var init_settlement = __esm({
|
|
|
28063
27473
|
init_gatekeeper_output();
|
|
28064
27474
|
init_navigator_output();
|
|
28065
27475
|
init_auditor_output();
|
|
28066
|
-
init_evidence_child_output();
|
|
28067
27476
|
init_method_skill();
|
|
28068
27477
|
init_navigator_invocation_identity();
|
|
28069
27478
|
init_receipt_delivery_policy();
|
|
@@ -29328,8 +28737,6 @@ function instructionSeatAdapters(options) {
|
|
|
29328
28737
|
return trySettleNavigatorTerminalResult(admitted, authority, scope);
|
|
29329
28738
|
case "auditor":
|
|
29330
28739
|
return trySettleAuditorTerminalResult(admitted, authority, scope);
|
|
29331
|
-
case "evidence-child":
|
|
29332
|
-
return trySettleEvidenceChildTerminalResult(admitted, authority, scope);
|
|
29333
28740
|
}
|
|
29334
28741
|
},
|
|
29335
28742
|
// Accepted receipts and failure terminals both present via shared path.
|
|
@@ -29358,8 +28765,6 @@ async function admitInstructionSeat(role, options) {
|
|
|
29358
28765
|
return admitNavigatorInvocation(options);
|
|
29359
28766
|
case "auditor":
|
|
29360
28767
|
return admitAuditorInvocation(options);
|
|
29361
|
-
case "evidence-child":
|
|
29362
|
-
return admitEvidenceChildInvocation(options);
|
|
29363
28768
|
}
|
|
29364
28769
|
}
|
|
29365
28770
|
async function runPublicInstructionSeatResume(request, env, io) {
|
|
@@ -31746,7 +31151,7 @@ function isMissingPathError5(error) {
|
|
|
31746
31151
|
function errorText3(error) {
|
|
31747
31152
|
return error instanceof Error ? error.message : String(error);
|
|
31748
31153
|
}
|
|
31749
|
-
function
|
|
31154
|
+
function isRecord18(value) {
|
|
31750
31155
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31751
31156
|
}
|
|
31752
31157
|
async function readExistingRunLifecycleState(runDirectory) {
|
|
@@ -31754,7 +31159,7 @@ async function readExistingRunLifecycleState(runDirectory) {
|
|
|
31754
31159
|
const raw = JSON.parse(
|
|
31755
31160
|
await readFile18(join31(runDirectory, "run-state.json"), "utf8")
|
|
31756
31161
|
);
|
|
31757
|
-
if (!
|
|
31162
|
+
if (!isRecord18(raw) || typeof raw.state !== "string") return void 0;
|
|
31758
31163
|
return raw.state;
|
|
31759
31164
|
} catch {
|
|
31760
31165
|
return void 0;
|
|
@@ -31790,7 +31195,7 @@ async function readInvocationScopeFields(runDirectory) {
|
|
|
31790
31195
|
throw error;
|
|
31791
31196
|
}
|
|
31792
31197
|
const parsed = JSON.parse(raw);
|
|
31793
|
-
if (!
|
|
31198
|
+
if (!isRecord18(parsed)) return void 0;
|
|
31794
31199
|
if (typeof parsed.projectRoot !== "string" || parsed.projectRoot.trim() === "") {
|
|
31795
31200
|
return void 0;
|
|
31796
31201
|
}
|
|
@@ -31818,7 +31223,7 @@ async function resolveSessionFile(runDirectory) {
|
|
|
31818
31223
|
try {
|
|
31819
31224
|
const raw = await readFile18(join31(runDirectory, "invocation.json"), "utf8");
|
|
31820
31225
|
const parsed = JSON.parse(raw);
|
|
31821
|
-
if (
|
|
31226
|
+
if (isRecord18(parsed) && typeof parsed.sessionFile === "string" && parsed.sessionFile.trim() !== "") {
|
|
31822
31227
|
return parsed.sessionFile;
|
|
31823
31228
|
}
|
|
31824
31229
|
} catch (error) {
|
|
@@ -32123,7 +31528,7 @@ var init_analyst_ledger = __esm({
|
|
|
32123
31528
|
});
|
|
32124
31529
|
|
|
32125
31530
|
// src/analyst-metric-families/acceptance-success-rework.ts
|
|
32126
|
-
function
|
|
31531
|
+
function isRecord19(value) {
|
|
32127
31532
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32128
31533
|
}
|
|
32129
31534
|
function wallMsFromSpan(span) {
|
|
@@ -32132,21 +31537,21 @@ function wallMsFromSpan(span) {
|
|
|
32132
31537
|
function findCollectorGroups(body) {
|
|
32133
31538
|
if (Array.isArray(body.groups)) return body.groups;
|
|
32134
31539
|
const receipt = body.receipt;
|
|
32135
|
-
if (
|
|
31540
|
+
if (isRecord19(receipt) && Array.isArray(receipt.groups)) return receipt.groups;
|
|
32136
31541
|
const outcome = body.outcome;
|
|
32137
|
-
if (
|
|
31542
|
+
if (isRecord19(outcome)) {
|
|
32138
31543
|
const facts = outcome.decisiveFacts;
|
|
32139
|
-
if (
|
|
31544
|
+
if (isRecord19(facts) && Array.isArray(facts.groups)) return facts.groups;
|
|
32140
31545
|
}
|
|
32141
31546
|
return void 0;
|
|
32142
31547
|
}
|
|
32143
31548
|
function extractStatus(body) {
|
|
32144
31549
|
const outcome = body.outcome;
|
|
32145
|
-
if (
|
|
31550
|
+
if (isRecord19(outcome) && typeof outcome.status === "string" && outcome.status.trim() !== "") {
|
|
32146
31551
|
return outcome.status;
|
|
32147
31552
|
}
|
|
32148
31553
|
const receipt = body.receipt;
|
|
32149
|
-
if (
|
|
31554
|
+
if (isRecord19(receipt) && typeof receipt.status === "string" && receipt.status.trim() !== "") {
|
|
32150
31555
|
return receipt.status;
|
|
32151
31556
|
}
|
|
32152
31557
|
if (typeof body.status === "string" && body.status.trim() !== "") {
|
|
@@ -32771,21 +32176,21 @@ var init_leg_wall_clock = __esm({
|
|
|
32771
32176
|
});
|
|
32772
32177
|
|
|
32773
32178
|
// src/analyst-metric-families/round-timeline.ts
|
|
32774
|
-
function
|
|
32179
|
+
function isRecord20(value) {
|
|
32775
32180
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32776
32181
|
}
|
|
32777
32182
|
function wallMsFromSpan2(startedAt, endedAt) {
|
|
32778
32183
|
return Date.parse(endedAt) - Date.parse(startedAt);
|
|
32779
32184
|
}
|
|
32780
32185
|
function readOutcomeStatus(body) {
|
|
32781
|
-
if (!
|
|
32186
|
+
if (!isRecord20(body.outcome)) return void 0;
|
|
32782
32187
|
const status = body.outcome.status;
|
|
32783
32188
|
if (typeof status !== "string" || status.trim() === "") return void 0;
|
|
32784
32189
|
return status;
|
|
32785
32190
|
}
|
|
32786
32191
|
function readClassCount(body) {
|
|
32787
|
-
if (!
|
|
32788
|
-
if (!
|
|
32192
|
+
if (!isRecord20(body.outcome)) return void 0;
|
|
32193
|
+
if (!isRecord20(body.outcome.decisiveFacts)) return void 0;
|
|
32789
32194
|
const classCount = body.outcome.decisiveFacts.classCount;
|
|
32790
32195
|
if (typeof classCount !== "number" || !Number.isFinite(classCount)) {
|
|
32791
32196
|
return void 0;
|
|
@@ -34425,7 +33830,7 @@ async function runAkRole(argv, env) {
|
|
|
34425
33830
|
...result2.terminal === void 0 ? {} : { terminal: result2.terminal }
|
|
34426
33831
|
};
|
|
34427
33832
|
}
|
|
34428
|
-
if (parsed.command === "gatekeeper" || parsed.command === "navigator" || parsed.command === "auditor"
|
|
33833
|
+
if (parsed.command === "gatekeeper" || parsed.command === "navigator" || parsed.command === "auditor") {
|
|
34429
33834
|
const agentDir = resolveAgentDir(env, home);
|
|
34430
33835
|
const cwd = env.cwd ?? process.cwd();
|
|
34431
33836
|
const config = await loadAndValidateConfig(home, env.packageRoot);
|
|
@@ -34527,7 +33932,6 @@ var init_cli = __esm({
|
|
|
34527
33932
|
gatekeeper: { seat: "gatekeeper", run: runPublicInstructionSeatResume },
|
|
34528
33933
|
navigator: { seat: "navigator", run: runPublicInstructionSeatResume },
|
|
34529
33934
|
auditor: { seat: "auditor", run: runPublicInstructionSeatResume },
|
|
34530
|
-
"evidence-child": { seat: "evidence-child", run: runPublicInstructionSeatResume },
|
|
34531
33935
|
diarist: { seat: "diarist", run: runPublicDiaristResume }
|
|
34532
33936
|
};
|
|
34533
33937
|
PUBLIC_ROLE_ARGV = {
|
|
@@ -34545,7 +33949,6 @@ var init_cli = __esm({
|
|
|
34545
33949
|
gatekeeper: { parse: parseGatekeeperArgv, options: optionsForOwner("gatekeeper") },
|
|
34546
33950
|
navigator: { parse: parseNavigatorArgv, options: optionsForOwner("navigator") },
|
|
34547
33951
|
auditor: { parse: parseAuditorArgv, options: optionsForOwner("auditor") },
|
|
34548
|
-
"evidence-child": { parse: parseEvidenceChildArgv, options: optionsForOwner("evidence-child") },
|
|
34549
33952
|
diarist: { parse: parseDiaristArgv, options: optionsForOwner("diarist") },
|
|
34550
33953
|
/** Deterministic analysis seat (#336) — argv parse only; no LLM admission. */
|
|
34551
33954
|
analyst: { parse: parseAnalystArgv, options: optionsForOwner("analyst") }
|