@scotthuang/agent-knock-knock 0.2.43 → 0.2.46
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 +27 -0
- package/README.md +135 -244
- package/dist/src/cli.js +641 -730
- package/dist/src/cli.js.map +1 -1
- package/dist/src/codex-session-provider.d.ts +6 -32
- package/dist/src/codex-session-provider.js +2 -1
- package/dist/src/codex-session-provider.js.map +1 -1
- package/dist/src/codex-store-adapter.d.ts +3 -9
- package/dist/src/codex-store-adapter.js +5 -55
- package/dist/src/codex-store-adapter.js.map +1 -1
- package/dist/src/codex-terminal-agent-adapter.d.ts +34 -0
- package/dist/src/codex-terminal-agent-adapter.js +386 -0
- package/dist/src/codex-terminal-agent-adapter.js.map +1 -0
- package/dist/src/openclaw-plugin.js +54 -5
- package/dist/src/openclaw-plugin.js.map +1 -1
- package/dist/src/protocol.d.ts +1 -1
- package/dist/src/terminal-agent-adapter.d.ts +124 -0
- package/dist/src/terminal-agent-adapter.js +109 -0
- package/dist/src/terminal-agent-adapter.js.map +1 -0
- package/dist/src/terminal-agent-bridge.d.ts +97 -0
- package/dist/src/terminal-agent-bridge.js +362 -0
- package/dist/src/terminal-agent-bridge.js.map +1 -0
- package/dist/src/terminal-agent-registry.d.ts +7 -0
- package/dist/src/terminal-agent-registry.js +22 -0
- package/dist/src/terminal-agent-registry.js.map +1 -0
- package/dist/src/terminal-control-provider.d.ts +8 -6
- package/dist/src/terminal-control-provider.js +5 -5
- package/dist/src/terminal-control-provider.js.map +1 -1
- package/dist/src/terminal-process-source.d.ts +25 -0
- package/dist/src/terminal-process-source.js +77 -0
- package/dist/src/terminal-process-source.js.map +1 -0
- package/openclaw.plugin.json +4 -0
- package/package.json +1 -1
- package/templates/openclaw-skills/agent-knock-knock/SKILL.md +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-process-source.js","sourceRoot":"","sources":["../../src/terminal-process-source.ts"],"names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AAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,+DAA+D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzF,IAAI,KAAK,EAAE,CAAC;YACV,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,IAAc;IAC/D,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE;QACtC,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE;KAC5B,CAAC,CAAC;IACH,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC"}
|
package/openclaw.plugin.json
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"agent_knock_knock_describe",
|
|
17
17
|
"agent_knock_knock_send",
|
|
18
18
|
"agent_knock_knock_renew",
|
|
19
|
+
"agent_knock_knock_retry_callback",
|
|
19
20
|
"agent_knock_knock_cancel",
|
|
20
21
|
"agent_knock_knock_recover",
|
|
21
22
|
"agent_knock_knock_close",
|
|
@@ -43,6 +44,9 @@
|
|
|
43
44
|
"agent_knock_knock_renew": {
|
|
44
45
|
"optional": true
|
|
45
46
|
},
|
|
47
|
+
"agent_knock_knock_retry_callback": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
46
50
|
"agent_knock_knock_cancel": {
|
|
47
51
|
"optional": true
|
|
48
52
|
},
|
package/package.json
CHANGED
|
@@ -57,14 +57,14 @@ Natural-language forms:
|
|
|
57
57
|
- `AKK close <conversation-id>`: call `agent_knock_knock_close`.
|
|
58
58
|
- `AKK takeover Codex <session-id>` or requests to take over an active Codex CLI session: call `agent_knock_knock_agent_takeover` with `agent="codex"` and `strategy="terminate_then_resume"`.
|
|
59
59
|
- `AKK terminal takeover Codex <session-id>` or requests to take over a Codex CLI that is running inside a controllable terminal provider without stopping it: call `agent_knock_knock_agent_takeover` with `agent="codex"` and `strategy="terminal_control"`.
|
|
60
|
-
- `AKK approve <conversation-id>` or requests to approve the current visible Codex permission/command prompt for a terminal-controlled session: first call `agent_knock_knock_status` for that conversation and show the terminal screen excerpt to the user. Only after the user explicitly approves that prompt, call `agent_knock_knock_approve`. If an AKK callback says a terminal bridge session is waiting for approval,
|
|
60
|
+
- `AKK approve <conversation-id>` or requests to approve the current visible Codex permission/command prompt for a terminal-controlled session: first call `agent_knock_knock_status` for that conversation and show the terminal screen excerpt to the user. Only after the user explicitly approves that prompt, call `agent_knock_knock_approve` with the exact `approval_state.fingerprint` as `expected_approval_fingerprint`. If an AKK callback says a terminal bridge session is waiting for approval, pass its approval fingerprint the same way; deny or stop that request with `agent_knock_knock_cancel`. If the target comes from a `terminal_controlled` entry in `AKK list`, use that entry's `id` directly; it does not need an AKK-managed state file before status or approval.
|
|
61
61
|
- `AKK takeover Codex <session-id> with fork`, `AKK fork takeover Codex <session-id>`, or requests to take over without stopping the original Codex CLI: call `agent_knock_knock_agent_takeover` with `agent="codex"` and `strategy="fork"`.
|
|
62
62
|
|
|
63
63
|
Session reuse rule:
|
|
64
64
|
|
|
65
65
|
- If the user asks to continue, add, follow up, "send another task", "let it also", "tell it", "ask Codex/Claude/Cursor to also", "再让它", "继续让它", "给刚才那个", or otherwise refers to an existing AKK agent, reuse the most recent matching open AKK session instead of creating a new delegation.
|
|
66
66
|
- When the user gives a follow-up without a `conversation_id`, first call `agent_knock_knock_list`, choose the most recent open session that matches the requested agent if one is named, and then call `agent_knock_knock_send` with that `conversation_id`.
|
|
67
|
-
- After `AKK list`, if the user refers to any listed row by id, tmux target, pane number, session name, ordinal ("first/second/that one"), cwd, or visible description and asks to send or assign work to it, resolve that listed row and call `agent_knock_knock_send`. For `terminal_controlled` rows, pass the row's `id` such as `terminal:tmux:my-work:0.1:38140`; do not create a new AKK delegation.
|
|
67
|
+
- After `AKK list`, if the user refers to any listed row by id, tmux target, pane number, session name, ordinal ("first/second/that one"), cwd, or visible description and asks to send or assign work to it, resolve that listed row and call `agent_knock_knock_send`. For `terminal_controlled` rows, pass the row's `id` such as `terminal:v2:tmux:codex:my-work:0.1:38140`; do not create a new AKK delegation.
|
|
68
68
|
- `idle` means the agent completed the previous round but the AKK session is still open and should be reused for follow-ups.
|
|
69
69
|
- `send` automatically falls back to AKK replay recovery when the previous coding-agent session is unavailable. If AKK still reports `needs_recovery`, ask the user to choose `AKK recover <conversation-id>`, `AKK close <conversation-id>`, or starting a new independent AKK delegation.
|
|
70
70
|
- Call `agent_knock_knock_delegate` only when the user clearly asks for a new independent AKK task/session, names a different agent that does not already have a suitable open session, or there is no matching open session to reuse.
|
|
@@ -79,7 +79,7 @@ AKK Cursor: fix the flaky UI test
|
|
|
79
79
|
akk list
|
|
80
80
|
akk describe task-20260618T010203Z-abcdef12
|
|
81
81
|
akk send task-20260618T010203Z-abcdef12: continue with the smaller implementation
|
|
82
|
-
akk send terminal:tmux:my-work:0.1:38140: hello 测试一下通信
|
|
82
|
+
akk send terminal:v2:tmux:codex:my-work:0.1:38140: hello 测试一下通信
|
|
83
83
|
给 AKK list 里的 my-work:0.1 发一条消息:继续刚才的任务
|
|
84
84
|
再让刚才那个 Codex 分析 ~/chrome-debug 为什么占空间
|
|
85
85
|
akk cancel task-20260618T010203Z-abcdef12
|
|
@@ -157,7 +157,7 @@ Use `agent_knock_knock_describe` when the user asks what a listed session is abo
|
|
|
157
157
|
Use `agent_knock_knock_agent_takeover` when the user wants AKK to take over an existing native Codex session. By default this tool is side-effect-free and returns a plan. When the plan is ready and the user explicitly wants AKK to manage the session, call it with `createConversation=true` to create an AKK conversation bound to the native session:
|
|
158
158
|
|
|
159
159
|
- `terminate_then_resume`: use when the user wants to take over an active native Codex CLI. The first call is side-effect-free. If the result is `requires_confirmation`, explain the exact pid, cwd, and session that would be stopped. Only after explicit user confirmation, call `agent_knock_knock_agent_takeover` again with `strategy="terminate_then_resume"`, `createConversation=true`, `confirmTerminate=true`, and `expectedPid=<confirmed pid>`. AKK will re-scan before terminating and will only stop an exact session match. If Codex does not expose a session id and the user still explicitly confirms a specific pid in the target cwd, you may add `allowCwdOnly=true`; explain that this is higher risk because it relies on pid and cwd rather than a visible session id.
|
|
160
|
-
- `terminal_control`: use when the target Codex CLI is running inside a controllable terminal provider and the user wants AKK to operate the existing TUI without stopping or resuming it. The first call is side-effect-free. If the result is `requires_confirmation`, show the exact terminal target, pid, cwd, and current terminal-control metadata. Only after explicit user confirmation, call again with `strategy="terminal_control"`, `createConversation=true`, `confirmTerminal=true`, and `terminalTarget=<confirmed target>`. Follow-up `AKK send` messages will be typed into the terminal pane as concise user-facing task text; AKK monitors the Codex rollout/terminal state and sends the callback to OpenClaw itself. `AKK cancel` sends Control-C to the controlled terminal pane. Terminal-controlled entries from `AKK list` can be sent to, cancelled, approved, and inspected directly with their `id`; use `agent_knock_knock_status` to inspect the current terminal screen or execution result. Before `agent_knock_knock_approve`,
|
|
160
|
+
- `terminal_control`: use when the target Codex CLI is running inside a controllable terminal provider and the user wants AKK to operate the existing TUI without stopping or resuming it. The first call is side-effect-free. If the result is `requires_confirmation`, show the exact terminal target, pid, cwd, and current terminal-control metadata. Only after explicit user confirmation, call again with `strategy="terminal_control"`, `createConversation=true`, `confirmTerminal=true`, and `terminalTarget=<confirmed target>`. Follow-up `AKK send` messages will be typed into the terminal pane as concise user-facing task text; AKK monitors the Codex rollout/terminal state and sends the callback to OpenClaw itself. `AKK cancel` sends Control-C to the controlled terminal pane. Terminal-controlled entries from `AKK list` can be sent to, cancelled, approved, and inspected directly with their `id`; use `agent_knock_knock_status` to inspect the current terminal screen or execution result. Before `agent_knock_knock_approve`, show the user the latest terminal excerpt and pass its fingerprint as `expected_approval_fingerprint`.
|
|
161
161
|
- `fork`: use when the user wants to avoid stopping the original Codex CLI. First call returns a bounded context package plus `summaryPrompt` and `nextAction`; use that prompt to summarize as OpenClaw, ask the user to confirm, and do not inject raw full rollout history directly. After the user confirms the summary, call `agent_knock_knock_agent_takeover` again with `strategy="fork"`, `createConversation=true`, and `forkSummary=<approved summary>` to create the forked AKK-managed session. Then use the returned `conversation_id` with `AKK send` for follow-up work.
|
|
162
162
|
|
|
163
163
|
Do not present `fork` as a standalone command or standalone feature. It is a takeover strategy.
|