@dudko.dev/agent-web-react 0.0.33 → 0.0.34
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/README.md +2 -1
- package/dist/{elicitation-B6h_-yLg.d.cts → elicitation-BTrJ5t3c.d.cts} +5 -0
- package/dist/{elicitation-B6h_-yLg.d.ts → elicitation-BTrJ5t3c.d.ts} +5 -0
- package/dist/index.cjs +1029 -599
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +145 -6
- package/dist/index.d.ts +145 -6
- package/dist/index.js +964 -543
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.cts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/styles.css +159 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -696,7 +696,10 @@ var applyEvent = (state, event, ctx) => {
|
|
|
696
696
|
...event.model !== void 0 ? { model: event.model } : {},
|
|
697
697
|
...event.tierReason !== void 0 ? { tierReason: event.tierReason } : {}
|
|
698
698
|
};
|
|
699
|
-
|
|
699
|
+
const steps = state.steps.map(
|
|
700
|
+
(s) => s.total === event.total ? s : { ...s, total: event.total }
|
|
701
|
+
);
|
|
702
|
+
return { ...state, steps: [...steps, view] };
|
|
700
703
|
}
|
|
701
704
|
case "step.escalated":
|
|
702
705
|
return {
|
|
@@ -2517,6 +2520,11 @@ var defaultLabels = {
|
|
|
2517
2520
|
subagentNoTools: "no tools",
|
|
2518
2521
|
approvalLeadHelper: (role) => role ? `The helper \u201C${role}\u201D wants to run` : "A helper the agent started wants to run",
|
|
2519
2522
|
mediaImage: (path) => `Generated image ${path}`,
|
|
2523
|
+
imageOpen: (name) => `Open image ${name}`,
|
|
2524
|
+
imagePrevious: "Previous image",
|
|
2525
|
+
imageNext: "Next image",
|
|
2526
|
+
imageZoom: "Zoom",
|
|
2527
|
+
imageCount: (index, total) => `${index} of ${total}`,
|
|
2520
2528
|
mediaAudio: (path) => `Generated audio ${path}`,
|
|
2521
2529
|
mediaFile: (path) => `Generated file ${path}`,
|
|
2522
2530
|
transcriptOf: (name) => `Transcript of ${name}`,
|
|
@@ -2806,11 +2814,128 @@ var useAgentContext = () => {
|
|
|
2806
2814
|
var useOptionalAgentContext = () => useContext2(AgentContext);
|
|
2807
2815
|
|
|
2808
2816
|
// src/components/AgentChat.tsx
|
|
2809
|
-
import { useEffect as
|
|
2810
|
-
import { createPortal } from "react-dom";
|
|
2817
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState16 } from "react";
|
|
2818
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
2819
|
+
|
|
2820
|
+
// src/hooks/use-follow-scroll.ts
|
|
2821
|
+
import { useEffect as useEffect6, useLayoutEffect, useRef as useRef5 } from "react";
|
|
2822
|
+
|
|
2823
|
+
// src/follow-scroll.ts
|
|
2824
|
+
var FOLLOW_REJOIN_PX = 80;
|
|
2825
|
+
var FOLLOW_LEAVE_PX = 2;
|
|
2826
|
+
var endGap = (m) => m.scrollHeight - m.scrollTop - m.clientHeight;
|
|
2827
|
+
var reach = (m) => Math.min(m.scrollTop, Math.max(0, m.scrollHeight - m.clientHeight));
|
|
2828
|
+
var followsAfterScroll = (following, before, now) => {
|
|
2829
|
+
if (before.scrollHeight !== now.scrollHeight || before.clientHeight !== now.clientHeight)
|
|
2830
|
+
return following;
|
|
2831
|
+
if (now.scrollTop < reach(before) - FOLLOW_LEAVE_PX) return false;
|
|
2832
|
+
if (now.scrollTop > before.scrollTop) return endGap(now) < FOLLOW_REJOIN_PX ? true : following;
|
|
2833
|
+
return following;
|
|
2834
|
+
};
|
|
2835
|
+
var followsAfterResize = (following, before, now) => following && !(now.clientHeight === before.clientHeight && now.scrollHeight >= before.scrollHeight && now.scrollTop < reach(before) - FOLLOW_LEAVE_PX);
|
|
2836
|
+
|
|
2837
|
+
// src/hooks/use-follow-scroll.ts
|
|
2838
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect6 : useLayoutEffect;
|
|
2839
|
+
var measure = (el) => ({
|
|
2840
|
+
scrollTop: el.scrollTop,
|
|
2841
|
+
scrollHeight: el.scrollHeight,
|
|
2842
|
+
clientHeight: el.clientHeight
|
|
2843
|
+
});
|
|
2844
|
+
var anchorOf = (el) => {
|
|
2845
|
+
const box = el.getBoundingClientRect();
|
|
2846
|
+
if (box.width === 0 || box.height === 0) return void 0;
|
|
2847
|
+
const doc = el.ownerDocument;
|
|
2848
|
+
const marks = [];
|
|
2849
|
+
for (const dy of [8, 24, 48, 80, 120, 180]) {
|
|
2850
|
+
if (dy >= box.height) break;
|
|
2851
|
+
const node = doc.elementFromPoint(box.left + box.width / 2, box.top + dy);
|
|
2852
|
+
if (!node || node === el || !el.contains(node) || marks.some((m) => m.node === node)) continue;
|
|
2853
|
+
const r = node.getBoundingClientRect();
|
|
2854
|
+
marks.push({ node, offset: r.top - box.top, height: r.height });
|
|
2855
|
+
}
|
|
2856
|
+
marks.sort((a, b) => a.height - b.height);
|
|
2857
|
+
return marks.length ? { marks, top: el.scrollTop } : void 0;
|
|
2858
|
+
};
|
|
2859
|
+
var useFollowScroll = (ref, turn, live = true) => {
|
|
2860
|
+
const following = useRef5(true);
|
|
2861
|
+
const last = useRef5(void 0);
|
|
2862
|
+
const anchor = useRef5(void 0);
|
|
2863
|
+
const settle = useRef5(() => {
|
|
2864
|
+
});
|
|
2865
|
+
const arriving = useRef5(live);
|
|
2866
|
+
arriving.current = live;
|
|
2867
|
+
useIsoLayoutEffect(() => {
|
|
2868
|
+
const el = ref.current;
|
|
2869
|
+
if (!el) return;
|
|
2870
|
+
last.current = measure(el);
|
|
2871
|
+
const anchoring = el.style.getPropertyValue("overflow-anchor");
|
|
2872
|
+
el.style.setProperty("overflow-anchor", "none");
|
|
2873
|
+
const toEnd = () => {
|
|
2874
|
+
const top = el.scrollHeight - el.clientHeight;
|
|
2875
|
+
if (top - el.scrollTop > 0.5) el.scrollTop = top;
|
|
2876
|
+
};
|
|
2877
|
+
const keep = (render) => {
|
|
2878
|
+
const now = measure(el);
|
|
2879
|
+
const before = last.current;
|
|
2880
|
+
if (before) following.current = followsAfterResize(following.current, before, now);
|
|
2881
|
+
if (following.current) {
|
|
2882
|
+
if (render || arriving.current || !before || now.clientHeight !== before.clientHeight)
|
|
2883
|
+
toEnd();
|
|
2884
|
+
else if (endGap(now) > 0.5) following.current = false;
|
|
2885
|
+
} else if (anchor.current) {
|
|
2886
|
+
const seenAt = anchor.current.top;
|
|
2887
|
+
const mark = anchor.current.marks.find(
|
|
2888
|
+
(m) => m.node.isConnected && m.node.getClientRects().length > 0
|
|
2889
|
+
);
|
|
2890
|
+
if (mark) {
|
|
2891
|
+
const shift = mark.node.getBoundingClientRect().top - el.getBoundingClientRect().top - mark.offset + (el.scrollTop - seenAt);
|
|
2892
|
+
if (Math.abs(shift) > 0.5) el.scrollTop += shift;
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
last.current = measure(el);
|
|
2896
|
+
if (!following.current) anchor.current = anchorOf(el);
|
|
2897
|
+
};
|
|
2898
|
+
settle.current = () => keep(true);
|
|
2899
|
+
const onScroll = () => {
|
|
2900
|
+
const now = measure(el);
|
|
2901
|
+
const was = following.current;
|
|
2902
|
+
following.current = followsAfterScroll(was, last.current ?? now, now);
|
|
2903
|
+
last.current = now;
|
|
2904
|
+
anchor.current = following.current ? void 0 : anchorOf(el);
|
|
2905
|
+
};
|
|
2906
|
+
el.addEventListener("scroll", onScroll, { passive: true });
|
|
2907
|
+
const restore = () => {
|
|
2908
|
+
el.removeEventListener("scroll", onScroll);
|
|
2909
|
+
if (anchoring) el.style.setProperty("overflow-anchor", anchoring);
|
|
2910
|
+
else el.style.removeProperty("overflow-anchor");
|
|
2911
|
+
};
|
|
2912
|
+
if (typeof ResizeObserver === "undefined") return restore;
|
|
2913
|
+
const sizes = new ResizeObserver(() => keep(false));
|
|
2914
|
+
const watch = () => {
|
|
2915
|
+
sizes.disconnect();
|
|
2916
|
+
sizes.observe(el);
|
|
2917
|
+
for (const child of el.children) sizes.observe(child);
|
|
2918
|
+
};
|
|
2919
|
+
watch();
|
|
2920
|
+
const parts = typeof MutationObserver === "undefined" ? void 0 : new MutationObserver((records) => {
|
|
2921
|
+
if (records.some((r) => r.type === "childList")) watch();
|
|
2922
|
+
});
|
|
2923
|
+
parts?.observe(el, { childList: true });
|
|
2924
|
+
return () => {
|
|
2925
|
+
restore();
|
|
2926
|
+
sizes.disconnect();
|
|
2927
|
+
parts?.disconnect();
|
|
2928
|
+
};
|
|
2929
|
+
}, [ref]);
|
|
2930
|
+
useIsoLayoutEffect(() => {
|
|
2931
|
+
following.current = true;
|
|
2932
|
+
anchor.current = void 0;
|
|
2933
|
+
}, [turn]);
|
|
2934
|
+
useIsoLayoutEffect(() => settle.current());
|
|
2935
|
+
};
|
|
2811
2936
|
|
|
2812
2937
|
// src/hooks/use-mcp-app-host.ts
|
|
2813
|
-
import { useCallback as useCallback7, useEffect as
|
|
2938
|
+
import { useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef6, useState as useState7 } from "react";
|
|
2814
2939
|
|
|
2815
2940
|
// src/mcp-app.ts
|
|
2816
2941
|
import { mcpAppOrigin } from "@dudko.dev/agent-web";
|
|
@@ -3639,18 +3764,18 @@ var useMcpAppHost = ({
|
|
|
3639
3764
|
}) => {
|
|
3640
3765
|
const [requests, setRequests] = useState7([]);
|
|
3641
3766
|
const [draft, setDraft] = useState7();
|
|
3642
|
-
const waiting =
|
|
3767
|
+
const waiting = useRef6(
|
|
3643
3768
|
/* @__PURE__ */ new Map()
|
|
3644
3769
|
);
|
|
3645
|
-
const samplingAllowed =
|
|
3646
|
-
const sampleRef =
|
|
3770
|
+
const samplingAllowed = useRef6(/* @__PURE__ */ new Set());
|
|
3771
|
+
const sampleRef = useRef6(sampleFn);
|
|
3647
3772
|
sampleRef.current = sampleFn;
|
|
3648
3773
|
const [gated, setGated] = useState7({});
|
|
3649
|
-
const connectionRef =
|
|
3774
|
+
const connectionRef = useRef6(connection);
|
|
3650
3775
|
connectionRef.current = connection;
|
|
3651
|
-
const approveRef =
|
|
3776
|
+
const approveRef = useRef6(approve);
|
|
3652
3777
|
approveRef.current = approve;
|
|
3653
|
-
|
|
3778
|
+
useEffect7(
|
|
3654
3779
|
() => () => {
|
|
3655
3780
|
for (const { resolve } of waiting.current.values()) resolve(false);
|
|
3656
3781
|
waiting.current.clear();
|
|
@@ -3981,11 +4106,11 @@ var AppRequestPrompt = ({
|
|
|
3981
4106
|
};
|
|
3982
4107
|
|
|
3983
4108
|
// src/components/McpAppFrame.tsx
|
|
3984
|
-
import { useEffect as
|
|
4109
|
+
import { useEffect as useEffect8, useLayoutEffect as useLayoutEffect2, useMemo as useMemo5, useRef as useRef7, useState as useState8 } from "react";
|
|
3985
4110
|
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3986
4111
|
var HOST_INFO = { name: "@dudko.dev/agent-web-react", version: "1" };
|
|
3987
4112
|
var MAX_LISTED_CALLS = 12;
|
|
3988
|
-
var
|
|
4113
|
+
var useIsoLayoutEffect2 = typeof window === "undefined" ? useEffect8 : useLayoutEffect2;
|
|
3989
4114
|
var userActivation = () => typeof navigator === "undefined" ? void 0 : navigator.userActivation?.isActive;
|
|
3990
4115
|
var silentSandboxes = /* @__PURE__ */ new Set();
|
|
3991
4116
|
var warned = /* @__PURE__ */ new Set();
|
|
@@ -4027,27 +4152,27 @@ var McpAppFrame = ({
|
|
|
4027
4152
|
const [fallback, setFallback] = useState8();
|
|
4028
4153
|
const [broken, setBroken] = useState8(false);
|
|
4029
4154
|
const [onOrigin, setOnOrigin] = useState8(false);
|
|
4030
|
-
const shellLoaded =
|
|
4155
|
+
const shellLoaded = useRef7(void 0);
|
|
4031
4156
|
const [mode, setMode] = useState8("inline");
|
|
4032
|
-
const modeRef =
|
|
4157
|
+
const modeRef = useRef7("inline");
|
|
4033
4158
|
const [holder, setHolder] = useState8(0);
|
|
4034
4159
|
const [fullRect, setFullRect] = useState8();
|
|
4035
|
-
const leaveRef =
|
|
4036
|
-
const rootRef =
|
|
4037
|
-
const exitRef =
|
|
4038
|
-
const allowFullscreenRef =
|
|
4160
|
+
const leaveRef = useRef7(void 0);
|
|
4161
|
+
const rootRef = useRef7(null);
|
|
4162
|
+
const exitRef = useRef7(null);
|
|
4163
|
+
const allowFullscreenRef = useRef7(allowFullscreen);
|
|
4039
4164
|
allowFullscreenRef.current = allowFullscreen;
|
|
4040
|
-
const iframeRef =
|
|
4041
|
-
const bridgeRef =
|
|
4042
|
-
const menuRef =
|
|
4043
|
-
const themeRef =
|
|
4165
|
+
const iframeRef = useRef7(null);
|
|
4166
|
+
const bridgeRef = useRef7(void 0);
|
|
4167
|
+
const menuRef = useRef7(null);
|
|
4168
|
+
const themeRef = useRef7(theme);
|
|
4044
4169
|
themeRef.current = theme;
|
|
4045
|
-
const hostRef =
|
|
4170
|
+
const hostRef = useRef7(host);
|
|
4046
4171
|
hostRef.current = host;
|
|
4047
|
-
const appRef =
|
|
4172
|
+
const appRef = useRef7(app);
|
|
4048
4173
|
appRef.current = app;
|
|
4049
4174
|
const live = !collapsed;
|
|
4050
|
-
|
|
4175
|
+
useEffect8(() => {
|
|
4051
4176
|
if (!live) return;
|
|
4052
4177
|
if (!hostRef.current.connected) {
|
|
4053
4178
|
setLoaded({ unavailable: true });
|
|
@@ -4085,7 +4210,7 @@ var McpAppFrame = ({
|
|
|
4085
4210
|
() => !resource || !placement ? void 0 : placement.mode === "origin" ? buildMcpAppSandboxShell(placement.url) : buildMcpAppDocument(resource.html, resource.csp),
|
|
4086
4211
|
[resource, placement]
|
|
4087
4212
|
);
|
|
4088
|
-
|
|
4213
|
+
useEffect8(() => {
|
|
4089
4214
|
const reason = placement?.mode === "opaque" ? placement.reason : void 0;
|
|
4090
4215
|
if (reason && reason !== "no-answer" && sandboxUrl !== void 0) {
|
|
4091
4216
|
warnOnce(
|
|
@@ -4094,7 +4219,7 @@ var McpAppFrame = ({
|
|
|
4094
4219
|
);
|
|
4095
4220
|
}
|
|
4096
4221
|
}, [placement, sandboxUrl]);
|
|
4097
|
-
|
|
4222
|
+
useEffect8(() => {
|
|
4098
4223
|
const frame = iframeRef.current;
|
|
4099
4224
|
if (!live || !resource || !frame || !placement || broken) return;
|
|
4100
4225
|
const abort = new AbortController();
|
|
@@ -4239,10 +4364,10 @@ var McpAppFrame = ({
|
|
|
4239
4364
|
}, [live, resource, reload, variant, app.id, placement, broken, timeoutMs]);
|
|
4240
4365
|
const fullscreen = mode === "fullscreen" && live && !broken;
|
|
4241
4366
|
const waitingNow = host.isWaiting(app);
|
|
4242
|
-
|
|
4367
|
+
useEffect8(() => {
|
|
4243
4368
|
if (fullscreen && waitingNow) leaveRef.current?.();
|
|
4244
4369
|
}, [fullscreen, waitingNow]);
|
|
4245
|
-
|
|
4370
|
+
useIsoLayoutEffect2(() => {
|
|
4246
4371
|
if (!fullscreen) return;
|
|
4247
4372
|
const place = () => {
|
|
4248
4373
|
const chat2 = rootRef.current?.closest(".awr-chat");
|
|
@@ -4274,7 +4399,7 @@ var McpAppFrame = ({
|
|
|
4274
4399
|
ro?.disconnect();
|
|
4275
4400
|
};
|
|
4276
4401
|
}, [fullscreen]);
|
|
4277
|
-
|
|
4402
|
+
useEffect8(() => {
|
|
4278
4403
|
if (!fullscreen) return;
|
|
4279
4404
|
const before = document.activeElement;
|
|
4280
4405
|
exitRef.current?.focus();
|
|
@@ -4291,10 +4416,10 @@ var McpAppFrame = ({
|
|
|
4291
4416
|
if (frame && (before === frame || document.activeElement === document.body)) frame.focus();
|
|
4292
4417
|
};
|
|
4293
4418
|
}, [fullscreen]);
|
|
4294
|
-
|
|
4419
|
+
useEffect8(() => {
|
|
4295
4420
|
if (theme) bridgeRef.current?.updateContext({ theme });
|
|
4296
4421
|
}, [theme]);
|
|
4297
|
-
|
|
4422
|
+
useEffect8(() => {
|
|
4298
4423
|
if (!menu) return;
|
|
4299
4424
|
const close = (e) => {
|
|
4300
4425
|
if (e instanceof KeyboardEvent ? e.key === "Escape" : !menuRef.current?.contains(e.target)) {
|
|
@@ -4599,7 +4724,7 @@ var McpAppLine = ({ app, note, action, onAction, labels, className }) => {
|
|
|
4599
4724
|
};
|
|
4600
4725
|
|
|
4601
4726
|
// src/components/AgentComposer.tsx
|
|
4602
|
-
import { useEffect as
|
|
4727
|
+
import { useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useMemo as useMemo6, useRef as useRef8, useState as useState9 } from "react";
|
|
4603
4728
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4604
4729
|
var thinkingDefaults = (l) => [
|
|
4605
4730
|
{ id: "off", label: l.thinkingLevels.off },
|
|
@@ -4611,10 +4736,10 @@ var thinkingDefaults = (l) => [
|
|
|
4611
4736
|
var MODES = ["autopilot", "ask-writes", "ask-all", "read-only"];
|
|
4612
4737
|
var ModeIcon = ({ mode }) => mode === "autopilot" ? /* @__PURE__ */ jsx5(BoltIcon, { size: 14 }) : mode === "read-only" ? /* @__PURE__ */ jsx5(EyeIcon, { size: 14 }) : /* @__PURE__ */ jsx5(ShieldIcon, { size: 14 });
|
|
4613
4738
|
var attachSeq = 0;
|
|
4614
|
-
var
|
|
4739
|
+
var useIsoLayoutEffect3 = typeof window === "undefined" ? useEffect9 : useLayoutEffect3;
|
|
4615
4740
|
var useMenuPlacement = (open, anchor, align) => {
|
|
4616
4741
|
const [style, setStyle] = useState9();
|
|
4617
|
-
|
|
4742
|
+
useIsoLayoutEffect3(() => {
|
|
4618
4743
|
if (!open) return;
|
|
4619
4744
|
const place = () => {
|
|
4620
4745
|
const el = anchor.current;
|
|
@@ -4698,12 +4823,12 @@ var AgentComposer = ({
|
|
|
4698
4823
|
const [dismissed, setDismissed] = useState9(() => /* @__PURE__ */ new Set());
|
|
4699
4824
|
const [attachError, setAttachError] = useState9();
|
|
4700
4825
|
const [dragging, setDragging] = useState9(false);
|
|
4701
|
-
const rootRef =
|
|
4702
|
-
const modelRef =
|
|
4703
|
-
const modeRef =
|
|
4826
|
+
const rootRef = useRef8(null);
|
|
4827
|
+
const modelRef = useRef8(null);
|
|
4828
|
+
const modeRef = useRef8(null);
|
|
4704
4829
|
const [dropRect, setDropRect] = useState9();
|
|
4705
4830
|
const [compactBar, setCompactBar] = useState9(false);
|
|
4706
|
-
|
|
4831
|
+
useEffect9(() => {
|
|
4707
4832
|
const el = rootRef.current;
|
|
4708
4833
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
4709
4834
|
const ro = new ResizeObserver(
|
|
@@ -4712,11 +4837,11 @@ var AgentComposer = ({
|
|
|
4712
4837
|
ro.observe(el);
|
|
4713
4838
|
return () => ro.disconnect();
|
|
4714
4839
|
}, [compactWidth]);
|
|
4715
|
-
const fileRef =
|
|
4716
|
-
const inputRef =
|
|
4840
|
+
const fileRef = useRef8(null);
|
|
4841
|
+
const inputRef = useRef8(null);
|
|
4717
4842
|
const draftId = draft?.id;
|
|
4718
4843
|
const draftText = draft?.text;
|
|
4719
|
-
|
|
4844
|
+
useEffect9(() => {
|
|
4720
4845
|
if (draftId === void 0 || !draftText) return;
|
|
4721
4846
|
setText((t) => t.trim() ? `${t.trimEnd()}
|
|
4722
4847
|
${draftText}` : draftText);
|
|
@@ -4736,7 +4861,7 @@ ${draftText}` : draftText);
|
|
|
4736
4861
|
const [startedAt, setStartedAt] = useState9();
|
|
4737
4862
|
const [now, setNow] = useState9(() => Date.now());
|
|
4738
4863
|
const [lastElapsed, setLastElapsed] = useState9();
|
|
4739
|
-
|
|
4864
|
+
useEffect9(() => {
|
|
4740
4865
|
if (!busy) {
|
|
4741
4866
|
if (startedAt !== void 0) setLastElapsed(Date.now() - startedAt);
|
|
4742
4867
|
setStartedAt(void 0);
|
|
@@ -4829,8 +4954,8 @@ ${draftText}` : draftText);
|
|
|
4829
4954
|
const commandsStyle = useMenuPlacement(paletteOpen, rootRef, "stretch");
|
|
4830
4955
|
const modelStyle = useMenuPlacement(menu === "model", modelRef, "left");
|
|
4831
4956
|
const modeStyle = useMenuPlacement(menu === "mode", modeRef, "right");
|
|
4832
|
-
|
|
4833
|
-
|
|
4957
|
+
useEffect9(() => setActive(0), [text, menu]);
|
|
4958
|
+
useEffect9(() => {
|
|
4834
4959
|
if (!menu) return;
|
|
4835
4960
|
const onDown = (e) => {
|
|
4836
4961
|
if (!rootRef.current?.contains(e.target)) setMenu(void 0);
|
|
@@ -4923,9 +5048,9 @@ ${draftText}` : draftText);
|
|
|
4923
5048
|
e.preventDefault();
|
|
4924
5049
|
void addFiles(pasted);
|
|
4925
5050
|
};
|
|
4926
|
-
const addFilesRef =
|
|
5051
|
+
const addFilesRef = useRef8(addFiles);
|
|
4927
5052
|
addFilesRef.current = addFiles;
|
|
4928
|
-
|
|
5053
|
+
useEffect9(() => {
|
|
4929
5054
|
if (attachments === false) return;
|
|
4930
5055
|
const target = dropZone === "window" ? globalThis.window : dropZone === "self" ? rootRef.current : dropZone.current;
|
|
4931
5056
|
if (!target) return;
|
|
@@ -5564,7 +5689,7 @@ var ContextMeter = ({
|
|
|
5564
5689
|
};
|
|
5565
5690
|
|
|
5566
5691
|
// src/components/ElicitationPrompt.tsx
|
|
5567
|
-
import { useEffect as
|
|
5692
|
+
import { useEffect as useEffect10, useId, useState as useState10 } from "react";
|
|
5568
5693
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
5569
5694
|
var reasonText = (outcome, L) => {
|
|
5570
5695
|
const reason = outcome.reason;
|
|
@@ -5575,7 +5700,7 @@ var reasonText = (outcome, L) => {
|
|
|
5575
5700
|
};
|
|
5576
5701
|
var useNow = (active) => {
|
|
5577
5702
|
const [now, setNow] = useState10(() => Date.now());
|
|
5578
|
-
|
|
5703
|
+
useEffect10(() => {
|
|
5579
5704
|
if (!active) return;
|
|
5580
5705
|
setNow(Date.now());
|
|
5581
5706
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -5887,8 +6012,256 @@ var ElicitationPrompt = ({
|
|
|
5887
6012
|
};
|
|
5888
6013
|
|
|
5889
6014
|
// src/components/FilesPanel.tsx
|
|
5890
|
-
import { Fragment as
|
|
5891
|
-
|
|
6015
|
+
import { Fragment as Fragment5, useEffect as useEffect12, useRef as useRef10, useState as useState12 } from "react";
|
|
6016
|
+
|
|
6017
|
+
// src/components/ImageViewer.tsx
|
|
6018
|
+
import { createContext as createContext3, useContext as useContext3, useEffect as useEffect11, useRef as useRef9, useState as useState11 } from "react";
|
|
6019
|
+
import { createPortal } from "react-dom";
|
|
6020
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
6021
|
+
var fileNameOf = (name) => name.split(/[\\/]/).filter(Boolean).pop() ?? name;
|
|
6022
|
+
var SWIPE_PX = 48;
|
|
6023
|
+
var ImageViewer = ({ images, index, onIndex, onClose, labels }) => {
|
|
6024
|
+
const L = useLabels(labels);
|
|
6025
|
+
const rootRef = useRef9(null);
|
|
6026
|
+
const closeRef = useRef9(null);
|
|
6027
|
+
const imgRef = useRef9(null);
|
|
6028
|
+
const touch = useRef9(void 0);
|
|
6029
|
+
const [zoom, setZoom] = useState11(void 0);
|
|
6030
|
+
const count = images.length;
|
|
6031
|
+
const at = Math.min(Math.max(index, 0), count - 1);
|
|
6032
|
+
const image = images[at];
|
|
6033
|
+
const go = (step) => {
|
|
6034
|
+
if (count < 2) return;
|
|
6035
|
+
setZoom(void 0);
|
|
6036
|
+
onIndex((at + step + count) % count);
|
|
6037
|
+
};
|
|
6038
|
+
useEffect11(() => {
|
|
6039
|
+
closeRef.current?.focus();
|
|
6040
|
+
const root = document.documentElement;
|
|
6041
|
+
const before = root.style.overflow;
|
|
6042
|
+
root.style.overflow = "hidden";
|
|
6043
|
+
return () => {
|
|
6044
|
+
root.style.overflow = before;
|
|
6045
|
+
};
|
|
6046
|
+
}, []);
|
|
6047
|
+
const keys = useRef9(() => {
|
|
6048
|
+
});
|
|
6049
|
+
keys.current = (e) => {
|
|
6050
|
+
if (e.key === "Escape") {
|
|
6051
|
+
e.preventDefault();
|
|
6052
|
+
e.stopPropagation();
|
|
6053
|
+
onClose();
|
|
6054
|
+
} else if (e.key === "ArrowLeft") go(-1);
|
|
6055
|
+
else if (e.key === "ArrowRight") go(1);
|
|
6056
|
+
else if (e.key === "Tab") {
|
|
6057
|
+
const stops = [
|
|
6058
|
+
...rootRef.current?.querySelectorAll("button, a[href]") ?? []
|
|
6059
|
+
].filter((el) => !el.hasAttribute("disabled"));
|
|
6060
|
+
if (!stops.length) return;
|
|
6061
|
+
const first = stops[0];
|
|
6062
|
+
const last = stops[stops.length - 1];
|
|
6063
|
+
const active = document.activeElement;
|
|
6064
|
+
if (!rootRef.current?.contains(active)) {
|
|
6065
|
+
e.preventDefault();
|
|
6066
|
+
(e.shiftKey ? last : first).focus();
|
|
6067
|
+
} else if (e.shiftKey ? active === first : active === last) {
|
|
6068
|
+
e.preventDefault();
|
|
6069
|
+
(e.shiftKey ? last : first).focus();
|
|
6070
|
+
}
|
|
6071
|
+
}
|
|
6072
|
+
};
|
|
6073
|
+
useEffect11(() => {
|
|
6074
|
+
const onKey = (e) => keys.current(e);
|
|
6075
|
+
document.addEventListener("keydown", onKey, true);
|
|
6076
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
6077
|
+
}, []);
|
|
6078
|
+
if (!image) return null;
|
|
6079
|
+
const toggleZoom = () => {
|
|
6080
|
+
const img = imgRef.current;
|
|
6081
|
+
if (zoom !== void 0 || !img) return setZoom(void 0);
|
|
6082
|
+
setZoom(Math.max(img.naturalWidth, Math.round(img.clientWidth * 2)));
|
|
6083
|
+
};
|
|
6084
|
+
const onTouchStart = (e) => {
|
|
6085
|
+
touch.current = e.touches.length === 1 ? { x: e.touches[0].clientX, y: e.touches[0].clientY } : void 0;
|
|
6086
|
+
};
|
|
6087
|
+
const onTouchEnd = (e) => {
|
|
6088
|
+
const from = touch.current;
|
|
6089
|
+
touch.current = void 0;
|
|
6090
|
+
if (!from || zoom !== void 0 || e.changedTouches.length !== 1) return;
|
|
6091
|
+
const dx = e.changedTouches[0].clientX - from.x;
|
|
6092
|
+
const dy = e.changedTouches[0].clientY - from.y;
|
|
6093
|
+
if (Math.abs(dx) > SWIPE_PX && Math.abs(dx) > Math.abs(dy) * 1.5) go(dx < 0 ? 1 : -1);
|
|
6094
|
+
};
|
|
6095
|
+
const name = fileNameOf(image.name);
|
|
6096
|
+
return /* @__PURE__ */ jsxs7("div", { ref: rootRef, className: "awr-viewer", role: "dialog", "aria-modal": "true", "aria-label": name, children: [
|
|
6097
|
+
/* @__PURE__ */ jsxs7("div", { className: "awr-viewer__bar", children: [
|
|
6098
|
+
/* @__PURE__ */ jsx9("span", { className: "awr-viewer__name", title: image.name, children: name }),
|
|
6099
|
+
count > 1 && /* @__PURE__ */ jsx9("span", { className: "awr-viewer__count", "aria-live": "polite", children: L.imageCount(at + 1, count) }),
|
|
6100
|
+
/* @__PURE__ */ jsx9(
|
|
6101
|
+
"button",
|
|
6102
|
+
{
|
|
6103
|
+
type: "button",
|
|
6104
|
+
className: "awr-iconbtn awr-viewer__zoom",
|
|
6105
|
+
"aria-label": L.imageZoom,
|
|
6106
|
+
title: L.imageZoom,
|
|
6107
|
+
"aria-pressed": zoom !== void 0,
|
|
6108
|
+
onClick: toggleZoom,
|
|
6109
|
+
children: zoom !== void 0 ? /* @__PURE__ */ jsx9(ShrinkIcon, { size: 18 }) : /* @__PURE__ */ jsx9(ExpandIcon, { size: 18 })
|
|
6110
|
+
}
|
|
6111
|
+
),
|
|
6112
|
+
/* @__PURE__ */ jsx9(
|
|
6113
|
+
"a",
|
|
6114
|
+
{
|
|
6115
|
+
className: "awr-iconbtn awr-viewer__download",
|
|
6116
|
+
href: image.src,
|
|
6117
|
+
download: name,
|
|
6118
|
+
"aria-label": L.fileDownload(name),
|
|
6119
|
+
title: L.download,
|
|
6120
|
+
children: /* @__PURE__ */ jsx9(DownloadIcon, { size: 18 })
|
|
6121
|
+
}
|
|
6122
|
+
),
|
|
6123
|
+
/* @__PURE__ */ jsx9(
|
|
6124
|
+
"button",
|
|
6125
|
+
{
|
|
6126
|
+
ref: closeRef,
|
|
6127
|
+
type: "button",
|
|
6128
|
+
className: "awr-iconbtn awr-viewer__close",
|
|
6129
|
+
"aria-label": L.close,
|
|
6130
|
+
title: L.close,
|
|
6131
|
+
onClick: onClose,
|
|
6132
|
+
children: /* @__PURE__ */ jsx9(XIcon, { size: 18 })
|
|
6133
|
+
}
|
|
6134
|
+
)
|
|
6135
|
+
] }),
|
|
6136
|
+
/* @__PURE__ */ jsx9(
|
|
6137
|
+
"div",
|
|
6138
|
+
{
|
|
6139
|
+
className: `awr-viewer__stage${zoom !== void 0 ? " is-zoomed" : ""}`,
|
|
6140
|
+
onClick: (e) => {
|
|
6141
|
+
if (e.target === e.currentTarget) onClose();
|
|
6142
|
+
},
|
|
6143
|
+
onTouchStart,
|
|
6144
|
+
onTouchEnd,
|
|
6145
|
+
children: /* @__PURE__ */ jsx9(
|
|
6146
|
+
"img",
|
|
6147
|
+
{
|
|
6148
|
+
ref: imgRef,
|
|
6149
|
+
className: "awr-viewer__img",
|
|
6150
|
+
src: image.src,
|
|
6151
|
+
alt: image.alt ?? name,
|
|
6152
|
+
style: zoom !== void 0 ? { width: zoom } : void 0,
|
|
6153
|
+
onClick: toggleZoom,
|
|
6154
|
+
onDoubleClick: (e) => e.preventDefault(),
|
|
6155
|
+
draggable: false
|
|
6156
|
+
},
|
|
6157
|
+
image.src
|
|
6158
|
+
)
|
|
6159
|
+
}
|
|
6160
|
+
),
|
|
6161
|
+
count > 1 && /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
6162
|
+
/* @__PURE__ */ jsx9(
|
|
6163
|
+
"button",
|
|
6164
|
+
{
|
|
6165
|
+
type: "button",
|
|
6166
|
+
className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--prev",
|
|
6167
|
+
"aria-label": L.imagePrevious,
|
|
6168
|
+
title: L.imagePrevious,
|
|
6169
|
+
onClick: () => go(-1),
|
|
6170
|
+
children: /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u2039" })
|
|
6171
|
+
}
|
|
6172
|
+
),
|
|
6173
|
+
/* @__PURE__ */ jsx9(
|
|
6174
|
+
"button",
|
|
6175
|
+
{
|
|
6176
|
+
type: "button",
|
|
6177
|
+
className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--next",
|
|
6178
|
+
"aria-label": L.imageNext,
|
|
6179
|
+
title: L.imageNext,
|
|
6180
|
+
onClick: () => go(1),
|
|
6181
|
+
children: /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u203A" })
|
|
6182
|
+
}
|
|
6183
|
+
)
|
|
6184
|
+
] })
|
|
6185
|
+
] });
|
|
6186
|
+
};
|
|
6187
|
+
var ImageViewerContext = createContext3({ enabled: true });
|
|
6188
|
+
var ImageViewerProvider = ({
|
|
6189
|
+
enabled = true,
|
|
6190
|
+
render,
|
|
6191
|
+
children
|
|
6192
|
+
}) => /* @__PURE__ */ jsx9(ImageViewerContext.Provider, { value: { enabled, render }, children });
|
|
6193
|
+
var imageExtensionOf = (src) => {
|
|
6194
|
+
const type = /^data:image\/([a-z0-9.+-]+)/i.exec(src)?.[1]?.toLowerCase();
|
|
6195
|
+
return !type ? "" : type === "jpeg" ? ".jpg" : type === "svg+xml" ? ".svg" : `.${type}`;
|
|
6196
|
+
};
|
|
6197
|
+
var groupOf = (button) => {
|
|
6198
|
+
const scope = button.closest(".awr-msg") ?? button.parentElement ?? button;
|
|
6199
|
+
const buttons = [...scope.querySelectorAll("[data-awr-image]")];
|
|
6200
|
+
const images = buttons.flatMap((b) => {
|
|
6201
|
+
const img = b.querySelector("img");
|
|
6202
|
+
return img ? [{ src: img.currentSrc || img.src, name: b.dataset.awrImage || img.alt, alt: img.alt }] : [];
|
|
6203
|
+
});
|
|
6204
|
+
return { images, index: Math.max(0, buttons.indexOf(button)) };
|
|
6205
|
+
};
|
|
6206
|
+
var ImageThumb = ({
|
|
6207
|
+
src,
|
|
6208
|
+
name,
|
|
6209
|
+
alt,
|
|
6210
|
+
className,
|
|
6211
|
+
imgClassName,
|
|
6212
|
+
title,
|
|
6213
|
+
labels
|
|
6214
|
+
}) => {
|
|
6215
|
+
const L = useLabels(labels);
|
|
6216
|
+
const { enabled, render } = useContext3(ImageViewerContext);
|
|
6217
|
+
const ref = useRef9(null);
|
|
6218
|
+
const [open, setOpen] = useState11(void 0);
|
|
6219
|
+
const img = /* @__PURE__ */ jsx9("img", { className: imgClassName, src, alt });
|
|
6220
|
+
if (!enabled) {
|
|
6221
|
+
return /* @__PURE__ */ jsx9("a", { className, href: src, target: "_blank", rel: "noopener noreferrer", title, children: img });
|
|
6222
|
+
}
|
|
6223
|
+
const close = () => {
|
|
6224
|
+
setOpen(void 0);
|
|
6225
|
+
ref.current?.focus();
|
|
6226
|
+
};
|
|
6227
|
+
const viewer = (o) => ({
|
|
6228
|
+
images: o.images,
|
|
6229
|
+
index: o.index,
|
|
6230
|
+
onIndex: (index) => setOpen({ ...o, index }),
|
|
6231
|
+
onClose: close,
|
|
6232
|
+
labels
|
|
6233
|
+
});
|
|
6234
|
+
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
6235
|
+
/* @__PURE__ */ jsx9(
|
|
6236
|
+
"button",
|
|
6237
|
+
{
|
|
6238
|
+
ref,
|
|
6239
|
+
type: "button",
|
|
6240
|
+
className: ["awr-imgbtn", className].filter(Boolean).join(" "),
|
|
6241
|
+
"data-awr-image": name,
|
|
6242
|
+
"aria-label": L.imageOpen(fileNameOf(name)),
|
|
6243
|
+
"aria-haspopup": "dialog",
|
|
6244
|
+
title,
|
|
6245
|
+
onClick: (e) => {
|
|
6246
|
+
const button = e.currentTarget;
|
|
6247
|
+
setOpen({
|
|
6248
|
+
...groupOf(button),
|
|
6249
|
+
// Inside the chat's element, so its theme applies; it covers the window from there.
|
|
6250
|
+
host: button.closest(".awr-chat, .awr-theme") ?? document.body
|
|
6251
|
+
});
|
|
6252
|
+
},
|
|
6253
|
+
children: img
|
|
6254
|
+
}
|
|
6255
|
+
),
|
|
6256
|
+
open && createPortal(
|
|
6257
|
+
render ? render(viewer(open), /* @__PURE__ */ jsx9(ImageViewer, { ...viewer(open) })) : /* @__PURE__ */ jsx9(ImageViewer, { ...viewer(open) }),
|
|
6258
|
+
open.host
|
|
6259
|
+
)
|
|
6260
|
+
] });
|
|
6261
|
+
};
|
|
6262
|
+
|
|
6263
|
+
// src/components/FilesPanel.tsx
|
|
6264
|
+
import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
5892
6265
|
var PREVIEW_CHARS = 2e4;
|
|
5893
6266
|
var FilesPanel = ({
|
|
5894
6267
|
files: vfs,
|
|
@@ -5904,9 +6277,9 @@ var FilesPanel = ({
|
|
|
5904
6277
|
}) => {
|
|
5905
6278
|
const L = useLabels(labels);
|
|
5906
6279
|
const fs = useVirtualFiles(vfs, prefix);
|
|
5907
|
-
const [preview, setPreview] =
|
|
5908
|
-
const inputRef =
|
|
5909
|
-
|
|
6280
|
+
const [preview, setPreview] = useState12();
|
|
6281
|
+
const inputRef = useRef10(null);
|
|
6282
|
+
useEffect12(() => {
|
|
5910
6283
|
if (preview && !fs.files.some((f) => f.path === preview.path)) setPreview(void 0);
|
|
5911
6284
|
}, [fs.files, preview]);
|
|
5912
6285
|
const open = async (f) => {
|
|
@@ -5929,11 +6302,11 @@ var FilesPanel = ({
|
|
|
5929
6302
|
a.download = f.path.split("/").pop() || "file";
|
|
5930
6303
|
a.click();
|
|
5931
6304
|
};
|
|
5932
|
-
return /* @__PURE__ */
|
|
5933
|
-
/* @__PURE__ */
|
|
5934
|
-
/* @__PURE__ */
|
|
5935
|
-
allowUpload && /* @__PURE__ */
|
|
5936
|
-
/* @__PURE__ */
|
|
6305
|
+
return /* @__PURE__ */ jsxs8("div", { className: ["awr-filespanel", className].filter(Boolean).join(" "), children: [
|
|
6306
|
+
/* @__PURE__ */ jsxs8("div", { className: "awr-panel__head", children: [
|
|
6307
|
+
/* @__PURE__ */ jsx10("span", { className: "awr-panel__title", children: title ?? L.files }),
|
|
6308
|
+
allowUpload && /* @__PURE__ */ jsxs8(Fragment6, { children: [
|
|
6309
|
+
/* @__PURE__ */ jsx10(
|
|
5937
6310
|
"button",
|
|
5938
6311
|
{
|
|
5939
6312
|
type: "button",
|
|
@@ -5941,10 +6314,10 @@ var FilesPanel = ({
|
|
|
5941
6314
|
"aria-label": L.upload,
|
|
5942
6315
|
title: L.upload,
|
|
5943
6316
|
onClick: () => inputRef.current?.click(),
|
|
5944
|
-
children: /* @__PURE__ */
|
|
6317
|
+
children: /* @__PURE__ */ jsx10(PlusIcon, { size: 16 })
|
|
5945
6318
|
}
|
|
5946
6319
|
),
|
|
5947
|
-
/* @__PURE__ */
|
|
6320
|
+
/* @__PURE__ */ jsx10(
|
|
5948
6321
|
"input",
|
|
5949
6322
|
{
|
|
5950
6323
|
ref: inputRef,
|
|
@@ -5959,15 +6332,15 @@ var FilesPanel = ({
|
|
|
5959
6332
|
)
|
|
5960
6333
|
] })
|
|
5961
6334
|
] }),
|
|
5962
|
-
fs.error && /* @__PURE__ */
|
|
5963
|
-
!fs.loading && fs.files.length === 0 && /* @__PURE__ */
|
|
5964
|
-
/* @__PURE__ */
|
|
5965
|
-
const row = /* @__PURE__ */
|
|
6335
|
+
fs.error && /* @__PURE__ */ jsx10("div", { className: "awr-notice awr-notice--warn", children: fs.error }),
|
|
6336
|
+
!fs.loading && fs.files.length === 0 && /* @__PURE__ */ jsx10("div", { className: "awr-panel__empty", children: L.filesEmpty }),
|
|
6337
|
+
/* @__PURE__ */ jsx10("ul", { className: "awr-filelist", children: fs.files.map((f) => {
|
|
6338
|
+
const row = /* @__PURE__ */ jsxs8(
|
|
5966
6339
|
"li",
|
|
5967
6340
|
{
|
|
5968
6341
|
className: `awr-filelist__item${preview?.path === f.path ? " is-active" : ""}`,
|
|
5969
6342
|
children: [
|
|
5970
|
-
/* @__PURE__ */
|
|
6343
|
+
/* @__PURE__ */ jsxs8(
|
|
5971
6344
|
"button",
|
|
5972
6345
|
{
|
|
5973
6346
|
type: "button",
|
|
@@ -5975,13 +6348,13 @@ var FilesPanel = ({
|
|
|
5975
6348
|
onClick: () => void open(f),
|
|
5976
6349
|
title: `${L.preview}: ${f.path}`,
|
|
5977
6350
|
children: [
|
|
5978
|
-
/* @__PURE__ */
|
|
5979
|
-
/* @__PURE__ */
|
|
5980
|
-
/* @__PURE__ */
|
|
6351
|
+
/* @__PURE__ */ jsx10(FileIcon, { size: 14 }),
|
|
6352
|
+
/* @__PURE__ */ jsx10("span", { className: "awr-filelist__path", children: f.path }),
|
|
6353
|
+
/* @__PURE__ */ jsx10("span", { className: "awr-filelist__size", children: L.bytes(f.size) })
|
|
5981
6354
|
]
|
|
5982
6355
|
}
|
|
5983
6356
|
),
|
|
5984
|
-
/* @__PURE__ */
|
|
6357
|
+
/* @__PURE__ */ jsx10(
|
|
5985
6358
|
"button",
|
|
5986
6359
|
{
|
|
5987
6360
|
type: "button",
|
|
@@ -5989,10 +6362,10 @@ var FilesPanel = ({
|
|
|
5989
6362
|
"aria-label": `${L.download} ${f.path}`,
|
|
5990
6363
|
title: L.download,
|
|
5991
6364
|
onClick: () => void download(f),
|
|
5992
|
-
children: /* @__PURE__ */
|
|
6365
|
+
children: /* @__PURE__ */ jsx10(DownloadIcon, { size: 14 })
|
|
5993
6366
|
}
|
|
5994
6367
|
),
|
|
5995
|
-
allowDelete && /* @__PURE__ */
|
|
6368
|
+
allowDelete && /* @__PURE__ */ jsx10(
|
|
5996
6369
|
"button",
|
|
5997
6370
|
{
|
|
5998
6371
|
type: "button",
|
|
@@ -6000,22 +6373,34 @@ var FilesPanel = ({
|
|
|
6000
6373
|
"aria-label": `${L.delete} ${f.path}`,
|
|
6001
6374
|
title: L.delete,
|
|
6002
6375
|
onClick: () => void fs.remove(f.path),
|
|
6003
|
-
children: /* @__PURE__ */
|
|
6376
|
+
children: /* @__PURE__ */ jsx10(XIcon, { size: 14 })
|
|
6004
6377
|
}
|
|
6005
6378
|
)
|
|
6006
6379
|
]
|
|
6007
6380
|
},
|
|
6008
6381
|
f.path
|
|
6009
6382
|
);
|
|
6010
|
-
return renderFile ? /* @__PURE__ */
|
|
6383
|
+
return renderFile ? /* @__PURE__ */ jsx10(Fragment5, { children: renderFile(f, row) }, f.path) : row;
|
|
6011
6384
|
}) }),
|
|
6012
|
-
preview && /* @__PURE__ */
|
|
6385
|
+
preview && /* @__PURE__ */ jsx10("div", { className: "awr-filepreview", children: preview.kind === "image" ? (
|
|
6386
|
+
// A click (Enter, Space) opens it over the chat, fitted to the screen.
|
|
6387
|
+
/* @__PURE__ */ jsx10(
|
|
6388
|
+
ImageThumb,
|
|
6389
|
+
{
|
|
6390
|
+
src: preview.src,
|
|
6391
|
+
name: preview.path,
|
|
6392
|
+
alt: preview.path,
|
|
6393
|
+
title: preview.path,
|
|
6394
|
+
labels
|
|
6395
|
+
}
|
|
6396
|
+
)
|
|
6397
|
+
) : /* @__PURE__ */ jsx10("pre", { children: preview.text.length > PREVIEW_CHARS ? `${preview.text.slice(0, PREVIEW_CHARS)}
|
|
6013
6398
|
\u2026` : preview.text }) })
|
|
6014
6399
|
] });
|
|
6015
6400
|
};
|
|
6016
6401
|
|
|
6017
6402
|
// src/components/FileChips.tsx
|
|
6018
|
-
import { Fragment as
|
|
6403
|
+
import { Fragment as Fragment7, useEffect as useEffect14, useMemo as useMemo7, useState as useState14 } from "react";
|
|
6019
6404
|
|
|
6020
6405
|
// src/file-kinds.ts
|
|
6021
6406
|
import { MEDIA_IMAGE_TYPES, isTextMime } from "@dudko.dev/agent-web";
|
|
@@ -6033,12 +6418,12 @@ var fileKindOf = (path, mediaType) => {
|
|
|
6033
6418
|
if (mime === "text/plain" || /\.(?:txt|log)$/i.test(path) || isTextMime(mime)) return "text";
|
|
6034
6419
|
return "file";
|
|
6035
6420
|
};
|
|
6036
|
-
var
|
|
6421
|
+
var fileNameOf2 = (path) => path.split("/").filter(Boolean).pop() || "file";
|
|
6037
6422
|
|
|
6038
6423
|
// src/components/Media.tsx
|
|
6039
|
-
import { useEffect as
|
|
6424
|
+
import { useEffect as useEffect13, useState as useState13 } from "react";
|
|
6040
6425
|
import { MEDIA_AUDIO_TYPES, MEDIA_IMAGE_TYPES as MEDIA_IMAGE_TYPES2 } from "@dudko.dev/agent-web";
|
|
6041
|
-
import { jsx as
|
|
6426
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6042
6427
|
var mediaFamilyOf = (mediaType) => {
|
|
6043
6428
|
const type = mediaType.toLowerCase().split(";")[0].trim();
|
|
6044
6429
|
if (Object.hasOwn(MEDIA_IMAGE_TYPES2, type)) return "image";
|
|
@@ -6053,8 +6438,8 @@ var bytesOf = (content, encoding) => {
|
|
|
6053
6438
|
return bytes;
|
|
6054
6439
|
};
|
|
6055
6440
|
var useFileUrl = (files, path, mediaType) => {
|
|
6056
|
-
const [url, setUrl] =
|
|
6057
|
-
|
|
6441
|
+
const [url, setUrl] = useState13(void 0);
|
|
6442
|
+
useEffect13(() => {
|
|
6058
6443
|
if (!files || !mediaType) return;
|
|
6059
6444
|
let made;
|
|
6060
6445
|
let gone = false;
|
|
@@ -6080,20 +6465,21 @@ var GeneratedMedia = ({ media, files, labels }) => {
|
|
|
6080
6465
|
const type = family ? media.mediaType.toLowerCase().split(";")[0].trim() : void 0;
|
|
6081
6466
|
const url = useFileUrl(files, media.path, type);
|
|
6082
6467
|
if (url && family === "image") {
|
|
6083
|
-
return /* @__PURE__ */
|
|
6084
|
-
|
|
6468
|
+
return /* @__PURE__ */ jsx11(
|
|
6469
|
+
ImageThumb,
|
|
6085
6470
|
{
|
|
6086
6471
|
className: "awr-media awr-media--image",
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6472
|
+
imgClassName: "awr-media__img",
|
|
6473
|
+
src: url,
|
|
6474
|
+
name: media.path,
|
|
6475
|
+
alt: L.mediaImage(media.path),
|
|
6090
6476
|
title: media.path,
|
|
6091
|
-
|
|
6477
|
+
labels
|
|
6092
6478
|
}
|
|
6093
6479
|
);
|
|
6094
6480
|
}
|
|
6095
6481
|
if (url && family === "audio") {
|
|
6096
|
-
return /* @__PURE__ */
|
|
6482
|
+
return /* @__PURE__ */ jsx11("span", { className: "awr-media awr-media--audio", title: media.path, children: /* @__PURE__ */ jsx11(
|
|
6097
6483
|
"audio",
|
|
6098
6484
|
{
|
|
6099
6485
|
className: "awr-media__audio",
|
|
@@ -6104,27 +6490,27 @@ var GeneratedMedia = ({ media, files, labels }) => {
|
|
|
6104
6490
|
}
|
|
6105
6491
|
) });
|
|
6106
6492
|
}
|
|
6107
|
-
return /* @__PURE__ */
|
|
6108
|
-
/* @__PURE__ */
|
|
6493
|
+
return /* @__PURE__ */ jsxs9("span", { className: "awr-chip awr-file awr-media awr-media--file", title: L.mediaFile(media.path), children: [
|
|
6494
|
+
/* @__PURE__ */ jsx11(FileIcon, { size: 13 }),
|
|
6109
6495
|
" ",
|
|
6110
6496
|
media.path
|
|
6111
6497
|
] });
|
|
6112
6498
|
};
|
|
6113
6499
|
var TranscriptBlock = ({ transcript, labels }) => {
|
|
6114
6500
|
const L = useLabels(labels);
|
|
6115
|
-
return /* @__PURE__ */
|
|
6116
|
-
/* @__PURE__ */
|
|
6117
|
-
/* @__PURE__ */
|
|
6501
|
+
return /* @__PURE__ */ jsxs9("details", { className: "awr-transcript", children: [
|
|
6502
|
+
/* @__PURE__ */ jsxs9("summary", { className: "awr-transcript__summary", children: [
|
|
6503
|
+
/* @__PURE__ */ jsx11(FileIcon, { size: 13 }),
|
|
6118
6504
|
" ",
|
|
6119
6505
|
L.transcriptOf(transcript.name)
|
|
6120
6506
|
] }),
|
|
6121
|
-
/* @__PURE__ */
|
|
6122
|
-
/* @__PURE__ */
|
|
6507
|
+
/* @__PURE__ */ jsx11("p", { className: "awr-transcript__note", children: L.transcriptNote }),
|
|
6508
|
+
/* @__PURE__ */ jsx11("blockquote", { className: "awr-transcript__text", children: transcript.text })
|
|
6123
6509
|
] });
|
|
6124
6510
|
};
|
|
6125
6511
|
|
|
6126
6512
|
// src/components/SandboxedFrame.tsx
|
|
6127
|
-
import { jsx as
|
|
6513
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6128
6514
|
var FRAME_MIN_HEIGHT = 120;
|
|
6129
6515
|
var FRAME_MAX_HEIGHT = 800;
|
|
6130
6516
|
var clampFrameHeight = (height) => Math.min(
|
|
@@ -6141,12 +6527,12 @@ var SandboxedFrame = ({
|
|
|
6141
6527
|
height = 300,
|
|
6142
6528
|
children,
|
|
6143
6529
|
className
|
|
6144
|
-
}) => /* @__PURE__ */
|
|
6145
|
-
/* @__PURE__ */
|
|
6146
|
-
/* @__PURE__ */
|
|
6530
|
+
}) => /* @__PURE__ */ jsxs10("div", { className: ["awr-frame", className].filter(Boolean).join(" "), children: [
|
|
6531
|
+
/* @__PURE__ */ jsxs10("div", { className: "awr-frame__head", children: [
|
|
6532
|
+
/* @__PURE__ */ jsx12("div", { className: "awr-frame__label", children: label }),
|
|
6147
6533
|
actions
|
|
6148
6534
|
] }),
|
|
6149
|
-
html !== void 0 && children === void 0 ? /* @__PURE__ */
|
|
6535
|
+
html !== void 0 && children === void 0 ? /* @__PURE__ */ jsx12("div", { className: "awr-frame__well", children: /* @__PURE__ */ jsx12(
|
|
6150
6536
|
"iframe",
|
|
6151
6537
|
{
|
|
6152
6538
|
className: "awr-frame__iframe",
|
|
@@ -6158,11 +6544,11 @@ var SandboxedFrame = ({
|
|
|
6158
6544
|
},
|
|
6159
6545
|
scripts ? "scripts" : "static"
|
|
6160
6546
|
) }) : children,
|
|
6161
|
-
footer ? /* @__PURE__ */
|
|
6547
|
+
footer ? /* @__PURE__ */ jsx12("div", { className: "awr-frame__foot", children: footer }) : null
|
|
6162
6548
|
] });
|
|
6163
6549
|
|
|
6164
6550
|
// src/components/FileChips.tsx
|
|
6165
|
-
import { Fragment as
|
|
6551
|
+
import { Fragment as Fragment8, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6166
6552
|
var FILE_PREVIEW_CHARS = 2e4;
|
|
6167
6553
|
var textOf = (file) => file.encoding === "base64" ? new TextDecoder().decode(bytesOf(file.content, "base64")) : file.content;
|
|
6168
6554
|
var KIND_ICON = {
|
|
@@ -6183,11 +6569,11 @@ var downloadFile = async (vfs, path) => {
|
|
|
6183
6569
|
);
|
|
6184
6570
|
const a = document.createElement("a");
|
|
6185
6571
|
a.href = url;
|
|
6186
|
-
a.download =
|
|
6572
|
+
a.download = fileNameOf2(path);
|
|
6187
6573
|
a.click();
|
|
6188
6574
|
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
6189
6575
|
};
|
|
6190
|
-
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */
|
|
6576
|
+
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ jsx13("div", { className: "awr-seg", role: "group", "aria-label": label, children: options.map((o) => /* @__PURE__ */ jsxs11(
|
|
6191
6577
|
"button",
|
|
6192
6578
|
{
|
|
6193
6579
|
type: "button",
|
|
@@ -6226,14 +6612,14 @@ var SourceView = ({
|
|
|
6226
6612
|
() => linesOf(html ? tokenizeHtml(shown) : [{ kind: "text", text: shown }]),
|
|
6227
6613
|
[shown, html]
|
|
6228
6614
|
);
|
|
6229
|
-
return /* @__PURE__ */
|
|
6230
|
-
/* @__PURE__ */
|
|
6615
|
+
return /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6616
|
+
/* @__PURE__ */ jsx13("pre", { className: ["awr-source", className].filter(Boolean).join(" "), tabIndex: 0, children: lines.map((line, i) => /* @__PURE__ */ jsxs11("span", { className: "awr-source__line", children: [
|
|
6231
6617
|
line.map(
|
|
6232
|
-
(t, k) => t.kind === "text" ? /* @__PURE__ */
|
|
6618
|
+
(t, k) => t.kind === "text" ? /* @__PURE__ */ jsx13(Fragment7, { children: t.text }, k) : /* @__PURE__ */ jsx13("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
|
|
6233
6619
|
),
|
|
6234
6620
|
"\n"
|
|
6235
6621
|
] }, i)) }),
|
|
6236
|
-
cut && /* @__PURE__ */
|
|
6622
|
+
cut && /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.fileCut(maxChars) })
|
|
6237
6623
|
] });
|
|
6238
6624
|
};
|
|
6239
6625
|
var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
@@ -6241,13 +6627,13 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6241
6627
|
const options = htmlPreview === false ? void 0 : htmlPreview;
|
|
6242
6628
|
const tooLarge = html.length > HTML_PREVIEW_MAX_CHARS;
|
|
6243
6629
|
const canFrame = Boolean(options) && !tooLarge;
|
|
6244
|
-
const [view, setView] =
|
|
6245
|
-
const [tall, setTall] =
|
|
6630
|
+
const [view, setView] = useState14(canFrame ? "preview" : "source");
|
|
6631
|
+
const [tall, setTall] = useState14(false);
|
|
6246
6632
|
const showing = canFrame ? view : "source";
|
|
6247
6633
|
const scripts = options?.scripts === true;
|
|
6248
6634
|
const height = options?.height ?? 300;
|
|
6249
6635
|
const linked = useMemo7(() => showing === "preview" ? linkedFilesOf(html) : [], [html, showing]);
|
|
6250
|
-
return /* @__PURE__ */
|
|
6636
|
+
return /* @__PURE__ */ jsx13(
|
|
6251
6637
|
SandboxedFrame,
|
|
6252
6638
|
{
|
|
6253
6639
|
className: "awr-frame--html",
|
|
@@ -6255,35 +6641,35 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6255
6641
|
html: showing === "preview" ? html : void 0,
|
|
6256
6642
|
scripts,
|
|
6257
6643
|
height: tall ? height * 2 : height,
|
|
6258
|
-
label: /* @__PURE__ */
|
|
6259
|
-
/* @__PURE__ */
|
|
6260
|
-
/* @__PURE__ */
|
|
6261
|
-
/* @__PURE__ */
|
|
6262
|
-
/* @__PURE__ */
|
|
6263
|
-
/* @__PURE__ */
|
|
6644
|
+
label: /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6645
|
+
/* @__PURE__ */ jsx13(CodeIcon, { size: 14, className: "awr-frame__icon" }),
|
|
6646
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-frame__titles", children: [
|
|
6647
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
|
|
6648
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6649
|
+
/* @__PURE__ */ jsx13(LockIcon, { size: 11 }),
|
|
6264
6650
|
" ",
|
|
6265
6651
|
L.htmlSandboxed,
|
|
6266
6652
|
" \xB7 ",
|
|
6267
|
-
/* @__PURE__ */
|
|
6653
|
+
/* @__PURE__ */ jsx13(NoNetworkIcon, { size: 11 }),
|
|
6268
6654
|
" ",
|
|
6269
6655
|
L.htmlNoNetwork
|
|
6270
6656
|
] }) : L.htmlSourceNote })
|
|
6271
6657
|
] })
|
|
6272
6658
|
] }),
|
|
6273
|
-
actions: canFrame ? /* @__PURE__ */
|
|
6274
|
-
/* @__PURE__ */
|
|
6659
|
+
actions: canFrame ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6660
|
+
/* @__PURE__ */ jsx13(
|
|
6275
6661
|
Seg,
|
|
6276
6662
|
{
|
|
6277
6663
|
label: L.htmlFrameTitle,
|
|
6278
6664
|
value: showing,
|
|
6279
6665
|
onChange: setView,
|
|
6280
6666
|
options: [
|
|
6281
|
-
{ value: "preview", label: L.preview, icon: /* @__PURE__ */
|
|
6282
|
-
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */
|
|
6667
|
+
{ value: "preview", label: L.preview, icon: /* @__PURE__ */ jsx13(EyeIcon, { size: 13 }) },
|
|
6668
|
+
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */ jsx13(CodeIcon, { size: 13 }) }
|
|
6283
6669
|
]
|
|
6284
6670
|
}
|
|
6285
6671
|
),
|
|
6286
|
-
/* @__PURE__ */
|
|
6672
|
+
/* @__PURE__ */ jsx13(
|
|
6287
6673
|
"button",
|
|
6288
6674
|
{
|
|
6289
6675
|
type: "button",
|
|
@@ -6293,14 +6679,14 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6293
6679
|
"aria-pressed": tall,
|
|
6294
6680
|
disabled: showing !== "preview",
|
|
6295
6681
|
onClick: () => setTall((t) => !t),
|
|
6296
|
-
children: /* @__PURE__ */
|
|
6682
|
+
children: /* @__PURE__ */ jsx13(ExpandIcon, { size: 15 })
|
|
6297
6683
|
}
|
|
6298
6684
|
)
|
|
6299
6685
|
] }) : void 0,
|
|
6300
|
-
footer: /* @__PURE__ */
|
|
6301
|
-
/* @__PURE__ */
|
|
6302
|
-
/* @__PURE__ */
|
|
6303
|
-
/* @__PURE__ */
|
|
6686
|
+
footer: /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6687
|
+
/* @__PURE__ */ jsx13(FileIcon, { size: 11 }),
|
|
6688
|
+
/* @__PURE__ */ jsx13("code", { children: written.path }),
|
|
6689
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-frame__footmeta", children: [
|
|
6304
6690
|
"\xB7 ",
|
|
6305
6691
|
L.bytes(file.size),
|
|
6306
6692
|
" \xB7",
|
|
@@ -6309,18 +6695,18 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6309
6695
|
linked.length > 0 ? ` \xB7 ${L.htmlLinkedFiles(linked.join(", "))}` : ""
|
|
6310
6696
|
] })
|
|
6311
6697
|
] }),
|
|
6312
|
-
children: showing === "source" ? /* @__PURE__ */
|
|
6313
|
-
tooLarge && options ? /* @__PURE__ */
|
|
6314
|
-
/* @__PURE__ */
|
|
6698
|
+
children: showing === "source" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6699
|
+
tooLarge && options ? /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
|
|
6700
|
+
/* @__PURE__ */ jsx13(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
|
|
6315
6701
|
] }) : void 0
|
|
6316
6702
|
}
|
|
6317
6703
|
);
|
|
6318
6704
|
};
|
|
6319
6705
|
var ImagePreview = ({ written, vfs, onClose, L }) => {
|
|
6320
6706
|
const url = useFileUrl(vfs, written.path, written.mediaType.toLowerCase().split(";")[0].trim());
|
|
6321
|
-
return /* @__PURE__ */
|
|
6322
|
-
/* @__PURE__ */
|
|
6323
|
-
/* @__PURE__ */
|
|
6707
|
+
return /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
|
|
6708
|
+
/* @__PURE__ */ jsx13(FileViewHead, { written, kind: "image", onClose, L }),
|
|
6709
|
+
/* @__PURE__ */ jsx13("div", { className: "awr-fileview__image", children: url ? /* @__PURE__ */ jsx13("img", { src: url, alt: fileNameOf2(written.path) }) : null })
|
|
6324
6710
|
] });
|
|
6325
6711
|
};
|
|
6326
6712
|
var FileViewHead = ({
|
|
@@ -6329,15 +6715,15 @@ var FileViewHead = ({
|
|
|
6329
6715
|
onClose,
|
|
6330
6716
|
L,
|
|
6331
6717
|
children
|
|
6332
|
-
}) => /* @__PURE__ */
|
|
6333
|
-
/* @__PURE__ */
|
|
6334
|
-
/* @__PURE__ */
|
|
6718
|
+
}) => /* @__PURE__ */ jsxs11("div", { className: "awr-fileview__head", children: [
|
|
6719
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-fileview__name", title: written.path, children: fileNameOf2(written.path) }),
|
|
6720
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-fileview__kind", children: [
|
|
6335
6721
|
"\xB7 ",
|
|
6336
6722
|
L.fileKinds[kind]
|
|
6337
6723
|
] }),
|
|
6338
|
-
/* @__PURE__ */
|
|
6724
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-fileview__actions", children: [
|
|
6339
6725
|
children,
|
|
6340
|
-
/* @__PURE__ */
|
|
6726
|
+
/* @__PURE__ */ jsx13(
|
|
6341
6727
|
"button",
|
|
6342
6728
|
{
|
|
6343
6729
|
type: "button",
|
|
@@ -6345,7 +6731,7 @@ var FileViewHead = ({
|
|
|
6345
6731
|
"aria-label": L.closePreview,
|
|
6346
6732
|
title: L.closePreview,
|
|
6347
6733
|
onClick: onClose,
|
|
6348
|
-
children: /* @__PURE__ */
|
|
6734
|
+
children: /* @__PURE__ */ jsx13(XIcon, { size: 14 })
|
|
6349
6735
|
}
|
|
6350
6736
|
)
|
|
6351
6737
|
] })
|
|
@@ -6365,15 +6751,15 @@ var TextPreview = ({
|
|
|
6365
6751
|
[renderFileContent, written, text, previewChars]
|
|
6366
6752
|
);
|
|
6367
6753
|
const hasRendered = rendered !== void 0 && rendered !== null && rendered !== false;
|
|
6368
|
-
const [view, setView] =
|
|
6369
|
-
const [all, setAll] =
|
|
6754
|
+
const [view, setView] = useState14("rendered");
|
|
6755
|
+
const [all, setAll] = useState14(false);
|
|
6370
6756
|
const showing = hasRendered ? view : "source";
|
|
6371
6757
|
const long = text.length > 1200 || text.split("\n").length > 16;
|
|
6372
|
-
return /* @__PURE__ */
|
|
6373
|
-
/* @__PURE__ */
|
|
6758
|
+
return /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
|
|
6759
|
+
/* @__PURE__ */ jsx13(FileViewHead, { written, kind, onClose, L, children: hasRendered && /* @__PURE__ */ jsx13(
|
|
6374
6760
|
Seg,
|
|
6375
6761
|
{
|
|
6376
|
-
label:
|
|
6762
|
+
label: fileNameOf2(written.path),
|
|
6377
6763
|
value: showing,
|
|
6378
6764
|
onChange: setView,
|
|
6379
6765
|
options: [
|
|
@@ -6382,16 +6768,16 @@ var TextPreview = ({
|
|
|
6382
6768
|
]
|
|
6383
6769
|
}
|
|
6384
6770
|
) }),
|
|
6385
|
-
/* @__PURE__ */
|
|
6386
|
-
/* @__PURE__ */
|
|
6387
|
-
text.length > previewChars && /* @__PURE__ */
|
|
6388
|
-
] }) : /* @__PURE__ */
|
|
6389
|
-
long && /* @__PURE__ */
|
|
6771
|
+
/* @__PURE__ */ jsx13("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6772
|
+
/* @__PURE__ */ jsx13("div", { className: "awr-fileview__rendered", children: rendered }),
|
|
6773
|
+
text.length > previewChars && /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
|
|
6774
|
+
] }) : /* @__PURE__ */ jsx13(SourceView, { text, maxChars: previewChars }) }),
|
|
6775
|
+
long && /* @__PURE__ */ jsx13("div", { className: "awr-fileview__more", children: /* @__PURE__ */ jsx13("button", { type: "button", className: "awr-linkbtn", onClick: () => setAll((a) => !a), children: all ? L.fileShowLess : L.fileShowRest }) })
|
|
6390
6776
|
] });
|
|
6391
6777
|
};
|
|
6392
|
-
var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */
|
|
6393
|
-
/* @__PURE__ */
|
|
6394
|
-
/* @__PURE__ */
|
|
6778
|
+
var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
|
|
6779
|
+
/* @__PURE__ */ jsx13(FileViewHead, { written, kind, onClose, L }),
|
|
6780
|
+
/* @__PURE__ */ jsx13("p", { className: "awr-fileview__none", children: L.fileNoPreview })
|
|
6395
6781
|
] });
|
|
6396
6782
|
var FileChips = ({
|
|
6397
6783
|
written,
|
|
@@ -6408,11 +6794,11 @@ var FileChips = ({
|
|
|
6408
6794
|
}) => {
|
|
6409
6795
|
const L = useLabels(labels);
|
|
6410
6796
|
const live = useVirtualFiles(vfs);
|
|
6411
|
-
const [openPath, setOpenPath] =
|
|
6412
|
-
const [file, setFile] =
|
|
6797
|
+
const [openPath, setOpenPath] = useState14(defaultOpen);
|
|
6798
|
+
const [file, setFile] = useState14();
|
|
6413
6799
|
const open = written.find((f) => f.path === openPath);
|
|
6414
6800
|
const stamp = live.files.find((f) => f.path === openPath)?.updatedAt;
|
|
6415
|
-
|
|
6801
|
+
useEffect14(() => {
|
|
6416
6802
|
if (!vfs || !openPath) return setFile(void 0);
|
|
6417
6803
|
let gone = false;
|
|
6418
6804
|
vfs.read(openPath).then((f) => {
|
|
@@ -6439,23 +6825,23 @@ var FileChips = ({
|
|
|
6439
6825
|
onClose: () => setOpenPath(void 0),
|
|
6440
6826
|
L
|
|
6441
6827
|
};
|
|
6442
|
-
if (kind === "html") return /* @__PURE__ */
|
|
6443
|
-
if (kind === "image") return /* @__PURE__ */
|
|
6444
|
-
if (kind === "file") return /* @__PURE__ */
|
|
6445
|
-
return /* @__PURE__ */
|
|
6828
|
+
if (kind === "html") return /* @__PURE__ */ jsx13(HtmlPreview, { ...props }, open.path);
|
|
6829
|
+
if (kind === "image") return /* @__PURE__ */ jsx13(ImagePreview, { ...props }, open.path);
|
|
6830
|
+
if (kind === "file") return /* @__PURE__ */ jsx13(NoPreview, { ...props }, open.path);
|
|
6831
|
+
return /* @__PURE__ */ jsx13(TextPreview, { ...props }, open.path);
|
|
6446
6832
|
};
|
|
6447
|
-
return /* @__PURE__ */
|
|
6448
|
-
showHeader && /* @__PURE__ */
|
|
6449
|
-
/* @__PURE__ */
|
|
6450
|
-
/* @__PURE__ */
|
|
6451
|
-
onShowFiles && /* @__PURE__ */
|
|
6833
|
+
return /* @__PURE__ */ jsxs11("div", { className: ["awr-msg__files", className].filter(Boolean).join(" "), children: [
|
|
6834
|
+
showHeader && /* @__PURE__ */ jsxs11("div", { className: "awr-msg__fileshead", children: [
|
|
6835
|
+
/* @__PURE__ */ jsx13(FileIcon, { size: 13 }),
|
|
6836
|
+
/* @__PURE__ */ jsx13("span", { children: L.filesWritten(written.length) }),
|
|
6837
|
+
onShowFiles && /* @__PURE__ */ jsx13("button", { type: "button", className: "awr-linkbtn", onClick: onShowFiles, children: L.showInFiles })
|
|
6452
6838
|
] }),
|
|
6453
|
-
/* @__PURE__ */
|
|
6839
|
+
/* @__PURE__ */ jsx13("ul", { className: "awr-filechips", children: written.map((w) => {
|
|
6454
6840
|
const info = live.files.find((f) => f.path === w.path);
|
|
6455
6841
|
const gone = Boolean(vfs) && !live.loading && !info;
|
|
6456
6842
|
const usable = Boolean(vfs) && !gone;
|
|
6457
6843
|
const isOpen = openPath === w.path && usable;
|
|
6458
|
-
const chip = /* @__PURE__ */
|
|
6844
|
+
const chip = /* @__PURE__ */ jsx13(
|
|
6459
6845
|
FileChip,
|
|
6460
6846
|
{
|
|
6461
6847
|
written: w,
|
|
@@ -6468,7 +6854,7 @@ var FileChips = ({
|
|
|
6468
6854
|
labels
|
|
6469
6855
|
}
|
|
6470
6856
|
);
|
|
6471
|
-
return /* @__PURE__ */
|
|
6857
|
+
return /* @__PURE__ */ jsx13("li", { className: "awr-filechips__item", children: renderFile ? renderFile(w, chip) : chip }, w.path);
|
|
6472
6858
|
}) }),
|
|
6473
6859
|
preview()
|
|
6474
6860
|
] });
|
|
@@ -6485,7 +6871,7 @@ var FileChip = ({
|
|
|
6485
6871
|
}) => {
|
|
6486
6872
|
const L = useLabels(labels);
|
|
6487
6873
|
const kind = fileKindOf(written.path, mediaType);
|
|
6488
|
-
const name =
|
|
6874
|
+
const name = fileNameOf2(written.path);
|
|
6489
6875
|
const Icon = KIND_ICON[kind];
|
|
6490
6876
|
const thumb = useFileUrl(
|
|
6491
6877
|
kind === "image" ? vfs : void 0,
|
|
@@ -6493,19 +6879,19 @@ var FileChip = ({
|
|
|
6493
6879
|
kind === "image" ? mediaType.toLowerCase().split(";")[0].trim() : void 0
|
|
6494
6880
|
);
|
|
6495
6881
|
const meta = gone ? L.fileGone : [L.fileKinds[kind], L.bytes(bytes), written.by ? L.fileBy(written.by.name) : ""].filter(Boolean).join(" \xB7 ");
|
|
6496
|
-
return /* @__PURE__ */
|
|
6882
|
+
return /* @__PURE__ */ jsxs11(
|
|
6497
6883
|
"div",
|
|
6498
6884
|
{
|
|
6499
6885
|
className: `awr-filechip${open ? " is-open" : ""}${gone ? " is-gone" : ""}`,
|
|
6500
6886
|
title: written.path,
|
|
6501
6887
|
children: [
|
|
6502
|
-
/* @__PURE__ */
|
|
6503
|
-
/* @__PURE__ */
|
|
6504
|
-
/* @__PURE__ */
|
|
6505
|
-
/* @__PURE__ */
|
|
6888
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-filechip__thumb", children: thumb ? /* @__PURE__ */ jsx13("img", { src: thumb, alt: "" }) : /* @__PURE__ */ jsx13(Icon, { size: 16 }) }),
|
|
6889
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-filechip__text", children: [
|
|
6890
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-filechip__name", children: name }),
|
|
6891
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-filechip__meta", children: meta })
|
|
6506
6892
|
] }),
|
|
6507
|
-
vfs && /* @__PURE__ */
|
|
6508
|
-
onToggle && /* @__PURE__ */
|
|
6893
|
+
vfs && /* @__PURE__ */ jsxs11("span", { className: "awr-filechip__actions", children: [
|
|
6894
|
+
onToggle && /* @__PURE__ */ jsx13(
|
|
6509
6895
|
"button",
|
|
6510
6896
|
{
|
|
6511
6897
|
type: "button",
|
|
@@ -6514,10 +6900,10 @@ var FileChip = ({
|
|
|
6514
6900
|
title: open ? L.closePreview : L.preview,
|
|
6515
6901
|
"aria-expanded": open,
|
|
6516
6902
|
onClick: onToggle,
|
|
6517
|
-
children: open ? /* @__PURE__ */
|
|
6903
|
+
children: open ? /* @__PURE__ */ jsx13(ChevronUpIcon, { size: 15 }) : /* @__PURE__ */ jsx13(EyeIcon, { size: 15 })
|
|
6518
6904
|
}
|
|
6519
6905
|
),
|
|
6520
|
-
/* @__PURE__ */
|
|
6906
|
+
/* @__PURE__ */ jsx13(
|
|
6521
6907
|
"button",
|
|
6522
6908
|
{
|
|
6523
6909
|
type: "button",
|
|
@@ -6525,7 +6911,7 @@ var FileChip = ({
|
|
|
6525
6911
|
"aria-label": L.fileDownload(name),
|
|
6526
6912
|
title: L.download,
|
|
6527
6913
|
onClick: () => void downloadFile(vfs, written.path),
|
|
6528
|
-
children: /* @__PURE__ */
|
|
6914
|
+
children: /* @__PURE__ */ jsx13(DownloadIcon, { size: 15 })
|
|
6529
6915
|
}
|
|
6530
6916
|
)
|
|
6531
6917
|
] })
|
|
@@ -6535,14 +6921,14 @@ var FileChip = ({
|
|
|
6535
6921
|
};
|
|
6536
6922
|
|
|
6537
6923
|
// src/components/StepList.tsx
|
|
6538
|
-
import { Fragment as
|
|
6924
|
+
import { Fragment as Fragment10 } from "react";
|
|
6539
6925
|
|
|
6540
6926
|
// src/components/SubagentTree.tsx
|
|
6541
|
-
import { Fragment as
|
|
6542
|
-
import { jsx as
|
|
6927
|
+
import { Fragment as Fragment9, useEffect as useEffect15, useState as useState15 } from "react";
|
|
6928
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6543
6929
|
var useElapsed = (startedAt, running) => {
|
|
6544
|
-
const [now, setNow] =
|
|
6545
|
-
|
|
6930
|
+
const [now, setNow] = useState15(void 0);
|
|
6931
|
+
useEffect15(() => {
|
|
6546
6932
|
if (!running || startedAt === void 0) return;
|
|
6547
6933
|
setNow(Date.now());
|
|
6548
6934
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -6570,19 +6956,19 @@ var SubagentRow = ({
|
|
|
6570
6956
|
sub.toolCalls > 0 ? L.toolCalls(sub.toolCalls) : "",
|
|
6571
6957
|
time !== void 0 ? formatDuration(time) : ""
|
|
6572
6958
|
].filter(Boolean);
|
|
6573
|
-
return /* @__PURE__ */
|
|
6959
|
+
return /* @__PURE__ */ jsxs12(
|
|
6574
6960
|
"li",
|
|
6575
6961
|
{
|
|
6576
6962
|
className: `awr-subagent awr-subagent--${sub.status}${sub.dynamic ? " awr-subagent--dynamic" : ""}`,
|
|
6577
6963
|
"data-depth": sub.depth,
|
|
6578
6964
|
children: [
|
|
6579
|
-
/* @__PURE__ */
|
|
6580
|
-
/* @__PURE__ */
|
|
6581
|
-
/* @__PURE__ */
|
|
6582
|
-
sub.dynamic && role && /* @__PURE__ */
|
|
6583
|
-
sub.profile && /* @__PURE__ */
|
|
6584
|
-
/* @__PURE__ */
|
|
6585
|
-
running && onStop && /* @__PURE__ */
|
|
6965
|
+
/* @__PURE__ */ jsxs12("div", { className: "awr-subagent__head", children: [
|
|
6966
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ jsx14(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ jsx14(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ jsx14(StopIcon, { size: 13 }) : /* @__PURE__ */ jsx14(AlertIcon, { size: 13 }) }),
|
|
6967
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
|
|
6968
|
+
sub.dynamic && role && /* @__PURE__ */ jsx14("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
|
|
6969
|
+
sub.profile && /* @__PURE__ */ jsx14("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
6970
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
6971
|
+
running && onStop && /* @__PURE__ */ jsx14(
|
|
6586
6972
|
"button",
|
|
6587
6973
|
{
|
|
6588
6974
|
type: "button",
|
|
@@ -6590,16 +6976,16 @@ var SubagentRow = ({
|
|
|
6590
6976
|
"aria-label": L.stopSubagent,
|
|
6591
6977
|
title: L.stopSubagent,
|
|
6592
6978
|
onClick: () => onStop(sub.id),
|
|
6593
|
-
children: /* @__PURE__ */
|
|
6979
|
+
children: /* @__PURE__ */ jsx14(StopIcon, { size: 12 })
|
|
6594
6980
|
}
|
|
6595
6981
|
)
|
|
6596
6982
|
] }),
|
|
6597
|
-
showUsage && /* @__PURE__ */
|
|
6598
|
-
/* @__PURE__ */
|
|
6599
|
-
meta.map((part, i) => /* @__PURE__ */
|
|
6983
|
+
showUsage && /* @__PURE__ */ jsxs12("div", { className: "awr-subagent__meta", children: [
|
|
6984
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
|
|
6985
|
+
meta.map((part, i) => /* @__PURE__ */ jsx14("span", { className: "awr-subagent__metaitem", children: part }, i))
|
|
6600
6986
|
] }),
|
|
6601
|
-
showTools && sub.tools && /* @__PURE__ */
|
|
6602
|
-
/* @__PURE__ */
|
|
6987
|
+
showTools && sub.tools && /* @__PURE__ */ jsx14("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
|
|
6988
|
+
/* @__PURE__ */ jsx14("div", { className: "awr-subagent__activity", children: sub.status === "error" ? sub.error : sub.status === "stopped" ? L.subagentStopped : sub.status === "done" ? previewValue(sub.text, 160) : `${sub.activity}${!showUsage && sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` }),
|
|
6603
6989
|
children
|
|
6604
6990
|
]
|
|
6605
6991
|
}
|
|
@@ -6615,12 +7001,12 @@ var SubagentTree = ({
|
|
|
6615
7001
|
className
|
|
6616
7002
|
}) => {
|
|
6617
7003
|
if (subagents.length === 0) return null;
|
|
6618
|
-
const branch = (nodes, nested) => /* @__PURE__ */
|
|
7004
|
+
const branch = (nodes, nested) => /* @__PURE__ */ jsx14(
|
|
6619
7005
|
"ul",
|
|
6620
7006
|
{
|
|
6621
7007
|
className: ["awr-subagents", nested ? "awr-subagents--nested" : className].filter(Boolean).join(" "),
|
|
6622
7008
|
children: nodes.map((node) => {
|
|
6623
|
-
const row = /* @__PURE__ */
|
|
7009
|
+
const row = /* @__PURE__ */ jsx14(
|
|
6624
7010
|
SubagentRow,
|
|
6625
7011
|
{
|
|
6626
7012
|
sub: node,
|
|
@@ -6632,7 +7018,7 @@ var SubagentTree = ({
|
|
|
6632
7018
|
},
|
|
6633
7019
|
node.id
|
|
6634
7020
|
);
|
|
6635
|
-
return renderSubagent ? /* @__PURE__ */
|
|
7021
|
+
return renderSubagent ? /* @__PURE__ */ jsx14(Fragment9, { children: renderSubagent(node, row) }, node.id) : row;
|
|
6636
7022
|
})
|
|
6637
7023
|
}
|
|
6638
7024
|
);
|
|
@@ -6640,7 +7026,7 @@ var SubagentTree = ({
|
|
|
6640
7026
|
};
|
|
6641
7027
|
|
|
6642
7028
|
// src/components/StepList.tsx
|
|
6643
|
-
import { jsx as
|
|
7029
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6644
7030
|
var WEB_SEARCH = "web_search";
|
|
6645
7031
|
var ToolCallRow = ({
|
|
6646
7032
|
call,
|
|
@@ -6658,37 +7044,47 @@ var ToolCallRow = ({
|
|
|
6658
7044
|
call.outputTokens ? `\u2248${formatTokens(call.outputTokens)} out` : "",
|
|
6659
7045
|
call.durationMs !== void 0 ? formatDuration(call.durationMs) : ""
|
|
6660
7046
|
].filter(Boolean).join(" \xB7 ");
|
|
6661
|
-
return /* @__PURE__ */
|
|
7047
|
+
return /* @__PURE__ */ jsxs13(
|
|
6662
7048
|
"li",
|
|
6663
7049
|
{
|
|
6664
7050
|
className: `awr-tool awr-tool--${state}${showTiers && call.attempt !== void 0 ? " awr-tool--earlier" : ""}`,
|
|
6665
7051
|
children: [
|
|
6666
|
-
/* @__PURE__ */
|
|
6667
|
-
/* @__PURE__ */
|
|
6668
|
-
/* @__PURE__ */
|
|
6669
|
-
previewValue(call.input) && /* @__PURE__ */
|
|
6670
|
-
call.status === "calling" && /* @__PURE__ */
|
|
6671
|
-
call.status === "done" && call.ok === false && /* @__PURE__ */
|
|
6672
|
-
showTiers && call.replayed && /* @__PURE__ */
|
|
6673
|
-
showTiers && call.attempt !== void 0 && /* @__PURE__ */
|
|
6674
|
-
call.app && /* @__PURE__ */
|
|
6675
|
-
/* @__PURE__ */
|
|
7052
|
+
/* @__PURE__ */ jsxs13("div", { className: "awr-tool__row", children: [
|
|
7053
|
+
/* @__PURE__ */ jsx15(ToolIcon, { size: 13, className: "awr-tool__icon" }),
|
|
7054
|
+
/* @__PURE__ */ jsx15("code", { className: "awr-tool__name", children: call.name }),
|
|
7055
|
+
previewValue(call.input) && /* @__PURE__ */ jsx15("span", { className: "awr-tool__args", children: previewValue(call.input) }),
|
|
7056
|
+
call.status === "calling" && /* @__PURE__ */ jsx15(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
7057
|
+
call.status === "done" && call.ok === false && /* @__PURE__ */ jsx15("span", { className: "awr-tool__badge", children: L.failed }),
|
|
7058
|
+
showTiers && call.replayed && /* @__PURE__ */ jsx15("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
|
|
7059
|
+
showTiers && call.attempt !== void 0 && /* @__PURE__ */ jsx15("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
|
|
7060
|
+
call.app && /* @__PURE__ */ jsxs13("span", { className: "awr-tool__tag awr-tool__tag--app", "data-app": call.app, children: [
|
|
7061
|
+
/* @__PURE__ */ jsx15(AppIcon, { size: 10 }),
|
|
6676
7062
|
" ",
|
|
6677
7063
|
L.appTag
|
|
6678
7064
|
] }),
|
|
6679
|
-
showUsage && cost && /* @__PURE__ */
|
|
7065
|
+
showUsage && cost && /* @__PURE__ */ jsx15("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
|
|
6680
7066
|
] }),
|
|
6681
|
-
images.length > 0 && /* @__PURE__ */
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
7067
|
+
images.length > 0 && /* @__PURE__ */ jsx15("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ jsx15(
|
|
7068
|
+
ImageThumb,
|
|
7069
|
+
{
|
|
7070
|
+
src,
|
|
7071
|
+
name: `${call.name}-${i + 1}${imageExtensionOf(src)}`,
|
|
7072
|
+
alt: `${call.name} result ${i + 1}`,
|
|
7073
|
+
imgClassName: "awr-thumb",
|
|
7074
|
+
labels
|
|
7075
|
+
},
|
|
7076
|
+
i
|
|
7077
|
+
)) }),
|
|
7078
|
+
search && /* @__PURE__ */ jsxs13("div", { className: "awr-search", children: [
|
|
7079
|
+
/* @__PURE__ */ jsxs13("p", { className: "awr-search__query", children: [
|
|
7080
|
+
/* @__PURE__ */ jsx15(GlobeIcon, { size: 12 }),
|
|
6685
7081
|
" ",
|
|
6686
7082
|
L.searchQuery,
|
|
6687
7083
|
" ",
|
|
6688
|
-
/* @__PURE__ */
|
|
7084
|
+
/* @__PURE__ */ jsx15("q", { children: search.query })
|
|
6689
7085
|
] }),
|
|
6690
|
-
search.results.length > 0 ? /* @__PURE__ */
|
|
6691
|
-
/* @__PURE__ */
|
|
7086
|
+
search.results.length > 0 ? /* @__PURE__ */ jsx15("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ jsxs13("li", { className: "awr-search__result", children: [
|
|
7087
|
+
/* @__PURE__ */ jsx15(
|
|
6692
7088
|
"a",
|
|
6693
7089
|
{
|
|
6694
7090
|
className: "awr-search__title",
|
|
@@ -6699,13 +7095,13 @@ var ToolCallRow = ({
|
|
|
6699
7095
|
}
|
|
6700
7096
|
),
|
|
6701
7097
|
" ",
|
|
6702
|
-
/* @__PURE__ */
|
|
7098
|
+
/* @__PURE__ */ jsxs13("span", { className: "awr-search__host", children: [
|
|
6703
7099
|
r.host,
|
|
6704
7100
|
r.date ? ` \xB7 ${r.date}` : ""
|
|
6705
7101
|
] }),
|
|
6706
|
-
r.snippet && /* @__PURE__ */
|
|
6707
|
-
] }, i)) }) : /* @__PURE__ */
|
|
6708
|
-
(search.filtered > 0 || search.truncated) && /* @__PURE__ */
|
|
7102
|
+
r.snippet && /* @__PURE__ */ jsx15("p", { className: "awr-search__snippet", children: r.snippet })
|
|
7103
|
+
] }, i)) }) : /* @__PURE__ */ jsx15("p", { className: "awr-search__note", children: L.searchNoResults }),
|
|
7104
|
+
(search.filtered > 0 || search.truncated) && /* @__PURE__ */ jsx15("p", { className: "awr-search__note", children: [
|
|
6709
7105
|
search.filtered > 0 ? L.searchFiltered(search.filtered) : "",
|
|
6710
7106
|
search.truncated ? L.searchTruncated : ""
|
|
6711
7107
|
].filter(Boolean).join(" \xB7 ") })
|
|
@@ -6719,11 +7115,11 @@ var UserNoteRow = ({
|
|
|
6719
7115
|
labels
|
|
6720
7116
|
}) => {
|
|
6721
7117
|
const L = useLabels(labels);
|
|
6722
|
-
return /* @__PURE__ */
|
|
6723
|
-
/* @__PURE__ */
|
|
6724
|
-
/* @__PURE__ */
|
|
6725
|
-
/* @__PURE__ */
|
|
6726
|
-
note.origin === "another-tab" && /* @__PURE__ */
|
|
7118
|
+
return /* @__PURE__ */ jsxs13("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
7119
|
+
/* @__PURE__ */ jsx15(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
7120
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
7121
|
+
/* @__PURE__ */ jsx15("q", { className: "awr-note__text", children: note.text }),
|
|
7122
|
+
note.origin === "another-tab" && /* @__PURE__ */ jsx15("span", { className: "awr-note__origin", children: L.fromAnotherTab })
|
|
6727
7123
|
] });
|
|
6728
7124
|
};
|
|
6729
7125
|
var decisionNote = (d, L) => {
|
|
@@ -6754,18 +7150,14 @@ var StepItem = ({
|
|
|
6754
7150
|
renderToolCall,
|
|
6755
7151
|
renderSubagent,
|
|
6756
7152
|
L
|
|
6757
|
-
}) => /* @__PURE__ */
|
|
6758
|
-
/* @__PURE__ */
|
|
6759
|
-
/* @__PURE__ */
|
|
6760
|
-
/* @__PURE__ */
|
|
6761
|
-
|
|
6762
|
-
"/",
|
|
6763
|
-
step.total
|
|
6764
|
-
] }),
|
|
6765
|
-
/* @__PURE__ */ jsx14("span", { className: "awr-step__desc", children: step.step.description })
|
|
7153
|
+
}) => /* @__PURE__ */ jsxs13("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
|
|
7154
|
+
/* @__PURE__ */ jsxs13("div", { className: "awr-step__head", children: [
|
|
7155
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ jsx15(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ jsx15(AlertIcon, { size: 14 }) : /* @__PURE__ */ jsx15(CheckIcon, { size: 14 }) }),
|
|
7156
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-step__index", children: `${step.index}/${step.total}` }),
|
|
7157
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-step__desc", children: step.step.description })
|
|
6766
7158
|
] }),
|
|
6767
|
-
showTiers && step.tier && /* @__PURE__ */
|
|
6768
|
-
/* @__PURE__ */
|
|
7159
|
+
showTiers && step.tier && /* @__PURE__ */ jsxs13("div", { className: "awr-step__meta", children: [
|
|
7160
|
+
/* @__PURE__ */ jsx15(
|
|
6769
7161
|
"span",
|
|
6770
7162
|
{
|
|
6771
7163
|
className: `awr-step__tier awr-step__tier--${step.tier}`,
|
|
@@ -6773,29 +7165,29 @@ var StepItem = ({
|
|
|
6773
7165
|
children: L.tierNames[step.tier]
|
|
6774
7166
|
}
|
|
6775
7167
|
),
|
|
6776
|
-
step.model && /* @__PURE__ */
|
|
7168
|
+
step.model && /* @__PURE__ */ jsx15("span", { className: "awr-step__model", children: step.model })
|
|
6777
7169
|
] }),
|
|
6778
|
-
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */
|
|
6779
|
-
/* @__PURE__ */
|
|
6780
|
-
/* @__PURE__ */
|
|
6781
|
-
/* @__PURE__ */
|
|
7170
|
+
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ jsxs13("div", { className: "awr-step__escalated", children: [
|
|
7171
|
+
/* @__PURE__ */ jsxs13("p", { className: "awr-step__escalated-line", children: [
|
|
7172
|
+
/* @__PURE__ */ jsx15(ArrowUpIcon, { size: 12 }),
|
|
7173
|
+
/* @__PURE__ */ jsx15("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
|
|
6782
7174
|
] }),
|
|
6783
|
-
e.text?.trim() && /* @__PURE__ */
|
|
6784
|
-
/* @__PURE__ */
|
|
6785
|
-
/* @__PURE__ */
|
|
7175
|
+
e.text?.trim() && /* @__PURE__ */ jsxs13("details", { className: "awr-step__attempt", children: [
|
|
7176
|
+
/* @__PURE__ */ jsx15("summary", { children: L.escalatedAttemptText }),
|
|
7177
|
+
/* @__PURE__ */ jsx15("p", { className: "awr-step__text", children: e.text.trim() })
|
|
6786
7178
|
] })
|
|
6787
7179
|
] }, i)),
|
|
6788
|
-
showThoughts && step.reasoning.trim() && /* @__PURE__ */
|
|
6789
|
-
/* @__PURE__ */
|
|
6790
|
-
/* @__PURE__ */
|
|
7180
|
+
showThoughts && step.reasoning.trim() && /* @__PURE__ */ jsxs13("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
|
|
7181
|
+
/* @__PURE__ */ jsxs13("summary", { children: [
|
|
7182
|
+
/* @__PURE__ */ jsx15(BrainIcon, { size: 13 }),
|
|
6791
7183
|
" ",
|
|
6792
7184
|
L.stepThoughts
|
|
6793
7185
|
] }),
|
|
6794
|
-
/* @__PURE__ */
|
|
7186
|
+
/* @__PURE__ */ jsx15("p", { className: "awr-thought__text", children: step.reasoning.trim() })
|
|
6795
7187
|
] }),
|
|
6796
|
-
step.text.trim() && /* @__PURE__ */
|
|
6797
|
-
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */
|
|
6798
|
-
const row = /* @__PURE__ */
|
|
7188
|
+
step.text.trim() && /* @__PURE__ */ jsx15("p", { className: "awr-step__text", children: step.text.trim() }),
|
|
7189
|
+
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ jsx15("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
|
|
7190
|
+
const row = /* @__PURE__ */ jsx15(
|
|
6799
7191
|
ToolCallRow,
|
|
6800
7192
|
{
|
|
6801
7193
|
call,
|
|
@@ -6805,15 +7197,15 @@ var StepItem = ({
|
|
|
6805
7197
|
},
|
|
6806
7198
|
i
|
|
6807
7199
|
);
|
|
6808
|
-
return renderToolCall ? /* @__PURE__ */
|
|
7200
|
+
return renderToolCall ? /* @__PURE__ */ jsx15(Fragment10, { children: renderToolCall(call, row) }, i) : row;
|
|
6809
7201
|
}) }),
|
|
6810
|
-
approvals.length > 0 && /* @__PURE__ */
|
|
6811
|
-
/* @__PURE__ */
|
|
6812
|
-
/* @__PURE__ */
|
|
6813
|
-
/* @__PURE__ */
|
|
6814
|
-
a.subagent && /* @__PURE__ */
|
|
7202
|
+
approvals.length > 0 && /* @__PURE__ */ jsx15("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ jsxs13("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
|
|
7203
|
+
/* @__PURE__ */ jsx15(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
|
|
7204
|
+
/* @__PURE__ */ jsx15("code", { className: "awr-tool__name", children: a.name }),
|
|
7205
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
|
|
7206
|
+
a.subagent && /* @__PURE__ */ jsx15("span", { className: "awr-tool__tag", children: L.subagentHelper })
|
|
6815
7207
|
] }, a.id)) }),
|
|
6816
|
-
showSubagents && /* @__PURE__ */
|
|
7208
|
+
showSubagents && /* @__PURE__ */ jsx15(
|
|
6817
7209
|
SubagentTree,
|
|
6818
7210
|
{
|
|
6819
7211
|
subagents,
|
|
@@ -6822,14 +7214,14 @@ var StepItem = ({
|
|
|
6822
7214
|
renderSubagent
|
|
6823
7215
|
}
|
|
6824
7216
|
),
|
|
6825
|
-
notes.length > 0 && /* @__PURE__ */
|
|
6826
|
-
step.blocked && step.summary && /* @__PURE__ */
|
|
6827
|
-
showReplanFailed && step.replanFailed && /* @__PURE__ */
|
|
6828
|
-
/* @__PURE__ */
|
|
7217
|
+
notes.length > 0 && /* @__PURE__ */ jsx15("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ jsx15(UserNoteRow, { note: n }, n.id)) }),
|
|
7218
|
+
step.blocked && step.summary && /* @__PURE__ */ jsx15("p", { className: "awr-step__blocked", children: step.summary }),
|
|
7219
|
+
showReplanFailed && step.replanFailed && /* @__PURE__ */ jsxs13("p", { className: "awr-step__warn", title: step.replanFailed, children: [
|
|
7220
|
+
/* @__PURE__ */ jsx15(AlertIcon, { size: 12 }),
|
|
6829
7221
|
" ",
|
|
6830
7222
|
L.replanFailed
|
|
6831
7223
|
] }),
|
|
6832
|
-
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */
|
|
7224
|
+
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ jsx15(
|
|
6833
7225
|
"p",
|
|
6834
7226
|
{
|
|
6835
7227
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -6864,8 +7256,8 @@ var StepList = ({
|
|
|
6864
7256
|
const known = new Set(steps.map((s) => s.id));
|
|
6865
7257
|
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
6866
7258
|
const loose = showSubagents ? subagents.filter((s) => !s.stepId || !known.has(s.stepId)) : [];
|
|
6867
|
-
return /* @__PURE__ */
|
|
6868
|
-
steps.map((step) => /* @__PURE__ */
|
|
7259
|
+
return /* @__PURE__ */ jsxs13("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
7260
|
+
steps.map((step) => /* @__PURE__ */ jsx15(
|
|
6869
7261
|
StepItem,
|
|
6870
7262
|
{
|
|
6871
7263
|
step,
|
|
@@ -6887,7 +7279,7 @@ var StepList = ({
|
|
|
6887
7279
|
},
|
|
6888
7280
|
step.id
|
|
6889
7281
|
)),
|
|
6890
|
-
loose.length > 0 && /* @__PURE__ */
|
|
7282
|
+
loose.length > 0 && /* @__PURE__ */ jsx15("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ jsx15(
|
|
6891
7283
|
SubagentTree,
|
|
6892
7284
|
{
|
|
6893
7285
|
subagents: loose,
|
|
@@ -6896,12 +7288,12 @@ var StepList = ({
|
|
|
6896
7288
|
renderSubagent
|
|
6897
7289
|
}
|
|
6898
7290
|
) }),
|
|
6899
|
-
atEnd.length > 0 && /* @__PURE__ */
|
|
7291
|
+
atEnd.length > 0 && /* @__PURE__ */ jsx15("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ jsx15("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ jsx15(UserNoteRow, { note: n }, n.id)) }) })
|
|
6900
7292
|
] });
|
|
6901
7293
|
};
|
|
6902
7294
|
|
|
6903
7295
|
// src/components/MessageList.tsx
|
|
6904
|
-
import { jsx as
|
|
7296
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6905
7297
|
var usageLine = (usage, durationMs) => {
|
|
6906
7298
|
const parts = [];
|
|
6907
7299
|
if (usage && usage.totalTokens > 0) {
|
|
@@ -6912,8 +7304,17 @@ var usageLine = (usage, durationMs) => {
|
|
|
6912
7304
|
if (durationMs !== void 0) parts.push(formatDuration(durationMs));
|
|
6913
7305
|
return parts.join(" \xB7 ");
|
|
6914
7306
|
};
|
|
6915
|
-
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */
|
|
6916
|
-
|
|
7307
|
+
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ jsx16(
|
|
7308
|
+
ImageThumb,
|
|
7309
|
+
{
|
|
7310
|
+
src: a.dataUrl,
|
|
7311
|
+
name: a.path ?? a.name,
|
|
7312
|
+
alt: a.name,
|
|
7313
|
+
imgClassName: "awr-thumb awr-thumb--msg",
|
|
7314
|
+
title: a.path ?? a.name
|
|
7315
|
+
}
|
|
7316
|
+
) : /* @__PURE__ */ jsxs14("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
|
|
7317
|
+
/* @__PURE__ */ jsx16(FileIcon, { size: 13 }),
|
|
6917
7318
|
" ",
|
|
6918
7319
|
a.name
|
|
6919
7320
|
] });
|
|
@@ -6964,24 +7365,26 @@ var MessageList = ({
|
|
|
6964
7365
|
renderToolCall,
|
|
6965
7366
|
renderApp,
|
|
6966
7367
|
showApps = true,
|
|
7368
|
+
imageViewer = true,
|
|
7369
|
+
renderImageViewer,
|
|
6967
7370
|
labels,
|
|
6968
7371
|
className
|
|
6969
7372
|
}) => {
|
|
6970
7373
|
const L = useLabels(labels);
|
|
6971
7374
|
if (messages.length === 0) {
|
|
6972
|
-
return empty ? /* @__PURE__ */
|
|
7375
|
+
return empty ? /* @__PURE__ */ jsx16("div", { className: "awr-messages__empty", children: empty }) : null;
|
|
6973
7376
|
}
|
|
6974
|
-
return /* @__PURE__ */
|
|
7377
|
+
return /* @__PURE__ */ jsx16(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ jsx16("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
|
|
6975
7378
|
const steps = m.steps ?? [];
|
|
6976
7379
|
const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
|
|
6977
7380
|
const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
|
|
6978
|
-
const node = /* @__PURE__ */
|
|
7381
|
+
const node = /* @__PURE__ */ jsx16(
|
|
6979
7382
|
"div",
|
|
6980
7383
|
{
|
|
6981
7384
|
className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
|
|
6982
|
-
children: /* @__PURE__ */
|
|
6983
|
-
m.role === "assistant" && hasActivity && /* @__PURE__ */
|
|
6984
|
-
/* @__PURE__ */
|
|
7385
|
+
children: /* @__PURE__ */ jsxs14("div", { className: "awr-msg__col", children: [
|
|
7386
|
+
m.role === "assistant" && hasActivity && /* @__PURE__ */ jsxs14("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
|
|
7387
|
+
/* @__PURE__ */ jsx16("summary", { className: "awr-activity__summary", children: activitySummary(
|
|
6985
7388
|
m,
|
|
6986
7389
|
showToolCalls,
|
|
6987
7390
|
showLearned,
|
|
@@ -6991,7 +7394,7 @@ var MessageList = ({
|
|
|
6991
7394
|
showApps && Boolean(renderApp)
|
|
6992
7395
|
) }),
|
|
6993
7396
|
m.pending && liveExtra,
|
|
6994
|
-
/* @__PURE__ */
|
|
7397
|
+
/* @__PURE__ */ jsx16(
|
|
6995
7398
|
StepList,
|
|
6996
7399
|
{
|
|
6997
7400
|
steps,
|
|
@@ -7013,45 +7416,45 @@ var MessageList = ({
|
|
|
7013
7416
|
labels
|
|
7014
7417
|
}
|
|
7015
7418
|
),
|
|
7016
|
-
showLearned && m.fetches?.length ? /* @__PURE__ */
|
|
7419
|
+
showLearned && m.fetches?.length ? /* @__PURE__ */ jsx16("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ jsxs14(
|
|
7017
7420
|
"li",
|
|
7018
7421
|
{
|
|
7019
7422
|
className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
|
|
7020
7423
|
children: [
|
|
7021
|
-
/* @__PURE__ */
|
|
7424
|
+
/* @__PURE__ */ jsx16(GlobeIcon, { size: 12 }),
|
|
7022
7425
|
" ",
|
|
7023
|
-
/* @__PURE__ */
|
|
7426
|
+
/* @__PURE__ */ jsx16("code", { children: f.url }),
|
|
7024
7427
|
" ",
|
|
7025
|
-
/* @__PURE__ */
|
|
7428
|
+
/* @__PURE__ */ jsx16("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
|
|
7026
7429
|
]
|
|
7027
7430
|
},
|
|
7028
7431
|
i
|
|
7029
7432
|
)) }) : null,
|
|
7030
|
-
showLearned && m.learned?.length ? /* @__PURE__ */
|
|
7031
|
-
/* @__PURE__ */
|
|
7433
|
+
showLearned && m.learned?.length ? /* @__PURE__ */ jsxs14("p", { className: "awr-learned", children: [
|
|
7434
|
+
/* @__PURE__ */ jsx16(BookIcon, { size: 12 }),
|
|
7032
7435
|
" ",
|
|
7033
7436
|
L.learnedNow(m.learned.join(", "))
|
|
7034
7437
|
] }) : null,
|
|
7035
|
-
showThoughts && m.reasoning?.trim() && /* @__PURE__ */
|
|
7036
|
-
/* @__PURE__ */
|
|
7037
|
-
/* @__PURE__ */
|
|
7438
|
+
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ jsxs14("details", { className: "awr-thought", children: [
|
|
7439
|
+
/* @__PURE__ */ jsxs14("summary", { children: [
|
|
7440
|
+
/* @__PURE__ */ jsx16(BrainIcon, { size: 13 }),
|
|
7038
7441
|
" ",
|
|
7039
7442
|
L.answerThoughts
|
|
7040
7443
|
] }),
|
|
7041
|
-
/* @__PURE__ */
|
|
7444
|
+
/* @__PURE__ */ jsx16("p", { className: "awr-thought__text", children: m.reasoning.trim() })
|
|
7042
7445
|
] })
|
|
7043
7446
|
] }),
|
|
7044
|
-
showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */
|
|
7045
|
-
showMedia && m.transcripts?.length ? /* @__PURE__ */
|
|
7046
|
-
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */
|
|
7447
|
+
showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__apps", children: m.apps.map((app) => /* @__PURE__ */ jsx16("div", { className: "awr-msg__app", children: renderApp(app, m) }, app.id)) }) : null,
|
|
7448
|
+
showMedia && m.transcripts?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ jsx16(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
|
|
7449
|
+
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ jsxs14("div", { className: "awr-msg__bubble", children: [
|
|
7047
7450
|
m.content ? renderContent ? renderContent(m) : m.content : null,
|
|
7048
|
-
m.pending && !m.content && /* @__PURE__ */
|
|
7451
|
+
m.pending && !m.content && /* @__PURE__ */ jsx16(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
|
|
7049
7452
|
] }),
|
|
7050
|
-
showMedia && m.media?.length ? /* @__PURE__ */
|
|
7051
|
-
const built = /* @__PURE__ */
|
|
7052
|
-
return renderMedia ? /* @__PURE__ */
|
|
7453
|
+
showMedia && m.media?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
7454
|
+
const built = /* @__PURE__ */ jsx16(GeneratedMedia, { media: item, files, labels }, i);
|
|
7455
|
+
return renderMedia ? /* @__PURE__ */ jsx16("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
7053
7456
|
}) }) : null,
|
|
7054
|
-
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */
|
|
7457
|
+
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ jsx16(
|
|
7055
7458
|
FileChips,
|
|
7056
7459
|
{
|
|
7057
7460
|
written: m.writtenFiles,
|
|
@@ -7063,34 +7466,34 @@ var MessageList = ({
|
|
|
7063
7466
|
labels
|
|
7064
7467
|
}
|
|
7065
7468
|
) : null,
|
|
7066
|
-
m.attachments?.length ? /* @__PURE__ */
|
|
7067
|
-
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */
|
|
7469
|
+
m.attachments?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__attachments", "aria-label": L.attachments, children: m.attachments.map((a, i) => /* @__PURE__ */ jsx16("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ jsx16(AttachmentView, { attachment: a }) }, i)) }) : null,
|
|
7470
|
+
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ jsx16("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
7068
7471
|
] })
|
|
7069
7472
|
},
|
|
7070
7473
|
m.id
|
|
7071
7474
|
);
|
|
7072
|
-
return renderMessage ? /* @__PURE__ */
|
|
7073
|
-
}) });
|
|
7475
|
+
return renderMessage ? /* @__PURE__ */ jsx16("div", { children: renderMessage(m, node) }, m.id) : node;
|
|
7476
|
+
}) }) });
|
|
7074
7477
|
};
|
|
7075
7478
|
|
|
7076
7479
|
// src/components/ModelLoadBar.tsx
|
|
7077
|
-
import { jsx as
|
|
7480
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
7078
7481
|
var ModelLoadBar = ({ load, className }) => {
|
|
7079
7482
|
const pct = Math.round(Math.max(0, Math.min(1, load.progress)) * 100);
|
|
7080
|
-
return /* @__PURE__ */
|
|
7081
|
-
/* @__PURE__ */
|
|
7082
|
-
/* @__PURE__ */
|
|
7083
|
-
/* @__PURE__ */
|
|
7483
|
+
return /* @__PURE__ */ jsxs15("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
|
|
7484
|
+
/* @__PURE__ */ jsxs15("div", { className: "awr-modelload__head", children: [
|
|
7485
|
+
/* @__PURE__ */ jsx17("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
|
|
7486
|
+
/* @__PURE__ */ jsxs15("span", { className: "awr-modelload__pct", children: [
|
|
7084
7487
|
pct,
|
|
7085
7488
|
"%"
|
|
7086
7489
|
] })
|
|
7087
7490
|
] }),
|
|
7088
|
-
/* @__PURE__ */
|
|
7491
|
+
/* @__PURE__ */ jsx17("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ jsx17("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
|
|
7089
7492
|
] });
|
|
7090
7493
|
};
|
|
7091
7494
|
|
|
7092
7495
|
// src/components/ToolApprovalPrompt.tsx
|
|
7093
|
-
import { jsx as
|
|
7496
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
7094
7497
|
var SkillConsentCard = ({
|
|
7095
7498
|
approval: a,
|
|
7096
7499
|
skill,
|
|
@@ -7100,7 +7503,7 @@ var SkillConsentCard = ({
|
|
|
7100
7503
|
showPreview,
|
|
7101
7504
|
onApprove,
|
|
7102
7505
|
onDeny
|
|
7103
|
-
}) => /* @__PURE__ */
|
|
7506
|
+
}) => /* @__PURE__ */ jsxs16(
|
|
7104
7507
|
"div",
|
|
7105
7508
|
{
|
|
7106
7509
|
className: `awr-approval awr-approval--skill${helper ? " awr-approval--helper" : ""}`,
|
|
@@ -7108,28 +7511,28 @@ var SkillConsentCard = ({
|
|
|
7108
7511
|
"data-skill-server": skill.server,
|
|
7109
7512
|
"data-subagent": helper?.id,
|
|
7110
7513
|
children: [
|
|
7111
|
-
/* @__PURE__ */
|
|
7112
|
-
/* @__PURE__ */
|
|
7113
|
-
/* @__PURE__ */
|
|
7514
|
+
/* @__PURE__ */ jsxs16("div", { className: "awr-approval__head", children: [
|
|
7515
|
+
/* @__PURE__ */ jsx18(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
7516
|
+
/* @__PURE__ */ jsx18("span", { children: L.skillConsentLead(skill.server, skill.skill) })
|
|
7114
7517
|
] }),
|
|
7115
|
-
skill.description && /* @__PURE__ */
|
|
7116
|
-
/* @__PURE__ */
|
|
7117
|
-
/* @__PURE__ */
|
|
7118
|
-
/* @__PURE__ */
|
|
7518
|
+
skill.description && /* @__PURE__ */ jsx18("p", { className: "awr-approval__quote", children: skill.description }),
|
|
7519
|
+
/* @__PURE__ */ jsxs16("p", { className: "awr-approval__skillmeta", children: [
|
|
7520
|
+
/* @__PURE__ */ jsx18("code", { className: "awr-tool__name", children: skill.name }),
|
|
7521
|
+
/* @__PURE__ */ jsx18("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
|
|
7119
7522
|
] }),
|
|
7120
|
-
skill.byUri && /* @__PURE__ */
|
|
7121
|
-
skill.nestedIn && /* @__PURE__ */
|
|
7122
|
-
skill.dynamic && /* @__PURE__ */
|
|
7123
|
-
skill.dynamic && skill.noFileListing && /* @__PURE__ */
|
|
7124
|
-
showPreview && skill.body !== void 0 && /* @__PURE__ */
|
|
7125
|
-
/* @__PURE__ */
|
|
7126
|
-
/* @__PURE__ */
|
|
7127
|
-
skill.files.length > 0 && /* @__PURE__ */
|
|
7523
|
+
skill.byUri && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
|
|
7524
|
+
skill.nestedIn && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
|
|
7525
|
+
skill.dynamic && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
|
|
7526
|
+
skill.dynamic && skill.noFileListing && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
|
|
7527
|
+
showPreview && skill.body !== void 0 && /* @__PURE__ */ jsxs16("details", { className: "awr-approval__preview", children: [
|
|
7528
|
+
/* @__PURE__ */ jsx18("summary", { children: L.skillConsentPreview }),
|
|
7529
|
+
/* @__PURE__ */ jsx18("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
|
|
7530
|
+
skill.files.length > 0 && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
|
|
7128
7531
|
] }),
|
|
7129
|
-
/* @__PURE__ */
|
|
7130
|
-
/* @__PURE__ */
|
|
7131
|
-
/* @__PURE__ */
|
|
7132
|
-
allowRemember && /* @__PURE__ */
|
|
7532
|
+
/* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
|
|
7533
|
+
/* @__PURE__ */ jsxs16("div", { className: "awr-approval__actions", children: [
|
|
7534
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
|
|
7535
|
+
allowRemember && /* @__PURE__ */ jsx18(
|
|
7133
7536
|
"button",
|
|
7134
7537
|
{
|
|
7135
7538
|
type: "button",
|
|
@@ -7138,7 +7541,7 @@ var SkillConsentCard = ({
|
|
|
7138
7541
|
children: L.skillConsentAlways
|
|
7139
7542
|
}
|
|
7140
7543
|
),
|
|
7141
|
-
/* @__PURE__ */
|
|
7544
|
+
/* @__PURE__ */ jsx18(
|
|
7142
7545
|
"button",
|
|
7143
7546
|
{
|
|
7144
7547
|
type: "button",
|
|
@@ -7164,9 +7567,9 @@ var ToolApprovalPrompt = ({
|
|
|
7164
7567
|
}) => {
|
|
7165
7568
|
const L = useLabels(labels);
|
|
7166
7569
|
if (approvals.length === 0) return null;
|
|
7167
|
-
return /* @__PURE__ */
|
|
7570
|
+
return /* @__PURE__ */ jsx18("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
|
|
7168
7571
|
if (a.skill) {
|
|
7169
|
-
const card2 = /* @__PURE__ */
|
|
7572
|
+
const card2 = /* @__PURE__ */ jsx18(
|
|
7170
7573
|
SkillConsentCard,
|
|
7171
7574
|
{
|
|
7172
7575
|
approval: a,
|
|
@@ -7180,33 +7583,33 @@ var ToolApprovalPrompt = ({
|
|
|
7180
7583
|
},
|
|
7181
7584
|
a.id
|
|
7182
7585
|
);
|
|
7183
|
-
return renderApproval ? /* @__PURE__ */
|
|
7586
|
+
return renderApproval ? /* @__PURE__ */ jsx18("div", { children: renderApproval(a, card2) }, a.id) : card2;
|
|
7184
7587
|
}
|
|
7185
7588
|
const helper = showHelper ? a.subagent : void 0;
|
|
7186
7589
|
const app = a.app;
|
|
7187
|
-
const card = /* @__PURE__ */
|
|
7590
|
+
const card = /* @__PURE__ */ jsxs16(
|
|
7188
7591
|
"div",
|
|
7189
7592
|
{
|
|
7190
7593
|
className: `awr-approval${helper ? " awr-approval--helper" : ""}${app ? " awr-approval--app" : ""}`,
|
|
7191
7594
|
"data-subagent": helper?.id,
|
|
7192
7595
|
"data-app-server": app?.server,
|
|
7193
7596
|
children: [
|
|
7194
|
-
/* @__PURE__ */
|
|
7195
|
-
/* @__PURE__ */
|
|
7196
|
-
/* @__PURE__ */
|
|
7597
|
+
/* @__PURE__ */ jsxs16("div", { className: "awr-approval__head", children: [
|
|
7598
|
+
/* @__PURE__ */ jsx18(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
7599
|
+
/* @__PURE__ */ jsxs16("span", { children: [
|
|
7197
7600
|
app ? L.approvalLeadApp(app.server) : helper ? L.approvalLeadHelper(
|
|
7198
7601
|
previewValue(helper.role ?? "", 60) || void 0,
|
|
7199
7602
|
helper.depth
|
|
7200
7603
|
) : L.approvalLead,
|
|
7201
7604
|
" ",
|
|
7202
|
-
/* @__PURE__ */
|
|
7605
|
+
/* @__PURE__ */ jsx18("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
|
|
7203
7606
|
a.readOnly && !app ? ` (${L.readOnlyTool})` : ""
|
|
7204
7607
|
] })
|
|
7205
7608
|
] }),
|
|
7206
|
-
previewValue(a.input, 300) && /* @__PURE__ */
|
|
7207
|
-
app && /* @__PURE__ */
|
|
7208
|
-
/* @__PURE__ */
|
|
7209
|
-
/* @__PURE__ */
|
|
7609
|
+
previewValue(a.input, 300) && /* @__PURE__ */ jsx18("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
|
|
7610
|
+
app && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
|
|
7611
|
+
/* @__PURE__ */ jsxs16("div", { className: "awr-approval__actions", children: [
|
|
7612
|
+
/* @__PURE__ */ jsx18(
|
|
7210
7613
|
"button",
|
|
7211
7614
|
{
|
|
7212
7615
|
type: "button",
|
|
@@ -7215,7 +7618,7 @@ var ToolApprovalPrompt = ({
|
|
|
7215
7618
|
children: L.approve
|
|
7216
7619
|
}
|
|
7217
7620
|
),
|
|
7218
|
-
allowRemember && /* @__PURE__ */
|
|
7621
|
+
allowRemember && /* @__PURE__ */ jsx18(
|
|
7219
7622
|
"button",
|
|
7220
7623
|
{
|
|
7221
7624
|
type: "button",
|
|
@@ -7224,7 +7627,7 @@ var ToolApprovalPrompt = ({
|
|
|
7224
7627
|
children: L.alwaysAllow
|
|
7225
7628
|
}
|
|
7226
7629
|
),
|
|
7227
|
-
/* @__PURE__ */
|
|
7630
|
+
/* @__PURE__ */ jsx18(
|
|
7228
7631
|
"button",
|
|
7229
7632
|
{
|
|
7230
7633
|
type: "button",
|
|
@@ -7238,12 +7641,12 @@ var ToolApprovalPrompt = ({
|
|
|
7238
7641
|
},
|
|
7239
7642
|
a.id
|
|
7240
7643
|
);
|
|
7241
|
-
return renderApproval ? /* @__PURE__ */
|
|
7644
|
+
return renderApproval ? /* @__PURE__ */ jsx18("div", { children: renderApproval(a, card) }, a.id) : card;
|
|
7242
7645
|
}) });
|
|
7243
7646
|
};
|
|
7244
7647
|
|
|
7245
7648
|
// src/components/UsageBadge.tsx
|
|
7246
|
-
import { jsxs as
|
|
7649
|
+
import { jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7247
7650
|
var UsageBadge = ({
|
|
7248
7651
|
usage,
|
|
7249
7652
|
compact = false,
|
|
@@ -7269,7 +7672,7 @@ var UsageBadge = ({
|
|
|
7269
7672
|
mediaText,
|
|
7270
7673
|
decisions ? L.usageDecisions(decisions) : ""
|
|
7271
7674
|
].filter(Boolean).join(" \xB7 ");
|
|
7272
|
-
return /* @__PURE__ */
|
|
7675
|
+
return /* @__PURE__ */ jsxs17("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
|
|
7273
7676
|
formatTokens(usage.inputTokens),
|
|
7274
7677
|
"\u2191 ",
|
|
7275
7678
|
formatTokens(usage.outputTokens),
|
|
@@ -7282,13 +7685,13 @@ var UsageBadge = ({
|
|
|
7282
7685
|
};
|
|
7283
7686
|
|
|
7284
7687
|
// src/components/AgentChat.tsx
|
|
7285
|
-
import { Fragment as
|
|
7688
|
+
import { Fragment as Fragment11, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7286
7689
|
var usePrefersDark = () => {
|
|
7287
7690
|
const query = "(prefers-color-scheme: dark)";
|
|
7288
|
-
const [dark, setDark] =
|
|
7691
|
+
const [dark, setDark] = useState16(
|
|
7289
7692
|
() => typeof matchMedia === "function" && matchMedia(query).matches
|
|
7290
7693
|
);
|
|
7291
|
-
|
|
7694
|
+
useEffect16(() => {
|
|
7292
7695
|
if (typeof matchMedia !== "function") return;
|
|
7293
7696
|
const mq = matchMedia(query);
|
|
7294
7697
|
const on = () => setDark(mq.matches);
|
|
@@ -7299,7 +7702,7 @@ var usePrefersDark = () => {
|
|
|
7299
7702
|
};
|
|
7300
7703
|
var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
|
|
7301
7704
|
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
7302
|
-
var AgentChat = (props) => /* @__PURE__ */
|
|
7705
|
+
var AgentChat = (props) => /* @__PURE__ */ jsx19(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ jsx19(AgentChatInner, { ...props }) });
|
|
7303
7706
|
var NO_LABELS = {};
|
|
7304
7707
|
var AgentChatInner = ({
|
|
7305
7708
|
controller,
|
|
@@ -7348,6 +7751,8 @@ var AgentChatInner = ({
|
|
|
7348
7751
|
renderFileContent,
|
|
7349
7752
|
renderApproval,
|
|
7350
7753
|
slots = {},
|
|
7754
|
+
imageViewer = true,
|
|
7755
|
+
renderImageViewer,
|
|
7351
7756
|
components = {},
|
|
7352
7757
|
theme = "auto",
|
|
7353
7758
|
classNames = {},
|
|
@@ -7374,7 +7779,7 @@ var AgentChatInner = ({
|
|
|
7374
7779
|
}
|
|
7375
7780
|
const L = useLabels();
|
|
7376
7781
|
const external = isHistoryHook(history) ? history : void 0;
|
|
7377
|
-
const [ownStore] =
|
|
7782
|
+
const [ownStore] = useState16(
|
|
7378
7783
|
() => history instanceof ChatHistoryStore ? history : new ChatHistoryStore()
|
|
7379
7784
|
);
|
|
7380
7785
|
const own = useChatHistory(agent, {
|
|
@@ -7382,20 +7787,20 @@ var AgentChatInner = ({
|
|
|
7382
7787
|
enabled: Boolean(history) && !external
|
|
7383
7788
|
});
|
|
7384
7789
|
const chats = history ? external ?? own : void 0;
|
|
7385
|
-
const rootRef =
|
|
7386
|
-
const [narrow, setNarrow] =
|
|
7387
|
-
|
|
7790
|
+
const rootRef = useRef11(null);
|
|
7791
|
+
const [narrow, setNarrow] = useState16(void 0);
|
|
7792
|
+
useEffect16(() => {
|
|
7388
7793
|
const el = rootRef.current;
|
|
7389
7794
|
if (!el || typeof ResizeObserver === "undefined") return setNarrow(false);
|
|
7390
|
-
const
|
|
7391
|
-
|
|
7392
|
-
const ro = new ResizeObserver(
|
|
7795
|
+
const measure2 = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
|
|
7796
|
+
measure2();
|
|
7797
|
+
const ro = new ResizeObserver(measure2);
|
|
7393
7798
|
ro.observe(el);
|
|
7394
7799
|
return () => ro.disconnect();
|
|
7395
7800
|
}, [narrowWidth]);
|
|
7396
|
-
const [historyChoice, setHistoryOpen] =
|
|
7801
|
+
const [historyChoice, setHistoryOpen] = useState16(defaultHistoryOpen);
|
|
7397
7802
|
const historyOpen = historyChoice ?? narrow === false;
|
|
7398
|
-
const [filesOpen, setFilesOpen] =
|
|
7803
|
+
const [filesOpen, setFilesOpen] = useState16(defaultFilesOpen);
|
|
7399
7804
|
const toggleHistory = () => {
|
|
7400
7805
|
setHistoryOpen(!historyOpen);
|
|
7401
7806
|
if (narrow && !historyOpen) setFilesOpen(false);
|
|
@@ -7408,19 +7813,22 @@ var AgentChatInner = ({
|
|
|
7408
7813
|
setFilesOpen(true);
|
|
7409
7814
|
if (narrow) setHistoryOpen(false);
|
|
7410
7815
|
};
|
|
7411
|
-
const
|
|
7412
|
-
const
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7816
|
+
const overlayOpen = narrow === true && (Boolean(chats) && historyOpen || Boolean(files) && filesOpen);
|
|
7817
|
+
const closeOverlays = () => {
|
|
7818
|
+
setHistoryOpen(false);
|
|
7819
|
+
setFilesOpen(false);
|
|
7820
|
+
};
|
|
7821
|
+
useEffect16(() => {
|
|
7822
|
+
if (!overlayOpen) return;
|
|
7823
|
+
const onKey = (e) => {
|
|
7824
|
+
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
7825
|
+
setHistoryOpen(false);
|
|
7826
|
+
setFilesOpen(false);
|
|
7827
|
+
};
|
|
7828
|
+
document.addEventListener("keydown", onKey);
|
|
7829
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
7830
|
+
}, [overlayOpen]);
|
|
7831
|
+
const bodyRef = useRef11(null);
|
|
7424
7832
|
const appHost = useMcpAppHost({
|
|
7425
7833
|
connection: mcpApps,
|
|
7426
7834
|
approve: agent.approveAppToolCall,
|
|
@@ -7432,23 +7840,28 @@ var AgentChatInner = ({
|
|
|
7432
7840
|
});
|
|
7433
7841
|
const prefersDark = usePrefersDark();
|
|
7434
7842
|
const appTheme = theme === "auto" ? prefersDark ? "dark" : "light" : theme;
|
|
7435
|
-
const [panelApp, setPanelAppState] =
|
|
7843
|
+
const [panelApp, setPanelAppState] = useState16();
|
|
7436
7844
|
const setPanelApp = (app) => {
|
|
7437
7845
|
setPanelAppState(app);
|
|
7438
7846
|
onAppPanel?.(app);
|
|
7439
7847
|
};
|
|
7440
7848
|
const appsOn = showApps && Boolean(mcpApps);
|
|
7849
|
+
useFollowScroll(
|
|
7850
|
+
bodyRef,
|
|
7851
|
+
agent.messages.filter((m) => m.role === "user").length,
|
|
7852
|
+
agent.isRunning || agent.messages.some((m) => m.pending)
|
|
7853
|
+
);
|
|
7441
7854
|
const panelAllowed = appPanel !== false && appPanel !== null;
|
|
7442
7855
|
const panelTarget = typeof appPanel === "object" && appPanel ? appPanel : void 0;
|
|
7443
7856
|
const asSheet = !panelTarget && (appPanel === "sheet" || Boolean(narrow));
|
|
7444
|
-
|
|
7857
|
+
useEffect16(() => {
|
|
7445
7858
|
if (panelApp && !agent.messages.some((m) => m.apps?.some((a) => a.id === panelApp.id))) {
|
|
7446
7859
|
setPanelAppState(void 0);
|
|
7447
7860
|
onAppPanel?.(void 0);
|
|
7448
7861
|
}
|
|
7449
7862
|
}, [agent.messages, panelApp, onAppPanel]);
|
|
7450
7863
|
const drawApp = (app, message) => {
|
|
7451
|
-
const built = panelApp?.id === app.id ? /* @__PURE__ */
|
|
7864
|
+
const built = panelApp?.id === app.id ? /* @__PURE__ */ jsx19(
|
|
7452
7865
|
McpAppLine,
|
|
7453
7866
|
{
|
|
7454
7867
|
app,
|
|
@@ -7456,7 +7869,7 @@ var AgentChatInner = ({
|
|
|
7456
7869
|
action: L.appBringBack,
|
|
7457
7870
|
onAction: () => setPanelApp(void 0)
|
|
7458
7871
|
}
|
|
7459
|
-
) : /* @__PURE__ */
|
|
7872
|
+
) : /* @__PURE__ */ jsx19(
|
|
7460
7873
|
McpAppFrame,
|
|
7461
7874
|
{
|
|
7462
7875
|
app,
|
|
@@ -7469,7 +7882,7 @@ var AgentChatInner = ({
|
|
|
7469
7882
|
);
|
|
7470
7883
|
return renderApp ? renderApp(app, message, built) : built;
|
|
7471
7884
|
};
|
|
7472
|
-
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */
|
|
7885
|
+
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ jsx19(
|
|
7473
7886
|
McpAppFrame,
|
|
7474
7887
|
{
|
|
7475
7888
|
app: panelApp,
|
|
@@ -7481,7 +7894,7 @@ var AgentChatInner = ({
|
|
|
7481
7894
|
},
|
|
7482
7895
|
panelApp.id
|
|
7483
7896
|
) : null;
|
|
7484
|
-
const [compacting, setCompacting] =
|
|
7897
|
+
const [compacting, setCompacting] = useState16(false);
|
|
7485
7898
|
const compact = () => {
|
|
7486
7899
|
setCompacting(true);
|
|
7487
7900
|
void agent.compact().finally(() => setCompacting(false));
|
|
@@ -7502,18 +7915,18 @@ var AgentChatInner = ({
|
|
|
7502
7915
|
const showReplan = agent.replan && agent.replan.mode !== "continue";
|
|
7503
7916
|
const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
|
|
7504
7917
|
const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
|
|
7505
|
-
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */
|
|
7506
|
-
agent.planThought.trim() && /* @__PURE__ */
|
|
7507
|
-
/* @__PURE__ */
|
|
7508
|
-
/* @__PURE__ */
|
|
7918
|
+
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
7919
|
+
agent.planThought.trim() && /* @__PURE__ */ jsxs18("details", { className: "awr-activity__plan", children: [
|
|
7920
|
+
/* @__PURE__ */ jsx19("summary", { children: L.planned }),
|
|
7921
|
+
/* @__PURE__ */ jsx19("p", { className: "awr-activity__thought", children: agent.planThought })
|
|
7509
7922
|
] }),
|
|
7510
|
-
showReplan && /* @__PURE__ */
|
|
7511
|
-
replanFailedEarly && /* @__PURE__ */
|
|
7512
|
-
/* @__PURE__ */
|
|
7923
|
+
showReplan && /* @__PURE__ */ jsx19("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
|
|
7924
|
+
replanFailedEarly && /* @__PURE__ */ jsxs18("p", { className: "awr-step__warn", title: agent.replan.error, children: [
|
|
7925
|
+
/* @__PURE__ */ jsx19(AlertIcon, { size: 12 }),
|
|
7513
7926
|
" ",
|
|
7514
7927
|
L.replanFailed
|
|
7515
7928
|
] }),
|
|
7516
|
-
earlyDecisions.map((d, i) => /* @__PURE__ */
|
|
7929
|
+
earlyDecisions.map((d, i) => /* @__PURE__ */ jsx19(
|
|
7517
7930
|
"p",
|
|
7518
7931
|
{
|
|
7519
7932
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -7522,8 +7935,8 @@ var AgentChatInner = ({
|
|
|
7522
7935
|
i
|
|
7523
7936
|
))
|
|
7524
7937
|
] }) : void 0;
|
|
7525
|
-
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */
|
|
7526
|
-
chats && /* @__PURE__ */
|
|
7938
|
+
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ jsxs18("div", { className: cx("awr-chat__header", classNames.header), children: [
|
|
7939
|
+
chats && /* @__PURE__ */ jsx19(
|
|
7527
7940
|
"button",
|
|
7528
7941
|
{
|
|
7529
7942
|
type: "button",
|
|
@@ -7532,17 +7945,17 @@ var AgentChatInner = ({
|
|
|
7532
7945
|
title: L.showHistory,
|
|
7533
7946
|
"aria-pressed": historyOpen,
|
|
7534
7947
|
onClick: toggleHistory,
|
|
7535
|
-
children: /* @__PURE__ */
|
|
7948
|
+
children: /* @__PURE__ */ jsx19(HistoryIcon, { size: 16 })
|
|
7536
7949
|
}
|
|
7537
7950
|
),
|
|
7538
7951
|
slots.headerStart,
|
|
7539
|
-
/* @__PURE__ */
|
|
7540
|
-
showStatus && /* @__PURE__ */
|
|
7541
|
-
/* @__PURE__ */
|
|
7542
|
-
/* @__PURE__ */
|
|
7952
|
+
/* @__PURE__ */ jsx19("div", { className: "awr-chat__title", children: title }),
|
|
7953
|
+
showStatus && /* @__PURE__ */ jsxs18("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
|
|
7954
|
+
/* @__PURE__ */ jsx19("span", { className: "awr-status__dot" }),
|
|
7955
|
+
/* @__PURE__ */ jsx19("span", { className: "awr-status__text", children: L.status[agent.status] })
|
|
7543
7956
|
] }),
|
|
7544
|
-
showTotalUsage && /* @__PURE__ */
|
|
7545
|
-
files && /* @__PURE__ */
|
|
7957
|
+
showTotalUsage && /* @__PURE__ */ jsx19("span", { title: L.totalUsage, children: /* @__PURE__ */ jsx19(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
|
|
7958
|
+
files && /* @__PURE__ */ jsx19(
|
|
7546
7959
|
"button",
|
|
7547
7960
|
{
|
|
7548
7961
|
type: "button",
|
|
@@ -7551,12 +7964,12 @@ var AgentChatInner = ({
|
|
|
7551
7964
|
title: L.showFiles,
|
|
7552
7965
|
"aria-pressed": filesOpen,
|
|
7553
7966
|
onClick: toggleFiles,
|
|
7554
|
-
children: /* @__PURE__ */
|
|
7967
|
+
children: /* @__PURE__ */ jsx19(FileIcon, { size: 16 })
|
|
7555
7968
|
}
|
|
7556
7969
|
),
|
|
7557
7970
|
slots.headerEnd
|
|
7558
7971
|
] });
|
|
7559
|
-
return /* @__PURE__ */
|
|
7972
|
+
return /* @__PURE__ */ jsxs18(
|
|
7560
7973
|
"div",
|
|
7561
7974
|
{
|
|
7562
7975
|
ref: rootRef,
|
|
@@ -7564,8 +7977,16 @@ var AgentChatInner = ({
|
|
|
7564
7977
|
style,
|
|
7565
7978
|
"data-awr-theme": theme === "auto" ? void 0 : theme,
|
|
7566
7979
|
children: [
|
|
7567
|
-
|
|
7568
|
-
|
|
7980
|
+
overlayOpen && /* @__PURE__ */ jsx19(
|
|
7981
|
+
"div",
|
|
7982
|
+
{
|
|
7983
|
+
className: cx("awr-chat__scrim", classNames.scrim),
|
|
7984
|
+
"aria-hidden": "true",
|
|
7985
|
+
onClick: closeOverlays
|
|
7986
|
+
}
|
|
7987
|
+
),
|
|
7988
|
+
chats && historyOpen && /* @__PURE__ */ jsxs18("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
|
|
7989
|
+
/* @__PURE__ */ jsx19(
|
|
7569
7990
|
HistoryList,
|
|
7570
7991
|
{
|
|
7571
7992
|
history: {
|
|
@@ -7584,7 +8005,7 @@ var AgentChatInner = ({
|
|
|
7584
8005
|
}
|
|
7585
8006
|
),
|
|
7586
8007
|
slots.sidebar,
|
|
7587
|
-
/* @__PURE__ */
|
|
8008
|
+
/* @__PURE__ */ jsx19(
|
|
7588
8009
|
"button",
|
|
7589
8010
|
{
|
|
7590
8011
|
type: "button",
|
|
@@ -7595,91 +8016,82 @@ var AgentChatInner = ({
|
|
|
7595
8016
|
}
|
|
7596
8017
|
)
|
|
7597
8018
|
] }),
|
|
7598
|
-
/* @__PURE__ */
|
|
8019
|
+
/* @__PURE__ */ jsxs18("div", { className: cx("awr-chat__main", classNames.main), children: [
|
|
7599
8020
|
header,
|
|
7600
|
-
/* @__PURE__ */
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
renderElicitation
|
|
7672
|
-
}
|
|
7673
|
-
),
|
|
7674
|
-
agent.modelLoad && loading && /* @__PURE__ */ jsx18(ModelLoadBar, { load: agent.modelLoad }),
|
|
7675
|
-
slots.afterMessages
|
|
7676
|
-
]
|
|
7677
|
-
}
|
|
7678
|
-
),
|
|
7679
|
-
/* @__PURE__ */ jsxs17("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
8021
|
+
/* @__PURE__ */ jsxs18("div", { className: cx("awr-chat__body", classNames.body), ref: bodyRef, children: [
|
|
8022
|
+
slots.beforeMessages,
|
|
8023
|
+
/* @__PURE__ */ jsx19(
|
|
8024
|
+
Messages,
|
|
8025
|
+
{
|
|
8026
|
+
messages: agent.messages,
|
|
8027
|
+
empty: emptyState ?? L.emptyState,
|
|
8028
|
+
showActivity,
|
|
8029
|
+
showToolCalls,
|
|
8030
|
+
showUsage,
|
|
8031
|
+
showThoughts,
|
|
8032
|
+
showNotes,
|
|
8033
|
+
showLearned,
|
|
8034
|
+
showTiers,
|
|
8035
|
+
showReplanFailed,
|
|
8036
|
+
showDecisions,
|
|
8037
|
+
showSearchResults,
|
|
8038
|
+
showSubagents,
|
|
8039
|
+
showMedia,
|
|
8040
|
+
showFileChips,
|
|
8041
|
+
files,
|
|
8042
|
+
htmlPreview,
|
|
8043
|
+
onShowFiles: files ? showFiles : void 0,
|
|
8044
|
+
renderFile,
|
|
8045
|
+
renderFileContent,
|
|
8046
|
+
renderMedia,
|
|
8047
|
+
renderSubagent,
|
|
8048
|
+
onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
|
|
8049
|
+
activityOpen,
|
|
8050
|
+
liveExtra,
|
|
8051
|
+
renderContent,
|
|
8052
|
+
renderMessage,
|
|
8053
|
+
renderAttachment,
|
|
8054
|
+
renderToolCall,
|
|
8055
|
+
showApps: appsOn,
|
|
8056
|
+
renderApp: appsOn ? drawApp : void 0,
|
|
8057
|
+
imageViewer,
|
|
8058
|
+
renderImageViewer
|
|
8059
|
+
}
|
|
8060
|
+
),
|
|
8061
|
+
/* @__PURE__ */ jsx19(
|
|
8062
|
+
Approvals,
|
|
8063
|
+
{
|
|
8064
|
+
approvals: agent.pendingApprovals,
|
|
8065
|
+
onApprove: agent.approve,
|
|
8066
|
+
onDeny: agent.deny,
|
|
8067
|
+
showSkillPreview,
|
|
8068
|
+
renderApproval
|
|
8069
|
+
}
|
|
8070
|
+
),
|
|
8071
|
+
appsOn && /* @__PURE__ */ jsx19(
|
|
8072
|
+
AppRequestPrompt,
|
|
8073
|
+
{
|
|
8074
|
+
requests: appHost.requests,
|
|
8075
|
+
onAnswer: appHost.answer,
|
|
8076
|
+
renderRequest: renderAppRequest
|
|
8077
|
+
}
|
|
8078
|
+
),
|
|
8079
|
+
showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ jsx19(
|
|
8080
|
+
Elicitations,
|
|
8081
|
+
{
|
|
8082
|
+
elicitations,
|
|
8083
|
+
onAnswer: onElicitationAnswer,
|
|
8084
|
+
outcomes: agent.elicitations,
|
|
8085
|
+
renderElicitation
|
|
8086
|
+
}
|
|
8087
|
+
),
|
|
8088
|
+
agent.modelLoad && loading && /* @__PURE__ */ jsx19(ModelLoadBar, { load: agent.modelLoad }),
|
|
8089
|
+
slots.afterMessages
|
|
8090
|
+
] }),
|
|
8091
|
+
/* @__PURE__ */ jsxs18("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
7680
8092
|
slots.footerStart,
|
|
7681
|
-
tabNotes.length > 0 && /* @__PURE__ */
|
|
7682
|
-
showContext !== false && /* @__PURE__ */
|
|
8093
|
+
tabNotes.length > 0 && /* @__PURE__ */ jsx19("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text) => /* @__PURE__ */ jsx19("p", { className: "awr-tabnote__text", children: text }, text)) }),
|
|
8094
|
+
showContext !== false && /* @__PURE__ */ jsx19(
|
|
7683
8095
|
ContextMeter,
|
|
7684
8096
|
{
|
|
7685
8097
|
usage: agent.usage,
|
|
@@ -7690,11 +8102,11 @@ var AgentChatInner = ({
|
|
|
7690
8102
|
compacting
|
|
7691
8103
|
}
|
|
7692
8104
|
),
|
|
7693
|
-
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */
|
|
7694
|
-
/* @__PURE__ */
|
|
8105
|
+
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ jsxs18("div", { className: "awr-chat__error", children: [
|
|
8106
|
+
/* @__PURE__ */ jsx19(AlertIcon, { size: 14 }),
|
|
7695
8107
|
" ",
|
|
7696
8108
|
agent.error
|
|
7697
|
-
] }) : /* @__PURE__ */
|
|
8109
|
+
] }) : /* @__PURE__ */ jsx19(
|
|
7698
8110
|
Composer2,
|
|
7699
8111
|
{
|
|
7700
8112
|
controller: agent,
|
|
@@ -7710,8 +8122,8 @@ var AgentChatInner = ({
|
|
|
7710
8122
|
] }),
|
|
7711
8123
|
appPanelNode && (panelTarget ? (
|
|
7712
8124
|
// Outside the chat: the theme tokens come with it.
|
|
7713
|
-
|
|
7714
|
-
/* @__PURE__ */
|
|
8125
|
+
createPortal2(
|
|
8126
|
+
/* @__PURE__ */ jsx19(
|
|
7715
8127
|
"div",
|
|
7716
8128
|
{
|
|
7717
8129
|
className: "awr-theme awr-apppanel",
|
|
@@ -7721,24 +8133,24 @@ var AgentChatInner = ({
|
|
|
7721
8133
|
),
|
|
7722
8134
|
panelTarget
|
|
7723
8135
|
)
|
|
7724
|
-
) : asSheet ? /* @__PURE__ */
|
|
7725
|
-
/* @__PURE__ */
|
|
7726
|
-
/* @__PURE__ */
|
|
8136
|
+
) : asSheet ? /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
8137
|
+
/* @__PURE__ */ jsx19("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
|
|
8138
|
+
/* @__PURE__ */ jsxs18(
|
|
7727
8139
|
"aside",
|
|
7728
8140
|
{
|
|
7729
8141
|
className: "awr-chat__appsheet",
|
|
7730
8142
|
role: "dialog",
|
|
7731
8143
|
"aria-label": L.appFrom(panelApp.server),
|
|
7732
8144
|
children: [
|
|
7733
|
-
/* @__PURE__ */
|
|
8145
|
+
/* @__PURE__ */ jsx19("div", { className: "awr-sheet__grab" }),
|
|
7734
8146
|
appPanelNode
|
|
7735
8147
|
]
|
|
7736
8148
|
}
|
|
7737
8149
|
)
|
|
7738
|
-
] }) : /* @__PURE__ */
|
|
7739
|
-
files && filesOpen && /* @__PURE__ */
|
|
7740
|
-
/* @__PURE__ */
|
|
7741
|
-
/* @__PURE__ */
|
|
8150
|
+
] }) : /* @__PURE__ */ jsx19("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
|
|
8151
|
+
files && filesOpen && /* @__PURE__ */ jsxs18("aside", { className: cx("awr-chat__files", classNames.files), children: [
|
|
8152
|
+
/* @__PURE__ */ jsx19(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ jsx19(Files, { files }) }),
|
|
8153
|
+
/* @__PURE__ */ jsx19(
|
|
7742
8154
|
"button",
|
|
7743
8155
|
{
|
|
7744
8156
|
type: "button",
|
|
@@ -7755,7 +8167,7 @@ var AgentChatInner = ({
|
|
|
7755
8167
|
};
|
|
7756
8168
|
|
|
7757
8169
|
// src/components/LearnedSkills.tsx
|
|
7758
|
-
import { jsx as
|
|
8170
|
+
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7759
8171
|
var LearnedSkills = ({
|
|
7760
8172
|
controller,
|
|
7761
8173
|
lessons,
|
|
@@ -7771,18 +8183,18 @@ var LearnedSkills = ({
|
|
|
7771
8183
|
const c = controller ?? ctx;
|
|
7772
8184
|
const list = lessons ?? c?.learned ?? [];
|
|
7773
8185
|
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
7774
|
-
return /* @__PURE__ */
|
|
7775
|
-
!hideTitle && /* @__PURE__ */
|
|
7776
|
-
/* @__PURE__ */
|
|
8186
|
+
return /* @__PURE__ */ jsxs19("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
8187
|
+
!hideTitle && /* @__PURE__ */ jsxs19("h3", { className: "awr-notebook__title", children: [
|
|
8188
|
+
/* @__PURE__ */ jsx20(BookIcon, { size: 14 }),
|
|
7777
8189
|
" ",
|
|
7778
8190
|
L.notebookTitle,
|
|
7779
|
-
list.length > 0 && /* @__PURE__ */
|
|
8191
|
+
list.length > 0 && /* @__PURE__ */ jsx20("span", { className: "awr-notebook__count", children: list.length })
|
|
7780
8192
|
] }),
|
|
7781
|
-
list.length === 0 ? /* @__PURE__ */
|
|
7782
|
-
/* @__PURE__ */
|
|
7783
|
-
/* @__PURE__ */
|
|
7784
|
-
l.revision > 1 && /* @__PURE__ */
|
|
7785
|
-
forget && /* @__PURE__ */
|
|
8193
|
+
list.length === 0 ? /* @__PURE__ */ jsx20("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ jsx20("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ jsxs19("li", { className: "awr-lesson", children: [
|
|
8194
|
+
/* @__PURE__ */ jsxs19("div", { className: "awr-lesson__head", children: [
|
|
8195
|
+
/* @__PURE__ */ jsx20("code", { className: "awr-lesson__name", children: l.name }),
|
|
8196
|
+
l.revision > 1 && /* @__PURE__ */ jsx20("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
8197
|
+
forget && /* @__PURE__ */ jsx20(
|
|
7786
8198
|
"button",
|
|
7787
8199
|
{
|
|
7788
8200
|
type: "button",
|
|
@@ -7790,12 +8202,12 @@ var LearnedSkills = ({
|
|
|
7790
8202
|
title: `${L.notebookForget}: ${l.name}`,
|
|
7791
8203
|
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
7792
8204
|
onClick: () => void forget(l.name),
|
|
7793
|
-
children: /* @__PURE__ */
|
|
8205
|
+
children: /* @__PURE__ */ jsx20(XIcon, { size: 12 })
|
|
7794
8206
|
}
|
|
7795
8207
|
)
|
|
7796
8208
|
] }),
|
|
7797
|
-
/* @__PURE__ */
|
|
7798
|
-
showSources && l.sources.length > 0 && /* @__PURE__ */
|
|
8209
|
+
/* @__PURE__ */ jsx20("p", { className: "awr-lesson__when", children: l.description }),
|
|
8210
|
+
showSources && l.sources.length > 0 && /* @__PURE__ */ jsxs19("p", { className: "awr-lesson__from", children: [
|
|
7799
8211
|
L.notebookFrom,
|
|
7800
8212
|
" ",
|
|
7801
8213
|
l.sources.join(", ")
|
|
@@ -7805,8 +8217,8 @@ var LearnedSkills = ({
|
|
|
7805
8217
|
};
|
|
7806
8218
|
|
|
7807
8219
|
// src/components/Composer.tsx
|
|
7808
|
-
import { useState as
|
|
7809
|
-
import { jsx as
|
|
8220
|
+
import { useState as useState17 } from "react";
|
|
8221
|
+
import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7810
8222
|
var Composer = ({
|
|
7811
8223
|
onSubmit,
|
|
7812
8224
|
busy = false,
|
|
@@ -7815,7 +8227,7 @@ var Composer = ({
|
|
|
7815
8227
|
placeholder = "Ask the agent to do something\u2026",
|
|
7816
8228
|
className
|
|
7817
8229
|
}) => {
|
|
7818
|
-
const [text, setText] =
|
|
8230
|
+
const [text, setText] = useState17("");
|
|
7819
8231
|
const submit = () => {
|
|
7820
8232
|
const value = text.trim();
|
|
7821
8233
|
if (!value || busy || disabled) return;
|
|
@@ -7828,7 +8240,7 @@ var Composer = ({
|
|
|
7828
8240
|
submit();
|
|
7829
8241
|
}
|
|
7830
8242
|
};
|
|
7831
|
-
return /* @__PURE__ */
|
|
8243
|
+
return /* @__PURE__ */ jsxs20(
|
|
7832
8244
|
"form",
|
|
7833
8245
|
{
|
|
7834
8246
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -7837,7 +8249,7 @@ var Composer = ({
|
|
|
7837
8249
|
submit();
|
|
7838
8250
|
},
|
|
7839
8251
|
children: [
|
|
7840
|
-
/* @__PURE__ */
|
|
8252
|
+
/* @__PURE__ */ jsx21(
|
|
7841
8253
|
"textarea",
|
|
7842
8254
|
{
|
|
7843
8255
|
className: "awr-composer__input",
|
|
@@ -7849,23 +8261,23 @@ var Composer = ({
|
|
|
7849
8261
|
rows: 1
|
|
7850
8262
|
}
|
|
7851
8263
|
),
|
|
7852
|
-
busy ? /* @__PURE__ */
|
|
8264
|
+
busy ? /* @__PURE__ */ jsx21(
|
|
7853
8265
|
"button",
|
|
7854
8266
|
{
|
|
7855
8267
|
type: "button",
|
|
7856
8268
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
7857
8269
|
onClick: onStop,
|
|
7858
8270
|
"aria-label": "Stop",
|
|
7859
|
-
children: /* @__PURE__ */
|
|
8271
|
+
children: /* @__PURE__ */ jsx21(StopIcon, { size: 18 })
|
|
7860
8272
|
}
|
|
7861
|
-
) : /* @__PURE__ */
|
|
8273
|
+
) : /* @__PURE__ */ jsx21(
|
|
7862
8274
|
"button",
|
|
7863
8275
|
{
|
|
7864
8276
|
type: "submit",
|
|
7865
8277
|
className: "awr-composer__btn",
|
|
7866
8278
|
disabled: disabled || !text.trim(),
|
|
7867
8279
|
"aria-label": "Send",
|
|
7868
|
-
children: disabled ? /* @__PURE__ */
|
|
8280
|
+
children: disabled ? /* @__PURE__ */ jsx21(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ jsx21(SendIcon, { size: 18 })
|
|
7869
8281
|
}
|
|
7870
8282
|
)
|
|
7871
8283
|
]
|
|
@@ -7874,17 +8286,17 @@ var Composer = ({
|
|
|
7874
8286
|
};
|
|
7875
8287
|
|
|
7876
8288
|
// src/components/PlanView.tsx
|
|
7877
|
-
import { jsx as
|
|
8289
|
+
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7878
8290
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
7879
8291
|
if (!plan.steps.length && !plan.thought) return null;
|
|
7880
|
-
return /* @__PURE__ */
|
|
7881
|
-
showThought && plan.thought.trim() && /* @__PURE__ */
|
|
7882
|
-
plan.steps.length > 0 && /* @__PURE__ */
|
|
8292
|
+
return /* @__PURE__ */ jsxs21("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
8293
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ jsx22("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
8294
|
+
plan.steps.length > 0 && /* @__PURE__ */ jsx22("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ jsx22("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
7883
8295
|
] });
|
|
7884
8296
|
};
|
|
7885
8297
|
|
|
7886
8298
|
// src/components/ApprovalModeSwitch.tsx
|
|
7887
|
-
import { jsx as
|
|
8299
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
7888
8300
|
var DEFAULT_LABELS = {
|
|
7889
8301
|
autopilot: "Autopilot",
|
|
7890
8302
|
"ask-writes": "Ask before changes",
|
|
@@ -7904,13 +8316,13 @@ var ApprovalModeSwitch = ({
|
|
|
7904
8316
|
labels,
|
|
7905
8317
|
disabled,
|
|
7906
8318
|
className
|
|
7907
|
-
}) => /* @__PURE__ */
|
|
8319
|
+
}) => /* @__PURE__ */ jsx23(
|
|
7908
8320
|
"div",
|
|
7909
8321
|
{
|
|
7910
8322
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
7911
8323
|
role: "radiogroup",
|
|
7912
8324
|
"aria-label": "Tool consent",
|
|
7913
|
-
children: modes.map((m) => /* @__PURE__ */
|
|
8325
|
+
children: modes.map((m) => /* @__PURE__ */ jsx23(
|
|
7914
8326
|
"button",
|
|
7915
8327
|
{
|
|
7916
8328
|
type: "button",
|
|
@@ -7928,8 +8340,8 @@ var ApprovalModeSwitch = ({
|
|
|
7928
8340
|
);
|
|
7929
8341
|
|
|
7930
8342
|
// src/components/ApiKeyForm.tsx
|
|
7931
|
-
import { useEffect as
|
|
7932
|
-
import { jsx as
|
|
8343
|
+
import { useEffect as useEffect17, useState as useState18 } from "react";
|
|
8344
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7933
8345
|
var ApiKeyForm = ({
|
|
7934
8346
|
credentials,
|
|
7935
8347
|
credentialRef,
|
|
@@ -7938,10 +8350,10 @@ var ApiKeyForm = ({
|
|
|
7938
8350
|
onChange,
|
|
7939
8351
|
className
|
|
7940
8352
|
}) => {
|
|
7941
|
-
const [value, setValue] =
|
|
7942
|
-
const [present, setPresent] =
|
|
7943
|
-
const [busy, setBusy] =
|
|
7944
|
-
|
|
8353
|
+
const [value, setValue] = useState18("");
|
|
8354
|
+
const [present, setPresent] = useState18(false);
|
|
8355
|
+
const [busy, setBusy] = useState18(false);
|
|
8356
|
+
useEffect17(() => {
|
|
7945
8357
|
let active = true;
|
|
7946
8358
|
credentials.hasKey(credentialRef).then((has) => {
|
|
7947
8359
|
if (active) setPresent(has);
|
|
@@ -7973,16 +8385,16 @@ var ApiKeyForm = ({
|
|
|
7973
8385
|
setBusy(false);
|
|
7974
8386
|
}
|
|
7975
8387
|
};
|
|
7976
|
-
return /* @__PURE__ */
|
|
7977
|
-
/* @__PURE__ */
|
|
8388
|
+
return /* @__PURE__ */ jsxs22("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
8389
|
+
/* @__PURE__ */ jsxs22("label", { className: "awr-keyform__label", children: [
|
|
7978
8390
|
label,
|
|
7979
|
-
present && /* @__PURE__ */
|
|
7980
|
-
/* @__PURE__ */
|
|
8391
|
+
present && /* @__PURE__ */ jsxs22("span", { className: "awr-keyform__saved", children: [
|
|
8392
|
+
/* @__PURE__ */ jsx24(CheckIcon, { size: 12 }),
|
|
7981
8393
|
" stored, encrypted"
|
|
7982
8394
|
] })
|
|
7983
8395
|
] }),
|
|
7984
|
-
/* @__PURE__ */
|
|
7985
|
-
/* @__PURE__ */
|
|
8396
|
+
/* @__PURE__ */ jsxs22("div", { className: "awr-keyform__row", children: [
|
|
8397
|
+
/* @__PURE__ */ jsx24(
|
|
7986
8398
|
"input",
|
|
7987
8399
|
{
|
|
7988
8400
|
className: "awr-keyform__input",
|
|
@@ -8000,7 +8412,7 @@ var ApiKeyForm = ({
|
|
|
8000
8412
|
disabled: busy
|
|
8001
8413
|
}
|
|
8002
8414
|
),
|
|
8003
|
-
/* @__PURE__ */
|
|
8415
|
+
/* @__PURE__ */ jsx24(
|
|
8004
8416
|
"button",
|
|
8005
8417
|
{
|
|
8006
8418
|
type: "button",
|
|
@@ -8010,7 +8422,7 @@ var ApiKeyForm = ({
|
|
|
8010
8422
|
children: "Save"
|
|
8011
8423
|
}
|
|
8012
8424
|
),
|
|
8013
|
-
present && /* @__PURE__ */
|
|
8425
|
+
present && /* @__PURE__ */ jsx24(
|
|
8014
8426
|
"button",
|
|
8015
8427
|
{
|
|
8016
8428
|
type: "button",
|
|
@@ -8075,6 +8487,8 @@ export {
|
|
|
8075
8487
|
ContextMeter,
|
|
8076
8488
|
ElicitationPrompt,
|
|
8077
8489
|
FILE_PREVIEW_CHARS,
|
|
8490
|
+
FOLLOW_LEAVE_PX,
|
|
8491
|
+
FOLLOW_REJOIN_PX,
|
|
8078
8492
|
FRAME_MAX_HEIGHT,
|
|
8079
8493
|
FRAME_MIN_HEIGHT,
|
|
8080
8494
|
FileChip,
|
|
@@ -8082,6 +8496,9 @@ export {
|
|
|
8082
8496
|
FilesPanel,
|
|
8083
8497
|
GeneratedMedia,
|
|
8084
8498
|
HTML_PREVIEW_MAX_CHARS,
|
|
8499
|
+
ImageThumb,
|
|
8500
|
+
ImageViewer,
|
|
8501
|
+
ImageViewerProvider,
|
|
8085
8502
|
ImagesNotSupportedError,
|
|
8086
8503
|
IndexedDBStore,
|
|
8087
8504
|
LearnedSkills,
|
|
@@ -8171,11 +8588,14 @@ export {
|
|
|
8171
8588
|
elicitationLink,
|
|
8172
8589
|
escapeAttribute,
|
|
8173
8590
|
fileKindOf,
|
|
8174
|
-
fileNameOf,
|
|
8591
|
+
fileNameOf2 as fileNameOf,
|
|
8175
8592
|
filterCommands,
|
|
8593
|
+
followsAfterResize,
|
|
8594
|
+
followsAfterScroll,
|
|
8176
8595
|
formatCountdown,
|
|
8177
8596
|
formatElapsed,
|
|
8178
8597
|
grantedAppCsp,
|
|
8598
|
+
imageExtensionOf,
|
|
8179
8599
|
isMcpAppSandboxMessage,
|
|
8180
8600
|
isWebGPUAvailable2 as isWebGPUAvailable,
|
|
8181
8601
|
lessonsOf,
|
|
@@ -8217,6 +8637,7 @@ export {
|
|
|
8217
8637
|
useAgentContext,
|
|
8218
8638
|
useChatHistory,
|
|
8219
8639
|
useCredentials,
|
|
8640
|
+
useFollowScroll,
|
|
8220
8641
|
useLabels,
|
|
8221
8642
|
useLocalModel,
|
|
8222
8643
|
useMcpAppHost,
|