@assistant-ui/react 0.7.54 → 0.7.56
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/runtimes/edge/converters/fromCoreMessage.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/fromCoreMessage.js +6 -1
- package/dist/runtimes/edge/converters/fromCoreMessage.js.map +1 -1
- package/dist/runtimes/edge/converters/fromCoreMessage.mjs +6 -1
- package/dist/runtimes/edge/converters/fromCoreMessage.mjs.map +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.js +6 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.js.map +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.mjs +6 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.mjs.map +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.js +7 -0
- package/dist/runtimes/edge/streams/assistantEncoderStream.js.map +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.mjs +7 -0
- package/dist/runtimes/edge/streams/assistantEncoderStream.mjs.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.js +17 -0
- package/dist/runtimes/edge/streams/runResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.mjs +17 -0
- package/dist/runtimes/edge/streams/runResultStream.mjs.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.d.ts +3 -0
- package/dist/runtimes/edge/streams/toolResultStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.js +1 -0
- package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.mjs +1 -0
- package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +1 -3
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +1 -3
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts +2 -1
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.js +1 -0
- package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.mjs +1 -0
- package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
- package/dist/runtimes/external-store/external-message-converter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-message-converter.js +6 -0
- package/dist/runtimes/external-store/external-message-converter.js.map +1 -1
- package/dist/runtimes/external-store/external-message-converter.mjs +6 -0
- package/dist/runtimes/external-store/external-message-converter.mjs.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.d.ts +1 -0
- package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +10 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +10 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/tailwindcss/index.js +1 -1
- package/dist/tailwindcss/index.js.map +1 -1
- package/dist/tailwindcss/index.mjs +1 -1
- package/dist/tailwindcss/index.mjs.map +1 -1
- package/dist/types/AssistantTypes.d.ts +2 -0
- package/dist/types/AssistantTypes.d.ts.map +1 -1
- package/dist/types/AssistantTypes.js.map +1 -1
- package/package.json +1 -1
- package/src/runtimes/edge/converters/fromCoreMessage.ts +6 -1
- package/src/runtimes/edge/streams/assistantDecoderStream.ts +7 -1
- package/src/runtimes/edge/streams/assistantEncoderStream.ts +8 -0
- package/src/runtimes/edge/streams/runResultStream.ts +22 -0
- package/src/runtimes/edge/streams/toolResultStream.ts +5 -0
- package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +1 -3
- package/src/runtimes/external-store/ThreadMessageLike.tsx +3 -1
- package/src/runtimes/external-store/external-message-converter.tsx +6 -0
- package/src/runtimes/local/ChatModelAdapter.tsx +1 -0
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +14 -1
- package/src/tailwindcss/index.ts +1 -1
- package/src/types/AssistantTypes.ts +2 -0
@@ -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\";\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 ({\n components = [\"assistant-modal\", \"thread\"],\n colors = {},\n shadcn = false,\n }) => {\n const prefix = !shadcn ? \"--aui-\" : \"--\";\n return {\n ...(components.length > 0\n ? { safelist: [{ pattern: /^aui-/ }] }\n : undefined),\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;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,iCAA8B;AAC9B,wBAAsB;AACtB,uBAAqB;AACrB,yBAA4B;AAC5B,+BAA4B;AA4C5B,IAAM,YAAY,cAAAA,QAAO;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,mBAAAC,OAAe;AAAA,IAC/B;AACA,QAAI,CAAC,gBAAgB,QAAQ,QAAQ;AACnC,oBAAc,yBAAAC,OAAe;AAAA,IAC/B;AAEA,QAAI,MAAM;AACR,oBAAc,2BAAAC,OAAiB;AAAA,IACjC;AAEA,QAAI,QAAQ;AACV,oBAAc,kBAAAC,OAAS;AAAA,IACzB;AAEA,QAAI,gBAAgB;AAClB,oBAAc,iBAAAC,OAAQ;AAAA,IACxB;AAAA,EACF;AAAA,EACF,CAAC;AAAA,IACC,aAAa,CAAC,mBAAmB,QAAQ;AAAA,IACzC,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,EACX,MAAM;
|
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 ({\n components = [\"assistant-modal\", \"thread\"],\n colors = {},\n shadcn = false,\n } = {}) => {\n const prefix = !shadcn ? \"--aui-\" : \"--\";\n return {\n ...(components.length > 0\n ? { safelist: [{ pattern: /^aui-/ }] }\n : undefined),\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(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AQ;","names":["plugin","defaultThemeCSS","shadcnExtrasCSS","baseComponentsCSS","threadCSS","modalCSS"]}
|
@@ -33,7 +33,7 @@ var auiPlugin = plugin.withOptions(
|
|
33
33
|
components = ["assistant-modal", "thread"],
|
34
34
|
colors = {},
|
35
35
|
shadcn = false
|
36
|
-
}) => {
|
36
|
+
} = {}) => {
|
37
37
|
const prefix = !shadcn ? "--aui-" : "--";
|
38
38
|
return {
|
39
39
|
...components.length > 0 ? { safelist: [{ pattern: /^aui-/ }] } : void 0,
|
@@ -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\";\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 ({\n components = [\"assistant-modal\", \"thread\"],\n colors = {},\n shadcn = false,\n }) => {\n const prefix = !shadcn ? \"--aui-\" : \"--\";\n return {\n ...(components.length > 0\n ? { safelist: [{ pattern: /^aui-/ }] }\n : undefined),\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;AAAA,IACC,aAAa,CAAC,mBAAmB,QAAQ;AAAA,IACzC,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,EACX,MAAM;
|
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 ({\n components = [\"assistant-modal\", \"thread\"],\n colors = {},\n shadcn = false,\n } = {}) => {\n const prefix = !shadcn ? \"--aui-\" : \"--\";\n return {\n ...(components.length > 0\n ? { safelist: [{ pattern: /^aui-/ }] }\n : undefined),\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,OA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,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":[]}
|
@@ -131,6 +131,7 @@ export type ThreadAssistantMessage = MessageCommonProps & {
|
|
131
131
|
readonly content: readonly ThreadAssistantContentPart[];
|
132
132
|
readonly status: MessageStatus;
|
133
133
|
readonly metadata: {
|
134
|
+
readonly unstable_annotations: readonly unknown[];
|
134
135
|
readonly unstable_data: readonly unknown[];
|
135
136
|
readonly steps: readonly ThreadStep[];
|
136
137
|
readonly custom: Record<string, unknown>;
|
@@ -150,6 +151,7 @@ export type AppendMessage = CoreMessage & {
|
|
150
151
|
type BaseThreadMessage = {
|
151
152
|
readonly status?: ThreadAssistantMessage["status"];
|
152
153
|
readonly metadata: {
|
154
|
+
readonly unstable_annotations?: readonly unknown[];
|
153
155
|
readonly unstable_data?: readonly unknown[];
|
154
156
|
readonly steps?: readonly ThreadStep[];
|
155
157
|
readonly custom: Record<string, unknown>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AssistantTypes.d.ts","sourceRoot":"","sources":["../../src/types/AssistantTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,KAAK,C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sources":["../../src/types/AssistantTypes.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { CompleteAttachment } from \"./AttachmentTypes\";\n\nexport type MessageRole = \"user\" | \"assistant\" | \"system\";\n\nexport type TextContentPart = {\n readonly type: \"text\";\n readonly text: string;\n};\n\nexport type ImageContentPart = {\n readonly type: \"image\";\n readonly image: string;\n};\n\nexport type FileContentPart = {\n readonly type: \"file\";\n readonly data: string;\n readonly mimeType: string;\n};\n\nexport type Unstable_AudioContentPart = {\n readonly type: \"audio\";\n readonly audio: {\n readonly data: string;\n readonly format: \"mp3\" | \"wav\";\n };\n};\n\n/**\n * @deprecated UI content parts are deprecated and will be removed in v0.8.0.\n * Migration guide for external-store users using UI content parts:\n * If you must, store UI elements on your external store messages, update your\n * external store converter:\n * ```ts\n * const UI_PLACEHOLDER = Object.freeze({ type: \"text\", text: \"UI content placeholder\" });\n * const convertMessage = (message: TMessage): ThreadMessageLike => ({\n * content: [\n * // other content parts,\n * UI_PLACEHOLDER\n * ],\n * });\n * ```\n *\n * Then, define a custom `TextContentPartComponent`:\n *\n * ```tsx\n * const MyText: FC = () => {\n * const isUIPlaceholder = useContentPart(p => p === UI_PLACEHOLDER);\n *\n * // this assumes that you have a `display` field on your original message objects before conversion.\n * const ui = useMessage(m => isUIPlaceholder ? getExternalStoreMessage(m).display : undefined);\n * if (ui) {\n * return ui;\n * }\n *\n * return <MarkdownText />; // your default text component\n * }\n * ```\n *\n * Pass this component to your Thread:\n *\n * ```tsx\n * <Thread assistantMessage={{ components: { Text: MyText } }} userMessage={{ components: { Text: MyText } }} />\n * ```\n */\nexport type UIContentPart = {\n readonly type: \"ui\";\n readonly display: ReactNode;\n};\n\nexport type CoreToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: TArgs;\n readonly result?: TResult | undefined;\n readonly isError?: boolean | undefined;\n};\n\nexport type ToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = CoreToolCallContentPart<TArgs, TResult> & {\n readonly argsText: string;\n};\n\nexport type ThreadUserContentPart =\n | TextContentPart\n | ImageContentPart\n | FileContentPart\n | Unstable_AudioContentPart\n | UIContentPart;\n\nexport type ThreadAssistantContentPart =\n | TextContentPart\n | ToolCallContentPart\n | UIContentPart;\n\ntype MessageCommonProps = {\n readonly id: string;\n readonly createdAt: Date;\n};\n\nexport type ThreadStep = {\n readonly usage?:\n | {\n readonly promptTokens: number;\n readonly completionTokens: number;\n }\n | undefined;\n};\n\nexport type ContentPartStatus =\n | {\n readonly type: \"running\";\n }\n | {\n readonly type: \"complete\";\n }\n | {\n readonly type: \"incomplete\";\n readonly reason:\n | \"cancelled\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n readonly error?: unknown;\n };\n\nexport type ToolCallContentPartStatus =\n | {\n readonly type: \"requires-action\";\n readonly reason: \"tool-calls\";\n }\n | ContentPartStatus;\n\nexport type MessageStatus =\n | {\n readonly type: \"running\";\n }\n | {\n readonly type: \"requires-action\";\n readonly reason: \"tool-calls\";\n }\n | {\n readonly type: \"complete\";\n readonly reason: \"stop\" | \"unknown\";\n }\n | {\n readonly type: \"incomplete\";\n readonly reason:\n | \"cancelled\"\n | \"tool-calls\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n readonly error?: unknown;\n };\n\nexport type ThreadSystemMessage = MessageCommonProps & {\n readonly role: \"system\";\n readonly content: readonly [TextContentPart];\n readonly metadata: {\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type ThreadUserMessage = MessageCommonProps & {\n readonly role: \"user\";\n readonly content: readonly ThreadUserContentPart[];\n readonly attachments: readonly CompleteAttachment[];\n readonly metadata: {\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type ThreadAssistantMessage = MessageCommonProps & {\n readonly role: \"assistant\";\n readonly content: readonly ThreadAssistantContentPart[];\n readonly status: MessageStatus;\n readonly metadata: {\n readonly unstable_data: readonly unknown[];\n readonly steps: readonly ThreadStep[];\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type RunConfig = {\n // TODO allow user customization via global type overrides\n readonly custom?: Record<string, unknown>;\n};\n\nexport type AppendMessage = CoreMessage & {\n parentId: string | null;\n\n /** The ID of the message that was edited or undefined. */\n sourceId: string | null;\n runConfig: RunConfig | undefined;\n\n attachments: readonly CompleteAttachment[];\n startRun?: boolean | undefined;\n};\n\ntype BaseThreadMessage = {\n readonly status?: ThreadAssistantMessage[\"status\"];\n readonly metadata: {\n readonly unstable_data?: readonly unknown[];\n readonly steps?: readonly ThreadStep[];\n readonly custom: Record<string, unknown>;\n };\n readonly attachments?: ThreadUserMessage[\"attachments\"];\n};\n\nexport type ThreadMessage = BaseThreadMessage &\n (ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage);\n\n/** Core Message Types (without UI content parts) */\n\nexport type CoreUserContentPart =\n | TextContentPart\n | ImageContentPart\n | FileContentPart\n | Unstable_AudioContentPart;\nexport type CoreAssistantContentPart =\n | TextContentPart\n | CoreToolCallContentPart;\n\nexport type CoreSystemMessage = {\n role: \"system\";\n content: readonly [TextContentPart];\n};\n\nexport type CoreUserMessage = {\n role: \"user\";\n content: readonly CoreUserContentPart[];\n};\n\nexport type CoreAssistantMessage = {\n role: \"assistant\";\n content: readonly CoreAssistantContentPart[];\n};\n\nexport type CoreMessage =\n | CoreSystemMessage\n | CoreUserMessage\n | CoreAssistantMessage;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
1
|
+
{"version":3,"sources":["../../src/types/AssistantTypes.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { CompleteAttachment } from \"./AttachmentTypes\";\n\nexport type MessageRole = \"user\" | \"assistant\" | \"system\";\n\nexport type TextContentPart = {\n readonly type: \"text\";\n readonly text: string;\n};\n\nexport type ImageContentPart = {\n readonly type: \"image\";\n readonly image: string;\n};\n\nexport type FileContentPart = {\n readonly type: \"file\";\n readonly data: string;\n readonly mimeType: string;\n};\n\nexport type Unstable_AudioContentPart = {\n readonly type: \"audio\";\n readonly audio: {\n readonly data: string;\n readonly format: \"mp3\" | \"wav\";\n };\n};\n\n/**\n * @deprecated UI content parts are deprecated and will be removed in v0.8.0.\n * Migration guide for external-store users using UI content parts:\n * If you must, store UI elements on your external store messages, update your\n * external store converter:\n * ```ts\n * const UI_PLACEHOLDER = Object.freeze({ type: \"text\", text: \"UI content placeholder\" });\n * const convertMessage = (message: TMessage): ThreadMessageLike => ({\n * content: [\n * // other content parts,\n * UI_PLACEHOLDER\n * ],\n * });\n * ```\n *\n * Then, define a custom `TextContentPartComponent`:\n *\n * ```tsx\n * const MyText: FC = () => {\n * const isUIPlaceholder = useContentPart(p => p === UI_PLACEHOLDER);\n *\n * // this assumes that you have a `display` field on your original message objects before conversion.\n * const ui = useMessage(m => isUIPlaceholder ? getExternalStoreMessage(m).display : undefined);\n * if (ui) {\n * return ui;\n * }\n *\n * return <MarkdownText />; // your default text component\n * }\n * ```\n *\n * Pass this component to your Thread:\n *\n * ```tsx\n * <Thread assistantMessage={{ components: { Text: MyText } }} userMessage={{ components: { Text: MyText } }} />\n * ```\n */\nexport type UIContentPart = {\n readonly type: \"ui\";\n readonly display: ReactNode;\n};\n\nexport type CoreToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: TArgs;\n readonly result?: TResult | undefined;\n readonly isError?: boolean | undefined;\n};\n\nexport type ToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = CoreToolCallContentPart<TArgs, TResult> & {\n readonly argsText: string;\n};\n\nexport type ThreadUserContentPart =\n | TextContentPart\n | ImageContentPart\n | FileContentPart\n | Unstable_AudioContentPart\n | UIContentPart;\n\nexport type ThreadAssistantContentPart =\n | TextContentPart\n | ToolCallContentPart\n | UIContentPart;\n\ntype MessageCommonProps = {\n readonly id: string;\n readonly createdAt: Date;\n};\n\nexport type ThreadStep = {\n readonly usage?:\n | {\n readonly promptTokens: number;\n readonly completionTokens: number;\n }\n | undefined;\n};\n\nexport type ContentPartStatus =\n | {\n readonly type: \"running\";\n }\n | {\n readonly type: \"complete\";\n }\n | {\n readonly type: \"incomplete\";\n readonly reason:\n | \"cancelled\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n readonly error?: unknown;\n };\n\nexport type ToolCallContentPartStatus =\n | {\n readonly type: \"requires-action\";\n readonly reason: \"tool-calls\";\n }\n | ContentPartStatus;\n\nexport type MessageStatus =\n | {\n readonly type: \"running\";\n }\n | {\n readonly type: \"requires-action\";\n readonly reason: \"tool-calls\";\n }\n | {\n readonly type: \"complete\";\n readonly reason: \"stop\" | \"unknown\";\n }\n | {\n readonly type: \"incomplete\";\n readonly reason:\n | \"cancelled\"\n | \"tool-calls\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n readonly error?: unknown;\n };\n\nexport type ThreadSystemMessage = MessageCommonProps & {\n readonly role: \"system\";\n readonly content: readonly [TextContentPart];\n readonly metadata: {\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type ThreadUserMessage = MessageCommonProps & {\n readonly role: \"user\";\n readonly content: readonly ThreadUserContentPart[];\n readonly attachments: readonly CompleteAttachment[];\n readonly metadata: {\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type ThreadAssistantMessage = MessageCommonProps & {\n readonly role: \"assistant\";\n readonly content: readonly ThreadAssistantContentPart[];\n readonly status: MessageStatus;\n readonly metadata: {\n readonly unstable_annotations: readonly unknown[];\n readonly unstable_data: readonly unknown[];\n readonly steps: readonly ThreadStep[];\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type RunConfig = {\n // TODO allow user customization via global type overrides\n readonly custom?: Record<string, unknown>;\n};\n\nexport type AppendMessage = CoreMessage & {\n parentId: string | null;\n\n /** The ID of the message that was edited or undefined. */\n sourceId: string | null;\n runConfig: RunConfig | undefined;\n\n attachments: readonly CompleteAttachment[];\n startRun?: boolean | undefined;\n};\n\ntype BaseThreadMessage = {\n readonly status?: ThreadAssistantMessage[\"status\"];\n readonly metadata: {\n readonly unstable_annotations?: readonly unknown[];\n readonly unstable_data?: readonly unknown[];\n readonly steps?: readonly ThreadStep[];\n readonly custom: Record<string, unknown>;\n };\n readonly attachments?: ThreadUserMessage[\"attachments\"];\n};\n\nexport type ThreadMessage = BaseThreadMessage &\n (ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage);\n\n/** Core Message Types (without UI content parts) */\n\nexport type CoreUserContentPart =\n | TextContentPart\n | ImageContentPart\n | FileContentPart\n | Unstable_AudioContentPart;\nexport type CoreAssistantContentPart =\n | TextContentPart\n | CoreToolCallContentPart;\n\nexport type CoreSystemMessage = {\n role: \"system\";\n content: readonly [TextContentPart];\n};\n\nexport type CoreUserMessage = {\n role: \"user\";\n content: readonly CoreUserContentPart[];\n};\n\nexport type CoreAssistantMessage = {\n role: \"assistant\";\n content: readonly CoreAssistantContentPart[];\n};\n\nexport type CoreMessage =\n | CoreSystemMessage\n | CoreUserMessage\n | CoreAssistantMessage;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/package.json
CHANGED
@@ -43,7 +43,12 @@ export const fromCoreMessage = (
|
|
43
43
|
}),
|
44
44
|
status,
|
45
45
|
|
46
|
-
metadata: {
|
46
|
+
metadata: {
|
47
|
+
unstable_annotations: [],
|
48
|
+
unstable_data: [],
|
49
|
+
steps: [],
|
50
|
+
custom: {},
|
51
|
+
},
|
47
52
|
} satisfies ThreadMessage;
|
48
53
|
|
49
54
|
case "user":
|
@@ -131,6 +131,13 @@ export function assistantDecoderStream() {
|
|
131
131
|
break;
|
132
132
|
}
|
133
133
|
|
134
|
+
case AssistantStreamChunkType.Annotation:
|
135
|
+
controller.enqueue({
|
136
|
+
type: "annotations",
|
137
|
+
annotations: value,
|
138
|
+
});
|
139
|
+
break;
|
140
|
+
|
134
141
|
case AssistantStreamChunkType.Data:
|
135
142
|
controller.enqueue({
|
136
143
|
type: "data",
|
@@ -141,7 +148,6 @@ export function assistantDecoderStream() {
|
|
141
148
|
// TODO
|
142
149
|
case AssistantStreamChunkType.ReasoningDelta:
|
143
150
|
case AssistantStreamChunkType.StartStep:
|
144
|
-
case AssistantStreamChunkType.Annotation:
|
145
151
|
break;
|
146
152
|
|
147
153
|
default: {
|
@@ -44,6 +44,14 @@ export function assistantEncoderStream() {
|
|
44
44
|
break;
|
45
45
|
}
|
46
46
|
|
47
|
+
case "annotations": {
|
48
|
+
controller.enqueue({
|
49
|
+
type: AssistantStreamChunkType.Annotation,
|
50
|
+
value: chunk.annotations,
|
51
|
+
});
|
52
|
+
break;
|
53
|
+
}
|
54
|
+
|
47
55
|
case "data": {
|
48
56
|
controller.enqueue({
|
49
57
|
type: AssistantStreamChunkType.Data,
|
@@ -38,6 +38,12 @@ export function runResultStream() {
|
|
38
38
|
case "response-metadata":
|
39
39
|
break;
|
40
40
|
|
41
|
+
case "annotations": {
|
42
|
+
message = appendAnnotations(message, chunk);
|
43
|
+
controller.enqueue(message);
|
44
|
+
break;
|
45
|
+
}
|
46
|
+
|
41
47
|
case "data": {
|
42
48
|
message = appendData(message, chunk);
|
43
49
|
controller.enqueue(message);
|
@@ -194,6 +200,22 @@ const appendOrUpdateToolResult = (
|
|
194
200
|
};
|
195
201
|
};
|
196
202
|
|
203
|
+
const appendAnnotations = (
|
204
|
+
message: CoreChatModelRunResult,
|
205
|
+
chunk: ToolResultStreamPart & { type: "annotations" },
|
206
|
+
): CoreChatModelRunResult => {
|
207
|
+
return {
|
208
|
+
...message,
|
209
|
+
metadata: {
|
210
|
+
...message.metadata,
|
211
|
+
unstable_annotations: [
|
212
|
+
...(message.metadata?.unstable_annotations ?? []),
|
213
|
+
...chunk.annotations,
|
214
|
+
],
|
215
|
+
},
|
216
|
+
};
|
217
|
+
};
|
218
|
+
|
197
219
|
const appendData = (
|
198
220
|
message: CoreChatModelRunResult,
|
199
221
|
chunk: ToolResultStreamPart & { type: "data" },
|
@@ -5,6 +5,10 @@ import sjson from "secure-json-parse";
|
|
5
5
|
|
6
6
|
export type ToolResultStreamPart =
|
7
7
|
| LanguageModelV1StreamPart
|
8
|
+
| {
|
9
|
+
type: "annotations";
|
10
|
+
annotations: JSONValue[];
|
11
|
+
}
|
8
12
|
| {
|
9
13
|
type: "data";
|
10
14
|
data: JSONValue[];
|
@@ -127,6 +131,7 @@ export function toolResultStream(
|
|
127
131
|
case "finish":
|
128
132
|
case "error":
|
129
133
|
case "response-metadata":
|
134
|
+
case "annotations":
|
130
135
|
case "data":
|
131
136
|
break;
|
132
137
|
|
@@ -4,9 +4,7 @@ import { ExternalStoreAdapter } from "./ExternalStoreAdapter";
|
|
4
4
|
import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
|
5
5
|
|
6
6
|
const getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {
|
7
|
-
return {
|
8
|
-
...store.adapters?.threadList,
|
9
|
-
};
|
7
|
+
return store.adapters?.threadList ?? {};
|
10
8
|
};
|
11
9
|
|
12
10
|
export class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
|
@@ -38,7 +38,8 @@ export type ThreadMessageLike = {
|
|
38
38
|
readonly attachments?: readonly CompleteAttachment[] | undefined;
|
39
39
|
readonly metadata?:
|
40
40
|
| {
|
41
|
-
readonly
|
41
|
+
readonly unstable_annotations?: readonly unknown[] | undefined;
|
42
|
+
readonly unstable_data?: readonly unknown[] | undefined;
|
42
43
|
readonly steps?: readonly ThreadStep[] | undefined;
|
43
44
|
readonly custom?: Record<string, unknown> | undefined;
|
44
45
|
}
|
@@ -105,6 +106,7 @@ export const fromThreadMessageLike = (
|
|
105
106
|
.filter((c) => !!c),
|
106
107
|
status: status ?? fallbackStatus,
|
107
108
|
metadata: {
|
109
|
+
unstable_annotations: metadata?.unstable_annotations ?? [],
|
108
110
|
unstable_data: metadata?.unstable_data ?? [],
|
109
111
|
custom: metadata?.custom ?? {},
|
110
112
|
steps: metadata?.steps ?? [],
|
@@ -109,6 +109,12 @@ const joinExternalMessages = (
|
|
109
109
|
|
110
110
|
if (output.metadata) {
|
111
111
|
assistantMessage.metadata ??= {};
|
112
|
+
if (output.metadata.unstable_annotations) {
|
113
|
+
assistantMessage.metadata.unstable_annotations = [
|
114
|
+
...(assistantMessage.metadata.unstable_annotations ?? []),
|
115
|
+
...output.metadata.unstable_annotations,
|
116
|
+
];
|
117
|
+
}
|
112
118
|
if (output.metadata.unstable_data) {
|
113
119
|
assistantMessage.metadata.unstable_data = [
|
114
120
|
...(assistantMessage.metadata.unstable_data ?? []),
|
@@ -18,6 +18,7 @@ export type ChatModelRunResult = {
|
|
18
18
|
content?: ThreadAssistantContentPart[] | undefined;
|
19
19
|
status?: MessageStatus | undefined;
|
20
20
|
metadata?: {
|
21
|
+
unstable_annotations?: unknown[] | undefined;
|
21
22
|
unstable_data?: unknown[] | undefined;
|
22
23
|
steps?: ThreadStep[] | undefined;
|
23
24
|
custom?: Record<string, unknown> | undefined;
|
@@ -118,7 +118,12 @@ export class LocalThreadRuntimeCore
|
|
118
118
|
role: "assistant",
|
119
119
|
status: { type: "running" },
|
120
120
|
content: [],
|
121
|
-
metadata: {
|
121
|
+
metadata: {
|
122
|
+
unstable_annotations: [],
|
123
|
+
unstable_data: [],
|
124
|
+
steps: [],
|
125
|
+
custom: {},
|
126
|
+
},
|
122
127
|
createdAt: new Date(),
|
123
128
|
};
|
124
129
|
|
@@ -150,6 +155,7 @@ export class LocalThreadRuntimeCore
|
|
150
155
|
this.abortController = new AbortController();
|
151
156
|
|
152
157
|
const initialContent = message.content;
|
158
|
+
const initialAnnotations = message.metadata?.unstable_annotations;
|
153
159
|
const initialData = message.metadata?.unstable_data;
|
154
160
|
const initialSteps = message.metadata?.steps;
|
155
161
|
const initalCustom = message.metadata?.custom;
|
@@ -159,7 +165,11 @@ export class LocalThreadRuntimeCore
|
|
159
165
|
? [...(initialSteps ?? []), ...newSteps]
|
160
166
|
: undefined;
|
161
167
|
|
168
|
+
const newAnnotations = m.metadata?.unstable_annotations;
|
162
169
|
const newData = m.metadata?.unstable_data;
|
170
|
+
const annotations = newAnnotations
|
171
|
+
? [...(initialAnnotations ?? []), ...newAnnotations]
|
172
|
+
: undefined;
|
163
173
|
const data = newData ? [...(initialData ?? []), ...newData] : undefined;
|
164
174
|
|
165
175
|
message = {
|
@@ -172,6 +182,9 @@ export class LocalThreadRuntimeCore
|
|
172
182
|
? {
|
173
183
|
metadata: {
|
174
184
|
...message.metadata,
|
185
|
+
...(annotations
|
186
|
+
? { unstable_annotations: annotations }
|
187
|
+
: undefined),
|
175
188
|
...(data ? { unstable_data: data } : undefined),
|
176
189
|
...(steps ? { steps } : undefined),
|
177
190
|
...(m.metadata?.custom
|
package/src/tailwindcss/index.ts
CHANGED
@@ -81,7 +81,7 @@ const auiPlugin = plugin.withOptions<AssisstantTailwindPluginOptions>(
|
|
81
81
|
components = ["assistant-modal", "thread"],
|
82
82
|
colors = {},
|
83
83
|
shadcn = false,
|
84
|
-
}) => {
|
84
|
+
} = {}) => {
|
85
85
|
const prefix = !shadcn ? "--aui-" : "--";
|
86
86
|
return {
|
87
87
|
...(components.length > 0
|
@@ -185,6 +185,7 @@ export type ThreadAssistantMessage = MessageCommonProps & {
|
|
185
185
|
readonly content: readonly ThreadAssistantContentPart[];
|
186
186
|
readonly status: MessageStatus;
|
187
187
|
readonly metadata: {
|
188
|
+
readonly unstable_annotations: readonly unknown[];
|
188
189
|
readonly unstable_data: readonly unknown[];
|
189
190
|
readonly steps: readonly ThreadStep[];
|
190
191
|
readonly custom: Record<string, unknown>;
|
@@ -210,6 +211,7 @@ export type AppendMessage = CoreMessage & {
|
|
210
211
|
type BaseThreadMessage = {
|
211
212
|
readonly status?: ThreadAssistantMessage["status"];
|
212
213
|
readonly metadata: {
|
214
|
+
readonly unstable_annotations?: readonly unknown[];
|
213
215
|
readonly unstable_data?: readonly unknown[];
|
214
216
|
readonly steps?: readonly ThreadStep[];
|
215
217
|
readonly custom: Record<string, unknown>;
|