@corbat-tech/coco 2.21.1 → 2.22.0

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/cli/index.js CHANGED
@@ -4487,8 +4487,7 @@ var init_codex = __esm({
4487
4487
  model,
4488
4488
  input,
4489
4489
  instructions: instructions ?? "You are a helpful coding assistant.",
4490
- max_tokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
4491
- temperature: options?.temperature ?? this.config.temperature ?? 0,
4490
+ truncation: "auto",
4492
4491
  store: false,
4493
4492
  stream: true
4494
4493
  // Codex API requires streaming
@@ -10709,9 +10708,13 @@ var init_registry4 = __esm({
10709
10708
  }
10710
10709
  } else if (isCocoError(error)) {
10711
10710
  const causeMsg = error.cause instanceof Error ? error.cause.message : "";
10712
- const combined = causeMsg && !error.message.includes(causeMsg) ? `${error.message} \u2014 ${causeMsg}` : error.message;
10711
+ const isRawEnoent = causeMsg.startsWith("ENOENT:");
10712
+ const combined = causeMsg && !isRawEnoent && !error.message.includes(causeMsg) ? `${error.message} \u2014 ${causeMsg}` : error.message;
10713
10713
  errorMessage = humanizeError(combined, name);
10714
- if (error.suggestion && !errorMessage.includes(error.suggestion)) {
10714
+ const hasRecoveryHint = /Did you mean\?|Use glob|Check that the parent directory/.test(
10715
+ errorMessage
10716
+ );
10717
+ if (error.suggestion && !hasRecoveryHint && !errorMessage.includes(error.suggestion)) {
10715
10718
  errorMessage += `
10716
10719
  Suggestion: ${error.suggestion}`;
10717
10720
  }
@@ -47593,6 +47596,7 @@ var TOOL_ICONS = {
47593
47596
  grep: "\u{1F50D}",
47594
47597
  bash_exec: "\u26A1",
47595
47598
  web_search: "\u{1F310}",
47599
+ web_fetch: "\u{1F310}",
47596
47600
  git_status: "\u{1F4CA}",
47597
47601
  git_commit: "\u{1F4BE}",
47598
47602
  git_push: "\u2B06\uFE0F",
@@ -47601,6 +47605,30 @@ var TOOL_ICONS = {
47601
47605
  run_linter: "\u{1F50E}",
47602
47606
  default: "\u{1F527}"
47603
47607
  };
47608
+ var TOOL_VERBS = {
47609
+ read_file: "Read",
47610
+ delete_file: "Delete",
47611
+ list_directory: "List",
47612
+ list_dir: "List",
47613
+ grep: "Search",
47614
+ search_files: "Search",
47615
+ bash_exec: "Run",
47616
+ web_search: "Search",
47617
+ web_fetch: "Fetch",
47618
+ git_status: "Git status",
47619
+ git_commit: "Git commit",
47620
+ git_add: "Git add",
47621
+ git_push: "Git push",
47622
+ git_pull: "Git pull",
47623
+ git_diff: "Git diff",
47624
+ git_log: "Git log",
47625
+ git_branch: "Git branch",
47626
+ git_checkout: "Git checkout",
47627
+ git_init: "Git init",
47628
+ run_tests: "Test",
47629
+ run_linter: "Lint",
47630
+ run_script: "Run"
47631
+ };
47604
47632
  function getToolIcon(toolName, input) {
47605
47633
  if (toolName === "write_file" && input) {
47606
47634
  const wouldCreate = input.wouldCreate === true;
@@ -47625,8 +47653,9 @@ ${icon} ${chalk2.yellow.bold("EDIT")} ${chalk2.cyan(String(input.path || ""))}`)
47625
47653
  printEditDiff(String(input.oldText || ""), String(input.newText || ""));
47626
47654
  return;
47627
47655
  }
47656
+ const verb = TOOL_VERBS[toolName] ?? toolName.replace(/_/g, " ");
47628
47657
  console.log(`
47629
- ${icon} ${chalk2.cyan.bold(toolName)} ${chalk2.dim(summary)}`);
47658
+ ${icon} ${chalk2.bold(verb)} ${chalk2.dim(summary)}`);
47630
47659
  }
47631
47660
  function renderContentPreview(content, maxLines) {
47632
47661
  const maxWidth = Math.max(getTerminalWidth2() - 6, 40);
@@ -47822,10 +47851,29 @@ function formatToolSummary(toolName, input) {
47822
47851
  const max = Math.max(getTerminalWidth2() - 20, 50);
47823
47852
  return cmd.length > max ? cmd.slice(0, max - 1) + "\u2026" : cmd;
47824
47853
  }
47854
+ case "web_fetch": {
47855
+ const url = String(input.url || input.path || "");
47856
+ return formatUrl(url);
47857
+ }
47858
+ case "web_search": {
47859
+ return String(input.query || "");
47860
+ }
47825
47861
  default:
47826
47862
  return formatToolInput(input);
47827
47863
  }
47828
47864
  }
47865
+ function formatUrl(url) {
47866
+ try {
47867
+ const u = new URL(url);
47868
+ const path58 = u.pathname.replace(/\/$/, "");
47869
+ const display = path58 ? `${u.hostname} \u203A ${path58.slice(1)}` : u.hostname;
47870
+ const max = Math.max(getTerminalWidth2() - 20, 50);
47871
+ return display.length > max ? display.slice(0, max - 1) + "\u2026" : display;
47872
+ } catch {
47873
+ const max = Math.max(getTerminalWidth2() - 20, 50);
47874
+ return url.length > max ? url.slice(0, max - 1) + "\u2026" : url;
47875
+ }
47876
+ }
47829
47877
  function formatResultPreview(result) {
47830
47878
  if (!result.result.success) return "";
47831
47879
  const { name, result: toolResult } = result;
@@ -47890,14 +47938,14 @@ function formatResultDetails(result) {
47890
47938
  const stdout = String(data.stdout || "").trimEnd();
47891
47939
  if (!stdout) return "";
47892
47940
  const outputLines = stdout.split("\n").filter((l) => l.trim());
47893
- if (outputLines.length > 6) return "";
47894
- const shown = outputLines.slice(0, 4);
47941
+ if (outputLines.length > 3) return "";
47942
+ const shown = outputLines.slice(0, 3);
47895
47943
  const lines = shown.map((l) => {
47896
47944
  const truncated = l.length > maxWidth ? l.slice(0, maxWidth - 1) + "\u2026" : l;
47897
47945
  return ` ${chalk2.dim("\u2502")} ${chalk2.dim(truncated)}`;
47898
47946
  });
47899
- if (outputLines.length > 4) {
47900
- lines.push(` ${chalk2.dim(`\u2502 \u2026 +${outputLines.length - 4} more`)}`);
47947
+ if (outputLines.length > 3) {
47948
+ lines.push(` ${chalk2.dim(`\u2502 \u2026 +${outputLines.length - 3} more`)}`);
47901
47949
  }
47902
47950
  return lines.join("\n");
47903
47951
  }