@raidiant/notifai 9.0.0 → 9.2.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 (68) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/command-session.d.ts +14 -0
  3. package/dist/command-session.js +30 -0
  4. package/dist/command-session.js.map +1 -0
  5. package/dist/commands-doctor.js +17 -15
  6. package/dist/commands-doctor.js.map +1 -1
  7. package/dist/commands-guidance.js +3 -29
  8. package/dist/commands-guidance.js.map +1 -1
  9. package/dist/commands-harness-context.js +21 -1
  10. package/dist/commands-harness-context.js.map +1 -1
  11. package/dist/commands-hooks.d.ts +11 -1
  12. package/dist/commands-hooks.js +98 -184
  13. package/dist/commands-hooks.js.map +1 -1
  14. package/dist/commands-init.d.ts +2 -0
  15. package/dist/commands-init.js +41 -21
  16. package/dist/commands-init.js.map +1 -1
  17. package/dist/commands-send.d.ts +1 -0
  18. package/dist/commands-send.js +62 -14
  19. package/dist/commands-send.js.map +1 -1
  20. package/dist/commands-setup-proof.d.ts +4 -3
  21. package/dist/commands-setup-proof.js +29 -14
  22. package/dist/commands-setup-proof.js.map +1 -1
  23. package/dist/commands.d.ts +1 -1
  24. package/dist/commands.js +1 -1
  25. package/dist/commands.js.map +1 -1
  26. package/dist/guidance-render.d.ts +20 -0
  27. package/dist/guidance-render.js +42 -0
  28. package/dist/guidance-render.js.map +1 -0
  29. package/dist/hooks.d.ts +16 -13
  30. package/dist/hooks.js +57 -32
  31. package/dist/hooks.js.map +1 -1
  32. package/dist/opencode-plugin.js +32 -5
  33. package/dist/opencode-plugin.js.map +1 -1
  34. package/dist/program.js +21 -12
  35. package/dist/program.js.map +1 -1
  36. package/dist/readiness.d.ts +6 -0
  37. package/dist/readiness.js +37 -0
  38. package/dist/readiness.js.map +1 -1
  39. package/dist/send-attempts.d.ts +26 -0
  40. package/dist/send-attempts.js +139 -0
  41. package/dist/send-attempts.js.map +1 -0
  42. package/dist/session-activation.d.ts +4 -8
  43. package/dist/session-activation.js +25 -14
  44. package/dist/session-activation.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/command-session.ts +38 -0
  47. package/src/commands-doctor.ts +18 -28
  48. package/src/commands-guidance.ts +3 -38
  49. package/src/commands-harness-context.ts +20 -1
  50. package/src/commands-hooks.ts +219 -220
  51. package/src/commands-init.ts +46 -24
  52. package/src/commands-send.ts +70 -14
  53. package/src/commands-setup-proof.test.ts +72 -0
  54. package/src/commands-setup-proof.ts +33 -14
  55. package/src/commands.test.ts +209 -67
  56. package/src/commands.ts +1 -0
  57. package/src/guidance-render.ts +56 -0
  58. package/src/guidance.test.ts +28 -0
  59. package/src/hooks.test.ts +42 -137
  60. package/src/hooks.ts +67 -46
  61. package/src/install-hooks.test.ts +41 -16
  62. package/src/opencode-plugin.ts +35 -5
  63. package/src/program.ts +22 -12
  64. package/src/readiness.ts +44 -0
  65. package/src/send-attempts.test.ts +143 -0
  66. package/src/send-attempts.ts +188 -0
  67. package/src/session-activation.ts +35 -18
  68. package/src/skill.test.ts +22 -23
package/src/skill.test.ts CHANGED
@@ -47,30 +47,31 @@ const section = (heading: string): string => {
47
47
  }
48
48
 
49
49
  describe('Notifai agent skill', () => {
50
- it('routes proactively in ordinary sessions without waiting for the user to name Notifai', () => {
50
+ it('routes proactively in owner sessions without turning ordinary workers into senders', () => {
51
51
  // The frontmatter description is the only skill text available during
52
- // automatic selection. If the ordinary-session trigger lives only in the
53
- // body, agents doing unrelated work never load it and therefore never see
54
- // the completion rule.
55
- expect(description).toMatch(/every agent session/i)
56
- expect(description).toMatch(/even when the user does not mention Notifai/i)
52
+ // automatic selection. It must select parent owners and workers given
53
+ // explicit delegation without selecting every ordinary worker.
54
+ expect(description).toMatch(/every agent session that owns User-visible Notification Requests/i)
55
+ expect(description).toMatch(/parent owns by default/i)
56
+ expect(description).toMatch(/worker only when ownership is explicitly delegated/i)
57
+ expect(description).toMatch(/even when the user does not mention (?:Notifai|it)/i)
57
58
  expect(description).toMatch(/guidance/i)
58
59
 
59
60
  const decide = section('## Decide whether to notify')
60
- expect(decide).toMatch(/every session's first task turn/i)
61
- expect(decide).toMatch(/read guidance before judging an Agent\s+Event/i)
62
- expect(decide).toMatch(/parent owns User-visible Notification Requests/i)
63
- expect(decide).toMatch(/unless\s+it explicitly delegates/i)
64
- expect(decide).toMatch(/workers[\s\S]{0,100}do not send independently/i)
61
+ expect(decide).toMatch(/owner session lifecycle context normally includes.*effective\s+guidance/is)
62
+ expect(decide).toMatch(/context is absent.*read it once before judging an Agent\s+Event/is)
63
+ expect(decide).toMatch(/parent owns by default/i)
64
+ expect(decide).toMatch(/explicit textual\s+delegation makes a worker the owner/i)
65
+ expect(decide).toMatch(/ordinary workers[\s\S]{0,100}do not load or send/i)
65
66
  })
66
67
 
67
68
  it('preserves the original Agent Event across setup and ambiguous delivery', () => {
68
69
  expect(skill).toMatch(
69
- /interrupted or killed `send`[\s\S]*`send\.attempt`[\s\S]*session,\s+title length, kind, and time/i,
70
+ /interrupted or killed `send`[\s\S]*do not correlate redacted logs by title[\s\S]*re-run the exact semantic send with\s+`--retry`/i,
70
71
  )
71
- expect(skill).toMatch(/unambiguous match[\s\S]*otherwise report ambiguous delivery without retrying/i)
72
- expect(skill).toMatch(/`no_active_devices`[\s\S]*repeat the original send/i)
73
- expect(skill).toMatch(/verification Notification[\s\S]*does not deliver the original Agent Event/i)
72
+ expect(skill).toMatch(/opaque matching attempt[\s\S]*refuse ambiguity/i)
73
+ expect(skill).toMatch(/`no_active_devices`[\s\S]*repeat the\s+(?:exact\s+)?original send/i)
74
+ expect(skill).toMatch(/verification Notification[\s\S]*does not deliver\s+the original Agent Event/i)
74
75
  })
75
76
 
76
77
  it('fits inside the budget a skill is actually read within', () => {
@@ -224,17 +225,16 @@ describe('Notifai agent skill', () => {
224
225
  expect(send).toMatch(/kind and the project travel as their own\s+fields, never in it/i)
225
226
  })
226
227
 
227
- it('names each immutable session once without asking the agent for its id', () => {
228
+ it('lets callers repeat one immutable semantic session name without supplying its id', () => {
228
229
  const send = section('## Send')
229
230
  expect(send).toContain('--session-label')
230
- expect(send).toMatch(/first Notification\s+Request/i)
231
231
  expect(send).toMatch(/2-6 words/i)
232
- expect(send).toMatch(/only when the current\s+environment exposes an exact session/i)
232
+ expect(send).toMatch(/when the current\s+environment exposes an exact session/i)
233
233
  expect(send).toMatch(/without an exact session[\s\S]{0,160}usage\s+error/i)
234
234
  expect(send).toMatch(/omit `--session-label`/i)
235
235
  expect(send).toMatch(/name the\s+environment supplies wins/i)
236
236
  expect(send).toMatch(/freezes one semantic name/i)
237
- expect(send).toMatch(/omit the flag on later sends and\s+questions/i)
237
+ expect(send).toMatch(/safe to repeat the same `--session-label` on every send and ask/i)
238
238
  // The one exception to permanence: garbage names are recoverable.
239
239
  expect(send).toMatch(/generated fallback name[\s\S]*replaced by a later\s+semantic name/i)
240
240
  expect(send).toMatch(/never pass\s+`--session-id`/i)
@@ -309,8 +309,8 @@ describe('Notifai agent skill', () => {
309
309
  expect(setup).toMatch(/never tell the\s+user to run a command you could have run/i)
310
310
  expect(setup).toMatch(/browser/i)
311
311
  expect(setup).toMatch(/companion/i)
312
- expect(setup).toContain('notifai doctor --json')
313
- expect(setup).toContain('notifai init')
312
+ expect(setup).toContain('notifai init --json')
313
+ expect(setup).toMatch(/do not follow a successful structured init\s+with doctor/i)
314
314
  expect(setup).toContain('--setup-scope')
315
315
  })
316
316
 
@@ -371,7 +371,6 @@ describe('Notifai agent skill', () => {
371
371
  'notifai replies',
372
372
  'notifai acknowledge',
373
373
  'notifai close',
374
- 'notifai doctor',
375
374
  'notifai init',
376
375
  'notifai config show',
377
376
  'notifai guidance',
@@ -389,7 +388,7 @@ describe('Notifai agent skill', () => {
389
388
  expect(harnessReference).toContain(`**${harness}:**`)
390
389
  }
391
390
  // The agent runs what a process can run; the human only does the human part.
392
- expect(harnessReference).toContain('install hooks yourself')
391
+ expect(harnessReference).toMatch(/let init install and assess\s+the hooks/i)
393
392
  expect(harnessReference).toMatch(/run `notifai login` yourself/i)
394
393
  expect(harnessReference).toMatch(/only the user can approve/i)
395
394
  })