@dudko.dev/agent-web-react 0.0.19 → 0.0.21
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 +10 -2
- package/dist/index.cjs +396 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +244 -10
- package/dist/index.d.ts +244 -10
- package/dist/index.js +394 -54
- package/dist/index.js.map +1 -1
- package/dist/styles.css +203 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/hooks/use-agent.ts
|
|
2
2
|
import { useCallback, useEffect, useReducer, useRef, useState } from "react";
|
|
3
3
|
import {
|
|
4
|
-
createAgent
|
|
4
|
+
createAgent,
|
|
5
|
+
createRunControl
|
|
5
6
|
} from "@dudko.dev/agent-web";
|
|
6
7
|
|
|
7
8
|
// src/state.ts
|
|
@@ -31,6 +32,13 @@ var addUsage = (a, b) => ({
|
|
|
31
32
|
cachedInputTokens: (a.cachedInputTokens ?? 0) + (b.cachedInputTokens ?? 0),
|
|
32
33
|
cacheWriteTokens: (a.cacheWriteTokens ?? 0) + (b.cacheWriteTokens ?? 0)
|
|
33
34
|
});
|
|
35
|
+
var lessonsOf = (skills) => skills.filter((s) => s.origin?.kind === "learned").map((s) => ({
|
|
36
|
+
name: s.name,
|
|
37
|
+
description: s.description,
|
|
38
|
+
revision: s.origin?.revision ?? 1,
|
|
39
|
+
chars: s.content.length,
|
|
40
|
+
sources: [...s.origin?.sources ?? [], ...s.origin?.fetched ?? []]
|
|
41
|
+
}));
|
|
34
42
|
var createInitialAgentState = () => ({
|
|
35
43
|
status: "idle",
|
|
36
44
|
goal: void 0,
|
|
@@ -44,7 +52,13 @@ var createInitialAgentState = () => ({
|
|
|
44
52
|
runMessageId: void 0,
|
|
45
53
|
approvals: [],
|
|
46
54
|
subagents: [],
|
|
55
|
+
queued: [],
|
|
56
|
+
notes: [],
|
|
57
|
+
undelivered: [],
|
|
47
58
|
skills: [],
|
|
59
|
+
learned: [],
|
|
60
|
+
learnedNow: [],
|
|
61
|
+
fetches: [],
|
|
48
62
|
discoveredTools: [],
|
|
49
63
|
compactions: [],
|
|
50
64
|
budget: void 0,
|
|
@@ -62,7 +76,8 @@ var resetRun = (state) => ({
|
|
|
62
76
|
status: state.status,
|
|
63
77
|
messages: state.messages,
|
|
64
78
|
totalUsage: state.totalUsage,
|
|
65
|
-
seq: state.seq
|
|
79
|
+
seq: state.seq,
|
|
80
|
+
learned: state.learned
|
|
66
81
|
});
|
|
67
82
|
var patchStep = (steps, id, fn) => steps.map((s) => s.id === id ? fn(s) : s);
|
|
68
83
|
var patchApproval = (approvals, id, fn) => approvals.map((a) => a.id === id ? fn(a) : a);
|
|
@@ -147,7 +162,16 @@ var applyEvent = (state, event, ctx) => {
|
|
|
147
162
|
planThought: state.planThought || event.plan.thought
|
|
148
163
|
};
|
|
149
164
|
case "plan.revised":
|
|
150
|
-
return {
|
|
165
|
+
return {
|
|
166
|
+
...state,
|
|
167
|
+
plan: event.plan,
|
|
168
|
+
// `replan.decision` came first: keep its "because the user spoke" flag.
|
|
169
|
+
replan: {
|
|
170
|
+
mode: "revise",
|
|
171
|
+
reason: event.reason,
|
|
172
|
+
...state.replan?.byUser ? { byUser: true } : {}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
151
175
|
case "plan.step-added":
|
|
152
176
|
return state;
|
|
153
177
|
case "step.start": {
|
|
@@ -247,7 +271,27 @@ var applyEvent = (state, event, ctx) => {
|
|
|
247
271
|
}))
|
|
248
272
|
};
|
|
249
273
|
case "replan.decision":
|
|
250
|
-
return {
|
|
274
|
+
return {
|
|
275
|
+
...state,
|
|
276
|
+
replan: {
|
|
277
|
+
mode: event.mode,
|
|
278
|
+
reason: event.reason,
|
|
279
|
+
...event.byUser ? { byUser: true } : {}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
case "message.queued":
|
|
283
|
+
return state.queued.some((q) => q.id === event.id) ? state : { ...state, queued: [...state.queued, { id: event.id, text: event.text }] };
|
|
284
|
+
case "message.delivered": {
|
|
285
|
+
const anchor = event.at === "round" ? runningStepId(state.steps) : event.at === "step" ? state.steps[state.steps.length - 1]?.id : void 0;
|
|
286
|
+
return {
|
|
287
|
+
...state,
|
|
288
|
+
queued: state.queued.filter((q) => q.id !== event.id),
|
|
289
|
+
notes: [
|
|
290
|
+
...state.notes,
|
|
291
|
+
{ id: event.id, text: event.text, at: event.at, ...anchor ? { stepId: anchor } : {} }
|
|
292
|
+
]
|
|
293
|
+
};
|
|
294
|
+
}
|
|
251
295
|
case "final.text-delta": {
|
|
252
296
|
const finalText = state.finalText + event.delta;
|
|
253
297
|
return { ...state, finalText, messages: streamAssistant(state.messages, finalText) };
|
|
@@ -317,6 +361,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
317
361
|
name: event.name,
|
|
318
362
|
task: event.task,
|
|
319
363
|
status: "running",
|
|
364
|
+
...event.profile ? { profile: event.profile } : {},
|
|
320
365
|
stepId: runningStepId(state.steps),
|
|
321
366
|
activity: "starting",
|
|
322
367
|
steps: 0,
|
|
@@ -351,13 +396,45 @@ var applyEvent = (state, event, ctx) => {
|
|
|
351
396
|
...state,
|
|
352
397
|
subagents: patchSubagent(state.subagents, event.id, (s) => ({
|
|
353
398
|
...s,
|
|
354
|
-
status: "error",
|
|
355
|
-
activity: "failed",
|
|
399
|
+
status: event.stopped ? "stopped" : "error",
|
|
400
|
+
activity: event.stopped ? "stopped" : "failed",
|
|
356
401
|
error: event.error
|
|
357
402
|
}))
|
|
358
403
|
};
|
|
359
404
|
case "skill.activated":
|
|
360
405
|
return state.skills.includes(event.name) ? state : { ...state, skills: [...state.skills, event.name] };
|
|
406
|
+
case "skill.learned": {
|
|
407
|
+
const before = state.learned.find((l) => l.name === event.name);
|
|
408
|
+
const lesson = {
|
|
409
|
+
name: event.name,
|
|
410
|
+
description: event.description,
|
|
411
|
+
// A rewrite of a lesson we know goes up one; a lesson we never saw (an event for a store
|
|
412
|
+
// loaded before this view existed) starts at 2 when the core says it is an update.
|
|
413
|
+
revision: event.update ? (before?.revision ?? 1) + 1 : 1,
|
|
414
|
+
chars: event.chars,
|
|
415
|
+
sources: event.sources
|
|
416
|
+
};
|
|
417
|
+
return {
|
|
418
|
+
...state,
|
|
419
|
+
learned: before ? state.learned.map((l) => l.name === event.name ? lesson : l) : [...state.learned, lesson],
|
|
420
|
+
learnedNow: state.learnedNow.includes(event.name) ? state.learnedNow : [...state.learnedNow, event.name]
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
case "skill.forgotten":
|
|
424
|
+
return { ...state, learned: state.learned.filter((l) => l.name !== event.name) };
|
|
425
|
+
case "egress.request":
|
|
426
|
+
return {
|
|
427
|
+
...state,
|
|
428
|
+
fetches: [
|
|
429
|
+
...state.fetches,
|
|
430
|
+
{
|
|
431
|
+
url: event.url,
|
|
432
|
+
allowed: event.allowed,
|
|
433
|
+
...event.status !== void 0 ? { status: event.status } : {},
|
|
434
|
+
...event.reason ? { reason: event.reason } : {}
|
|
435
|
+
}
|
|
436
|
+
]
|
|
437
|
+
};
|
|
361
438
|
case "tools.discovered":
|
|
362
439
|
return {
|
|
363
440
|
...state,
|
|
@@ -413,9 +490,13 @@ var syncRunMessage = (state) => {
|
|
|
413
490
|
const patch = {};
|
|
414
491
|
if (m.steps !== state.steps) patch.steps = state.steps;
|
|
415
492
|
if (m.subagents !== state.subagents) patch.subagents = state.subagents;
|
|
493
|
+
if (state.notes.length > 0 && m.notes !== state.notes) patch.notes = state.notes;
|
|
416
494
|
if (m.usage !== state.usage) patch.usage = state.usage;
|
|
417
495
|
if ((m.reasoning ?? "") !== state.finalReasoning) patch.reasoning = state.finalReasoning;
|
|
418
496
|
if (m.skills !== state.skills) patch.skills = state.skills;
|
|
497
|
+
if (state.learnedNow.length > 0 && m.learned !== state.learnedNow)
|
|
498
|
+
patch.learned = state.learnedNow;
|
|
499
|
+
if (state.fetches.length > 0 && m.fetches !== state.fetches) patch.fetches = state.fetches;
|
|
419
500
|
if ((m.approvals?.length ?? 0) !== decided.length || decided.some((a, k) => m.approvals?.[k] !== a)) {
|
|
420
501
|
patch.approvals = decided;
|
|
421
502
|
}
|
|
@@ -427,7 +508,14 @@ var syncRunMessage = (state) => {
|
|
|
427
508
|
var agentStateReducer = (state, action) => {
|
|
428
509
|
switch (action.type) {
|
|
429
510
|
case "reset":
|
|
430
|
-
return {
|
|
511
|
+
return {
|
|
512
|
+
...createInitialAgentState(),
|
|
513
|
+
status: state.status,
|
|
514
|
+
seq: state.seq,
|
|
515
|
+
learned: state.learned
|
|
516
|
+
};
|
|
517
|
+
case "notebook":
|
|
518
|
+
return { ...state, learned: action.lessons };
|
|
431
519
|
case "status":
|
|
432
520
|
return {
|
|
433
521
|
...state,
|
|
@@ -442,6 +530,8 @@ var agentStateReducer = (state, action) => {
|
|
|
442
530
|
const events = cap > 0 ? [...state.events, action.event].slice(-cap) : [...state.events, action.event];
|
|
443
531
|
return { ...next, events };
|
|
444
532
|
}
|
|
533
|
+
case "undelivered":
|
|
534
|
+
return { ...state, queued: [], undelivered: action.texts };
|
|
445
535
|
case "load": {
|
|
446
536
|
const maxSeq = action.messages.reduce((n, m) => {
|
|
447
537
|
const k = Number(/^msg-(\d+)$/.exec(m.id)?.[1] ?? -1);
|
|
@@ -452,7 +542,8 @@ var agentStateReducer = (state, action) => {
|
|
|
452
542
|
status: state.status,
|
|
453
543
|
messages: action.messages.map((m) => m.pending ? { ...m, pending: false } : m),
|
|
454
544
|
totalUsage: action.totalUsage ?? emptyUsage(),
|
|
455
|
-
seq: maxSeq
|
|
545
|
+
seq: maxSeq,
|
|
546
|
+
learned: state.learned
|
|
456
547
|
};
|
|
457
548
|
}
|
|
458
549
|
default:
|
|
@@ -468,6 +559,9 @@ var useAgent = (config, options = {}) => {
|
|
|
468
559
|
const [state, dispatch] = useReducer(agentStateReducer, void 0, createInitialAgentState);
|
|
469
560
|
const agentRef = useRef(void 0);
|
|
470
561
|
const abortRef = useRef(void 0);
|
|
562
|
+
const controlRef = useRef(void 0);
|
|
563
|
+
const stateRef = useRef(state);
|
|
564
|
+
stateRef.current = state;
|
|
471
565
|
const [generation, setGeneration] = useState(0);
|
|
472
566
|
const configRef = useRef(config);
|
|
473
567
|
configRef.current = config;
|
|
@@ -524,6 +618,7 @@ var useAgent = (config, options = {}) => {
|
|
|
524
618
|
if (cancelled) return;
|
|
525
619
|
agent.setToolApprovalMode(modeRef.current);
|
|
526
620
|
agentRef.current = agent;
|
|
621
|
+
dispatch({ type: "notebook", lessons: lessonsOf(agent.listLearnedSkills()) });
|
|
527
622
|
setBuildStatus({ status: "ready" });
|
|
528
623
|
}).catch((err) => {
|
|
529
624
|
if (cancelled) return;
|
|
@@ -540,16 +635,21 @@ var useAgent = (config, options = {}) => {
|
|
|
540
635
|
},
|
|
541
636
|
[settleAll]
|
|
542
637
|
);
|
|
638
|
+
const runRef = useRef(void 0);
|
|
543
639
|
const run = useCallback(
|
|
544
640
|
async (goal, runOptions) => {
|
|
545
641
|
const agent = agentRef.current;
|
|
546
642
|
if (!agent || abortRef.current) return void 0;
|
|
547
643
|
const controller = new AbortController();
|
|
548
644
|
abortRef.current = controller;
|
|
645
|
+
const control = createRunControl();
|
|
646
|
+
controlRef.current = control;
|
|
647
|
+
let left = [];
|
|
549
648
|
dispatch({ type: "status", status: "running" });
|
|
550
649
|
try {
|
|
551
|
-
|
|
650
|
+
const result = await agent.run(goal, {
|
|
552
651
|
signal: controller.signal,
|
|
652
|
+
control,
|
|
553
653
|
sessionId: sessionRef.current,
|
|
554
654
|
...runOptions?.images?.length ? { images: runOptions.images } : {},
|
|
555
655
|
...runOptions?.files?.length ? { files: runOptions.files } : {},
|
|
@@ -569,7 +669,10 @@ var useAgent = (config, options = {}) => {
|
|
|
569
669
|
}
|
|
570
670
|
}
|
|
571
671
|
});
|
|
672
|
+
left = result.undelivered ?? [];
|
|
673
|
+
return result;
|
|
572
674
|
} catch (err) {
|
|
675
|
+
left = control.pending();
|
|
573
676
|
dispatch({
|
|
574
677
|
type: "event",
|
|
575
678
|
event: { type: "error", phase: "run", error: errMessage(err) },
|
|
@@ -578,12 +681,36 @@ var useAgent = (config, options = {}) => {
|
|
|
578
681
|
return void 0;
|
|
579
682
|
} finally {
|
|
580
683
|
abortRef.current = void 0;
|
|
684
|
+
controlRef.current = void 0;
|
|
581
685
|
settleAll({ approved: false, reason: "the run ended" });
|
|
582
686
|
dispatch({ type: "status", ...buildStatusRef.current });
|
|
687
|
+
if (left.length > 0) {
|
|
688
|
+
if (!controller.signal.aborted && optionsRef.current.followUp !== false) {
|
|
689
|
+
dispatch({ type: "undelivered", texts: [] });
|
|
690
|
+
void runRef.current?.(left.join("\n\n"));
|
|
691
|
+
} else {
|
|
692
|
+
dispatch({ type: "undelivered", texts: left });
|
|
693
|
+
}
|
|
694
|
+
} else {
|
|
695
|
+
dispatch({ type: "undelivered", texts: [] });
|
|
696
|
+
}
|
|
583
697
|
}
|
|
584
698
|
},
|
|
585
699
|
[settleAll]
|
|
586
700
|
);
|
|
701
|
+
runRef.current = run;
|
|
702
|
+
const send = useCallback((text) => controlRef.current?.send(text) ?? false, []);
|
|
703
|
+
const stopSubagent = useCallback(
|
|
704
|
+
(id) => controlRef.current?.stopSubagent(id) ?? false,
|
|
705
|
+
[]
|
|
706
|
+
);
|
|
707
|
+
const sendUndelivered = useCallback(() => {
|
|
708
|
+
const texts = stateRef.current.undelivered;
|
|
709
|
+
if (texts.length === 0) return;
|
|
710
|
+
dispatch({ type: "undelivered", texts: [] });
|
|
711
|
+
void runRef.current?.(texts.join("\n\n"));
|
|
712
|
+
}, []);
|
|
713
|
+
const discardUndelivered = useCallback(() => dispatch({ type: "undelivered", texts: [] }), []);
|
|
587
714
|
const stop = useCallback(() => {
|
|
588
715
|
abortRef.current?.abort();
|
|
589
716
|
settleAll({ approved: false, reason: "stopped by the user" });
|
|
@@ -602,6 +729,14 @@ var useAgent = (config, options = {}) => {
|
|
|
602
729
|
},
|
|
603
730
|
[]
|
|
604
731
|
);
|
|
732
|
+
const forgetSkill = useCallback(async (name) => {
|
|
733
|
+
const agent = agentRef.current;
|
|
734
|
+
if (!agent) return false;
|
|
735
|
+
return agent.forgetSkill(
|
|
736
|
+
name,
|
|
737
|
+
(event) => dispatch({ type: "event", event, maxEvents: optionsRef.current.maxEvents, at: Date.now() })
|
|
738
|
+
);
|
|
739
|
+
}, []);
|
|
605
740
|
const approve = useCallback((id, opts) => {
|
|
606
741
|
const resolve = resolversRef.current.get(id);
|
|
607
742
|
if (!resolve) return;
|
|
@@ -637,6 +772,11 @@ var useAgent = (config, options = {}) => {
|
|
|
637
772
|
...state,
|
|
638
773
|
run,
|
|
639
774
|
stop,
|
|
775
|
+
send,
|
|
776
|
+
stopSubagent,
|
|
777
|
+
forgetSkill,
|
|
778
|
+
sendUndelivered,
|
|
779
|
+
discardUndelivered,
|
|
640
780
|
reset,
|
|
641
781
|
reload,
|
|
642
782
|
agent: agentRef.current,
|
|
@@ -1108,6 +1248,13 @@ var parseSlash = (text) => {
|
|
|
1108
1248
|
const m = /^\/([\w-]*)(?:\s+([\s\S]*))?$/.exec(text.trimStart());
|
|
1109
1249
|
return m ? { name: m[1].toLowerCase(), args: (m[2] ?? "").trim() } : void 0;
|
|
1110
1250
|
};
|
|
1251
|
+
var steerIntent = (input) => {
|
|
1252
|
+
if (!input.busy) return "idle";
|
|
1253
|
+
if (!input.steering) return "ignore";
|
|
1254
|
+
if (!input.raw && !input.hasAttachments) return "ignore";
|
|
1255
|
+
if (parseSlash(input.raw)) return "ignore";
|
|
1256
|
+
return input.hasAttachments ? "attachments" : "steer";
|
|
1257
|
+
};
|
|
1111
1258
|
var filterCommands = (commands, query) => {
|
|
1112
1259
|
const q = query.toLowerCase();
|
|
1113
1260
|
if (!q) return commands;
|
|
@@ -1223,12 +1370,20 @@ var defaultLabels = {
|
|
|
1223
1370
|
toolCalls: (n) => plural(n, "tool call", "tool calls"),
|
|
1224
1371
|
subagents: (n) => plural(n, "subagent", "subagents"),
|
|
1225
1372
|
skillsUsed: (names) => `skills: ${names}`,
|
|
1373
|
+
learnedNow: (names) => `learned: ${names}`,
|
|
1374
|
+
fetches: (n) => plural(n, "web request", "web requests"),
|
|
1375
|
+
fetchRefused: (reason) => `refused: ${reason}`,
|
|
1226
1376
|
answerThoughts: "Thinking about the answer",
|
|
1227
1377
|
stepThoughts: "Thoughts",
|
|
1228
1378
|
usageTitle: "Tokens this answer spent, by kind",
|
|
1229
1379
|
attachments: "Attachments",
|
|
1230
1380
|
planned: "Plan",
|
|
1231
1381
|
replanned: (mode, reason) => `Replanned (${mode}): ${reason}`,
|
|
1382
|
+
notebookTitle: "Notebook",
|
|
1383
|
+
notebookEmpty: "The agent has not written any lessons down yet.",
|
|
1384
|
+
notebookForget: "Forget",
|
|
1385
|
+
notebookRevision: (n) => `revision ${n}`,
|
|
1386
|
+
notebookFrom: "from",
|
|
1232
1387
|
placeholder: "Ask the agent to do something\u2026 ( / for commands, Ctrl+V to paste an image )",
|
|
1233
1388
|
listening: "Listening\u2026",
|
|
1234
1389
|
message: "Message",
|
|
@@ -1305,6 +1460,20 @@ var defaultLabels = {
|
|
|
1305
1460
|
consentWaiting: "waiting for your consent",
|
|
1306
1461
|
consentAllowed: "allowed",
|
|
1307
1462
|
consentDenied: (reason) => `denied${reason ? ` \u2014 ${reason}` : ""}`,
|
|
1463
|
+
placeholderBusy: "Tell the agent something while it works\u2026",
|
|
1464
|
+
steer: "Send to the agent",
|
|
1465
|
+
noAttachmentsWhileBusy: "Files can\u2019t be added while the agent is working \u2014 send them with your next message.",
|
|
1466
|
+
queuedWaiting: "waiting for the agent\u2019s next step",
|
|
1467
|
+
noteAt: {
|
|
1468
|
+
round: "you said, between tool calls",
|
|
1469
|
+
step: "you said, after this step",
|
|
1470
|
+
final: "you said, before the answer"
|
|
1471
|
+
},
|
|
1472
|
+
undelivered: (n) => `Not delivered (${plural(n, "message", "messages")})`,
|
|
1473
|
+
sendUndelivered: "Send now",
|
|
1474
|
+
discardUndelivered: "Discard",
|
|
1475
|
+
stopSubagent: "Stop this subagent",
|
|
1476
|
+
subagentStopped: "stopped",
|
|
1308
1477
|
failed: "failed",
|
|
1309
1478
|
toolCostTitle: "Estimated tokens of the arguments and of the result fed back to the model (chars / 4), and the call's duration"
|
|
1310
1479
|
};
|
|
@@ -1313,7 +1482,8 @@ var NESTED = [
|
|
|
1313
1482
|
"modes",
|
|
1314
1483
|
"commandGroups",
|
|
1315
1484
|
"commandDescriptions",
|
|
1316
|
-
"thinkingLevels"
|
|
1485
|
+
"thinkingLevels",
|
|
1486
|
+
"noteAt"
|
|
1317
1487
|
];
|
|
1318
1488
|
var mergeLabels = (base2, over) => {
|
|
1319
1489
|
if (!over) return base2;
|
|
@@ -1467,6 +1637,14 @@ var HistoryIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base
|
|
|
1467
1637
|
/* @__PURE__ */ jsx3("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
|
|
1468
1638
|
/* @__PURE__ */ jsx3("path", { d: "M3 3v5h5M12 7v5l3 2" })
|
|
1469
1639
|
] });
|
|
1640
|
+
var BookIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1641
|
+
/* @__PURE__ */ jsx3("path", { d: "M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2Z" }),
|
|
1642
|
+
/* @__PURE__ */ jsx3("path", { d: "M4 19V5M9 7h6" })
|
|
1643
|
+
] });
|
|
1644
|
+
var GlobeIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1645
|
+
/* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "9" }),
|
|
1646
|
+
/* @__PURE__ */ jsx3("path", { d: "M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18" })
|
|
1647
|
+
] });
|
|
1470
1648
|
var DownloadIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className, children: /* @__PURE__ */ jsx3("path", { d: "M12 3v12m-5-5 5 5 5-5M5 21h14" }) });
|
|
1471
1649
|
|
|
1472
1650
|
// src/components/AgentComposer.tsx
|
|
@@ -1548,6 +1726,8 @@ var AgentComposer = ({
|
|
|
1548
1726
|
showAgents = true,
|
|
1549
1727
|
showApprovalMode = true,
|
|
1550
1728
|
showNotices = true,
|
|
1729
|
+
steering = true,
|
|
1730
|
+
showQueued = true,
|
|
1551
1731
|
compactWidth = 460,
|
|
1552
1732
|
toolbarExtra,
|
|
1553
1733
|
toolbarEnd,
|
|
@@ -1825,7 +2005,17 @@ var AgentComposer = ({
|
|
|
1825
2005
|
}, [attachments, dropZone]);
|
|
1826
2006
|
const submit = () => {
|
|
1827
2007
|
const raw = text.trim();
|
|
1828
|
-
|
|
2008
|
+
const intent = steerIntent({ raw, busy, steering, hasAttachments: pending.length > 0 });
|
|
2009
|
+
if (intent === "steer") {
|
|
2010
|
+
if (agent.send(raw)) setText("");
|
|
2011
|
+
return;
|
|
2012
|
+
}
|
|
2013
|
+
if (intent === "attachments") {
|
|
2014
|
+
setAttachError(L.noAttachmentsWhileBusy);
|
|
2015
|
+
return;
|
|
2016
|
+
}
|
|
2017
|
+
if (intent === "ignore") return;
|
|
2018
|
+
if (!ready) return;
|
|
1829
2019
|
const parsed = parseSlash(raw);
|
|
1830
2020
|
if (parsed) {
|
|
1831
2021
|
const cmd = allCommands.find((c) => c.name === parsed.name);
|
|
@@ -1923,6 +2113,24 @@ var AgentComposer = ({
|
|
|
1923
2113
|
const thinkingOptions = thinking?.options ?? DEFAULT_THINKING;
|
|
1924
2114
|
const thinkingLabel = thinking ? thinkingOptions.find((o) => o.id === thinking.value)?.label ?? thinking.value : void 0;
|
|
1925
2115
|
const canSend = ready && (text.trim().length > 0 || pending.length > 0);
|
|
2116
|
+
const canSteer = busy && steering && text.trim().length > 0;
|
|
2117
|
+
const queuedStrip = showQueued && (agent.queued.length > 0 || agent.undelivered.length > 0) ? /* @__PURE__ */ jsxs2("div", { className: "awr-queued", children: [
|
|
2118
|
+
agent.queued.map((q) => /* @__PURE__ */ jsxs2("div", { className: "awr-queued__item", role: "status", children: [
|
|
2119
|
+
/* @__PURE__ */ jsx4(ClockIcon, { size: 13, className: "awr-queued__icon" }),
|
|
2120
|
+
/* @__PURE__ */ jsx4("span", { className: "awr-queued__text", title: q.text, children: q.text }),
|
|
2121
|
+
/* @__PURE__ */ jsx4("span", { className: "awr-queued__state", children: L.queuedWaiting })
|
|
2122
|
+
] }, q.id)),
|
|
2123
|
+
agent.undelivered.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "awr-queued__item awr-queued__item--undelivered", role: "status", children: [
|
|
2124
|
+
/* @__PURE__ */ jsx4(AlertIcon, { size: 13, className: "awr-queued__icon" }),
|
|
2125
|
+
/* @__PURE__ */ jsxs2("span", { className: "awr-queued__text", title: agent.undelivered.join("\n\n"), children: [
|
|
2126
|
+
L.undelivered(agent.undelivered.length),
|
|
2127
|
+
": ",
|
|
2128
|
+
agent.undelivered.join(" \xB7 ")
|
|
2129
|
+
] }),
|
|
2130
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "awr-linkbtn", onClick: agent.sendUndelivered, children: L.sendUndelivered }),
|
|
2131
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "awr-linkbtn", onClick: agent.discardUndelivered, children: L.discardUndelivered })
|
|
2132
|
+
] })
|
|
2133
|
+
] }) : null;
|
|
1926
2134
|
return /* @__PURE__ */ jsxs2(
|
|
1927
2135
|
"div",
|
|
1928
2136
|
{
|
|
@@ -1935,6 +2143,7 @@ var AgentComposer = ({
|
|
|
1935
2143
|
ref: rootRef,
|
|
1936
2144
|
children: [
|
|
1937
2145
|
dragging && /* @__PURE__ */ jsx4("div", { className: "awr-dropnote", style: dropRect, "aria-hidden": "true", children: L.dropHint }),
|
|
2146
|
+
queuedStrip,
|
|
1938
2147
|
notices.length > 0 && /* @__PURE__ */ jsx4("div", { className: "awr-notices", children: notices.map((n) => /* @__PURE__ */ jsxs2("div", { className: `awr-notice awr-notice--${n.tone}`, role: "status", children: [
|
|
1939
2148
|
/* @__PURE__ */ jsx4("span", { children: n.text }),
|
|
1940
2149
|
/* @__PURE__ */ jsx4(
|
|
@@ -2007,7 +2216,7 @@ var AgentComposer = ({
|
|
|
2007
2216
|
onChange: (e) => setText(e.target.value),
|
|
2008
2217
|
onKeyDown,
|
|
2009
2218
|
onPaste,
|
|
2010
|
-
placeholder: stt.listening ? L.listening : placeholder ?? L.placeholder,
|
|
2219
|
+
placeholder: stt.listening ? L.listening : busy && steering ? L.placeholderBusy : placeholder ?? L.placeholder,
|
|
2011
2220
|
disabled,
|
|
2012
2221
|
rows: 2,
|
|
2013
2222
|
"aria-label": L.message
|
|
@@ -2184,6 +2393,7 @@ var AgentComposer = ({
|
|
|
2184
2393
|
))
|
|
2185
2394
|
] })
|
|
2186
2395
|
] }),
|
|
2396
|
+
canSteer && /* @__PURE__ */ jsx4("button", { type: "button", className: "awr-sendbtn", onClick: submit, "aria-label": L.steer, children: /* @__PURE__ */ jsx4(SendIcon, { size: 16 }) }),
|
|
2187
2397
|
busy ? /* @__PURE__ */ jsx4(
|
|
2188
2398
|
"button",
|
|
2189
2399
|
{
|
|
@@ -2558,6 +2768,7 @@ var ToolCallRow = ({ call, showUsage = true, labels }) => {
|
|
|
2558
2768
|
};
|
|
2559
2769
|
var SubagentRow = ({
|
|
2560
2770
|
sub,
|
|
2771
|
+
onStop,
|
|
2561
2772
|
labels
|
|
2562
2773
|
}) => {
|
|
2563
2774
|
const L = useLabels(labels);
|
|
@@ -2565,10 +2776,33 @@ var SubagentRow = ({
|
|
|
2565
2776
|
/* @__PURE__ */ jsxs6("div", { className: "awr-subagent__head", children: [
|
|
2566
2777
|
/* @__PURE__ */ jsx8(BotIcon, { size: 13, className: "awr-subagent__icon" }),
|
|
2567
2778
|
/* @__PURE__ */ jsx8("span", { className: "awr-subagent__name", children: sub.name }),
|
|
2779
|
+
sub.profile && /* @__PURE__ */ jsx8("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
2568
2780
|
/* @__PURE__ */ jsx8("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
2569
|
-
sub.status === "running" && /* @__PURE__ */ jsx8(SpinnerIcon, { size: 12, className: "awr-tool__spin" })
|
|
2781
|
+
sub.status === "running" && /* @__PURE__ */ jsx8(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
2782
|
+
sub.status === "running" && onStop && /* @__PURE__ */ jsx8(
|
|
2783
|
+
"button",
|
|
2784
|
+
{
|
|
2785
|
+
type: "button",
|
|
2786
|
+
className: "awr-iconbtn awr-subagent__stop",
|
|
2787
|
+
"aria-label": L.stopSubagent,
|
|
2788
|
+
title: L.stopSubagent,
|
|
2789
|
+
onClick: () => onStop(sub.id),
|
|
2790
|
+
children: /* @__PURE__ */ jsx8(StopIcon, { size: 12 })
|
|
2791
|
+
}
|
|
2792
|
+
)
|
|
2570
2793
|
] }),
|
|
2571
|
-
/* @__PURE__ */ jsx8("div", { className: "awr-subagent__activity", children: sub.status === "error" ? sub.error : sub.status === "done" ? previewValue(sub.text, 160) : `${sub.activity}${sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` })
|
|
2794
|
+
/* @__PURE__ */ jsx8("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}${sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` })
|
|
2795
|
+
] });
|
|
2796
|
+
};
|
|
2797
|
+
var UserNoteRow = ({
|
|
2798
|
+
note,
|
|
2799
|
+
labels
|
|
2800
|
+
}) => {
|
|
2801
|
+
const L = useLabels(labels);
|
|
2802
|
+
return /* @__PURE__ */ jsxs6("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
2803
|
+
/* @__PURE__ */ jsx8(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
2804
|
+
/* @__PURE__ */ jsx8("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
2805
|
+
/* @__PURE__ */ jsx8("q", { className: "awr-note__text", children: note.text })
|
|
2572
2806
|
] });
|
|
2573
2807
|
};
|
|
2574
2808
|
var decisionLabel = (a, L) => a.status === "pending" ? L.consentWaiting : a.status === "approved" ? L.consentAllowed : L.consentDenied(a.reason);
|
|
@@ -2576,6 +2810,8 @@ var StepItem = ({
|
|
|
2576
2810
|
step,
|
|
2577
2811
|
subagents,
|
|
2578
2812
|
approvals,
|
|
2813
|
+
notes,
|
|
2814
|
+
onStopSubagent,
|
|
2579
2815
|
showToolCalls,
|
|
2580
2816
|
showUsage,
|
|
2581
2817
|
showThoughts,
|
|
@@ -2609,13 +2845,17 @@ var StepItem = ({
|
|
|
2609
2845
|
/* @__PURE__ */ jsx8("code", { className: "awr-tool__name", children: a.name }),
|
|
2610
2846
|
/* @__PURE__ */ jsx8("span", { className: "awr-tool__args", children: decisionLabel(a, L) })
|
|
2611
2847
|
] }, a.id)) }),
|
|
2612
|
-
subagents.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "awr-subagents", children: subagents.map((sub) => /* @__PURE__ */ jsx8(SubagentRow, { sub }, sub.id)) }),
|
|
2848
|
+
subagents.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "awr-subagents", children: subagents.map((sub) => /* @__PURE__ */ jsx8(SubagentRow, { sub, onStop: onStopSubagent }, sub.id)) }),
|
|
2849
|
+
notes.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ jsx8(UserNoteRow, { note: n }, n.id)) }),
|
|
2613
2850
|
step.blocked && step.summary && /* @__PURE__ */ jsx8("p", { className: "awr-step__blocked", children: step.summary })
|
|
2614
2851
|
] });
|
|
2615
2852
|
var StepList = ({
|
|
2616
2853
|
steps,
|
|
2617
2854
|
subagents = [],
|
|
2618
2855
|
approvals = [],
|
|
2856
|
+
notes = [],
|
|
2857
|
+
showNotes = true,
|
|
2858
|
+
onStopSubagent,
|
|
2619
2859
|
showToolCalls = true,
|
|
2620
2860
|
showUsage = true,
|
|
2621
2861
|
showThoughts = true,
|
|
@@ -2625,20 +2865,27 @@ var StepList = ({
|
|
|
2625
2865
|
}) => {
|
|
2626
2866
|
const L = useLabels(labels);
|
|
2627
2867
|
if (steps.length === 0) return null;
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2868
|
+
const known = new Set(steps.map((s) => s.id));
|
|
2869
|
+
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
2870
|
+
return /* @__PURE__ */ jsxs6("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
2871
|
+
steps.map((step) => /* @__PURE__ */ jsx8(
|
|
2872
|
+
StepItem,
|
|
2873
|
+
{
|
|
2874
|
+
step,
|
|
2875
|
+
subagents: subagents.filter((s) => s.stepId === step.id),
|
|
2876
|
+
approvals: approvals.filter((a) => a.stepId === step.id && a.status !== "pending"),
|
|
2877
|
+
notes: showNotes ? notes.filter((n) => n.stepId === step.id) : [],
|
|
2878
|
+
onStopSubagent,
|
|
2879
|
+
showToolCalls,
|
|
2880
|
+
showUsage,
|
|
2881
|
+
showThoughts,
|
|
2882
|
+
renderToolCall,
|
|
2883
|
+
L
|
|
2884
|
+
},
|
|
2885
|
+
step.id
|
|
2886
|
+
)),
|
|
2887
|
+
atEnd.length > 0 && /* @__PURE__ */ jsx8("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ jsx8("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ jsx8(UserNoteRow, { note: n }, n.id)) }) })
|
|
2888
|
+
] });
|
|
2642
2889
|
};
|
|
2643
2890
|
|
|
2644
2891
|
// src/components/MessageList.tsx
|
|
@@ -2659,12 +2906,14 @@ var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith(
|
|
|
2659
2906
|
a.name
|
|
2660
2907
|
] });
|
|
2661
2908
|
var toolCallCount = (m) => (m.steps ?? []).reduce((n, s) => n + s.toolCalls.length, 0);
|
|
2662
|
-
var activitySummary = (m, showToolCalls, L) => {
|
|
2909
|
+
var activitySummary = (m, showToolCalls, showLearned, L) => {
|
|
2663
2910
|
const steps = m.steps ?? [];
|
|
2664
2911
|
const parts = [L.steps(steps.length)];
|
|
2665
2912
|
if (showToolCalls) parts.push(L.toolCalls(toolCallCount(m)));
|
|
2666
2913
|
if (m.subagents?.length) parts.push(L.subagents(m.subagents.length));
|
|
2667
2914
|
if (m.skills?.length) parts.push(L.skillsUsed(m.skills.join(", ")));
|
|
2915
|
+
if (showLearned && m.learned?.length) parts.push(L.learnedNow(m.learned.join(", ")));
|
|
2916
|
+
if (showLearned && m.fetches?.length) parts.push(L.fetches(m.fetches.length));
|
|
2668
2917
|
return parts.join(" \xB7 ");
|
|
2669
2918
|
};
|
|
2670
2919
|
var MessageList = ({
|
|
@@ -2674,6 +2923,9 @@ var MessageList = ({
|
|
|
2674
2923
|
showToolCalls = true,
|
|
2675
2924
|
showUsage = true,
|
|
2676
2925
|
showThoughts = true,
|
|
2926
|
+
showNotes = true,
|
|
2927
|
+
showLearned = true,
|
|
2928
|
+
onStopSubagent,
|
|
2677
2929
|
activityOpen = false,
|
|
2678
2930
|
liveExtra,
|
|
2679
2931
|
renderContent,
|
|
@@ -2697,7 +2949,7 @@ var MessageList = ({
|
|
|
2697
2949
|
className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
|
|
2698
2950
|
children: /* @__PURE__ */ jsxs7("div", { className: "awr-msg__col", children: [
|
|
2699
2951
|
m.role === "assistant" && hasActivity && /* @__PURE__ */ jsxs7("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
|
|
2700
|
-
/* @__PURE__ */ jsx9("summary", { className: "awr-activity__summary", children: activitySummary(m, showToolCalls, L) }),
|
|
2952
|
+
/* @__PURE__ */ jsx9("summary", { className: "awr-activity__summary", children: activitySummary(m, showToolCalls, showLearned, L) }),
|
|
2701
2953
|
m.pending && liveExtra,
|
|
2702
2954
|
/* @__PURE__ */ jsx9(
|
|
2703
2955
|
StepList,
|
|
@@ -2705,6 +2957,9 @@ var MessageList = ({
|
|
|
2705
2957
|
steps,
|
|
2706
2958
|
subagents: m.subagents,
|
|
2707
2959
|
approvals: m.approvals,
|
|
2960
|
+
notes: m.notes,
|
|
2961
|
+
showNotes,
|
|
2962
|
+
onStopSubagent: m.pending ? onStopSubagent : void 0,
|
|
2708
2963
|
showToolCalls,
|
|
2709
2964
|
showUsage,
|
|
2710
2965
|
showThoughts,
|
|
@@ -2712,6 +2967,25 @@ var MessageList = ({
|
|
|
2712
2967
|
labels
|
|
2713
2968
|
}
|
|
2714
2969
|
),
|
|
2970
|
+
showLearned && m.fetches?.length ? /* @__PURE__ */ jsx9("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ jsxs7(
|
|
2971
|
+
"li",
|
|
2972
|
+
{
|
|
2973
|
+
className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
|
|
2974
|
+
children: [
|
|
2975
|
+
/* @__PURE__ */ jsx9(GlobeIcon, { size: 12 }),
|
|
2976
|
+
" ",
|
|
2977
|
+
/* @__PURE__ */ jsx9("code", { children: f.url }),
|
|
2978
|
+
" ",
|
|
2979
|
+
/* @__PURE__ */ jsx9("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
|
|
2980
|
+
]
|
|
2981
|
+
},
|
|
2982
|
+
i
|
|
2983
|
+
)) }) : null,
|
|
2984
|
+
showLearned && m.learned?.length ? /* @__PURE__ */ jsxs7("p", { className: "awr-learned", children: [
|
|
2985
|
+
/* @__PURE__ */ jsx9(BookIcon, { size: 12 }),
|
|
2986
|
+
" ",
|
|
2987
|
+
L.learnedNow(m.learned.join(", "))
|
|
2988
|
+
] }) : null,
|
|
2715
2989
|
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ jsxs7("details", { className: "awr-thought", children: [
|
|
2716
2990
|
/* @__PURE__ */ jsxs7("summary", { children: [
|
|
2717
2991
|
/* @__PURE__ */ jsx9(BrainIcon, { size: 13 }),
|
|
@@ -2846,6 +3120,9 @@ var AgentChatInner = ({
|
|
|
2846
3120
|
showToolCalls = true,
|
|
2847
3121
|
showUsage = true,
|
|
2848
3122
|
showThoughts = true,
|
|
3123
|
+
showNotes = true,
|
|
3124
|
+
showLearned = true,
|
|
3125
|
+
stoppableSubagents = true,
|
|
2849
3126
|
showTotalUsage = true,
|
|
2850
3127
|
showStatus = true,
|
|
2851
3128
|
showApprovalMode = true,
|
|
@@ -3028,6 +3305,9 @@ var AgentChatInner = ({
|
|
|
3028
3305
|
showToolCalls,
|
|
3029
3306
|
showUsage,
|
|
3030
3307
|
showThoughts,
|
|
3308
|
+
showNotes,
|
|
3309
|
+
showLearned,
|
|
3310
|
+
onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
|
|
3031
3311
|
activityOpen,
|
|
3032
3312
|
liveExtra,
|
|
3033
3313
|
renderContent,
|
|
@@ -3098,9 +3378,59 @@ var AgentChatInner = ({
|
|
|
3098
3378
|
);
|
|
3099
3379
|
};
|
|
3100
3380
|
|
|
3381
|
+
// src/components/LearnedSkills.tsx
|
|
3382
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3383
|
+
var LearnedSkills = ({
|
|
3384
|
+
controller,
|
|
3385
|
+
lessons,
|
|
3386
|
+
onForget,
|
|
3387
|
+
showSources = true,
|
|
3388
|
+
empty,
|
|
3389
|
+
hideTitle = false,
|
|
3390
|
+
labels,
|
|
3391
|
+
className
|
|
3392
|
+
}) => {
|
|
3393
|
+
const L = useLabels(labels);
|
|
3394
|
+
const ctx = useOptionalAgentContext();
|
|
3395
|
+
const c = controller ?? ctx;
|
|
3396
|
+
const list = lessons ?? c?.learned ?? [];
|
|
3397
|
+
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
3398
|
+
return /* @__PURE__ */ jsxs12("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
3399
|
+
!hideTitle && /* @__PURE__ */ jsxs12("h3", { className: "awr-notebook__title", children: [
|
|
3400
|
+
/* @__PURE__ */ jsx13(BookIcon, { size: 14 }),
|
|
3401
|
+
" ",
|
|
3402
|
+
L.notebookTitle,
|
|
3403
|
+
list.length > 0 && /* @__PURE__ */ jsx13("span", { className: "awr-notebook__count", children: list.length })
|
|
3404
|
+
] }),
|
|
3405
|
+
list.length === 0 ? /* @__PURE__ */ jsx13("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ jsx13("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ jsxs12("li", { className: "awr-lesson", children: [
|
|
3406
|
+
/* @__PURE__ */ jsxs12("div", { className: "awr-lesson__head", children: [
|
|
3407
|
+
/* @__PURE__ */ jsx13("code", { className: "awr-lesson__name", children: l.name }),
|
|
3408
|
+
l.revision > 1 && /* @__PURE__ */ jsx13("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
3409
|
+
forget && /* @__PURE__ */ jsx13(
|
|
3410
|
+
"button",
|
|
3411
|
+
{
|
|
3412
|
+
type: "button",
|
|
3413
|
+
className: "awr-lesson__forget",
|
|
3414
|
+
title: `${L.notebookForget}: ${l.name}`,
|
|
3415
|
+
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
3416
|
+
onClick: () => void forget(l.name),
|
|
3417
|
+
children: /* @__PURE__ */ jsx13(XIcon, { size: 12 })
|
|
3418
|
+
}
|
|
3419
|
+
)
|
|
3420
|
+
] }),
|
|
3421
|
+
/* @__PURE__ */ jsx13("p", { className: "awr-lesson__when", children: l.description }),
|
|
3422
|
+
showSources && l.sources.length > 0 && /* @__PURE__ */ jsxs12("p", { className: "awr-lesson__from", children: [
|
|
3423
|
+
L.notebookFrom,
|
|
3424
|
+
" ",
|
|
3425
|
+
l.sources.join(", ")
|
|
3426
|
+
] })
|
|
3427
|
+
] }, l.name)) })
|
|
3428
|
+
] });
|
|
3429
|
+
};
|
|
3430
|
+
|
|
3101
3431
|
// src/components/Composer.tsx
|
|
3102
3432
|
import { useState as useState10 } from "react";
|
|
3103
|
-
import { jsx as
|
|
3433
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3104
3434
|
var Composer = ({
|
|
3105
3435
|
onSubmit,
|
|
3106
3436
|
busy = false,
|
|
@@ -3122,7 +3452,7 @@ var Composer = ({
|
|
|
3122
3452
|
submit();
|
|
3123
3453
|
}
|
|
3124
3454
|
};
|
|
3125
|
-
return /* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ jsxs13(
|
|
3126
3456
|
"form",
|
|
3127
3457
|
{
|
|
3128
3458
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -3131,7 +3461,7 @@ var Composer = ({
|
|
|
3131
3461
|
submit();
|
|
3132
3462
|
},
|
|
3133
3463
|
children: [
|
|
3134
|
-
/* @__PURE__ */
|
|
3464
|
+
/* @__PURE__ */ jsx14(
|
|
3135
3465
|
"textarea",
|
|
3136
3466
|
{
|
|
3137
3467
|
className: "awr-composer__input",
|
|
@@ -3143,23 +3473,23 @@ var Composer = ({
|
|
|
3143
3473
|
rows: 1
|
|
3144
3474
|
}
|
|
3145
3475
|
),
|
|
3146
|
-
busy ? /* @__PURE__ */
|
|
3476
|
+
busy ? /* @__PURE__ */ jsx14(
|
|
3147
3477
|
"button",
|
|
3148
3478
|
{
|
|
3149
3479
|
type: "button",
|
|
3150
3480
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
3151
3481
|
onClick: onStop,
|
|
3152
3482
|
"aria-label": "Stop",
|
|
3153
|
-
children: /* @__PURE__ */
|
|
3483
|
+
children: /* @__PURE__ */ jsx14(StopIcon, { size: 18 })
|
|
3154
3484
|
}
|
|
3155
|
-
) : /* @__PURE__ */
|
|
3485
|
+
) : /* @__PURE__ */ jsx14(
|
|
3156
3486
|
"button",
|
|
3157
3487
|
{
|
|
3158
3488
|
type: "submit",
|
|
3159
3489
|
className: "awr-composer__btn",
|
|
3160
3490
|
disabled: disabled || !text.trim(),
|
|
3161
3491
|
"aria-label": "Send",
|
|
3162
|
-
children: disabled ? /* @__PURE__ */
|
|
3492
|
+
children: disabled ? /* @__PURE__ */ jsx14(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ jsx14(SendIcon, { size: 18 })
|
|
3163
3493
|
}
|
|
3164
3494
|
)
|
|
3165
3495
|
]
|
|
@@ -3168,17 +3498,17 @@ var Composer = ({
|
|
|
3168
3498
|
};
|
|
3169
3499
|
|
|
3170
3500
|
// src/components/PlanView.tsx
|
|
3171
|
-
import { jsx as
|
|
3501
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3172
3502
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
3173
3503
|
if (!plan.steps.length && !plan.thought) return null;
|
|
3174
|
-
return /* @__PURE__ */
|
|
3175
|
-
showThought && plan.thought.trim() && /* @__PURE__ */
|
|
3176
|
-
plan.steps.length > 0 && /* @__PURE__ */
|
|
3504
|
+
return /* @__PURE__ */ jsxs14("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
3505
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ jsx15("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
3506
|
+
plan.steps.length > 0 && /* @__PURE__ */ jsx15("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ jsx15("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
3177
3507
|
] });
|
|
3178
3508
|
};
|
|
3179
3509
|
|
|
3180
3510
|
// src/components/ApprovalModeSwitch.tsx
|
|
3181
|
-
import { jsx as
|
|
3511
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
3182
3512
|
var DEFAULT_LABELS = {
|
|
3183
3513
|
autopilot: "Autopilot",
|
|
3184
3514
|
"ask-writes": "Ask before changes",
|
|
@@ -3198,13 +3528,13 @@ var ApprovalModeSwitch = ({
|
|
|
3198
3528
|
labels,
|
|
3199
3529
|
disabled,
|
|
3200
3530
|
className
|
|
3201
|
-
}) => /* @__PURE__ */
|
|
3531
|
+
}) => /* @__PURE__ */ jsx16(
|
|
3202
3532
|
"div",
|
|
3203
3533
|
{
|
|
3204
3534
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
3205
3535
|
role: "radiogroup",
|
|
3206
3536
|
"aria-label": "Tool consent",
|
|
3207
|
-
children: modes.map((m) => /* @__PURE__ */
|
|
3537
|
+
children: modes.map((m) => /* @__PURE__ */ jsx16(
|
|
3208
3538
|
"button",
|
|
3209
3539
|
{
|
|
3210
3540
|
type: "button",
|
|
@@ -3223,7 +3553,7 @@ var ApprovalModeSwitch = ({
|
|
|
3223
3553
|
|
|
3224
3554
|
// src/components/ApiKeyForm.tsx
|
|
3225
3555
|
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
3226
|
-
import { jsx as
|
|
3556
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3227
3557
|
var ApiKeyForm = ({
|
|
3228
3558
|
credentials,
|
|
3229
3559
|
credentialRef,
|
|
@@ -3267,16 +3597,16 @@ var ApiKeyForm = ({
|
|
|
3267
3597
|
setBusy(false);
|
|
3268
3598
|
}
|
|
3269
3599
|
};
|
|
3270
|
-
return /* @__PURE__ */
|
|
3271
|
-
/* @__PURE__ */
|
|
3600
|
+
return /* @__PURE__ */ jsxs15("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
3601
|
+
/* @__PURE__ */ jsxs15("label", { className: "awr-keyform__label", children: [
|
|
3272
3602
|
label,
|
|
3273
|
-
present && /* @__PURE__ */
|
|
3274
|
-
/* @__PURE__ */
|
|
3603
|
+
present && /* @__PURE__ */ jsxs15("span", { className: "awr-keyform__saved", children: [
|
|
3604
|
+
/* @__PURE__ */ jsx17(CheckIcon, { size: 12 }),
|
|
3275
3605
|
" stored, encrypted"
|
|
3276
3606
|
] })
|
|
3277
3607
|
] }),
|
|
3278
|
-
/* @__PURE__ */
|
|
3279
|
-
/* @__PURE__ */
|
|
3608
|
+
/* @__PURE__ */ jsxs15("div", { className: "awr-keyform__row", children: [
|
|
3609
|
+
/* @__PURE__ */ jsx17(
|
|
3280
3610
|
"input",
|
|
3281
3611
|
{
|
|
3282
3612
|
className: "awr-keyform__input",
|
|
@@ -3294,7 +3624,7 @@ var ApiKeyForm = ({
|
|
|
3294
3624
|
disabled: busy
|
|
3295
3625
|
}
|
|
3296
3626
|
),
|
|
3297
|
-
/* @__PURE__ */
|
|
3627
|
+
/* @__PURE__ */ jsx17(
|
|
3298
3628
|
"button",
|
|
3299
3629
|
{
|
|
3300
3630
|
type: "button",
|
|
@@ -3304,7 +3634,7 @@ var ApiKeyForm = ({
|
|
|
3304
3634
|
children: "Save"
|
|
3305
3635
|
}
|
|
3306
3636
|
),
|
|
3307
|
-
present && /* @__PURE__ */
|
|
3637
|
+
present && /* @__PURE__ */ jsx17(
|
|
3308
3638
|
"button",
|
|
3309
3639
|
{
|
|
3310
3640
|
type: "button",
|
|
@@ -3325,6 +3655,7 @@ import {
|
|
|
3325
3655
|
defineSkill,
|
|
3326
3656
|
parseSkillMarkdown,
|
|
3327
3657
|
loadSkillFromUrl,
|
|
3658
|
+
createRunControl as createRunControl2,
|
|
3328
3659
|
createSubagentTool,
|
|
3329
3660
|
serveSubagentWorker,
|
|
3330
3661
|
markReadOnly,
|
|
@@ -3338,6 +3669,8 @@ import {
|
|
|
3338
3669
|
IndexedDBStore,
|
|
3339
3670
|
VirtualFileSystem,
|
|
3340
3671
|
createFileTools,
|
|
3672
|
+
MemorySkillStore,
|
|
3673
|
+
VfsSkillStore,
|
|
3341
3674
|
AttachmentsNotSupportedError,
|
|
3342
3675
|
ImagesNotSupportedError,
|
|
3343
3676
|
supportsImages,
|
|
@@ -3359,7 +3692,9 @@ export {
|
|
|
3359
3692
|
FilesPanel,
|
|
3360
3693
|
ImagesNotSupportedError,
|
|
3361
3694
|
IndexedDBStore,
|
|
3695
|
+
LearnedSkills,
|
|
3362
3696
|
MemoryCredentialStore,
|
|
3697
|
+
MemorySkillStore,
|
|
3363
3698
|
MemoryStore,
|
|
3364
3699
|
MessageList,
|
|
3365
3700
|
ModelLoadBar,
|
|
@@ -3369,7 +3704,9 @@ export {
|
|
|
3369
3704
|
ToolApprovalPrompt,
|
|
3370
3705
|
ToolCallRow,
|
|
3371
3706
|
UsageBadge,
|
|
3707
|
+
UserNoteRow,
|
|
3372
3708
|
VaultCredentialStore2 as VaultCredentialStore,
|
|
3709
|
+
VfsSkillStore,
|
|
3373
3710
|
VirtualFileSystem,
|
|
3374
3711
|
agentStateReducer,
|
|
3375
3712
|
attachmentKindOf,
|
|
@@ -3378,6 +3715,7 @@ export {
|
|
|
3378
3715
|
createAgent2 as createAgent,
|
|
3379
3716
|
createFileTools,
|
|
3380
3717
|
createInitialAgentState,
|
|
3718
|
+
createRunControl2 as createRunControl,
|
|
3381
3719
|
createSubagentTool,
|
|
3382
3720
|
createWebLLMEngine,
|
|
3383
3721
|
createWebLLMModel2 as createWebLLMModel,
|
|
@@ -3388,6 +3726,7 @@ export {
|
|
|
3388
3726
|
filterCommands,
|
|
3389
3727
|
formatElapsed,
|
|
3390
3728
|
isWebGPUAvailable2 as isWebGPUAvailable,
|
|
3729
|
+
lessonsOf,
|
|
3391
3730
|
loadSkillFromUrl,
|
|
3392
3731
|
markReadOnly,
|
|
3393
3732
|
mergeLabels,
|
|
@@ -3397,6 +3736,7 @@ export {
|
|
|
3397
3736
|
parseSlash,
|
|
3398
3737
|
preloadWebLLMModel2 as preloadWebLLMModel,
|
|
3399
3738
|
serveSubagentWorker,
|
|
3739
|
+
steerIntent,
|
|
3400
3740
|
supportsImages,
|
|
3401
3741
|
supportsPdf,
|
|
3402
3742
|
unloadWebLLMModel2 as unloadWebLLMModel,
|