@scotthuang/agent-knock-knock 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +18 -8
- package/dist/src/agent-session-provider.d.ts +1 -1
- package/dist/src/claude-local-transcript-provider.d.ts +29 -1
- package/dist/src/claude-local-transcript-provider.js +313 -0
- package/dist/src/claude-local-transcript-provider.js.map +1 -1
- package/dist/src/claude-terminal-agent-adapter.d.ts +6 -1
- package/dist/src/claude-terminal-agent-adapter.js +178 -0
- package/dist/src/claude-terminal-agent-adapter.js.map +1 -1
- package/dist/src/cli.js +4745 -355
- package/dist/src/cli.js.map +1 -1
- package/dist/src/codex-local-session-provider.d.ts +2 -2
- package/dist/src/codex-local-session-provider.js +2 -2
- package/dist/src/codex-local-session-provider.js.map +1 -1
- package/dist/src/codex-store-adapter.d.ts +11 -3
- package/dist/src/codex-store-adapter.js +371 -4
- package/dist/src/codex-store-adapter.js.map +1 -1
- package/dist/src/codex-terminal-agent-adapter.d.ts +6 -1
- package/dist/src/codex-terminal-agent-adapter.js +192 -0
- package/dist/src/codex-terminal-agent-adapter.js.map +1 -1
- package/dist/src/managed-session.d.ts +163 -0
- package/dist/src/managed-session.js +873 -0
- package/dist/src/managed-session.js.map +1 -0
- package/dist/src/native-thread-lifecycle-policy.d.ts +57 -0
- package/dist/src/native-thread-lifecycle-policy.js +116 -0
- package/dist/src/native-thread-lifecycle-policy.js.map +1 -0
- package/dist/src/openclaw-plugin-helpers.d.ts +31 -6
- package/dist/src/openclaw-plugin-helpers.js +226 -9
- package/dist/src/openclaw-plugin-helpers.js.map +1 -1
- package/dist/src/openclaw-plugin.js +238 -23
- package/dist/src/openclaw-plugin.js.map +1 -1
- package/dist/src/protocol.d.ts +6 -0
- package/dist/src/protocol.js.map +1 -1
- package/dist/src/session-store.d.ts +57 -0
- package/dist/src/session-store.js +529 -0
- package/dist/src/session-store.js.map +1 -0
- package/dist/src/store.d.ts +2 -1
- package/dist/src/store.js +233 -21
- package/dist/src/store.js.map +1 -1
- package/dist/src/terminal-agent-adapter.d.ts +153 -0
- package/dist/src/terminal-agent-adapter.js +12 -0
- package/dist/src/terminal-agent-adapter.js.map +1 -1
- package/dist/src/terminal-agent-bridge.d.ts +8 -0
- package/dist/src/terminal-agent-bridge.js +15 -0
- package/dist/src/terminal-agent-bridge.js.map +1 -1
- package/dist/src/terminal-control-provider.d.ts +2 -0
- package/dist/src/terminal-control-provider.js +1 -0
- package/dist/src/terminal-control-provider.js.map +1 -1
- package/docs/quickstart-tmux.md +12 -1
- package/openclaw.plugin.json +14 -2
- package/package.json +1 -1
- package/templates/openclaw-skills/agent-knock-knock/SKILL.md +23 -5
|
@@ -26,11 +26,14 @@ Core slash-command forms:
|
|
|
26
26
|
- `/akk <task>`: send a new task only when exactly one eligible idle coding-agent pane exists across all workspaces.
|
|
27
27
|
- `/akk <selector>: <message>`: resolve one exact eligible AKK session and create a new Turn for the message.
|
|
28
28
|
- `/akk list`: list live coding-agent terminals with their current or recent managed-turn context.
|
|
29
|
+
- `/akk threads <exact-terminal-id>`: list verified native threads that may be resumed in one exact terminal.
|
|
30
|
+
- `/akk new-thread <exact-terminal-id>` or `/akk clear-thread <exact-terminal-id>`: switch that idle terminal to a verified clean native context without creating a Turn.
|
|
31
|
+
- `/akk resume-thread <exact-terminal-id> [native-thread-uuid]`: list candidates when the UUID is omitted, or resume one exact returned native thread without creating a Turn.
|
|
29
32
|
- `/akk status [turn-selector]`: inspect one live terminal or exact managed Turn.
|
|
30
33
|
- `/akk respond <turn-selector>: <answer>`: answer a coding-agent question inside a `waiting_for_openclaw` Turn.
|
|
31
34
|
- `/akk cancel <turn-selector>`: interrupt the exact Turn without closing its tmux pane.
|
|
32
35
|
|
|
33
|
-
For human-facing slash forms, a selector may be `codex`, `claude`, `only`, `latest`, or an `@short-ref` returned by `AKK list`. These selectors are only a resolution layer and fail closed when the target is missing or ambiguous. Once an AKK session exists, plugin actions prefill the authoritative full `session_id` for ordinary send or `turn_id` for respond and managed controls.
|
|
36
|
+
For human-facing ordinary-send slash forms, a selector may be `codex`, `claude`, `only`, `latest`, or an `@short-ref` returned by `AKK list`. These selectors are only a resolution layer and fail closed when the target is missing or ambiguous. A natural-language tool call may preserve a selector explicitly named by the user; otherwise use a list-prefilled selector or omit it and require a unique pane. Never pass a selector as `session_id` or `turn_id`. Native-thread slash commands are stricter: copy the full `terminal_id` returned by `/akk list`, not its `@short-ref`. The slash handler reads a fresh lifecycle snapshot and immediately supplies its compare-and-swap binding token internally; the human never copies that token. Once an AKK session exists, plugin actions prefill the authoritative full `session_id` for ordinary send or `turn_id` for respond and managed controls. The same raw terminal row may advertise status, approval, cancellation, or orphan-close with its own prefilled `conversation_id` compatibility selector. Use only the exact returned action; never infer, copy, or reuse compatibility selectors. For every send, AKK must revalidate the selected agent PID and tmux pane identity, confirm that the process and pane working directories match, and verify the idle prompt.
|
|
34
37
|
|
|
35
38
|
AKK discovers eligible panes across workspaces. When more than one target matches, use a selector returned by `AKK list`; never guess based on a workspace name or path.
|
|
36
39
|
|
|
@@ -40,8 +43,12 @@ Natural-language forms:
|
|
|
40
43
|
- `AKK Codex: <task>`: call `agent_knock_knock_send` with `request=<task>` and `selector="codex"`.
|
|
41
44
|
- `AKK Claude: <task>`: call `agent_knock_knock_send` with `request=<task>` and `selector="claude"`.
|
|
42
45
|
- Requests to list AKK or local coding-agent work: call `agent_knock_knock_list`.
|
|
46
|
+
- Requests to list resumable native threads for an exact terminal: call `agent_knock_knock_list_resumable_threads` with the terminal row's prefilled `terminal_id`.
|
|
47
|
+
- Explicit requests to start a new thread or clear context: call `agent_knock_knock_new_thread` only from an advertised `new_thread` action, preserving its exact `terminal_id` and `expected_binding_token`.
|
|
48
|
+
- Explicit requests to resume prior native context: first call `agent_knock_knock_list_resumable_threads`; then call `agent_knock_knock_resume_thread` with the same exact `terminal_id`, the complete UUID and opaque `candidate_token` from one `resumable=true` row, and the `expected_binding_token` from that same result.
|
|
43
49
|
- Requests to inspect current output or ask what a task is doing: call `agent_knock_knock_status`.
|
|
44
50
|
- A later request for an existing listed AKK session: call `agent_knock_knock_send` with its authoritative `session_id` and `request=<message>`; this creates a new Turn in the same native context.
|
|
51
|
+
- Requests to continue the current thread are ordinary sends, not lifecycle actions.
|
|
45
52
|
- An answer to a coding-agent question in a `waiting_for_openclaw` Turn: call `agent_knock_knock_respond` with its authoritative `turn_id` and `request=<answer>`.
|
|
46
53
|
- Requests to stop current work: call `agent_knock_knock_cancel`.
|
|
47
54
|
|
|
@@ -57,12 +64,20 @@ For ordinary send or an in-flight answer:
|
|
|
57
64
|
2. If no ID is supplied and more than one eligible pane may exist, call `agent_knock_knock_list`.
|
|
58
65
|
3. Treat `terminals[]` as the primary resource list. Its managed context exposes `session_id`; `managed.current_turn` is the only current AKK owner, while `managed.recent_turn` and `managed.history` are retained Turn history. Records in `unavailable_managed_turns[]` have no live pane in this snapshot.
|
|
59
66
|
4. Read the selected resource's `available_actions`. Use only an action present there, start with its prefilled authoritative arguments, supply every `missing_required` field, and consult the top-level contract for optional fields.
|
|
60
|
-
5. For an existing managed Session, use `send` with its prefilled `session_id`; it creates a new Turn. For first attach only, use the selected unmanaged raw-terminal row's
|
|
67
|
+
5. For an existing managed Session, use `send` with its prefilled `session_id`; it creates a new Turn. For first attach only, use a discovery selector explicitly named by the user or the selected unmanaged raw-terminal row's prefilled `selector`. Never infer or reuse a selector. Use `respond` with its prefilled `turn_id` only when that Turn is explicitly `waiting_for_openclaw`; the answer stays in the same Turn. Add the text as `request`. Do not add timeout fields for ordinary use; `timeoutSeconds` is unsupported.
|
|
61
68
|
6. If multiple terminals match, show their `short_ref`, agent, and tmux target, then ask the user to choose. Never guess or send to a pane that AKK has not verified as idle.
|
|
62
69
|
|
|
63
70
|
An idle pane is at a verified ready prompt, with no current work or unresolved permission request. A previously completed managed turn alone is not proof that the pane is still idle.
|
|
64
71
|
|
|
65
|
-
Do not treat ordinary send as native clear, new-session, or resume.
|
|
72
|
+
Do not treat ordinary send as native clear, new-session, fork, branch, side thread, status probe, or resume. Do not send `/clear`, `/new`, `/resume`, `/status`, Codex `/fork`, `/side`, `/btw`, Claude `/branch`, or any other first-line native slash command as ordinary task or answer text. Native lifecycle tools own supported keystrokes, capability checks, serialization, identity verification, and binding changes; express other requests in natural language or leave unsupported native commands to a human in tmux. Each successful lifecycle transition creates no Turn.
|
|
73
|
+
|
|
74
|
+
For native-thread lifecycle discovery or mutation:
|
|
75
|
+
|
|
76
|
+
1. Start from the exact terminal row's currently advertised `list_resumable_threads` or `new_thread` action. Listing is read-only, requires only the full `terminal_id`, and creates no Turn.
|
|
77
|
+
2. Before either mutation, `new_thread` or `resume_thread`, the terminal must be verified idle and have no active or unresolved Turn. Preserve the exact `expected_binding_token` from the same current terminal action or lifecycle-list result. Never construct, guess, or reuse it after another terminal action.
|
|
78
|
+
3. For resume, list candidates first and invoke only the `resume_thread` action advertised by one candidate row with `resumable=true`. Preserve that row's complete `native_thread_id` and opaque `candidate_token`; never select by title, preview, recency, or a partial UUID, and never combine values from different snapshots.
|
|
79
|
+
4. Treat mutation success as a Session/native-context transition, not as task delivery. It creates or activates an AKK `session_id`, advances the terminal binding generation, and creates no `turn_id`. The next ordinary send creates the first Turn in that context.
|
|
80
|
+
5. If the agent/version is unsupported, a candidate is ambiguous or active elsewhere, the token is stale, or post-transition identity cannot be verified, fail closed and report the error. Do not fall back to raw terminal commands.
|
|
66
81
|
|
|
67
82
|
Useful examples:
|
|
68
83
|
|
|
@@ -71,6 +86,9 @@ Useful examples:
|
|
|
71
86
|
/akk codex: inspect the repository and summarize it
|
|
72
87
|
/akk @a1b2c3d4: run the focused tests
|
|
73
88
|
/akk list
|
|
89
|
+
/akk threads terminal:v2:tmux:codex:akk-work:0.0:1234
|
|
90
|
+
/akk new-thread terminal:v2:tmux:codex:akk-work:0.0:1234
|
|
91
|
+
/akk resume-thread terminal:v2:tmux:codex:akk-work:0.0:1234 11111111-1111-4111-8111-111111111111
|
|
74
92
|
/akk status only
|
|
75
93
|
/akk respond @a1b2c3d4: use the existing JSON format
|
|
76
94
|
/akk cancel only
|
|
@@ -104,7 +122,7 @@ Use `agent_knock_knock_renew` only when AKK marked the same live terminal Turn `
|
|
|
104
122
|
|
|
105
123
|
Use `agent_knock_knock_retry_callback` only for a `callback_failed` managed turn, for example `/akk retry-callback @a1b2c3d4`.
|
|
106
124
|
|
|
107
|
-
Use `agent_knock_knock_close` only when the user explicitly wants to close AKK's managed record. If `AKK list` reports an orphaned terminal dispatch, inspect the pane first and use the exact `/akk close <terminal-id>
|
|
125
|
+
Use `agent_knock_knock_close` only when the user explicitly wants to close AKK's managed record. If `AKK list` reports an orphaned terminal dispatch or lifecycle transition, inspect the pane first and use the exact `/akk close <terminal-id> ...` recovery command it returns. That command contains exactly one fresh `--expected-message-id <id>` or `--expected-transition-id <id>` fence. Never invent, substitute, or reuse the fence. Closing a managed record does not close the coding agent or tmux pane.
|
|
108
126
|
|
|
109
127
|
Use `/akk doctor` only for installation checks or troubleshooting.
|
|
110
128
|
|
|
@@ -133,7 +151,7 @@ A trusted, default-disabled plugin `autoApprove` policy may independently approv
|
|
|
133
151
|
|
|
134
152
|
`agent_knock_knock_list` is terminal-first: every eligible already-running Codex or Claude Code pane appears once in `terminals[]`, even when retained managed Turns reference it. The resource chain is terminal → verified native session → managed AKK `session_id` → Turns. `process_state` reports process liveness and `activity_state` reports the parsed screen state. `managed.current_turn` is the authoritative active Turn for that terminal; otherwise `managed.recent_turn` shows the newest retained context. Request `all=true` only when older `managed.history` or retained unavailable history is needed. By default, `unavailable_managed_turns[]` contains attention-needed records whose terminal is unavailable.
|
|
135
153
|
|
|
136
|
-
The top-level `action_contracts` summarizes each tool's managed target and its narrow compatibility inputs; `available_actions` is the
|
|
154
|
+
The top-level v5 `action_contracts` summarizes each tool's managed target and its narrow compatibility inputs; `available_actions` is the authoritative current-action source after listing. An existing managed Session's ordinary `send` targets `session_id` and starts a new managed Turn. On first attach only, `selector` may preserve a discovery target explicitly named by the user or the exact selector prefilled by an unmanaged raw-terminal row; it must never be passed as `session_id`. `respond` and every managed control target `turn_id`; `respond` is offered only for a Turn waiting on OpenClaw. The read-only `list_resumable_threads` action is advertised on the terminal row, requires only its full `terminal_id`, and returns a fresh `expected_binding_token` plus candidate rows. The `new_thread` mutation is advertised on the terminal row and requires that terminal ID and token; each resumable candidate row advertises its own `resume_thread` mutation with the same snapshot token, its complete `native_thread_id`, and its opaque `candidate_token`. Lifecycle discovery and mutations never create a Turn. A raw terminal may be controlled only through the exact action that its own row advertises; prefilled compatibility selectors, lifecycle IDs, and tokens must never be inferred, copied from another row, or reused from another snapshot. Start with the prefilled full argument, supply all `missing_required` fields, and use a returned `@short-ref` only for human-facing ordinary-send selection. Availability is a snapshot, so AKK revalidates it before side effects.
|
|
137
155
|
|
|
138
156
|
Before every terminal operation, AKK revalidates the expected agent PID and tmux pane identity, then confirms that the process and pane working directories match. Sending new work additionally requires a verified idle prompt. Humans can attach to the same tmux session and continue directly at any time.
|
|
139
157
|
|