@runeya/runeya 2.0.64 → 2.0.66
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/agent/index.js +135 -26
- package/agent/index.js.map +1 -1
- package/index.js +1 -1
- package/mcp-server/launch.d.ts +45 -0
- package/mcp-server/launch.js +65 -0
- package/mcp-server/launch.js.map +1 -0
- package/package.json +1 -1
- package/{src-RN7TATWK.js → src-ETRPQHFP.js} +101 -23
- package/src-ETRPQHFP.js.map +1 -0
- package/src-RN7TATWK.js.map +0 -1
package/index.js
CHANGED
|
@@ -270,7 +270,7 @@ function listenWithRetry(server, port, host, wss, maxRetries = 20, delay = 500)
|
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
272
|
async function main() {
|
|
273
|
-
const { createLocalServer, pullEnv, PullEnvError, registerInstance } = await import("./src-
|
|
273
|
+
const { createLocalServer, pullEnv, PullEnvError, registerInstance } = await import("./src-ETRPQHFP.js");
|
|
274
274
|
if (isPullEnv) {
|
|
275
275
|
if (!serviceArg) {
|
|
276
276
|
console.error("Error: --service (-s) is required with --pull-env");
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment brancher le serveur MCP Runeya sur un CLI d'IA.
|
|
3
|
+
*
|
|
4
|
+
* Runeya n'installe rien dans la configuration de la machine : il passe sa
|
|
5
|
+
* config MCP en ligne de commande, au moment où il lance lui-même le CLI. Le
|
|
6
|
+
* `~/.claude.json` ou le `~/.codex/config.toml` de l'utilisateur reste intact,
|
|
7
|
+
* et un CLI lancé à la main depuis un terminal ne voit pas ce serveur.
|
|
8
|
+
*
|
|
9
|
+
* Chaque CLI a sa syntaxe — d'où ce module, seule source de vérité partagée par
|
|
10
|
+
* les deux points de lancement (l'agent, et le serveur en mode local).
|
|
11
|
+
*/
|
|
12
|
+
/** Variables d'environnement que le serveur MCP attend pour joindre Runeya. */
|
|
13
|
+
interface RuneyaMcpEnv {
|
|
14
|
+
RUNEYA_BASE_URL?: string;
|
|
15
|
+
RUNEYA_API_TOKEN?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Chemin du point d'entrée du serveur MCP, à lancer avec `node`.
|
|
19
|
+
*
|
|
20
|
+
* Ne PAS se fier à `import.meta.url` pour viser `./index.js` : ce module est
|
|
21
|
+
* bundlé dans l'agent et dans le serveur (tsup y bundle les paquets @runeya
|
|
22
|
+
* via `noExternal`), donc
|
|
23
|
+
* `import.meta.url` y désigne le bundle hôte, pas ce paquet. On résout donc le
|
|
24
|
+
* paquet, puis on sonde les emplacements de la version packagée, où les liens
|
|
25
|
+
* symboliques de l'espace de travail n'existent plus.
|
|
26
|
+
*/
|
|
27
|
+
declare function resolveMcpServerPath(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Arguments `--mcp-config` pour le CLI `claude`, qui attend du JSON.
|
|
30
|
+
*
|
|
31
|
+
* Volontairement non strict : le CLI démarre aussi les serveurs MCP de la
|
|
32
|
+
* machine. Cela coûte quelques secondes par lancement, mais l'utilisateur garde
|
|
33
|
+
* ses propres outils.
|
|
34
|
+
*/
|
|
35
|
+
declare function claudeMcpArgs(env: RuneyaMcpEnv): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Arguments `-c` pour le CLI `codex`, qui attend du TOML.
|
|
38
|
+
*
|
|
39
|
+
* Codex n'a pas d'équivalent de `--mcp-config` : il expose des surcharges de
|
|
40
|
+
* configuration en TOML (`-c chemin.pointé=valeur`), à placer AVANT la
|
|
41
|
+
* sous-commande. Une table inline décrit le serveur en une seule surcharge.
|
|
42
|
+
*/
|
|
43
|
+
declare function codexMcpArgs(env: RuneyaMcpEnv): string[];
|
|
44
|
+
|
|
45
|
+
export { type RuneyaMcpEnv, claudeMcpArgs, codexMcpArgs, resolveMcpServerPath };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// src/launch.ts
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
import { existsSync } from "fs";
|
|
5
|
+
function resolveMcpServerPath() {
|
|
6
|
+
try {
|
|
7
|
+
const req = createRequire(import.meta.url);
|
|
8
|
+
return req.resolve("@runeya/packages-mcp-server");
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
const candidates = [
|
|
12
|
+
// Build packagé du CLI : dist/agent/index.js et dist/index.js côtoient
|
|
13
|
+
// dist/mcp-server/, copié là par le post-build.
|
|
14
|
+
new URL("../mcp-server/index.js", import.meta.url),
|
|
15
|
+
new URL("./mcp-server/index.js", import.meta.url),
|
|
16
|
+
// Monorepo, depuis un dist d'app.
|
|
17
|
+
new URL("../../../packages/mcp-server/dist/index.js", import.meta.url),
|
|
18
|
+
new URL("../../../../packages/mcp-server/dist/index.js", import.meta.url)
|
|
19
|
+
];
|
|
20
|
+
for (const c of candidates) {
|
|
21
|
+
const p = fileURLToPath(c);
|
|
22
|
+
if (existsSync(p)) return p;
|
|
23
|
+
}
|
|
24
|
+
throw new Error("Could not locate @runeya/packages-mcp-server (built dist not found)");
|
|
25
|
+
}
|
|
26
|
+
function pickEnv(env) {
|
|
27
|
+
return {
|
|
28
|
+
...env.RUNEYA_BASE_URL ? { RUNEYA_BASE_URL: env.RUNEYA_BASE_URL } : {},
|
|
29
|
+
...env.RUNEYA_API_TOKEN ? { RUNEYA_API_TOKEN: env.RUNEYA_API_TOKEN } : {}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function claudeMcpArgs(env) {
|
|
33
|
+
const config = JSON.stringify({
|
|
34
|
+
mcpServers: {
|
|
35
|
+
runeya: {
|
|
36
|
+
command: "node",
|
|
37
|
+
args: [resolveMcpServerPath()],
|
|
38
|
+
env: pickEnv(env)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return ["--mcp-config", config];
|
|
43
|
+
}
|
|
44
|
+
function codexMcpArgs(env) {
|
|
45
|
+
const fields = [
|
|
46
|
+
`command=${tomlString("node")}`,
|
|
47
|
+
`args=[${tomlString(resolveMcpServerPath())}]`
|
|
48
|
+
];
|
|
49
|
+
const entries = Object.entries(pickEnv(env));
|
|
50
|
+
if (entries.length > 0) {
|
|
51
|
+
const inline = entries.map(([k, v]) => `${k}=${tomlString(v)}`).join(",");
|
|
52
|
+
fields.push(`env={${inline}}`);
|
|
53
|
+
}
|
|
54
|
+
return ["-c", `mcp_servers.runeya={${fields.join(",")}}`];
|
|
55
|
+
}
|
|
56
|
+
function tomlString(value) {
|
|
57
|
+
const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/[\u0000-\u001f\u007f]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
58
|
+
return `"${escaped}"`;
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
claudeMcpArgs,
|
|
62
|
+
codexMcpArgs,
|
|
63
|
+
resolveMcpServerPath
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=launch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/launch.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url';\nimport { createRequire } from 'node:module';\nimport { existsSync } from 'node:fs';\n\n/**\n * Comment brancher le serveur MCP Runeya sur un CLI d'IA.\n *\n * Runeya n'installe rien dans la configuration de la machine : il passe sa\n * config MCP en ligne de commande, au moment où il lance lui-même le CLI. Le\n * `~/.claude.json` ou le `~/.codex/config.toml` de l'utilisateur reste intact,\n * et un CLI lancé à la main depuis un terminal ne voit pas ce serveur.\n *\n * Chaque CLI a sa syntaxe — d'où ce module, seule source de vérité partagée par\n * les deux points de lancement (l'agent, et le serveur en mode local).\n */\n\n/** Variables d'environnement que le serveur MCP attend pour joindre Runeya. */\nexport interface RuneyaMcpEnv {\n RUNEYA_BASE_URL?: string;\n RUNEYA_API_TOKEN?: string;\n}\n\n/**\n * Chemin du point d'entrée du serveur MCP, à lancer avec `node`.\n *\n * Ne PAS se fier à `import.meta.url` pour viser `./index.js` : ce module est\n * bundlé dans l'agent et dans le serveur (tsup y bundle les paquets @runeya\n * via `noExternal`), donc\n * `import.meta.url` y désigne le bundle hôte, pas ce paquet. On résout donc le\n * paquet, puis on sonde les emplacements de la version packagée, où les liens\n * symboliques de l'espace de travail n'existent plus.\n */\nexport function resolveMcpServerPath(): string {\n try {\n const req = createRequire(import.meta.url);\n return req.resolve('@runeya/packages-mcp-server');\n } catch { /* pas de node_modules résolvable : on sonde le disque */ }\n\n const candidates = [\n // Build packagé du CLI : dist/agent/index.js et dist/index.js côtoient\n // dist/mcp-server/, copié là par le post-build.\n new URL('../mcp-server/index.js', import.meta.url),\n new URL('./mcp-server/index.js', import.meta.url),\n // Monorepo, depuis un dist d'app.\n new URL('../../../packages/mcp-server/dist/index.js', import.meta.url),\n new URL('../../../../packages/mcp-server/dist/index.js', import.meta.url),\n ];\n for (const c of candidates) {\n const p = fileURLToPath(c);\n if (existsSync(p)) return p;\n }\n throw new Error('Could not locate @runeya/packages-mcp-server (built dist not found)');\n}\n\n/** Ne garde que les variables renseignées : une valeur vide n'aide personne. */\nfunction pickEnv(env: RuneyaMcpEnv): Record<string, string> {\n return {\n ...(env.RUNEYA_BASE_URL ? { RUNEYA_BASE_URL: env.RUNEYA_BASE_URL } : {}),\n ...(env.RUNEYA_API_TOKEN ? { RUNEYA_API_TOKEN: env.RUNEYA_API_TOKEN } : {}),\n };\n}\n\n/**\n * Arguments `--mcp-config` pour le CLI `claude`, qui attend du JSON.\n *\n * Volontairement non strict : le CLI démarre aussi les serveurs MCP de la\n * machine. Cela coûte quelques secondes par lancement, mais l'utilisateur garde\n * ses propres outils.\n */\nexport function claudeMcpArgs(env: RuneyaMcpEnv): string[] {\n const config = JSON.stringify({\n mcpServers: {\n runeya: {\n command: 'node',\n args: [resolveMcpServerPath()],\n env: pickEnv(env),\n },\n },\n });\n return ['--mcp-config', config];\n}\n\n/**\n * Arguments `-c` pour le CLI `codex`, qui attend du TOML.\n *\n * Codex n'a pas d'équivalent de `--mcp-config` : il expose des surcharges de\n * configuration en TOML (`-c chemin.pointé=valeur`), à placer AVANT la\n * sous-commande. Une table inline décrit le serveur en une seule surcharge.\n */\nexport function codexMcpArgs(env: RuneyaMcpEnv): string[] {\n const fields = [\n `command=${tomlString('node')}`,\n `args=[${tomlString(resolveMcpServerPath())}]`,\n ];\n\n const entries = Object.entries(pickEnv(env));\n if (entries.length > 0) {\n const inline = entries.map(([k, v]) => `${k}=${tomlString(v)}`).join(',');\n fields.push(`env={${inline}}`);\n }\n\n return ['-c', `mcp_servers.runeya={${fields.join(',')}}`];\n}\n\n/**\n * Chaîne TOML de base : seuls la contre-oblique et le guillemet doivent être\n * échappés. Les caractères de contrôle, eux, sont interdits par le format — un\n * chemin ou un jeton qui en contiendrait casserait la config en silence.\n */\nfunction tomlString(value: string): string {\n const escaped = value\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/[\\u0000-\\u001f\\u007f]/g, (c) => `\\\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`);\n return `\"${escaped}\"`;\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AA8BpB,SAAS,uBAA+B;AAC7C,MAAI;AACF,UAAM,MAAM,cAAc,YAAY,GAAG;AACzC,WAAO,IAAI,QAAQ,6BAA6B;AAAA,EAClD,QAAQ;AAAA,EAA4D;AAEpE,QAAM,aAAa;AAAA;AAAA;AAAA,IAGjB,IAAI,IAAI,0BAA0B,YAAY,GAAG;AAAA,IACjD,IAAI,IAAI,yBAAyB,YAAY,GAAG;AAAA;AAAA,IAEhD,IAAI,IAAI,8CAA8C,YAAY,GAAG;AAAA,IACrE,IAAI,IAAI,iDAAiD,YAAY,GAAG;AAAA,EAC1E;AACA,aAAW,KAAK,YAAY;AAC1B,UAAM,IAAI,cAAc,CAAC;AACzB,QAAI,WAAW,CAAC,EAAG,QAAO;AAAA,EAC5B;AACA,QAAM,IAAI,MAAM,qEAAqE;AACvF;AAGA,SAAS,QAAQ,KAA2C;AAC1D,SAAO;AAAA,IACL,GAAI,IAAI,kBAAkB,EAAE,iBAAiB,IAAI,gBAAgB,IAAI,CAAC;AAAA,IACtE,GAAI,IAAI,mBAAmB,EAAE,kBAAkB,IAAI,iBAAiB,IAAI,CAAC;AAAA,EAC3E;AACF;AASO,SAAS,cAAc,KAA6B;AACzD,QAAM,SAAS,KAAK,UAAU;AAAA,IAC5B,YAAY;AAAA,MACV,QAAQ;AAAA,QACN,SAAS;AAAA,QACT,MAAM,CAAC,qBAAqB,CAAC;AAAA,QAC7B,KAAK,QAAQ,GAAG;AAAA,MAClB;AAAA,IACF;AAAA,EACF,CAAC;AACD,SAAO,CAAC,gBAAgB,MAAM;AAChC;AASO,SAAS,aAAa,KAA6B;AACxD,QAAM,SAAS;AAAA,IACb,WAAW,WAAW,MAAM,CAAC;AAAA,IAC7B,SAAS,WAAW,qBAAqB,CAAC,CAAC;AAAA,EAC7C;AAEA,QAAM,UAAU,OAAO,QAAQ,QAAQ,GAAG,CAAC;AAC3C,MAAI,QAAQ,SAAS,GAAG;AACtB,UAAM,SAAS,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG;AACxE,WAAO,KAAK,QAAQ,MAAM,GAAG;AAAA,EAC/B;AAEA,SAAO,CAAC,MAAM,uBAAuB,OAAO,KAAK,GAAG,CAAC,GAAG;AAC1D;AAOA,SAAS,WAAW,OAAuB;AACzC,QAAM,UAAU,MACb,QAAQ,OAAO,MAAM,EACrB,QAAQ,MAAM,KAAK,EACnB,QAAQ,0BAA0B,CAAC,MAAM,MAAM,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAAE;AACjG,SAAO,IAAI,OAAO;AACpB;","names":[]}
|
package/package.json
CHANGED
|
@@ -2497,9 +2497,11 @@ async function resolveAgentCwd(target) {
|
|
|
2497
2497
|
}
|
|
2498
2498
|
|
|
2499
2499
|
// ../server/src/trpc/routers/service.ts
|
|
2500
|
-
var LOCAL_AGENT_ID = "local-agent";
|
|
2501
2500
|
async function resolveEffectiveAgentId(service) {
|
|
2502
|
-
const known = new Set(
|
|
2501
|
+
const known = /* @__PURE__ */ new Set([
|
|
2502
|
+
...agentManager.listAgents().map((a) => a.config.id),
|
|
2503
|
+
...(await agentStore.list()).map((a) => a.id)
|
|
2504
|
+
]);
|
|
2503
2505
|
if (service.agentId && known.has(service.agentId)) return service.agentId;
|
|
2504
2506
|
const projects = await projectStore.list();
|
|
2505
2507
|
const project = projects.find((p) => p.serviceIds.includes(service.id));
|
|
@@ -2507,7 +2509,7 @@ async function resolveEffectiveAgentId(service) {
|
|
|
2507
2509
|
const activeEnv = await environmentStore.get(project.activeEnvironmentId);
|
|
2508
2510
|
if (activeEnv?.agentId && known.has(activeEnv.agentId)) return activeEnv.agentId;
|
|
2509
2511
|
}
|
|
2510
|
-
return
|
|
2512
|
+
return agentManager.getDefaultAgentId();
|
|
2511
2513
|
}
|
|
2512
2514
|
async function resolveServiceVariables(service) {
|
|
2513
2515
|
const projects = await projectStore.list();
|
|
@@ -5132,7 +5134,7 @@ import Anthropic2 from "@anthropic-ai/sdk";
|
|
|
5132
5134
|
import OpenAI2 from "openai";
|
|
5133
5135
|
import { execFile as execFile3 } from "child_process";
|
|
5134
5136
|
import { promisify as promisify2 } from "util";
|
|
5135
|
-
import { fileURLToPath } from "url";
|
|
5137
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5136
5138
|
|
|
5137
5139
|
// ../../packages/ai-capabilities/src/capabilities.ts
|
|
5138
5140
|
var RUNEYA_CAPABILITIES = [
|
|
@@ -8276,6 +8278,68 @@ var ClaudeCodeRunner = class {
|
|
|
8276
8278
|
import { spawn as spawn3 } from "child_process";
|
|
8277
8279
|
import { createInterface } from "readline";
|
|
8278
8280
|
import { EventEmitter as EventEmitter3 } from "events";
|
|
8281
|
+
|
|
8282
|
+
// ../../packages/mcp-server/src/launch.ts
|
|
8283
|
+
import { fileURLToPath } from "url";
|
|
8284
|
+
import { createRequire } from "module";
|
|
8285
|
+
import { existsSync as existsSync2 } from "fs";
|
|
8286
|
+
function resolveMcpServerPath() {
|
|
8287
|
+
try {
|
|
8288
|
+
const req = createRequire(import.meta.url);
|
|
8289
|
+
return req.resolve("@runeya/packages-mcp-server");
|
|
8290
|
+
} catch {
|
|
8291
|
+
}
|
|
8292
|
+
const candidates = [
|
|
8293
|
+
// Build packagé du CLI : dist/agent/index.js et dist/index.js côtoient
|
|
8294
|
+
// dist/mcp-server/, copié là par le post-build.
|
|
8295
|
+
new URL("../mcp-server/index.js", import.meta.url),
|
|
8296
|
+
new URL("./mcp-server/index.js", import.meta.url),
|
|
8297
|
+
// Monorepo, depuis un dist d'app.
|
|
8298
|
+
new URL("../../../packages/mcp-server/dist/index.js", import.meta.url),
|
|
8299
|
+
new URL("../../../../packages/mcp-server/dist/index.js", import.meta.url)
|
|
8300
|
+
];
|
|
8301
|
+
for (const c of candidates) {
|
|
8302
|
+
const p = fileURLToPath(c);
|
|
8303
|
+
if (existsSync2(p)) return p;
|
|
8304
|
+
}
|
|
8305
|
+
throw new Error("Could not locate @runeya/packages-mcp-server (built dist not found)");
|
|
8306
|
+
}
|
|
8307
|
+
function pickEnv(env2) {
|
|
8308
|
+
return {
|
|
8309
|
+
...env2.RUNEYA_BASE_URL ? { RUNEYA_BASE_URL: env2.RUNEYA_BASE_URL } : {},
|
|
8310
|
+
...env2.RUNEYA_API_TOKEN ? { RUNEYA_API_TOKEN: env2.RUNEYA_API_TOKEN } : {}
|
|
8311
|
+
};
|
|
8312
|
+
}
|
|
8313
|
+
function codexMcpArgs(env2) {
|
|
8314
|
+
const fields = [
|
|
8315
|
+
`command=${tomlString("node")}`,
|
|
8316
|
+
`args=[${tomlString(resolveMcpServerPath())}]`
|
|
8317
|
+
];
|
|
8318
|
+
const entries2 = Object.entries(pickEnv(env2));
|
|
8319
|
+
if (entries2.length > 0) {
|
|
8320
|
+
const inline = entries2.map(([k, v]) => `${k}=${tomlString(v)}`).join(",");
|
|
8321
|
+
fields.push(`env={${inline}}`);
|
|
8322
|
+
}
|
|
8323
|
+
return ["-c", `mcp_servers.runeya={${fields.join(",")}}`];
|
|
8324
|
+
}
|
|
8325
|
+
function tomlString(value) {
|
|
8326
|
+
const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/[\u0000-\u001f\u007f]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
8327
|
+
return `"${escaped}"`;
|
|
8328
|
+
}
|
|
8329
|
+
|
|
8330
|
+
// ../server/src/services/ai-runners/codex-app-server-client.ts
|
|
8331
|
+
function resolveMcpArgs(env2) {
|
|
8332
|
+
if (!env2["RUNEYA_API_TOKEN"]) return [];
|
|
8333
|
+
try {
|
|
8334
|
+
return codexMcpArgs({
|
|
8335
|
+
RUNEYA_BASE_URL: env2["RUNEYA_BASE_URL"],
|
|
8336
|
+
RUNEYA_API_TOKEN: env2["RUNEYA_API_TOKEN"]
|
|
8337
|
+
});
|
|
8338
|
+
} catch (err) {
|
|
8339
|
+
console.warn("[codex-app-server] Failed to resolve MCP server path:", err.message);
|
|
8340
|
+
return [];
|
|
8341
|
+
}
|
|
8342
|
+
}
|
|
8279
8343
|
var CodexAppServerClient = class extends EventEmitter3 {
|
|
8280
8344
|
proc = null;
|
|
8281
8345
|
rl = null;
|
|
@@ -8288,11 +8352,18 @@ var CodexAppServerClient = class extends EventEmitter3 {
|
|
|
8288
8352
|
super();
|
|
8289
8353
|
this.requestTimeoutMs = opts?.requestTimeoutMs ?? 12e4;
|
|
8290
8354
|
}
|
|
8291
|
-
/**
|
|
8292
|
-
|
|
8293
|
-
|
|
8355
|
+
/**
|
|
8356
|
+
* Spawn codex app-server, perform initialize handshake, return server info.
|
|
8357
|
+
*
|
|
8358
|
+
* `runeyaEnv` porte les identifiants Runeya : ils vont à la fois dans l'env du
|
|
8359
|
+
* process (le CLI y résout `$RUNEYA_API_TOKEN`) et dans la config du serveur
|
|
8360
|
+
* MCP dérivée de cet env — un seul canal, comme côté agent.
|
|
8361
|
+
*/
|
|
8362
|
+
async connect(runeyaEnv) {
|
|
8363
|
+
const env2 = { ...process.env, ...runeyaEnv };
|
|
8364
|
+
this.proc = spawn3("codex", [...resolveMcpArgs(env2), "app-server"], {
|
|
8294
8365
|
stdio: ["pipe", "pipe", "pipe"],
|
|
8295
|
-
env:
|
|
8366
|
+
env: env2
|
|
8296
8367
|
});
|
|
8297
8368
|
this.rl = createInterface({ input: this.proc.stdout });
|
|
8298
8369
|
this.rl.on("line", (line) => this.handleLine(line));
|
|
@@ -8419,14 +8490,14 @@ var CodexAppServerClient = class extends EventEmitter3 {
|
|
|
8419
8490
|
// ../server/src/services/ai-runners/codex-runner.ts
|
|
8420
8491
|
var appServerClient = null;
|
|
8421
8492
|
var appServerConnecting = null;
|
|
8422
|
-
async function getAppServerClient() {
|
|
8493
|
+
async function getAppServerClient(runeyaEnv) {
|
|
8423
8494
|
if (appServerClient) return appServerClient;
|
|
8424
8495
|
if (appServerConnecting) {
|
|
8425
8496
|
await appServerConnecting;
|
|
8426
8497
|
return appServerClient;
|
|
8427
8498
|
}
|
|
8428
8499
|
const client = new CodexAppServerClient({ requestTimeoutMs: 3e5 });
|
|
8429
|
-
appServerConnecting = client.connect().then(() => {
|
|
8500
|
+
appServerConnecting = client.connect(runeyaEnv).then(() => {
|
|
8430
8501
|
appServerClient = client;
|
|
8431
8502
|
appServerConnecting = null;
|
|
8432
8503
|
}).catch((err) => {
|
|
@@ -8524,7 +8595,11 @@ var CodexRunner = class {
|
|
|
8524
8595
|
}
|
|
8525
8596
|
params.onStatus("\u{1F527} Codex en cours\u2026");
|
|
8526
8597
|
params.onCommand?.("codex app-server (agent JSON-RPC)");
|
|
8527
|
-
const codexEnv = injectedEnv && Object.keys(injectedEnv).length > 0 || apiToken ? {
|
|
8598
|
+
const codexEnv = injectedEnv && Object.keys(injectedEnv).length > 0 || apiToken ? {
|
|
8599
|
+
...injectedEnv,
|
|
8600
|
+
...apiToken ? { RUNEYA_API_TOKEN: apiToken } : {},
|
|
8601
|
+
...apiToken && apiBaseUrl ? { RUNEYA_BASE_URL: apiBaseUrl } : {}
|
|
8602
|
+
} : void 0;
|
|
8528
8603
|
let threadId;
|
|
8529
8604
|
if (isResume && this.lastThreadId) {
|
|
8530
8605
|
const res = await agentMgr.agentMutation(agentId, "ai.codexRequest", {
|
|
@@ -8722,7 +8797,10 @@ ${prompt}`;
|
|
|
8722
8797
|
}
|
|
8723
8798
|
params.onStatus("\u{1F527} Codex en cours\u2026");
|
|
8724
8799
|
params.onCommand?.("codex app-server (JSON-RPC)");
|
|
8725
|
-
const client = await getAppServerClient(
|
|
8800
|
+
const client = await getAppServerClient({
|
|
8801
|
+
...apiBaseUrl ? { RUNEYA_BASE_URL: apiBaseUrl } : {},
|
|
8802
|
+
...apiToken ? { RUNEYA_API_TOKEN: apiToken } : {}
|
|
8803
|
+
});
|
|
8726
8804
|
let threadId;
|
|
8727
8805
|
if (isResume && this.lastThreadId) {
|
|
8728
8806
|
const res = await client.sendRequest("thread/resume", { threadId: this.lastThreadId });
|
|
@@ -9162,7 +9240,7 @@ async function startClaudeCodeSession(convId, prompt, opts = {}) {
|
|
|
9162
9240
|
conversationStore.update(conv.id, { messages: conv.messages }, { silent: true }).catch(() => {
|
|
9163
9241
|
});
|
|
9164
9242
|
const systemContext = await buildCliSystemContext(conv, opts.jwt);
|
|
9165
|
-
const mcpServerPath =
|
|
9243
|
+
const mcpServerPath = fileURLToPath2(new URL("../mcp-server/index.js", import.meta.url));
|
|
9166
9244
|
const mcpConfig = JSON.stringify({
|
|
9167
9245
|
mcpServers: {
|
|
9168
9246
|
runeya: {
|
|
@@ -9602,7 +9680,7 @@ ${input.prompt}` : input.prompt;
|
|
|
9602
9680
|
systemContext += "\n\n" + (conv.kanbanCardId ? await buildKanbanCardPrompt(kanbanBoard, conv.kanbanCardId) : generateKanbanPopulatePrompt(kanbanBoard));
|
|
9603
9681
|
}
|
|
9604
9682
|
}
|
|
9605
|
-
const mcpServerPath =
|
|
9683
|
+
const mcpServerPath = fileURLToPath2(new URL("../mcp-server/index.js", import.meta.url));
|
|
9606
9684
|
const mcpConfig = JSON.stringify({
|
|
9607
9685
|
mcpServers: {
|
|
9608
9686
|
runeya: {
|
|
@@ -10235,7 +10313,7 @@ Context:
|
|
|
10235
10313
|
const agentId = input.agentId ?? agentManager.getDefaultAgentId();
|
|
10236
10314
|
if (!agentId) throw new TRPCError11({ code: "PRECONDITION_FAILED", message: "No agent available" });
|
|
10237
10315
|
const stressSessionId = `${input.sessionId}-stress-${Date.now().toString(36)}`;
|
|
10238
|
-
const { existsSync:
|
|
10316
|
+
const { existsSync: existsSync4 } = await import("fs");
|
|
10239
10317
|
const candidates = [
|
|
10240
10318
|
new URL("../../../../scripts/pty-stress-gen.mjs", import.meta.url),
|
|
10241
10319
|
new URL("../../../../../scripts/pty-stress-gen.mjs", import.meta.url),
|
|
@@ -10243,8 +10321,8 @@ Context:
|
|
|
10243
10321
|
];
|
|
10244
10322
|
let scriptPath = null;
|
|
10245
10323
|
for (const c of candidates) {
|
|
10246
|
-
const p =
|
|
10247
|
-
if (
|
|
10324
|
+
const p = fileURLToPath2(c);
|
|
10325
|
+
if (existsSync4(p)) {
|
|
10248
10326
|
scriptPath = p;
|
|
10249
10327
|
break;
|
|
10250
10328
|
}
|
|
@@ -10252,7 +10330,7 @@ Context:
|
|
|
10252
10330
|
if (!scriptPath) {
|
|
10253
10331
|
throw new TRPCError11({
|
|
10254
10332
|
code: "INTERNAL_SERVER_ERROR",
|
|
10255
|
-
message: `pty-stress-gen.mjs not found near ${
|
|
10333
|
+
message: `pty-stress-gen.mjs not found near ${fileURLToPath2(import.meta.url)}`
|
|
10256
10334
|
});
|
|
10257
10335
|
}
|
|
10258
10336
|
const res = await agentManager.agentMutation(
|
|
@@ -15233,7 +15311,7 @@ async function migrateSettingsIntoVaults() {
|
|
|
15233
15311
|
}
|
|
15234
15312
|
|
|
15235
15313
|
// ../server/src/migrations/migrate-from-legacy.ts
|
|
15236
|
-
import { createRequire } from "module";
|
|
15314
|
+
import { createRequire as createRequire2 } from "module";
|
|
15237
15315
|
import { randomBytes as randomBytes6, createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3 } from "crypto";
|
|
15238
15316
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
15239
15317
|
import {
|
|
@@ -15245,7 +15323,7 @@ import {
|
|
|
15245
15323
|
readdir as readdir11
|
|
15246
15324
|
} from "fs/promises";
|
|
15247
15325
|
import { join as join27, dirname as dirname10 } from "path";
|
|
15248
|
-
var _require =
|
|
15326
|
+
var _require = createRequire2(import.meta.url);
|
|
15249
15327
|
var PARSER_ID_MAP = {
|
|
15250
15328
|
"stack-monitor-parser-jsons": "native:json",
|
|
15251
15329
|
"stack-monitor-parser-debug": "native:debug",
|
|
@@ -16350,7 +16428,7 @@ function getOpenApiDocument() {
|
|
|
16350
16428
|
|
|
16351
16429
|
// ../server/src/create-server.ts
|
|
16352
16430
|
import rateLimit from "express-rate-limit";
|
|
16353
|
-
import { existsSync as
|
|
16431
|
+
import { existsSync as existsSync3, createReadStream } from "fs";
|
|
16354
16432
|
import multer from "multer";
|
|
16355
16433
|
|
|
16356
16434
|
// ../server/src/services/image-cleanup.service.ts
|
|
@@ -16461,7 +16539,7 @@ async function createLocalServer() {
|
|
|
16461
16539
|
const absoluteDataDir = resolve6(env.DATA_DIR);
|
|
16462
16540
|
console.log(`[server] Local project directory: ${absoluteDataDir}`);
|
|
16463
16541
|
console.log(`[server] Machine directory: ${machineRoot()}`);
|
|
16464
|
-
if (
|
|
16542
|
+
if (existsSync3(env.DATA_DIR)) {
|
|
16465
16543
|
await ensureDataGitignore(env.DATA_DIR);
|
|
16466
16544
|
}
|
|
16467
16545
|
await settingsManager.getSettings();
|
|
@@ -17289,4 +17367,4 @@ export {
|
|
|
17289
17367
|
pullEnv,
|
|
17290
17368
|
registerInstance
|
|
17291
17369
|
};
|
|
17292
|
-
//# sourceMappingURL=src-
|
|
17370
|
+
//# sourceMappingURL=src-ETRPQHFP.js.map
|