clawdentity 0.0.23 → 0.0.25
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 +108 -0
- package/dist/bin.js +6585 -3799
- package/dist/index.js +6585 -3799
- package/dist/postinstall.js +0 -0
- package/package.json +25 -16
- package/postinstall.mjs +16 -7
- package/skill-bundle/openclaw-skill/skill/SKILL.md +56 -9
- package/skill-bundle/openclaw-skill/skill/references/clawdentity-environment.md +13 -0
- package/LICENSE +0 -21
package/dist/postinstall.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clawdentity",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/vrknetha/clawdentity"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/vrknetha/clawdentity/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/vrknetha/clawdentity#readme",
|
|
8
16
|
"main": "./dist/index.js",
|
|
9
17
|
"types": "./dist/index.d.ts",
|
|
10
18
|
"bin": {
|
|
@@ -21,6 +29,17 @@
|
|
|
21
29
|
"postinstall.mjs",
|
|
22
30
|
"skill-bundle"
|
|
23
31
|
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "pnpm -F @clawdentity/openclaw-skill build && pnpm run sync:skill-bundle && pnpm run verify:skill-bundle && tsup",
|
|
34
|
+
"format": "biome format .",
|
|
35
|
+
"lint": "biome lint .",
|
|
36
|
+
"prepack": "pnpm run build",
|
|
37
|
+
"postinstall": "node ./postinstall.mjs",
|
|
38
|
+
"sync:skill-bundle": "node ./scripts/sync-skill-bundle.mjs",
|
|
39
|
+
"verify:skill-bundle": "node ./scripts/verify-skill-bundle.mjs",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
42
|
+
},
|
|
24
43
|
"dependencies": {
|
|
25
44
|
"commander": "^13.1.0",
|
|
26
45
|
"jsqr": "^1.4.0",
|
|
@@ -29,21 +48,11 @@
|
|
|
29
48
|
"ws": "^8.19.0"
|
|
30
49
|
},
|
|
31
50
|
"devDependencies": {
|
|
51
|
+
"@clawdentity/connector": "workspace:*",
|
|
52
|
+
"@clawdentity/protocol": "workspace:*",
|
|
53
|
+
"@clawdentity/sdk": "workspace:*",
|
|
32
54
|
"@types/node": "^22.18.11",
|
|
33
55
|
"@types/pngjs": "^6.0.5",
|
|
34
|
-
"@types/qrcode": "^1.5.6"
|
|
35
|
-
"@clawdentity/protocol": "0.0.0",
|
|
36
|
-
"@clawdentity/connector": "0.0.0",
|
|
37
|
-
"@clawdentity/sdk": "0.0.0"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "pnpm -F @clawdentity/openclaw-skill build && pnpm run sync:skill-bundle && pnpm run verify:skill-bundle && tsup",
|
|
41
|
-
"format": "biome format .",
|
|
42
|
-
"lint": "biome lint .",
|
|
43
|
-
"postinstall": "node ./postinstall.mjs",
|
|
44
|
-
"sync:skill-bundle": "node ./scripts/sync-skill-bundle.mjs",
|
|
45
|
-
"verify:skill-bundle": "node ./scripts/verify-skill-bundle.mjs",
|
|
46
|
-
"test": "vitest run",
|
|
47
|
-
"typecheck": "tsc --noEmit"
|
|
56
|
+
"@types/qrcode": "^1.5.6"
|
|
48
57
|
}
|
|
49
|
-
}
|
|
58
|
+
}
|
package/postinstall.mjs
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
1
2
|
import { dirname, join } from "node:path";
|
|
2
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
4
|
|
|
4
5
|
const packageRoot = dirname(fileURLToPath(import.meta.url));
|
|
5
6
|
const bundledPostinstallPath = join(packageRoot, "dist", "postinstall.js");
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
if (existsSync(bundledPostinstallPath)) {
|
|
9
|
+
try {
|
|
10
|
+
await import(pathToFileURL(bundledPostinstallPath).href);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
if (
|
|
13
|
+
!(
|
|
14
|
+
error &&
|
|
15
|
+
typeof error === "object" &&
|
|
16
|
+
(error.code === "ENOENT" || error.code === "ERR_MODULE_NOT_FOUND")
|
|
17
|
+
)
|
|
18
|
+
) {
|
|
19
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
20
|
+
process.stderr.write(`[clawdentity] postinstall failed: ${message}\n`);
|
|
21
|
+
process.exitCode = 1;
|
|
22
|
+
}
|
|
14
23
|
}
|
|
15
24
|
}
|
|
@@ -16,6 +16,30 @@ After setup, this skill also covers lifecycle operations: token refresh, API key
|
|
|
16
16
|
|
|
17
17
|
Relay invite codes are not part of this flow.
|
|
18
18
|
|
|
19
|
+
## State Discovery First (required before asking for onboarding inputs)
|
|
20
|
+
|
|
21
|
+
Always detect existing local state before asking for invite code, API key, or peer setup.
|
|
22
|
+
|
|
23
|
+
1. Resolve OpenClaw state root.
|
|
24
|
+
- Default: `~/.openclaw`
|
|
25
|
+
- Respect env overrides: `OPENCLAW_STATE_DIR`, legacy `CLAWDBOT_STATE_DIR`, `OPENCLAW_HOME`
|
|
26
|
+
|
|
27
|
+
2. Resolve Clawdentity state root using this order.
|
|
28
|
+
- Primary: `~/.clawdentity`
|
|
29
|
+
- Fallback: `<openclaw-state>/.clawdentity`
|
|
30
|
+
|
|
31
|
+
3. If fallback exists and primary is missing:
|
|
32
|
+
- Run all `clawdentity ...` commands with `HOME=<openclaw-state>` so CLI resolves the same state root as OpenClaw profile.
|
|
33
|
+
|
|
34
|
+
4. Run readiness probe before asking questions:
|
|
35
|
+
- `clawdentity openclaw doctor --json`
|
|
36
|
+
|
|
37
|
+
5. Behavior gate from doctor output:
|
|
38
|
+
- If doctor is healthy: do not ask for onboarding invite/API key; proceed directly with requested relay/pairing action.
|
|
39
|
+
- If doctor is unhealthy: ask only for the minimum missing input required by failed checks.
|
|
40
|
+
|
|
41
|
+
Never claim that no local relay setup exists until this discovery flow is complete.
|
|
42
|
+
|
|
19
43
|
## Filesystem Truth (must be used exactly)
|
|
20
44
|
|
|
21
45
|
### OpenClaw state files
|
|
@@ -139,10 +163,13 @@ Use `--no-runtime-start` when the connector runs as a separate container or proc
|
|
|
139
163
|
- `clawdentity pair start <agent-name> --qr --ttl-seconds <seconds>`
|
|
140
164
|
- `clawdentity pair start <agent-name> --qr --wait`
|
|
141
165
|
- `clawdentity pair start <agent-name> --qr --wait --wait-seconds <seconds> --poll-interval-seconds <seconds>`
|
|
166
|
+
- `clawdentity pair start <agent-name> --qr --allow-responder <did:claw:agent:...>`
|
|
167
|
+
- `clawdentity pair start <agent-name> --qr --callback-url <https://...>`
|
|
142
168
|
- `clawdentity pair confirm <agent-name> --qr-file <path>`
|
|
143
169
|
- `clawdentity pair confirm <agent-name> --ticket <clwpair1_...>`
|
|
144
170
|
- `clawdentity pair status <agent-name> --ticket <clwpair1_...>`
|
|
145
171
|
- `clawdentity pair status <agent-name> --ticket <clwpair1_...> --wait`
|
|
172
|
+
- `clawdentity pair recover <agent-name>`
|
|
146
173
|
|
|
147
174
|
### Token verification
|
|
148
175
|
- `clawdentity verify <tokenOrFile>`
|
|
@@ -176,9 +203,10 @@ Use `--no-runtime-start` when the connector runs as a separate container or proc
|
|
|
176
203
|
- `npm install -g clawdentity@latest`
|
|
177
204
|
- Confirm local agent name.
|
|
178
205
|
- Confirm local human display name for onboarding.
|
|
179
|
-
- Check
|
|
180
|
-
-
|
|
181
|
-
-
|
|
206
|
+
- Check existing relay state first using **State Discovery First** above.
|
|
207
|
+
- Check local API key status with `clawdentity config get apiKey` only after state root resolution is confirmed.
|
|
208
|
+
- If API key is missing and doctor indicates onboarding is incomplete, ask for onboarding invite `clw_inv_...` and continue with invite redeem.
|
|
209
|
+
- Do not ask for raw API key unless the user explicitly says invite is unavailable and onboarding invite cannot be provided.
|
|
182
210
|
- Confirm OpenClaw path/base URL only if non-default.
|
|
183
211
|
- Do not ask for pairing inputs before onboarding is complete.
|
|
184
212
|
|
|
@@ -256,7 +284,11 @@ Use `--no-runtime-start` when the connector runs as a separate container or proc
|
|
|
256
284
|
- `clawdentity pair status <agent-name> --ticket <clwpair1_...> --wait`
|
|
257
285
|
- This persists the peer on initiator after responder confirmation.
|
|
258
286
|
- Default wait timeout is 300 seconds with 3-second polling.
|
|
259
|
-
-
|
|
287
|
+
- Wait flow is resilient (adaptive polling + transient retries) and persists pending ticket state per agent.
|
|
288
|
+
- If wait times out/cancels/fails due repeated transients, preferred recovery is:
|
|
289
|
+
- `clawdentity pair recover <agent-name>`
|
|
290
|
+
- Manual fallback remains:
|
|
291
|
+
- `clawdentity pair status <agent-name> --ticket <clwpair1_...> --wait`
|
|
260
292
|
- Confirm pairing success, then run `clawdentity openclaw relay test`.
|
|
261
293
|
- **Validate:** `~/.clawdentity/peers.json` contains the new peer alias entry.
|
|
262
294
|
|
|
@@ -274,26 +306,38 @@ Use `--no-runtime-start` when the connector runs as a separate container or proc
|
|
|
274
306
|
After pairing, agents receive relayed messages from their paired peers.
|
|
275
307
|
Identity injection is enabled by default (`INJECT_IDENTITY_INTO_MESSAGE=true` on proxy).
|
|
276
308
|
|
|
309
|
+
**Do not reply to peer messages in chat.** Chat replies stay local and never reach the peer. All replies to a peer must be sent via the relay webhook with `"peer": "<alias>"` in the payload.
|
|
310
|
+
|
|
277
311
|
### Recognizing incoming messages
|
|
278
312
|
- Relayed messages contain a `[Clawdentity Identity]` block prepended to the message body.
|
|
279
313
|
- Extract `agentDid` from this block to identify the sender.
|
|
280
314
|
- See `references/clawdentity-protocol.md` § Identity Injection for the exact block format and field definitions.
|
|
281
315
|
- The connector `deliver` frame also exposes `fromAgentDid` for programmatic access.
|
|
316
|
+
- When you see a `[Clawdentity Identity]` block, the message is from a peer. Do not answer in chat. Follow the reply flow below.
|
|
282
317
|
|
|
283
318
|
### Looking up peer identity
|
|
284
319
|
- Map sender `agentDid` to a known peer by matching against `did` in `~/.clawdentity/peers.json`.
|
|
285
320
|
- Each peer entry contains:
|
|
286
321
|
- `did` — the peer's agent DID (match key)
|
|
287
|
-
- `agentName` — the peer's agent name
|
|
288
|
-
- `humanName` — the human behind the peer agent
|
|
322
|
+
- `agentName` — the peer's agent name
|
|
323
|
+
- `humanName` — the human behind the peer agent
|
|
289
324
|
- `proxyUrl` — the peer's proxy endpoint
|
|
290
|
-
-
|
|
325
|
+
- The peer alias is the key of that entry in `peers.json` (e.g., `"beta"`). Use this alias in the reply payload.
|
|
291
326
|
|
|
292
327
|
### Sending messages to a peer
|
|
328
|
+
This is the only way to reply to a peer or send a new message. Chat replies do not reach peers.
|
|
293
329
|
- Include `"peer": "<alias>"` in the webhook payload to route via relay.
|
|
294
|
-
-
|
|
330
|
+
- Use the alias resolved from the lookup step above.
|
|
331
|
+
- Use `agentName` or `humanName` in the message text for natural addressing.
|
|
295
332
|
- The relay transform strips `peer` from the payload and routes to the connector.
|
|
296
333
|
|
|
334
|
+
### Reply flow
|
|
335
|
+
When a relayed peer message arrives:
|
|
336
|
+
1. Extract `agentDid` from the `[Clawdentity Identity]` block.
|
|
337
|
+
2. Look up the peer alias by matching `agentDid` against `did` in `~/.clawdentity/peers.json`.
|
|
338
|
+
3. Compose a webhook payload with `"peer": "<alias>"` set to the resolved alias.
|
|
339
|
+
4. The relay delivers the payload to the peer. Do not also reply in chat.
|
|
340
|
+
|
|
297
341
|
### Peer validation
|
|
298
342
|
- `clawdentity openclaw doctor --peer <alias>` confirms a specific peer is reachable.
|
|
299
343
|
- `clawdentity openclaw relay test --peer <alias>` sends a test probe to the peer.
|
|
@@ -356,7 +400,10 @@ Do not suggest switching endpoints unless user explicitly asks for endpoint chan
|
|
|
356
400
|
### Pairing errors
|
|
357
401
|
- `PROXY_PAIR_TICKET_NOT_FOUND`: ticket invalid or expired. Request a new ticket from initiator.
|
|
358
402
|
- `PROXY_PAIR_TICKET_EXPIRED`: ticket has expired. Request a new ticket.
|
|
359
|
-
- `
|
|
403
|
+
- `PROXY_PAIR_TICKET_ALREADY_CONFIRMED`: ticket replayed; pairing already completed earlier.
|
|
404
|
+
- `CLI_PAIR_STATUS_WAIT_TIMEOUT`: responder did not confirm before deadline. Run `pair recover` (preferred) or `pair status --ticket ... --wait`.
|
|
405
|
+
- `CLI_PAIR_STATUS_POLL_FAILED`: transient polling failures exceeded retry budget. Run `pair recover`.
|
|
406
|
+
- `CLI_PAIR_STATUS_WAIT_CANCELLED`: wait interrupted (SIGINT). Run `pair recover`.
|
|
360
407
|
- `CLI_PAIR_CONFIRM_INPUT_CONFLICT`: cannot provide both `--ticket` and `--qr-file`. Use one path only.
|
|
361
408
|
- `CLI_PAIR_PROXY_URL_MISMATCH`: local `proxyUrl` does not match registry metadata. Rerun `clawdentity invite redeem <clw_inv_...>`.
|
|
362
409
|
- Responder shows peer but initiator does not:
|
|
@@ -21,6 +21,19 @@ Complete reference for CLI environment variable overrides. When env overrides ar
|
|
|
21
21
|
| `OPENCLAW_STATE_DIR` | Override OpenClaw state directory | openclaw |
|
|
22
22
|
| `OPENCLAW_HOME` | Override OpenClaw home directory (used when explicit config/state overrides are unset) | openclaw |
|
|
23
23
|
|
|
24
|
+
## Profile-Local State Resolution
|
|
25
|
+
|
|
26
|
+
In profile-mounted/containerized OpenClaw environments, Clawdentity state may be stored at:
|
|
27
|
+
- `<openclaw-state>/.clawdentity`
|
|
28
|
+
|
|
29
|
+
instead of:
|
|
30
|
+
- `~/.clawdentity`
|
|
31
|
+
|
|
32
|
+
If `~/.clawdentity` is missing but `<openclaw-state>/.clawdentity` exists, run CLI commands with:
|
|
33
|
+
- `HOME=<openclaw-state>`
|
|
34
|
+
|
|
35
|
+
This makes `clawdentity` resolve the correct profile-local state root.
|
|
36
|
+
|
|
24
37
|
## Legacy Environment Variables
|
|
25
38
|
|
|
26
39
|
| Variable | Replaced By |
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Ravi Kiran Vemula
|
|
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.
|