@scotthuang/agent-knock-knock 0.12.13 → 0.12.15

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 (170) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +13 -13
  3. package/dist/src/callback-cli-adapter.d.ts +9 -6
  4. package/dist/src/callback-cli-adapter.js +119 -30
  5. package/dist/src/callback-cli-adapter.js.map +1 -1
  6. package/dist/src/callback-outbox-policy.d.ts +39 -0
  7. package/dist/src/callback-outbox-policy.js +163 -6
  8. package/dist/src/callback-outbox-policy.js.map +1 -1
  9. package/dist/src/callback-outbox-service.d.ts +28 -1
  10. package/dist/src/callback-outbox-service.js +413 -82
  11. package/dist/src/callback-outbox-service.js.map +1 -1
  12. package/dist/src/callback-outbox-settlement.d.ts +14 -1
  13. package/dist/src/callback-outbox-settlement.js +151 -30
  14. package/dist/src/callback-outbox-settlement.js.map +1 -1
  15. package/dist/src/callback-route-authority.d.ts +59 -0
  16. package/dist/src/callback-route-authority.js +123 -0
  17. package/dist/src/callback-route-authority.js.map +1 -0
  18. package/dist/src/callback-transport.d.ts +134 -0
  19. package/dist/src/callback-transport.js +256 -0
  20. package/dist/src/callback-transport.js.map +1 -0
  21. package/dist/src/cli-core.js +56 -18
  22. package/dist/src/cli-core.js.map +1 -1
  23. package/dist/src/cli-runtime-context.d.ts +2 -0
  24. package/dist/src/cli-runtime-context.js.map +1 -1
  25. package/dist/src/codex-lifecycle-compatibility.js +2 -1
  26. package/dist/src/codex-lifecycle-compatibility.js.map +1 -1
  27. package/dist/src/deferred-foreground-application-service.d.ts +18 -0
  28. package/dist/src/deferred-foreground-application-service.js +72 -0
  29. package/dist/src/deferred-foreground-application-service.js.map +1 -1
  30. package/dist/src/deferred-foreground-authority-cli-adapter.js +10 -1
  31. package/dist/src/deferred-foreground-authority-cli-adapter.js.map +1 -1
  32. package/dist/src/deferred-foreground-recovery-cli-adapter.d.ts +1 -1
  33. package/dist/src/deferred-foreground-recovery-cli-adapter.js +108 -37
  34. package/dist/src/deferred-foreground-recovery-cli-adapter.js.map +1 -1
  35. package/dist/src/deferred-foreground-recovery-service.d.ts +1 -1
  36. package/dist/src/deferred-foreground-recovery-service.js +10 -3
  37. package/dist/src/deferred-foreground-recovery-service.js.map +1 -1
  38. package/dist/src/deferred-foreground-transfer-policy.d.ts +1 -1
  39. package/dist/src/deferred-foreground-transfer-policy.js +3 -2
  40. package/dist/src/deferred-foreground-transfer-policy.js.map +1 -1
  41. package/dist/src/deferred-foreground-transfer.d.ts +17 -1
  42. package/dist/src/deferred-foreground-transfer.js +244 -35
  43. package/dist/src/deferred-foreground-transfer.js.map +1 -1
  44. package/dist/src/deferred-foreground-user-close.d.ts +18 -0
  45. package/dist/src/deferred-foreground-user-close.js +180 -0
  46. package/dist/src/deferred-foreground-user-close.js.map +1 -0
  47. package/dist/src/install-doctor-command-adapter.js +1 -1
  48. package/dist/src/install-doctor-command-adapter.js.map +1 -1
  49. package/dist/src/openclaw-callback-transport.d.ts +4 -1
  50. package/dist/src/openclaw-callback-transport.js +403 -10
  51. package/dist/src/openclaw-callback-transport.js.map +1 -1
  52. package/dist/src/openclaw-doctor.js +16 -2
  53. package/dist/src/openclaw-doctor.js.map +1 -1
  54. package/dist/src/openclaw-managed-callback-cli-adapter.d.ts +23 -0
  55. package/dist/src/openclaw-managed-callback-cli-adapter.js +77 -0
  56. package/dist/src/openclaw-managed-callback-cli-adapter.js.map +1 -0
  57. package/dist/src/openclaw-plugin-command-adapter.js +93 -39
  58. package/dist/src/openclaw-plugin-command-adapter.js.map +1 -1
  59. package/dist/src/openclaw-plugin-helpers.d.ts +1 -0
  60. package/dist/src/openclaw-plugin-helpers.js +9 -1
  61. package/dist/src/openclaw-plugin-helpers.js.map +1 -1
  62. package/dist/src/openclaw-plugin-schemas.d.ts +20 -1
  63. package/dist/src/openclaw-plugin-schemas.js +27 -3
  64. package/dist/src/openclaw-plugin-schemas.js.map +1 -1
  65. package/dist/src/protocol.d.ts +3 -0
  66. package/dist/src/protocol.js +4 -0
  67. package/dist/src/protocol.js.map +1 -1
  68. package/dist/src/store.d.ts +12 -1
  69. package/dist/src/store.js +81 -3
  70. package/dist/src/store.js.map +1 -1
  71. package/dist/src/terminal-acceptance-cli-adapter.d.ts +2 -0
  72. package/dist/src/terminal-acceptance-cli-adapter.js +62 -12
  73. package/dist/src/terminal-acceptance-cli-adapter.js.map +1 -1
  74. package/dist/src/terminal-action-projection.d.ts +31 -3
  75. package/dist/src/terminal-action-projection.js +64 -9
  76. package/dist/src/terminal-action-projection.js.map +1 -1
  77. package/dist/src/terminal-agent-bridge.d.ts +82 -0
  78. package/dist/src/terminal-agent-bridge.js +553 -109
  79. package/dist/src/terminal-agent-bridge.js.map +1 -1
  80. package/dist/src/terminal-command-cli-adapter.d.ts +26 -2
  81. package/dist/src/terminal-command-cli-adapter.js +3162 -214
  82. package/dist/src/terminal-command-cli-adapter.js.map +1 -1
  83. package/dist/src/terminal-delegate-cli-adapter.d.ts +4 -22
  84. package/dist/src/terminal-delegate-cli-adapter.js +239 -192
  85. package/dist/src/terminal-delegate-cli-adapter.js.map +1 -1
  86. package/dist/src/terminal-delegate-send-binding.d.ts +63 -0
  87. package/dist/src/terminal-delegate-send-binding.js +360 -0
  88. package/dist/src/terminal-delegate-send-binding.js.map +1 -0
  89. package/dist/src/terminal-dispatch-application.d.ts +4 -1
  90. package/dist/src/terminal-dispatch-application.js +11 -2
  91. package/dist/src/terminal-dispatch-application.js.map +1 -1
  92. package/dist/src/terminal-dispatch-composition.d.ts +5 -0
  93. package/dist/src/terminal-dispatch-execution.js +3 -1
  94. package/dist/src/terminal-dispatch-execution.js.map +1 -1
  95. package/dist/src/terminal-dispatch-ledger-codec.d.ts +3 -0
  96. package/dist/src/terminal-dispatch-ledger-codec.js +46 -19
  97. package/dist/src/terminal-dispatch-ledger-codec.js.map +1 -1
  98. package/dist/src/terminal-dispatch-presenter.js +5 -3
  99. package/dist/src/terminal-dispatch-presenter.js.map +1 -1
  100. package/dist/src/terminal-dispatch-receipt.d.ts +3 -0
  101. package/dist/src/terminal-dispatch-receipt.js +15 -1
  102. package/dist/src/terminal-dispatch-receipt.js.map +1 -1
  103. package/dist/src/terminal-dispatch-recovery-cli-adapter.js +68 -7
  104. package/dist/src/terminal-dispatch-recovery-cli-adapter.js.map +1 -1
  105. package/dist/src/terminal-dispatch-recovery-service.d.ts +2 -0
  106. package/dist/src/terminal-dispatch-recovery-service.js +9 -0
  107. package/dist/src/terminal-dispatch-recovery-service.js.map +1 -1
  108. package/dist/src/terminal-dispatch-repository-cli-adapter.d.ts +4 -2
  109. package/dist/src/terminal-dispatch-repository-cli-adapter.js +10 -3
  110. package/dist/src/terminal-dispatch-repository-cli-adapter.js.map +1 -1
  111. package/dist/src/terminal-identity-authority-cli-adapter.d.ts +2 -0
  112. package/dist/src/terminal-identity-authority-cli-adapter.js +34 -27
  113. package/dist/src/terminal-identity-authority-cli-adapter.js.map +1 -1
  114. package/dist/src/terminal-list-cli-adapter.d.ts +6 -0
  115. package/dist/src/terminal-list-cli-adapter.js +391 -177
  116. package/dist/src/terminal-list-cli-adapter.js.map +1 -1
  117. package/dist/src/terminal-list-renderer.d.ts +9 -1
  118. package/dist/src/terminal-list-renderer.js +226 -104
  119. package/dist/src/terminal-list-renderer.js.map +1 -1
  120. package/dist/src/terminal-maintenance-cli-adapter.js +253 -326
  121. package/dist/src/terminal-maintenance-cli-adapter.js.map +1 -1
  122. package/dist/src/terminal-monitor-application-service.d.ts +5 -0
  123. package/dist/src/terminal-monitor-application-service.js +5 -0
  124. package/dist/src/terminal-monitor-application-service.js.map +1 -1
  125. package/dist/src/terminal-monitor-cli-adapter.d.ts +25 -1
  126. package/dist/src/terminal-monitor-cli-adapter.js +170 -27
  127. package/dist/src/terminal-monitor-cli-adapter.js.map +1 -1
  128. package/dist/src/terminal-monitor-reconciliation-eligibility.d.ts +1 -1
  129. package/dist/src/terminal-monitor-reconciliation-eligibility.js +220 -32
  130. package/dist/src/terminal-monitor-reconciliation-eligibility.js.map +1 -1
  131. package/dist/src/terminal-monitor-state-cli-adapter.d.ts +1 -1
  132. package/dist/src/terminal-monitor-state-cli-adapter.js +808 -147
  133. package/dist/src/terminal-monitor-state-cli-adapter.js.map +1 -1
  134. package/dist/src/terminal-monitor-state-reconciliation-service.d.ts +2 -1
  135. package/dist/src/terminal-monitor-state-reconciliation-service.js +12 -0
  136. package/dist/src/terminal-monitor-state-reconciliation-service.js.map +1 -1
  137. package/dist/src/terminal-monitor-supervision-cli-adapter.d.ts +2 -0
  138. package/dist/src/terminal-monitor-supervision-cli-adapter.js +31 -11
  139. package/dist/src/terminal-monitor-supervision-cli-adapter.js.map +1 -1
  140. package/dist/src/terminal-process-source.d.ts +13 -0
  141. package/dist/src/terminal-process-source.js +37 -0
  142. package/dist/src/terminal-process-source.js.map +1 -1
  143. package/dist/src/terminal-runtime-cli-adapter.js +14 -2
  144. package/dist/src/terminal-runtime-cli-adapter.js.map +1 -1
  145. package/dist/src/terminal-status-cli-adapter.d.ts +1 -0
  146. package/dist/src/terminal-status-cli-adapter.js +30 -28
  147. package/dist/src/terminal-status-cli-adapter.js.map +1 -1
  148. package/dist/src/terminal-submission-acceptance.js +78 -25
  149. package/dist/src/terminal-submission-acceptance.js.map +1 -1
  150. package/dist/src/terminal-submission-retry-service.d.ts +114 -0
  151. package/dist/src/terminal-submission-retry-service.js +589 -0
  152. package/dist/src/terminal-submission-retry-service.js.map +1 -0
  153. package/dist/src/terminal-user-send-intent.d.ts +65 -0
  154. package/dist/src/terminal-user-send-intent.js +317 -0
  155. package/dist/src/terminal-user-send-intent.js.map +1 -0
  156. package/dist/src/terminal-watch-callback-cli-adapter.d.ts +10 -2
  157. package/dist/src/terminal-watch-callback-cli-adapter.js +76 -37
  158. package/dist/src/terminal-watch-callback-cli-adapter.js.map +1 -1
  159. package/dist/src/terminal-watch-cli-adapter.js +41 -17
  160. package/dist/src/terminal-watch-cli-adapter.js.map +1 -1
  161. package/dist/src/terminal-watch-service.d.ts +11 -6
  162. package/dist/src/terminal-watch-service.js +210 -41
  163. package/dist/src/terminal-watch-service.js.map +1 -1
  164. package/dist/src/terminal-watch-store.d.ts +23 -0
  165. package/dist/src/terminal-watch-store.js +162 -4
  166. package/dist/src/terminal-watch-store.js.map +1 -1
  167. package/docs/quickstart-herdr.md +1 -1
  168. package/docs/quickstart-tmux.md +3 -3
  169. package/package.json +1 -1
  170. package/templates/openclaw-skills/agent-knock-knock/SKILL.md +14 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.15 - 2026-08-25
4
+
5
+ ### Added
6
+
7
+ - Add the `terminal_user_explicit` physical Send authority domain, global message intent, and immutable omitted-target binding so an explicit user Send remains actionable independently of AKK management state.
8
+
9
+ ### Fixed
10
+
11
+ - Prevent stale, stalled, deferred, corrupt, or missing Store, Session, Turn, transfer, activity, and dispatch-ledger state from vetoing an explicit user Send. When a zero-wait managed attempt proves that no input was submitted, fall back once to exact physical delivery and leave subsequent observation to Terminal Watch.
12
+ - Detach an exact same-incarnation bound Session left behind by failed managed preparation after physical fallback when no live blocking Turn remains, so a later Terminal Watch can attach normally.
13
+ - Retire an exact same-incarnation ordinary dispatch ledger whose owner Turn is gone after physical fallback, so a refreshed List can advertise Watch again; unresolved native lifecycle ledgers remain preserved.
14
+ - Reject ordinary native slash-command text before selector discovery, avoiding terminal or host-process scans for an invalid Send or Respond.
15
+ - Make OpenClaw doctor skill verification compatible with multi-agent installations that require an explicit `main` owner.
16
+ - Scope durable omitted-target delegate bindings to the active runtime directory, preventing in-process hosts with scoped `AKK_RUNTIME_DIR` values from sharing message-ID state.
17
+ - Bind explicit physical Send authority to the exact operating-system process incarnation and reject stale supplied authority before managed preparation or terminal input.
18
+
19
+ ### Changed
20
+
21
+ - Advance the action contract to 19 and expose Send readiness from physical terminal evidence while retaining the existing Store format and writer protocol.
22
+
23
+ ### Security
24
+
25
+ - Continue to require exact live terminal and process identity, approval eligibility, an empty composer, and unambiguous input evidence before physical Send. Possible prior input, true concurrency, or same-message ambiguity remains fail-closed and never triggers duplicate delivery.
26
+ - Keep fallback delivery free of synthetic Turns or callbacks, and treat post-delivery bookkeeping or cleanup failures as warnings without automatically replaying user input.
27
+ - Preserve a Session still named by an unresolved native lifecycle ledger instead of fabricating a transition outcome; the physical Send remains delivered and cleanup reports the retained recovery boundary.
28
+
29
+ ## 0.12.14 - 2026-08-24
30
+
31
+ ### Added
32
+
33
+ - Add an exact Codex `0.149.1` native lifecycle and `/status` inspection profile, retaining fail-closed handling for adjacent and future unverified versions.
34
+ - Add a versioned, host-neutral callback route and transport boundary with durable routing and idempotency authority while retaining OpenClaw as the concrete host adapter.
35
+
36
+ ### Fixed
37
+
38
+ - Distinguish the exact Codex root user row from same-turn synthetic user-role context, preserving Terminal Watch until a later native task actually supersedes it.
39
+ - Safely recover eligible uncertain Send submissions through exact one-shot retry and reconciliation without replaying accepted input or replacing the original request.
40
+ - Make explicit Close honor the user's management-release decision first, with best-effort linked cleanup, warning-only cleanup conflicts, no terminal or coding-agent interruption, and immediate eligibility for a fresh Watch.
41
+
42
+ ### Security
43
+
44
+ - Freeze callback routing and idempotency authority durably, fail closed on route drift or ambiguous recovery, and keep model-facing callback and retry contracts free of opaque authority material.
45
+ - Require exact adjacent native-event evidence and a privacy-safe content hash when identifying Codex root user rows; missing, duplicate, orphaned, or mismatched evidence fails closed.
46
+
3
47
  ## 0.12.13 - 2026-08-22
4
48
 
5
49
  ### Added
package/README.md CHANGED
@@ -42,7 +42,7 @@ After doctor reports `AKK doctor: ready`, send a separate message:
42
42
  /akk inspect this repository and summarize it
43
43
  ```
44
44
 
45
- The second command proves that AKK can find the one eligible idle pane, revalidate its process and pane identity, confirm that their working directories match, send the task, and return the result. Direct `/akk ...` commands need no OpenClaw tool-policy changes.
45
+ The second command proves that AKK can find the one send-ready pane, revalidate its process and pane identity, verify a non-blocked approval state and exact empty composer, send the task, and return the result. Parsed `activity_state` and broken AKK management state do not veto this user-explicit Send. Direct `/akk ...` commands need no OpenClaw tool-policy changes.
46
46
 
47
47
  ## See It in Action
48
48
 
@@ -89,21 +89,21 @@ terminal resource / process incarnation
89
89
  └─ Turn 3 (turn_id)
90
90
  ```
91
91
 
92
- The v18 model-facing action contract is semantic-ID only. `send(session_id, request)` is **session-scoped** (`session_exact`): it creates a new `turn_id` in that exact native coding-agent context and never silently follows a different thread now visible in the pane. `send(terminal_id, request)` is **terminal-scoped follow-current** (`terminal_follow_current`): it means “send this ordinary task to the current verified context in this pane,” including when AKK cannot yet name its foreground native thread. `session_id` and `terminal_id` are mutually exclusive; callers may omit both only when AKK must prove one unique eligible pane. Human-facing slash selectors remain a discovery convenience, but structured tools never carry selectors or opaque authority values. The trusted plugin/CLI derives fresh terminal, binding, candidate, prompt, and handoff fences internally, then revalidates them under the canonical terminal and Store locks before a side effect. AKK sends the task once and binds only the single rollout that durably accepts that exact request. The `turn_id` is not a destination for later ordinary sends; it is the exact identity used for status, approval, cancellation, renewal, callback retry, close, and callback correlation. If a Turn is `waiting_for_openclaw`, `respond(turn_id, answer)` supplies the answer inside that same Turn instead of creating another one.
92
+ The v19 model-facing action contract remains semantic-ID only. `send(session_id, request)` is **session-scoped** (`session_exact`): it creates a new `turn_id` in that exact native coding-agent context and never silently follows a different thread now visible in the pane. `send(terminal_id, request)` may be managed follow-current (`terminal_follow_current`) or the user-priority physical-terminal path (`terminal_user_explicit`), exactly as advertised by the current row. `session_id` and `terminal_id` are mutually exclusive; callers may omit both only when AKK must prove one unique send-ready pane. Human-facing slash selectors remain a discovery convenience, but structured tools never carry selectors or opaque authority values. The trusted plugin/CLI derives fresh terminal, binding, candidate, prompt, and handoff fences internally. Every mutation holds the terminal lock; managed operations additionally use Store locks, while unmanaged user-priority fallback deliberately does not depend on Store health. A managed send creates a Turn and binds only the single rollout that durably accepts that exact request. The `turn_id` is not a destination for later ordinary sends; it is the exact identity used for status, approval, cancellation, renewal, callback retry, close, and callback correlation. If a Turn is `waiting_for_openclaw`, `respond(turn_id, answer)` supplies the answer inside that same Turn instead of creating another one.
93
93
 
94
- v15 generalized the human-priority Codex path; v18 preserves that safety while removing opaque fences from model arguments. It covers a status-card-only Session with no rollout, a quiescent managed pane whose exact open-rollout inventory is complete but cannot identify the foreground candidate, and a supported manual `/clear` whose new logical thread is visible before its rollout materializes. The complete exact inventory domain binds the provider terminal, PID and process birth, workspace and canonical endpoint, and every open rollout's UUID, descriptor, device, inode, canonical path, and pre-submit byte offset. Native foreground resolution may be unavailable only when that independent domain is complete and exact; an incomplete, missing, stale, or changed domain fails closed. A `/clear` resume hint is advisory only. Under the terminal lock, AKK isolates the old Session, creates a separate zero-UUID provisional Session and Turn, sends only the real task, and promotes that target only after the post-submit monitor finds a unique exact request acceptance in the pinned rollout domain. The resulting native UUID may match or differ from the old Session; it is never silently merged back into the predecessor. A rollout-backed Codex row therefore advertises `terminal_follow_current` with `terminal_id`, not `session_exact`; a cached or direct `session_exact` attempt revalidates under the terminal lock, rejects before task text, and never downgrades itself to the follow-current path. Only released predecessor Turn history from a strictly earlier binding epoch is excluded from current-send authority; unresolved current-epoch state still blocks. The freshly listed semantic-ID action can work in a narrow pane without `/status`. Until promotion commits, strict `session_id` send, `respond`, managed `approve`, `cancel`, native lifecycle, callback delivery, and `native_inspect` remain unavailable. If terminal delivery or native acceptance is uncertain, AKK does not retry the input. Explicitly closing such an uncertain Turn abandons its missing result and callback; when the exact resolved close ledger, append-only uncertain receipt, frozen predecessor history, absent old rollout, and unclaimed current candidate inventory remain authoritative, the conflict row may restore only a future internally fenced candidate send.
94
+ v15 generalized the human-priority Codex path; v18 preserves that safety while removing opaque fences from model arguments. It covers a status-card-only Session with no rollout, a quiescent managed pane whose exact open-rollout inventory is complete but cannot identify the foreground candidate, and a supported manual `/clear` whose new logical thread is visible before its rollout materializes. The complete exact inventory domain binds the provider terminal, PID and process birth, workspace and canonical endpoint, and every open rollout's UUID, descriptor, device, inode, canonical path, and pre-submit byte offset. Native foreground resolution may be unavailable only when that independent domain is complete and exact; an incomplete, missing, stale, or changed domain fails closed. A `/clear` resume hint is advisory only. Under the terminal lock, AKK isolates the old Session, creates a separate zero-UUID provisional Session and Turn, sends only the real task, and promotes that target only after the post-submit monitor finds a unique exact request acceptance in the pinned rollout domain. The resulting native UUID may match or differ from the old Session; it is never silently merged back into the predecessor. A rollout-backed Codex row therefore advertises `terminal_follow_current` with `terminal_id`, not `session_exact`; a cached or direct `session_exact` attempt revalidates under the terminal lock, rejects before task text, and never downgrades itself to the follow-current path. Only released predecessor Turn history from a strictly earlier binding epoch is excluded from current-send authority; unresolved current-epoch state still blocks the managed path. The freshly listed semantic-ID action can work in a narrow pane without `/status`. Until promotion commits, strict `session_id` send, `respond`, managed `approve`, `cancel`, native lifecycle, callback delivery, and `native_inspect` remain unavailable. If terminal delivery or native acceptance is uncertain, AKK does not retry the input. Explicit Close is the user's management escape hatch: AKK closes the selected Turn first, sends no terminal input, leaves the coding agent and pane running, and then best-effort releases only linked AKK metadata. Missing, malformed, stale, or newer cleanup records are preserved and reported as warnings instead of vetoing Close. Refresh the list afterward; if the coding agent is still working, Watch can observe it again. v19 adds `terminal_user_explicit`: when the user chooses an advertised exact live physical prompt, only terminal/process identity, a visible prompt with no active approval, and an exactly empty composer may veto a new Send. Broken AKK Turn, Session, deferred-transfer, transition, ledger, or Store state cannot veto that user decision. AKK tries the managed fast path first; if internal state prevents it, AKK delivers the request once as unmanaged work and then best-effort releases the conflicting management. For an omitted target, AKK durably binds the `message_id` to the first selected physical terminal before input whenever runtime durability is available, so a retry cannot move the same request to another pane. An existing or possibly existing same-ID record rejects automatic replay. If no record exists and durability is unavailable, user priority wins: AKK proceeds with a warning, and strict cross-process replay or reselection protection is unavailable for that degraded invocation, so callers must not automatically retry its result. The fallback creates no callback Turn and sends no callback; refresh the list and use Watch to observe the task.
95
95
 
96
96
  Approval remains separate from managed attribution. When `list` can prove one exact visible Codex approval prompt, it may advertise managed `approve({turn_id})` or terminal-scoped `approve({terminal_id})`; the latter remains possible when foreground rollout attribution is temporarily unavailable. The user must inspect and explicitly confirm that exact prompt. The plugin/CLI then keeps the confirmation offer private, recaptures the prompt, and revalidates the Store, terminal, process, and prompt fence under lock immediately before sending the exact key once. No token or fingerprint is transported through the model call. Terminal-scoped approval does not attribute the approval to a Turn, mutate Session identity, or create a durable approval receipt, so an uncertain transport result must not be retried blindly. It is never available to auto-approve. A changed prompt, identity, owner, or confirmation offer remains blocked.
97
97
 
98
98
  The private approval fence remains prompt-scoped. AKK hashes the adapter-isolated, exact unredacted approval region together with the terminal/process identity, decision keys and label, prompt kind, working directory, reason/detail, and any request or policy evidence. The whole-screen digest and redacted excerpt remain diagnostic only: output outside the approval region may change without invalidating the same reviewed prompt. A change inside the region—including the command or an otherwise identically redacted secret, choices, highlighted option, prompt kind, or request identity—or a change in the bound process, working directory, or request evidence still rejects with zero approval keys. If the adapter cannot isolate one complete bounded prompt region, approval fails closed. The raw prompt region and its opaque fence are never returned to the model, persisted as public action data, or logged.
99
99
 
100
- Human-friendly selectors such as `only`, `codex`, `claude`, a terminal ID, or `@short-ref` remain a slash-command discovery layer. Structured model tools use semantic IDs instead: strict continuation pre-fills `session_id`, while follow-current continuation pre-fills `terminal_id`. Merely observing a mismatch or an unbound rollout inventory never mutates the Store. AKK advertises a send only when it can prove a single source claim, an exact live terminal/process incarnation, an idle empty composer, a stable complete rollout inventory, and no unresolved Turn, transition, dispatch, or approval. A foreground ambiguity inside that complete inventory may be resolved after the real request is accepted; incomplete, stale, or unverifiable evidence remains blocked. Other actions likewise expose only their semantic identities, while opaque freshness fences are derived and consumed inside the trusted plugin/CLI boundary.
100
+ Human-friendly selectors such as `only`, `codex`, `claude`, a terminal ID, or `@short-ref` remain a slash-command discovery layer. Structured model tools use semantic IDs instead: strict continuation pre-fills `session_id`, while terminal-scoped Send pre-fills `terminal_id`. Merely observing a mismatch or an unbound rollout inventory never mutates the Store. Managed Send remains available only when AKK can prove its complete managed authority. A listed `terminal_user_explicit` action has the narrower user-priority boundary instead: one exact live physical prompt, no active approval prompt, and an exactly empty composer. AKK internal management or persistence damage does not suppress that action. Other actions likewise expose only their semantic identities, while opaque freshness fences are derived and consumed inside the trusted plugin/CLI boundary.
101
101
 
102
- An exact human switch while the old Session still has one active Turn is a decision point, not an automatic redirect. In that case the terminal row may expose `handoff_decision` instead of a follow-current send. Its nested `choices.take_over_current.action` is the only authoritative supersede action: after explicit user confirmation, invoke `agent_knock_knock_close({turn_id, reason:"superseded_by_human_context_switch"})`. The plugin/CLI resolves and revalidates the exact advertised handoff decision privately; no live native UUID or handoff token crosses the model boundary. The close records the old Turn's disposition and sends no terminal input. Then list again and use only the newly advertised follow-current send. Choosing `keep_source` changes no AKK state: restore the old native thread in the Codex or Claude TUI, then refresh the list. A completed/changed Turn or another human thread switch invalidates the private decision fence and requires a fresh decision.
102
+ An exact human switch while the old Session still has one active Turn is a decision point, not an automatic redirect. The terminal row may expose `handoff_decision` instead of a follow-current send. If the user chooses to close the old Turn, explicit Close takes priority and releases only its AKK management; it does not depend on the live native thread remaining unchanged, sends no terminal input, and does not stop the coding agent. Then list again and use only the newly advertised follow-current send or Watch action. Choosing `keep_source` changes no AKK state: restore the old native thread in the Codex or Claude TUI, then refresh the list.
103
103
 
104
- Native clear/new/resume operations requested through AKK are explicit lifecycle actions, separate from ordinary Turn creation. A successful new/clear creates a new native thread and AKK Session; resume activates the exact historical native thread and its corresponding Session. Each successful lifecycle transition creates no Turn. A human may also run native `/clear`, `/new`, `/resume`, or the equivalent directly in the shared terminal. AKK does not forbid that takeover: the next exact, fresh terminal-scoped follow-current send can absorb the human-driven transition when it is safe, while a `session_id` send deliberately remains pinned to its old context. AKK serializes either transition, verifies the resulting native identity, and advances the terminal binding generation so work and callbacks from the previous context cannot cross the boundary. Exact AKK-driven lifecycle profiles are verified for Codex 0.146.0/0.146.1/0.147.0/0.148.0 and Claude Code 2.1.218/2.1.226/2.1.237.
104
+ Native clear/new/resume operations requested through AKK are explicit lifecycle actions, separate from ordinary Turn creation. A successful new/clear creates a new native thread and AKK Session; resume activates the exact historical native thread and its corresponding Session. Each successful lifecycle transition creates no Turn. A human may also run native `/clear`, `/new`, `/resume`, or the equivalent directly in the shared terminal. AKK does not forbid that takeover: the next exact, fresh terminal-scoped follow-current send can absorb the human-driven transition when it is safe, while a `session_id` send deliberately remains pinned to its old context. AKK serializes either transition, verifies the resulting native identity, and advances the terminal binding generation so work and callbacks from the previous context cannot cross the boundary. Exact AKK-driven lifecycle profiles are verified for Codex 0.146.0/0.146.1/0.147.0/0.148.0/0.149.1 and Claude Code 2.1.218/2.1.226/2.1.237.
105
105
 
106
- AKK status and native status inspection are different operations. `agent_knock_knock_status` (and `/akk status`) reads AKK Turn state plus a bounded current terminal screen; it does not execute the coding agent's `/status`. When an idle terminal row advertises `native_inspect`, `agent_knock_knock_native_inspect({terminal_id, inspection:"status"})` can execute only that closed, version-scoped inspection. AKK derives and revalidates the fresh binding fence internally. Supported profiles are Codex 0.146.0/0.146.1/0.147.0/0.148.0 and Claude Code 2.1.218/2.1.226/2.1.237. Claude's adapter parses a newly opened Status panel, dismisses that exact panel once, and proves the same pane returned to an idle empty composer. The action creates no Session, Turn, receipt, monitor, or callback. `/usage`, `/cost`, `/stats`, `/usage-credits`, `/model`, `/compact`, arbitrary slash strings, and unsupported versions remain unavailable. In particular, bare Codex `/usage` opens an interactive menu whose later Enter can select an account-side usage-limit reset; do not automate it as a read-only inspection.
106
+ AKK status and native status inspection are different operations. `agent_knock_knock_status` (and `/akk status`) reads AKK Turn state plus a bounded current terminal screen; it does not execute the coding agent's `/status`. When an idle terminal row advertises `native_inspect`, `agent_knock_knock_native_inspect({terminal_id, inspection:"status"})` can execute only that closed, version-scoped inspection. AKK derives and revalidates the fresh binding fence internally. Supported profiles are Codex 0.146.0/0.146.1/0.147.0/0.148.0/0.149.1 and Claude Code 2.1.218/2.1.226/2.1.237. Claude's adapter parses a newly opened Status panel, dismisses that exact panel once, and proves the same pane returned to an idle empty composer. The action creates no Session, Turn, receipt, monitor, or callback. `/usage`, `/cost`, `/stats`, `/usage-credits`, `/model`, `/compact`, arbitrary slash strings, and unsupported versions remain unavailable. In particular, bare Codex `/usage` opens an interactive menu whose later Enter can select an account-side usage-limit reset; do not automate it as a read-only inspection.
107
107
 
108
108
  ## Optional: Natural-Language Delegation
109
109
 
@@ -213,7 +213,7 @@ For one complete first run, follow [Agent Knock Knock in 5 minutes](https://gith
213
213
 
214
214
  AKK discovers verified Codex and Claude Code panes across workspaces. It sends work only to a pane that is already running in tmux or supported Herdr and at a verified idle prompt; it never starts a coding agent for you.
215
215
 
216
- If exactly one eligible idle coding-agent pane exists across all workspaces, send a task directly:
216
+ If exactly one send-ready coding-agent pane exists across all workspaces, send a task directly:
217
217
 
218
218
  ```text
219
219
  /akk inspect this repository and summarize it
@@ -246,7 +246,7 @@ The core command surface is intentionally small:
246
246
 
247
247
  `/akk list` performs a controlled reconciliation across managed turns, and managed `/akk status` limits reconciliation to the selected turn. This can close records whose idle retention has elapsed and restore eligible missing monitors, but it does not send terminal input or retry managed-Turn callback delivery. A `watch_id` status reads that independent Watch record. The running OpenClaw supervisor coordinates two separate reconciliation passes every five seconds and at startup: one restores eligible `waiting_for_agent` Turn monitors, while the other observes active Terminal Watches and retries their durable callback outboxes. Each pass has its own error boundary, so one failure does not starve the other. Standalone shell queries are read-only unless their command explicitly reconciles, and resolving a selector never changes turn state.
248
248
 
249
- Selectors fail closed: `only` works only with one actionable target, `latest` requires a unique newest target, and `codex` or `claude` must identify exactly one eligible pane. These names and `@short-ref` are human-facing slash-command resolution inputs. The v18 structured model contract does not expose a `selector`: JSON actions carry an authoritative `session_id`, `terminal_id`, `turn_id`, `watch_id`, or other semantic entity ID. For ordinary send, exactly one of `session_id` and `terminal_id` may be supplied, or both may be omitted to require one unique pane. Approval likewise uses only `turn_id` or `terminal_id` after explicit confirmation. Before every terminal operation, AKK derives fresh opaque authority internally, revalidates the expected agent PID and provider-owned terminal identity, confirms that the process and pane working directories still match, and—before send—revalidates the idle prompt.
249
+ Selectors fail closed: `only` works only with one actionable target, `latest` requires a unique newest target, and `codex` or `claude` must identify exactly one eligible pane. These names and `@short-ref` are human-facing slash-command resolution inputs. The v19 structured model contract does not expose a `selector`: JSON actions carry an authoritative `session_id`, `terminal_id`, `turn_id`, `watch_id`, or other semantic entity ID. For ordinary send, exactly one of `session_id` and `terminal_id` may be supplied, or both may be omitted to require one unique send-ready pane. Approval likewise uses only `turn_id` or `terminal_id` after explicit confirmation. Before every terminal operation, AKK derives fresh opaque authority internally and revalidates the expected agent PID and provider-owned terminal identity. `terminal_user_explicit` additionally requires the exact live prompt, no active approval, and an empty composer, but does not require healthy AKK management state.
250
250
 
251
251
  To ask AKK itself to change native context, first copy the full `terminal_id` from `/akk list`; lifecycle commands do not accept an ordinary-send `@short-ref` or loose agent selector. `/akk threads <exact-terminal-id>` lists exact, same-workspace candidates with a deterministic number, a collision-safe display-only `@short-id`, and the complete UUID. `/akk resume-thread <exact-terminal-id>` without a selection shows that list. A complete UUID remains compatible. A number or short ID resolves only against the latest list displayed in the same OpenClaw conversation incarnation; both expire after five minutes and fail after terminal, process, workspace, binding, candidate-set, or relevant action changes. AKK resolves that human navigation to the complete UUID and derives fresh private evidence under lock. `previous` (or `刚才那个`) is advertised only when the current Session's latest committed lifecycle transition identifies exactly one currently verified resumable source; it never guesses from title, recency, or static lineage. If `previous` is present, use only its exact prefilled semantic-ID action for a natural-language “刚才那个” request. Structured lifecycle mutations are `new_thread({terminal_id})` and `resume_thread({terminal_id,native_thread_id})`. AKK does not poll bindings or adopt observed switches in the background: a human-driven switch is adopted only as part of an explicit, fresh terminal-scoped send. If a recorded owner process exits, the next lifecycle listing can classify that sole historical binding as resumable, and the resume mutation compare-and-swap detaches it before touching the terminal. Stale, expired, unsupported, busy, ambiguous, active-elsewhere, or unverifiable transitions fail closed. Do not ask AKK to send `/clear`, `/new`, `/resume`, `/status`, Codex `/fork`, `/side`, or `/btw`, Claude `/branch`, or any other first-line native slash command as an ordinary task or answer; use an advertised AKK action, express the request in natural language, or enter an unsupported native command manually in the terminal UI.
252
252
 
@@ -254,15 +254,15 @@ The number and short-ID resume forms refer only to that displayed snapshot; neit
254
254
 
255
255
  To request a native Codex status card or Claude Status panel, first run `agent_knock_knock_list` and use only that terminal row's advertised `native_inspect({terminal_id,inspection:"status"})` action. The structured tool schema is closed to those two semantic fields; callers cannot provide `/status`, another slash command, or an authority token. AKK serializes the inspection with terminal mutations, derives and revalidates its private binding fence and exact terminal identity, and returns only after it proves one fresh bounded status result and an idle postcondition. Codex status probes additionally require an exact viewport of at least 80 columns to preserve the full Session UUID, cross the versioned paste-settle boundary, and dispatch Enter exactly once. An initially narrow or unknown viewport fails before text input with a widen/zoom diagnostic; post-injection viewport or composer drift fails closed before Enter and leaves the draft for manual inspection. Codex `/status` and that viewport requirement apply only to operations that must prove the UUID before terminal input. An otherwise eligible terminal-scoped ordinary task can send once and bind from exact native acceptance afterward, so it does not run `/status` or fail merely because the pane is narrow. For Claude, the inspection safely dismisses the exact modal once. It never turns ordinary `send` or `respond` into a slash-command escape hatch.
256
256
 
257
- The current OpenClaw surface registers 16 tools, and the top-level v18 `action_contracts` documents Terminal Watch alongside closed native inspection, human-priority current-pane send/approval, lifecycle, and Turn actions. Every model-facing action carries semantic IDs only; opaque freshness and compare-and-swap fences stay inside the trusted plugin/CLI boundary. `available_actions` remains the authority for ordinary current actions. Two deliberate nested exceptions require explicit user confirmation: an active human-handoff conflict may expose `handoff_decision.choices.take_over_current.action`, while a collateral terminal-wide unresolved Turn may appear in `blocking_turns[]` with its exact Store-only `recovery_action`. An active handoff source Turn is never generically closable through `blocking_turns`; it remains governed only by the handoff decision. Invoke only the advertised semantic-ID action, then refresh the list before doing anything else.
257
+ The current OpenClaw surface registers 16 tools, and the top-level v19 `action_contracts` documents Terminal Watch alongside closed native inspection, user-priority current-pane Send/approval, lifecycle, and Turn actions. Every model-facing action carries semantic IDs only; opaque freshness and compare-and-swap fences stay inside the trusted plugin/CLI boundary. `available_actions` remains the authority for ordinary current actions. A listed `terminal_user_explicit` Send prioritizes the user's exact live physical prompt over broken AKK internal state: AKK attempts managed delivery first, then may deliver unmanaged without a callback before attempting best-effort management release. Refresh and use Watch afterward. Explicit Close is always available for a selected managed Turn after user confirmation, including deferred-transfer and handoff conflicts; it releases AKK management without terminal input or stopping the coding agent. A terminal row may also expose a nested `blocking_turns[].recovery_action` for the same user-owned Close. Invoke the advertised semantic-ID action, then refresh the list before doing anything else.
258
258
 
259
- For natural-language tool use, `agent_knock_knock_list` is terminal-first. Each live pane appears exactly once in `terminals[]`; `process_state` reports whether its coding-agent process is alive and `activity_state` reports the parsed screen state. `managed.session_id` identifies the continuing AKK session, `managed.current_turn` is its optional active Turn, and `managed.recent_turn` is retained history; retained Turns do not occupy the terminal. A human-driven native-thread mismatch remains honestly classified as `management_state="conflict"`; its `handoff_state` is `external_handoff_adoptable` only when the row advertises the fenced follow-current `send`, otherwise it is `external_handoff_blocked`. Listing never performs the adoption. Pass `all=true` to include older entries in `managed.history`. By default, `unavailable_managed_turns[]` contains attention-needed records whose pane cannot be presented as a live terminal; `all=true` also includes retained unavailable history.
259
+ For natural-language tool use, `agent_knock_knock_list` is terminal-first. Each live pane appears exactly once in `terminals[]`; `process_state` reports whether its coding-agent process is alive and `activity_state` reports the parsed screen state. `managed.session_id` identifies the continuing AKK session, `managed.current_turn` is its optional active Turn, and `managed.recent_turn` is retained history; retained Turns do not occupy the terminal. A human-driven native-thread mismatch remains honestly classified as `management_state="conflict"`; its `handoff_state` is `external_handoff_adoptable` only when the row advertises the fenced follow-current `send`, otherwise it is `external_handoff_blocked`. `management_state="unavailable"` means only that AKK's management projection could not be read; the separately observed live terminal facts and any advertised `terminal_user_explicit` Send remain authoritative. Listing never performs the adoption. Pass `all=true` to include older entries in `managed.history`. By default, `unavailable_managed_turns[]` contains attention-needed records whose pane cannot be presented as a live terminal; `all=true` also includes retained unavailable history.
260
260
 
261
- Use only an `available_actions` entry returned in the current list, begin with its prefilled semantic IDs, and supply every `missing_required` field. The only additional action sources are a terminal row's nested `handoff_decision.choices.take_over_current.action` and an exact `blocking_turns[].recovery_action`; both require explicit user confirmation. When advertised, a managed Session's strict send uses `send({session_id,request})` and creates a new Turn only in that Session's native context. A follow-current send uses `send({terminal_id,request})`; this is the human-priority path when the pane is exact but its foreground Codex UUID is not yet attributable. Structured send never exposes a selector. `respond` and managed controls use `turn_id`; terminal-scoped approval uses `terminal_id` only after explicit confirmation. Native inspection uses `{terminal_id,inspection:"status"}`. Other raw controls may be used only through the exact action their row advertises. `timeoutSeconds` is unsupported, and monitoring limits should be omitted unless the user explicitly asks to change them. AKK derives fresh opaque fences and revalidates availability under lock before every side effect.
261
+ Use only an `available_actions` entry returned in the current list, begin with its prefilled semantic IDs, and supply every `missing_required` field. The only additional action sources are a terminal row's nested `handoff_decision.choices.take_over_current.action` and an exact `blocking_turns[].recovery_action`; both require explicit user confirmation. When advertised, a managed Session's strict send uses `send({session_id,request})` and creates a new Turn only in that Session's native context. Terminal-scoped Send uses `send({terminal_id,request})`. A `terminal_user_explicit` action is the user-priority path: healthy AKK state still takes the managed fast path, while broken AKK state receives one unmanaged delivery with no callback before best-effort management release. Refresh the list and use Watch afterward. Structured Send never exposes a selector. `respond` and managed controls use `turn_id`; terminal-scoped approval uses `terminal_id` only after explicit confirmation. Native inspection uses `{terminal_id,inspection:"status"}`. Other raw controls may be used only through the exact action their row advertises. `timeoutSeconds` is unsupported, and monitoring limits should be omitted unless the user explicitly asks to change them. AKK derives fresh opaque fences and revalidates availability under lock before every side effect.
262
262
 
263
263
  On first attach, the target terminal must be explicitly named by the user; AKK never guesses which already-running pane should receive a task.
264
264
 
265
- The top-level v18 action contracts include `watch` and `unwatch` as well as `send`, manual `approve`, `native_inspect`, `list_resumable_threads`, `new_thread`, `resume_thread`, and conflict-only `reconcile_binding`. Their model-facing mutation shapes are deliberately small: `watch({terminal_id})`; `send({session_id|terminal_id,request})` with the targets mutually exclusive; managed `approve({turn_id})` or terminal-scoped `approve({terminal_id})`; `native_inspect({terminal_id,inspection})`; `new_thread({terminal_id})`; `resume_thread({terminal_id,native_thread_id})`; and `reconcile_binding({terminal_id,conflicting_session_id})`. Approval, handoff takeover, and reconciliation require explicit user confirmation, but none transports a token, revision, binding ID/generation, candidate fence, handoff-only live-native-UUID fence, or approval fingerprint through the model. `native_thread_id` remains the intentional semantic identity for resume. `watch` returns a `watch_id`; Watch status and `unwatch` use only that ID. Human-facing resume numbers and short IDs remain conversation-scoped navigation aids that AKK resolves to the complete native thread ID before the structured action. Orphan close retains `expected_message_id` or `expected_transition_id` because those are entity identities, not opaque authority tokens. The plugin/CLI derives and revalidates all freshness fences privately under the canonical locks. Store format remains 1 and writer protocol remains 5.
265
+ The top-level v19 action contracts include `watch` and `unwatch` as well as `send`, manual `approve`, `native_inspect`, `list_resumable_threads`, `new_thread`, `resume_thread`, and conflict-only `reconcile_binding`. Their model-facing mutation shapes are deliberately small: `watch({terminal_id})`; `send({session_id|terminal_id,request})` with the targets mutually exclusive; managed `approve({turn_id})` or terminal-scoped `approve({terminal_id})`; `native_inspect({terminal_id,inspection})`; `new_thread({terminal_id})`; `resume_thread({terminal_id,native_thread_id})`; and `reconcile_binding({terminal_id,conflicting_session_id})`. The listed Send scope distinguishes managed delivery from `terminal_user_explicit`; the latter is gated by physical prompt safety, not AKK management health, and an unmanaged fallback has no callback. Approval, handoff takeover, and reconciliation require explicit user confirmation, but none transports a token, revision, binding ID/generation, candidate fence, handoff-only live-native-UUID fence, or approval fingerprint through the model. `native_thread_id` remains the intentional semantic identity for resume. `watch` returns a `watch_id`; Watch status and `unwatch` use only that ID. Human-facing resume numbers and short IDs remain conversation-scoped navigation aids that AKK resolves to the complete native thread ID before the structured action. Orphan close retains `expected_message_id` or `expected_transition_id` because those are entity identities, not opaque authority tokens. The plugin/CLI derives and revalidates all freshness fences privately under the canonical locks. Store format remains 1 and writer protocol remains 5.
266
266
 
267
267
  Workspace is not a routing boundary. AKK can list, inspect, and control verified panes across projects; when more than one target matches, choose one listed `terminal_id` for a structured tool or one listed selector for a slash command.
268
268
 
@@ -1,6 +1,6 @@
1
- import { createCallbackOutboxService, type ApprovalNotificationPreparationInput, type CallbackDeliveryReconciliationInput, type CallbackExecutionResult, type CallbackOutboxServicePorts, type CallbackPreparationOptions, type CallbackRetryMonitorInput, type PreparedCallback, type TerminalCompletionPreparationInput } from "./callback-outbox-service.js";
2
- import type { CallbackRetryDisposition } from "./callback-outbox-policy.js";
3
- import { type CallbackProcessDelivery, type DeliverChatSendInput, type DeliverGatewayMethodInput } from "./openclaw-callback-transport.js";
1
+ import { createCallbackOutboxService, type ApprovalNotificationPreparationInput, type CallbackDeliveryReconciliationInput, type CallbackExecutionResult, type CallbackOutboxServicePorts, type CallbackPreparationOptions, type CallbackRetryMonitorInput, type PreparedCallback, type StallNotificationPreparationInput, type TerminalCompletionPreparationInput } from "./callback-outbox-service.js";
2
+ import type { CallbackRetryDisposition, DeliverCallbackInput } from "./callback-outbox-policy.js";
3
+ import { type CallbackTransport, type CallbackTransportDeliverInput } from "./callback-transport.js";
4
4
  import { type Conversation } from "./protocol.js";
5
5
  import type { TranscriptEvent } from "./transcript.js";
6
6
  export type CallbackCliOptions = Omit<CallbackPreparationOptions, "statePath"> & {
@@ -9,6 +9,7 @@ export type CallbackCliOptions = Omit<CallbackPreparationOptions, "statePath"> &
9
9
  statePath?: string;
10
10
  [option: string]: unknown;
11
11
  };
12
+ type ResolvedCallbackTransportDelivery = Omit<CallbackTransportDeliverInput, "reportCheckpoint">;
12
13
  export interface CallbackCliDependencies {
13
14
  state: {
14
15
  acquireFileLock(lockPath: string): () => void;
@@ -22,8 +23,11 @@ export interface CallbackCliDependencies {
22
23
  };
23
24
  authority: CallbackOutboxServicePorts["authority"];
24
25
  retry: CallbackOutboxServicePorts["retry"];
26
+ delivery: {
27
+ transport: CallbackTransport;
28
+ resolve(input: DeliverCallbackInput): ResolvedCallbackTransportDelivery;
29
+ };
25
30
  runtime: {
26
- classifyProcessFailure(delivery: CallbackProcessDelivery): string | undefined;
27
31
  textSummary(value: unknown): unknown;
28
32
  };
29
33
  }
@@ -35,13 +39,12 @@ export interface CallbackCliFacade {
35
39
  reconcileDelivery(input: CallbackDeliveryReconciliationInput): ReturnType<CallbackOutboxService["reconcileDelivery"]>;
36
40
  runRetryMonitor(input: CallbackRetryMonitorInput): void;
37
41
  prepareApprovalNotification(input: ApprovalNotificationPreparationInput): ReturnType<CallbackOutboxService["prepareApprovalNotification"]>;
42
+ prepareStallNotification(input: StallNotificationPreparationInput): ReturnType<CallbackOutboxService["prepareStallNotification"]>;
38
43
  prepareTerminalCompletion(input: TerminalCompletionPreparationInput): ReturnType<CallbackOutboxService["prepareTerminalCompletion"]>;
39
44
  runPrepared(prepared: PreparedCallback, options?: {
40
45
  emit?: boolean;
41
46
  }): CallbackExecutionResult;
42
47
  emitPreparedResult(result: CallbackExecutionResult): void;
43
- deliverGatewayMethod(input: DeliverGatewayMethodInput): CallbackProcessDelivery;
44
- deliverChatSend(input: DeliverChatSendInput): CallbackProcessDelivery;
45
48
  }
46
49
  export declare function createCallbackCliFacade(dependencies: CallbackCliDependencies): CallbackCliFacade;
47
50
  export {};
@@ -2,11 +2,11 @@
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import path from "node:path";
4
4
  import { createCallbackOutboxService } from "./callback-outbox-service.js";
5
- import { createOpenClawCallbackTransport } from "./openclaw-callback-transport.js";
5
+ import { parseCallbackAttemptOutcome } from "./callback-transport.js";
6
6
  import { budgetAction } from "./protocol.js";
7
- import { redactString } from "./runtime-log.js";
8
7
  import { appendEvent, assertStoreWriterCompatible, loadState, logPathForStatePath, messageEvent, pathsForConversationDir, saveState } from "./store.js";
9
- import { expandHome, redactCliOutput, writeCliJson } from "./cli-command-runtime.js";
8
+ import { nonBlankString, recordValue } from "./value-guards.js";
9
+ import { expandHome, writeCliJson } from "./cli-command-runtime.js";
10
10
  import { cliEnv, cliExit, cliNow, cliNowMs, cliPid, cliRuntimeLog, cliSleepSync } from "./cli-runtime-context.js";
11
11
  const callbackCliContext = new AsyncLocalStorage();
12
12
  function callbackRuntime() {
@@ -58,6 +58,118 @@ function runCallbackTransaction(options) {
58
58
  });
59
59
  return runPreparedCallback(prepared);
60
60
  }
61
+ function deliverCallbackViaTransport(input) {
62
+ const runtime = callbackRuntime();
63
+ let resolved;
64
+ try {
65
+ resolved = runtime.delivery.resolve(input);
66
+ }
67
+ catch {
68
+ return callbackDeliveryOutcome(undefined, {
69
+ disposition: "permanent_failure",
70
+ error_code: "callback_route_resolution_failed"
71
+ });
72
+ }
73
+ let acceptedCheckpoint;
74
+ let invalidCheckpoint = false;
75
+ const reportCheckpoint = (value) => {
76
+ let outcome;
77
+ try {
78
+ outcome = parseCallbackAttemptOutcome(value);
79
+ }
80
+ catch {
81
+ invalidCheckpoint = true;
82
+ return;
83
+ }
84
+ const delivery = callbackDeliveryOutcome(resolved.route, outcome);
85
+ if (outcome.disposition === "accepted") {
86
+ acceptedCheckpoint = outcome;
87
+ input.onAccepted?.(delivery);
88
+ }
89
+ input.onProgress?.({
90
+ stage: "transport_checkpoint",
91
+ ...delivery
92
+ });
93
+ };
94
+ let value;
95
+ try {
96
+ value = runtime.delivery.transport.deliver({
97
+ ...resolved,
98
+ reportCheckpoint
99
+ });
100
+ }
101
+ catch {
102
+ return callbackDeliveryOutcome(resolved.route, acceptedCheckpoint ?? callbackTransportContractViolation());
103
+ }
104
+ let outcome;
105
+ try {
106
+ outcome = parseCallbackAttemptOutcome(value);
107
+ }
108
+ catch {
109
+ outcome = acceptedCheckpoint ?? callbackTransportContractViolation();
110
+ }
111
+ if (acceptedCheckpoint && outcome.disposition !== "accepted") {
112
+ outcome = acceptedCheckpoint;
113
+ }
114
+ else if (invalidCheckpoint && outcome.disposition !== "accepted") {
115
+ outcome = callbackTransportContractViolation();
116
+ }
117
+ return callbackDeliveryOutcome(resolved.route, outcome);
118
+ }
119
+ function callbackTransportContractViolation() {
120
+ return {
121
+ disposition: "uncertain",
122
+ error_code: "callback_transport_contract_violation",
123
+ observed_at: cliNow().toISOString()
124
+ };
125
+ }
126
+ function callbackDeliveryOutcome(route, outcome) {
127
+ const legacyDelivery = legacyCallbackDelivery(outcome);
128
+ if (legacyDelivery) {
129
+ return { ...legacyDelivery, attempt_outcome: outcome };
130
+ }
131
+ const accepted = outcome.disposition === "accepted";
132
+ const uncertain = outcome.disposition === "uncertain";
133
+ const errorCode = accepted ? undefined : outcome.error_code;
134
+ const injectionStatus = outcomeEvidenceString(outcome, "injection_status") ?? (accepted ? "accepted" : uncertain ? "uncertain" : "failed");
135
+ const wakeStatus = outcomeEvidenceString(outcome, "wake_status") ??
136
+ (accepted ? "not_required" : "not_attempted");
137
+ return {
138
+ kind: outcomeEvidenceString(outcome, "delivery_kind") ??
139
+ route?.transport ?? "callback_transport",
140
+ injection: {
141
+ status: injectionStatus,
142
+ ...(accepted
143
+ ? {
144
+ accepted_at: outcome.accepted_at
145
+ }
146
+ : { error_code: errorCode })
147
+ },
148
+ wake: {
149
+ status: wakeStatus
150
+ },
151
+ attempt_outcome: outcome
152
+ };
153
+ }
154
+ function legacyCallbackDelivery(outcome) {
155
+ const value = recordValue(outcome.evidence?.legacy_delivery);
156
+ const kind = nonBlankString(value?.kind);
157
+ const injection = recordValue(value?.injection);
158
+ const wake = recordValue(value?.wake);
159
+ const runObservation = recordValue(value?.run_observation);
160
+ if (!kind || !injection || !wake)
161
+ return undefined;
162
+ return {
163
+ kind,
164
+ injection,
165
+ wake,
166
+ ...(runObservation ? { run_observation: runObservation } : {})
167
+ };
168
+ }
169
+ function outcomeEvidenceString(outcome, field) {
170
+ const value = outcome.evidence?.[field];
171
+ return typeof value === "string" && value.trim() ? value : undefined;
172
+ }
61
173
  function callbackOutboxService() {
62
174
  const runtime = callbackRuntime();
63
175
  return createCallbackOutboxService({
@@ -76,6 +188,7 @@ function callbackOutboxService() {
76
188
  releaseState();
77
189
  }
78
190
  },
191
+ withWriter: runtime.state.withWriter,
79
192
  storeDirForStatePath: callbackStoreDir, logPathForStatePath
80
193
  },
81
194
  authority: runtime.authority,
@@ -90,7 +203,7 @@ function callbackOutboxService() {
90
203
  }
91
204
  }
92
205
  },
93
- delivery: { deliver: (input) => openClawCallbackTransport().deliverCallback(input),
206
+ delivery: { deliver: deliverCallbackViaTransport,
94
207
  runTransaction: runCallbackTransaction }
95
208
  });
96
209
  }
@@ -114,29 +227,6 @@ function runPreparedCallback(prepared, { emit = true } = {}) {
114
227
  emitPreparedCallbackResult(result);
115
228
  return result;
116
229
  }
117
- function recordCallbackProcessDelivery(observation) {
118
- const { logPath, conversation, message, event, runtimeEvent, delivery } = observation;
119
- const detail = observation.detail ?? {};
120
- appendEvent(logPath, {
121
- ts: cliNow().toISOString(), conversation_id: conversation.conversation_id,
122
- event, from: message.from, to: "openclaw", round: message.round, ...detail,
123
- status: delivery.status, stdout: redactString(delivery.stdout),
124
- stderr: redactString(delivery.stderr)
125
- });
126
- cliRuntimeLog("info", runtimeEvent, {
127
- conversation_id: conversation.conversation_id, ...detail,
128
- status: delivery.status,
129
- failure_kind: callbackRuntime().runtime.classifyProcessFailure(delivery),
130
- stdout: callbackRuntime().runtime.textSummary(delivery.stdout),
131
- stderr: callbackRuntime().runtime.textSummary(delivery.stderr)
132
- });
133
- }
134
- function openClawCallbackTransport() {
135
- return createOpenClawCallbackTransport({
136
- now: cliNow, environment: cliEnv, redactConversation: redactCliOutput,
137
- recordCallbackProcessDelivery
138
- });
139
- }
140
230
  export function createCallbackCliFacade(dependencies) {
141
231
  const call = (operation) => callbackCliContext.run(dependencies, operation);
142
232
  return Object.freeze({
@@ -146,11 +236,10 @@ export function createCallbackCliFacade(dependencies) {
146
236
  reconcileDelivery: (input) => call(() => callbackOutboxService().reconcileDelivery(input)),
147
237
  runRetryMonitor: (input) => call(() => callbackOutboxService().runRetryMonitor(input)),
148
238
  prepareApprovalNotification: (input) => call(() => callbackOutboxService().prepareApprovalNotification(input)),
239
+ prepareStallNotification: (input) => call(() => callbackOutboxService().prepareStallNotification(input)),
149
240
  prepareTerminalCompletion: (input) => call(() => callbackOutboxService().prepareTerminalCompletion(input)),
150
241
  runPrepared: (prepared, options) => call(() => runPreparedCallback(prepared, options)),
151
- emitPreparedResult: (result) => call(() => emitPreparedCallbackResult(result)),
152
- deliverGatewayMethod: (input) => call(() => openClawCallbackTransport().deliverGatewayMethod(input)),
153
- deliverChatSend: (input) => call(() => openClawCallbackTransport().deliverChatSend(input))
242
+ emitPreparedResult: (result) => call(() => emitPreparedCallbackResult(result))
154
243
  });
155
244
  }
156
245
  //# sourceMappingURL=callback-cli-adapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"callback-cli-adapter.js","sourceRoot":"","sources":["../../src/callback-cli-adapter.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,2BAA2B,EAK5B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,+BAA+B,EAIhC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAqB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,WAAW,EAAE,2BAA2B,EAAE,SAAS,EAAE,mBAAmB,EACxE,YAAY,EAAE,uBAAuB,EAAE,SAAS,EACjD,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,MAClD,0BAA0B,CAAC;AAC7B,OAAO,EACL,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EACxD,YAAY,EACb,MAAM,0BAA0B,CAAC;AA0ClC,MAAM,kBAAkB,GAAG,IAAI,iBAAiB,EAA2B,CAAC;AAC5E,SAAS,eAAe;IACtB,MAAM,OAAO,GAAG,kBAAk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AE,CAAC,IAAI,CAAC,GAAG,EAAE,CAC5C,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzC,kBAAkB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;KAC/E,CAAC,CAAC;AACL,CAAC"}
@@ -1,9 +1,13 @@
1
1
  import type { AgentMessage, Conversation } from "./protocol.js";
2
+ import { type CallbackAttemptOutcome, type CallbackEnvelopeV1, type CallbackRouteV1, type CallbackTransportAttemptV1 } from "./callback-transport.js";
3
+ export type { CallbackAttemptOutcome, CallbackEnvelopeV1, CallbackRouteV1 } from "./callback-transport.js";
2
4
  export interface CallbackDeliveryOutcome {
3
5
  kind: string;
4
6
  injection: Record<string, unknown>;
5
7
  wake: Record<string, unknown>;
6
8
  run_observation?: Record<string, unknown>;
9
+ /** Generic evidence written alongside the legacy OpenClaw shape. */
10
+ attempt_outcome?: CallbackAttemptOutcome;
7
11
  }
8
12
  export interface CallbackProcessFailureObservation {
9
13
  status?: number | null;
@@ -13,8 +17,28 @@ export interface CallbackProcessFailureObservation {
13
17
  message?: string;
14
18
  };
15
19
  }
20
+ /**
21
+ * Fence an advisory outbox when its underlying Turn moves on. Accepted
22
+ * transport evidence is retained for settlement; only unaccepted work is
23
+ * superseded so a late retry cannot notify the previous lifecycle phase.
24
+ */
25
+ export declare function supersedeCallbackNotificationDelivery(conversation: Conversation, input: {
26
+ at: string;
27
+ reason: string;
28
+ }): Conversation;
29
+ /**
30
+ * Explicit Close releases AKK's management of the Turn. Fence both durable
31
+ * callback lanes unless the host has already accepted the transport. A
32
+ * transport-start marker is retained as audit evidence, but never authorizes a
33
+ * retry after Close.
34
+ */
35
+ export declare function supersedeUnacceptedCallbackDeliveries(conversation: Conversation, input: {
36
+ at: string;
37
+ reason: string;
38
+ }): Conversation;
16
39
  export declare function classifyCallbackProcessFailure(result: CallbackProcessFailureObservation): string | undefined;
17
40
  export interface CallbackDeliveryOptions {
41
+ callbackRoute?: CallbackRouteV1;
18
42
  gatewayMethod?: string;
19
43
  openclawBin?: string;
20
44
  gatewayUrl?: string;
@@ -28,6 +52,10 @@ export interface DeliverCallbackInput {
28
52
  logPath: string;
29
53
  conversation: Conversation;
30
54
  message: AgentMessage;
55
+ /** Immutable prepared outbox claim crossing the transport boundary. */
56
+ attempt: CallbackTransportAttemptV1;
57
+ route?: CallbackRouteV1;
58
+ envelope?: CallbackEnvelopeV1;
31
59
  onProgress?: (progress: Record<string, unknown>) => void;
32
60
  onAccepted?: (outcome: CallbackDeliveryOutcome) => void;
33
61
  }
@@ -43,6 +71,14 @@ export type CallbackRetryDisposition = {
43
71
  } | {
44
72
  state: "accepted";
45
73
  attempt: number;
74
+ } | {
75
+ state: "permanent_failure";
76
+ attempt: number;
77
+ reason: string;
78
+ } | {
79
+ state: "uncertain";
80
+ attempt: number;
81
+ reason: string;
46
82
  } | {
47
83
  state: "exhausted";
48
84
  attempt: number;
@@ -61,6 +97,7 @@ export type CallbackRetryPolicyState = {
61
97
  effective_lease_expires_at_ms?: number;
62
98
  persisted_lease_expires_at?: string;
63
99
  next_attempt_at?: string;
100
+ transport_started_without_outcome?: true;
64
101
  } | {
65
102
  phase: "observe_clock";
66
103
  attempt: number;
@@ -68,6 +105,7 @@ export type CallbackRetryPolicyState = {
68
105
  effective_lease_expires_at_ms: number;
69
106
  persisted_lease_expires_at?: string;
70
107
  next_attempt_at?: string;
108
+ transport_started_without_outcome?: true;
71
109
  };
72
110
  export type CallbackRetryObservation = {
73
111
  kind: "process_alive";
@@ -93,3 +131,4 @@ export declare function beginCallbackRetryPolicy(callbackDelivery: unknown, limi
93
131
  */
94
132
  export declare function reduceCallbackRetryPolicy(state: CallbackRetryPolicyState, observation: CallbackRetryObservation): CallbackRetryPolicyState;
95
133
  export declare function callbackDeliveryHasAcceptedTransport(callbackDelivery: unknown): boolean;
134
+ export declare function callbackDeliveryAttemptOutcome(callbackDelivery: unknown): CallbackAttemptOutcome | undefined;