@dudko.dev/agent-web-react 0.0.41 → 0.0.43
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 +4 -2
- package/dist/{chunk-FXHQXIOU.js → chunk-AWZ2OZSG.js} +6 -2
- package/dist/chunk-AWZ2OZSG.js.map +1 -0
- package/dist/{elicitation-Dp6Fi6ZA.d.ts → elicitation-B5t9hdaJ.d.cts} +9 -3
- package/dist/{elicitation-Dp6Fi6ZA.d.cts → elicitation-rJu93Z3o.d.ts} +9 -3
- package/dist/index.cjs +951 -593
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -9
- package/dist/index.d.ts +134 -9
- package/dist/index.js +800 -451
- package/dist/index.js.map +1 -1
- package/dist/{mcp-app-policy-DIUmGPJP.d.cts → mcp-app-policy-BhBIsbBy.d.cts} +20 -2
- package/dist/{mcp-app-policy-DIUmGPJP.d.ts → mcp-app-policy-BhBIsbBy.d.ts} +20 -2
- package/dist/mcp-app-sandbox.cjs +17 -7
- package/dist/mcp-app-sandbox.cjs.map +1 -1
- package/dist/mcp-app-sandbox.d.cts +11 -6
- package/dist/mcp-app-sandbox.d.ts +11 -6
- package/dist/mcp-app-sandbox.js +15 -7
- package/dist/mcp-app-sandbox.js.map +1 -1
- package/dist/mcp.d.cts +3 -2
- package/dist/mcp.d.ts +3 -2
- package/dist/styles.css +99 -6
- package/package.json +3 -3
- package/dist/chunk-FXHQXIOU.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -64,10 +64,12 @@ import {
|
|
|
64
64
|
MCP_APP_POLICY_TOKEN_MAX_CHARS,
|
|
65
65
|
MCP_APP_SANDBOX_PROXY_READY,
|
|
66
66
|
MCP_APP_SANDBOX_RESOURCE_READY,
|
|
67
|
+
MCP_APP_SCHEME_PARAM,
|
|
67
68
|
isMcpAppSandboxMessage,
|
|
69
|
+
mcpAppColorScheme,
|
|
68
70
|
mcpAppPolicy,
|
|
69
71
|
mcpAppPolicyToken
|
|
70
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-AWZ2OZSG.js";
|
|
71
73
|
|
|
72
74
|
// src/hooks/use-agent.ts
|
|
73
75
|
import { useCallback, useEffect, useReducer, useRef, useState } from "react";
|
|
@@ -2114,7 +2116,18 @@ var useChatHistory = (agent, options = {}) => {
|
|
|
2114
2116
|
const agentRef = useRef2(agent);
|
|
2115
2117
|
agentRef.current = agent;
|
|
2116
2118
|
const baseRef = useRef2(void 0);
|
|
2119
|
+
const loadingRef = useRef2(void 0);
|
|
2120
|
+
if (loadingRef.current && agent.messages !== loadingRef.current) loadingRef.current = void 0;
|
|
2117
2121
|
const staleRef = useRef2(void 0);
|
|
2122
|
+
const queueRef = useRef2(Promise.resolve());
|
|
2123
|
+
const serially = useCallback2((task) => {
|
|
2124
|
+
const next = queueRef.current.then(task);
|
|
2125
|
+
queueRef.current = next.catch(() => {
|
|
2126
|
+
});
|
|
2127
|
+
return next;
|
|
2128
|
+
}, []);
|
|
2129
|
+
const baseOf = (id) => baseRef.current?.id === id ? baseRef.current : void 0;
|
|
2130
|
+
const unsavedHere = (messages2, id) => !loadingRef.current && ownUnsaved(messages2, baseOf(id));
|
|
2118
2131
|
const refresh = useCallback2(async () => {
|
|
2119
2132
|
try {
|
|
2120
2133
|
setChats(await store.list());
|
|
@@ -2124,19 +2137,79 @@ var useChatHistory = (agent, options = {}) => {
|
|
|
2124
2137
|
const newChat = useCallback2(() => {
|
|
2125
2138
|
agentRef.current.loadChat({ sessionId: newChatId(), messages: [] });
|
|
2126
2139
|
}, []);
|
|
2127
|
-
const
|
|
2140
|
+
const show = useCallback2((record) => {
|
|
2141
|
+
createdRef.current.set(record.id, record.createdAt);
|
|
2142
|
+
baseRef.current = {
|
|
2143
|
+
id: record.id,
|
|
2144
|
+
known: new Set(record.messages),
|
|
2145
|
+
updatedAt: record.updatedAt
|
|
2146
|
+
};
|
|
2147
|
+
loadingRef.current ??= agentRef.current.messages;
|
|
2148
|
+
agentRef.current.loadChat({
|
|
2149
|
+
sessionId: record.id,
|
|
2150
|
+
messages: record.messages,
|
|
2151
|
+
totalUsage: record.totalUsage
|
|
2152
|
+
});
|
|
2153
|
+
}, []);
|
|
2154
|
+
const saveOpen = useCallback2(
|
|
2128
2155
|
async (id) => {
|
|
2129
|
-
const
|
|
2130
|
-
if (
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2156
|
+
const current = agentRef.current;
|
|
2157
|
+
if (current.sessionId !== id || current.isRunning) return;
|
|
2158
|
+
const { messages: messages2, totalUsage: totalUsage2, remote: remote2 } = current;
|
|
2159
|
+
if (messages2.length === 0) return;
|
|
2160
|
+
const base = baseOf(id);
|
|
2161
|
+
if (loadingRef.current || unchangedSince(messages2, base)) return;
|
|
2162
|
+
if (remote2 && !ownUnsaved(messages2, base)) return;
|
|
2163
|
+
const now = Date.now();
|
|
2164
|
+
const createdAt = createdRef.current.get(id) ?? now;
|
|
2165
|
+
createdRef.current.set(id, createdAt);
|
|
2166
|
+
const view = {
|
|
2167
|
+
id,
|
|
2168
|
+
title: chatTitle(messages2, textsRef.current),
|
|
2169
|
+
createdAt,
|
|
2170
|
+
updatedAt: now,
|
|
2171
|
+
messages: messages2,
|
|
2172
|
+
totalUsage: totalUsage2
|
|
2173
|
+
};
|
|
2174
|
+
const { record, merged } = await saveChat(store, view, base, textsRef.current);
|
|
2175
|
+
baseRef.current = {
|
|
2176
|
+
id,
|
|
2177
|
+
known: new Set(merged ? record.messages : messages2),
|
|
2178
|
+
updatedAt: record.updatedAt
|
|
2179
|
+
};
|
|
2180
|
+
await refresh();
|
|
2181
|
+
if (merged && agentRef.current.sessionId === id) show(record);
|
|
2138
2182
|
},
|
|
2139
|
-
|
|
2183
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2184
|
+
[store, show]
|
|
2185
|
+
);
|
|
2186
|
+
const reread = useCallback2(
|
|
2187
|
+
(id) => serially(async () => {
|
|
2188
|
+
const settled = () => {
|
|
2189
|
+
const current = agentRef.current;
|
|
2190
|
+
if (current.sessionId !== id) return false;
|
|
2191
|
+
if (current.isRunning) {
|
|
2192
|
+
if (current.remote?.running) staleRef.current = id;
|
|
2193
|
+
return false;
|
|
2194
|
+
}
|
|
2195
|
+
return true;
|
|
2196
|
+
};
|
|
2197
|
+
if (!settled()) return;
|
|
2198
|
+
if (unsavedHere(agentRef.current.messages, id)) return saveOpen(id);
|
|
2199
|
+
const record = await store.get(id).catch(() => void 0);
|
|
2200
|
+
if (!record || !settled()) return;
|
|
2201
|
+
if (unsavedHere(agentRef.current.messages, id)) return saveOpen(id);
|
|
2202
|
+
show(record);
|
|
2203
|
+
}),
|
|
2204
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2205
|
+
[store, serially, saveOpen, show]
|
|
2206
|
+
);
|
|
2207
|
+
const select = useCallback2(
|
|
2208
|
+
(id) => serially(async () => {
|
|
2209
|
+
const record = await store.get(id).catch(() => void 0);
|
|
2210
|
+
if (record) show(record);
|
|
2211
|
+
}),
|
|
2212
|
+
[store, serially, show]
|
|
2140
2213
|
);
|
|
2141
2214
|
const remove = useCallback2(
|
|
2142
2215
|
async (id) => {
|
|
@@ -2180,45 +2253,34 @@ var useChatHistory = (agent, options = {}) => {
|
|
|
2180
2253
|
const current = agentRef.current;
|
|
2181
2254
|
if (key === void 0 || key !== current.sessionId) return;
|
|
2182
2255
|
if (current.remote?.running) staleRef.current = key;
|
|
2183
|
-
else if (!current.isRunning) void
|
|
2256
|
+
else if (!current.isRunning) void reread(key);
|
|
2184
2257
|
}
|
|
2185
2258
|
);
|
|
2186
|
-
}, [enabled, store, refresh,
|
|
2259
|
+
}, [enabled, store, refresh, reread]);
|
|
2187
2260
|
const { messages, totalUsage, sessionId, isRunning, remote } = agent;
|
|
2188
2261
|
useEffect2(() => {
|
|
2189
2262
|
if (!enabled || loading || isRunning) return;
|
|
2190
2263
|
if (staleRef.current === sessionId) {
|
|
2191
2264
|
staleRef.current = void 0;
|
|
2192
|
-
void
|
|
2265
|
+
void reread(sessionId).catch(() => {
|
|
2266
|
+
});
|
|
2193
2267
|
return;
|
|
2194
2268
|
}
|
|
2195
2269
|
if (messages.length === 0) return;
|
|
2196
|
-
|
|
2197
|
-
if (unchangedSince(messages, base)) return;
|
|
2198
|
-
if (remote && !ownUnsaved(messages, base)) return;
|
|
2199
|
-
const now = Date.now();
|
|
2200
|
-
const createdAt = createdRef.current.get(sessionId) ?? now;
|
|
2201
|
-
createdRef.current.set(sessionId, createdAt);
|
|
2202
|
-
const view = {
|
|
2203
|
-
id: sessionId,
|
|
2204
|
-
title: chatTitle(messages, textsRef.current),
|
|
2205
|
-
createdAt,
|
|
2206
|
-
updatedAt: now,
|
|
2207
|
-
messages,
|
|
2208
|
-
totalUsage
|
|
2209
|
-
};
|
|
2210
|
-
void (async () => {
|
|
2211
|
-
const { record, merged } = await saveChat(store, view, base, textsRef.current);
|
|
2212
|
-
baseRef.current = {
|
|
2213
|
-
id: sessionId,
|
|
2214
|
-
known: new Set(merged ? record.messages : messages),
|
|
2215
|
-
updatedAt: record.updatedAt
|
|
2216
|
-
};
|
|
2217
|
-
await refresh();
|
|
2218
|
-
if (merged && agentRef.current.sessionId === sessionId) await select(sessionId);
|
|
2219
|
-
})().catch(() => {
|
|
2270
|
+
void serially(() => saveOpen(sessionId)).catch(() => {
|
|
2220
2271
|
});
|
|
2221
|
-
}, [
|
|
2272
|
+
}, [
|
|
2273
|
+
enabled,
|
|
2274
|
+
loading,
|
|
2275
|
+
isRunning,
|
|
2276
|
+
remote,
|
|
2277
|
+
messages,
|
|
2278
|
+
totalUsage,
|
|
2279
|
+
sessionId,
|
|
2280
|
+
serially,
|
|
2281
|
+
saveOpen,
|
|
2282
|
+
reread
|
|
2283
|
+
]);
|
|
2222
2284
|
return { chats, currentId: sessionId, loading, select, newChat, remove };
|
|
2223
2285
|
};
|
|
2224
2286
|
|
|
@@ -3639,6 +3701,7 @@ var defaultLabels = {
|
|
|
3639
3701
|
dictate: "Dictate (speech to text)",
|
|
3640
3702
|
dictateTitle: "Dictate \u2014 speech to text in the browser",
|
|
3641
3703
|
stopDictation: "Stop dictation",
|
|
3704
|
+
micListening: "Listening \u2014 tap to finish",
|
|
3642
3705
|
microphone: "Microphone",
|
|
3643
3706
|
transcribing: "Transcribing\u2026",
|
|
3644
3707
|
micDenied: "The microphone is blocked for this site. Allow it in the browser's site settings (the icon beside the address), then try again.",
|
|
@@ -3788,6 +3851,7 @@ var defaultLabels = {
|
|
|
3788
3851
|
readAloudCode: "A code block is not read out.",
|
|
3789
3852
|
readAloudFailed: "It could not be read aloud.",
|
|
3790
3853
|
filesWritten: (n) => `${plural(n, "file", "files")} written in this turn`,
|
|
3854
|
+
filesNamed: (n) => `${plural(n, "file", "files")} in this answer`,
|
|
3791
3855
|
filesCount: (n) => plural(n, "file", "files"),
|
|
3792
3856
|
showInFiles: "Show in Files",
|
|
3793
3857
|
fileKinds: {
|
|
@@ -4158,7 +4222,7 @@ var useAgentContext = () => {
|
|
|
4158
4222
|
var useOptionalAgentContext = () => useContext2(AgentContext);
|
|
4159
4223
|
|
|
4160
4224
|
// src/components/AgentChat.tsx
|
|
4161
|
-
import { useEffect as useEffect20, useRef as
|
|
4225
|
+
import { useEffect as useEffect20, useRef as useRef15, useState as useState20 } from "react";
|
|
4162
4226
|
import { createPortal as createPortal2 } from "react-dom";
|
|
4163
4227
|
|
|
4164
4228
|
// src/hooks/use-follow-scroll.ts
|
|
@@ -4416,9 +4480,13 @@ var grantedAppCsp = (csp) => ({
|
|
|
4416
4480
|
resourceDomains: origins(csp?.resourceDomains)
|
|
4417
4481
|
});
|
|
4418
4482
|
var MCP_APP_RELAY = "(function(){var f=document.getElementById('app');function reserved(d){return !!d&&typeof d.method==='string'&&d.method.indexOf('ui/notifications/sandbox-')===0}addEventListener('message',function(e){var w=f&&f.contentWindow;if(!w||reserved(e.data))return;if(e.source===w){parent.postMessage(e.data,'*')}else if(e.source===parent){w.postMessage(e.data,'*')}})})()";
|
|
4419
|
-
var
|
|
4483
|
+
var schemeMeta = (scheme) => scheme ? `<meta name="color-scheme" content="${scheme}">` : "";
|
|
4484
|
+
var schemeCss = (scheme) => scheme ? `:root{color-scheme:${scheme}}` : "";
|
|
4485
|
+
var schemeOfFrame = (scheme) => scheme ? `;color-scheme:${scheme}` : "";
|
|
4486
|
+
var buildMcpAppDocument = (html, csp, scheme) => {
|
|
4420
4487
|
const policy = mcpAppCsp(csp);
|
|
4421
|
-
|
|
4488
|
+
const s = mcpAppColorScheme(scheme);
|
|
4489
|
+
return `<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${escapeAttribute(policy)}">` + schemeMeta(s) + `<style>${schemeCss(s)}html,body{margin:0;height:100%;overflow:hidden;background:transparent}iframe{display:block;border:0;width:100%;height:100%${schemeOfFrame(s)}}</style></head><body><iframe id="app" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${escapeAttribute(withPolicyFirst(html, policy))}"></iframe><script>${MCP_APP_RELAY}</script></body></html>`;
|
|
4422
4490
|
};
|
|
4423
4491
|
var appLinkOf = (value) => {
|
|
4424
4492
|
if (typeof value !== "string" || value.length > MCP_APP_MAX_URL_CHARS) return void 0;
|
|
@@ -5037,9 +5105,11 @@ var mcpAppSandboxShellCsp = (proxyUrl) => [
|
|
|
5037
5105
|
"form-action 'none'",
|
|
5038
5106
|
"base-uri 'none'"
|
|
5039
5107
|
].join("; ");
|
|
5040
|
-
var buildMcpAppSandboxShell = (proxyUrl) => {
|
|
5108
|
+
var buildMcpAppSandboxShell = (proxyUrl, scheme) => {
|
|
5041
5109
|
if (!PROXY_URL.test(proxyUrl)) throw new Error("not a sandbox proxy URL");
|
|
5042
|
-
|
|
5110
|
+
const s = mcpAppColorScheme(scheme);
|
|
5111
|
+
const src = s ? `${proxyUrl}?${MCP_APP_SCHEME_PARAM}=${s}` : proxyUrl;
|
|
5112
|
+
return "<!doctype html><html><head>" + cspMetaTag(mcpAppSandboxShellCsp(proxyUrl)) + schemeMeta(s) + `<style>${schemeCss(s)}html,body{margin:0;height:100%;overflow:hidden;background:transparent}iframe{display:block;border:0;width:100%;height:100%${schemeOfFrame(s)}}</style></head><body><iframe id="proxy" sandbox="${MCP_APP_SANDBOX_FRAME_TOKENS}" referrerpolicy="no-referrer" src="${escapeAttribute(src)}"></iframe></body></html>`;
|
|
5043
5113
|
};
|
|
5044
5114
|
var McpAppSandboxLink = class {
|
|
5045
5115
|
o;
|
|
@@ -5550,10 +5620,14 @@ var McpAppFrame = ({
|
|
|
5550
5620
|
if (!url) return { mode: "opaque", reason: "too-many-origins" };
|
|
5551
5621
|
return { mode: "origin", origin: target.origin, url };
|
|
5552
5622
|
}, [resource, sandboxUrl, fallback, app.server, reload]);
|
|
5553
|
-
const doc = useMemo6(
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5623
|
+
const { doc, scheme } = useMemo6(() => {
|
|
5624
|
+
const scheme2 = themeRef.current === "dark" ? "dark" : "light";
|
|
5625
|
+
if (!resource || !placement) return { scheme: scheme2 };
|
|
5626
|
+
return {
|
|
5627
|
+
scheme: scheme2,
|
|
5628
|
+
doc: placement.mode === "origin" ? buildMcpAppSandboxShell(placement.url, scheme2) : buildMcpAppDocument(resource.html, resource.csp, scheme2)
|
|
5629
|
+
};
|
|
5630
|
+
}, [resource, placement]);
|
|
5557
5631
|
useEffect11(() => {
|
|
5558
5632
|
const reason = placement?.mode === "opaque" ? placement.reason : void 0;
|
|
5559
5633
|
if (reason && reason !== "no-answer" && sandboxUrl !== void 0) {
|
|
@@ -5838,6 +5912,7 @@ var McpAppFrame = ({
|
|
|
5838
5912
|
referrerPolicy: "no-referrer",
|
|
5839
5913
|
srcDoc: doc,
|
|
5840
5914
|
onLoad: () => shellLoaded.current?.(),
|
|
5915
|
+
"data-color-scheme": scheme,
|
|
5841
5916
|
style: panel || fullscreen ? void 0 : { height }
|
|
5842
5917
|
},
|
|
5843
5918
|
`${reload}:origin`
|
|
@@ -5850,6 +5925,7 @@ var McpAppFrame = ({
|
|
|
5850
5925
|
sandbox: "allow-scripts",
|
|
5851
5926
|
referrerPolicy: "no-referrer",
|
|
5852
5927
|
srcDoc: doc,
|
|
5928
|
+
"data-color-scheme": scheme,
|
|
5853
5929
|
style: panel || fullscreen ? void 0 : { height }
|
|
5854
5930
|
},
|
|
5855
5931
|
`${reload}:opaque`
|
|
@@ -6156,6 +6232,15 @@ var readDataUrl2 = (file) => new Promise((resolve, reject) => {
|
|
|
6156
6232
|
r.readAsDataURL(file);
|
|
6157
6233
|
});
|
|
6158
6234
|
var safeName = (name) => name.replace(/[^\w.-]+/g, "_").slice(0, 80) || "file";
|
|
6235
|
+
var DictationClock = () => {
|
|
6236
|
+
const [t0] = useState12(() => Date.now());
|
|
6237
|
+
const [now, setNow] = useState12(t0);
|
|
6238
|
+
useEffect12(() => {
|
|
6239
|
+
const id = setInterval(() => setNow(Date.now()), 500);
|
|
6240
|
+
return () => clearInterval(id);
|
|
6241
|
+
}, []);
|
|
6242
|
+
return /* @__PURE__ */ jsx5("span", { className: "awr-mic__time", "aria-hidden": "true", children: formatClock(now - t0) });
|
|
6243
|
+
};
|
|
6159
6244
|
var AgentComposer = ({
|
|
6160
6245
|
controller: agent,
|
|
6161
6246
|
placeholder,
|
|
@@ -6252,6 +6337,7 @@ ${draftText}` : draftText);
|
|
|
6252
6337
|
onFinal: (heard) => setText((t) => t.trim() ? `${t.trimEnd()} ${heard}` : heard)
|
|
6253
6338
|
});
|
|
6254
6339
|
const showMic = speech !== false && stt.supported;
|
|
6340
|
+
const micOn = stt.listening && !stt.finishing;
|
|
6255
6341
|
const recorder = useAudioRecorder({
|
|
6256
6342
|
maxMs: typeof voiceMessage === "object" ? voiceMessage.maxMs : void 0
|
|
6257
6343
|
});
|
|
@@ -6894,19 +6980,22 @@ ${draftText}` : draftText);
|
|
|
6894
6980
|
"aria-label": L.message
|
|
6895
6981
|
}
|
|
6896
6982
|
),
|
|
6897
|
-
showMic && /* @__PURE__ */
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6983
|
+
showMic && /* @__PURE__ */ jsxs3("span", { className: `awr-micbox${micOn ? " is-on" : ""}${stt.finishing ? " is-busy" : ""}`, children: [
|
|
6984
|
+
micOn && /* @__PURE__ */ jsx5(DictationClock, {}),
|
|
6985
|
+
/* @__PURE__ */ jsx5(
|
|
6986
|
+
"button",
|
|
6987
|
+
{
|
|
6988
|
+
type: "button",
|
|
6989
|
+
className: `awr-iconbtn awr-mic${micOn ? " is-on" : ""}${stt.finishing ? " is-busy" : ""}`,
|
|
6990
|
+
"aria-label": stt.finishing ? L.transcribing : micOn ? L.micListening : L.dictate,
|
|
6991
|
+
"aria-busy": stt.finishing || void 0,
|
|
6992
|
+
title: micOn ? L.stopDictation : stt.finishing ? L.transcribing : L.dictateTitle,
|
|
6993
|
+
onClick: stt.toggle,
|
|
6994
|
+
disabled: disabled || recordingOn || stt.finishing,
|
|
6995
|
+
children: stt.finishing ? /* @__PURE__ */ jsx5(SpinnerIcon, { size: 18 }) : micOn ? /* @__PURE__ */ jsx5(StopIcon, { size: 16 }) : /* @__PURE__ */ jsx5(MicIcon, { size: 18 })
|
|
6996
|
+
}
|
|
6997
|
+
)
|
|
6998
|
+
] })
|
|
6910
6999
|
] }),
|
|
6911
7000
|
stt.listening && stt.interim && /* @__PURE__ */ jsx5("div", { className: "awr-composer2__interim", children: stt.interim }),
|
|
6912
7001
|
stt.finishing && /* @__PURE__ */ jsx5("div", { className: "awr-composer2__interim", role: "status", children: L.transcribing }),
|
|
@@ -7824,6 +7913,7 @@ var ImageViewerProvider = ({
|
|
|
7824
7913
|
render,
|
|
7825
7914
|
children
|
|
7826
7915
|
}) => /* @__PURE__ */ jsx9(ImageViewerContext.Provider, { value: { enabled, render }, children });
|
|
7916
|
+
var useImageViewerOn = () => useContext3(ImageViewerContext).enabled;
|
|
7827
7917
|
var imageExtensionOf = (src) => {
|
|
7828
7918
|
const type = /^data:image\/([a-z0-9.+-]+)/i.exec(src)?.[1]?.toLowerCase();
|
|
7829
7919
|
return !type ? "" : type === "jpeg" ? ".jpg" : type === "svg+xml" ? ".svg" : `.${type}`;
|
|
@@ -8034,7 +8124,7 @@ var FilesPanel = ({
|
|
|
8034
8124
|
};
|
|
8035
8125
|
|
|
8036
8126
|
// src/components/FileChips.tsx
|
|
8037
|
-
import { Fragment as Fragment8, useEffect as useEffect17, useMemo as
|
|
8127
|
+
import { Fragment as Fragment8, useEffect as useEffect17, useMemo as useMemo9, useRef as useRef13, useState as useState17 } from "react";
|
|
8038
8128
|
|
|
8039
8129
|
// src/file-kinds.ts
|
|
8040
8130
|
import { MEDIA_IMAGE_TYPES, isTextMime } from "@dudko.dev/agent-web";
|
|
@@ -8054,6 +8144,122 @@ var fileKindOf = (path, mediaType) => {
|
|
|
8054
8144
|
};
|
|
8055
8145
|
var fileNameOf2 = (path) => path.split("/").filter(Boolean).pop() || "file";
|
|
8056
8146
|
|
|
8147
|
+
// src/named-files.ts
|
|
8148
|
+
var NAMED_FILES_MAX = 12;
|
|
8149
|
+
var NAMED_FILES_SCAN_MAX = 200;
|
|
8150
|
+
var NAMED_FILES_TEXT_MAX = 1e5;
|
|
8151
|
+
var PATH_MAX = 512;
|
|
8152
|
+
var workspacePathOf = (raw) => {
|
|
8153
|
+
if (raw.length < 2 || raw.length > PATH_MAX) return void 0;
|
|
8154
|
+
if (raw[0] !== "/" || raw[1] === "/") return void 0;
|
|
8155
|
+
if (/[\u0000-\u001f\u007f\\]/.test(raw)) return void 0;
|
|
8156
|
+
const segments = raw.slice(1).split("/");
|
|
8157
|
+
for (const s of segments) {
|
|
8158
|
+
if (!s || s === "." || s === ".." || s.trim() !== s) return void 0;
|
|
8159
|
+
}
|
|
8160
|
+
return raw;
|
|
8161
|
+
};
|
|
8162
|
+
var withoutFences = (text) => {
|
|
8163
|
+
const lines = text.split("\n");
|
|
8164
|
+
let fence;
|
|
8165
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8166
|
+
const open = /^ {0,3}(`{3,}|~{3,})/.exec(lines[i]);
|
|
8167
|
+
if (!fence) {
|
|
8168
|
+
if (open && !(open[1][0] === "`" && lines[i].slice(open[0].length).includes("`"))) {
|
|
8169
|
+
fence = { char: open[1][0], size: open[1].length };
|
|
8170
|
+
lines[i] = " ".repeat(lines[i].length);
|
|
8171
|
+
}
|
|
8172
|
+
continue;
|
|
8173
|
+
}
|
|
8174
|
+
const close = /^ {0,3}(`{3,}|~{3,})\s*$/.exec(lines[i]);
|
|
8175
|
+
if (close && close[1][0] === fence.char && close[1].length >= fence.size) fence = void 0;
|
|
8176
|
+
lines[i] = " ".repeat(lines[i].length);
|
|
8177
|
+
}
|
|
8178
|
+
return lines.join("\n");
|
|
8179
|
+
};
|
|
8180
|
+
var decoded = (s) => {
|
|
8181
|
+
if (!s.includes("%")) return s;
|
|
8182
|
+
try {
|
|
8183
|
+
return decodeURIComponent(s);
|
|
8184
|
+
} catch {
|
|
8185
|
+
return s;
|
|
8186
|
+
}
|
|
8187
|
+
};
|
|
8188
|
+
var codeSpansOf = (text) => {
|
|
8189
|
+
const runs = [];
|
|
8190
|
+
for (let i = text.indexOf("`"); i >= 0; i = text.indexOf("`", i)) {
|
|
8191
|
+
let j = i + 1;
|
|
8192
|
+
while (j < text.length && text.charCodeAt(j) === 96) j++;
|
|
8193
|
+
runs.push({ at: i, size: j - i });
|
|
8194
|
+
i = j;
|
|
8195
|
+
}
|
|
8196
|
+
const next = new Array(runs.length);
|
|
8197
|
+
const later = /* @__PURE__ */ new Map();
|
|
8198
|
+
for (let k = runs.length - 1; k >= 0; k--) {
|
|
8199
|
+
next[k] = later.get(runs[k].size) ?? -1;
|
|
8200
|
+
later.set(runs[k].size, k);
|
|
8201
|
+
}
|
|
8202
|
+
const spans = [];
|
|
8203
|
+
for (let k = 0; k < runs.length; ) {
|
|
8204
|
+
const close = next[k];
|
|
8205
|
+
if (close < 0) {
|
|
8206
|
+
k++;
|
|
8207
|
+
continue;
|
|
8208
|
+
}
|
|
8209
|
+
const open = runs[k];
|
|
8210
|
+
const end = runs[close].at + runs[close].size;
|
|
8211
|
+
spans.push({ at: open.at, end, inner: text.slice(open.at + open.size, runs[close].at) });
|
|
8212
|
+
k = close + 1;
|
|
8213
|
+
}
|
|
8214
|
+
return spans;
|
|
8215
|
+
};
|
|
8216
|
+
var LINK = /!?\[[^[\]\n]*\]\(\s*(<[^<>\n]+>|[^\s()<>]+)(?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^()\n]*\)))?\s*\)/g;
|
|
8217
|
+
var pathsNamedIn = (text) => {
|
|
8218
|
+
if (!text) return [];
|
|
8219
|
+
const head = text.length > NAMED_FILES_TEXT_MAX ? text.slice(0, NAMED_FILES_TEXT_MAX) : text;
|
|
8220
|
+
if (!head.includes("/")) return [];
|
|
8221
|
+
const found = [];
|
|
8222
|
+
let masked = withoutFences(head);
|
|
8223
|
+
const spans = codeSpansOf(masked);
|
|
8224
|
+
const parts = [];
|
|
8225
|
+
let from = 0;
|
|
8226
|
+
for (const span of spans) {
|
|
8227
|
+
let inner = span.inner;
|
|
8228
|
+
if (inner.length > 2 && inner.startsWith(" ") && inner.endsWith(" ")) inner = inner.slice(1, -1);
|
|
8229
|
+
const path = workspacePathOf(inner);
|
|
8230
|
+
if (path) found.push({ at: span.at, path });
|
|
8231
|
+
parts.push(masked.slice(from, span.at), " ".repeat(span.end - span.at));
|
|
8232
|
+
from = span.end;
|
|
8233
|
+
}
|
|
8234
|
+
masked = parts.join("") + masked.slice(from);
|
|
8235
|
+
for (const m of masked.matchAll(LINK)) {
|
|
8236
|
+
const dest = m[1].startsWith("<") ? m[1].slice(1, -1) : m[1];
|
|
8237
|
+
const path = workspacePathOf(decoded(dest));
|
|
8238
|
+
if (path) found.push({ at: m.index, path });
|
|
8239
|
+
}
|
|
8240
|
+
found.sort((a, b) => a.at - b.at);
|
|
8241
|
+
const out = [];
|
|
8242
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8243
|
+
for (const { path } of found) {
|
|
8244
|
+
if (seen.has(path)) continue;
|
|
8245
|
+
seen.add(path);
|
|
8246
|
+
out.push(path);
|
|
8247
|
+
if (out.length >= NAMED_FILES_SCAN_MAX) break;
|
|
8248
|
+
}
|
|
8249
|
+
return out;
|
|
8250
|
+
};
|
|
8251
|
+
var namedFilesOf = (named, exists, { exclude, max = NAMED_FILES_MAX } = {}) => {
|
|
8252
|
+
const skip = new Set(exclude ?? []);
|
|
8253
|
+
const out = [];
|
|
8254
|
+
for (const path of named) {
|
|
8255
|
+
if (out.length >= max) break;
|
|
8256
|
+
if (skip.has(path) || !exists(path)) continue;
|
|
8257
|
+
skip.add(path);
|
|
8258
|
+
out.push(path);
|
|
8259
|
+
}
|
|
8260
|
+
return out;
|
|
8261
|
+
};
|
|
8262
|
+
|
|
8057
8263
|
// src/components/Media.tsx
|
|
8058
8264
|
import { useEffect as useEffect16, useState as useState16 } from "react";
|
|
8059
8265
|
import { MEDIA_AUDIO_TYPES, MEDIA_IMAGE_TYPES as MEDIA_IMAGE_TYPES2 } from "@dudko.dev/agent-web";
|
|
@@ -8196,8 +8402,30 @@ var SandboxedFrame = ({
|
|
|
8196
8402
|
footer ? /* @__PURE__ */ jsx12("div", { className: "awr-frame__foot", children: footer }) : null
|
|
8197
8403
|
] });
|
|
8198
8404
|
|
|
8405
|
+
// src/components/WorkspaceListing.tsx
|
|
8406
|
+
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo8 } from "react";
|
|
8407
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
8408
|
+
var WorkspaceListingContext = createContext4(void 0);
|
|
8409
|
+
var WorkspaceListingProvider = ({
|
|
8410
|
+
files,
|
|
8411
|
+
children
|
|
8412
|
+
}) => {
|
|
8413
|
+
const live = useVirtualFiles(files);
|
|
8414
|
+
const value = useMemo8(
|
|
8415
|
+
() => files ? { vfs: files, listing: { files: live.files, loading: live.loading } } : void 0,
|
|
8416
|
+
[files, live.files, live.loading]
|
|
8417
|
+
);
|
|
8418
|
+
return /* @__PURE__ */ jsx13(WorkspaceListingContext.Provider, { value, children });
|
|
8419
|
+
};
|
|
8420
|
+
var useWorkspaceListing = (vfs) => {
|
|
8421
|
+
const shared = useContext4(WorkspaceListingContext);
|
|
8422
|
+
const fromShared = shared !== void 0 && vfs !== void 0 && shared.vfs === vfs;
|
|
8423
|
+
const own = useVirtualFiles(fromShared ? void 0 : vfs);
|
|
8424
|
+
return fromShared ? shared.listing : own;
|
|
8425
|
+
};
|
|
8426
|
+
|
|
8199
8427
|
// src/components/FileChips.tsx
|
|
8200
|
-
import { Fragment as Fragment9, jsx as
|
|
8428
|
+
import { Fragment as Fragment9, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
8201
8429
|
var FILE_PREVIEW_CHARS = 2e4;
|
|
8202
8430
|
var textOf = (file) => file.encoding === "base64" ? new TextDecoder().decode(bytesOf(file.content, "base64")) : file.content;
|
|
8203
8431
|
var KIND_ICON = {
|
|
@@ -8222,7 +8450,7 @@ var downloadFile = async (vfs, path) => {
|
|
|
8222
8450
|
a.click();
|
|
8223
8451
|
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
8224
8452
|
};
|
|
8225
|
-
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */
|
|
8453
|
+
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ jsx14("div", { className: "awr-seg", role: "group", "aria-label": label, children: options.map((o) => /* @__PURE__ */ jsxs11(
|
|
8226
8454
|
"button",
|
|
8227
8455
|
{
|
|
8228
8456
|
type: "button",
|
|
@@ -8257,22 +8485,22 @@ var SourceView = ({
|
|
|
8257
8485
|
const L = useLabels(labels);
|
|
8258
8486
|
const cut = text.length > maxChars;
|
|
8259
8487
|
const shown = cut ? text.slice(0, maxChars) : text;
|
|
8260
|
-
const lines =
|
|
8488
|
+
const lines = useMemo9(
|
|
8261
8489
|
() => linesOf(html ? tokenizeHtml(shown) : [{ kind: "text", text: shown }]),
|
|
8262
8490
|
[shown, html]
|
|
8263
8491
|
);
|
|
8264
8492
|
return /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
8265
|
-
/* @__PURE__ */
|
|
8493
|
+
/* @__PURE__ */ jsx14("pre", { className: ["awr-source", className].filter(Boolean).join(" "), tabIndex: 0, children: lines.map((line, i) => /* @__PURE__ */ jsxs11("span", { className: "awr-source__line", children: [
|
|
8266
8494
|
line.map(
|
|
8267
|
-
(t, k) => t.kind === "text" ? /* @__PURE__ */
|
|
8495
|
+
(t, k) => t.kind === "text" ? /* @__PURE__ */ jsx14(Fragment8, { children: t.text }, k) : /* @__PURE__ */ jsx14("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
|
|
8268
8496
|
),
|
|
8269
8497
|
"\n"
|
|
8270
8498
|
] }, i)) }),
|
|
8271
|
-
cut && /* @__PURE__ */
|
|
8499
|
+
cut && /* @__PURE__ */ jsx14("p", { className: "awr-fileview__cut", children: L.fileCut(maxChars) })
|
|
8272
8500
|
] });
|
|
8273
8501
|
};
|
|
8274
8502
|
var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
8275
|
-
const html =
|
|
8503
|
+
const html = useMemo9(() => textOf(file), [file]);
|
|
8276
8504
|
const options = htmlPreview === false ? void 0 : htmlPreview;
|
|
8277
8505
|
const tooLarge = html.length > HTML_PREVIEW_MAX_CHARS;
|
|
8278
8506
|
const canFrame = Boolean(options) && !tooLarge;
|
|
@@ -8281,8 +8509,8 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
8281
8509
|
const showing = canFrame ? view : "source";
|
|
8282
8510
|
const scripts = options?.scripts === true;
|
|
8283
8511
|
const height = options?.height ?? 300;
|
|
8284
|
-
const linked =
|
|
8285
|
-
return /* @__PURE__ */
|
|
8512
|
+
const linked = useMemo9(() => showing === "preview" ? linkedFilesOf(html) : [], [html, showing]);
|
|
8513
|
+
return /* @__PURE__ */ jsx14(
|
|
8286
8514
|
SandboxedFrame,
|
|
8287
8515
|
{
|
|
8288
8516
|
className: "awr-frame--html",
|
|
@@ -8291,34 +8519,34 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
8291
8519
|
scripts,
|
|
8292
8520
|
height: tall ? height * 2 : height,
|
|
8293
8521
|
label: /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
8294
|
-
/* @__PURE__ */
|
|
8522
|
+
/* @__PURE__ */ jsx14(CodeIcon, { size: 14, className: "awr-frame__icon" }),
|
|
8295
8523
|
/* @__PURE__ */ jsxs11("span", { className: "awr-frame__titles", children: [
|
|
8296
|
-
/* @__PURE__ */
|
|
8297
|
-
/* @__PURE__ */
|
|
8298
|
-
/* @__PURE__ */
|
|
8524
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
|
|
8525
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
8526
|
+
/* @__PURE__ */ jsx14(LockIcon, { size: 11 }),
|
|
8299
8527
|
" ",
|
|
8300
8528
|
L.htmlSandboxed,
|
|
8301
8529
|
" \xB7 ",
|
|
8302
|
-
/* @__PURE__ */
|
|
8530
|
+
/* @__PURE__ */ jsx14(NoNetworkIcon, { size: 11 }),
|
|
8303
8531
|
" ",
|
|
8304
8532
|
L.htmlNoNetwork
|
|
8305
8533
|
] }) : L.htmlSourceNote })
|
|
8306
8534
|
] })
|
|
8307
8535
|
] }),
|
|
8308
8536
|
actions: canFrame ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
8309
|
-
/* @__PURE__ */
|
|
8537
|
+
/* @__PURE__ */ jsx14(
|
|
8310
8538
|
Seg,
|
|
8311
8539
|
{
|
|
8312
8540
|
label: L.htmlFrameTitle,
|
|
8313
8541
|
value: showing,
|
|
8314
8542
|
onChange: setView,
|
|
8315
8543
|
options: [
|
|
8316
|
-
{ value: "preview", label: L.preview, icon: /* @__PURE__ */
|
|
8317
|
-
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */
|
|
8544
|
+
{ value: "preview", label: L.preview, icon: /* @__PURE__ */ jsx14(EyeIcon, { size: 13 }) },
|
|
8545
|
+
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */ jsx14(CodeIcon, { size: 13 }) }
|
|
8318
8546
|
]
|
|
8319
8547
|
}
|
|
8320
8548
|
),
|
|
8321
|
-
/* @__PURE__ */
|
|
8549
|
+
/* @__PURE__ */ jsx14(
|
|
8322
8550
|
"button",
|
|
8323
8551
|
{
|
|
8324
8552
|
type: "button",
|
|
@@ -8328,13 +8556,13 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
8328
8556
|
"aria-pressed": tall,
|
|
8329
8557
|
disabled: showing !== "preview",
|
|
8330
8558
|
onClick: () => setTall((t) => !t),
|
|
8331
|
-
children: /* @__PURE__ */
|
|
8559
|
+
children: /* @__PURE__ */ jsx14(ExpandIcon, { size: 15 })
|
|
8332
8560
|
}
|
|
8333
8561
|
)
|
|
8334
8562
|
] }) : void 0,
|
|
8335
8563
|
footer: /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
8336
|
-
/* @__PURE__ */
|
|
8337
|
-
/* @__PURE__ */
|
|
8564
|
+
/* @__PURE__ */ jsx14(FileIcon, { size: 11 }),
|
|
8565
|
+
/* @__PURE__ */ jsx14("code", { children: written.path }),
|
|
8338
8566
|
/* @__PURE__ */ jsxs11("span", { className: "awr-frame__footmeta", children: [
|
|
8339
8567
|
"\xB7 ",
|
|
8340
8568
|
L.bytes(file.size),
|
|
@@ -8345,8 +8573,8 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
8345
8573
|
] })
|
|
8346
8574
|
] }),
|
|
8347
8575
|
children: showing === "source" ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
8348
|
-
tooLarge && options ? /* @__PURE__ */
|
|
8349
|
-
/* @__PURE__ */
|
|
8576
|
+
tooLarge && options ? /* @__PURE__ */ jsx14("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
|
|
8577
|
+
/* @__PURE__ */ jsx14(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
|
|
8350
8578
|
] }) : void 0
|
|
8351
8579
|
}
|
|
8352
8580
|
);
|
|
@@ -8354,8 +8582,8 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
8354
8582
|
var ImagePreview = ({ written, vfs, onClose, L }) => {
|
|
8355
8583
|
const url = useFileUrl(vfs, written.path, written.mediaType.toLowerCase().split(";")[0].trim());
|
|
8356
8584
|
return /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
|
|
8357
|
-
/* @__PURE__ */
|
|
8358
|
-
/* @__PURE__ */
|
|
8585
|
+
/* @__PURE__ */ jsx14(FileViewHead, { written, kind: "image", onClose, L }),
|
|
8586
|
+
/* @__PURE__ */ jsx14("div", { className: "awr-fileview__image", children: url ? /* @__PURE__ */ jsx14("img", { src: url, alt: fileNameOf2(written.path) }) : null })
|
|
8359
8587
|
] });
|
|
8360
8588
|
};
|
|
8361
8589
|
var FileViewHead = ({
|
|
@@ -8365,14 +8593,14 @@ var FileViewHead = ({
|
|
|
8365
8593
|
L,
|
|
8366
8594
|
children
|
|
8367
8595
|
}) => /* @__PURE__ */ jsxs11("div", { className: "awr-fileview__head", children: [
|
|
8368
|
-
/* @__PURE__ */
|
|
8596
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-fileview__name", title: written.path, children: fileNameOf2(written.path) }),
|
|
8369
8597
|
/* @__PURE__ */ jsxs11("span", { className: "awr-fileview__kind", children: [
|
|
8370
8598
|
"\xB7 ",
|
|
8371
8599
|
L.fileKinds[kind]
|
|
8372
8600
|
] }),
|
|
8373
8601
|
/* @__PURE__ */ jsxs11("span", { className: "awr-fileview__actions", children: [
|
|
8374
8602
|
children,
|
|
8375
|
-
/* @__PURE__ */
|
|
8603
|
+
/* @__PURE__ */ jsx14(
|
|
8376
8604
|
"button",
|
|
8377
8605
|
{
|
|
8378
8606
|
type: "button",
|
|
@@ -8380,7 +8608,7 @@ var FileViewHead = ({
|
|
|
8380
8608
|
"aria-label": L.closePreview,
|
|
8381
8609
|
title: L.closePreview,
|
|
8382
8610
|
onClick: onClose,
|
|
8383
|
-
children: /* @__PURE__ */
|
|
8611
|
+
children: /* @__PURE__ */ jsx14(XIcon, { size: 14 })
|
|
8384
8612
|
}
|
|
8385
8613
|
)
|
|
8386
8614
|
] })
|
|
@@ -8394,8 +8622,8 @@ var TextPreview = ({
|
|
|
8394
8622
|
onClose,
|
|
8395
8623
|
L
|
|
8396
8624
|
}) => {
|
|
8397
|
-
const text =
|
|
8398
|
-
const rendered =
|
|
8625
|
+
const text = useMemo9(() => textOf(file), [file]);
|
|
8626
|
+
const rendered = useMemo9(
|
|
8399
8627
|
() => renderFileContent?.(written, text.slice(0, previewChars)),
|
|
8400
8628
|
[renderFileContent, written, text, previewChars]
|
|
8401
8629
|
);
|
|
@@ -8405,7 +8633,7 @@ var TextPreview = ({
|
|
|
8405
8633
|
const showing = hasRendered ? view : "source";
|
|
8406
8634
|
const long = text.length > 1200 || text.split("\n").length > 16;
|
|
8407
8635
|
return /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
|
|
8408
|
-
/* @__PURE__ */
|
|
8636
|
+
/* @__PURE__ */ jsx14(FileViewHead, { written, kind, onClose, L, children: hasRendered && /* @__PURE__ */ jsx14(
|
|
8409
8637
|
Seg,
|
|
8410
8638
|
{
|
|
8411
8639
|
label: fileNameOf2(written.path),
|
|
@@ -8417,21 +8645,23 @@ var TextPreview = ({
|
|
|
8417
8645
|
]
|
|
8418
8646
|
}
|
|
8419
8647
|
) }),
|
|
8420
|
-
/* @__PURE__ */
|
|
8421
|
-
/* @__PURE__ */
|
|
8422
|
-
text.length > previewChars && /* @__PURE__ */
|
|
8423
|
-
] }) : /* @__PURE__ */
|
|
8424
|
-
long && /* @__PURE__ */
|
|
8648
|
+
/* @__PURE__ */ jsx14("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
8649
|
+
/* @__PURE__ */ jsx14("div", { className: "awr-fileview__rendered", children: rendered }),
|
|
8650
|
+
text.length > previewChars && /* @__PURE__ */ jsx14("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
|
|
8651
|
+
] }) : /* @__PURE__ */ jsx14(SourceView, { text, maxChars: previewChars }) }),
|
|
8652
|
+
long && /* @__PURE__ */ jsx14("div", { className: "awr-fileview__more", children: /* @__PURE__ */ jsx14("button", { type: "button", className: "awr-linkbtn", onClick: () => setAll((a) => !a), children: all ? L.fileShowLess : L.fileShowRest }) })
|
|
8425
8653
|
] });
|
|
8426
8654
|
};
|
|
8427
8655
|
var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
|
|
8428
|
-
/* @__PURE__ */
|
|
8429
|
-
/* @__PURE__ */
|
|
8656
|
+
/* @__PURE__ */ jsx14(FileViewHead, { written, kind, onClose, L }),
|
|
8657
|
+
/* @__PURE__ */ jsx14("p", { className: "awr-fileview__none", children: L.fileNoPreview })
|
|
8430
8658
|
] });
|
|
8431
8659
|
var FileChips = ({
|
|
8432
8660
|
written,
|
|
8433
8661
|
files: vfs,
|
|
8434
8662
|
showHeader = true,
|
|
8663
|
+
heading,
|
|
8664
|
+
imagesInViewer = false,
|
|
8435
8665
|
onShowFiles,
|
|
8436
8666
|
htmlPreview = {},
|
|
8437
8667
|
renderFile,
|
|
@@ -8442,7 +8672,7 @@ var FileChips = ({
|
|
|
8442
8672
|
className
|
|
8443
8673
|
}) => {
|
|
8444
8674
|
const L = useLabels(labels);
|
|
8445
|
-
const live =
|
|
8675
|
+
const live = useWorkspaceListing(vfs);
|
|
8446
8676
|
const [openPath, setOpenPath] = useState17(defaultOpen);
|
|
8447
8677
|
const [file, setFile] = useState17();
|
|
8448
8678
|
const open = written.find((f) => f.path === openPath);
|
|
@@ -8474,23 +8704,23 @@ var FileChips = ({
|
|
|
8474
8704
|
onClose: () => setOpenPath(void 0),
|
|
8475
8705
|
L
|
|
8476
8706
|
};
|
|
8477
|
-
if (kind === "html") return /* @__PURE__ */
|
|
8478
|
-
if (kind === "image") return /* @__PURE__ */
|
|
8479
|
-
if (kind === "file") return /* @__PURE__ */
|
|
8480
|
-
return /* @__PURE__ */
|
|
8707
|
+
if (kind === "html") return /* @__PURE__ */ jsx14(HtmlPreview, { ...props }, open.path);
|
|
8708
|
+
if (kind === "image") return /* @__PURE__ */ jsx14(ImagePreview, { ...props }, open.path);
|
|
8709
|
+
if (kind === "file") return /* @__PURE__ */ jsx14(NoPreview, { ...props }, open.path);
|
|
8710
|
+
return /* @__PURE__ */ jsx14(TextPreview, { ...props }, open.path);
|
|
8481
8711
|
};
|
|
8482
8712
|
return /* @__PURE__ */ jsxs11("div", { className: ["awr-msg__files", className].filter(Boolean).join(" "), children: [
|
|
8483
8713
|
showHeader && /* @__PURE__ */ jsxs11("div", { className: "awr-msg__fileshead", children: [
|
|
8484
|
-
/* @__PURE__ */
|
|
8485
|
-
/* @__PURE__ */
|
|
8486
|
-
onShowFiles && /* @__PURE__ */
|
|
8714
|
+
/* @__PURE__ */ jsx14(FileIcon, { size: 13 }),
|
|
8715
|
+
/* @__PURE__ */ jsx14("span", { children: heading ?? L.filesWritten(written.length) }),
|
|
8716
|
+
onShowFiles && /* @__PURE__ */ jsx14("button", { type: "button", className: "awr-linkbtn", onClick: onShowFiles, children: L.showInFiles })
|
|
8487
8717
|
] }),
|
|
8488
|
-
/* @__PURE__ */
|
|
8718
|
+
/* @__PURE__ */ jsx14("ul", { className: "awr-filechips", children: written.map((w) => {
|
|
8489
8719
|
const info = live.files.find((f) => f.path === w.path);
|
|
8490
8720
|
const gone = Boolean(vfs) && !live.loading && !info;
|
|
8491
8721
|
const usable = Boolean(vfs) && !gone;
|
|
8492
8722
|
const isOpen = openPath === w.path && usable;
|
|
8493
|
-
const chip = /* @__PURE__ */
|
|
8723
|
+
const chip = /* @__PURE__ */ jsx14(
|
|
8494
8724
|
FileChip,
|
|
8495
8725
|
{
|
|
8496
8726
|
written: w,
|
|
@@ -8500,10 +8730,11 @@ var FileChips = ({
|
|
|
8500
8730
|
gone,
|
|
8501
8731
|
open: isOpen,
|
|
8502
8732
|
onToggle: () => setOpenPath(isOpen ? void 0 : w.path),
|
|
8733
|
+
viewer: imagesInViewer,
|
|
8503
8734
|
labels
|
|
8504
8735
|
}
|
|
8505
8736
|
);
|
|
8506
|
-
return /* @__PURE__ */
|
|
8737
|
+
return /* @__PURE__ */ jsx14("li", { className: "awr-filechips__item", children: renderFile ? renderFile(w, chip) : chip }, w.path);
|
|
8507
8738
|
}) }),
|
|
8508
8739
|
preview()
|
|
8509
8740
|
] });
|
|
@@ -8516,9 +8747,12 @@ var FileChip = ({
|
|
|
8516
8747
|
gone = false,
|
|
8517
8748
|
open = false,
|
|
8518
8749
|
onToggle,
|
|
8750
|
+
viewer = false,
|
|
8519
8751
|
labels
|
|
8520
8752
|
}) => {
|
|
8521
8753
|
const L = useLabels(labels);
|
|
8754
|
+
const viewerOn = useImageViewerOn();
|
|
8755
|
+
const thumbRef = useRef13(null);
|
|
8522
8756
|
const kind = fileKindOf(written.path, mediaType);
|
|
8523
8757
|
const name = fileNameOf2(written.path);
|
|
8524
8758
|
const Icon = KIND_ICON[kind];
|
|
@@ -8528,19 +8762,40 @@ var FileChip = ({
|
|
|
8528
8762
|
kind === "image" ? mediaType.toLowerCase().split(";")[0].trim() : void 0
|
|
8529
8763
|
);
|
|
8530
8764
|
const meta = gone ? L.fileGone : [L.fileKinds[kind], L.bytes(bytes), written.by ? L.fileBy(written.by.name) : ""].filter(Boolean).join(" \xB7 ");
|
|
8765
|
+
const inViewer = viewer && viewerOn && kind === "image" && Boolean(thumb) && !gone;
|
|
8531
8766
|
return /* @__PURE__ */ jsxs11(
|
|
8532
8767
|
"div",
|
|
8533
8768
|
{
|
|
8534
8769
|
className: `awr-filechip${open ? " is-open" : ""}${gone ? " is-gone" : ""}`,
|
|
8535
8770
|
title: written.path,
|
|
8536
8771
|
children: [
|
|
8537
|
-
/* @__PURE__ */
|
|
8772
|
+
/* @__PURE__ */ jsx14("span", { ref: thumbRef, className: "awr-filechip__thumb", children: inViewer && thumb ? /* @__PURE__ */ jsx14(
|
|
8773
|
+
ImageThumb,
|
|
8774
|
+
{
|
|
8775
|
+
src: thumb,
|
|
8776
|
+
name: written.path,
|
|
8777
|
+
alt: name,
|
|
8778
|
+
className: "awr-filechip__imgbtn",
|
|
8779
|
+
labels
|
|
8780
|
+
}
|
|
8781
|
+
) : thumb ? /* @__PURE__ */ jsx14("img", { src: thumb, alt: "" }) : /* @__PURE__ */ jsx14(Icon, { size: 16 }) }),
|
|
8538
8782
|
/* @__PURE__ */ jsxs11("span", { className: "awr-filechip__text", children: [
|
|
8539
|
-
/* @__PURE__ */
|
|
8540
|
-
/* @__PURE__ */
|
|
8783
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-filechip__name", children: name }),
|
|
8784
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-filechip__meta", children: meta })
|
|
8541
8785
|
] }),
|
|
8542
8786
|
vfs && /* @__PURE__ */ jsxs11("span", { className: "awr-filechip__actions", children: [
|
|
8543
|
-
|
|
8787
|
+
inViewer ? /* @__PURE__ */ jsx14(
|
|
8788
|
+
"button",
|
|
8789
|
+
{
|
|
8790
|
+
type: "button",
|
|
8791
|
+
className: "awr-iconbtn",
|
|
8792
|
+
"aria-label": L.imageOpen(name),
|
|
8793
|
+
"aria-haspopup": "dialog",
|
|
8794
|
+
title: L.preview,
|
|
8795
|
+
onClick: () => thumbRef.current?.querySelector("button")?.click(),
|
|
8796
|
+
children: /* @__PURE__ */ jsx14(EyeIcon, { size: 15 })
|
|
8797
|
+
}
|
|
8798
|
+
) : onToggle && /* @__PURE__ */ jsx14(
|
|
8544
8799
|
"button",
|
|
8545
8800
|
{
|
|
8546
8801
|
type: "button",
|
|
@@ -8549,10 +8804,10 @@ var FileChip = ({
|
|
|
8549
8804
|
title: open ? L.closePreview : L.preview,
|
|
8550
8805
|
"aria-expanded": open,
|
|
8551
8806
|
onClick: onToggle,
|
|
8552
|
-
children: open ? /* @__PURE__ */
|
|
8807
|
+
children: open ? /* @__PURE__ */ jsx14(ChevronUpIcon, { size: 15 }) : /* @__PURE__ */ jsx14(EyeIcon, { size: 15 })
|
|
8553
8808
|
}
|
|
8554
8809
|
),
|
|
8555
|
-
/* @__PURE__ */
|
|
8810
|
+
/* @__PURE__ */ jsx14(
|
|
8556
8811
|
"button",
|
|
8557
8812
|
{
|
|
8558
8813
|
type: "button",
|
|
@@ -8560,7 +8815,7 @@ var FileChip = ({
|
|
|
8560
8815
|
"aria-label": L.fileDownload(name),
|
|
8561
8816
|
title: L.download,
|
|
8562
8817
|
onClick: () => void downloadFile(vfs, written.path),
|
|
8563
|
-
children: /* @__PURE__ */
|
|
8818
|
+
children: /* @__PURE__ */ jsx14(DownloadIcon, { size: 15 })
|
|
8564
8819
|
}
|
|
8565
8820
|
)
|
|
8566
8821
|
] })
|
|
@@ -8568,13 +8823,66 @@ var FileChip = ({
|
|
|
8568
8823
|
}
|
|
8569
8824
|
);
|
|
8570
8825
|
};
|
|
8826
|
+
var NamedFileChips = (props) => {
|
|
8827
|
+
const named = useMemo9(() => pathsNamedIn(props.text), [props.text]);
|
|
8828
|
+
if (!props.files || named.length === 0) return null;
|
|
8829
|
+
return /* @__PURE__ */ jsx14(NamedFileChipsOf, { ...props, named, files: props.files });
|
|
8830
|
+
};
|
|
8831
|
+
var NamedFileChipsOf = ({
|
|
8832
|
+
named,
|
|
8833
|
+
files: vfs,
|
|
8834
|
+
exclude,
|
|
8835
|
+
max = NAMED_FILES_MAX,
|
|
8836
|
+
showHeader = true,
|
|
8837
|
+
htmlPreview,
|
|
8838
|
+
renderFile,
|
|
8839
|
+
renderFileContent,
|
|
8840
|
+
labels,
|
|
8841
|
+
className
|
|
8842
|
+
}) => {
|
|
8843
|
+
const L = useLabels(labels);
|
|
8844
|
+
const live = useWorkspaceListing(vfs);
|
|
8845
|
+
const shown = useRef13(/* @__PURE__ */ new Map());
|
|
8846
|
+
const excludedKey = [...exclude ?? []].join("\n");
|
|
8847
|
+
const excluded = useMemo9(() => excludedKey ? excludedKey.split("\n") : [], [excludedKey]);
|
|
8848
|
+
const list = useMemo9(() => {
|
|
8849
|
+
if (live.loading) return [];
|
|
8850
|
+
const byPath = new Map(live.files.map((f) => [f.path, f]));
|
|
8851
|
+
const paths = namedFilesOf(named, (p) => byPath.has(p) || shown.current.has(p), {
|
|
8852
|
+
exclude: excluded,
|
|
8853
|
+
max
|
|
8854
|
+
});
|
|
8855
|
+
return paths.map((path) => {
|
|
8856
|
+
const info = byPath.get(path);
|
|
8857
|
+
const view = info ? { path, mediaType: info.mimeType, bytes: info.size, writes: 0 } : shown.current.get(path);
|
|
8858
|
+
shown.current.set(path, view);
|
|
8859
|
+
return view;
|
|
8860
|
+
});
|
|
8861
|
+
}, [live.loading, live.files, named, excluded, max]);
|
|
8862
|
+
if (list.length === 0) return null;
|
|
8863
|
+
return /* @__PURE__ */ jsx14(
|
|
8864
|
+
FileChips,
|
|
8865
|
+
{
|
|
8866
|
+
className: ["awr-msg__files--named", className].filter(Boolean).join(" "),
|
|
8867
|
+
written: list,
|
|
8868
|
+
files: vfs,
|
|
8869
|
+
showHeader,
|
|
8870
|
+
heading: L.filesNamed(list.length),
|
|
8871
|
+
imagesInViewer: true,
|
|
8872
|
+
htmlPreview,
|
|
8873
|
+
renderFile,
|
|
8874
|
+
renderFileContent,
|
|
8875
|
+
labels
|
|
8876
|
+
}
|
|
8877
|
+
);
|
|
8878
|
+
};
|
|
8571
8879
|
|
|
8572
8880
|
// src/components/StepList.tsx
|
|
8573
8881
|
import { Fragment as Fragment11 } from "react";
|
|
8574
8882
|
|
|
8575
8883
|
// src/components/SubagentTree.tsx
|
|
8576
8884
|
import { Fragment as Fragment10, useEffect as useEffect18, useState as useState18 } from "react";
|
|
8577
|
-
import { jsx as
|
|
8885
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
8578
8886
|
var useElapsed = (startedAt, running) => {
|
|
8579
8887
|
const [now, setNow] = useState18(void 0);
|
|
8580
8888
|
useEffect18(() => {
|
|
@@ -8612,12 +8920,12 @@ var SubagentRow = ({
|
|
|
8612
8920
|
"data-depth": sub.depth,
|
|
8613
8921
|
children: [
|
|
8614
8922
|
/* @__PURE__ */ jsxs12("div", { className: "awr-subagent__head", children: [
|
|
8615
|
-
/* @__PURE__ */
|
|
8616
|
-
/* @__PURE__ */
|
|
8617
|
-
sub.dynamic && role && /* @__PURE__ */
|
|
8618
|
-
sub.profile && /* @__PURE__ */
|
|
8619
|
-
/* @__PURE__ */
|
|
8620
|
-
running && onStop && /* @__PURE__ */
|
|
8923
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ jsx15(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ jsx15(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ jsx15(StopIcon, { size: 13 }) : /* @__PURE__ */ jsx15(AlertIcon, { size: 13 }) }),
|
|
8924
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
|
|
8925
|
+
sub.dynamic && role && /* @__PURE__ */ jsx15("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
|
|
8926
|
+
sub.profile && /* @__PURE__ */ jsx15("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
8927
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
8928
|
+
running && onStop && /* @__PURE__ */ jsx15(
|
|
8621
8929
|
"button",
|
|
8622
8930
|
{
|
|
8623
8931
|
type: "button",
|
|
@@ -8625,16 +8933,16 @@ var SubagentRow = ({
|
|
|
8625
8933
|
"aria-label": L.stopSubagent,
|
|
8626
8934
|
title: L.stopSubagent,
|
|
8627
8935
|
onClick: () => onStop(sub.id),
|
|
8628
|
-
children: /* @__PURE__ */
|
|
8936
|
+
children: /* @__PURE__ */ jsx15(StopIcon, { size: 12 })
|
|
8629
8937
|
}
|
|
8630
8938
|
)
|
|
8631
8939
|
] }),
|
|
8632
8940
|
showUsage && /* @__PURE__ */ jsxs12("div", { className: "awr-subagent__meta", children: [
|
|
8633
|
-
/* @__PURE__ */
|
|
8634
|
-
meta.map((part, i) => /* @__PURE__ */
|
|
8941
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
|
|
8942
|
+
meta.map((part, i) => /* @__PURE__ */ jsx15("span", { className: "awr-subagent__metaitem", children: part }, i))
|
|
8635
8943
|
] }),
|
|
8636
|
-
showTools && sub.tools && /* @__PURE__ */
|
|
8637
|
-
/* @__PURE__ */
|
|
8944
|
+
showTools && sub.tools && /* @__PURE__ */ jsx15("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
|
|
8945
|
+
/* @__PURE__ */ jsx15("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)}` : ""}` }),
|
|
8638
8946
|
children
|
|
8639
8947
|
]
|
|
8640
8948
|
}
|
|
@@ -8650,12 +8958,12 @@ var SubagentTree = ({
|
|
|
8650
8958
|
className
|
|
8651
8959
|
}) => {
|
|
8652
8960
|
if (subagents.length === 0) return null;
|
|
8653
|
-
const branch = (nodes, nested) => /* @__PURE__ */
|
|
8961
|
+
const branch = (nodes, nested) => /* @__PURE__ */ jsx15(
|
|
8654
8962
|
"ul",
|
|
8655
8963
|
{
|
|
8656
8964
|
className: ["awr-subagents", nested ? "awr-subagents--nested" : className].filter(Boolean).join(" "),
|
|
8657
8965
|
children: nodes.map((node) => {
|
|
8658
|
-
const row = /* @__PURE__ */
|
|
8966
|
+
const row = /* @__PURE__ */ jsx15(
|
|
8659
8967
|
SubagentRow,
|
|
8660
8968
|
{
|
|
8661
8969
|
sub: node,
|
|
@@ -8667,7 +8975,7 @@ var SubagentTree = ({
|
|
|
8667
8975
|
},
|
|
8668
8976
|
node.id
|
|
8669
8977
|
);
|
|
8670
|
-
return renderSubagent ? /* @__PURE__ */
|
|
8978
|
+
return renderSubagent ? /* @__PURE__ */ jsx15(Fragment10, { children: renderSubagent(node, row) }, node.id) : row;
|
|
8671
8979
|
})
|
|
8672
8980
|
}
|
|
8673
8981
|
);
|
|
@@ -8675,7 +8983,7 @@ var SubagentTree = ({
|
|
|
8675
8983
|
};
|
|
8676
8984
|
|
|
8677
8985
|
// src/components/StepList.tsx
|
|
8678
|
-
import { jsx as
|
|
8986
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
8679
8987
|
var WEB_SEARCH = "web_search";
|
|
8680
8988
|
var ToolCallRow = ({
|
|
8681
8989
|
call,
|
|
@@ -8699,21 +9007,21 @@ var ToolCallRow = ({
|
|
|
8699
9007
|
className: `awr-tool awr-tool--${state}${showTiers && call.attempt !== void 0 ? " awr-tool--earlier" : ""}`,
|
|
8700
9008
|
children: [
|
|
8701
9009
|
/* @__PURE__ */ jsxs13("div", { className: "awr-tool__row", children: [
|
|
8702
|
-
/* @__PURE__ */
|
|
8703
|
-
/* @__PURE__ */
|
|
8704
|
-
previewValue(call.input) && /* @__PURE__ */
|
|
8705
|
-
call.status === "calling" && /* @__PURE__ */
|
|
8706
|
-
call.status === "done" && call.ok === false && /* @__PURE__ */
|
|
8707
|
-
showTiers && call.replayed && /* @__PURE__ */
|
|
8708
|
-
showTiers && call.attempt !== void 0 && /* @__PURE__ */
|
|
9010
|
+
/* @__PURE__ */ jsx16(ToolIcon, { size: 13, className: "awr-tool__icon" }),
|
|
9011
|
+
/* @__PURE__ */ jsx16("code", { className: "awr-tool__name", children: call.name }),
|
|
9012
|
+
previewValue(call.input) && /* @__PURE__ */ jsx16("span", { className: "awr-tool__args", children: previewValue(call.input) }),
|
|
9013
|
+
call.status === "calling" && /* @__PURE__ */ jsx16(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
9014
|
+
call.status === "done" && call.ok === false && /* @__PURE__ */ jsx16("span", { className: "awr-tool__badge", children: L.failed }),
|
|
9015
|
+
showTiers && call.replayed && /* @__PURE__ */ jsx16("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
|
|
9016
|
+
showTiers && call.attempt !== void 0 && /* @__PURE__ */ jsx16("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
|
|
8709
9017
|
call.app && /* @__PURE__ */ jsxs13("span", { className: "awr-tool__tag awr-tool__tag--app", "data-app": call.app, children: [
|
|
8710
|
-
/* @__PURE__ */
|
|
9018
|
+
/* @__PURE__ */ jsx16(AppIcon, { size: 10 }),
|
|
8711
9019
|
" ",
|
|
8712
9020
|
L.appTag
|
|
8713
9021
|
] }),
|
|
8714
|
-
showUsage && cost && /* @__PURE__ */
|
|
9022
|
+
showUsage && cost && /* @__PURE__ */ jsx16("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
|
|
8715
9023
|
] }),
|
|
8716
|
-
images.length > 0 && /* @__PURE__ */
|
|
9024
|
+
images.length > 0 && /* @__PURE__ */ jsx16("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ jsx16(
|
|
8717
9025
|
ImageThumb,
|
|
8718
9026
|
{
|
|
8719
9027
|
src,
|
|
@@ -8726,14 +9034,14 @@ var ToolCallRow = ({
|
|
|
8726
9034
|
)) }),
|
|
8727
9035
|
search && /* @__PURE__ */ jsxs13("div", { className: "awr-search", children: [
|
|
8728
9036
|
/* @__PURE__ */ jsxs13("p", { className: "awr-search__query", children: [
|
|
8729
|
-
/* @__PURE__ */
|
|
9037
|
+
/* @__PURE__ */ jsx16(GlobeIcon, { size: 12 }),
|
|
8730
9038
|
" ",
|
|
8731
9039
|
L.searchQuery,
|
|
8732
9040
|
" ",
|
|
8733
|
-
/* @__PURE__ */
|
|
9041
|
+
/* @__PURE__ */ jsx16("q", { children: search.query })
|
|
8734
9042
|
] }),
|
|
8735
|
-
search.results.length > 0 ? /* @__PURE__ */
|
|
8736
|
-
/* @__PURE__ */
|
|
9043
|
+
search.results.length > 0 ? /* @__PURE__ */ jsx16("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ jsxs13("li", { className: "awr-search__result", children: [
|
|
9044
|
+
/* @__PURE__ */ jsx16(
|
|
8737
9045
|
"a",
|
|
8738
9046
|
{
|
|
8739
9047
|
className: "awr-search__title",
|
|
@@ -8748,9 +9056,9 @@ var ToolCallRow = ({
|
|
|
8748
9056
|
r.host,
|
|
8749
9057
|
r.date ? ` \xB7 ${r.date}` : ""
|
|
8750
9058
|
] }),
|
|
8751
|
-
r.snippet && /* @__PURE__ */
|
|
8752
|
-
] }, i)) }) : /* @__PURE__ */
|
|
8753
|
-
(search.filtered > 0 || search.truncated) && /* @__PURE__ */
|
|
9059
|
+
r.snippet && /* @__PURE__ */ jsx16("p", { className: "awr-search__snippet", children: r.snippet })
|
|
9060
|
+
] }, i)) }) : /* @__PURE__ */ jsx16("p", { className: "awr-search__note", children: L.searchNoResults }),
|
|
9061
|
+
(search.filtered > 0 || search.truncated) && /* @__PURE__ */ jsx16("p", { className: "awr-search__note", children: [
|
|
8754
9062
|
search.filtered > 0 ? L.searchFiltered(search.filtered) : "",
|
|
8755
9063
|
search.truncated ? L.searchTruncated : ""
|
|
8756
9064
|
].filter(Boolean).join(" \xB7 ") })
|
|
@@ -8765,10 +9073,10 @@ var UserNoteRow = ({
|
|
|
8765
9073
|
}) => {
|
|
8766
9074
|
const L = useLabels(labels);
|
|
8767
9075
|
return /* @__PURE__ */ jsxs13("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
8768
|
-
/* @__PURE__ */
|
|
8769
|
-
/* @__PURE__ */
|
|
8770
|
-
/* @__PURE__ */
|
|
8771
|
-
note.origin === "another-tab" && /* @__PURE__ */
|
|
9076
|
+
/* @__PURE__ */ jsx16(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
9077
|
+
/* @__PURE__ */ jsx16("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
9078
|
+
/* @__PURE__ */ jsx16("q", { className: "awr-note__text", children: note.text }),
|
|
9079
|
+
note.origin === "another-tab" && /* @__PURE__ */ jsx16("span", { className: "awr-note__origin", children: L.fromAnotherTab })
|
|
8772
9080
|
] });
|
|
8773
9081
|
};
|
|
8774
9082
|
var decisionNote = (d, L) => {
|
|
@@ -8801,12 +9109,12 @@ var StepItem = ({
|
|
|
8801
9109
|
L
|
|
8802
9110
|
}) => /* @__PURE__ */ jsxs13("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
|
|
8803
9111
|
/* @__PURE__ */ jsxs13("div", { className: "awr-step__head", children: [
|
|
8804
|
-
/* @__PURE__ */
|
|
8805
|
-
/* @__PURE__ */
|
|
8806
|
-
/* @__PURE__ */
|
|
9112
|
+
/* @__PURE__ */ jsx16("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ jsx16(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ jsx16(AlertIcon, { size: 14 }) : /* @__PURE__ */ jsx16(CheckIcon, { size: 14 }) }),
|
|
9113
|
+
/* @__PURE__ */ jsx16("span", { className: "awr-step__index", children: `${step.index}/${step.total}` }),
|
|
9114
|
+
/* @__PURE__ */ jsx16("span", { className: "awr-step__desc", children: step.step.description })
|
|
8807
9115
|
] }),
|
|
8808
9116
|
showTiers && step.tier && /* @__PURE__ */ jsxs13("div", { className: "awr-step__meta", children: [
|
|
8809
|
-
/* @__PURE__ */
|
|
9117
|
+
/* @__PURE__ */ jsx16(
|
|
8810
9118
|
"span",
|
|
8811
9119
|
{
|
|
8812
9120
|
className: `awr-step__tier awr-step__tier--${step.tier}`,
|
|
@@ -8814,29 +9122,29 @@ var StepItem = ({
|
|
|
8814
9122
|
children: L.tierNames[step.tier]
|
|
8815
9123
|
}
|
|
8816
9124
|
),
|
|
8817
|
-
step.model && /* @__PURE__ */
|
|
9125
|
+
step.model && /* @__PURE__ */ jsx16("span", { className: "awr-step__model", children: step.model })
|
|
8818
9126
|
] }),
|
|
8819
9127
|
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ jsxs13("div", { className: "awr-step__escalated", children: [
|
|
8820
9128
|
/* @__PURE__ */ jsxs13("p", { className: "awr-step__escalated-line", children: [
|
|
8821
|
-
/* @__PURE__ */
|
|
8822
|
-
/* @__PURE__ */
|
|
9129
|
+
/* @__PURE__ */ jsx16(ArrowUpIcon, { size: 12 }),
|
|
9130
|
+
/* @__PURE__ */ jsx16("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
|
|
8823
9131
|
] }),
|
|
8824
9132
|
e.text?.trim() && /* @__PURE__ */ jsxs13("details", { className: "awr-step__attempt", children: [
|
|
8825
|
-
/* @__PURE__ */
|
|
8826
|
-
/* @__PURE__ */
|
|
9133
|
+
/* @__PURE__ */ jsx16("summary", { children: L.escalatedAttemptText }),
|
|
9134
|
+
/* @__PURE__ */ jsx16("p", { className: "awr-step__text", children: e.text.trim() })
|
|
8827
9135
|
] })
|
|
8828
9136
|
] }, i)),
|
|
8829
9137
|
showThoughts && step.reasoning.trim() && /* @__PURE__ */ jsxs13("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
|
|
8830
9138
|
/* @__PURE__ */ jsxs13("summary", { children: [
|
|
8831
|
-
/* @__PURE__ */
|
|
9139
|
+
/* @__PURE__ */ jsx16(BrainIcon, { size: 13 }),
|
|
8832
9140
|
" ",
|
|
8833
9141
|
L.stepThoughts
|
|
8834
9142
|
] }),
|
|
8835
|
-
/* @__PURE__ */
|
|
9143
|
+
/* @__PURE__ */ jsx16("p", { className: "awr-thought__text", children: step.reasoning.trim() })
|
|
8836
9144
|
] }),
|
|
8837
|
-
step.text.trim() && /* @__PURE__ */
|
|
8838
|
-
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */
|
|
8839
|
-
const row = /* @__PURE__ */
|
|
9145
|
+
step.text.trim() && /* @__PURE__ */ jsx16("p", { className: "awr-step__text", children: step.text.trim() }),
|
|
9146
|
+
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ jsx16("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
|
|
9147
|
+
const row = /* @__PURE__ */ jsx16(
|
|
8840
9148
|
ToolCallRow,
|
|
8841
9149
|
{
|
|
8842
9150
|
call,
|
|
@@ -8846,15 +9154,15 @@ var StepItem = ({
|
|
|
8846
9154
|
},
|
|
8847
9155
|
i
|
|
8848
9156
|
);
|
|
8849
|
-
return renderToolCall ? /* @__PURE__ */
|
|
9157
|
+
return renderToolCall ? /* @__PURE__ */ jsx16(Fragment11, { children: renderToolCall(call, row) }, i) : row;
|
|
8850
9158
|
}) }),
|
|
8851
|
-
approvals.length > 0 && /* @__PURE__ */
|
|
8852
|
-
/* @__PURE__ */
|
|
8853
|
-
/* @__PURE__ */
|
|
8854
|
-
/* @__PURE__ */
|
|
8855
|
-
a.subagent && /* @__PURE__ */
|
|
9159
|
+
approvals.length > 0 && /* @__PURE__ */ jsx16("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ jsxs13("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
|
|
9160
|
+
/* @__PURE__ */ jsx16(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
|
|
9161
|
+
/* @__PURE__ */ jsx16("code", { className: "awr-tool__name", children: a.name }),
|
|
9162
|
+
/* @__PURE__ */ jsx16("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
|
|
9163
|
+
a.subagent && /* @__PURE__ */ jsx16("span", { className: "awr-tool__tag", children: L.subagentHelper })
|
|
8856
9164
|
] }, a.id)) }),
|
|
8857
|
-
showSubagents && /* @__PURE__ */
|
|
9165
|
+
showSubagents && /* @__PURE__ */ jsx16(
|
|
8858
9166
|
SubagentTree,
|
|
8859
9167
|
{
|
|
8860
9168
|
subagents,
|
|
@@ -8863,14 +9171,14 @@ var StepItem = ({
|
|
|
8863
9171
|
renderSubagent
|
|
8864
9172
|
}
|
|
8865
9173
|
),
|
|
8866
|
-
notes.length > 0 && /* @__PURE__ */
|
|
8867
|
-
step.blocked && step.summary && /* @__PURE__ */
|
|
9174
|
+
notes.length > 0 && /* @__PURE__ */ jsx16("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ jsx16(UserNoteRow, { note: n }, n.id)) }),
|
|
9175
|
+
step.blocked && step.summary && /* @__PURE__ */ jsx16("p", { className: "awr-step__blocked", children: step.summary }),
|
|
8868
9176
|
showReplanFailed && step.replanFailed && /* @__PURE__ */ jsxs13("p", { className: "awr-step__warn", title: step.replanFailed, children: [
|
|
8869
|
-
/* @__PURE__ */
|
|
9177
|
+
/* @__PURE__ */ jsx16(AlertIcon, { size: 12 }),
|
|
8870
9178
|
" ",
|
|
8871
9179
|
L.replanFailed
|
|
8872
9180
|
] }),
|
|
8873
|
-
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */
|
|
9181
|
+
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ jsx16(
|
|
8874
9182
|
"p",
|
|
8875
9183
|
{
|
|
8876
9184
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -8906,7 +9214,7 @@ var StepList = ({
|
|
|
8906
9214
|
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
8907
9215
|
const loose = showSubagents ? subagents.filter((s) => !s.stepId || !known.has(s.stepId)) : [];
|
|
8908
9216
|
return /* @__PURE__ */ jsxs13("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
8909
|
-
steps.map((step) => /* @__PURE__ */
|
|
9217
|
+
steps.map((step) => /* @__PURE__ */ jsx16(
|
|
8910
9218
|
StepItem,
|
|
8911
9219
|
{
|
|
8912
9220
|
step,
|
|
@@ -8928,7 +9236,7 @@ var StepList = ({
|
|
|
8928
9236
|
},
|
|
8929
9237
|
step.id
|
|
8930
9238
|
)),
|
|
8931
|
-
loose.length > 0 && /* @__PURE__ */
|
|
9239
|
+
loose.length > 0 && /* @__PURE__ */ jsx16("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ jsx16(
|
|
8932
9240
|
SubagentTree,
|
|
8933
9241
|
{
|
|
8934
9242
|
subagents: loose,
|
|
@@ -8937,12 +9245,12 @@ var StepList = ({
|
|
|
8937
9245
|
renderSubagent
|
|
8938
9246
|
}
|
|
8939
9247
|
) }),
|
|
8940
|
-
atEnd.length > 0 && /* @__PURE__ */
|
|
9248
|
+
atEnd.length > 0 && /* @__PURE__ */ jsx16("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ jsx16("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ jsx16(UserNoteRow, { note: n }, n.id)) }) })
|
|
8941
9249
|
] });
|
|
8942
9250
|
};
|
|
8943
9251
|
|
|
8944
9252
|
// src/components/MessageList.tsx
|
|
8945
|
-
import { Fragment as Fragment12, jsx as
|
|
9253
|
+
import { Fragment as Fragment12, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
8946
9254
|
var usageLine = (usage, durationMs) => {
|
|
8947
9255
|
const parts = [];
|
|
8948
9256
|
if (usage && usage.totalTokens > 0) {
|
|
@@ -8977,7 +9285,7 @@ var AttachedAudio = ({
|
|
|
8977
9285
|
const length = lengthOf(a.durationMs);
|
|
8978
9286
|
const said = length !== void 0 ? L.audioDuration(formatClock(length)) : void 0;
|
|
8979
9287
|
return url ? /* @__PURE__ */ jsxs14("span", { className: "awr-media awr-media--audio awr-msg__audio", title: a.path ?? a.name, children: [
|
|
8980
|
-
/* @__PURE__ */
|
|
9288
|
+
/* @__PURE__ */ jsx17(
|
|
8981
9289
|
"audio",
|
|
8982
9290
|
{
|
|
8983
9291
|
className: "awr-media__audio",
|
|
@@ -8988,9 +9296,9 @@ var AttachedAudio = ({
|
|
|
8988
9296
|
onLoadedMetadata: (e) => settleAudioDuration(e.currentTarget)
|
|
8989
9297
|
}
|
|
8990
9298
|
),
|
|
8991
|
-
said && /* @__PURE__ */
|
|
9299
|
+
said && /* @__PURE__ */ jsx17("span", { className: "awr-msg__audiolen", "aria-hidden": "true", children: said })
|
|
8992
9300
|
] }) : /* @__PURE__ */ jsxs14("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
|
|
8993
|
-
/* @__PURE__ */
|
|
9301
|
+
/* @__PURE__ */ jsx17(WaveIcon, { size: 13 }),
|
|
8994
9302
|
" ",
|
|
8995
9303
|
a.name,
|
|
8996
9304
|
said ? ` \xB7 ${said}` : ""
|
|
@@ -9000,7 +9308,7 @@ var AttachmentView = ({
|
|
|
9000
9308
|
attachment: a,
|
|
9001
9309
|
files,
|
|
9002
9310
|
labels
|
|
9003
|
-
}) => mediaFamilyOf(a.mediaType) === "audio" ? /* @__PURE__ */
|
|
9311
|
+
}) => mediaFamilyOf(a.mediaType) === "audio" ? /* @__PURE__ */ jsx17(AttachedAudio, { attachment: a, files, labels }) : a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ jsx17(
|
|
9004
9312
|
ImageThumb,
|
|
9005
9313
|
{
|
|
9006
9314
|
src: a.dataUrl,
|
|
@@ -9010,7 +9318,7 @@ var AttachmentView = ({
|
|
|
9010
9318
|
title: a.path ?? a.name
|
|
9011
9319
|
}
|
|
9012
9320
|
) : /* @__PURE__ */ jsxs14("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
|
|
9013
|
-
/* @__PURE__ */
|
|
9321
|
+
/* @__PURE__ */ jsx17(FileIcon, { size: 13 }),
|
|
9014
9322
|
" ",
|
|
9015
9323
|
a.name
|
|
9016
9324
|
] });
|
|
@@ -9051,6 +9359,7 @@ var MessageList = ({
|
|
|
9051
9359
|
showSubagents = true,
|
|
9052
9360
|
showMedia = true,
|
|
9053
9361
|
showFileChips = true,
|
|
9362
|
+
showNamedFiles = showFileChips,
|
|
9054
9363
|
files,
|
|
9055
9364
|
htmlPreview,
|
|
9056
9365
|
onShowFiles,
|
|
@@ -9078,128 +9387,157 @@ var MessageList = ({
|
|
|
9078
9387
|
const L = useLabels(labels);
|
|
9079
9388
|
const reader = useReadAloud(readAloud?.speak, readAloud?.lang);
|
|
9080
9389
|
if (messages.length === 0) {
|
|
9081
|
-
return empty ? /* @__PURE__ */
|
|
9390
|
+
return empty ? /* @__PURE__ */ jsx17("div", { className: "awr-messages__empty", children: empty }) : null;
|
|
9082
9391
|
}
|
|
9083
|
-
return /* @__PURE__ */
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
"div",
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9392
|
+
return /* @__PURE__ */ jsx17(
|
|
9393
|
+
TranscriptContext,
|
|
9394
|
+
{
|
|
9395
|
+
imageViewer,
|
|
9396
|
+
renderImageViewer,
|
|
9397
|
+
files: showFileChips || showNamedFiles ? files : void 0,
|
|
9398
|
+
children: /* @__PURE__ */ jsx17("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
|
|
9399
|
+
const steps = m.steps ?? [];
|
|
9400
|
+
const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
|
|
9401
|
+
const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
|
|
9402
|
+
const cards = showToolCards && renderToolCard && m.role === "assistant" ? toolCardsOf(m, renderToolCard) : [];
|
|
9403
|
+
const node = /* @__PURE__ */ jsx17(
|
|
9404
|
+
"div",
|
|
9405
|
+
{
|
|
9406
|
+
className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
|
|
9407
|
+
children: /* @__PURE__ */ jsxs14("div", { className: "awr-msg__col", children: [
|
|
9408
|
+
m.role === "assistant" && hasActivity && /* @__PURE__ */ jsxs14("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
|
|
9409
|
+
/* @__PURE__ */ jsx17("summary", { className: "awr-activity__summary", children: activitySummary(
|
|
9410
|
+
m,
|
|
9411
|
+
showToolCalls,
|
|
9412
|
+
showLearned,
|
|
9413
|
+
showTiers,
|
|
9414
|
+
showFileChips,
|
|
9415
|
+
L,
|
|
9416
|
+
showApps && Boolean(renderApp)
|
|
9417
|
+
) }),
|
|
9418
|
+
m.pending && liveExtra,
|
|
9419
|
+
/* @__PURE__ */ jsx17(
|
|
9420
|
+
StepList,
|
|
9421
|
+
{
|
|
9422
|
+
steps,
|
|
9423
|
+
subagents: m.subagents,
|
|
9424
|
+
approvals: m.approvals,
|
|
9425
|
+
notes: m.notes,
|
|
9426
|
+
showNotes,
|
|
9427
|
+
onStopSubagent: m.pending ? onStopSubagent : void 0,
|
|
9428
|
+
showToolCalls,
|
|
9429
|
+
showUsage,
|
|
9430
|
+
showThoughts,
|
|
9431
|
+
showTiers,
|
|
9432
|
+
showReplanFailed,
|
|
9433
|
+
showDecisions,
|
|
9434
|
+
showSearchResults,
|
|
9435
|
+
showSubagents,
|
|
9436
|
+
renderToolCall,
|
|
9437
|
+
renderSubagent,
|
|
9438
|
+
labels
|
|
9439
|
+
}
|
|
9440
|
+
),
|
|
9441
|
+
showLearned && m.fetches?.length ? /* @__PURE__ */ jsx17("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ jsxs14(
|
|
9442
|
+
"li",
|
|
9443
|
+
{
|
|
9444
|
+
className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
|
|
9445
|
+
children: [
|
|
9446
|
+
/* @__PURE__ */ jsx17(GlobeIcon, { size: 12 }),
|
|
9447
|
+
" ",
|
|
9448
|
+
/* @__PURE__ */ jsx17("code", { children: f.url }),
|
|
9449
|
+
" ",
|
|
9450
|
+
/* @__PURE__ */ jsx17("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
|
|
9451
|
+
]
|
|
9452
|
+
},
|
|
9453
|
+
i
|
|
9454
|
+
)) }) : null,
|
|
9455
|
+
showLearned && m.learned?.length ? /* @__PURE__ */ jsxs14("p", { className: "awr-learned", children: [
|
|
9456
|
+
/* @__PURE__ */ jsx17(BookIcon, { size: 12 }),
|
|
9134
9457
|
" ",
|
|
9135
|
-
|
|
9136
|
-
]
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
/* @__PURE__ */
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9458
|
+
L.learnedNow(m.learned.join(", "))
|
|
9459
|
+
] }) : null,
|
|
9460
|
+
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ jsxs14("details", { className: "awr-thought", children: [
|
|
9461
|
+
/* @__PURE__ */ jsxs14("summary", { children: [
|
|
9462
|
+
/* @__PURE__ */ jsx17(BrainIcon, { size: 13 }),
|
|
9463
|
+
" ",
|
|
9464
|
+
L.answerThoughts
|
|
9465
|
+
] }),
|
|
9466
|
+
/* @__PURE__ */ jsx17("p", { className: "awr-thought__text", children: m.reasoning.trim() })
|
|
9467
|
+
] })
|
|
9468
|
+
] }),
|
|
9469
|
+
cards.length > 0 && /* @__PURE__ */ jsx17("div", { className: "awr-msg__cards", children: cards.map((card) => /* @__PURE__ */ jsx17("div", { className: "awr-msg__card", children: card.node }, card.key)) }),
|
|
9470
|
+
showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ jsx17("div", { className: "awr-msg__apps", children: m.apps.map((app) => /* @__PURE__ */ jsx17("div", { className: "awr-msg__app", children: renderApp(app, m) }, app.id)) }) : null,
|
|
9471
|
+
showMedia && m.transcripts?.length ? /* @__PURE__ */ jsx17("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ jsx17(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
|
|
9472
|
+
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ jsxs14("div", { className: "awr-msg__bubble", children: [
|
|
9473
|
+
m.content ? renderContent ? renderContent(m) : m.content : m.stopped && !m.pending ? /* @__PURE__ */ jsx17("span", { className: "awr-msg__stopped", children: L.answerStopped }) : null,
|
|
9474
|
+
m.pending && !m.content && /* @__PURE__ */ jsx17(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
|
|
9150
9475
|
] }),
|
|
9151
|
-
|
|
9476
|
+
readAloud && m.role === "assistant" && m.content && !m.pending && !m.error && /* @__PURE__ */ jsx17(
|
|
9477
|
+
ReadAloudControl,
|
|
9478
|
+
{
|
|
9479
|
+
id: m.id,
|
|
9480
|
+
text: () => readAloud.textOf ? readAloud.textOf(m) : speakableText(m.content, { code: L.readAloudCode }),
|
|
9481
|
+
reader,
|
|
9482
|
+
labels: L
|
|
9483
|
+
}
|
|
9484
|
+
),
|
|
9485
|
+
showMedia && m.media?.length ? /* @__PURE__ */ jsx17("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
9486
|
+
const built = /* @__PURE__ */ jsx17(GeneratedMedia, { media: item, files, labels }, i);
|
|
9487
|
+
return renderMedia ? /* @__PURE__ */ jsx17("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
9488
|
+
}) }) : null,
|
|
9489
|
+
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ jsx17(
|
|
9490
|
+
FileChips,
|
|
9491
|
+
{
|
|
9492
|
+
written: m.writtenFiles,
|
|
9493
|
+
files,
|
|
9494
|
+
htmlPreview,
|
|
9495
|
+
onShowFiles,
|
|
9496
|
+
renderFile: renderFile ? (f, fallback) => renderFile(f, m, fallback) : void 0,
|
|
9497
|
+
renderFileContent,
|
|
9498
|
+
labels
|
|
9499
|
+
}
|
|
9500
|
+
) : null,
|
|
9501
|
+
showNamedFiles && files && m.role === "assistant" && !m.pending && m.content ? /* @__PURE__ */ jsx17(
|
|
9502
|
+
NamedFileChips,
|
|
9503
|
+
{
|
|
9504
|
+
text: m.content,
|
|
9505
|
+
files,
|
|
9506
|
+
exclude: [
|
|
9507
|
+
...showFileChips ? (m.writtenFiles ?? []).map((f) => f.path) : [],
|
|
9508
|
+
...showMedia ? (m.media ?? []).map((x) => x.path) : []
|
|
9509
|
+
],
|
|
9510
|
+
htmlPreview,
|
|
9511
|
+
renderFile: renderFile ? (f, fallback) => renderFile(f, m, fallback) : void 0,
|
|
9512
|
+
renderFileContent,
|
|
9513
|
+
labels
|
|
9514
|
+
}
|
|
9515
|
+
) : null,
|
|
9516
|
+
m.attachments?.length ? /* @__PURE__ */ jsx17(
|
|
9517
|
+
"div",
|
|
9518
|
+
{
|
|
9519
|
+
className: "awr-msg__attachments",
|
|
9520
|
+
role: "group",
|
|
9521
|
+
"aria-label": m.content.trim() ? L.attachments : attachmentsText(m.attachments, { voiceMessage: L.voiceMessage }),
|
|
9522
|
+
children: m.attachments.map((a, i) => /* @__PURE__ */ jsx17("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ jsx17(AttachmentView, { attachment: a, files, labels }) }, i))
|
|
9523
|
+
}
|
|
9524
|
+
) : null,
|
|
9525
|
+
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ jsx17("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
9152
9526
|
] })
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
] }),
|
|
9161
|
-
readAloud && m.role === "assistant" && m.content && !m.pending && !m.error && /* @__PURE__ */ jsx16(
|
|
9162
|
-
ReadAloudControl,
|
|
9163
|
-
{
|
|
9164
|
-
id: m.id,
|
|
9165
|
-
text: () => readAloud.textOf ? readAloud.textOf(m) : speakableText(m.content, { code: L.readAloudCode }),
|
|
9166
|
-
reader,
|
|
9167
|
-
labels: L
|
|
9168
|
-
}
|
|
9169
|
-
),
|
|
9170
|
-
showMedia && m.media?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
9171
|
-
const built = /* @__PURE__ */ jsx16(GeneratedMedia, { media: item, files, labels }, i);
|
|
9172
|
-
return renderMedia ? /* @__PURE__ */ jsx16("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
9173
|
-
}) }) : null,
|
|
9174
|
-
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ jsx16(
|
|
9175
|
-
FileChips,
|
|
9176
|
-
{
|
|
9177
|
-
written: m.writtenFiles,
|
|
9178
|
-
files,
|
|
9179
|
-
htmlPreview,
|
|
9180
|
-
onShowFiles,
|
|
9181
|
-
renderFile: renderFile ? (f, fallback) => renderFile(f, m, fallback) : void 0,
|
|
9182
|
-
renderFileContent,
|
|
9183
|
-
labels
|
|
9184
|
-
}
|
|
9185
|
-
) : null,
|
|
9186
|
-
m.attachments?.length ? /* @__PURE__ */ jsx16(
|
|
9187
|
-
"div",
|
|
9188
|
-
{
|
|
9189
|
-
className: "awr-msg__attachments",
|
|
9190
|
-
role: "group",
|
|
9191
|
-
"aria-label": m.content.trim() ? L.attachments : attachmentsText(m.attachments, { voiceMessage: L.voiceMessage }),
|
|
9192
|
-
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))
|
|
9193
|
-
}
|
|
9194
|
-
) : null,
|
|
9195
|
-
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ jsx16("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
9196
|
-
] })
|
|
9197
|
-
},
|
|
9198
|
-
m.id
|
|
9199
|
-
);
|
|
9200
|
-
return renderMessage ? /* @__PURE__ */ jsx16("div", { children: renderMessage(m, node) }, m.id) : node;
|
|
9201
|
-
}) }) });
|
|
9527
|
+
},
|
|
9528
|
+
m.id
|
|
9529
|
+
);
|
|
9530
|
+
return renderMessage ? /* @__PURE__ */ jsx17("div", { children: renderMessage(m, node) }, m.id) : node;
|
|
9531
|
+
}) })
|
|
9532
|
+
}
|
|
9533
|
+
);
|
|
9202
9534
|
};
|
|
9535
|
+
var TranscriptContext = ({
|
|
9536
|
+
imageViewer,
|
|
9537
|
+
renderImageViewer,
|
|
9538
|
+
files,
|
|
9539
|
+
children
|
|
9540
|
+
}) => /* @__PURE__ */ jsx17(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ jsx17(WorkspaceListingProvider, { files, children }) });
|
|
9203
9541
|
var ReadAloudControl = ({
|
|
9204
9542
|
id,
|
|
9205
9543
|
text,
|
|
@@ -9217,14 +9555,14 @@ var ReadAloudControl = ({
|
|
|
9217
9555
|
onClick: () => reader.start(id, text()),
|
|
9218
9556
|
"aria-label": L.readAloud,
|
|
9219
9557
|
children: [
|
|
9220
|
-
/* @__PURE__ */
|
|
9558
|
+
/* @__PURE__ */ jsx17(SpeakerIcon, { size: 14 }),
|
|
9221
9559
|
" ",
|
|
9222
9560
|
L.readAloud
|
|
9223
9561
|
]
|
|
9224
9562
|
}
|
|
9225
9563
|
) : /* @__PURE__ */ jsxs14(Fragment12, { children: [
|
|
9226
9564
|
reader.state === "loading" ? /* @__PURE__ */ jsxs14("span", { className: "awr-readaloud__status", role: "status", children: [
|
|
9227
|
-
/* @__PURE__ */
|
|
9565
|
+
/* @__PURE__ */ jsx17(SpinnerIcon, { size: 14 }),
|
|
9228
9566
|
" ",
|
|
9229
9567
|
L.readAloudLoading
|
|
9230
9568
|
] }) : reader.state === "paused" ? /* @__PURE__ */ jsxs14(
|
|
@@ -9235,7 +9573,7 @@ var ReadAloudControl = ({
|
|
|
9235
9573
|
onClick: reader.resume,
|
|
9236
9574
|
"aria-label": L.readAloudResume,
|
|
9237
9575
|
children: [
|
|
9238
|
-
/* @__PURE__ */
|
|
9576
|
+
/* @__PURE__ */ jsx17(PlayIcon, { size: 14 }),
|
|
9239
9577
|
" ",
|
|
9240
9578
|
L.readAloudResume
|
|
9241
9579
|
]
|
|
@@ -9248,7 +9586,7 @@ var ReadAloudControl = ({
|
|
|
9248
9586
|
onClick: reader.pause,
|
|
9249
9587
|
"aria-label": L.readAloudPause,
|
|
9250
9588
|
children: [
|
|
9251
|
-
/* @__PURE__ */
|
|
9589
|
+
/* @__PURE__ */ jsx17(PauseIcon, { size: 14 }),
|
|
9252
9590
|
" ",
|
|
9253
9591
|
L.readAloudPause
|
|
9254
9592
|
]
|
|
@@ -9262,36 +9600,36 @@ var ReadAloudControl = ({
|
|
|
9262
9600
|
onClick: reader.stop,
|
|
9263
9601
|
"aria-label": L.readAloudStop,
|
|
9264
9602
|
children: [
|
|
9265
|
-
/* @__PURE__ */
|
|
9603
|
+
/* @__PURE__ */ jsx17(StopIcon, { size: 14 }),
|
|
9266
9604
|
" ",
|
|
9267
9605
|
L.readAloudStop
|
|
9268
9606
|
]
|
|
9269
9607
|
}
|
|
9270
9608
|
)
|
|
9271
9609
|
] }),
|
|
9272
|
-
failed && /* @__PURE__ */
|
|
9610
|
+
failed && /* @__PURE__ */ jsx17("span", { className: "awr-readaloud__error", role: "alert", children: failed.message ?? L.readAloudFailed })
|
|
9273
9611
|
] });
|
|
9274
9612
|
};
|
|
9275
9613
|
|
|
9276
9614
|
// src/components/ModelLoadBar.tsx
|
|
9277
|
-
import { jsx as
|
|
9615
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
9278
9616
|
var ModelLoadBar = ({ load, className }) => {
|
|
9279
9617
|
const pct = Math.round(Math.max(0, Math.min(1, load.progress)) * 100);
|
|
9280
9618
|
return /* @__PURE__ */ jsxs15("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
|
|
9281
9619
|
/* @__PURE__ */ jsxs15("div", { className: "awr-modelload__head", children: [
|
|
9282
|
-
/* @__PURE__ */
|
|
9620
|
+
/* @__PURE__ */ jsx18("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
|
|
9283
9621
|
/* @__PURE__ */ jsxs15("span", { className: "awr-modelload__pct", children: [
|
|
9284
9622
|
pct,
|
|
9285
9623
|
"%"
|
|
9286
9624
|
] })
|
|
9287
9625
|
] }),
|
|
9288
|
-
/* @__PURE__ */
|
|
9626
|
+
/* @__PURE__ */ jsx18("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ jsx18("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
|
|
9289
9627
|
] });
|
|
9290
9628
|
};
|
|
9291
9629
|
|
|
9292
9630
|
// src/components/QuestionPrompt.tsx
|
|
9293
|
-
import { useEffect as useEffect19, useId as useId2, useRef as
|
|
9294
|
-
import { jsx as
|
|
9631
|
+
import { useEffect as useEffect19, useId as useId2, useRef as useRef14, useState as useState19 } from "react";
|
|
9632
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
9295
9633
|
var useNow2 = (active) => {
|
|
9296
9634
|
const [now, setNow] = useState19(() => Date.now());
|
|
9297
9635
|
useEffect19(() => {
|
|
@@ -9304,7 +9642,7 @@ var useNow2 = (active) => {
|
|
|
9304
9642
|
};
|
|
9305
9643
|
var Expiry2 = ({ expiresAt, L }) => {
|
|
9306
9644
|
const now = useNow2(true);
|
|
9307
|
-
return /* @__PURE__ */
|
|
9645
|
+
return /* @__PURE__ */ jsx19("p", { className: "awr-question__expiry", children: L.questionExpiresIn(formatCountdown(expiresAt - now)) });
|
|
9308
9646
|
};
|
|
9309
9647
|
var reasonText2 = (q, L) => {
|
|
9310
9648
|
const key = q.reason ?? q.status;
|
|
@@ -9329,8 +9667,8 @@ var QuestionCard = ({
|
|
|
9329
9667
|
const [picked, setPicked] = useState19([]);
|
|
9330
9668
|
const [otherOpen, setOtherOpen] = useState19(false);
|
|
9331
9669
|
const [otherText, setOtherText] = useState19("");
|
|
9332
|
-
const otherField =
|
|
9333
|
-
const otherButton =
|
|
9670
|
+
const otherField = useRef14(null);
|
|
9671
|
+
const otherButton = useRef14(null);
|
|
9334
9672
|
useEffect19(() => {
|
|
9335
9673
|
if (otherOpen) otherField.current?.focus();
|
|
9336
9674
|
}, [otherOpen]);
|
|
@@ -9369,13 +9707,13 @@ var QuestionCard = ({
|
|
|
9369
9707
|
onKeyDown,
|
|
9370
9708
|
children: [
|
|
9371
9709
|
/* @__PURE__ */ jsxs16("div", { className: "awr-question__head", children: [
|
|
9372
|
-
/* @__PURE__ */
|
|
9373
|
-
/* @__PURE__ */
|
|
9374
|
-
total > 1 && /* @__PURE__ */
|
|
9710
|
+
/* @__PURE__ */ jsx19(QuestionIcon, { size: 16, className: "awr-question__icon" }),
|
|
9711
|
+
/* @__PURE__ */ jsx19("span", { className: "awr-question__lead", role: "alert", children: leadOf(helper, L) }),
|
|
9712
|
+
total > 1 && /* @__PURE__ */ jsx19("span", { className: "awr-question__count", children: L.questionCount(index, total) })
|
|
9375
9713
|
] }),
|
|
9376
|
-
/* @__PURE__ */
|
|
9377
|
-
q.multiple && /* @__PURE__ */
|
|
9378
|
-
/* @__PURE__ */
|
|
9714
|
+
/* @__PURE__ */ jsx19("p", { className: "awr-question__text", id: textId, children: q.question }),
|
|
9715
|
+
q.multiple && /* @__PURE__ */ jsx19("p", { className: "awr-question__hint", children: L.questionSeveral }),
|
|
9716
|
+
/* @__PURE__ */ jsx19("div", { className: "awr-question__options", children: q.options.map((o, i) => {
|
|
9379
9717
|
const on = picked.includes(o.label);
|
|
9380
9718
|
return /* @__PURE__ */ jsxs16(
|
|
9381
9719
|
"button",
|
|
@@ -9387,21 +9725,21 @@ var QuestionCard = ({
|
|
|
9387
9725
|
"aria-keyshortcuts": numberKeys && i < 9 ? String(i + 1) : void 0,
|
|
9388
9726
|
onClick: () => pick(o.label),
|
|
9389
9727
|
children: [
|
|
9390
|
-
numberKeys && i < 9 && /* @__PURE__ */
|
|
9728
|
+
numberKeys && i < 9 && /* @__PURE__ */ jsx19("span", { className: "awr-question__key", "aria-hidden": "true", children: i + 1 }),
|
|
9391
9729
|
/* @__PURE__ */ jsxs16("span", { className: "awr-question__body", children: [
|
|
9392
|
-
/* @__PURE__ */
|
|
9393
|
-
o.description && /* @__PURE__ */
|
|
9730
|
+
/* @__PURE__ */ jsx19("span", { className: "awr-question__label", children: o.label }),
|
|
9731
|
+
o.description && /* @__PURE__ */ jsx19("span", { className: "awr-question__desc", children: o.description })
|
|
9394
9732
|
] }),
|
|
9395
|
-
q.multiple && /* @__PURE__ */
|
|
9733
|
+
q.multiple && /* @__PURE__ */ jsx19("span", { className: "awr-question__mark", "aria-hidden": "true", children: on && /* @__PURE__ */ jsx19(CheckIcon, { size: 14 }) })
|
|
9396
9734
|
]
|
|
9397
9735
|
},
|
|
9398
9736
|
o.label
|
|
9399
9737
|
);
|
|
9400
9738
|
}) }),
|
|
9401
9739
|
q.allowOther && otherOpen && /* @__PURE__ */ jsxs16("form", { className: "awr-question__other", onSubmit: sendOther, children: [
|
|
9402
|
-
/* @__PURE__ */
|
|
9740
|
+
/* @__PURE__ */ jsx19("label", { className: "awr-question__otherlabel", htmlFor: otherId, children: L.questionOtherLabel }),
|
|
9403
9741
|
/* @__PURE__ */ jsxs16("div", { className: "awr-question__otherrow", children: [
|
|
9404
|
-
/* @__PURE__ */
|
|
9742
|
+
/* @__PURE__ */ jsx19(
|
|
9405
9743
|
"input",
|
|
9406
9744
|
{
|
|
9407
9745
|
ref: otherField,
|
|
@@ -9420,11 +9758,11 @@ var QuestionCard = ({
|
|
|
9420
9758
|
}
|
|
9421
9759
|
}
|
|
9422
9760
|
),
|
|
9423
|
-
/* @__PURE__ */
|
|
9761
|
+
/* @__PURE__ */ jsx19("button", { type: "submit", className: "awr-btn awr-btn--primary", disabled: !other, children: L.questionSend })
|
|
9424
9762
|
] })
|
|
9425
9763
|
] }),
|
|
9426
9764
|
/* @__PURE__ */ jsxs16("div", { className: "awr-question__actions", children: [
|
|
9427
|
-
q.multiple && !otherOpen && /* @__PURE__ */
|
|
9765
|
+
q.multiple && !otherOpen && /* @__PURE__ */ jsx19(
|
|
9428
9766
|
"button",
|
|
9429
9767
|
{
|
|
9430
9768
|
type: "button",
|
|
@@ -9434,7 +9772,7 @@ var QuestionCard = ({
|
|
|
9434
9772
|
children: L.questionSend
|
|
9435
9773
|
}
|
|
9436
9774
|
),
|
|
9437
|
-
q.allowOther && /* @__PURE__ */
|
|
9775
|
+
q.allowOther && /* @__PURE__ */ jsx19(
|
|
9438
9776
|
"button",
|
|
9439
9777
|
{
|
|
9440
9778
|
ref: otherButton,
|
|
@@ -9446,7 +9784,7 @@ var QuestionCard = ({
|
|
|
9446
9784
|
children: L.questionOther
|
|
9447
9785
|
}
|
|
9448
9786
|
),
|
|
9449
|
-
/* @__PURE__ */
|
|
9787
|
+
/* @__PURE__ */ jsx19(
|
|
9450
9788
|
"button",
|
|
9451
9789
|
{
|
|
9452
9790
|
type: "button",
|
|
@@ -9456,7 +9794,7 @@ var QuestionCard = ({
|
|
|
9456
9794
|
}
|
|
9457
9795
|
)
|
|
9458
9796
|
] }),
|
|
9459
|
-
showExpiry && q.expiresAt !== void 0 && /* @__PURE__ */
|
|
9797
|
+
showExpiry && q.expiresAt !== void 0 && /* @__PURE__ */ jsx19(Expiry2, { expiresAt: q.expiresAt, L })
|
|
9460
9798
|
]
|
|
9461
9799
|
}
|
|
9462
9800
|
);
|
|
@@ -9472,15 +9810,15 @@ var RemoteQuestion = ({ view, L }) => {
|
|
|
9472
9810
|
"data-question": view.id,
|
|
9473
9811
|
children: [
|
|
9474
9812
|
/* @__PURE__ */ jsxs16("div", { className: "awr-question__head", children: [
|
|
9475
|
-
/* @__PURE__ */
|
|
9476
|
-
/* @__PURE__ */
|
|
9813
|
+
/* @__PURE__ */ jsx19(QuestionIcon, { size: 16, className: "awr-question__icon" }),
|
|
9814
|
+
/* @__PURE__ */ jsx19("span", { className: "awr-question__lead", children: leadOf(view.subagent, L) })
|
|
9477
9815
|
] }),
|
|
9478
|
-
/* @__PURE__ */
|
|
9479
|
-
/* @__PURE__ */
|
|
9480
|
-
/* @__PURE__ */
|
|
9481
|
-
o.description && /* @__PURE__ */
|
|
9816
|
+
/* @__PURE__ */ jsx19("p", { className: "awr-question__text", id: textId, children: view.question }),
|
|
9817
|
+
/* @__PURE__ */ jsx19("ul", { className: "awr-question__list", children: view.options.map((o) => /* @__PURE__ */ jsxs16("li", { children: [
|
|
9818
|
+
/* @__PURE__ */ jsx19("span", { className: "awr-question__label", children: o.label }),
|
|
9819
|
+
o.description && /* @__PURE__ */ jsx19("span", { className: "awr-question__desc", children: o.description })
|
|
9482
9820
|
] }, o.label)) }),
|
|
9483
|
-
/* @__PURE__ */
|
|
9821
|
+
/* @__PURE__ */ jsx19("p", { className: "awr-question__remote", role: "status", children: L.questionRemote })
|
|
9484
9822
|
]
|
|
9485
9823
|
}
|
|
9486
9824
|
);
|
|
@@ -9509,7 +9847,7 @@ var QuestionPrompt = ({
|
|
|
9509
9847
|
let card = null;
|
|
9510
9848
|
if (current) {
|
|
9511
9849
|
const answer = (a) => onAnswer(current.id, a);
|
|
9512
|
-
const builtIn = /* @__PURE__ */
|
|
9850
|
+
const builtIn = /* @__PURE__ */ jsx19(
|
|
9513
9851
|
QuestionCard,
|
|
9514
9852
|
{
|
|
9515
9853
|
question: current,
|
|
@@ -9534,13 +9872,13 @@ var QuestionPrompt = ({
|
|
|
9534
9872
|
role: "status",
|
|
9535
9873
|
"data-reason": o.reason ?? o.status,
|
|
9536
9874
|
children: [
|
|
9537
|
-
/* @__PURE__ */
|
|
9875
|
+
/* @__PURE__ */ jsx19(AlertIcon, { size: 14, className: "awr-question-outcome__icon" }),
|
|
9538
9876
|
/* @__PURE__ */ jsxs16("span", { className: "awr-question-outcome__text", children: [
|
|
9539
9877
|
L.questionAutomatic(reasonText2(o, L)),
|
|
9540
9878
|
" ",
|
|
9541
|
-
/* @__PURE__ */
|
|
9879
|
+
/* @__PURE__ */ jsx19("q", { className: "awr-question-outcome__question", children: o.question })
|
|
9542
9880
|
] }),
|
|
9543
|
-
/* @__PURE__ */
|
|
9881
|
+
/* @__PURE__ */ jsx19(
|
|
9544
9882
|
"button",
|
|
9545
9883
|
{
|
|
9546
9884
|
type: "button",
|
|
@@ -9548,20 +9886,20 @@ var QuestionPrompt = ({
|
|
|
9548
9886
|
"aria-label": L.questionDismiss,
|
|
9549
9887
|
title: L.questionDismiss,
|
|
9550
9888
|
onClick: () => setDismissed((d) => new Set(d).add(o.id)),
|
|
9551
|
-
children: /* @__PURE__ */
|
|
9889
|
+
children: /* @__PURE__ */ jsx19(XIcon, { size: 14 })
|
|
9552
9890
|
}
|
|
9553
9891
|
)
|
|
9554
9892
|
]
|
|
9555
9893
|
},
|
|
9556
9894
|
o.id
|
|
9557
9895
|
)),
|
|
9558
|
-
remote.map((o) => /* @__PURE__ */
|
|
9896
|
+
remote.map((o) => /* @__PURE__ */ jsx19(RemoteQuestion, { view: o, L }, o.id)),
|
|
9559
9897
|
card
|
|
9560
9898
|
] });
|
|
9561
9899
|
};
|
|
9562
9900
|
|
|
9563
9901
|
// src/components/ToolApprovalPrompt.tsx
|
|
9564
|
-
import { jsx as
|
|
9902
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
9565
9903
|
var SkillConsentCard = ({
|
|
9566
9904
|
approval: a,
|
|
9567
9905
|
skill,
|
|
@@ -9580,27 +9918,27 @@ var SkillConsentCard = ({
|
|
|
9580
9918
|
"data-subagent": helper?.id,
|
|
9581
9919
|
children: [
|
|
9582
9920
|
/* @__PURE__ */ jsxs17("div", { className: "awr-approval__head", children: [
|
|
9583
|
-
/* @__PURE__ */
|
|
9584
|
-
/* @__PURE__ */
|
|
9921
|
+
/* @__PURE__ */ jsx20(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
9922
|
+
/* @__PURE__ */ jsx20("span", { children: L.skillConsentLead(skill.server, skill.skill) })
|
|
9585
9923
|
] }),
|
|
9586
|
-
skill.description && /* @__PURE__ */
|
|
9924
|
+
skill.description && /* @__PURE__ */ jsx20("p", { className: "awr-approval__quote", children: skill.description }),
|
|
9587
9925
|
/* @__PURE__ */ jsxs17("p", { className: "awr-approval__skillmeta", children: [
|
|
9588
|
-
/* @__PURE__ */
|
|
9589
|
-
/* @__PURE__ */
|
|
9926
|
+
/* @__PURE__ */ jsx20("code", { className: "awr-tool__name", children: skill.name }),
|
|
9927
|
+
/* @__PURE__ */ jsx20("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
|
|
9590
9928
|
] }),
|
|
9591
|
-
skill.byUri && /* @__PURE__ */
|
|
9592
|
-
skill.nestedIn && /* @__PURE__ */
|
|
9593
|
-
skill.dynamic && /* @__PURE__ */
|
|
9594
|
-
skill.dynamic && skill.noFileListing && /* @__PURE__ */
|
|
9929
|
+
skill.byUri && /* @__PURE__ */ jsx20("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
|
|
9930
|
+
skill.nestedIn && /* @__PURE__ */ jsx20("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
|
|
9931
|
+
skill.dynamic && /* @__PURE__ */ jsx20("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
|
|
9932
|
+
skill.dynamic && skill.noFileListing && /* @__PURE__ */ jsx20("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
|
|
9595
9933
|
showPreview && skill.body !== void 0 && /* @__PURE__ */ jsxs17("details", { className: "awr-approval__preview", children: [
|
|
9596
|
-
/* @__PURE__ */
|
|
9597
|
-
/* @__PURE__ */
|
|
9598
|
-
skill.files.length > 0 && /* @__PURE__ */
|
|
9934
|
+
/* @__PURE__ */ jsx20("summary", { children: L.skillConsentPreview }),
|
|
9935
|
+
/* @__PURE__ */ jsx20("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
|
|
9936
|
+
skill.files.length > 0 && /* @__PURE__ */ jsx20("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
|
|
9599
9937
|
] }),
|
|
9600
|
-
/* @__PURE__ */
|
|
9938
|
+
/* @__PURE__ */ jsx20("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
|
|
9601
9939
|
/* @__PURE__ */ jsxs17("div", { className: "awr-approval__actions", children: [
|
|
9602
|
-
/* @__PURE__ */
|
|
9603
|
-
allowRemember && /* @__PURE__ */
|
|
9940
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
|
|
9941
|
+
allowRemember && /* @__PURE__ */ jsx20(
|
|
9604
9942
|
"button",
|
|
9605
9943
|
{
|
|
9606
9944
|
type: "button",
|
|
@@ -9609,7 +9947,7 @@ var SkillConsentCard = ({
|
|
|
9609
9947
|
children: L.skillConsentAlways
|
|
9610
9948
|
}
|
|
9611
9949
|
),
|
|
9612
|
-
/* @__PURE__ */
|
|
9950
|
+
/* @__PURE__ */ jsx20(
|
|
9613
9951
|
"button",
|
|
9614
9952
|
{
|
|
9615
9953
|
type: "button",
|
|
@@ -9635,9 +9973,9 @@ var ToolApprovalPrompt = ({
|
|
|
9635
9973
|
}) => {
|
|
9636
9974
|
const L = useLabels(labels);
|
|
9637
9975
|
if (approvals.length === 0) return null;
|
|
9638
|
-
return /* @__PURE__ */
|
|
9976
|
+
return /* @__PURE__ */ jsx20("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
|
|
9639
9977
|
if (a.skill) {
|
|
9640
|
-
const card2 = /* @__PURE__ */
|
|
9978
|
+
const card2 = /* @__PURE__ */ jsx20(
|
|
9641
9979
|
SkillConsentCard,
|
|
9642
9980
|
{
|
|
9643
9981
|
approval: a,
|
|
@@ -9651,7 +9989,7 @@ var ToolApprovalPrompt = ({
|
|
|
9651
9989
|
},
|
|
9652
9990
|
a.id
|
|
9653
9991
|
);
|
|
9654
|
-
return renderApproval ? /* @__PURE__ */
|
|
9992
|
+
return renderApproval ? /* @__PURE__ */ jsx20("div", { children: renderApproval(a, card2) }, a.id) : card2;
|
|
9655
9993
|
}
|
|
9656
9994
|
const helper = showHelper ? a.subagent : void 0;
|
|
9657
9995
|
const app = a.app;
|
|
@@ -9663,21 +10001,21 @@ var ToolApprovalPrompt = ({
|
|
|
9663
10001
|
"data-app-server": app?.server,
|
|
9664
10002
|
children: [
|
|
9665
10003
|
/* @__PURE__ */ jsxs17("div", { className: "awr-approval__head", children: [
|
|
9666
|
-
/* @__PURE__ */
|
|
10004
|
+
/* @__PURE__ */ jsx20(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
9667
10005
|
/* @__PURE__ */ jsxs17("span", { children: [
|
|
9668
10006
|
app ? L.approvalLeadApp(app.server) : helper ? L.approvalLeadHelper(
|
|
9669
10007
|
previewValue(helper.role ?? "", 60) || void 0,
|
|
9670
10008
|
helper.depth
|
|
9671
10009
|
) : L.approvalLead,
|
|
9672
10010
|
" ",
|
|
9673
|
-
/* @__PURE__ */
|
|
10011
|
+
/* @__PURE__ */ jsx20("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
|
|
9674
10012
|
a.readOnly && !app ? ` (${L.readOnlyTool})` : ""
|
|
9675
10013
|
] })
|
|
9676
10014
|
] }),
|
|
9677
|
-
previewValue(a.input, 300) && /* @__PURE__ */
|
|
9678
|
-
app && /* @__PURE__ */
|
|
10015
|
+
previewValue(a.input, 300) && /* @__PURE__ */ jsx20("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
|
|
10016
|
+
app && /* @__PURE__ */ jsx20("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
|
|
9679
10017
|
/* @__PURE__ */ jsxs17("div", { className: "awr-approval__actions", children: [
|
|
9680
|
-
/* @__PURE__ */
|
|
10018
|
+
/* @__PURE__ */ jsx20(
|
|
9681
10019
|
"button",
|
|
9682
10020
|
{
|
|
9683
10021
|
type: "button",
|
|
@@ -9686,7 +10024,7 @@ var ToolApprovalPrompt = ({
|
|
|
9686
10024
|
children: L.approve
|
|
9687
10025
|
}
|
|
9688
10026
|
),
|
|
9689
|
-
allowRemember && /* @__PURE__ */
|
|
10027
|
+
allowRemember && /* @__PURE__ */ jsx20(
|
|
9690
10028
|
"button",
|
|
9691
10029
|
{
|
|
9692
10030
|
type: "button",
|
|
@@ -9695,7 +10033,7 @@ var ToolApprovalPrompt = ({
|
|
|
9695
10033
|
children: L.alwaysAllow
|
|
9696
10034
|
}
|
|
9697
10035
|
),
|
|
9698
|
-
/* @__PURE__ */
|
|
10036
|
+
/* @__PURE__ */ jsx20(
|
|
9699
10037
|
"button",
|
|
9700
10038
|
{
|
|
9701
10039
|
type: "button",
|
|
@@ -9709,7 +10047,7 @@ var ToolApprovalPrompt = ({
|
|
|
9709
10047
|
},
|
|
9710
10048
|
a.id
|
|
9711
10049
|
);
|
|
9712
|
-
return renderApproval ? /* @__PURE__ */
|
|
10050
|
+
return renderApproval ? /* @__PURE__ */ jsx20("div", { children: renderApproval(a, card) }, a.id) : card;
|
|
9713
10051
|
}) });
|
|
9714
10052
|
};
|
|
9715
10053
|
|
|
@@ -9753,7 +10091,7 @@ var UsageBadge = ({
|
|
|
9753
10091
|
};
|
|
9754
10092
|
|
|
9755
10093
|
// src/components/AgentChat.tsx
|
|
9756
|
-
import { Fragment as Fragment13, jsx as
|
|
10094
|
+
import { Fragment as Fragment13, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
9757
10095
|
var usePrefersDark = () => {
|
|
9758
10096
|
const query = "(prefers-color-scheme: dark)";
|
|
9759
10097
|
const [dark, setDark] = useState20(
|
|
@@ -9770,7 +10108,7 @@ var usePrefersDark = () => {
|
|
|
9770
10108
|
};
|
|
9771
10109
|
var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
|
|
9772
10110
|
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
9773
|
-
var AgentChat = (props) => /* @__PURE__ */
|
|
10111
|
+
var AgentChat = (props) => /* @__PURE__ */ jsx21(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ jsx21(AgentChatInner, { ...props }) });
|
|
9774
10112
|
var NO_LABELS = {};
|
|
9775
10113
|
var AgentChatInner = ({
|
|
9776
10114
|
controller,
|
|
@@ -9790,6 +10128,7 @@ var AgentChatInner = ({
|
|
|
9790
10128
|
showSubagents = true,
|
|
9791
10129
|
showMedia = true,
|
|
9792
10130
|
showFileChips = true,
|
|
10131
|
+
showNamedFiles = showFileChips,
|
|
9793
10132
|
htmlPreview,
|
|
9794
10133
|
stoppableSubagents = true,
|
|
9795
10134
|
showTotalUsage = true,
|
|
@@ -9862,7 +10201,7 @@ var AgentChatInner = ({
|
|
|
9862
10201
|
labels: { voiceMessage: L.voiceMessage }
|
|
9863
10202
|
});
|
|
9864
10203
|
const chats = history ? external ?? own : void 0;
|
|
9865
|
-
const rootRef =
|
|
10204
|
+
const rootRef = useRef15(null);
|
|
9866
10205
|
const [narrow, setNarrow] = useState20(void 0);
|
|
9867
10206
|
useEffect20(() => {
|
|
9868
10207
|
const el = rootRef.current;
|
|
@@ -9903,7 +10242,7 @@ var AgentChatInner = ({
|
|
|
9903
10242
|
document.addEventListener("keydown", onKey);
|
|
9904
10243
|
return () => document.removeEventListener("keydown", onKey);
|
|
9905
10244
|
}, [overlayOpen]);
|
|
9906
|
-
const bodyRef =
|
|
10245
|
+
const bodyRef = useRef15(null);
|
|
9907
10246
|
const appHost = useMcpAppHost({
|
|
9908
10247
|
connection: mcpApps,
|
|
9909
10248
|
approve: agent.approveAppToolCall,
|
|
@@ -9936,7 +10275,7 @@ var AgentChatInner = ({
|
|
|
9936
10275
|
}
|
|
9937
10276
|
}, [agent.messages, panelApp, onAppPanel]);
|
|
9938
10277
|
const drawApp = (app, message) => {
|
|
9939
|
-
const built = panelApp?.id === app.id ? /* @__PURE__ */
|
|
10278
|
+
const built = panelApp?.id === app.id ? /* @__PURE__ */ jsx21(
|
|
9940
10279
|
McpAppLine,
|
|
9941
10280
|
{
|
|
9942
10281
|
app,
|
|
@@ -9944,7 +10283,7 @@ var AgentChatInner = ({
|
|
|
9944
10283
|
action: L.appBringBack,
|
|
9945
10284
|
onAction: () => setPanelApp(void 0)
|
|
9946
10285
|
}
|
|
9947
|
-
) : /* @__PURE__ */
|
|
10286
|
+
) : /* @__PURE__ */ jsx21(
|
|
9948
10287
|
McpAppFrame,
|
|
9949
10288
|
{
|
|
9950
10289
|
app,
|
|
@@ -9957,7 +10296,7 @@ var AgentChatInner = ({
|
|
|
9957
10296
|
);
|
|
9958
10297
|
return renderApp ? renderApp(app, message, built) : built;
|
|
9959
10298
|
};
|
|
9960
|
-
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */
|
|
10299
|
+
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ jsx21(
|
|
9961
10300
|
McpAppFrame,
|
|
9962
10301
|
{
|
|
9963
10302
|
app: panelApp,
|
|
@@ -9993,16 +10332,16 @@ var AgentChatInner = ({
|
|
|
9993
10332
|
const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
|
|
9994
10333
|
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ jsxs19(Fragment13, { children: [
|
|
9995
10334
|
agent.planThought.trim() && /* @__PURE__ */ jsxs19("details", { className: "awr-activity__plan", children: [
|
|
9996
|
-
/* @__PURE__ */
|
|
9997
|
-
/* @__PURE__ */
|
|
10335
|
+
/* @__PURE__ */ jsx21("summary", { children: L.planned }),
|
|
10336
|
+
/* @__PURE__ */ jsx21("p", { className: "awr-activity__thought", children: agent.planThought })
|
|
9998
10337
|
] }),
|
|
9999
|
-
showReplan && /* @__PURE__ */
|
|
10338
|
+
showReplan && /* @__PURE__ */ jsx21("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
|
|
10000
10339
|
replanFailedEarly && /* @__PURE__ */ jsxs19("p", { className: "awr-step__warn", title: agent.replan.error, children: [
|
|
10001
|
-
/* @__PURE__ */
|
|
10340
|
+
/* @__PURE__ */ jsx21(AlertIcon, { size: 12 }),
|
|
10002
10341
|
" ",
|
|
10003
10342
|
L.replanFailed
|
|
10004
10343
|
] }),
|
|
10005
|
-
earlyDecisions.map((d, i) => /* @__PURE__ */
|
|
10344
|
+
earlyDecisions.map((d, i) => /* @__PURE__ */ jsx21(
|
|
10006
10345
|
"p",
|
|
10007
10346
|
{
|
|
10008
10347
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -10012,7 +10351,7 @@ var AgentChatInner = ({
|
|
|
10012
10351
|
))
|
|
10013
10352
|
] }) : void 0;
|
|
10014
10353
|
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ jsxs19("div", { className: cx("awr-chat__header", classNames.header), children: [
|
|
10015
|
-
chats && /* @__PURE__ */
|
|
10354
|
+
chats && /* @__PURE__ */ jsx21(
|
|
10016
10355
|
"button",
|
|
10017
10356
|
{
|
|
10018
10357
|
type: "button",
|
|
@@ -10021,17 +10360,17 @@ var AgentChatInner = ({
|
|
|
10021
10360
|
title: L.showHistory,
|
|
10022
10361
|
"aria-pressed": historyOpen,
|
|
10023
10362
|
onClick: toggleHistory,
|
|
10024
|
-
children: /* @__PURE__ */
|
|
10363
|
+
children: /* @__PURE__ */ jsx21(HistoryIcon, { size: 16 })
|
|
10025
10364
|
}
|
|
10026
10365
|
),
|
|
10027
10366
|
slots.headerStart,
|
|
10028
|
-
/* @__PURE__ */
|
|
10367
|
+
/* @__PURE__ */ jsx21("div", { className: "awr-chat__title", children: title }),
|
|
10029
10368
|
showStatus && /* @__PURE__ */ jsxs19("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
|
|
10030
|
-
/* @__PURE__ */
|
|
10031
|
-
/* @__PURE__ */
|
|
10369
|
+
/* @__PURE__ */ jsx21("span", { className: "awr-status__dot" }),
|
|
10370
|
+
/* @__PURE__ */ jsx21("span", { className: "awr-status__text", children: L.status[agent.status] })
|
|
10032
10371
|
] }),
|
|
10033
|
-
showTotalUsage && /* @__PURE__ */
|
|
10034
|
-
files && /* @__PURE__ */
|
|
10372
|
+
showTotalUsage && /* @__PURE__ */ jsx21("span", { title: L.totalUsage, children: /* @__PURE__ */ jsx21(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
|
|
10373
|
+
files && /* @__PURE__ */ jsx21(
|
|
10035
10374
|
"button",
|
|
10036
10375
|
{
|
|
10037
10376
|
type: "button",
|
|
@@ -10040,7 +10379,7 @@ var AgentChatInner = ({
|
|
|
10040
10379
|
title: L.showFiles,
|
|
10041
10380
|
"aria-pressed": filesOpen,
|
|
10042
10381
|
onClick: toggleFiles,
|
|
10043
|
-
children: /* @__PURE__ */
|
|
10382
|
+
children: /* @__PURE__ */ jsx21(FileIcon, { size: 16 })
|
|
10044
10383
|
}
|
|
10045
10384
|
),
|
|
10046
10385
|
slots.headerEnd
|
|
@@ -10053,7 +10392,7 @@ var AgentChatInner = ({
|
|
|
10053
10392
|
style,
|
|
10054
10393
|
"data-awr-theme": theme === "auto" ? void 0 : theme,
|
|
10055
10394
|
children: [
|
|
10056
|
-
overlayOpen && /* @__PURE__ */
|
|
10395
|
+
overlayOpen && /* @__PURE__ */ jsx21(
|
|
10057
10396
|
"div",
|
|
10058
10397
|
{
|
|
10059
10398
|
className: cx("awr-chat__scrim", classNames.scrim),
|
|
@@ -10062,7 +10401,7 @@ var AgentChatInner = ({
|
|
|
10062
10401
|
}
|
|
10063
10402
|
),
|
|
10064
10403
|
chats && historyOpen && /* @__PURE__ */ jsxs19("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
|
|
10065
|
-
/* @__PURE__ */
|
|
10404
|
+
/* @__PURE__ */ jsx21(
|
|
10066
10405
|
HistoryList,
|
|
10067
10406
|
{
|
|
10068
10407
|
history: {
|
|
@@ -10081,7 +10420,7 @@ var AgentChatInner = ({
|
|
|
10081
10420
|
}
|
|
10082
10421
|
),
|
|
10083
10422
|
slots.sidebar,
|
|
10084
|
-
/* @__PURE__ */
|
|
10423
|
+
/* @__PURE__ */ jsx21(
|
|
10085
10424
|
"button",
|
|
10086
10425
|
{
|
|
10087
10426
|
type: "button",
|
|
@@ -10096,7 +10435,7 @@ var AgentChatInner = ({
|
|
|
10096
10435
|
header,
|
|
10097
10436
|
/* @__PURE__ */ jsxs19("div", { className: cx("awr-chat__body", classNames.body), ref: bodyRef, children: [
|
|
10098
10437
|
slots.beforeMessages,
|
|
10099
|
-
/* @__PURE__ */
|
|
10438
|
+
/* @__PURE__ */ jsx21(
|
|
10100
10439
|
Messages,
|
|
10101
10440
|
{
|
|
10102
10441
|
messages: agent.messages,
|
|
@@ -10114,6 +10453,7 @@ var AgentChatInner = ({
|
|
|
10114
10453
|
showSubagents,
|
|
10115
10454
|
showMedia,
|
|
10116
10455
|
showFileChips,
|
|
10456
|
+
showNamedFiles,
|
|
10117
10457
|
files,
|
|
10118
10458
|
htmlPreview,
|
|
10119
10459
|
onShowFiles: files ? showFiles : void 0,
|
|
@@ -10137,7 +10477,7 @@ var AgentChatInner = ({
|
|
|
10137
10477
|
renderImageViewer
|
|
10138
10478
|
}
|
|
10139
10479
|
),
|
|
10140
|
-
/* @__PURE__ */
|
|
10480
|
+
/* @__PURE__ */ jsx21(
|
|
10141
10481
|
Approvals,
|
|
10142
10482
|
{
|
|
10143
10483
|
approvals: agent.pendingApprovals,
|
|
@@ -10147,7 +10487,7 @@ var AgentChatInner = ({
|
|
|
10147
10487
|
renderApproval
|
|
10148
10488
|
}
|
|
10149
10489
|
),
|
|
10150
|
-
showQuestions && /* @__PURE__ */
|
|
10490
|
+
showQuestions && /* @__PURE__ */ jsx21(
|
|
10151
10491
|
Questions,
|
|
10152
10492
|
{
|
|
10153
10493
|
questions: agent.pendingQuestions ?? [],
|
|
@@ -10156,7 +10496,7 @@ var AgentChatInner = ({
|
|
|
10156
10496
|
renderQuestion
|
|
10157
10497
|
}
|
|
10158
10498
|
),
|
|
10159
|
-
appsOn && /* @__PURE__ */
|
|
10499
|
+
appsOn && /* @__PURE__ */ jsx21(
|
|
10160
10500
|
AppRequestPrompt,
|
|
10161
10501
|
{
|
|
10162
10502
|
requests: appHost.requests,
|
|
@@ -10164,7 +10504,7 @@ var AgentChatInner = ({
|
|
|
10164
10504
|
renderRequest: renderAppRequest
|
|
10165
10505
|
}
|
|
10166
10506
|
),
|
|
10167
|
-
showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */
|
|
10507
|
+
showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ jsx21(
|
|
10168
10508
|
Elicitations,
|
|
10169
10509
|
{
|
|
10170
10510
|
elicitations,
|
|
@@ -10173,13 +10513,13 @@ var AgentChatInner = ({
|
|
|
10173
10513
|
renderElicitation
|
|
10174
10514
|
}
|
|
10175
10515
|
),
|
|
10176
|
-
agent.modelLoad && loading && /* @__PURE__ */
|
|
10516
|
+
agent.modelLoad && loading && /* @__PURE__ */ jsx21(ModelLoadBar, { load: agent.modelLoad }),
|
|
10177
10517
|
slots.afterMessages
|
|
10178
10518
|
] }),
|
|
10179
10519
|
/* @__PURE__ */ jsxs19("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
10180
10520
|
slots.footerStart,
|
|
10181
|
-
tabNotes.length > 0 && /* @__PURE__ */
|
|
10182
|
-
showContext !== false && /* @__PURE__ */
|
|
10521
|
+
tabNotes.length > 0 && /* @__PURE__ */ jsx21("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text) => /* @__PURE__ */ jsx21("p", { className: "awr-tabnote__text", children: text }, text)) }),
|
|
10522
|
+
showContext !== false && /* @__PURE__ */ jsx21(
|
|
10183
10523
|
ContextMeter,
|
|
10184
10524
|
{
|
|
10185
10525
|
usage: agent.usage,
|
|
@@ -10191,10 +10531,10 @@ var AgentChatInner = ({
|
|
|
10191
10531
|
}
|
|
10192
10532
|
),
|
|
10193
10533
|
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ jsxs19("div", { className: "awr-chat__error", children: [
|
|
10194
|
-
/* @__PURE__ */
|
|
10534
|
+
/* @__PURE__ */ jsx21(AlertIcon, { size: 14 }),
|
|
10195
10535
|
" ",
|
|
10196
10536
|
agent.error
|
|
10197
|
-
] }) : /* @__PURE__ */
|
|
10537
|
+
] }) : /* @__PURE__ */ jsx21(
|
|
10198
10538
|
Composer2,
|
|
10199
10539
|
{
|
|
10200
10540
|
controller: agent,
|
|
@@ -10211,7 +10551,7 @@ var AgentChatInner = ({
|
|
|
10211
10551
|
appPanelNode && (panelTarget ? (
|
|
10212
10552
|
// Outside the chat: the theme tokens come with it.
|
|
10213
10553
|
createPortal2(
|
|
10214
|
-
/* @__PURE__ */
|
|
10554
|
+
/* @__PURE__ */ jsx21(
|
|
10215
10555
|
"div",
|
|
10216
10556
|
{
|
|
10217
10557
|
className: "awr-theme awr-apppanel",
|
|
@@ -10222,7 +10562,7 @@ var AgentChatInner = ({
|
|
|
10222
10562
|
panelTarget
|
|
10223
10563
|
)
|
|
10224
10564
|
) : asSheet ? /* @__PURE__ */ jsxs19(Fragment13, { children: [
|
|
10225
|
-
/* @__PURE__ */
|
|
10565
|
+
/* @__PURE__ */ jsx21("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
|
|
10226
10566
|
/* @__PURE__ */ jsxs19(
|
|
10227
10567
|
"aside",
|
|
10228
10568
|
{
|
|
@@ -10230,15 +10570,15 @@ var AgentChatInner = ({
|
|
|
10230
10570
|
role: "dialog",
|
|
10231
10571
|
"aria-label": L.appFrom(panelApp.server),
|
|
10232
10572
|
children: [
|
|
10233
|
-
/* @__PURE__ */
|
|
10573
|
+
/* @__PURE__ */ jsx21("div", { className: "awr-sheet__grab" }),
|
|
10234
10574
|
appPanelNode
|
|
10235
10575
|
]
|
|
10236
10576
|
}
|
|
10237
10577
|
)
|
|
10238
|
-
] }) : /* @__PURE__ */
|
|
10578
|
+
] }) : /* @__PURE__ */ jsx21("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
|
|
10239
10579
|
files && filesOpen && /* @__PURE__ */ jsxs19("aside", { className: cx("awr-chat__files", classNames.files), children: [
|
|
10240
|
-
/* @__PURE__ */
|
|
10241
|
-
/* @__PURE__ */
|
|
10580
|
+
/* @__PURE__ */ jsx21(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ jsx21(Files, { files }) }),
|
|
10581
|
+
/* @__PURE__ */ jsx21(
|
|
10242
10582
|
"button",
|
|
10243
10583
|
{
|
|
10244
10584
|
type: "button",
|
|
@@ -10255,7 +10595,7 @@ var AgentChatInner = ({
|
|
|
10255
10595
|
};
|
|
10256
10596
|
|
|
10257
10597
|
// src/components/LearnedSkills.tsx
|
|
10258
|
-
import { jsx as
|
|
10598
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
10259
10599
|
var LearnedSkills = ({
|
|
10260
10600
|
controller,
|
|
10261
10601
|
lessons,
|
|
@@ -10273,16 +10613,16 @@ var LearnedSkills = ({
|
|
|
10273
10613
|
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
10274
10614
|
return /* @__PURE__ */ jsxs20("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
10275
10615
|
!hideTitle && /* @__PURE__ */ jsxs20("h3", { className: "awr-notebook__title", children: [
|
|
10276
|
-
/* @__PURE__ */
|
|
10616
|
+
/* @__PURE__ */ jsx22(BookIcon, { size: 14 }),
|
|
10277
10617
|
" ",
|
|
10278
10618
|
L.notebookTitle,
|
|
10279
|
-
list.length > 0 && /* @__PURE__ */
|
|
10619
|
+
list.length > 0 && /* @__PURE__ */ jsx22("span", { className: "awr-notebook__count", children: list.length })
|
|
10280
10620
|
] }),
|
|
10281
|
-
list.length === 0 ? /* @__PURE__ */
|
|
10621
|
+
list.length === 0 ? /* @__PURE__ */ jsx22("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ jsx22("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ jsxs20("li", { className: "awr-lesson", children: [
|
|
10282
10622
|
/* @__PURE__ */ jsxs20("div", { className: "awr-lesson__head", children: [
|
|
10283
|
-
/* @__PURE__ */
|
|
10284
|
-
l.revision > 1 && /* @__PURE__ */
|
|
10285
|
-
forget && /* @__PURE__ */
|
|
10623
|
+
/* @__PURE__ */ jsx22("code", { className: "awr-lesson__name", children: l.name }),
|
|
10624
|
+
l.revision > 1 && /* @__PURE__ */ jsx22("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
10625
|
+
forget && /* @__PURE__ */ jsx22(
|
|
10286
10626
|
"button",
|
|
10287
10627
|
{
|
|
10288
10628
|
type: "button",
|
|
@@ -10290,11 +10630,11 @@ var LearnedSkills = ({
|
|
|
10290
10630
|
title: `${L.notebookForget}: ${l.name}`,
|
|
10291
10631
|
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
10292
10632
|
onClick: () => void forget(l.name),
|
|
10293
|
-
children: /* @__PURE__ */
|
|
10633
|
+
children: /* @__PURE__ */ jsx22(XIcon, { size: 12 })
|
|
10294
10634
|
}
|
|
10295
10635
|
)
|
|
10296
10636
|
] }),
|
|
10297
|
-
/* @__PURE__ */
|
|
10637
|
+
/* @__PURE__ */ jsx22("p", { className: "awr-lesson__when", children: l.description }),
|
|
10298
10638
|
showSources && l.sources.length > 0 && /* @__PURE__ */ jsxs20("p", { className: "awr-lesson__from", children: [
|
|
10299
10639
|
L.notebookFrom,
|
|
10300
10640
|
" ",
|
|
@@ -10306,7 +10646,7 @@ var LearnedSkills = ({
|
|
|
10306
10646
|
|
|
10307
10647
|
// src/components/MemoryCard.tsx
|
|
10308
10648
|
import { useState as useState21 } from "react";
|
|
10309
|
-
import { jsx as
|
|
10649
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10310
10650
|
var MemoryCard = ({
|
|
10311
10651
|
kind,
|
|
10312
10652
|
text,
|
|
@@ -10331,13 +10671,13 @@ var MemoryCard = ({
|
|
|
10331
10671
|
className: ["awr-memory", `awr-memory--${kind}`, undone ? "is-undone" : "", className].filter(Boolean).join(" "),
|
|
10332
10672
|
"data-memory": kind,
|
|
10333
10673
|
children: [
|
|
10334
|
-
/* @__PURE__ */
|
|
10674
|
+
/* @__PURE__ */ jsx23(BookmarkIcon, { size: 14, className: "awr-memory__icon" }),
|
|
10335
10675
|
/* @__PURE__ */ jsxs21("div", { className: "awr-memory__body", children: [
|
|
10336
|
-
/* @__PURE__ */
|
|
10337
|
-
/* @__PURE__ */
|
|
10338
|
-
problem && /* @__PURE__ */
|
|
10676
|
+
/* @__PURE__ */ jsx23("span", { className: "awr-memory__label", children: label }),
|
|
10677
|
+
/* @__PURE__ */ jsx23("span", { className: "awr-memory__text", children: text }),
|
|
10678
|
+
problem && /* @__PURE__ */ jsx23("span", { className: "awr-memory__problem", role: "alert", children: problem })
|
|
10339
10679
|
] }),
|
|
10340
|
-
undone ? /* @__PURE__ */
|
|
10680
|
+
undone ? /* @__PURE__ */ jsx23("span", { className: "awr-memory__undone", children: L.memoryUndone }) : onUndo ? /* @__PURE__ */ jsx23(
|
|
10341
10681
|
"button",
|
|
10342
10682
|
{
|
|
10343
10683
|
type: "button",
|
|
@@ -10356,7 +10696,7 @@ var MemoryCard = ({
|
|
|
10356
10696
|
|
|
10357
10697
|
// src/components/Composer.tsx
|
|
10358
10698
|
import { useState as useState22 } from "react";
|
|
10359
|
-
import { jsx as
|
|
10699
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
10360
10700
|
var Composer = ({
|
|
10361
10701
|
onSubmit,
|
|
10362
10702
|
busy = false,
|
|
@@ -10387,7 +10727,7 @@ var Composer = ({
|
|
|
10387
10727
|
submit();
|
|
10388
10728
|
},
|
|
10389
10729
|
children: [
|
|
10390
|
-
/* @__PURE__ */
|
|
10730
|
+
/* @__PURE__ */ jsx24(
|
|
10391
10731
|
"textarea",
|
|
10392
10732
|
{
|
|
10393
10733
|
className: "awr-composer__input",
|
|
@@ -10399,23 +10739,23 @@ var Composer = ({
|
|
|
10399
10739
|
rows: 1
|
|
10400
10740
|
}
|
|
10401
10741
|
),
|
|
10402
|
-
busy ? /* @__PURE__ */
|
|
10742
|
+
busy ? /* @__PURE__ */ jsx24(
|
|
10403
10743
|
"button",
|
|
10404
10744
|
{
|
|
10405
10745
|
type: "button",
|
|
10406
10746
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
10407
10747
|
onClick: onStop,
|
|
10408
10748
|
"aria-label": "Stop",
|
|
10409
|
-
children: /* @__PURE__ */
|
|
10749
|
+
children: /* @__PURE__ */ jsx24(StopIcon, { size: 18 })
|
|
10410
10750
|
}
|
|
10411
|
-
) : /* @__PURE__ */
|
|
10751
|
+
) : /* @__PURE__ */ jsx24(
|
|
10412
10752
|
"button",
|
|
10413
10753
|
{
|
|
10414
10754
|
type: "submit",
|
|
10415
10755
|
className: "awr-composer__btn",
|
|
10416
10756
|
disabled: disabled || !text.trim(),
|
|
10417
10757
|
"aria-label": "Send",
|
|
10418
|
-
children: disabled ? /* @__PURE__ */
|
|
10758
|
+
children: disabled ? /* @__PURE__ */ jsx24(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ jsx24(SendIcon, { size: 18 })
|
|
10419
10759
|
}
|
|
10420
10760
|
)
|
|
10421
10761
|
]
|
|
@@ -10424,17 +10764,17 @@ var Composer = ({
|
|
|
10424
10764
|
};
|
|
10425
10765
|
|
|
10426
10766
|
// src/components/PlanView.tsx
|
|
10427
|
-
import { jsx as
|
|
10767
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
10428
10768
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
10429
10769
|
if (!plan.steps.length && !plan.thought) return null;
|
|
10430
10770
|
return /* @__PURE__ */ jsxs23("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
10431
|
-
showThought && plan.thought.trim() && /* @__PURE__ */
|
|
10432
|
-
plan.steps.length > 0 && /* @__PURE__ */
|
|
10771
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ jsx25("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
10772
|
+
plan.steps.length > 0 && /* @__PURE__ */ jsx25("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ jsx25("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
10433
10773
|
] });
|
|
10434
10774
|
};
|
|
10435
10775
|
|
|
10436
10776
|
// src/components/ApprovalModeSwitch.tsx
|
|
10437
|
-
import { jsx as
|
|
10777
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
10438
10778
|
var DEFAULT_LABELS = {
|
|
10439
10779
|
autopilot: "Autopilot",
|
|
10440
10780
|
"ask-writes": "Ask before changes",
|
|
@@ -10454,13 +10794,13 @@ var ApprovalModeSwitch = ({
|
|
|
10454
10794
|
labels,
|
|
10455
10795
|
disabled,
|
|
10456
10796
|
className
|
|
10457
|
-
}) => /* @__PURE__ */
|
|
10797
|
+
}) => /* @__PURE__ */ jsx26(
|
|
10458
10798
|
"div",
|
|
10459
10799
|
{
|
|
10460
10800
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
10461
10801
|
role: "radiogroup",
|
|
10462
10802
|
"aria-label": "Tool consent",
|
|
10463
|
-
children: modes.map((m) => /* @__PURE__ */
|
|
10803
|
+
children: modes.map((m) => /* @__PURE__ */ jsx26(
|
|
10464
10804
|
"button",
|
|
10465
10805
|
{
|
|
10466
10806
|
type: "button",
|
|
@@ -10479,7 +10819,7 @@ var ApprovalModeSwitch = ({
|
|
|
10479
10819
|
|
|
10480
10820
|
// src/components/ApiKeyForm.tsx
|
|
10481
10821
|
import { useEffect as useEffect21, useState as useState23 } from "react";
|
|
10482
|
-
import { jsx as
|
|
10822
|
+
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
10483
10823
|
var ApiKeyForm = ({
|
|
10484
10824
|
credentials,
|
|
10485
10825
|
credentialRef,
|
|
@@ -10527,12 +10867,12 @@ var ApiKeyForm = ({
|
|
|
10527
10867
|
/* @__PURE__ */ jsxs24("label", { className: "awr-keyform__label", children: [
|
|
10528
10868
|
label,
|
|
10529
10869
|
present && /* @__PURE__ */ jsxs24("span", { className: "awr-keyform__saved", children: [
|
|
10530
|
-
/* @__PURE__ */
|
|
10870
|
+
/* @__PURE__ */ jsx27(CheckIcon, { size: 12 }),
|
|
10531
10871
|
" stored, encrypted"
|
|
10532
10872
|
] })
|
|
10533
10873
|
] }),
|
|
10534
10874
|
/* @__PURE__ */ jsxs24("div", { className: "awr-keyform__row", children: [
|
|
10535
|
-
/* @__PURE__ */
|
|
10875
|
+
/* @__PURE__ */ jsx27(
|
|
10536
10876
|
"input",
|
|
10537
10877
|
{
|
|
10538
10878
|
className: "awr-keyform__input",
|
|
@@ -10550,7 +10890,7 @@ var ApiKeyForm = ({
|
|
|
10550
10890
|
disabled: busy
|
|
10551
10891
|
}
|
|
10552
10892
|
),
|
|
10553
|
-
/* @__PURE__ */
|
|
10893
|
+
/* @__PURE__ */ jsx27(
|
|
10554
10894
|
"button",
|
|
10555
10895
|
{
|
|
10556
10896
|
type: "button",
|
|
@@ -10560,7 +10900,7 @@ var ApiKeyForm = ({
|
|
|
10560
10900
|
children: "Save"
|
|
10561
10901
|
}
|
|
10562
10902
|
),
|
|
10563
|
-
present && /* @__PURE__ */
|
|
10903
|
+
present && /* @__PURE__ */ jsx27(
|
|
10564
10904
|
"button",
|
|
10565
10905
|
{
|
|
10566
10906
|
type: "button",
|
|
@@ -10664,6 +11004,7 @@ export {
|
|
|
10664
11004
|
MCP_APP_SANDBOX_RESOURCE_READY,
|
|
10665
11005
|
MCP_APP_SANDBOX_SERVER,
|
|
10666
11006
|
MCP_APP_SANDBOX_TIMEOUT_MS,
|
|
11007
|
+
MCP_APP_SCHEME_PARAM,
|
|
10667
11008
|
McpAppBridge,
|
|
10668
11009
|
McpAppFrame,
|
|
10669
11010
|
McpAppLine,
|
|
@@ -10676,6 +11017,10 @@ export {
|
|
|
10676
11017
|
MessageList,
|
|
10677
11018
|
MicError,
|
|
10678
11019
|
ModelLoadBar,
|
|
11020
|
+
NAMED_FILES_MAX,
|
|
11021
|
+
NAMED_FILES_SCAN_MAX,
|
|
11022
|
+
NAMED_FILES_TEXT_MAX,
|
|
11023
|
+
NamedFileChips,
|
|
10679
11024
|
PlanView,
|
|
10680
11025
|
QUESTION_TIMEOUT_MS,
|
|
10681
11026
|
QuestionPrompt,
|
|
@@ -10763,6 +11108,7 @@ export {
|
|
|
10763
11108
|
linkedFilesOf,
|
|
10764
11109
|
loadSkillFromUrl,
|
|
10765
11110
|
markReadOnly,
|
|
11111
|
+
mcpAppColorScheme,
|
|
10766
11112
|
mcpAppCsp,
|
|
10767
11113
|
mcpAppHostCapabilities,
|
|
10768
11114
|
mcpAppPolicyToken,
|
|
@@ -10777,11 +11123,13 @@ export {
|
|
|
10777
11123
|
messageOverLimit,
|
|
10778
11124
|
micProblemOf,
|
|
10779
11125
|
micProblemText,
|
|
11126
|
+
namedFilesOf,
|
|
10780
11127
|
newChatId,
|
|
10781
11128
|
noticesOf,
|
|
10782
11129
|
onStorageChange,
|
|
10783
11130
|
parseSkillMarkdown,
|
|
10784
11131
|
parseSlash,
|
|
11132
|
+
pathsNamedIn,
|
|
10785
11133
|
pendingApprovalsOf,
|
|
10786
11134
|
pickRecordingType,
|
|
10787
11135
|
postStorageChange2 as postStorageChange,
|
|
@@ -10835,6 +11183,7 @@ export {
|
|
|
10835
11183
|
withAttachments,
|
|
10836
11184
|
withCspFirst,
|
|
10837
11185
|
withPolicyFirst,
|
|
10838
|
-
withoutOwnWords
|
|
11186
|
+
withoutOwnWords,
|
|
11187
|
+
workspacePathOf
|
|
10839
11188
|
};
|
|
10840
11189
|
//# sourceMappingURL=index.js.map
|