@akagilnc/pi-workflow-roles 0.1.3565 → 0.1.3621
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/README.md +4 -1
- package/README.zh-CN.md +1 -1
- package/dist/acp-host/production-host.js +18477 -8099
- package/dist/analyst-gate-cycles-read.js +387 -0
- package/dist/archivist-record-entry.js +22 -1
- package/dist/audit-escalation.js +6 -0
- package/dist/auditor-soul.js +74 -0
- package/dist/collector-config.js +86 -0
- package/dist/collector-evidence.js +316 -0
- package/dist/collector-github.js +527 -0
- package/dist/collector-ledger.js +853 -0
- package/dist/collector-tool-schemas.js +33 -0
- package/dist/compliance-transport.js +104 -52
- package/dist/diarist-contracts.js +72 -0
- package/dist/diarist-mechanical.js +411 -0
- package/dist/diarist-ticket-resolution.js +177 -0
- package/dist/diarist.js +311 -0
- package/dist/doctor-auditor.js +25 -0
- package/dist/doctor-contracts.js +2 -0
- package/dist/doctor-evidence.js +142 -0
- package/dist/gatekeeper-role.js +104 -81
- package/dist/host-transition-prior-native.js +78 -0
- package/dist/institutional-resolution.js +1 -95
- package/dist/judge-auditor.js +26 -0
- package/dist/ledger-session-read.js +227 -0
- package/dist/merger-git-state.js +78 -0
- package/dist/navigator-attendance.js +15 -7
- package/dist/navigator-public-session.js +170 -0
- package/dist/navigator-session-contracts.js +36 -40
- package/dist/notary-source-run.js +122 -0
- package/dist/package-contracts/auditor-output.js +66 -0
- package/dist/package-contracts/evidence-child-output.js +34 -0
- package/dist/package-contracts/judge-output.js +2 -0
- package/dist/package-contracts/terminating-tools.js +44 -3
- package/dist/package-resources/method-skill.js +254 -0
- package/dist/packaged-role-registry.js +56 -0
- package/dist/pi/durable-principal.js +61 -0
- package/dist/pi/in-process-session.js +25 -6
- package/dist/pi/known-failure.js +52 -0
- package/dist/pi/role-turn-host.js +430 -0
- package/dist/public-cli/auto-resume.js +414 -0
- package/dist/public-cli/cli-errors.js +8 -0
- package/dist/public-cli/cli-io.js +1 -0
- package/dist/public-cli/command-renderer.js +5 -0
- package/dist/public-cli/doctor-run.js +84 -0
- package/dist/public-cli/inspector-run.js +136 -0
- package/dist/public-cli/instruction-seat-run.js +256 -0
- package/dist/public-cli/invocation.js +2225 -0
- package/dist/public-cli/judge-run.js +118 -0
- package/dist/public-cli/load-production-acp-host.js +40 -0
- package/dist/public-cli/main.js +1511 -1124
- package/dist/public-cli/notary-run.js +161 -0
- package/dist/public-cli/option-definitions.js +1192 -0
- package/dist/public-cli/post-admission.js +667 -0
- package/dist/public-cli/public-run-credentials.js +49 -0
- package/dist/public-cli/registry.js +8 -2
- package/dist/public-cli/reviewer-dispatch-rejection.js +77 -0
- package/dist/public-cli/run-lifecycle.js +1344 -0
- package/dist/public-cli/seat-ticket-binding.js +113 -0
- package/dist/public-cli/settlement.js +3441 -0
- package/dist/public-cli/terminal.js +135 -0
- package/dist/public-cli/turn-request.js +25 -0
- package/dist/public-role-summons.js +301 -0
- package/dist/receipt-delivery-policy.js +10 -0
- package/dist/reviewer-child-executor.js +80 -8
- package/dist/reviewer-execution-ledger.js +2 -1
- package/dist/run-terminal-artifacts.js +195 -0
- package/dist/run-ticket-number.js +40 -0
- package/dist/session-assistant-usage.js +107 -0
- package/dist/shape-unreadable-failure.js +34 -0
- package/dist/submission-errors.js +3 -0
- package/dist/submission-ledger.js +388 -0
- package/dist/ticket-provenance-contracts.js +115 -0
- package/dist/ticket-provenance.js +340 -0
- package/extensions/role-runtime.ts +8 -0
- package/package.json +1 -1
- package/resources/diarist-collect.md +6 -10
- package/scripts/build-package.mjs +2 -1
- package/souls/diarist.md +9 -0
- package/souls/doctor-auditor.md +1 -0
- package/souls/evidence-child.md +1 -0
- package/src/acp-host/production-host.ts +4 -0
- package/src/acp-host/role-envelope.ts +4 -3
- package/src/acp-host/role-turn-host.ts +9 -1
- package/src/analyst-gate-cycles-read.ts +37 -2
- package/src/archivist-record-entry.ts +45 -1
- package/src/audit-escalation.ts +17 -0
- package/src/auditor-role.ts +22 -0
- package/src/auditor-soul.ts +42 -0
- package/src/compliance-transport.ts +177 -66
- package/src/diarist-contracts.ts +88 -0
- package/src/diarist-role.ts +60 -0
- package/src/diarist.ts +253 -179
- package/src/doctor-auditor.ts +10 -14
- package/src/doctor-contracts.ts +1 -0
- package/src/doctor-role.ts +2 -2
- package/src/evidence-child-role.ts +22 -0
- package/src/gatekeeper-pass-envelope.ts +109 -0
- package/src/gatekeeper-role.ts +145 -104
- package/src/host-contracts.ts +15 -2
- package/src/institutional-resolution.ts +8 -163
- package/src/judge-auditor.ts +10 -15
- package/src/judge-role.ts +8 -0
- package/src/navigator-attendance.ts +25 -9
- package/src/navigator-public-session.ts +217 -0
- package/src/navigator-session-contracts.ts +61 -54
- package/src/notary-source-run.ts +3 -1
- package/src/package-contracts/auditor-output.ts +82 -0
- package/src/package-contracts/evidence-child-output.ts +51 -0
- package/src/package-contracts/judge-output.ts +1 -0
- package/src/package-contracts/reviewer-output.ts +2 -2
- package/src/package-contracts/terminating-tools.ts +53 -3
- package/src/packaged-role-registry.ts +63 -0
- package/src/pi/adapter.ts +2 -1
- package/src/pi/in-process-session.ts +38 -12
- package/src/pi/role-turn-host.ts +42 -0
- package/src/public-cli/cli.ts +43 -6
- package/src/public-cli/countersign-run.ts +9 -129
- package/src/public-cli/diarist-run.ts +312 -0
- package/src/public-cli/instruction-seat-run.ts +289 -50
- package/src/public-cli/invocation.ts +87 -25
- package/src/public-cli/option-definitions.ts +79 -0
- package/src/public-cli/post-admission.ts +9 -3
- package/src/public-cli/registry.ts +7 -1
- package/src/public-cli/run-lifecycle.ts +53 -6
- package/src/public-cli/settlement.ts +170 -7
- package/src/public-cli/terminal.ts +4 -1
- package/src/public-role-summons.ts +431 -0
- package/src/receipt-delivery-policy.ts +10 -0
- package/src/reviewer-agent.ts +1 -1
- package/src/reviewer-child-executor.ts +114 -12
- package/src/reviewer-execution-ledger.ts +3 -2
- package/src/role-runtime.ts +275 -23
- package/src/session-assistant-usage.ts +119 -0
- package/src/session-opening-materials.ts +1 -1
- package/src/shape-unreadable-failure.ts +49 -0
- package/src/submission-errors.ts +3 -0
- package/src/ticket-provenance-contracts.ts +1 -0
- package/src/ticket-provenance.ts +0 -23
- package/dist/evidence-child-executor.js +0 -829
- package/src/diarist-llm-collector.ts +0 -324
- package/src/evidence-child-executor.ts +0 -1140
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 起居郎 LLM semantic collector — ADR 0075 / #582.
|
|
3
|
-
* Cheap engine selects decision-related blocks from a frozen candidate set.
|
|
4
|
-
* Every claimed quote must pass mechanical reverse-verify before entry.
|
|
5
|
-
*/
|
|
6
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
7
|
-
import { join } from "node:path";
|
|
8
|
-
import { fileURLToPath } from "node:url";
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
ENGINE_DETOUR_STAGED_PROMPT_TOKEN,
|
|
12
|
-
runEngineDetourOnce,
|
|
13
|
-
} from "./engine-detour.ts";
|
|
14
|
-
import type { DiaristSourceBlock } from "./diarist-mechanical.ts";
|
|
15
|
-
|
|
16
|
-
/** Owner-domain method material for collector semantic judgment (ADR 0073/0075). */
|
|
17
|
-
export const DIARIST_COLLECT_METHOD_RELATIVE = "resources/diarist-collect.md" as const;
|
|
18
|
-
|
|
19
|
-
const packageRootUrl = new URL("..", import.meta.url);
|
|
20
|
-
|
|
21
|
-
/** Absolute path to packaged diarist-collect method material. */
|
|
22
|
-
export function resolveDiaristCollectMethodPath(
|
|
23
|
-
packageRoot: string = fileURLToPath(packageRootUrl),
|
|
24
|
-
): string {
|
|
25
|
-
return join(packageRoot, DIARIST_COLLECT_METHOD_RELATIVE);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** One LLM-selected block reference into the candidate set. */
|
|
29
|
-
export type DiaristLlmSelection = {
|
|
30
|
-
/** Index into the candidate array the collector received. */
|
|
31
|
-
readonly candidateIndex: number;
|
|
32
|
-
/** Quotes the model claims (must be verbatim in the block transcript). */
|
|
33
|
-
readonly quotes: readonly string[];
|
|
34
|
-
/** Optional human-facing note (theme / summary). Not a machine gate. */
|
|
35
|
-
readonly note?: string;
|
|
36
|
-
/** Human-face triage label — never a machine gate. */
|
|
37
|
-
readonly triage?: "relevant" | "context" | "irrelevant";
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export type DiaristLlmCollectResult = {
|
|
41
|
-
readonly selections: readonly DiaristLlmSelection[];
|
|
42
|
-
/** Raw engine stdout retained for diagnostics (not a gate). */
|
|
43
|
-
readonly rawStdout: string;
|
|
44
|
-
readonly engineArgv: readonly string[];
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type DiaristLlmCollector = (input: {
|
|
48
|
-
readonly ticketNumber: number;
|
|
49
|
-
readonly candidates: readonly DiaristSourceBlock[];
|
|
50
|
-
readonly signal?: AbortSignal;
|
|
51
|
-
}) => Promise<DiaristLlmCollectResult>;
|
|
52
|
-
|
|
53
|
-
/** Typed cause when collector stdout cannot be consumed as the sole selections object. */
|
|
54
|
-
export type DiaristLlmStdoutReason =
|
|
55
|
-
| "empty-stdout"
|
|
56
|
-
| "unparseable-json"
|
|
57
|
-
| "not-object"
|
|
58
|
-
| "selections-missing"
|
|
59
|
-
| "selections-wrong-type"
|
|
60
|
-
| "selection-uninterpretable";
|
|
61
|
-
|
|
62
|
-
export class DiaristLlmStdoutError extends Error {
|
|
63
|
-
readonly code = "diarist-llm-stdout" as const;
|
|
64
|
-
readonly reason: DiaristLlmStdoutReason;
|
|
65
|
-
constructor(reason: DiaristLlmStdoutReason, message: string, options?: ErrorOptions) {
|
|
66
|
-
super(message, options);
|
|
67
|
-
this.name = "DiaristLlmStdoutError";
|
|
68
|
-
this.reason = reason;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
73
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Consumer-driven parse of collector stdout.
|
|
78
|
-
* Sole shape: one JSON object with typed `selections` array.
|
|
79
|
-
* Unknown top-level / row fields are ignored. No fence/substring recovery,
|
|
80
|
-
* no blocks/index/i/quote aliases. Empty or uninterpretable input fails honestly.
|
|
81
|
-
*/
|
|
82
|
-
export function parseDiaristLlmStdout(
|
|
83
|
-
stdout: string,
|
|
84
|
-
candidateCount: number,
|
|
85
|
-
): DiaristLlmSelection[] {
|
|
86
|
-
const trimmed = stdout.trim();
|
|
87
|
-
if (trimmed.length === 0) {
|
|
88
|
-
throw new DiaristLlmStdoutError("empty-stdout", "diarist collector stdout is empty");
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
let parsed: unknown;
|
|
92
|
-
try {
|
|
93
|
-
parsed = JSON.parse(trimmed);
|
|
94
|
-
} catch (error) {
|
|
95
|
-
throw new DiaristLlmStdoutError(
|
|
96
|
-
"unparseable-json",
|
|
97
|
-
"diarist collector stdout is not JSON",
|
|
98
|
-
{ cause: error },
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (!isRecord(parsed)) {
|
|
103
|
-
throw new DiaristLlmStdoutError(
|
|
104
|
-
"not-object",
|
|
105
|
-
"diarist collector stdout must be one JSON object",
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (!Object.prototype.hasOwnProperty.call(parsed, "selections")) {
|
|
110
|
-
throw new DiaristLlmStdoutError(
|
|
111
|
-
"selections-missing",
|
|
112
|
-
"diarist collector stdout missing selections",
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (!Array.isArray(parsed.selections)) {
|
|
117
|
-
throw new DiaristLlmStdoutError(
|
|
118
|
-
"selections-wrong-type",
|
|
119
|
-
"diarist collector selections must be an array",
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const out: DiaristLlmSelection[] = [];
|
|
124
|
-
for (let rowIndex = 0; rowIndex < parsed.selections.length; rowIndex += 1) {
|
|
125
|
-
const row = parsed.selections[rowIndex];
|
|
126
|
-
if (!isRecord(row)) {
|
|
127
|
-
throw new DiaristLlmStdoutError(
|
|
128
|
-
"selection-uninterpretable",
|
|
129
|
-
`diarist collector selection[${rowIndex}] is not an object`,
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Consume only typed fields; ignore unknown row keys.
|
|
134
|
-
if (typeof row.candidateIndex !== "number" || !Number.isInteger(row.candidateIndex)) {
|
|
135
|
-
throw new DiaristLlmStdoutError(
|
|
136
|
-
"selection-uninterpretable",
|
|
137
|
-
`diarist collector selection[${rowIndex}].candidateIndex is not an integer`,
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
const index = row.candidateIndex;
|
|
141
|
-
if (index < 0 || index >= candidateCount) {
|
|
142
|
-
throw new DiaristLlmStdoutError(
|
|
143
|
-
"selection-uninterpretable",
|
|
144
|
-
`diarist collector selection[${rowIndex}].candidateIndex ${index} out of range 0..${candidateCount - 1}`,
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (!Object.prototype.hasOwnProperty.call(row, "quotes")) {
|
|
149
|
-
throw new DiaristLlmStdoutError(
|
|
150
|
-
"selection-uninterpretable",
|
|
151
|
-
`diarist collector selection[${rowIndex}].quotes missing`,
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
if (!Array.isArray(row.quotes)) {
|
|
155
|
-
throw new DiaristLlmStdoutError(
|
|
156
|
-
"selection-uninterpretable",
|
|
157
|
-
`diarist collector selection[${rowIndex}].quotes must be an array`,
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
const quotes: string[] = [];
|
|
161
|
-
for (let qIndex = 0; qIndex < row.quotes.length; qIndex += 1) {
|
|
162
|
-
const q = row.quotes[qIndex];
|
|
163
|
-
if (typeof q !== "string") {
|
|
164
|
-
throw new DiaristLlmStdoutError(
|
|
165
|
-
"selection-uninterpretable",
|
|
166
|
-
`diarist collector selection[${rowIndex}].quotes[${qIndex}] is not a string`,
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
// Empty string quotes are skipped at reverse-verify; keep non-empty only.
|
|
170
|
-
if (q.length > 0) quotes.push(q);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const triage =
|
|
174
|
-
row.triage === "relevant" ||
|
|
175
|
-
row.triage === "context" ||
|
|
176
|
-
row.triage === "irrelevant"
|
|
177
|
-
? row.triage
|
|
178
|
-
: undefined;
|
|
179
|
-
|
|
180
|
-
out.push({
|
|
181
|
-
candidateIndex: index,
|
|
182
|
-
quotes,
|
|
183
|
-
...(typeof row.note === "string" ? { note: row.note } : {}),
|
|
184
|
-
...(triage === undefined ? {} : { triage }),
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
return out;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** Structured engine payload for hermes -z (sole method-delivery seam). */
|
|
191
|
-
export type DiaristCollectorEnginePayload = {
|
|
192
|
-
/**
|
|
193
|
-
* Owner-domain diarist-collect method material bytes.
|
|
194
|
-
* File at DIARIST_COLLECT_METHOD_RELATIVE is the sole source of truth; bytes are
|
|
195
|
-
* read at call time and delivered in the same -z structured input (no coordinate-only).
|
|
196
|
-
*/
|
|
197
|
-
readonly method: string;
|
|
198
|
-
readonly ticketNumber: number;
|
|
199
|
-
readonly candidates: readonly {
|
|
200
|
-
readonly candidateIndex: number;
|
|
201
|
-
readonly sourceKind: DiaristSourceBlock["sourceKind"];
|
|
202
|
-
readonly isUserTurn: boolean;
|
|
203
|
-
readonly timestamp: string;
|
|
204
|
-
readonly transcript: string;
|
|
205
|
-
}[];
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Machine kickoff payload (ADR 0073): method material bytes + frozen candidate catalog.
|
|
210
|
-
* Semantic judgment lives in owner-domain method material — delivered as `method` bytes,
|
|
211
|
-
* not a path coordinate. Serialized body is staged by the shared engine seam (never argv).
|
|
212
|
-
*/
|
|
213
|
-
export function buildDiaristCollectorEnginePayload(input: {
|
|
214
|
-
readonly ticketNumber: number;
|
|
215
|
-
readonly candidates: readonly DiaristSourceBlock[];
|
|
216
|
-
readonly method: string;
|
|
217
|
-
}): DiaristCollectorEnginePayload {
|
|
218
|
-
return {
|
|
219
|
-
method: input.method,
|
|
220
|
-
ticketNumber: input.ticketNumber,
|
|
221
|
-
candidates: input.candidates.map((block, index) => ({
|
|
222
|
-
candidateIndex: index,
|
|
223
|
-
sourceKind: block.sourceKind,
|
|
224
|
-
isUserTurn: block.isUserTurn,
|
|
225
|
-
timestamp: block.timestamp,
|
|
226
|
-
transcript: block.transcript,
|
|
227
|
-
})),
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/** Serialize engine payload body for seam-owned staged prompt file delivery. */
|
|
232
|
-
export function serializeDiaristCollectorEnginePayload(
|
|
233
|
-
payload: DiaristCollectorEnginePayload,
|
|
234
|
-
): string {
|
|
235
|
-
return JSON.stringify(payload);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Hermes built-in toolset that resolves to zero tools.
|
|
240
|
-
* Collector labor is pure JSON selection — never a tools-capable agent surface.
|
|
241
|
-
* Not exported — callers must not depend on the name; argv face is the contract.
|
|
242
|
-
*/
|
|
243
|
-
const HERMES_DIARIST_COLLECTOR_TOOLSET = "context_engine" as const;
|
|
244
|
-
|
|
245
|
-
export type HermesDiaristCollectorOptions = {
|
|
246
|
-
/** Executable name or path. Default hermes. */
|
|
247
|
-
readonly executable?: string;
|
|
248
|
-
readonly cwd?: string;
|
|
249
|
-
readonly env?: NodeJS.ProcessEnv;
|
|
250
|
-
/** Extra argv after executable (before -z). */
|
|
251
|
-
readonly extraArgv?: readonly string[];
|
|
252
|
-
/** Package root for resolving diarist-collect method material. */
|
|
253
|
-
readonly packageRoot?: string;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Default cheap-engine collector via hermes (ADR 0069 detour seam).
|
|
258
|
-
* Owner-domain method material is read from the packaged file (sole source of truth)
|
|
259
|
-
* and delivered as `method` bytes inside the structured JSON body. The body is staged
|
|
260
|
-
* by the shared engine seam (`--query-file` path token) — never a single argv blob
|
|
261
|
-
* (E2BIG / engine-dispatch). No path-only method coordinate; no env dual transport.
|
|
262
|
-
* Engine failure and uninterpretable stdout throw — caller records honest diagnostic.
|
|
263
|
-
*/
|
|
264
|
-
export function createHermesDiaristCollector(
|
|
265
|
-
options: HermesDiaristCollectorOptions = {},
|
|
266
|
-
): DiaristLlmCollector {
|
|
267
|
-
const executable = options.executable ?? "hermes";
|
|
268
|
-
const methodPath = resolveDiaristCollectMethodPath(options.packageRoot);
|
|
269
|
-
if (!existsSync(methodPath)) {
|
|
270
|
-
throw new Error(`diarist collect method material missing (${methodPath})`);
|
|
271
|
-
}
|
|
272
|
-
// Read once at factory time — file remains the sole editable source of truth.
|
|
273
|
-
const method = readFileSync(methodPath, "utf8");
|
|
274
|
-
if (method.trim().length === 0) {
|
|
275
|
-
throw new Error(`diarist collect method material is empty (${methodPath})`);
|
|
276
|
-
}
|
|
277
|
-
return async (input) => {
|
|
278
|
-
const payload = buildDiaristCollectorEnginePayload({
|
|
279
|
-
ticketNumber: input.ticketNumber,
|
|
280
|
-
candidates: input.candidates,
|
|
281
|
-
method,
|
|
282
|
-
});
|
|
283
|
-
const prompt = serializeDiaristCollectorEnginePayload(payload);
|
|
284
|
-
// File-path delivery via shared seam token (never paste body into argv).
|
|
285
|
-
// chat --query-file + -Q keeps final-response-only stdout. Tool surface is
|
|
286
|
-
// the empty built-in `context_engine` toolset — collector is pure JSON
|
|
287
|
-
// selection over untrusted ticket text; never terminal/file/web tools.
|
|
288
|
-
// --ignore-rules keeps host identity out.
|
|
289
|
-
const argv = [
|
|
290
|
-
executable,
|
|
291
|
-
...(options.extraArgv ?? []),
|
|
292
|
-
"chat",
|
|
293
|
-
"--query-file",
|
|
294
|
-
ENGINE_DETOUR_STAGED_PROMPT_TOKEN,
|
|
295
|
-
"-Q",
|
|
296
|
-
"--no-restore-cwd",
|
|
297
|
-
"--ignore-rules",
|
|
298
|
-
"-t",
|
|
299
|
-
HERMES_DIARIST_COLLECTOR_TOOLSET,
|
|
300
|
-
];
|
|
301
|
-
const result = await runEngineDetourOnce({
|
|
302
|
-
argv,
|
|
303
|
-
stagedPrompt: prompt,
|
|
304
|
-
cwd: options.cwd ?? process.cwd(),
|
|
305
|
-
...(options.env === undefined ? {} : { env: options.env }),
|
|
306
|
-
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
307
|
-
});
|
|
308
|
-
if (result.code !== 0) {
|
|
309
|
-
throw new Error(
|
|
310
|
-
`diarist LLM collector engine exited ${result.code}: ${result.stderr.slice(0, 500)}`,
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
const selections = parseDiaristLlmStdout(
|
|
314
|
-
result.stdout,
|
|
315
|
-
input.candidates.length,
|
|
316
|
-
);
|
|
317
|
-
return {
|
|
318
|
-
selections,
|
|
319
|
-
rawStdout: result.stdout,
|
|
320
|
-
// Staged body redacted — argv face shows the path token only.
|
|
321
|
-
engineArgv: argv,
|
|
322
|
-
};
|
|
323
|
-
};
|
|
324
|
-
}
|