@dudko.dev/agent-web-ui 0.0.6 → 0.0.8
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 +52 -0
- package/dist/{chunk-NHU6WQM5.js → chunk-ETYLHTPK.js} +435 -1
- package/dist/{chunk-627OXMFG.js → chunk-HIHUK7YA.js} +5 -0
- package/dist/{chunk-S5AHUAFG.js → chunk-JEW2ZWYX.js} +4 -0
- package/dist/{chunk-VZCQXE3P.js → chunk-UO2Q7AIV.js} +4 -0
- package/dist/{chunk-V33T6VX3.js → chunk-VG5NLFI5.js} +4 -0
- package/dist/controller.cjs +452 -16
- package/dist/controller.d.cts +39 -3
- package/dist/controller.d.ts +39 -3
- package/dist/controller.js +39 -16
- package/dist/{en-Dg2MtzcJ.d.cts → en-CPCAidve.d.cts} +4 -0
- package/dist/{en-Dg2MtzcJ.d.ts → en-CPCAidve.d.ts} +4 -0
- package/dist/index.cjs +458 -4
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +37 -1
- package/dist/{labels-CCPL7t17.d.ts → labels-CeJMN8NU.d.ts} +9 -1
- package/dist/{labels-ipy-ydkp.d.cts → labels-D-NI4hKW.d.cts} +9 -1
- package/dist/locales/be.cjs +9 -0
- package/dist/locales/be.d.cts +2 -2
- package/dist/locales/be.d.ts +2 -2
- package/dist/locales/be.js +5 -1
- package/dist/locales/bg.cjs +9 -0
- package/dist/locales/bg.d.cts +2 -2
- package/dist/locales/bg.d.ts +2 -2
- package/dist/locales/bg.js +5 -1
- package/dist/locales/ca.cjs +9 -0
- package/dist/locales/ca.d.cts +2 -2
- package/dist/locales/ca.d.ts +2 -2
- package/dist/locales/ca.js +5 -1
- package/dist/locales/cs.cjs +9 -0
- package/dist/locales/cs.d.cts +2 -2
- package/dist/locales/cs.d.ts +2 -2
- package/dist/locales/cs.js +5 -1
- package/dist/locales/da.cjs +9 -0
- package/dist/locales/da.d.cts +2 -2
- package/dist/locales/da.d.ts +2 -2
- package/dist/locales/da.js +5 -1
- package/dist/locales/de.cjs +9 -0
- package/dist/locales/de.d.cts +2 -2
- package/dist/locales/de.d.ts +2 -2
- package/dist/locales/de.js +5 -1
- package/dist/locales/el.cjs +9 -0
- package/dist/locales/el.d.cts +2 -2
- package/dist/locales/el.d.ts +2 -2
- package/dist/locales/el.js +5 -1
- package/dist/locales/en.cjs +9 -0
- package/dist/locales/en.d.cts +2 -2
- package/dist/locales/en.d.ts +2 -2
- package/dist/locales/en.js +5 -1
- package/dist/locales/es-419.cjs +9 -0
- package/dist/locales/es-419.d.cts +2 -2
- package/dist/locales/es-419.d.ts +2 -2
- package/dist/locales/es-419.js +2 -2
- package/dist/locales/es.cjs +9 -0
- package/dist/locales/es.d.cts +2 -2
- package/dist/locales/es.d.ts +2 -2
- package/dist/locales/es.js +2 -2
- package/dist/locales/fi.cjs +9 -0
- package/dist/locales/fi.d.cts +2 -2
- package/dist/locales/fi.d.ts +2 -2
- package/dist/locales/fi.js +5 -1
- package/dist/locales/fr-CA.cjs +9 -0
- package/dist/locales/fr-CA.d.cts +2 -2
- package/dist/locales/fr-CA.d.ts +2 -2
- package/dist/locales/fr-CA.js +2 -2
- package/dist/locales/fr.cjs +9 -0
- package/dist/locales/fr.d.cts +2 -2
- package/dist/locales/fr.d.ts +2 -2
- package/dist/locales/fr.js +2 -2
- package/dist/locales/gn.cjs +9 -0
- package/dist/locales/gn.d.cts +2 -2
- package/dist/locales/gn.d.ts +2 -2
- package/dist/locales/gn.js +5 -1
- package/dist/locales/hr.cjs +9 -0
- package/dist/locales/hr.d.cts +2 -2
- package/dist/locales/hr.d.ts +2 -2
- package/dist/locales/hr.js +5 -1
- package/dist/locales/ht.cjs +9 -0
- package/dist/locales/ht.d.cts +2 -2
- package/dist/locales/ht.d.ts +2 -2
- package/dist/locales/ht.js +5 -1
- package/dist/locales/hu.cjs +9 -0
- package/dist/locales/hu.d.cts +2 -2
- package/dist/locales/hu.d.ts +2 -2
- package/dist/locales/hu.js +5 -1
- package/dist/locales/index.cjs +5 -0
- package/dist/locales/index.d.cts +4 -4
- package/dist/locales/index.d.ts +4 -4
- package/dist/locales/index.js +1 -1
- package/dist/locales/it.cjs +9 -0
- package/dist/locales/it.d.cts +2 -2
- package/dist/locales/it.d.ts +2 -2
- package/dist/locales/it.js +5 -1
- package/dist/locales/nb.cjs +9 -0
- package/dist/locales/nb.d.cts +2 -2
- package/dist/locales/nb.d.ts +2 -2
- package/dist/locales/nb.js +5 -1
- package/dist/locales/nl.cjs +9 -0
- package/dist/locales/nl.d.cts +2 -2
- package/dist/locales/nl.d.ts +2 -2
- package/dist/locales/nl.js +5 -1
- package/dist/locales/pl.cjs +9 -0
- package/dist/locales/pl.d.cts +2 -2
- package/dist/locales/pl.d.ts +2 -2
- package/dist/locales/pl.js +5 -1
- package/dist/locales/pt-BR.cjs +9 -0
- package/dist/locales/pt-BR.d.cts +2 -2
- package/dist/locales/pt-BR.d.ts +2 -2
- package/dist/locales/pt-BR.js +5 -1
- package/dist/locales/pt.cjs +9 -0
- package/dist/locales/pt.d.cts +2 -2
- package/dist/locales/pt.d.ts +2 -2
- package/dist/locales/pt.js +5 -1
- package/dist/locales/qu.cjs +9 -0
- package/dist/locales/qu.d.cts +2 -2
- package/dist/locales/qu.d.ts +2 -2
- package/dist/locales/qu.js +5 -1
- package/dist/locales/ro.cjs +9 -0
- package/dist/locales/ro.d.cts +2 -2
- package/dist/locales/ro.d.ts +2 -2
- package/dist/locales/ro.js +5 -1
- package/dist/locales/ru.cjs +9 -0
- package/dist/locales/ru.d.cts +2 -2
- package/dist/locales/ru.d.ts +2 -2
- package/dist/locales/ru.js +5 -1
- package/dist/locales/sk.cjs +9 -0
- package/dist/locales/sk.d.cts +2 -2
- package/dist/locales/sk.d.ts +2 -2
- package/dist/locales/sk.js +5 -1
- package/dist/locales/sq.cjs +9 -0
- package/dist/locales/sq.d.cts +2 -2
- package/dist/locales/sq.d.ts +2 -2
- package/dist/locales/sq.js +5 -1
- package/dist/locales/sr-Latn.cjs +9 -0
- package/dist/locales/sr-Latn.d.cts +2 -2
- package/dist/locales/sr-Latn.d.ts +2 -2
- package/dist/locales/sr-Latn.js +2 -2
- package/dist/locales/sr.cjs +9 -0
- package/dist/locales/sr.d.cts +2 -2
- package/dist/locales/sr.d.ts +2 -2
- package/dist/locales/sr.js +2 -2
- package/dist/locales/sv.cjs +9 -0
- package/dist/locales/sv.d.cts +2 -2
- package/dist/locales/sv.d.ts +2 -2
- package/dist/locales/sv.js +5 -1
- package/dist/locales/tr.cjs +9 -0
- package/dist/locales/tr.d.cts +2 -2
- package/dist/locales/tr.d.ts +2 -2
- package/dist/locales/tr.js +5 -1
- package/dist/locales/uk.cjs +9 -0
- package/dist/locales/uk.d.cts +2 -2
- package/dist/locales/uk.d.ts +2 -2
- package/dist/locales/uk.js +5 -1
- package/dist/page-context-BAmw4p6d.d.cts +244 -0
- package/dist/page-context-BAmw4p6d.d.ts +244 -0
- package/dist/pipeline-format.cjs +842 -0
- package/dist/pipeline-format.d.cts +512 -0
- package/dist/pipeline-format.d.ts +512 -0
- package/dist/pipeline-format.js +788 -0
- package/dist/pipeline.cjs +1 -0
- package/dist/pipeline.d.cts +2 -0
- package/dist/pipeline.d.ts +2 -0
- package/dist/pipeline.js +1 -0
- package/dist/styles.css +59 -0
- package/dist/{types-CQquuZpl.d.cts → types-B5cyqkWY.d.cts} +1 -1
- package/dist/{types-CXZfZVP5.d.ts → types-BgNjWN5Z.d.ts} +1 -1
- package/dist/{types-DnBCok3z.d.ts → types-CHFtTZjl.d.cts} +6 -0
- package/dist/{types-DnBCok3z.d.cts → types-CHFtTZjl.d.ts} +6 -0
- package/package.json +12 -2
package/dist/index.cjs
CHANGED
|
@@ -46,12 +46,17 @@ __export(src_exports, {
|
|
|
46
46
|
NAMED_FILES_MAX: () => NAMED_FILES_MAX,
|
|
47
47
|
NAMED_FILES_SCAN_MAX: () => NAMED_FILES_SCAN_MAX,
|
|
48
48
|
NAMED_FILES_TEXT_MAX: () => NAMED_FILES_TEXT_MAX,
|
|
49
|
+
PAGE_CONTEXT_ASK_ON_SEND: () => PAGE_CONTEXT_ASK_ON_SEND,
|
|
50
|
+
PAGE_CONTEXT_MAX_CHARS: () => PAGE_CONTEXT_MAX_CHARS,
|
|
51
|
+
PAGE_CONTEXT_SELECTION_MAX: () => PAGE_CONTEXT_SELECTION_MAX,
|
|
52
|
+
PAGE_CONTEXT_VALUE_MAX: () => PAGE_CONTEXT_VALUE_MAX,
|
|
49
53
|
PROMPT_ARM_MS: () => PROMPT_ARM_MS,
|
|
50
54
|
QUESTION_TIMEOUT_MS: () => QUESTION_TIMEOUT_MS,
|
|
51
55
|
RECORDING_DEFAULT_MAX_MS: () => RECORDING_DEFAULT_MAX_MS,
|
|
52
56
|
RECORDING_TYPES: () => RECORDING_TYPES,
|
|
53
57
|
SpeechOutputError: () => SpeechOutputError,
|
|
54
58
|
activeElementOf: () => activeElementOf,
|
|
59
|
+
addressWithoutQuery: () => addressWithoutQuery,
|
|
55
60
|
agentCoreIfLoaded: () => agentCoreIfLoaded,
|
|
56
61
|
agentStateReducer: () => agentStateReducer,
|
|
57
62
|
agentStatusOf: () => agentStatusOf,
|
|
@@ -68,6 +73,7 @@ __export(src_exports, {
|
|
|
68
73
|
audioTypeOf: () => audioTypeOf,
|
|
69
74
|
boxLength: () => boxLength,
|
|
70
75
|
buildSandboxedDocument: () => buildSandboxedDocument,
|
|
76
|
+
capPageContext: () => capPageContext,
|
|
71
77
|
chatTitle: () => chatTitle,
|
|
72
78
|
clampFrameHeight: () => clampFrameHeight,
|
|
73
79
|
coalesce: () => coalesce,
|
|
@@ -77,6 +83,7 @@ __export(src_exports, {
|
|
|
77
83
|
createBrowserSpeaker: () => createBrowserSpeaker,
|
|
78
84
|
createElicitationQueue: () => createElicitationQueue,
|
|
79
85
|
createInitialAgentState: () => createInitialAgentState,
|
|
86
|
+
createPageContextCollector: () => createPageContextCollector,
|
|
80
87
|
createPromptArming: () => createPromptArming,
|
|
81
88
|
createQuestionQueue: () => createQuestionQueue,
|
|
82
89
|
createRecordingRecognizer: () => createRecordingRecognizer,
|
|
@@ -102,6 +109,7 @@ __export(src_exports, {
|
|
|
102
109
|
fileKindOf: () => fileKindOf,
|
|
103
110
|
fileNameOf: () => fileNameOf,
|
|
104
111
|
filterCommands: () => filterCommands,
|
|
112
|
+
focusEntries: () => focusEntries,
|
|
105
113
|
followOtherTabs: () => followOtherTabs,
|
|
106
114
|
followsAfterResize: () => followsAfterResize,
|
|
107
115
|
followsAfterScroll: () => followsAfterScroll,
|
|
@@ -112,12 +120,15 @@ __export(src_exports, {
|
|
|
112
120
|
formatProbability: () => formatProbability,
|
|
113
121
|
formatTokens: () => formatTokens,
|
|
114
122
|
freeAttachmentPath: () => freeAttachmentPath,
|
|
123
|
+
headingsInView: () => headingsInView,
|
|
115
124
|
imageSizeOf: () => imageSizeOf,
|
|
116
125
|
imagesInOutput: () => imagesInOutput,
|
|
117
126
|
inputCounterShown: () => inputCounterShown,
|
|
118
127
|
insertionFits: () => insertionFits,
|
|
128
|
+
isEditableElement: () => isEditableElement,
|
|
119
129
|
isEventInside: () => isEventInside,
|
|
120
130
|
isOneCharacter: () => isOneCharacter,
|
|
131
|
+
isSecretField: () => isSecretField,
|
|
121
132
|
isShadowRoot: () => isShadowRoot,
|
|
122
133
|
languageOfText: () => languageOfText,
|
|
123
134
|
lessonsOf: () => lessonsOf,
|
|
@@ -144,6 +155,8 @@ __export(src_exports, {
|
|
|
144
155
|
noticesOf: () => noticesOf,
|
|
145
156
|
overflowOf: () => overflowOf,
|
|
146
157
|
ownUnsaved: () => ownUnsaved,
|
|
158
|
+
pageContextOff: () => pageContextOff,
|
|
159
|
+
pageContextRows: () => pageContextRows,
|
|
147
160
|
parseSlash: () => parseSlash,
|
|
148
161
|
pathsNamedIn: () => pathsNamedIn,
|
|
149
162
|
pendingApprovalsOf: () => pendingApprovalsOf,
|
|
@@ -156,6 +169,7 @@ __export(src_exports, {
|
|
|
156
169
|
recordingSupported: () => recordingSupported,
|
|
157
170
|
remoteAnswerOf: () => remoteAnswerOf,
|
|
158
171
|
rootOf: () => rootOf,
|
|
172
|
+
roundCoordinate: () => roundCoordinate,
|
|
159
173
|
sandboxTokens: () => sandboxTokens,
|
|
160
174
|
sandboxedCsp: () => sandboxedCsp,
|
|
161
175
|
saveAttachments: () => saveAttachments,
|
|
@@ -172,6 +186,7 @@ __export(src_exports, {
|
|
|
172
186
|
subagentTree: () => subagentTree,
|
|
173
187
|
textExcerpt: () => textExcerpt,
|
|
174
188
|
tokenizeHtml: () => tokenizeHtml,
|
|
189
|
+
trackPageFocus: () => trackPageFocus,
|
|
175
190
|
unchangedSince: () => unchangedSince,
|
|
176
191
|
voiceFor: () => voiceFor,
|
|
177
192
|
voiceMessageName: () => voiceMessageName,
|
|
@@ -181,6 +196,7 @@ __export(src_exports, {
|
|
|
181
196
|
withAttachments: () => withAttachments,
|
|
182
197
|
withCspFirst: () => withCspFirst,
|
|
183
198
|
withPolicyFirst: () => withPolicyFirst,
|
|
199
|
+
withoutAskOnSend: () => withoutAskOnSend,
|
|
184
200
|
withoutOwnWords: () => withoutOwnWords,
|
|
185
201
|
workspacePathOf: () => workspacePathOf
|
|
186
202
|
});
|
|
@@ -426,6 +442,7 @@ var sentEntryOf = (queued, text2) => queued.findIndex(
|
|
|
426
442
|
(q) => q.sentTo === "another-tab" && (q.text === text2 || text2.endsWith("…") && q.text.length > text2.length && q.text.startsWith(text2.slice(0, -1)))
|
|
427
443
|
);
|
|
428
444
|
var patchStep = (steps, id, fn) => steps.map((s) => s.id === id ? fn(s) : s);
|
|
445
|
+
var summaryOf = (summary) => typeof summary === "string" && summary.trim() ? { summary: summary.slice(0, 4e3) } : {};
|
|
429
446
|
var withoutSkillBody = (a) => {
|
|
430
447
|
if (!a.skill || a.skill.body === void 0) return a;
|
|
431
448
|
const { body: _body, ...skill } = a.skill;
|
|
@@ -511,13 +528,20 @@ var answerQuestion = (state, event) => state.questions?.some((q) => q.id === eve
|
|
|
511
528
|
} : state;
|
|
512
529
|
var patchSubagent = (subagents, id, fn) => subagents.map((s) => s.id === id ? fn(s) : s);
|
|
513
530
|
var runningStepId = (steps) => [...steps].reverse().find((s) => s.status === "running")?.id;
|
|
531
|
+
var stepPlace = (index, total) => {
|
|
532
|
+
const whole = (n) => typeof n === "number" && Number.isInteger(n);
|
|
533
|
+
if (whole(index) && whole(total) && index >= 1 && total >= index) return `${index}/${total}`;
|
|
534
|
+
if (whole(index) && index >= 0 && total === void 0) return String(index + 1);
|
|
535
|
+
if (whole(index) && index >= 1) return String(index);
|
|
536
|
+
return "?";
|
|
537
|
+
};
|
|
514
538
|
var applySubagentEvent = (view, event) => {
|
|
515
539
|
switch (event.type) {
|
|
516
540
|
case "step.start":
|
|
517
541
|
return {
|
|
518
542
|
...view,
|
|
519
543
|
steps: view.steps + 1,
|
|
520
|
-
activity: `step ${event.index
|
|
544
|
+
activity: `step ${stepPlace(event.index, event.total)}: ${event.step.description}`,
|
|
521
545
|
// Known only when the child runs with model tiers.
|
|
522
546
|
...event.model !== void 0 ? { model: event.model } : {},
|
|
523
547
|
...event.tier !== void 0 ? { tier: event.tier } : {}
|
|
@@ -705,6 +729,7 @@ var applySubagent = (state, event, ancestors, ctx) => {
|
|
|
705
729
|
},
|
|
706
730
|
...inner.skill ? { skill: inner.skill } : {},
|
|
707
731
|
...inner.rule ? { rule: inner.rule } : {},
|
|
732
|
+
...summaryOf(inner.summary),
|
|
708
733
|
...ctx.remote ? { remote: true } : {},
|
|
709
734
|
status: "pending"
|
|
710
735
|
}
|
|
@@ -1259,6 +1284,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
1259
1284
|
...event.app ? { app: event.app } : {},
|
|
1260
1285
|
...event.skill ? { skill: event.skill } : {},
|
|
1261
1286
|
...event.rule ? { rule: event.rule } : {},
|
|
1287
|
+
...summaryOf(event.summary),
|
|
1262
1288
|
// Asked in the tab that runs the tool: shown here, answered there.
|
|
1263
1289
|
...ctx.remote ? { remote: true } : {},
|
|
1264
1290
|
status: "pending"
|
|
@@ -2229,6 +2255,10 @@ var defaultLabels = {
|
|
|
2229
2255
|
questionOther: "Other…",
|
|
2230
2256
|
questionOtherLabel: "Your answer",
|
|
2231
2257
|
questionSkip: "Skip",
|
|
2258
|
+
pageContextSharing: "Sharing",
|
|
2259
|
+
pageContextNotSharing: "Not shared with this message",
|
|
2260
|
+
pageContextDontShare: "Don’t share with this message",
|
|
2261
|
+
pageContextAskedOnSend: "asked when you send",
|
|
2232
2262
|
questionExpiresIn: (time) => `If you do not answer, the agent decides by itself in ${time}`,
|
|
2233
2263
|
questionRemote: "Answered in the other tab, where the agent is running.",
|
|
2234
2264
|
questionAutomatic: (reason) => `The agent went on without your answer: ${reason}.`,
|
|
@@ -2698,6 +2728,414 @@ var downscaleImage = async (file, opts = {}) => {
|
|
|
2698
2728
|
return out && out.size < file.size ? out : file;
|
|
2699
2729
|
};
|
|
2700
2730
|
|
|
2731
|
+
// src/page-context.ts
|
|
2732
|
+
var PAGE_CONTEXT_VALUE_MAX = 500;
|
|
2733
|
+
var PAGE_CONTEXT_SELECTION_MAX = 500;
|
|
2734
|
+
var PAGE_CONTEXT_MAX_CHARS = 2e3;
|
|
2735
|
+
var HEADINGS_MAX = 8;
|
|
2736
|
+
var CLIP = "…";
|
|
2737
|
+
var clip = (text2, max) => text2.length > max ? `${text2.slice(0, Math.max(0, max - 1))}${CLIP}` : text2;
|
|
2738
|
+
var oneLine = (text2) => text2.replace(/\s+/g, " ").trim();
|
|
2739
|
+
var pageEnv = () => {
|
|
2740
|
+
const g = globalThis;
|
|
2741
|
+
if (typeof g.window === "undefined") return {};
|
|
2742
|
+
const w = g;
|
|
2743
|
+
return {
|
|
2744
|
+
location: w.location,
|
|
2745
|
+
document: w.document,
|
|
2746
|
+
getSelection: () => w.getSelection?.() ?? null,
|
|
2747
|
+
innerWidth: w.innerWidth,
|
|
2748
|
+
innerHeight: w.innerHeight,
|
|
2749
|
+
scrollY: w.scrollY,
|
|
2750
|
+
matchMedia: (q) => w.matchMedia(q),
|
|
2751
|
+
...g.navigator?.geolocation ? { geolocation: g.navigator.geolocation } : {},
|
|
2752
|
+
now: () => Date.now(),
|
|
2753
|
+
timeZone: () => Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
2754
|
+
screenWidth: g.screen?.width ?? w.innerWidth
|
|
2755
|
+
};
|
|
2756
|
+
};
|
|
2757
|
+
var pageContextOff = (options) => !options || !options.extra && !Object.values(options.collect ?? {}).some((v) => v !== false && v != null);
|
|
2758
|
+
var addressWithoutQuery = (href) => {
|
|
2759
|
+
try {
|
|
2760
|
+
const u = new URL(href);
|
|
2761
|
+
if (u.protocol !== "http:" && u.protocol !== "https:") return void 0;
|
|
2762
|
+
return `${u.origin}${u.pathname}`;
|
|
2763
|
+
} catch {
|
|
2764
|
+
return void 0;
|
|
2765
|
+
}
|
|
2766
|
+
};
|
|
2767
|
+
var autocompleteTokens = (el) => (el.getAttribute("autocomplete") ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
2768
|
+
var isSecretField = (el) => {
|
|
2769
|
+
const type = (el.type ?? el.getAttribute("type") ?? "").toLowerCase();
|
|
2770
|
+
if (type === "password" || type === "hidden") return true;
|
|
2771
|
+
return autocompleteTokens(el).some(
|
|
2772
|
+
(t) => t.startsWith("cc-") || t === "one-time-code" || t === "current-password" || t === "new-password"
|
|
2773
|
+
);
|
|
2774
|
+
};
|
|
2775
|
+
var IMPLICIT_ROLE = {
|
|
2776
|
+
a: "link",
|
|
2777
|
+
button: "button",
|
|
2778
|
+
textarea: "textbox",
|
|
2779
|
+
select: "combobox",
|
|
2780
|
+
h1: "heading",
|
|
2781
|
+
h2: "heading",
|
|
2782
|
+
h3: "heading",
|
|
2783
|
+
summary: "button"
|
|
2784
|
+
};
|
|
2785
|
+
var roleOf = (el) => {
|
|
2786
|
+
const explicit = el.getAttribute("role");
|
|
2787
|
+
if (explicit) return explicit.split(/\s+/)[0];
|
|
2788
|
+
const tag = el.tagName.toLowerCase();
|
|
2789
|
+
if (tag === "input") {
|
|
2790
|
+
const type = (el.type ?? el.getAttribute("type") ?? "text").toLowerCase();
|
|
2791
|
+
if (type === "checkbox") return "checkbox";
|
|
2792
|
+
if (type === "radio") return "radio";
|
|
2793
|
+
if (type === "button" || type === "submit" || type === "reset") return "button";
|
|
2794
|
+
if (type === "range") return "slider";
|
|
2795
|
+
if (type === "search") return "searchbox";
|
|
2796
|
+
return "textbox";
|
|
2797
|
+
}
|
|
2798
|
+
if (tag !== "textarea" && tag !== "select" && isEditableElement(el)) return "textbox";
|
|
2799
|
+
return IMPLICIT_ROLE[tag] ?? tag;
|
|
2800
|
+
};
|
|
2801
|
+
var EDITABLE_ROLES = /* @__PURE__ */ new Set(["textbox", "searchbox", "combobox", "spinbutton"]);
|
|
2802
|
+
var isEditableElement = (el) => {
|
|
2803
|
+
const tag = el.tagName.toLowerCase();
|
|
2804
|
+
if (tag === "input" || tag === "textarea" || tag === "select") return true;
|
|
2805
|
+
if (el.isContentEditable === true) return true;
|
|
2806
|
+
const ce = el.getAttribute("contenteditable");
|
|
2807
|
+
if (ce !== null && ce.toLowerCase() !== "false") return true;
|
|
2808
|
+
const role = (el.getAttribute("role") ?? "").toLowerCase().split(/\s+/)[0] ?? "";
|
|
2809
|
+
return EDITABLE_ROLES.has(role);
|
|
2810
|
+
};
|
|
2811
|
+
var nameOf = (el, env) => {
|
|
2812
|
+
const aria = el.getAttribute("aria-label");
|
|
2813
|
+
if (aria) return aria;
|
|
2814
|
+
const by = el.getAttribute("aria-labelledby");
|
|
2815
|
+
if (by) {
|
|
2816
|
+
const text2 = by.split(/\s+/).map((id) => env.document?.getElementById?.(id)?.textContent ?? "").join(" ");
|
|
2817
|
+
if (text2.trim()) return text2;
|
|
2818
|
+
}
|
|
2819
|
+
const label = el.labels && el.labels.length ? el.labels[0]?.textContent ?? "" : "";
|
|
2820
|
+
if (label.trim()) return label;
|
|
2821
|
+
const placeholder = el.getAttribute("placeholder") ?? el.getAttribute("title");
|
|
2822
|
+
if (placeholder) return placeholder;
|
|
2823
|
+
return isEditableElement(el) ? "" : el.textContent ?? "";
|
|
2824
|
+
};
|
|
2825
|
+
var focusEntries = (env, includeValues) => {
|
|
2826
|
+
const el = env.document?.activeElement;
|
|
2827
|
+
if (!el) return {};
|
|
2828
|
+
const tag = el.tagName.toLowerCase();
|
|
2829
|
+
if (tag === "body" || tag === "html") return {};
|
|
2830
|
+
const out = { "focus.role": roleOf(el) };
|
|
2831
|
+
const name = clip(oneLine(nameOf(el, env)), 120);
|
|
2832
|
+
if (name) out["focus.label"] = name;
|
|
2833
|
+
out["focus.type"] = tag === "input" ? `input:${(el.type ?? "text").toLowerCase()}` : tag;
|
|
2834
|
+
if (includeValues && isEditableElement(el) && !isSecretField(el)) {
|
|
2835
|
+
const isControl = tag === "input" || tag === "textarea" || tag === "select";
|
|
2836
|
+
const raw = isControl ? el.value : el.textContent;
|
|
2837
|
+
const value = typeof raw === "string" ? raw.trim() : "";
|
|
2838
|
+
if (value) out["focus.value"] = clip(value, PAGE_CONTEXT_VALUE_MAX);
|
|
2839
|
+
}
|
|
2840
|
+
return out;
|
|
2841
|
+
};
|
|
2842
|
+
var headingsInView = (env) => {
|
|
2843
|
+
const all = env.document?.querySelectorAll?.("h1, h2, h3");
|
|
2844
|
+
if (!all) return void 0;
|
|
2845
|
+
const height = env.innerHeight ?? Infinity;
|
|
2846
|
+
const shown = [];
|
|
2847
|
+
for (let i = 0; i < all.length && shown.length < HEADINGS_MAX; i++) {
|
|
2848
|
+
const h = all[i];
|
|
2849
|
+
const box = h.getBoundingClientRect?.();
|
|
2850
|
+
if (box && (box.bottom < 0 || box.top > height)) continue;
|
|
2851
|
+
const text2 = clip(oneLine(h.textContent ?? ""), 120);
|
|
2852
|
+
if (text2) shown.push(text2);
|
|
2853
|
+
}
|
|
2854
|
+
return shown.length ? clip(shown.join(" / "), PAGE_CONTEXT_VALUE_MAX) : void 0;
|
|
2855
|
+
};
|
|
2856
|
+
var roundCoordinate = (value, precision) => {
|
|
2857
|
+
const p = Math.min(6, Math.max(0, Math.floor(precision)));
|
|
2858
|
+
const f = 10 ** p;
|
|
2859
|
+
return Math.round(value * f) / f;
|
|
2860
|
+
};
|
|
2861
|
+
var localIso = (ms) => {
|
|
2862
|
+
const d = new Date(ms);
|
|
2863
|
+
const pad2 = (n) => String(Math.abs(n)).padStart(2, "0");
|
|
2864
|
+
const off = -d.getTimezoneOffset();
|
|
2865
|
+
const sign = off >= 0 ? "+" : "-";
|
|
2866
|
+
return `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}T${pad2(d.getHours())}:${pad2(d.getMinutes())}${sign}${pad2(Math.floor(Math.abs(off) / 60))}:${pad2(Math.abs(off) % 60)}`;
|
|
2867
|
+
};
|
|
2868
|
+
var capPageContext = (context, max) => {
|
|
2869
|
+
let left = max;
|
|
2870
|
+
const out = {};
|
|
2871
|
+
for (const [k, v] of Object.entries(context)) {
|
|
2872
|
+
const text2 = v === null ? "" : String(v);
|
|
2873
|
+
const room = left - k.length - 2;
|
|
2874
|
+
if (room <= 0) break;
|
|
2875
|
+
if (typeof v === "string" && text2.length > room) {
|
|
2876
|
+
if (room < 8) break;
|
|
2877
|
+
out[k] = clip(text2, room);
|
|
2878
|
+
left = 0;
|
|
2879
|
+
break;
|
|
2880
|
+
}
|
|
2881
|
+
if (typeof v !== "string" && text2.length > room) break;
|
|
2882
|
+
out[k] = v;
|
|
2883
|
+
left -= k.length + 2 + text2.length;
|
|
2884
|
+
}
|
|
2885
|
+
return out;
|
|
2886
|
+
};
|
|
2887
|
+
var trackPageFocus = (doc, isInside) => {
|
|
2888
|
+
let lastElement;
|
|
2889
|
+
let lastSelection;
|
|
2890
|
+
const deepActive = () => {
|
|
2891
|
+
let el = doc.activeElement;
|
|
2892
|
+
while (el?.shadowRoot?.activeElement) el = el.shadowRoot.activeElement;
|
|
2893
|
+
return el;
|
|
2894
|
+
};
|
|
2895
|
+
const isPageElement = (el) => {
|
|
2896
|
+
const tag = el?.tagName?.toLowerCase();
|
|
2897
|
+
return Boolean(tag) && tag !== "body" && tag !== "html";
|
|
2898
|
+
};
|
|
2899
|
+
const onFocus = (e) => {
|
|
2900
|
+
const target = e.composedPath?.()[0] ?? e.target;
|
|
2901
|
+
if (isPageElement(target) && !isInside(target)) lastElement = target;
|
|
2902
|
+
};
|
|
2903
|
+
const onSelection = () => {
|
|
2904
|
+
const sel = doc.getSelection();
|
|
2905
|
+
if (!sel || isInside(sel.anchorNode)) return;
|
|
2906
|
+
const text2 = sel.toString().trim();
|
|
2907
|
+
lastSelection = text2 || void 0;
|
|
2908
|
+
};
|
|
2909
|
+
doc.addEventListener("focusin", onFocus, true);
|
|
2910
|
+
doc.addEventListener("selectionchange", onSelection);
|
|
2911
|
+
return {
|
|
2912
|
+
element() {
|
|
2913
|
+
const now = deepActive();
|
|
2914
|
+
if (isPageElement(now) && !isInside(now)) return now;
|
|
2915
|
+
const last = lastElement;
|
|
2916
|
+
return last && last.isConnected !== false ? lastElement : void 0;
|
|
2917
|
+
},
|
|
2918
|
+
selection() {
|
|
2919
|
+
const sel = doc.getSelection();
|
|
2920
|
+
if (sel && !isInside(sel.anchorNode)) {
|
|
2921
|
+
const text2 = sel.toString().trim();
|
|
2922
|
+
if (text2) return text2;
|
|
2923
|
+
}
|
|
2924
|
+
return lastSelection;
|
|
2925
|
+
},
|
|
2926
|
+
stop() {
|
|
2927
|
+
doc.removeEventListener("focusin", onFocus, true);
|
|
2928
|
+
doc.removeEventListener("selectionchange", onSelection);
|
|
2929
|
+
lastElement = void 0;
|
|
2930
|
+
lastSelection = void 0;
|
|
2931
|
+
}
|
|
2932
|
+
};
|
|
2933
|
+
};
|
|
2934
|
+
var PAGE_CONTEXT_ASK_ON_SEND = /* @__PURE__ */ Symbol.for("@dudko.dev/agent-web-ui:page-context-ask");
|
|
2935
|
+
var createPageContextCollector = (options, env = pageEnv) => {
|
|
2936
|
+
let position;
|
|
2937
|
+
let denied = false;
|
|
2938
|
+
let tracker;
|
|
2939
|
+
let asking;
|
|
2940
|
+
const geoSettings = (raw) => {
|
|
2941
|
+
const o = typeof raw === "object" && raw ? raw : {};
|
|
2942
|
+
return {
|
|
2943
|
+
precision: typeof o.precision === "number" ? o.precision : 2,
|
|
2944
|
+
maxAgeMs: typeof o.maxAgeMs === "number" ? o.maxAgeMs : 10 * 6e4,
|
|
2945
|
+
timeoutMs: typeof o.timeoutMs === "number" ? o.timeoutMs : 1e4
|
|
2946
|
+
};
|
|
2947
|
+
};
|
|
2948
|
+
const askPosition = (e, s) => {
|
|
2949
|
+
if (asking) return asking;
|
|
2950
|
+
const geo = e.geolocation;
|
|
2951
|
+
if (!geo) return Promise.resolve(void 0);
|
|
2952
|
+
asking = new Promise((resolve) => {
|
|
2953
|
+
let done = false;
|
|
2954
|
+
const finish = (p) => {
|
|
2955
|
+
if (done) return;
|
|
2956
|
+
done = true;
|
|
2957
|
+
asking = void 0;
|
|
2958
|
+
resolve(p);
|
|
2959
|
+
};
|
|
2960
|
+
const timer = setTimeout(() => finish(void 0), s.timeoutMs + 1e3);
|
|
2961
|
+
try {
|
|
2962
|
+
geo.getCurrentPosition(
|
|
2963
|
+
(p) => {
|
|
2964
|
+
clearTimeout(timer);
|
|
2965
|
+
const now = e.now?.() ?? Date.now();
|
|
2966
|
+
position = {
|
|
2967
|
+
latitude: p.coords.latitude,
|
|
2968
|
+
longitude: p.coords.longitude,
|
|
2969
|
+
accuracy: p.coords.accuracy,
|
|
2970
|
+
at: now
|
|
2971
|
+
};
|
|
2972
|
+
finish(position);
|
|
2973
|
+
},
|
|
2974
|
+
(err) => {
|
|
2975
|
+
clearTimeout(timer);
|
|
2976
|
+
if (err?.code === 1) denied = true;
|
|
2977
|
+
finish(void 0);
|
|
2978
|
+
},
|
|
2979
|
+
{ timeout: s.timeoutMs, maximumAge: s.maxAgeMs, enableHighAccuracy: false }
|
|
2980
|
+
);
|
|
2981
|
+
} catch {
|
|
2982
|
+
clearTimeout(timer);
|
|
2983
|
+
finish(void 0);
|
|
2984
|
+
}
|
|
2985
|
+
});
|
|
2986
|
+
return asking;
|
|
2987
|
+
};
|
|
2988
|
+
const fresh = (e, maxAgeMs) => position && (e.now?.() ?? Date.now()) - position.at <= maxAgeMs ? position : void 0;
|
|
2989
|
+
const geoEntries = (p, precision) => ({
|
|
2990
|
+
"geo.latitude": roundCoordinate(p.latitude, precision),
|
|
2991
|
+
"geo.longitude": roundCoordinate(p.longitude, precision),
|
|
2992
|
+
// The accuracy is never better than the rounding: at 2 decimals, about a kilometre.
|
|
2993
|
+
"geo.accuracy": Math.max(
|
|
2994
|
+
Math.round(p.accuracy),
|
|
2995
|
+
Math.round(111e3 / 10 ** Math.min(6, precision))
|
|
2996
|
+
)
|
|
2997
|
+
});
|
|
2998
|
+
const read = (base, o) => {
|
|
2999
|
+
const t = tracker;
|
|
3000
|
+
const e = t ? {
|
|
3001
|
+
...base,
|
|
3002
|
+
// Delegated one by one: a real Document's getters and methods live on its prototype.
|
|
3003
|
+
document: {
|
|
3004
|
+
...base.document?.title !== void 0 ? { title: base.document.title } : {},
|
|
3005
|
+
...base.document?.referrer !== void 0 ? { referrer: base.document.referrer } : {},
|
|
3006
|
+
...base.document?.documentElement ? { documentElement: base.document.documentElement } : {},
|
|
3007
|
+
activeElement: t.element() ?? null,
|
|
3008
|
+
querySelectorAll: (q) => base.document?.querySelectorAll?.(q) ?? [],
|
|
3009
|
+
getElementById: (id) => base.document?.getElementById?.(id) ?? null
|
|
3010
|
+
},
|
|
3011
|
+
getSelection: () => {
|
|
3012
|
+
const text2 = t.selection();
|
|
3013
|
+
return text2 ? { toString: () => text2 } : null;
|
|
3014
|
+
}
|
|
3015
|
+
} : base;
|
|
3016
|
+
const c = o.collect ?? {};
|
|
3017
|
+
const out = {};
|
|
3018
|
+
if (c.url && e.location) {
|
|
3019
|
+
const url = addressWithoutQuery(e.location.href);
|
|
3020
|
+
if (url) out.url = clip(url, PAGE_CONTEXT_VALUE_MAX);
|
|
3021
|
+
}
|
|
3022
|
+
if (c.path && e.location) out.path = clip(e.location.pathname, PAGE_CONTEXT_VALUE_MAX);
|
|
3023
|
+
if (c.title && e.document?.title)
|
|
3024
|
+
out.title = clip(oneLine(e.document.title), PAGE_CONTEXT_VALUE_MAX);
|
|
3025
|
+
if (c.language && e.document?.documentElement?.lang)
|
|
3026
|
+
out.language = e.document.documentElement.lang.slice(0, 35);
|
|
3027
|
+
if (c.referrer && e.document?.referrer) {
|
|
3028
|
+
const ref = addressWithoutQuery(e.document.referrer);
|
|
3029
|
+
if (ref) out.referrer = clip(ref, PAGE_CONTEXT_VALUE_MAX);
|
|
3030
|
+
}
|
|
3031
|
+
if (c.focus) {
|
|
3032
|
+
const includeValues = typeof c.focus === "object" && c.focus.includeValues === true;
|
|
3033
|
+
Object.assign(out, focusEntries(e, includeValues));
|
|
3034
|
+
}
|
|
3035
|
+
if (c.selection) {
|
|
3036
|
+
const max = typeof c.selection === "object" && typeof c.selection.maxChars === "number" ? Math.max(1, Math.min(PAGE_CONTEXT_VALUE_MAX * 4, c.selection.maxChars)) : PAGE_CONTEXT_SELECTION_MAX;
|
|
3037
|
+
const text2 = (e.getSelection?.()?.toString() ?? "").trim();
|
|
3038
|
+
if (text2) out.selection = clip(text2, max);
|
|
3039
|
+
}
|
|
3040
|
+
if (c.viewport && e.innerWidth && e.innerHeight)
|
|
3041
|
+
out.viewport = `${e.innerWidth}x${e.innerHeight}`;
|
|
3042
|
+
if (c.scroll && typeof e.scrollY === "number") {
|
|
3043
|
+
const total = (e.document?.documentElement?.scrollHeight ?? 0) - (e.innerHeight ?? 0);
|
|
3044
|
+
out.scroll = total > 0 ? `${Math.round(Math.min(100, e.scrollY / total * 100))}% (${Math.round(e.scrollY)}px)` : `0% (${Math.round(e.scrollY)}px)`;
|
|
3045
|
+
}
|
|
3046
|
+
if (c.headings) {
|
|
3047
|
+
const h = headingsInView(e);
|
|
3048
|
+
if (h) out.headings = h;
|
|
3049
|
+
}
|
|
3050
|
+
if (c.time) {
|
|
3051
|
+
const tz = e.timeZone?.();
|
|
3052
|
+
if (tz) out.timeZone = tz;
|
|
3053
|
+
out.localTime = localIso(e.now?.() ?? Date.now());
|
|
3054
|
+
}
|
|
3055
|
+
if (c.colorScheme && e.matchMedia) {
|
|
3056
|
+
out.colorScheme = e.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
3057
|
+
}
|
|
3058
|
+
if (c.device && e.matchMedia) {
|
|
3059
|
+
const coarse = e.matchMedia("(pointer: coarse)").matches;
|
|
3060
|
+
const w = e.screenWidth ?? e.innerWidth ?? 0;
|
|
3061
|
+
out.device = coarse ? w && w < 768 ? "phone" : "tablet" : "desktop";
|
|
3062
|
+
}
|
|
3063
|
+
return out;
|
|
3064
|
+
};
|
|
3065
|
+
const finishContext = (o, out) => {
|
|
3066
|
+
let extra;
|
|
3067
|
+
try {
|
|
3068
|
+
extra = o.extra?.();
|
|
3069
|
+
} catch {
|
|
3070
|
+
extra = void 0;
|
|
3071
|
+
}
|
|
3072
|
+
if (extra && typeof extra === "object") {
|
|
3073
|
+
for (const [k, v] of Object.entries(extra)) {
|
|
3074
|
+
if (v === void 0) continue;
|
|
3075
|
+
if (v === null || typeof v === "boolean" || typeof v === "number" && Number.isFinite(v))
|
|
3076
|
+
out[k] = v;
|
|
3077
|
+
else if (typeof v === "string") out[k] = clip(v, PAGE_CONTEXT_VALUE_MAX * 4);
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
const include = o.include ? new Set(o.include) : void 0;
|
|
3081
|
+
const exclude = new Set(o.exclude ?? []);
|
|
3082
|
+
const kept = {};
|
|
3083
|
+
for (const [k, v] of Object.entries(out)) {
|
|
3084
|
+
if (include && !include.has(k) || exclude.has(k)) continue;
|
|
3085
|
+
kept[k] = v;
|
|
3086
|
+
}
|
|
3087
|
+
const capped = capPageContext(kept, o.maxChars ?? PAGE_CONTEXT_MAX_CHARS);
|
|
3088
|
+
return Object.keys(capped).length ? capped : void 0;
|
|
3089
|
+
};
|
|
3090
|
+
return {
|
|
3091
|
+
get geolocationDenied() {
|
|
3092
|
+
return denied;
|
|
3093
|
+
},
|
|
3094
|
+
setTracker(next) {
|
|
3095
|
+
tracker = next;
|
|
3096
|
+
},
|
|
3097
|
+
preview() {
|
|
3098
|
+
const o = options();
|
|
3099
|
+
if (pageContextOff(o)) return void 0;
|
|
3100
|
+
const e = env();
|
|
3101
|
+
const out = read(e, o);
|
|
3102
|
+
const g = o.collect?.geolocation;
|
|
3103
|
+
if (g && !denied && e.geolocation) {
|
|
3104
|
+
const s = geoSettings(g);
|
|
3105
|
+
const p = fresh(e, s.maxAgeMs);
|
|
3106
|
+
if (p) Object.assign(out, geoEntries(p, s.precision));
|
|
3107
|
+
else out["geo.latitude"] = PAGE_CONTEXT_ASK_ON_SEND;
|
|
3108
|
+
}
|
|
3109
|
+
return finishContext(o, out);
|
|
3110
|
+
},
|
|
3111
|
+
async collect(opts = {}) {
|
|
3112
|
+
const o = options();
|
|
3113
|
+
if (pageContextOff(o)) return void 0;
|
|
3114
|
+
const e = env();
|
|
3115
|
+
const out = read(e, o);
|
|
3116
|
+
const g = o.collect?.geolocation;
|
|
3117
|
+
if (g && !denied) {
|
|
3118
|
+
const s = geoSettings(g);
|
|
3119
|
+
const p = fresh(e, s.maxAgeMs) ?? (opts.ask ? await askPosition(e, s) : void 0);
|
|
3120
|
+
if (p) Object.assign(out, geoEntries(p, s.precision));
|
|
3121
|
+
}
|
|
3122
|
+
return finishContext(o, out);
|
|
3123
|
+
}
|
|
3124
|
+
};
|
|
3125
|
+
};
|
|
3126
|
+
var pageContextRows = (context, askedOnSend) => Object.entries(context ?? {}).map(([key, v]) => ({
|
|
3127
|
+
key: v === PAGE_CONTEXT_ASK_ON_SEND ? "geo" : key,
|
|
3128
|
+
value: v === PAGE_CONTEXT_ASK_ON_SEND ? askedOnSend : v === null ? "" : String(v)
|
|
3129
|
+
}));
|
|
3130
|
+
var withoutAskOnSend = (context) => {
|
|
3131
|
+
if (!context) return void 0;
|
|
3132
|
+
const out = {};
|
|
3133
|
+
for (const [k, v] of Object.entries(context)) {
|
|
3134
|
+
if (v !== PAGE_CONTEXT_ASK_ON_SEND) out[k] = v;
|
|
3135
|
+
}
|
|
3136
|
+
return Object.keys(out).length ? out : void 0;
|
|
3137
|
+
};
|
|
3138
|
+
|
|
2701
3139
|
// src/format.ts
|
|
2702
3140
|
var previewValue = (value, max = 140) => {
|
|
2703
3141
|
if (value === void 0) return "";
|
|
@@ -3315,15 +3753,15 @@ var ChatHistoryStore = class {
|
|
|
3315
3753
|
}
|
|
3316
3754
|
};
|
|
3317
3755
|
var attachmentsText = (attachments, texts = {}) => attachments.length > 0 && attachments.every((a) => a.mediaType.toLowerCase().startsWith("audio/")) ? texts.voiceMessage ?? "Voice message" : attachments.map((a) => a.name).join(", ");
|
|
3318
|
-
var
|
|
3756
|
+
var oneLine2 = (text2) => (text2 ?? "").replace(/\s+/g, " ").trim();
|
|
3319
3757
|
var chatTitle = (messages, texts = {}) => {
|
|
3320
3758
|
const at = messages.findIndex((m) => m.role === "user");
|
|
3321
3759
|
const user = at >= 0 ? messages[at] : void 0;
|
|
3322
|
-
let first =
|
|
3760
|
+
let first = oneLine2(user?.content);
|
|
3323
3761
|
if (!first && user?.attachments?.length) {
|
|
3324
3762
|
const answer = messages.slice(at + 1).find((m) => m.role === "assistant");
|
|
3325
3763
|
const heard = answer?.transcripts?.find((t) => t.source === "attachment")?.text;
|
|
3326
|
-
first =
|
|
3764
|
+
first = oneLine2(heard) || oneLine2(attachmentsText(user.attachments, texts));
|
|
3327
3765
|
}
|
|
3328
3766
|
if (!first) return "New chat";
|
|
3329
3767
|
return first.length > 60 ? `${first.slice(0, 59)}…` : first;
|
|
@@ -4202,12 +4640,17 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4202
4640
|
NAMED_FILES_MAX,
|
|
4203
4641
|
NAMED_FILES_SCAN_MAX,
|
|
4204
4642
|
NAMED_FILES_TEXT_MAX,
|
|
4643
|
+
PAGE_CONTEXT_ASK_ON_SEND,
|
|
4644
|
+
PAGE_CONTEXT_MAX_CHARS,
|
|
4645
|
+
PAGE_CONTEXT_SELECTION_MAX,
|
|
4646
|
+
PAGE_CONTEXT_VALUE_MAX,
|
|
4205
4647
|
PROMPT_ARM_MS,
|
|
4206
4648
|
QUESTION_TIMEOUT_MS,
|
|
4207
4649
|
RECORDING_DEFAULT_MAX_MS,
|
|
4208
4650
|
RECORDING_TYPES,
|
|
4209
4651
|
SpeechOutputError,
|
|
4210
4652
|
activeElementOf,
|
|
4653
|
+
addressWithoutQuery,
|
|
4211
4654
|
agentCoreIfLoaded,
|
|
4212
4655
|
agentStateReducer,
|
|
4213
4656
|
agentStatusOf,
|
|
@@ -4224,6 +4667,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4224
4667
|
audioTypeOf,
|
|
4225
4668
|
boxLength,
|
|
4226
4669
|
buildSandboxedDocument,
|
|
4670
|
+
capPageContext,
|
|
4227
4671
|
chatTitle,
|
|
4228
4672
|
clampFrameHeight,
|
|
4229
4673
|
coalesce,
|
|
@@ -4233,6 +4677,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4233
4677
|
createBrowserSpeaker,
|
|
4234
4678
|
createElicitationQueue,
|
|
4235
4679
|
createInitialAgentState,
|
|
4680
|
+
createPageContextCollector,
|
|
4236
4681
|
createPromptArming,
|
|
4237
4682
|
createQuestionQueue,
|
|
4238
4683
|
createRecordingRecognizer,
|
|
@@ -4258,6 +4703,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4258
4703
|
fileKindOf,
|
|
4259
4704
|
fileNameOf,
|
|
4260
4705
|
filterCommands,
|
|
4706
|
+
focusEntries,
|
|
4261
4707
|
followOtherTabs,
|
|
4262
4708
|
followsAfterResize,
|
|
4263
4709
|
followsAfterScroll,
|
|
@@ -4268,12 +4714,15 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4268
4714
|
formatProbability,
|
|
4269
4715
|
formatTokens,
|
|
4270
4716
|
freeAttachmentPath,
|
|
4717
|
+
headingsInView,
|
|
4271
4718
|
imageSizeOf,
|
|
4272
4719
|
imagesInOutput,
|
|
4273
4720
|
inputCounterShown,
|
|
4274
4721
|
insertionFits,
|
|
4722
|
+
isEditableElement,
|
|
4275
4723
|
isEventInside,
|
|
4276
4724
|
isOneCharacter,
|
|
4725
|
+
isSecretField,
|
|
4277
4726
|
isShadowRoot,
|
|
4278
4727
|
languageOfText,
|
|
4279
4728
|
lessonsOf,
|
|
@@ -4300,6 +4749,8 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4300
4749
|
noticesOf,
|
|
4301
4750
|
overflowOf,
|
|
4302
4751
|
ownUnsaved,
|
|
4752
|
+
pageContextOff,
|
|
4753
|
+
pageContextRows,
|
|
4303
4754
|
parseSlash,
|
|
4304
4755
|
pathsNamedIn,
|
|
4305
4756
|
pendingApprovalsOf,
|
|
@@ -4312,6 +4763,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4312
4763
|
recordingSupported,
|
|
4313
4764
|
remoteAnswerOf,
|
|
4314
4765
|
rootOf,
|
|
4766
|
+
roundCoordinate,
|
|
4315
4767
|
sandboxTokens,
|
|
4316
4768
|
sandboxedCsp,
|
|
4317
4769
|
saveAttachments,
|
|
@@ -4328,6 +4780,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4328
4780
|
subagentTree,
|
|
4329
4781
|
textExcerpt,
|
|
4330
4782
|
tokenizeHtml,
|
|
4783
|
+
trackPageFocus,
|
|
4331
4784
|
unchangedSince,
|
|
4332
4785
|
voiceFor,
|
|
4333
4786
|
voiceMessageName,
|
|
@@ -4337,6 +4790,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4337
4790
|
withAttachments,
|
|
4338
4791
|
withCspFirst,
|
|
4339
4792
|
withPolicyFirst,
|
|
4793
|
+
withoutAskOnSend,
|
|
4340
4794
|
withoutOwnWords,
|
|
4341
4795
|
workspacePathOf
|
|
4342
4796
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as Core from '@dudko.dev/agent-web';
|
|
2
2
|
import { AgentEvent, IUsage, Skill, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
|
|
3
|
-
import { A as AgentUiState, C as ChatAttachment, R as RemoteRunView, L as LessonView, a as ChatMessage, b as ApprovalView, S as SubagentView, i as SubagentNode } from './types-
|
|
4
|
-
export { h as AgentStatus, j as AppView, B as BrowserOAuthProvider, k as BrowserOAuthProviderOptions, l as BudgetView, m as CompactionView, n as ConnectedMcp, D as DecisionView, E as ElicitationView, F as FetchView, o as McpAppsConnectionLike, p as McpCatalogEntry, M as McpElicitationFieldSchema, c as McpElicitationHandler, f as McpElicitationOptions, d as McpElicitationRequest, e as McpElicitationResult, g as McpElicitationSchema, q as McpHttpServerConfig, r as McpModule, s as McpOAuthCallback, t as McpOAuthRegistration, u as McpOAuthRegistrationKind, v as McpProtocolMode, w as McpServerInstructions, x as McpServerProtocol, y as McpServerResult, z as MediaView, G as ModelLoadState, Q as QuestionView, H as QueuedMessageView, I as ReplanState, J as SkillConsentView, K as StepEscalationView, N as StepView, T as ToolCallView, O as TranscriptView, U as UserNoteView, W as WrittenFileView } from './types-
|
|
5
|
-
export { a as ATTACHMENT_BOUNDS, b as AgentLabels, A as AgentLabelsOverride, c as AttachmentBounds, d as AttachmentFiles, e as AttachmentOverLimit, f as AttachmentTextOptions, g as AttachmentTransform, C as ComposerAttachment, h as ComposerNotice, E as ELICITATION_MAX_OPTIONS, i as ELICITATION_TIMEOUT_MS, j as ELICITATION_VALUE_MAX_CHARS, k as ElicitationControl, l as ElicitationDraft, m as ElicitationDraftValue, n as ElicitationField, o as ElicitationFormOutcome, p as ElicitationIssue, q as ElicitationIssueKind, r as ElicitationLink, s as ElicitationOption, t as ElicitationOutcomeReason, u as ElicitationQueue, v as ElicitationQueueOptions, F as FileKind, I as INPUT_COUNTER_FROM, M as MenuSection, N as NotReadyInput, w as NotReadyIntent, x as NotReadyReason, y as NoticeTexts, P as PendingElicitation, S as SavedAttachments, z as SlashCommand, B as SteerIntent, T as TextExcerpt, W as WaitingSendStep, D as attachmentFileName, G as attachmentKindOf, H as attachmentLabel, J as attachmentOverLimit, K as attachmentRefusal, L as attachmentTransformOf, O as boxLength, Q as createElicitationQueue, R as dataUrlParts, U as defaultLabels, V as defaultNoticeTexts, X as elicitationConnectOptions, Y as elicitationFields, Z as elicitationFormAnswer, _ as elicitationInitialDraft, $ as elicitationLink, a0 as elicitationSettings, a1 as elicitationTimeoutOf, a2 as excerptNote, a3 as fileKindOf, a4 as fileNameOf, a5 as filterCommands, a6 as formatClock, a7 as formatCountdown, a8 as formatElapsed, a9 as freeAttachmentPath, aa as inputCounterShown, ab as insertionFits, ac as isOneCharacter, ad as lineCountOf, ae as longTextName, af as longTextRoute, ag as mediaFamilyOf, ah as menuKeyTarget, ai as menuSections, aj as mergeLabels, ak as messageOverLimit, al as micProblemText, am as notReadyIntent, an as notReadyReason, ao as noticesOf, ap as overflowOf, aq as parseSlash, ar as saveAttachments, as as steerIntent, at as textExcerpt, au as voiceMessageName, av as waitingSendStep, aw as withAttachments } from './labels-
|
|
3
|
+
import { A as AgentUiState, C as ChatAttachment, R as RemoteRunView, L as LessonView, a as ChatMessage, b as ApprovalView, S as SubagentView, i as SubagentNode } from './types-CHFtTZjl.cjs';
|
|
4
|
+
export { h as AgentStatus, j as AppView, B as BrowserOAuthProvider, k as BrowserOAuthProviderOptions, l as BudgetView, m as CompactionView, n as ConnectedMcp, D as DecisionView, E as ElicitationView, F as FetchView, o as McpAppsConnectionLike, p as McpCatalogEntry, M as McpElicitationFieldSchema, c as McpElicitationHandler, f as McpElicitationOptions, d as McpElicitationRequest, e as McpElicitationResult, g as McpElicitationSchema, q as McpHttpServerConfig, r as McpModule, s as McpOAuthCallback, t as McpOAuthRegistration, u as McpOAuthRegistrationKind, v as McpProtocolMode, w as McpServerInstructions, x as McpServerProtocol, y as McpServerResult, z as MediaView, G as ModelLoadState, Q as QuestionView, H as QueuedMessageView, I as ReplanState, J as SkillConsentView, K as StepEscalationView, N as StepView, T as ToolCallView, O as TranscriptView, U as UserNoteView, W as WrittenFileView } from './types-CHFtTZjl.cjs';
|
|
5
|
+
export { a as ATTACHMENT_BOUNDS, b as AgentLabels, A as AgentLabelsOverride, c as AttachmentBounds, d as AttachmentFiles, e as AttachmentOverLimit, f as AttachmentTextOptions, g as AttachmentTransform, C as ComposerAttachment, h as ComposerNotice, E as ELICITATION_MAX_OPTIONS, i as ELICITATION_TIMEOUT_MS, j as ELICITATION_VALUE_MAX_CHARS, k as ElicitationControl, l as ElicitationDraft, m as ElicitationDraftValue, n as ElicitationField, o as ElicitationFormOutcome, p as ElicitationIssue, q as ElicitationIssueKind, r as ElicitationLink, s as ElicitationOption, t as ElicitationOutcomeReason, u as ElicitationQueue, v as ElicitationQueueOptions, F as FileKind, I as INPUT_COUNTER_FROM, M as MenuSection, N as NotReadyInput, w as NotReadyIntent, x as NotReadyReason, y as NoticeTexts, P as PendingElicitation, S as SavedAttachments, z as SlashCommand, B as SteerIntent, T as TextExcerpt, W as WaitingSendStep, D as attachmentFileName, G as attachmentKindOf, H as attachmentLabel, J as attachmentOverLimit, K as attachmentRefusal, L as attachmentTransformOf, O as boxLength, Q as createElicitationQueue, R as dataUrlParts, U as defaultLabels, V as defaultNoticeTexts, X as elicitationConnectOptions, Y as elicitationFields, Z as elicitationFormAnswer, _ as elicitationInitialDraft, $ as elicitationLink, a0 as elicitationSettings, a1 as elicitationTimeoutOf, a2 as excerptNote, a3 as fileKindOf, a4 as fileNameOf, a5 as filterCommands, a6 as formatClock, a7 as formatCountdown, a8 as formatElapsed, a9 as freeAttachmentPath, aa as inputCounterShown, ab as insertionFits, ac as isOneCharacter, ad as lineCountOf, ae as longTextName, af as longTextRoute, ag as mediaFamilyOf, ah as menuKeyTarget, ai as menuSections, aj as mergeLabels, ak as messageOverLimit, al as micProblemText, am as notReadyIntent, an as notReadyReason, ao as noticesOf, ap as overflowOf, aq as parseSlash, ar as saveAttachments, as as steerIntent, at as textExcerpt, au as voiceMessageName, av as waitingSendStep, aw as withAttachments } from './labels-D-NI4hKW.cjs';
|
|
6
|
+
export { G as GeolocationCollect, d as PAGE_CONTEXT_ASK_ON_SEND, e as PAGE_CONTEXT_MAX_CHARS, f as PAGE_CONTEXT_SELECTION_MAX, g as PAGE_CONTEXT_VALUE_MAX, a as PageContext, h as PageContextCollect, b as PageContextCollector, i as PageContextElement, j as PageContextEnv, P as PageContextOptions, k as PageContextValue, l as PageFocusTracker, m as addressWithoutQuery, n as capPageContext, c as createPageContextCollector, o as focusEntries, p as headingsInView, q as isEditableElement, r as isSecretField, s as pageContextOff, u as pageContextRows, v as roundCoordinate, t as trackPageFocus, w as withoutAskOnSend } from './page-context-BAmw4p6d.cjs';
|
|
6
7
|
export { A as ASK_USER_TOOL_NAME, P as PendingQuestion, a as QUESTION_TIMEOUT_MS, Q as QuestionOutcomeReason, b as QuestionQueue, c as QuestionQueueOptions, d as askUserOutputKept, e as askUserWith, f as createQuestionQueue, q as questionChoiceOf, g as questionOtherOf, h as questionTimeoutOf, w as withoutOwnWords } from './questions-Dw--IEjT.cjs';
|
|
7
8
|
import './mcp-app.cjs';
|
|
8
9
|
import './mcp-app-policy-DXKQ2jjM.cjs';
|