@raidiant/notifai 0.5.0 → 1.0.0

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 (74) hide show
  1. package/CHANGELOG.md +165 -0
  2. package/README.md +11 -4
  3. package/dist/claude-wake.d.ts +101 -0
  4. package/dist/claude-wake.js +397 -0
  5. package/dist/claude-wake.js.map +1 -0
  6. package/dist/codex-wake.d.ts +84 -0
  7. package/dist/codex-wake.js +238 -0
  8. package/dist/codex-wake.js.map +1 -0
  9. package/dist/commands.d.ts +31 -11
  10. package/dist/commands.js +679 -232
  11. package/dist/commands.js.map +1 -1
  12. package/dist/config-schema.d.ts +3 -3
  13. package/dist/config-schema.js +11 -49
  14. package/dist/config-schema.js.map +1 -1
  15. package/dist/config.d.ts +23 -45
  16. package/dist/config.js +61 -39
  17. package/dist/config.js.map +1 -1
  18. package/dist/harnesses.d.ts +4 -13
  19. package/dist/harnesses.js +12 -17
  20. package/dist/harnesses.js.map +1 -1
  21. package/dist/hook-adapter.d.ts +10 -1
  22. package/dist/hook-adapter.js +79 -10
  23. package/dist/hook-adapter.js.map +1 -1
  24. package/dist/hooks.d.ts +119 -65
  25. package/dist/hooks.js +330 -285
  26. package/dist/hooks.js.map +1 -1
  27. package/dist/install-hooks.d.ts +76 -24
  28. package/dist/install-hooks.js +301 -125
  29. package/dist/install-hooks.js.map +1 -1
  30. package/dist/interactive.d.ts +32 -1
  31. package/dist/interactive.js +165 -51
  32. package/dist/interactive.js.map +1 -1
  33. package/dist/main.js +14 -21
  34. package/dist/main.js.map +1 -1
  35. package/dist/native-skills.d.ts +1 -1
  36. package/dist/native-skills.js +23 -58
  37. package/dist/native-skills.js.map +1 -1
  38. package/dist/pack-feedback-slice.d.ts +35 -0
  39. package/dist/pack-feedback-slice.js +126 -0
  40. package/dist/pack-feedback-slice.js.map +1 -0
  41. package/dist/readiness.d.ts +20 -0
  42. package/dist/readiness.js +24 -0
  43. package/dist/readiness.js.map +1 -1
  44. package/dist/release.d.ts +31 -0
  45. package/dist/release.js +52 -0
  46. package/dist/release.js.map +1 -0
  47. package/dist/ui/theme.d.ts +1 -1
  48. package/package.json +11 -10
  49. package/src/commands.test.ts +386 -36
  50. package/src/commands.ts +473 -182
  51. package/src/config-schema.ts +2 -17
  52. package/src/config.test.ts +29 -4
  53. package/src/config.ts +67 -11
  54. package/src/harnesses.ts +7 -0
  55. package/src/hook-adapter.test.ts +43 -1
  56. package/src/hook-adapter.ts +83 -11
  57. package/src/hooks.test.ts +4 -5
  58. package/src/install-hooks.test.ts +154 -2
  59. package/src/install-hooks.ts +231 -44
  60. package/src/interactive.test.ts +338 -0
  61. package/src/interactive.ts +221 -49
  62. package/src/main.ts +14 -20
  63. package/src/native-skills.test.ts +75 -0
  64. package/src/native-skills.ts +31 -75
  65. package/src/pack-feedback-slice.test.ts +212 -0
  66. package/src/pack-feedback-slice.ts +187 -0
  67. package/src/readiness.test.ts +25 -0
  68. package/src/readiness.ts +38 -0
  69. package/src/release.ts +51 -0
  70. package/src/skill.test.ts +43 -0
  71. package/src/ui/config-view.test.ts +5 -4
  72. package/dist/idle.d.ts +0 -16
  73. package/dist/idle.js +0 -44
  74. package/dist/idle.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-wake.js","sourceRoot":"","sources":["../src/claude-wake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAO3C,qFAAqF;AACrF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAA;AAErC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAA;AAEjD,kFAAkF;A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E,IAAI,CAAC,CAAA;gBAC1B,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;oBAC1B,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE;wBACpB,IAAI,OAAO;4BAAE,OAAM;wBACnB,OAAO,GAAG,IAAI,CAAA;wBACd,OAAO,EAAE,CAAA;oBACX,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO;YAClC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,GAAG,EAAE,CAAC,CAAA;YACpF,MAAM,SAAS,CACb;gBACE,IAAI;gBACJ,UAAU;gBACV,SAAS;gBACT,iBAAiB;gBACjB,MAAM;gBACN,OAAO;aACR,EACD,EAAE,GAAG,EAAE,GAAG,EAAE,qBAAqB,CAAC,GAAG,CAAC,EAAE,CACzC,CAAA;QACH,CAAC;QACD,KAAK,CAAC,YAAY;YAChB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAA;QACpE,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { type EscalationDeliveryRoute } from './hooks.js';
2
+ /** Codex's per-thread writer lock directory, relative to `$CODEX_HOME`. */
3
+ export declare const CODEX_THREAD_LOCK_DIR = "thread-writer-locks";
4
+ export type CodexWakeObservation =
5
+ /** A live writer owns this thread. Resuming it would create a divergent ghost. */
6
+ {
7
+ state: 'live';
8
+ }
9
+ /** No process holds the thread's writer lock; a cold resume can own it. */
10
+ | {
11
+ state: 'stopped';
12
+ } | {
13
+ state: 'unknown';
14
+ reason: string;
15
+ };
16
+ export interface CodexWakeAdapters {
17
+ /** Non-blocking writer-lock probe. Never holds the lock beyond the probe. */
18
+ probeThreadWriter(lockPath: string): CodexWakeObservation;
19
+ /** Is the harness process that will read this hook's stdout still running? */
20
+ sourceAlive(pid: number): boolean;
21
+ resume(threadId: string, cwd: string, context: string): Promise<void>;
22
+ }
23
+ /**
24
+ * The one cross-process oracle for "who owns this Codex thread".
25
+ *
26
+ * Codex's thread store takes a non-blocking `flock(LOCK_EX)` on a zero-byte
27
+ * file per thread and holds it for as long as that process owns the thread —
28
+ * verified against both a hosted app-server thread sitting idle and an
29
+ * in-process `codex exec` run (2026-08-12). Because the kernel holds it, a
30
+ * crash, SIGKILL, or reboot releases it instantly, and the leftover file proves
31
+ * nothing: only the lock does. Codex fails closed itself with `-32600` when a
32
+ * second writer contends, but that is the backstop; this is the gate.
33
+ */
34
+ export declare function observeCodexThread(threadId: string, env: NodeJS.ProcessEnv, adapters: Pick<CodexWakeAdapters, 'probeThreadWriter'>): CodexWakeObservation;
35
+ export declare function codexThreadLockPath(threadId: string, env: NodeJS.ProcessEnv): string;
36
+ export declare function codexThreadLockDirectory(env: NodeJS.ProcessEnv): string;
37
+ export type CodexResumeReadiness = {
38
+ state: 'ready';
39
+ lockDirectory: string;
40
+ } | {
41
+ state: 'unavailable';
42
+ reason: string;
43
+ };
44
+ /**
45
+ * Whether a Codex thread whose Stop hook has already returned could still be
46
+ * cold-resumed, decided without taking any lock or spawning anything.
47
+ *
48
+ * Two things have to hold: this platform must implement the non-blocking
49
+ * `flock` the probe is built on, and `$CODEX_HOME` must actually have a
50
+ * thread-writer-lock directory — its absence is not evidence that a thread is
51
+ * unowned, so the gate fails closed and the answer waits for the next turn.
52
+ * Neither affects the ordinary path, where the hook's own stdout continues the
53
+ * held turn.
54
+ */
55
+ export declare function inspectCodexResume(env: NodeJS.ProcessEnv, options: {
56
+ platform: NodeJS.Platform;
57
+ directoryExists: (directory: string) => boolean;
58
+ }): CodexResumeReadiness;
59
+ /**
60
+ * Codex's answer-delivery route: the blocking Stop hook, then nothing else.
61
+ *
62
+ * The default is the hook continuation itself. While the Codex process that
63
+ * invoked this hook is alive it is reading this process's stdout, and
64
+ * `{"decision":"block"}` there creates a real new user turn — no launch
65
+ * ownership, no control plane, no probe required. That path must never depend
66
+ * on the lock probe: printing to a dead pipe cannot ghost-write anything, so
67
+ * an unreadable `$CODEX_HOME` is not a reason to withhold a continuation.
68
+ *
69
+ * Only when that process is gone does the answer need another last meter, and
70
+ * then exactly one is safe: a cold `codex exec resume` of a thread no live
71
+ * writer owns. Anything else — a live writer, an unprobeable platform, a thread
72
+ * id we cannot name — is journaled and replayed at the session's next Stop.
73
+ * That accepted gap is the honest floor of the Codex adapter: a session that
74
+ * went idle after its Stop returned, which Notifai did not launch, cannot be
75
+ * woken in place.
76
+ */
77
+ export declare function codexWakeRoute(options: {
78
+ threadId: string;
79
+ cwd: string;
80
+ sourcePid: number;
81
+ env?: NodeJS.ProcessEnv;
82
+ adapters?: CodexWakeAdapters;
83
+ }): EscalationDeliveryRoute;
84
+ export declare function systemCodexWakeAdapters(env?: NodeJS.ProcessEnv): CodexWakeAdapters;
@@ -0,0 +1,238 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { closeSync, constants, existsSync, openSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { configHome } from './install-hooks.js';
5
+ import { hookContinuationRoute, } from './hooks.js';
6
+ /** Codex's per-thread writer lock directory, relative to `$CODEX_HOME`. */
7
+ export const CODEX_THREAD_LOCK_DIR = 'thread-writer-locks';
8
+ /**
9
+ * BSD `open(2)` lock flags. Node does not surface them in `fs.constants`, and
10
+ * they are the only way to take a non-blocking `flock` from Node without a
11
+ * native addon: the kernel takes the lock at open and drops it at close.
12
+ */
13
+ const O_EXLOCK = 0x20;
14
+ const O_NONBLOCK = 0x4;
15
+ /** Platforms whose `open(2)` implements `O_EXLOCK`. Everything else fails closed. */
16
+ const LOCK_PROBE_PLATFORMS = new Set(['darwin', 'freebsd', 'openbsd']);
17
+ /** Codex thread ids are UUIDs, and the lock file is named by the exact id. */
18
+ const THREAD_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
19
+ /**
20
+ * The one cross-process oracle for "who owns this Codex thread".
21
+ *
22
+ * Codex's thread store takes a non-blocking `flock(LOCK_EX)` on a zero-byte
23
+ * file per thread and holds it for as long as that process owns the thread —
24
+ * verified against both a hosted app-server thread sitting idle and an
25
+ * in-process `codex exec` run (2026-08-12). Because the kernel holds it, a
26
+ * crash, SIGKILL, or reboot releases it instantly, and the leftover file proves
27
+ * nothing: only the lock does. Codex fails closed itself with `-32600` when a
28
+ * second writer contends, but that is the backstop; this is the gate.
29
+ */
30
+ export function observeCodexThread(threadId, env, adapters) {
31
+ if (!THREAD_ID.test(threadId)) {
32
+ return { state: 'unknown', reason: 'the Codex session id is not a thread id' };
33
+ }
34
+ try {
35
+ return adapters.probeThreadWriter(codexThreadLockPath(threadId, env));
36
+ }
37
+ catch (err) {
38
+ return {
39
+ state: 'unknown',
40
+ reason: `Codex thread-writer lock probe failed: ${err instanceof Error ? err.message : String(err)}`,
41
+ };
42
+ }
43
+ }
44
+ export function codexThreadLockPath(threadId, env) {
45
+ return path.join(codexThreadLockDirectory(env), `${threadId}.lock`);
46
+ }
47
+ export function codexThreadLockDirectory(env) {
48
+ return path.join(configHome(env, 'CODEX_HOME', '.codex'), CODEX_THREAD_LOCK_DIR);
49
+ }
50
+ /**
51
+ * Whether a Codex thread whose Stop hook has already returned could still be
52
+ * cold-resumed, decided without taking any lock or spawning anything.
53
+ *
54
+ * Two things have to hold: this platform must implement the non-blocking
55
+ * `flock` the probe is built on, and `$CODEX_HOME` must actually have a
56
+ * thread-writer-lock directory — its absence is not evidence that a thread is
57
+ * unowned, so the gate fails closed and the answer waits for the next turn.
58
+ * Neither affects the ordinary path, where the hook's own stdout continues the
59
+ * held turn.
60
+ */
61
+ export function inspectCodexResume(env, options) {
62
+ const lockDirectory = codexThreadLockDirectory(env);
63
+ if (!LOCK_PROBE_PLATFORMS.has(options.platform)) {
64
+ return {
65
+ state: 'unavailable',
66
+ reason: `no non-blocking thread-writer lock probe exists on ${options.platform}`,
67
+ };
68
+ }
69
+ if (!options.directoryExists(lockDirectory)) {
70
+ return {
71
+ state: 'unavailable',
72
+ reason: `no thread-writer-lock directory at ${lockDirectory}, so no thread can be proven unowned`,
73
+ };
74
+ }
75
+ return { state: 'ready', lockDirectory };
76
+ }
77
+ /**
78
+ * Codex's answer-delivery route: the blocking Stop hook, then nothing else.
79
+ *
80
+ * The default is the hook continuation itself. While the Codex process that
81
+ * invoked this hook is alive it is reading this process's stdout, and
82
+ * `{"decision":"block"}` there creates a real new user turn — no launch
83
+ * ownership, no control plane, no probe required. That path must never depend
84
+ * on the lock probe: printing to a dead pipe cannot ghost-write anything, so
85
+ * an unreadable `$CODEX_HOME` is not a reason to withhold a continuation.
86
+ *
87
+ * Only when that process is gone does the answer need another last meter, and
88
+ * then exactly one is safe: a cold `codex exec resume` of a thread no live
89
+ * writer owns. Anything else — a live writer, an unprobeable platform, a thread
90
+ * id we cannot name — is journaled and replayed at the session's next Stop.
91
+ * That accepted gap is the honest floor of the Codex adapter: a session that
92
+ * went idle after its Stop returned, which Notifai did not launch, cannot be
93
+ * woken in place.
94
+ */
95
+ export function codexWakeRoute(options) {
96
+ const env = options.env ?? process.env;
97
+ const adapters = options.adapters ?? systemCodexWakeAdapters(env);
98
+ const continuation = hookContinuationRoute();
99
+ return {
100
+ kind: 'hook-continuation',
101
+ async deliver(event) {
102
+ if (adapters.sourceAlive(options.sourcePid))
103
+ return continuation.deliver(event);
104
+ // Probe immediately before the spawn, twice, and never trust the earlier
105
+ // answer: ownership is a kernel fact that can change between two syscalls,
106
+ // and resuming a thread someone else owns is the disqualifying failure.
107
+ const observed = observeCodexThread(options.threadId, env, adapters);
108
+ const held = holdForNextTurn(observed);
109
+ if (held !== null)
110
+ return held;
111
+ const confirmed = observeCodexThread(options.threadId, env, adapters);
112
+ const raced = holdForNextTurn(confirmed);
113
+ if (raced !== null)
114
+ return raced;
115
+ await adapters.resume(options.threadId, options.cwd, event.context);
116
+ return {
117
+ notes: ['cold-resumed the stopped Codex thread with its accepted answer'],
118
+ log: { route: 'cold-resume', stage: 'delivered' },
119
+ // The resume ran: the thread holds the answer, and no later hook of this
120
+ // session will report on a turn that started elsewhere.
121
+ acknowledgement: 'delivered',
122
+ };
123
+ },
124
+ };
125
+ }
126
+ /** The journal, with the exact reason the thread could not be resumed. */
127
+ function holdForNextTurn(observation) {
128
+ if (observation.state === 'stopped')
129
+ return null;
130
+ const reason = observation.state === 'live'
131
+ ? 'a live writer owns the Codex thread and this hook can no longer continue it'
132
+ : observation.reason;
133
+ return {
134
+ notes: [`holding the accepted answer for the next turn: ${reason}`],
135
+ log: { route: 'hold-for-next-turn', stage: 'queued', reason },
136
+ acknowledgement: 'held',
137
+ };
138
+ }
139
+ /**
140
+ * Take and release the writer lock in one open/close pair.
141
+ *
142
+ * The probe momentarily owns the lock when it is free, so it is held for
143
+ * microseconds and never across a spawn — a probe racing a legitimate resume
144
+ * must not be what makes that resume fail.
145
+ */
146
+ function probeThreadWriterLock(lockPath) {
147
+ if (!LOCK_PROBE_PLATFORMS.has(process.platform)) {
148
+ return {
149
+ state: 'unknown',
150
+ reason: `no non-blocking thread-writer lock probe exists on ${process.platform}`,
151
+ };
152
+ }
153
+ const directory = path.dirname(lockPath);
154
+ if (!existsSync(directory)) {
155
+ // No lock directory means this is not a Codex home that has ever opened a
156
+ // thread, so its silence is not evidence that nothing owns this one.
157
+ return { state: 'unknown', reason: `no Codex thread-writer lock directory at ${directory}` };
158
+ }
159
+ let handle;
160
+ try {
161
+ handle = openSync(lockPath, constants.O_RDONLY | O_EXLOCK | O_NONBLOCK);
162
+ }
163
+ catch (err) {
164
+ const code = err.code;
165
+ if (code === 'EAGAIN' || code === 'EWOULDBLOCK')
166
+ return { state: 'live' };
167
+ // Codex unlinks the lock file when its writer drops cleanly, so a missing
168
+ // file inside a real lock directory means the thread has no owner.
169
+ if (code === 'ENOENT')
170
+ return { state: 'stopped' };
171
+ return {
172
+ state: 'unknown',
173
+ reason: `Codex thread-writer lock probe failed: ${err instanceof Error ? err.message : String(err)}`,
174
+ };
175
+ }
176
+ closeSync(handle);
177
+ return { state: 'stopped' };
178
+ }
179
+ function runCodex(args, options) {
180
+ return new Promise((resolve, reject) => {
181
+ const child = spawn('codex', args, {
182
+ cwd: options.cwd,
183
+ env: options.env,
184
+ stdio: ['ignore', 'pipe', 'pipe'],
185
+ });
186
+ const stdout = [];
187
+ const stderr = [];
188
+ child.stdout?.on('data', (chunk) => stdout.push(Buffer.from(chunk)));
189
+ child.stderr?.on('data', (chunk) => stderr.push(Buffer.from(chunk)));
190
+ child.once('error', reject);
191
+ child.once('exit', (code, signal) => {
192
+ if (code === 0) {
193
+ resolve(Buffer.concat(stdout).toString());
194
+ return;
195
+ }
196
+ reject(new Error(`codex ${args[0] ?? ''} exited ${code === null ? `on ${String(signal)}` : String(code)}: ${Buffer.concat(stderr).toString().trim()}`));
197
+ });
198
+ });
199
+ }
200
+ /**
201
+ * The resumed process must not inherit the ended session's identity, or it
202
+ * reports itself as that thread to every hook it fires. `CODEX_HOME` is the one
203
+ * exception: it names the thread store the resume has to open.
204
+ */
205
+ function coldResumeEnvironment(env) {
206
+ const next = { ...env };
207
+ for (const key of Object.keys(next)) {
208
+ if (key.startsWith('CODEX_') && key !== 'CODEX_HOME')
209
+ delete next[key];
210
+ }
211
+ return next;
212
+ }
213
+ export function systemCodexWakeAdapters(env = process.env) {
214
+ return {
215
+ probeThreadWriter: probeThreadWriterLock,
216
+ sourceAlive(pid) {
217
+ if (!Number.isInteger(pid) || pid <= 1)
218
+ return false;
219
+ try {
220
+ process.kill(pid, 0);
221
+ return true;
222
+ }
223
+ catch (err) {
224
+ // Signalling a process we may not touch still proves it exists.
225
+ return err.code === 'EPERM';
226
+ }
227
+ },
228
+ async resume(threadId, cwd, context) {
229
+ if (!existsSync(cwd))
230
+ throw new Error(`Codex thread cwd no longer exists: ${cwd}`);
231
+ await runCodex(['exec', 'resume', threadId, context], {
232
+ cwd,
233
+ env: coldResumeEnvironment(env),
234
+ });
235
+ },
236
+ };
237
+ }
238
+ //# sourceMappingURL=codex-wake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-wake.js","sourceRoot":"","sources":["../src/codex-wake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACpE,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EACL,qBAAqB,GAItB,MAAM,YAAY,CAAA;AAEnB,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,QAAQ,GAAG,IAAI,CAAA;AACrB,MAAM,UAAU,GAAG,GAAG,CAAA;AAEtB,qFAAqF;AACrF,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAA;AAE3F,8EAA8E;AAC9E,MAAM,SAAS,GAAG,iEAAiE,CAAA;AAiBnF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,GAAsB,EACtB,QAAsD;IAEtD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,yCAAyC,EAAE,CAAA;IAChF,CAAC;IACD,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;IACvE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,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;QACD,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO;YACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,GAAG,EAAE,CAAC,CAAA;YAClF,MAAM,QAAQ,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE;gBACpD,GAAG;gBACH,GAAG,EAAE,qBAAqB,CAAC,GAAG,CAAC;aAChC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -1,10 +1,13 @@
1
1
  import { type ListRepliesResponse, type Platform, type QuestionT, type ReplyView, type RoutableDevice } from '@raidiant/notifai-protocol';
2
2
  import { type ApiClient, type ClientOptions } from './client.js';
3
3
  import type { CredentialStore } from './credentials.js';
4
- import { type Readiness } from './readiness.js';
4
+ import { type Readiness, type ReadinessRefresh } from './readiness.js';
5
5
  import type { Tone } from './ui/theme.js';
6
6
  import { type HookHarness } from './hooks.js';
7
7
  import { type Logger } from './logging.js';
8
+ import { type ClaudeWakeAdapters } from './claude-wake.js';
9
+ import { type CodexWakeAdapters } from './codex-wake.js';
10
+ import { type HookAdapterTarget } from './hook-adapter.js';
8
11
  import { type SendFlags } from './send.js';
9
12
  import type { NativeSkills, SkillScope } from './native-skills.js';
10
13
  export interface CommandIo {
@@ -26,6 +29,12 @@ export interface CommandIo {
26
29
  label: string;
27
30
  hint?: string;
28
31
  }[]): Promise<string | null>;
32
+ /** Interactive multi-select. `initial` are pre-selected values. */
33
+ multiselect?(message: string, options: {
34
+ value: string;
35
+ label: string;
36
+ hint?: string;
37
+ }[], initial?: string[]): Promise<string[] | null>;
29
38
  intro?(title: string): Promise<void>;
30
39
  outro?(message: string): Promise<void>;
31
40
  note?(message: string, title?: string): Promise<void>;
@@ -50,14 +59,20 @@ export interface CommandDeps {
50
59
  cwd: string;
51
60
  /** Test seam; production fixes the hook adapter under os.homedir(). */
52
61
  hookAdapterHome?: string;
62
+ /** Test seam; production uses this process's Node and CLI paths. */
63
+ hookInstallTarget?: HookAdapterTarget;
53
64
  /** Test seam; production uses fetch against base_url. */
54
65
  clientFactory?: (baseUrl: string, bearer: string | null, options?: ClientOptions) => ApiClient;
55
66
  /** Test seam for bounded polling without wall-clock sleeps. */
56
67
  now?: () => number;
57
68
  /** Test seam for retry/backoff timing. */
58
69
  sleep?: (milliseconds: number) => Promise<void>;
59
- /** Test seam for the OS idle probe; production shells out to the platform. */
60
- idleSeconds?: () => number | null;
70
+ /** Test seams for Claude liveness, socket delivery, and cold resume. */
71
+ claudeWake?: ClaudeWakeAdapters;
72
+ claudeSourcePid?: number;
73
+ /** Test seams for the Codex thread-writer probe and cold resume. */
74
+ codexWake?: CodexWakeAdapters;
75
+ codexSourcePid?: number;
61
76
  /** Test seam and production adapter for the external native skills installer. */
62
77
  nativeSkills?: NativeSkills;
63
78
  /**
@@ -208,10 +223,9 @@ export declare function buildQuestions(flags: AskFlags, question: string | undef
208
223
  error: string;
209
224
  };
210
225
  /**
211
- * Registers a question for turn-end routing under the user's presence config.
212
- * Returns immediately so the agent can ask in prose and end its turn. Presence
213
- * does not block the shipped default; `require_idle = true` intentionally keeps
214
- * the question local while the user is active.
226
+ * Registers a question for turn-end routing. Returns immediately so the agent
227
+ * can ask in prose and end its turn; the terminal keeps the question to itself
228
+ * for `ask_grace_seconds` before it reaches any device.
215
229
  */
216
230
  export declare function askCommand(deps: CommandDeps, question: string | undefined, flags: AskFlags): number;
217
231
  /** Retire a question so a late answer is rejected rather than silently lost. */
@@ -223,6 +237,8 @@ export interface HooksInstallFlags {
223
237
  execPath?: string;
224
238
  scriptPath?: string;
225
239
  }
240
+ /** True when this process is `npx` / `npm exec`, not a global or linked install. */
241
+ export declare function runningViaNpx(env: NodeJS.ProcessEnv, scriptPath: string): boolean;
226
242
  export declare function hooksInstallCommand(deps: CommandDeps, flags: HooksInstallFlags): number;
227
243
  export declare function hooksUninstallCommand(deps: CommandDeps, flags: HooksInstallFlags): number;
228
244
  export declare function configShowCommand(deps: CommandDeps, flags: {
@@ -284,11 +300,11 @@ export declare function parseSince(raw: string, now: number): number | null;
284
300
  */
285
301
  export declare function logsCommand(deps: CommandDeps, flags: LogsFlags): number;
286
302
  /**
287
- * Where `npx skills add` fetches the optional agent skill from. In skills CLI
288
- * 1.5.x, `owner/repo@name` selects a skill; a Git ref belongs after `#`.
289
- * Keep this immutable and public because the command is printed to users.
303
+ * Where `npx skills add` fetches the optional agent skill from, derived from
304
+ * this build's own version so the pin cannot drift from the release it names.
305
+ * Null when the build cannot establish its version; see `./release.js`.
290
306
  */
291
- export declare const SKILLS_SOURCE = "Raidiant-io/notifai#v0.4.0";
307
+ export declare const SKILLS_SOURCE: string | null;
292
308
  /** Derive a contract-valid project slug from a directory name. */
293
309
  export declare function projectSlugFrom(name: string): string;
294
310
  export interface InitFlags {
@@ -333,9 +349,13 @@ export declare function initCommand(deps: CommandDeps, flags: InitFlags): Promis
333
349
  */
334
350
  export declare function assessReadiness(deps: CommandDeps, options?: {
335
351
  skillScope?: SkillScope;
352
+ previous?: Readiness;
353
+ refresh?: readonly ReadinessRefresh[];
336
354
  }): Promise<Readiness>;
337
355
  export declare function doctorCommand(deps: CommandDeps, flags: {
338
356
  json?: boolean;
357
+ }, options?: {
358
+ readiness?: Readiness;
339
359
  }): Promise<number>;
340
360
  export declare function realIo(env?: NodeJS.ProcessEnv): CommandIo;
341
361
  export {};