@corbat-tech/coco 2.21.0 → 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_output_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
  }
@@ -11149,9 +11152,7 @@ function renderFileBlock(file, opts) {
11149
11152
  content = wordHighlights.get(delIdx).styledAdd;
11150
11153
  } else {
11151
11154
  content = line.content;
11152
- }
11153
- if (lang) {
11154
- content = highlightLine(content, lang);
11155
+ if (lang) content = highlightLine(content, lang);
11155
11156
  }
11156
11157
  const lineStr = `${lineNo}${prefix} ${content}`;
11157
11158
  console.log(bgAddLine(lineStr));
@@ -11162,9 +11163,7 @@ function renderFileBlock(file, opts) {
11162
11163
  content = wordHighlights.get(li).styledDelete;
11163
11164
  } else {
11164
11165
  content = line.content;
11165
- }
11166
- if (lang) {
11167
- content = highlightLine(content, lang);
11166
+ if (lang) content = highlightLine(content, lang);
11168
11167
  }
11169
11168
  const lineStr = `${lineNo}${prefix} ${content}`;
11170
11169
  console.log(bgDeleteLine(lineStr));
@@ -47597,6 +47596,7 @@ var TOOL_ICONS = {
47597
47596
  grep: "\u{1F50D}",
47598
47597
  bash_exec: "\u26A1",
47599
47598
  web_search: "\u{1F310}",
47599
+ web_fetch: "\u{1F310}",
47600
47600
  git_status: "\u{1F4CA}",
47601
47601
  git_commit: "\u{1F4BE}",
47602
47602
  git_push: "\u2B06\uFE0F",
@@ -47605,6 +47605,30 @@ var TOOL_ICONS = {
47605
47605
  run_linter: "\u{1F50E}",
47606
47606
  default: "\u{1F527}"
47607
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
+ };
47608
47632
  function getToolIcon(toolName, input) {
47609
47633
  if (toolName === "write_file" && input) {
47610
47634
  const wouldCreate = input.wouldCreate === true;
@@ -47629,8 +47653,9 @@ ${icon} ${chalk2.yellow.bold("EDIT")} ${chalk2.cyan(String(input.path || ""))}`)
47629
47653
  printEditDiff(String(input.oldText || ""), String(input.newText || ""));
47630
47654
  return;
47631
47655
  }
47656
+ const verb = TOOL_VERBS[toolName] ?? toolName.replace(/_/g, " ");
47632
47657
  console.log(`
47633
- ${icon} ${chalk2.cyan.bold(toolName)} ${chalk2.dim(summary)}`);
47658
+ ${icon} ${chalk2.bold(verb)} ${chalk2.dim(summary)}`);
47634
47659
  }
47635
47660
  function renderContentPreview(content, maxLines) {
47636
47661
  const maxWidth = Math.max(getTerminalWidth2() - 6, 40);
@@ -47826,10 +47851,29 @@ function formatToolSummary(toolName, input) {
47826
47851
  const max = Math.max(getTerminalWidth2() - 20, 50);
47827
47852
  return cmd.length > max ? cmd.slice(0, max - 1) + "\u2026" : cmd;
47828
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
+ }
47829
47861
  default:
47830
47862
  return formatToolInput(input);
47831
47863
  }
47832
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
+ }
47833
47877
  function formatResultPreview(result) {
47834
47878
  if (!result.result.success) return "";
47835
47879
  const { name, result: toolResult } = result;
@@ -47894,14 +47938,14 @@ function formatResultDetails(result) {
47894
47938
  const stdout = String(data.stdout || "").trimEnd();
47895
47939
  if (!stdout) return "";
47896
47940
  const outputLines = stdout.split("\n").filter((l) => l.trim());
47897
- if (outputLines.length > 6) return "";
47898
- const shown = outputLines.slice(0, 4);
47941
+ if (outputLines.length > 3) return "";
47942
+ const shown = outputLines.slice(0, 3);
47899
47943
  const lines = shown.map((l) => {
47900
47944
  const truncated = l.length > maxWidth ? l.slice(0, maxWidth - 1) + "\u2026" : l;
47901
47945
  return ` ${chalk2.dim("\u2502")} ${chalk2.dim(truncated)}`;
47902
47946
  });
47903
- if (outputLines.length > 4) {
47904
- 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`)}`);
47905
47949
  }
47906
47950
  return lines.join("\n");
47907
47951
  }