@dudko.dev/agent-web-react 0.0.33 → 0.0.35
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 +53 -3
- package/dist/{elicitation-B6h_-yLg.d.cts → elicitation-xMLll5W9.d.cts} +52 -3
- package/dist/{elicitation-B6h_-yLg.d.ts → elicitation-xMLll5W9.d.ts} +52 -3
- package/dist/index.cjs +1566 -610
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +346 -9
- package/dist/index.d.ts +346 -9
- package/dist/index.js +1490 -553
- 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 +423 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -109,6 +109,127 @@ var createApprovalQueue = () => {
|
|
|
109
109
|
};
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
+
// src/questions.ts
|
|
113
|
+
var ASK_USER_TOOL_NAME = "ask_user";
|
|
114
|
+
var QUESTION_TIMEOUT_MS = 3e5;
|
|
115
|
+
var TIMER_MAX_MS = 2147483647;
|
|
116
|
+
var questionTimeoutOf = (askUser) => {
|
|
117
|
+
if (!askUser) return void 0;
|
|
118
|
+
const raw = askUser === true ? void 0 : askUser.timeoutMs;
|
|
119
|
+
if (raw === void 0 || raw === null) return QUESTION_TIMEOUT_MS;
|
|
120
|
+
if (typeof raw !== "number" || !(raw > 0) || raw > TIMER_MAX_MS) return void 0;
|
|
121
|
+
return Math.max(1, Math.floor(raw));
|
|
122
|
+
};
|
|
123
|
+
var askUserWith = (askUser, handler) => {
|
|
124
|
+
if (!askUser) return askUser;
|
|
125
|
+
if (askUser === true) return { onQuestion: handler };
|
|
126
|
+
return askUser.onQuestion ? askUser : { ...askUser, onQuestion: handler };
|
|
127
|
+
};
|
|
128
|
+
var DECLINED = { declined: true };
|
|
129
|
+
var createQuestionQueue = (options = {}) => {
|
|
130
|
+
const now = options.now ?? Date.now;
|
|
131
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
132
|
+
let disposed = false;
|
|
133
|
+
const list = () => [...waiting.values()].map((w) => w.question);
|
|
134
|
+
const changed = () => {
|
|
135
|
+
if (!disposed) options.onChange?.(list());
|
|
136
|
+
};
|
|
137
|
+
const handler = (request, ctx) => new Promise((resolve) => {
|
|
138
|
+
const signal = ctx?.signal;
|
|
139
|
+
if (disposed || signal?.aborted || waiting.has(request.id)) {
|
|
140
|
+
resolve(DECLINED);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const onAbort = () => {
|
|
144
|
+
if (waiting.get(request.id)?.settle !== settle) return;
|
|
145
|
+
settle(DECLINED);
|
|
146
|
+
changed();
|
|
147
|
+
};
|
|
148
|
+
const settle = (answer) => {
|
|
149
|
+
waiting.delete(request.id);
|
|
150
|
+
signal?.removeEventListener("abort", onAbort);
|
|
151
|
+
resolve(answer);
|
|
152
|
+
};
|
|
153
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
154
|
+
const timeoutMs = typeof options.timeoutMs === "function" ? options.timeoutMs() : options.timeoutMs;
|
|
155
|
+
waiting.set(request.id, {
|
|
156
|
+
question: {
|
|
157
|
+
...request,
|
|
158
|
+
options: request.options.map((o) => ({ ...o })),
|
|
159
|
+
...timeoutMs !== void 0 ? { expiresAt: now() + timeoutMs } : {}
|
|
160
|
+
},
|
|
161
|
+
settle
|
|
162
|
+
});
|
|
163
|
+
changed();
|
|
164
|
+
});
|
|
165
|
+
return {
|
|
166
|
+
handler,
|
|
167
|
+
pending: list,
|
|
168
|
+
answer: (id, answer) => {
|
|
169
|
+
const entry = waiting.get(id);
|
|
170
|
+
if (!entry) return false;
|
|
171
|
+
entry.settle(answer);
|
|
172
|
+
changed();
|
|
173
|
+
return true;
|
|
174
|
+
},
|
|
175
|
+
cancel: (match) => {
|
|
176
|
+
let any = false;
|
|
177
|
+
for (const entry of [...waiting.values()]) {
|
|
178
|
+
if (match && !match(entry.question)) continue;
|
|
179
|
+
entry.settle(DECLINED);
|
|
180
|
+
any = true;
|
|
181
|
+
}
|
|
182
|
+
if (any) changed();
|
|
183
|
+
},
|
|
184
|
+
dispose: () => {
|
|
185
|
+
disposed = true;
|
|
186
|
+
for (const entry of [...waiting.values()]) entry.settle(DECLINED);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
var questionChoiceOf = (question, picked) => {
|
|
191
|
+
const chosen = question.options.map((o) => o.label).filter((label) => picked.includes(label));
|
|
192
|
+
if (chosen.length === 0) return void 0;
|
|
193
|
+
return { choice: question.multiple ? chosen : chosen.slice(0, 1) };
|
|
194
|
+
};
|
|
195
|
+
var questionOtherOf = (question, text) => question.allowOther && typeof text === "string" && text.trim() ? { other: text.trim() } : void 0;
|
|
196
|
+
var LABELS_ONLY = [
|
|
197
|
+
"The user chose: ",
|
|
198
|
+
"The user chose not to answer.",
|
|
199
|
+
"The user did not answer in time.",
|
|
200
|
+
"The question could not be put to the user",
|
|
201
|
+
"You have already asked the user "
|
|
202
|
+
];
|
|
203
|
+
var askUserOutputKept = (output, ok) => (
|
|
204
|
+
// A failed call is about the model's own arguments (a bad question): nobody was asked.
|
|
205
|
+
!ok || typeof output === "string" && LABELS_ONLY.some((start) => output.startsWith(start))
|
|
206
|
+
);
|
|
207
|
+
var withoutOutput = (call) => {
|
|
208
|
+
if (call.name !== ASK_USER_TOOL_NAME || askUserOutputKept(call.output, call.ok)) return call;
|
|
209
|
+
const { output: _dropped, ...rest } = call;
|
|
210
|
+
void _dropped;
|
|
211
|
+
return rest;
|
|
212
|
+
};
|
|
213
|
+
var withoutOwnWords = (event) => {
|
|
214
|
+
switch (event.type) {
|
|
215
|
+
case "step.tool-result": {
|
|
216
|
+
const cleaned = withoutOutput(event);
|
|
217
|
+
return cleaned === event ? event : { ...cleaned, output: void 0 };
|
|
218
|
+
}
|
|
219
|
+
case "step.complete": {
|
|
220
|
+
const calls = event.result.toolCalls;
|
|
221
|
+
const cleaned = calls.map(withoutOutput);
|
|
222
|
+
return cleaned.every((c, i) => c === calls[i]) ? event : { ...event, result: { ...event.result, toolCalls: cleaned } };
|
|
223
|
+
}
|
|
224
|
+
case "subagent.event": {
|
|
225
|
+
const inner = withoutOwnWords(event.event);
|
|
226
|
+
return inner === event.event ? event : { ...event, event: inner };
|
|
227
|
+
}
|
|
228
|
+
default:
|
|
229
|
+
return event;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
112
233
|
// src/state.ts
|
|
113
234
|
import {
|
|
114
235
|
isReplayedToolOutput
|
|
@@ -258,6 +379,35 @@ var answerElicitation = (state, event, stepId) => {
|
|
|
258
379
|
]
|
|
259
380
|
};
|
|
260
381
|
};
|
|
382
|
+
var addQuestion = (state, event, extra) => state.questions?.some((q) => q.id === event.id) ? state : {
|
|
383
|
+
...state,
|
|
384
|
+
questions: [
|
|
385
|
+
...state.questions ?? [],
|
|
386
|
+
{
|
|
387
|
+
id: event.id,
|
|
388
|
+
question: event.question,
|
|
389
|
+
options: event.options.map((o) => ({ ...o })),
|
|
390
|
+
multiple: event.multiple,
|
|
391
|
+
allowOther: event.allowOther,
|
|
392
|
+
...extra.stepId ? { stepId: extra.stepId } : {},
|
|
393
|
+
...extra.subagent ? { subagent: extra.subagent } : {},
|
|
394
|
+
...extra.remote ? { remote: true } : {},
|
|
395
|
+
status: "pending"
|
|
396
|
+
}
|
|
397
|
+
]
|
|
398
|
+
};
|
|
399
|
+
var answerQuestion = (state, event) => state.questions?.some((q) => q.id === event.id) ? {
|
|
400
|
+
...state,
|
|
401
|
+
questions: state.questions.map(
|
|
402
|
+
(q) => q.id === event.id ? {
|
|
403
|
+
...q,
|
|
404
|
+
status: event.action,
|
|
405
|
+
automatic: event.automatic,
|
|
406
|
+
...event.action === "choice" && event.choice ? { choice: [...event.choice] } : {},
|
|
407
|
+
...event.reason ? { reason: event.reason } : {}
|
|
408
|
+
} : q
|
|
409
|
+
)
|
|
410
|
+
} : state;
|
|
261
411
|
var patchSubagent = (subagents, id, fn) => subagents.map((s) => s.id === id ? fn(s) : s);
|
|
262
412
|
var runningStepId = (steps) => [...steps].reverse().find((s) => s.status === "running")?.id;
|
|
263
413
|
var applySubagentEvent = (view, event) => {
|
|
@@ -490,6 +640,25 @@ var applySubagent = (state, event, ancestors, ctx) => {
|
|
|
490
640
|
inner,
|
|
491
641
|
known.subagents.find((s) => s.id === event.id)?.stepId
|
|
492
642
|
);
|
|
643
|
+
// A helper (or a subagent the host defined) asks the person through the run's handler:
|
|
644
|
+
// the question is the person's to answer, like the run's own, marked with who asks.
|
|
645
|
+
case "user.question-asked": {
|
|
646
|
+
const asker = inner.subagent ?? { id: event.id, depth: ancestors.length + 1 };
|
|
647
|
+
const node = known.subagents.find((s) => s.id === asker.id);
|
|
648
|
+
return addQuestion(known, inner, {
|
|
649
|
+
...ctx.remote ? { remote: true } : {},
|
|
650
|
+
// The helper's own step ids mean nothing here: the step that delegated it does.
|
|
651
|
+
stepId: (node ?? known.subagents.find((s) => s.id === event.id))?.stepId,
|
|
652
|
+
subagent: {
|
|
653
|
+
id: asker.id,
|
|
654
|
+
depth: asker.depth,
|
|
655
|
+
...node ? { name: node.name } : {},
|
|
656
|
+
...node?.role ? { role: node.role } : {}
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
case "user.question-answered":
|
|
661
|
+
return answerQuestion(known, inner);
|
|
493
662
|
// What a subagent generated is in the same workspace: it shows in the turn (its step
|
|
494
663
|
// ids are its own, so it is tied to no step here).
|
|
495
664
|
case "media.generated":
|
|
@@ -696,7 +865,10 @@ var applyEvent = (state, event, ctx) => {
|
|
|
696
865
|
...event.model !== void 0 ? { model: event.model } : {},
|
|
697
866
|
...event.tierReason !== void 0 ? { tierReason: event.tierReason } : {}
|
|
698
867
|
};
|
|
699
|
-
|
|
868
|
+
const steps = state.steps.map(
|
|
869
|
+
(s) => s.total === event.total ? s : { ...s, total: event.total }
|
|
870
|
+
);
|
|
871
|
+
return { ...state, steps: [...steps, view] };
|
|
700
872
|
}
|
|
701
873
|
case "step.escalated":
|
|
702
874
|
return {
|
|
@@ -948,6 +1120,15 @@ var applyEvent = (state, event, ctx) => {
|
|
|
948
1120
|
});
|
|
949
1121
|
case "mcp.elicitation-answered":
|
|
950
1122
|
return answerElicitation(state, event, runningStepId(state.steps));
|
|
1123
|
+
case "user.question-asked":
|
|
1124
|
+
return addQuestion(state, event, {
|
|
1125
|
+
// Asked in the tab that runs the agent: shown here, answered there only.
|
|
1126
|
+
...ctx.remote ? { remote: true } : {},
|
|
1127
|
+
stepId: event.step?.id,
|
|
1128
|
+
...event.subagent ? { subagent: event.subagent } : {}
|
|
1129
|
+
});
|
|
1130
|
+
case "user.question-answered":
|
|
1131
|
+
return answerQuestion(state, event);
|
|
951
1132
|
case "tool.approval-requested":
|
|
952
1133
|
return {
|
|
953
1134
|
...state,
|
|
@@ -1079,6 +1260,12 @@ var applyEvent = (state, event, ctx) => {
|
|
|
1079
1260
|
(e) => e.status === "pending" ? { ...e, status: "cancelled", automatic: true, reason: "stopped" } : e
|
|
1080
1261
|
)
|
|
1081
1262
|
} : {},
|
|
1263
|
+
// Nobody is asked any more once the run has stopped.
|
|
1264
|
+
...state.questions ? {
|
|
1265
|
+
questions: state.questions.map(
|
|
1266
|
+
(q) => q.status === "pending" ? { ...q, status: "stopped", automatic: true, reason: "stopped" } : q
|
|
1267
|
+
)
|
|
1268
|
+
} : {},
|
|
1082
1269
|
messages: finalizeAssistant(
|
|
1083
1270
|
state.messages,
|
|
1084
1271
|
state.finalText || "Stopped.",
|
|
@@ -1197,8 +1384,9 @@ var agentStateReducer = (state, action) => {
|
|
|
1197
1384
|
return { ...state, remote };
|
|
1198
1385
|
}
|
|
1199
1386
|
case "event": {
|
|
1387
|
+
const event = withoutOwnWords(action.event);
|
|
1200
1388
|
const next = syncRunMessage(
|
|
1201
|
-
applyEvent(state,
|
|
1389
|
+
applyEvent(state, event, {
|
|
1202
1390
|
at: action.at,
|
|
1203
1391
|
attachments: action.attachments,
|
|
1204
1392
|
...action.remote ? { remote: true } : {},
|
|
@@ -1206,7 +1394,7 @@ var agentStateReducer = (state, action) => {
|
|
|
1206
1394
|
})
|
|
1207
1395
|
);
|
|
1208
1396
|
const cap = action.maxEvents ?? 200;
|
|
1209
|
-
const events = cap > 0 ? [...state.events,
|
|
1397
|
+
const events = cap > 0 ? [...state.events, event].slice(-cap) : [...state.events, event];
|
|
1210
1398
|
return { ...next, events };
|
|
1211
1399
|
}
|
|
1212
1400
|
case "undelivered":
|
|
@@ -1257,6 +1445,13 @@ var useAgent = (config, options = {}) => {
|
|
|
1257
1445
|
(decision) => approvals.settleAll(decision),
|
|
1258
1446
|
[approvals]
|
|
1259
1447
|
);
|
|
1448
|
+
const [pendingQuestions, setPendingQuestions] = useState([]);
|
|
1449
|
+
const [questionQueue] = useState(
|
|
1450
|
+
() => createQuestionQueue({
|
|
1451
|
+
timeoutMs: () => questionTimeoutOf(configRef.current.askUser),
|
|
1452
|
+
onChange: setPendingQuestions
|
|
1453
|
+
})
|
|
1454
|
+
);
|
|
1260
1455
|
const uiOnRequest = useCallback(
|
|
1261
1456
|
(req2, ctx) => (req2.app ? appApprovals : approvals).handler(req2, ctx),
|
|
1262
1457
|
[approvals, appApprovals]
|
|
@@ -1291,10 +1486,12 @@ var useAgent = (config, options = {}) => {
|
|
|
1291
1486
|
return;
|
|
1292
1487
|
}
|
|
1293
1488
|
const routeApprovals = optionsRef.current.approvals !== false && !cfg.toolApproval?.onRequest;
|
|
1294
|
-
const
|
|
1489
|
+
const askUser = optionsRef.current.questions !== false ? askUserWith(cfg.askUser, questionQueue.handler) : cfg.askUser;
|
|
1490
|
+
const built = {
|
|
1295
1491
|
...cfg,
|
|
1296
|
-
toolApproval: { ...cfg.toolApproval, mode: modeRef.current, onRequest: uiOnRequest }
|
|
1297
|
-
|
|
1492
|
+
...routeApprovals ? { toolApproval: { ...cfg.toolApproval, mode: modeRef.current, onRequest: uiOnRequest } } : {},
|
|
1493
|
+
...askUser !== cfg.askUser ? { askUser } : {}
|
|
1494
|
+
};
|
|
1298
1495
|
let cancelled = false;
|
|
1299
1496
|
setBuildStatus({ status: "initializing" });
|
|
1300
1497
|
createAgent(built).then((agent) => {
|
|
@@ -1367,8 +1564,9 @@ var useAgent = (config, options = {}) => {
|
|
|
1367
1564
|
abortRef.current?.abort();
|
|
1368
1565
|
settleAll({ approved: false, reason: "the view was closed" });
|
|
1369
1566
|
appApprovals.settleAll({ approved: false, reason: "the view was closed" });
|
|
1567
|
+
questionQueue.dispose();
|
|
1370
1568
|
},
|
|
1371
|
-
[settleAll, appApprovals]
|
|
1569
|
+
[settleAll, appApprovals, questionQueue]
|
|
1372
1570
|
);
|
|
1373
1571
|
const runRef = useRef(void 0);
|
|
1374
1572
|
const run = useCallback(
|
|
@@ -1436,6 +1634,7 @@ var useAgent = (config, options = {}) => {
|
|
|
1436
1634
|
startedRef.current = false;
|
|
1437
1635
|
controlRef.current = void 0;
|
|
1438
1636
|
settleAll({ approved: false, reason: "the run ended" });
|
|
1637
|
+
questionQueue.cancel();
|
|
1439
1638
|
dispatch({ type: "status", ...buildStatusRef.current });
|
|
1440
1639
|
if (stopped && !began && shownGoal.trim()) left = [shownGoal, ...left];
|
|
1441
1640
|
if (left.length > 0) {
|
|
@@ -1450,7 +1649,7 @@ var useAgent = (config, options = {}) => {
|
|
|
1450
1649
|
}
|
|
1451
1650
|
}
|
|
1452
1651
|
},
|
|
1453
|
-
[settleAll]
|
|
1652
|
+
[settleAll, questionQueue]
|
|
1454
1653
|
);
|
|
1455
1654
|
runRef.current = run;
|
|
1456
1655
|
const send = useCallback((text) => controlRef.current?.send(text) ?? false, []);
|
|
@@ -1486,7 +1685,12 @@ var useAgent = (config, options = {}) => {
|
|
|
1486
1685
|
const stop = useCallback(() => {
|
|
1487
1686
|
abortRef.current?.abort();
|
|
1488
1687
|
settleAll({ approved: false, reason: "stopped by the user" });
|
|
1489
|
-
|
|
1688
|
+
questionQueue.cancel();
|
|
1689
|
+
}, [settleAll, questionQueue]);
|
|
1690
|
+
const answerQuestion2 = useCallback(
|
|
1691
|
+
(id, answer) => questionQueue.answer(id, answer),
|
|
1692
|
+
[questionQueue]
|
|
1693
|
+
);
|
|
1490
1694
|
const reset = useCallback(() => {
|
|
1491
1695
|
dispatch({ type: "reset" });
|
|
1492
1696
|
void configRef.current.memory?.clear(sessionRef.current).catch(() => {
|
|
@@ -1611,6 +1815,8 @@ var useAgent = (config, options = {}) => {
|
|
|
1611
1815
|
pendingApprovals: pendingApprovalsOf(state),
|
|
1612
1816
|
approve,
|
|
1613
1817
|
deny,
|
|
1818
|
+
pendingQuestions,
|
|
1819
|
+
answerQuestion: answerQuestion2,
|
|
1614
1820
|
approvalMode,
|
|
1615
1821
|
setApprovalMode,
|
|
1616
1822
|
approveAppToolCall,
|
|
@@ -2517,6 +2723,11 @@ var defaultLabels = {
|
|
|
2517
2723
|
subagentNoTools: "no tools",
|
|
2518
2724
|
approvalLeadHelper: (role) => role ? `The helper \u201C${role}\u201D wants to run` : "A helper the agent started wants to run",
|
|
2519
2725
|
mediaImage: (path) => `Generated image ${path}`,
|
|
2726
|
+
imageOpen: (name) => `Open image ${name}`,
|
|
2727
|
+
imagePrevious: "Previous image",
|
|
2728
|
+
imageNext: "Next image",
|
|
2729
|
+
imageZoom: "Zoom",
|
|
2730
|
+
imageCount: (index, total) => `${index} of ${total}`,
|
|
2520
2731
|
mediaAudio: (path) => `Generated audio ${path}`,
|
|
2521
2732
|
mediaFile: (path) => `Generated file ${path}`,
|
|
2522
2733
|
transcriptOf: (name) => `Transcript of ${name}`,
|
|
@@ -2628,6 +2839,25 @@ var defaultLabels = {
|
|
|
2628
2839
|
"no-tool-call": "no tool call was in progress"
|
|
2629
2840
|
},
|
|
2630
2841
|
elicitationDismiss: "Dismiss",
|
|
2842
|
+
questionLead: "The agent asks you",
|
|
2843
|
+
questionLeadHelper: (role) => role ? `The helper \u201C${role}\u201D asks you` : "A helper the agent started asks you",
|
|
2844
|
+
questionCount: (index, total) => `${index} of ${total}`,
|
|
2845
|
+
questionSeveral: "Pick one or more, then Send.",
|
|
2846
|
+
questionSend: "Send",
|
|
2847
|
+
questionOther: "Other\u2026",
|
|
2848
|
+
questionOtherLabel: "Your answer",
|
|
2849
|
+
questionSkip: "Skip",
|
|
2850
|
+
questionExpiresIn: (time) => `If you do not answer, the agent decides by itself in ${time}`,
|
|
2851
|
+
questionRemote: "Answered in the other tab, where the agent is running.",
|
|
2852
|
+
questionAutomatic: (reason) => `The agent went on without your answer: ${reason}.`,
|
|
2853
|
+
questionReasons: {
|
|
2854
|
+
timeout: "nobody answered in time",
|
|
2855
|
+
stopped: "the run was stopped",
|
|
2856
|
+
"handler-error": "the question could not be shown",
|
|
2857
|
+
"invalid-answer": "the answer did not fit the question",
|
|
2858
|
+
"cannot-park": "the question could not wait here"
|
|
2859
|
+
},
|
|
2860
|
+
questionDismiss: "Dismiss",
|
|
2631
2861
|
appFrom: (server) => `App from server \u201C${server}\u201D`,
|
|
2632
2862
|
appSandboxed: "sandboxed",
|
|
2633
2863
|
appSandboxedOrigin: "sandboxed on its own origin",
|
|
@@ -2719,6 +2949,7 @@ var NESTED = [
|
|
|
2719
2949
|
"decisionReasons",
|
|
2720
2950
|
"elicitationErrors",
|
|
2721
2951
|
"elicitationReasons",
|
|
2952
|
+
"questionReasons",
|
|
2722
2953
|
"fileKinds",
|
|
2723
2954
|
"appSandboxReasons"
|
|
2724
2955
|
];
|
|
@@ -2806,11 +3037,128 @@ var useAgentContext = () => {
|
|
|
2806
3037
|
var useOptionalAgentContext = () => useContext2(AgentContext);
|
|
2807
3038
|
|
|
2808
3039
|
// src/components/AgentChat.tsx
|
|
2809
|
-
import { useEffect as
|
|
2810
|
-
import { createPortal } from "react-dom";
|
|
3040
|
+
import { useEffect as useEffect17, useRef as useRef12, useState as useState17 } from "react";
|
|
3041
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
3042
|
+
|
|
3043
|
+
// src/hooks/use-follow-scroll.ts
|
|
3044
|
+
import { useEffect as useEffect6, useLayoutEffect, useRef as useRef5 } from "react";
|
|
3045
|
+
|
|
3046
|
+
// src/follow-scroll.ts
|
|
3047
|
+
var FOLLOW_REJOIN_PX = 80;
|
|
3048
|
+
var FOLLOW_LEAVE_PX = 2;
|
|
3049
|
+
var endGap = (m) => m.scrollHeight - m.scrollTop - m.clientHeight;
|
|
3050
|
+
var reach = (m) => Math.min(m.scrollTop, Math.max(0, m.scrollHeight - m.clientHeight));
|
|
3051
|
+
var followsAfterScroll = (following, before, now) => {
|
|
3052
|
+
if (before.scrollHeight !== now.scrollHeight || before.clientHeight !== now.clientHeight)
|
|
3053
|
+
return following;
|
|
3054
|
+
if (now.scrollTop < reach(before) - FOLLOW_LEAVE_PX) return false;
|
|
3055
|
+
if (now.scrollTop > before.scrollTop) return endGap(now) < FOLLOW_REJOIN_PX ? true : following;
|
|
3056
|
+
return following;
|
|
3057
|
+
};
|
|
3058
|
+
var followsAfterResize = (following, before, now) => following && !(now.clientHeight === before.clientHeight && now.scrollHeight >= before.scrollHeight && now.scrollTop < reach(before) - FOLLOW_LEAVE_PX);
|
|
3059
|
+
|
|
3060
|
+
// src/hooks/use-follow-scroll.ts
|
|
3061
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect6 : useLayoutEffect;
|
|
3062
|
+
var measure = (el) => ({
|
|
3063
|
+
scrollTop: el.scrollTop,
|
|
3064
|
+
scrollHeight: el.scrollHeight,
|
|
3065
|
+
clientHeight: el.clientHeight
|
|
3066
|
+
});
|
|
3067
|
+
var anchorOf = (el) => {
|
|
3068
|
+
const box = el.getBoundingClientRect();
|
|
3069
|
+
if (box.width === 0 || box.height === 0) return void 0;
|
|
3070
|
+
const doc = el.ownerDocument;
|
|
3071
|
+
const marks = [];
|
|
3072
|
+
for (const dy of [8, 24, 48, 80, 120, 180]) {
|
|
3073
|
+
if (dy >= box.height) break;
|
|
3074
|
+
const node = doc.elementFromPoint(box.left + box.width / 2, box.top + dy);
|
|
3075
|
+
if (!node || node === el || !el.contains(node) || marks.some((m) => m.node === node)) continue;
|
|
3076
|
+
const r = node.getBoundingClientRect();
|
|
3077
|
+
marks.push({ node, offset: r.top - box.top, height: r.height });
|
|
3078
|
+
}
|
|
3079
|
+
marks.sort((a, b) => a.height - b.height);
|
|
3080
|
+
return marks.length ? { marks, top: el.scrollTop } : void 0;
|
|
3081
|
+
};
|
|
3082
|
+
var useFollowScroll = (ref, turn, live = true) => {
|
|
3083
|
+
const following = useRef5(true);
|
|
3084
|
+
const last = useRef5(void 0);
|
|
3085
|
+
const anchor = useRef5(void 0);
|
|
3086
|
+
const settle = useRef5(() => {
|
|
3087
|
+
});
|
|
3088
|
+
const arriving = useRef5(live);
|
|
3089
|
+
arriving.current = live;
|
|
3090
|
+
useIsoLayoutEffect(() => {
|
|
3091
|
+
const el = ref.current;
|
|
3092
|
+
if (!el) return;
|
|
3093
|
+
last.current = measure(el);
|
|
3094
|
+
const anchoring = el.style.getPropertyValue("overflow-anchor");
|
|
3095
|
+
el.style.setProperty("overflow-anchor", "none");
|
|
3096
|
+
const toEnd = () => {
|
|
3097
|
+
const top = el.scrollHeight - el.clientHeight;
|
|
3098
|
+
if (top - el.scrollTop > 0.5) el.scrollTop = top;
|
|
3099
|
+
};
|
|
3100
|
+
const keep = (render) => {
|
|
3101
|
+
const now = measure(el);
|
|
3102
|
+
const before = last.current;
|
|
3103
|
+
if (before) following.current = followsAfterResize(following.current, before, now);
|
|
3104
|
+
if (following.current) {
|
|
3105
|
+
if (render || arriving.current || !before || now.clientHeight !== before.clientHeight)
|
|
3106
|
+
toEnd();
|
|
3107
|
+
else if (endGap(now) > 0.5) following.current = false;
|
|
3108
|
+
} else if (anchor.current) {
|
|
3109
|
+
const seenAt = anchor.current.top;
|
|
3110
|
+
const mark = anchor.current.marks.find(
|
|
3111
|
+
(m) => m.node.isConnected && m.node.getClientRects().length > 0
|
|
3112
|
+
);
|
|
3113
|
+
if (mark) {
|
|
3114
|
+
const shift = mark.node.getBoundingClientRect().top - el.getBoundingClientRect().top - mark.offset + (el.scrollTop - seenAt);
|
|
3115
|
+
if (Math.abs(shift) > 0.5) el.scrollTop += shift;
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
last.current = measure(el);
|
|
3119
|
+
if (!following.current) anchor.current = anchorOf(el);
|
|
3120
|
+
};
|
|
3121
|
+
settle.current = () => keep(true);
|
|
3122
|
+
const onScroll = () => {
|
|
3123
|
+
const now = measure(el);
|
|
3124
|
+
const was = following.current;
|
|
3125
|
+
following.current = followsAfterScroll(was, last.current ?? now, now);
|
|
3126
|
+
last.current = now;
|
|
3127
|
+
anchor.current = following.current ? void 0 : anchorOf(el);
|
|
3128
|
+
};
|
|
3129
|
+
el.addEventListener("scroll", onScroll, { passive: true });
|
|
3130
|
+
const restore = () => {
|
|
3131
|
+
el.removeEventListener("scroll", onScroll);
|
|
3132
|
+
if (anchoring) el.style.setProperty("overflow-anchor", anchoring);
|
|
3133
|
+
else el.style.removeProperty("overflow-anchor");
|
|
3134
|
+
};
|
|
3135
|
+
if (typeof ResizeObserver === "undefined") return restore;
|
|
3136
|
+
const sizes = new ResizeObserver(() => keep(false));
|
|
3137
|
+
const watch = () => {
|
|
3138
|
+
sizes.disconnect();
|
|
3139
|
+
sizes.observe(el);
|
|
3140
|
+
for (const child of el.children) sizes.observe(child);
|
|
3141
|
+
};
|
|
3142
|
+
watch();
|
|
3143
|
+
const parts = typeof MutationObserver === "undefined" ? void 0 : new MutationObserver((records) => {
|
|
3144
|
+
if (records.some((r) => r.type === "childList")) watch();
|
|
3145
|
+
});
|
|
3146
|
+
parts?.observe(el, { childList: true });
|
|
3147
|
+
return () => {
|
|
3148
|
+
restore();
|
|
3149
|
+
sizes.disconnect();
|
|
3150
|
+
parts?.disconnect();
|
|
3151
|
+
};
|
|
3152
|
+
}, [ref]);
|
|
3153
|
+
useIsoLayoutEffect(() => {
|
|
3154
|
+
following.current = true;
|
|
3155
|
+
anchor.current = void 0;
|
|
3156
|
+
}, [turn]);
|
|
3157
|
+
useIsoLayoutEffect(() => settle.current());
|
|
3158
|
+
};
|
|
2811
3159
|
|
|
2812
3160
|
// src/hooks/use-mcp-app-host.ts
|
|
2813
|
-
import { useCallback as useCallback7, useEffect as
|
|
3161
|
+
import { useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef6, useState as useState7 } from "react";
|
|
2814
3162
|
|
|
2815
3163
|
// src/mcp-app.ts
|
|
2816
3164
|
import { mcpAppOrigin } from "@dudko.dev/agent-web";
|
|
@@ -3639,18 +3987,18 @@ var useMcpAppHost = ({
|
|
|
3639
3987
|
}) => {
|
|
3640
3988
|
const [requests, setRequests] = useState7([]);
|
|
3641
3989
|
const [draft, setDraft] = useState7();
|
|
3642
|
-
const waiting =
|
|
3990
|
+
const waiting = useRef6(
|
|
3643
3991
|
/* @__PURE__ */ new Map()
|
|
3644
3992
|
);
|
|
3645
|
-
const samplingAllowed =
|
|
3646
|
-
const sampleRef =
|
|
3993
|
+
const samplingAllowed = useRef6(/* @__PURE__ */ new Set());
|
|
3994
|
+
const sampleRef = useRef6(sampleFn);
|
|
3647
3995
|
sampleRef.current = sampleFn;
|
|
3648
3996
|
const [gated, setGated] = useState7({});
|
|
3649
|
-
const connectionRef =
|
|
3997
|
+
const connectionRef = useRef6(connection);
|
|
3650
3998
|
connectionRef.current = connection;
|
|
3651
|
-
const approveRef =
|
|
3999
|
+
const approveRef = useRef6(approve);
|
|
3652
4000
|
approveRef.current = approve;
|
|
3653
|
-
|
|
4001
|
+
useEffect7(
|
|
3654
4002
|
() => () => {
|
|
3655
4003
|
for (const { resolve } of waiting.current.values()) resolve(false);
|
|
3656
4004
|
waiting.current.clear();
|
|
@@ -3981,11 +4329,11 @@ var AppRequestPrompt = ({
|
|
|
3981
4329
|
};
|
|
3982
4330
|
|
|
3983
4331
|
// src/components/McpAppFrame.tsx
|
|
3984
|
-
import { useEffect as
|
|
4332
|
+
import { useEffect as useEffect8, useLayoutEffect as useLayoutEffect2, useMemo as useMemo5, useRef as useRef7, useState as useState8 } from "react";
|
|
3985
4333
|
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3986
4334
|
var HOST_INFO = { name: "@dudko.dev/agent-web-react", version: "1" };
|
|
3987
4335
|
var MAX_LISTED_CALLS = 12;
|
|
3988
|
-
var
|
|
4336
|
+
var useIsoLayoutEffect2 = typeof window === "undefined" ? useEffect8 : useLayoutEffect2;
|
|
3989
4337
|
var userActivation = () => typeof navigator === "undefined" ? void 0 : navigator.userActivation?.isActive;
|
|
3990
4338
|
var silentSandboxes = /* @__PURE__ */ new Set();
|
|
3991
4339
|
var warned = /* @__PURE__ */ new Set();
|
|
@@ -4027,27 +4375,27 @@ var McpAppFrame = ({
|
|
|
4027
4375
|
const [fallback, setFallback] = useState8();
|
|
4028
4376
|
const [broken, setBroken] = useState8(false);
|
|
4029
4377
|
const [onOrigin, setOnOrigin] = useState8(false);
|
|
4030
|
-
const shellLoaded =
|
|
4378
|
+
const shellLoaded = useRef7(void 0);
|
|
4031
4379
|
const [mode, setMode] = useState8("inline");
|
|
4032
|
-
const modeRef =
|
|
4380
|
+
const modeRef = useRef7("inline");
|
|
4033
4381
|
const [holder, setHolder] = useState8(0);
|
|
4034
4382
|
const [fullRect, setFullRect] = useState8();
|
|
4035
|
-
const leaveRef =
|
|
4036
|
-
const rootRef =
|
|
4037
|
-
const exitRef =
|
|
4038
|
-
const allowFullscreenRef =
|
|
4383
|
+
const leaveRef = useRef7(void 0);
|
|
4384
|
+
const rootRef = useRef7(null);
|
|
4385
|
+
const exitRef = useRef7(null);
|
|
4386
|
+
const allowFullscreenRef = useRef7(allowFullscreen);
|
|
4039
4387
|
allowFullscreenRef.current = allowFullscreen;
|
|
4040
|
-
const iframeRef =
|
|
4041
|
-
const bridgeRef =
|
|
4042
|
-
const menuRef =
|
|
4043
|
-
const themeRef =
|
|
4388
|
+
const iframeRef = useRef7(null);
|
|
4389
|
+
const bridgeRef = useRef7(void 0);
|
|
4390
|
+
const menuRef = useRef7(null);
|
|
4391
|
+
const themeRef = useRef7(theme);
|
|
4044
4392
|
themeRef.current = theme;
|
|
4045
|
-
const hostRef =
|
|
4393
|
+
const hostRef = useRef7(host);
|
|
4046
4394
|
hostRef.current = host;
|
|
4047
|
-
const appRef =
|
|
4395
|
+
const appRef = useRef7(app);
|
|
4048
4396
|
appRef.current = app;
|
|
4049
4397
|
const live = !collapsed;
|
|
4050
|
-
|
|
4398
|
+
useEffect8(() => {
|
|
4051
4399
|
if (!live) return;
|
|
4052
4400
|
if (!hostRef.current.connected) {
|
|
4053
4401
|
setLoaded({ unavailable: true });
|
|
@@ -4085,7 +4433,7 @@ var McpAppFrame = ({
|
|
|
4085
4433
|
() => !resource || !placement ? void 0 : placement.mode === "origin" ? buildMcpAppSandboxShell(placement.url) : buildMcpAppDocument(resource.html, resource.csp),
|
|
4086
4434
|
[resource, placement]
|
|
4087
4435
|
);
|
|
4088
|
-
|
|
4436
|
+
useEffect8(() => {
|
|
4089
4437
|
const reason = placement?.mode === "opaque" ? placement.reason : void 0;
|
|
4090
4438
|
if (reason && reason !== "no-answer" && sandboxUrl !== void 0) {
|
|
4091
4439
|
warnOnce(
|
|
@@ -4094,7 +4442,7 @@ var McpAppFrame = ({
|
|
|
4094
4442
|
);
|
|
4095
4443
|
}
|
|
4096
4444
|
}, [placement, sandboxUrl]);
|
|
4097
|
-
|
|
4445
|
+
useEffect8(() => {
|
|
4098
4446
|
const frame = iframeRef.current;
|
|
4099
4447
|
if (!live || !resource || !frame || !placement || broken) return;
|
|
4100
4448
|
const abort = new AbortController();
|
|
@@ -4239,10 +4587,10 @@ var McpAppFrame = ({
|
|
|
4239
4587
|
}, [live, resource, reload, variant, app.id, placement, broken, timeoutMs]);
|
|
4240
4588
|
const fullscreen = mode === "fullscreen" && live && !broken;
|
|
4241
4589
|
const waitingNow = host.isWaiting(app);
|
|
4242
|
-
|
|
4590
|
+
useEffect8(() => {
|
|
4243
4591
|
if (fullscreen && waitingNow) leaveRef.current?.();
|
|
4244
4592
|
}, [fullscreen, waitingNow]);
|
|
4245
|
-
|
|
4593
|
+
useIsoLayoutEffect2(() => {
|
|
4246
4594
|
if (!fullscreen) return;
|
|
4247
4595
|
const place = () => {
|
|
4248
4596
|
const chat2 = rootRef.current?.closest(".awr-chat");
|
|
@@ -4274,7 +4622,7 @@ var McpAppFrame = ({
|
|
|
4274
4622
|
ro?.disconnect();
|
|
4275
4623
|
};
|
|
4276
4624
|
}, [fullscreen]);
|
|
4277
|
-
|
|
4625
|
+
useEffect8(() => {
|
|
4278
4626
|
if (!fullscreen) return;
|
|
4279
4627
|
const before = document.activeElement;
|
|
4280
4628
|
exitRef.current?.focus();
|
|
@@ -4291,10 +4639,10 @@ var McpAppFrame = ({
|
|
|
4291
4639
|
if (frame && (before === frame || document.activeElement === document.body)) frame.focus();
|
|
4292
4640
|
};
|
|
4293
4641
|
}, [fullscreen]);
|
|
4294
|
-
|
|
4642
|
+
useEffect8(() => {
|
|
4295
4643
|
if (theme) bridgeRef.current?.updateContext({ theme });
|
|
4296
4644
|
}, [theme]);
|
|
4297
|
-
|
|
4645
|
+
useEffect8(() => {
|
|
4298
4646
|
if (!menu) return;
|
|
4299
4647
|
const close = (e) => {
|
|
4300
4648
|
if (e instanceof KeyboardEvent ? e.key === "Escape" : !menuRef.current?.contains(e.target)) {
|
|
@@ -4599,7 +4947,7 @@ var McpAppLine = ({ app, note, action, onAction, labels, className }) => {
|
|
|
4599
4947
|
};
|
|
4600
4948
|
|
|
4601
4949
|
// src/components/AgentComposer.tsx
|
|
4602
|
-
import { useEffect as
|
|
4950
|
+
import { useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useMemo as useMemo6, useRef as useRef8, useState as useState9 } from "react";
|
|
4603
4951
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4604
4952
|
var thinkingDefaults = (l) => [
|
|
4605
4953
|
{ id: "off", label: l.thinkingLevels.off },
|
|
@@ -4611,10 +4959,10 @@ var thinkingDefaults = (l) => [
|
|
|
4611
4959
|
var MODES = ["autopilot", "ask-writes", "ask-all", "read-only"];
|
|
4612
4960
|
var ModeIcon = ({ mode }) => mode === "autopilot" ? /* @__PURE__ */ jsx5(BoltIcon, { size: 14 }) : mode === "read-only" ? /* @__PURE__ */ jsx5(EyeIcon, { size: 14 }) : /* @__PURE__ */ jsx5(ShieldIcon, { size: 14 });
|
|
4613
4961
|
var attachSeq = 0;
|
|
4614
|
-
var
|
|
4962
|
+
var useIsoLayoutEffect3 = typeof window === "undefined" ? useEffect9 : useLayoutEffect3;
|
|
4615
4963
|
var useMenuPlacement = (open, anchor, align) => {
|
|
4616
4964
|
const [style, setStyle] = useState9();
|
|
4617
|
-
|
|
4965
|
+
useIsoLayoutEffect3(() => {
|
|
4618
4966
|
if (!open) return;
|
|
4619
4967
|
const place = () => {
|
|
4620
4968
|
const el = anchor.current;
|
|
@@ -4698,12 +5046,12 @@ var AgentComposer = ({
|
|
|
4698
5046
|
const [dismissed, setDismissed] = useState9(() => /* @__PURE__ */ new Set());
|
|
4699
5047
|
const [attachError, setAttachError] = useState9();
|
|
4700
5048
|
const [dragging, setDragging] = useState9(false);
|
|
4701
|
-
const rootRef =
|
|
4702
|
-
const modelRef =
|
|
4703
|
-
const modeRef =
|
|
5049
|
+
const rootRef = useRef8(null);
|
|
5050
|
+
const modelRef = useRef8(null);
|
|
5051
|
+
const modeRef = useRef8(null);
|
|
4704
5052
|
const [dropRect, setDropRect] = useState9();
|
|
4705
5053
|
const [compactBar, setCompactBar] = useState9(false);
|
|
4706
|
-
|
|
5054
|
+
useEffect9(() => {
|
|
4707
5055
|
const el = rootRef.current;
|
|
4708
5056
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
4709
5057
|
const ro = new ResizeObserver(
|
|
@@ -4712,11 +5060,11 @@ var AgentComposer = ({
|
|
|
4712
5060
|
ro.observe(el);
|
|
4713
5061
|
return () => ro.disconnect();
|
|
4714
5062
|
}, [compactWidth]);
|
|
4715
|
-
const fileRef =
|
|
4716
|
-
const inputRef =
|
|
5063
|
+
const fileRef = useRef8(null);
|
|
5064
|
+
const inputRef = useRef8(null);
|
|
4717
5065
|
const draftId = draft?.id;
|
|
4718
5066
|
const draftText = draft?.text;
|
|
4719
|
-
|
|
5067
|
+
useEffect9(() => {
|
|
4720
5068
|
if (draftId === void 0 || !draftText) return;
|
|
4721
5069
|
setText((t) => t.trim() ? `${t.trimEnd()}
|
|
4722
5070
|
${draftText}` : draftText);
|
|
@@ -4736,7 +5084,7 @@ ${draftText}` : draftText);
|
|
|
4736
5084
|
const [startedAt, setStartedAt] = useState9();
|
|
4737
5085
|
const [now, setNow] = useState9(() => Date.now());
|
|
4738
5086
|
const [lastElapsed, setLastElapsed] = useState9();
|
|
4739
|
-
|
|
5087
|
+
useEffect9(() => {
|
|
4740
5088
|
if (!busy) {
|
|
4741
5089
|
if (startedAt !== void 0) setLastElapsed(Date.now() - startedAt);
|
|
4742
5090
|
setStartedAt(void 0);
|
|
@@ -4829,8 +5177,8 @@ ${draftText}` : draftText);
|
|
|
4829
5177
|
const commandsStyle = useMenuPlacement(paletteOpen, rootRef, "stretch");
|
|
4830
5178
|
const modelStyle = useMenuPlacement(menu === "model", modelRef, "left");
|
|
4831
5179
|
const modeStyle = useMenuPlacement(menu === "mode", modeRef, "right");
|
|
4832
|
-
|
|
4833
|
-
|
|
5180
|
+
useEffect9(() => setActive(0), [text, menu]);
|
|
5181
|
+
useEffect9(() => {
|
|
4834
5182
|
if (!menu) return;
|
|
4835
5183
|
const onDown = (e) => {
|
|
4836
5184
|
if (!rootRef.current?.contains(e.target)) setMenu(void 0);
|
|
@@ -4923,9 +5271,9 @@ ${draftText}` : draftText);
|
|
|
4923
5271
|
e.preventDefault();
|
|
4924
5272
|
void addFiles(pasted);
|
|
4925
5273
|
};
|
|
4926
|
-
const addFilesRef =
|
|
5274
|
+
const addFilesRef = useRef8(addFiles);
|
|
4927
5275
|
addFilesRef.current = addFiles;
|
|
4928
|
-
|
|
5276
|
+
useEffect9(() => {
|
|
4929
5277
|
if (attachments === false) return;
|
|
4930
5278
|
const target = dropZone === "window" ? globalThis.window : dropZone === "self" ? rootRef.current : dropZone.current;
|
|
4931
5279
|
if (!target) return;
|
|
@@ -5564,7 +5912,7 @@ var ContextMeter = ({
|
|
|
5564
5912
|
};
|
|
5565
5913
|
|
|
5566
5914
|
// src/components/ElicitationPrompt.tsx
|
|
5567
|
-
import { useEffect as
|
|
5915
|
+
import { useEffect as useEffect10, useId, useState as useState10 } from "react";
|
|
5568
5916
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
5569
5917
|
var reasonText = (outcome, L) => {
|
|
5570
5918
|
const reason = outcome.reason;
|
|
@@ -5575,7 +5923,7 @@ var reasonText = (outcome, L) => {
|
|
|
5575
5923
|
};
|
|
5576
5924
|
var useNow = (active) => {
|
|
5577
5925
|
const [now, setNow] = useState10(() => Date.now());
|
|
5578
|
-
|
|
5926
|
+
useEffect10(() => {
|
|
5579
5927
|
if (!active) return;
|
|
5580
5928
|
setNow(Date.now());
|
|
5581
5929
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -5887,8 +6235,256 @@ var ElicitationPrompt = ({
|
|
|
5887
6235
|
};
|
|
5888
6236
|
|
|
5889
6237
|
// src/components/FilesPanel.tsx
|
|
5890
|
-
import { Fragment as
|
|
5891
|
-
|
|
6238
|
+
import { Fragment as Fragment5, useEffect as useEffect12, useRef as useRef10, useState as useState12 } from "react";
|
|
6239
|
+
|
|
6240
|
+
// src/components/ImageViewer.tsx
|
|
6241
|
+
import { createContext as createContext3, useContext as useContext3, useEffect as useEffect11, useRef as useRef9, useState as useState11 } from "react";
|
|
6242
|
+
import { createPortal } from "react-dom";
|
|
6243
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
6244
|
+
var fileNameOf = (name) => name.split(/[\\/]/).filter(Boolean).pop() ?? name;
|
|
6245
|
+
var SWIPE_PX = 48;
|
|
6246
|
+
var ImageViewer = ({ images, index, onIndex, onClose, labels }) => {
|
|
6247
|
+
const L = useLabels(labels);
|
|
6248
|
+
const rootRef = useRef9(null);
|
|
6249
|
+
const closeRef = useRef9(null);
|
|
6250
|
+
const imgRef = useRef9(null);
|
|
6251
|
+
const touch = useRef9(void 0);
|
|
6252
|
+
const [zoom, setZoom] = useState11(void 0);
|
|
6253
|
+
const count = images.length;
|
|
6254
|
+
const at = Math.min(Math.max(index, 0), count - 1);
|
|
6255
|
+
const image = images[at];
|
|
6256
|
+
const go = (step) => {
|
|
6257
|
+
if (count < 2) return;
|
|
6258
|
+
setZoom(void 0);
|
|
6259
|
+
onIndex((at + step + count) % count);
|
|
6260
|
+
};
|
|
6261
|
+
useEffect11(() => {
|
|
6262
|
+
closeRef.current?.focus();
|
|
6263
|
+
const root = document.documentElement;
|
|
6264
|
+
const before = root.style.overflow;
|
|
6265
|
+
root.style.overflow = "hidden";
|
|
6266
|
+
return () => {
|
|
6267
|
+
root.style.overflow = before;
|
|
6268
|
+
};
|
|
6269
|
+
}, []);
|
|
6270
|
+
const keys = useRef9(() => {
|
|
6271
|
+
});
|
|
6272
|
+
keys.current = (e) => {
|
|
6273
|
+
if (e.key === "Escape") {
|
|
6274
|
+
e.preventDefault();
|
|
6275
|
+
e.stopPropagation();
|
|
6276
|
+
onClose();
|
|
6277
|
+
} else if (e.key === "ArrowLeft") go(-1);
|
|
6278
|
+
else if (e.key === "ArrowRight") go(1);
|
|
6279
|
+
else if (e.key === "Tab") {
|
|
6280
|
+
const stops = [
|
|
6281
|
+
...rootRef.current?.querySelectorAll("button, a[href]") ?? []
|
|
6282
|
+
].filter((el) => !el.hasAttribute("disabled"));
|
|
6283
|
+
if (!stops.length) return;
|
|
6284
|
+
const first = stops[0];
|
|
6285
|
+
const last = stops[stops.length - 1];
|
|
6286
|
+
const active = document.activeElement;
|
|
6287
|
+
if (!rootRef.current?.contains(active)) {
|
|
6288
|
+
e.preventDefault();
|
|
6289
|
+
(e.shiftKey ? last : first).focus();
|
|
6290
|
+
} else if (e.shiftKey ? active === first : active === last) {
|
|
6291
|
+
e.preventDefault();
|
|
6292
|
+
(e.shiftKey ? last : first).focus();
|
|
6293
|
+
}
|
|
6294
|
+
}
|
|
6295
|
+
};
|
|
6296
|
+
useEffect11(() => {
|
|
6297
|
+
const onKey = (e) => keys.current(e);
|
|
6298
|
+
document.addEventListener("keydown", onKey, true);
|
|
6299
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
6300
|
+
}, []);
|
|
6301
|
+
if (!image) return null;
|
|
6302
|
+
const toggleZoom = () => {
|
|
6303
|
+
const img = imgRef.current;
|
|
6304
|
+
if (zoom !== void 0 || !img) return setZoom(void 0);
|
|
6305
|
+
setZoom(Math.max(img.naturalWidth, Math.round(img.clientWidth * 2)));
|
|
6306
|
+
};
|
|
6307
|
+
const onTouchStart = (e) => {
|
|
6308
|
+
touch.current = e.touches.length === 1 ? { x: e.touches[0].clientX, y: e.touches[0].clientY } : void 0;
|
|
6309
|
+
};
|
|
6310
|
+
const onTouchEnd = (e) => {
|
|
6311
|
+
const from = touch.current;
|
|
6312
|
+
touch.current = void 0;
|
|
6313
|
+
if (!from || zoom !== void 0 || e.changedTouches.length !== 1) return;
|
|
6314
|
+
const dx = e.changedTouches[0].clientX - from.x;
|
|
6315
|
+
const dy = e.changedTouches[0].clientY - from.y;
|
|
6316
|
+
if (Math.abs(dx) > SWIPE_PX && Math.abs(dx) > Math.abs(dy) * 1.5) go(dx < 0 ? 1 : -1);
|
|
6317
|
+
};
|
|
6318
|
+
const name = fileNameOf(image.name);
|
|
6319
|
+
return /* @__PURE__ */ jsxs7("div", { ref: rootRef, className: "awr-viewer", role: "dialog", "aria-modal": "true", "aria-label": name, children: [
|
|
6320
|
+
/* @__PURE__ */ jsxs7("div", { className: "awr-viewer__bar", children: [
|
|
6321
|
+
/* @__PURE__ */ jsx9("span", { className: "awr-viewer__name", title: image.name, children: name }),
|
|
6322
|
+
count > 1 && /* @__PURE__ */ jsx9("span", { className: "awr-viewer__count", "aria-live": "polite", children: L.imageCount(at + 1, count) }),
|
|
6323
|
+
/* @__PURE__ */ jsx9(
|
|
6324
|
+
"button",
|
|
6325
|
+
{
|
|
6326
|
+
type: "button",
|
|
6327
|
+
className: "awr-iconbtn awr-viewer__zoom",
|
|
6328
|
+
"aria-label": L.imageZoom,
|
|
6329
|
+
title: L.imageZoom,
|
|
6330
|
+
"aria-pressed": zoom !== void 0,
|
|
6331
|
+
onClick: toggleZoom,
|
|
6332
|
+
children: zoom !== void 0 ? /* @__PURE__ */ jsx9(ShrinkIcon, { size: 18 }) : /* @__PURE__ */ jsx9(ExpandIcon, { size: 18 })
|
|
6333
|
+
}
|
|
6334
|
+
),
|
|
6335
|
+
/* @__PURE__ */ jsx9(
|
|
6336
|
+
"a",
|
|
6337
|
+
{
|
|
6338
|
+
className: "awr-iconbtn awr-viewer__download",
|
|
6339
|
+
href: image.src,
|
|
6340
|
+
download: name,
|
|
6341
|
+
"aria-label": L.fileDownload(name),
|
|
6342
|
+
title: L.download,
|
|
6343
|
+
children: /* @__PURE__ */ jsx9(DownloadIcon, { size: 18 })
|
|
6344
|
+
}
|
|
6345
|
+
),
|
|
6346
|
+
/* @__PURE__ */ jsx9(
|
|
6347
|
+
"button",
|
|
6348
|
+
{
|
|
6349
|
+
ref: closeRef,
|
|
6350
|
+
type: "button",
|
|
6351
|
+
className: "awr-iconbtn awr-viewer__close",
|
|
6352
|
+
"aria-label": L.close,
|
|
6353
|
+
title: L.close,
|
|
6354
|
+
onClick: onClose,
|
|
6355
|
+
children: /* @__PURE__ */ jsx9(XIcon, { size: 18 })
|
|
6356
|
+
}
|
|
6357
|
+
)
|
|
6358
|
+
] }),
|
|
6359
|
+
/* @__PURE__ */ jsx9(
|
|
6360
|
+
"div",
|
|
6361
|
+
{
|
|
6362
|
+
className: `awr-viewer__stage${zoom !== void 0 ? " is-zoomed" : ""}`,
|
|
6363
|
+
onClick: (e) => {
|
|
6364
|
+
if (e.target === e.currentTarget) onClose();
|
|
6365
|
+
},
|
|
6366
|
+
onTouchStart,
|
|
6367
|
+
onTouchEnd,
|
|
6368
|
+
children: /* @__PURE__ */ jsx9(
|
|
6369
|
+
"img",
|
|
6370
|
+
{
|
|
6371
|
+
ref: imgRef,
|
|
6372
|
+
className: "awr-viewer__img",
|
|
6373
|
+
src: image.src,
|
|
6374
|
+
alt: image.alt ?? name,
|
|
6375
|
+
style: zoom !== void 0 ? { width: zoom } : void 0,
|
|
6376
|
+
onClick: toggleZoom,
|
|
6377
|
+
onDoubleClick: (e) => e.preventDefault(),
|
|
6378
|
+
draggable: false
|
|
6379
|
+
},
|
|
6380
|
+
image.src
|
|
6381
|
+
)
|
|
6382
|
+
}
|
|
6383
|
+
),
|
|
6384
|
+
count > 1 && /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
6385
|
+
/* @__PURE__ */ jsx9(
|
|
6386
|
+
"button",
|
|
6387
|
+
{
|
|
6388
|
+
type: "button",
|
|
6389
|
+
className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--prev",
|
|
6390
|
+
"aria-label": L.imagePrevious,
|
|
6391
|
+
title: L.imagePrevious,
|
|
6392
|
+
onClick: () => go(-1),
|
|
6393
|
+
children: /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u2039" })
|
|
6394
|
+
}
|
|
6395
|
+
),
|
|
6396
|
+
/* @__PURE__ */ jsx9(
|
|
6397
|
+
"button",
|
|
6398
|
+
{
|
|
6399
|
+
type: "button",
|
|
6400
|
+
className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--next",
|
|
6401
|
+
"aria-label": L.imageNext,
|
|
6402
|
+
title: L.imageNext,
|
|
6403
|
+
onClick: () => go(1),
|
|
6404
|
+
children: /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u203A" })
|
|
6405
|
+
}
|
|
6406
|
+
)
|
|
6407
|
+
] })
|
|
6408
|
+
] });
|
|
6409
|
+
};
|
|
6410
|
+
var ImageViewerContext = createContext3({ enabled: true });
|
|
6411
|
+
var ImageViewerProvider = ({
|
|
6412
|
+
enabled = true,
|
|
6413
|
+
render,
|
|
6414
|
+
children
|
|
6415
|
+
}) => /* @__PURE__ */ jsx9(ImageViewerContext.Provider, { value: { enabled, render }, children });
|
|
6416
|
+
var imageExtensionOf = (src) => {
|
|
6417
|
+
const type = /^data:image\/([a-z0-9.+-]+)/i.exec(src)?.[1]?.toLowerCase();
|
|
6418
|
+
return !type ? "" : type === "jpeg" ? ".jpg" : type === "svg+xml" ? ".svg" : `.${type}`;
|
|
6419
|
+
};
|
|
6420
|
+
var groupOf = (button) => {
|
|
6421
|
+
const scope = button.closest(".awr-msg") ?? button.parentElement ?? button;
|
|
6422
|
+
const buttons = [...scope.querySelectorAll("[data-awr-image]")];
|
|
6423
|
+
const images = buttons.flatMap((b) => {
|
|
6424
|
+
const img = b.querySelector("img");
|
|
6425
|
+
return img ? [{ src: img.currentSrc || img.src, name: b.dataset.awrImage || img.alt, alt: img.alt }] : [];
|
|
6426
|
+
});
|
|
6427
|
+
return { images, index: Math.max(0, buttons.indexOf(button)) };
|
|
6428
|
+
};
|
|
6429
|
+
var ImageThumb = ({
|
|
6430
|
+
src,
|
|
6431
|
+
name,
|
|
6432
|
+
alt,
|
|
6433
|
+
className,
|
|
6434
|
+
imgClassName,
|
|
6435
|
+
title,
|
|
6436
|
+
labels
|
|
6437
|
+
}) => {
|
|
6438
|
+
const L = useLabels(labels);
|
|
6439
|
+
const { enabled, render } = useContext3(ImageViewerContext);
|
|
6440
|
+
const ref = useRef9(null);
|
|
6441
|
+
const [open, setOpen] = useState11(void 0);
|
|
6442
|
+
const img = /* @__PURE__ */ jsx9("img", { className: imgClassName, src, alt });
|
|
6443
|
+
if (!enabled) {
|
|
6444
|
+
return /* @__PURE__ */ jsx9("a", { className, href: src, target: "_blank", rel: "noopener noreferrer", title, children: img });
|
|
6445
|
+
}
|
|
6446
|
+
const close = () => {
|
|
6447
|
+
setOpen(void 0);
|
|
6448
|
+
ref.current?.focus();
|
|
6449
|
+
};
|
|
6450
|
+
const viewer = (o) => ({
|
|
6451
|
+
images: o.images,
|
|
6452
|
+
index: o.index,
|
|
6453
|
+
onIndex: (index) => setOpen({ ...o, index }),
|
|
6454
|
+
onClose: close,
|
|
6455
|
+
labels
|
|
6456
|
+
});
|
|
6457
|
+
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
6458
|
+
/* @__PURE__ */ jsx9(
|
|
6459
|
+
"button",
|
|
6460
|
+
{
|
|
6461
|
+
ref,
|
|
6462
|
+
type: "button",
|
|
6463
|
+
className: ["awr-imgbtn", className].filter(Boolean).join(" "),
|
|
6464
|
+
"data-awr-image": name,
|
|
6465
|
+
"aria-label": L.imageOpen(fileNameOf(name)),
|
|
6466
|
+
"aria-haspopup": "dialog",
|
|
6467
|
+
title,
|
|
6468
|
+
onClick: (e) => {
|
|
6469
|
+
const button = e.currentTarget;
|
|
6470
|
+
setOpen({
|
|
6471
|
+
...groupOf(button),
|
|
6472
|
+
// Inside the chat's element, so its theme applies; it covers the window from there.
|
|
6473
|
+
host: button.closest(".awr-chat, .awr-theme") ?? document.body
|
|
6474
|
+
});
|
|
6475
|
+
},
|
|
6476
|
+
children: img
|
|
6477
|
+
}
|
|
6478
|
+
),
|
|
6479
|
+
open && createPortal(
|
|
6480
|
+
render ? render(viewer(open), /* @__PURE__ */ jsx9(ImageViewer, { ...viewer(open) })) : /* @__PURE__ */ jsx9(ImageViewer, { ...viewer(open) }),
|
|
6481
|
+
open.host
|
|
6482
|
+
)
|
|
6483
|
+
] });
|
|
6484
|
+
};
|
|
6485
|
+
|
|
6486
|
+
// src/components/FilesPanel.tsx
|
|
6487
|
+
import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
5892
6488
|
var PREVIEW_CHARS = 2e4;
|
|
5893
6489
|
var FilesPanel = ({
|
|
5894
6490
|
files: vfs,
|
|
@@ -5904,9 +6500,9 @@ var FilesPanel = ({
|
|
|
5904
6500
|
}) => {
|
|
5905
6501
|
const L = useLabels(labels);
|
|
5906
6502
|
const fs = useVirtualFiles(vfs, prefix);
|
|
5907
|
-
const [preview, setPreview] =
|
|
5908
|
-
const inputRef =
|
|
5909
|
-
|
|
6503
|
+
const [preview, setPreview] = useState12();
|
|
6504
|
+
const inputRef = useRef10(null);
|
|
6505
|
+
useEffect12(() => {
|
|
5910
6506
|
if (preview && !fs.files.some((f) => f.path === preview.path)) setPreview(void 0);
|
|
5911
6507
|
}, [fs.files, preview]);
|
|
5912
6508
|
const open = async (f) => {
|
|
@@ -5929,11 +6525,11 @@ var FilesPanel = ({
|
|
|
5929
6525
|
a.download = f.path.split("/").pop() || "file";
|
|
5930
6526
|
a.click();
|
|
5931
6527
|
};
|
|
5932
|
-
return /* @__PURE__ */
|
|
5933
|
-
/* @__PURE__ */
|
|
5934
|
-
/* @__PURE__ */
|
|
5935
|
-
allowUpload && /* @__PURE__ */
|
|
5936
|
-
/* @__PURE__ */
|
|
6528
|
+
return /* @__PURE__ */ jsxs8("div", { className: ["awr-filespanel", className].filter(Boolean).join(" "), children: [
|
|
6529
|
+
/* @__PURE__ */ jsxs8("div", { className: "awr-panel__head", children: [
|
|
6530
|
+
/* @__PURE__ */ jsx10("span", { className: "awr-panel__title", children: title ?? L.files }),
|
|
6531
|
+
allowUpload && /* @__PURE__ */ jsxs8(Fragment6, { children: [
|
|
6532
|
+
/* @__PURE__ */ jsx10(
|
|
5937
6533
|
"button",
|
|
5938
6534
|
{
|
|
5939
6535
|
type: "button",
|
|
@@ -5941,10 +6537,10 @@ var FilesPanel = ({
|
|
|
5941
6537
|
"aria-label": L.upload,
|
|
5942
6538
|
title: L.upload,
|
|
5943
6539
|
onClick: () => inputRef.current?.click(),
|
|
5944
|
-
children: /* @__PURE__ */
|
|
6540
|
+
children: /* @__PURE__ */ jsx10(PlusIcon, { size: 16 })
|
|
5945
6541
|
}
|
|
5946
6542
|
),
|
|
5947
|
-
/* @__PURE__ */
|
|
6543
|
+
/* @__PURE__ */ jsx10(
|
|
5948
6544
|
"input",
|
|
5949
6545
|
{
|
|
5950
6546
|
ref: inputRef,
|
|
@@ -5959,15 +6555,15 @@ var FilesPanel = ({
|
|
|
5959
6555
|
)
|
|
5960
6556
|
] })
|
|
5961
6557
|
] }),
|
|
5962
|
-
fs.error && /* @__PURE__ */
|
|
5963
|
-
!fs.loading && fs.files.length === 0 && /* @__PURE__ */
|
|
5964
|
-
/* @__PURE__ */
|
|
5965
|
-
const row = /* @__PURE__ */
|
|
6558
|
+
fs.error && /* @__PURE__ */ jsx10("div", { className: "awr-notice awr-notice--warn", children: fs.error }),
|
|
6559
|
+
!fs.loading && fs.files.length === 0 && /* @__PURE__ */ jsx10("div", { className: "awr-panel__empty", children: L.filesEmpty }),
|
|
6560
|
+
/* @__PURE__ */ jsx10("ul", { className: "awr-filelist", children: fs.files.map((f) => {
|
|
6561
|
+
const row = /* @__PURE__ */ jsxs8(
|
|
5966
6562
|
"li",
|
|
5967
6563
|
{
|
|
5968
6564
|
className: `awr-filelist__item${preview?.path === f.path ? " is-active" : ""}`,
|
|
5969
6565
|
children: [
|
|
5970
|
-
/* @__PURE__ */
|
|
6566
|
+
/* @__PURE__ */ jsxs8(
|
|
5971
6567
|
"button",
|
|
5972
6568
|
{
|
|
5973
6569
|
type: "button",
|
|
@@ -5975,13 +6571,13 @@ var FilesPanel = ({
|
|
|
5975
6571
|
onClick: () => void open(f),
|
|
5976
6572
|
title: `${L.preview}: ${f.path}`,
|
|
5977
6573
|
children: [
|
|
5978
|
-
/* @__PURE__ */
|
|
5979
|
-
/* @__PURE__ */
|
|
5980
|
-
/* @__PURE__ */
|
|
6574
|
+
/* @__PURE__ */ jsx10(FileIcon, { size: 14 }),
|
|
6575
|
+
/* @__PURE__ */ jsx10("span", { className: "awr-filelist__path", children: f.path }),
|
|
6576
|
+
/* @__PURE__ */ jsx10("span", { className: "awr-filelist__size", children: L.bytes(f.size) })
|
|
5981
6577
|
]
|
|
5982
6578
|
}
|
|
5983
6579
|
),
|
|
5984
|
-
/* @__PURE__ */
|
|
6580
|
+
/* @__PURE__ */ jsx10(
|
|
5985
6581
|
"button",
|
|
5986
6582
|
{
|
|
5987
6583
|
type: "button",
|
|
@@ -5989,10 +6585,10 @@ var FilesPanel = ({
|
|
|
5989
6585
|
"aria-label": `${L.download} ${f.path}`,
|
|
5990
6586
|
title: L.download,
|
|
5991
6587
|
onClick: () => void download(f),
|
|
5992
|
-
children: /* @__PURE__ */
|
|
6588
|
+
children: /* @__PURE__ */ jsx10(DownloadIcon, { size: 14 })
|
|
5993
6589
|
}
|
|
5994
6590
|
),
|
|
5995
|
-
allowDelete && /* @__PURE__ */
|
|
6591
|
+
allowDelete && /* @__PURE__ */ jsx10(
|
|
5996
6592
|
"button",
|
|
5997
6593
|
{
|
|
5998
6594
|
type: "button",
|
|
@@ -6000,22 +6596,34 @@ var FilesPanel = ({
|
|
|
6000
6596
|
"aria-label": `${L.delete} ${f.path}`,
|
|
6001
6597
|
title: L.delete,
|
|
6002
6598
|
onClick: () => void fs.remove(f.path),
|
|
6003
|
-
children: /* @__PURE__ */
|
|
6599
|
+
children: /* @__PURE__ */ jsx10(XIcon, { size: 14 })
|
|
6004
6600
|
}
|
|
6005
6601
|
)
|
|
6006
6602
|
]
|
|
6007
6603
|
},
|
|
6008
6604
|
f.path
|
|
6009
6605
|
);
|
|
6010
|
-
return renderFile ? /* @__PURE__ */
|
|
6606
|
+
return renderFile ? /* @__PURE__ */ jsx10(Fragment5, { children: renderFile(f, row) }, f.path) : row;
|
|
6011
6607
|
}) }),
|
|
6012
|
-
preview && /* @__PURE__ */
|
|
6608
|
+
preview && /* @__PURE__ */ jsx10("div", { className: "awr-filepreview", children: preview.kind === "image" ? (
|
|
6609
|
+
// A click (Enter, Space) opens it over the chat, fitted to the screen.
|
|
6610
|
+
/* @__PURE__ */ jsx10(
|
|
6611
|
+
ImageThumb,
|
|
6612
|
+
{
|
|
6613
|
+
src: preview.src,
|
|
6614
|
+
name: preview.path,
|
|
6615
|
+
alt: preview.path,
|
|
6616
|
+
title: preview.path,
|
|
6617
|
+
labels
|
|
6618
|
+
}
|
|
6619
|
+
)
|
|
6620
|
+
) : /* @__PURE__ */ jsx10("pre", { children: preview.text.length > PREVIEW_CHARS ? `${preview.text.slice(0, PREVIEW_CHARS)}
|
|
6013
6621
|
\u2026` : preview.text }) })
|
|
6014
6622
|
] });
|
|
6015
6623
|
};
|
|
6016
6624
|
|
|
6017
6625
|
// src/components/FileChips.tsx
|
|
6018
|
-
import { Fragment as
|
|
6626
|
+
import { Fragment as Fragment7, useEffect as useEffect14, useMemo as useMemo7, useState as useState14 } from "react";
|
|
6019
6627
|
|
|
6020
6628
|
// src/file-kinds.ts
|
|
6021
6629
|
import { MEDIA_IMAGE_TYPES, isTextMime } from "@dudko.dev/agent-web";
|
|
@@ -6033,12 +6641,12 @@ var fileKindOf = (path, mediaType) => {
|
|
|
6033
6641
|
if (mime === "text/plain" || /\.(?:txt|log)$/i.test(path) || isTextMime(mime)) return "text";
|
|
6034
6642
|
return "file";
|
|
6035
6643
|
};
|
|
6036
|
-
var
|
|
6644
|
+
var fileNameOf2 = (path) => path.split("/").filter(Boolean).pop() || "file";
|
|
6037
6645
|
|
|
6038
6646
|
// src/components/Media.tsx
|
|
6039
|
-
import { useEffect as
|
|
6647
|
+
import { useEffect as useEffect13, useState as useState13 } from "react";
|
|
6040
6648
|
import { MEDIA_AUDIO_TYPES, MEDIA_IMAGE_TYPES as MEDIA_IMAGE_TYPES2 } from "@dudko.dev/agent-web";
|
|
6041
|
-
import { jsx as
|
|
6649
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6042
6650
|
var mediaFamilyOf = (mediaType) => {
|
|
6043
6651
|
const type = mediaType.toLowerCase().split(";")[0].trim();
|
|
6044
6652
|
if (Object.hasOwn(MEDIA_IMAGE_TYPES2, type)) return "image";
|
|
@@ -6053,8 +6661,8 @@ var bytesOf = (content, encoding) => {
|
|
|
6053
6661
|
return bytes;
|
|
6054
6662
|
};
|
|
6055
6663
|
var useFileUrl = (files, path, mediaType) => {
|
|
6056
|
-
const [url, setUrl] =
|
|
6057
|
-
|
|
6664
|
+
const [url, setUrl] = useState13(void 0);
|
|
6665
|
+
useEffect13(() => {
|
|
6058
6666
|
if (!files || !mediaType) return;
|
|
6059
6667
|
let made;
|
|
6060
6668
|
let gone = false;
|
|
@@ -6080,20 +6688,21 @@ var GeneratedMedia = ({ media, files, labels }) => {
|
|
|
6080
6688
|
const type = family ? media.mediaType.toLowerCase().split(";")[0].trim() : void 0;
|
|
6081
6689
|
const url = useFileUrl(files, media.path, type);
|
|
6082
6690
|
if (url && family === "image") {
|
|
6083
|
-
return /* @__PURE__ */
|
|
6084
|
-
|
|
6691
|
+
return /* @__PURE__ */ jsx11(
|
|
6692
|
+
ImageThumb,
|
|
6085
6693
|
{
|
|
6086
6694
|
className: "awr-media awr-media--image",
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6695
|
+
imgClassName: "awr-media__img",
|
|
6696
|
+
src: url,
|
|
6697
|
+
name: media.path,
|
|
6698
|
+
alt: L.mediaImage(media.path),
|
|
6090
6699
|
title: media.path,
|
|
6091
|
-
|
|
6700
|
+
labels
|
|
6092
6701
|
}
|
|
6093
6702
|
);
|
|
6094
6703
|
}
|
|
6095
6704
|
if (url && family === "audio") {
|
|
6096
|
-
return /* @__PURE__ */
|
|
6705
|
+
return /* @__PURE__ */ jsx11("span", { className: "awr-media awr-media--audio", title: media.path, children: /* @__PURE__ */ jsx11(
|
|
6097
6706
|
"audio",
|
|
6098
6707
|
{
|
|
6099
6708
|
className: "awr-media__audio",
|
|
@@ -6104,27 +6713,27 @@ var GeneratedMedia = ({ media, files, labels }) => {
|
|
|
6104
6713
|
}
|
|
6105
6714
|
) });
|
|
6106
6715
|
}
|
|
6107
|
-
return /* @__PURE__ */
|
|
6108
|
-
/* @__PURE__ */
|
|
6716
|
+
return /* @__PURE__ */ jsxs9("span", { className: "awr-chip awr-file awr-media awr-media--file", title: L.mediaFile(media.path), children: [
|
|
6717
|
+
/* @__PURE__ */ jsx11(FileIcon, { size: 13 }),
|
|
6109
6718
|
" ",
|
|
6110
6719
|
media.path
|
|
6111
6720
|
] });
|
|
6112
6721
|
};
|
|
6113
6722
|
var TranscriptBlock = ({ transcript, labels }) => {
|
|
6114
6723
|
const L = useLabels(labels);
|
|
6115
|
-
return /* @__PURE__ */
|
|
6116
|
-
/* @__PURE__ */
|
|
6117
|
-
/* @__PURE__ */
|
|
6724
|
+
return /* @__PURE__ */ jsxs9("details", { className: "awr-transcript", children: [
|
|
6725
|
+
/* @__PURE__ */ jsxs9("summary", { className: "awr-transcript__summary", children: [
|
|
6726
|
+
/* @__PURE__ */ jsx11(FileIcon, { size: 13 }),
|
|
6118
6727
|
" ",
|
|
6119
6728
|
L.transcriptOf(transcript.name)
|
|
6120
6729
|
] }),
|
|
6121
|
-
/* @__PURE__ */
|
|
6122
|
-
/* @__PURE__ */
|
|
6730
|
+
/* @__PURE__ */ jsx11("p", { className: "awr-transcript__note", children: L.transcriptNote }),
|
|
6731
|
+
/* @__PURE__ */ jsx11("blockquote", { className: "awr-transcript__text", children: transcript.text })
|
|
6123
6732
|
] });
|
|
6124
6733
|
};
|
|
6125
6734
|
|
|
6126
6735
|
// src/components/SandboxedFrame.tsx
|
|
6127
|
-
import { jsx as
|
|
6736
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6128
6737
|
var FRAME_MIN_HEIGHT = 120;
|
|
6129
6738
|
var FRAME_MAX_HEIGHT = 800;
|
|
6130
6739
|
var clampFrameHeight = (height) => Math.min(
|
|
@@ -6141,12 +6750,12 @@ var SandboxedFrame = ({
|
|
|
6141
6750
|
height = 300,
|
|
6142
6751
|
children,
|
|
6143
6752
|
className
|
|
6144
|
-
}) => /* @__PURE__ */
|
|
6145
|
-
/* @__PURE__ */
|
|
6146
|
-
/* @__PURE__ */
|
|
6753
|
+
}) => /* @__PURE__ */ jsxs10("div", { className: ["awr-frame", className].filter(Boolean).join(" "), children: [
|
|
6754
|
+
/* @__PURE__ */ jsxs10("div", { className: "awr-frame__head", children: [
|
|
6755
|
+
/* @__PURE__ */ jsx12("div", { className: "awr-frame__label", children: label }),
|
|
6147
6756
|
actions
|
|
6148
6757
|
] }),
|
|
6149
|
-
html !== void 0 && children === void 0 ? /* @__PURE__ */
|
|
6758
|
+
html !== void 0 && children === void 0 ? /* @__PURE__ */ jsx12("div", { className: "awr-frame__well", children: /* @__PURE__ */ jsx12(
|
|
6150
6759
|
"iframe",
|
|
6151
6760
|
{
|
|
6152
6761
|
className: "awr-frame__iframe",
|
|
@@ -6158,11 +6767,11 @@ var SandboxedFrame = ({
|
|
|
6158
6767
|
},
|
|
6159
6768
|
scripts ? "scripts" : "static"
|
|
6160
6769
|
) }) : children,
|
|
6161
|
-
footer ? /* @__PURE__ */
|
|
6770
|
+
footer ? /* @__PURE__ */ jsx12("div", { className: "awr-frame__foot", children: footer }) : null
|
|
6162
6771
|
] });
|
|
6163
6772
|
|
|
6164
6773
|
// src/components/FileChips.tsx
|
|
6165
|
-
import { Fragment as
|
|
6774
|
+
import { Fragment as Fragment8, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6166
6775
|
var FILE_PREVIEW_CHARS = 2e4;
|
|
6167
6776
|
var textOf = (file) => file.encoding === "base64" ? new TextDecoder().decode(bytesOf(file.content, "base64")) : file.content;
|
|
6168
6777
|
var KIND_ICON = {
|
|
@@ -6183,11 +6792,11 @@ var downloadFile = async (vfs, path) => {
|
|
|
6183
6792
|
);
|
|
6184
6793
|
const a = document.createElement("a");
|
|
6185
6794
|
a.href = url;
|
|
6186
|
-
a.download =
|
|
6795
|
+
a.download = fileNameOf2(path);
|
|
6187
6796
|
a.click();
|
|
6188
6797
|
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
6189
6798
|
};
|
|
6190
|
-
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */
|
|
6799
|
+
var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ jsx13("div", { className: "awr-seg", role: "group", "aria-label": label, children: options.map((o) => /* @__PURE__ */ jsxs11(
|
|
6191
6800
|
"button",
|
|
6192
6801
|
{
|
|
6193
6802
|
type: "button",
|
|
@@ -6226,14 +6835,14 @@ var SourceView = ({
|
|
|
6226
6835
|
() => linesOf(html ? tokenizeHtml(shown) : [{ kind: "text", text: shown }]),
|
|
6227
6836
|
[shown, html]
|
|
6228
6837
|
);
|
|
6229
|
-
return /* @__PURE__ */
|
|
6230
|
-
/* @__PURE__ */
|
|
6838
|
+
return /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6839
|
+
/* @__PURE__ */ jsx13("pre", { className: ["awr-source", className].filter(Boolean).join(" "), tabIndex: 0, children: lines.map((line, i) => /* @__PURE__ */ jsxs11("span", { className: "awr-source__line", children: [
|
|
6231
6840
|
line.map(
|
|
6232
|
-
(t, k) => t.kind === "text" ? /* @__PURE__ */
|
|
6841
|
+
(t, k) => t.kind === "text" ? /* @__PURE__ */ jsx13(Fragment7, { children: t.text }, k) : /* @__PURE__ */ jsx13("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
|
|
6233
6842
|
),
|
|
6234
6843
|
"\n"
|
|
6235
6844
|
] }, i)) }),
|
|
6236
|
-
cut && /* @__PURE__ */
|
|
6845
|
+
cut && /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.fileCut(maxChars) })
|
|
6237
6846
|
] });
|
|
6238
6847
|
};
|
|
6239
6848
|
var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
@@ -6241,13 +6850,13 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6241
6850
|
const options = htmlPreview === false ? void 0 : htmlPreview;
|
|
6242
6851
|
const tooLarge = html.length > HTML_PREVIEW_MAX_CHARS;
|
|
6243
6852
|
const canFrame = Boolean(options) && !tooLarge;
|
|
6244
|
-
const [view, setView] =
|
|
6245
|
-
const [tall, setTall] =
|
|
6853
|
+
const [view, setView] = useState14(canFrame ? "preview" : "source");
|
|
6854
|
+
const [tall, setTall] = useState14(false);
|
|
6246
6855
|
const showing = canFrame ? view : "source";
|
|
6247
6856
|
const scripts = options?.scripts === true;
|
|
6248
6857
|
const height = options?.height ?? 300;
|
|
6249
6858
|
const linked = useMemo7(() => showing === "preview" ? linkedFilesOf(html) : [], [html, showing]);
|
|
6250
|
-
return /* @__PURE__ */
|
|
6859
|
+
return /* @__PURE__ */ jsx13(
|
|
6251
6860
|
SandboxedFrame,
|
|
6252
6861
|
{
|
|
6253
6862
|
className: "awr-frame--html",
|
|
@@ -6255,35 +6864,35 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6255
6864
|
html: showing === "preview" ? html : void 0,
|
|
6256
6865
|
scripts,
|
|
6257
6866
|
height: tall ? height * 2 : height,
|
|
6258
|
-
label: /* @__PURE__ */
|
|
6259
|
-
/* @__PURE__ */
|
|
6260
|
-
/* @__PURE__ */
|
|
6261
|
-
/* @__PURE__ */
|
|
6262
|
-
/* @__PURE__ */
|
|
6263
|
-
/* @__PURE__ */
|
|
6867
|
+
label: /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6868
|
+
/* @__PURE__ */ jsx13(CodeIcon, { size: 14, className: "awr-frame__icon" }),
|
|
6869
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-frame__titles", children: [
|
|
6870
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
|
|
6871
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6872
|
+
/* @__PURE__ */ jsx13(LockIcon, { size: 11 }),
|
|
6264
6873
|
" ",
|
|
6265
6874
|
L.htmlSandboxed,
|
|
6266
6875
|
" \xB7 ",
|
|
6267
|
-
/* @__PURE__ */
|
|
6876
|
+
/* @__PURE__ */ jsx13(NoNetworkIcon, { size: 11 }),
|
|
6268
6877
|
" ",
|
|
6269
6878
|
L.htmlNoNetwork
|
|
6270
6879
|
] }) : L.htmlSourceNote })
|
|
6271
6880
|
] })
|
|
6272
6881
|
] }),
|
|
6273
|
-
actions: canFrame ? /* @__PURE__ */
|
|
6274
|
-
/* @__PURE__ */
|
|
6882
|
+
actions: canFrame ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6883
|
+
/* @__PURE__ */ jsx13(
|
|
6275
6884
|
Seg,
|
|
6276
6885
|
{
|
|
6277
6886
|
label: L.htmlFrameTitle,
|
|
6278
6887
|
value: showing,
|
|
6279
6888
|
onChange: setView,
|
|
6280
6889
|
options: [
|
|
6281
|
-
{ value: "preview", label: L.preview, icon: /* @__PURE__ */
|
|
6282
|
-
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */
|
|
6890
|
+
{ value: "preview", label: L.preview, icon: /* @__PURE__ */ jsx13(EyeIcon, { size: 13 }) },
|
|
6891
|
+
{ value: "source", label: L.fileSource, icon: /* @__PURE__ */ jsx13(CodeIcon, { size: 13 }) }
|
|
6283
6892
|
]
|
|
6284
6893
|
}
|
|
6285
6894
|
),
|
|
6286
|
-
/* @__PURE__ */
|
|
6895
|
+
/* @__PURE__ */ jsx13(
|
|
6287
6896
|
"button",
|
|
6288
6897
|
{
|
|
6289
6898
|
type: "button",
|
|
@@ -6293,14 +6902,14 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6293
6902
|
"aria-pressed": tall,
|
|
6294
6903
|
disabled: showing !== "preview",
|
|
6295
6904
|
onClick: () => setTall((t) => !t),
|
|
6296
|
-
children: /* @__PURE__ */
|
|
6905
|
+
children: /* @__PURE__ */ jsx13(ExpandIcon, { size: 15 })
|
|
6297
6906
|
}
|
|
6298
6907
|
)
|
|
6299
6908
|
] }) : void 0,
|
|
6300
|
-
footer: /* @__PURE__ */
|
|
6301
|
-
/* @__PURE__ */
|
|
6302
|
-
/* @__PURE__ */
|
|
6303
|
-
/* @__PURE__ */
|
|
6909
|
+
footer: /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6910
|
+
/* @__PURE__ */ jsx13(FileIcon, { size: 11 }),
|
|
6911
|
+
/* @__PURE__ */ jsx13("code", { children: written.path }),
|
|
6912
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-frame__footmeta", children: [
|
|
6304
6913
|
"\xB7 ",
|
|
6305
6914
|
L.bytes(file.size),
|
|
6306
6915
|
" \xB7",
|
|
@@ -6309,18 +6918,18 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
|
|
|
6309
6918
|
linked.length > 0 ? ` \xB7 ${L.htmlLinkedFiles(linked.join(", "))}` : ""
|
|
6310
6919
|
] })
|
|
6311
6920
|
] }),
|
|
6312
|
-
children: showing === "source" ? /* @__PURE__ */
|
|
6313
|
-
tooLarge && options ? /* @__PURE__ */
|
|
6314
|
-
/* @__PURE__ */
|
|
6921
|
+
children: showing === "source" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6922
|
+
tooLarge && options ? /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
|
|
6923
|
+
/* @__PURE__ */ jsx13(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
|
|
6315
6924
|
] }) : void 0
|
|
6316
6925
|
}
|
|
6317
6926
|
);
|
|
6318
6927
|
};
|
|
6319
6928
|
var ImagePreview = ({ written, vfs, onClose, L }) => {
|
|
6320
6929
|
const url = useFileUrl(vfs, written.path, written.mediaType.toLowerCase().split(";")[0].trim());
|
|
6321
|
-
return /* @__PURE__ */
|
|
6322
|
-
/* @__PURE__ */
|
|
6323
|
-
/* @__PURE__ */
|
|
6930
|
+
return /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
|
|
6931
|
+
/* @__PURE__ */ jsx13(FileViewHead, { written, kind: "image", onClose, L }),
|
|
6932
|
+
/* @__PURE__ */ jsx13("div", { className: "awr-fileview__image", children: url ? /* @__PURE__ */ jsx13("img", { src: url, alt: fileNameOf2(written.path) }) : null })
|
|
6324
6933
|
] });
|
|
6325
6934
|
};
|
|
6326
6935
|
var FileViewHead = ({
|
|
@@ -6329,15 +6938,15 @@ var FileViewHead = ({
|
|
|
6329
6938
|
onClose,
|
|
6330
6939
|
L,
|
|
6331
6940
|
children
|
|
6332
|
-
}) => /* @__PURE__ */
|
|
6333
|
-
/* @__PURE__ */
|
|
6334
|
-
/* @__PURE__ */
|
|
6941
|
+
}) => /* @__PURE__ */ jsxs11("div", { className: "awr-fileview__head", children: [
|
|
6942
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-fileview__name", title: written.path, children: fileNameOf2(written.path) }),
|
|
6943
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-fileview__kind", children: [
|
|
6335
6944
|
"\xB7 ",
|
|
6336
6945
|
L.fileKinds[kind]
|
|
6337
6946
|
] }),
|
|
6338
|
-
/* @__PURE__ */
|
|
6947
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-fileview__actions", children: [
|
|
6339
6948
|
children,
|
|
6340
|
-
/* @__PURE__ */
|
|
6949
|
+
/* @__PURE__ */ jsx13(
|
|
6341
6950
|
"button",
|
|
6342
6951
|
{
|
|
6343
6952
|
type: "button",
|
|
@@ -6345,7 +6954,7 @@ var FileViewHead = ({
|
|
|
6345
6954
|
"aria-label": L.closePreview,
|
|
6346
6955
|
title: L.closePreview,
|
|
6347
6956
|
onClick: onClose,
|
|
6348
|
-
children: /* @__PURE__ */
|
|
6957
|
+
children: /* @__PURE__ */ jsx13(XIcon, { size: 14 })
|
|
6349
6958
|
}
|
|
6350
6959
|
)
|
|
6351
6960
|
] })
|
|
@@ -6365,15 +6974,15 @@ var TextPreview = ({
|
|
|
6365
6974
|
[renderFileContent, written, text, previewChars]
|
|
6366
6975
|
);
|
|
6367
6976
|
const hasRendered = rendered !== void 0 && rendered !== null && rendered !== false;
|
|
6368
|
-
const [view, setView] =
|
|
6369
|
-
const [all, setAll] =
|
|
6977
|
+
const [view, setView] = useState14("rendered");
|
|
6978
|
+
const [all, setAll] = useState14(false);
|
|
6370
6979
|
const showing = hasRendered ? view : "source";
|
|
6371
6980
|
const long = text.length > 1200 || text.split("\n").length > 16;
|
|
6372
|
-
return /* @__PURE__ */
|
|
6373
|
-
/* @__PURE__ */
|
|
6981
|
+
return /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
|
|
6982
|
+
/* @__PURE__ */ jsx13(FileViewHead, { written, kind, onClose, L, children: hasRendered && /* @__PURE__ */ jsx13(
|
|
6374
6983
|
Seg,
|
|
6375
6984
|
{
|
|
6376
|
-
label:
|
|
6985
|
+
label: fileNameOf2(written.path),
|
|
6377
6986
|
value: showing,
|
|
6378
6987
|
onChange: setView,
|
|
6379
6988
|
options: [
|
|
@@ -6382,16 +6991,16 @@ var TextPreview = ({
|
|
|
6382
6991
|
]
|
|
6383
6992
|
}
|
|
6384
6993
|
) }),
|
|
6385
|
-
/* @__PURE__ */
|
|
6386
|
-
/* @__PURE__ */
|
|
6387
|
-
text.length > previewChars && /* @__PURE__ */
|
|
6388
|
-
] }) : /* @__PURE__ */
|
|
6389
|
-
long && /* @__PURE__ */
|
|
6994
|
+
/* @__PURE__ */ jsx13("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
6995
|
+
/* @__PURE__ */ jsx13("div", { className: "awr-fileview__rendered", children: rendered }),
|
|
6996
|
+
text.length > previewChars && /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
|
|
6997
|
+
] }) : /* @__PURE__ */ jsx13(SourceView, { text, maxChars: previewChars }) }),
|
|
6998
|
+
long && /* @__PURE__ */ jsx13("div", { className: "awr-fileview__more", children: /* @__PURE__ */ jsx13("button", { type: "button", className: "awr-linkbtn", onClick: () => setAll((a) => !a), children: all ? L.fileShowLess : L.fileShowRest }) })
|
|
6390
6999
|
] });
|
|
6391
7000
|
};
|
|
6392
|
-
var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */
|
|
6393
|
-
/* @__PURE__ */
|
|
6394
|
-
/* @__PURE__ */
|
|
7001
|
+
var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
|
|
7002
|
+
/* @__PURE__ */ jsx13(FileViewHead, { written, kind, onClose, L }),
|
|
7003
|
+
/* @__PURE__ */ jsx13("p", { className: "awr-fileview__none", children: L.fileNoPreview })
|
|
6395
7004
|
] });
|
|
6396
7005
|
var FileChips = ({
|
|
6397
7006
|
written,
|
|
@@ -6408,11 +7017,11 @@ var FileChips = ({
|
|
|
6408
7017
|
}) => {
|
|
6409
7018
|
const L = useLabels(labels);
|
|
6410
7019
|
const live = useVirtualFiles(vfs);
|
|
6411
|
-
const [openPath, setOpenPath] =
|
|
6412
|
-
const [file, setFile] =
|
|
7020
|
+
const [openPath, setOpenPath] = useState14(defaultOpen);
|
|
7021
|
+
const [file, setFile] = useState14();
|
|
6413
7022
|
const open = written.find((f) => f.path === openPath);
|
|
6414
7023
|
const stamp = live.files.find((f) => f.path === openPath)?.updatedAt;
|
|
6415
|
-
|
|
7024
|
+
useEffect14(() => {
|
|
6416
7025
|
if (!vfs || !openPath) return setFile(void 0);
|
|
6417
7026
|
let gone = false;
|
|
6418
7027
|
vfs.read(openPath).then((f) => {
|
|
@@ -6439,23 +7048,23 @@ var FileChips = ({
|
|
|
6439
7048
|
onClose: () => setOpenPath(void 0),
|
|
6440
7049
|
L
|
|
6441
7050
|
};
|
|
6442
|
-
if (kind === "html") return /* @__PURE__ */
|
|
6443
|
-
if (kind === "image") return /* @__PURE__ */
|
|
6444
|
-
if (kind === "file") return /* @__PURE__ */
|
|
6445
|
-
return /* @__PURE__ */
|
|
7051
|
+
if (kind === "html") return /* @__PURE__ */ jsx13(HtmlPreview, { ...props }, open.path);
|
|
7052
|
+
if (kind === "image") return /* @__PURE__ */ jsx13(ImagePreview, { ...props }, open.path);
|
|
7053
|
+
if (kind === "file") return /* @__PURE__ */ jsx13(NoPreview, { ...props }, open.path);
|
|
7054
|
+
return /* @__PURE__ */ jsx13(TextPreview, { ...props }, open.path);
|
|
6446
7055
|
};
|
|
6447
|
-
return /* @__PURE__ */
|
|
6448
|
-
showHeader && /* @__PURE__ */
|
|
6449
|
-
/* @__PURE__ */
|
|
6450
|
-
/* @__PURE__ */
|
|
6451
|
-
onShowFiles && /* @__PURE__ */
|
|
7056
|
+
return /* @__PURE__ */ jsxs11("div", { className: ["awr-msg__files", className].filter(Boolean).join(" "), children: [
|
|
7057
|
+
showHeader && /* @__PURE__ */ jsxs11("div", { className: "awr-msg__fileshead", children: [
|
|
7058
|
+
/* @__PURE__ */ jsx13(FileIcon, { size: 13 }),
|
|
7059
|
+
/* @__PURE__ */ jsx13("span", { children: L.filesWritten(written.length) }),
|
|
7060
|
+
onShowFiles && /* @__PURE__ */ jsx13("button", { type: "button", className: "awr-linkbtn", onClick: onShowFiles, children: L.showInFiles })
|
|
6452
7061
|
] }),
|
|
6453
|
-
/* @__PURE__ */
|
|
7062
|
+
/* @__PURE__ */ jsx13("ul", { className: "awr-filechips", children: written.map((w) => {
|
|
6454
7063
|
const info = live.files.find((f) => f.path === w.path);
|
|
6455
7064
|
const gone = Boolean(vfs) && !live.loading && !info;
|
|
6456
7065
|
const usable = Boolean(vfs) && !gone;
|
|
6457
7066
|
const isOpen = openPath === w.path && usable;
|
|
6458
|
-
const chip = /* @__PURE__ */
|
|
7067
|
+
const chip = /* @__PURE__ */ jsx13(
|
|
6459
7068
|
FileChip,
|
|
6460
7069
|
{
|
|
6461
7070
|
written: w,
|
|
@@ -6468,7 +7077,7 @@ var FileChips = ({
|
|
|
6468
7077
|
labels
|
|
6469
7078
|
}
|
|
6470
7079
|
);
|
|
6471
|
-
return /* @__PURE__ */
|
|
7080
|
+
return /* @__PURE__ */ jsx13("li", { className: "awr-filechips__item", children: renderFile ? renderFile(w, chip) : chip }, w.path);
|
|
6472
7081
|
}) }),
|
|
6473
7082
|
preview()
|
|
6474
7083
|
] });
|
|
@@ -6485,7 +7094,7 @@ var FileChip = ({
|
|
|
6485
7094
|
}) => {
|
|
6486
7095
|
const L = useLabels(labels);
|
|
6487
7096
|
const kind = fileKindOf(written.path, mediaType);
|
|
6488
|
-
const name =
|
|
7097
|
+
const name = fileNameOf2(written.path);
|
|
6489
7098
|
const Icon = KIND_ICON[kind];
|
|
6490
7099
|
const thumb = useFileUrl(
|
|
6491
7100
|
kind === "image" ? vfs : void 0,
|
|
@@ -6493,19 +7102,19 @@ var FileChip = ({
|
|
|
6493
7102
|
kind === "image" ? mediaType.toLowerCase().split(";")[0].trim() : void 0
|
|
6494
7103
|
);
|
|
6495
7104
|
const meta = gone ? L.fileGone : [L.fileKinds[kind], L.bytes(bytes), written.by ? L.fileBy(written.by.name) : ""].filter(Boolean).join(" \xB7 ");
|
|
6496
|
-
return /* @__PURE__ */
|
|
7105
|
+
return /* @__PURE__ */ jsxs11(
|
|
6497
7106
|
"div",
|
|
6498
7107
|
{
|
|
6499
7108
|
className: `awr-filechip${open ? " is-open" : ""}${gone ? " is-gone" : ""}`,
|
|
6500
7109
|
title: written.path,
|
|
6501
7110
|
children: [
|
|
6502
|
-
/* @__PURE__ */
|
|
6503
|
-
/* @__PURE__ */
|
|
6504
|
-
/* @__PURE__ */
|
|
6505
|
-
/* @__PURE__ */
|
|
7111
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-filechip__thumb", children: thumb ? /* @__PURE__ */ jsx13("img", { src: thumb, alt: "" }) : /* @__PURE__ */ jsx13(Icon, { size: 16 }) }),
|
|
7112
|
+
/* @__PURE__ */ jsxs11("span", { className: "awr-filechip__text", children: [
|
|
7113
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-filechip__name", children: name }),
|
|
7114
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-filechip__meta", children: meta })
|
|
6506
7115
|
] }),
|
|
6507
|
-
vfs && /* @__PURE__ */
|
|
6508
|
-
onToggle && /* @__PURE__ */
|
|
7116
|
+
vfs && /* @__PURE__ */ jsxs11("span", { className: "awr-filechip__actions", children: [
|
|
7117
|
+
onToggle && /* @__PURE__ */ jsx13(
|
|
6509
7118
|
"button",
|
|
6510
7119
|
{
|
|
6511
7120
|
type: "button",
|
|
@@ -6514,10 +7123,10 @@ var FileChip = ({
|
|
|
6514
7123
|
title: open ? L.closePreview : L.preview,
|
|
6515
7124
|
"aria-expanded": open,
|
|
6516
7125
|
onClick: onToggle,
|
|
6517
|
-
children: open ? /* @__PURE__ */
|
|
7126
|
+
children: open ? /* @__PURE__ */ jsx13(ChevronUpIcon, { size: 15 }) : /* @__PURE__ */ jsx13(EyeIcon, { size: 15 })
|
|
6518
7127
|
}
|
|
6519
7128
|
),
|
|
6520
|
-
/* @__PURE__ */
|
|
7129
|
+
/* @__PURE__ */ jsx13(
|
|
6521
7130
|
"button",
|
|
6522
7131
|
{
|
|
6523
7132
|
type: "button",
|
|
@@ -6525,7 +7134,7 @@ var FileChip = ({
|
|
|
6525
7134
|
"aria-label": L.fileDownload(name),
|
|
6526
7135
|
title: L.download,
|
|
6527
7136
|
onClick: () => void downloadFile(vfs, written.path),
|
|
6528
|
-
children: /* @__PURE__ */
|
|
7137
|
+
children: /* @__PURE__ */ jsx13(DownloadIcon, { size: 15 })
|
|
6529
7138
|
}
|
|
6530
7139
|
)
|
|
6531
7140
|
] })
|
|
@@ -6535,14 +7144,14 @@ var FileChip = ({
|
|
|
6535
7144
|
};
|
|
6536
7145
|
|
|
6537
7146
|
// src/components/StepList.tsx
|
|
6538
|
-
import { Fragment as
|
|
7147
|
+
import { Fragment as Fragment10 } from "react";
|
|
6539
7148
|
|
|
6540
7149
|
// src/components/SubagentTree.tsx
|
|
6541
|
-
import { Fragment as
|
|
6542
|
-
import { jsx as
|
|
7150
|
+
import { Fragment as Fragment9, useEffect as useEffect15, useState as useState15 } from "react";
|
|
7151
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6543
7152
|
var useElapsed = (startedAt, running) => {
|
|
6544
|
-
const [now, setNow] =
|
|
6545
|
-
|
|
7153
|
+
const [now, setNow] = useState15(void 0);
|
|
7154
|
+
useEffect15(() => {
|
|
6546
7155
|
if (!running || startedAt === void 0) return;
|
|
6547
7156
|
setNow(Date.now());
|
|
6548
7157
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -6570,19 +7179,19 @@ var SubagentRow = ({
|
|
|
6570
7179
|
sub.toolCalls > 0 ? L.toolCalls(sub.toolCalls) : "",
|
|
6571
7180
|
time !== void 0 ? formatDuration(time) : ""
|
|
6572
7181
|
].filter(Boolean);
|
|
6573
|
-
return /* @__PURE__ */
|
|
7182
|
+
return /* @__PURE__ */ jsxs12(
|
|
6574
7183
|
"li",
|
|
6575
7184
|
{
|
|
6576
7185
|
className: `awr-subagent awr-subagent--${sub.status}${sub.dynamic ? " awr-subagent--dynamic" : ""}`,
|
|
6577
7186
|
"data-depth": sub.depth,
|
|
6578
7187
|
children: [
|
|
6579
|
-
/* @__PURE__ */
|
|
6580
|
-
/* @__PURE__ */
|
|
6581
|
-
/* @__PURE__ */
|
|
6582
|
-
sub.dynamic && role && /* @__PURE__ */
|
|
6583
|
-
sub.profile && /* @__PURE__ */
|
|
6584
|
-
/* @__PURE__ */
|
|
6585
|
-
running && onStop && /* @__PURE__ */
|
|
7188
|
+
/* @__PURE__ */ jsxs12("div", { className: "awr-subagent__head", children: [
|
|
7189
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ jsx14(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ jsx14(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ jsx14(StopIcon, { size: 13 }) : /* @__PURE__ */ jsx14(AlertIcon, { size: 13 }) }),
|
|
7190
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
|
|
7191
|
+
sub.dynamic && role && /* @__PURE__ */ jsx14("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
|
|
7192
|
+
sub.profile && /* @__PURE__ */ jsx14("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
7193
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
7194
|
+
running && onStop && /* @__PURE__ */ jsx14(
|
|
6586
7195
|
"button",
|
|
6587
7196
|
{
|
|
6588
7197
|
type: "button",
|
|
@@ -6590,16 +7199,16 @@ var SubagentRow = ({
|
|
|
6590
7199
|
"aria-label": L.stopSubagent,
|
|
6591
7200
|
title: L.stopSubagent,
|
|
6592
7201
|
onClick: () => onStop(sub.id),
|
|
6593
|
-
children: /* @__PURE__ */
|
|
7202
|
+
children: /* @__PURE__ */ jsx14(StopIcon, { size: 12 })
|
|
6594
7203
|
}
|
|
6595
7204
|
)
|
|
6596
7205
|
] }),
|
|
6597
|
-
showUsage && /* @__PURE__ */
|
|
6598
|
-
/* @__PURE__ */
|
|
6599
|
-
meta.map((part, i) => /* @__PURE__ */
|
|
7206
|
+
showUsage && /* @__PURE__ */ jsxs12("div", { className: "awr-subagent__meta", children: [
|
|
7207
|
+
/* @__PURE__ */ jsx14("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
|
|
7208
|
+
meta.map((part, i) => /* @__PURE__ */ jsx14("span", { className: "awr-subagent__metaitem", children: part }, i))
|
|
6600
7209
|
] }),
|
|
6601
|
-
showTools && sub.tools && /* @__PURE__ */
|
|
6602
|
-
/* @__PURE__ */
|
|
7210
|
+
showTools && sub.tools && /* @__PURE__ */ jsx14("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
|
|
7211
|
+
/* @__PURE__ */ jsx14("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)}` : ""}` }),
|
|
6603
7212
|
children
|
|
6604
7213
|
]
|
|
6605
7214
|
}
|
|
@@ -6615,12 +7224,12 @@ var SubagentTree = ({
|
|
|
6615
7224
|
className
|
|
6616
7225
|
}) => {
|
|
6617
7226
|
if (subagents.length === 0) return null;
|
|
6618
|
-
const branch = (nodes, nested) => /* @__PURE__ */
|
|
7227
|
+
const branch = (nodes, nested) => /* @__PURE__ */ jsx14(
|
|
6619
7228
|
"ul",
|
|
6620
7229
|
{
|
|
6621
7230
|
className: ["awr-subagents", nested ? "awr-subagents--nested" : className].filter(Boolean).join(" "),
|
|
6622
7231
|
children: nodes.map((node) => {
|
|
6623
|
-
const row = /* @__PURE__ */
|
|
7232
|
+
const row = /* @__PURE__ */ jsx14(
|
|
6624
7233
|
SubagentRow,
|
|
6625
7234
|
{
|
|
6626
7235
|
sub: node,
|
|
@@ -6632,7 +7241,7 @@ var SubagentTree = ({
|
|
|
6632
7241
|
},
|
|
6633
7242
|
node.id
|
|
6634
7243
|
);
|
|
6635
|
-
return renderSubagent ? /* @__PURE__ */
|
|
7244
|
+
return renderSubagent ? /* @__PURE__ */ jsx14(Fragment9, { children: renderSubagent(node, row) }, node.id) : row;
|
|
6636
7245
|
})
|
|
6637
7246
|
}
|
|
6638
7247
|
);
|
|
@@ -6640,7 +7249,7 @@ var SubagentTree = ({
|
|
|
6640
7249
|
};
|
|
6641
7250
|
|
|
6642
7251
|
// src/components/StepList.tsx
|
|
6643
|
-
import { jsx as
|
|
7252
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6644
7253
|
var WEB_SEARCH = "web_search";
|
|
6645
7254
|
var ToolCallRow = ({
|
|
6646
7255
|
call,
|
|
@@ -6658,37 +7267,47 @@ var ToolCallRow = ({
|
|
|
6658
7267
|
call.outputTokens ? `\u2248${formatTokens(call.outputTokens)} out` : "",
|
|
6659
7268
|
call.durationMs !== void 0 ? formatDuration(call.durationMs) : ""
|
|
6660
7269
|
].filter(Boolean).join(" \xB7 ");
|
|
6661
|
-
return /* @__PURE__ */
|
|
7270
|
+
return /* @__PURE__ */ jsxs13(
|
|
6662
7271
|
"li",
|
|
6663
7272
|
{
|
|
6664
7273
|
className: `awr-tool awr-tool--${state}${showTiers && call.attempt !== void 0 ? " awr-tool--earlier" : ""}`,
|
|
6665
7274
|
children: [
|
|
6666
|
-
/* @__PURE__ */
|
|
6667
|
-
/* @__PURE__ */
|
|
6668
|
-
/* @__PURE__ */
|
|
6669
|
-
previewValue(call.input) && /* @__PURE__ */
|
|
6670
|
-
call.status === "calling" && /* @__PURE__ */
|
|
6671
|
-
call.status === "done" && call.ok === false && /* @__PURE__ */
|
|
6672
|
-
showTiers && call.replayed && /* @__PURE__ */
|
|
6673
|
-
showTiers && call.attempt !== void 0 && /* @__PURE__ */
|
|
6674
|
-
call.app && /* @__PURE__ */
|
|
6675
|
-
/* @__PURE__ */
|
|
7275
|
+
/* @__PURE__ */ jsxs13("div", { className: "awr-tool__row", children: [
|
|
7276
|
+
/* @__PURE__ */ jsx15(ToolIcon, { size: 13, className: "awr-tool__icon" }),
|
|
7277
|
+
/* @__PURE__ */ jsx15("code", { className: "awr-tool__name", children: call.name }),
|
|
7278
|
+
previewValue(call.input) && /* @__PURE__ */ jsx15("span", { className: "awr-tool__args", children: previewValue(call.input) }),
|
|
7279
|
+
call.status === "calling" && /* @__PURE__ */ jsx15(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
7280
|
+
call.status === "done" && call.ok === false && /* @__PURE__ */ jsx15("span", { className: "awr-tool__badge", children: L.failed }),
|
|
7281
|
+
showTiers && call.replayed && /* @__PURE__ */ jsx15("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
|
|
7282
|
+
showTiers && call.attempt !== void 0 && /* @__PURE__ */ jsx15("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
|
|
7283
|
+
call.app && /* @__PURE__ */ jsxs13("span", { className: "awr-tool__tag awr-tool__tag--app", "data-app": call.app, children: [
|
|
7284
|
+
/* @__PURE__ */ jsx15(AppIcon, { size: 10 }),
|
|
6676
7285
|
" ",
|
|
6677
7286
|
L.appTag
|
|
6678
7287
|
] }),
|
|
6679
|
-
showUsage && cost && /* @__PURE__ */
|
|
7288
|
+
showUsage && cost && /* @__PURE__ */ jsx15("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
|
|
6680
7289
|
] }),
|
|
6681
|
-
images.length > 0 && /* @__PURE__ */
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
7290
|
+
images.length > 0 && /* @__PURE__ */ jsx15("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ jsx15(
|
|
7291
|
+
ImageThumb,
|
|
7292
|
+
{
|
|
7293
|
+
src,
|
|
7294
|
+
name: `${call.name}-${i + 1}${imageExtensionOf(src)}`,
|
|
7295
|
+
alt: `${call.name} result ${i + 1}`,
|
|
7296
|
+
imgClassName: "awr-thumb",
|
|
7297
|
+
labels
|
|
7298
|
+
},
|
|
7299
|
+
i
|
|
7300
|
+
)) }),
|
|
7301
|
+
search && /* @__PURE__ */ jsxs13("div", { className: "awr-search", children: [
|
|
7302
|
+
/* @__PURE__ */ jsxs13("p", { className: "awr-search__query", children: [
|
|
7303
|
+
/* @__PURE__ */ jsx15(GlobeIcon, { size: 12 }),
|
|
6685
7304
|
" ",
|
|
6686
7305
|
L.searchQuery,
|
|
6687
7306
|
" ",
|
|
6688
|
-
/* @__PURE__ */
|
|
7307
|
+
/* @__PURE__ */ jsx15("q", { children: search.query })
|
|
6689
7308
|
] }),
|
|
6690
|
-
search.results.length > 0 ? /* @__PURE__ */
|
|
6691
|
-
/* @__PURE__ */
|
|
7309
|
+
search.results.length > 0 ? /* @__PURE__ */ jsx15("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ jsxs13("li", { className: "awr-search__result", children: [
|
|
7310
|
+
/* @__PURE__ */ jsx15(
|
|
6692
7311
|
"a",
|
|
6693
7312
|
{
|
|
6694
7313
|
className: "awr-search__title",
|
|
@@ -6699,13 +7318,13 @@ var ToolCallRow = ({
|
|
|
6699
7318
|
}
|
|
6700
7319
|
),
|
|
6701
7320
|
" ",
|
|
6702
|
-
/* @__PURE__ */
|
|
7321
|
+
/* @__PURE__ */ jsxs13("span", { className: "awr-search__host", children: [
|
|
6703
7322
|
r.host,
|
|
6704
7323
|
r.date ? ` \xB7 ${r.date}` : ""
|
|
6705
7324
|
] }),
|
|
6706
|
-
r.snippet && /* @__PURE__ */
|
|
6707
|
-
] }, i)) }) : /* @__PURE__ */
|
|
6708
|
-
(search.filtered > 0 || search.truncated) && /* @__PURE__ */
|
|
7325
|
+
r.snippet && /* @__PURE__ */ jsx15("p", { className: "awr-search__snippet", children: r.snippet })
|
|
7326
|
+
] }, i)) }) : /* @__PURE__ */ jsx15("p", { className: "awr-search__note", children: L.searchNoResults }),
|
|
7327
|
+
(search.filtered > 0 || search.truncated) && /* @__PURE__ */ jsx15("p", { className: "awr-search__note", children: [
|
|
6709
7328
|
search.filtered > 0 ? L.searchFiltered(search.filtered) : "",
|
|
6710
7329
|
search.truncated ? L.searchTruncated : ""
|
|
6711
7330
|
].filter(Boolean).join(" \xB7 ") })
|
|
@@ -6719,11 +7338,11 @@ var UserNoteRow = ({
|
|
|
6719
7338
|
labels
|
|
6720
7339
|
}) => {
|
|
6721
7340
|
const L = useLabels(labels);
|
|
6722
|
-
return /* @__PURE__ */
|
|
6723
|
-
/* @__PURE__ */
|
|
6724
|
-
/* @__PURE__ */
|
|
6725
|
-
/* @__PURE__ */
|
|
6726
|
-
note.origin === "another-tab" && /* @__PURE__ */
|
|
7341
|
+
return /* @__PURE__ */ jsxs13("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
7342
|
+
/* @__PURE__ */ jsx15(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
7343
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
7344
|
+
/* @__PURE__ */ jsx15("q", { className: "awr-note__text", children: note.text }),
|
|
7345
|
+
note.origin === "another-tab" && /* @__PURE__ */ jsx15("span", { className: "awr-note__origin", children: L.fromAnotherTab })
|
|
6727
7346
|
] });
|
|
6728
7347
|
};
|
|
6729
7348
|
var decisionNote = (d, L) => {
|
|
@@ -6754,18 +7373,14 @@ var StepItem = ({
|
|
|
6754
7373
|
renderToolCall,
|
|
6755
7374
|
renderSubagent,
|
|
6756
7375
|
L
|
|
6757
|
-
}) => /* @__PURE__ */
|
|
6758
|
-
/* @__PURE__ */
|
|
6759
|
-
/* @__PURE__ */
|
|
6760
|
-
/* @__PURE__ */
|
|
6761
|
-
|
|
6762
|
-
"/",
|
|
6763
|
-
step.total
|
|
6764
|
-
] }),
|
|
6765
|
-
/* @__PURE__ */ jsx14("span", { className: "awr-step__desc", children: step.step.description })
|
|
7376
|
+
}) => /* @__PURE__ */ jsxs13("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
|
|
7377
|
+
/* @__PURE__ */ jsxs13("div", { className: "awr-step__head", children: [
|
|
7378
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ jsx15(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ jsx15(AlertIcon, { size: 14 }) : /* @__PURE__ */ jsx15(CheckIcon, { size: 14 }) }),
|
|
7379
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-step__index", children: `${step.index}/${step.total}` }),
|
|
7380
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-step__desc", children: step.step.description })
|
|
6766
7381
|
] }),
|
|
6767
|
-
showTiers && step.tier && /* @__PURE__ */
|
|
6768
|
-
/* @__PURE__ */
|
|
7382
|
+
showTiers && step.tier && /* @__PURE__ */ jsxs13("div", { className: "awr-step__meta", children: [
|
|
7383
|
+
/* @__PURE__ */ jsx15(
|
|
6769
7384
|
"span",
|
|
6770
7385
|
{
|
|
6771
7386
|
className: `awr-step__tier awr-step__tier--${step.tier}`,
|
|
@@ -6773,29 +7388,29 @@ var StepItem = ({
|
|
|
6773
7388
|
children: L.tierNames[step.tier]
|
|
6774
7389
|
}
|
|
6775
7390
|
),
|
|
6776
|
-
step.model && /* @__PURE__ */
|
|
7391
|
+
step.model && /* @__PURE__ */ jsx15("span", { className: "awr-step__model", children: step.model })
|
|
6777
7392
|
] }),
|
|
6778
|
-
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */
|
|
6779
|
-
/* @__PURE__ */
|
|
6780
|
-
/* @__PURE__ */
|
|
6781
|
-
/* @__PURE__ */
|
|
7393
|
+
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ jsxs13("div", { className: "awr-step__escalated", children: [
|
|
7394
|
+
/* @__PURE__ */ jsxs13("p", { className: "awr-step__escalated-line", children: [
|
|
7395
|
+
/* @__PURE__ */ jsx15(ArrowUpIcon, { size: 12 }),
|
|
7396
|
+
/* @__PURE__ */ jsx15("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
|
|
6782
7397
|
] }),
|
|
6783
|
-
e.text?.trim() && /* @__PURE__ */
|
|
6784
|
-
/* @__PURE__ */
|
|
6785
|
-
/* @__PURE__ */
|
|
7398
|
+
e.text?.trim() && /* @__PURE__ */ jsxs13("details", { className: "awr-step__attempt", children: [
|
|
7399
|
+
/* @__PURE__ */ jsx15("summary", { children: L.escalatedAttemptText }),
|
|
7400
|
+
/* @__PURE__ */ jsx15("p", { className: "awr-step__text", children: e.text.trim() })
|
|
6786
7401
|
] })
|
|
6787
7402
|
] }, i)),
|
|
6788
|
-
showThoughts && step.reasoning.trim() && /* @__PURE__ */
|
|
6789
|
-
/* @__PURE__ */
|
|
6790
|
-
/* @__PURE__ */
|
|
7403
|
+
showThoughts && step.reasoning.trim() && /* @__PURE__ */ jsxs13("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
|
|
7404
|
+
/* @__PURE__ */ jsxs13("summary", { children: [
|
|
7405
|
+
/* @__PURE__ */ jsx15(BrainIcon, { size: 13 }),
|
|
6791
7406
|
" ",
|
|
6792
7407
|
L.stepThoughts
|
|
6793
7408
|
] }),
|
|
6794
|
-
/* @__PURE__ */
|
|
7409
|
+
/* @__PURE__ */ jsx15("p", { className: "awr-thought__text", children: step.reasoning.trim() })
|
|
6795
7410
|
] }),
|
|
6796
|
-
step.text.trim() && /* @__PURE__ */
|
|
6797
|
-
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */
|
|
6798
|
-
const row = /* @__PURE__ */
|
|
7411
|
+
step.text.trim() && /* @__PURE__ */ jsx15("p", { className: "awr-step__text", children: step.text.trim() }),
|
|
7412
|
+
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ jsx15("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
|
|
7413
|
+
const row = /* @__PURE__ */ jsx15(
|
|
6799
7414
|
ToolCallRow,
|
|
6800
7415
|
{
|
|
6801
7416
|
call,
|
|
@@ -6805,15 +7420,15 @@ var StepItem = ({
|
|
|
6805
7420
|
},
|
|
6806
7421
|
i
|
|
6807
7422
|
);
|
|
6808
|
-
return renderToolCall ? /* @__PURE__ */
|
|
7423
|
+
return renderToolCall ? /* @__PURE__ */ jsx15(Fragment10, { children: renderToolCall(call, row) }, i) : row;
|
|
6809
7424
|
}) }),
|
|
6810
|
-
approvals.length > 0 && /* @__PURE__ */
|
|
6811
|
-
/* @__PURE__ */
|
|
6812
|
-
/* @__PURE__ */
|
|
6813
|
-
/* @__PURE__ */
|
|
6814
|
-
a.subagent && /* @__PURE__ */
|
|
7425
|
+
approvals.length > 0 && /* @__PURE__ */ jsx15("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ jsxs13("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
|
|
7426
|
+
/* @__PURE__ */ jsx15(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
|
|
7427
|
+
/* @__PURE__ */ jsx15("code", { className: "awr-tool__name", children: a.name }),
|
|
7428
|
+
/* @__PURE__ */ jsx15("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
|
|
7429
|
+
a.subagent && /* @__PURE__ */ jsx15("span", { className: "awr-tool__tag", children: L.subagentHelper })
|
|
6815
7430
|
] }, a.id)) }),
|
|
6816
|
-
showSubagents && /* @__PURE__ */
|
|
7431
|
+
showSubagents && /* @__PURE__ */ jsx15(
|
|
6817
7432
|
SubagentTree,
|
|
6818
7433
|
{
|
|
6819
7434
|
subagents,
|
|
@@ -6822,14 +7437,14 @@ var StepItem = ({
|
|
|
6822
7437
|
renderSubagent
|
|
6823
7438
|
}
|
|
6824
7439
|
),
|
|
6825
|
-
notes.length > 0 && /* @__PURE__ */
|
|
6826
|
-
step.blocked && step.summary && /* @__PURE__ */
|
|
6827
|
-
showReplanFailed && step.replanFailed && /* @__PURE__ */
|
|
6828
|
-
/* @__PURE__ */
|
|
7440
|
+
notes.length > 0 && /* @__PURE__ */ jsx15("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ jsx15(UserNoteRow, { note: n }, n.id)) }),
|
|
7441
|
+
step.blocked && step.summary && /* @__PURE__ */ jsx15("p", { className: "awr-step__blocked", children: step.summary }),
|
|
7442
|
+
showReplanFailed && step.replanFailed && /* @__PURE__ */ jsxs13("p", { className: "awr-step__warn", title: step.replanFailed, children: [
|
|
7443
|
+
/* @__PURE__ */ jsx15(AlertIcon, { size: 12 }),
|
|
6829
7444
|
" ",
|
|
6830
7445
|
L.replanFailed
|
|
6831
7446
|
] }),
|
|
6832
|
-
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */
|
|
7447
|
+
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ jsx15(
|
|
6833
7448
|
"p",
|
|
6834
7449
|
{
|
|
6835
7450
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -6864,8 +7479,8 @@ var StepList = ({
|
|
|
6864
7479
|
const known = new Set(steps.map((s) => s.id));
|
|
6865
7480
|
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
6866
7481
|
const loose = showSubagents ? subagents.filter((s) => !s.stepId || !known.has(s.stepId)) : [];
|
|
6867
|
-
return /* @__PURE__ */
|
|
6868
|
-
steps.map((step) => /* @__PURE__ */
|
|
7482
|
+
return /* @__PURE__ */ jsxs13("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
7483
|
+
steps.map((step) => /* @__PURE__ */ jsx15(
|
|
6869
7484
|
StepItem,
|
|
6870
7485
|
{
|
|
6871
7486
|
step,
|
|
@@ -6887,7 +7502,7 @@ var StepList = ({
|
|
|
6887
7502
|
},
|
|
6888
7503
|
step.id
|
|
6889
7504
|
)),
|
|
6890
|
-
loose.length > 0 && /* @__PURE__ */
|
|
7505
|
+
loose.length > 0 && /* @__PURE__ */ jsx15("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ jsx15(
|
|
6891
7506
|
SubagentTree,
|
|
6892
7507
|
{
|
|
6893
7508
|
subagents: loose,
|
|
@@ -6896,12 +7511,12 @@ var StepList = ({
|
|
|
6896
7511
|
renderSubagent
|
|
6897
7512
|
}
|
|
6898
7513
|
) }),
|
|
6899
|
-
atEnd.length > 0 && /* @__PURE__ */
|
|
7514
|
+
atEnd.length > 0 && /* @__PURE__ */ jsx15("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ jsx15("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ jsx15(UserNoteRow, { note: n }, n.id)) }) })
|
|
6900
7515
|
] });
|
|
6901
7516
|
};
|
|
6902
7517
|
|
|
6903
7518
|
// src/components/MessageList.tsx
|
|
6904
|
-
import { jsx as
|
|
7519
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6905
7520
|
var usageLine = (usage, durationMs) => {
|
|
6906
7521
|
const parts = [];
|
|
6907
7522
|
if (usage && usage.totalTokens > 0) {
|
|
@@ -6912,8 +7527,17 @@ var usageLine = (usage, durationMs) => {
|
|
|
6912
7527
|
if (durationMs !== void 0) parts.push(formatDuration(durationMs));
|
|
6913
7528
|
return parts.join(" \xB7 ");
|
|
6914
7529
|
};
|
|
6915
|
-
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */
|
|
6916
|
-
|
|
7530
|
+
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ jsx16(
|
|
7531
|
+
ImageThumb,
|
|
7532
|
+
{
|
|
7533
|
+
src: a.dataUrl,
|
|
7534
|
+
name: a.path ?? a.name,
|
|
7535
|
+
alt: a.name,
|
|
7536
|
+
imgClassName: "awr-thumb awr-thumb--msg",
|
|
7537
|
+
title: a.path ?? a.name
|
|
7538
|
+
}
|
|
7539
|
+
) : /* @__PURE__ */ jsxs14("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
|
|
7540
|
+
/* @__PURE__ */ jsx16(FileIcon, { size: 13 }),
|
|
6917
7541
|
" ",
|
|
6918
7542
|
a.name
|
|
6919
7543
|
] });
|
|
@@ -6964,24 +7588,26 @@ var MessageList = ({
|
|
|
6964
7588
|
renderToolCall,
|
|
6965
7589
|
renderApp,
|
|
6966
7590
|
showApps = true,
|
|
7591
|
+
imageViewer = true,
|
|
7592
|
+
renderImageViewer,
|
|
6967
7593
|
labels,
|
|
6968
7594
|
className
|
|
6969
7595
|
}) => {
|
|
6970
7596
|
const L = useLabels(labels);
|
|
6971
7597
|
if (messages.length === 0) {
|
|
6972
|
-
return empty ? /* @__PURE__ */
|
|
7598
|
+
return empty ? /* @__PURE__ */ jsx16("div", { className: "awr-messages__empty", children: empty }) : null;
|
|
6973
7599
|
}
|
|
6974
|
-
return /* @__PURE__ */
|
|
7600
|
+
return /* @__PURE__ */ jsx16(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ jsx16("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
|
|
6975
7601
|
const steps = m.steps ?? [];
|
|
6976
7602
|
const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
|
|
6977
7603
|
const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
|
|
6978
|
-
const node = /* @__PURE__ */
|
|
7604
|
+
const node = /* @__PURE__ */ jsx16(
|
|
6979
7605
|
"div",
|
|
6980
7606
|
{
|
|
6981
7607
|
className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
|
|
6982
|
-
children: /* @__PURE__ */
|
|
6983
|
-
m.role === "assistant" && hasActivity && /* @__PURE__ */
|
|
6984
|
-
/* @__PURE__ */
|
|
7608
|
+
children: /* @__PURE__ */ jsxs14("div", { className: "awr-msg__col", children: [
|
|
7609
|
+
m.role === "assistant" && hasActivity && /* @__PURE__ */ jsxs14("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
|
|
7610
|
+
/* @__PURE__ */ jsx16("summary", { className: "awr-activity__summary", children: activitySummary(
|
|
6985
7611
|
m,
|
|
6986
7612
|
showToolCalls,
|
|
6987
7613
|
showLearned,
|
|
@@ -6991,7 +7617,7 @@ var MessageList = ({
|
|
|
6991
7617
|
showApps && Boolean(renderApp)
|
|
6992
7618
|
) }),
|
|
6993
7619
|
m.pending && liveExtra,
|
|
6994
|
-
/* @__PURE__ */
|
|
7620
|
+
/* @__PURE__ */ jsx16(
|
|
6995
7621
|
StepList,
|
|
6996
7622
|
{
|
|
6997
7623
|
steps,
|
|
@@ -7013,45 +7639,45 @@ var MessageList = ({
|
|
|
7013
7639
|
labels
|
|
7014
7640
|
}
|
|
7015
7641
|
),
|
|
7016
|
-
showLearned && m.fetches?.length ? /* @__PURE__ */
|
|
7642
|
+
showLearned && m.fetches?.length ? /* @__PURE__ */ jsx16("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ jsxs14(
|
|
7017
7643
|
"li",
|
|
7018
7644
|
{
|
|
7019
7645
|
className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
|
|
7020
7646
|
children: [
|
|
7021
|
-
/* @__PURE__ */
|
|
7647
|
+
/* @__PURE__ */ jsx16(GlobeIcon, { size: 12 }),
|
|
7022
7648
|
" ",
|
|
7023
|
-
/* @__PURE__ */
|
|
7649
|
+
/* @__PURE__ */ jsx16("code", { children: f.url }),
|
|
7024
7650
|
" ",
|
|
7025
|
-
/* @__PURE__ */
|
|
7651
|
+
/* @__PURE__ */ jsx16("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
|
|
7026
7652
|
]
|
|
7027
7653
|
},
|
|
7028
7654
|
i
|
|
7029
7655
|
)) }) : null,
|
|
7030
|
-
showLearned && m.learned?.length ? /* @__PURE__ */
|
|
7031
|
-
/* @__PURE__ */
|
|
7656
|
+
showLearned && m.learned?.length ? /* @__PURE__ */ jsxs14("p", { className: "awr-learned", children: [
|
|
7657
|
+
/* @__PURE__ */ jsx16(BookIcon, { size: 12 }),
|
|
7032
7658
|
" ",
|
|
7033
7659
|
L.learnedNow(m.learned.join(", "))
|
|
7034
7660
|
] }) : null,
|
|
7035
|
-
showThoughts && m.reasoning?.trim() && /* @__PURE__ */
|
|
7036
|
-
/* @__PURE__ */
|
|
7037
|
-
/* @__PURE__ */
|
|
7661
|
+
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ jsxs14("details", { className: "awr-thought", children: [
|
|
7662
|
+
/* @__PURE__ */ jsxs14("summary", { children: [
|
|
7663
|
+
/* @__PURE__ */ jsx16(BrainIcon, { size: 13 }),
|
|
7038
7664
|
" ",
|
|
7039
7665
|
L.answerThoughts
|
|
7040
7666
|
] }),
|
|
7041
|
-
/* @__PURE__ */
|
|
7667
|
+
/* @__PURE__ */ jsx16("p", { className: "awr-thought__text", children: m.reasoning.trim() })
|
|
7042
7668
|
] })
|
|
7043
7669
|
] }),
|
|
7044
|
-
showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */
|
|
7045
|
-
showMedia && m.transcripts?.length ? /* @__PURE__ */
|
|
7046
|
-
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */
|
|
7670
|
+
showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__apps", children: m.apps.map((app) => /* @__PURE__ */ jsx16("div", { className: "awr-msg__app", children: renderApp(app, m) }, app.id)) }) : null,
|
|
7671
|
+
showMedia && m.transcripts?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ jsx16(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
|
|
7672
|
+
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ jsxs14("div", { className: "awr-msg__bubble", children: [
|
|
7047
7673
|
m.content ? renderContent ? renderContent(m) : m.content : null,
|
|
7048
|
-
m.pending && !m.content && /* @__PURE__ */
|
|
7674
|
+
m.pending && !m.content && /* @__PURE__ */ jsx16(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
|
|
7049
7675
|
] }),
|
|
7050
|
-
showMedia && m.media?.length ? /* @__PURE__ */
|
|
7051
|
-
const built = /* @__PURE__ */
|
|
7052
|
-
return renderMedia ? /* @__PURE__ */
|
|
7676
|
+
showMedia && m.media?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
7677
|
+
const built = /* @__PURE__ */ jsx16(GeneratedMedia, { media: item, files, labels }, i);
|
|
7678
|
+
return renderMedia ? /* @__PURE__ */ jsx16("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
7053
7679
|
}) }) : null,
|
|
7054
|
-
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */
|
|
7680
|
+
showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ jsx16(
|
|
7055
7681
|
FileChips,
|
|
7056
7682
|
{
|
|
7057
7683
|
written: m.writtenFiles,
|
|
@@ -7063,34 +7689,305 @@ var MessageList = ({
|
|
|
7063
7689
|
labels
|
|
7064
7690
|
}
|
|
7065
7691
|
) : null,
|
|
7066
|
-
m.attachments?.length ? /* @__PURE__ */
|
|
7067
|
-
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */
|
|
7692
|
+
m.attachments?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__attachments", "aria-label": L.attachments, children: m.attachments.map((a, i) => /* @__PURE__ */ jsx16("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ jsx16(AttachmentView, { attachment: a }) }, i)) }) : null,
|
|
7693
|
+
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ jsx16("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
7068
7694
|
] })
|
|
7069
7695
|
},
|
|
7070
7696
|
m.id
|
|
7071
7697
|
);
|
|
7072
|
-
return renderMessage ? /* @__PURE__ */
|
|
7073
|
-
}) });
|
|
7698
|
+
return renderMessage ? /* @__PURE__ */ jsx16("div", { children: renderMessage(m, node) }, m.id) : node;
|
|
7699
|
+
}) }) });
|
|
7074
7700
|
};
|
|
7075
7701
|
|
|
7076
7702
|
// src/components/ModelLoadBar.tsx
|
|
7077
|
-
import { jsx as
|
|
7703
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
7078
7704
|
var ModelLoadBar = ({ load, className }) => {
|
|
7079
7705
|
const pct = Math.round(Math.max(0, Math.min(1, load.progress)) * 100);
|
|
7080
|
-
return /* @__PURE__ */
|
|
7081
|
-
/* @__PURE__ */
|
|
7082
|
-
/* @__PURE__ */
|
|
7083
|
-
/* @__PURE__ */
|
|
7706
|
+
return /* @__PURE__ */ jsxs15("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
|
|
7707
|
+
/* @__PURE__ */ jsxs15("div", { className: "awr-modelload__head", children: [
|
|
7708
|
+
/* @__PURE__ */ jsx17("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
|
|
7709
|
+
/* @__PURE__ */ jsxs15("span", { className: "awr-modelload__pct", children: [
|
|
7084
7710
|
pct,
|
|
7085
7711
|
"%"
|
|
7086
7712
|
] })
|
|
7087
7713
|
] }),
|
|
7088
|
-
/* @__PURE__ */
|
|
7714
|
+
/* @__PURE__ */ jsx17("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ jsx17("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
|
|
7715
|
+
] });
|
|
7716
|
+
};
|
|
7717
|
+
|
|
7718
|
+
// src/components/QuestionPrompt.tsx
|
|
7719
|
+
import { useEffect as useEffect16, useId as useId2, useRef as useRef11, useState as useState16 } from "react";
|
|
7720
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
7721
|
+
var useNow2 = (active) => {
|
|
7722
|
+
const [now, setNow] = useState16(() => Date.now());
|
|
7723
|
+
useEffect16(() => {
|
|
7724
|
+
if (!active) return;
|
|
7725
|
+
setNow(Date.now());
|
|
7726
|
+
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
7727
|
+
return () => clearInterval(timer);
|
|
7728
|
+
}, [active]);
|
|
7729
|
+
return now;
|
|
7730
|
+
};
|
|
7731
|
+
var Expiry2 = ({ expiresAt, L }) => {
|
|
7732
|
+
const now = useNow2(true);
|
|
7733
|
+
return /* @__PURE__ */ jsx18("p", { className: "awr-question__expiry", children: L.questionExpiresIn(formatCountdown(expiresAt - now)) });
|
|
7734
|
+
};
|
|
7735
|
+
var reasonText2 = (q, L) => {
|
|
7736
|
+
const key = q.reason ?? q.status;
|
|
7737
|
+
return Object.hasOwn(L.questionReasons, key) ? L.questionReasons[key] : key;
|
|
7738
|
+
};
|
|
7739
|
+
var leadOf = (subagent, L) => subagent ? L.questionLeadHelper(previewValue(subagent.role ?? "", 60) || void 0, subagent.depth) : L.questionLead;
|
|
7740
|
+
var isTyping = (target) => target instanceof HTMLElement && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable);
|
|
7741
|
+
var QuestionCard = ({
|
|
7742
|
+
question: q,
|
|
7743
|
+
view,
|
|
7744
|
+
index,
|
|
7745
|
+
total,
|
|
7746
|
+
answer,
|
|
7747
|
+
showExpiry,
|
|
7748
|
+
showHelper,
|
|
7749
|
+
numberKeys,
|
|
7750
|
+
L
|
|
7751
|
+
}) => {
|
|
7752
|
+
const baseId = useId2();
|
|
7753
|
+
const textId = `${baseId}-q`;
|
|
7754
|
+
const otherId = `${baseId}-other`;
|
|
7755
|
+
const [picked, setPicked] = useState16([]);
|
|
7756
|
+
const [otherOpen, setOtherOpen] = useState16(false);
|
|
7757
|
+
const [otherText, setOtherText] = useState16("");
|
|
7758
|
+
const otherField = useRef11(null);
|
|
7759
|
+
const otherButton = useRef11(null);
|
|
7760
|
+
useEffect16(() => {
|
|
7761
|
+
if (otherOpen) otherField.current?.focus();
|
|
7762
|
+
}, [otherOpen]);
|
|
7763
|
+
const helper = showHelper && q.subagent ? { ...q.subagent, ...view?.subagent } : void 0;
|
|
7764
|
+
const choice = questionChoiceOf(q, picked);
|
|
7765
|
+
const other = questionOtherOf(q, otherText);
|
|
7766
|
+
const pick = (label) => {
|
|
7767
|
+
if (!q.multiple) {
|
|
7768
|
+
const one = questionChoiceOf(q, [label]);
|
|
7769
|
+
if (one) answer(one);
|
|
7770
|
+
return;
|
|
7771
|
+
}
|
|
7772
|
+
setPicked((p) => p.includes(label) ? p.filter((l) => l !== label) : [...p, label]);
|
|
7773
|
+
};
|
|
7774
|
+
const sendOther = (e) => {
|
|
7775
|
+
e.preventDefault();
|
|
7776
|
+
if (other) answer(other);
|
|
7777
|
+
};
|
|
7778
|
+
const onKeyDown = (e) => {
|
|
7779
|
+
if (!numberKeys || e.defaultPrevented || isTyping(e.target)) return;
|
|
7780
|
+
if (e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) return;
|
|
7781
|
+
const n = /^[1-9]$/.test(e.key) ? Number(e.key) : 0;
|
|
7782
|
+
const option = n ? q.options[n - 1] : void 0;
|
|
7783
|
+
if (!option) return;
|
|
7784
|
+
e.preventDefault();
|
|
7785
|
+
pick(option.label);
|
|
7786
|
+
};
|
|
7787
|
+
return /* @__PURE__ */ jsxs16(
|
|
7788
|
+
"section",
|
|
7789
|
+
{
|
|
7790
|
+
className: `awr-question${q.multiple ? " awr-question--multiple" : ""}${helper ? " awr-question--helper" : ""}`,
|
|
7791
|
+
role: "group",
|
|
7792
|
+
"aria-labelledby": textId,
|
|
7793
|
+
"data-question": q.id,
|
|
7794
|
+
"data-subagent": helper?.id,
|
|
7795
|
+
onKeyDown,
|
|
7796
|
+
children: [
|
|
7797
|
+
/* @__PURE__ */ jsxs16("div", { className: "awr-question__head", children: [
|
|
7798
|
+
/* @__PURE__ */ jsx18(QuestionIcon, { size: 16, className: "awr-question__icon" }),
|
|
7799
|
+
/* @__PURE__ */ jsx18("span", { className: "awr-question__lead", role: "alert", children: leadOf(helper, L) }),
|
|
7800
|
+
total > 1 && /* @__PURE__ */ jsx18("span", { className: "awr-question__count", children: L.questionCount(index, total) })
|
|
7801
|
+
] }),
|
|
7802
|
+
/* @__PURE__ */ jsx18("p", { className: "awr-question__text", id: textId, children: q.question }),
|
|
7803
|
+
q.multiple && /* @__PURE__ */ jsx18("p", { className: "awr-question__hint", children: L.questionSeveral }),
|
|
7804
|
+
/* @__PURE__ */ jsx18("div", { className: "awr-question__options", children: q.options.map((o, i) => {
|
|
7805
|
+
const on = picked.includes(o.label);
|
|
7806
|
+
return /* @__PURE__ */ jsxs16(
|
|
7807
|
+
"button",
|
|
7808
|
+
{
|
|
7809
|
+
type: "button",
|
|
7810
|
+
className: `awr-question__option${on ? " is-picked" : ""}`,
|
|
7811
|
+
"data-option": i + 1,
|
|
7812
|
+
"aria-pressed": q.multiple ? on : void 0,
|
|
7813
|
+
"aria-keyshortcuts": numberKeys && i < 9 ? String(i + 1) : void 0,
|
|
7814
|
+
onClick: () => pick(o.label),
|
|
7815
|
+
children: [
|
|
7816
|
+
numberKeys && i < 9 && /* @__PURE__ */ jsx18("span", { className: "awr-question__key", "aria-hidden": "true", children: i + 1 }),
|
|
7817
|
+
/* @__PURE__ */ jsxs16("span", { className: "awr-question__body", children: [
|
|
7818
|
+
/* @__PURE__ */ jsx18("span", { className: "awr-question__label", children: o.label }),
|
|
7819
|
+
o.description && /* @__PURE__ */ jsx18("span", { className: "awr-question__desc", children: o.description })
|
|
7820
|
+
] }),
|
|
7821
|
+
q.multiple && /* @__PURE__ */ jsx18("span", { className: "awr-question__mark", "aria-hidden": "true", children: on && /* @__PURE__ */ jsx18(CheckIcon, { size: 14 }) })
|
|
7822
|
+
]
|
|
7823
|
+
},
|
|
7824
|
+
o.label
|
|
7825
|
+
);
|
|
7826
|
+
}) }),
|
|
7827
|
+
q.allowOther && otherOpen && /* @__PURE__ */ jsxs16("form", { className: "awr-question__other", onSubmit: sendOther, children: [
|
|
7828
|
+
/* @__PURE__ */ jsx18("label", { className: "awr-question__otherlabel", htmlFor: otherId, children: L.questionOtherLabel }),
|
|
7829
|
+
/* @__PURE__ */ jsxs16("div", { className: "awr-question__otherrow", children: [
|
|
7830
|
+
/* @__PURE__ */ jsx18(
|
|
7831
|
+
"input",
|
|
7832
|
+
{
|
|
7833
|
+
ref: otherField,
|
|
7834
|
+
id: otherId,
|
|
7835
|
+
className: "awr-question__input",
|
|
7836
|
+
type: "text",
|
|
7837
|
+
value: otherText,
|
|
7838
|
+
autoComplete: "off",
|
|
7839
|
+
onChange: (e) => setOtherText(e.target.value),
|
|
7840
|
+
onKeyDown: (e) => {
|
|
7841
|
+
if (e.key !== "Escape") return;
|
|
7842
|
+
e.preventDefault();
|
|
7843
|
+
e.stopPropagation();
|
|
7844
|
+
setOtherOpen(false);
|
|
7845
|
+
otherButton.current?.focus();
|
|
7846
|
+
}
|
|
7847
|
+
}
|
|
7848
|
+
),
|
|
7849
|
+
/* @__PURE__ */ jsx18("button", { type: "submit", className: "awr-btn awr-btn--primary", disabled: !other, children: L.questionSend })
|
|
7850
|
+
] })
|
|
7851
|
+
] }),
|
|
7852
|
+
/* @__PURE__ */ jsxs16("div", { className: "awr-question__actions", children: [
|
|
7853
|
+
q.multiple && !otherOpen && /* @__PURE__ */ jsx18(
|
|
7854
|
+
"button",
|
|
7855
|
+
{
|
|
7856
|
+
type: "button",
|
|
7857
|
+
className: "awr-btn awr-btn--primary",
|
|
7858
|
+
disabled: !choice,
|
|
7859
|
+
onClick: () => choice && answer(choice),
|
|
7860
|
+
children: L.questionSend
|
|
7861
|
+
}
|
|
7862
|
+
),
|
|
7863
|
+
q.allowOther && /* @__PURE__ */ jsx18(
|
|
7864
|
+
"button",
|
|
7865
|
+
{
|
|
7866
|
+
ref: otherButton,
|
|
7867
|
+
type: "button",
|
|
7868
|
+
className: "awr-btn",
|
|
7869
|
+
"aria-expanded": otherOpen,
|
|
7870
|
+
"aria-controls": otherOpen ? otherId : void 0,
|
|
7871
|
+
onClick: () => setOtherOpen((o) => !o),
|
|
7872
|
+
children: L.questionOther
|
|
7873
|
+
}
|
|
7874
|
+
),
|
|
7875
|
+
/* @__PURE__ */ jsx18(
|
|
7876
|
+
"button",
|
|
7877
|
+
{
|
|
7878
|
+
type: "button",
|
|
7879
|
+
className: "awr-btn awr-btn--ghost",
|
|
7880
|
+
onClick: () => answer({ declined: true }),
|
|
7881
|
+
children: L.questionSkip
|
|
7882
|
+
}
|
|
7883
|
+
)
|
|
7884
|
+
] }),
|
|
7885
|
+
showExpiry && q.expiresAt !== void 0 && /* @__PURE__ */ jsx18(Expiry2, { expiresAt: q.expiresAt, L })
|
|
7886
|
+
]
|
|
7887
|
+
}
|
|
7888
|
+
);
|
|
7889
|
+
};
|
|
7890
|
+
var RemoteQuestion = ({ view, L }) => {
|
|
7891
|
+
const textId = `${useId2()}-q`;
|
|
7892
|
+
return /* @__PURE__ */ jsxs16(
|
|
7893
|
+
"section",
|
|
7894
|
+
{
|
|
7895
|
+
className: "awr-question awr-question--remote",
|
|
7896
|
+
role: "group",
|
|
7897
|
+
"aria-labelledby": textId,
|
|
7898
|
+
"data-question": view.id,
|
|
7899
|
+
children: [
|
|
7900
|
+
/* @__PURE__ */ jsxs16("div", { className: "awr-question__head", children: [
|
|
7901
|
+
/* @__PURE__ */ jsx18(QuestionIcon, { size: 16, className: "awr-question__icon" }),
|
|
7902
|
+
/* @__PURE__ */ jsx18("span", { className: "awr-question__lead", children: leadOf(view.subagent, L) })
|
|
7903
|
+
] }),
|
|
7904
|
+
/* @__PURE__ */ jsx18("p", { className: "awr-question__text", id: textId, children: view.question }),
|
|
7905
|
+
/* @__PURE__ */ jsx18("ul", { className: "awr-question__list", children: view.options.map((o) => /* @__PURE__ */ jsxs16("li", { children: [
|
|
7906
|
+
/* @__PURE__ */ jsx18("span", { className: "awr-question__label", children: o.label }),
|
|
7907
|
+
o.description && /* @__PURE__ */ jsx18("span", { className: "awr-question__desc", children: o.description })
|
|
7908
|
+
] }, o.label)) }),
|
|
7909
|
+
/* @__PURE__ */ jsx18("p", { className: "awr-question__remote", role: "status", children: L.questionRemote })
|
|
7910
|
+
]
|
|
7911
|
+
}
|
|
7912
|
+
);
|
|
7913
|
+
};
|
|
7914
|
+
var QuestionPrompt = ({
|
|
7915
|
+
questions,
|
|
7916
|
+
onAnswer,
|
|
7917
|
+
outcomes,
|
|
7918
|
+
showOutcomes = true,
|
|
7919
|
+
showExpiry = true,
|
|
7920
|
+
showHelper = true,
|
|
7921
|
+
showRemote = true,
|
|
7922
|
+
numberKeys = true,
|
|
7923
|
+
renderQuestion,
|
|
7924
|
+
labels,
|
|
7925
|
+
className
|
|
7926
|
+
}) => {
|
|
7927
|
+
const L = useLabels(labels);
|
|
7928
|
+
const [dismissed, setDismissed] = useState16(() => /* @__PURE__ */ new Set());
|
|
7929
|
+
const automatic = showOutcomes ? (outcomes ?? []).filter(
|
|
7930
|
+
(o) => o.automatic === true && o.status !== "pending" && o.status !== "stopped" && !dismissed.has(o.id)
|
|
7931
|
+
) : [];
|
|
7932
|
+
const remote = showRemote ? (outcomes ?? []).filter((o) => o.remote && o.status === "pending") : [];
|
|
7933
|
+
const current = questions[0];
|
|
7934
|
+
if (!current && automatic.length === 0 && remote.length === 0) return null;
|
|
7935
|
+
let card = null;
|
|
7936
|
+
if (current) {
|
|
7937
|
+
const answer = (a) => onAnswer(current.id, a);
|
|
7938
|
+
const builtIn = /* @__PURE__ */ jsx18(
|
|
7939
|
+
QuestionCard,
|
|
7940
|
+
{
|
|
7941
|
+
question: current,
|
|
7942
|
+
view: outcomes?.find((o) => o.id === current.id),
|
|
7943
|
+
index: 1,
|
|
7944
|
+
total: questions.length,
|
|
7945
|
+
answer,
|
|
7946
|
+
showExpiry,
|
|
7947
|
+
showHelper,
|
|
7948
|
+
numberKeys,
|
|
7949
|
+
L
|
|
7950
|
+
},
|
|
7951
|
+
current.id
|
|
7952
|
+
);
|
|
7953
|
+
card = renderQuestion ? renderQuestion(current, builtIn, answer) : builtIn;
|
|
7954
|
+
}
|
|
7955
|
+
return /* @__PURE__ */ jsxs16("div", { className: ["awr-questions", className].filter(Boolean).join(" "), children: [
|
|
7956
|
+
automatic.map((o) => /* @__PURE__ */ jsxs16(
|
|
7957
|
+
"div",
|
|
7958
|
+
{
|
|
7959
|
+
className: "awr-question-outcome",
|
|
7960
|
+
role: "status",
|
|
7961
|
+
"data-reason": o.reason ?? o.status,
|
|
7962
|
+
children: [
|
|
7963
|
+
/* @__PURE__ */ jsx18(AlertIcon, { size: 14, className: "awr-question-outcome__icon" }),
|
|
7964
|
+
/* @__PURE__ */ jsxs16("span", { className: "awr-question-outcome__text", children: [
|
|
7965
|
+
L.questionAutomatic(reasonText2(o, L)),
|
|
7966
|
+
" ",
|
|
7967
|
+
/* @__PURE__ */ jsx18("q", { className: "awr-question-outcome__question", children: o.question })
|
|
7968
|
+
] }),
|
|
7969
|
+
/* @__PURE__ */ jsx18(
|
|
7970
|
+
"button",
|
|
7971
|
+
{
|
|
7972
|
+
type: "button",
|
|
7973
|
+
className: "awr-iconbtn awr-question-outcome__dismiss",
|
|
7974
|
+
"aria-label": L.questionDismiss,
|
|
7975
|
+
title: L.questionDismiss,
|
|
7976
|
+
onClick: () => setDismissed((d) => new Set(d).add(o.id)),
|
|
7977
|
+
children: /* @__PURE__ */ jsx18(XIcon, { size: 14 })
|
|
7978
|
+
}
|
|
7979
|
+
)
|
|
7980
|
+
]
|
|
7981
|
+
},
|
|
7982
|
+
o.id
|
|
7983
|
+
)),
|
|
7984
|
+
remote.map((o) => /* @__PURE__ */ jsx18(RemoteQuestion, { view: o, L }, o.id)),
|
|
7985
|
+
card
|
|
7089
7986
|
] });
|
|
7090
7987
|
};
|
|
7091
7988
|
|
|
7092
7989
|
// src/components/ToolApprovalPrompt.tsx
|
|
7093
|
-
import { jsx as
|
|
7990
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7094
7991
|
var SkillConsentCard = ({
|
|
7095
7992
|
approval: a,
|
|
7096
7993
|
skill,
|
|
@@ -7100,7 +7997,7 @@ var SkillConsentCard = ({
|
|
|
7100
7997
|
showPreview,
|
|
7101
7998
|
onApprove,
|
|
7102
7999
|
onDeny
|
|
7103
|
-
}) => /* @__PURE__ */
|
|
8000
|
+
}) => /* @__PURE__ */ jsxs17(
|
|
7104
8001
|
"div",
|
|
7105
8002
|
{
|
|
7106
8003
|
className: `awr-approval awr-approval--skill${helper ? " awr-approval--helper" : ""}`,
|
|
@@ -7108,28 +8005,28 @@ var SkillConsentCard = ({
|
|
|
7108
8005
|
"data-skill-server": skill.server,
|
|
7109
8006
|
"data-subagent": helper?.id,
|
|
7110
8007
|
children: [
|
|
7111
|
-
/* @__PURE__ */
|
|
7112
|
-
/* @__PURE__ */
|
|
7113
|
-
/* @__PURE__ */
|
|
8008
|
+
/* @__PURE__ */ jsxs17("div", { className: "awr-approval__head", children: [
|
|
8009
|
+
/* @__PURE__ */ jsx19(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
8010
|
+
/* @__PURE__ */ jsx19("span", { children: L.skillConsentLead(skill.server, skill.skill) })
|
|
7114
8011
|
] }),
|
|
7115
|
-
skill.description && /* @__PURE__ */
|
|
7116
|
-
/* @__PURE__ */
|
|
7117
|
-
/* @__PURE__ */
|
|
7118
|
-
/* @__PURE__ */
|
|
8012
|
+
skill.description && /* @__PURE__ */ jsx19("p", { className: "awr-approval__quote", children: skill.description }),
|
|
8013
|
+
/* @__PURE__ */ jsxs17("p", { className: "awr-approval__skillmeta", children: [
|
|
8014
|
+
/* @__PURE__ */ jsx19("code", { className: "awr-tool__name", children: skill.name }),
|
|
8015
|
+
/* @__PURE__ */ jsx19("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
|
|
7119
8016
|
] }),
|
|
7120
|
-
skill.byUri && /* @__PURE__ */
|
|
7121
|
-
skill.nestedIn && /* @__PURE__ */
|
|
7122
|
-
skill.dynamic && /* @__PURE__ */
|
|
7123
|
-
skill.dynamic && skill.noFileListing && /* @__PURE__ */
|
|
7124
|
-
showPreview && skill.body !== void 0 && /* @__PURE__ */
|
|
7125
|
-
/* @__PURE__ */
|
|
7126
|
-
/* @__PURE__ */
|
|
7127
|
-
skill.files.length > 0 && /* @__PURE__ */
|
|
8017
|
+
skill.byUri && /* @__PURE__ */ jsx19("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
|
|
8018
|
+
skill.nestedIn && /* @__PURE__ */ jsx19("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
|
|
8019
|
+
skill.dynamic && /* @__PURE__ */ jsx19("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
|
|
8020
|
+
skill.dynamic && skill.noFileListing && /* @__PURE__ */ jsx19("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
|
|
8021
|
+
showPreview && skill.body !== void 0 && /* @__PURE__ */ jsxs17("details", { className: "awr-approval__preview", children: [
|
|
8022
|
+
/* @__PURE__ */ jsx19("summary", { children: L.skillConsentPreview }),
|
|
8023
|
+
/* @__PURE__ */ jsx19("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
|
|
8024
|
+
skill.files.length > 0 && /* @__PURE__ */ jsx19("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
|
|
7128
8025
|
] }),
|
|
7129
|
-
/* @__PURE__ */
|
|
7130
|
-
/* @__PURE__ */
|
|
7131
|
-
/* @__PURE__ */
|
|
7132
|
-
allowRemember && /* @__PURE__ */
|
|
8026
|
+
/* @__PURE__ */ jsx19("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
|
|
8027
|
+
/* @__PURE__ */ jsxs17("div", { className: "awr-approval__actions", children: [
|
|
8028
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
|
|
8029
|
+
allowRemember && /* @__PURE__ */ jsx19(
|
|
7133
8030
|
"button",
|
|
7134
8031
|
{
|
|
7135
8032
|
type: "button",
|
|
@@ -7138,7 +8035,7 @@ var SkillConsentCard = ({
|
|
|
7138
8035
|
children: L.skillConsentAlways
|
|
7139
8036
|
}
|
|
7140
8037
|
),
|
|
7141
|
-
/* @__PURE__ */
|
|
8038
|
+
/* @__PURE__ */ jsx19(
|
|
7142
8039
|
"button",
|
|
7143
8040
|
{
|
|
7144
8041
|
type: "button",
|
|
@@ -7164,9 +8061,9 @@ var ToolApprovalPrompt = ({
|
|
|
7164
8061
|
}) => {
|
|
7165
8062
|
const L = useLabels(labels);
|
|
7166
8063
|
if (approvals.length === 0) return null;
|
|
7167
|
-
return /* @__PURE__ */
|
|
8064
|
+
return /* @__PURE__ */ jsx19("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
|
|
7168
8065
|
if (a.skill) {
|
|
7169
|
-
const card2 = /* @__PURE__ */
|
|
8066
|
+
const card2 = /* @__PURE__ */ jsx19(
|
|
7170
8067
|
SkillConsentCard,
|
|
7171
8068
|
{
|
|
7172
8069
|
approval: a,
|
|
@@ -7180,33 +8077,33 @@ var ToolApprovalPrompt = ({
|
|
|
7180
8077
|
},
|
|
7181
8078
|
a.id
|
|
7182
8079
|
);
|
|
7183
|
-
return renderApproval ? /* @__PURE__ */
|
|
8080
|
+
return renderApproval ? /* @__PURE__ */ jsx19("div", { children: renderApproval(a, card2) }, a.id) : card2;
|
|
7184
8081
|
}
|
|
7185
8082
|
const helper = showHelper ? a.subagent : void 0;
|
|
7186
8083
|
const app = a.app;
|
|
7187
|
-
const card = /* @__PURE__ */
|
|
8084
|
+
const card = /* @__PURE__ */ jsxs17(
|
|
7188
8085
|
"div",
|
|
7189
8086
|
{
|
|
7190
8087
|
className: `awr-approval${helper ? " awr-approval--helper" : ""}${app ? " awr-approval--app" : ""}`,
|
|
7191
8088
|
"data-subagent": helper?.id,
|
|
7192
8089
|
"data-app-server": app?.server,
|
|
7193
8090
|
children: [
|
|
7194
|
-
/* @__PURE__ */
|
|
7195
|
-
/* @__PURE__ */
|
|
7196
|
-
/* @__PURE__ */
|
|
8091
|
+
/* @__PURE__ */ jsxs17("div", { className: "awr-approval__head", children: [
|
|
8092
|
+
/* @__PURE__ */ jsx19(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
8093
|
+
/* @__PURE__ */ jsxs17("span", { children: [
|
|
7197
8094
|
app ? L.approvalLeadApp(app.server) : helper ? L.approvalLeadHelper(
|
|
7198
8095
|
previewValue(helper.role ?? "", 60) || void 0,
|
|
7199
8096
|
helper.depth
|
|
7200
8097
|
) : L.approvalLead,
|
|
7201
8098
|
" ",
|
|
7202
|
-
/* @__PURE__ */
|
|
8099
|
+
/* @__PURE__ */ jsx19("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
|
|
7203
8100
|
a.readOnly && !app ? ` (${L.readOnlyTool})` : ""
|
|
7204
8101
|
] })
|
|
7205
8102
|
] }),
|
|
7206
|
-
previewValue(a.input, 300) && /* @__PURE__ */
|
|
7207
|
-
app && /* @__PURE__ */
|
|
7208
|
-
/* @__PURE__ */
|
|
7209
|
-
/* @__PURE__ */
|
|
8103
|
+
previewValue(a.input, 300) && /* @__PURE__ */ jsx19("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
|
|
8104
|
+
app && /* @__PURE__ */ jsx19("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
|
|
8105
|
+
/* @__PURE__ */ jsxs17("div", { className: "awr-approval__actions", children: [
|
|
8106
|
+
/* @__PURE__ */ jsx19(
|
|
7210
8107
|
"button",
|
|
7211
8108
|
{
|
|
7212
8109
|
type: "button",
|
|
@@ -7215,7 +8112,7 @@ var ToolApprovalPrompt = ({
|
|
|
7215
8112
|
children: L.approve
|
|
7216
8113
|
}
|
|
7217
8114
|
),
|
|
7218
|
-
allowRemember && /* @__PURE__ */
|
|
8115
|
+
allowRemember && /* @__PURE__ */ jsx19(
|
|
7219
8116
|
"button",
|
|
7220
8117
|
{
|
|
7221
8118
|
type: "button",
|
|
@@ -7224,7 +8121,7 @@ var ToolApprovalPrompt = ({
|
|
|
7224
8121
|
children: L.alwaysAllow
|
|
7225
8122
|
}
|
|
7226
8123
|
),
|
|
7227
|
-
/* @__PURE__ */
|
|
8124
|
+
/* @__PURE__ */ jsx19(
|
|
7228
8125
|
"button",
|
|
7229
8126
|
{
|
|
7230
8127
|
type: "button",
|
|
@@ -7238,12 +8135,12 @@ var ToolApprovalPrompt = ({
|
|
|
7238
8135
|
},
|
|
7239
8136
|
a.id
|
|
7240
8137
|
);
|
|
7241
|
-
return renderApproval ? /* @__PURE__ */
|
|
8138
|
+
return renderApproval ? /* @__PURE__ */ jsx19("div", { children: renderApproval(a, card) }, a.id) : card;
|
|
7242
8139
|
}) });
|
|
7243
8140
|
};
|
|
7244
8141
|
|
|
7245
8142
|
// src/components/UsageBadge.tsx
|
|
7246
|
-
import { jsxs as
|
|
8143
|
+
import { jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7247
8144
|
var UsageBadge = ({
|
|
7248
8145
|
usage,
|
|
7249
8146
|
compact = false,
|
|
@@ -7269,7 +8166,7 @@ var UsageBadge = ({
|
|
|
7269
8166
|
mediaText,
|
|
7270
8167
|
decisions ? L.usageDecisions(decisions) : ""
|
|
7271
8168
|
].filter(Boolean).join(" \xB7 ");
|
|
7272
|
-
return /* @__PURE__ */
|
|
8169
|
+
return /* @__PURE__ */ jsxs18("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
|
|
7273
8170
|
formatTokens(usage.inputTokens),
|
|
7274
8171
|
"\u2191 ",
|
|
7275
8172
|
formatTokens(usage.outputTokens),
|
|
@@ -7282,13 +8179,13 @@ var UsageBadge = ({
|
|
|
7282
8179
|
};
|
|
7283
8180
|
|
|
7284
8181
|
// src/components/AgentChat.tsx
|
|
7285
|
-
import { Fragment as
|
|
8182
|
+
import { Fragment as Fragment11, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7286
8183
|
var usePrefersDark = () => {
|
|
7287
8184
|
const query = "(prefers-color-scheme: dark)";
|
|
7288
|
-
const [dark, setDark] =
|
|
8185
|
+
const [dark, setDark] = useState17(
|
|
7289
8186
|
() => typeof matchMedia === "function" && matchMedia(query).matches
|
|
7290
8187
|
);
|
|
7291
|
-
|
|
8188
|
+
useEffect17(() => {
|
|
7292
8189
|
if (typeof matchMedia !== "function") return;
|
|
7293
8190
|
const mq = matchMedia(query);
|
|
7294
8191
|
const on = () => setDark(mq.matches);
|
|
@@ -7299,7 +8196,7 @@ var usePrefersDark = () => {
|
|
|
7299
8196
|
};
|
|
7300
8197
|
var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
|
|
7301
8198
|
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
7302
|
-
var AgentChat = (props) => /* @__PURE__ */
|
|
8199
|
+
var AgentChat = (props) => /* @__PURE__ */ jsx20(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ jsx20(AgentChatInner, { ...props }) });
|
|
7303
8200
|
var NO_LABELS = {};
|
|
7304
8201
|
var AgentChatInner = ({
|
|
7305
8202
|
controller,
|
|
@@ -7327,11 +8224,13 @@ var AgentChatInner = ({
|
|
|
7327
8224
|
showContext = false,
|
|
7328
8225
|
activityOpen = false,
|
|
7329
8226
|
showElicitation = true,
|
|
8227
|
+
showQuestions = true,
|
|
7330
8228
|
showSkillPreview = true,
|
|
7331
8229
|
showOtherTabs = true,
|
|
7332
8230
|
elicitations,
|
|
7333
8231
|
onElicitationAnswer,
|
|
7334
8232
|
renderElicitation,
|
|
8233
|
+
renderQuestion,
|
|
7335
8234
|
history,
|
|
7336
8235
|
defaultHistoryOpen,
|
|
7337
8236
|
files,
|
|
@@ -7348,6 +8247,8 @@ var AgentChatInner = ({
|
|
|
7348
8247
|
renderFileContent,
|
|
7349
8248
|
renderApproval,
|
|
7350
8249
|
slots = {},
|
|
8250
|
+
imageViewer = true,
|
|
8251
|
+
renderImageViewer,
|
|
7351
8252
|
components = {},
|
|
7352
8253
|
theme = "auto",
|
|
7353
8254
|
classNames = {},
|
|
@@ -7374,7 +8275,7 @@ var AgentChatInner = ({
|
|
|
7374
8275
|
}
|
|
7375
8276
|
const L = useLabels();
|
|
7376
8277
|
const external = isHistoryHook(history) ? history : void 0;
|
|
7377
|
-
const [ownStore] =
|
|
8278
|
+
const [ownStore] = useState17(
|
|
7378
8279
|
() => history instanceof ChatHistoryStore ? history : new ChatHistoryStore()
|
|
7379
8280
|
);
|
|
7380
8281
|
const own = useChatHistory(agent, {
|
|
@@ -7382,20 +8283,20 @@ var AgentChatInner = ({
|
|
|
7382
8283
|
enabled: Boolean(history) && !external
|
|
7383
8284
|
});
|
|
7384
8285
|
const chats = history ? external ?? own : void 0;
|
|
7385
|
-
const rootRef =
|
|
7386
|
-
const [narrow, setNarrow] =
|
|
7387
|
-
|
|
8286
|
+
const rootRef = useRef12(null);
|
|
8287
|
+
const [narrow, setNarrow] = useState17(void 0);
|
|
8288
|
+
useEffect17(() => {
|
|
7388
8289
|
const el = rootRef.current;
|
|
7389
8290
|
if (!el || typeof ResizeObserver === "undefined") return setNarrow(false);
|
|
7390
|
-
const
|
|
7391
|
-
|
|
7392
|
-
const ro = new ResizeObserver(
|
|
8291
|
+
const measure2 = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
|
|
8292
|
+
measure2();
|
|
8293
|
+
const ro = new ResizeObserver(measure2);
|
|
7393
8294
|
ro.observe(el);
|
|
7394
8295
|
return () => ro.disconnect();
|
|
7395
8296
|
}, [narrowWidth]);
|
|
7396
|
-
const [historyChoice, setHistoryOpen] =
|
|
8297
|
+
const [historyChoice, setHistoryOpen] = useState17(defaultHistoryOpen);
|
|
7397
8298
|
const historyOpen = historyChoice ?? narrow === false;
|
|
7398
|
-
const [filesOpen, setFilesOpen] =
|
|
8299
|
+
const [filesOpen, setFilesOpen] = useState17(defaultFilesOpen);
|
|
7399
8300
|
const toggleHistory = () => {
|
|
7400
8301
|
setHistoryOpen(!historyOpen);
|
|
7401
8302
|
if (narrow && !historyOpen) setFilesOpen(false);
|
|
@@ -7408,19 +8309,22 @@ var AgentChatInner = ({
|
|
|
7408
8309
|
setFilesOpen(true);
|
|
7409
8310
|
if (narrow) setHistoryOpen(false);
|
|
7410
8311
|
};
|
|
7411
|
-
const
|
|
7412
|
-
const
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
8312
|
+
const overlayOpen = narrow === true && (Boolean(chats) && historyOpen || Boolean(files) && filesOpen);
|
|
8313
|
+
const closeOverlays = () => {
|
|
8314
|
+
setHistoryOpen(false);
|
|
8315
|
+
setFilesOpen(false);
|
|
8316
|
+
};
|
|
8317
|
+
useEffect17(() => {
|
|
8318
|
+
if (!overlayOpen) return;
|
|
8319
|
+
const onKey = (e) => {
|
|
8320
|
+
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
8321
|
+
setHistoryOpen(false);
|
|
8322
|
+
setFilesOpen(false);
|
|
8323
|
+
};
|
|
8324
|
+
document.addEventListener("keydown", onKey);
|
|
8325
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
8326
|
+
}, [overlayOpen]);
|
|
8327
|
+
const bodyRef = useRef12(null);
|
|
7424
8328
|
const appHost = useMcpAppHost({
|
|
7425
8329
|
connection: mcpApps,
|
|
7426
8330
|
approve: agent.approveAppToolCall,
|
|
@@ -7432,23 +8336,28 @@ var AgentChatInner = ({
|
|
|
7432
8336
|
});
|
|
7433
8337
|
const prefersDark = usePrefersDark();
|
|
7434
8338
|
const appTheme = theme === "auto" ? prefersDark ? "dark" : "light" : theme;
|
|
7435
|
-
const [panelApp, setPanelAppState] =
|
|
8339
|
+
const [panelApp, setPanelAppState] = useState17();
|
|
7436
8340
|
const setPanelApp = (app) => {
|
|
7437
8341
|
setPanelAppState(app);
|
|
7438
8342
|
onAppPanel?.(app);
|
|
7439
8343
|
};
|
|
7440
8344
|
const appsOn = showApps && Boolean(mcpApps);
|
|
8345
|
+
useFollowScroll(
|
|
8346
|
+
bodyRef,
|
|
8347
|
+
agent.messages.filter((m) => m.role === "user").length,
|
|
8348
|
+
agent.isRunning || agent.messages.some((m) => m.pending)
|
|
8349
|
+
);
|
|
7441
8350
|
const panelAllowed = appPanel !== false && appPanel !== null;
|
|
7442
8351
|
const panelTarget = typeof appPanel === "object" && appPanel ? appPanel : void 0;
|
|
7443
8352
|
const asSheet = !panelTarget && (appPanel === "sheet" || Boolean(narrow));
|
|
7444
|
-
|
|
8353
|
+
useEffect17(() => {
|
|
7445
8354
|
if (panelApp && !agent.messages.some((m) => m.apps?.some((a) => a.id === panelApp.id))) {
|
|
7446
8355
|
setPanelAppState(void 0);
|
|
7447
8356
|
onAppPanel?.(void 0);
|
|
7448
8357
|
}
|
|
7449
8358
|
}, [agent.messages, panelApp, onAppPanel]);
|
|
7450
8359
|
const drawApp = (app, message) => {
|
|
7451
|
-
const built = panelApp?.id === app.id ? /* @__PURE__ */
|
|
8360
|
+
const built = panelApp?.id === app.id ? /* @__PURE__ */ jsx20(
|
|
7452
8361
|
McpAppLine,
|
|
7453
8362
|
{
|
|
7454
8363
|
app,
|
|
@@ -7456,7 +8365,7 @@ var AgentChatInner = ({
|
|
|
7456
8365
|
action: L.appBringBack,
|
|
7457
8366
|
onAction: () => setPanelApp(void 0)
|
|
7458
8367
|
}
|
|
7459
|
-
) : /* @__PURE__ */
|
|
8368
|
+
) : /* @__PURE__ */ jsx20(
|
|
7460
8369
|
McpAppFrame,
|
|
7461
8370
|
{
|
|
7462
8371
|
app,
|
|
@@ -7469,7 +8378,7 @@ var AgentChatInner = ({
|
|
|
7469
8378
|
);
|
|
7470
8379
|
return renderApp ? renderApp(app, message, built) : built;
|
|
7471
8380
|
};
|
|
7472
|
-
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */
|
|
8381
|
+
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ jsx20(
|
|
7473
8382
|
McpAppFrame,
|
|
7474
8383
|
{
|
|
7475
8384
|
app: panelApp,
|
|
@@ -7481,7 +8390,7 @@ var AgentChatInner = ({
|
|
|
7481
8390
|
},
|
|
7482
8391
|
panelApp.id
|
|
7483
8392
|
) : null;
|
|
7484
|
-
const [compacting, setCompacting] =
|
|
8393
|
+
const [compacting, setCompacting] = useState17(false);
|
|
7485
8394
|
const compact = () => {
|
|
7486
8395
|
setCompacting(true);
|
|
7487
8396
|
void agent.compact().finally(() => setCompacting(false));
|
|
@@ -7492,9 +8401,10 @@ var AgentChatInner = ({
|
|
|
7492
8401
|
const Files = components.FilesPanel ?? FilesPanel;
|
|
7493
8402
|
const Approvals = components.ApprovalPrompt ?? ToolApprovalPrompt;
|
|
7494
8403
|
const Elicitations = components.ElicitationPrompt ?? ElicitationPrompt;
|
|
8404
|
+
const Questions = components.QuestionPrompt ?? QuestionPrompt;
|
|
7495
8405
|
const tabNotes = showOtherTabs ? [
|
|
7496
8406
|
agent.remote?.running && L.remoteRunning,
|
|
7497
|
-
agent.remote?.running && agent.approvals.some((a) => a.remote && a.status === "pending") && L.remoteWaitingConsent,
|
|
8407
|
+
agent.remote?.running && (agent.approvals.some((a) => a.remote && a.status === "pending") || (agent.questions ?? []).some((q) => q.remote && q.status === "pending")) && L.remoteWaitingConsent,
|
|
7498
8408
|
agent.remote?.ended === "gone" && L.remoteGone,
|
|
7499
8409
|
agent.sessionBusy && L.sessionBusy(agent.sessionBusy.heldBy)
|
|
7500
8410
|
].filter((t) => typeof t === "string") : [];
|
|
@@ -7502,18 +8412,18 @@ var AgentChatInner = ({
|
|
|
7502
8412
|
const showReplan = agent.replan && agent.replan.mode !== "continue";
|
|
7503
8413
|
const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
|
|
7504
8414
|
const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
|
|
7505
|
-
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */
|
|
7506
|
-
agent.planThought.trim() && /* @__PURE__ */
|
|
7507
|
-
/* @__PURE__ */
|
|
7508
|
-
/* @__PURE__ */
|
|
8415
|
+
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
8416
|
+
agent.planThought.trim() && /* @__PURE__ */ jsxs19("details", { className: "awr-activity__plan", children: [
|
|
8417
|
+
/* @__PURE__ */ jsx20("summary", { children: L.planned }),
|
|
8418
|
+
/* @__PURE__ */ jsx20("p", { className: "awr-activity__thought", children: agent.planThought })
|
|
7509
8419
|
] }),
|
|
7510
|
-
showReplan && /* @__PURE__ */
|
|
7511
|
-
replanFailedEarly && /* @__PURE__ */
|
|
7512
|
-
/* @__PURE__ */
|
|
8420
|
+
showReplan && /* @__PURE__ */ jsx20("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
|
|
8421
|
+
replanFailedEarly && /* @__PURE__ */ jsxs19("p", { className: "awr-step__warn", title: agent.replan.error, children: [
|
|
8422
|
+
/* @__PURE__ */ jsx20(AlertIcon, { size: 12 }),
|
|
7513
8423
|
" ",
|
|
7514
8424
|
L.replanFailed
|
|
7515
8425
|
] }),
|
|
7516
|
-
earlyDecisions.map((d, i) => /* @__PURE__ */
|
|
8426
|
+
earlyDecisions.map((d, i) => /* @__PURE__ */ jsx20(
|
|
7517
8427
|
"p",
|
|
7518
8428
|
{
|
|
7519
8429
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -7522,8 +8432,8 @@ var AgentChatInner = ({
|
|
|
7522
8432
|
i
|
|
7523
8433
|
))
|
|
7524
8434
|
] }) : void 0;
|
|
7525
|
-
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */
|
|
7526
|
-
chats && /* @__PURE__ */
|
|
8435
|
+
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ jsxs19("div", { className: cx("awr-chat__header", classNames.header), children: [
|
|
8436
|
+
chats && /* @__PURE__ */ jsx20(
|
|
7527
8437
|
"button",
|
|
7528
8438
|
{
|
|
7529
8439
|
type: "button",
|
|
@@ -7532,17 +8442,17 @@ var AgentChatInner = ({
|
|
|
7532
8442
|
title: L.showHistory,
|
|
7533
8443
|
"aria-pressed": historyOpen,
|
|
7534
8444
|
onClick: toggleHistory,
|
|
7535
|
-
children: /* @__PURE__ */
|
|
8445
|
+
children: /* @__PURE__ */ jsx20(HistoryIcon, { size: 16 })
|
|
7536
8446
|
}
|
|
7537
8447
|
),
|
|
7538
8448
|
slots.headerStart,
|
|
7539
|
-
/* @__PURE__ */
|
|
7540
|
-
showStatus && /* @__PURE__ */
|
|
7541
|
-
/* @__PURE__ */
|
|
7542
|
-
/* @__PURE__ */
|
|
8449
|
+
/* @__PURE__ */ jsx20("div", { className: "awr-chat__title", children: title }),
|
|
8450
|
+
showStatus && /* @__PURE__ */ jsxs19("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
|
|
8451
|
+
/* @__PURE__ */ jsx20("span", { className: "awr-status__dot" }),
|
|
8452
|
+
/* @__PURE__ */ jsx20("span", { className: "awr-status__text", children: L.status[agent.status] })
|
|
7543
8453
|
] }),
|
|
7544
|
-
showTotalUsage && /* @__PURE__ */
|
|
7545
|
-
files && /* @__PURE__ */
|
|
8454
|
+
showTotalUsage && /* @__PURE__ */ jsx20("span", { title: L.totalUsage, children: /* @__PURE__ */ jsx20(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
|
|
8455
|
+
files && /* @__PURE__ */ jsx20(
|
|
7546
8456
|
"button",
|
|
7547
8457
|
{
|
|
7548
8458
|
type: "button",
|
|
@@ -7551,12 +8461,12 @@ var AgentChatInner = ({
|
|
|
7551
8461
|
title: L.showFiles,
|
|
7552
8462
|
"aria-pressed": filesOpen,
|
|
7553
8463
|
onClick: toggleFiles,
|
|
7554
|
-
children: /* @__PURE__ */
|
|
8464
|
+
children: /* @__PURE__ */ jsx20(FileIcon, { size: 16 })
|
|
7555
8465
|
}
|
|
7556
8466
|
),
|
|
7557
8467
|
slots.headerEnd
|
|
7558
8468
|
] });
|
|
7559
|
-
return /* @__PURE__ */
|
|
8469
|
+
return /* @__PURE__ */ jsxs19(
|
|
7560
8470
|
"div",
|
|
7561
8471
|
{
|
|
7562
8472
|
ref: rootRef,
|
|
@@ -7564,8 +8474,16 @@ var AgentChatInner = ({
|
|
|
7564
8474
|
style,
|
|
7565
8475
|
"data-awr-theme": theme === "auto" ? void 0 : theme,
|
|
7566
8476
|
children: [
|
|
7567
|
-
|
|
7568
|
-
|
|
8477
|
+
overlayOpen && /* @__PURE__ */ jsx20(
|
|
8478
|
+
"div",
|
|
8479
|
+
{
|
|
8480
|
+
className: cx("awr-chat__scrim", classNames.scrim),
|
|
8481
|
+
"aria-hidden": "true",
|
|
8482
|
+
onClick: closeOverlays
|
|
8483
|
+
}
|
|
8484
|
+
),
|
|
8485
|
+
chats && historyOpen && /* @__PURE__ */ jsxs19("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
|
|
8486
|
+
/* @__PURE__ */ jsx20(
|
|
7569
8487
|
HistoryList,
|
|
7570
8488
|
{
|
|
7571
8489
|
history: {
|
|
@@ -7584,7 +8502,7 @@ var AgentChatInner = ({
|
|
|
7584
8502
|
}
|
|
7585
8503
|
),
|
|
7586
8504
|
slots.sidebar,
|
|
7587
|
-
/* @__PURE__ */
|
|
8505
|
+
/* @__PURE__ */ jsx20(
|
|
7588
8506
|
"button",
|
|
7589
8507
|
{
|
|
7590
8508
|
type: "button",
|
|
@@ -7595,91 +8513,91 @@ var AgentChatInner = ({
|
|
|
7595
8513
|
}
|
|
7596
8514
|
)
|
|
7597
8515
|
] }),
|
|
7598
|
-
/* @__PURE__ */
|
|
8516
|
+
/* @__PURE__ */ jsxs19("div", { className: cx("awr-chat__main", classNames.main), children: [
|
|
7599
8517
|
header,
|
|
7600
|
-
/* @__PURE__ */
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
),
|
|
7679
|
-
/* @__PURE__ */
|
|
8518
|
+
/* @__PURE__ */ jsxs19("div", { className: cx("awr-chat__body", classNames.body), ref: bodyRef, children: [
|
|
8519
|
+
slots.beforeMessages,
|
|
8520
|
+
/* @__PURE__ */ jsx20(
|
|
8521
|
+
Messages,
|
|
8522
|
+
{
|
|
8523
|
+
messages: agent.messages,
|
|
8524
|
+
empty: emptyState ?? L.emptyState,
|
|
8525
|
+
showActivity,
|
|
8526
|
+
showToolCalls,
|
|
8527
|
+
showUsage,
|
|
8528
|
+
showThoughts,
|
|
8529
|
+
showNotes,
|
|
8530
|
+
showLearned,
|
|
8531
|
+
showTiers,
|
|
8532
|
+
showReplanFailed,
|
|
8533
|
+
showDecisions,
|
|
8534
|
+
showSearchResults,
|
|
8535
|
+
showSubagents,
|
|
8536
|
+
showMedia,
|
|
8537
|
+
showFileChips,
|
|
8538
|
+
files,
|
|
8539
|
+
htmlPreview,
|
|
8540
|
+
onShowFiles: files ? showFiles : void 0,
|
|
8541
|
+
renderFile,
|
|
8542
|
+
renderFileContent,
|
|
8543
|
+
renderMedia,
|
|
8544
|
+
renderSubagent,
|
|
8545
|
+
onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
|
|
8546
|
+
activityOpen,
|
|
8547
|
+
liveExtra,
|
|
8548
|
+
renderContent,
|
|
8549
|
+
renderMessage,
|
|
8550
|
+
renderAttachment,
|
|
8551
|
+
renderToolCall,
|
|
8552
|
+
showApps: appsOn,
|
|
8553
|
+
renderApp: appsOn ? drawApp : void 0,
|
|
8554
|
+
imageViewer,
|
|
8555
|
+
renderImageViewer
|
|
8556
|
+
}
|
|
8557
|
+
),
|
|
8558
|
+
/* @__PURE__ */ jsx20(
|
|
8559
|
+
Approvals,
|
|
8560
|
+
{
|
|
8561
|
+
approvals: agent.pendingApprovals,
|
|
8562
|
+
onApprove: agent.approve,
|
|
8563
|
+
onDeny: agent.deny,
|
|
8564
|
+
showSkillPreview,
|
|
8565
|
+
renderApproval
|
|
8566
|
+
}
|
|
8567
|
+
),
|
|
8568
|
+
showQuestions && /* @__PURE__ */ jsx20(
|
|
8569
|
+
Questions,
|
|
8570
|
+
{
|
|
8571
|
+
questions: agent.pendingQuestions ?? [],
|
|
8572
|
+
onAnswer: (id, answer) => agent.answerQuestion?.(id, answer),
|
|
8573
|
+
outcomes: agent.questions,
|
|
8574
|
+
renderQuestion
|
|
8575
|
+
}
|
|
8576
|
+
),
|
|
8577
|
+
appsOn && /* @__PURE__ */ jsx20(
|
|
8578
|
+
AppRequestPrompt,
|
|
8579
|
+
{
|
|
8580
|
+
requests: appHost.requests,
|
|
8581
|
+
onAnswer: appHost.answer,
|
|
8582
|
+
renderRequest: renderAppRequest
|
|
8583
|
+
}
|
|
8584
|
+
),
|
|
8585
|
+
showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ jsx20(
|
|
8586
|
+
Elicitations,
|
|
8587
|
+
{
|
|
8588
|
+
elicitations,
|
|
8589
|
+
onAnswer: onElicitationAnswer,
|
|
8590
|
+
outcomes: agent.elicitations,
|
|
8591
|
+
renderElicitation
|
|
8592
|
+
}
|
|
8593
|
+
),
|
|
8594
|
+
agent.modelLoad && loading && /* @__PURE__ */ jsx20(ModelLoadBar, { load: agent.modelLoad }),
|
|
8595
|
+
slots.afterMessages
|
|
8596
|
+
] }),
|
|
8597
|
+
/* @__PURE__ */ jsxs19("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
7680
8598
|
slots.footerStart,
|
|
7681
|
-
tabNotes.length > 0 && /* @__PURE__ */
|
|
7682
|
-
showContext !== false && /* @__PURE__ */
|
|
8599
|
+
tabNotes.length > 0 && /* @__PURE__ */ jsx20("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text) => /* @__PURE__ */ jsx20("p", { className: "awr-tabnote__text", children: text }, text)) }),
|
|
8600
|
+
showContext !== false && /* @__PURE__ */ jsx20(
|
|
7683
8601
|
ContextMeter,
|
|
7684
8602
|
{
|
|
7685
8603
|
usage: agent.usage,
|
|
@@ -7690,11 +8608,11 @@ var AgentChatInner = ({
|
|
|
7690
8608
|
compacting
|
|
7691
8609
|
}
|
|
7692
8610
|
),
|
|
7693
|
-
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */
|
|
7694
|
-
/* @__PURE__ */
|
|
8611
|
+
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ jsxs19("div", { className: "awr-chat__error", children: [
|
|
8612
|
+
/* @__PURE__ */ jsx20(AlertIcon, { size: 14 }),
|
|
7695
8613
|
" ",
|
|
7696
8614
|
agent.error
|
|
7697
|
-
] }) : /* @__PURE__ */
|
|
8615
|
+
] }) : /* @__PURE__ */ jsx20(
|
|
7698
8616
|
Composer2,
|
|
7699
8617
|
{
|
|
7700
8618
|
controller: agent,
|
|
@@ -7710,8 +8628,8 @@ var AgentChatInner = ({
|
|
|
7710
8628
|
] }),
|
|
7711
8629
|
appPanelNode && (panelTarget ? (
|
|
7712
8630
|
// Outside the chat: the theme tokens come with it.
|
|
7713
|
-
|
|
7714
|
-
/* @__PURE__ */
|
|
8631
|
+
createPortal2(
|
|
8632
|
+
/* @__PURE__ */ jsx20(
|
|
7715
8633
|
"div",
|
|
7716
8634
|
{
|
|
7717
8635
|
className: "awr-theme awr-apppanel",
|
|
@@ -7721,24 +8639,24 @@ var AgentChatInner = ({
|
|
|
7721
8639
|
),
|
|
7722
8640
|
panelTarget
|
|
7723
8641
|
)
|
|
7724
|
-
) : asSheet ? /* @__PURE__ */
|
|
7725
|
-
/* @__PURE__ */
|
|
7726
|
-
/* @__PURE__ */
|
|
8642
|
+
) : asSheet ? /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
8643
|
+
/* @__PURE__ */ jsx20("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
|
|
8644
|
+
/* @__PURE__ */ jsxs19(
|
|
7727
8645
|
"aside",
|
|
7728
8646
|
{
|
|
7729
8647
|
className: "awr-chat__appsheet",
|
|
7730
8648
|
role: "dialog",
|
|
7731
8649
|
"aria-label": L.appFrom(panelApp.server),
|
|
7732
8650
|
children: [
|
|
7733
|
-
/* @__PURE__ */
|
|
8651
|
+
/* @__PURE__ */ jsx20("div", { className: "awr-sheet__grab" }),
|
|
7734
8652
|
appPanelNode
|
|
7735
8653
|
]
|
|
7736
8654
|
}
|
|
7737
8655
|
)
|
|
7738
|
-
] }) : /* @__PURE__ */
|
|
7739
|
-
files && filesOpen && /* @__PURE__ */
|
|
7740
|
-
/* @__PURE__ */
|
|
7741
|
-
/* @__PURE__ */
|
|
8656
|
+
] }) : /* @__PURE__ */ jsx20("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
|
|
8657
|
+
files && filesOpen && /* @__PURE__ */ jsxs19("aside", { className: cx("awr-chat__files", classNames.files), children: [
|
|
8658
|
+
/* @__PURE__ */ jsx20(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ jsx20(Files, { files }) }),
|
|
8659
|
+
/* @__PURE__ */ jsx20(
|
|
7742
8660
|
"button",
|
|
7743
8661
|
{
|
|
7744
8662
|
type: "button",
|
|
@@ -7755,7 +8673,7 @@ var AgentChatInner = ({
|
|
|
7755
8673
|
};
|
|
7756
8674
|
|
|
7757
8675
|
// src/components/LearnedSkills.tsx
|
|
7758
|
-
import { jsx as
|
|
8676
|
+
import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7759
8677
|
var LearnedSkills = ({
|
|
7760
8678
|
controller,
|
|
7761
8679
|
lessons,
|
|
@@ -7771,18 +8689,18 @@ var LearnedSkills = ({
|
|
|
7771
8689
|
const c = controller ?? ctx;
|
|
7772
8690
|
const list = lessons ?? c?.learned ?? [];
|
|
7773
8691
|
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
7774
|
-
return /* @__PURE__ */
|
|
7775
|
-
!hideTitle && /* @__PURE__ */
|
|
7776
|
-
/* @__PURE__ */
|
|
8692
|
+
return /* @__PURE__ */ jsxs20("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
8693
|
+
!hideTitle && /* @__PURE__ */ jsxs20("h3", { className: "awr-notebook__title", children: [
|
|
8694
|
+
/* @__PURE__ */ jsx21(BookIcon, { size: 14 }),
|
|
7777
8695
|
" ",
|
|
7778
8696
|
L.notebookTitle,
|
|
7779
|
-
list.length > 0 && /* @__PURE__ */
|
|
8697
|
+
list.length > 0 && /* @__PURE__ */ jsx21("span", { className: "awr-notebook__count", children: list.length })
|
|
7780
8698
|
] }),
|
|
7781
|
-
list.length === 0 ? /* @__PURE__ */
|
|
7782
|
-
/* @__PURE__ */
|
|
7783
|
-
/* @__PURE__ */
|
|
7784
|
-
l.revision > 1 && /* @__PURE__ */
|
|
7785
|
-
forget && /* @__PURE__ */
|
|
8699
|
+
list.length === 0 ? /* @__PURE__ */ jsx21("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ jsx21("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ jsxs20("li", { className: "awr-lesson", children: [
|
|
8700
|
+
/* @__PURE__ */ jsxs20("div", { className: "awr-lesson__head", children: [
|
|
8701
|
+
/* @__PURE__ */ jsx21("code", { className: "awr-lesson__name", children: l.name }),
|
|
8702
|
+
l.revision > 1 && /* @__PURE__ */ jsx21("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
8703
|
+
forget && /* @__PURE__ */ jsx21(
|
|
7786
8704
|
"button",
|
|
7787
8705
|
{
|
|
7788
8706
|
type: "button",
|
|
@@ -7790,12 +8708,12 @@ var LearnedSkills = ({
|
|
|
7790
8708
|
title: `${L.notebookForget}: ${l.name}`,
|
|
7791
8709
|
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
7792
8710
|
onClick: () => void forget(l.name),
|
|
7793
|
-
children: /* @__PURE__ */
|
|
8711
|
+
children: /* @__PURE__ */ jsx21(XIcon, { size: 12 })
|
|
7794
8712
|
}
|
|
7795
8713
|
)
|
|
7796
8714
|
] }),
|
|
7797
|
-
/* @__PURE__ */
|
|
7798
|
-
showSources && l.sources.length > 0 && /* @__PURE__ */
|
|
8715
|
+
/* @__PURE__ */ jsx21("p", { className: "awr-lesson__when", children: l.description }),
|
|
8716
|
+
showSources && l.sources.length > 0 && /* @__PURE__ */ jsxs20("p", { className: "awr-lesson__from", children: [
|
|
7799
8717
|
L.notebookFrom,
|
|
7800
8718
|
" ",
|
|
7801
8719
|
l.sources.join(", ")
|
|
@@ -7805,8 +8723,8 @@ var LearnedSkills = ({
|
|
|
7805
8723
|
};
|
|
7806
8724
|
|
|
7807
8725
|
// src/components/Composer.tsx
|
|
7808
|
-
import { useState as
|
|
7809
|
-
import { jsx as
|
|
8726
|
+
import { useState as useState18 } from "react";
|
|
8727
|
+
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7810
8728
|
var Composer = ({
|
|
7811
8729
|
onSubmit,
|
|
7812
8730
|
busy = false,
|
|
@@ -7815,7 +8733,7 @@ var Composer = ({
|
|
|
7815
8733
|
placeholder = "Ask the agent to do something\u2026",
|
|
7816
8734
|
className
|
|
7817
8735
|
}) => {
|
|
7818
|
-
const [text, setText] =
|
|
8736
|
+
const [text, setText] = useState18("");
|
|
7819
8737
|
const submit = () => {
|
|
7820
8738
|
const value = text.trim();
|
|
7821
8739
|
if (!value || busy || disabled) return;
|
|
@@ -7828,7 +8746,7 @@ var Composer = ({
|
|
|
7828
8746
|
submit();
|
|
7829
8747
|
}
|
|
7830
8748
|
};
|
|
7831
|
-
return /* @__PURE__ */
|
|
8749
|
+
return /* @__PURE__ */ jsxs21(
|
|
7832
8750
|
"form",
|
|
7833
8751
|
{
|
|
7834
8752
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -7837,7 +8755,7 @@ var Composer = ({
|
|
|
7837
8755
|
submit();
|
|
7838
8756
|
},
|
|
7839
8757
|
children: [
|
|
7840
|
-
/* @__PURE__ */
|
|
8758
|
+
/* @__PURE__ */ jsx22(
|
|
7841
8759
|
"textarea",
|
|
7842
8760
|
{
|
|
7843
8761
|
className: "awr-composer__input",
|
|
@@ -7849,23 +8767,23 @@ var Composer = ({
|
|
|
7849
8767
|
rows: 1
|
|
7850
8768
|
}
|
|
7851
8769
|
),
|
|
7852
|
-
busy ? /* @__PURE__ */
|
|
8770
|
+
busy ? /* @__PURE__ */ jsx22(
|
|
7853
8771
|
"button",
|
|
7854
8772
|
{
|
|
7855
8773
|
type: "button",
|
|
7856
8774
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
7857
8775
|
onClick: onStop,
|
|
7858
8776
|
"aria-label": "Stop",
|
|
7859
|
-
children: /* @__PURE__ */
|
|
8777
|
+
children: /* @__PURE__ */ jsx22(StopIcon, { size: 18 })
|
|
7860
8778
|
}
|
|
7861
|
-
) : /* @__PURE__ */
|
|
8779
|
+
) : /* @__PURE__ */ jsx22(
|
|
7862
8780
|
"button",
|
|
7863
8781
|
{
|
|
7864
8782
|
type: "submit",
|
|
7865
8783
|
className: "awr-composer__btn",
|
|
7866
8784
|
disabled: disabled || !text.trim(),
|
|
7867
8785
|
"aria-label": "Send",
|
|
7868
|
-
children: disabled ? /* @__PURE__ */
|
|
8786
|
+
children: disabled ? /* @__PURE__ */ jsx22(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ jsx22(SendIcon, { size: 18 })
|
|
7869
8787
|
}
|
|
7870
8788
|
)
|
|
7871
8789
|
]
|
|
@@ -7874,17 +8792,17 @@ var Composer = ({
|
|
|
7874
8792
|
};
|
|
7875
8793
|
|
|
7876
8794
|
// src/components/PlanView.tsx
|
|
7877
|
-
import { jsx as
|
|
8795
|
+
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7878
8796
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
7879
8797
|
if (!plan.steps.length && !plan.thought) return null;
|
|
7880
|
-
return /* @__PURE__ */
|
|
7881
|
-
showThought && plan.thought.trim() && /* @__PURE__ */
|
|
7882
|
-
plan.steps.length > 0 && /* @__PURE__ */
|
|
8798
|
+
return /* @__PURE__ */ jsxs22("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
8799
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ jsx23("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
8800
|
+
plan.steps.length > 0 && /* @__PURE__ */ jsx23("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ jsx23("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
7883
8801
|
] });
|
|
7884
8802
|
};
|
|
7885
8803
|
|
|
7886
8804
|
// src/components/ApprovalModeSwitch.tsx
|
|
7887
|
-
import { jsx as
|
|
8805
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
7888
8806
|
var DEFAULT_LABELS = {
|
|
7889
8807
|
autopilot: "Autopilot",
|
|
7890
8808
|
"ask-writes": "Ask before changes",
|
|
@@ -7904,13 +8822,13 @@ var ApprovalModeSwitch = ({
|
|
|
7904
8822
|
labels,
|
|
7905
8823
|
disabled,
|
|
7906
8824
|
className
|
|
7907
|
-
}) => /* @__PURE__ */
|
|
8825
|
+
}) => /* @__PURE__ */ jsx24(
|
|
7908
8826
|
"div",
|
|
7909
8827
|
{
|
|
7910
8828
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
7911
8829
|
role: "radiogroup",
|
|
7912
8830
|
"aria-label": "Tool consent",
|
|
7913
|
-
children: modes.map((m) => /* @__PURE__ */
|
|
8831
|
+
children: modes.map((m) => /* @__PURE__ */ jsx24(
|
|
7914
8832
|
"button",
|
|
7915
8833
|
{
|
|
7916
8834
|
type: "button",
|
|
@@ -7928,8 +8846,8 @@ var ApprovalModeSwitch = ({
|
|
|
7928
8846
|
);
|
|
7929
8847
|
|
|
7930
8848
|
// src/components/ApiKeyForm.tsx
|
|
7931
|
-
import { useEffect as
|
|
7932
|
-
import { jsx as
|
|
8849
|
+
import { useEffect as useEffect18, useState as useState19 } from "react";
|
|
8850
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7933
8851
|
var ApiKeyForm = ({
|
|
7934
8852
|
credentials,
|
|
7935
8853
|
credentialRef,
|
|
@@ -7938,10 +8856,10 @@ var ApiKeyForm = ({
|
|
|
7938
8856
|
onChange,
|
|
7939
8857
|
className
|
|
7940
8858
|
}) => {
|
|
7941
|
-
const [value, setValue] =
|
|
7942
|
-
const [present, setPresent] =
|
|
7943
|
-
const [busy, setBusy] =
|
|
7944
|
-
|
|
8859
|
+
const [value, setValue] = useState19("");
|
|
8860
|
+
const [present, setPresent] = useState19(false);
|
|
8861
|
+
const [busy, setBusy] = useState19(false);
|
|
8862
|
+
useEffect18(() => {
|
|
7945
8863
|
let active = true;
|
|
7946
8864
|
credentials.hasKey(credentialRef).then((has) => {
|
|
7947
8865
|
if (active) setPresent(has);
|
|
@@ -7973,16 +8891,16 @@ var ApiKeyForm = ({
|
|
|
7973
8891
|
setBusy(false);
|
|
7974
8892
|
}
|
|
7975
8893
|
};
|
|
7976
|
-
return /* @__PURE__ */
|
|
7977
|
-
/* @__PURE__ */
|
|
8894
|
+
return /* @__PURE__ */ jsxs23("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
8895
|
+
/* @__PURE__ */ jsxs23("label", { className: "awr-keyform__label", children: [
|
|
7978
8896
|
label,
|
|
7979
|
-
present && /* @__PURE__ */
|
|
7980
|
-
/* @__PURE__ */
|
|
8897
|
+
present && /* @__PURE__ */ jsxs23("span", { className: "awr-keyform__saved", children: [
|
|
8898
|
+
/* @__PURE__ */ jsx25(CheckIcon, { size: 12 }),
|
|
7981
8899
|
" stored, encrypted"
|
|
7982
8900
|
] })
|
|
7983
8901
|
] }),
|
|
7984
|
-
/* @__PURE__ */
|
|
7985
|
-
/* @__PURE__ */
|
|
8902
|
+
/* @__PURE__ */ jsxs23("div", { className: "awr-keyform__row", children: [
|
|
8903
|
+
/* @__PURE__ */ jsx25(
|
|
7986
8904
|
"input",
|
|
7987
8905
|
{
|
|
7988
8906
|
className: "awr-keyform__input",
|
|
@@ -8000,7 +8918,7 @@ var ApiKeyForm = ({
|
|
|
8000
8918
|
disabled: busy
|
|
8001
8919
|
}
|
|
8002
8920
|
),
|
|
8003
|
-
/* @__PURE__ */
|
|
8921
|
+
/* @__PURE__ */ jsx25(
|
|
8004
8922
|
"button",
|
|
8005
8923
|
{
|
|
8006
8924
|
type: "button",
|
|
@@ -8010,7 +8928,7 @@ var ApiKeyForm = ({
|
|
|
8010
8928
|
children: "Save"
|
|
8011
8929
|
}
|
|
8012
8930
|
),
|
|
8013
|
-
present && /* @__PURE__ */
|
|
8931
|
+
present && /* @__PURE__ */ jsx25(
|
|
8014
8932
|
"button",
|
|
8015
8933
|
{
|
|
8016
8934
|
type: "button",
|
|
@@ -8060,6 +8978,7 @@ export {
|
|
|
8060
8978
|
APP_DEFAULT_HEIGHT,
|
|
8061
8979
|
APP_MAX_HEIGHT,
|
|
8062
8980
|
APP_MIN_HEIGHT,
|
|
8981
|
+
ASK_USER_TOOL_NAME,
|
|
8063
8982
|
AgentChat,
|
|
8064
8983
|
AgentComposer,
|
|
8065
8984
|
AgentLabelsProvider,
|
|
@@ -8075,6 +8994,8 @@ export {
|
|
|
8075
8994
|
ContextMeter,
|
|
8076
8995
|
ElicitationPrompt,
|
|
8077
8996
|
FILE_PREVIEW_CHARS,
|
|
8997
|
+
FOLLOW_LEAVE_PX,
|
|
8998
|
+
FOLLOW_REJOIN_PX,
|
|
8078
8999
|
FRAME_MAX_HEIGHT,
|
|
8079
9000
|
FRAME_MIN_HEIGHT,
|
|
8080
9001
|
FileChip,
|
|
@@ -8082,6 +9003,9 @@ export {
|
|
|
8082
9003
|
FilesPanel,
|
|
8083
9004
|
GeneratedMedia,
|
|
8084
9005
|
HTML_PREVIEW_MAX_CHARS,
|
|
9006
|
+
ImageThumb,
|
|
9007
|
+
ImageViewer,
|
|
9008
|
+
ImageViewerProvider,
|
|
8085
9009
|
ImagesNotSupportedError,
|
|
8086
9010
|
IndexedDBStore,
|
|
8087
9011
|
LearnedSkills,
|
|
@@ -8118,6 +9042,8 @@ export {
|
|
|
8118
9042
|
MessageList,
|
|
8119
9043
|
ModelLoadBar,
|
|
8120
9044
|
PlanView,
|
|
9045
|
+
QUESTION_TIMEOUT_MS,
|
|
9046
|
+
QuestionPrompt,
|
|
8121
9047
|
SandboxedFrame,
|
|
8122
9048
|
SessionBusyError,
|
|
8123
9049
|
SourceView,
|
|
@@ -8144,6 +9070,8 @@ export {
|
|
|
8144
9070
|
appMessageTextOf,
|
|
8145
9071
|
appMimeTypeOf,
|
|
8146
9072
|
appSamplingErrorOf,
|
|
9073
|
+
askUserOutputKept,
|
|
9074
|
+
askUserWith,
|
|
8147
9075
|
attachmentKindOf,
|
|
8148
9076
|
attachmentRefusal,
|
|
8149
9077
|
buildMcpAppDocument,
|
|
@@ -8156,6 +9084,7 @@ export {
|
|
|
8156
9084
|
createApprovalQueue,
|
|
8157
9085
|
createFileTools,
|
|
8158
9086
|
createInitialAgentState,
|
|
9087
|
+
createQuestionQueue,
|
|
8159
9088
|
createRunControl2 as createRunControl,
|
|
8160
9089
|
createSubagentTool,
|
|
8161
9090
|
createWebLLMEngine,
|
|
@@ -8171,11 +9100,14 @@ export {
|
|
|
8171
9100
|
elicitationLink,
|
|
8172
9101
|
escapeAttribute,
|
|
8173
9102
|
fileKindOf,
|
|
8174
|
-
fileNameOf,
|
|
9103
|
+
fileNameOf2 as fileNameOf,
|
|
8175
9104
|
filterCommands,
|
|
9105
|
+
followsAfterResize,
|
|
9106
|
+
followsAfterScroll,
|
|
8176
9107
|
formatCountdown,
|
|
8177
9108
|
formatElapsed,
|
|
8178
9109
|
grantedAppCsp,
|
|
9110
|
+
imageExtensionOf,
|
|
8179
9111
|
isMcpAppSandboxMessage,
|
|
8180
9112
|
isWebGPUAvailable2 as isWebGPUAvailable,
|
|
8181
9113
|
lessonsOf,
|
|
@@ -8199,6 +9131,9 @@ export {
|
|
|
8199
9131
|
pendingApprovalsOf,
|
|
8200
9132
|
postStorageChange2 as postStorageChange,
|
|
8201
9133
|
preloadWebLLMModel2 as preloadWebLLMModel,
|
|
9134
|
+
questionChoiceOf,
|
|
9135
|
+
questionOtherOf,
|
|
9136
|
+
questionTimeoutOf,
|
|
8202
9137
|
resolveAppDownload,
|
|
8203
9138
|
sandboxTokens,
|
|
8204
9139
|
sandboxedCsp,
|
|
@@ -8217,6 +9152,7 @@ export {
|
|
|
8217
9152
|
useAgentContext,
|
|
8218
9153
|
useChatHistory,
|
|
8219
9154
|
useCredentials,
|
|
9155
|
+
useFollowScroll,
|
|
8220
9156
|
useLabels,
|
|
8221
9157
|
useLocalModel,
|
|
8222
9158
|
useMcpAppHost,
|
|
@@ -8228,6 +9164,7 @@ export {
|
|
|
8228
9164
|
webSearchOf,
|
|
8229
9165
|
withAttachments,
|
|
8230
9166
|
withCspFirst,
|
|
8231
|
-
withPolicyFirst
|
|
9167
|
+
withPolicyFirst,
|
|
9168
|
+
withoutOwnWords
|
|
8232
9169
|
};
|
|
8233
9170
|
//# sourceMappingURL=index.js.map
|