@assistant-ui/react 0.7.75 → 0.7.77
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/README.md +36 -0
- package/dist/api/AssistantRuntime.d.ts +1 -1
- package/dist/api/AssistantRuntime.js +1 -1
- package/dist/api/AssistantRuntime.js.map +1 -1
- package/dist/api/AssistantRuntime.mjs +1 -1
- package/dist/api/AssistantRuntime.mjs.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +1 -1
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.mjs +1 -1
- package/dist/primitives/threadList/ThreadListItems.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js +2 -2
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs +2 -2
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.js +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.mjs +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts +4 -5
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.js +2 -2
- package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.mjs +2 -2
- package/dist/runtimes/local/LocalRuntimeOptions.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +2 -8
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +2 -8
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/shouldContinue.d.ts +1 -1
- package/dist/runtimes/local/shouldContinue.d.ts.map +1 -1
- package/dist/runtimes/local/shouldContinue.js +8 -3
- package/dist/runtimes/local/shouldContinue.js.map +1 -1
- package/dist/runtimes/local/shouldContinue.mjs +8 -3
- package/dist/runtimes/local/shouldContinue.mjs.map +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +7 -7
- package/dist/styles/tailwindcss/thread.css.json +6 -6
- package/package.json +3 -3
- package/src/api/AssistantRuntime.ts +2 -2
- package/src/context/providers/AssistantRuntimeProvider.tsx +1 -1
- package/src/primitives/threadList/ThreadListItems.tsx +2 -2
- package/src/runtimes/edge/converters/toLanguageModelMessages.ts +5 -2
- package/src/runtimes/edge/streams/toolResultStream.ts +1 -1
- package/src/runtimes/local/LocalRuntimeOptions.tsx +4 -5
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +2 -10
- package/src/runtimes/local/shouldContinue.tsx +21 -9
- package/src/styles/tailwindcss/thread.css +7 -7
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<a href="https://www.assistant-ui.com">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/header.svg" alt="assistant-ui Header" width="100%" style="width: 1000px" />
|
|
3
|
+
</a>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.assistant-ui.com">Product</a> ·
|
|
7
|
+
<a href="https://www.assistant-ui.com/docs/getting-started">Documentation</a> ·
|
|
8
|
+
<a href="https://www.assistant-ui.com/examples">Examples</a> ·
|
|
9
|
+
<a href="https://discord.gg/S9dwgCNEFs">Discord Community</a> ·
|
|
10
|
+
<a href="https://cal.com/simon-farshid/assistant-ui">Contact Sales</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
**assistant-ui** is a set of React components for AI chat, with integrations Langchain, Vercel AI SDK, TailwindCSS, shadcn/ui, react-markdown, react-syntax-highlighter, React Hook Form and more!
|
|
14
|
+
|
|
15
|
+
Wide model provider support (OpenAI, Anthropic, Mistral, Perplexity, AWS Bedrock, Azure, Google Gemini, Hugging Face, Fireworks, Cohere, Replicate, Ollama) out of the box and the ability to integrate custom APIs.
|
|
16
|
+
|
|
17
|
+
[](https://app.workweave.ai/reports/repository/org_GhSIrtWo37b5B3Mv0At3wQ1Q/722184017)
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
[](https://youtu.be/k6Dc8URmLjk)
|
|
22
|
+
|
|
23
|
+
Step 1: Run `assistant-ui init` to install assistant-ui in a new or existing React.js project:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx assistant-ui@latest create # new project
|
|
27
|
+
npx assistant-ui@latest init # existing project
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Step 2: Update the `.env` file with your OpenAI API key.
|
|
31
|
+
|
|
32
|
+
Step 3: Run the app:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm run dev
|
|
36
|
+
```
|
|
@@ -29,7 +29,7 @@ var AssistantRuntimeImpl = class _AssistantRuntimeImpl {
|
|
|
29
29
|
constructor(_core, runtimeFactory = import_ThreadRuntime.ThreadRuntimeImpl) {
|
|
30
30
|
this._core = _core;
|
|
31
31
|
this.threads = new import_ThreadListRuntime.ThreadListRuntimeImpl(_core.threads, runtimeFactory);
|
|
32
|
-
this._thread = this.
|
|
32
|
+
this._thread = this.threads.main;
|
|
33
33
|
}
|
|
34
34
|
threads;
|
|
35
35
|
get threadList() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/AssistantRuntime.ts"],"sourcesContent":["import { AssistantRuntimeCore } from \"../runtimes/core/AssistantRuntimeCore\";\nimport { ModelContextProvider } from \"../model-context/ModelContextTypes\";\nimport {\n ThreadListItemRuntimeBinding,\n ThreadRuntime,\n ThreadRuntimeCoreBinding,\n ThreadRuntimeImpl,\n} from \"./ThreadRuntime\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListRuntime, ThreadListRuntimeImpl } from \"./ThreadListRuntime\";\n\nexport type AssistantRuntime = {\n /**\n * The threads in this assistant.\n */\n readonly threads: ThreadListRuntime;\n\n /**\n * The currently selected main thread. Equivalent to `threads.main`.\n */\n readonly thread: ThreadRuntime;\n\n /**\n * @deprecated This field was renamed to `threads
|
|
1
|
+
{"version":3,"sources":["../../src/api/AssistantRuntime.ts"],"sourcesContent":["import { AssistantRuntimeCore } from \"../runtimes/core/AssistantRuntimeCore\";\nimport { ModelContextProvider } from \"../model-context/ModelContextTypes\";\nimport {\n ThreadListItemRuntimeBinding,\n ThreadRuntime,\n ThreadRuntimeCoreBinding,\n ThreadRuntimeImpl,\n} from \"./ThreadRuntime\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListRuntime, ThreadListRuntimeImpl } from \"./ThreadListRuntime\";\n\nexport type AssistantRuntime = {\n /**\n * The threads in this assistant.\n */\n readonly threads: ThreadListRuntime;\n\n /**\n * The currently selected main thread. Equivalent to `threads.main`.\n */\n readonly thread: ThreadRuntime;\n\n /**\n * @deprecated This field was renamed to `threads`.\n */\n readonly threadList: ThreadListRuntime;\n\n /**\n * Switch to a new thread.\n *\n * @deprecated This method was moved to `threads.switchToNewThread`.\n */\n switchToNewThread(): void;\n\n /**\n * Switch to a thread.\n *\n * @param threadId The thread ID to switch to.\n * @deprecated This method was moved to `threads.switchToThread`.\n */\n switchToThread(threadId: string): void;\n\n /**\n * Register a model context provider. Model context providers are configuration such as system message, temperature, etc. that are set in the frontend.\n *\n * @param provider The model context provider to register.\n */\n registerModelContextProvider(provider: ModelContextProvider): Unsubscribe;\n\n /**\n * @deprecated This method was renamed to `registerModelContextProvider`.\n */\n registerModelConfigProvider(provider: ModelContextProvider): Unsubscribe;\n};\n\nexport class AssistantRuntimeImpl implements AssistantRuntime {\n public readonly threads;\n public get threadList() {\n return this.threads;\n }\n\n public readonly _thread: ThreadRuntime;\n\n protected constructor(\n private readonly _core: AssistantRuntimeCore,\n runtimeFactory: new (\n binding: ThreadRuntimeCoreBinding,\n threadListItemBinding: ThreadListItemRuntimeBinding,\n ) => ThreadRuntime = ThreadRuntimeImpl,\n ) {\n this.threads = new ThreadListRuntimeImpl(_core.threads, runtimeFactory);\n this._thread = this.threads.main;\n }\n\n protected __internal_bindMethods() {\n this.switchToNewThread = this.switchToNewThread.bind(this);\n this.switchToThread = this.switchToThread.bind(this);\n this.registerModelContextProvider =\n this.registerModelContextProvider.bind(this);\n this.registerModelConfigProvider =\n this.registerModelConfigProvider.bind(this);\n }\n\n public get thread() {\n return this._thread;\n }\n\n public switchToNewThread() {\n return this._core.threads.switchToNewThread();\n }\n\n public switchToThread(threadId: string) {\n return this._core.threads.switchToThread(threadId);\n }\n\n public registerModelContextProvider(provider: ModelContextProvider) {\n return this._core.registerModelContextProvider(provider);\n }\n\n public registerModelConfigProvider(provider: ModelContextProvider) {\n return this.registerModelContextProvider(provider);\n }\n\n public static create(\n _core: AssistantRuntimeCore,\n runtimeFactory: new (\n binding: ThreadRuntimeCoreBinding,\n threadListItemBinding: ThreadListItemRuntimeBinding,\n ) => ThreadRuntime = ThreadRuntimeImpl,\n ): AssistantRuntime {\n return new AssistantRuntimeImpl(_core, runtimeFactory);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAKO;AAEP,+BAAyD;AA8ClD,IAAM,uBAAN,MAAM,sBAAiD;AAAA,EAQlD,YACS,OACjB,iBAGqB,wCACrB;AALiB;AAMjB,SAAK,UAAU,IAAI,+CAAsB,MAAM,SAAS,cAAc;AACtE,SAAK,UAAU,KAAK,QAAQ;AAAA,EAC9B;AAAA,EAhBgB;AAAA,EAChB,IAAW,aAAa;AACtB,WAAO,KAAK;AAAA,EACd;AAAA,EAEgB;AAAA,EAaN,yBAAyB;AACjC,SAAK,oBAAoB,KAAK,kBAAkB,KAAK,IAAI;AACzD,SAAK,iBAAiB,KAAK,eAAe,KAAK,IAAI;AACnD,SAAK,+BACH,KAAK,6BAA6B,KAAK,IAAI;AAC7C,SAAK,8BACH,KAAK,4BAA4B,KAAK,IAAI;AAAA,EAC9C;AAAA,EAEA,IAAW,SAAS;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEO,oBAAoB;AACzB,WAAO,KAAK,MAAM,QAAQ,kBAAkB;AAAA,EAC9C;AAAA,EAEO,eAAe,UAAkB;AACtC,WAAO,KAAK,MAAM,QAAQ,eAAe,QAAQ;AAAA,EACnD;AAAA,EAEO,6BAA6B,UAAgC;AAClE,WAAO,KAAK,MAAM,6BAA6B,QAAQ;AAAA,EACzD;AAAA,EAEO,4BAA4B,UAAgC;AACjE,WAAO,KAAK,6BAA6B,QAAQ;AAAA,EACnD;AAAA,EAEA,OAAc,OACZ,OACA,iBAGqB,wCACH;AAClB,WAAO,IAAI,sBAAqB,OAAO,cAAc;AAAA,EACvD;AACF;","names":[]}
|
|
@@ -7,7 +7,7 @@ var AssistantRuntimeImpl = class _AssistantRuntimeImpl {
|
|
|
7
7
|
constructor(_core, runtimeFactory = ThreadRuntimeImpl) {
|
|
8
8
|
this._core = _core;
|
|
9
9
|
this.threads = new ThreadListRuntimeImpl(_core.threads, runtimeFactory);
|
|
10
|
-
this._thread = this.
|
|
10
|
+
this._thread = this.threads.main;
|
|
11
11
|
}
|
|
12
12
|
threads;
|
|
13
13
|
get threadList() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/AssistantRuntime.ts"],"sourcesContent":["import { AssistantRuntimeCore } from \"../runtimes/core/AssistantRuntimeCore\";\nimport { ModelContextProvider } from \"../model-context/ModelContextTypes\";\nimport {\n ThreadListItemRuntimeBinding,\n ThreadRuntime,\n ThreadRuntimeCoreBinding,\n ThreadRuntimeImpl,\n} from \"./ThreadRuntime\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListRuntime, ThreadListRuntimeImpl } from \"./ThreadListRuntime\";\n\nexport type AssistantRuntime = {\n /**\n * The threads in this assistant.\n */\n readonly threads: ThreadListRuntime;\n\n /**\n * The currently selected main thread. Equivalent to `threads.main`.\n */\n readonly thread: ThreadRuntime;\n\n /**\n * @deprecated This field was renamed to `threads
|
|
1
|
+
{"version":3,"sources":["../../src/api/AssistantRuntime.ts"],"sourcesContent":["import { AssistantRuntimeCore } from \"../runtimes/core/AssistantRuntimeCore\";\nimport { ModelContextProvider } from \"../model-context/ModelContextTypes\";\nimport {\n ThreadListItemRuntimeBinding,\n ThreadRuntime,\n ThreadRuntimeCoreBinding,\n ThreadRuntimeImpl,\n} from \"./ThreadRuntime\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListRuntime, ThreadListRuntimeImpl } from \"./ThreadListRuntime\";\n\nexport type AssistantRuntime = {\n /**\n * The threads in this assistant.\n */\n readonly threads: ThreadListRuntime;\n\n /**\n * The currently selected main thread. Equivalent to `threads.main`.\n */\n readonly thread: ThreadRuntime;\n\n /**\n * @deprecated This field was renamed to `threads`.\n */\n readonly threadList: ThreadListRuntime;\n\n /**\n * Switch to a new thread.\n *\n * @deprecated This method was moved to `threads.switchToNewThread`.\n */\n switchToNewThread(): void;\n\n /**\n * Switch to a thread.\n *\n * @param threadId The thread ID to switch to.\n * @deprecated This method was moved to `threads.switchToThread`.\n */\n switchToThread(threadId: string): void;\n\n /**\n * Register a model context provider. Model context providers are configuration such as system message, temperature, etc. that are set in the frontend.\n *\n * @param provider The model context provider to register.\n */\n registerModelContextProvider(provider: ModelContextProvider): Unsubscribe;\n\n /**\n * @deprecated This method was renamed to `registerModelContextProvider`.\n */\n registerModelConfigProvider(provider: ModelContextProvider): Unsubscribe;\n};\n\nexport class AssistantRuntimeImpl implements AssistantRuntime {\n public readonly threads;\n public get threadList() {\n return this.threads;\n }\n\n public readonly _thread: ThreadRuntime;\n\n protected constructor(\n private readonly _core: AssistantRuntimeCore,\n runtimeFactory: new (\n binding: ThreadRuntimeCoreBinding,\n threadListItemBinding: ThreadListItemRuntimeBinding,\n ) => ThreadRuntime = ThreadRuntimeImpl,\n ) {\n this.threads = new ThreadListRuntimeImpl(_core.threads, runtimeFactory);\n this._thread = this.threads.main;\n }\n\n protected __internal_bindMethods() {\n this.switchToNewThread = this.switchToNewThread.bind(this);\n this.switchToThread = this.switchToThread.bind(this);\n this.registerModelContextProvider =\n this.registerModelContextProvider.bind(this);\n this.registerModelConfigProvider =\n this.registerModelConfigProvider.bind(this);\n }\n\n public get thread() {\n return this._thread;\n }\n\n public switchToNewThread() {\n return this._core.threads.switchToNewThread();\n }\n\n public switchToThread(threadId: string) {\n return this._core.threads.switchToThread(threadId);\n }\n\n public registerModelContextProvider(provider: ModelContextProvider) {\n return this._core.registerModelContextProvider(provider);\n }\n\n public registerModelConfigProvider(provider: ModelContextProvider) {\n return this.registerModelContextProvider(provider);\n }\n\n public static create(\n _core: AssistantRuntimeCore,\n runtimeFactory: new (\n binding: ThreadRuntimeCoreBinding,\n threadListItemBinding: ThreadListItemRuntimeBinding,\n ) => ThreadRuntime = ThreadRuntimeImpl,\n ): AssistantRuntime {\n return new AssistantRuntimeImpl(_core, runtimeFactory);\n }\n}\n"],"mappings":";AAEA;AAAA,EAIE;AAAA,OACK;AAEP,SAA4B,6BAA6B;AA8ClD,IAAM,uBAAN,MAAM,sBAAiD;AAAA,EAQlD,YACS,OACjB,iBAGqB,mBACrB;AALiB;AAMjB,SAAK,UAAU,IAAI,sBAAsB,MAAM,SAAS,cAAc;AACtE,SAAK,UAAU,KAAK,QAAQ;AAAA,EAC9B;AAAA,EAhBgB;AAAA,EAChB,IAAW,aAAa;AACtB,WAAO,KAAK;AAAA,EACd;AAAA,EAEgB;AAAA,EAaN,yBAAyB;AACjC,SAAK,oBAAoB,KAAK,kBAAkB,KAAK,IAAI;AACzD,SAAK,iBAAiB,KAAK,eAAe,KAAK,IAAI;AACnD,SAAK,+BACH,KAAK,6BAA6B,KAAK,IAAI;AAC7C,SAAK,8BACH,KAAK,4BAA4B,KAAK,IAAI;AAAA,EAC9C;AAAA,EAEA,IAAW,SAAS;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEO,oBAAoB;AACzB,WAAO,KAAK,MAAM,QAAQ,kBAAkB;AAAA,EAC9C;AAAA,EAEO,eAAe,UAAkB;AACtC,WAAO,KAAK,MAAM,QAAQ,eAAe,QAAQ;AAAA,EACnD;AAAA,EAEO,6BAA6B,UAAgC;AAClE,WAAO,KAAK,MAAM,6BAA6B,QAAQ;AAAA,EACzD;AAAA,EAEO,4BAA4B,UAAgC;AACjE,WAAO,KAAK,6BAA6B,QAAQ;AAAA,EACnD;AAAA,EAEA,OAAc,OACZ,OACA,iBAGqB,mBACH;AAClB,WAAO,IAAI,sBAAqB,OAAO,cAAc;AAAA,EACvD;AACF;","names":[]}
|
|
@@ -64,7 +64,7 @@ var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
|
|
|
64
64
|
import_ThreadRuntimeProvider.ThreadRuntimeProvider,
|
|
65
65
|
{
|
|
66
66
|
runtime: runtime.thread,
|
|
67
|
-
listItemRuntime: runtime.
|
|
67
|
+
listItemRuntime: runtime.threads.mainItem,
|
|
68
68
|
children
|
|
69
69
|
}
|
|
70
70
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n PropsWithChildren,\n memo,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n ensureBinding(runtime.threads);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const [context] = useState(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n };\n });\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n {RenderComponent && <RenderComponent />}\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.
|
|
1
|
+
{"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n PropsWithChildren,\n memo,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n ensureBinding(runtime.threads);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const [context] = useState(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n };\n });\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n {RenderComponent && <RenderComponent />}\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.threads.mainItem}\n >\n {children}\n </ThreadRuntimeProvider>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAOO;AACP,8BAAiC;AACjC,8BAA0C;AAC1C,mCAAsC;AAEtC,qBAAuB;AACvB,2BAA8B;AAE9B,2BAA8B;AA+C1B;AApCJ,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,OAAO,CAAC;AAEpD,8BAAU,MAAM;AACd,4CAAc,OAAO;AACrB,4CAAc,QAAQ,OAAO;AAE7B,4CAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,aAAO,sBAAQ,UAAM,mDAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,SAAQ,QAA6C,OAAO;AAC9D;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,CAAC,OAAO,QAAI,uBAAS,MAAM;AAC/B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,kBAAkB,mBAAmB,OAAO;AAElD,SACE,6CAAC,yCAAiB,UAAjB,EAA0B,OAAO,SAC/B;AAAA,uBAAmB,4CAAC,mBAAgB;AAAA,IACrC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,QAAQ;AAAA,QACjB,iBAAiB,QAAQ,QAAQ;AAAA,QAEhC;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;AAEO,IAAM,+BAA2B,mBAAK,4BAA4B;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n PropsWithChildren,\n memo,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n ensureBinding(runtime.threads);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const [context] = useState(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n };\n });\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n {RenderComponent && <RenderComponent />}\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.
|
|
1
|
+
{"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n PropsWithChildren,\n memo,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n ensureBinding(runtime.threads);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const [context] = useState(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n };\n });\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n {RenderComponent && <RenderComponent />}\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.threads.mainItem}\n >\n {children}\n </ThreadRuntimeProvider>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AAEtC,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AA+C1B,SACsB,KADtB;AApCJ,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,OAAO;AACrB,kBAAc,QAAQ,OAAO;AAE7B,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,SAAO,QAAQ,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,SAAQ,QAA6C,OAAO;AAC9D;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,CAAC,OAAO,IAAI,SAAS,MAAM;AAC/B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,kBAAkB,mBAAmB,OAAO;AAElD,SACE,qBAAC,iBAAiB,UAAjB,EAA0B,OAAO,SAC/B;AAAA,uBAAmB,oBAAC,mBAAgB;AAAA,IACrC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,QAAQ;AAAA,QACjB,iBAAiB,QAAQ,QAAQ;AAAA,QAEhC;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;AAEO,IAAM,2BAA2B,KAAK,4BAA4B;","names":[]}
|
|
@@ -35,7 +35,7 @@ var ThreadListItemImpl = ({
|
|
|
35
35
|
}) => {
|
|
36
36
|
const assistantRuntime = (0, import_context.useAssistantRuntime)();
|
|
37
37
|
const runtime = (0, import_react.useMemo)(
|
|
38
|
-
() => archived ? assistantRuntime.
|
|
38
|
+
() => archived ? assistantRuntime.threads.getArchivedItemByIndex(partIndex) : assistantRuntime.threads.getItemByIndex(partIndex),
|
|
39
39
|
[assistantRuntime, partIndex, archived]
|
|
40
40
|
);
|
|
41
41
|
const ThreadListItemComponent = components.ThreadListItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/threadList/ThreadListItems.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentType, FC, memo, useMemo } from \"react\";\nimport { ThreadListItemRuntimeProvider } from \"../../context/providers/ThreadListItemRuntimeProvider\";\nimport { useAssistantRuntime, useThreadList } from \"../../context\";\n\nexport namespace ThreadListPrimitiveItems {\n export type Props = {\n archived?: boolean | undefined;\n components: {\n ThreadListItem: ComponentType;\n };\n };\n}\n\ntype ThreadListItemProps = {\n partIndex: number;\n archived: boolean;\n components: ThreadListPrimitiveItems.Props[\"components\"];\n};\n\nconst ThreadListItemImpl: FC<ThreadListItemProps> = ({\n partIndex,\n archived,\n components,\n}) => {\n const assistantRuntime = useAssistantRuntime();\n const runtime = useMemo(\n () =>\n archived\n ? assistantRuntime.
|
|
1
|
+
{"version":3,"sources":["../../../src/primitives/threadList/ThreadListItems.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentType, FC, memo, useMemo } from \"react\";\nimport { ThreadListItemRuntimeProvider } from \"../../context/providers/ThreadListItemRuntimeProvider\";\nimport { useAssistantRuntime, useThreadList } from \"../../context\";\n\nexport namespace ThreadListPrimitiveItems {\n export type Props = {\n archived?: boolean | undefined;\n components: {\n ThreadListItem: ComponentType;\n };\n };\n}\n\ntype ThreadListItemProps = {\n partIndex: number;\n archived: boolean;\n components: ThreadListPrimitiveItems.Props[\"components\"];\n};\n\nconst ThreadListItemImpl: FC<ThreadListItemProps> = ({\n partIndex,\n archived,\n components,\n}) => {\n const assistantRuntime = useAssistantRuntime();\n const runtime = useMemo(\n () =>\n archived\n ? assistantRuntime.threads.getArchivedItemByIndex(partIndex)\n : assistantRuntime.threads.getItemByIndex(partIndex),\n [assistantRuntime, partIndex, archived],\n );\n\n const ThreadListItemComponent = components.ThreadListItem;\n\n return (\n <ThreadListItemRuntimeProvider runtime={runtime}>\n <ThreadListItemComponent />\n </ThreadListItemRuntimeProvider>\n );\n};\n\nconst ThreadListItem = memo(\n ThreadListItemImpl,\n (prev, next) =>\n prev.partIndex === next.partIndex &&\n prev.archived === next.archived &&\n prev.components.ThreadListItem === next.components.ThreadListItem,\n);\n\nexport const ThreadListPrimitiveItems: FC<ThreadListPrimitiveItems.Props> = ({\n archived = false,\n components,\n}) => {\n const contentLength = useThreadList((s) =>\n archived ? s.archivedThreads.length : s.threads.length,\n );\n\n return Array.from({ length: contentLength }, (_, index) => (\n <ThreadListItem\n key={index}\n partIndex={index}\n archived={archived}\n components={components}\n />\n ));\n};\n\nThreadListPrimitiveItems.displayName = \"ThreadListPrimitive.Items\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAiD;AACjD,2CAA8C;AAC9C,qBAAmD;AAmC7C;AAlBN,IAAM,qBAA8C,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,uBAAmB,oCAAoB;AAC7C,QAAM,cAAU;AAAA,IACd,MACE,WACI,iBAAiB,QAAQ,uBAAuB,SAAS,IACzD,iBAAiB,QAAQ,eAAe,SAAS;AAAA,IACvD,CAAC,kBAAkB,WAAW,QAAQ;AAAA,EACxC;AAEA,QAAM,0BAA0B,WAAW;AAE3C,SACE,4CAAC,sEAA8B,SAC7B,sDAAC,2BAAwB,GAC3B;AAEJ;AAEA,IAAM,qBAAiB;AAAA,EACrB;AAAA,EACA,CAAC,MAAM,SACL,KAAK,cAAc,KAAK,aACxB,KAAK,aAAa,KAAK,YACvB,KAAK,WAAW,mBAAmB,KAAK,WAAW;AACvD;AAEO,IAAM,2BAA+D,CAAC;AAAA,EAC3E,WAAW;AAAA,EACX;AACF,MAAM;AACJ,QAAM,oBAAgB;AAAA,IAAc,CAAC,MACnC,WAAW,EAAE,gBAAgB,SAAS,EAAE,QAAQ;AAAA,EAClD;AAEA,SAAO,MAAM,KAAK,EAAE,QAAQ,cAAc,GAAG,CAAC,GAAG,UAC/C;AAAA,IAAC;AAAA;AAAA,MAEC,WAAW;AAAA,MACX;AAAA,MACA;AAAA;AAAA,IAHK;AAAA,EAIP,CACD;AACH;AAEA,yBAAyB,cAAc;","names":[]}
|
|
@@ -12,7 +12,7 @@ var ThreadListItemImpl = ({
|
|
|
12
12
|
}) => {
|
|
13
13
|
const assistantRuntime = useAssistantRuntime();
|
|
14
14
|
const runtime = useMemo(
|
|
15
|
-
() => archived ? assistantRuntime.
|
|
15
|
+
() => archived ? assistantRuntime.threads.getArchivedItemByIndex(partIndex) : assistantRuntime.threads.getItemByIndex(partIndex),
|
|
16
16
|
[assistantRuntime, partIndex, archived]
|
|
17
17
|
);
|
|
18
18
|
const ThreadListItemComponent = components.ThreadListItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/threadList/ThreadListItems.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentType, FC, memo, useMemo } from \"react\";\nimport { ThreadListItemRuntimeProvider } from \"../../context/providers/ThreadListItemRuntimeProvider\";\nimport { useAssistantRuntime, useThreadList } from \"../../context\";\n\nexport namespace ThreadListPrimitiveItems {\n export type Props = {\n archived?: boolean | undefined;\n components: {\n ThreadListItem: ComponentType;\n };\n };\n}\n\ntype ThreadListItemProps = {\n partIndex: number;\n archived: boolean;\n components: ThreadListPrimitiveItems.Props[\"components\"];\n};\n\nconst ThreadListItemImpl: FC<ThreadListItemProps> = ({\n partIndex,\n archived,\n components,\n}) => {\n const assistantRuntime = useAssistantRuntime();\n const runtime = useMemo(\n () =>\n archived\n ? assistantRuntime.
|
|
1
|
+
{"version":3,"sources":["../../../src/primitives/threadList/ThreadListItems.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentType, FC, memo, useMemo } from \"react\";\nimport { ThreadListItemRuntimeProvider } from \"../../context/providers/ThreadListItemRuntimeProvider\";\nimport { useAssistantRuntime, useThreadList } from \"../../context\";\n\nexport namespace ThreadListPrimitiveItems {\n export type Props = {\n archived?: boolean | undefined;\n components: {\n ThreadListItem: ComponentType;\n };\n };\n}\n\ntype ThreadListItemProps = {\n partIndex: number;\n archived: boolean;\n components: ThreadListPrimitiveItems.Props[\"components\"];\n};\n\nconst ThreadListItemImpl: FC<ThreadListItemProps> = ({\n partIndex,\n archived,\n components,\n}) => {\n const assistantRuntime = useAssistantRuntime();\n const runtime = useMemo(\n () =>\n archived\n ? assistantRuntime.threads.getArchivedItemByIndex(partIndex)\n : assistantRuntime.threads.getItemByIndex(partIndex),\n [assistantRuntime, partIndex, archived],\n );\n\n const ThreadListItemComponent = components.ThreadListItem;\n\n return (\n <ThreadListItemRuntimeProvider runtime={runtime}>\n <ThreadListItemComponent />\n </ThreadListItemRuntimeProvider>\n );\n};\n\nconst ThreadListItem = memo(\n ThreadListItemImpl,\n (prev, next) =>\n prev.partIndex === next.partIndex &&\n prev.archived === next.archived &&\n prev.components.ThreadListItem === next.components.ThreadListItem,\n);\n\nexport const ThreadListPrimitiveItems: FC<ThreadListPrimitiveItems.Props> = ({\n archived = false,\n components,\n}) => {\n const contentLength = useThreadList((s) =>\n archived ? s.archivedThreads.length : s.threads.length,\n );\n\n return Array.from({ length: contentLength }, (_, index) => (\n <ThreadListItem\n key={index}\n partIndex={index}\n archived={archived}\n components={components}\n />\n ));\n};\n\nThreadListPrimitiveItems.displayName = \"ThreadListPrimitive.Items\";\n"],"mappings":";;;AAEA,SAA4B,MAAM,eAAe;AACjD,SAAS,qCAAqC;AAC9C,SAAS,qBAAqB,qBAAqB;AAmC7C;AAlBN,IAAM,qBAA8C,CAAC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,mBAAmB,oBAAoB;AAC7C,QAAM,UAAU;AAAA,IACd,MACE,WACI,iBAAiB,QAAQ,uBAAuB,SAAS,IACzD,iBAAiB,QAAQ,eAAe,SAAS;AAAA,IACvD,CAAC,kBAAkB,WAAW,QAAQ;AAAA,EACxC;AAEA,QAAM,0BAA0B,WAAW;AAE3C,SACE,oBAAC,iCAA8B,SAC7B,8BAAC,2BAAwB,GAC3B;AAEJ;AAEA,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA,CAAC,MAAM,SACL,KAAK,cAAc,KAAK,aACxB,KAAK,aAAa,KAAK,YACvB,KAAK,WAAW,mBAAmB,KAAK,WAAW;AACvD;AAEO,IAAM,2BAA+D,CAAC;AAAA,EAC3E,WAAW;AAAA,EACX;AACF,MAAM;AACJ,QAAM,gBAAgB;AAAA,IAAc,CAAC,MACnC,WAAW,EAAE,gBAAgB,SAAS,EAAE,QAAQ;AAAA,EAClD;AAEA,SAAO,MAAM,KAAK,EAAE,QAAQ,cAAc,GAAG,CAAC,GAAG,UAC/C;AAAA,IAAC;AAAA;AAAA,MAEC,WAAW;AAAA,MACX;AAAA,MACA;AAAA;AAAA,IAHK;AAAA,EAIP,CACD;AACH;AAEA,yBAAyB,cAAc;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toLanguageModelMessages.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/edge/converters/toLanguageModelMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,sBAAsB,EAIvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,aAAa,EAGd,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"toLanguageModelMessages.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/edge/converters/toLanguageModelMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,sBAAsB,EAIvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,aAAa,EAGd,MAAM,+BAA+B,CAAC;AAgEvC,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,aAAa,EAAE,EAC1D,OAAO,GAAE;IAAE,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAO,GACzD,sBAAsB,EAAE,CAmG1B"}
|
|
@@ -60,8 +60,8 @@ var assistantMessageSplitter = () => {
|
|
|
60
60
|
type: "tool-result",
|
|
61
61
|
toolCallId: part.toolCallId,
|
|
62
62
|
toolName: part.toolName,
|
|
63
|
-
result: part.result
|
|
64
|
-
isError: part.isError ??
|
|
63
|
+
result: part.result === void 0 ? "Error: tool is has no configured code to run" : void 0,
|
|
64
|
+
isError: part.isError ?? part.result === void 0
|
|
65
65
|
});
|
|
66
66
|
},
|
|
67
67
|
getMessages: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/edge/converters/toLanguageModelMessages.ts"],"sourcesContent":["import {\n LanguageModelV1FilePart,\n LanguageModelV1ImagePart,\n LanguageModelV1Message,\n LanguageModelV1TextPart,\n LanguageModelV1ToolCallPart,\n LanguageModelV1ToolResultPart,\n} from \"@ai-sdk/provider\";\nimport {\n CoreMessage,\n ThreadMessage,\n TextContentPart,\n CoreToolCallContentPart,\n} from \"../../../types/AssistantTypes\";\n\nconst assistantMessageSplitter = () => {\n const stash: LanguageModelV1Message[] = [];\n let assistantMessage = {\n role: \"assistant\" as const,\n content: [] as (LanguageModelV1TextPart | LanguageModelV1ToolCallPart)[],\n };\n let toolMessage = {\n role: \"tool\" as const,\n content: [] as LanguageModelV1ToolResultPart[],\n };\n\n return {\n addTextContentPart: (part: TextContentPart) => {\n if (toolMessage.content.length > 0) {\n stash.push(assistantMessage);\n stash.push(toolMessage);\n\n assistantMessage = {\n role: \"assistant\" as const,\n content: [] as (\n | LanguageModelV1TextPart\n | LanguageModelV1ToolCallPart\n )[],\n };\n\n toolMessage = {\n role: \"tool\" as const,\n content: [] as LanguageModelV1ToolResultPart[],\n };\n }\n\n assistantMessage.content.push(part);\n },\n addToolCallPart: (part: CoreToolCallContentPart) => {\n assistantMessage.content.push({\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n args: part.args,\n });\n\n toolMessage.content.push({\n type: \"tool-result\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n result
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/edge/converters/toLanguageModelMessages.ts"],"sourcesContent":["import {\n LanguageModelV1FilePart,\n LanguageModelV1ImagePart,\n LanguageModelV1Message,\n LanguageModelV1TextPart,\n LanguageModelV1ToolCallPart,\n LanguageModelV1ToolResultPart,\n} from \"@ai-sdk/provider\";\nimport {\n CoreMessage,\n ThreadMessage,\n TextContentPart,\n CoreToolCallContentPart,\n} from \"../../../types/AssistantTypes\";\n\nconst assistantMessageSplitter = () => {\n const stash: LanguageModelV1Message[] = [];\n let assistantMessage = {\n role: \"assistant\" as const,\n content: [] as (LanguageModelV1TextPart | LanguageModelV1ToolCallPart)[],\n };\n let toolMessage = {\n role: \"tool\" as const,\n content: [] as LanguageModelV1ToolResultPart[],\n };\n\n return {\n addTextContentPart: (part: TextContentPart) => {\n if (toolMessage.content.length > 0) {\n stash.push(assistantMessage);\n stash.push(toolMessage);\n\n assistantMessage = {\n role: \"assistant\" as const,\n content: [] as (\n | LanguageModelV1TextPart\n | LanguageModelV1ToolCallPart\n )[],\n };\n\n toolMessage = {\n role: \"tool\" as const,\n content: [] as LanguageModelV1ToolResultPart[],\n };\n }\n\n assistantMessage.content.push(part);\n },\n addToolCallPart: (part: CoreToolCallContentPart) => {\n assistantMessage.content.push({\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n args: part.args,\n });\n\n toolMessage.content.push({\n type: \"tool-result\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n result:\n part.result === undefined\n ? \"Error: tool is has no configured code to run\"\n : undefined,\n isError: part.isError ?? part.result === undefined,\n });\n },\n getMessages: () => {\n if (toolMessage.content.length > 0) {\n return [...stash, assistantMessage, toolMessage];\n }\n\n return [...stash, assistantMessage];\n },\n };\n};\n\nexport function toLanguageModelMessages(\n message: readonly CoreMessage[] | readonly ThreadMessage[],\n options: { unstable_includeId?: boolean | undefined } = {},\n): LanguageModelV1Message[] {\n const includeId = options.unstable_includeId ?? false;\n return message.flatMap((message) => {\n const role = message.role;\n switch (role) {\n case \"system\": {\n return [\n {\n ...(includeId\n ? { unstable_id: (message as ThreadMessage).id }\n : {}),\n role: \"system\",\n content: message.content[0].text,\n },\n ];\n }\n\n case \"user\": {\n const attachments = \"attachments\" in message ? message.attachments : [];\n const content = [\n ...message.content,\n ...attachments.map((a) => a.content).flat(),\n ];\n const msg: LanguageModelV1Message = {\n ...(includeId ? { unstable_id: (message as ThreadMessage).id } : {}),\n role: \"user\",\n content: content.map(\n (\n part,\n ):\n | LanguageModelV1TextPart\n | LanguageModelV1ImagePart\n | LanguageModelV1FilePart => {\n const type = part.type;\n switch (type) {\n case \"text\": {\n return part;\n }\n\n case \"image\": {\n return {\n type: \"image\",\n image: new URL(part.image),\n };\n }\n\n case \"file\": {\n return {\n type: \"file\",\n data: new URL(part.data),\n mimeType: part.mimeType,\n };\n }\n\n default: {\n const unhandledType: \"ui\" | \"audio\" = type;\n throw new Error(\n `Unspported content part type: ${unhandledType}`,\n );\n }\n }\n },\n ),\n };\n return [msg];\n }\n\n case \"assistant\": {\n const splitter = assistantMessageSplitter();\n for (const part of message.content) {\n const type = part.type;\n switch (type) {\n case \"reasoning\": {\n break; // reasoning parts are omitted\n }\n\n case \"text\": {\n splitter.addTextContentPart(part);\n break;\n }\n case \"tool-call\": {\n splitter.addToolCallPart(part);\n break;\n }\n default: {\n const unhandledType: \"ui\" = type;\n throw new Error(`Unhandled content part type: ${unhandledType}`);\n }\n }\n }\n return splitter.getMessages();\n }\n\n default: {\n const unhandledRole: never = role;\n throw new Error(`Unknown message role: ${unhandledRole}`);\n }\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,IAAM,2BAA2B,MAAM;AACrC,QAAM,QAAkC,CAAC;AACzC,MAAI,mBAAmB;AAAA,IACrB,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,EACZ;AACA,MAAI,cAAc;AAAA,IAChB,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,EACZ;AAEA,SAAO;AA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BAAM,gBAAsB;AAC5B,oBAAM,IAAI,MAAM,gCAAgC,aAAa,EAAE;AAAA,YACjE;AAAA,UACF;AAAA,QACF;AACA,eAAO,SAAS,YAAY;AAAA,MAC9B;AAAA,MAEA,SAAS;AACP,cAAM,gBAAuB;AAC7B,cAAM,IAAI,MAAM,yBAAyB,aAAa,EAAE;AAAA,MAC1D;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":["message"]}
|
|
@@ -36,8 +36,8 @@ var assistantMessageSplitter = () => {
|
|
|
36
36
|
type: "tool-result",
|
|
37
37
|
toolCallId: part.toolCallId,
|
|
38
38
|
toolName: part.toolName,
|
|
39
|
-
result: part.result
|
|
40
|
-
isError: part.isError ??
|
|
39
|
+
result: part.result === void 0 ? "Error: tool is has no configured code to run" : void 0,
|
|
40
|
+
isError: part.isError ?? part.result === void 0
|
|
41
41
|
});
|
|
42
42
|
},
|
|
43
43
|
getMessages: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/edge/converters/toLanguageModelMessages.ts"],"sourcesContent":["import {\n LanguageModelV1FilePart,\n LanguageModelV1ImagePart,\n LanguageModelV1Message,\n LanguageModelV1TextPart,\n LanguageModelV1ToolCallPart,\n LanguageModelV1ToolResultPart,\n} from \"@ai-sdk/provider\";\nimport {\n CoreMessage,\n ThreadMessage,\n TextContentPart,\n CoreToolCallContentPart,\n} from \"../../../types/AssistantTypes\";\n\nconst assistantMessageSplitter = () => {\n const stash: LanguageModelV1Message[] = [];\n let assistantMessage = {\n role: \"assistant\" as const,\n content: [] as (LanguageModelV1TextPart | LanguageModelV1ToolCallPart)[],\n };\n let toolMessage = {\n role: \"tool\" as const,\n content: [] as LanguageModelV1ToolResultPart[],\n };\n\n return {\n addTextContentPart: (part: TextContentPart) => {\n if (toolMessage.content.length > 0) {\n stash.push(assistantMessage);\n stash.push(toolMessage);\n\n assistantMessage = {\n role: \"assistant\" as const,\n content: [] as (\n | LanguageModelV1TextPart\n | LanguageModelV1ToolCallPart\n )[],\n };\n\n toolMessage = {\n role: \"tool\" as const,\n content: [] as LanguageModelV1ToolResultPart[],\n };\n }\n\n assistantMessage.content.push(part);\n },\n addToolCallPart: (part: CoreToolCallContentPart) => {\n assistantMessage.content.push({\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n args: part.args,\n });\n\n toolMessage.content.push({\n type: \"tool-result\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n result
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/edge/converters/toLanguageModelMessages.ts"],"sourcesContent":["import {\n LanguageModelV1FilePart,\n LanguageModelV1ImagePart,\n LanguageModelV1Message,\n LanguageModelV1TextPart,\n LanguageModelV1ToolCallPart,\n LanguageModelV1ToolResultPart,\n} from \"@ai-sdk/provider\";\nimport {\n CoreMessage,\n ThreadMessage,\n TextContentPart,\n CoreToolCallContentPart,\n} from \"../../../types/AssistantTypes\";\n\nconst assistantMessageSplitter = () => {\n const stash: LanguageModelV1Message[] = [];\n let assistantMessage = {\n role: \"assistant\" as const,\n content: [] as (LanguageModelV1TextPart | LanguageModelV1ToolCallPart)[],\n };\n let toolMessage = {\n role: \"tool\" as const,\n content: [] as LanguageModelV1ToolResultPart[],\n };\n\n return {\n addTextContentPart: (part: TextContentPart) => {\n if (toolMessage.content.length > 0) {\n stash.push(assistantMessage);\n stash.push(toolMessage);\n\n assistantMessage = {\n role: \"assistant\" as const,\n content: [] as (\n | LanguageModelV1TextPart\n | LanguageModelV1ToolCallPart\n )[],\n };\n\n toolMessage = {\n role: \"tool\" as const,\n content: [] as LanguageModelV1ToolResultPart[],\n };\n }\n\n assistantMessage.content.push(part);\n },\n addToolCallPart: (part: CoreToolCallContentPart) => {\n assistantMessage.content.push({\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n args: part.args,\n });\n\n toolMessage.content.push({\n type: \"tool-result\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n result:\n part.result === undefined\n ? \"Error: tool is has no configured code to run\"\n : undefined,\n isError: part.isError ?? part.result === undefined,\n });\n },\n getMessages: () => {\n if (toolMessage.content.length > 0) {\n return [...stash, assistantMessage, toolMessage];\n }\n\n return [...stash, assistantMessage];\n },\n };\n};\n\nexport function toLanguageModelMessages(\n message: readonly CoreMessage[] | readonly ThreadMessage[],\n options: { unstable_includeId?: boolean | undefined } = {},\n): LanguageModelV1Message[] {\n const includeId = options.unstable_includeId ?? false;\n return message.flatMap((message) => {\n const role = message.role;\n switch (role) {\n case \"system\": {\n return [\n {\n ...(includeId\n ? { unstable_id: (message as ThreadMessage).id }\n : {}),\n role: \"system\",\n content: message.content[0].text,\n },\n ];\n }\n\n case \"user\": {\n const attachments = \"attachments\" in message ? message.attachments : [];\n const content = [\n ...message.content,\n ...attachments.map((a) => a.content).flat(),\n ];\n const msg: LanguageModelV1Message = {\n ...(includeId ? { unstable_id: (message as ThreadMessage).id } : {}),\n role: \"user\",\n content: content.map(\n (\n part,\n ):\n | LanguageModelV1TextPart\n | LanguageModelV1ImagePart\n | LanguageModelV1FilePart => {\n const type = part.type;\n switch (type) {\n case \"text\": {\n return part;\n }\n\n case \"image\": {\n return {\n type: \"image\",\n image: new URL(part.image),\n };\n }\n\n case \"file\": {\n return {\n type: \"file\",\n data: new URL(part.data),\n mimeType: part.mimeType,\n };\n }\n\n default: {\n const unhandledType: \"ui\" | \"audio\" = type;\n throw new Error(\n `Unspported content part type: ${unhandledType}`,\n );\n }\n }\n },\n ),\n };\n return [msg];\n }\n\n case \"assistant\": {\n const splitter = assistantMessageSplitter();\n for (const part of message.content) {\n const type = part.type;\n switch (type) {\n case \"reasoning\": {\n break; // reasoning parts are omitted\n }\n\n case \"text\": {\n splitter.addTextContentPart(part);\n break;\n }\n case \"tool-call\": {\n splitter.addToolCallPart(part);\n break;\n }\n default: {\n const unhandledType: \"ui\" = type;\n throw new Error(`Unhandled content part type: ${unhandledType}`);\n }\n }\n }\n return splitter.getMessages();\n }\n\n default: {\n const unhandledRole: never = role;\n throw new Error(`Unknown message role: ${unhandledRole}`);\n }\n }\n });\n}\n"],"mappings":";AAeA,IAAM,2BAA2B,MAAM;AACrC,QAAM,QAAkC,CAAC;AACzC,MAAI,mBAAmB;AAAA,IACrB,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,EACZ;AACA,MAAI,cAAc;AAAA,IAChB,MAAM;AAAA,IACN,SAAS,CAAC;AAAA,EACZ;AAEA,SAAO;AAAA,IACL,oBAAoB,CAAC,SAA0B;AAC7C,UAAI,YAAY,QAAQ,SAAS,GAAG;AAClC,cAAM,KAAK,gBAAgB;AAC3B,cAAM,KAAK,WAAW;AAEtB,2BAAmB;AAAA,UACjB,MAAM;AAAA,UACN,SAAS,CAAC;AAAA,QAIZ;AAEA,sBAAc;AAAA,UACZ,MAAM;AAAA,UACN,SAAS,CAAC;AAAA,QACZ;AAAA,MACF;AAEA,uBAAiB,QAAQ,KAAK,IAAI;AAAA,IACpC;AAAA,IACA,iBAAiB,CAAC,SAAkC;AAClD,uBAAiB,QAAQ,KAAK;AAAA,QAC5B,MAAM;AAAA,QACN,YAAY,KAAK;AAAA,QACjB,UAAU,KAAK;AAAA,QACf,MAAM,KAAK;AAAA,MACb,CAAC;AAED,kBAAY,QAAQ,KAAK;AAAA,QACvB,MAAM;AAAA,QACN,YAAY,KAAK;AAAA,QACjB,UAAU,KAAK;AAAA,QACf,QACE,KAAK,WAAW,SACZ,iDACA;AAAA,QACN,SAAS,KAAK,WAAW,KAAK,WAAW;AAAA,MAC3C,CAAC;AAAA,IACH;AAAA,IACA,aAAa,MAAM;AACjB,UAAI,YAAY,QAAQ,SAAS,GAAG;AAClC,eAAO,CAAC,GAAG,OAAO,kBAAkB,WAAW;AAAA,MACjD;AAEA,aAAO,CAAC,GAAG,OAAO,gBAAgB;AAAA,IACpC;AAAA,EACF;AACF;AAEO,SAAS,wBACd,SACA,UAAwD,CAAC,GAC/B;AAC1B,QAAM,YAAY,QAAQ,sBAAsB;AACh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AAyB;AAC1C,mBAAW,QAAQA,SAAQ,SAAS;AAClC,gBAAM,OAAO,KAAK;AAClB,kBAAQ,MAAM;AAAA,YACZ,KAAK,aAAa;AAChB;AAAA,YACF;AAAA,YAEA,KAAK,QAAQ;AACX,uBAAS,mBAAmB,IAAI;AAChC;AAAA,YACF;AAAA,YACA,KAAK,aAAa;AAChB,uBAAS,gBAAgB,IAAI;AAC7B;AAAA,YACF;AAAA,YACA,SAAS;AACP,oBAAM,gBAAsB;AAC5B,oBAAM,IAAI,MAAM,gCAAgC,aAAa,EAAE;AAAA,YACjE;AAAA,UACF;AAAA,QACF;AACA,eAAO,SAAS,YAAY;AAAA,MAC9B;AAAA,MAEA,SAAS;AACP,cAAM,gBAAuB;AAC7B,cAAM,IAAI,MAAM,yBAAyB,aAAa,EAAE;AAAA,MAC1D;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":["message"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/edge/streams/toolResultStream.ts"],"sourcesContent":["import { Tool } from \"../../../model-context/ModelContextTypes\";\nimport { LanguageModelV1StreamPart } from \"@ai-sdk/provider\";\nimport { z } from \"zod\";\nimport sjson from \"secure-json-parse\";\nimport { ReadonlyJSONValue } from \"../../../utils/json/json-value\";\n\nexport type ToolResultStreamPart =\n | LanguageModelV1StreamPart\n | {\n type: \"annotations\";\n annotations: ReadonlyJSONValue[];\n }\n | {\n type: \"data\";\n data: ReadonlyJSONValue[];\n }\n | {\n type: \"tool-result\";\n toolCallType: \"function\";\n toolCallId: string;\n toolName: string;\n result: unknown;\n isError?: boolean;\n }\n | {\n type: \"step-finish\";\n finishReason:\n | \"stop\"\n | \"length\"\n | \"content-filter\"\n | \"tool-calls\"\n | \"error\"\n | \"other\"\n | \"unknown\";\n usage: {\n promptTokens: number;\n completionTokens: number;\n };\n isContinued: boolean;\n };\n\nexport function toolResultStream(\n tools: Record<string, Tool> | undefined,\n abortSignal: AbortSignal,\n) {\n const toolCallExecutions = new Map<string, Promise<any>>();\n\n return new TransformStream<ToolResultStreamPart, ToolResultStreamPart>({\n transform(chunk, controller) {\n // forward everything\n controller.enqueue(chunk);\n\n // handle tool calls\n const chunkType = chunk.type;\n switch (chunkType) {\n case \"tool-call\": {\n const { toolCallId, toolCallType, toolName, args: argsText } = chunk;\n const tool = tools?.[toolName];\n if (!tool || !tool.execute) return;\n\n let args;\n try {\n args = sjson.parse(argsText);\n } catch (e) {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result:\n \"Function parameter parsing failed. \" +\n JSON.stringify((e as Error).message),\n isError: true,\n });\n return;\n }\n\n toolCallExecutions.set(\n toolCallId,\n (async () => {\n if (!tool.execute) return;\n\n let executeFn = tool.execute;\n\n if (tool.parameters instanceof z.ZodType) {\n const result = tool.parameters.safeParse(args);\n if (!result.success) {\n executeFn =\n tool.experimental_onSchemaValidationError ??\n (() => {\n throw (\n \"Function parameter validation failed. \" +\n JSON.stringify(result.error.issues)\n );\n });\n }\n }\n\n try {\n const result = await executeFn(args, {\n toolCallId,\n abortSignal,\n });\n\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result,\n });\n } catch (error) {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result: \"Error: \" + error,\n isError: true,\n });\n } finally {\n toolCallExecutions.delete(toolCallId);\n }\n })(),\n );\n break;\n }\n\n // ignore other parts\n case \"text-delta\":\n case \"reasoning\":\n case \"tool-call-delta\":\n case \"tool-result\":\n case \"step-finish\":\n case \"finish\":\n case \"error\":\n case \"response-metadata\":\n case \"annotations\":\n case \"data\":\n break;\n\n default: {\n const unhandledType: never = chunkType;\n throw new Error(`Unhandled chunk type: ${unhandledType}`);\n }\n }\n },\n\n async flush() {\n await Promise.all(toolCallExecutions.values());\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAA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["import { Tool } from \"../../../model-context/ModelContextTypes\";\nimport { LanguageModelV1StreamPart } from \"@ai-sdk/provider\";\nimport { z } from \"zod\";\nimport sjson from \"secure-json-parse\";\nimport { ReadonlyJSONValue } from \"../../../utils/json/json-value\";\n\nexport type ToolResultStreamPart =\n | LanguageModelV1StreamPart\n | {\n type: \"annotations\";\n annotations: ReadonlyJSONValue[];\n }\n | {\n type: \"data\";\n data: ReadonlyJSONValue[];\n }\n | {\n type: \"tool-result\";\n toolCallType: \"function\";\n toolCallId: string;\n toolName: string;\n result: unknown;\n isError?: boolean;\n }\n | {\n type: \"step-finish\";\n finishReason:\n | \"stop\"\n | \"length\"\n | \"content-filter\"\n | \"tool-calls\"\n | \"error\"\n | \"other\"\n | \"unknown\";\n usage: {\n promptTokens: number;\n completionTokens: number;\n };\n isContinued: boolean;\n };\n\nexport function toolResultStream(\n tools: Record<string, Tool> | undefined,\n abortSignal: AbortSignal,\n) {\n const toolCallExecutions = new Map<string, Promise<any>>();\n\n return new TransformStream<ToolResultStreamPart, ToolResultStreamPart>({\n transform(chunk, controller) {\n // forward everything\n controller.enqueue(chunk);\n\n // handle tool calls\n const chunkType = chunk.type;\n switch (chunkType) {\n case \"tool-call\": {\n const { toolCallId, toolCallType, toolName, args: argsText } = chunk;\n const tool = tools?.[toolName];\n if (!tool || !tool.execute) return;\n\n let args;\n try {\n args = sjson.parse(argsText);\n } catch (e) {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result:\n \"Function parameter parsing failed. \" +\n JSON.stringify((e as Error).message),\n isError: true,\n });\n return;\n }\n\n toolCallExecutions.set(\n toolCallId,\n (async () => {\n if (!tool.execute) return;\n\n let executeFn = tool.execute;\n\n if (tool.parameters instanceof z.ZodType) {\n const result = tool.parameters.safeParse(args);\n if (!result.success) {\n executeFn =\n tool.experimental_onSchemaValidationError ??\n (() => {\n throw (\n \"Function parameter validation failed. \" +\n JSON.stringify(result.error.issues)\n );\n });\n }\n }\n\n try {\n const result = await executeFn(args, {\n toolCallId,\n abortSignal,\n });\n\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result: result === undefined ? \"<no result>\" : result,\n });\n } catch (error) {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result: \"Error: \" + error,\n isError: true,\n });\n } finally {\n toolCallExecutions.delete(toolCallId);\n }\n })(),\n );\n break;\n }\n\n // ignore other parts\n case \"text-delta\":\n case \"reasoning\":\n case \"tool-call-delta\":\n case \"tool-result\":\n case \"step-finish\":\n case \"finish\":\n case \"error\":\n case \"response-metadata\":\n case \"annotations\":\n case \"data\":\n break;\n\n default: {\n const unhandledType: never = chunkType;\n throw new Error(`Unhandled chunk type: ${unhandledType}`);\n }\n }\n },\n\n async flush() {\n await Promise.all(toolCallExecutions.values());\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAkB;AAClB,+BAAkB;AAsCX,SAAS,iBACd,OACA,aACA;AACA,QAAM,qBAAqB,oBAAI,IAA0B;AAEzD,SAAO,IAAI,gBAA4D;AAAA,IACrE,UAAU,OAAO,YAAY;AAE3B,iBAAW,QAAQ,KAAK;AAGxB,YAAM,YAAY,MAAM;AACxB,cAAQ,WAAW;AAAA,QACjB,KAAK,aAAa;AAChB,gBAAM,EAAE,YAAY,cAAc,UAAU,MAAM,SAAS,IAAI;AAC/D,gBAAM,OAAO,QAAQ,QAAQ;AAC7B,cAAI,CAAC,QAAQ,CAAC,KAAK,QAAS;AAE5B,cAAI;AACJ,cAAI;AACF,mBAAO,yBAAAA,QAAM,MAAM,QAAQ;AAAA,UAC7B,SAAS,GAAG;AACV,uBAAW,QAAQ;AAAA,cACjB,MAAM;AAAA,cACN;AAAA,cACA;AAAA,cACA;AAAA,cACA,QACE,wCACA,KAAK,UAAW,EAAY,OAAO;AAAA,cACrC,SAAS;AAAA,YACX,CAA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AC;AACH;","names":["sjson"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/edge/streams/toolResultStream.ts"],"sourcesContent":["import { Tool } from \"../../../model-context/ModelContextTypes\";\nimport { LanguageModelV1StreamPart } from \"@ai-sdk/provider\";\nimport { z } from \"zod\";\nimport sjson from \"secure-json-parse\";\nimport { ReadonlyJSONValue } from \"../../../utils/json/json-value\";\n\nexport type ToolResultStreamPart =\n | LanguageModelV1StreamPart\n | {\n type: \"annotations\";\n annotations: ReadonlyJSONValue[];\n }\n | {\n type: \"data\";\n data: ReadonlyJSONValue[];\n }\n | {\n type: \"tool-result\";\n toolCallType: \"function\";\n toolCallId: string;\n toolName: string;\n result: unknown;\n isError?: boolean;\n }\n | {\n type: \"step-finish\";\n finishReason:\n | \"stop\"\n | \"length\"\n | \"content-filter\"\n | \"tool-calls\"\n | \"error\"\n | \"other\"\n | \"unknown\";\n usage: {\n promptTokens: number;\n completionTokens: number;\n };\n isContinued: boolean;\n };\n\nexport function toolResultStream(\n tools: Record<string, Tool> | undefined,\n abortSignal: AbortSignal,\n) {\n const toolCallExecutions = new Map<string, Promise<any>>();\n\n return new TransformStream<ToolResultStreamPart, ToolResultStreamPart>({\n transform(chunk, controller) {\n // forward everything\n controller.enqueue(chunk);\n\n // handle tool calls\n const chunkType = chunk.type;\n switch (chunkType) {\n case \"tool-call\": {\n const { toolCallId, toolCallType, toolName, args: argsText } = chunk;\n const tool = tools?.[toolName];\n if (!tool || !tool.execute) return;\n\n let args;\n try {\n args = sjson.parse(argsText);\n } catch (e) {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result:\n \"Function parameter parsing failed. \" +\n JSON.stringify((e as Error).message),\n isError: true,\n });\n return;\n }\n\n toolCallExecutions.set(\n toolCallId,\n (async () => {\n if (!tool.execute) return;\n\n let executeFn = tool.execute;\n\n if (tool.parameters instanceof z.ZodType) {\n const result = tool.parameters.safeParse(args);\n if (!result.success) {\n executeFn =\n tool.experimental_onSchemaValidationError ??\n (() => {\n throw (\n \"Function parameter validation failed. \" +\n JSON.stringify(result.error.issues)\n );\n });\n }\n }\n\n try {\n const result = await executeFn(args, {\n toolCallId,\n abortSignal,\n });\n\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result,\n });\n } catch (error) {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result: \"Error: \" + error,\n isError: true,\n });\n } finally {\n toolCallExecutions.delete(toolCallId);\n }\n })(),\n );\n break;\n }\n\n // ignore other parts\n case \"text-delta\":\n case \"reasoning\":\n case \"tool-call-delta\":\n case \"tool-result\":\n case \"step-finish\":\n case \"finish\":\n case \"error\":\n case \"response-metadata\":\n case \"annotations\":\n case \"data\":\n break;\n\n default: {\n const unhandledType: never = chunkType;\n throw new Error(`Unhandled chunk type: ${unhandledType}`);\n }\n }\n },\n\n async flush() {\n await Promise.all(toolCallExecutions.values());\n },\n });\n}\n"],"mappings":";AAEA,SAAS,SAAS;AAClB,OAAO,WAAW;AAsCX,SAAS,iBACd,OACA,aACA;AACA,QAAM,qBAAqB,oBAAI,IAA0B;AAEzD,SAAO,IAAI,gBAA4D;AAAA,IACrE,UAAU,OAAO,YAAY;AAE3B,iBAAW,QAAQ,KAAK;AAGxB,YAAM,YAAY,MAAM;AACxB,cAAQ,WAAW;AAAA,QACjB,KAAK,aAAa;AAChB,gBAAM,EAAE,YAAY,cAAc,UAAU,MAAM,SAAS,IAAI;AAC/D,gBAAM,OAAO,QAAQ,QAAQ;AAC7B,cAAI,CAAC,QAAQ,CAAC,KAAK,QAAS;AAE5B,cAAI;AACJ,cAAI;AACF,mBAAO,MAAM,MAAM,QAAQ;AAAA,UAC7B,SAAS,GAAG;AACV,uBAAW,QAAQ;AAAA,cACjB,MAAM;AAAA,cACN;AAAA,cACA;AAAA,cACA;AAAA,cACA,QACE,wCACA,KAAK,UAAW,EAAY,OAAO;AAAA,cACrC,SAAS;AAAA,YACX,CAAC;AACD;AAAA,UACF;AAEA,6BAAmB;AAAA,YACjB;AAAA,aACC,YAAY;AACX,kBAAI,CAAC,KAAK,QAAS;AAEnB,kBAAI,YAAY,KAAK;AAErB,kBAAI,KAAK,sBAAsB,EAAE,SAAS;AACxC,sBAAM,SAAS,KAAK,WAAW,UAAU,IAAI;AAC7C,oBAAI,CAAC,OAAO,SAAS;AACnB,8BACE,KAAK,yCACJ,MAAM;AACL,0BACE,2CACA,KAAK,UAAU,OAAO,MAAM,MAAM;AAAA,kBAEtC;AAAA,gBACJ;AAAA,cACF;AAEA,kBAAI;AACF,sBAAM,SAAS,MAAM,UAAU,MAAM;AAAA,kBACnC;AAAA,kBACA;AAAA,gBACF,CAAC;AAED,2BAAW,QAAQ;AAAA,kBACjB,MAAM;AAAA,kBACN;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/edge/streams/toolResultStream.ts"],"sourcesContent":["import { Tool } from \"../../../model-context/ModelContextTypes\";\nimport { LanguageModelV1StreamPart } from \"@ai-sdk/provider\";\nimport { z } from \"zod\";\nimport sjson from \"secure-json-parse\";\nimport { ReadonlyJSONValue } from \"../../../utils/json/json-value\";\n\nexport type ToolResultStreamPart =\n | LanguageModelV1StreamPart\n | {\n type: \"annotations\";\n annotations: ReadonlyJSONValue[];\n }\n | {\n type: \"data\";\n data: ReadonlyJSONValue[];\n }\n | {\n type: \"tool-result\";\n toolCallType: \"function\";\n toolCallId: string;\n toolName: string;\n result: unknown;\n isError?: boolean;\n }\n | {\n type: \"step-finish\";\n finishReason:\n | \"stop\"\n | \"length\"\n | \"content-filter\"\n | \"tool-calls\"\n | \"error\"\n | \"other\"\n | \"unknown\";\n usage: {\n promptTokens: number;\n completionTokens: number;\n };\n isContinued: boolean;\n };\n\nexport function toolResultStream(\n tools: Record<string, Tool> | undefined,\n abortSignal: AbortSignal,\n) {\n const toolCallExecutions = new Map<string, Promise<any>>();\n\n return new TransformStream<ToolResultStreamPart, ToolResultStreamPart>({\n transform(chunk, controller) {\n // forward everything\n controller.enqueue(chunk);\n\n // handle tool calls\n const chunkType = chunk.type;\n switch (chunkType) {\n case \"tool-call\": {\n const { toolCallId, toolCallType, toolName, args: argsText } = chunk;\n const tool = tools?.[toolName];\n if (!tool || !tool.execute) return;\n\n let args;\n try {\n args = sjson.parse(argsText);\n } catch (e) {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result:\n \"Function parameter parsing failed. \" +\n JSON.stringify((e as Error).message),\n isError: true,\n });\n return;\n }\n\n toolCallExecutions.set(\n toolCallId,\n (async () => {\n if (!tool.execute) return;\n\n let executeFn = tool.execute;\n\n if (tool.parameters instanceof z.ZodType) {\n const result = tool.parameters.safeParse(args);\n if (!result.success) {\n executeFn =\n tool.experimental_onSchemaValidationError ??\n (() => {\n throw (\n \"Function parameter validation failed. \" +\n JSON.stringify(result.error.issues)\n );\n });\n }\n }\n\n try {\n const result = await executeFn(args, {\n toolCallId,\n abortSignal,\n });\n\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result: result === undefined ? \"<no result>\" : result,\n });\n } catch (error) {\n controller.enqueue({\n type: \"tool-result\",\n toolCallType,\n toolCallId,\n toolName,\n result: \"Error: \" + error,\n isError: true,\n });\n } finally {\n toolCallExecutions.delete(toolCallId);\n }\n })(),\n );\n break;\n }\n\n // ignore other parts\n case \"text-delta\":\n case \"reasoning\":\n case \"tool-call-delta\":\n case \"tool-result\":\n case \"step-finish\":\n case \"finish\":\n case \"error\":\n case \"response-metadata\":\n case \"annotations\":\n case \"data\":\n break;\n\n default: {\n const unhandledType: never = chunkType;\n throw new Error(`Unhandled chunk type: ${unhandledType}`);\n }\n }\n },\n\n async flush() {\n await Promise.all(toolCallExecutions.values());\n },\n });\n}\n"],"mappings":";AAEA,SAAS,SAAS;AAClB,OAAO,WAAW;AAsCX,SAAS,iBACd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BACA;AAAA,kBACA,QAAQ,YAAY;AAAA,kBACpB,SAAS;AAAA,gBACX,CAAC;AAAA,cACH,UAAE;AACA,mCAAmB,OAAO,UAAU;AAAA,cACtC;AAAA,YACF,GAAG;AAAA,UACL;AACA;AAAA,QACF;AAAA;AAAA,QAGA,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AACH;AAAA,QAEF,SAAS;AACP,gBAAM,gBAAuB;AAC7B,gBAAM,IAAI,MAAM,yBAAyB,aAAa,EAAE;AAAA,QAC1D;AAAA,MACF;AAAA,IACF;AAAA,IAEA,MAAM,QAAQ;AACZ,YAAM,QAAQ,IAAI,mBAAmB,OAAO,CAAC;AAAA,IAC/C;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -15,10 +15,9 @@ export type LocalRuntimeOptionsBase = {
|
|
|
15
15
|
feedback?: FeedbackAdapter | undefined;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* This feature will be removed in a future version without notice. DO NOT USE.
|
|
18
|
+
* Names of tools that are allowed to interrupt the run in order to wait for human/external approval.
|
|
20
19
|
*/
|
|
21
|
-
|
|
20
|
+
unstable_humanToolNames?: string[] | undefined;
|
|
22
21
|
};
|
|
23
22
|
export type LocalRuntimeOptions = Omit<LocalRuntimeOptionsBase, "adapters"> & {
|
|
24
23
|
cloud?: AssistantCloud | undefined;
|
|
@@ -37,8 +36,8 @@ export declare const splitLocalRuntimeOptions: <T extends LocalRuntimeOptions>(o
|
|
|
37
36
|
speech?: SpeechSynthesisAdapter | undefined;
|
|
38
37
|
feedback?: FeedbackAdapter | undefined;
|
|
39
38
|
}, "chatModel"> | undefined;
|
|
40
|
-
|
|
39
|
+
unstable_humanToolNames: string[] | undefined;
|
|
41
40
|
};
|
|
42
|
-
otherOptions: Omit<T, "adapters" | "maxSteps" | "
|
|
41
|
+
otherOptions: Omit<T, "adapters" | "maxSteps" | "unstable_humanToolNames" | "cloud" | "initialMessages">;
|
|
43
42
|
};
|
|
44
43
|
//# sourceMappingURL=LocalRuntimeOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalRuntimeOptions.d.ts","sourceRoot":"","sources":["../../../src/runtimes/local/LocalRuntimeOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE;QACR,SAAS,EAAE,gBAAgB,CAAC;QAC5B,OAAO,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;QAC3C,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;QAC5C,MAAM,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;QAC5C,QAAQ,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;KACxC,CAAC;IAEF
|
|
1
|
+
{"version":3,"file":"LocalRuntimeOptions.d.ts","sourceRoot":"","sources":["../../../src/runtimes/local/LocalRuntimeOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,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,7 +29,7 @@ var splitLocalRuntimeOptions = (options) => {
|
|
|
29
29
|
initialMessages,
|
|
30
30
|
maxSteps,
|
|
31
31
|
adapters,
|
|
32
|
-
|
|
32
|
+
unstable_humanToolNames,
|
|
33
33
|
...rest
|
|
34
34
|
} = options;
|
|
35
35
|
return {
|
|
@@ -38,7 +38,7 @@ var splitLocalRuntimeOptions = (options) => {
|
|
|
38
38
|
initialMessages,
|
|
39
39
|
maxSteps,
|
|
40
40
|
adapters,
|
|
41
|
-
|
|
41
|
+
unstable_humanToolNames
|
|
42
42
|
},
|
|
43
43
|
otherOptions: rest
|
|
44
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/local/LocalRuntimeOptions.tsx"],"sourcesContent":["import { ThreadHistoryAdapter } from \"../adapters/thread-history/ThreadHistoryAdapter\";\nimport { AttachmentAdapter } from \"../adapters/attachment/AttachmentAdapter\";\nimport { ThreadMessageLike } from \"../external-store\";\nimport { FeedbackAdapter } from \"../adapters/feedback/FeedbackAdapter\";\nimport { SpeechSynthesisAdapter } from \"../adapters/speech/SpeechAdapterTypes\";\nimport { ChatModelAdapter } from \"./ChatModelAdapter\";\nimport { AssistantCloud } from \"../../cloud\";\n\nexport type LocalRuntimeOptionsBase = {\n maxSteps?: number | undefined;\n adapters: {\n chatModel: ChatModelAdapter;\n history?: ThreadHistoryAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n };\n\n /**\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/local/LocalRuntimeOptions.tsx"],"sourcesContent":["import { ThreadHistoryAdapter } from \"../adapters/thread-history/ThreadHistoryAdapter\";\nimport { AttachmentAdapter } from \"../adapters/attachment/AttachmentAdapter\";\nimport { ThreadMessageLike } from \"../external-store\";\nimport { FeedbackAdapter } from \"../adapters/feedback/FeedbackAdapter\";\nimport { SpeechSynthesisAdapter } from \"../adapters/speech/SpeechAdapterTypes\";\nimport { ChatModelAdapter } from \"./ChatModelAdapter\";\nimport { AssistantCloud } from \"../../cloud\";\n\nexport type LocalRuntimeOptionsBase = {\n maxSteps?: number | undefined;\n adapters: {\n chatModel: ChatModelAdapter;\n history?: ThreadHistoryAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n };\n\n /**\n * Names of tools that are allowed to interrupt the run in order to wait for human/external approval.\n */\n unstable_humanToolNames?: string[] | undefined;\n};\n\n// TODO align LocalRuntimeOptions with LocalRuntimeOptionsBase\nexport type LocalRuntimeOptions = Omit<LocalRuntimeOptionsBase, \"adapters\"> & {\n cloud?: AssistantCloud | undefined;\n initialMessages?: readonly ThreadMessageLike[] | undefined;\n adapters?: Omit<LocalRuntimeOptionsBase[\"adapters\"], \"chatModel\"> | undefined;\n};\n\nexport const splitLocalRuntimeOptions = <T extends LocalRuntimeOptions>(\n options: T,\n) => {\n const {\n cloud,\n initialMessages,\n maxSteps,\n adapters,\n unstable_humanToolNames,\n ...rest\n } = options;\n\n return {\n localRuntimeOptions: {\n cloud,\n initialMessages,\n maxSteps,\n adapters,\n unstable_humanToolNames,\n },\n otherOptions: rest,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BO,IAAM,2BAA2B,CACtC,YACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,SAAO;AAAA,IACL,qBAAqB;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,cAAc;AAAA,EAChB;AACF;","names":[]}
|
|
@@ -5,7 +5,7 @@ var splitLocalRuntimeOptions = (options) => {
|
|
|
5
5
|
initialMessages,
|
|
6
6
|
maxSteps,
|
|
7
7
|
adapters,
|
|
8
|
-
|
|
8
|
+
unstable_humanToolNames,
|
|
9
9
|
...rest
|
|
10
10
|
} = options;
|
|
11
11
|
return {
|
|
@@ -14,7 +14,7 @@ var splitLocalRuntimeOptions = (options) => {
|
|
|
14
14
|
initialMessages,
|
|
15
15
|
maxSteps,
|
|
16
16
|
adapters,
|
|
17
|
-
|
|
17
|
+
unstable_humanToolNames
|
|
18
18
|
},
|
|
19
19
|
otherOptions: rest
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/local/LocalRuntimeOptions.tsx"],"sourcesContent":["import { ThreadHistoryAdapter } from \"../adapters/thread-history/ThreadHistoryAdapter\";\nimport { AttachmentAdapter } from \"../adapters/attachment/AttachmentAdapter\";\nimport { ThreadMessageLike } from \"../external-store\";\nimport { FeedbackAdapter } from \"../adapters/feedback/FeedbackAdapter\";\nimport { SpeechSynthesisAdapter } from \"../adapters/speech/SpeechAdapterTypes\";\nimport { ChatModelAdapter } from \"./ChatModelAdapter\";\nimport { AssistantCloud } from \"../../cloud\";\n\nexport type LocalRuntimeOptionsBase = {\n maxSteps?: number | undefined;\n adapters: {\n chatModel: ChatModelAdapter;\n history?: ThreadHistoryAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n };\n\n /**\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/local/LocalRuntimeOptions.tsx"],"sourcesContent":["import { ThreadHistoryAdapter } from \"../adapters/thread-history/ThreadHistoryAdapter\";\nimport { AttachmentAdapter } from \"../adapters/attachment/AttachmentAdapter\";\nimport { ThreadMessageLike } from \"../external-store\";\nimport { FeedbackAdapter } from \"../adapters/feedback/FeedbackAdapter\";\nimport { SpeechSynthesisAdapter } from \"../adapters/speech/SpeechAdapterTypes\";\nimport { ChatModelAdapter } from \"./ChatModelAdapter\";\nimport { AssistantCloud } from \"../../cloud\";\n\nexport type LocalRuntimeOptionsBase = {\n maxSteps?: number | undefined;\n adapters: {\n chatModel: ChatModelAdapter;\n history?: ThreadHistoryAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n };\n\n /**\n * Names of tools that are allowed to interrupt the run in order to wait for human/external approval.\n */\n unstable_humanToolNames?: string[] | undefined;\n};\n\n// TODO align LocalRuntimeOptions with LocalRuntimeOptionsBase\nexport type LocalRuntimeOptions = Omit<LocalRuntimeOptionsBase, \"adapters\"> & {\n cloud?: AssistantCloud | undefined;\n initialMessages?: readonly ThreadMessageLike[] | undefined;\n adapters?: Omit<LocalRuntimeOptionsBase[\"adapters\"], \"chatModel\"> | undefined;\n};\n\nexport const splitLocalRuntimeOptions = <T extends LocalRuntimeOptions>(\n options: T,\n) => {\n const {\n cloud,\n initialMessages,\n maxSteps,\n adapters,\n unstable_humanToolNames,\n ...rest\n } = options;\n\n return {\n localRuntimeOptions: {\n cloud,\n initialMessages,\n maxSteps,\n adapters,\n unstable_humanToolNames,\n },\n otherOptions: rest,\n };\n};\n"],"mappings":";AA+BO,IAAM,2BAA2B,CACtC,YACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,SAAO;AAAA,IACL,qBAAqB;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,cAAc;AAAA,EAChB;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalThreadRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/local/LocalThreadRuntimeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAA0B,MAAM,aAAa,CAAC;AAIzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACh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AC;AAE3D,qBAAa,sBACX,SAAQ,qBACR,YAAW,iBAAiB;IAE5B,SAAgB,YAAY;;;;;;;;;MAS1B;IAEF,OAAO,CAAC,eAAe,CAAgC;IAEvD,SAAgB,UAAU,SAAS;IACnC,SAAgB,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAM;IAE9D,IAAW,QAAQ;;;;;;MAElB;gBAGC,eAAe,EAAE,oBAAoB,EACrC,OAAO,EAAE,uBAAuB;IAMlC,OAAO,CAAC,QAAQ,CAA2B;IAE3C,OAAO,CAAC,cAAc,CAAiB;IAEvC,IAAW,MAAM,cAEhB;IAEM,qBAAqB,CAAC,OAAO,EAAE,uBAAuB;IA4B7D,OAAO,CAAC,YAAY,CAA4B;IACzC,eAAe;IAcT,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB7C,QAAQ,CAAC,EACpB,QAAQ,EACR,SAAS,GACV,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;YAgCnB,gBAAgB;IAgJvB,SAAS;IAKT,aAAa,CAAC,EACnB,SAAS,EACT,UAAU,EACV,MAAM,GACP,EAAE,oBAAoB;CAqCxB"}
|
|
@@ -131,10 +131,7 @@ var LocalThreadRuntimeCore = class extends import_BaseThreadRuntimeCore.BaseThre
|
|
|
131
131
|
try {
|
|
132
132
|
do {
|
|
133
133
|
message = await this.performRoundtrip(parentId, message, runConfig);
|
|
134
|
-
} while ((0, import_shouldContinue.shouldContinue)(
|
|
135
|
-
message,
|
|
136
|
-
this._options.unstable_shouldContinueIgnoreToolNames ?? []
|
|
137
|
-
));
|
|
134
|
+
} while ((0, import_shouldContinue.shouldContinue)(message, this._options.unstable_humanToolNames));
|
|
138
135
|
} finally {
|
|
139
136
|
this._notifyEventSubscribers("run-end");
|
|
140
137
|
}
|
|
@@ -277,10 +274,7 @@ var LocalThreadRuntimeCore = class extends import_BaseThreadRuntimeCore.BaseThre
|
|
|
277
274
|
content: newContent
|
|
278
275
|
};
|
|
279
276
|
this.repository.addOrUpdateMessage(parentId, message);
|
|
280
|
-
if (added && (0, import_shouldContinue.shouldContinue)(
|
|
281
|
-
message,
|
|
282
|
-
this._options.unstable_shouldContinueIgnoreToolNames ?? []
|
|
283
|
-
)) {
|
|
277
|
+
if (added && (0, import_shouldContinue.shouldContinue)(message, this._options.unstable_humanToolNames)) {
|
|
284
278
|
this.performRoundtrip(parentId, message, this._lastRunConfig);
|
|
285
279
|
}
|
|
286
280
|
}
|