@hasna/oldpal 0.3.2 → 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 +167 -44
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31417,41 +31417,164 @@ function MessageBubble({ message }) {
|
|
|
31417
31417
|
]
|
|
31418
31418
|
}, undefined, true, undefined, this);
|
|
31419
31419
|
}
|
|
31420
|
-
const
|
|
31420
|
+
const toolSummary = message.toolCalls ? getToolSummary(message.toolCalls) : "";
|
|
31421
|
+
const hasContent = message.content && message.content.trim();
|
|
31422
|
+
if (!hasContent && toolSummary) {
|
|
31423
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
31424
|
+
marginY: 1,
|
|
31425
|
+
children: [
|
|
31426
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
31427
|
+
dimColor: true,
|
|
31428
|
+
children: "\u25CF "
|
|
31429
|
+
}, undefined, false, undefined, this),
|
|
31430
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
31431
|
+
dimColor: true,
|
|
31432
|
+
children: toolSummary
|
|
31433
|
+
}, undefined, false, undefined, this)
|
|
31434
|
+
]
|
|
31435
|
+
}, undefined, true, undefined, this);
|
|
31436
|
+
}
|
|
31421
31437
|
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
31422
31438
|
marginY: 1,
|
|
31423
|
-
flexDirection: "column",
|
|
31424
31439
|
children: [
|
|
31440
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
31441
|
+
dimColor: true,
|
|
31442
|
+
children: "\u25CF "
|
|
31443
|
+
}, undefined, false, undefined, this),
|
|
31425
31444
|
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
31445
|
+
flexGrow: 1,
|
|
31426
31446
|
children: [
|
|
31427
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(
|
|
31428
|
-
|
|
31429
|
-
children: "\u25CF "
|
|
31447
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Markdown, {
|
|
31448
|
+
content: message.content
|
|
31430
31449
|
}, undefined, false, undefined, this),
|
|
31431
|
-
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(
|
|
31432
|
-
|
|
31433
|
-
children:
|
|
31434
|
-
|
|
31435
|
-
|
|
31436
|
-
|
|
31450
|
+
toolSummary && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
31451
|
+
dimColor: true,
|
|
31452
|
+
children: [
|
|
31453
|
+
" ",
|
|
31454
|
+
toolSummary
|
|
31455
|
+
]
|
|
31456
|
+
}, undefined, true, undefined, this)
|
|
31437
31457
|
]
|
|
31438
|
-
}, undefined, true, undefined, this)
|
|
31439
|
-
toolCount > 0 && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
31440
|
-
marginLeft: 2,
|
|
31441
|
-
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
|
|
31442
|
-
dimColor: true,
|
|
31443
|
-
children: [
|
|
31444
|
-
"[",
|
|
31445
|
-
toolCount,
|
|
31446
|
-
" tool",
|
|
31447
|
-
toolCount > 1 ? "s" : "",
|
|
31448
|
-
" used]"
|
|
31449
|
-
]
|
|
31450
|
-
}, undefined, true, undefined, this)
|
|
31451
|
-
}, undefined, false, undefined, this)
|
|
31458
|
+
}, undefined, true, undefined, this)
|
|
31452
31459
|
]
|
|
31453
31460
|
}, undefined, true, undefined, this);
|
|
31454
31461
|
}
|
|
31462
|
+
function getToolSummary(toolCalls) {
|
|
31463
|
+
if (toolCalls.length === 0)
|
|
31464
|
+
return "";
|
|
31465
|
+
if (toolCalls.length === 1) {
|
|
31466
|
+
return `[${formatToolCall(toolCalls[0])}]`;
|
|
31467
|
+
}
|
|
31468
|
+
const toolGroups = {};
|
|
31469
|
+
for (const tc of toolCalls) {
|
|
31470
|
+
const name = getToolDisplayName(tc);
|
|
31471
|
+
if (!toolGroups[name]) {
|
|
31472
|
+
toolGroups[name] = { count: 1, firstCall: tc };
|
|
31473
|
+
} else {
|
|
31474
|
+
toolGroups[name].count++;
|
|
31475
|
+
}
|
|
31476
|
+
}
|
|
31477
|
+
const parts = [];
|
|
31478
|
+
for (const [name, { count, firstCall }] of Object.entries(toolGroups)) {
|
|
31479
|
+
if (count > 1) {
|
|
31480
|
+
const context = getToolContext(firstCall);
|
|
31481
|
+
parts.push(context ? `${name} \xD7${count} (${context}, ...)` : `${name} \xD7${count}`);
|
|
31482
|
+
} else {
|
|
31483
|
+
parts.push(formatToolCall(firstCall));
|
|
31484
|
+
}
|
|
31485
|
+
}
|
|
31486
|
+
return `[${parts.join(", ")}]`;
|
|
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
|
+
}
|
|
31507
|
+
function getToolDisplayName(toolCall) {
|
|
31508
|
+
const { name, input } = toolCall;
|
|
31509
|
+
switch (name) {
|
|
31510
|
+
case "bash":
|
|
31511
|
+
return "bash";
|
|
31512
|
+
case "curl":
|
|
31513
|
+
case "web_fetch":
|
|
31514
|
+
return "fetch";
|
|
31515
|
+
case "web_search":
|
|
31516
|
+
return "search";
|
|
31517
|
+
case "read":
|
|
31518
|
+
return "read";
|
|
31519
|
+
case "write":
|
|
31520
|
+
return "write";
|
|
31521
|
+
case "glob":
|
|
31522
|
+
return "glob";
|
|
31523
|
+
case "grep":
|
|
31524
|
+
return "grep";
|
|
31525
|
+
case "display_image":
|
|
31526
|
+
return "image";
|
|
31527
|
+
case "notion":
|
|
31528
|
+
case "gmail":
|
|
31529
|
+
case "googledrive":
|
|
31530
|
+
case "googlecalendar":
|
|
31531
|
+
case "linear":
|
|
31532
|
+
case "slack":
|
|
31533
|
+
return name;
|
|
31534
|
+
default:
|
|
31535
|
+
return name;
|
|
31536
|
+
}
|
|
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
|
+
}
|
|
31455
31578
|
|
|
31456
31579
|
// packages/terminal/src/components/Status.tsx
|
|
31457
31580
|
var jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -31695,46 +31818,46 @@ function ToolCallRow({ entry }) {
|
|
|
31695
31818
|
}, undefined, true, undefined, this),
|
|
31696
31819
|
/* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
|
|
31697
31820
|
dimColor: true,
|
|
31698
|
-
children:
|
|
31821
|
+
children: formatToolCall2(toolCall)
|
|
31699
31822
|
}, undefined, false, undefined, this)
|
|
31700
31823
|
]
|
|
31701
31824
|
}, undefined, true, undefined, this);
|
|
31702
31825
|
}
|
|
31703
|
-
function
|
|
31826
|
+
function formatToolCall2(toolCall) {
|
|
31704
31827
|
const { name, input } = toolCall;
|
|
31705
31828
|
switch (name) {
|
|
31706
31829
|
case "bash":
|
|
31707
|
-
return `bash: ${
|
|
31830
|
+
return `bash: ${truncate2(String(input.command || ""), 50)}`;
|
|
31708
31831
|
case "curl":
|
|
31709
31832
|
case "web_fetch":
|
|
31710
|
-
return `fetch: ${
|
|
31833
|
+
return `fetch: ${truncate2(String(input.url || ""), 50)}`;
|
|
31711
31834
|
case "web_search":
|
|
31712
|
-
return `search: ${
|
|
31835
|
+
return `search: ${truncate2(String(input.query || ""), 50)}`;
|
|
31713
31836
|
case "read":
|
|
31714
|
-
return `read: ${
|
|
31837
|
+
return `read: ${truncate2(String(input.path || input.file_path || ""), 50)}`;
|
|
31715
31838
|
case "write":
|
|
31716
|
-
return `write: ${
|
|
31839
|
+
return `write: ${truncate2(String(input.path || input.file_path || ""), 50)}`;
|
|
31717
31840
|
case "glob":
|
|
31718
|
-
return `glob: ${
|
|
31841
|
+
return `glob: ${truncate2(String(input.pattern || ""), 50)}`;
|
|
31719
31842
|
case "grep":
|
|
31720
|
-
return `grep: ${
|
|
31843
|
+
return `grep: ${truncate2(String(input.pattern || ""), 50)}`;
|
|
31721
31844
|
case "notion":
|
|
31722
|
-
return `notion: ${
|
|
31845
|
+
return `notion: ${truncate2(String(input.command || input.action || ""), 50)}`;
|
|
31723
31846
|
case "gmail":
|
|
31724
|
-
return `gmail: ${
|
|
31847
|
+
return `gmail: ${truncate2(String(input.command || input.action || ""), 50)}`;
|
|
31725
31848
|
case "googledrive":
|
|
31726
|
-
return `drive: ${
|
|
31849
|
+
return `drive: ${truncate2(String(input.command || input.action || ""), 50)}`;
|
|
31727
31850
|
case "googlecalendar":
|
|
31728
|
-
return `calendar: ${
|
|
31851
|
+
return `calendar: ${truncate2(String(input.command || input.action || ""), 50)}`;
|
|
31729
31852
|
case "linear":
|
|
31730
|
-
return `linear: ${
|
|
31853
|
+
return `linear: ${truncate2(String(input.command || input.action || ""), 50)}`;
|
|
31731
31854
|
case "slack":
|
|
31732
|
-
return `slack: ${
|
|
31855
|
+
return `slack: ${truncate2(String(input.command || input.action || ""), 50)}`;
|
|
31733
31856
|
default:
|
|
31734
|
-
return `${name}: ${
|
|
31857
|
+
return `${name}: ${truncate2(JSON.stringify(input), 40)}`;
|
|
31735
31858
|
}
|
|
31736
31859
|
}
|
|
31737
|
-
function
|
|
31860
|
+
function truncate2(text, maxLength) {
|
|
31738
31861
|
if (text.length <= maxLength)
|
|
31739
31862
|
return text;
|
|
31740
31863
|
return text.slice(0, maxLength - 3) + "...";
|
|
@@ -32129,7 +32252,7 @@ var options = {
|
|
|
32129
32252
|
help: args.includes("--help") || args.includes("-h")
|
|
32130
32253
|
};
|
|
32131
32254
|
if (options.version) {
|
|
32132
|
-
console.log("oldpal v0.3.
|
|
32255
|
+
console.log("oldpal v0.3.4");
|
|
32133
32256
|
process.exit(0);
|
|
32134
32257
|
}
|
|
32135
32258
|
if (options.help) {
|
|
@@ -32160,4 +32283,4 @@ waitUntilExit().then(() => {
|
|
|
32160
32283
|
process.exit(0);
|
|
32161
32284
|
});
|
|
32162
32285
|
|
|
32163
|
-
//# debugId=
|
|
32286
|
+
//# debugId=61F669D73881A2A464756E2164756E21
|