@codeforbreakfast/commy-mcp 0.19.1 → 0.20.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/package.json +1 -1
- package/server.js +19 -5
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -47718,6 +47718,7 @@ var markReplayed = (events) => events.map((ev) => {
|
|
|
47718
47718
|
return ev;
|
|
47719
47719
|
});
|
|
47720
47720
|
var defaultRetrySchedule = exports_Schedule.exponential(exports_Duration.seconds(1)).pipe(exports_Schedule.either(exports_Schedule.spaced(exports_Duration.seconds(30))));
|
|
47721
|
+
var RESUME_VERDICT_FALLBACK = exports_Duration.seconds(60);
|
|
47721
47722
|
var skipWithLog = (line) => exports_Effect.logInfo(line).pipe(exports_Effect.as([]));
|
|
47722
47723
|
var processSingleEvent = (evt, directory, config2) => {
|
|
47723
47724
|
if (evt.type === "message") {
|
|
@@ -47749,7 +47750,7 @@ var processSingleEvent = (evt, directory, config2) => {
|
|
|
47749
47750
|
}
|
|
47750
47751
|
return exports_Effect.succeed([]);
|
|
47751
47752
|
};
|
|
47752
|
-
var inboxEvents = (config2) => exports_Stream.
|
|
47753
|
+
var inboxEvents = (config2) => exports_Stream.unwrapScoped(exports_Effect.gen(function* () {
|
|
47753
47754
|
const watermark = config2.watermarkStore ?? (yield* createWatermarkStore());
|
|
47754
47755
|
const breadcrumb = yield* exports_Ref.make({
|
|
47755
47756
|
consecutiveFailures: 0,
|
|
@@ -47762,6 +47763,9 @@ var inboxEvents = (config2) => exports_Stream.unwrap(exports_Effect.gen(function
|
|
|
47762
47763
|
return exports_Effect.void;
|
|
47763
47764
|
return exports_Ref.getAndSet(resumeReported, true).pipe(exports_Effect.flatMap((already) => already ? exports_Effect.void : onResumeOutcome(queueReplayed)));
|
|
47764
47765
|
};
|
|
47766
|
+
if (config2.onResumeOutcome !== undefined) {
|
|
47767
|
+
yield* exports_Effect.forkScoped(exports_Effect.sleep(RESUME_VERDICT_FALLBACK).pipe(exports_Effect.zipRight(reportResume(false))));
|
|
47768
|
+
}
|
|
47765
47769
|
const recordTransientFailure = (cause3) => exports_Ref.modify(breadcrumb, (s) => {
|
|
47766
47770
|
const consecutiveFailures = s.consecutiveFailures + 1;
|
|
47767
47771
|
return [consecutiveFailures, { consecutiveFailures, needsBreadcrumb: true }];
|
|
@@ -48403,15 +48407,25 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
|
|
|
48403
48407
|
})))
|
|
48404
48408
|
})))), exports_Effect.mapError((cause3) => cause3 instanceof PublisherError ? cause3 : new PublisherError({ operation, cause: cause3 })));
|
|
48405
48409
|
};
|
|
48410
|
+
const addressThread = (channel, thread) => {
|
|
48411
|
+
const resolvedTopic = applyResolvedPrefix(thread, true);
|
|
48412
|
+
return findNewestInTopic(channel, thread).pipe(exports_Effect.flatMap(exports_Option.match({
|
|
48413
|
+
onSome: () => exports_Effect.succeed({ topic: thread, resolved: false }),
|
|
48414
|
+
onNone: () => findNewestInTopic(channel, resolvedTopic).pipe(exports_Effect.map(exports_Option.match({
|
|
48415
|
+
onSome: () => ({ topic: resolvedTopic, resolved: true }),
|
|
48416
|
+
onNone: () => ({ topic: thread, resolved: false })
|
|
48417
|
+
})))
|
|
48418
|
+
})));
|
|
48419
|
+
};
|
|
48406
48420
|
const publisher = {
|
|
48407
48421
|
post: (channel, body, opts) => {
|
|
48408
48422
|
const thread = opts?.thread;
|
|
48409
|
-
return boundHttp().pipe(exports_Effect.flatMap((http) => resolvePublishChannel(channel).pipe(exports_Effect.flatMap((effective) => http.post("/messages", sentMessageSchema, {
|
|
48423
|
+
return boundHttp().pipe(exports_Effect.flatMap((http) => resolvePublishChannel(channel).pipe(exports_Effect.flatMap((effective) => (thread === undefined ? exports_Effect.succeed({ topic: "(no topic)", resolved: false }) : addressThread(effective.name, thread)).pipe(exports_Effect.flatMap((addressed) => http.post("/messages", sentMessageSchema, {
|
|
48410
48424
|
type: "channel",
|
|
48411
48425
|
to: effective.name,
|
|
48412
48426
|
content: body,
|
|
48413
|
-
topic:
|
|
48414
|
-
}).pipe(exports_Effect.flatMap((sent) => decodeMessageId(String(sent.id)).pipe(exports_Effect.map((id3) => decorateMessageRef(id3, effective, thread === undefined ? undefined : { name: thread, resolved:
|
|
48427
|
+
topic: addressed.topic
|
|
48428
|
+
}).pipe(exports_Effect.flatMap((sent) => decodeMessageId(String(sent.id)).pipe(exports_Effect.map((id3) => decorateMessageRef(id3, effective, thread === undefined ? undefined : { name: thread, resolved: addressed.resolved })))))))))), exports_Effect.mapError((cause3) => cause3 instanceof UnknownChannel ? cause3 : new PublisherError({ operation: "post", cause: cause3 })));
|
|
48415
48429
|
},
|
|
48416
48430
|
edit: (message, body) => boundHttp().pipe(exports_Effect.flatMap((http) => http.patch(`/messages/${encodeURIComponent(message.id)}`, successSchema2, {
|
|
48417
48431
|
content: body
|
|
@@ -58892,7 +58906,7 @@ class Server extends Protocol {
|
|
|
58892
58906
|
}
|
|
58893
58907
|
|
|
58894
58908
|
// packages/mcp/mcp-server.ts
|
|
58895
|
-
var PLUGIN_VERSION = "0.
|
|
58909
|
+
var PLUGIN_VERSION = "0.20.0";
|
|
58896
58910
|
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.
|
|
58897
58911
|
|
|
58898
58912
|
**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.
|