@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.cjs
CHANGED
|
@@ -87,6 +87,7 @@ __export(src_exports, {
|
|
|
87
87
|
MCP_APP_SANDBOX_RESOURCE_READY: () => MCP_APP_SANDBOX_RESOURCE_READY,
|
|
88
88
|
MCP_APP_SANDBOX_SERVER: () => MCP_APP_SANDBOX_SERVER,
|
|
89
89
|
MCP_APP_SANDBOX_TIMEOUT_MS: () => MCP_APP_SANDBOX_TIMEOUT_MS,
|
|
90
|
+
MCP_APP_SCHEME_PARAM: () => MCP_APP_SCHEME_PARAM,
|
|
90
91
|
McpAppBridge: () => McpAppBridge,
|
|
91
92
|
McpAppFrame: () => McpAppFrame,
|
|
92
93
|
McpAppLine: () => McpAppLine,
|
|
@@ -99,6 +100,10 @@ __export(src_exports, {
|
|
|
99
100
|
MessageList: () => MessageList,
|
|
100
101
|
MicError: () => MicError,
|
|
101
102
|
ModelLoadBar: () => ModelLoadBar,
|
|
103
|
+
NAMED_FILES_MAX: () => NAMED_FILES_MAX,
|
|
104
|
+
NAMED_FILES_SCAN_MAX: () => NAMED_FILES_SCAN_MAX,
|
|
105
|
+
NAMED_FILES_TEXT_MAX: () => NAMED_FILES_TEXT_MAX,
|
|
106
|
+
NamedFileChips: () => NamedFileChips,
|
|
102
107
|
PlanView: () => PlanView,
|
|
103
108
|
QUESTION_TIMEOUT_MS: () => QUESTION_TIMEOUT_MS,
|
|
104
109
|
QuestionPrompt: () => QuestionPrompt,
|
|
@@ -186,6 +191,7 @@ __export(src_exports, {
|
|
|
186
191
|
linkedFilesOf: () => linkedFilesOf,
|
|
187
192
|
loadSkillFromUrl: () => import_agent_web8.loadSkillFromUrl,
|
|
188
193
|
markReadOnly: () => import_agent_web8.markReadOnly,
|
|
194
|
+
mcpAppColorScheme: () => mcpAppColorScheme,
|
|
189
195
|
mcpAppCsp: () => mcpAppCsp,
|
|
190
196
|
mcpAppHostCapabilities: () => mcpAppHostCapabilities,
|
|
191
197
|
mcpAppPolicyToken: () => mcpAppPolicyToken,
|
|
@@ -200,11 +206,13 @@ __export(src_exports, {
|
|
|
200
206
|
messageOverLimit: () => messageOverLimit,
|
|
201
207
|
micProblemOf: () => micProblemOf,
|
|
202
208
|
micProblemText: () => micProblemText,
|
|
209
|
+
namedFilesOf: () => namedFilesOf,
|
|
203
210
|
newChatId: () => newChatId,
|
|
204
211
|
noticesOf: () => noticesOf,
|
|
205
212
|
onStorageChange: () => import_agent_web8.onStorageChange,
|
|
206
213
|
parseSkillMarkdown: () => import_agent_web8.parseSkillMarkdown,
|
|
207
214
|
parseSlash: () => parseSlash,
|
|
215
|
+
pathsNamedIn: () => pathsNamedIn,
|
|
208
216
|
pendingApprovalsOf: () => pendingApprovalsOf,
|
|
209
217
|
pickRecordingType: () => pickRecordingType,
|
|
210
218
|
postStorageChange: () => import_agent_web8.postStorageChange,
|
|
@@ -258,7 +266,8 @@ __export(src_exports, {
|
|
|
258
266
|
withAttachments: () => withAttachments,
|
|
259
267
|
withCspFirst: () => withCspFirst,
|
|
260
268
|
withPolicyFirst: () => withPolicyFirst,
|
|
261
|
-
withoutOwnWords: () => withoutOwnWords
|
|
269
|
+
withoutOwnWords: () => withoutOwnWords,
|
|
270
|
+
workspacePathOf: () => workspacePathOf
|
|
262
271
|
});
|
|
263
272
|
module.exports = __toCommonJS(src_exports);
|
|
264
273
|
|
|
@@ -2333,7 +2342,18 @@ var useChatHistory = (agent, options = {}) => {
|
|
|
2333
2342
|
const agentRef = (0, import_react2.useRef)(agent);
|
|
2334
2343
|
agentRef.current = agent;
|
|
2335
2344
|
const baseRef = (0, import_react2.useRef)(void 0);
|
|
2345
|
+
const loadingRef = (0, import_react2.useRef)(void 0);
|
|
2346
|
+
if (loadingRef.current && agent.messages !== loadingRef.current) loadingRef.current = void 0;
|
|
2336
2347
|
const staleRef = (0, import_react2.useRef)(void 0);
|
|
2348
|
+
const queueRef = (0, import_react2.useRef)(Promise.resolve());
|
|
2349
|
+
const serially = (0, import_react2.useCallback)((task) => {
|
|
2350
|
+
const next = queueRef.current.then(task);
|
|
2351
|
+
queueRef.current = next.catch(() => {
|
|
2352
|
+
});
|
|
2353
|
+
return next;
|
|
2354
|
+
}, []);
|
|
2355
|
+
const baseOf = (id) => baseRef.current?.id === id ? baseRef.current : void 0;
|
|
2356
|
+
const unsavedHere = (messages2, id) => !loadingRef.current && ownUnsaved(messages2, baseOf(id));
|
|
2337
2357
|
const refresh = (0, import_react2.useCallback)(async () => {
|
|
2338
2358
|
try {
|
|
2339
2359
|
setChats(await store.list());
|
|
@@ -2343,19 +2363,79 @@ var useChatHistory = (agent, options = {}) => {
|
|
|
2343
2363
|
const newChat = (0, import_react2.useCallback)(() => {
|
|
2344
2364
|
agentRef.current.loadChat({ sessionId: newChatId(), messages: [] });
|
|
2345
2365
|
}, []);
|
|
2346
|
-
const
|
|
2366
|
+
const show = (0, import_react2.useCallback)((record) => {
|
|
2367
|
+
createdRef.current.set(record.id, record.createdAt);
|
|
2368
|
+
baseRef.current = {
|
|
2369
|
+
id: record.id,
|
|
2370
|
+
known: new Set(record.messages),
|
|
2371
|
+
updatedAt: record.updatedAt
|
|
2372
|
+
};
|
|
2373
|
+
loadingRef.current ??= agentRef.current.messages;
|
|
2374
|
+
agentRef.current.loadChat({
|
|
2375
|
+
sessionId: record.id,
|
|
2376
|
+
messages: record.messages,
|
|
2377
|
+
totalUsage: record.totalUsage
|
|
2378
|
+
});
|
|
2379
|
+
}, []);
|
|
2380
|
+
const saveOpen = (0, import_react2.useCallback)(
|
|
2347
2381
|
async (id) => {
|
|
2348
|
-
const
|
|
2349
|
-
if (
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2382
|
+
const current = agentRef.current;
|
|
2383
|
+
if (current.sessionId !== id || current.isRunning) return;
|
|
2384
|
+
const { messages: messages2, totalUsage: totalUsage2, remote: remote2 } = current;
|
|
2385
|
+
if (messages2.length === 0) return;
|
|
2386
|
+
const base2 = baseOf(id);
|
|
2387
|
+
if (loadingRef.current || unchangedSince(messages2, base2)) return;
|
|
2388
|
+
if (remote2 && !ownUnsaved(messages2, base2)) return;
|
|
2389
|
+
const now = Date.now();
|
|
2390
|
+
const createdAt = createdRef.current.get(id) ?? now;
|
|
2391
|
+
createdRef.current.set(id, createdAt);
|
|
2392
|
+
const view = {
|
|
2393
|
+
id,
|
|
2394
|
+
title: chatTitle(messages2, textsRef.current),
|
|
2395
|
+
createdAt,
|
|
2396
|
+
updatedAt: now,
|
|
2397
|
+
messages: messages2,
|
|
2398
|
+
totalUsage: totalUsage2
|
|
2399
|
+
};
|
|
2400
|
+
const { record, merged } = await saveChat(store, view, base2, textsRef.current);
|
|
2401
|
+
baseRef.current = {
|
|
2402
|
+
id,
|
|
2403
|
+
known: new Set(merged ? record.messages : messages2),
|
|
2404
|
+
updatedAt: record.updatedAt
|
|
2405
|
+
};
|
|
2406
|
+
await refresh();
|
|
2407
|
+
if (merged && agentRef.current.sessionId === id) show(record);
|
|
2357
2408
|
},
|
|
2358
|
-
|
|
2409
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2410
|
+
[store, show]
|
|
2411
|
+
);
|
|
2412
|
+
const reread = (0, import_react2.useCallback)(
|
|
2413
|
+
(id) => serially(async () => {
|
|
2414
|
+
const settled = () => {
|
|
2415
|
+
const current = agentRef.current;
|
|
2416
|
+
if (current.sessionId !== id) return false;
|
|
2417
|
+
if (current.isRunning) {
|
|
2418
|
+
if (current.remote?.running) staleRef.current = id;
|
|
2419
|
+
return false;
|
|
2420
|
+
}
|
|
2421
|
+
return true;
|
|
2422
|
+
};
|
|
2423
|
+
if (!settled()) return;
|
|
2424
|
+
if (unsavedHere(agentRef.current.messages, id)) return saveOpen(id);
|
|
2425
|
+
const record = await store.get(id).catch(() => void 0);
|
|
2426
|
+
if (!record || !settled()) return;
|
|
2427
|
+
if (unsavedHere(agentRef.current.messages, id)) return saveOpen(id);
|
|
2428
|
+
show(record);
|
|
2429
|
+
}),
|
|
2430
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2431
|
+
[store, serially, saveOpen, show]
|
|
2432
|
+
);
|
|
2433
|
+
const select = (0, import_react2.useCallback)(
|
|
2434
|
+
(id) => serially(async () => {
|
|
2435
|
+
const record = await store.get(id).catch(() => void 0);
|
|
2436
|
+
if (record) show(record);
|
|
2437
|
+
}),
|
|
2438
|
+
[store, serially, show]
|
|
2359
2439
|
);
|
|
2360
2440
|
const remove = (0, import_react2.useCallback)(
|
|
2361
2441
|
async (id) => {
|
|
@@ -2399,45 +2479,34 @@ var useChatHistory = (agent, options = {}) => {
|
|
|
2399
2479
|
const current = agentRef.current;
|
|
2400
2480
|
if (key === void 0 || key !== current.sessionId) return;
|
|
2401
2481
|
if (current.remote?.running) staleRef.current = key;
|
|
2402
|
-
else if (!current.isRunning) void
|
|
2482
|
+
else if (!current.isRunning) void reread(key);
|
|
2403
2483
|
}
|
|
2404
2484
|
);
|
|
2405
|
-
}, [enabled, store, refresh,
|
|
2485
|
+
}, [enabled, store, refresh, reread]);
|
|
2406
2486
|
const { messages, totalUsage, sessionId, isRunning, remote } = agent;
|
|
2407
2487
|
(0, import_react2.useEffect)(() => {
|
|
2408
2488
|
if (!enabled || loading || isRunning) return;
|
|
2409
2489
|
if (staleRef.current === sessionId) {
|
|
2410
2490
|
staleRef.current = void 0;
|
|
2411
|
-
void
|
|
2491
|
+
void reread(sessionId).catch(() => {
|
|
2492
|
+
});
|
|
2412
2493
|
return;
|
|
2413
2494
|
}
|
|
2414
2495
|
if (messages.length === 0) return;
|
|
2415
|
-
|
|
2416
|
-
if (unchangedSince(messages, base2)) return;
|
|
2417
|
-
if (remote && !ownUnsaved(messages, base2)) return;
|
|
2418
|
-
const now = Date.now();
|
|
2419
|
-
const createdAt = createdRef.current.get(sessionId) ?? now;
|
|
2420
|
-
createdRef.current.set(sessionId, createdAt);
|
|
2421
|
-
const view = {
|
|
2422
|
-
id: sessionId,
|
|
2423
|
-
title: chatTitle(messages, textsRef.current),
|
|
2424
|
-
createdAt,
|
|
2425
|
-
updatedAt: now,
|
|
2426
|
-
messages,
|
|
2427
|
-
totalUsage
|
|
2428
|
-
};
|
|
2429
|
-
void (async () => {
|
|
2430
|
-
const { record, merged } = await saveChat(store, view, base2, textsRef.current);
|
|
2431
|
-
baseRef.current = {
|
|
2432
|
-
id: sessionId,
|
|
2433
|
-
known: new Set(merged ? record.messages : messages),
|
|
2434
|
-
updatedAt: record.updatedAt
|
|
2435
|
-
};
|
|
2436
|
-
await refresh();
|
|
2437
|
-
if (merged && agentRef.current.sessionId === sessionId) await select(sessionId);
|
|
2438
|
-
})().catch(() => {
|
|
2496
|
+
void serially(() => saveOpen(sessionId)).catch(() => {
|
|
2439
2497
|
});
|
|
2440
|
-
}, [
|
|
2498
|
+
}, [
|
|
2499
|
+
enabled,
|
|
2500
|
+
loading,
|
|
2501
|
+
isRunning,
|
|
2502
|
+
remote,
|
|
2503
|
+
messages,
|
|
2504
|
+
totalUsage,
|
|
2505
|
+
sessionId,
|
|
2506
|
+
serially,
|
|
2507
|
+
saveOpen,
|
|
2508
|
+
reread
|
|
2509
|
+
]);
|
|
2441
2510
|
return { chats, currentId: sessionId, loading, select, newChat, remove };
|
|
2442
2511
|
};
|
|
2443
2512
|
|
|
@@ -3852,6 +3921,7 @@ var defaultLabels = {
|
|
|
3852
3921
|
dictate: "Dictate (speech to text)",
|
|
3853
3922
|
dictateTitle: "Dictate \u2014 speech to text in the browser",
|
|
3854
3923
|
stopDictation: "Stop dictation",
|
|
3924
|
+
micListening: "Listening \u2014 tap to finish",
|
|
3855
3925
|
microphone: "Microphone",
|
|
3856
3926
|
transcribing: "Transcribing\u2026",
|
|
3857
3927
|
micDenied: "The microphone is blocked for this site. Allow it in the browser's site settings (the icon beside the address), then try again.",
|
|
@@ -4001,6 +4071,7 @@ var defaultLabels = {
|
|
|
4001
4071
|
readAloudCode: "A code block is not read out.",
|
|
4002
4072
|
readAloudFailed: "It could not be read aloud.",
|
|
4003
4073
|
filesWritten: (n) => `${plural(n, "file", "files")} written in this turn`,
|
|
4074
|
+
filesNamed: (n) => `${plural(n, "file", "files")} in this answer`,
|
|
4004
4075
|
filesCount: (n) => plural(n, "file", "files"),
|
|
4005
4076
|
showInFiles: "Show in Files",
|
|
4006
4077
|
fileKinds: {
|
|
@@ -4575,7 +4646,7 @@ var formatCountdown = (ms) => {
|
|
|
4575
4646
|
};
|
|
4576
4647
|
|
|
4577
4648
|
// src/components/AgentChat.tsx
|
|
4578
|
-
var
|
|
4649
|
+
var import_react26 = require("react");
|
|
4579
4650
|
var import_react_dom2 = require("react-dom");
|
|
4580
4651
|
|
|
4581
4652
|
// src/hooks/use-follow-scroll.ts
|
|
@@ -4810,11 +4881,13 @@ var tokenizeHtml = (source) => {
|
|
|
4810
4881
|
var MCP_APP_SANDBOX_PROXY_READY = "ui/notifications/sandbox-proxy-ready";
|
|
4811
4882
|
var MCP_APP_SANDBOX_RESOURCE_READY = "ui/notifications/sandbox-resource-ready";
|
|
4812
4883
|
var isMcpAppSandboxMessage = (data) => typeof data === "object" && data !== null && typeof data.method === "string" && data.method.startsWith("ui/notifications/sandbox-");
|
|
4884
|
+
var MCP_APP_SCHEME_PARAM = "scheme";
|
|
4885
|
+
var mcpAppColorScheme = (value) => value === "light" || value === "dark" ? value : void 0;
|
|
4813
4886
|
var mcpAppPolicy = ({ connect, resources }) => {
|
|
4814
4887
|
const from = resources.length > 0 ? ` ${resources.join(" ")}` : "";
|
|
4815
4888
|
return [
|
|
4816
4889
|
"default-src 'none'",
|
|
4817
|
-
`script-src 'unsafe-inline'${from}`,
|
|
4890
|
+
`script-src 'unsafe-inline' 'wasm-unsafe-eval'${from}`,
|
|
4818
4891
|
`style-src 'unsafe-inline'${from}`,
|
|
4819
4892
|
`img-src data: blob:${from}`,
|
|
4820
4893
|
`font-src data:${from}`,
|
|
@@ -4872,9 +4945,13 @@ var grantedAppCsp = (csp) => ({
|
|
|
4872
4945
|
resourceDomains: origins(csp?.resourceDomains)
|
|
4873
4946
|
});
|
|
4874
4947
|
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,'*')}})})()";
|
|
4875
|
-
var
|
|
4948
|
+
var schemeMeta = (scheme) => scheme ? `<meta name="color-scheme" content="${scheme}">` : "";
|
|
4949
|
+
var schemeCss = (scheme) => scheme ? `:root{color-scheme:${scheme}}` : "";
|
|
4950
|
+
var schemeOfFrame = (scheme) => scheme ? `;color-scheme:${scheme}` : "";
|
|
4951
|
+
var buildMcpAppDocument = (html, csp, scheme) => {
|
|
4876
4952
|
const policy = mcpAppCsp(csp);
|
|
4877
|
-
|
|
4953
|
+
const s = mcpAppColorScheme(scheme);
|
|
4954
|
+
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>`;
|
|
4878
4955
|
};
|
|
4879
4956
|
var appLinkOf = (value) => {
|
|
4880
4957
|
if (typeof value !== "string" || value.length > MCP_APP_MAX_URL_CHARS) return void 0;
|
|
@@ -5493,9 +5570,11 @@ var mcpAppSandboxShellCsp = (proxyUrl) => [
|
|
|
5493
5570
|
"form-action 'none'",
|
|
5494
5571
|
"base-uri 'none'"
|
|
5495
5572
|
].join("; ");
|
|
5496
|
-
var buildMcpAppSandboxShell = (proxyUrl) => {
|
|
5573
|
+
var buildMcpAppSandboxShell = (proxyUrl, scheme) => {
|
|
5497
5574
|
if (!PROXY_URL.test(proxyUrl)) throw new Error("not a sandbox proxy URL");
|
|
5498
|
-
|
|
5575
|
+
const s = mcpAppColorScheme(scheme);
|
|
5576
|
+
const src = s ? `${proxyUrl}?${MCP_APP_SCHEME_PARAM}=${s}` : proxyUrl;
|
|
5577
|
+
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>`;
|
|
5499
5578
|
};
|
|
5500
5579
|
var McpAppSandboxLink = class {
|
|
5501
5580
|
o;
|
|
@@ -6142,10 +6221,14 @@ var McpAppFrame = ({
|
|
|
6142
6221
|
if (!url) return { mode: "opaque", reason: "too-many-origins" };
|
|
6143
6222
|
return { mode: "origin", origin: target.origin, url };
|
|
6144
6223
|
}, [resource, sandboxUrl, fallback, app.server, reload]);
|
|
6145
|
-
const doc = (0, import_react14.useMemo)(
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6224
|
+
const { doc, scheme } = (0, import_react14.useMemo)(() => {
|
|
6225
|
+
const scheme2 = themeRef.current === "dark" ? "dark" : "light";
|
|
6226
|
+
if (!resource || !placement) return { scheme: scheme2 };
|
|
6227
|
+
return {
|
|
6228
|
+
scheme: scheme2,
|
|
6229
|
+
doc: placement.mode === "origin" ? buildMcpAppSandboxShell(placement.url, scheme2) : buildMcpAppDocument(resource.html, resource.csp, scheme2)
|
|
6230
|
+
};
|
|
6231
|
+
}, [resource, placement]);
|
|
6149
6232
|
(0, import_react14.useEffect)(() => {
|
|
6150
6233
|
const reason = placement?.mode === "opaque" ? placement.reason : void 0;
|
|
6151
6234
|
if (reason && reason !== "no-answer" && sandboxUrl !== void 0) {
|
|
@@ -6430,6 +6513,7 @@ var McpAppFrame = ({
|
|
|
6430
6513
|
referrerPolicy: "no-referrer",
|
|
6431
6514
|
srcDoc: doc,
|
|
6432
6515
|
onLoad: () => shellLoaded.current?.(),
|
|
6516
|
+
"data-color-scheme": scheme,
|
|
6433
6517
|
style: panel || fullscreen ? void 0 : { height }
|
|
6434
6518
|
},
|
|
6435
6519
|
`${reload}:origin`
|
|
@@ -6442,6 +6526,7 @@ var McpAppFrame = ({
|
|
|
6442
6526
|
sandbox: "allow-scripts",
|
|
6443
6527
|
referrerPolicy: "no-referrer",
|
|
6444
6528
|
srcDoc: doc,
|
|
6529
|
+
"data-color-scheme": scheme,
|
|
6445
6530
|
style: panel || fullscreen ? void 0 : { height }
|
|
6446
6531
|
},
|
|
6447
6532
|
`${reload}:opaque`
|
|
@@ -6748,6 +6833,15 @@ var readDataUrl2 = (file) => new Promise((resolve, reject) => {
|
|
|
6748
6833
|
r.readAsDataURL(file);
|
|
6749
6834
|
});
|
|
6750
6835
|
var safeName = (name) => name.replace(/[^\w.-]+/g, "_").slice(0, 80) || "file";
|
|
6836
|
+
var DictationClock = () => {
|
|
6837
|
+
const [t0] = (0, import_react15.useState)(() => Date.now());
|
|
6838
|
+
const [now, setNow] = (0, import_react15.useState)(t0);
|
|
6839
|
+
(0, import_react15.useEffect)(() => {
|
|
6840
|
+
const id = setInterval(() => setNow(Date.now()), 500);
|
|
6841
|
+
return () => clearInterval(id);
|
|
6842
|
+
}, []);
|
|
6843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "awr-mic__time", "aria-hidden": "true", children: formatClock(now - t0) });
|
|
6844
|
+
};
|
|
6751
6845
|
var AgentComposer = ({
|
|
6752
6846
|
controller: agent,
|
|
6753
6847
|
placeholder,
|
|
@@ -6844,6 +6938,7 @@ ${draftText}` : draftText);
|
|
|
6844
6938
|
onFinal: (heard) => setText((t) => t.trim() ? `${t.trimEnd()} ${heard}` : heard)
|
|
6845
6939
|
});
|
|
6846
6940
|
const showMic = speech !== false && stt.supported;
|
|
6941
|
+
const micOn = stt.listening && !stt.finishing;
|
|
6847
6942
|
const recorder = useAudioRecorder({
|
|
6848
6943
|
maxMs: typeof voiceMessage === "object" ? voiceMessage.maxMs : void 0
|
|
6849
6944
|
});
|
|
@@ -7486,19 +7581,22 @@ ${draftText}` : draftText);
|
|
|
7486
7581
|
"aria-label": L.message
|
|
7487
7582
|
}
|
|
7488
7583
|
),
|
|
7489
|
-
showMic && /* @__PURE__ */ (0, import_jsx_runtime6.
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7584
|
+
showMic && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: `awr-micbox${micOn ? " is-on" : ""}${stt.finishing ? " is-busy" : ""}`, children: [
|
|
7585
|
+
micOn && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DictationClock, {}),
|
|
7586
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
7587
|
+
"button",
|
|
7588
|
+
{
|
|
7589
|
+
type: "button",
|
|
7590
|
+
className: `awr-iconbtn awr-mic${micOn ? " is-on" : ""}${stt.finishing ? " is-busy" : ""}`,
|
|
7591
|
+
"aria-label": stt.finishing ? L.transcribing : micOn ? L.micListening : L.dictate,
|
|
7592
|
+
"aria-busy": stt.finishing || void 0,
|
|
7593
|
+
title: micOn ? L.stopDictation : stt.finishing ? L.transcribing : L.dictateTitle,
|
|
7594
|
+
onClick: stt.toggle,
|
|
7595
|
+
disabled: disabled || recordingOn || stt.finishing,
|
|
7596
|
+
children: stt.finishing ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SpinnerIcon, { size: 18 }) : micOn ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StopIcon, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MicIcon, { size: 18 })
|
|
7597
|
+
}
|
|
7598
|
+
)
|
|
7599
|
+
] })
|
|
7502
7600
|
] }),
|
|
7503
7601
|
stt.listening && stt.interim && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "awr-composer2__interim", children: stt.interim }),
|
|
7504
7602
|
stt.finishing && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "awr-composer2__interim", role: "status", children: L.transcribing }),
|
|
@@ -8498,6 +8596,7 @@ var ImageViewerProvider = ({
|
|
|
8498
8596
|
render,
|
|
8499
8597
|
children
|
|
8500
8598
|
}) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageViewerContext.Provider, { value: { enabled, render }, children });
|
|
8599
|
+
var useImageViewerOn = () => (0, import_react18.useContext)(ImageViewerContext).enabled;
|
|
8501
8600
|
var imageExtensionOf = (src) => {
|
|
8502
8601
|
const type = /^data:image\/([a-z0-9.+-]+)/i.exec(src)?.[1]?.toLowerCase();
|
|
8503
8602
|
return !type ? "" : type === "jpeg" ? ".jpg" : type === "svg+xml" ? ".svg" : `.${type}`;
|
|
@@ -8708,7 +8807,7 @@ var FilesPanel = ({
|
|
|
8708
8807
|
};
|
|
8709
8808
|
|
|
8710
8809
|
// src/components/FileChips.tsx
|
|
8711
|
-
var
|
|
8810
|
+
var import_react22 = require("react");
|
|
8712
8811
|
|
|
8713
8812
|
// src/file-kinds.ts
|
|
8714
8813
|
var import_agent_web6 = require("@dudko.dev/agent-web");
|
|
@@ -8728,6 +8827,122 @@ var fileKindOf = (path, mediaType) => {
|
|
|
8728
8827
|
};
|
|
8729
8828
|
var fileNameOf2 = (path) => path.split("/").filter(Boolean).pop() || "file";
|
|
8730
8829
|
|
|
8830
|
+
// src/named-files.ts
|
|
8831
|
+
var NAMED_FILES_MAX = 12;
|
|
8832
|
+
var NAMED_FILES_SCAN_MAX = 200;
|
|
8833
|
+
var NAMED_FILES_TEXT_MAX = 1e5;
|
|
8834
|
+
var PATH_MAX = 512;
|
|
8835
|
+
var workspacePathOf = (raw) => {
|
|
8836
|
+
if (raw.length < 2 || raw.length > PATH_MAX) return void 0;
|
|
8837
|
+
if (raw[0] !== "/" || raw[1] === "/") return void 0;
|
|
8838
|
+
if (/[\u0000-\u001f\u007f\\]/.test(raw)) return void 0;
|
|
8839
|
+
const segments = raw.slice(1).split("/");
|
|
8840
|
+
for (const s of segments) {
|
|
8841
|
+
if (!s || s === "." || s === ".." || s.trim() !== s) return void 0;
|
|
8842
|
+
}
|
|
8843
|
+
return raw;
|
|
8844
|
+
};
|
|
8845
|
+
var withoutFences = (text2) => {
|
|
8846
|
+
const lines = text2.split("\n");
|
|
8847
|
+
let fence;
|
|
8848
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8849
|
+
const open = /^ {0,3}(`{3,}|~{3,})/.exec(lines[i]);
|
|
8850
|
+
if (!fence) {
|
|
8851
|
+
if (open && !(open[1][0] === "`" && lines[i].slice(open[0].length).includes("`"))) {
|
|
8852
|
+
fence = { char: open[1][0], size: open[1].length };
|
|
8853
|
+
lines[i] = " ".repeat(lines[i].length);
|
|
8854
|
+
}
|
|
8855
|
+
continue;
|
|
8856
|
+
}
|
|
8857
|
+
const close = /^ {0,3}(`{3,}|~{3,})\s*$/.exec(lines[i]);
|
|
8858
|
+
if (close && close[1][0] === fence.char && close[1].length >= fence.size) fence = void 0;
|
|
8859
|
+
lines[i] = " ".repeat(lines[i].length);
|
|
8860
|
+
}
|
|
8861
|
+
return lines.join("\n");
|
|
8862
|
+
};
|
|
8863
|
+
var decoded = (s) => {
|
|
8864
|
+
if (!s.includes("%")) return s;
|
|
8865
|
+
try {
|
|
8866
|
+
return decodeURIComponent(s);
|
|
8867
|
+
} catch {
|
|
8868
|
+
return s;
|
|
8869
|
+
}
|
|
8870
|
+
};
|
|
8871
|
+
var codeSpansOf = (text2) => {
|
|
8872
|
+
const runs = [];
|
|
8873
|
+
for (let i = text2.indexOf("`"); i >= 0; i = text2.indexOf("`", i)) {
|
|
8874
|
+
let j = i + 1;
|
|
8875
|
+
while (j < text2.length && text2.charCodeAt(j) === 96) j++;
|
|
8876
|
+
runs.push({ at: i, size: j - i });
|
|
8877
|
+
i = j;
|
|
8878
|
+
}
|
|
8879
|
+
const next = new Array(runs.length);
|
|
8880
|
+
const later = /* @__PURE__ */ new Map();
|
|
8881
|
+
for (let k = runs.length - 1; k >= 0; k--) {
|
|
8882
|
+
next[k] = later.get(runs[k].size) ?? -1;
|
|
8883
|
+
later.set(runs[k].size, k);
|
|
8884
|
+
}
|
|
8885
|
+
const spans = [];
|
|
8886
|
+
for (let k = 0; k < runs.length; ) {
|
|
8887
|
+
const close = next[k];
|
|
8888
|
+
if (close < 0) {
|
|
8889
|
+
k++;
|
|
8890
|
+
continue;
|
|
8891
|
+
}
|
|
8892
|
+
const open = runs[k];
|
|
8893
|
+
const end = runs[close].at + runs[close].size;
|
|
8894
|
+
spans.push({ at: open.at, end, inner: text2.slice(open.at + open.size, runs[close].at) });
|
|
8895
|
+
k = close + 1;
|
|
8896
|
+
}
|
|
8897
|
+
return spans;
|
|
8898
|
+
};
|
|
8899
|
+
var LINK = /!?\[[^[\]\n]*\]\(\s*(<[^<>\n]+>|[^\s()<>]+)(?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^()\n]*\)))?\s*\)/g;
|
|
8900
|
+
var pathsNamedIn = (text2) => {
|
|
8901
|
+
if (!text2) return [];
|
|
8902
|
+
const head = text2.length > NAMED_FILES_TEXT_MAX ? text2.slice(0, NAMED_FILES_TEXT_MAX) : text2;
|
|
8903
|
+
if (!head.includes("/")) return [];
|
|
8904
|
+
const found = [];
|
|
8905
|
+
let masked = withoutFences(head);
|
|
8906
|
+
const spans = codeSpansOf(masked);
|
|
8907
|
+
const parts = [];
|
|
8908
|
+
let from = 0;
|
|
8909
|
+
for (const span of spans) {
|
|
8910
|
+
let inner = span.inner;
|
|
8911
|
+
if (inner.length > 2 && inner.startsWith(" ") && inner.endsWith(" ")) inner = inner.slice(1, -1);
|
|
8912
|
+
const path = workspacePathOf(inner);
|
|
8913
|
+
if (path) found.push({ at: span.at, path });
|
|
8914
|
+
parts.push(masked.slice(from, span.at), " ".repeat(span.end - span.at));
|
|
8915
|
+
from = span.end;
|
|
8916
|
+
}
|
|
8917
|
+
masked = parts.join("") + masked.slice(from);
|
|
8918
|
+
for (const m of masked.matchAll(LINK)) {
|
|
8919
|
+
const dest = m[1].startsWith("<") ? m[1].slice(1, -1) : m[1];
|
|
8920
|
+
const path = workspacePathOf(decoded(dest));
|
|
8921
|
+
if (path) found.push({ at: m.index, path });
|
|
8922
|
+
}
|
|
8923
|
+
found.sort((a, b) => a.at - b.at);
|
|
8924
|
+
const out = [];
|
|
8925
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8926
|
+
for (const { path } of found) {
|
|
8927
|
+
if (seen.has(path)) continue;
|
|
8928
|
+
seen.add(path);
|
|
8929
|
+
out.push(path);
|
|
8930
|
+
if (out.length >= NAMED_FILES_SCAN_MAX) break;
|
|
8931
|
+
}
|
|
8932
|
+
return out;
|
|
8933
|
+
};
|
|
8934
|
+
var namedFilesOf = (named, exists, { exclude, max = NAMED_FILES_MAX } = {}) => {
|
|
8935
|
+
const skip = new Set(exclude ?? []);
|
|
8936
|
+
const out = [];
|
|
8937
|
+
for (const path of named) {
|
|
8938
|
+
if (out.length >= max) break;
|
|
8939
|
+
if (skip.has(path) || !exists(path)) continue;
|
|
8940
|
+
skip.add(path);
|
|
8941
|
+
out.push(path);
|
|
8942
|
+
}
|
|
8943
|
+
return out;
|
|
8944
|
+
};
|
|
8945
|
+
|
|
8731
8946
|
// src/components/Media.tsx
|
|
8732
8947
|
var import_react20 = require("react");
|
|
8733
8948
|
var import_agent_web7 = require("@dudko.dev/agent-web");
|
|
@@ -8870,8 +9085,30 @@ var SandboxedFrame = ({
|
|
|
8870
9085
|
footer ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-frame__foot", children: footer }) : null
|
|
8871
9086
|
] });
|
|
8872
9087
|
|
|
8873
|
-
// src/components/
|
|
9088
|
+
// src/components/WorkspaceListing.tsx
|
|
9089
|
+
var import_react21 = require("react");
|
|
8874
9090
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
9091
|
+
var WorkspaceListingContext = (0, import_react21.createContext)(void 0);
|
|
9092
|
+
var WorkspaceListingProvider = ({
|
|
9093
|
+
files,
|
|
9094
|
+
children
|
|
9095
|
+
}) => {
|
|
9096
|
+
const live = useVirtualFiles(files);
|
|
9097
|
+
const value = (0, import_react21.useMemo)(
|
|
9098
|
+
() => files ? { vfs: files, listing: { files: live.files, loading: live.loading } } : void 0,
|
|
9099
|
+
[files, live.files, live.loading]
|
|
9100
|
+
);
|
|
9101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(WorkspaceListingContext.Provider, { value, children });
|
|
9102
|
+
};
|
|
9103
|
+
var useWorkspaceListing = (vfs) => {
|
|
9104
|
+
const shared = (0, import_react21.useContext)(WorkspaceListingContext);
|
|
9105
|
+
const fromShared = shared !== void 0 && vfs !== void 0 && shared.vfs === vfs;
|
|
9106
|
+
const own = useVirtualFiles(fromShared ? void 0 : vfs);
|
|
9107
|
+
return fromShared ? shared.listing : own;
|
|
9108
|
+
};
|
|
9109
|
+
|
|
9110
|
+
// src/components/FileChips.tsx
|
|
9111
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
8875
9112
|
var FILE_PREVIEW_CHARS = 2e4;
|
|
8876
9113
|
var textOf = (file) => file.encoding === "base64" ? new TextDecoder().decode(bytesOf(file.content, "base64")) : file.content;
|
|
8877
9114
|
var KIND_ICON = {
|
|
@@ -8896,7 +9133,7 @@ var downloadFile = async (vfs, path) => {
|
|
|
8896
9133
|
a.click();
|
|
8897
9134
|
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
8898
9135
|
};
|
|
8899
|
-
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ (0,
|
|
9136
|
+
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "awr-seg", role: "group", "aria-label": label, children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
8900
9137
|
"button",
|
|
8901
9138
|
{
|
|
8902
9139
|
type: "button",
|
|
@@ -8931,32 +9168,32 @@ var SourceView = ({
|
|
|
8931
9168
|
const L = useLabels(labels);
|
|
8932
9169
|
const cut = text2.length > maxChars;
|
|
8933
9170
|
const shown = cut ? text2.slice(0, maxChars) : text2;
|
|
8934
|
-
const lines = (0,
|
|
9171
|
+
const lines = (0, import_react22.useMemo)(
|
|
8935
9172
|
() => linesOf(html ? tokenizeHtml(shown) : [{ kind: "text", text: shown }]),
|
|
8936
9173
|
[shown, html]
|
|
8937
9174
|
);
|
|
8938
|
-
return /* @__PURE__ */ (0,
|
|
8939
|
-
/* @__PURE__ */ (0,
|
|
9175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
9176
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("pre", { className: ["awr-source", className].filter(Boolean).join(" "), tabIndex: 0, children: lines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-source__line", children: [
|
|
8940
9177
|
line.map(
|
|
8941
|
-
(t, k) => t.kind === "text" ? /* @__PURE__ */ (0,
|
|
9178
|
+
(t, k) => t.kind === "text" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react22.Fragment, { children: t.text }, k) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
|
|
8942
9179
|
),
|
|
8943
9180
|
"\n"
|
|
8944
9181
|
] }, i)) }),
|
|
8945
|
-
cut && /* @__PURE__ */ (0,
|
|
9182
|
+
cut && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-fileview__cut", children: L.fileCut(maxChars) })
|
|
8946
9183
|
] });
|
|
8947
9184
|
};
|
|
8948
9185
|
var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
8949
|
-
const html = (0,
|
|
9186
|
+
const html = (0, import_react22.useMemo)(() => textOf(file), [file]);
|
|
8950
9187
|
const options = htmlPreview === false ? void 0 : htmlPreview;
|
|
8951
9188
|
const tooLarge = html.length > HTML_PREVIEW_MAX_CHARS;
|
|
8952
9189
|
const canFrame = Boolean(options) && !tooLarge;
|
|
8953
|
-
const [view, setView] = (0,
|
|
8954
|
-
const [tall, setTall] = (0,
|
|
9190
|
+
const [view, setView] = (0, import_react22.useState)(canFrame ? "preview" : "source");
|
|
9191
|
+
const [tall, setTall] = (0, import_react22.useState)(false);
|
|
8955
9192
|
const showing = canFrame ? view : "source";
|
|
8956
9193
|
const scripts = options?.scripts === true;
|
|
8957
9194
|
const height = options?.height ?? 300;
|
|
8958
|
-
const linked = (0,
|
|
8959
|
-
return /* @__PURE__ */ (0,
|
|
9195
|
+
const linked = (0, import_react22.useMemo)(() => showing === "preview" ? linkedFilesOf(html) : [], [html, showing]);
|
|
9196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8960
9197
|
SandboxedFrame,
|
|
8961
9198
|
{
|
|
8962
9199
|
className: "awr-frame--html",
|
|
@@ -8964,35 +9201,35 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
8964
9201
|
html: showing === "preview" ? html : void 0,
|
|
8965
9202
|
scripts,
|
|
8966
9203
|
height: tall ? height * 2 : height,
|
|
8967
|
-
label: /* @__PURE__ */ (0,
|
|
8968
|
-
/* @__PURE__ */ (0,
|
|
8969
|
-
/* @__PURE__ */ (0,
|
|
8970
|
-
/* @__PURE__ */ (0,
|
|
8971
|
-
/* @__PURE__ */ (0,
|
|
8972
|
-
/* @__PURE__ */ (0,
|
|
9204
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
9205
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CodeIcon, { size: 14, className: "awr-frame__icon" }),
|
|
9206
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-frame__titles", children: [
|
|
9207
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
|
|
9208
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
9209
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LockIcon, { size: 11 }),
|
|
8973
9210
|
" ",
|
|
8974
9211
|
L.htmlSandboxed,
|
|
8975
9212
|
" \xB7 ",
|
|
8976
|
-
/* @__PURE__ */ (0,
|
|
9213
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NoNetworkIcon, { size: 11 }),
|
|
8977
9214
|
" ",
|
|
8978
9215
|
L.htmlNoNetwork
|
|
8979
9216
|
] }) : L.htmlSourceNote })
|
|
8980
9217
|
] })
|
|
8981
9218
|
] }),
|
|
8982
|
-
actions: canFrame ? /* @__PURE__ */ (0,
|
|
8983
|
-
/* @__PURE__ */ (0,
|
|
9219
|
+
actions: canFrame ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
9220
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8984
9221
|
Seg,
|
|
8985
9222
|
{
|
|
8986
9223
|
label: L.htmlFrameTitle,
|
|
8987
9224
|
value: showing,
|
|
8988
9225
|
onChange: setView,
|
|
8989
9226
|
options: [
|
|
8990
|
-
{ value: "preview", label: L.preview, icon: /* @__PURE__ */ (0,
|
|
8991
|
-
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */ (0,
|
|
9227
|
+
{ value: "preview", label: L.preview, icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EyeIcon, { size: 13 }) },
|
|
9228
|
+
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CodeIcon, { size: 13 }) }
|
|
8992
9229
|
]
|
|
8993
9230
|
}
|
|
8994
9231
|
),
|
|
8995
|
-
/* @__PURE__ */ (0,
|
|
9232
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8996
9233
|
"button",
|
|
8997
9234
|
{
|
|
8998
9235
|
type: "button",
|
|
@@ -9002,14 +9239,14 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
9002
9239
|
"aria-pressed": tall,
|
|
9003
9240
|
disabled: showing !== "preview",
|
|
9004
9241
|
onClick: () => setTall((t) => !t),
|
|
9005
|
-
children: /* @__PURE__ */ (0,
|
|
9242
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ExpandIcon, { size: 15 })
|
|
9006
9243
|
}
|
|
9007
9244
|
)
|
|
9008
9245
|
] }) : void 0,
|
|
9009
|
-
footer: /* @__PURE__ */ (0,
|
|
9010
|
-
/* @__PURE__ */ (0,
|
|
9011
|
-
/* @__PURE__ */ (0,
|
|
9012
|
-
/* @__PURE__ */ (0,
|
|
9246
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
9247
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileIcon, { size: 11 }),
|
|
9248
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { children: written.path }),
|
|
9249
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-frame__footmeta", children: [
|
|
9013
9250
|
"\xB7 ",
|
|
9014
9251
|
L.bytes(file.size),
|
|
9015
9252
|
" \xB7",
|
|
@@ -9018,18 +9255,18 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
9018
9255
|
linked.length > 0 ? ` \xB7 ${L.htmlLinkedFiles(linked.join(", "))}` : ""
|
|
9019
9256
|
] })
|
|
9020
9257
|
] }),
|
|
9021
|
-
children: showing === "source" ? /* @__PURE__ */ (0,
|
|
9022
|
-
tooLarge && options ? /* @__PURE__ */ (0,
|
|
9023
|
-
/* @__PURE__ */ (0,
|
|
9258
|
+
children: showing === "source" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
9259
|
+
tooLarge && options ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
|
|
9260
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
|
|
9024
9261
|
] }) : void 0
|
|
9025
9262
|
}
|
|
9026
9263
|
);
|
|
9027
9264
|
};
|
|
9028
9265
|
var ImagePreview = ({ written, vfs, onClose, L }) => {
|
|
9029
9266
|
const url = useFileUrl(vfs, written.path, written.mediaType.toLowerCase().split(";")[0].trim());
|
|
9030
|
-
return /* @__PURE__ */ (0,
|
|
9031
|
-
/* @__PURE__ */ (0,
|
|
9032
|
-
/* @__PURE__ */ (0,
|
|
9267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-fileview", children: [
|
|
9268
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileViewHead, { written, kind: "image", onClose, L }),
|
|
9269
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "awr-fileview__image", children: url ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: url, alt: fileNameOf2(written.path) }) : null })
|
|
9033
9270
|
] });
|
|
9034
9271
|
};
|
|
9035
9272
|
var FileViewHead = ({
|
|
@@ -9038,15 +9275,15 @@ var FileViewHead = ({
|
|
|
9038
9275
|
onClose,
|
|
9039
9276
|
L,
|
|
9040
9277
|
children
|
|
9041
|
-
}) => /* @__PURE__ */ (0,
|
|
9042
|
-
/* @__PURE__ */ (0,
|
|
9043
|
-
/* @__PURE__ */ (0,
|
|
9278
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-fileview__head", children: [
|
|
9279
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-fileview__name", title: written.path, children: fileNameOf2(written.path) }),
|
|
9280
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-fileview__kind", children: [
|
|
9044
9281
|
"\xB7 ",
|
|
9045
9282
|
L.fileKinds[kind]
|
|
9046
9283
|
] }),
|
|
9047
|
-
/* @__PURE__ */ (0,
|
|
9284
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-fileview__actions", children: [
|
|
9048
9285
|
children,
|
|
9049
|
-
/* @__PURE__ */ (0,
|
|
9286
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9050
9287
|
"button",
|
|
9051
9288
|
{
|
|
9052
9289
|
type: "button",
|
|
@@ -9054,7 +9291,7 @@ var FileViewHead = ({
|
|
|
9054
9291
|
"aria-label": L.closePreview,
|
|
9055
9292
|
title: L.closePreview,
|
|
9056
9293
|
onClick: onClose,
|
|
9057
|
-
children: /* @__PURE__ */ (0,
|
|
9294
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(XIcon, { size: 14 })
|
|
9058
9295
|
}
|
|
9059
9296
|
)
|
|
9060
9297
|
] })
|
|
@@ -9068,18 +9305,18 @@ var TextPreview = ({
|
|
|
9068
9305
|
onClose,
|
|
9069
9306
|
L
|
|
9070
9307
|
}) => {
|
|
9071
|
-
const text2 = (0,
|
|
9072
|
-
const rendered = (0,
|
|
9308
|
+
const text2 = (0, import_react22.useMemo)(() => textOf(file), [file]);
|
|
9309
|
+
const rendered = (0, import_react22.useMemo)(
|
|
9073
9310
|
() => renderFileContent?.(written, text2.slice(0, previewChars)),
|
|
9074
9311
|
[renderFileContent, written, text2, previewChars]
|
|
9075
9312
|
);
|
|
9076
9313
|
const hasRendered = rendered !== void 0 && rendered !== null && rendered !== false;
|
|
9077
|
-
const [view, setView] = (0,
|
|
9078
|
-
const [all, setAll] = (0,
|
|
9314
|
+
const [view, setView] = (0, import_react22.useState)("rendered");
|
|
9315
|
+
const [all, setAll] = (0, import_react22.useState)(false);
|
|
9079
9316
|
const showing = hasRendered ? view : "source";
|
|
9080
9317
|
const long = text2.length > 1200 || text2.split("\n").length > 16;
|
|
9081
|
-
return /* @__PURE__ */ (0,
|
|
9082
|
-
/* @__PURE__ */ (0,
|
|
9318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-fileview", children: [
|
|
9319
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileViewHead, { written, kind, onClose, L, children: hasRendered && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9083
9320
|
Seg,
|
|
9084
9321
|
{
|
|
9085
9322
|
label: fileNameOf2(written.path),
|
|
@@ -9091,21 +9328,23 @@ var TextPreview = ({
|
|
|
9091
9328
|
]
|
|
9092
9329
|
}
|
|
9093
9330
|
) }),
|
|
9094
|
-
/* @__PURE__ */ (0,
|
|
9095
|
-
/* @__PURE__ */ (0,
|
|
9096
|
-
text2.length > previewChars && /* @__PURE__ */ (0,
|
|
9097
|
-
] }) : /* @__PURE__ */ (0,
|
|
9098
|
-
long && /* @__PURE__ */ (0,
|
|
9331
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
9332
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "awr-fileview__rendered", children: rendered }),
|
|
9333
|
+
text2.length > previewChars && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
|
|
9334
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SourceView, { text: text2, maxChars: previewChars }) }),
|
|
9335
|
+
long && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "awr-fileview__more", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: () => setAll((a) => !a), children: all ? L.fileShowLess : L.fileShowRest }) })
|
|
9099
9336
|
] });
|
|
9100
9337
|
};
|
|
9101
|
-
var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ (0,
|
|
9102
|
-
/* @__PURE__ */ (0,
|
|
9103
|
-
/* @__PURE__ */ (0,
|
|
9338
|
+
var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-fileview", children: [
|
|
9339
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileViewHead, { written, kind, onClose, L }),
|
|
9340
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-fileview__none", children: L.fileNoPreview })
|
|
9104
9341
|
] });
|
|
9105
9342
|
var FileChips = ({
|
|
9106
9343
|
written,
|
|
9107
9344
|
files: vfs,
|
|
9108
9345
|
showHeader = true,
|
|
9346
|
+
heading,
|
|
9347
|
+
imagesInViewer = false,
|
|
9109
9348
|
onShowFiles,
|
|
9110
9349
|
htmlPreview = {},
|
|
9111
9350
|
renderFile,
|
|
@@ -9116,12 +9355,12 @@ var FileChips = ({
|
|
|
9116
9355
|
className
|
|
9117
9356
|
}) => {
|
|
9118
9357
|
const L = useLabels(labels);
|
|
9119
|
-
const live =
|
|
9120
|
-
const [openPath, setOpenPath] = (0,
|
|
9121
|
-
const [file, setFile] = (0,
|
|
9358
|
+
const live = useWorkspaceListing(vfs);
|
|
9359
|
+
const [openPath, setOpenPath] = (0, import_react22.useState)(defaultOpen);
|
|
9360
|
+
const [file, setFile] = (0, import_react22.useState)();
|
|
9122
9361
|
const open = written.find((f) => f.path === openPath);
|
|
9123
9362
|
const stamp = live.files.find((f) => f.path === openPath)?.updatedAt;
|
|
9124
|
-
(0,
|
|
9363
|
+
(0, import_react22.useEffect)(() => {
|
|
9125
9364
|
if (!vfs || !openPath) return setFile(void 0);
|
|
9126
9365
|
let gone = false;
|
|
9127
9366
|
vfs.read(openPath).then((f) => {
|
|
@@ -9148,23 +9387,23 @@ var FileChips = ({
|
|
|
9148
9387
|
onClose: () => setOpenPath(void 0),
|
|
9149
9388
|
L
|
|
9150
9389
|
};
|
|
9151
|
-
if (kind === "html") return /* @__PURE__ */ (0,
|
|
9152
|
-
if (kind === "image") return /* @__PURE__ */ (0,
|
|
9153
|
-
if (kind === "file") return /* @__PURE__ */ (0,
|
|
9154
|
-
return /* @__PURE__ */ (0,
|
|
9390
|
+
if (kind === "html") return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HtmlPreview, { ...props }, open.path);
|
|
9391
|
+
if (kind === "image") return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ImagePreview, { ...props }, open.path);
|
|
9392
|
+
if (kind === "file") return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NoPreview, { ...props }, open.path);
|
|
9393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TextPreview, { ...props }, open.path);
|
|
9155
9394
|
};
|
|
9156
|
-
return /* @__PURE__ */ (0,
|
|
9157
|
-
showHeader && /* @__PURE__ */ (0,
|
|
9158
|
-
/* @__PURE__ */ (0,
|
|
9159
|
-
/* @__PURE__ */ (0,
|
|
9160
|
-
onShowFiles && /* @__PURE__ */ (0,
|
|
9395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: ["awr-msg__files", className].filter(Boolean).join(" "), children: [
|
|
9396
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-msg__fileshead", children: [
|
|
9397
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileIcon, { size: 13 }),
|
|
9398
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: heading ?? L.filesWritten(written.length) }),
|
|
9399
|
+
onShowFiles && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: onShowFiles, children: L.showInFiles })
|
|
9161
9400
|
] }),
|
|
9162
|
-
/* @__PURE__ */ (0,
|
|
9401
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "awr-filechips", children: written.map((w) => {
|
|
9163
9402
|
const info = live.files.find((f) => f.path === w.path);
|
|
9164
9403
|
const gone = Boolean(vfs) && !live.loading && !info;
|
|
9165
9404
|
const usable = Boolean(vfs) && !gone;
|
|
9166
9405
|
const isOpen = openPath === w.path && usable;
|
|
9167
|
-
const chip = /* @__PURE__ */ (0,
|
|
9406
|
+
const chip = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9168
9407
|
FileChip,
|
|
9169
9408
|
{
|
|
9170
9409
|
written: w,
|
|
@@ -9174,10 +9413,11 @@ var FileChips = ({
|
|
|
9174
9413
|
gone,
|
|
9175
9414
|
open: isOpen,
|
|
9176
9415
|
onToggle: () => setOpenPath(isOpen ? void 0 : w.path),
|
|
9416
|
+
viewer: imagesInViewer,
|
|
9177
9417
|
labels
|
|
9178
9418
|
}
|
|
9179
9419
|
);
|
|
9180
|
-
return /* @__PURE__ */ (0,
|
|
9420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { className: "awr-filechips__item", children: renderFile ? renderFile(w, chip) : chip }, w.path);
|
|
9181
9421
|
}) }),
|
|
9182
9422
|
preview()
|
|
9183
9423
|
] });
|
|
@@ -9190,9 +9430,12 @@ var FileChip = ({
|
|
|
9190
9430
|
gone = false,
|
|
9191
9431
|
open = false,
|
|
9192
9432
|
onToggle,
|
|
9433
|
+
viewer = false,
|
|
9193
9434
|
labels
|
|
9194
9435
|
}) => {
|
|
9195
9436
|
const L = useLabels(labels);
|
|
9437
|
+
const viewerOn = useImageViewerOn();
|
|
9438
|
+
const thumbRef = (0, import_react22.useRef)(null);
|
|
9196
9439
|
const kind = fileKindOf(written.path, mediaType);
|
|
9197
9440
|
const name = fileNameOf2(written.path);
|
|
9198
9441
|
const Icon = KIND_ICON[kind];
|
|
@@ -9202,19 +9445,40 @@ var FileChip = ({
|
|
|
9202
9445
|
kind === "image" ? mediaType.toLowerCase().split(";")[0].trim() : void 0
|
|
9203
9446
|
);
|
|
9204
9447
|
const meta = gone ? L.fileGone : [L.fileKinds[kind], L.bytes(bytes), written.by ? L.fileBy(written.by.name) : ""].filter(Boolean).join(" \xB7 ");
|
|
9205
|
-
|
|
9448
|
+
const inViewer = viewer && viewerOn && kind === "image" && Boolean(thumb) && !gone;
|
|
9449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
9206
9450
|
"div",
|
|
9207
9451
|
{
|
|
9208
9452
|
className: `awr-filechip${open ? " is-open" : ""}${gone ? " is-gone" : ""}`,
|
|
9209
9453
|
title: written.path,
|
|
9210
9454
|
children: [
|
|
9211
|
-
/* @__PURE__ */ (0,
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9455
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { ref: thumbRef, className: "awr-filechip__thumb", children: inViewer && thumb ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9456
|
+
ImageThumb,
|
|
9457
|
+
{
|
|
9458
|
+
src: thumb,
|
|
9459
|
+
name: written.path,
|
|
9460
|
+
alt: name,
|
|
9461
|
+
className: "awr-filechip__imgbtn",
|
|
9462
|
+
labels
|
|
9463
|
+
}
|
|
9464
|
+
) : thumb ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: thumb, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { size: 16 }) }),
|
|
9465
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-filechip__text", children: [
|
|
9466
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-filechip__name", children: name }),
|
|
9467
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-filechip__meta", children: meta })
|
|
9215
9468
|
] }),
|
|
9216
|
-
vfs && /* @__PURE__ */ (0,
|
|
9217
|
-
|
|
9469
|
+
vfs && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-filechip__actions", children: [
|
|
9470
|
+
inViewer ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9471
|
+
"button",
|
|
9472
|
+
{
|
|
9473
|
+
type: "button",
|
|
9474
|
+
className: "awr-iconbtn",
|
|
9475
|
+
"aria-label": L.imageOpen(name),
|
|
9476
|
+
"aria-haspopup": "dialog",
|
|
9477
|
+
title: L.preview,
|
|
9478
|
+
onClick: () => thumbRef.current?.querySelector("button")?.click(),
|
|
9479
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EyeIcon, { size: 15 })
|
|
9480
|
+
}
|
|
9481
|
+
) : onToggle && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9218
9482
|
"button",
|
|
9219
9483
|
{
|
|
9220
9484
|
type: "button",
|
|
@@ -9223,10 +9487,10 @@ var FileChip = ({
|
|
|
9223
9487
|
title: open ? L.closePreview : L.preview,
|
|
9224
9488
|
"aria-expanded": open,
|
|
9225
9489
|
onClick: onToggle,
|
|
9226
|
-
children: open ? /* @__PURE__ */ (0,
|
|
9490
|
+
children: open ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronUpIcon, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EyeIcon, { size: 15 })
|
|
9227
9491
|
}
|
|
9228
9492
|
),
|
|
9229
|
-
/* @__PURE__ */ (0,
|
|
9493
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9230
9494
|
"button",
|
|
9231
9495
|
{
|
|
9232
9496
|
type: "button",
|
|
@@ -9234,7 +9498,7 @@ var FileChip = ({
|
|
|
9234
9498
|
"aria-label": L.fileDownload(name),
|
|
9235
9499
|
title: L.download,
|
|
9236
9500
|
onClick: () => void downloadFile(vfs, written.path),
|
|
9237
|
-
children: /* @__PURE__ */ (0,
|
|
9501
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DownloadIcon, { size: 15 })
|
|
9238
9502
|
}
|
|
9239
9503
|
)
|
|
9240
9504
|
] })
|
|
@@ -9242,16 +9506,69 @@ var FileChip = ({
|
|
|
9242
9506
|
}
|
|
9243
9507
|
);
|
|
9244
9508
|
};
|
|
9509
|
+
var NamedFileChips = (props) => {
|
|
9510
|
+
const named = (0, import_react22.useMemo)(() => pathsNamedIn(props.text), [props.text]);
|
|
9511
|
+
if (!props.files || named.length === 0) return null;
|
|
9512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NamedFileChipsOf, { ...props, named, files: props.files });
|
|
9513
|
+
};
|
|
9514
|
+
var NamedFileChipsOf = ({
|
|
9515
|
+
named,
|
|
9516
|
+
files: vfs,
|
|
9517
|
+
exclude,
|
|
9518
|
+
max = NAMED_FILES_MAX,
|
|
9519
|
+
showHeader = true,
|
|
9520
|
+
htmlPreview,
|
|
9521
|
+
renderFile,
|
|
9522
|
+
renderFileContent,
|
|
9523
|
+
labels,
|
|
9524
|
+
className
|
|
9525
|
+
}) => {
|
|
9526
|
+
const L = useLabels(labels);
|
|
9527
|
+
const live = useWorkspaceListing(vfs);
|
|
9528
|
+
const shown = (0, import_react22.useRef)(/* @__PURE__ */ new Map());
|
|
9529
|
+
const excludedKey = [...exclude ?? []].join("\n");
|
|
9530
|
+
const excluded = (0, import_react22.useMemo)(() => excludedKey ? excludedKey.split("\n") : [], [excludedKey]);
|
|
9531
|
+
const list = (0, import_react22.useMemo)(() => {
|
|
9532
|
+
if (live.loading) return [];
|
|
9533
|
+
const byPath = new Map(live.files.map((f) => [f.path, f]));
|
|
9534
|
+
const paths = namedFilesOf(named, (p) => byPath.has(p) || shown.current.has(p), {
|
|
9535
|
+
exclude: excluded,
|
|
9536
|
+
max
|
|
9537
|
+
});
|
|
9538
|
+
return paths.map((path) => {
|
|
9539
|
+
const info = byPath.get(path);
|
|
9540
|
+
const view = info ? { path, mediaType: info.mimeType, bytes: info.size, writes: 0 } : shown.current.get(path);
|
|
9541
|
+
shown.current.set(path, view);
|
|
9542
|
+
return view;
|
|
9543
|
+
});
|
|
9544
|
+
}, [live.loading, live.files, named, excluded, max]);
|
|
9545
|
+
if (list.length === 0) return null;
|
|
9546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9547
|
+
FileChips,
|
|
9548
|
+
{
|
|
9549
|
+
className: ["awr-msg__files--named", className].filter(Boolean).join(" "),
|
|
9550
|
+
written: list,
|
|
9551
|
+
files: vfs,
|
|
9552
|
+
showHeader,
|
|
9553
|
+
heading: L.filesNamed(list.length),
|
|
9554
|
+
imagesInViewer: true,
|
|
9555
|
+
htmlPreview,
|
|
9556
|
+
renderFile,
|
|
9557
|
+
renderFileContent,
|
|
9558
|
+
labels
|
|
9559
|
+
}
|
|
9560
|
+
);
|
|
9561
|
+
};
|
|
9245
9562
|
|
|
9246
9563
|
// src/components/StepList.tsx
|
|
9247
|
-
var
|
|
9564
|
+
var import_react24 = require("react");
|
|
9248
9565
|
|
|
9249
9566
|
// src/components/SubagentTree.tsx
|
|
9250
|
-
var
|
|
9251
|
-
var
|
|
9567
|
+
var import_react23 = require("react");
|
|
9568
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
9252
9569
|
var useElapsed = (startedAt, running) => {
|
|
9253
|
-
const [now, setNow] = (0,
|
|
9254
|
-
(0,
|
|
9570
|
+
const [now, setNow] = (0, import_react23.useState)(void 0);
|
|
9571
|
+
(0, import_react23.useEffect)(() => {
|
|
9255
9572
|
if (!running || startedAt === void 0) return;
|
|
9256
9573
|
setNow(Date.now());
|
|
9257
9574
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -9279,19 +9596,19 @@ var SubagentRow = ({
|
|
|
9279
9596
|
sub.toolCalls > 0 ? L.toolCalls(sub.toolCalls) : "",
|
|
9280
9597
|
time !== void 0 ? formatDuration(time) : ""
|
|
9281
9598
|
].filter(Boolean);
|
|
9282
|
-
return /* @__PURE__ */ (0,
|
|
9599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
9283
9600
|
"li",
|
|
9284
9601
|
{
|
|
9285
9602
|
className: `awr-subagent awr-subagent--${sub.status}${sub.dynamic ? " awr-subagent--dynamic" : ""}`,
|
|
9286
9603
|
"data-depth": sub.depth,
|
|
9287
9604
|
children: [
|
|
9288
|
-
/* @__PURE__ */ (0,
|
|
9289
|
-
/* @__PURE__ */ (0,
|
|
9290
|
-
/* @__PURE__ */ (0,
|
|
9291
|
-
sub.dynamic && role && /* @__PURE__ */ (0,
|
|
9292
|
-
sub.profile && /* @__PURE__ */ (0,
|
|
9293
|
-
/* @__PURE__ */ (0,
|
|
9294
|
-
running && onStop && /* @__PURE__ */ (0,
|
|
9605
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-subagent__head", children: [
|
|
9606
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StopIcon, { size: 13 }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlertIcon, { size: 13 }) }),
|
|
9607
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
|
|
9608
|
+
sub.dynamic && role && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
|
|
9609
|
+
sub.profile && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
9610
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
9611
|
+
running && onStop && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9295
9612
|
"button",
|
|
9296
9613
|
{
|
|
9297
9614
|
type: "button",
|
|
@@ -9299,16 +9616,16 @@ var SubagentRow = ({
|
|
|
9299
9616
|
"aria-label": L.stopSubagent,
|
|
9300
9617
|
title: L.stopSubagent,
|
|
9301
9618
|
onClick: () => onStop(sub.id),
|
|
9302
|
-
children: /* @__PURE__ */ (0,
|
|
9619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StopIcon, { size: 12 })
|
|
9303
9620
|
}
|
|
9304
9621
|
)
|
|
9305
9622
|
] }),
|
|
9306
|
-
showUsage && /* @__PURE__ */ (0,
|
|
9307
|
-
/* @__PURE__ */ (0,
|
|
9308
|
-
meta.map((part, i) => /* @__PURE__ */ (0,
|
|
9623
|
+
showUsage && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-subagent__meta", children: [
|
|
9624
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
|
|
9625
|
+
meta.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-subagent__metaitem", children: part }, i))
|
|
9309
9626
|
] }),
|
|
9310
|
-
showTools && sub.tools && /* @__PURE__ */ (0,
|
|
9311
|
-
/* @__PURE__ */ (0,
|
|
9627
|
+
showTools && sub.tools && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
|
|
9628
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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)}` : ""}` }),
|
|
9312
9629
|
children
|
|
9313
9630
|
]
|
|
9314
9631
|
}
|
|
@@ -9324,12 +9641,12 @@ var SubagentTree = ({
|
|
|
9324
9641
|
className
|
|
9325
9642
|
}) => {
|
|
9326
9643
|
if (subagents.length === 0) return null;
|
|
9327
|
-
const branch = (nodes, nested) => /* @__PURE__ */ (0,
|
|
9644
|
+
const branch = (nodes, nested) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9328
9645
|
"ul",
|
|
9329
9646
|
{
|
|
9330
9647
|
className: ["awr-subagents", nested ? "awr-subagents--nested" : className].filter(Boolean).join(" "),
|
|
9331
9648
|
children: nodes.map((node) => {
|
|
9332
|
-
const row = /* @__PURE__ */ (0,
|
|
9649
|
+
const row = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9333
9650
|
SubagentRow,
|
|
9334
9651
|
{
|
|
9335
9652
|
sub: node,
|
|
@@ -9341,7 +9658,7 @@ var SubagentTree = ({
|
|
|
9341
9658
|
},
|
|
9342
9659
|
node.id
|
|
9343
9660
|
);
|
|
9344
|
-
return renderSubagent ? /* @__PURE__ */ (0,
|
|
9661
|
+
return renderSubagent ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react23.Fragment, { children: renderSubagent(node, row) }, node.id) : row;
|
|
9345
9662
|
})
|
|
9346
9663
|
}
|
|
9347
9664
|
);
|
|
@@ -9349,7 +9666,7 @@ var SubagentTree = ({
|
|
|
9349
9666
|
};
|
|
9350
9667
|
|
|
9351
9668
|
// src/components/StepList.tsx
|
|
9352
|
-
var
|
|
9669
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
9353
9670
|
var WEB_SEARCH = "web_search";
|
|
9354
9671
|
var ToolCallRow = ({
|
|
9355
9672
|
call,
|
|
@@ -9367,27 +9684,27 @@ var ToolCallRow = ({
|
|
|
9367
9684
|
call.outputTokens ? `\u2248${formatTokens(call.outputTokens)} out` : "",
|
|
9368
9685
|
call.durationMs !== void 0 ? formatDuration(call.durationMs) : ""
|
|
9369
9686
|
].filter(Boolean).join(" \xB7 ");
|
|
9370
|
-
return /* @__PURE__ */ (0,
|
|
9687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
9371
9688
|
"li",
|
|
9372
9689
|
{
|
|
9373
9690
|
className: `awr-tool awr-tool--${state}${showTiers && call.attempt !== void 0 ? " awr-tool--earlier" : ""}`,
|
|
9374
9691
|
children: [
|
|
9375
|
-
/* @__PURE__ */ (0,
|
|
9376
|
-
/* @__PURE__ */ (0,
|
|
9377
|
-
/* @__PURE__ */ (0,
|
|
9378
|
-
previewValue(call.input) && /* @__PURE__ */ (0,
|
|
9379
|
-
call.status === "calling" && /* @__PURE__ */ (0,
|
|
9380
|
-
call.status === "done" && call.ok === false && /* @__PURE__ */ (0,
|
|
9381
|
-
showTiers && call.replayed && /* @__PURE__ */ (0,
|
|
9382
|
-
showTiers && call.attempt !== void 0 && /* @__PURE__ */ (0,
|
|
9383
|
-
call.app && /* @__PURE__ */ (0,
|
|
9384
|
-
/* @__PURE__ */ (0,
|
|
9692
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-tool__row", children: [
|
|
9693
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolIcon, { size: 13, className: "awr-tool__icon" }),
|
|
9694
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { className: "awr-tool__name", children: call.name }),
|
|
9695
|
+
previewValue(call.input) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-tool__args", children: previewValue(call.input) }),
|
|
9696
|
+
call.status === "calling" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
9697
|
+
call.status === "done" && call.ok === false && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-tool__badge", children: L.failed }),
|
|
9698
|
+
showTiers && call.replayed && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
|
|
9699
|
+
showTiers && call.attempt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
|
|
9700
|
+
call.app && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "awr-tool__tag awr-tool__tag--app", "data-app": call.app, children: [
|
|
9701
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AppIcon, { size: 10 }),
|
|
9385
9702
|
" ",
|
|
9386
9703
|
L.appTag
|
|
9387
9704
|
] }),
|
|
9388
|
-
showUsage && cost && /* @__PURE__ */ (0,
|
|
9705
|
+
showUsage && cost && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
|
|
9389
9706
|
] }),
|
|
9390
|
-
images.length > 0 && /* @__PURE__ */ (0,
|
|
9707
|
+
images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9391
9708
|
ImageThumb,
|
|
9392
9709
|
{
|
|
9393
9710
|
src,
|
|
@@ -9398,16 +9715,16 @@ var ToolCallRow = ({
|
|
|
9398
9715
|
},
|
|
9399
9716
|
i
|
|
9400
9717
|
)) }),
|
|
9401
|
-
search && /* @__PURE__ */ (0,
|
|
9402
|
-
/* @__PURE__ */ (0,
|
|
9403
|
-
/* @__PURE__ */ (0,
|
|
9718
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-search", children: [
|
|
9719
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "awr-search__query", children: [
|
|
9720
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GlobeIcon, { size: 12 }),
|
|
9404
9721
|
" ",
|
|
9405
9722
|
L.searchQuery,
|
|
9406
9723
|
" ",
|
|
9407
|
-
/* @__PURE__ */ (0,
|
|
9724
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("q", { children: search.query })
|
|
9408
9725
|
] }),
|
|
9409
|
-
search.results.length > 0 ? /* @__PURE__ */ (0,
|
|
9410
|
-
/* @__PURE__ */ (0,
|
|
9726
|
+
search.results.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "awr-search__result", children: [
|
|
9727
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9411
9728
|
"a",
|
|
9412
9729
|
{
|
|
9413
9730
|
className: "awr-search__title",
|
|
@@ -9418,13 +9735,13 @@ var ToolCallRow = ({
|
|
|
9418
9735
|
}
|
|
9419
9736
|
),
|
|
9420
9737
|
" ",
|
|
9421
|
-
/* @__PURE__ */ (0,
|
|
9738
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "awr-search__host", children: [
|
|
9422
9739
|
r.host,
|
|
9423
9740
|
r.date ? ` \xB7 ${r.date}` : ""
|
|
9424
9741
|
] }),
|
|
9425
|
-
r.snippet && /* @__PURE__ */ (0,
|
|
9426
|
-
] }, i)) }) : /* @__PURE__ */ (0,
|
|
9427
|
-
(search.filtered > 0 || search.truncated) && /* @__PURE__ */ (0,
|
|
9742
|
+
r.snippet && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "awr-search__snippet", children: r.snippet })
|
|
9743
|
+
] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "awr-search__note", children: L.searchNoResults }),
|
|
9744
|
+
(search.filtered > 0 || search.truncated) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "awr-search__note", children: [
|
|
9428
9745
|
search.filtered > 0 ? L.searchFiltered(search.filtered) : "",
|
|
9429
9746
|
search.truncated ? L.searchTruncated : ""
|
|
9430
9747
|
].filter(Boolean).join(" \xB7 ") })
|
|
@@ -9438,11 +9755,11 @@ var UserNoteRow = ({
|
|
|
9438
9755
|
labels
|
|
9439
9756
|
}) => {
|
|
9440
9757
|
const L = useLabels(labels);
|
|
9441
|
-
return /* @__PURE__ */ (0,
|
|
9442
|
-
/* @__PURE__ */ (0,
|
|
9443
|
-
/* @__PURE__ */ (0,
|
|
9444
|
-
/* @__PURE__ */ (0,
|
|
9445
|
-
note.origin === "another-tab" && /* @__PURE__ */ (0,
|
|
9758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
9759
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
9760
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
9761
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("q", { className: "awr-note__text", children: note.text }),
|
|
9762
|
+
note.origin === "another-tab" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-note__origin", children: L.fromAnotherTab })
|
|
9446
9763
|
] });
|
|
9447
9764
|
};
|
|
9448
9765
|
var decisionNote = (d, L) => {
|
|
@@ -9473,14 +9790,14 @@ var StepItem = ({
|
|
|
9473
9790
|
renderToolCall,
|
|
9474
9791
|
renderSubagent,
|
|
9475
9792
|
L
|
|
9476
|
-
}) => /* @__PURE__ */ (0,
|
|
9477
|
-
/* @__PURE__ */ (0,
|
|
9478
|
-
/* @__PURE__ */ (0,
|
|
9479
|
-
/* @__PURE__ */ (0,
|
|
9480
|
-
/* @__PURE__ */ (0,
|
|
9793
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
|
|
9794
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-step__head", children: [
|
|
9795
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlertIcon, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CheckIcon, { size: 14 }) }),
|
|
9796
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-step__index", children: `${step.index}/${step.total}` }),
|
|
9797
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-step__desc", children: step.step.description })
|
|
9481
9798
|
] }),
|
|
9482
|
-
showTiers && step.tier && /* @__PURE__ */ (0,
|
|
9483
|
-
/* @__PURE__ */ (0,
|
|
9799
|
+
showTiers && step.tier && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-step__meta", children: [
|
|
9800
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9484
9801
|
"span",
|
|
9485
9802
|
{
|
|
9486
9803
|
className: `awr-step__tier awr-step__tier--${step.tier}`,
|
|
@@ -9488,29 +9805,29 @@ var StepItem = ({
|
|
|
9488
9805
|
children: L.tierNames[step.tier]
|
|
9489
9806
|
}
|
|
9490
9807
|
),
|
|
9491
|
-
step.model && /* @__PURE__ */ (0,
|
|
9808
|
+
step.model && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-step__model", children: step.model })
|
|
9492
9809
|
] }),
|
|
9493
|
-
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ (0,
|
|
9494
|
-
/* @__PURE__ */ (0,
|
|
9495
|
-
/* @__PURE__ */ (0,
|
|
9496
|
-
/* @__PURE__ */ (0,
|
|
9810
|
+
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-step__escalated", children: [
|
|
9811
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "awr-step__escalated-line", children: [
|
|
9812
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArrowUpIcon, { size: 12 }),
|
|
9813
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
|
|
9497
9814
|
] }),
|
|
9498
|
-
e.text?.trim() && /* @__PURE__ */ (0,
|
|
9499
|
-
/* @__PURE__ */ (0,
|
|
9500
|
-
/* @__PURE__ */ (0,
|
|
9815
|
+
e.text?.trim() && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("details", { className: "awr-step__attempt", children: [
|
|
9816
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("summary", { children: L.escalatedAttemptText }),
|
|
9817
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "awr-step__text", children: e.text.trim() })
|
|
9501
9818
|
] })
|
|
9502
9819
|
] }, i)),
|
|
9503
|
-
showThoughts && step.reasoning.trim() && /* @__PURE__ */ (0,
|
|
9504
|
-
/* @__PURE__ */ (0,
|
|
9505
|
-
/* @__PURE__ */ (0,
|
|
9820
|
+
showThoughts && step.reasoning.trim() && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
|
|
9821
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("summary", { children: [
|
|
9822
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BrainIcon, { size: 13 }),
|
|
9506
9823
|
" ",
|
|
9507
9824
|
L.stepThoughts
|
|
9508
9825
|
] }),
|
|
9509
|
-
/* @__PURE__ */ (0,
|
|
9826
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "awr-thought__text", children: step.reasoning.trim() })
|
|
9510
9827
|
] }),
|
|
9511
|
-
step.text.trim() && /* @__PURE__ */ (0,
|
|
9512
|
-
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ (0,
|
|
9513
|
-
const row = /* @__PURE__ */ (0,
|
|
9828
|
+
step.text.trim() && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "awr-step__text", children: step.text.trim() }),
|
|
9829
|
+
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
|
|
9830
|
+
const row = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9514
9831
|
ToolCallRow,
|
|
9515
9832
|
{
|
|
9516
9833
|
call,
|
|
@@ -9520,15 +9837,15 @@ var StepItem = ({
|
|
|
9520
9837
|
},
|
|
9521
9838
|
i
|
|
9522
9839
|
);
|
|
9523
|
-
return renderToolCall ? /* @__PURE__ */ (0,
|
|
9840
|
+
return renderToolCall ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react24.Fragment, { children: renderToolCall(call, row) }, i) : row;
|
|
9524
9841
|
}) }),
|
|
9525
|
-
approvals.length > 0 && /* @__PURE__ */ (0,
|
|
9526
|
-
/* @__PURE__ */ (0,
|
|
9527
|
-
/* @__PURE__ */ (0,
|
|
9528
|
-
/* @__PURE__ */ (0,
|
|
9529
|
-
a.subagent && /* @__PURE__ */ (0,
|
|
9842
|
+
approvals.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
|
|
9843
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
|
|
9844
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { className: "awr-tool__name", children: a.name }),
|
|
9845
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
|
|
9846
|
+
a.subagent && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-tool__tag", children: L.subagentHelper })
|
|
9530
9847
|
] }, a.id)) }),
|
|
9531
|
-
showSubagents && /* @__PURE__ */ (0,
|
|
9848
|
+
showSubagents && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9532
9849
|
SubagentTree,
|
|
9533
9850
|
{
|
|
9534
9851
|
subagents,
|
|
@@ -9537,14 +9854,14 @@ var StepItem = ({
|
|
|
9537
9854
|
renderSubagent
|
|
9538
9855
|
}
|
|
9539
9856
|
),
|
|
9540
|
-
notes.length > 0 && /* @__PURE__ */ (0,
|
|
9541
|
-
step.blocked && step.summary && /* @__PURE__ */ (0,
|
|
9542
|
-
showReplanFailed && step.replanFailed && /* @__PURE__ */ (0,
|
|
9543
|
-
/* @__PURE__ */ (0,
|
|
9857
|
+
notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UserNoteRow, { note: n }, n.id)) }),
|
|
9858
|
+
step.blocked && step.summary && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "awr-step__blocked", children: step.summary }),
|
|
9859
|
+
showReplanFailed && step.replanFailed && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "awr-step__warn", title: step.replanFailed, children: [
|
|
9860
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlertIcon, { size: 12 }),
|
|
9544
9861
|
" ",
|
|
9545
9862
|
L.replanFailed
|
|
9546
9863
|
] }),
|
|
9547
|
-
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ (0,
|
|
9864
|
+
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9548
9865
|
"p",
|
|
9549
9866
|
{
|
|
9550
9867
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -9579,8 +9896,8 @@ var StepList = ({
|
|
|
9579
9896
|
const known = new Set(steps.map((s) => s.id));
|
|
9580
9897
|
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
9581
9898
|
const loose = showSubagents ? subagents.filter((s) => !s.stepId || !known.has(s.stepId)) : [];
|
|
9582
|
-
return /* @__PURE__ */ (0,
|
|
9583
|
-
steps.map((step) => /* @__PURE__ */ (0,
|
|
9899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
9900
|
+
steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9584
9901
|
StepItem,
|
|
9585
9902
|
{
|
|
9586
9903
|
step,
|
|
@@ -9602,7 +9919,7 @@ var StepList = ({
|
|
|
9602
9919
|
},
|
|
9603
9920
|
step.id
|
|
9604
9921
|
)),
|
|
9605
|
-
loose.length > 0 && /* @__PURE__ */ (0,
|
|
9922
|
+
loose.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9606
9923
|
SubagentTree,
|
|
9607
9924
|
{
|
|
9608
9925
|
subagents: loose,
|
|
@@ -9611,12 +9928,12 @@ var StepList = ({
|
|
|
9611
9928
|
renderSubagent
|
|
9612
9929
|
}
|
|
9613
9930
|
) }),
|
|
9614
|
-
atEnd.length > 0 && /* @__PURE__ */ (0,
|
|
9931
|
+
atEnd.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UserNoteRow, { note: n }, n.id)) }) })
|
|
9615
9932
|
] });
|
|
9616
9933
|
};
|
|
9617
9934
|
|
|
9618
9935
|
// src/components/MessageList.tsx
|
|
9619
|
-
var
|
|
9936
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
9620
9937
|
var usageLine = (usage, durationMs) => {
|
|
9621
9938
|
const parts = [];
|
|
9622
9939
|
if (usage && usage.totalTokens > 0) {
|
|
@@ -9650,8 +9967,8 @@ var AttachedAudio = ({
|
|
|
9650
9967
|
const url = useFileUrl(files, a.path ?? "", files && a.path ? type : void 0);
|
|
9651
9968
|
const length = lengthOf(a.durationMs);
|
|
9652
9969
|
const said = length !== void 0 ? L.audioDuration(formatClock(length)) : void 0;
|
|
9653
|
-
return url ? /* @__PURE__ */ (0,
|
|
9654
|
-
/* @__PURE__ */ (0,
|
|
9970
|
+
return url ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "awr-media awr-media--audio awr-msg__audio", title: a.path ?? a.name, children: [
|
|
9971
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
9655
9972
|
"audio",
|
|
9656
9973
|
{
|
|
9657
9974
|
className: "awr-media__audio",
|
|
@@ -9662,9 +9979,9 @@ var AttachedAudio = ({
|
|
|
9662
9979
|
onLoadedMetadata: (e) => settleAudioDuration(e.currentTarget)
|
|
9663
9980
|
}
|
|
9664
9981
|
),
|
|
9665
|
-
said && /* @__PURE__ */ (0,
|
|
9666
|
-
] }) : /* @__PURE__ */ (0,
|
|
9667
|
-
/* @__PURE__ */ (0,
|
|
9982
|
+
said && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "awr-msg__audiolen", "aria-hidden": "true", children: said })
|
|
9983
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
|
|
9984
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(WaveIcon, { size: 13 }),
|
|
9668
9985
|
" ",
|
|
9669
9986
|
a.name,
|
|
9670
9987
|
said ? ` \xB7 ${said}` : ""
|
|
@@ -9674,7 +9991,7 @@ var AttachmentView = ({
|
|
|
9674
9991
|
attachment: a,
|
|
9675
9992
|
files,
|
|
9676
9993
|
labels
|
|
9677
|
-
}) => mediaFamilyOf(a.mediaType) === "audio" ? /* @__PURE__ */ (0,
|
|
9994
|
+
}) => mediaFamilyOf(a.mediaType) === "audio" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AttachedAudio, { attachment: a, files, labels }) : a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
9678
9995
|
ImageThumb,
|
|
9679
9996
|
{
|
|
9680
9997
|
src: a.dataUrl,
|
|
@@ -9683,8 +10000,8 @@ var AttachmentView = ({
|
|
|
9683
10000
|
imgClassName: "awr-thumb awr-thumb--msg",
|
|
9684
10001
|
title: a.path ?? a.name
|
|
9685
10002
|
}
|
|
9686
|
-
) : /* @__PURE__ */ (0,
|
|
9687
|
-
/* @__PURE__ */ (0,
|
|
10003
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
|
|
10004
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FileIcon, { size: 13 }),
|
|
9688
10005
|
" ",
|
|
9689
10006
|
a.name
|
|
9690
10007
|
] });
|
|
@@ -9725,6 +10042,7 @@ var MessageList = ({
|
|
|
9725
10042
|
showSubagents = true,
|
|
9726
10043
|
showMedia = true,
|
|
9727
10044
|
showFileChips = true,
|
|
10045
|
+
showNamedFiles = showFileChips,
|
|
9728
10046
|
files,
|
|
9729
10047
|
htmlPreview,
|
|
9730
10048
|
onShowFiles,
|
|
@@ -9752,128 +10070,157 @@ var MessageList = ({
|
|
|
9752
10070
|
const L = useLabels(labels);
|
|
9753
10071
|
const reader = useReadAloud(readAloud?.speak, readAloud?.lang);
|
|
9754
10072
|
if (messages.length === 0) {
|
|
9755
|
-
return empty ? /* @__PURE__ */ (0,
|
|
9756
|
-
}
|
|
9757
|
-
return /* @__PURE__ */ (0,
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
"div",
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
10073
|
+
return empty ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-messages__empty", children: empty }) : null;
|
|
10074
|
+
}
|
|
10075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
10076
|
+
TranscriptContext,
|
|
10077
|
+
{
|
|
10078
|
+
imageViewer,
|
|
10079
|
+
renderImageViewer,
|
|
10080
|
+
files: showFileChips || showNamedFiles ? files : void 0,
|
|
10081
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
|
|
10082
|
+
const steps = m.steps ?? [];
|
|
10083
|
+
const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
|
|
10084
|
+
const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
|
|
10085
|
+
const cards = showToolCards && renderToolCard && m.role === "assistant" ? toolCardsOf(m, renderToolCard) : [];
|
|
10086
|
+
const node = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
10087
|
+
"div",
|
|
10088
|
+
{
|
|
10089
|
+
className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
|
|
10090
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-msg__col", children: [
|
|
10091
|
+
m.role === "assistant" && hasActivity && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
|
|
10092
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("summary", { className: "awr-activity__summary", children: activitySummary(
|
|
10093
|
+
m,
|
|
10094
|
+
showToolCalls,
|
|
10095
|
+
showLearned,
|
|
10096
|
+
showTiers,
|
|
10097
|
+
showFileChips,
|
|
10098
|
+
L,
|
|
10099
|
+
showApps && Boolean(renderApp)
|
|
10100
|
+
) }),
|
|
10101
|
+
m.pending && liveExtra,
|
|
10102
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
10103
|
+
StepList,
|
|
10104
|
+
{
|
|
10105
|
+
steps,
|
|
10106
|
+
subagents: m.subagents,
|
|
10107
|
+
approvals: m.approvals,
|
|
10108
|
+
notes: m.notes,
|
|
10109
|
+
showNotes,
|
|
10110
|
+
onStopSubagent: m.pending ? onStopSubagent : void 0,
|
|
10111
|
+
showToolCalls,
|
|
10112
|
+
showUsage,
|
|
10113
|
+
showThoughts,
|
|
10114
|
+
showTiers,
|
|
10115
|
+
showReplanFailed,
|
|
10116
|
+
showDecisions,
|
|
10117
|
+
showSearchResults,
|
|
10118
|
+
showSubagents,
|
|
10119
|
+
renderToolCall,
|
|
10120
|
+
renderSubagent,
|
|
10121
|
+
labels
|
|
10122
|
+
}
|
|
10123
|
+
),
|
|
10124
|
+
showLearned && m.fetches?.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
10125
|
+
"li",
|
|
10126
|
+
{
|
|
10127
|
+
className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
|
|
10128
|
+
children: [
|
|
10129
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GlobeIcon, { size: 12 }),
|
|
10130
|
+
" ",
|
|
10131
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { children: f.url }),
|
|
10132
|
+
" ",
|
|
10133
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
|
|
10134
|
+
]
|
|
10135
|
+
},
|
|
10136
|
+
i
|
|
10137
|
+
)) }) : null,
|
|
10138
|
+
showLearned && m.learned?.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "awr-learned", children: [
|
|
10139
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BookIcon, { size: 12 }),
|
|
9808
10140
|
" ",
|
|
9809
|
-
|
|
9810
|
-
]
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
/* @__PURE__ */ (0,
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
10141
|
+
L.learnedNow(m.learned.join(", "))
|
|
10142
|
+
] }) : null,
|
|
10143
|
+
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("details", { className: "awr-thought", children: [
|
|
10144
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("summary", { children: [
|
|
10145
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BrainIcon, { size: 13 }),
|
|
10146
|
+
" ",
|
|
10147
|
+
L.answerThoughts
|
|
10148
|
+
] }),
|
|
10149
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-thought__text", children: m.reasoning.trim() })
|
|
10150
|
+
] })
|
|
10151
|
+
] }),
|
|
10152
|
+
cards.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-msg__cards", children: cards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-msg__card", children: card.node }, card.key)) }),
|
|
10153
|
+
showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-msg__apps", children: m.apps.map((app) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-msg__app", children: renderApp(app, m) }, app.id)) }) : null,
|
|
10154
|
+
showMedia && m.transcripts?.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
|
|
10155
|
+
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-msg__bubble", children: [
|
|
10156
|
+
m.content ? renderContent ? renderContent(m) : m.content : m.stopped && !m.pending ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "awr-msg__stopped", children: L.answerStopped }) : null,
|
|
10157
|
+
m.pending && !m.content && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
|
|
9824
10158
|
] }),
|
|
9825
|
-
|
|
10159
|
+
readAloud && m.role === "assistant" && m.content && !m.pending && !m.error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
10160
|
+
ReadAloudControl,
|
|
10161
|
+
{
|
|
10162
|
+
id: m.id,
|
|
10163
|
+
text: () => readAloud.textOf ? readAloud.textOf(m) : speakableText(m.content, { code: L.readAloudCode }),
|
|
10164
|
+
reader,
|
|
10165
|
+
labels: L
|
|
10166
|
+
}
|
|
10167
|
+
),
|
|
10168
|
+
showMedia && m.media?.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
10169
|
+
const built = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GeneratedMedia, { media: item, files, labels }, i);
|
|
10170
|
+
return renderMedia ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
10171
|
+
}) }) : null,
|
|
10172
|
+
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
10173
|
+
FileChips,
|
|
10174
|
+
{
|
|
10175
|
+
written: m.writtenFiles,
|
|
10176
|
+
files,
|
|
10177
|
+
htmlPreview,
|
|
10178
|
+
onShowFiles,
|
|
10179
|
+
renderFile: renderFile ? (f, fallback) => renderFile(f, m, fallback) : void 0,
|
|
10180
|
+
renderFileContent,
|
|
10181
|
+
labels
|
|
10182
|
+
}
|
|
10183
|
+
) : null,
|
|
10184
|
+
showNamedFiles && files && m.role === "assistant" && !m.pending && m.content ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
10185
|
+
NamedFileChips,
|
|
10186
|
+
{
|
|
10187
|
+
text: m.content,
|
|
10188
|
+
files,
|
|
10189
|
+
exclude: [
|
|
10190
|
+
...showFileChips ? (m.writtenFiles ?? []).map((f) => f.path) : [],
|
|
10191
|
+
...showMedia ? (m.media ?? []).map((x) => x.path) : []
|
|
10192
|
+
],
|
|
10193
|
+
htmlPreview,
|
|
10194
|
+
renderFile: renderFile ? (f, fallback) => renderFile(f, m, fallback) : void 0,
|
|
10195
|
+
renderFileContent,
|
|
10196
|
+
labels
|
|
10197
|
+
}
|
|
10198
|
+
) : null,
|
|
10199
|
+
m.attachments?.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
10200
|
+
"div",
|
|
10201
|
+
{
|
|
10202
|
+
className: "awr-msg__attachments",
|
|
10203
|
+
role: "group",
|
|
10204
|
+
"aria-label": m.content.trim() ? L.attachments : attachmentsText(m.attachments, { voiceMessage: L.voiceMessage }),
|
|
10205
|
+
children: m.attachments.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AttachmentView, { attachment: a, files, labels }) }, i))
|
|
10206
|
+
}
|
|
10207
|
+
) : null,
|
|
10208
|
+
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
9826
10209
|
] })
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
] }),
|
|
9835
|
-
readAloud && m.role === "assistant" && m.content && !m.pending && !m.error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9836
|
-
ReadAloudControl,
|
|
9837
|
-
{
|
|
9838
|
-
id: m.id,
|
|
9839
|
-
text: () => readAloud.textOf ? readAloud.textOf(m) : speakableText(m.content, { code: L.readAloudCode }),
|
|
9840
|
-
reader,
|
|
9841
|
-
labels: L
|
|
9842
|
-
}
|
|
9843
|
-
),
|
|
9844
|
-
showMedia && m.media?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
9845
|
-
const built = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GeneratedMedia, { media: item, files, labels }, i);
|
|
9846
|
-
return renderMedia ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
9847
|
-
}) }) : null,
|
|
9848
|
-
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9849
|
-
FileChips,
|
|
9850
|
-
{
|
|
9851
|
-
written: m.writtenFiles,
|
|
9852
|
-
files,
|
|
9853
|
-
htmlPreview,
|
|
9854
|
-
onShowFiles,
|
|
9855
|
-
renderFile: renderFile ? (f, fallback) => renderFile(f, m, fallback) : void 0,
|
|
9856
|
-
renderFileContent,
|
|
9857
|
-
labels
|
|
9858
|
-
}
|
|
9859
|
-
) : null,
|
|
9860
|
-
m.attachments?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
9861
|
-
"div",
|
|
9862
|
-
{
|
|
9863
|
-
className: "awr-msg__attachments",
|
|
9864
|
-
role: "group",
|
|
9865
|
-
"aria-label": m.content.trim() ? L.attachments : attachmentsText(m.attachments, { voiceMessage: L.voiceMessage }),
|
|
9866
|
-
children: m.attachments.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AttachmentView, { attachment: a, files, labels }) }, i))
|
|
9867
|
-
}
|
|
9868
|
-
) : null,
|
|
9869
|
-
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
9870
|
-
] })
|
|
9871
|
-
},
|
|
9872
|
-
m.id
|
|
9873
|
-
);
|
|
9874
|
-
return renderMessage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: renderMessage(m, node) }, m.id) : node;
|
|
9875
|
-
}) }) });
|
|
10210
|
+
},
|
|
10211
|
+
m.id
|
|
10212
|
+
);
|
|
10213
|
+
return renderMessage ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: renderMessage(m, node) }, m.id) : node;
|
|
10214
|
+
}) })
|
|
10215
|
+
}
|
|
10216
|
+
);
|
|
9876
10217
|
};
|
|
10218
|
+
var TranscriptContext = ({
|
|
10219
|
+
imageViewer,
|
|
10220
|
+
renderImageViewer,
|
|
10221
|
+
files,
|
|
10222
|
+
children
|
|
10223
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(WorkspaceListingProvider, { files, children }) });
|
|
9877
10224
|
var ReadAloudControl = ({
|
|
9878
10225
|
id,
|
|
9879
10226
|
text: text2,
|
|
@@ -9882,8 +10229,8 @@ var ReadAloudControl = ({
|
|
|
9882
10229
|
}) => {
|
|
9883
10230
|
const mine = reader.current === id;
|
|
9884
10231
|
const failed = reader.failed?.id === id ? reader.failed : void 0;
|
|
9885
|
-
return /* @__PURE__ */ (0,
|
|
9886
|
-
!mine ? /* @__PURE__ */ (0,
|
|
10232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-readaloud", "data-state": mine ? reader.state : "idle", children: [
|
|
10233
|
+
!mine ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
9887
10234
|
"button",
|
|
9888
10235
|
{
|
|
9889
10236
|
type: "button",
|
|
@@ -9891,17 +10238,17 @@ var ReadAloudControl = ({
|
|
|
9891
10238
|
onClick: () => reader.start(id, text2()),
|
|
9892
10239
|
"aria-label": L.readAloud,
|
|
9893
10240
|
children: [
|
|
9894
|
-
/* @__PURE__ */ (0,
|
|
10241
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SpeakerIcon, { size: 14 }),
|
|
9895
10242
|
" ",
|
|
9896
10243
|
L.readAloud
|
|
9897
10244
|
]
|
|
9898
10245
|
}
|
|
9899
|
-
) : /* @__PURE__ */ (0,
|
|
9900
|
-
reader.state === "loading" ? /* @__PURE__ */ (0,
|
|
9901
|
-
/* @__PURE__ */ (0,
|
|
10246
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
10247
|
+
reader.state === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "awr-readaloud__status", role: "status", children: [
|
|
10248
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SpinnerIcon, { size: 14 }),
|
|
9902
10249
|
" ",
|
|
9903
10250
|
L.readAloudLoading
|
|
9904
|
-
] }) : reader.state === "paused" ? /* @__PURE__ */ (0,
|
|
10251
|
+
] }) : reader.state === "paused" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
9905
10252
|
"button",
|
|
9906
10253
|
{
|
|
9907
10254
|
type: "button",
|
|
@@ -9909,12 +10256,12 @@ var ReadAloudControl = ({
|
|
|
9909
10256
|
onClick: reader.resume,
|
|
9910
10257
|
"aria-label": L.readAloudResume,
|
|
9911
10258
|
children: [
|
|
9912
|
-
/* @__PURE__ */ (0,
|
|
10259
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlayIcon, { size: 14 }),
|
|
9913
10260
|
" ",
|
|
9914
10261
|
L.readAloudResume
|
|
9915
10262
|
]
|
|
9916
10263
|
}
|
|
9917
|
-
) : /* @__PURE__ */ (0,
|
|
10264
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
9918
10265
|
"button",
|
|
9919
10266
|
{
|
|
9920
10267
|
type: "button",
|
|
@@ -9922,13 +10269,13 @@ var ReadAloudControl = ({
|
|
|
9922
10269
|
onClick: reader.pause,
|
|
9923
10270
|
"aria-label": L.readAloudPause,
|
|
9924
10271
|
children: [
|
|
9925
|
-
/* @__PURE__ */ (0,
|
|
10272
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PauseIcon, { size: 14 }),
|
|
9926
10273
|
" ",
|
|
9927
10274
|
L.readAloudPause
|
|
9928
10275
|
]
|
|
9929
10276
|
}
|
|
9930
10277
|
),
|
|
9931
|
-
/* @__PURE__ */ (0,
|
|
10278
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
9932
10279
|
"button",
|
|
9933
10280
|
{
|
|
9934
10281
|
type: "button",
|
|
@@ -9936,39 +10283,39 @@ var ReadAloudControl = ({
|
|
|
9936
10283
|
onClick: reader.stop,
|
|
9937
10284
|
"aria-label": L.readAloudStop,
|
|
9938
10285
|
children: [
|
|
9939
|
-
/* @__PURE__ */ (0,
|
|
10286
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StopIcon, { size: 14 }),
|
|
9940
10287
|
" ",
|
|
9941
10288
|
L.readAloudStop
|
|
9942
10289
|
]
|
|
9943
10290
|
}
|
|
9944
10291
|
)
|
|
9945
10292
|
] }),
|
|
9946
|
-
failed && /* @__PURE__ */ (0,
|
|
10293
|
+
failed && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "awr-readaloud__error", role: "alert", children: failed.message ?? L.readAloudFailed })
|
|
9947
10294
|
] });
|
|
9948
10295
|
};
|
|
9949
10296
|
|
|
9950
10297
|
// src/components/ModelLoadBar.tsx
|
|
9951
|
-
var
|
|
10298
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
9952
10299
|
var ModelLoadBar = ({ load, className }) => {
|
|
9953
10300
|
const pct = Math.round(Math.max(0, Math.min(1, load.progress)) * 100);
|
|
9954
|
-
return /* @__PURE__ */ (0,
|
|
9955
|
-
/* @__PURE__ */ (0,
|
|
9956
|
-
/* @__PURE__ */ (0,
|
|
9957
|
-
/* @__PURE__ */ (0,
|
|
10301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
|
|
10302
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-modelload__head", children: [
|
|
10303
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
|
|
10304
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "awr-modelload__pct", children: [
|
|
9958
10305
|
pct,
|
|
9959
10306
|
"%"
|
|
9960
10307
|
] })
|
|
9961
10308
|
] }),
|
|
9962
|
-
/* @__PURE__ */ (0,
|
|
10309
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
|
|
9963
10310
|
] });
|
|
9964
10311
|
};
|
|
9965
10312
|
|
|
9966
10313
|
// src/components/QuestionPrompt.tsx
|
|
9967
|
-
var
|
|
9968
|
-
var
|
|
10314
|
+
var import_react25 = require("react");
|
|
10315
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
9969
10316
|
var useNow2 = (active) => {
|
|
9970
|
-
const [now, setNow] = (0,
|
|
9971
|
-
(0,
|
|
10317
|
+
const [now, setNow] = (0, import_react25.useState)(() => Date.now());
|
|
10318
|
+
(0, import_react25.useEffect)(() => {
|
|
9972
10319
|
if (!active) return;
|
|
9973
10320
|
setNow(Date.now());
|
|
9974
10321
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -9978,7 +10325,7 @@ var useNow2 = (active) => {
|
|
|
9978
10325
|
};
|
|
9979
10326
|
var Expiry2 = ({ expiresAt, L }) => {
|
|
9980
10327
|
const now = useNow2(true);
|
|
9981
|
-
return /* @__PURE__ */ (0,
|
|
10328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-question__expiry", children: L.questionExpiresIn(formatCountdown(expiresAt - now)) });
|
|
9982
10329
|
};
|
|
9983
10330
|
var reasonText2 = (q, L) => {
|
|
9984
10331
|
const key = q.reason ?? q.status;
|
|
@@ -9997,15 +10344,15 @@ var QuestionCard = ({
|
|
|
9997
10344
|
numberKeys,
|
|
9998
10345
|
L
|
|
9999
10346
|
}) => {
|
|
10000
|
-
const baseId = (0,
|
|
10347
|
+
const baseId = (0, import_react25.useId)();
|
|
10001
10348
|
const textId = `${baseId}-q`;
|
|
10002
10349
|
const otherId = `${baseId}-other`;
|
|
10003
|
-
const [picked, setPicked] = (0,
|
|
10004
|
-
const [otherOpen, setOtherOpen] = (0,
|
|
10005
|
-
const [otherText, setOtherText] = (0,
|
|
10006
|
-
const otherField = (0,
|
|
10007
|
-
const otherButton = (0,
|
|
10008
|
-
(0,
|
|
10350
|
+
const [picked, setPicked] = (0, import_react25.useState)([]);
|
|
10351
|
+
const [otherOpen, setOtherOpen] = (0, import_react25.useState)(false);
|
|
10352
|
+
const [otherText, setOtherText] = (0, import_react25.useState)("");
|
|
10353
|
+
const otherField = (0, import_react25.useRef)(null);
|
|
10354
|
+
const otherButton = (0, import_react25.useRef)(null);
|
|
10355
|
+
(0, import_react25.useEffect)(() => {
|
|
10009
10356
|
if (otherOpen) otherField.current?.focus();
|
|
10010
10357
|
}, [otherOpen]);
|
|
10011
10358
|
const helper = showHelper && q.subagent ? { ...q.subagent, ...view?.subagent } : void 0;
|
|
@@ -10032,7 +10379,7 @@ var QuestionCard = ({
|
|
|
10032
10379
|
e.preventDefault();
|
|
10033
10380
|
pick(option.label);
|
|
10034
10381
|
};
|
|
10035
|
-
return /* @__PURE__ */ (0,
|
|
10382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10036
10383
|
"section",
|
|
10037
10384
|
{
|
|
10038
10385
|
className: `awr-question${q.multiple ? " awr-question--multiple" : ""}${helper ? " awr-question--helper" : ""}`,
|
|
@@ -10042,16 +10389,16 @@ var QuestionCard = ({
|
|
|
10042
10389
|
"data-subagent": helper?.id,
|
|
10043
10390
|
onKeyDown,
|
|
10044
10391
|
children: [
|
|
10045
|
-
/* @__PURE__ */ (0,
|
|
10046
|
-
/* @__PURE__ */ (0,
|
|
10047
|
-
/* @__PURE__ */ (0,
|
|
10048
|
-
total > 1 && /* @__PURE__ */ (0,
|
|
10392
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-question__head", children: [
|
|
10393
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(QuestionIcon, { size: 16, className: "awr-question__icon" }),
|
|
10394
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-question__lead", role: "alert", children: leadOf(helper, L) }),
|
|
10395
|
+
total > 1 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-question__count", children: L.questionCount(index, total) })
|
|
10049
10396
|
] }),
|
|
10050
|
-
/* @__PURE__ */ (0,
|
|
10051
|
-
q.multiple && /* @__PURE__ */ (0,
|
|
10052
|
-
/* @__PURE__ */ (0,
|
|
10397
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-question__text", id: textId, children: q.question }),
|
|
10398
|
+
q.multiple && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-question__hint", children: L.questionSeveral }),
|
|
10399
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "awr-question__options", children: q.options.map((o, i) => {
|
|
10053
10400
|
const on = picked.includes(o.label);
|
|
10054
|
-
return /* @__PURE__ */ (0,
|
|
10401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10055
10402
|
"button",
|
|
10056
10403
|
{
|
|
10057
10404
|
type: "button",
|
|
@@ -10061,21 +10408,21 @@ var QuestionCard = ({
|
|
|
10061
10408
|
"aria-keyshortcuts": numberKeys && i < 9 ? String(i + 1) : void 0,
|
|
10062
10409
|
onClick: () => pick(o.label),
|
|
10063
10410
|
children: [
|
|
10064
|
-
numberKeys && i < 9 && /* @__PURE__ */ (0,
|
|
10065
|
-
/* @__PURE__ */ (0,
|
|
10066
|
-
/* @__PURE__ */ (0,
|
|
10067
|
-
o.description && /* @__PURE__ */ (0,
|
|
10411
|
+
numberKeys && i < 9 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-question__key", "aria-hidden": "true", children: i + 1 }),
|
|
10412
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "awr-question__body", children: [
|
|
10413
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-question__label", children: o.label }),
|
|
10414
|
+
o.description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-question__desc", children: o.description })
|
|
10068
10415
|
] }),
|
|
10069
|
-
q.multiple && /* @__PURE__ */ (0,
|
|
10416
|
+
q.multiple && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-question__mark", "aria-hidden": "true", children: on && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckIcon, { size: 14 }) })
|
|
10070
10417
|
]
|
|
10071
10418
|
},
|
|
10072
10419
|
o.label
|
|
10073
10420
|
);
|
|
10074
10421
|
}) }),
|
|
10075
|
-
q.allowOther && otherOpen && /* @__PURE__ */ (0,
|
|
10076
|
-
/* @__PURE__ */ (0,
|
|
10077
|
-
/* @__PURE__ */ (0,
|
|
10078
|
-
/* @__PURE__ */ (0,
|
|
10422
|
+
q.allowOther && otherOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("form", { className: "awr-question__other", onSubmit: sendOther, children: [
|
|
10423
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { className: "awr-question__otherlabel", htmlFor: otherId, children: L.questionOtherLabel }),
|
|
10424
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-question__otherrow", children: [
|
|
10425
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10079
10426
|
"input",
|
|
10080
10427
|
{
|
|
10081
10428
|
ref: otherField,
|
|
@@ -10094,11 +10441,11 @@ var QuestionCard = ({
|
|
|
10094
10441
|
}
|
|
10095
10442
|
}
|
|
10096
10443
|
),
|
|
10097
|
-
/* @__PURE__ */ (0,
|
|
10444
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "submit", className: "awr-btn awr-btn--primary", disabled: !other, children: L.questionSend })
|
|
10098
10445
|
] })
|
|
10099
10446
|
] }),
|
|
10100
|
-
/* @__PURE__ */ (0,
|
|
10101
|
-
q.multiple && !otherOpen && /* @__PURE__ */ (0,
|
|
10447
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-question__actions", children: [
|
|
10448
|
+
q.multiple && !otherOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10102
10449
|
"button",
|
|
10103
10450
|
{
|
|
10104
10451
|
type: "button",
|
|
@@ -10108,7 +10455,7 @@ var QuestionCard = ({
|
|
|
10108
10455
|
children: L.questionSend
|
|
10109
10456
|
}
|
|
10110
10457
|
),
|
|
10111
|
-
q.allowOther && /* @__PURE__ */ (0,
|
|
10458
|
+
q.allowOther && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10112
10459
|
"button",
|
|
10113
10460
|
{
|
|
10114
10461
|
ref: otherButton,
|
|
@@ -10120,7 +10467,7 @@ var QuestionCard = ({
|
|
|
10120
10467
|
children: L.questionOther
|
|
10121
10468
|
}
|
|
10122
10469
|
),
|
|
10123
|
-
/* @__PURE__ */ (0,
|
|
10470
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10124
10471
|
"button",
|
|
10125
10472
|
{
|
|
10126
10473
|
type: "button",
|
|
@@ -10130,14 +10477,14 @@ var QuestionCard = ({
|
|
|
10130
10477
|
}
|
|
10131
10478
|
)
|
|
10132
10479
|
] }),
|
|
10133
|
-
showExpiry && q.expiresAt !== void 0 && /* @__PURE__ */ (0,
|
|
10480
|
+
showExpiry && q.expiresAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Expiry2, { expiresAt: q.expiresAt, L })
|
|
10134
10481
|
]
|
|
10135
10482
|
}
|
|
10136
10483
|
);
|
|
10137
10484
|
};
|
|
10138
10485
|
var RemoteQuestion = ({ view, L }) => {
|
|
10139
|
-
const textId = `${(0,
|
|
10140
|
-
return /* @__PURE__ */ (0,
|
|
10486
|
+
const textId = `${(0, import_react25.useId)()}-q`;
|
|
10487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10141
10488
|
"section",
|
|
10142
10489
|
{
|
|
10143
10490
|
className: "awr-question awr-question--remote",
|
|
@@ -10145,16 +10492,16 @@ var RemoteQuestion = ({ view, L }) => {
|
|
|
10145
10492
|
"aria-labelledby": textId,
|
|
10146
10493
|
"data-question": view.id,
|
|
10147
10494
|
children: [
|
|
10148
|
-
/* @__PURE__ */ (0,
|
|
10149
|
-
/* @__PURE__ */ (0,
|
|
10150
|
-
/* @__PURE__ */ (0,
|
|
10495
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-question__head", children: [
|
|
10496
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(QuestionIcon, { size: 16, className: "awr-question__icon" }),
|
|
10497
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-question__lead", children: leadOf(view.subagent, L) })
|
|
10151
10498
|
] }),
|
|
10152
|
-
/* @__PURE__ */ (0,
|
|
10153
|
-
/* @__PURE__ */ (0,
|
|
10154
|
-
/* @__PURE__ */ (0,
|
|
10155
|
-
o.description && /* @__PURE__ */ (0,
|
|
10499
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-question__text", id: textId, children: view.question }),
|
|
10500
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { className: "awr-question__list", children: view.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("li", { children: [
|
|
10501
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-question__label", children: o.label }),
|
|
10502
|
+
o.description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-question__desc", children: o.description })
|
|
10156
10503
|
] }, o.label)) }),
|
|
10157
|
-
/* @__PURE__ */ (0,
|
|
10504
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-question__remote", role: "status", children: L.questionRemote })
|
|
10158
10505
|
]
|
|
10159
10506
|
}
|
|
10160
10507
|
);
|
|
@@ -10173,7 +10520,7 @@ var QuestionPrompt = ({
|
|
|
10173
10520
|
className
|
|
10174
10521
|
}) => {
|
|
10175
10522
|
const L = useLabels(labels);
|
|
10176
|
-
const [dismissed, setDismissed] = (0,
|
|
10523
|
+
const [dismissed, setDismissed] = (0, import_react25.useState)(() => /* @__PURE__ */ new Set());
|
|
10177
10524
|
const automatic = showOutcomes ? (outcomes ?? []).filter(
|
|
10178
10525
|
(o) => o.automatic === true && o.status !== "pending" && o.status !== "stopped" && !dismissed.has(o.id)
|
|
10179
10526
|
) : [];
|
|
@@ -10183,7 +10530,7 @@ var QuestionPrompt = ({
|
|
|
10183
10530
|
let card = null;
|
|
10184
10531
|
if (current) {
|
|
10185
10532
|
const answer = (a) => onAnswer(current.id, a);
|
|
10186
|
-
const builtIn = /* @__PURE__ */ (0,
|
|
10533
|
+
const builtIn = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10187
10534
|
QuestionCard,
|
|
10188
10535
|
{
|
|
10189
10536
|
question: current,
|
|
@@ -10200,21 +10547,21 @@ var QuestionPrompt = ({
|
|
|
10200
10547
|
);
|
|
10201
10548
|
card = renderQuestion ? renderQuestion(current, builtIn, answer) : builtIn;
|
|
10202
10549
|
}
|
|
10203
|
-
return /* @__PURE__ */ (0,
|
|
10204
|
-
automatic.map((o) => /* @__PURE__ */ (0,
|
|
10550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: ["awr-questions", className].filter(Boolean).join(" "), children: [
|
|
10551
|
+
automatic.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10205
10552
|
"div",
|
|
10206
10553
|
{
|
|
10207
10554
|
className: "awr-question-outcome",
|
|
10208
10555
|
role: "status",
|
|
10209
10556
|
"data-reason": o.reason ?? o.status,
|
|
10210
10557
|
children: [
|
|
10211
|
-
/* @__PURE__ */ (0,
|
|
10212
|
-
/* @__PURE__ */ (0,
|
|
10558
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AlertIcon, { size: 14, className: "awr-question-outcome__icon" }),
|
|
10559
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "awr-question-outcome__text", children: [
|
|
10213
10560
|
L.questionAutomatic(reasonText2(o, L)),
|
|
10214
10561
|
" ",
|
|
10215
|
-
/* @__PURE__ */ (0,
|
|
10562
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("q", { className: "awr-question-outcome__question", children: o.question })
|
|
10216
10563
|
] }),
|
|
10217
|
-
/* @__PURE__ */ (0,
|
|
10564
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10218
10565
|
"button",
|
|
10219
10566
|
{
|
|
10220
10567
|
type: "button",
|
|
@@ -10222,20 +10569,20 @@ var QuestionPrompt = ({
|
|
|
10222
10569
|
"aria-label": L.questionDismiss,
|
|
10223
10570
|
title: L.questionDismiss,
|
|
10224
10571
|
onClick: () => setDismissed((d) => new Set(d).add(o.id)),
|
|
10225
|
-
children: /* @__PURE__ */ (0,
|
|
10572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(XIcon, { size: 14 })
|
|
10226
10573
|
}
|
|
10227
10574
|
)
|
|
10228
10575
|
]
|
|
10229
10576
|
},
|
|
10230
10577
|
o.id
|
|
10231
10578
|
)),
|
|
10232
|
-
remote.map((o) => /* @__PURE__ */ (0,
|
|
10579
|
+
remote.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RemoteQuestion, { view: o, L }, o.id)),
|
|
10233
10580
|
card
|
|
10234
10581
|
] });
|
|
10235
10582
|
};
|
|
10236
10583
|
|
|
10237
10584
|
// src/components/ToolApprovalPrompt.tsx
|
|
10238
|
-
var
|
|
10585
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
10239
10586
|
var SkillConsentCard = ({
|
|
10240
10587
|
approval: a,
|
|
10241
10588
|
skill,
|
|
@@ -10245,7 +10592,7 @@ var SkillConsentCard = ({
|
|
|
10245
10592
|
showPreview,
|
|
10246
10593
|
onApprove,
|
|
10247
10594
|
onDeny
|
|
10248
|
-
}) => /* @__PURE__ */ (0,
|
|
10595
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
10249
10596
|
"div",
|
|
10250
10597
|
{
|
|
10251
10598
|
className: `awr-approval awr-approval--skill${helper ? " awr-approval--helper" : ""}`,
|
|
@@ -10253,28 +10600,28 @@ var SkillConsentCard = ({
|
|
|
10253
10600
|
"data-skill-server": skill.server,
|
|
10254
10601
|
"data-subagent": helper?.id,
|
|
10255
10602
|
children: [
|
|
10256
|
-
/* @__PURE__ */ (0,
|
|
10257
|
-
/* @__PURE__ */ (0,
|
|
10258
|
-
/* @__PURE__ */ (0,
|
|
10603
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "awr-approval__head", children: [
|
|
10604
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
10605
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: L.skillConsentLead(skill.server, skill.skill) })
|
|
10259
10606
|
] }),
|
|
10260
|
-
skill.description && /* @__PURE__ */ (0,
|
|
10261
|
-
/* @__PURE__ */ (0,
|
|
10262
|
-
/* @__PURE__ */ (0,
|
|
10263
|
-
/* @__PURE__ */ (0,
|
|
10607
|
+
skill.description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-approval__quote", children: skill.description }),
|
|
10608
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "awr-approval__skillmeta", children: [
|
|
10609
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("code", { className: "awr-tool__name", children: skill.name }),
|
|
10610
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
|
|
10264
10611
|
] }),
|
|
10265
|
-
skill.byUri && /* @__PURE__ */ (0,
|
|
10266
|
-
skill.nestedIn && /* @__PURE__ */ (0,
|
|
10267
|
-
skill.dynamic && /* @__PURE__ */ (0,
|
|
10268
|
-
skill.dynamic && skill.noFileListing && /* @__PURE__ */ (0,
|
|
10269
|
-
showPreview && skill.body !== void 0 && /* @__PURE__ */ (0,
|
|
10270
|
-
/* @__PURE__ */ (0,
|
|
10271
|
-
/* @__PURE__ */ (0,
|
|
10272
|
-
skill.files.length > 0 && /* @__PURE__ */ (0,
|
|
10612
|
+
skill.byUri && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
|
|
10613
|
+
skill.nestedIn && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
|
|
10614
|
+
skill.dynamic && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
|
|
10615
|
+
skill.dynamic && skill.noFileListing && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
|
|
10616
|
+
showPreview && skill.body !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("details", { className: "awr-approval__preview", children: [
|
|
10617
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("summary", { children: L.skillConsentPreview }),
|
|
10618
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
|
|
10619
|
+
skill.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
|
|
10273
10620
|
] }),
|
|
10274
|
-
/* @__PURE__ */ (0,
|
|
10275
|
-
/* @__PURE__ */ (0,
|
|
10276
|
-
/* @__PURE__ */ (0,
|
|
10277
|
-
allowRemember && /* @__PURE__ */ (0,
|
|
10621
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
|
|
10622
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "awr-approval__actions", children: [
|
|
10623
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
|
|
10624
|
+
allowRemember && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
10278
10625
|
"button",
|
|
10279
10626
|
{
|
|
10280
10627
|
type: "button",
|
|
@@ -10283,7 +10630,7 @@ var SkillConsentCard = ({
|
|
|
10283
10630
|
children: L.skillConsentAlways
|
|
10284
10631
|
}
|
|
10285
10632
|
),
|
|
10286
|
-
/* @__PURE__ */ (0,
|
|
10633
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
10287
10634
|
"button",
|
|
10288
10635
|
{
|
|
10289
10636
|
type: "button",
|
|
@@ -10309,9 +10656,9 @@ var ToolApprovalPrompt = ({
|
|
|
10309
10656
|
}) => {
|
|
10310
10657
|
const L = useLabels(labels);
|
|
10311
10658
|
if (approvals.length === 0) return null;
|
|
10312
|
-
return /* @__PURE__ */ (0,
|
|
10659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
|
|
10313
10660
|
if (a.skill) {
|
|
10314
|
-
const card2 = /* @__PURE__ */ (0,
|
|
10661
|
+
const card2 = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
10315
10662
|
SkillConsentCard,
|
|
10316
10663
|
{
|
|
10317
10664
|
approval: a,
|
|
@@ -10325,33 +10672,33 @@ var ToolApprovalPrompt = ({
|
|
|
10325
10672
|
},
|
|
10326
10673
|
a.id
|
|
10327
10674
|
);
|
|
10328
|
-
return renderApproval ? /* @__PURE__ */ (0,
|
|
10675
|
+
return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: renderApproval(a, card2) }, a.id) : card2;
|
|
10329
10676
|
}
|
|
10330
10677
|
const helper = showHelper ? a.subagent : void 0;
|
|
10331
10678
|
const app = a.app;
|
|
10332
|
-
const card = /* @__PURE__ */ (0,
|
|
10679
|
+
const card = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
10333
10680
|
"div",
|
|
10334
10681
|
{
|
|
10335
10682
|
className: `awr-approval${helper ? " awr-approval--helper" : ""}${app ? " awr-approval--app" : ""}`,
|
|
10336
10683
|
"data-subagent": helper?.id,
|
|
10337
10684
|
"data-app-server": app?.server,
|
|
10338
10685
|
children: [
|
|
10339
|
-
/* @__PURE__ */ (0,
|
|
10340
|
-
/* @__PURE__ */ (0,
|
|
10341
|
-
/* @__PURE__ */ (0,
|
|
10686
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "awr-approval__head", children: [
|
|
10687
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
10688
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { children: [
|
|
10342
10689
|
app ? L.approvalLeadApp(app.server) : helper ? L.approvalLeadHelper(
|
|
10343
10690
|
previewValue(helper.role ?? "", 60) || void 0,
|
|
10344
10691
|
helper.depth
|
|
10345
10692
|
) : L.approvalLead,
|
|
10346
10693
|
" ",
|
|
10347
|
-
/* @__PURE__ */ (0,
|
|
10694
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
|
|
10348
10695
|
a.readOnly && !app ? ` (${L.readOnlyTool})` : ""
|
|
10349
10696
|
] })
|
|
10350
10697
|
] }),
|
|
10351
|
-
previewValue(a.input, 300) && /* @__PURE__ */ (0,
|
|
10352
|
-
app && /* @__PURE__ */ (0,
|
|
10353
|
-
/* @__PURE__ */ (0,
|
|
10354
|
-
/* @__PURE__ */ (0,
|
|
10698
|
+
previewValue(a.input, 300) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
|
|
10699
|
+
app && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
|
|
10700
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "awr-approval__actions", children: [
|
|
10701
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
10355
10702
|
"button",
|
|
10356
10703
|
{
|
|
10357
10704
|
type: "button",
|
|
@@ -10360,7 +10707,7 @@ var ToolApprovalPrompt = ({
|
|
|
10360
10707
|
children: L.approve
|
|
10361
10708
|
}
|
|
10362
10709
|
),
|
|
10363
|
-
allowRemember && /* @__PURE__ */ (0,
|
|
10710
|
+
allowRemember && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
10364
10711
|
"button",
|
|
10365
10712
|
{
|
|
10366
10713
|
type: "button",
|
|
@@ -10369,7 +10716,7 @@ var ToolApprovalPrompt = ({
|
|
|
10369
10716
|
children: L.alwaysAllow
|
|
10370
10717
|
}
|
|
10371
10718
|
),
|
|
10372
|
-
/* @__PURE__ */ (0,
|
|
10719
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
10373
10720
|
"button",
|
|
10374
10721
|
{
|
|
10375
10722
|
type: "button",
|
|
@@ -10383,12 +10730,12 @@ var ToolApprovalPrompt = ({
|
|
|
10383
10730
|
},
|
|
10384
10731
|
a.id
|
|
10385
10732
|
);
|
|
10386
|
-
return renderApproval ? /* @__PURE__ */ (0,
|
|
10733
|
+
return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: renderApproval(a, card) }, a.id) : card;
|
|
10387
10734
|
}) });
|
|
10388
10735
|
};
|
|
10389
10736
|
|
|
10390
10737
|
// src/components/UsageBadge.tsx
|
|
10391
|
-
var
|
|
10738
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
10392
10739
|
var UsageBadge = ({
|
|
10393
10740
|
usage,
|
|
10394
10741
|
compact = false,
|
|
@@ -10414,7 +10761,7 @@ var UsageBadge = ({
|
|
|
10414
10761
|
mediaText,
|
|
10415
10762
|
decisions ? L.usageDecisions(decisions) : ""
|
|
10416
10763
|
].filter(Boolean).join(" \xB7 ");
|
|
10417
|
-
return /* @__PURE__ */ (0,
|
|
10764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
|
|
10418
10765
|
formatTokens(usage.inputTokens),
|
|
10419
10766
|
"\u2191 ",
|
|
10420
10767
|
formatTokens(usage.outputTokens),
|
|
@@ -10427,13 +10774,13 @@ var UsageBadge = ({
|
|
|
10427
10774
|
};
|
|
10428
10775
|
|
|
10429
10776
|
// src/components/AgentChat.tsx
|
|
10430
|
-
var
|
|
10777
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
10431
10778
|
var usePrefersDark = () => {
|
|
10432
10779
|
const query = "(prefers-color-scheme: dark)";
|
|
10433
|
-
const [dark, setDark] = (0,
|
|
10780
|
+
const [dark, setDark] = (0, import_react26.useState)(
|
|
10434
10781
|
() => typeof matchMedia === "function" && matchMedia(query).matches
|
|
10435
10782
|
);
|
|
10436
|
-
(0,
|
|
10783
|
+
(0, import_react26.useEffect)(() => {
|
|
10437
10784
|
if (typeof matchMedia !== "function") return;
|
|
10438
10785
|
const mq = matchMedia(query);
|
|
10439
10786
|
const on = () => setDark(mq.matches);
|
|
@@ -10444,7 +10791,7 @@ var usePrefersDark = () => {
|
|
|
10444
10791
|
};
|
|
10445
10792
|
var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
|
|
10446
10793
|
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
10447
|
-
var AgentChat = (props) => /* @__PURE__ */ (0,
|
|
10794
|
+
var AgentChat = (props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AgentChatInner, { ...props }) });
|
|
10448
10795
|
var NO_LABELS = {};
|
|
10449
10796
|
var AgentChatInner = ({
|
|
10450
10797
|
controller,
|
|
@@ -10464,6 +10811,7 @@ var AgentChatInner = ({
|
|
|
10464
10811
|
showSubagents = true,
|
|
10465
10812
|
showMedia = true,
|
|
10466
10813
|
showFileChips = true,
|
|
10814
|
+
showNamedFiles = showFileChips,
|
|
10467
10815
|
htmlPreview,
|
|
10468
10816
|
stoppableSubagents = true,
|
|
10469
10817
|
showTotalUsage = true,
|
|
@@ -10526,7 +10874,7 @@ var AgentChatInner = ({
|
|
|
10526
10874
|
}
|
|
10527
10875
|
const L = useLabels();
|
|
10528
10876
|
const external = isHistoryHook(history) ? history : void 0;
|
|
10529
|
-
const [ownStore] = (0,
|
|
10877
|
+
const [ownStore] = (0, import_react26.useState)(
|
|
10530
10878
|
() => history instanceof ChatHistoryStore ? history : new ChatHistoryStore()
|
|
10531
10879
|
);
|
|
10532
10880
|
const own = useChatHistory(agent, {
|
|
@@ -10536,9 +10884,9 @@ var AgentChatInner = ({
|
|
|
10536
10884
|
labels: { voiceMessage: L.voiceMessage }
|
|
10537
10885
|
});
|
|
10538
10886
|
const chats = history ? external ?? own : void 0;
|
|
10539
|
-
const rootRef = (0,
|
|
10540
|
-
const [narrow, setNarrow] = (0,
|
|
10541
|
-
(0,
|
|
10887
|
+
const rootRef = (0, import_react26.useRef)(null);
|
|
10888
|
+
const [narrow, setNarrow] = (0, import_react26.useState)(void 0);
|
|
10889
|
+
(0, import_react26.useEffect)(() => {
|
|
10542
10890
|
const el = rootRef.current;
|
|
10543
10891
|
if (!el || typeof ResizeObserver === "undefined") return setNarrow(false);
|
|
10544
10892
|
const measure2 = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
|
|
@@ -10547,9 +10895,9 @@ var AgentChatInner = ({
|
|
|
10547
10895
|
ro.observe(el);
|
|
10548
10896
|
return () => ro.disconnect();
|
|
10549
10897
|
}, [narrowWidth]);
|
|
10550
|
-
const [historyChoice, setHistoryOpen] = (0,
|
|
10898
|
+
const [historyChoice, setHistoryOpen] = (0, import_react26.useState)(defaultHistoryOpen);
|
|
10551
10899
|
const historyOpen = historyChoice ?? narrow === false;
|
|
10552
|
-
const [filesOpen, setFilesOpen] = (0,
|
|
10900
|
+
const [filesOpen, setFilesOpen] = (0, import_react26.useState)(defaultFilesOpen);
|
|
10553
10901
|
const toggleHistory = () => {
|
|
10554
10902
|
setHistoryOpen(!historyOpen);
|
|
10555
10903
|
if (narrow && !historyOpen) setFilesOpen(false);
|
|
@@ -10567,7 +10915,7 @@ var AgentChatInner = ({
|
|
|
10567
10915
|
setHistoryOpen(false);
|
|
10568
10916
|
setFilesOpen(false);
|
|
10569
10917
|
};
|
|
10570
|
-
(0,
|
|
10918
|
+
(0, import_react26.useEffect)(() => {
|
|
10571
10919
|
if (!overlayOpen) return;
|
|
10572
10920
|
const onKey = (e) => {
|
|
10573
10921
|
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
@@ -10577,7 +10925,7 @@ var AgentChatInner = ({
|
|
|
10577
10925
|
document.addEventListener("keydown", onKey);
|
|
10578
10926
|
return () => document.removeEventListener("keydown", onKey);
|
|
10579
10927
|
}, [overlayOpen]);
|
|
10580
|
-
const bodyRef = (0,
|
|
10928
|
+
const bodyRef = (0, import_react26.useRef)(null);
|
|
10581
10929
|
const appHost = useMcpAppHost({
|
|
10582
10930
|
connection: mcpApps,
|
|
10583
10931
|
approve: agent.approveAppToolCall,
|
|
@@ -10589,7 +10937,7 @@ var AgentChatInner = ({
|
|
|
10589
10937
|
});
|
|
10590
10938
|
const prefersDark = usePrefersDark();
|
|
10591
10939
|
const appTheme = theme === "auto" ? prefersDark ? "dark" : "light" : theme;
|
|
10592
|
-
const [panelApp, setPanelAppState] = (0,
|
|
10940
|
+
const [panelApp, setPanelAppState] = (0, import_react26.useState)();
|
|
10593
10941
|
const setPanelApp = (app) => {
|
|
10594
10942
|
setPanelAppState(app);
|
|
10595
10943
|
onAppPanel?.(app);
|
|
@@ -10603,14 +10951,14 @@ var AgentChatInner = ({
|
|
|
10603
10951
|
const panelAllowed = appPanel !== false && appPanel !== null;
|
|
10604
10952
|
const panelTarget = typeof appPanel === "object" && appPanel ? appPanel : void 0;
|
|
10605
10953
|
const asSheet = !panelTarget && (appPanel === "sheet" || Boolean(narrow));
|
|
10606
|
-
(0,
|
|
10954
|
+
(0, import_react26.useEffect)(() => {
|
|
10607
10955
|
if (panelApp && !agent.messages.some((m) => m.apps?.some((a) => a.id === panelApp.id))) {
|
|
10608
10956
|
setPanelAppState(void 0);
|
|
10609
10957
|
onAppPanel?.(void 0);
|
|
10610
10958
|
}
|
|
10611
10959
|
}, [agent.messages, panelApp, onAppPanel]);
|
|
10612
10960
|
const drawApp = (app, message) => {
|
|
10613
|
-
const built = panelApp?.id === app.id ? /* @__PURE__ */ (0,
|
|
10961
|
+
const built = panelApp?.id === app.id ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10614
10962
|
McpAppLine,
|
|
10615
10963
|
{
|
|
10616
10964
|
app,
|
|
@@ -10618,7 +10966,7 @@ var AgentChatInner = ({
|
|
|
10618
10966
|
action: L.appBringBack,
|
|
10619
10967
|
onAction: () => setPanelApp(void 0)
|
|
10620
10968
|
}
|
|
10621
|
-
) : /* @__PURE__ */ (0,
|
|
10969
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10622
10970
|
McpAppFrame,
|
|
10623
10971
|
{
|
|
10624
10972
|
app,
|
|
@@ -10631,7 +10979,7 @@ var AgentChatInner = ({
|
|
|
10631
10979
|
);
|
|
10632
10980
|
return renderApp ? renderApp(app, message, built) : built;
|
|
10633
10981
|
};
|
|
10634
|
-
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ (0,
|
|
10982
|
+
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10635
10983
|
McpAppFrame,
|
|
10636
10984
|
{
|
|
10637
10985
|
app: panelApp,
|
|
@@ -10643,7 +10991,7 @@ var AgentChatInner = ({
|
|
|
10643
10991
|
},
|
|
10644
10992
|
panelApp.id
|
|
10645
10993
|
) : null;
|
|
10646
|
-
const [compacting, setCompacting] = (0,
|
|
10994
|
+
const [compacting, setCompacting] = (0, import_react26.useState)(false);
|
|
10647
10995
|
const compact = () => {
|
|
10648
10996
|
setCompacting(true);
|
|
10649
10997
|
void agent.compact().finally(() => setCompacting(false));
|
|
@@ -10665,18 +11013,18 @@ var AgentChatInner = ({
|
|
|
10665
11013
|
const showReplan = agent.replan && agent.replan.mode !== "continue";
|
|
10666
11014
|
const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
|
|
10667
11015
|
const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
|
|
10668
|
-
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ (0,
|
|
10669
|
-
agent.planThought.trim() && /* @__PURE__ */ (0,
|
|
10670
|
-
/* @__PURE__ */ (0,
|
|
10671
|
-
/* @__PURE__ */ (0,
|
|
11016
|
+
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
11017
|
+
agent.planThought.trim() && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("details", { className: "awr-activity__plan", children: [
|
|
11018
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("summary", { children: L.planned }),
|
|
11019
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "awr-activity__thought", children: agent.planThought })
|
|
10672
11020
|
] }),
|
|
10673
|
-
showReplan && /* @__PURE__ */ (0,
|
|
10674
|
-
replanFailedEarly && /* @__PURE__ */ (0,
|
|
10675
|
-
/* @__PURE__ */ (0,
|
|
11021
|
+
showReplan && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
|
|
11022
|
+
replanFailedEarly && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "awr-step__warn", title: agent.replan.error, children: [
|
|
11023
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AlertIcon, { size: 12 }),
|
|
10676
11024
|
" ",
|
|
10677
11025
|
L.replanFailed
|
|
10678
11026
|
] }),
|
|
10679
|
-
earlyDecisions.map((d, i) => /* @__PURE__ */ (0,
|
|
11027
|
+
earlyDecisions.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10680
11028
|
"p",
|
|
10681
11029
|
{
|
|
10682
11030
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -10685,8 +11033,8 @@ var AgentChatInner = ({
|
|
|
10685
11033
|
i
|
|
10686
11034
|
))
|
|
10687
11035
|
] }) : void 0;
|
|
10688
|
-
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0,
|
|
10689
|
-
chats && /* @__PURE__ */ (0,
|
|
11036
|
+
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cx("awr-chat__header", classNames.header), children: [
|
|
11037
|
+
chats && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10690
11038
|
"button",
|
|
10691
11039
|
{
|
|
10692
11040
|
type: "button",
|
|
@@ -10695,17 +11043,17 @@ var AgentChatInner = ({
|
|
|
10695
11043
|
title: L.showHistory,
|
|
10696
11044
|
"aria-pressed": historyOpen,
|
|
10697
11045
|
onClick: toggleHistory,
|
|
10698
|
-
children: /* @__PURE__ */ (0,
|
|
11046
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(HistoryIcon, { size: 16 })
|
|
10699
11047
|
}
|
|
10700
11048
|
),
|
|
10701
11049
|
slots.headerStart,
|
|
10702
|
-
/* @__PURE__ */ (0,
|
|
10703
|
-
showStatus && /* @__PURE__ */ (0,
|
|
10704
|
-
/* @__PURE__ */ (0,
|
|
10705
|
-
/* @__PURE__ */ (0,
|
|
11050
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "awr-chat__title", children: title }),
|
|
11051
|
+
showStatus && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
|
|
11052
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "awr-status__dot" }),
|
|
11053
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "awr-status__text", children: L.status[agent.status] })
|
|
10706
11054
|
] }),
|
|
10707
|
-
showTotalUsage && /* @__PURE__ */ (0,
|
|
10708
|
-
files && /* @__PURE__ */ (0,
|
|
11055
|
+
showTotalUsage && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { title: L.totalUsage, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
|
|
11056
|
+
files && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10709
11057
|
"button",
|
|
10710
11058
|
{
|
|
10711
11059
|
type: "button",
|
|
@@ -10714,12 +11062,12 @@ var AgentChatInner = ({
|
|
|
10714
11062
|
title: L.showFiles,
|
|
10715
11063
|
"aria-pressed": filesOpen,
|
|
10716
11064
|
onClick: toggleFiles,
|
|
10717
|
-
children: /* @__PURE__ */ (0,
|
|
11065
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FileIcon, { size: 16 })
|
|
10718
11066
|
}
|
|
10719
11067
|
),
|
|
10720
11068
|
slots.headerEnd
|
|
10721
11069
|
] });
|
|
10722
|
-
return /* @__PURE__ */ (0,
|
|
11070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10723
11071
|
"div",
|
|
10724
11072
|
{
|
|
10725
11073
|
ref: rootRef,
|
|
@@ -10727,7 +11075,7 @@ var AgentChatInner = ({
|
|
|
10727
11075
|
style,
|
|
10728
11076
|
"data-awr-theme": theme === "auto" ? void 0 : theme,
|
|
10729
11077
|
children: [
|
|
10730
|
-
overlayOpen && /* @__PURE__ */ (0,
|
|
11078
|
+
overlayOpen && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10731
11079
|
"div",
|
|
10732
11080
|
{
|
|
10733
11081
|
className: cx("awr-chat__scrim", classNames.scrim),
|
|
@@ -10735,8 +11083,8 @@ var AgentChatInner = ({
|
|
|
10735
11083
|
onClick: closeOverlays
|
|
10736
11084
|
}
|
|
10737
11085
|
),
|
|
10738
|
-
chats && historyOpen && /* @__PURE__ */ (0,
|
|
10739
|
-
/* @__PURE__ */ (0,
|
|
11086
|
+
chats && historyOpen && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
|
|
11087
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10740
11088
|
HistoryList,
|
|
10741
11089
|
{
|
|
10742
11090
|
history: {
|
|
@@ -10755,7 +11103,7 @@ var AgentChatInner = ({
|
|
|
10755
11103
|
}
|
|
10756
11104
|
),
|
|
10757
11105
|
slots.sidebar,
|
|
10758
|
-
/* @__PURE__ */ (0,
|
|
11106
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10759
11107
|
"button",
|
|
10760
11108
|
{
|
|
10761
11109
|
type: "button",
|
|
@@ -10766,11 +11114,11 @@ var AgentChatInner = ({
|
|
|
10766
11114
|
}
|
|
10767
11115
|
)
|
|
10768
11116
|
] }),
|
|
10769
|
-
/* @__PURE__ */ (0,
|
|
11117
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cx("awr-chat__main", classNames.main), children: [
|
|
10770
11118
|
header,
|
|
10771
|
-
/* @__PURE__ */ (0,
|
|
11119
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cx("awr-chat__body", classNames.body), ref: bodyRef, children: [
|
|
10772
11120
|
slots.beforeMessages,
|
|
10773
|
-
/* @__PURE__ */ (0,
|
|
11121
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10774
11122
|
Messages,
|
|
10775
11123
|
{
|
|
10776
11124
|
messages: agent.messages,
|
|
@@ -10788,6 +11136,7 @@ var AgentChatInner = ({
|
|
|
10788
11136
|
showSubagents,
|
|
10789
11137
|
showMedia,
|
|
10790
11138
|
showFileChips,
|
|
11139
|
+
showNamedFiles,
|
|
10791
11140
|
files,
|
|
10792
11141
|
htmlPreview,
|
|
10793
11142
|
onShowFiles: files ? showFiles : void 0,
|
|
@@ -10811,7 +11160,7 @@ var AgentChatInner = ({
|
|
|
10811
11160
|
renderImageViewer
|
|
10812
11161
|
}
|
|
10813
11162
|
),
|
|
10814
|
-
/* @__PURE__ */ (0,
|
|
11163
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10815
11164
|
Approvals,
|
|
10816
11165
|
{
|
|
10817
11166
|
approvals: agent.pendingApprovals,
|
|
@@ -10821,7 +11170,7 @@ var AgentChatInner = ({
|
|
|
10821
11170
|
renderApproval
|
|
10822
11171
|
}
|
|
10823
11172
|
),
|
|
10824
|
-
showQuestions && /* @__PURE__ */ (0,
|
|
11173
|
+
showQuestions && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10825
11174
|
Questions,
|
|
10826
11175
|
{
|
|
10827
11176
|
questions: agent.pendingQuestions ?? [],
|
|
@@ -10830,7 +11179,7 @@ var AgentChatInner = ({
|
|
|
10830
11179
|
renderQuestion
|
|
10831
11180
|
}
|
|
10832
11181
|
),
|
|
10833
|
-
appsOn && /* @__PURE__ */ (0,
|
|
11182
|
+
appsOn && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10834
11183
|
AppRequestPrompt,
|
|
10835
11184
|
{
|
|
10836
11185
|
requests: appHost.requests,
|
|
@@ -10838,7 +11187,7 @@ var AgentChatInner = ({
|
|
|
10838
11187
|
renderRequest: renderAppRequest
|
|
10839
11188
|
}
|
|
10840
11189
|
),
|
|
10841
|
-
showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ (0,
|
|
11190
|
+
showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10842
11191
|
Elicitations,
|
|
10843
11192
|
{
|
|
10844
11193
|
elicitations,
|
|
@@ -10847,13 +11196,13 @@ var AgentChatInner = ({
|
|
|
10847
11196
|
renderElicitation
|
|
10848
11197
|
}
|
|
10849
11198
|
),
|
|
10850
|
-
agent.modelLoad && loading && /* @__PURE__ */ (0,
|
|
11199
|
+
agent.modelLoad && loading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ModelLoadBar, { load: agent.modelLoad }),
|
|
10851
11200
|
slots.afterMessages
|
|
10852
11201
|
] }),
|
|
10853
|
-
/* @__PURE__ */ (0,
|
|
11202
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
10854
11203
|
slots.footerStart,
|
|
10855
|
-
tabNotes.length > 0 && /* @__PURE__ */ (0,
|
|
10856
|
-
showContext !== false && /* @__PURE__ */ (0,
|
|
11204
|
+
tabNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text2) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "awr-tabnote__text", children: text2 }, text2)) }),
|
|
11205
|
+
showContext !== false && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10857
11206
|
ContextMeter,
|
|
10858
11207
|
{
|
|
10859
11208
|
usage: agent.usage,
|
|
@@ -10864,11 +11213,11 @@ var AgentChatInner = ({
|
|
|
10864
11213
|
compacting
|
|
10865
11214
|
}
|
|
10866
11215
|
),
|
|
10867
|
-
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0,
|
|
10868
|
-
/* @__PURE__ */ (0,
|
|
11216
|
+
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "awr-chat__error", children: [
|
|
11217
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AlertIcon, { size: 14 }),
|
|
10869
11218
|
" ",
|
|
10870
11219
|
agent.error
|
|
10871
|
-
] }) : /* @__PURE__ */ (0,
|
|
11220
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10872
11221
|
Composer2,
|
|
10873
11222
|
{
|
|
10874
11223
|
controller: agent,
|
|
@@ -10885,7 +11234,7 @@ var AgentChatInner = ({
|
|
|
10885
11234
|
appPanelNode && (panelTarget ? (
|
|
10886
11235
|
// Outside the chat: the theme tokens come with it.
|
|
10887
11236
|
(0, import_react_dom2.createPortal)(
|
|
10888
|
-
/* @__PURE__ */ (0,
|
|
11237
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10889
11238
|
"div",
|
|
10890
11239
|
{
|
|
10891
11240
|
className: "awr-theme awr-apppanel",
|
|
@@ -10895,24 +11244,24 @@ var AgentChatInner = ({
|
|
|
10895
11244
|
),
|
|
10896
11245
|
panelTarget
|
|
10897
11246
|
)
|
|
10898
|
-
) : asSheet ? /* @__PURE__ */ (0,
|
|
10899
|
-
/* @__PURE__ */ (0,
|
|
10900
|
-
/* @__PURE__ */ (0,
|
|
11247
|
+
) : asSheet ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
11248
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
|
|
11249
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10901
11250
|
"aside",
|
|
10902
11251
|
{
|
|
10903
11252
|
className: "awr-chat__appsheet",
|
|
10904
11253
|
role: "dialog",
|
|
10905
11254
|
"aria-label": L.appFrom(panelApp.server),
|
|
10906
11255
|
children: [
|
|
10907
|
-
/* @__PURE__ */ (0,
|
|
11256
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "awr-sheet__grab" }),
|
|
10908
11257
|
appPanelNode
|
|
10909
11258
|
]
|
|
10910
11259
|
}
|
|
10911
11260
|
)
|
|
10912
|
-
] }) : /* @__PURE__ */ (0,
|
|
10913
|
-
files && filesOpen && /* @__PURE__ */ (0,
|
|
10914
|
-
/* @__PURE__ */ (0,
|
|
10915
|
-
/* @__PURE__ */ (0,
|
|
11261
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
|
|
11262
|
+
files && filesOpen && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("aside", { className: cx("awr-chat__files", classNames.files), children: [
|
|
11263
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Files, { files }) }),
|
|
11264
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10916
11265
|
"button",
|
|
10917
11266
|
{
|
|
10918
11267
|
type: "button",
|
|
@@ -10929,7 +11278,7 @@ var AgentChatInner = ({
|
|
|
10929
11278
|
};
|
|
10930
11279
|
|
|
10931
11280
|
// src/components/LearnedSkills.tsx
|
|
10932
|
-
var
|
|
11281
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
10933
11282
|
var LearnedSkills = ({
|
|
10934
11283
|
controller,
|
|
10935
11284
|
lessons,
|
|
@@ -10945,18 +11294,18 @@ var LearnedSkills = ({
|
|
|
10945
11294
|
const c = controller ?? ctx;
|
|
10946
11295
|
const list = lessons ?? c?.learned ?? [];
|
|
10947
11296
|
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
10948
|
-
return /* @__PURE__ */ (0,
|
|
10949
|
-
!hideTitle && /* @__PURE__ */ (0,
|
|
10950
|
-
/* @__PURE__ */ (0,
|
|
11297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
11298
|
+
!hideTitle && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("h3", { className: "awr-notebook__title", children: [
|
|
11299
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(BookIcon, { size: 14 }),
|
|
10951
11300
|
" ",
|
|
10952
11301
|
L.notebookTitle,
|
|
10953
|
-
list.length > 0 && /* @__PURE__ */ (0,
|
|
11302
|
+
list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "awr-notebook__count", children: list.length })
|
|
10954
11303
|
] }),
|
|
10955
|
-
list.length === 0 ? /* @__PURE__ */ (0,
|
|
10956
|
-
/* @__PURE__ */ (0,
|
|
10957
|
-
/* @__PURE__ */ (0,
|
|
10958
|
-
l.revision > 1 && /* @__PURE__ */ (0,
|
|
10959
|
-
forget && /* @__PURE__ */ (0,
|
|
11304
|
+
list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { className: "awr-lesson", children: [
|
|
11305
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "awr-lesson__head", children: [
|
|
11306
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { className: "awr-lesson__name", children: l.name }),
|
|
11307
|
+
l.revision > 1 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
11308
|
+
forget && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10960
11309
|
"button",
|
|
10961
11310
|
{
|
|
10962
11311
|
type: "button",
|
|
@@ -10964,12 +11313,12 @@ var LearnedSkills = ({
|
|
|
10964
11313
|
title: `${L.notebookForget}: ${l.name}`,
|
|
10965
11314
|
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
10966
11315
|
onClick: () => void forget(l.name),
|
|
10967
|
-
children: /* @__PURE__ */ (0,
|
|
11316
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(XIcon, { size: 12 })
|
|
10968
11317
|
}
|
|
10969
11318
|
)
|
|
10970
11319
|
] }),
|
|
10971
|
-
/* @__PURE__ */ (0,
|
|
10972
|
-
showSources && l.sources.length > 0 && /* @__PURE__ */ (0,
|
|
11320
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "awr-lesson__when", children: l.description }),
|
|
11321
|
+
showSources && l.sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("p", { className: "awr-lesson__from", children: [
|
|
10973
11322
|
L.notebookFrom,
|
|
10974
11323
|
" ",
|
|
10975
11324
|
l.sources.join(", ")
|
|
@@ -10979,8 +11328,8 @@ var LearnedSkills = ({
|
|
|
10979
11328
|
};
|
|
10980
11329
|
|
|
10981
11330
|
// src/components/MemoryCard.tsx
|
|
10982
|
-
var
|
|
10983
|
-
var
|
|
11331
|
+
var import_react27 = require("react");
|
|
11332
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
10984
11333
|
var MemoryCard = ({
|
|
10985
11334
|
kind,
|
|
10986
11335
|
text: text2,
|
|
@@ -10991,7 +11340,7 @@ var MemoryCard = ({
|
|
|
10991
11340
|
className
|
|
10992
11341
|
}) => {
|
|
10993
11342
|
const L = useLabels(labels);
|
|
10994
|
-
const [busy, setBusy] = (0,
|
|
11343
|
+
const [busy, setBusy] = (0, import_react27.useState)(false);
|
|
10995
11344
|
const label = kind === "saved" ? L.memorySaved : kind === "updated" ? L.memoryUpdated : L.memoryForgotten;
|
|
10996
11345
|
const undo = () => {
|
|
10997
11346
|
if (!onUndo || busy) return;
|
|
@@ -10999,19 +11348,19 @@ var MemoryCard = ({
|
|
|
10999
11348
|
void Promise.resolve().then(onUndo).catch(() => {
|
|
11000
11349
|
}).finally(() => setBusy(false));
|
|
11001
11350
|
};
|
|
11002
|
-
return /* @__PURE__ */ (0,
|
|
11351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
11003
11352
|
"div",
|
|
11004
11353
|
{
|
|
11005
11354
|
className: ["awr-memory", `awr-memory--${kind}`, undone ? "is-undone" : "", className].filter(Boolean).join(" "),
|
|
11006
11355
|
"data-memory": kind,
|
|
11007
11356
|
children: [
|
|
11008
|
-
/* @__PURE__ */ (0,
|
|
11009
|
-
/* @__PURE__ */ (0,
|
|
11010
|
-
/* @__PURE__ */ (0,
|
|
11011
|
-
/* @__PURE__ */ (0,
|
|
11012
|
-
problem && /* @__PURE__ */ (0,
|
|
11357
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BookmarkIcon, { size: 14, className: "awr-memory__icon" }),
|
|
11358
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "awr-memory__body", children: [
|
|
11359
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "awr-memory__label", children: label }),
|
|
11360
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "awr-memory__text", children: text2 }),
|
|
11361
|
+
problem && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "awr-memory__problem", role: "alert", children: problem })
|
|
11013
11362
|
] }),
|
|
11014
|
-
undone ? /* @__PURE__ */ (0,
|
|
11363
|
+
undone ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "awr-memory__undone", children: L.memoryUndone }) : onUndo ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
11015
11364
|
"button",
|
|
11016
11365
|
{
|
|
11017
11366
|
type: "button",
|
|
@@ -11029,8 +11378,8 @@ var MemoryCard = ({
|
|
|
11029
11378
|
};
|
|
11030
11379
|
|
|
11031
11380
|
// src/components/Composer.tsx
|
|
11032
|
-
var
|
|
11033
|
-
var
|
|
11381
|
+
var import_react28 = require("react");
|
|
11382
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
11034
11383
|
var Composer = ({
|
|
11035
11384
|
onSubmit,
|
|
11036
11385
|
busy = false,
|
|
@@ -11039,7 +11388,7 @@ var Composer = ({
|
|
|
11039
11388
|
placeholder = "Ask the agent to do something\u2026",
|
|
11040
11389
|
className
|
|
11041
11390
|
}) => {
|
|
11042
|
-
const [text2, setText] = (0,
|
|
11391
|
+
const [text2, setText] = (0, import_react28.useState)("");
|
|
11043
11392
|
const submit = () => {
|
|
11044
11393
|
const value = text2.trim();
|
|
11045
11394
|
if (!value || busy || disabled) return;
|
|
@@ -11052,7 +11401,7 @@ var Composer = ({
|
|
|
11052
11401
|
submit();
|
|
11053
11402
|
}
|
|
11054
11403
|
};
|
|
11055
|
-
return /* @__PURE__ */ (0,
|
|
11404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
11056
11405
|
"form",
|
|
11057
11406
|
{
|
|
11058
11407
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -11061,7 +11410,7 @@ var Composer = ({
|
|
|
11061
11410
|
submit();
|
|
11062
11411
|
},
|
|
11063
11412
|
children: [
|
|
11064
|
-
/* @__PURE__ */ (0,
|
|
11413
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
11065
11414
|
"textarea",
|
|
11066
11415
|
{
|
|
11067
11416
|
className: "awr-composer__input",
|
|
@@ -11073,23 +11422,23 @@ var Composer = ({
|
|
|
11073
11422
|
rows: 1
|
|
11074
11423
|
}
|
|
11075
11424
|
),
|
|
11076
|
-
busy ? /* @__PURE__ */ (0,
|
|
11425
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
11077
11426
|
"button",
|
|
11078
11427
|
{
|
|
11079
11428
|
type: "button",
|
|
11080
11429
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
11081
11430
|
onClick: onStop,
|
|
11082
11431
|
"aria-label": "Stop",
|
|
11083
|
-
children: /* @__PURE__ */ (0,
|
|
11432
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StopIcon, { size: 18 })
|
|
11084
11433
|
}
|
|
11085
|
-
) : /* @__PURE__ */ (0,
|
|
11434
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
11086
11435
|
"button",
|
|
11087
11436
|
{
|
|
11088
11437
|
type: "submit",
|
|
11089
11438
|
className: "awr-composer__btn",
|
|
11090
11439
|
disabled: disabled || !text2.trim(),
|
|
11091
11440
|
"aria-label": "Send",
|
|
11092
|
-
children: disabled ? /* @__PURE__ */ (0,
|
|
11441
|
+
children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SendIcon, { size: 18 })
|
|
11093
11442
|
}
|
|
11094
11443
|
)
|
|
11095
11444
|
]
|
|
@@ -11098,17 +11447,17 @@ var Composer = ({
|
|
|
11098
11447
|
};
|
|
11099
11448
|
|
|
11100
11449
|
// src/components/PlanView.tsx
|
|
11101
|
-
var
|
|
11450
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
11102
11451
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
11103
11452
|
if (!plan.steps.length && !plan.thought) return null;
|
|
11104
|
-
return /* @__PURE__ */ (0,
|
|
11105
|
-
showThought && plan.thought.trim() && /* @__PURE__ */ (0,
|
|
11106
|
-
plan.steps.length > 0 && /* @__PURE__ */ (0,
|
|
11453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
11454
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
11455
|
+
plan.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
11107
11456
|
] });
|
|
11108
11457
|
};
|
|
11109
11458
|
|
|
11110
11459
|
// src/components/ApprovalModeSwitch.tsx
|
|
11111
|
-
var
|
|
11460
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
11112
11461
|
var DEFAULT_LABELS = {
|
|
11113
11462
|
autopilot: "Autopilot",
|
|
11114
11463
|
"ask-writes": "Ask before changes",
|
|
@@ -11128,13 +11477,13 @@ var ApprovalModeSwitch = ({
|
|
|
11128
11477
|
labels,
|
|
11129
11478
|
disabled,
|
|
11130
11479
|
className
|
|
11131
|
-
}) => /* @__PURE__ */ (0,
|
|
11480
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
11132
11481
|
"div",
|
|
11133
11482
|
{
|
|
11134
11483
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
11135
11484
|
role: "radiogroup",
|
|
11136
11485
|
"aria-label": "Tool consent",
|
|
11137
|
-
children: modes.map((m) => /* @__PURE__ */ (0,
|
|
11486
|
+
children: modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
11138
11487
|
"button",
|
|
11139
11488
|
{
|
|
11140
11489
|
type: "button",
|
|
@@ -11152,8 +11501,8 @@ var ApprovalModeSwitch = ({
|
|
|
11152
11501
|
);
|
|
11153
11502
|
|
|
11154
11503
|
// src/components/ApiKeyForm.tsx
|
|
11155
|
-
var
|
|
11156
|
-
var
|
|
11504
|
+
var import_react29 = require("react");
|
|
11505
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
11157
11506
|
var ApiKeyForm = ({
|
|
11158
11507
|
credentials,
|
|
11159
11508
|
credentialRef,
|
|
@@ -11162,10 +11511,10 @@ var ApiKeyForm = ({
|
|
|
11162
11511
|
onChange,
|
|
11163
11512
|
className
|
|
11164
11513
|
}) => {
|
|
11165
|
-
const [value, setValue] = (0,
|
|
11166
|
-
const [present, setPresent] = (0,
|
|
11167
|
-
const [busy, setBusy] = (0,
|
|
11168
|
-
(0,
|
|
11514
|
+
const [value, setValue] = (0, import_react29.useState)("");
|
|
11515
|
+
const [present, setPresent] = (0, import_react29.useState)(false);
|
|
11516
|
+
const [busy, setBusy] = (0, import_react29.useState)(false);
|
|
11517
|
+
(0, import_react29.useEffect)(() => {
|
|
11169
11518
|
let active = true;
|
|
11170
11519
|
credentials.hasKey(credentialRef).then((has) => {
|
|
11171
11520
|
if (active) setPresent(has);
|
|
@@ -11197,16 +11546,16 @@ var ApiKeyForm = ({
|
|
|
11197
11546
|
setBusy(false);
|
|
11198
11547
|
}
|
|
11199
11548
|
};
|
|
11200
|
-
return /* @__PURE__ */ (0,
|
|
11201
|
-
/* @__PURE__ */ (0,
|
|
11549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
11550
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "awr-keyform__label", children: [
|
|
11202
11551
|
label,
|
|
11203
|
-
present && /* @__PURE__ */ (0,
|
|
11204
|
-
/* @__PURE__ */ (0,
|
|
11552
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "awr-keyform__saved", children: [
|
|
11553
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CheckIcon, { size: 12 }),
|
|
11205
11554
|
" stored, encrypted"
|
|
11206
11555
|
] })
|
|
11207
11556
|
] }),
|
|
11208
|
-
/* @__PURE__ */ (0,
|
|
11209
|
-
/* @__PURE__ */ (0,
|
|
11557
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "awr-keyform__row", children: [
|
|
11558
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
11210
11559
|
"input",
|
|
11211
11560
|
{
|
|
11212
11561
|
className: "awr-keyform__input",
|
|
@@ -11224,7 +11573,7 @@ var ApiKeyForm = ({
|
|
|
11224
11573
|
disabled: busy
|
|
11225
11574
|
}
|
|
11226
11575
|
),
|
|
11227
|
-
/* @__PURE__ */ (0,
|
|
11576
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
11228
11577
|
"button",
|
|
11229
11578
|
{
|
|
11230
11579
|
type: "button",
|
|
@@ -11234,7 +11583,7 @@ var ApiKeyForm = ({
|
|
|
11234
11583
|
children: "Save"
|
|
11235
11584
|
}
|
|
11236
11585
|
),
|
|
11237
|
-
present && /* @__PURE__ */ (0,
|
|
11586
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
11238
11587
|
"button",
|
|
11239
11588
|
{
|
|
11240
11589
|
type: "button",
|
|
@@ -11309,6 +11658,7 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
11309
11658
|
MCP_APP_SANDBOX_RESOURCE_READY,
|
|
11310
11659
|
MCP_APP_SANDBOX_SERVER,
|
|
11311
11660
|
MCP_APP_SANDBOX_TIMEOUT_MS,
|
|
11661
|
+
MCP_APP_SCHEME_PARAM,
|
|
11312
11662
|
McpAppBridge,
|
|
11313
11663
|
McpAppFrame,
|
|
11314
11664
|
McpAppLine,
|
|
@@ -11321,6 +11671,10 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
11321
11671
|
MessageList,
|
|
11322
11672
|
MicError,
|
|
11323
11673
|
ModelLoadBar,
|
|
11674
|
+
NAMED_FILES_MAX,
|
|
11675
|
+
NAMED_FILES_SCAN_MAX,
|
|
11676
|
+
NAMED_FILES_TEXT_MAX,
|
|
11677
|
+
NamedFileChips,
|
|
11324
11678
|
PlanView,
|
|
11325
11679
|
QUESTION_TIMEOUT_MS,
|
|
11326
11680
|
QuestionPrompt,
|
|
@@ -11408,6 +11762,7 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
11408
11762
|
linkedFilesOf,
|
|
11409
11763
|
loadSkillFromUrl,
|
|
11410
11764
|
markReadOnly,
|
|
11765
|
+
mcpAppColorScheme,
|
|
11411
11766
|
mcpAppCsp,
|
|
11412
11767
|
mcpAppHostCapabilities,
|
|
11413
11768
|
mcpAppPolicyToken,
|
|
@@ -11422,11 +11777,13 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
11422
11777
|
messageOverLimit,
|
|
11423
11778
|
micProblemOf,
|
|
11424
11779
|
micProblemText,
|
|
11780
|
+
namedFilesOf,
|
|
11425
11781
|
newChatId,
|
|
11426
11782
|
noticesOf,
|
|
11427
11783
|
onStorageChange,
|
|
11428
11784
|
parseSkillMarkdown,
|
|
11429
11785
|
parseSlash,
|
|
11786
|
+
pathsNamedIn,
|
|
11430
11787
|
pendingApprovalsOf,
|
|
11431
11788
|
pickRecordingType,
|
|
11432
11789
|
postStorageChange,
|
|
@@ -11480,6 +11837,7 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
11480
11837
|
withAttachments,
|
|
11481
11838
|
withCspFirst,
|
|
11482
11839
|
withPolicyFirst,
|
|
11483
|
-
withoutOwnWords
|
|
11840
|
+
withoutOwnWords,
|
|
11841
|
+
workspacePathOf
|
|
11484
11842
|
});
|
|
11485
11843
|
//# sourceMappingURL=index.cjs.map
|