@rk0429/agentic-relay 0.9.1 → 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.
- package/dist/relay.mjs +57 -21
- 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
|
-
|
|
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, {
|
|
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(),
|
|
@@ -637,7 +667,7 @@ var init_spawn_agent = __esm({
|
|
|
637
667
|
definitionPath: z2.string().describe("Path to the agent definition file (e.g., '.claude/agents/software-engineer.md')")
|
|
638
668
|
}).optional().describe("Agent definition file to inject into the sub-agent's system prompt"),
|
|
639
669
|
preferredBackend: z2.enum(["claude", "codex", "gemini"]).optional().describe("Preferred backend override. Takes priority over automatic selection based on agent/task type."),
|
|
640
|
-
taskType: z2.enum(["code", "document", "
|
|
670
|
+
taskType: z2.enum(["code-writing", "code-review", "document-writing", "document-review", "research", "mixed"]).optional().describe("Task type hint for automatic backend selection when preferredBackend is not specified. code-writing\u2192codex, code-review\u2192claude, document-writing\u2192claude, document-review\u2192codex, research\u2192codex, mixed\u2192claude."),
|
|
641
671
|
timeoutMs: z2.number().optional().describe("Timeout in milliseconds for agent execution. Default: no timeout."),
|
|
642
672
|
taskInstructionPath: z2.string().optional().describe(
|
|
643
673
|
"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."
|
|
@@ -961,10 +991,12 @@ var init_backend_selector = __esm({
|
|
|
961
991
|
"payments-billing": "codex"
|
|
962
992
|
};
|
|
963
993
|
TASK_TYPE_TO_BACKEND_MAP = {
|
|
964
|
-
code: "codex",
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
994
|
+
"code-writing": "codex",
|
|
995
|
+
"code-review": "claude",
|
|
996
|
+
"document-writing": "claude",
|
|
997
|
+
"document-review": "codex",
|
|
998
|
+
"research": "codex",
|
|
999
|
+
"mixed": "claude"
|
|
968
1000
|
};
|
|
969
1001
|
DEFAULT_BACKEND = "claude";
|
|
970
1002
|
BackendSelector = class {
|
|
@@ -1113,7 +1145,7 @@ var init_server = __esm({
|
|
|
1113
1145
|
this.backendSelector = new BackendSelector();
|
|
1114
1146
|
this.server = new McpServer({
|
|
1115
1147
|
name: "agentic-relay",
|
|
1116
|
-
version: "0.
|
|
1148
|
+
version: "0.10.1"
|
|
1117
1149
|
});
|
|
1118
1150
|
this.registerTools(this.server);
|
|
1119
1151
|
}
|
|
@@ -1421,7 +1453,7 @@ var init_server = __esm({
|
|
|
1421
1453
|
});
|
|
1422
1454
|
const server = new McpServer({
|
|
1423
1455
|
name: "agentic-relay",
|
|
1424
|
-
version: "0.
|
|
1456
|
+
version: "0.10.1"
|
|
1425
1457
|
});
|
|
1426
1458
|
this.registerTools(server);
|
|
1427
1459
|
transport.onclose = () => {
|
|
@@ -1637,7 +1669,7 @@ var BaseAdapter = class _BaseAdapter {
|
|
|
1637
1669
|
}
|
|
1638
1670
|
return result.stdout.trim();
|
|
1639
1671
|
}
|
|
1640
|
-
async continueSession(_nativeSessionId, _prompt) {
|
|
1672
|
+
async continueSession(_nativeSessionId, _prompt, _options) {
|
|
1641
1673
|
return {
|
|
1642
1674
|
exitCode: 1,
|
|
1643
1675
|
stdout: "",
|
|
@@ -1994,31 +2026,33 @@ var ClaudeAdapter = class extends BaseAdapter {
|
|
|
1994
2026
|
if (timer !== void 0) clearTimeout(timer);
|
|
1995
2027
|
}
|
|
1996
2028
|
}
|
|
1997
|
-
async continueSession(nativeSessionId, prompt) {
|
|
2029
|
+
async continueSession(nativeSessionId, prompt, options) {
|
|
1998
2030
|
const timeoutMs = resolveClaudeSdkTimeoutMs();
|
|
1999
2031
|
const abortController = new AbortController();
|
|
2000
2032
|
const timer = timeoutMs !== void 0 ? setTimeout(() => abortController.abort(), timeoutMs) : void 0;
|
|
2001
2033
|
try {
|
|
2002
2034
|
const { query } = await loadClaudeSDK();
|
|
2003
2035
|
const permissionMode = this.getPermissionMode();
|
|
2004
|
-
const
|
|
2036
|
+
const queryOptions = {
|
|
2005
2037
|
abortController,
|
|
2006
2038
|
resume: nativeSessionId,
|
|
2007
|
-
maxTurns: 1,
|
|
2039
|
+
maxTurns: options?.maxTurns ?? 1,
|
|
2008
2040
|
cwd: process.cwd(),
|
|
2009
2041
|
strictMcpConfig: true
|
|
2010
2042
|
};
|
|
2011
2043
|
if (permissionMode === "bypassPermissions") {
|
|
2012
|
-
|
|
2013
|
-
|
|
2044
|
+
queryOptions.permissionMode = "bypassPermissions";
|
|
2045
|
+
queryOptions.allowDangerouslySkipPermissions = true;
|
|
2014
2046
|
}
|
|
2015
2047
|
const q = query({
|
|
2016
2048
|
prompt,
|
|
2017
|
-
options
|
|
2049
|
+
options: queryOptions
|
|
2018
2050
|
});
|
|
2019
2051
|
let resultText = "";
|
|
2052
|
+
let sessionId = "";
|
|
2020
2053
|
for await (const message of q) {
|
|
2021
2054
|
if (message.type === "result") {
|
|
2055
|
+
sessionId = message.session_id;
|
|
2022
2056
|
if (message.subtype === "success") {
|
|
2023
2057
|
resultText = message.result;
|
|
2024
2058
|
}
|
|
@@ -2027,7 +2061,8 @@ var ClaudeAdapter = class extends BaseAdapter {
|
|
|
2027
2061
|
return {
|
|
2028
2062
|
exitCode: 0,
|
|
2029
2063
|
stdout: resultText,
|
|
2030
|
-
stderr: ""
|
|
2064
|
+
stderr: "",
|
|
2065
|
+
...sessionId ? { nativeSessionId: sessionId } : {}
|
|
2031
2066
|
};
|
|
2032
2067
|
} catch (error) {
|
|
2033
2068
|
if (abortController.signal.aborted) {
|
|
@@ -2457,7 +2492,7 @@ ${prompt}`;
|
|
|
2457
2492
|
};
|
|
2458
2493
|
}
|
|
2459
2494
|
}
|
|
2460
|
-
async continueSession(nativeSessionId, prompt) {
|
|
2495
|
+
async continueSession(nativeSessionId, prompt, _options) {
|
|
2461
2496
|
try {
|
|
2462
2497
|
const { Codex } = await loadCodexSDK();
|
|
2463
2498
|
const codex = new Codex();
|
|
@@ -2469,7 +2504,8 @@ ${prompt}`;
|
|
|
2469
2504
|
return {
|
|
2470
2505
|
exitCode: 0,
|
|
2471
2506
|
stdout: result.finalResponse,
|
|
2472
|
-
stderr: ""
|
|
2507
|
+
stderr: "",
|
|
2508
|
+
nativeSessionId
|
|
2473
2509
|
};
|
|
2474
2510
|
} catch (error) {
|
|
2475
2511
|
return {
|
|
@@ -4369,7 +4405,7 @@ function createVersionCommand(registry2) {
|
|
|
4369
4405
|
description: "Show relay and backend versions"
|
|
4370
4406
|
},
|
|
4371
4407
|
async run() {
|
|
4372
|
-
const relayVersion = "0.
|
|
4408
|
+
const relayVersion = "0.10.1";
|
|
4373
4409
|
console.log(`agentic-relay v${relayVersion}`);
|
|
4374
4410
|
console.log("");
|
|
4375
4411
|
console.log("Backends:");
|
|
@@ -4719,7 +4755,7 @@ void configManager.getConfig().then((config) => {
|
|
|
4719
4755
|
var main = defineCommand10({
|
|
4720
4756
|
meta: {
|
|
4721
4757
|
name: "relay",
|
|
4722
|
-
version: "0.
|
|
4758
|
+
version: "0.10.1",
|
|
4723
4759
|
description: "Unified CLI proxy for Claude Code, Codex CLI, and Gemini CLI"
|
|
4724
4760
|
},
|
|
4725
4761
|
subCommands: {
|
package/package.json
CHANGED