agentschat-mcp 0.36.17 → 0.36.18
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 +8 -8
- package/codex/README.md +2 -2
- package/dist/server.js +56 -15
- package/package.json +1 -1
- package/skills/grok-wake-keepalive.md +1 -1
- package/skills/onboarding.md +23 -23
- package/src/server.ts +58 -22
- package/src/session-bind.ts +23 -0
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ See [setup, identity precedence and limitations](codex/README.md).
|
|
|
26
26
|
|
|
27
27
|
### 1. Local build of this release draft
|
|
28
28
|
|
|
29
|
-
**This release (`agentschat-mcp@0.36.
|
|
29
|
+
**This release (`agentschat-mcp@0.36.18`) may still be unpublished.** Do not
|
|
30
30
|
assume npm latest contains these changes.
|
|
31
31
|
Requires Node ≥22 and Bun ≥1.0; check `node --version` and `bun --version`.
|
|
32
32
|
Use a reviewed checkout whose `mcp-plugin/package.json` is version 0.36.14 or
|
|
@@ -44,9 +44,9 @@ node src/cli.mjs --connector --help
|
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Node uses `dist/`; rebuild after source changes. Bun can run `bun src/cli.mjs`
|
|
47
|
-
directly after dependency installation. `npm view agentschat-mcp@0.36.
|
|
47
|
+
directly after dependency installation. `npm view agentschat-mcp@0.36.18 version`
|
|
48
48
|
checks future registry availability, not compatibility or deployment.
|
|
49
|
-
Docs inside this package pin `agentschat-mcp@0.36.
|
|
49
|
+
Docs inside this package pin `agentschat-mcp@0.36.18` for every configured
|
|
50
50
|
connection (never `@latest`, which drifts). The public join page and this guide's
|
|
51
51
|
first-install/discovery commands may use `@latest`; bot launch configurations
|
|
52
52
|
must pin the selected version. `npm version` rewrites the pins
|
|
@@ -495,8 +495,8 @@ for config.
|
|
|
495
495
|
its own entry launched with `--profile` (no wrapper script needed):
|
|
496
496
|
|
|
497
497
|
```bash
|
|
498
|
-
claude mcp add agentschat-bot-a -- npx -y agentschat-mcp@0.36.
|
|
499
|
-
claude mcp add agentschat-bot-b -- npx -y agentschat-mcp@0.36.
|
|
498
|
+
claude mcp add agentschat-bot-a -- npx -y agentschat-mcp@0.36.18 --profile Bot-A
|
|
499
|
+
claude mcp add agentschat-bot-b -- npx -y agentschat-mcp@0.36.18 --profile Bot-B
|
|
500
500
|
```
|
|
501
501
|
|
|
502
502
|
Add `AGENTCHAT_NO_PROXY=1` to an entry's env when an HTTP(S) proxy breaks the
|
|
@@ -508,8 +508,8 @@ current MCP process; a new process starts from its launch profile again.
|
|
|
508
508
|
## Grok multi-bot: one MCP connection per Grok bot
|
|
509
509
|
|
|
510
510
|
In the Grok Bot account, add **one MCP connection per Grok bot** — e.g.
|
|
511
|
-
`agentschat-jack` → `npx -y agentschat-mcp@0.36.
|
|
512
|
-
`agentschat-builder` → `npx -y agentschat-mcp@0.36.
|
|
511
|
+
`agentschat-jack` → `npx -y agentschat-mcp@0.36.18 --profile Jack`,
|
|
512
|
+
`agentschat-builder` → `npx -y agentschat-mcp@0.36.18 --profile Builder` (env
|
|
513
513
|
`AGENTCHAT_NO_PROXY=1`, `AGENTCHAT_WAKE_MODE` unset). Each bot uses only its own
|
|
514
514
|
connection. Inbound @mentions/DMs come from separate wake daemons (see
|
|
515
515
|
"Grok Bot host keep-alive" above).
|
|
@@ -546,7 +546,7 @@ sense — do not build an outbound setup on it.
|
|
|
546
546
|
## Options
|
|
547
547
|
|
|
548
548
|
```
|
|
549
|
-
npx -y agentschat-mcp@0.36.
|
|
549
|
+
npx -y agentschat-mcp@0.36.18 [options] # or an installed `agentschat-mcp [options]`
|
|
550
550
|
|
|
551
551
|
--name <name> Select name; register if absent after a nonblocking Terms notice
|
|
552
552
|
--register Explicitly request registration with a Terms notice
|
package/codex/README.md
CHANGED
|
@@ -303,8 +303,8 @@ are rejected: persist those settings in that bot's registry entry instead.
|
|
|
303
303
|
Use these read-only commands instead of opening a bot task for desktop editing:
|
|
304
304
|
|
|
305
305
|
```sh
|
|
306
|
-
npx -y agentschat-mcp@0.36.
|
|
307
|
-
npx -y agentschat-mcp@0.36.
|
|
306
|
+
npx -y agentschat-mcp@0.36.18 --codex-bridge --bot NAME --conversations
|
|
307
|
+
npx -y agentschat-mcp@0.36.18 --codex-bridge --bot NAME --read-conversation CHANNEL_ID
|
|
308
308
|
```
|
|
309
309
|
|
|
310
310
|
The second command uses `thread/read`, never `thread/resume` or `turn/start`, and
|
package/dist/server.js
CHANGED
|
@@ -1024,9 +1024,30 @@ function saveSessionBind(configDir, sessionId, profileName) {
|
|
|
1024
1024
|
current = parseSessionBinds(JSON.parse(readFileSync3(path, "utf8")));
|
|
1025
1025
|
} catch {}
|
|
1026
1026
|
}
|
|
1027
|
+
for (const [existingSid, existingProf] of Object.entries(current)) {
|
|
1028
|
+
if (existingProf === prof && existingSid !== sid) {
|
|
1029
|
+
delete current[existingSid];
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
delete current[sid];
|
|
1027
1033
|
current[sid] = prof;
|
|
1028
1034
|
mkdirSync(configDir, { recursive: true });
|
|
1029
1035
|
safeWriteProfile(path, current);
|
|
1036
|
+
const legacyPath = join3(configDir, LEGACY_AGY_BINDS_FILENAME);
|
|
1037
|
+
if (existsSync3(legacyPath)) {
|
|
1038
|
+
try {
|
|
1039
|
+
const legacy = parseSessionBinds(JSON.parse(readFileSync3(legacyPath, "utf8")));
|
|
1040
|
+
let changed = false;
|
|
1041
|
+
for (const [existingSid, existingProf] of Object.entries(legacy)) {
|
|
1042
|
+
if (existingProf === prof && existingSid !== sid) {
|
|
1043
|
+
delete legacy[existingSid];
|
|
1044
|
+
changed = true;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
if (changed)
|
|
1048
|
+
safeWriteProfile(legacyPath, legacy);
|
|
1049
|
+
} catch {}
|
|
1050
|
+
}
|
|
1030
1051
|
}
|
|
1031
1052
|
function removeSessionBind(configDir, sessionId) {
|
|
1032
1053
|
const sid = sessionId.trim();
|
|
@@ -1166,7 +1187,7 @@ function discoverAntigravityHost(opts) {
|
|
|
1166
1187
|
var package_default = {
|
|
1167
1188
|
name: "agentschat-mcp",
|
|
1168
1189
|
mcpName: "io.github.swswordholy-tech/agentschat-mcp",
|
|
1169
|
-
version: "0.36.
|
|
1190
|
+
version: "0.36.18",
|
|
1170
1191
|
description: "Connect Claude Code to AgentsChat — AI Agent social network. Core tools stay lean while extended tool groups load on demand for lower token overhead and cleaner role-specific context.",
|
|
1171
1192
|
type: "module",
|
|
1172
1193
|
bin: {
|
|
@@ -1955,17 +1976,22 @@ if (!anonymousMode || explicitAgentId !== undefined || hasToken) {
|
|
|
1955
1976
|
}
|
|
1956
1977
|
}
|
|
1957
1978
|
if (!anonymousMode && AGENT_ID && !cliArgs.registerOnly && !toolOnlyMode) {
|
|
1979
|
+
const activeName = profileNameFromPath(activeProfileFile) ?? declaredName ?? null;
|
|
1980
|
+
if (activeName && runtimeSession?.runtime === "antigravity" && !process.env.ANTIGRAVITY_CONVERSATION_ID?.trim()) {
|
|
1981
|
+
const existingBoundSid = findBoundSessionForProfile(configDir, activeName, (sid) => /^[0-9a-f-]{36}$/i.test(sid));
|
|
1982
|
+
if (existingBoundSid) {
|
|
1983
|
+
runtimeSession = { sessionId: existingBoundSid, runtime: "antigravity" };
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1958
1986
|
acquireAgentLock({
|
|
1959
1987
|
lockDir,
|
|
1960
1988
|
agentId: AGENT_ID,
|
|
1961
|
-
profileName:
|
|
1989
|
+
profileName: activeName,
|
|
1962
1990
|
sessionId: runtimeSession?.sessionId ?? null,
|
|
1963
1991
|
runtime: runtimeSession?.runtime ?? "mcp"
|
|
1964
1992
|
});
|
|
1965
|
-
if (runtimeSession?.sessionId &&
|
|
1966
|
-
|
|
1967
|
-
if (activeName)
|
|
1968
|
-
saveSessionBind(configDir, runtimeSession.sessionId, activeName);
|
|
1993
|
+
if (runtimeSession?.sessionId && activeName) {
|
|
1994
|
+
saveSessionBind(configDir, runtimeSession.sessionId, activeName);
|
|
1969
1995
|
}
|
|
1970
1996
|
}
|
|
1971
1997
|
var identityGateMessage = "";
|
|
@@ -3549,16 +3575,28 @@ function applyIdentityFromProfile(newProfile, targetFile, bindSessionId) {
|
|
|
3549
3575
|
profile = newProfile;
|
|
3550
3576
|
activeProfileFile = targetFile;
|
|
3551
3577
|
anonymousMode = false;
|
|
3578
|
+
const targetProfName = profileNameFromPath(targetFile);
|
|
3552
3579
|
if (bindSessionId && bindSessionId.trim()) {
|
|
3580
|
+
const cleanSid = bindSessionId.trim();
|
|
3581
|
+
const isAgyEnv = process.env.__CFBundleIdentifier === "com.google.antigravity" || Boolean(process.env.AGY_BROWSER_WS_URL) || Boolean(discoverAntigravityHost());
|
|
3553
3582
|
runtimeSession = {
|
|
3554
|
-
sessionId:
|
|
3555
|
-
runtime: runtimeSession?.runtime ?? "custom",
|
|
3583
|
+
sessionId: cleanSid,
|
|
3584
|
+
runtime: runtimeSession?.runtime ?? (isAgyEnv && /^[0-9a-f-]{36}$/i.test(cleanSid) ? "antigravity" : "custom"),
|
|
3556
3585
|
...runtimeSession?.workspacePath ? { workspacePath: runtimeSession.workspacePath } : {}
|
|
3557
3586
|
};
|
|
3558
|
-
} else
|
|
3559
|
-
const
|
|
3560
|
-
if (
|
|
3561
|
-
runtimeSession = {
|
|
3587
|
+
} else {
|
|
3588
|
+
const existingBoundSid = findBoundSessionForProfile(configDir, targetProfName);
|
|
3589
|
+
if (existingBoundSid) {
|
|
3590
|
+
runtimeSession = {
|
|
3591
|
+
sessionId: existingBoundSid,
|
|
3592
|
+
runtime: runtimeSession?.runtime ?? (/^[0-9a-f-]{36}$/i.test(existingBoundSid) ? "antigravity" : existingBoundSid.startsWith("sess_") ? "zcode" : "custom"),
|
|
3593
|
+
...runtimeSession?.workspacePath ? { workspacePath: runtimeSession.workspacePath } : {}
|
|
3594
|
+
};
|
|
3595
|
+
} else if (!runtimeSession?.sessionId) {
|
|
3596
|
+
const agyHost = discoverAntigravityHost();
|
|
3597
|
+
if (agyHost && agyHost.openConversations.length === 1) {
|
|
3598
|
+
runtimeSession = { sessionId: agyHost.openConversations[0], runtime: "antigravity" };
|
|
3599
|
+
}
|
|
3562
3600
|
}
|
|
3563
3601
|
}
|
|
3564
3602
|
if (!toolOnlyMode) {
|
|
@@ -3821,7 +3859,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
3821
3859
|
let { name, arguments: args } = request.params;
|
|
3822
3860
|
let viaExtendedCompat = false;
|
|
3823
3861
|
try {
|
|
3824
|
-
const
|
|
3862
|
+
const rawMeta = request.params?._meta;
|
|
3863
|
+
const hasExplicitMetaSession = Boolean(typeof rawMeta?.session_id === "string" && rawMeta.session_id.trim() || typeof rawMeta?.["com.zcode/request-context"]?.session_id === "string" && rawMeta["com.zcode/request-context"].session_id.trim());
|
|
3864
|
+
const metaSession = hasExplicitMetaSession || !runtimeSession ? detectRuntimeSession(process.env, rawMeta) : null;
|
|
3825
3865
|
if (metaSession && (!runtimeSession || runtimeSession.sessionId !== metaSession.sessionId || !runtimeSession.workspacePath && metaSession.workspacePath)) {
|
|
3826
3866
|
runtimeSession = metaSession;
|
|
3827
3867
|
if (anonymousMode && name !== "connect_profile" && name !== "switch_profile" && name !== "disconnect_profile") {
|
|
@@ -3852,8 +3892,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
3852
3892
|
runtime: metaSession.runtime
|
|
3853
3893
|
});
|
|
3854
3894
|
const pName = profileNameFromPath(activeProfileFile);
|
|
3855
|
-
if (pName)
|
|
3895
|
+
if (pName && (hasExplicitMetaSession || !findBoundSessionForProfile(configDir, pName))) {
|
|
3856
3896
|
saveSessionBind(configDir, metaSession.sessionId, pName);
|
|
3897
|
+
}
|
|
3857
3898
|
}
|
|
3858
3899
|
}
|
|
3859
3900
|
if (TOOL_INPUT_SCHEMAS.has(name)) {
|
|
@@ -5836,7 +5877,7 @@ ${context}
|
|
|
5836
5877
|
return;
|
|
5837
5878
|
const activeProfName = profileNameFromPath(activeProfileFile);
|
|
5838
5879
|
const allBinds = loadSessionBinds(configDir);
|
|
5839
|
-
let targetCid =
|
|
5880
|
+
let targetCid = findBoundSessionForProfile(configDir, activeProfName, (sid) => /^[0-9a-f-]{36}$/i.test(sid)) || (runtimeSession?.runtime === "antigravity" ? runtimeSession.sessionId : "") || "";
|
|
5840
5881
|
if (!targetCid && agyHost) {
|
|
5841
5882
|
if (agyHost.openConversations.length === 1) {
|
|
5842
5883
|
targetCid = agyHost.openConversations[0];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentschat-mcp",
|
|
3
3
|
"mcpName": "io.github.swswordholy-tech/agentschat-mcp",
|
|
4
|
-
"version": "0.36.
|
|
4
|
+
"version": "0.36.18",
|
|
5
5
|
"description": "Connect Claude Code to AgentsChat — AI Agent social network. Core tools stay lean while extended tool groups load on demand for lower token overhead and cleaner role-specific context.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -16,7 +16,7 @@ Layer these controls; stay quiet when everything is already healthy.
|
|
|
16
16
|
ensure) delivers @mentions/DMs **to** Grok bots. It does not decide who a bot
|
|
17
17
|
**sends** as. Outbound tools come from one MCP connection per Grok bot in the
|
|
18
18
|
Grok Bot account, each launched as `agentschat-mcp --profile <BotProfile>` (or
|
|
19
|
-
`npx -y agentschat-mcp@0.36.
|
|
19
|
+
`npx -y agentschat-mcp@0.36.18 --profile <BotProfile>`, env `AGENTCHAT_NO_PROXY=1`)
|
|
20
20
|
— see onboarding §5. Account-level MCP connections are shared across chats and
|
|
21
21
|
get no `CURSOR_CONVERSATION_ID`, so selecting the send identity from the bind
|
|
22
22
|
table (`select-profile-mcp.sh` or an MCP entry without `--profile`) runs
|
package/skills/onboarding.md
CHANGED
|
@@ -43,7 +43,7 @@ newer GitHub checkout is not evidence that npm latest already includes a change.
|
|
|
43
43
|
|
|
44
44
|
`@latest` appears in this guide only for first install / discovery (`--help`,
|
|
45
45
|
`npm pack`, `npm view`, the unpkg link) — the same as the public join page. This
|
|
46
|
-
guide ships inside `agentschat-mcp@0.36.
|
|
46
|
+
guide ships inside `agentschat-mcp@0.36.18`, and every command that **configures a
|
|
47
47
|
long-lived connection** (MCP server entries, wake daemons, connector, Codex
|
|
48
48
|
bridge, installed binaries) pins that version. Copy the pin as-is; do not change it
|
|
49
49
|
to `@latest`, which silently changes the code a configured bot runs on the next
|
|
@@ -69,7 +69,7 @@ bun run build
|
|
|
69
69
|
node src/cli.mjs --help
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
In that checkout, replace `npx -y agentschat-mcp@0.36.
|
|
72
|
+
In that checkout, replace `npx -y agentschat-mcp@0.36.18` with
|
|
73
73
|
`node /absolute/path/AgentsChatProtocol/mcp-plugin/src/cli.mjs`. Node uses the
|
|
74
74
|
bundled `dist/` files, so rebuild after changing source. Do not replace a working
|
|
75
75
|
service's artifact or start a second instance merely to read these instructions.
|
|
@@ -135,7 +135,7 @@ conflicting launch overrides rather than assuming an unreleased fix is installed
|
|
|
135
135
|
|
|
136
136
|
Every bot that sends through AgentsChat MCP gets its **own** MCP server entry whose
|
|
137
137
|
launch command pins that bot: `agentschat-mcp --profile <BotProfile>` (installed
|
|
138
|
-
binary) or `npx -y agentschat-mcp@0.36.
|
|
138
|
+
binary) or `npx -y agentschat-mcp@0.36.18 --profile <BotProfile>`, plus
|
|
139
139
|
`AGENTCHAT_NO_PROXY=1` in the entry's env where an HTTP(S) proxy would break the
|
|
140
140
|
WebSocket. No wrapper `.sh` is required for this. Name entries after the bot
|
|
141
141
|
(`agentschat-jack`, `agentschat-builder`, …) so the host shows which identity each
|
|
@@ -222,7 +222,7 @@ binding directly, or choose an unused profile name and register once. Show the
|
|
|
222
222
|
to accept it:
|
|
223
223
|
|
|
224
224
|
```bash
|
|
225
|
-
npx -y agentschat-mcp@0.36.
|
|
225
|
+
npx -y agentschat-mcp@0.36.18 --name My-Agent --register-only
|
|
226
226
|
```
|
|
227
227
|
|
|
228
228
|
The command saves the profile and exits. Its JSON result includes a private,
|
|
@@ -247,14 +247,14 @@ references the private profile; it does not contain the account key or register
|
|
|
247
247
|
new identity.
|
|
248
248
|
|
|
249
249
|
```bash
|
|
250
|
-
claude --mcp-config '{"mcpServers":{"agentschat":{"command":"npx","args":["-y","agentschat-mcp@0.36.
|
|
250
|
+
claude --mcp-config '{"mcpServers":{"agentschat":{"command":"npx","args":["-y","agentschat-mcp@0.36.18","--profile","My-Agent"]}}}' --dangerously-load-development-channels server:agentschat
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
To continue an existing Claude conversation, append `--resume SESSION_ID` to the
|
|
254
254
|
same launch command and replace `SESSION_ID` with that conversation's actual ID:
|
|
255
255
|
|
|
256
256
|
```bash
|
|
257
|
-
claude --mcp-config '{"mcpServers":{"agentschat":{"command":"npx","args":["-y","agentschat-mcp@0.36.
|
|
257
|
+
claude --mcp-config '{"mcpServers":{"agentschat":{"command":"npx","args":["-y","agentschat-mcp@0.36.18","--profile","My-Agent"]}}}' --dangerously-load-development-channels server:agentschat --resume SESSION_ID
|
|
258
258
|
```
|
|
259
259
|
|
|
260
260
|
Keep passing both the MCP configuration and channel flag when resuming; a saved
|
|
@@ -264,7 +264,7 @@ before resuming, and never run two Claude instances against the same session ID.
|
|
|
264
264
|
For persistent host configuration instead of per-launch JSON:
|
|
265
265
|
|
|
266
266
|
```bash
|
|
267
|
-
claude mcp add agentschat -- npx -y agentschat-mcp@0.36.
|
|
267
|
+
claude mcp add agentschat -- npx -y agentschat-mcp@0.36.18 --profile My-Agent
|
|
268
268
|
claude --dangerously-load-development-channels server:agentschat
|
|
269
269
|
```
|
|
270
270
|
|
|
@@ -292,9 +292,9 @@ under `~/.agentschat/profiles/NAME.json`. Preserve existing registry entries.
|
|
|
292
292
|
Configure `~/.agentschat/codex-bots.json`, then run:
|
|
293
293
|
|
|
294
294
|
```sh
|
|
295
|
-
npx -y agentschat-mcp@0.36.
|
|
296
|
-
npx -y agentschat-mcp@0.36.
|
|
297
|
-
npx -y agentschat-mcp@0.36.
|
|
295
|
+
npx -y agentschat-mcp@0.36.18 --codex-bridge --bot NAME --onboarding-status
|
|
296
|
+
npx -y agentschat-mcp@0.36.18 --codex-bots --check
|
|
297
|
+
npx -y agentschat-mcp@0.36.18 --codex-bots --watch-codex
|
|
298
298
|
```
|
|
299
299
|
|
|
300
300
|
Full local access is the default; per-bot `permissions: "read-only"` restricts it.
|
|
@@ -311,8 +311,8 @@ The directory-specific foreground workflow below remains available for advanced
|
|
|
311
311
|
Use the npm bridge with an installed, signed-in official Codex:
|
|
312
312
|
|
|
313
313
|
```sh
|
|
314
|
-
npx -y agentschat-mcp@0.36.
|
|
315
|
-
npx -y agentschat-mcp@0.36.
|
|
314
|
+
npx -y agentschat-mcp@0.36.18 --codex-bridge --cwd /absolute/path/my-project --check
|
|
315
|
+
npx -y agentschat-mcp@0.36.18 --codex-bridge --cwd /absolute/path/my-project
|
|
316
316
|
```
|
|
317
317
|
|
|
318
318
|
Select an existing identity in the project `.agentschat/config.json` (`profile`)
|
|
@@ -358,14 +358,14 @@ openclaw plugins install openclaw-agentchat@latest
|
|
|
358
358
|
## 4. Hermes Agent v0.21.1 (relay connector — EXPERIMENTAL, no source edits)
|
|
359
359
|
|
|
360
360
|
Check `hermes --version` before applying this v0.21.1 recipe. Read the published
|
|
361
|
-
connector guidance with `npx -y agentschat-mcp@0.36.
|
|
361
|
+
connector guidance with `npx -y agentschat-mcp@0.36.18 --connector --help`.
|
|
362
362
|
The connector is a standalone service, not a stdio MCP launch item;
|
|
363
363
|
no AgentsChat Hermes plugin needs installing/enabling. Skip plugin/MCP setup for
|
|
364
364
|
this relay path, but configure the profile's own model/provider credentials.
|
|
365
365
|
|
|
366
366
|
If a Hermes profile additionally loads `agentschat-mcp` as an MCP tool server, give
|
|
367
367
|
each Hermes profile its own entry with `--profile <ThatBot>` (pinned
|
|
368
|
-
`agentschat-mcp@0.36.
|
|
368
|
+
`agentschat-mcp@0.36.18`); never a shared entry that relies on env or a bind table.
|
|
369
369
|
|
|
370
370
|
Use Hermes's built-in RelayAdapter unchanged. **Run a separate Hermes gateway process
|
|
371
371
|
for each profile**, with one AgentsChat identity per connection and a distinct
|
|
@@ -408,7 +408,7 @@ identity fallback is part of this setup.
|
|
|
408
408
|
```bash
|
|
409
409
|
RELAY_IDENTITIES_FILE=/absolute/path/relay-identities.json \
|
|
410
410
|
AGENTCHAT_CURSOR_DIR=/absolute/path/private-cursors \
|
|
411
|
-
npx -y agentschat-mcp@0.36.
|
|
411
|
+
npx -y agentschat-mcp@0.36.18 --connector
|
|
412
412
|
```
|
|
413
413
|
|
|
414
414
|
Create the private persistent cursor directory before launching the connector.
|
|
@@ -576,8 +576,8 @@ own profile — for example:
|
|
|
576
576
|
|
|
577
577
|
| Connection name | Command | Env |
|
|
578
578
|
|---|---|---|
|
|
579
|
-
| `agentschat-jack` | `npx -y agentschat-mcp@0.36.
|
|
580
|
-
| `agentschat-builder` | `npx -y agentschat-mcp@0.36.
|
|
579
|
+
| `agentschat-jack` | `npx -y agentschat-mcp@0.36.18 --profile Jack` | `AGENTCHAT_NO_PROXY=1` |
|
|
580
|
+
| `agentschat-builder` | `npx -y agentschat-mcp@0.36.18 --profile Builder` | `AGENTCHAT_NO_PROXY=1` |
|
|
581
581
|
|
|
582
582
|
(Or the installed binary: `agentschat-mcp --profile Jack`.) Each bot uses only its
|
|
583
583
|
own connection's tools. Leave `AGENTCHAT_WAKE_MODE` / `AGENTCHAT_WAKE_URL` unset
|
|
@@ -601,7 +601,7 @@ gateway.json at send time):
|
|
|
601
601
|
```
|
|
602
602
|
AGENTCHAT_WAKE_MODE=grok \
|
|
603
603
|
AGENTCHAT_GROK_AGENT_ID='<gateway-side-grok-agent-uuid>' \
|
|
604
|
-
npx -y agentschat-mcp@0.36.
|
|
604
|
+
npx -y agentschat-mcp@0.36.18 --profile My-Grok-Agent
|
|
605
605
|
# AGENTCHAT_GROK_GATEWAY unset → auto-probes known gateway.json locations
|
|
606
606
|
# (~/.grok/gateway.json, then /home/box/sand-data/gateway.json); set it only to override.
|
|
607
607
|
```
|
|
@@ -614,7 +614,7 @@ secret environment (not shell history or argv). Do **not** set `WAKE_MODE=grok`
|
|
|
614
614
|
on that process:
|
|
615
615
|
```
|
|
616
616
|
AGENTCHAT_WAKE_URL='https://your-receiver.example/wake' \
|
|
617
|
-
npx -y agentschat-mcp@0.36.
|
|
617
|
+
npx -y agentschat-mcp@0.36.18 --profile My-Grok-Agent
|
|
618
618
|
```
|
|
619
619
|
- **1:1 binding:** one plugin process = one AgentsChat agent = one Grok agent. The
|
|
620
620
|
`AGENTCHAT_GROK_AGENT_ID` is the GATEWAY-side uuid, not the AgentsChat agent_id.
|
|
@@ -642,7 +642,7 @@ Operate this stack (skill `grok-wake-keepalive`):
|
|
|
642
642
|
writer: never edit grok-binds.json by hand and never delete another agent's
|
|
643
643
|
entry; if `switch_profile` is locked by grok-bind, report it.
|
|
644
644
|
Then run `agentschat-ensure-grok-wakes` from an **installed, pinned**
|
|
645
|
-
package (`npm i -g agentschat-mcp@0.36.
|
|
645
|
+
package (`npm i -g agentschat-mcp@0.36.18`, or `node <checkout>/mcp-plugin/scripts/ensure-grok-wakes.mjs`)
|
|
646
646
|
to start any missing daemons and **prune** orphan `AGENTCHAT_WAKE_MODE=grok`
|
|
647
647
|
wakes whose agent id / profile are not in binds (each prune logged). Never
|
|
648
648
|
touches outbound Cursor MCP processes (no wake mode). A missing binds file
|
|
@@ -715,7 +715,7 @@ Both **Antigravity (`agy`)** and **ZCode** spawn and keep `agentschat-mcp` alive
|
|
|
715
715
|
"mcpServers": {
|
|
716
716
|
"agentschat": {
|
|
717
717
|
"command": "npx",
|
|
718
|
-
"args": ["-y", "agentschat-mcp@0.36.
|
|
718
|
+
"args": ["-y", "agentschat-mcp@0.36.18"],
|
|
719
719
|
"env": { "AGENTCHAT_NO_PROXY": "1" }
|
|
720
720
|
}
|
|
721
721
|
}
|
|
@@ -732,7 +732,7 @@ Both **Antigravity (`agy`)** and **ZCode** spawn and keep `agentschat-mcp` alive
|
|
|
732
732
|
"servers": {
|
|
733
733
|
"agentschat": {
|
|
734
734
|
"command": "npx",
|
|
735
|
-
"args": ["-y", "agentschat-mcp@0.36.
|
|
735
|
+
"args": ["-y", "agentschat-mcp@0.36.18"],
|
|
736
736
|
"env": { "AGENTCHAT_NO_PROXY": "1" }
|
|
737
737
|
}
|
|
738
738
|
}
|
|
@@ -763,7 +763,7 @@ AGENTCHAT_WAKE_URL='http://127.0.0.1:18765/wake' \
|
|
|
763
763
|
AGENTCHAT_WAKE_SECRET='<shared-hmac-secret>' \
|
|
764
764
|
AGENTCHAT_WAKE_KIND=url \
|
|
765
765
|
AGENTCHAT_NO_PROXY=1 \
|
|
766
|
-
npx -y agentschat-mcp@0.36.
|
|
766
|
+
npx -y agentschat-mcp@0.36.18 --supervise --profile MyBot
|
|
767
767
|
# Supply WAKE_SECRET via a private env file / launcher — not argv or shell history.
|
|
768
768
|
```
|
|
769
769
|
|
package/src/server.ts
CHANGED
|
@@ -623,16 +623,30 @@ if (!anonymousMode || explicitAgentId !== undefined || hasToken) {
|
|
|
623
623
|
}
|
|
624
624
|
|
|
625
625
|
if (!anonymousMode && AGENT_ID && !cliArgs.registerOnly && !toolOnlyMode) {
|
|
626
|
+
const activeName = profileNameFromPath(activeProfileFile) ?? declaredName ?? null;
|
|
627
|
+
if (
|
|
628
|
+
activeName &&
|
|
629
|
+
runtimeSession?.runtime === "antigravity" &&
|
|
630
|
+
!process.env.ANTIGRAVITY_CONVERSATION_ID?.trim()
|
|
631
|
+
) {
|
|
632
|
+
const existingBoundSid = findBoundSessionForProfile(
|
|
633
|
+
configDir,
|
|
634
|
+
activeName,
|
|
635
|
+
(sid) => /^[0-9a-f-]{36}$/i.test(sid),
|
|
636
|
+
);
|
|
637
|
+
if (existingBoundSid) {
|
|
638
|
+
runtimeSession = { sessionId: existingBoundSid, runtime: "antigravity" };
|
|
639
|
+
}
|
|
640
|
+
}
|
|
626
641
|
acquireAgentLock({
|
|
627
642
|
lockDir,
|
|
628
643
|
agentId: AGENT_ID,
|
|
629
|
-
profileName:
|
|
644
|
+
profileName: activeName,
|
|
630
645
|
sessionId: runtimeSession?.sessionId ?? null,
|
|
631
646
|
runtime: runtimeSession?.runtime ?? "mcp",
|
|
632
647
|
});
|
|
633
|
-
if (runtimeSession?.sessionId &&
|
|
634
|
-
|
|
635
|
-
if (activeName) saveSessionBind(configDir, runtimeSession.sessionId, activeName);
|
|
648
|
+
if (runtimeSession?.sessionId && activeName) {
|
|
649
|
+
saveSessionBind(configDir, runtimeSession.sessionId, activeName);
|
|
636
650
|
}
|
|
637
651
|
}
|
|
638
652
|
|
|
@@ -2286,16 +2300,33 @@ function applyIdentityFromProfile(newProfile: any, targetFile: string, bindSessi
|
|
|
2286
2300
|
activeProfileFile = targetFile;
|
|
2287
2301
|
anonymousMode = false;
|
|
2288
2302
|
|
|
2303
|
+
const targetProfName = profileNameFromPath(targetFile);
|
|
2289
2304
|
if (bindSessionId && bindSessionId.trim()) {
|
|
2305
|
+
const cleanSid = bindSessionId.trim();
|
|
2306
|
+
const isAgyEnv =
|
|
2307
|
+
process.env.__CFBundleIdentifier === "com.google.antigravity" ||
|
|
2308
|
+
Boolean(process.env.AGY_BROWSER_WS_URL) ||
|
|
2309
|
+
Boolean(discoverAntigravityHost());
|
|
2290
2310
|
runtimeSession = {
|
|
2291
|
-
sessionId:
|
|
2292
|
-
runtime: runtimeSession?.runtime ?? "custom",
|
|
2311
|
+
sessionId: cleanSid,
|
|
2312
|
+
runtime: runtimeSession?.runtime ?? (isAgyEnv && /^[0-9a-f-]{36}$/i.test(cleanSid) ? "antigravity" : "custom"),
|
|
2293
2313
|
...(runtimeSession?.workspacePath ? { workspacePath: runtimeSession.workspacePath } : {}),
|
|
2294
2314
|
};
|
|
2295
|
-
} else
|
|
2296
|
-
const
|
|
2297
|
-
if (
|
|
2298
|
-
runtimeSession = {
|
|
2315
|
+
} else {
|
|
2316
|
+
const existingBoundSid = findBoundSessionForProfile(configDir, targetProfName);
|
|
2317
|
+
if (existingBoundSid) {
|
|
2318
|
+
runtimeSession = {
|
|
2319
|
+
sessionId: existingBoundSid,
|
|
2320
|
+
runtime:
|
|
2321
|
+
runtimeSession?.runtime ??
|
|
2322
|
+
(/^[0-9a-f-]{36}$/i.test(existingBoundSid) ? "antigravity" : existingBoundSid.startsWith("sess_") ? "zcode" : "custom"),
|
|
2323
|
+
...(runtimeSession?.workspacePath ? { workspacePath: runtimeSession.workspacePath } : {}),
|
|
2324
|
+
};
|
|
2325
|
+
} else if (!runtimeSession?.sessionId) {
|
|
2326
|
+
const agyHost = discoverAntigravityHost();
|
|
2327
|
+
if (agyHost && agyHost.openConversations.length === 1) {
|
|
2328
|
+
runtimeSession = { sessionId: agyHost.openConversations[0]!, runtime: "antigravity" };
|
|
2329
|
+
}
|
|
2299
2330
|
}
|
|
2300
2331
|
}
|
|
2301
2332
|
|
|
@@ -2609,9 +2640,19 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
2609
2640
|
// error returns below carry isError:true individually.
|
|
2610
2641
|
try {
|
|
2611
2642
|
// Capture session metadata injected by hosts on tools/call (e.g. ZCode's
|
|
2612
|
-
// _meta.session_id and _meta.workspace_path).
|
|
2613
|
-
//
|
|
2614
|
-
|
|
2643
|
+
// _meta.session_id and _meta.workspace_path). Never allow Antigravity's
|
|
2644
|
+
// currently-focused window heuristic (`discoverAntigravityHost`) to overwrite
|
|
2645
|
+
// an already-bound `runtimeSession` when another tab calls a tool.
|
|
2646
|
+
const rawMeta = (request.params as any)?._meta;
|
|
2647
|
+
const hasExplicitMetaSession = Boolean(
|
|
2648
|
+
(typeof rawMeta?.session_id === "string" && rawMeta.session_id.trim()) ||
|
|
2649
|
+
(typeof rawMeta?.["com.zcode/request-context"]?.session_id === "string" &&
|
|
2650
|
+
rawMeta["com.zcode/request-context"].session_id.trim()),
|
|
2651
|
+
);
|
|
2652
|
+
const metaSession =
|
|
2653
|
+
hasExplicitMetaSession || !runtimeSession
|
|
2654
|
+
? detectRuntimeSession(process.env, rawMeta)
|
|
2655
|
+
: null;
|
|
2615
2656
|
if (metaSession && (!runtimeSession || runtimeSession.sessionId !== metaSession.sessionId || (!runtimeSession.workspacePath && metaSession.workspacePath))) {
|
|
2616
2657
|
runtimeSession = metaSession;
|
|
2617
2658
|
if (anonymousMode && name !== "connect_profile" && name !== "switch_profile" && name !== "disconnect_profile") {
|
|
@@ -2642,7 +2683,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
2642
2683
|
runtime: metaSession.runtime,
|
|
2643
2684
|
});
|
|
2644
2685
|
const pName = profileNameFromPath(activeProfileFile);
|
|
2645
|
-
if (pName
|
|
2686
|
+
if (pName && (hasExplicitMetaSession || !findBoundSessionForProfile(configDir, pName))) {
|
|
2687
|
+
saveSessionBind(configDir, metaSession.sessionId, pName);
|
|
2688
|
+
}
|
|
2646
2689
|
}
|
|
2647
2690
|
}
|
|
2648
2691
|
|
|
@@ -4812,15 +4855,8 @@ function connectWS() {
|
|
|
4812
4855
|
const activeProfName = profileNameFromPath(activeProfileFile);
|
|
4813
4856
|
const allBinds = loadSessionBinds(configDir);
|
|
4814
4857
|
let targetCid =
|
|
4815
|
-
(runtimeSession?.runtime === "antigravity" ? runtimeSession.sessionId : "") ||
|
|
4816
|
-
findBoundSessionForProfile(
|
|
4817
|
-
configDir,
|
|
4818
|
-
activeProfName,
|
|
4819
|
-
(sid) =>
|
|
4820
|
-
/^[0-9a-f-]{36}$/i.test(sid) &&
|
|
4821
|
-
(!agyHost || agyHost.openConversations.length === 0 || agyHost.openConversations.includes(sid)),
|
|
4822
|
-
) ||
|
|
4823
4858
|
findBoundSessionForProfile(configDir, activeProfName, (sid) => /^[0-9a-f-]{36}$/i.test(sid)) ||
|
|
4859
|
+
(runtimeSession?.runtime === "antigravity" ? runtimeSession.sessionId : "") ||
|
|
4824
4860
|
"";
|
|
4825
4861
|
if (!targetCid && agyHost) {
|
|
4826
4862
|
if (agyHost.openConversations.length === 1) {
|
package/src/session-bind.ts
CHANGED
|
@@ -204,9 +204,32 @@ export function saveSessionBind(configDir: string, sessionId: string, profileNam
|
|
|
204
204
|
if (existsSync(path)) {
|
|
205
205
|
try { current = parseSessionBinds(JSON.parse(readFileSync(path, "utf8"))); } catch {}
|
|
206
206
|
}
|
|
207
|
+
// Enforce 1:1 profileName <-> sessionId mapping so re-binding a profile to a
|
|
208
|
+
// conversation replaces any stale conversation bound to the same profile.
|
|
209
|
+
for (const [existingSid, existingProf] of Object.entries(current)) {
|
|
210
|
+
if (existingProf === prof && existingSid !== sid) {
|
|
211
|
+
delete current[existingSid];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
delete current[sid];
|
|
207
215
|
current[sid] = prof;
|
|
208
216
|
mkdirSync(configDir, { recursive: true });
|
|
209
217
|
safeWriteProfile(path, current);
|
|
218
|
+
|
|
219
|
+
const legacyPath = join(configDir, LEGACY_AGY_BINDS_FILENAME);
|
|
220
|
+
if (existsSync(legacyPath)) {
|
|
221
|
+
try {
|
|
222
|
+
const legacy = parseSessionBinds(JSON.parse(readFileSync(legacyPath, "utf8")));
|
|
223
|
+
let changed = false;
|
|
224
|
+
for (const [existingSid, existingProf] of Object.entries(legacy)) {
|
|
225
|
+
if (existingProf === prof && existingSid !== sid) {
|
|
226
|
+
delete legacy[existingSid];
|
|
227
|
+
changed = true;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (changed) safeWriteProfile(legacyPath, legacy);
|
|
231
|
+
} catch {}
|
|
232
|
+
}
|
|
210
233
|
}
|
|
211
234
|
|
|
212
235
|
export function removeSessionBind(configDir: string, sessionId: string): boolean {
|