@scotthuang/agent-knock-knock 0.13.18 → 0.14.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 (270) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/CONTRIBUTING.md +212 -0
  3. package/README.md +105 -166
  4. package/connectors/deepseek-harness/LICENSE +21 -0
  5. package/connectors/deepseek-harness/README.md +406 -0
  6. package/connectors/pi/LICENSE +21 -0
  7. package/connectors/pi/README.md +446 -0
  8. package/dist/src/backend-recovery-semantic.d.ts +16 -0
  9. package/dist/src/backend-recovery-semantic.js +113 -0
  10. package/dist/src/backend-recovery-semantic.js.map +1 -0
  11. package/dist/src/backend-task-recovery.d.ts +103 -0
  12. package/dist/src/backend-task-recovery.js +142 -0
  13. package/dist/src/backend-task-recovery.js.map +1 -0
  14. package/dist/src/callback-transport.d.ts +8 -0
  15. package/dist/src/callback-transport.js +14 -0
  16. package/dist/src/callback-transport.js.map +1 -1
  17. package/dist/src/cli-core.js +18 -8
  18. package/dist/src/cli-core.js.map +1 -1
  19. package/dist/src/cli-runtime-context.d.ts +5 -0
  20. package/dist/src/cli-runtime-context.js.map +1 -1
  21. package/dist/src/codex-native-cli-adapter.d.ts +6 -0
  22. package/dist/src/codex-native-cli-adapter.js +273 -0
  23. package/dist/src/codex-native-cli-adapter.js.map +1 -0
  24. package/dist/src/codex-native-client-interactions.d.ts +6 -0
  25. package/dist/src/codex-native-client-interactions.js +124 -0
  26. package/dist/src/codex-native-client-interactions.js.map +1 -0
  27. package/dist/src/codex-native-client-rpc.d.ts +21 -0
  28. package/dist/src/codex-native-client-rpc.js +137 -0
  29. package/dist/src/codex-native-client-rpc.js.map +1 -0
  30. package/dist/src/codex-native-client.d.ts +42 -0
  31. package/dist/src/codex-native-client.js +326 -0
  32. package/dist/src/codex-native-client.js.map +1 -0
  33. package/dist/src/codex-native-identity.d.ts +6 -0
  34. package/dist/src/codex-native-identity.js +42 -0
  35. package/dist/src/codex-native-identity.js.map +1 -0
  36. package/dist/src/codex-native-monitor.d.ts +4 -0
  37. package/dist/src/codex-native-monitor.js +92 -0
  38. package/dist/src/codex-native-monitor.js.map +1 -0
  39. package/dist/src/codex-native-outbox.d.ts +16 -0
  40. package/dist/src/codex-native-outbox.js +120 -0
  41. package/dist/src/codex-native-outbox.js.map +1 -0
  42. package/dist/src/codex-native-public-projection.d.ts +545 -0
  43. package/dist/src/codex-native-public-projection.js +182 -0
  44. package/dist/src/codex-native-public-projection.js.map +1 -0
  45. package/dist/src/codex-native-record-store.d.ts +27 -0
  46. package/dist/src/codex-native-record-store.js +111 -0
  47. package/dist/src/codex-native-record-store.js.map +1 -0
  48. package/dist/src/codex-native-response-service.d.ts +69 -0
  49. package/dist/src/codex-native-response-service.js +244 -0
  50. package/dist/src/codex-native-response-service.js.map +1 -0
  51. package/dist/src/codex-native-runtime.d.ts +46 -0
  52. package/dist/src/codex-native-runtime.js +112 -0
  53. package/dist/src/codex-native-runtime.js.map +1 -0
  54. package/dist/src/codex-native-semantic.d.ts +17 -0
  55. package/dist/src/codex-native-semantic.js +175 -0
  56. package/dist/src/codex-native-semantic.js.map +1 -0
  57. package/dist/src/codex-native-snapshot.d.ts +19 -0
  58. package/dist/src/codex-native-snapshot.js +160 -0
  59. package/dist/src/codex-native-snapshot.js.map +1 -0
  60. package/dist/src/codex-native-state-store.d.ts +61 -0
  61. package/dist/src/codex-native-state-store.js +132 -0
  62. package/dist/src/codex-native-state-store.js.map +1 -0
  63. package/dist/src/codex-native-task-service.d.ts +71 -0
  64. package/dist/src/codex-native-task-service.js +502 -0
  65. package/dist/src/codex-native-task-service.js.map +1 -0
  66. package/dist/src/codex-native-types.d.ts +92 -0
  67. package/dist/src/codex-native-types.js +15 -0
  68. package/dist/src/codex-native-types.js.map +1 -0
  69. package/dist/src/conversation-list.d.ts +12 -0
  70. package/dist/src/conversation-list.js +30 -0
  71. package/dist/src/conversation-list.js.map +1 -0
  72. package/dist/src/conversation-route-dispatch.d.ts +13 -0
  73. package/dist/src/conversation-route-dispatch.js +66 -0
  74. package/dist/src/conversation-route-dispatch.js.map +1 -0
  75. package/dist/src/conversation-route-legacy.d.ts +18 -0
  76. package/dist/src/conversation-route-legacy.js +54 -0
  77. package/dist/src/conversation-route-legacy.js.map +1 -0
  78. package/dist/src/conversation-route-store.d.ts +51 -0
  79. package/dist/src/conversation-route-store.js +126 -0
  80. package/dist/src/conversation-route-store.js.map +1 -0
  81. package/dist/src/conversation-routing-cli-adapter.d.ts +12 -0
  82. package/dist/src/conversation-routing-cli-adapter.js +211 -0
  83. package/dist/src/conversation-routing-cli-adapter.js.map +1 -0
  84. package/dist/src/conversation-routing-commands.d.ts +11 -0
  85. package/dist/src/conversation-routing-commands.js +85 -0
  86. package/dist/src/conversation-routing-commands.js.map +1 -0
  87. package/dist/src/conversation-routing-home.d.ts +26 -0
  88. package/dist/src/conversation-routing-home.js +105 -0
  89. package/dist/src/conversation-routing-home.js.map +1 -0
  90. package/dist/src/conversation-routing-identity.d.ts +40 -0
  91. package/dist/src/conversation-routing-identity.js +174 -0
  92. package/dist/src/conversation-routing-identity.js.map +1 -0
  93. package/dist/src/conversation-runtime-route-store.d.ts +11 -0
  94. package/dist/src/conversation-runtime-route-store.js +118 -0
  95. package/dist/src/conversation-runtime-route-store.js.map +1 -0
  96. package/dist/src/desktop-async-interactions.d.ts +15 -0
  97. package/dist/src/desktop-async-interactions.js +88 -0
  98. package/dist/src/desktop-async-interactions.js.map +1 -0
  99. package/dist/src/desktop-async-state.d.ts +5 -0
  100. package/dist/src/desktop-async-state.js +53 -0
  101. package/dist/src/desktop-async-state.js.map +1 -0
  102. package/dist/src/desktop-cli-adapter.d.ts +7 -0
  103. package/dist/src/desktop-cli-adapter.js +322 -0
  104. package/dist/src/desktop-cli-adapter.js.map +1 -0
  105. package/dist/src/desktop-cli-controls.d.ts +9 -0
  106. package/dist/src/desktop-cli-controls.js +45 -0
  107. package/dist/src/desktop-cli-controls.js.map +1 -0
  108. package/dist/src/desktop-command-presentation.d.ts +2 -0
  109. package/dist/src/desktop-command-presentation.js +31 -0
  110. package/dist/src/desktop-command-presentation.js.map +1 -0
  111. package/dist/src/desktop-control-semantic.d.ts +8 -0
  112. package/dist/src/desktop-control-semantic.js +68 -0
  113. package/dist/src/desktop-control-semantic.js.map +1 -0
  114. package/dist/src/desktop-identity.d.ts +5 -0
  115. package/dist/src/desktop-identity.js +40 -0
  116. package/dist/src/desktop-identity.js.map +1 -0
  117. package/dist/src/desktop-interaction-projection.d.ts +57 -0
  118. package/dist/src/desktop-interaction-projection.js +196 -0
  119. package/dist/src/desktop-interaction-projection.js.map +1 -0
  120. package/dist/src/desktop-interaction-state.d.ts +3 -0
  121. package/dist/src/desktop-interaction-state.js +48 -0
  122. package/dist/src/desktop-interaction-state.js.map +1 -0
  123. package/dist/src/desktop-ipc-async-answer.d.ts +9 -0
  124. package/dist/src/desktop-ipc-async-answer.js +71 -0
  125. package/dist/src/desktop-ipc-async-answer.js.map +1 -0
  126. package/dist/src/desktop-ipc-client.d.ts +47 -0
  127. package/dist/src/desktop-ipc-client.js +400 -0
  128. package/dist/src/desktop-ipc-client.js.map +1 -0
  129. package/dist/src/desktop-ipc-native-operations.d.ts +11 -0
  130. package/dist/src/desktop-ipc-native-operations.js +126 -0
  131. package/dist/src/desktop-ipc-native-operations.js.map +1 -0
  132. package/dist/src/desktop-ipc-transport.d.ts +13 -0
  133. package/dist/src/desktop-ipc-transport.js +123 -0
  134. package/dist/src/desktop-ipc-transport.js.map +1 -0
  135. package/dist/src/desktop-list.d.ts +25 -0
  136. package/dist/src/desktop-list.js +55 -0
  137. package/dist/src/desktop-list.js.map +1 -0
  138. package/dist/src/desktop-metadata-reader.d.ts +30 -0
  139. package/dist/src/desktop-metadata-reader.js +182 -0
  140. package/dist/src/desktop-metadata-reader.js.map +1 -0
  141. package/dist/src/desktop-monitor.d.ts +4 -0
  142. package/dist/src/desktop-monitor.js +101 -0
  143. package/dist/src/desktop-monitor.js.map +1 -0
  144. package/dist/src/desktop-public-projection.d.ts +6 -0
  145. package/dist/src/desktop-public-projection.js +134 -0
  146. package/dist/src/desktop-public-projection.js.map +1 -0
  147. package/dist/src/desktop-request-interactions.d.ts +14 -0
  148. package/dist/src/desktop-request-interactions.js +144 -0
  149. package/dist/src/desktop-request-interactions.js.map +1 -0
  150. package/dist/src/desktop-response-dispatch.d.ts +14 -0
  151. package/dist/src/desktop-response-dispatch.js +19 -0
  152. package/dist/src/desktop-response-dispatch.js.map +1 -0
  153. package/dist/src/desktop-response-evidence.d.ts +4 -0
  154. package/dist/src/desktop-response-evidence.js +19 -0
  155. package/dist/src/desktop-response-evidence.js.map +1 -0
  156. package/dist/src/desktop-response-service.d.ts +11 -0
  157. package/dist/src/desktop-response-service.js +188 -0
  158. package/dist/src/desktop-response-service.js.map +1 -0
  159. package/dist/src/desktop-response-store.d.ts +35 -0
  160. package/dist/src/desktop-response-store.js +58 -0
  161. package/dist/src/desktop-response-store.js.map +1 -0
  162. package/dist/src/desktop-response-types.d.ts +20 -0
  163. package/dist/src/desktop-response-types.js +2 -0
  164. package/dist/src/desktop-response-types.js.map +1 -0
  165. package/dist/src/desktop-response-value.d.ts +6 -0
  166. package/dist/src/desktop-response-value.js +31 -0
  167. package/dist/src/desktop-response-value.js.map +1 -0
  168. package/dist/src/desktop-runtime.d.ts +153 -0
  169. package/dist/src/desktop-runtime.js +88 -0
  170. package/dist/src/desktop-runtime.js.map +1 -0
  171. package/dist/src/desktop-semantic.d.ts +21 -0
  172. package/dist/src/desktop-semantic.js +140 -0
  173. package/dist/src/desktop-semantic.js.map +1 -0
  174. package/dist/src/desktop-session-catalog.d.ts +68 -0
  175. package/dist/src/desktop-session-catalog.js +225 -0
  176. package/dist/src/desktop-session-catalog.js.map +1 -0
  177. package/dist/src/desktop-session-controls.d.ts +145 -0
  178. package/dist/src/desktop-session-controls.js +176 -0
  179. package/dist/src/desktop-session-controls.js.map +1 -0
  180. package/dist/src/desktop-sidebar-metadata.d.ts +27 -0
  181. package/dist/src/desktop-sidebar-metadata.js +83 -0
  182. package/dist/src/desktop-sidebar-metadata.js.map +1 -0
  183. package/dist/src/desktop-sidebar-projects.d.ts +10 -0
  184. package/dist/src/desktop-sidebar-projects.js +31 -0
  185. package/dist/src/desktop-sidebar-projects.js.map +1 -0
  186. package/dist/src/desktop-sidebar-selection.d.ts +28 -0
  187. package/dist/src/desktop-sidebar-selection.js +85 -0
  188. package/dist/src/desktop-sidebar-selection.js.map +1 -0
  189. package/dist/src/desktop-snapshot-details.d.ts +4 -0
  190. package/dist/src/desktop-snapshot-details.js +116 -0
  191. package/dist/src/desktop-snapshot-details.js.map +1 -0
  192. package/dist/src/desktop-snapshot.d.ts +11 -0
  193. package/dist/src/desktop-snapshot.js +276 -0
  194. package/dist/src/desktop-snapshot.js.map +1 -0
  195. package/dist/src/desktop-state-store.d.ts +72 -0
  196. package/dist/src/desktop-state-store.js +269 -0
  197. package/dist/src/desktop-state-store.js.map +1 -0
  198. package/dist/src/desktop-task-interactions.d.ts +10 -0
  199. package/dist/src/desktop-task-interactions.js +93 -0
  200. package/dist/src/desktop-task-interactions.js.map +1 -0
  201. package/dist/src/desktop-task-recovery.d.ts +38 -0
  202. package/dist/src/desktop-task-recovery.js +171 -0
  203. package/dist/src/desktop-task-recovery.js.map +1 -0
  204. package/dist/src/desktop-task-service.d.ts +54 -0
  205. package/dist/src/desktop-task-service.js +441 -0
  206. package/dist/src/desktop-task-service.js.map +1 -0
  207. package/dist/src/desktop-types.d.ts +281 -0
  208. package/dist/src/desktop-types.js +13 -0
  209. package/dist/src/desktop-types.js.map +1 -0
  210. package/dist/src/host-monitor-reconciliation.js +36 -4
  211. package/dist/src/host-monitor-reconciliation.js.map +1 -1
  212. package/dist/src/host-profile-runtime.js +7 -3
  213. package/dist/src/host-profile-runtime.js.map +1 -1
  214. package/dist/src/local-codex-cli-adapter.d.ts +7 -0
  215. package/dist/src/local-codex-cli-adapter.js +13 -0
  216. package/dist/src/local-codex-cli-adapter.js.map +1 -0
  217. package/dist/src/openclaw-callback-transport.js +2 -1
  218. package/dist/src/openclaw-callback-transport.js.map +1 -1
  219. package/dist/src/semantic-conversation-target.d.ts +4 -0
  220. package/dist/src/semantic-conversation-target.js +20 -0
  221. package/dist/src/semantic-conversation-target.js.map +1 -0
  222. package/dist/src/semantic-permission-control.js +47 -9
  223. package/dist/src/semantic-permission-control.js.map +1 -1
  224. package/dist/src/semantic-private-authority-offers.d.ts +1 -1
  225. package/dist/src/semantic-private-authority-offers.js +3 -1
  226. package/dist/src/semantic-private-authority-offers.js.map +1 -1
  227. package/dist/src/semantic-tool-command-helpers.d.ts +6 -0
  228. package/dist/src/semantic-tool-command-helpers.js +199 -78
  229. package/dist/src/semantic-tool-command-helpers.js.map +1 -1
  230. package/dist/src/semantic-tool-descriptions.d.ts +2 -1
  231. package/dist/src/semantic-tool-descriptions.js +81 -35
  232. package/dist/src/semantic-tool-descriptions.js.map +1 -1
  233. package/dist/src/semantic-tool-list-projection.js +66 -2
  234. package/dist/src/semantic-tool-list-projection.js.map +1 -1
  235. package/dist/src/semantic-tool-presentation.js +76 -7
  236. package/dist/src/semantic-tool-presentation.js.map +1 -1
  237. package/dist/src/semantic-tool-runtime.js +129 -29
  238. package/dist/src/semantic-tool-runtime.js.map +1 -1
  239. package/dist/src/semantic-tool-schemas.d.ts +410 -27
  240. package/dist/src/semantic-tool-schemas.js +176 -88
  241. package/dist/src/semantic-tool-schemas.js.map +1 -1
  242. package/dist/src/terminal-action-contracts.js +10 -6
  243. package/dist/src/terminal-action-contracts.js.map +1 -1
  244. package/dist/src/terminal-list-cli-adapter.d.ts +1 -0
  245. package/dist/src/terminal-list-cli-adapter.js +6 -3
  246. package/dist/src/terminal-list-cli-adapter.js.map +1 -1
  247. package/dist/src/terminal-monitor-decision-policy.d.ts +1 -1
  248. package/dist/src/terminal-permission-control-list-projection.d.ts +1 -1
  249. package/dist/src/terminal-user-send-intent.d.ts +2 -0
  250. package/dist/src/terminal-user-send-intent.js +11 -3
  251. package/dist/src/terminal-user-send-intent.js.map +1 -1
  252. package/docs/architecture/current-architecture.md +313 -0
  253. package/docs/architecture/interactive-terminal-response.md +276 -0
  254. package/docs/architecture/issue-126-final-report.md +248 -0
  255. package/docs/architecture/orchestration-refactor-history.md +2987 -0
  256. package/docs/architecture/orchestration-refactor.md +21 -0
  257. package/docs/backend-task-recovery.md +89 -0
  258. package/docs/bidirectional-agent-protocol.md +260 -0
  259. package/docs/codex-cli-native-compatibility.md +246 -0
  260. package/docs/codex-desktop-compatibility.md +414 -0
  261. package/docs/openclaw-operations.md +281 -0
  262. package/docs/openclaw-session-turn-delivery-requirement.md +45 -0
  263. package/docs/operator-guide.md +543 -0
  264. package/docs/storage-and-logging.md +91 -0
  265. package/docs/test-performance-issue-108.md +80 -0
  266. package/docs/test-performance-issue-120.md +226 -0
  267. package/docs/testing.md +628 -0
  268. package/openclaw.plugin.json +7 -3
  269. package/package.json +6 -13
  270. package/templates/openclaw-skills/agent-knock-knock/SKILL.md +66 -15
@@ -0,0 +1,446 @@
1
+ # Agent Knock Knock for Pi — POC
2
+
3
+ This Pi Extension makes Pi an Agent Knock Knock (AKK) orchestration Host. Pi
4
+ can use `/akk` and AKK's capability-handshake-verified semantic tools to control Codex and Claude Code
5
+ terminals that are already running in tmux or Herdr.
6
+
7
+ The connector does not modify Pi, launch or authenticate a coding agent, or
8
+ depend on an OpenClaw Gateway. It uses AKK's public HostAdapter and returns
9
+ callbacks to the exact initiating Pi session through a private local Unix
10
+ socket.
11
+
12
+ ## Status and compatibility
13
+
14
+ This connector's pinned AKK 0.13.3 runtime provides terminal control. The
15
+ [root README](../../README.md) describes the newer AKK 0.14.0 CLI direct,
16
+ Desktop, and Recovery features; installing this connector does not select that
17
+ runtime automatically. The AKK core release does not upgrade this connector's
18
+ pinned dependency.
19
+
20
+ This is a POC prerelease distributed on npm as
21
+ `@scotthuang/agent-knock-knock-pi`. Prereleases use the `next` dist-tag:
22
+
23
+ ```sh
24
+ pi install npm:@scotthuang/agent-knock-knock-pi@next
25
+ ```
26
+
27
+ The current compatibility contract is intentionally exact:
28
+
29
+ - Pi `0.84.4`, installed from the official
30
+ `@earendil-works/pi-coding-agent` package.
31
+ - Node.js `22.19.0` or newer.
32
+ - AKK `0.13.3`, pinned by this connector's package and lockfile. Running
33
+ `npm ci` in `connectors/pi` installs that exact AKK runtime; a different
34
+ version at the repository root is not substituted automatically.
35
+ - macOS or Linux. The POC requires a POSIX Unix socket and does not support
36
+ Windows named pipes.
37
+ - At least one authenticated Codex or Claude Code process already running in a
38
+ supported tmux or Herdr terminal under the same OS user.
39
+ - A configured Pi model/provider. Pi model authentication is separate from
40
+ AKK and is not performed by this connector.
41
+
42
+ The connector rejects a Pi runtime other than `0.84.4` before it creates a
43
+ socket or starts AKK lifecycle work. Pi's own packages remain `*` peer
44
+ dependencies as required by Pi's package contract; the runtime check is the
45
+ compatibility authority.
46
+
47
+ ## Five-minute quick start
48
+
49
+ ### 1. Install the accepted Pi version
50
+
51
+ ```sh
52
+ npm install -g @earendil-works/pi-coding-agent@0.84.4
53
+ node --version
54
+ pi --version
55
+ ```
56
+
57
+ Configure a model using Pi's normal `/login`, provider environment variable,
58
+ or settings flow before continuing.
59
+
60
+ ### 2. Start a coding agent in a shared terminal
61
+
62
+ AKK discovers an existing process; it never starts one for you. For example:
63
+
64
+ ```sh
65
+ tmux new-session -s akk-pi-work -c "$(pwd -P)" codex
66
+ ```
67
+
68
+ Wait for Codex to reach its interactive prompt, then detach with `Ctrl-b`
69
+ followed by `d`. Use `claude` instead of `codex` to test Claude Code. An
70
+ existing supported Herdr terminal works too.
71
+
72
+ ### 3. Install the connector
73
+
74
+ ```sh
75
+ pi install npm:@scotthuang/agent-knock-knock-pi@next
76
+ pi list
77
+ ```
78
+
79
+ Using `next` follows compatible Pi connector prereleases. To pin this exact
80
+ build instead, install
81
+ `npm:@scotthuang/agent-knock-knock-pi@0.1.0-poc.2`; exact versions are pinned
82
+ and are not advanced by Pi's bulk update command.
83
+
84
+ ### 4. Start Pi
85
+
86
+ ```sh
87
+ pi
88
+ ```
89
+
90
+ Pi should show `AKK ready`. The package manifest registers both the Extension
91
+ and its bundled `agent-knock-knock` skill, so no separate skill copy, `-e`
92
+ path, or repository checkout is required. The structured List result stays
93
+ small by returning current action names and dynamic inputs; Pi loads the skill
94
+ when it needs the static action meanings and safety rules.
95
+
96
+ ### 5. Complete the first round trip
97
+
98
+ In Pi, list the live targets:
99
+
100
+ ```text
101
+ /akk list
102
+ ```
103
+
104
+ If exactly one terminal is send-ready, submit a small task:
105
+
106
+ ```text
107
+ /akk reply with exactly AKK_PI_OK after inspecting the current workspace
108
+ ```
109
+
110
+ If multiple targets are present, use the fresh selector printed by
111
+ `/akk list`:
112
+
113
+ ```text
114
+ /akk @a1b2c3d4: reply with exactly AKK_PI_OK after inspecting the current workspace
115
+ ```
116
+
117
+ A managed Send returns a `turn_id`; when the coding agent settles, its callback
118
+ is injected into the same Pi session. Inspect it at any time with the exact
119
+ turn selector printed by AKK:
120
+
121
+ ```text
122
+ /akk status <turn-selector>
123
+ ```
124
+
125
+ To observe work that you started manually in the terminal, copy the complete
126
+ `terminal_id` from a fresh list and start a read-only Watch:
127
+
128
+ ```text
129
+ /akk watch <exact-terminal-id>
130
+ /akk status <watch-id>
131
+ /akk unwatch <watch-id>
132
+ ```
133
+
134
+ Watch does not send, adopt, approve, interrupt, or reserve the task. Do not add
135
+ a second Watch merely to make a normal managed Send callback: managed Send
136
+ already has a callback. When a user-priority Send must fall back to unmanaged
137
+ physical delivery, AKK instead tries to attach the request-bound Watch itself
138
+ and returns its `watch_id`.
139
+
140
+ ## Tool workflow
141
+
142
+ The usual product loop is:
143
+
144
+ 1. **List** to discover live terminals and their current `available_actions`.
145
+ 2. **Send** using the fresh action's prefilled `session_id` or `terminal_id`.
146
+ Do not invent semantic IDs or retry an uncertain terminal mutation.
147
+ 3. Wait for the managed **Callback**. An unmanaged user-priority fallback may
148
+ return a Terminal Watch callback instead of a managed Turn callback.
149
+ 4. Use **Status** with the exact `turn_id` or `watch_id` when the callback is
150
+ delayed or the Pi route changed.
151
+ 5. Use **Respond** for a question in that same Turn. Use **Approve** only after
152
+ reviewing the live approval prompt and making an explicit decision.
153
+ 6. Use **Cancel**, **Close**, **Renew**, or **Retry Callback** only when the
154
+ current list/status output advertises that exact action.
155
+
156
+ The `/akk` command is the direct human surface. The complete semantic catalog is
157
+ also registered for model-driven orchestration:
158
+
159
+ | Tool | Purpose |
160
+ | --- | --- |
161
+ | `agent_knock_knock_list` | List verified Codex/Claude terminals, managed work, Watches, and currently available semantic actions. |
162
+ | `agent_knock_knock_watch` | Start a durable, read-only Watch for one exact `terminal_id`. |
163
+ | `agent_knock_knock_unwatch` | Stop observation by exact `watch_id`; it does not interrupt the coding agent. |
164
+ | `agent_knock_knock_list_resumable_threads` | List structurally verified native threads that can be resumed in one terminal. |
165
+ | `agent_knock_knock_native_inspect` | Run the closed native `status` inspection for one exact terminal. Arbitrary slash commands are not accepted. |
166
+ | `agent_knock_knock_model_options` | Read one exact idle terminal's native model and reasoning catalog and create a single-use typed offer. |
167
+ | `agent_knock_knock_repair_model_control` | Dismiss only an exactly recognized stale model-control surface; it never selects a model or submits a task. |
168
+ | `agent_knock_knock_set_model` | Consume the current catalog offer to select one advertised semantic model and reasoning effort. |
169
+ | `agent_knock_knock_identify_foreground` | Run a bounded diagnostic native identity probe without creating durable model-control authority. |
170
+ | `agent_knock_knock_identify_and_send` | Keep one terminal lock across identity observation and one explicit Send when the normal foreground identity is ambiguous. |
171
+ | `agent_knock_knock_new_thread` | Start and verify a clean native coding-agent thread after explicit user intent. |
172
+ | `agent_knock_knock_reconcile_binding` | Detach one exact conflicting AKK Session binding after explicit confirmation, without adopting another thread. |
173
+ | `agent_knock_knock_resume_thread` | Resume one exact complete `native_thread_id` returned by the current discovery result. |
174
+ | `agent_knock_knock_status` | Inspect one exact managed Turn or Terminal Watch. |
175
+ | `agent_knock_knock_send` | Send a new task through the exact currently advertised Session or terminal action. |
176
+ | `agent_knock_knock_respond` | Answer a question or blocked callback in one existing Turn; it does not start a new Turn. |
177
+ | `agent_knock_knock_respond_interaction` | Answer the current typed native questionnaire step for one exact response-capable Turn or Watch. |
178
+ | `agent_knock_knock_approve` | Approve one current permission request after Pi presents a native user-decision gate. |
179
+ | `agent_knock_knock_renew` | Renew monitoring for one stalled but still-live Turn without terminal input. |
180
+ | `agent_knock_knock_retry_callback` | Retry one persisted managed callback with its original message identity. |
181
+ | `agent_knock_knock_cancel` | Interrupt one exact task after Pi obtains native confirmation; the shared pane stays open. |
182
+ | `agent_knock_knock_close` | Release AKK management for one Turn without sending terminal input or stopping the coding agent. |
183
+
184
+ Except for the deliberately user-intent-first, read-only Watch path, treat the
185
+ fresh `available_actions` output as authority. The connector preserves AKK's
186
+ semantic-ID, idempotency, terminal identity, Store, Session, Turn, and
187
+ completion rules rather than recreating them in Pi.
188
+
189
+ ## Active approval, response, and cancellation
190
+
191
+ When a managed task needs permission, its callback is queued into the
192
+ originating Pi session. A model-facing `agent_knock_knock_approve` call does not
193
+ immediately type into the terminal. The connector first refreshes AKK Status,
194
+ shows the current prompt in Pi's native UI, and requires a selection:
195
+
196
+ - **Approve once** sends the current prompt-scoped AKK approval.
197
+ - **Keep pending** sends no terminal input.
198
+ - For a managed `turn_id`, **Reject and cancel task** asks for a second
199
+ confirmation, then invokes AKK Cancel.
200
+
201
+ A terminal-scoped approval has no terminal-scoped Cancel authority, so its
202
+ dialog offers only Approve or Keep pending. A separately advertised Cancel
203
+ action gets its own Pi confirmation dialog.
204
+
205
+ `agent_knock_knock_respond` answers an ordinary question in the exact
206
+ in-flight Turn; it is not an approval denial. AKK currently has no generic
207
+ "select the target's No option and continue this Turn" tool. Reject-and-cancel
208
+ interrupts the task instead.
209
+
210
+ The native confirmation flow requires an interactive Pi UI. In a context where
211
+ `ctx.hasUI` is false, the connector refuses model-facing Approve and Cancel
212
+ instead of mutating the terminal without a person. Headless/non-interactive Pi
213
+ is not a product-acceptance target for this POC.
214
+
215
+ AKK keeps the coding agent's existing permission mode. This connector does not
216
+ enable `--yolo`, change a target's permission settings, or expose AKK's
217
+ OpenClaw-specific `autoApprove` configuration.
218
+
219
+ ## Callback delivery and recovery
220
+
221
+ The callback path is:
222
+
223
+ ```text
224
+ AKK callback outbox
225
+ -> command_json_v1 callback helper
226
+ -> authenticated private Unix socket
227
+ -> fsync-backed Pi callback inbox
228
+ -> originating Pi session
229
+ ```
230
+
231
+ When Pi is idle, the callback is injected with `triggerTurn: true` and starts a
232
+ new Pi turn. When Pi is already producing a response, the connector uses Pi's
233
+ follow-up queue so the callback is not mixed into the current model turn.
234
+
235
+ An `accepted` callback acknowledgement means that the connector durably
236
+ admitted the exact delivery to its local inbox and returned an acceptance ID.
237
+ It does **not** mean the Pi model consumed the message: Pi `0.84.4` exposes a
238
+ synchronous `sendMessage()` call without a model-consumption receipt. The last
239
+ hop is therefore at-least-once or uncertain if Pi crashes between
240
+ `sendMessage()` and recording the inbox entry as delivered. Delivery and
241
+ idempotency IDs let the connector reject collisions and suppress known exact
242
+ duplicates.
243
+
244
+ For a missing callback:
245
+
246
+ 1. If Pi is busy, wait for the current response to end; the callback may be a
247
+ queued follow-up.
248
+ 2. Refresh `/akk list`, then run `/akk status <turn-selector-or-watch-id>`.
249
+ Status is the authoritative manual recovery path and does not need the
250
+ callback to have reached the model.
251
+ 3. If a still-live task has no managed callback route, start a new read-only
252
+ Watch on its exact current `terminal_id` and retain the returned `watch_id`.
253
+ 4. Use `agent_knock_knock_retry_callback` only when the current managed Turn
254
+ advertises it and the original Pi callback route is still live. Never retry
255
+ an uncertain terminal Send to recover a callback.
256
+
257
+ The POC owns one live Pi runtime and one branch epoch. Explicit session-tree
258
+ navigation rotates the controller route; Pi shutdown removes the socket and
259
+ invalidates that runtime's route. The durable inbox does not migrate callbacks
260
+ from an old random controller identity into a new Pi runtime or branch. After a
261
+ restart or branch change, use fresh List/Status and, for still-running terminal
262
+ work, a fresh Watch. Do not expect the old route's callback to jump to the new
263
+ conversation automatically.
264
+
265
+ ## Configuration, security, and storage
266
+
267
+ The connector needs no project-specific configuration. These optional
268
+ environment variables must be set **before** Pi starts and must contain
269
+ absolute paths:
270
+
271
+ | Variable | Default | Purpose |
272
+ | --- | --- | --- |
273
+ | `AKK_PI_STORE_DIR` | `~/.agent-knock-knock/store` | Override AKK's shared Session, Turn, Watch, receipt, and callback-outbox Store. |
274
+ | `AKK_PI_STATE_DIR` | `~/.pi/agent/akk` | Override the Pi connector's durable callback-inbox directory. |
275
+
276
+ Example with isolated development state:
277
+
278
+ ```sh
279
+ AKK_PI_STORE_DIR=/absolute/private/path/akk-store \
280
+ AKK_PI_STATE_DIR=/absolute/private/path/pi-akk-state \
281
+ pi
282
+ ```
283
+
284
+ Security and retention boundaries:
285
+
286
+ - Pi Extensions execute with the same OS privileges as Pi. Review local
287
+ connector source before loading it.
288
+ - Each Pi runtime creates a random directory under the OS temporary directory
289
+ with mode `0700`. Its Host Profile and authenticated Unix socket use mode
290
+ `0600`, and the directory is removed on clean Pi shutdown.
291
+ - The socket token is random and runtime-private. It is not written to the
292
+ durable inbox or accepted as a model/tool argument. The callback helper is
293
+ allowed only the socket and token environment variables it needs.
294
+ - The persistent state directory is forced to `0700`; its
295
+ `callback-inbox.json` is written atomically with mode `0600`. It can retain
296
+ callback bodies, which may contain task results. The inbox is bounded to 256
297
+ entries and 64 MiB, pruning older delivered entries as new callbacks arrive.
298
+ - The AKK Store is separate from the Pi inbox and may contain terminal/session
299
+ metadata and callback results. Use a dedicated private directory for either
300
+ override; do not point it at a shared or broad filesystem root.
301
+ - The connector strips the supported GLM credential environment variables
302
+ from AKK relay/callback subprocess environments. Model credentials remain
303
+ Pi-owned and are never connector configuration.
304
+
305
+ ## Troubleshooting
306
+
307
+ | Symptom | Check and recovery |
308
+ | --- | --- |
309
+ | `requires Pi 0.84.4` | Run `pi --version`, then reinstall the exact accepted release with `npm install -g @earendil-works/pi-coding-agent@0.84.4`. Newer Pi releases are not silently accepted by this POC. |
310
+ | Pi never shows `AKK ready` | Confirm Node is at least 22.19, run `pi list`, update or reinstall `npm:@scotthuang/agent-knock-knock-pi@next`, and fully restart Pi. For a source checkout, follow the local-development build commands below. |
311
+ | Module or `lib/index.js` not found | Remove and reinstall the npm package. For a source checkout, confirm Pi was given `connectors/pi`, not the repository root, and rebuild with the documented cwd-specific command. |
312
+ | `/akk list` finds no terminal | Start authenticated `codex` or `claude` inside supported tmux/Herdr under the same OS user and leave the process running. The connector never launches it. |
313
+ | Send says the target is ambiguous | Run a fresh `/akk list` and use the exact displayed selector for `/akk`, or the prefilled semantic ID from that row's current tool action. |
314
+ | Callback does not appear immediately | Pi may be busy, so the callback is queued as a follow-up. Wait for the current turn, then use fresh List and Status. After a Pi restart or branch change, the old callback route is intentionally not migrated. |
315
+ | Approval or cancellation says an interactive UI is required | Use Pi's interactive TUI. The POC deliberately blocks model-facing Approve/Cancel when `ctx.hasUI` is false. |
316
+ | Approval changed before confirmation | Refresh Status and review the newly observed prompt. Do not reuse an old approval offer or blindly retry an interrupted approval. |
317
+ | Callback socket/profile is unavailable | The owning Pi runtime may have stopped or its temporary private directory may have disappeared. Restart Pi to create a fresh route; recover existing work with List/Status rather than copying socket paths or tokens. |
318
+ | State-directory or Store permission error | Both override variables must be absolute and point to dedicated real directories. Stop Pi, inspect ownership and contents, then choose a new private directory if the existing path is unsafe or incompatible. |
319
+ | Updated connector still behaves like the old POC | Run `pi update npm:@scotthuang/agent-knock-knock-pi` and fully restart Pi. For a source checkout, re-run `npm ci` and the connector-specific build first. A running Extension is not hot-replaced. |
320
+ | Send result is uncertain | Do not automatically send the task again. Inspect Status, the exact pane, or the attached Watch; retrying terminal input could duplicate work. |
321
+
322
+ ## Upgrade and uninstall
323
+
324
+ Inspect and update the npm installation with Pi's package manager:
325
+
326
+ ```sh
327
+ pi list
328
+ pi update npm:@scotthuang/agent-knock-knock-pi
329
+ ```
330
+
331
+ Keep Pi at exactly `0.84.4` until this README declares another accepted
332
+ version. Do not use an unverified Pi upgrade as a connector update.
333
+
334
+ Remove the npm package by its package identity:
335
+
336
+ ```sh
337
+ pi remove npm:@scotthuang/agent-knock-knock-pi
338
+ ```
339
+
340
+ `pi uninstall` is an alias for `pi remove`. Removing the package does not stop
341
+ or delete Codex/Claude terminals, model credentials, `~/.pi/agent/akk`, or the
342
+ AKK Store. Those durable directories are retained for inspection/recovery and
343
+ should be reviewed separately before any manual deletion.
344
+
345
+ ## Development and verification
346
+
347
+ To load a source checkout for one Pi run, build the connector explicitly:
348
+
349
+ ```sh
350
+ AKK_REPO=/absolute/path/to/agent-knock-knock
351
+ cd "$AKK_REPO"
352
+ npm --prefix connectors/pi ci
353
+ npm run pi:build
354
+ pi -e "$AKK_REPO/connectors/pi"
355
+ ```
356
+
357
+ The equivalent child-package build is:
358
+
359
+ ```sh
360
+ cd "$AKK_REPO/connectors/pi"
361
+ npm ci
362
+ npm run build
363
+ ```
364
+
365
+ Do not run a bare root `npm run build` and assume it built this connector. The
366
+ unambiguous root command is `npm run pi:build`; inside `connectors/pi`, use
367
+ `npm run build`. `pi -e` is temporary and changes no package settings. To
368
+ persist a local source path, use `pi install "$AKK_REPO/connectors/pi"`; remove
369
+ that same absolute source with `pi remove` when finished.
370
+
371
+ From the repository root:
372
+
373
+ ```sh
374
+ npm run pi:typecheck
375
+ npm run pi:test:fast
376
+ npm run pi:pack:check
377
+ ```
378
+
379
+ Or from `connectors/pi`:
380
+
381
+ ```sh
382
+ npm run typecheck
383
+ npm run test:fast
384
+ npm run pack:check
385
+ ```
386
+
387
+ ## Release safety
388
+
389
+ `npm run release:check` is check-only. The shared connector gate proves the
390
+ generated Skill hash, package manifest/constants/lock/dependency parity, then
391
+ runs typecheck, fast tests, and inspection of the real package tarball. In
392
+ release mode it also requires a clean synchronized `main`, verifies that the
393
+ exact npm version and `pi-v<version>` repository tag are unused, and rejects
394
+ non-publishable runtime dependency specifiers.
395
+
396
+ Activation also performs a runtime compatibility gate. The pinned AKK
397
+ HostAdapter must expose capability handshake v1, whose catalog digest, ordered
398
+ tool names and derived count, and canonical Skill digest must match both this
399
+ package's generated Skill and the tools Pi just registered. Missing or forged
400
+ metadata, an unknown handshake version, or partial registration prevents the
401
+ connector from reporting `AKK ready`; no connector-local tool-count literal is
402
+ used.
403
+
404
+ The deterministic local form performs the same package checks without reading
405
+ registry or git-remote release state:
406
+
407
+ ```sh
408
+ npm run release:check -- --offline
409
+ ```
410
+
411
+ From the repository root, `npm run connectors:verify` checks Pi and DeepSeek
412
+ Harness independently; it does not require their package versions to match.
413
+ Publishing Pi additionally requires explicit version confirmation:
414
+
415
+ ```sh
416
+ npm run release:check -- --publish --confirm-version 0.1.0-poc.2
417
+ ```
418
+
419
+ Prereleases use npm tag `next`; stable versions use `latest`. Tags and GitHub
420
+ Releases use `pi-v<version>` and are created separately after npm verification.
421
+
422
+ The [PR #266](https://github.com/scotthuang/agent-knock-knock/pull/266)
423
+ acceptance record on 2026-08-30 included:
424
+
425
+ - root fast tests: 1,462/1,462 passed;
426
+ - connector fast tests: 23/23 passed;
427
+ - root and connector TypeScript typechecks, architecture/evidence validators,
428
+ and connector package dry-run passed;
429
+ - a real Claude Code 2.1.251 flow covering Send, approval callback, Pi native
430
+ approval, exact marker execution, completion callback, and delivered Status;
431
+ - a real Codex flow in a clean isolated environment covering native
432
+ `agent_accepted`, exact marker execution, Unix Socket callback into Pi, and
433
+ durable high-confidence delivered Status.
434
+
435
+ These are POC acceptance results, not a promise of compatibility with every
436
+ future Pi, Codex, Claude Code, tmux, or Herdr release. Version
437
+ `0.1.0-poc.2` is an npm prerelease and is distributed through the
438
+ `next` dist-tag; it does not change the AKK main package or ClawHub artifact.
439
+
440
+ ## Deliberate POC limits
441
+
442
+ The POC intentionally does not provide a standalone Supervisor, multi-Host
443
+ leader election, cross-session or cross-branch callback migration, remote
444
+ terminal access, Windows named pipes, configuration-driven auto-approval, or
445
+ coding-agent `--yolo` adaptation. It controls only the Codex and Claude Code
446
+ terminal surfaces already supported by AKK.
@@ -0,0 +1,16 @@
1
+ export type BackendRecoveryCommand = "renew" | "close" | "recover" | "retry-callback";
2
+ export declare function isBackendTaskWatchId(value: unknown): value is string;
3
+ export declare function normalizeBackendStatusTarget(params: Record<string, unknown>): Record<string, unknown>;
4
+ /** Backend maintenance is anchored to one persisted task, never the thread's current task. */
5
+ export declare function backendRecoveryTarget(params: Record<string, unknown>, command: BackendRecoveryCommand): string | undefined;
6
+ export declare function backendRecoveryToolArgs(command: BackendRecoveryCommand, params: Record<string, unknown>, context: {
7
+ sessionKey?: unknown;
8
+ }, options?: {
9
+ storeDir?: string;
10
+ codexHome?: string;
11
+ defaultMinutes?: number;
12
+ }): string[] | undefined;
13
+ /** Run before conversation routing, which must never reinterpret a backend recovery target. */
14
+ export declare function assertBackendRecoveryCliTarget(command: string | undefined, options: Record<string, unknown>): void;
15
+ /** Report observed delivery state without turning a retry attempt into a delivery receipt. */
16
+ export declare function formatBackendRecoveryCommandResult(result: unknown, command: BackendRecoveryCommand): string | undefined;
@@ -0,0 +1,113 @@
1
+ import { pushOptional, requiredControllerSessionKey, requiredString } from "./semantic-tool-arguments.js";
2
+ import { isRecord, nonBlankString } from "./value-guards.js";
3
+ const commands = new Set(["renew", "close", "recover", "retry-callback"]);
4
+ const backendIdentity = /^(?:desktop|codex-cli):/u;
5
+ const backendWatchPrefix = /^(?:desktop-watch|codex-cli-watch):/u;
6
+ const backendWatch = /^(?:desktop-watch|codex-cli-watch):[A-Za-z0-9_-]{8,128}$/u;
7
+ export function isBackendTaskWatchId(value) {
8
+ return typeof value === "string" && backendWatch.test(value);
9
+ }
10
+ export function normalizeBackendStatusTarget(params) {
11
+ if (typeof params.turn_id !== "string" || !backendWatchPrefix.test(params.turn_id.trim()))
12
+ return params;
13
+ if (Object.hasOwn(params, "watch_id") || Object.hasOwn(params, "conversation_id"))
14
+ throw new Error("status accepts exactly one of turn_id, conversation_id, or watch_id");
15
+ if (!backendWatch.test(params.turn_id))
16
+ throw new Error("status requires an exact backend Watch ID");
17
+ const { turn_id, ...rest } = params;
18
+ return { ...rest, watch_id: turn_id };
19
+ }
20
+ /** Backend maintenance is anchored to one persisted task, never the thread's current task. */
21
+ export function backendRecoveryTarget(params, command) {
22
+ const targets = ["watch_id", "turn_id", "conversation_id"].filter(key => Object.hasOwn(params, key));
23
+ if (targets.length !== 1)
24
+ throw new Error(`${command} accepts exactly one of watch_id, turn_id or conversation_id`);
25
+ const field = targets[0];
26
+ const id = requiredString(params[field], field);
27
+ if (backendIdentity.test(id.trim()) || field === "conversation_id" && backendWatchPrefix.test(id.trim())) {
28
+ throw new Error(`${command} requires the exact backend watch_id or send-produced turn_id; conversation_id cannot select a backend task`);
29
+ }
30
+ if (backendWatchPrefix.test(id.trim()) || field === "watch_id" || command === "recover") {
31
+ if (!backendWatch.test(id))
32
+ throw new Error(`${command} requires an exact backend Watch ID`);
33
+ return id;
34
+ }
35
+ return undefined;
36
+ }
37
+ export function backendRecoveryToolArgs(command, params, context, options = {}) {
38
+ const id = backendRecoveryTarget(params, command);
39
+ if (!id) {
40
+ if (Object.hasOwn(params, "notification_id"))
41
+ throw new Error("notification_id is supported only for backend callback recovery");
42
+ return undefined;
43
+ }
44
+ const fields = command === "renew" ? ["minutes"] : command === "close" ? ["reason"] : command === "retry-callback" ? ["notification_id"] : [];
45
+ const allowed = new Set(["watch_id", "turn_id", ...fields]);
46
+ const extra = Object.keys(params).filter(key => !allowed.has(key));
47
+ if (extra.length)
48
+ throw new Error(`Unsupported backend ${command} parameters: ${extra.join(", ")}`);
49
+ const args = [command, "--watch", id, "--openclaw-session", requiredControllerSessionKey(context.sessionKey)];
50
+ pushOptional(args, "--store-dir", options.storeDir);
51
+ pushOptional(args, "--codex-home", options.codexHome);
52
+ if (command === "renew") {
53
+ const minutes = params.minutes ?? options.defaultMinutes;
54
+ if (minutes !== undefined) {
55
+ if (typeof minutes !== "number" || !Number.isFinite(minutes) || minutes <= 0)
56
+ throw new Error("minutes must be a positive number");
57
+ args.push("--minutes", String(minutes));
58
+ }
59
+ }
60
+ if (Object.hasOwn(params, "reason"))
61
+ args.push("--reason", requiredString(params.reason, "reason"));
62
+ if (Object.hasOwn(params, "notification_id"))
63
+ args.push("--notification-id", requiredString(params.notification_id, "notification_id"));
64
+ return args;
65
+ }
66
+ /** Run before conversation routing, which must never reinterpret a backend recovery target. */
67
+ export function assertBackendRecoveryCliTarget(command, options) {
68
+ if (!command || !commands.has(command))
69
+ return;
70
+ const fields = ["watch", "turn", "conversation", "conversationId", "terminal", "session"];
71
+ const targets = fields.filter(key => Object.hasOwn(options, key));
72
+ const hasBackend = targets.some(key => typeof options[key] === "string" &&
73
+ (backendIdentity.test(options[key].trim()) || backendWatchPrefix.test(options[key].trim())));
74
+ if (command !== "recover" && !hasBackend && !Object.hasOwn(options, "watch")) {
75
+ if (Object.hasOwn(options, "notificationId"))
76
+ throw new Error("--notification-id is supported only for backend callback recovery");
77
+ return;
78
+ }
79
+ if (targets.length !== 1 || !["watch", "turn"].includes(targets[0]) || !backendWatch.test(String(options[targets[0]]))) {
80
+ throw new Error(`${command} requires exactly one --watch or --turn containing an exact backend Watch ID`);
81
+ }
82
+ requiredControllerSessionKey(options.openclawSession);
83
+ const fences = Object.keys(options).filter(key => /^expected/u.test(key));
84
+ if (fences.length)
85
+ throw new Error(`Backend ${command} does not accept terminal recovery fences: ${fences.join(", ")}`);
86
+ if (command !== "retry-callback" && Object.hasOwn(options, "notificationId")) {
87
+ throw new Error("--notification-id is supported only by retry-callback");
88
+ }
89
+ if (Object.hasOwn(options, "notificationId"))
90
+ requiredString(options.notificationId, "notification-id");
91
+ }
92
+ /** Report observed delivery state without turning a retry attempt into a delivery receipt. */
93
+ export function formatBackendRecoveryCommandResult(result, command) {
94
+ if (!isRecord(result) || !backendWatch.test(String(result.watch_id)))
95
+ return undefined;
96
+ const fields = ["watch_id", "turn_id", "task_kind", "native_turn_id", "status", "management_state", "observation_state", "closed_at", "unwatched_at", "hard_timeout_at", "deadline_at"];
97
+ const lines = fields.flatMap(field => {
98
+ const value = nonBlankString(result[field]);
99
+ return value ? [`${field}: ${value}`] : [];
100
+ });
101
+ if (Array.isArray(result.callback_notifications)) {
102
+ for (const notification of result.callback_notifications) {
103
+ if (!isRecord(notification))
104
+ continue;
105
+ const id = nonBlankString(notification.notification_id) ?? nonBlankString(notification.id);
106
+ const status = nonBlankString(notification.status);
107
+ if (id && status)
108
+ lines.push(`callback ${id}: ${status}`);
109
+ }
110
+ }
111
+ return [`AKK backend ${command}.`, ...lines].join("\n");
112
+ }
113
+ //# sourceMappingURL=backend-recovery-semantic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-recovery-semantic.js","sourceRoot":"","sources":["../../src/backend-recovery-semantic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC1G,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG7D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAClF,MAAM,eAAe,GAAG,0BAA0B,CAAC;AACnD,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAClE,MAAM,YAAY,GAAG,2DAA2D,CAAC;AAEjF,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,MAA+B;IAC1E,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAAE,OAAO,MAAM,CAAC;IACzG,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,MA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