@aparte/core 0.22.0 → 0.24.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 (66) hide show
  1. package/dist/client/aparte-client.d.ts +10 -22
  2. package/dist/client/aparte-client.d.ts.map +1 -1
  3. package/dist/client/stream-adapter.d.ts +16 -0
  4. package/dist/client/stream-adapter.d.ts.map +1 -1
  5. package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
  6. package/dist/components/conversation-list/aparte-conversation-list.d.ts +38 -0
  7. package/dist/components/conversation-list/aparte-conversation-list.d.ts.map +1 -1
  8. package/dist/components/conversation-list/index.d.ts +1 -1
  9. package/dist/components/conversation-list/index.d.ts.map +1 -1
  10. package/dist/components/index.d.ts +1 -1
  11. package/dist/components/index.d.ts.map +1 -1
  12. package/dist/components/viewport/aparte-chat-viewport.d.ts +10 -1
  13. package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
  14. package/dist/config/aparte-config.d.ts +76 -19
  15. package/dist/config/aparte-config.d.ts.map +1 -1
  16. package/dist/config/error-renderer.d.ts +3 -1
  17. package/dist/config/error-renderer.d.ts.map +1 -1
  18. package/dist/config/locale.d.ts +49 -4
  19. package/dist/config/locale.d.ts.map +1 -1
  20. package/dist/config/tool-table.d.ts +30 -0
  21. package/dist/config/tool-table.d.ts.map +1 -0
  22. package/dist/conversations/conversation-controller.d.ts +19 -0
  23. package/dist/conversations/conversation-controller.d.ts.map +1 -1
  24. package/dist/conversations/conversation-status.d.ts +27 -0
  25. package/dist/conversations/conversation-status.d.ts.map +1 -0
  26. package/dist/custom-elements.json +12058 -11106
  27. package/dist/{dialog-triggers-3Rk7PuZa.js → dialog-triggers-BqXRdHWZ.js} +746 -205
  28. package/dist/dialog-triggers-BqXRdHWZ.js.map +1 -0
  29. package/dist/index.css +1 -1
  30. package/dist/index.d.ts +4 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +91 -18
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.node.d.ts +3 -2
  35. package/dist/index.node.d.ts.map +1 -1
  36. package/dist/index.node.js +4 -3
  37. package/dist/index.node.js.map +1 -1
  38. package/dist/interop/element-props.d.ts +1 -1
  39. package/dist/interop/element-props.d.ts.map +1 -1
  40. package/dist/renderers/copy-button.d.ts +12 -0
  41. package/dist/renderers/copy-button.d.ts.map +1 -0
  42. package/dist/renderers/segment-renderers.d.ts +6 -3
  43. package/dist/renderers/segment-renderers.d.ts.map +1 -1
  44. package/dist/renderers/segments/code.d.ts.map +1 -1
  45. package/dist/renderers/segments/error.d.ts.map +1 -1
  46. package/dist/renderers/segments/thinking.d.ts.map +1 -1
  47. package/dist/renderers/segments/tool-call.d.ts.map +1 -1
  48. package/dist/transport/agent-handler.d.ts.map +1 -1
  49. package/dist/types/errors.d.ts +2 -0
  50. package/dist/types/errors.d.ts.map +1 -1
  51. package/dist/types/event-map.d.ts +4 -2
  52. package/dist/types/event-map.d.ts.map +1 -1
  53. package/dist/types/events.d.ts +15 -0
  54. package/dist/types/events.d.ts.map +1 -1
  55. package/dist/types/index.d.ts +2 -2
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/segments.d.ts +42 -2
  58. package/dist/types/segments.d.ts.map +1 -1
  59. package/dist/types/tools.d.ts +77 -0
  60. package/dist/types/tools.d.ts.map +1 -1
  61. package/dist/utils/format-duration.d.ts +9 -0
  62. package/dist/utils/format-duration.d.ts.map +1 -0
  63. package/dist/utils/tool-line.d.ts +23 -0
  64. package/dist/utils/tool-line.d.ts.map +1 -0
  65. package/package.json +2 -2
  66. package/dist/dialog-triggers-3Rk7PuZa.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Values registered per tool, by exact name, by pattern, or for every tool (`'*'`).
3
+ *
4
+ * The tool registries were `Map<string, …>` keyed by the exact name, which gave no
5
+ * spelling to a tool whose name the app does not know in advance (an MCP server's
6
+ * `mcp__github__get_issue`) nor to "every tool I have not described". This is the one
7
+ * lookup they share, so the rule is written once: the exact name, else the first pattern
8
+ * REGISTERED that matches, else `'*'`.
9
+ */
10
+ import type { AparteToolMatcher } from '../types/tools.js';
11
+ /** Where a value came from: how specifically it names the tool. */
12
+ export type ToolMatchLevel = 'exact' | 'pattern' | 'any';
13
+ export declare class ToolTable<T> {
14
+ private readonly exact;
15
+ private readonly patterns;
16
+ private any;
17
+ /** The value registered under exactly this matcher — not a resolution. */
18
+ get(match: AparteToolMatcher): T | undefined;
19
+ set(match: AparteToolMatcher, value: T): void;
20
+ delete(match: AparteToolMatcher): void;
21
+ /** The value that applies to a tool named `name`, and how specifically it names it. */
22
+ resolve(name: string): {
23
+ value: T;
24
+ level: ToolMatchLevel;
25
+ } | undefined;
26
+ /** Every value registered, whatever its matcher. */
27
+ values(): T[];
28
+ clear(): void;
29
+ }
30
+ //# sourceMappingURL=tool-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-table.d.ts","sourceRoot":"","sources":["../../src/config/tool-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,mEAAmE;AACnE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;AAEzD,qBAAa,SAAS,CAAC,CAAC;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;IAG9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+C;IACxE,OAAO,CAAC,GAAG,CAAgB;IAE3B,0EAA0E;IAC1E,GAAG,CAAC,KAAK,EAAE,iBAAiB,GAAG,CAAC,GAAG,SAAS;IAK5C,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAa7C,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAMtC,uFAAuF;IACvF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,GAAG,SAAS;IAatE,oDAAoD;IACpD,MAAM,IAAI,CAAC,EAAE;IAMb,KAAK,IAAI,IAAI;CAKhB"}
@@ -87,6 +87,10 @@ export declare class AparteConversationController {
87
87
  private _isStreaming;
88
88
  private _isLoadingConversation;
89
89
  private _ensureInFlight;
90
+ /** The conversation the turn in flight started in, and what the lists were told of it. */
91
+ private _turn;
92
+ /** The reply the turn in flight writes into, from its `aparte-message-start`. */
93
+ private _turnMessage;
90
94
  private _onSendCapture;
91
95
  private _onPathChanged;
92
96
  private _onMessageStart;
@@ -94,6 +98,7 @@ export declare class AparteConversationController {
94
98
  private _onMessageError;
95
99
  private _onMessageAborted;
96
100
  private _onMessagePaused;
101
+ private _onMessageResumed;
97
102
  private _onSelectConversation;
98
103
  private _onCompactDone;
99
104
  private _unsubscribeManager;
@@ -132,6 +137,20 @@ export declare class AparteConversationController {
132
137
  */
133
138
  private _warnedNoManager;
134
139
  private _warnManagerOnTheWrongConfig;
140
+ /**
141
+ * Tell every conversation list on the page what the turn is doing, through
142
+ * `aparte-conversation-status` on `window` — the mirror of the list's
143
+ * `aparte-conversation-select`, which this controller hears. Always about the
144
+ * conversation the turn started in: the person may have opened another since. A turn
145
+ * that starts before its conversation exists (a first message) is told once it does.
146
+ */
147
+ private _setTurn;
148
+ /**
149
+ * Whether a lifecycle event is about the turn in flight. A turn a newer send replaced
150
+ * (a chip, a retry, an edit) says it stopped AFTER the new one started: its end must not
151
+ * end the new turn's state. An event without a message id is taken as this turn's.
152
+ */
153
+ private _ofThisTurn;
135
154
  /**
136
155
  * Attach event listeners to the binding host. Returns an unbind function.
137
156
  */
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-controller.d.ts","sourceRoot":"","sources":["../../src/conversations/conversation-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,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I,MAAM,IAAI;IAiJlB,8BAA8B;IAC9B,mFAAmF;IACnF,OAAO,CAAC,mBAAmB,CAA6B;IAExD,MAAM,IAAI,IAAI;IAoEd;;;;;;;;;;OAUG;IACG,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAqLzD;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAUjB;;;;;;;;;OASG;IACH;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,cAAc;YA+BR,6BAA6B;CAmE9C"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * What each conversation is doing, for every conversation list on the page.
3
+ *
4
+ * The conversation controller says it as turns start, pause and end, and a list applies it
5
+ * to its row. An event alone was edge-triggered: a list that connected after it — a drawer
6
+ * drawn on open, a history screen, a remount — never learnt that a conversation was
7
+ * answering or waiting. So the state is also kept here, page-wide, and a list reads it
8
+ * when it connects. Keyed by conversation id, as the event is: two independent chats with
9
+ * colliding ids share it.
10
+ *
11
+ * No DOM at module level: the controller is also loaded in Node.
12
+ */
13
+ /**
14
+ * What a conversation is doing, as its row says it: `running` while an AI answers in it,
15
+ * `waiting` while its turn waits on the page — a run paused on a question, an approval or a
16
+ * browser tool, the one state a conversation keeps after the person has gone elsewhere.
17
+ */
18
+ export type AparteConversationStatus = 'running' | 'waiting';
19
+ /** Keep a conversation's state without telling anyone: for a list applying an event it heard. */
20
+ export declare function rememberConversationStatus(id: string, status: AparteConversationStatus | null): void;
21
+ /** Keep a conversation's state and tell every list: `aparte-conversation-status` on `window`. */
22
+ export declare function tellConversationStatus(id: string, status: AparteConversationStatus | null): void;
23
+ /** A conversation's state as last told; `null` for neither. */
24
+ export declare function conversationStatusOf(id: string): AparteConversationStatus | null;
25
+ /** Forget every state. Internal: for tests, which share the page between cases. */
26
+ export declare function forgetConversationStatuses(): void;
27
+ //# sourceMappingURL=conversation-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-status.d.ts","sourceRoot":"","sources":["../../src/conversations/conversation-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,SAAS,CAAC;AAI7D,iGAAiG;AACjG,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,wBAAwB,GAAG,IAAI,GAAG,IAAI,CAGpG;AAED,iGAAiG;AACjG,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,wBAAwB,GAAG,IAAI,GAAG,IAAI,CAOhG;AAED,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,wBAAwB,GAAG,IAAI,CAEhF;AAED,mFAAmF;AACnF,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD"}