@aparte/core 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/client/agent-runner.d.ts.map +1 -1
  2. package/dist/client/aparte-client.d.ts +37 -76
  3. package/dist/client/aparte-client.d.ts.map +1 -1
  4. package/dist/client/stream-adapter.d.ts.map +1 -1
  5. package/dist/client/wire-history.d.ts +78 -0
  6. package/dist/client/wire-history.d.ts.map +1 -1
  7. package/dist/components/bubble/aparte-chat-bubble.d.ts +90 -4
  8. package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
  9. package/dist/components/bubble/bubble-sync.d.ts +5 -1
  10. package/dist/components/bubble/bubble-sync.d.ts.map +1 -1
  11. package/dist/components/bubble/checkpoint-separator.d.ts +40 -0
  12. package/dist/components/bubble/checkpoint-separator.d.ts.map +1 -0
  13. package/dist/components/composer/accepts-file.d.ts +10 -0
  14. package/dist/components/composer/accepts-file.d.ts.map +1 -0
  15. package/dist/components/composer/aparte-composer-add-attachment.d.ts +5 -1
  16. package/dist/components/composer/aparte-composer-add-attachment.d.ts.map +1 -1
  17. package/dist/components/composer/aparte-composer-attachments.d.ts +9 -4
  18. package/dist/components/composer/aparte-composer-attachments.d.ts.map +1 -1
  19. package/dist/components/composer/aparte-composer-input.d.ts.map +1 -1
  20. package/dist/components/context/aparte-context.d.ts +172 -25
  21. package/dist/components/context/aparte-context.d.ts.map +1 -1
  22. package/dist/components/elicitation/aparte-elicitation.d.ts +2 -2
  23. package/dist/components/index.d.ts +2 -0
  24. package/dist/components/index.d.ts.map +1 -1
  25. package/dist/components/launcher/aparte-launcher.d.ts +167 -0
  26. package/dist/components/launcher/aparte-launcher.d.ts.map +1 -0
  27. package/dist/components/launcher/index.d.ts +3 -0
  28. package/dist/components/launcher/index.d.ts.map +1 -0
  29. package/dist/components/viewport/aparte-chat-viewport.d.ts +7 -0
  30. package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
  31. package/dist/config/aparte-config.d.ts +23 -1
  32. package/dist/config/aparte-config.d.ts.map +1 -1
  33. package/dist/config/error-renderer.d.ts +21 -10
  34. package/dist/config/error-renderer.d.ts.map +1 -1
  35. package/dist/config/icon-provider.d.ts +2 -0
  36. package/dist/config/icon-provider.d.ts.map +1 -1
  37. package/dist/config/locale.d.ts +85 -5
  38. package/dist/config/locale.d.ts.map +1 -1
  39. package/dist/context/checkpoint-state.d.ts +70 -0
  40. package/dist/context/checkpoint-state.d.ts.map +1 -0
  41. package/dist/context/checkpoint.d.ts +28 -0
  42. package/dist/context/checkpoint.d.ts.map +1 -0
  43. package/dist/context/measure.d.ts +148 -0
  44. package/dist/context/measure.d.ts.map +1 -0
  45. package/dist/context/restore.d.ts +24 -0
  46. package/dist/context/restore.d.ts.map +1 -0
  47. package/dist/conversations/conversation-controller.d.ts +13 -4
  48. package/dist/conversations/conversation-controller.d.ts.map +1 -1
  49. package/dist/conversations/conversation-manager.d.ts +6 -0
  50. package/dist/conversations/conversation-manager.d.ts.map +1 -1
  51. package/dist/custom-elements.json +13893 -11714
  52. package/dist/{defer-hydration-BwMqeRHq.js → defer-hydration-DSZE-bKi.js} +788 -269
  53. package/dist/defer-hydration-DSZE-bKi.js.map +1 -0
  54. package/dist/generated/element-attributes.d.ts +21 -3
  55. package/dist/generated/element-attributes.d.ts.map +1 -1
  56. package/dist/{glyphs-2bym5jl5.js → glyphs-DFp-825O.js} +33 -30
  57. package/dist/{glyphs-2bym5jl5.js.map → glyphs-DFp-825O.js.map} +1 -1
  58. package/dist/host/aparte-chat-host.d.ts +19 -2
  59. package/dist/host/aparte-chat-host.d.ts.map +1 -1
  60. package/dist/icons/extended.d.ts +2 -2
  61. package/dist/icons/extended.d.ts.map +1 -1
  62. package/dist/icons/glyphs.d.ts +3 -0
  63. package/dist/icons/glyphs.d.ts.map +1 -1
  64. package/dist/icons.js +29 -30
  65. package/dist/icons.js.map +1 -1
  66. package/dist/index.css +1 -1
  67. package/dist/index.d.ts +8 -1
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +1140 -95
  70. package/dist/index.js.map +1 -1
  71. package/dist/index.node.d.ts +6 -2
  72. package/dist/index.node.d.ts.map +1 -1
  73. package/dist/index.node.js +33 -29
  74. package/dist/index.node.js.map +1 -1
  75. package/dist/interop/element-props.d.ts +1 -1
  76. package/dist/interop/element-props.d.ts.map +1 -1
  77. package/dist/renderers/segments/error.d.ts.map +1 -1
  78. package/dist/renderers/segments/tool-call.d.ts.map +1 -1
  79. package/dist/transport/agent-handler.d.ts.map +1 -1
  80. package/dist/transport/backend-handler.d.ts.map +1 -1
  81. package/dist/transport/types.d.ts +24 -4
  82. package/dist/transport/types.d.ts.map +1 -1
  83. package/dist/types/chat.d.ts +16 -1
  84. package/dist/types/chat.d.ts.map +1 -1
  85. package/dist/types/compactor.d.ts +104 -0
  86. package/dist/types/compactor.d.ts.map +1 -0
  87. package/dist/types/element-map.d.ts +2 -0
  88. package/dist/types/element-map.d.ts.map +1 -1
  89. package/dist/types/errors.d.ts +9 -0
  90. package/dist/types/errors.d.ts.map +1 -1
  91. package/dist/types/event-map.d.ts +2 -0
  92. package/dist/types/event-map.d.ts.map +1 -1
  93. package/dist/types/events.d.ts +50 -3
  94. package/dist/types/events.d.ts.map +1 -1
  95. package/dist/types/index.d.ts +4 -3
  96. package/dist/types/index.d.ts.map +1 -1
  97. package/dist/types/model-provider.d.ts +3 -0
  98. package/dist/types/model-provider.d.ts.map +1 -1
  99. package/dist/types/models.d.ts +43 -3
  100. package/dist/types/models.d.ts.map +1 -1
  101. package/dist/types/segments.d.ts +13 -5
  102. package/dist/types/segments.d.ts.map +1 -1
  103. package/dist/types/tools.d.ts +6 -1
  104. package/dist/types/tools.d.ts.map +1 -1
  105. package/dist/utils/error-sentence.d.ts +21 -0
  106. package/dist/utils/error-sentence.d.ts.map +1 -0
  107. package/package.json +2 -2
  108. package/dist/defer-hydration-BwMqeRHq.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"aparte-composer-attachments.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-attachments.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;IAsFf,0EAA0E;IAC1E,OAAO,CAAC,IAAI;CAIf"}
1
+ {"version":3,"file":"aparte-composer-attachments.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-attachments.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;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;IAsFf,0EAA0E;IAC1E,OAAO,CAAC,IAAI;CAIf"}
@@ -1 +1 @@
1
- {"version":3,"file":"aparte-composer-input.d.ts","sourceRoot":"","sources":["../../../src/components/composer/aparte-composer-input.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO;IAyBf,OAAO,CAAC,cAAc;IAqCtB,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,cAAc;IAyCtB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,YAAY;IA0BpB,OAAO,CAAC,aAAa;IAmBrB;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,eAAe;CAW1B"}
@@ -1,9 +1,10 @@
1
+ import { type AparteContextMeasure } from '../../context/measure.js';
1
2
  /** How full the window is, against the two thresholds. */
2
3
  export type AparteContextLevel = 'ok' | 'warn' | 'danger';
3
4
  /** Detail of `aparte-context-threshold`: the level just entered, and the numbers behind it. */
4
5
  export interface AparteContextThresholdEventDetail {
5
6
  level: AparteContextLevel;
6
- /** Tokens the last turn reported as used — the prompt sent plus the reply. */
7
+ /** Tokens in use — the last turn's reported usage (prompt sent plus reply), or an estimate once the context has changed since. */
7
8
  used: number;
8
9
  /** The window those tokens are measured against. */
9
10
  window: number;
@@ -13,28 +14,51 @@ export interface AparteContextThresholdEventDetail {
13
14
  targetId?: string;
14
15
  }
15
16
  /**
16
- * A gauge of the model's context window: how much of it the conversation uses.
17
+ * A gauge of the model's context window: how much of it the conversation uses, and what
18
+ * fills it.
17
19
  *
18
- * It reads two numbers and draws their ratio. The USED part is what each turn reports —
19
- * `aparte-message-done` carries the provider's usage, and the prompt tokens of the
20
- * last call are the size of the context as the model saw it. The WINDOW is the
21
- * current model's `contextWindow` (a provider's `/models` fetch fills it in), or the
22
- * `window` attribute when you know better. With no window, or before the first turn,
23
- * it renders nothing — an affordance with nothing to show has no chrome to leave.
20
+ * It draws one number against the window. The number is what the last turn REPORTED —
21
+ * `aparte-message-done` carries the provider's usage, and the prompt tokens of the last call
22
+ * are the size of the context as the model saw it — for as long as nothing the model reads
23
+ * has changed since. Once something has (a compaction summarised the history, a Restore
24
+ * brought it back), the reported number describes a request that will not be sent again, so
25
+ * the gauge measures the request that WOULD be sent and prefixes it with `~`: an estimate,
26
+ * calibrated against the last reply, never a stale figure and never a blank. The measure is
27
+ * `measureContext`, the same one the compaction plugin decides on.
28
+ *
29
+ * The WINDOW is the current model's `contextWindow` (a provider's `/models` fetch fills it
30
+ * in), or the `window` attribute when you know better. With no window, or before the first
31
+ * turn, it renders nothing — an affordance with nothing to show has no chrome to leave.
24
32
  *
25
33
  * Two thresholds turn it `warn` then `danger` (`data-level`), and crossing one fires
26
- * `aparte-context-threshold`. With `auto-compact`, a turn that ends in `danger` dispatches
27
- * `aparte-compact` for its chat — one request at a time, asked again on the next turn in
28
- * `danger` once the plugin has answered. 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.
34
+ * `aparte-context-threshold`. A turn the model refused as over its window
35
+ * (`USAGE_CONTEXT_EXCEEDED` on `aparte-message-error`) turns it `danger` whatever the number
36
+ * says: the model has just said what the number could not.
37
+ *
38
+ * The gauge is also a disclosure. It is a button (`aria-expanded`; click, Enter or Space) that
39
+ * opens a panel listing what the window holds — the system prompt, the tools, the summary
40
+ * of a compacted history, the messages — beside what is free. The parts are estimates and
41
+ * labelled so; what the heuristic cannot see is `other`. When
42
+ * `@aparte/plugin-compaction` is registered as the compactor and can say what compacting
43
+ * would do, the panel adds "Compacting now would free ~N tokens" and a **Compact now** button.
44
+ * While a compaction runs the element carries `data-compact="running"`, and `"failed"` after a
45
+ * failure, with Retry in the panel. Escape and a click outside close it; nothing opens on hover.
46
+ *
47
+ * `auto-compact` is deprecated: the plugin decides when to compact now (after a turn, and
48
+ * before a send that would overflow), so a page does not need the gauge to ask. It still
49
+ * works — a turn that ends in `danger` dispatches `aparte-compact`, one request at a time,
50
+ * with `auto: true` so the plugin can tell it from a button — and it will go away in a
51
+ * future major version.
52
+ *
53
+ * A new chat or a conversation loaded in place of the last replaces the reading: it is
54
+ * cleared on `aparte-reset-done` and, for a stored conversation, read from its last reply on
55
+ * `aparte-conversation-loaded`. A restored reading never asks for a compaction, whatever its
56
+ * level — that stays tied to the end of a turn.
33
57
  *
34
58
  * The bar wears the `aparte-progress` recipe. `variant="ring"` draws the same reading
35
59
  * as a ring with the percentage beside it — for a toolbar, where a bar wants a width
36
60
  * 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.
61
+ * levels, the events, the panel and the accessible name; only the drawing differs.
38
62
  *
39
63
  * @element aparte-context
40
64
  *
@@ -42,21 +66,22 @@ export interface AparteContextThresholdEventDetail {
42
66
  * @attr {number} used - Tokens in use before a turn of this page has reported any: a restored conversation's last usage. The next turn's usage replaces it.
43
67
  * @attr {number} warn - Fraction of the window at which the level turns `warn`. Default `0.75`.
44
68
  * @attr {number} danger - Fraction at which it turns `danger`. Default `0.9`.
45
- * @attr {boolean} auto-compact - Dispatch `aparte-compact` on each turn that ends in `danger`, one request at a time.
69
+ * @attr {boolean} auto-compact - Deprecated, still works. Dispatch `aparte-compact` (with `auto: true`) on each turn that ends in `danger`, one request at a time. `@aparte/plugin-compaction` decides when to compact by itself now, so leave this off.
46
70
  * @attr {string} target - The id of the `<aparte-chat>` to watch, when the element is not under it.
47
71
  * @attr {string} variant - `bar` (default) or `ring`: a progress bar with the reading beside it, or a ring with the percentage.
48
72
  * @attr {string} data-level - Reflected BY the element: `ok`, `warn` or `danger`. Read-only.
49
73
  * @attr {boolean} data-empty - Reflected BY the element while it has nothing to show. Read-only.
74
+ * @attr {string} data-compact - Reflected BY the element while this chat is being compacted (`running`) and after a compaction failed (`failed`). Read-only.
50
75
  *
51
76
  * @fires {CustomEvent<AparteContextThresholdEventDetail>} aparte-context-threshold - The level changed. Bubbles.
52
- * @fires {CustomEvent<AparteCompactEventDetail>} aparte-compact - Dispatched on `window` when `auto-compact` is set and a turn ends in `danger`: compact this target's transcript. One request at a time — the next turn in `danger` asks again once the plugin has answered — and only while the attribute is present. `@aparte/plugin-compaction` answers it; with no listener nothing happens.
77
+ * @fires {CustomEvent<AparteCompactEventDetail>} aparte-compact - Dispatched on `window` when the deprecated `auto-compact` is set and a turn ends in `danger` (`auto: true`, with the `window` it measured against), and by Retry in the panel when no compactor is registered. One automatic request at a time — the next turn in `danger` asks again once the plugin has answered. `@aparte/plugin-compaction` answers it; with no listener nothing happens.
53
78
  *
54
79
  * @cssprop [--aparte-context-ring-size=22px] - Diameter of the ring variant.
55
80
  *
56
81
  * @example
57
82
  * <!-- The same gauge twice: the bar takes the room it is given, the ring takes none. -->
58
83
  * <aparte-composer-toolbar>
59
- * <aparte-context window="128000" auto-compact style="flex: 1"></aparte-context>
84
+ * <aparte-context window="128000" style="flex: 1"></aparte-context>
60
85
  * <aparte-context window="128000" variant="ring"></aparte-context>
61
86
  * </aparte-composer-toolbar>
62
87
  *
@@ -71,22 +96,68 @@ export interface AparteContextThresholdEventDetail {
71
96
  */
72
97
  export declare class AparteContext extends HTMLElement {
73
98
  static get observedAttributes(): string[];
99
+ /**
100
+ * A reading with no transcript behind it: the `used` attribute's seed, or a turn's usage
101
+ * when the chat's list cannot be read from here (a gauge placed far from its chat, a test).
102
+ * When the list can be read, the measure comes from it and this is only the fallback.
103
+ */
74
104
  private _used;
75
105
  private _level;
76
106
  private _compactRequested;
107
+ /** The last turn's usage and the reply it belongs to, so the measure has it before the list has written it back. */
108
+ private _lastDone;
109
+ /** What the model reads changed with nothing on the path to say so (a Restore): the reading is an estimate until the next turn reports. */
110
+ private _viewChanged;
111
+ /** A conversation was replaced and nothing has reported or loaded since: the list on screen is not read yet. */
112
+ private _blank;
113
+ /** The model refused a request as over its window; the level is `danger` until something changes. */
114
+ private _overflow;
115
+ private _compact;
116
+ private _failure;
117
+ private _open;
118
+ /** The reading drawn last, so the `used` getter and the panel read what is on screen. */
119
+ private _measured;
120
+ /** The chat an event last came from, for a gauge that is neither under its chat nor names it with `target`. */
121
+ private _seen;
122
+ /** What the panel was last built from: a render that changes nothing leaves its nodes, and the focus in them, alone. */
123
+ private _panelSignature;
124
+ private _remember;
77
125
  private _onDone;
78
126
  /**
79
- * After a real compaction the context is smaller by an amount nobody has measured
80
- * yet — the next turn's usage will say. Until then the gauge shows nothing rather
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.
127
+ * A conversation is replaced — a new chat, or one loaded in place of the last — and the
128
+ * previous reading is not this one's. The viewport says so with `aparte-reset-done` (no
129
+ * detail: the chat is found from where the event came from). A load clears first and
130
+ * `aparte-conversation-loaded` follows, so the reading is dropped here and read again
131
+ * there. Until then the chat's list is not trusted: a framework's may not have caught up.
132
+ */
133
+ private _onReset;
134
+ /**
135
+ * The messages of a stored conversation are on screen: the reading is the last reply's
136
+ * usage — what a turn would have reported had it just ended. A transcript with none
137
+ * (an empty one, a conversation saved before usage was kept) shows nothing, the same as
138
+ * a chat that has not spoken yet.
139
+ */
140
+ private _onLoaded;
141
+ /** A compaction began for this chat: say so on the element and in the panel. */
142
+ private _onCompactStart;
143
+ /**
144
+ * After a real compaction — or a Restore — what the model reads is a different size by an
145
+ * amount nobody has measured yet, and the last reply's reported usage describes the request
146
+ * from before. The gauge measures the request that would be sent now and says so with `~`,
147
+ * rather than keeping a number it knows to be wrong or going blank until the next turn. The
148
+ * event names the chat it compacted, so on a multi-chat page only that chat's gauge
149
+ * moves; an unnamed one moves every gauge.
150
+ *
151
+ * Without a transcript to measure (a gauge that cannot read its chat's list) there is
152
+ * nothing to estimate from, and the reading is dropped as it always was.
84
153
  */
85
154
  private _onCompacted;
86
155
  /** A failed compaction spends the request too; the next `danger` asks again. */
87
156
  private _onCompactError;
157
+ /** The model refused this chat's request as over its window: the number was wrong, and so is "ok". */
158
+ private _onMessageError;
88
159
  private _onRerender;
89
- /** Tokens the last turn reported — or `used` set, until a turn reports — else `null`. */
160
+ /** Tokens in use — what is drawn — else the last reported or seeded reading, else `null`. */
90
161
  get used(): number | null;
91
162
  /**
92
163
  * Writes the `used` attribute: a reading for a conversation restored without a turn of
@@ -105,13 +176,89 @@ export declare class AparteContext extends HTMLElement {
105
176
  set window(value: number | null);
106
177
  /** The current level, or `null` while nothing is shown. */
107
178
  get level(): AparteContextLevel | null;
179
+ /** The reading drawn now, parts and all, or `null` while nothing is shown. */
180
+ get measure(): AparteContextMeasure | null;
108
181
  connectedCallback(): void;
109
182
  disconnectedCallback(): void;
110
183
  attributeChangedCallback(name: string): void;
184
+ /**
185
+ * The config the chat this gauge watches answers to, not the one at the gauge's own
186
+ * position. A gauge in a header, with `target=`, stands outside the chat's boundary, and
187
+ * a chat that carries its own config (a wrapper's `config` prop) has its own prompt, tools,
188
+ * window and compactor: the client and the plugin read them from there, so the gauge must
189
+ * too, or it measures a different request and offers no Compact now. Resolved live, like
190
+ * every config read: the boundary may be attached after this element connects.
191
+ */
192
+ private _cfg;
111
193
  private _window;
112
194
  /** The chat this gauge watches: `target`, else the chat host above it — the composer's rule. */
113
195
  private _ownTargetId;
114
196
  private _isMine;
197
+ /**
198
+ * The chat's element: the one `target` names, else the chat above the gauge, else the one
199
+ * its events last came from. Passed to the compactor as it is — a chat inside a shadow
200
+ * root is not found by id, so the element is the address that always works.
201
+ */
202
+ private _chat;
203
+ /** The chat's active path, or `null` when it cannot be read from here. */
204
+ private _messages;
205
+ /**
206
+ * What to draw: the measure of the chat's own transcript when it holds a reply with usage
207
+ * (or the model has just refused a request, and an estimate is better than nothing), else
208
+ * the seeded or reported number with nothing to break down.
209
+ *
210
+ * The last turn's usage is laid over its reply when the list has not written it back yet.
211
+ * If the list does not hold that reply at all it is not used: the list is the path on
212
+ * screen, and a reply that is not on it (a branch was switched) is not its reading.
213
+ */
214
+ private _measure;
115
215
  private _render;
216
+ /**
217
+ * What the window holds, row by row, and what can be done about it.
218
+ *
219
+ * The parts are raw estimates and `used` is the number the gauge draws — measured or
220
+ * calibrated — so they need not agree. The panel never shows a sum above the total: when
221
+ * the estimates add up to more than `used`, each is scaled down to fit and `other` is
222
+ * zero; otherwise the difference is `other`, the part the heuristic cannot see.
223
+ */
224
+ private _renderPanel;
225
+ private _action;
226
+ /**
227
+ * Ask the registered compactor to compact this chat now, as a person asked. With none
228
+ * registered (Retry only — Compact now is not offered without one) the command event
229
+ * is the way to ask, the one a host's own button uses.
230
+ */
231
+ private _compactNow;
232
+ private _onClick;
233
+ private _setOpen;
234
+ /**
235
+ * Escape and a click anywhere else close the panel. Listened for on the document only
236
+ * while it is open: a page full of closed gauges holds no listeners but its own.
237
+ */
238
+ private _onDocumentClick;
239
+ /**
240
+ * Escape from inside the gauge — the toggle, the panel — is the gauge's, and it is
241
+ * answered HERE, on the element, not on the document. An ancestor that also answers
242
+ * Escape (a launcher closing its card, a dialog) listens on its own element, which runs
243
+ * before any listener on the document, so a press consumed only there had already
244
+ * closed the card around the panel it was meant for. Taken means stopped, so nothing
245
+ * above answers it too, and prevented, so a listener that still sees it — one on this
246
+ * element, a capture listener — knows it is spoken for, and a dialog around does not
247
+ * take it as its own close request.
248
+ */
249
+ private _onKeydown;
250
+ /**
251
+ * A press elsewhere still closes the panel, but is left to whatever else listens for
252
+ * Escape (a dialog, the composer).
253
+ */
254
+ private _onDocumentKeydown;
255
+ private _listenWhileOpen;
256
+ private _stopListeningWhileOpen;
257
+ /**
258
+ * Where the panel opens: above the reading by default, since a gauge usually sits in the
259
+ * composer at the foot of the page; below when there is no room above, and flush with the
260
+ * other edge when it would run past the window's.
261
+ */
262
+ private _place;
116
263
  }
117
264
  //# sourceMappingURL=aparte-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aparte-context.d.ts","sourceRoot":"","sources":["../../../src/components/context/aparte-context.ts"],"names":[],"mappings":"AAIA,0DAA0D;AAC1D,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1D,+FAA+F;AAC/F,MAAM,WAAW,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,OAAO,CAAC,QAAQ,CAad;IAEF,OAAO,CAAC,QAAQ;IAUhB;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAEtB;IAEF;;;;;;;;;OASG;IACH,OAAO,CAAC,UAAU,CAKhB;IAEF;;;OAGG;IACH,OAAO,CAAC,kBAAkB,CAGxB;IAEF,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,uBAAuB;IAK/B;;;;OAIG;IACH,OAAO,CAAC,MAAM;CAUjB"}
@@ -52,7 +52,7 @@ import type { AparteConfig } from '../../config/aparte-config.js';
52
52
  * @element aparte-elicitation
53
53
  *
54
54
  * @cssprop [--aparte-elic-gap=var(--aparte-space-3)] - Vertical gap between the panel's rows (message, body, tabs).
55
- * @cssprop [--aparte-elic-padding=var(--aparte-space-3) var(--aparte-space-2)] - Padding inside the panel.
55
+ * @cssprop [--aparte-elic-padding=max(var(--aparte-space-3), calc(var(--aparte-focus-outline-width) + var(--aparte-focus-outline-offset))) max(var(--aparte-space-2), calc(var(--aparte-focus-outline-width) + var(--aparte-focus-outline-offset)))] - Padding inside the panel; never less than the focus ring's reach, so a focused option's ring is not cut.
56
56
  * @cssprop [--aparte-elic-max-height=50vh] - Cap on the panel's height; its body scrolls, the panel does not.
57
57
  * @cssprop [--aparte-elic-field-gap=var(--aparte-space-4)] - Space and separator padding between two fields of an object schema.
58
58
  * @cssprop [--aparte-elic-message-size=var(--aparte-font-size-base)] - Font size of the question text at the top of the panel.
@@ -72,7 +72,7 @@ import type { AparteConfig } from '../../config/aparte-config.js';
72
72
  * @cssprop [--aparte-elic-step-gap=var(--aparte-space-7)] - Gap between step tabs.
73
73
  * @cssprop [--aparte-elic-step-underline=2px] - Thickness of the current step's underline (a tab, not a pill).
74
74
  * @cssprop [--aparte-elic-dismiss-room=104px] - Space the tab rail and the question message keep clear for the corner: the hide button and, on a question, Skip. Widen it for a locale whose "Skip" word is wider.
75
- * @cssprop [--aparte-approval-gap=4px] - Gap between the stacked options of an approval request.
75
+ * @cssprop [--aparte-approval-gap=calc(var(--aparte-focus-outline-width) + var(--aparte-focus-outline-offset) + var(--aparte-space-1))] - Gap between the stacked options of an approval request; by default wider than the focus ring's reach.
76
76
  * @cssprop [--aparte-approval-option-size=0.85rem] - Font size of an approval option button.
77
77
  * @cssprop [--aparte-approval-option-padding=8px 10px] - Padding of an approval option button.
78
78
  * @cssprop [--aparte-approval-option-radius=8px] - Corner radius of an approval option button.
@@ -17,4 +17,6 @@ export { AparteSidebar } from './sidebar/index.js';
17
17
  export type { AparteSidebarToggleDetail } from './sidebar/index.js';
18
18
  export { AparteSplit } from './split/index.js';
19
19
  export type { AparteSplitResizeDetail } from './split/index.js';
20
+ export { AparteLauncher } from './launcher/index.js';
21
+ export type { AparteLauncherToggleDetail } from './launcher/index.js';
20
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAChF,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACzN,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAGxM,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EAAE,0BAA0B,EAA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AAuB,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAGxM,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAGvS,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAG5F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,iCAAiC,EAAE,MAAM,oBAAoB,CAAC;AAGhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAGhG,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGpE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,167 @@
1
+ /** Detail of `aparte-launcher-toggle`: the state just entered. */
2
+ export interface AparteLauncherToggleDetail {
3
+ open: boolean;
4
+ /** True while the window is under the breakpoint and the open chat fills it. Kept current: the event fires again when the window crosses the breakpoint while the chat is open. */
5
+ sheet: boolean;
6
+ }
7
+ /**
8
+ * A chat that floats in a corner of the page — the support widget every product site has,
9
+ * as an element. A round button sits at the bottom of the window, on the inline-end side;
10
+ * a click opens the chat above it as a card, and a second click, Escape or any control
11
+ * marked `data-aparte-launcher-close` inside closes it again.
12
+ *
13
+ * Children are yours: put the chat in it — an `<aparte-chat>`, or your own card with a
14
+ * header above one. The element adds its button after them and shows them only while it is
15
+ * open, so a closed launcher keeps the chat mounted (the conversation and the client stay)
16
+ * but out of the tab order and the accessibility tree. Nothing is stored: listen to
17
+ * `aparte-launcher-toggle` to remember the state.
18
+ *
19
+ * **On a phone.** Under `breakpoint` (30rem of window, wide or high, unless you set a width) the open chat
20
+ * fills the window as a sheet, Tab stays inside it, and the button moves to the top corner
21
+ * to close it — or hides, when your card holds its own `data-aparte-launcher-close`
22
+ * control. The element reflects `data-sheet` while the window is that narrow.
23
+ *
24
+ * **The button** shows a speech bubble, or the bubble and your `label` (`label="Help"`)
25
+ * as a pill; it is named by the locale's `launcherOpen`/`launcherClose` when it shows no
26
+ * text. Its two icons are the `launcherOpen` and `launcherClose` icons when the config holds
27
+ * them (`registerIcons`), else `messageSquare` and `close` — so a theme redraws this button
28
+ * without redrawing every close button in the chat. Opening with the button hands the focus to the composer, or to the first control of
29
+ * your card; `show()` and `open` set from a script move no focus, so a page that restores the
30
+ * state on load does not steal it. Closing gives the focus back to the button when it was
31
+ * inside.
32
+ *
33
+ * **Server rendering.** The button is drawn when the element connects, which on a
34
+ * server-rendered page is before the framework hydrates, and hydration removes what it did
35
+ * not render. Put `defer-hydration` on the launcher in the server's HTML and call
36
+ * `releaseDeferredHydration` once your framework has hydrated, so the element draws itself
37
+ * then; if something takes the button out anyway, the element puts it back.
38
+ *
39
+ * @element aparte-launcher
40
+ *
41
+ * @attr {boolean} open - The chat is open. Reflected; set it to start open.
42
+ * @attr {string} label - Text shown beside the bubble on the closed button, which then reads as a pill. Without it the button is round and named by the locale.
43
+ * @attr {string} breakpoint - The window width under which the open chat fills the window: a length, or `none` for a card at any size. Unset, a window under 30rem wide or 30rem high.
44
+ * @attr {boolean} data-sheet - Reflected BY the element while the window is narrower than `breakpoint` (30rem unless you set it). Read-only.
45
+ *
46
+ * @fires {CustomEvent<AparteLauncherToggleDetail>} aparte-launcher-toggle - The chat opened or closed, by the button, by Escape, by a close control or by `open` being set — or, while it is open, turned into a sheet or back as the window crossed the breakpoint. Bubbles.
47
+ *
48
+ * @cssprop [--aparte-launcher-width=23.75rem] - Width of the open card.
49
+ * @cssprop [--aparte-launcher-height=37.5rem] - Height of the open card, shortened to fit a short window.
50
+ * @cssprop [--aparte-launcher-offset=1.25rem] - Distance from the window's edges to the button and the card.
51
+ * @cssprop [--aparte-launcher-gap=var(--aparte-space-5)] - Space between the open card and the button.
52
+ * @cssprop [--aparte-launcher-radius=var(--aparte-radius-xl)] - Corner radius of the open card.
53
+ *
54
+ * @example
55
+ * <!-- In a page it floats over the window; here, over a 30rem frame. -->
56
+ * <div style="height: 30rem"></div>
57
+ * <aparte-launcher label="Help" open breakpoint="none" style="--aparte-launcher-height: 24rem">
58
+ * <aparte-chat></aparte-chat>
59
+ * </aparte-launcher>
60
+ */
61
+ export declare class AparteLauncher extends HTMLElement {
62
+ static get observedAttributes(): string[];
63
+ private _button;
64
+ /**
65
+ * Watches the element's own children. The button is the one child that is not the host's,
66
+ * so it is the one a framework reconciling the others knows nothing about: Vue's
67
+ * hydration removes "more child nodes than client vdom", Svelte 4's removes what its
68
+ * claim did not take. Without this it stays removed — a closed launcher then shows
69
+ * nothing, and nothing can open the chat.
70
+ */
71
+ private _childWatch;
72
+ /**
73
+ * Watches for a config boundary appearing, changing or leaving inside the element. A
74
+ * framework wrapper attaches its chat's `config` from a post-mount hook, after the
75
+ * launcher has connected and drawn its button, and `attachConfig` tells the elements
76
+ * INSIDE the boundary, never the launcher around it.
77
+ */
78
+ private _hostWatch;
79
+ private _media;
80
+ private _lastOpen;
81
+ /**
82
+ * `connectedCallback` has run. During an UPGRADE `attributeChangedCallback` fires for
83
+ * every authored attribute before it — `<aparte-launcher open>` server-rendered and
84
+ * upgraded when the module loads — and announcing a toggle there tells the host its
85
+ * chat just opened when all that happened is that the markup was read.
86
+ */
87
+ private _ready;
88
+ /** The chat is open. */
89
+ get open(): boolean;
90
+ set open(value: boolean);
91
+ /** True while the window is under the breakpoint, where the open chat fills it. */
92
+ get sheet(): boolean;
93
+ connectedCallback(): void;
94
+ disconnectedCallback(): void;
95
+ attributeChangedCallback(name: string): void;
96
+ private _announce;
97
+ /** Open the chat. */
98
+ show(): void;
99
+ /** Close the chat. */
100
+ close(): void;
101
+ /** Open the chat when it is closed, close it when it is open. */
102
+ toggle(): void;
103
+ /**
104
+ * The one opening that is a person's: the composer takes the focus, since they opened the
105
+ * chat to write. `show()` and `open` are a script's — a page restoring the state it saved,
106
+ * a host driving `open` from its own state — and a focus that jumps on page load is
107
+ * unasked for, and on a phone raises the keyboard over a sheet nobody pressed. An authored
108
+ * `open` never took the focus either, so the three ways of starting open now agree.
109
+ */
110
+ private _onButtonClick;
111
+ private _onConfigChange;
112
+ /**
113
+ * The config the button answers to: the chat's own when the chat inside carries an
114
+ * instance config (a wrapper's `config` prop, `attachConfig(chat, config)`), else the
115
+ * one at the launcher's own place — an ancestor's boundary, or the page's. The button
116
+ * labels and draws a control of THAT chat, and the chat's boundary is below the launcher,
117
+ * so resolving from the launcher alone read the page's locale and icons next to a chat
118
+ * in another language. Resolved live, never kept: the boundary may arrive after connect.
119
+ */
120
+ private _config;
121
+ /**
122
+ * The button is a child of the element, whatever was done to the children since: put
123
+ * back at the end when something took it out. A button that is still a child stays
124
+ * where it is, since the host may have placed it. Called on every render, and from the
125
+ * observer for the removal that comes with no render at all.
126
+ */
127
+ private _keepButton;
128
+ /**
129
+ * The button, for the state it is in: the bubble (and the label, as a pill) while
130
+ * closed, a close glyph while open. Its name comes from the locale when it shows no
131
+ * text, and from that text when it does — a visible label the name did not contain
132
+ * is what speech users cannot say to press it. `aria-expanded` is the disclosure's whole
133
+ * contract: there is no `aria-controls`, since the one element it could name without
134
+ * writing an id on the host's card is the launcher itself, the button's own ancestor.
135
+ */
136
+ private _renderButton;
137
+ private _onMediaChange;
138
+ /** The sheet's media query, from `breakpoint`: a length, or `none` for a card at any width. */
139
+ private _watchBreakpoint;
140
+ /**
141
+ * An open chat that turns into a sheet now covers the page, and one that turns back no
142
+ * longer does: announced, so a host that takes its page out of reach under the sheet
143
+ * follows the window without a media query of its own, which would be a second copy
144
+ * of `breakpoint` to keep in step.
145
+ */
146
+ private _applySheet;
147
+ /** What the chat lets the focus land on: yours to decide, so only what is visible. */
148
+ private _focusables;
149
+ /**
150
+ * The composer when there is one — the person opened the chat to write — else the
151
+ * first thing in the card that holds focus. The button itself never: it is what the
152
+ * person just pressed.
153
+ */
154
+ private _focusChat;
155
+ /** A `[data-aparte-launcher-close]` inside closes the chat — no script in your card. */
156
+ private _onClick;
157
+ /**
158
+ * A modal dialog open inside the card, with the key pressed inside it. The browser
159
+ * closes it on Escape — unless the keydown was cancelled, which is what closing the
160
+ * launcher would do: the dialog refused its close request and the card hidden under it.
161
+ * An engine that cannot tell a modal dialog from one opened with `show()` (no `:modal`)
162
+ * leaves the key to the dialog, which is the answer that loses nothing.
163
+ */
164
+ private _inModalDialog;
165
+ private _onKeydown;
166
+ }
167
+ //# sourceMappingURL=aparte-launcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aparte-launcher.d.ts","sourceRoot":"","sources":["../../../src/components/launcher/aparte-launcher.ts"],"names":[],"mappings":"AAKA,kEAAkE;AAClE,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,mLAAmL;IACnL,KAAK,EAAE,OAAO,CAAC;CAClB;AAqBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC3C,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,OAAO,CAAkC;IACjD;;;;;;OAMG;IACH,OAAO,CAAC,WAAW,CAAiC;IACpD;;;;;OAKG;IACH,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,SAAS,CAAwB;IAEzC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAS;IAEvB,wBAAwB;IACxB,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,EAEtB;IAED,mFAAmF;IACnF,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,iBAAiB,IAAI,IAAI;IAwBzB,oBAAoB,IAAI,IAAI;IAW5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAkB5C,OAAO,CAAC,SAAS;IAUjB,qBAAqB;IACrB,IAAI,IAAI,IAAI;IAIZ,sBAAsB;IACtB,KAAK,IAAI,IAAI;IAIb,iEAAiE;IACjE,MAAM,IAAI,IAAI;IAMd;;;;;;OAMG;IACH,OAAO,CAAC,cAAc,CAIpB;IAEF,OAAO,CAAC,eAAe,CAAoC;IAE3D;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO;IAIf;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAInB;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,cAAc,CAAiE;IAEvF,+FAA+F;IAC/F,OAAO,CAAC,gBAAgB;IAaxB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAQnB,sFAAsF;IACtF,OAAO,CAAC,WAAW;IAKnB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IASlB,wFAAwF;IACxF,OAAO,CAAC,QAAQ,CAKd;IAEF;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,UAAU,CA4BhB;CACL"}
@@ -0,0 +1,3 @@
1
+ export { AparteLauncher } from './aparte-launcher.js';
2
+ export type { AparteLauncherToggleDetail } from './aparte-launcher.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/launcher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -211,6 +211,13 @@ export declare class AparteChatViewport extends HTMLElement {
211
211
  /** Last `--aparte-transcript-inset` written on the host, in px — same write-on-change rule. */
212
212
  private _transcriptInset;
213
213
  private _boundResetHandler;
214
+ /**
215
+ * Marks the bubble a compaction is writing its checkpoint onto (`data-checkpoint`). The
216
+ * vanilla viewport's job: under a wrapper the transcript is the framework's, and the
217
+ * host answers for it instead (`active` below).
218
+ */
219
+ private _checkpointState;
220
+ private _stopCheckpointState;
214
221
  /**
215
222
  * When true, _reRenderActivePath() only dispatches aparte-path-changed without
216
223
  * touching the DOM. Set via setFrameworkManagedDOM(true) when a framework
@@ -1 +1 @@
1
- {"version":3,"file":"aparte-chat-viewport.d.ts","sourceRoot":"","sources":["../../../src/components/viewport/aparte-chat-viewport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,oBAAoB,EACpB,aAAa,EAIb,WAAW,EACd,MAAM,sBAAsB,CAAC;AAM9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AA+DrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;IAG/C,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,aAAa,CAA+B;IACpD;;;;;OAKG;IACH,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,kBAAkB,CAAa;IACvC,OAAO,CAA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;IAC3F,OAAO,CAAC,YAAY;IAiBpB;;;;;;;;;OASG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;;;;;;OAQG;IACH,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,QAAQ;CAsCnB"}
@@ -22,6 +22,7 @@ import type { AparteTransport } from '../transport/index.js';
22
22
  import type { AparteTool, AparteToolHandler, AparteToolRenderer, AparteToolSummary, AparteToolInputFormatter, AparteToolCall, AparteToolMatcher, AparteToolDisplay, AparteApprovalPolicy, AparteApprovalRuling } from '../types/tools.js';
23
23
  import type { AparteSegmentDefaults } from '../types/segments.js';
24
24
  import type { AparteStreamBlock } from '../types/stream-blocks.js';
25
+ import type { AparteCompactor } from '../types/compactor.js';
25
26
  import type { AparteBubbleActionsConfig, AparteBubbleActionName, AparteHostHandlersConfig } from '../types/models.js';
26
27
  import type { AparteConversationManager } from '../conversations/conversation-manager.js';
27
28
  import { type AparteSanitizer } from './sanitize.js';
@@ -168,6 +169,7 @@ export declare class AparteConfig {
168
169
  private _transport;
169
170
  private _modelPreferenceProvider?;
170
171
  private _approvalPolicy;
172
+ private _compactor;
171
173
  private _conversationManager?;
172
174
  private _elicitationPresenters;
173
175
  /** Warn once per config, not once per request — a tool loop can ask repeatedly. */
@@ -552,6 +554,21 @@ export declare class AparteConfig {
552
554
  setApprovalPolicy(policy: AparteApprovalPolicy | null): void;
553
555
  /** The registered approval policy, or `null`. */
554
556
  getApprovalPolicy(): AparteApprovalPolicy | null;
557
+ /**
558
+ * Register what makes the context smaller: the gauge's Compact now, a separator's
559
+ * Retry and the client's pre-flight and overflow retry call it. `null` removes it.
560
+ *
561
+ * `@aparte/plugin-compaction`'s `setupCompaction()` registers itself here; core never
562
+ * compacts on its own, so a page without a compactor has a gauge that measures and a
563
+ * separator whose Retry falls back to the `aparte-compact` event. A chat reads the one
564
+ * on ITS config first (`resolveConfig(chat).getCompactor()`), then the client's.
565
+ *
566
+ * Notifies like every other registration: a mounted gauge has to hear that "Compact
567
+ * now" became possible after it was drawn, or went away.
568
+ */
569
+ setCompactor(compactor: AparteCompactor | null): void;
570
+ /** The registered compactor, or `null`. */
571
+ getCompactor(): AparteCompactor | null;
555
572
  /**
556
573
  * What the policy says about one call, with the tool's own `needsApproval` as the
557
574
  * answer when it has no opinion. The one place the two are combined, so the client's
@@ -800,8 +817,13 @@ export declare class AparteConfig {
800
817
  * aparteGlobalConfig.registerToolDisplay('*', { hidden: true });
801
818
  *
802
819
  * @example
820
+ * // An agent's chat: the spinner, "Running" and "Done" (the default is quiet), on every
821
+ * // tool without an entry of its own — a tool with one says `quiet: false` there too.
822
+ * aparteGlobalConfig.registerToolDisplay('*', { quiet: false });
823
+ *
824
+ * @example
803
825
  * // The line, and no raw JSON behind it: nothing, or a detail of the app's own.
804
- * aparteGlobalConfig.registerToolDisplay('read_file', { label: 'Reading a file', details: false });
826
+ * aparteGlobalConfig.registerToolDisplay('read_file', { label: 'Read a file', details: false });
805
827
  * aparteGlobalConfig.registerToolDisplay('web_search', {
806
828
  * label: 'Searched the web',
807
829
  * details: (segment) => sourcesList(segment.result),