@assistant-ui/react 0.7.39 → 0.7.40

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  import { FC, PropsWithChildren, ComponentType } from "react";
2
2
  import { BaseSubscribable } from "./BaseSubscribable";
3
- import { RemoteThreadListHook } from "./types";
3
+ import { AssistantRuntime } from "../../api";
4
+ type RemoteThreadListHook = () => AssistantRuntime;
4
5
  export declare class RemoteThreadListHookInstanceManager extends BaseSubscribable {
5
6
  private useRuntimeHook;
6
7
  private instances;
@@ -74,4 +75,5 @@ export declare class RemoteThreadListHookInstanceManager extends BaseSubscribabl
74
75
  provider: ComponentType<PropsWithChildren>;
75
76
  }>;
76
77
  }
78
+ export {};
77
79
  //# sourceMappingURL=RemoteThreadListHookInstanceManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteThreadListHookInstanceManager.d.ts","sourceRoot":"","sources":["../../../src/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,EAAE,EAMF,iBAAiB,EACjB,aAAa,EACd,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAK/C,qBAAa,mCAAoC,SAAQ,gBAAgB;IACvE,OAAO,CAAC,cAAc,CAEpB;IACF,OAAO,CAAC,SAAS,CAAmD;IACpE,OAAO,CAAC,0BAA0B,CAAsB;gBAE5C,WAAW,EAAE,oBAAoB;IAKtC,kBAAkB,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwBnC,oBAAoB,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASrC,iBAAiB,CAAC,QAAQ,EAAE,MAAM;IAKlC,cAAc,CAAC,cAAc,EAAE,oBAAoB;IAO1D,OAAO,CAAC,0BAA0B,CAiChC;IAEF,OAAO,CAAC,0BAA0B,CAiB/B;IAEI,+BAA+B,EAAE,EAAE,CAAC;QACzC,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;KAC5C,CAAC,CAYA;CACH"}
1
+ {"version":3,"file":"RemoteThreadListHookInstanceManager.d.ts","sourceRoot":"","sources":["../../../src/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,EAAE,EAMF,iBAAiB,EACjB,aAAa,EACd,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,KAAK,oBAAoB,GAAG,MAAM,gBAAgB,CAAC;AAKnD,qBAAa,mCAAoC,SAAQ,gBAAgB;IACvE,OAAO,CAAC,cAAc,CAEpB;IACF,OAAO,CAAC,SAAS,CAAmD;IACpE,OAAO,CAAC,0BAA0B,CAAsB;gBAE5C,WAAW,EAAE,oBAAoB;IAKtC,kBAAkB,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwBnC,oBAAoB,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASrC,iBAAiB,CAAC,QAAQ,EAAE,MAAM;IAKlC,cAAc,CAAC,cAAc,EAAE,oBAAoB;IAO1D,OAAO,CAAC,0BAA0B,CAiChC;IAEF,OAAO,CAAC,0BAA0B,CAiB/B;IAEI,+BAA+B,EAAE,EAAE,CAAC;QACzC,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;KAC5C,CAAC,CAYA;CACH"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n useCallback,\n useRef,\n useEffect,\n memo,\n useMemo,\n PropsWithChildren,\n ComponentType,\n} from \"react\";\nimport { UseBoundStore, StoreApi, create } from \"zustand\";\nimport { useAssistantRuntime } from \"../../context\";\nimport { ThreadListItemRuntimeProvider } from \"../../context/providers/ThreadListItemRuntimeProvider\";\nimport { useThreadListItem } from \"../../context/react/ThreadListItemContext\";\nimport { ThreadRuntimeCore, ThreadRuntimeImpl } from \"../../internal\";\nimport { BaseSubscribable } from \"./BaseSubscribable\";\nimport { RemoteThreadListHook } from \"./types\";\n\ntype RemoteThreadListHookInstance = {\n runtime?: ThreadRuntimeCore;\n};\nexport class RemoteThreadListHookInstanceManager extends BaseSubscribable {\n private useRuntimeHook: UseBoundStore<\n StoreApi<{ useRuntime: RemoteThreadListHook }>\n >;\n private instances = new Map<string, RemoteThreadListHookInstance>();\n private useAliveThreadsKeysChanged = create(() => ({}));\n\n constructor(runtimeHook: RemoteThreadListHook) {\n super();\n this.useRuntimeHook = create(() => ({ useRuntime: runtimeHook }));\n }\n\n public startThreadRuntime(threadId: string) {\n if (!this.instances.has(threadId)) {\n this.instances.set(threadId, {});\n this.useAliveThreadsKeysChanged.setState({}, true);\n }\n\n return new Promise<ThreadRuntimeCore>((resolve, reject) => {\n const callback = () => {\n const instance = this.instances.get(threadId);\n if (!instance) {\n dispose();\n reject(new Error(\"Thread was deleted before runtime was started\"));\n } else if (!instance.runtime) {\n return; // misc update\n } else {\n dispose();\n resolve(instance.runtime);\n }\n };\n const dispose = this.subscribe(callback);\n callback();\n });\n }\n\n public getThreadRuntimeCore(threadId: string) {\n const instance = this.instances.get(threadId);\n if (!instance)\n throw new Error(\n \"getThreadRuntimeCore not found. This is a bug in assistant-ui.\",\n );\n return instance.runtime;\n }\n\n public stopThreadRuntime(threadId: string) {\n this.instances.delete(threadId);\n this.useAliveThreadsKeysChanged.setState({}, true);\n }\n\n public setRuntimeHook(newRuntimeHook: RemoteThreadListHook) {\n const prevRuntimeHook = this.useRuntimeHook.getState().useRuntime;\n if (prevRuntimeHook !== newRuntimeHook) {\n this.useRuntimeHook.setState({ useRuntime: newRuntimeHook }, true);\n }\n }\n\n private _InnerActiveThreadProvider: FC = () => {\n const { id } = useThreadListItem();\n\n const { useRuntime } = this.useRuntimeHook();\n const runtime = useRuntime();\n\n const threadBinding = (runtime.thread as ThreadRuntimeImpl)\n .__internal_threadBinding;\n\n const updateRuntime = useCallback(() => {\n const aliveThread = this.instances.get(id);\n if (!aliveThread)\n throw new Error(\"Thread not found. This is a bug in assistant-ui.\");\n\n aliveThread.runtime = threadBinding.getState();\n\n if (isMounted) {\n this._notifySubscribers();\n }\n }, [id, threadBinding]);\n\n const isMounted = useRef(false);\n if (!isMounted.current) {\n updateRuntime();\n }\n\n useEffect(() => {\n isMounted.current = true;\n updateRuntime();\n return threadBinding.outerSubscribe(updateRuntime);\n }, [threadBinding]);\n\n return null;\n };\n\n private _OuterActiveThreadProvider: FC<{\n threadId: string;\n provider: ComponentType<PropsWithChildren>;\n }> = memo(({ threadId, provider: Provider }) => {\n const assistantRuntime = useAssistantRuntime();\n const threadListItemRuntime = useMemo(\n () => assistantRuntime.threadList.getItemById(threadId),\n [assistantRuntime, threadId],\n );\n\n return (\n <ThreadListItemRuntimeProvider runtime={threadListItemRuntime}>\n <Provider>\n <this._InnerActiveThreadProvider />\n </Provider>\n </ThreadListItemRuntimeProvider>\n );\n });\n\n public __internal_RenderThreadRuntimes: FC<{\n provider: ComponentType<PropsWithChildren>;\n }> = ({ provider }) => {\n this.useAliveThreadsKeysChanged(); // trigger re-render on alive threads change\n\n return this.instances\n .keys()\n .map((threadId) => (\n <this._OuterActiveThreadProvider\n key={threadId}\n threadId={threadId}\n provider={provider}\n />\n ));\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBASO;AACP,qBAAgD;AAChD,qBAAoC;AACpC,2CAA8C;AAC9C,mCAAkC;AAElC,8BAAiC;AA+GvB;AAzGH,IAAM,sCAAN,cAAkD,yCAAiB;AAAA,EAChE;AAAA,EAGA,YAAY,oBAAI,IAA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AI,gDAAkB;AAEjC,UAAM,EAAE,WAAW,IAAI,KAAK,eAAe;AAC3C,UAAM,UAAU,WAAW;AAE3B,UAAM,gBAAiB,QAAQ,OAC5B;AAEH,UAAM,oBAAgB,0BAAY,MAAM;AACtC,YAAM,cAAc,KAAK,UAAU,IAAI,EAAE;AACzC,UAAI,CAAC;AACH,cAAM,IAAI,MAAM,kDAAkD;AAEpE,kBAAY,UAAU,cAAc,SAAS;AAE7C,UAAI,WAAW;AACb,aAAK,mBAAmB;AAAA,MAC1B;AAAA,IACF,GAAG,CAAC,IAAI,aAAa,CAAC;AAEtB,UAAM,gBAAY,qBAAO,KAAK;AAC9B,QAAI,CAAC,UAAU,SAAS;AACtB,oBAAc;AAAA,IAChB;AAEA,gCAAU,MAAM;AACd,gBAAU,UAAU;AACpB,oBAAc;AACd,aAAO,cAAc,eAAe,aAAa;AAAA,IACnD,GAAG,CAAC,aAAa,CAAC;AAElB,WAAO;AAAA,EACT;AAAA,EAEQ,iCAGH,mBAAK,CAAC,EAAE,UAAU,UAAU,SAAS,MAAM;AAC9C,UAAM,uBAAmB,oCAAoB;AAC7C,UAAM,4BAAwB;AAAA,MAC5B,MAAM,iBAAiB,WAAW,YAAY,QAAQ;AAAA,MACtD,CAAC,kBAAkB,QAAQ;AAAA,IAC7B;AAEA,WACE,4CAAC,sEAA8B,SAAS,uBACtC,sDAAC,YACC,sDAAC,KAAK,4BAAL,EAAgC,GACnC,GACF;AAAA,EAEJ,CAAC;AAAA,EAEM,kCAEF,CAAC,EAAE,SAAS,MAAM;AACrB,SAAK,2BAA2B;AAEhC,WAAO,KAAK,UACT,KAAK,EACL,IAAI,CAAC,aACJ;AAAA,MAAC,KAAK;AAAA,MAAL;AAAA,QAEC;AAAA,QACA;AAAA;AAAA,MAFK;AAAA,IAGP,CACD;AAAA,EACL;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n useCallback,\n useRef,\n useEffect,\n memo,\n useMemo,\n PropsWithChildren,\n ComponentType,\n} from \"react\";\nimport { UseBoundStore, StoreApi, create } from \"zustand\";\nimport { useAssistantRuntime } from \"../../context\";\nimport { ThreadListItemRuntimeProvider } from \"../../context/providers/ThreadListItemRuntimeProvider\";\nimport { useThreadListItem } from \"../../context/react/ThreadListItemContext\";\nimport { ThreadRuntimeCore, ThreadRuntimeImpl } from \"../../internal\";\nimport { BaseSubscribable } from \"./BaseSubscribable\";\nimport { AssistantRuntime } from \"../../api\";\n\ntype RemoteThreadListHook = () => AssistantRuntime;\n\ntype RemoteThreadListHookInstance = {\n runtime?: ThreadRuntimeCore;\n};\nexport class RemoteThreadListHookInstanceManager extends BaseSubscribable {\n private useRuntimeHook: UseBoundStore<\n StoreApi<{ useRuntime: RemoteThreadListHook }>\n >;\n private instances = new Map<string, RemoteThreadListHookInstance>();\n private useAliveThreadsKeysChanged = create(() => ({}));\n\n constructor(runtimeHook: RemoteThreadListHook) {\n super();\n this.useRuntimeHook = create(() => ({ useRuntime: runtimeHook }));\n }\n\n public startThreadRuntime(threadId: string) {\n if (!this.instances.has(threadId)) {\n this.instances.set(threadId, {});\n this.useAliveThreadsKeysChanged.setState({}, true);\n }\n\n return new Promise<ThreadRuntimeCore>((resolve, reject) => {\n const callback = () => {\n const instance = this.instances.get(threadId);\n if (!instance) {\n dispose();\n reject(new Error(\"Thread was deleted before runtime was started\"));\n } else if (!instance.runtime) {\n return; // misc update\n } else {\n dispose();\n resolve(instance.runtime);\n }\n };\n const dispose = this.subscribe(callback);\n callback();\n });\n }\n\n public getThreadRuntimeCore(threadId: string) {\n const instance = this.instances.get(threadId);\n if (!instance)\n throw new Error(\n \"getThreadRuntimeCore not found. This is a bug in assistant-ui.\",\n );\n return instance.runtime;\n }\n\n public stopThreadRuntime(threadId: string) {\n this.instances.delete(threadId);\n this.useAliveThreadsKeysChanged.setState({}, true);\n }\n\n public setRuntimeHook(newRuntimeHook: RemoteThreadListHook) {\n const prevRuntimeHook = this.useRuntimeHook.getState().useRuntime;\n if (prevRuntimeHook !== newRuntimeHook) {\n this.useRuntimeHook.setState({ useRuntime: newRuntimeHook }, true);\n }\n }\n\n private _InnerActiveThreadProvider: FC = () => {\n const { id } = useThreadListItem();\n\n const { useRuntime } = this.useRuntimeHook();\n const runtime = useRuntime();\n\n const threadBinding = (runtime.thread as ThreadRuntimeImpl)\n .__internal_threadBinding;\n\n const updateRuntime = useCallback(() => {\n const aliveThread = this.instances.get(id);\n if (!aliveThread)\n throw new Error(\"Thread not found. This is a bug in assistant-ui.\");\n\n aliveThread.runtime = threadBinding.getState();\n\n if (isMounted) {\n this._notifySubscribers();\n }\n }, [id, threadBinding]);\n\n const isMounted = useRef(false);\n if (!isMounted.current) {\n updateRuntime();\n }\n\n useEffect(() => {\n isMounted.current = true;\n updateRuntime();\n return threadBinding.outerSubscribe(updateRuntime);\n }, [threadBinding]);\n\n return null;\n };\n\n private _OuterActiveThreadProvider: FC<{\n threadId: string;\n provider: ComponentType<PropsWithChildren>;\n }> = memo(({ threadId, provider: Provider }) => {\n const assistantRuntime = useAssistantRuntime();\n const threadListItemRuntime = useMemo(\n () => assistantRuntime.threadList.getItemById(threadId),\n [assistantRuntime, threadId],\n );\n\n return (\n <ThreadListItemRuntimeProvider runtime={threadListItemRuntime}>\n <Provider>\n <this._InnerActiveThreadProvider />\n </Provider>\n </ThreadListItemRuntimeProvider>\n );\n });\n\n public __internal_RenderThreadRuntimes: FC<{\n provider: ComponentType<PropsWithChildren>;\n }> = ({ provider }) => {\n this.useAliveThreadsKeysChanged(); // trigger re-render on alive threads change\n\n return this.instances\n .keys()\n .map((threadId) => (\n <this._OuterActiveThreadProvider\n key={threadId}\n threadId={threadId}\n provider={provider}\n />\n ));\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBASO;AACP,qBAAgD;AAChD,qBAAoC;AACpC,2CAA8C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ACD;AAAA,EACL;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n useCallback,\n useRef,\n useEffect,\n memo,\n useMemo,\n PropsWithChildren,\n ComponentType,\n} from \"react\";\nimport { UseBoundStore, StoreApi, create } from \"zustand\";\nimport { useAssistantRuntime } from \"../../context\";\nimport { ThreadListItemRuntimeProvider } from \"../../context/providers/ThreadListItemRuntimeProvider\";\nimport { useThreadListItem } from \"../../context/react/ThreadListItemContext\";\nimport { ThreadRuntimeCore, ThreadRuntimeImpl } from \"../../internal\";\nimport { BaseSubscribable } from \"./BaseSubscribable\";\nimport { RemoteThreadListHook } from \"./types\";\n\ntype RemoteThreadListHookInstance = {\n runtime?: ThreadRuntimeCore;\n};\nexport class RemoteThreadListHookInstanceManager extends BaseSubscribable {\n private useRuntimeHook: UseBoundStore<\n StoreApi<{ useRuntime: RemoteThreadListHook }>\n >;\n private instances = new Map<string, RemoteThreadListHookInstance>();\n private useAliveThreadsKeysChanged = create(() => ({}));\n\n constructor(runtimeHook: RemoteThreadListHook) {\n super();\n this.useRuntimeHook = create(() => ({ useRuntime: runtimeHook }));\n }\n\n public startThreadRuntime(threadId: string) {\n if (!this.instances.has(threadId)) {\n this.instances.set(threadId, {});\n this.useAliveThreadsKeysChanged.setState({}, true);\n }\n\n return new Promise<ThreadRuntimeCore>((resolve, reject) => {\n const callback = () => {\n const instance = this.instances.get(threadId);\n if (!instance) {\n dispose();\n reject(new Error(\"Thread was deleted before runtime was started\"));\n } else if (!instance.runtime) {\n return; // misc update\n } else {\n dispose();\n resolve(instance.runtime);\n }\n };\n const dispose = this.subscribe(callback);\n callback();\n });\n }\n\n public getThreadRuntimeCore(threadId: string) {\n const instance = this.instances.get(threadId);\n if (!instance)\n throw new Error(\n \"getThreadRuntimeCore not found. This is a bug in assistant-ui.\",\n );\n return instance.runtime;\n }\n\n public stopThreadRuntime(threadId: string) {\n this.instances.delete(threadId);\n this.useAliveThreadsKeysChanged.setState({}, true);\n }\n\n public setRuntimeHook(newRuntimeHook: RemoteThreadListHook) {\n const prevRuntimeHook = this.useRuntimeHook.getState().useRuntime;\n if (prevRuntimeHook !== newRuntimeHook) {\n this.useRuntimeHook.setState({ useRuntime: newRuntimeHook }, true);\n }\n }\n\n private _InnerActiveThreadProvider: FC = () => {\n const { id } = useThreadListItem();\n\n const { useRuntime } = this.useRuntimeHook();\n const runtime = useRuntime();\n\n const threadBinding = (runtime.thread as ThreadRuntimeImpl)\n .__internal_threadBinding;\n\n const updateRuntime = useCallback(() => {\n const aliveThread = this.instances.get(id);\n if (!aliveThread)\n throw new Error(\"Thread not found. This is a bug in assistant-ui.\");\n\n aliveThread.runtime = threadBinding.getState();\n\n if (isMounted) {\n this._notifySubscribers();\n }\n }, [id, threadBinding]);\n\n const isMounted = useRef(false);\n if (!isMounted.current) {\n updateRuntime();\n }\n\n useEffect(() => {\n isMounted.current = true;\n updateRuntime();\n return threadBinding.outerSubscribe(updateRuntime);\n }, [threadBinding]);\n\n return null;\n };\n\n private _OuterActiveThreadProvider: FC<{\n threadId: string;\n provider: ComponentType<PropsWithChildren>;\n }> = memo(({ threadId, provider: Provider }) => {\n const assistantRuntime = useAssistantRuntime();\n const threadListItemRuntime = useMemo(\n () => assistantRuntime.threadList.getItemById(threadId),\n [assistantRuntime, threadId],\n );\n\n return (\n <ThreadListItemRuntimeProvider runtime={threadListItemRuntime}>\n <Provider>\n <this._InnerActiveThreadProvider />\n </Provider>\n </ThreadListItemRuntimeProvider>\n );\n });\n\n public __internal_RenderThreadRuntimes: FC<{\n provider: ComponentType<PropsWithChildren>;\n }> = ({ provider }) => {\n this.useAliveThreadsKeysChanged(); // trigger re-render on alive threads change\n\n return this.instances\n .keys()\n .map((threadId) => (\n <this._OuterActiveThreadProvider\n key={threadId}\n threadId={threadId}\n provider={provider}\n />\n ));\n };\n}\n"],"mappings":";;;AAEA;A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AO,KAAK,UACT,KAAK,EACL,IAAI,CAAC,aACJ;AAAA,MAAC,KAAK;AAAA,MAAL;AAAA,QAEC;AAAA,QACA;AAAA;AAAA,MAFK;AAAA,IAGP,CACD;AAAA,EACL;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n useCallback,\n useRef,\n useEffect,\n memo,\n useMemo,\n PropsWithChildren,\n ComponentType,\n} from \"react\";\nimport { UseBoundStore, StoreApi, create } from \"zustand\";\nimport { useAssistantRuntime } from \"../../context\";\nimport { ThreadListItemRuntimeProvider } from \"../../context/providers/ThreadListItemRuntimeProvider\";\nimport { useThreadListItem } from \"../../context/react/ThreadListItemContext\";\nimport { ThreadRuntimeCore, ThreadRuntimeImpl } from \"../../internal\";\nimport { BaseSubscribable } from \"./BaseSubscribable\";\nimport { AssistantRuntime } from \"../../api\";\n\ntype RemoteThreadListHook = () => AssistantRuntime;\n\ntype RemoteThreadListHookInstance = {\n runtime?: ThreadRuntimeCore;\n};\nexport class RemoteThreadListHookInstanceManager extends BaseSubscribable {\n private useRuntimeHook: UseBoundStore<\n StoreApi<{ useRuntime: RemoteThreadListHook }>\n >;\n private instances = new Map<string, RemoteThreadListHookInstance>();\n private useAliveThreadsKeysChanged = create(() => ({}));\n\n constructor(runtimeHook: RemoteThreadListHook) {\n super();\n this.useRuntimeHook = create(() => ({ useRuntime: runtimeHook }));\n }\n\n public startThreadRuntime(threadId: string) {\n if (!this.instances.has(threadId)) {\n this.instances.set(threadId, {});\n this.useAliveThreadsKeysChanged.setState({}, true);\n }\n\n return new Promise<ThreadRuntimeCore>((resolve, reject) => {\n const callback = () => {\n const instance = this.instances.get(threadId);\n if (!instance) {\n dispose();\n reject(new Error(\"Thread was deleted before runtime was started\"));\n } else if (!instance.runtime) {\n return; // misc update\n } else {\n dispose();\n resolve(instance.runtime);\n }\n };\n const dispose = this.subscribe(callback);\n callback();\n });\n }\n\n public getThreadRuntimeCore(threadId: string) {\n const instance = this.instances.get(threadId);\n if (!instance)\n throw new Error(\n \"getThreadRuntimeCore not found. This is a bug in assistant-ui.\",\n );\n return instance.runtime;\n }\n\n public stopThreadRuntime(threadId: string) {\n this.instances.delete(threadId);\n this.useAliveThreadsKeysChanged.setState({}, true);\n }\n\n public setRuntimeHook(newRuntimeHook: RemoteThreadListHook) {\n const prevRuntimeHook = this.useRuntimeHook.getState().useRuntime;\n if (prevRuntimeHook !== newRuntimeHook) {\n this.useRuntimeHook.setState({ useRuntime: newRuntimeHook }, true);\n }\n }\n\n private _InnerActiveThreadProvider: FC = () => {\n const { id } = useThreadListItem();\n\n const { useRuntime } = this.useRuntimeHook();\n const runtime = useRuntime();\n\n const threadBinding = (runtime.thread as ThreadRuntimeImpl)\n .__internal_threadBinding;\n\n const updateRuntime = useCallback(() => {\n const aliveThread = this.instances.get(id);\n if (!aliveThread)\n throw new Error(\"Thread not found. This is a bug in assistant-ui.\");\n\n aliveThread.runtime = threadBinding.getState();\n\n if (isMounted) {\n this._notifySubscribers();\n }\n }, [id, threadBinding]);\n\n const isMounted = useRef(false);\n if (!isMounted.current) {\n updateRuntime();\n }\n\n useEffect(() => {\n isMounted.current = true;\n updateRuntime();\n return threadBinding.outerSubscribe(updateRuntime);\n }, [threadBinding]);\n\n return null;\n };\n\n private _OuterActiveThreadProvider: FC<{\n threadId: string;\n provider: ComponentType<PropsWithChildren>;\n }> = memo(({ threadId, provider: Provider }) => {\n const assistantRuntime = useAssistantRuntime();\n const threadListItemRuntime = useMemo(\n () => assistantRuntime.threadList.getItemById(threadId),\n [assistantRuntime, threadId],\n );\n\n return (\n <ThreadListItemRuntimeProvider runtime={threadListItemRuntime}>\n <Provider>\n <this._InnerActiveThreadProvider />\n </Provider>\n </ThreadListItemRuntimeProvider>\n );\n });\n\n public __internal_RenderThreadRuntimes: FC<{\n provider: ComponentType<PropsWithChildren>;\n }> = ({ provider }) => {\n this.useAliveThreadsKeysChanged(); // trigger re-render on alive threads change\n\n return this.instances\n .keys()\n .map((threadId) => (\n <this._OuterActiveThreadProvider\n key={threadId}\n threadId={threadId}\n provider={provider}\n />\n ));\n };\n}\n"],"mappings":";;;AAEA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAkC,cAAc;AAChD,SAAS,2BAA2B;AACpC,SAAS,qCAAqC;AAC9C,SAAS,yBAAyB;AAElC,SAAS,wBAAwB;AAiHvB;AAzGH,IAAM,sCAAN,cAAkD,iBAAiB;AAAA,EAChE;AAAA,EAGA,YAAY,oBAAI,IAA0C;AAAA,EAC1D,6BAA6B,OAAO,OAAO,CAAC,EAAE;AAAA,EAEtD,YAAY,aAAmC;AAC7C,UAAM;AACN,SAAK,iBAAiB,OAAO,OAAO,EAAE,YAAY,YAAY,EAAE;AAAA,EAClE;AAAA,EAEO,mBAAmB,UAAkB;AAC1C,QAAI,CAAC,KAAK,UAAU,IAAI,QAAQ,GAAG;AACjC,WAAK,UAAU,IAAI,UAAU,CAAC,CAAC;AAC/B,WAAK,2BAA2B,SAAS,CAAC,GAAG,IAAI;AAAA,IACnD;AAEA,WAAO,IAAI,QAA2B,CAAC,SAAS,WAAW;AACzD,YAAM,WAAW,MAAM;AACrB,cAAM,WAAW,KAAK,UAAU,IAAI,QAAQ;AAC5C,YAAI,CAAC,UAAU;AACb,kBAAQ;AACR,iBAAO,IAAI,MAAM,+CAA+C,CAAC;AAAA,QACnE,WAAW,CAAC,SAAS,SAAS;AAC5B;AAAA,QACF,OAAO;AACL,kBAAQ;AACR,kBAAQ,SAAS,OAAO;AAAA,QAC1B;AAAA,MACF;AACA,YAAM,UAAU,KAAK,UAAU,QAAQ;AACvC,eAAS;AAAA,IACX,CAAC;AAAA,EACH;AAAA,EAEO,qBAAqB,UAAkB;AAC5C,UAAM,WAAW,KAAK,UAAU,IAAI,QAAQ;AAC5C,QAAI,CAAC;AACH,YAAM,IAAI;AAA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tC,8BAAC,YACC,8BAAC,KAAK,4BAAL,EAAgC,GACnC,GACF;AAAA,EAEJ,CAAC;AAAA,EAEM,kCAEF,CAAC,EAAE,SAAS,MAAM;AACrB,SAAK,2BAA2B;AAEhC,WAAO,KAAK,UACT,KAAK,EACL,IAAI,CAAC,aACJ;AAAA,MAAC,KAAK;AAAA,MAAL;AAAA,QAEC;AAAA,QACA;AAAA;AAAA,MAFK;AAAA,IAGP,CACD;AAAA,EACL;AACF;","names":[]}
@@ -1,2 +1,4 @@
1
+ export { useRemoteThreadListRuntime as unstable_useRemoteThreadListRuntime } from "./useRemoteThreadListRuntime";
2
+ export type { RemoteThreadListAdapter as unstable_RemoteThreadListAdapter } from "./types";
1
3
  export * from "./cloud";
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtimes/remote-thread-list/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtimes/remote-thread-list/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,IAAI,mCAAmC,EAAE,MAAM,8BAA8B,CAAC;AACjH,YAAY,EAAE,uBAAuB,IAAI,gCAAgC,EAAE,MAAM,SAAS,CAAC;AAC3F,cAAc,SAAS,CAAC"}
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -16,10 +20,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
20
 
17
21
  // src/runtimes/remote-thread-list/index.ts
18
22
  var remote_thread_list_exports = {};
23
+ __export(remote_thread_list_exports, {
24
+ unstable_useRemoteThreadListRuntime: () => import_useRemoteThreadListRuntime.useRemoteThreadListRuntime
25
+ });
19
26
  module.exports = __toCommonJS(remote_thread_list_exports);
27
+ var import_useRemoteThreadListRuntime = require("./useRemoteThreadListRuntime.js");
20
28
  __reExport(remote_thread_list_exports, require("./cloud/index.js"), module.exports);
21
29
  // Annotate the CommonJS export names for ESM import in node:
22
30
  0 && (module.exports = {
31
+ unstable_useRemoteThreadListRuntime,
23
32
  ...require("./cloud/index.js")
24
33
  });
25
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/remote-thread-list/index.ts"],"sourcesContent":["// export { useRemoteThreadListRuntime } from \"./useRemoteThreadListRuntime\";\nexport * from \"./cloud\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AACA,uCAAc,6BADd;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/remote-thread-list/index.ts"],"sourcesContent":["export { useRemoteThreadListRuntime as unstable_useRemoteThreadListRuntime } from \"./useRemoteThreadListRuntime\";\nexport type { RemoteThreadListAdapter as unstable_RemoteThreadListAdapter } from \"./types\";\nexport * from \"./cloud\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAAkF;AAElF,uCAAc,6BAFd;","names":[]}
@@ -1,3 +1,7 @@
1
1
  // src/runtimes/remote-thread-list/index.ts
2
+ import { useRemoteThreadListRuntime } from "./useRemoteThreadListRuntime.mjs";
2
3
  export * from "./cloud/index.mjs";
4
+ export {
5
+ useRemoteThreadListRuntime as unstable_useRemoteThreadListRuntime
6
+ };
3
7
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/remote-thread-list/index.ts"],"sourcesContent":["// export { useRemoteThreadListRuntime } from \"./useRemoteThreadListRuntime\";\nexport * from \"./cloud\";\n"],"mappings":";AACA,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/remote-thread-list/index.ts"],"sourcesContent":["export { useRemoteThreadListRuntime as unstable_useRemoteThreadListRuntime } from \"./useRemoteThreadListRuntime\";\nexport type { RemoteThreadListAdapter as unstable_RemoteThreadListAdapter } from \"./types\";\nexport * from \"./cloud\";\n"],"mappings":";AAAA,SAAuC,kCAA2C;AAElF,cAAc;","names":[]}
@@ -15,13 +15,12 @@ export type RemoteThreadMetadata = {
15
15
  export type RemoteThreadListResponse = {
16
16
  threads: RemoteThreadMetadata[];
17
17
  };
18
- export type RemoteThreadListHook = () => AssistantRuntime;
19
18
  export type RemoteThreadListSubscriber = {
20
19
  onInitialize: (threadId: string, begin: () => Promise<RemoteThreadInitializeResponse>) => void;
21
20
  onGenerateTitle: (threadId: string, begin: () => Promise<AssistantStream>) => void;
22
21
  };
23
22
  export type RemoteThreadListAdapter = {
24
- runtimeHook: RemoteThreadListHook;
23
+ runtimeHook: () => AssistantRuntime;
25
24
  list(): Promise<RemoteThreadListResponse>;
26
25
  rename(remoteId: string, newTitle: string): Promise<void>;
27
26
  archive(remoteId: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtimes/remote-thread-list/types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,oBA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CAAC;IAC1D,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC,SAAS,CAAC,UAAU,EAAE,0BAA0B,GAAG,WAAW,CAAC;IAE/D,iBAAiB,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CACtD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/remote-thread-list/types.tsx"],"sourcesContent":["import { ComponentType, PropsWithChildren } from \"react\";\nimport { AssistantRuntime } from \"../../api\";\nimport { Unsubscribe } from \"../../types\";\nimport { AssistantStream } from \"assistant-stream\";\n\nexport type RemoteThreadInitializeResponse = {\n remoteId: string;\n externalId: string | undefined;\n};\n\nexport type RemoteThreadMetadata = {\n readonly status: \"regular\" | \"archived\";\n readonly remoteId: string;\n readonly externalId?: string | undefined;\n readonly title?: string | undefined;\n};\n\nexport type RemoteThreadListResponse = {\n threads: RemoteThreadMetadata[];\n};\n\nexport type RemoteThreadListHook = () => AssistantRuntime;\n\nexport type RemoteThreadListSubscriber = {\n onInitialize: (\n threadId: string,\n begin: () => Promise<RemoteThreadInitializeResponse>,\n ) => void;\n onGenerateTitle: (\n threadId: string,\n begin: () => Promise<AssistantStream>,\n ) => void;\n};\n\nexport type RemoteThreadListAdapter = {\n runtimeHook: RemoteThreadListHook;\n\n list(): Promise<RemoteThreadListResponse>;\n\n rename(remoteId: string, newTitle: string): Promise<void>;\n archive(remoteId: string): Promise<void>;\n unarchive(remoteId: string): Promise<void>;\n delete(remoteId: string): Promise<void>;\n\n subscribe(subscriber: RemoteThreadListSubscriber): Unsubscribe;\n\n unstable_Provider?: ComponentType<PropsWithChildren>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/remote-thread-list/types.tsx"],"sourcesContent":["import { ComponentType, PropsWithChildren } from \"react\";\nimport { AssistantRuntime } from \"../../api\";\nimport { Unsubscribe } from \"../../types\";\nimport { AssistantStream } from \"assistant-stream\";\n\nexport type RemoteThreadInitializeResponse = {\n remoteId: string;\n externalId: string | undefined;\n};\n\nexport type RemoteThreadMetadata = {\n readonly status: \"regular\" | \"archived\";\n readonly remoteId: string;\n readonly externalId?: string | undefined;\n readonly title?: string | undefined;\n};\n\nexport type RemoteThreadListResponse = {\n threads: RemoteThreadMetadata[];\n};\n\nexport type RemoteThreadListSubscriber = {\n onInitialize: (\n threadId: string,\n begin: () => Promise<RemoteThreadInitializeResponse>,\n ) => void;\n onGenerateTitle: (\n threadId: string,\n begin: () => Promise<AssistantStream>,\n ) => void;\n};\n\nexport type RemoteThreadListAdapter = {\n runtimeHook: () => AssistantRuntime;\n\n list(): Promise<RemoteThreadListResponse>;\n\n rename(remoteId: string, newTitle: string): Promise<void>;\n archive(remoteId: string): Promise<void>;\n unarchive(remoteId: string): Promise<void>;\n delete(remoteId: string): Promise<void>;\n\n subscribe(subscriber: RemoteThreadListSubscriber): Unsubscribe;\n\n unstable_Provider?: ComponentType<PropsWithChildren>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "conversational-ui",
30
30
  "conversational-ai"
31
31
  ],
32
- "version": "0.7.39",
32
+ "version": "0.7.40",
33
33
  "license": "MIT",
34
34
  "exports": {
35
35
  ".": {
@@ -117,9 +117,9 @@
117
117
  "tailwindcss": "^3.4.17",
118
118
  "tailwindcss-animate": "^1.0.7",
119
119
  "tsx": "^4.19.2",
120
- "@assistant-ui/tailwindcss-transformer": "0.1.0",
121
120
  "@assistant-ui/tsbuildutils": "^0.0.1",
122
- "@assistant-ui/tsconfig": "0.0.0"
121
+ "@assistant-ui/tsconfig": "0.0.0",
122
+ "@assistant-ui/tailwindcss-transformer": "0.1.0"
123
123
  },
124
124
  "publishConfig": {
125
125
  "access": "public",
@@ -16,7 +16,9 @@ import { ThreadListItemRuntimeProvider } from "../../context/providers/ThreadLis
16
16
  import { useThreadListItem } from "../../context/react/ThreadListItemContext";
17
17
  import { ThreadRuntimeCore, ThreadRuntimeImpl } from "../../internal";
18
18
  import { BaseSubscribable } from "./BaseSubscribable";
19
- import { RemoteThreadListHook } from "./types";
19
+ import { AssistantRuntime } from "../../api";
20
+
21
+ type RemoteThreadListHook = () => AssistantRuntime;
20
22
 
21
23
  type RemoteThreadListHookInstance = {
22
24
  runtime?: ThreadRuntimeCore;
@@ -1,2 +1,3 @@
1
- // export { useRemoteThreadListRuntime } from "./useRemoteThreadListRuntime";
1
+ export { useRemoteThreadListRuntime as unstable_useRemoteThreadListRuntime } from "./useRemoteThreadListRuntime";
2
+ export type { RemoteThreadListAdapter as unstable_RemoteThreadListAdapter } from "./types";
2
3
  export * from "./cloud";
@@ -19,8 +19,6 @@ export type RemoteThreadListResponse = {
19
19
  threads: RemoteThreadMetadata[];
20
20
  };
21
21
 
22
- export type RemoteThreadListHook = () => AssistantRuntime;
23
-
24
22
  export type RemoteThreadListSubscriber = {
25
23
  onInitialize: (
26
24
  threadId: string,
@@ -33,7 +31,7 @@ export type RemoteThreadListSubscriber = {
33
31
  };
34
32
 
35
33
  export type RemoteThreadListAdapter = {
36
- runtimeHook: RemoteThreadListHook;
34
+ runtimeHook: () => AssistantRuntime;
37
35
 
38
36
  list(): Promise<RemoteThreadListResponse>;
39
37