@agentproto/adapter-openclaw 0.1.0-alpha.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.
- package/LICENSE +21 -0
- package/OPENCLAW.md +141 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.mjs +125 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 agentproto contributors
|
|
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.
|
package/OPENCLAW.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openclaw
|
|
3
|
+
id: openclaw
|
|
4
|
+
description: OpenClaw — coding-agent platform with a native plugin surface and built-in ACP bridge. `openclaw acp` exposes a Gateway session as an ACP server over stdio JSON-RPC; an external host (Zed, agentproto driver) drives prompts and the bridge forwards them to the Gateway over WebSocket. Requires an onboarded local Gateway service, or explicit remote Gateway URL/token injection.
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
bin: openclaw
|
|
7
|
+
bin_args: [acp]
|
|
8
|
+
install:
|
|
9
|
+
- method: curl
|
|
10
|
+
url: https://openclaw.ai/install.sh
|
|
11
|
+
- method: npm
|
|
12
|
+
package: openclaw
|
|
13
|
+
global: true
|
|
14
|
+
experimental: true
|
|
15
|
+
version_check:
|
|
16
|
+
cmd: openclaw --version
|
|
17
|
+
parse: "(\\d+\\.\\d+\\.\\d+)"
|
|
18
|
+
range: ">=0.1.0"
|
|
19
|
+
timeout_ms: 5000
|
|
20
|
+
setup:
|
|
21
|
+
- id: install-daemon
|
|
22
|
+
kind: cmd
|
|
23
|
+
cmd: "openclaw onboard --install-daemon"
|
|
24
|
+
skip_if:
|
|
25
|
+
cmd: "openclaw gateway probe"
|
|
26
|
+
exit_code: 0
|
|
27
|
+
description: "Installs and starts the OpenClaw background daemon (one-time per host)."
|
|
28
|
+
interactive: true
|
|
29
|
+
timeout_ms: 300000
|
|
30
|
+
- id: ready-check
|
|
31
|
+
kind: cmd
|
|
32
|
+
cmd: "openclaw gateway probe"
|
|
33
|
+
description: "Confirms the OpenClaw Gateway is reachable and write-capable."
|
|
34
|
+
timeout_ms: 30000
|
|
35
|
+
auth:
|
|
36
|
+
ref: ./SECRETS.md
|
|
37
|
+
state:
|
|
38
|
+
env: [OPENCLAW_GATEWAY_URL, OPENCLAW_GATEWAY_TOKEN, OPENCLAW_GATEWAY_PASSWORD]
|
|
39
|
+
sandbox: ./SANDBOX.md
|
|
40
|
+
protocol: acp
|
|
41
|
+
acp: ./openclaw-acp.ACP.md
|
|
42
|
+
session:
|
|
43
|
+
mode: persistent
|
|
44
|
+
idle_timeout_ms: 1800000
|
|
45
|
+
context_carryover: true
|
|
46
|
+
capabilities:
|
|
47
|
+
streaming: true
|
|
48
|
+
tool_calls: true
|
|
49
|
+
sub_agents: true
|
|
50
|
+
file_io: true
|
|
51
|
+
multimodal: true
|
|
52
|
+
resumable: true
|
|
53
|
+
bidirectional: true
|
|
54
|
+
tags: ["openclaw", "acp", "agent-runtime", "coding"]
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
# OpenClaw adapter
|
|
58
|
+
|
|
59
|
+
`@agentproto/adapter-openclaw` drives **OpenClaw** as an AIP-45 agent
|
|
60
|
+
CLI. OpenClaw ships a native ACP bridge (`openclaw acp`) that talks
|
|
61
|
+
ACP over stdio JSON-RPC and forwards prompts to the OpenClaw Gateway
|
|
62
|
+
over WebSocket — so a host like Zed, an editor, or the agentproto
|
|
63
|
+
driver-agent-cli can drive OpenClaw the same way it drives Claude
|
|
64
|
+
Code or Hermes.
|
|
65
|
+
|
|
66
|
+
Unlike pure npx adapters (claude-code, opencode, codex), OpenClaw
|
|
67
|
+
needs a one-time onboarding step on the host machine: the local
|
|
68
|
+
Gateway service has to be installed, started, and authenticated. Remote
|
|
69
|
+
Gateway URL/token injection is still supported through env vars or
|
|
70
|
+
spawn options, but the default local flow relies on OpenClaw's own
|
|
71
|
+
persisted config.
|
|
72
|
+
|
|
73
|
+
## Install
|
|
74
|
+
|
|
75
|
+
The agentproto installer drives both the binary install and the
|
|
76
|
+
post-install onboarding via the manifest's `install[]` and `setup[]`
|
|
77
|
+
blocks:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
agentproto install openclaw
|
|
81
|
+
# ↓ install[]: curl https://openclaw.ai/install.sh | bash (or npm)
|
|
82
|
+
# ↓ setup[]:
|
|
83
|
+
# • install-daemon — `openclaw onboard --install-daemon`
|
|
84
|
+
# (skipped when `openclaw gateway probe` succeeds)
|
|
85
|
+
# • ready-check — `openclaw gateway probe`
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Re-runs are idempotent: setup asks the live Gateway probe first, and a
|
|
89
|
+
successful step is recorded in the host's setup ledger so it doesn't
|
|
90
|
+
re-run next time. Pass `--force` to re-run anyway. To run setup standalone (after a
|
|
91
|
+
`--skip-setup` install or when adding new steps to the adapter):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
agentproto setup openclaw # all pending steps
|
|
95
|
+
agentproto setup openclaw --only ready-check # one specific step
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
To bootstrap without agentproto (manual flow):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
curl -fsSL https://openclaw.ai/install.sh | bash
|
|
102
|
+
# OR
|
|
103
|
+
npm install -g openclaw@latest
|
|
104
|
+
openclaw onboard --install-daemon
|
|
105
|
+
|
|
106
|
+
openclaw gateway probe
|
|
107
|
+
openclaw acp
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For a remote Gateway, pass explicit env vars or flags:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
export OPENCLAW_GATEWAY_URL=wss://gateway-host:18789
|
|
114
|
+
export OPENCLAW_GATEWAY_TOKEN=...
|
|
115
|
+
openclaw acp --url "$OPENCLAW_GATEWAY_URL"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Spawn
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
openclaw acp
|
|
122
|
+
# or with explicit flags:
|
|
123
|
+
openclaw acp --url wss://gateway-host:18789 --token-file ~/.openclaw/gateway.token
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The adapter sets `OPENCLAW_HIDE_BANNER=1` and `OPENCLAW_SUPPRESS_NOTES=1`
|
|
127
|
+
on spawn to keep the stdio channel free of decorative output. The
|
|
128
|
+
runtime itself sets `OPENCLAW_SHELL=acp`.
|
|
129
|
+
|
|
130
|
+
## Auth
|
|
131
|
+
|
|
132
|
+
| Env var | Purpose |
|
|
133
|
+
|---------------------------------|---------------------------------------------------|
|
|
134
|
+
| `OPENCLAW_GATEWAY_URL` | Gateway WebSocket URL (`wss://…`) |
|
|
135
|
+
| `OPENCLAW_GATEWAY_TOKEN` | Bearer token for the gateway session |
|
|
136
|
+
| `OPENCLAW_GATEWAY_PASSWORD` | Alternative password-based auth |
|
|
137
|
+
|
|
138
|
+
If both `OPENCLAW_GATEWAY_TOKEN` and a persisted config exist, the
|
|
139
|
+
env var wins. Underlying provider keys (Anthropic, OpenAI, …) are
|
|
140
|
+
configured *inside* OpenClaw via `openclaw config` — they are not
|
|
141
|
+
read directly by the bridge.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AgentCliHandle, AgentCliRuntime } from '@agentproto/driver-agent-cli';
|
|
2
|
+
export { AgentCliHandle, AgentCliRuntime } from '@agentproto/driver-agent-cli';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @agentproto/adapter-openclaw — AIP-45 adapter for OpenClaw.
|
|
6
|
+
*
|
|
7
|
+
* OpenClaw exposes a native ACP bridge: `openclaw acp` speaks ACP over
|
|
8
|
+
* stdio and forwards prompts to the OpenClaw Gateway over WebSocket.
|
|
9
|
+
* Unlike claude-code / opencode / codex which run in pure-npx mode,
|
|
10
|
+
* OpenClaw needs a one-time onboarding step (`openclaw onboard
|
|
11
|
+
* --install-daemon`) so the local Gateway service and auth config exist.
|
|
12
|
+
* Hosts can inject remote Gateway credentials per spawn, but the default
|
|
13
|
+
* path relies on OpenClaw's persisted local config.
|
|
14
|
+
*
|
|
15
|
+
* import { openclaw, openclawRuntime } from "@agentproto/adapter-openclaw"
|
|
16
|
+
* const session = await openclawRuntime().start({
|
|
17
|
+
* env: {
|
|
18
|
+
* OPENCLAW_GATEWAY_URL: "wss://gateway:18789",
|
|
19
|
+
* OPENCLAW_GATEWAY_TOKEN: "...",
|
|
20
|
+
* },
|
|
21
|
+
* })
|
|
22
|
+
* for await (const evt of session.send({ role: "user", content: "..." })) {
|
|
23
|
+
* console.log(evt)
|
|
24
|
+
* }
|
|
25
|
+
* await session.close()
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
declare const openclaw: AgentCliHandle;
|
|
29
|
+
declare function openclawRuntime(): AgentCliRuntime;
|
|
30
|
+
|
|
31
|
+
export { openclaw, openclawRuntime };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { defineAgentCli, createAgentCliRuntime } from '@agentproto/driver-agent-cli';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @agentproto/adapter-openclaw v0.1.0-alpha
|
|
5
|
+
* AIP-45 adapter for OpenClaw via its built-in `openclaw acp` mode.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var openclaw = defineAgentCli({
|
|
9
|
+
name: "openclaw",
|
|
10
|
+
id: "openclaw",
|
|
11
|
+
description: "OpenClaw \u2014 coding-agent platform with a native plugin surface and built-in ACP bridge. `openclaw acp` exposes a Gateway session as an ACP server over stdio JSON-RPC; an external host drives prompts and the bridge forwards them to the OpenClaw Gateway over WebSocket. Requires an onboarded local Gateway service, or explicit remote Gateway URL/token injection on spawn.",
|
|
12
|
+
version: "0.1.0",
|
|
13
|
+
bin: "openclaw",
|
|
14
|
+
bin_args: ["acp"],
|
|
15
|
+
install: [
|
|
16
|
+
{ method: "curl", url: "https://openclaw.ai/install.sh" },
|
|
17
|
+
{
|
|
18
|
+
method: "npm",
|
|
19
|
+
package: "openclaw",
|
|
20
|
+
global: true,
|
|
21
|
+
experimental: true
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
version_check: {
|
|
25
|
+
cmd: "openclaw --version",
|
|
26
|
+
parse: "(\\d+\\.\\d+\\.\\d+)",
|
|
27
|
+
range: ">=0.1.0",
|
|
28
|
+
timeout_ms: 5e3
|
|
29
|
+
},
|
|
30
|
+
// AIP-29 § Setup — post-install configuration. OpenClaw 2026.x stores
|
|
31
|
+
// Gateway auth under `gateway.auth.*` for the local service; remote
|
|
32
|
+
// Gateway URL/token injection remains available through runtime options.
|
|
33
|
+
// `openclaw acp --probe` no longer exists, so setup uses the Gateway
|
|
34
|
+
// probe as the idempotent readiness check.
|
|
35
|
+
setup: [
|
|
36
|
+
{
|
|
37
|
+
id: "install-daemon",
|
|
38
|
+
kind: "cmd",
|
|
39
|
+
cmd: "openclaw onboard --install-daemon",
|
|
40
|
+
// `gateway status` can exit 0 even when launchd has a plist but the
|
|
41
|
+
// service is not loaded. `gateway probe` fails until the ACP target
|
|
42
|
+
// is actually reachable and write-capable.
|
|
43
|
+
skip_if: { cmd: "openclaw gateway probe", exit_code: 0 },
|
|
44
|
+
description: "Installs and starts the OpenClaw local Gateway service (one-time per host).",
|
|
45
|
+
// Onboard prints a TUI progress; attach a PTY so the user can
|
|
46
|
+
// see the steps and any prompts the daemon installer raises.
|
|
47
|
+
interactive: true,
|
|
48
|
+
timeout_ms: 3e5
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "ready-check",
|
|
52
|
+
kind: "cmd",
|
|
53
|
+
cmd: "openclaw gateway probe",
|
|
54
|
+
description: "Confirms the OpenClaw Gateway is reachable and write-capable.",
|
|
55
|
+
timeout_ms: 3e4
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
auth: {
|
|
59
|
+
ref: "./SECRETS.md",
|
|
60
|
+
state: {
|
|
61
|
+
env: [
|
|
62
|
+
"OPENCLAW_GATEWAY_URL",
|
|
63
|
+
"OPENCLAW_GATEWAY_TOKEN",
|
|
64
|
+
"OPENCLAW_GATEWAY_PASSWORD"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
sandbox: "./SANDBOX.md",
|
|
69
|
+
protocol: "acp",
|
|
70
|
+
acp: "./openclaw-acp.ACP.md",
|
|
71
|
+
session: {
|
|
72
|
+
mode: "persistent",
|
|
73
|
+
idle_timeout_ms: 18e5,
|
|
74
|
+
context_carryover: true
|
|
75
|
+
},
|
|
76
|
+
capabilities: {
|
|
77
|
+
streaming: true,
|
|
78
|
+
tool_calls: true,
|
|
79
|
+
// OpenClaw plugins can register sub-agents (per the tools/plugin
|
|
80
|
+
// docs — `registerProvider`, `registerChannel`, etc.)
|
|
81
|
+
sub_agents: true,
|
|
82
|
+
file_io: true,
|
|
83
|
+
multimodal: true,
|
|
84
|
+
// The bridge advertises sessionCapabilities `list`, `resume`,
|
|
85
|
+
// `close` per the protocol smoke test.
|
|
86
|
+
resumable: true,
|
|
87
|
+
bidirectional: true
|
|
88
|
+
},
|
|
89
|
+
modes: [
|
|
90
|
+
{
|
|
91
|
+
id: "default",
|
|
92
|
+
description: "Standard interactive mode \u2014 bridge forwards prompts to the configured Gateway session."
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
options: [
|
|
96
|
+
{
|
|
97
|
+
id: "gateway_url",
|
|
98
|
+
type: "string",
|
|
99
|
+
description: "Gateway WebSocket URL override. Falls back to OPENCLAW_GATEWAY_URL or OpenClaw's persisted local config.",
|
|
100
|
+
bin_args_template: ["--url", "{value}"]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "token_file",
|
|
104
|
+
type: "string",
|
|
105
|
+
description: "Path to a file holding the Gateway bearer token. Alternative to OPENCLAW_GATEWAY_TOKEN env.",
|
|
106
|
+
bin_args_template: ["--token-file", "{value}"]
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
continuation: {
|
|
110
|
+
default: "pinned-session",
|
|
111
|
+
supported: ["pinned-session", "transcript", "none"],
|
|
112
|
+
pinned_session: {
|
|
113
|
+
idle_timeout_ms: 18e5,
|
|
114
|
+
key_scope: ["conversation", "operator"]
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
tags: ["openclaw", "acp", "agent-runtime", "coding"]
|
|
118
|
+
});
|
|
119
|
+
function openclawRuntime() {
|
|
120
|
+
return createAgentCliRuntime(openclaw);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export { openclaw, openclawRuntime };
|
|
124
|
+
//# sour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;AAAA,IAClD,cAAA,EAAgB;AAAA,MACd,eAAA,EAAiB,IAAA;AAAA,MACjB,SAAA,EAAW,CAAC,cAAA,EAAgB,UAAU;AAAA;AACxC,GACF;AAAA,EACA,IAAA,EAAM,CAAC,UAAA,EAAY,KAAA,EAAO,iBAAiB,QAAQ;AACrD,CAAC;AAEM,SAAS,eAAA,GAAmC;AACjD,EAAA,OAAO,sBAAsB,QAAQ,CAAA;AACvC","file":"index.mjs","sourcesContent":["/**\n * @agentproto/adapter-openclaw — AIP-45 adapter for OpenClaw.\n *\n * OpenClaw exposes a native ACP bridge: `openclaw acp` speaks ACP over\n * stdio and forwards prompts to the OpenClaw Gateway over WebSocket.\n * Unlike claude-code / opencode / codex which run in pure-npx mode,\n * OpenClaw needs a one-time onboarding step (`openclaw onboard\n * --install-daemon`) so the local Gateway service and auth config exist.\n * Hosts can inject remote Gateway credentials per spawn, but the default\n * path relies on OpenClaw's persisted local config.\n *\n * import { openclaw, openclawRuntime } from \"@agentproto/adapter-openclaw\"\n * const session = await openclawRuntime().start({\n * env: {\n * OPENCLAW_GATEWAY_URL: \"wss://gateway:18789\",\n * OPENCLAW_GATEWAY_TOKEN: \"...\",\n * },\n * })\n * for await (const evt of session.send({ role: \"user\", content: \"...\" })) {\n * console.log(evt)\n * }\n * await session.close()\n */\n\nimport {\n createAgentCliRuntime,\n defineAgentCli,\n type AgentCliHandle,\n type AgentCliRuntime,\n} from \"@agentproto/driver-agent-cli\"\n\nexport const openclaw: AgentCliHandle = defineAgentCli({\n name: \"openclaw\",\n id: \"openclaw\",\n description:\n \"OpenClaw — coding-agent platform with a native plugin surface and built-in ACP bridge. `openclaw acp` exposes a Gateway session as an ACP server over stdio JSON-RPC; an external host drives prompts and the bridge forwards them to the OpenClaw Gateway over WebSocket. Requires an onboarded local Gateway service, or explicit remote Gateway URL/token injection on spawn.\",\n version: \"0.1.0\",\n bin: \"openclaw\",\n bin_args: [\"acp\"],\n install: [\n { method: \"curl\", url: \"https://openclaw.ai/install.sh\" },\n {\n method: \"npm\",\n package: \"openclaw\",\n global: true,\n experimental: true,\n },\n ],\n version_check: {\n cmd: \"openclaw --version\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \">=0.1.0\",\n timeout_ms: 5_000,\n },\n // AIP-29 § Setup — post-install configuration. OpenClaw 2026.x stores\n // Gateway auth under `gateway.auth.*` for the local service; remote\n // Gateway URL/token injection remains available through runtime options.\n // `openclaw acp --probe` no longer exists, so setup uses the Gateway\n // probe as the idempotent readiness check.\n setup: [\n {\n id: \"install-daemon\",\n kind: \"cmd\",\n cmd: \"openclaw onboard --install-daemon\",\n // `gateway status` can exit 0 even when launchd has a plist but the\n // service is not loaded. `gateway probe` fails until the ACP target\n // is actually reachable and write-capable.\n skip_if: { cmd: \"openclaw gateway probe\", exit_code: 0 },\n description:\n \"Installs and starts the OpenClaw local Gateway service (one-time per host).\",\n // Onboard prints a TUI progress; attach a PTY so the user can\n // see the steps and any prompts the daemon installer raises.\n interactive: true,\n timeout_ms: 300_000,\n },\n {\n id: \"ready-check\",\n kind: \"cmd\",\n cmd: \"openclaw gateway probe\",\n description:\n \"Confirms the OpenClaw Gateway is reachable and write-capable.\",\n timeout_ms: 30_000,\n },\n ],\n auth: {\n ref: \"./SECRETS.md\",\n state: {\n env: [\n \"OPENCLAW_GATEWAY_URL\",\n \"OPENCLAW_GATEWAY_TOKEN\",\n \"OPENCLAW_GATEWAY_PASSWORD\",\n ],\n },\n },\n sandbox: \"./SANDBOX.md\",\n protocol: \"acp\",\n acp: \"./openclaw-acp.ACP.md\",\n session: {\n mode: \"persistent\",\n idle_timeout_ms: 1_800_000,\n context_carryover: true,\n },\n capabilities: {\n streaming: true,\n tool_calls: true,\n // OpenClaw plugins can register sub-agents (per the tools/plugin\n // docs — `registerProvider`, `registerChannel`, etc.)\n sub_agents: true,\n file_io: true,\n multimodal: true,\n // The bridge advertises sessionCapabilities `list`, `resume`,\n // `close` per the protocol smoke test.\n resumable: true,\n bidirectional: true,\n },\n modes: [\n {\n id: \"default\",\n description:\n \"Standard interactive mode — bridge forwards prompts to the configured Gateway session.\",\n },\n ],\n options: [\n {\n id: \"gateway_url\",\n type: \"string\",\n description:\n \"Gateway WebSocket URL override. Falls back to OPENCLAW_GATEWAY_URL or OpenClaw's persisted local config.\",\n bin_args_template: [\"--url\", \"{value}\"],\n },\n {\n id: \"token_file\",\n type: \"string\",\n description:\n \"Path to a file holding the Gateway bearer token. Alternative to OPENCLAW_GATEWAY_TOKEN env.\",\n bin_args_template: [\"--token-file\", \"{value}\"],\n },\n ],\n continuation: {\n default: \"pinned-session\",\n supported: [\"pinned-session\", \"transcript\", \"none\"],\n pinned_session: {\n idle_timeout_ms: 1_800_000,\n key_scope: [\"conversation\", \"operator\"],\n },\n },\n tags: [\"openclaw\", \"acp\", \"agent-runtime\", \"coding\"],\n})\n\nexport function openclawRuntime(): AgentCliRuntime {\n return createAgentCliRuntime(openclaw)\n}\n\nexport type { AgentCliHandle, AgentCliRuntime }\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentproto/adapter-openclaw",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "@agentproto/adapter-openclaw — AIP-45 AGENT-CLI adapter for OpenClaw. Spawns `openclaw acp` and bridges OpenClaw's Gateway session over stdio JSON-RPC.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agentproto",
|
|
7
|
+
"aip-45",
|
|
8
|
+
"openclaw",
|
|
9
|
+
"acp",
|
|
10
|
+
"agent-cli",
|
|
11
|
+
"adapter"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://agentproto.sh/docs/aip-45",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/agentproto/ts",
|
|
17
|
+
"directory": "adapters/openclaw"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "dist/index.mjs",
|
|
22
|
+
"module": "dist/index.mjs",
|
|
23
|
+
"types": "dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.mjs",
|
|
28
|
+
"default": "./dist/index.mjs"
|
|
29
|
+
},
|
|
30
|
+
"./OPENCLAW.md": "./OPENCLAW.md",
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"OPENCLAW.md",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@agentproto/driver-agent-cli": "0.1.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^25.6.2",
|
|
47
|
+
"tsup": "^8.5.1",
|
|
48
|
+
"typescript": "^5.9.3",
|
|
49
|
+
"vitest": "^3.2.4",
|
|
50
|
+
"@agentproto/tooling": "0.1.0-alpha.0"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"dev": "tsup --watch",
|
|
54
|
+
"build": "tsup",
|
|
55
|
+
"clean": "rm -rf dist",
|
|
56
|
+
"check-types": "tsc --noEmit",
|
|
57
|
+
"test": "vitest run --passWithNoTests",
|
|
58
|
+
"test:watch": "vitest"
|
|
59
|
+
}
|
|
60
|
+
}
|