@akagilnc/pi-workflow-roles 0.1.4321 → 0.1.4363
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 +81 -99
- package/dist/doctor-contracts.js +2 -2
- package/dist/headless-host/production-host.js +81 -99
- package/dist/merger-contracts.js +2 -2
- package/dist/migrate-book-topology.js +13 -8
- package/dist/notary-contracts.js +2 -2
- package/dist/package-contracts/auditor-output.js +2 -2
- package/dist/package-contracts/fixer-output.js +2 -2
- package/dist/package-contracts/gatekeeper-output.js +2 -2
- package/dist/package-contracts/navigator-output.js +2 -2
- package/dist/package-contracts/terminating-infrastructure.js +7 -2
- package/dist/public-cli/case-dossier-delivery.js +45 -28
- package/dist/public-cli/main.js +71 -89
- package/dist/public-cli/post-admission.js +41 -41
- package/dist/public-cli/settlement.js +3 -53
- package/dist/sitian-appender.js +21 -4
- package/package.json +1 -1
- package/src/collector-tool-schemas.ts +2 -2
- package/src/countersign-role.ts +2 -2
- package/src/diarist-role.ts +2 -2
- package/src/doctor-contracts.ts +2 -2
- package/src/gleaner-left-role.ts +2 -2
- package/src/inspector-role.ts +2 -2
- package/src/judge-role.ts +2 -2
- package/src/merger-contracts.ts +2 -2
- package/src/notary-contracts.ts +2 -2
- package/src/package-contracts/auditor-output.ts +2 -2
- package/src/package-contracts/fixer-output.ts +2 -2
- package/src/package-contracts/gatekeeper-output.ts +2 -2
- package/src/package-contracts/navigator-output.ts +2 -2
- package/src/package-contracts/terminating-infrastructure.ts +13 -3
- package/src/public-cli/case-dossier-delivery.ts +48 -29
- package/src/public-cli/post-admission.ts +42 -50
- package/src/public-cli/settlement.ts +3 -53
- package/src/reviewer-role.ts +2 -2
- package/src/sitian-appender.ts +36 -3
- package/src/worker-role.ts +2 -2
|
@@ -1246,10 +1246,15 @@ var init_open_tool_schema = __esm({
|
|
|
1246
1246
|
|
|
1247
1247
|
// src/package-contracts/terminating-infrastructure.ts
|
|
1248
1248
|
import { Type as Type3 } from "typebox";
|
|
1249
|
-
function
|
|
1249
|
+
function withTerminatingOutputDeclarations(schema) {
|
|
1250
1250
|
const baseProperties = schema.properties;
|
|
1251
1251
|
const properties = {
|
|
1252
1252
|
...baseProperties ?? {},
|
|
1253
|
+
...baseProperties?.ticketNumber === void 0 ? {
|
|
1254
|
+
ticketNumber: Type3.Unknown({
|
|
1255
|
+
description: "\u53EF\u9009\u672C\u7968\u53F7\uFF1A\u5C1A\u672A\u7ED1\u5B9A\u65F6\u7531\u89D2\u8272\u5728\u65E2\u6709\u56DE\u6267\u4E2D\u7533\u62A5\uFF1B\u673A\u68B0\u5C42\u53EA\u8BB0\u5F55\u5408\u6CD5\u6B63\u6574\u6570\uFF0C\u4E0D\u4ECE\u6563\u6587\u63A8\u5BFC\u3001\u4E0D\u9A8C\u771F\u3002\u7F3A\u5931\u6216\u9519\u5F62\u4E0D\u62D2\u6536\u3002"
|
|
1256
|
+
})
|
|
1257
|
+
} : {},
|
|
1253
1258
|
[INFRASTRUCTURE_FAILURE_DECLARATION_KEY]: infrastructureFailureDeclarationSchema.properties[INFRASTRUCTURE_FAILURE_DECLARATION_KEY]
|
|
1254
1259
|
};
|
|
1255
1260
|
const object = Type3.Object(properties, { additionalProperties: true });
|
|
@@ -1343,7 +1348,7 @@ var init_gatekeeper_output = __esm({
|
|
|
1343
1348
|
})
|
|
1344
1349
|
})
|
|
1345
1350
|
);
|
|
1346
|
-
gatekeeperOutputSchema =
|
|
1351
|
+
gatekeeperOutputSchema = withTerminatingOutputDeclarations(
|
|
1347
1352
|
gatekeeperDecisionSchema
|
|
1348
1353
|
);
|
|
1349
1354
|
}
|
|
@@ -1552,7 +1557,7 @@ var init_navigator_output = __esm({
|
|
|
1552
1557
|
init_terminating_infrastructure();
|
|
1553
1558
|
NAVIGATOR_OUTPUT_TOOL_NAME = "ak_navigator_output";
|
|
1554
1559
|
NAVIGATOR_ACCEPTED_TEXT = "\u6E38\u5955\u4F7F\u5EFA\u8BAE\u5DF2\u53D7\u7406";
|
|
1555
|
-
navigatorOutputSchema =
|
|
1560
|
+
navigatorOutputSchema = withTerminatingOutputDeclarations(
|
|
1556
1561
|
openToolObject(
|
|
1557
1562
|
Type5.Object({
|
|
1558
1563
|
status: Type5.Unknown({
|
|
@@ -1650,7 +1655,7 @@ var init_fixer_output = __esm({
|
|
|
1650
1655
|
Type6.Object({ status: Type6.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type6.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type6.Array(classResultSchema, { description: "\u5404\u7C7B\u62D2\u7EDD\u7ED3\u7B97" }) }),
|
|
1651
1656
|
Type6.Object({ status: Type6.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type6.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type6.Array(classResultSchema, { description: "\u5404\u7C7B\u5B8C\u6210\u6216\u62D2\u7EDD\u7ED3\u7B97" }), testEvidence: Type6.Optional(testEvidenceSchema) })
|
|
1652
1657
|
]);
|
|
1653
|
-
fixerOutputSchema =
|
|
1658
|
+
fixerOutputSchema = withTerminatingOutputDeclarations(
|
|
1654
1659
|
openToolObjectFromUnion(fixerOutputVariants)
|
|
1655
1660
|
);
|
|
1656
1661
|
}
|
|
@@ -1816,7 +1821,7 @@ var init_doctor_contracts = __esm({
|
|
|
1816
1821
|
missingEvidence: Type8.Array(Type8.Object({ need: nonblank, targetKeys: evidenceIds }, { additionalProperties: true }), { description: "\u5982\u5B9E\u8BC1\u8BCD\u6240\u9700\u800C\u5C1A\u7F3A\u7684\u8BC1\u636E" })
|
|
1817
1822
|
}, { additionalProperties: false, description: "\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u6848\u8BC1\u8BCD" })
|
|
1818
1823
|
]);
|
|
1819
|
-
doctorSubmissionSchema =
|
|
1824
|
+
doctorSubmissionSchema = withTerminatingOutputDeclarations(
|
|
1820
1825
|
openToolObjectFromUnion(doctorSubmissionVariants)
|
|
1821
1826
|
);
|
|
1822
1827
|
doctorEvidenceReadSchema = Type8.Object({ evidenceId: Type8.String({ minLength: 1, description: "\u5F85\u8BFB\u7559\u5B58\u8BC1\u636E\u6807\u8BC6" }), offset: Type8.Optional(Type8.Integer({ minimum: 0, description: "\u8D77\u59CB\u5B57\u8282\u504F\u79FB\uFF08\u4ECE 0 \u8BA1\uFF09" })), limit: Type8.Optional(Type8.Integer({ minimum: 1, description: "\u8FD4\u56DE\u5B57\u8282\u6570\uFF08\u65E0\u4E0A\u9650\uFF09" })) }, { additionalProperties: true });
|
|
@@ -1934,7 +1939,7 @@ var init_merger_contracts = __esm({
|
|
|
1934
1939
|
Type9.Object({ status: Type9.Unknown({ description: MERGER_STATUS_DESCRIPTION }), attemptId: Type9.String({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }), report: Type9.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), mergeCommitId: Type9.String({ description: "\u5B8C\u6210\u5408\u5E76 commit object ID" }) }, { additionalProperties: false }),
|
|
1935
1940
|
Type9.Object({ status: Type9.Unknown({ description: MERGER_STATUS_DESCRIPTION }), attemptId: Type9.String({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }), diagnosis: Type9.String({ description: "\u5408\u5E76\u65E0\u6CD5\u6216\u4E0D\u5E94\u7531\u672C\u5E2D\u5B8C\u6210\u7684\u539F\u56E0\uFF08\u542B\u65E0\u8FDB\u884C\u4E2D\u5408\u5E76\u3001\u65E0\u6D3B\u53EF\u5E72\u3001\u9700\u65B0\u7684\u4EA7\u54C1/\u6743\u529B\u51B3\u5B9A\uFF09" }), report: Type9.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }) }, { additionalProperties: false })
|
|
1936
1941
|
]);
|
|
1937
|
-
mergerOutputSchema =
|
|
1942
|
+
mergerOutputSchema = withTerminatingOutputDeclarations(openToolObjectFromUnion(mergerOutputVariants));
|
|
1938
1943
|
MERGER_OUTPUT_TOOL_NAME = "ak_merger_output";
|
|
1939
1944
|
MERGER_ACCEPTED_TEXT = "\u5408\u5E76\u56DE\u6267\u5DF2\u63A5\u53D7";
|
|
1940
1945
|
record = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -1975,7 +1980,7 @@ var init_notary_contracts = __esm({
|
|
|
1975
1980
|
}
|
|
1976
1981
|
};
|
|
1977
1982
|
NOTARY_FIXED_KICKOFF = "\u7B26\u5B9D\u90CE\u6848\u5377\u5DF2\u53D7\u7406\uFF1B\u6765\u6E90 run \u5B9A\u4F4D\u89C1\u4F1A\u8BDD\u6750\u6599\u3002";
|
|
1978
|
-
notaryOutputSchema =
|
|
1983
|
+
notaryOutputSchema = withTerminatingOutputDeclarations(
|
|
1979
1984
|
openToolObject(
|
|
1980
1985
|
Type10.Object({
|
|
1981
1986
|
status: Type10.Unknown({
|
|
@@ -2030,7 +2035,7 @@ var init_auditor_output = __esm({
|
|
|
2030
2035
|
init_terminating_infrastructure();
|
|
2031
2036
|
AUDITOR_OUTPUT_TOOL_NAME = "ak_auditor_output";
|
|
2032
2037
|
AUDITOR_ACCEPTED_TEXT = "\u5BA1\u5211\u9662\u56DE\u6267\u5DF2\u63A5\u53D7";
|
|
2033
|
-
auditorOutputSchema =
|
|
2038
|
+
auditorOutputSchema = withTerminatingOutputDeclarations(
|
|
2034
2039
|
openToolObject(
|
|
2035
2040
|
Type11.Object({
|
|
2036
2041
|
status: Type11.Unknown({
|
|
@@ -2704,25 +2709,40 @@ function resolveSitianVolumeCategory(kind) {
|
|
|
2704
2709
|
}
|
|
2705
2710
|
return kind;
|
|
2706
2711
|
}
|
|
2712
|
+
function ticketProvenanceUnderBookPaths(ledgerHome, bookKey, ticketId) {
|
|
2713
|
+
const sessionDir = join10(activationBookDirectory(ledgerHome, bookKey), ticketId);
|
|
2714
|
+
return { sessionDir, recordFile: join10(sessionDir, SITIAN_RECORDS_LEAF) };
|
|
2715
|
+
}
|
|
2707
2716
|
function resolveSitianRecordPathInLedger(input, ledgerHome) {
|
|
2708
2717
|
const category = resolveSitianVolumeCategory(input.kind);
|
|
2709
2718
|
const ticketNumber = category === "ticket-provenance" ? typeof input.subject === "string" && /^[1-9][0-9]*$/.test(input.subject) ? input.subject : typeof input.subject === "object" && typeof input.subject.ticketNumber === "number" && Number.isSafeInteger(input.subject.ticketNumber) && input.subject.ticketNumber > 0 ? String(input.subject.ticketNumber) : void 0 : void 0;
|
|
2710
2719
|
let sessionDir;
|
|
2720
|
+
let recordFile;
|
|
2711
2721
|
if (ticketNumber !== void 0) {
|
|
2712
|
-
const
|
|
2722
|
+
const paths = ticketProvenanceUnderBookPaths(
|
|
2713
2723
|
ledgerHome,
|
|
2714
|
-
resolveBookKeyFromGit(input.cwd ?? process.cwd())
|
|
2724
|
+
resolveBookKeyFromGit(input.cwd ?? process.cwd()),
|
|
2725
|
+
ticketNumber
|
|
2715
2726
|
);
|
|
2716
|
-
sessionDir =
|
|
2727
|
+
sessionDir = paths.sessionDir;
|
|
2728
|
+
recordFile = paths.recordFile;
|
|
2717
2729
|
} else {
|
|
2718
2730
|
if (input.sessionParent === void 0 || input.sessionParent.length === 0 || !physicallyContainedIn(ledgerHome, input.sessionParent)) {
|
|
2719
2731
|
throw new Error("Sitian record ownership requires a parent session inside the ledger home");
|
|
2720
2732
|
}
|
|
2721
2733
|
sessionDir = join10(dirname5(input.sessionParent), category);
|
|
2734
|
+
recordFile = join10(sessionDir, SITIAN_RECORDS_LEAF);
|
|
2722
2735
|
}
|
|
2723
|
-
const recordFile = join10(sessionDir, "records.jsonl");
|
|
2724
2736
|
return { sessionDir, recordFile, ledgerHome };
|
|
2725
2737
|
}
|
|
2738
|
+
function projectTicketRecordsPathShape() {
|
|
2739
|
+
const { recordFile } = ticketProvenanceUnderBookPaths(
|
|
2740
|
+
join10("~", ".ak-roles"),
|
|
2741
|
+
"<\u7C3F>",
|
|
2742
|
+
"<\u7968\u53F7>"
|
|
2743
|
+
);
|
|
2744
|
+
return recordFile.replace(/\\/g, "/");
|
|
2745
|
+
}
|
|
2726
2746
|
function resolveSitianRecordPath(input) {
|
|
2727
2747
|
const ledgerHome = input.home !== void 0 && input.home.length > 0 ? resolveActivationLedgerHome(input.home) : resolveActivationLedgerHomeForPath(input.sessionParent);
|
|
2728
2748
|
return resolveSitianRecordPathInLedger(input, ledgerHome);
|
|
@@ -2759,7 +2779,7 @@ function appendSitianRecord(input) {
|
|
|
2759
2779
|
);
|
|
2760
2780
|
}
|
|
2761
2781
|
}
|
|
2762
|
-
var S4_SUBMISSION_LEDGER_KINDS;
|
|
2782
|
+
var S4_SUBMISSION_LEDGER_KINDS, SITIAN_RECORDS_LEAF;
|
|
2763
2783
|
var init_sitian_appender = __esm({
|
|
2764
2784
|
"src/sitian-appender.ts"() {
|
|
2765
2785
|
"use strict";
|
|
@@ -2773,6 +2793,7 @@ var init_sitian_appender = __esm({
|
|
|
2773
2793
|
"sealed",
|
|
2774
2794
|
"post-seal-anomaly"
|
|
2775
2795
|
]);
|
|
2796
|
+
SITIAN_RECORDS_LEAF = "records.jsonl";
|
|
2776
2797
|
}
|
|
2777
2798
|
});
|
|
2778
2799
|
|
|
@@ -3492,8 +3513,8 @@ async function runComplianceAudit(options) {
|
|
|
3492
3513
|
const subject = options.subject;
|
|
3493
3514
|
const summon = options.summonAuditor ?? (async (auditSubject, sourceRunDirectory, auditSignal, reask2) => {
|
|
3494
3515
|
const { summonPublicRole: summonPublicRole2 } = await Promise.resolve().then(() => (init_public_role_summons(), public_role_summons_exports));
|
|
3495
|
-
const { homeFromRunDirectory:
|
|
3496
|
-
const home =
|
|
3516
|
+
const { homeFromRunDirectory: homeFromRunDirectory2 } = await Promise.resolve().then(() => (init_activation_ledger_topology(), activation_ledger_topology_exports));
|
|
3517
|
+
const home = homeFromRunDirectory2(sourceRunDirectory);
|
|
3497
3518
|
return await summonPublicRole2({
|
|
3498
3519
|
role: "auditor",
|
|
3499
3520
|
argv: [
|
|
@@ -14269,7 +14290,6 @@ __export(settlement_exports, {
|
|
|
14269
14290
|
publishMergerArtifacts: () => publishMergerArtifacts,
|
|
14270
14291
|
publishReviewerArtifacts: () => publishReviewerArtifacts,
|
|
14271
14292
|
raceNavigatorGrace: () => raceNavigatorGrace,
|
|
14272
|
-
readBoundAuditorKnownFailure: () => readBoundAuditorKnownFailure,
|
|
14273
14293
|
readBoundEvidenceChildKnownFailure: () => readBoundEvidenceChildKnownFailure,
|
|
14274
14294
|
readCollectorInfrastructureFailure: () => readCollectorInfrastructureFailure,
|
|
14275
14295
|
readEngineDetourInfrastructureFailure: () => readEngineDetourInfrastructureFailure,
|
|
@@ -14813,32 +14833,6 @@ async function loadBoundAuditorVolumes(sessionFile) {
|
|
|
14813
14833
|
}
|
|
14814
14834
|
const parentId = parentEntries.find((entry) => entry.type === "session")?.id;
|
|
14815
14835
|
if (parentId === void 0) return void 0;
|
|
14816
|
-
const isResumeEnvelopeBytes = (value) => {
|
|
14817
|
-
if (typeof value !== "string") return false;
|
|
14818
|
-
if (value.length === 0) return true;
|
|
14819
|
-
const nl = value.indexOf("\n");
|
|
14820
|
-
const firstLine = nl === -1 ? value : value.slice(0, nl);
|
|
14821
|
-
const body = firstLine === "" && nl !== -1 ? value.slice(nl + 1) : value;
|
|
14822
|
-
return body.startsWith("\u672C\u6B21\u914D\u7F6E\u7684\u52B3\u52A1\u5F15\u64CE\u53CA\u5176\u624B\u518C\uFF1A") || body.startsWith("- engine:");
|
|
14823
|
-
};
|
|
14824
|
-
const isResumeEnvelope = (msg) => {
|
|
14825
|
-
if (!isRecord11(msg) || msg.role !== "user") return false;
|
|
14826
|
-
const text = typeof msg.text === "string" ? msg.text : typeof msg.content === "string" ? msg.content : void 0;
|
|
14827
|
-
if (isResumeEnvelopeBytes(text)) return true;
|
|
14828
|
-
const content = msg.content;
|
|
14829
|
-
if (Array.isArray(content)) {
|
|
14830
|
-
return content.some((p) => isRecord11(p) && (isResumeEnvelopeBytes(p.text) || isResumeEnvelopeBytes(p.content)));
|
|
14831
|
-
}
|
|
14832
|
-
return false;
|
|
14833
|
-
};
|
|
14834
|
-
let latestParentUserIndex = -1;
|
|
14835
|
-
for (let i = parentEntries.length - 1; i >= 0; i -= 1) {
|
|
14836
|
-
const entry = parentEntries[i];
|
|
14837
|
-
if (entry?.type !== "message" || entry.message?.role !== "user") continue;
|
|
14838
|
-
if (isResumeEnvelope(entry.message)) continue;
|
|
14839
|
-
latestParentUserIndex = i;
|
|
14840
|
-
break;
|
|
14841
|
-
}
|
|
14842
14836
|
const childDirectories = [join29(dirname14(sessionFile), "auditor-roles")];
|
|
14843
14837
|
const valid = [];
|
|
14844
14838
|
let sawAnyDirectory = false;
|
|
@@ -14875,12 +14869,9 @@ async function loadBoundAuditorVolumes(sessionFile) {
|
|
|
14875
14869
|
for (const { entry: bindingEntry, start, end } of bindingPasses) {
|
|
14876
14870
|
const bindingParent = bindingEntry !== void 0 && isRecord11(bindingEntry.data) && isRecord11(bindingEntry.data.parent) ? bindingEntry.data.parent : void 0;
|
|
14877
14871
|
const attemptEntryId = typeof bindingParent?.attemptEntryId === "string" ? bindingParent.attemptEntryId : void 0;
|
|
14878
|
-
const attemptEntryIndex = attemptEntryId === void 0 ? -1 : parentEntries.findIndex((entry) => entry.id === attemptEntryId);
|
|
14879
14872
|
const boundSessionFile = typeof bindingParent?.sessionFile === "string" ? bindingParent.sessionFile : typeof header.parentSession === "string" ? header.parentSession : void 0;
|
|
14880
14873
|
if (boundSessionFile !== sessionFile) continue;
|
|
14881
|
-
if (bindingParent !== void 0 &&
|
|
14882
|
-
continue;
|
|
14883
|
-
}
|
|
14874
|
+
if (bindingParent !== void 0 && bindingParent.sessionId !== parentId) continue;
|
|
14884
14875
|
if (bindingParent === void 0 && header.parentSession !== sessionFile) continue;
|
|
14885
14876
|
valid.push({
|
|
14886
14877
|
entries: entries.slice(start, end),
|
|
@@ -14935,11 +14926,6 @@ function providerStopFallbackFromAuditorVolumes(volumes) {
|
|
|
14935
14926
|
}
|
|
14936
14927
|
return void 0;
|
|
14937
14928
|
}
|
|
14938
|
-
async function readBoundAuditorKnownFailure(sessionFile) {
|
|
14939
|
-
const volumes = await loadBoundAuditorVolumes(sessionFile);
|
|
14940
|
-
if (volumes === void 0) return void 0;
|
|
14941
|
-
return complianceFailureFromAuditorVolumes(volumes) ?? providerStopFallbackFromAuditorVolumes(volumes);
|
|
14942
|
-
}
|
|
14943
14929
|
async function readBoundAuditorComplianceFailure(sessionFile) {
|
|
14944
14930
|
const volumes = await loadBoundAuditorVolumes(sessionFile);
|
|
14945
14931
|
if (volumes === void 0) return void 0;
|
|
@@ -17509,11 +17495,14 @@ __export(case_dossier_delivery_exports, {
|
|
|
17509
17495
|
import { mkdtemp as mkdtemp2, readFile as readFile19, rm as rm2, writeFile as writeFile9 } from "node:fs/promises";
|
|
17510
17496
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
17511
17497
|
import { join as join32 } from "node:path";
|
|
17512
|
-
function describeDossierFile(path) {
|
|
17513
|
-
return path;
|
|
17514
|
-
}
|
|
17515
17498
|
async function projectCaseDossierPointerSection(input) {
|
|
17516
|
-
if (input.ticketNumber === void 0)
|
|
17499
|
+
if (input.ticketNumber === void 0) {
|
|
17500
|
+
return [
|
|
17501
|
+
UNBOUND_DOSSIER_PATH_HEADING,
|
|
17502
|
+
"",
|
|
17503
|
+
`\u8BB0\u5F55\u5377\u5B97\uFF1A${projectTicketRecordsPathShape()}`
|
|
17504
|
+
].join("\n");
|
|
17505
|
+
}
|
|
17517
17506
|
const volume = resolveTicketProvenanceVolume(
|
|
17518
17507
|
input.ticketNumber,
|
|
17519
17508
|
input.projectRoot,
|
|
@@ -17523,7 +17512,7 @@ async function projectCaseDossierPointerSection(input) {
|
|
|
17523
17512
|
CASE_DOSSIER_SECTION_HEADING,
|
|
17524
17513
|
"",
|
|
17525
17514
|
`\u7968\u53F7\uFF1A#${input.ticketNumber}`,
|
|
17526
|
-
`\u8BB0\u5F55\u5377\u5B97\uFF1A${
|
|
17515
|
+
`\u8BB0\u5F55\u5377\u5B97\uFF1A${volume.recordFile}`
|
|
17527
17516
|
].join("\n");
|
|
17528
17517
|
}
|
|
17529
17518
|
async function deliverCaseDossierAsAttachment(input) {
|
|
@@ -17532,7 +17521,6 @@ async function deliverCaseDossierAsAttachment(input) {
|
|
|
17532
17521
|
projectRoot: input.projectRoot,
|
|
17533
17522
|
home: input.home
|
|
17534
17523
|
});
|
|
17535
|
-
if (section === void 0) return void 0;
|
|
17536
17524
|
const stagingDir = await mkdtemp2(join32(tmpdir2(), "ak-case-dossier-"));
|
|
17537
17525
|
try {
|
|
17538
17526
|
const stagingPath = join32(stagingDir, CASE_DOSSIER_ATTACH_FILE);
|
|
@@ -17564,13 +17552,15 @@ async function loadCaseDossierReadingMaterial(runDirectory) {
|
|
|
17564
17552
|
if (section.trim() === "") return void 0;
|
|
17565
17553
|
return { kind: "case-dossier-pointer", frozenPath, section };
|
|
17566
17554
|
}
|
|
17567
|
-
var CASE_DOSSIER_SECTION_HEADING, CASE_DOSSIER_ATTACH_KEY, CASE_DOSSIER_ATTACH_FILE;
|
|
17555
|
+
var CASE_DOSSIER_SECTION_HEADING, UNBOUND_DOSSIER_PATH_HEADING, CASE_DOSSIER_ATTACH_KEY, CASE_DOSSIER_ATTACH_FILE;
|
|
17568
17556
|
var init_case_dossier_delivery = __esm({
|
|
17569
17557
|
"src/public-cli/case-dossier-delivery.ts"() {
|
|
17570
17558
|
"use strict";
|
|
17559
|
+
init_sitian_facade();
|
|
17571
17560
|
init_ticket_provenance();
|
|
17572
17561
|
init_invocation();
|
|
17573
17562
|
CASE_DOSSIER_SECTION_HEADING = "## \u672C\u7968\u8D77\u5C45\u5F55\uFF08\u7CFB\u7EDF\u968F\u6848\u63D0\u4F9B\uFF09";
|
|
17563
|
+
UNBOUND_DOSSIER_PATH_HEADING = "## \u8D77\u5C45\u5F55\u8DEF\u5F84\uFF08\u7CFB\u7EDF\u968F\u6848\u63D0\u4F9B\uFF09";
|
|
17574
17564
|
CASE_DOSSIER_ATTACH_KEY = "case-dossier";
|
|
17575
17565
|
CASE_DOSSIER_ATTACH_FILE = "case-dossier-pointer.md";
|
|
17576
17566
|
}
|
|
@@ -18069,12 +18059,6 @@ function describeCaughtError(error) {
|
|
|
18069
18059
|
}
|
|
18070
18060
|
return { message: String(error) };
|
|
18071
18061
|
}
|
|
18072
|
-
function appendContinuationSection(continuation, section) {
|
|
18073
|
-
const prompt = `${continuation.prompt}
|
|
18074
|
-
|
|
18075
|
-
${section}`;
|
|
18076
|
-
return continuation.kind === "initial" ? { kind: "initial", prompt } : { kind: "resume", prompt };
|
|
18077
|
-
}
|
|
18078
18062
|
function isStationChildOfficerDialogue(role, env) {
|
|
18079
18063
|
return env.stationChild === true && isOfficerReviewSeat(role);
|
|
18080
18064
|
}
|
|
@@ -18212,10 +18196,24 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
18212
18196
|
const shouldPresent = adapters.shouldPresentSettled ?? ((terminal) => isLawfulTypedTerminalOutcome(terminal.roleOutcome));
|
|
18213
18197
|
let afterDispatchApplied = false;
|
|
18214
18198
|
const finishAfterTurn = async (result) => {
|
|
18215
|
-
if (
|
|
18199
|
+
if (afterDispatchApplied) return result;
|
|
18216
18200
|
afterDispatchApplied = true;
|
|
18217
18201
|
try {
|
|
18218
|
-
|
|
18202
|
+
if (admitted.ticketNumber === void 0) {
|
|
18203
|
+
const rows = await readRecordedSubmissionRows(
|
|
18204
|
+
admitted.projectRoot,
|
|
18205
|
+
admitted.runId,
|
|
18206
|
+
{ home: homeFromRunDirectory(admitted.runDirectory), sessionParent: join35(admitted.runDirectory, "session", "session.jsonl") }
|
|
18207
|
+
);
|
|
18208
|
+
const asserted = rows.filter((row) => row.kind === "accepted" && row.role === admitted.role).map((row) => row.accepted).find((payload) => {
|
|
18209
|
+
if (payload === null || typeof payload !== "object" || Array.isArray(payload)) return false;
|
|
18210
|
+
const value = payload.ticketNumber;
|
|
18211
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
18212
|
+
});
|
|
18213
|
+
const ticketNumber = asserted === void 0 ? void 0 : asserted.ticketNumber;
|
|
18214
|
+
if (ticketNumber !== void 0) await bindAdmittedTicketNumber(admitted, ticketNumber);
|
|
18215
|
+
}
|
|
18216
|
+
if (adapters.afterDispatch !== void 0) await adapters.afterDispatch(admitted, lease);
|
|
18219
18217
|
return result;
|
|
18220
18218
|
} catch (error) {
|
|
18221
18219
|
const primaryFailure = result.terminal !== void 0 && !isLawfulTypedTerminalOutcome(result.terminal.roleOutcome);
|
|
@@ -18330,29 +18328,12 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
18330
18328
|
if (typeof liveHost === "string" && liveHost.trim() !== "") {
|
|
18331
18329
|
turnRequest = { ...turnRequest, host: liveHost.trim() };
|
|
18332
18330
|
}
|
|
18333
|
-
|
|
18334
|
-
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
});
|
|
18340
|
-
} else {
|
|
18341
|
-
const dossierSection = await projectCaseDossierPointerSection({
|
|
18342
|
-
ticketNumber: admitted.ticketNumber,
|
|
18343
|
-
projectRoot: admitted.projectRoot,
|
|
18344
|
-
home: env.home
|
|
18345
|
-
});
|
|
18346
|
-
if (dossierSection !== void 0) {
|
|
18347
|
-
turnRequest = {
|
|
18348
|
-
...turnRequest,
|
|
18349
|
-
continuation: appendContinuationSection(
|
|
18350
|
-
turnRequest.continuation,
|
|
18351
|
-
dossierSection
|
|
18352
|
-
)
|
|
18353
|
-
};
|
|
18354
|
-
}
|
|
18355
|
-
}
|
|
18331
|
+
await deliverCaseDossierAsAttachment({
|
|
18332
|
+
ticketNumber: admitted.ticketNumber,
|
|
18333
|
+
projectRoot: admitted.projectRoot,
|
|
18334
|
+
home: env.home,
|
|
18335
|
+
runDirectory: admitted.runDirectory
|
|
18336
|
+
});
|
|
18356
18337
|
await markRunRunning(
|
|
18357
18338
|
admitted.runDirectory,
|
|
18358
18339
|
env.model,
|
|
@@ -18940,6 +18921,7 @@ var init_post_admission = __esm({
|
|
|
18940
18921
|
init_run_lifecycle();
|
|
18941
18922
|
init_cli_errors();
|
|
18942
18923
|
init_invocation();
|
|
18924
|
+
init_submission_ledger();
|
|
18943
18925
|
init_activation_ledger_topology();
|
|
18944
18926
|
init_engine_material();
|
|
18945
18927
|
init_session_identity();
|
|
@@ -20288,8 +20270,8 @@ async function summonPublicRole(options) {
|
|
|
20288
20270
|
async function summonGateOfficer(options) {
|
|
20289
20271
|
let home = options.home;
|
|
20290
20272
|
if (home === void 0) {
|
|
20291
|
-
const { homeFromRunDirectory:
|
|
20292
|
-
home =
|
|
20273
|
+
const { homeFromRunDirectory: homeFromRunDirectory2 } = await Promise.resolve().then(() => (init_activation_ledger_topology(), activation_ledger_topology_exports));
|
|
20274
|
+
home = homeFromRunDirectory2(options.sourceRunDirectory);
|
|
20293
20275
|
}
|
|
20294
20276
|
let gateReviewInstruction;
|
|
20295
20277
|
if (options.reask === void 0 && options.submission !== void 0) {
|
|
@@ -21268,7 +21250,7 @@ var collectorOutputBaseSchema = openToolObject(
|
|
|
21268
21250
|
})
|
|
21269
21251
|
})
|
|
21270
21252
|
);
|
|
21271
|
-
var collectorOutputArgsSchema =
|
|
21253
|
+
var collectorOutputArgsSchema = withTerminatingOutputDeclarations(
|
|
21272
21254
|
collectorOutputBaseSchema
|
|
21273
21255
|
);
|
|
21274
21256
|
|
|
@@ -22115,7 +22097,7 @@ init_terminating_infrastructure();
|
|
|
22115
22097
|
init_countersign_contracts();
|
|
22116
22098
|
init_countersign_contracts();
|
|
22117
22099
|
import { Type as Type16 } from "typebox";
|
|
22118
|
-
var countersignVerdictSchema =
|
|
22100
|
+
var countersignVerdictSchema = withTerminatingOutputDeclarations(
|
|
22119
22101
|
Type16.Object(
|
|
22120
22102
|
{
|
|
22121
22103
|
countersignStatus: Type16.Unknown({ description: "converged | continue | escalate\u3002\u975E\u4E09\u6001\u65F6\u8BF7\u91CD\u8BFB\u540E\u91CD\u4EA4\uFF0C\u52FF\u6539\u6807\u3002" }),
|
|
@@ -22158,7 +22140,7 @@ init_terminating_infrastructure();
|
|
|
22158
22140
|
init_gleaner_left_contracts();
|
|
22159
22141
|
init_gleaner_left_contracts();
|
|
22160
22142
|
import { Type as Type17 } from "typebox";
|
|
22161
|
-
var gleanerLeftOutputSchema =
|
|
22143
|
+
var gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
|
|
22162
22144
|
openToolObject(
|
|
22163
22145
|
Type17.Object({
|
|
22164
22146
|
status: Type17.Unknown({
|
|
@@ -22193,7 +22175,7 @@ init_open_tool_schema();
|
|
|
22193
22175
|
init_terminating_infrastructure();
|
|
22194
22176
|
init_inspector_contracts();
|
|
22195
22177
|
import { Type as Type18 } from "typebox";
|
|
22196
|
-
var inspectorOutputSchema =
|
|
22178
|
+
var inspectorOutputSchema = withTerminatingOutputDeclarations(
|
|
22197
22179
|
openToolObject(
|
|
22198
22180
|
Type18.Object({
|
|
22199
22181
|
status: Type18.Unknown({
|
|
@@ -22225,7 +22207,7 @@ init_terminating_infrastructure();
|
|
|
22225
22207
|
init_diarist_contracts();
|
|
22226
22208
|
init_diarist_contracts();
|
|
22227
22209
|
import { Type as Type19 } from "typebox";
|
|
22228
|
-
var diaristOutputSchema =
|
|
22210
|
+
var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
22229
22211
|
openToolObject(
|
|
22230
22212
|
Type19.Object({
|
|
22231
22213
|
status: Type19.Unknown({
|
|
@@ -23364,7 +23346,7 @@ init_judge_output();
|
|
|
23364
23346
|
import { Type as Type22 } from "typebox";
|
|
23365
23347
|
var JUDGE_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "continue", "escalate"]);
|
|
23366
23348
|
var JUDGE_STATUS_REASK = "judgeStatus \u4E0D\u662F converged\u3001continue\u3001escalate \u4E09\u6001\u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
23367
|
-
var judgeVerdictSchema =
|
|
23349
|
+
var judgeVerdictSchema = withTerminatingOutputDeclarations(
|
|
23368
23350
|
Type22.Object(
|
|
23369
23351
|
{
|
|
23370
23352
|
judgeStatus: Type22.Unknown({ description: "converged | continue | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }),
|
|
@@ -23491,7 +23473,7 @@ var reviewerOutputVariants = Type23.Union([
|
|
|
23491
23473
|
amendments: Type23.Optional(reviewerAmendmentsSchema)
|
|
23492
23474
|
}, { additionalProperties: false })
|
|
23493
23475
|
]);
|
|
23494
|
-
var reviewerOutputSchema =
|
|
23476
|
+
var reviewerOutputSchema = withTerminatingOutputDeclarations(
|
|
23495
23477
|
openToolObjectFromUnion(reviewerOutputVariants)
|
|
23496
23478
|
);
|
|
23497
23479
|
function createReviewerRoleRuntime(pi, dependencies, _hostActions) {
|
|
@@ -23828,7 +23810,7 @@ var coderOutputVariants = Type24.Union([
|
|
|
23828
23810
|
}))
|
|
23829
23811
|
}, { additionalProperties: false })
|
|
23830
23812
|
]);
|
|
23831
|
-
var coderOutputSchema =
|
|
23813
|
+
var coderOutputSchema = withTerminatingOutputDeclarations(
|
|
23832
23814
|
openToolObjectFromUnion(coderOutputVariants)
|
|
23833
23815
|
);
|
|
23834
23816
|
var FIXER_FLAG_DEFINITIONS = {
|
package/dist/doctor-contracts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { canonicalJson } from "./canonical-json.js";
|
|
3
3
|
import { openToolObjectFromUnion } from "./open-tool-schema.js";
|
|
4
|
-
import {
|
|
4
|
+
import { withTerminatingOutputDeclarations } from "./package-contracts/terminating-infrastructure.js";
|
|
5
5
|
const DOCTOR_EVIDENCE_TOOL_NAME = "ak_doctor_evidence";
|
|
6
6
|
const DOCTOR_OUTPUT_TOOL_NAME = "ak_doctor_output";
|
|
7
7
|
const DOCTOR_ACCEPTED_TEXT = "\u592A\u533B\u7F72\u56DE\u6267\u5DF2\u63A5\u53D7";
|
|
@@ -41,7 +41,7 @@ const doctorSubmissionVariants = Type.Union([
|
|
|
41
41
|
missingEvidence: Type.Array(Type.Object({ need: nonblank, targetKeys: evidenceIds }, { additionalProperties: true }), { description: "\u5982\u5B9E\u8BC1\u8BCD\u6240\u9700\u800C\u5C1A\u7F3A\u7684\u8BC1\u636E" })
|
|
42
42
|
}, { additionalProperties: false, description: "\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u6848\u8BC1\u8BCD" })
|
|
43
43
|
]);
|
|
44
|
-
const doctorSubmissionSchema =
|
|
44
|
+
const doctorSubmissionSchema = withTerminatingOutputDeclarations(
|
|
45
45
|
openToolObjectFromUnion(doctorSubmissionVariants)
|
|
46
46
|
);
|
|
47
47
|
const doctorEvidenceReadSchema = Type.Object({ evidenceId: Type.String({ minLength: 1, description: "\u5F85\u8BFB\u7559\u5B58\u8BC1\u636E\u6807\u8BC6" }), offset: Type.Optional(Type.Integer({ minimum: 0, description: "\u8D77\u59CB\u5B57\u8282\u504F\u79FB\uFF08\u4ECE 0 \u8BA1\uFF09" })), limit: Type.Optional(Type.Integer({ minimum: 1, description: "\u8FD4\u56DE\u5B57\u8282\u6570\uFF08\u65E0\u4E0A\u9650\uFF09" })) }, { additionalProperties: true });
|