@rk0429/agentic-relay 0.16.1 → 0.16.3

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.
Files changed (2) hide show
  1. package/dist/relay.mjs +54 -21
  2. 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
- import Anthropic from "@anthropic-ai/sdk";
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 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:
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
- const content = message.content[0];
1240
- if (content?.type !== "text") {
1241
- throw new Error("Unexpected response format from summarization API");
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 content.text;
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
 
@@ -1389,8 +1418,12 @@ async function formatParallelResponse(result, options, perAgentOptions) {
1389
1418
  }
1390
1419
  parts.push("");
1391
1420
  }
1421
+ const sanitizedResult = {
1422
+ ...result,
1423
+ results: result.results.map(({ stdout: _stdout, stderr: _stderr, error: _error, ...rest }) => rest)
1424
+ };
1392
1425
  parts.push(`<metadata>
1393
- ${JSON.stringify(result, null, 2)}
1426
+ ${JSON.stringify(sanitizedResult, null, 2)}
1394
1427
  </metadata>`);
1395
1428
  return { text: parts.join("\n"), isError };
1396
1429
  }
@@ -1458,7 +1491,7 @@ var init_server = __esm({
1458
1491
  this.guard = new RecursionGuard(guardConfig);
1459
1492
  this.backendSelector = new BackendSelector();
1460
1493
  this.server = new McpServer(
1461
- { name: "agentic-relay", version: "0.16.1" },
1494
+ { name: "agentic-relay", version: "0.16.3" },
1462
1495
  createMcpServerOptions()
1463
1496
  );
1464
1497
  this.registerTools(this.server);
@@ -1863,7 +1896,7 @@ var init_server = __esm({
1863
1896
  sessionIdGenerator: () => randomUUID()
1864
1897
  });
1865
1898
  const server = new McpServer(
1866
- { name: "agentic-relay", version: "0.16.1" },
1899
+ { name: "agentic-relay", version: "0.16.3" },
1867
1900
  createMcpServerOptions()
1868
1901
  );
1869
1902
  this.registerTools(server);
@@ -4878,7 +4911,7 @@ function createVersionCommand(registry2) {
4878
4911
  description: "Show relay and backend versions"
4879
4912
  },
4880
4913
  async run() {
4881
- const relayVersion = "0.16.1";
4914
+ const relayVersion = "0.16.3";
4882
4915
  console.log(`agentic-relay v${relayVersion}`);
4883
4916
  console.log("");
4884
4917
  console.log("Backends:");
@@ -5228,7 +5261,7 @@ void configManager.getConfig().then((config) => {
5228
5261
  var main = defineCommand10({
5229
5262
  meta: {
5230
5263
  name: "relay",
5231
- version: "0.16.1",
5264
+ version: "0.16.3",
5232
5265
  description: "Unified CLI proxy for Claude Code, Codex CLI, and Gemini CLI"
5233
5266
  },
5234
5267
  subCommands: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rk0429/agentic-relay",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
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",