acpx 0.1.4 → 0.1.5
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/README.md +69 -4
- package/dist/cli.d.ts +13 -0
- package/dist/cli.js +3553 -874
- package/package.json +1 -1
- package/skills/acpx/SKILL.md +72 -5
package/README.md
CHANGED
|
@@ -9,9 +9,19 @@ One command surface for Codex, Claude, Gemini, OpenCode, Pi, or custom ACP serve
|
|
|
9
9
|
- **Persistent sessions**: multi-turn conversations that survive across invocations, scoped per repo
|
|
10
10
|
- **Named sessions**: run parallel workstreams in the same repo (`-s backend`, `-s frontend`)
|
|
11
11
|
- **Prompt queueing**: submit prompts while one is already running, they execute in order
|
|
12
|
+
- **Cooperative cancel command**: `cancel` sends ACP `session/cancel` via queue IPC without tearing down session state
|
|
12
13
|
- **Soft-close lifecycle**: close sessions without deleting history from disk
|
|
13
14
|
- **Queue owner TTL**: keep queue owners alive briefly for follow-up prompts (`--ttl`)
|
|
14
15
|
- **Fire-and-forget**: `--no-wait` queues a prompt and returns immediately
|
|
16
|
+
- **Graceful cancel**: `Ctrl+C` sends ACP `session/cancel` before force-kill fallback
|
|
17
|
+
- **Session controls**: `set-mode` and `set <key> <value>` for `session/set_mode` and `session/set_config_option`
|
|
18
|
+
- **Crash reconnect**: dead agent processes are detected and sessions are reloaded automatically
|
|
19
|
+
- **Prompt from file/stdin**: `--file <path>` or piped stdin for prompt content
|
|
20
|
+
- **Config files**: global + project JSON config with `acpx config show|init`
|
|
21
|
+
- **Session inspect/history**: `sessions show` and `sessions history --limit <n>`
|
|
22
|
+
- **Local status checks**: `status` reports running/dead/no-session, pid, uptime, last prompt
|
|
23
|
+
- **Client methods**: stable `fs/*` and `terminal/*` handlers with permission controls and cwd sandboxing
|
|
24
|
+
- **Auth handshake**: stable `authenticate` support via env/config credentials
|
|
15
25
|
- **Structured output**: typed ACP messages (thinking, tool calls, diffs) instead of ANSI scraping
|
|
16
26
|
- **Any ACP agent**: built-in registry + `--agent` escape hatch for custom servers
|
|
17
27
|
- **One-shot mode**: `exec` for stateless fire-and-forget tasks
|
|
@@ -53,8 +63,11 @@ Copy the block below and paste it into your OpenClaw, Pi, Claude Code, or simila
|
|
|
53
63
|
I want you to use acpx to run coding agents over the Agent Client Protocol
|
|
54
64
|
(ACP) instead of scraping PTY sessions. Please do the following:
|
|
55
65
|
|
|
56
|
-
1. Install acpx
|
|
57
|
-
npm
|
|
66
|
+
1. Install acpx (global is recommended for frequent use, but npx works fine too):
|
|
67
|
+
npm install -g acpx@latest
|
|
68
|
+
|
|
69
|
+
Or, run without installing:
|
|
70
|
+
npx acpx@latest
|
|
58
71
|
|
|
59
72
|
2. Install the acpx skill so you have the full reference available:
|
|
60
73
|
acpx --skill export acpx | npx skillflag install
|
|
@@ -76,10 +89,16 @@ instead of spawning raw terminal sessions. For example:
|
|
|
76
89
|
## Install
|
|
77
90
|
|
|
78
91
|
```bash
|
|
79
|
-
npm
|
|
92
|
+
npm install -g acpx@latest
|
|
80
93
|
```
|
|
81
94
|
|
|
82
|
-
|
|
95
|
+
Or run without installing:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx acpx@latest codex "fix the tests"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Session state lives in `~/.acpx/` either way. Global install is a little faster, but `npx acpx@latest` works fine.
|
|
83
102
|
|
|
84
103
|
## Agent prerequisites
|
|
85
104
|
|
|
@@ -99,7 +118,13 @@ The only prerequisite is the underlying coding agent you want to use:
|
|
|
99
118
|
acpx codex sessions new # create a session (explicit) for this project dir
|
|
100
119
|
acpx codex 'fix the tests' # implicit prompt (routes via directory-walk)
|
|
101
120
|
acpx codex prompt 'fix the tests' # explicit prompt subcommand
|
|
121
|
+
echo 'fix flaky tests' | acpx codex # prompt from stdin
|
|
122
|
+
acpx codex --file prompt.md # prompt from file
|
|
123
|
+
acpx codex --file - "extra context" # explicit stdin + appended args
|
|
102
124
|
acpx codex --no-wait 'draft test migration plan' # enqueue without waiting if session is busy
|
|
125
|
+
acpx codex cancel # cooperative cancel of in-flight prompt
|
|
126
|
+
acpx codex set-mode plan # session/set_mode
|
|
127
|
+
acpx codex set approval_policy conservative # session/set_config_option
|
|
103
128
|
acpx exec 'summarize this repo' # default agent shortcut (codex)
|
|
104
129
|
acpx codex exec 'what does this repo do?' # one-shot, no saved session
|
|
105
130
|
|
|
@@ -110,10 +135,16 @@ acpx codex -s docs 'rewrite API docs' # parallel work in another named
|
|
|
110
135
|
|
|
111
136
|
acpx codex sessions # list sessions for codex command
|
|
112
137
|
acpx codex sessions list # explicit list
|
|
138
|
+
acpx codex sessions show # inspect cwd session metadata
|
|
139
|
+
acpx codex sessions history # show recent turn history
|
|
113
140
|
acpx codex sessions new # create fresh cwd-scoped default session
|
|
114
141
|
acpx codex sessions new --name api # create fresh named session
|
|
115
142
|
acpx codex sessions close # close cwd-scoped default session
|
|
116
143
|
acpx codex sessions close api # close cwd-scoped named session
|
|
144
|
+
acpx codex status # local process status for current session
|
|
145
|
+
|
|
146
|
+
acpx config show # show resolved config (global + project)
|
|
147
|
+
acpx config init # create ~/.acpx/config.json template
|
|
117
148
|
|
|
118
149
|
acpx claude 'refactor auth middleware' # built-in claude agent
|
|
119
150
|
acpx gemini 'add startup logging' # built-in gemini agent
|
|
@@ -151,6 +182,35 @@ acpx --ttl 30 codex 'keep queue owner alive for quick follow-ups'
|
|
|
151
182
|
acpx --verbose codex 'debug why adapter startup is failing'
|
|
152
183
|
```
|
|
153
184
|
|
|
185
|
+
## Configuration files
|
|
186
|
+
|
|
187
|
+
`acpx` reads config in this order (later wins):
|
|
188
|
+
|
|
189
|
+
1. global: `~/.acpx/config.json`
|
|
190
|
+
2. project: `<cwd>/.acpxrc.json`
|
|
191
|
+
|
|
192
|
+
CLI flags always win over config values.
|
|
193
|
+
|
|
194
|
+
Supported keys:
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"defaultAgent": "codex",
|
|
199
|
+
"defaultPermissions": "approve-all",
|
|
200
|
+
"ttl": 300,
|
|
201
|
+
"timeout": null,
|
|
202
|
+
"format": "text",
|
|
203
|
+
"agents": {
|
|
204
|
+
"my-custom": { "command": "./bin/my-acp-server" }
|
|
205
|
+
},
|
|
206
|
+
"auth": {
|
|
207
|
+
"my_auth_method_id": "credential-value"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Use `acpx config show` to inspect the resolved result and `acpx config init` to create the global template.
|
|
213
|
+
|
|
154
214
|
## Output formats
|
|
155
215
|
|
|
156
216
|
```bash
|
|
@@ -195,8 +255,13 @@ acpx --agent ./my-custom-acp-server 'do something'
|
|
|
195
255
|
- Prompt submissions are queue-aware per session. If a prompt is already running, new prompts are queued and drained by the running `acpx` process.
|
|
196
256
|
- Queue owners use an idle TTL (default 300s). `--ttl <seconds>` overrides it; `--ttl 0` keeps owners alive indefinitely.
|
|
197
257
|
- `--no-wait` submits to that queue and returns immediately.
|
|
258
|
+
- `cancel` sends cooperative `session/cancel` to the running queue owner process and returns success when no prompt is running (`nothing to cancel`).
|
|
259
|
+
- `set-mode` and `set` route through queue-owner IPC when active, otherwise they reconnect directly to apply `session/set_mode` and `session/set_config_option`.
|
|
198
260
|
- `exec` is always one-shot and does not reuse saved sessions.
|
|
199
261
|
- Session metadata is stored under `~/.acpx/sessions/`.
|
|
262
|
+
- Each successful prompt appends lightweight turn history previews (`role`, `timestamp`, `textPreview`) to session metadata.
|
|
263
|
+
- `Ctrl+C` during a running turn sends ACP `session/cancel` and waits briefly for `stopReason=cancelled` before force-killing if needed.
|
|
264
|
+
- If a saved session pid is dead on the next prompt, `acpx` respawns the agent, attempts `session/load`, and transparently falls back to `session/new` if loading fails.
|
|
200
265
|
|
|
201
266
|
## Full CLI reference
|
|
202
267
|
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { AgentCapabilities } from '@agentclientprotocol/sdk';
|
|
3
3
|
|
|
4
|
+
type SessionHistoryRole = "user" | "assistant";
|
|
5
|
+
type SessionHistoryEntry = {
|
|
6
|
+
role: SessionHistoryRole;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
textPreview: string;
|
|
9
|
+
};
|
|
4
10
|
type SessionRecord = {
|
|
5
11
|
id: string;
|
|
6
12
|
sessionId: string;
|
|
@@ -12,6 +18,13 @@ type SessionRecord = {
|
|
|
12
18
|
closed?: boolean;
|
|
13
19
|
closedAt?: string;
|
|
14
20
|
pid?: number;
|
|
21
|
+
agentStartedAt?: string;
|
|
22
|
+
lastPromptAt?: string;
|
|
23
|
+
lastAgentExitCode?: number | null;
|
|
24
|
+
lastAgentExitSignal?: NodeJS.Signals | null;
|
|
25
|
+
lastAgentExitAt?: string;
|
|
26
|
+
lastAgentDisconnectReason?: string;
|
|
27
|
+
turnHistory?: SessionHistoryEntry[];
|
|
15
28
|
protocolVersion?: number;
|
|
16
29
|
agentCapabilities?: AgentCapabilities;
|
|
17
30
|
};
|