@dudko.dev/agent-web-react 0.0.34 → 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 +51 -2
- package/dist/{elicitation-BTrJ5t3c.d.cts → elicitation-xMLll5W9.d.cts} +47 -3
- package/dist/{elicitation-BTrJ5t3c.d.ts → elicitation-xMLll5W9.d.ts} +47 -3
- package/dist/index.cjs +683 -157
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +205 -7
- package/dist/index.d.ts +205 -7
- package/dist/index.js +672 -156
- 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 +264 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(src_exports, {
|
|
|
33
33
|
APP_DEFAULT_HEIGHT: () => APP_DEFAULT_HEIGHT,
|
|
34
34
|
APP_MAX_HEIGHT: () => APP_MAX_HEIGHT,
|
|
35
35
|
APP_MIN_HEIGHT: () => APP_MIN_HEIGHT,
|
|
36
|
+
ASK_USER_TOOL_NAME: () => ASK_USER_TOOL_NAME,
|
|
36
37
|
AgentChat: () => AgentChat,
|
|
37
38
|
AgentComposer: () => AgentComposer,
|
|
38
39
|
AgentLabelsProvider: () => AgentLabelsProvider,
|
|
@@ -96,6 +97,8 @@ __export(src_exports, {
|
|
|
96
97
|
MessageList: () => MessageList,
|
|
97
98
|
ModelLoadBar: () => ModelLoadBar,
|
|
98
99
|
PlanView: () => PlanView,
|
|
100
|
+
QUESTION_TIMEOUT_MS: () => QUESTION_TIMEOUT_MS,
|
|
101
|
+
QuestionPrompt: () => QuestionPrompt,
|
|
99
102
|
SandboxedFrame: () => SandboxedFrame,
|
|
100
103
|
SessionBusyError: () => import_agent_web8.SessionBusyError,
|
|
101
104
|
SourceView: () => SourceView,
|
|
@@ -122,6 +125,8 @@ __export(src_exports, {
|
|
|
122
125
|
appMessageTextOf: () => appMessageTextOf,
|
|
123
126
|
appMimeTypeOf: () => appMimeTypeOf,
|
|
124
127
|
appSamplingErrorOf: () => appSamplingErrorOf,
|
|
128
|
+
askUserOutputKept: () => askUserOutputKept,
|
|
129
|
+
askUserWith: () => askUserWith,
|
|
125
130
|
attachmentKindOf: () => attachmentKindOf,
|
|
126
131
|
attachmentRefusal: () => attachmentRefusal,
|
|
127
132
|
buildMcpAppDocument: () => buildMcpAppDocument,
|
|
@@ -134,6 +139,7 @@ __export(src_exports, {
|
|
|
134
139
|
createApprovalQueue: () => createApprovalQueue,
|
|
135
140
|
createFileTools: () => import_agent_web8.createFileTools,
|
|
136
141
|
createInitialAgentState: () => createInitialAgentState,
|
|
142
|
+
createQuestionQueue: () => createQuestionQueue,
|
|
137
143
|
createRunControl: () => import_agent_web8.createRunControl,
|
|
138
144
|
createSubagentTool: () => import_agent_web8.createSubagentTool,
|
|
139
145
|
createWebLLMEngine: () => createWebLLMEngine,
|
|
@@ -180,6 +186,9 @@ __export(src_exports, {
|
|
|
180
186
|
pendingApprovalsOf: () => pendingApprovalsOf,
|
|
181
187
|
postStorageChange: () => import_agent_web8.postStorageChange,
|
|
182
188
|
preloadWebLLMModel: () => import_agent_web8.preloadWebLLMModel,
|
|
189
|
+
questionChoiceOf: () => questionChoiceOf,
|
|
190
|
+
questionOtherOf: () => questionOtherOf,
|
|
191
|
+
questionTimeoutOf: () => questionTimeoutOf,
|
|
183
192
|
resolveAppDownload: () => resolveAppDownload,
|
|
184
193
|
sandboxTokens: () => sandboxTokens,
|
|
185
194
|
sandboxedCsp: () => sandboxedCsp,
|
|
@@ -210,7 +219,8 @@ __export(src_exports, {
|
|
|
210
219
|
webSearchOf: () => webSearchOf,
|
|
211
220
|
withAttachments: () => withAttachments,
|
|
212
221
|
withCspFirst: () => withCspFirst,
|
|
213
|
-
withPolicyFirst: () => withPolicyFirst
|
|
222
|
+
withPolicyFirst: () => withPolicyFirst,
|
|
223
|
+
withoutOwnWords: () => withoutOwnWords
|
|
214
224
|
});
|
|
215
225
|
module.exports = __toCommonJS(src_exports);
|
|
216
226
|
|
|
@@ -257,6 +267,127 @@ var createApprovalQueue = () => {
|
|
|
257
267
|
};
|
|
258
268
|
};
|
|
259
269
|
|
|
270
|
+
// src/questions.ts
|
|
271
|
+
var ASK_USER_TOOL_NAME = "ask_user";
|
|
272
|
+
var QUESTION_TIMEOUT_MS = 3e5;
|
|
273
|
+
var TIMER_MAX_MS = 2147483647;
|
|
274
|
+
var questionTimeoutOf = (askUser) => {
|
|
275
|
+
if (!askUser) return void 0;
|
|
276
|
+
const raw = askUser === true ? void 0 : askUser.timeoutMs;
|
|
277
|
+
if (raw === void 0 || raw === null) return QUESTION_TIMEOUT_MS;
|
|
278
|
+
if (typeof raw !== "number" || !(raw > 0) || raw > TIMER_MAX_MS) return void 0;
|
|
279
|
+
return Math.max(1, Math.floor(raw));
|
|
280
|
+
};
|
|
281
|
+
var askUserWith = (askUser, handler) => {
|
|
282
|
+
if (!askUser) return askUser;
|
|
283
|
+
if (askUser === true) return { onQuestion: handler };
|
|
284
|
+
return askUser.onQuestion ? askUser : { ...askUser, onQuestion: handler };
|
|
285
|
+
};
|
|
286
|
+
var DECLINED = { declined: true };
|
|
287
|
+
var createQuestionQueue = (options = {}) => {
|
|
288
|
+
const now = options.now ?? Date.now;
|
|
289
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
290
|
+
let disposed = false;
|
|
291
|
+
const list = () => [...waiting.values()].map((w) => w.question);
|
|
292
|
+
const changed = () => {
|
|
293
|
+
if (!disposed) options.onChange?.(list());
|
|
294
|
+
};
|
|
295
|
+
const handler = (request, ctx) => new Promise((resolve) => {
|
|
296
|
+
const signal = ctx?.signal;
|
|
297
|
+
if (disposed || signal?.aborted || waiting.has(request.id)) {
|
|
298
|
+
resolve(DECLINED);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const onAbort = () => {
|
|
302
|
+
if (waiting.get(request.id)?.settle !== settle) return;
|
|
303
|
+
settle(DECLINED);
|
|
304
|
+
changed();
|
|
305
|
+
};
|
|
306
|
+
const settle = (answer) => {
|
|
307
|
+
waiting.delete(request.id);
|
|
308
|
+
signal?.removeEventListener("abort", onAbort);
|
|
309
|
+
resolve(answer);
|
|
310
|
+
};
|
|
311
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
312
|
+
const timeoutMs = typeof options.timeoutMs === "function" ? options.timeoutMs() : options.timeoutMs;
|
|
313
|
+
waiting.set(request.id, {
|
|
314
|
+
question: {
|
|
315
|
+
...request,
|
|
316
|
+
options: request.options.map((o) => ({ ...o })),
|
|
317
|
+
...timeoutMs !== void 0 ? { expiresAt: now() + timeoutMs } : {}
|
|
318
|
+
},
|
|
319
|
+
settle
|
|
320
|
+
});
|
|
321
|
+
changed();
|
|
322
|
+
});
|
|
323
|
+
return {
|
|
324
|
+
handler,
|
|
325
|
+
pending: list,
|
|
326
|
+
answer: (id, answer) => {
|
|
327
|
+
const entry = waiting.get(id);
|
|
328
|
+
if (!entry) return false;
|
|
329
|
+
entry.settle(answer);
|
|
330
|
+
changed();
|
|
331
|
+
return true;
|
|
332
|
+
},
|
|
333
|
+
cancel: (match) => {
|
|
334
|
+
let any = false;
|
|
335
|
+
for (const entry of [...waiting.values()]) {
|
|
336
|
+
if (match && !match(entry.question)) continue;
|
|
337
|
+
entry.settle(DECLINED);
|
|
338
|
+
any = true;
|
|
339
|
+
}
|
|
340
|
+
if (any) changed();
|
|
341
|
+
},
|
|
342
|
+
dispose: () => {
|
|
343
|
+
disposed = true;
|
|
344
|
+
for (const entry of [...waiting.values()]) entry.settle(DECLINED);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
var questionChoiceOf = (question, picked) => {
|
|
349
|
+
const chosen = question.options.map((o) => o.label).filter((label) => picked.includes(label));
|
|
350
|
+
if (chosen.length === 0) return void 0;
|
|
351
|
+
return { choice: question.multiple ? chosen : chosen.slice(0, 1) };
|
|
352
|
+
};
|
|
353
|
+
var questionOtherOf = (question, text2) => question.allowOther && typeof text2 === "string" && text2.trim() ? { other: text2.trim() } : void 0;
|
|
354
|
+
var LABELS_ONLY = [
|
|
355
|
+
"The user chose: ",
|
|
356
|
+
"The user chose not to answer.",
|
|
357
|
+
"The user did not answer in time.",
|
|
358
|
+
"The question could not be put to the user",
|
|
359
|
+
"You have already asked the user "
|
|
360
|
+
];
|
|
361
|
+
var askUserOutputKept = (output, ok) => (
|
|
362
|
+
// A failed call is about the model's own arguments (a bad question): nobody was asked.
|
|
363
|
+
!ok || typeof output === "string" && LABELS_ONLY.some((start) => output.startsWith(start))
|
|
364
|
+
);
|
|
365
|
+
var withoutOutput = (call) => {
|
|
366
|
+
if (call.name !== ASK_USER_TOOL_NAME || askUserOutputKept(call.output, call.ok)) return call;
|
|
367
|
+
const { output: _dropped, ...rest } = call;
|
|
368
|
+
void _dropped;
|
|
369
|
+
return rest;
|
|
370
|
+
};
|
|
371
|
+
var withoutOwnWords = (event) => {
|
|
372
|
+
switch (event.type) {
|
|
373
|
+
case "step.tool-result": {
|
|
374
|
+
const cleaned = withoutOutput(event);
|
|
375
|
+
return cleaned === event ? event : { ...cleaned, output: void 0 };
|
|
376
|
+
}
|
|
377
|
+
case "step.complete": {
|
|
378
|
+
const calls = event.result.toolCalls;
|
|
379
|
+
const cleaned = calls.map(withoutOutput);
|
|
380
|
+
return cleaned.every((c, i) => c === calls[i]) ? event : { ...event, result: { ...event.result, toolCalls: cleaned } };
|
|
381
|
+
}
|
|
382
|
+
case "subagent.event": {
|
|
383
|
+
const inner = withoutOwnWords(event.event);
|
|
384
|
+
return inner === event.event ? event : { ...event, event: inner };
|
|
385
|
+
}
|
|
386
|
+
default:
|
|
387
|
+
return event;
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
260
391
|
// src/state.ts
|
|
261
392
|
var import_agent_web = require("@dudko.dev/agent-web");
|
|
262
393
|
var approxTokens = (value) => {
|
|
@@ -404,6 +535,35 @@ var answerElicitation = (state, event, stepId) => {
|
|
|
404
535
|
]
|
|
405
536
|
};
|
|
406
537
|
};
|
|
538
|
+
var addQuestion = (state, event, extra) => state.questions?.some((q) => q.id === event.id) ? state : {
|
|
539
|
+
...state,
|
|
540
|
+
questions: [
|
|
541
|
+
...state.questions ?? [],
|
|
542
|
+
{
|
|
543
|
+
id: event.id,
|
|
544
|
+
question: event.question,
|
|
545
|
+
options: event.options.map((o) => ({ ...o })),
|
|
546
|
+
multiple: event.multiple,
|
|
547
|
+
allowOther: event.allowOther,
|
|
548
|
+
...extra.stepId ? { stepId: extra.stepId } : {},
|
|
549
|
+
...extra.subagent ? { subagent: extra.subagent } : {},
|
|
550
|
+
...extra.remote ? { remote: true } : {},
|
|
551
|
+
status: "pending"
|
|
552
|
+
}
|
|
553
|
+
]
|
|
554
|
+
};
|
|
555
|
+
var answerQuestion = (state, event) => state.questions?.some((q) => q.id === event.id) ? {
|
|
556
|
+
...state,
|
|
557
|
+
questions: state.questions.map(
|
|
558
|
+
(q) => q.id === event.id ? {
|
|
559
|
+
...q,
|
|
560
|
+
status: event.action,
|
|
561
|
+
automatic: event.automatic,
|
|
562
|
+
...event.action === "choice" && event.choice ? { choice: [...event.choice] } : {},
|
|
563
|
+
...event.reason ? { reason: event.reason } : {}
|
|
564
|
+
} : q
|
|
565
|
+
)
|
|
566
|
+
} : state;
|
|
407
567
|
var patchSubagent = (subagents, id, fn) => subagents.map((s) => s.id === id ? fn(s) : s);
|
|
408
568
|
var runningStepId = (steps) => [...steps].reverse().find((s) => s.status === "running")?.id;
|
|
409
569
|
var applySubagentEvent = (view, event) => {
|
|
@@ -636,6 +796,25 @@ var applySubagent = (state, event, ancestors, ctx) => {
|
|
|
636
796
|
inner,
|
|
637
797
|
known.subagents.find((s) => s.id === event.id)?.stepId
|
|
638
798
|
);
|
|
799
|
+
// A helper (or a subagent the host defined) asks the person through the run's handler:
|
|
800
|
+
// the question is the person's to answer, like the run's own, marked with who asks.
|
|
801
|
+
case "user.question-asked": {
|
|
802
|
+
const asker = inner.subagent ?? { id: event.id, depth: ancestors.length + 1 };
|
|
803
|
+
const node = known.subagents.find((s) => s.id === asker.id);
|
|
804
|
+
return addQuestion(known, inner, {
|
|
805
|
+
...ctx.remote ? { remote: true } : {},
|
|
806
|
+
// The helper's own step ids mean nothing here: the step that delegated it does.
|
|
807
|
+
stepId: (node ?? known.subagents.find((s) => s.id === event.id))?.stepId,
|
|
808
|
+
subagent: {
|
|
809
|
+
id: asker.id,
|
|
810
|
+
depth: asker.depth,
|
|
811
|
+
...node ? { name: node.name } : {},
|
|
812
|
+
...node?.role ? { role: node.role } : {}
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
case "user.question-answered":
|
|
817
|
+
return answerQuestion(known, inner);
|
|
639
818
|
// What a subagent generated is in the same workspace: it shows in the turn (its step
|
|
640
819
|
// ids are its own, so it is tied to no step here).
|
|
641
820
|
case "media.generated":
|
|
@@ -1097,6 +1276,15 @@ var applyEvent = (state, event, ctx) => {
|
|
|
1097
1276
|
});
|
|
1098
1277
|
case "mcp.elicitation-answered":
|
|
1099
1278
|
return answerElicitation(state, event, runningStepId(state.steps));
|
|
1279
|
+
case "user.question-asked":
|
|
1280
|
+
return addQuestion(state, event, {
|
|
1281
|
+
// Asked in the tab that runs the agent: shown here, answered there only.
|
|
1282
|
+
...ctx.remote ? { remote: true } : {},
|
|
1283
|
+
stepId: event.step?.id,
|
|
1284
|
+
...event.subagent ? { subagent: event.subagent } : {}
|
|
1285
|
+
});
|
|
1286
|
+
case "user.question-answered":
|
|
1287
|
+
return answerQuestion(state, event);
|
|
1100
1288
|
case "tool.approval-requested":
|
|
1101
1289
|
return {
|
|
1102
1290
|
...state,
|
|
@@ -1228,6 +1416,12 @@ var applyEvent = (state, event, ctx) => {
|
|
|
1228
1416
|
(e) => e.status === "pending" ? { ...e, status: "cancelled", automatic: true, reason: "stopped" } : e
|
|
1229
1417
|
)
|
|
1230
1418
|
} : {},
|
|
1419
|
+
// Nobody is asked any more once the run has stopped.
|
|
1420
|
+
...state.questions ? {
|
|
1421
|
+
questions: state.questions.map(
|
|
1422
|
+
(q) => q.status === "pending" ? { ...q, status: "stopped", automatic: true, reason: "stopped" } : q
|
|
1423
|
+
)
|
|
1424
|
+
} : {},
|
|
1231
1425
|
messages: finalizeAssistant(
|
|
1232
1426
|
state.messages,
|
|
1233
1427
|
state.finalText || "Stopped.",
|
|
@@ -1346,8 +1540,9 @@ var agentStateReducer = (state, action) => {
|
|
|
1346
1540
|
return { ...state, remote };
|
|
1347
1541
|
}
|
|
1348
1542
|
case "event": {
|
|
1543
|
+
const event = withoutOwnWords(action.event);
|
|
1349
1544
|
const next = syncRunMessage(
|
|
1350
|
-
applyEvent(state,
|
|
1545
|
+
applyEvent(state, event, {
|
|
1351
1546
|
at: action.at,
|
|
1352
1547
|
attachments: action.attachments,
|
|
1353
1548
|
...action.remote ? { remote: true } : {},
|
|
@@ -1355,7 +1550,7 @@ var agentStateReducer = (state, action) => {
|
|
|
1355
1550
|
})
|
|
1356
1551
|
);
|
|
1357
1552
|
const cap = action.maxEvents ?? 200;
|
|
1358
|
-
const events = cap > 0 ? [...state.events,
|
|
1553
|
+
const events = cap > 0 ? [...state.events, event].slice(-cap) : [...state.events, event];
|
|
1359
1554
|
return { ...next, events };
|
|
1360
1555
|
}
|
|
1361
1556
|
case "undelivered":
|
|
@@ -1436,6 +1631,13 @@ var useAgent = (config, options = {}) => {
|
|
|
1436
1631
|
(decision) => approvals.settleAll(decision),
|
|
1437
1632
|
[approvals]
|
|
1438
1633
|
);
|
|
1634
|
+
const [pendingQuestions, setPendingQuestions] = (0, import_react.useState)([]);
|
|
1635
|
+
const [questionQueue] = (0, import_react.useState)(
|
|
1636
|
+
() => createQuestionQueue({
|
|
1637
|
+
timeoutMs: () => questionTimeoutOf(configRef.current.askUser),
|
|
1638
|
+
onChange: setPendingQuestions
|
|
1639
|
+
})
|
|
1640
|
+
);
|
|
1439
1641
|
const uiOnRequest = (0, import_react.useCallback)(
|
|
1440
1642
|
(req2, ctx) => (req2.app ? appApprovals : approvals).handler(req2, ctx),
|
|
1441
1643
|
[approvals, appApprovals]
|
|
@@ -1470,10 +1672,12 @@ var useAgent = (config, options = {}) => {
|
|
|
1470
1672
|
return;
|
|
1471
1673
|
}
|
|
1472
1674
|
const routeApprovals = optionsRef.current.approvals !== false && !cfg.toolApproval?.onRequest;
|
|
1473
|
-
const
|
|
1675
|
+
const askUser = optionsRef.current.questions !== false ? askUserWith(cfg.askUser, questionQueue.handler) : cfg.askUser;
|
|
1676
|
+
const built = {
|
|
1474
1677
|
...cfg,
|
|
1475
|
-
toolApproval: { ...cfg.toolApproval, mode: modeRef.current, onRequest: uiOnRequest }
|
|
1476
|
-
|
|
1678
|
+
...routeApprovals ? { toolApproval: { ...cfg.toolApproval, mode: modeRef.current, onRequest: uiOnRequest } } : {},
|
|
1679
|
+
...askUser !== cfg.askUser ? { askUser } : {}
|
|
1680
|
+
};
|
|
1477
1681
|
let cancelled = false;
|
|
1478
1682
|
setBuildStatus({ status: "initializing" });
|
|
1479
1683
|
(0, import_agent_web2.createAgent)(built).then((agent) => {
|
|
@@ -1546,8 +1750,9 @@ var useAgent = (config, options = {}) => {
|
|
|
1546
1750
|
abortRef.current?.abort();
|
|
1547
1751
|
settleAll({ approved: false, reason: "the view was closed" });
|
|
1548
1752
|
appApprovals.settleAll({ approved: false, reason: "the view was closed" });
|
|
1753
|
+
questionQueue.dispose();
|
|
1549
1754
|
},
|
|
1550
|
-
[settleAll, appApprovals]
|
|
1755
|
+
[settleAll, appApprovals, questionQueue]
|
|
1551
1756
|
);
|
|
1552
1757
|
const runRef = (0, import_react.useRef)(void 0);
|
|
1553
1758
|
const run = (0, import_react.useCallback)(
|
|
@@ -1615,6 +1820,7 @@ var useAgent = (config, options = {}) => {
|
|
|
1615
1820
|
startedRef.current = false;
|
|
1616
1821
|
controlRef.current = void 0;
|
|
1617
1822
|
settleAll({ approved: false, reason: "the run ended" });
|
|
1823
|
+
questionQueue.cancel();
|
|
1618
1824
|
dispatch({ type: "status", ...buildStatusRef.current });
|
|
1619
1825
|
if (stopped && !began && shownGoal.trim()) left = [shownGoal, ...left];
|
|
1620
1826
|
if (left.length > 0) {
|
|
@@ -1629,7 +1835,7 @@ var useAgent = (config, options = {}) => {
|
|
|
1629
1835
|
}
|
|
1630
1836
|
}
|
|
1631
1837
|
},
|
|
1632
|
-
[settleAll]
|
|
1838
|
+
[settleAll, questionQueue]
|
|
1633
1839
|
);
|
|
1634
1840
|
runRef.current = run;
|
|
1635
1841
|
const send = (0, import_react.useCallback)((text2) => controlRef.current?.send(text2) ?? false, []);
|
|
@@ -1665,7 +1871,12 @@ var useAgent = (config, options = {}) => {
|
|
|
1665
1871
|
const stop = (0, import_react.useCallback)(() => {
|
|
1666
1872
|
abortRef.current?.abort();
|
|
1667
1873
|
settleAll({ approved: false, reason: "stopped by the user" });
|
|
1668
|
-
|
|
1874
|
+
questionQueue.cancel();
|
|
1875
|
+
}, [settleAll, questionQueue]);
|
|
1876
|
+
const answerQuestion2 = (0, import_react.useCallback)(
|
|
1877
|
+
(id, answer) => questionQueue.answer(id, answer),
|
|
1878
|
+
[questionQueue]
|
|
1879
|
+
);
|
|
1669
1880
|
const reset = (0, import_react.useCallback)(() => {
|
|
1670
1881
|
dispatch({ type: "reset" });
|
|
1671
1882
|
void configRef.current.memory?.clear(sessionRef.current).catch(() => {
|
|
@@ -1790,6 +2001,8 @@ var useAgent = (config, options = {}) => {
|
|
|
1790
2001
|
pendingApprovals: pendingApprovalsOf(state),
|
|
1791
2002
|
approve,
|
|
1792
2003
|
deny,
|
|
2004
|
+
pendingQuestions,
|
|
2005
|
+
answerQuestion: answerQuestion2,
|
|
1793
2006
|
approvalMode,
|
|
1794
2007
|
setApprovalMode,
|
|
1795
2008
|
approveAppToolCall,
|
|
@@ -2806,6 +3019,25 @@ var defaultLabels = {
|
|
|
2806
3019
|
"no-tool-call": "no tool call was in progress"
|
|
2807
3020
|
},
|
|
2808
3021
|
elicitationDismiss: "Dismiss",
|
|
3022
|
+
questionLead: "The agent asks you",
|
|
3023
|
+
questionLeadHelper: (role) => role ? `The helper \u201C${role}\u201D asks you` : "A helper the agent started asks you",
|
|
3024
|
+
questionCount: (index, total) => `${index} of ${total}`,
|
|
3025
|
+
questionSeveral: "Pick one or more, then Send.",
|
|
3026
|
+
questionSend: "Send",
|
|
3027
|
+
questionOther: "Other\u2026",
|
|
3028
|
+
questionOtherLabel: "Your answer",
|
|
3029
|
+
questionSkip: "Skip",
|
|
3030
|
+
questionExpiresIn: (time) => `If you do not answer, the agent decides by itself in ${time}`,
|
|
3031
|
+
questionRemote: "Answered in the other tab, where the agent is running.",
|
|
3032
|
+
questionAutomatic: (reason) => `The agent went on without your answer: ${reason}.`,
|
|
3033
|
+
questionReasons: {
|
|
3034
|
+
timeout: "nobody answered in time",
|
|
3035
|
+
stopped: "the run was stopped",
|
|
3036
|
+
"handler-error": "the question could not be shown",
|
|
3037
|
+
"invalid-answer": "the answer did not fit the question",
|
|
3038
|
+
"cannot-park": "the question could not wait here"
|
|
3039
|
+
},
|
|
3040
|
+
questionDismiss: "Dismiss",
|
|
2809
3041
|
appFrom: (server) => `App from server \u201C${server}\u201D`,
|
|
2810
3042
|
appSandboxed: "sandboxed",
|
|
2811
3043
|
appSandboxedOrigin: "sandboxed on its own origin",
|
|
@@ -2897,6 +3129,7 @@ var NESTED = [
|
|
|
2897
3129
|
"decisionReasons",
|
|
2898
3130
|
"elicitationErrors",
|
|
2899
3131
|
"elicitationReasons",
|
|
3132
|
+
"questionReasons",
|
|
2900
3133
|
"fileKinds",
|
|
2901
3134
|
"appSandboxReasons"
|
|
2902
3135
|
];
|
|
@@ -3188,7 +3421,7 @@ var formatCountdown = (ms) => {
|
|
|
3188
3421
|
};
|
|
3189
3422
|
|
|
3190
3423
|
// src/components/AgentChat.tsx
|
|
3191
|
-
var
|
|
3424
|
+
var import_react22 = require("react");
|
|
3192
3425
|
var import_react_dom2 = require("react-dom");
|
|
3193
3426
|
|
|
3194
3427
|
// src/hooks/use-follow-scroll.ts
|
|
@@ -8115,8 +8348,279 @@ var ModelLoadBar = ({ load, className }) => {
|
|
|
8115
8348
|
] });
|
|
8116
8349
|
};
|
|
8117
8350
|
|
|
8118
|
-
// src/components/
|
|
8351
|
+
// src/components/QuestionPrompt.tsx
|
|
8352
|
+
var import_react21 = require("react");
|
|
8119
8353
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
8354
|
+
var useNow2 = (active) => {
|
|
8355
|
+
const [now, setNow] = (0, import_react21.useState)(() => Date.now());
|
|
8356
|
+
(0, import_react21.useEffect)(() => {
|
|
8357
|
+
if (!active) return;
|
|
8358
|
+
setNow(Date.now());
|
|
8359
|
+
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
8360
|
+
return () => clearInterval(timer);
|
|
8361
|
+
}, [active]);
|
|
8362
|
+
return now;
|
|
8363
|
+
};
|
|
8364
|
+
var Expiry2 = ({ expiresAt, L }) => {
|
|
8365
|
+
const now = useNow2(true);
|
|
8366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-question__expiry", children: L.questionExpiresIn(formatCountdown(expiresAt - now)) });
|
|
8367
|
+
};
|
|
8368
|
+
var reasonText2 = (q, L) => {
|
|
8369
|
+
const key = q.reason ?? q.status;
|
|
8370
|
+
return Object.hasOwn(L.questionReasons, key) ? L.questionReasons[key] : key;
|
|
8371
|
+
};
|
|
8372
|
+
var leadOf = (subagent, L) => subagent ? L.questionLeadHelper(previewValue(subagent.role ?? "", 60) || void 0, subagent.depth) : L.questionLead;
|
|
8373
|
+
var isTyping = (target) => target instanceof HTMLElement && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable);
|
|
8374
|
+
var QuestionCard = ({
|
|
8375
|
+
question: q,
|
|
8376
|
+
view,
|
|
8377
|
+
index,
|
|
8378
|
+
total,
|
|
8379
|
+
answer,
|
|
8380
|
+
showExpiry,
|
|
8381
|
+
showHelper,
|
|
8382
|
+
numberKeys,
|
|
8383
|
+
L
|
|
8384
|
+
}) => {
|
|
8385
|
+
const baseId = (0, import_react21.useId)();
|
|
8386
|
+
const textId = `${baseId}-q`;
|
|
8387
|
+
const otherId = `${baseId}-other`;
|
|
8388
|
+
const [picked, setPicked] = (0, import_react21.useState)([]);
|
|
8389
|
+
const [otherOpen, setOtherOpen] = (0, import_react21.useState)(false);
|
|
8390
|
+
const [otherText, setOtherText] = (0, import_react21.useState)("");
|
|
8391
|
+
const otherField = (0, import_react21.useRef)(null);
|
|
8392
|
+
const otherButton = (0, import_react21.useRef)(null);
|
|
8393
|
+
(0, import_react21.useEffect)(() => {
|
|
8394
|
+
if (otherOpen) otherField.current?.focus();
|
|
8395
|
+
}, [otherOpen]);
|
|
8396
|
+
const helper = showHelper && q.subagent ? { ...q.subagent, ...view?.subagent } : void 0;
|
|
8397
|
+
const choice = questionChoiceOf(q, picked);
|
|
8398
|
+
const other = questionOtherOf(q, otherText);
|
|
8399
|
+
const pick = (label) => {
|
|
8400
|
+
if (!q.multiple) {
|
|
8401
|
+
const one = questionChoiceOf(q, [label]);
|
|
8402
|
+
if (one) answer(one);
|
|
8403
|
+
return;
|
|
8404
|
+
}
|
|
8405
|
+
setPicked((p) => p.includes(label) ? p.filter((l) => l !== label) : [...p, label]);
|
|
8406
|
+
};
|
|
8407
|
+
const sendOther = (e) => {
|
|
8408
|
+
e.preventDefault();
|
|
8409
|
+
if (other) answer(other);
|
|
8410
|
+
};
|
|
8411
|
+
const onKeyDown = (e) => {
|
|
8412
|
+
if (!numberKeys || e.defaultPrevented || isTyping(e.target)) return;
|
|
8413
|
+
if (e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) return;
|
|
8414
|
+
const n = /^[1-9]$/.test(e.key) ? Number(e.key) : 0;
|
|
8415
|
+
const option = n ? q.options[n - 1] : void 0;
|
|
8416
|
+
if (!option) return;
|
|
8417
|
+
e.preventDefault();
|
|
8418
|
+
pick(option.label);
|
|
8419
|
+
};
|
|
8420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
8421
|
+
"section",
|
|
8422
|
+
{
|
|
8423
|
+
className: `awr-question${q.multiple ? " awr-question--multiple" : ""}${helper ? " awr-question--helper" : ""}`,
|
|
8424
|
+
role: "group",
|
|
8425
|
+
"aria-labelledby": textId,
|
|
8426
|
+
"data-question": q.id,
|
|
8427
|
+
"data-subagent": helper?.id,
|
|
8428
|
+
onKeyDown,
|
|
8429
|
+
children: [
|
|
8430
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-question__head", children: [
|
|
8431
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(QuestionIcon, { size: 16, className: "awr-question__icon" }),
|
|
8432
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-question__lead", role: "alert", children: leadOf(helper, L) }),
|
|
8433
|
+
total > 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-question__count", children: L.questionCount(index, total) })
|
|
8434
|
+
] }),
|
|
8435
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-question__text", id: textId, children: q.question }),
|
|
8436
|
+
q.multiple && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-question__hint", children: L.questionSeveral }),
|
|
8437
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "awr-question__options", children: q.options.map((o, i) => {
|
|
8438
|
+
const on = picked.includes(o.label);
|
|
8439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
8440
|
+
"button",
|
|
8441
|
+
{
|
|
8442
|
+
type: "button",
|
|
8443
|
+
className: `awr-question__option${on ? " is-picked" : ""}`,
|
|
8444
|
+
"data-option": i + 1,
|
|
8445
|
+
"aria-pressed": q.multiple ? on : void 0,
|
|
8446
|
+
"aria-keyshortcuts": numberKeys && i < 9 ? String(i + 1) : void 0,
|
|
8447
|
+
onClick: () => pick(o.label),
|
|
8448
|
+
children: [
|
|
8449
|
+
numberKeys && i < 9 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-question__key", "aria-hidden": "true", children: i + 1 }),
|
|
8450
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "awr-question__body", children: [
|
|
8451
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-question__label", children: o.label }),
|
|
8452
|
+
o.description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-question__desc", children: o.description })
|
|
8453
|
+
] }),
|
|
8454
|
+
q.multiple && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-question__mark", "aria-hidden": "true", children: on && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CheckIcon, { size: 14 }) })
|
|
8455
|
+
]
|
|
8456
|
+
},
|
|
8457
|
+
o.label
|
|
8458
|
+
);
|
|
8459
|
+
}) }),
|
|
8460
|
+
q.allowOther && otherOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("form", { className: "awr-question__other", onSubmit: sendOther, children: [
|
|
8461
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "awr-question__otherlabel", htmlFor: otherId, children: L.questionOtherLabel }),
|
|
8462
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-question__otherrow", children: [
|
|
8463
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8464
|
+
"input",
|
|
8465
|
+
{
|
|
8466
|
+
ref: otherField,
|
|
8467
|
+
id: otherId,
|
|
8468
|
+
className: "awr-question__input",
|
|
8469
|
+
type: "text",
|
|
8470
|
+
value: otherText,
|
|
8471
|
+
autoComplete: "off",
|
|
8472
|
+
onChange: (e) => setOtherText(e.target.value),
|
|
8473
|
+
onKeyDown: (e) => {
|
|
8474
|
+
if (e.key !== "Escape") return;
|
|
8475
|
+
e.preventDefault();
|
|
8476
|
+
e.stopPropagation();
|
|
8477
|
+
setOtherOpen(false);
|
|
8478
|
+
otherButton.current?.focus();
|
|
8479
|
+
}
|
|
8480
|
+
}
|
|
8481
|
+
),
|
|
8482
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "submit", className: "awr-btn awr-btn--primary", disabled: !other, children: L.questionSend })
|
|
8483
|
+
] })
|
|
8484
|
+
] }),
|
|
8485
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-question__actions", children: [
|
|
8486
|
+
q.multiple && !otherOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8487
|
+
"button",
|
|
8488
|
+
{
|
|
8489
|
+
type: "button",
|
|
8490
|
+
className: "awr-btn awr-btn--primary",
|
|
8491
|
+
disabled: !choice,
|
|
8492
|
+
onClick: () => choice && answer(choice),
|
|
8493
|
+
children: L.questionSend
|
|
8494
|
+
}
|
|
8495
|
+
),
|
|
8496
|
+
q.allowOther && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8497
|
+
"button",
|
|
8498
|
+
{
|
|
8499
|
+
ref: otherButton,
|
|
8500
|
+
type: "button",
|
|
8501
|
+
className: "awr-btn",
|
|
8502
|
+
"aria-expanded": otherOpen,
|
|
8503
|
+
"aria-controls": otherOpen ? otherId : void 0,
|
|
8504
|
+
onClick: () => setOtherOpen((o) => !o),
|
|
8505
|
+
children: L.questionOther
|
|
8506
|
+
}
|
|
8507
|
+
),
|
|
8508
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8509
|
+
"button",
|
|
8510
|
+
{
|
|
8511
|
+
type: "button",
|
|
8512
|
+
className: "awr-btn awr-btn--ghost",
|
|
8513
|
+
onClick: () => answer({ declined: true }),
|
|
8514
|
+
children: L.questionSkip
|
|
8515
|
+
}
|
|
8516
|
+
)
|
|
8517
|
+
] }),
|
|
8518
|
+
showExpiry && q.expiresAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Expiry2, { expiresAt: q.expiresAt, L })
|
|
8519
|
+
]
|
|
8520
|
+
}
|
|
8521
|
+
);
|
|
8522
|
+
};
|
|
8523
|
+
var RemoteQuestion = ({ view, L }) => {
|
|
8524
|
+
const textId = `${(0, import_react21.useId)()}-q`;
|
|
8525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
8526
|
+
"section",
|
|
8527
|
+
{
|
|
8528
|
+
className: "awr-question awr-question--remote",
|
|
8529
|
+
role: "group",
|
|
8530
|
+
"aria-labelledby": textId,
|
|
8531
|
+
"data-question": view.id,
|
|
8532
|
+
children: [
|
|
8533
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-question__head", children: [
|
|
8534
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(QuestionIcon, { size: 16, className: "awr-question__icon" }),
|
|
8535
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-question__lead", children: leadOf(view.subagent, L) })
|
|
8536
|
+
] }),
|
|
8537
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-question__text", id: textId, children: view.question }),
|
|
8538
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "awr-question__list", children: view.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { children: [
|
|
8539
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-question__label", children: o.label }),
|
|
8540
|
+
o.description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "awr-question__desc", children: o.description })
|
|
8541
|
+
] }, o.label)) }),
|
|
8542
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-question__remote", role: "status", children: L.questionRemote })
|
|
8543
|
+
]
|
|
8544
|
+
}
|
|
8545
|
+
);
|
|
8546
|
+
};
|
|
8547
|
+
var QuestionPrompt = ({
|
|
8548
|
+
questions,
|
|
8549
|
+
onAnswer,
|
|
8550
|
+
outcomes,
|
|
8551
|
+
showOutcomes = true,
|
|
8552
|
+
showExpiry = true,
|
|
8553
|
+
showHelper = true,
|
|
8554
|
+
showRemote = true,
|
|
8555
|
+
numberKeys = true,
|
|
8556
|
+
renderQuestion,
|
|
8557
|
+
labels,
|
|
8558
|
+
className
|
|
8559
|
+
}) => {
|
|
8560
|
+
const L = useLabels(labels);
|
|
8561
|
+
const [dismissed, setDismissed] = (0, import_react21.useState)(() => /* @__PURE__ */ new Set());
|
|
8562
|
+
const automatic = showOutcomes ? (outcomes ?? []).filter(
|
|
8563
|
+
(o) => o.automatic === true && o.status !== "pending" && o.status !== "stopped" && !dismissed.has(o.id)
|
|
8564
|
+
) : [];
|
|
8565
|
+
const remote = showRemote ? (outcomes ?? []).filter((o) => o.remote && o.status === "pending") : [];
|
|
8566
|
+
const current = questions[0];
|
|
8567
|
+
if (!current && automatic.length === 0 && remote.length === 0) return null;
|
|
8568
|
+
let card = null;
|
|
8569
|
+
if (current) {
|
|
8570
|
+
const answer = (a) => onAnswer(current.id, a);
|
|
8571
|
+
const builtIn = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8572
|
+
QuestionCard,
|
|
8573
|
+
{
|
|
8574
|
+
question: current,
|
|
8575
|
+
view: outcomes?.find((o) => o.id === current.id),
|
|
8576
|
+
index: 1,
|
|
8577
|
+
total: questions.length,
|
|
8578
|
+
answer,
|
|
8579
|
+
showExpiry,
|
|
8580
|
+
showHelper,
|
|
8581
|
+
numberKeys,
|
|
8582
|
+
L
|
|
8583
|
+
},
|
|
8584
|
+
current.id
|
|
8585
|
+
);
|
|
8586
|
+
card = renderQuestion ? renderQuestion(current, builtIn, answer) : builtIn;
|
|
8587
|
+
}
|
|
8588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: ["awr-questions", className].filter(Boolean).join(" "), children: [
|
|
8589
|
+
automatic.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
8590
|
+
"div",
|
|
8591
|
+
{
|
|
8592
|
+
className: "awr-question-outcome",
|
|
8593
|
+
role: "status",
|
|
8594
|
+
"data-reason": o.reason ?? o.status,
|
|
8595
|
+
children: [
|
|
8596
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AlertIcon, { size: 14, className: "awr-question-outcome__icon" }),
|
|
8597
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "awr-question-outcome__text", children: [
|
|
8598
|
+
L.questionAutomatic(reasonText2(o, L)),
|
|
8599
|
+
" ",
|
|
8600
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("q", { className: "awr-question-outcome__question", children: o.question })
|
|
8601
|
+
] }),
|
|
8602
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8603
|
+
"button",
|
|
8604
|
+
{
|
|
8605
|
+
type: "button",
|
|
8606
|
+
className: "awr-iconbtn awr-question-outcome__dismiss",
|
|
8607
|
+
"aria-label": L.questionDismiss,
|
|
8608
|
+
title: L.questionDismiss,
|
|
8609
|
+
onClick: () => setDismissed((d) => new Set(d).add(o.id)),
|
|
8610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(XIcon, { size: 14 })
|
|
8611
|
+
}
|
|
8612
|
+
)
|
|
8613
|
+
]
|
|
8614
|
+
},
|
|
8615
|
+
o.id
|
|
8616
|
+
)),
|
|
8617
|
+
remote.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RemoteQuestion, { view: o, L }, o.id)),
|
|
8618
|
+
card
|
|
8619
|
+
] });
|
|
8620
|
+
};
|
|
8621
|
+
|
|
8622
|
+
// src/components/ToolApprovalPrompt.tsx
|
|
8623
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
8120
8624
|
var SkillConsentCard = ({
|
|
8121
8625
|
approval: a,
|
|
8122
8626
|
skill,
|
|
@@ -8126,7 +8630,7 @@ var SkillConsentCard = ({
|
|
|
8126
8630
|
showPreview,
|
|
8127
8631
|
onApprove,
|
|
8128
8632
|
onDeny
|
|
8129
|
-
}) => /* @__PURE__ */ (0,
|
|
8633
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8130
8634
|
"div",
|
|
8131
8635
|
{
|
|
8132
8636
|
className: `awr-approval awr-approval--skill${helper ? " awr-approval--helper" : ""}`,
|
|
@@ -8134,28 +8638,28 @@ var SkillConsentCard = ({
|
|
|
8134
8638
|
"data-skill-server": skill.server,
|
|
8135
8639
|
"data-subagent": helper?.id,
|
|
8136
8640
|
children: [
|
|
8137
|
-
/* @__PURE__ */ (0,
|
|
8138
|
-
/* @__PURE__ */ (0,
|
|
8139
|
-
/* @__PURE__ */ (0,
|
|
8641
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-approval__head", children: [
|
|
8642
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
8643
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: L.skillConsentLead(skill.server, skill.skill) })
|
|
8140
8644
|
] }),
|
|
8141
|
-
skill.description && /* @__PURE__ */ (0,
|
|
8142
|
-
/* @__PURE__ */ (0,
|
|
8143
|
-
/* @__PURE__ */ (0,
|
|
8144
|
-
/* @__PURE__ */ (0,
|
|
8645
|
+
skill.description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-approval__quote", children: skill.description }),
|
|
8646
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "awr-approval__skillmeta", children: [
|
|
8647
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("code", { className: "awr-tool__name", children: skill.name }),
|
|
8648
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
|
|
8145
8649
|
] }),
|
|
8146
|
-
skill.byUri && /* @__PURE__ */ (0,
|
|
8147
|
-
skill.nestedIn && /* @__PURE__ */ (0,
|
|
8148
|
-
skill.dynamic && /* @__PURE__ */ (0,
|
|
8149
|
-
skill.dynamic && skill.noFileListing && /* @__PURE__ */ (0,
|
|
8150
|
-
showPreview && skill.body !== void 0 && /* @__PURE__ */ (0,
|
|
8151
|
-
/* @__PURE__ */ (0,
|
|
8152
|
-
/* @__PURE__ */ (0,
|
|
8153
|
-
skill.files.length > 0 && /* @__PURE__ */ (0,
|
|
8650
|
+
skill.byUri && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
|
|
8651
|
+
skill.nestedIn && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
|
|
8652
|
+
skill.dynamic && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
|
|
8653
|
+
skill.dynamic && skill.noFileListing && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
|
|
8654
|
+
showPreview && skill.body !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("details", { className: "awr-approval__preview", children: [
|
|
8655
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("summary", { children: L.skillConsentPreview }),
|
|
8656
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
|
|
8657
|
+
skill.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
|
|
8154
8658
|
] }),
|
|
8155
|
-
/* @__PURE__ */ (0,
|
|
8156
|
-
/* @__PURE__ */ (0,
|
|
8157
|
-
/* @__PURE__ */ (0,
|
|
8158
|
-
allowRemember && /* @__PURE__ */ (0,
|
|
8659
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
|
|
8660
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-approval__actions", children: [
|
|
8661
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
|
|
8662
|
+
allowRemember && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8159
8663
|
"button",
|
|
8160
8664
|
{
|
|
8161
8665
|
type: "button",
|
|
@@ -8164,7 +8668,7 @@ var SkillConsentCard = ({
|
|
|
8164
8668
|
children: L.skillConsentAlways
|
|
8165
8669
|
}
|
|
8166
8670
|
),
|
|
8167
|
-
/* @__PURE__ */ (0,
|
|
8671
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8168
8672
|
"button",
|
|
8169
8673
|
{
|
|
8170
8674
|
type: "button",
|
|
@@ -8190,9 +8694,9 @@ var ToolApprovalPrompt = ({
|
|
|
8190
8694
|
}) => {
|
|
8191
8695
|
const L = useLabels(labels);
|
|
8192
8696
|
if (approvals.length === 0) return null;
|
|
8193
|
-
return /* @__PURE__ */ (0,
|
|
8697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
|
|
8194
8698
|
if (a.skill) {
|
|
8195
|
-
const card2 = /* @__PURE__ */ (0,
|
|
8699
|
+
const card2 = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8196
8700
|
SkillConsentCard,
|
|
8197
8701
|
{
|
|
8198
8702
|
approval: a,
|
|
@@ -8206,33 +8710,33 @@ var ToolApprovalPrompt = ({
|
|
|
8206
8710
|
},
|
|
8207
8711
|
a.id
|
|
8208
8712
|
);
|
|
8209
|
-
return renderApproval ? /* @__PURE__ */ (0,
|
|
8713
|
+
return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: renderApproval(a, card2) }, a.id) : card2;
|
|
8210
8714
|
}
|
|
8211
8715
|
const helper = showHelper ? a.subagent : void 0;
|
|
8212
8716
|
const app = a.app;
|
|
8213
|
-
const card = /* @__PURE__ */ (0,
|
|
8717
|
+
const card = /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8214
8718
|
"div",
|
|
8215
8719
|
{
|
|
8216
8720
|
className: `awr-approval${helper ? " awr-approval--helper" : ""}${app ? " awr-approval--app" : ""}`,
|
|
8217
8721
|
"data-subagent": helper?.id,
|
|
8218
8722
|
"data-app-server": app?.server,
|
|
8219
8723
|
children: [
|
|
8220
|
-
/* @__PURE__ */ (0,
|
|
8221
|
-
/* @__PURE__ */ (0,
|
|
8222
|
-
/* @__PURE__ */ (0,
|
|
8724
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-approval__head", children: [
|
|
8725
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
8726
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
|
|
8223
8727
|
app ? L.approvalLeadApp(app.server) : helper ? L.approvalLeadHelper(
|
|
8224
8728
|
previewValue(helper.role ?? "", 60) || void 0,
|
|
8225
8729
|
helper.depth
|
|
8226
8730
|
) : L.approvalLead,
|
|
8227
8731
|
" ",
|
|
8228
|
-
/* @__PURE__ */ (0,
|
|
8732
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
|
|
8229
8733
|
a.readOnly && !app ? ` (${L.readOnlyTool})` : ""
|
|
8230
8734
|
] })
|
|
8231
8735
|
] }),
|
|
8232
|
-
previewValue(a.input, 300) && /* @__PURE__ */ (0,
|
|
8233
|
-
app && /* @__PURE__ */ (0,
|
|
8234
|
-
/* @__PURE__ */ (0,
|
|
8235
|
-
/* @__PURE__ */ (0,
|
|
8736
|
+
previewValue(a.input, 300) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
|
|
8737
|
+
app && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
|
|
8738
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-approval__actions", children: [
|
|
8739
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8236
8740
|
"button",
|
|
8237
8741
|
{
|
|
8238
8742
|
type: "button",
|
|
@@ -8241,7 +8745,7 @@ var ToolApprovalPrompt = ({
|
|
|
8241
8745
|
children: L.approve
|
|
8242
8746
|
}
|
|
8243
8747
|
),
|
|
8244
|
-
allowRemember && /* @__PURE__ */ (0,
|
|
8748
|
+
allowRemember && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8245
8749
|
"button",
|
|
8246
8750
|
{
|
|
8247
8751
|
type: "button",
|
|
@@ -8250,7 +8754,7 @@ var ToolApprovalPrompt = ({
|
|
|
8250
8754
|
children: L.alwaysAllow
|
|
8251
8755
|
}
|
|
8252
8756
|
),
|
|
8253
|
-
/* @__PURE__ */ (0,
|
|
8757
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8254
8758
|
"button",
|
|
8255
8759
|
{
|
|
8256
8760
|
type: "button",
|
|
@@ -8264,12 +8768,12 @@ var ToolApprovalPrompt = ({
|
|
|
8264
8768
|
},
|
|
8265
8769
|
a.id
|
|
8266
8770
|
);
|
|
8267
|
-
return renderApproval ? /* @__PURE__ */ (0,
|
|
8771
|
+
return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: renderApproval(a, card) }, a.id) : card;
|
|
8268
8772
|
}) });
|
|
8269
8773
|
};
|
|
8270
8774
|
|
|
8271
8775
|
// src/components/UsageBadge.tsx
|
|
8272
|
-
var
|
|
8776
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
8273
8777
|
var UsageBadge = ({
|
|
8274
8778
|
usage,
|
|
8275
8779
|
compact = false,
|
|
@@ -8295,7 +8799,7 @@ var UsageBadge = ({
|
|
|
8295
8799
|
mediaText,
|
|
8296
8800
|
decisions ? L.usageDecisions(decisions) : ""
|
|
8297
8801
|
].filter(Boolean).join(" \xB7 ");
|
|
8298
|
-
return /* @__PURE__ */ (0,
|
|
8802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
|
|
8299
8803
|
formatTokens(usage.inputTokens),
|
|
8300
8804
|
"\u2191 ",
|
|
8301
8805
|
formatTokens(usage.outputTokens),
|
|
@@ -8308,13 +8812,13 @@ var UsageBadge = ({
|
|
|
8308
8812
|
};
|
|
8309
8813
|
|
|
8310
8814
|
// src/components/AgentChat.tsx
|
|
8311
|
-
var
|
|
8815
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
8312
8816
|
var usePrefersDark = () => {
|
|
8313
8817
|
const query = "(prefers-color-scheme: dark)";
|
|
8314
|
-
const [dark, setDark] = (0,
|
|
8818
|
+
const [dark, setDark] = (0, import_react22.useState)(
|
|
8315
8819
|
() => typeof matchMedia === "function" && matchMedia(query).matches
|
|
8316
8820
|
);
|
|
8317
|
-
(0,
|
|
8821
|
+
(0, import_react22.useEffect)(() => {
|
|
8318
8822
|
if (typeof matchMedia !== "function") return;
|
|
8319
8823
|
const mq = matchMedia(query);
|
|
8320
8824
|
const on = () => setDark(mq.matches);
|
|
@@ -8325,7 +8829,7 @@ var usePrefersDark = () => {
|
|
|
8325
8829
|
};
|
|
8326
8830
|
var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
|
|
8327
8831
|
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
8328
|
-
var AgentChat = (props) => /* @__PURE__ */ (0,
|
|
8832
|
+
var AgentChat = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AgentChatInner, { ...props }) });
|
|
8329
8833
|
var NO_LABELS = {};
|
|
8330
8834
|
var AgentChatInner = ({
|
|
8331
8835
|
controller,
|
|
@@ -8353,11 +8857,13 @@ var AgentChatInner = ({
|
|
|
8353
8857
|
showContext = false,
|
|
8354
8858
|
activityOpen = false,
|
|
8355
8859
|
showElicitation = true,
|
|
8860
|
+
showQuestions = true,
|
|
8356
8861
|
showSkillPreview = true,
|
|
8357
8862
|
showOtherTabs = true,
|
|
8358
8863
|
elicitations,
|
|
8359
8864
|
onElicitationAnswer,
|
|
8360
8865
|
renderElicitation,
|
|
8866
|
+
renderQuestion,
|
|
8361
8867
|
history,
|
|
8362
8868
|
defaultHistoryOpen,
|
|
8363
8869
|
files,
|
|
@@ -8402,7 +8908,7 @@ var AgentChatInner = ({
|
|
|
8402
8908
|
}
|
|
8403
8909
|
const L = useLabels();
|
|
8404
8910
|
const external = isHistoryHook(history) ? history : void 0;
|
|
8405
|
-
const [ownStore] = (0,
|
|
8911
|
+
const [ownStore] = (0, import_react22.useState)(
|
|
8406
8912
|
() => history instanceof ChatHistoryStore ? history : new ChatHistoryStore()
|
|
8407
8913
|
);
|
|
8408
8914
|
const own = useChatHistory(agent, {
|
|
@@ -8410,9 +8916,9 @@ var AgentChatInner = ({
|
|
|
8410
8916
|
enabled: Boolean(history) && !external
|
|
8411
8917
|
});
|
|
8412
8918
|
const chats = history ? external ?? own : void 0;
|
|
8413
|
-
const rootRef = (0,
|
|
8414
|
-
const [narrow, setNarrow] = (0,
|
|
8415
|
-
(0,
|
|
8919
|
+
const rootRef = (0, import_react22.useRef)(null);
|
|
8920
|
+
const [narrow, setNarrow] = (0, import_react22.useState)(void 0);
|
|
8921
|
+
(0, import_react22.useEffect)(() => {
|
|
8416
8922
|
const el = rootRef.current;
|
|
8417
8923
|
if (!el || typeof ResizeObserver === "undefined") return setNarrow(false);
|
|
8418
8924
|
const measure2 = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
|
|
@@ -8421,9 +8927,9 @@ var AgentChatInner = ({
|
|
|
8421
8927
|
ro.observe(el);
|
|
8422
8928
|
return () => ro.disconnect();
|
|
8423
8929
|
}, [narrowWidth]);
|
|
8424
|
-
const [historyChoice, setHistoryOpen] = (0,
|
|
8930
|
+
const [historyChoice, setHistoryOpen] = (0, import_react22.useState)(defaultHistoryOpen);
|
|
8425
8931
|
const historyOpen = historyChoice ?? narrow === false;
|
|
8426
|
-
const [filesOpen, setFilesOpen] = (0,
|
|
8932
|
+
const [filesOpen, setFilesOpen] = (0, import_react22.useState)(defaultFilesOpen);
|
|
8427
8933
|
const toggleHistory = () => {
|
|
8428
8934
|
setHistoryOpen(!historyOpen);
|
|
8429
8935
|
if (narrow && !historyOpen) setFilesOpen(false);
|
|
@@ -8441,7 +8947,7 @@ var AgentChatInner = ({
|
|
|
8441
8947
|
setHistoryOpen(false);
|
|
8442
8948
|
setFilesOpen(false);
|
|
8443
8949
|
};
|
|
8444
|
-
(0,
|
|
8950
|
+
(0, import_react22.useEffect)(() => {
|
|
8445
8951
|
if (!overlayOpen) return;
|
|
8446
8952
|
const onKey = (e) => {
|
|
8447
8953
|
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
@@ -8451,7 +8957,7 @@ var AgentChatInner = ({
|
|
|
8451
8957
|
document.addEventListener("keydown", onKey);
|
|
8452
8958
|
return () => document.removeEventListener("keydown", onKey);
|
|
8453
8959
|
}, [overlayOpen]);
|
|
8454
|
-
const bodyRef = (0,
|
|
8960
|
+
const bodyRef = (0, import_react22.useRef)(null);
|
|
8455
8961
|
const appHost = useMcpAppHost({
|
|
8456
8962
|
connection: mcpApps,
|
|
8457
8963
|
approve: agent.approveAppToolCall,
|
|
@@ -8463,7 +8969,7 @@ var AgentChatInner = ({
|
|
|
8463
8969
|
});
|
|
8464
8970
|
const prefersDark = usePrefersDark();
|
|
8465
8971
|
const appTheme = theme === "auto" ? prefersDark ? "dark" : "light" : theme;
|
|
8466
|
-
const [panelApp, setPanelAppState] = (0,
|
|
8972
|
+
const [panelApp, setPanelAppState] = (0, import_react22.useState)();
|
|
8467
8973
|
const setPanelApp = (app) => {
|
|
8468
8974
|
setPanelAppState(app);
|
|
8469
8975
|
onAppPanel?.(app);
|
|
@@ -8477,14 +8983,14 @@ var AgentChatInner = ({
|
|
|
8477
8983
|
const panelAllowed = appPanel !== false && appPanel !== null;
|
|
8478
8984
|
const panelTarget = typeof appPanel === "object" && appPanel ? appPanel : void 0;
|
|
8479
8985
|
const asSheet = !panelTarget && (appPanel === "sheet" || Boolean(narrow));
|
|
8480
|
-
(0,
|
|
8986
|
+
(0, import_react22.useEffect)(() => {
|
|
8481
8987
|
if (panelApp && !agent.messages.some((m) => m.apps?.some((a) => a.id === panelApp.id))) {
|
|
8482
8988
|
setPanelAppState(void 0);
|
|
8483
8989
|
onAppPanel?.(void 0);
|
|
8484
8990
|
}
|
|
8485
8991
|
}, [agent.messages, panelApp, onAppPanel]);
|
|
8486
8992
|
const drawApp = (app, message) => {
|
|
8487
|
-
const built = panelApp?.id === app.id ? /* @__PURE__ */ (0,
|
|
8993
|
+
const built = panelApp?.id === app.id ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8488
8994
|
McpAppLine,
|
|
8489
8995
|
{
|
|
8490
8996
|
app,
|
|
@@ -8492,7 +8998,7 @@ var AgentChatInner = ({
|
|
|
8492
8998
|
action: L.appBringBack,
|
|
8493
8999
|
onAction: () => setPanelApp(void 0)
|
|
8494
9000
|
}
|
|
8495
|
-
) : /* @__PURE__ */ (0,
|
|
9001
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8496
9002
|
McpAppFrame,
|
|
8497
9003
|
{
|
|
8498
9004
|
app,
|
|
@@ -8505,7 +9011,7 @@ var AgentChatInner = ({
|
|
|
8505
9011
|
);
|
|
8506
9012
|
return renderApp ? renderApp(app, message, built) : built;
|
|
8507
9013
|
};
|
|
8508
|
-
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ (0,
|
|
9014
|
+
const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8509
9015
|
McpAppFrame,
|
|
8510
9016
|
{
|
|
8511
9017
|
app: panelApp,
|
|
@@ -8517,7 +9023,7 @@ var AgentChatInner = ({
|
|
|
8517
9023
|
},
|
|
8518
9024
|
panelApp.id
|
|
8519
9025
|
) : null;
|
|
8520
|
-
const [compacting, setCompacting] = (0,
|
|
9026
|
+
const [compacting, setCompacting] = (0, import_react22.useState)(false);
|
|
8521
9027
|
const compact = () => {
|
|
8522
9028
|
setCompacting(true);
|
|
8523
9029
|
void agent.compact().finally(() => setCompacting(false));
|
|
@@ -8528,9 +9034,10 @@ var AgentChatInner = ({
|
|
|
8528
9034
|
const Files = components.FilesPanel ?? FilesPanel;
|
|
8529
9035
|
const Approvals = components.ApprovalPrompt ?? ToolApprovalPrompt;
|
|
8530
9036
|
const Elicitations = components.ElicitationPrompt ?? ElicitationPrompt;
|
|
9037
|
+
const Questions = components.QuestionPrompt ?? QuestionPrompt;
|
|
8531
9038
|
const tabNotes = showOtherTabs ? [
|
|
8532
9039
|
agent.remote?.running && L.remoteRunning,
|
|
8533
|
-
agent.remote?.running && agent.approvals.some((a) => a.remote && a.status === "pending") && L.remoteWaitingConsent,
|
|
9040
|
+
agent.remote?.running && (agent.approvals.some((a) => a.remote && a.status === "pending") || (agent.questions ?? []).some((q) => q.remote && q.status === "pending")) && L.remoteWaitingConsent,
|
|
8534
9041
|
agent.remote?.ended === "gone" && L.remoteGone,
|
|
8535
9042
|
agent.sessionBusy && L.sessionBusy(agent.sessionBusy.heldBy)
|
|
8536
9043
|
].filter((t) => typeof t === "string") : [];
|
|
@@ -8538,18 +9045,18 @@ var AgentChatInner = ({
|
|
|
8538
9045
|
const showReplan = agent.replan && agent.replan.mode !== "continue";
|
|
8539
9046
|
const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
|
|
8540
9047
|
const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
|
|
8541
|
-
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ (0,
|
|
8542
|
-
agent.planThought.trim() && /* @__PURE__ */ (0,
|
|
8543
|
-
/* @__PURE__ */ (0,
|
|
8544
|
-
/* @__PURE__ */ (0,
|
|
9048
|
+
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
9049
|
+
agent.planThought.trim() && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("details", { className: "awr-activity__plan", children: [
|
|
9050
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("summary", { children: L.planned }),
|
|
9051
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "awr-activity__thought", children: agent.planThought })
|
|
8545
9052
|
] }),
|
|
8546
|
-
showReplan && /* @__PURE__ */ (0,
|
|
8547
|
-
replanFailedEarly && /* @__PURE__ */ (0,
|
|
8548
|
-
/* @__PURE__ */ (0,
|
|
9053
|
+
showReplan && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
|
|
9054
|
+
replanFailedEarly && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "awr-step__warn", title: agent.replan.error, children: [
|
|
9055
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AlertIcon, { size: 12 }),
|
|
8549
9056
|
" ",
|
|
8550
9057
|
L.replanFailed
|
|
8551
9058
|
] }),
|
|
8552
|
-
earlyDecisions.map((d, i) => /* @__PURE__ */ (0,
|
|
9059
|
+
earlyDecisions.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8553
9060
|
"p",
|
|
8554
9061
|
{
|
|
8555
9062
|
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
@@ -8558,8 +9065,8 @@ var AgentChatInner = ({
|
|
|
8558
9065
|
i
|
|
8559
9066
|
))
|
|
8560
9067
|
] }) : void 0;
|
|
8561
|
-
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0,
|
|
8562
|
-
chats && /* @__PURE__ */ (0,
|
|
9068
|
+
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx("awr-chat__header", classNames.header), children: [
|
|
9069
|
+
chats && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8563
9070
|
"button",
|
|
8564
9071
|
{
|
|
8565
9072
|
type: "button",
|
|
@@ -8568,17 +9075,17 @@ var AgentChatInner = ({
|
|
|
8568
9075
|
title: L.showHistory,
|
|
8569
9076
|
"aria-pressed": historyOpen,
|
|
8570
9077
|
onClick: toggleHistory,
|
|
8571
|
-
children: /* @__PURE__ */ (0,
|
|
9078
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(HistoryIcon, { size: 16 })
|
|
8572
9079
|
}
|
|
8573
9080
|
),
|
|
8574
9081
|
slots.headerStart,
|
|
8575
|
-
/* @__PURE__ */ (0,
|
|
8576
|
-
showStatus && /* @__PURE__ */ (0,
|
|
8577
|
-
/* @__PURE__ */ (0,
|
|
8578
|
-
/* @__PURE__ */ (0,
|
|
9082
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "awr-chat__title", children: title }),
|
|
9083
|
+
showStatus && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
|
|
9084
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "awr-status__dot" }),
|
|
9085
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "awr-status__text", children: L.status[agent.status] })
|
|
8579
9086
|
] }),
|
|
8580
|
-
showTotalUsage && /* @__PURE__ */ (0,
|
|
8581
|
-
files && /* @__PURE__ */ (0,
|
|
9087
|
+
showTotalUsage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { title: L.totalUsage, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
|
|
9088
|
+
files && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8582
9089
|
"button",
|
|
8583
9090
|
{
|
|
8584
9091
|
type: "button",
|
|
@@ -8587,12 +9094,12 @@ var AgentChatInner = ({
|
|
|
8587
9094
|
title: L.showFiles,
|
|
8588
9095
|
"aria-pressed": filesOpen,
|
|
8589
9096
|
onClick: toggleFiles,
|
|
8590
|
-
children: /* @__PURE__ */ (0,
|
|
9097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FileIcon, { size: 16 })
|
|
8591
9098
|
}
|
|
8592
9099
|
),
|
|
8593
9100
|
slots.headerEnd
|
|
8594
9101
|
] });
|
|
8595
|
-
return /* @__PURE__ */ (0,
|
|
9102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8596
9103
|
"div",
|
|
8597
9104
|
{
|
|
8598
9105
|
ref: rootRef,
|
|
@@ -8600,7 +9107,7 @@ var AgentChatInner = ({
|
|
|
8600
9107
|
style,
|
|
8601
9108
|
"data-awr-theme": theme === "auto" ? void 0 : theme,
|
|
8602
9109
|
children: [
|
|
8603
|
-
overlayOpen && /* @__PURE__ */ (0,
|
|
9110
|
+
overlayOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8604
9111
|
"div",
|
|
8605
9112
|
{
|
|
8606
9113
|
className: cx("awr-chat__scrim", classNames.scrim),
|
|
@@ -8608,8 +9115,8 @@ var AgentChatInner = ({
|
|
|
8608
9115
|
onClick: closeOverlays
|
|
8609
9116
|
}
|
|
8610
9117
|
),
|
|
8611
|
-
chats && historyOpen && /* @__PURE__ */ (0,
|
|
8612
|
-
/* @__PURE__ */ (0,
|
|
9118
|
+
chats && historyOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
|
|
9119
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8613
9120
|
HistoryList,
|
|
8614
9121
|
{
|
|
8615
9122
|
history: {
|
|
@@ -8628,7 +9135,7 @@ var AgentChatInner = ({
|
|
|
8628
9135
|
}
|
|
8629
9136
|
),
|
|
8630
9137
|
slots.sidebar,
|
|
8631
|
-
/* @__PURE__ */ (0,
|
|
9138
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8632
9139
|
"button",
|
|
8633
9140
|
{
|
|
8634
9141
|
type: "button",
|
|
@@ -8639,11 +9146,11 @@ var AgentChatInner = ({
|
|
|
8639
9146
|
}
|
|
8640
9147
|
)
|
|
8641
9148
|
] }),
|
|
8642
|
-
/* @__PURE__ */ (0,
|
|
9149
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx("awr-chat__main", classNames.main), children: [
|
|
8643
9150
|
header,
|
|
8644
|
-
/* @__PURE__ */ (0,
|
|
9151
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx("awr-chat__body", classNames.body), ref: bodyRef, children: [
|
|
8645
9152
|
slots.beforeMessages,
|
|
8646
|
-
/* @__PURE__ */ (0,
|
|
9153
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8647
9154
|
Messages,
|
|
8648
9155
|
{
|
|
8649
9156
|
messages: agent.messages,
|
|
@@ -8681,7 +9188,7 @@ var AgentChatInner = ({
|
|
|
8681
9188
|
renderImageViewer
|
|
8682
9189
|
}
|
|
8683
9190
|
),
|
|
8684
|
-
/* @__PURE__ */ (0,
|
|
9191
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8685
9192
|
Approvals,
|
|
8686
9193
|
{
|
|
8687
9194
|
approvals: agent.pendingApprovals,
|
|
@@ -8691,7 +9198,16 @@ var AgentChatInner = ({
|
|
|
8691
9198
|
renderApproval
|
|
8692
9199
|
}
|
|
8693
9200
|
),
|
|
8694
|
-
|
|
9201
|
+
showQuestions && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9202
|
+
Questions,
|
|
9203
|
+
{
|
|
9204
|
+
questions: agent.pendingQuestions ?? [],
|
|
9205
|
+
onAnswer: (id, answer) => agent.answerQuestion?.(id, answer),
|
|
9206
|
+
outcomes: agent.questions,
|
|
9207
|
+
renderQuestion
|
|
9208
|
+
}
|
|
9209
|
+
),
|
|
9210
|
+
appsOn && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8695
9211
|
AppRequestPrompt,
|
|
8696
9212
|
{
|
|
8697
9213
|
requests: appHost.requests,
|
|
@@ -8699,7 +9215,7 @@ var AgentChatInner = ({
|
|
|
8699
9215
|
renderRequest: renderAppRequest
|
|
8700
9216
|
}
|
|
8701
9217
|
),
|
|
8702
|
-
showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ (0,
|
|
9218
|
+
showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8703
9219
|
Elicitations,
|
|
8704
9220
|
{
|
|
8705
9221
|
elicitations,
|
|
@@ -8708,13 +9224,13 @@ var AgentChatInner = ({
|
|
|
8708
9224
|
renderElicitation
|
|
8709
9225
|
}
|
|
8710
9226
|
),
|
|
8711
|
-
agent.modelLoad && loading && /* @__PURE__ */ (0,
|
|
9227
|
+
agent.modelLoad && loading && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ModelLoadBar, { load: agent.modelLoad }),
|
|
8712
9228
|
slots.afterMessages
|
|
8713
9229
|
] }),
|
|
8714
|
-
/* @__PURE__ */ (0,
|
|
9230
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
8715
9231
|
slots.footerStart,
|
|
8716
|
-
tabNotes.length > 0 && /* @__PURE__ */ (0,
|
|
8717
|
-
showContext !== false && /* @__PURE__ */ (0,
|
|
9232
|
+
tabNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "awr-tabnote__text", children: text2 }, text2)) }),
|
|
9233
|
+
showContext !== false && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8718
9234
|
ContextMeter,
|
|
8719
9235
|
{
|
|
8720
9236
|
usage: agent.usage,
|
|
@@ -8725,11 +9241,11 @@ var AgentChatInner = ({
|
|
|
8725
9241
|
compacting
|
|
8726
9242
|
}
|
|
8727
9243
|
),
|
|
8728
|
-
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0,
|
|
8729
|
-
/* @__PURE__ */ (0,
|
|
9244
|
+
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "awr-chat__error", children: [
|
|
9245
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AlertIcon, { size: 14 }),
|
|
8730
9246
|
" ",
|
|
8731
9247
|
agent.error
|
|
8732
|
-
] }) : /* @__PURE__ */ (0,
|
|
9248
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8733
9249
|
Composer2,
|
|
8734
9250
|
{
|
|
8735
9251
|
controller: agent,
|
|
@@ -8746,7 +9262,7 @@ var AgentChatInner = ({
|
|
|
8746
9262
|
appPanelNode && (panelTarget ? (
|
|
8747
9263
|
// Outside the chat: the theme tokens come with it.
|
|
8748
9264
|
(0, import_react_dom2.createPortal)(
|
|
8749
|
-
/* @__PURE__ */ (0,
|
|
9265
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8750
9266
|
"div",
|
|
8751
9267
|
{
|
|
8752
9268
|
className: "awr-theme awr-apppanel",
|
|
@@ -8756,24 +9272,24 @@ var AgentChatInner = ({
|
|
|
8756
9272
|
),
|
|
8757
9273
|
panelTarget
|
|
8758
9274
|
)
|
|
8759
|
-
) : asSheet ? /* @__PURE__ */ (0,
|
|
8760
|
-
/* @__PURE__ */ (0,
|
|
8761
|
-
/* @__PURE__ */ (0,
|
|
9275
|
+
) : asSheet ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
9276
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
|
|
9277
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8762
9278
|
"aside",
|
|
8763
9279
|
{
|
|
8764
9280
|
className: "awr-chat__appsheet",
|
|
8765
9281
|
role: "dialog",
|
|
8766
9282
|
"aria-label": L.appFrom(panelApp.server),
|
|
8767
9283
|
children: [
|
|
8768
|
-
/* @__PURE__ */ (0,
|
|
9284
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "awr-sheet__grab" }),
|
|
8769
9285
|
appPanelNode
|
|
8770
9286
|
]
|
|
8771
9287
|
}
|
|
8772
9288
|
)
|
|
8773
|
-
] }) : /* @__PURE__ */ (0,
|
|
8774
|
-
files && filesOpen && /* @__PURE__ */ (0,
|
|
8775
|
-
/* @__PURE__ */ (0,
|
|
8776
|
-
/* @__PURE__ */ (0,
|
|
9289
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
|
|
9290
|
+
files && filesOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("aside", { className: cx("awr-chat__files", classNames.files), children: [
|
|
9291
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Files, { files }) }),
|
|
9292
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8777
9293
|
"button",
|
|
8778
9294
|
{
|
|
8779
9295
|
type: "button",
|
|
@@ -8790,7 +9306,7 @@ var AgentChatInner = ({
|
|
|
8790
9306
|
};
|
|
8791
9307
|
|
|
8792
9308
|
// src/components/LearnedSkills.tsx
|
|
8793
|
-
var
|
|
9309
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
8794
9310
|
var LearnedSkills = ({
|
|
8795
9311
|
controller,
|
|
8796
9312
|
lessons,
|
|
@@ -8806,18 +9322,18 @@ var LearnedSkills = ({
|
|
|
8806
9322
|
const c = controller ?? ctx;
|
|
8807
9323
|
const list = lessons ?? c?.learned ?? [];
|
|
8808
9324
|
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
8809
|
-
return /* @__PURE__ */ (0,
|
|
8810
|
-
!hideTitle && /* @__PURE__ */ (0,
|
|
8811
|
-
/* @__PURE__ */ (0,
|
|
9325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
9326
|
+
!hideTitle && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("h3", { className: "awr-notebook__title", children: [
|
|
9327
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BookIcon, { size: 14 }),
|
|
8812
9328
|
" ",
|
|
8813
9329
|
L.notebookTitle,
|
|
8814
|
-
list.length > 0 && /* @__PURE__ */ (0,
|
|
9330
|
+
list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "awr-notebook__count", children: list.length })
|
|
8815
9331
|
] }),
|
|
8816
|
-
list.length === 0 ? /* @__PURE__ */ (0,
|
|
8817
|
-
/* @__PURE__ */ (0,
|
|
8818
|
-
/* @__PURE__ */ (0,
|
|
8819
|
-
l.revision > 1 && /* @__PURE__ */ (0,
|
|
8820
|
-
forget && /* @__PURE__ */ (0,
|
|
9332
|
+
list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("li", { className: "awr-lesson", children: [
|
|
9333
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "awr-lesson__head", children: [
|
|
9334
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("code", { className: "awr-lesson__name", children: l.name }),
|
|
9335
|
+
l.revision > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
9336
|
+
forget && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8821
9337
|
"button",
|
|
8822
9338
|
{
|
|
8823
9339
|
type: "button",
|
|
@@ -8825,12 +9341,12 @@ var LearnedSkills = ({
|
|
|
8825
9341
|
title: `${L.notebookForget}: ${l.name}`,
|
|
8826
9342
|
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
8827
9343
|
onClick: () => void forget(l.name),
|
|
8828
|
-
children: /* @__PURE__ */ (0,
|
|
9344
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(XIcon, { size: 12 })
|
|
8829
9345
|
}
|
|
8830
9346
|
)
|
|
8831
9347
|
] }),
|
|
8832
|
-
/* @__PURE__ */ (0,
|
|
8833
|
-
showSources && l.sources.length > 0 && /* @__PURE__ */ (0,
|
|
9348
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "awr-lesson__when", children: l.description }),
|
|
9349
|
+
showSources && l.sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "awr-lesson__from", children: [
|
|
8834
9350
|
L.notebookFrom,
|
|
8835
9351
|
" ",
|
|
8836
9352
|
l.sources.join(", ")
|
|
@@ -8840,8 +9356,8 @@ var LearnedSkills = ({
|
|
|
8840
9356
|
};
|
|
8841
9357
|
|
|
8842
9358
|
// src/components/Composer.tsx
|
|
8843
|
-
var
|
|
8844
|
-
var
|
|
9359
|
+
var import_react23 = require("react");
|
|
9360
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
8845
9361
|
var Composer = ({
|
|
8846
9362
|
onSubmit,
|
|
8847
9363
|
busy = false,
|
|
@@ -8850,7 +9366,7 @@ var Composer = ({
|
|
|
8850
9366
|
placeholder = "Ask the agent to do something\u2026",
|
|
8851
9367
|
className
|
|
8852
9368
|
}) => {
|
|
8853
|
-
const [text2, setText] = (0,
|
|
9369
|
+
const [text2, setText] = (0, import_react23.useState)("");
|
|
8854
9370
|
const submit = () => {
|
|
8855
9371
|
const value = text2.trim();
|
|
8856
9372
|
if (!value || busy || disabled) return;
|
|
@@ -8863,7 +9379,7 @@ var Composer = ({
|
|
|
8863
9379
|
submit();
|
|
8864
9380
|
}
|
|
8865
9381
|
};
|
|
8866
|
-
return /* @__PURE__ */ (0,
|
|
9382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
8867
9383
|
"form",
|
|
8868
9384
|
{
|
|
8869
9385
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -8872,7 +9388,7 @@ var Composer = ({
|
|
|
8872
9388
|
submit();
|
|
8873
9389
|
},
|
|
8874
9390
|
children: [
|
|
8875
|
-
/* @__PURE__ */ (0,
|
|
9391
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
8876
9392
|
"textarea",
|
|
8877
9393
|
{
|
|
8878
9394
|
className: "awr-composer__input",
|
|
@@ -8884,23 +9400,23 @@ var Composer = ({
|
|
|
8884
9400
|
rows: 1
|
|
8885
9401
|
}
|
|
8886
9402
|
),
|
|
8887
|
-
busy ? /* @__PURE__ */ (0,
|
|
9403
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
8888
9404
|
"button",
|
|
8889
9405
|
{
|
|
8890
9406
|
type: "button",
|
|
8891
9407
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
8892
9408
|
onClick: onStop,
|
|
8893
9409
|
"aria-label": "Stop",
|
|
8894
|
-
children: /* @__PURE__ */ (0,
|
|
9410
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StopIcon, { size: 18 })
|
|
8895
9411
|
}
|
|
8896
|
-
) : /* @__PURE__ */ (0,
|
|
9412
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
8897
9413
|
"button",
|
|
8898
9414
|
{
|
|
8899
9415
|
type: "submit",
|
|
8900
9416
|
className: "awr-composer__btn",
|
|
8901
9417
|
disabled: disabled || !text2.trim(),
|
|
8902
9418
|
"aria-label": "Send",
|
|
8903
|
-
children: disabled ? /* @__PURE__ */ (0,
|
|
9419
|
+
children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SendIcon, { size: 18 })
|
|
8904
9420
|
}
|
|
8905
9421
|
)
|
|
8906
9422
|
]
|
|
@@ -8909,17 +9425,17 @@ var Composer = ({
|
|
|
8909
9425
|
};
|
|
8910
9426
|
|
|
8911
9427
|
// src/components/PlanView.tsx
|
|
8912
|
-
var
|
|
9428
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
8913
9429
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
8914
9430
|
if (!plan.steps.length && !plan.thought) return null;
|
|
8915
|
-
return /* @__PURE__ */ (0,
|
|
8916
|
-
showThought && plan.thought.trim() && /* @__PURE__ */ (0,
|
|
8917
|
-
plan.steps.length > 0 && /* @__PURE__ */ (0,
|
|
9431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
9432
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
9433
|
+
plan.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
8918
9434
|
] });
|
|
8919
9435
|
};
|
|
8920
9436
|
|
|
8921
9437
|
// src/components/ApprovalModeSwitch.tsx
|
|
8922
|
-
var
|
|
9438
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
8923
9439
|
var DEFAULT_LABELS = {
|
|
8924
9440
|
autopilot: "Autopilot",
|
|
8925
9441
|
"ask-writes": "Ask before changes",
|
|
@@ -8939,13 +9455,13 @@ var ApprovalModeSwitch = ({
|
|
|
8939
9455
|
labels,
|
|
8940
9456
|
disabled,
|
|
8941
9457
|
className
|
|
8942
|
-
}) => /* @__PURE__ */ (0,
|
|
9458
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8943
9459
|
"div",
|
|
8944
9460
|
{
|
|
8945
9461
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
8946
9462
|
role: "radiogroup",
|
|
8947
9463
|
"aria-label": "Tool consent",
|
|
8948
|
-
children: modes.map((m) => /* @__PURE__ */ (0,
|
|
9464
|
+
children: modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8949
9465
|
"button",
|
|
8950
9466
|
{
|
|
8951
9467
|
type: "button",
|
|
@@ -8963,8 +9479,8 @@ var ApprovalModeSwitch = ({
|
|
|
8963
9479
|
);
|
|
8964
9480
|
|
|
8965
9481
|
// src/components/ApiKeyForm.tsx
|
|
8966
|
-
var
|
|
8967
|
-
var
|
|
9482
|
+
var import_react24 = require("react");
|
|
9483
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
8968
9484
|
var ApiKeyForm = ({
|
|
8969
9485
|
credentials,
|
|
8970
9486
|
credentialRef,
|
|
@@ -8973,10 +9489,10 @@ var ApiKeyForm = ({
|
|
|
8973
9489
|
onChange,
|
|
8974
9490
|
className
|
|
8975
9491
|
}) => {
|
|
8976
|
-
const [value, setValue] = (0,
|
|
8977
|
-
const [present, setPresent] = (0,
|
|
8978
|
-
const [busy, setBusy] = (0,
|
|
8979
|
-
(0,
|
|
9492
|
+
const [value, setValue] = (0, import_react24.useState)("");
|
|
9493
|
+
const [present, setPresent] = (0, import_react24.useState)(false);
|
|
9494
|
+
const [busy, setBusy] = (0, import_react24.useState)(false);
|
|
9495
|
+
(0, import_react24.useEffect)(() => {
|
|
8980
9496
|
let active = true;
|
|
8981
9497
|
credentials.hasKey(credentialRef).then((has) => {
|
|
8982
9498
|
if (active) setPresent(has);
|
|
@@ -9008,16 +9524,16 @@ var ApiKeyForm = ({
|
|
|
9008
9524
|
setBusy(false);
|
|
9009
9525
|
}
|
|
9010
9526
|
};
|
|
9011
|
-
return /* @__PURE__ */ (0,
|
|
9012
|
-
/* @__PURE__ */ (0,
|
|
9527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
9528
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "awr-keyform__label", children: [
|
|
9013
9529
|
label,
|
|
9014
|
-
present && /* @__PURE__ */ (0,
|
|
9015
|
-
/* @__PURE__ */ (0,
|
|
9530
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "awr-keyform__saved", children: [
|
|
9531
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckIcon, { size: 12 }),
|
|
9016
9532
|
" stored, encrypted"
|
|
9017
9533
|
] })
|
|
9018
9534
|
] }),
|
|
9019
|
-
/* @__PURE__ */ (0,
|
|
9020
|
-
/* @__PURE__ */ (0,
|
|
9535
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "awr-keyform__row", children: [
|
|
9536
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9021
9537
|
"input",
|
|
9022
9538
|
{
|
|
9023
9539
|
className: "awr-keyform__input",
|
|
@@ -9035,7 +9551,7 @@ var ApiKeyForm = ({
|
|
|
9035
9551
|
disabled: busy
|
|
9036
9552
|
}
|
|
9037
9553
|
),
|
|
9038
|
-
/* @__PURE__ */ (0,
|
|
9554
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9039
9555
|
"button",
|
|
9040
9556
|
{
|
|
9041
9557
|
type: "button",
|
|
@@ -9045,7 +9561,7 @@ var ApiKeyForm = ({
|
|
|
9045
9561
|
children: "Save"
|
|
9046
9562
|
}
|
|
9047
9563
|
),
|
|
9048
|
-
present && /* @__PURE__ */ (0,
|
|
9564
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9049
9565
|
"button",
|
|
9050
9566
|
{
|
|
9051
9567
|
type: "button",
|
|
@@ -9066,6 +9582,7 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
9066
9582
|
APP_DEFAULT_HEIGHT,
|
|
9067
9583
|
APP_MAX_HEIGHT,
|
|
9068
9584
|
APP_MIN_HEIGHT,
|
|
9585
|
+
ASK_USER_TOOL_NAME,
|
|
9069
9586
|
AgentChat,
|
|
9070
9587
|
AgentComposer,
|
|
9071
9588
|
AgentLabelsProvider,
|
|
@@ -9129,6 +9646,8 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
9129
9646
|
MessageList,
|
|
9130
9647
|
ModelLoadBar,
|
|
9131
9648
|
PlanView,
|
|
9649
|
+
QUESTION_TIMEOUT_MS,
|
|
9650
|
+
QuestionPrompt,
|
|
9132
9651
|
SandboxedFrame,
|
|
9133
9652
|
SessionBusyError,
|
|
9134
9653
|
SourceView,
|
|
@@ -9155,6 +9674,8 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
9155
9674
|
appMessageTextOf,
|
|
9156
9675
|
appMimeTypeOf,
|
|
9157
9676
|
appSamplingErrorOf,
|
|
9677
|
+
askUserOutputKept,
|
|
9678
|
+
askUserWith,
|
|
9158
9679
|
attachmentKindOf,
|
|
9159
9680
|
attachmentRefusal,
|
|
9160
9681
|
buildMcpAppDocument,
|
|
@@ -9167,6 +9688,7 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
9167
9688
|
createApprovalQueue,
|
|
9168
9689
|
createFileTools,
|
|
9169
9690
|
createInitialAgentState,
|
|
9691
|
+
createQuestionQueue,
|
|
9170
9692
|
createRunControl,
|
|
9171
9693
|
createSubagentTool,
|
|
9172
9694
|
createWebLLMEngine,
|
|
@@ -9213,6 +9735,9 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
9213
9735
|
pendingApprovalsOf,
|
|
9214
9736
|
postStorageChange,
|
|
9215
9737
|
preloadWebLLMModel,
|
|
9738
|
+
questionChoiceOf,
|
|
9739
|
+
questionOtherOf,
|
|
9740
|
+
questionTimeoutOf,
|
|
9216
9741
|
resolveAppDownload,
|
|
9217
9742
|
sandboxTokens,
|
|
9218
9743
|
sandboxedCsp,
|
|
@@ -9243,6 +9768,7 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
|
|
|
9243
9768
|
webSearchOf,
|
|
9244
9769
|
withAttachments,
|
|
9245
9770
|
withCspFirst,
|
|
9246
|
-
withPolicyFirst
|
|
9771
|
+
withPolicyFirst,
|
|
9772
|
+
withoutOwnWords
|
|
9247
9773
|
});
|
|
9248
9774
|
//# sourceMappingURL=index.cjs.map
|