myrmo-mcp 0.33.0 → 0.35.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/dist/doctor.d.ts +17 -0
- package/dist/doctor.js +123 -1
- package/dist/hooks/cline-hook.mjs +169 -0
- package/dist/hooks/worklog.mjs +17 -5
- package/dist/init.d.ts +25 -0
- package/dist/init.js +136 -5
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/doctor.d.ts
CHANGED
|
@@ -18,11 +18,28 @@ export interface DoctorInput {
|
|
|
18
18
|
people_detail?: string | null;
|
|
19
19
|
holdout_percent?: number;
|
|
20
20
|
effort?: boolean;
|
|
21
|
+
worklog_scopes?: string[];
|
|
21
22
|
};
|
|
22
23
|
publish: string;
|
|
23
24
|
nodeVersion?: string;
|
|
24
25
|
home: string;
|
|
25
26
|
fetchImpl?: typeof fetch;
|
|
27
|
+
/** The environment this command runs in: where MYRMO_WORKLOG is looked for (default: process.env). */
|
|
28
|
+
env?: NodeJS.ProcessEnv;
|
|
29
|
+
platform?: NodeJS.Platform;
|
|
26
30
|
}
|
|
31
|
+
/** The node a Cline hook file starts, as init wrote it; undefined when the file is not ours or has another shape. */
|
|
32
|
+
export declare function clineHookNode(text: string): string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Where Claude Code gets MYRMO_WORKLOG=1, or null: the shell this runs in, the `env` block of ~/.claude/settings.json
|
|
35
|
+
* (which applies however Claude Code is started, from a terminal or from VS Code), or a work log hook registered there
|
|
36
|
+
* with the variable on its own command line.
|
|
37
|
+
*/
|
|
38
|
+
export declare function claudeWorkLogSource(home: string, env: NodeJS.ProcessEnv): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* The work log, client by client: which agents on this machine record what they do in it, and which cannot yet. Only
|
|
41
|
+
* for a colony that keeps one; nothing is sent and no text is read.
|
|
42
|
+
*/
|
|
43
|
+
export declare function workLogChecks(input: DoctorInput, fetchImpl: typeof fetch): Promise<Check[]>;
|
|
27
44
|
export declare function diagnose(input: DoctorInput): Promise<Check[]>;
|
|
28
45
|
export declare function render(checks: Check[]): string;
|
package/dist/doctor.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// trail is read: it asks the colony whether it is up, whether it lets this network in and whether this key opens it.
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { join } from "node:path";
|
|
6
|
-
import { claudeCodeSetUp } from "./init.js";
|
|
6
|
+
import { CLINE_HOOK_EVENTS, CLINE_MARK, claudeCodeSetUp, claudeWorkLogHook, clineHooksDir, clineInstalled, targets } from "./init.js";
|
|
7
7
|
import { compareVersions, describeColony, VERSION, VERSION_SHAPE } from "./server.js";
|
|
8
8
|
import { t } from "./i18n.js";
|
|
9
9
|
const PUBLIC_HOSTS = new Set(["myrmo.dev", "www.myrmo.dev"]);
|
|
@@ -20,6 +20,127 @@ async function call(fetchImpl, url, key) {
|
|
|
20
20
|
return { error: String(cause) };
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
/** The node a Cline hook file starts, as init wrote it; undefined when the file is not ours or has another shape. */
|
|
24
|
+
export function clineHookNode(text) {
|
|
25
|
+
if (!text.includes(CLINE_MARK))
|
|
26
|
+
return undefined;
|
|
27
|
+
return /exec '((?:[^']|'\\'')+)'/.exec(text)?.[1]?.replace(/'\\''/g, "'") ?? /& "([^"]+)"/.exec(text)?.[1];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Where Claude Code gets MYRMO_WORKLOG=1, or null: the shell this runs in, the `env` block of ~/.claude/settings.json
|
|
31
|
+
* (which applies however Claude Code is started, from a terminal or from VS Code), or a work log hook registered there
|
|
32
|
+
* with the variable on its own command line.
|
|
33
|
+
*/
|
|
34
|
+
export function claudeWorkLogSource(home, env) {
|
|
35
|
+
let settings;
|
|
36
|
+
try {
|
|
37
|
+
settings = JSON.parse(readFileSync(join(home, ".claude", "settings.json"), "utf8"));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
settings = undefined;
|
|
41
|
+
}
|
|
42
|
+
if (String(settings?.env?.MYRMO_WORKLOG ?? "") === "1")
|
|
43
|
+
return t("MYRMO_WORKLOG=1 in ~/.claude/settings.json", "MYRMO_WORKLOG=1 en ~/.claude/settings.json");
|
|
44
|
+
if (/MYRMO_WORKLOG=1[^"]*worklog-hook\.mjs/.test(JSON.stringify(settings?.hooks ?? "")))
|
|
45
|
+
return t("the work log hook in ~/.claude/settings.json", "el hook del registro en ~/.claude/settings.json");
|
|
46
|
+
if (env.MYRMO_WORKLOG === "1")
|
|
47
|
+
return t("MYRMO_WORKLOG=1 in this shell", "MYRMO_WORKLOG=1 en esta terminal");
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The work log, client by client: which agents on this machine record what they do in it, and which cannot yet. Only
|
|
52
|
+
* for a colony that keeps one; nothing is sent and no text is read.
|
|
53
|
+
*/
|
|
54
|
+
export async function workLogChecks(input, fetchImpl) {
|
|
55
|
+
const scopes = input.declared?.worklog_scopes;
|
|
56
|
+
if (!input.privateMode || !Array.isArray(scopes) || scopes.length === 0)
|
|
57
|
+
return [];
|
|
58
|
+
const name = t("Work log", "Registro de trabajo");
|
|
59
|
+
const checks = [];
|
|
60
|
+
const env = input.env ?? process.env;
|
|
61
|
+
const platform = input.platform ?? process.platform;
|
|
62
|
+
const enrolled = await call(fetchImpl, `${input.url.replace(/\/+$/, "")}/v1/worklog/matters?limit=1`, input.apiKey);
|
|
63
|
+
if ("status" in enrolled && enrolled.status === 403) {
|
|
64
|
+
checks.push({ level: "warn", name, detail: t("this colony keeps one, but your key is not enrolled in it", "esta colonia lo lleva, pero tu clave no está inscrita"), fix: t("Ask whoever runs the colony to add your key's name to MYRMO_WORKLOG_PEOPLE", "Pide a quien opera la colonia que añada el nombre de tu clave a MYRMO_WORKLOG_PEOPLE") });
|
|
65
|
+
return checks;
|
|
66
|
+
}
|
|
67
|
+
if (existsSync(join(input.home, ".myrmo", "worklog-paused")) || env.MYRMO_WORKLOG_PAUSE === "1") {
|
|
68
|
+
checks.push({ level: "warn", name, detail: t("paused on this machine: nothing is recorded", "en pausa en esta máquina: no se registra nada"), fix: t("Delete ~/.myrmo/worklog-paused (and unset MYRMO_WORKLOG_PAUSE) to resume", "Borra ~/.myrmo/worklog-paused (y quita MYRMO_WORKLOG_PAUSE) para reanudar") });
|
|
69
|
+
}
|
|
70
|
+
let capturing = 0;
|
|
71
|
+
if (claudeCodeSetUp(input.home)) {
|
|
72
|
+
const source = claudeWorkLogSource(input.home, env);
|
|
73
|
+
let settingsText = "";
|
|
74
|
+
try {
|
|
75
|
+
settingsText = readFileSync(join(input.home, ".claude", "settings.json"), "utf8");
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
settingsText = "";
|
|
79
|
+
}
|
|
80
|
+
const hook = claudeWorkLogHook(settingsText);
|
|
81
|
+
const plugin = /"MYRMO_WORKLOG"\s*:\s*"1"/.test(settingsText) || env.MYRMO_WORKLOG === "1";
|
|
82
|
+
if (hook && plugin) {
|
|
83
|
+
capturing++;
|
|
84
|
+
checks.push({ level: "warn", name: `${name}, Claude Code`, detail: t("recorded twice: by the plugin (MYRMO_WORKLOG=1) and by a work log hook of its own", "se registra dos veces: por el plugin (MYRMO_WORKLOG=1) y por un hook del registro aparte"), fix: t("Keep one: remove the worklog-hook.mjs entries from ~/.claude/settings.json, or MYRMO_WORKLOG=1 from its env", "Deja uno: quita de ~/.claude/settings.json las entradas de worklog-hook.mjs, o MYRMO_WORKLOG=1 de su env") });
|
|
85
|
+
}
|
|
86
|
+
else if (source) {
|
|
87
|
+
capturing++;
|
|
88
|
+
checks.push({ level: "ok", name: `${name}, Claude Code`, detail: t(`recorded (${source})`, `se registra (${source})`) });
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
checks.push({
|
|
92
|
+
level: "warn",
|
|
93
|
+
name: `${name}, Claude Code`,
|
|
94
|
+
detail: t("not recorded: MYRMO_WORKLOG=1 is set nowhere Claude Code reads it", "no se registra: MYRMO_WORKLOG=1 no está en ningún sitio que lea Claude Code"),
|
|
95
|
+
fix: t('Add "env": { "MYRMO_WORKLOG": "1" } to ~/.claude/settings.json (it works however Claude Code is started), then restart it', 'Añade "env": { "MYRMO_WORKLOG": "1" } a ~/.claude/settings.json (vale arranques Claude Code como lo arranques) y reinícialo'),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (clineInstalled(input.home)) {
|
|
100
|
+
const missing = [];
|
|
101
|
+
const foreign = [];
|
|
102
|
+
const broken = [];
|
|
103
|
+
for (const event of CLINE_HOOK_EVENTS) {
|
|
104
|
+
const file = join(clineHooksDir(input.home), platform === "win32" ? `${event}.ps1` : event);
|
|
105
|
+
if (!existsSync(file)) {
|
|
106
|
+
missing.push(event);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const node = clineHookNode(readFileSync(file, "utf8"));
|
|
110
|
+
if (!node)
|
|
111
|
+
foreign.push(event);
|
|
112
|
+
else if (!existsSync(node))
|
|
113
|
+
broken.push(event);
|
|
114
|
+
}
|
|
115
|
+
const fix = t("npx myrmo-mcp@latest init --worklog then reload VS Code (Developer: Reload Window)", "npx myrmo-mcp@latest init --worklog y recarga VS Code (Developer: Reload Window)");
|
|
116
|
+
if (missing.length === CLINE_HOOK_EVENTS.length) {
|
|
117
|
+
checks.push({ level: "warn", name: `${name}, Cline`, detail: t("not recorded: the hooks are not installed", "no se registra: los hooks no están instalados"), fix });
|
|
118
|
+
}
|
|
119
|
+
else if (broken.length) {
|
|
120
|
+
checks.push({ level: "warn", name: `${name}, Cline`, detail: t(`not recorded: the hooks start a node that no longer exists (${broken.join(", ")})`, `no se registra: los hooks arrancan un node que ya no existe (${broken.join(", ")})`), fix });
|
|
121
|
+
}
|
|
122
|
+
else if (missing.length) {
|
|
123
|
+
checks.push({ level: "warn", name: `${name}, Cline`, detail: t(`incomplete: ${missing.join(", ")} missing`, `incompleto: falta ${missing.join(", ")}`), fix });
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
capturing++;
|
|
127
|
+
checks.push({ level: "ok", name: `${name}, Cline`, detail: foreign.length ? t(`recorded, except ${foreign.join(", ")}: hooks of your own are in their place`, `se registra, salvo ${foreign.join(", ")}: en su lugar hay hooks tuyos`) : t("recorded (hooks in place; reload VS Code once after installing them)", "se registra (hooks instalados; recarga VS Code una vez tras instalarlos)") });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Everything else Myrmo can set up talks to the colony through its tools, but has no hook that records the work.
|
|
131
|
+
const others = targets(input.home, platform)
|
|
132
|
+
.filter((c) => c.id !== "claude-desktop" && existsSync(c.file) && /myrmo/i.test(readFileSync(c.file, "utf8")))
|
|
133
|
+
.map((c) => c.name);
|
|
134
|
+
if (others.length) {
|
|
135
|
+
checks.push({
|
|
136
|
+
level: capturing ? "ok" : "warn",
|
|
137
|
+
name: t(`${name}, other agents`, `${name}, otros agentes`),
|
|
138
|
+
detail: t(`${others.join(", ")}: not recorded (Myrmo has no work log hook for them yet); their agents can still read it with myrmo_matters`, `${others.join(", ")}: no se registra (Myrmo aún no tiene hook del registro para ellos); sus agentes sí pueden leerlo con myrmo_matters`),
|
|
139
|
+
...(capturing ? {} : { fix: t("Use Claude Code or Cline for the work you want in the work log", "Usa Claude Code o Cline para el trabajo que quieras en el registro") }),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return checks;
|
|
143
|
+
}
|
|
23
144
|
export async function diagnose(input) {
|
|
24
145
|
const checks = [];
|
|
25
146
|
const fetchImpl = input.fetchImpl ?? fetch;
|
|
@@ -152,6 +273,7 @@ export async function diagnose(input) {
|
|
|
152
273
|
else {
|
|
153
274
|
checks.push({ level: "fail", name: t("Agents", "Agentes"), detail: t("no agent on this machine is set up to use Myrmo", "ningún agente de esta máquina está configurado para usar Myrmo"), fix: t("Run the setup command again, then restart Claude Code or Antigravity.", "Vuelve a ejecutar el comando de configuración y reinicia Claude Code o Antigravity.") });
|
|
154
275
|
}
|
|
276
|
+
checks.push(...(await workLogChecks(input, fetchImpl)));
|
|
155
277
|
checks.push({
|
|
156
278
|
level: "ok",
|
|
157
279
|
name: "Claude Desktop",
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The work log for Cline: the same thing the Claude Code hook (worklog-hook.mjs) does, with the events Cline has.
|
|
3
|
+
//
|
|
4
|
+
// Cline runs a hook as an executable named after the event, in ~/Documents/Cline/Hooks (or a project's .clinerules/hooks),
|
|
5
|
+
// writes a JSON object to its standard input and reads a JSON object back. Measured in Cline 4.1.26 (every field below
|
|
6
|
+
// was seen, not read in a document):
|
|
7
|
+
//
|
|
8
|
+
// UserPromptSubmit { taskId, workspaceRoots, userPromptSubmit: { prompt } } -> { contextModification } reaches the model
|
|
9
|
+
// PostToolUse { taskId, postToolUse: { toolName, parameters, success } } -> { contextModification } reaches the model
|
|
10
|
+
// TaskComplete { taskId, taskComplete: { taskMetadata: { result } } } the agent's last words (nothing to return)
|
|
11
|
+
// TaskCancel { taskId }
|
|
12
|
+
//
|
|
13
|
+
// The prompt arrives wrapped in <user_input mode="act">…</user_input>. Cline 4.1.26 does not pass a command's output to
|
|
14
|
+
// PostToolUse (the result is the text "[object Object]"), so what the agent did is recorded as the tool and its command,
|
|
15
|
+
// and a failed call as an error line. A new user message is a new run with a new taskId: the state that joins a request to
|
|
16
|
+
// its answer is keyed by it.
|
|
17
|
+
//
|
|
18
|
+
// It never holds the agent back and answers nothing whenever it has nothing to say or anything goes wrong. Like the Claude
|
|
19
|
+
// Code hook it does nothing unless MYRMO_WORKLOG=1, the colony is the organisation's own, the person is enrolled and the
|
|
20
|
+
// folder is covered (worklog.mjs: worklogTarget). A request that starts with //privado or //private is never logged.
|
|
21
|
+
|
|
22
|
+
import { mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
23
|
+
import { homedir } from "node:os";
|
|
24
|
+
import { join } from "node:path";
|
|
25
|
+
import { personalText, taskOf } from "./lookup.mjs";
|
|
26
|
+
import { readSettings } from "./on-failure.mjs";
|
|
27
|
+
import { redactText } from "./redact.mjs";
|
|
28
|
+
import { digestMatters, digestNote, isContinuation, isPrivate, recallEvents, recallNote, redactRandom, send, worklogTarget } from "./worklog.mjs";
|
|
29
|
+
|
|
30
|
+
const DAY = 86_400_000;
|
|
31
|
+
/** How long before the digest of what colleagues did is shown again for a repository: a Cline run is not a session. */
|
|
32
|
+
export const DIGEST_EVERY_MS = 4 * 3_600_000;
|
|
33
|
+
|
|
34
|
+
export const stateDir = (env = process.env) => env.MYRMO_WORKLOG_STATE_DIR || join(homedir(), ".myrmo", "worklog-state");
|
|
35
|
+
const safeId = (id) => String(id ?? "none").replace(/[^A-Za-z0-9_-]/g, "").slice(0, 64) || "none";
|
|
36
|
+
const fileOf = (dir, id) => join(dir, `cline-${safeId(id)}.json`);
|
|
37
|
+
|
|
38
|
+
/** What the person typed: Cline wraps it in <user_input …>…</user_input>. */
|
|
39
|
+
export function promptOf(text) {
|
|
40
|
+
const raw = String(text ?? "");
|
|
41
|
+
const m = /<user_input(?:\s[^>]*)?>([\s\S]*?)<\/user_input>/i.exec(raw);
|
|
42
|
+
return (m ? m[1] : raw).trim();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const oneLine = (text, max) => String(text ?? "").replace(/\s+/g, " ").trim().slice(0, max);
|
|
46
|
+
|
|
47
|
+
/** One short line for a tool call: its name and what it was asked to do. */
|
|
48
|
+
export function toolLine(name, parameters) {
|
|
49
|
+
let p = parameters ?? {};
|
|
50
|
+
const target = p.commands ?? p.command ?? p.file_path ?? p.path ?? p.paths ?? p.pattern ?? p.query ?? p.url ?? p.description ?? "";
|
|
51
|
+
let text = typeof target === "string" ? target : JSON.stringify(target);
|
|
52
|
+
try {
|
|
53
|
+
const list = JSON.parse(text);
|
|
54
|
+
if (Array.isArray(list)) text = list.join(" ; "); // Cline gives the commands as a JSON list inside a string
|
|
55
|
+
} catch {
|
|
56
|
+
/* not a list */
|
|
57
|
+
}
|
|
58
|
+
return `${name}: ${oneLine(text, 200)}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const safe = (target, text) => redactRandom(redactText(String(text ?? ""), {}, { keepNetwork: true, keepPersonal: target.keepPersonal === true }));
|
|
62
|
+
|
|
63
|
+
function readState(file) {
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
66
|
+
} catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function sweep(dir, now) {
|
|
72
|
+
try {
|
|
73
|
+
for (const name of readdirSync(dir)) {
|
|
74
|
+
const path = join(dir, name);
|
|
75
|
+
if (name.startsWith("cline-") && now - statSync(path).mtimeMs > DAY) rmSync(path, { force: true });
|
|
76
|
+
}
|
|
77
|
+
} catch {
|
|
78
|
+
/* nothing to sweep */
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const digestFile = (dir, repo) => join(dir, `cline-digest-${safeId(repo)}.stamp`);
|
|
83
|
+
|
|
84
|
+
function digestDue(dir, repo, now) {
|
|
85
|
+
try {
|
|
86
|
+
return now - Number(readFileSync(digestFile(dir, repo), "utf8")) > DIGEST_EVERY_MS;
|
|
87
|
+
} catch {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Handles one hook call. Returns what to say to Cline ({contextModification}) or null.
|
|
94
|
+
* `deps` lets a test choose the clock, the environment, the folder for state and the way to reach the colony.
|
|
95
|
+
*/
|
|
96
|
+
export async function handle(input, { env = process.env, settings = readSettings(env), now = Date.now(), dir = stateDir(env), poster = send, recall = recallEvents, digest = digestMatters } = {}) {
|
|
97
|
+
const event = String(input?.hookName ?? "");
|
|
98
|
+
const id = input?.taskId;
|
|
99
|
+
const cwd = Array.isArray(input?.workspaceRoots) && input.workspaceRoots[0] ? input.workspaceRoots[0] : process.cwd();
|
|
100
|
+
const file = fileOf(dir, id);
|
|
101
|
+
|
|
102
|
+
if (event === "TaskCancel") {
|
|
103
|
+
rmSync(file, { force: true });
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const target = worklogTarget({ cwd }, { env, settings });
|
|
107
|
+
if (!target) return null;
|
|
108
|
+
|
|
109
|
+
if (event === "UserPromptSubmit") {
|
|
110
|
+
const prompt = promptOf(input.userPromptSubmit?.prompt);
|
|
111
|
+
rmSync(file, { force: true });
|
|
112
|
+
if (!prompt || isPrivate(prompt)) return null; // marked private: nothing is kept, nothing is asked of the colony
|
|
113
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
114
|
+
sweep(dir, now);
|
|
115
|
+
writeFileSync(file, JSON.stringify({ prompt, tools: [], at: now }), { mode: 0o600 });
|
|
116
|
+
const notes = [];
|
|
117
|
+
const task = taskOf(prompt);
|
|
118
|
+
if (task || isContinuation(prompt)) {
|
|
119
|
+
const note = recallNote(await recall({ prompt, session_id: id }, target, task));
|
|
120
|
+
if (note) notes.push(note);
|
|
121
|
+
}
|
|
122
|
+
if (digestDue(dir, target.repo, now)) {
|
|
123
|
+
writeFileSync(digestFile(dir, target.repo), String(now), { mode: 0o600 });
|
|
124
|
+
const note = digestNote(await digest({ session_id: id }, target));
|
|
125
|
+
if (note) notes.push(note);
|
|
126
|
+
}
|
|
127
|
+
return notes.length ? { context: notes.join("\n\n"), contextModification: notes.join("\n\n") } : null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (event === "PostToolUse") {
|
|
131
|
+
const state = readState(file);
|
|
132
|
+
if (!state) return null; // a request marked private, or one this hook did not see
|
|
133
|
+
const call = input.postToolUse ?? {};
|
|
134
|
+
const lines = [toolLine(call.toolName, call.parameters)];
|
|
135
|
+
if (call.success === false) lines.push(`error: ${call.toolName} failed`);
|
|
136
|
+
state.tools = [...(state.tools ?? []), ...lines].slice(-60);
|
|
137
|
+
writeFileSync(file, JSON.stringify(state), { mode: 0o600 });
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (event === "TaskComplete") {
|
|
142
|
+
const state = readState(file);
|
|
143
|
+
rmSync(file, { force: true });
|
|
144
|
+
const answer = String(input.taskComplete?.taskMetadata?.result ?? "").trim();
|
|
145
|
+
if (!state || !state.prompt || !answer) return null;
|
|
146
|
+
await poster(target, "/v1/worklog/exchanges", {
|
|
147
|
+
session: `cline-${safeId(id)}`.slice(0, 64),
|
|
148
|
+
scope: target.scope,
|
|
149
|
+
repo: target.repo,
|
|
150
|
+
branch: target.branch,
|
|
151
|
+
prompt: safe(target, personalText(state.prompt).trim()).slice(0, 4000),
|
|
152
|
+
answer: safe(target, answer).slice(0, 6000),
|
|
153
|
+
activity: safe(target, (state.tools ?? []).join("\n")).slice(0, 3000),
|
|
154
|
+
}, { timeoutMs: 8000 });
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function main() {
|
|
161
|
+
let raw = "";
|
|
162
|
+
for await (const chunk of process.stdin) raw += chunk;
|
|
163
|
+
const out = await handle(JSON.parse(raw));
|
|
164
|
+
if (out) process.stdout.write(JSON.stringify(out));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (process.argv[1]?.endsWith("cline-hook.mjs")) {
|
|
168
|
+
main().catch(() => {}).finally(() => process.exit(0));
|
|
169
|
+
}
|
package/dist/hooks/worklog.mjs
CHANGED
|
@@ -74,7 +74,7 @@ export function worklogTarget(input, { env = process.env, settings = {}, run = e
|
|
|
74
74
|
return scope ? { colony, keepPersonal, scope, repo: where.repo || basename(cwd), branch: where.branch } : null;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
async function send(target, path, body, { fetcher = fetch, timeoutMs = 3000 } = {}) {
|
|
77
|
+
export async function send(target, path, body, { fetcher = fetch, timeoutMs = 3000 } = {}) {
|
|
78
78
|
const ctrl = new AbortController();
|
|
79
79
|
const timer = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
80
80
|
try {
|
|
@@ -221,9 +221,20 @@ export async function recallEvents(input, target, task, options) {
|
|
|
221
221
|
const LABEL = { decision: "decided", fact: "fact", conclusion: "concluded", failed_attempt: "tried and failed", state: "state", resolved: "resolved" };
|
|
222
222
|
|
|
223
223
|
/** At most three lines for the agent, as untrusted data. */
|
|
224
|
-
|
|
224
|
+
/** "25 min ago" or "3 h ago" for what happened today, else the date: an agent should know when a colleague is on it now. */
|
|
225
|
+
export function whenSaid(at, now = Date.now()) {
|
|
226
|
+
const t = Date.parse(String(at ?? ""));
|
|
227
|
+
const date = String(at ?? "").slice(0, 10).replace(/[^0-9-]/g, "");
|
|
228
|
+
if (!Number.isFinite(t)) return date;
|
|
229
|
+
const minutes = Math.max(0, Math.round((now - t) / 60_000));
|
|
230
|
+
if (minutes < 60) return `${minutes} min ago`;
|
|
231
|
+
if (minutes < 24 * 60) return `${Math.round(minutes / 60)} h ago`;
|
|
232
|
+
return date;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export function recallNote(events, now = Date.now()) {
|
|
225
236
|
const lines = events.slice(0, 3).map((e) => {
|
|
226
|
-
const when =
|
|
237
|
+
const when = whenSaid(e.at, now);
|
|
227
238
|
return `- [${LABEL[e.kind] ?? "note"}, ${clip(e.person, 40)}, ${when}] ${clip(e.matter, 80)}: ${clip(e.text, 300)}`;
|
|
228
239
|
});
|
|
229
240
|
if (!lines.length) return null;
|
|
@@ -247,9 +258,10 @@ export async function digestMatters(input, target, options) {
|
|
|
247
258
|
export const DIGEST_SOURCES = ["startup", "resume", "clear"];
|
|
248
259
|
|
|
249
260
|
/** The lines for the agent, as untrusted data, or null when there is nothing to say. */
|
|
250
|
-
export function digestNote(matters) {
|
|
261
|
+
export function digestNote(matters, now = Date.now()) {
|
|
251
262
|
const lines = (matters ?? []).slice(0, 3).map((m) => {
|
|
252
|
-
const when =
|
|
263
|
+
const when = whenSaid(m.last_at, now);
|
|
264
|
+
if (m.for_you) return `- ${clip(m.matter, 70)} WAITS ON THIS PERSON (${clip((m.people ?? [])[0], 30)}, ${when}): ${clip(m.text, 200)}`;
|
|
253
265
|
const who = (Array.isArray(m.people) ? m.people : []).slice(0, 3).map((p) => clip(p, 30)).join(", ");
|
|
254
266
|
const more = Number(m.new_events) > 1 ? `, ${Number(m.new_events)} new` : "";
|
|
255
267
|
return `- ${clip(m.matter, 70)} (${who}, ${when}${more}) ${LABEL[m.kind] ?? "note"}: ${clip(m.text, 160)}`;
|
package/dist/init.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export interface InitOptions {
|
|
|
49
49
|
agentsMd?: string;
|
|
50
50
|
readOnly?: boolean;
|
|
51
51
|
private?: boolean;
|
|
52
|
+
worklog?: boolean;
|
|
52
53
|
url?: string;
|
|
53
54
|
key?: string;
|
|
54
55
|
keySource?: "argument" | "file" | "stdin";
|
|
@@ -92,6 +93,30 @@ export declare function mergeHooks(current: string | undefined, command: string)
|
|
|
92
93
|
*/
|
|
93
94
|
/** The scripts the hooks are made of, copied together (scripts/copy-hooks.mjs puts them in dist/hooks). */
|
|
94
95
|
export declare const HOOK_SCRIPTS: string[];
|
|
96
|
+
/** The events Cline runs a hook for that the work log uses. Cline looks for an executable named after the event. */
|
|
97
|
+
export declare const CLINE_HOOK_EVENTS: string[];
|
|
98
|
+
export declare const CLINE_MARK = "myrmo-work-log (written by myrmo-mcp init)";
|
|
99
|
+
/** Cline's global hooks folder, where it looks on every project (Cline 4.1: ~/Documents/Cline/Hooks). */
|
|
100
|
+
export declare const clineHooksDir: (home: string) => string;
|
|
101
|
+
/** Whether Cline is on this machine: its data folder, its documents folder or its VS Code extension. */
|
|
102
|
+
export declare function clineInstalled(home: string): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* What goes in the file Cline runs for an event. The node that runs init is written in as an absolute path: VS Code starts
|
|
105
|
+
* a hook with the PATH of the desktop session, which often lacks the node that nvm or conda put in a terminal's PATH.
|
|
106
|
+
* MYRMO_WORKLOG=1 is set here, because Cline passes the hook no environment of the person's shell.
|
|
107
|
+
*/
|
|
108
|
+
export declare function clineWrapper(node: string, script: string, platform?: NodeJS.Platform): string;
|
|
109
|
+
/** Whether ~/.claude/settings.json registers the work log's own hook (tools/worklog/install.mjs), which already records. */
|
|
110
|
+
export declare function claudeWorkLogHook(settingsText: string): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Turns the work log on for Claude Code: the plugin records it when MYRMO_WORKLOG=1, and the `env` block of
|
|
113
|
+
* ~/.claude/settings.json is the one place Claude Code reads it however it is started. Left alone when the settings
|
|
114
|
+
* file is not valid JSON, when it is already on, and when a work log hook of its own is registered there (both would
|
|
115
|
+
* send every exchange). A copy of the file is kept next to it before the first change.
|
|
116
|
+
*/
|
|
117
|
+
export declare function enableClaudeWorkLog(opts: InitOptions, home: string, log: (l: string) => void): void;
|
|
118
|
+
/** Installs the work log's hooks for Cline, or says how to. Only with --worklog, and never over a hook the person wrote. */
|
|
119
|
+
export declare function installClineHooks(opts: InitOptions, home: string, log: (l: string) => void): void;
|
|
95
120
|
/** This machine or a private network: where plain http does not carry a key across the internet. */
|
|
96
121
|
export declare function nearbyHost(hostname: string): boolean;
|
|
97
122
|
/** What to tell the person about how their key is handled, one line each. */
|
package/dist/init.js
CHANGED
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
// read safely (JSON that does not parse, a TOML file that already defines "myrmo" in a way that adding
|
|
14
14
|
// a table would break).
|
|
15
15
|
import { spawnSync } from "node:child_process";
|
|
16
|
-
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
16
|
+
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
17
17
|
import { homedir } from "node:os";
|
|
18
18
|
import { dirname, join } from "node:path";
|
|
19
19
|
import { fileURLToPath } from "node:url";
|
|
20
|
-
import { writeConfig } from "myrmo";
|
|
20
|
+
import { readConfig, writeConfig } from "myrmo";
|
|
21
21
|
import { VERSION } from "./server.js";
|
|
22
22
|
import { t as tx } from "./i18n.js";
|
|
23
23
|
export const AGENTS_BLOCK = `<!-- myrmo:start -->
|
|
@@ -323,7 +323,120 @@ export function mergeHooks(current, command) {
|
|
|
323
323
|
* which apply only to that colony), and for Antigravity installs the hook that looks errors up there.
|
|
324
324
|
*/
|
|
325
325
|
/** The scripts the hooks are made of, copied together (scripts/copy-hooks.mjs puts them in dist/hooks). */
|
|
326
|
-
export const HOOK_SCRIPTS = ["antigravity-hook.mjs", "on-failure.mjs", "lookup.mjs", "worklog.mjs", "effort.mjs", "state.mjs", "redact.mjs", "packages.mjs"];
|
|
326
|
+
export const HOOK_SCRIPTS = ["cline-hook.mjs", "antigravity-hook.mjs", "on-failure.mjs", "lookup.mjs", "worklog.mjs", "effort.mjs", "state.mjs", "redact.mjs", "packages.mjs"];
|
|
327
|
+
/** The events Cline runs a hook for that the work log uses. Cline looks for an executable named after the event. */
|
|
328
|
+
export const CLINE_HOOK_EVENTS = ["UserPromptSubmit", "PostToolUse", "TaskComplete", "TaskCancel"];
|
|
329
|
+
export const CLINE_MARK = "myrmo-work-log (written by myrmo-mcp init)";
|
|
330
|
+
/** Cline's global hooks folder, where it looks on every project (Cline 4.1: ~/Documents/Cline/Hooks). */
|
|
331
|
+
export const clineHooksDir = (home) => join(home, "Documents", "Cline", "Hooks");
|
|
332
|
+
/** Whether Cline is on this machine: its data folder, its documents folder or its VS Code extension. */
|
|
333
|
+
export function clineInstalled(home) {
|
|
334
|
+
if (existsSync(join(home, ".cline")) || existsSync(join(home, "Documents", "Cline")))
|
|
335
|
+
return true;
|
|
336
|
+
for (const dir of [join(home, ".vscode", "extensions"), join(home, ".vscode-server", "extensions")]) {
|
|
337
|
+
try {
|
|
338
|
+
if (readdirSync(dir).some((n) => n.startsWith("saoudrizwan.claude-dev")))
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
/* no such folder */
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* What goes in the file Cline runs for an event. The node that runs init is written in as an absolute path: VS Code starts
|
|
349
|
+
* a hook with the PATH of the desktop session, which often lacks the node that nvm or conda put in a terminal's PATH.
|
|
350
|
+
* MYRMO_WORKLOG=1 is set here, because Cline passes the hook no environment of the person's shell.
|
|
351
|
+
*/
|
|
352
|
+
export function clineWrapper(node, script, platform = process.platform) {
|
|
353
|
+
if (platform === "win32")
|
|
354
|
+
return `# ${CLINE_MARK}\r\n$env:MYRMO_WORKLOG = '1'\r\n$input | & "${node}" "${script}"\r\n`;
|
|
355
|
+
const q = (v) => `'${v.replace(/'/g, `'\\''`)}'`;
|
|
356
|
+
return `#!/bin/sh\n# ${CLINE_MARK}\nMYRMO_WORKLOG=1 exec ${q(node)} ${q(script)}\n`;
|
|
357
|
+
}
|
|
358
|
+
/** Whether ~/.claude/settings.json registers the work log's own hook (tools/worklog/install.mjs), which already records. */
|
|
359
|
+
export function claudeWorkLogHook(settingsText) {
|
|
360
|
+
return /worklog-hook\.mjs/.test(settingsText);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Turns the work log on for Claude Code: the plugin records it when MYRMO_WORKLOG=1, and the `env` block of
|
|
364
|
+
* ~/.claude/settings.json is the one place Claude Code reads it however it is started. Left alone when the settings
|
|
365
|
+
* file is not valid JSON, when it is already on, and when a work log hook of its own is registered there (both would
|
|
366
|
+
* send every exchange). A copy of the file is kept next to it before the first change.
|
|
367
|
+
*/
|
|
368
|
+
export function enableClaudeWorkLog(opts, home, log) {
|
|
369
|
+
if (!opts.private || !opts.worklog || !claudeCodeSetUp(home))
|
|
370
|
+
return;
|
|
371
|
+
const file = join(home, ".claude", "settings.json");
|
|
372
|
+
const text = existsSync(file) ? readFileSync(file, "utf8") : "{}";
|
|
373
|
+
let settings;
|
|
374
|
+
try {
|
|
375
|
+
settings = JSON.parse(text || "{}");
|
|
376
|
+
if (!settings || typeof settings !== "object" || Array.isArray(settings))
|
|
377
|
+
throw new Error("not an object");
|
|
378
|
+
}
|
|
379
|
+
catch {
|
|
380
|
+
log(tx(`Claude Code: ${file} is not valid JSON, left untouched; add "env": { "MYRMO_WORKLOG": "1" } to it by hand`, `Claude Code: ${file} no es un JSON válido, no se ha tocado; añádele a mano "env": { "MYRMO_WORKLOG": "1" }`));
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (claudeWorkLogHook(text)) {
|
|
384
|
+
log(tx("Claude Code: the work log already records through its own hook in ~/.claude/settings.json; left as it is", "Claude Code: el registro de trabajo ya se guarda con su propio hook en ~/.claude/settings.json; se deja como está"));
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (String(settings.env?.MYRMO_WORKLOG ?? "") === "1") {
|
|
388
|
+
log(tx("Claude Code: the work log is already on (MYRMO_WORKLOG=1 in ~/.claude/settings.json)", "Claude Code: el registro de trabajo ya está activado (MYRMO_WORKLOG=1 en ~/.claude/settings.json)"));
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
if (!opts.dryRun) {
|
|
392
|
+
if (existsSync(file) && !existsSync(`${file}.before-myrmo-worklog`))
|
|
393
|
+
copyFileSync(file, `${file}.before-myrmo-worklog`);
|
|
394
|
+
settings.env = { ...(settings.env && typeof settings.env === "object" ? settings.env : {}), MYRMO_WORKLOG: "1" };
|
|
395
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
396
|
+
writeFileSync(file, JSON.stringify(settings, null, 2) + "\n");
|
|
397
|
+
}
|
|
398
|
+
log(tx(`Claude Code: ${opts.dryRun ? "would turn" : "turned"} the work log on (MYRMO_WORKLOG=1 in ${file}); restart Claude Code`, `Claude Code: ${opts.dryRun ? "se activaría" : "activado"} el registro de trabajo (MYRMO_WORKLOG=1 en ${file}); reinicia Claude Code`));
|
|
399
|
+
}
|
|
400
|
+
/** Installs the work log's hooks for Cline, or says how to. Only with --worklog, and never over a hook the person wrote. */
|
|
401
|
+
export function installClineHooks(opts, home, log) {
|
|
402
|
+
if (!opts.private || !clineInstalled(home))
|
|
403
|
+
return;
|
|
404
|
+
if (!opts.worklog) {
|
|
405
|
+
log(tx("Cline: found. To keep your work log from Cline as well, run this again with --worklog (what the hooks do: https://myrmo.dev/docs)", "Cline: encontrado. Para guardar también tu registro de trabajo desde Cline, ejecuta esto otra vez con --worklog (qué hacen los hooks: https://myrmo.dev/docs)"));
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const win = process.platform === "win32";
|
|
409
|
+
const dir = clineHooksDir(home);
|
|
410
|
+
const scripts = join(home, ".myrmo", "hooks");
|
|
411
|
+
const source = opts.hooksSource ?? join(dirname(fileURLToPath(import.meta.url)), "hooks");
|
|
412
|
+
const script = join(scripts, "cline-hook.mjs");
|
|
413
|
+
const verb = opts.dryRun ? "would" : "did";
|
|
414
|
+
const kept = [];
|
|
415
|
+
const written = [];
|
|
416
|
+
for (const event of CLINE_HOOK_EVENTS) {
|
|
417
|
+
const file = join(dir, win ? `${event}.ps1` : event);
|
|
418
|
+
if (existsSync(file) && !readFileSync(file, "utf8").includes(CLINE_MARK)) {
|
|
419
|
+
kept.push(event);
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
written.push(event);
|
|
423
|
+
if (opts.dryRun)
|
|
424
|
+
continue;
|
|
425
|
+
mkdirSync(dir, { recursive: true });
|
|
426
|
+
writeFileSync(file, clineWrapper(process.execPath, script), { mode: 0o755 });
|
|
427
|
+
if (!win)
|
|
428
|
+
chmodSync(file, 0o755);
|
|
429
|
+
}
|
|
430
|
+
if (!opts.dryRun && written.length) {
|
|
431
|
+
mkdirSync(scripts, { recursive: true });
|
|
432
|
+
for (const name of HOOK_SCRIPTS)
|
|
433
|
+
copyFileSync(join(source, name), join(scripts, name));
|
|
434
|
+
}
|
|
435
|
+
if (written.length)
|
|
436
|
+
log(tx(`Cline: ${verb} install the work log hooks (${written.join(", ")}) in ${dir}; restart VS Code so Cline picks them up`, `Cline: ${opts.dryRun ? "se instalarían" : "instalados"} los hooks del registro de trabajo (${written.join(", ")}) en ${dir}; reinicia VS Code para que Cline los recoja`));
|
|
437
|
+
if (kept.length)
|
|
438
|
+
log(tx(`Cline: ${kept.join(", ")} in ${dir} are hooks of your own, left untouched; the work log will not see those events`, `Cline: ${kept.join(", ")} en ${dir} son hooks tuyos, no se han tocado; el registro de trabajo no verá esos eventos`));
|
|
439
|
+
}
|
|
327
440
|
/** This machine or a private network: where plain http does not carry a key across the internet. */
|
|
328
441
|
export function nearbyHost(hostname) {
|
|
329
442
|
const h = hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
@@ -354,11 +467,17 @@ function setUpColony(opts, home, log, wanted) {
|
|
|
354
467
|
for (const line of keyWarnings(opts))
|
|
355
468
|
log(line);
|
|
356
469
|
const url = opts.url.trim().replace(/\/+$/, "");
|
|
357
|
-
|
|
470
|
+
// Running init again for the same colony (to add --worklog, say) keeps what is saved for it: the colony is written as a
|
|
471
|
+
// whole, and without this a run with no --key would drop the key and the publish choice.
|
|
472
|
+
const saved = readConfig().colony;
|
|
473
|
+
const kept = saved && typeof saved.url === "string" && saved.url.trim().replace(/\/+$/, "") === url ? saved : {};
|
|
474
|
+
const colony = { ...kept, url, ...(opts.key ? { api_key: opts.key } : {}), ...(opts.private ? { private: true } : {}), ...(opts.publish ? { publish: opts.publish } : {}) };
|
|
358
475
|
if (!opts.dryRun)
|
|
359
476
|
writeConfig({ colony });
|
|
360
477
|
const what = [opts.key ? tx("its access key", "su clave de acceso") : "", opts.private ? tx("private mode", "el modo privado") : "", opts.publish ? `publish ${opts.publish}` : ""].filter(Boolean).join(", ");
|
|
361
478
|
log(tx(`Colony: ${verb} save ${url}${what ? ` with ${what}` : ""} in the settings file; the key and the choices apply only to that colony`, `Colonia: ${opts.dryRun ? "se guardaría" : "guardada"} ${url}${what ? ` con ${what}` : ""} en el fichero de configuración; la clave y las elecciones solo se aplican a esa colonia`));
|
|
479
|
+
installClineHooks(opts, home, log);
|
|
480
|
+
enableClaudeWorkLog(opts, home, log);
|
|
362
481
|
// Antigravity has no plugin: copy the hook next to the settings and register it, so that after a failed command it
|
|
363
482
|
// looks the error up in this colony (and reminds the agent to report and to publish).
|
|
364
483
|
const agy = targets(home).find((t) => t.id === "antigravity");
|
|
@@ -399,6 +518,16 @@ export function runInit(opts) {
|
|
|
399
518
|
const verb = opts.dryRun ? "would" : "did";
|
|
400
519
|
if (opts.url)
|
|
401
520
|
setUpColony(opts, home, log, wanted);
|
|
521
|
+
else if (opts.worklog) {
|
|
522
|
+
// `init --worklog` on a machine already pointed at its organisation's colony: only the Cline hooks are added.
|
|
523
|
+
const saved = readConfig().colony;
|
|
524
|
+
if (saved?.url && (saved.private === true || Boolean(saved.api_key))) {
|
|
525
|
+
installClineHooks({ ...opts, private: true }, home, log);
|
|
526
|
+
enableClaudeWorkLog({ ...opts, private: true }, home, log);
|
|
527
|
+
}
|
|
528
|
+
else
|
|
529
|
+
log(tx("--worklog needs your organisation's colony: run init with --url and --key first", "--worklog necesita la colonia de tu organización: ejecuta antes init con --url y --key"));
|
|
530
|
+
}
|
|
402
531
|
const alreadyThere = wanted(CLAUDE_CODE) ? claudeCodeSetUp(home) : null;
|
|
403
532
|
const slash = tx(`In Claude Code's chat run: /plugin marketplace add ${MARKETPLACE} then /plugin install ${PLUGIN}`, `En el chat de Claude Code ejecuta: /plugin marketplace add ${MARKETPLACE} y después /plugin install ${PLUGIN}`);
|
|
404
533
|
if (alreadyThere) {
|
|
@@ -523,6 +652,8 @@ export function parseInitArgs(args, readStdin = () => readFileSync(0, "utf8")) {
|
|
|
523
652
|
opts.rules = false;
|
|
524
653
|
else if (a === "--private")
|
|
525
654
|
opts.private = true;
|
|
655
|
+
else if (a === "--worklog")
|
|
656
|
+
opts.worklog = true;
|
|
526
657
|
else if (a === "--key-file") {
|
|
527
658
|
// The key stays out of the command line, so out of the shell's history and the process list.
|
|
528
659
|
const file = args[++i];
|
|
@@ -572,7 +703,7 @@ export function parseInitArgs(args, readStdin = () => readFileSync(0, "utf8")) {
|
|
|
572
703
|
return tx("--publish takes auto, ask or off", "--publish acepta auto, ask u off");
|
|
573
704
|
}
|
|
574
705
|
else
|
|
575
|
-
return tx(`Unknown option ${a}.`, `Opción desconocida ${a}.`) + ` ${tx("Usage:", "Uso:")} myrmo-mcp init [--client <id>]... [--agents-md [file] [--read-only]] [--url <colony> [--key <key> | --key - | --key-file <file>] [--private] [--publish auto|ask|off]] [--no-rules] [--dry-run]`;
|
|
706
|
+
return tx(`Unknown option ${a}.`, `Opción desconocida ${a}.`) + ` ${tx("Usage:", "Uso:")} myrmo-mcp init [--client <id>]... [--agents-md [file] [--read-only]] [--url <colony> [--key <key> | --key - | --key-file <file>] [--private] [--publish auto|ask|off]] [--no-rules] [--worklog] [--dry-run]`;
|
|
576
707
|
}
|
|
577
708
|
if ((opts.key || opts.publish) && !opts.url)
|
|
578
709
|
return tx("--key and --publish go with --url: they belong to one colony", "--key y --publish van con --url: pertenecen a una colonia");
|
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.
|
|
3
|
+
export declare const VERSION = "0.35.0";
|
|
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
|
@@ -7,7 +7,7 @@ import { z } from "zod";
|
|
|
7
7
|
import { checkTrail } from "./check.js";
|
|
8
8
|
import { buildInstructions } from "./instructions.js";
|
|
9
9
|
import { MATTER_DESCRIPTION, MATTERS_DESCRIPTION, formatMatter, formatMatters } from "./worklog.js";
|
|
10
|
-
export const VERSION = "0.
|
|
10
|
+
export const VERSION = "0.35.0"; // x-release-please-version
|
|
11
11
|
const PUBLIC_HOSTS = new Set(["myrmo.dev", "www.myrmo.dev"]);
|
|
12
12
|
/**
|
|
13
13
|
* Whether the server runs for an organisation's colony, where agents keep its internal names. Never for the public
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myrmo-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
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",
|