@blinkdotnew/dev-sdk 2.3.0 → 2.3.2
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/index.d.mts +72 -11
- package/dist/index.d.ts +72 -11
- package/dist/index.js +62 -35
- package/dist/index.mjs +62 -36
- package/package.json +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -2244,6 +2244,13 @@ interface SandboxCreateOptions {
|
|
|
2244
2244
|
timeoutMs?: number;
|
|
2245
2245
|
/** Custom metadata for tracking */
|
|
2246
2246
|
metadata?: Record<string, string>;
|
|
2247
|
+
/**
|
|
2248
|
+
* Secret names to inject as environment variables.
|
|
2249
|
+
* Secrets are resolved server-side from project secrets vault.
|
|
2250
|
+
* Add secrets via Workspace > Secrets or request_secret tool.
|
|
2251
|
+
* @example ['ANTHROPIC_API_KEY', 'GITHUB_TOKEN']
|
|
2252
|
+
*/
|
|
2253
|
+
secrets?: string[];
|
|
2247
2254
|
}
|
|
2248
2255
|
interface SandboxConnectOptions {
|
|
2249
2256
|
/** Reset inactivity timeout in ms (default: 5 min) */
|
|
@@ -2306,6 +2313,23 @@ declare class BlinkSandboxImpl implements BlinkSandbox {
|
|
|
2306
2313
|
* Factory function and client class for the Blink SDK
|
|
2307
2314
|
*/
|
|
2308
2315
|
|
|
2316
|
+
/**
|
|
2317
|
+
* Get the default Blink client instance.
|
|
2318
|
+
* Returns the client created by createClient().
|
|
2319
|
+
*
|
|
2320
|
+
* @throws Error if createClient() hasn't been called yet
|
|
2321
|
+
* @returns The default BlinkClient instance
|
|
2322
|
+
*
|
|
2323
|
+
* @example
|
|
2324
|
+
* ```ts
|
|
2325
|
+
* // First, create client somewhere in your app
|
|
2326
|
+
* createClient({ projectId: '...', secretKey: '...' })
|
|
2327
|
+
*
|
|
2328
|
+
* // Later, get the default client
|
|
2329
|
+
* const client = getDefaultClient()
|
|
2330
|
+
* ```
|
|
2331
|
+
*/
|
|
2332
|
+
declare function getDefaultClient(): BlinkClientImpl;
|
|
2309
2333
|
interface BlinkClient {
|
|
2310
2334
|
auth: BlinkAuth;
|
|
2311
2335
|
db: BlinkDatabase;
|
|
@@ -2320,8 +2344,39 @@ interface BlinkClient {
|
|
|
2320
2344
|
rag: BlinkRAG;
|
|
2321
2345
|
sandbox: BlinkSandbox;
|
|
2322
2346
|
}
|
|
2347
|
+
declare class BlinkClientImpl implements BlinkClient {
|
|
2348
|
+
auth: BlinkAuth;
|
|
2349
|
+
db: BlinkDatabase;
|
|
2350
|
+
storage: BlinkStorage;
|
|
2351
|
+
ai: BlinkAI;
|
|
2352
|
+
data: BlinkData;
|
|
2353
|
+
realtime: BlinkRealtime;
|
|
2354
|
+
notifications: BlinkNotifications;
|
|
2355
|
+
analytics: BlinkAnalytics;
|
|
2356
|
+
connectors: BlinkConnectors;
|
|
2357
|
+
functions: BlinkFunctions;
|
|
2358
|
+
rag: BlinkRAG;
|
|
2359
|
+
sandbox: BlinkSandbox;
|
|
2360
|
+
/** @internal HTTP client for Agent auto-binding */
|
|
2361
|
+
_httpClient: HttpClient;
|
|
2362
|
+
constructor(config: BlinkClientConfig);
|
|
2363
|
+
}
|
|
2323
2364
|
/**
|
|
2324
|
-
* Create a new Blink client instance
|
|
2365
|
+
* Create a new Blink client instance.
|
|
2366
|
+
* This also sets the default client for Agent auto-binding.
|
|
2367
|
+
*
|
|
2368
|
+
* @example
|
|
2369
|
+
* ```ts
|
|
2370
|
+
* // Create client (call once in your app)
|
|
2371
|
+
* const blink = createClient({
|
|
2372
|
+
* projectId: 'my-project',
|
|
2373
|
+
* secretKey: 'sk_...',
|
|
2374
|
+
* })
|
|
2375
|
+
*
|
|
2376
|
+
* // Now Agent works without explicit binding
|
|
2377
|
+
* const agent = new Agent({ model: 'openai/gpt-4o' })
|
|
2378
|
+
* await agent.generate({ prompt: 'Hello!' })
|
|
2379
|
+
* ```
|
|
2325
2380
|
*/
|
|
2326
2381
|
declare function createClient(config: BlinkClientConfig): BlinkClient;
|
|
2327
2382
|
|
|
@@ -2620,6 +2675,8 @@ interface AgentResponse {
|
|
|
2620
2675
|
* - Create agent instance with config
|
|
2621
2676
|
* - Call agent.generate() for non-streaming
|
|
2622
2677
|
* - Call agent.stream() for streaming
|
|
2678
|
+
*
|
|
2679
|
+
* Auto-binds to default client when createClient() has been called.
|
|
2623
2680
|
*/
|
|
2624
2681
|
|
|
2625
2682
|
/**
|
|
@@ -2679,34 +2736,38 @@ interface StreamOptions {
|
|
|
2679
2736
|
* - `agent.generate({ prompt })` for non-streaming one-shot generation
|
|
2680
2737
|
* - `agent.stream({ prompt })` for streaming real-time generation
|
|
2681
2738
|
*
|
|
2739
|
+
* **Auto-binding:** After calling `createClient()`, agents automatically
|
|
2740
|
+
* bind to the default client. No need for `blink.ai.createAgent()`.
|
|
2741
|
+
*
|
|
2682
2742
|
* @example
|
|
2683
2743
|
* ```ts
|
|
2684
|
-
* import { Agent, webSearch
|
|
2744
|
+
* import { createClient, Agent, webSearch } from '@blinkdotnew/sdk'
|
|
2685
2745
|
*
|
|
2746
|
+
* // Initialize client once
|
|
2747
|
+
* createClient({ projectId: '...', secretKey: '...' })
|
|
2748
|
+
*
|
|
2749
|
+
* // Create agent - auto-binds to default client
|
|
2686
2750
|
* const weatherAgent = new Agent({
|
|
2687
2751
|
* model: 'anthropic/claude-sonnet-4-20250514',
|
|
2688
2752
|
* system: 'You are a helpful weather assistant.',
|
|
2689
|
-
* tools: [webSearch
|
|
2753
|
+
* tools: [webSearch],
|
|
2690
2754
|
* maxSteps: 10,
|
|
2691
2755
|
* })
|
|
2692
2756
|
*
|
|
2693
|
-
* //
|
|
2757
|
+
* // Works immediately - no binding needed!
|
|
2694
2758
|
* const result = await weatherAgent.generate({
|
|
2695
2759
|
* prompt: 'What is the weather in San Francisco?',
|
|
2696
2760
|
* })
|
|
2697
2761
|
* console.log(result.text)
|
|
2698
|
-
*
|
|
2699
|
-
* // Streaming
|
|
2700
|
-
* const stream = await weatherAgent.stream({
|
|
2701
|
-
* prompt: 'Tell me about weather patterns',
|
|
2702
|
-
* })
|
|
2703
2762
|
* ```
|
|
2704
2763
|
*/
|
|
2705
2764
|
declare class Agent {
|
|
2706
2765
|
private httpClient;
|
|
2707
2766
|
private readonly config;
|
|
2708
2767
|
/**
|
|
2709
|
-
* Create a new Agent instance
|
|
2768
|
+
* Create a new Agent instance.
|
|
2769
|
+
* Auto-binds to default client if createClient() was called.
|
|
2770
|
+
*
|
|
2710
2771
|
* @param options - Agent configuration options
|
|
2711
2772
|
*/
|
|
2712
2773
|
constructor(options: AgentOptions);
|
|
@@ -3661,4 +3722,4 @@ declare const mediaTools: readonly ["generate_image", "edit_image", "generate_vi
|
|
|
3661
3722
|
*/
|
|
3662
3723
|
declare function serializeTools(tools: string[]): string[];
|
|
3663
3724
|
|
|
3664
|
-
export { type AISearchOptions, Agent, type AgentBilling, type AgentConfig, type AgentNonStreamMessagesRequest, type AgentNonStreamPromptRequest, type AgentOptions, type AgentRequest, type AgentResponse, type AgentStep, type AgentStreamRequest, type TokenUsage as AgentTokenUsage, type AnalyticsEvent, AsyncStorageAdapter, type AuthState, type AuthStateChangeCallback, type AuthTokens, type BlinkAI, BlinkAIImpl, type BlinkAnalytics, BlinkAnalyticsImpl, type BlinkClient, type BlinkClientConfig, BlinkConnectorError, type BlinkConnectors, BlinkConnectorsImpl, type BlinkData, BlinkDataImpl, BlinkDatabase, type BlinkRAG, BlinkRAGImpl, type BlinkRealtime, BlinkRealtimeChannel, BlinkRealtimeError, BlinkRealtimeImpl, type BlinkSandbox, BlinkSandboxImpl, type BlinkStorage, BlinkStorageImpl, BlinkTable, type BlinkTokenType, type BlinkUser, type ClientTool, type ConnectorApiKeyRequest, type ConnectorApiKeyResponse, type ConnectorAuthMode, type ConnectorExecuteRequest, type ConnectorExecuteResponse, type ConnectorProvider, type ConnectorStatusResponse, type ContextPolicy, type CreateCollectionOptions, type CreateOptions, type DataExtraction, type FileObject, type FilterCondition, type GenerateOptions, type ImageGenerationRequest, type ImageGenerationResponse, type JSONSchema, type ListDocumentsOptions, type Message, NoOpStorageAdapter, type ObjectGenerationRequest, type ObjectGenerationResponse, type PresenceUser, type QueryOptions, type RAGAISearchResult, type RAGAISearchSource, type RAGCollection, type RAGDocument, type RAGSearchResponse, type RAGSearchResult, type RealtimeChannel, type RealtimeGetMessagesOptions, type RealtimeMessage, type RealtimePublishOptions, type RealtimeSubscribeOptions, SANDBOX_TEMPLATES, type Sandbox, type SandboxConnectOptions, SandboxConnectionError, type SandboxCreateOptions, type SandboxTemplate, type SearchOptions, type SearchRequest, type SearchResponse, type SpeechGenerationRequest, type SpeechGenerationResponse, type StopCondition, type StorageAdapter, type StorageUploadOptions, type StorageUploadResponse, type StreamOptions, type TableOperations, type TextGenerationRequest, type TextGenerationResponse, type TokenIntrospectionResult, type TokenUsage$1 as TokenUsage, type ToolCall, type ToolResult, type TranscriptionRequest, type TranscriptionResponse, type UIMessage, type UIMessagePart, type UpdateOptions, type UploadOptions, type UpsertOptions, type WaitForReadyOptions, type WebBrowserModule, WebStorageAdapter, type WebhookTool, coreTools, createClient, dbDelete, dbGet, dbInsert, dbList, dbTools, dbUpdate, editImage, fetchUrl, generateImage, generateVideo, getDefaultStorageAdapter, getHost, globFileSearch, grep, imageToVideo, isBrowser, isDeno, isNode, isReactNative, isServer, isWeb, listDir, mediaTools, platform, ragSearch, ragTools, readFile, runCode, runTerminalCmd, sandboxTools, searchReplace, serializeTools, stepCountIs, storageCopy, storageDelete, storageDownload, storageList, storageMove, storagePublicUrl, storageTools, storageUpload, webSearch, writeFile };
|
|
3725
|
+
export { type AISearchOptions, Agent, type AgentBilling, type AgentConfig, type AgentNonStreamMessagesRequest, type AgentNonStreamPromptRequest, type AgentOptions, type AgentRequest, type AgentResponse, type AgentStep, type AgentStreamRequest, type TokenUsage as AgentTokenUsage, type AnalyticsEvent, AsyncStorageAdapter, type AuthState, type AuthStateChangeCallback, type AuthTokens, type BlinkAI, BlinkAIImpl, type BlinkAnalytics, BlinkAnalyticsImpl, type BlinkClient, type BlinkClientConfig, BlinkConnectorError, type BlinkConnectors, BlinkConnectorsImpl, type BlinkData, BlinkDataImpl, BlinkDatabase, type BlinkRAG, BlinkRAGImpl, type BlinkRealtime, BlinkRealtimeChannel, BlinkRealtimeError, BlinkRealtimeImpl, type BlinkSandbox, BlinkSandboxImpl, type BlinkStorage, BlinkStorageImpl, BlinkTable, type BlinkTokenType, type BlinkUser, type ClientTool, type ConnectorApiKeyRequest, type ConnectorApiKeyResponse, type ConnectorAuthMode, type ConnectorExecuteRequest, type ConnectorExecuteResponse, type ConnectorProvider, type ConnectorStatusResponse, type ContextPolicy, type CreateCollectionOptions, type CreateOptions, type DataExtraction, type FileObject, type FilterCondition, type GenerateOptions, type ImageGenerationRequest, type ImageGenerationResponse, type JSONSchema, type ListDocumentsOptions, type Message, NoOpStorageAdapter, type ObjectGenerationRequest, type ObjectGenerationResponse, type PresenceUser, type QueryOptions, type RAGAISearchResult, type RAGAISearchSource, type RAGCollection, type RAGDocument, type RAGSearchResponse, type RAGSearchResult, type RealtimeChannel, type RealtimeGetMessagesOptions, type RealtimeMessage, type RealtimePublishOptions, type RealtimeSubscribeOptions, SANDBOX_TEMPLATES, type Sandbox, type SandboxConnectOptions, SandboxConnectionError, type SandboxCreateOptions, type SandboxTemplate, type SearchOptions, type SearchRequest, type SearchResponse, type SpeechGenerationRequest, type SpeechGenerationResponse, type StopCondition, type StorageAdapter, type StorageUploadOptions, type StorageUploadResponse, type StreamOptions, type TableOperations, type TextGenerationRequest, type TextGenerationResponse, type TokenIntrospectionResult, type TokenUsage$1 as TokenUsage, type ToolCall, type ToolResult, type TranscriptionRequest, type TranscriptionResponse, type UIMessage, type UIMessagePart, type UpdateOptions, type UploadOptions, type UpsertOptions, type WaitForReadyOptions, type WebBrowserModule, WebStorageAdapter, type WebhookTool, coreTools, createClient, dbDelete, dbGet, dbInsert, dbList, dbTools, dbUpdate, editImage, fetchUrl, generateImage, generateVideo, getDefaultClient, getDefaultStorageAdapter, getHost, globFileSearch, grep, imageToVideo, isBrowser, isDeno, isNode, isReactNative, isServer, isWeb, listDir, mediaTools, platform, ragSearch, ragTools, readFile, runCode, runTerminalCmd, sandboxTools, searchReplace, serializeTools, stepCountIs, storageCopy, storageDelete, storageDownload, storageList, storageMove, storagePublicUrl, storageTools, storageUpload, webSearch, writeFile };
|
package/dist/index.d.ts
CHANGED
|
@@ -2244,6 +2244,13 @@ interface SandboxCreateOptions {
|
|
|
2244
2244
|
timeoutMs?: number;
|
|
2245
2245
|
/** Custom metadata for tracking */
|
|
2246
2246
|
metadata?: Record<string, string>;
|
|
2247
|
+
/**
|
|
2248
|
+
* Secret names to inject as environment variables.
|
|
2249
|
+
* Secrets are resolved server-side from project secrets vault.
|
|
2250
|
+
* Add secrets via Workspace > Secrets or request_secret tool.
|
|
2251
|
+
* @example ['ANTHROPIC_API_KEY', 'GITHUB_TOKEN']
|
|
2252
|
+
*/
|
|
2253
|
+
secrets?: string[];
|
|
2247
2254
|
}
|
|
2248
2255
|
interface SandboxConnectOptions {
|
|
2249
2256
|
/** Reset inactivity timeout in ms (default: 5 min) */
|
|
@@ -2306,6 +2313,23 @@ declare class BlinkSandboxImpl implements BlinkSandbox {
|
|
|
2306
2313
|
* Factory function and client class for the Blink SDK
|
|
2307
2314
|
*/
|
|
2308
2315
|
|
|
2316
|
+
/**
|
|
2317
|
+
* Get the default Blink client instance.
|
|
2318
|
+
* Returns the client created by createClient().
|
|
2319
|
+
*
|
|
2320
|
+
* @throws Error if createClient() hasn't been called yet
|
|
2321
|
+
* @returns The default BlinkClient instance
|
|
2322
|
+
*
|
|
2323
|
+
* @example
|
|
2324
|
+
* ```ts
|
|
2325
|
+
* // First, create client somewhere in your app
|
|
2326
|
+
* createClient({ projectId: '...', secretKey: '...' })
|
|
2327
|
+
*
|
|
2328
|
+
* // Later, get the default client
|
|
2329
|
+
* const client = getDefaultClient()
|
|
2330
|
+
* ```
|
|
2331
|
+
*/
|
|
2332
|
+
declare function getDefaultClient(): BlinkClientImpl;
|
|
2309
2333
|
interface BlinkClient {
|
|
2310
2334
|
auth: BlinkAuth;
|
|
2311
2335
|
db: BlinkDatabase;
|
|
@@ -2320,8 +2344,39 @@ interface BlinkClient {
|
|
|
2320
2344
|
rag: BlinkRAG;
|
|
2321
2345
|
sandbox: BlinkSandbox;
|
|
2322
2346
|
}
|
|
2347
|
+
declare class BlinkClientImpl implements BlinkClient {
|
|
2348
|
+
auth: BlinkAuth;
|
|
2349
|
+
db: BlinkDatabase;
|
|
2350
|
+
storage: BlinkStorage;
|
|
2351
|
+
ai: BlinkAI;
|
|
2352
|
+
data: BlinkData;
|
|
2353
|
+
realtime: BlinkRealtime;
|
|
2354
|
+
notifications: BlinkNotifications;
|
|
2355
|
+
analytics: BlinkAnalytics;
|
|
2356
|
+
connectors: BlinkConnectors;
|
|
2357
|
+
functions: BlinkFunctions;
|
|
2358
|
+
rag: BlinkRAG;
|
|
2359
|
+
sandbox: BlinkSandbox;
|
|
2360
|
+
/** @internal HTTP client for Agent auto-binding */
|
|
2361
|
+
_httpClient: HttpClient;
|
|
2362
|
+
constructor(config: BlinkClientConfig);
|
|
2363
|
+
}
|
|
2323
2364
|
/**
|
|
2324
|
-
* Create a new Blink client instance
|
|
2365
|
+
* Create a new Blink client instance.
|
|
2366
|
+
* This also sets the default client for Agent auto-binding.
|
|
2367
|
+
*
|
|
2368
|
+
* @example
|
|
2369
|
+
* ```ts
|
|
2370
|
+
* // Create client (call once in your app)
|
|
2371
|
+
* const blink = createClient({
|
|
2372
|
+
* projectId: 'my-project',
|
|
2373
|
+
* secretKey: 'sk_...',
|
|
2374
|
+
* })
|
|
2375
|
+
*
|
|
2376
|
+
* // Now Agent works without explicit binding
|
|
2377
|
+
* const agent = new Agent({ model: 'openai/gpt-4o' })
|
|
2378
|
+
* await agent.generate({ prompt: 'Hello!' })
|
|
2379
|
+
* ```
|
|
2325
2380
|
*/
|
|
2326
2381
|
declare function createClient(config: BlinkClientConfig): BlinkClient;
|
|
2327
2382
|
|
|
@@ -2620,6 +2675,8 @@ interface AgentResponse {
|
|
|
2620
2675
|
* - Create agent instance with config
|
|
2621
2676
|
* - Call agent.generate() for non-streaming
|
|
2622
2677
|
* - Call agent.stream() for streaming
|
|
2678
|
+
*
|
|
2679
|
+
* Auto-binds to default client when createClient() has been called.
|
|
2623
2680
|
*/
|
|
2624
2681
|
|
|
2625
2682
|
/**
|
|
@@ -2679,34 +2736,38 @@ interface StreamOptions {
|
|
|
2679
2736
|
* - `agent.generate({ prompt })` for non-streaming one-shot generation
|
|
2680
2737
|
* - `agent.stream({ prompt })` for streaming real-time generation
|
|
2681
2738
|
*
|
|
2739
|
+
* **Auto-binding:** After calling `createClient()`, agents automatically
|
|
2740
|
+
* bind to the default client. No need for `blink.ai.createAgent()`.
|
|
2741
|
+
*
|
|
2682
2742
|
* @example
|
|
2683
2743
|
* ```ts
|
|
2684
|
-
* import { Agent, webSearch
|
|
2744
|
+
* import { createClient, Agent, webSearch } from '@blinkdotnew/sdk'
|
|
2685
2745
|
*
|
|
2746
|
+
* // Initialize client once
|
|
2747
|
+
* createClient({ projectId: '...', secretKey: '...' })
|
|
2748
|
+
*
|
|
2749
|
+
* // Create agent - auto-binds to default client
|
|
2686
2750
|
* const weatherAgent = new Agent({
|
|
2687
2751
|
* model: 'anthropic/claude-sonnet-4-20250514',
|
|
2688
2752
|
* system: 'You are a helpful weather assistant.',
|
|
2689
|
-
* tools: [webSearch
|
|
2753
|
+
* tools: [webSearch],
|
|
2690
2754
|
* maxSteps: 10,
|
|
2691
2755
|
* })
|
|
2692
2756
|
*
|
|
2693
|
-
* //
|
|
2757
|
+
* // Works immediately - no binding needed!
|
|
2694
2758
|
* const result = await weatherAgent.generate({
|
|
2695
2759
|
* prompt: 'What is the weather in San Francisco?',
|
|
2696
2760
|
* })
|
|
2697
2761
|
* console.log(result.text)
|
|
2698
|
-
*
|
|
2699
|
-
* // Streaming
|
|
2700
|
-
* const stream = await weatherAgent.stream({
|
|
2701
|
-
* prompt: 'Tell me about weather patterns',
|
|
2702
|
-
* })
|
|
2703
2762
|
* ```
|
|
2704
2763
|
*/
|
|
2705
2764
|
declare class Agent {
|
|
2706
2765
|
private httpClient;
|
|
2707
2766
|
private readonly config;
|
|
2708
2767
|
/**
|
|
2709
|
-
* Create a new Agent instance
|
|
2768
|
+
* Create a new Agent instance.
|
|
2769
|
+
* Auto-binds to default client if createClient() was called.
|
|
2770
|
+
*
|
|
2710
2771
|
* @param options - Agent configuration options
|
|
2711
2772
|
*/
|
|
2712
2773
|
constructor(options: AgentOptions);
|
|
@@ -3661,4 +3722,4 @@ declare const mediaTools: readonly ["generate_image", "edit_image", "generate_vi
|
|
|
3661
3722
|
*/
|
|
3662
3723
|
declare function serializeTools(tools: string[]): string[];
|
|
3663
3724
|
|
|
3664
|
-
export { type AISearchOptions, Agent, type AgentBilling, type AgentConfig, type AgentNonStreamMessagesRequest, type AgentNonStreamPromptRequest, type AgentOptions, type AgentRequest, type AgentResponse, type AgentStep, type AgentStreamRequest, type TokenUsage as AgentTokenUsage, type AnalyticsEvent, AsyncStorageAdapter, type AuthState, type AuthStateChangeCallback, type AuthTokens, type BlinkAI, BlinkAIImpl, type BlinkAnalytics, BlinkAnalyticsImpl, type BlinkClient, type BlinkClientConfig, BlinkConnectorError, type BlinkConnectors, BlinkConnectorsImpl, type BlinkData, BlinkDataImpl, BlinkDatabase, type BlinkRAG, BlinkRAGImpl, type BlinkRealtime, BlinkRealtimeChannel, BlinkRealtimeError, BlinkRealtimeImpl, type BlinkSandbox, BlinkSandboxImpl, type BlinkStorage, BlinkStorageImpl, BlinkTable, type BlinkTokenType, type BlinkUser, type ClientTool, type ConnectorApiKeyRequest, type ConnectorApiKeyResponse, type ConnectorAuthMode, type ConnectorExecuteRequest, type ConnectorExecuteResponse, type ConnectorProvider, type ConnectorStatusResponse, type ContextPolicy, type CreateCollectionOptions, type CreateOptions, type DataExtraction, type FileObject, type FilterCondition, type GenerateOptions, type ImageGenerationRequest, type ImageGenerationResponse, type JSONSchema, type ListDocumentsOptions, type Message, NoOpStorageAdapter, type ObjectGenerationRequest, type ObjectGenerationResponse, type PresenceUser, type QueryOptions, type RAGAISearchResult, type RAGAISearchSource, type RAGCollection, type RAGDocument, type RAGSearchResponse, type RAGSearchResult, type RealtimeChannel, type RealtimeGetMessagesOptions, type RealtimeMessage, type RealtimePublishOptions, type RealtimeSubscribeOptions, SANDBOX_TEMPLATES, type Sandbox, type SandboxConnectOptions, SandboxConnectionError, type SandboxCreateOptions, type SandboxTemplate, type SearchOptions, type SearchRequest, type SearchResponse, type SpeechGenerationRequest, type SpeechGenerationResponse, type StopCondition, type StorageAdapter, type StorageUploadOptions, type StorageUploadResponse, type StreamOptions, type TableOperations, type TextGenerationRequest, type TextGenerationResponse, type TokenIntrospectionResult, type TokenUsage$1 as TokenUsage, type ToolCall, type ToolResult, type TranscriptionRequest, type TranscriptionResponse, type UIMessage, type UIMessagePart, type UpdateOptions, type UploadOptions, type UpsertOptions, type WaitForReadyOptions, type WebBrowserModule, WebStorageAdapter, type WebhookTool, coreTools, createClient, dbDelete, dbGet, dbInsert, dbList, dbTools, dbUpdate, editImage, fetchUrl, generateImage, generateVideo, getDefaultStorageAdapter, getHost, globFileSearch, grep, imageToVideo, isBrowser, isDeno, isNode, isReactNative, isServer, isWeb, listDir, mediaTools, platform, ragSearch, ragTools, readFile, runCode, runTerminalCmd, sandboxTools, searchReplace, serializeTools, stepCountIs, storageCopy, storageDelete, storageDownload, storageList, storageMove, storagePublicUrl, storageTools, storageUpload, webSearch, writeFile };
|
|
3725
|
+
export { type AISearchOptions, Agent, type AgentBilling, type AgentConfig, type AgentNonStreamMessagesRequest, type AgentNonStreamPromptRequest, type AgentOptions, type AgentRequest, type AgentResponse, type AgentStep, type AgentStreamRequest, type TokenUsage as AgentTokenUsage, type AnalyticsEvent, AsyncStorageAdapter, type AuthState, type AuthStateChangeCallback, type AuthTokens, type BlinkAI, BlinkAIImpl, type BlinkAnalytics, BlinkAnalyticsImpl, type BlinkClient, type BlinkClientConfig, BlinkConnectorError, type BlinkConnectors, BlinkConnectorsImpl, type BlinkData, BlinkDataImpl, BlinkDatabase, type BlinkRAG, BlinkRAGImpl, type BlinkRealtime, BlinkRealtimeChannel, BlinkRealtimeError, BlinkRealtimeImpl, type BlinkSandbox, BlinkSandboxImpl, type BlinkStorage, BlinkStorageImpl, BlinkTable, type BlinkTokenType, type BlinkUser, type ClientTool, type ConnectorApiKeyRequest, type ConnectorApiKeyResponse, type ConnectorAuthMode, type ConnectorExecuteRequest, type ConnectorExecuteResponse, type ConnectorProvider, type ConnectorStatusResponse, type ContextPolicy, type CreateCollectionOptions, type CreateOptions, type DataExtraction, type FileObject, type FilterCondition, type GenerateOptions, type ImageGenerationRequest, type ImageGenerationResponse, type JSONSchema, type ListDocumentsOptions, type Message, NoOpStorageAdapter, type ObjectGenerationRequest, type ObjectGenerationResponse, type PresenceUser, type QueryOptions, type RAGAISearchResult, type RAGAISearchSource, type RAGCollection, type RAGDocument, type RAGSearchResponse, type RAGSearchResult, type RealtimeChannel, type RealtimeGetMessagesOptions, type RealtimeMessage, type RealtimePublishOptions, type RealtimeSubscribeOptions, SANDBOX_TEMPLATES, type Sandbox, type SandboxConnectOptions, SandboxConnectionError, type SandboxCreateOptions, type SandboxTemplate, type SearchOptions, type SearchRequest, type SearchResponse, type SpeechGenerationRequest, type SpeechGenerationResponse, type StopCondition, type StorageAdapter, type StorageUploadOptions, type StorageUploadResponse, type StreamOptions, type TableOperations, type TextGenerationRequest, type TextGenerationResponse, type TokenIntrospectionResult, type TokenUsage$1 as TokenUsage, type ToolCall, type ToolResult, type TranscriptionRequest, type TranscriptionResponse, type UIMessage, type UIMessagePart, type UpdateOptions, type UploadOptions, type UpsertOptions, type WaitForReadyOptions, type WebBrowserModule, WebStorageAdapter, type WebhookTool, coreTools, createClient, dbDelete, dbGet, dbInsert, dbList, dbTools, dbUpdate, editImage, fetchUrl, generateImage, generateVideo, getDefaultClient, getDefaultStorageAdapter, getHost, globFileSearch, grep, imageToVideo, isBrowser, isDeno, isNode, isReactNative, isServer, isWeb, listDir, mediaTools, platform, ragSearch, ragTools, readFile, runCode, runTerminalCmd, sandboxTools, searchReplace, serializeTools, stepCountIs, storageCopy, storageDelete, storageDownload, storageList, storageMove, storagePublicUrl, storageTools, storageUpload, webSearch, writeFile };
|
package/dist/index.js
CHANGED
|
@@ -4576,25 +4576,29 @@ var BlinkAuth = class {
|
|
|
4576
4576
|
}
|
|
4577
4577
|
const { sessionId, authUrl } = await this.initiateMobileOAuth(provider, options);
|
|
4578
4578
|
console.log("\u{1F510} Opening OAuth browser for", provider);
|
|
4579
|
-
const
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
throw new BlinkAuthError(
|
|
4592
|
-
"POPUP_CANCELED" /* POPUP_CANCELED */,
|
|
4593
|
-
"Authentication was canceled"
|
|
4594
|
-
);
|
|
4579
|
+
const browserPromise = webBrowser.openAuthSessionAsync(authUrl);
|
|
4580
|
+
const raceResult = await Promise.race([
|
|
4581
|
+
browserPromise.then((result) => ({ closed: true, result })).catch((err) => ({ closed: true, error: err })),
|
|
4582
|
+
new Promise(
|
|
4583
|
+
(resolve) => setTimeout(() => resolve({ closed: false }), 5e3)
|
|
4584
|
+
)
|
|
4585
|
+
]);
|
|
4586
|
+
if (raceResult.closed) {
|
|
4587
|
+
if ("result" in raceResult) {
|
|
4588
|
+
console.log("\u{1F510} Browser closed with result:", raceResult.result.type);
|
|
4589
|
+
} else {
|
|
4590
|
+
console.log("\u{1F510} Browser closed with error");
|
|
4595
4591
|
}
|
|
4596
|
-
|
|
4592
|
+
} else {
|
|
4593
|
+
console.log("\u{1F510} Browser still open (new tab/stuck popup), starting to poll...");
|
|
4597
4594
|
}
|
|
4595
|
+
const user = await this.pollMobileOAuthSession(sessionId, {
|
|
4596
|
+
maxAttempts: 120,
|
|
4597
|
+
// 60 seconds (give user time to complete auth)
|
|
4598
|
+
intervalMs: 500
|
|
4599
|
+
});
|
|
4600
|
+
console.log("\u2705 OAuth completed successfully");
|
|
4601
|
+
return user;
|
|
4598
4602
|
}
|
|
4599
4603
|
/**
|
|
4600
4604
|
* Generic provider sign-in method (headless mode)
|
|
@@ -6454,7 +6458,9 @@ var Agent = class {
|
|
|
6454
6458
|
httpClient = null;
|
|
6455
6459
|
config;
|
|
6456
6460
|
/**
|
|
6457
|
-
* Create a new Agent instance
|
|
6461
|
+
* Create a new Agent instance.
|
|
6462
|
+
* Auto-binds to default client if createClient() was called.
|
|
6463
|
+
*
|
|
6458
6464
|
* @param options - Agent configuration options
|
|
6459
6465
|
*/
|
|
6460
6466
|
constructor(options) {
|
|
@@ -6462,6 +6468,10 @@ var Agent = class {
|
|
|
6462
6468
|
throw new BlinkAIError("Agent model is required");
|
|
6463
6469
|
}
|
|
6464
6470
|
this.config = options;
|
|
6471
|
+
try {
|
|
6472
|
+
this.httpClient = _getDefaultHttpClient();
|
|
6473
|
+
} catch {
|
|
6474
|
+
}
|
|
6465
6475
|
}
|
|
6466
6476
|
/**
|
|
6467
6477
|
* Internal: Set the HTTP client (called by BlinkClient)
|
|
@@ -6504,7 +6514,7 @@ var Agent = class {
|
|
|
6504
6514
|
async generate(options) {
|
|
6505
6515
|
if (!this.httpClient) {
|
|
6506
6516
|
throw new BlinkAIError(
|
|
6507
|
-
"Agent not initialized.
|
|
6517
|
+
"Agent not initialized. Call createClient() first, or use useAgent() in React."
|
|
6508
6518
|
);
|
|
6509
6519
|
}
|
|
6510
6520
|
if (!options.prompt && !options.messages) {
|
|
@@ -6561,7 +6571,7 @@ var Agent = class {
|
|
|
6561
6571
|
async stream(options) {
|
|
6562
6572
|
if (!this.httpClient) {
|
|
6563
6573
|
throw new BlinkAIError(
|
|
6564
|
-
"Agent not initialized.
|
|
6574
|
+
"Agent not initialized. Call createClient() first, or use useAgent() in React."
|
|
6565
6575
|
);
|
|
6566
6576
|
}
|
|
6567
6577
|
if (!options.prompt && !options.messages) {
|
|
@@ -9173,7 +9183,8 @@ var BlinkSandboxImpl = class {
|
|
|
9173
9183
|
const body = {
|
|
9174
9184
|
template: options.template,
|
|
9175
9185
|
timeout_ms: options.timeoutMs,
|
|
9176
|
-
metadata: options.metadata
|
|
9186
|
+
metadata: options.metadata,
|
|
9187
|
+
secrets: options.secrets
|
|
9177
9188
|
};
|
|
9178
9189
|
const response = await this.httpClient.post(this.url("/create"), body);
|
|
9179
9190
|
const { id, template, host_pattern } = response.data;
|
|
@@ -9211,6 +9222,18 @@ var BlinkSandboxImpl = class {
|
|
|
9211
9222
|
};
|
|
9212
9223
|
|
|
9213
9224
|
// src/client.ts
|
|
9225
|
+
var defaultClient = null;
|
|
9226
|
+
function getDefaultClient() {
|
|
9227
|
+
if (!defaultClient) {
|
|
9228
|
+
throw new Error(
|
|
9229
|
+
"No Blink client initialized. Call createClient() first before using Agent or other SDK features."
|
|
9230
|
+
);
|
|
9231
|
+
}
|
|
9232
|
+
return defaultClient;
|
|
9233
|
+
}
|
|
9234
|
+
function _getDefaultHttpClient() {
|
|
9235
|
+
return getDefaultClient()._httpClient;
|
|
9236
|
+
}
|
|
9214
9237
|
var BlinkClientImpl = class {
|
|
9215
9238
|
auth;
|
|
9216
9239
|
db;
|
|
@@ -9224,32 +9247,33 @@ var BlinkClientImpl = class {
|
|
|
9224
9247
|
functions;
|
|
9225
9248
|
rag;
|
|
9226
9249
|
sandbox;
|
|
9227
|
-
|
|
9250
|
+
/** @internal HTTP client for Agent auto-binding */
|
|
9251
|
+
_httpClient;
|
|
9228
9252
|
constructor(config) {
|
|
9229
9253
|
if ((config.secretKey || config.serviceToken) && isBrowser) {
|
|
9230
9254
|
throw new Error("secretKey/serviceToken is server-only. Do not provide it in browser/React Native clients.");
|
|
9231
9255
|
}
|
|
9232
9256
|
this.auth = new BlinkAuth(config);
|
|
9233
|
-
this.
|
|
9257
|
+
this._httpClient = new HttpClient(
|
|
9234
9258
|
config,
|
|
9235
9259
|
() => this.auth.getToken(),
|
|
9236
9260
|
() => this.auth.getValidToken()
|
|
9237
9261
|
);
|
|
9238
|
-
this.db = new BlinkDatabase(this.
|
|
9239
|
-
this.storage = new BlinkStorageImpl(this.
|
|
9240
|
-
this.ai = new BlinkAIImpl(this.
|
|
9241
|
-
this.data = new BlinkDataImpl(this.
|
|
9242
|
-
this.realtime = new BlinkRealtimeImpl(this.
|
|
9243
|
-
this.notifications = new BlinkNotificationsImpl(this.
|
|
9244
|
-
this.analytics = new BlinkAnalyticsImpl(this.
|
|
9245
|
-
this.connectors = new BlinkConnectorsImpl(this.
|
|
9262
|
+
this.db = new BlinkDatabase(this._httpClient);
|
|
9263
|
+
this.storage = new BlinkStorageImpl(this._httpClient);
|
|
9264
|
+
this.ai = new BlinkAIImpl(this._httpClient);
|
|
9265
|
+
this.data = new BlinkDataImpl(this._httpClient, config.projectId);
|
|
9266
|
+
this.realtime = new BlinkRealtimeImpl(this._httpClient, config.projectId);
|
|
9267
|
+
this.notifications = new BlinkNotificationsImpl(this._httpClient);
|
|
9268
|
+
this.analytics = new BlinkAnalyticsImpl(this._httpClient, config.projectId);
|
|
9269
|
+
this.connectors = new BlinkConnectorsImpl(this._httpClient);
|
|
9246
9270
|
this.functions = new BlinkFunctionsImpl(
|
|
9247
|
-
this.
|
|
9271
|
+
this._httpClient,
|
|
9248
9272
|
config.projectId,
|
|
9249
9273
|
() => this.auth.getValidToken()
|
|
9250
9274
|
);
|
|
9251
|
-
this.rag = new BlinkRAGImpl(this.
|
|
9252
|
-
this.sandbox = new BlinkSandboxImpl(this.
|
|
9275
|
+
this.rag = new BlinkRAGImpl(this._httpClient);
|
|
9276
|
+
this.sandbox = new BlinkSandboxImpl(this._httpClient);
|
|
9253
9277
|
this.auth.onAuthStateChanged((state) => {
|
|
9254
9278
|
if (state.isAuthenticated && state.user) {
|
|
9255
9279
|
this.analytics.setUserId(state.user.id);
|
|
@@ -9265,7 +9289,9 @@ function createClient(config) {
|
|
|
9265
9289
|
if (!config.projectId) {
|
|
9266
9290
|
throw new Error("projectId is required");
|
|
9267
9291
|
}
|
|
9268
|
-
|
|
9292
|
+
const client = new BlinkClientImpl(config);
|
|
9293
|
+
defaultClient = client;
|
|
9294
|
+
return client;
|
|
9269
9295
|
}
|
|
9270
9296
|
|
|
9271
9297
|
exports.Agent = Agent;
|
|
@@ -9297,6 +9323,7 @@ exports.editImage = editImage;
|
|
|
9297
9323
|
exports.fetchUrl = fetchUrl;
|
|
9298
9324
|
exports.generateImage = generateImage;
|
|
9299
9325
|
exports.generateVideo = generateVideo;
|
|
9326
|
+
exports.getDefaultClient = getDefaultClient;
|
|
9300
9327
|
exports.getDefaultStorageAdapter = getDefaultStorageAdapter;
|
|
9301
9328
|
exports.getHost = getHost;
|
|
9302
9329
|
exports.globFileSearch = globFileSearch;
|
package/dist/index.mjs
CHANGED
|
@@ -4574,25 +4574,29 @@ var BlinkAuth = class {
|
|
|
4574
4574
|
}
|
|
4575
4575
|
const { sessionId, authUrl } = await this.initiateMobileOAuth(provider, options);
|
|
4576
4576
|
console.log("\u{1F510} Opening OAuth browser for", provider);
|
|
4577
|
-
const
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
throw new BlinkAuthError(
|
|
4590
|
-
"POPUP_CANCELED" /* POPUP_CANCELED */,
|
|
4591
|
-
"Authentication was canceled"
|
|
4592
|
-
);
|
|
4577
|
+
const browserPromise = webBrowser.openAuthSessionAsync(authUrl);
|
|
4578
|
+
const raceResult = await Promise.race([
|
|
4579
|
+
browserPromise.then((result) => ({ closed: true, result })).catch((err) => ({ closed: true, error: err })),
|
|
4580
|
+
new Promise(
|
|
4581
|
+
(resolve) => setTimeout(() => resolve({ closed: false }), 5e3)
|
|
4582
|
+
)
|
|
4583
|
+
]);
|
|
4584
|
+
if (raceResult.closed) {
|
|
4585
|
+
if ("result" in raceResult) {
|
|
4586
|
+
console.log("\u{1F510} Browser closed with result:", raceResult.result.type);
|
|
4587
|
+
} else {
|
|
4588
|
+
console.log("\u{1F510} Browser closed with error");
|
|
4593
4589
|
}
|
|
4594
|
-
|
|
4590
|
+
} else {
|
|
4591
|
+
console.log("\u{1F510} Browser still open (new tab/stuck popup), starting to poll...");
|
|
4595
4592
|
}
|
|
4593
|
+
const user = await this.pollMobileOAuthSession(sessionId, {
|
|
4594
|
+
maxAttempts: 120,
|
|
4595
|
+
// 60 seconds (give user time to complete auth)
|
|
4596
|
+
intervalMs: 500
|
|
4597
|
+
});
|
|
4598
|
+
console.log("\u2705 OAuth completed successfully");
|
|
4599
|
+
return user;
|
|
4596
4600
|
}
|
|
4597
4601
|
/**
|
|
4598
4602
|
* Generic provider sign-in method (headless mode)
|
|
@@ -6452,7 +6456,9 @@ var Agent = class {
|
|
|
6452
6456
|
httpClient = null;
|
|
6453
6457
|
config;
|
|
6454
6458
|
/**
|
|
6455
|
-
* Create a new Agent instance
|
|
6459
|
+
* Create a new Agent instance.
|
|
6460
|
+
* Auto-binds to default client if createClient() was called.
|
|
6461
|
+
*
|
|
6456
6462
|
* @param options - Agent configuration options
|
|
6457
6463
|
*/
|
|
6458
6464
|
constructor(options) {
|
|
@@ -6460,6 +6466,10 @@ var Agent = class {
|
|
|
6460
6466
|
throw new BlinkAIError("Agent model is required");
|
|
6461
6467
|
}
|
|
6462
6468
|
this.config = options;
|
|
6469
|
+
try {
|
|
6470
|
+
this.httpClient = _getDefaultHttpClient();
|
|
6471
|
+
} catch {
|
|
6472
|
+
}
|
|
6463
6473
|
}
|
|
6464
6474
|
/**
|
|
6465
6475
|
* Internal: Set the HTTP client (called by BlinkClient)
|
|
@@ -6502,7 +6512,7 @@ var Agent = class {
|
|
|
6502
6512
|
async generate(options) {
|
|
6503
6513
|
if (!this.httpClient) {
|
|
6504
6514
|
throw new BlinkAIError(
|
|
6505
|
-
"Agent not initialized.
|
|
6515
|
+
"Agent not initialized. Call createClient() first, or use useAgent() in React."
|
|
6506
6516
|
);
|
|
6507
6517
|
}
|
|
6508
6518
|
if (!options.prompt && !options.messages) {
|
|
@@ -6559,7 +6569,7 @@ var Agent = class {
|
|
|
6559
6569
|
async stream(options) {
|
|
6560
6570
|
if (!this.httpClient) {
|
|
6561
6571
|
throw new BlinkAIError(
|
|
6562
|
-
"Agent not initialized.
|
|
6572
|
+
"Agent not initialized. Call createClient() first, or use useAgent() in React."
|
|
6563
6573
|
);
|
|
6564
6574
|
}
|
|
6565
6575
|
if (!options.prompt && !options.messages) {
|
|
@@ -9171,7 +9181,8 @@ var BlinkSandboxImpl = class {
|
|
|
9171
9181
|
const body = {
|
|
9172
9182
|
template: options.template,
|
|
9173
9183
|
timeout_ms: options.timeoutMs,
|
|
9174
|
-
metadata: options.metadata
|
|
9184
|
+
metadata: options.metadata,
|
|
9185
|
+
secrets: options.secrets
|
|
9175
9186
|
};
|
|
9176
9187
|
const response = await this.httpClient.post(this.url("/create"), body);
|
|
9177
9188
|
const { id, template, host_pattern } = response.data;
|
|
@@ -9209,6 +9220,18 @@ var BlinkSandboxImpl = class {
|
|
|
9209
9220
|
};
|
|
9210
9221
|
|
|
9211
9222
|
// src/client.ts
|
|
9223
|
+
var defaultClient = null;
|
|
9224
|
+
function getDefaultClient() {
|
|
9225
|
+
if (!defaultClient) {
|
|
9226
|
+
throw new Error(
|
|
9227
|
+
"No Blink client initialized. Call createClient() first before using Agent or other SDK features."
|
|
9228
|
+
);
|
|
9229
|
+
}
|
|
9230
|
+
return defaultClient;
|
|
9231
|
+
}
|
|
9232
|
+
function _getDefaultHttpClient() {
|
|
9233
|
+
return getDefaultClient()._httpClient;
|
|
9234
|
+
}
|
|
9212
9235
|
var BlinkClientImpl = class {
|
|
9213
9236
|
auth;
|
|
9214
9237
|
db;
|
|
@@ -9222,32 +9245,33 @@ var BlinkClientImpl = class {
|
|
|
9222
9245
|
functions;
|
|
9223
9246
|
rag;
|
|
9224
9247
|
sandbox;
|
|
9225
|
-
|
|
9248
|
+
/** @internal HTTP client for Agent auto-binding */
|
|
9249
|
+
_httpClient;
|
|
9226
9250
|
constructor(config) {
|
|
9227
9251
|
if ((config.secretKey || config.serviceToken) && isBrowser) {
|
|
9228
9252
|
throw new Error("secretKey/serviceToken is server-only. Do not provide it in browser/React Native clients.");
|
|
9229
9253
|
}
|
|
9230
9254
|
this.auth = new BlinkAuth(config);
|
|
9231
|
-
this.
|
|
9255
|
+
this._httpClient = new HttpClient(
|
|
9232
9256
|
config,
|
|
9233
9257
|
() => this.auth.getToken(),
|
|
9234
9258
|
() => this.auth.getValidToken()
|
|
9235
9259
|
);
|
|
9236
|
-
this.db = new BlinkDatabase(this.
|
|
9237
|
-
this.storage = new BlinkStorageImpl(this.
|
|
9238
|
-
this.ai = new BlinkAIImpl(this.
|
|
9239
|
-
this.data = new BlinkDataImpl(this.
|
|
9240
|
-
this.realtime = new BlinkRealtimeImpl(this.
|
|
9241
|
-
this.notifications = new BlinkNotificationsImpl(this.
|
|
9242
|
-
this.analytics = new BlinkAnalyticsImpl(this.
|
|
9243
|
-
this.connectors = new BlinkConnectorsImpl(this.
|
|
9260
|
+
this.db = new BlinkDatabase(this._httpClient);
|
|
9261
|
+
this.storage = new BlinkStorageImpl(this._httpClient);
|
|
9262
|
+
this.ai = new BlinkAIImpl(this._httpClient);
|
|
9263
|
+
this.data = new BlinkDataImpl(this._httpClient, config.projectId);
|
|
9264
|
+
this.realtime = new BlinkRealtimeImpl(this._httpClient, config.projectId);
|
|
9265
|
+
this.notifications = new BlinkNotificationsImpl(this._httpClient);
|
|
9266
|
+
this.analytics = new BlinkAnalyticsImpl(this._httpClient, config.projectId);
|
|
9267
|
+
this.connectors = new BlinkConnectorsImpl(this._httpClient);
|
|
9244
9268
|
this.functions = new BlinkFunctionsImpl(
|
|
9245
|
-
this.
|
|
9269
|
+
this._httpClient,
|
|
9246
9270
|
config.projectId,
|
|
9247
9271
|
() => this.auth.getValidToken()
|
|
9248
9272
|
);
|
|
9249
|
-
this.rag = new BlinkRAGImpl(this.
|
|
9250
|
-
this.sandbox = new BlinkSandboxImpl(this.
|
|
9273
|
+
this.rag = new BlinkRAGImpl(this._httpClient);
|
|
9274
|
+
this.sandbox = new BlinkSandboxImpl(this._httpClient);
|
|
9251
9275
|
this.auth.onAuthStateChanged((state) => {
|
|
9252
9276
|
if (state.isAuthenticated && state.user) {
|
|
9253
9277
|
this.analytics.setUserId(state.user.id);
|
|
@@ -9263,9 +9287,11 @@ function createClient(config) {
|
|
|
9263
9287
|
if (!config.projectId) {
|
|
9264
9288
|
throw new Error("projectId is required");
|
|
9265
9289
|
}
|
|
9266
|
-
|
|
9290
|
+
const client = new BlinkClientImpl(config);
|
|
9291
|
+
defaultClient = client;
|
|
9292
|
+
return client;
|
|
9267
9293
|
}
|
|
9268
9294
|
|
|
9269
|
-
export { Agent, AsyncStorageAdapter, BlinkAIImpl, BlinkAnalyticsImpl, BlinkConnectorsImpl, BlinkDataImpl, BlinkDatabase, BlinkRAGImpl, BlinkRealtimeChannel, BlinkRealtimeImpl, BlinkSandboxImpl, BlinkStorageImpl, BlinkTable, NoOpStorageAdapter, SANDBOX_TEMPLATES, SandboxConnectionError, WebStorageAdapter, coreTools, createClient, dbDelete, dbGet, dbInsert, dbList, dbTools, dbUpdate, editImage, fetchUrl, generateImage, generateVideo, getDefaultStorageAdapter, getHost, globFileSearch, grep, imageToVideo, isBrowser, isDeno, isNode, isReactNative, isServer, isWeb, listDir, mediaTools, platform, ragSearch, ragTools, readFile, runCode, runTerminalCmd, sandboxTools, searchReplace, serializeTools, stepCountIs, storageCopy, storageDelete, storageDownload, storageList, storageMove, storagePublicUrl, storageTools, storageUpload, webSearch, writeFile };
|
|
9295
|
+
export { Agent, AsyncStorageAdapter, BlinkAIImpl, BlinkAnalyticsImpl, BlinkConnectorsImpl, BlinkDataImpl, BlinkDatabase, BlinkRAGImpl, BlinkRealtimeChannel, BlinkRealtimeImpl, BlinkSandboxImpl, BlinkStorageImpl, BlinkTable, NoOpStorageAdapter, SANDBOX_TEMPLATES, SandboxConnectionError, WebStorageAdapter, coreTools, createClient, dbDelete, dbGet, dbInsert, dbList, dbTools, dbUpdate, editImage, fetchUrl, generateImage, generateVideo, getDefaultClient, getDefaultStorageAdapter, getHost, globFileSearch, grep, imageToVideo, isBrowser, isDeno, isNode, isReactNative, isServer, isWeb, listDir, mediaTools, platform, ragSearch, ragTools, readFile, runCode, runTerminalCmd, sandboxTools, searchReplace, serializeTools, stepCountIs, storageCopy, storageDelete, storageDownload, storageList, storageMove, storagePublicUrl, storageTools, storageUpload, webSearch, writeFile };
|
|
9270
9296
|
//# sourceMappingURL=index.mjs.map
|
|
9271
9297
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blinkdotnew/dev-sdk",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Blink TypeScript SDK for client-side applications - Zero-boilerplate CRUD + auth + AI + analytics + notifications for modern SaaS/AI apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blink",
|
|
@@ -51,8 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {},
|
|
53
53
|
"devDependencies": {
|
|
54
|
+
"@blink/core": "0.4.1",
|
|
54
55
|
"tsup": "^8.0.0",
|
|
55
|
-
"typescript": "^5.0.0"
|
|
56
|
+
"typescript": "^5.0.0",
|
|
57
|
+
"@blinkdotnew/dev-sdk": "workspace:*"
|
|
56
58
|
},
|
|
57
59
|
"peerDependencies": {},
|
|
58
60
|
"publishConfig": {
|