@scotthuang/agent-knock-knock 0.13.2 → 0.13.4

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 (278) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +27 -6
  3. package/dist/src/callback-outbox-policy.js +27 -6
  4. package/dist/src/callback-outbox-policy.js.map +1 -1
  5. package/dist/src/callback-outbox-service.d.ts +4 -30
  6. package/dist/src/callback-outbox-service.js +21 -154
  7. package/dist/src/callback-outbox-service.js.map +1 -1
  8. package/dist/src/callback-outbox-settlement.js +13 -8
  9. package/dist/src/callback-outbox-settlement.js.map +1 -1
  10. package/dist/src/callback-route-service.d.ts +46 -0
  11. package/dist/src/callback-route-service.js +155 -0
  12. package/dist/src/callback-route-service.js.map +1 -0
  13. package/dist/src/claude-terminal-agent-adapter.js +4 -0
  14. package/dist/src/claude-terminal-agent-adapter.js.map +1 -1
  15. package/dist/src/cli-core.js +9 -1
  16. package/dist/src/cli-core.js.map +1 -1
  17. package/dist/src/codex-process-incarnation.d.ts +8 -0
  18. package/dist/src/codex-process-incarnation.js +36 -0
  19. package/dist/src/codex-process-incarnation.js.map +1 -0
  20. package/dist/src/codex-terminal-agent-adapter.js +4 -0
  21. package/dist/src/codex-terminal-agent-adapter.js.map +1 -1
  22. package/dist/src/deferred-foreground-conflict-policy.d.ts +22 -0
  23. package/dist/src/deferred-foreground-conflict-policy.js +52 -0
  24. package/dist/src/deferred-foreground-conflict-policy.js.map +1 -0
  25. package/dist/src/durable-notification-kernel.d.ts +94 -0
  26. package/dist/src/durable-notification-kernel.js +68 -0
  27. package/dist/src/durable-notification-kernel.js.map +1 -0
  28. package/dist/src/herdr-socket-transport.d.ts +43 -0
  29. package/dist/src/herdr-socket-transport.js +170 -0
  30. package/dist/src/herdr-socket-transport.js.map +1 -0
  31. package/dist/src/herdr-terminal-control-provider.d.ts +2 -45
  32. package/dist/src/herdr-terminal-control-provider.js +8 -173
  33. package/dist/src/herdr-terminal-control-provider.js.map +1 -1
  34. package/dist/src/host-adapter-capabilities.d.ts +35 -0
  35. package/dist/src/host-adapter-capabilities.js +146 -0
  36. package/dist/src/host-adapter-capabilities.js.map +1 -0
  37. package/dist/src/host-adapter.d.ts +9 -3
  38. package/dist/src/host-adapter.js +33 -9
  39. package/dist/src/host-adapter.js.map +1 -1
  40. package/dist/src/host-bridge-tools.d.ts +3 -4
  41. package/dist/src/host-bridge-tools.js +49 -92
  42. package/dist/src/host-bridge-tools.js.map +1 -1
  43. package/dist/src/host-bridge.js +5 -5
  44. package/dist/src/host-bridge.js.map +1 -1
  45. package/dist/src/host-monitor-reconciliation.d.ts +6 -0
  46. package/dist/src/host-monitor-reconciliation.js +96 -0
  47. package/dist/src/host-monitor-reconciliation.js.map +1 -0
  48. package/dist/src/managed-session.js +2 -18
  49. package/dist/src/managed-session.js.map +1 -1
  50. package/dist/src/native-thread-lifecycle-cli-adapter.d.ts +13 -0
  51. package/dist/src/native-thread-lifecycle-cli-adapter.js +635 -3
  52. package/dist/src/native-thread-lifecycle-cli-adapter.js.map +1 -1
  53. package/dist/src/openclaw-list-projection.d.ts +2 -0
  54. package/dist/src/openclaw-list-projection.js +3 -0
  55. package/dist/src/openclaw-list-projection.js.map +1 -0
  56. package/dist/src/openclaw-model-facing-field-policy.d.ts +2 -0
  57. package/dist/src/openclaw-model-facing-field-policy.js +3 -0
  58. package/dist/src/openclaw-model-facing-field-policy.js.map +1 -0
  59. package/dist/src/openclaw-plugin-command-adapter.d.ts +6 -29
  60. package/dist/src/openclaw-plugin-command-adapter.js +7 -2370
  61. package/dist/src/openclaw-plugin-command-adapter.js.map +1 -1
  62. package/dist/src/openclaw-plugin-helpers.d.ts +2 -121
  63. package/dist/src/openclaw-plugin-helpers.js +2 -1164
  64. package/dist/src/openclaw-plugin-helpers.js.map +1 -1
  65. package/dist/src/openclaw-plugin-schemas.d.ts +2 -510
  66. package/dist/src/openclaw-plugin-schemas.js +2 -519
  67. package/dist/src/openclaw-plugin-schemas.js.map +1 -1
  68. package/dist/src/openclaw-plugin-supervisor.d.ts +4 -5
  69. package/dist/src/openclaw-plugin-supervisor.js +5 -94
  70. package/dist/src/openclaw-plugin-supervisor.js.map +1 -1
  71. package/dist/src/openclaw-plugin-value-helpers.d.ts +2 -0
  72. package/dist/src/openclaw-plugin-value-helpers.js +3 -0
  73. package/dist/src/openclaw-plugin-value-helpers.js.map +1 -0
  74. package/dist/src/openclaw-private-authority-offers.d.ts +4 -39
  75. package/dist/src/openclaw-private-authority-offers.js +3 -258
  76. package/dist/src/openclaw-private-authority-offers.js.map +1 -1
  77. package/dist/src/semantic-private-authority-offers.d.ts +41 -0
  78. package/dist/src/semantic-private-authority-offers.js +261 -0
  79. package/dist/src/semantic-private-authority-offers.js.map +1 -0
  80. package/dist/src/semantic-tool-arguments.d.ts +9 -0
  81. package/dist/src/semantic-tool-arguments.js +64 -0
  82. package/dist/src/semantic-tool-arguments.js.map +1 -0
  83. package/dist/src/semantic-tool-catalog.d.ts +48 -0
  84. package/dist/src/semantic-tool-catalog.js +105 -0
  85. package/dist/src/semantic-tool-catalog.js.map +1 -0
  86. package/dist/src/semantic-tool-command-helpers.d.ts +145 -0
  87. package/dist/src/semantic-tool-command-helpers.js +1272 -0
  88. package/dist/src/semantic-tool-command-helpers.js.map +1 -0
  89. package/dist/src/semantic-tool-list-projection.d.ts +10 -0
  90. package/dist/src/semantic-tool-list-projection.js +497 -0
  91. package/dist/src/semantic-tool-list-projection.js.map +1 -0
  92. package/dist/src/semantic-tool-model-facing-field-policy.d.ts +3 -0
  93. package/dist/src/semantic-tool-model-facing-field-policy.js +66 -0
  94. package/dist/src/semantic-tool-model-facing-field-policy.js.map +1 -0
  95. package/dist/src/semantic-tool-presentation.d.ts +37 -0
  96. package/dist/src/semantic-tool-presentation.js +680 -0
  97. package/dist/src/semantic-tool-presentation.js.map +1 -0
  98. package/dist/src/semantic-tool-private-authority.d.ts +39 -0
  99. package/dist/src/semantic-tool-private-authority.js +602 -0
  100. package/dist/src/semantic-tool-private-authority.js.map +1 -0
  101. package/dist/src/semantic-tool-relay.d.ts +16 -0
  102. package/dist/src/semantic-tool-relay.js +175 -0
  103. package/dist/src/semantic-tool-relay.js.map +1 -0
  104. package/dist/src/semantic-tool-runtime.d.ts +10 -0
  105. package/dist/src/semantic-tool-runtime.js +1157 -0
  106. package/dist/src/semantic-tool-runtime.js.map +1 -0
  107. package/dist/src/semantic-tool-schemas.d.ts +563 -0
  108. package/dist/src/semantic-tool-schemas.js +573 -0
  109. package/dist/src/semantic-tool-schemas.js.map +1 -0
  110. package/dist/src/semantic-tool-value-helpers.d.ts +5 -0
  111. package/dist/src/semantic-tool-value-helpers.js +27 -0
  112. package/dist/src/semantic-tool-value-helpers.js.map +1 -0
  113. package/dist/src/store-event-presentation.d.ts +17 -0
  114. package/dist/src/store-event-presentation.js +33 -0
  115. package/dist/src/store-event-presentation.js.map +1 -0
  116. package/dist/src/store.d.ts +3 -16
  117. package/dist/src/store.js +2 -30
  118. package/dist/src/store.js.map +1 -1
  119. package/dist/src/terminal-action-projection.d.ts +3 -17
  120. package/dist/src/terminal-action-projection.js +13 -41
  121. package/dist/src/terminal-action-projection.js.map +1 -1
  122. package/dist/src/terminal-agent-adapter.d.ts +7 -0
  123. package/dist/src/terminal-agent-adapter.js +8 -0
  124. package/dist/src/terminal-agent-adapter.js.map +1 -1
  125. package/dist/src/terminal-agent-bridge.d.ts +35 -332
  126. package/dist/src/terminal-agent-bridge.js +293 -2798
  127. package/dist/src/terminal-agent-bridge.js.map +1 -1
  128. package/dist/src/terminal-approval-cli-adapter.d.ts +17 -0
  129. package/dist/src/terminal-approval-cli-adapter.js +921 -0
  130. package/dist/src/terminal-approval-cli-adapter.js.map +1 -0
  131. package/dist/src/terminal-command-cli-adapter.d.ts +2 -429
  132. package/dist/src/terminal-command-cli-adapter.js +344 -6061
  133. package/dist/src/terminal-command-cli-adapter.js.map +1 -1
  134. package/dist/src/terminal-command-cli-ports.d.ts +443 -0
  135. package/dist/src/terminal-command-cli-ports.js +2 -0
  136. package/dist/src/terminal-command-cli-ports.js.map +1 -0
  137. package/dist/src/terminal-command-dispatch-preparation.d.ts +81 -0
  138. package/dist/src/terminal-command-dispatch-preparation.js +209 -0
  139. package/dist/src/terminal-command-dispatch-preparation.js.map +1 -0
  140. package/dist/src/terminal-command-dispatch-transport.d.ts +35 -0
  141. package/dist/src/terminal-command-dispatch-transport.js +859 -0
  142. package/dist/src/terminal-command-dispatch-transport.js.map +1 -0
  143. package/dist/src/terminal-command-foreground-proof.d.ts +32 -0
  144. package/dist/src/terminal-command-foreground-proof.js +72 -0
  145. package/dist/src/terminal-command-foreground-proof.js.map +1 -0
  146. package/dist/src/terminal-command-send-preflight.d.ts +41 -0
  147. package/dist/src/terminal-command-send-preflight.js +86 -0
  148. package/dist/src/terminal-command-send-preflight.js.map +1 -0
  149. package/dist/src/terminal-composer-classifier.d.ts +55 -0
  150. package/dist/src/terminal-composer-classifier.js +638 -0
  151. package/dist/src/terminal-composer-classifier.js.map +1 -0
  152. package/dist/src/terminal-control-ref.d.ts +23 -0
  153. package/dist/src/terminal-control-ref.js +32 -0
  154. package/dist/src/terminal-control-ref.js.map +1 -1
  155. package/dist/src/terminal-dispatch-recovery-authority.d.ts +56 -0
  156. package/dist/src/terminal-dispatch-recovery-authority.js +251 -0
  157. package/dist/src/terminal-dispatch-recovery-authority.js.map +1 -0
  158. package/dist/src/terminal-dispatch-recovery-cli-adapter.d.ts +1 -9
  159. package/dist/src/terminal-dispatch-recovery-cli-adapter.js +5 -240
  160. package/dist/src/terminal-dispatch-recovery-cli-adapter.js.map +1 -1
  161. package/dist/src/terminal-handoff-cli-adapter.d.ts +1 -11
  162. package/dist/src/terminal-handoff-cli-adapter.js +2 -39
  163. package/dist/src/terminal-handoff-cli-adapter.js.map +1 -1
  164. package/dist/src/terminal-human-explicit-send-cli-adapter.d.ts +25 -0
  165. package/dist/src/terminal-human-explicit-send-cli-adapter.js +903 -0
  166. package/dist/src/terminal-human-explicit-send-cli-adapter.js.map +1 -0
  167. package/dist/src/terminal-identity-authority-cli-adapter.d.ts +1 -6
  168. package/dist/src/terminal-identity-authority-cli-adapter.js +3 -33
  169. package/dist/src/terminal-identity-authority-cli-adapter.js.map +1 -1
  170. package/dist/src/terminal-interaction-cli-adapter.js +209 -210
  171. package/dist/src/terminal-interaction-cli-adapter.js.map +1 -1
  172. package/dist/src/terminal-interaction-core.d.ts +0 -2
  173. package/dist/src/terminal-interaction-core.js +4 -3
  174. package/dist/src/terminal-interaction-core.js.map +1 -1
  175. package/dist/src/terminal-interaction-protocol.d.ts +21 -0
  176. package/dist/src/terminal-interaction-protocol.js +74 -0
  177. package/dist/src/terminal-interaction-protocol.js.map +1 -1
  178. package/dist/src/terminal-interaction-response-bridge.d.ts +126 -0
  179. package/dist/src/terminal-interaction-response-bridge.js +579 -0
  180. package/dist/src/terminal-interaction-response-bridge.js.map +1 -0
  181. package/dist/src/terminal-interaction-response-transaction.d.ts +44 -0
  182. package/dist/src/terminal-interaction-response-transaction.js +56 -0
  183. package/dist/src/terminal-interaction-response-transaction.js.map +1 -0
  184. package/dist/src/terminal-list-action-policy.d.ts +43 -0
  185. package/dist/src/terminal-list-action-policy.js +164 -0
  186. package/dist/src/terminal-list-action-policy.js.map +1 -0
  187. package/dist/src/terminal-list-cli-adapter.d.ts +6 -36
  188. package/dist/src/terminal-list-cli-adapter.js +314 -1711
  189. package/dist/src/terminal-list-cli-adapter.js.map +1 -1
  190. package/dist/src/terminal-list-facts.d.ts +129 -0
  191. package/dist/src/terminal-list-facts.js +179 -0
  192. package/dist/src/terminal-list-facts.js.map +1 -0
  193. package/dist/src/terminal-list-inventory.d.ts +59 -0
  194. package/dist/src/terminal-list-inventory.js +194 -0
  195. package/dist/src/terminal-list-inventory.js.map +1 -0
  196. package/dist/src/terminal-list-ownership-service.d.ts +118 -0
  197. package/dist/src/terminal-list-ownership-service.js +1003 -0
  198. package/dist/src/terminal-list-ownership-service.js.map +1 -0
  199. package/dist/src/terminal-list-projection-service.d.ts +49 -0
  200. package/dist/src/terminal-list-projection-service.js +407 -0
  201. package/dist/src/terminal-list-projection-service.js.map +1 -0
  202. package/dist/src/terminal-list-renderer.d.ts +12 -11
  203. package/dist/src/terminal-list-renderer.js +237 -104
  204. package/dist/src/terminal-list-renderer.js.map +1 -1
  205. package/dist/src/terminal-managed-send-cli-adapter.d.ts +33 -0
  206. package/dist/src/terminal-managed-send-cli-adapter.js +994 -0
  207. package/dist/src/terminal-managed-send-cli-adapter.js.map +1 -0
  208. package/dist/src/terminal-managed-turn-list-action-policy.d.ts +47 -0
  209. package/dist/src/terminal-managed-turn-list-action-policy.js +64 -0
  210. package/dist/src/terminal-managed-turn-list-action-policy.js.map +1 -0
  211. package/dist/src/terminal-model-control-action-policy.d.ts +60 -0
  212. package/dist/src/terminal-model-control-action-policy.js +96 -0
  213. package/dist/src/terminal-model-control-action-policy.js.map +1 -0
  214. package/dist/src/terminal-model-control-availability.d.ts +68 -0
  215. package/dist/src/terminal-model-control-availability.js +157 -0
  216. package/dist/src/terminal-model-control-availability.js.map +1 -0
  217. package/dist/src/terminal-model-control-bridge.d.ts +48 -0
  218. package/dist/src/terminal-model-control-bridge.js +259 -0
  219. package/dist/src/terminal-model-control-bridge.js.map +1 -0
  220. package/dist/src/terminal-model-control-profile.d.ts +55 -0
  221. package/dist/src/terminal-model-control-profile.js +137 -0
  222. package/dist/src/terminal-model-control-profile.js.map +1 -0
  223. package/dist/src/terminal-model-control-subject.d.ts +34 -0
  224. package/dist/src/terminal-model-control-subject.js +58 -0
  225. package/dist/src/terminal-model-control-subject.js.map +1 -0
  226. package/dist/src/terminal-model-control-transaction.d.ts +19 -0
  227. package/dist/src/terminal-model-control-transaction.js +39 -0
  228. package/dist/src/terminal-model-control-transaction.js.map +1 -0
  229. package/dist/src/terminal-model-control.d.ts +331 -0
  230. package/dist/src/terminal-model-control.js +1686 -0
  231. package/dist/src/terminal-model-control.js.map +1 -0
  232. package/dist/src/terminal-monitor-application-service.js +50 -17
  233. package/dist/src/terminal-monitor-application-service.js.map +1 -1
  234. package/dist/src/terminal-native-inspection-bridge.d.ts +211 -0
  235. package/dist/src/terminal-native-inspection-bridge.js +1127 -0
  236. package/dist/src/terminal-native-inspection-bridge.js.map +1 -0
  237. package/dist/src/terminal-runtime-cli-adapter.d.ts +2 -0
  238. package/dist/src/terminal-runtime-cli-adapter.js +59 -17
  239. package/dist/src/terminal-runtime-cli-adapter.js.map +1 -1
  240. package/dist/src/terminal-submission-retry-application.d.ts +24 -0
  241. package/dist/src/terminal-submission-retry-application.js +402 -0
  242. package/dist/src/terminal-submission-retry-application.js.map +1 -0
  243. package/dist/src/terminal-submission-retry-ports.d.ts +30 -0
  244. package/dist/src/terminal-submission-retry-ports.js +2 -0
  245. package/dist/src/terminal-submission-retry-ports.js.map +1 -0
  246. package/dist/src/terminal-submission-retry-reconciliation.d.ts +236 -0
  247. package/dist/src/terminal-submission-retry-reconciliation.js +1130 -0
  248. package/dist/src/terminal-submission-retry-reconciliation.js.map +1 -0
  249. package/dist/src/terminal-submission-retry-transport.d.ts +58 -0
  250. package/dist/src/terminal-submission-retry-transport.js +675 -0
  251. package/dist/src/terminal-submission-retry-transport.js.map +1 -0
  252. package/dist/src/terminal-text-submission-bridge.d.ts +200 -0
  253. package/dist/src/terminal-text-submission-bridge.js +632 -0
  254. package/dist/src/terminal-text-submission-bridge.js.map +1 -0
  255. package/dist/src/terminal-user-explicit-send-policy.d.ts +29 -0
  256. package/dist/src/terminal-user-explicit-send-policy.js +46 -0
  257. package/dist/src/terminal-user-explicit-send-policy.js.map +1 -0
  258. package/dist/src/terminal-watch-cli-adapter.js +91 -143
  259. package/dist/src/terminal-watch-cli-adapter.js.map +1 -1
  260. package/dist/src/terminal-watch-codec.d.ts +9 -0
  261. package/dist/src/terminal-watch-codec.js +1051 -0
  262. package/dist/src/terminal-watch-codec.js.map +1 -0
  263. package/dist/src/terminal-watch-interaction-response-store.d.ts +19 -0
  264. package/dist/src/terminal-watch-interaction-response-store.js +87 -0
  265. package/dist/src/terminal-watch-interaction-response-store.js.map +1 -0
  266. package/dist/src/terminal-watch-record.d.ts +319 -0
  267. package/dist/src/terminal-watch-record.js +742 -0
  268. package/dist/src/terminal-watch-record.js.map +1 -0
  269. package/dist/src/terminal-watch-service.js +48 -27
  270. package/dist/src/terminal-watch-service.js.map +1 -1
  271. package/dist/src/terminal-watch-store.d.ts +3 -279
  272. package/dist/src/terminal-watch-store.js +5 -1779
  273. package/dist/src/terminal-watch-store.js.map +1 -1
  274. package/docs/quickstart-herdr.md +1 -1
  275. package/docs/quickstart-tmux.md +27 -2
  276. package/openclaw.plugin.json +13 -1
  277. package/package.json +7 -2
  278. package/templates/openclaw-skills/agent-knock-knock/SKILL.md +54 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.4 - 2026-09-15
4
+
5
+ ### Changed
6
+
7
+ - Make typed model control use one shared source of truth for native profile support, terminal subject normalization, input-owning surface classification, action availability, private authority, and transaction phase. List and execution now make the same fail-closed decision for ordinary, residual-continuation, and repair flows.
8
+ - Run managed Monitor and Terminal Watch questionnaire responses through the same reservation, live-revalidation, dispatch, settlement, and `response_uncertain` transaction semantics while preserving their distinct ownership and task-completion models.
9
+ - Keep OpenClaw, Pi, and DeepSeek Harness integrations aligned through one Host-neutral 22-tool semantic catalog, one canonical bundled Skill, a versioned capability handshake, and shared connector package verification.
10
+ - Restructure terminal discovery into immutable facts, centralized action policy, and compact public projection. Split terminal Send, approval, retry, native inspection, model control, Watch storage, callback routing, and Herdr transport into focused modules behind compatibility facades.
11
+ - Add typed model-control UI goldens, an in-process List-to-catalog-to-set-model contract, architecture-health ratchets, focused contract suites, and separate current-architecture and historical design records.
12
+
13
+ ### Security
14
+
15
+ - Preserve exact pane, process-birth, cwd, agent, version, mutation-lock, and durable pre-input reservation checks across the new module boundaries. Private authority remains isolated, historical Store formats remain readable, and any possible input with an unproven postcondition remains non-retryable.
16
+
17
+ ## 0.13.3 - 2026-09-14
18
+
19
+ ### Added
20
+
21
+ - Add typed, catalog-bound model control for supported idle Codex and Claude Code panes. Callers can inspect native model/reasoning choices, select only an advertised semantic tuple, and receive separate effective-current-session and future-session-default postconditions without exposing raw slash commands, keys, menu indexes, or private authority.
22
+ - Add a narrowly scoped Codex model-control repair action for an exactly recognized stale `/model` completion surface, bare Composer command, or native picker. The cleanup action never selects a model or submits work and must prove the main Composer empty before returning success.
23
+
24
+ ### Changed
25
+
26
+ - Replace the structured List response's repeated action contract and verbose diagnostics with a compact terminal-first projection shared by OpenClaw, Pi, and DeepSeek Harness. It retains live resource identities, current state, action names, and dynamic semantic inputs; static action meanings and safety rules live in the bundled `agent-knock-knock` skill.
27
+ - Bundle that same canonical skill with the OpenClaw plugin and export one Host-neutral List projection contract so native controller connectors do not maintain separate field-pruning logic.
28
+
29
+ ### Fixed
30
+
31
+ - Let exact, idle Codex `0.154.0` zero-rollout panes discover and change native model settings without first fabricating a Session identity, while preserving exact pane/process/cwd, empty-Composer, interaction, active-Turn, and postcondition checks.
32
+ - Recognize the standard and narrow Codex `Select Model and Effort` picker, including the nested `More reasoning…` flow, as a model-control surface instead of generic busy activity. List no longer advertises ordinary idle mutations while that picker owns input.
33
+ - Normalize terminal/process incarnation authority across List and typed model-control execution, preserve a safe continuation action for exact residual `/model` state, and keep uncertain input outcomes non-retryable.
34
+
35
+ ### Security
36
+
37
+ - Revalidate the exact terminal, process birth, screen generation, native catalog, Composer/input-owning surface, and current action offer under one mutation lock. Approval, questionnaire, editor, viewer, active Turn, unknown content, and identity drift remain zero-input failures; any post-input uncertainty remains `do_not_retry`.
38
+
3
39
  ## 0.13.2 - 2026-09-12
4
40
 
5
41
  ### Added
package/README.md CHANGED
@@ -52,18 +52,19 @@ pi install npm:@scotthuang/agent-knock-knock-pi@next
52
52
  pi
53
53
  ```
54
54
 
55
- Pi should show `AKK ready`. With Codex or Claude Code already running in tmux or Herdr, enter `/akk list`. The connector provides `/akk`, 16 structured tools, callbacks to the initiating Pi session, and native approval dialogs. See the [Pi connector guide](connectors/pi/README.md).
55
+ Pi should show `AKK ready`. With Codex or Claude Code already running in tmux or Herdr, enter `/akk list`. The connector provides `/akk`, the complete capability-handshake-verified semantic tool catalog, the bundled `agent-knock-knock` skill, callbacks to the initiating Pi session, and native approval dialogs. See the [Pi connector guide](connectors/pi/README.md).
56
56
 
57
57
  ## Install for DeepSeek Harness
58
58
 
59
- The connector supports DeepSeek Harness Web `0.1.1-rc.2` and `0.1.2-alpha.1`:
59
+ The connector supports DeepSeek Harness Web `0.1.1-rc.2`, `0.1.2-alpha.1`, and
60
+ `0.1.5-rc.2`:
60
61
 
61
62
  ```bash
62
63
  dsh plugin --profile web add @scotthuang/agent-knock-knock-deepseek-harness@next
63
64
  dsh web
64
65
  ```
65
66
 
66
- Open a Web conversation and enter `/akk list`. The connector gives every conversation `/akk`, the same 16 structured tools, and callbacks to the exact Harness Agent that initiated the work. See the [DeepSeek Harness connector guide](connectors/deepseek-harness/README.md).
67
+ Open a Web conversation and enter `/akk list`. The connector gives every conversation `/akk`, the same capability-handshake-verified semantic tool catalog, the bundled `agent-knock-knock` skill, and callbacks to the exact Harness Agent that initiated the work. See the [DeepSeek Harness connector guide](connectors/deepseek-harness/README.md).
67
68
 
68
69
  ## See It in Action
69
70
 
@@ -78,6 +79,8 @@ Suppose several Codex or Claude Code jobs are already running in tmux or Herdr:
78
79
  - **Watch without babysitting.** `/akk watch <terminal>` observes work already in progress and sends a callback when it finishes, needs approval, or becomes blocked. You can leave the terminal and continue from your phone or another chat client.
79
80
  - **Send without typing in a tiny remote console.** `/akk <selector>: <message>` sends your natural-language instruction to the selected live coding-agent terminal. An explicit user Send has priority over stale AKK management state.
80
81
  - **Identify an ambiguous Codex foreground explicitly.** When several rollout files or a recent `/clear` prevent durable attribution, an advertised foreground-identification action can inspect one exact idle pane without guessing which rollout is current.
82
+ - **Switch models through the native catalog.** `/akk models <exact-terminal-id>` lists the choices currently offered by one exact physical Codex or Claude Code pane; a Codex rollout/native-thread attribution is not required, so this also works before the first rollout materializes. `/akk set-model ...` consumes one exact advertised model/reasoning-effort tuple without accepting raw slash commands, keys, or menu indexes. Codex synchronizes the model and ordinary efforts through `max` to the current and future-session defaults; its `ultra` effort is current-session-only, and the native UI does not expose the exact non-Ultra effort chosen for future sessions, so AKK omits that unobservable field. Claude Code changes only the current session.
83
+ - **Continue or clear only a proven model-control residue.** If a failed Codex 0.154 model-control attempt leaves an exact `/model` completion surface or bare `/model` Composer, a fresh List may advertise both `/akk models <exact-terminal-id>` and `/akk repair-model-control <exact-terminal-id>`. Models uses a separate residual-bound authority to continue that exact native slash command into read-only catalog discovery without retyping it. If the exact native picker is already open, List marks the pane non-idle and advertises repair only. Repair remains the cleanup-only escape hatch, never presses Enter, and must prove an empty Composer.
81
84
  - **Inspect and recover.** `/akk status <turn-or-watch>` shows current state when a callback is delayed. Durable callback records and Watches provide a recovery path after transient Host failures.
82
85
  - **Approve deliberately.** AKK can surface Codex or Claude Code permission requests and submit an explicit human decision. It preserves the coding agent's existing permission mode.
83
86
  - **Hand control back and forth.** Attach to the same tmux or Herdr pane whenever you want. AKK does not create a parallel hidden conversation.
@@ -87,11 +90,22 @@ The common workflow is:
87
90
  ```text
88
91
  /akk list
89
92
  /akk watch <exact-terminal-id>
93
+ /akk models <exact-terminal-id>
94
+ /akk set-model <exact-terminal-id> <advertised-model-id> <advertised-reasoning-effort>
90
95
  /akk codex: run the tests and explain any failures
91
96
  /akk status <turn-id-or-watch-id>
92
97
  ```
93
98
 
94
- Use identifiers and actions from a fresh `/akk list`; do not guess or cache terminal IDs.
99
+ If List advertises `repair-model-control`, it is an alternative cleanup flow:
100
+
101
+ ```text
102
+ /akk repair-model-control <exact-terminal-id>
103
+ /akk list
104
+ /akk models <exact-terminal-id>
105
+ /akk set-model <exact-terminal-id> <advertised-model-id> <advertised-reasoning-effort>
106
+ ```
107
+
108
+ Use identifiers and actions from a fresh `/akk list`; do not guess or cache terminal IDs. Model switching is fail-closed: the same exact physical pane/process must still be free of an active Turn or any input-owning approval, questionnaire/editor, or read-only viewer, and must show either an exact idle empty Composer or one stable profiled Codex 0.154 `/model` residual. A Codex 0.154 zero-rollout pane does not require `identify_foreground` or a resolved native rollout identity; Claude Code still requires its exact current native Session. When List advertises both actions for a Composer residual, `model_options` may continue it into the catalog while `repair_model_control` only clears it. An open exact picker is non-idle and exposes repair only. If continuation, repair, or model switching reports `uncertain`, inspect the pane instead of retrying automatically.
95
109
 
96
110
  ## How It Works
97
111
 
@@ -109,6 +123,13 @@ OpenClaw / Pi / DeepSeek Harness
109
123
 
110
124
  For a managed Send, AKK verifies the selected terminal and coding-agent process, writes one user request, monitors that exact Turn, and returns completion or attention callbacks to the initiating Host session. If stale AKK bookkeeping blocks an explicit Codex Send before terminal input, AKK can fall back to a verified one-time physical Send and attach a read-only Watch for callback and Status recovery.
111
125
 
126
+ Native Pi and DeepSeek Harness connectors accept the shared catalog through a
127
+ versioned, secretless Host Adapter capability handshake. Startup verifies the
128
+ ordered semantic tool registration and the bundled Skill against catalog and
129
+ Skill SHA-256 digests; an older, missing, or drifted handshake fails closed
130
+ instead of mounting a partial tool surface. Connector package versions remain
131
+ independent of one another.
132
+
112
133
  In the current OpenClaw plugin and core Host Adapter, an idle Codex pane with ambiguous foreground rollout identity may advertise `identify_foreground`. That action issues one closed `/status` command to the exact pane. It does not mutate the AKK Store, but it does type into the visible terminal. Its 30-second result is diagnostic only and grants no later authority. The separate `identify_and_send` action keeps one terminal lock across the probe and one requested task, then relies on exact request acceptance—not the status card—for durable Session and Turn identity. Ordinary Send, List, and Status never run this probe.
113
134
 
114
135
  AKK is local-first: there is no hosted control plane or telemetry. It stores only the local state needed for routing, lifecycle recovery, callback delivery, and idempotency.
@@ -121,7 +142,7 @@ AKK is local-first: there is no hosted control plane or telemetry. It stores onl
121
142
  | Coding agents | Codex and Claude Code; unknown complete versions are allowed with a compatibility warning and fail naturally if behavior changed |
122
143
  | OpenClaw | `2026.6.5`+; plugin API and Gateway `2026.5.12`+ |
123
144
  | Pi connector | Pi `0.84.4` |
124
- | DeepSeek Harness connector | `0.1.1-rc.2` and `0.1.2-alpha.1` |
145
+ | DeepSeek Harness connector | `0.1.1-rc.2`, `0.1.2-alpha.1`, and `0.1.5-rc.2` |
125
146
  | Runtime | Node.js `22.19.0`+ on macOS or Linux |
126
147
 
127
148
  The adjacent OpenClaw boundary `2026.5.10-beta.2` is intentionally unsupported. Herdr support is exact-version because its local control protocol is not yet a stable public API. See each connector guide for its tested release status and limitations.
@@ -134,7 +155,7 @@ Choose the guide that matches what you are trying to do:
134
155
  | --- | --- |
135
156
  | [tmux quick start](docs/quickstart-tmux.md) | First OpenClaw task, multiple panes, and selectors |
136
157
  | [Herdr quick start](docs/quickstart-herdr.md) | Local Herdr discovery and exact-version checks |
137
- | [Pi connector](connectors/pi/README.md) | Pi installation, 16 tools, native approval, callbacks, upgrade, and uninstall |
158
+ | [Pi connector](connectors/pi/README.md) | Pi installation, semantic tool catalog, bundled skill, native approval, callbacks, upgrade, and uninstall |
138
159
  | [DeepSeek Harness connector](connectors/deepseek-harness/README.md) | Harness installation, approval contract, callbacks, upgrade, and troubleshooting |
139
160
  | [Operator guide](docs/operator-guide.md) | Complete command reference, reliable Send, Watch, Status, approval, recovery, Sessions, and native threads |
140
161
  | [OpenClaw operations](docs/openclaw-operations.md) | npm alternative, configuration, auto-approval policy, supervisor behavior, and troubleshooting |
@@ -1,6 +1,7 @@
1
1
  import { nonBlankString as stringValue, recordValue } from "./value-guards.js";
2
2
  import { turnIdForConversation } from "./protocol.js";
3
3
  import { parseCallbackAttemptOutcome } from "./callback-transport.js";
4
+ import { decideDurableNotificationRetry } from "./durable-notification-kernel.js";
4
5
  /**
5
6
  * Fence an advisory outbox when its underlying Turn moves on. Accepted
6
7
  * transport evidence is retained for settlement; only unaccepted work is
@@ -219,13 +220,17 @@ export function beginCallbackRetryPolicy(callbackDelivery, limits) {
219
220
  reason: "callback outbox has invalid attempt metadata"
220
221
  });
221
222
  }
222
- if (attemptValue > limits.retryDelayCount) {
223
+ if (decideDurableNotificationRetry({
224
+ phase: "ready",
225
+ attempt,
226
+ maxAttempts: limits.retryDelayCount
227
+ }).state === "exhausted") {
223
228
  return decided({ state: "exhausted", attempt });
224
229
  }
225
230
  if (delivery.status === "failed") {
226
231
  return transportStartedWithoutOutcome
227
232
  ? uncertainTransportStart(attempt)
228
- : decided({ state: "retryable", attempt });
233
+ : decided(retryableCallbackDisposition(attempt));
229
234
  }
230
235
  const attemptPidValue = Number(delivery.attempt_pid);
231
236
  const attemptPid = Number.isSafeInteger(attemptPidValue) && attemptPidValue > 0
@@ -234,7 +239,7 @@ export function beginCallbackRetryPolicy(callbackDelivery, limits) {
234
239
  if (attemptPid === undefined) {
235
240
  return transportStartedWithoutOutcome
236
241
  ? uncertainTransportStart(attempt)
237
- : decided({ state: "retryable", attempt });
242
+ : decided(retryableCallbackDisposition(attempt));
238
243
  }
239
244
  const persistedLeaseExpiresAt = stringValue(delivery.attempt_lease_expires_at);
240
245
  const leaseExpiresAtMs = validTimestampMs(persistedLeaseExpiresAt);
@@ -270,7 +275,7 @@ export function reduceCallbackRetryPolicy(state, observation) {
270
275
  if (!observation.alive || state.effective_lease_expires_at_ms === undefined) {
271
276
  return state.transport_started_without_outcome
272
277
  ? uncertainTransportStart(state.attempt)
273
- : decided({ state: "retryable", attempt: state.attempt });
278
+ : decided(retryableCallbackDisposition(state.attempt));
274
279
  }
275
280
  return {
276
281
  phase: "observe_clock",
@@ -287,7 +292,13 @@ export function reduceCallbackRetryPolicy(state, observation) {
287
292
  if (observation.kind !== "clock") {
288
293
  throw new Error("callback retry policy requires a clock observation");
289
294
  }
290
- if (state.effective_lease_expires_at_ms > observation.now_ms) {
295
+ const leaseDecision = decideDurableNotificationRetry({
296
+ phase: "leased",
297
+ attempt: state.attempt,
298
+ nowMs: observation.now_ms,
299
+ leaseExpiresAt: new Date(state.effective_lease_expires_at_ms).toISOString()
300
+ });
301
+ if (leaseDecision.state === "in_flight") {
291
302
  return decided({
292
303
  state: "in_flight",
293
304
  attempt: state.attempt,
@@ -299,7 +310,17 @@ export function reduceCallbackRetryPolicy(state, observation) {
299
310
  }
300
311
  return state.transport_started_without_outcome
301
312
  ? uncertainTransportStart(state.attempt)
302
- : decided({ state: "retryable", attempt: state.attempt });
313
+ : decided(retryableCallbackDisposition(state.attempt));
314
+ }
315
+ function retryableCallbackDisposition(attempt) {
316
+ const decision = decideDurableNotificationRetry({
317
+ phase: "ready",
318
+ attempt
319
+ });
320
+ if (decision.state !== "retryable") {
321
+ throw new Error("durable notification retry policy rejected a ready attempt");
322
+ }
323
+ return decision;
303
324
  }
304
325
  function uncertainTransportStart(attempt) {
305
326
  return decided({
@@ -1 +1 @@
1
- {"version":3,"file":"callback-outbox-policy.js","sourceRoot":"","sources":["../../src/callback-outbox-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,IAAI,WAAW,EAC7B,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EAGtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,2BAA2B,EAK5B,MAAM,yBAAyB,CAAC;AAwBjC;;;;GAIG;AACH,MAAM,UAAU,qCAAqC,CACnD,YAA0B,EAC1B,KAAqC;IAErC,MAAM,QAAQ,GAAG,WAAW,CAAC,YAAY,CAAC,8BAA8B,CAAC,CAAC;IAC1E,IACE,CAAC,QAAQ;QACT,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QAC9D,oCAAoC,CAAC,QAAQ,CAAC,EAC9C,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,OAAO;QACL,GAAG,YAAY;QACf,8BAA8B,EAAE;YAC9B,GAAG,QAAQ;YACX,MAAM,EAAE,YAAY;YACpB,aAAa,EAAE,KAAK,CA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S,gBAAgB,CAAC,KAAc;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC"}
@@ -1,26 +1,12 @@
1
1
  import { type AgentMessage, type Actor, type Conversation } from "./protocol.js";
2
2
  import type { TerminalCompletionEvidence, TerminalControlRef } from "./terminal-agent-adapter.js";
3
- import type { CallbackDeliveryOptions, CallbackDeliveryOutcome, CallbackRetryDisposition, DeliverCallbackInput } from "./callback-outbox-policy.js";
3
+ import type { CallbackDeliveryOutcome, CallbackRetryDisposition, DeliverCallbackInput } from "./callback-outbox-policy.js";
4
+ import { type CallbackPreparationOptions } from "./callback-route-service.js";
5
+ export { resolveCallbackGatewayRoute } from "./callback-route-service.js";
6
+ export type { CallbackGatewayRouteCandidate, CallbackPreparationOptions } from "./callback-route-service.js";
4
7
  import { type CallbackOutboxLane } from "./callback-outbox-settlement.js";
5
8
  import type { TranscriptEvent } from "./transcript.js";
6
9
  import { type CallbackEnvelopeV1, type CallbackRouteV1 } from "./callback-transport.js";
7
- export interface CallbackPreparationOptions extends CallbackDeliveryOptions {
8
- statePath: string;
9
- messageJson?: string;
10
- log?: string;
11
- conversationOverride?: unknown;
12
- callbackDeliveryKind?: string;
13
- allowTerminalCompletionRecoveryStatus?: boolean;
14
- closeTerminalBridgeOnDone?: boolean;
15
- disableCallbackRetry?: boolean;
16
- preserveMessageId?: boolean;
17
- recordOnly?: boolean;
18
- recoverMissingOutbox?: boolean;
19
- recoverTerminalCompletion?: boolean;
20
- retryPending?: boolean;
21
- /** Internal durable lane; ordinary callbacks use the lifecycle lane. */
22
- callbackOutboxLane?: CallbackOutboxLane;
23
- }
24
10
  export interface PrepareCallbackOutboxInput {
25
11
  options: CallbackPreparationOptions;
26
12
  logPath: string;
@@ -170,17 +156,6 @@ export interface CallbackOutboxServicePorts {
170
156
  runTransaction(options: CallbackPreparationOptions): CallbackExecutionResult;
171
157
  };
172
158
  }
173
- export interface CallbackGatewayRouteCandidate {
174
- gatewayUrl?: unknown;
175
- token?: unknown;
176
- }
177
- export declare function resolveCallbackGatewayRoute(...candidates: CallbackGatewayRouteCandidate[]): {
178
- gatewayUrl: string | undefined;
179
- token: string;
180
- } | {
181
- gatewayUrl: string | undefined;
182
- token: undefined;
183
- };
184
159
  export declare function createCallbackOutboxService(ports: CallbackOutboxServicePorts): {
185
160
  prepare: ({ options, logPath }: PrepareCallbackOutboxInput) => PreparedCallback;
186
161
  runPrepared: (prepared: PreparedCallback) => CallbackExecutionResult;
@@ -292,4 +267,3 @@ export declare function terminalBridgeCompletionFingerprint(input: {
292
267
  completion: TerminalCompletionEvidence;
293
268
  terminalMessageId?: string;
294
269
  }): string;
295
- export {};
@@ -1,10 +1,12 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
- import { applyMessageToConversation, createMessage, effectiveTurnStatus, executorForConversation, extractStructuredMessage, isTerminalBridgeCallbackSupersedeStatus, isTerminalDispatchOwnerReleasedStatus, isTurnPhaseStatus, isWaitingForAgentStatus, normalizeLegacyCallbackStatus, parseMessageJson, sessionIdForConversation, turnIdForConversation } from "./protocol.js";
2
+ import { applyMessageToConversation, createMessage, effectiveTurnStatus, executorForConversation, extractStructuredMessage, isTerminalBridgeCallbackSupersedeStatus, isTerminalDispatchOwnerReleasedStatus, isTurnPhaseStatus, isWaitingForAgentStatus, normalizeLegacyCallbackStatus, parseMessageJson, turnIdForConversation } from "./protocol.js";
3
3
  import { beginCallbackRetryPolicy, reduceCallbackRetryPolicy, supersedeCallbackNotificationDelivery } from "./callback-outbox-policy.js";
4
+ import { assertDispatchCallbackRouteAuthority, assertImmutableCallbackTransport, createManagedCallbackEnvelope, resolvedDeliveryOptions, resolveCallbackGatewayRoute, resolveManagedCallbackRoute } from "./callback-route-service.js";
5
+ export { resolveCallbackGatewayRoute } from "./callback-route-service.js";
4
6
  import { callbackOutboxEvent, callbackOutboxField, createCallbackOutboxSettlement } from "./callback-outbox-settlement.js";
7
+ import { createDurableNotificationLease } from "./durable-notification-kernel.js";
5
8
  import { canonicalJson } from "./canonical-json.js";
6
- import { callbackRouteFingerprint } from "./callback-route-authority.js";
7
- import { createCallbackEnvelope, parseCallbackAttemptOutcome, resolveCallbackRoute as resolveHostCallbackRoute } from "./callback-transport.js";
9
+ import { parseCallbackAttemptOutcome } from "./callback-transport.js";
8
10
  import { isRecord, nonBlankString as stringValue } from "./value-guards.js";
9
11
  function supersedeNotificationForLifecycleMessage(conversation, message, now) {
10
12
  return message.type === "done" || message.type === "error"
@@ -14,152 +16,6 @@ function supersedeNotificationForLifecycleMessage(conversation, message, now) {
14
16
  })
15
17
  : conversation;
16
18
  }
17
- export function resolveCallbackGatewayRoute(...candidates) {
18
- let gatewayUrl;
19
- for (const candidate of candidates) {
20
- gatewayUrl ??= stringValue(candidate.gatewayUrl);
21
- const token = stringValue(candidate.token);
22
- if (!token || token === "<token>") {
23
- continue;
24
- }
25
- return {
26
- gatewayUrl: stringValue(candidate.gatewayUrl) ?? gatewayUrl,
27
- token
28
- };
29
- }
30
- return {
31
- gatewayUrl,
32
- token: undefined
33
- };
34
- }
35
- function resolveManagedCallbackRoute(input) {
36
- if (input.inheritedDelivery) {
37
- return resolveHostCallbackRoute(callbackRouteFieldCandidate(input.inheritedDelivery, "callback_route"), legacyCallbackRouteCandidate({
38
- gatewayMethod: input.inheritedDelivery.gateway_method,
39
- gatewaySession: input.inheritedDelivery.gateway_session ??
40
- input.conversation.gateway_session ??
41
- input.conversation.openclaw_session,
42
- openclawBin: input.inheritedDelivery.openclaw_bin ??
43
- input.conversation.openclaw_bin,
44
- gatewayUrl: input.inheritedDelivery.gateway_url ??
45
- input.conversation.gateway_url
46
- }));
47
- }
48
- return resolveHostCallbackRoute(callbackRouteFieldCandidate(input.options, "callbackRoute"), callbackRouteFieldCandidate(input.conversation, "callback_route"), legacyCallbackRouteCandidate({
49
- gatewayMethod: input.options.gatewayMethod ??
50
- input.conversation.gateway_method,
51
- gatewaySession: input.options.gatewaySession ??
52
- input.options.openclawSession ?? input.conversation.gateway_session ??
53
- input.conversation.openclaw_session,
54
- openclawBin: input.options.openclawBin ?? input.conversation.openclaw_bin,
55
- gatewayUrl: input.options.gatewayUrl ?? input.conversation.gateway_url
56
- }), legacyCallbackRouteCandidate({
57
- gatewayMethod: input.conversation.gateway_method,
58
- gatewaySession: input.conversation.gateway_session ??
59
- input.conversation.openclaw_session,
60
- openclawBin: input.conversation.openclaw_bin,
61
- gatewayUrl: input.conversation.gateway_url
62
- }));
63
- }
64
- function callbackRouteFieldCandidate(container, field) {
65
- return Object.hasOwn(container, field)
66
- ? { callbackRoute: container[field] }
67
- : {};
68
- }
69
- function resolvedDeliveryOptions(input) {
70
- if (!input.inheritedDelivery) {
71
- return {
72
- ...input.options,
73
- ...(input.callbackRoute ? { callbackRoute: input.callbackRoute } : {}),
74
- gatewayMethod: input.options.gatewayMethod ??
75
- input.conversation.gateway_method,
76
- gatewaySession: input.options.gatewaySession ??
77
- input.options.openclawSession ?? input.conversation.gateway_session ??
78
- input.conversation.openclaw_session,
79
- openclawSession: input.options.openclawSession ??
80
- input.conversation.openclaw_session,
81
- openclawBin: input.options.openclawBin ?? input.conversation.openclaw_bin,
82
- gatewayUrl: input.options.gatewayUrl ?? input.conversation.gateway_url
83
- };
84
- }
85
- const { callbackRoute: _ignoredCurrentRoute, ...currentOptions } = input.options;
86
- return {
87
- ...currentOptions,
88
- ...(input.callbackRoute ? { callbackRoute: input.callbackRoute } : {}),
89
- gatewayMethod: stringValue(input.inheritedDelivery.gateway_method),
90
- gatewaySession: stringValue(input.inheritedDelivery.gateway_session) ??
91
- input.conversation.gateway_session ??
92
- input.conversation.openclaw_session,
93
- openclawSession: input.conversation.openclaw_session,
94
- openclawBin: stringValue(input.inheritedDelivery.openclaw_bin) ??
95
- input.conversation.openclaw_bin,
96
- gatewayUrl: stringValue(input.inheritedDelivery.gateway_url) ??
97
- input.conversation.gateway_url
98
- };
99
- }
100
- function legacyCallbackRouteCandidate(input) {
101
- return stringValue(input.gatewayMethod)
102
- ? {
103
- legacyOpenClaw: {
104
- controllerSessionId: input.gatewaySession,
105
- gatewayMethod: input.gatewayMethod,
106
- openclawBin: input.openclawBin,
107
- gatewayUrl: input.gatewayUrl
108
- }
109
- }
110
- : {};
111
- }
112
- function createManagedCallbackEnvelope(route, conversation, message) {
113
- return createCallbackEnvelope({
114
- route,
115
- source: {
116
- kind: "managed_turn",
117
- session_id: sessionIdForConversation(conversation),
118
- turn_id: turnIdForConversation(conversation),
119
- conversation_id: conversation.conversation_id
120
- },
121
- event: {
122
- id: message.id,
123
- type: message.type,
124
- body: message.body,
125
- requires_response: message.requires_response,
126
- metadata: message.metadata
127
- }
128
- });
129
- }
130
- function assertImmutableCallbackTransport(inheritedDelivery, route, envelope, messageId) {
131
- if (!inheritedDelivery)
132
- return;
133
- if (inheritedDelivery.callback_route !== undefined &&
134
- canonicalJson(inheritedDelivery.callback_route) !== canonicalJson(route)) {
135
- throw new Error(`callback message ${messageId} conflicts with its persisted immutable route`);
136
- }
137
- if (inheritedDelivery.callback_envelope !== undefined &&
138
- canonicalJson(inheritedDelivery.callback_envelope) !== canonicalJson(envelope)) {
139
- throw new Error(`callback message ${messageId} conflicts with its persisted immutable envelope`);
140
- }
141
- }
142
- function assertDispatchCallbackRouteAuthority(conversation, route) {
143
- const takeover = isRecord(conversation.native_session_takeover)
144
- ? conversation.native_session_takeover
145
- : undefined;
146
- const submission = isRecord(takeover?.terminal_bridge_submission)
147
- ? takeover.terminal_bridge_submission
148
- : undefined;
149
- if (!submission ||
150
- !Object.hasOwn(submission, "callback_route_fingerprint")) {
151
- // Records from before the route-fingerprint field remain readable.
152
- return;
153
- }
154
- const authority = submission.callback_route_fingerprint;
155
- const matches = authority === null
156
- ? route === undefined
157
- : stringValue(authority) !== undefined && route !== undefined &&
158
- callbackRouteFingerprint(route) === authority;
159
- if (!matches) {
160
- throw new Error("callback route conflicts with immutable terminal dispatch authority");
161
- }
162
- }
163
19
  export function createCallbackOutboxService(ports) {
164
20
  const settlement = createCallbackOutboxSettlement({
165
21
  state: {
@@ -298,8 +154,9 @@ export function createCallbackOutboxService(ports) {
298
154
  const closeTerminalBridgeOnDone = message.type === "done" &&
299
155
  options.closeTerminalBridgeOnDone === true;
300
156
  const requiresDelivery = options.recordOnly !== true;
301
- const deliveryAttempt = Number(inheritedDelivery?.attempts ?? 0) + 1;
302
157
  const deliveryAttemptId = randomUUID();
158
+ const previousDeliveryAttempts = Number(inheritedDelivery?.attempts ?? 0);
159
+ const deliveryAttempt = previousDeliveryAttempts + 1;
303
160
  let nextConversation = retryingPending
304
161
  ? conversation
305
162
  : callbackOutboxLane === "notification"
@@ -340,17 +197,18 @@ export function createCallbackOutboxService(ports) {
340
197
  }
341
198
  if (requiresDelivery) {
342
199
  const now = ports.runtime.now().toISOString();
200
+ const claim = callbackDeliveryLease(ports, previousDeliveryAttempts, deliveryAttemptId, now);
343
201
  nextConversation = {
344
202
  ...nextConversation,
345
203
  [callbackOutbox]: {
346
204
  status: "pending",
347
205
  message,
348
- attempts: deliveryAttempt,
349
- attempt_id: deliveryAttemptId,
206
+ attempts: claim.attempt,
207
+ attempt_id: claim.attemptId,
350
208
  attempt_pid: ports.runtime.pid(),
351
- attempt_lease_expires_at: new Date(ports.runtime.nowMs() + ports.retry.attemptLeaseMs).toISOString(),
209
+ attempt_lease_expires_at: claim.leaseExpiresAt,
352
210
  created_at: stringValue(inheritedDelivery?.created_at) ?? now,
353
- last_attempt_at: now,
211
+ last_attempt_at: claim.attemptedAt,
354
212
  updated_at: now,
355
213
  gateway_method: deliveryOptions.gatewayMethod,
356
214
  gateway_session: deliveryOptions.gatewaySession ??
@@ -572,6 +430,15 @@ export function createCallbackOutboxService(ports) {
572
430
  prepareTerminalCompletion: (input) => prepareTerminalCompletion(ports, prepare, input)
573
431
  };
574
432
  }
433
+ function callbackDeliveryLease(ports, previousAttempts, attemptId, attemptedAt) {
434
+ return createDurableNotificationLease({
435
+ previousAttempts,
436
+ attemptId,
437
+ attemptedAt,
438
+ leaseBaseMs: ports.runtime.nowMs(),
439
+ leaseMs: ports.retry.attemptLeaseMs
440
+ });
441
+ }
575
442
  function beginPreparedCallbackTransport(ports, prepared) {
576
443
  const storeDir = ports.state.storeDirForStatePath(prepared.statePath);
577
444
  return ports.state.withWriter(storeDir, () => ports.state.withTransaction(prepared.statePath, () => {