@akagilnc/pi-workflow-roles 0.1.3932 → 0.1.3975
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/CLAUDE.md +1 -1
- package/dist/acp-host/production-host.js +2389 -6018
- package/dist/analyst-gate-cycles-read.js +15 -19
- package/dist/audit-escalation.js +16 -46
- package/dist/auditor-dossier-tool.js +7 -62
- package/dist/collector-identity.js +0 -157
- package/dist/collector-ledger.js +2 -42
- package/dist/compliance-transport.js +40 -14
- package/dist/diarist-contracts.js +2 -40
- package/dist/doctor-contracts.js +39 -108
- package/dist/doctor-evidence.js +1 -5
- package/dist/engine-detour-tool.js +1 -1
- package/dist/gatekeeper-role.js +49 -38
- package/dist/headless-host/production-host.js +4814 -8450
- package/dist/host-contracts.js +0 -5
- package/dist/merger-contracts.js +4 -6
- package/dist/navigator-attendance.js +30 -52
- package/dist/navigator-invocation-identity.js +0 -1
- package/dist/navigator-public-session.js +2 -1
- package/dist/notary-contracts.js +4 -10
- package/dist/package-contracts/auditor-output.js +5 -23
- package/dist/package-contracts/fixer-output.js +25 -49
- package/dist/package-contracts/gatekeeper-output.js +3 -13
- package/dist/package-contracts/navigator-output.js +4 -7
- package/dist/package-contracts/reviewer-output.js +1 -95
- package/dist/package-contracts/terminating-tools.js +33 -144
- package/dist/package-contracts/worker-output.js +1 -3
- package/dist/public-cli/auto-resume.js +30 -68
- package/dist/public-cli/case-dossier-delivery.js +5 -17
- package/dist/public-cli/diarist-run.js +9 -4
- package/dist/public-cli/inspector-run.js +2 -8
- package/dist/public-cli/instruction-seat-run.js +3 -7
- package/dist/public-cli/invocation.js +5 -2
- package/dist/public-cli/main.js +6068 -6964
- package/dist/public-cli/notary-run.js +1 -8
- package/dist/public-cli/post-admission.js +314 -113
- package/dist/public-cli/run-lifecycle.js +14 -38
- package/dist/public-cli/settlement.js +209 -390
- package/dist/public-cli/terminal.js +51 -45
- package/dist/public-role-summons.js +1 -12
- package/dist/reviewer-dispatch.js +12 -258
- package/dist/submission-correctable-error.js +0 -12
- package/dist/submission-errors.js +6 -1
- package/dist/submission-ledger.js +125 -168
- package/dist/ticket-provenance-contracts.js +2 -49
- package/dist/ticket-provenance.js +82 -31
- package/extensions/role-runtime.ts +1 -6
- package/package.json +1 -1
- package/resources/836-deleted-machine-instruction-inventory.md +18 -0
- package/src/acp-host/role-turn-host.ts +8 -3
- package/src/analyst-gate-cycles-read.ts +17 -29
- package/src/audit-escalation.ts +20 -50
- package/src/auditor-dossier-tool.ts +5 -103
- package/src/canonical-skill-binding.ts +3 -2
- package/src/collector-identity.ts +0 -179
- package/src/collector-ledger.ts +3 -46
- package/src/collector-role.ts +32 -61
- package/src/collector-tool-schemas.ts +20 -14
- package/src/compliance-transport.ts +55 -17
- package/src/countersign-role.ts +17 -8
- package/src/diarist-contracts.ts +3 -36
- package/src/diarist-role.ts +13 -7
- package/src/diarist.ts +4 -16
- package/src/doctor-contracts.ts +73 -94
- package/src/doctor-evidence.ts +1 -1
- package/src/doctor-role.ts +3 -3
- package/src/engine-detour-tool.ts +4 -1
- package/src/external-host-turn-loop.ts +9 -3
- package/src/gatekeeper-pass-envelope.ts +7 -12
- package/src/gatekeeper-role.ts +56 -50
- package/src/gleaner-left-role.ts +4 -2
- package/src/headless-host/role-turn-host.ts +4 -5
- package/src/host-contracts.ts +3 -8
- package/src/judge-role.ts +19 -13
- package/src/merger-contracts.ts +10 -6
- package/src/merger-role.ts +1 -5
- package/src/navigator-attendance.ts +37 -74
- package/src/navigator-invocation-identity.ts +0 -6
- package/src/navigator-public-session.ts +2 -1
- package/src/notary-contracts.ts +7 -10
- package/src/package-contracts/auditor-output.ts +4 -21
- package/src/package-contracts/fixer-output.ts +34 -52
- package/src/package-contracts/gatekeeper-output.ts +5 -22
- package/src/package-contracts/navigator-output.ts +7 -7
- package/src/package-contracts/reviewer-output.ts +2 -150
- package/src/package-contracts/terminating-tools.ts +32 -147
- package/src/package-contracts/worker-output.ts +0 -1
- package/src/pi/adapter.ts +3 -8
- package/src/public-cli/auto-resume.ts +41 -94
- package/src/public-cli/case-dossier-delivery.ts +5 -15
- package/src/public-cli/countersign-run.ts +14 -6
- package/src/public-cli/diarist-run.ts +11 -9
- package/src/public-cli/inspector-run.ts +2 -18
- package/src/public-cli/instruction-seat-run.ts +3 -17
- package/src/public-cli/invocation.ts +5 -2
- package/src/public-cli/merger-run.ts +1 -1
- package/src/public-cli/notary-run.ts +1 -18
- package/src/public-cli/post-admission.ts +385 -115
- package/src/public-cli/run-lifecycle.ts +13 -44
- package/src/public-cli/settlement.ts +314 -562
- package/src/public-cli/terminal.ts +66 -72
- package/src/public-role-summons.ts +5 -30
- package/src/reviewer-dispatch.ts +29 -331
- package/src/reviewer-role.ts +16 -83
- package/src/role-envelope.ts +16 -24
- package/src/role-runtime-dependencies.ts +1 -6
- package/src/role-runtime.ts +65 -201
- package/src/submission-correctable-error.ts +0 -14
- package/src/submission-errors.ts +6 -1
- package/src/submission-ledger.ts +187 -187
- package/src/ticket-provenance-contracts.ts +4 -60
- package/src/ticket-provenance.ts +98 -32
- package/src/worker-role.ts +35 -36
- package/dist/activation-ledger-session.js +0 -105
- package/dist/activation-ledger.js +0 -139
- package/dist/activation-trace.js +0 -33
- package/dist/atomic-write.js +0 -23
- package/dist/auditor-role.js +0 -12
- package/dist/canonical-skill-binding.js +0 -61
- package/dist/collector-handbook.js +0 -142
- package/dist/collector-receipt.js +0 -107
- package/dist/collector-role.js +0 -566
- package/dist/collector-tool-schemas.js +0 -107
- package/dist/countersign-role.js +0 -28
- package/dist/diarist-role.js +0 -44
- package/dist/diarist.js +0 -66
- package/dist/doctor-role.js +0 -75
- package/dist/fixer-bash-seatbelt.js +0 -13
- package/dist/gatekeeper-pass-envelope.js +0 -77
- package/dist/gleaner-left-role.js +0 -26
- package/dist/inspector-role.js +0 -29
- package/dist/judge-role.js +0 -104
- package/dist/merger-role.js +0 -55
- package/dist/navigator-role.js +0 -12
- package/dist/notary-role.js +0 -134
- package/dist/oauth-keepalive.js +0 -158
- package/dist/pi/adapter.js +0 -223
- package/dist/reviewer-agent.js +0 -122
- package/dist/reviewer-child-executor.js +0 -194
- package/dist/reviewer-construction.js +0 -103
- package/dist/reviewer-execution-ledger.js +0 -166
- package/dist/reviewer-failure-diagnostic.js +0 -17
- package/dist/reviewer-role.js +0 -159
- package/dist/reviewer-scope-prompt.js +0 -21
- package/dist/reviewer-settlement.js +0 -66
- package/dist/reviewer-workspace.js +0 -132
- package/dist/role-runtime.js +0 -1604
- package/dist/stderr-jsonl.js +0 -26
- package/dist/tool-execution-observation.js +0 -141
- package/dist/worker-role.js +0 -345
- package/dist/worker-submission-gates.js +0 -305
- package/src/collector-receipt.ts +0 -140
- package/src/diagnostic-tail.ts +0 -18
- package/src/reviewer-agent.ts +0 -135
- package/src/reviewer-child-executor.ts +0 -252
- package/src/reviewer-construction.ts +0 -195
- package/src/reviewer-execution-ledger.ts +0 -212
- package/src/reviewer-failure-diagnostic.ts +0 -18
- package/src/reviewer-scope-prompt.ts +0 -24
- package/src/reviewer-settlement.ts +0 -74
- package/src/reviewer-workspace.ts +0 -105
- package/src/shape-unreadable-failure.ts +0 -49
|
@@ -34,15 +34,37 @@ export function ticketProvenanceEntryIdentity(input) {
|
|
|
34
34
|
].join("\u0000");
|
|
35
35
|
return createHash("sha256").update(material, "utf8").digest("hex");
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
function identityFromPayload(ticketNumber, payload) {
|
|
38
|
+
if (typeof payload === "object"
|
|
39
|
+
&& payload !== null
|
|
40
|
+
&& !Array.isArray(payload)) {
|
|
41
|
+
const record = payload;
|
|
42
|
+
if (typeof record.sourceKind === "string" && typeof record.transcript === "string") {
|
|
43
|
+
const sourceRef = typeof record.sourceRef === "object" && record.sourceRef !== null && !Array.isArray(record.sourceRef)
|
|
44
|
+
? record.sourceRef
|
|
45
|
+
: {};
|
|
46
|
+
return ticketProvenanceEntryIdentity({
|
|
47
|
+
ticketNumber,
|
|
48
|
+
sourceKind: record.sourceKind,
|
|
49
|
+
sourceRef,
|
|
50
|
+
transcript: record.transcript,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return createHash("sha256")
|
|
55
|
+
.update(`${String(ticketNumber)}\u0000${JSON.stringify(payload)}`, "utf8")
|
|
56
|
+
.digest("hex");
|
|
57
|
+
}
|
|
58
|
+
/** Append one original row; returns existing pointer on identity hit. */
|
|
38
59
|
export function appendTicketProvenanceEntry(input) {
|
|
39
60
|
const subject = ticketProvenanceSubject(input.ticketNumber);
|
|
40
|
-
const identity =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
const identity = identityFromPayload(input.ticketNumber, input.payload);
|
|
62
|
+
const record = typeof input.payload === "object" && input.payload !== null && !Array.isArray(input.payload)
|
|
63
|
+
? input.payload
|
|
64
|
+
: undefined;
|
|
65
|
+
const sourceRef = record !== undefined && typeof record.sourceRef === "object" && record.sourceRef !== null && !Array.isArray(record.sourceRef)
|
|
66
|
+
? record.sourceRef
|
|
67
|
+
: undefined;
|
|
46
68
|
return sitianReport({
|
|
47
69
|
level: "event",
|
|
48
70
|
kind: TICKET_PROVENANCE_KIND,
|
|
@@ -52,12 +74,13 @@ export function appendTicketProvenanceEntry(input) {
|
|
|
52
74
|
...(input.home === undefined ? {} : { home: input.home }),
|
|
53
75
|
host: input.host ?? "diarist",
|
|
54
76
|
source: input.source ?? "diarist",
|
|
55
|
-
payload: input.
|
|
56
|
-
raw:
|
|
57
|
-
|
|
77
|
+
payload: input.payload,
|
|
78
|
+
raw: sourceRef !== undefined
|
|
79
|
+
&& typeof sourceRef.sessionFile === "string"
|
|
80
|
+
&& (typeof sourceRef.entryId === "string" || typeof sourceRef.entryId === "number")
|
|
58
81
|
? {
|
|
59
|
-
sessionFile:
|
|
60
|
-
entryId:
|
|
82
|
+
sessionFile: sourceRef.sessionFile,
|
|
83
|
+
entryId: sourceRef.entryId,
|
|
61
84
|
}
|
|
62
85
|
: undefined,
|
|
63
86
|
});
|
|
@@ -82,6 +105,7 @@ export async function readTicketProvenance(ticketNumber, cwd, home) {
|
|
|
82
105
|
const { recordFile } = resolveTicketProvenanceVolume(ticketNumber, cwd, home);
|
|
83
106
|
const { records } = await readSitianRecords(recordFile);
|
|
84
107
|
const entries = [];
|
|
108
|
+
const unprojected = [];
|
|
85
109
|
const diagnostics = [];
|
|
86
110
|
let skipped = 0;
|
|
87
111
|
for (const record of records) {
|
|
@@ -97,12 +121,12 @@ export async function readTicketProvenance(ticketNumber, cwd, home) {
|
|
|
97
121
|
}
|
|
98
122
|
const entry = projectTicketProvenanceEntry(record.payload);
|
|
99
123
|
if (entry === undefined) {
|
|
100
|
-
|
|
124
|
+
unprojected.push(record.payload);
|
|
101
125
|
continue;
|
|
102
126
|
}
|
|
103
127
|
entries.push(entry);
|
|
104
128
|
}
|
|
105
|
-
return { entries, diagnostics, records, recordFile, skipped };
|
|
129
|
+
return { entries, unprojected, diagnostics, records, recordFile, skipped };
|
|
106
130
|
}
|
|
107
131
|
/**
|
|
108
132
|
* Fence long enough that any backtick run inside `text` cannot close the block.
|
|
@@ -124,44 +148,70 @@ function markdownFenceFor(text) {
|
|
|
124
148
|
* Presentation only — machines bite JSONL. No wording lock for consumers.
|
|
125
149
|
*/
|
|
126
150
|
export function renderTicketProvenanceMarkdown(input) {
|
|
151
|
+
const unprojected = input.unprojected ?? [];
|
|
127
152
|
const lines = [
|
|
128
153
|
`# 起居录 · #${input.ticketNumber}`,
|
|
129
154
|
"",
|
|
130
|
-
`条目数:${input.entries.length}`,
|
|
155
|
+
`条目数:${input.entries.length + unprojected.length}`,
|
|
131
156
|
"",
|
|
132
157
|
];
|
|
133
158
|
let index = 0;
|
|
134
159
|
for (const entry of input.entries) {
|
|
135
160
|
index += 1;
|
|
136
|
-
|
|
161
|
+
const sourceKind = typeof entry.sourceKind === "string" ? entry.sourceKind : "未投影";
|
|
162
|
+
const timestamp = typeof entry.timestamp === "string" ? entry.timestamp : "";
|
|
163
|
+
lines.push(`## ${index}. ${sourceKind} · ${timestamp}`);
|
|
137
164
|
lines.push("");
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
165
|
+
const basis = entry.basis;
|
|
166
|
+
const method = typeof basis === "object" && basis !== null && !Array.isArray(basis) && typeof basis.method === "string"
|
|
167
|
+
? basis.method
|
|
168
|
+
: "未投影";
|
|
169
|
+
lines.push(`- basis.method: \`${method}\``);
|
|
170
|
+
if (typeof basis === "object" &&
|
|
171
|
+
basis !== null &&
|
|
172
|
+
!Array.isArray(basis) &&
|
|
173
|
+
Array.isArray(basis.anchors) &&
|
|
174
|
+
basis.anchors.length > 0) {
|
|
175
|
+
lines.push(`- anchors: ${basis.anchors.map((a) => `\`${String(a)}\``).join(", ")}`);
|
|
141
176
|
}
|
|
142
|
-
if (
|
|
143
|
-
lines.push(`- note: ${
|
|
177
|
+
if (typeof basis === "object" && basis !== null && !Array.isArray(basis) && basis.note !== undefined) {
|
|
178
|
+
lines.push(`- note: ${String(basis.note)}`);
|
|
144
179
|
}
|
|
180
|
+
const sourceRef = typeof entry.sourceRef === "object" && entry.sourceRef !== null && !Array.isArray(entry.sourceRef)
|
|
181
|
+
? entry.sourceRef
|
|
182
|
+
: {};
|
|
145
183
|
const refParts = [];
|
|
146
|
-
if (
|
|
147
|
-
refParts.push(`sessionFile=${
|
|
184
|
+
if (sourceRef.sessionFile !== undefined) {
|
|
185
|
+
refParts.push(`sessionFile=${String(sourceRef.sessionFile)}`);
|
|
148
186
|
}
|
|
149
|
-
if (
|
|
150
|
-
refParts.push(`entryId=${String(
|
|
187
|
+
if (sourceRef.entryId !== undefined) {
|
|
188
|
+
refParts.push(`entryId=${String(sourceRef.entryId)}`);
|
|
151
189
|
}
|
|
152
|
-
if (
|
|
153
|
-
refParts.push(`path=${
|
|
190
|
+
if (sourceRef.path !== undefined) {
|
|
191
|
+
refParts.push(`path=${String(sourceRef.path)}`);
|
|
154
192
|
}
|
|
155
|
-
if (
|
|
156
|
-
refParts.push(`url=${
|
|
193
|
+
if (sourceRef.url !== undefined) {
|
|
194
|
+
refParts.push(`url=${String(sourceRef.url)}`);
|
|
157
195
|
}
|
|
158
196
|
if (refParts.length > 0) {
|
|
159
197
|
lines.push(`- sourceRef: ${refParts.join(" · ")}`);
|
|
160
198
|
}
|
|
161
199
|
lines.push("");
|
|
162
|
-
const
|
|
200
|
+
const transcript = typeof entry.transcript === "string" ? entry.transcript : JSON.stringify(entry);
|
|
201
|
+
const fence = markdownFenceFor(transcript);
|
|
202
|
+
lines.push(fence);
|
|
203
|
+
lines.push(transcript);
|
|
204
|
+
lines.push(fence);
|
|
205
|
+
lines.push("");
|
|
206
|
+
}
|
|
207
|
+
for (const payload of unprojected) {
|
|
208
|
+
index += 1;
|
|
209
|
+
lines.push(`## ${index}. 未投影`);
|
|
210
|
+
lines.push("");
|
|
211
|
+
const text = typeof payload === "string" ? payload : JSON.stringify(payload);
|
|
212
|
+
const fence = markdownFenceFor(text);
|
|
163
213
|
lines.push(fence);
|
|
164
|
-
lines.push(
|
|
214
|
+
lines.push(text);
|
|
165
215
|
lines.push(fence);
|
|
166
216
|
lines.push("");
|
|
167
217
|
}
|
|
@@ -187,6 +237,7 @@ export function writeTicketProvenanceHumanView(input) {
|
|
|
187
237
|
const md = renderTicketProvenanceMarkdown({
|
|
188
238
|
ticketNumber: input.ticketNumber,
|
|
189
239
|
entries: input.entries,
|
|
240
|
+
...(input.unprojected === undefined ? {} : { unprojected: input.unprojected }),
|
|
190
241
|
});
|
|
191
242
|
writeFileSync(volume.humanViewFile, md, "utf8");
|
|
192
243
|
return volume.humanViewFile;
|
|
@@ -14,8 +14,7 @@ import {
|
|
|
14
14
|
} from "@earendil-works/pi-coding-agent";
|
|
15
15
|
import type { Message } from "@earendil-works/pi-ai";
|
|
16
16
|
|
|
17
|
-
import { createGhCollectorGitHubTransport
|
|
18
|
-
import { createPerDispatchReviewerAgent } from "../src/reviewer-agent.ts";
|
|
17
|
+
import { createGhCollectorGitHubTransport } from "../src/collector-github.ts";
|
|
19
18
|
import { createReviewerPinnedGitReader } from "../src/reviewer-dispatch.ts";
|
|
20
19
|
import { createPiDoctorAuditor } from "../src/doctor-auditor.ts";
|
|
21
20
|
import {
|
|
@@ -108,7 +107,6 @@ export async function loadNavigatorWorkContext(
|
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
export default function roleRuntime(pi: ExtensionAPI): void {
|
|
111
|
-
const reviewerAgent = createPerDispatchReviewerAgent({ packageRoot });
|
|
112
110
|
const oauthKeepaliveProviders = readOAuthKeepaliveProviders();
|
|
113
111
|
registerNavigatorModelCommand(pi);
|
|
114
112
|
const navigatorSessionFactory = createNativeNavigatorSessionFactory();
|
|
@@ -120,7 +118,6 @@ export default function roleRuntime(pi: ExtensionAPI): void {
|
|
|
120
118
|
loadCoderTask: (path) => readFile(path, "utf8"),
|
|
121
119
|
loadReviewerSoul: () => loadMainRoleSessionMaterials("reviewer"),
|
|
122
120
|
createReviewerPinnedGitReader: () => createReviewerPinnedGitReader(),
|
|
123
|
-
createReviewerIssueFetcher: () => createGhIssueSoftFetcher(),
|
|
124
121
|
loadCollectorSoul: () => loadMainRoleSessionMaterials("collector"),
|
|
125
122
|
loadCollectorHandbookSeed: () => readFile(collectorHandbookSeedPath, "utf8"),
|
|
126
123
|
createCollectorTransport: () => createGhCollectorGitHubTransport(),
|
|
@@ -170,8 +167,6 @@ export default function roleRuntime(pi: ExtensionAPI): void {
|
|
|
170
167
|
}
|
|
171
168
|
return loadHomeCanonicalSkillBinding(name);
|
|
172
169
|
},
|
|
173
|
-
runReviewerDispatch: (dispatch, options) => reviewerAgent.run(dispatch, options),
|
|
174
|
-
shutdownReviewerAgent: () => reviewerAgent.shutdown(),
|
|
175
170
|
}, {
|
|
176
171
|
transcriptFromContext,
|
|
177
172
|
oauthKeepalive: { providers: oauthKeepaliveProviders },
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# #836 删 5:从代码迁出的机器指令句清单
|
|
2
|
+
|
|
3
|
+
供陛下过目。不改 soul。确需对角色说的话归入本包资源(ADR 0073)。指针句(附件路径、卷宗指针、「请重读」)保留为中立机器文本,不在本表。
|
|
4
|
+
|
|
5
|
+
| 原位点 | 原句(代码自写) | 处置 |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `role-envelope.ts` `buildSkillExpansion` | `References are relative to ${dirname}.` | 删。方法体原文即可。 |
|
|
8
|
+
| `role-runtime.ts` reviewer parent prompt | `权威 Spec 不存在;未启动 Spec 取证腿。` | 删。Spec 有无由本席读材料自判。 |
|
|
9
|
+
| `compliance-transport.ts` `AUDITOR_DOSSIER_PROMPT` | `本 run 卷宗已就绪。` | 改为察院同形路径指针。 |
|
|
10
|
+
| `doctor-role.ts` case catalog | `provenance: "由留存 session 字节推导,封入受理回执。"` | 删。catalog 只留 cost 与证据指针。 |
|
|
11
|
+
| `collector-role.ts` bounceInfrastructure | `请省略该字段后重新提交。` | 代码打回推翻自报已删。 |
|
|
12
|
+
| `reviewer-role.ts` output description | `Standards/Spec 评审腿由 runtime 以取证子会话代跑…` | 改为「本席自调 code-review skill」。方法步骤在 `resources/methods/code-review/SKILL.md`。 |
|
|
13
|
+
| `run-lifecycle.ts` A4.1 | `[ak-role:resume-continue]` | 生产码不再含此字面量。结算只跳过空轮与引擎指针续跑。 |
|
|
14
|
+
| `run-lifecycle.ts` A4.2 | `重新读 <path>` | 前轮已删改写。 |
|
|
15
|
+
| `submission-correctable-error.ts` A4.5 | `终局交卷并非本轮唯一工具调用。` | 删。Pi/ACP `deliverSubmissionRejection` 不再注入该句。 |
|
|
16
|
+
| `role-runtime.ts` 催交 | `本会话尚无已接受的 typed 回执。` | **留**(轮次/预算,Q2)。 |
|
|
17
|
+
|
|
18
|
+
催交句与 2.1–2.3 打回文、重问三句不在删除列。
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
driveExternalRoleTurnRounds,
|
|
8
8
|
raceAgainstHostAbort,
|
|
9
9
|
} from "../external-host-turn-loop.ts";
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
import { reportHostSessionEvent } from "../host-session-record.ts";
|
|
12
12
|
import {
|
|
13
13
|
renderSystemPromptOverride,
|
|
@@ -22,6 +22,8 @@ export interface AcpConnection {
|
|
|
22
22
|
notify(method: string, params: Readonly<Record<string, unknown>>): void;
|
|
23
23
|
/** Subscribe to agent→client notifications (session/update stream, etc.). */
|
|
24
24
|
onNotification?(handler: (method: string, params: Readonly<Record<string, unknown>>) => void): void;
|
|
25
|
+
/** Full process stderr accumulated so far (#836). */
|
|
26
|
+
stderr?(): string;
|
|
25
27
|
close(): Promise<void>;
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -93,7 +95,7 @@ export function connectAcpStdio(options: {
|
|
|
93
95
|
child.kill("SIGTERM");
|
|
94
96
|
};
|
|
95
97
|
child.stderr.setEncoding("utf8").on("data", (chunk: string) => {
|
|
96
|
-
stderr
|
|
98
|
+
stderr += chunk;
|
|
97
99
|
});
|
|
98
100
|
child.on("error", (error) => settleClosed(acpError("acp-process-error", `ACP process error: ${error.message}`, error)));
|
|
99
101
|
createInterface({ input: child.stdout }).on("line", (line) => {
|
|
@@ -159,6 +161,9 @@ export function connectAcpStdio(options: {
|
|
|
159
161
|
onNotification(handler) {
|
|
160
162
|
notificationHandlers.push(handler);
|
|
161
163
|
},
|
|
164
|
+
stderr() {
|
|
165
|
+
return stderr;
|
|
166
|
+
},
|
|
162
167
|
async close() {
|
|
163
168
|
if (closed) return;
|
|
164
169
|
settleClosed(acpError("acp-connection-closed", "ACP connection is closed"));
|
|
@@ -316,7 +321,7 @@ export function createAcpRoleTurnHost(config: AcpRoleTurnHostConfig): RoleTurnHo
|
|
|
316
321
|
result: failure("output", "AcpRefusal", "refusal", { sessionId }),
|
|
317
322
|
};
|
|
318
323
|
}
|
|
319
|
-
return { status: "delivered" };
|
|
324
|
+
return { status: "delivered", stderr: activeConnection.stderr?.() ?? "" };
|
|
320
325
|
},
|
|
321
326
|
async afterAccepted() {
|
|
322
327
|
await rpc("session/close", { sessionId: activeSessionId });
|
|
@@ -61,10 +61,9 @@ export type AnalystGateCycleRound = {
|
|
|
61
61
|
readonly officerStartedAt: string;
|
|
62
62
|
readonly officerEndedAt: string;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
* projection). Analyst metrics still consume findingsCount only — never prose.
|
|
64
|
+
* Officer findings as recorded. Metrics consume findingsCount only — never prose.
|
|
66
65
|
*/
|
|
67
|
-
readonly findings: readonly
|
|
66
|
+
readonly findings: readonly unknown[];
|
|
68
67
|
/** findings.length — retained so metric families need not re-derive. */
|
|
69
68
|
readonly findingsCount: number;
|
|
70
69
|
/** Direct summons or historical province-paired dispatch. */
|
|
@@ -119,10 +118,9 @@ function normalizeOfficerArg(raw: unknown): "inspector" | "notary" | undefined {
|
|
|
119
118
|
return OFFICER_ARG_ALIASES[raw.trim()];
|
|
120
119
|
}
|
|
121
120
|
|
|
122
|
-
/**
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
return value.filter((item): item is string => typeof item === "string");
|
|
121
|
+
/** Findings as recorded — missing/non-array → []. */
|
|
122
|
+
function asFindings(value: unknown): readonly unknown[] {
|
|
123
|
+
return Array.isArray(value) ? value : [];
|
|
126
124
|
}
|
|
127
125
|
|
|
128
126
|
/**
|
|
@@ -162,16 +160,11 @@ function acceptedGateReceiptIds(
|
|
|
162
160
|
return accepted;
|
|
163
161
|
}
|
|
164
162
|
|
|
165
|
-
function
|
|
163
|
+
function readAcceptedGateStatus(
|
|
166
164
|
args: Record<string, unknown> | undefined,
|
|
167
|
-
filePath: string,
|
|
168
165
|
): string {
|
|
169
|
-
if (args === undefined
|
|
170
|
-
|
|
171
|
-
`accepted gate receipt missing usable status in ${filePath}`,
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
return args.status.trim();
|
|
166
|
+
if (args === undefined) return "";
|
|
167
|
+
return typeof args.status === "string" ? args.status : args.status === undefined ? "" : String(args.status);
|
|
175
168
|
}
|
|
176
169
|
|
|
177
170
|
function requireAcceptedGateSpan(
|
|
@@ -216,7 +209,7 @@ type ClassifiedVolume =
|
|
|
216
209
|
readonly endedAt: string;
|
|
217
210
|
readonly officer: "inspector" | "notary";
|
|
218
211
|
readonly status: string;
|
|
219
|
-
readonly findings: readonly
|
|
212
|
+
readonly findings: readonly unknown[];
|
|
220
213
|
readonly findingsCount: number;
|
|
221
214
|
readonly officerWallMs: number;
|
|
222
215
|
readonly attemptEntryId?: string;
|
|
@@ -288,8 +281,8 @@ function projectAcceptedGateCall(
|
|
|
288
281
|
): ClassifiedVolume | undefined {
|
|
289
282
|
// Continuous memory volumes carry many summons; span only this binding's interval.
|
|
290
283
|
const span = requireAcceptedGateSpan(intervalRowsForGateCall(rows, call.rowIndex), filePath);
|
|
291
|
-
const status =
|
|
292
|
-
const findings =
|
|
284
|
+
const status = readAcceptedGateStatus(call.args);
|
|
285
|
+
const findings = asFindings(call.args?.findings);
|
|
293
286
|
const findingsCount = findings.length;
|
|
294
287
|
const bindingFields = {
|
|
295
288
|
...(call.attemptEntryId === undefined ? {} : { attemptEntryId: call.attemptEntryId }),
|
|
@@ -297,21 +290,16 @@ function projectAcceptedGateCall(
|
|
|
297
290
|
};
|
|
298
291
|
|
|
299
292
|
if (DISPATCH_TOOLS.has(call.toolName)) {
|
|
300
|
-
// Lawful province non-dispatch release — opens no round
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
// Pairing terminal is dispatch; unknown/non-contract status stays loud (#475).
|
|
293
|
+
// Lawful province non-dispatch release — opens no round (#597).
|
|
294
|
+
// #836 / #622: bounce|escalate|unknown status must not throw and kill parent settlement.
|
|
295
|
+
// Only a real dispatch pairs; everything else is omitted from pairing (原 payload 已在账本).
|
|
305
296
|
if (status !== "dispatch") {
|
|
306
|
-
|
|
307
|
-
`accepted dispatch receipt has non-dispatch status ${JSON.stringify(status)} in ${filePath}`,
|
|
308
|
-
);
|
|
297
|
+
return undefined;
|
|
309
298
|
}
|
|
310
299
|
const officer = normalizeOfficerArg(call.args?.officer);
|
|
311
300
|
if (officer === undefined) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
);
|
|
301
|
+
// Missing officer on a dispatch face — omit pairing; do not kill parent (#836).
|
|
302
|
+
return undefined;
|
|
315
303
|
}
|
|
316
304
|
const reason = optionalDispatchReason(call.args?.reason);
|
|
317
305
|
return {
|
package/src/audit-escalation.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
ComplianceDecision,
|
|
5
5
|
} from "./compliance-transport.ts";
|
|
6
6
|
import { readableGateItem } from "./readable-gate-item.ts";
|
|
7
|
+
import { GatekeeperDecisionError } from "./submission-errors.ts";
|
|
7
8
|
|
|
8
9
|
export const AUDIT_ESCALATION_KIND = "audit_escalation" as const;
|
|
9
10
|
|
|
@@ -80,24 +81,10 @@ export function buildAuditEscalationResult(
|
|
|
80
81
|
if (Object.hasOwn(decision, "findings") && (decision as { findings?: unknown }).findings !== undefined) {
|
|
81
82
|
auditOwned.findings = (decision as { findings?: unknown }).findings;
|
|
82
83
|
}
|
|
83
|
-
const deliveredFields =
|
|
84
|
-
deliveredOutput !== undefined &&
|
|
85
|
-
deliveredOutput !== null &&
|
|
86
|
-
typeof deliveredOutput === "object" &&
|
|
87
|
-
!Array.isArray(deliveredOutput)
|
|
88
|
-
? { ...(deliveredOutput as Record<string, unknown>) }
|
|
89
|
-
: {};
|
|
90
|
-
// Role output cannot fill an absent audit/officer-owned field.
|
|
91
|
-
delete deliveredFields.conflicts;
|
|
92
|
-
delete deliveredFields.auditDecisionGate;
|
|
93
|
-
if (Object.hasOwn(decision, "officer")) {
|
|
94
|
-
delete deliveredFields.reason;
|
|
95
|
-
delete deliveredFields.officer;
|
|
96
|
-
delete deliveredFields.findings;
|
|
97
|
-
}
|
|
98
84
|
const result = {
|
|
99
|
-
|
|
100
|
-
...
|
|
85
|
+
kind: AUDIT_ESCALATION_KIND,
|
|
86
|
+
...(deliveredOutput !== undefined ? { receipt: deliveredOutput } : {}),
|
|
87
|
+
audit: auditOwned,
|
|
101
88
|
} as AuditEscalationResult;
|
|
102
89
|
AUDIT_ESCALATION_LIVE_REGISTRY.add(result);
|
|
103
90
|
return result;
|
|
@@ -111,45 +98,14 @@ export function isAuditEscalationProjection(
|
|
|
111
98
|
return AUDIT_ESCALATION_LIVE_REGISTRY.has(value);
|
|
112
99
|
}
|
|
113
100
|
|
|
114
|
-
function humanDecisionText(
|
|
115
|
-
decision: AuditEscalationDecision,
|
|
116
|
-
result: AuditEscalationResult,
|
|
117
|
-
): string {
|
|
118
|
-
const officer = Object.hasOwn(decision, "officer")
|
|
119
|
-
? (decision as OfficerAuditEscalationDecision).officer
|
|
120
|
-
: undefined;
|
|
121
|
-
const lines = [
|
|
122
|
-
officer === undefined
|
|
123
|
-
? "Human decision required: compliance audit escalation."
|
|
124
|
-
: `Human decision required: ${officer} escalation.`,
|
|
125
|
-
];
|
|
126
|
-
if (officer !== undefined && typeof result.reason === "string") {
|
|
127
|
-
lines.push(`Reason: ${result.reason}`);
|
|
128
|
-
}
|
|
129
|
-
if (Array.isArray(result.conflicts)) {
|
|
130
|
-
lines.push("Conflicts:", ...result.conflicts.map((conflict) => `- ${readableGateItem(conflict)}`));
|
|
131
|
-
}
|
|
132
|
-
if (officer !== undefined && Array.isArray(result.findings) && result.findings.length > 0) {
|
|
133
|
-
lines.push("Findings:", ...result.findings.map((finding) => `- ${readableGateItem(finding)}`));
|
|
134
|
-
}
|
|
135
|
-
const gate = result.auditDecisionGate;
|
|
136
|
-
if (gate !== null && typeof gate === "object" && !Array.isArray(gate)) {
|
|
137
|
-
const record = gate as Record<string, unknown>;
|
|
138
|
-
if (typeof record.question === "string") lines.push(`Question: ${record.question}`);
|
|
139
|
-
if (Array.isArray(record.options)) {
|
|
140
|
-
lines.push("Options:", ...record.options.map((option) => `- ${readableGateItem(option)}`));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return lines.join("\n");
|
|
144
|
-
}
|
|
145
|
-
|
|
146
101
|
export function projectAuditEscalation(
|
|
147
102
|
decision: AuditEscalationDecision,
|
|
148
103
|
deliveredOutput?: unknown,
|
|
149
104
|
): AuditEscalationToolResult {
|
|
150
105
|
const details = buildAuditEscalationResult(decision, deliveredOutput);
|
|
106
|
+
const original = deliveredOutput !== undefined ? deliveredOutput : decision;
|
|
151
107
|
return {
|
|
152
|
-
content: [{ type: "text", text:
|
|
108
|
+
content: [{ type: "text", text: readableGateItem(original) }],
|
|
153
109
|
details,
|
|
154
110
|
terminate: true,
|
|
155
111
|
...(decision.usage === undefined ? {} : { usage: decision.usage }),
|
|
@@ -186,6 +142,10 @@ export type ComplianceDecisionHandlers<T> = {
|
|
|
186
142
|
) => T | PromiseLike<T>;
|
|
187
143
|
bounce: (violations: readonly unknown[]) => T | PromiseLike<T>;
|
|
188
144
|
escalate: (result: AuditEscalationToolResult) => T | PromiseLike<T>;
|
|
145
|
+
/** Host failure beside any recorded auditor payloads — parent is not accepted. */
|
|
146
|
+
transportFailure?: (
|
|
147
|
+
facts: Extract<ComplianceDecision, { status: "transport_failure" }>,
|
|
148
|
+
) => T | PromiseLike<T>;
|
|
189
149
|
};
|
|
190
150
|
|
|
191
151
|
/**
|
|
@@ -225,5 +185,15 @@ export async function disposeComplianceDecision<T>(
|
|
|
225
185
|
return await handlers.escalate(
|
|
226
186
|
projectAuditEscalation(decision, deliveredOutput),
|
|
227
187
|
);
|
|
188
|
+
case "transport_failure":
|
|
189
|
+
if (handlers.transportFailure !== undefined) {
|
|
190
|
+
return await handlers.transportFailure(decision);
|
|
191
|
+
}
|
|
192
|
+
throw new GatekeeperDecisionError({
|
|
193
|
+
status: "transport_failure",
|
|
194
|
+
stage: "auditor",
|
|
195
|
+
reason: decision.diagnostic,
|
|
196
|
+
submission: decision.submissions ?? decision.terminal,
|
|
197
|
+
});
|
|
228
198
|
}
|
|
229
199
|
}
|
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
1
|
import { dirname, join, resolve } from "node:path";
|
|
3
2
|
|
|
4
3
|
import type { AgentToolResult, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
5
4
|
import type { HostContext } from "./host-contracts.ts";
|
|
6
|
-
import { readableGateItem } from "./readable-gate-item.ts";
|
|
7
5
|
import { Type } from "typebox";
|
|
8
6
|
|
|
9
7
|
export const AUDITOR_DOSSIER_TOOL_NAME = "ak_get_run_dossier" as const;
|
|
10
8
|
|
|
11
|
-
/** Run-relative leaf written before gate officer summons (#632 Grok header-only session). */
|
|
12
|
-
export const GATE_SUBMISSION_CANDIDATE_FILE = "gate-submission-candidate.json" as const;
|
|
13
|
-
|
|
14
9
|
export type AuditorDossierLocation = {
|
|
15
10
|
readonly runDirectory: string;
|
|
16
11
|
readonly admittedRequest: string;
|
|
17
12
|
readonly parentSessionCandidate: string;
|
|
18
13
|
readonly attachments: string;
|
|
19
14
|
readonly artifacts: string;
|
|
20
|
-
/** Set when gate summons persisted the in-flight tool-call leaf (#632). */
|
|
21
|
-
readonly submissionCandidate?: string;
|
|
22
15
|
};
|
|
23
16
|
|
|
24
|
-
export type GateSubmissionSessionContext = {
|
|
25
|
-
readonly sessionManager?: {
|
|
26
|
-
getEntries?(): Iterable<unknown>;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
31
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
17
|
/** Resolve the exact run binding already carried by the parent record session. */
|
|
35
18
|
export function auditorRunDirectory(context: ExtensionContext | HostContext): string | undefined {
|
|
36
19
|
const sessionFile = context.sessionManager?.getSessionFile?.();
|
|
@@ -39,93 +22,16 @@ export function auditorRunDirectory(context: ExtensionContext | HostContext): st
|
|
|
39
22
|
return resolve(dirname(dirname(sessionFile)));
|
|
40
23
|
}
|
|
41
24
|
|
|
42
|
-
/**
|
|
43
|
-
* Latest assistant toolCall leaf on parent session books (memory or disk-backed).
|
|
44
|
-
* Grok books the candidate in memory only (#617 DK-4); Pi books the same shape on JSONL.
|
|
45
|
-
*/
|
|
46
|
-
export function readLatestToolCallLeaf(context: GateSubmissionSessionContext): unknown | undefined {
|
|
47
|
-
const entries = [...(context.sessionManager?.getEntries?.() ?? [])];
|
|
48
|
-
for (let i = entries.length - 1; i >= 0; i--) {
|
|
49
|
-
const entry = entries[i];
|
|
50
|
-
if (!isRecord(entry) || entry.type !== "message" || !isRecord(entry.message)) continue;
|
|
51
|
-
const message = entry.message;
|
|
52
|
-
if (message.role !== "assistant" || !Array.isArray(message.content)) continue;
|
|
53
|
-
for (const part of message.content) {
|
|
54
|
-
if (isRecord(part) && part.type === "toolCall") {
|
|
55
|
-
return entry;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function gateSubmissionCandidatePath(runDirectory: string): string {
|
|
63
|
-
return join(runDirectory, "artifacts", GATE_SUBMISSION_CANDIDATE_FILE);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Arguments of the latest assistant toolCall leaf — the in-flight 交卷 body.
|
|
68
|
-
* Transport assembly only: does not interpret field contents (#786).
|
|
69
|
-
*/
|
|
70
|
-
export function readLatestSubmissionArguments(
|
|
71
|
-
context: GateSubmissionSessionContext,
|
|
72
|
-
): unknown | undefined {
|
|
73
|
-
const leaf = readLatestToolCallLeaf(context);
|
|
74
|
-
if (!isRecord(leaf) || !isRecord(leaf.message) || !Array.isArray(leaf.message.content)) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
for (const part of leaf.message.content) {
|
|
78
|
-
if (isRecord(part) && part.type === "toolCall" && "arguments" in part) {
|
|
79
|
-
return part.arguments;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Verbatim parent-submission body for gate-officer same-parent resume (#786).
|
|
87
|
-
* Three pairs share this face: countersign↔notary, judge↔auditor, worker↔inspector.
|
|
88
|
-
* Code relays bytes; it does not parse, judge, or rewrite the submission.
|
|
89
|
-
* Symmetric with bounce direction (officer receipt → parent via readableGateItem).
|
|
90
|
-
* No path/pointer substitute — argv 卷宗指针 stays on the code-summons face (ADR 0079).
|
|
91
|
-
*/
|
|
92
|
-
export function buildGateOfficerReviewInstruction(input: {
|
|
93
|
-
readonly submission: unknown;
|
|
94
|
-
}): string {
|
|
95
|
-
return readableGateItem(input.submission);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Persist the in-flight tool-call leaf as a run-directory artifact so pointer-only
|
|
100
|
-
* officer summons resolve on hosts whose session.jsonl is header-only (#632 / DK-4).
|
|
101
|
-
* Returns the written path, or undefined when no toolCall leaf is on the books.
|
|
102
|
-
*/
|
|
103
|
-
export function persistGateSubmissionCandidate(
|
|
104
|
-
runDirectory: string,
|
|
105
|
-
context: GateSubmissionSessionContext,
|
|
106
|
-
): string | undefined {
|
|
107
|
-
const leaf = readLatestToolCallLeaf(context);
|
|
108
|
-
if (leaf === undefined) return undefined;
|
|
109
|
-
const path = gateSubmissionCandidatePath(runDirectory);
|
|
110
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
111
|
-
writeFileSync(path, `${JSON.stringify(leaf)}\n`, "utf8");
|
|
112
|
-
return path;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export type CreateAuditorDossierToolOptions = {
|
|
116
|
-
/** Absolute path of the gate-persisted submission leaf, when written. */
|
|
117
|
-
readonly submissionCandidate?: string;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
25
|
/** The one shared, run-bound dossier locator exposed to every auditor seat. */
|
|
121
26
|
export function createAuditorDossierTool(
|
|
122
27
|
runDirectory: string | undefined,
|
|
123
|
-
options?: CreateAuditorDossierToolOptions,
|
|
124
28
|
) {
|
|
125
29
|
return {
|
|
126
30
|
name: AUDITOR_DOSSIER_TOOL_NAME,
|
|
127
31
|
description: "定位本审计席绑定的 run 卷宗及其证据入口。",
|
|
128
|
-
|
|
32
|
+
// #836 r16 class 3: execute() ignores `_params` entirely — a closed root
|
|
33
|
+
// only rejects the role for saying more.
|
|
34
|
+
parameters: Type.Object({}, { additionalProperties: true }),
|
|
129
35
|
async execute(_id: string, _params: unknown): Promise<AgentToolResult<AuditorDossierLocation | undefined>> {
|
|
130
36
|
if (runDirectory === undefined) {
|
|
131
37
|
return {
|
|
@@ -133,17 +39,13 @@ export function createAuditorDossierTool(
|
|
|
133
39
|
details: undefined,
|
|
134
40
|
};
|
|
135
41
|
}
|
|
136
|
-
|
|
137
|
-
const submissionCandidate = options?.submissionCandidate;
|
|
138
|
-
// Prefer the persisted gate leaf when present: Grok session.jsonl is header-only
|
|
139
|
-
// (#617 DK-4) and is not a candidate source after material deletion (#632).
|
|
42
|
+
// #836: whole run directory pointer — officer finds materials; no leaf preference (A7.2).
|
|
140
43
|
const details: AuditorDossierLocation = {
|
|
141
44
|
runDirectory,
|
|
142
45
|
admittedRequest: join(runDirectory, "admitted-request.json"),
|
|
143
|
-
parentSessionCandidate:
|
|
46
|
+
parentSessionCandidate: join(runDirectory, "session", "session.jsonl"),
|
|
144
47
|
attachments: join(runDirectory, "attachments"),
|
|
145
48
|
artifacts: join(runDirectory, "artifacts"),
|
|
146
|
-
...(submissionCandidate === undefined ? {} : { submissionCandidate }),
|
|
147
49
|
};
|
|
148
50
|
return {
|
|
149
51
|
content: [{ type: "text", text: JSON.stringify(details) }],
|
|
@@ -52,13 +52,14 @@ export function captureCanonicalSkillExpansion<Name extends CanonicalSkillName>(
|
|
|
52
52
|
: evidence?.location === snapshot.path
|
|
53
53
|
? snapshot.path
|
|
54
54
|
: undefined;
|
|
55
|
-
const expectedContent = matchedPath === undefined
|
|
55
|
+
const expectedContent = matchedPath === undefined ? undefined : snapshot.body;
|
|
56
|
+
const prefixedContent = matchedPath === undefined
|
|
56
57
|
? undefined
|
|
57
58
|
: `References are relative to ${dirname(matchedPath)}.\n\n${snapshot.body}`;
|
|
58
59
|
if (
|
|
59
60
|
evidence?.name !== name
|
|
60
61
|
|| matchedPath === undefined
|
|
61
|
-
|| evidence.content !== expectedContent
|
|
62
|
+
|| (evidence.content !== expectedContent && evidence.content !== prefixedContent)
|
|
62
63
|
|| evidence.userMessage !== originalRequest
|
|
63
64
|
) {
|
|
64
65
|
return undefined;
|