@aparte/core 0.15.0 → 0.16.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/dist/client/aparte-client.d.ts +53 -51
- package/dist/client/aparte-client.d.ts.map +1 -1
- package/dist/client/lifecycle-events.d.ts +0 -12
- package/dist/client/lifecycle-events.d.ts.map +1 -1
- package/dist/client/stream-adapter.d.ts +2 -12
- package/dist/client/stream-adapter.d.ts.map +1 -1
- package/dist/components/bubble/aparte-chat-bubble.d.ts +45 -1
- package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-attachments.d.ts +0 -1
- package/dist/components/composer/aparte-composer-attachments.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-send.d.ts +11 -11
- package/dist/components/composer/aparte-composer-send.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer.d.ts +20 -11
- package/dist/components/composer/aparte-composer.d.ts.map +1 -1
- package/dist/components/context/aparte-context.d.ts +31 -8
- package/dist/components/context/aparte-context.d.ts.map +1 -1
- package/dist/components/conversation-list/aparte-conversation-list.d.ts +93 -36
- package/dist/components/conversation-list/aparte-conversation-list.d.ts.map +1 -1
- package/dist/components/conversation-list/index.d.ts +1 -1
- package/dist/components/conversation-list/index.d.ts.map +1 -1
- package/dist/components/elicitation/aparte-elicitation.d.ts +19 -1
- package/dist/components/elicitation/aparte-elicitation.d.ts.map +1 -1
- package/dist/components/index.d.ts +7 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/scroll-rail/aparte-scroll-rail.d.ts +105 -0
- package/dist/components/scroll-rail/aparte-scroll-rail.d.ts.map +1 -0
- package/dist/components/scroll-rail/index.d.ts +3 -0
- package/dist/components/scroll-rail/index.d.ts.map +1 -0
- package/dist/components/sidebar/aparte-sidebar.d.ts +186 -0
- package/dist/components/sidebar/aparte-sidebar.d.ts.map +1 -0
- package/dist/components/sidebar/index.d.ts +3 -0
- package/dist/components/sidebar/index.d.ts.map +1 -0
- package/dist/components/split/aparte-split.d.ts +354 -0
- package/dist/components/split/aparte-split.d.ts.map +1 -0
- package/dist/components/split/geometry.d.ts +65 -0
- package/dist/components/split/geometry.d.ts.map +1 -0
- package/dist/components/split/index.d.ts +3 -0
- package/dist/components/split/index.d.ts.map +1 -0
- package/dist/components/suggestions/aparte-suggestions.d.ts +7 -1
- package/dist/components/suggestions/aparte-suggestions.d.ts.map +1 -1
- package/dist/components/viewport/aparte-chat-viewport.d.ts +52 -2
- package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
- package/dist/config/aparte-config.d.ts +95 -33
- package/dist/config/aparte-config.d.ts.map +1 -1
- package/dist/config/icon-provider.d.ts +6 -0
- package/dist/config/icon-provider.d.ts.map +1 -1
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/locale.d.ts +140 -27
- package/dist/config/locale.d.ts.map +1 -1
- package/dist/config/sanitize.d.ts +9 -0
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/conversations/conversation-controller.d.ts +13 -1
- package/dist/conversations/conversation-controller.d.ts.map +1 -1
- package/dist/conversations/conversation-manager.d.ts +9 -0
- package/dist/conversations/conversation-manager.d.ts.map +1 -1
- package/dist/custom-elements.json +9838 -7333
- package/dist/{is-awaiting-reply-BZ_iJ3s3.js → dialog-triggers-CVCxqKg3.js} +718 -1182
- package/dist/dialog-triggers-CVCxqKg3.js.map +1 -0
- package/dist/elicitation/approval-panel.d.ts +1 -1
- package/dist/elicitation/approval-panel.d.ts.map +1 -1
- package/dist/elicitation/panel.d.ts +24 -16
- package/dist/elicitation/panel.d.ts.map +1 -1
- package/dist/elicitation/types.d.ts +31 -0
- package/dist/elicitation/types.d.ts.map +1 -1
- package/dist/generated/element-attributes.d.ts +47 -1
- package/dist/generated/element-attributes.d.ts.map +1 -1
- package/dist/{glyphs-B3BZ2TIb.js → glyphs-DQTeOj4w.js} +22 -13
- package/dist/{glyphs-B3BZ2TIb.js.map → glyphs-DQTeOj4w.js.map} +1 -1
- package/dist/host/aparte-chat-host.d.ts +10 -2
- package/dist/host/aparte-chat-host.d.ts.map +1 -1
- package/dist/icons/extended.d.ts +4 -2
- package/dist/icons/extended.d.ts.map +1 -1
- package/dist/icons/glyphs.d.ts +9 -0
- package/dist/icons/glyphs.d.ts.map +1 -1
- package/dist/icons.js +16 -15
- package/dist/icons.js.map +1 -1
- package/dist/index.css +1217 -396
- package/dist/index.d.ts +26 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2097 -295
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +21 -5
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +39 -34
- package/dist/index.node.js.map +1 -1
- package/dist/interop/dialog-triggers.d.ts +27 -0
- package/dist/interop/dialog-triggers.d.ts.map +1 -0
- package/dist/interop/element-props.d.ts +16 -8
- package/dist/interop/element-props.d.ts.map +1 -1
- package/dist/parsers/aparte-stream-parser.d.ts +52 -22
- package/dist/parsers/aparte-stream-parser.d.ts.map +1 -1
- package/dist/parsers/index.d.ts +1 -1
- package/dist/parsers/index.d.ts.map +1 -1
- package/dist/primitives/select/aparte-select.d.ts.map +1 -1
- package/dist/renderers/segment-renderers.d.ts.map +1 -1
- package/dist/renderers/segments/code.d.ts.map +1 -1
- package/dist/renderers/segments/tool-call.d.ts.map +1 -1
- package/dist/runtime/message-repository.d.ts.map +1 -1
- package/dist/transport/backend-handler.d.ts.map +1 -1
- package/dist/transport/backend-transport.d.ts +6 -1
- package/dist/transport/backend-transport.d.ts.map +1 -1
- package/dist/types/chat.d.ts +8 -14
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/element-map.d.ts +54 -4
- package/dist/types/element-map.d.ts.map +1 -1
- package/dist/types/event-map.d.ts +16 -10
- package/dist/types/event-map.d.ts.map +1 -1
- package/dist/types/events.d.ts +59 -117
- 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 +5 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/models.d.ts +11 -31
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/segments.d.ts +11 -47
- package/dist/types/segments.d.ts.map +1 -1
- package/dist/types/stream-blocks.d.ts +57 -0
- package/dist/types/stream-blocks.d.ts.map +1 -0
- package/dist/types/tools.d.ts +57 -0
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/utils/copy-text.d.ts +24 -0
- package/dist/utils/copy-text.d.ts.map +1 -0
- package/dist/utils/css-escape.d.ts +5 -0
- package/dist/utils/css-escape.d.ts.map +1 -1
- package/dist/utils/tool-input.d.ts +20 -0
- package/dist/utils/tool-input.d.ts.map +1 -0
- package/package.json +10 -3
- package/dist/is-awaiting-reply-BZ_iJ3s3.js.map +0 -1
- package/dist/renderers/segments/artifact/binary-file.d.ts +0 -45
- package/dist/renderers/segments/artifact/binary-file.d.ts.map +0 -1
- package/dist/renderers/segments/artifact/card.d.ts +0 -3
- package/dist/renderers/segments/artifact/card.d.ts.map +0 -1
- package/dist/renderers/segments/artifact/preview-document.d.ts +0 -27
- package/dist/renderers/segments/artifact/preview-document.d.ts.map +0 -1
- package/dist/renderers/segments/artifact/shared.d.ts +0 -29
- package/dist/renderers/segments/artifact/shared.d.ts.map +0 -1
|
@@ -26,21 +26,13 @@ export type AparteToolApprovalResolver = (call: {
|
|
|
26
26
|
* that returns a bare `{ approved }` behaves exactly as before.
|
|
27
27
|
*/
|
|
28
28
|
instruction?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The refusal, verbatim, when nobody said anything — an approval policy that
|
|
31
|
+
* refused on its own. Without it the model is told "the user rejected this",
|
|
32
|
+
* which for a mode is a lie; with it, it reads the policy's own sentence.
|
|
33
|
+
*/
|
|
34
|
+
reason?: string;
|
|
29
35
|
}>;
|
|
30
|
-
/**
|
|
31
|
-
* Decides how a conversation is compacted: which messages are summarized away
|
|
32
|
-
* (`drop`) and which are preserved verbatim (`keep`). Pure — no LLM call.
|
|
33
|
-
*
|
|
34
|
-
* The default selector drops the whole history (summarize everything, replace
|
|
35
|
-
* all), which is the built-in behaviour. Inject a budget-aware selector (e.g.
|
|
36
|
-
* wrapping `@aparte/engine`'s `compactConversation`) so the compaction badge and
|
|
37
|
-
* the `compact()` action share one selection and only the old turns are sent to
|
|
38
|
-
* the summarizer — the budget is closed over by the consumer, not core's to know.
|
|
39
|
-
*/
|
|
40
|
-
export type AparteCompactionSelector = (messages: AparteMessage[]) => {
|
|
41
|
-
keep: AparteMessage[];
|
|
42
|
-
drop: AparteMessage[];
|
|
43
|
-
};
|
|
44
36
|
/**
|
|
45
37
|
* Configuration options for AparteClient
|
|
46
38
|
*/
|
|
@@ -57,23 +49,23 @@ export interface AparteClientOptions {
|
|
|
57
49
|
* decide from the call itself — it receives `(call, signal)` — or to drive
|
|
58
50
|
* approval from a headless source (CLI / webhook) with no DOM.
|
|
59
51
|
*
|
|
60
|
-
* It
|
|
52
|
+
* It owns the WHOLE decision: with one injected, an `AparteApprovalPolicy`
|
|
53
|
+
* registered through `setApprovalPolicy()` — and therefore
|
|
54
|
+
* `@aparte/plugin-approval`'s modes — is not consulted at all, neither for the
|
|
55
|
+
* gate nor for the answer, and the tool's own `needsApproval` decides which
|
|
56
|
+
* calls reach this resolver. Rule on the call here, or drop this option and use
|
|
57
|
+
* a policy; do not expect both.
|
|
58
|
+
*
|
|
59
|
+
* On a refusal it may return an `instruction` (the user's words) or a `reason`
|
|
60
|
+
* (nobody spoke), which the model reads as the tool result.
|
|
61
61
|
*/
|
|
62
62
|
approvalResolver?: AparteToolApprovalResolver;
|
|
63
|
-
/**
|
|
64
|
-
* Custom compaction selection strategy. Defaults to dropping the entire
|
|
65
|
-
* history (summarize all, replace all — the built-in behaviour). Inject a
|
|
66
|
-
* budget-aware selector so only old turns are summarized and recent ones are
|
|
67
|
-
* kept verbatim. See {@link AparteCompactionSelector}.
|
|
68
|
-
*/
|
|
69
|
-
compactionSelector?: AparteCompactionSelector;
|
|
70
63
|
/**
|
|
71
64
|
* The stream-loop runner. Default: `@aparte/engine`'s `runStreamAgent`, rendered
|
|
72
65
|
* through the core adapter ({@link createStreamAdapter}). Set it to wrap that loop
|
|
73
66
|
* — `(opts) => runStreamAgent({ ...opts, onHistoryAppend })` for a host that owns
|
|
74
67
|
* its transcript — or to replace it with a loop of your own that emits the same
|
|
75
|
-
* events. Same injection pattern as {@link approvalResolver}
|
|
76
|
-
* {@link compactionSelector}. See {@link AparteStreamRunner}.
|
|
68
|
+
* events. Same injection pattern as {@link approvalResolver}. See {@link AparteStreamRunner}.
|
|
77
69
|
*/
|
|
78
70
|
streamRunner?: AparteStreamRunner;
|
|
79
71
|
/**
|
|
@@ -195,16 +187,14 @@ export interface AparteClientOptions {
|
|
|
195
187
|
export declare class AparteClient {
|
|
196
188
|
private _boundHandler;
|
|
197
189
|
private _boundAbortHandler;
|
|
198
|
-
private _boundCompactHandler;
|
|
199
190
|
private _boundRetryHandler;
|
|
200
191
|
private _boundEditHandler;
|
|
201
|
-
private _activeToolControllers;
|
|
202
192
|
private _isAborted;
|
|
203
193
|
/**
|
|
204
194
|
* Does this window event belong to this client?
|
|
205
195
|
*
|
|
206
|
-
* One rule for all
|
|
207
|
-
* one omission: `aparte-compact` had no guard at all, so in the two-client
|
|
196
|
+
* One rule for all four handlers, because it used to be near-copies and
|
|
197
|
+
* one omission: `aparte-compact` (answered here until 0.16.0) had no guard at all, so in the two-client
|
|
208
198
|
* layout the JSDoc documents, a single compact event made BOTH clients run —
|
|
209
199
|
* two paid summarisation calls against whichever chat the DOM scan found
|
|
210
200
|
* first, and a global reset that wiped the other conversation.
|
|
@@ -216,8 +206,6 @@ export declare class AparteClient {
|
|
|
216
206
|
private _isForThisInstance;
|
|
217
207
|
/** Aborts the in-flight vendor/transport fetch when the user stops a stream. */
|
|
218
208
|
private _streamController;
|
|
219
|
-
/** Aborts an in-flight `compact()` summarisation — its own slot, see `compact`. */
|
|
220
|
-
private _compactController;
|
|
221
209
|
private options;
|
|
222
210
|
/** Config read by this client — an instance config, or the global default. */
|
|
223
211
|
private readonly _config;
|
|
@@ -230,11 +218,12 @@ export declare class AparteClient {
|
|
|
230
218
|
* erased an abort that arrived while the user was still waiting for a large attachment
|
|
231
219
|
* to be read.
|
|
232
220
|
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
221
|
+
* The superseded turn's TOOL handlers are not cancelled here, and do not need a
|
|
222
|
+
* registry of their own: `_streamTurn` aborts the previous `_streamController`, and
|
|
223
|
+
* the engine links every tool handler's controller to that run signal
|
|
224
|
+
* (`invokeToolHandler`), so cutting the stream cuts its tools. A `Set<AbortController>`
|
|
225
|
+
* used to sit here for that job and was never added to — three lines of loop over an
|
|
226
|
+
* empty set, plus a paragraph describing a cancellation the method did not perform.
|
|
238
227
|
*/
|
|
239
228
|
private _beginUserTurn;
|
|
240
229
|
/**
|
|
@@ -265,9 +254,14 @@ export declare class AparteClient {
|
|
|
265
254
|
* one queue, one panel slot, one teardown, and the same behaviour whether the
|
|
266
255
|
* request came from a tool handler or from this gate.
|
|
267
256
|
*
|
|
268
|
-
* The tool NAME is the question
|
|
269
|
-
*
|
|
270
|
-
*
|
|
257
|
+
* The tool NAME is the question and its ARGUMENTS are the body, because the
|
|
258
|
+
* arguments are what is being approved — a decision surface that names the act and
|
|
259
|
+
* hides its subject asks for a signature on a blank page. This paragraph used to
|
|
260
|
+
* say the opposite ("the arguments stay in the transcript"), and the guide beside
|
|
261
|
+
* it had always promised what the panel did not do. The transcript row stays the
|
|
262
|
+
* anchor; it is no longer the only place the call can be read. The panel is capped
|
|
263
|
+
* at 50vh and the block inside it scrolls, so a long input cannot push the options
|
|
264
|
+
* off the surface they are asked on.
|
|
271
265
|
*
|
|
272
266
|
* `aparte-tool-decision` is GONE with the buttons that dispatched it, and so is the
|
|
273
267
|
* `document` listener that answered it. It existed only because a segment renderer
|
|
@@ -296,14 +290,6 @@ export declare class AparteClient {
|
|
|
296
290
|
* sequence, so it can't drift between the three entry points.
|
|
297
291
|
*/
|
|
298
292
|
private _streamTurn;
|
|
299
|
-
/**
|
|
300
|
-
* Compact the current conversation: summarize all messages via the AI,
|
|
301
|
-
* clear the viewport, then inject the summary as a single context message.
|
|
302
|
-
*
|
|
303
|
-
* Triggered programmatically or by dispatching `window.dispatchEvent(new CustomEvent('aparte-compact'))`.
|
|
304
|
-
* Dispatches `aparte-compact-done` on window when complete, or `aparte-compact-error` on failure.
|
|
305
|
-
*/
|
|
306
|
-
compact(targetId?: string): Promise<void>;
|
|
307
293
|
/**
|
|
308
294
|
* Handle aparte-retry — add a sibling branch to the assistant message and re-stream
|
|
309
295
|
* using the same conversation history minus the retried reply.
|
|
@@ -369,12 +355,21 @@ export declare class AparteClient {
|
|
|
369
355
|
* Convert AparteMessage[] to AparteChatMessage[] for re-submission.
|
|
370
356
|
*/
|
|
371
357
|
private _messagesToChatMessages;
|
|
358
|
+
/** The "no model selected" warning is said once per client, not once per dropped send. */
|
|
359
|
+
private _warnedNoModel;
|
|
372
360
|
private _handleSend;
|
|
373
361
|
/**
|
|
374
362
|
* Build the initial messages array, prepending system prompts and conversation history.
|
|
375
363
|
*/
|
|
376
364
|
private _buildMessages;
|
|
377
365
|
private _toHistoryMessages;
|
|
366
|
+
/**
|
|
367
|
+
* A message's text as the MODEL should read it — the one mapper both history
|
|
368
|
+
* paths use, so the compaction preamble cannot be applied on retry and edit and
|
|
369
|
+
* forgotten on the ordinary send, which is what the first review of this feature
|
|
370
|
+
* caught: the summary went out on every normal turn as something the user said.
|
|
371
|
+
*/
|
|
372
|
+
private _wireText;
|
|
378
373
|
/**
|
|
379
374
|
* What the model is told it said last turn — reconstructed from what was
|
|
380
375
|
* RENDERED, not from the raw-text field.
|
|
@@ -403,12 +398,19 @@ export declare class AparteClient {
|
|
|
403
398
|
*
|
|
404
399
|
* Fences and the language tag are kept. Without them the model re-reads its own
|
|
405
400
|
* code as prose — which is how it starts explaining a snippet it believes it
|
|
406
|
-
* wrote in English.
|
|
407
|
-
*
|
|
408
|
-
*
|
|
401
|
+
* wrote in English.
|
|
402
|
+
*
|
|
403
|
+
* A type core does not know — a registered block grammar's (an artifact, a
|
|
404
|
+
* citation, a file), a consumer's custom segment — follows one rule: its
|
|
405
|
+
* `content` if it has one, else its `fallback`, else nothing. Dropping such a
|
|
406
|
+
* segment made a document the model had just produced invisible on the very next
|
|
407
|
+
* turn, so it could not be asked to change the thing it had built; there used to
|
|
408
|
+
* be an `artifact` branch here for exactly that, and the rule is what replaces it
|
|
409
|
+
* now that the artifact is a plugin's type like any other.
|
|
409
410
|
*
|
|
410
|
-
* `thinking`
|
|
411
|
-
* APIs neither want it back nor bill for it kindly
|
|
411
|
+
* `thinking` and `tool_call` stay out on purpose — the first is the model's own
|
|
412
|
+
* scratchpad, and most APIs neither want it back nor bill for it kindly; the
|
|
413
|
+
* second is already in the history as a call and a result.
|
|
412
414
|
*/
|
|
413
415
|
private _segmentsToText;
|
|
414
416
|
/**
|
|
@@ -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;AAO9E,OAAO,KAAK,EAAE,kBAAkB,EAA+C,MAAM,qBAAqB,CAAC;AAC3G,OAAO,KAAK,EAAoC,aAAa,EAAsB,MAAM,mBAAmB,CAAC;AAG7G,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,
|
|
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;AAO9E,OAAO,KAAK,EAAE,kBAAkB,EAA+C,MAAM,qBAAqB,CAAC;AAC3G,OAAO,KAAK,EAAoC,aAAa,EAAsB,MAAM,mBAAmB,C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AAW;IA6EzB;;;OAGG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,qBAAqB;YAMf,YAAY;IA4D1B;;;;;;;;OAQG;IACH,OAAO,CAAC,eAAe;IASvB;;;OAGG;YACW,WAAW;IAiEzB;;OAEG;IACH,OAAO,CAAC,cAAc;IAsBtB;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAY/B,0FAA0F;IAC1F,OAAO,CAAC,cAAc,CAAS;YAEjB,WAAW;IAuKzB;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,kBAAkB;IA2B1B;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAKjB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,YAAY;IAOpB;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,eAAe;IAuBvB;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;;;;;OAMG;YACW,oBAAoB;IAsClC;;;;;;;;;;OAUG;IACH;;;OAGG;YACW,WAAW;IA+CzB;;;;;;;;OAQG;YACW,mBAAmB;IA+GjC;;OAEG;IACH,OAAO,CAAC,cAAc;IAMtB;;OAEG;IACH,OAAO,CAAC,qBAAqB;CA+DhC"}
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
* callers satisfy: core's client passes an `HTMLElement`, the adapter passes its
|
|
25
25
|
* duck-typed target, and neither needs anything else.
|
|
26
26
|
*/
|
|
27
|
-
import type { AparteArtifactSegment } from '../types/segments.js';
|
|
28
27
|
/** Anything that can receive a DOM event and may carry an id. */
|
|
29
28
|
export interface AparteLifecycleTarget {
|
|
30
29
|
readonly id?: string;
|
|
@@ -41,15 +40,4 @@ export interface AparteLifecycleTarget {
|
|
|
41
40
|
* between the two versions that was ever load-bearing.
|
|
42
41
|
*/
|
|
43
42
|
export declare function dispatchLifecycleEvent(target: AparteLifecycleTarget, name: string, detail: unknown): void;
|
|
44
|
-
/**
|
|
45
|
-
* Dispatch the artifact lifecycle: `aparte-artifact-start` once per segment id,
|
|
46
|
-
* `aparte-artifact-delta` when the body actually grew, and `aparte-artifact-ready`
|
|
47
|
-
* when `isFinal`. `progress` tracks the per-id length already broadcast, so a
|
|
48
|
-
* re-render cannot replay a delta.
|
|
49
|
-
*
|
|
50
|
-
* The segment parameter is structural rather than `AparteArtifactSegment` because the
|
|
51
|
-
* adapter builds its segments from stream events and never constructs the full type;
|
|
52
|
-
* the import above keeps the two documented as the same thing.
|
|
53
|
-
*/
|
|
54
|
-
export declare function dispatchArtifactLifecycle(target: AparteLifecycleTarget, messageId: string, segment: Pick<AparteArtifactSegment, 'id'> & Partial<Pick<AparteArtifactSegment, 'content' | 'mimeType' | 'artifactType' | 'title'>>, progress: Map<string, number>, isFinal: boolean): void;
|
|
55
43
|
//# sourceMappingURL=lifecycle-events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-events.d.ts","sourceRoot":"","sources":["../../src/client/lifecycle-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;
|
|
1
|
+
{"version":3,"file":"lifecycle-events.d.ts","sourceRoot":"","sources":["../../src/client/lifecycle-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,iEAAiE;AACjE,MAAM,WAAW,qBAAqB;IAClC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;CACxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,GAChB,IAAI,CAMN"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* hand any more. The hand-mirrored union this file used to carry, and the compile-time
|
|
16
16
|
* guard in engine that policed it, went with the mirror (audit 2026-08-28, D1). A
|
|
17
17
|
* consumer wires a runner through `AparteClientOptions.streamRunner` — the same
|
|
18
|
-
* pattern as `approvalResolver` (HITL)
|
|
18
|
+
* pattern as `approvalResolver` (HITL).
|
|
19
19
|
*/
|
|
20
20
|
import type { AparteConfig } from '../config/aparte-config.js';
|
|
21
21
|
import type { AparteSegment, AparteMessage, AparteStreamEvent } from '../types/index.js';
|
|
@@ -69,18 +69,8 @@ export interface CreateStreamAdapterOptions {
|
|
|
69
69
|
target: StreamAdapterTarget;
|
|
70
70
|
/** Config for tool-renderer lookup + per-tool style injection. */
|
|
71
71
|
config: AparteConfig;
|
|
72
|
-
/** The streamed assistant message id (carried in run
|
|
72
|
+
/** The streamed assistant message id (carried in the run events). */
|
|
73
73
|
messageId: string;
|
|
74
|
-
/**
|
|
75
|
-
* Code-fence promotion hint (`baseRequest._meta.artifactHint`). When set, the
|
|
76
|
-
* first `code` segment produced by the text parser is promoted to an artifact
|
|
77
|
-
* — the one `_streamLoop` mechanism that stays adapter-side (it needs the
|
|
78
|
-
* parser). Absent for the raw / XML / create_artifact modes.
|
|
79
|
-
*/
|
|
80
|
-
artifactHint?: {
|
|
81
|
-
mimeType: string;
|
|
82
|
-
kind: string;
|
|
83
|
-
};
|
|
84
74
|
}
|
|
85
75
|
/**
|
|
86
76
|
* Build the event → DOM adapter for one streamed message. Returns a synchronous
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-adapter.d.ts","sourceRoot":"","sources":["../../src/client/stream-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"stream-adapter.d.ts","sourceRoot":"","sources":["../../src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AAE,WAAW,GAAG,IAAI,CAAC;IAChD,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;CACxC;AAED,MAAM,WAAW,0BAA0B;IACvC,4DAA4D;IAC5D,MAAM,EAAE,mBAAmB,CAAC;IAC5B,kEAAkE;IAClE,MAAM,EAAE,YAAY,CAAC;IACrB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,sBAAsB,CAuK5F;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,MAAM,EAAE,cAAc,CAAC,iBAAiB,CAAC,EACzC,MAAM,EAAE,WAAW,GACpB,aAAa,CAAC,iBAAiB,CAAC,CA4BlC"}
|
|
@@ -58,6 +58,7 @@ import type { AparteSegment, AparteAttachment, AparteUsage, AparteMessage } from
|
|
|
58
58
|
* @fires {CustomEvent<AparteMessageInfoEventDetail>} aparte-message-info - The info affordance was pressed.
|
|
59
59
|
* @fires {CustomEvent<AparteBranchNavigateEventDetail>} aparte-branch-navigate - The `‹1/2›` picker moved between sibling versions.
|
|
60
60
|
* @fires {CustomEvent<AparteAttachmentPreviewEventDetail>} aparte-attachment-preview - An attached image was clicked, asking the app to open it full-size.
|
|
61
|
+
* @fires {CustomEvent<AparteLinkClickEventDetail>} aparte-link-click - A link in the message body is about to be followed. Cancelable: `preventDefault()` keeps the browser from navigating, so a host can route the link itself.
|
|
61
62
|
*
|
|
62
63
|
* @cssprop [--aparte-message-gap=12px] - Gap between the avatar column and the body (the viewport reuses it between messages).
|
|
63
64
|
* @cssprop [--aparte-message-padding=16px 12px] - Padding around one message row.
|
|
@@ -65,7 +66,7 @@ import type { AparteSegment, AparteAttachment, AparteUsage, AparteMessage } from
|
|
|
65
66
|
*
|
|
66
67
|
* @cssprop [--aparte-message-content-radius=14px] - Radius of the painted content box.
|
|
67
68
|
* @cssprop [--aparte-message-content-padding=10px 14px] - Padding of the USER box only; the assistant's content is plain full-width prose.
|
|
68
|
-
* @cssprop
|
|
69
|
+
* @cssprop --aparte-message-content-bg-user - Background of the user box: a wash of `--aparte-primary` over `--aparte-surface-1`, derived in `theme.css` so a rebrand moves it (declare it to override).
|
|
69
70
|
* @cssprop [--aparte-message-content-bg-assistant=transparent] - Background of the assistant box — transparent on purpose (AI-chat convention, not messaging).
|
|
70
71
|
* @cssprop [--aparte-message-content-text-user=var(--aparte-text)] - Text colour inside the user box.
|
|
71
72
|
* @cssprop [--aparte-message-content-text-assistant=var(--aparte-text)] - Text colour inside the assistant box.
|
|
@@ -340,6 +341,17 @@ export declare class AparteChatBubble extends HTMLElement {
|
|
|
340
341
|
* stacked listeners twice before (the viewport, and `aparte-select`).
|
|
341
342
|
*/
|
|
342
343
|
private _onBranchPickerClick;
|
|
344
|
+
/**
|
|
345
|
+
* A link the MODEL wrote is about to be followed. Announced as a cancelable event
|
|
346
|
+
* before the browser acts, so a host can route it — an external browser, a
|
|
347
|
+
* confirmation, an embedded view — without intercepting the DOM (issue #38). With
|
|
348
|
+
* no listener the browser follows it, which the sanitizer has already made open in
|
|
349
|
+
* a new tab for an external URL; `preventDefault()` on the event cancels the click.
|
|
350
|
+
*
|
|
351
|
+
* Only anchors inside the message body: the action bar and the branch picker are
|
|
352
|
+
* buttons, and an attachment tile is its own event.
|
|
353
|
+
*/
|
|
354
|
+
private _onLinkClick;
|
|
343
355
|
/**
|
|
344
356
|
* Whether a reply is streaming somewhere in this bubble's transcript. Set by the
|
|
345
357
|
* viewport (`data-busy` on it, pushed here), read once on connect for a bubble
|
|
@@ -351,6 +363,38 @@ export declare class AparteChatBubble extends HTMLElement {
|
|
|
351
363
|
private _applyTranscriptBusy;
|
|
352
364
|
private _updateBranchPicker;
|
|
353
365
|
private _updateActionBar;
|
|
366
|
+
/**
|
|
367
|
+
* `role="toolbar"` promises a keyboard model. This is it.
|
|
368
|
+
*
|
|
369
|
+
* The bar has announced itself as a toolbar since it existed, and a toolbar is ONE
|
|
370
|
+
* tab stop whose members are reached with the arrow keys — that is the whole of what
|
|
371
|
+
* the role means to a screen-reader user. What shipped was five independent tab
|
|
372
|
+
* stops per message, so the role described a behaviour that did not exist: a reader
|
|
373
|
+
* told to press Right heard nothing move, and tabbing through a long transcript
|
|
374
|
+
* walked every button of every message.
|
|
375
|
+
*
|
|
376
|
+
* The roving index is re-applied from `_syncFooterVisibility`, which is the single
|
|
377
|
+
* funnel all three build paths already run through (the flag-driven bar, the edit
|
|
378
|
+
* bar, and the branch picker's own visibility pass). Re-deriving it there rather
|
|
379
|
+
* than in each builder is what keeps the invariant true after a `setBubbleActions`
|
|
380
|
+
* rebuild — the drift this pattern usually dies of.
|
|
381
|
+
*
|
|
382
|
+
* DISABLED buttons are skipped, not merely un-tabbable: while the transcript is busy
|
|
383
|
+
* retry and edit are disabled, and a toolbar whose arrows stop on a dead control
|
|
384
|
+
* reads as broken. If every button is disabled the bar keeps one tab stop anyway, so
|
|
385
|
+
* focus sitting there when the turn ends is not thrown to the top of the page.
|
|
386
|
+
*/
|
|
387
|
+
private _rovingButtons;
|
|
388
|
+
private _setRovingIndex;
|
|
389
|
+
/**
|
|
390
|
+
* Left/Right walk the bar, Home/End jump to its ends, and both wrap.
|
|
391
|
+
*
|
|
392
|
+
* Arrow keys follow the READING direction, per the ARIA practices: in an RTL
|
|
393
|
+
* transcript Left is "next". `dir` is resolved from the nearest ancestor that sets
|
|
394
|
+
* it — the viewport writes it from `locale.direction` — because a bubble has none of
|
|
395
|
+
* its own and `getComputedStyle` is not something jsdom can answer.
|
|
396
|
+
*/
|
|
397
|
+
private _onActionBarKeydown;
|
|
354
398
|
/**
|
|
355
399
|
* An empty action bar is not a bar: with every action off it was still a
|
|
356
400
|
* `role="toolbar"` with nothing in it (announced as such), and it still reserved
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-chat-bubble.d.ts","sourceRoot":"","sources":["../../../src/components/bubble/aparte-chat-bubble.ts"],"names":[],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IAwG1B;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IA8BtB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IA4BrB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,gBAAgB;CAsBzB"}
|
|
@@ -70,6 +70,5 @@ export declare class AparteComposerAttachments extends HTMLElement {
|
|
|
70
70
|
private _render;
|
|
71
71
|
/** Uppercased file extension (≤4 chars), or 'FILE' when there is none. */
|
|
72
72
|
private _ext;
|
|
73
|
-
private _escape;
|
|
74
73
|
}
|
|
75
74
|
//# sourceMappingURL=aparte-composer-attachments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-composer-attachments.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-attachments.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,qBAAa,yBAA0B,SAAQ,WAAW;IACtD,OAAO,CAAC,aAAa,CAAsB;IAC3C,+EAA+E;IAC/E,OAAO,CAAC,WAAW,CAAgB;IAEnC,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAQ5B,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,cAAc;IAYtB,kEAAkE;IAClE,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"aparte-composer-attachments.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-attachments.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,qBAAa,yBAA0B,SAAQ,WAAW;IACtD,OAAO,CAAC,aAAa,CAAsB;IAC3C,+EAA+E;IAC/E,OAAO,CAAC,WAAW,CAAgB;IAEnC,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAQ5B,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,cAAc;IAYtB,kEAAkE;IAClE,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,OAAO;IAmEf,0EAA0E;IAC1E,OAAO,CAAC,IAAI;CAIf"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Submit button primitive for <aparte-composer>.
|
|
3
3
|
*
|
|
4
|
-
* One control,
|
|
5
|
-
* an elicitation panel is open — **submit**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* One control, three meanings: **send**, **stop** while the root is streaming, and — when
|
|
5
|
+
* an elicitation panel is open — **submit** the answer; a panel whose mode is `'none'`
|
|
6
|
+
* (its options settle on the click) takes the button out of the layout entirely. The
|
|
7
|
+
* panel outranks streaming: while one is open the button stays the answer control and a
|
|
8
|
+
* streaming change is ignored. The icon moves with the meaning (paper plane, square,
|
|
9
|
+
* check), because a paper plane that means "answer" is a lie. All three are decided by the root's state
|
|
10
10
|
* — its `value`, `attachments`, `disabled`, `streaming` and the panel payload it
|
|
11
11
|
* broadcasts — not by anything this element owns, which is why it recomputes its chrome
|
|
12
12
|
* rather than re-rendering: a rebuild would put a paper plane back mid-stream, drop out
|
|
@@ -91,14 +91,14 @@ export declare class AparteComposerSend extends HTMLElement {
|
|
|
91
91
|
*/
|
|
92
92
|
private _refreshChrome;
|
|
93
93
|
/**
|
|
94
|
-
* Panel open: this one button now means "
|
|
95
|
-
* where you are in the form.
|
|
94
|
+
* Panel open: this one button now means "submit the answer".
|
|
96
95
|
*
|
|
97
96
|
* The icon has to move with the meaning: it drew a paper plane while the label
|
|
98
97
|
* already said "Submit", so it read as "send a message" while it meant "answer
|
|
99
|
-
* this question".
|
|
100
|
-
*
|
|
101
|
-
*
|
|
98
|
+
* this question". It used to draw a chevron too, while a form had questions
|
|
99
|
+
* ahead, and turn into a "Next" — a second way to do what the panel's chips do,
|
|
100
|
+
* and a button whose meaning changed under the pointer. It is disabled instead
|
|
101
|
+
* until every question has an answer, which is what the chips' marks explain.
|
|
102
102
|
*/
|
|
103
103
|
private _syncPanelState;
|
|
104
104
|
private _handleClick;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-composer-send.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-send.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;IAC/C,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,aAAa,CAAsB;IAC3C;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAA2F;IAGzG,OAAO,CAAC,QAAQ,CAAgC;IAEhD,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAQ5B,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,cAAc;IAgCtB;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAOtB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;
|
|
1
|
+
{"version":3,"file":"aparte-composer-send.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-send.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;IAC/C,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,aAAa,CAAsB;IAC3C;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAA2F;IAGzG,OAAO,CAAC,QAAQ,CAAgC;IAEhD,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAQ5B,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,cAAc;IAgCtB;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAOtB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,mBAAmB;IAiB3B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;CAGvB"}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* What the composer's one button means while a panel is up — and whether it is
|
|
3
3
|
* there at all.
|
|
4
4
|
*
|
|
5
|
-
* `'submit'` answers, `'
|
|
6
|
-
* `'
|
|
5
|
+
* `'submit'` answers, and `'none'` says this panel has NO act left for that button,
|
|
6
|
+
* so it is not drawn. (`'advance'` — the button as a "next" through a form — is gone:
|
|
7
|
+
* the chips are the navigation, and a button that changes meaning under the pointer
|
|
8
|
+
* was one more thing to explain.)
|
|
7
9
|
*
|
|
8
10
|
* `'none'` exists because a panel could not previously say it. The composer's panel
|
|
9
11
|
* mode was one fixed policy — hide the input and the attachment picker, keep the
|
|
@@ -16,7 +18,7 @@
|
|
|
16
18
|
* Named rather than inlined at each of its six readers: this union is exactly the
|
|
17
19
|
* kind of list this repo has watched drift when every reader kept its own copy.
|
|
18
20
|
*/
|
|
19
|
-
export type AparteComposerPanelMode = '
|
|
21
|
+
export type AparteComposerPanelMode = 'submit' | 'none';
|
|
20
22
|
export interface AparteComposerEventMap {
|
|
21
23
|
'value-change': {
|
|
22
24
|
value: string;
|
|
@@ -105,7 +107,15 @@ export interface AparteComposerChangeEventDetail {
|
|
|
105
107
|
* the question" instead — it calls the panel's `onSubmit` and returns, so neither the
|
|
106
108
|
* stop branch nor a send is reached.
|
|
107
109
|
*
|
|
108
|
-
* The streaming flag comes from WINDOW lifecycle events, filtered by target
|
|
110
|
+
* The streaming flag comes from WINDOW lifecycle events, filtered by target:
|
|
111
|
+
* `aparte-message-start` sets it, and any of `aparte-message-done` /
|
|
112
|
+
* `aparte-message-error` / `aparte-message-aborted` clears it (and evicts an open
|
|
113
|
+
* panel). `AparteClient` dispatches them on the chat host, bubbling, so they reach
|
|
114
|
+
* both this element's `window` listener and the host-bound readers; a host that runs
|
|
115
|
+
* its own loop dispatches the same two (start, done) the same way, with
|
|
116
|
+
* `detail.targetId` set to this composer's `target` — that is the whole contract,
|
|
117
|
+
* documented under
|
|
118
|
+
* "Make the composer follow your turn" in the bring-your-own-loop guide. On a page
|
|
109
119
|
* with two chats, give the composer a `target` — or put it under a chat host that has
|
|
110
120
|
* an `id` — otherwise it answers to every chat's events, and one chat's Stop resets the
|
|
111
121
|
* other's composer and evicts its open panel.
|
|
@@ -292,9 +302,8 @@ export declare class AparteComposer extends HTMLElement {
|
|
|
292
302
|
* are the user's state and not an action to offer — hiding them would look like
|
|
293
303
|
* losing them; and the toolbar, because switching model still does something.
|
|
294
304
|
*
|
|
295
|
-
* The send button is the part the PANEL decides, through `mode`. `'submit'`
|
|
296
|
-
*
|
|
297
|
-
* drawn. That third value is what a panel whose options settle on the first click
|
|
305
|
+
* The send button is the part the PANEL decides, through `mode`. `'submit'`
|
|
306
|
+
* keeps it; `'none'` says this panel has no act for it and it is not drawn. That third value is what a panel whose options settle on the first click
|
|
298
307
|
* needs — a single-choice question, an approval — and until it existed such a
|
|
299
308
|
* panel left a permanently disabled button beside options that never routed
|
|
300
309
|
* through it. Flip between them at any time with {@link setPanelSubmitEnabled},
|
|
@@ -361,10 +370,10 @@ export declare class AparteComposer extends HTMLElement {
|
|
|
361
370
|
/**
|
|
362
371
|
* Update the send button's state while a panel is active.
|
|
363
372
|
*
|
|
364
|
-
* `mode` moves with it because both change on the same event —
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
373
|
+
* `mode` moves with it because both can change on the same event — opening the
|
|
374
|
+
* "Other…" field of a panel whose options settle on the click gives the button
|
|
375
|
+
* an act it did not have — and two separate calls would flash a wrong state
|
|
376
|
+
* between them.
|
|
368
377
|
*/
|
|
369
378
|
setPanelSubmitEnabled(enabled: boolean, mode?: AparteComposerPanelMode): void;
|
|
370
379
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-composer.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"aparte-composer.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAKxD,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,kBAAkB,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3C,iBAAiB,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IACzC,oBAAoB,EAAE;QAAE,WAAW,EAAE,IAAI,EAAE,CAAA;KAAE,CAAC;IAC9C,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,IAAI,EAAE,CAAA;KAAE,CAAC;IACjD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChC,cAAc,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,uBAAuB,CAAA;KAAE,CAAC;CAC9F;AAED,MAAM,MAAM,uBAAuB,GAAG,MAAM,sBAAsB,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,IAAI,EAAE,CAAC;IACpB,2EAA2E;IAC3E,WAAW,EAAE,OAAO,CAAC;I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BAAuB,GAAG,IAAI;IAQ7E;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IAKzB,IAAI,WAAW,IAAI,OAAO,CAA8B;IAExD;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAO1B,oFAAoF;IACpF,MAAM,IAAI,IAAI;IAuCd,6CAA6C;IAC7C,MAAM,IAAI,IAAI;IA2Bd;;;;OAIG;IACH,KAAK,IAAI,IAAI;IAMb,sDAAsD;IAC7C,KAAK,IAAI,IAAI;IAOtB,KAAK,CAAC,CAAC,SAAS,uBAAuB,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,IAAI;IAa5F,GAAG,CAAC,CAAC,SAAS,uBAAuB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAQ9G;;mFAE+E;IAC/E,OAAO,CAAC,kBAAkB;IAK1B;;;;;;;;;;;;;;;;OAgBG;IACH;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,kBAAkB;CAO7B"}
|
|
@@ -25,12 +25,16 @@ export interface AparteContextThresholdEventDetail {
|
|
|
25
25
|
* Two thresholds turn it `warn` then `danger` (`data-level`), and crossing one fires
|
|
26
26
|
* `aparte-context-threshold`. With `auto-compact`, reaching `danger` dispatches
|
|
27
27
|
* `aparte-compact` for its chat — once, until the level drops again — which is what
|
|
28
|
-
* a gauge that turns red and then does nothing was missing.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* a gauge that turns red and then does nothing was missing. What answers the command
|
|
29
|
+
* is `@aparte/plugin-compaction` (`setupCompaction()`): it summarises what no longer
|
|
30
|
+
* fits the window and keeps the recent turns. Core itself does not compact — the
|
|
31
|
+
* gauge asks, the plugin does, and a page without the plugin gets a gauge that only
|
|
32
|
+
* measures.
|
|
31
33
|
*
|
|
32
|
-
* The bar wears the `aparte-progress` recipe
|
|
33
|
-
*
|
|
34
|
+
* The bar wears the `aparte-progress` recipe. `variant="ring"` draws the same reading
|
|
35
|
+
* as a ring with the percentage beside it — for a toolbar, where a bar wants a width
|
|
36
|
+
* and a ring wants none; the full reading is the ring's `title`. The two share the
|
|
37
|
+
* levels, the events and the accessible name; only the drawing differs.
|
|
34
38
|
*
|
|
35
39
|
* @element aparte-context
|
|
36
40
|
*
|
|
@@ -39,15 +43,31 @@ export interface AparteContextThresholdEventDetail {
|
|
|
39
43
|
* @attr {number} danger - Fraction at which it turns `danger`. Default `0.9`.
|
|
40
44
|
* @attr {boolean} auto-compact - Dispatch `aparte-compact` on reaching `danger` (once per crossing).
|
|
41
45
|
* @attr {string} target - The id of the `<aparte-chat>` to watch, when the element is not under it.
|
|
46
|
+
* @attr {string} variant - `bar` (default) or `ring`: a progress bar with the reading beside it, or a ring with the percentage.
|
|
42
47
|
* @attr {string} data-level - Reflected BY the element: `ok`, `warn` or `danger`. Read-only.
|
|
43
48
|
* @attr {boolean} data-empty - Reflected BY the element while it has nothing to show. Read-only.
|
|
44
49
|
*
|
|
45
50
|
* @fires {CustomEvent<AparteContextThresholdEventDetail>} aparte-context-threshold - The level changed. Bubbles.
|
|
51
|
+
* @fires {CustomEvent<AparteCompactEventDetail>} aparte-compact - Dispatched on `window` when `auto-compact` is set and the gauge first reaches `danger`: compact this target's transcript. Once per crossing, and only while the attribute is present. `@aparte/plugin-compaction` answers it; with no listener nothing happens.
|
|
52
|
+
*
|
|
53
|
+
* @cssprop [--aparte-context-ring-size=22px] - Diameter of the ring variant.
|
|
54
|
+
* @cssprop [--aparte-context-ring-stroke=4] - Thickness of the ring, in its own units (the ring is drawn on a 36-unit box).
|
|
46
55
|
*
|
|
47
56
|
* @example
|
|
57
|
+
* <!-- The same gauge twice: the bar takes the room it is given, the ring takes none. -->
|
|
48
58
|
* <aparte-composer-toolbar>
|
|
49
|
-
* <aparte-context auto-compact style="flex: 1"></aparte-context>
|
|
59
|
+
* <aparte-context window="128000" auto-compact style="flex: 1"></aparte-context>
|
|
60
|
+
* <aparte-context window="128000" variant="ring"></aparte-context>
|
|
50
61
|
* </aparte-composer-toolbar>
|
|
62
|
+
*
|
|
63
|
+
* <script>
|
|
64
|
+
* // The gauge reads what each turn reports; it draws nothing before the first one.
|
|
65
|
+
* // This is a provider's usage after a long conversation: 78% of a 128k window,
|
|
66
|
+
* // past the `warn` threshold.
|
|
67
|
+
* window.dispatchEvent(new CustomEvent('aparte-message-done', {
|
|
68
|
+
* detail: { usage: { inputTokens: 99400, outputTokens: 600 } },
|
|
69
|
+
* }));
|
|
70
|
+
* </script>
|
|
51
71
|
*/
|
|
52
72
|
export declare class AparteContext extends HTMLElement {
|
|
53
73
|
static get observedAttributes(): string[];
|
|
@@ -58,10 +78,13 @@ export declare class AparteContext extends HTMLElement {
|
|
|
58
78
|
/**
|
|
59
79
|
* After a real compaction the context is smaller by an amount nobody has measured
|
|
60
80
|
* yet — the next turn's usage will say. Until then the gauge shows nothing rather
|
|
61
|
-
* than a number it knows to be wrong.
|
|
62
|
-
* multi-chat page
|
|
81
|
+
* than a number it knows to be wrong. The event names the chat it compacted, so on a
|
|
82
|
+
* multi-chat page only that chat's gauge resets; an unnamed one resets every gauge,
|
|
83
|
+
* and each is right again one turn later.
|
|
63
84
|
*/
|
|
64
85
|
private _onCompacted;
|
|
86
|
+
/** A failed compaction spends the request too; the next `danger` asks again. */
|
|
87
|
+
private _onCompactError;
|
|
65
88
|
private _onRerender;
|
|
66
89
|
/** Tokens the last turn reported, or `null` before the first turn. */
|
|
67
90
|
get used(): number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-context.d.ts","sourceRoot":"","sources":["../../../src/components/context/aparte-context.ts"],"names":[],"mappings":"AAGA,0DAA0D;AAC1D,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,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