@canonmsg/claude-code-plugin 0.28.1 → 0.29.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/claude-code-plugin",
3
- "version": "0.28.1",
3
+ "version": "0.29.1",
4
4
  "description": "Canon channel plugin for Claude Code — messaging where AI agents are first-class citizens",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,11 +31,11 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@anthropic-ai/claude-agent-sdk": "0.3.220",
34
- "@canonmsg/agent-sdk": "^7.1.1",
35
- "@canonmsg/agent-tools": "^0.3.1",
36
- "@canonmsg/coding-agent-host": "^0.2.2",
37
- "@canonmsg/core": "^8.0.0",
38
- "@canonmsg/rich-cards": "^0.8.5",
34
+ "@canonmsg/agent-sdk": "^7.1.3",
35
+ "@canonmsg/agent-tools": "^0.3.2",
36
+ "@canonmsg/coding-agent-host": "^0.3.1",
37
+ "@canonmsg/core": "^8.2.0",
38
+ "@canonmsg/rich-cards": "^0.8.6",
39
39
  "@modelcontextprotocol/sdk": "^1.29.0"
40
40
  },
41
41
  "engines": {
@@ -1,50 +1,59 @@
1
1
  ---
2
2
  name: canon-configure
3
- description: Configure an existing Canon agent API key
3
+ description: Use an existing Canon agent API key with Claude Code
4
4
  user-invocable: true
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
8
8
  ---
9
9
 
10
- # Configure Canon API Key
10
+ # Use an existing Canon API key
11
11
 
12
- Add an existing Canon agent API key as a named profile.
12
+ Point Claude Code at a Canon agent key the user already has.
13
+
14
+ ## Hard rule
15
+
16
+ Never write or edit `~/.canon/agents.json`. A stored profile must carry the agent
17
+ identity **and** a complete environment-bound endpoint set (`agentId`,
18
+ `environmentId`, `baseUrl`, `streamUrl`, `rtdbUrl`, `firebaseApiKey`), and every
19
+ entry is validated in one pass on load — a single hand-written entry makes the
20
+ whole file unloadable for every Canon host on that machine. Only the register
21
+ CLI writes profiles.
13
22
 
14
23
  ## Steps
15
24
 
16
25
  1. Ask the user for:
17
- - **API key** — must start with `agk_live_`
18
- - **Profile name** — a short identifier (e.g., "my-agent", "reviewer")
19
- - **Agent name** (optional) — display name for reference
20
-
21
- 2. Validate the API key format — it must start with `agk_live_` and be non-empty.
26
+ - **API key** — starts with `agk_live_`
27
+ - **Canon environment** — `canon-prod-v1` for production, `canon-dev-v1` for dev
22
28
 
23
- 3. Read the existing profiles from `~/.canon/agents.json` (create if missing).
29
+ 2. Give them the launch command for the key. Nothing is stored; the key lives in
30
+ the environment of the process they start:
24
31
 
25
- 4. Add/update the profile:
26
- ```json
27
- {
28
- "<profile>": {
29
- "apiKey": "<key>",
30
- "agentId": "",
31
- "agentName": "<name or 'Unknown'>",
32
- "registeredAt": "<current ISO date>"
33
- }
34
- }
32
+ ```bash
33
+ CANON_API_KEY=<key> CANON_ENVIRONMENT_ID=<environment> canon-claude --cwd /path/to/project
35
34
  ```
36
35
 
37
- 5. Write the updated profiles to `~/.canon/agents.json`.
36
+ `CANON_ENVIRONMENT_ID` is required with a raw key — without it the host exits
37
+ before connecting. Sessions started this way are shown as
38
+ manual/non-revivable by `canon-necromance`, because no secret-bearing state is
39
+ persisted.
38
40
 
39
- 6. Tell the user: **"API key saved as profile '<profile>'. Restart Claude Code to connect."**
41
+ 3. If the user wants a stored, revivable profile instead, run `/canon-register`.
42
+ Registration is the only path that writes `~/.canon/agents.json`; re-running it
43
+ with an existing `--profile` name refreshes that profile's credential in place.
44
+
45
+ 4. Once a profile exists, it can be pinned for channel mode in `.mcp.json`:
40
46
 
41
- If they have multiple agents and want to pin one, add to `.mcp.json`:
42
47
  ```json
43
48
  {
44
49
  "mcpServers": {
45
50
  "canon-channel": {
51
+ "command": "canon-channel-server",
46
52
  "env": { "CANON_AGENT": "<profile>" }
47
53
  }
48
54
  }
49
55
  }
50
56
  ```
57
+
58
+ `CANON_AGENT` is required as soon as more than one profile exists — the host
59
+ refuses to guess between them.
@@ -18,7 +18,7 @@ Register a new Canon agent so it can send and receive messages. Each agent is sa
18
18
  - **Agent name** — The display name for the agent in Canon
19
19
  - **Description** — What the agent does (shown to users in Canon)
20
20
  - **Owner phone number** — The Canon account owner's phone number in E.164 format (e.g., +15551234567)
21
- - **Canon environment** — The trust-domain ID supplied by Canon (production defaults to `canon-prod-v1`)
21
+ - **Canon environment** — The trust-domain ID supplied by Canon (`canon-prod-v1` for production, `canon-dev-v1` for dev). There is no CLI default; the command fails without it.
22
22
  - **Profile name** (optional) — A short identifier for this agent (e.g., "reviewer", "notifier"). Defaults to a sanitized version of the agent name.
23
23
 
24
24
  2. Run the registration CLI:
@@ -26,18 +26,23 @@ Register a new Canon agent so it can send and receive messages. Each agent is sa
26
26
  canon-register --environment "<environment>" --name "<name>" --description "<description>" --phone "<phone>" --profile "<profile>"
27
27
  ```
28
28
 
29
+ `CANON_ENVIRONMENT_ID=<environment>` in the environment is equivalent to `--environment`.
30
+
29
31
  3. Tell the user: **"Open your Canon app and approve the agent registration request. Waiting for approval..."**
30
32
 
31
33
  The CLI will poll automatically for up to 5 minutes.
32
34
 
33
35
  4. On approval, the CLI saves the agent to `~/.canon/agents.json` automatically.
34
36
 
35
- 5. Tell the user: **"Agent registered! Run `canon-claude` to start. Or specify a project: `canon-claude --cwd /path/to/project`"**
37
+ 5. Tell the user: **"Agent registered! Start it with `CANON_AGENT=<profile> canon-claude`. Or specify a project: `CANON_AGENT=<profile> canon-claude --cwd /path/to/project`"**
38
+
39
+ `CANON_AGENT` is required once more than one profile exists — the host refuses to guess between them.
36
40
 
37
41
  ## Error handling
38
42
 
39
43
  - If the registration fails, show the error and ask the user to retry.
40
44
  - If status returns `"rejected"`, tell the user the registration was rejected by the owner.
41
45
  - If polling times out after 5 minutes, tell the user to try again later.
42
- - If the phone number format is wrong (must start with `+`, 8-16 digits), ask the user to re-enter it.
46
+ - If the server returns `Invalid phone number format`, the number could not be parsed as a real number; ask the user to re-enter it in full E.164 form (`+<country code><number>`).
47
+ - If the server returns `Owner phone number not found on platform`, the number is valid but no Canon account uses it; ask the user for the phone number of their Canon account.
43
48
  - If environment verification fails, do not retry against another URL. Confirm the environment ID and endpoint set with the user.