@rk0429/agentic-relay 0.16.1 → 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.
Files changed (2) hide show
  1. package/dist/relay.mjs +49 -20
  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
 
@@ -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.1" },
1490
+ { name: "agentic-relay", version: "0.16.2" },
1462
1491
  createMcpServerOptions()
1463
1492
  );
1464
1493
  this.registerTools(this.server);
@@ -1863,7 +1892,7 @@ var init_server = __esm({
1863
1892
  sessionIdGenerator: () => randomUUID()
1864
1893
  });
1865
1894
  const server = new McpServer(
1866
- { name: "agentic-relay", version: "0.16.1" },
1895
+ { name: "agentic-relay", version: "0.16.2" },
1867
1896
  createMcpServerOptions()
1868
1897
  );
1869
1898
  this.registerTools(server);
@@ -4878,7 +4907,7 @@ function createVersionCommand(registry2) {
4878
4907
  description: "Show relay and backend versions"
4879
4908
  },
4880
4909
  async run() {
4881
- const relayVersion = "0.16.1";
4910
+ const relayVersion = "0.16.2";
4882
4911
  console.log(`agentic-relay v${relayVersion}`);
4883
4912
  console.log("");
4884
4913
  console.log("Backends:");
@@ -5228,7 +5257,7 @@ void configManager.getConfig().then((config) => {
5228
5257
  var main = defineCommand10({
5229
5258
  meta: {
5230
5259
  name: "relay",
5231
- version: "0.16.1",
5260
+ version: "0.16.2",
5232
5261
  description: "Unified CLI proxy for Claude Code, Codex CLI, and Gemini CLI"
5233
5262
  },
5234
5263
  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.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",