@akagilnc/pi-workflow-roles 0.1.3412 → 0.1.3439
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/archivist-record-entry.js +21 -12
- package/dist/archivist-record-topology.js +20 -0
- package/dist/auditor-dossier-tool.js +67 -76
- package/dist/canonical-json.js +66 -69
- package/dist/compliance-transport.js +99 -86
- package/dist/countersign-contracts.js +23 -25
- package/dist/doctor-contracts.js +169 -145
- package/dist/engine-detour-tool.js +83 -87
- package/dist/engine-detour.js +148 -183
- package/dist/evidence-child-executor.js +10 -1
- package/dist/exact-utf8.js +11 -10
- package/dist/git-object-id.js +10 -5
- package/dist/gleaner-left-contracts.js +33 -35
- package/dist/grok/production-host.js +229 -118
- package/dist/inspector-contracts.js +28 -31
- package/dist/institutional-resolution.js +101 -104
- package/dist/ledger-session-read.js +241 -0
- package/dist/merger-contracts.js +66 -56
- package/dist/notary-contracts.js +91 -100
- package/dist/open-tool-schema.js +32 -31
- package/dist/package-contracts/collector-output.js +56 -43
- package/dist/package-contracts/fixer-output.js +52 -50
- package/dist/package-contracts/fixer-packet.js +67 -64
- package/dist/package-contracts/gatekeeper-output.js +48 -56
- package/dist/package-contracts/judge-output.js +23 -20
- package/dist/package-contracts/navigator-output.js +35 -40
- package/dist/package-contracts/reviewer-output.js +94 -110
- package/dist/package-contracts/terminating-infrastructure.js +62 -90
- package/dist/package-contracts/worker-output.js +30 -11
- package/dist/package-resources/engine-material.js +58 -94
- package/dist/public-cli/config.js +420 -484
- package/dist/public-cli/main.js +1219 -524
- package/dist/public-cli/registry.js +107 -114
- package/dist/receipt-delivery-policy.js +74 -76
- package/dist/session-opening-materials.js +44 -47
- package/dist/sha256.js +5 -3
- package/dist/sitian-appender.js +204 -210
- package/dist/sitian-contracts.js +15 -19
- package/dist/sitian-facade.js +5 -10
- package/dist/sitian-reader.js +37 -46
- package/dist/stream-idle-guard.js +63 -71
- package/dist/ticket-seat-memory.js +244 -0
- package/package.json +1 -1
- package/scripts/build-package.mjs +41 -0
- package/souls/audit-law.md +4 -0
- package/souls/countersign.md +1 -1
- package/souls/gleaner-left.md +1 -1
- package/souls/inspector.md +1 -1
- package/souls/notary.md +1 -1
- package/souls/reviewer.md +1 -1
- package/src/analyst-gate-cycles-read.ts +152 -83
- package/src/analyst-ledger.ts +170 -43
- package/src/archivist-record-entry.ts +32 -11
- package/src/archivist-record-topology.ts +39 -0
- package/src/evidence-child-executor.ts +14 -1
- package/src/grok/production-host.ts +44 -9
- package/src/host-contracts.ts +18 -0
- package/src/host-transition-prior-native.ts +8 -1
- package/src/ledger-session-read.ts +56 -0
- package/src/pi/durable-principal.ts +6 -0
- package/src/public-cli/inspector-run.ts +21 -10
- package/src/public-cli/invocation.ts +4 -20
- package/src/public-cli/notary-run.ts +21 -4
- package/src/public-cli/post-admission.ts +333 -42
- package/src/public-cli/settlement.ts +266 -81
- package/src/session-opening-materials.ts +4 -2
- package/src/ticket-seat-memory.ts +454 -0
|
@@ -2,72 +2,74 @@ import { Type } from "typebox";
|
|
|
2
2
|
import { FIXER_PREREQUISITE_ID_PATTERN } from "./fixer-packet.js";
|
|
3
3
|
import { openToolObjectFromUnion } from "../open-tool-schema.js";
|
|
4
4
|
import { withInfrastructureFailureDeclaration } from "./terminating-infrastructure.js";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const FIXER_OUTPUT_TOOL_NAME = "ak_fixer_output";
|
|
6
|
+
const FIXER_ACCEPTED_TEXT = "\u4FEE\u5185\u53F8\u56DE\u6267\u5DF2\u63A5\u53D7";
|
|
7
7
|
const nonblankTransportString = Type.String({ minLength: 1 });
|
|
8
8
|
const authorityBlockerSchema = Type.Object({ cause: Type.Literal("authority_violation"), evidence: nonblankTransportString });
|
|
9
9
|
const prerequisiteBlockerSchema = Type.Object({ cause: Type.Literal("prerequisite_unmet"), prerequisiteId: Type.String({ pattern: FIXER_PREREQUISITE_ID_PATTERN }), evidence: nonblankTransportString });
|
|
10
10
|
const blockerSchema = Type.Union([authorityBlockerSchema, prerequisiteBlockerSchema]);
|
|
11
11
|
const exceptionSchema = Type.Object({ where: nonblankTransportString, reason: nonblankTransportString });
|
|
12
|
-
/** ⑥ test evidence slip — require submit when diff has test changes; machine does not check existence/completeness/coverage. */
|
|
13
12
|
const testEvidenceSchema = Type.Object({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, { description: "
|
|
13
|
+
contract: Type.String({ minLength: 1, description: "\u6D4B\u8BD5\u6539\u52A8\u6240\u8BC1\u660E\u7684\u5951\u7EA6" }),
|
|
14
|
+
minimumNecessaryCost: Type.String({ minLength: 1, description: "\u6D4B\u8BD5\u6539\u52A8\u7684\u4E00\u884C\u6700\u5C0F\u5FC5\u8981\u6210\u672C" }),
|
|
15
|
+
measuredDuration: Type.String({ minLength: 1, description: "\u805A\u7126\u9A8C\u8BC1\u5B9E\u6D4B\u65F6\u957F" })
|
|
16
|
+
}, { description: "\u6D4B\u8BD5\u8BC1\u636E\u6761\uFF1Bdiff \u542B\u6D4B\u8BD5\u6539\u52A8\u65F6\u63D0\u4EA4\uFF1B\u673A\u5668\u4E0D\u6838\u9A8C\u3002" });
|
|
18
17
|
const completedClassResultSchema = Type.Object({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
name: nonblankTransportString,
|
|
19
|
+
disposition: Type.Literal("completed"),
|
|
20
|
+
searchScope: nonblankTransportString,
|
|
21
|
+
exceptions: Type.Array(exceptionSchema),
|
|
22
|
+
commitSha: nonblankTransportString
|
|
24
23
|
});
|
|
25
24
|
const refusedClassResultSchema = Type.Object({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
name: nonblankTransportString,
|
|
26
|
+
disposition: Type.Literal("refused"),
|
|
27
|
+
remainingScope: nonblankTransportString,
|
|
28
|
+
blocker: blockerSchema
|
|
30
29
|
});
|
|
31
30
|
const classResultSchema = Type.Union([completedClassResultSchema, refusedClassResultSchema]);
|
|
32
31
|
const completedClassResultsSchema = Type.Array(completedClassResultSchema, { minItems: 1 });
|
|
33
32
|
const fixerOutputVariants = Type.Union([
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
Type.Object({ status: Type.Literal("planned", { description: "planned \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }), report: Type.String({ minLength: 1, description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }) }),
|
|
34
|
+
Type.Object({ status: Type.Literal("refused", { description: "refused \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }), report: Type.String({ minLength: 1, description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), remainingScope: Type.String({ minLength: 1, description: "\u4F9D\u6CD5\u4E0D\u80FD\u5B8C\u6210\u7684\u5DE5\u4F5C\u8303\u56F4" }), blocker: Type.Unsafe({ ...blockerSchema, description: "\u5408\u6CD5\u963B\u65AD\u5B8C\u6210\u7684 blocker" }) }),
|
|
35
|
+
Type.Object({ status: Type.Literal("unfinished", { description: "unfinished \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\uFF1B\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u81F4\u672C\u5C40\u672A\u5B8C\u6210\u65F6\u53EF\u7528\u3002\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002" }), report: Type.String({ minLength: 1, description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), remainingScope: Type.String({ minLength: 1, description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }), reason: Type.Optional(Type.String({ minLength: 1, description: "\u963B\u65AD\u539F\u56E0\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u3002\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002" })), classResults: Type.Optional(Type.Unsafe({ ...completedClassResultsSchema, description: "\u672C\u5C40\u5DF2\u5B8C\u6210\u7684 class \u7ED3\u7B97" })), testEvidence: Type.Optional(testEvidenceSchema) }),
|
|
36
|
+
Type.Object({ status: Type.Literal("completed", { description: "completed \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }), report: Type.String({ minLength: 1, description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type.Array(classResultSchema, { minItems: 1, description: "\u5DF2\u5B8C\u6210\u7684 class \u7ED3\u7B97" }), testEvidence: Type.Optional(testEvidenceSchema) }),
|
|
37
|
+
Type.Object({ status: Type.Literal("refused", { description: "refused \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }), report: Type.String({ minLength: 1, description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type.Array(classResultSchema, { minItems: 1, description: "\u5404\u7C7B\u62D2\u7EDD\u7ED3\u7B97" }) }),
|
|
38
|
+
Type.Object({ status: Type.Literal("partially_completed", { description: "partially_completed \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }), report: Type.String({ minLength: 1, description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type.Array(classResultSchema, { minItems: 1, description: "\u5404\u7C7B\u5B8C\u6210\u6216\u62D2\u7EDD\u7ED3\u7B97" }), testEvidence: Type.Optional(testEvidenceSchema) })
|
|
40
39
|
]);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const fixerOutputSchema = withInfrastructureFailureDeclaration(
|
|
41
|
+
openToolObjectFromUnion(fixerOutputVariants)
|
|
42
|
+
);
|
|
43
|
+
function validateFixerOutput(value, _phase) {
|
|
44
|
+
return value;
|
|
44
45
|
}
|
|
45
46
|
function safeProperty(value, property) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
47
|
+
if (value === null || typeof value !== "object") return void 0;
|
|
48
|
+
try {
|
|
49
|
+
return value[property];
|
|
50
|
+
} catch {
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
54
53
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
continue;
|
|
67
|
-
const prerequisiteId = safeProperty(blocker, "prerequisiteId");
|
|
68
|
-
if (typeof prerequisiteId === "string" && !declaredIds.has(prerequisiteId)) {
|
|
69
|
-
throw new Error("Fixer output violates blocker.prerequisiteId declared-prerequisite constraint");
|
|
70
|
-
}
|
|
54
|
+
function validateFixerOutputForPacket(value, phase, packet) {
|
|
55
|
+
const output = validateFixerOutput(value, phase);
|
|
56
|
+
const declaredIds = new Set(packet.prerequisites.map((entry) => entry.id));
|
|
57
|
+
const topLevelBlocker = safeProperty(output, "blocker");
|
|
58
|
+
const classResults = safeProperty(output, "classResults");
|
|
59
|
+
const blockers = topLevelBlocker === void 0 ? Array.isArray(classResults) ? classResults.map((entry) => safeProperty(entry, "blocker")) : [] : [topLevelBlocker];
|
|
60
|
+
for (const blocker of blockers) {
|
|
61
|
+
if (safeProperty(blocker, "cause") !== "prerequisite_unmet") continue;
|
|
62
|
+
const prerequisiteId = safeProperty(blocker, "prerequisiteId");
|
|
63
|
+
if (typeof prerequisiteId === "string" && !declaredIds.has(prerequisiteId)) {
|
|
64
|
+
throw new Error("Fixer output violates blocker.prerequisiteId declared-prerequisite constraint");
|
|
71
65
|
}
|
|
72
|
-
|
|
66
|
+
}
|
|
67
|
+
return output;
|
|
73
68
|
}
|
|
69
|
+
export {
|
|
70
|
+
FIXER_ACCEPTED_TEXT,
|
|
71
|
+
FIXER_OUTPUT_TOOL_NAME,
|
|
72
|
+
fixerOutputSchema,
|
|
73
|
+
validateFixerOutput,
|
|
74
|
+
validateFixerOutputForPacket
|
|
75
|
+
};
|
|
@@ -1,77 +1,80 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { Value } from "typebox/value";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const FIXER_PREREQUISITE_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._-]*$";
|
|
4
|
+
const fixerPrerequisiteSchema = Type.Object({
|
|
5
|
+
id: Type.String({ pattern: FIXER_PREREQUISITE_ID_PATTERN }),
|
|
6
|
+
requirement: Type.String({ pattern: "\\S" })
|
|
7
7
|
}, { additionalProperties: false });
|
|
8
|
-
|
|
8
|
+
const fixerPrerequisitesSchema = Type.Array(fixerPrerequisiteSchema);
|
|
9
9
|
function causeMessage(cause) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
catch {
|
|
18
|
-
return String(cause);
|
|
19
|
-
}
|
|
10
|
+
if (cause instanceof Error) return cause.message;
|
|
11
|
+
if (typeof cause === "string") return cause;
|
|
12
|
+
try {
|
|
13
|
+
return JSON.stringify(cause) ?? String(cause);
|
|
14
|
+
} catch {
|
|
15
|
+
return String(cause);
|
|
16
|
+
}
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
class FixerPacketValidationError extends Error {
|
|
19
|
+
code = "AK_INVALID_FIX_PACKET";
|
|
20
|
+
constructor(cause) {
|
|
21
|
+
const prefix = "Fixer prerequisites or instructions violate the invocation contract";
|
|
22
|
+
super(
|
|
23
|
+
cause === void 0 ? prefix : `${prefix}: ${causeMessage(cause)}`,
|
|
24
|
+
cause === void 0 ? void 0 : { cause }
|
|
25
|
+
);
|
|
26
|
+
this.name = "FixerPacketValidationError";
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
function fail(cause) {
|
|
30
|
-
|
|
30
|
+
throw new FixerPacketValidationError(cause);
|
|
31
31
|
}
|
|
32
32
|
function parseFailure(value) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
fail(new Error("Fixer prerequisite entry must be an object with id and requirement fields"));
|
|
38
|
-
}
|
|
39
|
-
const keys = Object.keys(entry);
|
|
40
|
-
if (keys.length !== 2 || !keys.includes("id") || !keys.includes("requirement")) {
|
|
41
|
-
fail(new Error("Fixer prerequisite entry fields must be exactly id and requirement"));
|
|
42
|
-
}
|
|
43
|
-
if (typeof entry.id !== "string" ||
|
|
44
|
-
!(new RegExp(FIXER_PREREQUISITE_ID_PATTERN)).test(entry.id)) {
|
|
45
|
-
fail(new Error(`Fixer prerequisite id violates pattern ${FIXER_PREREQUISITE_ID_PATTERN}`));
|
|
46
|
-
}
|
|
47
|
-
if (typeof entry.requirement !== "string" ||
|
|
48
|
-
!/\S/.test(entry.requirement)) {
|
|
49
|
-
fail(new Error("Fixer prerequisite requirement must be nonblank"));
|
|
50
|
-
}
|
|
33
|
+
if (!Array.isArray(value)) fail(new Error("Fixer prerequisites must be a JSON array"));
|
|
34
|
+
for (const entry of value) {
|
|
35
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
36
|
+
fail(new Error("Fixer prerequisite entry must be an object with id and requirement fields"));
|
|
51
37
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (!Value.Check(fixerPrerequisitesSchema, value))
|
|
56
|
-
parseFailure(value);
|
|
57
|
-
const entries = value;
|
|
58
|
-
const ids = new Set();
|
|
59
|
-
const prerequisites = entries.map((entry) => {
|
|
60
|
-
if (ids.has(entry.id)) {
|
|
61
|
-
fail(new Error(`Fixer prerequisites contain duplicate id: ${entry.id}`));
|
|
62
|
-
}
|
|
63
|
-
ids.add(entry.id);
|
|
64
|
-
return Object.freeze({ id: entry.id, requirement: entry.requirement });
|
|
65
|
-
});
|
|
66
|
-
return Object.freeze(prerequisites);
|
|
67
|
-
}
|
|
68
|
-
export function parseFixerPrerequisites(source) {
|
|
69
|
-
let decoded;
|
|
70
|
-
try {
|
|
71
|
-
decoded = JSON.parse(source);
|
|
38
|
+
const keys = Object.keys(entry);
|
|
39
|
+
if (keys.length !== 2 || !keys.includes("id") || !keys.includes("requirement")) {
|
|
40
|
+
fail(new Error("Fixer prerequisite entry fields must be exactly id and requirement"));
|
|
72
41
|
}
|
|
73
|
-
|
|
74
|
-
|
|
42
|
+
if (typeof entry.id !== "string" || !new RegExp(FIXER_PREREQUISITE_ID_PATTERN).test(entry.id)) {
|
|
43
|
+
fail(new Error(`Fixer prerequisite id violates pattern ${FIXER_PREREQUISITE_ID_PATTERN}`));
|
|
75
44
|
}
|
|
76
|
-
|
|
45
|
+
if (typeof entry.requirement !== "string" || !/\S/.test(entry.requirement)) {
|
|
46
|
+
fail(new Error("Fixer prerequisite requirement must be nonblank"));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
fail(new Error("Fixer prerequisites violate the attachment schema"));
|
|
50
|
+
}
|
|
51
|
+
function validateFixerPrerequisites(value) {
|
|
52
|
+
if (!Value.Check(fixerPrerequisitesSchema, value)) parseFailure(value);
|
|
53
|
+
const entries = value;
|
|
54
|
+
const ids = /* @__PURE__ */ new Set();
|
|
55
|
+
const prerequisites = entries.map((entry) => {
|
|
56
|
+
if (ids.has(entry.id)) {
|
|
57
|
+
fail(new Error(`Fixer prerequisites contain duplicate id: ${entry.id}`));
|
|
58
|
+
}
|
|
59
|
+
ids.add(entry.id);
|
|
60
|
+
return Object.freeze({ id: entry.id, requirement: entry.requirement });
|
|
61
|
+
});
|
|
62
|
+
return Object.freeze(prerequisites);
|
|
63
|
+
}
|
|
64
|
+
function parseFixerPrerequisites(source) {
|
|
65
|
+
let decoded;
|
|
66
|
+
try {
|
|
67
|
+
decoded = JSON.parse(source);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
fail(error);
|
|
70
|
+
}
|
|
71
|
+
return validateFixerPrerequisites(decoded);
|
|
77
72
|
}
|
|
73
|
+
export {
|
|
74
|
+
FIXER_PREREQUISITE_ID_PATTERN,
|
|
75
|
+
FixerPacketValidationError,
|
|
76
|
+
fixerPrerequisiteSchema,
|
|
77
|
+
fixerPrerequisitesSchema,
|
|
78
|
+
parseFixerPrerequisites,
|
|
79
|
+
validateFixerPrerequisites
|
|
80
|
+
};
|
|
@@ -1,71 +1,63 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public Gatekeeper (门下省) terminating receipt contracts (#639).
|
|
3
|
-
* Direct public seat shares the province decision shape: dispatch | pass.
|
|
4
|
-
* No usable result is infrastructure failure via public settlement, not a judgment status (#475).
|
|
5
|
-
*/
|
|
6
1
|
import { Type } from "typebox";
|
|
7
2
|
import { openToolObject } from "../open-tool-schema.js";
|
|
8
3
|
import { withInfrastructureFailureDeclaration } from "./terminating-infrastructure.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
const GATEKEEPER_OUTPUT_TOOL_NAME = "ak_gatekeeper_output";
|
|
5
|
+
const GATEKEEPER_ACCEPTED_TEXT = "\u95E8\u4E0B\u7701\u51B3\u8BAE\u5DF2\u53D7\u7406";
|
|
6
|
+
const gatekeeperDecisionSchema = openToolObject(
|
|
7
|
+
Type.Object({
|
|
13
8
|
status: Type.Unknown({
|
|
14
|
-
|
|
9
|
+
description: "dispatch | pass \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
15
10
|
}),
|
|
16
11
|
officer: Type.Unknown({
|
|
17
|
-
|
|
12
|
+
description: "status \u4E3A dispatch \u65F6\u4E3A inspector | notary"
|
|
18
13
|
}),
|
|
19
14
|
findings: Type.Unknown({
|
|
20
|
-
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
|
|
15
|
+
description: "status \u4E3A pass \u65F6\u53EF\u9009 string[] findings"
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
const gatekeeperOutputSchema = withInfrastructureFailureDeclaration(
|
|
20
|
+
gatekeeperDecisionSchema
|
|
21
|
+
);
|
|
24
22
|
function isRecord(value) {
|
|
25
|
-
|
|
23
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
24
|
}
|
|
27
25
|
function asStringArray(value) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return value.filter((item) => typeof item === "string");
|
|
26
|
+
if (!Array.isArray(value)) return [];
|
|
27
|
+
return value.filter((item) => typeof item === "string");
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return Array.isArray(value.findings)
|
|
42
|
-
? { status: "pass", findings: asStringArray(value.findings) }
|
|
43
|
-
: { status: "pass" };
|
|
44
|
-
}
|
|
45
|
-
if (value.status === "dispatch" &&
|
|
46
|
-
(value.officer === "inspector" || value.officer === "notary")) {
|
|
47
|
-
return { status: "dispatch", officer: value.officer };
|
|
48
|
-
}
|
|
49
|
-
return undefined;
|
|
29
|
+
function projectLawfulGatekeeperOutput(value) {
|
|
30
|
+
if (!isRecord(value)) return void 0;
|
|
31
|
+
if (value.status === "pass") {
|
|
32
|
+
return Array.isArray(value.findings) ? { status: "pass", findings: asStringArray(value.findings) } : { status: "pass" };
|
|
33
|
+
}
|
|
34
|
+
if (value.status === "dispatch" && (value.officer === "inspector" || value.officer === "notary")) {
|
|
35
|
+
return { status: "dispatch", officer: value.officer };
|
|
36
|
+
}
|
|
37
|
+
return void 0;
|
|
50
38
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (projected === undefined) {
|
|
58
|
-
throw new Error("Gatekeeper output has no recognized execution discriminator");
|
|
59
|
-
}
|
|
60
|
-
return projected;
|
|
39
|
+
function validateRecordedGatekeeperOutput(value) {
|
|
40
|
+
const projected = projectLawfulGatekeeperOutput(value);
|
|
41
|
+
if (projected === void 0) {
|
|
42
|
+
throw new Error("Gatekeeper output has no recognized execution discriminator");
|
|
43
|
+
}
|
|
44
|
+
return projected;
|
|
61
45
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return facts;
|
|
46
|
+
function gatekeeperDecisiveFacts(output) {
|
|
47
|
+
const facts = { status: output.status };
|
|
48
|
+
if (output.status === "dispatch") {
|
|
49
|
+
facts.officer = output.officer;
|
|
50
|
+
} else if (Array.isArray(output.findings)) {
|
|
51
|
+
facts.findingsCount = output.findings.length;
|
|
52
|
+
}
|
|
53
|
+
return facts;
|
|
71
54
|
}
|
|
55
|
+
export {
|
|
56
|
+
GATEKEEPER_ACCEPTED_TEXT,
|
|
57
|
+
GATEKEEPER_OUTPUT_TOOL_NAME,
|
|
58
|
+
gatekeeperDecisionSchema,
|
|
59
|
+
gatekeeperDecisiveFacts,
|
|
60
|
+
gatekeeperOutputSchema,
|
|
61
|
+
projectLawfulGatekeeperOutput,
|
|
62
|
+
validateRecordedGatekeeperOutput
|
|
63
|
+
};
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
judgeStatus = verdict.judgeStatus;
|
|
11
|
-
}
|
|
12
|
-
catch {
|
|
13
|
-
throw new Error("Judge verdict has no execution discriminator");
|
|
14
|
-
}
|
|
15
|
-
if (typeof judgeStatus !== "string") {
|
|
16
|
-
throw new Error("Judge verdict has no execution discriminator");
|
|
17
|
-
}
|
|
18
|
-
if (["converged", "continue", "escalate"].includes(judgeStatus)) {
|
|
19
|
-
return verdict;
|
|
20
|
-
}
|
|
1
|
+
const JUDGE_OUTPUT_TOOL_NAME = "ak_judge_output";
|
|
2
|
+
const JUDGE_ACCEPTED_TEXT = "\u5927\u7406\u5BFA\u56DE\u6267\u5DF2\u63A5\u53D7";
|
|
3
|
+
const JUDGE_ACCEPTED_AUDIT_NO_RECEIPT_TEXT = "\u5927\u7406\u5BFA\u56DE\u6267\u5DF2\u63A5\u53D7\uFF1B\u5BA1\u8BA1\u65E0\u56DE\u6267";
|
|
4
|
+
function validateAcceptedJudgeDetails(verdict) {
|
|
5
|
+
if (verdict === null || typeof verdict !== "object" || Array.isArray(verdict)) throw new Error("Judge verdict has no execution discriminator");
|
|
6
|
+
let judgeStatus;
|
|
7
|
+
try {
|
|
8
|
+
judgeStatus = verdict.judgeStatus;
|
|
9
|
+
} catch {
|
|
21
10
|
throw new Error("Judge verdict has no execution discriminator");
|
|
11
|
+
}
|
|
12
|
+
if (typeof judgeStatus !== "string") {
|
|
13
|
+
throw new Error("Judge verdict has no execution discriminator");
|
|
14
|
+
}
|
|
15
|
+
if (["converged", "continue", "escalate"].includes(judgeStatus)) {
|
|
16
|
+
return verdict;
|
|
17
|
+
}
|
|
18
|
+
throw new Error("Judge verdict has no execution discriminator");
|
|
22
19
|
}
|
|
20
|
+
export {
|
|
21
|
+
JUDGE_ACCEPTED_AUDIT_NO_RECEIPT_TEXT,
|
|
22
|
+
JUDGE_ACCEPTED_TEXT,
|
|
23
|
+
JUDGE_OUTPUT_TOOL_NAME,
|
|
24
|
+
validateAcceptedJudgeDetails
|
|
25
|
+
};
|
|
@@ -1,48 +1,43 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public Navigator (游奕使) terminating receipt contracts (#639).
|
|
3
|
-
* Direct public seat submits route advice with the same candidate shape the
|
|
4
|
-
* attendance prepare tool owns — one shape authority for navigator advice.
|
|
5
|
-
* No usable result is infrastructure failure via public settlement, not a judgment status (#475).
|
|
6
|
-
*/
|
|
7
1
|
import { Type } from "typebox";
|
|
8
2
|
import { openToolObject } from "../open-tool-schema.js";
|
|
9
3
|
import { withInfrastructureFailureDeclaration } from "./terminating-infrastructure.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
const NAVIGATOR_OUTPUT_TOOL_NAME = "ak_navigator_output";
|
|
5
|
+
const NAVIGATOR_ACCEPTED_TEXT = "\u6E38\u5955\u4F7F\u5EFA\u8BAE\u5DF2\u53D7\u7406";
|
|
6
|
+
const navigatorOutputSchema = withInfrastructureFailureDeclaration(
|
|
7
|
+
openToolObject(
|
|
8
|
+
Type.Object({
|
|
9
|
+
status: Type.Unknown({
|
|
10
|
+
description: "advice \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
11
|
+
}),
|
|
12
|
+
candidates: Type.Unknown({
|
|
13
|
+
description: "\u6392\u597D\u5E8F\u7684\u8DEF\u7EBF\u5EFA\u8BAE\u6570\u7EC4\uFF0C\u5143\u7D20\u542B next/phase/reason \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
)
|
|
17
|
+
);
|
|
20
18
|
function isRecord(value) {
|
|
21
|
-
|
|
19
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
export function projectLawfulNavigatorOutput(value) {
|
|
29
|
-
if (!isRecord(value) || !Array.isArray(value.candidates))
|
|
30
|
-
return undefined;
|
|
31
|
-
if (value.status !== "advice")
|
|
32
|
-
return undefined;
|
|
33
|
-
return { status: "advice", candidates: value.candidates.filter(isRecord) };
|
|
21
|
+
function projectLawfulNavigatorOutput(value) {
|
|
22
|
+
if (!isRecord(value) || !Array.isArray(value.candidates)) return void 0;
|
|
23
|
+
if (value.status !== "advice") return void 0;
|
|
24
|
+
return { status: "advice", candidates: value.candidates.filter(isRecord) };
|
|
34
25
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (projected === undefined) {
|
|
42
|
-
throw new Error("Navigator output has no recognized execution discriminator");
|
|
43
|
-
}
|
|
44
|
-
return projected;
|
|
26
|
+
function validateRecordedNavigatorOutput(value) {
|
|
27
|
+
const projected = projectLawfulNavigatorOutput(value);
|
|
28
|
+
if (projected === void 0) {
|
|
29
|
+
throw new Error("Navigator output has no recognized execution discriminator");
|
|
30
|
+
}
|
|
31
|
+
return projected;
|
|
45
32
|
}
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
function navigatorDecisiveFacts(output) {
|
|
34
|
+
return { status: "advice", candidates: output.candidates };
|
|
48
35
|
}
|
|
36
|
+
export {
|
|
37
|
+
NAVIGATOR_ACCEPTED_TEXT,
|
|
38
|
+
NAVIGATOR_OUTPUT_TOOL_NAME,
|
|
39
|
+
navigatorDecisiveFacts,
|
|
40
|
+
navigatorOutputSchema,
|
|
41
|
+
projectLawfulNavigatorOutput,
|
|
42
|
+
validateRecordedNavigatorOutput
|
|
43
|
+
};
|