@scotthuang/agent-knock-knock 0.1.2 → 0.2.1

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 CHANGED
@@ -1,8 +1,23 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 0.2.1 - 2026-06-22
4
4
 
5
- No unreleased changes.
5
+ ### Changed
6
+
7
+ - Deprecated the standalone restart recovery path from the OpenClaw-facing tool, slash command, skill, and docs. Conversations that need recovery now present `recover`, `close`, or starting a new independent delegation.
8
+ - Changed `send` to automatically fall back to AKK replay recovery when the previous ACPX session is unavailable. Explicit recovery decisions remain available only through `--recovery-policy explicit`.
9
+
10
+ ## 0.2.0 - 2026-06-22
11
+
12
+ ### Added
13
+
14
+ - Added experimental native Codex session discovery and takeover flows, including safe resume, OpenClaw-summarized fork, and confirmed terminate-then-resume adoption for active Codex CLI sessions.
15
+ - Added an explicit `allowCwdOnly` terminate-then-resume fallback for Codex TUI processes that do not expose a session id in argv; it still requires a user-confirmed pid and cwd re-scan before termination.
16
+ - Added tests for Codex native session takeover planning, confirmed termination safeguards, fork summary confirmation, and native `codex exec resume` follow-up delivery.
17
+
18
+ ### Changed
19
+
20
+ - Updated Codex takeover sends to use native `codex exec resume` for adopted Codex sessions, avoiding ACPX session binding issues when resuming existing terminal Codex sessions.
6
21
 
7
22
  ## 0.1.2 - 2026-06-21
8
23
 
package/README.md CHANGED
@@ -140,7 +140,6 @@ akk list
140
140
  akk send <conversation-id>: continue with the smaller implementation
141
141
  akk cancel <conversation-id>
142
142
  akk recover <conversation-id>
143
- akk restart <conversation-id>
144
143
  akk close <conversation-id>
145
144
  ```
146
145
 
@@ -156,7 +155,6 @@ The plugin also registers the `/akk` slash command for channel surfaces that sup
156
155
  /akk send <conversation-id> <message>
157
156
  /akk cancel <conversation-id>
158
157
  /akk recover <conversation-id>
159
- /akk restart <conversation-id>
160
158
  /akk close <conversation-id> [reason]
161
159
  ```
162
160
 
@@ -172,7 +170,6 @@ If your OpenClaw config uses a restrictive tool allowlist, allow the tool:
172
170
  "agent_knock_knock_send",
173
171
  "agent_knock_knock_cancel",
174
172
  "agent_knock_knock_recover",
175
- "agent_knock_knock_restart",
176
173
  "agent_knock_knock_close"
177
174
  ]
178
175
  }
@@ -189,13 +186,15 @@ New delegations create a fresh ACPX session by default, using a name like `akk-c
189
186
 
190
187
  Background launches also start a small AKK monitor process. The monitor exits when the conversation receives a callback or otherwise leaves the agent-waiting state. If the executor process disappears before a callback, or if no callback arrives before `agentTimeoutMinutes`, the conversation is marked `stalled` and AKK attempts to notify the original OpenClaw session through the callback Gateway route. The default agent timeout is 60 minutes.
191
188
 
192
- Some coding agents may not reliably resume a named ACPX session after their backing process disappears. Executors can opt into an explicit recovery decision flow. In that mode, a failed follow-up send marks the AKK conversation `needs_recovery` instead of automatically replaying history or starting a new session. The user can then choose:
189
+ Some coding agents may not reliably resume a named ACPX session after their backing process disappears. By default, `AKK send <conversation-id>: <message>` automatically falls back to AKK replay recovery: it starts a fresh ACPX session, gives the agent a bounded summary of AKK's saved protocol history, and includes the pending message. The result includes `auto_recovered: true` when this happens.
190
+
191
+ If a caller uses the explicit recovery policy, or if automatic recovery cannot complete, the AKK conversation can enter `needs_recovery`. The user can then choose:
193
192
 
194
193
  - `AKK recover <conversation-id>`: start a new coding-agent session with AKK's saved protocol history summary plus the pending message.
195
- - `AKK restart <conversation-id>`: start a new coding-agent session with only the pending message.
196
194
  - `AKK close <conversation-id>`: close the AKK task without recovery.
195
+ - Start a new independent AKK delegation if the old task should not be recovered.
197
196
 
198
- Codex and Claude Code currently use native named-session recovery through ACPX. Cursor uses the explicit decision flow because its native session resume can be unreliable after the backing process disappears.
197
+ Recover is AKK replay recovery, not guaranteed native coding-agent session resume. Codex, Claude Code, and Cursor all use the same default `send` auto-recovery behavior when the existing ACPX session is unavailable.
199
198
 
200
199
  Task status can include a safe executor trace with `--trace` or the OpenClaw status tool's `trace: true` parameter. Trace summaries show client lifecycle events, tool call names and statuses, permission-request markers, monitor events, and short sanitized output previews. Agent thinking content is never returned; it is counted and marked as redacted.
201
200
 
@@ -256,16 +255,44 @@ node dist/src/cli.js cancel \
256
255
  --conversation <conversation-id>
257
256
  ```
258
257
 
259
- Recover or restart a task that is waiting for an explicit recovery decision:
258
+ Recover a task that is waiting for an explicit recovery decision:
260
259
 
261
260
  ```bash
262
261
  node dist/src/cli.js recover \
263
262
  --conversation <conversation-id>
263
+ ```
264
264
 
265
- node dist/src/cli.js restart \
266
- --conversation <conversation-id>
265
+ Inspect and take over native Codex sessions that were started outside AKK:
266
+
267
+ Experimental: native Codex takeover depends on best-effort local Codex session metadata, process scanning, and Codex CLI resume behavior. It may be unstable across Codex versions or unusual terminal states, so review the returned plan before confirming any takeover.
268
+
269
+ ```bash
270
+ node dist/src/cli.js agent discover \
271
+ --agent codex \
272
+ --scope active
273
+
274
+ node dist/src/cli.js agent takeover \
275
+ --agent codex \
276
+ --session-id <native-codex-session-id> \
277
+ --strategy terminate_then_resume
278
+ ```
279
+
280
+ `terminate_then_resume` is intentionally two-step. The first command returns the exact pid, cwd, and session that would be stopped. After confirming that plan, execute the takeover:
281
+
282
+ ```bash
283
+ node dist/src/cli.js agent takeover \
284
+ --agent codex \
285
+ --session-id <native-codex-session-id> \
286
+ --strategy terminate_then_resume \
287
+ --create-conversation \
288
+ --confirm-terminate \
289
+ --expected-pid <confirmed-pid>
267
290
  ```
268
291
 
292
+ AKK re-scans before terminating and only proceeds when the confirmed pid is still an exact match for the requested Codex session. After the process exits, AKK creates a managed conversation and future sends use native `codex exec resume`.
293
+
294
+ Some Codex TUI processes do not expose the native session id in argv. In that case the default takeover remains blocked as ambiguous. For a deliberate local test or an operator-confirmed handoff, add `--allow-cwd-only` with `--expected-pid`; AKK will still re-scan and require that pid to be active in the target session cwd before terminating it.
295
+
269
296
  Close a task locally:
270
297
 
271
298
  ```bash
@@ -0,0 +1,25 @@
1
+ import type { ActiveCodexProcess, CodexSessionModelInfo, CodexSessionSummary, ForkContextPackage, RolloutExcerptOptions } from "./codex-session-provider.js";
2
+ export type CodingAgentSessionProviderAgent = "codex";
3
+ export type HistoricalSessionCapability = "full" | "metadata_only" | "unavailable";
4
+ export type ForkContextCapability = "full" | "partial" | "unavailable";
5
+ export type ActiveSessionCapability = "process_scan" | "unavailable";
6
+ export type TakeoverCapability = "plan_only" | "unavailable";
7
+ export interface AgentSessionCapabilities {
8
+ historicalSessions: HistoricalSessionCapability;
9
+ forkContext: ForkContextCapability;
10
+ activeSessions: ActiveSessionCapability;
11
+ takeover: TakeoverCapability;
12
+ reasons: string[];
13
+ }
14
+ export interface ForkContextOptions extends RolloutExcerptOptions {
15
+ sessionId: string;
16
+ }
17
+ export interface CodingAgentSessionProvider {
18
+ agent: CodingAgentSessionProviderAgent;
19
+ getCapabilities(): Promise<AgentSessionCapabilities>;
20
+ listHistoricalSessions(): Promise<CodexSessionSummary[]>;
21
+ listActiveSessions(): Promise<ActiveCodexProcess[]>;
22
+ getSession(sessionId: string): Promise<CodexSessionSummary | undefined>;
23
+ getSessionModel(sessionId: string): Promise<CodexSessionModelInfo | undefined>;
24
+ getForkContext(options: ForkContextOptions): Promise<ForkContextPackage | undefined>;
25
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-session-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-session-provider.js","sourceRoot":"","sources":["../../src/agent-session-provider.ts"],"names":[],"mappings":""}