@aparte/core 0.7.1 → 0.8.0

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 (171) hide show
  1. package/README.md +20 -6
  2. package/dist/client/aparte-client.d.ts +113 -47
  3. package/dist/client/aparte-client.d.ts.map +1 -1
  4. package/dist/client/lifecycle-events.d.ts +55 -0
  5. package/dist/client/lifecycle-events.d.ts.map +1 -0
  6. package/dist/client/stream-adapter.d.ts +11 -5
  7. package/dist/client/stream-adapter.d.ts.map +1 -1
  8. package/dist/client/xml-artifact-feed.d.ts +76 -0
  9. package/dist/client/xml-artifact-feed.d.ts.map +1 -0
  10. package/dist/components/bubble/aparte-chat-bubble.d.ts +35 -8
  11. package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
  12. package/dist/components/chat/aparte-chat.d.ts +0 -6
  13. package/dist/components/chat/aparte-chat.d.ts.map +1 -1
  14. package/dist/components/composer/aparte-composer-action.d.ts +18 -3
  15. package/dist/components/composer/aparte-composer-action.d.ts.map +1 -1
  16. package/dist/components/composer/aparte-composer-add-attachment.d.ts.map +1 -1
  17. package/dist/components/composer/aparte-composer-attachments.d.ts +1 -1
  18. package/dist/components/composer/aparte-composer-attachments.d.ts.map +1 -1
  19. package/dist/components/composer/aparte-composer-cancel.d.ts.map +1 -1
  20. package/dist/components/composer/aparte-composer-input.d.ts +0 -2
  21. package/dist/components/composer/aparte-composer-input.d.ts.map +1 -1
  22. package/dist/components/composer/aparte-composer-send.d.ts +5 -0
  23. package/dist/components/composer/aparte-composer-send.d.ts.map +1 -1
  24. package/dist/components/composer/aparte-composer-toolbar.d.ts +4 -0
  25. package/dist/components/composer/aparte-composer-toolbar.d.ts.map +1 -1
  26. package/dist/components/composer/aparte-composer.d.ts +64 -6
  27. package/dist/components/composer/aparte-composer.d.ts.map +1 -1
  28. package/dist/components/composer/index.d.ts +1 -1
  29. package/dist/components/composer/index.d.ts.map +1 -1
  30. package/dist/components/conversation-list/aparte-conversation-list.d.ts +2 -5
  31. package/dist/components/conversation-list/aparte-conversation-list.d.ts.map +1 -1
  32. package/dist/components/conversation-list/index.d.ts +1 -1
  33. package/dist/components/conversation-list/index.d.ts.map +1 -1
  34. package/dist/components/elicitation/aparte-elicitation.d.ts +63 -3
  35. package/dist/components/elicitation/aparte-elicitation.d.ts.map +1 -1
  36. package/dist/components/index.d.ts +2 -2
  37. package/dist/components/index.d.ts.map +1 -1
  38. package/dist/components/status/aparte-chat-status.d.ts +8 -6
  39. package/dist/components/status/aparte-chat-status.d.ts.map +1 -1
  40. package/dist/components/viewport/aparte-chat-viewport.d.ts +35 -9
  41. package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
  42. package/dist/config/action-provider.d.ts +4 -4
  43. package/dist/config/aparte-config.d.ts +124 -41
  44. package/dist/config/aparte-config.d.ts.map +1 -1
  45. package/dist/config/attachment-renderer.d.ts +1 -1
  46. package/dist/config/avatar-provider.d.ts +1 -1
  47. package/dist/config/config-context.d.ts +66 -11
  48. package/dist/config/config-context.d.ts.map +1 -1
  49. package/dist/config/elicitation-field-renderer.d.ts +73 -0
  50. package/dist/config/elicitation-field-renderer.d.ts.map +1 -0
  51. package/dist/config/error-renderer.d.ts +1 -1
  52. package/dist/config/icon-provider.d.ts +2 -2
  53. package/dist/config/icon-provider.d.ts.map +1 -1
  54. package/dist/config/index.d.ts +7 -5
  55. package/dist/config/index.d.ts.map +1 -1
  56. package/dist/config/locale.d.ts +43 -2
  57. package/dist/config/locale.d.ts.map +1 -1
  58. package/dist/config/sanitize.d.ts +1 -7
  59. package/dist/config/sanitize.d.ts.map +1 -1
  60. package/dist/config/sibling-nav-renderer.d.ts +1 -1
  61. package/dist/config/skeleton-provider.d.ts +2 -2
  62. package/dist/config/skeleton-provider.d.ts.map +1 -1
  63. package/dist/config/status-renderer.d.ts +1 -1
  64. package/dist/conversations/conversation-controller.d.ts +19 -5
  65. package/dist/conversations/conversation-controller.d.ts.map +1 -1
  66. package/dist/conversations/conversation-manager.d.ts +2 -2
  67. package/dist/conversations/conversation-manager.d.ts.map +1 -1
  68. package/dist/conversations/index.d.ts +1 -1
  69. package/dist/conversations/index.d.ts.map +1 -1
  70. package/dist/conversations/types.d.ts +1 -1
  71. package/dist/custom-elements.json +6664 -4877
  72. package/dist/elicitation/index.d.ts +1 -1
  73. package/dist/elicitation/panel.d.ts +32 -0
  74. package/dist/elicitation/panel.d.ts.map +1 -1
  75. package/dist/elicitation/types.d.ts +29 -2
  76. package/dist/elicitation/types.d.ts.map +1 -1
  77. package/dist/host/aparte-chat-host.d.ts +3 -3
  78. package/dist/host/aparte-chat-host.d.ts.map +1 -1
  79. package/dist/{index-Dn7TH14G.js → index-BieFbKeW.js} +1795 -1238
  80. package/dist/index-BieFbKeW.js.map +1 -0
  81. package/dist/index.css +299 -21
  82. package/dist/index.d.ts +21 -13
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +447 -200
  85. package/dist/index.js.map +1 -1
  86. package/dist/index.node.d.ts +22 -13
  87. package/dist/index.node.d.ts.map +1 -1
  88. package/dist/index.node.js +54 -46
  89. package/dist/index.node.js.map +1 -1
  90. package/dist/interop/element-props.d.ts +1 -1
  91. package/dist/interop/element-props.d.ts.map +1 -1
  92. package/dist/parsers/aparte-stream-parser.d.ts.map +1 -1
  93. package/dist/primitives/index.d.ts +1 -1
  94. package/dist/primitives/index.d.ts.map +1 -1
  95. package/dist/primitives/select/aparte-optgroup.d.ts +15 -4
  96. package/dist/primitives/select/aparte-optgroup.d.ts.map +1 -1
  97. package/dist/primitives/select/aparte-option.d.ts +0 -5
  98. package/dist/primitives/select/aparte-option.d.ts.map +1 -1
  99. package/dist/primitives/select/aparte-select.d.ts +17 -5
  100. package/dist/primitives/select/aparte-select.d.ts.map +1 -1
  101. package/dist/primitives/select/index.d.ts +1 -1
  102. package/dist/primitives/select/index.d.ts.map +1 -1
  103. package/dist/renderers/markdown-stream.d.ts +42 -0
  104. package/dist/renderers/markdown-stream.d.ts.map +1 -0
  105. package/dist/renderers/segment-renderers.d.ts +20 -14
  106. package/dist/renderers/segment-renderers.d.ts.map +1 -1
  107. package/dist/renderers/segments/artifact/binary-file.d.ts +45 -0
  108. package/dist/renderers/segments/artifact/binary-file.d.ts.map +1 -0
  109. package/dist/renderers/segments/artifact/card.d.ts +3 -0
  110. package/dist/renderers/segments/artifact/card.d.ts.map +1 -0
  111. package/dist/renderers/segments/artifact/preview-document.d.ts +27 -0
  112. package/dist/renderers/segments/artifact/preview-document.d.ts.map +1 -0
  113. package/dist/renderers/segments/artifact/shared.d.ts +12 -0
  114. package/dist/renderers/segments/artifact/shared.d.ts.map +1 -0
  115. package/dist/renderers/segments/code.d.ts +3 -0
  116. package/dist/renderers/segments/code.d.ts.map +1 -0
  117. package/dist/renderers/segments/error.d.ts +3 -0
  118. package/dist/renderers/segments/error.d.ts.map +1 -0
  119. package/dist/renderers/segments/file-tree.d.ts +3 -0
  120. package/dist/renderers/segments/file-tree.d.ts.map +1 -0
  121. package/dist/renderers/segments/pipeline-waiting.d.ts +3 -0
  122. package/dist/renderers/segments/pipeline-waiting.d.ts.map +1 -0
  123. package/dist/renderers/segments/progress.d.ts +3 -0
  124. package/dist/renderers/segments/progress.d.ts.map +1 -0
  125. package/dist/renderers/segments/terminal.d.ts +3 -0
  126. package/dist/renderers/segments/terminal.d.ts.map +1 -0
  127. package/dist/renderers/segments/text.d.ts +10 -0
  128. package/dist/renderers/segments/text.d.ts.map +1 -0
  129. package/dist/renderers/segments/thinking.d.ts +3 -0
  130. package/dist/renderers/segments/thinking.d.ts.map +1 -0
  131. package/dist/renderers/segments/tool-call.d.ts +3 -0
  132. package/dist/renderers/segments/tool-call.d.ts.map +1 -0
  133. package/dist/runtime/message-repository.d.ts +3 -3
  134. package/dist/runtime/message-repository.d.ts.map +1 -1
  135. package/dist/transport/backend-handler.d.ts +19 -7
  136. package/dist/transport/backend-handler.d.ts.map +1 -1
  137. package/dist/transport/backend-transport.d.ts +1 -1
  138. package/dist/transport/backend-transport.d.ts.map +1 -1
  139. package/dist/transport/direct-transport.d.ts +4 -4
  140. package/dist/transport/direct-transport.d.ts.map +1 -1
  141. package/dist/transport/index.d.ts +2 -2
  142. package/dist/transport/index.d.ts.map +1 -1
  143. package/dist/transport/types.d.ts +3 -3
  144. package/dist/types/element-map.d.ts +69 -0
  145. package/dist/types/element-map.d.ts.map +1 -0
  146. package/dist/types/event-map.d.ts +84 -23
  147. package/dist/types/event-map.d.ts.map +1 -1
  148. package/dist/types/events.d.ts +206 -64
  149. package/dist/types/events.d.ts.map +1 -1
  150. package/dist/types/index.d.ts +4 -5
  151. package/dist/types/index.d.ts.map +1 -1
  152. package/dist/types/model-provider.d.ts +100 -54
  153. package/dist/types/model-provider.d.ts.map +1 -1
  154. package/dist/types/models.d.ts +29 -7
  155. package/dist/types/models.d.ts.map +1 -1
  156. package/dist/types/segments.d.ts +1 -8
  157. package/dist/types/segments.d.ts.map +1 -1
  158. package/dist/types/theming.d.ts +25 -37
  159. package/dist/types/theming.d.ts.map +1 -1
  160. package/dist/types/tools.d.ts +60 -15
  161. package/dist/types/tools.d.ts.map +1 -1
  162. package/dist/utils/escape.d.ts +46 -0
  163. package/dist/utils/escape.d.ts.map +1 -0
  164. package/dist/utils/files-to-attachments.d.ts +18 -1
  165. package/dist/utils/files-to-attachments.d.ts.map +1 -1
  166. package/dist/utils/uuid.d.ts +26 -0
  167. package/dist/utils/uuid.d.ts.map +1 -0
  168. package/package.json +3 -5
  169. package/dist/index-Dn7TH14G.js.map +0 -1
  170. package/dist/types/providers.d.ts +0 -93
  171. package/dist/types/providers.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AparteConfig
3
3
  *
4
- * Central configuration singleton for Aparte.
4
+ * Central configuration class for Aparte. `aparteGlobalConfig` is the page-wide instance.
5
5
  * Manages providers for Markdown rendering, Syntax Highlighting, Icons, and Skeleton loading.
6
6
  *
7
7
  * "Invisible but Flexible": Works out-of-the-box with sensible defaults,
@@ -15,13 +15,14 @@ import { AparteSkeletonProvider, AparteSkeletonType } from './skeleton-provider.
15
15
  import type { AparteStatusRenderer } from './status-renderer.js';
16
16
  import type { AparteErrorRenderer } from './error-renderer.js';
17
17
  import type { AparteAttachmentRenderer } from './attachment-renderer.js';
18
+ import type { AparteElicitationFieldRenderer } from './elicitation-field-renderer.js';
18
19
  import type { AparteSiblingNavRenderer } from './sibling-nav-renderer.js';
19
20
  import type { AparteBubbleShellRenderer } from './bubble-shell-renderer.js';
20
21
  import type { AparteAIProvider, AparteAIModel, AparteModelConfig } from '../types/model-provider.js';
21
22
  import type { AparteTransport } from '../transport/index.js';
22
23
  import type { AparteTool, AparteToolHandler, AparteToolRenderer } from '../types/tools.js';
23
24
  import type { AparteBubbleActionsConfig, AparteBubbleActionName, AparteHostHandlersConfig } from '../types/models.js';
24
- import type { ConversationManager } from '../conversations/conversation-manager.js';
25
+ import type { AparteConversationManager } from '../conversations/conversation-manager.js';
25
26
  import { type AparteSanitizer } from './sanitize.js';
26
27
  import type { AparteElicitationPresenter, AparteElicitationRequest, AparteElicitationResult } from '../elicitation/types.js';
27
28
  export type AparteMarkdownProvider = (raw: string) => string;
@@ -41,7 +42,7 @@ export type AparteKeyProvider = (providerId: string) => string | Promise<string
41
42
  *
42
43
  * Exported so a consumer can read the defaults instead of hard-coding them.
43
44
  */
44
- export declare const DEFAULT_BUBBLE_ACTIONS: {
45
+ export declare const APARTE_DEFAULT_BUBBLE_ACTIONS: {
45
46
  readonly copy: true;
46
47
  readonly retry: false;
47
48
  readonly edit: false;
@@ -51,15 +52,16 @@ export declare const DEFAULT_BUBBLE_ACTIONS: {
51
52
  /**
52
53
  * The host-handler declarations — nothing declared.
53
54
  *
54
- * Same rule as {@link DEFAULT_BUBBLE_ACTIONS}, applied outside the action bar: an
55
+ * Same rule as {@link APARTE_DEFAULT_BUBBLE_ACTIONS}, applied outside the action bar: an
55
56
  * image tile you can click, a Run button, a download button on a binary artifact
56
57
  * are all requests core forwards to the app. Undeclared, they are not rendered
57
58
  * (and the tile is not even signalled as clickable) instead of doing nothing.
58
59
  */
59
- export declare const DEFAULT_HOST_HANDLERS: {
60
+ export declare const APARTE_DEFAULT_HOST_HANDLERS: {
60
61
  readonly attachmentPreview: false;
61
62
  readonly terminalRun: false;
62
63
  readonly artifactRedownload: false;
64
+ readonly artifactRehydrate: false;
63
65
  };
64
66
  export interface AparteModelPreference {
65
67
  provider: string;
@@ -97,10 +99,10 @@ export type AparteStreamingMarkdownProvider = (target: HTMLElement) => AparteStr
97
99
  * Core ships only a CDN-free fallback (svg/css/html/js render offline; other
98
100
  * kinds degrade to a read-only code view), so the engine stays zero-network and
99
101
  * framework-agnostic. The app opts into richer previews via
100
- * {@link AparteConfigClass.setArtifactPreviewBuilder}.
102
+ * {@link AparteConfig.setArtifactPreviewBuilder}.
101
103
  */
102
104
  export type AparteArtifactPreviewBuilder = (kind: string, body: string, title: string) => string;
103
- export declare class AparteConfigClass {
105
+ export declare class AparteConfig {
104
106
  private _markdownProvider?;
105
107
  private _streamingMarkdownProvider?;
106
108
  private _highlightProvider?;
@@ -121,13 +123,33 @@ export declare class AparteConfigClass {
121
123
  private _actions;
122
124
  private _listeners;
123
125
  private _aiProviders;
126
+ /**
127
+ * What `refreshProviderModels()` last brought back, per provider.
128
+ *
129
+ * Without it, `getCurrentModel()` read `provider.getModels()` only — the
130
+ * SYNCHRONOUS, hand-declared list, which every preset of
131
+ * `@aparte/provider-openai-compat` leaves empty because a compat endpoint's
132
+ * list is fetched at runtime. So the current model resolved to `undefined`
133
+ * for the documented primary path, and everything that reads a capability off
134
+ * it silently got nothing: `AparteClient._toolsForCurrentModel()` gates tools
135
+ * on `capabilities.includes('function_calling')`, so NO tool was ever sent to
136
+ * the model. A registered tool, an approval gate, `<aparte-elicitation>` — all
137
+ * dead, with the model answering, correctly, that it had been given no tools.
138
+ */
139
+ private _fetchedModels;
124
140
  private _modelConfig;
125
141
  /** Opt-in: gate the composer (block send + grey out) until a model is selected. */
126
142
  private _requireModelSelection;
143
+ /** Host policy for the elicitation panel's free-text escape — see {@link setElicitationOptions}. */
144
+ private _elicitationAllowOther;
145
+ private _elicitationLayout;
146
+ private _elicitationFieldRenderer?;
127
147
  private _transport;
128
148
  private _modelPreferenceProvider?;
129
149
  private _conversationManager?;
130
150
  private _elicitationPresenter?;
151
+ /** Warn once per config, not once per request — a tool loop can ask repeatedly. */
152
+ private _warnedNoPresenter;
131
153
  private _tools;
132
154
  private _toolRenderers;
133
155
  private _hostHandlers;
@@ -149,15 +171,15 @@ export declare class AparteConfigClass {
149
171
  setActionHidden(id: string, hidden: boolean): void;
150
172
  /**
151
173
  * Configure which action buttons appear in message bubbles.
152
- * Unset keys keep their defaults — see {@link DEFAULT_BUBBLE_ACTIONS}: `copy`
174
+ * Unset keys keep their defaults — see {@link APARTE_DEFAULT_BUBBLE_ACTIONS}: `copy`
153
175
  * only, because every other button needs a host to honor it.
154
176
  *
155
177
  * @example
156
- * AparteConfig.setBubbleActions({ retry: true, edit: true }) // you run AparteClient
157
- * AparteConfig.setBubbleActions({ feedback: true }) // you listen for aparte-feedback
158
- * AparteConfig.setBubbleActions({ copy: false }) // hide everything
178
+ * aparteGlobalConfig.setBubbleActions({ retry: true, edit: true }) // you run AparteClient
179
+ * aparteGlobalConfig.setBubbleActions({ feedback: true }) // you listen for aparte-feedback
180
+ * aparteGlobalConfig.setBubbleActions({ copy: false }) // hide everything
159
181
  * // Explicit per-role ordered sets (replace the flag defaults for that role):
160
- * AparteConfig.setBubbleActions({ user: ['edit', 'copy'], assistant: ['copy', 'thumbUp', 'thumbDown', 'retry'] })
182
+ * aparteGlobalConfig.setBubbleActions({ user: ['edit', 'copy'], assistant: ['copy', 'thumbUp', 'thumbDown', 'retry'] })
161
183
  */
162
184
  setBubbleActions(config: AparteBubbleActionsConfig): void;
163
185
  /**
@@ -165,15 +187,11 @@ export declare class AparteConfigClass {
165
187
  * trigger only for the ones you claim — see {@link AparteHostHandlersConfig}.
166
188
  *
167
189
  * @example
168
- * AparteConfig.setHostHandlers({ attachmentPreview: true, terminalRun: true });
190
+ * aparteGlobalConfig.setHostHandlers({ attachmentPreview: true, terminalRun: true });
169
191
  */
170
192
  setHostHandlers(config: AparteHostHandlersConfig): void;
171
193
  /** Returns the resolved host-handler declarations (undeclared = false). */
172
- getHostHandlers(): {
173
- attachmentPreview: boolean;
174
- terminalRun: boolean;
175
- artifactRedownload: boolean;
176
- };
194
+ getHostHandlers(): Required<AparteHostHandlersConfig>;
177
195
  /** Returns the resolved bubble actions config (flag defaults applied; per-role sets passed through). */
178
196
  getBubbleActions(): {
179
197
  copy: boolean;
@@ -222,7 +240,7 @@ export declare class AparteConfigClass {
222
240
  * hardened coverage, or `null` to DISABLE sanitization. Disabling exposes
223
241
  * you to XSS from LLM-authored content — only do so for content you fully
224
242
  * trust and have already sanitized upstream.
225
- * @example AparteConfig.setHtmlSanitizer((html) => DOMPurify.sanitize(html));
243
+ * @example aparteGlobalConfig.setHtmlSanitizer((html) => DOMPurify.sanitize(html));
226
244
  */
227
245
  setHtmlSanitizer(sanitizer: AparteSanitizer | null): void;
228
246
  /**
@@ -271,7 +289,7 @@ export declare class AparteConfigClass {
271
289
  getArtifactPreviewBuilder(): AparteArtifactPreviewBuilder | undefined;
272
290
  /**
273
291
  * The icon set as a **complete** provider: every name resolves, falling back
274
- * to `DEFAULT_ICON_FALLBACKS` for anything the registered provider doesn't
292
+ * to `APARTE_DEFAULT_ICON_FALLBACKS` for anything the registered provider doesn't
275
293
  * implement. Callers (bubble action bar, composer controls) can therefore
276
294
  * invoke `icons.copy()` unconditionally.
277
295
  *
@@ -343,9 +361,9 @@ export declare class AparteConfigClass {
343
361
  */
344
362
  setLocale(locale: AparteLocale): void;
345
363
  /**
346
- * Restore the built-in English locale (the same `DEFAULT_LOCALE` core ships
364
+ * Restore the built-in English locale (the same `APARTE_DEFAULT_LOCALE` core ships
347
365
  * with). Counterpart of {@link setLocale} for language toggles — avoids
348
- * having to import `DEFAULT_LOCALE` yourself.
366
+ * having to import `APARTE_DEFAULT_LOCALE` yourself.
349
367
  */
350
368
  resetLocale(): void;
351
369
  /**
@@ -381,8 +399,8 @@ export declare class AparteConfigClass {
381
399
  * Register one or more AI providers (e.g., OpenRouter, Gemini, Anthropic)
382
400
  * @param providers AparteAIProvider implementations
383
401
  * @example
384
- * AparteConfig.registerAIProvider(OpenRouterProvider);
385
- * AparteConfig.registerAIProvider(GeminiProvider, AnthropicProvider);
402
+ * aparteGlobalConfig.registerAIProvider(OpenRouterProvider);
403
+ * aparteGlobalConfig.registerAIProvider(GeminiProvider, AnthropicProvider);
386
404
  */
387
405
  registerAIProvider(...providers: AparteAIProvider[]): void;
388
406
  /**
@@ -400,18 +418,18 @@ export declare class AparteConfigClass {
400
418
  getAIProvider(id: string): AparteAIProvider | undefined;
401
419
  /**
402
420
  * Set the transport that decides where chat requests go and how auth is
403
- * handled. Defaults to {@link DirectTransport} (browser-direct — BYOK/local).
404
- * Use a `BackendTransport` to keep API keys server-side (recommended for
421
+ * handled. Defaults to {@link AparteDirectTransport} (browser-direct — BYOK/local).
422
+ * Use a `AparteBackendTransport` to keep API keys server-side (recommended for
405
423
  * production).
406
424
  */
407
425
  setTransport(transport: AparteTransport): void;
408
- /** Get the active transport (DirectTransport by default). */
426
+ /** Get the active transport (AparteDirectTransport by default). */
409
427
  getTransport(): AparteTransport;
410
428
  /**
411
429
  * Register a model preference provider for agnostic persistence.
412
430
  * The host app decides how/where to store the selected provider & model.
413
431
  * @example
414
- * AparteConfig.setModelPreferenceProvider({
432
+ * aparteGlobalConfig.setModelPreferenceProvider({
415
433
  * save: (p, m) => localStorage.setItem('model', JSON.stringify({p, m})),
416
434
  * load: () => JSON.parse(localStorage.getItem('model') ?? 'null')
417
435
  * });
@@ -448,6 +466,48 @@ export declare class AparteConfigClass {
448
466
  * still fetching its list). Off by default so single-model / backend setups
449
467
  * that never select a model are unaffected.
450
468
  */
469
+ /**
470
+ * Elicitation policy: whether a choice offers a free-text "Other…" escape.
471
+ *
472
+ * This is the HOST's decision, not the model's. `ask_user` used to carry an
473
+ * `allow_other` field in the schema it hands the model, which meant the model
474
+ * decided your UX — and a small model fills a field it does not understand: one
475
+ * sent two questions with `allow_other: true` and no options at all, so the
476
+ * panel rendered a radio list whose only entry was "Other…", twice.
477
+ *
478
+ * Every serious implementation of this pattern makes the escape hatch a property
479
+ * of the surface rather than of the request. Default `true`, which is what the
480
+ * panel did before, so nothing a user sees changes — only who gets to say so.
481
+ * A direct `requestUserInput` caller can still set `allowOther` per field; that
482
+ * is the app talking, and it wins.
483
+ *
484
+ * `layout` decides how a form of SEVERAL questions is presented.
485
+ * `'stepped'` (default) asks them one at a time with a chip per question;
486
+ * `'stacked'` puts them all in the panel at once. Stacked was the only shape,
487
+ * inherited unexamined from MCP elicitation — which describes a FORM for
488
+ * collecting structured data, not two different questions asked mid-conversation.
489
+ * No product asks a person two questions by stacking them in one box; it is kept
490
+ * as an option because the form case is real, not because it was the right default.
491
+ */
492
+ setElicitationOptions(options: {
493
+ allowOther?: boolean;
494
+ layout?: 'stepped' | 'stacked';
495
+ }): void;
496
+ /** The elicitation policy (see {@link setElicitationOptions}). */
497
+ getElicitationOptions(): {
498
+ allowOther: boolean;
499
+ layout: 'stepped' | 'stacked';
500
+ };
501
+ /**
502
+ * Render one field of the question panel yourself.
503
+ *
504
+ * See {@link AparteElicitationFieldRenderer}. Return `null` for a field to let
505
+ * the built-in render it, which is what makes overriding a single kind practical.
506
+ * Pass `null` here to remove the renderer.
507
+ */
508
+ setElicitationFieldRenderer(fn: AparteElicitationFieldRenderer | null): void;
509
+ /** The custom field renderer, if one is registered. */
510
+ getElicitationFieldRenderer(): AparteElicitationFieldRenderer | undefined;
451
511
  setRequireModelSelection(required: boolean): void;
452
512
  /** Whether the composer should gate on model selection (see {@link setRequireModelSelection}). */
453
513
  getRequireModelSelection(): boolean;
@@ -481,7 +541,7 @@ export declare class AparteConfigClass {
481
541
  * Register a tool and its handler together.
482
542
  * The handler is called when the AI invokes the tool during streaming.
483
543
  * @example
484
- * AparteConfig.registerTool(askQuestionTool, askQuestionHandler);
544
+ * aparteGlobalConfig.registerTool(askUserTool, askUserHandler);
485
545
  */
486
546
  registerTool(tool: AparteTool, handler: AparteToolHandler): void;
487
547
  /** Unregister a tool by name */
@@ -496,12 +556,12 @@ export declare class AparteConfigClass {
496
556
  * Use this instead of the generic `tool_call` segment renderer for tool-specific UI.
497
557
  *
498
558
  * @example
499
- * // Hide the segment entirely (UI-only tool like ask_question)
500
- * AparteConfig.registerToolRenderer('ask_question', { render: () => '' });
559
+ * // Hide the segment entirely (UI-only tool like ask_user)
560
+ * aparteGlobalConfig.registerToolRenderer('ask_user', { render: () => '' });
501
561
  *
502
562
  * @example
503
563
  * // Custom pill for a web-search tool
504
- * AparteConfig.registerToolRenderer('web_search', { render: (seg) => `<div class="tool-pill">Searching...</div>` });
564
+ * aparteGlobalConfig.registerToolRenderer('web_search', { render: (seg) => `<div class="tool-pill">Searching...</div>` });
505
565
  */
506
566
  registerToolRenderer(toolName: string, renderer: AparteToolRenderer): void;
507
567
  /** Unregister a per-tool renderer */
@@ -509,12 +569,12 @@ export declare class AparteConfigClass {
509
569
  /** Get the renderer for a specific tool name. Returns undefined if none registered. */
510
570
  getToolRenderer(toolName: string): AparteToolRenderer | undefined;
511
571
  /**
512
- * Register a ConversationManager so any UI controller can persist & load
572
+ * Register a AparteConversationManager so any UI controller can persist & load
513
573
  * conversations without coupling to a framework wrapper.
514
574
  */
515
- setConversationManager(manager: ConversationManager): void;
516
- /** Returns the registered ConversationManager, or undefined if none. */
517
- getConversationManager(): ConversationManager | undefined;
575
+ setConversationManager(manager: AparteConversationManager): void;
576
+ /** Returns the registered AparteConversationManager, or undefined if none. */
577
+ getConversationManager(): AparteConversationManager | undefined;
518
578
  /**
519
579
  * Register the presenter that renders typed input requests (a choice, a
520
580
  * confirmation, a text field, a form) and resolves with the user's answer.
@@ -526,11 +586,18 @@ export declare class AparteConfigClass {
526
586
  getElicitationPresenter(): AparteElicitationPresenter | undefined;
527
587
  /**
528
588
  * Ask the user for typed input mid-run and await their response. This is the
529
- * generic primitive behind `ask_question` and tool approval — the KIND of
589
+ * generic primitive behind `ask_user` and tool approval — the KIND of
530
590
  * question is the schema, not a bespoke tool. Resolves `accept` with the
531
591
  * value, `decline` when the user declines, or `cancel` when the turn is
532
- * cancelled. With no presenter registered it resolves `cancel` (nothing can
533
- * present it) rather than hanging.
592
+ * cancelled.
593
+ *
594
+ * With NO presenter registered it resolves `cancel` rather than hanging — and
595
+ * warns, once, because that `cancel` is otherwise a lie told quietly. The
596
+ * model reads it as "the user refused"; the user was never asked, and the
597
+ * developer sees nothing at all. The default presenter is
598
+ * `<aparte-elicitation>`, which registers itself from its `connectedCallback`
599
+ * — so it has to be IN THE DOM. A docs page of ours claimed it "installs
600
+ * itself — nothing to register", which is how this failure mode was found.
534
601
  */
535
602
  requestUserInput(request: AparteElicitationRequest): Promise<AparteElicitationResult>;
536
603
  /**
@@ -543,11 +610,27 @@ export declare class AparteConfigClass {
543
610
  private _defaultMarkdownRenderer;
544
611
  private _defaultHighlightRenderer;
545
612
  private _defaultSkeletonRenderer;
546
- private _escapeHtml;
547
613
  }
548
614
  /**
549
615
  * Global configuration singleton for Aparte.
550
616
  * Use this to register providers and configure behavior.
551
617
  */
552
- export declare const AparteConfig: AparteConfigClass;
618
+ export declare const aparteGlobalConfig: AparteConfig;
619
+ /**
620
+ * Detail payload for `aparte-config-change`, dispatched on `window` whenever any
621
+ * provider, locale, action or model setting changes.
622
+ *
623
+ * Five core components listen for it — the widest listener footprint of any event
624
+ * that had no declared type. `config` is what makes per-instance config work: a
625
+ * component resolving to a different instance compares it and skips the rebuild
626
+ * instead of every chat on the page reacting to every config's change.
627
+ *
628
+ * @event aparte-config-change
629
+ */
630
+ export interface AparteConfigChangeEventDetail {
631
+ /** The config instance that changed — compare against your own before reacting. */
632
+ config: AparteConfig;
633
+ /** Its model configuration, after the change. */
634
+ modelConfig: AparteModelConfig;
635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B,GAAG,SAAS;IAI3D;;;;;;;;;;;;OAYG;IACH,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAI1E,qCAAqC;IACrC,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAI9C,uFAAuF;IACvF,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAQjE;;;OAGG;IACH,sBAAsB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAIhE,8EAA8E;IAC9E,sBAAsB,IAAI,yBAAyB,GAAG,SAAS;IAQ/D;;;;;OAKG;IACH,uBAAuB,CAAC,SAAS,EAAE,0BAA0B,GAAG,IAAI,GAAG,IAAI;IAI3E,kEAAkE;IAClE,uBAAuB,IAAI,0BAA0B,GAAG,SAAS;IAIjE;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAkBrF;;;;;OAKG;IACH,KAAK,IAAI,IAAI;IAyCb,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,wBAAwB;CAcnC;AAoCD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,cAAoB,CAAC;AAKpD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,6BAA6B;IAC1C,mFAAmF;IACnF,MAAM,EAAE,YAAY,CAAC;IACrB,iDAAiD;IACjD,WAAW,EAAE,iBAAiB,CAAC;CAClC"}
@@ -14,7 +14,7 @@ import type { AparteAttachment } from '../types/models.js';
14
14
  * clicks your own way.
15
15
  *
16
16
  * @example
17
- * AparteConfig.setAttachmentRenderer((att) => {
17
+ * aparteGlobalConfig.setAttachmentRenderer((att) => {
18
18
  * if (att.type === 'application/pdf') {
19
19
  * const el = document.createElement('div');
20
20
  * el.className = 'my-pdf-chip';
@@ -8,7 +8,7 @@
8
8
  * mounted via createComponent (Angular), createRoot (React), etc.
9
9
  *
10
10
  * @example
11
- * AparteConfig.setAvatarProvider({
11
+ * aparteGlobalConfig.setAvatarProvider({
12
12
  * render: (role, host) => {
13
13
  * if (role === 'assistant') {
14
14
  * const ref = createComponent(MascotComponent, { hostElement: host });
@@ -1,47 +1,102 @@
1
1
  /**
2
2
  * Per-instance config resolution (Phase 2, step 1 — the seam only).
3
3
  *
4
- * `AparteConfig` is a global singleton: one config for the whole page. That makes
4
+ * `aparteGlobalConfig` is a page-wide singleton: one config for the whole page. That makes
5
5
  * two independent chats on one page impossible (changing the model of one
6
6
  * changes the other) and couples every component to global state.
7
7
  *
8
8
  * This module adds an OPTIONAL instance boundary without touching behaviour:
9
- * a host element can carry its own {@link AparteConfigClass} instance, and any
9
+ * a host element can carry its own {@link AparteConfig} instance, and any
10
10
  * component resolves "its" config by walking up to the nearest such host —
11
11
  * falling back to the global singleton when there is none. Until a caller
12
12
  * attaches an instance config, `resolveConfig` always returns the global, so
13
13
  * single-chat apps are unaffected.
14
14
  *
15
- * Step 2 migrates the ~23 component read-sites from `AparteConfig.x()` to
15
+ * Step 2 migrates the ~23 component read-sites from `aparteGlobalConfig.x()` to
16
16
  * `resolveConfig(this).x()`. This step just ships the mechanism + tests.
17
17
  */
18
- import { AparteConfigClass } from './aparte-config.js';
18
+ import { AparteConfig } from './aparte-config.js';
19
19
  /** Marks an element as an instance-config boundary (used by `closest()`). */
20
20
  export declare const APARTE_HOST_ATTR = "data-aparte-host";
21
+ /**
22
+ * Implemented by an element that REGISTERS something on its config rather than
23
+ * only reading from it — an elicitation presenter, a renderer, a listener keyed
24
+ * on the config object.
25
+ *
26
+ * Reading is safe without this hook: `resolveConfig(this)` at every use site
27
+ * always sees the current boundary. WRITING is not. A write happens once, into
28
+ * whichever config was resolvable at that moment — and under all four wrappers
29
+ * that moment is *before* the boundary exists, because `AparteChatHost.bind()`
30
+ * runs from a post-mount hook. So the write lands on the global singleton and
31
+ * the instance config never gets it.
32
+ *
33
+ * That is not hypothetical: `<aparte-elicitation>` registered its presenter at
34
+ * connect, so under every wrapper `requestUserInput()` found no presenter on the
35
+ * instance config and answered the model `cancel` — the model was told the user
36
+ * refused while the user was shown nothing at all.
37
+ *
38
+ * Implement this and re-do the registration: move it off `previous`, put it on
39
+ * `next`. Both {@link attachConfig} and {@link detachConfig} call it, so the same
40
+ * method handles teardown, which is where the mirror-image leak lived.
41
+ */
42
+ export interface AparteConfigAware {
43
+ aparteConfigChanged(next: AparteConfig, previous: AparteConfig): void;
44
+ }
21
45
  /**
22
46
  * Attach an instance config to `el`, making it a resolution boundary: every
23
47
  * component inside `el` resolves to `config` instead of the global singleton.
24
48
  * Idempotent; pass the same element to replace its config.
49
+ *
50
+ * Anything already mounted inside `el` that implements {@link AparteConfigAware}
51
+ * is told, because attaching a boundary silently rewrites what those children
52
+ * resolve to and a registration they already made is now on the wrong object.
25
53
  */
26
- export declare function attachConfig(el: HTMLElement, config: AparteConfigClass): void;
54
+ export declare function attachConfig(el: HTMLElement, config: AparteConfig): void;
27
55
  /**
28
56
  * Remove the instance-config boundary from `el` (e.g. in `disconnectedCallback`).
29
57
  * Components under `el` fall back to the next boundary up, or the global.
58
+ *
59
+ * Registrants are told BEFORE they would silently re-resolve elsewhere, which is
60
+ * the half that leaked: a wrapper's `unbind()` detaches the boundary before the
61
+ * framework removes the DOM, so by the time `disconnectedCallback` ran, the
62
+ * element's own `resolveConfig(this)` already returned the global — its
63
+ * "am I still the registered one?" guard compared against the wrong config, found
64
+ * no match, and left the instance config holding a removed element for good.
30
65
  */
31
66
  export declare function detachConfig(el: HTMLElement): void;
32
67
  /**
33
68
  * Resolve the config governing `el`: the nearest ancestor boundary's instance
34
- * config (including `el` itself), or the global {@link AparteConfig} when none is
35
- * present. Cheap — a single `closest()` — but callers should cache the result at
36
- * `connectedCallback` rather than call it per render.
69
+ * config (including `el` itself), or {@link aparteGlobalConfig} when none is
70
+ * present. Cheap — a single `closest()`.
71
+ *
72
+ * DO NOT cache this at `connectedCallback`. An earlier version of this comment
73
+ * advised exactly that, and two elements followed it into a real bug: a framework
74
+ * wrapper calls `AparteChatHost.bind()` — which is what runs `attachConfig` — from
75
+ * its POST-mount hook (React `useEffect`, Vue `onMounted`, Svelte `onMount`,
76
+ * Angular `ngAfterViewInit`), so children mounted in the same commit connect
77
+ * BEFORE the boundary exists. A connect-time cache therefore freezes the global
78
+ * config forever, and the `config` prop every wrapper advertises silently does
79
+ * nothing for that element.
80
+ *
81
+ * Resolve it live, in a getter. `closest()` on a shallow tree is not a cost worth
82
+ * a correctness bug — `aparte-chat-bubble` has done it that way from the start, and
83
+ * it is the one element that was never affected.
84
+ *
85
+ * That advice covers READERS, and it is not enough on its own. An element that
86
+ * WRITES to its config — registering a presenter, a renderer, a keyed listener —
87
+ * cannot fix the ordering by resolving live, because the write already happened.
88
+ * Those implement {@link AparteConfigAware} and re-register when told. The
89
+ * reader/writer distinction is the one this file missed the first time round: the
90
+ * sweep that applied the advice above fixed every reader and left both writers
91
+ * broken.
37
92
  */
38
- export declare function resolveConfig(el: Element | null | undefined): AparteConfigClass;
93
+ export declare function resolveConfig(el: Element | null | undefined): AparteConfig;
39
94
  /** Run `fn` with `config` as the ambient render config (restored after). */
40
- export declare function runWithConfig<T>(config: AparteConfigClass, fn: () => T): T;
95
+ export declare function runWithConfig<T>(config: AparteConfig, fn: () => T): T;
41
96
  /**
42
97
  * The ambient render config set by {@link runWithConfig}, else the config
43
98
  * resolved from `el` (when provided), else the global singleton. Capture it
44
99
  * synchronously at the top of a renderer — never after an `await`.
45
100
  */
46
- export declare function contextConfig(el?: Element | null): AparteConfigClass;
101
+ export declare function contextConfig(el?: Element | null): AparteConfig;
47
102
  //# sourceMappingURL=config-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-context.d.ts","sourceRoot":"","sources":["../../src/config/config-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAgB,iBAAiB,EAAE,MAAM,oBAA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AG,SAAS,GAAG,YAAY,CAG1E;AAWD,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQrE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,YAAY,CAE/D"}
@@ -0,0 +1,73 @@
1
+ import type { AparteElicitationField } from '../elicitation/types.js';
2
+ /**
3
+ * What the panel gives a custom field renderer.
4
+ */
5
+ export interface AparteElicitationFieldContext {
6
+ /**
7
+ * The form key this field answers, in an object (multi-question) schema.
8
+ * `undefined` for a single-field request, where the panel's message is the
9
+ * question.
10
+ */
11
+ readonly key?: string;
12
+ /**
13
+ * Call whenever your field's value changes.
14
+ *
15
+ * The panel re-reads `isComplete()` on every change to enable or disable the
16
+ * send button — a field that never notifies is a field whose answer can never
17
+ * be submitted.
18
+ */
19
+ notifyChange(): void;
20
+ }
21
+ /**
22
+ * A field you rendered, and the three things the panel needs from it.
23
+ */
24
+ export interface AparteElicitationFieldControl {
25
+ /** The element to place in the panel. */
26
+ readonly el: HTMLElement;
27
+ /** The current answer, shaped as the field's schema kind implies. */
28
+ getValue(): unknown;
29
+ /** Whether the answer is usable — gates the send button. */
30
+ isComplete(): boolean;
31
+ /** Focus the input. Called when the panel opens on this field. */
32
+ focus?(): void;
33
+ }
34
+ /**
35
+ * Elicitation Field Renderer
36
+ *
37
+ * Replace ONE field of the question panel — a choice, a yes/no, a free-text answer
38
+ * — while the panel keeps everything around it: placement in the composer, the
39
+ * accept/decline/cancel contract, the send-button gating, focus, and the teardown
40
+ * when a turn is stopped.
41
+ *
42
+ * Until this existed the surface was all-or-nothing: the built-in panel, or
43
+ * `setElicitationPresenter` and you reimplemented every one of those. Every other
44
+ * customisation point in this library is a hook (charter §6), and this one was
45
+ * missing.
46
+ *
47
+ * Return `null` to let the built-in render that field, which is what makes it
48
+ * practical to override a single kind:
49
+ *
50
+ * @example
51
+ * aparteGlobalConfig.setElicitationFieldRenderer((field, ctx) => {
52
+ * if (field.type !== 'enum') return null; // built-in handles the rest
53
+ * const el = document.createElement('div');
54
+ * el.className = 'my-chips';
55
+ * let picked = '';
56
+ * for (const opt of field.options) {
57
+ * const b = document.createElement('button');
58
+ * b.type = 'button';
59
+ * b.textContent = opt.label ?? opt.value;
60
+ * b.onclick = () => { picked = opt.value; ctx.notifyChange(); };
61
+ * el.appendChild(b);
62
+ * }
63
+ * return { el, getValue: () => picked, isComplete: () => picked !== '' };
64
+ * });
65
+ *
66
+ * **Why this returns a control and not `string | HTMLElement`** like the render
67
+ * hooks in charter §6: a field has to hand back a VALUE. A hook that must also read
68
+ * the user's input is a control, not a decoration, and pretending otherwise would
69
+ * mean the panel scraping your markup for inputs by convention — which is a
70
+ * contract that breaks silently the first time someone styles it differently.
71
+ */
72
+ export type AparteElicitationFieldRenderer = (field: AparteElicitationField, ctx: AparteElicitationFieldContext) => AparteElicitationFieldControl | null;
73
+ //# sourceMappingURL=elicitation-field-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elicitation-field-renderer.d.ts","sourceRoot":"","sources":["../../src/config/elicitation-field-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,YAAY,IAAI,IAAI,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC1C,yCAAyC;IACzC,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IACzB,qEAAqE;IACrE,QAAQ,IAAI,OAAO,CAAC;IACpB,4DAA4D;IAC5D,UAAU,IAAI,OAAO,CAAC;IACtB,kEAAkE;IAClE,KAAK,CAAC,IAAI,IAAI,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,MAAM,8BAA8B,GAAG,CACzC,KAAK,EAAE,sBAAsB,EAC7B,GAAG,EAAE,6BAA6B,KACjC,6BAA6B,GAAG,IAAI,CAAC"}
@@ -10,7 +10,7 @@
10
10
  * on its `.aparte-message` while an error segment is present, for CSS theming.
11
11
  *
12
12
  * @example
13
- * AparteConfig.setErrorRenderer(({ message }) => {
13
+ * aparteGlobalConfig.setErrorRenderer(({ message }) => {
14
14
  * const el = document.createElement('div');
15
15
  * el.className = 'my-error';
16
16
  * el.textContent = `Something went wrong: ${message}`;
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @example
8
8
  * // Register an icon provider (e.g. a FontAwesome bridge)
9
- * AparteConfig.setIconProvider({
9
+ * aparteGlobalConfig.setIconProvider({
10
10
  * copy: () => '<i class="fas fa-copy"></i>',
11
11
  * check: () => '<i class="fas fa-check"></i>',
12
12
  * // ...
@@ -59,5 +59,5 @@ export interface AparteIconProvider {
59
59
  /** Icon names available in the provider */
60
60
  export type AparteIconName = keyof AparteIconProvider;
61
61
  /** Default textual fallbacks - zero dependency */
62
- export declare const DEFAULT_ICON_FALLBACKS: Record<AparteIconName, string>;
62
+ export declare const APARTE_DEFAULT_ICON_FALLBACKS: Record<AparteIconName, string>;
63
63
  //# sourceMappingURL=icon-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon-provider.d.ts","sourceRoot":"","sources":["../../src/config/icon-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IAM/B,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,MAAM,CAAC;IACpB,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;IACrB,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,MAAM,CAAC;IACpB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,MAAM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