@essentialai/cogent-bridge 3.16.0 → 3.18.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.
- package/CHANGELOG.md +33 -0
- package/dist/backend/file-backend.d.ts +2 -2
- package/dist/backend/file-backend.d.ts.map +1 -1
- package/dist/backend/file-backend.js +3 -2
- package/dist/backend/file-backend.js.map +1 -1
- package/dist/backend/http-backend.d.ts +6 -3
- package/dist/backend/http-backend.d.ts.map +1 -1
- package/dist/backend/http-backend.js +20 -4
- package/dist/backend/http-backend.js.map +1 -1
- package/dist/backend/storage-backend.d.ts +11 -1
- package/dist/backend/storage-backend.d.ts.map +1 -1
- package/dist/cloud/http-client.d.ts +4 -2
- package/dist/cloud/http-client.d.ts.map +1 -1
- package/dist/cloud/http-client.js +4 -1
- package/dist/cloud/http-client.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mail/auth-error.d.ts +22 -0
- package/dist/mail/auth-error.d.ts.map +1 -0
- package/dist/mail/auth-error.js +43 -0
- package/dist/mail/auth-error.js.map +1 -0
- package/dist/mail/validate.d.ts +17 -0
- package/dist/mail/validate.d.ts.map +1 -1
- package/dist/mail/validate.js +37 -0
- package/dist/mail/validate.js.map +1 -1
- package/dist/services/agent-config.d.ts +34 -0
- package/dist/services/agent-config.d.ts.map +1 -0
- package/dist/services/agent-config.js +46 -0
- package/dist/services/agent-config.js.map +1 -0
- package/dist/services/auto-relay.d.ts.map +1 -1
- package/dist/services/auto-relay.js +29 -9
- package/dist/services/auto-relay.js.map +1 -1
- package/dist/services/cc-cli.d.ts +2 -1
- package/dist/services/cc-cli.d.ts.map +1 -1
- package/dist/services/cc-cli.js +10 -7
- package/dist/services/cc-cli.js.map +1 -1
- package/dist/services/codex-cli.d.ts.map +1 -1
- package/dist/services/codex-cli.js +6 -4
- package/dist/services/codex-cli.js.map +1 -1
- package/dist/tools/deregister-peer.d.ts.map +1 -1
- package/dist/tools/deregister-peer.js +15 -1
- package/dist/tools/deregister-peer.js.map +1 -1
- package/dist/tools/fetch-mail.d.ts.map +1 -1
- package/dist/tools/fetch-mail.js +13 -0
- package/dist/tools/fetch-mail.js.map +1 -1
- package/dist/tools/rotate-mail-creds.d.ts +15 -0
- package/dist/tools/rotate-mail-creds.d.ts.map +1 -0
- package/dist/tools/rotate-mail-creds.js +83 -0
- package/dist/tools/rotate-mail-creds.js.map +1 -0
- package/dist/tools/send-mail.d.ts.map +1 -1
- package/dist/tools/send-mail.js +11 -1
- package/dist/tools/send-mail.js.map +1 -1
- package/dist/tools/setup-mail.d.ts.map +1 -1
- package/dist/tools/setup-mail.js +2 -1
- package/dist/tools/setup-mail.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/wizard/templates.js +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
/**
|
|
3
|
+
* cogent_rotate_mail_creds — self-service mailbox password rotation (Cogent Mail M2.4).
|
|
4
|
+
*
|
|
5
|
+
* Re-keys THIS agent's Team mailbox: the bridge asks the relay (authenticated by the per-cwd cloud
|
|
6
|
+
* session token) to rotate on the mail server; the relay derives orgScope + channel label from the
|
|
7
|
+
* session (never client input) so the box is targeted deterministically. On success the fresh
|
|
8
|
+
* password is returned ONCE and written to the per-cwd 0600 mail-credential store, so subsequent
|
|
9
|
+
* cogent_send_mail / cogent_fetch_mail keep working. Use it if a mailbox password may be compromised.
|
|
10
|
+
*
|
|
11
|
+
* Cloud + Team only: it needs cloud credentials (endpoint/session/token/peerId) and a CP-provisioned
|
|
12
|
+
* mailbox. A free/local session gets a clear "rotation isn't available for this channel" error.
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerRotateMailCredsTool(server: McpServer): void;
|
|
15
|
+
//# sourceMappingURL=rotate-mail-creds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rotate-mail-creds.d.ts","sourceRoot":"","sources":["../../src/tools/rotate-mail-creds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYpE;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAqFnE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { successResult, errorResult, BridgeError, BridgeErrorCode } from "../errors.js";
|
|
2
|
+
import { loadCredentials } from "../cloud/credential-store.js";
|
|
3
|
+
import { loadMailCredentials, saveMailCredentials, MAIL_DEFAULT_HOST, } from "../cloud/mail-credential-store.js";
|
|
4
|
+
/** Total budget for the relay round-trip. */
|
|
5
|
+
const ROTATE_TIMEOUT_MS = 8000;
|
|
6
|
+
/**
|
|
7
|
+
* cogent_rotate_mail_creds — self-service mailbox password rotation (Cogent Mail M2.4).
|
|
8
|
+
*
|
|
9
|
+
* Re-keys THIS agent's Team mailbox: the bridge asks the relay (authenticated by the per-cwd cloud
|
|
10
|
+
* session token) to rotate on the mail server; the relay derives orgScope + channel label from the
|
|
11
|
+
* session (never client input) so the box is targeted deterministically. On success the fresh
|
|
12
|
+
* password is returned ONCE and written to the per-cwd 0600 mail-credential store, so subsequent
|
|
13
|
+
* cogent_send_mail / cogent_fetch_mail keep working. Use it if a mailbox password may be compromised.
|
|
14
|
+
*
|
|
15
|
+
* Cloud + Team only: it needs cloud credentials (endpoint/session/token/peerId) and a CP-provisioned
|
|
16
|
+
* mailbox. A free/local session gets a clear "rotation isn't available for this channel" error.
|
|
17
|
+
*/
|
|
18
|
+
export function registerRotateMailCredsTool(server) {
|
|
19
|
+
server.registerTool("cogent_rotate_mail_creds", {
|
|
20
|
+
title: "Rotate this agent's mailbox password",
|
|
21
|
+
description: "Rotate (re-key) this agent's Team mailbox password on the mail server and update the local " +
|
|
22
|
+
"credential store, so cogent_send_mail / cogent_fetch_mail keep working with the fresh secret. " +
|
|
23
|
+
"Use it if the mailbox password may be compromised. Team channels only.",
|
|
24
|
+
inputSchema: {},
|
|
25
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
26
|
+
}, async () => {
|
|
27
|
+
try {
|
|
28
|
+
const creds = await loadCredentials();
|
|
29
|
+
if (!creds || !creds.endpoint || !creds.sessionId || !creds.token) {
|
|
30
|
+
throw new BridgeError(BridgeErrorCode.INVALID_INPUT, "Not registered in cloud mode", "Rotation applies to a cloud Team channel — register the peer first");
|
|
31
|
+
}
|
|
32
|
+
if (!creds.peerId) {
|
|
33
|
+
throw new BridgeError(BridgeErrorCode.INVALID_INPUT, "Cannot identify this peer", "Re-register the peer so its peerId is stored, then rotate");
|
|
34
|
+
}
|
|
35
|
+
const url = `${creds.endpoint.replace(/\/+$/, "")}/api/sessions/${encodeURIComponent(creds.sessionId)}` +
|
|
36
|
+
`/peers/${encodeURIComponent(creds.peerId)}/mail/rotate`;
|
|
37
|
+
let res;
|
|
38
|
+
try {
|
|
39
|
+
res = await fetch(url, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${creds.token}` },
|
|
42
|
+
body: "{}",
|
|
43
|
+
signal: AbortSignal.timeout(ROTATE_TIMEOUT_MS),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
throw new BridgeError(BridgeErrorCode.NETWORK_TIMEOUT, "Could not reach the relay to rotate the mailbox", "Check connectivity and try again");
|
|
48
|
+
}
|
|
49
|
+
if (!res.ok) {
|
|
50
|
+
// The relay maps a non-Team / no-rotator channel to a 400 with a clear message.
|
|
51
|
+
const detail = await res.text().catch(() => "");
|
|
52
|
+
throw new BridgeError(BridgeErrorCode.INVALID_INPUT, `Mailbox rotation was rejected (HTTP ${res.status})`, detail.slice(0, 200) || "Rotation applies to Team channels with a provisioned mailbox");
|
|
53
|
+
}
|
|
54
|
+
const data = (await res.json().catch(() => null));
|
|
55
|
+
if (!data || data.success !== true) {
|
|
56
|
+
throw new BridgeError(BridgeErrorCode.NETWORK_TIMEOUT, "Mailbox rotation failed", "The relay returned an unexpected response");
|
|
57
|
+
}
|
|
58
|
+
if (!data.rotated) {
|
|
59
|
+
// Clean "nothing to rotate" (no mailbox) — do NOT touch the local creds.
|
|
60
|
+
return successResult({ rotated: false, reason: data.reason ?? "no_mailbox" });
|
|
61
|
+
}
|
|
62
|
+
if (!data.address || !data.password) {
|
|
63
|
+
throw new BridgeError(BridgeErrorCode.NETWORK_TIMEOUT, "Rotation returned no new password", "Try again; the mailbox password was not updated locally");
|
|
64
|
+
}
|
|
65
|
+
// Persist the fresh secret, preserving the existing host/port config where present.
|
|
66
|
+
const existing = await loadMailCredentials();
|
|
67
|
+
await saveMailCredentials({
|
|
68
|
+
address: data.address,
|
|
69
|
+
password: data.password,
|
|
70
|
+
imapHost: existing?.imapHost ?? MAIL_DEFAULT_HOST,
|
|
71
|
+
imapPort: existing?.imapPort ?? 993,
|
|
72
|
+
smtpHost: existing?.smtpHost ?? MAIL_DEFAULT_HOST,
|
|
73
|
+
smtpPort: existing?.smtpPort ?? 465,
|
|
74
|
+
savedAt: new Date().toISOString(),
|
|
75
|
+
});
|
|
76
|
+
return successResult({ rotated: true, address: data.address });
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
return errorResult(err);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=rotate-mail-creds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rotate-mail-creds.js","sourceRoot":"","sources":["../../src/tools/rotate-mail-creds.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,c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Root":"","sources":["../../src/tools/send-mail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACvG,OAAO,EAA0C,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIjG,yFAAyF;AACzF,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,UAAU,CAAC;CACjE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,GAAE,YAAiB,GAAG,IAAI,CAsDrF"}
|
package/dist/tools/send-mail.js
CHANGED
|
@@ -2,7 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
import { BridgeError, BridgeErrorCode, successResult, errorResult } from "../errors.js";
|
|
3
3
|
import { loadMailCredentials } from "../cloud/mail-credential-store.js";
|
|
4
4
|
import { NodemailerMailSender, buildAndSendMail } from "../mail/mail-sender.js";
|
|
5
|
-
import { assertValidEmail } from "../mail/validate.js";
|
|
5
|
+
import { assertValidEmail, assertAllowedMailDomain } from "../mail/validate.js";
|
|
6
|
+
import { isMailAuthError, mailAuthErrorHint } from "../mail/auth-error.js";
|
|
6
7
|
/**
|
|
7
8
|
* cogent_send_mail — send an email from this agent's mailbox (Cogent Mail M2.2). Reads the
|
|
8
9
|
* agent's own creds from the local store, composes the message with optional attachments read
|
|
@@ -29,6 +30,7 @@ export function registerSendMailTool(server, deps = {}) {
|
|
|
29
30
|
}, async ({ to, subject, body, attachments }) => {
|
|
30
31
|
try {
|
|
31
32
|
assertValidEmail(to, "to"); // fail fast at the tool boundary, before the SMTP sink
|
|
33
|
+
assertAllowedMailDomain(to, "to"); // F4: org-only mail — no sending to external domains
|
|
32
34
|
const creds = await loadMailCredentials();
|
|
33
35
|
if (!creds) {
|
|
34
36
|
return errorResult(new BridgeError(BridgeErrorCode.INVALID_INPUT, "No mailbox is configured for this agent", "Run cogent_setup_mail with the address + password from the admin Mail panel first"));
|
|
@@ -42,6 +44,14 @@ export function registerSendMailTool(server, deps = {}) {
|
|
|
42
44
|
return successResult({ ...result, attachmentCount: attachments?.length ?? 0 });
|
|
43
45
|
}
|
|
44
46
|
catch (err) {
|
|
47
|
+
// Cogent Mail F3: on an SMTP AUTH failure, do NOT clear the local creds — a temporary admin
|
|
48
|
+
// SUSPEND is wire-indistinguishable from a reap-delete, and wiping still-valid creds would
|
|
49
|
+
// permanently lock the agent out after the box is resumed. A genuine reap already clears creds
|
|
50
|
+
// via the deregister deprovision-header path; here we just surface an actionable hint.
|
|
51
|
+
if (isMailAuthError(err)) {
|
|
52
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
53
|
+
return errorResult(new BridgeError(BridgeErrorCode.INVALID_INPUT, `Mailbox login was refused: ${detail}`, mailAuthErrorHint()));
|
|
54
|
+
}
|
|
45
55
|
return errorResult(err);
|
|
46
56
|
}
|
|
47
57
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-mail.js","sourceRoot":"","sources":["../../src/tools/send-mail.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAiC,MAAM,mCAAmC,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAmB,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"send-mail.js","sourceRoot":"","sources":["../../src/tools/send-mail.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW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AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQpE;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"setup-mail.d.ts","sourceRoot":"","sources":["../../src/tools/setup-mail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQpE;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAsC7D"}
|
package/dist/tools/setup-mail.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { successResult, errorResult } from "../errors.js";
|
|
3
3
|
import { saveMailCredentials, MAIL_DEFAULT_HOST } from "../cloud/mail-credential-store.js";
|
|
4
|
-
import { assertValidEmail } from "../mail/validate.js";
|
|
4
|
+
import { assertValidEmail, assertAllowedMailDomain } from "../mail/validate.js";
|
|
5
5
|
const DEFAULT_MAIL_HOST = MAIL_DEFAULT_HOST;
|
|
6
6
|
/**
|
|
7
7
|
* cogent_setup_mail — store this agent's mailbox credentials locally (Cogent Mail M2).
|
|
@@ -28,6 +28,7 @@ export function registerSetupMailTool(server) {
|
|
|
28
28
|
}, async ({ address, password, imapHost, imapPort, smtpHost, smtpPort }) => {
|
|
29
29
|
try {
|
|
30
30
|
assertValidEmail(address, "address"); // reject fat-finger creds before persisting
|
|
31
|
+
assertAllowedMailDomain(address, "address"); // F4: org-only — block BYO external mailboxes
|
|
31
32
|
await saveMailCredentials({
|
|
32
33
|
address,
|
|
33
34
|
password,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-mail.js","sourceRoot":"","sources":["../../src/tools/setup-mail.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,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,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;SAChG;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;KACzG,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;QACtE,IAAI,CAAC;YACH,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,4CAA4C;YAClF,uBAAuB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,8CAA8C;YAC3F,MAAM,mBAAmB,CAAC;gBACxB,OAAO;gBACP,QAAQ;gBACR,QAAQ,EAAE,QAAQ,IAAI,iBAAiB;gBACvC,QAAQ,EAAE,QAAQ,IAAI,GAAG;gBACzB,QAAQ,EAAE,QAAQ,IAAI,iBAAiB;gBACvC,QAAQ,EAAE,QAAQ,IAAI,GAAG;gBACzB,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aAClC,CAAC,CAAC;YACH,OAAO,aAAa,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -92,6 +92,21 @@ export interface MessageRecord {
|
|
|
92
92
|
* Absent on older records → treated as agent-origin (safe default).
|
|
93
93
|
*/
|
|
94
94
|
originPlatform?: "cc" | "codex" | "slack" | "gchat" | "web";
|
|
95
|
+
/**
|
|
96
|
+
* Cogent Mail M2.5 — file REFERENCES carried alongside the message (the byte transport
|
|
97
|
+
* is email; this is the reference layer). Either a public `url` or a `mailMessageId` the
|
|
98
|
+
* recipient fetches with `cogent_fetch_mail`. Optional/additive → no-attachment messages
|
|
99
|
+
* are unchanged. Mirrors @essentialai/cogent `Attachment`.
|
|
100
|
+
*/
|
|
101
|
+
attachments?: Attachment[];
|
|
102
|
+
}
|
|
103
|
+
/** Cogent Mail M2.5 attachment reference (mirrors @essentialai/cogent `Attachment`). */
|
|
104
|
+
export interface Attachment {
|
|
105
|
+
url?: string;
|
|
106
|
+
mailMessageId?: string;
|
|
107
|
+
name?: string;
|
|
108
|
+
mimeType?: string;
|
|
109
|
+
size?: number;
|
|
95
110
|
}
|
|
96
111
|
export interface SendMessageResult {
|
|
97
112
|
success: boolean;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAC5B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KA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AM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC;IACnD,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
package/dist/wizard/templates.js
CHANGED
|
@@ -48,7 +48,7 @@ Your peer identity: **peerId=\`${peerId}\`**, **label=\`${label}\`**
|
|
|
48
48
|
### On Session Start
|
|
49
49
|
1. Find your Claude Code session ID:
|
|
50
50
|
\`\`\`bash
|
|
51
|
-
ls -t
|
|
51
|
+
ls -t "\${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/projects/$(pwd | sed 's/[^a-zA-Z0-9-]/-/g')/*.jsonl 2>/dev/null | head -1 | xargs -I{} basename {} .jsonl
|
|
52
52
|
\`\`\`
|
|
53
53
|
2. Register yourself on the bridge:
|
|
54
54
|
- Use \`cogent_register_peer\` with peerId="${peerId}", label="${label}"
|
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": "3.
|
|
6
|
+
"version": "3.18.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.
|
|
15
|
+
"version": "3.18.0",
|
|
16
16
|
"runtimeHint": "npx",
|
|
17
17
|
"transport": {
|
|
18
18
|
"type": "stdio"
|