@rk0429/agentic-relay 0.10.0 → 0.10.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.
Files changed (2) hide show
  1. package/dist/relay.mjs +50 -16
  2. package/package.json +1 -1
package/dist/relay.mjs CHANGED
@@ -490,7 +490,34 @@ ${input.prompt}`;
490
490
  _failureReason: "session_continuation_unsupported"
491
491
  };
492
492
  }
493
- return adapter.continueSession(input.resumeSessionId, effectivePrompt);
493
+ let effectiveNativeSessionId;
494
+ if (input.resumeSessionId.startsWith("relay-")) {
495
+ const existingSession = await sessionManager2.get(input.resumeSessionId);
496
+ if (!existingSession) {
497
+ return {
498
+ exitCode: 1,
499
+ stdout: "",
500
+ stderr: `Session not found: ${input.resumeSessionId}`,
501
+ _noSession: true,
502
+ _failureReason: "session_not_found"
503
+ };
504
+ }
505
+ if (!existingSession.nativeSessionId) {
506
+ return {
507
+ exitCode: 1,
508
+ stdout: "",
509
+ stderr: `Session ${input.resumeSessionId} has no native session ID (session may have failed before completing)`,
510
+ _noSession: true,
511
+ _failureReason: "session_not_found"
512
+ };
513
+ }
514
+ effectiveNativeSessionId = existingSession.nativeSessionId;
515
+ } else {
516
+ effectiveNativeSessionId = input.resumeSessionId;
517
+ }
518
+ return adapter.continueSession(effectiveNativeSessionId, effectivePrompt, {
519
+ ...input.maxTurns !== void 0 ? { maxTurns: input.maxTurns } : {}
520
+ });
494
521
  } else {
495
522
  let mcpServers;
496
523
  if (childHttpUrl) {
@@ -550,7 +577,10 @@ ${input.prompt}`;
550
577
  guard.recordSpawn(context);
551
578
  const status = result.exitCode === 0 ? "completed" : "error";
552
579
  const failureReason = result.exitCode !== 0 ? inferFailureReason(result.stderr, result.stdout) : void 0;
553
- await sessionManager2.update(session.relaySessionId, { status });
580
+ await sessionManager2.update(session.relaySessionId, {
581
+ status,
582
+ ...result.nativeSessionId ? { nativeSessionId: result.nativeSessionId } : {}
583
+ });
554
584
  const completedAt = (/* @__PURE__ */ new Date()).toISOString();
555
585
  const metadata = {
556
586
  durationMs: new Date(completedAt).getTime() - new Date(spawnStartedAt).getTime(),
@@ -1115,7 +1145,7 @@ var init_server = __esm({
1115
1145
  this.backendSelector = new BackendSelector();
1116
1146
  this.server = new McpServer({
1117
1147
  name: "agentic-relay",
1118
- version: "0.10.0"
1148
+ version: "0.10.1"
1119
1149
  });
1120
1150
  this.registerTools(this.server);
1121
1151
  }
@@ -1423,7 +1453,7 @@ var init_server = __esm({
1423
1453
  });
1424
1454
  const server = new McpServer({
1425
1455
  name: "agentic-relay",
1426
- version: "0.10.0"
1456
+ version: "0.10.1"
1427
1457
  });
1428
1458
  this.registerTools(server);
1429
1459
  transport.onclose = () => {
@@ -1639,7 +1669,7 @@ var BaseAdapter = class _BaseAdapter {
1639
1669
  }
1640
1670
  return result.stdout.trim();
1641
1671
  }
1642
- async continueSession(_nativeSessionId, _prompt) {
1672
+ async continueSession(_nativeSessionId, _prompt, _options) {
1643
1673
  return {
1644
1674
  exitCode: 1,
1645
1675
  stdout: "",
@@ -1996,31 +2026,33 @@ var ClaudeAdapter = class extends BaseAdapter {
1996
2026
  if (timer !== void 0) clearTimeout(timer);
1997
2027
  }
1998
2028
  }
1999
- async continueSession(nativeSessionId, prompt) {
2029
+ async continueSession(nativeSessionId, prompt, options) {
2000
2030
  const timeoutMs = resolveClaudeSdkTimeoutMs();
2001
2031
  const abortController = new AbortController();
2002
2032
  const timer = timeoutMs !== void 0 ? setTimeout(() => abortController.abort(), timeoutMs) : void 0;
2003
2033
  try {
2004
2034
  const { query } = await loadClaudeSDK();
2005
2035
  const permissionMode = this.getPermissionMode();
2006
- const options = {
2036
+ const queryOptions = {
2007
2037
  abortController,
2008
2038
  resume: nativeSessionId,
2009
- maxTurns: 1,
2039
+ maxTurns: options?.maxTurns ?? 1,
2010
2040
  cwd: process.cwd(),
2011
2041
  strictMcpConfig: true
2012
2042
  };
2013
2043
  if (permissionMode === "bypassPermissions") {
2014
- options.permissionMode = "bypassPermissions";
2015
- options.allowDangerouslySkipPermissions = true;
2044
+ queryOptions.permissionMode = "bypassPermissions";
2045
+ queryOptions.allowDangerouslySkipPermissions = true;
2016
2046
  }
2017
2047
  const q = query({
2018
2048
  prompt,
2019
- options
2049
+ options: queryOptions
2020
2050
  });
2021
2051
  let resultText = "";
2052
+ let sessionId = "";
2022
2053
  for await (const message of q) {
2023
2054
  if (message.type === "result") {
2055
+ sessionId = message.session_id;
2024
2056
  if (message.subtype === "success") {
2025
2057
  resultText = message.result;
2026
2058
  }
@@ -2029,7 +2061,8 @@ var ClaudeAdapter = class extends BaseAdapter {
2029
2061
  return {
2030
2062
  exitCode: 0,
2031
2063
  stdout: resultText,
2032
- stderr: ""
2064
+ stderr: "",
2065
+ ...sessionId ? { nativeSessionId: sessionId } : {}
2033
2066
  };
2034
2067
  } catch (error) {
2035
2068
  if (abortController.signal.aborted) {
@@ -2459,7 +2492,7 @@ ${prompt}`;
2459
2492
  };
2460
2493
  }
2461
2494
  }
2462
- async continueSession(nativeSessionId, prompt) {
2495
+ async continueSession(nativeSessionId, prompt, _options) {
2463
2496
  try {
2464
2497
  const { Codex } = await loadCodexSDK();
2465
2498
  const codex = new Codex();
@@ -2471,7 +2504,8 @@ ${prompt}`;
2471
2504
  return {
2472
2505
  exitCode: 0,
2473
2506
  stdout: result.finalResponse,
2474
- stderr: ""
2507
+ stderr: "",
2508
+ nativeSessionId
2475
2509
  };
2476
2510
  } catch (error) {
2477
2511
  return {
@@ -4371,7 +4405,7 @@ function createVersionCommand(registry2) {
4371
4405
  description: "Show relay and backend versions"
4372
4406
  },
4373
4407
  async run() {
4374
- const relayVersion = "0.10.0";
4408
+ const relayVersion = "0.10.1";
4375
4409
  console.log(`agentic-relay v${relayVersion}`);
4376
4410
  console.log("");
4377
4411
  console.log("Backends:");
@@ -4721,7 +4755,7 @@ void configManager.getConfig().then((config) => {
4721
4755
  var main = defineCommand10({
4722
4756
  meta: {
4723
4757
  name: "relay",
4724
- version: "0.10.0",
4758
+ version: "0.10.1",
4725
4759
  description: "Unified CLI proxy for Claude Code, Codex CLI, and Gemini CLI"
4726
4760
  },
4727
4761
  subCommands: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rk0429/agentic-relay",
3
- "version": "0.10.0",
3
+ "version": "0.10.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",