@rk0429/agentic-relay 0.15.0 → 0.16.1
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/relay.mjs +189 -37
- package/package.json +2 -1
package/dist/relay.mjs
CHANGED
|
@@ -817,7 +817,13 @@ var init_spawn_agent = __esm({
|
|
|
817
817
|
taskInstructionPath: z2.string().optional().describe(
|
|
818
818
|
"Path to a file containing task instructions. Content is prepended to the prompt. Path is resolved relative to the project root and validated against path traversal."
|
|
819
819
|
),
|
|
820
|
-
label: z2.string().optional().describe("Human-readable label for identifying this agent in parallel results and logs.")
|
|
820
|
+
label: z2.string().optional().describe("Human-readable label for identifying this agent in parallel results and logs."),
|
|
821
|
+
maxResponseLength: z2.number().int().positive().optional().describe(
|
|
822
|
+
"Maximum response length in characters. When exceeded, response is truncated or summarized based on responseMode."
|
|
823
|
+
),
|
|
824
|
+
responseMode: z2.enum(["truncate", "summarize"]).optional().describe(
|
|
825
|
+
"How to handle responses exceeding maxResponseLength. 'truncate' (default) cuts at limit with file save. 'summarize' uses AI to condense."
|
|
826
|
+
)
|
|
821
827
|
});
|
|
822
828
|
}
|
|
823
829
|
});
|
|
@@ -858,11 +864,11 @@ function extractMentionedPaths(stdout) {
|
|
|
858
864
|
for (const pattern of patterns) {
|
|
859
865
|
let match;
|
|
860
866
|
while ((match = pattern.exec(stdout)) !== null) {
|
|
861
|
-
let
|
|
862
|
-
if (
|
|
863
|
-
|
|
867
|
+
let path2 = match[1];
|
|
868
|
+
if (path2.startsWith("./")) {
|
|
869
|
+
path2 = path2.slice(2);
|
|
864
870
|
}
|
|
865
|
-
paths.add(
|
|
871
|
+
paths.add(path2);
|
|
866
872
|
}
|
|
867
873
|
}
|
|
868
874
|
return paths;
|
|
@@ -897,7 +903,7 @@ async function detectConflicts(before, after, agentResults) {
|
|
|
897
903
|
}
|
|
898
904
|
}
|
|
899
905
|
const conflicts = Array.from(fileToAgents.entries()).map(
|
|
900
|
-
([
|
|
906
|
+
([path2, agents]) => ({ path: path2, agents })
|
|
901
907
|
);
|
|
902
908
|
return {
|
|
903
909
|
conflicts,
|
|
@@ -1207,7 +1213,98 @@ var init_types = __esm({
|
|
|
1207
1213
|
}
|
|
1208
1214
|
});
|
|
1209
1215
|
|
|
1216
|
+
// src/mcp-server/response-summarizer.ts
|
|
1217
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
1218
|
+
async function summarizeResponse(text, targetLength) {
|
|
1219
|
+
const client = new Anthropic();
|
|
1220
|
+
const message = await client.messages.create({
|
|
1221
|
+
model: "claude-haiku-4-5-20251001",
|
|
1222
|
+
max_tokens: Math.max(1024, Math.ceil(targetLength / 3)),
|
|
1223
|
+
messages: [
|
|
1224
|
+
{
|
|
1225
|
+
role: "user",
|
|
1226
|
+
content: `Summarize the following text in ${targetLength} characters or less. Prioritize:
|
|
1227
|
+
1. Key deliverables, artifacts, and file changes
|
|
1228
|
+
2. Important decisions and conclusions
|
|
1229
|
+
3. Action items and next steps
|
|
1230
|
+
|
|
1231
|
+
Preserve technical details (file paths, function names, error messages) when possible.
|
|
1232
|
+
|
|
1233
|
+
<text>
|
|
1234
|
+
${text}
|
|
1235
|
+
</text>`
|
|
1236
|
+
}
|
|
1237
|
+
]
|
|
1238
|
+
});
|
|
1239
|
+
const content = message.content[0];
|
|
1240
|
+
if (content?.type !== "text") {
|
|
1241
|
+
throw new Error("Unexpected response format from summarization API");
|
|
1242
|
+
}
|
|
1243
|
+
return content.text;
|
|
1244
|
+
}
|
|
1245
|
+
var init_response_summarizer = __esm({
|
|
1246
|
+
"src/mcp-server/response-summarizer.ts"() {
|
|
1247
|
+
"use strict";
|
|
1248
|
+
}
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1210
1251
|
// src/mcp-server/response-formatter.ts
|
|
1252
|
+
import * as fs from "fs";
|
|
1253
|
+
import * as path from "path";
|
|
1254
|
+
import * as os from "os";
|
|
1255
|
+
function saveFullResponse(content, sessionId) {
|
|
1256
|
+
try {
|
|
1257
|
+
const dir = sessionId ? path.join(RESPONSE_DIR, sessionId) : path.join(RESPONSE_DIR, `anonymous-${Date.now()}`);
|
|
1258
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
1259
|
+
const filePath = path.join(dir, "response.txt");
|
|
1260
|
+
fs.writeFileSync(filePath, content, "utf-8");
|
|
1261
|
+
try {
|
|
1262
|
+
const entries = fs.readdirSync(RESPONSE_DIR).map((name) => {
|
|
1263
|
+
const fullPath = path.join(RESPONSE_DIR, name);
|
|
1264
|
+
try {
|
|
1265
|
+
const stat = fs.statSync(fullPath);
|
|
1266
|
+
return { name, fullPath, mtimeMs: stat.mtimeMs };
|
|
1267
|
+
} catch {
|
|
1268
|
+
return null;
|
|
1269
|
+
}
|
|
1270
|
+
}).filter((e) => e !== null).sort((a, b) => a.mtimeMs - b.mtimeMs);
|
|
1271
|
+
if (entries.length > MAX_SAVED_RESPONSES) {
|
|
1272
|
+
const toRemove = entries.slice(0, entries.length - MAX_SAVED_RESPONSES);
|
|
1273
|
+
for (const entry of toRemove) {
|
|
1274
|
+
fs.rmSync(entry.fullPath, { recursive: true, force: true });
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
} catch {
|
|
1278
|
+
}
|
|
1279
|
+
return filePath;
|
|
1280
|
+
} catch {
|
|
1281
|
+
return void 0;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
async function processStdout(stdout, options) {
|
|
1285
|
+
const maxLength = options?.maxLength ?? STDOUT_DEFAULT_MAX_LENGTH;
|
|
1286
|
+
const mode = options?.mode ?? "truncate";
|
|
1287
|
+
if (stdout.length <= maxLength) {
|
|
1288
|
+
return { text: stdout, truncated: false };
|
|
1289
|
+
}
|
|
1290
|
+
const savedFilePath = saveFullResponse(stdout, options?.sessionId);
|
|
1291
|
+
const savedInfo = savedFilePath ? ` Full response saved to: ${savedFilePath}` : "";
|
|
1292
|
+
if (mode === "summarize") {
|
|
1293
|
+
try {
|
|
1294
|
+
const summary = await summarizeResponse(stdout, maxLength);
|
|
1295
|
+
const footer2 = `
|
|
1296
|
+
|
|
1297
|
+
[RESPONSE SUMMARIZED: original ${stdout.length} chars exceeded limit ${maxLength} chars.${savedInfo}]`;
|
|
1298
|
+
return { text: summary + footer2, truncated: true, savedFilePath };
|
|
1299
|
+
} catch {
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
const truncated = stdout.slice(0, maxLength);
|
|
1303
|
+
const footer = `
|
|
1304
|
+
|
|
1305
|
+
[RESPONSE TRUNCATED: original ${stdout.length} chars exceeded limit ${maxLength} chars.${savedInfo}]`;
|
|
1306
|
+
return { text: truncated + footer, truncated: true, savedFilePath };
|
|
1307
|
+
}
|
|
1211
1308
|
function truncateStderr(stderr) {
|
|
1212
1309
|
if (!stderr) return stderr;
|
|
1213
1310
|
const blocks = stderr.split("\n\n");
|
|
@@ -1237,7 +1334,7 @@ function truncateStderr(stderr) {
|
|
|
1237
1334
|
}
|
|
1238
1335
|
return stderr;
|
|
1239
1336
|
}
|
|
1240
|
-
function formatSpawnAgentResponse(result) {
|
|
1337
|
+
async function formatSpawnAgentResponse(result, options) {
|
|
1241
1338
|
const isError = result.exitCode !== 0;
|
|
1242
1339
|
let text;
|
|
1243
1340
|
if (isError) {
|
|
@@ -1248,9 +1345,10 @@ function formatSpawnAgentResponse(result) {
|
|
|
1248
1345
|
${truncateStderr(result.stderr)}`;
|
|
1249
1346
|
}
|
|
1250
1347
|
} else {
|
|
1348
|
+
const processed = await processStdout(result.stdout, options);
|
|
1251
1349
|
text = `Session: ${result.sessionId}
|
|
1252
1350
|
|
|
1253
|
-
${
|
|
1351
|
+
${processed.text}`;
|
|
1254
1352
|
}
|
|
1255
1353
|
if (result.metadata) {
|
|
1256
1354
|
text += `
|
|
@@ -1261,7 +1359,7 @@ ${JSON.stringify(result.metadata, null, 2)}
|
|
|
1261
1359
|
}
|
|
1262
1360
|
return { text, isError };
|
|
1263
1361
|
}
|
|
1264
|
-
function formatParallelResponse(result) {
|
|
1362
|
+
async function formatParallelResponse(result, options, perAgentOptions) {
|
|
1265
1363
|
const isError = result.failureCount === result.totalCount;
|
|
1266
1364
|
const parts = [];
|
|
1267
1365
|
if (result.hasConflicts && result.conflicts) {
|
|
@@ -1281,7 +1379,9 @@ function formatParallelResponse(result) {
|
|
|
1281
1379
|
const duration = r.metadata?.durationMs !== void 0 ? `${(r.metadata.durationMs / 1e3).toFixed(1)}s` : "?s";
|
|
1282
1380
|
if (r.exitCode === 0) {
|
|
1283
1381
|
parts.push(`--- Agent ${r.index}${labelPart} (${backend}, ${duration}) SUCCESS ---`);
|
|
1284
|
-
|
|
1382
|
+
const agentOptions = perAgentOptions?.get(r.index) ?? options;
|
|
1383
|
+
const processed = await processStdout(r.stdout || "", agentOptions);
|
|
1384
|
+
parts.push(processed.text || "(no output)");
|
|
1285
1385
|
} else {
|
|
1286
1386
|
const reasonPart = r.failureReason ? `, reason: ${r.failureReason}` : "";
|
|
1287
1387
|
parts.push(`--- Agent ${r.index}${labelPart} FAILED (${backend}, ${duration}${reasonPart}) ---`);
|
|
@@ -1294,11 +1394,15 @@ ${JSON.stringify(result, null, 2)}
|
|
|
1294
1394
|
</metadata>`);
|
|
1295
1395
|
return { text: parts.join("\n"), isError };
|
|
1296
1396
|
}
|
|
1297
|
-
var STDERR_MAX_LENGTH;
|
|
1397
|
+
var STDERR_MAX_LENGTH, STDOUT_DEFAULT_MAX_LENGTH, MAX_SAVED_RESPONSES, RESPONSE_DIR;
|
|
1298
1398
|
var init_response_formatter = __esm({
|
|
1299
1399
|
"src/mcp-server/response-formatter.ts"() {
|
|
1300
1400
|
"use strict";
|
|
1401
|
+
init_response_summarizer();
|
|
1301
1402
|
STDERR_MAX_LENGTH = 2e3;
|
|
1403
|
+
STDOUT_DEFAULT_MAX_LENGTH = 2e4;
|
|
1404
|
+
MAX_SAVED_RESPONSES = 100;
|
|
1405
|
+
RESPONSE_DIR = path.join(os.tmpdir(), "agentic-relay-responses");
|
|
1302
1406
|
}
|
|
1303
1407
|
});
|
|
1304
1408
|
|
|
@@ -1345,15 +1449,16 @@ var init_server = __esm({
|
|
|
1345
1449
|
};
|
|
1346
1450
|
MAX_CHILD_HTTP_SESSIONS = 100;
|
|
1347
1451
|
RelayMCPServer = class {
|
|
1348
|
-
constructor(registry2, sessionManager2, guardConfig, hooksEngine2, contextMonitor2) {
|
|
1452
|
+
constructor(registry2, sessionManager2, guardConfig, hooksEngine2, contextMonitor2, defaultMaxResponseLength) {
|
|
1349
1453
|
this.registry = registry2;
|
|
1350
1454
|
this.sessionManager = sessionManager2;
|
|
1351
1455
|
this.hooksEngine = hooksEngine2;
|
|
1352
1456
|
this.contextMonitor = contextMonitor2;
|
|
1457
|
+
this.defaultMaxResponseLength = defaultMaxResponseLength;
|
|
1353
1458
|
this.guard = new RecursionGuard(guardConfig);
|
|
1354
1459
|
this.backendSelector = new BackendSelector();
|
|
1355
1460
|
this.server = new McpServer(
|
|
1356
|
-
{ name: "agentic-relay", version: "0.
|
|
1461
|
+
{ name: "agentic-relay", version: "0.16.1" },
|
|
1357
1462
|
createMcpServerOptions()
|
|
1358
1463
|
);
|
|
1359
1464
|
this.registerTools(this.server);
|
|
@@ -1388,7 +1493,12 @@ var init_server = __esm({
|
|
|
1388
1493
|
this.backendSelector,
|
|
1389
1494
|
this._childHttpUrl
|
|
1390
1495
|
);
|
|
1391
|
-
const
|
|
1496
|
+
const controlOptions = {
|
|
1497
|
+
maxLength: params.maxResponseLength ?? this.defaultMaxResponseLength ?? STDOUT_DEFAULT_MAX_LENGTH,
|
|
1498
|
+
mode: params.responseMode ?? "truncate",
|
|
1499
|
+
sessionId: result.sessionId
|
|
1500
|
+
};
|
|
1501
|
+
const { text, isError } = await formatSpawnAgentResponse(result, controlOptions);
|
|
1392
1502
|
const callToolResult = {
|
|
1393
1503
|
content: [{ type: "text", text }],
|
|
1394
1504
|
isError
|
|
@@ -1435,7 +1545,26 @@ var init_server = __esm({
|
|
|
1435
1545
|
this.backendSelector,
|
|
1436
1546
|
this._childHttpUrl
|
|
1437
1547
|
);
|
|
1438
|
-
const
|
|
1548
|
+
const controlOptions = {
|
|
1549
|
+
maxLength: this.defaultMaxResponseLength ?? STDOUT_DEFAULT_MAX_LENGTH,
|
|
1550
|
+
mode: "truncate"
|
|
1551
|
+
};
|
|
1552
|
+
const perAgentOptions = /* @__PURE__ */ new Map();
|
|
1553
|
+
for (let i = 0; i < agents.length; i++) {
|
|
1554
|
+
const agent = agents[i];
|
|
1555
|
+
if (agent.maxResponseLength !== void 0 || agent.responseMode !== void 0) {
|
|
1556
|
+
perAgentOptions.set(i, {
|
|
1557
|
+
maxLength: agent.maxResponseLength ?? controlOptions.maxLength,
|
|
1558
|
+
mode: agent.responseMode ?? controlOptions.mode,
|
|
1559
|
+
sessionId: result.results[i]?.sessionId
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
const { text, isError } = await formatParallelResponse(
|
|
1564
|
+
result,
|
|
1565
|
+
controlOptions,
|
|
1566
|
+
perAgentOptions.size > 0 ? perAgentOptions : void 0
|
|
1567
|
+
);
|
|
1439
1568
|
const callToolResult = {
|
|
1440
1569
|
content: [{ type: "text", text }],
|
|
1441
1570
|
isError
|
|
@@ -1551,7 +1680,26 @@ var init_server = __esm({
|
|
|
1551
1680
|
this.backendSelector,
|
|
1552
1681
|
this._childHttpUrl
|
|
1553
1682
|
);
|
|
1554
|
-
const
|
|
1683
|
+
const controlOptions = {
|
|
1684
|
+
maxLength: this.defaultMaxResponseLength ?? STDOUT_DEFAULT_MAX_LENGTH,
|
|
1685
|
+
mode: "truncate"
|
|
1686
|
+
};
|
|
1687
|
+
const perAgentOptions = /* @__PURE__ */ new Map();
|
|
1688
|
+
for (let i = 0; i < agents.length; i++) {
|
|
1689
|
+
const agent = agents[i];
|
|
1690
|
+
if (agent.maxResponseLength !== void 0 || agent.responseMode !== void 0) {
|
|
1691
|
+
perAgentOptions.set(i, {
|
|
1692
|
+
maxLength: agent.maxResponseLength ?? controlOptions.maxLength,
|
|
1693
|
+
mode: agent.responseMode ?? controlOptions.mode,
|
|
1694
|
+
sessionId: result.results[i]?.sessionId
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
const { text, isError } = await formatParallelResponse(
|
|
1699
|
+
result,
|
|
1700
|
+
controlOptions,
|
|
1701
|
+
perAgentOptions.size > 0 ? perAgentOptions : void 0
|
|
1702
|
+
);
|
|
1555
1703
|
return {
|
|
1556
1704
|
content: [{ type: "text", text }],
|
|
1557
1705
|
isError
|
|
@@ -1715,7 +1863,7 @@ var init_server = __esm({
|
|
|
1715
1863
|
sessionIdGenerator: () => randomUUID()
|
|
1716
1864
|
});
|
|
1717
1865
|
const server = new McpServer(
|
|
1718
|
-
{ name: "agentic-relay", version: "0.
|
|
1866
|
+
{ name: "agentic-relay", version: "0.16.1" },
|
|
1719
1867
|
createMcpServerOptions()
|
|
1720
1868
|
);
|
|
1721
1869
|
this.registerTools(server);
|
|
@@ -1771,7 +1919,7 @@ var init_server = __esm({
|
|
|
1771
1919
|
|
|
1772
1920
|
// src/bin/relay.ts
|
|
1773
1921
|
import { defineCommand as defineCommand10, runMain } from "citty";
|
|
1774
|
-
import { join as
|
|
1922
|
+
import { join as join10 } from "path";
|
|
1775
1923
|
import { homedir as homedir6 } from "os";
|
|
1776
1924
|
|
|
1777
1925
|
// src/infrastructure/process-manager.ts
|
|
@@ -3315,7 +3463,8 @@ var relayConfigSchema = z.object({
|
|
|
3315
3463
|
mcpServerMode: z.object({
|
|
3316
3464
|
maxDepth: z.number().int().positive(),
|
|
3317
3465
|
maxCallsPerSession: z.number().int().positive(),
|
|
3318
|
-
timeoutSec: z.number().positive()
|
|
3466
|
+
timeoutSec: z.number().positive(),
|
|
3467
|
+
maxResponseLength: z.number().int().positive().optional()
|
|
3319
3468
|
}).optional(),
|
|
3320
3469
|
telemetry: z.object({
|
|
3321
3470
|
enabled: z.boolean()
|
|
@@ -3344,8 +3493,8 @@ function deepMerge(target, source) {
|
|
|
3344
3493
|
function isPlainObject(value) {
|
|
3345
3494
|
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
3346
3495
|
}
|
|
3347
|
-
function getByPath(obj,
|
|
3348
|
-
const parts =
|
|
3496
|
+
function getByPath(obj, path2) {
|
|
3497
|
+
const parts = path2.split(".");
|
|
3349
3498
|
let current = obj;
|
|
3350
3499
|
for (const part of parts) {
|
|
3351
3500
|
if (!isPlainObject(current)) return void 0;
|
|
@@ -3353,8 +3502,8 @@ function getByPath(obj, path) {
|
|
|
3353
3502
|
}
|
|
3354
3503
|
return current;
|
|
3355
3504
|
}
|
|
3356
|
-
function setByPath(obj,
|
|
3357
|
-
const parts =
|
|
3505
|
+
function setByPath(obj, path2, value) {
|
|
3506
|
+
const parts = path2.split(".");
|
|
3358
3507
|
let current = obj;
|
|
3359
3508
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
3360
3509
|
const part = parts[i];
|
|
@@ -4546,6 +4695,7 @@ function createMCPCommand(configManager2, registry2, sessionManager2, hooksEngin
|
|
|
4546
4695
|
return;
|
|
4547
4696
|
}
|
|
4548
4697
|
let guardConfig;
|
|
4698
|
+
let defaultMaxResponseLength;
|
|
4549
4699
|
try {
|
|
4550
4700
|
const config = await configManager2.getConfig();
|
|
4551
4701
|
if (config.mcpServerMode) {
|
|
@@ -4554,6 +4704,7 @@ function createMCPCommand(configManager2, registry2, sessionManager2, hooksEngin
|
|
|
4554
4704
|
maxCallsPerSession: config.mcpServerMode.maxCallsPerSession ?? 20,
|
|
4555
4705
|
timeoutSec: config.mcpServerMode.timeoutSec ?? 86400
|
|
4556
4706
|
};
|
|
4707
|
+
defaultMaxResponseLength = config.mcpServerMode.maxResponseLength;
|
|
4557
4708
|
}
|
|
4558
4709
|
} catch {
|
|
4559
4710
|
}
|
|
@@ -4564,7 +4715,8 @@ function createMCPCommand(configManager2, registry2, sessionManager2, hooksEngin
|
|
|
4564
4715
|
sessionManager2,
|
|
4565
4716
|
guardConfig,
|
|
4566
4717
|
hooksEngine2,
|
|
4567
|
-
contextMonitor2
|
|
4718
|
+
contextMonitor2,
|
|
4719
|
+
defaultMaxResponseLength
|
|
4568
4720
|
);
|
|
4569
4721
|
await server.start({ transport, port });
|
|
4570
4722
|
}
|
|
@@ -4726,7 +4878,7 @@ function createVersionCommand(registry2) {
|
|
|
4726
4878
|
description: "Show relay and backend versions"
|
|
4727
4879
|
},
|
|
4728
4880
|
async run() {
|
|
4729
|
-
const relayVersion = "0.
|
|
4881
|
+
const relayVersion = "0.16.1";
|
|
4730
4882
|
console.log(`agentic-relay v${relayVersion}`);
|
|
4731
4883
|
console.log("");
|
|
4732
4884
|
console.log("Backends:");
|
|
@@ -4751,7 +4903,7 @@ function createVersionCommand(registry2) {
|
|
|
4751
4903
|
// src/commands/doctor.ts
|
|
4752
4904
|
import { defineCommand as defineCommand8 } from "citty";
|
|
4753
4905
|
import { access, constants, readdir as readdir2 } from "fs/promises";
|
|
4754
|
-
import { join as
|
|
4906
|
+
import { join as join8 } from "path";
|
|
4755
4907
|
import { homedir as homedir5 } from "os";
|
|
4756
4908
|
import { execFile as execFile2 } from "child_process";
|
|
4757
4909
|
import { promisify as promisify2 } from "util";
|
|
@@ -4812,8 +4964,8 @@ async function checkConfig(configManager2) {
|
|
|
4812
4964
|
}
|
|
4813
4965
|
}
|
|
4814
4966
|
async function checkSessionsDir() {
|
|
4815
|
-
const relayHome2 = process.env["RELAY_HOME"] ??
|
|
4816
|
-
const sessionsDir =
|
|
4967
|
+
const relayHome2 = process.env["RELAY_HOME"] ?? join8(homedir5(), ".relay");
|
|
4968
|
+
const sessionsDir = join8(relayHome2, "sessions");
|
|
4817
4969
|
try {
|
|
4818
4970
|
await access(sessionsDir, constants.W_OK);
|
|
4819
4971
|
return {
|
|
@@ -4926,8 +5078,8 @@ async function checkBackendAuthEnv() {
|
|
|
4926
5078
|
return results;
|
|
4927
5079
|
}
|
|
4928
5080
|
async function checkSessionsDiskUsage() {
|
|
4929
|
-
const relayHome2 = process.env["RELAY_HOME"] ??
|
|
4930
|
-
const sessionsDir =
|
|
5081
|
+
const relayHome2 = process.env["RELAY_HOME"] ?? join8(homedir5(), ".relay");
|
|
5082
|
+
const sessionsDir = join8(relayHome2, "sessions");
|
|
4931
5083
|
try {
|
|
4932
5084
|
const entries = await readdir2(sessionsDir);
|
|
4933
5085
|
const fileCount = entries.length;
|
|
@@ -5001,7 +5153,7 @@ function createDoctorCommand(registry2, configManager2) {
|
|
|
5001
5153
|
init_logger();
|
|
5002
5154
|
import { defineCommand as defineCommand9 } from "citty";
|
|
5003
5155
|
import { mkdir as mkdir6, writeFile as writeFile6, access as access2, readFile as readFile6 } from "fs/promises";
|
|
5004
|
-
import { join as
|
|
5156
|
+
import { join as join9 } from "path";
|
|
5005
5157
|
var DEFAULT_CONFIG2 = {
|
|
5006
5158
|
defaultBackend: "claude",
|
|
5007
5159
|
backends: {},
|
|
@@ -5015,8 +5167,8 @@ function createInitCommand() {
|
|
|
5015
5167
|
},
|
|
5016
5168
|
async run() {
|
|
5017
5169
|
const projectDir = process.cwd();
|
|
5018
|
-
const relayDir =
|
|
5019
|
-
const configPath =
|
|
5170
|
+
const relayDir = join9(projectDir, ".relay");
|
|
5171
|
+
const configPath = join9(relayDir, "config.json");
|
|
5020
5172
|
try {
|
|
5021
5173
|
await access2(relayDir);
|
|
5022
5174
|
logger.info(
|
|
@@ -5032,7 +5184,7 @@ function createInitCommand() {
|
|
|
5032
5184
|
"utf-8"
|
|
5033
5185
|
);
|
|
5034
5186
|
logger.success(`Created ${configPath}`);
|
|
5035
|
-
const gitignorePath =
|
|
5187
|
+
const gitignorePath = join9(projectDir, ".gitignore");
|
|
5036
5188
|
try {
|
|
5037
5189
|
const gitignoreContent = await readFile6(gitignorePath, "utf-8");
|
|
5038
5190
|
if (!gitignoreContent.includes(".relay/config.local.json")) {
|
|
@@ -5058,8 +5210,8 @@ registry.registerLazy("claude", () => new ClaudeAdapter(processManager));
|
|
|
5058
5210
|
registry.registerLazy("codex", () => new CodexAdapter(processManager));
|
|
5059
5211
|
registry.registerLazy("gemini", () => new GeminiAdapter(processManager));
|
|
5060
5212
|
var sessionManager = new SessionManager();
|
|
5061
|
-
var relayHome = process.env["RELAY_HOME"] ??
|
|
5062
|
-
var projectRelayDir =
|
|
5213
|
+
var relayHome = process.env["RELAY_HOME"] ?? join10(homedir6(), ".relay");
|
|
5214
|
+
var projectRelayDir = join10(process.cwd(), ".relay");
|
|
5063
5215
|
var configManager = new ConfigManager(relayHome, projectRelayDir);
|
|
5064
5216
|
var authManager = new AuthManager(registry);
|
|
5065
5217
|
var eventBus = new EventBus();
|
|
@@ -5076,7 +5228,7 @@ void configManager.getConfig().then((config) => {
|
|
|
5076
5228
|
var main = defineCommand10({
|
|
5077
5229
|
meta: {
|
|
5078
5230
|
name: "relay",
|
|
5079
|
-
version: "0.
|
|
5231
|
+
version: "0.16.1",
|
|
5080
5232
|
description: "Unified CLI proxy for Claude Code, Codex CLI, and Gemini CLI"
|
|
5081
5233
|
},
|
|
5082
5234
|
subCommands: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rk0429/agentic-relay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "Unified CLI proxy for Claude Code, Codex CLI, and Gemini CLI with MCP-based multi-layer sub-agent orchestration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@anthropic-ai/claude-agent-sdk": "^0.2.59",
|
|
53
|
+
"@anthropic-ai/sdk": "^0.78.0",
|
|
53
54
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
54
55
|
"@openai/codex-sdk": "^0.105.0",
|
|
55
56
|
"citty": "^0.1.6",
|