@raidiant/notifai 10.1.7 → 11.0.2

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 +56 -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 +551 -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 +75 -60
  98. package/dist/install-hooks.js +299 -209
  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 +42 -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,20 @@ 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 preserves whichever one already owns its approved handlers. A fresh
18
+ * install writes `hooks.json`, except when the User's own hooks already live
19
+ * inline. Notifai lives in one of them, never both.
14
20
  *
15
21
  * Cursor's native format is flat and lower-camel-cased, while OpenCode's
16
22
  * extension point is a JavaScript plugin module. Each therefore has a bounded
@@ -22,20 +28,17 @@ export interface HookHandler {
22
28
  timeout?: number;
23
29
  async?: boolean;
24
30
  statusMessage?: string;
31
+ /**
32
+ * Codex-only. Approximate token threshold for spilling `additionalContext`.
33
+ * Unset uses Codex's 2,500-token default; `0` passes the full context.
34
+ */
35
+ additionalContextLimit?: number;
25
36
  }
26
37
  export interface HookGroup {
27
38
  matcher?: string;
28
39
  hooks: HookHandler[];
29
40
  }
30
41
  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
42
  export interface HookCommandOptions {
40
43
  platform?: NodeJS.Platform | HookHostPlatform;
41
44
  /** Registered Node used to interpret the Windows adapter. Ignored on POSIX. */
@@ -111,11 +114,20 @@ interface CursorSettingsDocument {
111
114
  /** Cursor's native schema is flat and uses lower-camel lifecycle event names. */
112
115
  export declare function buildCursorHookConfig(options: BuildOptions): CursorHookConfig;
113
116
  /**
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.
117
+ * The one file each harness reads Notifai's lifecycle wiring from: the current
118
+ * User's account, in that harness's active home.
119
+ */
120
+ export declare function settingsFile(harness: HookInstallableHarness, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string;
121
+ /**
122
+ * Files an older build may have left inside this Project, which Notifai now
123
+ * only ever reads in order to remove.
124
+ *
125
+ * Nothing installs here any more. Every path is still enumerated because a
126
+ * leftover Project-scoped handler keeps firing beside the Machine one, and
127
+ * silently leaving it would be exactly the duplicate-routing defect dropping
128
+ * the second scope was meant to end.
117
129
  */
118
- export declare function settingsFile(harness: HookInstallableHarness, global: boolean, cwd: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string;
130
+ export declare function legacyProjectHookFiles(harness: HookInstallableHarness, cwd: string): string[];
119
131
  /**
120
132
  * The account home harness config roots are resolved against.
121
133
  *
@@ -139,21 +151,6 @@ export declare function harnessAccountHome(env?: NodeJS.ProcessEnv, platform?: N
139
151
  * `.claude/settings.local.json` — so this deliberately applies to Codex only.
140
152
  */
141
153
  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
154
  /**
158
155
  * Harness-specific home variables relocate the whole active harness home.
159
156
  * This matters under session managers that give each Codex account its own
@@ -180,8 +177,17 @@ export interface CodexLayerPaths {
180
177
  hooksJson: string;
181
178
  configToml: string;
182
179
  }
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;
180
+ /** The two files Codex will look at in the Machine layer Notifai installs into. */
181
+ export declare function codexMachineLayerPaths(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): CodexLayerPaths;
182
+ /**
183
+ * Project layers an older build may have written into, for removal only.
184
+ *
185
+ * Codex resolves a project hook file against the main repository, so a linked
186
+ * worktree has two candidate directories: the main checkout's `.codex`, which
187
+ * Codex reads, and the worktree's own, which older builds sometimes created and
188
+ * Codex never reads. Both are legacy residue and both are enumerated here.
189
+ */
190
+ export declare function codexLegacyProjectLayers(cwd: string): CodexLayerPaths[];
185
191
  export interface CodexLayerInspection {
186
192
  paths: CodexLayerPaths;
187
193
  /** Every event this file defines a handler for, whoever owns it. */
@@ -190,23 +196,27 @@ export interface CodexLayerInspection {
190
196
  /** The subset of those events whose handlers are Notifai's own. */
191
197
  ourJsonEvents: string[];
192
198
  ourTomlEvents: string[];
199
+ /** Whether `config.toml` holds at least one hook handler Notifai does not own. */
200
+ foreignTomlHooks: boolean;
193
201
  writeTarget: string;
194
202
  }
195
203
  /**
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.
204
+ * Where Notifai writes in this Codex layer. An existing single Notifai
205
+ * representation is stable: upgrades refresh it in place because Codex keys
206
+ * approval by both handler identity and source path. Only a fresh installation
207
+ * chooses between `hooks.json` and inline `config.toml`.
199
208
  *
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.
209
+ * `config.toml` is the User's whole Codex configuration and Codex rewrites it
210
+ * itself for `[hooks.state]`; keeping Notifai out of it bounds the blast radius
211
+ * to hooks, removes a second writer racing those trust records, and replaces
212
+ * TOML splicing with the same JSON merge Claude Code uses. Joining an inline
213
+ * layer that already has the User's handlers is the one exception, and it
214
+ * exists only so Codex never prints its dual-representation warning.
205
215
  *
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.
216
+ * A fresh installation uses `hooks.json` unless foreign inline handlers make
217
+ * `config.toml` the layer's established representation. `[hooks.state]` is the
218
+ * trust store rather than a hook definition, so it never counts as a
219
+ * representation and is preserved through every write.
210
220
  */
211
221
  export declare function inspectCodexLayer(paths: CodexLayerPaths): CodexLayerInspection;
212
222
  /**
@@ -214,10 +224,10 @@ export declare function inspectCodexLayer(paths: CodexLayerPaths): CodexLayerIns
214
224
  * layer, then inspect that layer only after acquiring the shared anchor.
215
225
  */
216
226
  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[];
227
+ /** Every Machine-layer file this harness might already be reading hooks from. */
228
+ export declare function machineHookFiles(harness: HookInstallableHarness, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
219
229
  /**
220
- * Layers where *Notifai* is installed in both Codex representations.
230
+ * The Machine layer with *Notifai* installed in both Codex representations.
221
231
  *
222
232
  * A layer that uses `hooks.json` and inline `[hooks]` at once is not by itself
223
233
  * a Notifai fault: Codex supports both, loads both, runs every matching
@@ -233,9 +243,10 @@ export declare function hookDefinitionFiles(harness: HookInstallableHarness, glo
233
243
  * the other one. Uninstall strips Notifai from both files, so the remedy is
234
244
  * exact — and it never touches a foreign handler.
235
245
  */
236
- export declare function codexRepresentationProblems(cwd: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
246
+ export declare function codexRepresentationProblems(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
237
247
  /**
238
- * Layers where Notifai and someone else each own one Codex representation.
248
+ * The Machine layer where Notifai and someone else each own one Codex
249
+ * representation.
239
250
  *
240
251
  * This is not a fault and never fails a check. Codex loads `hooks.json` and
241
252
  * inline `[hooks]` together and runs every matching handler, so both sets fire
@@ -244,7 +255,7 @@ export declare function codexRepresentationProblems(cwd: string, env?: NodeJS.Pr
244
255
  * Notifai's, which is not, and that Notifai will not touch the one it does not
245
256
  * own. Saying nothing here is what made the warning look like Notifai's bug.
246
257
  */
247
- export declare function codexCoexistenceNotes(cwd: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
258
+ export declare function codexCoexistenceNotes(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform | HookHostPlatform): string[];
248
259
  /**
249
260
  * What `CODEX_HOME` is doing to this shell, when it is doing anything.
250
261
  *
@@ -336,21 +347,15 @@ export interface InstalledHandler {
336
347
  timeout?: number;
337
348
  async?: boolean;
338
349
  statusMessage?: string;
350
+ additionalContextLimit?: number;
339
351
  }
340
352
  export interface Installation {
341
353
  harness: HookInstallableHarness;
342
354
  file: string;
343
- global: boolean;
344
355
  handlers: InstalledHandler[];
345
356
  /** Structural defects that require reinstalling this generated adapter. */
346
357
  problems?: string[];
347
358
  }
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
359
  export declare function codexHookIdentityHash(handler: InstalledHandler): string;
355
360
  /** Best-effort mirror of current Codex's persisted key for one handler. */
356
361
  export declare function codexTrustKey(installation: Installation, handler: InstalledHandler): string;
@@ -373,7 +378,17 @@ export declare function codexStopDefinitionFingerprint(installations: Installati
373
378
  * `/hooks` remains the source of truth.
374
379
  */
375
380
  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[];
381
+ /**
382
+ * The one Machine installation each harness would read a Notifai handler from.
383
+ */
384
+ export declare function findInstallations(env?: NodeJS.ProcessEnv, adapterHome?: string, platform?: NodeJS.Platform | HookHostPlatform): Installation[];
385
+ /**
386
+ * Notifai handlers a previous build left in Project-scoped files.
387
+ *
388
+ * These are never an install target and never a fallback: they are residue to
389
+ * report and remove once the Machine installation is proven current. Foreign
390
+ * handlers sharing those files are not returned and are never touched.
391
+ */
392
+ export declare function findLegacyProjectInstallations(cwd: string, env?: NodeJS.ProcessEnv, adapterHome?: string, platform?: NodeJS.Platform | HookHostPlatform): Installation[];
378
393
  /** The hook event a handler's command actually invokes, e.g. `stop`. */
379
394
  export declare function handlerEvent(command: string): string | null;