@dudko.dev/agent-web-react 0.0.35 → 0.0.37
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 +11 -5
- package/dist/{elicitation-xMLll5W9.d.cts → elicitation-NV1_UPkJ.d.cts} +15 -1
- package/dist/{elicitation-xMLll5W9.d.ts → elicitation-NV1_UPkJ.d.ts} +15 -1
- package/dist/index.cjs +222 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -9
- package/dist/index.d.ts +53 -9
- package/dist/index.js +249 -105
- 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 +13 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1238,7 +1238,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
1238
1238
|
...ctx.goal ? {
|
|
1239
1239
|
queued: [
|
|
1240
1240
|
...state.queued.filter((q) => q.id !== WAITING_ID),
|
|
1241
|
-
{ id: WAITING_ID, text: ctx.goal }
|
|
1241
|
+
{ id: WAITING_ID, text: ctx.goal, session: event.heldBy }
|
|
1242
1242
|
]
|
|
1243
1243
|
} : {}
|
|
1244
1244
|
};
|
|
@@ -1266,11 +1266,11 @@ var applyEvent = (state, event, ctx) => {
|
|
|
1266
1266
|
(q) => q.status === "pending" ? { ...q, status: "stopped", automatic: true, reason: "stopped" } : q
|
|
1267
1267
|
)
|
|
1268
1268
|
} : {},
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
state
|
|
1272
|
-
|
|
1273
|
-
)
|
|
1269
|
+
// What it had written, or nothing - the chat says "stopped" through its labels.
|
|
1270
|
+
messages: finalizeAssistant(state.messages, state.finalText, {
|
|
1271
|
+
...runDuration(state, ctx.at),
|
|
1272
|
+
stopped: true
|
|
1273
|
+
})
|
|
1274
1274
|
};
|
|
1275
1275
|
case "error":
|
|
1276
1276
|
if (event.phase === "replan") {
|
|
@@ -1856,21 +1856,43 @@ var ChatHistoryStore = class {
|
|
|
1856
1856
|
if (opts.memory || typeof indexedDB === "undefined") this.memory = /* @__PURE__ */ new Map();
|
|
1857
1857
|
this.dbName = this.memory ? void 0 : this.name;
|
|
1858
1858
|
}
|
|
1859
|
+
/**
|
|
1860
|
+
* The store's connection, opened on first use. Never in another tab's way: when another
|
|
1861
|
+
* connection asks to delete or upgrade the database (`versionchange` - another tab's
|
|
1862
|
+
* `indexedDB.deleteDatabase`, a newer copy of this package), it is closed at once, so that
|
|
1863
|
+
* request goes ahead instead of waiting for this tab to close; one the browser closed by itself
|
|
1864
|
+
* (site data cleared) is let go too. The next use opens the database again - after a deletion a
|
|
1865
|
+
* new, empty one (no chats: `list()` is empty, a save starts it again); after an upgrade by a
|
|
1866
|
+
* newer copy, the open fails until the page is reloaded with that copy.
|
|
1867
|
+
*/
|
|
1859
1868
|
open() {
|
|
1860
|
-
this.db
|
|
1869
|
+
if (this.db) return this.db;
|
|
1870
|
+
const opening = new Promise((resolve, reject) => {
|
|
1861
1871
|
const r = indexedDB.open(this.name, DB_VERSION);
|
|
1862
1872
|
r.onupgradeneeded = () => {
|
|
1863
1873
|
if (!r.result.objectStoreNames.contains(this.storeName)) {
|
|
1864
1874
|
r.result.createObjectStore(this.storeName, { keyPath: "id" });
|
|
1865
1875
|
}
|
|
1866
1876
|
};
|
|
1867
|
-
r.onsuccess = () =>
|
|
1877
|
+
r.onsuccess = () => {
|
|
1878
|
+
const db = r.result;
|
|
1879
|
+
const forget = () => {
|
|
1880
|
+
if (this.db === opening) this.db = void 0;
|
|
1881
|
+
};
|
|
1882
|
+
db.addEventListener("versionchange", () => {
|
|
1883
|
+
forget();
|
|
1884
|
+
db.close();
|
|
1885
|
+
});
|
|
1886
|
+
db.addEventListener("close", forget);
|
|
1887
|
+
resolve(db);
|
|
1888
|
+
};
|
|
1868
1889
|
r.onerror = () => reject(r.error);
|
|
1869
1890
|
}).catch((err) => {
|
|
1870
|
-
this.db = void 0;
|
|
1891
|
+
if (this.db === opening) this.db = void 0;
|
|
1871
1892
|
throw err;
|
|
1872
1893
|
});
|
|
1873
|
-
|
|
1894
|
+
this.db = opening;
|
|
1895
|
+
return opening;
|
|
1874
1896
|
}
|
|
1875
1897
|
async tx(mode) {
|
|
1876
1898
|
const db = await this.open();
|
|
@@ -2519,6 +2541,31 @@ var attachmentRefusal = (kind, caps, canConvertPdf = false) => {
|
|
|
2519
2541
|
}
|
|
2520
2542
|
return void 0;
|
|
2521
2543
|
};
|
|
2544
|
+
var menuSections = (options) => {
|
|
2545
|
+
const out = [];
|
|
2546
|
+
for (const option of options) {
|
|
2547
|
+
const section = option.section || void 0;
|
|
2548
|
+
const last = out[out.length - 1];
|
|
2549
|
+
if (last && last.section === section) last.options.push(option);
|
|
2550
|
+
else out.push({ ...section ? { section } : {}, options: [option] });
|
|
2551
|
+
}
|
|
2552
|
+
return out;
|
|
2553
|
+
};
|
|
2554
|
+
var menuKeyTarget = (key, index, count) => {
|
|
2555
|
+
if (count <= 0) return void 0;
|
|
2556
|
+
switch (key) {
|
|
2557
|
+
case "ArrowDown":
|
|
2558
|
+
return index < 0 ? 0 : (index + 1) % count;
|
|
2559
|
+
case "ArrowUp":
|
|
2560
|
+
return index < 0 ? count - 1 : (index - 1 + count) % count;
|
|
2561
|
+
case "Home":
|
|
2562
|
+
return 0;
|
|
2563
|
+
case "End":
|
|
2564
|
+
return count - 1;
|
|
2565
|
+
default:
|
|
2566
|
+
return void 0;
|
|
2567
|
+
}
|
|
2568
|
+
};
|
|
2522
2569
|
var formatElapsed = (ms) => {
|
|
2523
2570
|
const s = Math.max(0, Math.floor(ms / 1e3));
|
|
2524
2571
|
if (s < 60) return `${s}s`;
|
|
@@ -2589,6 +2636,7 @@ var defaultLabels = {
|
|
|
2589
2636
|
fetches: (n) => plural(n, "web request", "web requests"),
|
|
2590
2637
|
fetchRefused: (reason) => `refused: ${reason}`,
|
|
2591
2638
|
answerThoughts: "Thinking about the answer",
|
|
2639
|
+
answerStopped: "Stopped.",
|
|
2592
2640
|
stepThoughts: "Thoughts",
|
|
2593
2641
|
usageTitle: "Tokens this answer spent, by kind",
|
|
2594
2642
|
attachments: "Attachments",
|
|
@@ -2679,6 +2727,7 @@ var defaultLabels = {
|
|
|
2679
2727
|
steer: "Send to the agent",
|
|
2680
2728
|
noAttachmentsWhileBusy: "Files can\u2019t be added while the agent is working \u2014 send them with your next message.",
|
|
2681
2729
|
queuedWaiting: "waiting for the agent\u2019s next step",
|
|
2730
|
+
queuedForSession: (heldBy) => heldBy === "this-tab" ? "waiting for the other run to finish" : "waiting for the other tab to finish",
|
|
2682
2731
|
noteAt: {
|
|
2683
2732
|
round: "you said, between tool calls",
|
|
2684
2733
|
step: "you said, after this step",
|
|
@@ -4947,8 +4996,8 @@ var McpAppLine = ({ app, note, action, onAction, labels, className }) => {
|
|
|
4947
4996
|
};
|
|
4948
4997
|
|
|
4949
4998
|
// src/components/AgentComposer.tsx
|
|
4950
|
-
import { useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useMemo as useMemo6, useRef as useRef8, useState as useState9 } from "react";
|
|
4951
|
-
import { Fragment as
|
|
4999
|
+
import { Fragment as Fragment2, useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useMemo as useMemo6, useRef as useRef8, useState as useState9 } from "react";
|
|
5000
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4952
5001
|
var thinkingDefaults = (l) => [
|
|
4953
5002
|
{ id: "off", label: l.thinkingLevels.off },
|
|
4954
5003
|
{ id: "none", label: l.thinkingLevels.none },
|
|
@@ -4958,6 +5007,34 @@ var thinkingDefaults = (l) => [
|
|
|
4958
5007
|
];
|
|
4959
5008
|
var MODES = ["autopilot", "ask-writes", "ask-all", "read-only"];
|
|
4960
5009
|
var ModeIcon = ({ mode }) => mode === "autopilot" ? /* @__PURE__ */ jsx5(BoltIcon, { size: 14 }) : mode === "read-only" ? /* @__PURE__ */ jsx5(EyeIcon, { size: 14 }) : /* @__PURE__ */ jsx5(ShieldIcon, { size: 14 });
|
|
5010
|
+
var useMenuKeys = (open, menuRef, chipRef, close) => {
|
|
5011
|
+
useEffect9(() => {
|
|
5012
|
+
if (!open) return;
|
|
5013
|
+
const menu = menuRef.current;
|
|
5014
|
+
const rows = menu ? [...menu.querySelectorAll('[role^="menuitem"]')] : [];
|
|
5015
|
+
(rows.find((r) => r.getAttribute("aria-checked") === "true") ?? rows[0])?.focus();
|
|
5016
|
+
}, [open, menuRef]);
|
|
5017
|
+
return (e) => {
|
|
5018
|
+
const menu = menuRef.current;
|
|
5019
|
+
if (!menu) return;
|
|
5020
|
+
if (e.key === "Escape") {
|
|
5021
|
+
e.preventDefault();
|
|
5022
|
+
close();
|
|
5023
|
+
chipRef.current?.focus();
|
|
5024
|
+
return;
|
|
5025
|
+
}
|
|
5026
|
+
const rows = [...menu.querySelectorAll('[role^="menuitem"]')];
|
|
5027
|
+
const to = menuKeyTarget(
|
|
5028
|
+
e.key,
|
|
5029
|
+
rows.indexOf(document.activeElement),
|
|
5030
|
+
rows.length
|
|
5031
|
+
);
|
|
5032
|
+
if (to === void 0) return;
|
|
5033
|
+
e.preventDefault();
|
|
5034
|
+
rows[to].focus();
|
|
5035
|
+
};
|
|
5036
|
+
};
|
|
5037
|
+
var opensMenu = (key) => key === "ArrowDown" || key === "ArrowUp";
|
|
4961
5038
|
var attachSeq = 0;
|
|
4962
5039
|
var useIsoLayoutEffect3 = typeof window === "undefined" ? useEffect9 : useLayoutEffect3;
|
|
4963
5040
|
var useMenuPlacement = (open, anchor, align) => {
|
|
@@ -5049,6 +5126,10 @@ var AgentComposer = ({
|
|
|
5049
5126
|
const rootRef = useRef8(null);
|
|
5050
5127
|
const modelRef = useRef8(null);
|
|
5051
5128
|
const modeRef = useRef8(null);
|
|
5129
|
+
const modelChipRef = useRef8(null);
|
|
5130
|
+
const modeChipRef = useRef8(null);
|
|
5131
|
+
const modelMenuRef = useRef8(null);
|
|
5132
|
+
const modeMenuRef = useRef8(null);
|
|
5052
5133
|
const [dropRect, setDropRect] = useState9();
|
|
5053
5134
|
const [compactBar, setCompactBar] = useState9(false);
|
|
5054
5135
|
useEffect9(() => {
|
|
@@ -5177,6 +5258,9 @@ ${draftText}` : draftText);
|
|
|
5177
5258
|
const commandsStyle = useMenuPlacement(paletteOpen, rootRef, "stretch");
|
|
5178
5259
|
const modelStyle = useMenuPlacement(menu === "model", modelRef, "left");
|
|
5179
5260
|
const modeStyle = useMenuPlacement(menu === "mode", modeRef, "right");
|
|
5261
|
+
const closeMenu = () => setMenu(void 0);
|
|
5262
|
+
const modelMenuKeys = useMenuKeys(menu === "model", modelMenuRef, modelChipRef, closeMenu);
|
|
5263
|
+
const modeMenuKeys = useMenuKeys(menu === "mode", modeMenuRef, modeChipRef, closeMenu);
|
|
5180
5264
|
useEffect9(() => setActive(0), [text, menu]);
|
|
5181
5265
|
useEffect9(() => {
|
|
5182
5266
|
if (!menu) return;
|
|
@@ -5455,7 +5539,7 @@ ${draftText}` : draftText);
|
|
|
5455
5539
|
/* @__PURE__ */ jsx5(ClockIcon, { size: 13, className: "awr-queued__icon" }),
|
|
5456
5540
|
/* @__PURE__ */ jsx5("span", { className: "awr-queued__text", title: q.text, children: q.text }),
|
|
5457
5541
|
q.origin === "another-tab" && /* @__PURE__ */ jsx5("span", { className: "awr-queued__origin", children: L.fromAnotherTab }),
|
|
5458
|
-
/* @__PURE__ */ jsx5("span", { className: "awr-queued__state", children: L.queuedWaiting })
|
|
5542
|
+
/* @__PURE__ */ jsx5("span", { className: "awr-queued__state", children: q.session ? L.queuedForSession(q.session) : L.queuedWaiting })
|
|
5459
5543
|
] }, q.id)),
|
|
5460
5544
|
agent.undelivered.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "awr-queued__item awr-queued__item--undelivered", role: "status", children: [
|
|
5461
5545
|
/* @__PURE__ */ jsx5(AlertIcon, { size: 13, className: "awr-queued__icon" }),
|
|
@@ -5574,7 +5658,7 @@ ${draftText}` : draftText);
|
|
|
5574
5658
|
] }),
|
|
5575
5659
|
stt.listening && stt.interim && /* @__PURE__ */ jsx5("div", { className: "awr-composer2__interim", children: stt.interim }),
|
|
5576
5660
|
/* @__PURE__ */ jsxs3("div", { className: "awr-toolbar", children: [
|
|
5577
|
-
attachments !== false && /* @__PURE__ */ jsxs3(
|
|
5661
|
+
attachments !== false && /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
5578
5662
|
/* @__PURE__ */ jsx5(
|
|
5579
5663
|
"button",
|
|
5580
5664
|
{
|
|
@@ -5634,8 +5718,15 @@ ${draftText}` : draftText);
|
|
|
5634
5718
|
"button",
|
|
5635
5719
|
{
|
|
5636
5720
|
type: "button",
|
|
5721
|
+
ref: modelChipRef,
|
|
5637
5722
|
className: "awr-tchip awr-tchip--btn",
|
|
5638
5723
|
onClick: () => setMenu(menu === "model" ? void 0 : "model"),
|
|
5724
|
+
onKeyDown: (e) => {
|
|
5725
|
+
if (menu !== "model" && opensMenu(e.key)) {
|
|
5726
|
+
e.preventDefault();
|
|
5727
|
+
setMenu("model");
|
|
5728
|
+
}
|
|
5729
|
+
},
|
|
5639
5730
|
"aria-haspopup": "menu",
|
|
5640
5731
|
"aria-expanded": menu === "model",
|
|
5641
5732
|
title: [model?.label, thinkingLabel].filter(Boolean).join(" \xB7 "),
|
|
@@ -5645,47 +5736,81 @@ ${draftText}` : draftText);
|
|
|
5645
5736
|
]
|
|
5646
5737
|
}
|
|
5647
5738
|
),
|
|
5648
|
-
menu === "model" && /* @__PURE__ */ jsxs3(
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5739
|
+
menu === "model" && /* @__PURE__ */ jsxs3(
|
|
5740
|
+
"div",
|
|
5741
|
+
{
|
|
5742
|
+
className: "awr-menu awr-menu--pop",
|
|
5743
|
+
style: modelStyle,
|
|
5744
|
+
role: "menu",
|
|
5745
|
+
ref: modelMenuRef,
|
|
5746
|
+
onKeyDown: modelMenuKeys,
|
|
5747
|
+
children: [
|
|
5748
|
+
thinking && /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
5749
|
+
/* @__PURE__ */ jsx5("div", { className: "awr-menu__head", children: L.thinking }),
|
|
5750
|
+
thinkingOptions.map((o) => /* @__PURE__ */ jsx5(
|
|
5751
|
+
"button",
|
|
5752
|
+
{
|
|
5753
|
+
type: "button",
|
|
5754
|
+
role: "menuitemradio",
|
|
5755
|
+
"aria-checked": thinking.value === o.id,
|
|
5756
|
+
className: `awr-menu__item${thinking.value === o.id ? " is-active" : ""}`,
|
|
5757
|
+
onClick: () => {
|
|
5758
|
+
thinking.onChange(o.id);
|
|
5759
|
+
setMenu(void 0);
|
|
5760
|
+
},
|
|
5761
|
+
children: o.label
|
|
5762
|
+
},
|
|
5763
|
+
o.id
|
|
5764
|
+
))
|
|
5765
|
+
] }),
|
|
5766
|
+
model?.options?.length ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
5767
|
+
/* @__PURE__ */ jsx5("div", { className: "awr-menu__head", children: L.model }),
|
|
5768
|
+
menuSections(model.options).map((run, i, runs) => {
|
|
5769
|
+
const rows = run.options.map((o) => /* @__PURE__ */ jsxs3(
|
|
5770
|
+
"button",
|
|
5771
|
+
{
|
|
5772
|
+
type: "button",
|
|
5773
|
+
role: "menuitemradio",
|
|
5774
|
+
"aria-checked": model.value === o.id,
|
|
5775
|
+
className: `awr-menu__item${model.value === o.id ? " is-active" : ""}`,
|
|
5776
|
+
onClick: () => {
|
|
5777
|
+
model.onSelect?.(o.id);
|
|
5778
|
+
setMenu(void 0);
|
|
5779
|
+
},
|
|
5780
|
+
children: [
|
|
5781
|
+
o.label,
|
|
5782
|
+
o.group && /* @__PURE__ */ jsx5("span", { className: "awr-menu__group", children: o.group })
|
|
5783
|
+
]
|
|
5784
|
+
},
|
|
5785
|
+
o.id
|
|
5786
|
+
));
|
|
5787
|
+
if (run.section)
|
|
5788
|
+
return /* @__PURE__ */ jsxs3(
|
|
5789
|
+
"div",
|
|
5790
|
+
{
|
|
5791
|
+
role: "group",
|
|
5792
|
+
"aria-label": run.section,
|
|
5793
|
+
className: "awr-menu__section",
|
|
5794
|
+
children: [
|
|
5795
|
+
/* @__PURE__ */ jsx5(
|
|
5796
|
+
"div",
|
|
5797
|
+
{
|
|
5798
|
+
className: "awr-menu__head awr-menu__sectionhead",
|
|
5799
|
+
"aria-hidden": "true",
|
|
5800
|
+
children: run.section
|
|
5801
|
+
}
|
|
5802
|
+
),
|
|
5803
|
+
rows
|
|
5804
|
+
]
|
|
5805
|
+
},
|
|
5806
|
+
`s${i}`
|
|
5807
|
+
);
|
|
5808
|
+
return runs[i - 1]?.section ? /* @__PURE__ */ jsx5("div", { className: "awr-menu__section awr-menu__section--plain", children: rows }, `s${i}`) : /* @__PURE__ */ jsx5(Fragment2, { children: rows }, `s${i}`);
|
|
5809
|
+
})
|
|
5810
|
+
] }) : null
|
|
5811
|
+
]
|
|
5812
|
+
}
|
|
5813
|
+
)
|
|
5689
5814
|
] }),
|
|
5690
5815
|
/* @__PURE__ */ jsx5("span", { className: "awr-toolbar__spacer" }),
|
|
5691
5816
|
toolbarEnd,
|
|
@@ -5694,9 +5819,16 @@ ${draftText}` : draftText);
|
|
|
5694
5819
|
"button",
|
|
5695
5820
|
{
|
|
5696
5821
|
type: "button",
|
|
5822
|
+
ref: modeChipRef,
|
|
5697
5823
|
className: `awr-tchip awr-tchip--btn awr-mode awr-mode--${agent.approvalMode}`,
|
|
5698
5824
|
title: MODE_CHIP[agent.approvalMode].hint,
|
|
5699
5825
|
onClick: () => setMenu(menu === "mode" ? void 0 : "mode"),
|
|
5826
|
+
onKeyDown: (e) => {
|
|
5827
|
+
if (menu !== "mode" && opensMenu(e.key)) {
|
|
5828
|
+
e.preventDefault();
|
|
5829
|
+
setMenu("mode");
|
|
5830
|
+
}
|
|
5831
|
+
},
|
|
5700
5832
|
"aria-haspopup": "menu",
|
|
5701
5833
|
"aria-expanded": menu === "mode",
|
|
5702
5834
|
"aria-label": `${L.toolConsent}: ${MODE_CHIP[agent.approvalMode].label}`,
|
|
@@ -5706,29 +5838,39 @@ ${draftText}` : draftText);
|
|
|
5706
5838
|
]
|
|
5707
5839
|
}
|
|
5708
5840
|
),
|
|
5709
|
-
menu === "mode" && /* @__PURE__ */ jsxs3(
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
"
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5841
|
+
menu === "mode" && /* @__PURE__ */ jsxs3(
|
|
5842
|
+
"div",
|
|
5843
|
+
{
|
|
5844
|
+
className: "awr-menu awr-menu--pop",
|
|
5845
|
+
style: modeStyle,
|
|
5846
|
+
role: "menu",
|
|
5847
|
+
ref: modeMenuRef,
|
|
5848
|
+
onKeyDown: modeMenuKeys,
|
|
5849
|
+
children: [
|
|
5850
|
+
/* @__PURE__ */ jsx5("div", { className: "awr-menu__head", children: L.toolConsent }),
|
|
5851
|
+
MODES.map((m) => /* @__PURE__ */ jsxs3(
|
|
5852
|
+
"button",
|
|
5853
|
+
{
|
|
5854
|
+
type: "button",
|
|
5855
|
+
role: "menuitemradio",
|
|
5856
|
+
"aria-checked": agent.approvalMode === m,
|
|
5857
|
+
className: `awr-menu__item${agent.approvalMode === m ? " is-active" : ""}`,
|
|
5858
|
+
onClick: () => {
|
|
5859
|
+
agent.setApprovalMode(m);
|
|
5860
|
+
setMenu(void 0);
|
|
5861
|
+
},
|
|
5862
|
+
children: [
|
|
5863
|
+
/* @__PURE__ */ jsx5(ModeIcon, { mode: m }),
|
|
5864
|
+
" ",
|
|
5865
|
+
MODE_CHIP[m].label,
|
|
5866
|
+
/* @__PURE__ */ jsx5("span", { className: "awr-menu__desc", children: MODE_CHIP[m].hint })
|
|
5867
|
+
]
|
|
5868
|
+
},
|
|
5869
|
+
m
|
|
5870
|
+
))
|
|
5871
|
+
]
|
|
5872
|
+
}
|
|
5873
|
+
)
|
|
5732
5874
|
] }),
|
|
5733
5875
|
canSteer && /* @__PURE__ */ jsx5("button", { type: "button", className: "awr-sendbtn", onClick: submit, "aria-label": L.steer, children: /* @__PURE__ */ jsx5(SendIcon, { size: 16 }) }),
|
|
5734
5876
|
busy ? /* @__PURE__ */ jsx5(
|
|
@@ -5758,7 +5900,7 @@ ${draftText}` : draftText);
|
|
|
5758
5900
|
};
|
|
5759
5901
|
|
|
5760
5902
|
// src/components/ChatHistoryList.tsx
|
|
5761
|
-
import { Fragment as
|
|
5903
|
+
import { Fragment as Fragment4 } from "react";
|
|
5762
5904
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
5763
5905
|
var defaultTime = (ms) => {
|
|
5764
5906
|
const d = new Date(ms);
|
|
@@ -5828,7 +5970,7 @@ var ChatHistoryList = ({
|
|
|
5828
5970
|
}
|
|
5829
5971
|
)
|
|
5830
5972
|
] }, c.id);
|
|
5831
|
-
return renderChat ? /* @__PURE__ */ jsx6(
|
|
5973
|
+
return renderChat ? /* @__PURE__ */ jsx6(Fragment4, { children: renderChat(c, active, row) }, c.id) : row;
|
|
5832
5974
|
}) })
|
|
5833
5975
|
] });
|
|
5834
5976
|
};
|
|
@@ -6235,12 +6377,12 @@ var ElicitationPrompt = ({
|
|
|
6235
6377
|
};
|
|
6236
6378
|
|
|
6237
6379
|
// src/components/FilesPanel.tsx
|
|
6238
|
-
import { Fragment as
|
|
6380
|
+
import { Fragment as Fragment6, useEffect as useEffect12, useRef as useRef10, useState as useState12 } from "react";
|
|
6239
6381
|
|
|
6240
6382
|
// src/components/ImageViewer.tsx
|
|
6241
6383
|
import { createContext as createContext3, useContext as useContext3, useEffect as useEffect11, useRef as useRef9, useState as useState11 } from "react";
|
|
6242
6384
|
import { createPortal } from "react-dom";
|
|
6243
|
-
import { Fragment as
|
|
6385
|
+
import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
6244
6386
|
var fileNameOf = (name) => name.split(/[\\/]/).filter(Boolean).pop() ?? name;
|
|
6245
6387
|
var SWIPE_PX = 48;
|
|
6246
6388
|
var ImageViewer = ({ images, index, onIndex, onClose, labels }) => {
|
|
@@ -6381,7 +6523,7 @@ var ImageViewer = ({ images, index, onIndex, onClose, labels }) => {
|
|
|
6381
6523
|
)
|
|
6382
6524
|
}
|
|
6383
6525
|
),
|
|
6384
|
-
count > 1 && /* @__PURE__ */ jsxs7(
|
|
6526
|
+
count > 1 && /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
6385
6527
|
/* @__PURE__ */ jsx9(
|
|
6386
6528
|
"button",
|
|
6387
6529
|
{
|
|
@@ -6454,7 +6596,7 @@ var ImageThumb = ({
|
|
|
6454
6596
|
onClose: close,
|
|
6455
6597
|
labels
|
|
6456
6598
|
});
|
|
6457
|
-
return /* @__PURE__ */ jsxs7(
|
|
6599
|
+
return /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
6458
6600
|
/* @__PURE__ */ jsx9(
|
|
6459
6601
|
"button",
|
|
6460
6602
|
{
|
|
@@ -6484,7 +6626,7 @@ var ImageThumb = ({
|
|
|
6484
6626
|
};
|
|
6485
6627
|
|
|
6486
6628
|
// src/components/FilesPanel.tsx
|
|
6487
|
-
import { Fragment as
|
|
6629
|
+
import { Fragment as Fragment7, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6488
6630
|
var PREVIEW_CHARS = 2e4;
|
|
6489
6631
|
var FilesPanel = ({
|
|
6490
6632
|
files: vfs,
|
|
@@ -6528,7 +6670,7 @@ var FilesPanel = ({
|
|
|
6528
6670
|
return /* @__PURE__ */ jsxs8("div", { className: ["awr-filespanel", className].filter(Boolean).join(" "), children: [
|
|
6529
6671
|
/* @__PURE__ */ jsxs8("div", { className: "awr-panel__head", children: [
|
|
6530
6672
|
/* @__PURE__ */ jsx10("span", { className: "awr-panel__title", children: title ?? L.files }),
|
|
6531
|
-
allowUpload && /* @__PURE__ */ jsxs8(
|
|
6673
|
+
allowUpload && /* @__PURE__ */ jsxs8(Fragment7, { children: [
|
|
6532
6674
|
/* @__PURE__ */ jsx10(
|
|
6533
6675
|
"button",
|
|
6534
6676
|
{
|
|
@@ -6603,7 +6745,7 @@ var FilesPanel = ({
|
|
|
6603
6745
|
},
|
|
6604
6746
|
f.path
|
|
6605
6747
|
);
|
|
6606
|
-
return renderFile ? /* @__PURE__ */ jsx10(
|
|
6748
|
+
return renderFile ? /* @__PURE__ */ jsx10(Fragment6, { children: renderFile(f, row) }, f.path) : row;
|
|
6607
6749
|
}) }),
|
|
6608
6750
|
preview && /* @__PURE__ */ jsx10("div", { className: "awr-filepreview", children: preview.kind === "image" ? (
|
|
6609
6751
|
// A click (Enter, Space) opens it over the chat, fitted to the screen.
|
|
@@ -6623,7 +6765,7 @@ var FilesPanel = ({
|
|
|
6623
6765
|
};
|
|
6624
6766
|
|
|
6625
6767
|
// src/components/FileChips.tsx
|
|
6626
|
-
import { Fragment as
|
|
6768
|
+
import { Fragment as Fragment8, useEffect as useEffect14, useMemo as useMemo7, useState as useState14 } from "react";
|
|
6627
6769
|
|
|
6628
6770
|
// src/file-kinds.ts
|
|
6629
6771
|
import { MEDIA_IMAGE_TYPES, isTextMime } from "@dudko.dev/agent-web";
|
|
@@ -6771,7 +6913,7 @@ var SandboxedFrame = ({
|
|
|
6771
6913
|
] });
|
|
6772
6914
|
|
|
6773
6915
|
// src/components/FileChips.tsx
|
|
6774
|
-
import { Fragment as
|
|
6916
|
+
import { Fragment as Fragment9, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6775
6917
|
var FILE_PREVIEW_CHARS = 2e4;
|
|
6776
6918
|
var textOf = (file) => file.encoding === "base64" ? new TextDecoder().decode(bytesOf(file.content, "base64")) : file.content;
|
|
6777
6919
|
var KIND_ICON = {
|
|
@@ -6835,10 +6977,10 @@ var SourceView = ({
|
|
|
6835
6977
|
() => linesOf(html ? tokenizeHtml(shown) : [{ kind: "text", text: shown }]),
|
|
6836
6978
|
[shown, html]
|
|
6837
6979
|
);
|
|
6838
|
-
return /* @__PURE__ */ jsxs11(
|
|
6980
|
+
return /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
6839
6981
|
/* @__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: [
|
|
6840
6982
|
line.map(
|
|
6841
|
-
(t, k) => t.kind === "text" ? /* @__PURE__ */ jsx13(
|
|
6983
|
+
(t, k) => t.kind === "text" ? /* @__PURE__ */ jsx13(Fragment8, { children: t.text }, k) : /* @__PURE__ */ jsx13("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
|
|
6842
6984
|
),
|
|
6843
6985
|
"\n"
|
|
6844
6986
|
] }, i)) }),
|
|
@@ -6864,11 +7006,11 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6864
7006
|
html: showing === "preview" ? html : void 0,
|
|
6865
7007
|
scripts,
|
|
6866
7008
|
height: tall ? height * 2 : height,
|
|
6867
|
-
label: /* @__PURE__ */ jsxs11(
|
|
7009
|
+
label: /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
6868
7010
|
/* @__PURE__ */ jsx13(CodeIcon, { size: 14, className: "awr-frame__icon" }),
|
|
6869
7011
|
/* @__PURE__ */ jsxs11("span", { className: "awr-frame__titles", children: [
|
|
6870
7012
|
/* @__PURE__ */ jsx13("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
|
|
6871
|
-
/* @__PURE__ */ jsx13("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ jsxs11(
|
|
7013
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
6872
7014
|
/* @__PURE__ */ jsx13(LockIcon, { size: 11 }),
|
|
6873
7015
|
" ",
|
|
6874
7016
|
L.htmlSandboxed,
|
|
@@ -6879,7 +7021,7 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6879
7021
|
] }) : L.htmlSourceNote })
|
|
6880
7022
|
] })
|
|
6881
7023
|
] }),
|
|
6882
|
-
actions: canFrame ? /* @__PURE__ */ jsxs11(
|
|
7024
|
+
actions: canFrame ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
6883
7025
|
/* @__PURE__ */ jsx13(
|
|
6884
7026
|
Seg,
|
|
6885
7027
|
{
|
|
@@ -6906,7 +7048,7 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6906
7048
|
}
|
|
6907
7049
|
)
|
|
6908
7050
|
] }) : void 0,
|
|
6909
|
-
footer: /* @__PURE__ */ jsxs11(
|
|
7051
|
+
footer: /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
6910
7052
|
/* @__PURE__ */ jsx13(FileIcon, { size: 11 }),
|
|
6911
7053
|
/* @__PURE__ */ jsx13("code", { children: written.path }),
|
|
6912
7054
|
/* @__PURE__ */ jsxs11("span", { className: "awr-frame__footmeta", children: [
|
|
@@ -6918,7 +7060,7 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6918
7060
|
linked.length > 0 ? ` \xB7 ${L.htmlLinkedFiles(linked.join(", "))}` : ""
|
|
6919
7061
|
] })
|
|
6920
7062
|
] }),
|
|
6921
|
-
children: showing === "source" ? /* @__PURE__ */ jsxs11(
|
|
7063
|
+
children: showing === "source" ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
6922
7064
|
tooLarge && options ? /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
|
|
6923
7065
|
/* @__PURE__ */ jsx13(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
|
|
6924
7066
|
] }) : void 0
|
|
@@ -6991,7 +7133,7 @@ var TextPreview = ({
|
|
|
6991
7133
|
]
|
|
6992
7134
|
}
|
|
6993
7135
|
) }),
|
|
6994
|
-
/* @__PURE__ */ jsx13("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ jsxs11(
|
|
7136
|
+
/* @__PURE__ */ jsx13("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
6995
7137
|
/* @__PURE__ */ jsx13("div", { className: "awr-fileview__rendered", children: rendered }),
|
|
6996
7138
|
text.length > previewChars && /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
|
|
6997
7139
|
] }) : /* @__PURE__ */ jsx13(SourceView, { text, maxChars: previewChars }) }),
|
|
@@ -7144,10 +7286,10 @@ var FileChip = ({
|
|
|
7144
7286
|
};
|
|
7145
7287
|
|
|
7146
7288
|
// src/components/StepList.tsx
|
|
7147
|
-
import { Fragment as
|
|
7289
|
+
import { Fragment as Fragment11 } from "react";
|
|
7148
7290
|
|
|
7149
7291
|
// src/components/SubagentTree.tsx
|
|
7150
|
-
import { Fragment as
|
|
7292
|
+
import { Fragment as Fragment10, useEffect as useEffect15, useState as useState15 } from "react";
|
|
7151
7293
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
7152
7294
|
var useElapsed = (startedAt, running) => {
|
|
7153
7295
|
const [now, setNow] = useState15(void 0);
|
|
@@ -7241,7 +7383,7 @@ var SubagentTree = ({
|
|
|
7241
7383
|
},
|
|
7242
7384
|
node.id
|
|
7243
7385
|
);
|
|
7244
|
-
return renderSubagent ? /* @__PURE__ */ jsx14(
|
|
7386
|
+
return renderSubagent ? /* @__PURE__ */ jsx14(Fragment10, { children: renderSubagent(node, row) }, node.id) : row;
|
|
7245
7387
|
})
|
|
7246
7388
|
}
|
|
7247
7389
|
);
|
|
@@ -7420,7 +7562,7 @@ var StepItem = ({
|
|
|
7420
7562
|
},
|
|
7421
7563
|
i
|
|
7422
7564
|
);
|
|
7423
|
-
return renderToolCall ? /* @__PURE__ */ jsx15(
|
|
7565
|
+
return renderToolCall ? /* @__PURE__ */ jsx15(Fragment11, { children: renderToolCall(call, row) }, i) : row;
|
|
7424
7566
|
}) }),
|
|
7425
7567
|
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: [
|
|
7426
7568
|
/* @__PURE__ */ jsx15(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
|
|
@@ -7670,7 +7812,7 @@ var MessageList = ({
|
|
|
7670
7812
|
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,
|
|
7671
7813
|
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,
|
|
7672
7814
|
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ jsxs14("div", { className: "awr-msg__bubble", children: [
|
|
7673
|
-
m.content ? renderContent ? renderContent(m) : m.content : null,
|
|
7815
|
+
m.content ? renderContent ? renderContent(m) : m.content : m.stopped && !m.pending ? /* @__PURE__ */ jsx16("span", { className: "awr-msg__stopped", children: L.answerStopped }) : null,
|
|
7674
7816
|
m.pending && !m.content && /* @__PURE__ */ jsx16(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
|
|
7675
7817
|
] }),
|
|
7676
7818
|
showMedia && m.media?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
@@ -8179,7 +8321,7 @@ var UsageBadge = ({
|
|
|
8179
8321
|
};
|
|
8180
8322
|
|
|
8181
8323
|
// src/components/AgentChat.tsx
|
|
8182
|
-
import { Fragment as
|
|
8324
|
+
import { Fragment as Fragment12, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
8183
8325
|
var usePrefersDark = () => {
|
|
8184
8326
|
const query = "(prefers-color-scheme: dark)";
|
|
8185
8327
|
const [dark, setDark] = useState17(
|
|
@@ -8412,7 +8554,7 @@ var AgentChatInner = ({
|
|
|
8412
8554
|
const showReplan = agent.replan && agent.replan.mode !== "continue";
|
|
8413
8555
|
const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
|
|
8414
8556
|
const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
|
|
8415
|
-
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ jsxs19(
|
|
8557
|
+
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
8416
8558
|
agent.planThought.trim() && /* @__PURE__ */ jsxs19("details", { className: "awr-activity__plan", children: [
|
|
8417
8559
|
/* @__PURE__ */ jsx20("summary", { children: L.planned }),
|
|
8418
8560
|
/* @__PURE__ */ jsx20("p", { className: "awr-activity__thought", children: agent.planThought })
|
|
@@ -8639,7 +8781,7 @@ var AgentChatInner = ({
|
|
|
8639
8781
|
),
|
|
8640
8782
|
panelTarget
|
|
8641
8783
|
)
|
|
8642
|
-
) : asSheet ? /* @__PURE__ */ jsxs19(
|
|
8784
|
+
) : asSheet ? /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
8643
8785
|
/* @__PURE__ */ jsx20("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
|
|
8644
8786
|
/* @__PURE__ */ jsxs19(
|
|
8645
8787
|
"aside",
|
|
@@ -9121,6 +9263,8 @@ export {
|
|
|
9121
9263
|
mcpAppSandboxShellCsp,
|
|
9122
9264
|
mcpAppSandboxTarget,
|
|
9123
9265
|
mediaFamilyOf,
|
|
9266
|
+
menuKeyTarget,
|
|
9267
|
+
menuSections,
|
|
9124
9268
|
mergeChatRecord,
|
|
9125
9269
|
mergeLabels,
|
|
9126
9270
|
newChatId,
|