@hasna/oldpal 0.3.5 → 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";
@@ -32228,7 +32286,7 @@ var options = {
32228
32286
  help: args.includes("--help") || args.includes("-h")
32229
32287
  };
32230
32288
  if (options.version) {
32231
- console.log("oldpal v0.3.5");
32289
+ console.log("oldpal v0.3.6");
32232
32290
  process.exit(0);
32233
32291
  }
32234
32292
  if (options.help) {
@@ -32259,4 +32317,4 @@ waitUntilExit().then(() => {
32259
32317
  process.exit(0);
32260
32318
  });
32261
32319
 
32262
- //# debugId=0403F5F696FDA15E64756E2164756E21
32320
+ //# debugId=883DD49707B1DC4164756E2164756E21