@essentialai/cogent-bridge 3.21.9 → 3.23.0

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 (44) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/backend/http-backend.d.ts +9 -1
  3. package/dist/backend/http-backend.d.ts.map +1 -1
  4. package/dist/backend/http-backend.js +59 -4
  5. package/dist/backend/http-backend.js.map +1 -1
  6. package/dist/backend/relay-version-cache.d.ts +18 -0
  7. package/dist/backend/relay-version-cache.d.ts.map +1 -1
  8. package/dist/backend/relay-version-cache.js +46 -2
  9. package/dist/backend/relay-version-cache.js.map +1 -1
  10. package/dist/backend/storage-backend.d.ts +7 -1
  11. package/dist/backend/storage-backend.d.ts.map +1 -1
  12. package/dist/cloud/credential-store.d.ts +14 -0
  13. package/dist/cloud/credential-store.d.ts.map +1 -1
  14. package/dist/cloud/credential-store.js.map +1 -1
  15. package/dist/index.js +2 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/services/auto-relay.d.ts +35 -12
  18. package/dist/services/auto-relay.d.ts.map +1 -1
  19. package/dist/services/auto-relay.js +147 -33
  20. package/dist/services/auto-relay.js.map +1 -1
  21. package/dist/services/wake-inflight.d.ts +14 -0
  22. package/dist/services/wake-inflight.d.ts.map +1 -1
  23. package/dist/services/wake-inflight.js +21 -0
  24. package/dist/services/wake-inflight.js.map +1 -1
  25. package/dist/services/wake-log.d.ts +56 -0
  26. package/dist/services/wake-log.d.ts.map +1 -0
  27. package/dist/services/wake-log.js +180 -0
  28. package/dist/services/wake-log.js.map +1 -0
  29. package/dist/startup.d.ts.map +1 -1
  30. package/dist/startup.js +3 -1
  31. package/dist/startup.js.map +1 -1
  32. package/dist/tools/register-peer.d.ts +15 -0
  33. package/dist/tools/register-peer.d.ts.map +1 -1
  34. package/dist/tools/register-peer.js +58 -9
  35. package/dist/tools/register-peer.js.map +1 -1
  36. package/dist/tools/send-message.d.ts.map +1 -1
  37. package/dist/tools/send-message.js +19 -1
  38. package/dist/tools/send-message.js.map +1 -1
  39. package/dist/tools/wake-log.d.ts +15 -0
  40. package/dist/tools/wake-log.d.ts.map +1 -0
  41. package/dist/tools/wake-log.js +78 -0
  42. package/dist/tools/wake-log.js.map +1 -0
  43. package/package.json +10 -3
  44. package/server.json +2 -2
@@ -0,0 +1,78 @@
1
+ import { z } from "zod";
2
+ import { successResult, errorResult, BridgeError, BridgeErrorCode } from "../errors.js";
3
+ import { readWakeLog } from "../services/wake-log.js";
4
+ import { listWakeInFlight } from "../services/wake-inflight.js";
5
+ /**
6
+ * `cogent_wake_log` — answers "what has been woken in this directory, and what did it touch?"
7
+ *
8
+ * WHY (external bug report, 2026-09-03). Wakes run with --dangerously-skip-permissions in the
9
+ * peer's real worktree and with --no-session-persistence, so nothing records the turn. A
10
+ * reporter watched coherent code appear in a live repo for ~20 hours and had to parse session
11
+ * JSONL, grep every transcript on the box, run lsof and a file watcher, and finally correlate
12
+ * relay durationMs values against file mtimes to establish it was their own peer and not an
13
+ * intruder. They nearly discarded the work.
14
+ *
15
+ * This tool is that investigation, as one call.
16
+ */
17
+ export function registerWakeLogTool(server) {
18
+ server.registerTool("cogent_wake_log", {
19
+ title: "Wake Log",
20
+ description: "Show the auto-resume (wake) sessions Cogent has run in this working directory: which peer's " +
21
+ "message triggered each one, when, how long it took, the outcome, and WHICH FILES IT CHANGED. " +
22
+ "Use this when files changed with no corresponding edit in your session, when you need to " +
23
+ "establish who authored a change before committing it, or to check whether a wake is running now.",
24
+ inputSchema: {
25
+ limit: z
26
+ .number()
27
+ .int()
28
+ .positive()
29
+ .optional()
30
+ .describe("Return only the most recent N wakes (default: all retained)."),
31
+ peerId: z
32
+ .string()
33
+ .optional()
34
+ .describe("Your local peer id. Required to list wakes running RIGHT NOW — in-flight markers are " +
35
+ "keyed per peer, and two peers can share one directory."),
36
+ cwd: z
37
+ .string()
38
+ .optional()
39
+ .describe("Directory to inspect (default: this bridge's working directory)."),
40
+ },
41
+ annotations: {
42
+ readOnlyHint: true,
43
+ destructiveHint: false,
44
+ idempotentHint: true,
45
+ openWorldHint: false,
46
+ },
47
+ }, async ({ limit, peerId, cwd }) => {
48
+ try {
49
+ const target = cwd ?? process.cwd();
50
+ const wakes = readWakeLog(target, limit);
51
+ // The headline number. `filesChanged: null` means "not a git worktree, could not
52
+ // tell" and is deliberately NOT counted as a mutation — an unknown must never be
53
+ // reported as a finding.
54
+ const mutatingWakeCount = wakes.filter((w) => Array.isArray(w.filesChanged) && w.filesChanged.length > 0).length;
55
+ // In-flight markers are per-peer by design (wake-inflight note 2), so without a
56
+ // peerId there is nothing safe to read. Say so rather than returning a
57
+ // reassuring empty list that reads as "nothing is running".
58
+ const active = peerId ? listWakeInFlight(peerId, target) : [];
59
+ return successResult({
60
+ cwd: target,
61
+ count: wakes.length,
62
+ mutatingWakeCount,
63
+ wakes,
64
+ active,
65
+ ...(peerId
66
+ ? {}
67
+ : { activeHint: "Pass peerId to see wakes running right now (markers are per-peer)." }),
68
+ note: "filesChanged is a git snapshot diff across each wake's window. If you were editing the " +
69
+ "same tree at the same time, your edits appear here too — it is what changed while the " +
70
+ "wake ran, not proof of authorship. null means the directory is not a git worktree.",
71
+ });
72
+ }
73
+ catch (err) {
74
+ return errorResult(new BridgeError(BridgeErrorCode.STATE_CORRUPT, `Could not read the wake log: ${err instanceof Error ? err.message : String(err)}`, "The log lives at ~/.cogent/wake-log/<sha256(cwd)[..16]>.jsonl — check it is readable."));
75
+ }
76
+ });
77
+ }
78
+ //# sourceMappingURL=wake-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wake-log.js","sourceRoot":"","sources":["../../src/tools/wake-log.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;A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YACvE,4DAA4D;YAC5D,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAE9D,OAAO,aAAa,CAAC;gBACnB,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,iBAAiB;gBACjB,KAAK;gBACL,MAAM;gBACN,GAAG,CAAC,MAAM;oBACR,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,EAAE,UAAU,EAAE,oEAAoE,EAAE,CAAC;gBACzF,IAAI,EACF,yFAAyF;oBACzF,wFAAwF;oBACxF,oFAAoF;aACvF,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,WAAW,CAChB,IAAI,WAAW,CACb,eAAe,CAAC,aAAa,EAC7B,gCAAgC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAClF,uFAAuF,CACxF,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@essentialai/cogent-bridge",
3
- "version": "3.21.9",
3
+ "version": "3.23.0",
4
4
  "description": "Cogent Bridge — cross-agent comms for Claude Code, OpenAI Codex and Slack. Codex users: install with `curl -fsSL https://cogent.tools/install.sh | sh`, then start with `cogent-codex` for real-time peer wake.",
5
5
  "type": "module",
6
6
  "workspaces": [
7
7
  "cogent",
8
8
  "slack-adapter",
9
9
  "cogent-plugin",
10
- "surface-core"
10
+ "surface-core",
11
+ "telegram-adapter",
12
+ "discord-adapter",
13
+ "whatsapp-adapter"
11
14
  ],
12
15
  "main": "dist/index.js",
13
16
  "bin": {
@@ -34,7 +37,11 @@
34
37
  "test:unit": "node node_modules/vitest/vitest.mjs run --exclude 'src/e2e/**'",
35
38
  "test:coverage": "node node_modules/vitest/vitest.mjs run --coverage",
36
39
  "postinstall": "node scripts/postinstall-global.mjs",
37
- "prepublishOnly": "npm run build && npm run test:unit"
40
+ "prepublishOnly": "npm run build && npm run typecheck && npm test",
41
+ "typecheck": "node node_modules/typescript/bin/tsc -p tsconfig.test.json --noEmit",
42
+ "test:all": "node scripts/test-all.mjs",
43
+ "secret-scan": "node scripts/secret-scan.mjs",
44
+ "verify": "npm run typecheck && npm run test:all && node scripts/artifact-staleness-test.mjs && node scripts/dist-blackbox-test.mjs"
38
45
  },
39
46
  "keywords": [
40
47
  "mcp",
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.eaisdevelopment/cogent",
4
4
  "title": "Cogent Bridge from Essential AI Solutions (essentialai.uk)",
5
5
  "description": "MCP bridge for inter-session communication between Claude Code instances",
6
- "version": "3.21.9",
6
+ "version": "3.23.0",
7
7
  "repository": {
8
8
  "url": "https://github.com/eaisdevelopment/cogent",
9
9
  "source": "github"
@@ -12,7 +12,7 @@
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "@essentialai/cogent-bridge",
15
- "version": "3.21.9",
15
+ "version": "3.23.0",
16
16
  "runtimeHint": "npx",
17
17
  "transport": {
18
18
  "type": "stdio"