@dudko.dev/agent-web-react 0.0.33 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/{elicitation-B6h_-yLg.d.cts → elicitation-BTrJ5t3c.d.cts} +5 -0
- package/dist/{elicitation-B6h_-yLg.d.ts → elicitation-BTrJ5t3c.d.ts} +5 -0
- package/dist/index.cjs +1029 -599
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +145 -6
- package/dist/index.d.ts +145 -6
- package/dist/index.js +964 -543
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.cts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/styles.css +159 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,8 @@ __export(src_exports, {
|
|
|
48
48
|
ContextMeter: () => ContextMeter,
|
|
49
49
|
ElicitationPrompt: () => ElicitationPrompt,
|
|
50
50
|
FILE_PREVIEW_CHARS: () => FILE_PREVIEW_CHARS,
|
|
51
|
+
FOLLOW_LEAVE_PX: () => FOLLOW_LEAVE_PX,
|
|
52
|
+
FOLLOW_REJOIN_PX: () => FOLLOW_REJOIN_PX,
|
|
51
53
|
FRAME_MAX_HEIGHT: () => FRAME_MAX_HEIGHT,
|
|
52
54
|
FRAME_MIN_HEIGHT: () => FRAME_MIN_HEIGHT,
|
|
53
55
|
FileChip: () => FileChip,
|
|
@@ -55,6 +57,9 @@ __export(src_exports, {
|
|
|
55
57
|
FilesPanel: () => FilesPanel,
|
|
56
58
|
GeneratedMedia: () => GeneratedMedia,
|
|
57
59
|
HTML_PREVIEW_MAX_CHARS: () => HTML_PREVIEW_MAX_CHARS,
|
|
60
|
+
ImageThumb: () => ImageThumb,
|
|
61
|
+
ImageViewer: () => ImageViewer,
|
|
62
|
+
ImageViewerProvider: () => ImageViewerProvider,
|
|
58
63
|
ImagesNotSupportedError: () => import_agent_web8.ImagesNotSupportedError,
|
|
59
64
|
IndexedDBStore: () => import_agent_web8.IndexedDBStore,
|
|
60
65
|
LearnedSkills: () => LearnedSkills,
|
|
@@ -144,11 +149,14 @@ __export(src_exports, {
|
|
|
144
149
|
elicitationLink: () => elicitationLink,
|
|
145
150
|
escapeAttribute: () => escapeAttribute,
|
|
146
151
|
fileKindOf: () => fileKindOf,
|
|
147
|
-
fileNameOf: () =>
|
|
152
|
+
fileNameOf: () => fileNameOf2,
|
|
148
153
|
filterCommands: () => filterCommands,
|
|
154
|
+
followsAfterResize: () => followsAfterResize,
|
|
155
|
+
followsAfterScroll: () => followsAfterScroll,
|
|
149
156
|
formatCountdown: () => formatCountdown,
|
|
150
157
|
formatElapsed: () => formatElapsed,
|
|
151
158
|
grantedAppCsp: () => grantedAppCsp,
|
|
159
|
+
imageExtensionOf: () => imageExtensionOf,
|
|
152
160
|
isMcpAppSandboxMessage: () => isMcpAppSandboxMessage,
|
|
153
161
|
isWebGPUAvailable: () => import_agent_web8.isWebGPUAvailable,
|
|
154
162
|
lessonsOf: () => lessonsOf,
|
|
@@ -190,6 +198,7 @@ __export(src_exports, {
|
|
|
190
198
|
useAgentContext: () => useAgentContext,
|
|
191
199
|
useChatHistory: () => useChatHistory,
|
|
192
200
|
useCredentials: () => useCredentials,
|
|
201
|
+
useFollowScroll: () => useFollowScroll,
|
|
193
202
|
useLabels: () => useLabels,
|
|
194
203
|
useLocalModel: () => useLocalModel,
|
|
195
204
|
useMcpAppHost: () => useMcpAppHost,
|
|
@@ -833,7 +842,10 @@ var applyEvent = (state, event, ctx) => {
|
|
|
833
842
|
...event.model !== void 0 ? { model: event.model } : {},
|
|
834
843
|
...event.tierReason !== void 0 ? { tierReason: event.tierReason } : {}
|
|
835
844
|
};
|
|
836
|
-
|
|
845
|
+
const steps = state.steps.map(
|
|
846
|
+
(s) => s.total === event.total ? s : { ...s, total: event.total }
|
|
847
|
+
);
|
|
848
|
+
return { ...state, steps: [...steps, view] };
|
|
837
849
|
}
|
|
838
850
|
case "step.escalated":
|
|
839
851
|
return {
|
|
@@ -2678,6 +2690,11 @@ var defaultLabels = {
|
|
|
2678
2690
|
subagentNoTools: "no tools",
|
|
2679
2691
|
approvalLeadHelper: (role) => role ? `The helper \u201C${role}\u201D wants to run` : "A helper the agent started wants to run",
|
|
2680
2692
|
mediaImage: (path) => `Generated image ${path}`,
|
|
2693
|
+
imageOpen: (name) => `Open image ${name}`,
|
|
2694
|
+
imagePrevious: "Previous image",
|
|
2695
|
+
imageNext: "Next image",
|
|
2696
|
+
imageZoom: "Zoom",
|
|
2697
|
+
imageCount: (index, total) => `${index} of ${total}`,
|
|
2681
2698
|
mediaAudio: (path) => `Generated audio ${path}`,
|
|
2682
2699
|
mediaFile: (path) => `Generated file ${path}`,
|
|
2683
2700
|
transcriptOf: (name) => `Transcript of ${name}`,
|
|
@@ -3171,12 +3188,129 @@ var formatCountdown = (ms) => {
|
|
|
3171
3188
|
};
|
|
3172
3189
|
|
|
3173
3190
|
// src/components/AgentChat.tsx
|
|
3174
|
-
var
|
|
3175
|
-
var
|
|
3191
|
+
var import_react21 = require("react");
|
|
3192
|
+
var import_react_dom2 = require("react-dom");
|
|
3176
3193
|
|
|
3177
|
-
// src/hooks/use-
|
|
3194
|
+
// src/hooks/use-follow-scroll.ts
|
|
3178
3195
|
var import_react9 = require("react");
|
|
3179
3196
|
|
|
3197
|
+
// src/follow-scroll.ts
|
|
3198
|
+
var FOLLOW_REJOIN_PX = 80;
|
|
3199
|
+
var FOLLOW_LEAVE_PX = 2;
|
|
3200
|
+
var endGap = (m) => m.scrollHeight - m.scrollTop - m.clientHeight;
|
|
3201
|
+
var reach = (m) => Math.min(m.scrollTop, Math.max(0, m.scrollHeight - m.clientHeight));
|
|
3202
|
+
var followsAfterScroll = (following, before, now) => {
|
|
3203
|
+
if (before.scrollHeight !== now.scrollHeight || before.clientHeight !== now.clientHeight)
|
|
3204
|
+
return following;
|
|
3205
|
+
if (now.scrollTop < reach(before) - FOLLOW_LEAVE_PX) return false;
|
|
3206
|
+
if (now.scrollTop > before.scrollTop) return endGap(now) < FOLLOW_REJOIN_PX ? true : following;
|
|
3207
|
+
return following;
|
|
3208
|
+
};
|
|
3209
|
+
var followsAfterResize = (following, before, now) => following && !(now.clientHeight === before.clientHeight && now.scrollHeight >= before.scrollHeight && now.scrollTop < reach(before) - FOLLOW_LEAVE_PX);
|
|
3210
|
+
|
|
3211
|
+
// src/hooks/use-follow-scroll.ts
|
|
3212
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? import_react9.useEffect : import_react9.useLayoutEffect;
|
|
3213
|
+
var measure = (el) => ({
|
|
3214
|
+
scrollTop: el.scrollTop,
|
|
3215
|
+
scrollHeight: el.scrollHeight,
|
|
3216
|
+
clientHeight: el.clientHeight
|
|
3217
|
+
});
|
|
3218
|
+
var anchorOf = (el) => {
|
|
3219
|
+
const box = el.getBoundingClientRect();
|
|
3220
|
+
if (box.width === 0 || box.height === 0) return void 0;
|
|
3221
|
+
const doc = el.ownerDocument;
|
|
3222
|
+
const marks = [];
|
|
3223
|
+
for (const dy of [8, 24, 48, 80, 120, 180]) {
|
|
3224
|
+
if (dy >= box.height) break;
|
|
3225
|
+
const node = doc.elementFromPoint(box.left + box.width / 2, box.top + dy);
|
|
3226
|
+
if (!node || node === el || !el.contains(node) || marks.some((m) => m.node === node)) continue;
|
|
3227
|
+
const r = node.getBoundingClientRect();
|
|
3228
|
+
marks.push({ node, offset: r.top - box.top, height: r.height });
|
|
3229
|
+
}
|
|
3230
|
+
marks.sort((a, b) => a.height - b.height);
|
|
3231
|
+
return marks.length ? { marks, top: el.scrollTop } : void 0;
|
|
3232
|
+
};
|
|
3233
|
+
var useFollowScroll = (ref, turn, live = true) => {
|
|
3234
|
+
const following = (0, import_react9.useRef)(true);
|
|
3235
|
+
const last = (0, import_react9.useRef)(void 0);
|
|
3236
|
+
const anchor = (0, import_react9.useRef)(void 0);
|
|
3237
|
+
const settle = (0, import_react9.useRef)(() => {
|
|
3238
|
+
});
|
|
3239
|
+
const arriving = (0, import_react9.useRef)(live);
|
|
3240
|
+
arriving.current = live;
|
|
3241
|
+
useIsoLayoutEffect(() => {
|
|
3242
|
+
const el = ref.current;
|
|
3243
|
+
if (!el) return;
|
|
3244
|
+
last.current = measure(el);
|
|
3245
|
+
const anchoring = el.style.getPropertyValue("overflow-anchor");
|
|
3246
|
+
el.style.setProperty("overflow-anchor", "none");
|
|
3247
|
+
const toEnd = () => {
|
|
3248
|
+
const top = el.scrollHeight - el.clientHeight;
|
|
3249
|
+
if (top - el.scrollTop > 0.5) el.scrollTop = top;
|
|
3250
|
+
};
|
|
3251
|
+
const keep = (render) => {
|
|
3252
|
+
const now = measure(el);
|
|
3253
|
+
const before = last.current;
|
|
3254
|
+
if (before) following.current = followsAfterResize(following.current, before, now);
|
|
3255
|
+
if (following.current) {
|
|
3256
|
+
if (render || arriving.current || !before || now.clientHeight !== before.clientHeight)
|
|
3257
|
+
toEnd();
|
|
3258
|
+
else if (endGap(now) > 0.5) following.current = false;
|
|
3259
|
+
} else if (anchor.current) {
|
|
3260
|
+
const seenAt = anchor.current.top;
|
|
3261
|
+
const mark = anchor.current.marks.find(
|
|
3262
|
+
(m) => m.node.isConnected && m.node.getClientRects().length > 0
|
|
3263
|
+
);
|
|
3264
|
+
if (mark) {
|
|
3265
|
+
const shift = mark.node.getBoundingClientRect().top - el.getBoundingClientRect().top - mark.offset + (el.scrollTop - seenAt);
|
|
3266
|
+
if (Math.abs(shift) > 0.5) el.scrollTop += shift;
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
last.current = measure(el);
|
|
3270
|
+
if (!following.current) anchor.current = anchorOf(el);
|
|
3271
|
+
};
|
|
3272
|
+
settle.current = () => keep(true);
|
|
3273
|
+
const onScroll = () => {
|
|
3274
|
+
const now = measure(el);
|
|
3275
|
+
const was = following.current;
|
|
3276
|
+
following.current = followsAfterScroll(was, last.current ?? now, now);
|
|
3277
|
+
last.current = now;
|
|
3278
|
+
anchor.current = following.current ? void 0 : anchorOf(el);
|
|
3279
|
+
};
|
|
3280
|
+
el.addEventListener("scroll", onScroll, { passive: true });
|
|
3281
|
+
const restore = () => {
|
|
3282
|
+
el.removeEventListener("scroll", onScroll);
|
|
3283
|
+
if (anchoring) el.style.setProperty("overflow-anchor", anchoring);
|
|
3284
|
+
else el.style.removeProperty("overflow-anchor");
|
|
3285
|
+
};
|
|
3286
|
+
if (typeof ResizeObserver === "undefined") return restore;
|
|
3287
|
+
const sizes = new ResizeObserver(() => keep(false));
|
|
3288
|
+
const watch = () => {
|
|
3289
|
+
sizes.disconnect();
|
|
3290
|
+
sizes.observe(el);
|
|
3291
|
+
for (const child of el.children) sizes.observe(child);
|
|
3292
|
+
};
|
|
3293
|
+
watch();
|
|
3294
|
+
const parts = typeof MutationObserver === "undefined" ? void 0 : new MutationObserver((records) => {
|
|
3295
|
+
if (records.some((r) => r.type === "childList")) watch();
|
|
3296
|
+
});
|
|
3297
|
+
parts?.observe(el, { childList: true });
|
|
3298
|
+
return () => {
|
|
3299
|
+
restore();
|
|
3300
|
+
sizes.disconnect();
|
|
3301
|
+
parts?.disconnect();
|
|
3302
|
+
};
|
|
3303
|
+
}, [ref]);
|
|
3304
|
+
useIsoLayoutEffect(() => {
|
|
3305
|
+
following.current = true;
|
|
3306
|
+
anchor.current = void 0;
|
|
3307
|
+
}, [turn]);
|
|
3308
|
+
useIsoLayoutEffect(() => settle.current());
|
|
3309
|
+
};
|
|
3310
|
+
|
|
3311
|
+
// src/hooks/use-mcp-app-host.ts
|
|
3312
|
+
var import_react10 = require("react");
|
|
3313
|
+
|
|
3180
3314
|
// src/mcp-app.ts
|
|
3181
3315
|
var import_agent_web5 = require("@dudko.dev/agent-web");
|
|
3182
3316
|
|
|
@@ -4041,27 +4175,27 @@ var useMcpAppHost = ({
|
|
|
4041
4175
|
sampling = false,
|
|
4042
4176
|
sample: sampleFn
|
|
4043
4177
|
}) => {
|
|
4044
|
-
const [requests, setRequests] = (0,
|
|
4045
|
-
const [draft, setDraft] = (0,
|
|
4046
|
-
const waiting = (0,
|
|
4178
|
+
const [requests, setRequests] = (0, import_react10.useState)([]);
|
|
4179
|
+
const [draft, setDraft] = (0, import_react10.useState)();
|
|
4180
|
+
const waiting = (0, import_react10.useRef)(
|
|
4047
4181
|
/* @__PURE__ */ new Map()
|
|
4048
4182
|
);
|
|
4049
|
-
const samplingAllowed = (0,
|
|
4050
|
-
const sampleRef = (0,
|
|
4183
|
+
const samplingAllowed = (0, import_react10.useRef)(/* @__PURE__ */ new Set());
|
|
4184
|
+
const sampleRef = (0, import_react10.useRef)(sampleFn);
|
|
4051
4185
|
sampleRef.current = sampleFn;
|
|
4052
|
-
const [gated, setGated] = (0,
|
|
4053
|
-
const connectionRef = (0,
|
|
4186
|
+
const [gated, setGated] = (0, import_react10.useState)({});
|
|
4187
|
+
const connectionRef = (0, import_react10.useRef)(connection);
|
|
4054
4188
|
connectionRef.current = connection;
|
|
4055
|
-
const approveRef = (0,
|
|
4189
|
+
const approveRef = (0, import_react10.useRef)(approve);
|
|
4056
4190
|
approveRef.current = approve;
|
|
4057
|
-
(0,
|
|
4191
|
+
(0, import_react10.useEffect)(
|
|
4058
4192
|
() => () => {
|
|
4059
4193
|
for (const { resolve } of waiting.current.values()) resolve(false);
|
|
4060
4194
|
waiting.current.clear();
|
|
4061
4195
|
},
|
|
4062
4196
|
[]
|
|
4063
4197
|
);
|
|
4064
|
-
const ask = (0,
|
|
4198
|
+
const ask = (0, import_react10.useCallback)(
|
|
4065
4199
|
(request, signal, extra = {}) => {
|
|
4066
4200
|
for (const w of waiting.current.values()) {
|
|
4067
4201
|
if (w.request.appId === request.appId) {
|
|
@@ -4086,7 +4220,7 @@ var useMcpAppHost = ({
|
|
|
4086
4220
|
},
|
|
4087
4221
|
[]
|
|
4088
4222
|
);
|
|
4089
|
-
const answer = (0,
|
|
4223
|
+
const answer = (0, import_react10.useCallback)((id, accept, options) => {
|
|
4090
4224
|
const w = waiting.current.get(id);
|
|
4091
4225
|
if (!w) return;
|
|
4092
4226
|
if (accept && w.request.kind === "link" && w.request.link) {
|
|
@@ -4112,16 +4246,16 @@ var useMcpAppHost = ({
|
|
|
4112
4246
|
}
|
|
4113
4247
|
w.resolve(accept);
|
|
4114
4248
|
}, []);
|
|
4115
|
-
const read = (0,
|
|
4249
|
+
const read = (0, import_react10.useCallback)((app, signal) => {
|
|
4116
4250
|
const c = connectionRef.current;
|
|
4117
4251
|
if (!c) return Promise.reject(new Error(`no connection to the server \u201C${app.server}\u201D`));
|
|
4118
4252
|
return c.readUiResource(app.server, app.resourceUri, signal ? { signal } : void 0);
|
|
4119
4253
|
}, []);
|
|
4120
|
-
const tool = (0,
|
|
4254
|
+
const tool = (0, import_react10.useCallback)(
|
|
4121
4255
|
(app) => connectionRef.current?.appTool(app.server, app.toolName),
|
|
4122
4256
|
[]
|
|
4123
4257
|
);
|
|
4124
|
-
const callTool = (0,
|
|
4258
|
+
const callTool = (0, import_react10.useCallback)(
|
|
4125
4259
|
async (app, name, args, signal) => {
|
|
4126
4260
|
const c = connectionRef.current;
|
|
4127
4261
|
if (!c) throw refused(`The server \u201C${app.server}\u201D is not connected`);
|
|
@@ -4158,15 +4292,15 @@ var useMcpAppHost = ({
|
|
|
4158
4292
|
},
|
|
4159
4293
|
[]
|
|
4160
4294
|
);
|
|
4161
|
-
const openLink = (0,
|
|
4295
|
+
const openLink = (0, import_react10.useCallback)(
|
|
4162
4296
|
(app, link, signal) => ask({ appId: app.id, server: app.server, kind: "link", link }, signal),
|
|
4163
4297
|
[ask]
|
|
4164
4298
|
);
|
|
4165
|
-
const message = (0,
|
|
4299
|
+
const message = (0, import_react10.useCallback)(
|
|
4166
4300
|
(app, text2, signal) => ask({ appId: app.id, server: app.server, kind: "message", text: text2 }, signal),
|
|
4167
4301
|
[ask]
|
|
4168
4302
|
);
|
|
4169
|
-
const downloadFile2 = (0,
|
|
4303
|
+
const downloadFile2 = (0, import_react10.useCallback)(
|
|
4170
4304
|
async (app, file, signal) => {
|
|
4171
4305
|
const c = connectionRef.current;
|
|
4172
4306
|
if (file.kind === "link" && !c) throw refused(`The server \u201C${app.server}\u201D is not connected`);
|
|
@@ -4189,7 +4323,7 @@ var useMcpAppHost = ({
|
|
|
4189
4323
|
},
|
|
4190
4324
|
[ask]
|
|
4191
4325
|
);
|
|
4192
|
-
const sample = (0,
|
|
4326
|
+
const sample = (0, import_react10.useCallback)(
|
|
4193
4327
|
async (app, params, signal) => {
|
|
4194
4328
|
const fn = sampleRef.current;
|
|
4195
4329
|
if (!fn) throw refused("This host cannot answer sampling requests");
|
|
@@ -4210,19 +4344,19 @@ var useMcpAppHost = ({
|
|
|
4210
4344
|
},
|
|
4211
4345
|
[ask]
|
|
4212
4346
|
);
|
|
4213
|
-
const pendingAppServers = (0,
|
|
4347
|
+
const pendingAppServers = (0, import_react10.useMemo)(
|
|
4214
4348
|
() => new Set(
|
|
4215
4349
|
approvals.filter((a) => a.app && a.status === "pending").map((a) => `${a.app.server}\0${a.app.resourceUri}`)
|
|
4216
4350
|
),
|
|
4217
4351
|
[approvals]
|
|
4218
4352
|
);
|
|
4219
|
-
const isWaiting = (0,
|
|
4353
|
+
const isWaiting = (0, import_react10.useCallback)(
|
|
4220
4354
|
(app) => requests.some((r) => r.appId === app.id) || Boolean(gated[app.id]) && pendingAppServers.has(`${app.server}\0${app.resourceUri}`),
|
|
4221
4355
|
[requests, gated, pendingAppServers]
|
|
4222
4356
|
);
|
|
4223
4357
|
const sandboxUrl = sandbox?.url;
|
|
4224
4358
|
const sandboxTimeout = sandbox?.timeoutMs;
|
|
4225
|
-
const sandboxSetting = (0,
|
|
4359
|
+
const sandboxSetting = (0, import_react10.useMemo)(
|
|
4226
4360
|
() => sandboxUrl === void 0 ? void 0 : {
|
|
4227
4361
|
url: sandboxUrl,
|
|
4228
4362
|
...sandboxTimeout !== void 0 ? { timeoutMs: sandboxTimeout } : {}
|
|
@@ -4230,7 +4364,7 @@ var useMcpAppHost = ({
|
|
|
4230
4364
|
[sandboxUrl, sandboxTimeout]
|
|
4231
4365
|
);
|
|
4232
4366
|
const samplingOn = sampling && Boolean(sampleFn);
|
|
4233
|
-
return (0,
|
|
4367
|
+
return (0, import_react10.useMemo)(
|
|
4234
4368
|
() => ({
|
|
4235
4369
|
connected: Boolean(connection),
|
|
4236
4370
|
read,
|
|
@@ -4513,11 +4647,11 @@ var AppRequestPrompt = ({
|
|
|
4513
4647
|
};
|
|
4514
4648
|
|
|
4515
4649
|
// src/components/McpAppFrame.tsx
|
|
4516
|
-
var
|
|
4650
|
+
var import_react11 = require("react");
|
|
4517
4651
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4518
4652
|
var HOST_INFO = { name: "@dudko.dev/agent-web-react", version: "1" };
|
|
4519
4653
|
var MAX_LISTED_CALLS = 12;
|
|
4520
|
-
var
|
|
4654
|
+
var useIsoLayoutEffect2 = typeof window === "undefined" ? import_react11.useEffect : import_react11.useLayoutEffect;
|
|
4521
4655
|
var userActivation = () => typeof navigator === "undefined" ? void 0 : navigator.userActivation?.isActive;
|
|
4522
4656
|
var silentSandboxes = /* @__PURE__ */ new Set();
|
|
4523
4657
|
var warned = /* @__PURE__ */ new Set();
|
|
@@ -4550,36 +4684,36 @@ var McpAppFrame = ({
|
|
|
4550
4684
|
className
|
|
4551
4685
|
}) => {
|
|
4552
4686
|
const L = useLabels(labels);
|
|
4553
|
-
const [collapsed, setCollapsed] = (0,
|
|
4554
|
-
const [menu, setMenu] = (0,
|
|
4555
|
-
const [reload, setReload] = (0,
|
|
4556
|
-
const [loaded, setLoaded] = (0,
|
|
4557
|
-
const [height, setHeight] = (0,
|
|
4558
|
-
const [calls, setCalls] = (0,
|
|
4559
|
-
const [fallback, setFallback] = (0,
|
|
4560
|
-
const [broken, setBroken] = (0,
|
|
4561
|
-
const [onOrigin, setOnOrigin] = (0,
|
|
4562
|
-
const shellLoaded = (0,
|
|
4563
|
-
const [mode, setMode] = (0,
|
|
4564
|
-
const modeRef = (0,
|
|
4565
|
-
const [holder, setHolder] = (0,
|
|
4566
|
-
const [fullRect, setFullRect] = (0,
|
|
4567
|
-
const leaveRef = (0,
|
|
4568
|
-
const rootRef = (0,
|
|
4569
|
-
const exitRef = (0,
|
|
4570
|
-
const allowFullscreenRef = (0,
|
|
4687
|
+
const [collapsed, setCollapsed] = (0, import_react11.useState)(defaultCollapsed);
|
|
4688
|
+
const [menu, setMenu] = (0, import_react11.useState)(false);
|
|
4689
|
+
const [reload, setReload] = (0, import_react11.useState)(0);
|
|
4690
|
+
const [loaded, setLoaded] = (0, import_react11.useState)();
|
|
4691
|
+
const [height, setHeight] = (0, import_react11.useState)(APP_DEFAULT_HEIGHT);
|
|
4692
|
+
const [calls, setCalls] = (0, import_react11.useState)([]);
|
|
4693
|
+
const [fallback, setFallback] = (0, import_react11.useState)();
|
|
4694
|
+
const [broken, setBroken] = (0, import_react11.useState)(false);
|
|
4695
|
+
const [onOrigin, setOnOrigin] = (0, import_react11.useState)(false);
|
|
4696
|
+
const shellLoaded = (0, import_react11.useRef)(void 0);
|
|
4697
|
+
const [mode, setMode] = (0, import_react11.useState)("inline");
|
|
4698
|
+
const modeRef = (0, import_react11.useRef)("inline");
|
|
4699
|
+
const [holder, setHolder] = (0, import_react11.useState)(0);
|
|
4700
|
+
const [fullRect, setFullRect] = (0, import_react11.useState)();
|
|
4701
|
+
const leaveRef = (0, import_react11.useRef)(void 0);
|
|
4702
|
+
const rootRef = (0, import_react11.useRef)(null);
|
|
4703
|
+
const exitRef = (0, import_react11.useRef)(null);
|
|
4704
|
+
const allowFullscreenRef = (0, import_react11.useRef)(allowFullscreen);
|
|
4571
4705
|
allowFullscreenRef.current = allowFullscreen;
|
|
4572
|
-
const iframeRef = (0,
|
|
4573
|
-
const bridgeRef = (0,
|
|
4574
|
-
const menuRef = (0,
|
|
4575
|
-
const themeRef = (0,
|
|
4706
|
+
const iframeRef = (0, import_react11.useRef)(null);
|
|
4707
|
+
const bridgeRef = (0, import_react11.useRef)(void 0);
|
|
4708
|
+
const menuRef = (0, import_react11.useRef)(null);
|
|
4709
|
+
const themeRef = (0, import_react11.useRef)(theme);
|
|
4576
4710
|
themeRef.current = theme;
|
|
4577
|
-
const hostRef = (0,
|
|
4711
|
+
const hostRef = (0, import_react11.useRef)(host);
|
|
4578
4712
|
hostRef.current = host;
|
|
4579
|
-
const appRef = (0,
|
|
4713
|
+
const appRef = (0, import_react11.useRef)(app);
|
|
4580
4714
|
appRef.current = app;
|
|
4581
4715
|
const live = !collapsed;
|
|
4582
|
-
(0,
|
|
4716
|
+
(0, import_react11.useEffect)(() => {
|
|
4583
4717
|
if (!live) return;
|
|
4584
4718
|
if (!hostRef.current.connected) {
|
|
4585
4719
|
setLoaded({ unavailable: true });
|
|
@@ -4602,7 +4736,7 @@ var McpAppFrame = ({
|
|
|
4602
4736
|
const resource = loaded && "resource" in loaded ? loaded.resource : void 0;
|
|
4603
4737
|
const sandboxUrl = host.sandbox?.url;
|
|
4604
4738
|
const timeoutMs = host.sandbox?.timeoutMs ?? MCP_APP_SANDBOX_TIMEOUT_MS;
|
|
4605
|
-
const placement = (0,
|
|
4739
|
+
const placement = (0, import_react11.useMemo)(() => {
|
|
4606
4740
|
if (!resource) return void 0;
|
|
4607
4741
|
if (sandboxUrl === void 0) return { mode: "opaque" };
|
|
4608
4742
|
if (fallback) return { mode: "opaque", reason: fallback };
|
|
@@ -4613,11 +4747,11 @@ var McpAppFrame = ({
|
|
|
4613
4747
|
if (!url) return { mode: "opaque", reason: "too-many-origins" };
|
|
4614
4748
|
return { mode: "origin", origin: target.origin, url };
|
|
4615
4749
|
}, [resource, sandboxUrl, fallback, app.server, reload]);
|
|
4616
|
-
const doc = (0,
|
|
4750
|
+
const doc = (0, import_react11.useMemo)(
|
|
4617
4751
|
() => !resource || !placement ? void 0 : placement.mode === "origin" ? buildMcpAppSandboxShell(placement.url) : buildMcpAppDocument(resource.html, resource.csp),
|
|
4618
4752
|
[resource, placement]
|
|
4619
4753
|
);
|
|
4620
|
-
(0,
|
|
4754
|
+
(0, import_react11.useEffect)(() => {
|
|
4621
4755
|
const reason = placement?.mode === "opaque" ? placement.reason : void 0;
|
|
4622
4756
|
if (reason && reason !== "no-answer" && sandboxUrl !== void 0) {
|
|
4623
4757
|
warnOnce(
|
|
@@ -4626,7 +4760,7 @@ var McpAppFrame = ({
|
|
|
4626
4760
|
);
|
|
4627
4761
|
}
|
|
4628
4762
|
}, [placement, sandboxUrl]);
|
|
4629
|
-
(0,
|
|
4763
|
+
(0, import_react11.useEffect)(() => {
|
|
4630
4764
|
const frame = iframeRef.current;
|
|
4631
4765
|
if (!live || !resource || !frame || !placement || broken) return;
|
|
4632
4766
|
const abort = new AbortController();
|
|
@@ -4771,10 +4905,10 @@ var McpAppFrame = ({
|
|
|
4771
4905
|
}, [live, resource, reload, variant, app.id, placement, broken, timeoutMs]);
|
|
4772
4906
|
const fullscreen = mode === "fullscreen" && live && !broken;
|
|
4773
4907
|
const waitingNow = host.isWaiting(app);
|
|
4774
|
-
(0,
|
|
4908
|
+
(0, import_react11.useEffect)(() => {
|
|
4775
4909
|
if (fullscreen && waitingNow) leaveRef.current?.();
|
|
4776
4910
|
}, [fullscreen, waitingNow]);
|
|
4777
|
-
|
|
4911
|
+
useIsoLayoutEffect2(() => {
|
|
4778
4912
|
if (!fullscreen) return;
|
|
4779
4913
|
const place = () => {
|
|
4780
4914
|
const chat2 = rootRef.current?.closest(".awr-chat");
|
|
@@ -4806,7 +4940,7 @@ var McpAppFrame = ({
|
|
|
4806
4940
|
ro?.disconnect();
|
|
4807
4941
|
};
|
|
4808
4942
|
}, [fullscreen]);
|
|
4809
|
-
(0,
|
|
4943
|
+
(0, import_react11.useEffect)(() => {
|
|
4810
4944
|
if (!fullscreen) return;
|
|
4811
4945
|
const before = document.activeElement;
|
|
4812
4946
|
exitRef.current?.focus();
|
|
@@ -4823,10 +4957,10 @@ var McpAppFrame = ({
|
|
|
4823
4957
|
if (frame && (before === frame || document.activeElement === document.body)) frame.focus();
|
|
4824
4958
|
};
|
|
4825
4959
|
}, [fullscreen]);
|
|
4826
|
-
(0,
|
|
4960
|
+
(0, import_react11.useEffect)(() => {
|
|
4827
4961
|
if (theme) bridgeRef.current?.updateContext({ theme });
|
|
4828
4962
|
}, [theme]);
|
|
4829
|
-
(0,
|
|
4963
|
+
(0, import_react11.useEffect)(() => {
|
|
4830
4964
|
if (!menu) return;
|
|
4831
4965
|
const close = (e) => {
|
|
4832
4966
|
if (e instanceof KeyboardEvent ? e.key === "Escape" : !menuRef.current?.contains(e.target)) {
|
|
@@ -5131,7 +5265,7 @@ var McpAppLine = ({ app, note, action, onAction, labels, className }) => {
|
|
|
5131
5265
|
};
|
|
5132
5266
|
|
|
5133
5267
|
// src/components/AgentComposer.tsx
|
|
5134
|
-
var
|
|
5268
|
+
var import_react12 = require("react");
|
|
5135
5269
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5136
5270
|
var thinkingDefaults = (l) => [
|
|
5137
5271
|
{ id: "off", label: l.thinkingLevels.off },
|
|
@@ -5143,10 +5277,10 @@ var thinkingDefaults = (l) => [
|
|
|
5143
5277
|
var MODES = ["autopilot", "ask-writes", "ask-all", "read-only"];
|
|
5144
5278
|
var ModeIcon = ({ mode }) => mode === "autopilot" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BoltIcon, { size: 14 }) : mode === "read-only" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EyeIcon, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ShieldIcon, { size: 14 });
|
|
5145
5279
|
var attachSeq = 0;
|
|
5146
|
-
var
|
|
5280
|
+
var useIsoLayoutEffect3 = typeof window === "undefined" ? import_react12.useEffect : import_react12.useLayoutEffect;
|
|
5147
5281
|
var useMenuPlacement = (open, anchor, align) => {
|
|
5148
|
-
const [style, setStyle] = (0,
|
|
5149
|
-
|
|
5282
|
+
const [style, setStyle] = (0, import_react12.useState)();
|
|
5283
|
+
useIsoLayoutEffect3(() => {
|
|
5150
5284
|
if (!open) return;
|
|
5151
5285
|
const place = () => {
|
|
5152
5286
|
const el = anchor.current;
|
|
@@ -5223,19 +5357,19 @@ var AgentComposer = ({
|
|
|
5223
5357
|
const L = useLabels(labelsOverride);
|
|
5224
5358
|
const MODE_CHIP = L.modes;
|
|
5225
5359
|
const DEFAULT_THINKING = thinkingDefaults(L);
|
|
5226
|
-
const [text2, setText] = (0,
|
|
5227
|
-
const [pending, setPending] = (0,
|
|
5228
|
-
const [menu, setMenu] = (0,
|
|
5229
|
-
const [active, setActive] = (0,
|
|
5230
|
-
const [dismissed, setDismissed] = (0,
|
|
5231
|
-
const [attachError, setAttachError] = (0,
|
|
5232
|
-
const [dragging, setDragging] = (0,
|
|
5233
|
-
const rootRef = (0,
|
|
5234
|
-
const modelRef = (0,
|
|
5235
|
-
const modeRef = (0,
|
|
5236
|
-
const [dropRect, setDropRect] = (0,
|
|
5237
|
-
const [compactBar, setCompactBar] = (0,
|
|
5238
|
-
(0,
|
|
5360
|
+
const [text2, setText] = (0, import_react12.useState)("");
|
|
5361
|
+
const [pending, setPending] = (0, import_react12.useState)([]);
|
|
5362
|
+
const [menu, setMenu] = (0, import_react12.useState)(void 0);
|
|
5363
|
+
const [active, setActive] = (0, import_react12.useState)(0);
|
|
5364
|
+
const [dismissed, setDismissed] = (0, import_react12.useState)(() => /* @__PURE__ */ new Set());
|
|
5365
|
+
const [attachError, setAttachError] = (0, import_react12.useState)();
|
|
5366
|
+
const [dragging, setDragging] = (0, import_react12.useState)(false);
|
|
5367
|
+
const rootRef = (0, import_react12.useRef)(null);
|
|
5368
|
+
const modelRef = (0, import_react12.useRef)(null);
|
|
5369
|
+
const modeRef = (0, import_react12.useRef)(null);
|
|
5370
|
+
const [dropRect, setDropRect] = (0, import_react12.useState)();
|
|
5371
|
+
const [compactBar, setCompactBar] = (0, import_react12.useState)(false);
|
|
5372
|
+
(0, import_react12.useEffect)(() => {
|
|
5239
5373
|
const el = rootRef.current;
|
|
5240
5374
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
5241
5375
|
const ro = new ResizeObserver(
|
|
@@ -5244,11 +5378,11 @@ var AgentComposer = ({
|
|
|
5244
5378
|
ro.observe(el);
|
|
5245
5379
|
return () => ro.disconnect();
|
|
5246
5380
|
}, [compactWidth]);
|
|
5247
|
-
const fileRef = (0,
|
|
5248
|
-
const inputRef = (0,
|
|
5381
|
+
const fileRef = (0, import_react12.useRef)(null);
|
|
5382
|
+
const inputRef = (0, import_react12.useRef)(null);
|
|
5249
5383
|
const draftId = draft?.id;
|
|
5250
5384
|
const draftText = draft?.text;
|
|
5251
|
-
(0,
|
|
5385
|
+
(0, import_react12.useEffect)(() => {
|
|
5252
5386
|
if (draftId === void 0 || !draftText) return;
|
|
5253
5387
|
setText((t) => t.trim() ? `${t.trimEnd()}
|
|
5254
5388
|
${draftText}` : draftText);
|
|
@@ -5265,10 +5399,10 @@ ${draftText}` : draftText);
|
|
|
5265
5399
|
onFinal: (heard) => setText((t) => t.trim() ? `${t.trimEnd()} ${heard}` : heard)
|
|
5266
5400
|
});
|
|
5267
5401
|
const showMic = speech !== false && stt.supported;
|
|
5268
|
-
const [startedAt, setStartedAt] = (0,
|
|
5269
|
-
const [now, setNow] = (0,
|
|
5270
|
-
const [lastElapsed, setLastElapsed] = (0,
|
|
5271
|
-
(0,
|
|
5402
|
+
const [startedAt, setStartedAt] = (0, import_react12.useState)();
|
|
5403
|
+
const [now, setNow] = (0, import_react12.useState)(() => Date.now());
|
|
5404
|
+
const [lastElapsed, setLastElapsed] = (0, import_react12.useState)();
|
|
5405
|
+
(0, import_react12.useEffect)(() => {
|
|
5272
5406
|
if (!busy) {
|
|
5273
5407
|
if (startedAt !== void 0) setLastElapsed(Date.now() - startedAt);
|
|
5274
5408
|
setStartedAt(void 0);
|
|
@@ -5281,7 +5415,7 @@ ${draftText}` : draftText);
|
|
|
5281
5415
|
return () => clearInterval(id);
|
|
5282
5416
|
}, [busy]);
|
|
5283
5417
|
const elapsed = startedAt !== void 0 ? now - startedAt : lastElapsed;
|
|
5284
|
-
const allCommands = (0,
|
|
5418
|
+
const allCommands = (0, import_react12.useMemo)(() => {
|
|
5285
5419
|
const out = [];
|
|
5286
5420
|
if (builtinCommands) {
|
|
5287
5421
|
out.push(
|
|
@@ -5361,8 +5495,8 @@ ${draftText}` : draftText);
|
|
|
5361
5495
|
const commandsStyle = useMenuPlacement(paletteOpen, rootRef, "stretch");
|
|
5362
5496
|
const modelStyle = useMenuPlacement(menu === "model", modelRef, "left");
|
|
5363
5497
|
const modeStyle = useMenuPlacement(menu === "mode", modeRef, "right");
|
|
5364
|
-
(0,
|
|
5365
|
-
(0,
|
|
5498
|
+
(0, import_react12.useEffect)(() => setActive(0), [text2, menu]);
|
|
5499
|
+
(0, import_react12.useEffect)(() => {
|
|
5366
5500
|
if (!menu) return;
|
|
5367
5501
|
const onDown = (e) => {
|
|
5368
5502
|
if (!rootRef.current?.contains(e.target)) setMenu(void 0);
|
|
@@ -5455,9 +5589,9 @@ ${draftText}` : draftText);
|
|
|
5455
5589
|
e.preventDefault();
|
|
5456
5590
|
void addFiles(pasted);
|
|
5457
5591
|
};
|
|
5458
|
-
const addFilesRef = (0,
|
|
5592
|
+
const addFilesRef = (0, import_react12.useRef)(addFiles);
|
|
5459
5593
|
addFilesRef.current = addFiles;
|
|
5460
|
-
(0,
|
|
5594
|
+
(0, import_react12.useEffect)(() => {
|
|
5461
5595
|
if (attachments === false) return;
|
|
5462
5596
|
const target = dropZone === "window" ? globalThis.window : dropZone === "self" ? rootRef.current : dropZone.current;
|
|
5463
5597
|
if (!target) return;
|
|
@@ -5942,7 +6076,7 @@ ${draftText}` : draftText);
|
|
|
5942
6076
|
};
|
|
5943
6077
|
|
|
5944
6078
|
// src/components/ChatHistoryList.tsx
|
|
5945
|
-
var
|
|
6079
|
+
var import_react13 = require("react");
|
|
5946
6080
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5947
6081
|
var defaultTime = (ms) => {
|
|
5948
6082
|
const d = new Date(ms);
|
|
@@ -6012,7 +6146,7 @@ var ChatHistoryList = ({
|
|
|
6012
6146
|
}
|
|
6013
6147
|
)
|
|
6014
6148
|
] }, c.id);
|
|
6015
|
-
return renderChat ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6149
|
+
return renderChat ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react13.Fragment, { children: renderChat(c, active, row) }, c.id) : row;
|
|
6016
6150
|
}) })
|
|
6017
6151
|
] });
|
|
6018
6152
|
};
|
|
@@ -6178,7 +6312,7 @@ var ContextMeter = ({
|
|
|
6178
6312
|
};
|
|
6179
6313
|
|
|
6180
6314
|
// src/components/ElicitationPrompt.tsx
|
|
6181
|
-
var
|
|
6315
|
+
var import_react14 = require("react");
|
|
6182
6316
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6183
6317
|
var reasonText = (outcome, L) => {
|
|
6184
6318
|
const reason = outcome.reason;
|
|
@@ -6188,8 +6322,8 @@ var reasonText = (outcome, L) => {
|
|
|
6188
6322
|
return reason || outcome.status;
|
|
6189
6323
|
};
|
|
6190
6324
|
var useNow = (active) => {
|
|
6191
|
-
const [now, setNow] = (0,
|
|
6192
|
-
(0,
|
|
6325
|
+
const [now, setNow] = (0, import_react14.useState)(() => Date.now());
|
|
6326
|
+
(0, import_react14.useEffect)(() => {
|
|
6193
6327
|
if (!active) return;
|
|
6194
6328
|
setNow(Date.now());
|
|
6195
6329
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -6317,11 +6451,11 @@ var FieldControl = ({ field, id, value, issue, onChange, L }) => {
|
|
|
6317
6451
|
] });
|
|
6318
6452
|
};
|
|
6319
6453
|
var FormBody = ({ elicitation, answer, L }) => {
|
|
6320
|
-
const baseId = (0,
|
|
6454
|
+
const baseId = (0, import_react14.useId)();
|
|
6321
6455
|
const schema = elicitation.requestedSchema;
|
|
6322
6456
|
const fields = elicitationFields(schema);
|
|
6323
|
-
const [draft, setDraft] = (0,
|
|
6324
|
-
const [issues, setIssues] = (0,
|
|
6457
|
+
const [draft, setDraft] = (0, import_react14.useState)(() => elicitationInitialDraft(schema));
|
|
6458
|
+
const [issues, setIssues] = (0, import_react14.useState)(void 0);
|
|
6325
6459
|
const fieldId = (i) => `${baseId}-f${i}`;
|
|
6326
6460
|
const submit = (e) => {
|
|
6327
6461
|
e.preventDefault();
|
|
@@ -6376,7 +6510,7 @@ var FormBody = ({ elicitation, answer, L }) => {
|
|
|
6376
6510
|
};
|
|
6377
6511
|
var UrlBody = ({ elicitation, answer, L }) => {
|
|
6378
6512
|
const link = elicitationLink(elicitation.url);
|
|
6379
|
-
const [opened, setOpened] = (0,
|
|
6513
|
+
const [opened, setOpened] = (0, import_react14.useState)(false);
|
|
6380
6514
|
const open = () => {
|
|
6381
6515
|
if (!link.openable || typeof window === "undefined") return;
|
|
6382
6516
|
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
@@ -6440,7 +6574,7 @@ var ElicitationPrompt = ({
|
|
|
6440
6574
|
className
|
|
6441
6575
|
}) => {
|
|
6442
6576
|
const L = useLabels(labels);
|
|
6443
|
-
const [dismissed, setDismissed] = (0,
|
|
6577
|
+
const [dismissed, setDismissed] = (0, import_react14.useState)(() => /* @__PURE__ */ new Set());
|
|
6444
6578
|
const automatic = showOutcomes ? (outcomes ?? []).filter(
|
|
6445
6579
|
(o) => o.automatic === true && o.status !== "pending" && !dismissed.has(o.id)
|
|
6446
6580
|
) : [];
|
|
@@ -6501,8 +6635,256 @@ var ElicitationPrompt = ({
|
|
|
6501
6635
|
};
|
|
6502
6636
|
|
|
6503
6637
|
// src/components/FilesPanel.tsx
|
|
6504
|
-
var
|
|
6638
|
+
var import_react16 = require("react");
|
|
6639
|
+
|
|
6640
|
+
// src/components/ImageViewer.tsx
|
|
6641
|
+
var import_react15 = require("react");
|
|
6642
|
+
var import_react_dom = require("react-dom");
|
|
6505
6643
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
6644
|
+
var fileNameOf = (name) => name.split(/[\\/]/).filter(Boolean).pop() ?? name;
|
|
6645
|
+
var SWIPE_PX = 48;
|
|
6646
|
+
var ImageViewer = ({ images, index, onIndex, onClose, labels }) => {
|
|
6647
|
+
const L = useLabels(labels);
|
|
6648
|
+
const rootRef = (0, import_react15.useRef)(null);
|
|
6649
|
+
const closeRef = (0, import_react15.useRef)(null);
|
|
6650
|
+
const imgRef = (0, import_react15.useRef)(null);
|
|
6651
|
+
const touch = (0, import_react15.useRef)(void 0);
|
|
6652
|
+
const [zoom, setZoom] = (0, import_react15.useState)(void 0);
|
|
6653
|
+
const count = images.length;
|
|
6654
|
+
const at = Math.min(Math.max(index, 0), count - 1);
|
|
6655
|
+
const image = images[at];
|
|
6656
|
+
const go = (step) => {
|
|
6657
|
+
if (count < 2) return;
|
|
6658
|
+
setZoom(void 0);
|
|
6659
|
+
onIndex((at + step + count) % count);
|
|
6660
|
+
};
|
|
6661
|
+
(0, import_react15.useEffect)(() => {
|
|
6662
|
+
closeRef.current?.focus();
|
|
6663
|
+
const root = document.documentElement;
|
|
6664
|
+
const before = root.style.overflow;
|
|
6665
|
+
root.style.overflow = "hidden";
|
|
6666
|
+
return () => {
|
|
6667
|
+
root.style.overflow = before;
|
|
6668
|
+
};
|
|
6669
|
+
}, []);
|
|
6670
|
+
const keys = (0, import_react15.useRef)(() => {
|
|
6671
|
+
});
|
|
6672
|
+
keys.current = (e) => {
|
|
6673
|
+
if (e.key === "Escape") {
|
|
6674
|
+
e.preventDefault();
|
|
6675
|
+
e.stopPropagation();
|
|
6676
|
+
onClose();
|
|
6677
|
+
} else if (e.key === "ArrowLeft") go(-1);
|
|
6678
|
+
else if (e.key === "ArrowRight") go(1);
|
|
6679
|
+
else if (e.key === "Tab") {
|
|
6680
|
+
const stops = [
|
|
6681
|
+
...rootRef.current?.querySelectorAll("button, a[href]") ?? []
|
|
6682
|
+
].filter((el) => !el.hasAttribute("disabled"));
|
|
6683
|
+
if (!stops.length) return;
|
|
6684
|
+
const first = stops[0];
|
|
6685
|
+
const last = stops[stops.length - 1];
|
|
6686
|
+
const active = document.activeElement;
|
|
6687
|
+
if (!rootRef.current?.contains(active)) {
|
|
6688
|
+
e.preventDefault();
|
|
6689
|
+
(e.shiftKey ? last : first).focus();
|
|
6690
|
+
} else if (e.shiftKey ? active === first : active === last) {
|
|
6691
|
+
e.preventDefault();
|
|
6692
|
+
(e.shiftKey ? last : first).focus();
|
|
6693
|
+
}
|
|
6694
|
+
}
|
|
6695
|
+
};
|
|
6696
|
+
(0, import_react15.useEffect)(() => {
|
|
6697
|
+
const onKey = (e) => keys.current(e);
|
|
6698
|
+
document.addEventListener("keydown", onKey, true);
|
|
6699
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
6700
|
+
}, []);
|
|
6701
|
+
if (!image) return null;
|
|
6702
|
+
const toggleZoom = () => {
|
|
6703
|
+
const img = imgRef.current;
|
|
6704
|
+
if (zoom !== void 0 || !img) return setZoom(void 0);
|
|
6705
|
+
setZoom(Math.max(img.naturalWidth, Math.round(img.clientWidth * 2)));
|
|
6706
|
+
};
|
|
6707
|
+
const onTouchStart = (e) => {
|
|
6708
|
+
touch.current = e.touches.length === 1 ? { x: e.touches[0].clientX, y: e.touches[0].clientY } : void 0;
|
|
6709
|
+
};
|
|
6710
|
+
const onTouchEnd = (e) => {
|
|
6711
|
+
const from = touch.current;
|
|
6712
|
+
touch.current = void 0;
|
|
6713
|
+
if (!from || zoom !== void 0 || e.changedTouches.length !== 1) return;
|
|
6714
|
+
const dx = e.changedTouches[0].clientX - from.x;
|
|
6715
|
+
const dy = e.changedTouches[0].clientY - from.y;
|
|
6716
|
+
if (Math.abs(dx) > SWIPE_PX && Math.abs(dx) > Math.abs(dy) * 1.5) go(dx < 0 ? 1 : -1);
|
|
6717
|
+
};
|
|
6718
|
+
const name = fileNameOf(image.name);
|
|
6719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref: rootRef, className: "awr-viewer", role: "dialog", "aria-modal": "true", "aria-label": name, children: [
|
|
6720
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "awr-viewer__bar", children: [
|
|
6721
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-viewer__name", title: image.name, children: name }),
|
|
6722
|
+
count > 1 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-viewer__count", "aria-live": "polite", children: L.imageCount(at + 1, count) }),
|
|
6723
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6724
|
+
"button",
|
|
6725
|
+
{
|
|
6726
|
+
type: "button",
|
|
6727
|
+
className: "awr-iconbtn awr-viewer__zoom",
|
|
6728
|
+
"aria-label": L.imageZoom,
|
|
6729
|
+
title: L.imageZoom,
|
|
6730
|
+
"aria-pressed": zoom !== void 0,
|
|
6731
|
+
onClick: toggleZoom,
|
|
6732
|
+
children: zoom !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ShrinkIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ExpandIcon, { size: 18 })
|
|
6733
|
+
}
|
|
6734
|
+
),
|
|
6735
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6736
|
+
"a",
|
|
6737
|
+
{
|
|
6738
|
+
className: "awr-iconbtn awr-viewer__download",
|
|
6739
|
+
href: image.src,
|
|
6740
|
+
download: name,
|
|
6741
|
+
"aria-label": L.fileDownload(name),
|
|
6742
|
+
title: L.download,
|
|
6743
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DownloadIcon, { size: 18 })
|
|
6744
|
+
}
|
|
6745
|
+
),
|
|
6746
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6747
|
+
"button",
|
|
6748
|
+
{
|
|
6749
|
+
ref: closeRef,
|
|
6750
|
+
type: "button",
|
|
6751
|
+
className: "awr-iconbtn awr-viewer__close",
|
|
6752
|
+
"aria-label": L.close,
|
|
6753
|
+
title: L.close,
|
|
6754
|
+
onClick: onClose,
|
|
6755
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(XIcon, { size: 18 })
|
|
6756
|
+
}
|
|
6757
|
+
)
|
|
6758
|
+
] }),
|
|
6759
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6760
|
+
"div",
|
|
6761
|
+
{
|
|
6762
|
+
className: `awr-viewer__stage${zoom !== void 0 ? " is-zoomed" : ""}`,
|
|
6763
|
+
onClick: (e) => {
|
|
6764
|
+
if (e.target === e.currentTarget) onClose();
|
|
6765
|
+
},
|
|
6766
|
+
onTouchStart,
|
|
6767
|
+
onTouchEnd,
|
|
6768
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6769
|
+
"img",
|
|
6770
|
+
{
|
|
6771
|
+
ref: imgRef,
|
|
6772
|
+
className: "awr-viewer__img",
|
|
6773
|
+
src: image.src,
|
|
6774
|
+
alt: image.alt ?? name,
|
|
6775
|
+
style: zoom !== void 0 ? { width: zoom } : void 0,
|
|
6776
|
+
onClick: toggleZoom,
|
|
6777
|
+
onDoubleClick: (e) => e.preventDefault(),
|
|
6778
|
+
draggable: false
|
|
6779
|
+
},
|
|
6780
|
+
image.src
|
|
6781
|
+
)
|
|
6782
|
+
}
|
|
6783
|
+
),
|
|
6784
|
+
count > 1 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
6785
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6786
|
+
"button",
|
|
6787
|
+
{
|
|
6788
|
+
type: "button",
|
|
6789
|
+
className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--prev",
|
|
6790
|
+
"aria-label": L.imagePrevious,
|
|
6791
|
+
title: L.imagePrevious,
|
|
6792
|
+
onClick: () => go(-1),
|
|
6793
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u2039" })
|
|
6794
|
+
}
|
|
6795
|
+
),
|
|
6796
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6797
|
+
"button",
|
|
6798
|
+
{
|
|
6799
|
+
type: "button",
|
|
6800
|
+
className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--next",
|
|
6801
|
+
"aria-label": L.imageNext,
|
|
6802
|
+
title: L.imageNext,
|
|
6803
|
+
onClick: () => go(1),
|
|
6804
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u203A" })
|
|
6805
|
+
}
|
|
6806
|
+
)
|
|
6807
|
+
] })
|
|
6808
|
+
] });
|
|
6809
|
+
};
|
|
6810
|
+
var ImageViewerContext = (0, import_react15.createContext)({ enabled: true });
|
|
6811
|
+
var ImageViewerProvider = ({
|
|
6812
|
+
enabled = true,
|
|
6813
|
+
render,
|
|
6814
|
+
children
|
|
6815
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageViewerContext.Provider, { value: { enabled, render }, children });
|
|
6816
|
+
var imageExtensionOf = (src) => {
|
|
6817
|
+
const type = /^data:image\/([a-z0-9.+-]+)/i.exec(src)?.[1]?.toLowerCase();
|
|
6818
|
+
return !type ? "" : type === "jpeg" ? ".jpg" : type === "svg+xml" ? ".svg" : `.${type}`;
|
|
6819
|
+
};
|
|
6820
|
+
var groupOf = (button) => {
|
|
6821
|
+
const scope = button.closest(".awr-msg") ?? button.parentElement ?? button;
|
|
6822
|
+
const buttons = [...scope.querySelectorAll("[data-awr-image]")];
|
|
6823
|
+
const images = buttons.flatMap((b) => {
|
|
6824
|
+
const img = b.querySelector("img");
|
|
6825
|
+
return img ? [{ src: img.currentSrc || img.src, name: b.dataset.awrImage || img.alt, alt: img.alt }] : [];
|
|
6826
|
+
});
|
|
6827
|
+
return { images, index: Math.max(0, buttons.indexOf(button)) };
|
|
6828
|
+
};
|
|
6829
|
+
var ImageThumb = ({
|
|
6830
|
+
src,
|
|
6831
|
+
name,
|
|
6832
|
+
alt,
|
|
6833
|
+
className,
|
|
6834
|
+
imgClassName,
|
|
6835
|
+
title,
|
|
6836
|
+
labels
|
|
6837
|
+
}) => {
|
|
6838
|
+
const L = useLabels(labels);
|
|
6839
|
+
const { enabled, render } = (0, import_react15.useContext)(ImageViewerContext);
|
|
6840
|
+
const ref = (0, import_react15.useRef)(null);
|
|
6841
|
+
const [open, setOpen] = (0, import_react15.useState)(void 0);
|
|
6842
|
+
const img = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { className: imgClassName, src, alt });
|
|
6843
|
+
if (!enabled) {
|
|
6844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("a", { className, href: src, target: "_blank", rel: "noopener noreferrer", title, children: img });
|
|
6845
|
+
}
|
|
6846
|
+
const close = () => {
|
|
6847
|
+
setOpen(void 0);
|
|
6848
|
+
ref.current?.focus();
|
|
6849
|
+
};
|
|
6850
|
+
const viewer = (o) => ({
|
|
6851
|
+
images: o.images,
|
|
6852
|
+
index: o.index,
|
|
6853
|
+
onIndex: (index) => setOpen({ ...o, index }),
|
|
6854
|
+
onClose: close,
|
|
6855
|
+
labels
|
|
6856
|
+
});
|
|
6857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
6858
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6859
|
+
"button",
|
|
6860
|
+
{
|
|
6861
|
+
ref,
|
|
6862
|
+
type: "button",
|
|
6863
|
+
className: ["awr-imgbtn", className].filter(Boolean).join(" "),
|
|
6864
|
+
"data-awr-image": name,
|
|
6865
|
+
"aria-label": L.imageOpen(fileNameOf(name)),
|
|
6866
|
+
"aria-haspopup": "dialog",
|
|
6867
|
+
title,
|
|
6868
|
+
onClick: (e) => {
|
|
6869
|
+
const button = e.currentTarget;
|
|
6870
|
+
setOpen({
|
|
6871
|
+
...groupOf(button),
|
|
6872
|
+
// Inside the chat's element, so its theme applies; it covers the window from there.
|
|
6873
|
+
host: button.closest(".awr-chat, .awr-theme") ?? document.body
|
|
6874
|
+
});
|
|
6875
|
+
},
|
|
6876
|
+
children: img
|
|
6877
|
+
}
|
|
6878
|
+
),
|
|
6879
|
+
open && (0, import_react_dom.createPortal)(
|
|
6880
|
+
render ? render(viewer(open), /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageViewer, { ...viewer(open) })) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageViewer, { ...viewer(open) }),
|
|
6881
|
+
open.host
|
|
6882
|
+
)
|
|
6883
|
+
] });
|
|
6884
|
+
};
|
|
6885
|
+
|
|
6886
|
+
// src/components/FilesPanel.tsx
|
|
6887
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
6506
6888
|
var PREVIEW_CHARS = 2e4;
|
|
6507
6889
|
var FilesPanel = ({
|
|
6508
6890
|
files: vfs,
|
|
@@ -6518,9 +6900,9 @@ var FilesPanel = ({
|
|
|
6518
6900
|
}) => {
|
|
6519
6901
|
const L = useLabels(labels);
|
|
6520
6902
|
const fs = useVirtualFiles(vfs, prefix);
|
|
6521
|
-
const [preview, setPreview] = (0,
|
|
6522
|
-
const inputRef = (0,
|
|
6523
|
-
(0,
|
|
6903
|
+
const [preview, setPreview] = (0, import_react16.useState)();
|
|
6904
|
+
const inputRef = (0, import_react16.useRef)(null);
|
|
6905
|
+
(0, import_react16.useEffect)(() => {
|
|
6524
6906
|
if (preview && !fs.files.some((f) => f.path === preview.path)) setPreview(void 0);
|
|
6525
6907
|
}, [fs.files, preview]);
|
|
6526
6908
|
const open = async (f) => {
|
|
@@ -6543,11 +6925,11 @@ var FilesPanel = ({
|
|
|
6543
6925
|
a.download = f.path.split("/").pop() || "file";
|
|
6544
6926
|
a.click();
|
|
6545
6927
|
};
|
|
6546
|
-
return /* @__PURE__ */ (0,
|
|
6547
|
-
/* @__PURE__ */ (0,
|
|
6548
|
-
/* @__PURE__ */ (0,
|
|
6549
|
-
allowUpload && /* @__PURE__ */ (0,
|
|
6550
|
-
/* @__PURE__ */ (0,
|
|
6928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: ["awr-filespanel", className].filter(Boolean).join(" "), children: [
|
|
6929
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "awr-panel__head", children: [
|
|
6930
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-panel__title", children: title ?? L.files }),
|
|
6931
|
+
allowUpload && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
6932
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6551
6933
|
"button",
|
|
6552
6934
|
{
|
|
6553
6935
|
type: "button",
|
|
@@ -6555,10 +6937,10 @@ var FilesPanel = ({
|
|
|
6555
6937
|
"aria-label": L.upload,
|
|
6556
6938
|
title: L.upload,
|
|
6557
6939
|
onClick: () => inputRef.current?.click(),
|
|
6558
|
-
children: /* @__PURE__ */ (0,
|
|
6940
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PlusIcon, { size: 16 })
|
|
6559
6941
|
}
|
|
6560
6942
|
),
|
|
6561
|
-
/* @__PURE__ */ (0,
|
|
6943
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6562
6944
|
"input",
|
|
6563
6945
|
{
|
|
6564
6946
|
ref: inputRef,
|
|
@@ -6573,15 +6955,15 @@ var FilesPanel = ({
|
|
|
6573
6955
|
)
|
|
6574
6956
|
] })
|
|
6575
6957
|
] }),
|
|
6576
|
-
fs.error && /* @__PURE__ */ (0,
|
|
6577
|
-
!fs.loading && fs.files.length === 0 && /* @__PURE__ */ (0,
|
|
6578
|
-
/* @__PURE__ */ (0,
|
|
6579
|
-
const row = /* @__PURE__ */ (0,
|
|
6958
|
+
fs.error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-notice awr-notice--warn", children: fs.error }),
|
|
6959
|
+
!fs.loading && fs.files.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-panel__empty", children: L.filesEmpty }),
|
|
6960
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "awr-filelist", children: fs.files.map((f) => {
|
|
6961
|
+
const row = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
6580
6962
|
"li",
|
|
6581
6963
|
{
|
|
6582
6964
|
className: `awr-filelist__item${preview?.path === f.path ? " is-active" : ""}`,
|
|
6583
6965
|
children: [
|
|
6584
|
-
/* @__PURE__ */ (0,
|
|
6966
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
6585
6967
|
"button",
|
|
6586
6968
|
{
|
|
6587
6969
|
type: "button",
|
|
@@ -6589,13 +6971,13 @@ var FilesPanel = ({
|
|
|
6589
6971
|
onClick: () => void open(f),
|
|
6590
6972
|
title: `${L.preview}: ${f.path}`,
|
|
6591
6973
|
children: [
|
|
6592
|
-
/* @__PURE__ */ (0,
|
|
6593
|
-
/* @__PURE__ */ (0,
|
|
6594
|
-
/* @__PURE__ */ (0,
|
|
6974
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FileIcon, { size: 14 }),
|
|
6975
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-filelist__path", children: f.path }),
|
|
6976
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-filelist__size", children: L.bytes(f.size) })
|
|
6595
6977
|
]
|
|
6596
6978
|
}
|
|
6597
6979
|
),
|
|
6598
|
-
/* @__PURE__ */ (0,
|
|
6980
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6599
6981
|
"button",
|
|
6600
6982
|
{
|
|
6601
6983
|
type: "button",
|
|
@@ -6603,10 +6985,10 @@ var FilesPanel = ({
|
|
|
6603
6985
|
"aria-label": `${L.download} ${f.path}`,
|
|
6604
6986
|
title: L.download,
|
|
6605
6987
|
onClick: () => void download(f),
|
|
6606
|
-
children: /* @__PURE__ */ (0,
|
|
6988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DownloadIcon, { size: 14 })
|
|
6607
6989
|
}
|
|
6608
6990
|
),
|
|
6609
|
-
allowDelete && /* @__PURE__ */ (0,
|
|
6991
|
+
allowDelete && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6610
6992
|
"button",
|
|
6611
6993
|
{
|
|
6612
6994
|
type: "button",
|
|
@@ -6614,22 +6996,34 @@ var FilesPanel = ({
|
|
|
6614
6996
|
"aria-label": `${L.delete} ${f.path}`,
|
|
6615
6997
|
title: L.delete,
|
|
6616
6998
|
onClick: () => void fs.remove(f.path),
|
|
6617
|
-
children: /* @__PURE__ */ (0,
|
|
6999
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(XIcon, { size: 14 })
|
|
6618
7000
|
}
|
|
6619
7001
|
)
|
|
6620
7002
|
]
|
|
6621
7003
|
},
|
|
6622
7004
|
f.path
|
|
6623
7005
|
);
|
|
6624
|
-
return renderFile ? /* @__PURE__ */ (0,
|
|
7006
|
+
return renderFile ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react16.Fragment, { children: renderFile(f, row) }, f.path) : row;
|
|
6625
7007
|
}) }),
|
|
6626
|
-
preview && /* @__PURE__ */ (0,
|
|
7008
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-filepreview", children: preview.kind === "image" ? (
|
|
7009
|
+
// A click (Enter, Space) opens it over the chat, fitted to the screen.
|
|
7010
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
7011
|
+
ImageThumb,
|
|
7012
|
+
{
|
|
7013
|
+
src: preview.src,
|
|
7014
|
+
name: preview.path,
|
|
7015
|
+
alt: preview.path,
|
|
7016
|
+
title: preview.path,
|
|
7017
|
+
labels
|
|
7018
|
+
}
|
|
7019
|
+
)
|
|
7020
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("pre", { children: preview.text.length > PREVIEW_CHARS ? `${preview.text.slice(0, PREVIEW_CHARS)}
|
|
6627
7021
|
\u2026` : preview.text }) })
|
|
6628
7022
|
] });
|
|
6629
7023
|
};
|
|
6630
7024
|
|
|
6631
7025
|
// src/components/FileChips.tsx
|
|
6632
|
-
var
|
|
7026
|
+
var import_react18 = require("react");
|
|
6633
7027
|
|
|
6634
7028
|
// src/file-kinds.ts
|
|
6635
7029
|
var import_agent_web6 = require("@dudko.dev/agent-web");
|
|
@@ -6647,12 +7041,12 @@ var fileKindOf = (path, mediaType) => {
|
|
|
6647
7041
|
if (mime === "text/plain" || /\.(?:txt|log)$/i.test(path) || (0, import_agent_web6.isTextMime)(mime)) return "text";
|
|
6648
7042
|
return "file";
|
|
6649
7043
|
};
|
|
6650
|
-
var
|
|
7044
|
+
var fileNameOf2 = (path) => path.split("/").filter(Boolean).pop() || "file";
|
|
6651
7045
|
|
|
6652
7046
|
// src/components/Media.tsx
|
|
6653
|
-
var
|
|
7047
|
+
var import_react17 = require("react");
|
|
6654
7048
|
var import_agent_web7 = require("@dudko.dev/agent-web");
|
|
6655
|
-
var
|
|
7049
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
6656
7050
|
var mediaFamilyOf = (mediaType) => {
|
|
6657
7051
|
const type = mediaType.toLowerCase().split(";")[0].trim();
|
|
6658
7052
|
if (Object.hasOwn(import_agent_web7.MEDIA_IMAGE_TYPES, type)) return "image";
|
|
@@ -6667,8 +7061,8 @@ var bytesOf = (content, encoding) => {
|
|
|
6667
7061
|
return bytes;
|
|
6668
7062
|
};
|
|
6669
7063
|
var useFileUrl = (files, path, mediaType) => {
|
|
6670
|
-
const [url, setUrl] = (0,
|
|
6671
|
-
(0,
|
|
7064
|
+
const [url, setUrl] = (0, import_react17.useState)(void 0);
|
|
7065
|
+
(0, import_react17.useEffect)(() => {
|
|
6672
7066
|
if (!files || !mediaType) return;
|
|
6673
7067
|
let made;
|
|
6674
7068
|
let gone = false;
|
|
@@ -6694,20 +7088,21 @@ var GeneratedMedia = ({ media, files, labels }) => {
|
|
|
6694
7088
|
const type = family ? media.mediaType.toLowerCase().split(";")[0].trim() : void 0;
|
|
6695
7089
|
const url = useFileUrl(files, media.path, type);
|
|
6696
7090
|
if (url && family === "image") {
|
|
6697
|
-
return /* @__PURE__ */ (0,
|
|
6698
|
-
|
|
7091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7092
|
+
ImageThumb,
|
|
6699
7093
|
{
|
|
6700
7094
|
className: "awr-media awr-media--image",
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
7095
|
+
imgClassName: "awr-media__img",
|
|
7096
|
+
src: url,
|
|
7097
|
+
name: media.path,
|
|
7098
|
+
alt: L.mediaImage(media.path),
|
|
6704
7099
|
title: media.path,
|
|
6705
|
-
|
|
7100
|
+
labels
|
|
6706
7101
|
}
|
|
6707
7102
|
);
|
|
6708
7103
|
}
|
|
6709
7104
|
if (url && family === "audio") {
|
|
6710
|
-
return /* @__PURE__ */ (0,
|
|
7105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "awr-media awr-media--audio", title: media.path, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6711
7106
|
"audio",
|
|
6712
7107
|
{
|
|
6713
7108
|
className: "awr-media__audio",
|
|
@@ -6718,27 +7113,27 @@ var GeneratedMedia = ({ media, files, labels }) => {
|
|
|
6718
7113
|
}
|
|
6719
7114
|
) });
|
|
6720
7115
|
}
|
|
6721
|
-
return /* @__PURE__ */ (0,
|
|
6722
|
-
/* @__PURE__ */ (0,
|
|
7116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "awr-chip awr-file awr-media awr-media--file", title: L.mediaFile(media.path), children: [
|
|
7117
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FileIcon, { size: 13 }),
|
|
6723
7118
|
" ",
|
|
6724
7119
|
media.path
|
|
6725
7120
|
] });
|
|
6726
7121
|
};
|
|
6727
7122
|
var TranscriptBlock = ({ transcript, labels }) => {
|
|
6728
7123
|
const L = useLabels(labels);
|
|
6729
|
-
return /* @__PURE__ */ (0,
|
|
6730
|
-
/* @__PURE__ */ (0,
|
|
6731
|
-
/* @__PURE__ */ (0,
|
|
7124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("details", { className: "awr-transcript", children: [
|
|
7125
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("summary", { className: "awr-transcript__summary", children: [
|
|
7126
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FileIcon, { size: 13 }),
|
|
6732
7127
|
" ",
|
|
6733
7128
|
L.transcriptOf(transcript.name)
|
|
6734
7129
|
] }),
|
|
6735
|
-
/* @__PURE__ */ (0,
|
|
6736
|
-
/* @__PURE__ */ (0,
|
|
7130
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "awr-transcript__note", children: L.transcriptNote }),
|
|
7131
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("blockquote", { className: "awr-transcript__text", children: transcript.text })
|
|
6737
7132
|
] });
|
|
6738
7133
|
};
|
|
6739
7134
|
|
|
6740
7135
|
// src/components/SandboxedFrame.tsx
|
|
6741
|
-
var
|
|
7136
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
6742
7137
|
var FRAME_MIN_HEIGHT = 120;
|
|
6743
7138
|
var FRAME_MAX_HEIGHT = 800;
|
|
6744
7139
|
var clampFrameHeight = (height) => Math.min(
|
|
@@ -6755,12 +7150,12 @@ var SandboxedFrame = ({
|
|
|
6755
7150
|
height = 300,
|
|
6756
7151
|
children,
|
|
6757
7152
|
className
|
|
6758
|
-
}) => /* @__PURE__ */ (0,
|
|
6759
|
-
/* @__PURE__ */ (0,
|
|
6760
|
-
/* @__PURE__ */ (0,
|
|
7153
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: ["awr-frame", className].filter(Boolean).join(" "), children: [
|
|
7154
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "awr-frame__head", children: [
|
|
7155
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-frame__label", children: label }),
|
|
6761
7156
|
actions
|
|
6762
7157
|
] }),
|
|
6763
|
-
html !== void 0 && children === void 0 ? /* @__PURE__ */ (0,
|
|
7158
|
+
html !== void 0 && children === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-frame__well", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6764
7159
|
"iframe",
|
|
6765
7160
|
{
|
|
6766
7161
|
className: "awr-frame__iframe",
|
|
@@ -6772,11 +7167,11 @@ var SandboxedFrame = ({
|
|
|
6772
7167
|
},
|
|
6773
7168
|
scripts ? "scripts" : "static"
|
|
6774
7169
|
) }) : children,
|
|
6775
|
-
footer ? /* @__PURE__ */ (0,
|
|
7170
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-frame__foot", children: footer }) : null
|
|
6776
7171
|
] });
|
|
6777
7172
|
|
|
6778
7173
|
// src/components/FileChips.tsx
|
|
6779
|
-
var
|
|
7174
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
6780
7175
|
var FILE_PREVIEW_CHARS = 2e4;
|
|
6781
7176
|
var textOf = (file) => file.encoding === "base64" ? new TextDecoder().decode(bytesOf(file.content, "base64")) : file.content;
|
|
6782
7177
|
var KIND_ICON = {
|
|
@@ -6797,11 +7192,11 @@ var downloadFile = async (vfs, path) => {
|
|
|
6797
7192
|
);
|
|
6798
7193
|
const a = document.createElement("a");
|
|
6799
7194
|
a.href = url;
|
|
6800
|
-
a.download =
|
|
7195
|
+
a.download = fileNameOf2(path);
|
|
6801
7196
|
a.click();
|
|
6802
7197
|
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
6803
7198
|
};
|
|
6804
|
-
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ (0,
|
|
7199
|
+
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "awr-seg", role: "group", "aria-label": label, children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
6805
7200
|
"button",
|
|
6806
7201
|
{
|
|
6807
7202
|
type: "button",
|
|
@@ -6836,32 +7231,32 @@ var SourceView = ({
|
|
|
6836
7231
|
const L = useLabels(labels);
|
|
6837
7232
|
const cut = text2.length > maxChars;
|
|
6838
7233
|
const shown = cut ? text2.slice(0, maxChars) : text2;
|
|
6839
|
-
const lines = (0,
|
|
7234
|
+
const lines = (0, import_react18.useMemo)(
|
|
6840
7235
|
() => linesOf(html ? tokenizeHtml(shown) : [{ kind: "text", text: shown }]),
|
|
6841
7236
|
[shown, html]
|
|
6842
7237
|
);
|
|
6843
|
-
return /* @__PURE__ */ (0,
|
|
6844
|
-
/* @__PURE__ */ (0,
|
|
7238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
7239
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("pre", { className: ["awr-source", className].filter(Boolean).join(" "), tabIndex: 0, children: lines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-source__line", children: [
|
|
6845
7240
|
line.map(
|
|
6846
|
-
(t, k) => t.kind === "text" ? /* @__PURE__ */ (0,
|
|
7241
|
+
(t, k) => t.kind === "text" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react18.Fragment, { children: t.text }, k) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
|
|
6847
7242
|
),
|
|
6848
7243
|
"\n"
|
|
6849
7244
|
] }, i)) }),
|
|
6850
|
-
cut && /* @__PURE__ */ (0,
|
|
7245
|
+
cut && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-fileview__cut", children: L.fileCut(maxChars) })
|
|
6851
7246
|
] });
|
|
6852
7247
|
};
|
|
6853
7248
|
var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
6854
|
-
const html = (0,
|
|
7249
|
+
const html = (0, import_react18.useMemo)(() => textOf(file), [file]);
|
|
6855
7250
|
const options = htmlPreview === false ? void 0 : htmlPreview;
|
|
6856
7251
|
const tooLarge = html.length > HTML_PREVIEW_MAX_CHARS;
|
|
6857
7252
|
const canFrame = Boolean(options) && !tooLarge;
|
|
6858
|
-
const [view, setView] = (0,
|
|
6859
|
-
const [tall, setTall] = (0,
|
|
7253
|
+
const [view, setView] = (0, import_react18.useState)(canFrame ? "preview" : "source");
|
|
7254
|
+
const [tall, setTall] = (0, import_react18.useState)(false);
|
|
6860
7255
|
const showing = canFrame ? view : "source";
|
|
6861
7256
|
const scripts = options?.scripts === true;
|
|
6862
7257
|
const height = options?.height ?? 300;
|
|
6863
|
-
const linked = (0,
|
|
6864
|
-
return /* @__PURE__ */ (0,
|
|
7258
|
+
const linked = (0, import_react18.useMemo)(() => showing === "preview" ? linkedFilesOf(html) : [], [html, showing]);
|
|
7259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6865
7260
|
SandboxedFrame,
|
|
6866
7261
|
{
|
|
6867
7262
|
className: "awr-frame--html",
|
|
@@ -6869,35 +7264,35 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6869
7264
|
html: showing === "preview" ? html : void 0,
|
|
6870
7265
|
scripts,
|
|
6871
7266
|
height: tall ? height * 2 : height,
|
|
6872
|
-
label: /* @__PURE__ */ (0,
|
|
6873
|
-
/* @__PURE__ */ (0,
|
|
6874
|
-
/* @__PURE__ */ (0,
|
|
6875
|
-
/* @__PURE__ */ (0,
|
|
6876
|
-
/* @__PURE__ */ (0,
|
|
6877
|
-
/* @__PURE__ */ (0,
|
|
7267
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
7268
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CodeIcon, { size: 14, className: "awr-frame__icon" }),
|
|
7269
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-frame__titles", children: [
|
|
7270
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
|
|
7271
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
7272
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LockIcon, { size: 11 }),
|
|
6878
7273
|
" ",
|
|
6879
7274
|
L.htmlSandboxed,
|
|
6880
7275
|
" \xB7 ",
|
|
6881
|
-
/* @__PURE__ */ (0,
|
|
7276
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NoNetworkIcon, { size: 11 }),
|
|
6882
7277
|
" ",
|
|
6883
7278
|
L.htmlNoNetwork
|
|
6884
7279
|
] }) : L.htmlSourceNote })
|
|
6885
7280
|
] })
|
|
6886
7281
|
] }),
|
|
6887
|
-
actions: canFrame ? /* @__PURE__ */ (0,
|
|
6888
|
-
/* @__PURE__ */ (0,
|
|
7282
|
+
actions: canFrame ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
7283
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6889
7284
|
Seg,
|
|
6890
7285
|
{
|
|
6891
7286
|
label: L.htmlFrameTitle,
|
|
6892
7287
|
value: showing,
|
|
6893
7288
|
onChange: setView,
|
|
6894
7289
|
options: [
|
|
6895
|
-
{ value: "preview", label: L.preview, icon: /* @__PURE__ */ (0,
|
|
6896
|
-
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */ (0,
|
|
7290
|
+
{ value: "preview", label: L.preview, icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EyeIcon, { size: 13 }) },
|
|
7291
|
+
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CodeIcon, { size: 13 }) }
|
|
6897
7292
|
]
|
|
6898
7293
|
}
|
|
6899
7294
|
),
|
|
6900
|
-
/* @__PURE__ */ (0,
|
|
7295
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6901
7296
|
"button",
|
|
6902
7297
|
{
|
|
6903
7298
|
type: "button",
|
|
@@ -6907,14 +7302,14 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6907
7302
|
"aria-pressed": tall,
|
|
6908
7303
|
disabled: showing !== "preview",
|
|
6909
7304
|
onClick: () => setTall((t) => !t),
|
|
6910
|
-
children: /* @__PURE__ */ (0,
|
|
7305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ExpandIcon, { size: 15 })
|
|
6911
7306
|
}
|
|
6912
7307
|
)
|
|
6913
7308
|
] }) : void 0,
|
|
6914
|
-
footer: /* @__PURE__ */ (0,
|
|
6915
|
-
/* @__PURE__ */ (0,
|
|
6916
|
-
/* @__PURE__ */ (0,
|
|
6917
|
-
/* @__PURE__ */ (0,
|
|
7309
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
7310
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileIcon, { size: 11 }),
|
|
7311
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { children: written.path }),
|
|
7312
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-frame__footmeta", children: [
|
|
6918
7313
|
"\xB7 ",
|
|
6919
7314
|
L.bytes(file.size),
|
|
6920
7315
|
" \xB7",
|
|
@@ -6923,18 +7318,18 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6923
7318
|
linked.length > 0 ? ` \xB7 ${L.htmlLinkedFiles(linked.join(", "))}` : ""
|
|
6924
7319
|
] })
|
|
6925
7320
|
] }),
|
|
6926
|
-
children: showing === "source" ? /* @__PURE__ */ (0,
|
|
6927
|
-
tooLarge && options ? /* @__PURE__ */ (0,
|
|
6928
|
-
/* @__PURE__ */ (0,
|
|
7321
|
+
children: showing === "source" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
7322
|
+
tooLarge && options ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
|
|
7323
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
|
|
6929
7324
|
] }) : void 0
|
|
6930
7325
|
}
|
|
6931
7326
|
);
|
|
6932
7327
|
};
|
|
6933
7328
|
var ImagePreview = ({ written, vfs, onClose, L }) => {
|
|
6934
7329
|
const url = useFileUrl(vfs, written.path, written.mediaType.toLowerCase().split(";")[0].trim());
|
|
6935
|
-
return /* @__PURE__ */ (0,
|
|
6936
|
-
/* @__PURE__ */ (0,
|
|
6937
|
-
/* @__PURE__ */ (0,
|
|
7330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-fileview", children: [
|
|
7331
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileViewHead, { written, kind: "image", onClose, L }),
|
|
7332
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "awr-fileview__image", children: url ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: url, alt: fileNameOf2(written.path) }) : null })
|
|
6938
7333
|
] });
|
|
6939
7334
|
};
|
|
6940
7335
|
var FileViewHead = ({
|
|
@@ -6943,15 +7338,15 @@ var FileViewHead = ({
|
|
|
6943
7338
|
onClose,
|
|
6944
7339
|
L,
|
|
6945
7340
|
children
|
|
6946
|
-
}) => /* @__PURE__ */ (0,
|
|
6947
|
-
/* @__PURE__ */ (0,
|
|
6948
|
-
/* @__PURE__ */ (0,
|
|
7341
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-fileview__head", children: [
|
|
7342
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-fileview__name", title: written.path, children: fileNameOf2(written.path) }),
|
|
7343
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-fileview__kind", children: [
|
|
6949
7344
|
"\xB7 ",
|
|
6950
7345
|
L.fileKinds[kind]
|
|
6951
7346
|
] }),
|
|
6952
|
-
/* @__PURE__ */ (0,
|
|
7347
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-fileview__actions", children: [
|
|
6953
7348
|
children,
|
|
6954
|
-
/* @__PURE__ */ (0,
|
|
7349
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6955
7350
|
"button",
|
|
6956
7351
|
{
|
|
6957
7352
|
type: "button",
|
|
@@ -6959,7 +7354,7 @@ var FileViewHead = ({
|
|
|
6959
7354
|
"aria-label": L.closePreview,
|
|
6960
7355
|
title: L.closePreview,
|
|
6961
7356
|
onClick: onClose,
|
|
6962
|
-
children: /* @__PURE__ */ (0,
|
|
7357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(XIcon, { size: 14 })
|
|
6963
7358
|
}
|
|
6964
7359
|
)
|
|
6965
7360
|
] })
|
|
@@ -6973,21 +7368,21 @@ var TextPreview = ({
|
|
|
6973
7368
|
onClose,
|
|
6974
7369
|
L
|
|
6975
7370
|
}) => {
|
|
6976
|
-
const text2 = (0,
|
|
6977
|
-
const rendered = (0,
|
|
7371
|
+
const text2 = (0, import_react18.useMemo)(() => textOf(file), [file]);
|
|
7372
|
+
const rendered = (0, import_react18.useMemo)(
|
|
6978
7373
|
() => renderFileContent?.(written, text2.slice(0, previewChars)),
|
|
6979
7374
|
[renderFileContent, written, text2, previewChars]
|
|
6980
7375
|
);
|
|
6981
7376
|
const hasRendered = rendered !== void 0 && rendered !== null && rendered !== false;
|
|
6982
|
-
const [view, setView] = (0,
|
|
6983
|
-
const [all, setAll] = (0,
|
|
7377
|
+
const [view, setView] = (0, import_react18.useState)("rendered");
|
|
7378
|
+
const [all, setAll] = (0, import_react18.useState)(false);
|
|
6984
7379
|
const showing = hasRendered ? view : "source";
|
|
6985
7380
|
const long = text2.length > 1200 || text2.split("\n").length > 16;
|
|
6986
|
-
return /* @__PURE__ */ (0,
|
|
6987
|
-
/* @__PURE__ */ (0,
|
|
7381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-fileview", children: [
|
|
7382
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileViewHead, { written, kind, onClose, L, children: hasRendered && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6988
7383
|
Seg,
|
|
6989
7384
|
{
|
|
6990
|
-
label:
|
|
7385
|
+
label: fileNameOf2(written.path),
|
|
6991
7386
|
value: showing,
|
|
6992
7387
|
onChange: setView,
|
|
6993
7388
|
options: [
|
|
@@ -6996,16 +7391,16 @@ var TextPreview = ({
|
|
|
6996
7391
|
]
|
|
6997
7392
|
}
|
|
6998
7393
|
) }),
|
|
6999
|
-
/* @__PURE__ */ (0,
|
|
7000
|
-
/* @__PURE__ */ (0,
|
|
7001
|
-
text2.length > previewChars && /* @__PURE__ */ (0,
|
|
7002
|
-
] }) : /* @__PURE__ */ (0,
|
|
7003
|
-
long && /* @__PURE__ */ (0,
|
|
7394
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
7395
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "awr-fileview__rendered", children: rendered }),
|
|
7396
|
+
text2.length > previewChars && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
|
|
7397
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SourceView, { text: text2, maxChars: previewChars }) }),
|
|
7398
|
+
long && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "awr-fileview__more", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: () => setAll((a) => !a), children: all ? L.fileShowLess : L.fileShowRest }) })
|
|
7004
7399
|
] });
|
|
7005
7400
|
};
|
|
7006
|
-
var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ (0,
|
|
7007
|
-
/* @__PURE__ */ (0,
|
|
7008
|
-
/* @__PURE__ */ (0,
|
|
7401
|
+
var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-fileview", children: [
|
|
7402
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileViewHead, { written, kind, onClose, L }),
|
|
7403
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-fileview__none", children: L.fileNoPreview })
|
|
7009
7404
|
] });
|
|
7010
7405
|
var FileChips = ({
|
|
7011
7406
|
written,
|
|
@@ -7022,11 +7417,11 @@ var FileChips = ({
|
|
|
7022
7417
|
}) => {
|
|
7023
7418
|
const L = useLabels(labels);
|
|
7024
7419
|
const live = useVirtualFiles(vfs);
|
|
7025
|
-
const [openPath, setOpenPath] = (0,
|
|
7026
|
-
const [file, setFile] = (0,
|
|
7420
|
+
const [openPath, setOpenPath] = (0, import_react18.useState)(defaultOpen);
|
|
7421
|
+
const [file, setFile] = (0, import_react18.useState)();
|
|
7027
7422
|
const open = written.find((f) => f.path === openPath);
|
|
7028
7423
|
const stamp = live.files.find((f) => f.path === openPath)?.updatedAt;
|
|
7029
|
-
(0,
|
|
7424
|
+
(0, import_react18.useEffect)(() => {
|
|
7030
7425
|
if (!vfs || !openPath) return setFile(void 0);
|
|
7031
7426
|
let gone = false;
|
|
7032
7427
|
vfs.read(openPath).then((f) => {
|
|
@@ -7053,23 +7448,23 @@ var FileChips = ({
|
|
|
7053
7448
|
onClose: () => setOpenPath(void 0),
|
|
7054
7449
|
L
|
|
7055
7450
|
};
|
|
7056
|
-
if (kind === "html") return /* @__PURE__ */ (0,
|
|
7057
|
-
if (kind === "image") return /* @__PURE__ */ (0,
|
|
7058
|
-
if (kind === "file") return /* @__PURE__ */ (0,
|
|
7059
|
-
return /* @__PURE__ */ (0,
|
|
7451
|
+
if (kind === "html") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(HtmlPreview, { ...props }, open.path);
|
|
7452
|
+
if (kind === "image") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ImagePreview, { ...props }, open.path);
|
|
7453
|
+
if (kind === "file") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NoPreview, { ...props }, open.path);
|
|
7454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TextPreview, { ...props }, open.path);
|
|
7060
7455
|
};
|
|
7061
|
-
return /* @__PURE__ */ (0,
|
|
7062
|
-
showHeader && /* @__PURE__ */ (0,
|
|
7063
|
-
/* @__PURE__ */ (0,
|
|
7064
|
-
/* @__PURE__ */ (0,
|
|
7065
|
-
onShowFiles && /* @__PURE__ */ (0,
|
|
7456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: ["awr-msg__files", className].filter(Boolean).join(" "), children: [
|
|
7457
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-msg__fileshead", children: [
|
|
7458
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileIcon, { size: 13 }),
|
|
7459
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: L.filesWritten(written.length) }),
|
|
7460
|
+
onShowFiles && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: onShowFiles, children: L.showInFiles })
|
|
7066
7461
|
] }),
|
|
7067
|
-
/* @__PURE__ */ (0,
|
|
7462
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "awr-filechips", children: written.map((w) => {
|
|
7068
7463
|
const info = live.files.find((f) => f.path === w.path);
|
|
7069
7464
|
const gone = Boolean(vfs) && !live.loading && !info;
|
|
7070
7465
|
const usable = Boolean(vfs) && !gone;
|
|
7071
7466
|
const isOpen = openPath === w.path && usable;
|
|
7072
|
-
const chip = /* @__PURE__ */ (0,
|
|
7467
|
+
const chip = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7073
7468
|
FileChip,
|
|
7074
7469
|
{
|
|
7075
7470
|
written: w,
|
|
@@ -7082,7 +7477,7 @@ var FileChips = ({
|
|
|
7082
7477
|
labels
|
|
7083
7478
|
}
|
|
7084
7479
|
);
|
|
7085
|
-
return /* @__PURE__ */ (0,
|
|
7480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: "awr-filechips__item", children: renderFile ? renderFile(w, chip) : chip }, w.path);
|
|
7086
7481
|
}) }),
|
|
7087
7482
|
preview()
|
|
7088
7483
|
] });
|
|
@@ -7099,7 +7494,7 @@ var FileChip = ({
|
|
|
7099
7494
|
}) => {
|
|
7100
7495
|
const L = useLabels(labels);
|
|
7101
7496
|
const kind = fileKindOf(written.path, mediaType);
|
|
7102
|
-
const name =
|
|
7497
|
+
const name = fileNameOf2(written.path);
|
|
7103
7498
|
const Icon = KIND_ICON[kind];
|
|
7104
7499
|
const thumb = useFileUrl(
|
|
7105
7500
|
kind === "image" ? vfs : void 0,
|
|
@@ -7107,19 +7502,19 @@ var FileChip = ({
|
|
|
7107
7502
|
kind === "image" ? mediaType.toLowerCase().split(";")[0].trim() : void 0
|
|
7108
7503
|
);
|
|
7109
7504
|
const meta = gone ? L.fileGone : [L.fileKinds[kind], L.bytes(bytes), written.by ? L.fileBy(written.by.name) : ""].filter(Boolean).join(" \xB7 ");
|
|
7110
|
-
return /* @__PURE__ */ (0,
|
|
7505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
7111
7506
|
"div",
|
|
7112
7507
|
{
|
|
7113
7508
|
className: `awr-filechip${open ? " is-open" : ""}${gone ? " is-gone" : ""}`,
|
|
7114
7509
|
title: written.path,
|
|
7115
7510
|
children: [
|
|
7116
|
-
/* @__PURE__ */ (0,
|
|
7117
|
-
/* @__PURE__ */ (0,
|
|
7118
|
-
/* @__PURE__ */ (0,
|
|
7119
|
-
/* @__PURE__ */ (0,
|
|
7511
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-filechip__thumb", children: thumb ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: thumb, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { size: 16 }) }),
|
|
7512
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-filechip__text", children: [
|
|
7513
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-filechip__name", children: name }),
|
|
7514
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-filechip__meta", children: meta })
|
|
7120
7515
|
] }),
|
|
7121
|
-
vfs && /* @__PURE__ */ (0,
|
|
7122
|
-
onToggle && /* @__PURE__ */ (0,
|
|
7516
|
+
vfs && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-filechip__actions", children: [
|
|
7517
|
+
onToggle && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7123
7518
|
"button",
|
|
7124
7519
|
{
|
|
7125
7520
|
type: "button",
|
|
@@ -7128,10 +7523,10 @@ var FileChip = ({
|
|
|
7128
7523
|
title: open ? L.closePreview : L.preview,
|
|
7129
7524
|
"aria-expanded": open,
|
|
7130
7525
|
onClick: onToggle,
|
|
7131
|
-
children: open ? /* @__PURE__ */ (0,
|
|
7526
|
+
children: open ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronUpIcon, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EyeIcon, { size: 15 })
|
|
7132
7527
|
}
|
|
7133
7528
|
),
|
|
7134
|
-
/* @__PURE__ */ (0,
|
|
7529
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7135
7530
|
"button",
|
|
7136
7531
|
{
|
|
7137
7532
|
type: "button",
|
|
@@ -7139,7 +7534,7 @@ var FileChip = ({
|
|
|
7139
7534
|
"aria-label": L.fileDownload(name),
|
|
7140
7535
|
title: L.download,
|
|
7141
7536
|
onClick: () => void downloadFile(vfs, written.path),
|
|
7142
|
-
children: /* @__PURE__ */ (0,
|
|
7537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DownloadIcon, { size: 15 })
|
|
7143
7538
|
}
|
|
7144
7539
|
)
|
|
7145
7540
|
] })
|
|
@@ -7149,14 +7544,14 @@ var FileChip = ({
|
|
|
7149
7544
|
};
|
|
7150
7545
|
|
|
7151
7546
|
// src/components/StepList.tsx
|
|
7152
|
-
var
|
|
7547
|
+
var import_react20 = require("react");
|
|
7153
7548
|
|
|
7154
7549
|
// src/components/SubagentTree.tsx
|
|
7155
|
-
var
|
|
7156
|
-
var
|
|
7550
|
+
var import_react19 = require("react");
|
|
7551
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
7157
7552
|
var useElapsed = (startedAt, running) => {
|
|
7158
|
-
const [now, setNow] = (0,
|
|
7159
|
-
(0,
|
|
7553
|
+
const [now, setNow] = (0, import_react19.useState)(void 0);
|
|
7554
|
+
(0, import_react19.useEffect)(() => {
|
|
7160
7555
|
if (!running || startedAt === void 0) return;
|
|
7161
7556
|
setNow(Date.now());
|
|
7162
7557
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -7184,19 +7579,19 @@ var SubagentRow = ({
|
|
|
7184
7579
|
sub.toolCalls > 0 ? L.toolCalls(sub.toolCalls) : "",
|
|
7185
7580
|
time !== void 0 ? formatDuration(time) : ""
|
|
7186
7581
|
].filter(Boolean);
|
|
7187
|
-
return /* @__PURE__ */ (0,
|
|
7582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
7188
7583
|
"li",
|
|
7189
7584
|
{
|
|
7190
7585
|
className: `awr-subagent awr-subagent--${sub.status}${sub.dynamic ? " awr-subagent--dynamic" : ""}`,
|
|
7191
7586
|
"data-depth": sub.depth,
|
|
7192
7587
|
children: [
|
|
7193
|
-
/* @__PURE__ */ (0,
|
|
7194
|
-
/* @__PURE__ */ (0,
|
|
7195
|
-
/* @__PURE__ */ (0,
|
|
7196
|
-
sub.dynamic && role && /* @__PURE__ */ (0,
|
|
7197
|
-
sub.profile && /* @__PURE__ */ (0,
|
|
7198
|
-
/* @__PURE__ */ (0,
|
|
7199
|
-
running && onStop && /* @__PURE__ */ (0,
|
|
7588
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-subagent__head", children: [
|
|
7589
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StopIcon, { size: 13 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AlertIcon, { size: 13 }) }),
|
|
7590
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
|
|
7591
|
+
sub.dynamic && role && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
|
|
7592
|
+
sub.profile && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
7593
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
7594
|
+
running && onStop && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
7200
7595
|
"button",
|
|
7201
7596
|
{
|
|
7202
7597
|
type: "button",
|
|
@@ -7204,16 +7599,16 @@ var SubagentRow = ({
|
|
|
7204
7599
|
"aria-label": L.stopSubagent,
|
|
7205
7600
|
title: L.stopSubagent,
|
|
7206
7601
|
onClick: () => onStop(sub.id),
|
|
7207
|
-
children: /* @__PURE__ */ (0,
|
|
7602
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StopIcon, { size: 12 })
|
|
7208
7603
|
}
|
|
7209
7604
|
)
|
|
7210
7605
|
] }),
|
|
7211
|
-
showUsage && /* @__PURE__ */ (0,
|
|
7212
|
-
/* @__PURE__ */ (0,
|
|
7213
|
-
meta.map((part, i) => /* @__PURE__ */ (0,
|
|
7606
|
+
showUsage && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-subagent__meta", children: [
|
|
7607
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
|
|
7608
|
+
meta.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__metaitem", children: part }, i))
|
|
7214
7609
|
] }),
|
|
7215
|
-
showTools && sub.tools && /* @__PURE__ */ (0,
|
|
7216
|
-
/* @__PURE__ */ (0,
|
|
7610
|
+
showTools && sub.tools && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
|
|
7611
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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)}` : ""}` }),
|
|
7217
7612
|
children
|
|
7218
7613
|
]
|
|
7219
7614
|
}
|
|
@@ -7229,12 +7624,12 @@ var SubagentTree = ({
|
|
|
7229
7624
|
className
|
|
7230
7625
|
}) => {
|
|
7231
7626
|
if (subagents.length === 0) return null;
|
|
7232
|
-
const branch = (nodes, nested) => /* @__PURE__ */ (0,
|
|
7627
|
+
const branch = (nodes, nested) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
7233
7628
|
"ul",
|
|
7234
7629
|
{
|
|
7235
7630
|
className: ["awr-subagents", nested ? "awr-subagents--nested" : className].filter(Boolean).join(" "),
|
|
7236
7631
|
children: nodes.map((node) => {
|
|
7237
|
-
const row = /* @__PURE__ */ (0,
|
|
7632
|
+
const row = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
7238
7633
|
SubagentRow,
|
|
7239
7634
|
{
|
|
7240
7635
|
sub: node,
|
|
@@ -7246,7 +7641,7 @@ var SubagentTree = ({
|
|
|
7246
7641
|
},
|
|
7247
7642
|
node.id
|
|
7248
7643
|
);
|
|
7249
|
-
return renderSubagent ? /* @__PURE__ */ (0,
|
|
7644
|
+
return renderSubagent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react19.Fragment, { children: renderSubagent(node, row) }, node.id) : row;
|
|
7250
7645
|
})
|
|
7251
7646
|
}
|
|
7252
7647
|
);
|
|
@@ -7254,7 +7649,7 @@ var SubagentTree = ({
|
|
|
7254
7649
|
};
|
|
7255
7650
|
|
|
7256
7651
|
// src/components/StepList.tsx
|
|
7257
|
-
var
|
|
7652
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
7258
7653
|
var WEB_SEARCH = "web_search";
|
|
7259
7654
|
var ToolCallRow = ({
|
|
7260
7655
|
call,
|
|
@@ -7272,37 +7667,47 @@ var ToolCallRow = ({
|
|
|
7272
7667
|
call.outputTokens ? `\u2248${formatTokens(call.outputTokens)} out` : "",
|
|
7273
7668
|
call.durationMs !== void 0 ? formatDuration(call.durationMs) : ""
|
|
7274
7669
|
].filter(Boolean).join(" \xB7 ");
|
|
7275
|
-
return /* @__PURE__ */ (0,
|
|
7670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
7276
7671
|
"li",
|
|
7277
7672
|
{
|
|
7278
7673
|
className: `awr-tool awr-tool--${state}${showTiers && call.attempt !== void 0 ? " awr-tool--earlier" : ""}`,
|
|
7279
7674
|
children: [
|
|
7280
|
-
/* @__PURE__ */ (0,
|
|
7281
|
-
/* @__PURE__ */ (0,
|
|
7282
|
-
/* @__PURE__ */ (0,
|
|
7283
|
-
previewValue(call.input) && /* @__PURE__ */ (0,
|
|
7284
|
-
call.status === "calling" && /* @__PURE__ */ (0,
|
|
7285
|
-
call.status === "done" && call.ok === false && /* @__PURE__ */ (0,
|
|
7286
|
-
showTiers && call.replayed && /* @__PURE__ */ (0,
|
|
7287
|
-
showTiers && call.attempt !== void 0 && /* @__PURE__ */ (0,
|
|
7288
|
-
call.app && /* @__PURE__ */ (0,
|
|
7289
|
-
/* @__PURE__ */ (0,
|
|
7675
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-tool__row", children: [
|
|
7676
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolIcon, { size: 13, className: "awr-tool__icon" }),
|
|
7677
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { className: "awr-tool__name", children: call.name }),
|
|
7678
|
+
previewValue(call.input) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__args", children: previewValue(call.input) }),
|
|
7679
|
+
call.status === "calling" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
7680
|
+
call.status === "done" && call.ok === false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__badge", children: L.failed }),
|
|
7681
|
+
showTiers && call.replayed && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
|
|
7682
|
+
showTiers && call.attempt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
|
|
7683
|
+
call.app && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "awr-tool__tag awr-tool__tag--app", "data-app": call.app, children: [
|
|
7684
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AppIcon, { size: 10 }),
|
|
7290
7685
|
" ",
|
|
7291
7686
|
L.appTag
|
|
7292
7687
|
] }),
|
|
7293
|
-
showUsage && cost && /* @__PURE__ */ (0,
|
|
7688
|
+
showUsage && cost && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
|
|
7294
7689
|
] }),
|
|
7295
|
-
images.length > 0 && /* @__PURE__ */ (0,
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7690
|
+
images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7691
|
+
ImageThumb,
|
|
7692
|
+
{
|
|
7693
|
+
src,
|
|
7694
|
+
name: `${call.name}-${i + 1}${imageExtensionOf(src)}`,
|
|
7695
|
+
alt: `${call.name} result ${i + 1}`,
|
|
7696
|
+
imgClassName: "awr-thumb",
|
|
7697
|
+
labels
|
|
7698
|
+
},
|
|
7699
|
+
i
|
|
7700
|
+
)) }),
|
|
7701
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-search", children: [
|
|
7702
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "awr-search__query", children: [
|
|
7703
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GlobeIcon, { size: 12 }),
|
|
7299
7704
|
" ",
|
|
7300
7705
|
L.searchQuery,
|
|
7301
7706
|
" ",
|
|
7302
|
-
/* @__PURE__ */ (0,
|
|
7707
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("q", { children: search.query })
|
|
7303
7708
|
] }),
|
|
7304
|
-
search.results.length > 0 ? /* @__PURE__ */ (0,
|
|
7305
|
-
/* @__PURE__ */ (0,
|
|
7709
|
+
search.results.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: "awr-search__result", children: [
|
|
7710
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7306
7711
|
"a",
|
|
7307
7712
|
{
|
|
7308
7713
|
className: "awr-search__title",
|
|
@@ -7313,13 +7718,13 @@ var ToolCallRow = ({
|
|
|
7313
7718
|
}
|
|
7314
7719
|
),
|
|
7315
7720
|
" ",
|
|
7316
|
-
/* @__PURE__ */ (0,
|
|
7721
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "awr-search__host", children: [
|
|
7317
7722
|
r.host,
|
|
7318
7723
|
r.date ? ` \xB7 ${r.date}` : ""
|
|
7319
7724
|
] }),
|
|
7320
|
-
r.snippet && /* @__PURE__ */ (0,
|
|
7321
|
-
] }, i)) }) : /* @__PURE__ */ (0,
|
|
7322
|
-
(search.filtered > 0 || search.truncated) && /* @__PURE__ */ (0,
|
|
7725
|
+
r.snippet && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-search__snippet", children: r.snippet })
|
|
7726
|
+
] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-search__note", children: L.searchNoResults }),
|
|
7727
|
+
(search.filtered > 0 || search.truncated) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-search__note", children: [
|
|
7323
7728
|
search.filtered > 0 ? L.searchFiltered(search.filtered) : "",
|
|
7324
7729
|
search.truncated ? L.searchTruncated : ""
|
|
7325
7730
|
].filter(Boolean).join(" \xB7 ") })
|
|
@@ -7333,11 +7738,11 @@ var UserNoteRow = ({
|
|
|
7333
7738
|
labels
|
|
7334
7739
|
}) => {
|
|
7335
7740
|
const L = useLabels(labels);
|
|
7336
|
-
return /* @__PURE__ */ (0,
|
|
7337
|
-
/* @__PURE__ */ (0,
|
|
7338
|
-
/* @__PURE__ */ (0,
|
|
7339
|
-
/* @__PURE__ */ (0,
|
|
7340
|
-
note.origin === "another-tab" && /* @__PURE__ */ (0,
|
|
7741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
7742
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
7743
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
7744
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("q", { className: "awr-note__text", children: note.text }),
|
|
7745
|
+
note.origin === "another-tab" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-note__origin", children: L.fromAnotherTab })
|
|
7341
7746
|
] });
|
|
7342
7747
|
};
|
|
7343
7748
|
var decisionNote = (d, L) => {
|
|
@@ -7368,18 +7773,14 @@ var StepItem = ({
|
|
|
7368
7773
|
renderToolCall,
|
|
7369
7774
|
renderSubagent,
|
|
7370
7775
|
L
|
|
7371
|
-
}) => /* @__PURE__ */ (0,
|
|
7372
|
-
/* @__PURE__ */ (0,
|
|
7373
|
-
/* @__PURE__ */ (0,
|
|
7374
|
-
/* @__PURE__ */ (0,
|
|
7375
|
-
|
|
7376
|
-
"/",
|
|
7377
|
-
step.total
|
|
7378
|
-
] }),
|
|
7379
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-step__desc", children: step.step.description })
|
|
7776
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
|
|
7777
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-step__head", children: [
|
|
7778
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlertIcon, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckIcon, { size: 14 }) }),
|
|
7779
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-step__index", children: `${step.index}/${step.total}` }),
|
|
7780
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-step__desc", children: step.step.description })
|
|
7380
7781
|
] }),
|
|
7381
|
-
showTiers && step.tier && /* @__PURE__ */ (0,
|
|
7382
|
-
/* @__PURE__ */ (0,
|
|
7782
|
+
showTiers && step.tier && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-step__meta", children: [
|
|
7783
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7383
7784
|
"span",
|
|
7384
7785
|
{
|
|
7385
7786
|
className: `awr-step__tier awr-step__tier--${step.tier}`,
|
|
@@ -7387,29 +7788,29 @@ var StepItem = ({
|
|
|
7387
7788
|
children: L.tierNames[step.tier]
|
|
7388
7789
|
}
|
|
7389
7790
|
),
|
|
7390
|
-
step.model && /* @__PURE__ */ (0,
|
|
7791
|
+
step.model && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-step__model", children: step.model })
|
|
7391
7792
|
] }),
|
|
7392
|
-
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ (0,
|
|
7393
|
-
/* @__PURE__ */ (0,
|
|
7394
|
-
/* @__PURE__ */ (0,
|
|
7395
|
-
/* @__PURE__ */ (0,
|
|
7793
|
+
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-step__escalated", children: [
|
|
7794
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "awr-step__escalated-line", children: [
|
|
7795
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArrowUpIcon, { size: 12 }),
|
|
7796
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
|
|
7396
7797
|
] }),
|
|
7397
|
-
e.text?.trim() && /* @__PURE__ */ (0,
|
|
7398
|
-
/* @__PURE__ */ (0,
|
|
7399
|
-
/* @__PURE__ */ (0,
|
|
7798
|
+
e.text?.trim() && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "awr-step__attempt", children: [
|
|
7799
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("summary", { children: L.escalatedAttemptText }),
|
|
7800
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-step__text", children: e.text.trim() })
|
|
7400
7801
|
] })
|
|
7401
7802
|
] }, i)),
|
|
7402
|
-
showThoughts && step.reasoning.trim() && /* @__PURE__ */ (0,
|
|
7403
|
-
/* @__PURE__ */ (0,
|
|
7404
|
-
/* @__PURE__ */ (0,
|
|
7803
|
+
showThoughts && step.reasoning.trim() && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
|
|
7804
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("summary", { children: [
|
|
7805
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BrainIcon, { size: 13 }),
|
|
7405
7806
|
" ",
|
|
7406
7807
|
L.stepThoughts
|
|
7407
7808
|
] }),
|
|
7408
|
-
/* @__PURE__ */ (0,
|
|
7809
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-thought__text", children: step.reasoning.trim() })
|
|
7409
7810
|
] }),
|
|
7410
|
-
step.text.trim() && /* @__PURE__ */ (0,
|
|
7411
|
-
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ (0,
|
|
7412
|
-
const row = /* @__PURE__ */ (0,
|
|
7811
|
+
step.text.trim() && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-step__text", children: step.text.trim() }),
|
|
7812
|
+
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
|
|
7813
|
+
const row = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7413
7814
|
ToolCallRow,
|
|
7414
7815
|
{
|
|
7415
7816
|
call,
|
|
@@ -7419,15 +7820,15 @@ var StepItem = ({
|
|
|
7419
7820
|
},
|
|
7420
7821
|
i
|
|
7421
7822
|
);
|
|
7422
|
-
return renderToolCall ? /* @__PURE__ */ (0,
|
|
7823
|
+
return renderToolCall ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react20.Fragment, { children: renderToolCall(call, row) }, i) : row;
|
|
7423
7824
|
}) }),
|
|
7424
|
-
approvals.length > 0 && /* @__PURE__ */ (0,
|
|
7425
|
-
/* @__PURE__ */ (0,
|
|
7426
|
-
/* @__PURE__ */ (0,
|
|
7427
|
-
/* @__PURE__ */ (0,
|
|
7428
|
-
a.subagent && /* @__PURE__ */ (0,
|
|
7825
|
+
approvals.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
|
|
7826
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
|
|
7827
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { className: "awr-tool__name", children: a.name }),
|
|
7828
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
|
|
7829
|
+
a.subagent && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__tag", children: L.subagentHelper })
|
|
7429
7830
|
] }, a.id)) }),
|
|
7430
|
-
showSubagents && /* @__PURE__ */ (0,
|
|
7831
|
+
showSubagents && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7431
7832
|
SubagentTree,
|
|
7432
7833
|
{
|
|
7433
7834
|
subagents,
|
|
@@ -7436,14 +7837,14 @@ var StepItem = ({
|
|
|
7436
7837
|
renderSubagent
|
|
7437
7838
|
}
|
|
7438
7839
|
),
|
|
7439
|
-
notes.length > 0 && /* @__PURE__ */ (0,
|
|
7440
|
-
step.blocked && step.summary && /* @__PURE__ */ (0,
|
|
7441
|
-
showReplanFailed && step.replanFailed && /* @__PURE__ */ (0,
|
|
7442
|
-
/* @__PURE__ */ (0,
|
|
7840
|
+
notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UserNoteRow, { note: n }, n.id)) }),
|
|
7841
|
+
step.blocked && step.summary && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-step__blocked", children: step.summary }),
|
|
7842
|
+
showReplanFailed && step.replanFailed && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "awr-step__warn", title: step.replanFailed, children: [
|
|
7843
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlertIcon, { size: 12 }),
|
|
7443
7844
|
" ",
|
|
7444
7845
|
L.replanFailed
|
|
7445
7846
|
] }),
|
|
7446
|
-
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ (0,
|
|
7847
|
+
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7447
7848
|
"p",
|
|
7448
7849
|
{
|
|
7449
7850
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -7478,8 +7879,8 @@ var StepList = ({
|
|
|
7478
7879
|
const known = new Set(steps.map((s) => s.id));
|
|
7479
7880
|
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
7480
7881
|
const loose = showSubagents ? subagents.filter((s) => !s.stepId || !known.has(s.stepId)) : [];
|
|
7481
|
-
return /* @__PURE__ */ (0,
|
|
7482
|
-
steps.map((step) => /* @__PURE__ */ (0,
|
|
7882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
7883
|
+
steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7483
7884
|
StepItem,
|
|
7484
7885
|
{
|
|
7485
7886
|
step,
|
|
@@ -7501,7 +7902,7 @@ var StepList = ({
|
|
|
7501
7902
|
},
|
|
7502
7903
|
step.id
|
|
7503
7904
|
)),
|
|
7504
|
-
loose.length > 0 && /* @__PURE__ */ (0,
|
|
7905
|
+
loose.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7505
7906
|
SubagentTree,
|
|
7506
7907
|
{
|
|
7507
7908
|
subagents: loose,
|
|
@@ -7510,12 +7911,12 @@ var StepList = ({
|
|
|
7510
7911
|
renderSubagent
|
|
7511
7912
|
}
|
|
7512
7913
|
) }),
|
|
7513
|
-
atEnd.length > 0 && /* @__PURE__ */ (0,
|
|
7914
|
+
atEnd.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UserNoteRow, { note: n }, n.id)) }) })
|
|
7514
7915
|
] });
|
|
7515
7916
|
};
|
|
7516
7917
|
|
|
7517
7918
|
// src/components/MessageList.tsx
|
|
7518
|
-
var
|
|
7919
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
7519
7920
|
var usageLine = (usage, durationMs) => {
|
|
7520
7921
|
const parts = [];
|
|
7521
7922
|
if (usage && usage.totalTokens > 0) {
|
|
@@ -7526,8 +7927,17 @@ var usageLine = (usage, durationMs) => {
|
|
|
7526
7927
|
if (durationMs !== void 0) parts.push(formatDuration(durationMs));
|
|
7527
7928
|
return parts.join(" \xB7 ");
|
|
7528
7929
|
};
|
|
7529
|
-
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ (0,
|
|
7530
|
-
|
|
7930
|
+
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7931
|
+
ImageThumb,
|
|
7932
|
+
{
|
|
7933
|
+
src: a.dataUrl,
|
|
7934
|
+
name: a.path ?? a.name,
|
|
7935
|
+
alt: a.name,
|
|
7936
|
+
imgClassName: "awr-thumb awr-thumb--msg",
|
|
7937
|
+
title: a.path ?? a.name
|
|
7938
|
+
}
|
|
7939
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
|
|
7940
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FileIcon, { size: 13 }),
|
|
7531
7941
|
" ",
|
|
7532
7942
|
a.name
|
|
7533
7943
|
] });
|
|
@@ -7578,24 +7988,26 @@ var MessageList = ({
|
|
|
7578
7988
|
renderToolCall,
|
|
7579
7989
|
renderApp,
|
|
7580
7990
|
showApps = true,
|
|
7991
|
+
imageViewer = true,
|
|
7992
|
+
renderImageViewer,
|
|
7581
7993
|
labels,
|
|
7582
7994
|
className
|
|
7583
7995
|
}) => {
|
|
7584
7996
|
const L = useLabels(labels);
|
|
7585
7997
|
if (messages.length === 0) {
|
|
7586
|
-
return empty ? /* @__PURE__ */ (0,
|
|
7998
|
+
return empty ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-messages__empty", children: empty }) : null;
|
|
7587
7999
|
}
|
|
7588
|
-
return /* @__PURE__ */ (0,
|
|
8000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
|
|
7589
8001
|
const steps = m.steps ?? [];
|
|
7590
8002
|
const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
|
|
7591
8003
|
const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
|
|
7592
|
-
const node = /* @__PURE__ */ (0,
|
|
8004
|
+
const node = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7593
8005
|
"div",
|
|
7594
8006
|
{
|
|
7595
8007
|
className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
|
|
7596
|
-
children: /* @__PURE__ */ (0,
|
|
7597
|
-
m.role === "assistant" && hasActivity && /* @__PURE__ */ (0,
|
|
7598
|
-
/* @__PURE__ */ (0,
|
|
8008
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-msg__col", children: [
|
|
8009
|
+
m.role === "assistant" && hasActivity && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
|
|
8010
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("summary", { className: "awr-activity__summary", children: activitySummary(
|
|
7599
8011
|
m,
|
|
7600
8012
|
showToolCalls,
|
|
7601
8013
|
showLearned,
|
|
@@ -7605,7 +8017,7 @@ var MessageList = ({
|
|
|
7605
8017
|
showApps && Boolean(renderApp)
|
|
7606
8018
|
) }),
|
|
7607
8019
|
m.pending && liveExtra,
|
|
7608
|
-
/* @__PURE__ */ (0,
|
|
8020
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7609
8021
|
StepList,
|
|
7610
8022
|
{
|
|
7611
8023
|
steps,
|
|
@@ -7627,45 +8039,45 @@ var MessageList = ({
|
|
|
7627
8039
|
labels
|
|
7628
8040
|
}
|
|
7629
8041
|
),
|
|
7630
|
-
showLearned && m.fetches?.length ? /* @__PURE__ */ (0,
|
|
8042
|
+
showLearned && m.fetches?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
7631
8043
|
"li",
|
|
7632
8044
|
{
|
|
7633
8045
|
className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
|
|
7634
8046
|
children: [
|
|
7635
|
-
/* @__PURE__ */ (0,
|
|
8047
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GlobeIcon, { size: 12 }),
|
|
7636
8048
|
" ",
|
|
7637
|
-
/* @__PURE__ */ (0,
|
|
8049
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { children: f.url }),
|
|
7638
8050
|
" ",
|
|
7639
|
-
/* @__PURE__ */ (0,
|
|
8051
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
|
|
7640
8052
|
]
|
|
7641
8053
|
},
|
|
7642
8054
|
i
|
|
7643
8055
|
)) }) : null,
|
|
7644
|
-
showLearned && m.learned?.length ? /* @__PURE__ */ (0,
|
|
7645
|
-
/* @__PURE__ */ (0,
|
|
8056
|
+
showLearned && m.learned?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "awr-learned", children: [
|
|
8057
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BookIcon, { size: 12 }),
|
|
7646
8058
|
" ",
|
|
7647
8059
|
L.learnedNow(m.learned.join(", "))
|
|
7648
8060
|
] }) : null,
|
|
7649
|
-
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ (0,
|
|
7650
|
-
/* @__PURE__ */ (0,
|
|
7651
|
-
/* @__PURE__ */ (0,
|
|
8061
|
+
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("details", { className: "awr-thought", children: [
|
|
8062
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("summary", { children: [
|
|
8063
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BrainIcon, { size: 13 }),
|
|
7652
8064
|
" ",
|
|
7653
8065
|
L.answerThoughts
|
|
7654
8066
|
] }),
|
|
7655
|
-
/* @__PURE__ */ (0,
|
|
8067
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "awr-thought__text", children: m.reasoning.trim() })
|
|
7656
8068
|
] })
|
|
7657
8069
|
] }),
|
|
7658
|
-
showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ (0,
|
|
7659
|
-
showMedia && m.transcripts?.length ? /* @__PURE__ */ (0,
|
|
7660
|
-
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ (0,
|
|
8070
|
+
showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__apps", children: m.apps.map((app) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__app", children: renderApp(app, m) }, app.id)) }) : null,
|
|
8071
|
+
showMedia && m.transcripts?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
|
|
8072
|
+
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-msg__bubble", children: [
|
|
7661
8073
|
m.content ? renderContent ? renderContent(m) : m.content : null,
|
|
7662
|
-
m.pending && !m.content && /* @__PURE__ */ (0,
|
|
8074
|
+
m.pending && !m.content && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
|
|
7663
8075
|
] }),
|
|
7664
|
-
showMedia && m.media?.length ? /* @__PURE__ */ (0,
|
|
7665
|
-
const built = /* @__PURE__ */ (0,
|
|
7666
|
-
return renderMedia ? /* @__PURE__ */ (0,
|
|
8076
|
+
showMedia && m.media?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
8077
|
+
const built = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GeneratedMedia, { media: item, files, labels }, i);
|
|
8078
|
+
return renderMedia ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
7667
8079
|
}) }) : null,
|
|
7668
|
-
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ (0,
|
|
8080
|
+
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7669
8081
|
FileChips,
|
|
7670
8082
|
{
|
|
7671
8083
|
written: m.writtenFiles,
|
|
@@ -7677,34 +8089,34 @@ var MessageList = ({
|
|
|
7677
8089
|
labels
|
|
7678
8090
|
}
|
|
7679
8091
|
) : null,
|
|
7680
|
-
m.attachments?.length ? /* @__PURE__ */ (0,
|
|
7681
|
-
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ (0,
|
|
8092
|
+
m.attachments?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__attachments", "aria-label": L.attachments, 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 }) }, i)) }) : null,
|
|
8093
|
+
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
7682
8094
|
] })
|
|
7683
8095
|
},
|
|
7684
8096
|
m.id
|
|
7685
8097
|
);
|
|
7686
|
-
return renderMessage ? /* @__PURE__ */ (0,
|
|
7687
|
-
}) });
|
|
8098
|
+
return renderMessage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: renderMessage(m, node) }, m.id) : node;
|
|
8099
|
+
}) }) });
|
|
7688
8100
|
};
|
|
7689
8101
|
|
|
7690
8102
|
// src/components/ModelLoadBar.tsx
|
|
7691
|
-
var
|
|
8103
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
7692
8104
|
var ModelLoadBar = ({ load, className }) => {
|
|
7693
8105
|
const pct = Math.round(Math.max(0, Math.min(1, load.progress)) * 100);
|
|
7694
|
-
return /* @__PURE__ */ (0,
|
|
7695
|
-
/* @__PURE__ */ (0,
|
|
7696
|
-
/* @__PURE__ */ (0,
|
|
7697
|
-
/* @__PURE__ */ (0,
|
|
8106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
|
|
8107
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-modelload__head", children: [
|
|
8108
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
|
|
8109
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "awr-modelload__pct", children: [
|
|
7698
8110
|
pct,
|
|
7699
8111
|
"%"
|
|
7700
8112
|
] })
|
|
7701
8113
|
] }),
|
|
7702
|
-
/* @__PURE__ */ (0,
|
|
8114
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
|
|
7703
8115
|
] });
|
|
7704
8116
|
};
|
|
7705
8117
|
|
|
7706
8118
|
// src/components/ToolApprovalPrompt.tsx
|
|
7707
|
-
var
|
|
8119
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
7708
8120
|
var SkillConsentCard = ({
|
|
7709
8121
|
approval: a,
|
|
7710
8122
|
skill,
|
|
@@ -7714,7 +8126,7 @@ var SkillConsentCard = ({
|
|
|
7714
8126
|
showPreview,
|
|
7715
8127
|
onApprove,
|
|
7716
8128
|
onDeny
|
|
7717
|
-
}) => /* @__PURE__ */ (0,
|
|
8129
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7718
8130
|
"div",
|
|
7719
8131
|
{
|
|
7720
8132
|
className: `awr-approval awr-approval--skill${helper ? " awr-approval--helper" : ""}`,
|
|
@@ -7722,28 +8134,28 @@ var SkillConsentCard = ({
|
|
|
7722
8134
|
"data-skill-server": skill.server,
|
|
7723
8135
|
"data-subagent": helper?.id,
|
|
7724
8136
|
children: [
|
|
7725
|
-
/* @__PURE__ */ (0,
|
|
7726
|
-
/* @__PURE__ */ (0,
|
|
7727
|
-
/* @__PURE__ */ (0,
|
|
8137
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-approval__head", children: [
|
|
8138
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
8139
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: L.skillConsentLead(skill.server, skill.skill) })
|
|
7728
8140
|
] }),
|
|
7729
|
-
skill.description && /* @__PURE__ */ (0,
|
|
7730
|
-
/* @__PURE__ */ (0,
|
|
7731
|
-
/* @__PURE__ */ (0,
|
|
7732
|
-
/* @__PURE__ */ (0,
|
|
8141
|
+
skill.description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__quote", children: skill.description }),
|
|
8142
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "awr-approval__skillmeta", children: [
|
|
8143
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("code", { className: "awr-tool__name", children: skill.name }),
|
|
8144
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
|
|
7733
8145
|
] }),
|
|
7734
|
-
skill.byUri && /* @__PURE__ */ (0,
|
|
7735
|
-
skill.nestedIn && /* @__PURE__ */ (0,
|
|
7736
|
-
skill.dynamic && /* @__PURE__ */ (0,
|
|
7737
|
-
skill.dynamic && skill.noFileListing && /* @__PURE__ */ (0,
|
|
7738
|
-
showPreview && skill.body !== void 0 && /* @__PURE__ */ (0,
|
|
7739
|
-
/* @__PURE__ */ (0,
|
|
7740
|
-
/* @__PURE__ */ (0,
|
|
7741
|
-
skill.files.length > 0 && /* @__PURE__ */ (0,
|
|
8146
|
+
skill.byUri && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
|
|
8147
|
+
skill.nestedIn && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
|
|
8148
|
+
skill.dynamic && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
|
|
8149
|
+
skill.dynamic && skill.noFileListing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
|
|
8150
|
+
showPreview && skill.body !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("details", { className: "awr-approval__preview", children: [
|
|
8151
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("summary", { children: L.skillConsentPreview }),
|
|
8152
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
|
|
8153
|
+
skill.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
|
|
7742
8154
|
] }),
|
|
7743
|
-
/* @__PURE__ */ (0,
|
|
7744
|
-
/* @__PURE__ */ (0,
|
|
7745
|
-
/* @__PURE__ */ (0,
|
|
7746
|
-
allowRemember && /* @__PURE__ */ (0,
|
|
8155
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
|
|
8156
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-approval__actions", children: [
|
|
8157
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
|
|
8158
|
+
allowRemember && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7747
8159
|
"button",
|
|
7748
8160
|
{
|
|
7749
8161
|
type: "button",
|
|
@@ -7752,7 +8164,7 @@ var SkillConsentCard = ({
|
|
|
7752
8164
|
children: L.skillConsentAlways
|
|
7753
8165
|
}
|
|
7754
8166
|
),
|
|
7755
|
-
/* @__PURE__ */ (0,
|
|
8167
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7756
8168
|
"button",
|
|
7757
8169
|
{
|
|
7758
8170
|
type: "button",
|
|
@@ -7778,9 +8190,9 @@ var ToolApprovalPrompt = ({
|
|
|
7778
8190
|
}) => {
|
|
7779
8191
|
const L = useLabels(labels);
|
|
7780
8192
|
if (approvals.length === 0) return null;
|
|
7781
|
-
return /* @__PURE__ */ (0,
|
|
8193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
|
|
7782
8194
|
if (a.skill) {
|
|
7783
|
-
const card2 = /* @__PURE__ */ (0,
|
|
8195
|
+
const card2 = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7784
8196
|
SkillConsentCard,
|
|
7785
8197
|
{
|
|
7786
8198
|
approval: a,
|
|
@@ -7794,33 +8206,33 @@ var ToolApprovalPrompt = ({
|
|
|
7794
8206
|
},
|
|
7795
8207
|
a.id
|
|
7796
8208
|
);
|
|
7797
|
-
return renderApproval ? /* @__PURE__ */ (0,
|
|
8209
|
+
return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: renderApproval(a, card2) }, a.id) : card2;
|
|
7798
8210
|
}
|
|
7799
8211
|
const helper = showHelper ? a.subagent : void 0;
|
|
7800
8212
|
const app = a.app;
|
|
7801
|
-
const card = /* @__PURE__ */ (0,
|
|
8213
|
+
const card = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7802
8214
|
"div",
|
|
7803
8215
|
{
|
|
7804
8216
|
className: `awr-approval${helper ? " awr-approval--helper" : ""}${app ? " awr-approval--app" : ""}`,
|
|
7805
8217
|
"data-subagent": helper?.id,
|
|
7806
8218
|
"data-app-server": app?.server,
|
|
7807
8219
|
children: [
|
|
7808
|
-
/* @__PURE__ */ (0,
|
|
7809
|
-
/* @__PURE__ */ (0,
|
|
7810
|
-
/* @__PURE__ */ (0,
|
|
8220
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-approval__head", children: [
|
|
8221
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
8222
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
|
|
7811
8223
|
app ? L.approvalLeadApp(app.server) : helper ? L.approvalLeadHelper(
|
|
7812
8224
|
previewValue(helper.role ?? "", 60) || void 0,
|
|
7813
8225
|
helper.depth
|
|
7814
8226
|
) : L.approvalLead,
|
|
7815
8227
|
" ",
|
|
7816
|
-
/* @__PURE__ */ (0,
|
|
8228
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
|
|
7817
8229
|
a.readOnly && !app ? ` (${L.readOnlyTool})` : ""
|
|
7818
8230
|
] })
|
|
7819
8231
|
] }),
|
|
7820
|
-
previewValue(a.input, 300) && /* @__PURE__ */ (0,
|
|
7821
|
-
app && /* @__PURE__ */ (0,
|
|
7822
|
-
/* @__PURE__ */ (0,
|
|
7823
|
-
/* @__PURE__ */ (0,
|
|
8232
|
+
previewValue(a.input, 300) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
|
|
8233
|
+
app && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
|
|
8234
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-approval__actions", children: [
|
|
8235
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7824
8236
|
"button",
|
|
7825
8237
|
{
|
|
7826
8238
|
type: "button",
|
|
@@ -7829,7 +8241,7 @@ var ToolApprovalPrompt = ({
|
|
|
7829
8241
|
children: L.approve
|
|
7830
8242
|
}
|
|
7831
8243
|
),
|
|
7832
|
-
allowRemember && /* @__PURE__ */ (0,
|
|
8244
|
+
allowRemember && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7833
8245
|
"button",
|
|
7834
8246
|
{
|
|
7835
8247
|
type: "button",
|
|
@@ -7838,7 +8250,7 @@ var ToolApprovalPrompt = ({
|
|
|
7838
8250
|
children: L.alwaysAllow
|
|
7839
8251
|
}
|
|
7840
8252
|
),
|
|
7841
|
-
/* @__PURE__ */ (0,
|
|
8253
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7842
8254
|
"button",
|
|
7843
8255
|
{
|
|
7844
8256
|
type: "button",
|
|
@@ -7852,12 +8264,12 @@ var ToolApprovalPrompt = ({
|
|
|
7852
8264
|
},
|
|
7853
8265
|
a.id
|
|
7854
8266
|
);
|
|
7855
|
-
return renderApproval ? /* @__PURE__ */ (0,
|
|
8267
|
+
return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: renderApproval(a, card) }, a.id) : card;
|
|
7856
8268
|
}) });
|
|
7857
8269
|
};
|
|
7858
8270
|
|
|
7859
8271
|
// src/components/UsageBadge.tsx
|
|
7860
|
-
var
|
|
8272
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
7861
8273
|
var UsageBadge = ({
|
|
7862
8274
|
usage,
|
|
7863
8275
|
compact = false,
|
|
@@ -7883,7 +8295,7 @@ var UsageBadge = ({
|
|
|
7883
8295
|
mediaText,
|
|
7884
8296
|
decisions ? L.usageDecisions(decisions) : ""
|
|
7885
8297
|
].filter(Boolean).join(" \xB7 ");
|
|
7886
|
-
return /* @__PURE__ */ (0,
|
|
8298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
|
|
7887
8299
|
formatTokens(usage.inputTokens),
|
|
7888
8300
|
"\u2191 ",
|
|
7889
8301
|
formatTokens(usage.outputTokens),
|
|
@@ -7896,13 +8308,13 @@ var UsageBadge = ({
|
|
|
7896
8308
|
};
|
|
7897
8309
|
|
|
7898
8310
|
// src/components/AgentChat.tsx
|
|
7899
|
-
var
|
|
8311
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
7900
8312
|
var usePrefersDark = () => {
|
|
7901
8313
|
const query = "(prefers-color-scheme: dark)";
|
|
7902
|
-
const [dark, setDark] = (0,
|
|
8314
|
+
const [dark, setDark] = (0, import_react21.useState)(
|
|
7903
8315
|
() => typeof matchMedia === "function" && matchMedia(query).matches
|
|
7904
8316
|
);
|
|
7905
|
-
(0,
|
|
8317
|
+
(0, import_react21.useEffect)(() => {
|
|
7906
8318
|
if (typeof matchMedia !== "function") return;
|
|
7907
8319
|
const mq = matchMedia(query);
|
|
7908
8320
|
const on = () => setDark(mq.matches);
|
|
@@ -7913,7 +8325,7 @@ var usePrefersDark = () => {
|
|
|
7913
8325
|
};
|
|
7914
8326
|
var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
|
|
7915
8327
|
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
7916
|
-
var AgentChat = (props) => /* @__PURE__ */ (0,
|
|
8328
|
+
var AgentChat = (props) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AgentChatInner, { ...props }) });
|
|
7917
8329
|
var NO_LABELS = {};
|
|
7918
8330
|
var AgentChatInner = ({
|
|
7919
8331
|
controller,
|
|
@@ -7962,6 +8374,8 @@ var AgentChatInner = ({
|
|
|
7962
8374
|
renderFileContent,
|
|
7963
8375
|
renderApproval,
|
|
7964
8376
|
slots = {},
|
|
8377
|
+
imageViewer = true,
|
|
8378
|
+
renderImageViewer,
|
|
7965
8379
|
components = {},
|
|
7966
8380
|
theme = "auto",
|
|
7967
8381
|
classNames = {},
|
|
@@ -7988,7 +8402,7 @@ var AgentChatInner = ({
|
|
|
7988
8402
|
}
|
|
7989
8403
|
const L = useLabels();
|
|
7990
8404
|
const external = isHistoryHook(history) ? history : void 0;
|
|
7991
|
-
const [ownStore] = (0,
|
|
8405
|
+
const [ownStore] = (0, import_react21.useState)(
|
|
7992
8406
|
() => history instanceof ChatHistoryStore ? history : new ChatHistoryStore()
|
|
7993
8407
|
);
|
|
7994
8408
|
const own = useChatHistory(agent, {
|
|
@@ -7996,20 +8410,20 @@ var AgentChatInner = ({
|
|
|
7996
8410
|
enabled: Boolean(history) && !external
|
|
7997
8411
|
});
|
|
7998
8412
|
const chats = history ? external ?? own : void 0;
|
|
7999
|
-
const rootRef = (0,
|
|
8000
|
-
const [narrow, setNarrow] = (0,
|
|
8001
|
-
(0,
|
|
8413
|
+
const rootRef = (0, import_react21.useRef)(null);
|
|
8414
|
+
const [narrow, setNarrow] = (0, import_react21.useState)(void 0);
|
|
8415
|
+
(0, import_react21.useEffect)(() => {
|
|
8002
8416
|
const el = rootRef.current;
|
|
8003
8417
|
if (!el || typeof ResizeObserver === "undefined") return setNarrow(false);
|
|
8004
|
-
const
|
|
8005
|
-
|
|
8006
|
-
const ro = new ResizeObserver(
|
|
8418
|
+
const measure2 = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
|
|
8419
|
+
measure2();
|
|
8420
|
+
const ro = new ResizeObserver(measure2);
|
|
8007
8421
|
ro.observe(el);
|
|
8008
8422
|
return () => ro.disconnect();
|
|
8009
8423
|
}, [narrowWidth]);
|
|
8010
|
-
const [historyChoice, setHistoryOpen] = (0,
|
|
8424
|
+
const [historyChoice, setHistoryOpen] = (0, import_react21.useState)(defaultHistoryOpen);
|
|
8011
8425
|
const historyOpen = historyChoice ?? narrow === false;
|
|
8012
|
-
const [filesOpen, setFilesOpen] = (0,
|
|
8426
|
+
const [filesOpen, setFilesOpen] = (0, import_react21.useState)(defaultFilesOpen);
|
|
8013
8427
|
const toggleHistory = () => {
|
|
8014
8428
|
setHistoryOpen(!historyOpen);
|
|
8015
8429
|
if (narrow && !historyOpen) setFilesOpen(false);
|
|
@@ -8022,19 +8436,22 @@ var AgentChatInner = ({
|
|
|
8022
8436
|
setFilesOpen(true);
|
|
8023
8437
|
if (narrow) setHistoryOpen(false);
|
|
8024
8438
|
};
|
|
8025
|
-
const
|
|
8026
|
-
const
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8439
|
+
const overlayOpen = narrow === true && (Boolean(chats) && historyOpen || Boolean(files) && filesOpen);
|
|
8440
|
+
const closeOverlays = () => {
|
|
8441
|
+
setHistoryOpen(false);
|
|
8442
|
+
setFilesOpen(false);
|
|
8443
|
+
};
|
|
8444
|
+
(0, import_react21.useEffect)(() => {
|
|
8445
|
+
if (!overlayOpen) return;
|
|
8446
|
+
const onKey = (e) => {
|
|
8447
|
+
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
8448
|
+
setHistoryOpen(false);
|
|
8449
|
+
setFilesOpen(false);
|
|
8450
|
+
};
|
|
8451
|
+
document.addEventListener("keydown", onKey);
|
|
8452
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
8453
|
+
}, [overlayOpen]);
|
|
8454
|
+
const bodyRef = (0, import_react21.useRef)(null);
|
|
8038
8455
|
const appHost = useMcpAppHost({
|
|
8039
8456
|
connection: mcpApps,
|
|
8040
8457
|
approve: agent.approveAppToolCall,
|
|
@@ -8046,23 +8463,28 @@ var AgentChatInner = ({
|
|
|
8046
8463
|
});
|
|
8047
8464
|
const prefersDark = usePrefersDark();
|
|
8048
8465
|
const appTheme = theme === "auto" ? prefersDark ? "dark" : "light" : theme;
|
|
8049
|
-
const [panelApp, setPanelAppState] = (0,
|
|
8466
|
+
const [panelApp, setPanelAppState] = (0, import_react21.useState)();
|
|
8050
8467
|
const setPanelApp = (app) => {
|
|
8051
8468
|
setPanelAppState(app);
|
|
8052
8469
|
onAppPanel?.(app);
|
|
8053
8470
|
};
|
|
8054
8471
|
const appsOn = showApps && Boolean(mcpApps);
|
|
8472
|
+
useFollowScroll(
|
|
8473
|
+
bodyRef,
|
|
8474
|
+
agent.messages.filter((m) => m.role === "user").length,
|
|
8475
|
+
agent.isRunning || agent.messages.some((m) => m.pending)
|
|
8476
|
+
);
|
|
8055
8477
|
const panelAllowed = appPanel !== false && appPanel !== null;
|
|
8056
8478
|
const panelTarget = typeof appPanel === "object" && appPanel ? appPanel : void 0;
|
|
8057
8479
|
const asSheet = !panelTarget && (appPanel === "sheet" || Boolean(narrow));
|
|
8058
|
-
(0,
|
|
8480
|
+
(0, import_react21.useEffect)(() => {
|
|
8059
8481
|
if (panelApp && !agent.messages.some((m) => m.apps?.some((a) => a.id === panelApp.id))) {
|
|
8060
8482
|
setPanelAppState(void 0);
|
|
8061
8483
|
onAppPanel?.(void 0);
|
|
8062
8484
|
}
|
|
8063
8485
|
}, [agent.messages, panelApp, onAppPanel]);
|
|
8064
8486
|
const drawApp = (app, message) => {
|
|
8065
|
-
const built = panelApp?.id === app.id ? /* @__PURE__ */ (0,
|
|
8487
|
+
const built = panelApp?.id === app.id ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8066
8488
|
McpAppLine,
|
|
8067
8489
|
{
|
|
8068
8490
|
app,
|
|
@@ -8070,7 +8492,7 @@ var AgentChatInner = ({
|
|
|
8070
8492
|
action: L.appBringBack,
|
|
8071
8493
|
onAction: () => setPanelApp(void 0)
|
|
8072
8494
|
}
|
|
8073
|
-
) : /* @__PURE__ */ (0,
|
|
8495
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8074
8496
|
McpAppFrame,
|
|
8075
8497
|
{
|
|
8076
8498
|
app,
|
|
@@ -8083,7 +8505,7 @@ var AgentChatInner = ({
|
|
|
8083
8505
|
);
|
|
8084
8506
|
return renderApp ? renderApp(app, message, built) : built;
|
|
8085
8507
|
};
|
|
8086
|
-
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ (0,
|
|
8508
|
+
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8087
8509
|
McpAppFrame,
|
|
8088
8510
|
{
|
|
8089
8511
|
app: panelApp,
|
|
@@ -8095,7 +8517,7 @@ var AgentChatInner = ({
|
|
|
8095
8517
|
},
|
|
8096
8518
|
panelApp.id
|
|
8097
8519
|
) : null;
|
|
8098
|
-
const [compacting, setCompacting] = (0,
|
|
8520
|
+
const [compacting, setCompacting] = (0, import_react21.useState)(false);
|
|
8099
8521
|
const compact = () => {
|
|
8100
8522
|
setCompacting(true);
|
|
8101
8523
|
void agent.compact().finally(() => setCompacting(false));
|
|
@@ -8116,18 +8538,18 @@ var AgentChatInner = ({
|
|
|
8116
8538
|
const showReplan = agent.replan && agent.replan.mode !== "continue";
|
|
8117
8539
|
const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
|
|
8118
8540
|
const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
|
|
8119
|
-
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ (0,
|
|
8120
|
-
agent.planThought.trim() && /* @__PURE__ */ (0,
|
|
8121
|
-
/* @__PURE__ */ (0,
|
|
8122
|
-
/* @__PURE__ */ (0,
|
|
8541
|
+
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
8542
|
+
agent.planThought.trim() && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("details", { className: "awr-activity__plan", children: [
|
|
8543
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("summary", { children: L.planned }),
|
|
8544
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-activity__thought", children: agent.planThought })
|
|
8123
8545
|
] }),
|
|
8124
|
-
showReplan && /* @__PURE__ */ (0,
|
|
8125
|
-
replanFailedEarly && /* @__PURE__ */ (0,
|
|
8126
|
-
/* @__PURE__ */ (0,
|
|
8546
|
+
showReplan && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
|
|
8547
|
+
replanFailedEarly && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "awr-step__warn", title: agent.replan.error, children: [
|
|
8548
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AlertIcon, { size: 12 }),
|
|
8127
8549
|
" ",
|
|
8128
8550
|
L.replanFailed
|
|
8129
8551
|
] }),
|
|
8130
|
-
earlyDecisions.map((d, i) => /* @__PURE__ */ (0,
|
|
8552
|
+
earlyDecisions.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8131
8553
|
"p",
|
|
8132
8554
|
{
|
|
8133
8555
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -8136,8 +8558,8 @@ var AgentChatInner = ({
|
|
|
8136
8558
|
i
|
|
8137
8559
|
))
|
|
8138
8560
|
] }) : void 0;
|
|
8139
|
-
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0,
|
|
8140
|
-
chats && /* @__PURE__ */ (0,
|
|
8561
|
+
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx("awr-chat__header", classNames.header), children: [
|
|
8562
|
+
chats && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8141
8563
|
"button",
|
|
8142
8564
|
{
|
|
8143
8565
|
type: "button",
|
|
@@ -8146,17 +8568,17 @@ var AgentChatInner = ({
|
|
|
8146
8568
|
title: L.showHistory,
|
|
8147
8569
|
"aria-pressed": historyOpen,
|
|
8148
8570
|
onClick: toggleHistory,
|
|
8149
|
-
children: /* @__PURE__ */ (0,
|
|
8571
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(HistoryIcon, { size: 16 })
|
|
8150
8572
|
}
|
|
8151
8573
|
),
|
|
8152
8574
|
slots.headerStart,
|
|
8153
|
-
/* @__PURE__ */ (0,
|
|
8154
|
-
showStatus && /* @__PURE__ */ (0,
|
|
8155
|
-
/* @__PURE__ */ (0,
|
|
8156
|
-
/* @__PURE__ */ (0,
|
|
8575
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-chat__title", children: title }),
|
|
8576
|
+
showStatus && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
|
|
8577
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "awr-status__dot" }),
|
|
8578
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "awr-status__text", children: L.status[agent.status] })
|
|
8157
8579
|
] }),
|
|
8158
|
-
showTotalUsage && /* @__PURE__ */ (0,
|
|
8159
|
-
files && /* @__PURE__ */ (0,
|
|
8580
|
+
showTotalUsage && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { title: L.totalUsage, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
|
|
8581
|
+
files && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8160
8582
|
"button",
|
|
8161
8583
|
{
|
|
8162
8584
|
type: "button",
|
|
@@ -8165,12 +8587,12 @@ var AgentChatInner = ({
|
|
|
8165
8587
|
title: L.showFiles,
|
|
8166
8588
|
"aria-pressed": filesOpen,
|
|
8167
8589
|
onClick: toggleFiles,
|
|
8168
|
-
children: /* @__PURE__ */ (0,
|
|
8590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FileIcon, { size: 16 })
|
|
8169
8591
|
}
|
|
8170
8592
|
),
|
|
8171
8593
|
slots.headerEnd
|
|
8172
8594
|
] });
|
|
8173
|
-
return /* @__PURE__ */ (0,
|
|
8595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
8174
8596
|
"div",
|
|
8175
8597
|
{
|
|
8176
8598
|
ref: rootRef,
|
|
@@ -8178,8 +8600,16 @@ var AgentChatInner = ({
|
|
|
8178
8600
|
style,
|
|
8179
8601
|
"data-awr-theme": theme === "auto" ? void 0 : theme,
|
|
8180
8602
|
children: [
|
|
8181
|
-
|
|
8182
|
-
|
|
8603
|
+
overlayOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8604
|
+
"div",
|
|
8605
|
+
{
|
|
8606
|
+
className: cx("awr-chat__scrim", classNames.scrim),
|
|
8607
|
+
"aria-hidden": "true",
|
|
8608
|
+
onClick: closeOverlays
|
|
8609
|
+
}
|
|
8610
|
+
),
|
|
8611
|
+
chats && historyOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
|
|
8612
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8183
8613
|
HistoryList,
|
|
8184
8614
|
{
|
|
8185
8615
|
history: {
|
|
@@ -8198,7 +8628,7 @@ var AgentChatInner = ({
|
|
|
8198
8628
|
}
|
|
8199
8629
|
),
|
|
8200
8630
|
slots.sidebar,
|
|
8201
|
-
/* @__PURE__ */ (0,
|
|
8631
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8202
8632
|
"button",
|
|
8203
8633
|
{
|
|
8204
8634
|
type: "button",
|
|
@@ -8209,91 +8639,82 @@ var AgentChatInner = ({
|
|
|
8209
8639
|
}
|
|
8210
8640
|
)
|
|
8211
8641
|
] }),
|
|
8212
|
-
/* @__PURE__ */ (0,
|
|
8642
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx("awr-chat__main", classNames.main), children: [
|
|
8213
8643
|
header,
|
|
8214
|
-
/* @__PURE__ */ (0,
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
renderElicitation
|
|
8286
|
-
}
|
|
8287
|
-
),
|
|
8288
|
-
agent.modelLoad && loading && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ModelLoadBar, { load: agent.modelLoad }),
|
|
8289
|
-
slots.afterMessages
|
|
8290
|
-
]
|
|
8291
|
-
}
|
|
8292
|
-
),
|
|
8293
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
8644
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx("awr-chat__body", classNames.body), ref: bodyRef, children: [
|
|
8645
|
+
slots.beforeMessages,
|
|
8646
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8647
|
+
Messages,
|
|
8648
|
+
{
|
|
8649
|
+
messages: agent.messages,
|
|
8650
|
+
empty: emptyState ?? L.emptyState,
|
|
8651
|
+
showActivity,
|
|
8652
|
+
showToolCalls,
|
|
8653
|
+
showUsage,
|
|
8654
|
+
showThoughts,
|
|
8655
|
+
showNotes,
|
|
8656
|
+
showLearned,
|
|
8657
|
+
showTiers,
|
|
8658
|
+
showReplanFailed,
|
|
8659
|
+
showDecisions,
|
|
8660
|
+
showSearchResults,
|
|
8661
|
+
showSubagents,
|
|
8662
|
+
showMedia,
|
|
8663
|
+
showFileChips,
|
|
8664
|
+
files,
|
|
8665
|
+
htmlPreview,
|
|
8666
|
+
onShowFiles: files ? showFiles : void 0,
|
|
8667
|
+
renderFile,
|
|
8668
|
+
renderFileContent,
|
|
8669
|
+
renderMedia,
|
|
8670
|
+
renderSubagent,
|
|
8671
|
+
onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
|
|
8672
|
+
activityOpen,
|
|
8673
|
+
liveExtra,
|
|
8674
|
+
renderContent,
|
|
8675
|
+
renderMessage,
|
|
8676
|
+
renderAttachment,
|
|
8677
|
+
renderToolCall,
|
|
8678
|
+
showApps: appsOn,
|
|
8679
|
+
renderApp: appsOn ? drawApp : void 0,
|
|
8680
|
+
imageViewer,
|
|
8681
|
+
renderImageViewer
|
|
8682
|
+
}
|
|
8683
|
+
),
|
|
8684
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8685
|
+
Approvals,
|
|
8686
|
+
{
|
|
8687
|
+
approvals: agent.pendingApprovals,
|
|
8688
|
+
onApprove: agent.approve,
|
|
8689
|
+
onDeny: agent.deny,
|
|
8690
|
+
showSkillPreview,
|
|
8691
|
+
renderApproval
|
|
8692
|
+
}
|
|
8693
|
+
),
|
|
8694
|
+
appsOn && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8695
|
+
AppRequestPrompt,
|
|
8696
|
+
{
|
|
8697
|
+
requests: appHost.requests,
|
|
8698
|
+
onAnswer: appHost.answer,
|
|
8699
|
+
renderRequest: renderAppRequest
|
|
8700
|
+
}
|
|
8701
|
+
),
|
|
8702
|
+
showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8703
|
+
Elicitations,
|
|
8704
|
+
{
|
|
8705
|
+
elicitations,
|
|
8706
|
+
onAnswer: onElicitationAnswer,
|
|
8707
|
+
outcomes: agent.elicitations,
|
|
8708
|
+
renderElicitation
|
|
8709
|
+
}
|
|
8710
|
+
),
|
|
8711
|
+
agent.modelLoad && loading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ModelLoadBar, { load: agent.modelLoad }),
|
|
8712
|
+
slots.afterMessages
|
|
8713
|
+
] }),
|
|
8714
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
8294
8715
|
slots.footerStart,
|
|
8295
|
-
tabNotes.length > 0 && /* @__PURE__ */ (0,
|
|
8296
|
-
showContext !== false && /* @__PURE__ */ (0,
|
|
8716
|
+
tabNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-tabnote__text", children: text2 }, text2)) }),
|
|
8717
|
+
showContext !== false && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8297
8718
|
ContextMeter,
|
|
8298
8719
|
{
|
|
8299
8720
|
usage: agent.usage,
|
|
@@ -8304,11 +8725,11 @@ var AgentChatInner = ({
|
|
|
8304
8725
|
compacting
|
|
8305
8726
|
}
|
|
8306
8727
|
),
|
|
8307
|
-
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0,
|
|
8308
|
-
/* @__PURE__ */ (0,
|
|
8728
|
+
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "awr-chat__error", children: [
|
|
8729
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AlertIcon, { size: 14 }),
|
|
8309
8730
|
" ",
|
|
8310
8731
|
agent.error
|
|
8311
|
-
] }) : /* @__PURE__ */ (0,
|
|
8732
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8312
8733
|
Composer2,
|
|
8313
8734
|
{
|
|
8314
8735
|
controller: agent,
|
|
@@ -8324,8 +8745,8 @@ var AgentChatInner = ({
|
|
|
8324
8745
|
] }),
|
|
8325
8746
|
appPanelNode && (panelTarget ? (
|
|
8326
8747
|
// Outside the chat: the theme tokens come with it.
|
|
8327
|
-
(0,
|
|
8328
|
-
/* @__PURE__ */ (0,
|
|
8748
|
+
(0, import_react_dom2.createPortal)(
|
|
8749
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8329
8750
|
"div",
|
|
8330
8751
|
{
|
|
8331
8752
|
className: "awr-theme awr-apppanel",
|
|
@@ -8335,24 +8756,24 @@ var AgentChatInner = ({
|
|
|
8335
8756
|
),
|
|
8336
8757
|
panelTarget
|
|
8337
8758
|
)
|
|
8338
|
-
) : asSheet ? /* @__PURE__ */ (0,
|
|
8339
|
-
/* @__PURE__ */ (0,
|
|
8340
|
-
/* @__PURE__ */ (0,
|
|
8759
|
+
) : asSheet ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
8760
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
|
|
8761
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
8341
8762
|
"aside",
|
|
8342
8763
|
{
|
|
8343
8764
|
className: "awr-chat__appsheet",
|
|
8344
8765
|
role: "dialog",
|
|
8345
8766
|
"aria-label": L.appFrom(panelApp.server),
|
|
8346
8767
|
children: [
|
|
8347
|
-
/* @__PURE__ */ (0,
|
|
8768
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-sheet__grab" }),
|
|
8348
8769
|
appPanelNode
|
|
8349
8770
|
]
|
|
8350
8771
|
}
|
|
8351
8772
|
)
|
|
8352
|
-
] }) : /* @__PURE__ */ (0,
|
|
8353
|
-
files && filesOpen && /* @__PURE__ */ (0,
|
|
8354
|
-
/* @__PURE__ */ (0,
|
|
8355
|
-
/* @__PURE__ */ (0,
|
|
8773
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
|
|
8774
|
+
files && filesOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("aside", { className: cx("awr-chat__files", classNames.files), children: [
|
|
8775
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Files, { files }) }),
|
|
8776
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8356
8777
|
"button",
|
|
8357
8778
|
{
|
|
8358
8779
|
type: "button",
|
|
@@ -8369,7 +8790,7 @@ var AgentChatInner = ({
|
|
|
8369
8790
|
};
|
|
8370
8791
|
|
|
8371
8792
|
// src/components/LearnedSkills.tsx
|
|
8372
|
-
var
|
|
8793
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
8373
8794
|
var LearnedSkills = ({
|
|
8374
8795
|
controller,
|
|
8375
8796
|
lessons,
|
|
@@ -8385,18 +8806,18 @@ var LearnedSkills = ({
|
|
|
8385
8806
|
const c = controller ?? ctx;
|
|
8386
8807
|
const list = lessons ?? c?.learned ?? [];
|
|
8387
8808
|
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
8388
|
-
return /* @__PURE__ */ (0,
|
|
8389
|
-
!hideTitle && /* @__PURE__ */ (0,
|
|
8390
|
-
/* @__PURE__ */ (0,
|
|
8809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
8810
|
+
!hideTitle && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("h3", { className: "awr-notebook__title", children: [
|
|
8811
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BookIcon, { size: 14 }),
|
|
8391
8812
|
" ",
|
|
8392
8813
|
L.notebookTitle,
|
|
8393
|
-
list.length > 0 && /* @__PURE__ */ (0,
|
|
8814
|
+
list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "awr-notebook__count", children: list.length })
|
|
8394
8815
|
] }),
|
|
8395
|
-
list.length === 0 ? /* @__PURE__ */ (0,
|
|
8396
|
-
/* @__PURE__ */ (0,
|
|
8397
|
-
/* @__PURE__ */ (0,
|
|
8398
|
-
l.revision > 1 && /* @__PURE__ */ (0,
|
|
8399
|
-
forget && /* @__PURE__ */ (0,
|
|
8816
|
+
list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("li", { className: "awr-lesson", children: [
|
|
8817
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "awr-lesson__head", children: [
|
|
8818
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { className: "awr-lesson__name", children: l.name }),
|
|
8819
|
+
l.revision > 1 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
8820
|
+
forget && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8400
8821
|
"button",
|
|
8401
8822
|
{
|
|
8402
8823
|
type: "button",
|
|
@@ -8404,12 +8825,12 @@ var LearnedSkills = ({
|
|
|
8404
8825
|
title: `${L.notebookForget}: ${l.name}`,
|
|
8405
8826
|
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
8406
8827
|
onClick: () => void forget(l.name),
|
|
8407
|
-
children: /* @__PURE__ */ (0,
|
|
8828
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(XIcon, { size: 12 })
|
|
8408
8829
|
}
|
|
8409
8830
|
)
|
|
8410
8831
|
] }),
|
|
8411
|
-
/* @__PURE__ */ (0,
|
|
8412
|
-
showSources && l.sources.length > 0 && /* @__PURE__ */ (0,
|
|
8832
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "awr-lesson__when", children: l.description }),
|
|
8833
|
+
showSources && l.sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "awr-lesson__from", children: [
|
|
8413
8834
|
L.notebookFrom,
|
|
8414
8835
|
" ",
|
|
8415
8836
|
l.sources.join(", ")
|
|
@@ -8419,8 +8840,8 @@ var LearnedSkills = ({
|
|
|
8419
8840
|
};
|
|
8420
8841
|
|
|
8421
8842
|
// src/components/Composer.tsx
|
|
8422
|
-
var
|
|
8423
|
-
var
|
|
8843
|
+
var import_react22 = require("react");
|
|
8844
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
8424
8845
|
var Composer = ({
|
|
8425
8846
|
onSubmit,
|
|
8426
8847
|
busy = false,
|
|
@@ -8429,7 +8850,7 @@ var Composer = ({
|
|
|
8429
8850
|
placeholder = "Ask the agent to do something\u2026",
|
|
8430
8851
|
className
|
|
8431
8852
|
}) => {
|
|
8432
|
-
const [text2, setText] = (0,
|
|
8853
|
+
const [text2, setText] = (0, import_react22.useState)("");
|
|
8433
8854
|
const submit = () => {
|
|
8434
8855
|
const value = text2.trim();
|
|
8435
8856
|
if (!value || busy || disabled) return;
|
|
@@ -8442,7 +8863,7 @@ var Composer = ({
|
|
|
8442
8863
|
submit();
|
|
8443
8864
|
}
|
|
8444
8865
|
};
|
|
8445
|
-
return /* @__PURE__ */ (0,
|
|
8866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
8446
8867
|
"form",
|
|
8447
8868
|
{
|
|
8448
8869
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -8451,7 +8872,7 @@ var Composer = ({
|
|
|
8451
8872
|
submit();
|
|
8452
8873
|
},
|
|
8453
8874
|
children: [
|
|
8454
|
-
/* @__PURE__ */ (0,
|
|
8875
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8455
8876
|
"textarea",
|
|
8456
8877
|
{
|
|
8457
8878
|
className: "awr-composer__input",
|
|
@@ -8463,23 +8884,23 @@ var Composer = ({
|
|
|
8463
8884
|
rows: 1
|
|
8464
8885
|
}
|
|
8465
8886
|
),
|
|
8466
|
-
busy ? /* @__PURE__ */ (0,
|
|
8887
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8467
8888
|
"button",
|
|
8468
8889
|
{
|
|
8469
8890
|
type: "button",
|
|
8470
8891
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
8471
8892
|
onClick: onStop,
|
|
8472
8893
|
"aria-label": "Stop",
|
|
8473
|
-
children: /* @__PURE__ */ (0,
|
|
8894
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StopIcon, { size: 18 })
|
|
8474
8895
|
}
|
|
8475
|
-
) : /* @__PURE__ */ (0,
|
|
8896
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8476
8897
|
"button",
|
|
8477
8898
|
{
|
|
8478
8899
|
type: "submit",
|
|
8479
8900
|
className: "awr-composer__btn",
|
|
8480
8901
|
disabled: disabled || !text2.trim(),
|
|
8481
8902
|
"aria-label": "Send",
|
|
8482
|
-
children: disabled ? /* @__PURE__ */ (0,
|
|
8903
|
+
children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SendIcon, { size: 18 })
|
|
8483
8904
|
}
|
|
8484
8905
|
)
|
|
8485
8906
|
]
|
|
@@ -8488,17 +8909,17 @@ var Composer = ({
|
|
|
8488
8909
|
};
|
|
8489
8910
|
|
|
8490
8911
|
// src/components/PlanView.tsx
|
|
8491
|
-
var
|
|
8912
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
8492
8913
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
8493
8914
|
if (!plan.steps.length && !plan.thought) return null;
|
|
8494
|
-
return /* @__PURE__ */ (0,
|
|
8495
|
-
showThought && plan.thought.trim() && /* @__PURE__ */ (0,
|
|
8496
|
-
plan.steps.length > 0 && /* @__PURE__ */ (0,
|
|
8915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
8916
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
8917
|
+
plan.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
8497
8918
|
] });
|
|
8498
8919
|
};
|
|
8499
8920
|
|
|
8500
8921
|
// src/components/ApprovalModeSwitch.tsx
|
|
8501
|
-
var
|
|
8922
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
8502
8923
|
var DEFAULT_LABELS = {
|
|
8503
8924
|
autopilot: "Autopilot",
|
|
8504
8925
|
"ask-writes": "Ask before changes",
|
|
@@ -8518,13 +8939,13 @@ var ApprovalModeSwitch = ({
|
|
|
8518
8939
|
labels,
|
|
8519
8940
|
disabled,
|
|
8520
8941
|
className
|
|
8521
|
-
}) => /* @__PURE__ */ (0,
|
|
8942
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
8522
8943
|
"div",
|
|
8523
8944
|
{
|
|
8524
8945
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
8525
8946
|
role: "radiogroup",
|
|
8526
8947
|
"aria-label": "Tool consent",
|
|
8527
|
-
children: modes.map((m) => /* @__PURE__ */ (0,
|
|
8948
|
+
children: modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
8528
8949
|
"button",
|
|
8529
8950
|
{
|
|
8530
8951
|
type: "button",
|
|
@@ -8542,8 +8963,8 @@ var ApprovalModeSwitch = ({
|
|
|
8542
8963
|
);
|
|
8543
8964
|
|
|
8544
8965
|
// src/components/ApiKeyForm.tsx
|
|
8545
|
-
var
|
|
8546
|
-
var
|
|
8966
|
+
var import_react23 = require("react");
|
|
8967
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
8547
8968
|
var ApiKeyForm = ({
|
|
8548
8969
|
credentials,
|
|
8549
8970
|
credentialRef,
|
|
@@ -8552,10 +8973,10 @@ var ApiKeyForm = ({
|
|
|
8552
8973
|
onChange,
|
|
8553
8974
|
className
|
|
8554
8975
|
}) => {
|
|
8555
|
-
const [value, setValue] = (0,
|
|
8556
|
-
const [present, setPresent] = (0,
|
|
8557
|
-
const [busy, setBusy] = (0,
|
|
8558
|
-
(0,
|
|
8976
|
+
const [value, setValue] = (0, import_react23.useState)("");
|
|
8977
|
+
const [present, setPresent] = (0, import_react23.useState)(false);
|
|
8978
|
+
const [busy, setBusy] = (0, import_react23.useState)(false);
|
|
8979
|
+
(0, import_react23.useEffect)(() => {
|
|
8559
8980
|
let active = true;
|
|
8560
8981
|
credentials.hasKey(credentialRef).then((has) => {
|
|
8561
8982
|
if (active) setPresent(has);
|
|
@@ -8587,16 +9008,16 @@ var ApiKeyForm = ({
|
|
|
8587
9008
|
setBusy(false);
|
|
8588
9009
|
}
|
|
8589
9010
|
};
|
|
8590
|
-
return /* @__PURE__ */ (0,
|
|
8591
|
-
/* @__PURE__ */ (0,
|
|
9011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
9012
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "awr-keyform__label", children: [
|
|
8592
9013
|
label,
|
|
8593
|
-
present && /* @__PURE__ */ (0,
|
|
8594
|
-
/* @__PURE__ */ (0,
|
|
9014
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "awr-keyform__saved", children: [
|
|
9015
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CheckIcon, { size: 12 }),
|
|
8595
9016
|
" stored, encrypted"
|
|
8596
9017
|
] })
|
|
8597
9018
|
] }),
|
|
8598
|
-
/* @__PURE__ */ (0,
|
|
8599
|
-
/* @__PURE__ */ (0,
|
|
9019
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "awr-keyform__row", children: [
|
|
9020
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8600
9021
|
"input",
|
|
8601
9022
|
{
|
|
8602
9023
|
className: "awr-keyform__input",
|
|
@@ -8614,7 +9035,7 @@ var ApiKeyForm = ({
|
|
|
8614
9035
|
disabled: busy
|
|
8615
9036
|
}
|
|
8616
9037
|
),
|
|
8617
|
-
/* @__PURE__ */ (0,
|
|
9038
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8618
9039
|
"button",
|
|
8619
9040
|
{
|
|
8620
9041
|
type: "button",
|
|
@@ -8624,7 +9045,7 @@ var ApiKeyForm = ({
|
|
|
8624
9045
|
children: "Save"
|
|
8625
9046
|
}
|
|
8626
9047
|
),
|
|
8627
|
-
present && /* @__PURE__ */ (0,
|
|
9048
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8628
9049
|
"button",
|
|
8629
9050
|
{
|
|
8630
9051
|
type: "button",
|
|
@@ -8660,6 +9081,8 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
8660
9081
|
ContextMeter,
|
|
8661
9082
|
ElicitationPrompt,
|
|
8662
9083
|
FILE_PREVIEW_CHARS,
|
|
9084
|
+
FOLLOW_LEAVE_PX,
|
|
9085
|
+
FOLLOW_REJOIN_PX,
|
|
8663
9086
|
FRAME_MAX_HEIGHT,
|
|
8664
9087
|
FRAME_MIN_HEIGHT,
|
|
8665
9088
|
FileChip,
|
|
@@ -8667,6 +9090,9 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
8667
9090
|
FilesPanel,
|
|
8668
9091
|
GeneratedMedia,
|
|
8669
9092
|
HTML_PREVIEW_MAX_CHARS,
|
|
9093
|
+
ImageThumb,
|
|
9094
|
+
ImageViewer,
|
|
9095
|
+
ImageViewerProvider,
|
|
8670
9096
|
ImagesNotSupportedError,
|
|
8671
9097
|
IndexedDBStore,
|
|
8672
9098
|
LearnedSkills,
|
|
@@ -8758,9 +9184,12 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
8758
9184
|
fileKindOf,
|
|
8759
9185
|
fileNameOf,
|
|
8760
9186
|
filterCommands,
|
|
9187
|
+
followsAfterResize,
|
|
9188
|
+
followsAfterScroll,
|
|
8761
9189
|
formatCountdown,
|
|
8762
9190
|
formatElapsed,
|
|
8763
9191
|
grantedAppCsp,
|
|
9192
|
+
imageExtensionOf,
|
|
8764
9193
|
isMcpAppSandboxMessage,
|
|
8765
9194
|
isWebGPUAvailable,
|
|
8766
9195
|
lessonsOf,
|
|
@@ -8802,6 +9231,7 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
8802
9231
|
useAgentContext,
|
|
8803
9232
|
useChatHistory,
|
|
8804
9233
|
useCredentials,
|
|
9234
|
+
useFollowScroll,
|
|
8805
9235
|
useLabels,
|
|
8806
9236
|
useLocalModel,
|
|
8807
9237
|
useMcpAppHost,
|