@aparte/core 0.16.11 → 0.17.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.
- package/README.md +6 -0
- package/dist/client/aparte-client.d.ts +42 -3
- package/dist/client/aparte-client.d.ts.map +1 -1
- package/dist/components/bubble/aparte-chat-bubble.d.ts +22 -0
- package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
- package/dist/components/chat/aparte-chat.d.ts +33 -0
- package/dist/components/chat/aparte-chat.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-action.d.ts +5 -3
- package/dist/components/composer/aparte-composer-action.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-toolbar.d.ts +5 -2
- package/dist/components/composer/aparte-composer-toolbar.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer.d.ts +27 -0
- package/dist/components/composer/aparte-composer.d.ts.map +1 -1
- package/dist/components/context/aparte-context.d.ts +8 -0
- package/dist/components/context/aparte-context.d.ts.map +1 -1
- package/dist/components/conversation-list/aparte-conversation-list.d.ts +82 -17
- package/dist/components/conversation-list/aparte-conversation-list.d.ts.map +1 -1
- package/dist/components/scroll-rail/aparte-scroll-rail.d.ts.map +1 -1
- package/dist/components/sidebar/aparte-sidebar.d.ts.map +1 -1
- package/dist/components/split/aparte-split.d.ts.map +1 -1
- package/dist/components/suggestions/aparte-suggestions.d.ts +10 -1
- package/dist/components/suggestions/aparte-suggestions.d.ts.map +1 -1
- package/dist/components/viewport/aparte-chat-viewport.d.ts +55 -1
- package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
- package/dist/config/action-provider.d.ts +14 -14
- package/dist/config/action-provider.d.ts.map +1 -1
- package/dist/config/aparte-config.d.ts +82 -13
- package/dist/config/aparte-config.d.ts.map +1 -1
- package/dist/config/bubble-shell-renderer.d.ts +50 -12
- package/dist/config/bubble-shell-renderer.d.ts.map +1 -1
- package/dist/config/locale.d.ts +33 -1
- package/dist/config/locale.d.ts.map +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/conversations/conversation-controller.d.ts +14 -0
- package/dist/conversations/conversation-controller.d.ts.map +1 -1
- package/dist/conversations/conversation-manager.d.ts +57 -19
- package/dist/conversations/conversation-manager.d.ts.map +1 -1
- package/dist/conversations/types.d.ts +18 -11
- package/dist/conversations/types.d.ts.map +1 -1
- package/dist/custom-elements.json +10818 -10062
- package/dist/{dialog-triggers-cYGTlfZf.js → dialog-triggers-Bb-3EkT4.js} +591 -161
- package/dist/dialog-triggers-Bb-3EkT4.js.map +1 -0
- package/dist/generated/element-attributes.d.ts +10 -4
- package/dist/generated/element-attributes.d.ts.map +1 -1
- package/dist/host/aparte-chat-host.d.ts +30 -0
- package/dist/host/aparte-chat-host.d.ts.map +1 -1
- package/dist/index.css +1 -8393
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +550 -98
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +1 -1
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +1 -1
- package/dist/index.node.js.map +1 -1
- package/dist/interop/element-props.d.ts +1 -1
- package/dist/primitives/select/aparte-optgroup.d.ts +1 -0
- package/dist/primitives/select/aparte-optgroup.d.ts.map +1 -1
- package/dist/primitives/select/aparte-select.d.ts +12 -1
- package/dist/primitives/select/aparte-select.d.ts.map +1 -1
- package/dist/renderers/markdown-stream.d.ts.map +1 -1
- package/dist/runtime/message-repository.d.ts +16 -3
- package/dist/runtime/message-repository.d.ts.map +1 -1
- package/dist/types/chat.d.ts +41 -46
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/event-map.d.ts +7 -7
- package/dist/types/event-map.d.ts.map +1 -1
- package/dist/types/events.d.ts +7 -6
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/imperative-api.d.ts +16 -0
- package/dist/types/imperative-api.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/models.d.ts +9 -0
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/segments.d.ts +56 -13
- package/dist/types/segments.d.ts.map +1 -1
- package/dist/utils/event-target.d.ts +31 -0
- package/dist/utils/event-target.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/dialog-triggers-cYGTlfZf.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/types/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAMnD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,CAAC;AAMhG,mDAAmD;AACnD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,CAAC;AAMpD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IAEX,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IAEb,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IAEb,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAC;IAEZ,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;CACf;AAUD;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAChC,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,oBAA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M,uBAAuB,EAAE,OAAO,MAA6C,CAAC"}
|
package/dist/types/segments.d.ts
CHANGED
|
@@ -10,6 +10,22 @@ export interface AparteSegmentBase {
|
|
|
10
10
|
type: string;
|
|
11
11
|
/** Whether segment is currently being streamed */
|
|
12
12
|
isStreaming?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* One sentence standing in for the segment when no renderer claims its `type` —
|
|
15
|
+
* DRAWN for every type, not only for `custom`.
|
|
16
|
+
*
|
|
17
|
+
* It is the answer to a real moment: a conversation replayed in another app, a
|
|
18
|
+
* client that loads its views lazily, an export. Core draws it as text (no markup)
|
|
19
|
+
* under `.aparte-segment-fallback`. Supplying one also silences the "no renderer"
|
|
20
|
+
* developer warning: an author who wrote a fallback has already said this can happen.
|
|
21
|
+
*
|
|
22
|
+
* In the HISTORY sent back to the model it stands in for the segment only where core
|
|
23
|
+
* does not serialise the type itself — `custom`, and any type core does not know (a
|
|
24
|
+
* registered block grammar's, a plugin's). A `text` or a `code` segment contributes
|
|
25
|
+
* its `content` and nothing else; `thinking` and `tool_call` are left out of the history
|
|
26
|
+
* on purpose (`_segmentsToText` in `AparteClient` states why), and so is `error`.
|
|
27
|
+
*/
|
|
28
|
+
fallback?: string;
|
|
13
29
|
/** Id of the message this segment belongs to. Stamped on insertion. */
|
|
14
30
|
messageId?: string;
|
|
15
31
|
/**
|
|
@@ -89,7 +105,14 @@ export interface AparteTextSegment extends AparteSegmentBase {
|
|
|
89
105
|
*/
|
|
90
106
|
export type AparteSegmentDefaults = Readonly<Record<string, unknown>>;
|
|
91
107
|
/**
|
|
92
|
-
* Thinking/reasoning segment - collapsible
|
|
108
|
+
* Thinking/reasoning segment - collapsible.
|
|
109
|
+
*
|
|
110
|
+
* A literal `<think>…</think>` in a reply is read as reasoning on every path — while
|
|
111
|
+
* it streams and when the reply is restored from storage — so a message that merely
|
|
112
|
+
* quotes the tag in its prose becomes this segment rather than text; and reasoning is
|
|
113
|
+
* deliberately not sent back to the model, so those words leave the wire history with
|
|
114
|
+
* it. Models whose reasoning is marked differently are handled by the parser's
|
|
115
|
+
* `thinkingDelimiters`.
|
|
93
116
|
*
|
|
94
117
|
* @example
|
|
95
118
|
* // No `collapsed` key, so it renders CLOSED — see the field's own note below.
|
|
@@ -186,27 +209,47 @@ export interface AparteToolCallSegment extends AparteSegmentBase {
|
|
|
186
209
|
structuredResult?: unknown;
|
|
187
210
|
}
|
|
188
211
|
/**
|
|
189
|
-
* Custom segment - for
|
|
212
|
+
* Custom segment - one escape hatch for the views an app draws itself.
|
|
213
|
+
*
|
|
214
|
+
* Renderers are keyed on `type`, so **`subType` never reaches the registry**: you
|
|
215
|
+
* register ONE renderer for `custom` and switch on `subType` inside it, with `fallback`
|
|
216
|
+
* as the default branch. Independent views take their own `type` instead — register a
|
|
217
|
+
* `chart` renderer for a chart — and `custom` is for a family of small views an app
|
|
218
|
+
* would rather keep behind one key.
|
|
190
219
|
*
|
|
191
220
|
* @example
|
|
192
|
-
*
|
|
193
|
-
* // field exists: an unknown view degrades to a sentence instead of to nothing.
|
|
194
|
-
* {
|
|
195
|
-
* id: 's1',
|
|
221
|
+
* registerSegmentRenderer<AparteCustomSegment>({
|
|
196
222
|
* type: 'custom',
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
223
|
+
* render(segment) {
|
|
224
|
+
* const data = (segment.data ?? {}) as Record<string, unknown>;
|
|
225
|
+
* const el = document.createElement('div');
|
|
226
|
+
* switch (segment.subType) {
|
|
227
|
+
* case 'weather':
|
|
228
|
+
* el.className = 'weather';
|
|
229
|
+
* el.textContent = `${data['city']} — ${data['celsius']}°C`;
|
|
230
|
+
* break;
|
|
231
|
+
* case 'poll':
|
|
232
|
+
* el.className = 'poll';
|
|
233
|
+
* el.textContent = String(data['question']);
|
|
234
|
+
* break;
|
|
235
|
+
* default:
|
|
236
|
+
* // A subType this build does not know: the sentence, not nothing.
|
|
237
|
+
* el.textContent = segment.fallback ?? '';
|
|
238
|
+
* }
|
|
239
|
+
* return el;
|
|
240
|
+
* },
|
|
241
|
+
* });
|
|
242
|
+
*
|
|
243
|
+
* // The segments that renderer draws:
|
|
244
|
+
* { id: 's1', type: 'custom', subType: 'weather', data: { city: 'Lille', celsius: 11 } }
|
|
245
|
+
* { id: 's2', type: 'custom', subType: 'gantt', fallback: 'Three tasks, ending Friday.' }
|
|
201
246
|
*/
|
|
202
247
|
export interface AparteCustomSegment extends AparteSegmentBase {
|
|
203
248
|
type: 'custom';
|
|
204
|
-
/**
|
|
249
|
+
/** Which view inside the `custom` renderer draws this segment (e.g. 'weather', 'poll', 'onboarding'). */
|
|
205
250
|
subType: string;
|
|
206
251
|
/** Arbitrary data payload for the component */
|
|
207
252
|
data?: unknown;
|
|
208
|
-
/** Optional fallback text representation */
|
|
209
|
-
fallback?: string;
|
|
210
253
|
}
|
|
211
254
|
/**
|
|
212
255
|
* All built-in segment types. An `artifact` is not one of them any more: it is a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../src/types/segments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAC9B,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IAEX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,kDAAkD;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../src/types/segments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAC9B,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IAEX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,kDAAkD;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAkBlB,uEA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C,GAAG,IAAI,CAAC;IAE/C;;;;;OAKG;IACH,MAAM,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IAEhD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IAEjD;;;OAGG;IACH,OAAO,CAAC,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;CACxC;AAMD,6DAA6D;AAC7D,MAAM,WAAW,8BAA8B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an event really started, read from a listener on `document`.
|
|
3
|
+
*
|
|
4
|
+
* An event that crosses a shadow boundary is RETARGETED on its way out: seen from
|
|
5
|
+
* outside, `event.target` is the shadow HOST, not the node that was hit. Core is light
|
|
6
|
+
* DOM, so this never bites inside core — but a consumer mounting a chat inside a shadow
|
|
7
|
+
* root of their own (their web component, a micro-frontend) is a documented
|
|
8
|
+
* arrangement, and every handler core puts on `document` then asks "was this inside
|
|
9
|
+
* me?" of the wrong element and answers no.
|
|
10
|
+
*
|
|
11
|
+
* `composedPath()[0]` is the node that was actually hit, whichever tree it lives in.
|
|
12
|
+
* The fallbacks are for the two events that have no path: one dispatched by hand with
|
|
13
|
+
* no `composed`, and one read after its dispatch has finished (the path is empty by
|
|
14
|
+
* then). Internal — not exported from the package barrel; the four callers are core's
|
|
15
|
+
* own document-level handlers.
|
|
16
|
+
*/
|
|
17
|
+
export declare function eventOrigin(e: Event): EventTarget | null;
|
|
18
|
+
/**
|
|
19
|
+
* The tree a node lives in: the consumer's shadow root when a chat is mounted inside
|
|
20
|
+
* one, the document otherwise. `document.querySelector` cannot see into a shadow tree —
|
|
21
|
+
* so a sibling looked up through it is missed, and on a page that also holds one in the
|
|
22
|
+
* light DOM it is the WRONG element that answers. Internal, like `eventOrigin`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function rootOf(node: Node): ParentNode;
|
|
25
|
+
/**
|
|
26
|
+
* The focused element as the node's own tree sees it. `document.activeElement` is
|
|
27
|
+
* retargeted to the shadow HOST exactly as `event.target` is, so "is the focus inside
|
|
28
|
+
* me?" answers no for every node sharing the node's shadow root.
|
|
29
|
+
*/
|
|
30
|
+
export declare function activeElementIn(node: Node): Element | null;
|
|
31
|
+
//# sourceMappingURL=event-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-target.d.ts","sourceRoot":"","sources":["../../src/utils/event-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,WAAW,GAAG,IAAI,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,UAAU,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,GAAG,IAAI,CAE1D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aparte/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"homepage": "https://apartejs.dev/",
|
|
5
5
|
"description": "AI chat in Web Components, with the agent loop inside — zero third-party dependencies",
|
|
6
6
|
"type": "module",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"node": ">=18"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@aparte/engine": "0.
|
|
56
|
+
"@aparte/engine": "0.17.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|