@essentialai/cogent-plugin 3.25.6 → 3.25.7
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/.claude-plugin/plugin.json +1 -1
- package/bridge/cogent-bridge.mjs +861 -379
- package/commands/register.md +43 -33
- package/package.json +1 -1
- package/skills/bridge-setup/SKILL.md +16 -7
package/commands/register.md
CHANGED
|
@@ -19,34 +19,39 @@ Capture `<org_id>` as an optional parsed value — extract **only** the Org_ID t
|
|
|
19
19
|
Resolve the channel in this order; **only the last resort is local-only**:
|
|
20
20
|
|
|
21
21
|
1. **From `$ARGUMENTS`** — if a channel name + password (with an optional Org_ID) were provided, use them.
|
|
22
|
-
2. **From the project `.env`** — if arguments named no channel, the repo almost always configures one in `.env
|
|
22
|
+
2. **From the project `.env`** — if arguments named no channel, the repo almost always configures one in `.env`. List the Cogent **key names** it holds (never assume it is absent). This command prints key NAMES and line numbers only — **never a value**:
|
|
23
23
|
```bash
|
|
24
|
-
grep -
|
|
24
|
+
grep -noE '^#COGENT[A-Za-z0-9_ -]*|^(CHANNEL|COG[A-Z]*NT)_(CHANNEL_)?(NAME|PASSWORD|ORG_ID|PEER_NAME|PEER_LABEL)=' .env
|
|
25
25
|
```
|
|
26
|
-
|
|
27
|
-
- **
|
|
28
|
-
|
|
26
|
+
The fields are recognised by how the key **ends**: channel = `…CHANNEL_NAME`, password = `…CHANNEL_PASSWORD`, Org_ID = `…ORG_ID` (present ⇒ **Team** channel), peer = `…PEER_NAME`, label = `…PEER_LABEL`. Both spellings are in use: `CHANNEL_NAME` / `CHANNEL_ORG_ID` / `CHANNEL_PEER_NAME` and `COGENT_CHANNEL_NAME` / `COGENT_ORG_ID` / `COGENT_PEER_NAME`.
|
|
27
|
+
- **Exactly one channel-name key** → use that set of keys. A `#COGENT…` comment header above them is optional.
|
|
28
|
+
- **More than one channel-name key** → list the `#COGENT…` headers (or the line numbers) and **ask the user which channel to join**. Never guess.
|
|
29
|
+
- **A key with a misspelled prefix** (for example `COGEGNT_PEER_NAME`) → use it, and tell the user the **key name** so they can fix the spelling.
|
|
30
|
+
- **No peer-name key at all** → ask the user for the peer name. Never invent one.
|
|
31
|
+
|
|
32
|
+
Then read the values of just those keys and pass them **straight into the tool calls** below. **Never print the channel password or the Org_ID**: do not run a command or write a script that prints them, and do not repeat them in a reply, a summary or a message to another peer.
|
|
33
|
+
3. **Local-only** — follow the bridge-setup skill **only** when there is neither an argument channel nor any channel-name key in `.env`.
|
|
29
34
|
|
|
30
35
|
When a channel resolved from step 1 or 2, follow **Cloud Channel Setup** below.
|
|
31
36
|
|
|
32
|
-
> ⚠️ **Never fall through to local-only while a
|
|
37
|
+
> ⚠️ **Never fall through to local-only while a channel-name key exists in `.env`.** Local-only puts you on a *different bridge* than peers who joined the cloud channel — they will not see each other (this was the real cause of "our two agents can't reach each other"). `.env` first; local-only is the last resort.
|
|
33
38
|
|
|
34
39
|
## Cloud Channel Setup
|
|
35
40
|
|
|
36
41
|
When channel name and password are provided:
|
|
37
42
|
|
|
38
|
-
### Step 1: Join the
|
|
43
|
+
### Step 1: Join the channel
|
|
39
44
|
|
|
40
45
|
**If an Org_ID was provided (Team channel):**
|
|
41
46
|
|
|
42
47
|
Call `cogent_join_session` with:
|
|
43
48
|
- `channel`: the channel name exactly as the user provided it
|
|
44
49
|
- `secret`: the channel password
|
|
45
|
-
- `orgId`: the Org_ID
|
|
50
|
+
- `orgId`: the Org_ID (from arguments or the `…ORG_ID` key)
|
|
46
51
|
|
|
47
52
|
The client auto-routes an Org_ID join to the Team relay (`app.cogent.tools`); a free join uses the default relay. You do not configure the endpoint — passing `orgId` is what selects the Team relay.
|
|
48
53
|
|
|
49
|
-
**CRITICAL — never drop the Org_ID.** If this join fails, do NOT retry `cogent_join_session` without `orgId`. A Team channel is org-isolated; retrying without the Org_ID would silently land you on a *different, public* free channel that happens to share the name — masking the real failure and breaking isolation.
|
|
54
|
+
**CRITICAL — never drop the Org_ID.** If this join fails, do NOT retry `cogent_join_session` without `orgId`. A Team channel is org-isolated; retrying without the Org_ID would silently land you on a *different, public* free channel that happens to share the name — masking the real failure and breaking isolation. What to do when the join fails is in Step 2.
|
|
50
55
|
|
|
51
56
|
**If no Org_ID was provided (free channel):**
|
|
52
57
|
|
|
@@ -56,49 +61,53 @@ Call `cogent_join_session` with:
|
|
|
56
61
|
|
|
57
62
|
**IMPORTANT**: The `channel` parameter takes the human-readable channel name, NOT a UUID or Claude Code session ID.
|
|
58
63
|
|
|
59
|
-
### Step 2: If join
|
|
60
|
-
|
|
61
|
-
**This step applies ONLY when no Org_ID was provided.**
|
|
64
|
+
### Step 2: If the join answers `CHANNEL_NOT_FOUND` — create the channel
|
|
62
65
|
|
|
63
|
-
Only
|
|
64
|
-
- `label`: the channel name (
|
|
65
|
-
- `secret`: the channel password
|
|
66
|
+
Only when Step 1 failed with **`CHANNEL_NOT_FOUND`**, call `cogent_create_session` **once** with:
|
|
67
|
+
- `label`: the SAME channel name (3-32 characters: lowercase letters, digits, hyphens)
|
|
68
|
+
- `secret`: the SAME channel password
|
|
69
|
+
- `orgId`: the SAME Org_ID — Team channel only. **If you were given an Org_ID, never leave it out.**
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
It creates the channel and joins you to it. Do not repeat Step 1 first: on the Team relay five failed joins lock the name for 15 minutes.
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
For every other answer:
|
|
74
|
+
- **`already in use`** from the create → the channel exists (another agent created it a moment ago). Go back to Step 1 with the same name. Never choose another name.
|
|
75
|
+
- **`CHANNEL_NOT_FOUND` on a join where you left out an Org_ID you were given** → do Step 1 again WITH `orgId` and create nothing. A create without the Org_ID makes a *public* channel on the free relay carrying the Team channel's name and password.
|
|
76
|
+
- **`Invalid credentials`** or **`Invalid session secret`** → the password or Org_ID is wrong. Stop and ask the user. Do not retry with guesses.
|
|
77
|
+
- **`RATE_LIMITED`** or HTTP 429 → wait the seconds it states, then repeat the same call once. Change nothing.
|
|
78
|
+
- Anything else → report it to the user and stop.
|
|
70
79
|
|
|
71
80
|
### Step 3: Register as peer
|
|
72
81
|
|
|
73
|
-
The cloud channel you joined in Step 1 is bound **automatically** (from this process's `cogent_join_session`). Do **NOT** pass the channel UUID as `sessionId`.
|
|
82
|
+
The cloud channel you joined in Step 1 (or created in Step 2) is bound **automatically** (from this process's `cogent_join_session` / `cogent_create_session`). Do **NOT** pass the channel UUID as `sessionId`.
|
|
74
83
|
|
|
75
84
|
Call `cogent_register_peer` with:
|
|
76
|
-
- `peerId`: the peer name (from arguments or `
|
|
85
|
+
- `peerId`: the peer name (from arguments or the `…PEER_NAME` key)
|
|
77
86
|
- `sessionId`: **this session's LOCAL Claude Code session id** — the id the relay uses to wake you (`claude --resume <id>`) for auto-reply. Discover it exactly as in the **bridge-setup** skill's "Discover Session ID" step (newest `~/.claude/projects/<cwd-with-non-alnum-as-dashes>/*.jsonl`). ⚠️ Passing the **channel UUID** here silently breaks auto-reply: a channel UUID is not a resumable session, so inbound directed messages fail with `DELIVERY_NO_ACK` — the peer looks online but never answers.
|
|
78
87
|
- `cwd`: the absolute working directory path
|
|
79
|
-
- `label`: `
|
|
88
|
+
- `label`: the `…PEER_LABEL` value, or derive from peerId (capitalize, replace hyphens with spaces)
|
|
80
89
|
- `mode`: `"agent"` (default — auto-replies to directed messages). Use `"observer"` only to monitor a channel without auto-replying; an observer is not woken, so its local session id does not matter.
|
|
81
90
|
|
|
82
|
-
> 🔴 **HARD RULE — never change your peerId.** Register under the EXACT peer name you were given — never a suffixed, "-recovery", "-2" or otherwise invented variant: your peers address you by that name, and a renamed peer silently stops receiving their messages. If `cogent_register_peer` fails with **`PEER_NOT_YOURS`**, the name is almost always held by your OWN earlier registration: retry the **SAME** `peerId` after the `retryAfterMs` / time the error states (or stop the other session using it). If it returns **`JOIN_NOT_CONFIRMED`**,
|
|
91
|
+
> 🔴 **HARD RULE — never change your peerId.** Register under the EXACT peer name you were given — never a suffixed, "-recovery", "-2" or otherwise invented variant: your peers address you by that name, and a renamed peer silently stops receiving their messages. If `cogent_register_peer` fails with **`PEER_NOT_YOURS`**, the name is almost always held by your OWN earlier registration: retry the **SAME** `peerId` after the `retryAfterMs` / time the error states (or stop the other session using it). If it returns **`JOIN_NOT_CONFIRMED`**, do what the error says: join, or create only if the join answered `CHANNEL_NOT_FOUND`. Report the failure to the user rather than picking another name.
|
|
83
92
|
|
|
84
93
|
### Step 4: Confirm
|
|
85
94
|
|
|
86
95
|
Call `cogent_list_peers` to show who is online.
|
|
87
96
|
|
|
88
|
-
Then display a summary block with **all** of the following fields
|
|
97
|
+
Then display a summary block with **all** of the following fields. **Never print the channel password or the Org_ID** — not here, not in a reply, not in a message to another peer. Show where each one lives instead.
|
|
89
98
|
|
|
90
99
|
**If an Org_ID was used (Team channel):**
|
|
91
100
|
|
|
92
101
|
```
|
|
93
102
|
- Peer ID: <peerId>
|
|
94
103
|
- Label: <label>
|
|
95
|
-
- Channel: <channel name>
|
|
96
|
-
- Secret: <
|
|
97
|
-
- Org_ID: <
|
|
104
|
+
- Channel: <channel name> (Team; created by this agent just now | joined existing)
|
|
105
|
+
- Secret: hidden (<key name> in .env)
|
|
106
|
+
- Org_ID: hidden (<key name> in .env)
|
|
98
107
|
- Transport: WebSocket (cloud relay)
|
|
99
108
|
|
|
100
109
|
To map this channel to a Slack channel, run this slash command in Slack:
|
|
101
|
-
|
|
110
|
+
<slackMapCommand from the join or create result>
|
|
102
111
|
```
|
|
103
112
|
|
|
104
113
|
**If no Org_ID was used (free channel):**
|
|
@@ -106,15 +115,16 @@ To map this channel to a Slack channel, run this slash command in Slack:
|
|
|
106
115
|
```
|
|
107
116
|
- Peer ID: <peerId>
|
|
108
117
|
- Label: <label>
|
|
109
|
-
- Channel: <channel name>
|
|
110
|
-
- Secret: <
|
|
118
|
+
- Channel: <channel name> (free; created by this agent just now | joined existing)
|
|
119
|
+
- Secret: hidden (<key name> in .env)
|
|
111
120
|
- Transport: WebSocket (cloud relay)
|
|
112
|
-
- Channel ID (for Slack): <sessionId from Step 1 or 2>
|
|
113
121
|
|
|
114
122
|
To map this channel to a Slack channel, run this slash command in Slack:
|
|
115
|
-
|
|
123
|
+
<slackMapCommand from the join or create result>
|
|
116
124
|
```
|
|
117
125
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
126
|
+
Write "created by this agent just now" only when `cogent_create_session` answered `created: true`; otherwise "joined existing". When the values came from the user's message rather than `.env`, write `hidden (given in your message)`.
|
|
127
|
+
|
|
128
|
+
**IMPORTANT**: Always show the Slack `/cogent map` command, copied from the `slackMapCommand` field of the join or create result **with its placeholders left exactly as they are**. The user fills in `<password>` and `<org-id>` in Slack:
|
|
129
|
+
- **Team channel (Org_ID was used):** `/cogent map <channel-name> <password> <org-id>` — all THREE are required, and it takes the channel **name**, not the UUID sessionId.
|
|
130
|
+
- **Free channel (no Org_ID):** `/cogent map <sessionId> <password>`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@essentialai/cogent-plugin",
|
|
3
|
-
"version": "3.25.
|
|
3
|
+
"version": "3.25.7",
|
|
4
4
|
"description": "Cogent — Claude Code plugin (skills + slash-commands + MCP server) for the cross-agent comms fabric.",
|
|
5
5
|
"author": { "name": "Essential AI Solutions Ltd.", "url": "https://essentialai.uk" },
|
|
6
6
|
"homepage": "https://cogent.tools",
|
|
@@ -20,15 +20,24 @@ cloud session BEFORE registering the peer:
|
|
|
20
20
|
1. **Try joining first**: Call `cogent_join_session` with:
|
|
21
21
|
- `channel`: the channel name (e.g., "mt-space") — this is the human-readable name, NOT a UUID
|
|
22
22
|
- `secret`: the channel password
|
|
23
|
+
- `orgId`: the Org_ID — **Team channel only**. If you were given an Org_ID, pass it on every call and never retry without it.
|
|
23
24
|
This triggers server-side label resolution (label -> UUID).
|
|
24
25
|
|
|
25
|
-
2. **Create only if join
|
|
26
|
-
- `label`: the channel name (
|
|
27
|
-
- `secret`: the channel password
|
|
26
|
+
2. **Create only if the join answers `CHANNEL_NOT_FOUND`**: Call `cogent_create_session` once with:
|
|
27
|
+
- `label`: the SAME channel name (3-32 characters: lowercase letters, digits, hyphens)
|
|
28
|
+
- `secret`: the SAME channel password
|
|
29
|
+
- `orgId`: the SAME Org_ID (Team channel only) — never leave it out if you were given one
|
|
28
30
|
Do NOT invent a different label. If the format is invalid, tell the user.
|
|
29
31
|
|
|
30
|
-
3. **If create fails with "
|
|
31
|
-
|
|
32
|
+
3. **If create fails with "already in use"**: The channel exists (another agent created it a
|
|
33
|
+
moment ago). Call `cogent_join_session` again with the same channel name.
|
|
34
|
+
|
|
35
|
+
4. **`Invalid credentials` / `Invalid session secret`**: the password or Org_ID is wrong — stop
|
|
36
|
+
and ask the user. **`RATE_LIMITED` / HTTP 429**: wait the seconds it states, then repeat the
|
|
37
|
+
same call once.
|
|
38
|
+
|
|
39
|
+
**Never print the channel password or the Org_ID** — pass them straight into the tool calls, and
|
|
40
|
+
do not repeat them in a reply, a summary or a message to another peer.
|
|
32
41
|
|
|
33
42
|
## Step 1: Discover Session ID
|
|
34
43
|
|
|
@@ -65,13 +74,13 @@ Call `cogent_register_peer` with:
|
|
|
65
74
|
- `cwd`: the absolute working directory path (output of `pwd`)
|
|
66
75
|
- `label`: the chosen label
|
|
67
76
|
|
|
68
|
-
> 🔴 **HARD RULE — never change your peerId.** Register under the EXACT peer name you were given — never a suffixed, "-recovery", "-2" or otherwise invented variant: your peers address you by that name, and a renamed peer silently stops receiving their messages. If `cogent_register_peer` fails with **`PEER_NOT_YOURS`**, the name is almost always held by your OWN earlier registration: retry the **SAME** `peerId` after the `retryAfterMs` / time the error states (or stop the other session using it). If it returns **`JOIN_NOT_CONFIRMED`**,
|
|
77
|
+
> 🔴 **HARD RULE — never change your peerId.** Register under the EXACT peer name you were given — never a suffixed, "-recovery", "-2" or otherwise invented variant: your peers address you by that name, and a renamed peer silently stops receiving their messages. If `cogent_register_peer` fails with **`PEER_NOT_YOURS`**, the name is almost always held by your OWN earlier registration: retry the **SAME** `peerId` after the `retryAfterMs` / time the error states (or stop the other session using it). If it returns **`JOIN_NOT_CONFIRMED`**, do what the error says: join, or create only if the join answered `CHANNEL_NOT_FOUND`. Report the failure to the user rather than picking another name.
|
|
69
78
|
|
|
70
79
|
## Step 4: Confirm Registration
|
|
71
80
|
|
|
72
81
|
After successful registration, inform the user:
|
|
73
82
|
- Their peer ID and label
|
|
74
|
-
- If cloud mode: the channel name
|
|
83
|
+
- If cloud mode: the channel name, whether you created or joined it, and the `slackMapCommand` from the tool result with its placeholders left as they are — never the password or the Org_ID
|
|
75
84
|
- They can send messages to other peers using `cogent_send_message`
|
|
76
85
|
- They can check who else is on the bridge using `cogent_list_peers`
|
|
77
86
|
- Incoming messages arrive with a `[Cogent Bridge message from ...]` header
|