@rk0429/agentic-relay 0.16.0 → 0.16.2
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 +81 -22
- package/package.json +1 -2
package/dist/relay.mjs
CHANGED
|
@@ -1214,16 +1214,21 @@ var init_types = __esm({
|
|
|
1214
1214
|
});
|
|
1215
1215
|
|
|
1216
1216
|
// src/mcp-server/response-summarizer.ts
|
|
1217
|
-
|
|
1217
|
+
async function loadClaudeSDK2() {
|
|
1218
|
+
return await import("@anthropic-ai/claude-agent-sdk");
|
|
1219
|
+
}
|
|
1220
|
+
function buildCleanEnv() {
|
|
1221
|
+
const env = {};
|
|
1222
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
1223
|
+
if (value !== void 0 && !CLAUDE_NESTING_ENV_VARS2.includes(key)) {
|
|
1224
|
+
env[key] = value;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
return env;
|
|
1228
|
+
}
|
|
1218
1229
|
async function summarizeResponse(text, targetLength) {
|
|
1219
|
-
const
|
|
1220
|
-
const
|
|
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:
|
|
1230
|
+
const { query } = await loadClaudeSDK2();
|
|
1231
|
+
const prompt = `Summarize the following text in ${targetLength} characters or less. Prioritize:
|
|
1227
1232
|
1. Key deliverables, artifacts, and file changes
|
|
1228
1233
|
2. Important decisions and conclusions
|
|
1229
1234
|
3. Action items and next steps
|
|
@@ -1232,19 +1237,43 @@ Preserve technical details (file paths, function names, error messages) when pos
|
|
|
1232
1237
|
|
|
1233
1238
|
<text>
|
|
1234
1239
|
${text}
|
|
1235
|
-
</text
|
|
1236
|
-
|
|
1237
|
-
|
|
1240
|
+
</text>`;
|
|
1241
|
+
const q = query({
|
|
1242
|
+
prompt,
|
|
1243
|
+
options: {
|
|
1244
|
+
model: "haiku",
|
|
1245
|
+
maxTurns: 1,
|
|
1246
|
+
env: buildCleanEnv(),
|
|
1247
|
+
cwd: process.cwd(),
|
|
1248
|
+
permissionMode: "bypassPermissions",
|
|
1249
|
+
allowDangerouslySkipPermissions: true
|
|
1250
|
+
}
|
|
1238
1251
|
});
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1252
|
+
let resultText = "";
|
|
1253
|
+
for await (const message of q) {
|
|
1254
|
+
if (message.type === "result") {
|
|
1255
|
+
if (message.subtype === "success") {
|
|
1256
|
+
resultText = message.result;
|
|
1257
|
+
} else {
|
|
1258
|
+
const errors = message.errors;
|
|
1259
|
+
throw new Error(`Summarization failed: ${errors?.join("; ") ?? "unknown error"}`);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
if (!resultText) {
|
|
1264
|
+
throw new Error("No result from summarization");
|
|
1242
1265
|
}
|
|
1243
|
-
return
|
|
1266
|
+
return resultText;
|
|
1244
1267
|
}
|
|
1268
|
+
var CLAUDE_NESTING_ENV_VARS2;
|
|
1245
1269
|
var init_response_summarizer = __esm({
|
|
1246
1270
|
"src/mcp-server/response-summarizer.ts"() {
|
|
1247
1271
|
"use strict";
|
|
1272
|
+
CLAUDE_NESTING_ENV_VARS2 = [
|
|
1273
|
+
"CLAUDECODE",
|
|
1274
|
+
"CLAUDE_CODE_SSE_PORT",
|
|
1275
|
+
"CLAUDE_CODE_ENTRYPOINT"
|
|
1276
|
+
];
|
|
1248
1277
|
}
|
|
1249
1278
|
});
|
|
1250
1279
|
|
|
@@ -1458,7 +1487,7 @@ var init_server = __esm({
|
|
|
1458
1487
|
this.guard = new RecursionGuard(guardConfig);
|
|
1459
1488
|
this.backendSelector = new BackendSelector();
|
|
1460
1489
|
this.server = new McpServer(
|
|
1461
|
-
{ name: "agentic-relay", version: "0.16.
|
|
1490
|
+
{ name: "agentic-relay", version: "0.16.2" },
|
|
1462
1491
|
createMcpServerOptions()
|
|
1463
1492
|
);
|
|
1464
1493
|
this.registerTools(this.server);
|
|
@@ -1549,7 +1578,22 @@ var init_server = __esm({
|
|
|
1549
1578
|
maxLength: this.defaultMaxResponseLength ?? STDOUT_DEFAULT_MAX_LENGTH,
|
|
1550
1579
|
mode: "truncate"
|
|
1551
1580
|
};
|
|
1552
|
-
const
|
|
1581
|
+
const perAgentOptions = /* @__PURE__ */ new Map();
|
|
1582
|
+
for (let i = 0; i < agents.length; i++) {
|
|
1583
|
+
const agent = agents[i];
|
|
1584
|
+
if (agent.maxResponseLength !== void 0 || agent.responseMode !== void 0) {
|
|
1585
|
+
perAgentOptions.set(i, {
|
|
1586
|
+
maxLength: agent.maxResponseLength ?? controlOptions.maxLength,
|
|
1587
|
+
mode: agent.responseMode ?? controlOptions.mode,
|
|
1588
|
+
sessionId: result.results[i]?.sessionId
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
const { text, isError } = await formatParallelResponse(
|
|
1593
|
+
result,
|
|
1594
|
+
controlOptions,
|
|
1595
|
+
perAgentOptions.size > 0 ? perAgentOptions : void 0
|
|
1596
|
+
);
|
|
1553
1597
|
const callToolResult = {
|
|
1554
1598
|
content: [{ type: "text", text }],
|
|
1555
1599
|
isError
|
|
@@ -1669,7 +1713,22 @@ var init_server = __esm({
|
|
|
1669
1713
|
maxLength: this.defaultMaxResponseLength ?? STDOUT_DEFAULT_MAX_LENGTH,
|
|
1670
1714
|
mode: "truncate"
|
|
1671
1715
|
};
|
|
1672
|
-
const
|
|
1716
|
+
const perAgentOptions = /* @__PURE__ */ new Map();
|
|
1717
|
+
for (let i = 0; i < agents.length; i++) {
|
|
1718
|
+
const agent = agents[i];
|
|
1719
|
+
if (agent.maxResponseLength !== void 0 || agent.responseMode !== void 0) {
|
|
1720
|
+
perAgentOptions.set(i, {
|
|
1721
|
+
maxLength: agent.maxResponseLength ?? controlOptions.maxLength,
|
|
1722
|
+
mode: agent.responseMode ?? controlOptions.mode,
|
|
1723
|
+
sessionId: result.results[i]?.sessionId
|
|
1724
|
+
});
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
const { text, isError } = await formatParallelResponse(
|
|
1728
|
+
result,
|
|
1729
|
+
controlOptions,
|
|
1730
|
+
perAgentOptions.size > 0 ? perAgentOptions : void 0
|
|
1731
|
+
);
|
|
1673
1732
|
return {
|
|
1674
1733
|
content: [{ type: "text", text }],
|
|
1675
1734
|
isError
|
|
@@ -1833,7 +1892,7 @@ var init_server = __esm({
|
|
|
1833
1892
|
sessionIdGenerator: () => randomUUID()
|
|
1834
1893
|
});
|
|
1835
1894
|
const server = new McpServer(
|
|
1836
|
-
{ name: "agentic-relay", version: "0.16.
|
|
1895
|
+
{ name: "agentic-relay", version: "0.16.2" },
|
|
1837
1896
|
createMcpServerOptions()
|
|
1838
1897
|
);
|
|
1839
1898
|
this.registerTools(server);
|
|
@@ -4848,7 +4907,7 @@ function createVersionCommand(registry2) {
|
|
|
4848
4907
|
description: "Show relay and backend versions"
|
|
4849
4908
|
},
|
|
4850
4909
|
async run() {
|
|
4851
|
-
const relayVersion = "0.16.
|
|
4910
|
+
const relayVersion = "0.16.2";
|
|
4852
4911
|
console.log(`agentic-relay v${relayVersion}`);
|
|
4853
4912
|
console.log("");
|
|
4854
4913
|
console.log("Backends:");
|
|
@@ -5198,7 +5257,7 @@ void configManager.getConfig().then((config) => {
|
|
|
5198
5257
|
var main = defineCommand10({
|
|
5199
5258
|
meta: {
|
|
5200
5259
|
name: "relay",
|
|
5201
|
-
version: "0.16.
|
|
5260
|
+
version: "0.16.2",
|
|
5202
5261
|
description: "Unified CLI proxy for Claude Code, Codex CLI, and Gemini CLI"
|
|
5203
5262
|
},
|
|
5204
5263
|
subCommands: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rk0429/agentic-relay",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
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,7 +50,6 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@anthropic-ai/claude-agent-sdk": "^0.2.59",
|
|
53
|
-
"@anthropic-ai/sdk": "^0.78.0",
|
|
54
53
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
55
54
|
"@openai/codex-sdk": "^0.105.0",
|
|
56
55
|
"citty": "^0.1.6",
|