@assistant-ui/core 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.d.ts +104 -0
- package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -0
- package/dist/react/primitives/message/MessageGroupedParts.js +74 -0
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -0
- package/dist/react/primitives/message/MessageParts.d.ts +14 -1
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +55 -35
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +3 -3
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +26 -5
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +2 -2
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +6 -5
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/utils/groupParts.d.ts +49 -0
- package/dist/react/utils/groupParts.d.ts.map +1 -0
- package/dist/react/utils/groupParts.js +97 -0
- package/dist/react/utils/groupParts.js.map +1 -0
- package/dist/runtime/api/bindings.d.ts +1 -0
- package/dist/runtime/api/bindings.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.d.ts +7 -5
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +1 -1
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.d.ts +18 -3
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js +1 -0
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +5 -5
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js +1 -1
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +4 -3
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +54 -26
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +3 -3
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +11 -11
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +28 -2
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +1 -0
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +37 -2
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js +2 -2
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +2 -2
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +3 -0
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +13 -1
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +5 -6
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
- package/dist/store/scopes/composer.d.ts +11 -1
- package/dist/store/scopes/composer.d.ts.map +1 -1
- package/dist/store/scopes/thread-list-item.d.ts +11 -0
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread.d.ts +17 -0
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/subscribable/subscribable.d.ts +4 -4
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +4 -4
- package/dist/subscribable/subscribable.js.map +1 -1
- package/package.json +21 -9
- package/src/index.ts +10 -0
- package/src/react/adapters/LocalStorageThreadListAdapter.tsx +2 -0
- package/src/react/index.ts +2 -0
- package/src/react/primitives/message/MessageGroupedParts.tsx +186 -0
- package/src/react/primitives/message/MessageParts.tsx +101 -49
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +40 -7
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +6 -12
- package/src/react/utils/groupParts.ts +152 -0
- package/src/runtime/api/bindings.ts +1 -0
- package/src/runtime/api/composer-runtime.ts +14 -11
- package/src/runtime/api/thread-list-item-runtime.ts +28 -6
- package/src/runtime/api/thread-list-runtime.ts +1 -0
- package/src/runtime/api/thread-runtime.ts +11 -7
- package/src/runtime/base/base-composer-runtime-core.ts +99 -35
- package/src/runtime/base/base-thread-runtime-core.ts +21 -12
- package/src/runtime/interfaces/composer-runtime-core.ts +39 -7
- package/src/runtime/interfaces/thread-list-runtime-core.ts +1 -0
- package/src/runtime/interfaces/thread-runtime-core.ts +44 -6
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +2 -2
- package/src/runtimes/local/local-thread-runtime-core.ts +2 -2
- package/src/runtimes/remote-thread-list/remote-thread-state.ts +3 -0
- package/src/runtimes/remote-thread-list/types.ts +13 -1
- package/src/store/runtime-clients/composer-runtime-client.ts +5 -9
- package/src/store/scopes/composer.ts +11 -0
- package/src/store/scopes/thread-list-item.ts +11 -0
- package/src/store/scopes/thread.ts +17 -0
- package/src/subscribable/subscribable.ts +10 -7
- package/src/tests/RemoteThreadListThreadListRuntimeCore-custom-metadata.test.ts +123 -0
- package/src/tests/base-composer-runtime-core-addAttachment.test.ts +217 -0
- package/src/tests/groupParts.test.ts +114 -0
|
@@ -121,15 +121,32 @@ export type ThreadMeta = {
|
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
123
|
export type ThreadEvents = {
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated State-derivable. Observe `isRunning` flipping to `true` via
|
|
126
|
+
* `useAuiState` instead. Kept for backward compatibility.
|
|
127
|
+
*/
|
|
124
128
|
"thread.runStart": {
|
|
125
129
|
threadId: string;
|
|
126
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* @deprecated State-derivable. Observe `isRunning` flipping to `false` via
|
|
133
|
+
* `useAuiState` instead. Kept for backward compatibility.
|
|
134
|
+
*/
|
|
127
135
|
"thread.runEnd": {
|
|
128
136
|
threadId: string;
|
|
129
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated State-derivable. This event fires before the first message is
|
|
140
|
+
* added; observe `messages` becoming non-empty via `useAuiState` instead of
|
|
141
|
+
* reading state inside this event handler. Kept for backward compatibility.
|
|
142
|
+
*/
|
|
130
143
|
"thread.initialize": {
|
|
131
144
|
threadId: string;
|
|
132
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* Truly transient. Model context lives in a provider, not in thread state,
|
|
148
|
+
* so this event has no state-derivable equivalent.
|
|
149
|
+
*/
|
|
133
150
|
"thread.modelContextUpdate": {
|
|
134
151
|
threadId: string;
|
|
135
152
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../../src/store/scopes/thread.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EACjB,wDAAqD;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,kDAA+C;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,mCAAgC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,mDAAgD;AACjF,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACd,4CAAyC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,qCAAkC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,qBAAkB;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,sBAAmB;AAEjE,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC;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MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC"}
|
|
@@ -12,7 +12,7 @@ export type NestedSubscribable<TState extends Subscribable | undefined, TPath> =
|
|
|
12
12
|
export type EventSubscribable<TEvent extends string> = {
|
|
13
13
|
event: TEvent;
|
|
14
14
|
binding: SubscribableWithState<{
|
|
15
|
-
unstable_on: (event: TEvent, callback: () => void) => Unsubscribe;
|
|
15
|
+
unstable_on: (event: TEvent, callback: (payload?: unknown) => void) => Unsubscribe;
|
|
16
16
|
} | undefined, unknown>;
|
|
17
17
|
};
|
|
18
18
|
export declare class BaseSubscribable {
|
|
@@ -26,9 +26,9 @@ export declare abstract class BaseSubject {
|
|
|
26
26
|
private _connection;
|
|
27
27
|
protected get isConnected(): boolean;
|
|
28
28
|
protected abstract _connect(): Unsubscribe;
|
|
29
|
-
protected notifySubscribers(): void;
|
|
29
|
+
protected notifySubscribers(payload?: unknown): void;
|
|
30
30
|
private _updateConnection;
|
|
31
|
-
subscribe(callback: () => void): () => void;
|
|
31
|
+
subscribe(callback: (payload?: unknown) => void): () => void;
|
|
32
32
|
}
|
|
33
33
|
export declare class ShallowMemoizeSubject<TState extends object, TPath> extends BaseSubject implements SubscribableWithState<TState, TPath> {
|
|
34
34
|
private binding;
|
|
@@ -60,7 +60,7 @@ export declare class EventSubscriptionSubject<TEvent extends string> extends Bas
|
|
|
60
60
|
private config;
|
|
61
61
|
constructor(config: EventSubscribable<TEvent>);
|
|
62
62
|
getState(): {
|
|
63
|
-
unstable_on: (event: TEvent, callback: () => void) => Unsubscribe;
|
|
63
|
+
unstable_on: (event: TEvent, callback: (payload?: unknown) => void) => Unsubscribe;
|
|
64
64
|
} | undefined;
|
|
65
65
|
outerSubscribe(callback: () => void): Unsubscribe;
|
|
66
66
|
protected _connect(): Unsubscribe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribable.d.ts","sourceRoot":"","sources":["../../src/subscribable/subscribable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gCAA6B;AAExD,eAAO,MAAM,WAAW,eAAwB,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,WAAW,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,MAAM,EAAE,KAAK,IAAI,YAAY,GAAG;IAChE,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,MAAM,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAC5B,MAAM,SAAS,YAAY,GAAG,SAAS,EACvC,KAAK,IACH,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEzC,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,MAAM,IAAI;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,qBAAqB,CAC1B;QACE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"subscribable.d.ts","sourceRoot":"","sources":["../../src/subscribable/subscribable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gCAA6B;AAExD,eAAO,MAAM,WAAW,eAAwB,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,WAAW,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,MAAM,EAAE,KAAK,IAAI,YAAY,GAAG;IAChE,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,MAAM,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAC5B,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kB,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,CAC1D,SAAQ,WACR,YAAW,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC;IAO7C,OAAO,CAAC,OAAO;IALjB,IAAW,IAAI,UAEd;gBAGS,OAAO,EAAE,qBAAqB,CAAC,MAAM,GAAG,WAAW,EAAE,KAAK,CAAC;IAKrE,OAAO,CAAC,mBAAmB,CAAQ;IACnC,OAAO,CAAC,cAAc,CAAqB;IACpC,QAAQ,eAWb;IAEF,SAAS,CAAC,QAAQ;CAQnB;AAED,qBAAa,yBAAyB,CAClC,MAAM,SAAS,YAAY,GAAG,SAAS,EACvC,KAAK,CAEP,SAAQ,WACR,YACE,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,EACpC,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC;IAMvB,OAAO,CAAC,OAAO;IAJ3B,IAAW,IAAI,UAEd;gBAEmB,OAAO,EAAE,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC;IAIvD,QAAQ;IAIR,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI;IAI1C,SAAS,CAAC,QAAQ,IAAI,WAAW;CAwBlC;AAED,qBAAa,wBAAwB,CACnC,MAAM,SAAS,MAAM,CACrB,SAAQ,WAAW;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;IAI9C,QAAQ;+CAjPG,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,KAClC,WAAW;;IAoPf,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI;IAI1C,SAAS,CAAC,QAAQ,IAAI,WAAW;CAsBlC"}
|
|
@@ -58,9 +58,9 @@ export class BaseSubject {
|
|
|
58
58
|
get isConnected() {
|
|
59
59
|
return !!this._connection;
|
|
60
60
|
}
|
|
61
|
-
notifySubscribers() {
|
|
61
|
+
notifySubscribers(payload) {
|
|
62
62
|
for (const callback of this._subscriptions)
|
|
63
|
-
callback();
|
|
63
|
+
callback(payload);
|
|
64
64
|
}
|
|
65
65
|
_updateConnection() {
|
|
66
66
|
if (this._subscriptions.size > 0) {
|
|
@@ -200,8 +200,8 @@ export class EventSubscriptionSubject extends BaseSubject {
|
|
|
200
200
|
return this.config.binding.subscribe(callback);
|
|
201
201
|
}
|
|
202
202
|
_connect() {
|
|
203
|
-
const callback = () => {
|
|
204
|
-
this.notifySubscribers();
|
|
203
|
+
const callback = (payload) => {
|
|
204
|
+
this.notifySubscribers(payload);
|
|
205
205
|
};
|
|
206
206
|
let lastState = this.config.binding.getState();
|
|
207
207
|
let innerUnsubscribe = lastState?.unstable_on(this.config.event, callback);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribable.js","sourceRoot":"","sources":["../../src/subscribable/subscribable.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"subscribable.js","sourceRoot":"","sources":["../../src/subscribable/subscribable.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AA+BjD,SAAS,YAAY,CACnB,IAAmB,EACnB,IAAmB;IAEnB,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC1D,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACrC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAErC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAc,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAc,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;YAAE,OAAO,KAA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SAAS,GAAG,QAAQ,CAAC;YAErB,gBAAgB,EAAE,EAAE,CAAC;YACrB,gBAAgB,GAAG,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACxE,CAAC,CAAC;QAEF,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QAC9D,OAAO,GAAG,EAAE;YACV,gBAAgB,EAAE,EAAE,CAAC;YACrB,gBAAgB,EAAE,EAAE,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Framework-agnostic core runtime for assistant-ui",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assistant",
|
|
@@ -32,14 +32,26 @@
|
|
|
32
32
|
"./react": {
|
|
33
33
|
"types": "./dist/react/index.d.ts",
|
|
34
34
|
"default": "./dist/react/index.js"
|
|
35
|
-
},
|
|
36
|
-
"./*": {
|
|
37
|
-
"types": "./dist/*.d.ts",
|
|
38
|
-
"default": "./dist/*.js"
|
|
39
35
|
}
|
|
40
36
|
},
|
|
41
37
|
"main": "./dist/index.js",
|
|
42
38
|
"types": "./dist/index.d.ts",
|
|
39
|
+
"typesVersions": {
|
|
40
|
+
"*": {
|
|
41
|
+
"react": [
|
|
42
|
+
"./dist/react/index.d.ts"
|
|
43
|
+
],
|
|
44
|
+
"internal": [
|
|
45
|
+
"./dist/internal.d.ts"
|
|
46
|
+
],
|
|
47
|
+
"store": [
|
|
48
|
+
"./dist/store/index.d.ts"
|
|
49
|
+
],
|
|
50
|
+
"store/internal": [
|
|
51
|
+
"./dist/store/internal.d.ts"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
43
55
|
"files": [
|
|
44
56
|
"dist",
|
|
45
57
|
"src",
|
|
@@ -51,8 +63,8 @@
|
|
|
51
63
|
"nanoid": "^5.1.9"
|
|
52
64
|
},
|
|
53
65
|
"peerDependencies": {
|
|
54
|
-
"@assistant-ui/store": "^0.2.
|
|
55
|
-
"@assistant-ui/tap": "^0.5.
|
|
66
|
+
"@assistant-ui/store": "^0.2.9",
|
|
67
|
+
"@assistant-ui/tap": "^0.5.10",
|
|
56
68
|
"@types/react": "*",
|
|
57
69
|
"react": "^18 || ^19",
|
|
58
70
|
"assistant-cloud": "^0.1.27",
|
|
@@ -77,8 +89,8 @@
|
|
|
77
89
|
"react": "^19.2.5",
|
|
78
90
|
"vitest": "^4.1.5",
|
|
79
91
|
"zustand": "^5.0.12",
|
|
80
|
-
"@assistant-ui/store": "0.2.
|
|
81
|
-
"@assistant-ui/tap": "0.5.
|
|
92
|
+
"@assistant-ui/store": "0.2.9",
|
|
93
|
+
"@assistant-ui/tap": "0.5.10",
|
|
82
94
|
"@assistant-ui/x-buildutils": "0.0.6",
|
|
83
95
|
"assistant-cloud": "0.1.27"
|
|
84
96
|
},
|
package/src/index.ts
CHANGED
|
@@ -32,7 +32,9 @@ export type {
|
|
|
32
32
|
export type {
|
|
33
33
|
Attachment,
|
|
34
34
|
PendingAttachment,
|
|
35
|
+
PendingAttachmentStatus,
|
|
35
36
|
CompleteAttachment,
|
|
37
|
+
CompleteAttachmentStatus,
|
|
36
38
|
AttachmentStatus,
|
|
37
39
|
CreateAttachment,
|
|
38
40
|
} from "./types/attachment";
|
|
@@ -143,7 +145,11 @@ export type {
|
|
|
143
145
|
|
|
144
146
|
// Runtime Core Interface Types
|
|
145
147
|
export type {
|
|
148
|
+
AttachmentAddErrorEvent,
|
|
149
|
+
AttachmentAddErrorReason,
|
|
146
150
|
ComposerRuntimeCore,
|
|
151
|
+
ComposerRuntimeEventCallback,
|
|
152
|
+
ComposerRuntimeEventPayload,
|
|
147
153
|
ComposerRuntimeEventType,
|
|
148
154
|
DictationState,
|
|
149
155
|
EditComposerRuntimeCore,
|
|
@@ -160,6 +166,8 @@ export type {
|
|
|
160
166
|
SpeechState,
|
|
161
167
|
VoiceSessionState,
|
|
162
168
|
SubmittedFeedback,
|
|
169
|
+
ThreadRuntimeEventCallback,
|
|
170
|
+
ThreadRuntimeEventPayload,
|
|
163
171
|
ThreadRuntimeEventType,
|
|
164
172
|
StartRunConfig,
|
|
165
173
|
ResumeRunConfig,
|
|
@@ -191,6 +199,8 @@ export type {
|
|
|
191
199
|
} from "./runtime/api/thread-list-runtime";
|
|
192
200
|
|
|
193
201
|
export type {
|
|
202
|
+
ThreadListItemEventCallback,
|
|
203
|
+
ThreadListItemEventPayload,
|
|
194
204
|
ThreadListItemEventType,
|
|
195
205
|
ThreadListItemRuntime,
|
|
196
206
|
} from "./runtime/api/thread-list-item-runtime";
|
|
@@ -28,6 +28,8 @@ type LocalStorageAdapterOptions = {
|
|
|
28
28
|
titleGenerator?: TitleGenerationAdapter | undefined;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
// `RemoteThreadMetadata.custom` is intentionally not persisted; consumers that
|
|
32
|
+
// need it across reloads should fork this adapter or use a remote backend.
|
|
31
33
|
type StoredThreadMetadata = {
|
|
32
34
|
remoteId: string;
|
|
33
35
|
externalId?: string;
|
package/src/react/index.ts
CHANGED
|
@@ -163,7 +163,9 @@ export {
|
|
|
163
163
|
MessagePrimitivePartByIndex,
|
|
164
164
|
defaultComponents as messagePartsDefaultComponents,
|
|
165
165
|
type EnrichedPartState,
|
|
166
|
+
type PartState,
|
|
166
167
|
} from "./primitives/message/MessageParts";
|
|
168
|
+
export { MessagePrimitiveGroupedParts } from "./primitives/message/MessageGroupedParts";
|
|
167
169
|
export { MessagePrimitiveQuote } from "./primitives/message/MessageQuote";
|
|
168
170
|
export {
|
|
169
171
|
MessagePrimitiveAttachments,
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Fragment, type FC, type ReactNode, useMemo } from "react";
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
|
+
import { useShallow } from "zustand/shallow";
|
|
6
|
+
import type { PartState } from "../../../store/scopes/part";
|
|
7
|
+
import type {
|
|
8
|
+
MessagePartStatus,
|
|
9
|
+
ToolCallMessagePartStatus,
|
|
10
|
+
} from "../../../types/message";
|
|
11
|
+
import {
|
|
12
|
+
buildGroupTree,
|
|
13
|
+
type GroupKey,
|
|
14
|
+
type GroupNode,
|
|
15
|
+
normalizeGroupKey,
|
|
16
|
+
} from "../../utils/groupParts";
|
|
17
|
+
import { MessagePartChildren, type EnrichedPartState } from "./MessageParts";
|
|
18
|
+
|
|
19
|
+
export namespace MessagePrimitiveGroupedParts {
|
|
20
|
+
/**
|
|
21
|
+
* A coalesced group of adjacent parts. Surfaced through the same
|
|
22
|
+
* `{ part }` channel as a leaf {@link EnrichedPartState} so consumers
|
|
23
|
+
* dispatch on a single `switch (part.type)`. `type` is the group key
|
|
24
|
+
* (always `"group-…"`); `status` mirrors the last contained part.
|
|
25
|
+
*/
|
|
26
|
+
export type GroupPart<TKey extends `group-${string}` = `group-${string}`> = {
|
|
27
|
+
readonly type: TKey;
|
|
28
|
+
readonly status: MessagePartStatus | ToolCallMessagePartStatus;
|
|
29
|
+
readonly indices: readonly number[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type RenderInfo<TKey extends `group-${string}` = `group-${string}`> = {
|
|
33
|
+
/**
|
|
34
|
+
* Either a coalesced group ({@link GroupPart}, identified by a
|
|
35
|
+
* `group-…` `type`) or a single enriched part. Use one switch over
|
|
36
|
+
* `part.type` to handle both.
|
|
37
|
+
*/
|
|
38
|
+
readonly part: GroupPart<TKey> | EnrichedPartState;
|
|
39
|
+
/**
|
|
40
|
+
* For group nodes: the recursively-rendered subtree (subgroups +
|
|
41
|
+
* leaf parts). For leaf parts: a sentinel that throws when rendered
|
|
42
|
+
* — accidental fall-through (`default: return children;`) errors
|
|
43
|
+
* loudly instead of silently rendering nothing.
|
|
44
|
+
*/
|
|
45
|
+
readonly children: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type Props<TKey extends `group-${string}` = `group-${string}`> = {
|
|
49
|
+
/**
|
|
50
|
+
* Maps each part to its group key path. Adjacent parts that share a
|
|
51
|
+
* prefix coalesce up to that prefix. Return `null`, `undefined`, or
|
|
52
|
+
* `[]` to leave a part ungrouped — it will be rendered as a leaf
|
|
53
|
+
* through `children` with `part` set to its {@link EnrichedPartState}.
|
|
54
|
+
*
|
|
55
|
+
* Keys must start with `"group-"` so the renderer's
|
|
56
|
+
* `switch (part.type)` can distinguish groups from real part types.
|
|
57
|
+
*
|
|
58
|
+
* For best performance, pass a stable reference (module-level
|
|
59
|
+
* constant or `useCallback`).
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const groupBy = (part) =>
|
|
64
|
+
* part.type === "reasoning" ? ["group-thought", "group-reasoning"] :
|
|
65
|
+
* part.type === "tool-call" ? ["group-thought", "group-tool"] :
|
|
66
|
+
* null;
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
readonly groupBy: (
|
|
70
|
+
part: PartState,
|
|
71
|
+
index: number,
|
|
72
|
+
parts: readonly PartState[],
|
|
73
|
+
) => GroupKey<TKey>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Render function called once per group node and once per leaf part.
|
|
77
|
+
* Switch on `part.type`: `"group-…"` cases wrap `children`; real
|
|
78
|
+
* part types (`"text"`, `"tool-call"`, …) render the part directly.
|
|
79
|
+
*
|
|
80
|
+
* Leaf parts receive the same {@link EnrichedPartState} that
|
|
81
|
+
* `<MessagePrimitive.Parts>` would produce (`toolUI`, `addResult`,
|
|
82
|
+
* `resume`, `dataRendererUI`).
|
|
83
|
+
*/
|
|
84
|
+
readonly children: (info: RenderInfo<TKey>) => ReactNode;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const COMPLETE_STATUS: MessagePartStatus = Object.freeze({ type: "complete" });
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* `children` placeholder passed for leaf-part renders. Leaf parts have no
|
|
92
|
+
* inner subtree; rendering this sentinel signals the consumer wrote
|
|
93
|
+
* `default: return children;` and accidentally fell through for a part —
|
|
94
|
+
* surface the bug loudly instead of silently rendering nothing.
|
|
95
|
+
*/
|
|
96
|
+
const PartChildrenSentinel: FC = () => {
|
|
97
|
+
throw new Error(
|
|
98
|
+
"MessagePrimitive.GroupedParts: rendered `children` under a leaf " +
|
|
99
|
+
"part. `children` is only meaningful for `group-…` cases — add a " +
|
|
100
|
+
"matching case for the part type or return `null` to skip it.",
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const renderNode = <TKey extends `group-${string}`>(
|
|
105
|
+
node: GroupNode,
|
|
106
|
+
parts: readonly PartState[],
|
|
107
|
+
render: (info: MessagePrimitiveGroupedParts.RenderInfo<TKey>) => ReactNode,
|
|
108
|
+
): ReactNode => {
|
|
109
|
+
if (node.type === "part") {
|
|
110
|
+
return (
|
|
111
|
+
<MessagePartChildren key={node.nodeKey} index={node.index}>
|
|
112
|
+
{({ part }) => render({ part, children: <PartChildrenSentinel /> })}
|
|
113
|
+
</MessagePartChildren>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const status = parts[node.indices.at(-1)!]?.status ?? COMPLETE_STATUS;
|
|
118
|
+
const groupPart: MessagePrimitiveGroupedParts.GroupPart<TKey> = {
|
|
119
|
+
type: node.key as TKey,
|
|
120
|
+
status,
|
|
121
|
+
indices: node.indices,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<Fragment key={node.nodeKey}>
|
|
126
|
+
{render({
|
|
127
|
+
part: groupPart,
|
|
128
|
+
children: (
|
|
129
|
+
<>{node.children.map((child) => renderNode(child, parts, render))}</>
|
|
130
|
+
),
|
|
131
|
+
})}
|
|
132
|
+
</Fragment>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Groups adjacent message parts into a tree of coalesced runs and
|
|
138
|
+
* renders each node — group or part — through a single `children`
|
|
139
|
+
* function.
|
|
140
|
+
*
|
|
141
|
+
* The render function receives `{ part, children }` where `part.type`
|
|
142
|
+
* is either a `"group-…"` literal (for a group, `children` is the
|
|
143
|
+
* recursively-rendered subtree) or a real part type (`"text"`,
|
|
144
|
+
* `"tool-call"`, …) for a leaf (`children` is a sentinel that throws
|
|
145
|
+
* if rendered — use `part.type` to distinguish).
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```tsx
|
|
149
|
+
* <MessagePrimitive.GroupedParts
|
|
150
|
+
* groupBy={(part) =>
|
|
151
|
+
* part.type === "reasoning" ? ["group-thought", "group-reasoning"] :
|
|
152
|
+
* part.type === "tool-call" ? ["group-thought", "group-tool"] :
|
|
153
|
+
* null
|
|
154
|
+
* }
|
|
155
|
+
* >
|
|
156
|
+
* {({ part, children }) => {
|
|
157
|
+
* switch (part.type) {
|
|
158
|
+
* case "group-thought": return <Thought>{children}</Thought>;
|
|
159
|
+
* case "group-reasoning": return <Reasoning>{children}</Reasoning>;
|
|
160
|
+
* case "group-tool": return <ToolStack>{children}</ToolStack>;
|
|
161
|
+
* case "text": return <MarkdownText />;
|
|
162
|
+
* case "tool-call": return part.toolUI ?? <ToolFallback {...part} />;
|
|
163
|
+
* default: return null;
|
|
164
|
+
* }
|
|
165
|
+
* }}
|
|
166
|
+
* </MessagePrimitive.GroupedParts>
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export const MessagePrimitiveGroupedParts = <TKey extends `group-${string}`>({
|
|
170
|
+
groupBy,
|
|
171
|
+
children,
|
|
172
|
+
}: MessagePrimitiveGroupedParts.Props<TKey>): ReactNode => {
|
|
173
|
+
const parts = useAuiState(useShallow((s) => s.message.parts));
|
|
174
|
+
|
|
175
|
+
const tree = useMemo(
|
|
176
|
+
() =>
|
|
177
|
+
buildGroupTree(
|
|
178
|
+
parts.map((part, i) => normalizeGroupKey(groupBy(part, i, parts))),
|
|
179
|
+
),
|
|
180
|
+
[parts, groupBy],
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
return <>{tree.map((node) => renderNode(node, parts, children))}</>;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
MessagePrimitiveGroupedParts.displayName = "MessagePrimitive.GroupedParts";
|
|
@@ -208,7 +208,7 @@ export namespace MessagePrimitiveParts {
|
|
|
208
208
|
* @param endIndex - Index of the last tool call in the group
|
|
209
209
|
* @param children - Rendered tool call components to display within the group
|
|
210
210
|
*
|
|
211
|
-
* @deprecated
|
|
211
|
+
* @deprecated Use `<MessagePrimitive.GroupedParts>` with a custom `groupBy` instead.
|
|
212
212
|
*/
|
|
213
213
|
ToolGroup?: ComponentType<
|
|
214
214
|
PropsWithChildren<{ startIndex: number; endIndex: number }>
|
|
@@ -220,6 +220,8 @@ export namespace MessagePrimitiveParts {
|
|
|
220
220
|
* @param startIndex - Index of the first reasoning part in the group
|
|
221
221
|
* @param endIndex - Index of the last reasoning part in the group
|
|
222
222
|
* @param children - Rendered reasoning part components
|
|
223
|
+
*
|
|
224
|
+
* @deprecated Use `<MessagePrimitive.GroupedParts>` with a custom `groupBy` instead.
|
|
223
225
|
*/
|
|
224
226
|
ReasoningGroup?: ReasoningGroupComponent;
|
|
225
227
|
|
|
@@ -234,6 +236,11 @@ export namespace MessagePrimitiveParts {
|
|
|
234
236
|
* `ToolGroup` components cannot be used alongside it.
|
|
235
237
|
*/
|
|
236
238
|
type ChainOfThoughtComponents = BaseComponents & {
|
|
239
|
+
/**
|
|
240
|
+
* @deprecated Use `<MessagePrimitive.GroupedParts>` with a `groupBy`
|
|
241
|
+
* that returns `["group-thought", ...]` for reasoning and tool-call
|
|
242
|
+
* parts. See `@assistant-ui/ui` for a worked example.
|
|
243
|
+
*/
|
|
237
244
|
ChainOfThought: ComponentType;
|
|
238
245
|
|
|
239
246
|
Reasoning?: never;
|
|
@@ -442,6 +449,10 @@ const COMPLETE_STATUS: MessagePartStatus = Object.freeze({
|
|
|
442
449
|
type: "complete",
|
|
443
450
|
});
|
|
444
451
|
|
|
452
|
+
const RUNNING_STATUS: MessagePartStatus = Object.freeze({
|
|
453
|
+
type: "running",
|
|
454
|
+
});
|
|
455
|
+
|
|
445
456
|
const EmptyPartsImpl: FC<MessagePartComponentProps> = ({ components }) => {
|
|
446
457
|
const status = useAuiState(
|
|
447
458
|
(s) => (s.message.status ?? COMPLETE_STATUS) as MessagePartStatus,
|
|
@@ -571,6 +582,12 @@ export type { PartState };
|
|
|
571
582
|
*
|
|
572
583
|
* For tool-call parts, adds `toolUI`, `addResult`, and `resume`.
|
|
573
584
|
* For data parts, adds `dataRendererUI`.
|
|
585
|
+
*
|
|
586
|
+
* The render function is also invoked once with a synthetic empty text part
|
|
587
|
+
* (`{ type: "text", text: "", status: { type: "running" } }`) when the
|
|
588
|
+
* assistant message has no parts yet but is in the running state, so a
|
|
589
|
+
* loading indicator can render. Differentiate this from a real empty text
|
|
590
|
+
* via `part.status?.type === "running" && part.text === ""`.
|
|
574
591
|
*/
|
|
575
592
|
export type EnrichedPartState =
|
|
576
593
|
| (Extract<PartState, { type: "tool-call" }> & {
|
|
@@ -587,59 +604,94 @@ export type EnrichedPartState =
|
|
|
587
604
|
})
|
|
588
605
|
| Exclude<PartState, { type: "tool-call" } | { type: "data" }>;
|
|
589
606
|
|
|
607
|
+
const EMPTY_RUNNING_TEXT_PART: Extract<EnrichedPartState, { type: "text" }> =
|
|
608
|
+
Object.freeze({
|
|
609
|
+
type: "text",
|
|
610
|
+
text: "",
|
|
611
|
+
status: RUNNING_STATUS,
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* @internal
|
|
616
|
+
* Renders a single part by index, calling `children` with the
|
|
617
|
+
* {@link EnrichedPartState} (tool/data UI enrichments + addResult/resume
|
|
618
|
+
* for tool calls). Shared between `<MessagePrimitive.Parts>` and
|
|
619
|
+
* `<MessagePrimitive.GroupedParts>`. Returns whatever `children`
|
|
620
|
+
* returns — callers decide how to handle a `null` return.
|
|
621
|
+
*/
|
|
622
|
+
export const MessagePartChildren: FC<{
|
|
623
|
+
index: number;
|
|
624
|
+
children: (value: { part: EnrichedPartState }) => ReactNode;
|
|
625
|
+
}> = ({ index, children }) => {
|
|
626
|
+
const aui = useAui();
|
|
627
|
+
// Subscribed (not snapshotted like `tools`) so fallbacks registered
|
|
628
|
+
// after the first render trigger a re-render and `hasUI` re-evaluates.
|
|
629
|
+
const dataRenderers = useAuiState((s) => s.dataRenderers);
|
|
630
|
+
|
|
631
|
+
return (
|
|
632
|
+
<PartByIndexProvider index={index}>
|
|
633
|
+
<RenderChildrenWithAccessor
|
|
634
|
+
getItemState={(aui) => aui.message().part({ index }).getState()}
|
|
635
|
+
>
|
|
636
|
+
{(getItem) =>
|
|
637
|
+
children({
|
|
638
|
+
get part() {
|
|
639
|
+
const state = getItem();
|
|
640
|
+
if (state.type === "tool-call") {
|
|
641
|
+
const entry = aui.tools().getState().tools[state.toolName];
|
|
642
|
+
const hasUI = Array.isArray(entry) ? !!entry[0] : !!entry;
|
|
643
|
+
const partMethods = aui.message().part({ index });
|
|
644
|
+
return {
|
|
645
|
+
...state,
|
|
646
|
+
toolUI: hasUI ? <RegisteredToolUI /> : null,
|
|
647
|
+
addResult: partMethods.addToolResult,
|
|
648
|
+
resume: partMethods.resumeToolCall,
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
if (state.type === "data") {
|
|
652
|
+
const hasUI =
|
|
653
|
+
getDataRenderer(dataRenderers, state.name, undefined) !==
|
|
654
|
+
undefined;
|
|
655
|
+
return {
|
|
656
|
+
...state,
|
|
657
|
+
dataRendererUI: hasUI ? <RegisteredDataRendererUI /> : null,
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
return state;
|
|
661
|
+
},
|
|
662
|
+
})
|
|
663
|
+
}
|
|
664
|
+
</RenderChildrenWithAccessor>
|
|
665
|
+
</PartByIndexProvider>
|
|
666
|
+
);
|
|
667
|
+
};
|
|
668
|
+
|
|
590
669
|
const MessagePrimitivePartsInner: FC<{
|
|
591
670
|
children: (value: { part: EnrichedPartState }) => ReactNode;
|
|
592
671
|
}> = ({ children }) => {
|
|
593
|
-
const aui = useAui();
|
|
594
672
|
const contentLength = useAuiState((s) => s.message.parts.length);
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
673
|
+
const isRunning = useAuiState(
|
|
674
|
+
(s) => (s.message.status?.type ?? "complete") === "running",
|
|
675
|
+
);
|
|
676
|
+
const isEmptyRunning = contentLength === 0 && isRunning;
|
|
598
677
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
(
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
...state,
|
|
617
|
-
toolUI: hasUI ? <RegisteredToolUI /> : null,
|
|
618
|
-
addResult: partMethods.addToolResult,
|
|
619
|
-
resume: partMethods.resumeToolCall,
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
if (state.type === "data") {
|
|
623
|
-
const hasUI =
|
|
624
|
-
getDataRenderer(dataRenderers, state.name, undefined) !==
|
|
625
|
-
undefined;
|
|
626
|
-
return {
|
|
627
|
-
...state,
|
|
628
|
-
dataRendererUI: hasUI ? (
|
|
629
|
-
<RegisteredDataRendererUI />
|
|
630
|
-
) : null,
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
return state;
|
|
634
|
-
},
|
|
635
|
-
});
|
|
636
|
-
if (result !== null) return result;
|
|
637
|
-
return <DefaultPartFallback />;
|
|
638
|
-
}}
|
|
639
|
-
</RenderChildrenWithAccessor>
|
|
640
|
-
</PartByIndexProvider>
|
|
641
|
-
)),
|
|
642
|
-
[contentLength, children, dataRenderers],
|
|
678
|
+
if (contentLength === 0) {
|
|
679
|
+
if (!isEmptyRunning) return null;
|
|
680
|
+
return (
|
|
681
|
+
<TextMessagePartProvider text="" isRunning>
|
|
682
|
+
{children({ part: EMPTY_RUNNING_TEXT_PART })}
|
|
683
|
+
</TextMessagePartProvider>
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
return (
|
|
688
|
+
<>
|
|
689
|
+
{Array.from({ length: contentLength }, (_, index) => (
|
|
690
|
+
<MessagePartChildren key={index} index={index}>
|
|
691
|
+
{(value) => children(value) ?? <DefaultPartFallback />}
|
|
692
|
+
</MessagePartChildren>
|
|
693
|
+
))}
|
|
694
|
+
</>
|
|
643
695
|
);
|
|
644
696
|
};
|
|
645
697
|
|