@aparte/core 0.13.0 → 0.14.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 +2 -2
- package/dist/client/aparte-client.d.ts +36 -35
- package/dist/client/aparte-client.d.ts.map +1 -1
- package/dist/client/stream-adapter.d.ts +37 -145
- package/dist/client/stream-adapter.d.ts.map +1 -1
- package/dist/components/bubble/aparte-chat-bubble.d.ts +10 -2
- package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-add-attachment.d.ts +6 -6
- package/dist/components/composer/aparte-composer-add-attachment.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-input.d.ts +9 -1
- package/dist/components/composer/aparte-composer-input.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer.d.ts +12 -3
- package/dist/components/composer/aparte-composer.d.ts.map +1 -1
- package/dist/components/context/aparte-context.d.ts +81 -0
- package/dist/components/context/aparte-context.d.ts.map +1 -0
- package/dist/components/context/index.d.ts +3 -0
- package/dist/components/context/index.d.ts.map +1 -0
- package/dist/components/elicitation/aparte-elicitation.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/suggestions/aparte-suggestions.d.ts +95 -0
- package/dist/components/suggestions/aparte-suggestions.d.ts.map +1 -0
- package/dist/components/suggestions/index.d.ts +3 -0
- package/dist/components/suggestions/index.d.ts.map +1 -0
- package/dist/components/viewport/aparte-chat-viewport.d.ts +37 -7
- package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
- package/dist/config/aparte-config.d.ts +1 -21
- package/dist/config/aparte-config.d.ts.map +1 -1
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/locale.d.ts +30 -1
- package/dist/config/locale.d.ts.map +1 -1
- package/dist/conversations/index.d.ts +1 -1
- package/dist/conversations/index.d.ts.map +1 -1
- package/dist/conversations/types.d.ts +9 -57
- package/dist/conversations/types.d.ts.map +1 -1
- package/dist/custom-elements.json +6484 -6103
- package/dist/generated/element-attributes.d.ts +34 -6
- package/dist/generated/element-attributes.d.ts.map +1 -1
- package/dist/{glyphs-QXfbL3n_.js → glyphs-B3BZ2TIb.js} +21 -21
- package/dist/glyphs-B3BZ2TIb.js.map +1 -0
- package/dist/host/aparte-chat-host.d.ts +1 -1
- package/dist/host/aparte-chat-host.d.ts.map +1 -1
- package/dist/icons/extended.d.ts +87 -85
- package/dist/icons/extended.d.ts.map +1 -1
- package/dist/icons/glyphs.d.ts +53 -50
- package/dist/icons/glyphs.d.ts.map +1 -1
- package/dist/icons.js +41 -41
- package/dist/icons.js.map +1 -1
- package/dist/index.css +539 -172
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +609 -183
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +6 -4
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +56 -56
- package/dist/index.node.js.map +1 -1
- package/dist/{is-awaiting-reply-DrO_oR32.js → is-awaiting-reply-BZ_iJ3s3.js} +188 -1017
- package/dist/is-awaiting-reply-BZ_iJ3s3.js.map +1 -0
- package/dist/parsers/aparte-stream-parser.d.ts +6 -17
- package/dist/parsers/aparte-stream-parser.d.ts.map +1 -1
- package/dist/primitives/select/aparte-select.d.ts +2 -2
- package/dist/primitives/select/aparte-select.d.ts.map +1 -1
- package/dist/renderers/segment-renderers.d.ts +18 -0
- package/dist/renderers/segment-renderers.d.ts.map +1 -1
- package/dist/renderers/segments/tool-call.d.ts.map +1 -1
- package/dist/runtime/message-repository.d.ts +7 -0
- package/dist/runtime/message-repository.d.ts.map +1 -1
- package/dist/transport/types.d.ts +8 -0
- package/dist/transport/types.d.ts.map +1 -1
- package/dist/types/chat.d.ts +32 -38
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/errors.d.ts +16 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/event-map.d.ts +4 -0
- package/dist/types/event-map.d.ts.map +1 -1
- package/dist/types/events.d.ts +15 -0
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/models.d.ts +1 -8
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/segments.d.ts +1 -13
- package/dist/types/segments.d.ts.map +1 -1
- package/dist/types/tools.d.ts +1 -1
- package/dist/utils/chat-boundary.d.ts +8 -4
- package/dist/utils/chat-boundary.d.ts.map +1 -1
- package/package.json +5 -2
- package/dist/client/xml-artifact-feed.d.ts +0 -76
- package/dist/client/xml-artifact-feed.d.ts.map +0 -1
- package/dist/config/skeleton-provider.d.ts +0 -26
- package/dist/config/skeleton-provider.d.ts.map +0 -1
- package/dist/glyphs-QXfbL3n_.js.map +0 -1
- package/dist/is-awaiting-reply-DrO_oR32.js.map +0 -1
- package/dist/renderers/segments/pipeline-waiting.d.ts +0 -3
- package/dist/renderers/segments/pipeline-waiting.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @aparte/core
|
|
2
2
|
|
|
3
|
-
Framework-agnostic AI-chat UI as **vanilla Web Components** — zero
|
|
3
|
+
Framework-agnostic AI-chat UI as **vanilla Web Components** — zero third-party dependencies,
|
|
4
4
|
ESM-only, usable in any framework or none.
|
|
5
5
|
|
|
6
6
|
> **Alpha.** On npm, released in lockstep with every other `@aparte/*` package — the
|
|
@@ -72,7 +72,7 @@ every CI run.
|
|
|
72
72
|
- **Theming** — restyle everything through `--aparte-*` CSS variables (Light DOM, no forking).
|
|
73
73
|
- **Customization** — icons, render hooks, and a zoned action registry via `aparteGlobalConfig`.
|
|
74
74
|
|
|
75
|
-
Zero
|
|
75
|
+
Zero third-party dependencies (the agent loop, `@aparte/engine`, is the one first-party dependency): Markdown, syntax highlighting, etc. are **opt-in** providers you inject.
|
|
76
76
|
ESM-only (CJS consumers use `await import()`).
|
|
77
77
|
|
|
78
78
|
## Docs
|
|
@@ -68,12 +68,11 @@ export interface AparteClientOptions {
|
|
|
68
68
|
*/
|
|
69
69
|
compactionSelector?: AparteCompactionSelector;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* ({
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* engine. Same injection pattern as {@link approvalResolver} /
|
|
71
|
+
* The stream-loop runner. Default: `@aparte/engine`'s `runStreamAgent`, rendered
|
|
72
|
+
* through the core adapter ({@link createStreamAdapter}). Set it to wrap that loop
|
|
73
|
+
* — `(opts) => runStreamAgent({ ...opts, onHistoryAppend })` for a host that owns
|
|
74
|
+
* its transcript — or to replace it with a loop of your own that emits the same
|
|
75
|
+
* events. Same injection pattern as {@link approvalResolver} /
|
|
77
76
|
* {@link compactionSelector}. See {@link AparteStreamRunner}.
|
|
78
77
|
*/
|
|
79
78
|
streamRunner?: AparteStreamRunner;
|
|
@@ -173,6 +172,26 @@ export interface AparteClientOptions {
|
|
|
173
172
|
*/
|
|
174
173
|
config?: AparteConfig;
|
|
175
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* AparteClient
|
|
177
|
+
*
|
|
178
|
+
* The "Automatic Transmission" for Aparte.
|
|
179
|
+
* Connects the UI events (aparte-send) to the AI Providers (chat).
|
|
180
|
+
* Handles:
|
|
181
|
+
* - Listening to send events
|
|
182
|
+
* - Resolving API keys
|
|
183
|
+
* - Calling the appropriate Provider
|
|
184
|
+
* - Streaming the response back to the UI
|
|
185
|
+
* - Tool use: awaiting handlers and re-calling the provider
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* const client = new AparteClient({
|
|
190
|
+
* keyResolver: (providerId) => process.env[providerId.toUpperCase() + '_KEY']
|
|
191
|
+
* });
|
|
192
|
+
* client.start();
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
176
195
|
export declare class AparteClient {
|
|
177
196
|
private _boundHandler;
|
|
178
197
|
private _boundAbortHandler;
|
|
@@ -197,6 +216,8 @@ export declare class AparteClient {
|
|
|
197
216
|
private _isForThisInstance;
|
|
198
217
|
/** Aborts the in-flight vendor/transport fetch when the user stops a stream. */
|
|
199
218
|
private _streamController;
|
|
219
|
+
/** Aborts an in-flight `compact()` summarisation — its own slot, see `compact`. */
|
|
220
|
+
private _compactController;
|
|
200
221
|
private options;
|
|
201
222
|
/** Config read by this client — an instance config, or the global default. */
|
|
202
223
|
private readonly _config;
|
|
@@ -407,15 +428,6 @@ export declare class AparteClient {
|
|
|
407
428
|
* - Other binary files → silently ignored.
|
|
408
429
|
*/
|
|
409
430
|
private _filesToContentParts;
|
|
410
|
-
/**
|
|
411
|
-
* Turn-1 forced tool call. When `toolChoice = { name, input }`
|
|
412
|
-
* (orchestrator-driven), execute the handler directly instead of consulting
|
|
413
|
-
* the LLM, render the tool segment, inject the result as `tool_result`, and
|
|
414
|
-
* strip `toolChoice` for the follow-up turn. Returns the (possibly-updated)
|
|
415
|
-
* request and whether the loop should skip to the next turn (handler missing
|
|
416
|
-
* or aborted). Extracted from `_streamLoop`. `messages` is mutated in place.
|
|
417
|
-
*/
|
|
418
|
-
private _maybeRunSyntheticTool;
|
|
419
431
|
/**
|
|
420
432
|
* What the loop does after one tool call. THREE outcomes, because a boolean
|
|
421
433
|
* conflated two questions that a refusal answers differently.
|
|
@@ -428,26 +440,18 @@ export declare class AparteClient {
|
|
|
428
440
|
* - `'halt'` — the run is over: an abort, a turn limit, a missing handler.
|
|
429
441
|
*/
|
|
430
442
|
/**
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
* approval gate, and running the registered handler (timeout / abort).
|
|
434
|
-
* Mutates the shared `messages` / `toolCallsThisTurn` history in place and
|
|
435
|
-
* returns what the loop should do next.
|
|
436
|
-
*/
|
|
437
|
-
private _handleToolUseEvent;
|
|
438
|
-
/**
|
|
439
|
-
* Stream loop: runs one provider.chat() call and repeats if a tool was called.
|
|
440
|
-
* Maintains a running messages array to inject tool_call / tool_result turns.
|
|
443
|
+
* The turn's agent loop — the engine's `runStreamAgent` rendered through the core
|
|
444
|
+
* adapter, or the runner a host injected — after the fetch-level abort bookkeeping.
|
|
441
445
|
*/
|
|
442
446
|
private _streamLoop;
|
|
443
447
|
/**
|
|
444
|
-
*
|
|
445
|
-
* rendering its DOM-free events through {@link createStreamAdapter}.
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
448
|
+
* Run the loop through a {@link AparteStreamRunner} — the engine's by default —
|
|
449
|
+
* rendering its DOM-free events through {@link createStreamAdapter}. Builds the
|
|
450
|
+
* runner's dependencies from this client's config / provider / transport. The
|
|
451
|
+
* leading writes (status streaming, prefix segments) happen here; the runner's
|
|
452
|
+
* `run-start` re-asserts `streaming` idempotently. The call sequence this
|
|
453
|
+
* produces is pinned by the `stream-parity` suite's snapshots, recorded while
|
|
454
|
+
* the inline loop it replaced still ran beside it.
|
|
451
455
|
*/
|
|
452
456
|
private _runViaStreamRunner;
|
|
453
457
|
/**
|
|
@@ -458,8 +462,5 @@ export declare class AparteClient {
|
|
|
458
462
|
* Gracefully handles errors by updating the current message instead of duplicating it
|
|
459
463
|
*/
|
|
460
464
|
private _handleLifecycleError;
|
|
461
|
-
/** Warn once per client for an unrecognised stream event, then carry on. */
|
|
462
|
-
private _warnedUnknownEvents;
|
|
463
|
-
private _warnUnknownStreamEvent;
|
|
464
465
|
}
|
|
465
466
|
//# sourceMappingURL=aparte-client.d.ts.map
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"aparte-client.d.ts","sourceRoot":"","sources":["../../src/client/aparte-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,4BAA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+DhC"}
|
|
@@ -3,160 +3,52 @@
|
|
|
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 exact `targetElement.*` calls + CustomEvents that
|
|
7
|
-
*
|
|
8
|
-
* `runStreamAgent` (engine, pure Node) + this adapter (core, DOM) reproduce
|
|
9
|
-
*
|
|
6
|
+
* the exact `targetElement.*` calls + CustomEvents that core's inline loop
|
|
7
|
+
* performed, using the **real** `AparteStreamParser` and tool renderers. So
|
|
8
|
+
* `runStreamAgent` (engine, pure Node) + this adapter (core, DOM) reproduce that
|
|
9
|
+
* loop byte-for-byte — and have replaced it (audit 2026-08-28, D1).
|
|
10
10
|
*
|
|
11
|
-
* DEPENDENCY DIRECTION: `@aparte/core`
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `AparteClientOptions.streamRunner`
|
|
18
|
-
* (HITL) and `compactionSelector`.
|
|
11
|
+
* DEPENDENCY DIRECTION: `@aparte/core` depends on `@aparte/engine` — first-party, so
|
|
12
|
+
* the zero-third-party-dependency promise is untouched — never the reverse. The
|
|
13
|
+
* run-event contract is engine's: {@link AparteStreamRunEvent} and its siblings below
|
|
14
|
+
* are `StreamRunEvent` & co under core's names, so there is nothing to keep in sync by
|
|
15
|
+
* hand any more. The hand-mirrored union this file used to carry, and the compile-time
|
|
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
|
|
18
|
+
* pattern as `approvalResolver` (HITL) and `compactionSelector`.
|
|
19
19
|
*/
|
|
20
20
|
import type { AparteConfig } from '../config/aparte-config.js';
|
|
21
21
|
import type { AparteSegment, AparteMessage, AparteStreamEvent } from '../types/index.js';
|
|
22
|
-
import type { AparteUsage
|
|
22
|
+
import type { AparteUsage } from '../types/chat.js';
|
|
23
|
+
import type { StreamRunEvent, StreamRunEmitter, StreamRunOptions, StreamUsage } from '@aparte/engine';
|
|
23
24
|
/**
|
|
24
|
-
* DOM-free run events
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* leaf). See `packages/engine/src/agent/stream-events.ts` for the source of truth
|
|
28
|
-
* and the per-event `_streamLoop` mapping notes.
|
|
25
|
+
* The DOM-free run events `@aparte/engine`'s `runStreamAgent` emits — engine's
|
|
26
|
+
* `StreamRunEvent`, under core's name. See `packages/engine/src/agent/stream-events.ts`
|
|
27
|
+
* for the per-event `_streamLoop` mapping notes.
|
|
29
28
|
*/
|
|
30
|
-
export type AparteStreamRunEvent =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
type: 'turn-start';
|
|
34
|
-
} | {
|
|
35
|
-
type: 'text-delta';
|
|
36
|
-
delta: string;
|
|
37
|
-
reduced?: boolean;
|
|
38
|
-
} | {
|
|
39
|
-
type: 'text-flush';
|
|
40
|
-
} | {
|
|
41
|
-
type: 'thinking-delta';
|
|
42
|
-
delta: string;
|
|
43
|
-
} | {
|
|
44
|
-
type: 'artifact-open';
|
|
45
|
-
id: string;
|
|
46
|
-
mimeType: string;
|
|
47
|
-
kind: string;
|
|
48
|
-
title: string;
|
|
49
|
-
} | {
|
|
50
|
-
type: 'artifact-chunk';
|
|
51
|
-
id: string;
|
|
52
|
-
content: string;
|
|
53
|
-
} | {
|
|
54
|
-
type: 'artifact-close';
|
|
55
|
-
id: string;
|
|
56
|
-
content: string;
|
|
57
|
-
inline: boolean;
|
|
58
|
-
} | {
|
|
59
|
-
type: 'artifact-ready';
|
|
60
|
-
id: string;
|
|
61
|
-
mimeType: string;
|
|
62
|
-
kind: string;
|
|
63
|
-
title: string;
|
|
64
|
-
content: string;
|
|
65
|
-
} | {
|
|
66
|
-
type: 'tool-start';
|
|
67
|
-
toolCallId: string;
|
|
68
|
-
name: string;
|
|
69
|
-
input: unknown;
|
|
70
|
-
} | {
|
|
71
|
-
type: 'tool-awaiting-approval';
|
|
72
|
-
toolCallId: string;
|
|
73
|
-
name: string;
|
|
74
|
-
input: unknown;
|
|
75
|
-
} | {
|
|
76
|
-
type: 'tool-approved';
|
|
77
|
-
toolCallId: string;
|
|
78
|
-
} | {
|
|
79
|
-
type: 'tool-rejected';
|
|
80
|
-
toolCallId: string;
|
|
81
|
-
reason: string;
|
|
82
|
-
} | {
|
|
83
|
-
type: 'tool-resolved';
|
|
84
|
-
toolCallId: string;
|
|
85
|
-
result: string;
|
|
86
|
-
} | {
|
|
87
|
-
type: 'tool-aborted';
|
|
88
|
-
toolCallId: string;
|
|
89
|
-
} | {
|
|
90
|
-
type: 'turn-limit-exceeded';
|
|
91
|
-
scope: 'global' | 'tool';
|
|
92
|
-
limit: number;
|
|
93
|
-
toolCallId?: string;
|
|
94
|
-
} | {
|
|
95
|
-
type: 'phase-advance';
|
|
96
|
-
index: number;
|
|
97
|
-
} | {
|
|
98
|
-
type: 'run-aborted';
|
|
99
|
-
} | {
|
|
100
|
-
type: 'run-done';
|
|
101
|
-
usage?: AparteUsage;
|
|
102
|
-
};
|
|
103
|
-
/** Synchronous, ordered event sink — mirrors engine's `StreamRunEmitter`. */
|
|
104
|
-
export type AparteStreamRunEmitter = (event: AparteStreamRunEvent) => void;
|
|
29
|
+
export type AparteStreamRunEvent = StreamRunEvent;
|
|
30
|
+
/** Synchronous, ordered event sink — engine's `StreamRunEmitter`. */
|
|
31
|
+
export type AparteStreamRunEmitter = StreamRunEmitter;
|
|
105
32
|
/**
|
|
106
|
-
* Options for an injected {@link AparteStreamRunner} —
|
|
107
|
-
*
|
|
108
|
-
*
|
|
33
|
+
* Options for an injected {@link AparteStreamRunner} — engine's `StreamRunOptions`.
|
|
34
|
+
* `AparteClient` builds these from its config / provider / transport and hands them
|
|
35
|
+
* to the runner; core's request, message and tool types are assignable to the
|
|
36
|
+
* structural ones the engine declares, and that assignment is checked where it is
|
|
37
|
+
* made rather than in a guard beside it.
|
|
109
38
|
*/
|
|
110
|
-
export
|
|
111
|
-
messageId: string;
|
|
112
|
-
baseRequest: AparteChatRequest;
|
|
113
|
-
/** Calls the transport; returns the structured stream or a plain string. */
|
|
114
|
-
transportCall: (request: AparteChatRequest) => Promise<AsyncIterable<AparteStreamEvent> | string>;
|
|
115
|
-
/** Resolves a tool's handler by name (mirrors `aparteGlobalConfig.getToolHandler`). */
|
|
116
|
-
toolLookup: (name: string) => ((call: {
|
|
117
|
-
id: string;
|
|
118
|
-
name: string;
|
|
119
|
-
input: Record<string, unknown>;
|
|
120
|
-
}, signal: AbortSignal) => Promise<{
|
|
121
|
-
content: string;
|
|
122
|
-
}>) | undefined;
|
|
123
|
-
/** Resolves a tool's loop config by name (maxTurns / needsApproval). */
|
|
124
|
-
toolConfigLookup?: (name: string) => {
|
|
125
|
-
maxTurns?: number;
|
|
126
|
-
needsApproval?: boolean;
|
|
127
|
-
} | undefined;
|
|
128
|
-
/** HITL approval resolver for `needsApproval` tools. */
|
|
129
|
-
approvalResolver?: (call: {
|
|
130
|
-
id: string;
|
|
131
|
-
name: string;
|
|
132
|
-
input: Record<string, unknown>;
|
|
133
|
-
}, signal: AbortSignal) => Promise<{
|
|
134
|
-
approved: boolean;
|
|
135
|
-
payload?: unknown;
|
|
136
|
-
instruction?: string;
|
|
137
|
-
}>;
|
|
138
|
-
/** The DOM adapter (from {@link createStreamAdapter}). */
|
|
139
|
-
emitter: AparteStreamRunEmitter;
|
|
140
|
-
/** Single abort signal (the client composes `_isAborted` + the controller). */
|
|
141
|
-
signal: AbortSignal;
|
|
142
|
-
maxTurns?: number;
|
|
143
|
-
toolTimeoutMs?: number;
|
|
144
|
-
idGen?: (prefix: string) => string;
|
|
145
|
-
}
|
|
39
|
+
export type AparteStreamRunOptions = StreamRunOptions;
|
|
146
40
|
/**
|
|
147
41
|
* A headless structured-stream loop injected via `AparteClientOptions.streamRunner`
|
|
148
|
-
* — the seam by which a
|
|
149
|
-
* `@aparte/engine`'s `runStreamAgent`
|
|
150
|
-
* imports engine).
|
|
42
|
+
* — the seam by which a host wraps or replaces the loop `AparteClient` runs,
|
|
43
|
+
* which is `@aparte/engine`'s `runStreamAgent` by default.
|
|
151
44
|
*
|
|
152
|
-
* `runStreamAgent`
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* `stream-events.contract.ts` now exists to fail on.
|
|
45
|
+
* `runStreamAgent` IS this type — pass it, do not cast it. An earlier version of this
|
|
46
|
+
* comment advised a cast "if the duck-typed shapes don't line up", which is how the
|
|
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.
|
|
158
50
|
*/
|
|
159
|
-
export type AparteStreamRunner = (opts: AparteStreamRunOptions) => Promise<
|
|
51
|
+
export type AparteStreamRunner = (opts: AparteStreamRunOptions) => Promise<StreamUsage | undefined>;
|
|
160
52
|
/**
|
|
161
53
|
* The imperative surface the adapter drives (subset of `AparteChatTargetElement`).
|
|
162
54
|
* Every method is optional so a partial/mock target degrades gracefully.
|
|
@@ -193,7 +85,7 @@ export interface CreateStreamAdapterOptions {
|
|
|
193
85
|
/**
|
|
194
86
|
* Build the event → DOM adapter for one streamed message. Returns a synchronous
|
|
195
87
|
* {@link AparteStreamRunEmitter} to hand to `runStreamAgent` as its `emitter`.
|
|
196
|
-
* Reproduces
|
|
88
|
+
* Reproduces the inline loop's `targetElement.*` call sequence exactly (validated
|
|
197
89
|
* by the engine parity test against the real loop).
|
|
198
90
|
*/
|
|
199
91
|
export declare function createStreamAdapter(opts: CreateStreamAdapterOptions): AparteStreamRunEmitter;
|
|
@@ -201,8 +93,8 @@ export declare function createStreamAdapter(opts: CreateStreamAdapterOptions): A
|
|
|
201
93
|
* Bridge a `ReadableStream` (what the transport returns) to the
|
|
202
94
|
* `AsyncIterable<AparteStreamEvent>` `runStreamAgent` consumes, cancelling the
|
|
203
95
|
* reader **synchronously** on abort so a user "stop" cuts the in-flight read.
|
|
204
|
-
* Used by
|
|
205
|
-
* runner. Mirrors
|
|
96
|
+
* Used by `AparteClient` when building `transportCall` for the
|
|
97
|
+
* runner. Mirrors the inline loop's `reader.read()` loop + `reader.cancel()`.
|
|
206
98
|
*/
|
|
207
99
|
export declare function readableToAsyncIterable(stream: ReadableStream<AparteStreamEvent>, signal: AbortSignal): AsyncIterable<AparteStreamEvent>;
|
|
208
100
|
//# sourceMappingURL=stream-adapter.d.ts.map
|
|
@@ -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;AAOzF,OAAO,KAAK,EAAE,WAAW,EAAE,
|
|
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;AAOzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKtG;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAElD,qEAAqE;AACrE,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,MAA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,cAAc,CAAC,iBAAiB,CAAC,EACzC,MAAM,EAAE,WAAW,GACpB,aAAa,CAAC,iBAAiB,CAAC,CA4BlC"}
|
|
@@ -44,8 +44,7 @@ import type { AparteSegment, AparteAttachment, AparteUsage, AparteMessage } from
|
|
|
44
44
|
*
|
|
45
45
|
* @element aparte-chat-bubble
|
|
46
46
|
*
|
|
47
|
-
* @attr {string} role - The message role. `
|
|
48
|
-
* @attr {string} data-role - `user` / `assistant` / `system`; what the CSS keys off.
|
|
47
|
+
* @attr {string} data-role - The message role, `user` or `assistant` — the one channel for it, and what the CSS keys off. (`role` is ARIA's attribute; this element sets it to `article` itself and no longer reads a message role from it.)
|
|
49
48
|
* @attr {string} content - Plain text content, for a bubble with no segments.
|
|
50
49
|
* @attr {number | string} timestamp - Epoch milliseconds OR a date string: `_updateTimestamp` accepts either and only coerces when the value is numeric.
|
|
51
50
|
* @attr {string} message-id - How streaming and the action bar address this bubble.
|
|
@@ -341,6 +340,15 @@ export declare class AparteChatBubble extends HTMLElement {
|
|
|
341
340
|
* stacked listeners twice before (the viewport, and `aparte-select`).
|
|
342
341
|
*/
|
|
343
342
|
private _onBranchPickerClick;
|
|
343
|
+
/**
|
|
344
|
+
* Whether a reply is streaming somewhere in this bubble's transcript. Set by the
|
|
345
|
+
* viewport (`data-busy` on it, pushed here), read once on connect for a bubble
|
|
346
|
+
* mounted while the flag was already up. While busy, the branch arrows and the
|
|
347
|
+
* retry/edit actions are disabled — the transcript is read-only except for Stop.
|
|
348
|
+
*/
|
|
349
|
+
private _transcriptBusy;
|
|
350
|
+
setTranscriptBusy(busy: boolean): void;
|
|
351
|
+
private _applyTranscriptBusy;
|
|
344
352
|
private _updateBranchPicker;
|
|
345
353
|
private _updateActionBar;
|
|
346
354
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-chat-bubble.d.ts","sourceRoot":"","sources":["../../../src/components/bubble/aparte-chat-bubble.ts"],"names":[],"mappings":"AAAA,OAAO,K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}
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
* `--aparte-focus-outline-width`, colour from `--aparte-primary`, radius from
|
|
18
18
|
* `--aparte-radius-input`, none of them declared here. The drop handler always calls
|
|
19
19
|
* `preventDefault()`, even while disabled, so the browser can never navigate away to the
|
|
20
|
-
* dropped file. `disabled` on the ROOT removes the drop target
|
|
21
|
-
*
|
|
20
|
+
* dropped file. `disabled` on the ROOT removes the drop target and greys the button;
|
|
21
|
+
* `streaming` does neither — a file queued while a reply arrives is part of preparing
|
|
22
|
+
* the next message, and only the send is gated meanwhile.
|
|
22
23
|
*
|
|
23
24
|
* The label and the icon are not attributes — they come from the config (`t('actionUpload')`
|
|
24
25
|
* and the `paperclip` icon), so a locale or icon-provider change rewrites the existing
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
*
|
|
27
28
|
* A child already carrying `class="aparte-caa-button"` suppresses core's own render — and
|
|
28
29
|
* core then wires nothing to it: no click listener (so no picker opens), and no label,
|
|
29
|
-
* icon or disabled
|
|
30
|
+
* icon or disabled writes. Drag & drop still works, since it is installed on the
|
|
30
31
|
* root regardless. Any other child is replaced on the first render. The file input itself
|
|
31
32
|
* is never a child: it is created on `document.body` per click and removed again.
|
|
32
33
|
*
|
|
@@ -68,9 +69,8 @@ export declare class AparteComposerAddAttachment extends HTMLElement {
|
|
|
68
69
|
* Re-read the label and the icon on the button that already exists.
|
|
69
70
|
*
|
|
70
71
|
* Deliberately not a re-render: `_render()` returns early once the button is
|
|
71
|
-
* there, and
|
|
72
|
-
*
|
|
73
|
-
* re-enable the attach button mid-turn, and drop focus if the user were on it.
|
|
72
|
+
* there, and rebuilding it would drop focus if the user were on it — a locale or
|
|
73
|
+
* icon change is not a reason to lose the keyboard.
|
|
74
74
|
* The native file input and the drag listeners live outside this element
|
|
75
75
|
* (on `document.body` and on the composer root), so they are untouched either way.
|
|
76
76
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-composer-add-attachment.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-add-attachment.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"aparte-composer-add-attachment.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-add-attachment.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,qBAAa,2BAA4B,SAAQ,WAAW;IACxD,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,aAAa,CAAsB;IAG3C,OAAO,CAAC,QAAQ,CAAgC;IAEhD,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,iBAAiB,IAAI,IAAI;IAOzB,oBAAoB,IAAI,IAAI;IAO5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQvF,OAAO,CAAC,QAAQ;IAIhB;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,cAAc;CA8BzB"}
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
* submitting Enter then dispatches `aparte-composer-submit` instead of calling
|
|
17
17
|
* `root.submit()`, which is how the bubble's inline editor reuses this primitive.
|
|
18
18
|
* Everything the root owns goes with it though — the mirrored value, the placeholder
|
|
19
|
-
* fallback, the disabled
|
|
19
|
+
* fallback, the disabled sync and image paste all need the composer. The editor stays
|
|
20
|
+
* editable while a reply streams (the next message is typed while the current one
|
|
21
|
+
* arrives); only the send is gated then — Enter is swallowed, the button is Stop.
|
|
20
22
|
*
|
|
21
23
|
* Not a `<textarea>` and not a stand-in for one: being a contenteditable it has no form
|
|
22
24
|
* value, no `name` and no native validation, and `getValue()` returns trimmed text with
|
|
@@ -91,6 +93,12 @@ export declare class AparteComposerInput extends HTMLElement {
|
|
|
91
93
|
setValue(value: string): void;
|
|
92
94
|
/** Empty the editor and mirror the empty value onto the parent composer. */
|
|
93
95
|
clear(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Re-read the placeholder fallback chain. Called by the composer when ITS
|
|
98
|
+
* `placeholder` changes — this element observes only its own attribute, and the
|
|
99
|
+
* composer's is one of the three sources it falls back to.
|
|
100
|
+
*/
|
|
101
|
+
syncPlaceholder(): void;
|
|
94
102
|
/** Focus the inner contenteditable rather than the host element. */
|
|
95
103
|
focus(): void;
|
|
96
104
|
/** Blur the inner contenteditable rather than the host element. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-composer-input.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-input.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"aparte-composer-input.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-input.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAChD,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,aAAa,CAAsB;IAG3C,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,QAAQ,CAAgC;IAEhD,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,iBAAiB,IAAI,IAAI;IAWzB,oBAAoB,IAAI,IAAI;IAU5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IASvF;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAkBlB,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ7B,4EAA4E;IAC5E,KAAK,IAAI,IAAI;IAQb;;;;OAIG;IACH,eAAe,IAAI,IAAI;IAIvB,oEAAoE;IAC3D,KAAK,IAAI,IAAI;IACtB,mEAAmE;IAC1D,IAAI,IAAI,IAAI;IAErB,2EAA2E;IAC3E,QAAQ,IAAI,IAAI;IAchB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,OAAO;IA8Bf,OAAO,CAAC,cAAc;IAqCtB,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,cAAc;IAyCtB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,aAAa;IAmBrB;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,eAAe;CAW1B"}
|
|
@@ -88,7 +88,9 @@ export interface AparteComposerChangeEventDetail {
|
|
|
88
88
|
* it (appending to the host when there is none).
|
|
89
89
|
*
|
|
90
90
|
* A PANEL is neither markup you write nor a named slot: `showPanel()` takes the element,
|
|
91
|
-
* stamps it `data-aparte-panel` and inserts it
|
|
91
|
+
* stamps it `data-aparte-panel` and inserts it — inside the descendant you marked
|
|
92
|
+
* `data-aparte-panel-host` if there is one, else right after the first input —
|
|
93
|
+
* and `hidePanel()` removes it. One at a time
|
|
92
94
|
* — a second `showPanel()` evicts the first and calls its `onEvict`. While one is up the
|
|
93
95
|
* host carries `[data-panel-active]`, which hides `<aparte-composer-input>` and
|
|
94
96
|
* `<aparte-composer-add-attachment>` and leaves the attachments strip and the toolbar in
|
|
@@ -119,8 +121,8 @@ export interface AparteComposerChangeEventDetail {
|
|
|
119
121
|
* @element aparte-composer
|
|
120
122
|
*
|
|
121
123
|
* @attr {string} placeholder - Fallback placeholder for `<aparte-composer-input>`, which
|
|
122
|
-
* reads it off this element when it carries none of its own.
|
|
123
|
-
*
|
|
124
|
+
* reads it off this element when it carries none of its own. Changing it here reaches
|
|
125
|
+
* the inputs already on the page too.
|
|
124
126
|
* @attr {boolean} disabled - Disables the composer's own controls — the input, send,
|
|
125
127
|
* add-attachment and `<aparte-composer-action>` buttons each read it. What you put in
|
|
126
128
|
* the toolbar is yours to disable.
|
|
@@ -417,6 +419,13 @@ export declare class AparteComposer extends HTMLElement {
|
|
|
417
419
|
* for the reason written there — Angular's wrapper root IS `<aparte-chat>`, the
|
|
418
420
|
* other three render a `[data-aparte-chat]` div.
|
|
419
421
|
*/
|
|
422
|
+
/**
|
|
423
|
+
* A signal, not a guard: on a page with several chats, a composer attached to none
|
|
424
|
+
* answers to every chat's lifecycle events (see `_ownTargetId`), and the symptom —
|
|
425
|
+
* one chat's Stop evicting another's open question — is nowhere near its cause.
|
|
426
|
+
* Said once, at the console, where the developer is.
|
|
427
|
+
*/
|
|
428
|
+
private _warnIfUnattached;
|
|
420
429
|
private _ownTargetId;
|
|
421
430
|
private _handleMessageStart;
|
|
422
431
|
private _handleMessageDone;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-composer.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAKpE,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,kBAAkB,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IA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