@rk0429/agentic-relay 0.12.0 → 0.12.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 +57 -35
  2. package/package.json +1 -1
package/dist/relay.mjs CHANGED
@@ -658,27 +658,45 @@ var init_spawn_agent = __esm({
658
658
  init_recursion_guard();
659
659
  init_logger();
660
660
  spawnAgentInputSchema = z2.object({
661
- backend: z2.enum(["claude", "codex", "gemini"]),
662
- prompt: z2.string(),
663
- agent: z2.string().optional(),
664
- systemPrompt: z2.string().optional(),
665
- resumeSessionId: z2.string().optional(),
666
- model: z2.string().optional(),
667
- maxTurns: z2.number().optional(),
661
+ backend: z2.enum(["claude", "codex", "gemini"]).describe(
662
+ "Required fallback backend. Overridden by automatic selection when BackendSelector is active (priority: preferredBackend > agentType mapping > taskType mapping > default)."
663
+ ),
664
+ prompt: z2.string().describe(
665
+ "The task instruction for the sub-agent. Be specific and include all necessary context for autonomous execution."
666
+ ),
667
+ agent: z2.string().optional().describe(
668
+ "Agent type identifier (e.g., 'coder', 'researcher', 'documenter', 'software-engineer'). Affects backend auto-selection: coder/researcher/software-engineer/devops-engineer\u2192codex, documenter\u2192claude. Also used to resolve agentDefinition files from .agents/agents/<agent>.md."
669
+ ),
670
+ systemPrompt: z2.string().optional().describe(
671
+ "Custom system prompt prepended to the agent's context. Use agentDefinition instead when a .md definition file exists."
672
+ ),
673
+ resumeSessionId: z2.string().optional().describe(
674
+ "Relay session ID to resume. Enables multi-turn continuation of a previous agent execution."
675
+ ),
676
+ model: z2.string().optional().describe(
677
+ "Model to use (e.g., 'opus', 'sonnet', 'o3'). Passed to the backend CLI. Model availability varies by backend."
678
+ ),
679
+ maxTurns: z2.number().optional().describe(
680
+ "Maximum agentic turns (tool-use cycles). Limits execution depth to prevent runaway agents."
681
+ ),
668
682
  skillContext: z2.object({
669
683
  skillPath: z2.string().describe("Path to the skill directory (e.g., '.agents/skills/software-engineer/')"),
670
- subskill: z2.string().optional().describe("Specific subskill to activate")
671
- }).optional().describe("Skill context to inject into the subagent's system prompt"),
684
+ subskill: z2.string().optional().describe("Specific subskill to activate within the skill")
685
+ }).optional().describe("Skill context to inject into the sub-agent's system prompt. Loads SKILL.md/SUBSKILL.md content."),
672
686
  agentDefinition: z2.object({
673
- definitionPath: z2.string().describe("Path to the agent definition file (e.g., '.claude/agents/software-engineer.md')")
674
- }).optional().describe("Agent definition file to inject into the sub-agent's system prompt"),
675
- preferredBackend: z2.enum(["claude", "codex", "gemini"]).optional().describe("Preferred backend override. Takes priority over automatic selection based on agent/task type."),
676
- 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."),
687
+ definitionPath: z2.string().describe("Path to the agent definition .md file (e.g., '.agents/agents/coder.md')")
688
+ }).optional().describe("Agent definition file to inject into the sub-agent's system prompt as <agent-definition> context."),
689
+ preferredBackend: z2.enum(["claude", "codex", "gemini"]).optional().describe(
690
+ "Preferred backend override. Takes highest priority in backend selection. Use when the automatic agentType/taskType mapping does not match your needs."
691
+ ),
692
+ taskType: z2.enum(["code-writing", "code-review", "document-writing", "document-review", "research", "mixed"]).optional().describe(
693
+ "Task type hint for automatic backend selection (priority 3, after preferredBackend and agentType). Mapping: code-writing\u2192codex, code-review\u2192claude, document-writing\u2192claude, document-review\u2192codex, research\u2192codex, mixed\u2192claude."
694
+ ),
677
695
  timeoutMs: z2.number().optional().describe("Timeout in milliseconds for agent execution. Default: no timeout."),
678
696
  taskInstructionPath: z2.string().optional().describe(
679
697
  "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."
680
698
  ),
681
- label: z2.string().optional().describe("Human-readable label for identifying this agent in parallel results")
699
+ label: z2.string().optional().describe("Human-readable label for identifying this agent in parallel results and logs.")
682
700
  });
683
701
  }
684
702
  });
@@ -994,7 +1012,10 @@ var init_backend_selector = __esm({
994
1012
  "skill-developer": "codex",
995
1013
  "security-auditor": "codex",
996
1014
  "analytics-engineer": "codex",
997
- "payments-billing": "codex"
1015
+ "payments-billing": "codex",
1016
+ "coder": "codex",
1017
+ "researcher": "codex",
1018
+ "documenter": "claude"
998
1019
  };
999
1020
  TASK_TYPE_TO_BACKEND_MAP = {
1000
1021
  "code-writing": "codex",
@@ -1180,7 +1201,7 @@ var init_server = __esm({
1180
1201
  this.guard = new RecursionGuard(guardConfig);
1181
1202
  this.backendSelector = new BackendSelector();
1182
1203
  this.server = new McpServer(
1183
- { name: "agentic-relay", version: "0.12.0" },
1204
+ { name: "agentic-relay", version: "0.12.1" },
1184
1205
  createMcpServerOptions()
1185
1206
  );
1186
1207
  this.registerTools(this.server);
@@ -1296,7 +1317,7 @@ var init_server = __esm({
1296
1317
  server.experimental.tasks.registerToolTask(
1297
1318
  "spawn_agent",
1298
1319
  {
1299
- description: "Spawn a sub-agent on the specified backend CLI (Claude Code, Codex CLI, or Gemini CLI). The agent executes the given prompt in non-interactive mode and returns the result. Use 'agent' for named agent configurations (Claude only), 'systemPrompt' for custom role instructions (all backends), 'skillContext' to inject a skill definition (SKILL.md/SUBSKILL.md), 'agentDefinition' to inject an agent definition file into the sub-agent's system prompt, 'preferredBackend' to override automatic backend selection, or 'taskType' to hint at the task nature for backend selection.",
1320
+ description: "Spawn a sub-agent on a backend CLI (Claude Code, Codex CLI, or Gemini CLI). The agent executes the given prompt in non-interactive mode and returns the result. Backend is auto-selected by priority: preferredBackend > agentType mapping (coder/researcher\u2192codex, documenter\u2192claude) > taskType mapping > default (claude). Use 'agentDefinition' to inject an agent .md file, 'skillContext' for a SKILL.md, or 'systemPrompt' for custom instructions.",
1300
1321
  inputSchema: spawnAgentInputSchema.shape,
1301
1322
  execution: { taskSupport: "optional" }
1302
1323
  },
@@ -1310,18 +1331,19 @@ var init_server = __esm({
1310
1331
  return { task };
1311
1332
  },
1312
1333
  getTask: async (_params, extra) => {
1313
- const task = await extra.taskStore.getTask(extra.taskId);
1314
- return { task: task ?? void 0 };
1334
+ return await extra.taskStore.getTask(extra.taskId);
1315
1335
  },
1316
1336
  getTaskResult: async (_params, extra) => {
1317
- return await extra.taskStore.getTaskResult(extra.taskId);
1337
+ return await extra.taskStore.getTaskResult(
1338
+ extra.taskId
1339
+ );
1318
1340
  }
1319
1341
  }
1320
1342
  );
1321
1343
  server.experimental.tasks.registerToolTask(
1322
1344
  "spawn_agents_parallel",
1323
1345
  {
1324
- description: "Spawn multiple sub-agents in parallel across available backends. Each agent entry accepts the same parameters as spawn_agent. All agents are executed concurrently via Promise.allSettled, and results are returned as an array with per-agent status. RecursionGuard batch pre-validation ensures the entire batch fits within call limits before execution begins. Failed results include 'originalInput' for retry via retry_failed_agents.",
1346
+ description: "Spawn multiple sub-agents in parallel across available backends. Use this when you have 2+ independent tasks that can execute concurrently. Each agent entry accepts the same parameters as spawn_agent. Results are returned as an array with per-agent status (success/failure). RecursionGuard batch pre-validation ensures the batch fits within call limits. Failed results include 'originalInput' for retry via retry_failed_agents.",
1325
1347
  inputSchema: spawnAgentsParallelInputShape,
1326
1348
  execution: { taskSupport: "optional" }
1327
1349
  },
@@ -1335,11 +1357,12 @@ var init_server = __esm({
1335
1357
  return { task };
1336
1358
  },
1337
1359
  getTask: async (_params, extra) => {
1338
- const task = await extra.taskStore.getTask(extra.taskId);
1339
- return { task: task ?? void 0 };
1360
+ return await extra.taskStore.getTask(extra.taskId);
1340
1361
  },
1341
1362
  getTaskResult: async (_params, extra) => {
1342
- return await extra.taskStore.getTaskResult(extra.taskId);
1363
+ return await extra.taskStore.getTaskResult(
1364
+ extra.taskId
1365
+ );
1343
1366
  }
1344
1367
  }
1345
1368
  );
@@ -1396,8 +1419,8 @@ var init_server = __esm({
1396
1419
  "list_sessions",
1397
1420
  "List relay sessions, optionally filtered by backend.",
1398
1421
  {
1399
- backend: z5.enum(["claude", "codex", "gemini"]).optional(),
1400
- limit: z5.number().optional()
1422
+ backend: z5.enum(["claude", "codex", "gemini"]).optional().describe("Filter sessions by backend type."),
1423
+ limit: z5.number().optional().describe("Maximum number of sessions to return. Default: 10.")
1401
1424
  },
1402
1425
  async (params) => {
1403
1426
  try {
@@ -1426,7 +1449,7 @@ var init_server = __esm({
1426
1449
  "get_context_status",
1427
1450
  "Get the context usage status of a relay session. Returns usage data from ContextMonitor when available, otherwise estimated values.",
1428
1451
  {
1429
- sessionId: z5.string()
1452
+ sessionId: z5.string().describe("Relay session ID to query context usage for.")
1430
1453
  },
1431
1454
  async (params) => {
1432
1455
  try {
@@ -1542,7 +1565,7 @@ var init_server = __esm({
1542
1565
  sessionIdGenerator: () => randomUUID()
1543
1566
  });
1544
1567
  const server = new McpServer(
1545
- { name: "agentic-relay", version: "0.12.0" },
1568
+ { name: "agentic-relay", version: "0.12.1" },
1546
1569
  createMcpServerOptions()
1547
1570
  );
1548
1571
  this.registerTools(server);
@@ -3414,7 +3437,8 @@ var HooksEngine = class _HooksEngine {
3414
3437
  const message = error instanceof Error ? error.message : String(error);
3415
3438
  if (strategy === "abort") {
3416
3439
  throw new Error(
3417
- `Hook "${def.command}" failed (abort): ${message}`
3440
+ `Hook "${def.command}" failed (abort): ${message}`,
3441
+ { cause: error }
3418
3442
  );
3419
3443
  }
3420
3444
  if (strategy === "warn") {
@@ -3461,7 +3485,8 @@ var HooksEngine = class _HooksEngine {
3461
3485
  const message = error instanceof Error ? error.message : String(error);
3462
3486
  if (strategy === "abort") {
3463
3487
  throw new Error(
3464
- `Hook "${def.command}" failed (abort): ${message}`
3488
+ `Hook "${def.command}" failed (abort): ${message}`,
3489
+ { cause: error }
3465
3490
  );
3466
3491
  }
3467
3492
  if (strategy === "warn") {
@@ -3853,7 +3878,6 @@ function createBackendCommand(backendId, registry2, sessionManager2, hooksEngine
3853
3878
  try {
3854
3879
  if (flags.prompt) {
3855
3880
  logger.debug(`Executing prompt on ${backendId}`);
3856
- let nativeSessionId;
3857
3881
  if (adapter.executeStreaming) {
3858
3882
  for await (const event of adapter.executeStreaming(flags)) {
3859
3883
  switch (event.type) {
@@ -3894,7 +3918,6 @@ function createBackendCommand(backendId, registry2, sessionManager2, hooksEngine
3894
3918
  }
3895
3919
  case "done":
3896
3920
  process.exitCode = event.result.exitCode;
3897
- nativeSessionId = event.nativeSessionId;
3898
3921
  if (event.nativeSessionId && sessionManager2 && relaySessionId) {
3899
3922
  try {
3900
3923
  await sessionManager2.update(relaySessionId, {
@@ -3911,7 +3934,6 @@ function createBackendCommand(backendId, registry2, sessionManager2, hooksEngine
3911
3934
  if (result.stdout) process.stdout.write(result.stdout);
3912
3935
  if (result.stderr) process.stderr.write(result.stderr);
3913
3936
  process.exitCode = result.exitCode;
3914
- nativeSessionId = result.nativeSessionId;
3915
3937
  if (result.nativeSessionId && sessionManager2 && relaySessionId) {
3916
3938
  try {
3917
3939
  await sessionManager2.update(relaySessionId, {
@@ -4495,7 +4517,7 @@ function createVersionCommand(registry2) {
4495
4517
  description: "Show relay and backend versions"
4496
4518
  },
4497
4519
  async run() {
4498
- const relayVersion = "0.12.0";
4520
+ const relayVersion = "0.12.1";
4499
4521
  console.log(`agentic-relay v${relayVersion}`);
4500
4522
  console.log("");
4501
4523
  console.log("Backends:");
@@ -4845,7 +4867,7 @@ void configManager.getConfig().then((config) => {
4845
4867
  var main = defineCommand10({
4846
4868
  meta: {
4847
4869
  name: "relay",
4848
- version: "0.12.0",
4870
+ version: "0.12.1",
4849
4871
  description: "Unified CLI proxy for Claude Code, Codex CLI, and Gemini CLI"
4850
4872
  },
4851
4873
  subCommands: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rk0429/agentic-relay",
3
- "version": "0.12.0",
3
+ "version": "0.12.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",