@raidiant/notifai 10.1.7 → 11.0.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.
Files changed (154) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +23 -13
  3. package/dist/claude-wake.d.ts +1 -2
  4. package/dist/claude-wake.js +15 -61
  5. package/dist/claude-wake.js.map +1 -1
  6. package/dist/cli-bin.js +3 -14
  7. package/dist/cli-bin.js.map +1 -1
  8. package/dist/cli-contract.d.ts +12 -0
  9. package/dist/cli-contract.js +19 -0
  10. package/dist/cli-contract.js.map +1 -0
  11. package/dist/cli-release.d.ts +0 -1
  12. package/dist/cli-release.js +5 -21
  13. package/dist/cli-release.js.map +1 -1
  14. package/dist/client.d.ts +2 -2
  15. package/dist/codex-wake.d.ts +1 -1
  16. package/dist/codex-wake.js +8 -36
  17. package/dist/codex-wake.js.map +1 -1
  18. package/dist/command-session.js +2 -1
  19. package/dist/command-session.js.map +1 -1
  20. package/dist/commands-acknowledge.d.ts +13 -0
  21. package/dist/commands-acknowledge.js +67 -0
  22. package/dist/commands-acknowledge.js.map +1 -0
  23. package/dist/commands-ask.d.ts +63 -0
  24. package/dist/commands-ask.js +407 -0
  25. package/dist/commands-ask.js.map +1 -0
  26. package/dist/commands-close.d.ts +6 -0
  27. package/dist/commands-close.js +197 -0
  28. package/dist/commands-close.js.map +1 -0
  29. package/dist/commands-config.js +2 -2
  30. package/dist/commands-config.js.map +1 -1
  31. package/dist/commands-core.js +2 -2
  32. package/dist/commands-core.js.map +1 -1
  33. package/dist/commands-doctor.js +61 -120
  34. package/dist/commands-doctor.js.map +1 -1
  35. package/dist/commands-harness-context.d.ts +0 -1
  36. package/dist/commands-harness-context.js +2 -4
  37. package/dist/commands-harness-context.js.map +1 -1
  38. package/dist/commands-hook-diagnostics.d.ts +27 -0
  39. package/dist/commands-hook-diagnostics.js +97 -0
  40. package/dist/commands-hook-diagnostics.js.map +1 -0
  41. package/dist/commands-hook-install.d.ts +26 -0
  42. package/dist/commands-hook-install.js +549 -0
  43. package/dist/commands-hook-install.js.map +1 -0
  44. package/dist/commands-hook-run.d.ts +29 -0
  45. package/dist/commands-hook-run.js +517 -0
  46. package/dist/commands-hook-run.js.map +1 -0
  47. package/dist/commands-init.d.ts +2 -7
  48. package/dist/commands-init.js +59 -92
  49. package/dist/commands-init.js.map +1 -1
  50. package/dist/commands-send.js +35 -3
  51. package/dist/commands-send.js.map +1 -1
  52. package/dist/commands-skill.js +5 -5
  53. package/dist/commands-skill.js.map +1 -1
  54. package/dist/commands-update.js +17 -31
  55. package/dist/commands-update.js.map +1 -1
  56. package/dist/commands.d.ts +11 -6
  57. package/dist/commands.js +9 -4
  58. package/dist/commands.js.map +1 -1
  59. package/dist/config.d.ts +14 -4
  60. package/dist/config.js +35 -9
  61. package/dist/config.js.map +1 -1
  62. package/dist/file-lock.d.ts +3 -0
  63. package/dist/file-lock.js +33 -17
  64. package/dist/file-lock.js.map +1 -1
  65. package/dist/guidance-content.js +30 -15
  66. package/dist/guidance-content.js.map +1 -1
  67. package/dist/hook-acknowledgements.d.ts +42 -0
  68. package/dist/hook-acknowledgements.js +316 -0
  69. package/dist/hook-acknowledgements.js.map +1 -0
  70. package/dist/hook-events.d.ts +6 -0
  71. package/dist/hook-events.js +22 -0
  72. package/dist/hook-events.js.map +1 -0
  73. package/dist/hook-gates.d.ts +7 -0
  74. package/dist/hook-gates.js +21 -0
  75. package/dist/hook-gates.js.map +1 -0
  76. package/dist/hook-lifecycle.d.ts +93 -0
  77. package/dist/{hooks.js → hook-lifecycle.js} +61 -1359
  78. package/dist/hook-lifecycle.js.map +1 -0
  79. package/dist/hook-project-sessions.d.ts +28 -0
  80. package/dist/hook-project-sessions.js +141 -0
  81. package/dist/hook-project-sessions.js.map +1 -0
  82. package/dist/hook-question-lock.d.ts +7 -0
  83. package/dist/hook-question-lock.js +173 -0
  84. package/dist/hook-question-lock.js.map +1 -0
  85. package/dist/hook-question-retirement.d.ts +57 -0
  86. package/dist/hook-question-retirement.js +261 -0
  87. package/dist/hook-question-retirement.js.map +1 -0
  88. package/dist/hook-question-state.d.ts +45 -0
  89. package/dist/hook-question-state.js +196 -0
  90. package/dist/hook-question-state.js.map +1 -0
  91. package/dist/hook-session-state.d.ts +31 -0
  92. package/dist/hook-session-state.js +249 -0
  93. package/dist/hook-session-state.js.map +1 -0
  94. package/dist/{hooks.d.ts → hook-types.d.ts} +17 -236
  95. package/dist/hook-types.js +4 -0
  96. package/dist/hook-types.js.map +1 -0
  97. package/dist/install-hooks.d.ts +72 -60
  98. package/dist/install-hooks.js +292 -211
  99. package/dist/install-hooks.js.map +1 -1
  100. package/dist/interactive.d.ts +3 -16
  101. package/dist/interactive.js +19 -95
  102. package/dist/interactive.js.map +1 -1
  103. package/dist/local-path.d.ts +7 -0
  104. package/dist/local-path.js +27 -0
  105. package/dist/local-path.js.map +1 -0
  106. package/dist/node-floor.js +3 -10
  107. package/dist/node-floor.js.map +1 -1
  108. package/dist/npm-invocation.d.ts +34 -0
  109. package/dist/npm-invocation.js +53 -0
  110. package/dist/npm-invocation.js.map +1 -0
  111. package/dist/openclaw-plugin.d.ts +12 -3
  112. package/dist/openclaw-plugin.js +42 -16
  113. package/dist/openclaw-plugin.js.map +1 -1
  114. package/dist/opencode-plugin.d.ts +2 -2
  115. package/dist/opencode-plugin.js +4 -6
  116. package/dist/opencode-plugin.js.map +1 -1
  117. package/dist/program.js +11 -13
  118. package/dist/program.js.map +1 -1
  119. package/dist/project-enablement.d.ts +6 -0
  120. package/dist/project-enablement.js +11 -27
  121. package/dist/project-enablement.js.map +1 -1
  122. package/dist/question-settlement-process.d.ts +1 -1
  123. package/dist/readiness.d.ts +0 -2
  124. package/dist/readiness.js +0 -4
  125. package/dist/readiness.js.map +1 -1
  126. package/dist/send.d.ts +8 -4
  127. package/dist/send.js +145 -26
  128. package/dist/send.js.map +1 -1
  129. package/dist/session-activation.d.ts +3 -1
  130. package/dist/session-activation.js +16 -0
  131. package/dist/session-activation.js.map +1 -1
  132. package/dist/skill-source/manifest.json +4 -4
  133. package/dist/skill-source/notifai/SKILL.md +60 -60
  134. package/dist/skill-source/notifai/references/harness-setup.md +41 -16
  135. package/dist/ui/config-view.d.ts +0 -2
  136. package/dist/ui/config-view.js +1 -5
  137. package/dist/ui/config-view.js.map +1 -1
  138. package/dist/ui/theme.d.ts +0 -3
  139. package/dist/ui/theme.js +0 -1
  140. package/dist/ui/theme.js.map +1 -1
  141. package/dist/version.d.ts +22 -0
  142. package/dist/version.js +51 -0
  143. package/dist/version.js.map +1 -0
  144. package/dist/wake-support.d.ts +8 -0
  145. package/dist/wake-support.js +38 -0
  146. package/dist/wake-support.js.map +1 -0
  147. package/package.json +2 -2
  148. package/dist/cli-update-contract.d.ts +0 -7
  149. package/dist/cli-update-contract.js +0 -10
  150. package/dist/cli-update-contract.js.map +0 -1
  151. package/dist/commands-hooks.d.ts +0 -160
  152. package/dist/commands-hooks.js +0 -1800
  153. package/dist/commands-hooks.js.map +0 -1
  154. package/dist/hooks.js.map +0 -1
@@ -3,14 +3,19 @@ import { type HookInstallableHarness } from './harnesses.js';
3
3
  /**
4
4
  * Harness hook installation.
5
5
  *
6
+ * Notifai owns exactly one lifecycle mechanism per harness, in the current
7
+ * User's account and that harness's active home. There is no second install
8
+ * scope: whether Notifai activates in a Project is Project Enablement's
9
+ * question, and Project-scoped hook files are read only as migration evidence
10
+ * to remove.
11
+ *
6
12
  * Claude Code's `settings.json` and Codex's hook files use the same shape —
7
13
  * `hooks` maps an event name to matcher groups, each holding command handlers
8
14
  * with an optional timeout — so one generator serves both. Only the file
9
15
  * location and the event set differ. Codex supports either a dedicated
10
- * `hooks.json` or inline `[hooks]` tables in the same layer's `config.toml`.
11
- * We default a hook-empty layer to inline config and preserve whichever single
12
- * representation a populated layer already uses. Notifai lives in one of them,
13
- * never both.
16
+ * `hooks.json` or inline `[hooks]` tables in the same layer's `config.toml`;
17
+ * Notifai writes `hooks.json` and only joins `config.toml` when the User's own
18
+ * hooks already live there. Notifai lives in one of them, never both.
14
19
  *
15
20
  * Cursor's native format is flat and lower-camel-cased, while OpenCode's
16
21
  * extension point is a JavaScript plugin module. Each therefore has a bounded
@@ -22,20 +27,17 @@ export interface HookHandler {
22
27
  timeout?: number;
23
28
  async?: boolean;
24
29
  statusMessage?: string;
30
+ /**
31
+ * Codex-only. Approximate token threshold for spilling `additionalContext`.
32
+ * Unset uses Codex's 2,500-token default; `0` passes the full context.
33
+ */
34
+ additionalContextLimit?: number;
25
35
  }
26
36
  export interface HookGroup {
27
37
  matcher?: string;
28
38
  hooks: HookHandler[];
29
39
  }
30
40
  export type HookConfig = Record<string, HookGroup[]>;
31
- export interface InstallPlan {
32
- harness: HookInstallableHarness;
33
- /** Absolute path of the settings file that will be written. */
34
- file: string;
35
- /** True when the file is machine-wide rather than per-project. */
36
- global: boolean;
37
- config: HookConfig;
38
- }
39
41
  export interface HookCommandOptions {
40
42
  platform?: NodeJS.Platform | HookHostPlatform;
41
43
  /** Registered Node used to interpret the Windows adapter. Ignored on POSIX. */
@@ -111,11 +113,20 @@ interface CursorSettingsDocument {
111
113
  /** Cursor's native schema is flat and uses lower-camel lifecycle event names. */
112
114
  export declare function buildCursorHookConfig(options: BuildOptions): CursorHookConfig;
113
115
  /**
114
- * Where each harness reads hooks from. Project installs deliberately target the
115
- * gitignored file where one exists: which devices a person wants their
116
- * questions pushed to is not a property of the repository.
116
+ * The one file each harness reads Notifai's lifecycle wiring from: the current
117
+ * User's account, in that harness's active home.
118
+ */
119
+ export declare function settingsFile(harness: HookInstallableHarness, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string;
120
+ /**
121
+ * Files an older build may have left inside this Project, which Notifai now
122
+ * only ever reads in order to remove.
123
+ *
124
+ * Nothing installs here any more. Every path is still enumerated because a
125
+ * leftover Project-scoped handler keeps firing beside the Machine one, and
126
+ * silently leaving it would be exactly the duplicate-routing defect dropping
127
+ * the second scope was meant to end.
117
128
  */
118
- export declare function settingsFile(harness: HookInstallableHarness, global: boolean, cwd: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string;
129
+ export declare function legacyProjectHookFiles(harness: HookInstallableHarness, cwd: string): string[];
119
130
  /**
120
131
  * The account home harness config roots are resolved against.
121
132
  *
@@ -139,21 +150,6 @@ export declare function harnessAccountHome(env?: NodeJS.ProcessEnv, platform?: N
139
150
  * `.claude/settings.local.json` — so this deliberately applies to Codex only.
140
151
  */
141
152
  export declare function codexProjectRoot(cwd: string): string;
142
- /**
143
- * The `.codex` directory that has to exist for Codex to load project hooks at
144
- * all, or null when nothing extra is needed.
145
- *
146
- * Codex splits the two halves of "which project am I in": it discovers the
147
- * project layer by walking up from cwd for a `.codex` directory, but resolves
148
- * the hook file inside that layer against the main repository. In an ordinary
149
- * checkout both land on the same directory and the split is invisible. In a
150
- * worktree they diverge, and writing only the main repository's file leaves it
151
- * unread — Codex never looks, because nothing at or above cwd told it there was
152
- * a project layer to load. Proven 2026-08-03: with cwd in a worktree, an *empty*
153
- * `.codex` directory there was the difference between the main repository's
154
- * handler running and nothing running.
155
- */
156
- export declare function codexLayerDir(cwd: string): string | null;
157
153
  /**
158
154
  * Harness-specific home variables relocate the whole active harness home.
159
155
  * This matters under session managers that give each Codex account its own
@@ -180,8 +176,17 @@ export interface CodexLayerPaths {
180
176
  hooksJson: string;
181
177
  configToml: string;
182
178
  }
183
- /** The two files Codex will look at for one config layer. */
184
- export declare function codexLayerPaths(global: boolean, cwd: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): CodexLayerPaths;
179
+ /** The two files Codex will look at in the Machine layer Notifai installs into. */
180
+ export declare function codexMachineLayerPaths(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): CodexLayerPaths;
181
+ /**
182
+ * Project layers an older build may have written into, for removal only.
183
+ *
184
+ * Codex resolves a project hook file against the main repository, so a linked
185
+ * worktree has two candidate directories: the main checkout's `.codex`, which
186
+ * Codex reads, and the worktree's own, which older builds sometimes created and
187
+ * Codex never reads. Both are legacy residue and both are enumerated here.
188
+ */
189
+ export declare function codexLegacyProjectLayers(cwd: string): CodexLayerPaths[];
185
190
  export interface CodexLayerInspection {
186
191
  paths: CodexLayerPaths;
187
192
  /** Every event this file defines a handler for, whoever owns it. */
@@ -190,23 +195,25 @@ export interface CodexLayerInspection {
190
195
  /** The subset of those events whose handlers are Notifai's own. */
191
196
  ourJsonEvents: string[];
192
197
  ourTomlEvents: string[];
198
+ /** Whether `config.toml` holds at least one hook handler Notifai does not own. */
199
+ foreignTomlHooks: boolean;
193
200
  writeTarget: string;
194
201
  }
195
202
  /**
196
- * Where Notifai writes in this Codex layer: wherever Notifai already is, then
197
- * whichever single hook representation the layer already uses, and inline
198
- * `config.toml` for a hook-empty or already-mixed layer.
203
+ * Where Notifai writes in this Codex layer: `hooks.json`, unless the User's own
204
+ * hooks already live inline in the same layer's `config.toml`.
199
205
  *
200
- * Codex supports `hooks.json` and inline `[hooks]` side by side, loads both,
201
- * and runs every matching handler. Reusing the one populated representation is
202
- * the generic layer contract: it avoids creating Codex's dual-representation
203
- * warning and, for a managed layer, writes through the same authority that
204
- * persists the layer rather than a sibling file it may regenerate away.
206
+ * `config.toml` is the User's whole Codex configuration and Codex rewrites it
207
+ * itself for `[hooks.state]`; keeping Notifai out of it bounds the blast radius
208
+ * to hooks, removes a second writer racing those trust records, and replaces
209
+ * TOML splicing with the same JSON merge Claude Code uses. Joining an inline
210
+ * layer that already has the User's handlers is the one exception, and it
211
+ * exists only so Codex never prints its dual-representation warning.
205
212
  *
206
- * Staying put where Notifai already is also keeps reinstalls idempotent and
207
- * preserves the `[hooks.state]` trust hash, which Codex keys by file path and
208
- * handler index. `[hooks.state]` is the trust store, not a hook definition, so
209
- * it does not count as a representation.
213
+ * Notifai's *own* inline handlers are not a reason to stay: the installer moves
214
+ * them to `hooks.json` and strips them from `config.toml`. `[hooks.state]` is
215
+ * the trust store rather than a hook definition, so it never counts as a
216
+ * representation and is preserved through every write.
210
217
  */
211
218
  export declare function inspectCodexLayer(paths: CodexLayerPaths): CodexLayerInspection;
212
219
  /**
@@ -214,10 +221,10 @@ export declare function inspectCodexLayer(paths: CodexLayerPaths): CodexLayerIns
214
221
  * layer, then inspect that layer only after acquiring the shared anchor.
215
222
  */
216
223
  export declare function withCodexLayerTransaction<T>(paths: CodexLayerPaths, action: (inspection: CodexLayerInspection) => T): T;
217
- /** Every file in this layer Codex might already be reading hooks from. */
218
- export declare function hookDefinitionFiles(harness: HookInstallableHarness, global: boolean, cwd: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
224
+ /** Every Machine-layer file this harness might already be reading hooks from. */
225
+ export declare function machineHookFiles(harness: HookInstallableHarness, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
219
226
  /**
220
- * Layers where *Notifai* is installed in both Codex representations.
227
+ * The Machine layer with *Notifai* installed in both Codex representations.
221
228
  *
222
229
  * A layer that uses `hooks.json` and inline `[hooks]` at once is not by itself
223
230
  * a Notifai fault: Codex supports both, loads both, runs every matching
@@ -233,9 +240,10 @@ export declare function hookDefinitionFiles(harness: HookInstallableHarness, glo
233
240
  * the other one. Uninstall strips Notifai from both files, so the remedy is
234
241
  * exact — and it never touches a foreign handler.
235
242
  */
236
- export declare function codexRepresentationProblems(cwd: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
243
+ export declare function codexRepresentationProblems(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
237
244
  /**
238
- * Layers where Notifai and someone else each own one Codex representation.
245
+ * The Machine layer where Notifai and someone else each own one Codex
246
+ * representation.
239
247
  *
240
248
  * This is not a fault and never fails a check. Codex loads `hooks.json` and
241
249
  * inline `[hooks]` together and runs every matching handler, so both sets fire
@@ -244,7 +252,7 @@ export declare function codexRepresentationProblems(cwd: string, env?: NodeJS.Pr
244
252
  * Notifai's, which is not, and that Notifai will not touch the one it does not
245
253
  * own. Saying nothing here is what made the warning look like Notifai's bug.
246
254
  */
247
- export declare function codexCoexistenceNotes(cwd: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
255
+ export declare function codexCoexistenceNotes(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
248
256
  /**
249
257
  * What `CODEX_HOME` is doing to this shell, when it is doing anything.
250
258
  *
@@ -336,21 +344,15 @@ export interface InstalledHandler {
336
344
  timeout?: number;
337
345
  async?: boolean;
338
346
  statusMessage?: string;
347
+ additionalContextLimit?: number;
339
348
  }
340
349
  export interface Installation {
341
350
  harness: HookInstallableHarness;
342
351
  file: string;
343
- global: boolean;
344
352
  handlers: InstalledHandler[];
345
353
  /** Structural defects that require reinstalling this generated adapter. */
346
354
  problems?: string[];
347
355
  }
348
- /**
349
- * Best-effort mirror of the identity current Codex builds compare with
350
- * `hooks.state.*.trusted_hash`. This persisted format is diagnostic evidence,
351
- * not an API: Codex's `/hooks` UI remains authoritative and Notifai never
352
- * writes the trust store.
353
- */
354
356
  export declare function codexHookIdentityHash(handler: InstalledHandler): string;
355
357
  /** Best-effort mirror of current Codex's persisted key for one handler. */
356
358
  export declare function codexTrustKey(installation: Installation, handler: InstalledHandler): string;
@@ -373,7 +375,17 @@ export declare function codexStopDefinitionFingerprint(installations: Installati
373
375
  * `/hooks` remains the source of truth.
374
376
  */
375
377
  export declare function codexTrustProblems(installations: Installation[], env?: NodeJS.ProcessEnv): string[];
376
- /** Every place either harness would read a Notifai handler from. */
377
- export declare function findInstallations(cwd: string, env?: NodeJS.ProcessEnv, adapterHome?: string, platform?: NodeJS.Platform | HookHostPlatform): Installation[];
378
+ /**
379
+ * The one Machine installation each harness would read a Notifai handler from.
380
+ */
381
+ export declare function findInstallations(env?: NodeJS.ProcessEnv, adapterHome?: string, platform?: NodeJS.Platform | HookHostPlatform): Installation[];
382
+ /**
383
+ * Notifai handlers a previous build left in Project-scoped files.
384
+ *
385
+ * These are never an install target and never a fallback: they are residue to
386
+ * report and remove once the Machine installation is proven current. Foreign
387
+ * handlers sharing those files are not returned and are never touched.
388
+ */
389
+ export declare function findLegacyProjectInstallations(cwd: string, env?: NodeJS.ProcessEnv, adapterHome?: string, platform?: NodeJS.Platform | HookHostPlatform): Installation[];
378
390
  /** The hook event a handler's command actually invokes, e.g. `stop`. */
379
391
  export declare function handlerEvent(command: string): string | null;