@convex-dev/agent 0.0.8 → 0.0.9-alpha.0
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 +7 -3
- package/dist/commonjs/client/index.d.ts +337 -13
- package/dist/commonjs/client/index.d.ts.map +1 -1
- package/dist/commonjs/client/index.js +163 -24
- package/dist/commonjs/client/index.js.map +1 -1
- package/dist/commonjs/mapping.d.ts +2 -1
- package/dist/commonjs/mapping.d.ts.map +1 -1
- package/dist/commonjs/mapping.js +22 -16
- package/dist/commonjs/mapping.js.map +1 -1
- package/dist/commonjs/react/index.d.ts +11 -0
- package/dist/commonjs/react/index.d.ts.map +1 -1
- package/dist/commonjs/react/index.js +11 -0
- package/dist/commonjs/react/index.js.map +1 -1
- package/dist/esm/client/index.d.ts +337 -13
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +163 -24
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/mapping.d.ts +2 -1
- package/dist/esm/mapping.d.ts.map +1 -1
- package/dist/esm/mapping.js +22 -16
- package/dist/esm/mapping.js.map +1 -1
- package/dist/esm/react/index.d.ts +11 -0
- package/dist/esm/react/index.d.ts.map +1 -1
- package/dist/esm/react/index.js +11 -0
- package/dist/esm/react/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +331 -36
- package/src/mapping.ts +23 -16
- package/src/react/index.ts +11 -0
package/src/react/index.ts
CHANGED
|
@@ -4,6 +4,17 @@ if (typeof window === "undefined") {
|
|
|
4
4
|
throw new Error("this is frontend code, but it's running somewhere else!");
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Use this hook to stream text from a server action, using the
|
|
9
|
+
* toTextStreamResponse or equivalent HTTP streaming endpoint returning text.
|
|
10
|
+
* @param url The URL of the server action to stream text from.
|
|
11
|
+
* e.g. https://....convex.site/yourendpoint
|
|
12
|
+
* @param threadId The ID of the thread to stream text from.
|
|
13
|
+
* @param token The auth token to use for the request.
|
|
14
|
+
* e.g. useAuthToken() from @convex-dev/auth/react
|
|
15
|
+
* @returns A tuple containing the {text, loading, error} and a function to call the endpoint
|
|
16
|
+
* with a given prompt, passing up { prompt, threadId } as the body in JSON.
|
|
17
|
+
*/
|
|
7
18
|
export function useStreamingText(
|
|
8
19
|
url: string,
|
|
9
20
|
threadId: string | null,
|