agent-comms 4.1.2 → 4.1.4

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.
Files changed (82) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +3 -1
  4. package/dist/bridges/cc-peer/bridge.d.ts +14 -0
  5. package/dist/bridges/cc-peer/bridge.d.ts.map +1 -1
  6. package/dist/bridges/cc-peer/bridge.js +37 -11
  7. package/dist/bridges/cc-peer/bridge.js.map +1 -1
  8. package/dist/bridges/cc-peer/default-front.d.ts +4 -0
  9. package/dist/bridges/cc-peer/default-front.d.ts.map +1 -1
  10. package/dist/bridges/cc-peer/default-front.js +2 -0
  11. package/dist/bridges/cc-peer/default-front.js.map +1 -1
  12. package/dist/bridges/cc-peer/front-controller.d.ts +2 -0
  13. package/dist/bridges/cc-peer/front-controller.d.ts.map +1 -1
  14. package/dist/bridges/cc-peer/front-controller.js +1 -1
  15. package/dist/bridges/cc-peer/front-controller.js.map +1 -1
  16. package/dist/bridges/cc-peer/front-runtime.d.ts +13 -1
  17. package/dist/bridges/cc-peer/front-runtime.d.ts.map +1 -1
  18. package/dist/bridges/cc-peer/front-runtime.js +22 -13
  19. package/dist/bridges/cc-peer/front-runtime.js.map +1 -1
  20. package/dist/bridges/cc-peer/run.d.ts.map +1 -1
  21. package/dist/bridges/cc-peer/run.js +10 -4
  22. package/dist/bridges/cc-peer/run.js.map +1 -1
  23. package/dist/bridges/cc-peer/shared-peer.d.ts +16 -0
  24. package/dist/bridges/cc-peer/shared-peer.d.ts.map +1 -0
  25. package/dist/bridges/cc-peer/shared-peer.js +28 -0
  26. package/dist/bridges/cc-peer/shared-peer.js.map +1 -0
  27. package/dist/bridges/claude-code/channel.d.ts.map +1 -1
  28. package/dist/bridges/claude-code/channel.js +2 -1
  29. package/dist/bridges/claude-code/channel.js.map +1 -1
  30. package/dist/bridges/codex/tool.d.ts.map +1 -1
  31. package/dist/bridges/codex/tool.js +2 -1
  32. package/dist/bridges/codex/tool.js.map +1 -1
  33. package/dist/bridges/mcp/server.d.ts.map +1 -1
  34. package/dist/bridges/mcp/server.js +2 -1
  35. package/dist/bridges/mcp/server.js.map +1 -1
  36. package/dist/bridges/opencode/plugin.d.ts.map +1 -1
  37. package/dist/bridges/opencode/plugin.js +2 -1
  38. package/dist/bridges/opencode/plugin.js.map +1 -1
  39. package/dist/bridges/pi/extension.d.ts.map +1 -1
  40. package/dist/bridges/pi/extension.js +5 -1
  41. package/dist/bridges/pi/extension.js.map +1 -1
  42. package/dist/bridges/user/controller.d.ts.map +1 -1
  43. package/dist/bridges/user/controller.js +9 -1
  44. package/dist/bridges/user/controller.js.map +1 -1
  45. package/dist/core/error-reporting.d.ts +8 -0
  46. package/dist/core/error-reporting.d.ts.map +1 -0
  47. package/dist/core/error-reporting.js +16 -0
  48. package/dist/core/error-reporting.js.map +1 -0
  49. package/dist/core/identity-store.d.ts.map +1 -1
  50. package/dist/core/identity-store.js +4 -2
  51. package/dist/core/identity-store.js.map +1 -1
  52. package/dist/core/index.d.ts +1 -0
  53. package/dist/core/index.d.ts.map +1 -1
  54. package/dist/core/index.js +1 -0
  55. package/dist/core/index.js.map +1 -1
  56. package/dist/test/cc-peer-bridge.unit.test.js +121 -8
  57. package/dist/test/cc-peer-bridge.unit.test.js.map +1 -1
  58. package/dist/test/cc-peer-default-front.unit.test.js +12 -0
  59. package/dist/test/cc-peer-default-front.unit.test.js.map +1 -1
  60. package/dist/test/cc-peer-front-controller.unit.test.js +30 -0
  61. package/dist/test/cc-peer-front-controller.unit.test.js.map +1 -1
  62. package/dist/test/cc-peer-front-runtime.unit.test.d.ts +2 -0
  63. package/dist/test/cc-peer-front-runtime.unit.test.d.ts.map +1 -0
  64. package/dist/test/cc-peer-front-runtime.unit.test.js +72 -0
  65. package/dist/test/cc-peer-front-runtime.unit.test.js.map +1 -0
  66. package/dist/test/cc-peer-shared-peer.unit.test.d.ts +2 -0
  67. package/dist/test/cc-peer-shared-peer.unit.test.d.ts.map +1 -0
  68. package/dist/test/cc-peer-shared-peer.unit.test.js +48 -0
  69. package/dist/test/cc-peer-shared-peer.unit.test.js.map +1 -0
  70. package/dist/test/chat-controller-mesh-errors.integration.test.d.ts +2 -0
  71. package/dist/test/chat-controller-mesh-errors.integration.test.d.ts.map +1 -0
  72. package/dist/test/chat-controller-mesh-errors.integration.test.js +49 -0
  73. package/dist/test/chat-controller-mesh-errors.integration.test.js.map +1 -0
  74. package/dist/test/error-reporting.unit.test.d.ts +2 -0
  75. package/dist/test/error-reporting.unit.test.d.ts.map +1 -0
  76. package/dist/test/error-reporting.unit.test.js +35 -0
  77. package/dist/test/error-reporting.unit.test.js.map +1 -0
  78. package/dist/test/identity-store-wait.unit.test.d.ts +2 -0
  79. package/dist/test/identity-store-wait.unit.test.d.ts.map +1 -0
  80. package/dist/test/identity-store-wait.unit.test.js +75 -0
  81. package/dist/test/identity-store-wait.unit.test.js.map +1 -0
  82. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-reporting.unit.test.js","sourceRoot":"","sources":["../../src/test/error-reporting.unit.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EACL,uBAAuB,EACvB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAEpC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,IAAI,CAC1D,kCAAkC,CACnC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,EAA0B,CAAC;QAC9C,MAAM,MAAM,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;QAE9C,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAErC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YAC/B,CAAC,kCAAkC,CAAC;YACpC,CAAC,gCAAgC,CAAC;SACnC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,MAAM,GAAG,EAAE;aACd,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC;aAC9B,kBAAkB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC;YACH,uBAAuB,EAAE,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;YAC7C,MAAM,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;QAC7D,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=identity-store-wait.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-store-wait.unit.test.d.ts","sourceRoot":"","sources":["../../src/test/identity-store-wait.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Unit test for the interleaving readStoredIdentityWaitingForConcurrentCreate must survive: the slot's identity file is read (absent), then the file is created and its creator exits, and only then is the lock file read (holder no longer alive). Concluding "no identity" from the lock alone would miss the file that appeared in between, so the file has to be checked once more.
3
+ *
4
+ * node:fs is wrapped so a hook can create the identity file at the exact moment the lock file is read, which is the only way to land that interleaving deterministically.
5
+ */
6
+ import { spawnSync } from "node:child_process";
7
+ import * as fs from "node:fs";
8
+ import { tmpdir } from "node:os";
9
+ import path from "node:path";
10
+ import { afterEach, describe, expect, it, vi } from "vitest";
11
+ import { loadOrCreateIdentity, loadRoomTokens, saveRoomToken, } from "../core/identity-store.js";
12
+ const hooks = vi.hoisted(() => ({
13
+ onRead: undefined,
14
+ }));
15
+ vi.mock("node:fs", async (importOriginal) => {
16
+ const actual = await importOriginal();
17
+ return {
18
+ ...actual,
19
+ default: actual,
20
+ readFileSync: (filePath, options) => {
21
+ hooks.onRead?.(String(filePath));
22
+ return actual.readFileSync(filePath, options);
23
+ },
24
+ };
25
+ });
26
+ // A structurally valid stand-in: saveRoomToken only serialises a CapabilityToken's byte-string fields.
27
+ const FAKE_TOKEN = [
28
+ Uint8Array.from([1]),
29
+ {},
30
+ null,
31
+ Uint8Array.from([2]),
32
+ ];
33
+ /** The pid of a process that has already exited, so the lock it "holds" is stale. */
34
+ function deadPid() {
35
+ const child = spawnSync(process.execPath, ["-e", ""]);
36
+ if (child.pid === undefined)
37
+ throw new Error("child had no pid");
38
+ return child.pid;
39
+ }
40
+ describe("saveRoomToken racing a concurrent identity creation", () => {
41
+ const dirs = [];
42
+ afterEach(() => {
43
+ hooks.onRead = undefined;
44
+ for (const dir of dirs.splice(0)) {
45
+ fs.rmSync(dir, { recursive: true, force: true });
46
+ }
47
+ });
48
+ function scratchDir() {
49
+ const dir = fs.mkdtempSync(path.join(tmpdir(), "identity-wait-"));
50
+ dirs.push(dir);
51
+ return dir;
52
+ }
53
+ it("finds an identity file that appeared, with its creator already gone, between the file read and the lock read", () => {
54
+ // Real identity text to "appear": made in a separate slot so nothing shares state with the slot under test.
55
+ const sourceSlot = {
56
+ harness: "wait",
57
+ cwd: "/tmp/source",
58
+ dir: scratchDir(),
59
+ };
60
+ loadOrCreateIdentity(sourceSlot);
61
+ const identityText = fs.readFileSync(path.join(sourceSlot.dir, fs.readdirSync(sourceSlot.dir).find((f) => f.endsWith(".json")) ?? ""), "utf-8");
62
+ const slot = { harness: "wait", cwd: "/tmp/target", dir: scratchDir() };
63
+ const targetBase = path.join(slot.dir, "identity-wait--_tmp_target");
64
+ fs.writeFileSync(`${targetBase}.lock`, `${String(deadPid())}\n`);
65
+ hooks.onRead = (filePath) => {
66
+ if (!filePath.endsWith(".lock"))
67
+ return;
68
+ hooks.onRead = undefined;
69
+ fs.writeFileSync(`${targetBase}.json`, identityText);
70
+ };
71
+ saveRoomToken(slot, "race-room", FAKE_TOKEN);
72
+ expect(Object.keys(loadRoomTokens(slot))).toEqual(["race-room"]);
73
+ });
74
+ });
75
+ //# sourceMappingURL=identity-store-wait.unit.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-store-wait.unit.test.js","sourceRoot":"","sources":["../../src/test/identity-store-wait.unit.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE7D,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,aAAa,GACd,MAAM,2BAA2B,CAAC;AAEnC,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC9B,MAAM,EAAE,SAAqD;CAC9D,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;IAC1C,MAAM,MAAM,GAAG,MAAM,cAAc,EAAmB,CAAC;I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C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-comms",
3
3
  "description": "Cross-harness communication mesh for LLM agents — rooms, DMs, presence, and real-time push delivery over TCP",
4
- "version": "4.1.2",
4
+ "version": "4.1.4",
5
5
  "bin": {
6
6
  "agent-comms": "dist/cli.js"
7
7
  },