arkitek-relay-skill 1.0.7 → 1.0.9
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 +128 -49
- package/SKILL.md +139 -0
- package/dist/cli/doctor.d.ts +3 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +165 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/init-skill.d.ts +3 -0
- package/dist/cli/init-skill.d.ts.map +1 -0
- package/dist/cli/init-skill.js +53 -0
- package/dist/cli/init-skill.js.map +1 -0
- package/dist/cli/install.d.ts +3 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +302 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/logs.d.ts +2 -0
- package/dist/cli/logs.d.ts.map +1 -0
- package/dist/cli/logs.js +63 -0
- package/dist/cli/logs.js.map +1 -0
- package/dist/cli/parse.d.ts +4 -0
- package/dist/cli/parse.d.ts.map +1 -0
- package/dist/cli/parse.js +98 -0
- package/dist/cli/parse.js.map +1 -0
- package/dist/cli/status.d.ts +2 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +43 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/ui.d.ts +10 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +62 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/cli/uninstall.d.ts +3 -0
- package/dist/cli/uninstall.d.ts.map +1 -0
- package/dist/cli/uninstall.js +60 -0
- package/dist/cli/uninstall.js.map +1 -0
- package/dist/config/openclaw.d.ts +67 -0
- package/dist/config/openclaw.d.ts.map +1 -0
- package/dist/config/openclaw.js +215 -0
- package/dist/config/openclaw.js.map +1 -0
- package/dist/config/resolver.d.ts +12 -0
- package/dist/config/resolver.d.ts.map +1 -0
- package/dist/config/resolver.js +243 -0
- package/dist/config/resolver.js.map +1 -0
- package/dist/council.d.ts.map +1 -1
- package/dist/council.js +7 -1
- package/dist/council.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +134 -140
- package/dist/index.js.map +1 -1
- package/dist/relay.d.ts +2 -0
- package/dist/relay.d.ts.map +1 -1
- package/dist/relay.js +59 -15
- package/dist/relay.js.map +1 -1
- package/dist/service/darwin.d.ts +5 -0
- package/dist/service/darwin.d.ts.map +1 -0
- package/dist/service/darwin.js +93 -0
- package/dist/service/darwin.js.map +1 -0
- package/dist/service/index.d.ts +12 -0
- package/dist/service/index.d.ts.map +1 -0
- package/dist/service/index.js +83 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/linux.d.ts +5 -0
- package/dist/service/linux.d.ts.map +1 -0
- package/dist/service/linux.js +88 -0
- package/dist/service/linux.js.map +1 -0
- package/dist/service/win32.d.ts +5 -0
- package/dist/service/win32.d.ts.map +1 -0
- package/dist/service/win32.js +91 -0
- package/dist/service/win32.js.map +1 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +3 -1
- package/dist/validation.js.map +1 -1
- package/package.json +5 -3
- package/scripts/postinstall.js +5 -1
package/README.md
CHANGED
|
@@ -25,54 +25,124 @@ The agent initiates all connections. Nothing is exposed on your network.
|
|
|
25
25
|
## Quick Start
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npm install arkitek-relay-skill
|
|
28
|
+
npm install -g arkitek-relay-skill
|
|
29
29
|
npx arkitek-relay-skill
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
On first run, the relay will:
|
|
33
|
+
|
|
34
|
+
1. Auto-detect your OpenClaw installation (`~/.openclaw/openclaw.json`)
|
|
35
|
+
2. Find your gateway URL, port, and auth token automatically
|
|
36
|
+
3. Place the skill definition (`SKILL.md`) into OpenClaw's skills directory
|
|
37
|
+
4. Prompt for your ArkiTek API key (saved for future runs)
|
|
38
|
+
5. Test the gateway connection and check that `/v1/responses` is enabled
|
|
39
|
+
6. Offer to enable it if it's disabled
|
|
40
|
+
7. Save configuration to `~/.arkitek-relay/config.json`
|
|
41
|
+
8. Offer to install as a system service (auto-start on boot)
|
|
42
|
+
9. Connect your agent to ArkiTek
|
|
33
43
|
|
|
34
44
|
> **First time?** Get your API key at [arkitekai.com](https://arkitekai.com) — go to **Agents** → **Add Agent** → **Create** and copy the `ak_...` key.
|
|
35
45
|
|
|
36
|
-
|
|
46
|
+
On subsequent runs, the saved config is loaded automatically and the agent reconnects.
|
|
37
47
|
|
|
38
|
-
|
|
39
|
-
2. The key is validated and saved to a local `.env` file (so you never have to enter it again)
|
|
40
|
-
3. The skill detects your OpenClaw gateway (on `localhost:18789` by default)
|
|
41
|
-
4. The skill connects to ArkiTek over HTTPS
|
|
42
|
-
5. Messages from the ArkiTek UI are forwarded to your OpenClaw agent and responses are sent back automatically
|
|
48
|
+
## Commands
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
| Command | Description |
|
|
51
|
+
|---------|-------------|
|
|
52
|
+
| `npx arkitek-relay-skill` | Start the relay (guided setup on first run) |
|
|
53
|
+
| `npx arkitek-relay-skill --install` | Re-run guided setup |
|
|
54
|
+
| `npx arkitek-relay-skill --init-skill` | Place SKILL.md into OpenClaw's skills directory |
|
|
55
|
+
| `npx arkitek-relay-skill --doctor` | Run diagnostic checks on your setup |
|
|
56
|
+
| `npx arkitek-relay-skill --status` | Show saved configuration |
|
|
57
|
+
| `npx arkitek-relay-skill --logs` | View relay log output |
|
|
58
|
+
| `npx arkitek-relay-skill --uninstall` | Remove service and saved config |
|
|
59
|
+
| `npx arkitek-relay-skill --help` | Show all options |
|
|
45
60
|
|
|
46
|
-
|
|
61
|
+
### CLI Options
|
|
47
62
|
|
|
48
|
-
|
|
63
|
+
| Option | Description |
|
|
64
|
+
|--------|-------------|
|
|
65
|
+
| `--api-key <key>` | ArkiTek API key (overrides saved config) |
|
|
66
|
+
| `--gateway-url <url>` | OpenClaw gateway URL (overrides auto-detection) |
|
|
67
|
+
| `--gateway-token <token>` | OpenClaw gateway auth token |
|
|
68
|
+
| `--agent-id <id>` | OpenClaw agent ID (default: `"main"`) |
|
|
69
|
+
| `--skills-dir <path>` | Custom OpenClaw skills directory for SKILL.md placement |
|
|
70
|
+
| `--yes, -y` | Skip confirmation prompts |
|
|
71
|
+
| `--verbose, -v` | Show detailed output |
|
|
49
72
|
|
|
50
|
-
|
|
51
|
-
2. Delete or edit the `ARKITEK_API_KEY` line in your `.env` file
|
|
52
|
-
3. Run `npx arkitek-relay-skill` again — it will prompt for the new key
|
|
73
|
+
## Skill Definition (SKILL.md)
|
|
53
74
|
|
|
54
|
-
|
|
75
|
+
During setup, the relay places its skill definition file into OpenClaw's skills directory so your agent can automatically discover it:
|
|
55
76
|
|
|
56
|
-
|
|
77
|
+
- **Default location**: `~/.openclaw/skills/arkitek-relay/SKILL.md`
|
|
78
|
+
- **Custom directory**: use `--skills-dir <path>` to override
|
|
79
|
+
- **Standalone command**: `npx arkitek-relay-skill --init-skill`
|
|
57
80
|
|
|
58
|
-
|
|
59
|
-
|
|
81
|
+
If OpenClaw has custom skill directories configured via `skills.load.extraDirs` in `openclaw.json`, the relay checks those locations too. You can verify with `openclaw skills list`.
|
|
82
|
+
|
|
83
|
+
## Config Resolution
|
|
84
|
+
|
|
85
|
+
The relay resolves configuration from multiple sources (highest priority first):
|
|
60
86
|
|
|
61
|
-
|
|
87
|
+
1. **CLI flags** (`--api-key`, `--gateway-url`, `--gateway-token`)
|
|
88
|
+
2. **Environment variables** (`ARKITEK_API_KEY`, `OPENCLAW_GATEWAY_URL`, etc.)
|
|
89
|
+
3. **Saved config** (`~/.arkitek-relay/config.json`, created by `--install`)
|
|
90
|
+
4. **Auto-detected from OpenClaw** (`~/.openclaw/openclaw.json`)
|
|
91
|
+
5. **Defaults**
|
|
62
92
|
|
|
63
|
-
|
|
93
|
+
The gateway token is **never saved to disk** — it's always read live from the CLI, environment, or OpenClaw's own config file so key rotations are picked up automatically.
|
|
64
94
|
|
|
65
|
-
|
|
95
|
+
### Environment Variables
|
|
66
96
|
|
|
67
97
|
| Variable | Required | Default | Description |
|
|
68
98
|
|----------|----------|---------|-------------|
|
|
69
99
|
| `ARKITEK_API_KEY` | Yes | — | Your agent's private API key from ArkiTek |
|
|
70
|
-
| `ARKITEK_RELAY_URL` | No | `https://api.arkitekai.com/api/v1/agents/relay` | Relay server URL
|
|
100
|
+
| `ARKITEK_RELAY_URL` | No | `https://api.arkitekai.com/api/v1/agents/relay` | Relay server URL |
|
|
71
101
|
| `ARKITEK_AUTO_RECONNECT` | No | `true` | Auto-reconnect on network errors |
|
|
72
|
-
| `OPENCLAW_GATEWAY_URL` | No |
|
|
73
|
-
| `OPENCLAW_GATEWAY_TOKEN` | No |
|
|
102
|
+
| `OPENCLAW_GATEWAY_URL` | No | Auto-detected | OpenClaw gateway URL |
|
|
103
|
+
| `OPENCLAW_GATEWAY_TOKEN` | No | Auto-detected | Bearer token for OpenClaw gateway auth |
|
|
104
|
+
| `OPENCLAW_AGENT_ID` | No | `main` | OpenClaw agent ID |
|
|
105
|
+
|
|
106
|
+
> **Security**: Your API key is a secret. Never commit it to version control or share it publicly.
|
|
107
|
+
|
|
108
|
+
## Changing or Rotating Your API Key
|
|
109
|
+
|
|
110
|
+
1. Run `npx arkitek-relay-skill --install` — it will detect the existing key and let you replace it
|
|
111
|
+
2. Or set the `ARKITEK_API_KEY` environment variable directly
|
|
112
|
+
3. Or use `--api-key <new_key>` on the command line
|
|
113
|
+
|
|
114
|
+
## System Service (Auto-Start)
|
|
115
|
+
|
|
116
|
+
During setup, the relay offers to install as a system service that starts automatically on boot and restarts on crashes. No terminal needed.
|
|
117
|
+
|
|
118
|
+
| Platform | Service type | Location |
|
|
119
|
+
|----------|-------------|----------|
|
|
120
|
+
| macOS | LaunchAgent | `~/Library/LaunchAgents/com.arkitekai.relay.plist` |
|
|
121
|
+
| Linux | systemd user unit | `~/.config/systemd/user/arkitek-relay.service` |
|
|
122
|
+
| Windows | Scheduled task | `ArkiTekRelay` (runs at logon) |
|
|
123
|
+
|
|
124
|
+
The service is **user-scoped** — no root, sudo, or admin privileges are required. It runs as your user account with the same permissions as running the relay manually in a terminal.
|
|
125
|
+
|
|
126
|
+
To check the service:
|
|
127
|
+
```bash
|
|
128
|
+
npx arkitek-relay-skill --status # shows if installed and running
|
|
129
|
+
npx arkitek-relay-skill --logs # view service log output
|
|
130
|
+
npx arkitek-relay-skill --doctor # full diagnostic including service
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
To remove the service:
|
|
134
|
+
```bash
|
|
135
|
+
npx arkitek-relay-skill --uninstall
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
> **Note**: For the service to persist across reboots, install the package globally: `npm install -g arkitek-relay-skill`. If you run via `npx` without a global install, the cached package may be cleaned up.
|
|
139
|
+
|
|
140
|
+
## Disconnecting Your Agent
|
|
74
141
|
|
|
75
|
-
|
|
142
|
+
1. Stop the agent process — if running as a service, use `npx arkitek-relay-skill --uninstall`; if running manually, press Ctrl+C
|
|
143
|
+
2. Optionally delete the agent in ArkiTek's dashboard (**Agents** → select your agent → **Delete**)
|
|
144
|
+
3. To remove all local config and service: `npx arkitek-relay-skill --uninstall`
|
|
145
|
+
4. To fully remove the package: `npm uninstall -g arkitek-relay-skill`
|
|
76
146
|
|
|
77
147
|
## Advanced: Using as a Library
|
|
78
148
|
|
|
@@ -100,6 +170,17 @@ const relay = createArkitekRelay(
|
|
|
100
170
|
await relay.connect();
|
|
101
171
|
```
|
|
102
172
|
|
|
173
|
+
You can also use the config resolver programmatically:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
import { resolveConfig, detectOpenClaw } from "arkitek-relay-skill";
|
|
177
|
+
|
|
178
|
+
// Auto-detect OpenClaw and resolve all config sources
|
|
179
|
+
const config = resolveConfig({ command: "start" });
|
|
180
|
+
// config.gatewayUrl, config.gatewayToken, etc. are resolved from
|
|
181
|
+
// CLI → env → saved config → OpenClaw → defaults
|
|
182
|
+
```
|
|
183
|
+
|
|
103
184
|
## Council of LLMs (Optional)
|
|
104
185
|
|
|
105
186
|
ArkiTek's Council feature lets you query multiple LLMs simultaneously and get aggregated responses. This requires an active ArkiTek subscription.
|
|
@@ -149,20 +230,38 @@ This skill is designed with security as a top priority:
|
|
|
149
230
|
- **No tunnels** — no ngrok, no Cloudflare tunnels, no port forwarding
|
|
150
231
|
- **Auth on every request** — both SSE and POST endpoints require the Bearer token
|
|
151
232
|
- **Message integrity** — responses must include the matching `messageId` or they are rejected
|
|
233
|
+
- **Secure config reading** — OpenClaw config is read with file ownership and permission checks
|
|
234
|
+
- **Token hygiene** — gateway tokens are never persisted to disk; always read live from source
|
|
235
|
+
- **User-scoped service** — system service runs as your user, no root/admin required
|
|
152
236
|
|
|
153
237
|
## Troubleshooting
|
|
154
238
|
|
|
239
|
+
### Run the doctor
|
|
240
|
+
|
|
241
|
+
The fastest way to diagnose any issue:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
npx arkitek-relay-skill --doctor
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
This checks Node.js version, saved config, API key, OpenClaw detection, gateway reachability, `/v1/responses` endpoint status, ArkiTek cloud connectivity, system service status, and SKILL.md placement.
|
|
248
|
+
|
|
249
|
+
### "Mode: Echo" — relay not forwarding to OpenClaw
|
|
250
|
+
|
|
251
|
+
- Run `--doctor` to see what's wrong
|
|
252
|
+
- Ensure OpenClaw is running: `openclaw gateway start`
|
|
253
|
+
- Verify `/v1/responses` is enabled: `openclaw gateway config.patch --set gateway.http.endpoints.responses.enabled=true`
|
|
254
|
+
- Restart the relay
|
|
255
|
+
|
|
155
256
|
### "API key invalid or revoked"
|
|
156
257
|
|
|
157
|
-
-
|
|
258
|
+
- Run `npx arkitek-relay-skill --install` to enter a new key
|
|
158
259
|
- Verify the key in ArkiTek's dashboard — it may have been revoked
|
|
159
260
|
- Keys start with `ak_` and are exactly 67 characters
|
|
160
|
-
- If you rotated your key, the old key has a 1-hour grace period
|
|
161
261
|
|
|
162
262
|
### "NODE_TLS_REJECT_UNAUTHORIZED=0 detected"
|
|
163
263
|
|
|
164
264
|
- Remove `NODE_TLS_REJECT_UNAUTHORIZED=0` from your environment
|
|
165
|
-
- This setting disables TLS certificate verification, which would allow man-in-the-middle attacks
|
|
166
265
|
- If you're behind a corporate proxy, configure `NODE_EXTRA_CA_CERTS` instead
|
|
167
266
|
|
|
168
267
|
### Connection keeps dropping
|
|
@@ -170,34 +269,14 @@ This skill is designed with security as a top priority:
|
|
|
170
269
|
- Check your network connection and firewall rules
|
|
171
270
|
- Ensure outbound HTTPS (port 443) to `arkitekai.com` is allowed
|
|
172
271
|
- The skill auto-reconnects with exponential backoff (1s → 30s max)
|
|
173
|
-
- Messages are queued server-side for up to 5 minutes during disconnections
|
|
174
|
-
|
|
175
|
-
### "Response not delivered"
|
|
176
|
-
|
|
177
|
-
- Ensure you're returning from your handler within 1 hour (server timeout)
|
|
178
|
-
- The `messageId` in your response must exactly match the incoming message
|
|
179
|
-
- Response content must be under 500KB
|
|
180
|
-
|
|
181
|
-
### No messages arriving
|
|
182
|
-
|
|
183
|
-
- Confirm your agent shows as "Connected" in the ArkiTek dashboard
|
|
184
|
-
- Try sending a test message from the ArkiTek web UI
|
|
185
|
-
- Check that your handler isn't throwing errors (they're caught and logged)
|
|
186
272
|
|
|
187
273
|
## Development
|
|
188
274
|
|
|
189
275
|
```bash
|
|
190
|
-
# Install dependencies
|
|
191
276
|
npm install
|
|
192
|
-
|
|
193
|
-
# Build
|
|
194
277
|
npm run build
|
|
195
|
-
|
|
196
|
-
# Run tests
|
|
197
278
|
npm test
|
|
198
|
-
|
|
199
|
-
# Watch mode (rebuilds on changes)
|
|
200
|
-
npm run dev
|
|
279
|
+
npm run dev # watch mode
|
|
201
280
|
```
|
|
202
281
|
|
|
203
282
|
## License
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arkitek-relay
|
|
3
|
+
description: Connect this agent to ArkiTek for secure remote chat via SSE. No tunnels, no open ports.
|
|
4
|
+
metadata: {"openclaw": {"requires": {"env": ["ARKITEK_API_KEY"], "bins": ["node", "npx"]}, "primaryEnv": "ARKITEK_API_KEY", "emoji": "\uD83D\uDCE1", "homepage": "https://arkitekai.com", "install": [{"id": "npm", "kind": "node", "package": "arkitek-relay-skill", "bins": ["arkitek-relay-skill"], "label": "Install ArkiTek Relay (npm)"}]}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ArkiTek Relay Skill
|
|
8
|
+
|
|
9
|
+
This skill connects your OpenClaw agent to [ArkiTek](https://arkitekai.com) — a web UI for chatting with AI agents remotely. It opens a secure, outbound-only SSE connection from your agent to ArkiTek's cloud relay, and forwards incoming messages directly to your OpenClaw gateway. No tunnels, public URLs, or open ports required.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
1. Install the relay:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
npm install -g arkitek-relay-skill
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. Get your API key from [arkitekai.com](https://arkitekai.com) (Agents → Add Agent → Create)
|
|
20
|
+
|
|
21
|
+
3. Run the relay:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
npx arkitek-relay-skill
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
On first run, the relay will:
|
|
28
|
+
- Auto-detect your OpenClaw installation and gateway config
|
|
29
|
+
- Place the skill definition (`SKILL.md`) into OpenClaw's skills directory
|
|
30
|
+
- Prompt for your ArkiTek API key
|
|
31
|
+
- Test the gateway connection
|
|
32
|
+
- Check that `/v1/responses` is enabled (and offer to enable it if not)
|
|
33
|
+
- Save configuration to `~/.arkitek-relay/config.json`
|
|
34
|
+
- Offer to install as a system service (auto-start on boot)
|
|
35
|
+
- Connect to ArkiTek
|
|
36
|
+
|
|
37
|
+
Subsequent runs load the saved config automatically.
|
|
38
|
+
|
|
39
|
+
## Commands
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
npx arkitek-relay-skill Start the relay (guided setup on first run)
|
|
43
|
+
npx arkitek-relay-skill --install Re-run guided setup
|
|
44
|
+
npx arkitek-relay-skill --init-skill Place SKILL.md into OpenClaw's skills directory
|
|
45
|
+
npx arkitek-relay-skill --doctor Run diagnostic checks
|
|
46
|
+
npx arkitek-relay-skill --status Show saved configuration
|
|
47
|
+
npx arkitek-relay-skill --logs View relay log output
|
|
48
|
+
npx arkitek-relay-skill --uninstall Remove service and saved config
|
|
49
|
+
npx arkitek-relay-skill --help Show all options
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Manual Setup (Advanced)
|
|
53
|
+
|
|
54
|
+
If you prefer manual configuration, set these environment variables or pass them as CLI flags:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
ARKITEK_API_KEY=ak_your_key_here
|
|
58
|
+
OPENCLAW_GATEWAY_URL=http://localhost:18789
|
|
59
|
+
OPENCLAW_GATEWAY_TOKEN=your_token_here
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Make sure the `/v1/responses` endpoint is enabled in OpenClaw:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
openclaw gateway config.patch --set gateway.http.endpoints.responses.enabled=true
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then start the relay:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
npx arkitek-relay-skill
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## How it works
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
ArkiTek Web UI ←→ ArkiTek Cloud ←——SSE—— This Skill ——POST→ OpenClaw Gateway
|
|
78
|
+
(user) (relay) (bridge) (your agent)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
All connections are outbound from the agent. Nothing is exposed on the agent's network.
|
|
82
|
+
|
|
83
|
+
## Skill Definition Placement
|
|
84
|
+
|
|
85
|
+
During setup, the relay automatically places its `SKILL.md` into OpenClaw's skills directory so your agent can discover it:
|
|
86
|
+
|
|
87
|
+
- Default location: `~/.openclaw/skills/arkitek-relay/SKILL.md`
|
|
88
|
+
- Custom directory: `--skills-dir <path>` overrides the default
|
|
89
|
+
- The `--init-skill` command can re-run this step independently
|
|
90
|
+
|
|
91
|
+
OpenClaw will discover the skill on next load. Verify with `openclaw skills list`.
|
|
92
|
+
|
|
93
|
+
## Config Resolution
|
|
94
|
+
|
|
95
|
+
The relay resolves configuration from multiple sources (highest priority first):
|
|
96
|
+
|
|
97
|
+
1. CLI flags (`--api-key`, `--gateway-url`, `--gateway-token`)
|
|
98
|
+
2. Environment variables (`ARKITEK_API_KEY`, `OPENCLAW_GATEWAY_URL`, etc.)
|
|
99
|
+
3. Saved config (`~/.arkitek-relay/config.json`)
|
|
100
|
+
4. Auto-detected from OpenClaw (`~/.openclaw/openclaw.json`)
|
|
101
|
+
5. Defaults
|
|
102
|
+
|
|
103
|
+
The gateway token is never saved to disk — it's always read live from CLI, environment, or OpenClaw's config so key rotations are picked up automatically.
|
|
104
|
+
|
|
105
|
+
## System Service
|
|
106
|
+
|
|
107
|
+
During setup, the relay offers to install as a system service that starts automatically on boot:
|
|
108
|
+
|
|
109
|
+
- **macOS**: LaunchAgent (`~/Library/LaunchAgents/com.arkitekai.relay.plist`)
|
|
110
|
+
- **Linux**: systemd user unit (`~/.config/systemd/user/arkitek-relay.service`)
|
|
111
|
+
- **Windows**: Scheduled task (runs at logon)
|
|
112
|
+
|
|
113
|
+
The service is user-scoped (no root/admin required), keeps the relay running in the background, and auto-restarts on crashes. Remove it anytime with `--uninstall`.
|
|
114
|
+
|
|
115
|
+
## Security
|
|
116
|
+
|
|
117
|
+
- Outbound-only HTTPS connections — no open ports or public URLs
|
|
118
|
+
- TLS enforced — refuses to run if TLS verification is disabled
|
|
119
|
+
- API key validated before any network request
|
|
120
|
+
- API keys are never logged (masked as `ak_****...last4`)
|
|
121
|
+
- OpenClaw config is read with ownership and permission checks
|
|
122
|
+
- Gateway token is never persisted — always read live
|
|
123
|
+
- System service is user-scoped — no elevated privileges required
|
|
124
|
+
|
|
125
|
+
## Troubleshooting
|
|
126
|
+
|
|
127
|
+
**Relay shows "Echo mode":**
|
|
128
|
+
- Run `npx arkitek-relay-skill --doctor` to diagnose
|
|
129
|
+
- Check that OpenClaw gateway is running
|
|
130
|
+
- Verify `/v1/responses` endpoint is enabled in OpenClaw config
|
|
131
|
+
|
|
132
|
+
**Agent offline in ArkiTek:**
|
|
133
|
+
- Check relay status: `npx arkitek-relay-skill --doctor`
|
|
134
|
+
- Verify internet connectivity to arkitekai.com
|
|
135
|
+
- Restart: `npx arkitek-relay-skill`
|
|
136
|
+
|
|
137
|
+
**"API key invalid or revoked":**
|
|
138
|
+
- Run `npx arkitek-relay-skill --install` to reconfigure
|
|
139
|
+
- Verify the key in ArkiTek's dashboard
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAmB9C,wBAAsB,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAiL9D"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { DEFAULT_GATEWAY_URL } from "../types.js";
|
|
2
|
+
import { readPersistedConfig, getConfigPath, getLogPath, getErrorLogPath, } from "../config/resolver.js";
|
|
3
|
+
import { existsSync, statSync } from "node:fs";
|
|
4
|
+
import { detectOpenClaw, testGatewayReachable, testResponsesEndpoint, findInstalledSkill, } from "../config/openclaw.js";
|
|
5
|
+
import { getServiceStatus } from "../service/index.js";
|
|
6
|
+
import { maskKey } from "../validation.js";
|
|
7
|
+
import * as ui from "./ui.js";
|
|
8
|
+
export async function runDoctor(cli) {
|
|
9
|
+
ui.heading("ArkiTek Relay \u2014 Diagnostics");
|
|
10
|
+
let issues = 0;
|
|
11
|
+
// 1. Node.js
|
|
12
|
+
const nodeVersion = process.versions.node;
|
|
13
|
+
const major = parseInt(nodeVersion.split(".")[0], 10);
|
|
14
|
+
if (major >= 20) {
|
|
15
|
+
ui.success(`Node.js ${nodeVersion}`);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
ui.error(`Node.js ${nodeVersion} \u2014 version 20.3+ required`);
|
|
19
|
+
issues++;
|
|
20
|
+
}
|
|
21
|
+
// 2. Persisted config
|
|
22
|
+
const persisted = readPersistedConfig();
|
|
23
|
+
if (persisted) {
|
|
24
|
+
ui.success(`Config found at ${getConfigPath()}`);
|
|
25
|
+
ui.dimmed(` Installed: ${persisted.installedAt}`);
|
|
26
|
+
ui.dimmed(` Updated: ${persisted.lastUpdated}`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
ui.warn("No saved config found. Run --install to set up.");
|
|
30
|
+
issues++;
|
|
31
|
+
}
|
|
32
|
+
// 3. API key
|
|
33
|
+
const apiKey = cli.apiKey || process.env.ARKITEK_API_KEY || persisted?.arkitekApiKey;
|
|
34
|
+
if (apiKey) {
|
|
35
|
+
ui.success(`ArkiTek API key: ${maskKey(apiKey)}`);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
ui.error("No ArkiTek API key found");
|
|
39
|
+
ui.dimmed(" Set ARKITEK_API_KEY, use --api-key, or run --install");
|
|
40
|
+
issues++;
|
|
41
|
+
}
|
|
42
|
+
// 4. OpenClaw config
|
|
43
|
+
const openclaw = detectOpenClaw();
|
|
44
|
+
if (openclaw) {
|
|
45
|
+
ui.success(`OpenClaw config: ${openclaw.configPath}`);
|
|
46
|
+
ui.dimmed(` Gateway URL: ${openclaw.gatewayUrl}`);
|
|
47
|
+
ui.dimmed(` Gateway token: ${openclaw.gatewayToken ? "present" : "not set"}`);
|
|
48
|
+
ui.dimmed(` /v1/responses: ${openclaw.responsesEnabled ? "enabled" : "disabled"}`);
|
|
49
|
+
if (!openclaw.responsesEnabled) {
|
|
50
|
+
ui.warn("/v1/responses endpoint is disabled in OpenClaw config");
|
|
51
|
+
ui.dimmed(" Fix: openclaw gateway config.patch --set gateway.http.endpoints.responses.enabled=true");
|
|
52
|
+
issues++;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
ui.warn("OpenClaw config not found at ~/.openclaw/openclaw.json");
|
|
57
|
+
issues++;
|
|
58
|
+
}
|
|
59
|
+
// 5. Gateway reachability
|
|
60
|
+
const gatewayUrl = cli.gatewayUrl ||
|
|
61
|
+
process.env.OPENCLAW_GATEWAY_URL ||
|
|
62
|
+
openclaw?.gatewayUrl ||
|
|
63
|
+
DEFAULT_GATEWAY_URL;
|
|
64
|
+
const gatewayReachable = await testGatewayReachable(gatewayUrl);
|
|
65
|
+
if (gatewayReachable) {
|
|
66
|
+
ui.success(`Gateway reachable at ${gatewayUrl}`);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
ui.error(`Gateway not reachable at ${gatewayUrl}`);
|
|
70
|
+
ui.dimmed(" Is OpenClaw running? Try: openclaw gateway start");
|
|
71
|
+
issues++;
|
|
72
|
+
}
|
|
73
|
+
// 6. /v1/responses live check
|
|
74
|
+
if (gatewayReachable) {
|
|
75
|
+
const gatewayToken = cli.gatewayToken ||
|
|
76
|
+
process.env.OPENCLAW_GATEWAY_TOKEN ||
|
|
77
|
+
openclaw?.gatewayToken;
|
|
78
|
+
const endpointStatus = await testResponsesEndpoint(gatewayUrl, gatewayToken);
|
|
79
|
+
if (endpointStatus === "enabled") {
|
|
80
|
+
ui.success("/v1/responses endpoint is responding");
|
|
81
|
+
}
|
|
82
|
+
else if (endpointStatus === "disabled") {
|
|
83
|
+
ui.error("/v1/responses endpoint returned 405 (disabled)");
|
|
84
|
+
ui.dimmed(" Fix: openclaw gateway config.patch --set gateway.http.endpoints.responses.enabled=true");
|
|
85
|
+
issues++;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
ui.warn("/v1/responses endpoint status unknown");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// 7. ArkiTek cloud
|
|
92
|
+
let arkitekReachable = false;
|
|
93
|
+
try {
|
|
94
|
+
await fetch("https://arkitekai.com", {
|
|
95
|
+
method: "HEAD",
|
|
96
|
+
signal: AbortSignal.timeout(5_000),
|
|
97
|
+
});
|
|
98
|
+
arkitekReachable = true;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// not reachable
|
|
102
|
+
}
|
|
103
|
+
if (arkitekReachable) {
|
|
104
|
+
ui.success("ArkiTek cloud reachable (arkitekai.com)");
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
ui.error("Cannot reach arkitekai.com");
|
|
108
|
+
ui.dimmed(" Check internet connection and firewall (outbound HTTPS port 443)");
|
|
109
|
+
issues++;
|
|
110
|
+
}
|
|
111
|
+
// 8. System service
|
|
112
|
+
const service = await getServiceStatus();
|
|
113
|
+
if (service.installed) {
|
|
114
|
+
if (service.running) {
|
|
115
|
+
ui.success(`System service: running (${service.platform})`);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
ui.warn(`System service: installed but not running (${service.platform})`);
|
|
119
|
+
issues++;
|
|
120
|
+
}
|
|
121
|
+
if (service.servicePath) {
|
|
122
|
+
ui.dimmed(` ${service.servicePath}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
ui.dimmed("System service: not installed (optional)");
|
|
127
|
+
ui.dimmed(" Install with: npx arkitek-relay-skill --install");
|
|
128
|
+
}
|
|
129
|
+
// 9. SKILL.md placement
|
|
130
|
+
const skillPath = findInstalledSkill();
|
|
131
|
+
if (skillPath) {
|
|
132
|
+
ui.success(`Skill definition installed: ${skillPath}`);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
ui.warn("SKILL.md not found in OpenClaw skills directory");
|
|
136
|
+
ui.dimmed(" Fix: npx arkitek-relay-skill --init-skill");
|
|
137
|
+
issues++;
|
|
138
|
+
}
|
|
139
|
+
// 10. Log file sizes
|
|
140
|
+
const LOG_WARN_BYTES = 100 * 1024 * 1024; // 100MB
|
|
141
|
+
for (const [label, logFile] of [
|
|
142
|
+
["Output log", getLogPath()],
|
|
143
|
+
["Error log", getErrorLogPath()],
|
|
144
|
+
]) {
|
|
145
|
+
if (existsSync(logFile)) {
|
|
146
|
+
const size = statSync(logFile).size;
|
|
147
|
+
if (size > LOG_WARN_BYTES) {
|
|
148
|
+
const sizeMB = (size / (1024 * 1024)).toFixed(0);
|
|
149
|
+
ui.warn(`${label} is ${sizeMB}MB — consider truncating`);
|
|
150
|
+
ui.dimmed(` File: ${logFile}`);
|
|
151
|
+
ui.dimmed(` Truncate: : > "${logFile}"`);
|
|
152
|
+
issues++;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Summary
|
|
157
|
+
console.log();
|
|
158
|
+
if (issues === 0) {
|
|
159
|
+
ui.success("All checks passed. Your relay should work correctly.");
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
ui.warn(`${issues} issue${issues > 1 ? "s" : ""} found. Fix the items above and run --doctor again.`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,uBAAuB,CAA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,0 +1,53 @@
|
|
|
1
|
+
import { detectOpenClaw, findInstalledSkill, installSkillFile, getDefaultSkillsDir, getBundledSkillPath, } from "../config/openclaw.js";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
import * as ui from "./ui.js";
|
|
5
|
+
export async function runInitSkill(cli) {
|
|
6
|
+
ui.heading("ArkiTek Relay — Install Skill Definition");
|
|
7
|
+
const bundledPath = getBundledSkillPath();
|
|
8
|
+
if (!existsSync(bundledPath)) {
|
|
9
|
+
ui.error("Bundled SKILL.md not found in the package.");
|
|
10
|
+
ui.dimmed("Try reinstalling: npm install -g arkitek-relay-skill");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
ui.success("Bundled SKILL.md located");
|
|
14
|
+
const openclaw = detectOpenClaw();
|
|
15
|
+
if (openclaw) {
|
|
16
|
+
ui.success(`OpenClaw detected at ${openclaw.configPath}`);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
ui.warn("OpenClaw config not found at ~/.openclaw/openclaw.json");
|
|
20
|
+
ui.dimmed("The skill file will still be placed in the default location.");
|
|
21
|
+
}
|
|
22
|
+
const targetDir = cli.skillsDir || getDefaultSkillsDir();
|
|
23
|
+
ui.info(`Target directory: ${targetDir}/arkitek-relay/`);
|
|
24
|
+
const existing = findInstalledSkill();
|
|
25
|
+
if (existing) {
|
|
26
|
+
ui.warn(`Existing SKILL.md found at ${existing}`);
|
|
27
|
+
let shouldOverwrite = cli.yes;
|
|
28
|
+
if (!shouldOverwrite && process.stdin.isTTY) {
|
|
29
|
+
shouldOverwrite = await ui.confirm("Overwrite with the latest version?");
|
|
30
|
+
}
|
|
31
|
+
if (!shouldOverwrite) {
|
|
32
|
+
ui.dimmed("Skipped. Existing SKILL.md left in place.");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const targetOverride = cli.skillsDir || (existing ? dirname(dirname(existing)) : undefined);
|
|
38
|
+
const result = installSkillFile(targetOverride);
|
|
39
|
+
ui.success(result.existed
|
|
40
|
+
? `SKILL.md updated at ${result.path}`
|
|
41
|
+
: `SKILL.md installed at ${result.path}`);
|
|
42
|
+
console.log();
|
|
43
|
+
ui.info("OpenClaw will discover this skill automatically on next load.");
|
|
44
|
+
ui.dimmed("To verify: openclaw skills list");
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
48
|
+
ui.error(`Failed to install SKILL.md: ${msg}`);
|
|
49
|
+
ui.dimmed("Try specifying a custom directory with --skills-dir <path>");
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=init-skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-skill.js","sourceRoot":"","sources":["../../src/cli/init-skill.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAe;IAChD,EAAE,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC;IAEvD,MAAM,WAAW,GAAG,mBAAmB,EAAE,CAAC;IAC1C,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,EAAE,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QACvD,EAAE,CAAC,MAAM,CAAC,sDAAsD,CAAC,CAAC;QAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,EAAE,CAAC,OAAO,CAAC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