@opengeni/react 0.42.1 → 0.44.2
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/{chunk-SJKT4TKW.js → chunk-23EJ676W.js} +3 -1
- package/dist/chunk-23EJ676W.js.map +1 -0
- package/dist/{chunk-Q2NCKWTK.js → chunk-HFO4ERGQ.js} +51 -4
- package/dist/chunk-HFO4ERGQ.js.map +1 -0
- package/dist/{chunk-4IJCL7YO.js → chunk-LWR4MXSS.js} +4 -1
- package/dist/chunk-LWR4MXSS.js.map +1 -0
- package/dist/{chunk-UWYTCQWW.js → chunk-QQRM3DO3.js} +93 -22
- package/dist/{chunk-UWYTCQWW.js.map → chunk-QQRM3DO3.js.map} +1 -1
- package/dist/{chunk-JALF5FI3.js → chunk-SRFUT2ZU.js} +2 -2
- package/dist/{chunk-WZT5G5OR.js → chunk-U6K24XQD.js} +5 -4
- package/dist/{chunk-WZT5G5OR.js.map → chunk-U6K24XQD.js.map} +1 -1
- package/dist/{chunk-KR2SK5GJ.js → chunk-YNYIAYXQ.js} +427 -94
- package/dist/chunk-YNYIAYXQ.js.map +1 -0
- package/dist/components/chat-composer.d.ts +5 -1
- package/dist/components/composer-transcription-control.d.ts +3 -1
- package/dist/components/composer.d.ts +6 -4
- package/dist/components/session-chrome.d.ts +1 -1
- package/dist/composer.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +70 -21
- package/dist/index.js.map +1 -1
- package/dist/model-policy.d.ts +2 -0
- package/dist/model-policy.js +1 -1
- package/dist/realtime/realtime-control.d.ts +29 -1
- package/dist/realtime.d.ts +1 -1
- package/dist/realtime.js +269 -151
- package/dist/realtime.js.map +1 -1
- package/dist/session-ui.js +2 -2
- package/dist/session.js +3 -3
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/parsers.d.ts +13 -8
- package/package.json +2 -2
- package/src/components/chat-composer.tsx +58 -19
- package/src/components/composer-transcription-control.tsx +194 -165
- package/src/components/composer.tsx +78 -14
- package/src/components/model-policy-picker.tsx +7 -2
- package/src/components/session-chrome.tsx +89 -78
- package/src/hooks/use-composer.ts +79 -9
- package/src/index.ts +2 -0
- package/src/model-policy.ts +4 -0
- package/src/realtime/realtime-control.tsx +307 -137
- package/src/realtime.ts +1 -0
- package/src/timeline/index.ts +2 -0
- package/src/timeline/parsers.ts +201 -19
- package/src/timeline/projection.ts +11 -0
- package/src/timeline/tool-renderers.tsx +213 -8
- package/src/timeline/turn-summary.tsx +7 -2
- package/styles/tokens.css +8 -5
- package/dist/chunk-4IJCL7YO.js.map +0 -1
- package/dist/chunk-KR2SK5GJ.js.map +0 -1
- package/dist/chunk-Q2NCKWTK.js.map +0 -1
- package/dist/chunk-SJKT4TKW.js.map +0 -1
- /package/dist/{chunk-JALF5FI3.js.map → chunk-SRFUT2ZU.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
groupTimeline,
|
|
8
8
|
mcpToolLeaf,
|
|
9
9
|
toolDisplayName
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LWR4MXSS.js";
|
|
11
11
|
import {
|
|
12
12
|
Tooltip,
|
|
13
13
|
TooltipContent,
|
|
@@ -301,7 +301,7 @@ function SessionChrome({
|
|
|
301
301
|
const chipRefs = useRef({});
|
|
302
302
|
const railRef = useRef(null);
|
|
303
303
|
const panelBodyRef = useRef(null);
|
|
304
|
-
const [pill, setPill] = useState({ left: 0, width: 0, opacity: 0 });
|
|
304
|
+
const [pill, setPill] = useState({ left: 0, top: 0, width: 0, height: 0, opacity: 0 });
|
|
305
305
|
const [panelHeight, setPanelHeight] = useState(0);
|
|
306
306
|
const signalIds = signals.map((signal) => signal.id).join(",");
|
|
307
307
|
useEffect(() => {
|
|
@@ -329,7 +329,9 @@ function SessionChrome({
|
|
|
329
329
|
const chipBox = chip.getBoundingClientRect();
|
|
330
330
|
setPill({
|
|
331
331
|
left: chipBox.left - railBox.left,
|
|
332
|
+
top: chipBox.top - railBox.top,
|
|
332
333
|
width: chipBox.width,
|
|
334
|
+
height: chipBox.height,
|
|
333
335
|
opacity: 1
|
|
334
336
|
});
|
|
335
337
|
};
|
|
@@ -337,6 +339,9 @@ function SessionChrome({
|
|
|
337
339
|
if (!rail) return;
|
|
338
340
|
const observer = new ResizeObserver(measure);
|
|
339
341
|
observer.observe(rail);
|
|
342
|
+
for (const chip of Object.values(chipRefs.current)) {
|
|
343
|
+
if (chip) observer.observe(chip);
|
|
344
|
+
}
|
|
340
345
|
window.addEventListener("resize", measure);
|
|
341
346
|
return () => {
|
|
342
347
|
observer.disconnect();
|
|
@@ -429,87 +434,95 @@ function SessionChrome({
|
|
|
429
434
|
transitionTimingFunction: "var(--og-session-chrome-ease)"
|
|
430
435
|
},
|
|
431
436
|
children: [
|
|
432
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ jsx2(
|
|
433
438
|
"div",
|
|
434
439
|
{
|
|
435
|
-
|
|
436
|
-
className: "relative flex flex-wrap items-stretch",
|
|
440
|
+
className: "relative",
|
|
437
441
|
style: {
|
|
438
|
-
|
|
439
|
-
|
|
442
|
+
paddingTop: "var(--og-session-chrome-rail-pad)",
|
|
443
|
+
paddingBottom: "var(--og-session-chrome-rail-pad)",
|
|
444
|
+
paddingLeft: "var(--og-session-chrome-rail-pad)",
|
|
445
|
+
paddingRight: "var(--og-session-chrome-rail-pad)"
|
|
440
446
|
},
|
|
441
|
-
children:
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
top: "var(--og-session-chrome-rail-pad)",
|
|
449
|
-
bottom: "var(--og-session-chrome-rail-pad)",
|
|
450
|
-
background: "var(--og-session-chrome-highlight)"
|
|
451
|
-
},
|
|
452
|
-
initial: false,
|
|
453
|
-
animate: {
|
|
454
|
-
x: pill.left,
|
|
455
|
-
width: pill.width,
|
|
456
|
-
opacity: pill.opacity
|
|
457
|
-
},
|
|
458
|
-
transition: { duration: shellDuration, ease }
|
|
459
|
-
}
|
|
460
|
-
),
|
|
461
|
-
signals.map((signal) => {
|
|
462
|
-
const selected = active === signal.id;
|
|
463
|
-
return /* @__PURE__ */ jsxs2(
|
|
464
|
-
"button",
|
|
465
|
-
{
|
|
466
|
-
type: "button",
|
|
467
|
-
ref: (node) => {
|
|
468
|
-
chipRefs.current[signal.id] = node;
|
|
469
|
-
},
|
|
470
|
-
"aria-expanded": selected,
|
|
471
|
-
"aria-controls": panelId,
|
|
472
|
-
"data-testid": `session-chrome-${signal.id}`,
|
|
473
|
-
"data-og-session-chrome-signal": signal.id,
|
|
474
|
-
onClick: () => setActive(selected ? null : signal.id),
|
|
475
|
-
className: cn(
|
|
476
|
-
"group relative z-[1] inline-flex min-h-[var(--og-session-chrome-chip-min-height)] max-w-full items-center gap-1 rounded-og-md text-left text-og-xs outline-none",
|
|
477
|
-
"transition-colors duration-150 motion-reduce:transition-none",
|
|
478
|
-
"hover:text-og-fg focus-visible:ring-2 focus-visible:ring-og-accent/40",
|
|
479
|
-
"pointer-coarse:min-h-11",
|
|
480
|
-
selected ? "text-og-fg" : "text-og-fg-muted"
|
|
481
|
-
),
|
|
482
|
-
style: {
|
|
483
|
-
paddingInline: "var(--og-session-chrome-chip-pad-x)"
|
|
484
|
-
},
|
|
485
|
-
children: [
|
|
486
|
-
/* @__PURE__ */ jsx2("span", { className: cn("shrink-0", toneClass(signal.tone, selected)), children: signal.icon }),
|
|
487
|
-
/* @__PURE__ */ jsx2("span", { className: "shrink-0 font-medium text-og-fg", children: signal.label }),
|
|
488
|
-
signal.detail ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
489
|
-
/* @__PURE__ */ jsx2("span", { "aria-hidden": true, className: "shrink-0 text-og-fg-subtle/60", children: "\xB7" }),
|
|
490
|
-
/* @__PURE__ */ jsx2("span", { className: "min-w-0 max-w-[8.5rem] truncate text-og-fg sm:max-w-[12rem]", children: signal.detail })
|
|
491
|
-
] }) : null
|
|
492
|
-
]
|
|
493
|
-
},
|
|
494
|
-
signal.id
|
|
495
|
-
);
|
|
496
|
-
}),
|
|
497
|
-
/* @__PURE__ */ jsx2(AnimatePresence, { initial: false, children: open ? /* @__PURE__ */ jsx2(
|
|
498
|
-
motion.button,
|
|
499
|
-
{
|
|
500
|
-
type: "button",
|
|
501
|
-
"aria-label": "Close session chrome panel",
|
|
502
|
-
onClick: () => setActive(null),
|
|
503
|
-
initial: reduceMotion ? false : { opacity: 0 },
|
|
504
|
-
animate: { opacity: 1 },
|
|
505
|
-
exit: reduceMotion ? { opacity: 1 } : { opacity: 0 },
|
|
506
|
-
transition: { duration: crossfadeDuration, ease },
|
|
507
|
-
className: "relative z-[1] ml-auto inline-flex size-7 shrink-0 items-center justify-center rounded-og-md text-og-fg-subtle outline-none transition-colors hover:bg-og-surface-3/60 hover:text-og-fg focus-visible:ring-2 focus-visible:ring-og-accent/40 pointer-coarse:size-11",
|
|
508
|
-
children: /* @__PURE__ */ jsx2(XIcon, { className: "size-3" })
|
|
447
|
+
children: /* @__PURE__ */ jsxs2(
|
|
448
|
+
"div",
|
|
449
|
+
{
|
|
450
|
+
ref: railRef,
|
|
451
|
+
className: "relative flex flex-wrap items-center",
|
|
452
|
+
style: {
|
|
453
|
+
gap: "var(--og-session-chrome-chip-gap)"
|
|
509
454
|
},
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
455
|
+
children: [
|
|
456
|
+
/* @__PURE__ */ jsx2(
|
|
457
|
+
motion.div,
|
|
458
|
+
{
|
|
459
|
+
"aria-hidden": true,
|
|
460
|
+
className: "pointer-events-none absolute left-0 top-0 rounded-og-md",
|
|
461
|
+
style: {
|
|
462
|
+
background: "var(--og-session-chrome-highlight)",
|
|
463
|
+
boxShadow: "inset 0 0 0 1px var(--og-session-chrome-highlight-ring)"
|
|
464
|
+
},
|
|
465
|
+
initial: false,
|
|
466
|
+
animate: {
|
|
467
|
+
x: pill.left,
|
|
468
|
+
y: pill.top,
|
|
469
|
+
width: pill.width,
|
|
470
|
+
height: pill.height,
|
|
471
|
+
opacity: pill.opacity
|
|
472
|
+
},
|
|
473
|
+
transition: { duration: shellDuration, ease }
|
|
474
|
+
}
|
|
475
|
+
),
|
|
476
|
+
signals.map((signal) => {
|
|
477
|
+
const selected = active === signal.id;
|
|
478
|
+
return /* @__PURE__ */ jsxs2(
|
|
479
|
+
"button",
|
|
480
|
+
{
|
|
481
|
+
type: "button",
|
|
482
|
+
ref: (node) => {
|
|
483
|
+
chipRefs.current[signal.id] = node;
|
|
484
|
+
},
|
|
485
|
+
"aria-expanded": selected,
|
|
486
|
+
"aria-controls": panelId,
|
|
487
|
+
"aria-label": selected ? `Close ${signal.label}` : void 0,
|
|
488
|
+
"data-testid": `session-chrome-${signal.id}`,
|
|
489
|
+
"data-og-session-chrome-signal": signal.id,
|
|
490
|
+
onClick: () => setActive(selected ? null : signal.id),
|
|
491
|
+
className: cn(
|
|
492
|
+
"group relative z-[1] inline-flex min-h-[var(--og-session-chrome-chip-min-height)] max-w-full items-center gap-1 rounded-og-md py-1 text-left text-og-xs outline-none",
|
|
493
|
+
// Coarse pointers keep a 44px target (session-pins acceptance).
|
|
494
|
+
"pointer-coarse:min-h-11",
|
|
495
|
+
"transition-colors duration-150 motion-reduce:transition-none",
|
|
496
|
+
"hover:text-og-fg focus-visible:bg-og-surface-3/50",
|
|
497
|
+
selected ? "text-og-fg" : "text-og-fg-muted"
|
|
498
|
+
),
|
|
499
|
+
style: {
|
|
500
|
+
paddingInline: "var(--og-session-chrome-chip-pad-x)"
|
|
501
|
+
},
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ jsx2("span", { className: cn("shrink-0", toneClass(signal.tone, selected)), children: signal.icon }),
|
|
504
|
+
/* @__PURE__ */ jsx2("span", { className: "shrink-0 font-medium text-og-fg", children: signal.label }),
|
|
505
|
+
signal.detail ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
506
|
+
/* @__PURE__ */ jsx2("span", { "aria-hidden": true, className: "shrink-0 text-og-fg-subtle/60", children: "\xB7" }),
|
|
507
|
+
/* @__PURE__ */ jsx2("span", { className: "min-w-0 max-w-[8.5rem] truncate text-og-fg sm:max-w-[12rem]", children: signal.detail })
|
|
508
|
+
] }) : null,
|
|
509
|
+
selected ? /* @__PURE__ */ jsx2(
|
|
510
|
+
"span",
|
|
511
|
+
{
|
|
512
|
+
"data-testid": "session-chrome-close",
|
|
513
|
+
className: "ml-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-og-sm text-og-fg-subtle transition-colors group-hover:text-og-fg pointer-coarse:size-5",
|
|
514
|
+
"aria-hidden": true,
|
|
515
|
+
children: /* @__PURE__ */ jsx2(XIcon, { className: "size-3" })
|
|
516
|
+
}
|
|
517
|
+
) : null
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
signal.id
|
|
521
|
+
);
|
|
522
|
+
})
|
|
523
|
+
]
|
|
524
|
+
}
|
|
525
|
+
)
|
|
513
526
|
}
|
|
514
527
|
),
|
|
515
528
|
/* @__PURE__ */ jsx2(
|
|
@@ -1636,20 +1649,170 @@ function v4aToGitFileDiff(op) {
|
|
|
1636
1649
|
truncated: false
|
|
1637
1650
|
};
|
|
1638
1651
|
}
|
|
1652
|
+
var BEGIN_PATCH = "*** Begin Patch";
|
|
1653
|
+
var END_PATCH = "*** End Patch";
|
|
1654
|
+
var ADD_FILE = "*** Add File: ";
|
|
1655
|
+
var DELETE_FILE = "*** Delete File: ";
|
|
1656
|
+
var UPDATE_FILE = "*** Update File: ";
|
|
1657
|
+
var MOVE_TO = "*** Move to: ";
|
|
1658
|
+
var APPLY_PATCH_OP_TYPES = /* @__PURE__ */ new Set(["create_file", "update_file", "delete_file"]);
|
|
1659
|
+
function isRecord(value) {
|
|
1660
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1661
|
+
}
|
|
1662
|
+
function freeformApplyPatchOps(rawPatch) {
|
|
1663
|
+
return parseFreeformApplyPatch(rawPatch.trimStart());
|
|
1664
|
+
}
|
|
1665
|
+
function asApplyPatchOperation(value) {
|
|
1666
|
+
if (!isRecord(value)) return null;
|
|
1667
|
+
if (typeof value.type !== "string" || !APPLY_PATCH_OP_TYPES.has(value.type)) {
|
|
1668
|
+
return null;
|
|
1669
|
+
}
|
|
1670
|
+
if (typeof value.path !== "string" || !value.path) {
|
|
1671
|
+
return null;
|
|
1672
|
+
}
|
|
1673
|
+
const op = {
|
|
1674
|
+
type: value.type,
|
|
1675
|
+
path: value.path
|
|
1676
|
+
};
|
|
1677
|
+
if (typeof value.diff === "string") op.diff = value.diff;
|
|
1678
|
+
if (typeof value.moveTo === "string" && value.moveTo.length > 0) op.moveTo = value.moveTo;
|
|
1679
|
+
return op;
|
|
1680
|
+
}
|
|
1681
|
+
function parseStructuredOperations(payloads) {
|
|
1682
|
+
if (payloads.length === 0) return [];
|
|
1683
|
+
const operations = [];
|
|
1684
|
+
for (const payload of payloads) {
|
|
1685
|
+
const op = asApplyPatchOperation(payload);
|
|
1686
|
+
if (!op) return [];
|
|
1687
|
+
operations.push(op);
|
|
1688
|
+
}
|
|
1689
|
+
return operations;
|
|
1690
|
+
}
|
|
1691
|
+
function parseFreeformApplyPatch(rawPatch) {
|
|
1692
|
+
const lines = rawPatch.split(/\r?\n/);
|
|
1693
|
+
if (lines.at(-1) === "") lines.pop();
|
|
1694
|
+
if (lines[0] !== BEGIN_PATCH) return [];
|
|
1695
|
+
if (lines.length < 2 || lines.at(-1) !== END_PATCH) return [];
|
|
1696
|
+
const operations = [];
|
|
1697
|
+
let index = 1;
|
|
1698
|
+
while (index < lines.length - 1) {
|
|
1699
|
+
const line = lines[index];
|
|
1700
|
+
let parsed = null;
|
|
1701
|
+
if (line.startsWith(ADD_FILE)) parsed = parseAddFilePatch(lines, index);
|
|
1702
|
+
else if (line.startsWith(DELETE_FILE)) parsed = parseDeleteFilePatch(lines, index);
|
|
1703
|
+
else if (line.startsWith(UPDATE_FILE)) parsed = parseUpdateFilePatch(lines, index);
|
|
1704
|
+
else return [];
|
|
1705
|
+
if (!parsed || "error" in parsed) return [];
|
|
1706
|
+
operations.push(parsed.operation);
|
|
1707
|
+
index = parsed.nextIndex;
|
|
1708
|
+
}
|
|
1709
|
+
return operations.length > 0 ? operations : [];
|
|
1710
|
+
}
|
|
1711
|
+
function parsePatchHeader(line, prefix) {
|
|
1712
|
+
const path = line.slice(prefix.length).trim();
|
|
1713
|
+
return path || null;
|
|
1714
|
+
}
|
|
1715
|
+
function isFileOperationHeader(line) {
|
|
1716
|
+
return line.startsWith(ADD_FILE) || line.startsWith(DELETE_FILE) || line.startsWith(UPDATE_FILE);
|
|
1717
|
+
}
|
|
1718
|
+
function joinDiff(lines) {
|
|
1719
|
+
return `${lines.join("\n")}
|
|
1720
|
+
`;
|
|
1721
|
+
}
|
|
1722
|
+
function parseAddFilePatch(lines, index) {
|
|
1723
|
+
const path = parsePatchHeader(lines[index], ADD_FILE);
|
|
1724
|
+
if (!path) return { error: true };
|
|
1725
|
+
index += 1;
|
|
1726
|
+
const diffLines = [];
|
|
1727
|
+
while (index < lines.length - 1 && !isFileOperationHeader(lines[index])) {
|
|
1728
|
+
const line = lines[index];
|
|
1729
|
+
if (!line.startsWith("+")) return { error: true };
|
|
1730
|
+
diffLines.push(line);
|
|
1731
|
+
index += 1;
|
|
1732
|
+
}
|
|
1733
|
+
if (diffLines.length === 0) return { error: true };
|
|
1734
|
+
return {
|
|
1735
|
+
operation: { type: "create_file", path, diff: joinDiff(diffLines) },
|
|
1736
|
+
nextIndex: index
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
function parseDeleteFilePatch(lines, index) {
|
|
1740
|
+
const path = parsePatchHeader(lines[index], DELETE_FILE);
|
|
1741
|
+
if (!path) return { error: true };
|
|
1742
|
+
index += 1;
|
|
1743
|
+
if (index < lines.length - 1 && !isFileOperationHeader(lines[index])) {
|
|
1744
|
+
return { error: true };
|
|
1745
|
+
}
|
|
1746
|
+
return { operation: { type: "delete_file", path }, nextIndex: index };
|
|
1747
|
+
}
|
|
1748
|
+
function parseUpdateFilePatch(lines, index) {
|
|
1749
|
+
const path = parsePatchHeader(lines[index], UPDATE_FILE);
|
|
1750
|
+
if (!path) return { error: true };
|
|
1751
|
+
index += 1;
|
|
1752
|
+
let moveTo;
|
|
1753
|
+
if (index < lines.length - 1 && lines[index].startsWith(MOVE_TO)) {
|
|
1754
|
+
const parsedMoveTo = parsePatchHeader(lines[index], MOVE_TO);
|
|
1755
|
+
if (!parsedMoveTo) return { error: true };
|
|
1756
|
+
moveTo = parsedMoveTo;
|
|
1757
|
+
index += 1;
|
|
1758
|
+
}
|
|
1759
|
+
const diffLines = [];
|
|
1760
|
+
while (index < lines.length - 1 && !isFileOperationHeader(lines[index])) {
|
|
1761
|
+
diffLines.push(lines[index]);
|
|
1762
|
+
index += 1;
|
|
1763
|
+
}
|
|
1764
|
+
if (diffLines.length === 0 && !moveTo) return { error: true };
|
|
1765
|
+
return {
|
|
1766
|
+
operation: {
|
|
1767
|
+
type: "update_file",
|
|
1768
|
+
path,
|
|
1769
|
+
diff: diffLines.length > 0 ? joinDiff(diffLines) : "",
|
|
1770
|
+
...moveTo ? { moveTo } : {}
|
|
1771
|
+
},
|
|
1772
|
+
nextIndex: index
|
|
1773
|
+
};
|
|
1774
|
+
}
|
|
1639
1775
|
function applyPatchOps(raw) {
|
|
1640
|
-
|
|
1641
|
-
if (
|
|
1642
|
-
|
|
1776
|
+
if (raw == null) return [];
|
|
1777
|
+
if (typeof raw === "string") {
|
|
1778
|
+
const trimmed = raw.trimStart();
|
|
1779
|
+
if (trimmed.startsWith(BEGIN_PATCH)) return freeformApplyPatchOps(trimmed);
|
|
1780
|
+
const parsed = tryParseJson(trimmed);
|
|
1781
|
+
return parsed === void 0 ? [] : applyPatchOps(parsed);
|
|
1782
|
+
}
|
|
1783
|
+
if (Array.isArray(raw)) return parseStructuredOperations(raw);
|
|
1784
|
+
if (!isRecord(raw)) return [];
|
|
1785
|
+
if (typeof raw.patch === "string") return freeformApplyPatchOps(raw.patch);
|
|
1786
|
+
if (Array.isArray(raw.command)) {
|
|
1787
|
+
const [commandName, patch] = raw.command;
|
|
1788
|
+
if (commandName === "apply_patch" && typeof patch === "string") {
|
|
1789
|
+
return freeformApplyPatchOps(patch);
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
if (Array.isArray(raw.operations) && raw.operations.length > 0) {
|
|
1793
|
+
return parseStructuredOperations(raw.operations);
|
|
1643
1794
|
}
|
|
1644
|
-
|
|
1795
|
+
if (raw.operation !== void 0) {
|
|
1796
|
+
const op = asApplyPatchOperation(raw.operation);
|
|
1797
|
+
return op ? [op] : [];
|
|
1798
|
+
}
|
|
1799
|
+
const flat = asApplyPatchOperation(raw);
|
|
1800
|
+
return flat ? [flat] : [];
|
|
1645
1801
|
}
|
|
1646
1802
|
function applyPatchOpsFromToolItem(item) {
|
|
1647
1803
|
const fromRaw = applyPatchOps(item.raw);
|
|
1648
|
-
if (fromRaw.length > 0)
|
|
1649
|
-
|
|
1804
|
+
if (fromRaw.length > 0) return fromRaw;
|
|
1805
|
+
if (isRecord(item.raw)) {
|
|
1806
|
+
const nested = item.raw.arguments ?? item.raw.input;
|
|
1807
|
+
if (nested !== void 0 && nested !== item.arguments) {
|
|
1808
|
+
const fromNested = applyPatchOps(nested);
|
|
1809
|
+
if (fromNested.length > 0) return fromNested;
|
|
1810
|
+
}
|
|
1650
1811
|
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1812
|
+
if (item.arguments !== void 0 && item.arguments !== null) {
|
|
1813
|
+
return applyPatchOps(item.arguments);
|
|
1814
|
+
}
|
|
1815
|
+
return [];
|
|
1653
1816
|
}
|
|
1654
1817
|
function isApplyPatch(item) {
|
|
1655
1818
|
const type = item.raw && typeof item.raw === "object" ? item.raw.type : void 0;
|
|
@@ -2364,6 +2527,7 @@ import {
|
|
|
2364
2527
|
MessagesSquareIcon,
|
|
2365
2528
|
MessageSquareIcon,
|
|
2366
2529
|
MousePointer2Icon,
|
|
2530
|
+
PackageSearchIcon,
|
|
2367
2531
|
PanelsTopLeftIcon,
|
|
2368
2532
|
PlugIcon,
|
|
2369
2533
|
SearchIcon,
|
|
@@ -2670,12 +2834,13 @@ function ApplyPatchRenderer({ item }) {
|
|
|
2670
2834
|
title: fileCount > 1 ? `Applying ${fileCount} files` : titleVerb,
|
|
2671
2835
|
running: true,
|
|
2672
2836
|
preview: /* @__PURE__ */ jsx10(RunningPreview, { children: fileCount > 1 ? `${fileCount} files` : firstOp ? firstOp.path : "applying\u2026" }),
|
|
2673
|
-
children: ops.map((op) => {
|
|
2837
|
+
children: ops.map((op, index) => {
|
|
2674
2838
|
const file2 = safeParseOp(op);
|
|
2675
|
-
|
|
2839
|
+
const key = `${op.type}:${op.path}:${index}`;
|
|
2840
|
+
return file2 ? /* @__PURE__ */ jsx10(ToolDiff, { files: [file2] }, key) : /* @__PURE__ */ jsxs7("div", { children: [
|
|
2676
2841
|
/* @__PURE__ */ jsx10("p", { className: "mb-1 font-og-mono text-og-xs text-og-fg-muted", children: op.path }),
|
|
2677
2842
|
/* @__PURE__ */ jsx10(RawPatch, { diff: op.diff ?? "" })
|
|
2678
|
-
] },
|
|
2843
|
+
] }, key);
|
|
2679
2844
|
})
|
|
2680
2845
|
}
|
|
2681
2846
|
);
|
|
@@ -2719,10 +2884,11 @@ function ApplyPatchRenderer({ item }) {
|
|
|
2719
2884
|
] }),
|
|
2720
2885
|
children: ops.map((op, index) => {
|
|
2721
2886
|
const file2 = parsed[index];
|
|
2722
|
-
|
|
2887
|
+
const key = `${op.type}:${op.path}:${index}`;
|
|
2888
|
+
return file2 ? /* @__PURE__ */ jsx10(ToolDiff, { files: [file2] }, key) : /* @__PURE__ */ jsxs7("div", { children: [
|
|
2723
2889
|
/* @__PURE__ */ jsx10("p", { className: "mb-1 font-og-mono text-og-xs text-og-fg-muted", children: op.path }),
|
|
2724
2890
|
/* @__PURE__ */ jsx10(RawPatch, { diff: op.diff ?? "" })
|
|
2725
|
-
] },
|
|
2891
|
+
] }, key);
|
|
2726
2892
|
})
|
|
2727
2893
|
}
|
|
2728
2894
|
);
|
|
@@ -3201,6 +3367,169 @@ function SecretSetRenderer({ item }) {
|
|
|
3201
3367
|
}
|
|
3202
3368
|
);
|
|
3203
3369
|
}
|
|
3370
|
+
function splitToolWireName(name) {
|
|
3371
|
+
const boundary = name.indexOf("__");
|
|
3372
|
+
if (boundary <= 0) {
|
|
3373
|
+
return { name, source: null, leaf: name };
|
|
3374
|
+
}
|
|
3375
|
+
return {
|
|
3376
|
+
name,
|
|
3377
|
+
source: name.slice(0, boundary),
|
|
3378
|
+
leaf: name.slice(boundary + 2)
|
|
3379
|
+
};
|
|
3380
|
+
}
|
|
3381
|
+
function toolSearchQuery(item) {
|
|
3382
|
+
const fromArgs = parseToolArgs(item.arguments);
|
|
3383
|
+
if (typeof fromArgs.query === "string" && fromArgs.query.trim()) {
|
|
3384
|
+
return fromArgs.query.trim();
|
|
3385
|
+
}
|
|
3386
|
+
const raw = item.raw;
|
|
3387
|
+
if (raw && typeof raw === "object") {
|
|
3388
|
+
const rawArgs = raw.arguments;
|
|
3389
|
+
if (typeof rawArgs === "string" && rawArgs.trim()) {
|
|
3390
|
+
const parsed = tryParseJson(rawArgs);
|
|
3391
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
3392
|
+
const query2 = parsed.query;
|
|
3393
|
+
if (typeof query2 === "string" && query2.trim()) {
|
|
3394
|
+
return query2.trim();
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
} else if (rawArgs && typeof rawArgs === "object" && !Array.isArray(rawArgs)) {
|
|
3398
|
+
const query2 = rawArgs.query;
|
|
3399
|
+
if (typeof query2 === "string" && query2.trim()) {
|
|
3400
|
+
return query2.trim();
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
return "";
|
|
3405
|
+
}
|
|
3406
|
+
function parseDisclosedTools(output) {
|
|
3407
|
+
if (output && typeof output === "object" && !Array.isArray(output)) {
|
|
3408
|
+
const tools = output.tools;
|
|
3409
|
+
if (Array.isArray(tools)) {
|
|
3410
|
+
return tools.map((tool) => {
|
|
3411
|
+
if (typeof tool === "string" && tool.trim()) {
|
|
3412
|
+
return splitToolWireName(tool.trim());
|
|
3413
|
+
}
|
|
3414
|
+
if (tool && typeof tool === "object" && typeof tool.name === "string") {
|
|
3415
|
+
const name = tool.name.trim();
|
|
3416
|
+
return name ? splitToolWireName(name) : null;
|
|
3417
|
+
}
|
|
3418
|
+
return null;
|
|
3419
|
+
}).filter((tool) => tool != null);
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
const { text } = unwrapMcpOutput(output);
|
|
3423
|
+
const trimmed = text.trim();
|
|
3424
|
+
if (!trimmed) {
|
|
3425
|
+
return null;
|
|
3426
|
+
}
|
|
3427
|
+
if (/^no matching tools found\.?$/i.test(trimmed)) {
|
|
3428
|
+
return [];
|
|
3429
|
+
}
|
|
3430
|
+
const disclosed = trimmed.match(/^disclosed tools:\s*(.+)$/i);
|
|
3431
|
+
if (disclosed?.[1]) {
|
|
3432
|
+
return disclosed[1].split(",").map((part) => part.trim()).filter(Boolean).map(splitToolWireName);
|
|
3433
|
+
}
|
|
3434
|
+
const parsed = tryParseJson(trimmed);
|
|
3435
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
3436
|
+
return parseDisclosedTools(parsed);
|
|
3437
|
+
}
|
|
3438
|
+
return null;
|
|
3439
|
+
}
|
|
3440
|
+
function toolSearchPreview(tools, cancelled) {
|
|
3441
|
+
if (cancelled) {
|
|
3442
|
+
return void 0;
|
|
3443
|
+
}
|
|
3444
|
+
if (!tools) {
|
|
3445
|
+
return "Done";
|
|
3446
|
+
}
|
|
3447
|
+
if (tools.length === 0) {
|
|
3448
|
+
return "No matches";
|
|
3449
|
+
}
|
|
3450
|
+
if (tools.length === 1) {
|
|
3451
|
+
return tools[0].leaf;
|
|
3452
|
+
}
|
|
3453
|
+
const head = tools[0].leaf;
|
|
3454
|
+
return `${tools.length} tools \xB7 ${truncatePreview(head, 28)}`;
|
|
3455
|
+
}
|
|
3456
|
+
function ToolSearchRenderer({ item }) {
|
|
3457
|
+
const query2 = toolSearchQuery(item);
|
|
3458
|
+
const icon = /* @__PURE__ */ jsx10(PackageSearchIcon, { className: ICON_SIZE });
|
|
3459
|
+
const running = item.status === "running";
|
|
3460
|
+
const queryPreview = query2 ? truncatePreview(query2, 64) : "";
|
|
3461
|
+
if (running) {
|
|
3462
|
+
return /* @__PURE__ */ jsxs7(
|
|
3463
|
+
ActivityDisclosure,
|
|
3464
|
+
{
|
|
3465
|
+
icon,
|
|
3466
|
+
iconTone: "running",
|
|
3467
|
+
title: "Looking up tools",
|
|
3468
|
+
running: true,
|
|
3469
|
+
preview: queryPreview ? /* @__PURE__ */ jsx10(RunningPreview, { children: queryPreview }) : /* @__PURE__ */ jsx10(RunningPreview, { children: "Matching capabilities\u2026" }),
|
|
3470
|
+
children: [
|
|
3471
|
+
query2 ? /* @__PURE__ */ jsxs7(BodyNote, { children: [
|
|
3472
|
+
"capability query: ",
|
|
3473
|
+
query2
|
|
3474
|
+
] }) : null,
|
|
3475
|
+
/* @__PURE__ */ jsx10(PayloadBlock, { label: "Arguments", value: redactSecrets(parseToolArgs(item.arguments)) })
|
|
3476
|
+
]
|
|
3477
|
+
}
|
|
3478
|
+
);
|
|
3479
|
+
}
|
|
3480
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
3481
|
+
if ((isError || item.status === "failed") && item.status !== "cancelled") {
|
|
3482
|
+
return /* @__PURE__ */ jsxs7(
|
|
3483
|
+
ActivityDisclosure,
|
|
3484
|
+
{
|
|
3485
|
+
icon,
|
|
3486
|
+
iconTone: "failed",
|
|
3487
|
+
title: "Tool lookup failed",
|
|
3488
|
+
failed: true,
|
|
3489
|
+
preview: truncatePreview(outText, 80) || queryPreview || "Lookup failed",
|
|
3490
|
+
children: [
|
|
3491
|
+
query2 ? /* @__PURE__ */ jsxs7(BodyNote, { children: [
|
|
3492
|
+
"capability query: ",
|
|
3493
|
+
query2
|
|
3494
|
+
] }) : null,
|
|
3495
|
+
/* @__PURE__ */ jsx10(PayloadBlock, { label: "Arguments", value: redactSecrets(parseToolArgs(item.arguments)) }),
|
|
3496
|
+
/* @__PURE__ */ jsx10(PayloadBlock, { label: "Error", value: outText, failed: true })
|
|
3497
|
+
]
|
|
3498
|
+
}
|
|
3499
|
+
);
|
|
3500
|
+
}
|
|
3501
|
+
const tools = parseDisclosedTools(item.output);
|
|
3502
|
+
const preview = toolSearchPreview(tools, item.status === "cancelled");
|
|
3503
|
+
return /* @__PURE__ */ jsxs7(
|
|
3504
|
+
ActivityDisclosure,
|
|
3505
|
+
{
|
|
3506
|
+
icon,
|
|
3507
|
+
iconTone: "muted",
|
|
3508
|
+
title: "Looked up tools",
|
|
3509
|
+
cancelled: item.status === "cancelled",
|
|
3510
|
+
preview,
|
|
3511
|
+
children: [
|
|
3512
|
+
query2 ? /* @__PURE__ */ jsxs7(BodyNote, { children: [
|
|
3513
|
+
"capability query: ",
|
|
3514
|
+
query2
|
|
3515
|
+
] }) : null,
|
|
3516
|
+
tools && tools.length > 0 ? /* @__PURE__ */ jsxs7("ul", { className: "grid gap-1.5", children: [
|
|
3517
|
+
tools.slice(0, 12).map((tool) => /* @__PURE__ */ jsxs7("li", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
3518
|
+
tool.source ? /* @__PURE__ */ jsx10("span", { className: "shrink-0 text-og-xs text-og-fg-subtle", children: tool.source }) : null,
|
|
3519
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate font-mono text-og-sm text-og-fg", children: tool.leaf })
|
|
3520
|
+
] }, tool.name)),
|
|
3521
|
+
tools.length > 12 ? /* @__PURE__ */ jsxs7("li", { className: "text-og-xs text-og-fg-muted", children: [
|
|
3522
|
+
"+",
|
|
3523
|
+
tools.length - 12,
|
|
3524
|
+
" more"
|
|
3525
|
+
] }) : null
|
|
3526
|
+
] }) : tools && tools.length === 0 ? /* @__PURE__ */ jsx10(BodyNote, { children: "no deferred tools matched this capability query." }) : null,
|
|
3527
|
+
/* @__PURE__ */ jsx10(PayloadBlock, { label: "Arguments", value: redactSecrets(parseToolArgs(item.arguments)) }),
|
|
3528
|
+
tools == null && outText ? /* @__PURE__ */ jsx10(PayloadBlock, { label: "Result", value: outText }) : null
|
|
3529
|
+
]
|
|
3530
|
+
}
|
|
3531
|
+
);
|
|
3532
|
+
}
|
|
3204
3533
|
function DocsSearchRenderer({ item }) {
|
|
3205
3534
|
const args = parseToolArgs(item.arguments);
|
|
3206
3535
|
const query2 = typeof args.query === "string" ? args.query.trim() : "";
|
|
@@ -3601,7 +3930,7 @@ function truncatePreview(text, max) {
|
|
|
3601
3930
|
}
|
|
3602
3931
|
function GenericToolIcon({ name }) {
|
|
3603
3932
|
const leaf = mcpToolLeaf(name);
|
|
3604
|
-
const Icon = leaf === "request_human_input" ? MessageCircleQuestionIcon2 : leaf.startsWith("goal_") ? TargetIcon : leaf.startsWith("memory_") || leaf === "preference_registry_summary" || leaf === "preference_registry_get" ? BrainCircuitIcon : leaf.startsWith("session_") || leaf === "sessions_list" || leaf === "set_session_title" || leaf === "set_other_session_title" ? MessagesSquareIcon : leaf.startsWith("sandbox") || leaf === "sandboxes_list" || leaf === "run_on" ? ServerIcon : leaf.startsWith("rig_") ? ServerCogIcon : leaf.startsWith("scheduled_") ? CalendarClockIcon : leaf.startsWith("artifacts_") ? PanelsTopLeftIcon : leaf.startsWith("social_") ? Share2Icon : leaf.startsWith("slack_") ? MessageSquareIcon : leaf.startsWith("github_") ? FolderGitIcon : leaf.startsWith("variable_") ? BoxIcon : leaf.startsWith("environment_") ? KeyRoundIcon : leaf.includes("document") || leaf.includes("knowledge") || leaf === "list_document_bases" ? FileSearchIcon : leaf === "tool_search"
|
|
3933
|
+
const Icon = leaf === "request_human_input" ? MessageCircleQuestionIcon2 : leaf.startsWith("goal_") ? TargetIcon : leaf.startsWith("memory_") || leaf === "preference_registry_summary" || leaf === "preference_registry_get" ? BrainCircuitIcon : leaf.startsWith("session_") || leaf === "sessions_list" || leaf === "set_session_title" || leaf === "set_other_session_title" ? MessagesSquareIcon : leaf.startsWith("sandbox") || leaf === "sandboxes_list" || leaf === "run_on" ? ServerIcon : leaf.startsWith("rig_") ? ServerCogIcon : leaf.startsWith("scheduled_") ? CalendarClockIcon : leaf.startsWith("artifacts_") ? PanelsTopLeftIcon : leaf.startsWith("social_") ? Share2Icon : leaf.startsWith("slack_") ? MessageSquareIcon : leaf.startsWith("github_") ? FolderGitIcon : leaf.startsWith("variable_") ? BoxIcon : leaf.startsWith("environment_") ? KeyRoundIcon : leaf.includes("document") || leaf.includes("knowledge") || leaf === "list_document_bases" ? FileSearchIcon : leaf === "tool_search" ? PackageSearchIcon : leaf === "load_skill" ? PlugIcon : WrenchIcon;
|
|
3605
3934
|
return /* @__PURE__ */ jsx10(Icon, { className: ICON_SIZE });
|
|
3606
3935
|
}
|
|
3607
3936
|
var BASE_ENTRIES = [
|
|
@@ -3610,6 +3939,7 @@ var BASE_ENTRIES = [
|
|
|
3610
3939
|
{ match: "rawType", type: "apply_patch_call", render: ApplyPatchRenderer },
|
|
3611
3940
|
{ match: "rawType", type: "computer_call", render: ComputerCallRenderer },
|
|
3612
3941
|
{ match: "rawType", type: "hosted_tool_call", render: WebSearchRenderer },
|
|
3942
|
+
{ match: "rawType", type: "tool_search_call", render: ToolSearchRenderer },
|
|
3613
3943
|
// First-party sandbox + MCP tools resolve by name (exact or MCP leaf).
|
|
3614
3944
|
{ match: "name", name: "exec_command", render: ExecRenderer },
|
|
3615
3945
|
{ match: "name", name: "request_human_input", render: AskRenderer },
|
|
@@ -3628,6 +3958,7 @@ var BASE_ENTRIES = [
|
|
|
3628
3958
|
{ match: "name", name: "computer_keypress", render: ComputerCallRenderer },
|
|
3629
3959
|
{ match: "name", name: "computer_drag", render: ComputerCallRenderer },
|
|
3630
3960
|
{ match: "name", name: "web_search_call", render: WebSearchRenderer },
|
|
3961
|
+
{ match: "name", name: "tool_search", render: ToolSearchRenderer },
|
|
3631
3962
|
{ match: "name", name: "view_image", render: ViewImageRenderer },
|
|
3632
3963
|
{ match: "name", name: "environment_set_variable", render: SecretSetRenderer },
|
|
3633
3964
|
{ match: "name", name: "variable_set_set_variable", render: SecretSetRenderer },
|
|
@@ -5020,7 +5351,7 @@ var BUILT_IN_TURN_SUMMARY_FACETS = Object.freeze([
|
|
|
5020
5351
|
let files = 0;
|
|
5021
5352
|
for (const item of toolCalls) {
|
|
5022
5353
|
if (isApplyPatch(item)) {
|
|
5023
|
-
files +=
|
|
5354
|
+
files += applyPatchOpsFromToolItem(item).length;
|
|
5024
5355
|
}
|
|
5025
5356
|
}
|
|
5026
5357
|
return files ? { content: `${files} ${files === 1 ? "file" : "files"} edited` } : null;
|
|
@@ -7427,7 +7758,9 @@ export {
|
|
|
7427
7758
|
looksBinary,
|
|
7428
7759
|
controlCaret,
|
|
7429
7760
|
v4aToGitFileDiff,
|
|
7761
|
+
parseFreeformApplyPatch,
|
|
7430
7762
|
applyPatchOps,
|
|
7763
|
+
applyPatchOpsFromToolItem,
|
|
7431
7764
|
isApplyPatch,
|
|
7432
7765
|
redactSecrets,
|
|
7433
7766
|
parseToolArgs,
|
|
@@ -7464,4 +7797,4 @@ export {
|
|
|
7464
7797
|
MessageTimeline,
|
|
7465
7798
|
TimelineRow
|
|
7466
7799
|
};
|
|
7467
|
-
//# sourceMappingURL=chunk-
|
|
7800
|
+
//# sourceMappingURL=chunk-YNYIAYXQ.js.map
|