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