@principles/pd-cli 1.161.0 → 1.162.1

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.
@@ -0,0 +1,387 @@
1
+ /**
2
+ * PRI-1051: one verdict across PD's four delivery surfaces.
3
+ *
4
+ * An update is not delivered when the internal chains are green — it is
5
+ * delivered when every surface that exists on this machine carries the
6
+ * canonical release's bytes and, for hosts that load plugins at start, the
7
+ * host has started since those bytes landed. 2026-10-27: the canonical
8
+ * runtime and the OpenClaw extension were on core 1.297.2 while the Codex
9
+ * plugin still executed 1.296.2, and nothing answered that question directly.
10
+ *
11
+ * Every row is DERIVED from the authority that already owns the fact:
12
+ *
13
+ * canonical-runtime active.json + live ~/.pd/runtime manifests (version report)
14
+ * openclaw-extension the extension shell's own package.json
15
+ * codex-plugin marketplace pin + the runtime under plugin data
16
+ * companion none — it ships on its own companion-v* track
17
+ *
18
+ * Nothing is cached, persisted or written, and no network is contacted: "a
19
+ * NEWER release exists" remains the update channel's question. A surface that
20
+ * cannot be read is `unknown` with a structured reason, never a silent `ok`
21
+ * (rc-9).
22
+ */
23
+ import * as fs from 'fs';
24
+ import * as os from 'os';
25
+ import { getInstallLayoutPaths } from '@principles/install-layout';
26
+ import { buildVersionReport } from './version-report.js';
27
+ import { findNewestRolloutFile, readInstalledCodexRuntime, resolveCodexHome, selectMarketplaceCacheVersionDir, } from './codex-plugin-install.js';
28
+ const COMPONENT_VERSION_KEYS = ['core', 'codex-adapter', 'host-runtime'];
29
+ function pickComponents(report, keys) {
30
+ const picked = {};
31
+ for (const key of keys) {
32
+ const version = report.components[key];
33
+ if (version !== undefined)
34
+ picked[key] = version;
35
+ }
36
+ return picked;
37
+ }
38
+ function judgeCanonicalRuntime(report) {
39
+ const expected = {
40
+ productVersion: report.productVersion,
41
+ generation: String(report.generation),
42
+ };
43
+ const actual = {
44
+ componentsSource: report.componentsSource ?? 'unknown',
45
+ health: report.health,
46
+ ...pickComponents(report, ['core', 'plugin', 'pd-cli']),
47
+ };
48
+ const base = { id: 'canonical-runtime', label: 'Canonical runtime (~/.pd/runtime)', required: true, expected, actual };
49
+ if (report.source === 'official-legacy-overlay') {
50
+ return {
51
+ ...base,
52
+ status: 'unknown',
53
+ reason: 'legacy_overlay_layout',
54
+ nextAction: 'Run the official installer (npx create-principles-disciple) to migrate this legacy overlay install into the canonical layout.',
55
+ };
56
+ }
57
+ if (report.health === 'corrupt') {
58
+ return {
59
+ ...base,
60
+ status: 'unknown',
61
+ reason: 'active_identity_mismatch',
62
+ nextAction: 'Run the official installer recovery, or re-run the official installer to repair the installation record.',
63
+ };
64
+ }
65
+ // health === 'degraded' means the release manifest for the active generation
66
+ // is unreadable, so the bytes on disk cannot be tied to a release. Returning
67
+ // ok here printed "Delivery: complete" with exit 0 while `pd version` called
68
+ // the same install degraded — the opposite of "never a silent ok".
69
+ if (report.health === 'degraded') {
70
+ return {
71
+ ...base,
72
+ status: 'unknown',
73
+ reason: 'canonical_health_degraded',
74
+ nextAction: 'Run the official installer (npx create-principles-disciple) to restore the release metadata, then re-run this check.',
75
+ };
76
+ }
77
+ if (report.componentsSource !== 'runtime') {
78
+ return {
79
+ ...base,
80
+ status: 'stale',
81
+ reason: 'runtime_dir_missing',
82
+ nextAction: 'Run the official installer (npx create-principles-disciple) to populate the live runtime from the active release.',
83
+ };
84
+ }
85
+ const missing = ['core', 'plugin', 'pd-cli'].filter((component) => report.components[component] === undefined);
86
+ if (missing.length > 0) {
87
+ return {
88
+ ...base,
89
+ status: 'unknown',
90
+ reason: 'runtime_component_missing',
91
+ nextAction: 'Run the official installer (npx create-principles-disciple) to repair the live runtime component manifests.',
92
+ detail: `unreadable manifests: ${missing.join(', ')}`,
93
+ };
94
+ }
95
+ return { ...base, status: 'ok' };
96
+ }
97
+ function readPackageVersion(filePath) {
98
+ try {
99
+ const parsed = JSON.parse(fs.readFileSync(filePath, 'utf8'));
100
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
101
+ return null;
102
+ const version = Object.hasOwn(parsed, 'version') ? Reflect.get(parsed, 'version') : undefined;
103
+ return typeof version === 'string' && version.length > 0 ? version : null;
104
+ }
105
+ catch {
106
+ return null;
107
+ }
108
+ }
109
+ function judgeOpenClawExtension(report, layout) {
110
+ const expectedPlugin = report.components.plugin;
111
+ const expected = expectedPlugin === undefined ? {} : { plugin: expectedPlugin };
112
+ const extensionManifest = `${layout.openClawExtensionDir}/package.json`;
113
+ const actual = { plugin: fs.existsSync(extensionManifest) ? readPackageVersion(extensionManifest) : null };
114
+ const base = {
115
+ id: 'openclaw-extension',
116
+ label: 'OpenClaw extension (~/.openclaw/extensions/principles-disciple)',
117
+ expected,
118
+ actual,
119
+ detail: layout.openClawExtensionDir,
120
+ };
121
+ if (!fs.existsSync(layout.openClawDir)) {
122
+ return {
123
+ ...base,
124
+ status: 'not_applicable',
125
+ required: false,
126
+ reason: 'openclaw_not_installed',
127
+ detail: `${layout.openClawDir} does not exist — OpenClaw is not installed on this machine.`,
128
+ };
129
+ }
130
+ if (!fs.existsSync(layout.openClawExtensionDir)) {
131
+ return {
132
+ ...base,
133
+ status: 'stale',
134
+ required: true,
135
+ reason: 'extension_missing',
136
+ nextAction: 'Run the official installer (npx create-principles-disciple) so the OpenClaw extension shell is re-synced from the canonical runtime.',
137
+ };
138
+ }
139
+ if (actual.plugin === null) {
140
+ return {
141
+ ...base,
142
+ status: 'unknown',
143
+ required: true,
144
+ reason: 'extension_manifest_unreadable',
145
+ nextAction: 'Run the official installer (npx create-principles-disciple) to repair the extension manifest.',
146
+ };
147
+ }
148
+ if (expectedPlugin === undefined) {
149
+ return {
150
+ ...base,
151
+ status: 'unknown',
152
+ required: true,
153
+ reason: 'canonical_component_version_unavailable',
154
+ nextAction: 'Fix the canonical runtime first (see the canonical-runtime row), then re-run this check.',
155
+ };
156
+ }
157
+ if (actual.plugin !== expectedPlugin) {
158
+ return {
159
+ ...base,
160
+ status: 'stale',
161
+ required: true,
162
+ reason: 'extension_version_mismatch',
163
+ nextAction: 'Run the official installer (npx create-principles-disciple) so the OpenClaw extension shell is re-synced from the canonical runtime.',
164
+ };
165
+ }
166
+ return { ...base, status: 'ok', required: true };
167
+ }
168
+ /**
169
+ * Host-start verdict, kept pure so the unreadable paths are testable without
170
+ * faking filesystem timestamps: a host that started before the plugin bytes
171
+ * landed is still executing the previous ones.
172
+ *
173
+ * Heuristic limit (accepted, documented): the caller feeds the newest rollout
174
+ * file BY MTIME, so a resumed long-lived session can carry an old birth time
175
+ * with a fresh mtime. That misreads as "needs restart" (the safe direction) and
176
+ * never as a false ok.
177
+ */
178
+ export function judgeHostRestart(installedAtMs, newestRollout) {
179
+ if (newestRollout === null)
180
+ return { status: 'unknown', reason: 'host_start_time_unavailable' };
181
+ if (newestRollout.birthtimeMs <= 0)
182
+ return { status: 'unknown', reason: 'host_start_time_unavailable' };
183
+ if (installedAtMs === null)
184
+ return { status: 'unknown', reason: 'plugin_install_time_unavailable' };
185
+ return newestRollout.birthtimeMs >= installedAtMs
186
+ ? { status: 'ok' }
187
+ : { status: 'ready_needs_host_restart', reason: 'host_started_before_runtime' };
188
+ }
189
+ function judgeCodexPlugin(report, env, homeDir) {
190
+ const codexHome = resolveCodexHome(env, homeDir);
191
+ const canonical = pickComponents(report, COMPONENT_VERSION_KEYS);
192
+ const expected = {};
193
+ if (canonical.core !== undefined)
194
+ expected.core = canonical.core;
195
+ if (canonical['codex-adapter'] !== undefined)
196
+ expected.codexAdapter = canonical['codex-adapter'];
197
+ if (canonical['host-runtime'] !== undefined)
198
+ expected.hostRuntime = canonical['host-runtime'];
199
+ const base = {
200
+ id: 'codex-plugin',
201
+ label: 'Codex plugin (marketplace pin + plugin data runtime)',
202
+ expected,
203
+ detail: codexHome,
204
+ };
205
+ if (!fs.existsSync(codexHome)) {
206
+ return {
207
+ ...base,
208
+ status: 'not_applicable',
209
+ required: false,
210
+ reason: 'codex_not_installed',
211
+ actual: {},
212
+ detail: `${codexHome} does not exist — Codex is not installed on this machine.`,
213
+ };
214
+ }
215
+ const cacheSelection = selectMarketplaceCacheVersionDir(codexHome);
216
+ const installed = readInstalledCodexRuntime(codexHome);
217
+ const actual = {
218
+ core: installed.core,
219
+ codexAdapter: installed.codexAdapter,
220
+ hostRuntime: installed.hostRuntime,
221
+ };
222
+ const pinDetail = cacheSelection === null
223
+ ? 'pin: unreadable'
224
+ : `pin ${cacheSelection.dirName}: core ${cacheSelection.pin.core ?? 'unreadable'}, adapter ${cacheSelection.pin.codexAdapter ?? 'unreadable'}`;
225
+ const withDetail = (detail) => `${pinDetail}; ${detail}`;
226
+ if (cacheSelection === null) {
227
+ return {
228
+ ...base,
229
+ status: 'unknown',
230
+ required: true,
231
+ actual,
232
+ reason: 'plugin_pin_unavailable',
233
+ nextAction: 'Re-add the plugin (codex plugin add principles-disciple@principles), re-run the $pd-control setup skill, then restart Codex.',
234
+ detail: withDetail('the marketplace snapshot PD publishes is missing or unreadable'),
235
+ };
236
+ }
237
+ if (!installed.present) {
238
+ return {
239
+ ...base,
240
+ status: 'stale',
241
+ required: true,
242
+ actual,
243
+ reason: 'plugin_runtime_missing',
244
+ nextAction: 'Re-run the $pd-control setup skill so the pinned runtime is installed, then restart Codex.',
245
+ detail: withDetail('no runtime under plugin data — hooks cannot execute'),
246
+ };
247
+ }
248
+ if (expected.core === undefined || expected.codexAdapter === undefined) {
249
+ return {
250
+ ...base,
251
+ status: 'unknown',
252
+ required: true,
253
+ actual,
254
+ reason: 'canonical_component_version_unavailable',
255
+ nextAction: 'Fix the canonical runtime first (see the canonical-runtime row), then re-run this check.',
256
+ detail: withDetail('the canonical runtime does not report core/codex-adapter'),
257
+ };
258
+ }
259
+ const canonicalHostRuntime = canonical['host-runtime'];
260
+ const pinBehind = cacheSelection.pin.core !== expected.core
261
+ || cacheSelection.pin.codexAdapter !== expected.codexAdapter
262
+ || (canonicalHostRuntime !== undefined && cacheSelection.pin.hostRuntime !== canonicalHostRuntime);
263
+ if (pinBehind) {
264
+ return {
265
+ ...base,
266
+ status: 'stale',
267
+ required: true,
268
+ actual,
269
+ reason: 'plugin_pin_behind_runtime',
270
+ nextAction: 'Refresh the Codex plugin cache (codex plugin remove principles-disciple@principles && codex plugin add principles-disciple@principles), re-run the $pd-control setup skill, then restart Codex.',
271
+ detail: withDetail('the snapshot PD publishes still pins older versions than the canonical runtime'),
272
+ };
273
+ }
274
+ if (installed.core !== cacheSelection.pin.core
275
+ || installed.codexAdapter !== cacheSelection.pin.codexAdapter
276
+ || (cacheSelection.pin.hostRuntime !== undefined && installed.hostRuntime !== cacheSelection.pin.hostRuntime)) {
277
+ return {
278
+ ...base,
279
+ status: 'stale',
280
+ required: true,
281
+ actual,
282
+ reason: 'plugin_runtime_not_refreshed',
283
+ nextAction: 'Re-run the $pd-control setup skill so the pinned runtime is reinstalled, then restart Codex.',
284
+ detail: withDetail('the executed runtime does not match the pin'),
285
+ };
286
+ }
287
+ const newestRollout = findNewestRolloutFile(codexHome);
288
+ const host = judgeHostRestart(installed.installedAtMs, newestRollout);
289
+ if (host.status === 'ok') {
290
+ return { ...base, status: 'ok', required: true, actual, detail: withDetail('host started after the runtime landed') };
291
+ }
292
+ if (host.status === 'ready_needs_host_restart') {
293
+ return {
294
+ ...base,
295
+ status: 'ready_needs_host_restart',
296
+ required: true,
297
+ actual,
298
+ reason: host.reason,
299
+ nextAction: 'Quit and relaunch Codex — the plugin runtime is loaded at host start.',
300
+ };
301
+ }
302
+ // No session transcript at all is not "cannot prove": it is a Codex install
303
+ // that has never loaded the runtime (fresh install, or pruned sessions). The
304
+ // action is the same as a restart — start the host once — so say that
305
+ // instead of leaving an anonymous unknown that reads like a defect forever.
306
+ if (newestRollout === null) {
307
+ return {
308
+ ...base,
309
+ status: 'ready_needs_host_restart',
310
+ required: true,
311
+ actual,
312
+ reason: 'host_not_started_since_install',
313
+ nextAction: 'Launch Codex once — the plugin runtime is loaded at host start — then re-run this check.',
314
+ detail: withDetail('no Codex session transcript under ~/.codex/sessions, so the runtime has not been loaded yet'),
315
+ };
316
+ }
317
+ return {
318
+ ...base,
319
+ status: 'unknown',
320
+ required: true,
321
+ actual,
322
+ reason: host.reason ?? 'host_start_time_unavailable',
323
+ nextAction: 'Restart Codex once you can, then re-run this check: without a readable host start time the restart cannot be proven.',
324
+ };
325
+ }
326
+ function judgeCompanion() {
327
+ return {
328
+ id: 'companion',
329
+ label: 'Companion (independent companion-v* release track)',
330
+ status: 'not_applicable',
331
+ required: false,
332
+ expected: {},
333
+ actual: {},
334
+ reason: 'independent_release_track',
335
+ detail: 'The Companion ships on its own release track and self-heals its Console on release changes; a PD product update does not deliver it.',
336
+ };
337
+ }
338
+ /**
339
+ * Builds the four-surface verdict from the canonical installation state.
340
+ * Throws VersionReportError (same shape as `pd version --json`) when no
341
+ * trustworthy canonical state exists at all.
342
+ */
343
+ export function buildDeliveryReport(homeDir = os.homedir(), env = process.env) {
344
+ const report = buildVersionReport(homeDir);
345
+ const layout = getInstallLayoutPaths(homeDir);
346
+ const surfaces = [
347
+ judgeCanonicalRuntime(report),
348
+ judgeOpenClawExtension(report, layout),
349
+ judgeCodexPlugin(report, env, homeDir),
350
+ judgeCompanion(),
351
+ ];
352
+ return {
353
+ ok: surfaces.every((surface) => !surface.required || surface.status === 'ok'),
354
+ surfaces,
355
+ };
356
+ }
357
+ function formatKeyValues(values) {
358
+ const entries = Object.entries(values);
359
+ if (entries.length === 0)
360
+ return '—';
361
+ return entries.map(([key, value]) => `${key}=${value ?? 'unreadable'}`).join(' ');
362
+ }
363
+ /** Human-readable rendering for `pd version --delivery` (non-JSON). */
364
+ export function formatDeliveryReport(report) {
365
+ const lines = ['Delivery surfaces:'];
366
+ for (const surface of report.surfaces) {
367
+ lines.push(` ${surface.id.padEnd(20)} ${surface.status}`);
368
+ if (Object.keys(surface.expected).length > 0) {
369
+ lines.push(` expected: ${formatKeyValues(surface.expected)}`);
370
+ }
371
+ if (Object.keys(surface.actual).length > 0) {
372
+ lines.push(` actual: ${formatKeyValues(surface.actual)}`);
373
+ }
374
+ if (surface.reason !== undefined)
375
+ lines.push(` reason: ${surface.reason}`);
376
+ if (surface.nextAction !== undefined)
377
+ lines.push(` next: ${surface.nextAction}`);
378
+ if (surface.detail !== undefined)
379
+ lines.push(` detail: ${surface.detail}`);
380
+ }
381
+ const pending = report.surfaces.filter((surface) => surface.required && surface.status !== 'ok');
382
+ lines.push(pending.length === 0
383
+ ? 'Delivery: complete — every required surface is ok.'
384
+ : `Delivery: incomplete — ${pending.map((surface) => `${surface.id} (${surface.status})`).join(', ')}.`);
385
+ return lines.join('\n');
386
+ }
387
+ //# sourceMappingURL=delivery-surfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-surfaces.js","sourceRoot":"","sources":["../../src/services/delivery-surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAA2B,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAsB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,gBAAgB,EAChB,gCAAgC,GACjC,MAAM,2BAA2B,CAAC;AAgCnC,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,cAAc,CAAU,CAAC;AAElF,SAAS,cAAc,CAAC,MAAqB,EAAE,IAAuB;IACpE,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;IACnD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,qBAAqB,CAAC,MAA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B,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAClF,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QAC1F,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;IACjG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QAC7B,CAAC,CAAC,oDAAoD;QACtD,CAAC,CAAC,0BAA0B,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3G,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,3 +1,62 @@
1
+ /**
2
+ * Pain Recall read model — SPEC-PD-PAIN-RECALL-CLI-001.
3
+ *
4
+ * Resolves a canonical ledger principle to its verifiably-associated
5
+ * historical pains through the two authoritative edges only:
6
+ *
7
+ * 1. `Principle.reuseEvidence[]` — carries a REAL `painId` (validated at
8
+ * the ledger write boundary, appendReuseEvidence);
9
+ * 2. `Principle.derivedFromPainIds[]` — stores CANDIDATE ids despite its
10
+ * legacy pain-oriented name (see PainChainReadModel's linkage note);
11
+ * the pain resolves through candidate → task → `tasks.input_ref`
12
+ * (fallback: the `diagnosis_<painId>` task-id spelling).
13
+ *
14
+ * Anything not reachable through those edges is excluded and REPORTED
15
+ * (unresolvedAssociations) — never guessed from text similarity, never
16
+ * resolved through candidateId/taskId/artifactId masquerading as pain ids.
17
+ *
18
+ * Strictly read-only: the ledger through readLedgerFileState, trajectory.db
19
+ * through openTrajectoryDbReadonly, state.db through RuntimeStateManager with
20
+ * readonly:true + bootstrapIfMissing:false. Missing stays missing; unreadable
21
+ * stays unreadable; neither is ever reported as an empty result.
22
+ *
23
+ * WAL safety (SPEC §6.1/§9.2; SPEC-PD-AGENT-CAPABILITY-API-001 v0.3 §10.3.1):
24
+ * both production databases are persisted in WAL journal mode. Any readonly
25
+ * open of a WAL database can touch workspace files — a quiet WAL gains
26
+ * `-wal`/`-shm` sidecars, a missing `-shm` gets created, and an existing
27
+ * `-shm` can be rewritten by WAL-index recovery (all reproduced 2026-10-28 on
28
+ * better-sqlite3 13.0.3, which cannot open `file:` URIs, so SQLite's
29
+ * immutable=1 zero-side-effect mode is unavailable). Therefore EVERY WAL-mode
30
+ * database is read through a staged, fingerprint-verified snapshot in a
31
+ * private temp directory; only rollback-journal databases keep the direct
32
+ * readonly open, which creates nothing. The snapshot copies the main file
33
+ * plus a non-empty `-wal` (the pair SQLite needs to recover un-checkpointed
34
+ * commits; `-shm` is an index cache and is deliberately never copied — the
35
+ * staged open regenerates it beside the copy).
36
+ *
37
+ * Snapshot acceptance contract (proved in stageWalSnapshot): the T1 re-check
38
+ * is ordered main → wal → main, making the WAL fingerprint read the single
39
+ * LINEARIZATION POINT. Acceptance means the staged bytes equal the real
40
+ * database state at that instant: the wal read observes the wal directly,
41
+ * and the bracketing main reads (equal to each other and to T0) pin the main
42
+ * bytes across the whole window — under SQLite-only writes the main file's
43
+ * byte-image cannot return to a previous value (monotonic change counter),
44
+ * so a bracketed main equal on both ends was unchanged in between. Any write
45
+ * completing before the linearization point is therefore caught (a commit
46
+ * changes the wal; a checkpoint changes main and is visible at one of the
47
+ * bracketing reads), and the trailing main re-read additionally rejects a
48
+ * checkpoint landing between the wal read and the protocol's end. An ABA
49
+ * rewrite (commit → checkpoint → wal delete → main bytes back at T0) cannot
50
+ * produce a stale acceptance: a commit surviving to the linearization point
51
+ * moved the main bytes and is rejected; bytes genuinely ending at the T0
52
+ * state mean the staged copy IS the current state, so returning it is
53
+ * correct. Writes after the linearization point (an un-checkpointed commit
54
+ * landing in the trailing window) are post-linearization events — a correct
55
+ * point-in-time read, not staleness. "Always latest at return time" would
56
+ * require writer coordination, which no available mechanism provides
57
+ * honestly (see the implementation report's option analysis A–D).
58
+ */
59
+ import * as fs from 'fs';
1
60
  export declare const PAIN_RECALL_SCHEMA_VERSION = "pd.pain-recall.v1";
2
61
  export declare const PAIN_RECALL_DEFAULT_LIMIT = 3;
3
62
  export declare const PAIN_RECALL_MIN_LIMIT = 1;
@@ -109,5 +168,25 @@ export interface PainRecallResult {
109
168
  };
110
169
  unresolvedAssociations: UnresolvedAssociation[];
111
170
  }
171
+ /**
172
+ * Deterministic fault-injection seam for snapshot-race tests — the same
173
+ * pattern as the runtime's databaseFactory seam (PR #2192). Every field is
174
+ * undefined in production; tests assign, then clear in a finally block.
175
+ */
176
+ export declare const painRecallSnapshotTestHooks: {
177
+ /** Replaces statSync for fingerprinting/classification (throw to simulate EACCES/EIO). */
178
+ statSync?: (path: string) => fs.Stats;
179
+ /** Replaces mkdtempSync for staging-root creation (throw to simulate failure). */
180
+ mkdtempSync?: (prefix: string) => string;
181
+ /** Called after each source→staging copyFileSync with (source, staged). */
182
+ afterCopyFile?: (source: string, stagedPath: string) => void;
183
+ /**
184
+ * Called between the T1 main fingerprint read and the T1 wal fingerprint
185
+ * read — the exact window a concurrent writer can hide in when the pair is
186
+ * sampled non-atomically. Tests use it to inject a deterministic
187
+ * commit→checkpoint→close cycle inside the re-check.
188
+ */
189
+ afterT1MainFingerprint?: (sourceDbPath: string) => void;
190
+ };
112
191
  export declare function recallPains(workspaceDir: string, query: PainRecallQuery): Promise<PainRecallResult>;
113
192
  //# sourceMappingURL=pain-recall.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pain-recall.d.ts","sourceRoot":"","sources":["../../src/services/pain-recall.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,0BAA0B,sBAAsB,CAAC;AAE9D,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,MAAM,MAAM,gBAAgB,GACxB,IAAI,GACJ,YAAY,GACZ,qBAAqB,GACrB,qBAAqB,GACrB,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,SAAS,CAAC;AAEd,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,GAAG,aAAa,CAAC;AAEjF,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAEnF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,gBAAgB,GAAG,mBAAmB,CAAC;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,CAAC;IACtB,UAAU,EAAE,UAAU,GAAG,kBAAkB,CAAC;IAC5C,YAAY,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI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