@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.cjs
CHANGED
|
@@ -35,7 +35,9 @@ __export(src_exports, {
|
|
|
35
35
|
FilesPanel: () => FilesPanel,
|
|
36
36
|
ImagesNotSupportedError: () => import_agent_web4.ImagesNotSupportedError,
|
|
37
37
|
IndexedDBStore: () => import_agent_web4.IndexedDBStore,
|
|
38
|
+
LearnedSkills: () => LearnedSkills,
|
|
38
39
|
MemoryCredentialStore: () => import_agent_web4.MemoryCredentialStore,
|
|
40
|
+
MemorySkillStore: () => import_agent_web4.MemorySkillStore,
|
|
39
41
|
MemoryStore: () => import_agent_web4.MemoryStore,
|
|
40
42
|
MessageList: () => MessageList,
|
|
41
43
|
ModelLoadBar: () => ModelLoadBar,
|
|
@@ -45,7 +47,9 @@ __export(src_exports, {
|
|
|
45
47
|
ToolApprovalPrompt: () => ToolApprovalPrompt,
|
|
46
48
|
ToolCallRow: () => ToolCallRow,
|
|
47
49
|
UsageBadge: () => UsageBadge,
|
|
50
|
+
UserNoteRow: () => UserNoteRow,
|
|
48
51
|
VaultCredentialStore: () => import_agent_web4.VaultCredentialStore,
|
|
52
|
+
VfsSkillStore: () => import_agent_web4.VfsSkillStore,
|
|
49
53
|
VirtualFileSystem: () => import_agent_web4.VirtualFileSystem,
|
|
50
54
|
agentStateReducer: () => agentStateReducer,
|
|
51
55
|
attachmentKindOf: () => attachmentKindOf,
|
|
@@ -54,6 +58,7 @@ __export(src_exports, {
|
|
|
54
58
|
createAgent: () => import_agent_web4.createAgent,
|
|
55
59
|
createFileTools: () => import_agent_web4.createFileTools,
|
|
56
60
|
createInitialAgentState: () => createInitialAgentState,
|
|
61
|
+
createRunControl: () => import_agent_web4.createRunControl,
|
|
57
62
|
createSubagentTool: () => import_agent_web4.createSubagentTool,
|
|
58
63
|
createWebLLMEngine: () => createWebLLMEngine,
|
|
59
64
|
createWebLLMModel: () => import_agent_web4.createWebLLMModel,
|
|
@@ -64,6 +69,7 @@ __export(src_exports, {
|
|
|
64
69
|
filterCommands: () => filterCommands,
|
|
65
70
|
formatElapsed: () => formatElapsed,
|
|
66
71
|
isWebGPUAvailable: () => import_agent_web4.isWebGPUAvailable,
|
|
72
|
+
lessonsOf: () => lessonsOf,
|
|
67
73
|
loadSkillFromUrl: () => import_agent_web4.loadSkillFromUrl,
|
|
68
74
|
markReadOnly: () => import_agent_web4.markReadOnly,
|
|
69
75
|
mergeLabels: () => mergeLabels,
|
|
@@ -73,6 +79,7 @@ __export(src_exports, {
|
|
|
73
79
|
parseSlash: () => parseSlash,
|
|
74
80
|
preloadWebLLMModel: () => import_agent_web4.preloadWebLLMModel,
|
|
75
81
|
serveSubagentWorker: () => import_agent_web4.serveSubagentWorker,
|
|
82
|
+
steerIntent: () => steerIntent,
|
|
76
83
|
supportsImages: () => import_agent_web4.supportsImages,
|
|
77
84
|
supportsPdf: () => import_agent_web4.supportsPdf,
|
|
78
85
|
unloadWebLLMModel: () => import_agent_web4.unloadWebLLMModel,
|
|
@@ -122,6 +129,13 @@ var addUsage = (a, b) => ({
|
|
|
122
129
|
cachedInputTokens: (a.cachedInputTokens ?? 0) + (b.cachedInputTokens ?? 0),
|
|
123
130
|
cacheWriteTokens: (a.cacheWriteTokens ?? 0) + (b.cacheWriteTokens ?? 0)
|
|
124
131
|
});
|
|
132
|
+
var lessonsOf = (skills) => skills.filter((s) => s.origin?.kind === "learned").map((s) => ({
|
|
133
|
+
name: s.name,
|
|
134
|
+
description: s.description,
|
|
135
|
+
revision: s.origin?.revision ?? 1,
|
|
136
|
+
chars: s.content.length,
|
|
137
|
+
sources: [...s.origin?.sources ?? [], ...s.origin?.fetched ?? []]
|
|
138
|
+
}));
|
|
125
139
|
var createInitialAgentState = () => ({
|
|
126
140
|
status: "idle",
|
|
127
141
|
goal: void 0,
|
|
@@ -135,7 +149,13 @@ var createInitialAgentState = () => ({
|
|
|
135
149
|
runMessageId: void 0,
|
|
136
150
|
approvals: [],
|
|
137
151
|
subagents: [],
|
|
152
|
+
queued: [],
|
|
153
|
+
notes: [],
|
|
154
|
+
undelivered: [],
|
|
138
155
|
skills: [],
|
|
156
|
+
learned: [],
|
|
157
|
+
learnedNow: [],
|
|
158
|
+
fetches: [],
|
|
139
159
|
discoveredTools: [],
|
|
140
160
|
compactions: [],
|
|
141
161
|
budget: void 0,
|
|
@@ -153,7 +173,8 @@ var resetRun = (state) => ({
|
|
|
153
173
|
status: state.status,
|
|
154
174
|
messages: state.messages,
|
|
155
175
|
totalUsage: state.totalUsage,
|
|
156
|
-
seq: state.seq
|
|
176
|
+
seq: state.seq,
|
|
177
|
+
learned: state.learned
|
|
157
178
|
});
|
|
158
179
|
var patchStep = (steps, id, fn) => steps.map((s) => s.id === id ? fn(s) : s);
|
|
159
180
|
var patchApproval = (approvals, id, fn) => approvals.map((a) => a.id === id ? fn(a) : a);
|
|
@@ -238,7 +259,16 @@ var applyEvent = (state, event, ctx) => {
|
|
|
238
259
|
planThought: state.planThought || event.plan.thought
|
|
239
260
|
};
|
|
240
261
|
case "plan.revised":
|
|
241
|
-
return {
|
|
262
|
+
return {
|
|
263
|
+
...state,
|
|
264
|
+
plan: event.plan,
|
|
265
|
+
// `replan.decision` came first: keep its "because the user spoke" flag.
|
|
266
|
+
replan: {
|
|
267
|
+
mode: "revise",
|
|
268
|
+
reason: event.reason,
|
|
269
|
+
...state.replan?.byUser ? { byUser: true } : {}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
242
272
|
case "plan.step-added":
|
|
243
273
|
return state;
|
|
244
274
|
case "step.start": {
|
|
@@ -338,7 +368,27 @@ var applyEvent = (state, event, ctx) => {
|
|
|
338
368
|
}))
|
|
339
369
|
};
|
|
340
370
|
case "replan.decision":
|
|
341
|
-
return {
|
|
371
|
+
return {
|
|
372
|
+
...state,
|
|
373
|
+
replan: {
|
|
374
|
+
mode: event.mode,
|
|
375
|
+
reason: event.reason,
|
|
376
|
+
...event.byUser ? { byUser: true } : {}
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
case "message.queued":
|
|
380
|
+
return state.queued.some((q) => q.id === event.id) ? state : { ...state, queued: [...state.queued, { id: event.id, text: event.text }] };
|
|
381
|
+
case "message.delivered": {
|
|
382
|
+
const anchor = event.at === "round" ? runningStepId(state.steps) : event.at === "step" ? state.steps[state.steps.length - 1]?.id : void 0;
|
|
383
|
+
return {
|
|
384
|
+
...state,
|
|
385
|
+
queued: state.queued.filter((q) => q.id !== event.id),
|
|
386
|
+
notes: [
|
|
387
|
+
...state.notes,
|
|
388
|
+
{ id: event.id, text: event.text, at: event.at, ...anchor ? { stepId: anchor } : {} }
|
|
389
|
+
]
|
|
390
|
+
};
|
|
391
|
+
}
|
|
342
392
|
case "final.text-delta": {
|
|
343
393
|
const finalText = state.finalText + event.delta;
|
|
344
394
|
return { ...state, finalText, messages: streamAssistant(state.messages, finalText) };
|
|
@@ -408,6 +458,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
408
458
|
name: event.name,
|
|
409
459
|
task: event.task,
|
|
410
460
|
status: "running",
|
|
461
|
+
...event.profile ? { profile: event.profile } : {},
|
|
411
462
|
stepId: runningStepId(state.steps),
|
|
412
463
|
activity: "starting",
|
|
413
464
|
steps: 0,
|
|
@@ -442,13 +493,45 @@ var applyEvent = (state, event, ctx) => {
|
|
|
442
493
|
...state,
|
|
443
494
|
subagents: patchSubagent(state.subagents, event.id, (s) => ({
|
|
444
495
|
...s,
|
|
445
|
-
status: "error",
|
|
446
|
-
activity: "failed",
|
|
496
|
+
status: event.stopped ? "stopped" : "error",
|
|
497
|
+
activity: event.stopped ? "stopped" : "failed",
|
|
447
498
|
error: event.error
|
|
448
499
|
}))
|
|
449
500
|
};
|
|
450
501
|
case "skill.activated":
|
|
451
502
|
return state.skills.includes(event.name) ? state : { ...state, skills: [...state.skills, event.name] };
|
|
503
|
+
case "skill.learned": {
|
|
504
|
+
const before = state.learned.find((l) => l.name === event.name);
|
|
505
|
+
const lesson = {
|
|
506
|
+
name: event.name,
|
|
507
|
+
description: event.description,
|
|
508
|
+
// A rewrite of a lesson we know goes up one; a lesson we never saw (an event for a store
|
|
509
|
+
// loaded before this view existed) starts at 2 when the core says it is an update.
|
|
510
|
+
revision: event.update ? (before?.revision ?? 1) + 1 : 1,
|
|
511
|
+
chars: event.chars,
|
|
512
|
+
sources: event.sources
|
|
513
|
+
};
|
|
514
|
+
return {
|
|
515
|
+
...state,
|
|
516
|
+
learned: before ? state.learned.map((l) => l.name === event.name ? lesson : l) : [...state.learned, lesson],
|
|
517
|
+
learnedNow: state.learnedNow.includes(event.name) ? state.learnedNow : [...state.learnedNow, event.name]
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
case "skill.forgotten":
|
|
521
|
+
return { ...state, learned: state.learned.filter((l) => l.name !== event.name) };
|
|
522
|
+
case "egress.request":
|
|
523
|
+
return {
|
|
524
|
+
...state,
|
|
525
|
+
fetches: [
|
|
526
|
+
...state.fetches,
|
|
527
|
+
{
|
|
528
|
+
url: event.url,
|
|
529
|
+
allowed: event.allowed,
|
|
530
|
+
...event.status !== void 0 ? { status: event.status } : {},
|
|
531
|
+
...event.reason ? { reason: event.reason } : {}
|
|
532
|
+
}
|
|
533
|
+
]
|
|
534
|
+
};
|
|
452
535
|
case "tools.discovered":
|
|
453
536
|
return {
|
|
454
537
|
...state,
|
|
@@ -504,9 +587,13 @@ var syncRunMessage = (state) => {
|
|
|
504
587
|
const patch = {};
|
|
505
588
|
if (m.steps !== state.steps) patch.steps = state.steps;
|
|
506
589
|
if (m.subagents !== state.subagents) patch.subagents = state.subagents;
|
|
590
|
+
if (state.notes.length > 0 && m.notes !== state.notes) patch.notes = state.notes;
|
|
507
591
|
if (m.usage !== state.usage) patch.usage = state.usage;
|
|
508
592
|
if ((m.reasoning ?? "") !== state.finalReasoning) patch.reasoning = state.finalReasoning;
|
|
509
593
|
if (m.skills !== state.skills) patch.skills = state.skills;
|
|
594
|
+
if (state.learnedNow.length > 0 && m.learned !== state.learnedNow)
|
|
595
|
+
patch.learned = state.learnedNow;
|
|
596
|
+
if (state.fetches.length > 0 && m.fetches !== state.fetches) patch.fetches = state.fetches;
|
|
510
597
|
if ((m.approvals?.length ?? 0) !== decided.length || decided.some((a, k) => m.approvals?.[k] !== a)) {
|
|
511
598
|
patch.approvals = decided;
|
|
512
599
|
}
|
|
@@ -518,7 +605,14 @@ var syncRunMessage = (state) => {
|
|
|
518
605
|
var agentStateReducer = (state, action) => {
|
|
519
606
|
switch (action.type) {
|
|
520
607
|
case "reset":
|
|
521
|
-
return {
|
|
608
|
+
return {
|
|
609
|
+
...createInitialAgentState(),
|
|
610
|
+
status: state.status,
|
|
611
|
+
seq: state.seq,
|
|
612
|
+
learned: state.learned
|
|
613
|
+
};
|
|
614
|
+
case "notebook":
|
|
615
|
+
return { ...state, learned: action.lessons };
|
|
522
616
|
case "status":
|
|
523
617
|
return {
|
|
524
618
|
...state,
|
|
@@ -533,6 +627,8 @@ var agentStateReducer = (state, action) => {
|
|
|
533
627
|
const events = cap > 0 ? [...state.events, action.event].slice(-cap) : [...state.events, action.event];
|
|
534
628
|
return { ...next, events };
|
|
535
629
|
}
|
|
630
|
+
case "undelivered":
|
|
631
|
+
return { ...state, queued: [], undelivered: action.texts };
|
|
536
632
|
case "load": {
|
|
537
633
|
const maxSeq = action.messages.reduce((n, m) => {
|
|
538
634
|
const k = Number(/^msg-(\d+)$/.exec(m.id)?.[1] ?? -1);
|
|
@@ -543,7 +639,8 @@ var agentStateReducer = (state, action) => {
|
|
|
543
639
|
status: state.status,
|
|
544
640
|
messages: action.messages.map((m) => m.pending ? { ...m, pending: false } : m),
|
|
545
641
|
totalUsage: action.totalUsage ?? emptyUsage(),
|
|
546
|
-
seq: maxSeq
|
|
642
|
+
seq: maxSeq,
|
|
643
|
+
learned: state.learned
|
|
547
644
|
};
|
|
548
645
|
}
|
|
549
646
|
default:
|
|
@@ -559,6 +656,9 @@ var useAgent = (config, options = {}) => {
|
|
|
559
656
|
const [state, dispatch] = (0, import_react.useReducer)(agentStateReducer, void 0, createInitialAgentState);
|
|
560
657
|
const agentRef = (0, import_react.useRef)(void 0);
|
|
561
658
|
const abortRef = (0, import_react.useRef)(void 0);
|
|
659
|
+
const controlRef = (0, import_react.useRef)(void 0);
|
|
660
|
+
const stateRef = (0, import_react.useRef)(state);
|
|
661
|
+
stateRef.current = state;
|
|
562
662
|
const [generation, setGeneration] = (0, import_react.useState)(0);
|
|
563
663
|
const configRef = (0, import_react.useRef)(config);
|
|
564
664
|
configRef.current = config;
|
|
@@ -615,6 +715,7 @@ var useAgent = (config, options = {}) => {
|
|
|
615
715
|
if (cancelled) return;
|
|
616
716
|
agent.setToolApprovalMode(modeRef.current);
|
|
617
717
|
agentRef.current = agent;
|
|
718
|
+
dispatch({ type: "notebook", lessons: lessonsOf(agent.listLearnedSkills()) });
|
|
618
719
|
setBuildStatus({ status: "ready" });
|
|
619
720
|
}).catch((err) => {
|
|
620
721
|
if (cancelled) return;
|
|
@@ -631,16 +732,21 @@ var useAgent = (config, options = {}) => {
|
|
|
631
732
|
},
|
|
632
733
|
[settleAll]
|
|
633
734
|
);
|
|
735
|
+
const runRef = (0, import_react.useRef)(void 0);
|
|
634
736
|
const run = (0, import_react.useCallback)(
|
|
635
737
|
async (goal, runOptions) => {
|
|
636
738
|
const agent = agentRef.current;
|
|
637
739
|
if (!agent || abortRef.current) return void 0;
|
|
638
740
|
const controller = new AbortController();
|
|
639
741
|
abortRef.current = controller;
|
|
742
|
+
const control = (0, import_agent_web.createRunControl)();
|
|
743
|
+
controlRef.current = control;
|
|
744
|
+
let left = [];
|
|
640
745
|
dispatch({ type: "status", status: "running" });
|
|
641
746
|
try {
|
|
642
|
-
|
|
747
|
+
const result = await agent.run(goal, {
|
|
643
748
|
signal: controller.signal,
|
|
749
|
+
control,
|
|
644
750
|
sessionId: sessionRef.current,
|
|
645
751
|
...runOptions?.images?.length ? { images: runOptions.images } : {},
|
|
646
752
|
...runOptions?.files?.length ? { files: runOptions.files } : {},
|
|
@@ -660,7 +766,10 @@ var useAgent = (config, options = {}) => {
|
|
|
660
766
|
}
|
|
661
767
|
}
|
|
662
768
|
});
|
|
769
|
+
left = result.undelivered ?? [];
|
|
770
|
+
return result;
|
|
663
771
|
} catch (err) {
|
|
772
|
+
left = control.pending();
|
|
664
773
|
dispatch({
|
|
665
774
|
type: "event",
|
|
666
775
|
event: { type: "error", phase: "run", error: errMessage(err) },
|
|
@@ -669,12 +778,36 @@ var useAgent = (config, options = {}) => {
|
|
|
669
778
|
return void 0;
|
|
670
779
|
} finally {
|
|
671
780
|
abortRef.current = void 0;
|
|
781
|
+
controlRef.current = void 0;
|
|
672
782
|
settleAll({ approved: false, reason: "the run ended" });
|
|
673
783
|
dispatch({ type: "status", ...buildStatusRef.current });
|
|
784
|
+
if (left.length > 0) {
|
|
785
|
+
if (!controller.signal.aborted && optionsRef.current.followUp !== false) {
|
|
786
|
+
dispatch({ type: "undelivered", texts: [] });
|
|
787
|
+
void runRef.current?.(left.join("\n\n"));
|
|
788
|
+
} else {
|
|
789
|
+
dispatch({ type: "undelivered", texts: left });
|
|
790
|
+
}
|
|
791
|
+
} else {
|
|
792
|
+
dispatch({ type: "undelivered", texts: [] });
|
|
793
|
+
}
|
|
674
794
|
}
|
|
675
795
|
},
|
|
676
796
|
[settleAll]
|
|
677
797
|
);
|
|
798
|
+
runRef.current = run;
|
|
799
|
+
const send = (0, import_react.useCallback)((text) => controlRef.current?.send(text) ?? false, []);
|
|
800
|
+
const stopSubagent = (0, import_react.useCallback)(
|
|
801
|
+
(id) => controlRef.current?.stopSubagent(id) ?? false,
|
|
802
|
+
[]
|
|
803
|
+
);
|
|
804
|
+
const sendUndelivered = (0, import_react.useCallback)(() => {
|
|
805
|
+
const texts = stateRef.current.undelivered;
|
|
806
|
+
if (texts.length === 0) return;
|
|
807
|
+
dispatch({ type: "undelivered", texts: [] });
|
|
808
|
+
void runRef.current?.(texts.join("\n\n"));
|
|
809
|
+
}, []);
|
|
810
|
+
const discardUndelivered = (0, import_react.useCallback)(() => dispatch({ type: "undelivered", texts: [] }), []);
|
|
678
811
|
const stop = (0, import_react.useCallback)(() => {
|
|
679
812
|
abortRef.current?.abort();
|
|
680
813
|
settleAll({ approved: false, reason: "stopped by the user" });
|
|
@@ -693,6 +826,14 @@ var useAgent = (config, options = {}) => {
|
|
|
693
826
|
},
|
|
694
827
|
[]
|
|
695
828
|
);
|
|
829
|
+
const forgetSkill = (0, import_react.useCallback)(async (name) => {
|
|
830
|
+
const agent = agentRef.current;
|
|
831
|
+
if (!agent) return false;
|
|
832
|
+
return agent.forgetSkill(
|
|
833
|
+
name,
|
|
834
|
+
(event) => dispatch({ type: "event", event, maxEvents: optionsRef.current.maxEvents, at: Date.now() })
|
|
835
|
+
);
|
|
836
|
+
}, []);
|
|
696
837
|
const approve = (0, import_react.useCallback)((id, opts) => {
|
|
697
838
|
const resolve = resolversRef.current.get(id);
|
|
698
839
|
if (!resolve) return;
|
|
@@ -728,6 +869,11 @@ var useAgent = (config, options = {}) => {
|
|
|
728
869
|
...state,
|
|
729
870
|
run,
|
|
730
871
|
stop,
|
|
872
|
+
send,
|
|
873
|
+
stopSubagent,
|
|
874
|
+
forgetSkill,
|
|
875
|
+
sendUndelivered,
|
|
876
|
+
discardUndelivered,
|
|
731
877
|
reset,
|
|
732
878
|
reload,
|
|
733
879
|
agent: agentRef.current,
|
|
@@ -1193,6 +1339,13 @@ var parseSlash = (text) => {
|
|
|
1193
1339
|
const m = /^\/([\w-]*)(?:\s+([\s\S]*))?$/.exec(text.trimStart());
|
|
1194
1340
|
return m ? { name: m[1].toLowerCase(), args: (m[2] ?? "").trim() } : void 0;
|
|
1195
1341
|
};
|
|
1342
|
+
var steerIntent = (input) => {
|
|
1343
|
+
if (!input.busy) return "idle";
|
|
1344
|
+
if (!input.steering) return "ignore";
|
|
1345
|
+
if (!input.raw && !input.hasAttachments) return "ignore";
|
|
1346
|
+
if (parseSlash(input.raw)) return "ignore";
|
|
1347
|
+
return input.hasAttachments ? "attachments" : "steer";
|
|
1348
|
+
};
|
|
1196
1349
|
var filterCommands = (commands, query) => {
|
|
1197
1350
|
const q = query.toLowerCase();
|
|
1198
1351
|
if (!q) return commands;
|
|
@@ -1308,12 +1461,20 @@ var defaultLabels = {
|
|
|
1308
1461
|
toolCalls: (n) => plural(n, "tool call", "tool calls"),
|
|
1309
1462
|
subagents: (n) => plural(n, "subagent", "subagents"),
|
|
1310
1463
|
skillsUsed: (names) => `skills: ${names}`,
|
|
1464
|
+
learnedNow: (names) => `learned: ${names}`,
|
|
1465
|
+
fetches: (n) => plural(n, "web request", "web requests"),
|
|
1466
|
+
fetchRefused: (reason) => `refused: ${reason}`,
|
|
1311
1467
|
answerThoughts: "Thinking about the answer",
|
|
1312
1468
|
stepThoughts: "Thoughts",
|
|
1313
1469
|
usageTitle: "Tokens this answer spent, by kind",
|
|
1314
1470
|
attachments: "Attachments",
|
|
1315
1471
|
planned: "Plan",
|
|
1316
1472
|
replanned: (mode, reason) => `Replanned (${mode}): ${reason}`,
|
|
1473
|
+
notebookTitle: "Notebook",
|
|
1474
|
+
notebookEmpty: "The agent has not written any lessons down yet.",
|
|
1475
|
+
notebookForget: "Forget",
|
|
1476
|
+
notebookRevision: (n) => `revision ${n}`,
|
|
1477
|
+
notebookFrom: "from",
|
|
1317
1478
|
placeholder: "Ask the agent to do something\u2026 ( / for commands, Ctrl+V to paste an image )",
|
|
1318
1479
|
listening: "Listening\u2026",
|
|
1319
1480
|
message: "Message",
|
|
@@ -1390,6 +1551,20 @@ var defaultLabels = {
|
|
|
1390
1551
|
consentWaiting: "waiting for your consent",
|
|
1391
1552
|
consentAllowed: "allowed",
|
|
1392
1553
|
consentDenied: (reason) => `denied${reason ? ` \u2014 ${reason}` : ""}`,
|
|
1554
|
+
placeholderBusy: "Tell the agent something while it works\u2026",
|
|
1555
|
+
steer: "Send to the agent",
|
|
1556
|
+
noAttachmentsWhileBusy: "Files can\u2019t be added while the agent is working \u2014 send them with your next message.",
|
|
1557
|
+
queuedWaiting: "waiting for the agent\u2019s next step",
|
|
1558
|
+
noteAt: {
|
|
1559
|
+
round: "you said, between tool calls",
|
|
1560
|
+
step: "you said, after this step",
|
|
1561
|
+
final: "you said, before the answer"
|
|
1562
|
+
},
|
|
1563
|
+
undelivered: (n) => `Not delivered (${plural(n, "message", "messages")})`,
|
|
1564
|
+
sendUndelivered: "Send now",
|
|
1565
|
+
discardUndelivered: "Discard",
|
|
1566
|
+
stopSubagent: "Stop this subagent",
|
|
1567
|
+
subagentStopped: "stopped",
|
|
1393
1568
|
failed: "failed",
|
|
1394
1569
|
toolCostTitle: "Estimated tokens of the arguments and of the result fed back to the model (chars / 4), and the call's duration"
|
|
1395
1570
|
};
|
|
@@ -1398,7 +1573,8 @@ var NESTED = [
|
|
|
1398
1573
|
"modes",
|
|
1399
1574
|
"commandGroups",
|
|
1400
1575
|
"commandDescriptions",
|
|
1401
|
-
"thinkingLevels"
|
|
1576
|
+
"thinkingLevels",
|
|
1577
|
+
"noteAt"
|
|
1402
1578
|
];
|
|
1403
1579
|
var mergeLabels = (base2, over) => {
|
|
1404
1580
|
if (!over) return base2;
|
|
@@ -1552,6 +1728,14 @@ var HistoryIcon = ({ size, className }) => /* @__PURE__ */ (0, import_jsx_runtim
|
|
|
1552
1728
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
|
|
1553
1729
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 3v5h5M12 7v5l3 2" })
|
|
1554
1730
|
] });
|
|
1731
|
+
var BookIcon = ({ size, className }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(size), className, children: [
|
|
1732
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2Z" }),
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 19V5M9 7h6" })
|
|
1734
|
+
] });
|
|
1735
|
+
var GlobeIcon = ({ size, className }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(size), className, children: [
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18" })
|
|
1738
|
+
] });
|
|
1555
1739
|
var DownloadIcon = ({ size, className }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...base(size), className, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 3v12m-5-5 5 5 5-5M5 21h14" }) });
|
|
1556
1740
|
|
|
1557
1741
|
// src/components/AgentComposer.tsx
|
|
@@ -1633,6 +1817,8 @@ var AgentComposer = ({
|
|
|
1633
1817
|
showAgents = true,
|
|
1634
1818
|
showApprovalMode = true,
|
|
1635
1819
|
showNotices = true,
|
|
1820
|
+
steering = true,
|
|
1821
|
+
showQueued = true,
|
|
1636
1822
|
compactWidth = 460,
|
|
1637
1823
|
toolbarExtra,
|
|
1638
1824
|
toolbarEnd,
|
|
@@ -1910,7 +2096,17 @@ var AgentComposer = ({
|
|
|
1910
2096
|
}, [attachments, dropZone]);
|
|
1911
2097
|
const submit = () => {
|
|
1912
2098
|
const raw = text.trim();
|
|
1913
|
-
|
|
2099
|
+
const intent = steerIntent({ raw, busy, steering, hasAttachments: pending.length > 0 });
|
|
2100
|
+
if (intent === "steer") {
|
|
2101
|
+
if (agent.send(raw)) setText("");
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2104
|
+
if (intent === "attachments") {
|
|
2105
|
+
setAttachError(L.noAttachmentsWhileBusy);
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
if (intent === "ignore") return;
|
|
2109
|
+
if (!ready) return;
|
|
1914
2110
|
const parsed = parseSlash(raw);
|
|
1915
2111
|
if (parsed) {
|
|
1916
2112
|
const cmd = allCommands.find((c) => c.name === parsed.name);
|
|
@@ -2008,6 +2204,24 @@ var AgentComposer = ({
|
|
|
2008
2204
|
const thinkingOptions = thinking?.options ?? DEFAULT_THINKING;
|
|
2009
2205
|
const thinkingLabel = thinking ? thinkingOptions.find((o) => o.id === thinking.value)?.label ?? thinking.value : void 0;
|
|
2010
2206
|
const canSend = ready && (text.trim().length > 0 || pending.length > 0);
|
|
2207
|
+
const canSteer = busy && steering && text.trim().length > 0;
|
|
2208
|
+
const queuedStrip = showQueued && (agent.queued.length > 0 || agent.undelivered.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "awr-queued", children: [
|
|
2209
|
+
agent.queued.map((q) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "awr-queued__item", role: "status", children: [
|
|
2210
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClockIcon, { size: 13, className: "awr-queued__icon" }),
|
|
2211
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "awr-queued__text", title: q.text, children: q.text }),
|
|
2212
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "awr-queued__state", children: L.queuedWaiting })
|
|
2213
|
+
] }, q.id)),
|
|
2214
|
+
agent.undelivered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "awr-queued__item awr-queued__item--undelivered", role: "status", children: [
|
|
2215
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AlertIcon, { size: 13, className: "awr-queued__icon" }),
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "awr-queued__text", title: agent.undelivered.join("\n\n"), children: [
|
|
2217
|
+
L.undelivered(agent.undelivered.length),
|
|
2218
|
+
": ",
|
|
2219
|
+
agent.undelivered.join(" \xB7 ")
|
|
2220
|
+
] }),
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: agent.sendUndelivered, children: L.sendUndelivered }),
|
|
2222
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: agent.discardUndelivered, children: L.discardUndelivered })
|
|
2223
|
+
] })
|
|
2224
|
+
] }) : null;
|
|
2011
2225
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2012
2226
|
"div",
|
|
2013
2227
|
{
|
|
@@ -2020,6 +2234,7 @@ var AgentComposer = ({
|
|
|
2020
2234
|
ref: rootRef,
|
|
2021
2235
|
children: [
|
|
2022
2236
|
dragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "awr-dropnote", style: dropRect, "aria-hidden": "true", children: L.dropHint }),
|
|
2237
|
+
queuedStrip,
|
|
2023
2238
|
notices.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "awr-notices", children: notices.map((n) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `awr-notice awr-notice--${n.tone}`, role: "status", children: [
|
|
2024
2239
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: n.text }),
|
|
2025
2240
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -2092,7 +2307,7 @@ var AgentComposer = ({
|
|
|
2092
2307
|
onChange: (e) => setText(e.target.value),
|
|
2093
2308
|
onKeyDown,
|
|
2094
2309
|
onPaste,
|
|
2095
|
-
placeholder: stt.listening ? L.listening : placeholder ?? L.placeholder,
|
|
2310
|
+
placeholder: stt.listening ? L.listening : busy && steering ? L.placeholderBusy : placeholder ?? L.placeholder,
|
|
2096
2311
|
disabled,
|
|
2097
2312
|
rows: 2,
|
|
2098
2313
|
"aria-label": L.message
|
|
@@ -2269,6 +2484,7 @@ var AgentComposer = ({
|
|
|
2269
2484
|
))
|
|
2270
2485
|
] })
|
|
2271
2486
|
] }),
|
|
2487
|
+
canSteer && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "awr-sendbtn", onClick: submit, "aria-label": L.steer, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SendIcon, { size: 16 }) }),
|
|
2272
2488
|
busy ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2273
2489
|
"button",
|
|
2274
2490
|
{
|
|
@@ -2643,6 +2859,7 @@ var ToolCallRow = ({ call, showUsage = true, labels }) => {
|
|
|
2643
2859
|
};
|
|
2644
2860
|
var SubagentRow = ({
|
|
2645
2861
|
sub,
|
|
2862
|
+
onStop,
|
|
2646
2863
|
labels
|
|
2647
2864
|
}) => {
|
|
2648
2865
|
const L = useLabels(labels);
|
|
@@ -2650,10 +2867,33 @@ var SubagentRow = ({
|
|
|
2650
2867
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "awr-subagent__head", children: [
|
|
2651
2868
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BotIcon, { size: 13, className: "awr-subagent__icon" }),
|
|
2652
2869
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-subagent__name", children: sub.name }),
|
|
2870
|
+
sub.profile && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
2653
2871
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
2654
|
-
sub.status === "running" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SpinnerIcon, { size: 12, className: "awr-tool__spin" })
|
|
2872
|
+
sub.status === "running" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
2873
|
+
sub.status === "running" && onStop && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2874
|
+
"button",
|
|
2875
|
+
{
|
|
2876
|
+
type: "button",
|
|
2877
|
+
className: "awr-iconbtn awr-subagent__stop",
|
|
2878
|
+
"aria-label": L.stopSubagent,
|
|
2879
|
+
title: L.stopSubagent,
|
|
2880
|
+
onClick: () => onStop(sub.id),
|
|
2881
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StopIcon, { size: 12 })
|
|
2882
|
+
}
|
|
2883
|
+
)
|
|
2655
2884
|
] }),
|
|
2656
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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)}` : ""}` })
|
|
2885
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "awr-subagent__activity", children: sub.status === "error" ? sub.error : sub.status === "stopped" ? L.subagentStopped : sub.status === "done" ? previewValue(sub.text, 160) : `${sub.activity}${sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` })
|
|
2886
|
+
] });
|
|
2887
|
+
};
|
|
2888
|
+
var UserNoteRow = ({
|
|
2889
|
+
note,
|
|
2890
|
+
labels
|
|
2891
|
+
}) => {
|
|
2892
|
+
const L = useLabels(labels);
|
|
2893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
2894
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
2895
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
2896
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("q", { className: "awr-note__text", children: note.text })
|
|
2657
2897
|
] });
|
|
2658
2898
|
};
|
|
2659
2899
|
var decisionLabel = (a, L) => a.status === "pending" ? L.consentWaiting : a.status === "approved" ? L.consentAllowed : L.consentDenied(a.reason);
|
|
@@ -2661,6 +2901,8 @@ var StepItem = ({
|
|
|
2661
2901
|
step,
|
|
2662
2902
|
subagents,
|
|
2663
2903
|
approvals,
|
|
2904
|
+
notes,
|
|
2905
|
+
onStopSubagent,
|
|
2664
2906
|
showToolCalls,
|
|
2665
2907
|
showUsage,
|
|
2666
2908
|
showThoughts,
|
|
@@ -2694,13 +2936,17 @@ var StepItem = ({
|
|
|
2694
2936
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { className: "awr-tool__name", children: a.name }),
|
|
2695
2937
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-tool__args", children: decisionLabel(a, L) })
|
|
2696
2938
|
] }, a.id)) }),
|
|
2697
|
-
subagents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "awr-subagents", children: subagents.map((sub) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SubagentRow, { sub }, sub.id)) }),
|
|
2939
|
+
subagents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "awr-subagents", children: subagents.map((sub) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SubagentRow, { sub, onStop: onStopSubagent }, sub.id)) }),
|
|
2940
|
+
notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UserNoteRow, { note: n }, n.id)) }),
|
|
2698
2941
|
step.blocked && step.summary && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "awr-step__blocked", children: step.summary })
|
|
2699
2942
|
] });
|
|
2700
2943
|
var StepList = ({
|
|
2701
2944
|
steps,
|
|
2702
2945
|
subagents = [],
|
|
2703
2946
|
approvals = [],
|
|
2947
|
+
notes = [],
|
|
2948
|
+
showNotes = true,
|
|
2949
|
+
onStopSubagent,
|
|
2704
2950
|
showToolCalls = true,
|
|
2705
2951
|
showUsage = true,
|
|
2706
2952
|
showThoughts = true,
|
|
@@ -2710,20 +2956,27 @@ var StepList = ({
|
|
|
2710
2956
|
}) => {
|
|
2711
2957
|
const L = useLabels(labels);
|
|
2712
2958
|
if (steps.length === 0) return null;
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2959
|
+
const known = new Set(steps.map((s) => s.id));
|
|
2960
|
+
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
2961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
2962
|
+
steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2963
|
+
StepItem,
|
|
2964
|
+
{
|
|
2965
|
+
step,
|
|
2966
|
+
subagents: subagents.filter((s) => s.stepId === step.id),
|
|
2967
|
+
approvals: approvals.filter((a) => a.stepId === step.id && a.status !== "pending"),
|
|
2968
|
+
notes: showNotes ? notes.filter((n) => n.stepId === step.id) : [],
|
|
2969
|
+
onStopSubagent,
|
|
2970
|
+
showToolCalls,
|
|
2971
|
+
showUsage,
|
|
2972
|
+
showThoughts,
|
|
2973
|
+
renderToolCall,
|
|
2974
|
+
L
|
|
2975
|
+
},
|
|
2976
|
+
step.id
|
|
2977
|
+
)),
|
|
2978
|
+
atEnd.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UserNoteRow, { note: n }, n.id)) }) })
|
|
2979
|
+
] });
|
|
2727
2980
|
};
|
|
2728
2981
|
|
|
2729
2982
|
// src/components/MessageList.tsx
|
|
@@ -2744,12 +2997,14 @@ var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith(
|
|
|
2744
2997
|
a.name
|
|
2745
2998
|
] });
|
|
2746
2999
|
var toolCallCount = (m) => (m.steps ?? []).reduce((n, s) => n + s.toolCalls.length, 0);
|
|
2747
|
-
var activitySummary = (m, showToolCalls, L) => {
|
|
3000
|
+
var activitySummary = (m, showToolCalls, showLearned, L) => {
|
|
2748
3001
|
const steps = m.steps ?? [];
|
|
2749
3002
|
const parts = [L.steps(steps.length)];
|
|
2750
3003
|
if (showToolCalls) parts.push(L.toolCalls(toolCallCount(m)));
|
|
2751
3004
|
if (m.subagents?.length) parts.push(L.subagents(m.subagents.length));
|
|
2752
3005
|
if (m.skills?.length) parts.push(L.skillsUsed(m.skills.join(", ")));
|
|
3006
|
+
if (showLearned && m.learned?.length) parts.push(L.learnedNow(m.learned.join(", ")));
|
|
3007
|
+
if (showLearned && m.fetches?.length) parts.push(L.fetches(m.fetches.length));
|
|
2753
3008
|
return parts.join(" \xB7 ");
|
|
2754
3009
|
};
|
|
2755
3010
|
var MessageList = ({
|
|
@@ -2759,6 +3014,9 @@ var MessageList = ({
|
|
|
2759
3014
|
showToolCalls = true,
|
|
2760
3015
|
showUsage = true,
|
|
2761
3016
|
showThoughts = true,
|
|
3017
|
+
showNotes = true,
|
|
3018
|
+
showLearned = true,
|
|
3019
|
+
onStopSubagent,
|
|
2762
3020
|
activityOpen = false,
|
|
2763
3021
|
liveExtra,
|
|
2764
3022
|
renderContent,
|
|
@@ -2782,7 +3040,7 @@ var MessageList = ({
|
|
|
2782
3040
|
className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
|
|
2783
3041
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "awr-msg__col", children: [
|
|
2784
3042
|
m.role === "assistant" && hasActivity && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
|
|
2785
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("summary", { className: "awr-activity__summary", children: activitySummary(m, showToolCalls, L) }),
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("summary", { className: "awr-activity__summary", children: activitySummary(m, showToolCalls, showLearned, L) }),
|
|
2786
3044
|
m.pending && liveExtra,
|
|
2787
3045
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2788
3046
|
StepList,
|
|
@@ -2790,6 +3048,9 @@ var MessageList = ({
|
|
|
2790
3048
|
steps,
|
|
2791
3049
|
subagents: m.subagents,
|
|
2792
3050
|
approvals: m.approvals,
|
|
3051
|
+
notes: m.notes,
|
|
3052
|
+
showNotes,
|
|
3053
|
+
onStopSubagent: m.pending ? onStopSubagent : void 0,
|
|
2793
3054
|
showToolCalls,
|
|
2794
3055
|
showUsage,
|
|
2795
3056
|
showThoughts,
|
|
@@ -2797,6 +3058,25 @@ var MessageList = ({
|
|
|
2797
3058
|
labels
|
|
2798
3059
|
}
|
|
2799
3060
|
),
|
|
3061
|
+
showLearned && m.fetches?.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3062
|
+
"li",
|
|
3063
|
+
{
|
|
3064
|
+
className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
|
|
3065
|
+
children: [
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GlobeIcon, { size: 12 }),
|
|
3067
|
+
" ",
|
|
3068
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: f.url }),
|
|
3069
|
+
" ",
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
|
|
3071
|
+
]
|
|
3072
|
+
},
|
|
3073
|
+
i
|
|
3074
|
+
)) }) : null,
|
|
3075
|
+
showLearned && m.learned?.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "awr-learned", children: [
|
|
3076
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BookIcon, { size: 12 }),
|
|
3077
|
+
" ",
|
|
3078
|
+
L.learnedNow(m.learned.join(", "))
|
|
3079
|
+
] }) : null,
|
|
2800
3080
|
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "awr-thought", children: [
|
|
2801
3081
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
|
|
2802
3082
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BrainIcon, { size: 13 }),
|
|
@@ -2931,6 +3211,9 @@ var AgentChatInner = ({
|
|
|
2931
3211
|
showToolCalls = true,
|
|
2932
3212
|
showUsage = true,
|
|
2933
3213
|
showThoughts = true,
|
|
3214
|
+
showNotes = true,
|
|
3215
|
+
showLearned = true,
|
|
3216
|
+
stoppableSubagents = true,
|
|
2934
3217
|
showTotalUsage = true,
|
|
2935
3218
|
showStatus = true,
|
|
2936
3219
|
showApprovalMode = true,
|
|
@@ -3113,6 +3396,9 @@ var AgentChatInner = ({
|
|
|
3113
3396
|
showToolCalls,
|
|
3114
3397
|
showUsage,
|
|
3115
3398
|
showThoughts,
|
|
3399
|
+
showNotes,
|
|
3400
|
+
showLearned,
|
|
3401
|
+
onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
|
|
3116
3402
|
activityOpen,
|
|
3117
3403
|
liveExtra,
|
|
3118
3404
|
renderContent,
|
|
@@ -3183,9 +3469,59 @@ var AgentChatInner = ({
|
|
|
3183
3469
|
);
|
|
3184
3470
|
};
|
|
3185
3471
|
|
|
3472
|
+
// src/components/LearnedSkills.tsx
|
|
3473
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3474
|
+
var LearnedSkills = ({
|
|
3475
|
+
controller,
|
|
3476
|
+
lessons,
|
|
3477
|
+
onForget,
|
|
3478
|
+
showSources = true,
|
|
3479
|
+
empty,
|
|
3480
|
+
hideTitle = false,
|
|
3481
|
+
labels,
|
|
3482
|
+
className
|
|
3483
|
+
}) => {
|
|
3484
|
+
const L = useLabels(labels);
|
|
3485
|
+
const ctx = useOptionalAgentContext();
|
|
3486
|
+
const c = controller ?? ctx;
|
|
3487
|
+
const list = lessons ?? c?.learned ?? [];
|
|
3488
|
+
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
3489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
3490
|
+
!hideTitle && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("h3", { className: "awr-notebook__title", children: [
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BookIcon, { size: 14 }),
|
|
3492
|
+
" ",
|
|
3493
|
+
L.notebookTitle,
|
|
3494
|
+
list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-notebook__count", children: list.length })
|
|
3495
|
+
] }),
|
|
3496
|
+
list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: "awr-lesson", children: [
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-lesson__head", children: [
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { className: "awr-lesson__name", children: l.name }),
|
|
3499
|
+
l.revision > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
3500
|
+
forget && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3501
|
+
"button",
|
|
3502
|
+
{
|
|
3503
|
+
type: "button",
|
|
3504
|
+
className: "awr-lesson__forget",
|
|
3505
|
+
title: `${L.notebookForget}: ${l.name}`,
|
|
3506
|
+
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
3507
|
+
onClick: () => void forget(l.name),
|
|
3508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(XIcon, { size: 12 })
|
|
3509
|
+
}
|
|
3510
|
+
)
|
|
3511
|
+
] }),
|
|
3512
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-lesson__when", children: l.description }),
|
|
3513
|
+
showSources && l.sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "awr-lesson__from", children: [
|
|
3514
|
+
L.notebookFrom,
|
|
3515
|
+
" ",
|
|
3516
|
+
l.sources.join(", ")
|
|
3517
|
+
] })
|
|
3518
|
+
] }, l.name)) })
|
|
3519
|
+
] });
|
|
3520
|
+
};
|
|
3521
|
+
|
|
3186
3522
|
// src/components/Composer.tsx
|
|
3187
3523
|
var import_react14 = require("react");
|
|
3188
|
-
var
|
|
3524
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3189
3525
|
var Composer = ({
|
|
3190
3526
|
onSubmit,
|
|
3191
3527
|
busy = false,
|
|
@@ -3207,7 +3543,7 @@ var Composer = ({
|
|
|
3207
3543
|
submit();
|
|
3208
3544
|
}
|
|
3209
3545
|
};
|
|
3210
|
-
return /* @__PURE__ */ (0,
|
|
3546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3211
3547
|
"form",
|
|
3212
3548
|
{
|
|
3213
3549
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -3216,7 +3552,7 @@ var Composer = ({
|
|
|
3216
3552
|
submit();
|
|
3217
3553
|
},
|
|
3218
3554
|
children: [
|
|
3219
|
-
/* @__PURE__ */ (0,
|
|
3555
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3220
3556
|
"textarea",
|
|
3221
3557
|
{
|
|
3222
3558
|
className: "awr-composer__input",
|
|
@@ -3228,23 +3564,23 @@ var Composer = ({
|
|
|
3228
3564
|
rows: 1
|
|
3229
3565
|
}
|
|
3230
3566
|
),
|
|
3231
|
-
busy ? /* @__PURE__ */ (0,
|
|
3567
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3232
3568
|
"button",
|
|
3233
3569
|
{
|
|
3234
3570
|
type: "button",
|
|
3235
3571
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
3236
3572
|
onClick: onStop,
|
|
3237
3573
|
"aria-label": "Stop",
|
|
3238
|
-
children: /* @__PURE__ */ (0,
|
|
3574
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StopIcon, { size: 18 })
|
|
3239
3575
|
}
|
|
3240
|
-
) : /* @__PURE__ */ (0,
|
|
3576
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3241
3577
|
"button",
|
|
3242
3578
|
{
|
|
3243
3579
|
type: "submit",
|
|
3244
3580
|
className: "awr-composer__btn",
|
|
3245
3581
|
disabled: disabled || !text.trim(),
|
|
3246
3582
|
"aria-label": "Send",
|
|
3247
|
-
children: disabled ? /* @__PURE__ */ (0,
|
|
3583
|
+
children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SendIcon, { size: 18 })
|
|
3248
3584
|
}
|
|
3249
3585
|
)
|
|
3250
3586
|
]
|
|
@@ -3253,17 +3589,17 @@ var Composer = ({
|
|
|
3253
3589
|
};
|
|
3254
3590
|
|
|
3255
3591
|
// src/components/PlanView.tsx
|
|
3256
|
-
var
|
|
3592
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3257
3593
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
3258
3594
|
if (!plan.steps.length && !plan.thought) return null;
|
|
3259
|
-
return /* @__PURE__ */ (0,
|
|
3260
|
-
showThought && plan.thought.trim() && /* @__PURE__ */ (0,
|
|
3261
|
-
plan.steps.length > 0 && /* @__PURE__ */ (0,
|
|
3595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
3596
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
3597
|
+
plan.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
3262
3598
|
] });
|
|
3263
3599
|
};
|
|
3264
3600
|
|
|
3265
3601
|
// src/components/ApprovalModeSwitch.tsx
|
|
3266
|
-
var
|
|
3602
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3267
3603
|
var DEFAULT_LABELS = {
|
|
3268
3604
|
autopilot: "Autopilot",
|
|
3269
3605
|
"ask-writes": "Ask before changes",
|
|
@@ -3283,13 +3619,13 @@ var ApprovalModeSwitch = ({
|
|
|
3283
3619
|
labels,
|
|
3284
3620
|
disabled,
|
|
3285
3621
|
className
|
|
3286
|
-
}) => /* @__PURE__ */ (0,
|
|
3622
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3287
3623
|
"div",
|
|
3288
3624
|
{
|
|
3289
3625
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
3290
3626
|
role: "radiogroup",
|
|
3291
3627
|
"aria-label": "Tool consent",
|
|
3292
|
-
children: modes.map((m) => /* @__PURE__ */ (0,
|
|
3628
|
+
children: modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3293
3629
|
"button",
|
|
3294
3630
|
{
|
|
3295
3631
|
type: "button",
|
|
@@ -3308,7 +3644,7 @@ var ApprovalModeSwitch = ({
|
|
|
3308
3644
|
|
|
3309
3645
|
// src/components/ApiKeyForm.tsx
|
|
3310
3646
|
var import_react15 = require("react");
|
|
3311
|
-
var
|
|
3647
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3312
3648
|
var ApiKeyForm = ({
|
|
3313
3649
|
credentials,
|
|
3314
3650
|
credentialRef,
|
|
@@ -3352,16 +3688,16 @@ var ApiKeyForm = ({
|
|
|
3352
3688
|
setBusy(false);
|
|
3353
3689
|
}
|
|
3354
3690
|
};
|
|
3355
|
-
return /* @__PURE__ */ (0,
|
|
3356
|
-
/* @__PURE__ */ (0,
|
|
3691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
3692
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "awr-keyform__label", children: [
|
|
3357
3693
|
label,
|
|
3358
|
-
present && /* @__PURE__ */ (0,
|
|
3359
|
-
/* @__PURE__ */ (0,
|
|
3694
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "awr-keyform__saved", children: [
|
|
3695
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CheckIcon, { size: 12 }),
|
|
3360
3696
|
" stored, encrypted"
|
|
3361
3697
|
] })
|
|
3362
3698
|
] }),
|
|
3363
|
-
/* @__PURE__ */ (0,
|
|
3364
|
-
/* @__PURE__ */ (0,
|
|
3699
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-keyform__row", children: [
|
|
3700
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3365
3701
|
"input",
|
|
3366
3702
|
{
|
|
3367
3703
|
className: "awr-keyform__input",
|
|
@@ -3379,7 +3715,7 @@ var ApiKeyForm = ({
|
|
|
3379
3715
|
disabled: busy
|
|
3380
3716
|
}
|
|
3381
3717
|
),
|
|
3382
|
-
/* @__PURE__ */ (0,
|
|
3718
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3383
3719
|
"button",
|
|
3384
3720
|
{
|
|
3385
3721
|
type: "button",
|
|
@@ -3389,7 +3725,7 @@ var ApiKeyForm = ({
|
|
|
3389
3725
|
children: "Save"
|
|
3390
3726
|
}
|
|
3391
3727
|
),
|
|
3392
|
-
present && /* @__PURE__ */ (0,
|
|
3728
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3393
3729
|
"button",
|
|
3394
3730
|
{
|
|
3395
3731
|
type: "button",
|
|
@@ -3422,7 +3758,9 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3422
3758
|
FilesPanel,
|
|
3423
3759
|
ImagesNotSupportedError,
|
|
3424
3760
|
IndexedDBStore,
|
|
3761
|
+
LearnedSkills,
|
|
3425
3762
|
MemoryCredentialStore,
|
|
3763
|
+
MemorySkillStore,
|
|
3426
3764
|
MemoryStore,
|
|
3427
3765
|
MessageList,
|
|
3428
3766
|
ModelLoadBar,
|
|
@@ -3432,7 +3770,9 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3432
3770
|
ToolApprovalPrompt,
|
|
3433
3771
|
ToolCallRow,
|
|
3434
3772
|
UsageBadge,
|
|
3773
|
+
UserNoteRow,
|
|
3435
3774
|
VaultCredentialStore,
|
|
3775
|
+
VfsSkillStore,
|
|
3436
3776
|
VirtualFileSystem,
|
|
3437
3777
|
agentStateReducer,
|
|
3438
3778
|
attachmentKindOf,
|
|
@@ -3441,6 +3781,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3441
3781
|
createAgent,
|
|
3442
3782
|
createFileTools,
|
|
3443
3783
|
createInitialAgentState,
|
|
3784
|
+
createRunControl,
|
|
3444
3785
|
createSubagentTool,
|
|
3445
3786
|
createWebLLMEngine,
|
|
3446
3787
|
createWebLLMModel,
|
|
@@ -3451,6 +3792,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3451
3792
|
filterCommands,
|
|
3452
3793
|
formatElapsed,
|
|
3453
3794
|
isWebGPUAvailable,
|
|
3795
|
+
lessonsOf,
|
|
3454
3796
|
loadSkillFromUrl,
|
|
3455
3797
|
markReadOnly,
|
|
3456
3798
|
mergeLabels,
|
|
@@ -3460,6 +3802,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3460
3802
|
parseSlash,
|
|
3461
3803
|
preloadWebLLMModel,
|
|
3462
3804
|
serveSubagentWorker,
|
|
3805
|
+
steerIntent,
|
|
3463
3806
|
supportsImages,
|
|
3464
3807
|
supportsPdf,
|
|
3465
3808
|
unloadWebLLMModel,
|