@dudko.dev/agent-web-ui 0.0.3 → 0.0.5

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.
Files changed (88) hide show
  1. package/README.md +78 -6
  2. package/dist/{chunk-UNIXGP4N.js → chunk-627OXMFG.js} +2 -0
  3. package/dist/{chunk-G7LQTOA2.js → chunk-NHU6WQM5.js} +61 -6
  4. package/dist/controller.cjs +621 -20
  5. package/dist/controller.d.cts +110 -3
  6. package/dist/controller.d.ts +110 -3
  7. package/dist/controller.js +575 -17
  8. package/dist/index.cjs +81 -14
  9. package/dist/index.d.cts +28 -10
  10. package/dist/index.d.ts +28 -10
  11. package/dist/index.js +27 -8
  12. package/dist/{labels-DH1ESUtm.d.ts → labels-CCPL7t17.d.ts} +8 -1
  13. package/dist/{labels-CmiTBLWD.d.cts → labels-ipy-ydkp.d.cts} +8 -1
  14. package/dist/locales/be.cjs +2 -0
  15. package/dist/locales/be.js +1 -1
  16. package/dist/locales/bg.cjs +2 -0
  17. package/dist/locales/bg.js +1 -1
  18. package/dist/locales/ca.cjs +2 -0
  19. package/dist/locales/ca.js +1 -1
  20. package/dist/locales/cs.cjs +2 -0
  21. package/dist/locales/cs.js +1 -1
  22. package/dist/locales/da.cjs +2 -0
  23. package/dist/locales/da.js +1 -1
  24. package/dist/locales/de.cjs +2 -0
  25. package/dist/locales/de.js +1 -1
  26. package/dist/locales/el.cjs +2 -0
  27. package/dist/locales/el.js +1 -1
  28. package/dist/locales/en.cjs +2 -0
  29. package/dist/locales/en.js +1 -1
  30. package/dist/locales/es-419.cjs +2 -0
  31. package/dist/locales/es-419.js +1 -1
  32. package/dist/locales/es.cjs +2 -0
  33. package/dist/locales/es.js +1 -1
  34. package/dist/locales/fi.cjs +2 -0
  35. package/dist/locales/fi.js +1 -1
  36. package/dist/locales/fr-CA.cjs +2 -0
  37. package/dist/locales/fr-CA.js +1 -1
  38. package/dist/locales/fr.cjs +2 -0
  39. package/dist/locales/fr.js +1 -1
  40. package/dist/locales/gn.cjs +2 -0
  41. package/dist/locales/gn.js +1 -1
  42. package/dist/locales/hr.cjs +2 -0
  43. package/dist/locales/hr.js +1 -1
  44. package/dist/locales/ht.cjs +2 -0
  45. package/dist/locales/ht.js +1 -1
  46. package/dist/locales/hu.cjs +2 -0
  47. package/dist/locales/hu.js +1 -1
  48. package/dist/locales/index.cjs +2 -0
  49. package/dist/locales/index.js +1 -1
  50. package/dist/locales/it.cjs +2 -0
  51. package/dist/locales/it.js +1 -1
  52. package/dist/locales/nb.cjs +2 -0
  53. package/dist/locales/nb.js +1 -1
  54. package/dist/locales/nl.cjs +2 -0
  55. package/dist/locales/nl.js +1 -1
  56. package/dist/locales/pl.cjs +2 -0
  57. package/dist/locales/pl.js +1 -1
  58. package/dist/locales/pt-BR.cjs +2 -0
  59. package/dist/locales/pt-BR.js +1 -1
  60. package/dist/locales/pt.cjs +2 -0
  61. package/dist/locales/pt.js +1 -1
  62. package/dist/locales/qu.cjs +2 -0
  63. package/dist/locales/qu.js +1 -1
  64. package/dist/locales/ro.cjs +2 -0
  65. package/dist/locales/ro.js +1 -1
  66. package/dist/locales/ru.cjs +2 -0
  67. package/dist/locales/ru.js +1 -1
  68. package/dist/locales/sk.cjs +2 -0
  69. package/dist/locales/sk.js +1 -1
  70. package/dist/locales/sq.cjs +2 -0
  71. package/dist/locales/sq.js +1 -1
  72. package/dist/locales/sr-Latn.cjs +2 -0
  73. package/dist/locales/sr-Latn.js +1 -1
  74. package/dist/locales/sr.cjs +2 -0
  75. package/dist/locales/sr.js +1 -1
  76. package/dist/locales/sv.cjs +2 -0
  77. package/dist/locales/sv.js +1 -1
  78. package/dist/locales/tr.cjs +2 -0
  79. package/dist/locales/tr.js +1 -1
  80. package/dist/locales/uk.cjs +2 -0
  81. package/dist/locales/uk.js +1 -1
  82. package/dist/markdown.cjs +36 -0
  83. package/dist/markdown.d.cts +27 -1
  84. package/dist/markdown.d.ts +27 -1
  85. package/dist/markdown.js +33 -0
  86. package/dist/mcp-app.cjs +1 -4
  87. package/dist/mcp-app.js +1 -2
  88. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -52,6 +52,7 @@ __export(src_exports, {
52
52
  RECORDING_TYPES: () => RECORDING_TYPES,
53
53
  SpeechOutputError: () => SpeechOutputError,
54
54
  activeElementOf: () => activeElementOf,
55
+ agentCoreIfLoaded: () => agentCoreIfLoaded,
55
56
  agentStateReducer: () => agentStateReducer,
56
57
  agentStatusOf: () => agentStatusOf,
57
58
  askUserOutputKept: () => askUserOutputKept,
@@ -124,8 +125,10 @@ __export(src_exports, {
124
125
  linkedFilesOf: () => linkedFilesOf,
125
126
  listenScrollAround: () => listenScrollAround,
126
127
  listenToOtherTabs: () => listenToOtherTabs,
128
+ loadAgentCore: () => loadAgentCore,
127
129
  longTextName: () => longTextName,
128
130
  longTextRoute: () => longTextRoute,
131
+ mediaFamilyOf: () => mediaFamilyOf,
129
132
  menuKeyTarget: () => menuKeyTarget,
130
133
  menuSections: () => menuSections,
131
134
  mergeChatRecord: () => mergeChatRecord,
@@ -183,8 +186,25 @@ __export(src_exports, {
183
186
  });
184
187
  module.exports = __toCommonJS(src_exports);
185
188
 
186
- // src/state.ts
187
- var import_agent_web = require("@dudko.dev/agent-web");
189
+ // src/core-copies.ts
190
+ var REPLAY_NOTE_OF_CORE = "[not run again: this exact call already succeeded in an earlier attempt at this step, and its effect is in place. Its result then:]";
191
+ var isReplayedOutput = (output) => typeof output === "string" && output.startsWith(REPLAY_NOTE_OF_CORE);
192
+ var MEDIA_IMAGE_TYPES_OF_CORE = {
193
+ "image/png": "png",
194
+ "image/jpeg": "jpg",
195
+ "image/gif": "gif",
196
+ "image/webp": "webp"
197
+ };
198
+ var MEDIA_AUDIO_TYPES_OF_CORE = {
199
+ "audio/mpeg": "mp3",
200
+ "audio/wav": "wav",
201
+ "audio/ogg": "ogg",
202
+ "audio/flac": "flac",
203
+ "audio/aac": "aac",
204
+ "audio/mp4": "m4a",
205
+ "audio/webm": "webm"
206
+ };
207
+ var isTextMimeOfCore = (mime) => /^text\/|json|xml|yaml|javascript|typescript|svg/.test(mime);
188
208
 
189
209
  // src/questions.ts
190
210
  var ASK_USER_TOOL_NAME = "ask_user";
@@ -1043,7 +1063,7 @@ var applyEvent = (state, event, ctx) => {
1043
1063
  ok: event.ok,
1044
1064
  status: "done",
1045
1065
  outputTokens: approxTokens(event.output),
1046
- ...(0, import_agent_web.isReplayedToolOutput)(event.output) ? { replayed: true } : {},
1066
+ ...isReplayedOutput(event.output) ? { replayed: true } : {},
1047
1067
  ...ctx.at !== void 0 && c.startedAt !== void 0 ? { durationMs: Math.max(0, ctx.at - c.startedAt) } : {}
1048
1068
  };
1049
1069
  }
@@ -1090,7 +1110,7 @@ var applyEvent = (state, event, ctx) => {
1090
1110
  ...streamed?.durationMs !== void 0 ? { durationMs: streamed.durationMs } : {},
1091
1111
  // With tiers the list holds every attempt's calls, in the order they were made.
1092
1112
  ...streamed?.attempt !== void 0 ? { attempt: streamed.attempt } : {},
1093
- ...(0, import_agent_web.isReplayedToolOutput)(c.output) ? { replayed: true } : {},
1113
+ ...isReplayedOutput(c.output) ? { replayed: true } : {},
1094
1114
  // The MCP App the call came with (only the stream told it).
1095
1115
  ...streamed?.app !== void 0 ? { app: streamed.app } : {}
1096
1116
  };
@@ -1909,6 +1929,7 @@ var defaultLabels = {
1909
1929
  memoryUndo: "Undo",
1910
1930
  memoryUndone: "Undone",
1911
1931
  placeholder: "Ask the agent to do something… ( / for commands, Ctrl+V to paste an image )",
1932
+ placeholderTextOnly: "Ask the agent to do something… ( / for commands )",
1912
1933
  listening: "Listening…",
1913
1934
  message: "Message",
1914
1935
  dropHint: "Drop files or images to attach them",
@@ -2540,22 +2561,27 @@ var portalHostOf = (from, selector) => {
2540
2561
  };
2541
2562
 
2542
2563
  // src/file-kinds.ts
2543
- var import_agent_web2 = require("@dudko.dev/agent-web");
2544
2564
  var CODE = /\.(?:js|mjs|cjs|jsx|ts|tsx|css|scss|py|rb|go|rs|java|kt|c|h|cpp|cs|php|sh|sql|xml|svg|yaml|yml|toml)$/i;
2545
2565
  var mimeOf = (mediaType) => mediaType.toLowerCase().split(";")[0].trim();
2546
2566
  var fileKindOf = (path, mediaType) => {
2547
2567
  const mime = mimeOf(mediaType);
2548
- if (Object.hasOwn(import_agent_web2.MEDIA_IMAGE_TYPES, mime)) return "image";
2568
+ if (Object.hasOwn(MEDIA_IMAGE_TYPES_OF_CORE, mime)) return "image";
2549
2569
  if (mime === "text/html" || mime === "application/xhtml+xml" || /\.x?html?$/i.test(path))
2550
2570
  return "html";
2551
2571
  if (mime === "text/markdown" || /\.(?:md|markdown)$/i.test(path)) return "markdown";
2552
2572
  if (mime === "text/csv" || /\.(?:csv|tsv)$/i.test(path)) return "csv";
2553
2573
  if (mime === "application/json" || /\.json$/i.test(path)) return "json";
2554
2574
  if (CODE.test(path)) return "code";
2555
- if (mime === "text/plain" || /\.(?:txt|log)$/i.test(path) || (0, import_agent_web2.isTextMime)(mime)) return "text";
2575
+ if (mime === "text/plain" || /\.(?:txt|log)$/i.test(path) || isTextMimeOfCore(mime)) return "text";
2556
2576
  return "file";
2557
2577
  };
2558
2578
  var fileNameOf = (path) => path.split("/").filter(Boolean).pop() || "file";
2579
+ var mediaFamilyOf = (mediaType) => {
2580
+ const type = mimeOf(mediaType);
2581
+ if (Object.hasOwn(MEDIA_IMAGE_TYPES_OF_CORE, type)) return "image";
2582
+ if (Object.hasOwn(MEDIA_AUDIO_TYPES_OF_CORE, type)) return "audio";
2583
+ return void 0;
2584
+ };
2559
2585
 
2560
2586
  // src/image-resize.ts
2561
2587
  var canvasOf = (w, h) => {
@@ -3123,8 +3149,22 @@ var createPromptArming = (delayMs = PROMPT_ARM_MS) => {
3123
3149
  };
3124
3150
  };
3125
3151
 
3152
+ // src/core-later.ts
3153
+ var loading;
3154
+ var loaded;
3155
+ var loadAgentCore = () => {
3156
+ if (!loading) {
3157
+ const next = import("@dudko.dev/agent-web").then((core) => loaded = core);
3158
+ loading = next;
3159
+ next.catch(() => {
3160
+ if (loading === next) loading = void 0;
3161
+ });
3162
+ }
3163
+ return loading;
3164
+ };
3165
+ var agentCoreIfLoaded = () => loaded;
3166
+
3126
3167
  // src/chat-history.ts
3127
- var core = __toESM(require("@dudko.dev/agent-web"), 1);
3128
3168
  var DB_VERSION = 1;
3129
3169
  var req = (r) => new Promise((resolve, reject) => {
3130
3170
  r.onsuccess = () => resolve(r.result);
@@ -3198,9 +3238,15 @@ var ChatHistoryStore = class {
3198
3238
  this.announce(notice);
3199
3239
  }
3200
3240
  announce(notice) {
3201
- if (typeof core.postStorageChange === "function") {
3202
- core.postStorageChange(this.dbName, { kind: "chats", ...notice });
3203
- }
3241
+ loadAgentCore().then(
3242
+ (core) => {
3243
+ if (typeof core.postStorageChange === "function") {
3244
+ core.postStorageChange(this.dbName, { kind: "chats", ...notice });
3245
+ }
3246
+ },
3247
+ () => {
3248
+ }
3249
+ );
3204
3250
  }
3205
3251
  /**
3206
3252
  * Read the stored record and write what `merge` makes of it in ONE readwrite transaction: no
@@ -3373,10 +3419,28 @@ var coalesce = (fn, ms = 100) => {
3373
3419
  }
3374
3420
  };
3375
3421
  };
3376
- var listenToOtherTabs = (core2, dbName, listener) => typeof core2.onStorageChange === "function" && dbName ? core2.onStorageChange(dbName, listener) : () => void 0;
3377
- var followOtherTabs = (core2, dbName, accept, settle, ms = 100) => {
3422
+ var listenToOtherTabs = (core, dbName, listener) => {
3423
+ if (!dbName) return () => void 0;
3424
+ if (typeof core === "function") {
3425
+ let closed = false;
3426
+ let off;
3427
+ core().then(
3428
+ (module2) => {
3429
+ if (!closed) off = listenToOtherTabs(module2, dbName, listener);
3430
+ },
3431
+ () => {
3432
+ }
3433
+ );
3434
+ return () => {
3435
+ closed = true;
3436
+ off?.();
3437
+ };
3438
+ }
3439
+ return typeof core.onStorageChange === "function" ? core.onStorageChange(dbName, listener) : () => void 0;
3440
+ };
3441
+ var followOtherTabs = (core, dbName, accept, settle, ms = 100) => {
3378
3442
  const later = coalesce(settle, ms);
3379
- const off = listenToOtherTabs(core2, dbName, (change) => {
3443
+ const off = listenToOtherTabs(core, dbName, (change) => {
3380
3444
  if (accept(change)) later.call();
3381
3445
  });
3382
3446
  return () => {
@@ -4144,6 +4208,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
4144
4208
  RECORDING_TYPES,
4145
4209
  SpeechOutputError,
4146
4210
  activeElementOf,
4211
+ agentCoreIfLoaded,
4147
4212
  agentStateReducer,
4148
4213
  agentStatusOf,
4149
4214
  askUserOutputKept,
@@ -4216,8 +4281,10 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
4216
4281
  linkedFilesOf,
4217
4282
  listenScrollAround,
4218
4283
  listenToOtherTabs,
4284
+ loadAgentCore,
4219
4285
  longTextName,
4220
4286
  longTextRoute,
4287
+ mediaFamilyOf,
4221
4288
  menuKeyTarget,
4222
4289
  menuSections,
4223
4290
  mergeChatRecord,
package/dist/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
+ import * as Core from '@dudko.dev/agent-web';
1
2
  import { AgentEvent, IUsage, Skill, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
2
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-DnBCok3z.cjs';
3
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-DnBCok3z.cjs';
4
- 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 menuKeyTarget, ah as menuSections, ai as mergeLabels, aj as messageOverLimit, ak as micProblemText, al as notReadyIntent, am as notReadyReason, an as noticesOf, ao as overflowOf, ap as parseSlash, aq as saveAttachments, ar as steerIntent, as as textExcerpt, at as voiceMessageName, au as waitingSendStep, av as withAttachments } from './labels-CmiTBLWD.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-ipy-ydkp.cjs';
5
6
  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';
6
7
  import './mcp-app.cjs';
7
8
  import './mcp-app-policy-DXKQ2jjM.cjs';
@@ -566,13 +567,19 @@ declare const coalesce: (fn: () => void, ms?: number) => {
566
567
  call: () => void;
567
568
  cancel: () => void;
568
569
  };
570
+ /** What `listenToOtherTabs` / `followOtherTabs` take for the core: its module, or a loader of it. */
571
+ type StorageChangeSource = {
572
+ onStorageChange?: unknown;
573
+ } | (() => Promise<{
574
+ onStorageChange?: unknown;
575
+ }>);
569
576
  /**
570
577
  * The core's `onStorageChange`, or a no-op where the core predates it (the hooks then work as
571
- * before: this tab's own changes only). One place for the guard every hook needs.
578
+ * before: this tab's own changes only). One place for the guard every hook needs. `core` may be a
579
+ * LOADER (`loadAgentCore`): it is called only when there is a database to follow, and the
580
+ * subscription starts once it resolves - so a view that follows nothing never loads the core.
572
581
  */
573
- declare const listenToOtherTabs: (core: {
574
- onStorageChange?: unknown;
575
- }, dbName: string | undefined, listener: (change: {
582
+ declare const listenToOtherTabs: (core: StorageChangeSource, dbName: string | undefined, listener: (change: {
576
583
  kind: string;
577
584
  op: string;
578
585
  key?: string;
@@ -583,9 +590,7 @@ declare const listenToOtherTabs: (core: {
583
590
  * matters here), `settle` runs once, ~`ms` after the last accepted one of a burst. What every hook
584
591
  * that follows other tabs uses. The returned function unsubscribes and drops a pending settle.
585
592
  */
586
- declare const followOtherTabs: (core: {
587
- onStorageChange?: unknown;
588
- }, dbName: string | undefined, accept: (change: {
593
+ declare const followOtherTabs: (core: StorageChangeSource, dbName: string | undefined, accept: (change: {
589
594
  kind: string;
590
595
  op: string;
591
596
  key?: string;
@@ -599,6 +604,19 @@ declare const followOtherTabs: (core: {
599
604
  */
600
605
  declare const remoteAnswerOf: (ok: boolean, stillWatching: boolean) => "taken" | "refused" | "unknown";
601
606
 
607
+ /** The core's module (`@dudko.dev/agent-web`), as `loadAgentCore` resolves it. */
608
+ type AgentCoreModule = typeof Core;
609
+ /**
610
+ * The core, imported on the first call (a dynamic `import()`, the same module every time): what
611
+ * this package uses of the core at run time goes through here, never through a static import. A
612
+ * bundler then leaves the core - the AI SDK, zod, the providers - out of the page's first chunk,
613
+ * and a chat whose agent is on a server (`createRemoteAgentController`) never loads it at all.
614
+ * A failed import is tried again on the next call.
615
+ */
616
+ declare const loadAgentCore: () => Promise<AgentCoreModule>;
617
+ /** The core if `loadAgentCore` has already resolved, else `undefined` (nothing is imported). */
618
+ declare const agentCoreIfLoaded: () => AgentCoreModule | undefined;
619
+
602
620
  /**
603
621
  * The sandboxed frame's security core: what untrusted HTML (a file the agent wrote, later an
604
622
  * MCP App) is wrapped in before it reaches an `<iframe>`. Pure strings - no React, no DOM - so
@@ -993,5 +1011,5 @@ interface AudioSpeakerOptions {
993
1011
  */
994
1012
  declare const createAudioSpeaker: (options: AudioSpeakerOptions) => SpeakText;
995
1013
 
996
- export { AgentUiState, ApprovalView, ChatAttachment, ChatHistoryStore, ChatMessage, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, HTML_PREVIEW_MAX_CHARS, LessonView, MicError, NAMED_FILES_MAX, NAMED_FILES_SCAN_MAX, NAMED_FILES_TEXT_MAX, PROMPT_ARM_MS, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SpeechOutputError, SubagentNode, SubagentView, activeElementOf, agentStateReducer, agentStatusOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, coalesce, composedContains, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createPromptArming, createRecordingRecognizer, cspMetaTag, deepActiveElement, deepElementFromPoint, downscaleImage, endGap, errMessage, escapeAttribute, eventTargetOf, followOtherTabs, followsAfterResize, followsAfterScroll, formatDuration, formatProbability, formatTokens, imageSizeOf, imagesInOutput, isEventInside, isShadowRoot, languageOfText, lessonsOf, linkedFilesOf, listenScrollAround, listenToOtherTabs, mergeChatRecord, micProblemOf, namedFilesOf, newChatId, nothingFocused, ownUnsaved, pathsNamedIn, pendingApprovalsOf, pickRecordingType, portalHostOf, previewValue, recordingSupported, remoteAnswerOf, rootOf, sandboxTokens, sandboxedCsp, saveChat, scriptOfLanguage, scriptOfText, shadowRootsAround, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, stopTracks, subagentTree, tokenizeHtml, unchangedSince, voiceFor, voicesOf, webSearchOf, withCspFirst, withPolicyFirst, workspacePathOf };
997
- export type { AgentAction, ApprovalQueue, AttachmentTexts, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryStoreOptions, ChatRecord, ChatSummary, DownscaleOptions, ImageSize, MediaRecorderConstructorLike, MediaRecorderLike, MicProblem, NamedFilesOptions, PromptArming, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, SandboxedDocumentOptions, ScrollMeasure, SourceToken, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, SynthesizeSpeech, TranscribeAudio, WebSearchResultView, WebSearchView };
1014
+ export { AgentUiState, ApprovalView, ChatAttachment, ChatHistoryStore, ChatMessage, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, HTML_PREVIEW_MAX_CHARS, LessonView, MicError, NAMED_FILES_MAX, NAMED_FILES_SCAN_MAX, NAMED_FILES_TEXT_MAX, PROMPT_ARM_MS, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SpeechOutputError, SubagentNode, SubagentView, activeElementOf, agentCoreIfLoaded, agentStateReducer, agentStatusOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, coalesce, composedContains, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createPromptArming, createRecordingRecognizer, cspMetaTag, deepActiveElement, deepElementFromPoint, downscaleImage, endGap, errMessage, escapeAttribute, eventTargetOf, followOtherTabs, followsAfterResize, followsAfterScroll, formatDuration, formatProbability, formatTokens, imageSizeOf, imagesInOutput, isEventInside, isShadowRoot, languageOfText, lessonsOf, linkedFilesOf, listenScrollAround, listenToOtherTabs, loadAgentCore, mergeChatRecord, micProblemOf, namedFilesOf, newChatId, nothingFocused, ownUnsaved, pathsNamedIn, pendingApprovalsOf, pickRecordingType, portalHostOf, previewValue, recordingSupported, remoteAnswerOf, rootOf, sandboxTokens, sandboxedCsp, saveChat, scriptOfLanguage, scriptOfText, shadowRootsAround, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, stopTracks, subagentTree, tokenizeHtml, unchangedSince, voiceFor, voicesOf, webSearchOf, withCspFirst, withPolicyFirst, workspacePathOf };
1015
+ export type { AgentAction, AgentCoreModule, ApprovalQueue, AttachmentTexts, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryStoreOptions, ChatRecord, ChatSummary, DownscaleOptions, ImageSize, MediaRecorderConstructorLike, MediaRecorderLike, MicProblem, NamedFilesOptions, PromptArming, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, SandboxedDocumentOptions, ScrollMeasure, SourceToken, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, StorageChangeSource, SynthesizeSpeech, TranscribeAudio, WebSearchResultView, WebSearchView };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
+ import * as Core from '@dudko.dev/agent-web';
1
2
  import { AgentEvent, IUsage, Skill, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
2
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-DnBCok3z.js';
3
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-DnBCok3z.js';
4
- 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 menuKeyTarget, ah as menuSections, ai as mergeLabels, aj as messageOverLimit, ak as micProblemText, al as notReadyIntent, am as notReadyReason, an as noticesOf, ao as overflowOf, ap as parseSlash, aq as saveAttachments, ar as steerIntent, as as textExcerpt, at as voiceMessageName, au as waitingSendStep, av as withAttachments } from './labels-DH1ESUtm.js';
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-CCPL7t17.js';
5
6
  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.js';
6
7
  import './mcp-app.js';
7
8
  import './mcp-app-policy-DXKQ2jjM.js';
@@ -566,13 +567,19 @@ declare const coalesce: (fn: () => void, ms?: number) => {
566
567
  call: () => void;
567
568
  cancel: () => void;
568
569
  };
570
+ /** What `listenToOtherTabs` / `followOtherTabs` take for the core: its module, or a loader of it. */
571
+ type StorageChangeSource = {
572
+ onStorageChange?: unknown;
573
+ } | (() => Promise<{
574
+ onStorageChange?: unknown;
575
+ }>);
569
576
  /**
570
577
  * The core's `onStorageChange`, or a no-op where the core predates it (the hooks then work as
571
- * before: this tab's own changes only). One place for the guard every hook needs.
578
+ * before: this tab's own changes only). One place for the guard every hook needs. `core` may be a
579
+ * LOADER (`loadAgentCore`): it is called only when there is a database to follow, and the
580
+ * subscription starts once it resolves - so a view that follows nothing never loads the core.
572
581
  */
573
- declare const listenToOtherTabs: (core: {
574
- onStorageChange?: unknown;
575
- }, dbName: string | undefined, listener: (change: {
582
+ declare const listenToOtherTabs: (core: StorageChangeSource, dbName: string | undefined, listener: (change: {
576
583
  kind: string;
577
584
  op: string;
578
585
  key?: string;
@@ -583,9 +590,7 @@ declare const listenToOtherTabs: (core: {
583
590
  * matters here), `settle` runs once, ~`ms` after the last accepted one of a burst. What every hook
584
591
  * that follows other tabs uses. The returned function unsubscribes and drops a pending settle.
585
592
  */
586
- declare const followOtherTabs: (core: {
587
- onStorageChange?: unknown;
588
- }, dbName: string | undefined, accept: (change: {
593
+ declare const followOtherTabs: (core: StorageChangeSource, dbName: string | undefined, accept: (change: {
589
594
  kind: string;
590
595
  op: string;
591
596
  key?: string;
@@ -599,6 +604,19 @@ declare const followOtherTabs: (core: {
599
604
  */
600
605
  declare const remoteAnswerOf: (ok: boolean, stillWatching: boolean) => "taken" | "refused" | "unknown";
601
606
 
607
+ /** The core's module (`@dudko.dev/agent-web`), as `loadAgentCore` resolves it. */
608
+ type AgentCoreModule = typeof Core;
609
+ /**
610
+ * The core, imported on the first call (a dynamic `import()`, the same module every time): what
611
+ * this package uses of the core at run time goes through here, never through a static import. A
612
+ * bundler then leaves the core - the AI SDK, zod, the providers - out of the page's first chunk,
613
+ * and a chat whose agent is on a server (`createRemoteAgentController`) never loads it at all.
614
+ * A failed import is tried again on the next call.
615
+ */
616
+ declare const loadAgentCore: () => Promise<AgentCoreModule>;
617
+ /** The core if `loadAgentCore` has already resolved, else `undefined` (nothing is imported). */
618
+ declare const agentCoreIfLoaded: () => AgentCoreModule | undefined;
619
+
602
620
  /**
603
621
  * The sandboxed frame's security core: what untrusted HTML (a file the agent wrote, later an
604
622
  * MCP App) is wrapped in before it reaches an `<iframe>`. Pure strings - no React, no DOM - so
@@ -993,5 +1011,5 @@ interface AudioSpeakerOptions {
993
1011
  */
994
1012
  declare const createAudioSpeaker: (options: AudioSpeakerOptions) => SpeakText;
995
1013
 
996
- export { AgentUiState, ApprovalView, ChatAttachment, ChatHistoryStore, ChatMessage, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, HTML_PREVIEW_MAX_CHARS, LessonView, MicError, NAMED_FILES_MAX, NAMED_FILES_SCAN_MAX, NAMED_FILES_TEXT_MAX, PROMPT_ARM_MS, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SpeechOutputError, SubagentNode, SubagentView, activeElementOf, agentStateReducer, agentStatusOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, coalesce, composedContains, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createPromptArming, createRecordingRecognizer, cspMetaTag, deepActiveElement, deepElementFromPoint, downscaleImage, endGap, errMessage, escapeAttribute, eventTargetOf, followOtherTabs, followsAfterResize, followsAfterScroll, formatDuration, formatProbability, formatTokens, imageSizeOf, imagesInOutput, isEventInside, isShadowRoot, languageOfText, lessonsOf, linkedFilesOf, listenScrollAround, listenToOtherTabs, mergeChatRecord, micProblemOf, namedFilesOf, newChatId, nothingFocused, ownUnsaved, pathsNamedIn, pendingApprovalsOf, pickRecordingType, portalHostOf, previewValue, recordingSupported, remoteAnswerOf, rootOf, sandboxTokens, sandboxedCsp, saveChat, scriptOfLanguage, scriptOfText, shadowRootsAround, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, stopTracks, subagentTree, tokenizeHtml, unchangedSince, voiceFor, voicesOf, webSearchOf, withCspFirst, withPolicyFirst, workspacePathOf };
997
- export type { AgentAction, ApprovalQueue, AttachmentTexts, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryStoreOptions, ChatRecord, ChatSummary, DownscaleOptions, ImageSize, MediaRecorderConstructorLike, MediaRecorderLike, MicProblem, NamedFilesOptions, PromptArming, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, SandboxedDocumentOptions, ScrollMeasure, SourceToken, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, SynthesizeSpeech, TranscribeAudio, WebSearchResultView, WebSearchView };
1014
+ export { AgentUiState, ApprovalView, ChatAttachment, ChatHistoryStore, ChatMessage, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, HTML_PREVIEW_MAX_CHARS, LessonView, MicError, NAMED_FILES_MAX, NAMED_FILES_SCAN_MAX, NAMED_FILES_TEXT_MAX, PROMPT_ARM_MS, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SpeechOutputError, SubagentNode, SubagentView, activeElementOf, agentCoreIfLoaded, agentStateReducer, agentStatusOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, coalesce, composedContains, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createPromptArming, createRecordingRecognizer, cspMetaTag, deepActiveElement, deepElementFromPoint, downscaleImage, endGap, errMessage, escapeAttribute, eventTargetOf, followOtherTabs, followsAfterResize, followsAfterScroll, formatDuration, formatProbability, formatTokens, imageSizeOf, imagesInOutput, isEventInside, isShadowRoot, languageOfText, lessonsOf, linkedFilesOf, listenScrollAround, listenToOtherTabs, loadAgentCore, mergeChatRecord, micProblemOf, namedFilesOf, newChatId, nothingFocused, ownUnsaved, pathsNamedIn, pendingApprovalsOf, pickRecordingType, portalHostOf, previewValue, recordingSupported, remoteAnswerOf, rootOf, sandboxTokens, sandboxedCsp, saveChat, scriptOfLanguage, scriptOfText, shadowRootsAround, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, stopTracks, subagentTree, tokenizeHtml, unchangedSince, voiceFor, voicesOf, webSearchOf, withCspFirst, withPolicyFirst, workspacePathOf };
1015
+ export type { AgentAction, AgentCoreModule, ApprovalQueue, AttachmentTexts, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryStoreOptions, ChatRecord, ChatSummary, DownscaleOptions, ImageSize, MediaRecorderConstructorLike, MediaRecorderLike, MicProblem, NamedFilesOptions, PromptArming, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, SandboxedDocumentOptions, ScrollMeasure, SourceToken, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, StorageChangeSource, SynthesizeSpeech, TranscribeAudio, WebSearchResultView, WebSearchView };
package/dist/index.js CHANGED
@@ -23,7 +23,10 @@ import {
23
23
  } from "./chunk-TJBGZM6D.js";
24
24
  import {
25
25
  ASK_USER_TOOL_NAME,
26
+ MEDIA_AUDIO_TYPES_OF_CORE,
27
+ MEDIA_IMAGE_TYPES_OF_CORE,
26
28
  QUESTION_TIMEOUT_MS,
29
+ agentCoreIfLoaded,
27
30
  agentStateReducer,
28
31
  agentStatusOf,
29
32
  askUserOutputKept,
@@ -34,8 +37,10 @@ import {
34
37
  createQuestionQueue,
35
38
  errMessage,
36
39
  followOtherTabs,
40
+ isTextMimeOfCore,
37
41
  lessonsOf,
38
42
  listenToOtherTabs,
43
+ loadAgentCore,
39
44
  pendingApprovalsOf,
40
45
  questionChoiceOf,
41
46
  questionOtherOf,
@@ -43,7 +48,7 @@ import {
43
48
  remoteAnswerOf,
44
49
  subagentTree,
45
50
  withoutOwnWords
46
- } from "./chunk-G7LQTOA2.js";
51
+ } from "./chunk-NHU6WQM5.js";
47
52
 
48
53
  // src/composer.ts
49
54
  var parseSlash = (text2) => {
@@ -424,6 +429,7 @@ var defaultLabels = {
424
429
  memoryUndo: "Undo",
425
430
  memoryUndone: "Undone",
426
431
  placeholder: "Ask the agent to do something… ( / for commands, Ctrl+V to paste an image )",
432
+ placeholderTextOnly: "Ask the agent to do something… ( / for commands )",
427
433
  listening: "Listening…",
428
434
  message: "Message",
429
435
  dropHint: "Drop files or images to attach them",
@@ -939,22 +945,27 @@ var portalHostOf = (from, selector) => {
939
945
  };
940
946
 
941
947
  // src/file-kinds.ts
942
- import { MEDIA_IMAGE_TYPES, isTextMime } from "@dudko.dev/agent-web";
943
948
  var CODE = /\.(?:js|mjs|cjs|jsx|ts|tsx|css|scss|py|rb|go|rs|java|kt|c|h|cpp|cs|php|sh|sql|xml|svg|yaml|yml|toml)$/i;
944
949
  var mimeOf = (mediaType) => mediaType.toLowerCase().split(";")[0].trim();
945
950
  var fileKindOf = (path, mediaType) => {
946
951
  const mime = mimeOf(mediaType);
947
- if (Object.hasOwn(MEDIA_IMAGE_TYPES, mime)) return "image";
952
+ if (Object.hasOwn(MEDIA_IMAGE_TYPES_OF_CORE, mime)) return "image";
948
953
  if (mime === "text/html" || mime === "application/xhtml+xml" || /\.x?html?$/i.test(path))
949
954
  return "html";
950
955
  if (mime === "text/markdown" || /\.(?:md|markdown)$/i.test(path)) return "markdown";
951
956
  if (mime === "text/csv" || /\.(?:csv|tsv)$/i.test(path)) return "csv";
952
957
  if (mime === "application/json" || /\.json$/i.test(path)) return "json";
953
958
  if (CODE.test(path)) return "code";
954
- if (mime === "text/plain" || /\.(?:txt|log)$/i.test(path) || isTextMime(mime)) return "text";
959
+ if (mime === "text/plain" || /\.(?:txt|log)$/i.test(path) || isTextMimeOfCore(mime)) return "text";
955
960
  return "file";
956
961
  };
957
962
  var fileNameOf = (path) => path.split("/").filter(Boolean).pop() || "file";
963
+ var mediaFamilyOf = (mediaType) => {
964
+ const type = mimeOf(mediaType);
965
+ if (Object.hasOwn(MEDIA_IMAGE_TYPES_OF_CORE, type)) return "image";
966
+ if (Object.hasOwn(MEDIA_AUDIO_TYPES_OF_CORE, type)) return "audio";
967
+ return void 0;
968
+ };
958
969
 
959
970
  // src/image-resize.ts
960
971
  var canvasOf = (w, h) => {
@@ -1485,7 +1496,6 @@ var createPromptArming = (delayMs = PROMPT_ARM_MS) => {
1485
1496
  };
1486
1497
 
1487
1498
  // src/chat-history.ts
1488
- import * as core from "@dudko.dev/agent-web";
1489
1499
  var DB_VERSION = 1;
1490
1500
  var req = (r) => new Promise((resolve, reject) => {
1491
1501
  r.onsuccess = () => resolve(r.result);
@@ -1559,9 +1569,15 @@ var ChatHistoryStore = class {
1559
1569
  this.announce(notice);
1560
1570
  }
1561
1571
  announce(notice) {
1562
- if (typeof core.postStorageChange === "function") {
1563
- core.postStorageChange(this.dbName, { kind: "chats", ...notice });
1564
- }
1572
+ loadAgentCore().then(
1573
+ (core) => {
1574
+ if (typeof core.postStorageChange === "function") {
1575
+ core.postStorageChange(this.dbName, { kind: "chats", ...notice });
1576
+ }
1577
+ },
1578
+ () => {
1579
+ }
1580
+ );
1565
1581
  }
1566
1582
  /**
1567
1583
  * Read the stored record and write what `merge` makes of it in ONE readwrite transaction: no
@@ -2362,6 +2378,7 @@ export {
2362
2378
  RECORDING_TYPES,
2363
2379
  SpeechOutputError,
2364
2380
  activeElementOf,
2381
+ agentCoreIfLoaded,
2365
2382
  agentStateReducer,
2366
2383
  agentStatusOf,
2367
2384
  askUserOutputKept,
@@ -2434,8 +2451,10 @@ export {
2434
2451
  linkedFilesOf,
2435
2452
  listenScrollAround,
2436
2453
  listenToOtherTabs,
2454
+ loadAgentCore,
2437
2455
  longTextName,
2438
2456
  longTextRoute,
2457
+ mediaFamilyOf,
2439
2458
  menuKeyTarget,
2440
2459
  menuSections,
2441
2460
  mergeChatRecord,
@@ -571,6 +571,11 @@ type FileKind = 'html' | 'markdown' | 'csv' | 'json' | 'image' | 'code' | 'text'
571
571
  declare const fileKindOf: (path: string, mediaType: string) => FileKind;
572
572
  /** The last segment of a path: what a chip is called and what a download is saved as. */
573
573
  declare const fileNameOf: (path: string) => string;
574
+ /**
575
+ * How a generated file may be shown: only the types the core's media tools accept
576
+ * (PNG / JPEG / GIF / WebP, and its audio list). Anything else - SVG included - is a file chip.
577
+ */
578
+ declare const mediaFamilyOf: (mediaType: string) => "image" | "audio" | undefined;
574
579
 
575
580
  /**
576
581
  * Every string the pre-styled components render — override any of them for
@@ -623,6 +628,8 @@ interface AgentLabels {
623
628
  /** In place of the button once it was taken back. */
624
629
  memoryUndone: string;
625
630
  placeholder: string;
631
+ /** The message box's placeholder when it takes text only (no attachments: `textOnly`). */
632
+ placeholderTextOnly: string;
626
633
  listening: string;
627
634
  message: string;
628
635
  dropHint: string;
@@ -1172,5 +1179,5 @@ type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'comma
1172
1179
  /** `base` with `over` applied (nested groups merged, not replaced). */
1173
1180
  declare const mergeLabels: (base: AgentLabels, over?: AgentLabelsOverride) => AgentLabels;
1174
1181
 
1175
- export { elicitationLink as $, attachmentFileName as D, ELICITATION_MAX_OPTIONS as E, attachmentKindOf as G, attachmentLabel as H, INPUT_COUNTER_FROM as I, attachmentOverLimit as J, attachmentRefusal as K, attachmentTransformOf as L, boxLength as O, createElicitationQueue as Q, dataUrlParts as R, defaultLabels as U, defaultNoticeTexts as V, elicitationConnectOptions as X, elicitationFields as Y, elicitationFormAnswer as Z, elicitationInitialDraft as _, ATTACHMENT_BOUNDS as a, elicitationSettings as a0, elicitationTimeoutOf as a1, excerptNote as a2, fileKindOf as a3, fileNameOf as a4, filterCommands as a5, formatClock as a6, formatCountdown as a7, formatElapsed as a8, freeAttachmentPath as a9, inputCounterShown as aa, insertionFits as ab, isOneCharacter as ac, lineCountOf as ad, longTextName as ae, longTextRoute as af, menuKeyTarget as ag, menuSections as ah, mergeLabels as ai, messageOverLimit as aj, micProblemText as ak, notReadyIntent as al, notReadyReason as am, noticesOf as an, overflowOf as ao, parseSlash as ap, saveAttachments as aq, steerIntent as ar, textExcerpt as as, voiceMessageName as at, waitingSendStep as au, withAttachments as av, ELICITATION_TIMEOUT_MS as i, ELICITATION_VALUE_MAX_CHARS as j };
1182
+ export { elicitationLink as $, attachmentFileName as D, ELICITATION_MAX_OPTIONS as E, attachmentKindOf as G, attachmentLabel as H, INPUT_COUNTER_FROM as I, attachmentOverLimit as J, attachmentRefusal as K, attachmentTransformOf as L, boxLength as O, createElicitationQueue as Q, dataUrlParts as R, defaultLabels as U, defaultNoticeTexts as V, elicitationConnectOptions as X, elicitationFields as Y, elicitationFormAnswer as Z, elicitationInitialDraft as _, ATTACHMENT_BOUNDS as a, elicitationSettings as a0, elicitationTimeoutOf as a1, excerptNote as a2, fileKindOf as a3, fileNameOf as a4, filterCommands as a5, formatClock as a6, formatCountdown as a7, formatElapsed as a8, freeAttachmentPath as a9, inputCounterShown as aa, insertionFits as ab, isOneCharacter as ac, lineCountOf as ad, longTextName as ae, longTextRoute as af, mediaFamilyOf as ag, menuKeyTarget as ah, menuSections as ai, mergeLabels as aj, messageOverLimit as ak, micProblemText as al, notReadyIntent as am, notReadyReason as an, noticesOf as ao, overflowOf as ap, parseSlash as aq, saveAttachments as ar, steerIntent as as, textExcerpt as at, voiceMessageName as au, waitingSendStep as av, withAttachments as aw, ELICITATION_TIMEOUT_MS as i, ELICITATION_VALUE_MAX_CHARS as j };
1176
1183
  export type { AgentLabelsOverride as A, SteerIntent as B, ComposerAttachment as C, FileKind as F, MenuSection as M, NotReadyInput as N, PendingElicitation as P, SavedAttachments as S, TextExcerpt as T, WaitingSendStep as W, AgentLabels as b, AttachmentBounds as c, AttachmentFiles as d, AttachmentOverLimit as e, AttachmentTextOptions as f, AttachmentTransform as g, ComposerNotice as h, ElicitationControl as k, ElicitationDraft as l, ElicitationDraftValue as m, ElicitationField as n, ElicitationFormOutcome as o, ElicitationIssue as p, ElicitationIssueKind as q, ElicitationLink as r, ElicitationOption as s, ElicitationOutcomeReason as t, ElicitationQueue as u, ElicitationQueueOptions as v, NotReadyIntent as w, NotReadyReason as x, NoticeTexts as y, SlashCommand as z };
@@ -571,6 +571,11 @@ type FileKind = 'html' | 'markdown' | 'csv' | 'json' | 'image' | 'code' | 'text'
571
571
  declare const fileKindOf: (path: string, mediaType: string) => FileKind;
572
572
  /** The last segment of a path: what a chip is called and what a download is saved as. */
573
573
  declare const fileNameOf: (path: string) => string;
574
+ /**
575
+ * How a generated file may be shown: only the types the core's media tools accept
576
+ * (PNG / JPEG / GIF / WebP, and its audio list). Anything else - SVG included - is a file chip.
577
+ */
578
+ declare const mediaFamilyOf: (mediaType: string) => "image" | "audio" | undefined;
574
579
 
575
580
  /**
576
581
  * Every string the pre-styled components render — override any of them for
@@ -623,6 +628,8 @@ interface AgentLabels {
623
628
  /** In place of the button once it was taken back. */
624
629
  memoryUndone: string;
625
630
  placeholder: string;
631
+ /** The message box's placeholder when it takes text only (no attachments: `textOnly`). */
632
+ placeholderTextOnly: string;
626
633
  listening: string;
627
634
  message: string;
628
635
  dropHint: string;
@@ -1172,5 +1179,5 @@ type AgentLabelsOverride = Partial<Omit<AgentLabels, 'status' | 'modes' | 'comma
1172
1179
  /** `base` with `over` applied (nested groups merged, not replaced). */
1173
1180
  declare const mergeLabels: (base: AgentLabels, over?: AgentLabelsOverride) => AgentLabels;
1174
1181
 
1175
- export { elicitationLink as $, attachmentFileName as D, ELICITATION_MAX_OPTIONS as E, attachmentKindOf as G, attachmentLabel as H, INPUT_COUNTER_FROM as I, attachmentOverLimit as J, attachmentRefusal as K, attachmentTransformOf as L, boxLength as O, createElicitationQueue as Q, dataUrlParts as R, defaultLabels as U, defaultNoticeTexts as V, elicitationConnectOptions as X, elicitationFields as Y, elicitationFormAnswer as Z, elicitationInitialDraft as _, ATTACHMENT_BOUNDS as a, elicitationSettings as a0, elicitationTimeoutOf as a1, excerptNote as a2, fileKindOf as a3, fileNameOf as a4, filterCommands as a5, formatClock as a6, formatCountdown as a7, formatElapsed as a8, freeAttachmentPath as a9, inputCounterShown as aa, insertionFits as ab, isOneCharacter as ac, lineCountOf as ad, longTextName as ae, longTextRoute as af, menuKeyTarget as ag, menuSections as ah, mergeLabels as ai, messageOverLimit as aj, micProblemText as ak, notReadyIntent as al, notReadyReason as am, noticesOf as an, overflowOf as ao, parseSlash as ap, saveAttachments as aq, steerIntent as ar, textExcerpt as as, voiceMessageName as at, waitingSendStep as au, withAttachments as av, ELICITATION_TIMEOUT_MS as i, ELICITATION_VALUE_MAX_CHARS as j };
1182
+ export { elicitationLink as $, attachmentFileName as D, ELICITATION_MAX_OPTIONS as E, attachmentKindOf as G, attachmentLabel as H, INPUT_COUNTER_FROM as I, attachmentOverLimit as J, attachmentRefusal as K, attachmentTransformOf as L, boxLength as O, createElicitationQueue as Q, dataUrlParts as R, defaultLabels as U, defaultNoticeTexts as V, elicitationConnectOptions as X, elicitationFields as Y, elicitationFormAnswer as Z, elicitationInitialDraft as _, ATTACHMENT_BOUNDS as a, elicitationSettings as a0, elicitationTimeoutOf as a1, excerptNote as a2, fileKindOf as a3, fileNameOf as a4, filterCommands as a5, formatClock as a6, formatCountdown as a7, formatElapsed as a8, freeAttachmentPath as a9, inputCounterShown as aa, insertionFits as ab, isOneCharacter as ac, lineCountOf as ad, longTextName as ae, longTextRoute as af, mediaFamilyOf as ag, menuKeyTarget as ah, menuSections as ai, mergeLabels as aj, messageOverLimit as ak, micProblemText as al, notReadyIntent as am, notReadyReason as an, noticesOf as ao, overflowOf as ap, parseSlash as aq, saveAttachments as ar, steerIntent as as, textExcerpt as at, voiceMessageName as au, waitingSendStep as av, withAttachments as aw, ELICITATION_TIMEOUT_MS as i, ELICITATION_VALUE_MAX_CHARS as j };
1176
1183
  export type { AgentLabelsOverride as A, SteerIntent as B, ComposerAttachment as C, FileKind as F, MenuSection as M, NotReadyInput as N, PendingElicitation as P, SavedAttachments as S, TextExcerpt as T, WaitingSendStep as W, AgentLabels as b, AttachmentBounds as c, AttachmentFiles as d, AttachmentOverLimit as e, AttachmentTextOptions as f, AttachmentTransform as g, ComposerNotice as h, ElicitationControl as k, ElicitationDraft as l, ElicitationDraftValue as m, ElicitationField as n, ElicitationFormOutcome as o, ElicitationIssue as p, ElicitationIssueKind as q, ElicitationLink as r, ElicitationOption as s, ElicitationOutcomeReason as t, ElicitationQueue as u, ElicitationQueueOptions as v, NotReadyIntent as w, NotReadyReason as x, NoticeTexts as y, SlashCommand as z };
@@ -82,6 +82,8 @@ var labelsFromCatalog = (tag, catalog2) => {
82
82
  planned: t("planned"),
83
83
  replanned: (_mode, reason) => t("replanned", { reason }),
84
84
  placeholder: t("placeholder"),
85
+ // The catalogs' placeholder names no attachment: the same words for a text-only box.
86
+ placeholderTextOnly: t("placeholder"),
85
87
  placeholderBusy: t("placeholderBusy"),
86
88
  message: t("message"),
87
89
  commands: t("commands"),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  labelsFromCatalog
3
- } from "../chunk-UNIXGP4N.js";
3
+ } from "../chunk-627OXMFG.js";
4
4
 
5
5
  // src/locales/catalogs/be.ts
6
6
  var catalog = {
@@ -82,6 +82,8 @@ var labelsFromCatalog = (tag, catalog2) => {
82
82
  planned: t("planned"),
83
83
  replanned: (_mode, reason) => t("replanned", { reason }),
84
84
  placeholder: t("placeholder"),
85
+ // The catalogs' placeholder names no attachment: the same words for a text-only box.
86
+ placeholderTextOnly: t("placeholder"),
85
87
  placeholderBusy: t("placeholderBusy"),
86
88
  message: t("message"),
87
89
  commands: t("commands"),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  labelsFromCatalog
3
- } from "../chunk-UNIXGP4N.js";
3
+ } from "../chunk-627OXMFG.js";
4
4
 
5
5
  // src/locales/catalogs/bg.ts
6
6
  var catalog = {
@@ -82,6 +82,8 @@ var labelsFromCatalog = (tag, catalog2) => {
82
82
  planned: t("planned"),
83
83
  replanned: (_mode, reason) => t("replanned", { reason }),
84
84
  placeholder: t("placeholder"),
85
+ // The catalogs' placeholder names no attachment: the same words for a text-only box.
86
+ placeholderTextOnly: t("placeholder"),
85
87
  placeholderBusy: t("placeholderBusy"),
86
88
  message: t("message"),
87
89
  commands: t("commands"),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  labelsFromCatalog
3
- } from "../chunk-UNIXGP4N.js";
3
+ } from "../chunk-627OXMFG.js";
4
4
 
5
5
  // src/locales/catalogs/ca.ts
6
6
  var catalog = {
@@ -82,6 +82,8 @@ var labelsFromCatalog = (tag, catalog2) => {
82
82
  planned: t("planned"),
83
83
  replanned: (_mode, reason) => t("replanned", { reason }),
84
84
  placeholder: t("placeholder"),
85
+ // The catalogs' placeholder names no attachment: the same words for a text-only box.
86
+ placeholderTextOnly: t("placeholder"),
85
87
  placeholderBusy: t("placeholderBusy"),
86
88
  message: t("message"),
87
89
  commands: t("commands"),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  labelsFromCatalog
3
- } from "../chunk-UNIXGP4N.js";
3
+ } from "../chunk-627OXMFG.js";
4
4
 
5
5
  // src/locales/catalogs/cs.ts
6
6
  var catalog = {
@@ -82,6 +82,8 @@ var labelsFromCatalog = (tag, catalog2) => {
82
82
  planned: t("planned"),
83
83
  replanned: (_mode, reason) => t("replanned", { reason }),
84
84
  placeholder: t("placeholder"),
85
+ // The catalogs' placeholder names no attachment: the same words for a text-only box.
86
+ placeholderTextOnly: t("placeholder"),
85
87
  placeholderBusy: t("placeholderBusy"),
86
88
  message: t("message"),
87
89
  commands: t("commands"),