agenthud 0.5.0 → 0.5.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/index.js +31 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -447,6 +447,21 @@ function ProjectPanel({
|
|
|
447
447
|
// src/ui/ClaudePanel.tsx
|
|
448
448
|
import { Box as Box4, Text as Text4 } from "ink";
|
|
449
449
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
450
|
+
function getActivityStyle(activity) {
|
|
451
|
+
if (activity.type === "user") {
|
|
452
|
+
return { color: "white", dimColor: false };
|
|
453
|
+
}
|
|
454
|
+
if (activity.type === "response") {
|
|
455
|
+
return { color: "green", dimColor: false };
|
|
456
|
+
}
|
|
457
|
+
if (activity.type === "tool") {
|
|
458
|
+
if (activity.label === "Bash") {
|
|
459
|
+
return { color: "gray", dimColor: false };
|
|
460
|
+
}
|
|
461
|
+
return { dimColor: true };
|
|
462
|
+
}
|
|
463
|
+
return { dimColor: true };
|
|
464
|
+
}
|
|
450
465
|
function formatCountdown3(seconds) {
|
|
451
466
|
if (seconds == null) return "";
|
|
452
467
|
const padded = String(seconds).padStart(2, " ");
|
|
@@ -471,19 +486,20 @@ function formatActivityTime(date) {
|
|
|
471
486
|
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
472
487
|
return `${hours}:${minutes}:${seconds}`;
|
|
473
488
|
}
|
|
474
|
-
function
|
|
489
|
+
function formatActivityParts(activity, maxWidth) {
|
|
475
490
|
const time = formatActivityTime(activity.timestamp);
|
|
476
491
|
const icon = activity.icon;
|
|
477
492
|
const label = activity.label;
|
|
478
493
|
const detail = activity.detail;
|
|
479
|
-
const
|
|
480
|
-
const
|
|
494
|
+
const timestamp = `[${time}] `;
|
|
495
|
+
const timestampWidth = timestamp.length;
|
|
481
496
|
const iconWidth = 2;
|
|
482
497
|
const labelWidth = label.length;
|
|
483
498
|
const separatorWidth = detail ? 2 : 0;
|
|
484
|
-
const
|
|
499
|
+
const contentPrefixWidth = iconWidth + 1 + labelWidth + separatorWidth;
|
|
500
|
+
const totalPrefixWidth = timestampWidth + contentPrefixWidth;
|
|
485
501
|
if (detail) {
|
|
486
|
-
const availableWidth = maxWidth -
|
|
502
|
+
const availableWidth = maxWidth - totalPrefixWidth;
|
|
487
503
|
let truncatedDetail = detail;
|
|
488
504
|
let detailDisplayWidth = getDisplayWidth(detail);
|
|
489
505
|
if (detailDisplayWidth > availableWidth) {
|
|
@@ -501,13 +517,13 @@ function formatActivityLine(activity, maxWidth) {
|
|
|
501
517
|
}
|
|
502
518
|
detailDisplayWidth = currentWidth;
|
|
503
519
|
}
|
|
504
|
-
const
|
|
505
|
-
const displayWidth2 =
|
|
506
|
-
return {
|
|
520
|
+
const content2 = `${icon} ${label}: ${truncatedDetail}`;
|
|
521
|
+
const displayWidth2 = totalPrefixWidth + detailDisplayWidth;
|
|
522
|
+
return { timestamp, content: content2, displayWidth: displayWidth2 };
|
|
507
523
|
}
|
|
508
|
-
const
|
|
509
|
-
const displayWidth =
|
|
510
|
-
return {
|
|
524
|
+
const content = `${icon} ${label}`;
|
|
525
|
+
const displayWidth = totalPrefixWidth;
|
|
526
|
+
return { timestamp, content, displayWidth };
|
|
511
527
|
}
|
|
512
528
|
function ClaudePanel({
|
|
513
529
|
data,
|
|
@@ -569,13 +585,15 @@ function ClaudePanel({
|
|
|
569
585
|
const lines = [];
|
|
570
586
|
for (let i = 0; i < state.activities.length; i++) {
|
|
571
587
|
const activity = state.activities[i];
|
|
572
|
-
const {
|
|
588
|
+
const { timestamp, content, displayWidth } = formatActivityParts(activity, contentWidth);
|
|
573
589
|
const padding = Math.max(0, contentWidth - displayWidth);
|
|
590
|
+
const style = getActivityStyle(activity);
|
|
574
591
|
lines.push(
|
|
575
592
|
/* @__PURE__ */ jsxs4(Text4, { children: [
|
|
576
593
|
BOX.v,
|
|
577
594
|
" ",
|
|
578
|
-
|
|
595
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: timestamp }),
|
|
596
|
+
/* @__PURE__ */ jsx4(Text4, { color: style.color, dimColor: style.dimColor, children: content }),
|
|
579
597
|
" ".repeat(padding),
|
|
580
598
|
BOX.v
|
|
581
599
|
] }, `activity-${i}`)
|
package/package.json
CHANGED