myrmo-mcp 0.29.0 → 0.30.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.js +39 -38
- package/dist/hooks/redact.mjs +5 -1
- package/dist/i18n.d.ts +6 -0
- package/dist/i18n.js +28 -0
- package/dist/index.js +106 -23
- package/dist/init.js +43 -43
- package/dist/join.d.ts +17 -0
- package/dist/join.js +90 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/wizard.js +39 -38
- package/package.json +2 -2
package/dist/doctor.js
CHANGED
|
@@ -5,6 +5,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { claudeCodeSetUp } from "./init.js";
|
|
7
7
|
import { compareVersions, describeColony, VERSION, VERSION_SHAPE } from "./server.js";
|
|
8
|
+
import { t } from "./i18n.js";
|
|
8
9
|
const PUBLIC_HOSTS = new Set(["myrmo.dev", "www.myrmo.dev"]);
|
|
9
10
|
async function call(fetchImpl, url, key) {
|
|
10
11
|
try {
|
|
@@ -24,22 +25,22 @@ export async function diagnose(input) {
|
|
|
24
25
|
const fetchImpl = input.fetchImpl ?? fetch;
|
|
25
26
|
const major = Number((input.nodeVersion ?? process.versions.node).split(".")[0]);
|
|
26
27
|
checks.push(major >= 20
|
|
27
|
-
? { level: "ok", name: "Node.js", detail: `version ${input.nodeVersion ?? process.versions.node}` }
|
|
28
|
-
: { level: "fail", name: "Node.js", detail: `version ${input.nodeVersion ?? process.versions.node} is too old`, fix: "Install Node.js 20 or newer (node --version) and run the command again." });
|
|
28
|
+
? { level: "ok", name: "Node.js", detail: t(`version ${input.nodeVersion ?? process.versions.node}`, `versión ${input.nodeVersion ?? process.versions.node}`) }
|
|
29
|
+
: { level: "fail", name: "Node.js", detail: t(`version ${input.nodeVersion ?? process.versions.node} is too old`, `la versión ${input.nodeVersion ?? process.versions.node} es demasiado antigua`), fix: t("Install Node.js 20 or newer (node --version) and run the command again.", "Instala Node.js 20 o superior (node --version) y vuelve a ejecutar el comando.") });
|
|
29
30
|
let host = "";
|
|
30
31
|
try {
|
|
31
32
|
host = new URL(input.url).host;
|
|
32
33
|
}
|
|
33
34
|
catch {
|
|
34
|
-
checks.push({ level: "fail", name: "Colony address", detail: `"${input.url}" is not a web address`, fix: "Run the setup command again with --url http://<machine>:8080." });
|
|
35
|
+
checks.push({ level: "fail", name: t("Colony address", "Dirección de la colonia"), detail: t(`"${input.url}" is not a web address`, `"${input.url}" no es una dirección web`), fix: t("Run the setup command again with --url http://<machine>:8080.", "Vuelve a ejecutar el comando de configuración con --url http://<machine>:8080.") });
|
|
35
36
|
return checks;
|
|
36
37
|
}
|
|
37
38
|
const isPublic = PUBLIC_HOSTS.has(host);
|
|
38
39
|
checks.push({
|
|
39
40
|
level: isPublic ? "warn" : "ok",
|
|
40
|
-
name: "Colony",
|
|
41
|
-
detail: `${input.url}${isPublic ? " (the public colony)" : input.saved ? " (saved by init)" : " (from MYRMO_URL)"}`,
|
|
42
|
-
fix: isPublic ? "To use your team's colony, run the setup command you were sent (npx myrmo-mcp init --url ... --key ... --private)." : undefined,
|
|
41
|
+
name: t("Colony", "Colonia"),
|
|
42
|
+
detail: `${input.url}${isPublic ? t(" (the public colony)", " (la colonia pública)") : input.saved ? t(" (saved by init)", " (guardada por init)") : t(" (from MYRMO_URL)", " (de MYRMO_URL)")}`,
|
|
43
|
+
fix: isPublic ? t("To use your team's colony, run the setup command you were sent (npx myrmo-mcp init --url ... --key ... --private).", "Para usar la colonia de tu equipo, ejecuta el comando de configuración que te enviaron (npx myrmo-mcp init --url ... --key ... --private).") : undefined,
|
|
43
44
|
});
|
|
44
45
|
if (isPublic)
|
|
45
46
|
return checks;
|
|
@@ -48,11 +49,11 @@ export async function diagnose(input) {
|
|
|
48
49
|
const refused = ready.error === "ECONNREFUSED";
|
|
49
50
|
checks.push({
|
|
50
51
|
level: "fail",
|
|
51
|
-
name: "Reaching the colony",
|
|
52
|
-
detail: refused ? "the machine answered but nothing listens on that port" : `no answer (${ready.error})`,
|
|
52
|
+
name: t("Reaching the colony", "Llegar a la colonia"),
|
|
53
|
+
detail: refused ? t("the machine answered but nothing listens on that port", "la máquina respondió pero nada escucha en ese puerto") : t(`no answer (${ready.error})`, `sin respuesta (${ready.error})`),
|
|
53
54
|
fix: refused
|
|
54
|
-
? "Ask whoever runs the colony whether it is up."
|
|
55
|
-
: "Check that you are on the team's network and that the address and port are right; from this machine try: curl " + input.url + "/readyz",
|
|
55
|
+
? t("Ask whoever runs the colony whether it is up.", "Pregunta a quien gestiona la colonia si está en marcha.")
|
|
56
|
+
: t("Check that you are on the team's network and that the address and port are right; from this machine try: curl ", "Comprueba que estás en la red del equipo y que la dirección y el puerto son correctos; desde esta máquina prueba: curl ") + input.url + "/readyz",
|
|
56
57
|
});
|
|
57
58
|
return checks;
|
|
58
59
|
}
|
|
@@ -68,42 +69,42 @@ export async function diagnose(input) {
|
|
|
68
69
|
const dockerNetwork = !!seen && /^172\.(1[6-9]|2\d|3[01])\./.test(seen);
|
|
69
70
|
checks.push({
|
|
70
71
|
level: "fail",
|
|
71
|
-
name: "Reaching the colony",
|
|
72
|
-
detail: `the colony refuses connections from this network (403)${seen ? `: it sees you as ${seen}` : ""}`,
|
|
72
|
+
name: t("Reaching the colony", "Llegar a la colonia"),
|
|
73
|
+
detail: t(`the colony refuses connections from this network (403)${seen ? `: it sees you as ${seen}` : ""}`, `la colonia rechaza las conexiones desde esta red (403)${seen ? `: te ve como ${seen}` : ""}`),
|
|
73
74
|
fix: dockerNetwork
|
|
74
|
-
? "You are probably on the colony's own machine: use its network address in the URL (not localhost or 127.0.0.1), and run the setup command again."
|
|
75
|
+
? t("You are probably on the colony's own machine: use its network address in the URL (not localhost or 127.0.0.1), and run the setup command again.", "Probablemente estás en la propia máquina de la colonia: usa su dirección de red en la URL (no localhost ni 127.0.0.1) y vuelve a ejecutar el comando de configuración.")
|
|
75
76
|
: seen
|
|
76
|
-
? `Tell whoever runs the colony to allow ${seen}. If that is not your machine's address, a router between you and the colony is translating it, and that shared address is the one to allow.`
|
|
77
|
-
: "Your machine is not in the networks the colony allows. Tell whoever runs it your address.",
|
|
77
|
+
? t(`Tell whoever runs the colony to allow ${seen}. If that is not your machine's address, a router between you and the colony is translating it, and that shared address is the one to allow.`, `Pide a quien gestiona la colonia que permita ${seen}. Si esa no es la dirección de tu máquina, un router entre tú y la colonia la está traduciendo, y es esa dirección compartida la que hay que permitir.`)
|
|
78
|
+
: t("Your machine is not in the networks the colony allows. Tell whoever runs it your address.", "Tu máquina no está en las redes que permite la colonia. Dile tu dirección a quien la gestiona."),
|
|
78
79
|
});
|
|
79
80
|
return checks;
|
|
80
81
|
}
|
|
81
82
|
checks.push(ready.status === 200
|
|
82
|
-
? { level: "ok", name: "Reaching the colony", detail: "it answers and reports itself ready" }
|
|
83
|
-
: { level: "fail", name: "Reaching the colony", detail: `it answered ${ready.status}`, fix: "It is up but not ready (it may still be starting). Try again in a minute, then tell whoever runs it." });
|
|
83
|
+
? { level: "ok", name: t("Reaching the colony", "Llegar a la colonia"), detail: t("it answers and reports itself ready", "responde y dice que está lista") }
|
|
84
|
+
: { level: "fail", name: t("Reaching the colony", "Llegar a la colonia"), detail: t(`it answered ${ready.status}`, `respondió ${ready.status}`), fix: t("It is up but not ready (it may still be starting). Try again in a minute, then tell whoever runs it.", "Está en marcha pero no lista (puede que aún esté arrancando). Inténtalo dentro de un minuto y, si sigue, díselo a quien la gestiona.") });
|
|
84
85
|
if (ready.status !== 200)
|
|
85
86
|
return checks;
|
|
86
87
|
const open = await call(fetchImpl, `${input.url.replace(/\/$/, "")}/v1/stats`, input.apiKey);
|
|
87
88
|
if ("error" in open) {
|
|
88
|
-
checks.push({ level: "fail", name: "Your access key", detail: `no answer (${open.error})`, fix: "Try again; if it persists tell whoever runs the colony." });
|
|
89
|
+
checks.push({ level: "fail", name: t("Your access key", "Tu clave de acceso"), detail: t(`no answer (${open.error})`, `sin respuesta (${open.error})`), fix: t("Try again; if it persists tell whoever runs the colony.", "Inténtalo otra vez; si sigue, díselo a quien gestiona la colonia.") });
|
|
89
90
|
}
|
|
90
91
|
else if (open.status === 401) {
|
|
91
92
|
checks.push(input.apiKey
|
|
92
|
-
? { level: "fail", name: "Your access key", detail: "the colony does not accept it (401)", fix: "The key was copied wrong or has been revoked. Ask for a new one and run the setup command again." }
|
|
93
|
-
: { level: "fail", name: "Your access key", detail: "this colony needs a key and none is set", fix: "Run the setup command you were sent: npx myrmo-mcp init --url <colony> --key <your key> --publish auto." });
|
|
93
|
+
? { level: "fail", name: t("Your access key", "Tu clave de acceso"), detail: t("the colony does not accept it (401)", "la colonia no la acepta (401)"), fix: t("The key was copied wrong or has been revoked. Ask for a new one and run the setup command again.", "La clave se copió mal o se ha revocado. Pide una nueva y vuelve a ejecutar el comando de configuración.") }
|
|
94
|
+
: { level: "fail", name: t("Your access key", "Tu clave de acceso"), detail: t("this colony needs a key and none is set", "esta colonia necesita una clave y no hay ninguna"), fix: t("Run the setup command you were sent: npx myrmo-mcp init --url <colony> --key <your key> --publish auto.", "Ejecuta el comando de configuración que te enviaron: npx myrmo-mcp init --url <colony> --key <your key> --publish auto.") });
|
|
94
95
|
}
|
|
95
96
|
else if (open.status === 200) {
|
|
96
|
-
checks.push(input.apiKey ? { level: "ok", name: "Your access key", detail: "accepted" } : { level: "warn", name: "Your access key", detail: "this colony does not ask for a key", fix: "If it should be private, tell whoever runs it." });
|
|
97
|
+
checks.push(input.apiKey ? { level: "ok", name: t("Your access key", "Tu clave de acceso"), detail: t("accepted", "aceptada") } : { level: "warn", name: t("Your access key", "Tu clave de acceso"), detail: t("this colony does not ask for a key", "esta colonia no pide clave"), fix: t("If it should be private, tell whoever runs it.", "Si debería ser privada, díselo a quien la gestiona.") });
|
|
97
98
|
}
|
|
98
99
|
else {
|
|
99
|
-
checks.push({ level: "fail", name: "Your access key", detail: `the colony answered ${open.status}`, fix: "Tell whoever runs the colony." });
|
|
100
|
+
checks.push({ level: "fail", name: t("Your access key", "Tu clave de acceso"), detail: t(`the colony answered ${open.status}`, `la colonia respondió ${open.status}`), fix: t("Tell whoever runs the colony.", "Díselo a quien gestiona la colonia.") });
|
|
100
101
|
}
|
|
101
102
|
// A key travels in every request: on plain HTTP anyone on the network path can read it.
|
|
102
103
|
try {
|
|
103
104
|
const u = new URL(input.url);
|
|
104
105
|
const local = ["localhost", "127.0.0.1", "::1", "[::1]"].includes(u.hostname);
|
|
105
106
|
if (u.protocol === "http:" && !local && input.apiKey) {
|
|
106
|
-
checks.push({ level: "warn", name: "Encryption", detail: "plain HTTP: your key and what you share cross the network unencrypted", fix: "Fine on a network you trust; elsewhere ask whoever runs the colony to put TLS (HTTPS) in front of it." });
|
|
107
|
+
checks.push({ level: "warn", name: t("Encryption", "Cifrado"), detail: t("plain HTTP: your key and what you share cross the network unencrypted", "HTTP sin cifrar: tu clave y lo que compartes cruzan la red sin cifrar"), fix: t("Fine on a network you trust; elsewhere ask whoever runs the colony to put TLS (HTTPS) in front of it.", "Vale en una red de confianza; en otro caso pide a quien gestiona la colonia que ponga TLS (HTTPS) delante.") });
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
catch {
|
|
@@ -111,18 +112,18 @@ export async function diagnose(input) {
|
|
|
111
112
|
}
|
|
112
113
|
const declared = input.declared?.profile;
|
|
113
114
|
checks.push(input.privateMode
|
|
114
|
-
? { level: "ok", name: "Private mode", detail: `agents keep your internal names in what they publish${declared === "organisation" ? " (the colony declares itself your organisation's)" : ""}` }
|
|
115
|
+
? { level: "ok", name: t("Private mode", "Modo privado"), detail: t(`agents keep your internal names in what they publish${declared === "organisation" ? " (the colony declares itself your organisation's)" : ""}`, `los agentes conservan tus nombres internos en lo que publican${declared === "organisation" ? " (la colonia se declara de tu organización)" : ""}`) }
|
|
115
116
|
: declared === "public"
|
|
116
|
-
? { level: "ok", name: "Private mode", detail: "off: the colony declares itself public, so internal names are removed" }
|
|
117
|
-
: { level: "warn", name: "Private mode", detail: "off: agents would strip internal names from what they publish", fix: declared === "organisation" ? "Set your access key (npx myrmo-mcp init --url <colony> --key <your key>)." : "This colony does not say what it is (an older server): run the setup command again with --private (or set MYRMO_PRIVATE=1)." });
|
|
117
|
+
? { level: "ok", name: t("Private mode", "Modo privado"), detail: t("off: the colony declares itself public, so internal names are removed", "desactivado: la colonia se declara pública, así que se quitan los nombres internos") }
|
|
118
|
+
: { level: "warn", name: t("Private mode", "Modo privado"), detail: t("off: agents would strip internal names from what they publish", "desactivado: los agentes quitarían los nombres internos de lo que publican"), fix: declared === "organisation" ? t("Set your access key (npx myrmo-mcp init --url <colony> --key <your key>).", "Configura tu clave de acceso (npx myrmo-mcp init --url <colony> --key <your key>).") : t("This colony does not say what it is (an older server): run the setup command again with --private (or set MYRMO_PRIVATE=1).", "Esta colonia no dice qué es (un servidor más antiguo): vuelve a ejecutar el comando de configuración con --private (o define MYRMO_PRIVATE=1).") });
|
|
118
119
|
if (input.declared?.profile === "organisation") {
|
|
119
|
-
checks.push({ level: "ok", name: "What the colony keeps", detail: describeColony(input.declared) });
|
|
120
|
+
checks.push({ level: "ok", name: t("What the colony keeps", "Lo que guarda la colonia"), detail: describeColony(input.declared) });
|
|
120
121
|
}
|
|
121
122
|
checks.push(input.publish === "auto"
|
|
122
|
-
? { level: "ok", name: "Publishing", detail: "agents publish what they solve, to this colony only" }
|
|
123
|
+
? { level: "ok", name: t("Publishing", "Publicación"), detail: t("agents publish what they solve, to this colony only", "los agentes publican lo que resuelven, solo en esta colonia") }
|
|
123
124
|
: input.publish === "ask"
|
|
124
|
-
? { level: "ok", name: "Publishing", detail: "you approve each trail before it is sent" }
|
|
125
|
-
: { level: "warn", name: "Publishing", detail: `agents do not publish (${input.publish})`, fix: "npx myrmo-mcp config publish auto (or ask, to approve each one)" });
|
|
125
|
+
? { level: "ok", name: t("Publishing", "Publicación"), detail: t("you approve each trail before it is sent", "apruebas cada rastro antes de enviarlo") }
|
|
126
|
+
: { level: "warn", name: t("Publishing", "Publicación"), detail: t(`agents do not publish (${input.publish})`, `los agentes no publican (${input.publish})`), fix: t("npx myrmo-mcp config publish auto (or ask, to approve each one)", "npx myrmo-mcp config publish auto (o ask, para aprobar cada uno)") });
|
|
126
127
|
// Is this client the one the colony was released with? An older one misses what came after it.
|
|
127
128
|
const version = await call(fetchImpl, `${input.url.replace(/\/+$/, "")}/v1/version`, input.apiKey);
|
|
128
129
|
if ("status" in version && version.status === 200) {
|
|
@@ -136,34 +137,34 @@ export async function diagnose(input) {
|
|
|
136
137
|
if (latest && !VERSION_SHAPE.test(latest))
|
|
137
138
|
latest = undefined;
|
|
138
139
|
if (latest && compareVersions(VERSION, latest) < 0) {
|
|
139
|
-
checks.push({ level: "warn", name: "Myrmo version", detail: `myrmo-mcp ${VERSION} here, ${latest} released with this colony`, fix: "Claude Code: claude plugin update myrmo@myrmo (or /plugin > Marketplaces > myrmo > Enable auto-update). Other clients: npx myrmo-mcp@latest init with the same options as the first time." });
|
|
140
|
+
checks.push({ level: "warn", name: t("Myrmo version", "Versión de Myrmo"), detail: t(`myrmo-mcp ${VERSION} here, ${latest} released with this colony`, `myrmo-mcp ${VERSION} aquí, ${latest} publicada con esta colonia`), fix: t("Claude Code: claude plugin update myrmo@myrmo (or /plugin > Marketplaces > myrmo > Enable auto-update). Other clients: npx myrmo-mcp@latest init with the same options as the first time.", "Claude Code: claude plugin update myrmo@myrmo (o /plugin > Marketplaces > myrmo > Enable auto-update). Otros clientes: npx myrmo-mcp@latest init con las mismas opciones que la primera vez.") });
|
|
140
141
|
}
|
|
141
142
|
else if (latest) {
|
|
142
|
-
checks.push({ level: "ok", name: "Myrmo version", detail: `myrmo-mcp ${VERSION}, up to date with this colony` });
|
|
143
|
+
checks.push({ level: "ok", name: t("Myrmo version", "Versión de Myrmo"), detail: t(`myrmo-mcp ${VERSION}, up to date with this colony`, `myrmo-mcp ${VERSION}, al día con esta colonia`) });
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
const claude = claudeCodeSetUp(input.home);
|
|
146
147
|
const gemini = join(input.home, ".gemini", "GEMINI.md");
|
|
147
148
|
const geminiRules = existsSync(gemini) && readFileSync(gemini, "utf8").includes("myrmo:start");
|
|
148
149
|
if (claude || geminiRules) {
|
|
149
|
-
checks.push({ level: "ok", name: "Agents", detail: [claude ? `Claude Code: ${claude}` : "", geminiRules ? "Gemini CLI / Antigravity: rules installed" : ""].filter(Boolean).join("; ") });
|
|
150
|
+
checks.push({ level: "ok", name: t("Agents", "Agentes"), detail: [claude ? `Claude Code: ${claude}` : "", geminiRules ? t("Gemini CLI / Antigravity: rules installed", "Gemini CLI / Antigravity: reglas instaladas") : ""].filter(Boolean).join("; ") });
|
|
150
151
|
}
|
|
151
152
|
else {
|
|
152
|
-
checks.push({ level: "fail", name: "Agents", detail: "no agent on this machine is set up to use Myrmo", fix: "Run the setup command again, then restart Claude Code or Antigravity." });
|
|
153
|
+
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.") });
|
|
153
154
|
}
|
|
154
155
|
checks.push({
|
|
155
156
|
level: "ok",
|
|
156
157
|
name: "Claude Desktop",
|
|
157
|
-
detail: "if you use it here, enable only one Myrmo integration there (the Plugin, for the public colony, or an Extension, for this one) — never both at once",
|
|
158
|
-
fix: "With both on, a tool call can be answered by the wrong one, silently: https://myrmo.dev/docs/reference/mcp#claude-desktop-when-the-colony-sits-behind-another-machine",
|
|
158
|
+
detail: t("if you use it here, enable only one Myrmo integration there (the Plugin, for the public colony, or an Extension, for this one) — never both at once", "si lo usas aquí, activa allí una sola integración de Myrmo (el Plugin, para la colonia pública, o una Extension, para esta), nunca las dos a la vez"),
|
|
159
|
+
fix: t("With both on, a tool call can be answered by the wrong one, silently: https://myrmo.dev/docs/reference/mcp#claude-desktop-when-the-colony-sits-behind-another-machine", "Con las dos activadas, una llamada a una herramienta puede responderla la equivocada, en silencio: https://myrmo.dev/docs/es/reference/mcp#claude-desktop-when-the-colony-sits-behind-another-machine"),
|
|
159
160
|
});
|
|
160
161
|
return checks;
|
|
161
162
|
}
|
|
162
163
|
export function render(checks) {
|
|
163
|
-
const mark = { ok: "ok ", warn: "warn", fail: "FAIL" };
|
|
164
|
+
const mark = { ok: "ok ", warn: t("warn", "ojo "), fail: t("FAIL", "MAL ") };
|
|
164
165
|
const lines = checks.flatMap((c) => [`[${mark[c.level]}] ${c.name}: ${c.detail}`, ...(c.fix ? [` -> ${c.fix}`] : [])]);
|
|
165
166
|
const failed = checks.filter((c) => c.level === "fail").length;
|
|
166
167
|
const warned = checks.filter((c) => c.level === "warn").length;
|
|
167
|
-
lines.push("", failed ? `${failed} problem${failed > 1 ? "s" : ""} to fix, then run this again.` : warned ? "Works, with things worth a look." : "Everything is in place. Restart your agent if you have not since the setup.");
|
|
168
|
+
lines.push("", failed ? t(`${failed} problem${failed > 1 ? "s" : ""} to fix, then run this again.`, `${failed} problema${failed > 1 ? "s" : ""} que arreglar; después vuelve a ejecutar esto.`) : warned ? t("Works, with things worth a look.", "Funciona, con cosas que conviene mirar.") : t("Everything is in place. Restart your agent if you have not since the setup.", "Todo está en orden. Reinicia tu agente si no lo has hecho desde la configuración."));
|
|
168
169
|
return lines.join("\n");
|
|
169
170
|
}
|
package/dist/hooks/redact.mjs
CHANGED
|
@@ -110,7 +110,11 @@ const CLI_NAMES = "password|passwd|pwd|pass|passphrase|secret|token|api[_-]?key|
|
|
|
110
110
|
// `"$PWD:/src"` and `$PATH:/opt/bin` expand a shell variable and go on with more text: the name gives no value.
|
|
111
111
|
// `$TOKEN=value` is still redacted, since what follows the `=` may well be a secret.
|
|
112
112
|
const expandsVariable = (name) => name.startsWith("$") && name.trimEnd().endsWith(":");
|
|
113
|
-
|
|
113
|
+
// `The secret: after the push, rotate it` is a sentence, not a value: after `name:` and a space, an unquoted common word
|
|
114
|
+
// is prose. The list is short on purpose; anything else after the colon is still redacted.
|
|
115
|
+
const PROSE_WORDS = new Set(["after", "before", "when", "then", "that", "this", "these", "those", "with", "without", "from", "into", "once", "until", "while", "where", "which", "what", "also", "only", "must", "should", "will", "would", "could", "have", "been", "does", "here", "there", "they", "them", "your", "every", "each", "never", "always", "cannot", "para", "pero", "como", "cuando", "antes", "desde", "hasta", "tras", "sobre", "este", "esta", "esto", "nunca", "siempre", "debe", "puede", "solo"]);
|
|
116
|
+
const proseAfterColon = (m) => /:[ \t]+$/.test(m[1]) && !m[2] && PROSE_WORDS.has(m[3].toLowerCase());
|
|
117
|
+
const assignment = (m) => (expandsVariable(m[1]) || isReference(m[3]) || proseAfterColon(m) ? null : m[1] + m[2] + full("secret"));
|
|
114
118
|
/** Replaces the value group with `<redacted:secret>`, keeping every group before and after it. */
|
|
115
119
|
const valueOnly = (valueGroup) => (m) => isReference(m[valueGroup])
|
|
116
120
|
? null
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type Lang = "en" | "es";
|
|
2
|
+
export declare function language(env?: NodeJS.ProcessEnv): Lang;
|
|
3
|
+
/** The text in the person's language. */
|
|
4
|
+
export declare function t(en: string, es: string): string;
|
|
5
|
+
/** For tests and for `--lang`: print in this language from now on. */
|
|
6
|
+
export declare function setLanguage(lang: Lang): void;
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// The language of what the commands print for a person (init, join, doctor, config, export): Spanish when MYRMO_LANG
|
|
2
|
+
// says so or the system's language is Spanish, English otherwise. What the server tells the agent stays English.
|
|
3
|
+
export function language(env = process.env) {
|
|
4
|
+
const explicit = env.MYRMO_LANG?.trim().toLowerCase();
|
|
5
|
+
if (explicit === "es" || explicit === "en")
|
|
6
|
+
return explicit;
|
|
7
|
+
// The first locale variable that names a language decides; C and POSIX name none.
|
|
8
|
+
for (const value of [env.LC_ALL, env.LC_MESSAGES, env.LANG]) {
|
|
9
|
+
if (!value || /^(C|POSIX)([._@]|$)/i.test(value))
|
|
10
|
+
continue;
|
|
11
|
+
return /^es([_.\-@]|$)/i.test(value) ? "es" : "en";
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
return /^es\b/i.test(Intl.DateTimeFormat().resolvedOptions().locale) ? "es" : "en";
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return "en";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
let current = language();
|
|
21
|
+
/** The text in the person's language. */
|
|
22
|
+
export function t(en, es) {
|
|
23
|
+
return current === "es" ? es : en;
|
|
24
|
+
}
|
|
25
|
+
/** For tests and for `--lang`: print in this language from now on. */
|
|
26
|
+
export function setLanguage(lang) {
|
|
27
|
+
current = lang;
|
|
28
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { parseInitArgs, runInit } from "./init.js";
|
|
|
13
13
|
import { createServer, privateMode, VERSION } from "./server.js";
|
|
14
14
|
import { allowedHosts, callerKey, DEFAULT_HTTP_HOST, hostedColonyUrl } from "./hosting.js";
|
|
15
15
|
import { clean, readDeclared, rememberDeclared } from "./profile.js";
|
|
16
|
+
import { t as tx } from "./i18n.js";
|
|
16
17
|
const args = process.argv.slice(2);
|
|
17
18
|
const flag = (name) => args.includes(name);
|
|
18
19
|
const option = (name, fallback) => {
|
|
@@ -39,6 +40,7 @@ const USAGE = `myrmo-mcp ${VERSION}: the Myrmo MCP server and its commands.
|
|
|
39
40
|
myrmo-mcp run the MCP server on stdio (what an agent's client launches)
|
|
40
41
|
myrmo-mcp --http [--port N] [--host H] run it over Streamable HTTP, stateless (default host 127.0.0.1)
|
|
41
42
|
myrmo-mcp init [options] set this machine's agents up (add --url, --key or --key-file, --private for a team colony)
|
|
43
|
+
myrmo-mcp join <invitation link> join a colony with an invitation and set this machine's agents up for it
|
|
42
44
|
myrmo-mcp doctor check that this machine can use the colony, and say what to fix
|
|
43
45
|
myrmo-mcp config [setting value] show or change a setting (publish, hook, ...)
|
|
44
46
|
myrmo-mcp export <dir> [--skill] write the colony's trails as Markdown notes
|
|
@@ -46,7 +48,20 @@ const USAGE = `myrmo-mcp ${VERSION}: the Myrmo MCP server and its commands.
|
|
|
46
48
|
myrmo-mcp --version
|
|
47
49
|
|
|
48
50
|
Docs: https://myrmo.dev/docs/reference/mcp`;
|
|
49
|
-
const
|
|
51
|
+
const USAGE_ES = `myrmo-mcp ${VERSION}: el servidor MCP de Myrmo y sus comandos.
|
|
52
|
+
|
|
53
|
+
myrmo-mcp ejecuta el servidor MCP por stdio (lo que lanza el cliente de un agente)
|
|
54
|
+
myrmo-mcp --http [--port N] [--host H] lo ejecuta por HTTP en streaming, sin estado (host por defecto 127.0.0.1)
|
|
55
|
+
myrmo-mcp init [opciones] configura los agentes de esta máquina (añade --url, --key o --key-file, --private para la colonia de un equipo)
|
|
56
|
+
myrmo-mcp join <enlace> se une a una colonia con una invitación y configura para ella los agentes de esta máquina
|
|
57
|
+
myrmo-mcp doctor comprueba que esta máquina puede usar la colonia y dice qué arreglar
|
|
58
|
+
myrmo-mcp config [ajuste valor] enseña o cambia un ajuste (publish, hook, ...)
|
|
59
|
+
myrmo-mcp export <dir> [--skill] escribe los rastros de la colonia como notas Markdown
|
|
60
|
+
myrmo-mcp pilot-roi [días] [--json] el resumen del piloto de una colonia privada (necesita MYRMO_ADMIN_TOKEN)
|
|
61
|
+
myrmo-mcp --version
|
|
62
|
+
|
|
63
|
+
Para ver los mensajes en inglés: MYRMO_LANG=en. Documentación: https://myrmo.dev/docs/es/reference/mcp`;
|
|
64
|
+
const COMMANDS = ["init", "join", "doctor", "config", "export", "pilot-roi"];
|
|
50
65
|
const INIT_USAGE = `myrmo-mcp init [options]: set up the agents on this machine to use Myrmo.
|
|
51
66
|
|
|
52
67
|
(no options) every agent client found: Claude Code (plugin), Cursor, Windsurf, Gemini CLI,
|
|
@@ -65,17 +80,39 @@ const INIT_USAGE = `myrmo-mcp init [options]: set up the agents on this machine
|
|
|
65
80
|
--yes do not ask anything (init alone in a terminal asks a few questions)
|
|
66
81
|
|
|
67
82
|
Afterwards: npx myrmo-mcp doctor (checks everything), npx myrmo-mcp config (shows and changes settings).`;
|
|
83
|
+
const INIT_USAGE_ES = `myrmo-mcp init [opciones]: configura los agentes de esta máquina para usar Myrmo.
|
|
84
|
+
|
|
85
|
+
(sin opciones) todos los clientes de agentes que encuentre: Claude Code (plugin), Cursor, Windsurf,
|
|
86
|
+
Gemini CLI, Antigravity, Claude Desktop, VS Code (Copilot), OpenCode, Codex; la colonia pública
|
|
87
|
+
--client <id>[,<id>] solo estos: claude-code, cursor, windsurf, gemini, antigravity, claude-desktop,
|
|
88
|
+
vscode, opencode, codex
|
|
89
|
+
--url <colony> la colonia de tu organización en lugar de la pública
|
|
90
|
+
--key-file <f> | --key - su clave de acceso, de un fichero (vale el mensaje de invitación) o de la entrada estándar;
|
|
91
|
+
--key <key> también funciona, pero queda en el historial de la shell
|
|
92
|
+
--publish auto|ask|off cómo publican los agentes en esa colonia (si no, se te pregunta la primera vez)
|
|
93
|
+
--private solo para una colonia anterior al protocolo 1.7 (las nuevas dicen lo que son)
|
|
94
|
+
--agents-md [file] escribe también las reglas de uso en el AGENTS.md de este repositorio
|
|
95
|
+
--read-only con --agents-md: los agentes de este repositorio buscan y reportan, nunca publican
|
|
96
|
+
--no-rules no escribe las reglas de uso en las instrucciones globales de Gemini CLI o Windsurf
|
|
97
|
+
--dry-run enseña lo que cambiaría, sin cambiar nada
|
|
98
|
+
--yes no pregunta nada (init solo, en una terminal, hace unas pocas preguntas)
|
|
99
|
+
|
|
100
|
+
Después: npx myrmo-mcp doctor (lo comprueba todo), npx myrmo-mcp config (enseña y cambia los ajustes).`;
|
|
68
101
|
if (args[0] === "init" && (flag("--help") || flag("-h"))) {
|
|
69
|
-
console.log(INIT_USAGE);
|
|
102
|
+
console.log(tx(INIT_USAGE, INIT_USAGE_ES));
|
|
103
|
+
process.exit(0);
|
|
104
|
+
}
|
|
105
|
+
if (args[0] === "join" && (flag("--help") || flag("-h"))) {
|
|
106
|
+
console.log((await import("./join.js")).joinUsage());
|
|
70
107
|
process.exit(0);
|
|
71
108
|
}
|
|
72
109
|
if (flag("--help") || flag("-h") || args[0] === "help") {
|
|
73
|
-
console.log(USAGE);
|
|
110
|
+
console.log(tx(USAGE, USAGE_ES));
|
|
74
111
|
process.exit(0);
|
|
75
112
|
}
|
|
76
113
|
// A word that is not a command is a mistake, not a request to start the server and wait for input that never comes.
|
|
77
114
|
if (args[0] && !args[0].startsWith("-") && !COMMANDS.includes(args[0])) {
|
|
78
|
-
console.error(`Unknown command "${args[0]}".\n\n${USAGE}`);
|
|
115
|
+
console.error(tx(`Unknown command "${args[0]}".\n\n${USAGE}`, `Comando desconocido "${args[0]}".\n\n${USAGE_ES}`));
|
|
79
116
|
process.exit(2);
|
|
80
117
|
}
|
|
81
118
|
// `myrmo-mcp config` shows every setting, where its value comes from and what it does;
|
|
@@ -84,22 +121,22 @@ if (args[0] && !args[0].startsWith("-") && !COMMANDS.includes(args[0])) {
|
|
|
84
121
|
if (args[0] === "config") {
|
|
85
122
|
const [, key, value] = args;
|
|
86
123
|
if (key === undefined) {
|
|
87
|
-
console.log(`Settings file: ${configPath()} (nothing here is required: every setting has a default)`);
|
|
124
|
+
console.log(tx(`Settings file: ${configPath()} (nothing here is required: every setting has a default)`, `Fichero de configuración: ${configPath()} (nada aquí es obligatorio: cada ajuste tiene un valor por defecto)`));
|
|
88
125
|
for (const row of settingsReport()) {
|
|
89
126
|
console.log(` ${row.key.padEnd(20)} ${row.value.padEnd(7)} (${row.source}) ${row.about} [${row.values}]`);
|
|
90
127
|
}
|
|
91
|
-
console.log(` ${"agent id".padEnd(20)} ${readConfig().agent_id ?? "(created on first use)"} a random pseudonym; delete it from the file for a new one`);
|
|
128
|
+
console.log(` ${"agent id".padEnd(20)} ${readConfig().agent_id ?? tx("(created on first use)", "(se crea al primer uso)")} ${tx("a random pseudonym; delete it from the file for a new one", "un seudónimo aleatorio; bórralo del fichero para obtener otro")}`);
|
|
92
129
|
// Which colony this machine uses: the one thing a person most needs to know before an agent publishes anything.
|
|
93
130
|
const saved = readConfig().colony;
|
|
94
131
|
const inUse = process.env.MYRMO_URL?.trim() || saved?.url || "https://myrmo.dev";
|
|
95
132
|
const where = process.env.MYRMO_URL?.trim() ? "MYRMO_URL" : saved?.url ? "file" : "default";
|
|
96
|
-
const kind = /^https?:\/\/(www\.)?myrmo\.dev\/?$/i.test(inUse) ? "the PUBLIC colony: what is published there is public" : "your own colony";
|
|
97
|
-
console.log(` ${"colony".padEnd(20)} ${inUse} (${where}) ${kind}${saved?.api_key && saved.url === inUse ? ", with an access key" : ""}`);
|
|
98
|
-
console.log(" To change it: npx myrmo-mcp init --url <colony> --key-file <file>; back to the public colony: npx myrmo-mcp init --url https://myrmo.dev");
|
|
99
|
-
console.log("\nChange one with: npx myrmo-mcp config <setting> <value> (<value> = reset restores the default)");
|
|
133
|
+
const kind = /^https?:\/\/(www\.)?myrmo\.dev\/?$/i.test(inUse) ? tx("the PUBLIC colony: what is published there is public", "la colonia PÚBLICA: lo que se publica ahí es público") : tx("your own colony", "tu propia colonia");
|
|
134
|
+
console.log(` ${"colony".padEnd(20)} ${inUse} (${where}) ${kind}${saved?.api_key && saved.url === inUse ? tx(", with an access key", ", con clave de acceso") : ""}`);
|
|
135
|
+
console.log(tx(" To change it: npx myrmo-mcp init --url <colony> --key-file <file>; back to the public colony: npx myrmo-mcp init --url https://myrmo.dev", " Para cambiarla: npx myrmo-mcp init --url <colony> --key-file <file>; para volver a la colonia pública: npx myrmo-mcp init --url https://myrmo.dev"));
|
|
136
|
+
console.log(tx("\nChange one with: npx myrmo-mcp config <setting> <value> (<value> = reset restores the default)", "\nCambia uno con: npx myrmo-mcp config <setting> <value> (<value> = reset vuelve al valor por defecto)"));
|
|
100
137
|
}
|
|
101
138
|
else if (value === undefined) {
|
|
102
|
-
console.error("Usage: myrmo-mcp config [<setting> <value>]");
|
|
139
|
+
console.error(tx("Usage: myrmo-mcp config [<setting> <value>]", "Uso: myrmo-mcp config [<setting> <value>]"));
|
|
103
140
|
process.exit(2);
|
|
104
141
|
}
|
|
105
142
|
else {
|
|
@@ -110,7 +147,7 @@ if (args[0] === "config") {
|
|
|
110
147
|
}
|
|
111
148
|
console.log(result.message);
|
|
112
149
|
if (key === "publish" && (value === "ask" || value === "auto")) {
|
|
113
|
-
console.log("By letting agents publish you accept the terms of service: https://myrmo.dev/docs/legal/terms");
|
|
150
|
+
console.log(tx("By letting agents publish you accept the terms of service: https://myrmo.dev/docs/legal/terms", "Al dejar publicar a los agentes aceptas las condiciones del servicio: https://myrmo.dev/docs/es/legal/terms"));
|
|
114
151
|
}
|
|
115
152
|
}
|
|
116
153
|
process.exit(0);
|
|
@@ -121,21 +158,21 @@ if (args[0] === "config") {
|
|
|
121
158
|
if (args[0] === "export") {
|
|
122
159
|
const dir = args[1];
|
|
123
160
|
if (!dir || dir.startsWith("--")) {
|
|
124
|
-
console.error("Usage: myrmo-mcp export <dir> [--skill]");
|
|
161
|
+
console.error(tx("Usage: myrmo-mcp export <dir> [--skill]", "Uso: myrmo-mcp export <dir> [--skill]"));
|
|
125
162
|
process.exit(2);
|
|
126
163
|
}
|
|
127
164
|
const { writeExport } = await import("./export.js");
|
|
128
165
|
const colony = new Colony({ agentId: false });
|
|
129
166
|
const feed = colony.allTrails;
|
|
130
167
|
if (!feed) {
|
|
131
|
-
console.error("This needs myrmo 0.14 or newer next to myrmo-mcp.");
|
|
168
|
+
console.error(tx("This needs myrmo 0.14 or newer next to myrmo-mcp.", "Esto necesita myrmo 0.14 o superior junto a myrmo-mcp."));
|
|
132
169
|
process.exit(1);
|
|
133
170
|
}
|
|
134
171
|
const items = [];
|
|
135
172
|
for await (const item of feed.call(colony))
|
|
136
173
|
items.push(item);
|
|
137
174
|
const written = writeExport(dir, items, { skill: flag("--skill"), source: colony.url });
|
|
138
|
-
console.log(`${written} trails from ${colony.url} written to ${dir}${flag("--skill") ? " as a skill (SKILL.md)" : ""}.`);
|
|
175
|
+
console.log(tx(`${written} trails from ${colony.url} written to ${dir}${flag("--skill") ? " as a skill (SKILL.md)" : ""}.`, `${written} rastros de ${colony.url} escritos en ${dir}${flag("--skill") ? " como skill (SKILL.md)" : ""}.`));
|
|
139
176
|
process.exit(0);
|
|
140
177
|
}
|
|
141
178
|
const colonyKey = process.env.MYRMO_API_KEY?.trim() || savedColony?.api_key;
|
|
@@ -146,7 +183,7 @@ if (args[0] === "pilot-roi") {
|
|
|
146
183
|
const days = Math.min(90, Math.max(1, Number.parseInt(daysArg ?? "14", 10) || 14));
|
|
147
184
|
const token = process.env.MYRMO_ADMIN_TOKEN?.trim();
|
|
148
185
|
if (!token) {
|
|
149
|
-
console.error("pilot-roi needs the colony's operator token: MYRMO_ADMIN_TOKEN=<token> npx myrmo-mcp pilot-roi [days]");
|
|
186
|
+
console.error(tx("pilot-roi needs the colony's operator token: MYRMO_ADMIN_TOKEN=<token> npx myrmo-mcp pilot-roi [days]", "pilot-roi necesita el token de operador de la colonia: MYRMO_ADMIN_TOKEN=<token> npx myrmo-mcp pilot-roi [días]"));
|
|
150
187
|
process.exit(2);
|
|
151
188
|
}
|
|
152
189
|
const json = flag("--json");
|
|
@@ -157,16 +194,16 @@ if (args[0] === "pilot-roi") {
|
|
|
157
194
|
if (!res.ok) {
|
|
158
195
|
console.error(`${colonyUrl} answered ${res.status}: ${body.slice(0, 300)}`);
|
|
159
196
|
if (res.status === 401 || res.status === 403)
|
|
160
|
-
console.error("Check MYRMO_ADMIN_TOKEN: it is the colony's operator token, not a person's key.");
|
|
197
|
+
console.error(tx("Check MYRMO_ADMIN_TOKEN: it is the colony's operator token, not a person's key.", "Revisa MYRMO_ADMIN_TOKEN: es el token de operador de la colonia, no la clave de una persona."));
|
|
161
198
|
if (res.status === 404)
|
|
162
|
-
console.error("This colony is older than the pilot summary: upgrade it.");
|
|
199
|
+
console.error(tx("This colony is older than the pilot summary: upgrade it.", "Esta colonia es anterior al resumen del piloto: actualízala."));
|
|
163
200
|
process.exit(1);
|
|
164
201
|
}
|
|
165
202
|
process.stdout.write(json ? `${JSON.stringify(JSON.parse(body), null, 2)}\n` : body);
|
|
166
203
|
process.exit(0);
|
|
167
204
|
}
|
|
168
205
|
catch (err) {
|
|
169
|
-
console.error(`Could not reach ${colonyUrl}: ${err instanceof Error ? err.message : String(err)}`);
|
|
206
|
+
console.error(tx(`Could not reach ${colonyUrl}: ${err instanceof Error ? err.message : String(err)}`, `No se pudo llegar a ${colonyUrl}: ${err instanceof Error ? err.message : String(err)}`));
|
|
170
207
|
process.exit(1);
|
|
171
208
|
}
|
|
172
209
|
}
|
|
@@ -202,6 +239,52 @@ if (args[0] === "doctor") {
|
|
|
202
239
|
console.log(render(checks));
|
|
203
240
|
process.exit(checks.some((c) => c.level === "fail") ? 1 : 0);
|
|
204
241
|
}
|
|
242
|
+
if (args[0] === "join") {
|
|
243
|
+
const { exchange, handleFrom, joinUsage, parseInvitation } = await import("./join.js");
|
|
244
|
+
if (!args[1]) {
|
|
245
|
+
console.log(joinUsage());
|
|
246
|
+
process.exit(2);
|
|
247
|
+
}
|
|
248
|
+
const { readFileSync } = await import("node:fs");
|
|
249
|
+
const { userInfo } = await import("node:os");
|
|
250
|
+
const link = args[1] === "-" ? readFileSync(0, "utf8") : args[1];
|
|
251
|
+
const inv = parseInvitation(link);
|
|
252
|
+
if (typeof inv === "string") {
|
|
253
|
+
console.error(inv);
|
|
254
|
+
process.exit(2);
|
|
255
|
+
}
|
|
256
|
+
let name = option("--name", "") || handleFrom(process.env.USER ?? process.env.USERNAME ?? userInfo().username) || "";
|
|
257
|
+
if (!name) {
|
|
258
|
+
console.error(tx("Say how the colony should know you: --name <handle> (2 to 32 lowercase letters, digits, '.', '-' or '_').", "Di cómo debe conocerte la colonia: --name <alias> (de 2 a 32 letras minúsculas, dígitos, '.', '-' o '_')."));
|
|
259
|
+
process.exit(2);
|
|
260
|
+
}
|
|
261
|
+
const publish = option("--publish", "auto");
|
|
262
|
+
if (!["auto", "ask", "off"].includes(publish)) {
|
|
263
|
+
console.error(tx("--publish takes auto, ask or off", "--publish acepta auto, ask u off"));
|
|
264
|
+
process.exit(2);
|
|
265
|
+
}
|
|
266
|
+
const clientsArg = option("--client", "");
|
|
267
|
+
// The options are checked before the invitation is spent; the key here is a stand-in for the one the colony gives.
|
|
268
|
+
const initArgs = ["--url", inv.url, "--key", "myk_" + "0".repeat(64), "--publish", publish, ...(clientsArg ? ["--client", clientsArg] : [])];
|
|
269
|
+
const parsed = parseInitArgs(initArgs);
|
|
270
|
+
if (typeof parsed === "string") {
|
|
271
|
+
console.error(parsed);
|
|
272
|
+
process.exit(2);
|
|
273
|
+
}
|
|
274
|
+
if (flag("--dry-run")) {
|
|
275
|
+
console.log(tx(`Would join ${inv.url} as "${name}", then set this machine's agents up for it (publishing: ${publish}).`, `Se uniría a ${inv.url} como "${name}" y después configuraría para ella los agentes de esta máquina (publicación: ${publish}).`));
|
|
276
|
+
process.exit(0);
|
|
277
|
+
}
|
|
278
|
+
const joined = await exchange(inv, name);
|
|
279
|
+
if (typeof joined === "string") {
|
|
280
|
+
console.error(tx(`Could not join: ${joined}.`, `No se pudo unir: ${joined}.`));
|
|
281
|
+
process.exit(1);
|
|
282
|
+
}
|
|
283
|
+
console.log(tx(`Joined ${inv.url} as "${joined.name}". Setting up this machine's agents...\n`, `Te has unido a ${inv.url} como "${joined.name}". Configurando los agentes de esta máquina...\n`));
|
|
284
|
+
runInit({ ...parsed, key: joined.key, keySource: "file" });
|
|
285
|
+
console.log(tx("\nCheck it any time with: npx myrmo-mcp doctor", "\nCompruébalo cuando quieras con: npx myrmo-mcp doctor"));
|
|
286
|
+
process.exit(0);
|
|
287
|
+
}
|
|
205
288
|
if (args[0] === "init") {
|
|
206
289
|
const { canAsk, Cancelled, terminal, wizard } = await import("./wizard.js");
|
|
207
290
|
// `init` alone in a terminal asks a few questions (arrows and Enter); any option, --yes, a script or CI: as before.
|
|
@@ -233,16 +316,16 @@ if (args[0] === "init") {
|
|
|
233
316
|
const body = (await res.json().catch(() => null));
|
|
234
317
|
if (res.ok)
|
|
235
318
|
return { ok: true, status: res.status, profile: body?.colony?.profile, people: body?.colony?.people_detail ?? null };
|
|
236
|
-
const why = res.status === 401 ? "The colony does not accept this key (copied wrong, or revoked)." : res.status === 403 ? (body?.error?.message ?? "This machine's network is not allowed to connect.") : `The colony answered ${res.status}
|
|
319
|
+
const why = res.status === 401 ? tx("The colony does not accept this key (copied wrong, or revoked).", "La colonia no acepta esta clave (mal copiada o revocada).") : res.status === 403 ? (body?.error?.message ?? tx("This machine's network is not allowed to connect.", "La red de esta máquina no tiene permitido conectarse.")) : tx(`The colony answered ${res.status}.`, `La colonia respondió ${res.status}.`);
|
|
237
320
|
return { ok: false, status: res.status, detail: why };
|
|
238
321
|
}
|
|
239
322
|
catch {
|
|
240
|
-
return { ok: false, detail: "No answer from that address (wrong address, or not reachable from this network)." };
|
|
323
|
+
return { ok: false, detail: tx("No answer from that address (wrong address, or not reachable from this network).", "Esa dirección no responde (dirección equivocada, o no se llega desde esta red).") };
|
|
241
324
|
}
|
|
242
325
|
},
|
|
243
326
|
});
|
|
244
327
|
if (answer.cancelled) {
|
|
245
|
-
console.log("Nothing was changed.");
|
|
328
|
+
console.log(tx("Nothing was changed.", "No se ha cambiado nada."));
|
|
246
329
|
process.exit(0);
|
|
247
330
|
}
|
|
248
331
|
const opts = { clients: answer.clients, dryRun: false };
|
|
@@ -258,7 +341,7 @@ if (args[0] === "init") {
|
|
|
258
341
|
}
|
|
259
342
|
console.log("");
|
|
260
343
|
runInit(opts);
|
|
261
|
-
console.log("\nCheck it any time with: npx myrmo-mcp doctor");
|
|
344
|
+
console.log(tx("\nCheck it any time with: npx myrmo-mcp doctor", "\nCompruébalo cuando quieras con: npx myrmo-mcp doctor"));
|
|
262
345
|
process.exit(0);
|
|
263
346
|
}
|
|
264
347
|
catch (err) {
|
package/dist/init.js
CHANGED
|
@@ -19,6 +19,7 @@ import { dirname, join } from "node:path";
|
|
|
19
19
|
import { fileURLToPath } from "node:url";
|
|
20
20
|
import { writeConfig } from "myrmo";
|
|
21
21
|
import { VERSION } from "./server.js";
|
|
22
|
+
import { t as tx } from "./i18n.js";
|
|
22
23
|
export const AGENTS_BLOCK = `<!-- myrmo:start -->
|
|
23
24
|
## Myrmo: shared memory of solved errors
|
|
24
25
|
|
|
@@ -286,11 +287,11 @@ export function claudeCodeSetUp(home) {
|
|
|
286
287
|
};
|
|
287
288
|
const plugins = read(join(home, ".claude", "plugins", "installed_plugins.json"))?.plugins;
|
|
288
289
|
if (plugins && typeof plugins === "object" && Object.keys(plugins).some((k) => k.startsWith("myrmo@")))
|
|
289
|
-
return "the Myrmo plugin is installed";
|
|
290
|
+
return tx("the Myrmo plugin is installed", "el plugin de Myrmo está instalado");
|
|
290
291
|
const config = read(join(home, ".claude.json"));
|
|
291
292
|
const has = (servers) => !!servers && typeof servers === "object" && "myrmo" in servers;
|
|
292
293
|
if (config && (has(config.mcpServers) || Object.values(config.projects ?? {}).some((p) => has(p?.mcpServers))))
|
|
293
|
-
return 'a "myrmo" MCP server is already registered';
|
|
294
|
+
return tx('a "myrmo" MCP server is already registered', 'ya hay registrado un servidor MCP "myrmo"');
|
|
294
295
|
return null;
|
|
295
296
|
}
|
|
296
297
|
function claudeCliAvailable() {
|
|
@@ -335,12 +336,12 @@ export function keyWarnings(opts) {
|
|
|
335
336
|
return [];
|
|
336
337
|
const lines = [];
|
|
337
338
|
if (opts.keySource === "argument") {
|
|
338
|
-
lines.push("Note: a key given with --key stays in your shell's history and shows in the process list. Next time use --key-file <file> or --key - (reads it from standard input).");
|
|
339
|
+
lines.push(tx("Note: a key given with --key stays in your shell's history and shows in the process list. Next time use --key-file <file> or --key - (reads it from standard input).", "Nota: una clave pasada con --key queda en el historial de la shell y se ve en la lista de procesos. La próxima vez usa --key-file <file> o --key - (la lee de la entrada estándar)."));
|
|
339
340
|
}
|
|
340
341
|
try {
|
|
341
342
|
const u = new URL(opts.url);
|
|
342
343
|
if (u.protocol === "http:" && !nearbyHost(u.hostname)) {
|
|
343
|
-
lines.push(`Warning: ${u.origin} is plain http and not on this machine or a private network: the key would travel unencrypted. Use the colony's https address.`);
|
|
344
|
+
lines.push(tx(`Warning: ${u.origin} is plain http and not on this machine or a private network: the key would travel unencrypted. Use the colony's https address.`, `Aviso: ${u.origin} es http sin cifrar y no está en esta máquina ni en una red privada: la clave viajaría sin cifrar. Usa la dirección https de la colonia.`));
|
|
344
345
|
}
|
|
345
346
|
}
|
|
346
347
|
catch {
|
|
@@ -356,8 +357,8 @@ function setUpColony(opts, home, log, wanted) {
|
|
|
356
357
|
const colony = { url, ...(opts.key ? { api_key: opts.key } : {}), ...(opts.private ? { private: true } : {}), ...(opts.publish ? { publish: opts.publish } : {}) };
|
|
357
358
|
if (!opts.dryRun)
|
|
358
359
|
writeConfig({ colony });
|
|
359
|
-
const what = [opts.key ? "its access key" : "", opts.private ? "private mode" : "", opts.publish ? `publish ${opts.publish}` : ""].filter(Boolean).join(", ");
|
|
360
|
-
log(`Colony: ${verb} save ${url}${what ? ` with ${what}` : ""} in the settings file; the key and the choices apply only to that colony`);
|
|
360
|
+
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
|
+
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`));
|
|
361
362
|
// Antigravity has no plugin: copy the hook next to the settings and register it, so that after a failed command it
|
|
362
363
|
// looks the error up in this colony (and reminds the agent to report and to publish).
|
|
363
364
|
const agy = targets(home).find((t) => t.id === "antigravity");
|
|
@@ -370,7 +371,7 @@ function setUpColony(opts, home, log, wanted) {
|
|
|
370
371
|
const current = existsSync(file) ? readFileSync(file, "utf8") : undefined;
|
|
371
372
|
const merged = mergeHooks(current, `node "${script}"`);
|
|
372
373
|
if (!merged) {
|
|
373
|
-
log(`Antigravity: ${file} is not valid JSON, left untouched; the hook was not registered`);
|
|
374
|
+
log(tx(`Antigravity: ${file} is not valid JSON, left untouched; the hook was not registered`, `Antigravity: ${file} no es un JSON válido, no se ha tocado; el hook no se ha registrado`));
|
|
374
375
|
return;
|
|
375
376
|
}
|
|
376
377
|
if (!opts.dryRun) {
|
|
@@ -382,7 +383,7 @@ function setUpColony(opts, home, log, wanted) {
|
|
|
382
383
|
writeFileSync(file, merged.text);
|
|
383
384
|
}
|
|
384
385
|
}
|
|
385
|
-
log(`Antigravity: ${verb} install the hook in ${dir} and register it in ${file}`);
|
|
386
|
+
log(tx(`Antigravity: ${verb} install the hook in ${dir} and register it in ${file}`, `Antigravity: ${opts.dryRun ? "se instalaría" : "instalado"} el hook en ${dir} y ${opts.dryRun ? "se registraría" : "registrado"} en ${file}`));
|
|
386
387
|
}
|
|
387
388
|
/** A colony key anywhere in a text (the invitation message works as it is), or a text holding only the key. */
|
|
388
389
|
export function keyIn(text) {
|
|
@@ -399,32 +400,32 @@ export function runInit(opts) {
|
|
|
399
400
|
if (opts.url)
|
|
400
401
|
setUpColony(opts, home, log, wanted);
|
|
401
402
|
const alreadyThere = wanted(CLAUDE_CODE) ? claudeCodeSetUp(home) : null;
|
|
402
|
-
const slash = `In Claude Code's chat run: /plugin marketplace add ${MARKETPLACE} then /plugin install ${PLUGIN}
|
|
403
|
+
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}`);
|
|
403
404
|
if (alreadyThere) {
|
|
404
405
|
configured.push("Claude Code");
|
|
405
|
-
log(`Claude Code: already set up (${alreadyThere}); adding the server as well would give the agent every tool twice`);
|
|
406
|
+
log(tx(`Claude Code: already set up (${alreadyThere}); adding the server as well would give the agent every tool twice`, `Claude Code: ya configurado (${alreadyThere}); añadir también el servidor le daría al agente cada herramienta dos veces`));
|
|
406
407
|
}
|
|
407
408
|
else if (wanted(CLAUDE_CODE)) {
|
|
408
409
|
const bin = findClaudeCli(home, opts.env ?? process.env);
|
|
409
410
|
const cmd = `claude plugin marketplace add ${MARKETPLACE} && claude plugin install ${PLUGIN}`;
|
|
410
411
|
if (opts.dryRun) {
|
|
411
412
|
if (bin || opts.clients.includes(CLAUDE_CODE))
|
|
412
|
-
log(`Claude Code: ${verb} run: ${cmd}`);
|
|
413
|
+
log(tx(`Claude Code: ${verb} run: ${cmd}`, `Claude Code: se ejecutaría: ${cmd}`));
|
|
413
414
|
}
|
|
414
415
|
else if (bin) {
|
|
415
416
|
const done = installPlugin(bin);
|
|
416
417
|
if (done.ok) {
|
|
417
418
|
configured.push("Claude Code");
|
|
418
|
-
log(`Claude Code: plugin installed (${cmd}); it carries the MCP server, a skill and the failure hook`);
|
|
419
|
+
log(tx(`Claude Code: plugin installed (${cmd}); it carries the MCP server, a skill and the failure hook`, `Claude Code: plugin instalado (${cmd}); lleva el servidor MCP, una skill y el hook de fallos`));
|
|
419
420
|
}
|
|
420
421
|
else {
|
|
421
422
|
skipped.push("Claude Code");
|
|
422
|
-
log(`Claude Code: the plugin could not be installed (${done.said || "no output"}). ${slash}`);
|
|
423
|
+
log(tx(`Claude Code: the plugin could not be installed (${done.said || "no output"}). ${slash}`, `Claude Code: no se pudo instalar el plugin (${done.said || "sin salida"}). ${slash}`));
|
|
423
424
|
}
|
|
424
425
|
}
|
|
425
426
|
else if (opts.clients.includes(CLAUDE_CODE) || existsSync(join(home, ".claude"))) {
|
|
426
427
|
skipped.push("Claude Code");
|
|
427
|
-
log(`Claude Code: no "claude" command found (not on the PATH, and not in the VS Code extension). ${slash}`);
|
|
428
|
+
log(tx(`Claude Code: no "claude" command found (not on the PATH, and not in the VS Code extension). ${slash}`, `Claude Code: no se encontró el comando "claude" (ni en el PATH ni en la extensión de VS Code). ${slash}`));
|
|
428
429
|
}
|
|
429
430
|
}
|
|
430
431
|
for (const t of targets(home)) {
|
|
@@ -437,14 +438,14 @@ export function runInit(opts) {
|
|
|
437
438
|
if (!merged) {
|
|
438
439
|
skipped.push(t.name);
|
|
439
440
|
const by = t.kind === "codex"
|
|
440
|
-
? `add this to it: [mcp_servers.myrmo] command = ${JSON.stringify(entry.command)} args = ${JSON.stringify(entry.args)}`
|
|
441
|
-
: `add the "myrmo" server by hand: ${JSON.stringify({ [SHAPES[t.kind].key]: { myrmo: SHAPES[t.kind].value(entry) } })}
|
|
442
|
-
log(`${t.name}: ${t.file} cannot be edited safely (${t.kind === "codex" ? "it already defines myrmo in another form, or sets mcp_servers inline" : "it is not valid JSON"}), left untouched. ${by.charAt(0).toUpperCase() + by.slice(1)}`);
|
|
441
|
+
? tx(`add this to it: [mcp_servers.myrmo] command = ${JSON.stringify(entry.command)} args = ${JSON.stringify(entry.args)}`, `añádele esto: [mcp_servers.myrmo] command = ${JSON.stringify(entry.command)} args = ${JSON.stringify(entry.args)}`)
|
|
442
|
+
: tx(`add the "myrmo" server by hand: ${JSON.stringify({ [SHAPES[t.kind].key]: { myrmo: SHAPES[t.kind].value(entry) } })}`, `añade a mano el servidor "myrmo": ${JSON.stringify({ [SHAPES[t.kind].key]: { myrmo: SHAPES[t.kind].value(entry) } })}`);
|
|
443
|
+
log(tx(`${t.name}: ${t.file} cannot be edited safely (${t.kind === "codex" ? "it already defines myrmo in another form, or sets mcp_servers inline" : "it is not valid JSON"}), left untouched. ${by.charAt(0).toUpperCase() + by.slice(1)}`, `${t.name}: ${t.file} no se puede editar con seguridad (${t.kind === "codex" ? "ya define myrmo de otra forma, o pone mcp_servers en línea" : "no es un JSON válido"}), no se ha tocado. ${by.charAt(0).toUpperCase() + by.slice(1)}`));
|
|
443
444
|
continue;
|
|
444
445
|
}
|
|
445
446
|
if (!merged.changed) {
|
|
446
447
|
configured.push(t.name);
|
|
447
|
-
log(`${t.name}: already set up (${t.file})`);
|
|
448
|
+
log(tx(`${t.name}: already set up (${t.file})`, `${t.name}: ya configurado (${t.file})`));
|
|
448
449
|
continue;
|
|
449
450
|
}
|
|
450
451
|
if (!opts.dryRun) {
|
|
@@ -452,11 +453,10 @@ export function runInit(opts) {
|
|
|
452
453
|
writeFileSync(t.file, merged.text);
|
|
453
454
|
}
|
|
454
455
|
configured.push(t.name);
|
|
455
|
-
log(`${t.name}: ${verb} add the "myrmo" server to ${t.file}`);
|
|
456
|
+
log(tx(`${t.name}: ${verb} add the "myrmo" server to ${t.file}`, `${t.name}: ${opts.dryRun ? "se añadiría" : "añadido"} el servidor "myrmo" a ${t.file}`));
|
|
456
457
|
}
|
|
457
458
|
if (opts.private && wanted("claude-desktop") && (configured.includes("Claude Desktop") || skipped.includes("Claude Desktop"))) {
|
|
458
|
-
log(`Claude Desktop: the current app (the one with Plugins, Extensions and Connectors in its own menus) does not read ${targets(home).find((
|
|
459
|
-
`https://myrmo.dev/docs/reference/mcp#claude-desktop-when-the-colony-sits-behind-another-machine for how to add this colony there, and disable the public Myrmo plugin first if it is already enabled: with both on, a publish can go to the wrong one, silently.`);
|
|
459
|
+
log(tx(`Claude Desktop: the current app (the one with Plugins, Extensions and Connectors in its own menus) does not read ${targets(home).find((d) => d.id === "claude-desktop")?.file} for a local server — this file only helps an older Claude Desktop. See the Claude Desktop section of https://myrmo.dev/docs/reference/mcp#claude-desktop-when-the-colony-sits-behind-another-machine for how to add this colony there, and disable the public Myrmo plugin first if it is already enabled: with both on, a publish can go to the wrong one, silently.`, `Claude Desktop: la app actual (la que tiene Plugins, Extensions y Connectors en sus propios menús) no lee ${targets(home).find((d) => d.id === "claude-desktop")?.file} para un servidor local; este fichero solo sirve para un Claude Desktop antiguo. Mira la sección de Claude Desktop en https://myrmo.dev/docs/es/reference/mcp#claude-desktop-when-the-colony-sits-behind-another-machine para añadir allí esta colonia, y desactiva antes el plugin público de Myrmo si ya está activado: con los dos activados, una publicación puede ir al equivocado, en silencio.`));
|
|
460
460
|
}
|
|
461
461
|
const block = opts.readOnly ? AGENTS_BLOCK_READ_ONLY : opts.private ? AGENTS_BLOCK_PRIVATE : AGENTS_BLOCK;
|
|
462
462
|
if (opts.rules !== false) {
|
|
@@ -466,36 +466,36 @@ export function runInit(opts) {
|
|
|
466
466
|
const current = existsSync(r.file) ? readFileSync(r.file, "utf8") : undefined;
|
|
467
467
|
const next = upsertBlock(current, block);
|
|
468
468
|
if (next === current) {
|
|
469
|
-
log(`${r.name}: the usage rules are already in ${r.file}`);
|
|
469
|
+
log(tx(`${r.name}: the usage rules are already in ${r.file}`, `${r.name}: las reglas de uso ya están en ${r.file}`));
|
|
470
470
|
continue;
|
|
471
471
|
}
|
|
472
472
|
if (!opts.dryRun) {
|
|
473
473
|
mkdirSync(dirname(r.file), { recursive: true });
|
|
474
474
|
writeFileSync(r.file, next);
|
|
475
475
|
}
|
|
476
|
-
log(`${r.name}: ${verb} write the usage rules to ${r.file}, between <!-- myrmo:start --> and <!-- myrmo:end -->`);
|
|
476
|
+
log(tx(`${r.name}: ${verb} write the usage rules to ${r.file}, between <!-- myrmo:start --> and <!-- myrmo:end -->`, `${r.name}: ${opts.dryRun ? "se escribirían" : "escritas"} las reglas de uso en ${r.file}, entre <!-- myrmo:start --> y <!-- myrmo:end -->`));
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
if (opts.agentsMd) {
|
|
480
480
|
const current = existsSync(opts.agentsMd) ? readFileSync(opts.agentsMd, "utf8") : undefined;
|
|
481
481
|
const next = upsertBlock(current, block);
|
|
482
482
|
if (next === current)
|
|
483
|
-
log(`${opts.agentsMd}: already has the Myrmo block`);
|
|
483
|
+
log(tx(`${opts.agentsMd}: already has the Myrmo block`, `${opts.agentsMd}: ya tiene el bloque de Myrmo`));
|
|
484
484
|
else {
|
|
485
485
|
if (!opts.dryRun)
|
|
486
486
|
writeFileSync(opts.agentsMd, next);
|
|
487
|
-
log(`${opts.agentsMd}: ${verb} write the Myrmo block between <!-- myrmo:start --> and <!-- myrmo:end -->`);
|
|
487
|
+
log(tx(`${opts.agentsMd}: ${verb} write the Myrmo block between <!-- myrmo:start --> and <!-- myrmo:end -->`, `${opts.agentsMd}: ${opts.dryRun ? "se escribiría" : "escrito"} el bloque de Myrmo entre <!-- myrmo:start --> y <!-- myrmo:end -->`));
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
if (configured.length === 0 && skipped.length === 0 && !opts.agentsMd) {
|
|
491
|
-
log(`No supported client found. Use --client ${CLIENT_IDS.join("|")} to choose one, or see https://myrmo.dev/docs/getting-started/quickstart`);
|
|
491
|
+
log(tx(`No supported client found. Use --client ${CLIENT_IDS.join("|")} to choose one, or see https://myrmo.dev/docs/getting-started/quickstart`, `No se encontró ningún cliente compatible. Usa --client ${CLIENT_IDS.join("|")} para elegir uno, o mira https://myrmo.dev/docs/es/getting-started/quickstart`));
|
|
492
492
|
}
|
|
493
493
|
log("");
|
|
494
|
-
log("Restart your client to load it. Agents learn how to use Myrmo from the server itself: no more setup is needed.");
|
|
494
|
+
log(tx("Restart your client to load it. Agents learn how to use Myrmo from the server itself: no more setup is needed.", "Reinicia tu cliente para cargarlo. Los agentes aprenden a usar Myrmo del propio servidor: no hace falta configurar nada más."));
|
|
495
495
|
log(opts.url && opts.publish
|
|
496
|
-
? `Nothing else to configure. Publishing to ${opts.url.replace(/\/+$/, "")} is "${opts.publish}" (change it with: npx myrmo-mcp init --url ... --publish auto|ask|off).`
|
|
497
|
-
: "Nothing else to configure. The first time an agent wants to publish, you are shown what would be sent and asked (\"ask\" is preselected).");
|
|
498
|
-
log("To change a default: npx myrmo-mcp config (publishing, failed attempts before publishing, the Claude Code hook, anonymity)");
|
|
496
|
+
? tx(`Nothing else to configure. Publishing to ${opts.url.replace(/\/+$/, "")} is "${opts.publish}" (change it with: npx myrmo-mcp init --url ... --publish auto|ask|off).`, `Nada más que configurar. La publicación en ${opts.url.replace(/\/+$/, "")} es "${opts.publish}" (cámbiala con: npx myrmo-mcp init --url ... --publish auto|ask|off).`)
|
|
497
|
+
: tx("Nothing else to configure. The first time an agent wants to publish, you are shown what would be sent and asked (\"ask\" is preselected).", "Nada más que configurar. La primera vez que un agente quiera publicar, verás lo que se enviaría y se te preguntará (\"ask\" viene preseleccionado)."));
|
|
498
|
+
log(tx("To change a default: npx myrmo-mcp config (publishing, failed attempts before publishing, the Claude Code hook, anonymity)", "Para cambiar un valor por defecto: npx myrmo-mcp config (publicación, intentos fallidos antes de publicar, el hook de Claude Code, anonimato)"));
|
|
499
499
|
return { configured, skipped };
|
|
500
500
|
}
|
|
501
501
|
export function parseInitArgs(args, readStdin = () => readFileSync(0, "utf8")) {
|
|
@@ -508,7 +508,7 @@ export function parseInitArgs(args, readStdin = () => readFileSync(0, "utf8")) {
|
|
|
508
508
|
// One id or several, comma-separated, as the help says; the flag may also be repeated.
|
|
509
509
|
const ids = (args[++i] ?? "").split(",").map((id) => id.trim()).filter(Boolean);
|
|
510
510
|
if (!ids.length || ids.some((id) => !CLIENT_IDS.includes(id)))
|
|
511
|
-
return `--client needs one of: ${CLIENT_IDS.join(", ")}
|
|
511
|
+
return tx(`--client needs one of: ${CLIENT_IDS.join(", ")}`, `--client necesita uno de: ${CLIENT_IDS.join(", ")}`);
|
|
512
512
|
for (const id of ids)
|
|
513
513
|
if (!opts.clients.includes(id))
|
|
514
514
|
opts.clients.push(id);
|
|
@@ -527,17 +527,17 @@ export function parseInitArgs(args, readStdin = () => readFileSync(0, "utf8")) {
|
|
|
527
527
|
// The key stays out of the command line, so out of the shell's history and the process list.
|
|
528
528
|
const file = args[++i];
|
|
529
529
|
if (!file || file.startsWith("--"))
|
|
530
|
-
return "--key-file needs the path of a file that holds the key";
|
|
530
|
+
return tx("--key-file needs the path of a file that holds the key", "--key-file necesita la ruta de un fichero que contenga la clave");
|
|
531
531
|
try {
|
|
532
532
|
// A colony key anywhere in the file (the invitation message works as it is), or a file holding only the key.
|
|
533
533
|
const found = keyIn(readFileSync(file, "utf8"));
|
|
534
534
|
if (!found)
|
|
535
|
-
return `${file} holds no key
|
|
535
|
+
return tx(`${file} holds no key`, `${file} no contiene ninguna clave`);
|
|
536
536
|
opts.key = found;
|
|
537
537
|
opts.keySource = "file";
|
|
538
538
|
}
|
|
539
539
|
catch {
|
|
540
|
-
return `cannot read ${file}
|
|
540
|
+
return tx(`cannot read ${file}`, `no se puede leer ${file}`);
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
543
|
else if (a === "--key" && args[i + 1] === "-") {
|
|
@@ -548,11 +548,11 @@ export function parseInitArgs(args, readStdin = () => readFileSync(0, "utf8")) {
|
|
|
548
548
|
input = readStdin();
|
|
549
549
|
}
|
|
550
550
|
catch {
|
|
551
|
-
return "--key - reads the key from standard input, and there was none";
|
|
551
|
+
return tx("--key - reads the key from standard input, and there was none", "--key - lee la clave de la entrada estándar, y no había ninguna");
|
|
552
552
|
}
|
|
553
553
|
const found = keyIn(input);
|
|
554
554
|
if (!found)
|
|
555
|
-
return "--key - found no key on standard input";
|
|
555
|
+
return tx("--key - found no key on standard input", "--key - no encontró ninguna clave en la entrada estándar");
|
|
556
556
|
opts.key = found;
|
|
557
557
|
opts.keySource = "stdin";
|
|
558
558
|
}
|
|
@@ -569,13 +569,13 @@ export function parseInitArgs(args, readStdin = () => readFileSync(0, "utf8")) {
|
|
|
569
569
|
else if (value === "auto" || value === "ask" || value === "off")
|
|
570
570
|
opts.publish = value;
|
|
571
571
|
else
|
|
572
|
-
return "--publish takes auto, ask or off";
|
|
572
|
+
return tx("--publish takes auto, ask or off", "--publish acepta auto, ask u off");
|
|
573
573
|
}
|
|
574
574
|
else
|
|
575
|
-
return `Unknown option ${a}
|
|
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]`;
|
|
576
576
|
}
|
|
577
577
|
if ((opts.key || opts.publish) && !opts.url)
|
|
578
|
-
return "--key and --publish go with --url: they belong to one colony";
|
|
578
|
+
return tx("--key and --publish go with --url: they belong to one colony", "--key y --publish van con --url: pertenecen a una colonia");
|
|
579
579
|
if (opts.url) {
|
|
580
580
|
let host = "";
|
|
581
581
|
try {
|
|
@@ -585,15 +585,15 @@ export function parseInitArgs(args, readStdin = () => readFileSync(0, "utf8")) {
|
|
|
585
585
|
host = u.hostname.toLowerCase();
|
|
586
586
|
}
|
|
587
587
|
catch {
|
|
588
|
-
return `--url needs a colony address such as https://myrmo.example.internal, not ${JSON.stringify(opts.url)}
|
|
588
|
+
return tx(`--url needs a colony address such as https://myrmo.example.internal, not ${JSON.stringify(opts.url)}`, `--url necesita la dirección de una colonia, como https://myrmo.example.internal, no ${JSON.stringify(opts.url)}`);
|
|
589
589
|
}
|
|
590
590
|
if (PUBLIC_HOSTS.has(host) && (opts.private || opts.key))
|
|
591
|
-
return "--private and --key are for your own colony, not the public one";
|
|
591
|
+
return tx("--private and --key are for your own colony, not the public one", "--private y --key son para tu propia colonia, no para la pública");
|
|
592
592
|
}
|
|
593
593
|
if (opts.readOnly && !opts.agentsMd)
|
|
594
|
-
return "--read-only goes with --agents-md";
|
|
594
|
+
return tx("--read-only goes with --agents-md", "--read-only va con --agents-md");
|
|
595
595
|
if (opts.readOnly && opts.private)
|
|
596
|
-
return "--read-only and --private cannot go together";
|
|
596
|
+
return tx("--read-only and --private cannot go together", "--read-only y --private no pueden ir juntos");
|
|
597
597
|
// A key for a colony of one's own is an organisation's colony: since protocol 1.7 the invitation needs no --private,
|
|
598
598
|
// and without this the Antigravity hook and the organisation's rules would not be installed. If the colony says it is
|
|
599
599
|
// public, its declaration still wins when the server starts.
|
package/dist/join.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Invitation {
|
|
2
|
+
url: string;
|
|
3
|
+
invite: string;
|
|
4
|
+
}
|
|
5
|
+
/** The colony and the invitation of a link, or why it is not one. Also takes the address and the invitation apart. */
|
|
6
|
+
export declare function parseInvitation(link: string, invite?: string): Invitation | string;
|
|
7
|
+
/** A handle the colony accepts, from the name of this machine's user (`Ana García` -> `ana-garcia`), or null. */
|
|
8
|
+
export declare function handleFrom(name: string | undefined): string | null;
|
|
9
|
+
export interface Joined {
|
|
10
|
+
key: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
/** Exchanges the invitation for this person's access key. The error is a sentence for the person. */
|
|
14
|
+
export declare function exchange(inv: Invitation, name: string, fetcher?: typeof fetch): Promise<Joined | string>;
|
|
15
|
+
export declare const JOIN_USAGE_EN = "myrmo-mcp join <invitation link> [options]: join a colony and set this machine's agents up for it.\n\n <invitation link> the link you were sent (https://.../join#myi_...); \"-\" reads it from standard input,\n which keeps it out of the shell's history\n --name <handle> how the colony knows you (default: your user name, if it makes a valid handle)\n --client <id>[,<id>] only these agent clients (as in init)\n --publish auto|ask|off how your agents publish to the colony (default: auto)\n --dry-run say what would happen, join nothing and change nothing\n\nYour key is created once and saved on this machine; nobody else sees it.";
|
|
16
|
+
/** The usage of `join`, in the person's language. */
|
|
17
|
+
export declare function joinUsage(): string;
|
package/dist/join.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// `myrmo-mcp join <invitation link>`: join a colony with an invitation and set this machine's agents up for it, in one
|
|
2
|
+
// step. The colony gives the person their own access key in exchange for the invitation (POST /v1/join); the rest is
|
|
3
|
+
// `init --url <colony> --key <key>`.
|
|
4
|
+
//
|
|
5
|
+
// An invitation link is `<colony address>/join#myi_...`: the invitation travels after `#`, so a browser that opens the
|
|
6
|
+
// link never sends it to any server, and it stays out of proxies' logs.
|
|
7
|
+
import { t } from "./i18n.js";
|
|
8
|
+
const INVITE = /^myi_[0-9a-f]{64}$/;
|
|
9
|
+
const HANDLE = /^[a-z0-9._-]{2,32}$/;
|
|
10
|
+
/** The colony and the invitation of a link, or why it is not one. Also takes the address and the invitation apart. */
|
|
11
|
+
export function parseInvitation(link, invite) {
|
|
12
|
+
let u;
|
|
13
|
+
try {
|
|
14
|
+
u = new URL(link.trim());
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return t(`${JSON.stringify(link)} is not an invitation link (it looks like https://cloud.myrmo.dev/c/<colony>/join#myi_...)`, `${JSON.stringify(link)} no es un enlace de invitación (tiene la forma https://cloud.myrmo.dev/c/<colony>/join#myi_...)`);
|
|
18
|
+
}
|
|
19
|
+
if (u.protocol !== "https:" && u.protocol !== "http:")
|
|
20
|
+
return t("an invitation link starts with https:// (or http:// inside a team's network)", "un enlace de invitación empieza por https:// (o http:// dentro de la red de un equipo)");
|
|
21
|
+
const code = (invite ?? decodeURIComponent(u.hash.replace(/^#/, ""))).trim();
|
|
22
|
+
if (!INVITE.test(code))
|
|
23
|
+
return t("the link has no invitation after '#': copy the whole link you were sent", "el enlace no tiene invitación después de '#': copia el enlace completo que te enviaron");
|
|
24
|
+
const path = u.pathname.replace(/\/+$/, "").replace(/\/join$/, "");
|
|
25
|
+
return { url: `${u.origin}${path}`, invite: code };
|
|
26
|
+
}
|
|
27
|
+
/** A handle the colony accepts, from the name of this machine's user (`Ana García` -> `ana-garcia`), or null. */
|
|
28
|
+
export function handleFrom(name) {
|
|
29
|
+
const handle = (name ?? "")
|
|
30
|
+
.normalize("NFKD")
|
|
31
|
+
.replace(/[̀-ͯ]/g, "")
|
|
32
|
+
.toLowerCase()
|
|
33
|
+
.replace(/[^a-z0-9._-]+/g, "-")
|
|
34
|
+
.replace(/^[-._]+|[-._]+$/g, "")
|
|
35
|
+
.slice(0, 32);
|
|
36
|
+
return HANDLE.test(handle) ? handle : null;
|
|
37
|
+
}
|
|
38
|
+
/** Exchanges the invitation for this person's access key. The error is a sentence for the person. */
|
|
39
|
+
export async function exchange(inv, name, fetcher = fetch) {
|
|
40
|
+
if (!HANDLE.test(name))
|
|
41
|
+
return t("the name must be 2 to 32 lowercase letters, digits, '.', '-' or '_' (a handle, not an e-mail address)", "el nombre debe tener de 2 a 32 letras minúsculas, dígitos, '.', '-' o '_' (un alias, no una dirección de correo)");
|
|
42
|
+
let res;
|
|
43
|
+
try {
|
|
44
|
+
res = await fetcher(`${inv.url}/v1/join`, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: { "content-type": "application/json", accept: "application/json" },
|
|
47
|
+
body: JSON.stringify({ invite: inv.invite, name }),
|
|
48
|
+
signal: AbortSignal.timeout(15000),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return t(`no answer from ${inv.url} (wrong address, or not reachable from this network)`, `${inv.url} no responde (dirección equivocada, o no se llega desde esta red)`);
|
|
53
|
+
}
|
|
54
|
+
const body = (await res.json().catch(() => null));
|
|
55
|
+
if (res.status === 201 && body?.key?.startsWith("myk_"))
|
|
56
|
+
return { key: body.key, name };
|
|
57
|
+
if (res.status === 409)
|
|
58
|
+
return t(`someone in this colony already uses the name "${name}": run it again with --name <another>`, `alguien de esta colonia ya usa el nombre "${name}": vuelve a ejecutarlo con --name <otro>`);
|
|
59
|
+
if (res.status === 401)
|
|
60
|
+
return t("this invitation is not valid any more (expired, used up or revoked): ask for a new one", "esta invitación ya no es válida (caducó, se gastó o se revocó): pide una nueva");
|
|
61
|
+
if (res.status === 429)
|
|
62
|
+
return t("too many attempts from this network: try again in an hour", "demasiados intentos desde esta red: inténtalo dentro de una hora");
|
|
63
|
+
if (res.status === 403)
|
|
64
|
+
return body?.error?.message ?? t("this network is not allowed to reach the colony", "esta red no tiene permitido llegar a la colonia");
|
|
65
|
+
return body?.error?.message ?? t(`the colony answered ${res.status}`, `la colonia respondió ${res.status}`);
|
|
66
|
+
}
|
|
67
|
+
export const JOIN_USAGE_EN = `myrmo-mcp join <invitation link> [options]: join a colony and set this machine's agents up for it.
|
|
68
|
+
|
|
69
|
+
<invitation link> the link you were sent (https://.../join#myi_...); "-" reads it from standard input,
|
|
70
|
+
which keeps it out of the shell's history
|
|
71
|
+
--name <handle> how the colony knows you (default: your user name, if it makes a valid handle)
|
|
72
|
+
--client <id>[,<id>] only these agent clients (as in init)
|
|
73
|
+
--publish auto|ask|off how your agents publish to the colony (default: auto)
|
|
74
|
+
--dry-run say what would happen, join nothing and change nothing
|
|
75
|
+
|
|
76
|
+
Your key is created once and saved on this machine; nobody else sees it.`;
|
|
77
|
+
const JOIN_USAGE_ES = `myrmo-mcp join <enlace de invitación> [opciones]: unirse a una colonia y configurar para ella los agentes de esta máquina.
|
|
78
|
+
|
|
79
|
+
<enlace de invitación> el enlace que te enviaron (https://.../join#myi_...); "-" lo lee de la entrada estándar,
|
|
80
|
+
así no queda en el historial de la shell
|
|
81
|
+
--name <alias> cómo te conoce la colonia (por defecto: tu nombre de usuario, si es un alias válido)
|
|
82
|
+
--client <id>[,<id>] solo estos clientes de agentes (como en init)
|
|
83
|
+
--publish auto|ask|off cómo publican tus agentes en la colonia (por defecto: auto)
|
|
84
|
+
--dry-run cuenta lo que pasaría, sin unirse a nada ni cambiar nada
|
|
85
|
+
|
|
86
|
+
Tu clave se crea una vez y se guarda en esta máquina; nadie más la ve.`;
|
|
87
|
+
/** The usage of `join`, in the person's language. */
|
|
88
|
+
export function joinUsage() {
|
|
89
|
+
return t(JOIN_USAGE_EN, JOIN_USAGE_ES);
|
|
90
|
+
}
|
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.30.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
|
@@ -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.
|
|
9
|
+
export const VERSION = "0.30.0"; // 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
|
package/dist/wizard.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// The key handling is pure (a state and a key in, a state out) so it is tested without a terminal; `terminal()` is the
|
|
5
5
|
// thin part that reads keys and draws.
|
|
6
6
|
import { emitKeypressEvents } from "node:readline";
|
|
7
|
+
import { t } from "./i18n.js";
|
|
7
8
|
export function selectKey(s, key) {
|
|
8
9
|
if (key.ctrl && key.name === "c")
|
|
9
10
|
return { ...s, cancelled: true };
|
|
@@ -55,49 +56,49 @@ export function textKey(s, key) {
|
|
|
55
56
|
}
|
|
56
57
|
const KEY_SHAPE = /^[\x21-\x7e]{8,256}$/;
|
|
57
58
|
export async function wizard(ask, ctx) {
|
|
58
|
-
ask.say("Myrmo: a memory your coding agents share. A few questions (arrows and Enter; Ctrl+C to leave without changes).\n");
|
|
59
|
-
const where = await ask.select("Where should your agents look things up and share what they solve?", [
|
|
60
|
-
{ value: "public", label: "The public colony (myrmo.dev)", hint: "errors anyone can hit, shared with every agent; what is published is public" },
|
|
61
|
-
{ value: "org", label: "My organisation's private colony", hint: "you were given its address and an access key" },
|
|
59
|
+
ask.say(t("Myrmo: a memory your coding agents share. A few questions (arrows and Enter; Ctrl+C to leave without changes).\n", "Myrmo: una memoria que comparten tus agentes de programación. Unas pocas preguntas (flechas y Enter; Ctrl+C para salir sin cambios).\n"));
|
|
60
|
+
const where = await ask.select(t("Where should your agents look things up and share what they solve?", "¿Dónde deben buscar tus agentes y compartir lo que resuelven?"), [
|
|
61
|
+
{ value: "public", label: t("The public colony (myrmo.dev)", "La colonia pública (myrmo.dev)"), hint: t("errors anyone can hit, shared with every agent; what is published is public", "errores que cualquiera puede encontrarse, compartidos con todos los agentes; lo publicado es público") },
|
|
62
|
+
{ value: "org", label: t("My organisation's private colony", "La colonia privada de mi organización"), hint: t("you were given its address and an access key", "te dieron su dirección y una clave de acceso") },
|
|
62
63
|
], ctx.savedUrl && !/myrmo\.dev/.test(ctx.savedUrl) ? 1 : 0);
|
|
63
64
|
let url;
|
|
64
65
|
let key;
|
|
65
66
|
if (where === "org") {
|
|
66
67
|
for (;;) {
|
|
67
|
-
url = (await ask.text("Colony address (for example http://10.20.0.17:8080):", {
|
|
68
|
+
url = (await ask.text(t("Colony address (for example http://10.20.0.17:8080):", "Dirección de la colonia (por ejemplo http://10.20.0.17:8080):"), {
|
|
68
69
|
initial: ctx.savedUrl && !/myrmo\.dev/.test(ctx.savedUrl) ? ctx.savedUrl : "",
|
|
69
|
-
validate: (v) => (/^https?:\/\/\S+$/.test(v.trim()) ? (/\/\/(www\.)?myrmo\.dev(\/|$)/.test(v) ? "That is the public colony: choose it in the first question instead." : null) : "An address starting with http:// or https://"),
|
|
70
|
+
validate: (v) => (/^https?:\/\/\S+$/.test(v.trim()) ? (/\/\/(www\.)?myrmo\.dev(\/|$)/.test(v) ? t("That is the public colony: choose it in the first question instead.", "Esa es la colonia pública: elígela en la primera pregunta.") : null) : t("An address starting with http:// or https://", "Una dirección que empiece por http:// o https://")),
|
|
70
71
|
})).trim().replace(/\/+$/, "");
|
|
71
|
-
const how = await ask.select("Your access key:", [
|
|
72
|
-
{ value: "file", label: "Read it from a file", hint: "the invitation saved as a file works: the key stays out of your shell history" },
|
|
73
|
-
{ value: "paste", label: "Paste it", hint: "it is not shown while you type" },
|
|
72
|
+
const how = await ask.select(t("Your access key:", "Tu clave de acceso:"), [
|
|
73
|
+
{ value: "file", label: t("Read it from a file", "Leerla de un fichero"), hint: t("the invitation saved as a file works: the key stays out of your shell history", "vale la invitación guardada como fichero: la clave no queda en el historial de la shell") },
|
|
74
|
+
{ value: "paste", label: t("Paste it", "Pegarla"), hint: t("it is not shown while you type", "no se muestra mientras escribes") },
|
|
74
75
|
]);
|
|
75
76
|
if (how === "paste") {
|
|
76
|
-
key = (await ask.text("Access key:", { secret: true, validate: (v) => (KEY_SHAPE.test(v.trim()) ? null : "That does not look like a key (myk_ and 64 characters).") })).trim();
|
|
77
|
+
key = (await ask.text(t("Access key:", "Clave de acceso:"), { secret: true, validate: (v) => (KEY_SHAPE.test(v.trim()) ? null : t("That does not look like a key (myk_ and 64 characters).", "Eso no parece una clave (myk_ y 64 caracteres).")) })).trim();
|
|
77
78
|
}
|
|
78
79
|
else {
|
|
79
80
|
for (;;) {
|
|
80
|
-
const path = (await ask.text("Path of the file with the key:", { validate: (v) => (v.trim() ? null : "A path, please.") })).trim();
|
|
81
|
+
const path = (await ask.text(t("Path of the file with the key:", "Ruta del fichero con la clave:"), { validate: (v) => (v.trim() ? null : t("A path, please.", "Una ruta, por favor.")) })).trim();
|
|
81
82
|
const found = ctx.readKeyFile(path);
|
|
82
83
|
if (found) {
|
|
83
84
|
key = found;
|
|
84
85
|
break;
|
|
85
86
|
}
|
|
86
|
-
ask.say(" No key found in that file (a key starts with myk_). Try another path.");
|
|
87
|
+
ask.say(t(" No key found in that file (a key starts with myk_). Try another path.", " No hay ninguna clave en ese fichero (una clave empieza por myk_). Prueba con otra ruta."));
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
ask.say(" Checking the colony...");
|
|
90
|
+
ask.say(t(" Checking the colony...", " Comprobando la colonia..."));
|
|
90
91
|
const seen = await ctx.probe(url, key);
|
|
91
92
|
if (seen.ok) {
|
|
92
|
-
const people = seen.people === "named" ? "it counts each person's activity by name" : seen.people === "aggregate" ? "it counts the team's activity as a whole, not per person" : "";
|
|
93
|
-
const what = seen.profile === "organisation" ? "your organisation's colony" : seen.profile === "public" ? "a colony that says it is public" : "a colony (its server is older and does not say what it is; private mode is set from your key)";
|
|
94
|
-
ask.say(` ✓ Connected: ${what}${people ? `; ${people}` : ""}.`);
|
|
93
|
+
const people = seen.people === "named" ? t("it counts each person's activity by name", "cuenta la actividad de cada persona por su nombre") : seen.people === "aggregate" ? t("it counts the team's activity as a whole, not per person", "cuenta la actividad del equipo en conjunto, no por persona") : "";
|
|
94
|
+
const what = seen.profile === "organisation" ? t("your organisation's colony", "la colonia de tu organización") : seen.profile === "public" ? t("a colony that says it is public", "una colonia que dice ser pública") : t("a colony (its server is older and does not say what it is; private mode is set from your key)", "una colonia (su servidor es más antiguo y no dice qué es; el modo privado se activa con tu clave)");
|
|
95
|
+
ask.say(t(` ✓ Connected: ${what}${people ? `; ${people}` : ""}.`, ` ✓ Conectado: ${what}${people ? `; ${people}` : ""}.`));
|
|
95
96
|
break;
|
|
96
97
|
}
|
|
97
|
-
ask.say(` ✗ ${seen.detail ?? "It did not answer."}`);
|
|
98
|
-
const next = await ask.select("What now?", [
|
|
99
|
-
{ value: "retry", label: "Enter the address and key again" },
|
|
100
|
-
{ value: "keep", label: "Keep them anyway", hint: "for a colony that is not reachable from here right now" },
|
|
98
|
+
ask.say(` ✗ ${seen.detail ?? t("It did not answer.", "No respondió.")}`);
|
|
99
|
+
const next = await ask.select(t("What now?", "¿Y ahora?"), [
|
|
100
|
+
{ value: "retry", label: t("Enter the address and key again", "Introducir otra vez la dirección y la clave") },
|
|
101
|
+
{ value: "keep", label: t("Keep them anyway", "Conservarlas igualmente"), hint: t("for a colony that is not reachable from here right now", "para una colonia a la que ahora mismo no se llega desde aquí") },
|
|
101
102
|
]);
|
|
102
103
|
if (next === "keep")
|
|
103
104
|
break;
|
|
@@ -105,30 +106,30 @@ export async function wizard(ask, ctx) {
|
|
|
105
106
|
}
|
|
106
107
|
let clients = [];
|
|
107
108
|
for (;;) {
|
|
108
|
-
clients = await ask.multi("Which agents should use it? (Space to change, a for all, Enter to go on)", ctx.clients.map((c) => ({ value: c.id, label: c.name, hint: c.found ? "found on this machine" : "not found", picked: c.found })));
|
|
109
|
+
clients = await ask.multi(t("Which agents should use it? (Space to change, a for all, Enter to go on)", "¿Qué agentes deben usarla? (Espacio para cambiar, a para todos, Enter para seguir)"), ctx.clients.map((c) => ({ value: c.id, label: c.name, hint: c.found ? t("found on this machine", "encontrado en esta máquina") : t("not found", "no encontrado"), picked: c.found })));
|
|
109
110
|
if (clients.length)
|
|
110
111
|
break;
|
|
111
|
-
ask.say(" Choose at least one (Space marks it).");
|
|
112
|
+
ask.say(t(" Choose at least one (Space marks it).", " Elige al menos uno (Espacio lo marca)."));
|
|
112
113
|
}
|
|
113
|
-
const publish = await ask.select(where === "org" ? "When your agents solve something the colony did not know:" : "When your agent solves an error nobody had published:", where === "org"
|
|
114
|
+
const publish = await ask.select(where === "org" ? t("When your agents solve something the colony did not know:", "Cuando tus agentes resuelvan algo que la colonia no sabía:") : t("When your agent solves an error nobody had published:", "Cuando tu agente resuelva un error que nadie había publicado:"), where === "org"
|
|
114
115
|
? [
|
|
115
|
-
{ value: "auto", label: "Share it with the team by itself", hint: "recommended for a team's colony: internal names are kept, credentials and personal data removed" },
|
|
116
|
-
{ value: "ask", label: "Ask me each time", hint: "you see exactly what would be sent" },
|
|
117
|
-
{ value: "off", label: "Never share, only look things up" },
|
|
116
|
+
{ value: "auto", label: t("Share it with the team by itself", "Compartirlo con el equipo por su cuenta"), hint: t("recommended for a team's colony: internal names are kept, credentials and personal data removed", "recomendado para la colonia de un equipo: se conservan los nombres internos y se quitan las credenciales y los datos personales") },
|
|
117
|
+
{ value: "ask", label: t("Ask me each time", "Preguntarme cada vez"), hint: t("you see exactly what would be sent", "ves exactamente lo que se enviaría") },
|
|
118
|
+
{ value: "off", label: t("Never share, only look things up", "No compartir nunca, solo buscar") },
|
|
118
119
|
]
|
|
119
120
|
: [
|
|
120
|
-
{ value: "ask", label: "Ask me each time", hint: "recommended: you see exactly what would be published, and it is public" },
|
|
121
|
-
{ value: "auto", label: "Publish it by itself", hint: "names of people, companies and internal systems are removed first" },
|
|
122
|
-
{ value: "off", label: "Never publish, only look things up" },
|
|
121
|
+
{ value: "ask", label: t("Ask me each time", "Preguntarme cada vez"), hint: t("recommended: you see exactly what would be published, and it is public", "recomendado: ves exactamente lo que se publicaría, y es público") },
|
|
122
|
+
{ value: "auto", label: t("Publish it by itself", "Publicarlo por su cuenta"), hint: t("names of people, companies and internal systems are removed first", "antes se quitan los nombres de personas, empresas y sistemas internos") },
|
|
123
|
+
{ value: "off", label: t("Never publish, only look things up", "No publicar nunca, solo buscar") },
|
|
123
124
|
]);
|
|
124
125
|
const chosen = ctx.clients.filter((c) => clients.includes(c.id)).map((c) => c.name);
|
|
125
126
|
ask.say("");
|
|
126
|
-
ask.say(` Colony: ${where === "org" ? `${url} (your organisation's)` : "https://myrmo.dev (public)"}`);
|
|
127
|
-
ask.say(` Agents: ${chosen.length ? chosen.join(", ") : "none"}`);
|
|
128
|
-
ask.say(` Publishing: ${publish === "auto" ? "by itself" : publish === "ask" ? "ask each time" : "never"}`);
|
|
129
|
-
const go = await ask.select("Set it up?", [
|
|
130
|
-
{ value: true, label: "Yes, set it up" },
|
|
131
|
-
{ value: false, label: "No, leave everything as it is" },
|
|
127
|
+
ask.say(t(` Colony: ${where === "org" ? `${url} (your organisation's)` : "https://myrmo.dev (public)"}`, ` Colonia: ${where === "org" ? `${url} (de tu organización)` : "https://myrmo.dev (pública)"}`));
|
|
128
|
+
ask.say(t(` Agents: ${chosen.length ? chosen.join(", ") : "none"}`, ` Agentes: ${chosen.length ? chosen.join(", ") : "ninguno"}`));
|
|
129
|
+
ask.say(t(` Publishing: ${publish === "auto" ? "by itself" : publish === "ask" ? "ask each time" : "never"}`, ` Publicar: ${publish === "auto" ? "por su cuenta" : publish === "ask" ? "preguntar cada vez" : "nunca"}`));
|
|
130
|
+
const go = await ask.select(t("Set it up?", "¿Lo configuro?"), [
|
|
131
|
+
{ value: true, label: t("Yes, set it up", "Sí, configúralo") },
|
|
132
|
+
{ value: false, label: t("No, leave everything as it is", "No, deja todo como está") },
|
|
132
133
|
]);
|
|
133
134
|
if (!go)
|
|
134
135
|
return { cancelled: true };
|
|
@@ -172,7 +173,7 @@ export function terminal(stdin = process.stdin, stdout = process.stdout, env = p
|
|
|
172
173
|
state = next;
|
|
173
174
|
if (state.cancelled) {
|
|
174
175
|
finish();
|
|
175
|
-
stdout.write(dim("Nothing was changed.\n"));
|
|
176
|
+
stdout.write(dim(t("Nothing was changed.\n", "No se ha cambiado nada.\n")));
|
|
176
177
|
return reject(new Cancelled());
|
|
177
178
|
}
|
|
178
179
|
draw(render(state));
|
|
@@ -203,14 +204,14 @@ export function terminal(stdin = process.stdin, stdout = process.stdout, env = p
|
|
|
203
204
|
},
|
|
204
205
|
async multi(question, choices) {
|
|
205
206
|
const s = await run({ index: 0, picked: choices.map((c) => c.picked), done: false, cancelled: false }, multiKey, (st) => st.done
|
|
206
|
-
? [`${accent("?")} ${bold(question)} ${accent(choices.filter((_, i) => st.picked[i]).map((c) => c.label).join(", ") || "none")}`]
|
|
207
|
+
? [`${accent("?")} ${bold(question)} ${accent(choices.filter((_, i) => st.picked[i]).map((c) => c.label).join(", ") || t("none", "ninguno"))}`]
|
|
207
208
|
: [`${accent("?")} ${bold(question)}`, ...choices.map((c, i) => `${i === st.index ? accent("❯") : " "} ${st.picked[i] ? accent("◉") : "◯"} ${c.label}${c.hint ? dim(` ${c.hint}`) : ""}`)]);
|
|
208
209
|
return choices.filter((_, i) => s.picked[i]).map((c) => c.value);
|
|
209
210
|
},
|
|
210
211
|
async text(question, options = {}) {
|
|
211
212
|
let error = "";
|
|
212
213
|
const shown = (v) => (options.secret ? "•".repeat(Math.min(v.length, 40)) : v);
|
|
213
|
-
const s = await run({ value: options.initial ?? "", done: false, cancelled: false }, textKey, (st) => (st.done ? [`${accent("?")} ${bold(question)} ${accent(shown(st.value))}`] : [`${accent("?")} ${bold(question)} ${shown(st.value)}`, error ? paint("31", ` ${error}`) : dim(" Enter to confirm")]), (st) => {
|
|
214
|
+
const s = await run({ value: options.initial ?? "", done: false, cancelled: false }, textKey, (st) => (st.done ? [`${accent("?")} ${bold(question)} ${accent(shown(st.value))}`] : [`${accent("?")} ${bold(question)} ${shown(st.value)}`, error ? paint("31", ` ${error}`) : dim(t(" Enter to confirm", " Enter para confirmar"))]), (st) => {
|
|
214
215
|
error = options.validate?.(st.value) ?? "";
|
|
215
216
|
return !error;
|
|
216
217
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myrmo-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"myrmo": ">=0.9.0 <1.0.0",
|
|
54
|
-
"@modelcontextprotocol/sdk": "^1.32.
|
|
54
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
55
55
|
"zod": "^3.25.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|