@hyperwindmill/caretaker-cli 0.18.0 → 0.19.0
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.
|
@@ -14944,6 +14944,28 @@ ${text}</tr>
|
|
|
14944
14944
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "markdown-body", dangerouslySetInnerHTML: { __html: html2 } });
|
|
14945
14945
|
});
|
|
14946
14946
|
|
|
14947
|
+
// src/compactGroups.ts
|
|
14948
|
+
function groupCompactItems(items) {
|
|
14949
|
+
const groups = [];
|
|
14950
|
+
let i = 0;
|
|
14951
|
+
while (i < items.length) {
|
|
14952
|
+
const item = items[i];
|
|
14953
|
+
if (item.kind === "tool") {
|
|
14954
|
+
const start = i;
|
|
14955
|
+
const run = [];
|
|
14956
|
+
while (i < items.length && items[i].kind === "tool") {
|
|
14957
|
+
run.push(items[i]);
|
|
14958
|
+
i++;
|
|
14959
|
+
}
|
|
14960
|
+
groups.push({ kind: "tool-row", key: start, items: run });
|
|
14961
|
+
} else {
|
|
14962
|
+
groups.push({ kind: "single", key: i, item });
|
|
14963
|
+
i++;
|
|
14964
|
+
}
|
|
14965
|
+
}
|
|
14966
|
+
return groups;
|
|
14967
|
+
}
|
|
14968
|
+
|
|
14947
14969
|
// src/toolFormat.ts
|
|
14948
14970
|
var PATH_KEYS = ["path", "file_path", "filePath"];
|
|
14949
14971
|
function toolSummary(args, max = 80) {
|
|
@@ -14990,6 +15012,12 @@ ${text}</tr>
|
|
|
14990
15012
|
function truncate(s, max) {
|
|
14991
15013
|
return s.length > max ? `${s.slice(0, max)}\u2026` : s;
|
|
14992
15014
|
}
|
|
15015
|
+
function popoverPosition(rect, vw, vh, gap = 6, width = 480) {
|
|
15016
|
+
const maxWidth = Math.min(width, vw - 16);
|
|
15017
|
+
const left = Math.max(8, Math.min(rect.left, vw - 8 - maxWidth));
|
|
15018
|
+
const placeAbove = rect.top > vh * 0.6;
|
|
15019
|
+
return placeAbove ? { left, bottom: vh - rect.top + gap, maxWidth } : { left, top: rect.bottom + gap, maxWidth };
|
|
15020
|
+
}
|
|
14993
15021
|
|
|
14994
15022
|
// ../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.6/node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
14995
15023
|
var import_react3 = __toESM(require_react());
|
|
@@ -15351,7 +15379,8 @@ ${text}</tr>
|
|
|
15351
15379
|
sessionId = null,
|
|
15352
15380
|
trailing,
|
|
15353
15381
|
isStreaming,
|
|
15354
|
-
agentName
|
|
15382
|
+
agentName,
|
|
15383
|
+
compact = false
|
|
15355
15384
|
}) {
|
|
15356
15385
|
const containerRef = (0, import_react4.useRef)(null);
|
|
15357
15386
|
const prevItemsLengthRef = (0, import_react4.useRef)(items.length);
|
|
@@ -15376,7 +15405,9 @@ ${text}</tr>
|
|
|
15376
15405
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "messages messages--empty", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "Send a message to start." }) });
|
|
15377
15406
|
}
|
|
15378
15407
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: containerRef, className: "messages", onScroll, children: [
|
|
15379
|
-
|
|
15408
|
+
compact ? groupCompactItems(items).map(
|
|
15409
|
+
(g) => g.kind === "tool-row" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tool-bubble-row", children: g.items.map((item, j) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Item, { item, sessionId, compact }, g.key + j)) }, g.key) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Item, { item: g.item, sessionId, compact }, g.key)
|
|
15410
|
+
) : items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Item, { item, sessionId, compact }, i)),
|
|
15380
15411
|
trailing,
|
|
15381
15412
|
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "messages__loading-indicator", children: [
|
|
15382
15413
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { src: caretaker_cli_default, alt: "Loading", className: "messages__loading-logo" }),
|
|
@@ -15408,7 +15439,104 @@ ${text}</tr>
|
|
|
15408
15439
|
] })
|
|
15409
15440
|
] });
|
|
15410
15441
|
});
|
|
15411
|
-
var
|
|
15442
|
+
var ToolBubble = (0, import_react4.memo)(function ToolBubble2({ item }) {
|
|
15443
|
+
const chipRef = (0, import_react4.useRef)(null);
|
|
15444
|
+
const popoverRef = (0, import_react4.useRef)(null);
|
|
15445
|
+
const [hovering, setHovering] = (0, import_react4.useState)(false);
|
|
15446
|
+
const [pinned, setPinned] = (0, import_react4.useState)(false);
|
|
15447
|
+
const [rect, setRect] = (0, import_react4.useState)(null);
|
|
15448
|
+
const summary = toolSummary(item.args);
|
|
15449
|
+
const fullArgs = prettyArgs(item.args);
|
|
15450
|
+
const hasResult = item.result !== null && item.result !== "";
|
|
15451
|
+
const hasDetail = Boolean(fullArgs) || hasResult;
|
|
15452
|
+
const open = hasDetail && (hovering || pinned);
|
|
15453
|
+
(0, import_react4.useEffect)(() => {
|
|
15454
|
+
if (!open) return;
|
|
15455
|
+
const measure = () => {
|
|
15456
|
+
if (chipRef.current) setRect(chipRef.current.getBoundingClientRect());
|
|
15457
|
+
};
|
|
15458
|
+
measure();
|
|
15459
|
+
const onKey = (e) => {
|
|
15460
|
+
if (e.key === "Escape") {
|
|
15461
|
+
setPinned(false);
|
|
15462
|
+
setHovering(false);
|
|
15463
|
+
}
|
|
15464
|
+
};
|
|
15465
|
+
window.addEventListener("scroll", measure, true);
|
|
15466
|
+
window.addEventListener("resize", measure);
|
|
15467
|
+
window.addEventListener("keydown", onKey);
|
|
15468
|
+
return () => {
|
|
15469
|
+
window.removeEventListener("scroll", measure, true);
|
|
15470
|
+
window.removeEventListener("resize", measure);
|
|
15471
|
+
window.removeEventListener("keydown", onKey);
|
|
15472
|
+
};
|
|
15473
|
+
}, [open]);
|
|
15474
|
+
(0, import_react4.useEffect)(() => {
|
|
15475
|
+
if (!pinned) return;
|
|
15476
|
+
const onDown = (e) => {
|
|
15477
|
+
const t = e.target;
|
|
15478
|
+
if (chipRef.current?.contains(t) || popoverRef.current?.contains(t)) return;
|
|
15479
|
+
setPinned(false);
|
|
15480
|
+
};
|
|
15481
|
+
document.addEventListener("mousedown", onDown, true);
|
|
15482
|
+
return () => document.removeEventListener("mousedown", onDown, true);
|
|
15483
|
+
}, [pinned]);
|
|
15484
|
+
const pos = open && rect ? popoverPosition(rect, window.innerWidth, window.innerHeight) : null;
|
|
15485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "tool-bubble-wrap", children: [
|
|
15486
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
15487
|
+
"div",
|
|
15488
|
+
{
|
|
15489
|
+
ref: chipRef,
|
|
15490
|
+
className: `tool-bubble${open ? " tool-bubble--open" : ""}`,
|
|
15491
|
+
tabIndex: hasDetail ? 0 : -1,
|
|
15492
|
+
role: hasDetail ? "button" : void 0,
|
|
15493
|
+
"aria-expanded": hasDetail ? open : void 0,
|
|
15494
|
+
onMouseEnter: () => setHovering(true),
|
|
15495
|
+
onMouseLeave: () => setHovering(false),
|
|
15496
|
+
onFocus: () => setHovering(true),
|
|
15497
|
+
onBlur: () => setHovering(false),
|
|
15498
|
+
onClick: () => hasDetail && setPinned((p) => !p),
|
|
15499
|
+
onKeyDown: (e) => {
|
|
15500
|
+
if (hasDetail && (e.key === "Enter" || e.key === " ")) {
|
|
15501
|
+
e.preventDefault();
|
|
15502
|
+
setPinned((p) => !p);
|
|
15503
|
+
}
|
|
15504
|
+
},
|
|
15505
|
+
children: [
|
|
15506
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool-bubble__icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Wrench, { size: 12 }) }),
|
|
15507
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool-bubble__name", children: item.name }),
|
|
15508
|
+
summary && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool-bubble__summary", children: summary }),
|
|
15509
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tool-bubble__status", children: item.result === null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoaderCircle, { className: "tool__spinner", size: 12 }) : hasResult ? resultMetric(item.result) : null })
|
|
15510
|
+
]
|
|
15511
|
+
}
|
|
15512
|
+
),
|
|
15513
|
+
pos && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
15514
|
+
"div",
|
|
15515
|
+
{
|
|
15516
|
+
ref: popoverRef,
|
|
15517
|
+
className: `tool-bubble__popover${pinned ? " tool-bubble__popover--pinned" : ""}`,
|
|
15518
|
+
role: "tooltip",
|
|
15519
|
+
style: {
|
|
15520
|
+
position: "fixed",
|
|
15521
|
+
left: pos.left,
|
|
15522
|
+
top: pos.top,
|
|
15523
|
+
bottom: pos.bottom,
|
|
15524
|
+
maxWidth: pos.maxWidth,
|
|
15525
|
+
pointerEvents: pinned ? "auto" : "none"
|
|
15526
|
+
},
|
|
15527
|
+
children: [
|
|
15528
|
+
fullArgs && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "tool-bubble__args", children: fullArgs }),
|
|
15529
|
+
hasResult && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tool-bubble__result", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.result }) })
|
|
15530
|
+
]
|
|
15531
|
+
}
|
|
15532
|
+
)
|
|
15533
|
+
] });
|
|
15534
|
+
});
|
|
15535
|
+
var Item = (0, import_react4.memo)(function Item2({
|
|
15536
|
+
item,
|
|
15537
|
+
sessionId,
|
|
15538
|
+
compact
|
|
15539
|
+
}) {
|
|
15412
15540
|
switch (item.kind) {
|
|
15413
15541
|
case "user":
|
|
15414
15542
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "bubble bubble--user", children: [
|
|
@@ -15469,7 +15597,7 @@ ${text}</tr>
|
|
|
15469
15597
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "thinking__content", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.text, cache: false }) })
|
|
15470
15598
|
] });
|
|
15471
15599
|
case "tool":
|
|
15472
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ToolBlock, { item });
|
|
15600
|
+
return compact ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ToolBubble, { item }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ToolBlock, { item });
|
|
15473
15601
|
case "notice":
|
|
15474
15602
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `notice${item.variant === "block" ? " notice--block" : ""}`, children: [
|
|
15475
15603
|
item.variant === "block" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TriangleAlert, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Settings, { size: 12 }),
|
|
@@ -15480,6 +15608,13 @@ ${text}</tr>
|
|
|
15480
15608
|
|
|
15481
15609
|
// src/Composer.tsx
|
|
15482
15610
|
var import_react5 = __toESM(require_react(), 1);
|
|
15611
|
+
|
|
15612
|
+
// src/composer_utils.ts
|
|
15613
|
+
function shouldFocusComposer(prevDisabled, disabled, documentHasFocus) {
|
|
15614
|
+
return prevDisabled && !disabled && documentHasFocus;
|
|
15615
|
+
}
|
|
15616
|
+
|
|
15617
|
+
// src/Composer.tsx
|
|
15483
15618
|
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
15484
15619
|
function Composer({
|
|
15485
15620
|
disabled,
|
|
@@ -15508,6 +15643,14 @@ ${text}</tr>
|
|
|
15508
15643
|
const [isDragging, setIsDragging] = (0, import_react5.useState)(false);
|
|
15509
15644
|
const fileInputRef = (0, import_react5.useRef)(null);
|
|
15510
15645
|
const dragCounter = (0, import_react5.useRef)(0);
|
|
15646
|
+
const inputRef = (0, import_react5.useRef)(null);
|
|
15647
|
+
const prevDisabled = (0, import_react5.useRef)(true);
|
|
15648
|
+
(0, import_react5.useEffect)(() => {
|
|
15649
|
+
if (shouldFocusComposer(prevDisabled.current, disabled, document.hasFocus())) {
|
|
15650
|
+
inputRef.current?.focus();
|
|
15651
|
+
}
|
|
15652
|
+
prevDisabled.current = disabled;
|
|
15653
|
+
}, [disabled]);
|
|
15511
15654
|
const send = () => {
|
|
15512
15655
|
onSend(value, attachments.length > 0 ? attachments : void 0);
|
|
15513
15656
|
setValue("");
|
|
@@ -15608,6 +15751,7 @@ ${text}</tr>
|
|
|
15608
15751
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
15609
15752
|
"textarea",
|
|
15610
15753
|
{
|
|
15754
|
+
ref: inputRef,
|
|
15611
15755
|
className: "composer__input",
|
|
15612
15756
|
value,
|
|
15613
15757
|
placeholder: "Message Caretaker (Drop/paste files/images)...",
|
|
@@ -20444,7 +20588,7 @@ ${msg.content}`, streaming: false, label: msg.agentLabel || labels?.reviewer });
|
|
|
20444
20588
|
}
|
|
20445
20589
|
),
|
|
20446
20590
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
|
|
20447
|
-
taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageList, { items: chatItems, sessionId: null }),
|
|
20591
|
+
taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageList, { items: chatItems, sessionId: null, compact: true }),
|
|
20448
20592
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("form", { className: "composer", onSubmit: onSend, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", gap: "8px", alignItems: "flex-end" }, children: [
|
|
20449
20593
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
20450
20594
|
"textarea",
|