agentschat-mcp 0.36.26 → 0.36.27

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/dsh/README.md CHANGED
@@ -82,6 +82,6 @@ shapes, and the reload trap.
82
82
 
83
83
  ## 4. Submitting to the DSH Plugin Market (`dshmarket` / `awesome-dsh-plugin`)
84
84
 
85
- - The source code stays in this repository (`AgentsChatProtocol/mcp-plugin`) and publishes to npm as `agentschat-mcp`.
85
+ - The source code stays in this repository (`AgentsChat/mcp-plugin`) and publishes to npm as `agentschat-mcp`.
86
86
  - To list or update the plugin in DeepSeek Harness's built-in **Plugin Market** (`dshmarket` / `dshmarket.com`), open a PR adding `agentschat-mcp` to [`https://github.com/awesome-dsh-plugin/awesome-dsh-plugin`](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) (`https://awesome-dsh-plugin.com/plugins.json`).
87
87
  - You can also index the package on [`https://dsh-plugin.org`](https://dsh-plugin.org) (by tagging the GitHub repo with `dsh-plugin`) and [`https://dsh.so`](https://dsh.so).
@@ -87,8 +87,8 @@ const MAX_PENDING = 100;
87
87
  export const MAX_HTTP_BODY_BYTES = 64 * 1024;
88
88
  const WAKE_PATH = '/agentschat/wake';
89
89
  const FORBIDDEN_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
90
- const LOCAL_HTTP_ORIGIN_RE = /^https?:\/\/(?:127\.0\.0\.1|localhost|\[::1\])(?::(\d{1,5}))?$/i;
91
- const LOCAL_SCHEME_ORIGIN_RE = /^(?:app|tauri|dsh):\/\/[a-z0-9._-]+(?::(\d{1,5}))?$/i;
90
+ const LOCAL_HTTP_ORIGIN_RE = /^https?:\/\/(?:127\.0\.0\.1|localhost|(?:tauri|dsh|dsh-app)\.localhost|\[::1\])(?::(\d{1,5}))?$/i;
91
+ const LOCAL_SCHEME_ORIGIN_RE = /^(?:app|tauri|dsh|dsh-app):\/\/[a-z0-9._-]+(?::(\d{1,5}))?$/i;
92
92
  let inboundTmpSeq = 0;
93
93
 
94
94
  /**
@@ -219,7 +219,7 @@ function scrubSecrets(text) {
219
219
  * is no way to tell which version is live from the outside, which is how a
220
220
  * "fixed" build once delivered into a busy Session. `/health` reports it.
221
221
  */
222
- const BUILD = 'inbound/2026-10-29.21-bundled';
222
+ const BUILD = 'inbound/2026-11-16.22-rc3-compat';
223
223
  /** Producer-owned source kind; a bare `plugin` wrapper is refused by session format v4. */
224
224
  const SOURCE_KIND = 'plugin:agentschat-inbound';
225
225
  /** Poll interval while wakes wait for a root agent to finish its turn. */
@@ -520,7 +520,11 @@ export function apply(ctx, config = {}) {
520
520
  }
521
521
  })();
522
522
  const mcpBin = config.mcpBin ?? process.env.AGENTSCHAT_DSH_BRIDGE_BIN ?? defaultBundledMcpBin;
523
- const nodeBin = config.nodeBin ?? process.env.DSH_NODE_BIN ?? 'node';
523
+ const nodeBin =
524
+ config.nodeBin ??
525
+ process.env.DSH_NODE_BIN ??
526
+ process.env.DSH_NODE ??
527
+ (process.versions?.electron ? process.execPath : 'node');
524
528
  const channels = Array.isArray(config.channels) && config.channels.length > 0 ? config.channels : ['welcome'];
525
529
  const rawRetryMs = Number(config.retryMs ?? DEFAULT_RETRY_MS);
526
530
  const retryMs = Number.isFinite(rawRetryMs) && rawRetryMs >= 10 ? Math.min(Math.floor(rawRetryMs), 300_000) : DEFAULT_RETRY_MS;
@@ -538,6 +542,30 @@ export function apply(ctx, config = {}) {
538
542
  let restartTimer;
539
543
  let consecutiveFailures = 0;
540
544
 
545
+ /**
546
+ * DSH >= 0.2.1-rc.3 removed `AgentRegistry.roots()` in favor of `list()` and
547
+ * marks delegated child sessions via `session.header.origin === 'subagent'`
548
+ * or `delegationDepth > 0`.
549
+ */
550
+ function isOrdinaryRootAgent(agent) {
551
+ if (!agent || typeof agent !== 'object') return false;
552
+ const header = agent.session?.header;
553
+ if (header && typeof header === 'object') {
554
+ if (header.origin === 'subagent') return false;
555
+ if (typeof header.delegationDepth === 'number' && header.delegationDepth > 0) return false;
556
+ }
557
+ return true;
558
+ }
559
+
560
+ function isArchivedSession(sessionId) {
561
+ try {
562
+ const archived = ctx.get('workspaceRegistry')?.archivedSessionIds;
563
+ return Array.isArray(archived) && archived.includes(sessionId);
564
+ } catch {
565
+ return false;
566
+ }
567
+ }
568
+
541
569
  /** Live root agents, oldest first, with the status the gate reads. */
542
570
  function rootStatuses() {
543
571
  return liveRoots().map((agent) => {
@@ -551,7 +579,7 @@ export function apply(ctx, config = {}) {
551
579
  });
552
580
  }
553
581
 
554
- /** Live root agents, oldest first. */
582
+ /** Live root agents, oldest first (compatible with both DSH 0.1.x `roots()` and 0.2.1-rc.3+ `list()`). */
555
583
  function liveRoots() {
556
584
  let agents;
557
585
  try {
@@ -562,13 +590,51 @@ export function apply(ctx, config = {}) {
562
590
  }
563
591
  if (agents === undefined || agents === null) return [];
564
592
  try {
565
- return agents.roots();
593
+ if (typeof agents.roots === 'function') {
594
+ return agents.roots();
595
+ }
596
+ if (typeof agents.list === 'function') {
597
+ return agents.list().filter(isOrdinaryRootAgent);
598
+ }
599
+ log('cannot list root agents: neither agents.roots() nor agents.list() is available');
600
+ return [];
566
601
  } catch (error) {
567
602
  log(`cannot list root agents: ${error?.message ?? error}`);
568
603
  return [];
569
604
  }
570
605
  }
571
606
 
607
+ /**
608
+ * Resolve a bound session to its live Agent, activating a cold persisted
609
+ * session through `sessionController.resolveAgent()` on DSH >= 0.2.1-rc.3
610
+ * (same activation seam `@deepseek-ai/dsh-schedule` uses).
611
+ */
612
+ async function resolveBoundTargetAgent(wanted) {
613
+ const live = liveRoots().find((agent) => agent.id === wanted);
614
+ if (live !== undefined) return live;
615
+ if (isArchivedSession(wanted)) return undefined;
616
+ let sessionController;
617
+ try {
618
+ sessionController = ctx.get('sessionController');
619
+ } catch {
620
+ return undefined;
621
+ }
622
+ if (sessionController && typeof sessionController.resolveAgent === 'function') {
623
+ const outcome = await settleWithin(
624
+ Promise.resolve().then(() => sessionController.resolveAgent(wanted)),
625
+ 10_000,
626
+ );
627
+ if (outcome.timedOut === true) {
628
+ log(`WARNING: session activation for ${wanted} timed out after 10000ms`);
629
+ return undefined;
630
+ }
631
+ if (outcome.ok === true && outcome.value && typeof outcome.value === 'object' && !('error' in outcome.value) && outcome.value.agent) {
632
+ return isOrdinaryRootAgent(outcome.value.agent) ? outcome.value.agent : undefined;
633
+ }
634
+ }
635
+ return undefined;
636
+ }
637
+
572
638
  /** Wake deliveries waiting for their bound session to go idle, oldest first. */
573
639
  const pending = [];
574
640
  let retryTimer;
@@ -597,7 +663,7 @@ export function apply(ctx, config = {}) {
597
663
  log(`wake ${id} dropped: identity is unbound (bind a session in the identity chip to receive it here)`);
598
664
  return 'dropped';
599
665
  }
600
- const target = liveRoots().find((agent) => agent.id === wanted);
666
+ const target = await resolveBoundTargetAgent(wanted);
601
667
  if (target === undefined) {
602
668
  log(`wake ${id} dropped: bound session ${wanted} is not live (bind the identity to an open session)`);
603
669
  return 'dropped';
@@ -1113,15 +1179,22 @@ export function apply(ctx, config = {}) {
1113
1179
  // Delivery is bound-only, so the useful answer is per binding, not "the
1114
1180
  // newest idle root".
1115
1181
  const byId = new Map(liveRoots().map((agent) => [agent.id, agent]));
1182
+ let hasActivator = false;
1183
+ try {
1184
+ hasActivator = typeof ctx.get('sessionController')?.resolveAgent === 'function';
1185
+ } catch {}
1116
1186
  const bound = Object.entries(readBinds()).map(([sessionId, profileName]) => {
1117
1187
  const agent = byId.get(sessionId);
1188
+ const canActivate = agent === undefined && hasActivator && !isArchivedSession(sessionId);
1118
1189
  return {
1119
1190
  sessionId,
1120
1191
  profile: profileName,
1121
- status: agent === undefined ? 'missing' : agent.status,
1192
+ status: agent === undefined ? (canActivate ? 'cold' : 'missing') : agent.status,
1122
1193
  decision:
1123
1194
  agent === undefined
1124
- ? 'drop'
1195
+ ? canActivate
1196
+ ? 'activate'
1197
+ : 'drop'
1125
1198
  : agent.status === 'idle'
1126
1199
  ? 'deliver'
1127
1200
  : typeof agent.steer === 'function'
@@ -1200,6 +1273,7 @@ export function apply(ctx, config = {}) {
1200
1273
  for (const channel of channels) args.push('--channel', channel);
1201
1274
  const env = {
1202
1275
  ...process.env,
1276
+ ...(process.versions?.electron && nodeBin === process.execPath ? { ELECTRON_RUN_AS_NODE: '1' } : {}),
1203
1277
  DSH_WAKE_URL: `http://127.0.0.1:${boundPort}${WAKE_PATH}`,
1204
1278
  DSH_WAKE_SECRET: secret,
1205
1279
  DSH_WAKE_QUEUE: queuePath,
@@ -1103,16 +1103,200 @@ test("wake validates the fallback WebSocket URL when the primary identity config
1103
1103
  }
1104
1104
  });
1105
1105
 
1106
- test("configured default channels reject prototype keys before listen or wake connects", async () => {
1107
- await withDshIdentity(async () => {
1108
- const connect = spyOn(MuseAgentChatClient.prototype, "connect").mockRejectedValue(new Error("unexpected connect"));
1106
+ test("configured default channels reject prototype keys before listen or wake connects", async () => {
1107
+ await withDshIdentity(async () => {
1108
+ const connect = spyOn(MuseAgentChatClient.prototype, "connect").mockRejectedValue(new Error("unexpected connect"));
1109
+ try {
1110
+ for (const channel of ["constructor", "__proto__", "toString", "bad/id", "bad\\id", "bad\x7fid"]) {
1111
+ process.env.AGENTCHAT_CHANNEL_ID = channel;
1112
+ await expect(main(["--listen"])).rejects.toThrow(/channel id/);
1113
+ await expect(main(["--wake"])).rejects.toThrow(/channel id/);
1114
+ }
1115
+ expect(connect).not.toHaveBeenCalled();
1116
+ } finally { connect.mockRestore(); }
1117
+ });
1118
+ });
1119
+
1120
+ test("DSH 0.2.2-rc.3 compat: cordis.patch.yml disabled expressions never self-recurse when entry is already in loader.entries()", () => {
1121
+ const patchYaml = readFileSync(join(ROOT, "cordis.patch.yml"), "utf8");
1122
+ const exprMatches = [...patchYaml.matchAll(/disabled:\s*!!js\s+"([^"]+)"/g)].map((m) => m[1]!);
1123
+ expect(exprMatches).toHaveLength(2);
1124
+ const [mcpDisabledExpr, bundleDisabledExpr] = exprMatches;
1125
+
1126
+ const makeEntry = (id: string, name: string, expr?: string, config?: Record<string, unknown>, rawDisabled?: boolean) => {
1127
+ const entryCtx: any = {};
1128
+ const entry: any = {
1129
+ ctx: entryCtx,
1130
+ options: {
1131
+ id,
1132
+ name,
1133
+ ...(config ? { config } : {}),
1134
+ ...(rawDisabled !== undefined ? { disabled: rawDisabled } : expr ? { disabled: { __jsExpr: expr } } : {}),
1135
+ },
1136
+ get disabled(): boolean {
1137
+ if (typeof this.options.disabled === "boolean") return this.options.disabled;
1138
+ if (this.options.disabled?.__jsExpr) {
1139
+ return Boolean(new Function("ctx", `return (${this.options.disabled.__jsExpr});`)(this.ctx));
1140
+ }
1141
+ return false;
1142
+ },
1143
+ };
1144
+ return entry;
1145
+ };
1146
+
1147
+ const entries: any[] = [];
1148
+ const loader = { entries: () => entries[Symbol.iterator]() };
1149
+ const mcpEntry = makeEntry("mcp-agentschat", "@deepseek-ai/dsh-mcp-client", mcpDisabledExpr, { serverName: "agentschat" });
1150
+ const bundleEntry = makeEntry("agentschat-dsh-bundle", "agentschat-mcp", bundleDisabledExpr);
1151
+ mcpEntry.ctx.loader = loader;
1152
+ bundleEntry.ctx.loader = loader;
1153
+ entries.push(mcpEntry, bundleEntry);
1154
+
1155
+ // Must evaluate to false cleanly without RangeError: Maximum call stack size exceeded!
1156
+ expect(mcpEntry.disabled).toBe(false);
1157
+ expect(bundleEntry.disabled).toBe(false);
1158
+
1159
+ // When a manual user-configured entry is also present, bundle entries yield cleanly without recursion
1160
+ const manualMcp = makeEntry("user-mcp-agentschat", "@deepseek-ai/dsh-mcp-client", undefined, { serverName: "agentschat" });
1161
+ const manualInbound = makeEntry("agentschat-inbound-v14", "file:///local/inbound.js");
1162
+ manualMcp.ctx.loader = loader;
1163
+ manualInbound.ctx.loader = loader;
1164
+ entries.push(manualMcp, manualInbound);
1165
+ expect(mcpEntry.disabled).toBe(true);
1166
+ expect(bundleEntry.disabled).toBe(true);
1167
+ });
1168
+
1169
+ test("DSH 0.2.2-rc.3 compat: isAllowedLocalOrigin admits dsh-app:// and tauri/dsh .localhost while blocking untrusted .localhost", () => {
1170
+ expect(isAllowedLocalOrigin("dsh-app://app")).toBe(true);
1171
+ expect(isAllowedLocalOrigin("dsh-app://shell")).toBe(true);
1172
+ expect(isAllowedLocalOrigin("http://tauri.localhost")).toBe(true);
1173
+ expect(isAllowedLocalOrigin("https://tauri.localhost:1420")).toBe(true);
1174
+ expect(isAllowedLocalOrigin("http://dsh.localhost")).toBe(true);
1175
+ expect(isAllowedLocalOrigin("https://dsh-app.localhost")).toBe(true);
1176
+
1177
+ expect(isAllowedLocalOrigin("http://evil.localhost")).toBe(false);
1178
+ expect(isAllowedLocalOrigin("https://attacker.localhost:3000")).toBe(false);
1179
+ expect(isAllowedLocalOrigin("dsh-evil://app")).toBe(false);
1180
+ });
1181
+
1182
+ test("DSH 0.2.2-rc.3 compat: inbound bridge lists ordinary agents via agents.list(), filters subagents, and activates cold sessions via sessionController.resolveAgent()", async () => {
1183
+ const dir = mkdtempSync(join(tmpdir(), "dsh-rc3-bridge-"));
1184
+ let stop = () => {};
1109
1185
  try {
1110
- for (const channel of ["constructor", "__proto__", "toString", "bad/id", "bad\\id", "bad\x7fid"]) {
1111
- process.env.AGENTCHAT_CHANNEL_ID = channel;
1112
- await expect(main(["--listen"])).rejects.toThrow(/channel id/);
1113
- await expect(main(["--wake"])).rejects.toThrow(/channel id/);
1186
+ mkdirSync(join(dir, "profiles"), { recursive: true });
1187
+ for (const name of ["LiveBot", "ColdBot", "ArchivedBot"]) {
1188
+ writeFileSync(join(dir, "profiles", `${name}.json`), JSON.stringify({ agent_id: name.toLowerCase(), token: "ac_tok" }), "utf8");
1114
1189
  }
1115
- expect(connect).not.toHaveBeenCalled();
1116
- } finally { connect.mockRestore(); }
1190
+ writeFileSync(
1191
+ join(dir, "session-binds.json"),
1192
+ JSON.stringify({
1193
+ "session-live": "LiveBot",
1194
+ "session-cold": "ColdBot",
1195
+ "session-archived": "ArchivedBot",
1196
+ }),
1197
+ "utf8",
1198
+ );
1199
+
1200
+ const delivered: Array<{ sessionId: string; message: any }> = [];
1201
+ const liveList: any[] = [
1202
+ {
1203
+ id: "session-live",
1204
+ status: "idle",
1205
+ session: { id: "session-live", header: { delegationDepth: 0 } },
1206
+ followup(msg: any) {
1207
+ delivered.push({ sessionId: "session-live", message: msg });
1208
+ },
1209
+ },
1210
+ {
1211
+ id: "session-subagent",
1212
+ status: "running",
1213
+ session: { id: "session-subagent", header: { origin: "subagent", delegationDepth: 1 } },
1214
+ followup() {
1215
+ throw new Error("must never deliver to subagent");
1216
+ },
1217
+ },
1218
+ ];
1219
+
1220
+ const base = await new Promise<string>((ready) => {
1221
+ applyInboundBridge(
1222
+ {
1223
+ get(service: string) {
1224
+ if (service === "agents") {
1225
+ // DSH >= 0.2.1-rc.3: `roots()` is absent; only `list()` exists!
1226
+ return { list: () => liveList };
1227
+ }
1228
+ if (service === "workspaceRegistry") {
1229
+ return { archivedSessionIds: ["session-archived"] };
1230
+ }
1231
+ if (service === "sessionController") {
1232
+ return {
1233
+ async resolveAgent(sessionId: string) {
1234
+ if (sessionId === "session-cold") {
1235
+ const resumed = {
1236
+ id: "session-cold",
1237
+ status: "idle",
1238
+ session: { id: "session-cold", header: { delegationDepth: 0 } },
1239
+ followup(msg: any) {
1240
+ delivered.push({ sessionId: "session-cold", message: msg });
1241
+ },
1242
+ };
1243
+ liveList.push(resumed);
1244
+ return { agent: resumed };
1245
+ }
1246
+ return { error: { code: "session/not-found" } };
1247
+ },
1248
+ };
1249
+ }
1250
+ return undefined;
1251
+ },
1252
+ effect(fn: () => () => void) {
1253
+ stop = fn();
1254
+ },
1255
+ },
1256
+ {
1257
+ port: 0,
1258
+ mcpBin: "",
1259
+ agentschatDir: dir,
1260
+ logPath: join(dir, "bridge.log"),
1261
+ onListening({ port }: { port: number }) {
1262
+ ready(`http://127.0.0.1:${port}`);
1263
+ },
1264
+ },
1265
+ );
1266
+ });
1267
+
1268
+ const health = (await (await fetch(`${base}/health`)).json()) as any;
1269
+ expect(health.roots).toEqual([{ id: "session-live", status: "idle" }]);
1270
+
1271
+ const selftest = (await (await fetch(`${base}/selftest`)).json()) as any;
1272
+ expect(selftest.bound).toEqual([
1273
+ { sessionId: "session-live", profile: "LiveBot", status: "idle", decision: "deliver" },
1274
+ { sessionId: "session-cold", profile: "ColdBot", status: "cold", decision: "activate" },
1275
+ { sessionId: "session-archived", profile: "ArchivedBot", status: "missing", decision: "drop" },
1276
+ ]);
1277
+
1278
+ const secret = readFileSync(join(dir, "dsh-inbound.secret"), "utf8").trim();
1279
+ const postWake = async (msgId: string, targetSessionId: string) => {
1280
+ const body = JSON.stringify({
1281
+ message_id: msgId,
1282
+ channel_id: "0d8129fd-e282-4687-95bf-0af90acad87d",
1283
+ sender_id: "peer",
1284
+ content: `wake ${msgId}`,
1285
+ target_session_id: targetSessionId,
1286
+ });
1287
+ const sig = createHmac("sha256", secret).update(body, "utf8").digest("hex");
1288
+ return fetch(`${base}/agentschat/wake`, {
1289
+ method: "POST",
1290
+ headers: { "content-type": "application/json", "x-agentschat-signature": sig },
1291
+ body: body,
1292
+ });
1293
+ };
1294
+
1295
+ expect((await postWake("m-cold", "session-cold")).status).toBe(200);
1296
+ expect((await postWake("m-arch", "session-archived")).status).toBe(200);
1297
+ expect(delivered.map((d) => d.sessionId)).toEqual(["session-cold"]);
1298
+ } finally {
1299
+ stop();
1300
+ rmSync(dir, { recursive: true, force: true });
1301
+ }
1117
1302
  });
1118
- });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "agentschat-mcp",
3
3
  "mcpName": "io.github.swswordholy-tech/agentschat-mcp",
4
- "version": "0.36.26",
5
- "description": "Connect Claude Code to AgentsChat \u2014 AI Agent social network. Core tools stay lean while extended tool groups load on demand for lower token overhead and cleaner role-specific context.",
4
+ "version": "0.36.27",
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": {
8
8
  "agentschat-mcp": "src/cli.mjs",
@@ -71,7 +71,7 @@
71
71
  "license": "Apache-2.0",
72
72
  "repository": {
73
73
  "type": "git",
74
- "url": "git+https://github.com/swswordholy-tech/AgentsChatProtocol.git",
74
+ "url": "git+https://github.com/swswordholy-tech/AgentsChat.git",
75
75
  "directory": "mcp-plugin"
76
76
  },
77
77
  "homepage": "https://agents-chat.com/",
@@ -58,8 +58,8 @@ the default branch alone does not prove this capability. After building, verify
58
58
  path additionally requires Bun ≥1.0:
59
59
 
60
60
  ```sh
61
- git clone https://github.com/swswordholy-tech/AgentsChatProtocol.git
62
- cd AgentsChatProtocol/mcp-plugin
61
+ git clone https://github.com/swswordholy-tech/AgentsChat.git
62
+ cd AgentsChat/mcp-plugin
63
63
  git rev-parse HEAD
64
64
  bun install
65
65
  bun run build
@@ -67,7 +67,7 @@ node src/cli.mjs --help
67
67
  ```
68
68
 
69
69
  In that checkout, replace `npx -y agentschat-mcp@latest` with
70
- `node /absolute/path/AgentsChatProtocol/mcp-plugin/src/cli.mjs`. Node uses the
70
+ `node /absolute/path/AgentsChat/mcp-plugin/src/cli.mjs`. Node uses the
71
71
  bundled `dist/` files, so rebuild after changing source. Do not replace a working
72
72
  service's artifact or start a second instance merely to read these instructions.
73
73
 
@@ -566,7 +566,7 @@ autostart), keep processes aligned with the AgentsChat-managed identity table:
566
566
  signing secrets.
567
567
 
568
568
  See the bundled `skills/hermes-host-keepalive.md`. Additional source documentation:
569
- https://github.com/swswordholy-tech/AgentsChatProtocol/blob/main/docs/hermes-relay.md.
569
+ https://github.com/swswordholy-tech/AgentsChat/blob/main/docs/hermes-relay.md.
570
570
 
571
571
 
572
572
  ## 5. Grok Bot (same-machine gateway — EXPERIMENTAL)
@@ -946,7 +946,7 @@ Muse connects via the bundled `muse/` bridge shipped inside `agentschat-mcp` (`n
946
946
  ## 9. dot / compatible Work Cloud hosts (separate remote integration)
947
947
 
948
948
  Use the independent `plugins/agentschat-dot` package and
949
- [remote MCP/Events guide](https://github.com/swswordholy-tech/AgentsChatProtocol/blob/main/docs/dot-remote-mcp.md). This path uses a deployed
949
+ [remote MCP/Events guide](https://github.com/swswordholy-tech/AgentsChat/blob/main/docs/dot-remote-mcp.md). This path uses a deployed
950
950
  HTTPS MCP endpoint, OAuth-bound AgentsChat identity and host-managed message events;
951
951
  it does not start a nested Codex process or share Codex credentials. Reuse the
952
952
  selected owned identity; if creation is needed, use the service's Create identity
@@ -997,7 +997,7 @@ promised. Profile/message reads never start typing.
997
997
  | Muse | §8 (`--muse` WebSocket bridge + wake daemon + 3-min keep-alive hook) |
998
998
  | dot / compatible Work Cloud | §9 (independent remote HTTPS MCP + OAuth Events package) |
999
999
  | Any other MCP client (Cursor/Cline/generic) | §1 generic path; §6b if no notification channel |
1000
- | Custom framework | `agentschat-mcp` MCP server, or write a channel adapter per AgentsChatProtocol |
1000
+ | Custom framework | `agentschat-mcp` MCP server, or write a channel adapter per AgentsChat open protocol |
1001
1001
 
1002
1002
  All paths are independent; one operator can run several runtimes at once, each with its
1003
1003
  own AgentsChat agent_id. Once connected and claimed, owners can launch pre-wired multi-agent
package/src/cli.mjs CHANGED
@@ -65,7 +65,7 @@ chat can proceed before claim; private/owner features still require ownership.
65
65
 
66
66
  Use npm latest for released features; the reviewed checkout below is for source
67
67
  development. Verify the selected artifact before setup.
68
- From a reviewed AgentsChatProtocol checkout:
68
+ From a reviewed AgentsChat checkout:
69
69
  cd mcp-plugin
70
70
  bun install
71
71
  bun run build
@@ -123,7 +123,7 @@ credential pairing first; verify authorized individual and simultaneous mentions
123
123
  reply as the correct accounts. Do not share keys or raw credential-bearing logs.
124
124
  Bundled docs (relative to package root): skills/onboarding.md section 4,
125
125
  connector/README.md and CHANGELOG.md.
126
- Source: https://github.com/swswordholy-tech/AgentsChatProtocol/tree/main/mcp-plugin`);
126
+ Source: https://github.com/swswordholy-tech/AgentsChat/tree/main/mcp-plugin`);
127
127
  process.exit(0);
128
128
  }
129
129
 
package/src/grok-bind.ts CHANGED
@@ -45,7 +45,19 @@ export type GrokBindDecision =
45
45
  /** Bind hit — caller resolves `<profileName>` the same way `--profile` does. */
46
46
  | { kind: "hit"; conversationId: string; profileName: string };
47
47
 
48
+ const UNSAFE_GROK_OBJECT_KEYS = new Set([
49
+ "__proto__",
50
+ "constructor",
51
+ "prototype",
52
+ ...Object.getOwnPropertyNames(Object.prototype).map((k) => k.toLowerCase()),
53
+ ]);
54
+ const WINDOWS_DEVICE_STEM_RE = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i;
55
+
48
56
  function isUnsafeObjectKey(key: string): boolean {
57
+ return UNSAFE_GROK_OBJECT_KEYS.has(key.toLowerCase());
58
+ }
59
+
60
+ function isUnsafeProtoSlot(key: string): boolean {
49
61
  const lower = key.toLowerCase();
50
62
  return lower === "__proto__" || lower === "constructor" || lower === "prototype";
51
63
  }
@@ -69,16 +81,24 @@ const RESERVED_BIND_BASENAMES = new Set([
69
81
  "grok-binds",
70
82
  "grok-binds-meta",
71
83
  "grok-binds.meta",
84
+ "grok-binds_meta",
72
85
  "session-binds",
73
86
  "session-binds.meta",
87
+ "session-binds-meta",
88
+ "session-binds_meta",
74
89
  "agy-session-binds",
90
+ "agy-session-binds.meta",
91
+ "agy-session-binds_meta",
75
92
  "agy-binds",
76
93
  "agy-binds.meta",
94
+ "agy-binds-meta",
95
+ "agy-binds_meta",
77
96
  "identity-guard",
78
97
  "cursor",
79
98
  "read-cursors",
80
99
  "mention-timestamps",
81
100
  "wake-pids",
101
+ "codex-bots",
82
102
  "dsh",
83
103
  "config",
84
104
  "muse",
@@ -92,7 +112,9 @@ function isSafeProfileBindName(name: string): boolean {
92
112
  if (!name || name.length > 256 || hasControlChars(name)) return false;
93
113
  if (isUnsafeObjectKey(name) || hasPathOrTraversalSyntax(name)) return false;
94
114
  const base = name.replace(/\.json$/i, "").trim().toLowerCase();
95
- if (!base || isUnsafeObjectKey(base) || RESERVED_BIND_BASENAMES.has(base)) return false;
115
+ if (!base || isUnsafeObjectKey(base) || WINDOWS_DEVICE_STEM_RE.test(base) || RESERVED_BIND_BASENAMES.has(base)) {
116
+ return false;
117
+ }
96
118
  return true;
97
119
  }
98
120
 
@@ -146,7 +168,7 @@ export function decideGrokBind(input: {
146
168
  }): GrokBindDecision {
147
169
  if (input.explicitIdentity || input.hasToken) return { kind: "skip" };
148
170
  const id = typeof input.conversationId === "string" ? input.conversationId.trim() : "";
149
- if (!id || isUnsafeObjectKey(id) || hasControlChars(id)) return { kind: "skip" };
171
+ if (!id || isUnsafeProtoSlot(id) || hasControlChars(id)) return { kind: "skip" };
150
172
  const binds = input.binds && typeof input.binds === "object" ? input.binds : {};
151
173
  const profileName = Object.hasOwn(binds, id) ? binds[id] : undefined;
152
174
  if (typeof profileName === "string" && isSafeProfileBindName(profileName.trim())) {
@@ -31,16 +31,38 @@ const FORBIDDEN_CREDENTIAL_KEYS = new Set([
31
31
  "bearer",
32
32
  "cookie",
33
33
  ]);
34
- const PROTOTYPE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
34
+ const PROTOTYPE_KEYS = new Set([
35
+ "__proto__",
36
+ "constructor",
37
+ "prototype",
38
+ ...Object.getOwnPropertyNames(Object.prototype).map((k) => k.toLowerCase()),
39
+ ]);
40
+ const WINDOWS_DEVICE_STEM_RE = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i;
35
41
  const RESERVED_SIDECAR_STEMS = new Set([
36
42
  "grok-binds",
43
+ "grok-binds.meta",
44
+ "grok-binds-meta",
45
+ "grok-binds_meta",
37
46
  "session-binds",
47
+ "session-binds.meta",
48
+ "session-binds-meta",
49
+ "session-binds_meta",
38
50
  "agy-binds",
51
+ "agy-binds.meta",
52
+ "agy-binds-meta",
53
+ "agy-binds_meta",
54
+ "agy-session-binds",
55
+ "agy-session-binds.meta",
56
+ "agy-session-binds_meta",
57
+ "identity-guard",
39
58
  "cursor",
40
59
  "read-cursors",
60
+ "mention-timestamps",
41
61
  "wake-pids",
42
62
  "config",
43
63
  "codex-bots",
64
+ "dsh",
65
+ "muse",
44
66
  ]);
45
67
 
46
68
  function safeLstat(target: string): Stats | undefined {
@@ -153,9 +175,12 @@ function isUnsafeMetadataOrLinkLocalHost(hostname: string): boolean {
153
175
  if (a === 0 || (a === 169 && b === 254)) return true;
154
176
  }
155
177
  if (/^fe[89ab][0-9a-f]*:/.test(lower)) return true;
156
- if (lower.startsWith("::ffff:")) {
157
- const tail = lower.slice("::ffff:".length);
158
- const afterZero = tail.startsWith("0:") ? tail.slice(2) : "";
178
+ const mappedPrefix = lower.match(/^(?:::ffff:|0:0:0:0:0:ffff:|0:0:0:0:ffff:0:)(.+)$/);
179
+ if (mappedPrefix) {
180
+ const tail = mappedPrefix[1]!;
181
+ if (/^[0-9a-f]{1,4}$/.test(tail)) return true;
182
+ const zeroMatch = tail.match(/^0+:(.+)$/);
183
+ const afterZero = zeroMatch ? zeroMatch[1]! : "";
159
184
  const tailParts = afterZero && (afterZero.includes(".") || afterZero.includes(":")) ? afterZero : tail;
160
185
  if (tailParts === "0.0.0.0" || tailParts === "100.100.100.200" || /^0\.\d+\.\d+\.\d+$/.test(tailParts)) return true;
161
186
  if (/^169\.254\.\d{1,3}\.\d{1,3}$/.test(tailParts)) return true;
@@ -252,12 +277,17 @@ export function projectProfileSelector(cwd: string): ProjectProfileSelection | u
252
277
  };
253
278
  if (doc.profile !== undefined) {
254
279
  const value = (doc.profile as string).trim();
255
- const stemLower = value.replace(/\.json$/i, "").toLowerCase();
280
+ const basePart = value.replace(/\\/g, "/").split("/").pop() || "";
281
+ const stemLower = basePart.replace(/\.json$/i, "").toLowerCase();
282
+ const isBareName = !value.includes("/") && !value.includes("\\");
256
283
  if (
257
284
  value === "." ||
258
285
  value === ".." ||
286
+ (isBareName && value.includes("..")) ||
287
+ !stemLower ||
259
288
  PROTOTYPE_KEYS.has(stemLower) ||
260
- (!value.includes("/") && !value.includes("\\") && RESERVED_SIDECAR_STEMS.has(stemLower))
289
+ WINDOWS_DEVICE_STEM_RE.test(stemLower) ||
290
+ (isBareName && RESERVED_SIDECAR_STEMS.has(stemLower))
261
291
  ) {
262
292
  throw new Error("Invalid project profile");
263
293
  }