@tambo-ai/react 0.60.0 → 0.63.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/dist/__tests__/util/validate-zod-schema.test.js +25 -0
- package/dist/__tests__/util/validate-zod-schema.test.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-tambo-voice.d.ts +21 -0
- package/dist/hooks/use-tambo-voice.d.ts.map +1 -0
- package/dist/hooks/use-tambo-voice.js +74 -0
- package/dist/hooks/use-tambo-voice.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/__tests__/tambo-mcp-provider.test.js +4 -4
- package/dist/mcp/__tests__/tambo-mcp-provider.test.js.map +1 -1
- package/dist/mcp/tambo-mcp-provider.d.ts +1 -1
- package/dist/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/dist/mcp/tambo-mcp-provider.js +2 -2
- package/dist/mcp/tambo-mcp-provider.js.map +1 -1
- package/dist/providers/__tests__/tambo-context-attachment-provider.test.d.ts +2 -0
- package/dist/providers/__tests__/tambo-context-attachment-provider.test.d.ts.map +1 -0
- package/dist/providers/__tests__/tambo-context-attachment-provider.test.js +633 -0
- package/dist/providers/__tests__/tambo-context-attachment-provider.test.js.map +1 -0
- package/dist/providers/__tests__/tambo-thread-provider-initial-messages.test.js +1 -1
- package/dist/providers/__tests__/tambo-thread-provider-initial-messages.test.js.map +1 -1
- package/dist/providers/__tests__/tambo-thread-provider.test.js +170 -0
- package/dist/providers/__tests__/tambo-thread-provider.test.js.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +4 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/tambo-context-attachment-provider.d.ts +132 -0
- package/dist/providers/tambo-context-attachment-provider.d.ts.map +1 -0
- package/dist/providers/tambo-context-attachment-provider.js +201 -0
- package/dist/providers/tambo-context-attachment-provider.js.map +1 -0
- package/dist/providers/tambo-provider.d.ts +6 -2
- package/dist/providers/tambo-provider.d.ts.map +1 -1
- package/dist/providers/tambo-provider.js +12 -5
- package/dist/providers/tambo-provider.js.map +1 -1
- package/dist/providers/tambo-stubs.d.ts.map +1 -1
- package/dist/providers/tambo-stubs.js +6 -2
- package/dist/providers/tambo-stubs.js.map +1 -1
- package/dist/providers/tambo-thread-provider.d.ts +6 -0
- package/dist/providers/tambo-thread-provider.d.ts.map +1 -1
- package/dist/providers/tambo-thread-provider.js +112 -45
- package/dist/providers/tambo-thread-provider.js.map +1 -1
- package/dist/setupTests.js +10 -0
- package/dist/setupTests.js.map +1 -1
- package/dist/util/validate-zod-schema.d.ts.map +1 -1
- package/dist/util/validate-zod-schema.js +11 -0
- package/dist/util/validate-zod-schema.js.map +1 -1
- package/esm/__tests__/util/validate-zod-schema.test.js +25 -0
- package/esm/__tests__/util/validate-zod-schema.test.js.map +1 -1
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.d.ts.map +1 -1
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/index.js.map +1 -1
- package/esm/hooks/use-tambo-voice.d.ts +21 -0
- package/esm/hooks/use-tambo-voice.d.ts.map +1 -0
- package/esm/hooks/use-tambo-voice.js +71 -0
- package/esm/hooks/use-tambo-voice.js.map +1 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -1
- package/esm/mcp/__tests__/tambo-mcp-provider.test.js +4 -4
- package/esm/mcp/__tests__/tambo-mcp-provider.test.js.map +1 -1
- package/esm/mcp/tambo-mcp-provider.d.ts +1 -1
- package/esm/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/esm/mcp/tambo-mcp-provider.js +2 -2
- package/esm/mcp/tambo-mcp-provider.js.map +1 -1
- package/esm/providers/__tests__/tambo-context-attachment-provider.test.d.ts +2 -0
- package/esm/providers/__tests__/tambo-context-attachment-provider.test.d.ts.map +1 -0
- package/esm/providers/__tests__/tambo-context-attachment-provider.test.js +628 -0
- package/esm/providers/__tests__/tambo-context-attachment-provider.test.js.map +1 -0
- package/esm/providers/__tests__/tambo-thread-provider-initial-messages.test.js +1 -1
- package/esm/providers/__tests__/tambo-thread-provider-initial-messages.test.js.map +1 -1
- package/esm/providers/__tests__/tambo-thread-provider.test.js +170 -0
- package/esm/providers/__tests__/tambo-thread-provider.test.js.map +1 -1
- package/esm/providers/index.d.ts +1 -0
- package/esm/providers/index.d.ts.map +1 -1
- package/esm/providers/index.js +1 -0
- package/esm/providers/index.js.map +1 -1
- package/esm/providers/tambo-context-attachment-provider.d.ts +132 -0
- package/esm/providers/tambo-context-attachment-provider.d.ts.map +1 -0
- package/esm/providers/tambo-context-attachment-provider.js +164 -0
- package/esm/providers/tambo-context-attachment-provider.js.map +1 -0
- package/esm/providers/tambo-provider.d.ts +6 -2
- package/esm/providers/tambo-provider.d.ts.map +1 -1
- package/esm/providers/tambo-provider.js +12 -5
- package/esm/providers/tambo-provider.js.map +1 -1
- package/esm/providers/tambo-stubs.d.ts.map +1 -1
- package/esm/providers/tambo-stubs.js +6 -2
- package/esm/providers/tambo-stubs.js.map +1 -1
- package/esm/providers/tambo-thread-provider.d.ts +6 -0
- package/esm/providers/tambo-thread-provider.d.ts.map +1 -1
- package/esm/providers/tambo-thread-provider.js +112 -45
- package/esm/providers/tambo-thread-provider.js.map +1 -1
- package/esm/setupTests.js +10 -0
- package/esm/setupTests.js.map +1 -1
- package/esm/util/validate-zod-schema.d.ts.map +1 -1
- package/esm/util/validate-zod-schema.js +11 -0
- package/esm/util/validate-zod-schema.js.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Suggestion } from "@tambo-ai/typescript-sdk/resources/beta/threads/suggestions";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Represents a context attachment that can be displayed in MessageInputContexts.
|
|
5
|
+
* Context attachments appear as badges above the message input and provide additional
|
|
6
|
+
* information to the AI about what to focus on.
|
|
7
|
+
* @property {string} name - Display name shown in the badge
|
|
8
|
+
* @property {React.ReactNode} [icon] - Optional icon to display in the badge
|
|
9
|
+
* @property {Record<string, unknown>} [metadata] - Additional data passed to the AI
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const context: ContextAttachment = {
|
|
13
|
+
* name: "Button.tsx",
|
|
14
|
+
* icon: <FileIcon />,
|
|
15
|
+
* metadata: { filePath: "/src/components/Button.tsx" }
|
|
16
|
+
* };
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export interface ContextAttachment {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
icon?: React.ReactNode;
|
|
23
|
+
metadata?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Represents the data structure returned by a context helper
|
|
27
|
+
*/
|
|
28
|
+
export type ContextHelperData = Record<string, unknown>;
|
|
29
|
+
/**
|
|
30
|
+
* Context state interface for managing context attachments and custom suggestions.
|
|
31
|
+
* @property {ContextAttachment[]} attachments - Array of active context attachments (badges above message input)
|
|
32
|
+
* @property {(context: Omit<ContextAttachment, "id">) => void} addContextAttachment - Add a new context attachment
|
|
33
|
+
* @property {(id: string) => void} removeContextAttachment - Remove a context attachment by ID
|
|
34
|
+
* @property {() => void} clearContextAttachments - Remove all context attachments - This is used to clear the context when the user submits a message
|
|
35
|
+
* @property {Suggestion[] | null} customSuggestions - Custom suggestions to display instead of auto-generated ones
|
|
36
|
+
* @property {(suggestions: Suggestion[] | null) => void} setCustomSuggestions - Set or clear custom suggestions
|
|
37
|
+
*/
|
|
38
|
+
export interface ContextAttachmentState {
|
|
39
|
+
attachments: ContextAttachment[];
|
|
40
|
+
addContextAttachment: (context: Omit<ContextAttachment, "id">) => void;
|
|
41
|
+
removeContextAttachment: (id: string) => void;
|
|
42
|
+
clearContextAttachments: () => void;
|
|
43
|
+
customSuggestions: Suggestion[] | null;
|
|
44
|
+
setCustomSuggestions: (suggestions: Suggestion[] | null) => void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Props for the TamboContextAttachmentProvider.
|
|
48
|
+
* @property {(context: ContextAttachment) => Promise<ContextHelperData> | ContextHelperData} [getContextHelperData] - Optional function to customize the data sent to the AI for each context. If not provided, uses a default structure with the context name and instruction.
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <TamboContextAttachmentProvider
|
|
52
|
+
* getContextHelperData={(context) => ({
|
|
53
|
+
* selectedFile: {
|
|
54
|
+
* name: context.name,
|
|
55
|
+
* path: context.metadata?.filePath,
|
|
56
|
+
* instruction: "Focus on this file"
|
|
57
|
+
* }
|
|
58
|
+
* })}
|
|
59
|
+
* >
|
|
60
|
+
* {children}
|
|
61
|
+
* </TamboContextAttachmentProvider>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export interface TamboContextAttachmentProviderProps {
|
|
65
|
+
children?: React.ReactNode;
|
|
66
|
+
getContextHelperData?: (context: ContextAttachment) => Promise<ContextHelperData> | ContextHelperData;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Provider that enables context attachment features and custom suggestions in MessageInput.
|
|
70
|
+
* **When to use:**
|
|
71
|
+
* - **Included by default** in TamboProvider - no need to wrap separately
|
|
72
|
+
* - Use `useTamboContextAttachment()` hook to manage context attachments
|
|
73
|
+
* **What it does:**
|
|
74
|
+
* - Manages context items that appear as badges above MessageInput
|
|
75
|
+
* - Syncs context data with Tambo's AI for better responses
|
|
76
|
+
* - Manages custom suggestions that replace auto-generated suggestions
|
|
77
|
+
* - Allows components to add/remove contexts via `useTamboContextAttachment()`
|
|
78
|
+
* - Allows components to set custom suggestions via `setCustomSuggestions()`
|
|
79
|
+
* @param props - The props for the TamboContextAttachmentProvider
|
|
80
|
+
* @param props.children - The children to wrap
|
|
81
|
+
* @param props.getContextHelperData - The function to get the context helper data
|
|
82
|
+
* @returns The TamboContextAttachmentProvider component
|
|
83
|
+
* @example
|
|
84
|
+
* Basic usage - already included in TamboProvider
|
|
85
|
+
* ```tsx
|
|
86
|
+
* <TamboProvider apiKey="...">
|
|
87
|
+
* <App />
|
|
88
|
+
* </TamboProvider>
|
|
89
|
+
* ```
|
|
90
|
+
* @example
|
|
91
|
+
* Using TamboProvider with custom context data
|
|
92
|
+
* ```tsx
|
|
93
|
+
* <TamboProvider
|
|
94
|
+
* apiKey="..."
|
|
95
|
+
* getContextHelperData={(context) => ({
|
|
96
|
+
* selectedComponent: {
|
|
97
|
+
* name: context.name,
|
|
98
|
+
* filePath: context.metadata?.path,
|
|
99
|
+
* instruction: "Edit this component"
|
|
100
|
+
* }
|
|
101
|
+
* })}
|
|
102
|
+
* >
|
|
103
|
+
* <App />
|
|
104
|
+
* </TamboProvider>
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare function TamboContextAttachmentProvider({ children, getContextHelperData, }: TamboContextAttachmentProviderProps): React.JSX.Element;
|
|
108
|
+
/**
|
|
109
|
+
* Hook to access context attachment state and methods.
|
|
110
|
+
* **Must be used within a `TamboProvider`** - throws an error otherwise.
|
|
111
|
+
* @throws {Error} If used outside of TamboProvider
|
|
112
|
+
* @returns The context attachment state and methods
|
|
113
|
+
* @example
|
|
114
|
+
* ```tsx
|
|
115
|
+
* const contextAttachment = useTamboContextAttachment();
|
|
116
|
+
*
|
|
117
|
+
* // Add a context
|
|
118
|
+
* contextAttachment.addContextAttachment({
|
|
119
|
+
* name: "Button.tsx",
|
|
120
|
+
* icon: <FileIcon />,
|
|
121
|
+
* metadata: { path: "/src/Button.tsx" }
|
|
122
|
+
* });
|
|
123
|
+
*
|
|
124
|
+
* // Remove a context
|
|
125
|
+
* contextAttachment.removeContextAttachment(contextId);
|
|
126
|
+
*
|
|
127
|
+
* // Set custom suggestions
|
|
128
|
+
* contextAttachment.setCustomSuggestions([{ id: "1", title: "Add Feature" }]);
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare function useTamboContextAttachment(): ContextAttachmentState;
|
|
132
|
+
//# sourceMappingURL=tambo-context-attachment-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tambo-context-attachment-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-context-attachment-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAC;AAC9F,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,oBAAoB,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;IACvE,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,uBAAuB,EAAE,MAAM,IAAI,CAAC;IACpC,iBAAiB,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IACvC,oBAAoB,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;CAClE;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,oBAAoB,CAAC,EAAE,CACrB,OAAO,EAAE,iBAAiB,KACvB,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;CACrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,8BAA8B,CAAC,EAC7C,QAAQ,EACR,oBAAoB,GACrB,EAAE,mCAAmC,qBAsHrC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,2BAQxC"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.TamboContextAttachmentProvider = TamboContextAttachmentProvider;
|
|
38
|
+
exports.useTamboContextAttachment = useTamboContextAttachment;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const tambo_context_helpers_provider_1 = require("./tambo-context-helpers-provider");
|
|
41
|
+
const ContextAttachmentContext = (0, react_1.createContext)(null);
|
|
42
|
+
/**
|
|
43
|
+
* Provider that enables context attachment features and custom suggestions in MessageInput.
|
|
44
|
+
* **When to use:**
|
|
45
|
+
* - **Included by default** in TamboProvider - no need to wrap separately
|
|
46
|
+
* - Use `useTamboContextAttachment()` hook to manage context attachments
|
|
47
|
+
* **What it does:**
|
|
48
|
+
* - Manages context items that appear as badges above MessageInput
|
|
49
|
+
* - Syncs context data with Tambo's AI for better responses
|
|
50
|
+
* - Manages custom suggestions that replace auto-generated suggestions
|
|
51
|
+
* - Allows components to add/remove contexts via `useTamboContextAttachment()`
|
|
52
|
+
* - Allows components to set custom suggestions via `setCustomSuggestions()`
|
|
53
|
+
* @param props - The props for the TamboContextAttachmentProvider
|
|
54
|
+
* @param props.children - The children to wrap
|
|
55
|
+
* @param props.getContextHelperData - The function to get the context helper data
|
|
56
|
+
* @returns The TamboContextAttachmentProvider component
|
|
57
|
+
* @example
|
|
58
|
+
* Basic usage - already included in TamboProvider
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <TamboProvider apiKey="...">
|
|
61
|
+
* <App />
|
|
62
|
+
* </TamboProvider>
|
|
63
|
+
* ```
|
|
64
|
+
* @example
|
|
65
|
+
* Using TamboProvider with custom context data
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <TamboProvider
|
|
68
|
+
* apiKey="..."
|
|
69
|
+
* getContextHelperData={(context) => ({
|
|
70
|
+
* selectedComponent: {
|
|
71
|
+
* name: context.name,
|
|
72
|
+
* filePath: context.metadata?.path,
|
|
73
|
+
* instruction: "Edit this component"
|
|
74
|
+
* }
|
|
75
|
+
* })}
|
|
76
|
+
* >
|
|
77
|
+
* <App />
|
|
78
|
+
* </TamboProvider>
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
function TamboContextAttachmentProvider({ children, getContextHelperData, }) {
|
|
82
|
+
const [attachments, setAttachments] = (0, react_1.useState)([]);
|
|
83
|
+
const [customSuggestions, setCustomSuggestions] = (0, react_1.useState)(null);
|
|
84
|
+
const { addContextHelper, removeContextHelper } = (0, tambo_context_helpers_provider_1.useTamboContextHelpers)();
|
|
85
|
+
// Track which context helpers have been registered to avoid duplicates
|
|
86
|
+
const registeredIdsRef = (0, react_1.useRef)(new Set());
|
|
87
|
+
const prevGetContextHelperDataRef = (0, react_1.useRef)();
|
|
88
|
+
// Sync context helpers with attachments using useEffect
|
|
89
|
+
(0, react_1.useEffect)(() => {
|
|
90
|
+
const currentIds = new Set(attachments.map((a) => a.id));
|
|
91
|
+
const registeredIds = registeredIdsRef.current;
|
|
92
|
+
// Remove context helpers that are no longer in attachments
|
|
93
|
+
registeredIds.forEach((id) => {
|
|
94
|
+
if (!currentIds.has(id)) {
|
|
95
|
+
removeContextHelper(id);
|
|
96
|
+
registeredIds.delete(id);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
const getDataChanged = prevGetContextHelperDataRef.current !== getContextHelperData;
|
|
100
|
+
// Add or replace context helpers for attachments
|
|
101
|
+
attachments.forEach((context) => {
|
|
102
|
+
if (getDataChanged || !registeredIds.has(context.id)) {
|
|
103
|
+
addContextHelper(context.id, async () => {
|
|
104
|
+
if (getContextHelperData) {
|
|
105
|
+
return await getContextHelperData(context);
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
selectedComponent: {
|
|
109
|
+
name: context.name,
|
|
110
|
+
instruction: "This is a Tambo interactable component that is currently selected and visible on the dashboard. You can read its current props and state, and update it by modifying its props. If multiple components are attached, you can interact with and modify any of them. Use the auto-registered interactable component tools (like get_interactable_component_by_id and update_interactable_component_<id>) to view and update the component's state.",
|
|
111
|
+
...(context.metadata ?? {}),
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
registeredIds.add(context.id);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
prevGetContextHelperDataRef.current = getContextHelperData;
|
|
119
|
+
}, [
|
|
120
|
+
attachments,
|
|
121
|
+
addContextHelper,
|
|
122
|
+
removeContextHelper,
|
|
123
|
+
getContextHelperData,
|
|
124
|
+
]);
|
|
125
|
+
// Cleanup: remove all context helpers on unmount
|
|
126
|
+
(0, react_1.useEffect)(() => {
|
|
127
|
+
const registeredIds = registeredIdsRef.current;
|
|
128
|
+
return () => {
|
|
129
|
+
registeredIds.forEach((id) => {
|
|
130
|
+
removeContextHelper(id);
|
|
131
|
+
});
|
|
132
|
+
registeredIds.clear();
|
|
133
|
+
};
|
|
134
|
+
}, [removeContextHelper]);
|
|
135
|
+
const addContextAttachment = (0, react_1.useCallback)((context) => {
|
|
136
|
+
setAttachments((prev) => {
|
|
137
|
+
if (prev.some((c) => c.name === context.name))
|
|
138
|
+
return prev;
|
|
139
|
+
if (typeof crypto === "undefined" || !("randomUUID" in crypto)) {
|
|
140
|
+
throw new Error("crypto.randomUUID() is not available. This usually happens when using an IP address instead of 'localhost' in development. Use 'localhost' or a secure context (HTTPS) to enable crypto APIs.");
|
|
141
|
+
}
|
|
142
|
+
const newId = crypto.randomUUID();
|
|
143
|
+
const newContext = { ...context, id: newId };
|
|
144
|
+
return [...prev, newContext];
|
|
145
|
+
});
|
|
146
|
+
}, []);
|
|
147
|
+
// This is used to remove a context when the user clicks the remove button
|
|
148
|
+
const removeContextAttachment = (0, react_1.useCallback)((id) => {
|
|
149
|
+
setAttachments((prev) => prev.filter((c) => c.id !== id));
|
|
150
|
+
}, []);
|
|
151
|
+
// This is used to clear the context when the user submits a message
|
|
152
|
+
const clearContextAttachments = (0, react_1.useCallback)(() => {
|
|
153
|
+
setAttachments([]);
|
|
154
|
+
}, []);
|
|
155
|
+
const value = (0, react_1.useMemo)(() => ({
|
|
156
|
+
attachments,
|
|
157
|
+
addContextAttachment,
|
|
158
|
+
removeContextAttachment,
|
|
159
|
+
clearContextAttachments,
|
|
160
|
+
customSuggestions,
|
|
161
|
+
setCustomSuggestions,
|
|
162
|
+
}), [
|
|
163
|
+
attachments,
|
|
164
|
+
addContextAttachment,
|
|
165
|
+
removeContextAttachment,
|
|
166
|
+
clearContextAttachments,
|
|
167
|
+
customSuggestions,
|
|
168
|
+
]);
|
|
169
|
+
return (react_1.default.createElement(ContextAttachmentContext.Provider, { value: value }, children));
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Hook to access context attachment state and methods.
|
|
173
|
+
* **Must be used within a `TamboProvider`** - throws an error otherwise.
|
|
174
|
+
* @throws {Error} If used outside of TamboProvider
|
|
175
|
+
* @returns The context attachment state and methods
|
|
176
|
+
* @example
|
|
177
|
+
* ```tsx
|
|
178
|
+
* const contextAttachment = useTamboContextAttachment();
|
|
179
|
+
*
|
|
180
|
+
* // Add a context
|
|
181
|
+
* contextAttachment.addContextAttachment({
|
|
182
|
+
* name: "Button.tsx",
|
|
183
|
+
* icon: <FileIcon />,
|
|
184
|
+
* metadata: { path: "/src/Button.tsx" }
|
|
185
|
+
* });
|
|
186
|
+
*
|
|
187
|
+
* // Remove a context
|
|
188
|
+
* contextAttachment.removeContextAttachment(contextId);
|
|
189
|
+
*
|
|
190
|
+
* // Set custom suggestions
|
|
191
|
+
* contextAttachment.setCustomSuggestions([{ id: "1", title: "Add Feature" }]);
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
function useTamboContextAttachment() {
|
|
195
|
+
const context = (0, react_1.useContext)(ContextAttachmentContext);
|
|
196
|
+
if (!context) {
|
|
197
|
+
throw new Error("useTamboContextAttachment must be used within a TamboContextAttachmentProvider");
|
|
198
|
+
}
|
|
199
|
+
return context;
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=tambo-context-attachment-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tambo-context-attachment-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-context-attachment-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgIb,wEAyHC;AAyBD,8DAQC;AAvRD,+CAQe;AACf,qFAA0E;AAgD1E,MAAM,wBAAwB,GAAG,IAAA,qBAAa,EAC5C,IAAI,CACL,CAAC;AA2BF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAgB,8BAA8B,CAAC,EAC7C,QAAQ,EACR,oBAAoB,GACgB;IACpC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAsB,EAAE,CAAC,CAAC;IACxE,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,IAAA,gBAAQ,EAExD,IAAI,CAAC,CAAC;IACR,MAAM,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,GAAG,IAAA,uDAAsB,GAAE,CAAC;IAE3E,uEAAuE;IACvE,MAAM,gBAAgB,GAAG,IAAA,cAAM,EAAc,IAAI,GAAG,EAAE,CAAC,CAAC;IACxD,MAAM,2BAA2B,GAAG,IAAA,cAAM,GAA+B,CAAC;IAE1E,wDAAwD;IACxD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CA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AAC;IAEP,oEAAoE;IACpE,MAAM,uBAAuB,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC/C,cAAc,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,IAAA,eAAO,EACnB,GAAG,EAAE,CAAC,CAAC;QACL,WAAW;QACX,oBAAoB;QACpB,uBAAuB;QACvB,uBAAuB;QACvB,iBAAiB;QACjB,oBAAoB;KACrB,CAAC,EACF;QACE,WAAW;QACX,oBAAoB;QACpB,uBAAuB;QACvB,uBAAuB;QACvB,iBAAiB;KAClB,CACF,CAAC;IAEF,OAAO,CACL,8BAAC,wBAAwB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAC5C,QAAQ,CACyB,CACrC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,yBAAyB;IACvC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,wBAAwB,CAAC,CAAC;IACrD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["\"use client\";\n\nimport type { Suggestion } from \"@tambo-ai/typescript-sdk/resources/beta/threads/suggestions\";\nimport React, {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useTamboContextHelpers } from \"./tambo-context-helpers-provider\";\n\n/**\n * Represents a context attachment that can be displayed in MessageInputContexts.\n * Context attachments appear as badges above the message input and provide additional\n * information to the AI about what to focus on.\n * @property {string} name - Display name shown in the badge\n * @property {React.ReactNode} [icon] - Optional icon to display in the badge\n * @property {Record<string, unknown>} [metadata] - Additional data passed to the AI\n * @example\n * ```tsx\n * const context: ContextAttachment = {\n * name: \"Button.tsx\",\n * icon: <FileIcon />,\n * metadata: { filePath: \"/src/components/Button.tsx\" }\n * };\n * ```\n */\nexport interface ContextAttachment {\n id: string;\n name: string;\n icon?: React.ReactNode;\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Represents the data structure returned by a context helper\n */\nexport type ContextHelperData = Record<string, unknown>;\n\n/**\n * Context state interface for managing context attachments and custom suggestions.\n * @property {ContextAttachment[]} attachments - Array of active context attachments (badges above message input)\n * @property {(context: Omit<ContextAttachment, \"id\">) => void} addContextAttachment - Add a new context attachment\n * @property {(id: string) => void} removeContextAttachment - Remove a context attachment by ID\n * @property {() => void} clearContextAttachments - Remove all context attachments - This is used to clear the context when the user submits a message\n * @property {Suggestion[] | null} customSuggestions - Custom suggestions to display instead of auto-generated ones\n * @property {(suggestions: Suggestion[] | null) => void} setCustomSuggestions - Set or clear custom suggestions\n */\nexport interface ContextAttachmentState {\n attachments: ContextAttachment[];\n addContextAttachment: (context: Omit<ContextAttachment, \"id\">) => void;\n removeContextAttachment: (id: string) => void;\n clearContextAttachments: () => void;\n customSuggestions: Suggestion[] | null;\n setCustomSuggestions: (suggestions: Suggestion[] | null) => void;\n}\n\nconst ContextAttachmentContext = createContext<ContextAttachmentState | null>(\n null,\n);\n\n/**\n * Props for the TamboContextAttachmentProvider.\n * @property {(context: ContextAttachment) => Promise<ContextHelperData> | ContextHelperData} [getContextHelperData] - Optional function to customize the data sent to the AI for each context. If not provided, uses a default structure with the context name and instruction.\n * @example\n * ```tsx\n * <TamboContextAttachmentProvider\n * getContextHelperData={(context) => ({\n * selectedFile: {\n * name: context.name,\n * path: context.metadata?.filePath,\n * instruction: \"Focus on this file\"\n * }\n * })}\n * >\n * {children}\n * </TamboContextAttachmentProvider>\n * ```\n */\nexport interface TamboContextAttachmentProviderProps {\n children?: React.ReactNode;\n getContextHelperData?: (\n context: ContextAttachment,\n ) => Promise<ContextHelperData> | ContextHelperData;\n}\n\n/**\n * Provider that enables context attachment features and custom suggestions in MessageInput.\n * **When to use:**\n * - **Included by default** in TamboProvider - no need to wrap separately\n * - Use `useTamboContextAttachment()` hook to manage context attachments\n * **What it does:**\n * - Manages context items that appear as badges above MessageInput\n * - Syncs context data with Tambo's AI for better responses\n * - Manages custom suggestions that replace auto-generated suggestions\n * - Allows components to add/remove contexts via `useTamboContextAttachment()`\n * - Allows components to set custom suggestions via `setCustomSuggestions()`\n * @param props - The props for the TamboContextAttachmentProvider\n * @param props.children - The children to wrap\n * @param props.getContextHelperData - The function to get the context helper data\n * @returns The TamboContextAttachmentProvider component\n * @example\n * Basic usage - already included in TamboProvider\n * ```tsx\n * <TamboProvider apiKey=\"...\">\n * <App />\n * </TamboProvider>\n * ```\n * @example\n * Using TamboProvider with custom context data\n * ```tsx\n * <TamboProvider\n * apiKey=\"...\"\n * getContextHelperData={(context) => ({\n * selectedComponent: {\n * name: context.name,\n * filePath: context.metadata?.path,\n * instruction: \"Edit this component\"\n * }\n * })}\n * >\n * <App />\n * </TamboProvider>\n * ```\n */\nexport function TamboContextAttachmentProvider({\n children,\n getContextHelperData,\n}: TamboContextAttachmentProviderProps) {\n const [attachments, setAttachments] = useState<ContextAttachment[]>([]);\n const [customSuggestions, setCustomSuggestions] = useState<\n Suggestion[] | null\n >(null);\n const { addContextHelper, removeContextHelper } = useTamboContextHelpers();\n\n // Track which context helpers have been registered to avoid duplicates\n const registeredIdsRef = useRef<Set<string>>(new Set());\n const prevGetContextHelperDataRef = useRef<typeof getContextHelperData>();\n\n // Sync context helpers with attachments using useEffect\n useEffect(() => {\n const currentIds = new Set(attachments.map((a) => a.id));\n const registeredIds = registeredIdsRef.current;\n\n // Remove context helpers that are no longer in attachments\n registeredIds.forEach((id) => {\n if (!currentIds.has(id)) {\n removeContextHelper(id);\n registeredIds.delete(id);\n }\n });\n\n const getDataChanged =\n prevGetContextHelperDataRef.current !== getContextHelperData;\n\n // Add or replace context helpers for attachments\n attachments.forEach((context) => {\n if (getDataChanged || !registeredIds.has(context.id)) {\n addContextHelper(context.id, async (): Promise<ContextHelperData> => {\n if (getContextHelperData) {\n return await getContextHelperData(context);\n }\n return {\n selectedComponent: {\n name: context.name,\n instruction:\n \"This is a Tambo interactable component that is currently selected and visible on the dashboard. You can read its current props and state, and update it by modifying its props. If multiple components are attached, you can interact with and modify any of them. Use the auto-registered interactable component tools (like get_interactable_component_by_id and update_interactable_component_<id>) to view and update the component's state.\",\n ...(context.metadata ?? {}),\n },\n };\n });\n registeredIds.add(context.id);\n }\n });\n\n prevGetContextHelperDataRef.current = getContextHelperData;\n }, [\n attachments,\n addContextHelper,\n removeContextHelper,\n getContextHelperData,\n ]);\n\n // Cleanup: remove all context helpers on unmount\n useEffect(() => {\n const registeredIds = registeredIdsRef.current;\n return () => {\n registeredIds.forEach((id) => {\n removeContextHelper(id);\n });\n registeredIds.clear();\n };\n }, [removeContextHelper]);\n\n const addContextAttachment = useCallback(\n (context: Omit<ContextAttachment, \"id\">) => {\n setAttachments((prev) => {\n if (prev.some((c) => c.name === context.name)) return prev;\n\n if (typeof crypto === \"undefined\" || !(\"randomUUID\" in crypto)) {\n throw new Error(\n \"crypto.randomUUID() is not available. This usually happens when using an IP address instead of 'localhost' in development. Use 'localhost' or a secure context (HTTPS) to enable crypto APIs.\",\n );\n }\n\n const newId = crypto.randomUUID();\n const newContext = { ...context, id: newId };\n return [...prev, newContext];\n });\n },\n [],\n );\n\n // This is used to remove a context when the user clicks the remove button\n const removeContextAttachment = useCallback((id: string) => {\n setAttachments((prev) => prev.filter((c) => c.id !== id));\n }, []);\n\n // This is used to clear the context when the user submits a message\n const clearContextAttachments = useCallback(() => {\n setAttachments([]);\n }, []);\n\n const value = useMemo(\n () => ({\n attachments,\n addContextAttachment,\n removeContextAttachment,\n clearContextAttachments,\n customSuggestions,\n setCustomSuggestions,\n }),\n [\n attachments,\n addContextAttachment,\n removeContextAttachment,\n clearContextAttachments,\n customSuggestions,\n ],\n );\n\n return (\n <ContextAttachmentContext.Provider value={value}>\n {children}\n </ContextAttachmentContext.Provider>\n );\n}\n\n/**\n * Hook to access context attachment state and methods.\n * **Must be used within a `TamboProvider`** - throws an error otherwise.\n * @throws {Error} If used outside of TamboProvider\n * @returns The context attachment state and methods\n * @example\n * ```tsx\n * const contextAttachment = useTamboContextAttachment();\n *\n * // Add a context\n * contextAttachment.addContextAttachment({\n * name: \"Button.tsx\",\n * icon: <FileIcon />,\n * metadata: { path: \"/src/Button.tsx\" }\n * });\n *\n * // Remove a context\n * contextAttachment.removeContextAttachment(contextId);\n *\n * // Set custom suggestions\n * contextAttachment.setCustomSuggestions([{ id: \"1\", title: \"Add Feature\" }]);\n * ```\n */\nexport function useTamboContextAttachment() {\n const context = useContext(ContextAttachmentContext);\n if (!context) {\n throw new Error(\n \"useTamboContextAttachment must be used within a TamboContextAttachmentProvider\",\n );\n }\n return context;\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import React, { PropsWithChildren } from "react";
|
|
|
2
2
|
import { TamboInteractableContext } from "../model/tambo-interactable";
|
|
3
3
|
import { TamboClientContextProps, TamboClientProviderProps } from "./tambo-client-provider";
|
|
4
4
|
import { TamboComponentContextProps } from "./tambo-component-provider";
|
|
5
|
+
import { ContextAttachmentState, TamboContextAttachmentProviderProps } from "./tambo-context-attachment-provider";
|
|
5
6
|
import { TamboContextHelpersContextProps, TamboContextHelpersProviderProps } from "./tambo-context-helpers-provider";
|
|
6
7
|
import { TamboRegistryProviderProps } from "./tambo-registry-provider";
|
|
7
8
|
import { TamboThreadInputProviderProps } from "./tambo-thread-input-provider";
|
|
@@ -17,15 +18,18 @@ import { TamboGenerationStageContextProps, TamboThreadContextProps, TamboThreadP
|
|
|
17
18
|
* @param props.environment - The environment to use for the Tambo API
|
|
18
19
|
* @param props.tools - The tools to register
|
|
19
20
|
* @param props.streaming - Whether to stream the response by default. Defaults to true.
|
|
21
|
+
* @param props.autoGenerateThreadName - Whether to automatically generate thread names. Defaults to true.
|
|
22
|
+
* @param props.autoGenerateNameThreshold - The message count threshold at which the thread name will be auto-generated. Defaults to 3.
|
|
20
23
|
* @param props.contextHelpers - Configuration for which context helpers are enabled/disabled
|
|
21
24
|
* @param props.userToken - The user's OAuth token (access or ID) used to identify the user and exchange for a Tambo session token (preferred over contextKey)
|
|
22
25
|
* @param props.contextKey - Optional context key to be used in the thread input provider
|
|
23
26
|
* @param props.onCallUnregisteredTool - Callback function called when an unregistered tool is called
|
|
24
27
|
* @param props.initialMessages - Initial messages to be included in new threads
|
|
28
|
+
* @param props.getContextHelperData - Optional function to customize the data sent to the AI for each context attachment
|
|
25
29
|
* @returns The TamboProvider component
|
|
26
30
|
*/
|
|
27
|
-
export declare const TamboProvider: React.FC<PropsWithChildren<TamboClientProviderProps & TamboRegistryProviderProps & TamboThreadProviderProps & TamboContextHelpersProviderProps & TamboThreadInputProviderProps
|
|
28
|
-
export type TamboContextProps = TamboClientContextProps & TamboThreadContextProps & TamboGenerationStageContextProps & TamboComponentContextProps & TamboInteractableContext & TamboContextHelpersContextProps;
|
|
31
|
+
export declare const TamboProvider: React.FC<PropsWithChildren<TamboClientProviderProps & TamboRegistryProviderProps & TamboThreadProviderProps & TamboContextHelpersProviderProps & TamboThreadInputProviderProps & Partial<Pick<TamboContextAttachmentProviderProps, "getContextHelperData">>>>;
|
|
32
|
+
export type TamboContextProps = TamboClientContextProps & TamboThreadContextProps & TamboGenerationStageContextProps & TamboComponentContextProps & TamboInteractableContext & TamboContextHelpersContextProps & ContextAttachmentState;
|
|
29
33
|
export declare const TamboContext: React.Context<TamboContextProps>;
|
|
30
34
|
/**
|
|
31
35
|
* TamboCompositeProvider is a provider that combines the TamboClient,
|
|
@@ -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,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,uBAAuB,EAEvB,wBAAwB,EAIzB,MAAM,yBAAyB,CAAC;AACjC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;AAEF,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GACrD,uBAAuB,GACvB,gCAAgC,GAChC,0BAA0B,GAC1B,wBAAwB,GACxB,+BAA+B,GAC/B,sBAAsB,CAAC;AAEzB,eAAO,MAAM,YAAY,kCAExB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA4B9D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,yBAEpB,CAAC"}
|
|
@@ -38,6 +38,7 @@ exports.useTambo = exports.TamboCompositeProvider = exports.TamboContext = expor
|
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const tambo_client_provider_1 = require("./tambo-client-provider");
|
|
40
40
|
const tambo_component_provider_1 = require("./tambo-component-provider");
|
|
41
|
+
const tambo_context_attachment_provider_1 = require("./tambo-context-attachment-provider");
|
|
41
42
|
const tambo_context_helpers_provider_1 = require("./tambo-context-helpers-provider");
|
|
42
43
|
const tambo_interactable_provider_1 = require("./tambo-interactable-provider");
|
|
43
44
|
const tambo_mcp_token_provider_1 = require("./tambo-mcp-token-provider");
|
|
@@ -55,23 +56,27 @@ const tambo_thread_provider_1 = require("./tambo-thread-provider");
|
|
|
55
56
|
* @param props.environment - The environment to use for the Tambo API
|
|
56
57
|
* @param props.tools - The tools to register
|
|
57
58
|
* @param props.streaming - Whether to stream the response by default. Defaults to true.
|
|
59
|
+
* @param props.autoGenerateThreadName - Whether to automatically generate thread names. Defaults to true.
|
|
60
|
+
* @param props.autoGenerateNameThreshold - The message count threshold at which the thread name will be auto-generated. Defaults to 3.
|
|
58
61
|
* @param props.contextHelpers - Configuration for which context helpers are enabled/disabled
|
|
59
62
|
* @param props.userToken - The user's OAuth token (access or ID) used to identify the user and exchange for a Tambo session token (preferred over contextKey)
|
|
60
63
|
* @param props.contextKey - Optional context key to be used in the thread input provider
|
|
61
64
|
* @param props.onCallUnregisteredTool - Callback function called when an unregistered tool is called
|
|
62
65
|
* @param props.initialMessages - Initial messages to be included in new threads
|
|
66
|
+
* @param props.getContextHelperData - Optional function to customize the data sent to the AI for each context attachment
|
|
63
67
|
* @returns The TamboProvider component
|
|
64
68
|
*/
|
|
65
|
-
const TamboProvider = ({ children, tamboUrl, apiKey, userToken, components, environment, tools, streaming, contextHelpers, contextKey, initialMessages, onCallUnregisteredTool, }) => {
|
|
69
|
+
const TamboProvider = ({ children, tamboUrl, apiKey, userToken, components, environment, tools, streaming, autoGenerateThreadName, autoGenerateNameThreshold, contextHelpers, contextKey, initialMessages, onCallUnregisteredTool, getContextHelperData, }) => {
|
|
66
70
|
return (react_1.default.createElement(tambo_client_provider_1.TamboClientProvider, { tamboUrl: tamboUrl, apiKey: apiKey, environment: environment, userToken: userToken },
|
|
67
71
|
react_1.default.createElement(tambo_registry_provider_1.TamboRegistryProvider, { components: components, tools: tools, onCallUnregisteredTool: onCallUnregisteredTool },
|
|
68
72
|
react_1.default.createElement(tambo_context_helpers_provider_1.TamboContextHelpersProvider, { contextHelpers: contextHelpers },
|
|
69
73
|
react_1.default.createElement(tambo_mcp_token_provider_1.TamboMcpTokenProvider, null,
|
|
70
|
-
react_1.default.createElement(tambo_thread_provider_1.TamboThreadProvider, { streaming: streaming, initialMessages: initialMessages },
|
|
74
|
+
react_1.default.createElement(tambo_thread_provider_1.TamboThreadProvider, { streaming: streaming, autoGenerateThreadName: autoGenerateThreadName, autoGenerateNameThreshold: autoGenerateNameThreshold, initialMessages: initialMessages },
|
|
71
75
|
react_1.default.createElement(tambo_thread_input_provider_1.TamboThreadInputProvider, { contextKey: contextKey },
|
|
72
|
-
react_1.default.createElement(
|
|
73
|
-
react_1.default.createElement(
|
|
74
|
-
react_1.default.createElement(
|
|
76
|
+
react_1.default.createElement(tambo_context_attachment_provider_1.TamboContextAttachmentProvider, { getContextHelperData: getContextHelperData },
|
|
77
|
+
react_1.default.createElement(tambo_component_provider_1.TamboComponentProvider, null,
|
|
78
|
+
react_1.default.createElement(tambo_interactable_provider_1.TamboInteractableProvider, null,
|
|
79
|
+
react_1.default.createElement(exports.TamboCompositeProvider, null, children)))))))))));
|
|
75
80
|
};
|
|
76
81
|
exports.TamboProvider = TamboProvider;
|
|
77
82
|
exports.TamboContext = (0, react_1.createContext)({});
|
|
@@ -90,6 +95,7 @@ const TamboCompositeProvider = ({ children, }) => {
|
|
|
90
95
|
const componentRegistry = (0, tambo_component_provider_1.useTamboComponent)();
|
|
91
96
|
const interactableComponents = (0, tambo_interactable_provider_1.useTamboInteractable)();
|
|
92
97
|
const contextHelpers = (0, tambo_context_helpers_provider_1.useTamboContextHelpers)();
|
|
98
|
+
const contextAttachment = (0, tambo_context_attachment_provider_1.useTamboContextAttachment)();
|
|
93
99
|
return (react_1.default.createElement(exports.TamboContext.Provider, { value: {
|
|
94
100
|
client,
|
|
95
101
|
queryClient,
|
|
@@ -98,6 +104,7 @@ const TamboCompositeProvider = ({ children, }) => {
|
|
|
98
104
|
...threads,
|
|
99
105
|
...interactableComponents,
|
|
100
106
|
...contextHelpers,
|
|
107
|
+
...contextAttachment,
|
|
101
108
|
} }, children));
|
|
102
109
|
};
|
|
103
110
|
exports.TamboCompositeProvider = TamboCompositeProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAA4E;AAE5E,mEAOiC;AACjC,yEAIoC;AACpC,qFAK0C;AAC1C,+EAGuC;AACvC,yEAAmE;AACnE,uEAGmC;AACnC,+EAGuC;AACvC,mEAMiC;AAEjC
|
|
1
|
+
{"version":3,"file":"tambo-provider.js","sourceRoot":"","sources":["../../src/providers/tambo-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,+CAA4E;AAE5E,m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,GACT,EAAE,EAAE;IACH,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,eAAe,GAAG,IAAA,+CAAuB,GAAE,CAAC;IAClD,MAAM,iBAAiB,GAAG,IAAA,4CAAiB,GAAE,CAAC;IAC9C,MAAM,sBAAsB,GAAG,IAAA,kDAAoB,GAAE,CAAC;IACtD,MAAM,cAAc,GAAG,IAAA,uDAAsB,GAAE,CAAC;IAChD,MAAM,iBAAiB,GAAG,IAAA,6DAAyB,GAAE,CAAC;IAEtD,OAAO,CACL,8BAAC,oBAAY,CAAC,QAAQ,IACpB,KAAK,EAAE;YACL,MAAM;YACN,WAAW;YACX,eAAe;YACf,GAAG,iBAAiB;YACpB,GAAG,OAAO;YACV,GAAG,sBAAsB;YACzB,GAAG,cAAc;YACjB,GAAG,iBAAiB;SACrB,IAEA,QAAQ,CACa,CACzB,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,sBAAsB,0BA4BjC;AAEF;;;;;;;GAOG;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 { TamboInteractableContext } from \"../model/tambo-interactable\";\nimport {\n TamboClientContextProps,\n TamboClientProvider,\n TamboClientProviderProps,\n useIsTamboTokenUpdating,\n useTamboClient,\n useTamboQueryClient,\n} from \"./tambo-client-provider\";\nimport {\n TamboComponentContextProps,\n TamboComponentProvider,\n useTamboComponent,\n} from \"./tambo-component-provider\";\nimport {\n ContextAttachmentState,\n TamboContextAttachmentProvider,\n TamboContextAttachmentProviderProps,\n useTamboContextAttachment,\n} from \"./tambo-context-attachment-provider\";\nimport {\n TamboContextHelpersContextProps,\n TamboContextHelpersProvider,\n TamboContextHelpersProviderProps,\n useTamboContextHelpers,\n} from \"./tambo-context-helpers-provider\";\nimport {\n TamboInteractableProvider,\n useTamboInteractable,\n} from \"./tambo-interactable-provider\";\nimport { TamboMcpTokenProvider } from \"./tambo-mcp-token-provider\";\nimport {\n TamboRegistryProvider,\n TamboRegistryProviderProps,\n} from \"./tambo-registry-provider\";\nimport {\n TamboThreadInputProvider,\n TamboThreadInputProviderProps,\n} from \"./tambo-thread-input-provider\";\nimport {\n TamboGenerationStageContextProps,\n TamboThreadContextProps,\n TamboThreadProvider,\n TamboThreadProviderProps,\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, the current thread context, and interactable components.\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 * @param props.tools - The tools to register\n * @param props.streaming - Whether to stream the response by default. Defaults to true.\n * @param props.autoGenerateThreadName - Whether to automatically generate thread names. Defaults to true.\n * @param props.autoGenerateNameThreshold - The message count threshold at which the thread name will be auto-generated. Defaults to 3.\n * @param props.contextHelpers - Configuration for which context helpers are enabled/disabled\n * @param props.userToken - The user's OAuth token (access or ID) used to identify the user and exchange for a Tambo session token (preferred over contextKey)\n * @param props.contextKey - Optional context key to be used in the thread input provider\n * @param props.onCallUnregisteredTool - Callback function called when an unregistered tool is called\n * @param props.initialMessages - Initial messages to be included in new threads\n * @param props.getContextHelperData - Optional function to customize the data sent to the AI for each context attachment\n * @returns The TamboProvider component\n */\nexport const TamboProvider: React.FC<\n PropsWithChildren<\n TamboClientProviderProps &\n TamboRegistryProviderProps &\n TamboThreadProviderProps &\n TamboContextHelpersProviderProps &\n TamboThreadInputProviderProps &\n Partial<Pick<TamboContextAttachmentProviderProps, \"getContextHelperData\">>\n >\n> = ({\n children,\n tamboUrl,\n apiKey,\n userToken,\n components,\n environment,\n tools,\n streaming,\n autoGenerateThreadName,\n autoGenerateNameThreshold,\n contextHelpers,\n contextKey,\n initialMessages,\n onCallUnregisteredTool,\n getContextHelperData,\n}) => {\n return (\n <TamboClientProvider\n tamboUrl={tamboUrl}\n apiKey={apiKey}\n environment={environment}\n userToken={userToken}\n >\n <TamboRegistryProvider\n components={components}\n tools={tools}\n onCallUnregisteredTool={onCallUnregisteredTool}\n >\n <TamboContextHelpersProvider contextHelpers={contextHelpers}>\n <TamboMcpTokenProvider>\n <TamboThreadProvider\n streaming={streaming}\n autoGenerateThreadName={autoGenerateThreadName}\n autoGenerateNameThreshold={autoGenerateNameThreshold}\n initialMessages={initialMessages}\n >\n <TamboThreadInputProvider contextKey={contextKey}>\n <TamboContextAttachmentProvider\n getContextHelperData={getContextHelperData}\n >\n <TamboComponentProvider>\n <TamboInteractableProvider>\n <TamboCompositeProvider>\n {children}\n </TamboCompositeProvider>\n </TamboInteractableProvider>\n </TamboComponentProvider>\n </TamboContextAttachmentProvider>\n </TamboThreadInputProvider>\n </TamboThreadProvider>\n </TamboMcpTokenProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n </TamboClientProvider>\n );\n};\n\nexport type TamboContextProps = TamboClientContextProps &\n TamboThreadContextProps &\n TamboGenerationStageContextProps &\n TamboComponentContextProps &\n TamboInteractableContext &\n TamboContextHelpersContextProps &\n ContextAttachmentState;\n\nexport const TamboContext = createContext<TamboContextProps>(\n {} as TamboContextProps,\n);\n\n/**\n * TamboCompositeProvider is a provider that combines the TamboClient,\n * TamboThread, TamboComponent, and TamboInteractable providers\n * @param props - The props for the TamboCompositeProvider\n * @param props.children - The children to wrap\n * @returns The wrapped component\n */\nexport const TamboCompositeProvider: React.FC<PropsWithChildren> = ({\n children,\n}) => {\n const threads = useTamboThread();\n const client = useTamboClient();\n const queryClient = useTamboQueryClient();\n const isUpdatingToken = useIsTamboTokenUpdating();\n const componentRegistry = useTamboComponent();\n const interactableComponents = useTamboInteractable();\n const contextHelpers = useTamboContextHelpers();\n const contextAttachment = useTamboContextAttachment();\n\n return (\n <TamboContext.Provider\n value={{\n client,\n queryClient,\n isUpdatingToken,\n ...componentRegistry,\n ...threads,\n ...interactableComponents,\n ...contextHelpers,\n ...contextAttachment,\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, the current thread context,\n * and interactable component management.\n * @returns The Tambo API\n */\nexport const useTambo = () => {\n return useContext(TamboContext);\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-stubs.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-stubs.tsx"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAE/C,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"tambo-stubs.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-stubs.tsx"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAE/C,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOpD,OAAO,EAEL,gCAAgC,EACjC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAQ1B;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,OAAO,CAAC,iBAAiB,CAAC;IACxE,2CAA2C;IAC3C,MAAM,EAAE,WAAW,CAAC;IACpB,wDAAwD;IACxD,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,mDAAmD;IACnD,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC9D,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,gCAAgC,CAAC,gBAAgB,CAAC,CAAC;CACrE;AA4JD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CACtC,iBAAiB,CAAC,sBAAsB,CAAC,CAsH1C,CAAC"}
|
|
@@ -40,7 +40,9 @@ const react_1 = __importStar(require("react"));
|
|
|
40
40
|
const generate_component_response_1 = require("../model/generate-component-response");
|
|
41
41
|
const tambo_client_provider_1 = require("./tambo-client-provider");
|
|
42
42
|
const tambo_component_provider_1 = require("./tambo-component-provider");
|
|
43
|
+
const tambo_context_attachment_provider_1 = require("./tambo-context-attachment-provider");
|
|
43
44
|
const tambo_context_helpers_provider_1 = require("./tambo-context-helpers-provider");
|
|
45
|
+
const tambo_interactable_provider_1 = require("./tambo-interactable-provider");
|
|
44
46
|
const tambo_provider_1 = require("./tambo-provider");
|
|
45
47
|
const tambo_registry_provider_1 = require("./tambo-registry-provider");
|
|
46
48
|
const tambo_thread_provider_1 = require("./tambo-thread-provider");
|
|
@@ -248,8 +250,10 @@ const TamboStubProvider = ({ children, thread, components = [], tools = [], thre
|
|
|
248
250
|
react_1.default.createElement(TamboStubRegistryProvider, { componentList: componentList, toolRegistry: toolRegistry, componentToolAssociations: componentToolAssociations, registerComponent: componentContextProps.registerComponent, registerTool: componentContextProps.registerTool, registerTools: componentContextProps.registerTools, addToolAssociation: componentContextProps.addToolAssociation },
|
|
249
251
|
react_1.default.createElement(TamboStubThreadProvider, { ...threadContextProps },
|
|
250
252
|
react_1.default.createElement(tambo_context_helpers_provider_1.TamboContextHelpersProvider, { contextHelpers: contextHelpers },
|
|
251
|
-
react_1.default.createElement(
|
|
252
|
-
react_1.default.createElement(
|
|
253
|
+
react_1.default.createElement(tambo_context_attachment_provider_1.TamboContextAttachmentProvider, null,
|
|
254
|
+
react_1.default.createElement(tambo_component_provider_1.TamboComponentProvider, null,
|
|
255
|
+
react_1.default.createElement(tambo_interactable_provider_1.TamboInteractableProvider, null,
|
|
256
|
+
react_1.default.createElement(tambo_provider_1.TamboCompositeProvider, null, children)))))))));
|
|
253
257
|
};
|
|
254
258
|
exports.TamboStubProvider = TamboStubProvider;
|
|
255
259
|
//# sourceMappingURL=tambo-stubs.js.map
|