@hasna/oldpal 0.3.3 → 0.3.4

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/index.js CHANGED
@@ -31462,21 +31462,48 @@ function MessageBubble({ message }) {
31462
31462
  function getToolSummary(toolCalls) {
31463
31463
  if (toolCalls.length === 0)
31464
31464
  return "";
31465
+ if (toolCalls.length === 1) {
31466
+ return `[${formatToolCall(toolCalls[0])}]`;
31467
+ }
31465
31468
  const toolGroups = {};
31466
31469
  for (const tc of toolCalls) {
31467
31470
  const name = getToolDisplayName(tc);
31468
- toolGroups[name] = (toolGroups[name] || 0) + 1;
31471
+ if (!toolGroups[name]) {
31472
+ toolGroups[name] = { count: 1, firstCall: tc };
31473
+ } else {
31474
+ toolGroups[name].count++;
31475
+ }
31469
31476
  }
31470
31477
  const parts = [];
31471
- for (const [name, count] of Object.entries(toolGroups)) {
31478
+ for (const [name, { count, firstCall }] of Object.entries(toolGroups)) {
31472
31479
  if (count > 1) {
31473
- parts.push(`${name} \xD7${count}`);
31480
+ const context = getToolContext(firstCall);
31481
+ parts.push(context ? `${name} \xD7${count} (${context}, ...)` : `${name} \xD7${count}`);
31474
31482
  } else {
31475
- parts.push(name);
31483
+ parts.push(formatToolCall(firstCall));
31476
31484
  }
31477
31485
  }
31478
31486
  return `[${parts.join(", ")}]`;
31479
31487
  }
31488
+ function getToolContext(toolCall) {
31489
+ const { name, input } = toolCall;
31490
+ switch (name) {
31491
+ case "bash":
31492
+ return truncate(String(input.command || ""), 20);
31493
+ case "read":
31494
+ const path = String(input.path || input.file_path || "");
31495
+ return path.split("/").pop() || "";
31496
+ case "write":
31497
+ const writePath = String(input.path || input.file_path || "");
31498
+ return writePath.split("/").pop() || "";
31499
+ case "glob":
31500
+ return truncate(String(input.pattern || ""), 20);
31501
+ case "grep":
31502
+ return truncate(String(input.pattern || ""), 20);
31503
+ default:
31504
+ return "";
31505
+ }
31506
+ }
31480
31507
  function getToolDisplayName(toolCall) {
31481
31508
  const { name, input } = toolCall;
31482
31509
  switch (name) {
@@ -31508,6 +31535,46 @@ function getToolDisplayName(toolCall) {
31508
31535
  return name;
31509
31536
  }
31510
31537
  }
31538
+ function formatToolCall(toolCall) {
31539
+ const { name, input } = toolCall;
31540
+ switch (name) {
31541
+ case "bash":
31542
+ return `Running: ${truncate(String(input.command || ""), 60)}`;
31543
+ case "curl":
31544
+ return `Fetching: ${truncate(String(input.url || ""), 60)}`;
31545
+ case "web_fetch":
31546
+ return `Fetching: ${truncate(String(input.url || ""), 60)}`;
31547
+ case "web_search":
31548
+ return `Searching: ${truncate(String(input.query || ""), 60)}`;
31549
+ case "read":
31550
+ return `Reading: ${truncate(String(input.path || input.file_path || ""), 60)}`;
31551
+ case "write":
31552
+ return `Writing: ${truncate(String(input.path || input.file_path || ""), 60)}`;
31553
+ case "glob":
31554
+ return `Finding: ${truncate(String(input.pattern || ""), 60)}`;
31555
+ case "grep":
31556
+ return `Searching: ${truncate(String(input.pattern || ""), 60)}`;
31557
+ case "notion":
31558
+ return `Notion: ${truncate(String(input.command || input.action || ""), 60)}`;
31559
+ case "gmail":
31560
+ return `Gmail: ${truncate(String(input.command || input.action || ""), 60)}`;
31561
+ case "googledrive":
31562
+ return `Drive: ${truncate(String(input.command || input.action || ""), 60)}`;
31563
+ case "googlecalendar":
31564
+ return `Calendar: ${truncate(String(input.command || input.action || ""), 60)}`;
31565
+ case "linear":
31566
+ return `Linear: ${truncate(String(input.command || input.action || ""), 60)}`;
31567
+ case "slack":
31568
+ return `Slack: ${truncate(String(input.command || input.action || ""), 60)}`;
31569
+ default:
31570
+ return `${name}: ${truncate(JSON.stringify(input), 50)}`;
31571
+ }
31572
+ }
31573
+ function truncate(text, maxLength) {
31574
+ if (text.length <= maxLength)
31575
+ return text;
31576
+ return text.slice(0, maxLength - 3) + "...";
31577
+ }
31511
31578
 
31512
31579
  // packages/terminal/src/components/Status.tsx
31513
31580
  var jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
@@ -31751,46 +31818,46 @@ function ToolCallRow({ entry }) {
31751
31818
  }, undefined, true, undefined, this),
31752
31819
  /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
31753
31820
  dimColor: true,
31754
- children: formatToolCall(toolCall)
31821
+ children: formatToolCall2(toolCall)
31755
31822
  }, undefined, false, undefined, this)
31756
31823
  ]
31757
31824
  }, undefined, true, undefined, this);
31758
31825
  }
31759
- function formatToolCall(toolCall) {
31826
+ function formatToolCall2(toolCall) {
31760
31827
  const { name, input } = toolCall;
31761
31828
  switch (name) {
31762
31829
  case "bash":
31763
- return `bash: ${truncate(String(input.command || ""), 50)}`;
31830
+ return `bash: ${truncate2(String(input.command || ""), 50)}`;
31764
31831
  case "curl":
31765
31832
  case "web_fetch":
31766
- return `fetch: ${truncate(String(input.url || ""), 50)}`;
31833
+ return `fetch: ${truncate2(String(input.url || ""), 50)}`;
31767
31834
  case "web_search":
31768
- return `search: ${truncate(String(input.query || ""), 50)}`;
31835
+ return `search: ${truncate2(String(input.query || ""), 50)}`;
31769
31836
  case "read":
31770
- return `read: ${truncate(String(input.path || input.file_path || ""), 50)}`;
31837
+ return `read: ${truncate2(String(input.path || input.file_path || ""), 50)}`;
31771
31838
  case "write":
31772
- return `write: ${truncate(String(input.path || input.file_path || ""), 50)}`;
31839
+ return `write: ${truncate2(String(input.path || input.file_path || ""), 50)}`;
31773
31840
  case "glob":
31774
- return `glob: ${truncate(String(input.pattern || ""), 50)}`;
31841
+ return `glob: ${truncate2(String(input.pattern || ""), 50)}`;
31775
31842
  case "grep":
31776
- return `grep: ${truncate(String(input.pattern || ""), 50)}`;
31843
+ return `grep: ${truncate2(String(input.pattern || ""), 50)}`;
31777
31844
  case "notion":
31778
- return `notion: ${truncate(String(input.command || input.action || ""), 50)}`;
31845
+ return `notion: ${truncate2(String(input.command || input.action || ""), 50)}`;
31779
31846
  case "gmail":
31780
- return `gmail: ${truncate(String(input.command || input.action || ""), 50)}`;
31847
+ return `gmail: ${truncate2(String(input.command || input.action || ""), 50)}`;
31781
31848
  case "googledrive":
31782
- return `drive: ${truncate(String(input.command || input.action || ""), 50)}`;
31849
+ return `drive: ${truncate2(String(input.command || input.action || ""), 50)}`;
31783
31850
  case "googlecalendar":
31784
- return `calendar: ${truncate(String(input.command || input.action || ""), 50)}`;
31851
+ return `calendar: ${truncate2(String(input.command || input.action || ""), 50)}`;
31785
31852
  case "linear":
31786
- return `linear: ${truncate(String(input.command || input.action || ""), 50)}`;
31853
+ return `linear: ${truncate2(String(input.command || input.action || ""), 50)}`;
31787
31854
  case "slack":
31788
- return `slack: ${truncate(String(input.command || input.action || ""), 50)}`;
31855
+ return `slack: ${truncate2(String(input.command || input.action || ""), 50)}`;
31789
31856
  default:
31790
- return `${name}: ${truncate(JSON.stringify(input), 40)}`;
31857
+ return `${name}: ${truncate2(JSON.stringify(input), 40)}`;
31791
31858
  }
31792
31859
  }
31793
- function truncate(text, maxLength) {
31860
+ function truncate2(text, maxLength) {
31794
31861
  if (text.length <= maxLength)
31795
31862
  return text;
31796
31863
  return text.slice(0, maxLength - 3) + "...";
@@ -32185,7 +32252,7 @@ var options = {
32185
32252
  help: args.includes("--help") || args.includes("-h")
32186
32253
  };
32187
32254
  if (options.version) {
32188
- console.log("oldpal v0.3.3");
32255
+ console.log("oldpal v0.3.4");
32189
32256
  process.exit(0);
32190
32257
  }
32191
32258
  if (options.help) {
@@ -32216,4 +32283,4 @@ waitUntilExit().then(() => {
32216
32283
  process.exit(0);
32217
32284
  });
32218
32285
 
32219
- //# debugId=2F63C3B99CA7C1AF64756E2164756E21
32286
+ //# debugId=61F669D73881A2A464756E2164756E21