@assistant-ui/react 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +6 -15
- package/dist/AssistantRuntime-BM_jVV3g.d.mts +0 -23
- package/dist/AssistantRuntime-CBMSAJqH.d.mts +0 -23
- package/dist/AssistantRuntime-C_BvM7ZT.d.ts +0 -23
- package/dist/AssistantRuntime-DELpXWfG.d.ts +0 -23
- package/dist/ModelConfigTypes-B9UY4zxv.d.mts +0 -55
- package/dist/ModelConfigTypes-B9UY4zxv.d.ts +0 -55
- package/dist/ModelConfigTypes-BF5HxVrH.d.mts +0 -55
- package/dist/ModelConfigTypes-BF5HxVrH.d.ts +0 -55
- package/dist/ModelConfigTypes-Cf3yjaDu.d.mts +0 -55
- package/dist/ModelConfigTypes-Cf3yjaDu.d.ts +0 -55
- package/dist/ModelConfigTypes-CzmXY3sn.d.mts +0 -55
- package/dist/ModelConfigTypes-CzmXY3sn.d.ts +0 -55
- package/dist/Thread-BMASJT4a.d.ts +0 -15
- package/dist/Thread-UEVsUmvl.d.mts +0 -15
- package/dist/chunk-3XZUKECF.mjs +0 -207
- package/dist/chunk-3XZUKECF.mjs.map +0 -1
- package/dist/chunk-4DQ2CIAD.mjs +0 -69
- package/dist/chunk-4DQ2CIAD.mjs.map +0 -1
- package/dist/chunk-5YONSDN4.mjs +0 -200
- package/dist/chunk-5YONSDN4.mjs.map +0 -1
- package/dist/chunk-CY4TTHR7.mjs +0 -76
- package/dist/chunk-CY4TTHR7.mjs.map +0 -1
- package/dist/chunk-DKAWDNW5.mjs +0 -22
- package/dist/chunk-DKAWDNW5.mjs.map +0 -1
- package/dist/chunk-GQKH2ADD.mjs +0 -165
- package/dist/chunk-GQKH2ADD.mjs.map +0 -1
- package/dist/chunk-J5LGTIGS.mjs +0 -10
- package/dist/chunk-J5LGTIGS.mjs.map +0 -1
- package/dist/chunk-NSBOH42A.mjs +0 -200
- package/dist/chunk-NSBOH42A.mjs.map +0 -1
- package/dist/chunk-X4HBDEFP.mjs +0 -30
- package/dist/chunk-X4HBDEFP.mjs.map +0 -1
- package/dist/experimental.d.mts +0 -86
- package/dist/experimental.d.ts +0 -86
- package/dist/experimental.js +0 -123
- package/dist/experimental.js.map +0 -1
- package/dist/experimental.mjs +0 -34
- package/dist/experimental.mjs.map +0 -1
- package/dist/index.d.mts +0 -289
- package/dist/index.d.ts +0 -289
- package/dist/index.js +0 -1500
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1245
- package/dist/index.mjs.map +0 -1
- package/dist/internal-dlLjX30u.d.mts +0 -75
- package/dist/internal-dlLjX30u.d.ts +0 -75
- package/dist/internal.d.mts +0 -25
- package/dist/internal.d.ts +0 -25
- package/dist/internal.js +0 -225
- package/dist/internal.js.map +0 -1
- package/dist/internal.mjs +0 -10
- package/dist/internal.mjs.map +0 -1
package/dist/experimental.js
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
|
20
|
-
// src/experimental.ts
|
21
|
-
var experimental_exports = {};
|
22
|
-
__export(experimental_exports, {
|
23
|
-
useAssistantContext: () => useAssistantContext,
|
24
|
-
useAssistantInstructions: () => useAssistantInstructions,
|
25
|
-
useComposerContext: () => useComposerContext,
|
26
|
-
useContentPartContext: () => useContentPartContext,
|
27
|
-
useMessageContext: () => useMessageContext,
|
28
|
-
useThreadContext: () => useThreadContext
|
29
|
-
});
|
30
|
-
module.exports = __toCommonJS(experimental_exports);
|
31
|
-
|
32
|
-
// src/context/AssistantContext.ts
|
33
|
-
var import_react = require("react");
|
34
|
-
var AssistantContext = (0, import_react.createContext)(
|
35
|
-
null
|
36
|
-
);
|
37
|
-
var useAssistantContext = () => {
|
38
|
-
const context = (0, import_react.useContext)(AssistantContext);
|
39
|
-
if (!context)
|
40
|
-
throw new Error(
|
41
|
-
"This component must be used within an AssistantRuntimeProvider."
|
42
|
-
);
|
43
|
-
return context;
|
44
|
-
};
|
45
|
-
|
46
|
-
// src/context/ThreadContext.ts
|
47
|
-
var import_react2 = require("react");
|
48
|
-
var ThreadContext = (0, import_react2.createContext)(null);
|
49
|
-
var useThreadContext = () => {
|
50
|
-
const context = (0, import_react2.useContext)(ThreadContext);
|
51
|
-
if (!context)
|
52
|
-
throw new Error("This component must be used within an AssistantRuntimeProvider.");
|
53
|
-
return context;
|
54
|
-
};
|
55
|
-
|
56
|
-
// src/context/ComposerContext.ts
|
57
|
-
var import_react4 = require("react");
|
58
|
-
|
59
|
-
// src/context/MessageContext.ts
|
60
|
-
var import_react3 = require("react");
|
61
|
-
var MessageContext = (0, import_react3.createContext)(null);
|
62
|
-
var useMessageContext = () => {
|
63
|
-
const context = (0, import_react3.useContext)(MessageContext);
|
64
|
-
if (!context)
|
65
|
-
throw new Error(
|
66
|
-
"This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
|
67
|
-
);
|
68
|
-
return context;
|
69
|
-
};
|
70
|
-
|
71
|
-
// src/context/ComposerContext.ts
|
72
|
-
var useComposerContext = () => {
|
73
|
-
const { useComposer } = useThreadContext();
|
74
|
-
const { useComposer: useEditComposer } = (0, import_react4.useContext)(MessageContext) ?? {};
|
75
|
-
return (0, import_react4.useMemo)(
|
76
|
-
() => ({
|
77
|
-
useComposer: useEditComposer ?? useComposer,
|
78
|
-
type: useEditComposer ? "edit" : "new"
|
79
|
-
}),
|
80
|
-
[useEditComposer, useComposer]
|
81
|
-
);
|
82
|
-
};
|
83
|
-
|
84
|
-
// src/context/ContentPartContext.ts
|
85
|
-
var import_react5 = require("react");
|
86
|
-
var ContentPartContext = (0, import_react5.createContext)(
|
87
|
-
null
|
88
|
-
);
|
89
|
-
var useContentPartContext = () => {
|
90
|
-
const context = (0, import_react5.useContext)(ContentPartContext);
|
91
|
-
if (!context)
|
92
|
-
throw new Error(
|
93
|
-
"This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
|
94
|
-
);
|
95
|
-
return context;
|
96
|
-
};
|
97
|
-
|
98
|
-
// src/model-config/useAssistantInstructions.tsx
|
99
|
-
var import_react6 = require("react");
|
100
|
-
var useAssistantInstructions = (instruction) => {
|
101
|
-
const { useModelConfig } = useAssistantContext();
|
102
|
-
const addContextProvider = useModelConfig(
|
103
|
-
(s) => s.registerModelConfigProvider
|
104
|
-
);
|
105
|
-
(0, import_react6.useEffect)(
|
106
|
-
() => addContextProvider(() => {
|
107
|
-
return {
|
108
|
-
system: instruction
|
109
|
-
};
|
110
|
-
}),
|
111
|
-
[addContextProvider, instruction]
|
112
|
-
);
|
113
|
-
};
|
114
|
-
// Annotate the CommonJS export names for ESM import in node:
|
115
|
-
0 && (module.exports = {
|
116
|
-
useAssistantContext,
|
117
|
-
useAssistantInstructions,
|
118
|
-
useComposerContext,
|
119
|
-
useContentPartContext,
|
120
|
-
useMessageContext,
|
121
|
-
useThreadContext
|
122
|
-
});
|
123
|
-
//# sourceMappingURL=experimental.js.map
|
package/dist/experimental.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/experimental.ts","../src/context/AssistantContext.ts","../src/context/ThreadContext.ts","../src/context/ComposerContext.ts","../src/context/MessageContext.ts","../src/context/ContentPartContext.ts","../src/model-config/useAssistantInstructions.tsx"],"sourcesContent":["export type {\n ImageContentPart,\n ToolCallContentPart,\n UIContentPart,\n} from \"./utils/AssistantTypes\";\n\nexport type { ModelConfigProvider } from \"./utils/ModelConfigTypes\";\n\nexport * from \"./context\";\nexport { useAssistantInstructions } from \"./model-config/useAssistantInstructions\";\n","import { createContext, useContext } from \"react\";\nimport type { StoreApi, UseBoundStore } from \"zustand\";\nimport type { AssistantModelConfigState } from \"./stores/AssistantModelConfig\";\n\nexport type AssistantContextValue = {\n useModelConfig: UseBoundStore<StoreApi<AssistantModelConfigState>>;\n};\n\nexport const AssistantContext = createContext<AssistantContextValue | null>(\n null,\n);\n\nexport const useAssistantContext = (): AssistantContextValue => {\n const context = useContext(AssistantContext);\n if (!context)\n throw new Error(\n \"This component must be used within an AssistantRuntimeProvider.\",\n );\n return context;\n};\n","import { createContext, useContext } from \"react\";\nimport type { StoreApi, UseBoundStore } from \"zustand\";\nimport type { ComposerState } from \"./stores/Composer\";\nimport type { ThreadState } from \"./stores/Thread\";\nimport type { ThreadViewportState } from \"./stores/ThreadViewport\";\n\nexport type ThreadContextValue = {\n useThread: UseBoundStore<StoreApi<ThreadState>>;\n useComposer: UseBoundStore<StoreApi<ComposerState>>;\n useViewport: UseBoundStore<StoreApi<ThreadViewportState>>;\n};\n\nexport const ThreadContext = createContext<ThreadContextValue | null>(null);\n\nexport const useThreadContext = (): ThreadContextValue => {\n const context = useContext(ThreadContext);\n if (!context)\n throw new Error(\"This component must be used within an AssistantRuntimeProvider.\");\n return context;\n};\n","import { useContext, useMemo } from \"react\";\nimport type { StoreApi, UseBoundStore } from \"zustand\";\nimport { MessageContext } from \"./MessageContext\";\nimport { useThreadContext } from \"./ThreadContext\";\nimport type { ComposerState } from \"./stores/Composer\";\nimport type { EditComposerState } from \"./stores/MessageComposer\";\n\nexport type ComposerContextValue = {\n useComposer: UseBoundStore<StoreApi<EditComposerState | ComposerState>>;\n type: \"edit\" | \"new\";\n};\n\nexport const useComposerContext = (): ComposerContextValue => {\n const { useComposer } = useThreadContext();\n const { useComposer: useEditComposer } = useContext(MessageContext) ?? {};\n return useMemo(\n () => ({\n useComposer: (useEditComposer ?? useComposer) as UseBoundStore<\n StoreApi<EditComposerState | ComposerState>\n >,\n type: useEditComposer ? (\"edit\" as const) : (\"new\" as const),\n }),\n [useEditComposer, useComposer],\n );\n};\n","import { createContext, useContext } from \"react\";\nimport type { StoreApi, UseBoundStore } from \"zustand\";\nimport type { MessageState } from \"./stores/Message\";\nimport type { EditComposerState } from \"./stores/MessageComposer\";\n\nexport type MessageContextValue = {\n useMessage: UseBoundStore<StoreApi<MessageState>>;\n useComposer: UseBoundStore<StoreApi<EditComposerState>>;\n};\n\nexport const MessageContext = createContext<MessageContextValue | null>(null);\n\nexport const useMessageContext = () => {\n const context = useContext(MessageContext);\n if (!context)\n throw new Error(\n \"This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />.\",\n );\n return context;\n};\n","import { createContext, useContext } from \"react\";\nimport type { StoreApi, UseBoundStore } from \"zustand\";\nimport type { ContentPartState } from \"./stores/ContentPart\";\n\nexport type ContentPartContextValue = {\n useContentPart: UseBoundStore<StoreApi<ContentPartState>>;\n};\n\nexport const ContentPartContext = createContext<ContentPartContextValue | null>(\n null,\n);\n\nexport const useContentPartContext = (): ContentPartContextValue => {\n const context = useContext(ContentPartContext);\n if (!context)\n throw new Error(\n \"This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >.\",\n );\n return context;\n};\n","\"use client\";\n\nimport { useEffect } from \"react\";\nimport { useAssistantContext } from \"../context/AssistantContext\";\n\nexport const useAssistantInstructions = (instruction: string) => {\n const { useModelConfig } = useAssistantContext();\n const addContextProvider = useModelConfig(\n (s) => s.registerModelConfigProvider,\n );\n useEffect(\n () =>\n addContextProvider(() => {\n return {\n system: instruction,\n };\n }),\n [addContextProvider, instruction],\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0C;AAQnC,IAAM,uBAAmB;AAAA,EAC9B;AACF;AAEO,IAAM,sBAAsB,MAA6B;AAC9D,QAAM,cAAU,yBAAW,gBAAgB;AAC3C,MAAI,CAAC;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,SAAO;AACT;;;ACnBA,IAAAA,gBAA0C;AAYnC,IAAM,oBAAgB,6BAAyC,IAAI;AAEnE,IAAM,mBAAmB,MAA0B;AACxD,QAAM,cAAU,0BAAW,aAAa;AACxC,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,iEAAiE;AACnF,SAAO;AACT;;;ACnBA,IAAAC,gBAAoC;;;ACApC,IAAAC,gBAA0C;AAUnC,IAAM,qBAAiB,6BAA0C,IAAI;AAErE,IAAM,oBAAoB,MAAM;AACrC,QAAM,cAAU,0BAAW,cAAc;AACzC,MAAI,CAAC;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,SAAO;AACT;;;ADPO,IAAM,qBAAqB,MAA4B;AAC5D,QAAM,EAAE,YAAY,IAAI,iBAAiB;AACzC,QAAM,EAAE,aAAa,gBAAgB,QAAI,0BAAW,cAAc,KAAK,CAAC;AACxE,aAAO;AAAA,IACL,OAAO;AAAA,MACL,aAAc,mBAAmB;AAAA,MAGjC,MAAM,kBAAmB,SAAoB;AAAA,IAC/C;AAAA,IACA,CAAC,iBAAiB,WAAW;AAAA,EAC/B;AACF;;;AExBA,IAAAC,gBAA0C;AAQnC,IAAM,yBAAqB;AAAA,EAChC;AACF;AAEO,IAAM,wBAAwB,MAA+B;AAClE,QAAM,cAAU,0BAAW,kBAAkB;AAC7C,MAAI,CAAC;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,SAAO;AACT;;;ACjBA,IAAAC,gBAA0B;AAGnB,IAAM,2BAA2B,CAAC,gBAAwB;AAC/D,QAAM,EAAE,eAAe,IAAI,oBAAoB;AAC/C,QAAM,qBAAqB;AAAA,IACzB,CAAC,MAAM,EAAE;AAAA,EACX;AACA;AAAA,IACE,MACE,mBAAmB,MAAM;AACvB,aAAO;AAAA,QACL,QAAQ;AAAA,MACV;AAAA,IACF,CAAC;AAAA,IACH,CAAC,oBAAoB,WAAW;AAAA,EAClC;AACF;","names":["import_react","import_react","import_react","import_react","import_react"]}
|
package/dist/experimental.mjs
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
useAssistantContext,
|
3
|
-
useComposerContext,
|
4
|
-
useContentPartContext,
|
5
|
-
useMessageContext,
|
6
|
-
useThreadContext
|
7
|
-
} from "./chunk-CY4TTHR7.mjs";
|
8
|
-
import "./chunk-J5LGTIGS.mjs";
|
9
|
-
|
10
|
-
// src/model-config/useAssistantInstructions.tsx
|
11
|
-
import { useEffect } from "react";
|
12
|
-
var useAssistantInstructions = (instruction) => {
|
13
|
-
const { useModelConfig } = useAssistantContext();
|
14
|
-
const addContextProvider = useModelConfig(
|
15
|
-
(s) => s.registerModelConfigProvider
|
16
|
-
);
|
17
|
-
useEffect(
|
18
|
-
() => addContextProvider(() => {
|
19
|
-
return {
|
20
|
-
system: instruction
|
21
|
-
};
|
22
|
-
}),
|
23
|
-
[addContextProvider, instruction]
|
24
|
-
);
|
25
|
-
};
|
26
|
-
export {
|
27
|
-
useAssistantContext,
|
28
|
-
useAssistantInstructions,
|
29
|
-
useComposerContext,
|
30
|
-
useContentPartContext,
|
31
|
-
useMessageContext,
|
32
|
-
useThreadContext
|
33
|
-
};
|
34
|
-
//# sourceMappingURL=experimental.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/model-config/useAssistantInstructions.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport { useAssistantContext } from \"../context/AssistantContext\";\n\nexport const useAssistantInstructions = (instruction: string) => {\n const { useModelConfig } = useAssistantContext();\n const addContextProvider = useModelConfig(\n (s) => s.registerModelConfigProvider,\n );\n useEffect(\n () =>\n addContextProvider(() => {\n return {\n system: instruction,\n };\n }),\n [addContextProvider, instruction],\n );\n};\n"],"mappings":";;;;;;;;;;AAEA,SAAS,iBAAiB;AAGnB,IAAM,2BAA2B,CAAC,gBAAwB;AAC/D,QAAM,EAAE,eAAe,IAAI,oBAAoB;AAC/C,QAAM,qBAAqB;AAAA,IACzB,CAAC,MAAM,EAAE;AAAA,EACX;AACA;AAAA,IACE,MACE,mBAAmB,MAAM;AACvB,aAAO;AAAA,QACL,QAAQ;AAAA,MACV;AAAA,IACF,CAAC;AAAA,IACH,CAAC,oBAAoB,WAAW;AAAA,EAClC;AACF;","names":[]}
|
package/dist/index.d.mts
DELETED
@@ -1,289 +0,0 @@
|
|
1
|
-
import * as react from 'react';
|
2
|
-
import { FC, ReactNode, PropsWithChildren, ComponentType } from 'react';
|
3
|
-
import { TextareaAutosizeProps } from 'react-textarea-autosize';
|
4
|
-
import { T as TextContentPart, I as ImageContentPart, U as UIContentPart, a as ToolCallContentPart, M as ModelConfigProvider, b as ThreadMessage, c as ModelConfig, A as AssistantContentPart, d as AppendMessage } from './ModelConfigTypes-CzmXY3sn.mjs';
|
5
|
-
export { h as AppendContentPart, e as AssistantMessage, g as UserContentPart, f as UserMessage } from './ModelConfigTypes-CzmXY3sn.mjs';
|
6
|
-
import { T as ThreadState, U as Unsubscribe } from './Thread-UEVsUmvl.mjs';
|
7
|
-
import 'zod';
|
8
|
-
|
9
|
-
declare const useCopyMessage: ({ copiedDuration }: {
|
10
|
-
copiedDuration?: number | undefined;
|
11
|
-
}) => (() => void) | null;
|
12
|
-
|
13
|
-
declare const useReloadMessage: () => (() => void) | null;
|
14
|
-
|
15
|
-
declare const useBeginMessageEdit: () => (() => void) | null;
|
16
|
-
|
17
|
-
declare const useGoToNextBranch: () => (() => void) | null;
|
18
|
-
|
19
|
-
declare const useGoToPreviousBranch: () => (() => void) | null;
|
20
|
-
|
21
|
-
declare const ThreadRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
22
|
-
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
23
|
-
} & {
|
24
|
-
asChild?: boolean;
|
25
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & react.RefAttributes<HTMLDivElement>>;
|
26
|
-
|
27
|
-
type ThreadEmptyProps = {
|
28
|
-
children: ReactNode;
|
29
|
-
};
|
30
|
-
declare const ThreadEmpty: FC<ThreadEmptyProps>;
|
31
|
-
|
32
|
-
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
33
|
-
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
34
|
-
}[Keys];
|
35
|
-
|
36
|
-
type ThreadIfFilters = {
|
37
|
-
empty: boolean | undefined;
|
38
|
-
running: boolean | undefined;
|
39
|
-
};
|
40
|
-
type ThreadIfProps = PropsWithChildren<RequireAtLeastOne<ThreadIfFilters>>;
|
41
|
-
declare const ThreadIf: FC<ThreadIfProps>;
|
42
|
-
|
43
|
-
declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
44
|
-
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
45
|
-
} & {
|
46
|
-
asChild?: boolean;
|
47
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
48
|
-
autoScroll?: boolean;
|
49
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
50
|
-
|
51
|
-
type ThreadMessagesProps = {
|
52
|
-
components: {
|
53
|
-
Message: ComponentType;
|
54
|
-
UserMessage?: ComponentType;
|
55
|
-
EditComposer?: ComponentType;
|
56
|
-
AssistantMessage?: ComponentType;
|
57
|
-
} | {
|
58
|
-
Message?: ComponentType;
|
59
|
-
UserMessage: ComponentType;
|
60
|
-
EditComposer?: ComponentType;
|
61
|
-
AssistantMessage: ComponentType;
|
62
|
-
};
|
63
|
-
};
|
64
|
-
declare const ThreadMessages: FC<ThreadMessagesProps>;
|
65
|
-
|
66
|
-
declare const ThreadScrollToBottom: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
67
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
68
|
-
} & {
|
69
|
-
asChild?: boolean;
|
70
|
-
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
|
71
|
-
|
72
|
-
declare const ThreadSuggestion: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
73
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
74
|
-
} & {
|
75
|
-
asChild?: boolean;
|
76
|
-
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
77
|
-
prompt: string;
|
78
|
-
method: "replace";
|
79
|
-
autoSend?: boolean;
|
80
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
81
|
-
|
82
|
-
declare namespace index$5 {
|
83
|
-
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadScrollToBottom as ScrollToBottom, ThreadSuggestion as Suggestion, ThreadViewport as Viewport };
|
84
|
-
}
|
85
|
-
|
86
|
-
declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & {
|
87
|
-
ref?: ((instance: HTMLFormElement | null) => void) | react.RefObject<HTMLFormElement> | null | undefined;
|
88
|
-
} & {
|
89
|
-
asChild?: boolean;
|
90
|
-
}, "key" | "asChild" | keyof react.FormHTMLAttributes<HTMLFormElement>> & react.RefAttributes<HTMLFormElement>>;
|
91
|
-
|
92
|
-
declare const ComposerInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
|
93
|
-
asChild?: boolean;
|
94
|
-
} & react.RefAttributes<HTMLTextAreaElement>>;
|
95
|
-
|
96
|
-
declare const ComposerSend: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
97
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
98
|
-
} & {
|
99
|
-
asChild?: boolean;
|
100
|
-
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
|
101
|
-
|
102
|
-
declare const ComposerCancel: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
103
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
104
|
-
} & {
|
105
|
-
asChild?: boolean;
|
106
|
-
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
|
107
|
-
|
108
|
-
type ComposerIfFilters = {
|
109
|
-
editing: boolean | undefined;
|
110
|
-
};
|
111
|
-
type ComposerIfProps = PropsWithChildren<RequireAtLeastOne<ComposerIfFilters>>;
|
112
|
-
declare const ComposerIf: FC<ComposerIfProps>;
|
113
|
-
|
114
|
-
declare namespace index$4 {
|
115
|
-
export { ComposerCancel as Cancel, ComposerIf as If, ComposerInput as Input, ComposerRoot as Root, ComposerSend as Send };
|
116
|
-
}
|
117
|
-
|
118
|
-
declare const MessageRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
119
|
-
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
120
|
-
} & {
|
121
|
-
asChild?: boolean;
|
122
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & react.RefAttributes<HTMLDivElement>>;
|
123
|
-
|
124
|
-
type MessageIfFilters = {
|
125
|
-
user: boolean | undefined;
|
126
|
-
assistant: boolean | undefined;
|
127
|
-
hasBranches: boolean | undefined;
|
128
|
-
copied: boolean | undefined;
|
129
|
-
lastOrHover: boolean | undefined;
|
130
|
-
};
|
131
|
-
type MessageIfProps = RequireAtLeastOne<MessageIfFilters> & {
|
132
|
-
children: ReactNode;
|
133
|
-
};
|
134
|
-
declare const MessageIf: FC<MessageIfProps>;
|
135
|
-
|
136
|
-
type MessageContentProps = {
|
137
|
-
components?: {
|
138
|
-
Text?: ComponentType<{
|
139
|
-
part: TextContentPart;
|
140
|
-
}>;
|
141
|
-
Image?: ComponentType<{
|
142
|
-
part: ImageContentPart;
|
143
|
-
}>;
|
144
|
-
UI?: ComponentType<{
|
145
|
-
part: UIContentPart;
|
146
|
-
}>;
|
147
|
-
tools?: {
|
148
|
-
by_name?: Record<string, ComponentType<{
|
149
|
-
part: ToolCallContentPart;
|
150
|
-
}>>;
|
151
|
-
Fallback?: ComponentType<{
|
152
|
-
part: ToolCallContentPart;
|
153
|
-
}>;
|
154
|
-
};
|
155
|
-
};
|
156
|
-
};
|
157
|
-
declare const MessageContent: FC<MessageContentProps>;
|
158
|
-
|
159
|
-
declare const MessageInProgress: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
160
|
-
ref?: ((instance: HTMLSpanElement | null) => void) | react.RefObject<HTMLSpanElement> | null | undefined;
|
161
|
-
} & {
|
162
|
-
asChild?: boolean;
|
163
|
-
}, "key" | "asChild" | keyof react.HTMLAttributes<HTMLSpanElement>> & react.RefAttributes<HTMLSpanElement>>;
|
164
|
-
|
165
|
-
declare namespace index$3 {
|
166
|
-
export { MessageContent as Content, MessageIf as If, MessageInProgress as InProgress, MessageRoot as Root };
|
167
|
-
}
|
168
|
-
|
169
|
-
declare const BranchPickerNext: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
170
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
171
|
-
} & {
|
172
|
-
asChild?: boolean;
|
173
|
-
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
|
174
|
-
|
175
|
-
declare const BranchPickerPrevious: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
176
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
177
|
-
} & {
|
178
|
-
asChild?: boolean;
|
179
|
-
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
|
180
|
-
|
181
|
-
declare const BranchPickerCount: FC;
|
182
|
-
|
183
|
-
declare const BranchPickerNumber: FC;
|
184
|
-
|
185
|
-
declare const BranchPickerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
186
|
-
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
187
|
-
} & {
|
188
|
-
asChild?: boolean;
|
189
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
190
|
-
hideWhenSingleBranch?: boolean;
|
191
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
192
|
-
|
193
|
-
declare namespace index$2 {
|
194
|
-
export { BranchPickerCount as Count, BranchPickerNext as Next, BranchPickerNumber as Number, BranchPickerPrevious as Previous, BranchPickerRoot as Root };
|
195
|
-
}
|
196
|
-
|
197
|
-
declare const ActionBarRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
198
|
-
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
199
|
-
} & {
|
200
|
-
asChild?: boolean;
|
201
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
202
|
-
hideWhenRunning?: boolean;
|
203
|
-
autohide?: "always" | "not-last" | "never";
|
204
|
-
autohideFloat?: "always" | "single-branch" | "never";
|
205
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
206
|
-
|
207
|
-
type ActionBarCopyProps = {
|
208
|
-
copiedDuration?: number;
|
209
|
-
};
|
210
|
-
declare const ActionBarCopy: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
211
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
212
|
-
} & {
|
213
|
-
asChild?: boolean;
|
214
|
-
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & ActionBarCopyProps & react.RefAttributes<HTMLButtonElement>>;
|
215
|
-
|
216
|
-
declare const ActionBarReload: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
217
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
218
|
-
} & {
|
219
|
-
asChild?: boolean;
|
220
|
-
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
|
221
|
-
|
222
|
-
declare const ActionBarEdit: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
223
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
224
|
-
} & {
|
225
|
-
asChild?: boolean;
|
226
|
-
}, "key" | "asChild" | keyof react.ButtonHTMLAttributes<HTMLButtonElement>> & react.RefAttributes<HTMLButtonElement>>;
|
227
|
-
|
228
|
-
declare namespace index$1 {
|
229
|
-
export { ActionBarCopy as Copy, ActionBarEdit as Edit, ActionBarReload as Reload, ActionBarRoot as Root };
|
230
|
-
}
|
231
|
-
|
232
|
-
declare const ContentPartInProgressIndicator: FC;
|
233
|
-
|
234
|
-
declare namespace index {
|
235
|
-
export { ContentPartInProgressIndicator as InProgressIndicator };
|
236
|
-
}
|
237
|
-
|
238
|
-
type ThreadRuntime = Readonly<ThreadState & {
|
239
|
-
subscribe: (callback: () => void) => Unsubscribe;
|
240
|
-
}>;
|
241
|
-
|
242
|
-
type AssistantRuntime = ThreadRuntime & {
|
243
|
-
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
244
|
-
};
|
245
|
-
|
246
|
-
type ReactThreadRuntime = ThreadRuntime & {
|
247
|
-
unstable_synchronizer?: ComponentType;
|
248
|
-
};
|
249
|
-
|
250
|
-
type ChatModelRunResult = {
|
251
|
-
content: AssistantContentPart[];
|
252
|
-
};
|
253
|
-
type ChatModelRunOptions = {
|
254
|
-
messages: ThreadMessage[];
|
255
|
-
abortSignal: AbortSignal;
|
256
|
-
config: ModelConfig;
|
257
|
-
onUpdate: (result: ChatModelRunResult) => void;
|
258
|
-
};
|
259
|
-
type ChatModelAdapter = {
|
260
|
-
run: (options: ChatModelRunOptions) => Promise<ChatModelRunResult>;
|
261
|
-
};
|
262
|
-
|
263
|
-
declare class LocalRuntime implements AssistantRuntime {
|
264
|
-
adapter: ChatModelAdapter;
|
265
|
-
private _subscriptions;
|
266
|
-
private _configProviders;
|
267
|
-
private abortController;
|
268
|
-
private repository;
|
269
|
-
get messages(): ThreadMessage[];
|
270
|
-
get isRunning(): boolean;
|
271
|
-
constructor(adapter: ChatModelAdapter);
|
272
|
-
getBranches(messageId: string): string[];
|
273
|
-
switchToBranch(branchId: string): void;
|
274
|
-
append(message: AppendMessage): Promise<void>;
|
275
|
-
startRun(parentId: string | null): Promise<void>;
|
276
|
-
cancelRun(): void;
|
277
|
-
private notifySubscribers;
|
278
|
-
subscribe(callback: () => void): Unsubscribe;
|
279
|
-
registerModelConfigProvider(provider: ModelConfigProvider): () => boolean;
|
280
|
-
}
|
281
|
-
|
282
|
-
declare const useLocalRuntime: (adapter: ChatModelAdapter) => LocalRuntime;
|
283
|
-
|
284
|
-
type AssistantRuntimeProviderProps = {
|
285
|
-
runtime: AssistantRuntime;
|
286
|
-
};
|
287
|
-
declare const AssistantRuntimeProvider: react.NamedExoticComponent<PropsWithChildren<AssistantRuntimeProviderProps>>;
|
288
|
-
|
289
|
-
export { index$1 as ActionBarPrimitive, AppendMessage, AssistantContentPart, type AssistantRuntime, AssistantRuntimeProvider, index$2 as BranchPickerPrimitive, type ChatModelAdapter, type ChatModelRunOptions, index$4 as ComposerPrimitive, index as ContentPartPrimitive, index$3 as MessagePrimitive, type ReactThreadRuntime, TextContentPart, ThreadMessage, index$5 as ThreadPrimitive, type ThreadRuntime, Unsubscribe, useBeginMessageEdit, useCopyMessage, useGoToNextBranch, useGoToPreviousBranch, useLocalRuntime, useReloadMessage };
|