@codeforbreakfast/commy-mcp 0.24.0-rc.2 → 0.24.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +25 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeforbreakfast/commy-mcp",
3
- "version": "0.24.0-rc.2",
3
+ "version": "0.24.1",
4
4
  "description": "commy MCP server — the inter-agent communication substrate, runnable on node via npx.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/server.js CHANGED
@@ -57343,13 +57343,16 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
57343
57343
  const byId = new Map;
57344
57344
  const byName = new Map;
57345
57345
  const byIdentityId = new Map;
57346
+ const active2 = new Set;
57346
57347
  for (const u of members) {
57347
57348
  const ident = yield* toIdentity(u);
57348
57349
  byId.set(ZulipUserRef(u.user_id), ident);
57349
57350
  byName.set(u.full_name, ident);
57350
57351
  byIdentityId.set(ident.id, ZulipUserRef(u.user_id));
57352
+ if (u.is_active)
57353
+ active2.add(ident.id);
57351
57354
  }
57352
- return { byId, byName, byIdentityId };
57355
+ return { byId, byName, byIdentityId, active: active2 };
57353
57356
  })));
57354
57357
  const recipientDirectory = () => buildDirectoryLookup().pipe(exports_Effect.map((lookup) => ({
57355
57358
  byId: new Map([...lookup.byId.entries()].map(([id3, ident]) => [id3, { kind: ident.kind }]))
@@ -57358,8 +57361,18 @@ var zulipAdapter = (config3) => exports_Effect.gen(function* () {
57358
57361
  byName: directory2.byName,
57359
57362
  byUserId: (userId) => directory2.byId.get(ZulipUserRef(userId))
57360
57363
  });
57364
+ const notifiableMentionDirectory = (directory2) => {
57365
+ const isActive2 = (identity7) => identity7 !== undefined && directory2.active.has(identity7.id);
57366
+ return {
57367
+ byName: new Map([...directory2.byName].filter(([, identity7]) => isActive2(identity7))),
57368
+ byUserId: (userId) => {
57369
+ const identity7 = directory2.byId.get(ZulipUserRef(userId));
57370
+ return isActive2(identity7) ? identity7 : undefined;
57371
+ }
57372
+ };
57373
+ };
57361
57374
  const validateOutboundMentions = (operation, body) => !mentionTokens(body).some(MentionToken.$is("UserToken")) ? exports_Effect.void : buildDirectoryLookup().pipe(exports_Effect.flatMap((directory2) => {
57362
- const dead = unresolvedMentions(body, mentionDirectory(directory2));
57375
+ const dead = unresolvedMentions(body, notifiableMentionDirectory(directory2));
57363
57376
  return dead.length === 0 ? exports_Effect.void : exports_Effect.fail(new UnresolvedMention({ operation, tokens: dead, substrate: "zulip" }));
57364
57377
  }));
57365
57378
  const mapHistoricalReactions = (raw3, directory2) => exports_Effect.gen(function* () {
@@ -58359,7 +58372,7 @@ var catchUpChannels = (deps) => exports_Effect.gen(function* () {
58359
58372
  const since = yield* clampedSince(now2, deps.windowSeconds);
58360
58373
  const newTopicsSince = yield* clampedSince(now2, deps.newTopicsWindowSeconds ?? deps.windowSeconds);
58361
58374
  const batches = yield* exports_Effect.forEach(deps.intents, (intent) => fetchForIntent(intent, deps.history, since, newTopicsSince).pipe(catchUpAt("history")), { concurrency: 2 });
58362
- const messages = exports_Array.sort(exports_Array.flatten(batches), exports_Order.mapInput(exports_Order.number, (m) => m.ts));
58375
+ const messages = exports_Array.sort(exports_Array.filter(exports_Array.flatten(batches), (m) => m.sender.id !== deps.botIdentityId), exports_Order.mapInput(exports_Order.number, (m) => m.ts));
58363
58376
  yield* exports_Effect.forEach(messages, (message) => exports_Effect.tryPromise({
58364
58377
  try: () => deps.notifier(formatMessage({ kind: "message-posted", message }, deps.botIdentityId)),
58365
58378
  catch: (cause3) => new CatchUpError({ stage: "dispatch", cause: cause3 })
@@ -58547,8 +58560,7 @@ var createSingleIdentityCache = (deps) => {
58547
58560
  const current2 = ensureBound.current();
58548
58561
  return current2 === undefined ? new Set : new Set([current2.identity.id]);
58549
58562
  },
58550
- releaseAllBound: () => exports_Effect.void,
58551
- sweepIdle: () => exports_Effect.void
58563
+ releaseAllBound: () => exports_Effect.void
58552
58564
  };
58553
58565
  };
58554
58566
  var unboundStub = Object.assign(() => exports_Effect.fail(new UnboundEphemeralSession({
@@ -58563,24 +58575,23 @@ var createEphemeralIdentityCache = (deps) => exports_Effect.map(exports_Synchron
58563
58575
  });
58564
58576
  const afterAcquireFor = (project3, sessionId) => (acquired) => deps.onAcquire !== undefined ? deps.onAcquire(acquired, project3, sessionId) : exports_Effect.void;
58565
58577
  const acquireForTransition = (priorEnsure) => (n) => priorEnsure.current() !== undefined ? deps.release().pipe(exports_Effect.zipRight(deps.acquire(n))) : deps.acquire(n);
58566
- const mintSlot = (sessionId, project3, nowMs, prior) => {
58578
+ const mintSlot = (sessionId, project3, prior) => {
58567
58579
  const name = deriveBotName(sessionId, project3);
58568
58580
  const acquire = prior !== undefined ? acquireForTransition(prior.ensureBound) : deps.acquire;
58569
58581
  return createEnsureBound({
58570
58582
  acquire,
58571
58583
  name,
58572
58584
  afterAcquire: afterAcquireFor(project3, sessionId)
58573
- }).pipe(exports_Effect.map((ensureBound) => [ensureBound, { sessionId, ensureBound, lastUsedMs: nowMs }]));
58585
+ }).pipe(exports_Effect.map((ensureBound) => [ensureBound, { sessionId, ensureBound }]));
58574
58586
  };
58575
58587
  const releaseBoundSlot = exports_SynchronizedRef.updateEffect(slotRef, (slot) => exports_Effect.as(slot !== undefined && slot.ensureBound.current() !== undefined ? deps.release() : exports_Effect.void, undefined));
58576
58588
  return {
58577
- ensureBoundFor: (sessionId, project3) => sessionId === undefined ? exports_Effect.succeed(unboundStub) : exports_Clock.currentTimeMillis.pipe(exports_Effect.flatMap((nowMs) => exports_SynchronizedRef.modifyEffect(slotRef, (slot) => {
58589
+ ensureBoundFor: (sessionId, project3) => sessionId === undefined ? exports_Effect.succeed(unboundStub) : exports_SynchronizedRef.modifyEffect(slotRef, (slot) => {
58578
58590
  if (slot !== undefined && slot.sessionId === sessionId) {
58579
- const bumped = { ...slot, lastUsedMs: nowMs };
58580
- return exports_Effect.succeed([slot.ensureBound, bumped]);
58591
+ return exports_Effect.succeed([slot.ensureBound, slot]);
58581
58592
  }
58582
- return mintSlot(sessionId, project3, nowMs, slot);
58583
- }))),
58593
+ return mintSlot(sessionId, project3, slot);
58594
+ }),
58584
58595
  boundIdentityIds: () => {
58585
58596
  const slot = exports_Effect.runSync(exports_SynchronizedRef.get(slotRef));
58586
58597
  if (slot === undefined)
@@ -58588,8 +58599,7 @@ var createEphemeralIdentityCache = (deps) => exports_Effect.map(exports_Synchron
58588
58599
  const current2 = slot.ensureBound.current();
58589
58600
  return current2 === undefined ? new Set : new Set([current2.identity.id]);
58590
58601
  },
58591
- releaseAllBound: () => releaseBoundSlot,
58592
- sweepIdle: (nowMs) => exports_SynchronizedRef.updateEffect(slotRef, (slot) => slot !== undefined && slot.ensureBound.current() !== undefined && nowMs - slot.lastUsedMs > deps.idleReleaseMs ? exports_Effect.as(deps.release(), undefined) : exports_Effect.succeed(slot))
58602
+ releaseAllBound: () => releaseBoundSlot
58593
58603
  };
58594
58604
  });
58595
58605
  // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
@@ -60013,7 +60023,7 @@ class Server extends Protocol {
60013
60023
  }
60014
60024
 
60015
60025
  // packages/mcp/mcp-server.ts
60016
- var PLUGIN_VERSION = "0.24.0-rc.2";
60026
+ var PLUGIN_VERSION = "0.24.1";
60017
60027
  var COMMY_INSTRUCTIONS = `**Substrate.** commy is the inter-agent channel: agents and humans coordinate here. If you run it alongside other agent-messaging tools, keep one substrate canonical and don't fan the same message across all of them.
60018
60028
 
60019
60029
  **Channels.** Each project has one channel: \`#<project-slug>\` where the slug is resolved per session as \`COMMY_PROJECT\` env > git remote \`origin\` basename > git root basename. Sessions launched outside a git repo (e.g. \`/tmp\`, \`$HOME\`) have no project channel and should post to \`#general\` instead. Don't invent a channel name from a metaphor — never post to a literal \`#home\`, \`#project\`, or \`#<project>\`. Use \`list_channels\` to enumerate what actually exists in the realm; posting to a non-existent channel throws \`UnknownChannel\` rather than silently routing to Notification Bot.
@@ -61020,12 +61030,6 @@ var registerTools = (server, deps) => {
61020
61030
  class BootError extends exports_Data.TaggedError("BootError") {
61021
61031
  }
61022
61032
  var RELEASE_TIMEOUT_MS = 5000;
61023
- var EPHEMERAL_IDLE_RELEASE_MS = 60 * 60 * 1000;
61024
- var EPHEMERAL_IDLE_SWEEP_INTERVAL_MS = 5 * 60 * 1000;
61025
- var forkIdleSweep = (cache, intervalMs) => {
61026
- const sweep = exports_Clock.currentTimeMillis.pipe(exports_Effect.flatMap((nowMs) => cache.sweepIdle(nowMs)));
61027
- return exports_Effect.asVoid(exports_Effect.forkScoped(exports_Effect.repeat(sweep, exports_Schedule.spaced(exports_Duration.millis(intervalMs)))));
61028
- };
61029
61033
  var createType2DefaultsOnAcquire = (narrowSet, inbox) => {
61030
61034
  const registerIntent = (intent) => exports_Effect.sync(() => narrowSet.add(intent)).pipe(exports_Effect.zipRight(inbox.subscribe(intentToTarget(intent))));
61031
61035
  return (project3) => (project3 !== undefined ? exports_Effect.all([decodeChannelName(project3), decodeThreadName("general")]).pipe(exports_Effect.flatMap(([channelName, threadName3]) => registerIntent({ kind: "thread", channelName, threadName: threadName3 }))) : exports_Effect.void).pipe(exports_Effect.catchAll((err) => exports_Effect.logError(`commy plugin: Type-2 default narrow registration failed: ${exports_Cause.pretty(exports_Cause.fail(err))}`)));
@@ -61047,7 +61051,6 @@ var buildIdentityCache = (adapter4, botName, ephemeralOnAcquire) => {
61047
61051
  return createEphemeralIdentityCache({
61048
61052
  acquire: adapter4.identity.acquire,
61049
61053
  release: adapter4.identity.release,
61050
- idleReleaseMs: EPHEMERAL_IDLE_RELEASE_MS,
61051
61054
  ...ephemeralOnAcquire !== undefined ? { onAcquire: ephemeralOnAcquire } : {}
61052
61055
  });
61053
61056
  };
@@ -61154,7 +61157,6 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
61154
61157
  }
61155
61158
  const releasePersistent = parsed.botName !== undefined;
61156
61159
  yield* exports_Effect.addFinalizer(() => identityCache.boundIdentityIds().size > 0 ? raceReleaseAgainstTimeout(adapter4.identity.release({ persistent: releasePersistent }), RELEASE_TIMEOUT_MS) : exports_Effect.void);
61157
- const runsIdleSweep = parsed.botName === undefined;
61158
61160
  const bootSessionId = yield* exports_Deferred.poll(sessionIdDeferred).pipe(exports_Effect.flatMap(exports_Option.match({
61159
61161
  onNone: () => exports_Effect.succeedNone,
61160
61162
  onSome: (awaitId) => exports_Effect.asSome(awaitId)
@@ -61233,9 +61235,6 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
61233
61235
  onRealmSettings: (settings) => exports_Effect.sync(() => toolsCache.setEditingAvailable(settings.editingAvailable)).pipe(exports_Effect.zipRight(exports_Effect.promise(() => mcp.sendToolListChanged()).pipe(exports_Effect.catchAllCause(logSettingsFailure(`tools/list_changed after editing=${settings.editingAvailable}`)))))
61234
61236
  });
61235
61237
  yield* exports_Effect.addFinalizer(() => pump.cancel);
61236
- if (runsIdleSweep) {
61237
- yield* forkIdleSweep(identityCache, EPHEMERAL_IDLE_SWEEP_INTERVAL_MS);
61238
- }
61239
61238
  yield* exports_Effect.forkScoped(rebuildNarrowSet);
61240
61239
  yield* exports_Effect.raceFirst(pump.done, params.shutdownSignal ?? exports_Effect.never);
61241
61240
  }));
@@ -61269,7 +61268,6 @@ if (__require.main == __require.module) {
61269
61268
  export {
61270
61269
  makeProgram,
61271
61270
  main,
61272
- forkIdleSweep,
61273
61271
  clientDisconnect,
61274
61272
  PlatformLive,
61275
61273
  MainLive,