@layernorm/overlay-agent-host 0.3.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 (87) hide show
  1. package/Dockerfile +19 -0
  2. package/README.md +136 -0
  3. package/dist/acp-adapter.d.ts +37 -0
  4. package/dist/acp-adapter.d.ts.map +1 -0
  5. package/dist/acp-adapter.js +218 -0
  6. package/dist/acp-adapter.js.map +1 -0
  7. package/dist/adapter-manifests.d.ts +47 -0
  8. package/dist/adapter-manifests.d.ts.map +1 -0
  9. package/dist/adapter-manifests.js +30 -0
  10. package/dist/adapter-manifests.js.map +1 -0
  11. package/dist/adapter.d.ts +32 -0
  12. package/dist/adapter.d.ts.map +1 -0
  13. package/dist/adapter.js +2 -0
  14. package/dist/adapter.js.map +1 -0
  15. package/dist/cli.d.ts +2 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +203 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/config.d.ts +177 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +55 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/connection.d.ts +67 -0
  24. package/dist/connection.d.ts.map +1 -0
  25. package/dist/connection.js +30 -0
  26. package/dist/connection.js.map +1 -0
  27. package/dist/device-key.d.ts +6 -0
  28. package/dist/device-key.d.ts.map +1 -0
  29. package/dist/device-key.js +28 -0
  30. package/dist/device-key.js.map +1 -0
  31. package/dist/doctor.d.ts +9 -0
  32. package/dist/doctor.d.ts.map +1 -0
  33. package/dist/doctor.js +47 -0
  34. package/dist/doctor.js.map +1 -0
  35. package/dist/enrollment.d.ts +18 -0
  36. package/dist/enrollment.d.ts.map +1 -0
  37. package/dist/enrollment.js +76 -0
  38. package/dist/enrollment.js.map +1 -0
  39. package/dist/eve-adapter.d.ts +61 -0
  40. package/dist/eve-adapter.d.ts.map +1 -0
  41. package/dist/eve-adapter.js +315 -0
  42. package/dist/eve-adapter.js.map +1 -0
  43. package/dist/fake-adapter.d.ts +29 -0
  44. package/dist/fake-adapter.d.ts.map +1 -0
  45. package/dist/fake-adapter.js +41 -0
  46. package/dist/fake-adapter.js.map +1 -0
  47. package/dist/filesystem-policy.d.ts +7 -0
  48. package/dist/filesystem-policy.d.ts.map +1 -0
  49. package/dist/filesystem-policy.js +23 -0
  50. package/dist/filesystem-policy.js.map +1 -0
  51. package/dist/hermes-readiness.d.ts +6 -0
  52. package/dist/hermes-readiness.d.ts.map +1 -0
  53. package/dist/hermes-readiness.js +21 -0
  54. package/dist/hermes-readiness.js.map +1 -0
  55. package/dist/index.d.ts +17 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +17 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/launchd.d.ts +15 -0
  60. package/dist/launchd.d.ts.map +1 -0
  61. package/dist/launchd.js +86 -0
  62. package/dist/launchd.js.map +1 -0
  63. package/dist/logger.d.ts +11 -0
  64. package/dist/logger.d.ts.map +1 -0
  65. package/dist/logger.js +24 -0
  66. package/dist/logger.js.map +1 -0
  67. package/dist/runtime-version.d.ts +3 -0
  68. package/dist/runtime-version.d.ts.map +1 -0
  69. package/dist/runtime-version.js +8 -0
  70. package/dist/runtime-version.js.map +1 -0
  71. package/dist/runtime.d.ts +54 -0
  72. package/dist/runtime.d.ts.map +1 -0
  73. package/dist/runtime.js +254 -0
  74. package/dist/runtime.js.map +1 -0
  75. package/dist/state.d.ts +39 -0
  76. package/dist/state.d.ts.map +1 -0
  77. package/dist/state.js +160 -0
  78. package/dist/state.js.map +1 -0
  79. package/dist/transport.d.ts +57 -0
  80. package/dist/transport.d.ts.map +1 -0
  81. package/dist/transport.js +119 -0
  82. package/dist/transport.js.map +1 -0
  83. package/docker-compose.example.yml +15 -0
  84. package/package.json +60 -0
  85. package/src/cli.mjs +9 -0
  86. package/systemd/agent-host.env.example +6 -0
  87. package/systemd/overlay-agent-host.service +32 -0
package/Dockerfile ADDED
@@ -0,0 +1,19 @@
1
+ FROM node:24-bookworm-slim
2
+
3
+ RUN apt-get update \
4
+ && apt-get install -y --no-install-recommends ca-certificates git openssh-client \
5
+ && rm -rf /var/lib/apt/lists/*
6
+
7
+ WORKDIR /opt/overlay
8
+ COPY package.json package-lock.json ./
9
+ COPY packages ./packages
10
+ RUN npm ci --omit=dev --workspace=@layernorm/overlay-agent-host --include-workspace-root=false \
11
+ && ln -s /opt/overlay/packages/overlay-agent-host/src/cli.mjs /usr/local/bin/overlay-agent-host \
12
+ && chmod +x /opt/overlay/packages/overlay-agent-host/src/cli.mjs \
13
+ && mkdir -p /workspace /var/lib/overlay-agent-host \
14
+ && chown -R node:node /workspace /var/lib/overlay-agent-host
15
+
16
+ USER node
17
+ WORKDIR /workspace
18
+ ENTRYPOINT ["overlay-agent-host"]
19
+ CMD ["run", "--config", "/etc/overlay-agent-host/config.json"]
package/README.md ADDED
@@ -0,0 +1,136 @@
1
+ # Overlay Agent Host
2
+
3
+ `@layernorm/overlay-agent-host` runs the same outbound-only bridge on a local computer, VPS, container, or
4
+ managed sandbox. It persists command outcomes, remote sessions, adapter stream cursors, and
5
+ unacknowledged events in SQLite, so restarting the host does not duplicate accepted work.
6
+
7
+ Node.js 24 or newer is required. Overlay's one-copy command supplies a pinned Node 24 runtime even
8
+ when the machine's default `node` is older:
9
+
10
+ ```sh
11
+ npx --yes --package node@24 --package @layernorm/overlay-agent-host@0.3.0 \
12
+ overlay-agent-host connect <enrollment-code> \
13
+ --server https://getoverlay.io \
14
+ --kind vps \
15
+ --run
16
+ ```
17
+
18
+ The machine needs outbound HTTPS access to Overlay and durable storage for the state directory.
19
+ It does not need an inbound port.
20
+
21
+ Browser enrollment writes a restartable `config.json` beside the private connection state. The
22
+ credential remains in the mode-0600 connection store rather than the JSON file:
23
+
24
+ ```json
25
+ {
26
+ "environmentId": "environment-id",
27
+ "workspaceId": "workspace-id",
28
+ "controlPlaneUrl": "https://example.com/api/v1/agent-environments/environment-id/host/",
29
+ "credentialEnv": "OVERLAY_AGENT_HOST_CREDENTIAL",
30
+ "stateDirectory": "/absolute/path/to/overlay-agent-host",
31
+ "filesystem": {
32
+ "mode": "selected_roots",
33
+ "roots": ["/absolute/project-one", "/absolute/project-two"]
34
+ },
35
+ "adapters": [
36
+ { "manifest": "codex" },
37
+ { "manifest": "claude-code" },
38
+ { "manifest": "hermes" }
39
+ ]
40
+ }
41
+ ```
42
+
43
+ The built-in manifests resolve to the exact, release-tested
44
+ `@agentclientprotocol/codex-acp@1.7.0` and
45
+ `@agentclientprotocol/claude-agent-acp@0.70.0` packages. Hermes uses its official
46
+ `hermes acp` stdio server and requires Hermes Agent 0.20.6 or newer. Install Hermes from the
47
+ official Nous Research distribution, then verify it before enrollment with
48
+ `hermes acp --check`. A custom
49
+ ACP process can still use the explicit `id`, `displayName`, `protocol`, `command`, and `args`
50
+ shape.
51
+
52
+ ## Eve
53
+
54
+ Eve is connected through its supported `eve/client` session and durable NDJSON stream contract.
55
+ Run the Agent Host beside the private Eve service and point the adapter at its loopback or private
56
+ network URL:
57
+
58
+ ```json
59
+ {
60
+ "id": "eve",
61
+ "displayName": "My Eve agent",
62
+ "protocol": "eve",
63
+ "host": "http://127.0.0.1:3000",
64
+ "bearerTokenEnv": "EVE_AGENT_TOKEN"
65
+ }
66
+ ```
67
+
68
+ The equivalent enrollment form is:
69
+
70
+ ```sh
71
+ npx --yes --package node@24 --package @layernorm/overlay-agent-host@0.3.0 \
72
+ overlay-agent-host connect <enrollment-code> \
73
+ --server https://getoverlay.io \
74
+ --kind vps \
75
+ --adapter eve \
76
+ --eve-url http://127.0.0.1:3000 \
77
+ --eve-auth-env EVE_AGENT_TOKEN \
78
+ --run
79
+ ```
80
+
81
+ Overlay remains authoritative for approvals, commands, billing attribution, audit, and transcript
82
+ projection. The adapter ignores private reasoning events, validates replies against Eve's pending
83
+ input requests, and persists Eve's session ID, stream cursor, visible text, and usage accumulators
84
+ for reconnects. Eve is pinned because its APIs are still preview. A missing cursor fails closed and
85
+ requires `start fresh`. Eve connection OAuth pauses are not bridged; an `authorization.required`
86
+ event fails the run closed instead of leaving it parked without an Overlay control.
87
+
88
+ ## Background and container operation
89
+
90
+ On macOS, install the per-user LaunchAgent after enrollment so the environment remains online when
91
+ Terminal closes and returns after login or process failure. Use the exact config path printed by
92
+ `connect`:
93
+
94
+ ```sh
95
+ npx --yes --package node@24 --package @layernorm/overlay-agent-host@0.3.0 \
96
+ overlay-agent-host service install --config "$HOME/.overlay/agent-host/config.json"
97
+ npx --yes --package node@24 --package @layernorm/overlay-agent-host@0.3.0 \
98
+ overlay-agent-host service status --config "$HOME/.overlay/agent-host/config.json"
99
+ ```
100
+
101
+ `service uninstall` stops and removes only that environment's LaunchAgent. It preserves the
102
+ credential, config, and SQLite state so the connection can be restarted later.
103
+
104
+ For a Linux VPS, create a dedicated `overlay-agent` system account, install the CLI globally, copy
105
+ `systemd/overlay-agent-host.service` to `/etc/systemd/system/`, and place configuration under
106
+ `/etc/overlay-agent-host/`. Adjust `ReadWritePaths` in the unit to exactly the project roots granted
107
+ in Overlay, then enable it:
108
+
109
+ ```sh
110
+ sudo systemctl daemon-reload
111
+ sudo systemctl enable --now overlay-agent-host
112
+ sudo systemctl status overlay-agent-host
113
+ ```
114
+
115
+ The unit restarts after process or machine failure and keeps state in `/var/lib/overlay-agent-host`.
116
+ Upgrades are `npm install -g @layernorm/overlay-agent-host@<version>` followed by `systemctl restart`; do not
117
+ delete the state directory. `docker-compose.example.yml` provides the same persistent, outbound-only
118
+ shape for Docker. It exposes no host ports. Mount the approved workspaces and state volume, pull a
119
+ pinned image version, and recreate the service to upgrade.
120
+
121
+ Run diagnostics and then the host:
122
+
123
+ ```sh
124
+ OVERLAY_AGENT_HOST_CREDENTIAL=... overlay-agent-host doctor --config /absolute/path/config.json
125
+ OVERLAY_AGENT_HOST_CREDENTIAL=... overlay-agent-host run --config /absolute/path/config.json
126
+ ```
127
+
128
+ Use `{"mode":"all_user_files"}` only when the user deliberately wants the harness to inherit
129
+ all filesystem access available to the host OS account. Selected roots validate the working
130
+ directory and ACP workspace roots; they are not an operating-system sandbox. For strict file
131
+ isolation, run the host and harness under a restricted OS account, container, VM, or managed
132
+ sandbox.
133
+
134
+ Native adapters such as OpenClaw are added only when the harness cannot expose ACP and only after
135
+ the unchanged Agent Host conformance suite passes. Hermes uses its official ACP server. MCP remains
136
+ a tool/resource protocol; it is not used as the execution lifecycle transport.
@@ -0,0 +1,37 @@
1
+ import type { AgentAdapter, AgentAdapterSession, EmitAgentEvent, StartAdapterSessionInput } from './adapter.js';
2
+ export type AcpAdapterOptions = {
3
+ id: string;
4
+ displayName: string;
5
+ command: string;
6
+ args?: string[];
7
+ env?: Record<string, string>;
8
+ verify?: () => Promise<void>;
9
+ };
10
+ export declare class AcpAgentAdapter implements AgentAdapter {
11
+ private readonly options;
12
+ readonly capability: {
13
+ id: string;
14
+ displayName: string;
15
+ protocol: "acp";
16
+ supports: {
17
+ prompt: boolean;
18
+ approval: boolean;
19
+ cancel: boolean;
20
+ resume: boolean;
21
+ };
22
+ };
23
+ constructor(options: AcpAdapterOptions);
24
+ discover(): Promise<{
25
+ id: string;
26
+ displayName: string;
27
+ protocol: "acp";
28
+ supports: {
29
+ prompt: boolean;
30
+ approval: boolean;
31
+ cancel: boolean;
32
+ resume: boolean;
33
+ };
34
+ }>;
35
+ start(input: StartAdapterSessionInput, emit: EmitAgentEvent): Promise<AgentAdapterSession>;
36
+ }
37
+ //# sourceMappingURL=acp-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp-adapter.d.ts","sourceRoot":"","sources":["../src/acp-adapter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAE/G,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B,CAAA;AAID,qBAAa,eAAgB,YAAW,YAAY;IAGtC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,QAAQ,CAAC,UAAU;;;;;;;;;;MAAA;gBAEU,OAAO,EAAE,iBAAiB;IAOjD,QAAQ;;;;;;;;;;;IAKR,KAAK,CAAC,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA4HjG"}
@@ -0,0 +1,218 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { randomUUID } from 'node:crypto';
3
+ import { Readable, Writable } from 'node:stream';
4
+ import * as acp from '@agentclientprotocol/sdk';
5
+ export class AcpAgentAdapter {
6
+ options;
7
+ capability;
8
+ constructor(options) {
9
+ this.options = options;
10
+ this.capability = {
11
+ id: options.id, displayName: options.displayName, protocol: 'acp',
12
+ supports: { prompt: true, approval: true, cancel: true, resume: true },
13
+ };
14
+ }
15
+ async discover() {
16
+ await this.options.verify?.();
17
+ return this.capability;
18
+ }
19
+ async start(input, emit) {
20
+ const ready = deferred();
21
+ const closed = deferred();
22
+ const permissions = new Map();
23
+ const elicitations = new Map();
24
+ let child;
25
+ let activeContext;
26
+ let sessionId = input.remoteSessionId;
27
+ let textCheckpoint = '';
28
+ const app = acp.client({ name: 'overlay-agent-host' })
29
+ .onRequest(acp.methods.client.session.requestPermission, async ({ params }) => {
30
+ const requestKey = params.toolCall.toolCallId || randomUUID();
31
+ const response = deferred();
32
+ permissions.set(requestKey, { response, options: new Set(params.options.map((option) => option.optionId)) });
33
+ await emit({
34
+ type: 'approval_requested',
35
+ payload: {
36
+ requestKey,
37
+ prompt: params.toolCall.title ?? 'Agent permission request',
38
+ options: params.options.map((option) => ({ id: option.optionId, label: option.name })),
39
+ context: { toolCallId: params.toolCall.toolCallId },
40
+ },
41
+ });
42
+ const optionId = await response.promise;
43
+ permissions.delete(requestKey);
44
+ return optionId ? { outcome: { outcome: 'selected', optionId } } : { outcome: { outcome: 'cancelled' } };
45
+ })
46
+ .onRequest(acp.methods.client.elicitation.create, async ({ params }) => {
47
+ if (params.mode !== 'form')
48
+ return { action: 'decline' };
49
+ const requestKey = randomUUID();
50
+ const response = deferred();
51
+ elicitations.set(requestKey, { response });
52
+ await emit({ type: 'elicitation_requested', payload: { requestKey, prompt: params.message,
53
+ requestedSchema: params.requestedSchema, context: {} } });
54
+ const result = await response.promise;
55
+ elicitations.delete(requestKey);
56
+ return result;
57
+ })
58
+ .onNotification(acp.methods.client.session.update, async ({ params }) => {
59
+ await normalizeAcpUpdate(params.update, emit, {
60
+ appendText(chunk) {
61
+ textCheckpoint += chunk;
62
+ return textCheckpoint;
63
+ },
64
+ });
65
+ });
66
+ const background = async () => {
67
+ child = spawn(this.options.command, this.options.args ?? [], {
68
+ cwd: input.workingDirectory,
69
+ env: { ...process.env, ...this.options.env },
70
+ stdio: ['pipe', 'pipe', 'pipe'],
71
+ });
72
+ child.stderr.on('data', (chunk) => {
73
+ if (process.env.OVERLAY_AGENT_HOST_DEBUG_ACP === '1')
74
+ process.stderr.write(chunk);
75
+ });
76
+ child.once('error', ready.reject);
77
+ const stream = acp.ndJsonStream(Writable.toWeb(child.stdin), Readable.toWeb(child.stdout));
78
+ await app.connectWith(stream, async (context) => {
79
+ activeContext = context;
80
+ const initialized = await context.request(acp.methods.agent.initialize, {
81
+ protocolVersion: acp.PROTOCOL_VERSION,
82
+ clientCapabilities: { elicitation: { form: {} } },
83
+ });
84
+ if (sessionId && initialized.agentCapabilities?.loadSession !== true) {
85
+ throw new Error(`ACP adapter ${this.options.id} does not support session resume`);
86
+ }
87
+ if (sessionId) {
88
+ await context.request(acp.methods.agent.session.load, {
89
+ sessionId, cwd: input.workingDirectory, additionalDirectories: input.additionalDirectories, mcpServers: [],
90
+ });
91
+ }
92
+ else {
93
+ const created = await context.request(acp.methods.agent.session.new, {
94
+ cwd: input.workingDirectory, additionalDirectories: input.additionalDirectories, mcpServers: [],
95
+ });
96
+ sessionId = created.sessionId;
97
+ }
98
+ ready.resolve({ sessionId, context });
99
+ await closed.promise;
100
+ });
101
+ };
102
+ void background().catch(async (error) => {
103
+ ready.reject(error);
104
+ await emit({ type: 'failed', payload: { code: 'acp_connection_failed', message: safeError(error), retryable: true } });
105
+ }).finally(() => child?.kill());
106
+ const initialized = await ready.promise;
107
+ const requireContext = () => activeContext ?? initialized.context;
108
+ return {
109
+ remoteSessionId: initialized.sessionId,
110
+ prompt: async (prompt) => {
111
+ const result = await requireContext().request(acp.methods.agent.session.prompt, {
112
+ sessionId: initialized.sessionId, prompt: [{ type: 'text', text: prompt }],
113
+ });
114
+ await emit({ type: 'completed', payload: { summary: `ACP turn stopped: ${result.stopReason}`, usage: {} } });
115
+ },
116
+ approve: async (requestKey, optionId) => {
117
+ const pending = permissions.get(requestKey);
118
+ if (!pending)
119
+ throw new Error(`ACP approval request is not pending: ${requestKey}`);
120
+ if (!pending.options.has(optionId))
121
+ throw new Error(`ACP approval option is invalid: ${optionId}`);
122
+ pending.response.resolve(optionId);
123
+ },
124
+ elicit: async (requestKey, action, content) => {
125
+ const pending = elicitations.get(requestKey);
126
+ if (!pending)
127
+ throw new Error(`ACP elicitation request is not pending: ${requestKey}`);
128
+ pending.response.resolve(action === 'accept' ? { action, content: content } : { action });
129
+ },
130
+ cancel: async () => {
131
+ await requireContext().notify(acp.methods.agent.session.cancel, { sessionId: initialized.sessionId });
132
+ await emit({ type: 'cancelled', payload: {} });
133
+ },
134
+ resume: async () => undefined,
135
+ stop: async () => {
136
+ for (const pending of permissions.values())
137
+ pending.response.resolve(undefined);
138
+ for (const pending of elicitations.values())
139
+ pending.response.resolve({ action: 'cancel' });
140
+ closed.resolve();
141
+ child?.kill();
142
+ },
143
+ };
144
+ }
145
+ }
146
+ async function normalizeAcpUpdate(update, emit, checkpoint) {
147
+ if (update.sessionUpdate === 'agent_message_chunk' && update.content.type === 'text') {
148
+ await emit({ type: 'text_checkpoint', payload: { text: checkpoint.appendText(update.content.text) } });
149
+ return;
150
+ }
151
+ if (update.sessionUpdate === 'tool_call') {
152
+ await emit({ type: 'action', payload: { actionId: update.toolCallId, title: update.title, status: normalizeStatus(update.status) } });
153
+ await emitToolContent(update.toolCallId, update.title, update.content, emit);
154
+ return;
155
+ }
156
+ if (update.sessionUpdate === 'tool_call_update') {
157
+ await emit({ type: 'action', payload: { actionId: update.toolCallId, title: update.title ?? 'Tool call', status: normalizeStatus(update.status) } });
158
+ await emitToolContent(update.toolCallId, update.title ?? 'Tool call', update.content, emit);
159
+ return;
160
+ }
161
+ if (update.sessionUpdate === 'plan') {
162
+ await emit({ type: 'plan', payload: { entries: update.entries.map((entry, index) => ({
163
+ id: `plan-${index}`, title: entry.content, status: entry.status,
164
+ })) } });
165
+ return;
166
+ }
167
+ if (update.sessionUpdate === 'plan_update') {
168
+ const plan = update.plan;
169
+ const entries = plan.type === 'items'
170
+ ? plan.entries.map((entry, index) => ({ id: `${plan.planId}-${index}`, title: entry.content, status: entry.status }))
171
+ : [{ id: plan.planId, title: plan.type === 'markdown' ? plan.content : `Plan: ${plan.uri}`, status: 'in_progress' }];
172
+ await emit({ type: 'plan', payload: { entries } });
173
+ return;
174
+ }
175
+ if (update.sessionUpdate === 'plan_removed') {
176
+ await emit({ type: 'plan', payload: { entries: [] } });
177
+ }
178
+ }
179
+ async function emitToolContent(toolCallId, title, content, emit) {
180
+ for (const [index, item] of (content ?? []).entries()) {
181
+ if (item.type === 'diff') {
182
+ const oldText = item.oldText ?? '';
183
+ await emit({ type: 'diff', payload: {
184
+ diffId: `${toolCallId}-diff-${index}`,
185
+ title: item.path.slice(0, 2_000),
186
+ patch: unifiedDiff(item.path, oldText, item.newText),
187
+ } });
188
+ }
189
+ else if (item.type === 'terminal') {
190
+ await emit({ type: 'terminal', payload: {
191
+ terminalId: item.terminalId,
192
+ title: title.slice(0, 2_000),
193
+ summary: `Terminal ${item.terminalId} is attached to this action.`,
194
+ status: 'running',
195
+ } });
196
+ }
197
+ }
198
+ }
199
+ function unifiedDiff(path, oldText, newText) {
200
+ return `--- a/${path}\n+++ b/${path}\n@@\n-${oldText}\n+${newText}`.slice(0, 200_000);
201
+ }
202
+ function normalizeStatus(status) {
203
+ if (status === 'completed')
204
+ return 'completed';
205
+ if (status === 'failed')
206
+ return 'failed';
207
+ if (status === 'in_progress' || status === 'pending')
208
+ return 'started';
209
+ return 'updated';
210
+ }
211
+ function deferred() {
212
+ let resolve;
213
+ let reject;
214
+ const promise = new Promise((accept, decline) => { resolve = accept; reject = decline; });
215
+ return { promise, resolve, reject };
216
+ }
217
+ function safeError(error) { return error instanceof Error ? error.message.slice(0, 2_000) : 'Unknown ACP error'; }
218
+ //# sourceMappingURL=acp-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp-adapter.js","sourceRoot":"","sources":["../src/acp-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAuC,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAA;AAc/C,MAAM,OAAO,eAAe;IAGG;IAFpB,UAAU,CAAA;IAEnB,YAA6B,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;QACrD,IAAI,CAAC,UAAU,GAAG;YAChB,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,KAAc;YAC1E,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;SACvE,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,UAAU,8BAA8B;oBAClE,MAAM,EAAE,SAAS;iBAClB,EAAE,CAAC,CAAA;QACN,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,OAAe,EAAE,OAAe;IACjE,OAAO,SAAS,IAAI,WAAW,IAAI,UAAU,OAAO,MAAM,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;AACvF,CAAC;AAED,SAAS,eAAe,CAAC,MAAiC;IACxD,IAAI,MAAM,KAAK,WAAW;QAAE,OAAO,WAAW,CAAA;IAC9C,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAA;IACxC,IAAI,MAAM,KAAK,aAAa,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACtE,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,QAAQ;IACf,IAAI,OAA4B,CAAA;IAChC,IAAI,MAAiC,CAAA;IACrC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,OAAO,CAAA,CAAC,CAAC,CAAC,CAAA;IAC3F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AACrC,CAAC;AAED,SAAS,SAAS,CAAC,KAAc,IAAY,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAA,CAAC,CAAC"}
@@ -0,0 +1,47 @@
1
+ export declare const CODEX_ACP_PACKAGE_VERSION = "1.7.0";
2
+ export declare const CLAUDE_AGENT_ACP_PACKAGE_VERSION = "0.70.0";
3
+ export declare const HERMES_AGENT_MINIMUM_VERSION = "0.20.6";
4
+ export declare const ACP_ADAPTER_MANIFESTS: {
5
+ readonly codex: {
6
+ readonly id: "codex";
7
+ readonly displayName: "Codex";
8
+ readonly protocol: "acp";
9
+ readonly command: "npx";
10
+ readonly args: readonly ["-y", "@agentclientprotocol/codex-acp@1.7.0"];
11
+ };
12
+ readonly 'claude-code': {
13
+ readonly id: "claude-code";
14
+ readonly displayName: "Claude Code";
15
+ readonly protocol: "acp";
16
+ readonly command: "npx";
17
+ readonly args: readonly ["-y", "@agentclientprotocol/claude-agent-acp@0.70.0"];
18
+ };
19
+ readonly hermes: {
20
+ readonly id: "hermes";
21
+ readonly displayName: "Hermes";
22
+ readonly protocol: "acp";
23
+ readonly command: "hermes";
24
+ readonly args: readonly ["acp"];
25
+ };
26
+ };
27
+ export type AcpAdapterManifestId = keyof typeof ACP_ADAPTER_MANIFESTS;
28
+ export declare function resolveAcpAdapterManifest(id: string): {
29
+ readonly id: "codex";
30
+ readonly displayName: "Codex";
31
+ readonly protocol: "acp";
32
+ readonly command: "npx";
33
+ readonly args: readonly ["-y", "@agentclientprotocol/codex-acp@1.7.0"];
34
+ } | {
35
+ readonly id: "claude-code";
36
+ readonly displayName: "Claude Code";
37
+ readonly protocol: "acp";
38
+ readonly command: "npx";
39
+ readonly args: readonly ["-y", "@agentclientprotocol/claude-agent-acp@0.70.0"];
40
+ } | {
41
+ readonly id: "hermes";
42
+ readonly displayName: "Hermes";
43
+ readonly protocol: "acp";
44
+ readonly command: "hermes";
45
+ readonly args: readonly ["acp"];
46
+ };
47
+ //# sourceMappingURL=adapter-manifests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-manifests.d.ts","sourceRoot":"","sources":["../src/adapter-manifests.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,UAAU,CAAA;AAChD,eAAO,MAAM,gCAAgC,WAAW,CAAA;AACxD,eAAO,MAAM,4BAA4B,WAAW,CAAA;AAEpD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;CAsBxB,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,qBAAqB,CAAA;AAErE,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;EAEnD"}
@@ -0,0 +1,30 @@
1
+ export const CODEX_ACP_PACKAGE_VERSION = '1.7.0';
2
+ export const CLAUDE_AGENT_ACP_PACKAGE_VERSION = '0.70.0';
3
+ export const HERMES_AGENT_MINIMUM_VERSION = '0.20.6';
4
+ export const ACP_ADAPTER_MANIFESTS = {
5
+ codex: {
6
+ id: 'codex',
7
+ displayName: 'Codex',
8
+ protocol: 'acp',
9
+ command: 'npx',
10
+ args: ['-y', `@agentclientprotocol/codex-acp@${CODEX_ACP_PACKAGE_VERSION}`],
11
+ },
12
+ 'claude-code': {
13
+ id: 'claude-code',
14
+ displayName: 'Claude Code',
15
+ protocol: 'acp',
16
+ command: 'npx',
17
+ args: ['-y', `@agentclientprotocol/claude-agent-acp@${CLAUDE_AGENT_ACP_PACKAGE_VERSION}`],
18
+ },
19
+ hermes: {
20
+ id: 'hermes',
21
+ displayName: 'Hermes',
22
+ protocol: 'acp',
23
+ command: 'hermes',
24
+ args: ['acp'],
25
+ },
26
+ };
27
+ export function resolveAcpAdapterManifest(id) {
28
+ return ACP_ADAPTER_MANIFESTS[id];
29
+ }
30
+ //# sourceMappingURL=adapter-manifests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-manifests.js","sourceRoot":"","sources":["../src/adapter-manifests.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAA;AAChD,MAAM,CAAC,MAAM,gCAAgC,GAAG,QAAQ,CAAA;AACxD,MAAM,CAAC,MAAM,4BAA4B,GAAG,QAAQ,CAAA;AAEpD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,WAAW,EAAE,OAAO;QACpB,QAAQ,EAAE,KAAc;QACxB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,IAAI,EAAE,kCAAkC,yBAAyB,EAAE,CAAC;KAC5E;IACD,aAAa,EAAE;QACb,EAAE,EAAE,aAAa;QACjB,WAAW,EAAE,aAAa;QAC1B,QAAQ,EAAE,KAAc;QACxB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,IAAI,EAAE,yCAAyC,gCAAgC,EAAE,CAAC;KAC1F;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,WAAW,EAAE,QAAQ;QACrB,QAAQ,EAAE,KAAc;QACxB,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,CAAC,KAAK,CAAC;KACd;CACO,CAAA;AAIV,MAAM,UAAU,yBAAyB,CAAC,EAAU;IAClD,OAAO,qBAAqB,CAAC,EAA0B,CAAC,CAAA;AAC1D,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { AdapterCapability, AgentHostEvent } from '@layernorm/overlay-agent-bridge-protocol';
2
+ type NormalizeEvent<Event> = Event extends AgentHostEvent ? Pick<Event, 'type' | 'payload'> : never;
3
+ export type NormalizedAgentEvent = NormalizeEvent<AgentHostEvent>;
4
+ export type EmitAgentEvent = (event: NormalizedAgentEvent) => Promise<void>;
5
+ export type StartAdapterSessionInput = {
6
+ runId: string;
7
+ workingDirectory: string;
8
+ additionalDirectories: string[];
9
+ prompt: string;
10
+ remoteSessionId?: string;
11
+ metadata: Record<string, unknown>;
12
+ adapterState?: Record<string, unknown>;
13
+ persistAdapterState?: (state: Record<string, unknown>) => void;
14
+ };
15
+ export interface AgentAdapterSession {
16
+ readonly remoteSessionId: string;
17
+ /** The adapter dispatched the first prompt while creating the remote session. */
18
+ readonly initialPromptHandled?: boolean;
19
+ prompt(prompt: string): Promise<void>;
20
+ approve(requestKey: string, optionId: string): Promise<void>;
21
+ elicit(requestKey: string, action: 'accept' | 'decline' | 'cancel', content?: Record<string, unknown>): Promise<void>;
22
+ cancel(reason?: string): Promise<void>;
23
+ resume(): Promise<void>;
24
+ stop(reason?: string): Promise<void>;
25
+ }
26
+ export interface AgentAdapter {
27
+ readonly capability: AdapterCapability;
28
+ discover(): Promise<AdapterCapability>;
29
+ start(input: StartAdapterSessionInput, emit: EmitAgentEvent): Promise<AgentAdapterSession>;
30
+ }
31
+ export {};
32
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAEjG,KAAK,cAAc,CAAC,KAAK,IAAI,KAAK,SAAS,cAAc,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,KAAK,CAAA;AACnG,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAA;AACjE,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE3E,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB,EAAE,MAAM,CAAA;IACxB,qBAAqB,EAAE,MAAM,EAAE,CAAA;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;CAC/D,CAAA;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,iFAAiF;IACjF,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IACvC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5D,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrH,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACvB,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACrC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAA;IACtC,QAAQ,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACtC,KAAK,CAAC,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAC3F"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":""}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}