@raidiant/notifai 9.2.2 → 9.3.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 (105) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +8 -5
  3. package/dist/claude-wake.js +11 -0
  4. package/dist/claude-wake.js.map +1 -1
  5. package/dist/codex-wake.js +9 -0
  6. package/dist/codex-wake.js.map +1 -1
  7. package/dist/commands-core.d.ts +0 -3
  8. package/dist/commands-core.js.map +1 -1
  9. package/dist/commands-doctor.js +41 -2
  10. package/dist/commands-doctor.js.map +1 -1
  11. package/dist/commands-hook-shape.d.ts +4 -3
  12. package/dist/commands-hook-shape.js +19 -10
  13. package/dist/commands-hook-shape.js.map +1 -1
  14. package/dist/commands-hooks.js +64 -13
  15. package/dist/commands-hooks.js.map +1 -1
  16. package/dist/commands-init.js +12 -1
  17. package/dist/commands-init.js.map +1 -1
  18. package/dist/commands-project.d.ts +4 -0
  19. package/dist/commands-project.js +41 -0
  20. package/dist/commands-project.js.map +1 -0
  21. package/dist/commands-send-support.js +1 -22
  22. package/dist/commands-send-support.js.map +1 -1
  23. package/dist/commands-send.js +10 -4
  24. package/dist/commands-send.js.map +1 -1
  25. package/dist/commands-skill.js +58 -0
  26. package/dist/commands-skill.js.map +1 -1
  27. package/dist/commands.d.ts +1 -0
  28. package/dist/commands.js +1 -0
  29. package/dist/commands.js.map +1 -1
  30. package/dist/config-schema.js +2 -2
  31. package/dist/config-schema.js.map +1 -1
  32. package/dist/config.d.ts +3 -3
  33. package/dist/config.js +4 -7
  34. package/dist/config.js.map +1 -1
  35. package/dist/guidance-content.d.ts +3 -0
  36. package/dist/guidance-content.js +20 -0
  37. package/dist/guidance-content.js.map +1 -1
  38. package/dist/guidance-render.js +3 -3
  39. package/dist/guidance-render.js.map +1 -1
  40. package/dist/harnesses.js +2 -2
  41. package/dist/harnesses.js.map +1 -1
  42. package/dist/hooks.d.ts +26 -50
  43. package/dist/hooks.js +391 -150
  44. package/dist/hooks.js.map +1 -1
  45. package/dist/install-hooks.d.ts +7 -28
  46. package/dist/install-hooks.js +18 -37
  47. package/dist/install-hooks.js.map +1 -1
  48. package/dist/program.d.ts +4 -1
  49. package/dist/program.js +19 -1
  50. package/dist/program.js.map +1 -1
  51. package/dist/project-enablement.d.ts +15 -0
  52. package/dist/project-enablement.js +87 -0
  53. package/dist/project-enablement.js.map +1 -0
  54. package/dist/question-timing.d.ts +46 -0
  55. package/dist/question-timing.js +48 -0
  56. package/dist/question-timing.js.map +1 -0
  57. package/dist/readiness.d.ts +7 -0
  58. package/dist/readiness.js.map +1 -1
  59. package/dist/send.d.ts +2 -0
  60. package/dist/send.js +6 -1
  61. package/dist/send.js.map +1 -1
  62. package/dist/session-activation.d.ts +1 -1
  63. package/dist/session-activation.js +3 -4
  64. package/dist/session-activation.js.map +1 -1
  65. package/package.json +2 -2
  66. package/src/claude-wake.test.ts +1 -0
  67. package/src/claude-wake.ts +10 -0
  68. package/src/codex-wake.test.ts +1 -0
  69. package/src/codex-wake.ts +9 -0
  70. package/src/commands-core.ts +0 -3
  71. package/src/commands-doctor.ts +48 -4
  72. package/src/commands-hook-shape.ts +26 -10
  73. package/src/commands-hooks.ts +59 -13
  74. package/src/commands-init.ts +11 -1
  75. package/src/commands-project.ts +47 -0
  76. package/src/commands-send-support.ts +1 -27
  77. package/src/commands-send.ts +8 -3
  78. package/src/commands-skill.test.ts +44 -0
  79. package/src/commands-skill.ts +57 -0
  80. package/src/commands.test.ts +47 -17
  81. package/src/commands.ts +5 -0
  82. package/src/config-schema.ts +2 -2
  83. package/src/config.test.ts +2 -3
  84. package/src/config.ts +7 -10
  85. package/src/guidance-content.ts +22 -0
  86. package/src/guidance-render.ts +3 -3
  87. package/src/harnesses.ts +2 -2
  88. package/src/hook-adapter.test.ts +27 -8
  89. package/src/hooks.test.ts +808 -80
  90. package/src/hooks.ts +525 -181
  91. package/src/install-hooks.test.ts +8 -12
  92. package/src/install-hooks.ts +21 -37
  93. package/src/program.test.ts +18 -0
  94. package/src/program.ts +22 -0
  95. package/src/project-enablement.test.ts +55 -0
  96. package/src/project-enablement.ts +99 -0
  97. package/src/question-timing.ts +56 -0
  98. package/src/readiness.ts +8 -1
  99. package/src/send.ts +8 -1
  100. package/src/session-activation.ts +3 -4
  101. package/dist/orca-session-title.d.ts +0 -10
  102. package/dist/orca-session-title.js +0 -99
  103. package/dist/orca-session-title.js.map +0 -1
  104. package/src/orca-session-title.test.ts +0 -95
  105. package/src/orca-session-title.ts +0 -105
@@ -1 +1 @@
1
- {"version":3,"file":"guidance-content.js","sourceRoot":"","sources":["../src/guidance-content.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBtB,CAAA;AAED,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBd,CAAA;AAED,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCd,CAAA;AAED,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BjB,CAAA;AAED,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;CAiBxB,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD;QACE,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,qCAAqC;QAC9C,OAAO,EAAE,cAAc;KACxB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,qCAAqC;QAC9C,OAAO,EAAE,MAAM;KAChB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,uDAAuD;QAChE,OAAO,EAAE,MAAM;KAChB;IACD;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,2CAA2C;QACpD,OAAO,EAAE,SAAS;KACnB;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,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;IACD;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,2CAA2C;QACpD,OAAO,EAAE,SAAS;KACnB;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,kCAAkC;QAC3C,OAAO,EAAE,gBAAgB;KAC1B;CACF,CAAA;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCA+BJ,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { Buffer } from 'node:buffer';
2
2
  import { describeSource } from './config-schema.js';
3
- import { GUIDANCE_TRUST_PREAMBLE } from './guidance-content.js';
3
+ import { AGENT_TERMS_FALLBACK, AGENT_TERMS_PREAMBLE, GUIDANCE_TRUST_PREAMBLE } from './guidance-content.js';
4
4
  import { resolveGuidance } from './guidance.js';
5
5
  const AUTHORITY_LABEL = {
6
6
  user: 'you',
@@ -19,7 +19,7 @@ export function renderGuidance(topics) {
19
19
  `${filePath === null ? '' : ` file=${encodeURIComponent(filePath)}`} -->`;
20
20
  return `${marker}\n${markerSafe(topic.content).trimEnd()}`;
21
21
  });
22
- return [GUIDANCE_TRUST_PREAMBLE, ...blocks].join('\n\n');
22
+ return [GUIDANCE_TRUST_PREAMBLE, AGENT_TERMS_PREAMBLE, ...blocks].join('\n\n');
23
23
  }
24
24
  /** Hard ceiling for model-visible lifecycle context, including repository topics. */
25
25
  export const GUIDANCE_CONTEXT_MAX_BYTES = 24_000;
@@ -33,7 +33,7 @@ export function boundedEffectiveGuidance(options) {
33
33
  ok: false,
34
34
  bytes,
35
35
  max_bytes: maxBytes,
36
- fallback: `${GUIDANCE_TRUST_PREAMBLE}\n\n` +
36
+ fallback: `${GUIDANCE_TRUST_PREAMBLE}\n\n${AGENT_TERMS_FALLBACK}\n\n` +
37
37
  `Notifai guidance is ${bytes} bytes, above the ${maxBytes}-byte lifecycle limit. ` +
38
38
  'Before deciding whether or how to notify, run `notifai guidance` once in this session. ' +
39
39
  'Do not infer or partially follow the omitted topics.',
@@ -1 +1 @@
1
- {"version":3,"file":"guidance-render.js","sourceRoot":"","sources":["../src/guidance-render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAsD,MAAM,eAAe,CAAA;AAEnG,MAAM,eAAe,GAAsC;IACzD,IAAI,EAAE,KAAK;IACX,UAAU,EAAE,iBAAiB;IAC7B,OAAO,EAAE,iBAAiB;CAC3B,CAAA;AAED,MAAM,YAAY,GAAG,kBAAkB,CAAA;AAEvC,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,4BAA4B,CAAC,CAAA;AACxG,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,cAAc,CAAC,MAAwC;IACrE,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAClC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACvD,MAAM,MAAM,GACV,QAAQ,YAAY,UAAU,KAAK,CAAC,IAAI,SAAS,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YACnF,GAAG,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,kBAAkB,CAAC,QA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G,OAAO,CAAC,QAAQ,IAAI,0BAA0B,CAAA;IAC/D,IAAI,KAAK,IAAI,QAAQ;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IAC1D,OAAO;QACL,EAAE,EAAE,KAAK;QACT,KAAK;QACL,SAAS,EAAE,QAAQ;QACnB,QAAQ,EACN,GAAG,uBAAuB,OAAO,oBAAoB,MAAM;YAC3D,uBAAuB,KAAK,qBAAqB,QAAQ,yBAAyB;YAClF,yFAAyF;YACzF,sDAAsD;KACzD,CAAA;AACH,CAAC"}
package/dist/harnesses.js CHANGED
@@ -14,12 +14,12 @@ export const HARNESS_CAPABILITIES = {
14
14
  'claude-code': {
15
15
  stopContinuation: 'decision-block',
16
16
  deliveryRoutes: ['hook-continuation', 'inbox-socket', 'cold-resume', 'hold-for-next-turn'],
17
- deliveryContract: 'the Stop hook returns at once and waits out of band, then posts the answer into this same session over its own inbox socket; a session that has stopped is resumed only once a liveness probe proves it stopped',
17
+ deliveryContract: 'the Stop hook returns at once and waits out of band through the complete answer window, then posts the answer into this same session over its own inbox socket; a session that has stopped is resumed only once a liveness probe proves it stopped',
18
18
  },
19
19
  codex: {
20
20
  stopContinuation: 'decision-block',
21
21
  deliveryRoutes: ['hook-continuation', 'cold-resume', 'hold-for-next-turn'],
22
- deliveryContract: 'live Stop continuation while the turn is held; once it returns, a stopped thread is resumed behind its writer lock and anything else waits for the next turn',
22
+ deliveryContract: 'live Stop continuation while the turn is held through the complete answer window; crash recovery may resume only a stopped thread behind its writer lock',
23
23
  },
24
24
  cursor: {
25
25
  stopContinuation: 'unsupported',
@@ -1 +1 @@
1
- {"version":3,"file":"harnesses.js","sourceRoot":"","sources":["../src/harnesses.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAA;AAIhF,MAAM,CAAC,MAA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QAC1F,gBAAgB,EACd,oPAAoP;KACvP;IACD,KAAK,EAAE;QACL,gBAAgB,EAAE,gBAAgB;QAClC,cAAc,EAAE,CAAC,mBAAmB,EAAE,aAAa,EAAE,oBAAoB,CAAC;QAC1E,gBAAgB,EACd,0JAA0J;KAC7J;IACD,MAAM,EAAE;QACN,gBAAgB,EAAE,aAAa;QAC/B,cAAc,EAAE,CAAC,aAAa,CAAC;QAC/B,gBAAgB,EACd,gIAAgI;KACnI;IACD,QAAQ,EAAE;QACR,gBAAgB,EAAE,aAAa;QAC/B,cAAc,EAAE,CAAC,aAAa,CAAC;QAC/B,gBAAgB,EACd,gFAAgF;KACnF;CACF,CAAA"}
package/dist/hooks.d.ts CHANGED
@@ -12,12 +12,11 @@ import { type DeliveryRoute, type Harness } from './harnesses.js';
12
12
  * proven exact-session continuation fail closed at question admission.
13
13
  *
14
14
  * Where the user is standing no longer decides anything here. It used to: the
15
- * turn-end hook held the terminal for as long as it waited, so waiting was
16
- * only defensible while the person was demonstrably not at the keyboard. On
17
- * Claude Code the handler now returns instantly and the waiter runs out of
18
- * band, and nothing is monopolised in the first place — so the question is
19
- * simply whether the user wants to be reached, which they answer once in
20
- * configuration rather than implicitly with every keystroke.
15
+ * old turn-end route held the terminal briefly and made keyboard presence an
16
+ * input to whether it waited. The current policy is explicit instead: Claude
17
+ * Code owns the complete answer window out of band, while Codex owns it by
18
+ * holding the asking turn. Neither infers notification preference from
19
+ * keystrokes.
21
20
  */
22
21
  /** Fields we read from harness hook JSON. Everything else is passed through. */
23
22
  export interface HookEnvelope {
@@ -127,6 +126,11 @@ interface AcceptedAnswerDelivery {
127
126
  * passes through.
128
127
  */
129
128
  delivery_attempts?: number;
129
+ /**
130
+ * Linearization point between delivery and SessionEnd. Once recorded, the
131
+ * route began first; before it, SessionEnd cancellation wins.
132
+ */
133
+ delivery_committed_at?: number;
130
134
  /** Turns this answer has been held without being handed to the agent. */
131
135
  held_deliveries?: number;
132
136
  }
@@ -185,15 +189,13 @@ export interface PendingQuestion {
185
189
  collapse_key?: string;
186
190
  /** Exact fanout of the live question; routing config may change afterwards. */
187
191
  device_ids?: string[];
188
- /** Absolute end of the server reply window and its local continuation owner. */
192
+ /** Absolute end of the server reply window. */
189
193
  reply_deadline_at?: number;
190
194
  /**
191
- * When this Stop owner stops listening for a direct wake. Distinct from
192
- * `reply_deadline_at`: the server may still accept an answer for a day after
193
- * this owner has returned. A later Stop that treats the reply window as a
194
- * fresh waiter ceiling monopolizes the claim and skips newly registered
195
- * questions. Absent on state written before this field existed — treated as
196
- * already spent, because that is the shape a degraded waiter left behind.
195
+ * Absolute process-owner deadline. It begins before submission and includes
196
+ * startup headroom, so it must be later than `reply_deadline_at`. Absent on
197
+ * state written before ownership was persisted — treated as already spent
198
+ * instead of inventing a fresh multi-day claim.
197
199
  */
198
200
  owner_deadline_at?: number;
199
201
  /** Frozen before the first network byte, so an ambiguous submit is replayable. */
@@ -207,51 +209,17 @@ interface PendingSubmissionIntent {
207
209
  draft: NotificationDraftT;
208
210
  owner_deadline_at: number;
209
211
  }
210
- /**
211
- * The waiter's whole wall clock: the terminal-first timer, submission, and the
212
- * wait for an answer, from the moment the turn-end hook starts.
213
- *
214
- * One plain ceiling, deliberately not a budget carved into reserves. The
215
- * reserves existed to fit every phase inside a *held* turn; on Claude Code the
216
- * turn is not held any more, and on a host that still holds one the useful
217
- * question is only how long that host is willing to wait in total.
218
- */
219
- export declare const WAITER_CEILING_SECONDS = 480;
220
- /**
221
- * The same wall clock where the waiter runs in the background instead of
222
- * inside a held turn.
223
- *
224
- * On a host that holds its turn, 480 s is a real cost to the person sitting in
225
- * front of it, and the number above is right. On Claude Code the Stop hook
226
- * returns at once and the waiter is detached, so the same 480 s buys nothing
227
- * and costs a direct wake: an answer arriving at minute nine had to wait for
228
- * the session's next turn even though nothing was blocked.
229
- *
230
- * This sits under `CLAUDE_ASYNC_STOP_TIMEOUT_SECONDS` (3600) with headroom,
231
- * because that declaration's kill is silent, and under the reply window the
232
- * question was pushed with. Past it the journal still delivers at the next
233
- * turn — the ceiling decides how long a *direct* wake stays possible, never
234
- * whether the answer survives.
235
- */
236
- export declare const DETACHED_WAITER_CEILING_SECONDS = 3300;
237
- /** The waiter's wall clock, which depends on whether a turn is held open for it. */
238
- export declare function waiterCeilingSeconds(detached: boolean): number;
239
212
  /**
240
213
  * The wire contract's shortest reply window. A question submitted with less
241
214
  * than this is rejected outright, and accepting one would in any case let the
242
215
  * server go on taking an answer after the waiter that owns it has returned.
243
216
  */
244
217
  export declare const MIN_REPLY_WINDOW_SECONDS = 60;
245
- /**
246
- * HTTP budget reserved for the waiter's final reply fetch and close fence.
247
- * Taken from the owner deadline rather than added after it, so the hook does
248
- * not block past its ceiling. A near-zero remainder used to produce a
249
- * misleading 0s timeout and an unproven retirement.
250
- */
251
- export declare const FINALIZATION_NETWORK_BUDGET_SECONDS = 3;
252
218
  export interface HookOutcome {
253
219
  /** Written to stdout verbatim — the harness parses this as output. */
254
220
  stdout?: string;
221
+ /** Commit a blocking continuation immediately before the harness stdout write. */
222
+ commitStdout?: () => boolean;
255
223
  /** Whether stdout takes over the turn, rather than adding prompt context. */
256
224
  decided?: boolean;
257
225
  /** Diagnostics; harnesses surface hook stderr in the transcript. */
@@ -266,6 +234,12 @@ export interface ContinuationEvent {
266
234
  remaining: number;
267
235
  request_ids: string[];
268
236
  journal_recorded_at: number;
237
+ /**
238
+ * Must be called immediately before the route's irreversible harness write.
239
+ * It atomically orders that write against SessionEnd; false means cancellation
240
+ * won and the route must hand nothing over.
241
+ */
242
+ commitDelivery(): boolean;
269
243
  }
270
244
  /**
271
245
  * How much a route's own return proves about where the answer ended up.
@@ -292,6 +266,8 @@ export type DeliveryAcknowledgement = 'delivered' | 'stdout' | 'held';
292
266
  /** What a route returns: the hook's outcome plus what the attempt proved. */
293
267
  export interface DeliveryOutcome {
294
268
  stdout?: string;
269
+ /** Deferred SessionEnd fence for a blocking stdout continuation. */
270
+ commitStdout?: () => boolean;
295
271
  notes?: string[];
296
272
  log?: Record<string, unknown>;
297
273
  acknowledgement: DeliveryAcknowledgement;
@@ -330,7 +306,7 @@ export declare function confirmCursorStopActivation(sessionId: string, env: Node
330
306
  /** A fresh/cleared Cursor lifecycle makes its next Stop the fallback owner again. */
331
307
  export declare function resetCursorStopActivation(sessionId: string, env: NodeJS.ProcessEnv): void;
332
308
  export declare function pruneAbandonedSessions(env: NodeJS.ProcessEnv, now?: number, maxAgeMs?: number): number;
333
- export declare function claimQuestionPush(sessionId: string, env: NodeJS.ProcessEnv, now?: number, beforeStaleReplace?: () => void): boolean;
309
+ export declare function claimQuestionPush(sessionId: string, env: NodeJS.ProcessEnv, now?: number, beforeStaleReplace?: () => void, ownerDeadlineAt?: number): boolean;
334
310
  export declare function releaseQuestionPush(sessionId: string, env: NodeJS.ProcessEnv): void;
335
311
  export interface ProjectSessionPointer {
336
312
  sessionId: string;