@dudko.dev/agent-web-react 0.0.39 → 0.0.40
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 +10 -5
- package/dist/{chunk-RJM7JCWI.js → chunk-V4JGQQRB.js} +5 -1
- package/dist/chunk-V4JGQQRB.js.map +1 -0
- package/dist/{elicitation-DdzjMut9.d.cts → elicitation-IpjGRDD-.d.cts} +9 -0
- package/dist/{elicitation-DdzjMut9.d.ts → elicitation-IpjGRDD-.d.ts} +9 -0
- package/dist/index.cjs +431 -239
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -9
- package/dist/index.d.ts +112 -9
- package/dist/index.js +427 -239
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.cts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/pipeline.cjs.map +1 -1
- package/dist/pipeline.js +1 -1
- package/dist/styles.css +93 -3
- package/package.json +3 -3
- package/dist/chunk-RJM7JCWI.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ArrowUpIcon,
|
|
12
12
|
BoltIcon,
|
|
13
13
|
BookIcon,
|
|
14
|
+
BookmarkIcon,
|
|
14
15
|
BotIcon,
|
|
15
16
|
BrainIcon,
|
|
16
17
|
CheckIcon,
|
|
@@ -56,8 +57,9 @@ import {
|
|
|
56
57
|
formatTokens,
|
|
57
58
|
imagesInOutput,
|
|
58
59
|
previewValue,
|
|
60
|
+
remoteAnswerOf,
|
|
59
61
|
webSearchOf
|
|
60
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-V4JGQQRB.js";
|
|
61
63
|
import {
|
|
62
64
|
MCP_APP_POLICY_TOKEN_MAX_CHARS,
|
|
63
65
|
MCP_APP_SANDBOX_PROXY_READY,
|
|
@@ -326,8 +328,15 @@ var resetRun = (state) => ({
|
|
|
326
328
|
seq: state.seq,
|
|
327
329
|
learned: state.learned,
|
|
328
330
|
// An MCP App's request is the user's, not the run's: it waits across runs.
|
|
329
|
-
approvals: state.approvals.filter((a) => a.app && a.status === "pending")
|
|
331
|
+
approvals: state.approvals.filter((a) => a.app && a.status === "pending"),
|
|
332
|
+
// So is what this tab sent to another tab's run, until that tab answers (a replay that opens
|
|
333
|
+
// with the run's start is not an answer).
|
|
334
|
+
queued: sentToOtherTab(state.queued)
|
|
330
335
|
});
|
|
336
|
+
var sentToOtherTab = (queued) => queued.filter((q) => q.sentTo === "another-tab");
|
|
337
|
+
var sentEntryOf = (queued, text) => queued.findIndex(
|
|
338
|
+
(q) => q.sentTo === "another-tab" && (q.text === text || text.endsWith("\u2026") && q.text.length > text.length && q.text.startsWith(text.slice(0, -1)))
|
|
339
|
+
);
|
|
331
340
|
var patchStep = (steps, id, fn) => steps.map((s) => s.id === id ? fn(s) : s);
|
|
332
341
|
var withoutSkillBody = (a) => {
|
|
333
342
|
if (!a.skill || a.skill.body === void 0) return a;
|
|
@@ -1076,14 +1085,17 @@ var applyEvent = (state, event, ctx) => {
|
|
|
1076
1085
|
return fileDeleted(state, event.path);
|
|
1077
1086
|
case "mcp.app":
|
|
1078
1087
|
return ctx.remote ? state : addApp(state, event);
|
|
1079
|
-
case "message.queued":
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
]
|
|
1088
|
+
case "message.queued": {
|
|
1089
|
+
if (state.queued.some((q) => q.id === event.id)) return state;
|
|
1090
|
+
const entry = {
|
|
1091
|
+
id: event.id,
|
|
1092
|
+
text: event.text,
|
|
1093
|
+
...event.origin ? { origin: event.origin } : {}
|
|
1086
1094
|
};
|
|
1095
|
+
const mine = ctx.remote && event.origin === "another-tab" ? sentEntryOf(state.queued, event.text) : -1;
|
|
1096
|
+
if (mine < 0) return { ...state, queued: [...state.queued, entry] };
|
|
1097
|
+
return { ...state, queued: state.queued.map((q, i) => i === mine ? entry : q) };
|
|
1098
|
+
}
|
|
1087
1099
|
case "message.delivered": {
|
|
1088
1100
|
const anchor = event.at === "round" ? runningStepId(state.steps) : event.at === "step" ? state.steps[state.steps.length - 1]?.id : void 0;
|
|
1089
1101
|
return {
|
|
@@ -1411,9 +1423,21 @@ var agentStateReducer = (state, action) => {
|
|
|
1411
1423
|
case "undelivered":
|
|
1412
1424
|
return {
|
|
1413
1425
|
...state,
|
|
1414
|
-
queued: action.keepQueued ? state.queued :
|
|
1426
|
+
queued: action.keepQueued ? state.queued : sentToOtherTab(state.queued),
|
|
1415
1427
|
undelivered: action.texts
|
|
1416
1428
|
};
|
|
1429
|
+
case "remote-send":
|
|
1430
|
+
return state.queued.some((q) => q.id === action.id) ? state : {
|
|
1431
|
+
...state,
|
|
1432
|
+
queued: [
|
|
1433
|
+
...state.queued,
|
|
1434
|
+
{ id: action.id, text: action.text, sentTo: "another-tab" }
|
|
1435
|
+
]
|
|
1436
|
+
};
|
|
1437
|
+
case "remote-answer": {
|
|
1438
|
+
const queued = state.queued.filter((q) => q.id !== action.id);
|
|
1439
|
+
return action.answer === "refused" ? { ...state, queued, undelivered: [...state.undelivered, action.text] } : { ...state, queued };
|
|
1440
|
+
}
|
|
1417
1441
|
case "load": {
|
|
1418
1442
|
const maxSeq = action.messages.reduce((n, m) => {
|
|
1419
1443
|
const k = Number(/^msg-(\d+)$/.exec(m.id)?.[1] ?? -1);
|
|
@@ -1667,18 +1691,16 @@ var useAgent = (config, options = {}) => {
|
|
|
1667
1691
|
);
|
|
1668
1692
|
runRef.current = run;
|
|
1669
1693
|
const send = useCallback((text) => controlRef.current?.send(text) ?? false, []);
|
|
1694
|
+
const remoteSendsRef = useRef(0);
|
|
1670
1695
|
const sendRemote = useCallback((text) => {
|
|
1671
1696
|
const watch = watchRef.current;
|
|
1672
1697
|
const clean = typeof text === "string" ? text.trim() : "";
|
|
1673
1698
|
if (!watch?.state.running || !clean) return false;
|
|
1699
|
+
const id = `to-other-tab-${remoteSendsRef.current += 1}`;
|
|
1700
|
+
dispatch({ type: "remote-send", id, text: clean });
|
|
1674
1701
|
void watch.send(clean).then((ok) => {
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
type: "undelivered",
|
|
1678
|
-
texts: [...stateRef.current.undelivered, clean],
|
|
1679
|
-
keepQueued: true
|
|
1680
|
-
});
|
|
1681
|
-
}
|
|
1702
|
+
const answer = remoteAnswerOf(ok, watchRef.current === watch);
|
|
1703
|
+
dispatch({ type: "remote-answer", id, text: clean, answer });
|
|
1682
1704
|
});
|
|
1683
1705
|
return true;
|
|
1684
1706
|
}, []);
|
|
@@ -2602,189 +2624,6 @@ var useAudioRecorder = (options = {}) => {
|
|
|
2602
2624
|
|
|
2603
2625
|
// src/hooks/use-read-aloud.ts
|
|
2604
2626
|
import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef5, useState as useState6 } from "react";
|
|
2605
|
-
var useReadAloud = (speak, lang) => {
|
|
2606
|
-
const [current, setCurrent] = useState6();
|
|
2607
|
-
const [state, setState] = useState6();
|
|
2608
|
-
const [failed, setFailed] = useState6();
|
|
2609
|
-
const playback = useRef5(void 0);
|
|
2610
|
-
const langRef = useRef5(lang);
|
|
2611
|
-
langRef.current = lang;
|
|
2612
|
-
const stop = useCallback6(() => {
|
|
2613
|
-
const now = playback.current;
|
|
2614
|
-
playback.current = void 0;
|
|
2615
|
-
now?.handle.stop();
|
|
2616
|
-
setCurrent(void 0);
|
|
2617
|
-
setState(void 0);
|
|
2618
|
-
}, []);
|
|
2619
|
-
const start = useCallback6(
|
|
2620
|
-
(id, text) => {
|
|
2621
|
-
if (!speak) return;
|
|
2622
|
-
stop();
|
|
2623
|
-
setFailed(void 0);
|
|
2624
|
-
setCurrent(id);
|
|
2625
|
-
setState("loading");
|
|
2626
|
-
const mine = { id, handle: void 0 };
|
|
2627
|
-
playback.current = mine;
|
|
2628
|
-
let handle;
|
|
2629
|
-
try {
|
|
2630
|
-
handle = speak(text, {
|
|
2631
|
-
lang: langRef.current,
|
|
2632
|
-
onState: (s) => {
|
|
2633
|
-
if (playback.current === mine) setState(s);
|
|
2634
|
-
}
|
|
2635
|
-
});
|
|
2636
|
-
} catch (err) {
|
|
2637
|
-
playback.current = void 0;
|
|
2638
|
-
setCurrent(void 0);
|
|
2639
|
-
setState(void 0);
|
|
2640
|
-
const own = err instanceof Error && err.name !== "SpeechOutputError";
|
|
2641
|
-
setFailed({ id, ...own && err.message ? { message: err.message } : {} });
|
|
2642
|
-
return;
|
|
2643
|
-
}
|
|
2644
|
-
mine.handle = handle;
|
|
2645
|
-
handle.done.then(
|
|
2646
|
-
() => {
|
|
2647
|
-
if (playback.current !== mine) return;
|
|
2648
|
-
playback.current = void 0;
|
|
2649
|
-
setCurrent(void 0);
|
|
2650
|
-
setState(void 0);
|
|
2651
|
-
},
|
|
2652
|
-
(err) => {
|
|
2653
|
-
if (playback.current !== mine) return;
|
|
2654
|
-
playback.current = void 0;
|
|
2655
|
-
setCurrent(void 0);
|
|
2656
|
-
setState(void 0);
|
|
2657
|
-
const own = err instanceof Error && err.name !== "SpeechOutputError";
|
|
2658
|
-
setFailed({ id, ...own && err.message ? { message: err.message } : {} });
|
|
2659
|
-
}
|
|
2660
|
-
);
|
|
2661
|
-
},
|
|
2662
|
-
[speak, stop]
|
|
2663
|
-
);
|
|
2664
|
-
useEffect6(() => stop, [speak, stop]);
|
|
2665
|
-
return {
|
|
2666
|
-
current,
|
|
2667
|
-
state,
|
|
2668
|
-
failed,
|
|
2669
|
-
start,
|
|
2670
|
-
pause: () => playback.current?.handle.pause(),
|
|
2671
|
-
resume: () => playback.current?.handle.resume(),
|
|
2672
|
-
stop
|
|
2673
|
-
};
|
|
2674
|
-
};
|
|
2675
|
-
|
|
2676
|
-
// src/hooks/use-speech-voices.ts
|
|
2677
|
-
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
2678
|
-
var useSpeechVoices = () => {
|
|
2679
|
-
const synth = typeof globalThis !== "undefined" ? globalThis.speechSynthesis : void 0;
|
|
2680
|
-
const read = () => {
|
|
2681
|
-
try {
|
|
2682
|
-
return (synth?.getVoices() ?? []).map((v) => ({
|
|
2683
|
-
voiceURI: v.voiceURI,
|
|
2684
|
-
name: v.name,
|
|
2685
|
-
lang: v.lang,
|
|
2686
|
-
localService: v.localService,
|
|
2687
|
-
default: v.default
|
|
2688
|
-
}));
|
|
2689
|
-
} catch {
|
|
2690
|
-
return [];
|
|
2691
|
-
}
|
|
2692
|
-
};
|
|
2693
|
-
const [voices, setVoices] = useState7(read);
|
|
2694
|
-
useEffect7(() => {
|
|
2695
|
-
if (!synth) return;
|
|
2696
|
-
const update = () => setVoices(read());
|
|
2697
|
-
update();
|
|
2698
|
-
synth.addEventListener?.("voiceschanged", update);
|
|
2699
|
-
return () => synth.removeEventListener?.("voiceschanged", update);
|
|
2700
|
-
}, [synth]);
|
|
2701
|
-
return voices;
|
|
2702
|
-
};
|
|
2703
|
-
|
|
2704
|
-
// src/voice/recognizer.ts
|
|
2705
|
-
var createRecordingRecognizer = (options) => () => {
|
|
2706
|
-
let recording;
|
|
2707
|
-
let starting;
|
|
2708
|
-
let stopAsked = false;
|
|
2709
|
-
let aborted = false;
|
|
2710
|
-
let ended = false;
|
|
2711
|
-
const controller = new AbortController();
|
|
2712
|
-
const rec = {
|
|
2713
|
-
lang: "",
|
|
2714
|
-
continuous: true,
|
|
2715
|
-
interimResults: false,
|
|
2716
|
-
onresult: null,
|
|
2717
|
-
onerror: null,
|
|
2718
|
-
onend: null,
|
|
2719
|
-
start() {
|
|
2720
|
-
if (starting) return;
|
|
2721
|
-
starting = (async () => {
|
|
2722
|
-
try {
|
|
2723
|
-
recording = await startRecording({
|
|
2724
|
-
...options,
|
|
2725
|
-
maxMs: options.maxMs,
|
|
2726
|
-
onLimit: () => rec.stop()
|
|
2727
|
-
});
|
|
2728
|
-
} catch (err) {
|
|
2729
|
-
if (!aborted) rec.onerror?.({ error: micProblemOf(err) });
|
|
2730
|
-
return finish();
|
|
2731
|
-
}
|
|
2732
|
-
if (aborted) {
|
|
2733
|
-
recording.cancel();
|
|
2734
|
-
return finish();
|
|
2735
|
-
}
|
|
2736
|
-
if (stopAsked) void transcribeNow();
|
|
2737
|
-
})();
|
|
2738
|
-
},
|
|
2739
|
-
stop() {
|
|
2740
|
-
if (stopAsked || ended) return;
|
|
2741
|
-
stopAsked = true;
|
|
2742
|
-
if (recording) void transcribeNow();
|
|
2743
|
-
},
|
|
2744
|
-
abort() {
|
|
2745
|
-
if (ended) return;
|
|
2746
|
-
aborted = true;
|
|
2747
|
-
controller.abort();
|
|
2748
|
-
recording?.cancel();
|
|
2749
|
-
if (!starting || recording) finish();
|
|
2750
|
-
}
|
|
2751
|
-
};
|
|
2752
|
-
const finish = () => {
|
|
2753
|
-
if (ended) return;
|
|
2754
|
-
ended = true;
|
|
2755
|
-
rec.onend?.();
|
|
2756
|
-
};
|
|
2757
|
-
let transcribing = false;
|
|
2758
|
-
const transcribeNow = async () => {
|
|
2759
|
-
if (transcribing || !recording) return;
|
|
2760
|
-
transcribing = true;
|
|
2761
|
-
let audio;
|
|
2762
|
-
try {
|
|
2763
|
-
audio = await recording.stop();
|
|
2764
|
-
} catch (err) {
|
|
2765
|
-
if (!aborted) rec.onerror?.({ error: micProblemOf(err) });
|
|
2766
|
-
return finish();
|
|
2767
|
-
}
|
|
2768
|
-
if (aborted) return finish();
|
|
2769
|
-
if (audio.blob.size === 0) return finish();
|
|
2770
|
-
try {
|
|
2771
|
-
const text = (await options.transcribe(audio, { lang: rec.lang, signal: controller.signal })).replace(/\s+/g, " ").trim();
|
|
2772
|
-
if (!aborted && text)
|
|
2773
|
-
rec.onresult?.({
|
|
2774
|
-
resultIndex: 0,
|
|
2775
|
-
results: [{ isFinal: true, 0: { transcript: text } }]
|
|
2776
|
-
});
|
|
2777
|
-
} catch (err) {
|
|
2778
|
-
if (!aborted)
|
|
2779
|
-
rec.onerror?.({
|
|
2780
|
-
error: "transcription",
|
|
2781
|
-
message: err instanceof Error ? err.message : String(err)
|
|
2782
|
-
});
|
|
2783
|
-
}
|
|
2784
|
-
finish();
|
|
2785
|
-
};
|
|
2786
|
-
return rec;
|
|
2787
|
-
};
|
|
2788
2627
|
|
|
2789
2628
|
// src/voice/speak.ts
|
|
2790
2629
|
var SpeechOutputError = class extends Error {
|
|
@@ -2851,10 +2690,98 @@ var splitForSpeech = (text, max = 220) => {
|
|
|
2851
2690
|
if (rest) pieces.push(rest);
|
|
2852
2691
|
return pieces;
|
|
2853
2692
|
};
|
|
2693
|
+
var SCRIPT_RANGES = [
|
|
2694
|
+
["latin", /\p{Script=Latin}/u],
|
|
2695
|
+
["cyrillic", /\p{Script=Cyrillic}/u],
|
|
2696
|
+
["greek", /\p{Script=Greek}/u],
|
|
2697
|
+
["arabic", /\p{Script=Arabic}/u],
|
|
2698
|
+
["hebrew", /\p{Script=Hebrew}/u],
|
|
2699
|
+
["kana", /[\p{Script=Hiragana}\p{Script=Katakana}]/u],
|
|
2700
|
+
["han", /\p{Script=Han}/u],
|
|
2701
|
+
["hangul", /\p{Script=Hangul}/u],
|
|
2702
|
+
["devanagari", /\p{Script=Devanagari}/u],
|
|
2703
|
+
["thai", /\p{Script=Thai}/u],
|
|
2704
|
+
["georgian", /\p{Script=Georgian}/u],
|
|
2705
|
+
["armenian", /\p{Script=Armenian}/u]
|
|
2706
|
+
];
|
|
2707
|
+
var LANGUAGE_SCRIPT = {
|
|
2708
|
+
ru: "cyrillic",
|
|
2709
|
+
uk: "cyrillic",
|
|
2710
|
+
be: "cyrillic",
|
|
2711
|
+
bg: "cyrillic",
|
|
2712
|
+
sr: "cyrillic",
|
|
2713
|
+
mk: "cyrillic",
|
|
2714
|
+
kk: "cyrillic",
|
|
2715
|
+
ky: "cyrillic",
|
|
2716
|
+
tg: "cyrillic",
|
|
2717
|
+
mn: "cyrillic",
|
|
2718
|
+
el: "greek",
|
|
2719
|
+
ar: "arabic",
|
|
2720
|
+
fa: "arabic",
|
|
2721
|
+
ur: "arabic",
|
|
2722
|
+
he: "hebrew",
|
|
2723
|
+
yi: "hebrew",
|
|
2724
|
+
zh: "han",
|
|
2725
|
+
ja: "kana",
|
|
2726
|
+
ko: "hangul",
|
|
2727
|
+
hi: "devanagari",
|
|
2728
|
+
mr: "devanagari",
|
|
2729
|
+
ne: "devanagari",
|
|
2730
|
+
th: "thai",
|
|
2731
|
+
ka: "georgian",
|
|
2732
|
+
hy: "armenian"
|
|
2733
|
+
};
|
|
2734
|
+
var SCRIPT_DEFAULT = {
|
|
2735
|
+
latin: "en",
|
|
2736
|
+
cyrillic: "ru",
|
|
2737
|
+
greek: "el",
|
|
2738
|
+
arabic: "ar",
|
|
2739
|
+
hebrew: "he",
|
|
2740
|
+
han: "zh",
|
|
2741
|
+
kana: "ja",
|
|
2742
|
+
hangul: "ko",
|
|
2743
|
+
devanagari: "hi",
|
|
2744
|
+
thai: "th",
|
|
2745
|
+
georgian: "ka",
|
|
2746
|
+
armenian: "hy"
|
|
2747
|
+
};
|
|
2748
|
+
var scriptOfLanguage = (lang) => {
|
|
2749
|
+
const parts = lang.toLowerCase().replace(/_/g, "-").split("-");
|
|
2750
|
+
if (parts.includes("latn")) return "latin";
|
|
2751
|
+
if (parts.includes("cyrl")) return "cyrillic";
|
|
2752
|
+
return LANGUAGE_SCRIPT[parts[0]] ?? "latin";
|
|
2753
|
+
};
|
|
2754
|
+
var scriptOfText = (text) => {
|
|
2755
|
+
const counts = /* @__PURE__ */ new Map();
|
|
2756
|
+
for (const ch of text) {
|
|
2757
|
+
if (!/\p{L}/u.test(ch)) continue;
|
|
2758
|
+
const found = SCRIPT_RANGES.find(([, re]) => re.test(ch));
|
|
2759
|
+
if (!found) continue;
|
|
2760
|
+
counts.set(found[0], (counts.get(found[0]) ?? 0) + 1);
|
|
2761
|
+
}
|
|
2762
|
+
if (counts.has("kana")) {
|
|
2763
|
+
counts.set("kana", (counts.get("kana") ?? 0) + (counts.get("han") ?? 0));
|
|
2764
|
+
counts.delete("han");
|
|
2765
|
+
}
|
|
2766
|
+
let best;
|
|
2767
|
+
let most = 0;
|
|
2768
|
+
for (const [script, n] of counts)
|
|
2769
|
+
if (n > most) {
|
|
2770
|
+
best = script;
|
|
2771
|
+
most = n;
|
|
2772
|
+
}
|
|
2773
|
+
return best;
|
|
2774
|
+
};
|
|
2775
|
+
var languageOfText = (text, preferred = []) => {
|
|
2776
|
+
const mine = preferred.filter((l) => Boolean(l));
|
|
2777
|
+
const script = scriptOfText(text);
|
|
2778
|
+
if (!script) return mine[0];
|
|
2779
|
+
return mine.find((l) => scriptOfLanguage(l) === script) ?? SCRIPT_DEFAULT[script];
|
|
2780
|
+
};
|
|
2854
2781
|
var voiceFor = (voices, lang, preferred) => {
|
|
2855
2782
|
if (preferred) {
|
|
2856
2783
|
const chosen = voices.find((v) => v.voiceURI === preferred);
|
|
2857
|
-
if (chosen) return chosen;
|
|
2784
|
+
if (chosen && (!lang || scriptOfLanguage(chosen.lang) === scriptOfLanguage(lang))) return chosen;
|
|
2858
2785
|
}
|
|
2859
2786
|
if (!lang) return void 0;
|
|
2860
2787
|
const norm = (l) => l.toLowerCase().replace(/_/g, "-");
|
|
@@ -3068,6 +2995,193 @@ var createAudioSpeaker = (options) => (text, { lang, onState }) => {
|
|
|
3068
2995
|
};
|
|
3069
2996
|
};
|
|
3070
2997
|
|
|
2998
|
+
// src/hooks/use-read-aloud.ts
|
|
2999
|
+
var browserLanguages = () => typeof navigator !== "undefined" && Array.isArray(navigator.languages) ? navigator.languages : [];
|
|
3000
|
+
var useReadAloud = (speak, lang) => {
|
|
3001
|
+
const [current, setCurrent] = useState6();
|
|
3002
|
+
const [state, setState] = useState6();
|
|
3003
|
+
const [failed, setFailed] = useState6();
|
|
3004
|
+
const playback = useRef5(void 0);
|
|
3005
|
+
const langRef = useRef5(lang);
|
|
3006
|
+
langRef.current = lang;
|
|
3007
|
+
const stop = useCallback6(() => {
|
|
3008
|
+
const now = playback.current;
|
|
3009
|
+
playback.current = void 0;
|
|
3010
|
+
now?.handle.stop();
|
|
3011
|
+
setCurrent(void 0);
|
|
3012
|
+
setState(void 0);
|
|
3013
|
+
}, []);
|
|
3014
|
+
const start = useCallback6(
|
|
3015
|
+
(id, text) => {
|
|
3016
|
+
if (!speak) return;
|
|
3017
|
+
stop();
|
|
3018
|
+
setFailed(void 0);
|
|
3019
|
+
setCurrent(id);
|
|
3020
|
+
setState("loading");
|
|
3021
|
+
const mine = { id, handle: void 0 };
|
|
3022
|
+
playback.current = mine;
|
|
3023
|
+
let handle;
|
|
3024
|
+
try {
|
|
3025
|
+
handle = speak(text, {
|
|
3026
|
+
// The TEXT's language: a Russian answer in an English interface is read in Russian.
|
|
3027
|
+
lang: languageOfText(text, [langRef.current, ...browserLanguages()]),
|
|
3028
|
+
onState: (s) => {
|
|
3029
|
+
if (playback.current === mine) setState(s);
|
|
3030
|
+
}
|
|
3031
|
+
});
|
|
3032
|
+
} catch (err) {
|
|
3033
|
+
playback.current = void 0;
|
|
3034
|
+
setCurrent(void 0);
|
|
3035
|
+
setState(void 0);
|
|
3036
|
+
const own = err instanceof Error && err.name !== "SpeechOutputError";
|
|
3037
|
+
setFailed({ id, ...own && err.message ? { message: err.message } : {} });
|
|
3038
|
+
return;
|
|
3039
|
+
}
|
|
3040
|
+
mine.handle = handle;
|
|
3041
|
+
handle.done.then(
|
|
3042
|
+
() => {
|
|
3043
|
+
if (playback.current !== mine) return;
|
|
3044
|
+
playback.current = void 0;
|
|
3045
|
+
setCurrent(void 0);
|
|
3046
|
+
setState(void 0);
|
|
3047
|
+
},
|
|
3048
|
+
(err) => {
|
|
3049
|
+
if (playback.current !== mine) return;
|
|
3050
|
+
playback.current = void 0;
|
|
3051
|
+
setCurrent(void 0);
|
|
3052
|
+
setState(void 0);
|
|
3053
|
+
const own = err instanceof Error && err.name !== "SpeechOutputError";
|
|
3054
|
+
setFailed({ id, ...own && err.message ? { message: err.message } : {} });
|
|
3055
|
+
}
|
|
3056
|
+
);
|
|
3057
|
+
},
|
|
3058
|
+
[speak, stop]
|
|
3059
|
+
);
|
|
3060
|
+
useEffect6(() => stop, [speak, stop]);
|
|
3061
|
+
return {
|
|
3062
|
+
current,
|
|
3063
|
+
state,
|
|
3064
|
+
failed,
|
|
3065
|
+
start,
|
|
3066
|
+
pause: () => playback.current?.handle.pause(),
|
|
3067
|
+
resume: () => playback.current?.handle.resume(),
|
|
3068
|
+
stop
|
|
3069
|
+
};
|
|
3070
|
+
};
|
|
3071
|
+
|
|
3072
|
+
// src/hooks/use-speech-voices.ts
|
|
3073
|
+
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
3074
|
+
var useSpeechVoices = () => {
|
|
3075
|
+
const synth = typeof globalThis !== "undefined" ? globalThis.speechSynthesis : void 0;
|
|
3076
|
+
const read = () => {
|
|
3077
|
+
try {
|
|
3078
|
+
return (synth?.getVoices() ?? []).map((v) => ({
|
|
3079
|
+
voiceURI: v.voiceURI,
|
|
3080
|
+
name: v.name,
|
|
3081
|
+
lang: v.lang,
|
|
3082
|
+
localService: v.localService,
|
|
3083
|
+
default: v.default
|
|
3084
|
+
}));
|
|
3085
|
+
} catch {
|
|
3086
|
+
return [];
|
|
3087
|
+
}
|
|
3088
|
+
};
|
|
3089
|
+
const [voices, setVoices] = useState7(read);
|
|
3090
|
+
useEffect7(() => {
|
|
3091
|
+
if (!synth) return;
|
|
3092
|
+
const update = () => setVoices(read());
|
|
3093
|
+
update();
|
|
3094
|
+
synth.addEventListener?.("voiceschanged", update);
|
|
3095
|
+
return () => synth.removeEventListener?.("voiceschanged", update);
|
|
3096
|
+
}, [synth]);
|
|
3097
|
+
return voices;
|
|
3098
|
+
};
|
|
3099
|
+
|
|
3100
|
+
// src/voice/recognizer.ts
|
|
3101
|
+
var createRecordingRecognizer = (options) => () => {
|
|
3102
|
+
let recording;
|
|
3103
|
+
let starting;
|
|
3104
|
+
let stopAsked = false;
|
|
3105
|
+
let aborted = false;
|
|
3106
|
+
let ended = false;
|
|
3107
|
+
const controller = new AbortController();
|
|
3108
|
+
const rec = {
|
|
3109
|
+
lang: "",
|
|
3110
|
+
continuous: true,
|
|
3111
|
+
interimResults: false,
|
|
3112
|
+
onresult: null,
|
|
3113
|
+
onerror: null,
|
|
3114
|
+
onend: null,
|
|
3115
|
+
start() {
|
|
3116
|
+
if (starting) return;
|
|
3117
|
+
starting = (async () => {
|
|
3118
|
+
try {
|
|
3119
|
+
recording = await startRecording({
|
|
3120
|
+
...options,
|
|
3121
|
+
maxMs: options.maxMs,
|
|
3122
|
+
onLimit: () => rec.stop()
|
|
3123
|
+
});
|
|
3124
|
+
} catch (err) {
|
|
3125
|
+
if (!aborted) rec.onerror?.({ error: micProblemOf(err) });
|
|
3126
|
+
return finish();
|
|
3127
|
+
}
|
|
3128
|
+
if (aborted) {
|
|
3129
|
+
recording.cancel();
|
|
3130
|
+
return finish();
|
|
3131
|
+
}
|
|
3132
|
+
if (stopAsked) void transcribeNow();
|
|
3133
|
+
})();
|
|
3134
|
+
},
|
|
3135
|
+
stop() {
|
|
3136
|
+
if (stopAsked || ended) return;
|
|
3137
|
+
stopAsked = true;
|
|
3138
|
+
if (recording) void transcribeNow();
|
|
3139
|
+
},
|
|
3140
|
+
abort() {
|
|
3141
|
+
if (ended) return;
|
|
3142
|
+
aborted = true;
|
|
3143
|
+
controller.abort();
|
|
3144
|
+
recording?.cancel();
|
|
3145
|
+
if (!starting || recording) finish();
|
|
3146
|
+
}
|
|
3147
|
+
};
|
|
3148
|
+
const finish = () => {
|
|
3149
|
+
if (ended) return;
|
|
3150
|
+
ended = true;
|
|
3151
|
+
rec.onend?.();
|
|
3152
|
+
};
|
|
3153
|
+
let transcribing = false;
|
|
3154
|
+
const transcribeNow = async () => {
|
|
3155
|
+
if (transcribing || !recording) return;
|
|
3156
|
+
transcribing = true;
|
|
3157
|
+
let audio;
|
|
3158
|
+
try {
|
|
3159
|
+
audio = await recording.stop();
|
|
3160
|
+
} catch (err) {
|
|
3161
|
+
if (!aborted) rec.onerror?.({ error: micProblemOf(err) });
|
|
3162
|
+
return finish();
|
|
3163
|
+
}
|
|
3164
|
+
if (aborted) return finish();
|
|
3165
|
+
if (audio.blob.size === 0) return finish();
|
|
3166
|
+
try {
|
|
3167
|
+
const text = (await options.transcribe(audio, { lang: rec.lang, signal: controller.signal })).replace(/\s+/g, " ").trim();
|
|
3168
|
+
if (!aborted && text)
|
|
3169
|
+
rec.onresult?.({
|
|
3170
|
+
resultIndex: 0,
|
|
3171
|
+
results: [{ isFinal: true, 0: { transcript: text } }]
|
|
3172
|
+
});
|
|
3173
|
+
} catch (err) {
|
|
3174
|
+
if (!aborted)
|
|
3175
|
+
rec.onerror?.({
|
|
3176
|
+
error: "transcription",
|
|
3177
|
+
message: err instanceof Error ? err.message : String(err)
|
|
3178
|
+
});
|
|
3179
|
+
}
|
|
3180
|
+
finish();
|
|
3181
|
+
};
|
|
3182
|
+
return rec;
|
|
3183
|
+
};
|
|
3184
|
+
|
|
3071
3185
|
// src/hooks/use-credentials.ts
|
|
3072
3186
|
import { useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo3, useState as useState8 } from "react";
|
|
3073
3187
|
import * as core5 from "@dudko.dev/agent-web";
|
|
@@ -3485,6 +3599,11 @@ var defaultLabels = {
|
|
|
3485
3599
|
notebookForget: "Forget",
|
|
3486
3600
|
notebookRevision: (n) => `revision ${n}`,
|
|
3487
3601
|
notebookFrom: "from",
|
|
3602
|
+
memorySaved: "Remembered",
|
|
3603
|
+
memoryUpdated: "Memory updated",
|
|
3604
|
+
memoryForgotten: "Forgotten",
|
|
3605
|
+
memoryUndo: "Undo",
|
|
3606
|
+
memoryUndone: "Undone",
|
|
3488
3607
|
placeholder: "Ask the agent to do something\u2026 ( / for commands, Ctrl+V to paste an image )",
|
|
3489
3608
|
listening: "Listening\u2026",
|
|
3490
3609
|
message: "Message",
|
|
@@ -3584,6 +3703,7 @@ var defaultLabels = {
|
|
|
3584
3703
|
noAttachmentsWhileBusy: "Files can\u2019t be added while the agent is working \u2014 send them with your next message.",
|
|
3585
3704
|
queuedWaiting: "waiting for the agent\u2019s next step",
|
|
3586
3705
|
queuedForSession: (heldBy) => heldBy === "this-tab" ? "waiting for the other run to finish" : "waiting for the other tab to finish",
|
|
3706
|
+
queuedForOtherTab: "waiting for the other tab to pick it up",
|
|
3587
3707
|
noteAt: {
|
|
3588
3708
|
round: "you said, between tool calls",
|
|
3589
3709
|
step: "you said, after this step",
|
|
@@ -6583,7 +6703,7 @@ ${draftText}` : draftText);
|
|
|
6583
6703
|
/* @__PURE__ */ jsx5(ClockIcon, { size: 13, className: "awr-queued__icon" }),
|
|
6584
6704
|
/* @__PURE__ */ jsx5("span", { className: "awr-queued__text", title: q.text, children: q.text }),
|
|
6585
6705
|
q.origin === "another-tab" && /* @__PURE__ */ jsx5("span", { className: "awr-queued__origin", children: L.fromAnotherTab }),
|
|
6586
|
-
/* @__PURE__ */ jsx5("span", { className: "awr-queued__state", children: q.session ? L.queuedForSession(q.session) : L.queuedWaiting })
|
|
6706
|
+
/* @__PURE__ */ jsx5("span", { className: "awr-queued__state", children: q.sentTo ? L.queuedForOtherTab : q.session ? L.queuedForSession(q.session) : L.queuedWaiting })
|
|
6587
6707
|
] }, q.id)),
|
|
6588
6708
|
agent.undelivered.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "awr-queued__item awr-queued__item--undelivered", role: "status", children: [
|
|
6589
6709
|
/* @__PURE__ */ jsx5(AlertIcon, { size: 13, className: "awr-queued__icon" }),
|
|
@@ -8839,6 +8959,12 @@ var AttachmentView = ({
|
|
|
8839
8959
|
" ",
|
|
8840
8960
|
a.name
|
|
8841
8961
|
] });
|
|
8962
|
+
var toolCardsOf = (m, render) => (m.steps ?? []).flatMap(
|
|
8963
|
+
(step, s) => step.toolCalls.flatMap((call, c) => {
|
|
8964
|
+
const node = render(call, m);
|
|
8965
|
+
return node === null || node === void 0 || node === false ? [] : [{ key: `${s}:${c}`, node }];
|
|
8966
|
+
})
|
|
8967
|
+
);
|
|
8842
8968
|
var toolCallCount = (m) => (m.steps ?? []).reduce((n, s) => n + s.toolCalls.length, 0);
|
|
8843
8969
|
var activitySummary = (m, showToolCalls, showLearned, showTiers, showFileChips, L, showApps = false) => {
|
|
8844
8970
|
const steps = m.steps ?? [];
|
|
@@ -8884,6 +9010,8 @@ var MessageList = ({
|
|
|
8884
9010
|
renderMessage,
|
|
8885
9011
|
renderAttachment,
|
|
8886
9012
|
renderToolCall,
|
|
9013
|
+
renderToolCard,
|
|
9014
|
+
showToolCards = true,
|
|
8887
9015
|
renderApp,
|
|
8888
9016
|
showApps = true,
|
|
8889
9017
|
imageViewer = true,
|
|
@@ -8901,6 +9029,7 @@ var MessageList = ({
|
|
|
8901
9029
|
const steps = m.steps ?? [];
|
|
8902
9030
|
const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
|
|
8903
9031
|
const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
|
|
9032
|
+
const cards = showToolCards && renderToolCard && m.role === "assistant" ? toolCardsOf(m, renderToolCard) : [];
|
|
8904
9033
|
const node = /* @__PURE__ */ jsx16(
|
|
8905
9034
|
"div",
|
|
8906
9035
|
{
|
|
@@ -8967,12 +9096,22 @@ var MessageList = ({
|
|
|
8967
9096
|
/* @__PURE__ */ jsx16("p", { className: "awr-thought__text", children: m.reasoning.trim() })
|
|
8968
9097
|
] })
|
|
8969
9098
|
] }),
|
|
9099
|
+
cards.length > 0 && /* @__PURE__ */ jsx16("div", { className: "awr-msg__cards", children: cards.map((card) => /* @__PURE__ */ jsx16("div", { className: "awr-msg__card", children: card.node }, card.key)) }),
|
|
8970
9100
|
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,
|
|
8971
9101
|
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,
|
|
8972
9102
|
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ jsxs14("div", { className: "awr-msg__bubble", children: [
|
|
8973
9103
|
m.content ? renderContent ? renderContent(m) : m.content : m.stopped && !m.pending ? /* @__PURE__ */ jsx16("span", { className: "awr-msg__stopped", children: L.answerStopped }) : null,
|
|
8974
9104
|
m.pending && !m.content && /* @__PURE__ */ jsx16(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
|
|
8975
9105
|
] }),
|
|
9106
|
+
readAloud && m.role === "assistant" && m.content && !m.pending && !m.error && /* @__PURE__ */ jsx16(
|
|
9107
|
+
ReadAloudControl,
|
|
9108
|
+
{
|
|
9109
|
+
id: m.id,
|
|
9110
|
+
text: () => readAloud.textOf ? readAloud.textOf(m) : speakableText(m.content, { code: L.readAloudCode }),
|
|
9111
|
+
reader,
|
|
9112
|
+
labels: L
|
|
9113
|
+
}
|
|
9114
|
+
),
|
|
8976
9115
|
showMedia && m.media?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
8977
9116
|
const built = /* @__PURE__ */ jsx16(GeneratedMedia, { media: item, files, labels }, i);
|
|
8978
9117
|
return renderMedia ? /* @__PURE__ */ jsx16("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
@@ -8998,15 +9137,6 @@ var MessageList = ({
|
|
|
8998
9137
|
children: m.attachments.map((a, i) => /* @__PURE__ */ jsx16("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ jsx16(AttachmentView, { attachment: a, files, labels }) }, i))
|
|
8999
9138
|
}
|
|
9000
9139
|
) : null,
|
|
9001
|
-
readAloud && m.role === "assistant" && m.content && !m.pending && !m.error && /* @__PURE__ */ jsx16(
|
|
9002
|
-
ReadAloudControl,
|
|
9003
|
-
{
|
|
9004
|
-
id: m.id,
|
|
9005
|
-
text: () => readAloud.textOf ? readAloud.textOf(m) : speakableText(m.content, { code: L.readAloudCode }),
|
|
9006
|
-
reader,
|
|
9007
|
-
labels: L
|
|
9008
|
-
}
|
|
9009
|
-
),
|
|
9010
9140
|
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ jsx16("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
9011
9141
|
] })
|
|
9012
9142
|
},
|
|
@@ -9631,6 +9761,8 @@ var AgentChatInner = ({
|
|
|
9631
9761
|
renderAttachment,
|
|
9632
9762
|
readAloud,
|
|
9633
9763
|
renderToolCall,
|
|
9764
|
+
renderToolCard,
|
|
9765
|
+
showToolCards = true,
|
|
9634
9766
|
renderSubagent,
|
|
9635
9767
|
renderMedia,
|
|
9636
9768
|
renderFile,
|
|
@@ -9942,6 +10074,8 @@ var AgentChatInner = ({
|
|
|
9942
10074
|
renderAttachment,
|
|
9943
10075
|
readAloud,
|
|
9944
10076
|
renderToolCall,
|
|
10077
|
+
renderToolCard,
|
|
10078
|
+
showToolCards,
|
|
9945
10079
|
showApps: appsOn,
|
|
9946
10080
|
renderApp: appsOn ? drawApp : void 0,
|
|
9947
10081
|
imageViewer,
|
|
@@ -10115,9 +10249,59 @@ var LearnedSkills = ({
|
|
|
10115
10249
|
] });
|
|
10116
10250
|
};
|
|
10117
10251
|
|
|
10118
|
-
// src/components/
|
|
10252
|
+
// src/components/MemoryCard.tsx
|
|
10119
10253
|
import { useState as useState21 } from "react";
|
|
10120
10254
|
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10255
|
+
var MemoryCard = ({
|
|
10256
|
+
kind,
|
|
10257
|
+
text,
|
|
10258
|
+
onUndo,
|
|
10259
|
+
undone = false,
|
|
10260
|
+
problem,
|
|
10261
|
+
labels,
|
|
10262
|
+
className
|
|
10263
|
+
}) => {
|
|
10264
|
+
const L = useLabels(labels);
|
|
10265
|
+
const [busy, setBusy] = useState21(false);
|
|
10266
|
+
const label = kind === "saved" ? L.memorySaved : kind === "updated" ? L.memoryUpdated : L.memoryForgotten;
|
|
10267
|
+
const undo = () => {
|
|
10268
|
+
if (!onUndo || busy) return;
|
|
10269
|
+
setBusy(true);
|
|
10270
|
+
void Promise.resolve().then(onUndo).catch(() => {
|
|
10271
|
+
}).finally(() => setBusy(false));
|
|
10272
|
+
};
|
|
10273
|
+
return /* @__PURE__ */ jsxs21(
|
|
10274
|
+
"div",
|
|
10275
|
+
{
|
|
10276
|
+
className: ["awr-memory", `awr-memory--${kind}`, undone ? "is-undone" : "", className].filter(Boolean).join(" "),
|
|
10277
|
+
"data-memory": kind,
|
|
10278
|
+
children: [
|
|
10279
|
+
/* @__PURE__ */ jsx22(BookmarkIcon, { size: 14, className: "awr-memory__icon" }),
|
|
10280
|
+
/* @__PURE__ */ jsxs21("div", { className: "awr-memory__body", children: [
|
|
10281
|
+
/* @__PURE__ */ jsx22("span", { className: "awr-memory__label", children: label }),
|
|
10282
|
+
/* @__PURE__ */ jsx22("span", { className: "awr-memory__text", children: text }),
|
|
10283
|
+
problem && /* @__PURE__ */ jsx22("span", { className: "awr-memory__problem", role: "alert", children: problem })
|
|
10284
|
+
] }),
|
|
10285
|
+
undone ? /* @__PURE__ */ jsx22("span", { className: "awr-memory__undone", children: L.memoryUndone }) : onUndo ? /* @__PURE__ */ jsx22(
|
|
10286
|
+
"button",
|
|
10287
|
+
{
|
|
10288
|
+
type: "button",
|
|
10289
|
+
className: "awr-memory__undo",
|
|
10290
|
+
disabled: busy,
|
|
10291
|
+
"aria-busy": busy,
|
|
10292
|
+
"aria-label": `${L.memoryUndo}: ${text}`,
|
|
10293
|
+
onClick: undo,
|
|
10294
|
+
children: L.memoryUndo
|
|
10295
|
+
}
|
|
10296
|
+
) : null
|
|
10297
|
+
]
|
|
10298
|
+
}
|
|
10299
|
+
);
|
|
10300
|
+
};
|
|
10301
|
+
|
|
10302
|
+
// src/components/Composer.tsx
|
|
10303
|
+
import { useState as useState22 } from "react";
|
|
10304
|
+
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
10121
10305
|
var Composer = ({
|
|
10122
10306
|
onSubmit,
|
|
10123
10307
|
busy = false,
|
|
@@ -10126,7 +10310,7 @@ var Composer = ({
|
|
|
10126
10310
|
placeholder = "Ask the agent to do something\u2026",
|
|
10127
10311
|
className
|
|
10128
10312
|
}) => {
|
|
10129
|
-
const [text, setText] =
|
|
10313
|
+
const [text, setText] = useState22("");
|
|
10130
10314
|
const submit = () => {
|
|
10131
10315
|
const value = text.trim();
|
|
10132
10316
|
if (!value || busy || disabled) return;
|
|
@@ -10139,7 +10323,7 @@ var Composer = ({
|
|
|
10139
10323
|
submit();
|
|
10140
10324
|
}
|
|
10141
10325
|
};
|
|
10142
|
-
return /* @__PURE__ */
|
|
10326
|
+
return /* @__PURE__ */ jsxs22(
|
|
10143
10327
|
"form",
|
|
10144
10328
|
{
|
|
10145
10329
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -10148,7 +10332,7 @@ var Composer = ({
|
|
|
10148
10332
|
submit();
|
|
10149
10333
|
},
|
|
10150
10334
|
children: [
|
|
10151
|
-
/* @__PURE__ */
|
|
10335
|
+
/* @__PURE__ */ jsx23(
|
|
10152
10336
|
"textarea",
|
|
10153
10337
|
{
|
|
10154
10338
|
className: "awr-composer__input",
|
|
@@ -10160,23 +10344,23 @@ var Composer = ({
|
|
|
10160
10344
|
rows: 1
|
|
10161
10345
|
}
|
|
10162
10346
|
),
|
|
10163
|
-
busy ? /* @__PURE__ */
|
|
10347
|
+
busy ? /* @__PURE__ */ jsx23(
|
|
10164
10348
|
"button",
|
|
10165
10349
|
{
|
|
10166
10350
|
type: "button",
|
|
10167
10351
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
10168
10352
|
onClick: onStop,
|
|
10169
10353
|
"aria-label": "Stop",
|
|
10170
|
-
children: /* @__PURE__ */
|
|
10354
|
+
children: /* @__PURE__ */ jsx23(StopIcon, { size: 18 })
|
|
10171
10355
|
}
|
|
10172
|
-
) : /* @__PURE__ */
|
|
10356
|
+
) : /* @__PURE__ */ jsx23(
|
|
10173
10357
|
"button",
|
|
10174
10358
|
{
|
|
10175
10359
|
type: "submit",
|
|
10176
10360
|
className: "awr-composer__btn",
|
|
10177
10361
|
disabled: disabled || !text.trim(),
|
|
10178
10362
|
"aria-label": "Send",
|
|
10179
|
-
children: disabled ? /* @__PURE__ */
|
|
10363
|
+
children: disabled ? /* @__PURE__ */ jsx23(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ jsx23(SendIcon, { size: 18 })
|
|
10180
10364
|
}
|
|
10181
10365
|
)
|
|
10182
10366
|
]
|
|
@@ -10185,17 +10369,17 @@ var Composer = ({
|
|
|
10185
10369
|
};
|
|
10186
10370
|
|
|
10187
10371
|
// src/components/PlanView.tsx
|
|
10188
|
-
import { jsx as
|
|
10372
|
+
import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
10189
10373
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
10190
10374
|
if (!plan.steps.length && !plan.thought) return null;
|
|
10191
|
-
return /* @__PURE__ */
|
|
10192
|
-
showThought && plan.thought.trim() && /* @__PURE__ */
|
|
10193
|
-
plan.steps.length > 0 && /* @__PURE__ */
|
|
10375
|
+
return /* @__PURE__ */ jsxs23("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
10376
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ jsx24("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
10377
|
+
plan.steps.length > 0 && /* @__PURE__ */ jsx24("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ jsx24("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
10194
10378
|
] });
|
|
10195
10379
|
};
|
|
10196
10380
|
|
|
10197
10381
|
// src/components/ApprovalModeSwitch.tsx
|
|
10198
|
-
import { jsx as
|
|
10382
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
10199
10383
|
var DEFAULT_LABELS = {
|
|
10200
10384
|
autopilot: "Autopilot",
|
|
10201
10385
|
"ask-writes": "Ask before changes",
|
|
@@ -10215,13 +10399,13 @@ var ApprovalModeSwitch = ({
|
|
|
10215
10399
|
labels,
|
|
10216
10400
|
disabled,
|
|
10217
10401
|
className
|
|
10218
|
-
}) => /* @__PURE__ */
|
|
10402
|
+
}) => /* @__PURE__ */ jsx25(
|
|
10219
10403
|
"div",
|
|
10220
10404
|
{
|
|
10221
10405
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
10222
10406
|
role: "radiogroup",
|
|
10223
10407
|
"aria-label": "Tool consent",
|
|
10224
|
-
children: modes.map((m) => /* @__PURE__ */
|
|
10408
|
+
children: modes.map((m) => /* @__PURE__ */ jsx25(
|
|
10225
10409
|
"button",
|
|
10226
10410
|
{
|
|
10227
10411
|
type: "button",
|
|
@@ -10239,8 +10423,8 @@ var ApprovalModeSwitch = ({
|
|
|
10239
10423
|
);
|
|
10240
10424
|
|
|
10241
10425
|
// src/components/ApiKeyForm.tsx
|
|
10242
|
-
import { useEffect as useEffect21, useState as
|
|
10243
|
-
import { jsx as
|
|
10426
|
+
import { useEffect as useEffect21, useState as useState23 } from "react";
|
|
10427
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
10244
10428
|
var ApiKeyForm = ({
|
|
10245
10429
|
credentials,
|
|
10246
10430
|
credentialRef,
|
|
@@ -10249,9 +10433,9 @@ var ApiKeyForm = ({
|
|
|
10249
10433
|
onChange,
|
|
10250
10434
|
className
|
|
10251
10435
|
}) => {
|
|
10252
|
-
const [value, setValue] =
|
|
10253
|
-
const [present, setPresent] =
|
|
10254
|
-
const [busy, setBusy] =
|
|
10436
|
+
const [value, setValue] = useState23("");
|
|
10437
|
+
const [present, setPresent] = useState23(false);
|
|
10438
|
+
const [busy, setBusy] = useState23(false);
|
|
10255
10439
|
useEffect21(() => {
|
|
10256
10440
|
let active = true;
|
|
10257
10441
|
credentials.hasKey(credentialRef).then((has) => {
|
|
@@ -10284,16 +10468,16 @@ var ApiKeyForm = ({
|
|
|
10284
10468
|
setBusy(false);
|
|
10285
10469
|
}
|
|
10286
10470
|
};
|
|
10287
|
-
return /* @__PURE__ */
|
|
10288
|
-
/* @__PURE__ */
|
|
10471
|
+
return /* @__PURE__ */ jsxs24("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
10472
|
+
/* @__PURE__ */ jsxs24("label", { className: "awr-keyform__label", children: [
|
|
10289
10473
|
label,
|
|
10290
|
-
present && /* @__PURE__ */
|
|
10291
|
-
/* @__PURE__ */
|
|
10474
|
+
present && /* @__PURE__ */ jsxs24("span", { className: "awr-keyform__saved", children: [
|
|
10475
|
+
/* @__PURE__ */ jsx26(CheckIcon, { size: 12 }),
|
|
10292
10476
|
" stored, encrypted"
|
|
10293
10477
|
] })
|
|
10294
10478
|
] }),
|
|
10295
|
-
/* @__PURE__ */
|
|
10296
|
-
/* @__PURE__ */
|
|
10479
|
+
/* @__PURE__ */ jsxs24("div", { className: "awr-keyform__row", children: [
|
|
10480
|
+
/* @__PURE__ */ jsx26(
|
|
10297
10481
|
"input",
|
|
10298
10482
|
{
|
|
10299
10483
|
className: "awr-keyform__input",
|
|
@@ -10311,7 +10495,7 @@ var ApiKeyForm = ({
|
|
|
10311
10495
|
disabled: busy
|
|
10312
10496
|
}
|
|
10313
10497
|
),
|
|
10314
|
-
/* @__PURE__ */
|
|
10498
|
+
/* @__PURE__ */ jsx26(
|
|
10315
10499
|
"button",
|
|
10316
10500
|
{
|
|
10317
10501
|
type: "button",
|
|
@@ -10321,7 +10505,7 @@ var ApiKeyForm = ({
|
|
|
10321
10505
|
children: "Save"
|
|
10322
10506
|
}
|
|
10323
10507
|
),
|
|
10324
|
-
present && /* @__PURE__ */
|
|
10508
|
+
present && /* @__PURE__ */ jsx26(
|
|
10325
10509
|
"button",
|
|
10326
10510
|
{
|
|
10327
10511
|
type: "button",
|
|
@@ -10430,6 +10614,7 @@ export {
|
|
|
10430
10614
|
McpAppLine,
|
|
10431
10615
|
McpAppRpcError,
|
|
10432
10616
|
McpAppSandboxLink,
|
|
10617
|
+
MemoryCard,
|
|
10433
10618
|
MemoryCredentialStore,
|
|
10434
10619
|
MemorySkillStore,
|
|
10435
10620
|
MemoryStore,
|
|
@@ -10518,6 +10703,7 @@ export {
|
|
|
10518
10703
|
imageSizeOf,
|
|
10519
10704
|
isMcpAppSandboxMessage,
|
|
10520
10705
|
isWebGPUAvailable2 as isWebGPUAvailable,
|
|
10706
|
+
languageOfText,
|
|
10521
10707
|
lessonsOf,
|
|
10522
10708
|
linkedFilesOf,
|
|
10523
10709
|
loadSkillFromUrl,
|
|
@@ -10554,6 +10740,8 @@ export {
|
|
|
10554
10740
|
sandboxedCsp,
|
|
10555
10741
|
saveAppFile,
|
|
10556
10742
|
saveChat,
|
|
10743
|
+
scriptOfLanguage,
|
|
10744
|
+
scriptOfText,
|
|
10557
10745
|
serveSubagentWorker,
|
|
10558
10746
|
settleAudioDuration,
|
|
10559
10747
|
speakableText,
|