@assistant-ui/react 0.11.5 → 0.11.6
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/client/AssistantClient.d.ts.map +1 -1
- package/dist/client/AssistantClient.js +1 -2
- package/dist/client/AssistantClient.js.map +1 -1
- package/dist/client/ToolUIClient.d.ts +3 -2
- package/dist/client/ToolUIClient.d.ts.map +1 -1
- package/dist/client/ToolUIClient.js +1 -5
- package/dist/client/ToolUIClient.js.map +1 -1
- package/dist/context/providers/AttachmentProvider.js +3 -3
- package/dist/context/providers/AttachmentProvider.js.map +1 -1
- package/dist/context/providers/MessageProvider.js +2 -2
- package/dist/context/providers/MessageProvider.js.map +1 -1
- package/dist/context/providers/PartProvider.js +2 -2
- package/dist/context/providers/PartProvider.js.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.js +6 -7
- package/dist/context/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.js +3 -3
- package/dist/context/providers/ThreadListItemProvider.js.map +1 -1
- package/dist/context/react/AssistantApiContext.d.ts +1 -1
- package/dist/context/react/AssistantApiContext.d.ts.map +1 -1
- package/dist/context/react/AssistantApiContext.js +4 -3
- package/dist/context/react/AssistantApiContext.js.map +1 -1
- package/dist/context/react/index.d.ts +1 -0
- package/dist/context/react/index.d.ts.map +1 -1
- package/dist/context/react/index.js +2 -0
- package/dist/context/react/index.js.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js +1 -5
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.d.ts +2 -4
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.js +10 -10
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.d.ts +3 -2
- package/dist/legacy-runtime/client/ComposerRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js +1 -5
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.d.ts +1 -1
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.js +10 -10
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/MessageRuntimeClient.d.ts +3 -3
- package/dist/legacy-runtime/client/MessageRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/MessageRuntimeClient.js +31 -31
- package/dist/legacy-runtime/client/MessageRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.d.ts +2 -2
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.js +17 -17
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.d.ts +3 -2
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.js +1 -5
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ThreadRuntimeClient.d.ts +3 -2
- package/dist/legacy-runtime/client/ThreadRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ThreadRuntimeClient.js +1 -5
- package/dist/legacy-runtime/client/ThreadRuntimeClient.js.map +1 -1
- package/dist/utils/tap-store/tap-api.d.ts +9 -1
- package/dist/utils/tap-store/tap-api.d.ts.map +1 -1
- package/dist/utils/tap-store/tap-api.js +12 -2
- package/dist/utils/tap-store/tap-api.js.map +1 -1
- package/package.json +1 -1
- package/src/client/AssistantClient.ts +1 -4
- package/src/client/ToolUIClient.ts +1 -6
- package/src/context/providers/AttachmentProvider.tsx +3 -3
- package/src/context/providers/MessageProvider.tsx +2 -2
- package/src/context/providers/PartProvider.tsx +2 -2
- package/src/context/providers/TextMessagePartProvider.tsx +5 -7
- package/src/context/providers/ThreadListItemProvider.tsx +3 -3
- package/src/context/react/AssistantApiContext.tsx +7 -2
- package/src/context/react/index.ts +2 -0
- package/src/legacy-runtime/AssistantRuntimeProvider.tsx +1 -15
- package/src/legacy-runtime/client/AttachmentRuntimeClient.ts +10 -11
- package/src/legacy-runtime/client/ComposerRuntimeClient.ts +1 -6
- package/src/legacy-runtime/client/MessagePartRuntimeClient.ts +13 -14
- package/src/legacy-runtime/client/MessageRuntimeClient.ts +35 -36
- package/src/legacy-runtime/client/ThreadListItemRuntimeClient.ts +17 -18
- package/src/legacy-runtime/client/ThreadListRuntimeClient.ts +1 -6
- package/src/legacy-runtime/client/ThreadRuntimeClient.ts +1 -6
- package/src/utils/tap-store/tap-api.ts +19 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ComposerRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/ComposerRuntimeClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAEV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EAEhB,MAAM,4BAA4B,CAAC;AAMpC,OAAO,
|
1
|
+
{"version":3,"file":"ComposerRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/ComposerRuntimeClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAEV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EAEhB,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAEL,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAoBrC,eAAO,MAAM,cAAc;;;;;iBAMV,SAAS,CAAC,MAAM,CAAC;mBACf,SAAS,CAAC,MAAM,CAAC;aACvB,eAAe;EAkF3B,CAAC"}
|
@@ -71,7 +71,7 @@ var ComposerClient = resource(
|
|
71
71
|
type: runtimeState.type ?? "thread"
|
72
72
|
};
|
73
73
|
}, [runtimeState, attachments.state]);
|
74
|
-
|
74
|
+
return tapApi({
|
75
75
|
getState: () => state,
|
76
76
|
setText: runtime.setText,
|
77
77
|
setRole: runtime.setRole,
|
@@ -93,10 +93,6 @@ var ComposerClient = resource(
|
|
93
93
|
},
|
94
94
|
__internal_getRuntime: () => runtime
|
95
95
|
});
|
96
|
-
return {
|
97
|
-
state,
|
98
|
-
api
|
99
|
-
};
|
100
96
|
}
|
101
97
|
);
|
102
98
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/legacy-runtime/client/ComposerRuntimeClient.ts"],"sourcesContent":["import {\n resource,\n tapMemo,\n tapEffect,\n RefObject,\n tapInlineResource,\n} from \"@assistant-ui/tap\";\nimport {\n ComposerRuntime,\n EditComposerRuntime,\n} from \"../runtime/ComposerRuntime\";\nimport { Unsubscribe } from \"../../types\";\n\nimport { tapApi } from \"../../utils/tap-store\";\nimport { ComposerRuntimeEventType } from \"../runtime-cores/core/ComposerRuntimeCore\";\nimport { tapEvents } from \"../../client/EventContext\";\nimport {\n ComposerClientState,\n ComposerClientApi,\n} from \"../../client/types/Composer\";\nimport { tapLookupResources } from \"../../client/util-hooks/tapLookupResources\";\nimport { AttachmentRuntimeClient } from \"./AttachmentRuntimeClient\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\n\nconst ComposerAttachmentClientByIndex = resource(\n ({ runtime, index }: { runtime: ComposerRuntime; index: number }) => {\n const attachmentRuntime = tapMemo(\n () => runtime.getAttachmentByIndex(index),\n [runtime, index],\n );\n\n return tapInlineResource(\n AttachmentRuntimeClient({\n runtime: attachmentRuntime,\n }),\n );\n },\n);\n\nexport const ComposerClient = resource(\n ({\n threadIdRef,\n messageIdRef,\n runtime,\n }: {\n threadIdRef: RefObject<string>;\n messageIdRef?: RefObject<string>;\n runtime: ComposerRuntime;\n }) => {\n const runtimeState = tapSubscribable(runtime);\n const events = tapEvents();\n\n // Bind composer events to event manager\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to composer events\n const composerEvents: ComposerRuntimeEventType[] = [\n \"send\",\n \"attachment-add\",\n ];\n\n for (const event of composerEvents) {\n const unsubscribe = runtime.unstable_on(event, () => {\n events.emit(`composer.${event}`, {\n threadId: threadIdRef.current,\n ...(messageIdRef && { messageId: messageIdRef.current }),\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime, events, threadIdRef, messageIdRef]);\n\n const attachments = tapLookupResources(\n runtimeState.attachments.map((_, idx) =>\n ComposerAttachmentClientByIndex(\n { runtime: runtime, index: idx },\n { key: idx },\n ),\n ),\n );\n\n const state = tapMemo<ComposerClientState>(() => {\n return {\n text: runtimeState.text,\n role: runtimeState.role,\n attachments: attachments.state,\n runConfig: runtimeState.runConfig,\n isEditing: runtimeState.isEditing,\n canCancel: runtimeState.canCancel,\n attachmentAccept: runtimeState.attachmentAccept,\n isEmpty: runtimeState.isEmpty,\n type: runtimeState.type ?? \"thread\",\n };\n }, [runtimeState, attachments.state]);\n\n
|
1
|
+
{"version":3,"sources":["../../../src/legacy-runtime/client/ComposerRuntimeClient.ts"],"sourcesContent":["import {\n resource,\n tapMemo,\n tapEffect,\n RefObject,\n tapInlineResource,\n} from \"@assistant-ui/tap\";\nimport {\n ComposerRuntime,\n EditComposerRuntime,\n} from \"../runtime/ComposerRuntime\";\nimport { Unsubscribe } from \"../../types\";\n\nimport { tapApi } from \"../../utils/tap-store\";\nimport { ComposerRuntimeEventType } from \"../runtime-cores/core/ComposerRuntimeCore\";\nimport { tapEvents } from \"../../client/EventContext\";\nimport {\n ComposerClientState,\n ComposerClientApi,\n} from \"../../client/types/Composer\";\nimport { tapLookupResources } from \"../../client/util-hooks/tapLookupResources\";\nimport { AttachmentRuntimeClient } from \"./AttachmentRuntimeClient\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\n\nconst ComposerAttachmentClientByIndex = resource(\n ({ runtime, index }: { runtime: ComposerRuntime; index: number }) => {\n const attachmentRuntime = tapMemo(\n () => runtime.getAttachmentByIndex(index),\n [runtime, index],\n );\n\n return tapInlineResource(\n AttachmentRuntimeClient({\n runtime: attachmentRuntime,\n }),\n );\n },\n);\n\nexport const ComposerClient = resource(\n ({\n threadIdRef,\n messageIdRef,\n runtime,\n }: {\n threadIdRef: RefObject<string>;\n messageIdRef?: RefObject<string>;\n runtime: ComposerRuntime;\n }) => {\n const runtimeState = tapSubscribable(runtime);\n const events = tapEvents();\n\n // Bind composer events to event manager\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to composer events\n const composerEvents: ComposerRuntimeEventType[] = [\n \"send\",\n \"attachment-add\",\n ];\n\n for (const event of composerEvents) {\n const unsubscribe = runtime.unstable_on(event, () => {\n events.emit(`composer.${event}`, {\n threadId: threadIdRef.current,\n ...(messageIdRef && { messageId: messageIdRef.current }),\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime, events, threadIdRef, messageIdRef]);\n\n const attachments = tapLookupResources(\n runtimeState.attachments.map((_, idx) =>\n ComposerAttachmentClientByIndex(\n { runtime: runtime, index: idx },\n { key: idx },\n ),\n ),\n );\n\n const state = tapMemo<ComposerClientState>(() => {\n return {\n text: runtimeState.text,\n role: runtimeState.role,\n attachments: attachments.state,\n runConfig: runtimeState.runConfig,\n isEditing: runtimeState.isEditing,\n canCancel: runtimeState.canCancel,\n attachmentAccept: runtimeState.attachmentAccept,\n isEmpty: runtimeState.isEmpty,\n type: runtimeState.type ?? \"thread\",\n };\n }, [runtimeState, attachments.state]);\n\n return tapApi<ComposerClientApi>({\n getState: () => state,\n\n setText: runtime.setText,\n setRole: runtime.setRole,\n setRunConfig: runtime.setRunConfig,\n addAttachment: runtime.addAttachment,\n reset: runtime.reset,\n\n clearAttachments: runtime.clearAttachments,\n send: runtime.send,\n cancel: runtime.cancel,\n beginEdit:\n (runtime as EditComposerRuntime).beginEdit ??\n (() => {\n throw new Error(\"beginEdit is not supported in this runtime\");\n }),\n\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.api({ key: selector.id });\n } else {\n return attachments.api(selector);\n }\n },\n\n __internal_getRuntime: () => runtime,\n });\n },\n);\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAOP,SAAS,cAAc;AAEvB,SAAS,iBAAiB;AAK1B,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAEhC,IAAM,kCAAkC;AAAA,EACtC,CAAC,EAAE,SAAS,MAAM,MAAmD;AACnE,UAAM,oBAAoB;AAAA,MACxB,MAAM,QAAQ,qBAAqB,KAAK;AAAA,MACxC,CAAC,SAAS,KAAK;AAAA,IACjB;AAEA,WAAO;AAAA,MACL,wBAAwB;AAAA,QACtB,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,IAAM,iBAAiB;AAAA,EAC5B,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAIM;AACJ,UAAM,eAAe,gBAAgB,OAAO;AAC5C,UAAM,SAAS,UAAU;AAGzB,cAAU,MAAM;AACd,YAAM,gBAA+B,CAAC;AAGtC,YAAM,iBAA6C;AAAA,QACjD;AAAA,QACA;AAAA,MACF;AAEA,iBAAW,SAAS,gBAAgB;AAClC,cAAM,cAAc,QAAQ,YAAY,OAAO,MAAM;AACnD,iBAAO,KAAK,YAAY,KAAK,IAAI;AAAA,YAC/B,UAAU,YAAY;AAAA,YACtB,GAAI,gBAAgB,EAAE,WAAW,aAAa,QAAQ;AAAA,UACxD,CAAC;AAAA,QACH,CAAC;AACD,sBAAc,KAAK,WAAW;AAAA,MAChC;AAEA,aAAO,MAAM;AACX,mBAAW,SAAS,cAAe,OAAM;AAAA,MAC3C;AAAA,IACF,GAAG,CAAC,SAAS,QAAQ,aAAa,YAAY,CAAC;AAE/C,UAAM,cAAc;AAAA,MAClB,aAAa,YAAY;AAAA,QAAI,CAAC,GAAG,QAC/B;AAAA,UACE,EAAE,SAAkB,OAAO,IAAI;AAAA,UAC/B,EAAE,KAAK,IAAI;AAAA,QACb;AAAA,MACF;AAAA,IACF;AAEA,UAAM,QAAQ,QAA6B,MAAM;AAC/C,aAAO;AAAA,QACL,MAAM,aAAa;AAAA,QACnB,MAAM,aAAa;AAAA,QACnB,aAAa,YAAY;AAAA,QACzB,WAAW,aAAa;AAAA,QACxB,WAAW,aAAa;AAAA,QACxB,WAAW,aAAa;AAAA,QACxB,kBAAkB,aAAa;AAAA,QAC/B,SAAS,aAAa;AAAA,QACtB,MAAM,aAAa,QAAQ;AAAA,MAC7B;AAAA,IACF,GAAG,CAAC,cAAc,YAAY,KAAK,CAAC;AAEpC,WAAO,OAA0B;AAAA,MAC/B,UAAU,MAAM;AAAA,MAEhB,SAAS,QAAQ;AAAA,MACjB,SAAS,QAAQ;AAAA,MACjB,cAAc,QAAQ;AAAA,MACtB,eAAe,QAAQ;AAAA,MACvB,OAAO,QAAQ;AAAA,MAEf,kBAAkB,QAAQ;AAAA,MAC1B,MAAM,QAAQ;AAAA,MACd,QAAQ,QAAQ;AAAA,MAChB,WACG,QAAgC,cAChC,MAAM;AACL,cAAM,IAAI,MAAM,4CAA4C;AAAA,MAC9D;AAAA,MAEF,YAAY,CAAC,aAAa;AACxB,YAAI,QAAQ,UAAU;AACpB,iBAAO,YAAY,IAAI,EAAE,KAAK,SAAS,GAAG,CAAC;AAAA,QAC7C,OAAO;AACL,iBAAO,YAAY,IAAI,QAAQ;AAAA,QACjC;AAAA,MACF;AAAA,MAEA,uBAAuB,MAAM;AAAA,IAC/B,CAAC;AAAA,EACH;AACF;","names":[]}
|
@@ -2,7 +2,7 @@ import { MessagePartRuntime } from "../runtime/MessagePartRuntime";
|
|
2
2
|
import { MessagePartClientApi } from "../../client/types/Part";
|
3
3
|
export declare const MessagePartClient: import("@assistant-ui/tap").ResourceElementConstructor<{
|
4
4
|
key: string | undefined;
|
5
|
-
state:
|
5
|
+
state: any;
|
6
6
|
api: MessagePartClientApi;
|
7
7
|
}, {
|
8
8
|
runtime: MessagePartRuntime;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MessagePartRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/MessagePartRuntimeClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,eAAO,MAAM,iBAAiB;;;;;aACH,kBAAkB;
|
1
|
+
{"version":3,"file":"MessagePartRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/MessagePartRuntimeClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,eAAO,MAAM,iBAAiB;;;;;aACH,kBAAkB;EAmB5C,CAAC"}
|
@@ -5,16 +5,16 @@ import { tapSubscribable } from "../util-hooks/tapSubscribable.js";
|
|
5
5
|
var MessagePartClient = resource(
|
6
6
|
({ runtime }) => {
|
7
7
|
const runtimeState = tapSubscribable(runtime);
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
return tapApi(
|
9
|
+
{
|
10
|
+
getState: () => runtimeState,
|
11
|
+
addToolResult: (result) => runtime.addToolResult(result),
|
12
|
+
__internal_getRuntime: () => runtime
|
13
|
+
},
|
14
|
+
{
|
15
|
+
key: runtimeState.type === "tool-call" ? "toolCallId-" + runtimeState.toolCallId : void 0
|
16
|
+
}
|
17
|
+
);
|
18
18
|
}
|
19
19
|
);
|
20
20
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/legacy-runtime/client/MessagePartRuntimeClient.ts"],"sourcesContent":["import { resource } from \"@assistant-ui/tap\";\nimport { tapApi } from \"../../utils/tap-store\";\nimport { MessagePartRuntime } from \"../runtime/MessagePartRuntime\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { MessagePartClientApi } from \"../../client/types/Part\";\nexport const MessagePartClient = resource(\n ({ runtime }: { runtime: MessagePartRuntime }) => {\n const runtimeState = tapSubscribable(runtime);\n\n
|
1
|
+
{"version":3,"sources":["../../../src/legacy-runtime/client/MessagePartRuntimeClient.ts"],"sourcesContent":["import { resource } from \"@assistant-ui/tap\";\nimport { tapApi } from \"../../utils/tap-store\";\nimport { MessagePartRuntime } from \"../runtime/MessagePartRuntime\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { MessagePartClientApi } from \"../../client/types/Part\";\nexport const MessagePartClient = resource(\n ({ runtime }: { runtime: MessagePartRuntime }) => {\n const runtimeState = tapSubscribable(runtime);\n\n return tapApi<MessagePartClientApi>(\n {\n getState: () => runtimeState,\n\n addToolResult: (result) => runtime.addToolResult(result),\n\n __internal_getRuntime: () => runtime,\n },\n {\n key:\n runtimeState.type === \"tool-call\"\n ? \"toolCallId-\" + runtimeState.toolCallId\n : undefined,\n },\n );\n },\n);\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,cAAc;AAEvB,SAAS,uBAAuB;AAEzB,IAAM,oBAAoB;AAAA,EAC/B,CAAC,EAAE,QAAQ,MAAuC;AAChD,UAAM,eAAe,gBAAgB,OAAO;AAE5C,WAAO;AAAA,MACL;AAAA,QACE,UAAU,MAAM;AAAA,QAEhB,eAAe,CAAC,WAAW,QAAQ,cAAc,MAAM;AAAA,QAEvD,uBAAuB,MAAM;AAAA,MAC/B;AAAA,MACA;AAAA,QACE,KACE,aAAa,SAAS,cAClB,gBAAgB,aAAa,aAC7B;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { MessageRuntime } from "../runtime/MessageRuntime";
|
2
2
|
import { RefObject } from "react";
|
3
|
-
import {
|
3
|
+
import { MessageClientApi } from "../../client/types/Message";
|
4
4
|
export declare const MessageClient: import("@assistant-ui/tap").ResourceElementConstructor<{
|
5
|
-
key: string;
|
6
|
-
state:
|
5
|
+
key: string | undefined;
|
6
|
+
state: any;
|
7
7
|
api: MessageClientApi;
|
8
8
|
}, {
|
9
9
|
runtime: MessageRuntime;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MessageRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/MessageRuntimeClient.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAK3D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,
|
1
|
+
{"version":3,"file":"MessageRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/MessageRuntimeClient.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAK3D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAEL,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAyBpC,eAAO,MAAM,aAAa;;;;;aAKb,cAAc;iBACV,SAAS,CAAC,MAAM,CAAC;EA6FjC,CAAC"}
|
@@ -79,38 +79,38 @@ var MessageClient = resource(
|
|
79
79
|
isCopiedState,
|
80
80
|
isHoveringState
|
81
81
|
]);
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
82
|
+
return tapApi(
|
83
|
+
{
|
84
|
+
getState: () => state,
|
85
|
+
composer: composer.api,
|
86
|
+
reload: (config) => runtime.reload(config),
|
87
|
+
speak: () => runtime.speak(),
|
88
|
+
stopSpeaking: () => runtime.stopSpeaking(),
|
89
|
+
submitFeedback: (feedback) => runtime.submitFeedback(feedback),
|
90
|
+
switchToBranch: (options) => runtime.switchToBranch(options),
|
91
|
+
getCopyText: () => runtime.unstable_getCopyText(),
|
92
|
+
part: (selector) => {
|
93
|
+
if ("index" in selector) {
|
94
|
+
return parts.api({ index: selector.index });
|
95
|
+
} else {
|
96
|
+
return parts.api({ key: "toolCallId-" + selector.toolCallId });
|
97
|
+
}
|
98
|
+
},
|
99
|
+
attachment: (selector) => {
|
100
|
+
if ("id" in selector) {
|
101
|
+
return attachments.api({ key: selector.id });
|
102
|
+
} else {
|
103
|
+
return attachments.api(selector);
|
104
|
+
}
|
105
|
+
},
|
106
|
+
setIsCopied,
|
107
|
+
setIsHovering,
|
108
|
+
__internal_getRuntime: () => runtime
|
104
109
|
},
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
return {
|
110
|
-
key: runtimeState.id,
|
111
|
-
state,
|
112
|
-
api
|
113
|
-
};
|
110
|
+
{
|
111
|
+
key: runtimeState.id
|
112
|
+
}
|
113
|
+
);
|
114
114
|
}
|
115
115
|
);
|
116
116
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/legacy-runtime/client/MessageRuntimeClient.ts"],"sourcesContent":["import {\n resource,\n tapInlineResource,\n tapMemo,\n tapState,\n} from \"@assistant-ui/tap\";\nimport { tapApi } from \"../../utils/tap-store\";\nimport { MessageRuntime } from \"../runtime/MessageRuntime\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { ComposerClient } from \"./ComposerRuntimeClient\";\nimport { MessagePartClient } from \"./MessagePartRuntimeClient\";\nimport { tapLookupResources } from \"../../client/util-hooks/tapLookupResources\";\nimport { RefObject } from \"react\";\nimport {\n MessageClientState,\n MessageClientApi,\n} from \"../../client/types/Message\";\nimport { AttachmentRuntimeClient } from \"./AttachmentRuntimeClient\";\n\nconst MessageAttachmentClientByIndex = resource(\n ({ runtime, index }: { runtime: MessageRuntime; index: number }) => {\n const attachmentRuntime = tapMemo(\n () => runtime.getAttachmentByIndex(index),\n [runtime, index],\n );\n return tapInlineResource(\n AttachmentRuntimeClient({ runtime: attachmentRuntime }),\n );\n },\n);\n\nconst MessagePartByIndex = resource(\n ({ runtime, index }: { runtime: MessageRuntime; index: number }) => {\n const partRuntime = tapMemo(\n () => runtime.getMessagePartByIndex(index),\n [runtime, index],\n );\n return tapInlineResource(MessagePartClient({ runtime: partRuntime }));\n },\n);\n\nexport const MessageClient = resource(\n ({\n runtime,\n threadIdRef,\n }: {\n runtime: MessageRuntime;\n threadIdRef: RefObject<string>;\n }) => {\n const runtimeState = tapSubscribable(runtime);\n\n const [isCopiedState, setIsCopied] = tapState(false);\n const [isHoveringState, setIsHovering] = tapState(false);\n\n const messageIdRef = tapMemo(\n () => ({\n get current() {\n return runtime.getState().id;\n },\n }),\n [runtime],\n );\n\n const composer = tapInlineResource(\n ComposerClient({\n runtime: runtime.composer,\n threadIdRef,\n messageIdRef,\n }),\n );\n\n const parts = tapLookupResources(\n runtimeState.content.map((_, idx) =>\n MessagePartByIndex({ runtime, index: idx }, { key: idx }),\n ),\n );\n\n const attachments = tapLookupResources(\n runtimeState.attachments?.map((_, idx) =>\n MessageAttachmentClientByIndex({ runtime, index: idx }, { key: idx }),\n ) ?? [],\n );\n\n const state = tapMemo<MessageClientState>(() => {\n return {\n ...(runtimeState as MessageClientState),\n\n parts: parts.state,\n composer: composer.state,\n\n isCopied: isCopiedState,\n isHovering: isHoveringState,\n };\n }, [\n runtimeState,\n parts.state,\n composer.state,\n isCopiedState,\n isHoveringState,\n ]);\n\n
|
1
|
+
{"version":3,"sources":["../../../src/legacy-runtime/client/MessageRuntimeClient.ts"],"sourcesContent":["import {\n resource,\n tapInlineResource,\n tapMemo,\n tapState,\n} from \"@assistant-ui/tap\";\nimport { tapApi } from \"../../utils/tap-store\";\nimport { MessageRuntime } from \"../runtime/MessageRuntime\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { ComposerClient } from \"./ComposerRuntimeClient\";\nimport { MessagePartClient } from \"./MessagePartRuntimeClient\";\nimport { tapLookupResources } from \"../../client/util-hooks/tapLookupResources\";\nimport { RefObject } from \"react\";\nimport {\n MessageClientState,\n MessageClientApi,\n} from \"../../client/types/Message\";\nimport { AttachmentRuntimeClient } from \"./AttachmentRuntimeClient\";\n\nconst MessageAttachmentClientByIndex = resource(\n ({ runtime, index }: { runtime: MessageRuntime; index: number }) => {\n const attachmentRuntime = tapMemo(\n () => runtime.getAttachmentByIndex(index),\n [runtime, index],\n );\n return tapInlineResource(\n AttachmentRuntimeClient({ runtime: attachmentRuntime }),\n );\n },\n);\n\nconst MessagePartByIndex = resource(\n ({ runtime, index }: { runtime: MessageRuntime; index: number }) => {\n const partRuntime = tapMemo(\n () => runtime.getMessagePartByIndex(index),\n [runtime, index],\n );\n return tapInlineResource(MessagePartClient({ runtime: partRuntime }));\n },\n);\n\nexport const MessageClient = resource(\n ({\n runtime,\n threadIdRef,\n }: {\n runtime: MessageRuntime;\n threadIdRef: RefObject<string>;\n }) => {\n const runtimeState = tapSubscribable(runtime);\n\n const [isCopiedState, setIsCopied] = tapState(false);\n const [isHoveringState, setIsHovering] = tapState(false);\n\n const messageIdRef = tapMemo(\n () => ({\n get current() {\n return runtime.getState().id;\n },\n }),\n [runtime],\n );\n\n const composer = tapInlineResource(\n ComposerClient({\n runtime: runtime.composer,\n threadIdRef,\n messageIdRef,\n }),\n );\n\n const parts = tapLookupResources(\n runtimeState.content.map((_, idx) =>\n MessagePartByIndex({ runtime, index: idx }, { key: idx }),\n ),\n );\n\n const attachments = tapLookupResources(\n runtimeState.attachments?.map((_, idx) =>\n MessageAttachmentClientByIndex({ runtime, index: idx }, { key: idx }),\n ) ?? [],\n );\n\n const state = tapMemo<MessageClientState>(() => {\n return {\n ...(runtimeState as MessageClientState),\n\n parts: parts.state,\n composer: composer.state,\n\n isCopied: isCopiedState,\n isHovering: isHoveringState,\n };\n }, [\n runtimeState,\n parts.state,\n composer.state,\n isCopiedState,\n isHoveringState,\n ]);\n\n return tapApi<MessageClientApi>(\n {\n getState: () => state,\n\n composer: composer.api,\n\n reload: (config) => runtime.reload(config),\n speak: () => runtime.speak(),\n stopSpeaking: () => runtime.stopSpeaking(),\n submitFeedback: (feedback) => runtime.submitFeedback(feedback),\n switchToBranch: (options) => runtime.switchToBranch(options),\n getCopyText: () => runtime.unstable_getCopyText(),\n\n part: (selector) => {\n if (\"index\" in selector) {\n return parts.api({ index: selector.index });\n } else {\n return parts.api({ key: \"toolCallId-\" + selector.toolCallId });\n }\n },\n\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.api({ key: selector.id });\n } else {\n return attachments.api(selector);\n }\n },\n\n setIsCopied,\n setIsHovering,\n\n __internal_getRuntime: () => runtime,\n },\n {\n key: runtimeState.id,\n },\n );\n },\n);\n"],"mappings":"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","names":[]}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { ThreadListItemRuntime } from "../runtime/ThreadListItemRuntime";
|
2
2
|
import { ThreadListItemClientApi } from "../../client/types/ThreadListItem";
|
3
3
|
export declare const ThreadListItemClient: import("@assistant-ui/tap").ResourceElementConstructor<{
|
4
|
-
|
4
|
+
key: string | undefined;
|
5
|
+
state: any;
|
5
6
|
api: ThreadListItemClientApi;
|
6
|
-
key: string;
|
7
7
|
}, {
|
8
8
|
runtime: ThreadListItemRuntime;
|
9
9
|
}>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadListItemRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/ThreadListItemRuntimeClient.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,qBAAqB,EACtB,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;;aACN,qBAAqB;
|
1
|
+
{"version":3,"file":"ThreadListItemRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/ThreadListItemRuntimeClient.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,qBAAqB,EACtB,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;;aACN,qBAAqB;EA8C/C,CAAC"}
|
@@ -25,23 +25,23 @@ var ThreadListItemClient = resource(
|
|
25
25
|
for (const unsub of unsubscribers) unsub();
|
26
26
|
};
|
27
27
|
}, [runtime, events]);
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
28
|
+
return tapApi(
|
29
|
+
{
|
30
|
+
getState: () => runtimeState,
|
31
|
+
switchTo: runtime.switchTo,
|
32
|
+
rename: runtime.rename,
|
33
|
+
archive: runtime.archive,
|
34
|
+
unarchive: runtime.unarchive,
|
35
|
+
delete: runtime.delete,
|
36
|
+
generateTitle: runtime.generateTitle,
|
37
|
+
initialize: runtime.initialize,
|
38
|
+
detach: runtime.detach,
|
39
|
+
__internal_getRuntime: () => runtime
|
40
|
+
},
|
41
|
+
{
|
42
|
+
key: runtimeState.id
|
43
|
+
}
|
44
|
+
);
|
45
45
|
}
|
46
46
|
);
|
47
47
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/legacy-runtime/client/ThreadListItemRuntimeClient.ts"],"sourcesContent":["import { resource, tapEffect } from \"@assistant-ui/tap\";\nimport {\n ThreadListItemEventType,\n ThreadListItemRuntime,\n} from \"../runtime/ThreadListItemRuntime\";\nimport { Unsubscribe } from \"../../types\";\nimport { tapApi } from \"../../utils/tap-store\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { tapEvents } from \"../../client/EventContext\";\nimport { ThreadListItemClientApi } from \"../../client/types/ThreadListItem\";\n\nexport const ThreadListItemClient = resource(\n ({ runtime }: { runtime: ThreadListItemRuntime }) => {\n const runtimeState = tapSubscribable(runtime);\n const events = tapEvents();\n\n // Bind thread list item events to event manager\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to thread list item events\n const threadListItemEvents: ThreadListItemEventType[] = [\n \"switched-to\",\n \"switched-away\",\n ];\n\n for (const event of threadListItemEvents) {\n const unsubscribe = runtime.unstable_on(event, () => {\n events.emit(`thread-list-item.${event}`, {\n threadId: runtime.getState()!.id,\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime, events]);\n\n
|
1
|
+
{"version":3,"sources":["../../../src/legacy-runtime/client/ThreadListItemRuntimeClient.ts"],"sourcesContent":["import { resource, tapEffect } from \"@assistant-ui/tap\";\nimport {\n ThreadListItemEventType,\n ThreadListItemRuntime,\n} from \"../runtime/ThreadListItemRuntime\";\nimport { Unsubscribe } from \"../../types\";\nimport { tapApi } from \"../../utils/tap-store\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { tapEvents } from \"../../client/EventContext\";\nimport { ThreadListItemClientApi } from \"../../client/types/ThreadListItem\";\n\nexport const ThreadListItemClient = resource(\n ({ runtime }: { runtime: ThreadListItemRuntime }) => {\n const runtimeState = tapSubscribable(runtime);\n const events = tapEvents();\n\n // Bind thread list item events to event manager\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to thread list item events\n const threadListItemEvents: ThreadListItemEventType[] = [\n \"switched-to\",\n \"switched-away\",\n ];\n\n for (const event of threadListItemEvents) {\n const unsubscribe = runtime.unstable_on(event, () => {\n events.emit(`thread-list-item.${event}`, {\n threadId: runtime.getState()!.id,\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime, events]);\n\n return tapApi<ThreadListItemClientApi>(\n {\n getState: () => runtimeState,\n switchTo: runtime.switchTo,\n rename: runtime.rename,\n archive: runtime.archive,\n unarchive: runtime.unarchive,\n delete: runtime.delete,\n generateTitle: runtime.generateTitle,\n initialize: runtime.initialize,\n detach: runtime.detach,\n __internal_getRuntime: () => runtime,\n },\n {\n key: runtimeState.id,\n },\n );\n },\n);\n"],"mappings":";AAAA,SAAS,UAAU,iBAAiB;AAMpC,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAGnB,IAAM,uBAAuB;AAAA,EAClC,CAAC,EAAE,QAAQ,MAA0C;AACnD,UAAM,eAAe,gBAAgB,OAAO;AAC5C,UAAM,SAAS,UAAU;AAGzB,cAAU,MAAM;AACd,YAAM,gBAA+B,CAAC;AAGtC,YAAM,uBAAkD;AAAA,QACtD;AAAA,QACA;AAAA,MACF;AAEA,iBAAW,SAAS,sBAAsB;AACxC,cAAM,cAAc,QAAQ,YAAY,OAAO,MAAM;AACnD,iBAAO,KAAK,oBAAoB,KAAK,IAAI;AAAA,YACvC,UAAU,QAAQ,SAAS,EAAG;AAAA,UAChC,CAAC;AAAA,QACH,CAAC;AACD,sBAAc,KAAK,WAAW;AAAA,MAChC;AAEA,aAAO,MAAM;AACX,mBAAW,SAAS,cAAe,OAAM;AAAA,MAC3C;AAAA,IACF,GAAG,CAAC,SAAS,MAAM,CAAC;AAEpB,WAAO;AAAA,MACL;AAAA,QACE,UAAU,MAAM;AAAA,QAChB,UAAU,QAAQ;AAAA,QAClB,QAAQ,QAAQ;AAAA,QAChB,SAAS,QAAQ;AAAA,QACjB,WAAW,QAAQ;AAAA,QACnB,QAAQ,QAAQ;AAAA,QAChB,eAAe,QAAQ;AAAA,QACvB,YAAY,QAAQ;AAAA,QACpB,QAAQ,QAAQ;AAAA,QAChB,uBAAuB,MAAM;AAAA,MAC/B;AAAA,MACA;AAAA,QACE,KAAK,aAAa;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { ThreadListRuntime } from "../runtime/ThreadListRuntime";
|
2
|
-
import {
|
2
|
+
import { ThreadListClientApi } from "../../client/types/ThreadList";
|
3
3
|
export declare const ThreadListClient: import("@assistant-ui/tap").ResourceElementConstructor<{
|
4
|
-
|
4
|
+
key: string | undefined;
|
5
|
+
state: any;
|
5
6
|
api: ThreadListClientApi;
|
6
7
|
}, {
|
7
8
|
runtime: ThreadListRuntime;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadListRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/ThreadListRuntimeClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAKjE,OAAO,
|
1
|
+
{"version":3,"file":"ThreadListRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/ThreadListRuntimeClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAKjE,OAAO,EAEL,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;AAgBvC,eAAO,MAAM,gBAAgB;;;;;aACF,iBAAiB;EAyD3C,CAAC"}
|
@@ -42,7 +42,7 @@ var ThreadListClient = resource(
|
|
42
42
|
main: main.state
|
43
43
|
};
|
44
44
|
}, [runtimeState, threadItems.state, main.state]);
|
45
|
-
|
45
|
+
return tapApi({
|
46
46
|
getState: () => state,
|
47
47
|
thread: () => main.api,
|
48
48
|
item: (threadIdOrOptions) => {
|
@@ -63,10 +63,6 @@ var ThreadListClient = resource(
|
|
63
63
|
runtime.switchToNewThread();
|
64
64
|
}
|
65
65
|
});
|
66
|
-
return {
|
67
|
-
state,
|
68
|
-
api
|
69
|
-
};
|
70
66
|
}
|
71
67
|
);
|
72
68
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/legacy-runtime/client/ThreadListRuntimeClient.ts"],"sourcesContent":["import { tapApi } from \"../../utils/tap-store\";\nimport { resource, tapInlineResource, tapMemo } from \"@assistant-ui/tap\";\nimport { ThreadListRuntime } from \"../runtime/ThreadListRuntime\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { ThreadListItemClient } from \"./ThreadListItemRuntimeClient\";\nimport { ThreadClient } from \"./ThreadRuntimeClient\";\nimport { tapLookupResources } from \"../../client/util-hooks/tapLookupResources\";\nimport {\n ThreadListClientState,\n ThreadListClientApi,\n} from \"../../client/types/ThreadList\";\n\nconst ThreadListItemClientById = resource(\n ({ runtime, id }: { runtime: ThreadListRuntime; id: string }) => {\n const threadListItemRuntime = tapMemo(\n () => runtime.getItemById(id),\n [runtime, id],\n );\n return tapInlineResource(\n ThreadListItemClient({\n runtime: threadListItemRuntime,\n }),\n );\n },\n);\n\nexport const ThreadListClient = resource(\n ({ runtime }: { runtime: ThreadListRuntime }) => {\n const runtimeState = tapSubscribable(runtime);\n\n const main = tapInlineResource(\n ThreadClient({\n runtime: runtime.main,\n }),\n );\n\n const threadItems = tapLookupResources(\n Object.keys(runtimeState.threadItems).map((id) =>\n ThreadListItemClientById({ runtime, id }, { key: id }),\n ),\n );\n\n const state = tapMemo<ThreadListClientState>(() => {\n return {\n mainThreadId: runtimeState.mainThreadId,\n newThreadId: runtimeState.newThread ?? null,\n isLoading: runtimeState.isLoading,\n threadIds: runtimeState.threads,\n archivedThreadIds: runtimeState.archivedThreads,\n threadItems: threadItems.state,\n\n main: main.state,\n };\n }, [runtimeState, threadItems.state, main.state]);\n\n
|
1
|
+
{"version":3,"sources":["../../../src/legacy-runtime/client/ThreadListRuntimeClient.ts"],"sourcesContent":["import { tapApi } from \"../../utils/tap-store\";\nimport { resource, tapInlineResource, tapMemo } from \"@assistant-ui/tap\";\nimport { ThreadListRuntime } from \"../runtime/ThreadListRuntime\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { ThreadListItemClient } from \"./ThreadListItemRuntimeClient\";\nimport { ThreadClient } from \"./ThreadRuntimeClient\";\nimport { tapLookupResources } from \"../../client/util-hooks/tapLookupResources\";\nimport {\n ThreadListClientState,\n ThreadListClientApi,\n} from \"../../client/types/ThreadList\";\n\nconst ThreadListItemClientById = resource(\n ({ runtime, id }: { runtime: ThreadListRuntime; id: string }) => {\n const threadListItemRuntime = tapMemo(\n () => runtime.getItemById(id),\n [runtime, id],\n );\n return tapInlineResource(\n ThreadListItemClient({\n runtime: threadListItemRuntime,\n }),\n );\n },\n);\n\nexport const ThreadListClient = resource(\n ({ runtime }: { runtime: ThreadListRuntime }) => {\n const runtimeState = tapSubscribable(runtime);\n\n const main = tapInlineResource(\n ThreadClient({\n runtime: runtime.main,\n }),\n );\n\n const threadItems = tapLookupResources(\n Object.keys(runtimeState.threadItems).map((id) =>\n ThreadListItemClientById({ runtime, id }, { key: id }),\n ),\n );\n\n const state = tapMemo<ThreadListClientState>(() => {\n return {\n mainThreadId: runtimeState.mainThreadId,\n newThreadId: runtimeState.newThread ?? null,\n isLoading: runtimeState.isLoading,\n threadIds: runtimeState.threads,\n archivedThreadIds: runtimeState.archivedThreads,\n threadItems: threadItems.state,\n\n main: main.state,\n };\n }, [runtimeState, threadItems.state, main.state]);\n\n return tapApi<ThreadListClientApi>({\n getState: () => state,\n\n thread: () => main.api,\n\n item: (threadIdOrOptions) => {\n if (threadIdOrOptions === \"main\") {\n return threadItems.api({ key: state.mainThreadId });\n }\n\n if (\"id\" in threadIdOrOptions) {\n return threadItems.api({ key: threadIdOrOptions.id });\n }\n\n const { index, archived = false } = threadIdOrOptions;\n const id = archived\n ? state.archivedThreadIds[index]!\n : state.threadIds[index]!;\n return threadItems.api({ key: id });\n },\n\n switchToThread: (threadId) => {\n runtime.switchToThread(threadId);\n },\n switchToNewThread: () => {\n runtime.switchToNewThread();\n },\n });\n },\n);\n"],"mappings":";AAAA,SAAS,cAAc;AACvB,SAAS,UAAU,mBAAmB,eAAe;AAErD,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AAMnC,IAAM,2BAA2B;AAAA,EAC/B,CAAC,EAAE,SAAS,GAAG,MAAkD;AAC/D,UAAM,wBAAwB;AAAA,MAC5B,MAAM,QAAQ,YAAY,EAAE;AAAA,MAC5B,CAAC,SAAS,EAAE;AAAA,IACd;AACA,WAAO;AAAA,MACL,qBAAqB;AAAA,QACnB,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,IAAM,mBAAmB;AAAA,EAC9B,CAAC,EAAE,QAAQ,MAAsC;AAC/C,UAAM,eAAe,gBAAgB,OAAO;AAE5C,UAAM,OAAO;AAAA,MACX,aAAa;AAAA,QACX,SAAS,QAAQ;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,UAAM,cAAc;AAAA,MAClB,OAAO,KAAK,aAAa,WAAW,EAAE;AAAA,QAAI,CAAC,OACzC,yBAAyB,EAAE,SAAS,GAAG,GAAG,EAAE,KAAK,GAAG,CAAC;AAAA,MACvD;AAAA,IACF;AAEA,UAAM,QAAQ,QAA+B,MAAM;AACjD,aAAO;AAAA,QACL,cAAc,aAAa;AAAA,QAC3B,aAAa,aAAa,aAAa;AAAA,QACvC,WAAW,aAAa;AAAA,QACxB,WAAW,aAAa;AAAA,QACxB,mBAAmB,aAAa;AAAA,QAChC,aAAa,YAAY;AAAA,QAEzB,MAAM,KAAK;AAAA,MACb;AAAA,IACF,GAAG,CAAC,cAAc,YAAY,OAAO,KAAK,KAAK,CAAC;AAEhD,WAAO,OAA4B;AAAA,MACjC,UAAU,MAAM;AAAA,MAEhB,QAAQ,MAAM,KAAK;AAAA,MAEnB,MAAM,CAAC,sBAAsB;AAC3B,YAAI,sBAAsB,QAAQ;AAChC,iBAAO,YAAY,IAAI,EAAE,KAAK,MAAM,aAAa,CAAC;AAAA,QACpD;AAEA,YAAI,QAAQ,mBAAmB;AAC7B,iBAAO,YAAY,IAAI,EAAE,KAAK,kBAAkB,GAAG,CAAC;AAAA,QACtD;AAEA,cAAM,EAAE,OAAO,WAAW,MAAM,IAAI;AACpC,cAAM,KAAK,WACP,MAAM,kBAAkB,KAAK,IAC7B,MAAM,UAAU,KAAK;AACzB,eAAO,YAAY,IAAI,EAAE,KAAK,GAAG,CAAC;AAAA,MACpC;AAAA,MAEA,gBAAgB,CAAC,aAAa;AAC5B,gBAAQ,eAAe,QAAQ;AAAA,MACjC;AAAA,MACA,mBAAmB,MAAM;AACvB,gBAAQ,kBAAkB;AAAA,MAC5B;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { ThreadRuntime } from "../runtime/ThreadRuntime";
|
2
|
-
import {
|
2
|
+
import { ThreadClientApi } from "../../client/types/Thread";
|
3
3
|
export declare const ThreadClient: import("@assistant-ui/tap").ResourceElementConstructor<{
|
4
|
-
|
4
|
+
key: string | undefined;
|
5
|
+
state: any;
|
5
6
|
api: ThreadClientApi;
|
6
7
|
}, {
|
7
8
|
runtime: ThreadRuntime;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/ThreadRuntimeClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAezD,OAAO,
|
1
|
+
{"version":3,"file":"ThreadRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/legacy-runtime/client/ThreadRuntimeClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAezD,OAAO,EAAqB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAuB/E,eAAO,MAAM,YAAY;;;;;aACE,aAAa;EAmGvC,CAAC"}
|
@@ -87,7 +87,7 @@ var ThreadClient = resource(
|
|
87
87
|
messages: messages.state
|
88
88
|
};
|
89
89
|
}, [runtimeState, messages, composer.state]);
|
90
|
-
|
90
|
+
return tapApi({
|
91
91
|
getState: () => state,
|
92
92
|
composer: composer.api,
|
93
93
|
append: runtime.append,
|
@@ -108,10 +108,6 @@ var ThreadClient = resource(
|
|
108
108
|
},
|
109
109
|
__internal_getRuntime: () => runtime
|
110
110
|
});
|
111
|
-
return {
|
112
|
-
state,
|
113
|
-
api
|
114
|
-
};
|
115
111
|
}
|
116
112
|
);
|
117
113
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/legacy-runtime/client/ThreadRuntimeClient.ts"],"sourcesContent":["import { ThreadRuntimeEventType } from \"../runtime-cores/core/ThreadRuntimeCore\";\nimport { ThreadRuntime } from \"../runtime/ThreadRuntime\";\nimport {\n resource,\n tapInlineResource,\n tapMemo,\n tapEffect,\n RefObject,\n} from \"@assistant-ui/tap\";\nimport { ComposerClient } from \"./ComposerRuntimeClient\";\nimport { MessageClient } from \"./MessageRuntimeClient\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { tapApi } from \"../../utils/tap-store\";\nimport { tapLookupResources } from \"../../client/util-hooks/tapLookupResources\";\nimport { Unsubscribe } from \"../../types\";\nimport { tapEvents } from \"../../client/EventContext\";\nimport { ThreadClientState, ThreadClientApi } from \"../../client/types/Thread\";\n\nconst MessageClientById = resource(\n ({\n runtime,\n id,\n threadIdRef,\n }: {\n runtime: ThreadRuntime;\n id: string;\n threadIdRef: RefObject<string>;\n }) => {\n const messageRuntime = tapMemo(\n () => runtime.getMessageById(id),\n [runtime, id],\n );\n\n return tapInlineResource(\n MessageClient({ runtime: messageRuntime, threadIdRef }),\n );\n },\n);\n\nexport const ThreadClient = resource(\n ({ runtime }: { runtime: ThreadRuntime }) => {\n const runtimeState = tapSubscribable(runtime);\n\n const events = tapEvents();\n\n // Bind thread events to event manager\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to thread events\n const threadEvents: ThreadRuntimeEventType[] = [\n \"run-start\",\n \"run-end\",\n \"initialize\",\n \"model-context-update\",\n ];\n\n for (const event of threadEvents) {\n const unsubscribe = runtime.unstable_on(event, () => {\n const threadId = runtime.getState()?.threadId || \"unknown\";\n events.emit(`thread.${event}`, {\n threadId,\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime]);\n\n const threadIdRef = tapMemo(\n () => ({\n get current() {\n return runtime.getState()!.threadId;\n },\n }),\n [runtime],\n );\n\n const composer = tapInlineResource(\n ComposerClient({\n runtime: runtime.composer,\n threadIdRef,\n }),\n );\n\n const messages = tapLookupResources(\n runtimeState.messages.map((m) =>\n MessageClientById(\n { runtime: runtime, id: m.id, threadIdRef },\n { key: m.id },\n ),\n ),\n );\n\n const state = tapMemo<ThreadClientState>(() => {\n return {\n isDisabled: runtimeState.isDisabled,\n isLoading: runtimeState.isLoading,\n isRunning: runtimeState.isRunning,\n capabilities: runtimeState.capabilities,\n state: runtimeState.state,\n suggestions: runtimeState.suggestions,\n extras: runtimeState.extras,\n speech: runtimeState.speech,\n\n composer: composer.state,\n messages: messages.state,\n };\n }, [runtimeState, messages, composer.state]);\n\n
|
1
|
+
{"version":3,"sources":["../../../src/legacy-runtime/client/ThreadRuntimeClient.ts"],"sourcesContent":["import { ThreadRuntimeEventType } from \"../runtime-cores/core/ThreadRuntimeCore\";\nimport { ThreadRuntime } from \"../runtime/ThreadRuntime\";\nimport {\n resource,\n tapInlineResource,\n tapMemo,\n tapEffect,\n RefObject,\n} from \"@assistant-ui/tap\";\nimport { ComposerClient } from \"./ComposerRuntimeClient\";\nimport { MessageClient } from \"./MessageRuntimeClient\";\nimport { tapSubscribable } from \"../util-hooks/tapSubscribable\";\nimport { tapApi } from \"../../utils/tap-store\";\nimport { tapLookupResources } from \"../../client/util-hooks/tapLookupResources\";\nimport { Unsubscribe } from \"../../types\";\nimport { tapEvents } from \"../../client/EventContext\";\nimport { ThreadClientState, ThreadClientApi } from \"../../client/types/Thread\";\n\nconst MessageClientById = resource(\n ({\n runtime,\n id,\n threadIdRef,\n }: {\n runtime: ThreadRuntime;\n id: string;\n threadIdRef: RefObject<string>;\n }) => {\n const messageRuntime = tapMemo(\n () => runtime.getMessageById(id),\n [runtime, id],\n );\n\n return tapInlineResource(\n MessageClient({ runtime: messageRuntime, threadIdRef }),\n );\n },\n);\n\nexport const ThreadClient = resource(\n ({ runtime }: { runtime: ThreadRuntime }) => {\n const runtimeState = tapSubscribable(runtime);\n\n const events = tapEvents();\n\n // Bind thread events to event manager\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to thread events\n const threadEvents: ThreadRuntimeEventType[] = [\n \"run-start\",\n \"run-end\",\n \"initialize\",\n \"model-context-update\",\n ];\n\n for (const event of threadEvents) {\n const unsubscribe = runtime.unstable_on(event, () => {\n const threadId = runtime.getState()?.threadId || \"unknown\";\n events.emit(`thread.${event}`, {\n threadId,\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime]);\n\n const threadIdRef = tapMemo(\n () => ({\n get current() {\n return runtime.getState()!.threadId;\n },\n }),\n [runtime],\n );\n\n const composer = tapInlineResource(\n ComposerClient({\n runtime: runtime.composer,\n threadIdRef,\n }),\n );\n\n const messages = tapLookupResources(\n runtimeState.messages.map((m) =>\n MessageClientById(\n { runtime: runtime, id: m.id, threadIdRef },\n { key: m.id },\n ),\n ),\n );\n\n const state = tapMemo<ThreadClientState>(() => {\n return {\n isDisabled: runtimeState.isDisabled,\n isLoading: runtimeState.isLoading,\n isRunning: runtimeState.isRunning,\n capabilities: runtimeState.capabilities,\n state: runtimeState.state,\n suggestions: runtimeState.suggestions,\n extras: runtimeState.extras,\n speech: runtimeState.speech,\n\n composer: composer.state,\n messages: messages.state,\n };\n }, [runtimeState, messages, composer.state]);\n\n return tapApi<ThreadClientApi>({\n getState: () => state,\n\n composer: composer.api,\n\n append: runtime.append,\n startRun: runtime.startRun,\n unstable_resumeRun: runtime.unstable_resumeRun,\n cancelRun: runtime.cancelRun,\n getModelContext: runtime.getModelContext,\n export: runtime.export,\n import: runtime.import,\n reset: runtime.reset,\n stopSpeaking: runtime.stopSpeaking,\n\n message: (selector) => {\n if (\"id\" in selector) {\n return messages.api({ key: selector.id });\n } else {\n return messages.api(selector);\n }\n },\n\n __internal_getRuntime: () => runtime,\n });\n },\n);\n"],"mappings":"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","names":[]}
|
@@ -1,5 +1,13 @@
|
|
1
1
|
export interface ApiObject {
|
2
2
|
[key: string]: ((...args: any[]) => any) | ApiObject;
|
3
3
|
}
|
4
|
-
export declare const tapApi: <TApi extends ApiObject
|
4
|
+
export declare const tapApi: <TApi extends ApiObject & {
|
5
|
+
getState: () => any;
|
6
|
+
}>(api: TApi, options?: {
|
7
|
+
key?: string | undefined;
|
8
|
+
}) => {
|
9
|
+
key: string | undefined;
|
10
|
+
state: any;
|
11
|
+
api: TApi;
|
12
|
+
};
|
5
13
|
//# sourceMappingURL=tap-api.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tap-api.d.ts","sourceRoot":"","sources":["../../../src/utils/tap-store/tap-api.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,GAAG,SAAS,CAAC;CACtD;AAgCD,eAAO,MAAM,MAAM,GAAI,IAAI,SAAS,SAAS,EAAE,KAAK,IAAI,
|
1
|
+
{"version":3,"file":"tap-api.d.ts","sourceRoot":"","sources":["../../../src/utils/tap-store/tap-api.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,GAAG,SAAS,CAAC;CACtD;AAgCD,eAAO,MAAM,MAAM,GAAI,IAAI,SAAS,SAAS,GAAG;IAAE,QAAQ,EAAE,MAAM,GAAG,CAAA;CAAE,EACrE,KAAK,IAAI,EACT,UAAU;IACR,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;;;;CAwBF,CAAC"}
|
@@ -26,15 +26,25 @@ var ReadonlyApiHandler = class {
|
|
26
26
|
return false;
|
27
27
|
}
|
28
28
|
};
|
29
|
-
var tapApi = (api) => {
|
29
|
+
var tapApi = (api, options) => {
|
30
30
|
const ref = tapRef(() => api);
|
31
31
|
tapEffect(() => {
|
32
32
|
ref.current = api;
|
33
33
|
});
|
34
|
-
|
34
|
+
const apiProxy = tapMemo(
|
35
35
|
() => new Proxy({}, new ReadonlyApiHandler(() => ref.current)),
|
36
36
|
[]
|
37
37
|
);
|
38
|
+
const key = options?.key;
|
39
|
+
const state = api.getState();
|
40
|
+
return tapMemo(
|
41
|
+
() => ({
|
42
|
+
key,
|
43
|
+
state,
|
44
|
+
api: apiProxy
|
45
|
+
}),
|
46
|
+
[state, key]
|
47
|
+
);
|
38
48
|
};
|
39
49
|
export {
|
40
50
|
tapApi
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/tap-store/tap-api.ts"],"sourcesContent":["import { tapEffect, tapMemo, tapRef } from \"@assistant-ui/tap\";\n\nexport interface ApiObject {\n [key: string]: ((...args: any[]) => any) | ApiObject;\n}\n\nclass ReadonlyApiHandler<TApi extends ApiObject> implements ProxyHandler<TApi> {\n constructor(private readonly getApi: () => TApi) {}\n\n get(_: unknown, prop: string | symbol) {\n return this.getApi()[prop as keyof TApi];\n }\n\n ownKeys(): ArrayLike<string | symbol> {\n return Object.keys(this.getApi() as object);\n }\n\n has(_: unknown, prop: string | symbol) {\n return prop in (this.getApi() as object);\n }\n\n getOwnPropertyDescriptor(_: unknown, prop: string | symbol) {\n return Object.getOwnPropertyDescriptor(this.getApi(), prop);\n }\n\n set() {\n return false;\n }\n defineProperty() {\n return false;\n }\n deleteProperty() {\n return false;\n }\n}\n\nexport const tapApi = <TApi extends ApiObject>(api: TApi) => {\n const ref = tapRef(() => api);\n tapEffect(() => {\n ref.current = api;\n });\n\n
|
1
|
+
{"version":3,"sources":["../../../src/utils/tap-store/tap-api.ts"],"sourcesContent":["import { tapEffect, tapMemo, tapRef } from \"@assistant-ui/tap\";\n\nexport interface ApiObject {\n [key: string]: ((...args: any[]) => any) | ApiObject;\n}\n\nclass ReadonlyApiHandler<TApi extends ApiObject> implements ProxyHandler<TApi> {\n constructor(private readonly getApi: () => TApi) {}\n\n get(_: unknown, prop: string | symbol) {\n return this.getApi()[prop as keyof TApi];\n }\n\n ownKeys(): ArrayLike<string | symbol> {\n return Object.keys(this.getApi() as object);\n }\n\n has(_: unknown, prop: string | symbol) {\n return prop in (this.getApi() as object);\n }\n\n getOwnPropertyDescriptor(_: unknown, prop: string | symbol) {\n return Object.getOwnPropertyDescriptor(this.getApi(), prop);\n }\n\n set() {\n return false;\n }\n defineProperty() {\n return false;\n }\n deleteProperty() {\n return false;\n }\n}\n\nexport const tapApi = <TApi extends ApiObject & { getState: () => any }>(\n api: TApi,\n options?: {\n key?: string | undefined;\n },\n) => {\n const ref = tapRef(() => api);\n tapEffect(() => {\n ref.current = api;\n });\n\n const apiProxy = tapMemo(\n () =>\n new Proxy<TApi>({} as TApi, new ReadonlyApiHandler(() => ref.current)),\n [],\n );\n\n const key = options?.key;\n const state = api.getState();\n\n return tapMemo(\n () => ({\n key,\n state,\n api: apiProxy,\n }),\n [state, key],\n );\n};\n"],"mappings":";AAAA,SAAS,WAAW,SAAS,cAAc;AAM3C,IAAM,qBAAN,MAA+E;AAAA,EAC7E,YAA6B,QAAoB;AAApB;AAAA,EAAqB;AAAA,EAElD,IAAI,GAAY,MAAuB;AACrC,WAAO,KAAK,OAAO,EAAE,IAAkB;AAAA,EACzC;AAAA,EAEA,UAAsC;AACpC,WAAO,OAAO,KAAK,KAAK,OAAO,CAAW;AAAA,EAC5C;AAAA,EAEA,IAAI,GAAY,MAAuB;AACrC,WAAO,QAAS,KAAK,OAAO;AAAA,EAC9B;AAAA,EAEA,yBAAyB,GAAY,MAAuB;AAC1D,WAAO,OAAO,yBAAyB,KAAK,OAAO,GAAG,IAAI;AAAA,EAC5D;AAAA,EAEA,MAAM;AACJ,WAAO;AAAA,EACT;AAAA,EACA,iBAAiB;AACf,WAAO;AAAA,EACT;AAAA,EACA,iBAAiB;AACf,WAAO;AAAA,EACT;AACF;AAEO,IAAM,SAAS,CACpB,KACA,YAGG;AACH,QAAM,MAAM,OAAO,MAAM,GAAG;AAC5B,YAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAChB,CAAC;AAED,QAAM,WAAW;AAAA,IACf,MACE,IAAI,MAAY,CAAC,GAAW,IAAI,mBAAmB,MAAM,IAAI,OAAO,CAAC;AAAA,IACvE,CAAC;AAAA,EACH;AAEA,QAAM,MAAM,SAAS;AACrB,QAAM,QAAQ,IAAI,SAAS;AAE3B,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,KAAK;AAAA,IACP;AAAA,IACA,CAAC,OAAO,GAAG;AAAA,EACb;AACF;","names":[]}
|
package/package.json
CHANGED
@@ -72,7 +72,7 @@ const AssistantStore = resource(
|
|
72
72
|
[threads.state, toolUIs.state],
|
73
73
|
);
|
74
74
|
|
75
|
-
|
75
|
+
return tapApi<AssistantClientApi>({
|
76
76
|
getState: () => state,
|
77
77
|
|
78
78
|
threads: threads.api,
|
@@ -82,9 +82,6 @@ const AssistantStore = resource(
|
|
82
82
|
registerModelContextProvider: registerModelContextProvider,
|
83
83
|
__internal_getRuntime: () => __internal_runtime ?? null,
|
84
84
|
});
|
85
|
-
|
86
|
-
// notify the store of state changes
|
87
|
-
return tapMemo(() => ({ api }), [state]);
|
88
85
|
},
|
89
86
|
);
|
90
87
|
|
@@ -5,7 +5,7 @@ import { ToolUIState, ToolUIApi } from "./types/ToolUI";
|
|
5
5
|
export const ToolUIClient = resource(() => {
|
6
6
|
const [state, setState] = tapState<ToolUIState>(() => ({}));
|
7
7
|
|
8
|
-
|
8
|
+
return tapApi<ToolUIApi>({
|
9
9
|
getState: () => state,
|
10
10
|
|
11
11
|
setToolUI: (toolName, render) => {
|
@@ -26,9 +26,4 @@ export const ToolUIClient = resource(() => {
|
|
26
26
|
};
|
27
27
|
},
|
28
28
|
});
|
29
|
-
|
30
|
-
return {
|
31
|
-
state,
|
32
|
-
api,
|
33
|
-
};
|
34
29
|
});
|
@@ -4,7 +4,7 @@ import { useMemo, type FC, type PropsWithChildren } from "react";
|
|
4
4
|
|
5
5
|
import {
|
6
6
|
AssistantApi,
|
7
|
-
|
7
|
+
AssistantProvider,
|
8
8
|
useAssistantApi,
|
9
9
|
createAssistantApiField,
|
10
10
|
} from "../react/AssistantApiContext";
|
@@ -25,7 +25,7 @@ export const MessageAttachmentByIndexProvider: FC<
|
|
25
25
|
} satisfies Partial<AssistantApi>;
|
26
26
|
}, [api, index]);
|
27
27
|
|
28
|
-
return <
|
28
|
+
return <AssistantProvider api={api2}>{children}</AssistantProvider>;
|
29
29
|
};
|
30
30
|
|
31
31
|
export const ComposerAttachmentByIndexProvider: FC<
|
@@ -44,5 +44,5 @@ export const ComposerAttachmentByIndexProvider: FC<
|
|
44
44
|
} satisfies Partial<AssistantApi>;
|
45
45
|
}, [api, index]);
|
46
46
|
|
47
|
-
return <
|
47
|
+
return <AssistantProvider api={api2}>{children}</AssistantProvider>;
|
48
48
|
};
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { useMemo, type FC, type PropsWithChildren } from "react";
|
4
4
|
import {
|
5
5
|
AssistantApi,
|
6
|
-
|
6
|
+
AssistantProvider,
|
7
7
|
useAssistantApi,
|
8
8
|
createAssistantApiField,
|
9
9
|
} from "../react/AssistantApiContext";
|
@@ -48,5 +48,5 @@ export const MessageByIndexProvider: FC<
|
|
48
48
|
} satisfies Partial<AssistantApi>;
|
49
49
|
}, [api, index]);
|
50
50
|
|
51
|
-
return <
|
51
|
+
return <AssistantProvider api={api2}>{children}</AssistantProvider>;
|
52
52
|
};
|