@scotthuang/agent-knock-knock 0.12.13 → 0.12.14
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.
- package/CHANGELOG.md +18 -0
- package/README.md +5 -5
- package/dist/src/callback-cli-adapter.d.ts +9 -6
- package/dist/src/callback-cli-adapter.js +119 -30
- package/dist/src/callback-cli-adapter.js.map +1 -1
- package/dist/src/callback-outbox-policy.d.ts +39 -0
- package/dist/src/callback-outbox-policy.js +163 -6
- package/dist/src/callback-outbox-policy.js.map +1 -1
- package/dist/src/callback-outbox-service.d.ts +28 -1
- package/dist/src/callback-outbox-service.js +413 -82
- package/dist/src/callback-outbox-service.js.map +1 -1
- package/dist/src/callback-outbox-settlement.d.ts +14 -1
- package/dist/src/callback-outbox-settlement.js +151 -30
- package/dist/src/callback-outbox-settlement.js.map +1 -1
- package/dist/src/callback-route-authority.d.ts +59 -0
- package/dist/src/callback-route-authority.js +123 -0
- package/dist/src/callback-route-authority.js.map +1 -0
- package/dist/src/callback-transport.d.ts +134 -0
- package/dist/src/callback-transport.js +256 -0
- package/dist/src/callback-transport.js.map +1 -0
- package/dist/src/cli-core.js +17 -4
- package/dist/src/cli-core.js.map +1 -1
- package/dist/src/codex-lifecycle-compatibility.js +2 -1
- package/dist/src/codex-lifecycle-compatibility.js.map +1 -1
- package/dist/src/deferred-foreground-application-service.d.ts +18 -0
- package/dist/src/deferred-foreground-application-service.js +72 -0
- package/dist/src/deferred-foreground-application-service.js.map +1 -1
- package/dist/src/deferred-foreground-authority-cli-adapter.js +2 -1
- package/dist/src/deferred-foreground-authority-cli-adapter.js.map +1 -1
- package/dist/src/deferred-foreground-recovery-cli-adapter.d.ts +1 -1
- package/dist/src/deferred-foreground-recovery-cli-adapter.js +108 -37
- package/dist/src/deferred-foreground-recovery-cli-adapter.js.map +1 -1
- package/dist/src/deferred-foreground-recovery-service.d.ts +1 -1
- package/dist/src/deferred-foreground-recovery-service.js +10 -3
- package/dist/src/deferred-foreground-recovery-service.js.map +1 -1
- package/dist/src/deferred-foreground-transfer-policy.d.ts +1 -1
- package/dist/src/deferred-foreground-transfer-policy.js +3 -2
- package/dist/src/deferred-foreground-transfer-policy.js.map +1 -1
- package/dist/src/deferred-foreground-transfer.d.ts +17 -1
- package/dist/src/deferred-foreground-transfer.js +244 -35
- package/dist/src/deferred-foreground-transfer.js.map +1 -1
- package/dist/src/deferred-foreground-user-close.d.ts +18 -0
- package/dist/src/deferred-foreground-user-close.js +180 -0
- package/dist/src/deferred-foreground-user-close.js.map +1 -0
- package/dist/src/openclaw-callback-transport.d.ts +4 -1
- package/dist/src/openclaw-callback-transport.js +403 -10
- package/dist/src/openclaw-callback-transport.js.map +1 -1
- package/dist/src/openclaw-managed-callback-cli-adapter.d.ts +23 -0
- package/dist/src/openclaw-managed-callback-cli-adapter.js +77 -0
- package/dist/src/openclaw-managed-callback-cli-adapter.js.map +1 -0
- package/dist/src/openclaw-plugin-command-adapter.js +28 -31
- package/dist/src/openclaw-plugin-command-adapter.js.map +1 -1
- package/dist/src/openclaw-plugin-helpers.js +8 -0
- package/dist/src/openclaw-plugin-helpers.js.map +1 -1
- package/dist/src/openclaw-plugin-schemas.d.ts +20 -1
- package/dist/src/openclaw-plugin-schemas.js +26 -2
- package/dist/src/openclaw-plugin-schemas.js.map +1 -1
- package/dist/src/protocol.d.ts +3 -0
- package/dist/src/protocol.js +4 -0
- package/dist/src/protocol.js.map +1 -1
- package/dist/src/store.d.ts +9 -0
- package/dist/src/store.js +79 -1
- package/dist/src/store.js.map +1 -1
- package/dist/src/terminal-acceptance-cli-adapter.d.ts +2 -0
- package/dist/src/terminal-acceptance-cli-adapter.js +62 -12
- package/dist/src/terminal-acceptance-cli-adapter.js.map +1 -1
- package/dist/src/terminal-action-projection.d.ts +1 -2
- package/dist/src/terminal-action-projection.js +4 -5
- package/dist/src/terminal-action-projection.js.map +1 -1
- package/dist/src/terminal-agent-bridge.d.ts +82 -0
- package/dist/src/terminal-agent-bridge.js +539 -111
- package/dist/src/terminal-agent-bridge.js.map +1 -1
- package/dist/src/terminal-command-cli-adapter.d.ts +9 -0
- package/dist/src/terminal-command-cli-adapter.js +2130 -5
- package/dist/src/terminal-command-cli-adapter.js.map +1 -1
- package/dist/src/terminal-dispatch-application.d.ts +4 -1
- package/dist/src/terminal-dispatch-application.js +11 -2
- package/dist/src/terminal-dispatch-application.js.map +1 -1
- package/dist/src/terminal-dispatch-execution.js +3 -1
- package/dist/src/terminal-dispatch-execution.js.map +1 -1
- package/dist/src/terminal-dispatch-ledger-codec.d.ts +3 -0
- package/dist/src/terminal-dispatch-ledger-codec.js +46 -19
- package/dist/src/terminal-dispatch-ledger-codec.js.map +1 -1
- package/dist/src/terminal-dispatch-presenter.js +5 -3
- package/dist/src/terminal-dispatch-presenter.js.map +1 -1
- package/dist/src/terminal-dispatch-receipt.d.ts +3 -0
- package/dist/src/terminal-dispatch-receipt.js +15 -1
- package/dist/src/terminal-dispatch-receipt.js.map +1 -1
- package/dist/src/terminal-dispatch-recovery-cli-adapter.js +68 -7
- package/dist/src/terminal-dispatch-recovery-cli-adapter.js.map +1 -1
- package/dist/src/terminal-dispatch-recovery-service.d.ts +2 -0
- package/dist/src/terminal-dispatch-recovery-service.js +9 -0
- package/dist/src/terminal-dispatch-recovery-service.js.map +1 -1
- package/dist/src/terminal-identity-authority-cli-adapter.d.ts +2 -0
- package/dist/src/terminal-identity-authority-cli-adapter.js +30 -27
- package/dist/src/terminal-identity-authority-cli-adapter.js.map +1 -1
- package/dist/src/terminal-list-cli-adapter.d.ts +1 -0
- package/dist/src/terminal-list-cli-adapter.js +50 -31
- package/dist/src/terminal-list-cli-adapter.js.map +1 -1
- package/dist/src/terminal-list-renderer.d.ts +9 -1
- package/dist/src/terminal-list-renderer.js +219 -98
- package/dist/src/terminal-list-renderer.js.map +1 -1
- package/dist/src/terminal-maintenance-cli-adapter.js +253 -326
- package/dist/src/terminal-maintenance-cli-adapter.js.map +1 -1
- package/dist/src/terminal-monitor-application-service.d.ts +5 -0
- package/dist/src/terminal-monitor-application-service.js +5 -0
- package/dist/src/terminal-monitor-application-service.js.map +1 -1
- package/dist/src/terminal-monitor-cli-adapter.d.ts +25 -1
- package/dist/src/terminal-monitor-cli-adapter.js +170 -27
- package/dist/src/terminal-monitor-cli-adapter.js.map +1 -1
- package/dist/src/terminal-monitor-reconciliation-eligibility.d.ts +1 -1
- package/dist/src/terminal-monitor-reconciliation-eligibility.js +220 -32
- package/dist/src/terminal-monitor-reconciliation-eligibility.js.map +1 -1
- package/dist/src/terminal-monitor-state-cli-adapter.d.ts +1 -1
- package/dist/src/terminal-monitor-state-cli-adapter.js +808 -147
- package/dist/src/terminal-monitor-state-cli-adapter.js.map +1 -1
- package/dist/src/terminal-monitor-state-reconciliation-service.d.ts +2 -1
- package/dist/src/terminal-monitor-state-reconciliation-service.js +12 -0
- package/dist/src/terminal-monitor-state-reconciliation-service.js.map +1 -1
- package/dist/src/terminal-monitor-supervision-cli-adapter.d.ts +2 -0
- package/dist/src/terminal-monitor-supervision-cli-adapter.js +31 -11
- package/dist/src/terminal-monitor-supervision-cli-adapter.js.map +1 -1
- package/dist/src/terminal-status-cli-adapter.d.ts +1 -0
- package/dist/src/terminal-status-cli-adapter.js +30 -28
- package/dist/src/terminal-status-cli-adapter.js.map +1 -1
- package/dist/src/terminal-submission-acceptance.js +78 -25
- package/dist/src/terminal-submission-acceptance.js.map +1 -1
- package/dist/src/terminal-submission-retry-service.d.ts +114 -0
- package/dist/src/terminal-submission-retry-service.js +589 -0
- package/dist/src/terminal-submission-retry-service.js.map +1 -0
- package/dist/src/terminal-watch-callback-cli-adapter.d.ts +10 -2
- package/dist/src/terminal-watch-callback-cli-adapter.js +76 -37
- package/dist/src/terminal-watch-callback-cli-adapter.js.map +1 -1
- package/dist/src/terminal-watch-cli-adapter.js +41 -17
- package/dist/src/terminal-watch-cli-adapter.js.map +1 -1
- package/dist/src/terminal-watch-service.d.ts +11 -6
- package/dist/src/terminal-watch-service.js +210 -41
- package/dist/src/terminal-watch-service.js.map +1 -1
- package/dist/src/terminal-watch-store.d.ts +23 -0
- package/dist/src/terminal-watch-store.js +162 -4
- package/dist/src/terminal-watch-store.js.map +1 -1
- package/docs/quickstart-tmux.md +1 -1
- package/package.json +1 -1
- package/templates/openclaw-skills/agent-knock-knock/SKILL.md +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.14 - 2026-08-24
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add an exact Codex `0.149.1` native lifecycle and `/status` inspection profile, retaining fail-closed handling for adjacent and future unverified versions.
|
|
8
|
+
- Add a versioned, host-neutral callback route and transport boundary with durable routing and idempotency authority while retaining OpenClaw as the concrete host adapter.
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- 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.
|
|
13
|
+
- Safely recover eligible uncertain Send submissions through exact one-shot retry and reconciliation without replaying accepted input or replacing the original request.
|
|
14
|
+
- 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.
|
|
15
|
+
|
|
16
|
+
### Security
|
|
17
|
+
|
|
18
|
+
- 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.
|
|
19
|
+
- 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.
|
|
20
|
+
|
|
3
21
|
## 0.12.13 - 2026-08-22
|
|
4
22
|
|
|
5
23
|
### Added
|
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ terminal resource / process incarnation
|
|
|
91
91
|
|
|
92
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.
|
|
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.
|
|
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. 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.
|
|
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
|
|
|
@@ -99,11 +99,11 @@ The private approval fence remains prompt-scoped. AKK hashes the adapter-isolate
|
|
|
99
99
|
|
|
100
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.
|
|
101
101
|
|
|
102
|
-
An exact human switch while the old Session still has one active Turn is a decision point, not an automatic redirect.
|
|
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
|
|
|
@@ -254,7 +254,7 @@ 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.
|
|
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. 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
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.
|
|
260
260
|
|
|
@@ -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
|
|
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 {
|
|
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 {
|
|
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:
|
|
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,
|
|
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,EAM5B,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EACL,2BAA2B,EAK5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAqB,MAAM,eAAe,CAAC;AAChE,OAAO,EACL,WAAW,EAAE,2BAA2B,EAAE,SAAS,EAAE,mBAAmB,EACxE,YAAY,EAAE,uBAAuB,EAAE,SAAS,EACjD,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MACjC,0BAA0B,CAAC;AAC7B,OAAO,EACL,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EACxD,YAAY,EACb,MAAM,0BAA0B,CAAC;AA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come, 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;
|