@essentialai/cogent-bridge 1.3.2 → 1.3.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.
- package/dist/tools/get-history.d.ts.map +1 -1
- package/dist/tools/get-history.js +6 -2
- package/dist/tools/get-history.js.map +1 -1
- package/dist/tools/join-session.d.ts +1 -1
- package/dist/tools/join-session.d.ts.map +1 -1
- package/dist/tools/join-session.js +30 -21
- package/dist/tools/join-session.js.map +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-history.d.ts","sourceRoot":"","sources":["../../src/tools/get-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"get-history.d.ts","sourceRoot":"","sources":["../../src/tools/get-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA4C9D"}
|
|
@@ -7,7 +7,9 @@ export function registerGetHistoryTool(server) {
|
|
|
7
7
|
title: "Get Message History",
|
|
8
8
|
description: "Retrieve the message history for the bridge. " +
|
|
9
9
|
"Optionally filter by a specific peer ID. " +
|
|
10
|
-
"Returns messages in chronological order, most recent last."
|
|
10
|
+
"Returns messages in chronological order, most recent last. " +
|
|
11
|
+
"IMPORTANT: Do NOT pass a small limit — always omit the limit parameter to get the full default of 150 messages. " +
|
|
12
|
+
"Users need to see their complete conversation history.",
|
|
11
13
|
inputSchema: {
|
|
12
14
|
peerId: z
|
|
13
15
|
.string()
|
|
@@ -17,7 +19,9 @@ export function registerGetHistoryTool(server) {
|
|
|
17
19
|
.number()
|
|
18
20
|
.optional()
|
|
19
21
|
.default(150)
|
|
20
|
-
.describe("Maximum number of messages to return
|
|
22
|
+
.describe("Maximum number of messages to return. Defaults to 150. " +
|
|
23
|
+
"Do NOT reduce this — users expect to see their full history. " +
|
|
24
|
+
"Only set this if the user explicitly asks for fewer messages."),
|
|
21
25
|
},
|
|
22
26
|
annotations: {
|
|
23
27
|
readOnlyHint: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-history.js","sourceRoot":"","sources":["../../src/tools/get-history.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACtD,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,+CAA+C;YAC/C,2CAA2C;YAC3C,
|
|
1
|
+
{"version":3,"file":"get-history.js","sourceRoot":"","sources":["../../src/tools/get-history.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACtD,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,+CAA+C;YAC/C,2CAA2C;YAC3C,6DAA6D;YAC7D,kHAAkH;YAClH,wDAAwD;QAC1D,WAAW,EAAE;YACX,MAAM,EAAE,CAAC;iBACN,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,wCAAwC,CAAC;YACrD,KAAK,EAAE,CAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,OAAO,CAAC,GAAG,CAAC;iBACZ,QAAQ,CACP,yDAAyD;gBACzD,+DAA+D;gBAC/D,+DAA+D,CAChE;SACJ;QACD,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QAC1B,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACzD,OAAO,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YACnD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Register the cogent_join_session MCP tool.
|
|
4
4
|
*
|
|
5
|
-
* Joins an existing cloud bridge
|
|
5
|
+
* Joins an existing cloud bridge channel using its name and shared secret.
|
|
6
6
|
* Only available when COGENT_ENDPOINT is configured.
|
|
7
7
|
* After joining, persists credentials locally and reinitializes
|
|
8
8
|
* the cloud backend so runtime HttpClient and CloudWsClient use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-session.d.ts","sourceRoot":"","sources":["../../src/tools/join-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUpE;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"join-session.d.ts","sourceRoot":"","sources":["../../src/tools/join-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUpE;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAgJ/D"}
|
|
@@ -8,7 +8,7 @@ const UUID_V4_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9
|
|
|
8
8
|
/**
|
|
9
9
|
* Register the cogent_join_session MCP tool.
|
|
10
10
|
*
|
|
11
|
-
* Joins an existing cloud bridge
|
|
11
|
+
* Joins an existing cloud bridge channel using its name and shared secret.
|
|
12
12
|
* Only available when COGENT_ENDPOINT is configured.
|
|
13
13
|
* After joining, persists credentials locally and reinitializes
|
|
14
14
|
* the cloud backend so runtime HttpClient and CloudWsClient use
|
|
@@ -16,17 +16,20 @@ const UUID_V4_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9
|
|
|
16
16
|
*/
|
|
17
17
|
export function registerJoinSessionTool(server) {
|
|
18
18
|
server.registerTool("cogent_join_session", {
|
|
19
|
-
title: "Join Cloud
|
|
20
|
-
description: "Join an existing cloud bridge
|
|
21
|
-
"
|
|
19
|
+
title: "Join Cloud Channel",
|
|
20
|
+
description: "Join an existing cloud bridge channel by its channel name (e.g. \"mt-space\") and shared secret. " +
|
|
21
|
+
"The channel name is the human-readable label provided by the user, NOT a UUID. " +
|
|
22
|
+
"Do NOT pass a Claude Code session ID here — use the channel/space name the user gave you.",
|
|
22
23
|
inputSchema: {
|
|
23
|
-
|
|
24
|
+
channel: z
|
|
24
25
|
.string()
|
|
25
|
-
.describe("
|
|
26
|
+
.describe("The channel name to join (e.g. \"mt-space\"). " +
|
|
27
|
+
"This is the human-readable name the user provided, NOT a UUID. " +
|
|
28
|
+
"Do NOT use a Claude Code session ID here."),
|
|
26
29
|
secret: z
|
|
27
30
|
.string()
|
|
28
31
|
.min(1)
|
|
29
|
-
.describe("The shared secret for the
|
|
32
|
+
.describe("The shared secret / password for the channel"),
|
|
30
33
|
},
|
|
31
34
|
annotations: {
|
|
32
35
|
readOnlyHint: false,
|
|
@@ -34,25 +37,31 @@ export function registerJoinSessionTool(server) {
|
|
|
34
37
|
idempotentHint: true,
|
|
35
38
|
openWorldHint: true,
|
|
36
39
|
},
|
|
37
|
-
}, async ({
|
|
40
|
+
}, async ({ channel, secret }) => {
|
|
38
41
|
try {
|
|
39
42
|
const config = getConfig();
|
|
40
43
|
if (!config.COGENT_ENDPOINT) {
|
|
41
44
|
return errorResult(new Error("COGENT_ENDPOINT not configured. Set it to use cloud mode."));
|
|
42
45
|
}
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
// Guard: if the caller passed a UUID instead of a channel name, it's
|
|
47
|
+
// almost certainly a mistake (e.g. a Claude Code session ID). Warn
|
|
48
|
+
// loudly so the LLM corrects the call.
|
|
49
|
+
if (UUID_V4_RE.test(channel)) {
|
|
50
|
+
return errorResult(new Error(`The "channel" parameter ("${channel}") looks like a UUID. ` +
|
|
51
|
+
`You should pass the human-readable channel name (e.g. "mt-space") ` +
|
|
52
|
+
`that the user provided, NOT a Claude Code session ID or any UUID. ` +
|
|
53
|
+
`Please retry with the correct channel name.`));
|
|
54
|
+
}
|
|
55
|
+
// Resolve channel name (label) to the internal session UUID
|
|
56
|
+
let resolvedSessionId;
|
|
57
|
+
const resolveResp = await fetch(`${config.COGENT_ENDPOINT}/api/sessions/resolve/${encodeURIComponent(channel)}`);
|
|
58
|
+
if (!resolveResp.ok) {
|
|
59
|
+
const body = await resolveResp.text().catch(() => "");
|
|
60
|
+
return errorResult(new Error(`Failed to resolve channel name "${channel}": HTTP ${resolveResp.status}${body ? ` - ${body}` : ""}`));
|
|
55
61
|
}
|
|
62
|
+
const resolved = (await resolveResp.json());
|
|
63
|
+
resolvedSessionId = resolved.sessionId;
|
|
64
|
+
const resolvedLabel = resolved.label;
|
|
56
65
|
// POST to join session (unauthenticated endpoint)
|
|
57
66
|
const joinPath = `/api/sessions/${encodeURIComponent(resolvedSessionId)}/join`;
|
|
58
67
|
const resp = await fetch(`${config.COGENT_ENDPOINT}${joinPath}`, {
|
|
@@ -93,7 +102,7 @@ export function registerJoinSessionTool(server) {
|
|
|
93
102
|
success: true,
|
|
94
103
|
sessionId: data.sessionId,
|
|
95
104
|
token: data.token,
|
|
96
|
-
label: resolvedLabel ?? data.label ??
|
|
105
|
+
label: resolvedLabel ?? data.label ?? channel,
|
|
97
106
|
peerCount: data.peerCount,
|
|
98
107
|
note: "Successfully joined session. Credentials saved locally. Cloud backend updated. You can now use cogent_register_peer.",
|
|
99
108
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-session.js","sourceRoot":"","sources":["../../src/tools/join-session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,0DAA0D;AAC1D,MAAM,UAAU,GAAG,wEAAwE,CAAC;AAE5F;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,C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D,MAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;YACvD,CAAC;YAED,OAAO,aAAa,CAAC;gBACnB,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,KAAK,EAAE,aAAa,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO;gBAC7C,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,IAAI,EAAE,sHAAsH;aAC7H,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YACpD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
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": "1.3.
|
|
6
|
+
"version": "1.3.4",
|
|
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": "1.3.
|
|
15
|
+
"version": "1.3.4",
|
|
16
16
|
"runtimeHint": "npx",
|
|
17
17
|
"transport": {
|
|
18
18
|
"type": "stdio"
|