@bubblelab/shared-schemas 0.1.10 → 0.1.12

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.
Files changed (98) hide show
  1. package/dist/agent-memory.d.ts +21 -0
  2. package/dist/agent-memory.d.ts.map +1 -0
  3. package/dist/agent-memory.js +11 -0
  4. package/dist/agent-memory.js.map +1 -0
  5. package/dist/ai-models.d.ts +1 -1
  6. package/dist/ai-models.d.ts.map +1 -1
  7. package/dist/ai-models.js +12 -0
  8. package/dist/ai-models.js.map +1 -1
  9. package/dist/api-schema.d.ts +2 -2
  10. package/dist/bubble-definition-schema.d.ts +559 -75
  11. package/dist/bubble-definition-schema.d.ts.map +1 -1
  12. package/dist/bubble-definition-schema.js +186 -0
  13. package/dist/bubble-definition-schema.js.map +1 -1
  14. package/dist/bubbleflow-execution-schema.d.ts +594 -147
  15. package/dist/bubbleflow-execution-schema.d.ts.map +1 -1
  16. package/dist/bubbleflow-execution-schema.js +46 -26
  17. package/dist/bubbleflow-execution-schema.js.map +1 -1
  18. package/dist/bubbleflow-generation-prompts.d.ts +5 -16
  19. package/dist/bubbleflow-generation-prompts.d.ts.map +1 -1
  20. package/dist/bubbleflow-generation-prompts.js +14 -54
  21. package/dist/bubbleflow-generation-prompts.js.map +1 -1
  22. package/dist/bubbleflow-schema.d.ts +1081 -92
  23. package/dist/bubbleflow-schema.d.ts.map +1 -1
  24. package/dist/bubbleflow-schema.js +94 -4
  25. package/dist/bubbleflow-schema.js.map +1 -1
  26. package/dist/coffee.d.ts +2201 -0
  27. package/dist/coffee.d.ts.map +1 -0
  28. package/dist/coffee.js +257 -0
  29. package/dist/coffee.js.map +1 -0
  30. package/dist/credential-schema.d.ts +172 -3
  31. package/dist/credential-schema.d.ts.map +1 -1
  32. package/dist/credential-schema.js +509 -5
  33. package/dist/credential-schema.js.map +1 -1
  34. package/dist/database-definition-schema.d.ts +8 -8
  35. package/dist/error-enhancer.d.ts +6 -0
  36. package/dist/error-enhancer.d.ts.map +1 -0
  37. package/dist/error-enhancer.js +88 -0
  38. package/dist/error-enhancer.js.map +1 -0
  39. package/dist/generate-bubbleflow-schema.d.ts +974 -52
  40. package/dist/generate-bubbleflow-schema.d.ts.map +1 -1
  41. package/dist/generate-bubbleflow-schema.js +23 -7
  42. package/dist/generate-bubbleflow-schema.js.map +1 -1
  43. package/dist/hash-utils.d.ts +26 -0
  44. package/dist/hash-utils.d.ts.map +1 -0
  45. package/dist/hash-utils.js +37 -0
  46. package/dist/hash-utils.js.map +1 -0
  47. package/dist/index.d.ts +7 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +7 -0
  50. package/dist/index.js.map +1 -1
  51. package/dist/milk-tea.d.ts +22 -24
  52. package/dist/milk-tea.d.ts.map +1 -1
  53. package/dist/milk-tea.js +1 -4
  54. package/dist/milk-tea.js.map +1 -1
  55. package/dist/oauth-schema.d.ts +2 -2
  56. package/dist/param-utils.d.ts +10 -0
  57. package/dist/param-utils.d.ts.map +1 -0
  58. package/dist/param-utils.js +13 -0
  59. package/dist/param-utils.js.map +1 -0
  60. package/dist/pearl.d.ts +96 -29
  61. package/dist/pearl.d.ts.map +1 -1
  62. package/dist/pearl.js +20 -9
  63. package/dist/pearl.js.map +1 -1
  64. package/dist/rice.d.ts +100 -0
  65. package/dist/rice.d.ts.map +1 -0
  66. package/dist/rice.js +65 -0
  67. package/dist/rice.js.map +1 -0
  68. package/dist/storage-utils.d.ts +19 -0
  69. package/dist/storage-utils.d.ts.map +1 -0
  70. package/dist/storage-utils.js +54 -0
  71. package/dist/storage-utils.js.map +1 -0
  72. package/dist/streaming-events.d.ts +36 -2
  73. package/dist/streaming-events.d.ts.map +1 -1
  74. package/dist/subscription-status-schema.d.ts +192 -32
  75. package/dist/subscription-status-schema.d.ts.map +1 -1
  76. package/dist/subscription-status-schema.js +85 -7
  77. package/dist/subscription-status-schema.js.map +1 -1
  78. package/dist/trigger.d.ts +45 -51
  79. package/dist/trigger.d.ts.map +1 -1
  80. package/dist/trigger.js +0 -2
  81. package/dist/trigger.js.map +1 -1
  82. package/dist/types.d.ts +13 -2
  83. package/dist/types.d.ts.map +1 -1
  84. package/dist/types.js +18 -0
  85. package/dist/types.js.map +1 -1
  86. package/package.json +1 -1
  87. package/dist/general-chat.d.ts +0 -81
  88. package/dist/general-chat.d.ts.map +0 -1
  89. package/dist/general-chat.js +0 -58
  90. package/dist/general-chat.js.map +0 -1
  91. package/dist/generation-result-schema.d.ts +0 -73
  92. package/dist/generation-result-schema.d.ts.map +0 -1
  93. package/dist/generation-result-schema.js +0 -55
  94. package/dist/generation-result-schema.js.map +0 -1
  95. package/dist/mock-data-generator.test.d.ts +0 -2
  96. package/dist/mock-data-generator.test.d.ts.map +0 -1
  97. package/dist/mock-data-generator.test.js +0 -176
  98. package/dist/mock-data-generator.test.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coffee.d.ts","sourceRoot":"","sources":["../src/coffee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAS5C,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,oBAAoB,EAAG,6BAAsC,CAAC;AAM3E,0DAA0D;AAC1D,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAOpC,CAAC;AAEH,qDAAqD;AACrD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBtC,CAAC;AAEH,gEAAgE;AAChE,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMzC,CAAC;AAMH;;;GAGG;AACH,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;EAWlD,CAAC;AAEH;;;GAGG;AACH,eAA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AC,CAAC;AAC5D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
package/dist/coffee.js ADDED
@@ -0,0 +1,257 @@
1
+ import { z } from 'zod';
2
+ import { CredentialType } from './types.js';
3
+ // ============================================================================
4
+ // Coffee Agent - Planning Phase for BubbleFlow Generation
5
+ // ============================================================================
6
+ // Coffee runs BEFORE Boba to gather clarification and generate an
7
+ // implementation plan. This helps reduce ambiguity in user requests.
8
+ // Constants
9
+ export const COFFEE_MAX_ITERATIONS = 30;
10
+ export const COFFEE_MAX_QUESTIONS = 5;
11
+ export const COFFEE_DEFAULT_MODEL = 'google/gemini-3-pro-preview';
12
+ // ============================================================================
13
+ // Clarification Schemas
14
+ // ============================================================================
15
+ /** A single choice option for a clarification question */
16
+ export const ClarificationChoiceSchema = z.object({
17
+ id: z.string().describe('Unique identifier for this choice'),
18
+ label: z.string().describe('Short display label for the choice'),
19
+ description: z
20
+ .string()
21
+ .optional()
22
+ .describe('Optional longer description explaining the choice'),
23
+ });
24
+ /** A clarification question with multiple choices */
25
+ export const ClarificationQuestionSchema = z.object({
26
+ id: z.string().describe('Unique identifier for this question'),
27
+ question: z.string().describe('The question text to display to the user'),
28
+ choices: z
29
+ .array(ClarificationChoiceSchema)
30
+ .min(2)
31
+ .describe('Available choices for the user (minimum 2 options)'),
32
+ context: z
33
+ .string()
34
+ .optional()
35
+ .describe('Optional context explaining why this question is being asked'),
36
+ allowMultiple: z
37
+ .boolean()
38
+ .optional()
39
+ .default(false)
40
+ .describe('If true, user can select multiple choices. Default is false (single selection)'),
41
+ });
42
+ /** Event sent to frontend containing clarification questions */
43
+ export const CoffeeClarificationEventSchema = z.object({
44
+ questions: z
45
+ .array(ClarificationQuestionSchema)
46
+ .min(1)
47
+ .max(COFFEE_MAX_QUESTIONS)
48
+ .describe(`List of clarification questions (1-${COFFEE_MAX_QUESTIONS})`),
49
+ });
50
+ // ============================================================================
51
+ // Context Gathering Schemas
52
+ // ============================================================================
53
+ /**
54
+ * Event sent when Coffee requests external context via running a BubbleFlow.
55
+ * This pauses the planning process until the user provides credentials and approves execution.
56
+ */
57
+ export const CoffeeRequestExternalContextEventSchema = z.object({
58
+ flowId: z.string().describe('Unique ID for this context request'),
59
+ flowCode: z
60
+ .string()
61
+ .describe('Validated BubbleFlow TypeScript code to execute'),
62
+ requiredCredentials: z
63
+ .array(z.nativeEnum(CredentialType))
64
+ .describe('List of credential types needed to run this flow'),
65
+ description: z
66
+ .string()
67
+ .describe('User-friendly description of what this flow will do'),
68
+ });
69
+ /**
70
+ * Answer sent back to Coffee after user provides credentials and flow executes.
71
+ * This is used to resume the planning process with enriched context.
72
+ */
73
+ export const CoffeeContextAnswerSchema = z.object({
74
+ flowId: z.string().describe('ID of the context request being answered'),
75
+ status: z
76
+ .enum(['success', 'rejected', 'error'])
77
+ .describe('Status: success (got context), rejected (user skipped), error (execution failed)'),
78
+ result: z
79
+ .unknown()
80
+ .optional()
81
+ .describe('The result data from running the context-gathering flow'),
82
+ error: z.string().optional().describe('Error message if status is error'),
83
+ originalRequest: CoffeeRequestExternalContextEventSchema.optional().describe('The original context request that triggered this answer'),
84
+ });
85
+ /**
86
+ * Context request info that the agent generates when it wants to run a flow.
87
+ */
88
+ export const CoffeeContextRequestInfoSchema = z.object({
89
+ purpose: z.string().describe('Why this context is needed'),
90
+ flowDescription: z
91
+ .string()
92
+ .describe('User-facing description of what the flow will do'),
93
+ });
94
+ /** Legacy context gathering status (used in streaming events) */
95
+ export const CoffeeContextEventSchema = z.object({
96
+ status: z.enum(['gathering', 'complete']),
97
+ miniFlowDescription: z.string().optional(),
98
+ result: z.string().optional(),
99
+ });
100
+ // ============================================================================
101
+ // Plan Schemas
102
+ // ============================================================================
103
+ /** A single step in the implementation plan */
104
+ export const PlanStepSchema = z.object({
105
+ title: z.string().describe('Short title for this step'),
106
+ description: z
107
+ .string()
108
+ .describe('Detailed description of what this step does'),
109
+ bubblesUsed: z
110
+ .array(z.string())
111
+ .optional()
112
+ .describe('Names of bubbles used in this step'),
113
+ });
114
+ /** The complete implementation plan generated by Coffee */
115
+ export const CoffeePlanEventSchema = z.object({
116
+ summary: z.string().describe('Brief overview of the workflow'),
117
+ steps: z.array(PlanStepSchema).describe('Step-by-step implementation plan'),
118
+ estimatedBubbles: z
119
+ .array(z.string())
120
+ .describe('All bubbles that will be used in the workflow'),
121
+ });
122
+ // ============================================================================
123
+ // Unified Message Types for Coffee Chat
124
+ // ============================================================================
125
+ // These message types allow Coffee interactions to be stored as persistent
126
+ // messages in the chat history, rather than ephemeral state.
127
+ /** Base message structure shared by all message types */
128
+ const BaseMessageSchema = z.object({
129
+ id: z.string().describe('Unique message identifier'),
130
+ timestamp: z.string().describe('ISO timestamp of message creation'),
131
+ });
132
+ /** Regular user text message */
133
+ export const UserMessageSchema = BaseMessageSchema.extend({
134
+ type: z.literal('user'),
135
+ content: z.string().describe('User message text'),
136
+ });
137
+ /** Regular assistant text message */
138
+ export const AssistantMessageSchema = BaseMessageSchema.extend({
139
+ type: z.literal('assistant'),
140
+ content: z.string().describe('Assistant response text'),
141
+ code: z.string().optional().describe('Generated code if applicable'),
142
+ resultType: z
143
+ .enum(['code', 'question', 'answer', 'reject'])
144
+ .optional()
145
+ .describe('Type of assistant response'),
146
+ bubbleParameters: z
147
+ .record(z.string(), z.unknown())
148
+ .optional()
149
+ .describe('Bubble parameters for code responses'),
150
+ });
151
+ /** Coffee asking clarification questions */
152
+ export const ClarificationRequestMessageSchema = BaseMessageSchema.extend({
153
+ type: z.literal('clarification_request'),
154
+ questions: z
155
+ .array(ClarificationQuestionSchema)
156
+ .describe('Questions being asked'),
157
+ });
158
+ /** User's answers to clarification questions */
159
+ export const ClarificationResponseMessageSchema = BaseMessageSchema.extend({
160
+ type: z.literal('clarification_response'),
161
+ answers: z
162
+ .record(z.string(), z.array(z.string()))
163
+ .describe('questionId -> choiceIds'),
164
+ originalQuestions: z
165
+ .array(ClarificationQuestionSchema)
166
+ .optional()
167
+ .describe('The questions that were answered (for display purposes)'),
168
+ });
169
+ /** Coffee requesting external context */
170
+ export const ContextRequestMessageSchema = BaseMessageSchema.extend({
171
+ type: z.literal('context_request'),
172
+ request: CoffeeRequestExternalContextEventSchema.describe('Context gathering request details'),
173
+ });
174
+ /** User's response to context request */
175
+ export const ContextResponseMessageSchema = BaseMessageSchema.extend({
176
+ type: z.literal('context_response'),
177
+ answer: CoffeeContextAnswerSchema.describe('User response to context request'),
178
+ credentialTypes: z
179
+ .array(z.string())
180
+ .optional()
181
+ .describe('Credential types used (for display, not actual secrets)'),
182
+ });
183
+ /** Coffee's generated plan */
184
+ export const PlanMessageSchema = BaseMessageSchema.extend({
185
+ type: z.literal('plan'),
186
+ plan: CoffeePlanEventSchema.describe('Generated implementation plan'),
187
+ });
188
+ /** User's plan approval with optional comment */
189
+ export const PlanApprovalMessageSchema = BaseMessageSchema.extend({
190
+ type: z.literal('plan_approval'),
191
+ approved: z.boolean().describe('Whether the plan was approved'),
192
+ comment: z.string().optional().describe('Optional user comment on the plan'),
193
+ });
194
+ /** System message (for retries, errors, etc.) */
195
+ export const SystemMessageSchema = BaseMessageSchema.extend({
196
+ type: z.literal('system'),
197
+ content: z.string().describe('System message content'),
198
+ });
199
+ /** Tool result message - persists successful tool call results */
200
+ export const ToolResultMessageSchema = BaseMessageSchema.extend({
201
+ type: z.literal('tool_result'),
202
+ toolName: z.string().describe('Name of the tool that was called'),
203
+ toolCallId: z.string().describe('Unique ID for this tool call'),
204
+ input: z.unknown().describe('Input parameters passed to the tool'),
205
+ output: z.unknown().describe('Output/result from the tool'),
206
+ duration: z.number().describe('Duration of the tool call in milliseconds'),
207
+ success: z.boolean().describe('Whether the tool call succeeded'),
208
+ });
209
+ /** Union of all Coffee message types */
210
+ export const CoffeeMessageSchema = z.discriminatedUnion('type', [
211
+ UserMessageSchema,
212
+ AssistantMessageSchema,
213
+ ClarificationRequestMessageSchema,
214
+ ClarificationResponseMessageSchema,
215
+ ContextRequestMessageSchema,
216
+ ContextResponseMessageSchema,
217
+ PlanMessageSchema,
218
+ PlanApprovalMessageSchema,
219
+ SystemMessageSchema,
220
+ ToolResultMessageSchema,
221
+ ]);
222
+ // ============================================================================
223
+ // Request/Response Schemas
224
+ // ============================================================================
225
+ /** Request to the Generate BubbleFlow */
226
+ export const CoffeeRequestSchema = z.object({
227
+ prompt: z.string().min(1).describe('The user prompt describing the workflow'),
228
+ flowId: z
229
+ .number()
230
+ .optional()
231
+ .describe('Optional flow ID if updating existing flow'),
232
+ messages: z
233
+ .array(CoffeeMessageSchema)
234
+ .optional()
235
+ .describe('Full conversation history including clarification Q&A, context results, plan approvals'),
236
+ });
237
+ /** Response from the Coffee agent */
238
+ export const CoffeeResponseSchema = z.object({
239
+ type: z
240
+ .enum(['clarification', 'plan', 'context_request', 'error'])
241
+ .describe('Response type'),
242
+ clarification: CoffeeClarificationEventSchema.optional(),
243
+ plan: CoffeePlanEventSchema.optional(),
244
+ contextRequest: CoffeeRequestExternalContextEventSchema.optional(),
245
+ error: z.string().optional(),
246
+ success: z.boolean().describe('Whether the operation completed successfully'),
247
+ });
248
+ /** Internal output format from the Coffee AI agent */
249
+ export const CoffeeAgentOutputSchema = z.object({
250
+ action: z
251
+ .enum(['askClarification', 'generatePlan', 'requestContext'])
252
+ .describe('The action the agent wants to take'),
253
+ questions: z.array(ClarificationQuestionSchema).optional(),
254
+ plan: CoffeePlanEventSchema.optional(),
255
+ contextRequest: CoffeeContextRequestInfoSchema.optional(),
256
+ });
257
+ //# sourceMappingURL=coffee.js.map
@@ -0,0 +1 @@
1
+ {"version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E,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;SAC3D,QAAQ,CAAC,eAAe,CAAC;IAC5B,aAAa,EAAE,8BAA8B,CAAC,QAAQ,EAAE;IACxD,IAAI,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IACtC,cAAc,EAAE,uCAAuC,CAAC,QAAQ,EAAE;IAClE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;CAC9E,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAC;SAC5D,QAAQ,CAAC,oCAAoC,CAAC;IACjD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE;IAC1D,IAAI,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IACtC,cAAc,EAAE,8BAA8B,CAAC,QAAQ,EAAE;CAC1D,CAAC,CAAC"}
@@ -1,15 +1,46 @@
1
1
  import { BubbleName, CredentialType } from './types.js';
2
2
  import { z } from '@hono/zod-openapi';
3
+ /**
4
+ * Configuration for a credential type displayed in the UI
5
+ */
6
+ export interface CredentialConfig {
7
+ label: string;
8
+ description: string;
9
+ placeholder: string;
10
+ namePlaceholder: string;
11
+ credentialConfigurations: Record<string, unknown>;
12
+ }
13
+ /**
14
+ * Configuration for all credential types - used by Credentials page and AI agents
15
+ */
16
+ export declare const CREDENTIAL_TYPE_CONFIG: Record<CredentialType, CredentialConfig>;
17
+ /**
18
+ * Generate a human-readable summary of available credentials for AI agents
19
+ */
20
+ export declare function generateCredentialsSummary(): string;
3
21
  /**
4
22
  * Maps credential types to their environment variable names (for backend only!!!!)
5
23
  */
6
24
  export declare const CREDENTIAL_ENV_MAP: Record<CredentialType, string>;
7
25
  /** Used by bubblelab studio */
8
26
  export declare const SYSTEM_CREDENTIALS: Set<CredentialType>;
27
+ /**
28
+ * Credentials that are optional (not required) for their associated bubbles.
29
+ * These will not show as "missing" in the UI when not selected.
30
+ */
31
+ export declare const OPTIONAL_CREDENTIALS: Set<CredentialType>;
9
32
  /**
10
33
  * OAuth provider names - type-safe provider identifiers
11
34
  */
12
- export type OAuthProvider = 'google';
35
+ export type OAuthProvider = 'google' | 'followupboss' | 'notion';
36
+ /**
37
+ * Scope description mapping - maps OAuth scope URLs to human-readable descriptions
38
+ */
39
+ export interface ScopeDescription {
40
+ scope: string;
41
+ description: string;
42
+ defaultEnabled: boolean;
43
+ }
13
44
  /**
14
45
  * OAuth credential type configuration for a specific service under a provider
15
46
  */
@@ -17,6 +48,7 @@ export interface OAuthCredentialConfig {
17
48
  displayName: string;
18
49
  defaultScopes: string[];
19
50
  description: string;
51
+ scopeDescriptions?: ScopeDescription[];
20
52
  }
21
53
  /**
22
54
  * OAuth provider configuration shared between frontend and backend
@@ -41,6 +73,45 @@ export declare function getOAuthProvider(credentialType: CredentialType): OAuthP
41
73
  * Check if a credential type is OAuth-based
42
74
  */
43
75
  export declare function isOAuthCredential(credentialType: CredentialType): boolean;
76
+ /**
77
+ * Get scope descriptions for a specific credential type
78
+ * Returns an array of scope descriptions that will be requested during OAuth
79
+ */
80
+ export declare function getScopeDescriptions(credentialType: CredentialType): ScopeDescription[];
81
+ /**
82
+ * Browser session provider name - for BrowserBase-powered authentication
83
+ */
84
+ export type BrowserSessionProvider = 'browserbase';
85
+ /**
86
+ * Browser session credential type configuration
87
+ */
88
+ export interface BrowserSessionCredentialConfig {
89
+ displayName: string;
90
+ description: string;
91
+ targetUrl: string;
92
+ cookieDomain: string;
93
+ }
94
+ /**
95
+ * Browser session provider configuration
96
+ */
97
+ export interface BrowserSessionProviderConfig {
98
+ name: BrowserSessionProvider;
99
+ displayName: string;
100
+ credentialTypes: Partial<Record<CredentialType, BrowserSessionCredentialConfig>>;
101
+ }
102
+ /**
103
+ * Browser session provider configurations - for credentials that use BrowserBase
104
+ * browser sessions instead of OAuth or API keys
105
+ */
106
+ export declare const BROWSER_SESSION_PROVIDERS: Record<BrowserSessionProvider, BrowserSessionProviderConfig>;
107
+ /**
108
+ * Get the browser session provider for a specific credential type
109
+ */
110
+ export declare function getBrowserSessionProvider(credentialType: CredentialType): BrowserSessionProvider | null;
111
+ /**
112
+ * Check if a credential type uses browser session authentication (BrowserBase)
113
+ */
114
+ export declare function isBrowserSessionCredential(credentialType: CredentialType): boolean;
44
115
  /**
45
116
  * Maps bubble names to their accepted credential types
46
117
  */
@@ -111,8 +182,8 @@ export declare const createCredentialSchema: z.ZodObject<{
111
182
  tags?: string[] | undefined;
112
183
  }>>;
113
184
  }, "strip", z.ZodTypeAny, {
114
- value: string;
115
185
  credentialType: CredentialType;
186
+ value: string;
116
187
  name?: string | undefined;
117
188
  skipValidation?: boolean | undefined;
118
189
  credentialConfigurations?: Record<string, unknown> | undefined;
@@ -132,8 +203,8 @@ export declare const createCredentialSchema: z.ZodObject<{
132
203
  tags?: string[] | undefined;
133
204
  } | undefined;
134
205
  }, {
135
- value: string;
136
206
  credentialType: CredentialType;
207
+ value: string;
137
208
  name?: string | undefined;
138
209
  skipValidation?: boolean | undefined;
139
210
  credentialConfigurations?: Record<string, unknown> | undefined;
@@ -319,6 +390,20 @@ export declare const credentialResponseSchema: z.ZodObject<{
319
390
  oauthExpiresAt: z.ZodOptional<z.ZodString>;
320
391
  oauthScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
321
392
  oauthStatus: z.ZodOptional<z.ZodEnum<["active", "expired", "needs_refresh"]>>;
393
+ isBrowserSession: z.ZodOptional<z.ZodBoolean>;
394
+ browserbaseSessionData: z.ZodOptional<z.ZodObject<{
395
+ capturedAt: z.ZodString;
396
+ cookieCount: z.ZodNumber;
397
+ domain: z.ZodString;
398
+ }, "strip", z.ZodTypeAny, {
399
+ capturedAt: string;
400
+ cookieCount: number;
401
+ domain: string;
402
+ }, {
403
+ capturedAt: string;
404
+ cookieCount: number;
405
+ domain: string;
406
+ }>>;
322
407
  }, "strip", z.ZodTypeAny, {
323
408
  credentialType: string;
324
409
  id: number;
@@ -344,6 +429,12 @@ export declare const credentialResponseSchema: z.ZodObject<{
344
429
  oauthExpiresAt?: string | undefined;
345
430
  oauthScopes?: string[] | undefined;
346
431
  oauthStatus?: "active" | "expired" | "needs_refresh" | undefined;
432
+ isBrowserSession?: boolean | undefined;
433
+ browserbaseSessionData?: {
434
+ capturedAt: string;
435
+ cookieCount: number;
436
+ domain: string;
437
+ } | undefined;
347
438
  }, {
348
439
  credentialType: string;
349
440
  id: number;
@@ -369,6 +460,12 @@ export declare const credentialResponseSchema: z.ZodObject<{
369
460
  oauthExpiresAt?: string | undefined;
370
461
  oauthScopes?: string[] | undefined;
371
462
  oauthStatus?: "active" | "expired" | "needs_refresh" | undefined;
463
+ isBrowserSession?: boolean | undefined;
464
+ browserbaseSessionData?: {
465
+ capturedAt: string;
466
+ cookieCount: number;
467
+ domain: string;
468
+ } | undefined;
372
469
  }>;
373
470
  export declare const createCredentialResponseSchema: z.ZodObject<{
374
471
  id: z.ZodNumber;
@@ -397,9 +494,81 @@ export declare const successMessageResponseSchema: z.ZodObject<{
397
494
  }, {
398
495
  message: string;
399
496
  }>;
497
+ export declare const browserbaseSessionCreateRequestSchema: z.ZodObject<{
498
+ credentialType: z.ZodNativeEnum<typeof CredentialType>;
499
+ name: z.ZodOptional<z.ZodString>;
500
+ }, "strip", z.ZodTypeAny, {
501
+ credentialType: CredentialType;
502
+ name?: string | undefined;
503
+ }, {
504
+ credentialType: CredentialType;
505
+ name?: string | undefined;
506
+ }>;
507
+ export declare const browserbaseSessionCreateResponseSchema: z.ZodObject<{
508
+ sessionId: z.ZodString;
509
+ debugUrl: z.ZodString;
510
+ contextId: z.ZodString;
511
+ state: z.ZodString;
512
+ }, "strip", z.ZodTypeAny, {
513
+ sessionId: string;
514
+ debugUrl: string;
515
+ contextId: string;
516
+ state: string;
517
+ }, {
518
+ sessionId: string;
519
+ debugUrl: string;
520
+ contextId: string;
521
+ state: string;
522
+ }>;
523
+ export declare const browserbaseSessionCompleteRequestSchema: z.ZodObject<{
524
+ sessionId: z.ZodString;
525
+ state: z.ZodString;
526
+ name: z.ZodOptional<z.ZodString>;
527
+ }, "strip", z.ZodTypeAny, {
528
+ sessionId: string;
529
+ state: string;
530
+ name?: string | undefined;
531
+ }, {
532
+ sessionId: string;
533
+ state: string;
534
+ name?: string | undefined;
535
+ }>;
536
+ export declare const browserbaseSessionCompleteResponseSchema: z.ZodObject<{
537
+ id: z.ZodNumber;
538
+ message: z.ZodString;
539
+ }, "strip", z.ZodTypeAny, {
540
+ message: string;
541
+ id: number;
542
+ }, {
543
+ message: string;
544
+ id: number;
545
+ }>;
546
+ export declare const browserbaseSessionReopenRequestSchema: z.ZodObject<{
547
+ credentialId: z.ZodNumber;
548
+ }, "strip", z.ZodTypeAny, {
549
+ credentialId: number;
550
+ }, {
551
+ credentialId: number;
552
+ }>;
553
+ export declare const browserbaseSessionReopenResponseSchema: z.ZodObject<{
554
+ sessionId: z.ZodString;
555
+ debugUrl: z.ZodString;
556
+ }, "strip", z.ZodTypeAny, {
557
+ sessionId: string;
558
+ debugUrl: string;
559
+ }, {
560
+ sessionId: string;
561
+ debugUrl: string;
562
+ }>;
400
563
  export type CreateCredentialRequest = z.infer<typeof createCredentialSchema>;
401
564
  export type UpdateCredentialRequest = z.infer<typeof updateCredentialSchema>;
402
565
  export type CredentialResponse = z.infer<typeof credentialResponseSchema>;
403
566
  export type CreateCredentialResponse = z.infer<typeof createCredentialResponseSchema>;
404
567
  export type UpdateCredentialResponse = z.infer<typeof updateCredentialResponseSchema>;
568
+ export type BrowserbaseSessionCreateRequest = z.infer<typeof browserbaseSessionCreateRequestSchema>;
569
+ export type BrowserbaseSessionCreateResponse = z.infer<typeof browserbaseSessionCreateResponseSchema>;
570
+ export type BrowserbaseSessionCompleteRequest = z.infer<typeof browserbaseSessionCompleteRequestSchema>;
571
+ export type BrowserbaseSessionCompleteResponse = z.infer<typeof browserbaseSessionCompleteResponseSchema>;
572
+ export type BrowserbaseSessionReopenRequest = z.infer<typeof browserbaseSessionReopenRequestSchema>;
573
+ export type BrowserbaseSessionReopenResponse = z.infer<typeof browserbaseSessionReopenResponseSchema>;
405
574
  //# sourceMappingURL=credential-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credential-schema.d.ts","sourceRoot":"","sources":["../src/credential-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAGtC;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAiB7D,CAAC;AAEF,+BAA+B;AAC/B,eAAO,MAAM,kBAAkB,qBAa7B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;IACxE,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAmCtE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,cA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