@raidiant/notifai 11.6.2 → 11.7.0-beta.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 (106) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/atomic-file.d.ts +1 -1
  3. package/dist/atomic-file.js +8 -3
  4. package/dist/atomic-file.js.map +1 -1
  5. package/dist/client.d.ts +5 -1
  6. package/dist/client.js +2 -0
  7. package/dist/client.js.map +1 -1
  8. package/dist/codex-answer-control.d.ts +14 -0
  9. package/dist/codex-answer-control.js +41 -0
  10. package/dist/codex-answer-control.js.map +1 -0
  11. package/dist/codex-answer-presentation.d.ts +18 -0
  12. package/dist/codex-answer-presentation.js +113 -0
  13. package/dist/codex-answer-presentation.js.map +1 -0
  14. package/dist/codex-input-lifecycle.d.ts +10 -0
  15. package/dist/codex-input-lifecycle.js +63 -0
  16. package/dist/codex-input-lifecycle.js.map +1 -0
  17. package/dist/codex-native-control.d.ts +13 -0
  18. package/dist/codex-native-control.js +120 -0
  19. package/dist/codex-native-control.js.map +1 -0
  20. package/dist/codex-native-turn.d.ts +18 -0
  21. package/dist/codex-native-turn.js +46 -4
  22. package/dist/codex-native-turn.js.map +1 -1
  23. package/dist/codex-question-bindings.d.ts +76 -0
  24. package/dist/codex-question-bindings.js +151 -0
  25. package/dist/codex-question-bindings.js.map +1 -0
  26. package/dist/codex-queue-control.d.ts +21 -0
  27. package/dist/codex-queue-control.js +59 -0
  28. package/dist/codex-queue-control.js.map +1 -0
  29. package/dist/codex-tool-messages.js +40 -16
  30. package/dist/codex-tool-messages.js.map +1 -1
  31. package/dist/commands-acknowledge.d.ts +2 -4
  32. package/dist/commands-acknowledge.js +7 -0
  33. package/dist/commands-acknowledge.js.map +1 -1
  34. package/dist/commands-ask.js +70 -13
  35. package/dist/commands-ask.js.map +1 -1
  36. package/dist/commands-auth.d.ts +3 -1
  37. package/dist/commands-auth.js +88 -28
  38. package/dist/commands-auth.js.map +1 -1
  39. package/dist/commands-close.js +51 -3
  40. package/dist/commands-close.js.map +1 -1
  41. package/dist/commands-core.d.ts +7 -0
  42. package/dist/commands-core.js +1 -0
  43. package/dist/commands-core.js.map +1 -1
  44. package/dist/commands-hook-attend.js +50 -10
  45. package/dist/commands-hook-attend.js.map +1 -1
  46. package/dist/commands-hook-run.js +2 -1
  47. package/dist/commands-hook-run.js.map +1 -1
  48. package/dist/commands-init.d.ts +2 -0
  49. package/dist/commands-init.js +3 -3
  50. package/dist/commands-init.js.map +1 -1
  51. package/dist/commands-io.js +7 -0
  52. package/dist/commands-io.js.map +1 -1
  53. package/dist/commands-native-acknowledge.d.ts +8 -0
  54. package/dist/commands-native-acknowledge.js +114 -0
  55. package/dist/commands-native-acknowledge.js.map +1 -0
  56. package/dist/credentials.d.ts +5 -0
  57. package/dist/credentials.js.map +1 -1
  58. package/dist/hermes-attendant.js +4 -0
  59. package/dist/hermes-attendant.js.map +1 -1
  60. package/dist/hook-acknowledgements.d.ts +1 -0
  61. package/dist/hook-acknowledgements.js +3 -1
  62. package/dist/hook-acknowledgements.js.map +1 -1
  63. package/dist/hook-lifecycle.d.ts +12 -1
  64. package/dist/hook-lifecycle.js +145 -79
  65. package/dist/hook-lifecycle.js.map +1 -1
  66. package/dist/hook-question-retirement.js +2 -1
  67. package/dist/hook-question-retirement.js.map +1 -1
  68. package/dist/hook-question-state.d.ts +6 -2
  69. package/dist/hook-question-state.js +19 -7
  70. package/dist/hook-question-state.js.map +1 -1
  71. package/dist/hook-session-state.d.ts +5 -1
  72. package/dist/hook-session-state.js +48 -14
  73. package/dist/hook-session-state.js.map +1 -1
  74. package/dist/hook-types.d.ts +23 -1
  75. package/dist/hook-types.js.map +1 -1
  76. package/dist/native-answer-operation.d.ts +70 -0
  77. package/dist/native-answer-operation.js +247 -0
  78. package/dist/native-answer-operation.js.map +1 -0
  79. package/dist/pairing-qr.d.ts +5 -0
  80. package/dist/pairing-qr.js +24 -0
  81. package/dist/pairing-qr.js.map +1 -0
  82. package/dist/pending-pairing.d.ts +1 -0
  83. package/dist/pending-pairing.js +7 -5
  84. package/dist/pending-pairing.js.map +1 -1
  85. package/dist/program.js +9 -3
  86. package/dist/program.js.map +1 -1
  87. package/dist/session-attendant-probe.d.ts +1 -1
  88. package/dist/session-attendant-probe.js +2 -1
  89. package/dist/session-attendant-probe.js.map +1 -1
  90. package/dist/session-attendant-state.d.ts +5 -0
  91. package/dist/session-attendant-state.js +29 -10
  92. package/dist/session-attendant-state.js.map +1 -1
  93. package/dist/session-delivery.d.ts +29 -0
  94. package/dist/session-delivery.js +3 -1
  95. package/dist/session-delivery.js.map +1 -1
  96. package/dist/session-input-wakes.d.ts +78 -0
  97. package/dist/session-input-wakes.js +239 -0
  98. package/dist/session-input-wakes.js.map +1 -0
  99. package/dist/session-inputs.d.ts +41 -6
  100. package/dist/session-inputs.js +199 -19
  101. package/dist/session-inputs.js.map +1 -1
  102. package/dist/skill-source/manifest.json +8 -4
  103. package/dist/skill-source/notifai/SKILL.md +30 -28
  104. package/dist/skill-source/notifai/references/harness-setup.md +33 -20
  105. package/dist/skill-source/notifai/references/native-questions.md +51 -0
  106. package/package.json +10 -3
@@ -14,23 +14,31 @@ diagnosing, or recovering — not before.
14
14
 
15
15
  ## Signing this machine in
16
16
 
17
- Run `notifai init --json` yourself. When this machine is not paired it starts
18
- one approval, opens the approval page only the User can approve if a browser
19
- is reachable, polls once, and returns: progress is on stderr, final readiness
20
- on stdout, and the `credential` state's `technical.pairing` holds the
21
- `approve_url` and `code`.
22
- Tell the User to open that page, check the code, and approve — in the fixed
23
- T2 wording of <https://app.notifai.sh/setup.md>, which also names the other
24
- handoffs (denied, expired, no access, companion app, hook trust); when they
25
- say so, run the same command again. It resumes the approval it started — the
26
- handshake is kept on this machine until it resolves or expires — so a tool
27
- timeout or a closed shell never strands an approval the User already gave. A
28
- new code on a later run means the earlier approval expired; relay the new one.
29
-
30
- `notifai login --no-open` starts or resumes the same approval without opening
31
- a browser. `--name <name>` sets what the machine is called in their dashboard;
32
- the hostname is the default. `notifai logout` discards a saved credential and
33
- any approval still waiting.
17
+ Run `notifai init --json` yourself. An unapproved Machine starts one approval,
18
+ defaults to QR without asking for email, polls once, and returns. Progress is
19
+ on stderr and final readiness on stdout. The `credential` state's
20
+ `technical.pairing` holds protected local `qr_path` and `qr_text_path` artifacts,
21
+ the `approve_url`, and matching `code`. Present the QR before requesting a scan:
22
+ show the local image where supported, or read `qr_text_path` and reproduce the
23
+ library-generated QR verbatim in a fenced text block in a terminal/text-only harness.
24
+ Display the matching code beside it. Never include the QR
25
+ or proof-bearing link in any Notification Request field or media. Use T2 from
26
+ <https://app.notifai.sh/setup.md>: the User reviews their Account, computer, and
27
+ matching code in their signed-in Companion App before approving. A valid Auth
28
+ Session needs no additional email code merely to approve a Machine. Only the User can approve; opening review never approves automatically.
29
+ If the harness cannot display the local QR, present the browser alternative
30
+ truthfully rather than claiming a QR was shown.
31
+
32
+ Only when the User chooses an approval notification, ask for their Account
33
+ email; never infer it from other services or files. Run `notifai init --approval notification --approval-email <email>
34
+ --json`. Requested delivery is not confirmed delivery. For the browser
35
+ alternative use `--approval browser`; it opens no browser by default. Every
36
+ route resumes the same pending approval. When the User says it is approved,
37
+ run setup again. If it reports a new code, relay that code. A timeout or closed
38
+ shell does not strand an approval already given.
39
+
40
+ `--name <name>` sets the Machine name; the hostname is the default.
41
+ `notifai logout` discards the saved credential and any pending approval and QR.
34
42
 
35
43
  `notifai auth status --json` says whether this machine is paired.
36
44
  `notifai auth access --json` says whether the account has access, including
@@ -263,13 +271,18 @@ meter differs per harness:
263
271
  Direct inbox wake is unavailable, but it is not needed while this exact Stop
264
272
  continuation owns the answer.
265
273
  - **Codex:** a detached observer starts after submission and waits in the
266
- background for the complete answer window; Stop provides recovery. When an answer arrives, Notifai
267
- invokes `codex queue` for the exact Agent Session in the same Codex home.
268
- Only a wake-up is queued. Pending notes and answers remain in Notifai until
274
+ background for the complete answer window; Stop provides recovery. While a
275
+ trusted tool hook can hand input into a working turn, Notifai uses that hook.
276
+ Idle sessions, or sessions whose live input path cannot be established, use
277
+ a content-free wake for the exact Agent Session in the same Codex home.
278
+ Notifai does not cold-start or resume Codex to obtain a control connection.
279
+ Pending notes and answers remain in Notifai until
269
280
  a trusted tool hook, prompt hook, or `notifai receive` drains a bounded batch.
270
281
  A late wake-up cannot repeat an acknowledged answer: it contains no answer
271
282
  text. Queue success proves wake storage, not input presentation. Inputs are
272
283
  claimed immediately before presentation; uncertain writes are never replayed.
284
+ Verified queue control can remove a stale wake owned by Notifai; unavailable
285
+ control leaves the harmless wake in place and preserves human prompts.
273
286
  Keep the original question and request identities when investigating a delay.
274
287
  - **Grok:** the Stop hook stays held through the complete answer window and
275
288
  returns the answer as a decision block to the same Agent Session. Its native
@@ -0,0 +1,51 @@
1
+ # Native questions linked to Notifai
2
+
3
+ Use this flow only when `ask` returns `native_question`. Native forms are
4
+ optional; Question Routing still works without them. New linking requires both
5
+ local eligibility and confirmed service support. Capability absence leaves
6
+ the ordinary conversation and app-answer flow available.
7
+
8
+ ## Before emitting the form
9
+
10
+ Use the returned tool, titles and options exactly, in the registration turn.
11
+ The short title marker identifies a registered question; wording alone does
12
+ not. Keep the returned question and choice IDs for reporting its answer.
13
+ An unsupported form or missing binding stays ordinary. Preserve unrelated
14
+ native forms, even when they contain identical wording.
15
+
16
+ ## When the native answer arrives
17
+
18
+ Read the actual native answer. As the first command before work depending on
19
+ that answer, run the `notifai acknowledge q_…` command printed by `ask`, filling
20
+ in the actual answer IDs or typed text and an authored acknowledgement naming
21
+ the concrete work it causes. Report partial answers as partial: only include
22
+ questions the User answered. An app answer relayed through a native envelope
23
+ keeps its printed app acknowledgement command; do not report it as a new
24
+ native submission.
25
+
26
+ `--native-answers` accepts an array: a choice answer looks like
27
+ `[{"question_id":"q1","choice_ids":["staging"]}]`; a typed answer looks like
28
+ `[{"question_id":"q1","text":"Wait until tomorrow"}]`. Substitute the actual
29
+ returned question/choice IDs and the User's actual words.
30
+
31
+ Choose a distinct operation ID for each distinct native submission. Retrying
32
+ the same submission uses the same operation ID, answers and acknowledgement.
33
+ An identity-only retry is valid only after the command confirms it saved the
34
+ operation. Follow its recovery output when submission or acknowledgement is
35
+ unconfirmed; keep the original question instead of registering another one.
36
+
37
+ Success confirms that the native answer and authored acknowledgement were
38
+ recorded. Review `other_submissions` before acting. Preserve distinct app and
39
+ native answers; a conflict needs clarification before further dependent work.
40
+ An already acknowledged operation must not repeat work it previously caused.
41
+
42
+ Keep the original app answer watcher after native acknowledgement: a reply may
43
+ already be in flight, and the User can still answer within its original window.
44
+ Use `close` for explicit withdrawal, not as native-answer acknowledgement.
45
+ If you never emitted the exact returned form, an ordinary conversation answer
46
+ still uses the unlinked question's `close` flow.
47
+
48
+ Reporting an answer does not prove a native form closed. Native settlement
49
+ depends on the harness capabilities and exact binding; missing or uncertain
50
+ control must leave unrelated forms untouched. Describe only the result the
51
+ command actually confirms.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raidiant/notifai",
3
- "version": "11.6.2",
3
+ "version": "11.7.0-beta.2",
4
4
  "type": "module",
5
5
  "description": "Send native device notifications from agents and local programs",
6
6
  "bin": {
@@ -12,13 +12,20 @@
12
12
  ],
13
13
  "dependencies": {
14
14
  "@clack/prompts": "^1.7.0",
15
- "@raidiant/notifai-protocol": "8.1.5",
15
+ "@raidiant/notifai-protocol": "8.2.0-beta.2",
16
16
  "commander": "^14.0.0",
17
17
  "jsonc-parser": "^3.3.1",
18
18
  "picocolors": "^1.1.1",
19
- "smol-toml": "^1.4.0"
19
+ "qrcode": "1.5.4",
20
+ "smol-toml": "^1.4.0",
21
+ "ws": "8.21.0"
20
22
  },
21
23
  "devDependencies": {
24
+ "@types/pngjs": "6.0.5",
25
+ "@types/qrcode": "1.5.6",
26
+ "@types/ws": "8.18.1",
27
+ "jsqr": "1.4.0",
28
+ "pngjs": "7.0.0",
22
29
  "typescript": "^5.8.0",
23
30
  "vitest": "4.1.11"
24
31
  },