@essentialai/cogent-plugin 3.18.0 → 3.19.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cogent",
3
- "version": "3.18.0",
3
+ "version": "3.19.1",
4
4
  "description": "Inter-session communication bridge for Claude Code with Slack integration. Enables CC agents and Slack team members to communicate in real time.",
5
5
  "author": {
6
6
  "name": "Essential AI Solutions",
@@ -26389,8 +26389,8 @@ var init_stdio2 = __esm({
26389
26389
  // src/constants.ts
26390
26390
  import { createRequire } from "node:module";
26391
26391
  function resolveVersion() {
26392
- if ("3.18.0") {
26393
- return "3.18.0";
26392
+ if ("3.19.1") {
26393
+ return "3.19.1";
26394
26394
  }
26395
26395
  try {
26396
26396
  const require2 = createRequire(import.meta.url);
@@ -27999,6 +27999,9 @@ function isCloudEndpoint(value) {
27999
27999
  function isCloudMode() {
28000
28000
  return _backend instanceof HttpBackend;
28001
28001
  }
28002
+ function isCloudDeferred(endpoint) {
28003
+ return !!endpoint && isCloudEndpoint(endpoint) && !isCloudMode();
28004
+ }
28002
28005
  function createBackend(endpoint, sessionId, token) {
28003
28006
  if (endpoint && isCloudEndpoint(endpoint)) {
28004
28007
  if (!sessionId || !token) {
@@ -33616,6 +33619,7 @@ __export(startup_exports, {
33616
33619
  cloudInbox: () => cloudInbox,
33617
33620
  cloudWsClient: () => cloudWsClient,
33618
33621
  reinitCloudBackend: () => reinitCloudBackend,
33622
+ runPreflights: () => runPreflights,
33619
33623
  runStartup: () => runStartup,
33620
33624
  triggerReRegistration: () => triggerReRegistration
33621
33625
  });
@@ -33843,7 +33847,8 @@ async function runStartup() {
33843
33847
  } else {
33844
33848
  try {
33845
33849
  const resolveResp = await fetch(
33846
- `${effectiveEndpoint}/api/sessions/resolve/${encodeURIComponent(effectiveSessionId)}`
33850
+ `${effectiveEndpoint}/api/sessions/resolve/${encodeURIComponent(effectiveSessionId)}`,
33851
+ { signal: AbortSignal.timeout(2500) }
33847
33852
  );
33848
33853
  if (resolveResp.ok) {
33849
33854
  const resolved = await resolveResp.json();
@@ -33921,6 +33926,13 @@ async function runStartup() {
33921
33926
  await validateStateDir(config2.COGENT_STATE_PATH);
33922
33927
  await checkClaudeCli2(config2.COGENT_CLAUDE_PATH);
33923
33928
  }
33929
+ const mode = isCloud ? "cloud" : "local";
33930
+ logger.info(
33931
+ `Startup complete. Mode: ${mode}, State: ${config2.COGENT_STATE_PATH}, Log level: ${config2.COGENT_LOG_LEVEL}`
33932
+ );
33933
+ }
33934
+ async function runPreflights() {
33935
+ const config2 = getConfig();
33924
33936
  if (config2.COGENT_PLATFORM === "codex") {
33925
33937
  await preflightCodex(config2.COGENT_CODEX_PATH);
33926
33938
  const sandbox = await preflightCodexSandbox(config2);
@@ -33930,10 +33942,6 @@ async function runStartup() {
33930
33942
  } else {
33931
33943
  await preflightClaude(config2.COGENT_CLAUDE_PATH);
33932
33944
  }
33933
- const mode = isCloud ? "cloud" : "local";
33934
- logger.info(
33935
- `Startup complete. Mode: ${mode}, State: ${config2.COGENT_STATE_PATH}, Log level: ${config2.COGENT_LOG_LEVEL}`
33936
- );
33937
33945
  }
33938
33946
  var UUID_V4_RE, execFileAsync3, PERSIST_PATH, legacyWarnEmitted, cloudWsClient, cloudInbox, cloudHttpClient, reRegistrationInProgress;
33939
33947
  var init_startup = __esm({
@@ -34070,11 +34078,11 @@ function registerRegisterPeerTool(server) {
34070
34078
  const hasCloudEndpointConfig = config2.COGENT_ENDPOINT && isCloudEndpoint(config2.COGENT_ENDPOINT);
34071
34079
  let sessionCreated = false;
34072
34080
  let cloudSessionId;
34081
+ let cloudToken;
34073
34082
  let autoSecret;
34074
34083
  if (hasCloudEndpointConfig && config2.COGENT_ENDPOINT) {
34075
34084
  let endpoint = config2.COGENT_ENDPOINT;
34076
34085
  cloudSessionId = config2.COGENT_SESSION_ID;
34077
- let cloudToken;
34078
34086
  if (!cloudSessionId) {
34079
34087
  const trustPersisted = hasJoinedInProcess() || process.env.COGENT_TRUST_PERSISTED_CREDENTIALS === "1";
34080
34088
  if (trustPersisted) {
@@ -34129,6 +34137,15 @@ function registerRegisterPeerTool(server) {
34129
34137
  );
34130
34138
  }
34131
34139
  }
34140
+ if (!cloudToken && isCloudDeferred(config2.COGENT_ENDPOINT)) {
34141
+ return errorResult(
34142
+ new BridgeError(
34143
+ "JOIN_NOT_CONFIRMED" /* JOIN_NOT_CONFIRMED */,
34144
+ "Cloud endpoint + COGENT_SESSION_ID are configured but this bridge has not joined the channel (no session token \u2014 the relay was unreachable or the session label did not resolve at startup). cogent_register_peer will NOT register against local state (that would leave you on no channel while other local agents' data sits on this host).",
34145
+ "Call cogent_join_session with the channel name + secret (+ Org_ID for Team channels) and confirm it returns success, then retry cogent_register_peer."
34146
+ )
34147
+ );
34148
+ }
34132
34149
  const backend = getBackend();
34133
34150
  const existing = await backend.getPeer(peerId);
34134
34151
  const channelSessionId = sessionId;
@@ -34314,6 +34331,13 @@ function registerSendMessageTool(server) {
34314
34331
  },
34315
34332
  async ({ fromPeerId, toPeerId, message }) => {
34316
34333
  try {
34334
+ if (isCloudDeferred(getConfig().COGENT_ENDPOINT)) {
34335
+ return successResult({
34336
+ success: false,
34337
+ notJoined: true,
34338
+ error: "Not connected to a channel yet \u2014 call cogent_join_session (or cogent_register_peer) first. Message not sent (cross-channel send is blocked until you join)."
34339
+ });
34340
+ }
34317
34341
  const backend = getBackend();
34318
34342
  const from = await backend.getPeer(fromPeerId);
34319
34343
  if (!from) {
@@ -35031,6 +35055,14 @@ function registerListPeersTool(server) {
35031
35055
  },
35032
35056
  async () => {
35033
35057
  try {
35058
+ if (isCloudDeferred(getConfig().COGENT_ENDPOINT)) {
35059
+ return successResult({
35060
+ peers: [],
35061
+ count: 0,
35062
+ notJoined: true,
35063
+ hint: "Not connected to a channel yet \u2014 call cogent_join_session (or cogent_register_peer) first. Local peers are withheld to prevent cross-channel disclosure."
35064
+ });
35065
+ }
35034
35066
  const backend = getBackend();
35035
35067
  const peers = await backend.listPeers();
35036
35068
  const staleTimeout = getConfig().COGENT_STALE_TIMEOUT_MS;
@@ -35095,6 +35127,16 @@ function registerGetHistoryTool(server) {
35095
35127
  },
35096
35128
  async ({ peerId, limit, includeRelayEchoes, metadataOnly, dedupInferredEchoes }) => {
35097
35129
  try {
35130
+ if (isCloudDeferred(getConfig().COGENT_ENDPOINT)) {
35131
+ return successResult({
35132
+ messages: [],
35133
+ count: 0,
35134
+ truncated: false,
35135
+ totalAvailable: 0,
35136
+ notJoined: true,
35137
+ hint: "Not connected to a channel yet \u2014 call cogent_join_session (or cogent_register_peer) first. Local history is withheld to prevent cross-channel disclosure."
35138
+ });
35139
+ }
35098
35140
  const backend = getBackend();
35099
35141
  const messages = await backend.getHistory(
35100
35142
  peerId,
@@ -35131,6 +35173,7 @@ var init_get_history = __esm({
35131
35173
  "use strict";
35132
35174
  import_zod12 = __toESM(require_zod(), 1);
35133
35175
  init_backend();
35176
+ init_config();
35134
35177
  init_errors4();
35135
35178
  init_logger();
35136
35179
  MAX_RESULT_CHARS = 5e4;
@@ -35156,6 +35199,14 @@ function registerDeregisterPeerTool(server) {
35156
35199
  },
35157
35200
  async ({ peerId }) => {
35158
35201
  try {
35202
+ if (isCloudDeferred(getConfig().COGENT_ENDPOINT)) {
35203
+ return successResult({
35204
+ success: false,
35205
+ notJoined: true,
35206
+ removed: false,
35207
+ message: "Not connected to a channel yet \u2014 call cogent_join_session (or cogent_register_peer) first. Nothing to deregister."
35208
+ });
35209
+ }
35159
35210
  const backend = getBackend();
35160
35211
  const { removed, mailboxDeprovisioned } = await backend.deregisterPeer(peerId);
35161
35212
  if (removed) heartbeat.stop();
@@ -35184,6 +35235,7 @@ var init_deregister_peer = __esm({
35184
35235
  "use strict";
35185
35236
  import_zod13 = __toESM(require_zod(), 1);
35186
35237
  init_backend();
35238
+ init_config();
35187
35239
  init_errors4();
35188
35240
  init_logger();
35189
35241
  init_heartbeat();
@@ -36132,6 +36184,11 @@ async function main() {
36132
36184
  `${SERVER_NAME} v${SERVER_VERSION} running on stdio
36133
36185
  `
36134
36186
  );
36187
+ void runPreflights().catch((err) => {
36188
+ logger.warn(
36189
+ `Preflight error (non-fatal): ${err instanceof Error ? err.message : String(err)}`
36190
+ );
36191
+ });
36135
36192
  void checkForUpdate(SERVER_VERSION).then((nudge) => {
36136
36193
  setLastNudge(nudge);
36137
36194
  if (nudge) process.stderr.write(`${nudge}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@essentialai/cogent-plugin",
3
- "version": "3.18.0",
3
+ "version": "3.19.1",
4
4
  "description": "Cogent — Claude Code plugin (skills + slash-commands + MCP server) for the cross-agent comms fabric.",
5
5
  "author": { "name": "Essential AI Solutions Ltd.", "url": "https://essentialai.uk" },
6
6
  "homepage": "https://cogent.tools",