@1agents/acp-service 0.3.0 β†’ 0.5.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.
Files changed (98) hide show
  1. package/README.md +69 -33
  2. package/dist/bin/acp-service.js +2 -2
  3. package/dist/src/bridge.d.ts +2 -2
  4. package/dist/src/bridge.js +1 -1
  5. package/dist/src/catalog.js +20 -3
  6. package/dist/src/dsh.d.ts +6 -0
  7. package/dist/src/dsh.js +9 -0
  8. package/dist/src/manifest.js +1 -1
  9. package/dist/src/package.d.ts +3 -0
  10. package/dist/src/package.js +3 -0
  11. package/package.json +65 -13
  12. package/vendor/dsh/LICENSE +21 -0
  13. package/vendor/dsh/README.md +101 -0
  14. package/vendor/dsh/adapter.d.ts +82 -0
  15. package/vendor/dsh/adapter.js +449 -0
  16. package/vendor/dsh/client.js +207 -0
  17. package/vendor/dsh/cordis.patch.yml +10 -0
  18. package/vendor/dsh/discovery.d.ts +4 -0
  19. package/vendor/dsh/discovery.js +20 -0
  20. package/vendor/dsh/imports.d.ts +54 -0
  21. package/vendor/dsh/imports.js +133 -0
  22. package/vendor/dsh/index.d.ts +5 -0
  23. package/vendor/dsh/index.js +84 -0
  24. package/vendor/dsh/preset.d.ts +7 -0
  25. package/vendor/dsh/preset.js +10 -0
  26. package/vendor/dsh/service-process.d.ts +10 -0
  27. package/vendor/dsh/service-process.js +150 -0
  28. package/vendor/dsh/service-worker.d.ts +1 -0
  29. package/vendor/dsh/service-worker.js +43 -0
  30. package/vendor/dsh/state.d.ts +22 -0
  31. package/vendor/dsh/state.js +47 -0
  32. package/vendor/dsh/transport.d.ts +18 -0
  33. package/vendor/dsh/transport.js +71 -0
  34. package/vendor/runtime/LICENSE +21 -0
  35. package/vendor/runtime/README.md +115 -0
  36. package/vendor/runtime/dist/agent-registry-CMg8LHKY.js +806 -0
  37. package/vendor/runtime/dist/agent-registry-CMg8LHKY.js.map +1 -0
  38. package/vendor/runtime/dist/agent-registry.d.ts +70 -0
  39. package/vendor/runtime/dist/agent-registry.d.ts.map +1 -0
  40. package/vendor/runtime/dist/agent-registry.js +2 -0
  41. package/vendor/runtime/dist/cli-DUHyAADv.js +182 -0
  42. package/vendor/runtime/dist/cli-DUHyAADv.js.map +1 -0
  43. package/vendor/runtime/dist/cli.d.ts +12 -0
  44. package/vendor/runtime/dist/cli.d.ts.map +1 -0
  45. package/vendor/runtime/dist/cli.js +2632 -0
  46. package/vendor/runtime/dist/cli.js.map +1 -0
  47. package/vendor/runtime/dist/client-DjkWknf7.d.ts +262 -0
  48. package/vendor/runtime/dist/client-DjkWknf7.d.ts.map +1 -0
  49. package/vendor/runtime/dist/docs-site/.nojekyll +0 -0
  50. package/vendor/runtime/dist/docs-site/CLI.html +832 -0
  51. package/vendor/runtime/dist/docs-site/CNAME +1 -0
  52. package/vendor/runtime/dist/docs-site/VISION.html +415 -0
  53. package/vendor/runtime/dist/docs-site/agents.html +391 -0
  54. package/vendor/runtime/dist/docs-site/compare.html +359 -0
  55. package/vendor/runtime/dist/docs-site/config.html +450 -0
  56. package/vendor/runtime/dist/docs-site/custom-agents.html +408 -0
  57. package/vendor/runtime/dist/docs-site/exit-codes.html +347 -0
  58. package/vendor/runtime/dist/docs-site/favicon.svg +21 -0
  59. package/vendor/runtime/dist/docs-site/flows.html +497 -0
  60. package/vendor/runtime/dist/docs-site/index.html +367 -0
  61. package/vendor/runtime/dist/docs-site/install.html +386 -0
  62. package/vendor/runtime/dist/docs-site/llms.txt +35 -0
  63. package/vendor/runtime/dist/docs-site/output-formats.html +403 -0
  64. package/vendor/runtime/dist/docs-site/permissions.html +413 -0
  65. package/vendor/runtime/dist/docs-site/prompting.html +460 -0
  66. package/vendor/runtime/dist/docs-site/proof-2026-07-18-grok-ext-methods/index.html +336 -0
  67. package/vendor/runtime/dist/docs-site/quickstart.html +382 -0
  68. package/vendor/runtime/dist/docs-site/runtime-environment.html +329 -0
  69. package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +335 -0
  70. package/vendor/runtime/dist/docs-site/session-control.html +406 -0
  71. package/vendor/runtime/dist/docs-site/session-watch.html +354 -0
  72. package/vendor/runtime/dist/docs-site/sessions.html +486 -0
  73. package/vendor/runtime/dist/docs-site/shared-sessions.html +377 -0
  74. package/vendor/runtime/dist/flows-CiJSCy4D.js +2474 -0
  75. package/vendor/runtime/dist/flows-CiJSCy4D.js.map +1 -0
  76. package/vendor/runtime/dist/flows.d.ts +334 -0
  77. package/vendor/runtime/dist/flows.d.ts.map +1 -0
  78. package/vendor/runtime/dist/flows.js +2 -0
  79. package/vendor/runtime/dist/invocation-options-BlIySxIw.js +345 -0
  80. package/vendor/runtime/dist/invocation-options-BlIySxIw.js.map +1 -0
  81. package/vendor/runtime/dist/ipc-BlljKR2b.js +5336 -0
  82. package/vendor/runtime/dist/ipc-BlljKR2b.js.map +1 -0
  83. package/vendor/runtime/dist/output-BzXQKArM.js +1012 -0
  84. package/vendor/runtime/dist/output-BzXQKArM.js.map +1 -0
  85. package/vendor/runtime/dist/queue-owner-runtime-DSFdsS_y.js +8867 -0
  86. package/vendor/runtime/dist/queue-owner-runtime-DSFdsS_y.js.map +1 -0
  87. package/vendor/runtime/dist/runtime.d.ts +1156 -0
  88. package/vendor/runtime/dist/runtime.d.ts.map +1 -0
  89. package/vendor/runtime/dist/runtime.js +3675 -0
  90. package/vendor/runtime/dist/runtime.js.map +1 -0
  91. package/vendor/runtime/dist/session-options-ORCchZGk.d.ts +426 -0
  92. package/vendor/runtime/dist/session-options-ORCchZGk.d.ts.map +1 -0
  93. package/vendor/runtime/dist/session-watch-BiBTBMz4.js +76 -0
  94. package/vendor/runtime/dist/session-watch-BiBTBMz4.js.map +1 -0
  95. package/vendor/runtime/dist/watch-iYiP-lOo.js +85 -0
  96. package/vendor/runtime/dist/watch-iYiP-lOo.js.map +1 -0
  97. package/vendor/runtime/package.json +46 -0
  98. package/vendor/runtime/skills/acpx/SKILL.md +688 -0
@@ -0,0 +1,150 @@
1
+ /** Own local ACP service processes; existing and remote servers keep their external owner. */
2
+ import { fork } from 'node:child_process';
3
+ import { fileURLToPath } from 'node:url';
4
+ const leases = new Map();
5
+ /** Validate lifecycle options before any process or connection is created. */
6
+ export function resolveServiceOptions(input) {
7
+ const result = {
8
+ serviceUrl: input.serviceUrl ?? 'http://127.0.0.1:36812',
9
+ serviceMode: input.serviceMode ?? 'auto',
10
+ serviceStartupTimeoutMs: input.serviceStartupTimeoutMs ?? 15_000,
11
+ serviceShutdownTimeoutMs: input.serviceShutdownTimeoutMs ?? 5_000,
12
+ };
13
+ const url = new URL(result.serviceUrl);
14
+ if (!['http:', 'https:'].includes(url.protocol))
15
+ throw new Error('serviceUrl must use http or https');
16
+ if (!['auto', 'external'].includes(result.serviceMode))
17
+ throw new Error('serviceMode must be auto or external');
18
+ for (const value of [result.serviceStartupTimeoutMs, result.serviceShutdownTimeoutMs]) {
19
+ if (!Number.isSafeInteger(value) || value < 1 || value > 2_147_483_647)
20
+ throw new Error('ACP service timeouts must be integers between 1 and 2147483647');
21
+ }
22
+ if (url.port === '0')
23
+ throw new Error('serviceUrl needs a stable, nonzero port for saved sessions');
24
+ return result;
25
+ }
26
+ function refused(error) {
27
+ if (!error || typeof error !== 'object')
28
+ return false;
29
+ if (error instanceof AggregateError)
30
+ return error.errors.length > 0 && error.errors.every(refused);
31
+ if ('code' in error && error.code === 'ECONNREFUSED')
32
+ return true;
33
+ return 'cause' in error && refused(error.cause);
34
+ }
35
+ async function running(url, timeout) {
36
+ let response;
37
+ try {
38
+ response = await fetch(new URL('/health', url), { signal: AbortSignal.timeout(timeout), redirect: 'error' });
39
+ }
40
+ catch (error) {
41
+ if (refused(error))
42
+ return false;
43
+ throw new Error(`ACP health check failed at ${url.origin}`, { cause: error });
44
+ }
45
+ if (!response.ok)
46
+ throw new Error(`ACP health check failed: HTTP ${response.status} at ${url.origin}`);
47
+ const body = await response.json();
48
+ if (!body || typeof body !== 'object' || !('service' in body) || body.service !== 'acp-service' || !('status' in body) || body.status !== 'ok') {
49
+ throw new Error(`The listener at ${url.origin} is not a healthy ACP service`);
50
+ }
51
+ return true;
52
+ }
53
+ async function start(options, url) {
54
+ if (await running(url, options.serviceStartupTimeoutMs))
55
+ return async () => { };
56
+ const child = fork(fileURLToPath(new URL('./service-worker.js', import.meta.url)), [], {
57
+ execArgv: [], stdio: ['ignore', 'ignore', 'ignore', 'ipc'],
58
+ env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' },
59
+ });
60
+ const ready = Promise.withResolvers();
61
+ const closed = Promise.withResolvers();
62
+ let ended = false;
63
+ child.once('error', error => ready.reject(error));
64
+ child.once('close', (code, signal) => {
65
+ ended = true;
66
+ ready.reject(new Error(`Managed ACP service exited (${signal ?? code})`));
67
+ closed.resolve();
68
+ });
69
+ child.on('message', message => {
70
+ if (!message || typeof message !== 'object' || !('type' in message))
71
+ return;
72
+ if (message.type === 'ready')
73
+ ready.resolve();
74
+ if (message.type === 'error' && 'message' in message && typeof message.message === 'string')
75
+ ready.reject(new Error(message.message));
76
+ });
77
+ let stopping;
78
+ const stop = () => stopping ??= (async () => {
79
+ if (ended)
80
+ return;
81
+ child.kill('SIGTERM');
82
+ const timer = setTimeout(() => child.kill('SIGKILL'), options.serviceShutdownTimeoutMs);
83
+ try {
84
+ await closed.promise;
85
+ }
86
+ finally {
87
+ clearTimeout(timer);
88
+ }
89
+ })();
90
+ const timer = setTimeout(() => ready.reject(new Error(`ACP service startup timed out after ${options.serviceStartupTimeoutMs}ms`)), options.serviceStartupTimeoutMs);
91
+ child.send({ host: url.hostname.replace(/^\[|\]$/g, ''), port: Number(url.port || 80), shutdownTimeoutMs: options.serviceShutdownTimeoutMs }, error => { if (error)
92
+ ready.reject(error); });
93
+ try {
94
+ await ready.promise;
95
+ if (!await running(url, options.serviceStartupTimeoutMs))
96
+ throw new Error('ACP service exited during startup');
97
+ return stop;
98
+ }
99
+ catch (error) {
100
+ await stop();
101
+ throw error;
102
+ }
103
+ finally {
104
+ clearTimeout(timer);
105
+ }
106
+ }
107
+ /** Acquire a shared local process lease; release waits for owned process exit, never kills an existing server. */
108
+ export async function acquireService(options) {
109
+ const url = new URL(options.serviceUrl);
110
+ const local = url.protocol === 'http:' && ['127.0.0.1', 'localhost', '[::1]'].includes(url.hostname)
111
+ && url.pathname === '/' && !url.search && !url.hash && !url.username && !url.password;
112
+ if (options.serviceMode === 'external' || !local)
113
+ return async () => { };
114
+ const key = url.origin;
115
+ let lease = leases.get(key);
116
+ if (lease?.closing) {
117
+ await lease.closing;
118
+ return acquireService(options);
119
+ }
120
+ if (!lease) {
121
+ lease = { users: 0, ready: start(options, url) };
122
+ leases.set(key, lease);
123
+ }
124
+ lease.users++;
125
+ let stop;
126
+ try {
127
+ stop = await lease.ready;
128
+ }
129
+ catch (error) {
130
+ if (--lease.users === 0)
131
+ leases.delete(key);
132
+ throw error;
133
+ }
134
+ let released = false;
135
+ return async () => {
136
+ if (released)
137
+ return;
138
+ released = true;
139
+ if (--lease.users !== 0)
140
+ return;
141
+ lease.closing = stop();
142
+ try {
143
+ await lease.closing;
144
+ }
145
+ finally {
146
+ if (leases.get(key) === lease)
147
+ leases.delete(key);
148
+ }
149
+ };
150
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ let startup;
2
+ let stopping = false;
3
+ let shutdownTimeoutMs = 5_000;
4
+ async function shutdown() {
5
+ if (stopping)
6
+ return;
7
+ stopping = true;
8
+ const timer = setTimeout(() => process.exit(1), shutdownTimeoutMs);
9
+ try {
10
+ await (await startup)?.close();
11
+ }
12
+ finally {
13
+ clearTimeout(timer);
14
+ process.exit(0);
15
+ }
16
+ }
17
+ process.once('disconnect', () => { void shutdown(); });
18
+ process.once('SIGTERM', () => { void shutdown(); });
19
+ process.once('SIGINT', () => { void shutdown(); });
20
+ process.once('message', message => {
21
+ if (!message || typeof message !== 'object' || !('host' in message) || typeof message.host !== 'string'
22
+ || !('port' in message) || typeof message.port !== 'number' || !Number.isSafeInteger(message.port) || message.port < 1 || message.port > 65535
23
+ || !('shutdownTimeoutMs' in message) || typeof message.shutdownTimeoutMs !== 'number' || !Number.isSafeInteger(message.shutdownTimeoutMs) || message.shutdownTimeoutMs < 1) {
24
+ process.exit(1);
25
+ }
26
+ if (stopping)
27
+ return;
28
+ shutdownTimeoutMs = message.shutdownTimeoutMs;
29
+ const { host, port } = message;
30
+ startup = import('@1agents/acp-service/service').then(service => service.serveAcpService({ host, port, report: false }));
31
+ void startup.then(() => {
32
+ if (!stopping && process.connected)
33
+ process.send?.({ type: 'ready' });
34
+ }, error => {
35
+ if (process.connected)
36
+ process.send?.({ type: 'error', message: error instanceof Error ? error.message : String(error) }, () => process.exit(1));
37
+ else
38
+ process.exit(1);
39
+ });
40
+ });
41
+ if (!process.connected)
42
+ void shutdown();
43
+ export {};
@@ -0,0 +1,22 @@
1
+ export interface NativeImport {
2
+ provider: string;
3
+ nativeSessionId: string;
4
+ /** Imported user messages must never be sent as fresh prompts. */
5
+ messageIds: string[];
6
+ }
7
+ export interface Binding {
8
+ agent: string;
9
+ cwd: string;
10
+ endpoint: string;
11
+ sessionId: string;
12
+ /** Absent on bindings created before native imports were supported. */
13
+ restoreMethod?: 'session/load' | 'session/resume';
14
+ imported?: NativeImport;
15
+ }
16
+ export declare class State {
17
+ readonly directory: string;
18
+ constructor(directory: string);
19
+ private path;
20
+ get(id: string): Binding | undefined;
21
+ save(id: string, binding: Binding): void;
22
+ }
@@ -0,0 +1,47 @@
1
+ /** Plugin-owned identities. DSH session files are never rewritten. */
2
+ import { createHash, randomUUID } from 'node:crypto';
3
+ import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
4
+ import { join } from 'node:path';
5
+ export class State {
6
+ directory;
7
+ constructor(directory) {
8
+ this.directory = directory;
9
+ }
10
+ path(id) { return join(this.directory, createHash('sha256').update(id).digest('hex') + '.json'); }
11
+ get(id) {
12
+ try {
13
+ return decodeBinding(JSON.parse(readFileSync(this.path(id), 'utf8')));
14
+ }
15
+ catch (error) {
16
+ if (error.code === 'ENOENT')
17
+ return;
18
+ throw error;
19
+ }
20
+ }
21
+ save(id, binding) {
22
+ mkdirSync(this.directory, { recursive: true, mode: 0o700 });
23
+ const path = this.path(id), temp = path + '.' + randomUUID();
24
+ writeFileSync(temp, JSON.stringify(binding) + '\n', { flag: 'wx', mode: 0o600 });
25
+ renameSync(temp, path);
26
+ }
27
+ }
28
+ /** Validate plugin-owned JSON while accepting legacy bindings without an explicit restore method. */
29
+ function decodeBinding(value) {
30
+ if (!value || typeof value !== 'object' || Array.isArray(value))
31
+ throw new Error('Invalid ACP binding');
32
+ const binding = value;
33
+ if (['agent', 'cwd', 'endpoint', 'sessionId'].some(key => typeof binding[key] !== 'string' || !binding[key]))
34
+ throw new Error('Invalid ACP binding identity');
35
+ if (binding.restoreMethod !== undefined && binding.restoreMethod !== 'session/load' && binding.restoreMethod !== 'session/resume')
36
+ throw new Error('Invalid ACP restore method');
37
+ if (binding.imported !== undefined) {
38
+ if (!binding.imported || typeof binding.imported !== 'object' || Array.isArray(binding.imported))
39
+ throw new Error('Invalid ACP native import');
40
+ const imported = binding.imported;
41
+ if (typeof imported.provider !== 'string' || typeof imported.nativeSessionId !== 'string'
42
+ || !Array.isArray(imported.messageIds) || !imported.messageIds.every(id => typeof id === 'string')
43
+ || binding.restoreMethod !== 'session/resume')
44
+ throw new Error('Invalid ACP native import');
45
+ }
46
+ return value;
47
+ }
@@ -0,0 +1,18 @@
1
+ /** ACP SDK client over the service's WebSocket transport. */
2
+ import { type Stream, type SessionUpdate, type RequestPermissionRequest, type RequestPermissionResponse } from '@agentclientprotocol/sdk';
3
+ import { WebSocket } from 'ws';
4
+ export type JsonObject = Record<string, unknown>;
5
+ export declare function object(value: unknown): JsonObject;
6
+ export declare function stream(ws: WebSocket): Stream;
7
+ export interface Handlers {
8
+ update(update: SessionUpdate): void;
9
+ permission(params: RequestPermissionRequest, signal: AbortSignal): Promise<RequestPermissionResponse>;
10
+ question(params: JsonObject, signal: AbortSignal): Promise<JsonObject>;
11
+ plan(params: JsonObject, signal: AbortSignal): Promise<JsonObject>;
12
+ }
13
+ export declare function connect(endpoint: string, handlers: Handlers, signal: AbortSignal): Promise<{
14
+ rpc: import("@agentclientprotocol/sdk").ClientContext;
15
+ ws: WebSocket;
16
+ close: () => void;
17
+ closed: Promise<void>;
18
+ }>;
@@ -0,0 +1,71 @@
1
+ /** ACP SDK client over the service's WebSocket transport. */
2
+ import { client } from '@agentclientprotocol/sdk';
3
+ import { WebSocket } from 'ws';
4
+ export function object(value) {
5
+ if (!value || typeof value !== 'object' || Array.isArray(value))
6
+ throw new Error('Expected an ACP object');
7
+ return value;
8
+ }
9
+ export function stream(ws) {
10
+ let readableClosed = false;
11
+ return {
12
+ readable: new ReadableStream({ start(controller) {
13
+ ws.on('message', raw => {
14
+ if (readableClosed)
15
+ return;
16
+ try {
17
+ controller.enqueue(JSON.parse(raw.toString()));
18
+ }
19
+ catch {
20
+ ws.close(1002, 'Invalid JSON');
21
+ }
22
+ });
23
+ ws.once('close', () => {
24
+ if (readableClosed)
25
+ return;
26
+ readableClosed = true;
27
+ controller.close();
28
+ });
29
+ ws.on('error', () => ws.close());
30
+ }, cancel() { readableClosed = true; ws.close(); } }),
31
+ writable: new WritableStream({ write(message) {
32
+ return new Promise((resolve, reject) => {
33
+ if (ws.readyState !== WebSocket.OPEN)
34
+ return reject(new Error('ACP disconnected'));
35
+ ws.send(JSON.stringify(message), error => error ? reject(error) : resolve());
36
+ });
37
+ } }),
38
+ };
39
+ }
40
+ export async function connect(endpoint, handlers, signal) {
41
+ signal.throwIfAborted();
42
+ const ws = new WebSocket(endpoint, { handshakeTimeout: 10_000 });
43
+ const abort = () => ws.terminate();
44
+ signal.addEventListener('abort', abort, { once: true });
45
+ try {
46
+ await new Promise((resolve, reject) => {
47
+ ws.once('open', resolve);
48
+ ws.once('error', reject);
49
+ ws.once('close', () => reject(new Error('ACP connection closed')));
50
+ });
51
+ const connection = client().onNotification('session/update', ({ params }) => handlers.update(params.update))
52
+ .onRequest('session/request_permission', ({ params, signal }) => handlers.permission(params, signal))
53
+ .onRequest('_x.ai/ask_user_question', object, ({ params, signal }) => handlers.question(params, signal))
54
+ .onRequest('_x.ai/exit_plan_mode', object, ({ params, signal }) => handlers.plan(params, signal))
55
+ .connect(stream(ws));
56
+ const initialized = await connection.agent.request('initialize', {
57
+ protocolVersion: 1, clientInfo: { name: 'dsh-acp', version: '0.1.0' },
58
+ clientCapabilities: { _meta: { '1agents': { version: 1 } } },
59
+ }, { cancellationSignal: AbortSignal.any([signal, AbortSignal.timeout(10_000)]) });
60
+ if (initialized.protocolVersion !== 1 || !initialized.agentCapabilities?._meta?.['1agents'])
61
+ throw new Error('Requires acp-service 0.2 with 1agents turn recovery');
62
+ return { rpc: connection.agent, ws, close: () => ws.close(), closed: connection.closed };
63
+ }
64
+ catch (error) {
65
+ ws.terminate();
66
+ throw error;
67
+ }
68
+ finally {
69
+ signal.removeEventListener('abort', abort);
70
+ }
71
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 OpenClaw Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,115 @@
1
+ # acpx 🀝 β€” Agents talking to agents, minus the terminal sΓ©ance
2
+
3
+ <p align="center">
4
+ <img src="acpx_banner.svg" alt="acpx banner" width="100%" />
5
+ </p>
6
+
7
+ [![CI](https://img.shields.io/github/actions/workflow/status/scottzx/1acp/ci.yml?branch=main&style=flat-square&label=ci)](https://github.com/scottzx/1acp/actions/workflows/ci.yml)
8
+ [![npm](https://img.shields.io/npm/v/%40scottzx%2F1acp?style=flat-square)](https://www.npmjs.com/package/@scottzx/1acp)
9
+ [![Node.js](https://img.shields.io/node/v/%40scottzx%2F1acp?style=flat-square)](https://nodejs.org/)
10
+ [![License](https://img.shields.io/github/license/scottzx/1acp?style=flat-square)](LICENSE)
11
+ [![npm downloads](https://img.shields.io/npm/dm/%40scottzx%2F1acp?style=flat-square)](https://www.npmjs.com/package/@scottzx/1acp)
12
+
13
+ `acpx` is a headless command-line client for the [Agent Client Protocol (ACP)](https://agentclientprotocol.com). It gives agents, orchestrators, and developers one structured interface for persistent sessions, one-shot runs, permissions, and machine-readable output across ACP-compatible coding agents.
14
+
15
+ ```console
16
+ $ acpx codex sessions new
17
+ <session-id>
18
+ $ acpx codex "summarize this repository"
19
+ [tool] Read README.md (completed)
20
+ This repository contains ...
21
+ [done] end_turn
22
+ ```
23
+
24
+ > [!NOTE]
25
+ > `acpx` is pre-1.0. Treat its CLI and runtime interfaces as evolving.
26
+
27
+ ## Install
28
+
29
+ Install the published npm package globally:
30
+
31
+ ```bash
32
+ npm install -g @scottzx/1acp@latest
33
+ ```
34
+
35
+ The package installs both `1acp` and the upstream-compatible `acpx` command. It requires Node.js 22.13 or newer. To try it without a global install, prefix a command with `npx @scottzx/1acp@latest` instead. See the [install guide](docs/install.md) for adapter prerequisites, updates, and source builds.
36
+
37
+ ## Quick start
38
+
39
+ Install and authenticate the coding agent you want to use, then create a session in your project and send it a prompt:
40
+
41
+ ```bash
42
+ acpx codex sessions new
43
+ acpx codex "find the slowest test and explain why"
44
+ ```
45
+
46
+ The session is scoped to the current repository and persists across invocations. Creating sessions explicitly prevents automation from starting an unexpected conversation. The [quickstart](docs/quickstart.md) continues with named sessions, one-shot runs, history, and JSON output.
47
+
48
+ ## Choose an agent
49
+
50
+ Common launch examples use the same command shape:
51
+
52
+ | Agent | Command |
53
+ | ----------------- | ---------------------------- |
54
+ | Pi | `acpx pi …` |
55
+ | OpenClaw | `acpx openclaw …` |
56
+ | Codex | `acpx codex …` |
57
+ | Claude Code | `acpx claude …` |
58
+ | Custom ACP server | `acpx --agent '<command>' …` |
59
+
60
+ The upstream agent must be installed and authenticated when its adapter does not provide that itself. See [built-in agents](docs/agents.md) for every supported profile and [custom agents](docs/custom-agents.md) for registry configuration.
61
+
62
+ ## Sessions and one-shot runs
63
+
64
+ Persistent sessions keep context between prompts, support parallel named workstreams, and queue follow-up prompts when a turn is already running. Use `exec` when you want a stateless run with no saved session.
65
+
66
+ ```bash
67
+ acpx codex sessions new --name backend
68
+ acpx codex -s backend "trace the checkout timeout"
69
+ acpx codex exec "summarize this repository"
70
+ acpx --model gpt-5.4 codex exec --config-option reasoning_effort=high "review this repository"
71
+ ```
72
+
73
+ Session state lives under `~/.acpx/`. The [sessions guide](docs/sessions.md) covers scope, queue ownership, reconnects, export/import, cancellation, and cleanup.
74
+
75
+ ## Automation and permissions
76
+
77
+ Text output is the default. `--format json` emits NDJSON ACP events for automation, while `--format quiet` prints only the final assistant text. Output events retain structured thinking, tool calls, diffs, and completion state instead of terminal escape sequences.
78
+
79
+ Permission modes range from read approval to explicit deny or approve-all policies. Use `--cwd` to set the session scope and filesystem boundary. Global and project JSON configuration can provide defaults; command-line flags take precedence.
80
+
81
+ - [Output formats](docs/output-formats.md)
82
+ - [Permissions](docs/permissions.md)
83
+ - [Configuration](docs/config.md)
84
+ - [Exit codes](docs/exit-codes.md)
85
+
86
+ ## Flows and embedding
87
+
88
+ For multi-step work, `acpx flow run` executes TypeScript workflows that combine ACP turns with deterministic actions, decisions, computation, and checkpoints. The package also exports `acpx/runtime` and `acpx/flows` for applications that need session and workflow primitives without shelling out.
89
+
90
+ Start with the [flows guide](docs/flows.md), then use the [examples](examples/flows/README.md) and [architecture notes](docs/2026-03-25-acpx-flows-architecture.md) for deeper integrations.
91
+
92
+ ## Documentation
93
+
94
+ - [CLI reference](docs/CLI.md) β€” commands, flags, and behavior
95
+ - [Prompting](docs/prompting.md) β€” arguments, stdin, files, and queueing
96
+ - [Session controls](docs/session-control.md) β€” cancel, modes, options, and status
97
+ - [Compare agents](docs/compare.md) β€” run one prompt across multiple agents
98
+ - [ACP coverage](docs/2026-02-19-acp-coverage-roadmap.md) β€” implemented protocol methods
99
+ - [Vision](VISION.md) β€” project scope and design principles
100
+
101
+ The full documentation is also available at [acpx.sh](https://acpx.sh/).
102
+
103
+ ## Development
104
+
105
+ ```bash
106
+ pnpm install --frozen-lockfile
107
+ pnpm run check
108
+ pnpm run check:docs
109
+ ```
110
+
111
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution and review guidance.
112
+
113
+ ## License
114
+
115
+ MIT. See [LICENSE](LICENSE).