@agent-native/core 0.19.0 → 0.19.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 (95) hide show
  1. package/dist/a2a/caller-auth.d.ts +1 -0
  2. package/dist/a2a/caller-auth.d.ts.map +1 -1
  3. package/dist/a2a/caller-auth.js +1 -1
  4. package/dist/a2a/caller-auth.js.map +1 -1
  5. package/dist/agent/production-agent.d.ts +1 -1
  6. package/dist/agent/production-agent.d.ts.map +1 -1
  7. package/dist/agent/production-agent.js +34 -2
  8. package/dist/agent/production-agent.js.map +1 -1
  9. package/dist/cli/code-agent-executor.d.ts.map +1 -1
  10. package/dist/cli/code-agent-executor.js +47 -256
  11. package/dist/cli/code-agent-executor.js.map +1 -1
  12. package/dist/cli/connect.d.ts +3 -2
  13. package/dist/cli/connect.d.ts.map +1 -1
  14. package/dist/cli/connect.js +12 -8
  15. package/dist/cli/connect.js.map +1 -1
  16. package/dist/cli/mcp-config-writers.d.ts +3 -3
  17. package/dist/cli/mcp-config-writers.d.ts.map +1 -1
  18. package/dist/cli/mcp-config-writers.js +19 -8
  19. package/dist/cli/mcp-config-writers.js.map +1 -1
  20. package/dist/client/AgentPanel.d.ts +3 -1
  21. package/dist/client/AgentPanel.d.ts.map +1 -1
  22. package/dist/client/AgentPanel.js +4 -4
  23. package/dist/client/AgentPanel.js.map +1 -1
  24. package/dist/client/AssistantChat.d.ts +3 -0
  25. package/dist/client/AssistantChat.d.ts.map +1 -1
  26. package/dist/client/AssistantChat.js +11 -3
  27. package/dist/client/AssistantChat.js.map +1 -1
  28. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  29. package/dist/client/MultiTabAssistantChat.js +4 -1
  30. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  31. package/dist/client/dynamic-suggestions.d.ts +43 -0
  32. package/dist/client/dynamic-suggestions.d.ts.map +1 -0
  33. package/dist/client/dynamic-suggestions.js +344 -0
  34. package/dist/client/dynamic-suggestions.js.map +1 -0
  35. package/dist/client/index.d.ts +1 -0
  36. package/dist/client/index.d.ts.map +1 -1
  37. package/dist/client/index.js +1 -0
  38. package/dist/client/index.js.map +1 -1
  39. package/dist/client/settings/SettingsPanel.js +2 -2
  40. package/dist/client/settings/SettingsPanel.js.map +1 -1
  41. package/dist/coding-tools/index.d.ts +31 -0
  42. package/dist/coding-tools/index.d.ts.map +1 -0
  43. package/dist/coding-tools/index.js +411 -0
  44. package/dist/coding-tools/index.js.map +1 -0
  45. package/dist/mcp/build-server.d.ts +33 -1
  46. package/dist/mcp/build-server.d.ts.map +1 -1
  47. package/dist/mcp/build-server.js +33 -10
  48. package/dist/mcp/build-server.js.map +1 -1
  49. package/dist/mcp/builtin-tools.d.ts +3 -1
  50. package/dist/mcp/builtin-tools.d.ts.map +1 -1
  51. package/dist/mcp/builtin-tools.js +115 -26
  52. package/dist/mcp/builtin-tools.js.map +1 -1
  53. package/dist/mcp/connect-route.d.ts.map +1 -1
  54. package/dist/mcp/connect-route.js +382 -74
  55. package/dist/mcp/connect-route.js.map +1 -1
  56. package/dist/mcp/org-directory.d.ts +83 -0
  57. package/dist/mcp/org-directory.d.ts.map +1 -0
  58. package/dist/mcp/org-directory.js +201 -0
  59. package/dist/mcp/org-directory.js.map +1 -0
  60. package/dist/mcp/server.d.ts +38 -1
  61. package/dist/mcp/server.d.ts.map +1 -1
  62. package/dist/mcp/server.js +222 -77
  63. package/dist/mcp/server.js.map +1 -1
  64. package/dist/scripts/dev/index.d.ts +6 -4
  65. package/dist/scripts/dev/index.d.ts.map +1 -1
  66. package/dist/scripts/dev/index.js +28 -13
  67. package/dist/scripts/dev/index.js.map +1 -1
  68. package/dist/server/agent-chat-plugin.d.ts +6 -6
  69. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  70. package/dist/server/agent-chat-plugin.js +65 -32
  71. package/dist/server/agent-chat-plugin.js.map +1 -1
  72. package/dist/server/agent-teams.js +2 -2
  73. package/dist/server/agent-teams.js.map +1 -1
  74. package/dist/server/agents-bundle.d.ts +3 -3
  75. package/dist/server/agents-bundle.js +5 -5
  76. package/dist/server/agents-bundle.js.map +1 -1
  77. package/dist/server/auth.d.ts +8 -0
  78. package/dist/server/auth.d.ts.map +1 -1
  79. package/dist/server/auth.js +8 -1
  80. package/dist/server/auth.js.map +1 -1
  81. package/dist/server/sentry.d.ts.map +1 -1
  82. package/dist/server/sentry.js +17 -2
  83. package/dist/server/sentry.js.map +1 -1
  84. package/dist/vite/client.d.ts.map +1 -1
  85. package/dist/vite/client.js +1 -0
  86. package/dist/vite/client.js.map +1 -1
  87. package/docs/content/client.md +15 -0
  88. package/docs/content/code-agents-ui.md +11 -1
  89. package/docs/content/drop-in-agent.md +3 -1
  90. package/docs/content/external-agents.md +27 -6
  91. package/docs/content/frames.md +1 -1
  92. package/docs/content/mcp-clients.md +2 -0
  93. package/docs/content/mcp-protocol.md +4 -2
  94. package/docs/content/migration-workbench.md +5 -0
  95. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"code-agent-executor.d.ts","sourceRoot":"","sources":["../../src/cli/code-agent-executor.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAsBD,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAqSpC;AAED,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,IAAI,CAAC,0BAA0B,EAAE,OAAO,CAAM,GACtD,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAEpC;AAED,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAA;CAAO,GAC/C,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CA0FpC;AAmZD,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,MAAM,GACd,0BAA0B,CAuE5B"}
1
+ {"version":3,"file":"code-agent-executor.d.ts","sourceRoot":"","sources":["../../src/cli/code-agent-executor.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAeD,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAqSpC;AAED,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,IAAI,CAAC,0BAA0B,EAAE,OAAO,CAAM,GACtD,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAEpC;AAED,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAA;CAAO,GAC/C,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CA0FpC;AA6OD,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,MAAM,GACd,0BAA0B,CAuD5B"}
@@ -1,8 +1,5 @@
1
- import { spawn } from "node:child_process";
2
- import fs from "node:fs";
3
- import path from "node:path";
4
- import { once } from "node:events";
5
1
  import { createToolSearchEntry, TOOL_SEARCH_ACTION_NAME, } from "../agent/tool-search.js";
2
+ import { createCodingToolRegistry, isReadOnlyShellCommand, runCodingCommand, truncateCodingOutput, } from "../coding-tools/index.js";
6
3
  import { buildMergedConfig, McpClientManager, mcpToolsToActionEntries, } from "../mcp-client/index.js";
7
4
  import { runWithRequestContext } from "../server/request-context.js";
8
5
  import { actionsToEngineTools, runAgentLoop, } from "../agent/production-agent.js";
@@ -144,7 +141,7 @@ export async function executeCodeAgentRun(options) {
144
141
  metadata: {
145
142
  type: "tool_done",
146
143
  tool: event.tool,
147
- result: truncate(event.result, 4000),
144
+ result: truncateCodingOutput(event.result, 4000),
148
145
  },
149
146
  });
150
147
  return;
@@ -338,8 +335,8 @@ export async function executePendingCodeAgentApproval(runId, options = {}) {
338
335
  command: approval.command,
339
336
  },
340
337
  });
341
- const result = await runCommand(approval.command, record.cwd || process.cwd(), DEFAULT_COMMAND_TIMEOUT_MS);
342
- const summary = truncate([
338
+ const result = await runCodingCommand(approval.command, record.cwd || process.cwd(), DEFAULT_COMMAND_TIMEOUT_MS);
339
+ const summary = truncateCodingOutput([
343
340
  `Approved command finished with exit code ${result.code}.`,
344
341
  result.timedOut ? "Timed out: true" : "",
345
342
  result.stdout ? `stdout:\n${result.stdout}` : "",
@@ -534,7 +531,8 @@ Work like a careful senior engineer:
534
531
  - In Auto mode, edit files and run ordinary project commands without pausing. Pause only for genuinely destructive operations such as recursive deletes, package publishing, privileged commands, destructive database operations, or forbidden git branch/reset/stash/rebase operations.
535
532
  - Do not create, switch, delete, reset, rebase, or stash git branches.
536
533
  - Do not run destructive git commands.
537
- - Use apply_patch or write_file for edits, then run focused verification.
534
+ - Use the shared coding tools: bash for search/list/test/build commands, read for file reads, edit for exact replacement edits, and write only for new files or intentional full rewrites.
535
+ - Prefer edit over write when changing existing files, then run focused verification with bash.
538
536
  - Use tool-search when you need a capability that may come from MCP, including browser automation or computer control.
539
537
  - Prefer Playwright MCP for deterministic browser testing; prefer Chrome DevTools MCP when the user needs their live logged-in Chrome session.
540
538
  - Only use computer-control MCP tools when they are explicitly available and the user request warrants controlling the local computer.
@@ -542,192 +540,45 @@ Work like a careful senior engineer:
542
540
  - Respect any AGENTS.md instructions in the repository.`;
543
541
  }
544
542
  function createLocalCodeAgentActions(cwd, permissionMode, runId) {
545
- const actions = {
546
- list_files: {
547
- readOnly: true,
548
- tool: {
549
- description: "List files under the current repository/workspace.",
550
- parameters: {
551
- type: "object",
552
- properties: {
553
- pattern: {
554
- type: "string",
555
- description: "Optional substring or glob-like fragment to filter.",
556
- },
557
- },
558
- required: [],
559
- },
560
- },
561
- run: async (args) => {
562
- const result = await runCommand("rg --files", cwd, 30_000);
563
- const output = result.code === 0
564
- ? result.stdout
565
- : (await runCommand("find . -type f | sed 's#^./##'", cwd, 30_000))
566
- .stdout;
567
- const pattern = stringArg(args.pattern).toLowerCase();
568
- const files = output
569
- .split(/\r?\n/)
570
- .filter(Boolean)
571
- .filter((file) => !pattern || file.toLowerCase().includes(pattern))
572
- .slice(0, 500);
573
- return files.join("\n") || "(no files found)";
574
- },
575
- },
576
- search_files: {
577
- readOnly: true,
578
- tool: {
579
- description: "Search files with ripgrep.",
580
- parameters: {
581
- type: "object",
582
- properties: {
583
- query: { type: "string", description: "Search query or regex." },
584
- glob: {
585
- type: "string",
586
- description: "Optional glob, for example src/**/*.ts.",
587
- },
588
- },
589
- required: ["query"],
590
- },
591
- },
592
- run: async (args) => {
593
- const query = stringArg(args.query);
594
- if (!query)
595
- return "Error: query is required.";
596
- const glob = stringArg(args.glob);
597
- const command = glob
598
- ? `rg --line-number --no-heading ${shellQuote(query)} -g ${shellQuote(glob)}`
599
- : `rg --line-number --no-heading ${shellQuote(query)}`;
600
- const result = await runCommand(command, cwd, 30_000);
601
- return truncate(result.stdout || result.stderr || "(no matches)", MAX_TOOL_OUTPUT_CHARS);
602
- },
603
- },
604
- read_file: {
605
- readOnly: true,
606
- tool: {
607
- description: "Read a UTF-8 text file inside the workspace.",
608
- parameters: {
609
- type: "object",
610
- properties: {
611
- path: { type: "string", description: "Relative file path." },
612
- },
613
- required: ["path"],
614
- },
615
- },
616
- run: async (args) => {
617
- const filePath = resolveInsideCwd(cwd, stringArg(args.path));
618
- if (!filePath)
619
- return "Error: path must stay inside the workspace.";
620
- if (!fs.existsSync(filePath))
621
- return `Error: file not found: ${args.path}`;
622
- const stat = fs.statSync(filePath);
623
- if (!stat.isFile())
624
- return `Error: not a file: ${args.path}`;
625
- return truncate(fs.readFileSync(filePath, "utf8"), MAX_FILE_READ_CHARS);
626
- },
627
- },
628
- write_file: {
629
- tool: {
630
- description: "Write a complete UTF-8 text file inside the workspace.",
631
- parameters: {
632
- type: "object",
633
- properties: {
634
- path: { type: "string", description: "Relative file path." },
635
- content: { type: "string", description: "Full file content." },
636
- },
637
- required: ["path", "content"],
638
- },
639
- },
640
- run: async (args) => {
641
- const permissionError = permissionErrorForWrite(permissionMode, "write_file");
642
- if (permissionError)
643
- return permissionError;
644
- const filePath = resolveInsideCwd(cwd, stringArg(args.path));
645
- if (!filePath)
646
- return "Error: path must stay inside the workspace.";
647
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
648
- fs.writeFileSync(filePath, stringArg(args.content));
649
- return `Wrote ${path.relative(cwd, filePath)}`;
650
- },
651
- },
652
- apply_patch: {
653
- tool: {
654
- description: "Apply a unified git patch from the workspace root. Prefer this for precise edits.",
655
- parameters: {
656
- type: "object",
657
- properties: {
658
- patch: { type: "string", description: "Unified diff patch text." },
659
- },
660
- required: ["patch"],
661
- },
662
- },
663
- run: async (args) => {
664
- const permissionError = permissionErrorForWrite(permissionMode, "apply_patch");
543
+ const actions = createCodingToolRegistry({
544
+ cwd,
545
+ restrictToCwd: true,
546
+ commandTimeoutMs: DEFAULT_COMMAND_TIMEOUT_MS,
547
+ maxOutputChars: MAX_TOOL_OUTPUT_CHARS,
548
+ maxFileReadChars: MAX_FILE_READ_CHARS,
549
+ canWrite: (toolName) => permissionErrorForWrite(permissionMode, toolName),
550
+ beforeBash: ({ command }) => {
551
+ const permission = classifyCodeAgentCommandPermission(command);
552
+ if (permission.kind === "forbidden") {
553
+ return `Error: command is blocked by Agent-Native Code policy: ${permission.reason}`;
554
+ }
555
+ if (permission.kind !== "read") {
556
+ const permissionError = permissionErrorForWrite(permissionMode, "bash");
665
557
  if (permissionError)
666
558
  return permissionError;
667
- const patch = stringArg(args.patch);
668
- if (!patch.trim())
669
- return "Error: patch is required.";
670
- const result = await runCommand("git apply --whitespace=nowarn -", cwd, 30_000, patch);
671
- if (result.code !== 0) {
672
- return `Error applying patch:\n${result.stderr || result.stdout}`;
673
- }
674
- return "Patch applied.";
675
- },
676
- },
677
- run_command: {
678
- tool: {
679
- description: "Run a shell command from the workspace root. Use for tests, typechecks, and safe project commands.",
680
- parameters: {
681
- type: "object",
682
- properties: {
683
- command: { type: "string", description: "Shell command to run." },
684
- timeoutMs: {
685
- type: "string",
686
- description: "Optional timeout in milliseconds.",
687
- },
688
- },
689
- required: ["command"],
690
- },
691
- },
692
- run: async (args) => {
693
- const command = stringArg(args.command);
694
- if (!command)
695
- return "Error: command is required.";
696
- const permission = classifyCodeAgentCommandPermission(command);
697
- if (permission.kind === "forbidden") {
698
- return `Error: command is blocked by Agent-Native Code policy: ${permission.reason}`;
699
- }
700
- if (permission.kind === "approval-required") {
701
- const approval = requestCodeAgentApproval(runId, {
702
- tool: "run_command",
703
- command,
704
- reason: permission.reason,
705
- permissionMode,
706
- });
707
- return [
708
- `Approval required before running this command: ${permission.reason}.`,
709
- `Approval id: ${approval.id}`,
710
- `Command: ${command}`,
711
- "The run is paused; approve from the Agent-Native Code UI/CLI if this command is intentional.",
712
- ].join("\n");
713
- }
714
- const timeoutMs = Number(args.timeoutMs);
715
- const result = await runCommand(command, cwd, Number.isFinite(timeoutMs) && timeoutMs > 0
716
- ? Math.min(timeoutMs, 10 * 60_000)
717
- : DEFAULT_COMMAND_TIMEOUT_MS);
718
- return truncate([
719
- `exitCode: ${result.code}`,
720
- result.timedOut ? "timedOut: true" : "",
721
- result.stdout ? `stdout:\n${result.stdout}` : "",
722
- result.stderr ? `stderr:\n${result.stderr}` : "",
723
- ]
724
- .filter(Boolean)
725
- .join("\n\n"), MAX_TOOL_OUTPUT_CHARS);
726
- },
559
+ }
560
+ if (permission.kind === "approval-required") {
561
+ const approval = requestCodeAgentApproval(runId, {
562
+ tool: "bash",
563
+ command,
564
+ reason: permission.reason,
565
+ permissionMode,
566
+ });
567
+ return [
568
+ `Approval required before running this command: ${permission.reason}.`,
569
+ `Approval id: ${approval.id}`,
570
+ `Command: ${command}`,
571
+ "The run is paused; approve from the Agent-Native Code UI/CLI if this command is intentional.",
572
+ ].join("\n");
573
+ }
574
+ return null;
727
575
  },
728
- };
576
+ });
729
577
  if (permissionMode === "read-only") {
730
- return Object.fromEntries(Object.entries(actions).filter(([, action]) => action.readOnly));
578
+ return {
579
+ bash: actions.bash,
580
+ read: actions.read,
581
+ };
731
582
  }
732
583
  return actions;
733
584
  }
@@ -767,23 +618,7 @@ export function classifyCodeAgentCommandPermission(command) {
767
618
  return { kind: "approval-required", reason };
768
619
  }
769
620
  }
770
- const readPatterns = [
771
- /^pwd\b/,
772
- /^ls\b/,
773
- /^find\b/,
774
- /^rg\b/,
775
- /^grep\b/,
776
- /^cat\b/,
777
- /^sed\s+-n\b/,
778
- /^head\b/,
779
- /^tail\b/,
780
- /^wc\b/,
781
- /^git\s+(status|diff|show|log)\b/,
782
- /^git\s+branch\s+--show-current\b/,
783
- /^pnpm\b.*\b(test|typecheck|lint|check)\b/,
784
- /^npm\b.*\b(test|run\s+(test|typecheck|lint|check))\b/,
785
- ];
786
- if (readPatterns.some((pattern) => pattern.test(normalized))) {
621
+ if (isReadOnlyShellCommand(command)) {
787
622
  return { kind: "read" };
788
623
  }
789
624
  const writePatterns = [
@@ -850,7 +685,10 @@ function getPendingApproval(runId) {
850
685
  if (!approval || typeof approval !== "object")
851
686
  return null;
852
687
  const candidate = approval;
853
- if (candidate.tool !== "run_command" ||
688
+ const tool = candidate.tool === "bash" || candidate.tool === "run_command"
689
+ ? candidate.tool
690
+ : null;
691
+ if (!tool ||
854
692
  typeof candidate.command !== "string" ||
855
693
  typeof candidate.reason !== "string" ||
856
694
  typeof candidate.id !== "string" ||
@@ -859,7 +697,7 @@ function getPendingApproval(runId) {
859
697
  }
860
698
  return {
861
699
  id: candidate.id,
862
- tool: "run_command",
700
+ tool,
863
701
  command: candidate.command,
864
702
  reason: candidate.reason,
865
703
  requestedAt: candidate.requestedAt,
@@ -871,51 +709,4 @@ function getPendingApproval(runId) {
871
709
  : "full-auto",
872
710
  };
873
711
  }
874
- function resolveInsideCwd(cwd, value) {
875
- if (!value.trim())
876
- return null;
877
- const resolved = path.resolve(cwd, value);
878
- const relative = path.relative(cwd, resolved);
879
- if (relative.startsWith("..") || path.isAbsolute(relative))
880
- return null;
881
- return resolved;
882
- }
883
- async function runCommand(command, cwd, timeoutMs, stdin) {
884
- const child = spawn(command, {
885
- cwd,
886
- shell: true,
887
- stdio: ["pipe", "pipe", "pipe"],
888
- });
889
- let stdout = "";
890
- let stderr = "";
891
- let timedOut = false;
892
- const timer = setTimeout(() => {
893
- timedOut = true;
894
- child.kill("SIGTERM");
895
- }, timeoutMs);
896
- child.stdout?.on("data", (chunk) => {
897
- stdout += chunk.toString();
898
- });
899
- child.stderr?.on("data", (chunk) => {
900
- stderr += chunk.toString();
901
- });
902
- if (stdin)
903
- child.stdin?.end(stdin);
904
- else
905
- child.stdin?.end();
906
- const [code] = (await once(child, "exit"));
907
- clearTimeout(timer);
908
- return { code, stdout, stderr, timedOut };
909
- }
910
- function stringArg(value) {
911
- return typeof value === "string" ? value : "";
912
- }
913
- function shellQuote(value) {
914
- return `'${value.replaceAll("'", "'\\''")}'`;
915
- }
916
- function truncate(value, max) {
917
- if (value.length <= max)
918
- return value;
919
- return `${value.slice(0, max)}\n\n...[truncated ${value.length - max} chars]`;
920
- }
921
712
  //# sourceMappingURL=code-agent-executor.js.map