@blinkdotnew/react 1.0.0 → 1.0.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 CHANGED
@@ -1,4 +1,4 @@
1
- import { BlinkClient, Agent, UIMessage, AgentResponse } from '@blinkdotnew/sdk';
1
+ import { BlinkClientConfig, BlinkClient, Agent, UIMessage, Sandbox, AgentResponse } from '@blinkdotnew/sdk';
2
2
  export * from '@blinkdotnew/sdk';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode } from 'react';
@@ -14,6 +14,8 @@ interface BlinkProviderProps {
14
14
  publishableKey?: string;
15
15
  /** Secret key for server-side usage (do not expose in browser!) */
16
16
  secretKey?: string;
17
+ /** Auth configuration (mode, coreUrl, etc.) */
18
+ auth?: BlinkClientConfig['auth'];
17
19
  /** Children components */
18
20
  children: ReactNode;
19
21
  }
@@ -36,7 +38,7 @@ interface BlinkProviderProps {
36
38
  * }
37
39
  * ```
38
40
  */
39
- declare function BlinkProvider({ projectId, publishableKey, secretKey, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
41
+ declare function BlinkProvider({ projectId, publishableKey, secretKey, auth, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
40
42
  /**
41
43
  * Get the Blink client from context
42
44
  *
@@ -105,6 +107,17 @@ interface UseAgentOptions {
105
107
  agent: Agent;
106
108
  /** Initial messages */
107
109
  initialMessages?: UIMessage[];
110
+ /**
111
+ * Sandbox for sandbox tools (AI coding agents)
112
+ * Pass a Sandbox object or sandbox ID string
113
+ *
114
+ * @example
115
+ * ```tsx
116
+ * const sandbox = await blink.sandbox.create()
117
+ * const chat = useAgent({ agent: myAgent, sandbox })
118
+ * ```
119
+ */
120
+ sandbox?: Sandbox | string;
108
121
  /** Callback when response is received */
109
122
  onFinish?: (response: AgentResponse) => void;
110
123
  /** Callback on error */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BlinkClient, Agent, UIMessage, AgentResponse } from '@blinkdotnew/sdk';
1
+ import { BlinkClientConfig, BlinkClient, Agent, UIMessage, Sandbox, AgentResponse } from '@blinkdotnew/sdk';
2
2
  export * from '@blinkdotnew/sdk';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode } from 'react';
@@ -14,6 +14,8 @@ interface BlinkProviderProps {
14
14
  publishableKey?: string;
15
15
  /** Secret key for server-side usage (do not expose in browser!) */
16
16
  secretKey?: string;
17
+ /** Auth configuration (mode, coreUrl, etc.) */
18
+ auth?: BlinkClientConfig['auth'];
17
19
  /** Children components */
18
20
  children: ReactNode;
19
21
  }
@@ -36,7 +38,7 @@ interface BlinkProviderProps {
36
38
  * }
37
39
  * ```
38
40
  */
39
- declare function BlinkProvider({ projectId, publishableKey, secretKey, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
41
+ declare function BlinkProvider({ projectId, publishableKey, secretKey, auth, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
40
42
  /**
41
43
  * Get the Blink client from context
42
44
  *
@@ -105,6 +107,17 @@ interface UseAgentOptions {
105
107
  agent: Agent;
106
108
  /** Initial messages */
107
109
  initialMessages?: UIMessage[];
110
+ /**
111
+ * Sandbox for sandbox tools (AI coding agents)
112
+ * Pass a Sandbox object or sandbox ID string
113
+ *
114
+ * @example
115
+ * ```tsx
116
+ * const sandbox = await blink.sandbox.create()
117
+ * const chat = useAgent({ agent: myAgent, sandbox })
118
+ * ```
119
+ */
120
+ sandbox?: Sandbox | string;
108
121
  /** Callback when response is received */
109
122
  onFinish?: (response: AgentResponse) => void;
110
123
  /** Callback on error */
package/dist/index.js CHANGED
@@ -50,15 +50,17 @@ function BlinkProvider({
50
50
  projectId,
51
51
  publishableKey,
52
52
  secretKey,
53
+ auth,
53
54
  children
54
55
  }) {
55
56
  const client = (0, import_react.useMemo)(
56
57
  () => (0, import_sdk.createClient)({
57
58
  projectId,
58
59
  publishableKey,
59
- secretKey
60
+ secretKey,
61
+ auth
60
62
  }),
61
- [projectId, publishableKey, secretKey]
63
+ [projectId, publishableKey, secretKey, auth]
62
64
  );
63
65
  const value = (0, import_react.useMemo)(
64
66
  () => ({
@@ -154,7 +156,7 @@ function useBlinkAuth() {
154
156
  var import_react2 = require("react");
155
157
  function useAgent(options) {
156
158
  const client = useBlinkClient();
157
- const { agent: agentInput, initialMessages = [], onFinish, onError } = options;
159
+ const { agent: agentInput, initialMessages = [], sandbox, onFinish, onError } = options;
158
160
  const [messages, setMessages] = (0, import_react2.useState)(initialMessages);
159
161
  const [input, setInput] = (0, import_react2.useState)("");
160
162
  const [isLoading, setIsLoading] = (0, import_react2.useState)(false);
@@ -291,6 +293,7 @@ function useAgent(options) {
291
293
  setMessages([...newMessages, assistantMessage]);
292
294
  const response = await agent.stream({
293
295
  messages: newMessages,
296
+ sandbox,
294
297
  signal: abortControllerRef.current.signal
295
298
  });
296
299
  const { text, finishData } = await parseStream(response, assistantMessageId);
@@ -319,7 +322,7 @@ function useAgent(options) {
319
322
  abortControllerRef.current = null;
320
323
  }
321
324
  },
322
- [agent, agentModel, messages, input, generateId, parseStream, onFinish, onError]
325
+ [agent, agentModel, messages, input, sandbox, generateId, parseStream, onFinish, onError]
323
326
  );
324
327
  const append = (0, import_react2.useCallback)((message) => {
325
328
  setMessages((prev) => [...prev, { ...message, id: message.id || generateId() }]);
package/dist/index.mjs CHANGED
@@ -10,15 +10,17 @@ function BlinkProvider({
10
10
  projectId,
11
11
  publishableKey,
12
12
  secretKey,
13
+ auth,
13
14
  children
14
15
  }) {
15
16
  const client = useMemo(
16
17
  () => createClient({
17
18
  projectId,
18
19
  publishableKey,
19
- secretKey
20
+ secretKey,
21
+ auth
20
22
  }),
21
- [projectId, publishableKey, secretKey]
23
+ [projectId, publishableKey, secretKey, auth]
22
24
  );
23
25
  const value = useMemo(
24
26
  () => ({
@@ -114,7 +116,7 @@ function useBlinkAuth() {
114
116
  import { useCallback, useRef, useState, useMemo as useMemo2 } from "react";
115
117
  function useAgent(options) {
116
118
  const client = useBlinkClient();
117
- const { agent: agentInput, initialMessages = [], onFinish, onError } = options;
119
+ const { agent: agentInput, initialMessages = [], sandbox, onFinish, onError } = options;
118
120
  const [messages, setMessages] = useState(initialMessages);
119
121
  const [input, setInput] = useState("");
120
122
  const [isLoading, setIsLoading] = useState(false);
@@ -251,6 +253,7 @@ function useAgent(options) {
251
253
  setMessages([...newMessages, assistantMessage]);
252
254
  const response = await agent.stream({
253
255
  messages: newMessages,
256
+ sandbox,
254
257
  signal: abortControllerRef.current.signal
255
258
  });
256
259
  const { text, finishData } = await parseStream(response, assistantMessageId);
@@ -279,7 +282,7 @@ function useAgent(options) {
279
282
  abortControllerRef.current = null;
280
283
  }
281
284
  },
282
- [agent, agentModel, messages, input, generateId, parseStream, onFinish, onError]
285
+ [agent, agentModel, messages, input, sandbox, generateId, parseStream, onFinish, onError]
283
286
  );
284
287
  const append = useCallback((message) => {
285
288
  setMessages((prev) => [...prev, { ...message, id: message.id || generateId() }]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/react",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Blink SDK for React - AI agents, database, storage, and auth for modern SaaS/AI apps",
5
5
  "keywords": [
6
6
  "blink",