@assistant-ui/react 0.7.26 → 0.7.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
  2. package/dist/context/providers/AssistantRuntimeProvider.js +1 -2
  3. package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
  4. package/dist/context/providers/AssistantRuntimeProvider.mjs +2 -3
  5. package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
  6. package/dist/context/react/ThreadListItemContext.d.ts +0 -5
  7. package/dist/context/react/ThreadListItemContext.d.ts.map +1 -1
  8. package/dist/context/react/ThreadListItemContext.js +6 -5
  9. package/dist/context/react/ThreadListItemContext.js.map +1 -1
  10. package/dist/context/react/ThreadListItemContext.mjs +5 -3
  11. package/dist/context/react/ThreadListItemContext.mjs.map +1 -1
  12. package/dist/context/react/index.d.ts +1 -0
  13. package/dist/context/react/index.d.ts.map +1 -1
  14. package/dist/context/react/index.js +5 -0
  15. package/dist/context/react/index.js.map +1 -1
  16. package/dist/context/react/index.mjs +6 -0
  17. package/dist/context/react/index.mjs.map +1 -1
  18. package/dist/runtimes/core/AssistantRuntimeCore.d.ts +9 -2
  19. package/dist/runtimes/core/AssistantRuntimeCore.d.ts.map +1 -1
  20. package/dist/runtimes/core/AssistantRuntimeCore.js.map +1 -1
  21. package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts +2 -0
  22. package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts.map +1 -1
  23. package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
  24. package/dist/runtimes/core/BaseAssistantRuntimeCore.mjs.map +1 -1
  25. package/dist/runtimes/core/ThreadRuntimeCore.d.ts +4 -0
  26. package/dist/runtimes/core/ThreadRuntimeCore.d.ts.map +1 -1
  27. package/dist/runtimes/core/ThreadRuntimeCore.js.map +1 -1
  28. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +6 -0
  29. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
  30. package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
  31. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +5 -2
  32. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
  33. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +21 -6
  34. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
  35. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +21 -6
  36. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
  37. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +1 -1
  38. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
  39. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +2 -2
  40. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
  41. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +2 -2
  42. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
  43. package/dist/runtimes/external-store/useExternalStoreRuntime.js +1 -1
  44. package/dist/runtimes/external-store/useExternalStoreRuntime.js.map +1 -1
  45. package/dist/runtimes/external-store/useExternalStoreRuntime.mjs +1 -1
  46. package/dist/runtimes/external-store/useExternalStoreRuntime.mjs.map +1 -1
  47. package/dist/runtimes/local/LocalRuntimeCore.d.ts +1 -0
  48. package/dist/runtimes/local/LocalRuntimeCore.d.ts.map +1 -1
  49. package/dist/runtimes/local/LocalRuntimeCore.js +1 -0
  50. package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
  51. package/dist/runtimes/local/LocalRuntimeCore.mjs +1 -0
  52. package/dist/runtimes/local/LocalRuntimeCore.mjs.map +1 -1
  53. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +1 -1
  54. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  55. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +3 -6
  56. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  57. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +4 -7
  58. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs.map +1 -1
  59. package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
  60. package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js +1 -2
  61. package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js.map +1 -1
  62. package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs +1 -2
  63. package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs.map +1 -1
  64. package/dist/runtimes/remote-thread-list/types.d.ts +2 -2
  65. package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
  66. package/dist/runtimes/remote-thread-list/types.js.map +1 -1
  67. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +2 -2
  68. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
  69. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs +2 -2
  70. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs.map +1 -1
  71. package/dist/styles/index.css +8 -7
  72. package/dist/styles/index.css.map +1 -1
  73. package/dist/styles/tailwindcss/thread.css +7 -7
  74. package/dist/styles/tailwindcss/thread.css.json +7 -7
  75. package/dist/styles/themes/default.css +3 -0
  76. package/dist/styles/themes/default.css.json +2 -1
  77. package/dist/styles/themes/shadcn-extras.css +4 -0
  78. package/dist/styles/themes/shadcn-extras.css.json +5 -0
  79. package/dist/tailwindcss/index.d.ts.map +1 -1
  80. package/dist/tailwindcss/index.js +7 -0
  81. package/dist/tailwindcss/index.js.map +1 -1
  82. package/dist/tailwindcss/index.mjs +7 -0
  83. package/dist/tailwindcss/index.mjs.map +1 -1
  84. package/package.json +1 -1
  85. package/src/context/providers/AssistantRuntimeProvider.tsx +2 -6
  86. package/src/context/react/ThreadListItemContext.ts +4 -2
  87. package/src/context/react/index.ts +6 -0
  88. package/src/runtimes/core/AssistantRuntimeCore.tsx +9 -2
  89. package/src/runtimes/core/BaseAssistantRuntimeCore.tsx +4 -0
  90. package/src/runtimes/core/ThreadRuntimeCore.tsx +5 -0
  91. package/src/runtimes/external-store/ExternalStoreAdapter.tsx +8 -0
  92. package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +26 -6
  93. package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +2 -2
  94. package/src/runtimes/external-store/useExternalStoreRuntime.tsx +1 -1
  95. package/src/runtimes/local/LocalRuntimeCore.tsx +1 -0
  96. package/src/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +4 -10
  97. package/src/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.tsx +1 -2
  98. package/src/runtimes/remote-thread-list/types.tsx +2 -2
  99. package/src/runtimes/remote-thread-list/useRemoteThreadListRuntime.tsx +2 -2
  100. package/src/styles/tailwindcss/thread.css +7 -7
  101. package/src/styles/themes/default.css +3 -0
  102. package/src/styles/themes/shadcn-extras.css +4 -0
  103. package/src/tailwindcss/index.ts +7 -0
  104. package/dist/primitive-hooks/thread/useThread.d.ts +0 -1
  105. package/dist/primitive-hooks/thread/useThread.d.ts.map +0 -1
  106. package/dist/primitive-hooks/thread/useThread.js +0 -2
  107. package/dist/primitive-hooks/thread/useThread.js.map +0 -1
  108. package/dist/primitive-hooks/thread/useThread.mjs +0 -1
  109. package/dist/primitive-hooks/thread/useThread.mjs.map +0 -1
  110. package/src/primitive-hooks/thread/useThread.tsx +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAK9D,yBAAiB,wBAAwB,CAAC;IACxC,KAAY,KAAK,GAAG,iBAAiB,CAAC;QACpC;;WAEG;QACH,OAAO,EAAE,gBAAgB,CAAC;KAC3B,CAAC,CAAC;CACJ;AAuCD,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,wBAAwB,CAAC,KAAK,CA2B/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,sEAAqC,CAAC"}
1
+ {"version":3,"file":"AssistantRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAK9D,yBAAiB,wBAAwB,CAAC;IACxC,KAAY,KAAK,GAAG,iBAAiB,CAAC;QACpC;;WAEG;QACH,OAAO,EAAE,gBAAgB,CAAC;KAC3B,CAAC,CAAC;CACJ;AAmCD,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,wBAAwB,CAAC,KAAK,CA2B/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,sEAAqC,CAAC"}
@@ -51,9 +51,8 @@ var useThreadListStore = (runtime) => {
51
51
  }, [runtime, store]);
52
52
  return store;
53
53
  };
54
- var DEFAULT_RENDER_COMPONENT = ({ children }) => children;
55
54
  var getRenderComponent = (runtime) => {
56
- return runtime._core?.__internal_RenderComponent ?? DEFAULT_RENDER_COMPONENT;
55
+ return runtime._core?.Provider ?? import_react.Fragment;
57
56
  };
58
57
  var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
59
58
  const useAssistantRuntime = useAssistantRuntimeStore(runtime);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { memo, useEffect, useMemo, useState } from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst useThreadListStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime.threadList.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.threadList.getState(), true);\n updateState();\n return runtime.threadList.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst DEFAULT_RENDER_COMPONENT: FC<PropsWithChildren> = ({ children }) =>\n children;\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (\n (runtime as { _core?: AssistantRuntimeCore })._core\n ?.__internal_RenderComponent ?? DEFAULT_RENDER_COMPONENT\n );\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const useThreadList = useThreadListStore(runtime);\n const context = useMemo(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n useThreadList,\n };\n }, [useAssistantRuntime, useToolUIs, useThreadList]);\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n <RenderComponent>\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.threadList.mainItem}\n >\n {children}\n </ThreadRuntimeProvider>\n </RenderComponent>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAmD;AACnD,8BAAiC;AACjC,8BAA0C;AAC1C,mCAAsC;AAEtC,qBAAuB;AACvB,2BAA8B;AAoEtB;AAxDR,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,OAAO,CAAC;AAEpD,8BAAU,MAAM;AACd,4CAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,aAAO,sBAAQ,UAAM,mDAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,QAAQ,WAAW,SAAS,CAAC,CAAC;AAE1E,8BAAU,MAAM;AACd,UAAM,cAAc,UAClB,oCAAc,KAAK,EAAE,SAAS,QAAQ,WAAW,SAAS,GAAG,IAAI;AACnE,gBAAY;AACZ,WAAO,QAAQ,WAAW,UAAU,WAAW;AAAA,EACjD,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAAkD,CAAC,EAAE,SAAS,MAClE;AAEF,IAAM,qBAAqB,CAAC,YAA8B;AACxD,SACG,QAA6C,OAC1C,8BAA8B;AAEtC;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,gBAAgB,mBAAmB,OAAO;AAChD,QAAM,cAAU,sBAAQ,MAAM;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,qBAAqB,YAAY,aAAa,CAAC;AAEnD,QAAM,kBAAkB,mBAAmB,OAAO;AAElD,SACE,4CAAC,yCAAiB,UAAjB,EAA0B,OAAO,SAChC,sDAAC,mBACC;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,QAAQ;AAAA,MACjB,iBAAiB,QAAQ,WAAW;AAAA,MAEnC;AAAA;AAAA,EACH,GACF,GACF;AAEJ;AAEO,IAAM,+BAA2B,mBAAK,4BAA4B;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { Fragment, memo, useEffect, useMemo, useState } from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst useThreadListStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime.threadList.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.threadList.getState(), true);\n updateState();\n return runtime.threadList.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (\n (runtime as { _core?: AssistantRuntimeCore })._core?.Provider ?? Fragment\n );\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const useThreadList = useThreadListStore(runtime);\n const context = useMemo(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n useThreadList,\n };\n }, [useAssistantRuntime, useToolUIs, useThreadList]);\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n <RenderComponent>\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.threadList.mainItem}\n >\n {children}\n </ThreadRuntimeProvider>\n </RenderComponent>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA6D;AAC7D,8BAAiC;AACjC,8BAA0C;AAC1C,mCAAsC;AAEtC,qBAAuB;AACvB,2BAA8B;AAgEtB;AApDR,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,OAAO,CAAC;AAEpD,8BAAU,MAAM;AACd,4CAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,aAAO,sBAAQ,UAAM,mDAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,QAAQ,WAAW,SAAS,CAAC,CAAC;AAE1E,8BAAU,MAAM;AACd,UAAM,cAAc,UAClB,oCAAc,KAAK,EAAE,SAAS,QAAQ,WAAW,SAAS,GAAG,IAAI;AACnE,gBAAY;AACZ,WAAO,QAAQ,WAAW,UAAU,WAAW;AAAA,EACjD,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,SACG,QAA6C,OAAO,YAAY;AAErE;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,gBAAgB,mBAAmB,OAAO;AAChD,QAAM,cAAU,sBAAQ,MAAM;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,qBAAqB,YAAY,aAAa,CAAC;AAEnD,QAAM,kBAAkB,mBAAmB,OAAO;AAElD,SACE,4CAAC,yCAAiB,UAAjB,EAA0B,OAAO,SAChC,sDAAC,mBACC;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,QAAQ;AAAA,MACjB,iBAAiB,QAAQ,WAAW;AAAA,MAEnC;AAAA;AAAA,EACH,GACF,GACF;AAEJ;AAEO,IAAM,+BAA2B,mBAAK,4BAA4B;","names":[]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/context/providers/AssistantRuntimeProvider.tsx
4
- import { memo, useEffect, useMemo, useState } from "react";
4
+ import { Fragment, memo, useEffect, useMemo, useState } from "react";
5
5
  import { AssistantContext } from "../react/AssistantContext.mjs";
6
6
  import { makeAssistantToolUIsStore } from "../stores/AssistantToolUIs.mjs";
7
7
  import { ThreadRuntimeProvider } from "./ThreadRuntimeProvider.mjs";
@@ -27,9 +27,8 @@ var useThreadListStore = (runtime) => {
27
27
  }, [runtime, store]);
28
28
  return store;
29
29
  };
30
- var DEFAULT_RENDER_COMPONENT = ({ children }) => children;
31
30
  var getRenderComponent = (runtime) => {
32
- return runtime._core?.__internal_RenderComponent ?? DEFAULT_RENDER_COMPONENT;
31
+ return runtime._core?.Provider ?? Fragment;
33
32
  };
34
33
  var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
35
34
  const useAssistantRuntime = useAssistantRuntimeStore(runtime);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { memo, useEffect, useMemo, useState } from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst useThreadListStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime.threadList.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.threadList.getState(), true);\n updateState();\n return runtime.threadList.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst DEFAULT_RENDER_COMPONENT: FC<PropsWithChildren> = ({ children }) =>\n children;\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (\n (runtime as { _core?: AssistantRuntimeCore })._core\n ?.__internal_RenderComponent ?? DEFAULT_RENDER_COMPONENT\n );\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const useThreadList = useThreadListStore(runtime);\n const context = useMemo(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n useThreadList,\n };\n }, [useAssistantRuntime, useToolUIs, useThreadList]);\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n <RenderComponent>\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.threadList.mainItem}\n >\n {children}\n </ThreadRuntimeProvider>\n </RenderComponent>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;AAGA,SAAS,MAAM,WAAW,SAAS,gBAAgB;AACnD,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AAEtC,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAoEtB;AAxDR,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,SAAO,QAAQ,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,QAAQ,WAAW,SAAS,CAAC,CAAC;AAE1E,YAAU,MAAM;AACd,UAAM,cAAc,MAClB,cAAc,KAAK,EAAE,SAAS,QAAQ,WAAW,SAAS,GAAG,IAAI;AACnE,gBAAY;AACZ,WAAO,QAAQ,WAAW,UAAU,WAAW;AAAA,EACjD,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAAkD,CAAC,EAAE,SAAS,MAClE;AAEF,IAAM,qBAAqB,CAAC,YAA8B;AACxD,SACG,QAA6C,OAC1C,8BAA8B;AAEtC;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,gBAAgB,mBAAmB,OAAO;AAChD,QAAM,UAAU,QAAQ,MAAM;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,qBAAqB,YAAY,aAAa,CAAC;AAEnD,QAAM,kBAAkB,mBAAmB,OAAO;AAElD,SACE,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,SAChC,8BAAC,mBACC;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,QAAQ;AAAA,MACjB,iBAAiB,QAAQ,WAAW;AAAA,MAEnC;AAAA;AAAA,EACH,GACF,GACF;AAEJ;AAEO,IAAM,2BAA2B,KAAK,4BAA4B;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { Fragment, memo, useEffect, useMemo, useState } from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst useThreadListStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime.threadList.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.threadList.getState(), true);\n updateState();\n return runtime.threadList.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (\n (runtime as { _core?: AssistantRuntimeCore })._core?.Provider ?? Fragment\n );\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const useThreadList = useThreadListStore(runtime);\n const context = useMemo(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n useThreadList,\n };\n }, [useAssistantRuntime, useToolUIs, useThreadList]);\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n <RenderComponent>\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.threadList.mainItem}\n >\n {children}\n </ThreadRuntimeProvider>\n </RenderComponent>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;AAGA,SAAS,UAAU,MAAM,WAAW,SAAS,gB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AA,MACC,SAAS,QAAQ;AAAA,MACjB,iBAAiB,QAAQ,WAAW;AAAA,MAEnC;AAAA;AAAA,EACH,GACF,GACF;AAEJ;AAEO,IAAM,2BAA2B,KAAK,4BAA4B;","names":[]}
@@ -31,10 +31,5 @@ export declare const useThreadListItem: {
31
31
  optional: true;
32
32
  selector?: (state: ThreadListItemState) => TSelected;
33
33
  }): TSelected | null;
34
- }, useThreadListItemStore: {
35
- (): ReadonlyStore<ThreadListItemState>;
36
- (options: {
37
- optional: true;
38
- }): ReadonlyStore<ThreadListItemState> | null;
39
34
  };
40
35
  //# sourceMappingURL=ThreadListItemContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadListItemContext.d.ts","sourceRoot":"","sources":["../../../src/context/react/ThreadListItemContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,MAAM,0BAA0B,GAAG;IACvC,wBAAwB,EAAE,aAAa,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC9E,iBAAiB,EAAE,aAAa,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC;CACtE,CAAC;AAEF,eAAO,MAAM,qBAAqB,4DACsB,CAAC;AAEzD,eAAO,MAAM,wBAAwB;;;;;;;CAGpC,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE;IACjD,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CAC9B,GAAG,qBAAqB,CAAC;AAC1B,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE;IACjD,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC,GAAG,qBAAqB,GAAG,IAAI,CAAC;AASjC,eAAO,MAAQ,iBAAiB;;;;;;;;;;GAAE,sBAAsB;;;;;CACe,CAAC"}
1
+ {"version":3,"file":"ThreadListItemContext.d.ts","sourceRoot":"","sources":["../../../src/context/react/ThreadListItemContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,MAAM,0BAA0B,GAAG;IACvC,wBAAwB,EAAE,aAAa,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC9E,iBAAiB,EAAE,aAAa,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC;CACtE,CAAC;AAEF,eAAO,MAAM,qBAAqB,4DACsB,CAAC;AAEzD,eAAO,MAAM,wBAAwB;;;;;;;CAGpC,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE;IACjD,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CAC9B,GAAG,qBAAqB,CAAC;AAC1B,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE;IACjD,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC,GAAG,qBAAqB,GAAG,IAAI,CAAC;AASjC,eAAO,MAAQ,iBAAiB;;;;;;;;;;CAG/B,CAAC"}
@@ -24,8 +24,7 @@ __export(ThreadListItemContext_exports, {
24
24
  ThreadListItemContext: () => ThreadListItemContext,
25
25
  useThreadListItem: () => useThreadListItem,
26
26
  useThreadListItemContext: () => useThreadListItemContext,
27
- useThreadListItemRuntime: () => useThreadListItemRuntime,
28
- useThreadListItemStore: () => useThreadListItemStore
27
+ useThreadListItemRuntime: () => useThreadListItemRuntime
29
28
  });
30
29
  module.exports = __toCommonJS(ThreadListItemContext_exports);
31
30
  var import_react = require("react");
@@ -41,13 +40,15 @@ function useThreadListItemRuntime(options) {
41
40
  if (!context) return null;
42
41
  return context.useThreadListItemRuntime();
43
42
  }
44
- var { useThreadListItem, useThreadListItemStore } = (0, import_createContextStoreHook.createContextStoreHook)(useThreadListItemContext, "useThreadListItem");
43
+ var { useThreadListItem } = (0, import_createContextStoreHook.createContextStoreHook)(
44
+ useThreadListItemContext,
45
+ "useThreadListItem"
46
+ );
45
47
  // Annotate the CommonJS export names for ESM import in node:
46
48
  0 && (module.exports = {
47
49
  ThreadListItemContext,
48
50
  useThreadListItem,
49
51
  useThreadListItemContext,
50
- useThreadListItemRuntime,
51
- useThreadListItemStore
52
+ useThreadListItemRuntime
52
53
  });
53
54
  //# sourceMappingURL=ThreadListItemContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/ThreadListItemContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { ThreadListItemState } from \"../../api/ThreadListItemRuntime\";\n\nexport type ThreadListItemContextValue = {\n useThreadListItemRuntime: UseBoundStore<ReadonlyStore<ThreadListItemRuntime>>;\n useThreadListItem: UseBoundStore<ReadonlyStore<ThreadListItemState>>;\n};\n\nexport const ThreadListItemContext =\n createContext<ThreadListItemContextValue | null>(null);\n\nexport const useThreadListItemContext = createContextHook(\n ThreadListItemContext,\n \"a component passed to <ThreadListPrimitive.Items components={...}>\",\n);\n\nexport function useThreadListItemRuntime(options?: {\n optional?: false | undefined;\n}): ThreadListItemRuntime;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}): ThreadListItemRuntime | null;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useThreadListItemContext(options);\n if (!context) return null;\n return context.useThreadListItemRuntime();\n}\n\nexport const { useThreadListItem, useThreadListItemStore } =\n createContextStoreHook(useThreadListItemContext, \"useThreadListItem\");\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA8B;AAE9B,oCAAuC;AACvC,+BAAkC;AAU3B,IAAM,4BACX,4BAAiD,IAAI;AAEhD,IAAM,+BAA2B;AAAA,EACtC;AAAA,EACA;AACF;AAQO,SAAS,yBAAyB,SAEtC;AACD,QAAM,UAAU,yBAAyB,OAAO;AAChD,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,yBAAyB;AAC1C;AAEO,IAAM,EAAE,mBAAmB,uBAAuB,QACvD,sDAAuB,0BAA0B,mBAAmB;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/ThreadListItemContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { ThreadListItemState } from \"../../api/ThreadListItemRuntime\";\n\nexport type ThreadListItemContextValue = {\n useThreadListItemRuntime: UseBoundStore<ReadonlyStore<ThreadListItemRuntime>>;\n useThreadListItem: UseBoundStore<ReadonlyStore<ThreadListItemState>>;\n};\n\nexport const ThreadListItemContext =\n createContext<ThreadListItemContextValue | null>(null);\n\nexport const useThreadListItemContext = createContextHook(\n ThreadListItemContext,\n \"a component passed to <ThreadListPrimitive.Items components={...}>\",\n);\n\nexport function useThreadListItemRuntime(options?: {\n optional?: false | undefined;\n}): ThreadListItemRuntime;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}): ThreadListItemRuntime | null;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useThreadListItemContext(options);\n if (!context) return null;\n return context.useThreadListItemRuntime();\n}\n\nexport const { useThreadListItem } = createContextStoreHook(\n useThreadListItemContext,\n \"useThreadListItem\",\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA8B;AAE9B,oCAAuC;AACvC,+BAAkC;AAU3B,IAAM,4BACX,4BAAiD,IAAI;AAEhD,IAAM,+BAA2B;AAAA,EACtC;AAAA,EACA;AACF;AAQO,SAAS,yBAAyB,SAEtC;AACD,QAAM,UAAU,yBAAyB,OAAO;AAChD,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,yBAAyB;AAC1C;AAEO,IAAM,EAAE,kBAAkB,QAAI;AAAA,EACnC;AAAA,EACA;AACF;","names":[]}
@@ -14,12 +14,14 @@ function useThreadListItemRuntime(options) {
14
14
  if (!context) return null;
15
15
  return context.useThreadListItemRuntime();
16
16
  }
17
- var { useThreadListItem, useThreadListItemStore } = createContextStoreHook(useThreadListItemContext, "useThreadListItem");
17
+ var { useThreadListItem } = createContextStoreHook(
18
+ useThreadListItemContext,
19
+ "useThreadListItem"
20
+ );
18
21
  export {
19
22
  ThreadListItemContext,
20
23
  useThreadListItem,
21
24
  useThreadListItemContext,
22
- useThreadListItemRuntime,
23
- useThreadListItemStore
25
+ useThreadListItemRuntime
24
26
  };
25
27
  //# sourceMappingURL=ThreadListItemContext.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/ThreadListItemContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { ThreadListItemState } from \"../../api/ThreadListItemRuntime\";\n\nexport type ThreadListItemContextValue = {\n useThreadListItemRuntime: UseBoundStore<ReadonlyStore<ThreadListItemRuntime>>;\n useThreadListItem: UseBoundStore<ReadonlyStore<ThreadListItemState>>;\n};\n\nexport const ThreadListItemContext =\n createContext<ThreadListItemContextValue | null>(null);\n\nexport const useThreadListItemContext = createContextHook(\n ThreadListItemContext,\n \"a component passed to <ThreadListPrimitive.Items components={...}>\",\n);\n\nexport function useThreadListItemRuntime(options?: {\n optional?: false | undefined;\n}): ThreadListItemRuntime;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}): ThreadListItemRuntime | null;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useThreadListItemContext(options);\n if (!context) return null;\n return context.useThreadListItemRuntime();\n}\n\nexport const { useThreadListItem, useThreadListItemStore } =\n createContextStoreHook(useThreadListItemContext, \"useThreadListItem\");\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAE9B,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAU3B,IAAM,wBACX,cAAiD,IAAI;AAEhD,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AACF;AAQO,SAAS,yBAAyB,SAEtC;AACD,QAAM,UAAU,yBAAyB,OAAO;AAChD,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,yBAAyB;AAC1C;AAEO,IAAM,EAAE,mBAAmB,uBAAuB,IACvD,uBAAuB,0BAA0B,mBAAmB;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/ThreadListItemContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { ThreadListItemState } from \"../../api/ThreadListItemRuntime\";\n\nexport type ThreadListItemContextValue = {\n useThreadListItemRuntime: UseBoundStore<ReadonlyStore<ThreadListItemRuntime>>;\n useThreadListItem: UseBoundStore<ReadonlyStore<ThreadListItemState>>;\n};\n\nexport const ThreadListItemContext =\n createContext<ThreadListItemContextValue | null>(null);\n\nexport const useThreadListItemContext = createContextHook(\n ThreadListItemContext,\n \"a component passed to <ThreadListPrimitive.Items components={...}>\",\n);\n\nexport function useThreadListItemRuntime(options?: {\n optional?: false | undefined;\n}): ThreadListItemRuntime;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}): ThreadListItemRuntime | null;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useThreadListItemContext(options);\n if (!context) return null;\n return context.useThreadListItemRuntime();\n}\n\nexport const { useThreadListItem } = createContextStoreHook(\n useThreadListItemContext,\n \"useThreadListItem\",\n);\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAE9B,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAU3B,IAAM,wBACX,cAAiD,IAAI;AAEhD,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AACF;AAQO,SAAS,yBAAyB,SAEtC;AACD,QAAM,UAAU,yBAAyB,OAAO;AAChD,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,yBAAyB;AAC1C;AAEO,IAAM,EAAE,kBAAkB,IAAI;AAAA,EACnC;AAAA,EACA;AACF;","names":[]}
@@ -1,5 +1,6 @@
1
1
  export { useAssistantRuntime, useThreadList, useToolUIs, useToolUIsStore, } from "./AssistantContext";
2
2
  export { useThreadRuntime, useThread, useThreadComposer, useThreadModelConfig, useThreadViewport, useThreadViewportStore, } from "./ThreadContext";
3
+ export { useThreadListItemRuntime, useThreadListItem, } from "./ThreadListItemContext";
3
4
  export { useMessageRuntime, useMessage, useEditComposer, useMessageUtils, useMessageUtilsStore, } from "./MessageContext";
4
5
  export { useContentPartRuntime, useContentPart } from "./ContentPartContext";
5
6
  export { useComposerRuntime, useComposer } from "./ComposerContext";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EACL,aAAa,EACb,oBAAoB,GASrB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EACL,aAAa,EACb,oBAAoB,GASrB,MAAM,qBAAqB,CAAC"}
@@ -35,6 +35,8 @@ __export(react_exports, {
35
35
  useThread: () => import_ThreadContext.useThread,
36
36
  useThreadComposer: () => import_ThreadContext.useThreadComposer,
37
37
  useThreadList: () => import_AssistantContext.useThreadList,
38
+ useThreadListItem: () => import_ThreadListItemContext.useThreadListItem,
39
+ useThreadListItemRuntime: () => import_ThreadListItemContext.useThreadListItemRuntime,
38
40
  useThreadModelConfig: () => import_ThreadContext.useThreadModelConfig,
39
41
  useThreadRuntime: () => import_ThreadContext.useThreadRuntime,
40
42
  useThreadViewport: () => import_ThreadContext.useThreadViewport,
@@ -45,6 +47,7 @@ __export(react_exports, {
45
47
  module.exports = __toCommonJS(react_exports);
46
48
  var import_AssistantContext = require("./AssistantContext.js");
47
49
  var import_ThreadContext = require("./ThreadContext.js");
50
+ var import_ThreadListItemContext = require("./ThreadListItemContext.js");
48
51
  var import_MessageContext = require("./MessageContext.js");
49
52
  var import_ContentPartContext = require("./ContentPartContext.js");
50
53
  var import_ComposerContext = require("./ComposerContext.js");
@@ -66,6 +69,8 @@ var import_AttachmentContext = require("./AttachmentContext.js");
66
69
  useThread,
67
70
  useThreadComposer,
68
71
  useThreadList,
72
+ useThreadListItem,
73
+ useThreadListItemRuntime,
69
74
  useThreadModelConfig,
70
75
  useThreadRuntime,
71
76
  useThreadViewport,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["export {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelConfig,\n useThreadViewport,\n useThreadViewportStore,\n} from \"./ThreadContext\";\nexport {\n useMessageRuntime,\n useMessage,\n useEditComposer,\n useMessageUtils,\n useMessageUtilsStore,\n} from \"./MessageContext\";\nexport { useContentPartRuntime, useContentPart } from \"./ContentPartContext\";\nexport { useComposerRuntime, useComposer } from \"./ComposerContext\";\n\nexport {\n useAttachment,\n useAttachmentRuntime,\n\n // TODO decide if we want to export/drop these?\n // useEditComposerAttachment,\n // useEditComposerAttachmentRuntime,\n // useMessageAttachment,\n // useMessageAttachmentRuntime,\n // useThreadComposerAttachment,\n // useThreadComposerAttachmentRuntime,\n} from \"./AttachmentContext\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAKO;AAEP,2BAOO;AACP,4BAMO;AACP,gCAAsD;AACtD,6BAAgD;AAEhD,+BAWO;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["export {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelConfig,\n useThreadViewport,\n useThreadViewportStore,\n} from \"./ThreadContext\";\n\nexport {\n useThreadListItemRuntime,\n useThreadListItem,\n} from \"./ThreadListItemContext\";\n\nexport {\n useMessageRuntime,\n useMessage,\n useEditComposer,\n useMessageUtils,\n useMessageUtilsStore,\n} from \"./MessageContext\";\nexport { useContentPartRuntime, useContentPart } from \"./ContentPartContext\";\nexport { useComposerRuntime, useComposer } from \"./ComposerContext\";\n\nexport {\n useAttachment,\n useAttachmentRuntime,\n\n // TODO decide if we want to export/drop these?\n // useEditComposerAttachment,\n // useEditComposerAttachmentRuntime,\n // useMessageAttachment,\n // useMessageAttachmentRuntime,\n // useThreadComposerAttachment,\n // useThreadComposerAttachmentRuntime,\n} from \"./AttachmentContext\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAKO;AAEP,2BAOO;AAEP,mCAGO;AAEP,4BAMO;AACP,gCAAsD;AACtD,6BAAgD;AAEhD,+BAWO;","names":[]}
@@ -13,6 +13,10 @@ import {
13
13
  useThreadViewport,
14
14
  useThreadViewportStore
15
15
  } from "./ThreadContext.mjs";
16
+ import {
17
+ useThreadListItemRuntime,
18
+ useThreadListItem
19
+ } from "./ThreadListItemContext.mjs";
16
20
  import {
17
21
  useMessageRuntime,
18
22
  useMessage,
@@ -42,6 +46,8 @@ export {
42
46
  useThread,
43
47
  useThreadComposer,
44
48
  useThreadList,
49
+ useThreadListItem,
50
+ useThreadListItemRuntime,
45
51
  useThreadModelConfig,
46
52
  useThreadRuntime,
47
53
  useThreadViewport,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["export {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelConfig,\n useThreadViewport,\n useThreadViewportStore,\n} from \"./ThreadContext\";\nexport {\n useMessageRuntime,\n useMessage,\n useEditComposer,\n useMessageUtils,\n useMessageUtilsStore,\n} from \"./MessageContext\";\nexport { useContentPartRuntime, useContentPart } from \"./ContentPartContext\";\nexport { useComposerRuntime, useComposer } from \"./ComposerContext\";\n\nexport {\n useAttachment,\n useAttachmentRuntime,\n\n // TODO decide if we want to export/drop these?\n // useEditComposerAttachment,\n // useEditComposerAttachmentRuntime,\n // useMessageAttachment,\n // useMessageAttachmentRuntime,\n // useThreadComposerAttachment,\n // useThreadComposerAttachmentRuntime,\n} from \"./AttachmentContext\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB,sBAAsB;AACtD,SAAS,oBAAoB,mBAAmB;AAEhD;AAAA,EACE;AAAA,EACA;AAAA,OASK;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["export {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelConfig,\n useThreadViewport,\n useThreadViewportStore,\n} from \"./ThreadContext\";\n\nexport {\n useThreadListItemRuntime,\n useThreadListItem,\n} from \"./ThreadListItemContext\";\n\nexport {\n useMessageRuntime,\n useMessage,\n useEditComposer,\n useMessageUtils,\n useMessageUtilsStore,\n} from \"./MessageContext\";\nexport { useContentPartRuntime, useContentPart } from \"./ContentPartContext\";\nexport { useComposerRuntime, useComposer } from \"./ComposerContext\";\n\nexport {\n useAttachment,\n useAttachmentRuntime,\n\n // TODO decide if we want to export/drop these?\n // useEditComposerAttachment,\n // useEditComposerAttachmentRuntime,\n // useMessageAttachment,\n // useMessageAttachmentRuntime,\n // useThreadComposerAttachment,\n // useThreadComposerAttachmentRuntime,\n} from \"./AttachmentContext\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB,sBAAsB;AACtD,SAAS,oBAAoB,mBAAmB;AAEhD;AAAA,EACE;AAAA,EACA;AAAA,OASK;","names":[]}
@@ -1,10 +1,17 @@
1
- import { PropsWithChildren } from "react";
1
+ import { ComponentType, PropsWithChildren } from "react";
2
2
  import type { ModelConfigProvider } from "../../types/ModelConfigTypes";
3
3
  import type { Unsubscribe } from "../../types/Unsubscribe";
4
4
  import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
5
5
  export type AssistantRuntimeCore = {
6
6
  readonly threadList: ThreadListRuntimeCore;
7
7
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
8
- __internal_RenderComponent?: React.FC<PropsWithChildren>;
8
+ /**
9
+ * A Provider component that wraps the app via `AssistantRuntimeProvider`.
10
+ *
11
+ * Note: This field is expected to never change.
12
+ * Refer to the source implementation of `ExternalStoreRuntimeCore`
13
+ * for an example of updating the provider via a zustand store.
14
+ */
15
+ readonly Provider: ComponentType<PropsWithChildren> | undefined;
9
16
  };
10
17
  //# sourceMappingURL=AssistantRuntimeCore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/AssistantRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAE3C,2BAA2B,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,WAAW,CAAC;IAE5E,0BAA0B,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;CAC1D,CAAC"}
1
+ {"version":3,"file":"AssistantRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/AssistantRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAE3C,2BAA2B,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,WAAW,CAAC;IAE5E;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC;CACjE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/core/AssistantRuntimeCore.tsx"],"sourcesContent":["import { PropsWithChildren } from \"react\";\nimport type { ModelConfigProvider } from \"../../types/ModelConfigTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport { ThreadListRuntimeCore } from \"./ThreadListRuntimeCore\";\n\nexport type AssistantRuntimeCore = {\n readonly threadList: ThreadListRuntimeCore;\n\n registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;\n\n __internal_RenderComponent?: React.FC<PropsWithChildren>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/core/AssistantRuntimeCore.tsx"],"sourcesContent":["import { ComponentType, PropsWithChildren } from \"react\";\nimport type { ModelConfigProvider } from \"../../types/ModelConfigTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport { ThreadListRuntimeCore } from \"./ThreadListRuntimeCore\";\n\nexport type AssistantRuntimeCore = {\n readonly threadList: ThreadListRuntimeCore;\n\n registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;\n\n /**\n * A Provider component that wraps the app via `AssistantRuntimeProvider`.\n *\n * Note: This field is expected to never change.\n * Refer to the source implementation of `ExternalStoreRuntimeCore`\n * for an example of updating the provider via a zustand store.\n */\n readonly Provider: ComponentType<PropsWithChildren> | undefined;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -3,9 +3,11 @@ import type { Unsubscribe } from "../../types/Unsubscribe";
3
3
  import type { AssistantRuntimeCore } from "./AssistantRuntimeCore";
4
4
  import { ProxyConfigProvider } from "../../utils/ProxyConfigProvider";
5
5
  import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
6
+ import { ComponentType } from "react";
6
7
  export declare abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {
7
8
  protected readonly _proxyConfigProvider: ProxyConfigProvider;
8
9
  abstract get threadList(): ThreadListRuntimeCore;
10
+ abstract get Provider(): ComponentType<React.PropsWithChildren> | undefined;
9
11
  constructor();
10
12
  registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;
11
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAssistantRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/BaseAssistantRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,8BAAsB,wBAAyB,YAAW,oBAAoB;IAC5E,SAAS,CAAC,QAAQ,CAAC,oBAAoB,sBAA6B;IACpE,aAAoB,UAAU,IAAI,qBAAqB,CAAC;;IAIjD,2BAA2B,CAChC,QAAQ,EAAE,mBAAmB,GAC5B,WAAW;CAGf"}
1
+ {"version":3,"file":"BaseAssistantRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/BaseAssistantRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,8BAAsB,wBAAyB,YAAW,oBAAoB;IAC5E,SAAS,CAAC,QAAQ,CAAC,oBAAoB,sBAA6B;IACpE,aAAoB,UAAU,IAAI,qBAAqB,CAAC;IACxD,aAAoB,QAAQ,IACxB,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,GACtC,SAAS,CAAC;;IAIP,2BAA2B,CAChC,QAAQ,EAAE,mBAAmB,GAC5B,WAAW;CAGf"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/core/BaseAssistantRuntimeCore.tsx"],"sourcesContent":["import { type ModelConfigProvider } from \"../../types/ModelConfigTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport type { AssistantRuntimeCore } from \"./AssistantRuntimeCore\";\nimport { ProxyConfigProvider } from \"../../utils/ProxyConfigProvider\";\nimport { ThreadListRuntimeCore } from \"./ThreadListRuntimeCore\";\n\nexport abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {\n protected readonly _proxyConfigProvider = new ProxyConfigProvider();\n public abstract get threadList(): ThreadListRuntimeCore;\n\n constructor() {}\n\n public registerModelConfigProvider(\n provider: ModelConfigProvider,\n ): Unsubscribe {\n return this._proxyConfigProvider.registerModelConfigProvider(provider);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAAoC;AAG7B,IAAe,2BAAf,MAAwE;AAAA,EAC1D,uBAAuB,IAAI,+CAAoB;AAAA,EAGlE,cAAc;AAAA,EAAC;AAAA,EAER,4BACL,UACa;AACb,WAAO,KAAK,qBAAqB,4BAA4B,QAAQ;AAAA,EACvE;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/core/BaseAssistantRuntimeCore.tsx"],"sourcesContent":["import { type ModelConfigProvider } from \"../../types/ModelConfigTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport type { AssistantRuntimeCore } from \"./AssistantRuntimeCore\";\nimport { ProxyConfigProvider } from \"../../utils/ProxyConfigProvider\";\nimport { ThreadListRuntimeCore } from \"./ThreadListRuntimeCore\";\nimport { ComponentType } from \"react\";\n\nexport abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {\n protected readonly _proxyConfigProvider = new ProxyConfigProvider();\n public abstract get threadList(): ThreadListRuntimeCore;\n public abstract get Provider():\n | ComponentType<React.PropsWithChildren>\n | undefined;\n\n constructor() {}\n\n public registerModelConfigProvider(\n provider: ModelConfigProvider,\n ): Unsubscribe {\n return this._proxyConfigProvider.registerModelConfigProvider(provider);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAAoC;AAI7B,IAAe,2BAAf,MAAwE;AAAA,EAC1D,uBAAuB,IAAI,+CAAoB;AAAA,EAMlE,cAAc;AAAA,EAAC;AAAA,EAER,4BACL,UACa;AACb,WAAO,KAAK,qBAAqB,4BAA4B,QAAQ;AAAA,EACvE;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/core/BaseAssistantRuntimeCore.tsx"],"sourcesContent":["import { type ModelConfigProvider } from \"../../types/ModelConfigTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport type { AssistantRuntimeCore } from \"./AssistantRuntimeCore\";\nimport { ProxyConfigProvider } from \"../../utils/ProxyConfigProvider\";\nimport { ThreadListRuntimeCore } from \"./ThreadListRuntimeCore\";\n\nexport abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {\n protected readonly _proxyConfigProvider = new ProxyConfigProvider();\n public abstract get threadList(): ThreadListRuntimeCore;\n\n constructor() {}\n\n public registerModelConfigProvider(\n provider: ModelConfigProvider,\n ): Unsubscribe {\n return this._proxyConfigProvider.registerModelConfigProvider(provider);\n }\n}\n"],"mappings":";AAGA,SAAS,2BAA2B;AAG7B,IAAe,2BAAf,MAAwE;AAAA,EAC1D,uBAAuB,IAAI,oBAAoB;AAAA,EAGlE,cAAc;AAAA,EAAC;AAAA,EAER,4BACL,UACa;AACb,WAAO,KAAK,qBAAqB,4BAA4B,QAAQ;AAAA,EACvE;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/core/BaseAssistantRuntimeCore.tsx"],"sourcesContent":["import { type ModelConfigProvider } from \"../../types/ModelConfigTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport type { AssistantRuntimeCore } from \"./AssistantRuntimeCore\";\nimport { ProxyConfigProvider } from \"../../utils/ProxyConfigProvider\";\nimport { ThreadListRuntimeCore } from \"./ThreadListRuntimeCore\";\nimport { ComponentType } from \"react\";\n\nexport abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {\n protected readonly _proxyConfigProvider = new ProxyConfigProvider();\n public abstract get threadList(): ThreadListRuntimeCore;\n public abstract get Provider():\n | ComponentType<React.PropsWithChildren>\n | undefined;\n\n constructor() {}\n\n public registerModelConfigProvider(\n provider: ModelConfigProvider,\n ): Unsubscribe {\n return this._proxyConfigProvider.registerModelConfigProvider(provider);\n }\n}\n"],"mappings":";AAGA,SAAS,2BAA2B;AAI7B,IAAe,2BAAf,MAAwE;AAAA,EAC1D,uBAAuB,IAAI,oBAAoB;AAAA,EAMlE,cAAc;AAAA,EAAC;AAAA,EAER,4BACL,UACa;AACb,WAAO,KAAK,qBAAqB,4BAA4B,QAAQ;AAAA,EACvE;AACF;","names":[]}
@@ -63,6 +63,10 @@ export type ThreadRuntimeCore = Readonly<{
63
63
  isDisabled: boolean;
64
64
  messages: readonly ThreadMessage[];
65
65
  suggestions: readonly ThreadSuggestion[];
66
+ /**
67
+ * @deprecated This field is deprecated and will be removed in 0.8.0.
68
+ * Please migrate to using `AssistantRuntimeCore.Provider` instead.
69
+ */
66
70
  extras: unknown;
67
71
  subscribe: (callback: () => void) => Unsubscribe;
68
72
  import(repository: ExportedMessageRepository): void;
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/ThreadRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B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SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAEhC,YAAY,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IACnC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAEzC;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,WAAW,CAAC;IAEjD,MAAM,CAAC,UAAU,EAAE,yBAAyB,GAAG,IAAI,CAAC;IACpD,MAAM,IAAI,yBAAyB,CAAC;IAEpC,WAAW,CAAC,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;CAC/E,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/core/ThreadRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, ModelConfig, ThreadMessage } from \"../../types\";\nimport { RunConfig } from \"../../types/AssistantTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { ExportedMessageRepository } from \"../utils/MessageRepository\";\nimport {\n ComposerRuntimeCore,\n ThreadComposerRuntimeCore,\n} from \"./ComposerRuntimeCore\";\n\nexport type RuntimeCapabilities = {\n readonly switchToBranch: boolean;\n readonly edit: boolean;\n readonly reload: boolean;\n readonly cancel: boolean;\n readonly unstable_copy: boolean;\n readonly speech: boolean;\n readonly attachments: boolean;\n readonly feedback: boolean;\n};\n\nexport type AddToolResultOptions = {\n messageId: string;\n toolName: string;\n toolCallId: string;\n result: any;\n};\n\nexport type SubmitFeedbackOptions = {\n messageId: string;\n type: \"negative\" | \"positive\";\n};\n\nexport type ThreadSuggestion = {\n prompt: string;\n};\n\nexport type SpeechState = {\n readonly messageId: string;\n readonly status: SpeechSynthesisAdapter.Status;\n};\n\nexport type SubmittedFeedback = {\n readonly type: \"negative\" | \"positive\";\n};\n\nexport type ThreadRuntimeEventType =\n | \"run-start\"\n | \"initialize\"\n | \"model-config-update\";\n\nexport type StartRunConfig = {\n parentId: string | null;\n runConfig?: RunConfig | undefined;\n};\n\nexport type ThreadRuntimeCore = Readonly<{\n getMessageById: (messageId: string) =>\n | {\n parentId: string | null;\n message: ThreadMessage;\n }\n | undefined;\n\n getBranches: (messageId: string) => readonly string[];\n switchToBranch: (branchId: string) => void;\n\n append: (message: AppendMessage) => void;\n startRun: (config: StartRunConfig) => void;\n cancelRun: () => void;\n\n addToolResult: (options: AddToolResultOptions) => void;\n\n speak: (messageId: string) => void;\n stopSpeaking: () => void;\n\n getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;\n submitFeedback: (feedback: SubmitFeedbackOptions) => void;\n\n getModelConfig: () => ModelConfig;\n\n composer: ThreadComposerRuntimeCore;\n getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;\n beginEdit: (messageId: string) => void;\n\n speech: SpeechState | undefined;\n\n capabilities: Readonly<RuntimeCapabilities>;\n isDisabled: boolean;\n messages: readonly ThreadMessage[];\n suggestions: readonly ThreadSuggestion[];\n extras: unknown;\n\n subscribe: (callback: () => void) => Unsubscribe;\n\n import(repository: ExportedMessageRepository): void;\n export(): ExportedMessageRepository;\n\n unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;\n}>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/core/ThreadRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, ModelConfig, ThreadMessage } from \"../../types\";\nimport { RunConfig } from \"../../types/AssistantTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { ExportedMessageRepository } from \"../utils/MessageRepository\";\nimport {\n ComposerRuntimeCore,\n ThreadComposerRuntimeCore,\n} from \"./ComposerRuntimeCore\";\n\nexport type RuntimeCapabilities = {\n readonly switchToBranch: boolean;\n readonly edit: boolean;\n readonly reload: boolean;\n readonly cancel: boolean;\n readonly unstable_copy: boolean;\n readonly speech: boolean;\n readonly attachments: boolean;\n readonly feedback: boolean;\n};\n\nexport type AddToolResultOptions = {\n messageId: string;\n toolName: string;\n toolCallId: string;\n result: any;\n};\n\nexport type SubmitFeedbackOptions = {\n messageId: string;\n type: \"negative\" | \"positive\";\n};\n\nexport type ThreadSuggestion = {\n prompt: string;\n};\n\nexport type SpeechState = {\n readonly messageId: string;\n readonly status: SpeechSynthesisAdapter.Status;\n};\n\nexport type SubmittedFeedback = {\n readonly type: \"negative\" | \"positive\";\n};\n\nexport type ThreadRuntimeEventType =\n | \"run-start\"\n | \"initialize\"\n | \"model-config-update\";\n\nexport type StartRunConfig = {\n parentId: string | null;\n runConfig?: RunConfig | undefined;\n};\n\nexport type ThreadRuntimeCore = Readonly<{\n getMessageById: (messageId: string) =>\n | {\n parentId: string | null;\n message: ThreadMessage;\n }\n | undefined;\n\n getBranches: (messageId: string) => readonly string[];\n switchToBranch: (branchId: string) => void;\n\n append: (message: AppendMessage) => void;\n startRun: (config: StartRunConfig) => void;\n cancelRun: () => void;\n\n addToolResult: (options: AddToolResultOptions) => void;\n\n speak: (messageId: string) => void;\n stopSpeaking: () => void;\n\n getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;\n submitFeedback: (feedback: SubmitFeedbackOptions) => void;\n\n getModelConfig: () => ModelConfig;\n\n composer: ThreadComposerRuntimeCore;\n getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;\n beginEdit: (messageId: string) => void;\n\n speech: SpeechState | undefined;\n\n capabilities: Readonly<RuntimeCapabilities>;\n isDisabled: boolean;\n messages: readonly ThreadMessage[];\n suggestions: readonly ThreadSuggestion[];\n\n /**\n * @deprecated This field is deprecated and will be removed in 0.8.0.\n * Please migrate to using `AssistantRuntimeCore.Provider` instead.\n */\n extras: unknown;\n\n subscribe: (callback: () => void) => Unsubscribe;\n\n import(repository: ExportedMessageRepository): void;\n export(): ExportedMessageRepository;\n\n unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;\n}>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,3 +1,4 @@
1
+ import { PropsWithChildren } from "react";
1
2
  import { AppendMessage, ThreadMessage } from "../../types";
2
3
  import { AttachmentAdapter } from "../attachment";
3
4
  import { AddToolResultOptions, StartRunConfig, ThreadSuggestion } from "../core/ThreadRuntimeCore";
@@ -38,6 +39,10 @@ type ExternalStoreAdapterBase<T> = {
38
39
  isRunning?: boolean | undefined;
39
40
  messages: T[];
40
41
  suggestions?: readonly ThreadSuggestion[] | undefined;
42
+ /**
43
+ * @deprecated This field is deprecated and will be removed in 0.8.0.
44
+ * Please migrate to `Provider` and a custom react context provider component instead.
45
+ */
41
46
  extras?: unknown;
42
47
  setMessages?: ((messages: T[]) => void) | undefined;
43
48
  onNew: (message: AppendMessage) => Promise<void>;
@@ -58,6 +63,7 @@ type ExternalStoreAdapterBase<T> = {
58
63
  unstable_capabilities?: {
59
64
  copy?: boolean | undefined;
60
65
  } | undefined;
66
+ unstable_Provider?: React.ComponentType<PropsWithChildren> | undefined;
61
67
  };
62
68
  export type ExternalStoreAdapter<T = ThreadMessage> = ExternalStoreAdapterBase<T> & (T extends ThreadMessage ? object : ExternalStoreMessageConverterAdapter<T>);
63
69
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalStoreAdapter.d.ts","sourceRoot":"","sources":["../../../src/runtimes/external-store/ExternalStoreAdapter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,oB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AAC,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GACzD,SAAS,CAAC;IACd,cAAc,CAAC,EAAE,6BAA6B,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,EACL;QACE,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;QAC5C,MAAM,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;QAC5C,QAAQ,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;QACvC;;WAEG;QACH,UAAU,CAAC,EAAE,8BAA8B,GAAG,SAAS,CAAC;KACzD,GACD,SAAS,CAAC;IACd,qBAAqB,CAAC,EAClB;QACE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC5B,GACD,SAAS,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,aAAa,IAChD,wBAAwB,CAAC,CAAC,CAAC,GACzB,CAAC,CAAC,SAAS,aAAa,GACpB,MAAM,GACN,oCAAoC,CAAC,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"ExternalStoreAdapter.d.ts","sourceRoot":"","sources":["../../../src/runtimes/external-store/ExternalStoreAdapter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,uBAAuB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,SAAS,CAAC;QAC5C,MAAM,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;QAC5C,QAAQ,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;QACvC;;WAEG;QACH,UAAU,CAAC,EAAE,8BAA8B,GAAG,SAAS,CAAC;KACzD,GACD,SAAS,CAAC;IACd,qBAAqB,CAAC,EAClB;QACE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC5B,GACD,SAAS,CAAC;IAEd,iBAAiB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC;CACxE,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,aAAa,IAChD,wBAAwB,CAAC,CAAC,CAAC,GACzB,CAAC,CAAC,SAAS,aAAa,GACpB,MAAM,GACN,oCAAoC,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreAdapter.tsx"],"sourcesContent":["import { AppendMessage, ThreadMessage } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport {\n AddToolResultOptions,\n StartRunConfig,\n ThreadSuggestion,\n} from \"../core/ThreadRuntimeCore\";\nimport { FeedbackAdapter } from \"../feedback/FeedbackAdapter\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { ThreadMessageLike } from \"./ThreadMessageLike\";\n\nexport type ExternalStoreThreadData<TState extends \"regular\" | \"archived\"> = {\n status: TState;\n threadId: string;\n title?: string | undefined;\n};\n\nexport type ExternalStoreThreadListAdapter = {\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n threadId?: string | undefined;\n threads?: readonly ExternalStoreThreadData<\"regular\">[] | undefined;\n archivedThreads?: readonly ExternalStoreThreadData<\"archived\">[] | undefined;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n onSwitchToNewThread?: (() => Promise<void> | void) | undefined;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;\n onRename?: (\n threadId: string,\n newTitle: string,\n ) => (Promise<void> | void) | undefined;\n onArchive?: ((threadId: string) => Promise<void> | void) | undefined;\n onUnarchive?: ((threadId: string) => Promise<void> | void) | undefined;\n onDelete?: ((threadId: string) => Promise<void> | void) | undefined;\n};\n\nexport type ExternalStoreMessageConverter<T> = (\n message: T,\n idx: number,\n) => ThreadMessageLike;\n\ntype ExternalStoreMessageConverterAdapter<T> = {\n convertMessage: ExternalStoreMessageConverter<T>;\n};\n\ntype ExternalStoreAdapterBase<T> = {\n isDisabled?: boolean | undefined;\n isRunning?: boolean | undefined;\n messages: T[];\n suggestions?: readonly ThreadSuggestion[] | undefined;\n extras?: unknown;\n\n setMessages?: ((messages: T[]) => void) | undefined;\n onNew: (message: AppendMessage) => Promise<void>;\n onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;\n onReload?: // TODO: remove parentId in 0.8.0\n | ((parentId: string | null, config: StartRunConfig) => Promise<void>)\n | undefined;\n onCancel?: (() => Promise<void>) | undefined;\n onAddToolResult?:\n | ((options: AddToolResultOptions) => Promise<void> | void)\n | undefined;\n convertMessage?: ExternalStoreMessageConverter<T> | undefined;\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n threadList?: ExternalStoreThreadListAdapter | undefined;\n }\n | undefined;\n unstable_capabilities?:\n | {\n copy?: boolean | undefined;\n }\n | undefined;\n};\n\nexport type ExternalStoreAdapter<T = ThreadMessage> =\n ExternalStoreAdapterBase<T> &\n (T extends ThreadMessage\n ? object\n : ExternalStoreMessageConverterAdapter<T>);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreAdapter.tsx"],"sourcesContent":["import { PropsWithChildren } from \"react\";\nimport { AppendMessage, ThreadMessage } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport {\n AddToolResultOptions,\n StartRunConfig,\n ThreadSuggestion,\n} from \"../core/ThreadRuntimeCore\";\nimport { FeedbackAdapter } from \"../feedback/FeedbackAdapter\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { ThreadMessageLike } from \"./ThreadMessageLike\";\n\nexport type ExternalStoreThreadData<TState extends \"regular\" | \"archived\"> = {\n status: TState;\n threadId: string;\n title?: string | undefined;\n};\n\nexport type ExternalStoreThreadListAdapter = {\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n threadId?: string | undefined;\n threads?: readonly ExternalStoreThreadData<\"regular\">[] | undefined;\n archivedThreads?: readonly ExternalStoreThreadData<\"archived\">[] | undefined;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n onSwitchToNewThread?: (() => Promise<void> | void) | undefined;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;\n onRename?: (\n threadId: string,\n newTitle: string,\n ) => (Promise<void> | void) | undefined;\n onArchive?: ((threadId: string) => Promise<void> | void) | undefined;\n onUnarchive?: ((threadId: string) => Promise<void> | void) | undefined;\n onDelete?: ((threadId: string) => Promise<void> | void) | undefined;\n};\n\nexport type ExternalStoreMessageConverter<T> = (\n message: T,\n idx: number,\n) => ThreadMessageLike;\n\ntype ExternalStoreMessageConverterAdapter<T> = {\n convertMessage: ExternalStoreMessageConverter<T>;\n};\n\ntype ExternalStoreAdapterBase<T> = {\n isDisabled?: boolean | undefined;\n isRunning?: boolean | undefined;\n messages: T[];\n suggestions?: readonly ThreadSuggestion[] | undefined;\n\n /**\n * @deprecated This field is deprecated and will be removed in 0.8.0. \n * Please migrate to `Provider` and a custom react context provider component instead.\n */\n extras?: unknown;\n\n setMessages?: ((messages: T[]) => void) | undefined;\n onNew: (message: AppendMessage) => Promise<void>;\n onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;\n onReload?: // TODO: remove parentId in 0.8.0\n | ((parentId: string | null, config: StartRunConfig) => Promise<void>)\n | undefined;\n onCancel?: (() => Promise<void>) | undefined;\n onAddToolResult?:\n | ((options: AddToolResultOptions) => Promise<void> | void)\n | undefined;\n convertMessage?: ExternalStoreMessageConverter<T> | undefined;\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n threadList?: ExternalStoreThreadListAdapter | undefined;\n }\n | undefined;\n unstable_capabilities?:\n | {\n copy?: boolean | undefined;\n }\n | undefined;\n\n unstable_Provider?: React.ComponentType<PropsWithChildren> | undefined;\n};\n\nexport type ExternalStoreAdapter<T = ThreadMessage> =\n ExternalStoreAdapterBase<T> &\n (T extends ThreadMessage\n ? object\n : ExternalStoreMessageConverterAdapter<T>);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,9 +1,12 @@
1
1
  import { BaseAssistantRuntimeCore } from "../../internal";
2
2
  import { ExternalStoreThreadListRuntimeCore } from "./ExternalStoreThreadListRuntimeCore";
3
3
  import { ExternalStoreAdapter } from "./ExternalStoreAdapter";
4
+ import { PropsWithChildren } from "react";
4
5
  export declare class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
5
6
  readonly threadList: ExternalStoreThreadListRuntimeCore;
6
- constructor(store: ExternalStoreAdapter<any>);
7
- setStore(store: ExternalStoreAdapter<any>): void;
7
+ private useRenderComponent;
8
+ constructor(adapter: ExternalStoreAdapter<any>);
9
+ setAdapter(adapter: ExternalStoreAdapter<any>): void;
10
+ readonly Provider: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
8
11
  }
9
12
  //# sourceMappingURL=ExternalStoreRuntimeCore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalStoreRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/external-store/ExternalStoreRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAS9D,qBAAa,wBAAyB,SAAQ,wBAAwB;IACpE,SAAgB,UAAU,qCAAC;gBAEf,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC;IASrC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC;CAKjD"}
1
+ {"version":3,"file":"ExternalStoreRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/external-store/ExternalStoreRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAS1C,qBAAa,wBAAyB,SAAQ,wBAAwB;IACpE,SAAgB,UAAU,qCAAC;IAE3B,OAAO,CAAC,kBAAkB,CAAC;gBAEf,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC;IAYvC,UAAU,CAAC,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC;IAapD,SAAgB,QAAQ,iBAAkB,iBAAiB,6CAGzD;CACH"}
@@ -26,6 +26,9 @@ module.exports = __toCommonJS(ExternalStoreRuntimeCore_exports);
26
26
  var import_internal = require("../../internal.js");
27
27
  var import_ExternalStoreThreadListRuntimeCore = require("./ExternalStoreThreadListRuntimeCore.js");
28
28
  var import_ExternalStoreThreadRuntimeCore = require("./ExternalStoreThreadRuntimeCore.js");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ var import_zustand = require("zustand");
31
+ var import_jsx_runtime2 = require("react/jsx-runtime");
29
32
  var getThreadListAdapter = (store) => {
30
33
  return {
31
34
  ...store.adapters?.threadList
@@ -33,17 +36,29 @@ var getThreadListAdapter = (store) => {
33
36
  };
34
37
  var ExternalStoreRuntimeCore = class extends import_internal.BaseAssistantRuntimeCore {
35
38
  threadList;
36
- constructor(store) {
39
+ useRenderComponent;
40
+ constructor(adapter) {
37
41
  super();
42
+ this.useRenderComponent = (0, import_zustand.create)(() => ({
43
+ RenderComponent: adapter.unstable_Provider ?? import_jsx_runtime.Fragment
44
+ }));
38
45
  this.threadList = new import_ExternalStoreThreadListRuntimeCore.ExternalStoreThreadListRuntimeCore(
39
- getThreadListAdapter(store),
40
- () => new import_ExternalStoreThreadRuntimeCore.ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, store)
46
+ getThreadListAdapter(adapter),
47
+ () => new import_ExternalStoreThreadRuntimeCore.ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, adapter)
41
48
  );
42
49
  }
43
- setStore(store) {
44
- this.threadList.__internal_setAdapter(getThreadListAdapter(store));
45
- this.threadList.getMainThreadRuntimeCore().__internal_setStore(store);
50
+ setAdapter(adapter) {
51
+ this.threadList.__internal_setAdapter(getThreadListAdapter(adapter));
52
+ this.threadList.getMainThreadRuntimeCore().__internal_setAdapter(adapter);
53
+ const RenderComponent = adapter.unstable_Provider ?? import_jsx_runtime.Fragment;
54
+ if (RenderComponent !== this.useRenderComponent.getState().RenderComponent) {
55
+ this.useRenderComponent.setState({ RenderComponent }, true);
56
+ }
46
57
  }
58
+ Provider = ({ children }) => {
59
+ const RenderComponent = this.useRenderComponent.getState().RenderComponent;
60
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RenderComponent, { children });
61
+ };
47
62
  };
48
63
  // Annotate the CommonJS export names for ESM import in node:
49
64
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreRuntimeCore.tsx"],"sourcesContent":["import { BaseAssistantRuntimeCore } from \"../../internal\";\nimport { ExternalStoreThreadListRuntimeCore } from \"./ExternalStoreThreadListRuntimeCore\";\nimport { ExternalStoreAdapter } from \"./ExternalStoreAdapter\";\nimport { ExternalStoreThreadRuntimeCore } from \"./ExternalStoreThreadRuntimeCore\";\n\nconst getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {\n return {\n ...store.adapters?.threadList,\n };\n};\n\nexport class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {\n public readonly threadList;\n\n constructor(store: ExternalStoreAdapter<any>) {\n super();\n this.threadList = new ExternalStoreThreadListRuntimeCore(\n getThreadListAdapter(store),\n () =>\n new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, store),\n );\n }\n\n public setStore(store: ExternalStoreAdapter<any>) {\n // Update the thread list adapter and propagate store changes to the main thread\n this.threadList.__internal_setAdapter(getThreadListAdapter(store));\n this.threadList.getMainThreadRuntimeCore().__internal_setStore(store);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyC;AACzC,gDAAmD;AAEnD,4CAA+C;AAE/C,IAAM,uBAAuB,CAAC,UAAqC;AACjE,SAAO;AAAA,IACL,GAAG,MAAM,UAAU;AAAA,EACrB;AACF;AAEO,IAAM,2BAAN,cAAuC,yCAAyB;AAAA,EACrD;AAAA,EAEhB,YAAY,OAAkC;AAC5C,UAAM;AACN,SAAK,aAAa,IAAI;AAAA,MACpB,qBAAqB,KAAK;AAAA,MAC1B,MACE,IAAI,qEAA+B,KAAK,sBAAsB,KAAK;AAAA,IACvE;AAAA,EACF;AAAA,EAEO,SAAS,OAAkC;AAEhD,SAAK,WAAW,sBAAsB,qBAAqB,KAAK,CAAC;AACjE,SAAK,WAAW,yBAAyB,EAAE,oBAAoB,KAAK;AAAA,EACtE;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreRuntimeCore.tsx"],"sourcesContent":["import { BaseAssistantRuntimeCore } from \"../../internal\";\nimport { ExternalStoreThreadListRuntimeCore } from \"./ExternalStoreThreadListRuntimeCore\";\nimport { ExternalStoreAdapter } from \"./ExternalStoreAdapter\";\nimport { ExternalStoreThreadRuntimeCore } from \"./ExternalStoreThreadRuntimeCore\";\nimport { Fragment } from \"react/jsx-runtime\";\nimport { PropsWithChildren } from \"react\";\nimport { create } from \"zustand\";\n\nconst getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {\n return {\n ...store.adapters?.threadList,\n };\n};\n\nexport class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {\n public readonly threadList;\n\n private useRenderComponent;\n\n constructor(adapter: ExternalStoreAdapter<any>) {\n super();\n this.useRenderComponent = create(() => ({\n RenderComponent: adapter.unstable_Provider ?? Fragment,\n }));\n this.threadList = new ExternalStoreThreadListRuntimeCore(\n getThreadListAdapter(adapter),\n () =>\n new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, adapter),\n );\n }\n\n public setAdapter(adapter: ExternalStoreAdapter<any>) {\n // Update the thread list adapter and propagate store changes to the main thread\n this.threadList.__internal_setAdapter(getThreadListAdapter(adapter));\n this.threadList.getMainThreadRuntimeCore().__internal_setAdapter(adapter);\n\n const RenderComponent = adapter.unstable_Provider ?? Fragment;\n if (\n RenderComponent !== this.useRenderComponent.getState().RenderComponent\n ) {\n this.useRenderComponent.setState({ RenderComponent }, true);\n }\n }\n\n public readonly Provider = ({ children }: PropsWithChildren) => {\n const RenderComponent = this.useRenderComponent.getState().RenderComponent;\n return <RenderComponent>{children}</RenderComponent>;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyC;AACzC,gDAAmD;AAEnD,4CAA+C;AAC/C,yBAAyB;AAEzB,qBAAuB;AAwCZ,IAAAA,sBAAA;AAtCX,IAAM,uBAAuB,CAAC,UAAqC;AACjE,SAAO;AAAA,IACL,GAAG,MAAM,UAAU;AAAA,EACrB;AACF;AAEO,IAAM,2BAAN,cAAuC,yCAAyB;AAAA,EACrD;AAAA,EAER;AAAA,EAER,YAAY,SAAoC;AAC9C,UAAM;AACN,SAAK,yBAAqB,uBAAO,OAAO;AAAA,MACtC,iBAAiB,QAAQ,qBAAqB;AAAA,IAChD,EAAE;AACF,SAAK,aAAa,IAAI;AAAA,MACpB,qBAAqB,OAAO;AAAA,MAC5B,MACE,IAAI,qEAA+B,KAAK,sBAAsB,OAAO;AAAA,IACzE;AAAA,EACF;AAAA,EAEO,WAAW,SAAoC;AAEpD,SAAK,WAAW,sBAAsB,qBAAqB,OAAO,CAAC;AACnE,SAAK,WAAW,yBAAyB,EAAE,sBAAsB,OAAO;AAExE,UAAM,kBAAkB,QAAQ,qBAAqB;AACrD,QACE,oBAAoB,KAAK,mBAAmB,SAAS,EAAE,iBACvD;AACA,WAAK,mBAAmB,SAAS,EAAE,gBAAgB,GAAG,IAAI;AAAA,IAC5D;AAAA,EACF;AAAA,EAEgB,WAAW,CAAC,EAAE,SAAS,MAAyB;AAC9D,UAAM,kBAAkB,KAAK,mBAAmB,SAAS,EAAE;AAC3D,WAAO,6CAAC,mBAAiB,UAAS;AAAA,EACpC;AACF;","names":["import_jsx_runtime"]}
@@ -2,6 +2,9 @@
2
2
  import { BaseAssistantRuntimeCore } from "../../internal.mjs";
3
3
  import { ExternalStoreThreadListRuntimeCore } from "./ExternalStoreThreadListRuntimeCore.mjs";
4
4
  import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore.mjs";
5
+ import { Fragment } from "react/jsx-runtime";
6
+ import { create } from "zustand";
7
+ import { jsx } from "react/jsx-runtime";
5
8
  var getThreadListAdapter = (store) => {
6
9
  return {
7
10
  ...store.adapters?.threadList
@@ -9,17 +12,29 @@ var getThreadListAdapter = (store) => {
9
12
  };
10
13
  var ExternalStoreRuntimeCore = class extends BaseAssistantRuntimeCore {
11
14
  threadList;
12
- constructor(store) {
15
+ useRenderComponent;
16
+ constructor(adapter) {
13
17
  super();
18
+ this.useRenderComponent = create(() => ({
19
+ RenderComponent: adapter.unstable_Provider ?? Fragment
20
+ }));
14
21
  this.threadList = new ExternalStoreThreadListRuntimeCore(
15
- getThreadListAdapter(store),
16
- () => new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, store)
22
+ getThreadListAdapter(adapter),
23
+ () => new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, adapter)
17
24
  );
18
25
  }
19
- setStore(store) {
20
- this.threadList.__internal_setAdapter(getThreadListAdapter(store));
21
- this.threadList.getMainThreadRuntimeCore().__internal_setStore(store);
26
+ setAdapter(adapter) {
27
+ this.threadList.__internal_setAdapter(getThreadListAdapter(adapter));
28
+ this.threadList.getMainThreadRuntimeCore().__internal_setAdapter(adapter);
29
+ const RenderComponent = adapter.unstable_Provider ?? Fragment;
30
+ if (RenderComponent !== this.useRenderComponent.getState().RenderComponent) {
31
+ this.useRenderComponent.setState({ RenderComponent }, true);
32
+ }
22
33
  }
34
+ Provider = ({ children }) => {
35
+ const RenderComponent = this.useRenderComponent.getState().RenderComponent;
36
+ return /* @__PURE__ */ jsx(RenderComponent, { children });
37
+ };
23
38
  };
24
39
  export {
25
40
  ExternalStoreRuntimeCore
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreRuntimeCore.tsx"],"sourcesContent":["import { BaseAssistantRuntimeCore } from \"../../internal\";\nimport { ExternalStoreThreadListRuntimeCore } from \"./ExternalStoreThreadListRuntimeCore\";\nimport { ExternalStoreAdapter } from \"./ExternalStoreAdapter\";\nimport { ExternalStoreThreadRuntimeCore } from \"./ExternalStoreThreadRuntimeCore\";\n\nconst getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {\n return {\n ...store.adapters?.threadList,\n };\n};\n\nexport class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {\n public readonly threadList;\n\n constructor(store: ExternalStoreAdapter<any>) {\n super();\n this.threadList = new ExternalStoreThreadListRuntimeCore(\n getThreadListAdapter(store),\n () =>\n new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, store),\n );\n }\n\n public setStore(store: ExternalStoreAdapter<any>) {\n // Update the thread list adapter and propagate store changes to the main thread\n this.threadList.__internal_setAdapter(getThreadListAdapter(store));\n this.threadList.getMainThreadRuntimeCore().__internal_setStore(store);\n }\n}\n"],"mappings":";AAAA,SAAS,gCAAgC;AACzC,SAAS,0CAA0C;AAEnD,SAAS,sCAAsC;AAE/C,IAAM,uBAAuB,CAAC,UAAqC;AACjE,SAAO;AAAA,IACL,GAAG,MAAM,UAAU;AAAA,EACrB;AACF;AAEO,IAAM,2BAAN,cAAuC,yBAAyB;AAAA,EACrD;AAAA,EAEhB,YAAY,OAAkC;AAC5C,UAAM;AACN,SAAK,aAAa,IAAI;AAAA,MACpB,qBAAqB,KAAK;AAAA,MAC1B,MACE,IAAI,+BAA+B,KAAK,sBAAsB,KAAK;AAAA,IACvE;AAAA,EACF;AAAA,EAEO,SAAS,OAAkC;AAEhD,SAAK,WAAW,sBAAsB,qBAAqB,KAAK,CAAC;AACjE,SAAK,WAAW,yBAAyB,EAAE,oBAAoB,KAAK;AAAA,EACtE;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreRuntimeCore.tsx"],"sourcesContent":["import { BaseAssistantRuntimeCore } from \"../../internal\";\nimport { ExternalStoreThreadListRuntimeCore } from \"./ExternalStoreThreadListRuntimeCore\";\nimport { ExternalStoreAdapter } from \"./ExternalStoreAdapter\";\nimport { ExternalStoreThreadRuntimeCore } from \"./ExternalStoreThreadRuntimeCore\";\nimport { Fragment } from \"react/jsx-runtime\";\nimport { PropsWithChildren } from \"react\";\nimport { create } from \"zustand\";\n\nconst getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {\n return {\n ...store.adapters?.threadList,\n };\n};\n\nexport class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {\n public readonly threadList;\n\n private useRenderComponent;\n\n constructor(adapter: ExternalStoreAdapter<any>) {\n super();\n this.useRenderComponent = create(() => ({\n RenderComponent: adapter.unstable_Provider ?? Fragment,\n }));\n this.threadList = new ExternalStoreThreadListRuntimeCore(\n getThreadListAdapter(adapter),\n () =>\n new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, adapter),\n );\n }\n\n public setAdapter(adapter: ExternalStoreAdapter<any>) {\n // Update the thread list adapter and propagate store changes to the main thread\n this.threadList.__internal_setAdapter(getThreadListAdapter(adapter));\n this.threadList.getMainThreadRuntimeCore().__internal_setAdapter(adapter);\n\n const RenderComponent = adapter.unstable_Provider ?? Fragment;\n if (\n RenderComponent !== this.useRenderComponent.getState().RenderComponent\n ) {\n this.useRenderComponent.setState({ RenderComponent }, true);\n }\n }\n\n public readonly Provider = ({ children }: PropsWithChildren) => {\n const RenderComponent = this.useRenderComponent.getState().RenderComponent;\n return <RenderComponent>{children}</RenderComponent>;\n };\n}\n"],"mappings":";AAAA,SAAS,gCAAgC;AACzC,SAAS,0CAA0C;AAEnD,SAAS,sCAAsC;AAC/C,SAAS,gBAAgB;AAEzB,SAAS,cAAc;AAwCZ;AAtCX,IAAM,uBAAuB,CAAC,UAAqC;AACjE,SAAO;AAAA,IACL,GAAG,MAAM,UAAU;AAAA,EACrB;AACF;AAEO,IAAM,2BAAN,cAAuC,yBAAyB;AAAA,EACrD;AAAA,EAER;AAAA,EAER,YAAY,SAAoC;AAC9C,UAAM;AACN,SAAK,qBAAqB,OAAO,OAAO;AAAA,MACtC,iBAAiB,QAAQ,qBAAqB;AAAA,IAChD,EAAE;AACF,SAAK,aAAa,IAAI;AAAA,MACpB,qBAAqB,OAAO;AAAA,MAC5B,MACE,IAAI,+BAA+B,KAAK,sBAAsB,OAAO;AAAA,IACzE;AAAA,EACF;AAAA,EAEO,WAAW,SAAoC;AAEpD,SAAK,WAAW,sBAAsB,qBAAqB,OAAO,CAAC;AACnE,SAAK,WAAW,yBAAyB,EAAE,sBAAsB,OAAO;AAExE,UAAM,kBAAkB,QAAQ,qBAAqB;AACrD,QACE,oBAAoB,KAAK,mBAAmB,SAAS,EAAE,iBACvD;AACA,WAAK,mBAAmB,SAAS,EAAE,gBAAgB,GAAG,IAAI;AAAA,IAC5D;AAAA,EACF;AAAA,EAEgB,WAAW,CAAC,EAAE,SAAS,MAAyB;AAC9D,UAAM,kBAAkB,KAAK,mBAAmB,SAAS,EAAE;AAC3D,WAAO,oBAAC,mBAAiB,UAAS;AAAA,EACpC;AACF;","names":[]}