@hasna/oldpal 0.3.4 → 0.3.6

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
@@ -31353,12 +31353,20 @@ function Messages4({
31353
31353
  const endIndex = messages.length - scrollOffset;
31354
31354
  const startIndex = Math.max(0, endIndex - maxVisible);
31355
31355
  const visibleMessages = messages.slice(startIndex, endIndex);
31356
+ const groupedMessages = groupConsecutiveToolMessages(visibleMessages);
31356
31357
  return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
31357
31358
  flexDirection: "column",
31358
31359
  children: [
31359
- visibleMessages.map((message) => /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(MessageBubble, {
31360
- message
31361
- }, message.id, false, undefined, this)),
31360
+ groupedMessages.map((group) => {
31361
+ if (group.type === "single") {
31362
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(MessageBubble, {
31363
+ message: group.message
31364
+ }, group.message.id, false, undefined, this);
31365
+ }
31366
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(CombinedToolMessage, {
31367
+ messages: group.messages
31368
+ }, group.messages[0].id, false, undefined, this);
31369
+ }),
31362
31370
  activityLog.map((entry) => {
31363
31371
  if (entry.type === "text" && entry.content) {
31364
31372
  return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
@@ -31397,6 +31405,56 @@ function Messages4({
31397
31405
  ]
31398
31406
  }, undefined, true, undefined, this);
31399
31407
  }
31408
+ function groupConsecutiveToolMessages(messages) {
31409
+ const groups = [];
31410
+ let currentToolGroup = [];
31411
+ for (const msg of messages) {
31412
+ const isToolOnlyAssistant = msg.role === "assistant" && (!msg.content || !msg.content.trim()) && msg.toolCalls && msg.toolCalls.length > 0;
31413
+ if (isToolOnlyAssistant) {
31414
+ currentToolGroup.push(msg);
31415
+ } else {
31416
+ if (currentToolGroup.length > 0) {
31417
+ if (currentToolGroup.length === 1) {
31418
+ groups.push({ type: "single", message: currentToolGroup[0] });
31419
+ } else {
31420
+ groups.push({ type: "grouped", messages: currentToolGroup });
31421
+ }
31422
+ currentToolGroup = [];
31423
+ }
31424
+ groups.push({ type: "single", message: msg });
31425
+ }
31426
+ }
31427
+ if (currentToolGroup.length > 0) {
31428
+ if (currentToolGroup.length === 1) {
31429
+ groups.push({ type: "single", message: currentToolGroup[0] });
31430
+ } else {
31431
+ groups.push({ type: "grouped", messages: currentToolGroup });
31432
+ }
31433
+ }
31434
+ return groups;
31435
+ }
31436
+ function CombinedToolMessage({ messages }) {
31437
+ const allToolCalls = [];
31438
+ for (const msg of messages) {
31439
+ if (msg.toolCalls) {
31440
+ allToolCalls.push(...msg.toolCalls);
31441
+ }
31442
+ }
31443
+ const summary = getToolSummary(allToolCalls);
31444
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
31445
+ marginY: 1,
31446
+ children: [
31447
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
31448
+ dimColor: true,
31449
+ children: "\u25CF "
31450
+ }, undefined, false, undefined, this),
31451
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
31452
+ dimColor: true,
31453
+ children: summary
31454
+ }, undefined, false, undefined, this)
31455
+ ]
31456
+ }, undefined, true, undefined, this);
31457
+ }
31400
31458
  function MessageBubble({ message }) {
31401
31459
  const isUser = message.role === "user";
31402
31460
  const isSystem = message.role === "system";
@@ -31591,41 +31649,17 @@ function Status({ isProcessing, cwd: cwd2, queueLength = 0, tokenUsage }) {
31591
31649
  }
31592
31650
  return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
31593
31651
  marginTop: 1,
31594
- borderStyle: "single",
31595
- borderColor: "gray",
31596
- paddingX: 1,
31597
- justifyContent: "space-between",
31598
- children: [
31599
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31600
- dimColor: true,
31601
- children: displayCwd
31602
- }, undefined, false, undefined, this),
31603
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
31604
- children: [
31605
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31606
- dimColor: !isProcessing,
31607
- children: isProcessing ? "\u25CF processing" : "\u25CF ready"
31608
- }, undefined, false, undefined, this),
31609
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31610
- dimColor: true,
31611
- children: tokenInfo
31612
- }, undefined, false, undefined, this),
31613
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31614
- dimColor: true,
31615
- children: queueInfo
31616
- }, undefined, false, undefined, this),
31617
- /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31618
- dimColor: true,
31619
- children: [
31620
- " | ",
31621
- isProcessing ? "Esc to stop" : "Ctrl+C to exit",
31622
- " | /help"
31623
- ]
31624
- }, undefined, true, undefined, this)
31625
- ]
31626
- }, undefined, true, undefined, this)
31627
- ]
31628
- }, undefined, true, undefined, this);
31652
+ children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
31653
+ dimColor: true,
31654
+ children: [
31655
+ displayCwd,
31656
+ tokenInfo,
31657
+ queueInfo,
31658
+ isProcessing && " | Esc to stop",
31659
+ " | Ctrl+C to exit | /help"
31660
+ ]
31661
+ }, undefined, true, undefined, this)
31662
+ }, undefined, false, undefined, this);
31629
31663
  }
31630
31664
 
31631
31665
  // node_modules/.pnpm/ink-spinner@5.0.0_ink@5.2.1_@types+react@18.3.27_react-devtools-core@4.28.5_react@18.3.1__react@18.3.1/node_modules/ink-spinner/build/index.js
@@ -32252,7 +32286,7 @@ var options = {
32252
32286
  help: args.includes("--help") || args.includes("-h")
32253
32287
  };
32254
32288
  if (options.version) {
32255
- console.log("oldpal v0.3.4");
32289
+ console.log("oldpal v0.3.6");
32256
32290
  process.exit(0);
32257
32291
  }
32258
32292
  if (options.help) {
@@ -32283,4 +32317,4 @@ waitUntilExit().then(() => {
32283
32317
  process.exit(0);
32284
32318
  });
32285
32319
 
32286
- //# debugId=61F669D73881A2A464756E2164756E21
32320
+ //# debugId=883DD49707B1DC4164756E2164756E21