@aparte/core 0.16.11 → 0.17.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 (81) hide show
  1. package/README.md +6 -0
  2. package/dist/client/aparte-client.d.ts +42 -3
  3. package/dist/client/aparte-client.d.ts.map +1 -1
  4. package/dist/components/bubble/aparte-chat-bubble.d.ts +22 -0
  5. package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
  6. package/dist/components/chat/aparte-chat.d.ts +33 -0
  7. package/dist/components/chat/aparte-chat.d.ts.map +1 -1
  8. package/dist/components/composer/aparte-composer-action.d.ts +5 -3
  9. package/dist/components/composer/aparte-composer-action.d.ts.map +1 -1
  10. package/dist/components/composer/aparte-composer-toolbar.d.ts +5 -2
  11. package/dist/components/composer/aparte-composer-toolbar.d.ts.map +1 -1
  12. package/dist/components/composer/aparte-composer.d.ts +27 -0
  13. package/dist/components/composer/aparte-composer.d.ts.map +1 -1
  14. package/dist/components/context/aparte-context.d.ts +8 -0
  15. package/dist/components/context/aparte-context.d.ts.map +1 -1
  16. package/dist/components/conversation-list/aparte-conversation-list.d.ts +82 -17
  17. package/dist/components/conversation-list/aparte-conversation-list.d.ts.map +1 -1
  18. package/dist/components/scroll-rail/aparte-scroll-rail.d.ts.map +1 -1
  19. package/dist/components/sidebar/aparte-sidebar.d.ts.map +1 -1
  20. package/dist/components/split/aparte-split.d.ts.map +1 -1
  21. package/dist/components/suggestions/aparte-suggestions.d.ts +10 -1
  22. package/dist/components/suggestions/aparte-suggestions.d.ts.map +1 -1
  23. package/dist/components/viewport/aparte-chat-viewport.d.ts +55 -1
  24. package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
  25. package/dist/config/action-provider.d.ts +14 -14
  26. package/dist/config/action-provider.d.ts.map +1 -1
  27. package/dist/config/aparte-config.d.ts +82 -13
  28. package/dist/config/aparte-config.d.ts.map +1 -1
  29. package/dist/config/bubble-shell-renderer.d.ts +50 -12
  30. package/dist/config/bubble-shell-renderer.d.ts.map +1 -1
  31. package/dist/config/locale.d.ts +33 -1
  32. package/dist/config/locale.d.ts.map +1 -1
  33. package/dist/config/sanitize.d.ts.map +1 -1
  34. package/dist/conversations/conversation-controller.d.ts +14 -0
  35. package/dist/conversations/conversation-controller.d.ts.map +1 -1
  36. package/dist/conversations/conversation-manager.d.ts +57 -19
  37. package/dist/conversations/conversation-manager.d.ts.map +1 -1
  38. package/dist/conversations/types.d.ts +18 -11
  39. package/dist/conversations/types.d.ts.map +1 -1
  40. package/dist/custom-elements.json +10818 -10062
  41. package/dist/{dialog-triggers-cYGTlfZf.js → dialog-triggers-Bb-3EkT4.js} +591 -161
  42. package/dist/dialog-triggers-Bb-3EkT4.js.map +1 -0
  43. package/dist/generated/element-attributes.d.ts +10 -4
  44. package/dist/generated/element-attributes.d.ts.map +1 -1
  45. package/dist/host/aparte-chat-host.d.ts +30 -0
  46. package/dist/host/aparte-chat-host.d.ts.map +1 -1
  47. package/dist/index.css +1 -8393
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +550 -98
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.node.d.ts +1 -1
  53. package/dist/index.node.d.ts.map +1 -1
  54. package/dist/index.node.js +1 -1
  55. package/dist/index.node.js.map +1 -1
  56. package/dist/interop/element-props.d.ts +1 -1
  57. package/dist/primitives/select/aparte-optgroup.d.ts +1 -0
  58. package/dist/primitives/select/aparte-optgroup.d.ts.map +1 -1
  59. package/dist/primitives/select/aparte-select.d.ts +12 -1
  60. package/dist/primitives/select/aparte-select.d.ts.map +1 -1
  61. package/dist/renderers/markdown-stream.d.ts.map +1 -1
  62. package/dist/runtime/message-repository.d.ts +16 -3
  63. package/dist/runtime/message-repository.d.ts.map +1 -1
  64. package/dist/types/chat.d.ts +41 -46
  65. package/dist/types/chat.d.ts.map +1 -1
  66. package/dist/types/event-map.d.ts +7 -7
  67. package/dist/types/event-map.d.ts.map +1 -1
  68. package/dist/types/events.d.ts +7 -6
  69. package/dist/types/events.d.ts.map +1 -1
  70. package/dist/types/imperative-api.d.ts +16 -0
  71. package/dist/types/imperative-api.d.ts.map +1 -1
  72. package/dist/types/index.d.ts +2 -2
  73. package/dist/types/index.d.ts.map +1 -1
  74. package/dist/types/models.d.ts +9 -0
  75. package/dist/types/models.d.ts.map +1 -1
  76. package/dist/types/segments.d.ts +56 -13
  77. package/dist/types/segments.d.ts.map +1 -1
  78. package/dist/utils/event-target.d.ts +31 -0
  79. package/dist/utils/event-target.d.ts.map +1 -0
  80. package/package.json +2 -2
  81. package/dist/dialog-triggers-cYGTlfZf.js.map +0 -1
@@ -39,20 +39,6 @@ export declare function applyRetention(messages: AparteMessage[], tree: Exported
39
39
  messages: AparteMessage[];
40
40
  tree: ExportedMessageRepository | undefined;
41
41
  };
42
- /**
43
- * Framework-agnostic conversation manager.
44
- *
45
- * Usage:
46
- * ```ts
47
- * const manager = new AparteConversationManager(myAdapter);
48
- * await manager.init(); // load from storage
49
- * const conv = await manager.createNew(); // returns new AparteConversation
50
- * ```
51
- *
52
- * The manager emits synchronous notifications to registered listeners on every
53
- * mutation so framework wrappers (Angular signals, Vue reactive, etc.) can
54
- * react without polling.
55
- */
56
42
  export declare class AparteConversationManager {
57
43
  private _adapter;
58
44
  private _conversations;
@@ -61,6 +47,14 @@ export declare class AparteConversationManager {
61
47
  private _initialized;
62
48
  private _retention;
63
49
  private _titleProvider;
50
+ /** Ids whose messages are in memory. Every id, after a loadAll(); only fetched ones after loadMeta(). */
51
+ private _loaded;
52
+ /** One fetch per id at a time: a second ensureFull(id) while the first is in flight joins it. */
53
+ private _fetching;
54
+ /** One append per id at a time: the next addMessage(id) reads what the previous one wrote. */
55
+ private _appending;
56
+ /** The list on its way: a conversation created meanwhile waits for it, or the list would replace it. */
57
+ private _initPromise;
64
58
  constructor(adapter: AparteStorageAdapter, options?: ConversationManagerOptions);
65
59
  /**
66
60
  * Replace how a new conversation is titled from its first user message.
@@ -70,8 +64,31 @@ export declare class AparteConversationManager {
70
64
  setTitleProvider(provider: AparteConversationTitleProvider | null): void;
71
65
  /** The registered title provider, or `null` when the default applies. */
72
66
  getTitleProvider(): AparteConversationTitleProvider | null;
73
- /** Load all conversations from the adapter. Call once at app startup. */
67
+ /**
68
+ * Load all conversations from the adapter. Call once at app startup.
69
+ *
70
+ * A later call re-reads the list from the store: rows it no longer lists are
71
+ * dropped, and a conversation whose messages are already in memory keeps them —
72
+ * so the one on screen goes on being persisted.
73
+ */
74
74
  init(): Promise<void>;
75
+ /** Whether a conversation's messages are in memory (always, without split storage). */
76
+ isLoaded(id: string): boolean;
77
+ /**
78
+ * Fetch a conversation's messages through the adapter's loadFull(), the first time
79
+ * they are needed; later calls resolve at once. The row keeps its place and its meta;
80
+ * the messages (and the tree) come from the full record, and a message written to
81
+ * the row while the fetch ran goes after them. Resolves `false` when the store has no
82
+ * such record (or answers with another id) — the row is then NOT loaded, and says so,
83
+ * rather than counting as an empty conversation.
84
+ */
85
+ ensureFull(id: string): Promise<boolean>;
86
+ /**
87
+ * The row with its messages in memory — fetched first when they are not, so a
88
+ * metadata change never writes a row back without them. `null` when the id is
89
+ * unknown or the store has no record to fetch.
90
+ */
91
+ private _full;
75
92
  /**
76
93
  * Whether `init()` has completed at least once. Consumers use this to
77
94
  * distinguish "manager still hydrating from storage" from "manager
@@ -87,14 +104,27 @@ export declare class AparteConversationManager {
87
104
  get activeConversations(): AparteConversation[];
88
105
  /** Archived conversations, newest first. */
89
106
  get archivedConversations(): AparteConversation[];
90
- /** Create a new empty conversation, persist it, and make it active. */
107
+ /**
108
+ * Create a new empty conversation, persist it, and make it active. Untitled by
109
+ * default: the list shows its locale's `newChat` word for an empty title, so the
110
+ * store never carries an English string a French UI would then display.
111
+ */
91
112
  createNew(title?: string): Promise<AparteConversation>;
92
113
  /** Switch active conversation without touching storage. */
93
114
  select(id: string): void;
94
115
  /** Deselect the active conversation (no conv selected). */
95
116
  clearActive(): void;
96
- /** Append a message to a conversation. Auto-generates title from first user message. */
117
+ /**
118
+ * Append a message to a conversation. Auto-generates title from first user message.
119
+ *
120
+ * One append at a time per conversation: two sends that overlap (a suggestion and a
121
+ * quick type, coalesced into one new conversation) both suspend before reading the
122
+ * record — for the messages, then for the title provider — so both used to read a
123
+ * conversation with no user message in it yet, and the second one's text became the
124
+ * title.
125
+ */
97
126
  addMessage(convId: string, msg: AparteMessage): Promise<void>;
127
+ private _append;
98
128
  /**
99
129
  * Replace the flat active-path messages and optionally the full branch tree.
100
130
  * `messages` is always written (active path, for sidebar/title/compat).
@@ -105,6 +135,13 @@ export declare class AparteConversationManager {
105
135
  delete(id: string): Promise<void>;
106
136
  /** Archive a conversation (soft-delete). */
107
137
  archive(id: string): Promise<void>;
138
+ /**
139
+ * A metadata change, through the adapter's own hook when it has one (the row is
140
+ * updated in memory, nothing else travels), else through `save()` — with the
141
+ * messages fetched first, so a row the list came with (`messages: []`) is never
142
+ * written back over the stored ones.
143
+ */
144
+ private _meta;
108
145
  /** Restore an archived conversation. */
109
146
  unarchive(id: string): Promise<void>;
110
147
  /**
@@ -126,8 +163,9 @@ export declare class AparteConversationManager {
126
163
  private _replace;
127
164
  private _notify;
128
165
  /**
129
- * The title of a conversation, decided once, on its first user message: the
130
- * provider's answer when one is registered and answers, else the default.
166
+ * The title of a conversation, decided on its first user message — and again if
167
+ * that message is edited while the title is still the manager's: the provider's
168
+ * answer when one is registered and answers, else the default.
131
169
  */
132
170
  private _title;
133
171
  private _autoTitle;
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-manager.d.ts","sourceRoot":"","sources":["../../src/conversations/conversation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAIlF,KAAK,QAAQ,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EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;YAarD,OAAO;IA6BrB;;;;OAIG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,IAAI,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+DhH,yCAAyC;IACnC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQvC,4CAA4C;IACtC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxC;;;;;OAKG;YACW,KAAK;IAoBnB,wCAAwC;IAClC,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1C;;;;;OAKG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpC,yDAAyD;IACnD,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtC;;;sEAGkE;IAC5D,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB3D,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI;IAOzC,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,OAAO;IAcf;;;;OAIG;YACW,MAAM;IAYpB,OAAO,CAAC,UAAU;CAOrB"}
@@ -16,8 +16,21 @@ export declare const APARTE_CONVERSATION_SCHEMA_VERSION: 2;
16
16
  */
17
17
  export interface AparteConversation {
18
18
  id: string;
19
- /** Auto-generated from the first user message (≤50 chars). */
19
+ /**
20
+ * The title. Decided by the manager from the first user message (the text as
21
+ * typed, or what the title provider returns), or typed by the user. Empty when
22
+ * the conversation has no text yet: the list shows its locale's `newChat` word,
23
+ * and the store never carries a UI string.
24
+ */
20
25
  title: string;
26
+ /**
27
+ * `true` while the title is the manager's decision. Editing the first user
28
+ * message then re-titles; a title typed by the user (`updateTitle`) clears it
29
+ * and is kept whatever happens to the messages. Absent on records written
30
+ * before this field existed, which reads as "typed": an old title is never
31
+ * overwritten.
32
+ */
33
+ autoTitle?: boolean;
21
34
  createdAt: number;
22
35
  updatedAt: number;
23
36
  messages: AparteMessage[];
@@ -34,8 +47,6 @@ export interface AparteConversation {
34
47
  archivedAt?: number;
35
48
  /** When truthy the conversation is pinned at the top of the list. */
36
49
  pinnedAt?: number;
37
- /** Optional folder/tag id for organisation (V2+). */
38
- folderId?: string;
39
50
  /**
40
51
  * Schema version of this record. Absent on legacy data (pre-versioning):
41
52
  * adapters should treat `undefined` as version 0 and migrate on read.
@@ -54,13 +65,6 @@ export interface AparteConversationMeta {
54
65
  updatedAt: number;
55
66
  archivedAt?: number;
56
67
  pinnedAt?: number;
57
- folderId?: string;
58
- /** Truncated last message body (≤200 chars) — for sidebar previews. */
59
- lastMessagePreview?: string;
60
- /** Cached message count for the sidebar badge / archive logic. */
61
- messageCount?: number;
62
- /** Sum of input+output tokens across messages, when available. */
63
- totalTokens?: number;
64
68
  /** Persisted schema version of the row. */
65
69
  schemaVersion?: number;
66
70
  }
@@ -92,7 +96,10 @@ export interface AparteAttachmentRow {
92
96
  * artifact gallery index. Each is a product's own table — the shape of a "memory
93
97
  * fact" or of a settings entry is the app's decision — and a public contract
94
98
  * carrying one app's schema binds every other adapter to it. An app that needs
95
- * them extends this interface in its own code.
99
+ * them extends this interface in its own code. Nor is a row's own bookkeeping: a
100
+ * folder id, a cached last-message preview, a message count and a token total are
101
+ * things a store computes for itself, so they live on the adapter's own row shape
102
+ * rather than on `AparteConversation` / `AparteConversationMeta`.
96
103
  */
97
104
  export interface AparteStorageAdapter {
98
105
  /** Return all stored conversations (full payload), ordered by updatedAt desc. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/conversations/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