@evomap/evolver-cli 2.0.42 → 2.0.44

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.
Files changed (50) hide show
  1. package/dist/autoRecall.d.ts +24 -5
  2. package/dist/autoRecall.js +233 -12
  3. package/dist/autoexec.d.ts +69 -10
  4. package/dist/autoexec.js +847 -137
  5. package/dist/cli.d.ts +1 -1
  6. package/dist/cli.js +71 -26
  7. package/dist/cliContracts.js +29 -7
  8. package/dist/cliEntry.d.ts +3 -0
  9. package/dist/cliEntry.js +63 -0
  10. package/dist/commandCatalog.d.ts +1 -0
  11. package/dist/commandCatalog.js +1 -0
  12. package/dist/contextDelivery.d.ts +12 -0
  13. package/dist/contextDelivery.js +139 -0
  14. package/dist/cycleConsumer.js +9 -1
  15. package/dist/dispatch.js +6 -0
  16. package/dist/feedbackOutbox.d.ts +96 -0
  17. package/dist/feedbackOutbox.js +510 -0
  18. package/dist/feedbackOutboxCli.d.ts +7 -0
  19. package/dist/feedbackOutboxCli.js +208 -0
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.js +286 -69
  22. package/dist/lifecycle.d.ts +18 -0
  23. package/dist/lifecycle.js +130 -3
  24. package/dist/lifecycleBootstrapTransaction.js +1 -6
  25. package/dist/liveStatus.d.ts +27 -0
  26. package/dist/liveStatus.js +197 -0
  27. package/dist/outboxLock.d.ts +7 -0
  28. package/dist/outboxLock.js +141 -0
  29. package/dist/promptRecallHook.d.ts +7 -22
  30. package/dist/promptRecallHook.js +20 -489
  31. package/dist/promptRecallRuntime.d.ts +24 -0
  32. package/dist/promptRecallRuntime.js +678 -0
  33. package/dist/promptRecallShared.d.ts +18 -0
  34. package/dist/promptRecallShared.js +119 -0
  35. package/dist/recall.js +27 -6
  36. package/dist/runtimeTelemetry.d.ts +9 -0
  37. package/dist/runtimeTelemetry.js +16 -0
  38. package/dist/sessionIngest.d.ts +25 -2
  39. package/dist/sessionIngest.js +196 -32
  40. package/dist/setupHooks.js +63 -13
  41. package/dist/setupHooksLifecycle.js +39 -17
  42. package/dist/skill2gep.d.ts +11 -0
  43. package/dist/skill2gep.js +23 -3
  44. package/dist/solo/mode.js +4 -0
  45. package/dist/taskCommitments.d.ts +4 -2
  46. package/dist/taskCommitments.js +208 -114
  47. package/dist/taskOutcomeOutbox.d.ts +83 -0
  48. package/dist/taskOutcomeOutbox.js +553 -0
  49. package/dist/workflowRuntime.js +12 -0
  50. package/package.json +11 -7
@@ -525,12 +525,7 @@ export function acquireBootstrapReadinessLock(stateDir, options = {}) {
525
525
  return bootstrapLockHandle(path, owner);
526
526
  }
527
527
  function bootstrapLockHandle(path, owner) {
528
- const expectedBytes = Buffer.from(`${JSON.stringify({
529
- v: 2,
530
- pid: owner.pid,
531
- token: owner.token,
532
- processStart: owner.processStartIdentity,
533
- })}\n`, 'utf8');
528
+ const expectedBytes = Buffer.from(util.serializeFileLockOwnerRecord(owner), 'utf8');
534
529
  let receipt;
535
530
  try {
536
531
  if (process.platform === 'win32') {
@@ -0,0 +1,27 @@
1
+ import { type ProxyRuntimeStatus } from './lifecycle.js';
2
+ import { type IngestionTelemetry } from './runtimeTelemetry.js';
3
+ export declare const LIVE_STATUS_USAGE = "Usage: evolver status [--json]\n evolver status --live [--json] [--home=<dir>] [--autoexec-home=<dir>]\n\nDefault: historical event/cycle statistics. --live: read-only local runtime observations.\nExit codes (--live): 0 observed running with recent/idle loop; 1 selected runtimes stopped; 2 inactive/unknown/degraded.\nProxy settings follow EVOLVER_PROXY_SETTINGS_FILE / EVOLVER_SETTINGS_DIR. No restart or cleanup is performed.\n";
4
+ export interface AutoexecRuntimeStatus {
5
+ state: 'running' | 'stopped' | 'unknown';
6
+ pid?: number;
7
+ reason?: string;
8
+ progress: 'recent' | 'overdue_or_blocked' | 'unknown';
9
+ lastTickAt?: number;
10
+ lastHeartbeatAt?: number;
11
+ lastTickOutcome?: 'completed' | 'failed' | 'blocked';
12
+ ingestion: IngestionTelemetry;
13
+ }
14
+ export interface LiveStatusReport {
15
+ schema: 'evolver.runtime-status.v1';
16
+ observedAt: string;
17
+ proxy: ProxyRuntimeStatus;
18
+ autoexec: AutoexecRuntimeStatus;
19
+ }
20
+ export declare function observeAutoexecRuntime(autoexecHome: string, eventsPath: string, now?: number): AutoexecRuntimeStatus;
21
+ export declare function collectLiveStatus(env?: NodeJS.ProcessEnv, autoexecHome?: string): Promise<LiveStatusReport>;
22
+ export declare function liveStatusExitCode(report: LiveStatusReport): number;
23
+ export declare function formatLiveStatus(report: LiveStatusReport): string;
24
+ export declare function runLiveStatus(argv: readonly string[], options?: {
25
+ env?: NodeJS.ProcessEnv;
26
+ stdout?: (text: string) => void;
27
+ }): Promise<number>;
@@ -0,0 +1,197 @@
1
+ import { closeSync, constants, fstatSync, lstatSync, openSync, readSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { events, util } from '@evomap/evolver-core';
4
+ import { lifecyclePaths, probeProxyRuntime } from './lifecycle.js';
5
+ import { runtimeOwnerGeneration } from './runtimeTelemetry.js';
6
+ export const LIVE_STATUS_USAGE = 'Usage: evolver status [--json]\n evolver status --live [--json] [--home=<dir>] [--autoexec-home=<dir>]\n\nDefault: historical event/cycle statistics. --live: read-only local runtime observations.\nExit codes (--live): 0 observed running with recent/idle loop; 1 selected runtimes stopped; 2 inactive/unknown/degraded.\nProxy settings follow EVOLVER_PROXY_SETTINGS_FILE / EVOLVER_SETTINGS_DIR. No restart or cleanup is performed.\n';
7
+ const MAX_HISTORY_TAIL_BYTES = 1024 * 1024;
8
+ function record(value) {
9
+ return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
10
+ }
11
+ function nonnegativeInteger(value) {
12
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
13
+ }
14
+ /** Only a stable, bounded tail is diagnostic evidence. It never opens an Ingestor or journal. */
15
+ function readHeartbeatTail(path) {
16
+ let fd;
17
+ try {
18
+ const before = lstatSync(path, { bigint: true });
19
+ if (!before.isFile() || before.isSymbolicLink())
20
+ throw new Error('invalid history');
21
+ fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
22
+ const opened = fstatSync(fd, { bigint: true });
23
+ if (!opened.isFile() || opened.dev !== before.dev || opened.ino !== before.ino || opened.size !== before.size
24
+ || opened.ctimeNs !== before.ctimeNs || opened.mtimeNs !== before.mtimeNs)
25
+ throw new Error('changed history');
26
+ const size = Number(opened.size);
27
+ if (!Number.isSafeInteger(size))
28
+ throw new Error('invalid history size');
29
+ const start = Math.max(0, size - MAX_HISTORY_TAIL_BYTES);
30
+ const buffer = Buffer.alloc(size - start);
31
+ let total = 0;
32
+ while (total < buffer.length) {
33
+ const count = readSync(fd, buffer, total, buffer.length - total, start + total);
34
+ if (!count)
35
+ break;
36
+ total += count;
37
+ }
38
+ const after = fstatSync(fd, { bigint: true });
39
+ const named = lstatSync(path, { bigint: true });
40
+ if (total !== buffer.length || named.isSymbolicLink() || named.dev !== opened.dev || named.ino !== opened.ino
41
+ || after.size !== opened.size || after.ctimeNs !== opened.ctimeNs || after.mtimeNs !== opened.mtimeNs
42
+ || named.size !== after.size || named.ctimeNs !== after.ctimeNs || named.mtimeNs !== after.mtimeNs)
43
+ throw new Error('changed history');
44
+ let text = buffer.toString('utf8');
45
+ if (start > 0)
46
+ text = text.slice(text.indexOf('\n') + 1);
47
+ text = text.slice(0, text.lastIndexOf('\n') + 1);
48
+ return text.split('\n').filter(line => line.trim()).map(line => JSON.parse(line));
49
+ }
50
+ finally {
51
+ if (fd !== undefined)
52
+ closeSync(fd);
53
+ }
54
+ }
55
+ function ingestionStatus(value, lastTickAt, recent) {
56
+ const input = record(value);
57
+ if (input?.['state'] === 'disabled')
58
+ return { state: 'disabled' };
59
+ if (!input || (input['state'] !== 'observed' && input['state'] !== 'degraded')
60
+ || !nonnegativeInteger(input['lastTickAt']) || input['lastTickAt'] > lastTickAt
61
+ || !nonnegativeInteger(input['recorded']) || !nonnegativeInteger(input['parseFailures']))
62
+ return { state: 'unknown' };
63
+ return {
64
+ state: recent ? input['state'] : 'unknown', lastTickAt: input['lastTickAt'],
65
+ recorded: input['recorded'], parseFailures: input['parseFailures'],
66
+ };
67
+ }
68
+ export function observeAutoexecRuntime(autoexecHome, eventsPath, now = Date.now()) {
69
+ const base = { state: 'unknown', progress: 'unknown', ingestion: { state: 'unknown' } };
70
+ const lockPath = join(autoexecHome, 'autoexec.lock');
71
+ try {
72
+ const owner = util.readFileLockOwner(lockPath);
73
+ if (!owner)
74
+ return { ...base, state: 'stopped', reason: 'owner_lock_absent' };
75
+ const ownerState = util.inspectFileLockOwnerProcess(owner);
76
+ if (ownerState === 'dead' || ownerState === 'pid_reused')
77
+ return { ...base, state: 'stopped', pid: owner.pid, reason: ownerState };
78
+ if (ownerState !== 'current')
79
+ return { ...base, pid: owner.pid, reason: 'process_identity_unavailable' };
80
+ const generation = runtimeOwnerGeneration(owner);
81
+ let candidates;
82
+ try {
83
+ candidates = readHeartbeatTail(eventsPath);
84
+ }
85
+ catch {
86
+ candidates = [];
87
+ }
88
+ let result = { ...base, state: 'running', pid: owner.pid, reason: 'current_heartbeat_unavailable' };
89
+ for (const candidate of candidates.reverse()) {
90
+ const event = record(candidate);
91
+ const payload = record(event?.['payload']);
92
+ const runtime = record(payload?.['runtime']);
93
+ if (event?.['type'] !== 'cycle.heartbeat' || !runtime || runtime['generation'] !== generation || runtime['pid'] !== owner.pid)
94
+ continue;
95
+ const identity = util.parseFileLockProcessStartIdentity(runtime['processStartIdentity']);
96
+ if (!identity || !util.sameFileLockProcessStartIdentity(identity, owner.processStartIdentity))
97
+ break;
98
+ const ts = typeof event['ts'] === 'string' ? Date.parse(event['ts']) : NaN;
99
+ const tick = runtime['lastTickAt'];
100
+ const interval = runtime['heartbeatIntervalMs'];
101
+ const delay = payload?.['nextDelayMs'];
102
+ const outcome = runtime['lastTickOutcome'];
103
+ if (!nonnegativeInteger(ts) || ts > now || !nonnegativeInteger(tick) || tick > ts
104
+ || !nonnegativeInteger(interval) || interval > 2_147_483_647 || !nonnegativeInteger(delay) || delay === 0 || delay > 2_147_483_647
105
+ || (outcome !== 'completed' && outcome !== 'failed' && outcome !== 'blocked'))
106
+ break;
107
+ const recent = now - tick <= Math.max(interval, delay) * 2 + 5_000;
108
+ result = {
109
+ state: 'running', pid: owner.pid, progress: recent ? 'recent' : 'overdue_or_blocked',
110
+ lastTickAt: tick, lastHeartbeatAt: ts, lastTickOutcome: outcome,
111
+ ingestion: ingestionStatus(runtime['ingestion'], tick, recent),
112
+ };
113
+ break;
114
+ }
115
+ const finalOwner = util.readFileLockOwner(lockPath);
116
+ if (!finalOwner || runtimeOwnerGeneration(finalOwner) !== generation || util.inspectFileLockOwnerProcess(finalOwner) !== 'current') {
117
+ return { ...base, reason: 'owner_changed_during_observation' };
118
+ }
119
+ return result;
120
+ }
121
+ catch {
122
+ return { ...base, reason: 'owner_unreadable_or_unverifiable' };
123
+ }
124
+ }
125
+ export async function collectLiveStatus(env = process.env, autoexecHome) {
126
+ const proxy = await probeProxyRuntime(lifecyclePaths(env));
127
+ const autoexec = observeAutoexecRuntime(autoexecHome ?? join(events.evomapHome(env), 'autoexec'), events.rootEventsPath(env));
128
+ return { schema: 'evolver.runtime-status.v1', observedAt: new Date().toISOString(), proxy, autoexec };
129
+ }
130
+ export function liveStatusExitCode(report) {
131
+ if (report.proxy.state === 'stopped' && report.autoexec.state === 'stopped')
132
+ return 1;
133
+ const proxyReady = report.proxy.state === 'running' && ['recent', 'idle'].includes(report.proxy.loop.state)
134
+ && report.proxy.hubAuth !== 'auth_failed' && report.proxy.hubAuth !== 'retired' && report.proxy.hubAuth !== 'rate_limited' && !report.proxy.syncErrorPresent;
135
+ const autoexecReady = report.autoexec.state === 'running' && report.autoexec.progress === 'recent'
136
+ && report.autoexec.lastTickOutcome === 'completed'
137
+ && (report.autoexec.ingestion.state === 'observed' || report.autoexec.ingestion.state === 'disabled');
138
+ return (proxyReady || autoexecReady) && report.proxy.state !== 'unknown' && report.autoexec.state !== 'unknown'
139
+ && (report.proxy.state !== 'running' || proxyReady) && (report.autoexec.state !== 'running' || autoexecReady) ? 0 : 2;
140
+ }
141
+ export function formatLiveStatus(report) {
142
+ const proxy = report.proxy;
143
+ const ae = report.autoexec;
144
+ const time = (value) => value === undefined ? '-' : new Date(value).toISOString();
145
+ return `Evolver runtime (${report.observedAt})\n`
146
+ + `Proxy: ${proxy.state} pid=${proxy.pid ?? '-'} IPC=${proxy.ipc} loop=${proxy.loop.state}${proxy.reason ? ` reason=${proxy.reason}` : ''}\n`
147
+ + ` lastTick=${time(proxy.loop.lastTickAt)} nextTick=${time(proxy.loop.nextTickDueAt)} failures=${proxy.loop.consecutiveFailures ?? '-'} hubAuth=${proxy.hubAuth ?? 'unknown'} syncError=${proxy.syncErrorPresent === undefined ? 'unknown' : proxy.syncErrorPresent ? 'present' : 'none'}\n`
148
+ + `Autoexec: ${ae.state} pid=${ae.pid ?? '-'} progress=${ae.progress}${ae.reason ? ` reason=${ae.reason}` : ''}\n`
149
+ + ` lastTick=${time(ae.lastTickAt)} lastOutcome=${ae.lastTickOutcome ?? 'unknown'}\n`
150
+ + `Ingestion (hosted by autoexec): ${ae.ingestion.state} lastTick=${time(ae.ingestion.lastTickAt)} recorded=${ae.ingestion.recorded ?? '-'}\n`
151
+ + 'Unknown/overdue observations do not prove a process has died. No services were restarted or state repaired.\n';
152
+ }
153
+ export async function runLiveStatus(argv, options = {}) {
154
+ const write = options.stdout ?? ((text) => { process.stdout.write(text); });
155
+ if (argv.includes('--help') || argv.includes('-h')) {
156
+ write(LIVE_STATUS_USAGE);
157
+ return 0;
158
+ }
159
+ const env = { ...(options.env ?? process.env) };
160
+ let home;
161
+ let autoexecHome;
162
+ let json = false;
163
+ const seen = new Set();
164
+ for (let i = 0; i < argv.length; i += 1) {
165
+ const arg = argv[i];
166
+ const key = arg.split('=', 1)[0];
167
+ if (seen.has(key)) {
168
+ write('Invalid status option: duplicate flag\n');
169
+ return 2;
170
+ }
171
+ seen.add(key);
172
+ if (arg === '--live')
173
+ continue;
174
+ if (arg === '--json') {
175
+ json = true;
176
+ continue;
177
+ }
178
+ if (key !== '--home' && key !== '--autoexec-home') {
179
+ write('Invalid status option\n');
180
+ return 2;
181
+ }
182
+ const value = arg.includes('=') ? arg.slice(arg.indexOf('=') + 1) : argv[++i];
183
+ if (!value?.trim() || value.startsWith('--')) {
184
+ write('Missing status directory option\n');
185
+ return 2;
186
+ }
187
+ if (key === '--home')
188
+ home = value;
189
+ else
190
+ autoexecHome = value;
191
+ }
192
+ if (home !== undefined)
193
+ env['EVOLVER_HOME'] = home;
194
+ const report = await collectLiveStatus(env, autoexecHome);
195
+ write(json ? `${JSON.stringify(report)}\n` : formatLiveStatus(report));
196
+ return liveStatusExitCode(report);
197
+ }
@@ -0,0 +1,7 @@
1
+ export interface OutboxDirectory {
2
+ readonly path: string;
3
+ assertTrusted(): void;
4
+ }
5
+ /** Only new directories are hardened; existing directories must already be private. */
6
+ export declare function prepareOutboxDirectory(directory: string): OutboxDirectory;
7
+ export declare function withOutboxLock<T>(directory: OutboxDirectory, operation: () => T, ..._syncOnly: Extract<T, PromiseLike<unknown>> extends never ? [] : [never]): T;
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Short, cross-process critical sections for durable outbox state transitions.
3
+ * Network I/O must happen outside this lock. The repository file lock owns
4
+ * crashed-process recovery and refuses ambiguous live owners.
5
+ */
6
+ import { dirname, join, resolve } from 'node:path';
7
+ import { lstatSync, mkdirSync } from 'node:fs';
8
+ import { hub, util } from '@evomap/evolver-core';
9
+ function unsafeDirectory() { throw new Error('unsafe outbox directory'); }
10
+ function assertDirectory(stat) {
11
+ if (!stat.isDirectory() || stat.isSymbolicLink())
12
+ unsafeDirectory();
13
+ }
14
+ function assertTrustedParents(path) {
15
+ if (process.platform === 'win32') {
16
+ new hub.PowerShellWindowsAclOps({ redactDiagnostics: true }).assertTrustedParent(path, true);
17
+ return;
18
+ }
19
+ const uid = process.getuid?.();
20
+ if (uid === undefined)
21
+ unsafeDirectory();
22
+ for (let current = path;; current = dirname(current)) {
23
+ const stat = lstatSync(current, { bigint: true });
24
+ assertDirectory(stat);
25
+ if (stat.uid !== BigInt(uid) && stat.uid !== 0n)
26
+ unsafeDirectory();
27
+ if ((stat.mode & 18n) !== 0n && (stat.mode & 512n) === 0n)
28
+ unsafeDirectory();
29
+ if (dirname(current) === current)
30
+ return;
31
+ }
32
+ }
33
+ function createMissingDirectories(path) {
34
+ const existing = lstatSync(path, { bigint: true, throwIfNoEntry: false });
35
+ if (existing) {
36
+ assertDirectory(existing);
37
+ return;
38
+ }
39
+ const parent = dirname(path);
40
+ if (parent === path)
41
+ unsafeDirectory();
42
+ createMissingDirectories(parent);
43
+ assertTrustedParents(parent);
44
+ let created = false;
45
+ try {
46
+ mkdirSync(path, { mode: 0o700 });
47
+ created = true;
48
+ }
49
+ catch (error) {
50
+ if (error.code !== 'EEXIST')
51
+ throw error;
52
+ }
53
+ const before = lstatSync(path, { bigint: true });
54
+ assertDirectory(before);
55
+ assertTrustedParents(path);
56
+ if (created && process.platform === 'win32') {
57
+ new hub.PowerShellWindowsAclOps({ redactDiagnostics: true }).secureDirectory(path);
58
+ }
59
+ const after = lstatSync(path, { bigint: true });
60
+ if (after.dev !== before.dev || after.ino !== before.ino)
61
+ unsafeDirectory();
62
+ }
63
+ /** Only new directories are hardened; existing directories must already be private. */
64
+ export function prepareOutboxDirectory(directory) {
65
+ const path = resolve(directory);
66
+ try {
67
+ createMissingDirectories(path);
68
+ }
69
+ catch (cause) {
70
+ throw new Error('unsafe outbox directory', { cause });
71
+ }
72
+ const identity = lstatSync(path, { bigint: true });
73
+ const prepared = {
74
+ path,
75
+ assertTrusted() {
76
+ try {
77
+ const before = lstatSync(path, { bigint: true });
78
+ assertDirectory(before);
79
+ if (before.dev !== identity.dev || before.ino !== identity.ino) {
80
+ throw new Error('outbox directory changed');
81
+ }
82
+ if (process.platform === 'win32') {
83
+ new hub.PowerShellWindowsAclOps({ redactDiagnostics: true }).assertPrivateDirectory(path);
84
+ }
85
+ else {
86
+ assertTrustedParents(path);
87
+ const uid = process.getuid?.();
88
+ if (uid === undefined || before.uid !== BigInt(uid) || (before.mode & 63n) !== 0n)
89
+ unsafeDirectory();
90
+ }
91
+ const after = lstatSync(path, { bigint: true });
92
+ if (after.dev !== before.dev || after.ino !== before.ino || after.mode !== before.mode || after.uid !== before.uid) {
93
+ throw new Error('outbox directory changed');
94
+ }
95
+ }
96
+ catch (cause) {
97
+ throw new Error('unsafe outbox directory', { cause });
98
+ }
99
+ },
100
+ };
101
+ prepared.assertTrusted();
102
+ return Object.freeze(prepared);
103
+ }
104
+ // ponytail: this static guard rejects visible Promise types, not async callbacks erased to void.
105
+ // Keep callers synchronous; async critical sections need an owned completion protocol.
106
+ export function withOutboxLock(directory, operation, ..._syncOnly) {
107
+ directory.assertTrusted();
108
+ const path = join(directory.path, '.outbox.lock');
109
+ const owner = util.acquireLock(path);
110
+ let result;
111
+ let failure;
112
+ let failed = false;
113
+ try {
114
+ directory.assertTrusted();
115
+ result = operation();
116
+ }
117
+ catch (error) {
118
+ failure = error;
119
+ failed = true;
120
+ }
121
+ try {
122
+ directory.assertTrusted();
123
+ const released = util.releaseLock(path, owner);
124
+ if (!released.released || released.reason !== 'released') {
125
+ throw new Error(`outbox lock release failed: ${released.reason}`);
126
+ }
127
+ }
128
+ catch (cleanup) {
129
+ const deferred = util.deferLockRelease(path, owner);
130
+ const errors = failed ? [failure, cleanup] : [cleanup];
131
+ if (!deferred.deferred)
132
+ errors.push(new Error(`outbox lock cleanup deferral failed: ${deferred.reason}`));
133
+ if (errors.length > 1) {
134
+ throw new AggregateError(errors, failed ? 'outbox operation and lock release failed' : 'outbox lock release failed');
135
+ }
136
+ throw cleanup;
137
+ }
138
+ if (failed)
139
+ throw failure;
140
+ return result;
141
+ }
@@ -1,24 +1,9 @@
1
- import { assetstore, hub } from '@evomap/evolver-core';
2
- export type PromptRecallMode = 'off' | 'shadow' | 'enforce';
3
- /** The hook sees a raw user prompt, so reject oversized payloads instead of retaining a partial JSON document. */
4
- export declare const MAX_PROMPT_RECALL_STDIN_BYTES: number;
5
- export declare const MAX_PROMPT_RECALL_LOCAL_FILE_BYTES: number;
6
- export declare const MAX_PROMPT_RECALL_LOCAL_TOTAL_BYTES: number;
7
- type HookInputReader = () => string | undefined | Promise<string | undefined>;
8
- export interface PromptRecallHookDeps {
9
- store?: assetstore.AssetStoreProvider;
10
- review?: assetstore.ReviewLedger;
11
- provenance?: assetstore.ProvenanceStore;
12
- callLog?: Pick<hub.AssetCallLog, 'append'>;
13
- env?: NodeJS.ProcessEnv;
14
- readHookInput?: HookInputReader;
15
- stdout?: (text: string) => void;
16
- selectionTimeoutMs?: number;
17
- }
18
- export declare function promptRecallMode(env?: NodeJS.ProcessEnv): PromptRecallMode;
1
+ import type { PromptRecallHookDeps } from './promptRecallRuntime.js';
2
+ export type { PromptRecallHookDeps } from './promptRecallRuntime.js';
3
+ export { MAX_PROMPT_RECALL_STDIN_BYTES, MAX_PROMPT_RECALL_LOCAL_FILE_BYTES, MAX_PROMPT_RECALL_LOCAL_TOTAL_BYTES, promptRecallMode, wrapGeneContext, type PromptRecallMode, } from './promptRecallShared.js';
19
4
  /**
20
- * Shared Claude Code/Codex UserPromptSubmit entrypoint. It is intentionally local-only and fail-open: no Hub
21
- * query, no transcript read, no prompt persistence, and exactly one JSON object on stdout for every outcome.
5
+ * Cold hook entry: env-file/off/argument gates must precede importing the local
6
+ * selection runtime. This matters for npm's unbundled, stable-obfuscated ESM, not
7
+ * just tree-shaken binaries. Off never reads prompt stdin or loads core stores.
22
8
  */
23
- export declare function runPromptRecallHook(argv: readonly string[], deps?: PromptRecallHookDeps): Promise<number>;
24
- export {};
9
+ export declare function runPromptRecallHook(argv: readonly string[], deps?: PromptRecallHookDeps): Promise<number>;