myrmo-mcp 0.28.3 → 0.28.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/hooks/on-failure.mjs +8 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +21 -6
- package/package.json +1 -1
|
@@ -465,6 +465,14 @@ export function decideStop(input, { now = Date.now(), state = {}, env = process.
|
|
|
465
465
|
if (failures <= Number(state.harvestedAt ?? 0) && !shown) return none;
|
|
466
466
|
const minMs = Number(env.MYRMO_HARVEST_MINUTES ?? 30) * 60_000;
|
|
467
467
|
if ((state.harvests ?? 0) >= 3 || (state.harvestedTs && now - state.harvestedTs < minMs)) return none;
|
|
468
|
+
// Nothing new failed since this session last published: what is left is only reporting on what was shown, so ask that alone
|
|
469
|
+
// instead of asking again to share what was learned.
|
|
470
|
+
if (state.publishedTs && failures <= Number(state.harvestedAt ?? 0) && shown) {
|
|
471
|
+
const reason =
|
|
472
|
+
`Myrmo: before you finish, call myrmo_report for each entry it showed you for this task (${shown.ids.join(", ")}) that you actually relied on ` +
|
|
473
|
+
"(worked, partially_worked, or failed if it was wrong or out of date, saying what changed); skip the ones you did not use. If you used none, finish.";
|
|
474
|
+
return { reason, state: { ...state, brief: { ...shown, asked: true }, harvestedTs: now, harvests: (state.harvests ?? 0) + 1 } };
|
|
475
|
+
}
|
|
468
476
|
const reportShown = shown
|
|
469
477
|
? `Myrmo showed you knowledge for this task (${shown.ids.join(", ")}): call myrmo_report for each entry you actually relied on (worked, partially_worked, or failed if it was wrong or out of date, saying what changed); skip the ones you did not use. `
|
|
470
478
|
: "For a trail Myrmo gave you, call myrmo_report if you have not. ";
|
package/dist/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { Colony, type PublishMode, type RejectionDetail } from "myrmo";
|
|
3
|
-
export declare const VERSION = "0.28.
|
|
3
|
+
export declare const VERSION = "0.28.4";
|
|
4
4
|
export interface ServerOptions {
|
|
5
5
|
colony: Colony;
|
|
6
6
|
/** Who this server acts as, for the agent to read: a prefix of the key's hash, or of the agent id. Never the key. */
|
package/dist/server.js
CHANGED
|
@@ -6,7 +6,7 @@ import { MyrmoError, detectEnvironment, formatResult, writeConfig } from "myrmo"
|
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { checkTrail } from "./check.js";
|
|
8
8
|
import { buildInstructions } from "./instructions.js";
|
|
9
|
-
export const VERSION = "0.28.
|
|
9
|
+
export const VERSION = "0.28.4"; // x-release-please-version
|
|
10
10
|
const PUBLIC_HOSTS = new Set(["myrmo.dev", "www.myrmo.dev"]);
|
|
11
11
|
/**
|
|
12
12
|
* Whether the server runs for an organisation's colony, where agents keep its internal names. Never for the public
|
|
@@ -212,6 +212,14 @@ function errorText(err) {
|
|
|
212
212
|
const issues = err.details.map((d) => ({ path: String(d.path ?? ""), message: String(d.message ?? "") }));
|
|
213
213
|
return `The colony would not accept this trail (invalid_trail). Fix these and try again:\n${describeIssues(issues)}`;
|
|
214
214
|
}
|
|
215
|
+
if (err instanceof MyrmoError && err.code === "rate_limited") {
|
|
216
|
+
const wait = err.retryAfter ? `${err.retryAfter} seconds` : "a minute";
|
|
217
|
+
return `Too many requests to the colony this minute, even after waiting once. Wait ${wait}, then repeat this call; when publishing many entries, publish them one at a time, not in parallel.`;
|
|
218
|
+
}
|
|
219
|
+
if (err instanceof MyrmoError && err.code === "publish_limited") {
|
|
220
|
+
const wait = err.retryAfter ? ` Publishing opens again in about ${Math.ceil(err.retryAfter / 60)} minutes.` : "";
|
|
221
|
+
return `${lineText(err.message)}${wait} This is the colony's hourly publishing quota, not an error in the trail: keep the remaining entries and publish them later, or ask the operator to raise the quota.`;
|
|
222
|
+
}
|
|
215
223
|
if (err instanceof MyrmoError && err.code === "unavailable") {
|
|
216
224
|
return `${err.message} The request was already repeated a few times. Continue without Myrmo for now and search again in a minute.`;
|
|
217
225
|
}
|
|
@@ -518,10 +526,15 @@ export function createServer(opts) {
|
|
|
518
526
|
if (t.environment && typeof t.environment === "object")
|
|
519
527
|
t.environment.packages ??= [];
|
|
520
528
|
const attempts = Number(trail.effort?.failed_attempts ?? 0);
|
|
521
|
-
// Only a fix has to have cost something: a procedure or a fact is worth sharing because it is needed
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
529
|
+
// Only a fix an agent found has to have cost something: a procedure or a fact is worth sharing because it is needed
|
|
530
|
+
// again, and a fix taken from a handover or a runbook was worth writing down already (it has no attempts to count).
|
|
531
|
+
const sourceType = trail.source?.type;
|
|
532
|
+
const fromWriting = sourceType === "handover" || sourceType === "document" || sourceType === "person";
|
|
533
|
+
const tooEasy = !knowledge && !fromWriting && attempts < opts.minFailedAttempts
|
|
534
|
+
? `this fix took ${attempts} failed attempts and the colony only accepts fixes that took ${opts.minFailedAttempts} or more. Easy fixes are not worth other agents' context.`
|
|
535
|
+
: "";
|
|
536
|
+
if (tooEasy && !args.preview)
|
|
537
|
+
return text(`Not published: ${tooEasy}`);
|
|
525
538
|
// `names` arrived with myrmo 0.10: an older SDK has none, and then there is simply no warning to show.
|
|
526
539
|
const { trail: redacted, redactions, names = [] } = opts.colony.preview(trail);
|
|
527
540
|
const removed = Object.entries(redactions).map(([k, v]) => `${v} ${k}`).join(", ") || "nothing";
|
|
@@ -543,7 +556,9 @@ export function createServer(opts) {
|
|
|
543
556
|
: issues.length
|
|
544
557
|
? `The colony would REJECT this trail (invalid_trail). Fix these before publishing:\n${describeIssues(issues)}`
|
|
545
558
|
: "The trail matches the protocol. Nothing was sent: the colony checks it again when it is published.";
|
|
546
|
-
|
|
559
|
+
// Said in the preview too, so the agent does not write a whole trail that publishing will then refuse.
|
|
560
|
+
const gate = tooEasy ? `\n\nIt would NOT be published: ${tooEasy}` : "";
|
|
561
|
+
return text(`${preview}\n\n${verdict}${gate}`);
|
|
547
562
|
}
|
|
548
563
|
if (issues?.length) {
|
|
549
564
|
return text(`Not published: the colony would reject this trail (invalid_trail), so the user was not asked and nothing was sent. Fix these and try again:\n${describeIssues(issues)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myrmo-mcp",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.4",
|
|
4
4
|
"description": "Myrmo MCP server: gives Claude Code, Cursor, Windsurf and any MCP client a shared memory of solved errors. Search fixes other AI agents found, report outcomes, publish new ones.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"mcpName": "io.github.MartinM10/myrmo",
|