@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
@@ -0,0 +1,22 @@
1
+ /** Canonical lifecycle event vocabulary shared by installation and execution. */
2
+ import {} from './harnesses.js';
3
+ // ---------------------------------------------------------------------------
4
+ // hook / ask / close — harness integration
5
+ // ---------------------------------------------------------------------------
6
+ export const HOOK_EVENTS = [
7
+ 'session-start',
8
+ 'subagent-start',
9
+ 'activation-stop',
10
+ 'user-prompt-submit',
11
+ 'stop',
12
+ 'session-end',
13
+ ];
14
+ /** Lifecycle handlers one installed harness must carry in this CLI build. */
15
+ export function requiredHookEvents(harness) {
16
+ if (harness === 'opencode' || harness === 'openclaw')
17
+ return [];
18
+ return harness === 'cursor'
19
+ ? ['session-start', 'activation-stop', 'user-prompt-submit', 'stop', 'session-end']
20
+ : ['session-start', 'subagent-start', 'user-prompt-submit', 'stop', 'session-end'];
21
+ }
22
+ //# sourceMappingURL=hook-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook-events.js","sourceRoot":"","sources":["../src/hook-events.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAA+B,MAAM,gBAAgB,CAAA;AAE5D,8EAA8E;AAC9E,2CAA2C;AAC3C,8EAA8E;AAE9E,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,oBAAoB;IACpB,MAAM;IACN,aAAa;CACL,CAAA;AAIV,6EAA6E;AAC7E,MAAM,UAAU,kBAAkB,CAAC,OAA+B;IAChE,IAAI,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,UAAU;QAAE,OAAO,EAAE,CAAA;IAC/D,OAAO,OAAO,KAAK,QAAQ;QACzB,CAAC,CAAC,CAAC,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,EAAE,aAAa,CAAC;QACnF,CAAC,CAAC,CAAC,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA;AACtF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /** Structured gate decisions shared by lifecycle and acknowledgement handling. */
2
+ import type { HookContext } from './hook-types.js';
3
+ /** Runtime vocabulary for every recorded question gate. */
4
+ export declare const GATE_REASONS: readonly ["no-session", "no-question", "answered", "continuation-repeat", "continuation-limit", "delivery-limit", "acknowledgement-required", "acknowledgement-abandoned", "harness-cannot-continue", "notifications-off", "claimed-elsewhere", "elapsed", "proceeding"];
5
+ export type GateReason = (typeof GATE_REASONS)[number];
6
+ /** Record one gate decision using a stable reason agents can filter on. */
7
+ export declare function gate(ctx: HookContext, verdict: 'held' | 'proceeding', reason: GateReason, data?: Record<string, unknown>): void;
@@ -0,0 +1,21 @@
1
+ /** Runtime vocabulary for every recorded question gate. */
2
+ export const GATE_REASONS = [
3
+ 'no-session',
4
+ 'no-question',
5
+ 'answered',
6
+ 'continuation-repeat',
7
+ 'continuation-limit',
8
+ 'delivery-limit',
9
+ 'acknowledgement-required',
10
+ 'acknowledgement-abandoned',
11
+ 'harness-cannot-continue',
12
+ 'notifications-off',
13
+ 'claimed-elsewhere',
14
+ 'elapsed',
15
+ 'proceeding',
16
+ ];
17
+ /** Record one gate decision using a stable reason agents can filter on. */
18
+ export function gate(ctx, verdict, reason, data = {}) {
19
+ ctx.log?.info('hook.gate', { verdict, reason, stage: 'queued', ...data });
20
+ }
21
+ //# sourceMappingURL=hook-gates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook-gates.js","sourceRoot":"","sources":["../src/hook-gates.ts"],"names":[],"mappings":"AAGA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,YAAY;IACZ,aAAa;IACb,UAAU;IACV,qBAAqB;IACrB,oBAAoB;IACpB,gBAAgB;IAChB,0BAA0B;IAC1B,2BAA2B;IAC3B,yBAAyB;IACzB,mBAAmB;IACnB,mBAAmB;IACnB,SAAS;IACT,YAAY;CACJ,CAAA;AAIV,2EAA2E;AAC3E,MAAM,UAAU,IAAI,CAClB,GAAgB,EAChB,OAA8B,EAC9B,MAAkB,EAClB,OAAgC,EAAE;IAElC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;AAC3E,CAAC"}
@@ -0,0 +1,93 @@
1
+ import type { EscalationDeliveryRoute, EscalationWaiterOptions, HookContext, HookEnvelope, HookOutcome, PendingQuestion } from './hook-types.js';
2
+ /**
3
+ * The wire contract's shortest reply window. A question submitted with less
4
+ * than this is rejected outright, and accepting one would in any case let the
5
+ * server go on taking an answer after the waiter that owns it has returned.
6
+ */
7
+ export declare const MIN_REPLY_WINDOW_SECONDS = 60;
8
+ /**
9
+ * The one bound on answer deliveries, for every route.
10
+ *
11
+ * It caps two things that both used to be able to run away: how many times a
12
+ * single accepted answer may be handed to a route before the journal gives up
13
+ * on it, and how many answer-driven continuation generations one chain may
14
+ * produce.
15
+ */
16
+ export declare const MAX_CONTINUATION_COUNT = 3;
17
+ /**
18
+ * How many turns an answer may be *held* before it is settled unread.
19
+ *
20
+ * A hold is not a delivery: the route reported that it handed nothing over, so
21
+ * the agent has not seen the answer and the wake-loop the continuation cap
22
+ * exists to stop has not happened. Counting holds against that cap meant three
23
+ * turns where a liveness probe could not reach a busy session were enough to
24
+ * discard an answer the user had already given.
25
+ *
26
+ * It still has to end. A route that can never deliver would otherwise retry
27
+ * every turn for the life of the session, so holds get their own, far looser
28
+ * bound — loose because each one costs nothing and the answer is still wanted.
29
+ */
30
+ export declare const MAX_HELD_DELIVERIES = 20;
31
+ /**
32
+ * Records presence. Retires a live question only when this prompt plausibly
33
+ * answers it. Typing in the terminal is not by itself a resolution: the User
34
+ * may be answering a different question on a device.
35
+ */
36
+ export declare function handleUserPromptSubmit(ctx: HookContext, envelope: HookEnvelope): Promise<HookOutcome>;
37
+ /**
38
+ * Only engages for a question the agent explicitly registered with
39
+ * `notifai ask`. Guessing from the last assistant message was the alternative
40
+ * and it is not worth it: a false positive here hijacks the terminal.
41
+ */
42
+ export declare function handleStop(ctx: HookContext, envelope: HookEnvelope, processDeadlineAt?: number, route?: EscalationDeliveryRoute, recordStop?: boolean): Promise<HookOutcome>;
43
+ /**
44
+ * Own one registered question pipeline from its terminal-first timer through
45
+ * its final delivery or retirement. Hosts differ only in the injected route.
46
+ */
47
+ export declare function runEscalationWaiter(ctx: HookContext, options: EscalationWaiterOptions): Promise<HookOutcome>;
48
+ /**
49
+ * The blocking Stop hook's own last meter: the answer becomes this process's
50
+ * stdout, and the harness admits it as a new user turn. Exported because a
51
+ * host adapter that has other routes still falls back to this one.
52
+ */
53
+ export declare function hookContinuationRoute(): EscalationDeliveryRoute;
54
+ /**
55
+ * Claude Code gives SessionEnd hooks a 1.5-second shared budget and Codex 1
56
+ * second, so this cannot make a network call. It drops the local marker — but
57
+ * first moves anything still live on the user's devices into the global
58
+ * retirement queue, because this file was the only record of those ids and no
59
+ * hook for this session will ever run again. A question whose
60
+ * agent just exited can receive no answer, so it is orphaned as `expired`.
61
+ */
62
+ export declare function handleSessionEnd(env: NodeJS.ProcessEnv, envelope: HookEnvelope, now?: number): HookOutcome;
63
+ /**
64
+ * Registrations still waiting for their first push. More than this in one turn
65
+ * means an agent is looping, not asking, and related questions belong in one
66
+ * `ask --form` instead.
67
+ *
68
+ * Deliberately counts only unasked entries. A question already on the user's
69
+ * devices is waiting on a person, not on the agent, and an answer stays
70
+ * accepted for a day — so counting live questions here would have turned a
71
+ * patient user into a reason the agent could no longer ask anything.
72
+ */
73
+ export declare const MAX_PENDING_QUESTIONS = 4;
74
+ /**
75
+ * Everything this session has open at once, asked or not. The lock screen is
76
+ * the shared resource being protected here, not the agent's turn.
77
+ */
78
+ export declare const MAX_LIVE_QUESTIONS = 10;
79
+ /**
80
+ * A session may hold several registered questions at once: a new `ask` never
81
+ * ends an earlier one. Each reaches the user as its own notification and is
82
+ * answerable independently. Superseding is reply semantics — a later reply
83
+ * corrects an earlier reply to the same question (that correction model lives
84
+ * server-side) — never question semantics: the old single-slot model silently
85
+ * discarded a question the moment a second was registered, and the user was
86
+ * pointed at a notification that never existed (2026-08-09).
87
+ *
88
+ * The queue is keyed on the session, not the project: several agents may be
89
+ * running in one project at once, and their questions must never interfere.
90
+ */
91
+ export declare function registerQuestion(sessionId: string, env: NodeJS.ProcessEnv, question: PendingQuestion, now?: number): string;
92
+ /** Parses hook JSON from stdin, tolerating an empty or malformed body. */
93
+ export declare function parseHookInput(raw: string): HookEnvelope;