@blinkdotnew/react 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { BlinkClient, Agent, UIMessage, AgentResponse } from '@blinkdotnew/sdk';
1
+ import { 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';
@@ -105,6 +105,17 @@ interface UseAgentOptions {
105
105
  agent: Agent;
106
106
  /** Initial messages */
107
107
  initialMessages?: UIMessage[];
108
+ /**
109
+ * Sandbox for sandbox tools (AI coding agents)
110
+ * Pass a Sandbox object or sandbox ID string
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * const sandbox = await blink.sandbox.create()
115
+ * const chat = useAgent({ agent: myAgent, sandbox })
116
+ * ```
117
+ */
118
+ sandbox?: Sandbox | string;
108
119
  /** Callback when response is received */
109
120
  onFinish?: (response: AgentResponse) => void;
110
121
  /** Callback on error */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BlinkClient, Agent, UIMessage, AgentResponse } from '@blinkdotnew/sdk';
1
+ import { 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';
@@ -105,6 +105,17 @@ interface UseAgentOptions {
105
105
  agent: Agent;
106
106
  /** Initial messages */
107
107
  initialMessages?: UIMessage[];
108
+ /**
109
+ * Sandbox for sandbox tools (AI coding agents)
110
+ * Pass a Sandbox object or sandbox ID string
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * const sandbox = await blink.sandbox.create()
115
+ * const chat = useAgent({ agent: myAgent, sandbox })
116
+ * ```
117
+ */
118
+ sandbox?: Sandbox | string;
108
119
  /** Callback when response is received */
109
120
  onFinish?: (response: AgentResponse) => void;
110
121
  /** Callback on error */
package/dist/index.js CHANGED
@@ -154,7 +154,7 @@ function useBlinkAuth() {
154
154
  var import_react2 = require("react");
155
155
  function useAgent(options) {
156
156
  const client = useBlinkClient();
157
- const { agent: agentInput, initialMessages = [], onFinish, onError } = options;
157
+ const { agent: agentInput, initialMessages = [], sandbox, onFinish, onError } = options;
158
158
  const [messages, setMessages] = (0, import_react2.useState)(initialMessages);
159
159
  const [input, setInput] = (0, import_react2.useState)("");
160
160
  const [isLoading, setIsLoading] = (0, import_react2.useState)(false);
@@ -291,6 +291,7 @@ function useAgent(options) {
291
291
  setMessages([...newMessages, assistantMessage]);
292
292
  const response = await agent.stream({
293
293
  messages: newMessages,
294
+ sandbox,
294
295
  signal: abortControllerRef.current.signal
295
296
  });
296
297
  const { text, finishData } = await parseStream(response, assistantMessageId);
@@ -319,7 +320,7 @@ function useAgent(options) {
319
320
  abortControllerRef.current = null;
320
321
  }
321
322
  },
322
- [agent, agentModel, messages, input, generateId, parseStream, onFinish, onError]
323
+ [agent, agentModel, messages, input, sandbox, generateId, parseStream, onFinish, onError]
323
324
  );
324
325
  const append = (0, import_react2.useCallback)((message) => {
325
326
  setMessages((prev) => [...prev, { ...message, id: message.id || generateId() }]);
package/dist/index.mjs CHANGED
@@ -114,7 +114,7 @@ function useBlinkAuth() {
114
114
  import { useCallback, useRef, useState, useMemo as useMemo2 } from "react";
115
115
  function useAgent(options) {
116
116
  const client = useBlinkClient();
117
- const { agent: agentInput, initialMessages = [], onFinish, onError } = options;
117
+ const { agent: agentInput, initialMessages = [], sandbox, onFinish, onError } = options;
118
118
  const [messages, setMessages] = useState(initialMessages);
119
119
  const [input, setInput] = useState("");
120
120
  const [isLoading, setIsLoading] = useState(false);
@@ -251,6 +251,7 @@ function useAgent(options) {
251
251
  setMessages([...newMessages, assistantMessage]);
252
252
  const response = await agent.stream({
253
253
  messages: newMessages,
254
+ sandbox,
254
255
  signal: abortControllerRef.current.signal
255
256
  });
256
257
  const { text, finishData } = await parseStream(response, assistantMessageId);
@@ -279,7 +280,7 @@ function useAgent(options) {
279
280
  abortControllerRef.current = null;
280
281
  }
281
282
  },
282
- [agent, agentModel, messages, input, generateId, parseStream, onFinish, onError]
283
+ [agent, agentModel, messages, input, sandbox, generateId, parseStream, onFinish, onError]
283
284
  );
284
285
  const append = useCallback((message) => {
285
286
  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.1",
4
4
  "description": "Blink SDK for React - AI agents, database, storage, and auth for modern SaaS/AI apps",
5
5
  "keywords": [
6
6
  "blink",