@akagilnc/pi-workflow-roles 0.1.4204 → 0.1.4228
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 +1203 -770
- package/dist/atomic-write.js +23 -0
- package/dist/diarist-contracts.js +22 -8
- package/dist/headless-host/production-host.js +1191 -758
- package/dist/ledger-session-read.js +52 -21
- package/dist/migrate-book-topology.js +238 -205
- package/dist/public-cli/case-dossier-delivery.js +0 -1
- package/dist/public-cli/main.js +303 -261
- package/dist/session-dialogue.js +221 -0
- package/dist/sitian-facade.js +1 -0
- package/dist/sitian-volume.js +67 -0
- package/dist/ticket-provenance-contracts.js +122 -39
- package/dist/ticket-provenance.js +289 -204
- package/package.json +1 -1
- package/src/book-topology-migration.ts +0 -7
- package/src/book-topology-record-class-migrators.ts +203 -99
- package/src/diarist-contracts.ts +42 -29
- package/src/diarist-role.ts +77 -31
- package/src/diarist.ts +31 -67
- package/src/ledger-session-read.ts +70 -27
- package/src/package-contracts/reviewer-output.ts +1 -1
- package/src/public-cli/case-dossier-delivery.ts +0 -1
- package/src/reviewer-role.ts +3 -3
- package/src/role-runtime.ts +56 -14
- package/src/session-dialogue.ts +225 -0
- package/src/sitian-appender.ts +1 -1
- package/src/sitian-facade.ts +7 -1
- package/src/sitian-volume.ts +91 -0
- package/src/ticket-provenance-contracts.ts +158 -101
- package/src/ticket-provenance.ts +387 -263
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Same-directory temp + rename atomic file replace.
|
|
3
|
+
* Shared primitive for ledger-adjacent typed pages (analyst metrics, etc.).
|
|
4
|
+
* Does not open/truncate an existing destination inode, so hard-linked twins
|
|
5
|
+
* keep prior bytes until the directory entry is swapped.
|
|
6
|
+
* Parent directory must already exist — callers that write under the package
|
|
7
|
+
* ledger home own confinement via ensureRealDirectoryTree (ADR 0038).
|
|
8
|
+
*/
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
10
|
+
import { rename, rm, writeFile } from "node:fs/promises";
|
|
11
|
+
import { dirname, join } from "node:path";
|
|
12
|
+
export async function writeFileAtomically(destination, contents) {
|
|
13
|
+
const parent = dirname(destination);
|
|
14
|
+
const temporary = join(parent, `.atomic-write-${randomUUID()}.tmp`);
|
|
15
|
+
try {
|
|
16
|
+
await writeFile(temporary, contents);
|
|
17
|
+
await rename(temporary, destination);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
await rm(temporary, { force: true }).catch(() => undefined);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Public 起居郎 (diarist) terminating receipt contracts — ADR 0075
|
|
2
|
+
* Public 起居郎 (diarist) terminating receipt contracts — ADR 0075 `diarist-is-role` / #901.
|
|
3
3
|
* Lawful explicit releases: completed (入录) | escalate (认不出本庭对象上抛).
|
|
4
|
-
* Machine facts about the volume come from the mechanical
|
|
4
|
+
* Machine facts about the volume come from the mechanical reproject seam, never
|
|
5
5
|
* from model self-report (锚定宪法); this module owns the receipt shape only.
|
|
6
6
|
*
|
|
7
|
-
* #
|
|
8
|
-
* Mechanical layer does not judge LLM output (no quote/ticket/relevance verify).
|
|
7
|
+
* #901: LLM submits bounds (+ optional amendments); mechanical layer projects.
|
|
9
8
|
*/
|
|
9
|
+
import { projectTicketProvenanceAmendments, projectTicketProvenanceSessions, } from "./ticket-provenance-contracts.js";
|
|
10
10
|
import { isSafePositiveTicketNumber, requireSafePositiveTicketNumber, } from "./run-ticket-number.js";
|
|
11
11
|
export const DIARIST_OUTPUT_TOOL_NAME = "ak_diarist_output";
|
|
12
12
|
export const DIARIST_ACCEPTED_TEXT = "起居郎回执已接受";
|
|
@@ -121,8 +121,22 @@ export function validateRecordedDiaristOutput(value) {
|
|
|
121
121
|
}
|
|
122
122
|
throw new Error("Diarist output has no execution discriminator");
|
|
123
123
|
}
|
|
124
|
-
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Project sessions from a completed diarist payload.
|
|
126
|
+
* Absent key → empty (lawful). Present but unusable → undefined (caller reasks).
|
|
127
|
+
*/
|
|
128
|
+
export function projectDiaristSessions(value) {
|
|
129
|
+
const raw = value?.sessions;
|
|
130
|
+
if (raw === undefined)
|
|
131
|
+
return [];
|
|
132
|
+
return projectTicketProvenanceSessions(raw);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Project optional amendments. Absent / non-array → empty (not a rejection).
|
|
136
|
+
*/
|
|
137
|
+
export function projectDiaristAmendments(value) {
|
|
138
|
+
const raw = value?.amendments;
|
|
139
|
+
if (raw === undefined)
|
|
140
|
+
return [];
|
|
141
|
+
return projectTicketProvenanceAmendments(raw);
|
|
128
142
|
}
|