@tambo-ai/react 0.19.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/react-query-hooks.d.ts +8 -0
- package/dist/hooks/react-query-hooks.d.ts.map +1 -1
- package/dist/hooks/react-query-hooks.js +8 -0
- package/dist/hooks/react-query-hooks.js.map +1 -1
- package/dist/hooks/use-component-state.d.ts +0 -3
- package/dist/hooks/use-component-state.d.ts.map +1 -1
- package/dist/hooks/use-component-state.js +8 -26
- package/dist/hooks/use-component-state.js.map +1 -1
- package/dist/hooks/use-current-message.d.ts +27 -7
- package/dist/hooks/use-current-message.d.ts.map +1 -1
- package/dist/hooks/use-current-message.js +27 -7
- package/dist/hooks/use-current-message.js.map +1 -1
- package/dist/hooks/use-streaming-props.d.ts +0 -2
- package/dist/hooks/use-streaming-props.d.ts.map +1 -1
- package/dist/hooks/use-streaming-props.js +0 -2
- package/dist/hooks/use-streaming-props.js.map +1 -1
- package/dist/hooks/use-suggestions.d.ts +0 -1
- package/dist/hooks/use-suggestions.d.ts.map +1 -1
- package/dist/hooks/use-suggestions.js +0 -1
- package/dist/hooks/use-suggestions.js.map +1 -1
- package/dist/hooks/use-tambo-threads.d.ts +35 -5
- package/dist/hooks/use-tambo-threads.d.ts.map +1 -1
- package/dist/hooks/use-tambo-threads.js +9 -1
- package/dist/hooks/use-tambo-threads.js.map +1 -1
- package/dist/hooks/use-thread-input.d.ts +0 -1
- package/dist/hooks/use-thread-input.d.ts.map +1 -1
- package/dist/hooks/use-thread-input.js +0 -1
- package/dist/hooks/use-thread-input.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/model/component-metadata.d.ts +6 -3
- package/dist/model/component-metadata.d.ts.map +1 -1
- package/dist/model/component-metadata.js.map +1 -1
- package/dist/model/generate-component-response.d.ts +9 -2
- package/dist/model/generate-component-response.d.ts.map +1 -1
- package/dist/model/generate-component-response.js +5 -0
- package/dist/model/generate-component-response.js.map +1 -1
- package/dist/model/tambo-thread.d.ts +4 -2
- package/dist/model/tambo-thread.d.ts.map +1 -1
- package/dist/model/tambo-thread.js.map +1 -1
- package/dist/model/validate-input.d.ts +5 -0
- package/dist/model/validate-input.d.ts.map +1 -1
- package/dist/model/validate-input.js +5 -1
- package/dist/model/validate-input.js.map +1 -1
- package/dist/providers/tambo-client-provider.d.ts +31 -0
- package/dist/providers/tambo-client-provider.d.ts.map +1 -1
- package/dist/providers/tambo-client-provider.js +21 -0
- package/dist/providers/tambo-client-provider.js.map +1 -1
- package/dist/providers/tambo-component-provider.d.ts +12 -0
- package/dist/providers/tambo-component-provider.d.ts.map +1 -1
- package/dist/providers/tambo-component-provider.js +24 -0
- package/dist/providers/tambo-component-provider.js.map +1 -1
- package/dist/providers/tambo-provider.d.ts +18 -1
- package/dist/providers/tambo-provider.d.ts.map +1 -1
- package/dist/providers/tambo-provider.js +25 -2
- package/dist/providers/tambo-provider.js.map +1 -1
- package/dist/providers/tambo-registry-provider.d.ts +14 -1
- package/dist/providers/tambo-registry-provider.d.ts.map +1 -1
- package/dist/providers/tambo-registry-provider.js +25 -0
- package/dist/providers/tambo-registry-provider.js.map +1 -1
- package/dist/providers/tambo-thread-provider.d.ts +25 -2
- package/dist/providers/tambo-thread-provider.d.ts.map +1 -1
- package/dist/providers/tambo-thread-provider.js +32 -26
- package/dist/providers/tambo-thread-provider.js.map +1 -1
- package/dist/util/generate-component.d.ts +5 -1
- package/dist/util/generate-component.d.ts.map +1 -1
- package/dist/util/generate-component.js +5 -1
- package/dist/util/generate-component.js.map +1 -1
- package/dist/util/query-utils.d.ts +16 -0
- package/dist/util/query-utils.d.ts.map +1 -1
- package/dist/util/query-utils.js +16 -0
- package/dist/util/query-utils.js.map +1 -1
- package/dist/util/registry.d.ts +27 -1
- package/dist/util/registry.d.ts.map +1 -1
- package/dist/util/registry.js +29 -4
- package/dist/util/registry.js.map +1 -1
- package/dist/util/tool-caller.d.ts +6 -0
- package/dist/util/tool-caller.d.ts.map +1 -1
- package/dist/util/tool-caller.js +6 -0
- package/dist/util/tool-caller.js.map +1 -1
- package/esm/hooks/react-query-hooks.d.ts +8 -0
- package/esm/hooks/react-query-hooks.d.ts.map +1 -1
- package/esm/hooks/react-query-hooks.js +8 -0
- package/esm/hooks/react-query-hooks.js.map +1 -1
- package/esm/hooks/use-component-state.d.ts +0 -3
- package/esm/hooks/use-component-state.d.ts.map +1 -1
- package/esm/hooks/use-component-state.js +2 -23
- package/esm/hooks/use-component-state.js.map +1 -1
- package/esm/hooks/use-current-message.d.ts +27 -7
- package/esm/hooks/use-current-message.d.ts.map +1 -1
- package/esm/hooks/use-current-message.js +27 -7
- package/esm/hooks/use-current-message.js.map +1 -1
- package/esm/hooks/use-streaming-props.d.ts +0 -2
- package/esm/hooks/use-streaming-props.d.ts.map +1 -1
- package/esm/hooks/use-streaming-props.js +0 -2
- package/esm/hooks/use-streaming-props.js.map +1 -1
- package/esm/hooks/use-suggestions.d.ts +0 -1
- package/esm/hooks/use-suggestions.d.ts.map +1 -1
- package/esm/hooks/use-suggestions.js +0 -1
- package/esm/hooks/use-suggestions.js.map +1 -1
- package/esm/hooks/use-tambo-threads.d.ts +35 -5
- package/esm/hooks/use-tambo-threads.d.ts.map +1 -1
- package/esm/hooks/use-tambo-threads.js +9 -1
- package/esm/hooks/use-tambo-threads.js.map +1 -1
- package/esm/hooks/use-thread-input.d.ts +0 -1
- package/esm/hooks/use-thread-input.d.ts.map +1 -1
- package/esm/hooks/use-thread-input.js +0 -1
- package/esm/hooks/use-thread-input.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/model/component-metadata.d.ts +6 -3
- package/esm/model/component-metadata.d.ts.map +1 -1
- package/esm/model/component-metadata.js.map +1 -1
- package/esm/model/generate-component-response.d.ts +9 -2
- package/esm/model/generate-component-response.d.ts.map +1 -1
- package/esm/model/generate-component-response.js +5 -0
- package/esm/model/generate-component-response.js.map +1 -1
- package/esm/model/tambo-thread.d.ts +4 -2
- package/esm/model/tambo-thread.d.ts.map +1 -1
- package/esm/model/tambo-thread.js.map +1 -1
- package/esm/model/validate-input.d.ts +5 -0
- package/esm/model/validate-input.d.ts.map +1 -1
- package/esm/model/validate-input.js +5 -1
- package/esm/model/validate-input.js.map +1 -1
- package/esm/providers/tambo-client-provider.d.ts +31 -0
- package/esm/providers/tambo-client-provider.d.ts.map +1 -1
- package/esm/providers/tambo-client-provider.js +21 -0
- package/esm/providers/tambo-client-provider.js.map +1 -1
- package/esm/providers/tambo-component-provider.d.ts +12 -0
- package/esm/providers/tambo-component-provider.d.ts.map +1 -1
- package/esm/providers/tambo-component-provider.js +24 -0
- package/esm/providers/tambo-component-provider.js.map +1 -1
- package/esm/providers/tambo-provider.d.ts +18 -1
- package/esm/providers/tambo-provider.d.ts.map +1 -1
- package/esm/providers/tambo-provider.js +25 -2
- package/esm/providers/tambo-provider.js.map +1 -1
- package/esm/providers/tambo-registry-provider.d.ts +14 -1
- package/esm/providers/tambo-registry-provider.d.ts.map +1 -1
- package/esm/providers/tambo-registry-provider.js +25 -0
- package/esm/providers/tambo-registry-provider.js.map +1 -1
- package/esm/providers/tambo-thread-provider.d.ts +25 -2
- package/esm/providers/tambo-thread-provider.d.ts.map +1 -1
- package/esm/providers/tambo-thread-provider.js +32 -26
- package/esm/providers/tambo-thread-provider.js.map +1 -1
- package/esm/util/generate-component.d.ts +5 -1
- package/esm/util/generate-component.d.ts.map +1 -1
- package/esm/util/generate-component.js +5 -1
- package/esm/util/generate-component.js.map +1 -1
- package/esm/util/query-utils.d.ts +16 -0
- package/esm/util/query-utils.d.ts.map +1 -1
- package/esm/util/query-utils.js +16 -0
- package/esm/util/query-utils.js.map +1 -1
- package/esm/util/registry.d.ts +27 -1
- package/esm/util/registry.d.ts.map +1 -1
- package/esm/util/registry.js +28 -2
- package/esm/util/registry.js.map +1 -1
- package/esm/util/tool-caller.d.ts +6 -0
- package/esm/util/tool-caller.d.ts.map +1 -1
- package/esm/util/tool-caller.js +6 -0
- package/esm/util/tool-caller.js.map +1 -1
- package/package.json +4 -2
- package/dist/util/messages.d.ts +0 -3
- package/dist/util/messages.d.ts.map +0 -1
- package/dist/util/messages.js +0 -12
- package/dist/util/messages.js.map +0 -1
- package/esm/util/messages.d.ts +0 -3
- package/esm/util/messages.d.ts.map +0 -1
- package/esm/util/messages.js +0 -9
- package/esm/util/messages.js.map +0 -1
|
@@ -43,7 +43,6 @@ export type UseThreadInput = UseThreadInputInternal & UseMutationResult<void, Er
|
|
|
43
43
|
}>;
|
|
44
44
|
/**
|
|
45
45
|
* Hook for managing thread message input state and submission
|
|
46
|
-
*
|
|
47
46
|
* @returns Interface for managing thread input state and submission
|
|
48
47
|
*/
|
|
49
48
|
export declare function useTamboThreadInput(contextKey?: string): UseThreadInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-thread-input.d.ts","sourceRoot":"","sources":["../../src/hooks/use-thread-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAO1D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAC/B,kDAAkD;;IAElD,0CAA0C;;IAE1C,qDAAqD;;IAErD,yCAAyC;;CAEjC,CAAC;AAEX;;;GAGG;AACH,UAAU,sBAAsB;IAC9B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;;OAKG;IACH,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB;AACD,MAAM,MAAM,cAAc,GAAG,sBAAsB,GACjD,iBAAiB,CACf,IAAI,EACJ,KAAK,EACL;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAClD,CAAC;AAEJ
|
|
1
|
+
{"version":3,"file":"use-thread-input.d.ts","sourceRoot":"","sources":["../../src/hooks/use-thread-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAO1D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAC/B,kDAAkD;;IAElD,0CAA0C;;IAE1C,qDAAqD;;IAErD,yCAAyC;;CAEjC,CAAC;AAEX;;;GAGG;AACH,UAAU,sBAAsB;IAC9B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;;OAKG;IACH,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB;AACD,MAAM,MAAM,cAAc,GAAG,sBAAsB,GACjD,iBAAiB,CACf,IAAI,EACJ,KAAK,EACL;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAClD,CAAC;AAEJ;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,cAAc,CAwCvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-thread-input.js","sourceRoot":"","sources":["../../src/hooks/use-thread-input.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"use-thread-input.js","sourceRoot":"","sources":["../../src/hooks/use-thread-input.ts"],"names":[],"mappings":";;;AAyDA,kDAw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rB,GAAG,aAAa,EACjB,GAAG,IAAA,oCAAgB,EAAC;QACnB,UAAU,EAAE,MAAM;KACnB,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,aAAa;QAChB,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE,aAAa;QACvB,MAAM,EAAE,WAAW;KACF,CAAC;AACtB,CAAC","sourcesContent":["import { UseMutationResult } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport { ThreadInputError } from \"../model/thread-input-error\";\nimport { validateInput } from \"../model/validate-input\";\nimport { useTamboThread } from \"../providers/tambo-thread-provider\";\nimport { useTamboMutation } from \"./react-query-hooks\";\n\n/**\n * Error messages for various input-related error scenarios\n * These messages are used to provide user-friendly error feedback\n * @readonly\n */\nexport const INPUT_ERROR_MESSAGES = {\n /** Error when attempting to submit empty input */\n EMPTY: \"Message cannot be empty\",\n /** Error when network connection fails */\n NETWORK: \"Network error. Please check your connection\",\n /** Error when server fails to process the request */\n SERVER: \"Server error. Please try again\",\n /** Error when input format is invalid */\n VALIDATION: \"Invalid message format\",\n} as const;\n\n/**\n * Interface for the thread input hook return value\n * Provides all necessary functions and state for managing thread input\n */\ninterface UseThreadInputInternal {\n /** Current value of the input field */\n value: string;\n /**\n * Function to update the input value\n * @param value - New value for the input field\n */\n setValue: (value: string) => void;\n /**\n * Function to submit the current input value\n * Validates input, handles errors, and cleans up state after submission\n * @throws {ThreadInputError} If submission fails\n * @returns Promise that resolves when submission is complete\n */\n submit: (options?: {\n contextKey?: string;\n streamResponse?: boolean;\n }) => Promise<void>;\n}\nexport type UseThreadInput = UseThreadInputInternal &\n UseMutationResult<\n void,\n Error,\n { contextKey?: string; streamResponse?: boolean }\n >;\n\n/**\n * Hook for managing thread message input state and submission\n * @returns Interface for managing thread input state and submission\n */\nexport function useTamboThreadInput(contextKey?: string): UseThreadInput {\n const { thread, inputValue, setInputValue, sendThreadMessage } =\n useTamboThread();\n\n const submit = useCallback(\n async ({\n contextKey: submitContextKey,\n streamResponse,\n }: { contextKey?: string; streamResponse?: boolean } = {}) => {\n const validation = validateInput(inputValue);\n if (!validation.isValid) {\n throw new ThreadInputError(\n `Cannot submit message: ${validation.error ?? INPUT_ERROR_MESSAGES.VALIDATION}`,\n { cause: validation.error },\n );\n }\n\n await sendThreadMessage(validation.sanitizedInput, {\n threadId: thread.id,\n contextKey: submitContextKey ?? contextKey ?? undefined,\n streamResponse: streamResponse,\n });\n setInputValue(\"\");\n },\n [inputValue, sendThreadMessage, thread.id, contextKey, setInputValue],\n );\n const {\n mutateAsync: submitAsync,\n mutate: _unusedSubmit,\n ...mutationState\n } = useTamboMutation({\n mutationFn: submit,\n });\n\n return {\n ...mutationState,\n value: inputValue,\n setValue: setInputValue,\n submit: submitAsync,\n } as UseThreadInput;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { TamboMessageProvider, useTamboCurrentMessage, useTamboMessageContext, }
|
|
|
4
4
|
export { useTamboStreamingProps } from "./hooks/use-streaming-props";
|
|
5
5
|
export * from "./hooks/use-suggestions";
|
|
6
6
|
export { useTamboThreadInput } from "./hooks/use-thread-input";
|
|
7
|
-
export
|
|
7
|
+
export { TamboClientProvider, TamboComponentProvider, TamboProvider, TamboThreadProvider, useTambo, useTamboClient, useTamboThread, type TamboComponent, type TamboRegistryContext, } from "./providers";
|
|
8
8
|
export type { APIError, RateLimitError, TamboAIError, } from "@tambo-ai/typescript-sdk";
|
|
9
9
|
export type { Suggestion, SuggestionGenerateParams, SuggestionGenerateResponse, SuggestionListResponse, } from "@tambo-ai/typescript-sdk/resources/beta/threads/suggestions";
|
|
10
10
|
export { useTamboThreadList } from "./hooks/use-tambo-threads";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wKAAwK;AACxK,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE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|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.GenerationStage = exports.useTamboThreadList = exports.useTamboThreadInput = exports.useTamboStreamingProps = exports.useTamboMessageContext = exports.useTamboCurrentMessage = exports.TamboMessageProvider = exports.useTamboComponentState = void 0;
|
|
17
|
+
exports.GenerationStage = exports.useTamboThreadList = exports.useTamboThread = exports.useTamboClient = exports.useTambo = exports.TamboThreadProvider = exports.TamboProvider = exports.TamboComponentProvider = exports.TamboClientProvider = exports.useTamboThreadInput = exports.useTamboStreamingProps = exports.useTamboMessageContext = exports.useTamboCurrentMessage = exports.TamboMessageProvider = exports.useTamboComponentState = void 0;
|
|
18
18
|
/** Exports for the library. Only publically available exports are re-exported here. Anything not exported here is not supported and may change or break at any time. */
|
|
19
19
|
var use_component_state_1 = require("./hooks/use-component-state");
|
|
20
20
|
Object.defineProperty(exports, "useTamboComponentState", { enumerable: true, get: function () { return use_component_state_1.useTamboComponentState; } });
|
|
@@ -28,7 +28,14 @@ __exportStar(require("./hooks/use-suggestions"), exports);
|
|
|
28
28
|
var use_thread_input_1 = require("./hooks/use-thread-input");
|
|
29
29
|
Object.defineProperty(exports, "useTamboThreadInput", { enumerable: true, get: function () { return use_thread_input_1.useTamboThreadInput; } });
|
|
30
30
|
// Re-export provider components
|
|
31
|
-
|
|
31
|
+
var providers_1 = require("./providers");
|
|
32
|
+
Object.defineProperty(exports, "TamboClientProvider", { enumerable: true, get: function () { return providers_1.TamboClientProvider; } });
|
|
33
|
+
Object.defineProperty(exports, "TamboComponentProvider", { enumerable: true, get: function () { return providers_1.TamboComponentProvider; } });
|
|
34
|
+
Object.defineProperty(exports, "TamboProvider", { enumerable: true, get: function () { return providers_1.TamboProvider; } });
|
|
35
|
+
Object.defineProperty(exports, "TamboThreadProvider", { enumerable: true, get: function () { return providers_1.TamboThreadProvider; } });
|
|
36
|
+
Object.defineProperty(exports, "useTambo", { enumerable: true, get: function () { return providers_1.useTambo; } });
|
|
37
|
+
Object.defineProperty(exports, "useTamboClient", { enumerable: true, get: function () { return providers_1.useTamboClient; } });
|
|
38
|
+
Object.defineProperty(exports, "useTamboThread", { enumerable: true, get: function () { return providers_1.useTamboThread; } });
|
|
32
39
|
var use_tambo_threads_1 = require("./hooks/use-tambo-threads");
|
|
33
40
|
Object.defineProperty(exports, "useTamboThreadList", { enumerable: true, get: function () { return use_tambo_threads_1.useTamboThreadList; } });
|
|
34
41
|
var generate_component_response_1 = require("./model/generate-component-response");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wKAAwK;AACxK,mEAAqE;AAA5D,6HAAA,sBAAsB,OAAA;AAC/B,mEAIqC;AAHnC,2HAAA,oBAAoB,OAAA;AACpB,6HAAA,sBAAsB,OAAA;AACtB,6HAAA,sBAAsB,OAAA;AAExB,mEAAqE;AAA5D,6HAAA,sBAAsB,OAAA;AAC/B,0DAAwC;AACxC,6DAA+D;AAAtD,uHAAA,mBAAmB,OAAA;AAE5B,gCAAgC;AAChC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wKAAwK;AACxK,mEAAqE;AAA5D,6HAAA,sBAAsB,OAAA;AAC/B,mEAIqC;AAHnC,2HAAA,oBAAoB,OAAA;AACpB,6HAAA,sBAAsB,OAAA;AACtB,6HAAA,sBAAsB,OAAA;AAExB,mEAAqE;AAA5D,6HAAA,sBAAsB,OAAA;AAC/B,0DAAwC;AACxC,6DAA+D;AAAtD,uHAAA,mBAAmB,OAAA;AAE5B,gCAAgC;AAChC,yCAUqB;AATnB,gHAAA,mBAAmB,OAAA;AACnB,mHAAA,sBAAsB,OAAA;AACtB,0GAAA,aAAa,OAAA;AACb,gHAAA,mBAAmB,OAAA;AACnB,qGAAA,QAAQ,OAAA;AACR,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AAiBhB,+DAA+D;AAAtD,uHAAA,kBAAkB,OAAA;AAQ3B,mFAG6C;AAF3C,8HAAA,eAAe,OAAA","sourcesContent":["/** Exports for the library. Only publically available exports are re-exported here. Anything not exported here is not supported and may change or break at any time. */\nexport { useTamboComponentState } from \"./hooks/use-component-state\";\nexport {\n TamboMessageProvider,\n useTamboCurrentMessage,\n useTamboMessageContext,\n} from \"./hooks/use-current-message\";\nexport { useTamboStreamingProps } from \"./hooks/use-streaming-props\";\nexport * from \"./hooks/use-suggestions\";\nexport { useTamboThreadInput } from \"./hooks/use-thread-input\";\n\n// Re-export provider components\nexport {\n TamboClientProvider,\n TamboComponentProvider,\n TamboProvider,\n TamboThreadProvider,\n useTambo,\n useTamboClient,\n useTamboThread,\n type TamboComponent,\n type TamboRegistryContext,\n} from \"./providers\";\n\n// Re-export types from Tambo Node SDK\nexport type {\n APIError,\n RateLimitError,\n TamboAIError,\n} from \"@tambo-ai/typescript-sdk\";\nexport type {\n Suggestion,\n SuggestionGenerateParams,\n SuggestionGenerateResponse,\n SuggestionListResponse,\n} from \"@tambo-ai/typescript-sdk/resources/beta/threads/suggestions\";\nexport { useTamboThreadList } from \"./hooks/use-tambo-threads\";\nexport {\n type ComponentContextToolMetadata,\n type ComponentRegistry,\n type ParameterSpec,\n type RegisteredComponent,\n type TamboTool,\n} from \"./model/component-metadata\";\nexport {\n GenerationStage,\n type TamboThreadMessage,\n} from \"./model/generate-component-response\";\nexport { type TamboThread } from \"./model/tambo-thread\";\n"]}
|
|
@@ -38,7 +38,8 @@ export interface TamboComponent {
|
|
|
38
38
|
name: string;
|
|
39
39
|
/** The description of the component */
|
|
40
40
|
description: string;
|
|
41
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* The React component to render.
|
|
42
43
|
*
|
|
43
44
|
* Make sure to pass the Component itself, not an instance of the component. For example,
|
|
44
45
|
* if you have a component like this:
|
|
@@ -57,11 +58,13 @@ export interface TamboComponent {
|
|
|
57
58
|
* ```
|
|
58
59
|
*/
|
|
59
60
|
component: ComponentType<any>;
|
|
60
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* A zod schema for the component props. (Recommended)
|
|
61
63
|
* Either this or propsDefinition must be provided, but not both.
|
|
62
64
|
*/
|
|
63
65
|
propsSchema?: z.ZodTypeAny;
|
|
64
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The props definition of the component as a JSON object.
|
|
65
68
|
* Either this or propsSchema must be provided, but not both.
|
|
66
69
|
*/
|
|
67
70
|
propsDefinition?: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-metadata.d.ts","sourceRoot":"","sources":["../../src/model/component-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,+FAA+F;AAC/F,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,cAAc,GAAG;IACnD,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;CAC7C,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,4BACf,SAAQ,OAAO,CAAC,4BAA4B;IAC5C,UAAU,EAAE,aAAa,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,mBAAmB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACtD,UAAU,EAAE,4BAA4B,CAAC;CAC1C;AAED,MAAM,W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BAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAC7D;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAE9B;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;IAC3B;;;OAGG;IACH,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IACtC,uDAAuD;IACvD,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-metadata.js","sourceRoot":"","sources":["../../src/model/component-metadata.ts"],"names":[],"mappings":"","sourcesContent":["import TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { ComponentType } from \"react\";\nimport z from \"zod\";\nimport type zodToJsonSchema from \"zod-to-json-schema\";\n/** Extension of the ToolParameters interface from Tambo AI to include JSONSchema definition */\nexport type ParameterSpec = TamboAI.ToolParameters & {\n schema?: ReturnType<typeof zodToJsonSchema>;\n};\n\n/**\n * Extends the base ContextTool interface from Tambo AI to include schema information\n * for parameter validation using zod-to-json-schema.\n */\nexport interface ComponentContextToolMetadata\n extends TamboAI.ComponentContextToolMetadata {\n parameters: ParameterSpec[];\n}\n\nexport interface ComponentContextTool {\n getComponentContext: (...args: any[]) => Promise<any>;\n definition: ComponentContextToolMetadata;\n}\n\nexport interface RegisteredComponent extends TamboAI.AvailableComponent {\n component: ComponentType<any>;\n loadingComponent?: ComponentType<any>;\n}\n\nexport type ComponentRegistry = Record<string, RegisteredComponent>;\n\nexport type TamboToolRegistry = Record<string, TamboTool>;\n\nexport interface TamboTool<\n Args extends z.ZodTuple<any, any> = z.ZodTuple<any, any>,\n Returns extends z.ZodTypeAny = z.ZodTypeAny,\n> {\n name: string;\n description: string;\n tool: (...args: z.infer<Args>) => z.infer<Returns>;\n toolSchema: z.ZodFunction<Args, Returns>;\n}\n\nexport type TamboToolAssociations = Record<string, string[]>;\n/**\n * A component that can be registered with the TamboRegistryProvider.\n */\n\nexport interface TamboComponent {\n /** The name of the component */\n name: string;\n /** The description of the component */\n description: string;\n
|
|
1
|
+
{"version":3,"file":"component-metadata.js","sourceRoot":"","sources":["../../src/model/component-metadata.ts"],"names":[],"mappings":"","sourcesContent":["import TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { ComponentType } from \"react\";\nimport z from \"zod\";\nimport type zodToJsonSchema from \"zod-to-json-schema\";\n/** Extension of the ToolParameters interface from Tambo AI to include JSONSchema definition */\nexport type ParameterSpec = TamboAI.ToolParameters & {\n schema?: ReturnType<typeof zodToJsonSchema>;\n};\n\n/**\n * Extends the base ContextTool interface from Tambo AI to include schema information\n * for parameter validation using zod-to-json-schema.\n */\nexport interface ComponentContextToolMetadata\n extends TamboAI.ComponentContextToolMetadata {\n parameters: ParameterSpec[];\n}\n\nexport interface ComponentContextTool {\n getComponentContext: (...args: any[]) => Promise<any>;\n definition: ComponentContextToolMetadata;\n}\n\nexport interface RegisteredComponent extends TamboAI.AvailableComponent {\n component: ComponentType<any>;\n loadingComponent?: ComponentType<any>;\n}\n\nexport type ComponentRegistry = Record<string, RegisteredComponent>;\n\nexport type TamboToolRegistry = Record<string, TamboTool>;\n\nexport interface TamboTool<\n Args extends z.ZodTuple<any, any> = z.ZodTuple<any, any>,\n Returns extends z.ZodTypeAny = z.ZodTypeAny,\n> {\n name: string;\n description: string;\n tool: (...args: z.infer<Args>) => z.infer<Returns>;\n toolSchema: z.ZodFunction<Args, Returns>;\n}\n\nexport type TamboToolAssociations = Record<string, string[]>;\n/**\n * A component that can be registered with the TamboRegistryProvider.\n */\n\nexport interface TamboComponent {\n /** The name of the component */\n name: string;\n /** The description of the component */\n description: string;\n /**\n * The React component to render.\n *\n * Make sure to pass the Component itself, not an instance of the component. For example,\n * if you have a component like this:\n *\n * ```tsx\n * const MyComponent = () => {\n * return <div>My Component</div>;\n * };\n * ```\n *\n * You should pass the `Component`:\n *\n * ```tsx\n * const components = [MyComponent];\n * <TamboRegistryProvider components={components} />\n * ```\n */\n component: ComponentType<any>;\n\n /**\n * A zod schema for the component props. (Recommended)\n * Either this or propsDefinition must be provided, but not both.\n */\n propsSchema?: z.ZodTypeAny;\n /**\n * The props definition of the component as a JSON object.\n * Either this or propsSchema must be provided, but not both.\n */\n propsDefinition?: any;\n /** The loading component to render while the component is loading */\n loadingComponent?: ComponentType<any>;\n /** The tools that are associated with the component */\n associatedTools?: TamboTool[];\n}\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import TamboAI from "@tambo-ai/typescript-sdk";
|
|
2
2
|
import { ReactElement } from "react";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
3
|
+
/**
|
|
4
|
+
* An extension of the TamboAI.Beta.Threads.ThreadMessage type that includes a
|
|
5
|
+
* renderedComponent
|
|
6
|
+
*/
|
|
5
7
|
export interface TamboThreadMessage extends TamboAI.Beta.Threads.ThreadMessage {
|
|
6
8
|
renderedComponent?: ReactElement | null;
|
|
7
9
|
}
|
|
@@ -14,5 +16,10 @@ export declare enum GenerationStage {
|
|
|
14
16
|
COMPLETE = "COMPLETE",
|
|
15
17
|
ERROR = "ERROR"
|
|
16
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the generation stage is in a state where it can accept user input.
|
|
21
|
+
* @param generationStage - The generation stage to check
|
|
22
|
+
* @returns True if the generation stage is idle, false otherwise
|
|
23
|
+
*/
|
|
17
24
|
export declare function isIdleStage(generationStage: GenerationStage): boolean;
|
|
18
25
|
//# sourceMappingURL=generate-component-response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-component-response.d.ts","sourceRoot":"","sources":["../../src/model/generate-component-response.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC;
|
|
1
|
+
{"version":3,"file":"generate-component-response.d.ts","sourceRoot":"","sources":["../../src/model/generate-component-response.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa;IAC5E,iBAAiB,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CACzC;AAED,oBAAY,eAAe;IACzB,IAAI,SAAS;IACb,kBAAkB,uBAAuB;IACzC,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,QAAQ,aAAa;IACrB,KAAK,UAAU;CAChB;AACD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,eAAe,EAAE,eAAe,WAM3D"}
|
|
@@ -12,6 +12,11 @@ var GenerationStage;
|
|
|
12
12
|
GenerationStage["COMPLETE"] = "COMPLETE";
|
|
13
13
|
GenerationStage["ERROR"] = "ERROR";
|
|
14
14
|
})(GenerationStage || (exports.GenerationStage = GenerationStage = {}));
|
|
15
|
+
/**
|
|
16
|
+
* Checks if the generation stage is in a state where it can accept user input.
|
|
17
|
+
* @param generationStage - The generation stage to check
|
|
18
|
+
* @returns True if the generation stage is idle, false otherwise
|
|
19
|
+
*/
|
|
15
20
|
function isIdleStage(generationStage) {
|
|
16
21
|
return [
|
|
17
22
|
GenerationStage.IDLE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-component-response.js","sourceRoot":"","sources":["../../src/model/generate-component-response.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"generate-component-response.js","sourceRoot":"","sources":["../../src/model/generate-component-response.ts"],"names":[],"mappings":";;;AAyBA,kCAMC;AApBD,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,4DAAyC,CAAA;IACzC,wDAAqC,CAAA;IACrC,8DAA2C,CAAA;IAC3C,4DAAyC,CAAA;IACzC,wCAAqB,CAAA;IACrB,kCAAe,CAAA;AACjB,CAAC,EARW,eAAe,+BAAf,eAAe,QAQ1B;AACD;;;;GAIG;AACH,SAAgB,WAAW,CAAC,eAAgC;IAC1D,OAAO;QACL,eAAe,CAAC,IAAI;QACpB,eAAe,CAAC,QAAQ;QACxB,eAAe,CAAC,KAAK;KACtB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { ReactElement } from \"react\";\n\n/**\n * An extension of the TamboAI.Beta.Threads.ThreadMessage type that includes a\n * renderedComponent\n */\nexport interface TamboThreadMessage extends TamboAI.Beta.Threads.ThreadMessage {\n renderedComponent?: ReactElement | null;\n}\n\nexport enum GenerationStage {\n IDLE = \"IDLE\",\n CHOOSING_COMPONENT = \"CHOOSING_COMPONENT\",\n FETCHING_CONTEXT = \"FETCHING_CONTEXT\",\n HYDRATING_COMPONENT = \"HYDRATING_COMPONENT\",\n STREAMING_RESPONSE = \"STREAMING_RESPONSE\",\n COMPLETE = \"COMPLETE\",\n ERROR = \"ERROR\",\n}\n/**\n * Checks if the generation stage is in a state where it can accept user input.\n * @param generationStage - The generation stage to check\n * @returns True if the generation stage is idle, false otherwise\n */\nexport function isIdleStage(generationStage: GenerationStage) {\n return [\n GenerationStage.IDLE,\n GenerationStage.COMPLETE,\n GenerationStage.ERROR,\n ].includes(generationStage);\n}\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import TamboAI from "@tambo-ai/typescript-sdk";
|
|
2
2
|
import { TamboThreadMessage } from "./generate-component-response";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
3
|
+
/**
|
|
4
|
+
* An extension of the TamboAI.Beta.Thread type that includes
|
|
5
|
+
* messages with renderedComponent
|
|
6
|
+
*/
|
|
5
7
|
export interface TamboThread extends TamboAI.Beta.Thread {
|
|
6
8
|
messages: TamboThreadMessage[];
|
|
7
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-thread.d.ts","sourceRoot":"","sources":["../../src/model/tambo-thread.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;
|
|
1
|
+
{"version":3,"file":"tambo-thread.d.ts","sourceRoot":"","sources":["../../src/model/tambo-thread.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,IAAI,CAAC,MAAM;IACtD,QAAQ,EAAE,kBAAkB,EAAE,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-thread.js","sourceRoot":"","sources":["../../src/model/tambo-thread.ts"],"names":[],"mappings":"","sourcesContent":["import TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { TamboThreadMessage } from \"./generate-component-response\";\n\n
|
|
1
|
+
{"version":3,"file":"tambo-thread.js","sourceRoot":"","sources":["../../src/model/tambo-thread.ts"],"names":[],"mappings":"","sourcesContent":["import TamboAI from \"@tambo-ai/typescript-sdk\";\nimport { TamboThreadMessage } from \"./generate-component-response\";\n\n/**\n * An extension of the TamboAI.Beta.Thread type that includes\n * messages with renderedComponent\n */\nexport interface TamboThread extends TamboAI.Beta.Thread {\n messages: TamboThreadMessage[];\n}\n"]}
|
|
@@ -3,5 +3,10 @@ export interface ValidationResult {
|
|
|
3
3
|
error?: Error;
|
|
4
4
|
sanitizedInput: string;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Validates the input of a message. Makes sure the message is not empty and is not too long.
|
|
8
|
+
* @param input - The input to validate
|
|
9
|
+
* @returns The validation result
|
|
10
|
+
*/
|
|
6
11
|
export declare function validateInput(input: string): ValidationResult;
|
|
7
12
|
//# sourceMappingURL=validate-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-input.d.ts","sourceRoot":"","sources":["../../src/model/validate-input.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"validate-input.d.ts","sourceRoot":"","sources":["../../src/model/validate-input.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAwB7D"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateInput = validateInput;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Validates the input of a message. Makes sure the message is not empty and is not too long.
|
|
6
|
+
* @param input - The input to validate
|
|
7
|
+
* @returns The validation result
|
|
8
|
+
*/
|
|
5
9
|
function validateInput(input) {
|
|
6
10
|
const trimmed = input.trim();
|
|
7
11
|
if (trimmed.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-input.js","sourceRoot":"","sources":["../../src/model/validate-input.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"validate-input.js","sourceRoot":"","sources":["../../src/model/validate-input.ts"],"names":[],"mappings":";;AAWA,sCAwBC;AA7BD;;;;GAIG;AACH,SAAgB,aAAa,CAAC,KAAa;IACzC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAE7B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,IAAI,KAAK,CAAC,yBAAyB,CAAC;YAC3C,cAAc,EAAE,OAAO;SACxB,CAAC;IACJ,CAAC;IAED,+CAA+C;IAC/C,IAAI,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;QAC3B,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,IAAI,KAAK,CAAC,4CAA4C,CAAC;YAC9D,cAAc,EAAE,OAAO;SACxB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,OAAO;KACxB,CAAC;AACJ,CAAC","sourcesContent":["export interface ValidationResult {\n isValid: boolean;\n error?: Error;\n sanitizedInput: string;\n}\n\n/**\n * Validates the input of a message. Makes sure the message is not empty and is not too long.\n * @param input - The input to validate\n * @returns The validation result\n */\nexport function validateInput(input: string): ValidationResult {\n const trimmed = input.trim();\n\n if (trimmed.length === 0) {\n return {\n isValid: false,\n error: new Error(\"Message cannot be empty\"),\n sanitizedInput: trimmed,\n };\n }\n\n // TODO(perf): Make this configurable if needed\n if (trimmed.length > 10000) {\n return {\n isValid: false,\n error: new Error(\"Message is too long (max 10000 characters)\"),\n sanitizedInput: trimmed,\n };\n }\n\n return {\n isValid: true,\n sanitizedInput: trimmed,\n };\n}\n"]}
|
|
@@ -2,16 +2,47 @@ import TamboAI from "@tambo-ai/typescript-sdk";
|
|
|
2
2
|
import { QueryClient } from "@tanstack/react-query";
|
|
3
3
|
import React, { PropsWithChildren } from "react";
|
|
4
4
|
export interface TamboClientProviderProps {
|
|
5
|
+
/**
|
|
6
|
+
* The URL of the Tambo API (used for local development and debugging)
|
|
7
|
+
*/
|
|
5
8
|
tamboUrl?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The API key for the Tambo API
|
|
11
|
+
*/
|
|
6
12
|
apiKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* The environment to use for the Tambo API
|
|
15
|
+
*/
|
|
7
16
|
environment?: "production" | "staging";
|
|
8
17
|
}
|
|
9
18
|
export interface TamboClientContextProps {
|
|
19
|
+
/** The TamboAI client */
|
|
10
20
|
client: TamboAI;
|
|
11
21
|
/** The tambo-specific query client */
|
|
12
22
|
queryClient: QueryClient;
|
|
13
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* The TamboClientProvider is a React provider that provides a TamboAI client
|
|
26
|
+
* and a query client to the descendants of the provider.
|
|
27
|
+
* @param props - The props for the TamboClientProvider
|
|
28
|
+
* @param props.children - The children to wrap
|
|
29
|
+
* @param props.tamboUrl - The URL of the Tambo API
|
|
30
|
+
* @param props.apiKey - The API key for the Tambo API
|
|
31
|
+
* @param props.environment - The environment to use for the Tambo API
|
|
32
|
+
* @returns The TamboClientProvider component
|
|
33
|
+
*/
|
|
14
34
|
export declare const TamboClientProvider: React.FC<PropsWithChildren<TamboClientProviderProps>>;
|
|
35
|
+
/**
|
|
36
|
+
* The useTamboClient hook provides access to the TamboAI client
|
|
37
|
+
* to the descendants of the TamboClientProvider.
|
|
38
|
+
* @returns The TamboAI client
|
|
39
|
+
*/
|
|
15
40
|
export declare const useTamboClient: () => TamboAI;
|
|
41
|
+
/**
|
|
42
|
+
* The useTamboQueryClient hook provides access to the tambo-specific query client
|
|
43
|
+
* to the descendants of the TamboClientProvider.
|
|
44
|
+
* @returns The tambo-specific query client
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
16
47
|
export declare const useTamboQueryClient: () => QueryClient;
|
|
17
48
|
//# sourceMappingURL=tambo-client-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-client-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-client-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,OAA0B,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAY,MAAM,OAAO,CAAC;AAE1E,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC;
|
|
1
|
+
{"version":3,"file":"tambo-client-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-client-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,OAA0B,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAY,MAAM,OAAO,CAAC;AAE1E,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC;AAED,MAAM,WAAW,uBAAuB;IACtC,yBAAyB;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,sCAAsC;IACtC,WAAW,EAAE,WAAW,CAAC;CAC1B;AAMD;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CACxC,iBAAiB,CAAC,wBAAwB,CAAC,CAgB5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,eAM1B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,mBAQ/B,CAAC"}
|
|
@@ -41,6 +41,16 @@ const typescript_sdk_1 = __importDefault(require("@tambo-ai/typescript-sdk"));
|
|
|
41
41
|
const react_query_1 = require("@tanstack/react-query");
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
43
|
const TamboClientContext = (0, react_1.createContext)(undefined);
|
|
44
|
+
/**
|
|
45
|
+
* The TamboClientProvider is a React provider that provides a TamboAI client
|
|
46
|
+
* and a query client to the descendants of the provider.
|
|
47
|
+
* @param props - The props for the TamboClientProvider
|
|
48
|
+
* @param props.children - The children to wrap
|
|
49
|
+
* @param props.tamboUrl - The URL of the Tambo API
|
|
50
|
+
* @param props.apiKey - The API key for the Tambo API
|
|
51
|
+
* @param props.environment - The environment to use for the Tambo API
|
|
52
|
+
* @returns The TamboClientProvider component
|
|
53
|
+
*/
|
|
44
54
|
const TamboClientProvider = ({ children, tamboUrl, apiKey, environment }) => {
|
|
45
55
|
const tamboConfig = { apiKey };
|
|
46
56
|
if (tamboUrl) {
|
|
@@ -54,6 +64,11 @@ const TamboClientProvider = ({ children, tamboUrl, apiKey, environment }) => {
|
|
|
54
64
|
return (react_1.default.createElement(TamboClientContext.Provider, { value: { client, queryClient } }, children));
|
|
55
65
|
};
|
|
56
66
|
exports.TamboClientProvider = TamboClientProvider;
|
|
67
|
+
/**
|
|
68
|
+
* The useTamboClient hook provides access to the TamboAI client
|
|
69
|
+
* to the descendants of the TamboClientProvider.
|
|
70
|
+
* @returns The TamboAI client
|
|
71
|
+
*/
|
|
57
72
|
const useTamboClient = () => {
|
|
58
73
|
const context = react_1.default.useContext(TamboClientContext);
|
|
59
74
|
if (context === undefined) {
|
|
@@ -62,6 +77,12 @@ const useTamboClient = () => {
|
|
|
62
77
|
return context.client;
|
|
63
78
|
};
|
|
64
79
|
exports.useTamboClient = useTamboClient;
|
|
80
|
+
/**
|
|
81
|
+
* The useTamboQueryClient hook provides access to the tambo-specific query client
|
|
82
|
+
* to the descendants of the TamboClientProvider.
|
|
83
|
+
* @returns The tambo-specific query client
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
65
86
|
const useTamboQueryClient = () => {
|
|
66
87
|
const context = react_1.default.useContext(TamboClientContext);
|
|
67
88
|
if (context === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-client-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-client-provider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8EAAkE;AAClE,uDAAoD;AACpD,+CAA0E;
|
|
1
|
+
{"version":3,"file":"tambo-client-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-client-provider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8EAAkE;AAClE,uDAAoD;AACpD,+CAA0E;AAwB1E,MAAM,kBAAkB,GAAG,IAAA,qBAAa,EACtC,SAAS,CACV,CAAC;AAEF;;;;;;;;;GASG;AACI,MAAM,mBAAmB,GAE5B,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE;IAClD,MAAM,WAAW,GAAkB,EAAE,MAAM,EAAE,CAAC;IAC9C,IAAI,QAAQ,EAAE,CAAC;QACb,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC;IACD,IAAI,WAAW,EAAE,CAAC;QAChB,WAAW,CAAC,WAAW,GAAG,WAAW,CAAC;IACxC,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,IAAI,wBAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1D,MAAM,CAAC,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC;IACxD,OAAO,CACL,8BAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,IACxD,QAAQ,CACmB,CAC/B,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,mBAAmB,uBAiB9B;AAEF;;;;GAIG;AACI,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,OAAO,GAAG,eAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACrD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEF;;;;;GAKG;AACI,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,OAAO,GAAG,eAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACrD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,WAAW,CAAC;AAC7B,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B","sourcesContent":["import TamboAI, { ClientOptions } from \"@tambo-ai/typescript-sdk\";\nimport { QueryClient } from \"@tanstack/react-query\";\nimport React, { createContext, PropsWithChildren, useState } from \"react\";\n\nexport interface TamboClientProviderProps {\n /**\n * The URL of the Tambo API (used for local development and debugging)\n */\n tamboUrl?: string;\n /**\n * The API key for the Tambo API\n */\n apiKey: string;\n /**\n * The environment to use for the Tambo API\n */\n environment?: \"production\" | \"staging\";\n}\n\nexport interface TamboClientContextProps {\n /** The TamboAI client */\n client: TamboAI;\n /** The tambo-specific query client */\n queryClient: QueryClient;\n}\n\nconst TamboClientContext = createContext<TamboClientContextProps | undefined>(\n undefined,\n);\n\n/**\n * The TamboClientProvider is a React provider that provides a TamboAI client\n * and a query client to the descendants of the provider.\n * @param props - The props for the TamboClientProvider\n * @param props.children - The children to wrap\n * @param props.tamboUrl - The URL of the Tambo API\n * @param props.apiKey - The API key for the Tambo API\n * @param props.environment - The environment to use for the Tambo API\n * @returns The TamboClientProvider component\n */\nexport const TamboClientProvider: React.FC<\n PropsWithChildren<TamboClientProviderProps>\n> = ({ children, tamboUrl, apiKey, environment }) => {\n const tamboConfig: ClientOptions = { apiKey };\n if (tamboUrl) {\n tamboConfig.baseURL = tamboUrl;\n }\n if (environment) {\n tamboConfig.environment = environment;\n }\n const [client] = useState(() => new TamboAI(tamboConfig));\n const [queryClient] = useState(() => new QueryClient());\n return (\n <TamboClientContext.Provider value={{ client, queryClient }}>\n {children}\n </TamboClientContext.Provider>\n );\n};\n\n/**\n * The useTamboClient hook provides access to the TamboAI client\n * to the descendants of the TamboClientProvider.\n * @returns The TamboAI client\n */\nexport const useTamboClient = () => {\n const context = React.useContext(TamboClientContext);\n if (context === undefined) {\n throw new Error(\"useTamboClient must be used within a TamboClientProvider\");\n }\n return context.client;\n};\n\n/**\n * The useTamboQueryClient hook provides access to the tambo-specific query client\n * to the descendants of the TamboClientProvider.\n * @returns The tambo-specific query client\n * @private\n */\nexport const useTamboQueryClient = () => {\n const context = React.useContext(TamboClientContext);\n if (context === undefined) {\n throw new Error(\n \"useTamboQueryClient must be used within a TamboClientProvider\",\n );\n }\n return context.queryClient;\n};\n"]}
|
|
@@ -6,6 +6,18 @@ export interface TamboComponentContextProps {
|
|
|
6
6
|
registerTools: (tools: TamboTool[]) => void;
|
|
7
7
|
addToolAssociation: (componentName: string, tool: TamboTool) => void;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* The TamboComponentProvider is a React provider that provides component
|
|
11
|
+
* registration services to the descendants of the provider.
|
|
12
|
+
* @param props - The props for the TamboComponentProvider
|
|
13
|
+
* @param props.children - The children to wrap
|
|
14
|
+
* @returns The TamboComponentProvider component
|
|
15
|
+
*/
|
|
9
16
|
export declare const TamboComponentProvider: React.FC<PropsWithChildren>;
|
|
17
|
+
/**
|
|
18
|
+
* The useTamboComponent hook provides access to the component registration
|
|
19
|
+
* services to the descendants of the TamboComponentProvider.
|
|
20
|
+
* @returns The component registration services
|
|
21
|
+
*/
|
|
10
22
|
export declare const useTamboComponent: () => TamboComponentContextProps;
|
|
11
23
|
//# sourceMappingURL=tambo-component-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-component-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-component-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAIxE,MAAM,WAAW,0BAA0B;IACzC,iBAAiB,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IACrD,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,aAAa,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC5C,kBAAkB,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACtE;
|
|
1
|
+
{"version":3,"file":"tambo-component-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-component-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAIxE,MAAM,WAAW,0BAA0B;IACzC,iBAAiB,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IACrD,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,aAAa,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC5C,kBAAkB,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACtE;AAqBD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoB9D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kCAE7B,CAAC"}
|
|
@@ -39,11 +39,30 @@ const react_1 = __importStar(require("react"));
|
|
|
39
39
|
const tambo_client_provider_1 = require("./tambo-client-provider");
|
|
40
40
|
const tambo_registry_provider_1 = require("./tambo-registry-provider");
|
|
41
41
|
const TamboComponentContext = (0, react_1.createContext)({
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
42
45
|
registerComponent: () => { },
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
43
49
|
registerTool: () => { },
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
44
53
|
registerTools: () => { },
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
45
57
|
addToolAssociation: () => { },
|
|
46
58
|
});
|
|
59
|
+
/**
|
|
60
|
+
* The TamboComponentProvider is a React provider that provides component
|
|
61
|
+
* registration services to the descendants of the provider.
|
|
62
|
+
* @param props - The props for the TamboComponentProvider
|
|
63
|
+
* @param props.children - The children to wrap
|
|
64
|
+
* @returns The TamboComponentProvider component
|
|
65
|
+
*/
|
|
47
66
|
const TamboComponentProvider = ({ children, }) => {
|
|
48
67
|
const client = (0, tambo_client_provider_1.useTamboClient)();
|
|
49
68
|
const { registerComponent, addToolAssociation, registerTool, registerTools } = (0, tambo_registry_provider_1.useTamboRegistry)();
|
|
@@ -57,6 +76,11 @@ const TamboComponentProvider = ({ children, }) => {
|
|
|
57
76
|
return (react_1.default.createElement(TamboComponentContext.Provider, { value: value }, children));
|
|
58
77
|
};
|
|
59
78
|
exports.TamboComponentProvider = TamboComponentProvider;
|
|
79
|
+
/**
|
|
80
|
+
* The useTamboComponent hook provides access to the component registration
|
|
81
|
+
* services to the descendants of the TamboComponentProvider.
|
|
82
|
+
* @returns The component registration services
|
|
83
|
+
*/
|
|
60
84
|
const useTamboComponent = () => {
|
|
61
85
|
return (0, react_1.useContext)(TamboComponentContext);
|
|
62
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-component-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-component-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAA4E;AAE5E,mEAAyD;AACzD,uEAA6D;AAS7D,MAAM,qBAAqB,GAAG,IAAA,qBAAa,EAA6B;IACtE,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC3B,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;IACtB,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;IACvB,kBAAkB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC7B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"tambo-component-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-component-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAA4E;AAE5E,mEAAyD;AACzD,uEAA6D;AAS7D,MAAM,qBAAqB,GAAG,IAAA,qBAAa,EAA6B;IACtE;;OAEG;IACH,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;IACtB;;OAEG;IACH,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;IACvB;;OAEG;IACH,kBAAkB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC7B,CAAC,CAAC;AAEH;;;;;;GAMG;AACI,MAAM,sBAAsB,GAAgC,CAAC,EAClE,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,IAAA,sCAAc,GAAE,CAAC;IAChC,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,GAC1E,IAAA,0CAAgB,GAAE,CAAC;IAErB,MAAM,KAAK,GAAG;QACZ,MAAM;QACN,iBAAiB;QACjB,YAAY;QACZ,aAAa;QACb,kBAAkB;KACnB,CAAC;IAEF,OAAO,CACL,8BAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IACzC,QAAQ,CACsB,CAClC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,sBAAsB,0BAoBjC;AAEF;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,OAAO,IAAA,kBAAU,EAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B","sourcesContent":["\"use client\";\nimport React, { createContext, PropsWithChildren, useContext } from \"react\";\nimport { TamboComponent, TamboTool } from \"../model/component-metadata\";\nimport { useTamboClient } from \"./tambo-client-provider\";\nimport { useTamboRegistry } from \"./tambo-registry-provider\";\n\nexport interface TamboComponentContextProps {\n registerComponent: (options: TamboComponent) => void;\n registerTool: (tool: TamboTool) => void;\n registerTools: (tools: TamboTool[]) => void;\n addToolAssociation: (componentName: string, tool: TamboTool) => void;\n}\n\nconst TamboComponentContext = createContext<TamboComponentContextProps>({\n /**\n *\n */\n registerComponent: () => {},\n /**\n *\n */\n registerTool: () => {},\n /**\n *\n */\n registerTools: () => {},\n /**\n *\n */\n addToolAssociation: () => {},\n});\n\n/**\n * The TamboComponentProvider is a React provider that provides component\n * registration services to the descendants of the provider.\n * @param props - The props for the TamboComponentProvider\n * @param props.children - The children to wrap\n * @returns The TamboComponentProvider component\n */\nexport const TamboComponentProvider: React.FC<PropsWithChildren> = ({\n children,\n}) => {\n const client = useTamboClient();\n const { registerComponent, addToolAssociation, registerTool, registerTools } =\n useTamboRegistry();\n\n const value = {\n client,\n registerComponent,\n registerTool,\n registerTools,\n addToolAssociation,\n };\n\n return (\n <TamboComponentContext.Provider value={value}>\n {children}\n </TamboComponentContext.Provider>\n );\n};\n\n/**\n * The useTamboComponent hook provides access to the component registration\n * services to the descendants of the TamboComponentProvider.\n * @returns The component registration services\n */\nexport const useTamboComponent = () => {\n return useContext(TamboComponentContext);\n};\n"]}
|
|
@@ -3,10 +3,27 @@ import { TamboClientContextProps, TamboClientProviderProps } from "./tambo-clien
|
|
|
3
3
|
import { TamboComponentContextProps } from "./tambo-component-provider";
|
|
4
4
|
import { TamboRegistryProviderProps } from "./tambo-registry-provider";
|
|
5
5
|
import { TamboThreadContextProps } from "./tambo-thread-provider";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* The TamboProvider gives full access to the whole Tambo API. This includes the
|
|
8
|
+
* TamboAI client, the component registry, and the current thread context.
|
|
9
|
+
* @param props - The props for the TamboProvider
|
|
10
|
+
* @param props.children - The children to wrap
|
|
11
|
+
* @param props.tamboUrl - The URL of the Tambo API
|
|
12
|
+
* @param props.apiKey - The API key for the Tambo API
|
|
13
|
+
* @param props.components - The components to register
|
|
14
|
+
* @param props.environment - The environment to use for the Tambo API
|
|
15
|
+
* @returns The TamboProvider component
|
|
16
|
+
*/
|
|
7
17
|
export declare const TamboProvider: React.FC<PropsWithChildren<TamboClientProviderProps & TamboRegistryProviderProps>>;
|
|
8
18
|
type TamboContextProps = TamboClientContextProps & TamboThreadContextProps & TamboComponentContextProps;
|
|
9
19
|
export declare const TamboContext: React.Context<TamboContextProps>;
|
|
20
|
+
/**
|
|
21
|
+
* The useTambo hook provides access to the Tambo API. This is the primary entrypoint
|
|
22
|
+
* for the Tambo React SDK.
|
|
23
|
+
*
|
|
24
|
+
* This includes the TamboAI client, the component registry, and the current thread context.
|
|
25
|
+
* @returns The Tambo API
|
|
26
|
+
*/
|
|
10
27
|
export declare const useTambo: () => TamboContextProps;
|
|
11
28
|
export {};
|
|
12
29
|
//# sourceMappingURL=tambo-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAA6B,MAAM,OAAO,CAAC;AAC5E,OAAO,EACL,uBAAuB,EAEvB,wBAAwB,EAGzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAG3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,0BAA0B,EAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,uBAAuB,EAGxB,MAAM,yBAAyB,CAAC;AAEjC
|
|
1
|
+
{"version":3,"file":"tambo-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAA6B,MAAM,OAAO,CAAC;AAC5E,OAAO,EACL,uBAAuB,EAEvB,wBAAwB,EAGzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAG3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,0BAA0B,EAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,uBAAuB,EAGxB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC,iBAAiB,CAAC,wBAAwB,GAAG,0BAA0B,CAAC,CAiBzE,CAAC;AACF,KAAK,iBAAiB,GAAG,uBAAuB,GAC9C,uBAAuB,GACvB,0BAA0B,CAAC;AAE7B,eAAO,MAAM,YAAY,kCAExB,CAAC;AA6BF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,yBAEpB,CAAC"}
|
|
@@ -40,7 +40,17 @@ const tambo_client_provider_1 = require("./tambo-client-provider");
|
|
|
40
40
|
const tambo_component_provider_1 = require("./tambo-component-provider");
|
|
41
41
|
const tambo_registry_provider_1 = require("./tambo-registry-provider");
|
|
42
42
|
const tambo_thread_provider_1 = require("./tambo-thread-provider");
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The TamboProvider gives full access to the whole Tambo API. This includes the
|
|
45
|
+
* TamboAI client, the component registry, and the current thread context.
|
|
46
|
+
* @param props - The props for the TamboProvider
|
|
47
|
+
* @param props.children - The children to wrap
|
|
48
|
+
* @param props.tamboUrl - The URL of the Tambo API
|
|
49
|
+
* @param props.apiKey - The API key for the Tambo API
|
|
50
|
+
* @param props.components - The components to register
|
|
51
|
+
* @param props.environment - The environment to use for the Tambo API
|
|
52
|
+
* @returns The TamboProvider component
|
|
53
|
+
*/
|
|
44
54
|
const TamboProvider = ({ children, tamboUrl, apiKey, components, environment }) => {
|
|
45
55
|
return (react_1.default.createElement(tambo_client_provider_1.TamboClientProvider, { tamboUrl: tamboUrl, apiKey: apiKey, environment: environment },
|
|
46
56
|
react_1.default.createElement(tambo_registry_provider_1.TamboRegistryProvider, { components: components },
|
|
@@ -50,7 +60,13 @@ const TamboProvider = ({ children, tamboUrl, apiKey, components, environment })
|
|
|
50
60
|
};
|
|
51
61
|
exports.TamboProvider = TamboProvider;
|
|
52
62
|
exports.TamboContext = (0, react_1.createContext)({});
|
|
53
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* TamboCompositeProvider is a provider that combines the TamboClient,
|
|
65
|
+
* TamboThread, and TamboComponent providers
|
|
66
|
+
* @param props - The props for the TamboCompositeProvider
|
|
67
|
+
* @param props.children - The children to wrap
|
|
68
|
+
* @returns The wrapped component
|
|
69
|
+
*/
|
|
54
70
|
const TamboCompositeProvider = ({ children }) => {
|
|
55
71
|
const threads = (0, tambo_thread_provider_1.useTamboThread)();
|
|
56
72
|
const client = (0, tambo_client_provider_1.useTamboClient)();
|
|
@@ -63,6 +79,13 @@ const TamboCompositeProvider = ({ children }) => {
|
|
|
63
79
|
...threads,
|
|
64
80
|
} }, children));
|
|
65
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* The useTambo hook provides access to the Tambo API. This is the primary entrypoint
|
|
84
|
+
* for the Tambo React SDK.
|
|
85
|
+
*
|
|
86
|
+
* This includes the TamboAI client, the component registry, and the current thread context.
|
|
87
|
+
* @returns The Tambo API
|
|
88
|
+
*/
|
|
66
89
|
const useTambo = () => {
|
|
67
90
|
return (0, react_1.useContext)(exports.TamboContext);
|
|
68
91
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAA4E;AAC5E,mEAMiC;AACjC,yEAIoC;AACpC,uEAGmC;AACnC,mEAIiC;AAEjC
|
|
1
|
+
{"version":3,"file":"tambo-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAA4E;AAC5E,mEAMiC;AACjC,yEAIoC;AACpC,uEAGmC;AACnC,mEAIiC;AAEjC;;;;;;;;;;GAUG;AACI,MAAM,aAAa,GAEtB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,EAAE;IAC9D,OAAO,CACL,8BAAC,2CAAmB,IAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW;QAExB,8BAAC,+CAAqB,IAAC,UAAU,EAAE,UAAU;YAC3C,8BAAC,2CAAmB;gBAClB,8BAAC,iDAAsB;oBACrB,8BAAC,sBAAsB,QAAE,QAAQ,CAA0B,CACpC,CACL,CACA,CACJ,CACvB,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,aAAa,iBAkBxB;AAKW,QAAA,YAAY,GAAG,IAAA,qBAAa,EACvC,EAAuB,CACxB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,sBAAsB,GAAgC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC3E,MAAM,OAAO,GAAG,IAAA,sCAAc,GAAE,CAAC;IACjC,MAAM,MAAM,GAAG,IAAA,sCAAc,GAAE,CAAC;IAChC,MAAM,WAAW,GAAG,IAAA,2CAAmB,GAAE,CAAC;IAC1C,MAAM,iBAAiB,GAAG,IAAA,4CAAiB,GAAE,CAAC;IAE9C,OAAO,CACL,8BAAC,oBAAY,CAAC,QAAQ,IACpB,KAAK,EAAE;YACL,MAAM;YACN,WAAW;YACX,GAAG,iBAAiB;YACpB,GAAG,OAAO;SACX,IAEA,QAAQ,CACa,CACzB,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;GAMG;AACI,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,OAAO,IAAA,kBAAU,EAAC,oBAAY,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB","sourcesContent":["\"use client\";\nimport React, { PropsWithChildren, createContext, useContext } from \"react\";\nimport {\n TamboClientContextProps,\n TamboClientProvider,\n TamboClientProviderProps,\n useTamboClient,\n useTamboQueryClient,\n} from \"./tambo-client-provider\";\nimport {\n TamboComponentContextProps,\n TamboComponentProvider,\n useTamboComponent,\n} from \"./tambo-component-provider\";\nimport {\n TamboRegistryProvider,\n TamboRegistryProviderProps,\n} from \"./tambo-registry-provider\";\nimport {\n TamboThreadContextProps,\n TamboThreadProvider,\n useTamboThread,\n} from \"./tambo-thread-provider\";\n\n/**\n * The TamboProvider gives full access to the whole Tambo API. This includes the\n * TamboAI client, the component registry, and the current thread context.\n * @param props - The props for the TamboProvider\n * @param props.children - The children to wrap\n * @param props.tamboUrl - The URL of the Tambo API\n * @param props.apiKey - The API key for the Tambo API\n * @param props.components - The components to register\n * @param props.environment - The environment to use for the Tambo API\n * @returns The TamboProvider component\n */\nexport const TamboProvider: React.FC<\n PropsWithChildren<TamboClientProviderProps & TamboRegistryProviderProps>\n> = ({ children, tamboUrl, apiKey, components, environment }) => {\n return (\n <TamboClientProvider\n tamboUrl={tamboUrl}\n apiKey={apiKey}\n environment={environment}\n >\n <TamboRegistryProvider components={components}>\n <TamboThreadProvider>\n <TamboComponentProvider>\n <TamboCompositeProvider>{children}</TamboCompositeProvider>\n </TamboComponentProvider>\n </TamboThreadProvider>\n </TamboRegistryProvider>\n </TamboClientProvider>\n );\n};\ntype TamboContextProps = TamboClientContextProps &\n TamboThreadContextProps &\n TamboComponentContextProps;\n\nexport const TamboContext = createContext<TamboContextProps>(\n {} as TamboContextProps,\n);\n\n/**\n * TamboCompositeProvider is a provider that combines the TamboClient,\n * TamboThread, and TamboComponent providers\n * @param props - The props for the TamboCompositeProvider\n * @param props.children - The children to wrap\n * @returns The wrapped component\n */\nconst TamboCompositeProvider: React.FC<PropsWithChildren> = ({ children }) => {\n const threads = useTamboThread();\n const client = useTamboClient();\n const queryClient = useTamboQueryClient();\n const componentRegistry = useTamboComponent();\n\n return (\n <TamboContext.Provider\n value={{\n client,\n queryClient,\n ...componentRegistry,\n ...threads,\n }}\n >\n {children}\n </TamboContext.Provider>\n );\n};\n\n/**\n * The useTambo hook provides access to the Tambo API. This is the primary entrypoint\n * for the Tambo React SDK.\n *\n * This includes the TamboAI client, the component registry, and the current thread context.\n * @returns The Tambo API\n */\nexport const useTambo = () => {\n return useContext(TamboContext);\n};\n"]}
|