@aparte/core 0.19.2 → 0.20.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 -1
- package/dist/client/aparte-client.d.ts +76 -97
- package/dist/client/aparte-client.d.ts.map +1 -1
- package/dist/client/stream-adapter.d.ts +7 -13
- package/dist/client/stream-adapter.d.ts.map +1 -1
- package/dist/client/wire-history.d.ts +4 -5
- package/dist/client/wire-history.d.ts.map +1 -1
- package/dist/components/bubble/aparte-chat-bubble.d.ts +89 -58
- package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
- package/dist/components/bubble/bubble-sync.d.ts +1 -1
- package/dist/components/chat/aparte-chat.d.ts +15 -13
- package/dist/components/chat/aparte-chat.d.ts.map +1 -1
- package/dist/components/chat/glide-gate.d.ts +13 -0
- package/dist/components/chat/glide-gate.d.ts.map +1 -0
- package/dist/components/composer/aparte-composer-action.d.ts +3 -3
- package/dist/components/composer/aparte-composer-add-attachment.d.ts +2 -2
- package/dist/components/composer/aparte-composer-cancel.d.ts +1 -1
- package/dist/components/composer/aparte-composer-input.d.ts +4 -7
- package/dist/components/composer/aparte-composer-input.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-send.d.ts +9 -11
- package/dist/components/composer/aparte-composer-send.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer.d.ts +50 -80
- package/dist/components/composer/aparte-composer.d.ts.map +1 -1
- package/dist/components/context/aparte-context.d.ts +13 -7
- package/dist/components/context/aparte-context.d.ts.map +1 -1
- package/dist/components/conversation-list/aparte-conversation-list.d.ts +25 -13
- package/dist/components/conversation-list/aparte-conversation-list.d.ts.map +1 -1
- package/dist/components/elicitation/aparte-elicitation.d.ts +15 -22
- package/dist/components/elicitation/aparte-elicitation.d.ts.map +1 -1
- package/dist/components/scroll-rail/aparte-scroll-rail.d.ts +10 -11
- package/dist/components/scroll-rail/aparte-scroll-rail.d.ts.map +1 -1
- package/dist/components/sidebar/aparte-sidebar.d.ts +16 -3
- package/dist/components/sidebar/aparte-sidebar.d.ts.map +1 -1
- package/dist/components/split/aparte-split.d.ts +12 -3
- package/dist/components/split/aparte-split.d.ts.map +1 -1
- package/dist/components/status/aparte-chat-status.d.ts +5 -3
- package/dist/components/status/aparte-chat-status.d.ts.map +1 -1
- package/dist/components/suggestions/aparte-suggestions.d.ts +6 -9
- package/dist/components/suggestions/aparte-suggestions.d.ts.map +1 -1
- package/dist/components/viewport/aparte-chat-viewport.d.ts +76 -69
- package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
- package/dist/config/aparte-config.d.ts +169 -141
- package/dist/config/aparte-config.d.ts.map +1 -1
- package/dist/config/icon-provider.d.ts +19 -2
- package/dist/config/icon-provider.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/locale.d.ts +61 -89
- 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 +18 -3
- package/dist/conversations/conversation-controller.d.ts.map +1 -1
- package/dist/conversations/conversation-manager.d.ts +6 -6
- package/dist/conversations/conversation-manager.d.ts.map +1 -1
- package/dist/conversations/index.d.ts +1 -1
- package/dist/conversations/index.d.ts.map +1 -1
- package/dist/custom-elements.json +5656 -4759
- package/dist/{dialog-triggers-CEazY76J.js → dialog-triggers-3Rk7PuZa.js} +555 -375
- package/dist/dialog-triggers-3Rk7PuZa.js.map +1 -0
- package/dist/elicitation/approval-panel.d.ts.map +1 -1
- package/dist/elicitation/index.d.ts +6 -1
- package/dist/elicitation/index.d.ts.map +1 -1
- package/dist/elicitation/panel.d.ts +11 -21
- package/dist/elicitation/panel.d.ts.map +1 -1
- package/dist/elicitation/types.d.ts +19 -27
- package/dist/elicitation/types.d.ts.map +1 -1
- package/dist/generated/element-attributes.d.ts +16 -10
- package/dist/generated/element-attributes.d.ts.map +1 -1
- package/dist/host/aparte-chat-host.d.ts +17 -32
- package/dist/host/aparte-chat-host.d.ts.map +1 -1
- package/dist/icons/extended.d.ts +1 -2
- package/dist/icons/extended.d.ts.map +1 -1
- package/dist/icons.d.ts +6 -8
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +13 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +775 -337
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +7 -4
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +2 -2
- package/dist/index.node.js.map +1 -1
- package/dist/interop/dialog-triggers.d.ts +2 -2
- package/dist/interop/element-props.d.ts +16 -27
- package/dist/interop/element-props.d.ts.map +1 -1
- package/dist/parsers/aparte-stream-parser.d.ts.map +1 -1
- package/dist/primitives/icon/aparte-icon.d.ts.map +1 -1
- package/dist/primitives/select/aparte-option.d.ts +3 -2
- package/dist/primitives/select/aparte-option.d.ts.map +1 -1
- package/dist/primitives/select/aparte-select.d.ts +24 -21
- package/dist/primitives/select/aparte-select.d.ts.map +1 -1
- package/dist/renderers/markdown-stream.d.ts.map +1 -1
- package/dist/renderers/segment-renderers.d.ts +11 -17
- package/dist/renderers/segment-renderers.d.ts.map +1 -1
- package/dist/renderers/segments/code.d.ts.map +1 -1
- package/dist/renderers/segments/error.d.ts.map +1 -1
- package/dist/renderers/segments/text.d.ts.map +1 -1
- package/dist/renderers/segments/thinking.d.ts.map +1 -1
- package/dist/renderers/segments/tool-call.d.ts.map +1 -1
- package/dist/runtime/message-repository.d.ts +8 -15
- package/dist/runtime/message-repository.d.ts.map +1 -1
- package/dist/transport/agent-handler.d.ts +2 -0
- package/dist/transport/agent-handler.d.ts.map +1 -1
- package/dist/transport/backend-handler.d.ts +4 -6
- package/dist/transport/backend-handler.d.ts.map +1 -1
- package/dist/transport/backend-transport.d.ts +15 -1
- package/dist/transport/backend-transport.d.ts.map +1 -1
- package/dist/transport/types.d.ts +7 -10
- package/dist/transport/types.d.ts.map +1 -1
- package/dist/types/chat.d.ts +10 -18
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/element-attributes.d.ts +6 -12
- package/dist/types/element-attributes.d.ts.map +1 -1
- package/dist/types/element-map.d.ts +6 -19
- package/dist/types/element-map.d.ts.map +1 -1
- package/dist/types/event-map.d.ts +11 -17
- package/dist/types/event-map.d.ts.map +1 -1
- package/dist/types/events.d.ts +5 -14
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/imperative-api.d.ts +3 -1
- package/dist/types/imperative-api.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/model-provider.d.ts +7 -9
- package/dist/types/model-provider.d.ts.map +1 -1
- package/dist/types/segments.d.ts +29 -13
- package/dist/types/segments.d.ts.map +1 -1
- package/dist/types/tools.d.ts +21 -23
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/utils/copy-text.d.ts +1 -2
- package/dist/utils/copy-text.d.ts.map +1 -1
- package/dist/utils/css-escape.d.ts +1 -1
- package/dist/utils/escape.d.ts +4 -19
- package/dist/utils/escape.d.ts.map +1 -1
- package/dist/utils/files-to-attachments.d.ts +2 -2
- package/dist/utils/fold-text.d.ts +13 -0
- package/dist/utils/fold-text.d.ts.map +1 -0
- package/dist/utils/is-awaiting-reply.d.ts +2 -5
- package/dist/utils/is-awaiting-reply.d.ts.map +1 -1
- package/dist/utils/presence.d.ts +5 -5
- package/dist/utils/segments.d.ts +54 -78
- package/dist/utils/segments.d.ts.map +1 -1
- package/dist/utils/tool-input.d.ts +1 -1
- package/dist/utils/tool-input.d.ts.map +1 -1
- package/dist/utils/transcript.d.ts +2 -2
- package/dist/utils/uuid.d.ts +0 -11
- package/dist/utils/uuid.d.ts.map +1 -1
- package/package.json +30 -4
- package/dist/dialog-triggers-CEazY76J.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.webcomponents.org/element/@aparte/core)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
AI chat and agent UI components as **vanilla Web Components, with the agent loop inside** —
|
|
6
6
|
zero third-party dependencies, ESM-only, usable in any framework or none.
|
|
7
7
|
|
|
8
|
+
The conversation, messages, reasoning, tool calls a human approves, the questions an agent
|
|
9
|
+
asks, the composer, the layout around the chat (app shell, sidebar, conversation list) and a
|
|
10
|
+
UI kit for the rest of the app — each one [shown live with its variants](https://apartejs.dev/components/),
|
|
11
|
+
and assembled into [templates](https://apartejs.dev/templates/) you can copy.
|
|
12
|
+
|
|
8
13
|
> **Beta.** On npm, released in lockstep with every other `@aparte/*` package — the
|
|
9
14
|
> version number is a plain `0.x`, and the declared surface is
|
|
10
15
|
> [frozen as of 0.17.0](https://apartejs.dev/reference/stability/): it leaves only
|
|
@@ -22,8 +22,8 @@ export type AparteToolApprovalResolver = (call: {
|
|
|
22
22
|
* What the user said to do instead, on a refusal.
|
|
23
23
|
*
|
|
24
24
|
* It becomes the `tool` message the model reads, which is possible at all only
|
|
25
|
-
* because a refusal
|
|
26
|
-
*
|
|
25
|
+
* because a refusal hands the model a turn. Optional: a resolver that returns a
|
|
26
|
+
* bare `{ approved }` is valid.
|
|
27
27
|
*/
|
|
28
28
|
instruction?: string;
|
|
29
29
|
/**
|
|
@@ -91,7 +91,7 @@ export interface AparteClientOptions {
|
|
|
91
91
|
* that cutoff; a turn a host seeded with NO `status` counts
|
|
92
92
|
* as answered, so a restored or server-rendered transcript
|
|
93
93
|
* goes out as history without inventing a status for it.
|
|
94
|
-
* - 'none' — sends only the current message
|
|
94
|
+
* - 'none' — sends only the current message
|
|
95
95
|
* - function — custom: receives viewport messages, returns AparteChatMessage[]
|
|
96
96
|
*/
|
|
97
97
|
history?: 'viewport' | 'none' | ((viewportMessages: AparteMessage[]) => AparteChatMessage[]);
|
|
@@ -133,10 +133,9 @@ export interface AparteClientOptions {
|
|
|
133
133
|
/**
|
|
134
134
|
* Whether a send appends the optimistic USER bubble before the reply streams.
|
|
135
135
|
*
|
|
136
|
-
* Default `true` — and opt-OUT on purpose: the
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* compiles, it streams, and nothing errors.
|
|
136
|
+
* Default `true` — and opt-OUT on purpose: if the host had to append the bubble,
|
|
137
|
+
* whoever forgot would ship a chat where the person cannot see what they typed.
|
|
138
|
+
* It compiles, it streams, and nothing errors.
|
|
140
139
|
*
|
|
141
140
|
* Pass `false` when the host owns its transcript and appends the user message
|
|
142
141
|
* itself — the four framework wrappers do (their ConversationController is
|
|
@@ -155,8 +154,7 @@ export interface AparteClientOptions {
|
|
|
155
154
|
* types (including images) are routed to the application layer. Used
|
|
156
155
|
* when images go through a captioning pipeline before RAG ingest, so
|
|
157
156
|
* the chat context only ever sees retrieved text — never raw image
|
|
158
|
-
* bytes. Saves bytes on every turn
|
|
159
|
-
* intent (read file once at upload, retrieve text-only forever after).
|
|
157
|
+
* bytes. Saves bytes on every turn.
|
|
160
158
|
*
|
|
161
159
|
* Set `'images-only'` when a `requestInterceptor` retrieves relevant
|
|
162
160
|
* document chunks and injects them as a system message instead, to avoid
|
|
@@ -214,15 +212,13 @@ export declare class AparteClient {
|
|
|
214
212
|
/**
|
|
215
213
|
* Does this window event belong to this client?
|
|
216
214
|
*
|
|
217
|
-
* One rule for all
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* two paid summarisation calls against whichever chat the DOM scan found
|
|
221
|
-
* first, and a global reset that wiped the other conversation.
|
|
215
|
+
* One rule for all the window-event handlers, so none of them can lack the guard:
|
|
216
|
+
* in a two-client layout an unguarded event would make BOTH clients run — two paid
|
|
217
|
+
* calls against whichever chat the DOM scan found first.
|
|
222
218
|
*
|
|
223
|
-
* A scoped client also answers only events ADDRESSED to it
|
|
224
|
-
*
|
|
225
|
-
*
|
|
219
|
+
* A scoped client also answers only events ADDRESSED to it; an untargeted event is
|
|
220
|
+
* not let through to every scoped client, or one broadcast would act on every chat
|
|
221
|
+
* on the page.
|
|
226
222
|
*/
|
|
227
223
|
private _isForThisInstance;
|
|
228
224
|
/** Aborts the in-flight vendor/transport fetch when the user stops a stream. */
|
|
@@ -230,31 +226,33 @@ export declare class AparteClient {
|
|
|
230
226
|
private options;
|
|
231
227
|
/** Config read by this client — an instance config, or the global default. */
|
|
232
228
|
private readonly _config;
|
|
229
|
+
/**
|
|
230
|
+
* A `keyResolver` becomes a key source on the client's config at once, before `start()`,
|
|
231
|
+
* so everything that needs a key can use it — the model selector's list included.
|
|
232
|
+
* `autoRegister` (on by default) installs core's built-in renderers on that config.
|
|
233
|
+
*/
|
|
233
234
|
constructor(options?: AparteClientOptions);
|
|
234
235
|
/**
|
|
235
236
|
* What every fresh user action does before it starts a turn.
|
|
236
237
|
*
|
|
237
|
-
* Clearing the abort flag
|
|
238
|
+
* Clearing the abort flag happens at the START of the action rather than inside
|
|
238
239
|
* `_streamTurn`, which runs after the auth and file-reading awaits — a reset there
|
|
239
|
-
*
|
|
240
|
-
* to be read.
|
|
240
|
+
* would erase an abort that arrived while the user was still waiting for a large
|
|
241
|
+
* attachment to be read.
|
|
241
242
|
*
|
|
242
243
|
* The superseded turn's TOOL handlers are not cancelled here, and do not need a
|
|
243
244
|
* registry of their own: `_streamTurn` aborts the previous `_streamController`, and
|
|
244
245
|
* the engine links every tool handler's controller to that run signal
|
|
245
|
-
* (`invokeToolHandler`), so cutting the stream cuts its tools.
|
|
246
|
-
* used to sit here for that job and was never added to — three lines of loop over an
|
|
247
|
-
* empty set, plus a paragraph describing a cancellation the method did not perform.
|
|
246
|
+
* (`invokeToolHandler`), so cutting the stream cuts its tools.
|
|
248
247
|
*/
|
|
249
248
|
private _beginUserTurn;
|
|
250
249
|
/**
|
|
251
250
|
* Put this client's `keyResolver` on its config, and hold the teardown so
|
|
252
251
|
* `stop()` can take it back off.
|
|
253
252
|
*
|
|
254
|
-
* The
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* one it meant to replace instead of replacing it. Idempotent, so the usual
|
|
253
|
+
* The teardown means a stopped client stops signing model-list requests, and a
|
|
254
|
+
* remount — the way the wrappers document swapping options — replaces the source
|
|
255
|
+
* instead of adding one behind it. Idempotent, so the usual
|
|
258
256
|
* `new AparteClient({…}).start()` registers once.
|
|
259
257
|
*/
|
|
260
258
|
private _registerKeyResolver;
|
|
@@ -264,11 +262,14 @@ export declare class AparteClient {
|
|
|
264
262
|
*/
|
|
265
263
|
private _setupListeners;
|
|
266
264
|
/**
|
|
267
|
-
*
|
|
265
|
+
* Answer the chats: listen on `window` for `aparte-send`, `aparte-retry`, `aparte-edit`,
|
|
266
|
+
* `aparte-abort` and `aparte-conversation-loaded`. Nothing streams before this is
|
|
267
|
+
* called. Starting a stopped client puts its `keyResolver` back on the config.
|
|
268
268
|
*/
|
|
269
269
|
start(): void;
|
|
270
270
|
/**
|
|
271
|
-
* Stop
|
|
271
|
+
* Stop answering: abort the reply in flight, take this client's `keyResolver` off the
|
|
272
|
+
* config, and remove the listeners.
|
|
272
273
|
*/
|
|
273
274
|
stop(): void;
|
|
274
275
|
/**
|
|
@@ -279,27 +280,21 @@ export declare class AparteClient {
|
|
|
279
280
|
/**
|
|
280
281
|
* Ask the human at the COMPOSER, and report what they decided.
|
|
281
282
|
*
|
|
282
|
-
* The default channel
|
|
283
|
-
* that existed only because the buttons lived in a segment renderer with no
|
|
284
|
-
* reference to this client. Routing through `requestUserInput` puts the decision
|
|
283
|
+
* The default channel. Routing through `requestUserInput` puts the decision
|
|
285
284
|
* where every other request for the user already goes, which is the whole point:
|
|
286
285
|
* one queue, one panel slot, one teardown, and the same behaviour whether the
|
|
287
286
|
* request came from a tool handler or from this gate.
|
|
288
287
|
*
|
|
289
288
|
* The tool NAME is the question and its ARGUMENTS are the body, because the
|
|
290
289
|
* arguments are what is being approved — a decision surface that names the act and
|
|
291
|
-
* hides its subject asks for a signature on a blank page.
|
|
292
|
-
*
|
|
293
|
-
* it had always promised what the panel did not do. The transcript row stays the
|
|
294
|
-
* anchor; it is no longer the only place the call can be read. The panel is capped
|
|
290
|
+
* hides its subject asks for a signature on a blank page. The transcript row stays the
|
|
291
|
+
* anchor, but it is not the only place the call can be read. The panel is capped
|
|
295
292
|
* at 50vh and the block inside it scrolls, so a long input cannot push the options
|
|
296
293
|
* off the surface they are asked on.
|
|
297
294
|
*
|
|
298
|
-
* `aparte-tool-decision`
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* decision are one seam too many, and the ratified elicitation rule already said so
|
|
302
|
-
* — "a typed presenter registered per config instance, never window events". A host
|
|
295
|
+
* There is no `aparte-tool-decision` event and no `document` listener that answers
|
|
296
|
+
* one: a decision is answered by a typed presenter registered per config instance,
|
|
297
|
+
* never by a window event. A host
|
|
303
298
|
* that wants to answer programmatically registers an `approvalResolver` (headless,
|
|
304
299
|
* no DOM) or its own presenter, both strictly more capable than an id on an event.
|
|
305
300
|
*/
|
|
@@ -340,29 +335,21 @@ export declare class AparteClient {
|
|
|
340
335
|
/**
|
|
341
336
|
* The registered tools, unless the current model says it cannot call one.
|
|
342
337
|
*
|
|
343
|
-
* Single source for the gate, so send / retry / edit cannot drift
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
* sets it from a fetched list, and in both cases the model's declared
|
|
352
|
-
* capabilities are commonly unknown. `undefined` capabilities then read as "no
|
|
353
|
-
* function calling", so `tools: []` went on the wire while `getTools()` held
|
|
354
|
-
* the tool the app had explicitly registered. The model answered, correctly,
|
|
355
|
-
* that it had no such tool, and nothing anywhere said why.
|
|
356
|
-
*
|
|
357
|
-
* So the question is now "did this model say it cannot", not "did it say it
|
|
358
|
-
* can". Registering a tool is an explicit act by the app; silently dropping it
|
|
338
|
+
* Single source for the gate, so send / retry / edit cannot drift.
|
|
339
|
+
*
|
|
340
|
+
* The question is "did this model say it cannot", not "did it say it can": the
|
|
341
|
+
* app sets a model id by hand (`setModelConfig`) or a selector sets it from a
|
|
342
|
+
* fetched list, and in both cases the model's declared capabilities are commonly
|
|
343
|
+
* unknown. `undefined` capabilities read as "can", or `tools: []` would go on
|
|
344
|
+
* the wire while `getTools()` held the tool the app had explicitly registered,
|
|
345
|
+
* and the model would answer that it had no such tool. Registering a tool is an explicit act by the app; silently dropping it
|
|
359
346
|
* because a `/models` listing is terse is the library second-guessing the
|
|
360
347
|
* developer. A model that declares its capabilities and omits function calling
|
|
361
348
|
* is still honoured — that is a statement, and it is respected.
|
|
362
349
|
*
|
|
363
350
|
* Failure modes, both ways round: over-sending means a model that cannot use
|
|
364
351
|
* tools does not call one, or its own endpoint rejects the array with an error
|
|
365
|
-
* the developer can read. Under-sending
|
|
352
|
+
* the developer can read. Under-sending would be silent, total, and look like a
|
|
366
353
|
* lying model.
|
|
367
354
|
*/
|
|
368
355
|
private _toolsForCurrentModel;
|
|
@@ -371,10 +358,9 @@ export declare class AparteClient {
|
|
|
371
358
|
* The system messages a turn opens with: the app's own template, then the registered
|
|
372
359
|
* tools' `systemPrompt`s.
|
|
373
360
|
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
* the abort-flag asymmetry `_beginUserTurn` exists to prevent.
|
|
361
|
+
* One helper for the three turn entry points (send, retry, edit), so the tool half
|
|
362
|
+
* cannot be added to two of them and forgotten in the third — the same shape as the
|
|
363
|
+
* abort-flag asymmetry `_beginUserTurn` exists to prevent.
|
|
378
364
|
*/
|
|
379
365
|
private _systemMessages;
|
|
380
366
|
/**
|
|
@@ -396,11 +382,11 @@ export declare class AparteClient {
|
|
|
396
382
|
* The trees a lookup must search, the one the gesture came from FIRST.
|
|
397
383
|
*
|
|
398
384
|
* `document.getElementById` and `document.querySelectorAll` cannot see into a shadow
|
|
399
|
-
* root, so a chat mounted in one — the arrangement the theming guide endorses —
|
|
400
|
-
* invisible to both: alone, the send
|
|
401
|
-
* holds a chat in the light DOM, the scan
|
|
402
|
-
* person's message AND the model's reply
|
|
403
|
-
* into. Nearest tree first
|
|
385
|
+
* root, so a chat mounted in one — the arrangement the theming guide endorses — is
|
|
386
|
+
* invisible to both: alone, the send would be dropped with a warning; on a page that
|
|
387
|
+
* also holds a chat in the light DOM, the scan would answer with the WRONG chat, and
|
|
388
|
+
* the person's message AND the model's reply would land in a transcript they never
|
|
389
|
+
* typed into. Nearest tree first keeps it from swapping the other way round.
|
|
404
390
|
*/
|
|
405
391
|
private _rootsFor;
|
|
406
392
|
/** The element an id names, looked up in the gesture's own tree before the document. */
|
|
@@ -442,8 +428,8 @@ export declare class AparteClient {
|
|
|
442
428
|
* The SLICE is each caller's own business — retry cuts before the reply it is
|
|
443
429
|
* regenerating, edit cuts after the message being reworded, send cuts at the last
|
|
444
430
|
* answered turn. What a message CONTRIBUTES to the wire is not: send, retry and
|
|
445
|
-
* edit must not disagree about it
|
|
446
|
-
*
|
|
431
|
+
* edit must not disagree about it. A failed turn and a turn stopped before its
|
|
432
|
+
* first token are filtered out rather than sent as
|
|
447
433
|
* `{ role: 'assistant', content: '' }` — a claim the assistant said nothing, which
|
|
448
434
|
* some providers reject outright and the rest read as an empty reply worth
|
|
449
435
|
* imitating.
|
|
@@ -472,12 +458,12 @@ export declare class AparteClient {
|
|
|
472
458
|
* the question the history gates can ask is "is this still in flight?", never
|
|
473
459
|
* "is this completed?".
|
|
474
460
|
*
|
|
475
|
-
* The gates below
|
|
461
|
+
* The gates below ask the first, because a host that SEEDS a transcript
|
|
476
462
|
* — restoring a saved conversation, hydrating a server-rendered one — has no
|
|
477
|
-
* reason to invent a status for turns that are already over.
|
|
478
|
-
*
|
|
479
|
-
* model
|
|
480
|
-
* because the viewport still
|
|
463
|
+
* reason to invent a status for turns that are already over. Asking "is this
|
|
464
|
+
* completed?" would leave the cutoff at 0 and slice away the whole transcript: the
|
|
465
|
+
* model would get the new question with no context, and nothing in the UI would say
|
|
466
|
+
* so, because the viewport still shows every message.
|
|
481
467
|
*/
|
|
482
468
|
private static _inFlight;
|
|
483
469
|
private _toHistoryMessages;
|
|
@@ -492,23 +478,9 @@ export declare class AparteClient {
|
|
|
492
478
|
* What the model is told it said last turn — reconstructed from what was
|
|
493
479
|
* RENDERED, not from the raw-text field.
|
|
494
480
|
*
|
|
495
|
-
* The
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
* correct-in-isolation decisions composed into it:
|
|
499
|
-
*
|
|
500
|
-
* 1. the parser withholds an ambiguous prefix (``` ``` ```, `` ` ``, `<`)
|
|
501
|
-
* waiting for the next delta, and creates no active segment while it waits;
|
|
502
|
-
* 2. so `_streamLoop` sees zero segments, concludes the parser produced
|
|
503
|
-
* nothing, and appends the raw delta straight to `message.content`;
|
|
504
|
-
* 3. and this method preferred `content`.
|
|
505
|
-
*
|
|
506
|
-
* The bubble hides its content element as soon as segments exist, so the UI was
|
|
507
|
-
* perfect and only the NEXT request showed it. No unit test, no example and
|
|
508
|
-
* no browser test could see it.
|
|
509
|
-
*
|
|
510
|
-
* `content` stays as the fallback, and that is not vestigial: a non-streaming
|
|
511
|
-
* transport writes the whole reply there and creates no segments at all.
|
|
481
|
+
* The segments are what the reader saw, so they come first. `content` is the
|
|
482
|
+
* fallback, and that is not vestigial: a non-streaming transport writes the whole
|
|
483
|
+
* reply there and creates no segments at all.
|
|
512
484
|
*/
|
|
513
485
|
private _extractText;
|
|
514
486
|
/**
|
|
@@ -521,10 +493,9 @@ export declare class AparteClient {
|
|
|
521
493
|
* A type core does not know — a registered block grammar's (an artifact, a
|
|
522
494
|
* citation, a file), a consumer's custom segment — follows one rule: its
|
|
523
495
|
* `content` if it has one, else its `fallback`, else nothing. Dropping such a
|
|
524
|
-
* segment
|
|
525
|
-
* turn, so it could not be asked to change the thing it had built
|
|
526
|
-
*
|
|
527
|
-
* now that the artifact is a plugin's type like any other.
|
|
496
|
+
* segment would make a document the model had just produced invisible on the very
|
|
497
|
+
* next turn, so it could not be asked to change the thing it had built. An artifact
|
|
498
|
+
* is a plugin's type like any other and follows this rule.
|
|
528
499
|
*
|
|
529
500
|
* `thinking` and `tool_call` stay out on purpose — the first is the model's own
|
|
530
501
|
* scratchpad, and most APIs neither want it back nor bill for it kindly; the
|
|
@@ -597,6 +568,14 @@ export declare class AparteClient {
|
|
|
597
568
|
* resume. A channel that CRASHES fails the turn, as it does for a run in the page.
|
|
598
569
|
*/
|
|
599
570
|
private _answerDeferred;
|
|
571
|
+
/**
|
|
572
|
+
* Whether a browser tool a paused run asked for may run, decided as a run in the page
|
|
573
|
+
* decides it. With a host `approvalResolver`, the tool's own `needsApproval` says whether
|
|
574
|
+
* to ask and the resolver answers; without one, the approval policy and `needsApproval`
|
|
575
|
+
* rule (`ruleOnToolCall`) and the default channel asks. `null` when nothing gates the
|
|
576
|
+
* call, the decision when something did, `undefined` when nobody answered.
|
|
577
|
+
*/
|
|
578
|
+
private _gateBrowserTool;
|
|
600
579
|
/**
|
|
601
580
|
* The ticket is spent the moment the resume leaves: the server answers these calls
|
|
602
581
|
* now, so a pause saved from here on — the conversation manager saves before it cuts a
|
|
@@ -608,8 +587,8 @@ export declare class AparteClient {
|
|
|
608
587
|
* Close the reply's calls that can no longer finish — paused, queued, or running on a
|
|
609
588
|
* server the page stopped listening to: each says it stopped, and forgets the pause.
|
|
610
589
|
* A cut connection carries none of their last events, so nothing else would: the rows
|
|
611
|
-
*
|
|
612
|
-
* server that had moved on. By the reply's id, not the chat's head — a retry during
|
|
590
|
+
* would spin, and a queued call would keep its ticket, which a reload would then
|
|
591
|
+
* resume against a server that had moved on. By the reply's id, not the chat's head — a retry during
|
|
613
592
|
* the wait moves the head. A run in the page ends every call itself: nothing to do.
|
|
614
593
|
*/
|
|
615
594
|
private _closeOpenCalls;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-client.d.ts","sourceRoot":"","sources":["../../src/client/aparte-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAS9E,OAAO,KAAK,EAAE,kBAAkB,EAA+C,MAAM,qBAAqB,CAA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OAAO,CAAC,cAAc;IAYtB;;;;;;;;;;;;OAYG;IACG,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAsCrE,2FAA2F;IAC3F,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;IAE/C;;OAEG;IACH,OAAO,CAAC,cAAc;IAMtB;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAuDhC"}
|
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `@aparte/engine`'s `runStreamAgent` is the headless loop: it emits high-level,
|
|
5
5
|
* DOM-free run events. This adapter is the other half — it turns each event into
|
|
6
|
-
* the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* loop byte-for-byte — and have replaced it (audit 2026-08-28, D1).
|
|
6
|
+
* the `targetElement.*` calls + CustomEvents the transcript needs, using the
|
|
7
|
+
* **real** `AparteStreamParser` and tool renderers. `runStreamAgent` (engine, pure
|
|
8
|
+
* Node) + this adapter (core, DOM) are the one agent loop `AparteClient` runs.
|
|
10
9
|
*
|
|
11
10
|
* DEPENDENCY DIRECTION: `@aparte/core` depends on `@aparte/engine` — first-party, so
|
|
12
11
|
* the zero-third-party-dependency promise is untouched — never the reverse. The
|
|
13
12
|
* run-event contract is engine's: {@link AparteStreamRunEvent} and its siblings below
|
|
14
13
|
* are `StreamRunEvent` & co under core's names, so there is nothing to keep in sync by
|
|
15
|
-
* hand
|
|
16
|
-
* guard in engine that policed it, went with the mirror (audit 2026-08-28, D1). A
|
|
17
|
-
* consumer wires a runner through `AparteClientOptions.streamRunner` — the same
|
|
14
|
+
* hand. A consumer wires a runner through `AparteClientOptions.streamRunner` — the same
|
|
18
15
|
* pattern as `approvalResolver` (HITL).
|
|
19
16
|
*/
|
|
20
17
|
import type { AparteConfig } from '../config/aparte-config.js';
|
|
@@ -24,7 +21,7 @@ import type { StreamRunEvent, StreamRunEmitter, StreamRunOptions, StreamUsage }
|
|
|
24
21
|
/**
|
|
25
22
|
* The DOM-free run events `@aparte/engine`'s `runStreamAgent` emits — engine's
|
|
26
23
|
* `StreamRunEvent`, under core's name. See `packages/engine/src/agent/stream-events.ts`
|
|
27
|
-
* for the per-event
|
|
24
|
+
* for the per-event documentation.
|
|
28
25
|
*/
|
|
29
26
|
export type AparteStreamRunEvent = StreamRunEvent;
|
|
30
27
|
/** Synchronous, ordered event sink — engine's `StreamRunEmitter`. */
|
|
@@ -42,11 +39,8 @@ export type AparteStreamRunOptions = StreamRunOptions;
|
|
|
42
39
|
* — the seam by which a host wraps or replaces the loop `AparteClient` runs,
|
|
43
40
|
* which is `@aparte/engine`'s `runStreamAgent` by default.
|
|
44
41
|
*
|
|
45
|
-
* `runStreamAgent` IS this type — pass it, do not cast it.
|
|
46
|
-
*
|
|
47
|
-
* two packages' message types drifted apart unnoticed and shipped a
|
|
48
|
-
* `streamRunner: runStreamAgent` that did not compile on five docs pages and a
|
|
49
|
-
* README. The alias makes that drift a typecheck error in the composition itself.
|
|
42
|
+
* `runStreamAgent` IS this type — pass it, do not cast it. The alias makes any drift
|
|
43
|
+
* between the two packages' message types a typecheck error in the composition itself.
|
|
50
44
|
*/
|
|
51
45
|
export type AparteStreamRunner = (opts: AparteStreamRunOptions) => Promise<StreamUsage | undefined>;
|
|
52
46
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-adapter.d.ts","sourceRoot":"","sources":["../../src/client/stream-adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stream-adapter.d.ts","sourceRoot":"","sources":["../../src/client/stream-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKzF,OAAO,KAAK,EAAE,WAAW,EAAE,M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CAAC;IAClB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,sBAAsB,CA2N5F;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,MAAM,EAAE,cAAc,CAAC,iBAAiB,CAAC,EACzC,MAAM,EAAE,WAAW,GACpB,aAAa,CAAC,iBAAiB,CAAC,CAkClC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What one message contributes to the history a turn sends — its tool calls included.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* text after them as the next envelope.
|
|
4
|
+
* A reply goes out in the order it was shown, so a tool's result stays in the model's
|
|
5
|
+
* context on later turns: the text before some calls and those calls as an assistant
|
|
6
|
+
* envelope, each call's answer as a `tool` message, the text after them as the next
|
|
7
|
+
* envelope.
|
|
9
8
|
*
|
|
10
9
|
* Every call is answered, because a provider rejects a request that declares a call
|
|
11
10
|
* with no `tool` message after it: a refusal sends its reason, a crash its error line,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-history.d.ts","sourceRoot":"","sources":["../../src/client/wire-history.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wire-history.d.ts","sourceRoot":"","sources":["../../src/client/wire-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEhH,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,6CAA6C,CAAC;AAE5E,0GAA0G;AAC1G,eAAO,MAAM,eAAe,iCAAiC,CAAC;AAU9D,gGAAgG;AAChG,eAAO,MAAM,cAAc,YAAa,aAAa,KAAG,OAAO,IAAI,qBAGkE,CAAC;AAEtI;;;;GAIG;AACH,wBAAgB,SAAS,CACrB,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,MAAM,EAC7C,OAAO,GAAE;IACL;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACrB,GACP,iBAAiB,EAAE,CA2CrB"}
|