@assistant-ui/react 0.7.26 → 0.7.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +1 -2
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs +2 -3
- package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts +9 -2
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts +2 -0
- package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts +4 -0
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +6 -0
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +5 -2
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +21 -6
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +21 -6
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +2 -2
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +2 -2
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.js +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.js.map +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.mjs +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.mjs.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.d.ts +1 -0
- package/dist/runtimes/local/LocalRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.js +1 -0
- package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.mjs +1 -0
- package/dist/runtimes/local/LocalRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +3 -6
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +4 -7
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js +1 -2
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js.map +1 -1
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs +1 -2
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +2 -2
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.js.map +1 -1
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +2 -2
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs +2 -2
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs.map +1 -1
- package/dist/styles/index.css +8 -7
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +7 -7
- package/dist/styles/tailwindcss/thread.css.json +7 -7
- package/dist/styles/themes/default.css +3 -0
- package/dist/styles/themes/default.css.json +2 -1
- package/dist/styles/themes/shadcn-extras.css +4 -0
- package/dist/styles/themes/shadcn-extras.css.json +5 -0
- package/dist/tailwindcss/index.d.ts.map +1 -1
- package/dist/tailwindcss/index.js +7 -0
- package/dist/tailwindcss/index.js.map +1 -1
- package/dist/tailwindcss/index.mjs +7 -0
- package/dist/tailwindcss/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/context/providers/AssistantRuntimeProvider.tsx +2 -6
- package/src/runtimes/core/AssistantRuntimeCore.tsx +9 -2
- package/src/runtimes/core/BaseAssistantRuntimeCore.tsx +4 -0
- package/src/runtimes/core/ThreadRuntimeCore.tsx +5 -0
- package/src/runtimes/external-store/ExternalStoreAdapter.tsx +8 -0
- package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +26 -6
- package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +2 -2
- package/src/runtimes/external-store/useExternalStoreRuntime.tsx +1 -1
- package/src/runtimes/local/LocalRuntimeCore.tsx +1 -0
- package/src/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +4 -10
- package/src/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.tsx +1 -2
- package/src/runtimes/remote-thread-list/types.tsx +2 -2
- package/src/runtimes/remote-thread-list/useRemoteThreadListRuntime.tsx +2 -2
- package/src/styles/tailwindcss/thread.css +7 -7
- package/src/styles/themes/default.css +3 -0
- package/src/styles/themes/shadcn-extras.css +4 -0
- package/src/tailwindcss/index.ts +7 -0
- package/dist/primitive-hooks/thread/useThread.d.ts +0 -1
- package/dist/primitive-hooks/thread/useThread.d.ts.map +0 -1
- package/dist/primitive-hooks/thread/useThread.js +0 -2
- package/dist/primitive-hooks/thread/useThread.js.map +0 -1
- package/dist/primitive-hooks/thread/useThread.mjs +0 -1
- package/dist/primitive-hooks/thread/useThread.mjs.map +0 -1
- package/src/primitive-hooks/thread/useThread.tsx +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tailwindcss/index.ts"],"sourcesContent":["import plugin from \"tailwindcss/plugin.js\";\nimport baseComponentsCSS from \"../../dist/styles/tailwindcss/base-components.css.json\";\nimport threadCSS from \"../../dist/styles/tailwindcss/thread.css.json\";\nimport modalCSS from \"../../dist/styles/tailwindcss/modal.css.json\";\nimport defaultThemeCSS from \"../../dist/styles/themes/default.css.json\";\n\ntype AssistantTailwindPluginColors = {\n border: string;\n input: string;\n ring: string;\n background: string;\n foreground: string;\n primary: {\n DEFAULT: string;\n foreground: string;\n };\n secondary: {\n DEFAULT: string;\n foreground: string;\n };\n destructive: {\n DEFAULT: string;\n foreground: string;\n };\n muted: {\n DEFAULT: string;\n foreground: string;\n };\n accent: {\n DEFAULT: string;\n foreground: string;\n };\n popover: {\n DEFAULT: string;\n foreground: string;\n };\n card: {\n DEFAULT: string;\n foreground: string;\n };\n};\n\ntype AssisstantTailwindPluginOptions = {\n components?: (\"default-theme\" | \"base\" | \"thread\" | \"assistant-modal\")[];\n colors?: AssistantTailwindPluginColors;\n shadcn?: boolean;\n};\n\nconst auiPlugin = plugin.withOptions<AssisstantTailwindPluginOptions>(\n ({ components = [\"assistant-modal\", \"thread\"], shadcn = false } = {}) =>\n ({ addComponents }) => {\n const assistantModal = components.includes(\"assistant-modal\");\n const thread = assistantModal || components.includes(\"thread\");\n const base = thread || components.includes(\"base\");\n const defaultTheme = components.includes(\"default-theme\");\n\n if (defaultTheme && shadcn)\n throw new Error(\"default-theme cannot be used with shadcn\");\n\n if (defaultTheme || (base && !shadcn)) {\n addComponents(defaultThemeCSS);\n }\n\n if (base) {\n addComponents(baseComponentsCSS);\n }\n\n if (thread) {\n addComponents(threadCSS);\n }\n\n if (assistantModal) {\n addComponents(modalCSS);\n }\n },\n ({ shadcn = false, colors = {} } = {}) => {\n const prefix = !shadcn ? \"--aui-\" : \"--\";\n return {\n safelist: [{ pattern: /aui-/ }],\n theme: {\n extend: {\n colors: {\n aui: {\n border: colors.border ?? `hsl(var(${prefix}border))`,\n input: colors.input ?? `hsl(var(${prefix}input))`,\n ring: colors.ring ?? `hsl(var(${prefix}ring))`,\n background: colors.background ?? `hsl(var(${prefix}background))`,\n foreground: colors.foreground ?? `hsl(var(${prefix}foreground))`,\n primary: {\n DEFAULT:\n colors.primary?.DEFAULT ?? `hsl(var(${prefix}primary))`,\n foreground:\n colors.primary?.foreground ??\n `hsl(var(${prefix}primary-foreground))`,\n },\n secondary: {\n DEFAULT:\n colors.secondary?.DEFAULT ?? `hsl(var(${prefix}secondary))`,\n foreground:\n colors.secondary?.foreground ??\n `hsl(var(${prefix}secondary-foreground))`,\n },\n destructive: {\n DEFAULT:\n colors.destructive?.DEFAULT ??\n `hsl(var(${prefix}destructive))`,\n foreground: `hsl(var(${prefix}destructive-foreground))`,\n },\n muted: {\n DEFAULT: `hsl(var(${prefix}muted))`,\n foreground:\n colors.muted?.foreground ??\n `hsl(var(${prefix}muted-foreground))`,\n },\n accent: {\n DEFAULT: colors.accent?.DEFAULT ?? `hsl(var(${prefix}accent))`,\n foreground:\n colors.accent?.foreground ??\n `hsl(var(${prefix}accent-foreground))`,\n },\n popover: {\n DEFAULT:\n colors.popover?.DEFAULT ?? `hsl(var(${prefix}popover))`,\n foreground:\n colors.popover?.foreground ??\n `hsl(var(${prefix}popover-foreground))`,\n },\n card: {\n DEFAULT: colors.card?.DEFAULT ?? `hsl(var(${prefix}card))`,\n foreground:\n colors.card?.foreground ??\n `hsl(var(${prefix}card-foreground))`,\n },\n },\n },\n },\n },\n };\n },\n);\n\nexport default auiPlugin;\n"],"mappings":";AAAA,OAAO,YAAY;AACnB,OAAO,uBAAuB;AAC9B,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,qBAAqB;AA4C5B,IAAM,YAAY,OAAO;AAAA,EACvB,CAAC,EAAE,aAAa,CAAC,mBAAmB,QAAQ,GAAG,SAAS,MAAM,IAAI,CAAC,MACjE,CAAC,EAAE,cAAc,MAAM;AACrB,UAAM,iBAAiB,WAAW,SAAS,iBAAiB;AAC5D,UAAM,SAAS,kBAAkB,WAAW,SAAS,QAAQ;AAC7D,UAAM,OAAO,UAAU,WAAW,SAAS,MAAM;AACjD,UAAM,eAAe,WAAW,SAAS,eAAe;AAExD,QAAI,gBAAgB;AAClB,YAAM,IAAI,MAAM,0CAA0C;AAE5D,QAAI,gBAAiB,QAAQ,CAAC,QAAS;AACrC,oBAAc,eAAe;AAAA,IAC/B;AAEA,QAAI,MAAM;AACR,oBAAc,iBAAiB;AAAA,IACjC;AAEA,QAAI,QAAQ;AACV,oBAAc,SAAS;AAAA,IACzB;AAEA,QAAI,gBAAgB;AAClB,oBAAc,QAAQ;AAAA,IACxB;AAAA,EACF;AAAA,EACF,CAAC,EAAE,SAAS,OAAO,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM;AACxC,UAAM,SAAS,CAAC,SAAS,WAAW;AACpC,WAAO;AAAA,MACL,UAAU,CAAC,EAAE,SAAS,OAAO,CAAC;AAAA,MAC9B,OAAO;AAAA,QACL,QAAQ;AAAA,UACN,QAAQ;AAAA,YACN,KAAK;AAAA,cACH,QAAQ,OAAO,UAAU,WAAW,MAAM;AAAA,cAC1C,OAAO,OAAO,SAAS,WAAW,MAAM;AAAA,cACxC,MAAM,OAAO,QAAQ,WAAW,MAAM;AAAA,cACtC,YAAY,OAAO,cAAc,WAAW,MAAM;AAAA,cAClD,YAAY,OAAO,cAAc,WAAW,MAAM;AAAA,cAClD,SAAS;AAAA,gBACP,SACE,OAAO,SAAS,WAAW,WAAW,MAAM;AAAA,gBAC9C,YACE,OAAO,SAAS,cAChB,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,WAAW;AAAA,gBACT,SACE,OAAO,WAAW,WAAW,WAAW,MAAM;AAAA,gBAChD,YACE,OAAO,WAAW,cAClB,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,aAAa;AAAA,gBACX,SACE,OAAO,aAAa,WACpB,WAAW,MAAM;AAAA,gBACnB,YAAY,WAAW,MAAM;AAAA,cAC/B;AAAA,cACA,OAAO;AAAA,gBACL,SAAS,WAAW,MAAM;AAAA,gBAC1B,YACE,OAAO,OAAO,cACd,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,QAAQ;AAAA,gBACN,SAAS,OAAO,QAAQ,WAAW,WAAW,MAAM;AAAA,gBACpD,YACE,OAAO,QAAQ,cACf,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,SAAS;AAAA,gBACP,SACE,OAAO,SAAS,WAAW,WAAW,MAAM;AAAA,gBAC9C,YACE,OAAO,SAAS,cAChB,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,MAAM;AAAA,gBACJ,SAAS,OAAO,MAAM,WAAW,WAAW,MAAM;AAAA,gBAClD,YACE,OAAO,MAAM,cACb,WAAW,MAAM;AAAA,cACrB;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/tailwindcss/index.ts"],"sourcesContent":["import plugin from \"tailwindcss/plugin.js\";\nimport baseComponentsCSS from \"../../dist/styles/tailwindcss/base-components.css.json\";\nimport threadCSS from \"../../dist/styles/tailwindcss/thread.css.json\";\nimport modalCSS from \"../../dist/styles/tailwindcss/modal.css.json\";\nimport defaultThemeCSS from \"../../dist/styles/themes/default.css.json\";\nimport shadcnExtrasCSS from \"../../dist/styles/themes/shadcn-extras.css.json\";\n\ntype AssistantTailwindPluginColors = {\n border: string;\n input: string;\n ring: string;\n background: string;\n foreground: string;\n primary: {\n DEFAULT: string;\n foreground: string;\n };\n secondary: {\n DEFAULT: string;\n foreground: string;\n };\n destructive: {\n DEFAULT: string;\n foreground: string;\n };\n muted: {\n DEFAULT: string;\n foreground: string;\n };\n accent: {\n DEFAULT: string;\n foreground: string;\n };\n popover: {\n DEFAULT: string;\n foreground: string;\n };\n card: {\n DEFAULT: string;\n foreground: string;\n };\n};\n\ntype AssisstantTailwindPluginOptions = {\n components?: (\"default-theme\" | \"base\" | \"thread\" | \"assistant-modal\")[];\n colors?: AssistantTailwindPluginColors;\n shadcn?: boolean;\n};\n\nconst auiPlugin = plugin.withOptions<AssisstantTailwindPluginOptions>(\n ({ components = [\"assistant-modal\", \"thread\"], shadcn = false } = {}) =>\n ({ addComponents }) => {\n const assistantModal = components.includes(\"assistant-modal\");\n const thread = assistantModal || components.includes(\"thread\");\n const base = thread || components.includes(\"base\");\n const defaultTheme = components.includes(\"default-theme\");\n\n if (defaultTheme && shadcn)\n throw new Error(\"default-theme cannot be used with shadcn\");\n\n if (defaultTheme || (base && !shadcn)) {\n addComponents(defaultThemeCSS);\n }\n if (!defaultTheme && base && shadcn) {\n addComponents(shadcnExtrasCSS);\n }\n\n if (base) {\n addComponents(baseComponentsCSS);\n }\n\n if (thread) {\n addComponents(threadCSS);\n }\n\n if (assistantModal) {\n addComponents(modalCSS);\n }\n },\n ({ shadcn = false, colors = {} } = {}) => {\n const prefix = !shadcn ? \"--aui-\" : \"--\";\n return {\n safelist: [{ pattern: /aui-/ }],\n theme: {\n extend: {\n maxWidth: {\n \"aui-thread\": \"var(--aui-thread-max-width)\",\n },\n colors: {\n aui: {\n border: colors.border ?? `hsl(var(${prefix}border))`,\n input: colors.input ?? `hsl(var(${prefix}input))`,\n ring: colors.ring ?? `hsl(var(${prefix}ring))`,\n background: colors.background ?? `hsl(var(${prefix}background))`,\n foreground: colors.foreground ?? `hsl(var(${prefix}foreground))`,\n primary: {\n DEFAULT:\n colors.primary?.DEFAULT ?? `hsl(var(${prefix}primary))`,\n foreground:\n colors.primary?.foreground ??\n `hsl(var(${prefix}primary-foreground))`,\n },\n secondary: {\n DEFAULT:\n colors.secondary?.DEFAULT ?? `hsl(var(${prefix}secondary))`,\n foreground:\n colors.secondary?.foreground ??\n `hsl(var(${prefix}secondary-foreground))`,\n },\n destructive: {\n DEFAULT:\n colors.destructive?.DEFAULT ??\n `hsl(var(${prefix}destructive))`,\n foreground: `hsl(var(${prefix}destructive-foreground))`,\n },\n muted: {\n DEFAULT: `hsl(var(${prefix}muted))`,\n foreground:\n colors.muted?.foreground ??\n `hsl(var(${prefix}muted-foreground))`,\n },\n accent: {\n DEFAULT: colors.accent?.DEFAULT ?? `hsl(var(${prefix}accent))`,\n foreground:\n colors.accent?.foreground ??\n `hsl(var(${prefix}accent-foreground))`,\n },\n popover: {\n DEFAULT:\n colors.popover?.DEFAULT ?? `hsl(var(${prefix}popover))`,\n foreground:\n colors.popover?.foreground ??\n `hsl(var(${prefix}popover-foreground))`,\n },\n card: {\n DEFAULT: colors.card?.DEFAULT ?? `hsl(var(${prefix}card))`,\n foreground:\n colors.card?.foreground ??\n `hsl(var(${prefix}card-foreground))`,\n },\n },\n },\n },\n },\n };\n },\n);\n\nexport default auiPlugin;\n"],"mappings":";AAAA,OAAO,YAAY;AACnB,OAAO,uBAAuB;AAC9B,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,qBAAqB;AAC5B,OAAO,qBAAqB;AA4C5B,IAAM,YAAY,OAAO;AAAA,EACvB,CAAC,EAAE,aAAa,CAAC,mBAAmB,QAAQ,GAAG,SAAS,MAAM,IAAI,CAAC,MACjE,CAAC,EAAE,cAAc,MAAM;AACrB,UAAM,iBAAiB,WAAW,SAAS,iBAAiB;AAC5D,UAAM,SAAS,kBAAkB,WAAW,SAAS,QAAQ;AAC7D,UAAM,OAAO,UAAU,WAAW,SAAS,MAAM;AACjD,UAAM,eAAe,WAAW,SAAS,eAAe;AAExD,QAAI,gBAAgB;AAClB,YAAM,IAAI,MAAM,0CAA0C;AAE5D,QAAI,gBAAiB,QAAQ,CAAC,QAAS;AACrC,oBAAc,eAAe;AAAA,IAC/B;AACA,QAAI,CAAC,gBAAgB,QAAQ,QAAQ;AACnC,oBAAc,eAAe;AAAA,IAC/B;AAEA,QAAI,MAAM;AACR,oBAAc,iBAAiB;AAAA,IACjC;AAEA,QAAI,QAAQ;AACV,oBAAc,SAAS;AAAA,IACzB;AAEA,QAAI,gBAAgB;AAClB,oBAAc,QAAQ;AAAA,IACxB;AAAA,EACF;AAAA,EACF,CAAC,EAAE,SAAS,OAAO,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM;AACxC,UAAM,SAAS,CAAC,SAAS,WAAW;AACpC,WAAO;AAAA,MACL,UAAU,CAAC,EAAE,SAAS,OAAO,CAAC;AAAA,MAC9B,OAAO;AAAA,QACL,QAAQ;AAAA,UACN,UAAU;AAAA,YACR,cAAc;AAAA,UAChB;AAAA,UACA,QAAQ;AAAA,YACN,KAAK;AAAA,cACH,QAAQ,OAAO,UAAU,WAAW,MAAM;AAAA,cAC1C,OAAO,OAAO,SAAS,WAAW,MAAM;AAAA,cACxC,MAAM,OAAO,QAAQ,WAAW,MAAM;AAAA,cACtC,YAAY,OAAO,cAAc,WAAW,MAAM;AAAA,cAClD,YAAY,OAAO,cAAc,WAAW,MAAM;AAAA,cAClD,SAAS;AAAA,gBACP,SACE,OAAO,SAAS,WAAW,WAAW,MAAM;AAAA,gBAC9C,YACE,OAAO,SAAS,cAChB,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,WAAW;AAAA,gBACT,SACE,OAAO,WAAW,WAAW,WAAW,MAAM;AAAA,gBAChD,YACE,OAAO,WAAW,cAClB,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,aAAa;AAAA,gBACX,SACE,OAAO,aAAa,WACpB,WAAW,MAAM;AAAA,gBACnB,YAAY,WAAW,MAAM;AAAA,cAC/B;AAAA,cACA,OAAO;AAAA,gBACL,SAAS,WAAW,MAAM;AAAA,gBAC1B,YACE,OAAO,OAAO,cACd,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,QAAQ;AAAA,gBACN,SAAS,OAAO,QAAQ,WAAW,WAAW,MAAM;AAAA,gBACpD,YACE,OAAO,QAAQ,cACf,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,SAAS;AAAA,gBACP,SACE,OAAO,SAAS,WAAW,WAAW,MAAM;AAAA,gBAC9C,YACE,OAAO,SAAS,cAChB,WAAW,MAAM;AAAA,cACrB;AAAA,cACA,MAAM;AAAA,gBACJ,SAAS,OAAO,MAAM,WAAW,WAAW,MAAM;AAAA,gBAClD,YACE,OAAO,MAAM,cACb,WAAW,MAAM;AAAA,cACrB;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { FC, PropsWithChildren } from "react";
|
|
4
|
-
import { memo, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { Fragment, memo, useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { AssistantContext } from "../react/AssistantContext";
|
|
6
6
|
import { makeAssistantToolUIsStore } from "../stores/AssistantToolUIs";
|
|
7
7
|
import { ThreadRuntimeProvider } from "./ThreadRuntimeProvider";
|
|
@@ -46,13 +46,9 @@ const useThreadListStore = (runtime: AssistantRuntime) => {
|
|
|
46
46
|
return store;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
const DEFAULT_RENDER_COMPONENT: FC<PropsWithChildren> = ({ children }) =>
|
|
50
|
-
children;
|
|
51
|
-
|
|
52
49
|
const getRenderComponent = (runtime: AssistantRuntime) => {
|
|
53
50
|
return (
|
|
54
|
-
(runtime as { _core?: AssistantRuntimeCore })._core
|
|
55
|
-
?.__internal_RenderComponent ?? DEFAULT_RENDER_COMPONENT
|
|
51
|
+
(runtime as { _core?: AssistantRuntimeCore })._core?.Provider ?? Fragment
|
|
56
52
|
);
|
|
57
53
|
};
|
|
58
54
|
|
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
@@ -8,5 +8,12 @@ export type AssistantRuntimeCore = {
|
|
|
8
8
|
|
|
9
9
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* A Provider component that wraps the app via `AssistantRuntimeProvider`.
|
|
13
|
+
*
|
|
14
|
+
* Note: This field is expected to never change.
|
|
15
|
+
* Refer to the source implementation of `ExternalStoreRuntimeCore`
|
|
16
|
+
* for an example of updating the provider via a zustand store.
|
|
17
|
+
*/
|
|
18
|
+
readonly Provider: ComponentType<PropsWithChildren> | undefined;
|
|
12
19
|
};
|
|
@@ -3,10 +3,14 @@ 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
|
|
|
7
8
|
export abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {
|
|
8
9
|
protected readonly _proxyConfigProvider = new ProxyConfigProvider();
|
|
9
10
|
public abstract get threadList(): ThreadListRuntimeCore;
|
|
11
|
+
public abstract get Provider():
|
|
12
|
+
| ComponentType<React.PropsWithChildren>
|
|
13
|
+
| undefined;
|
|
10
14
|
|
|
11
15
|
constructor() {}
|
|
12
16
|
|
|
@@ -89,6 +89,11 @@ export type ThreadRuntimeCore = Readonly<{
|
|
|
89
89
|
isDisabled: boolean;
|
|
90
90
|
messages: readonly ThreadMessage[];
|
|
91
91
|
suggestions: readonly ThreadSuggestion[];
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated This field is deprecated and will be removed in 0.8.0.
|
|
95
|
+
* Please migrate to using `AssistantRuntimeCore.Provider` instead.
|
|
96
|
+
*/
|
|
92
97
|
extras: unknown;
|
|
93
98
|
|
|
94
99
|
subscribe: (callback: () => void) => Unsubscribe;
|
|
@@ -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 {
|
|
@@ -53,6 +54,11 @@ type ExternalStoreAdapterBase<T> = {
|
|
|
53
54
|
isRunning?: boolean | undefined;
|
|
54
55
|
messages: T[];
|
|
55
56
|
suggestions?: readonly ThreadSuggestion[] | undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated This field is deprecated and will be removed in 0.8.0.
|
|
60
|
+
* Please migrate to `Provider` and a custom react context provider component instead.
|
|
61
|
+
*/
|
|
56
62
|
extras?: unknown;
|
|
57
63
|
|
|
58
64
|
setMessages?: ((messages: T[]) => void) | undefined;
|
|
@@ -82,6 +88,8 @@ type ExternalStoreAdapterBase<T> = {
|
|
|
82
88
|
copy?: boolean | undefined;
|
|
83
89
|
}
|
|
84
90
|
| undefined;
|
|
91
|
+
|
|
92
|
+
unstable_Provider?: React.ComponentType<PropsWithChildren> | undefined;
|
|
85
93
|
};
|
|
86
94
|
|
|
87
95
|
export type ExternalStoreAdapter<T = ThreadMessage> =
|
|
@@ -2,6 +2,9 @@ import { BaseAssistantRuntimeCore } from "../../internal";
|
|
|
2
2
|
import { ExternalStoreThreadListRuntimeCore } from "./ExternalStoreThreadListRuntimeCore";
|
|
3
3
|
import { ExternalStoreAdapter } from "./ExternalStoreAdapter";
|
|
4
4
|
import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
|
|
5
|
+
import { Fragment } from "react/jsx-runtime";
|
|
6
|
+
import { PropsWithChildren } from "react";
|
|
7
|
+
import { create } from "zustand";
|
|
5
8
|
|
|
6
9
|
const getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {
|
|
7
10
|
return {
|
|
@@ -12,18 +15,35 @@ const getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {
|
|
|
12
15
|
export class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
|
|
13
16
|
public readonly threadList;
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
private useRenderComponent;
|
|
19
|
+
|
|
20
|
+
constructor(adapter: ExternalStoreAdapter<any>) {
|
|
16
21
|
super();
|
|
22
|
+
this.useRenderComponent = create(() => ({
|
|
23
|
+
RenderComponent: adapter.unstable_Provider ?? Fragment,
|
|
24
|
+
}));
|
|
17
25
|
this.threadList = new ExternalStoreThreadListRuntimeCore(
|
|
18
|
-
getThreadListAdapter(
|
|
26
|
+
getThreadListAdapter(adapter),
|
|
19
27
|
() =>
|
|
20
|
-
new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider,
|
|
28
|
+
new ExternalStoreThreadRuntimeCore(this._proxyConfigProvider, adapter),
|
|
21
29
|
);
|
|
22
30
|
}
|
|
23
31
|
|
|
24
|
-
public
|
|
32
|
+
public setAdapter(adapter: ExternalStoreAdapter<any>) {
|
|
25
33
|
// Update the thread list adapter and propagate store changes to the main thread
|
|
26
|
-
this.threadList.__internal_setAdapter(getThreadListAdapter(
|
|
27
|
-
this.threadList.getMainThreadRuntimeCore().
|
|
34
|
+
this.threadList.__internal_setAdapter(getThreadListAdapter(adapter));
|
|
35
|
+
this.threadList.getMainThreadRuntimeCore().__internal_setAdapter(adapter);
|
|
36
|
+
|
|
37
|
+
const RenderComponent = adapter.unstable_Provider ?? Fragment;
|
|
38
|
+
if (
|
|
39
|
+
RenderComponent !== this.useRenderComponent.getState().RenderComponent
|
|
40
|
+
) {
|
|
41
|
+
this.useRenderComponent.setState({ RenderComponent }, true);
|
|
42
|
+
}
|
|
28
43
|
}
|
|
44
|
+
|
|
45
|
+
public readonly Provider = ({ children }: PropsWithChildren) => {
|
|
46
|
+
const RenderComponent = this.useRenderComponent.getState().RenderComponent;
|
|
47
|
+
return <RenderComponent>{children}</RenderComponent>;
|
|
48
|
+
};
|
|
29
49
|
}
|
|
@@ -80,10 +80,10 @@ export class ExternalStoreThreadRuntimeCore
|
|
|
80
80
|
store: ExternalStoreAdapter<any>,
|
|
81
81
|
) {
|
|
82
82
|
super(configProvider);
|
|
83
|
-
this.
|
|
83
|
+
this.__internal_setAdapter(store);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
public
|
|
86
|
+
public __internal_setAdapter(store: ExternalStoreAdapter<any>) {
|
|
87
87
|
if (this._store === store) return;
|
|
88
88
|
|
|
89
89
|
const isRunning = store.isRunning ?? false;
|
|
@@ -5,7 +5,7 @@ import { RemoteThreadListHookInstanceManager } from "./RemoteThreadListHookInsta
|
|
|
5
5
|
import { BaseSubscribable } from "./BaseSubscribable";
|
|
6
6
|
import { EMPTY_THREAD_CORE } from "./EMPTY_THREAD_CORE";
|
|
7
7
|
import { OptimisticState } from "./OptimisticState";
|
|
8
|
-
import { FC, PropsWithChildren, useEffect, useId } from "react";
|
|
8
|
+
import { FC, Fragment, PropsWithChildren, useEffect, useId } from "react";
|
|
9
9
|
import { create } from "zustand";
|
|
10
10
|
import { CloudInitializeResponse } from "./cloud/CloudContext";
|
|
11
11
|
|
|
@@ -25,10 +25,6 @@ type RemoteThreadData =
|
|
|
25
25
|
readonly title?: string | undefined;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const DEFAULT_RENDER_COMPONENT: FC<PropsWithChildren> = ({ children }) => {
|
|
29
|
-
return children;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
28
|
type THREAD_MAPPING_ID = string & { __brand: "THREAD_MAPPING_ID" };
|
|
33
29
|
function createThreadMappingId(id: string): THREAD_MAPPING_ID {
|
|
34
30
|
return id as THREAD_MAPPING_ID;
|
|
@@ -157,8 +153,7 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
|
157
153
|
adapter.runtimeHook,
|
|
158
154
|
);
|
|
159
155
|
this.useRenderComponent = create(() => ({
|
|
160
|
-
RenderComponent:
|
|
161
|
-
adapter.__internal_RenderComponent ?? DEFAULT_RENDER_COMPONENT,
|
|
156
|
+
RenderComponent: adapter.unstable_Provider ?? Fragment,
|
|
162
157
|
}));
|
|
163
158
|
this.__internal_setAdapter(adapter);
|
|
164
159
|
|
|
@@ -234,8 +229,7 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
|
234
229
|
this._disposeOldAdapter?.();
|
|
235
230
|
this._disposeOldAdapter = this._adapter.onInitialize(this._onInitialize);
|
|
236
231
|
|
|
237
|
-
const RenderComponent =
|
|
238
|
-
adapter.__internal_RenderComponent ?? DEFAULT_RENDER_COMPONENT;
|
|
232
|
+
const RenderComponent = adapter.unstable_Provider ?? Fragment;
|
|
239
233
|
if (
|
|
240
234
|
RenderComponent !== this.useRenderComponent.getState().RenderComponent
|
|
241
235
|
) {
|
|
@@ -460,7 +454,7 @@ export class RemoteThreadListThreadListRuntimeCore
|
|
|
460
454
|
|
|
461
455
|
private useBoundIds = create<string[]>(() => []);
|
|
462
456
|
|
|
463
|
-
public
|
|
457
|
+
public __internal_Provider: FC<PropsWithChildren> = ({ children }) => {
|
|
464
458
|
const id = useId();
|
|
465
459
|
useEffect(() => {
|
|
466
460
|
this.useBoundIds.setState((s) => [...s, id], true);
|
|
@@ -86,8 +86,7 @@ export const useCloudThreadListRuntime = (adapter: CloudThreadListAdapter) => {
|
|
|
86
86
|
onInitialize: (callback) => {
|
|
87
87
|
return cloudContextValue.subscribe(callback);
|
|
88
88
|
},
|
|
89
|
-
|
|
90
|
-
console.log("RENDER COMPONENT");
|
|
89
|
+
unstable_Provider: ({ children }: PropsWithChildren) => {
|
|
91
90
|
return (
|
|
92
91
|
<CloudContext.Provider value={cloudContextValue}>
|
|
93
92
|
{children}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType, PropsWithChildren } from "react";
|
|
2
2
|
import { AssistantRuntime } from "../../api";
|
|
3
3
|
import { Unsubscribe } from "../../types";
|
|
4
4
|
import { CloudInitializeResponse } from "./cloud/CloudContext";
|
|
@@ -30,5 +30,5 @@ export type RemoteThreadListAdapter = {
|
|
|
30
30
|
callback: (task: Promise<CloudInitializeResponse>) => Promise<void>,
|
|
31
31
|
): Unsubscribe;
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
unstable_Provider?: ComponentType<PropsWithChildren>;
|
|
34
34
|
};
|
|
@@ -12,8 +12,8 @@ class RemoteThreadListRuntimeCore extends BaseAssistantRuntimeCore {
|
|
|
12
12
|
this.threadList = new RemoteThreadListThreadListRuntimeCore(adapter);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
public get
|
|
16
|
-
return this.threadList.
|
|
15
|
+
public get Provider() {
|
|
16
|
+
return this.threadList.__internal_Provider;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.aui-thread-viewport-footer {
|
|
12
|
-
@apply sticky bottom-0 mt-3 flex w-full
|
|
12
|
+
@apply max-w-aui-thread sticky bottom-0 mt-3 flex w-full flex-col items-center justify-end rounded-t-lg bg-inherit pb-4;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.aui-thread-scroll-to-bottom {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/* thread welcome */
|
|
28
28
|
|
|
29
29
|
.aui-thread-welcome-root {
|
|
30
|
-
@apply flex w-full
|
|
30
|
+
@apply max-w-aui-thread flex w-full flex-grow flex-col;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.aui-thread-welcome-center {
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
|
|
109
109
|
.aui-user-message-root {
|
|
110
110
|
@apply grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [&>*]:col-start-2;
|
|
111
|
-
@apply w-
|
|
111
|
+
@apply max-w-aui-thread w-full py-4;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
:where(.aui-user-message-root) > .aui-user-action-bar-root {
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
.aui-user-message-content {
|
|
133
|
-
@apply bg-aui-muted text-aui-foreground max-w-
|
|
133
|
+
@apply bg-aui-muted text-aui-foreground max-w-[calc(var(--aui-thread-max-width)*0.8)] break-words rounded-3xl px-5 py-2.5;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
.aui-user-message-attachments {
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
/* edit composer */
|
|
147
147
|
|
|
148
148
|
.aui-edit-composer-root {
|
|
149
|
-
@apply bg-aui-muted my-4 flex w-full
|
|
149
|
+
@apply bg-aui-muted max-w-aui-thread my-4 flex w-full flex-col gap-2 rounded-xl;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
.aui-edit-composer-input {
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
|
|
162
162
|
.aui-assistant-message-root {
|
|
163
163
|
@apply grid grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr];
|
|
164
|
-
@apply relative w-full
|
|
164
|
+
@apply max-w-aui-thread relative w-full py-4;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
:where(.aui-assistant-message-root) > .aui-avatar-root {
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
.aui-assistant-message-content {
|
|
186
|
-
@apply text-aui-foreground max-w-
|
|
186
|
+
@apply text-aui-foreground max-w-[calc(var(--aui-thread-max-width)*0.8)] break-words leading-7;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
/* assistant action bar */
|
package/src/tailwindcss/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import baseComponentsCSS from "../../dist/styles/tailwindcss/base-components.css
|
|
|
3
3
|
import threadCSS from "../../dist/styles/tailwindcss/thread.css.json";
|
|
4
4
|
import modalCSS from "../../dist/styles/tailwindcss/modal.css.json";
|
|
5
5
|
import defaultThemeCSS from "../../dist/styles/themes/default.css.json";
|
|
6
|
+
import shadcnExtrasCSS from "../../dist/styles/themes/shadcn-extras.css.json";
|
|
6
7
|
|
|
7
8
|
type AssistantTailwindPluginColors = {
|
|
8
9
|
border: string;
|
|
@@ -60,6 +61,9 @@ const auiPlugin = plugin.withOptions<AssisstantTailwindPluginOptions>(
|
|
|
60
61
|
if (defaultTheme || (base && !shadcn)) {
|
|
61
62
|
addComponents(defaultThemeCSS);
|
|
62
63
|
}
|
|
64
|
+
if (!defaultTheme && base && shadcn) {
|
|
65
|
+
addComponents(shadcnExtrasCSS);
|
|
66
|
+
}
|
|
63
67
|
|
|
64
68
|
if (base) {
|
|
65
69
|
addComponents(baseComponentsCSS);
|
|
@@ -79,6 +83,9 @@ const auiPlugin = plugin.withOptions<AssisstantTailwindPluginOptions>(
|
|
|
79
83
|
safelist: [{ pattern: /aui-/ }],
|
|
80
84
|
theme: {
|
|
81
85
|
extend: {
|
|
86
|
+
maxWidth: {
|
|
87
|
+
"aui-thread": "var(--aui-thread-max-width)",
|
|
88
|
+
},
|
|
82
89
|
colors: {
|
|
83
90
|
aui: {
|
|
84
91
|
border: colors.border ?? `hsl(var(${prefix}border))`,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=useThread.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useThread.d.ts","sourceRoot":"","sources":["../../../src/primitive-hooks/thread/useThread.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=useThread.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|