@react-grab/opencode 0.0.97 → 0.1.0-beta.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/client.cjs CHANGED
@@ -1,230 +1,416 @@
1
1
  'use strict';
2
2
 
3
- // ../utils/dist/client.js
4
- var CONNECTION_CHECK_TTL_MS = 5e3;
5
- var STORAGE_KEY = "react-grab:agent-sessions";
6
- var parseSSEEvent = (eventBlock) => {
7
- let eventType = "";
8
- let data = "";
9
- for (const line of eventBlock.split("\n")) {
10
- if (line.startsWith("event:")) eventType = line.slice(6).trim();
11
- else if (line.startsWith("data:")) data = line.slice(5).trim();
12
- }
13
- return { eventType, data };
14
- };
15
- var streamSSE = async function* (stream, signal) {
16
- const reader = stream.getReader();
17
- const decoder = new TextDecoder();
18
- let buffer = "";
19
- let aborted = false;
20
- const onAbort = () => {
21
- aborted = true;
22
- reader.cancel().catch(() => {
23
- });
3
+ // ../relay/dist/client.js
4
+ var DEFAULT_RELAY_PORT = 4722;
5
+ var DEFAULT_RECONNECT_INTERVAL_MS = 3e3;
6
+ var RELAY_TOKEN_PARAM = "token";
7
+ var createRelayClient = (options = {}) => {
8
+ const serverUrl = options.serverUrl ?? `ws://localhost:${DEFAULT_RELAY_PORT}`;
9
+ const autoReconnect = options.autoReconnect ?? true;
10
+ const reconnectIntervalMs = options.reconnectIntervalMs ?? DEFAULT_RECONNECT_INTERVAL_MS;
11
+ const token = options.token;
12
+ let webSocketConnection = null;
13
+ let isConnectedState = false;
14
+ let availableHandlers = [];
15
+ let reconnectTimeoutId = null;
16
+ let pendingConnectionPromise = null;
17
+ let pendingConnectionReject = null;
18
+ let isIntentionalDisconnect = false;
19
+ const messageCallbacks = /* @__PURE__ */ new Set();
20
+ const handlersChangeCallbacks = /* @__PURE__ */ new Set();
21
+ const connectionChangeCallbacks = /* @__PURE__ */ new Set();
22
+ const scheduleReconnect = () => {
23
+ if (!autoReconnect || reconnectTimeoutId || isIntentionalDisconnect) return;
24
+ reconnectTimeoutId = setTimeout(() => {
25
+ reconnectTimeoutId = null;
26
+ connect().catch(() => {
27
+ });
28
+ }, reconnectIntervalMs);
24
29
  };
25
- signal.addEventListener("abort", onAbort);
26
- try {
27
- if (signal.aborted) {
28
- throw new DOMException("Aborted", "AbortError");
29
- }
30
- while (true) {
31
- const result = await reader.read();
32
- if (aborted || signal.aborted) {
33
- throw new DOMException("Aborted", "AbortError");
30
+ const handleMessage = (event) => {
31
+ try {
32
+ const message = JSON.parse(event.data);
33
+ if (message.type === "handlers" && message.handlers) {
34
+ availableHandlers = message.handlers;
35
+ for (const callback of handlersChangeCallbacks) {
36
+ callback(availableHandlers);
37
+ }
34
38
  }
35
- const { done, value } = result;
36
- if (value) buffer += decoder.decode(value, { stream: true });
37
- let boundary;
38
- while ((boundary = buffer.indexOf("\n\n")) !== -1) {
39
- const { eventType, data } = parseSSEEvent(buffer.slice(0, boundary));
40
- buffer = buffer.slice(boundary + 2);
41
- if (eventType === "done") return;
42
- if (eventType === "error") throw new Error(data || "Agent error");
43
- if (data) yield data;
39
+ for (const callback of messageCallbacks) {
40
+ callback(message);
44
41
  }
45
- if (done) break;
46
- }
47
- } finally {
48
- signal.removeEventListener("abort", onAbort);
49
- try {
50
- reader.releaseLock();
51
42
  } catch {
52
43
  }
53
- }
54
- };
55
- var isRecord = (value) => typeof value === "object" && value !== null;
56
- var getStoredAgentContext = (storage, sessionId, storageKey = STORAGE_KEY) => {
57
- const rawSessions = storage.getItem(storageKey);
58
- if (!rawSessions) throw new Error("No sessions to resume");
59
- let parsed;
60
- try {
61
- parsed = JSON.parse(rawSessions);
62
- } catch {
63
- throw new Error("Failed to parse stored sessions");
64
- }
65
- if (!isRecord(parsed)) throw new Error("Invalid stored sessions");
66
- const storedSession = parsed[sessionId];
67
- if (!isRecord(storedSession)) {
68
- throw new Error(`Session ${sessionId} not found`);
69
- }
70
- const context = storedSession.context;
71
- if (!isRecord(context)) throw new Error(`Session ${sessionId} is invalid`);
72
- const content = context.content;
73
- const prompt = context.prompt;
74
- if (!Array.isArray(content) || typeof prompt !== "string") {
75
- throw new Error(`Session ${sessionId} is invalid`);
76
- }
77
- const options = context.options;
78
- const storedSessionId = context.sessionId;
44
+ };
45
+ const connect = () => {
46
+ if (webSocketConnection?.readyState === WebSocket.OPEN) {
47
+ return Promise.resolve();
48
+ }
49
+ if (pendingConnectionPromise) {
50
+ return pendingConnectionPromise;
51
+ }
52
+ isIntentionalDisconnect = false;
53
+ pendingConnectionPromise = new Promise((resolve, reject) => {
54
+ pendingConnectionReject = reject;
55
+ const connectionUrl = token ? `${serverUrl}?${RELAY_TOKEN_PARAM}=${encodeURIComponent(token)}` : serverUrl;
56
+ webSocketConnection = new WebSocket(connectionUrl);
57
+ webSocketConnection.onopen = () => {
58
+ pendingConnectionPromise = null;
59
+ pendingConnectionReject = null;
60
+ isConnectedState = true;
61
+ for (const callback of connectionChangeCallbacks) {
62
+ callback(true);
63
+ }
64
+ resolve();
65
+ };
66
+ webSocketConnection.onmessage = handleMessage;
67
+ webSocketConnection.onclose = () => {
68
+ if (pendingConnectionReject) {
69
+ pendingConnectionReject(new Error("WebSocket connection closed"));
70
+ pendingConnectionReject = null;
71
+ }
72
+ pendingConnectionPromise = null;
73
+ isConnectedState = false;
74
+ availableHandlers = [];
75
+ for (const callback of handlersChangeCallbacks) {
76
+ callback(availableHandlers);
77
+ }
78
+ for (const callback of connectionChangeCallbacks) {
79
+ callback(false);
80
+ }
81
+ scheduleReconnect();
82
+ };
83
+ webSocketConnection.onerror = () => {
84
+ pendingConnectionPromise = null;
85
+ pendingConnectionReject = null;
86
+ isConnectedState = false;
87
+ reject(new Error("WebSocket connection failed"));
88
+ };
89
+ });
90
+ return pendingConnectionPromise;
91
+ };
92
+ const disconnect = () => {
93
+ isIntentionalDisconnect = true;
94
+ if (reconnectTimeoutId) {
95
+ clearTimeout(reconnectTimeoutId);
96
+ reconnectTimeoutId = null;
97
+ }
98
+ if (pendingConnectionReject) {
99
+ pendingConnectionReject(new Error("Connection aborted"));
100
+ pendingConnectionReject = null;
101
+ }
102
+ pendingConnectionPromise = null;
103
+ webSocketConnection?.close();
104
+ webSocketConnection = null;
105
+ isConnectedState = false;
106
+ availableHandlers = [];
107
+ };
108
+ const isConnected = () => isConnectedState;
109
+ const sendMessage = (message) => {
110
+ if (webSocketConnection?.readyState === WebSocket.OPEN) {
111
+ webSocketConnection.send(JSON.stringify(message));
112
+ return true;
113
+ }
114
+ return false;
115
+ };
116
+ const sendAgentRequest = (agentId, context) => {
117
+ return sendMessage({
118
+ type: "agent-request",
119
+ agentId,
120
+ sessionId: context.sessionId,
121
+ context
122
+ });
123
+ };
124
+ const abortAgent = (agentId, sessionId) => {
125
+ sendMessage({
126
+ type: "agent-abort",
127
+ agentId,
128
+ sessionId
129
+ });
130
+ };
131
+ const undoAgent = (agentId, sessionId) => {
132
+ return sendMessage({
133
+ type: "agent-undo",
134
+ agentId,
135
+ sessionId
136
+ });
137
+ };
138
+ const redoAgent = (agentId, sessionId) => {
139
+ return sendMessage({
140
+ type: "agent-redo",
141
+ agentId,
142
+ sessionId
143
+ });
144
+ };
145
+ const onMessage = (callback) => {
146
+ messageCallbacks.add(callback);
147
+ return () => messageCallbacks.delete(callback);
148
+ };
149
+ const onHandlersChange = (callback) => {
150
+ handlersChangeCallbacks.add(callback);
151
+ return () => handlersChangeCallbacks.delete(callback);
152
+ };
153
+ const onConnectionChange = (callback) => {
154
+ connectionChangeCallbacks.add(callback);
155
+ queueMicrotask(() => {
156
+ if (connectionChangeCallbacks.has(callback)) {
157
+ callback(isConnectedState);
158
+ }
159
+ });
160
+ return () => connectionChangeCallbacks.delete(callback);
161
+ };
162
+ const getAvailableHandlers = () => availableHandlers;
79
163
  return {
80
- content,
81
- prompt,
82
- options,
83
- sessionId: typeof storedSessionId === "string" ? storedSessionId : void 0
164
+ connect,
165
+ disconnect,
166
+ isConnected,
167
+ sendAgentRequest,
168
+ abortAgent,
169
+ undoAgent,
170
+ redoAgent,
171
+ onMessage,
172
+ onHandlersChange,
173
+ onConnectionChange,
174
+ getAvailableHandlers
84
175
  };
85
176
  };
86
- var streamAgentStatusFromServer = async function* (options, context, signal) {
87
- const startTime = Date.now();
88
- const sessionId = context.sessionId;
89
- const pollIntervalMs = options.pollIntervalMs ?? 100;
90
- const agentUrl = `${options.serverUrl}${options.agentPath ?? "/agent"}`;
91
- const handleAbort = () => {
92
- if (!sessionId) return;
93
- const abortPath = options.abortPath?.(sessionId) ?? `/abort/${sessionId}`;
94
- fetch(`${options.serverUrl}${abortPath}`, { method: "POST" }).catch(
95
- () => {
177
+ var createRelayAgentProvider = (options) => {
178
+ const { relayClient, agentId } = options;
179
+ const checkConnection = async () => {
180
+ if (!relayClient.isConnected()) {
181
+ try {
182
+ await relayClient.connect();
183
+ } catch {
184
+ return false;
96
185
  }
97
- );
98
- };
99
- signal.addEventListener("abort", handleAbort);
100
- try {
101
- const response = await fetch(agentUrl, {
102
- method: "POST",
103
- headers: { "Content-Type": "application/json" },
104
- body: JSON.stringify(context),
105
- signal
106
- });
107
- if (!response.ok) {
108
- throw new Error(`Server error: ${response.status}`);
109
186
  }
110
- if (!response.body) {
111
- throw new Error("No response body");
187
+ return relayClient.getAvailableHandlers().includes(agentId);
188
+ };
189
+ const send = async function* (context, signal) {
190
+ if (signal.aborted) {
191
+ throw new DOMException("Aborted", "AbortError");
112
192
  }
113
- const iterator = streamSSE(response.body, signal)[Symbol.asyncIterator]();
193
+ yield "Connecting\u2026";
194
+ const sessionId = context.sessionId ?? `session-${Date.now()}-${Math.random().toString(36).slice(2)}`;
195
+ const contextWithSession = {
196
+ ...context,
197
+ sessionId
198
+ };
199
+ const messageQueue = [];
200
+ let resolveNextMessage = null;
201
+ let rejectNextMessage = null;
114
202
  let isDone = false;
115
- let pendingNext = iterator.next();
116
- let lastStatus = null;
117
- while (!isDone) {
118
- const result = await Promise.race([
119
- pendingNext.then((iteratorResult) => ({
120
- type: "status",
121
- iteratorResult
122
- })),
123
- new Promise(
124
- (resolve) => setTimeout(() => resolve({ type: "timeout" }), pollIntervalMs)
125
- )
126
- ]);
127
- const elapsedSeconds = (Date.now() - startTime) / 1e3;
128
- if (result.type === "status") {
129
- const iteratorResult = result.iteratorResult;
130
- isDone = iteratorResult.done ?? false;
131
- if (!isDone && iteratorResult.value) {
132
- lastStatus = iteratorResult.value;
133
- pendingNext = iterator.next();
203
+ let errorMessage = null;
204
+ const handleAbort = () => {
205
+ relayClient.abortAgent(agentId, sessionId);
206
+ isDone = true;
207
+ if (resolveNextMessage) {
208
+ resolveNextMessage({ value: void 0, done: true });
209
+ resolveNextMessage = null;
210
+ rejectNextMessage = null;
211
+ }
212
+ };
213
+ signal.addEventListener("abort", handleAbort);
214
+ const handleConnectionChange = (connected) => {
215
+ if (!connected && !isDone) {
216
+ errorMessage = "Relay connection lost";
217
+ isDone = true;
218
+ if (rejectNextMessage) {
219
+ rejectNextMessage(new Error(errorMessage));
220
+ resolveNextMessage = null;
221
+ rejectNextMessage = null;
134
222
  }
135
223
  }
136
- if (lastStatus === options.completedStatus) {
137
- yield `Completed in ${elapsedSeconds.toFixed(1)}s`;
138
- } else if (lastStatus) {
139
- yield `${lastStatus} ${elapsedSeconds.toFixed(1)}s`;
140
- } else {
141
- yield `Working\u2026 ${elapsedSeconds.toFixed(1)}s`;
224
+ };
225
+ const unsubscribeConnection = relayClient.onConnectionChange(
226
+ handleConnectionChange
227
+ );
228
+ const unsubscribeMessage = relayClient.onMessage((message) => {
229
+ if (message.sessionId !== sessionId) return;
230
+ if (message.type === "agent-status" && message.content) {
231
+ messageQueue.push(message.content);
232
+ if (resolveNextMessage) {
233
+ const nextMessage = messageQueue.shift();
234
+ if (nextMessage !== void 0) {
235
+ resolveNextMessage({ value: nextMessage, done: false });
236
+ resolveNextMessage = null;
237
+ rejectNextMessage = null;
238
+ }
239
+ }
240
+ } else if (message.type === "agent-done") {
241
+ isDone = true;
242
+ if (resolveNextMessage) {
243
+ resolveNextMessage({ value: void 0, done: true });
244
+ resolveNextMessage = null;
245
+ rejectNextMessage = null;
246
+ }
247
+ } else if (message.type === "agent-error") {
248
+ errorMessage = message.content ?? "Unknown error";
249
+ isDone = true;
250
+ if (rejectNextMessage) {
251
+ rejectNextMessage(new Error(errorMessage));
252
+ resolveNextMessage = null;
253
+ rejectNextMessage = null;
254
+ }
142
255
  }
256
+ });
257
+ if (!relayClient.isConnected()) {
258
+ unsubscribeConnection();
259
+ unsubscribeMessage();
260
+ signal.removeEventListener("abort", handleAbort);
261
+ throw new Error("Relay connection is not open");
262
+ }
263
+ const didSendRequest = relayClient.sendAgentRequest(agentId, contextWithSession);
264
+ if (!didSendRequest) {
265
+ unsubscribeConnection();
266
+ unsubscribeMessage();
267
+ signal.removeEventListener("abort", handleAbort);
268
+ throw new Error("Failed to send agent request: connection not open");
143
269
  }
144
- } finally {
145
- signal.removeEventListener("abort", handleAbort);
146
- }
147
- };
148
- var createCachedConnectionChecker = (checkConnection, ttlMs = CONNECTION_CHECK_TTL_MS) => {
149
- let cache = null;
150
- return async () => {
151
- const now = Date.now();
152
- if (cache && now - cache.timestamp < ttlMs) return cache.result;
153
270
  try {
154
- const result = await checkConnection();
155
- cache = { result, timestamp: now };
156
- return result;
157
- } catch {
158
- cache = { result: false, timestamp: now };
159
- return false;
271
+ while (true) {
272
+ if (messageQueue.length > 0) {
273
+ const next = messageQueue.shift();
274
+ if (next !== void 0) {
275
+ yield next;
276
+ }
277
+ continue;
278
+ }
279
+ if (isDone || signal.aborted) {
280
+ break;
281
+ }
282
+ const result = await new Promise(
283
+ (resolve, reject) => {
284
+ resolveNextMessage = resolve;
285
+ rejectNextMessage = reject;
286
+ }
287
+ );
288
+ if (result.done) break;
289
+ yield result.value;
290
+ }
291
+ if (errorMessage) {
292
+ throw new Error(errorMessage);
293
+ }
294
+ } finally {
295
+ signal.removeEventListener("abort", handleAbort);
296
+ unsubscribeConnection();
297
+ unsubscribeMessage();
298
+ }
299
+ };
300
+ const abort = async (sessionId) => {
301
+ relayClient.abortAgent(agentId, sessionId);
302
+ };
303
+ const waitForOperationResponse = (sessionId) => {
304
+ return new Promise((resolve, reject) => {
305
+ let didCleanup = false;
306
+ const cleanup = () => {
307
+ if (didCleanup) return;
308
+ didCleanup = true;
309
+ unsubscribeMessage();
310
+ unsubscribeConnection();
311
+ };
312
+ const unsubscribeMessage = relayClient.onMessage((message) => {
313
+ if (message.sessionId !== sessionId) return;
314
+ cleanup();
315
+ if (message.type === "agent-done") {
316
+ resolve();
317
+ } else if (message.type === "agent-error") {
318
+ reject(new Error(message.content ?? "Operation failed"));
319
+ }
320
+ });
321
+ const unsubscribeConnection = relayClient.onConnectionChange((connected) => {
322
+ if (!connected) {
323
+ cleanup();
324
+ reject(new Error("Connection lost while waiting for operation response"));
325
+ }
326
+ });
327
+ });
328
+ };
329
+ const undo = async () => {
330
+ const sessionId = `undo-${agentId}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
331
+ const didSend = relayClient.undoAgent(agentId, sessionId);
332
+ if (!didSend) {
333
+ throw new Error("Failed to send undo request: connection not open");
160
334
  }
335
+ return waitForOperationResponse(sessionId);
336
+ };
337
+ const redo = async () => {
338
+ const sessionId = `redo-${agentId}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
339
+ const didSend = relayClient.redoAgent(agentId, sessionId);
340
+ if (!didSend) {
341
+ throw new Error("Failed to send redo request: connection not open");
342
+ }
343
+ return waitForOperationResponse(sessionId);
344
+ };
345
+ return {
346
+ send,
347
+ abort,
348
+ undo,
349
+ redo,
350
+ checkConnection,
351
+ supportsResume: true,
352
+ supportsFollowUp: true
161
353
  };
162
354
  };
163
-
164
- // src/constants.ts
165
- var DEFAULT_PORT = 6567;
166
- var COMPLETED_STATUS = "Completed successfully";
355
+ var defaultRelayClient = null;
356
+ var getDefaultRelayClient = () => {
357
+ if (typeof window === "undefined") {
358
+ return null;
359
+ }
360
+ if (window.__REACT_GRAB_RELAY__) {
361
+ defaultRelayClient = window.__REACT_GRAB_RELAY__;
362
+ return defaultRelayClient;
363
+ }
364
+ if (!defaultRelayClient) {
365
+ defaultRelayClient = createRelayClient();
366
+ window.__REACT_GRAB_RELAY__ = defaultRelayClient;
367
+ }
368
+ return defaultRelayClient;
369
+ };
167
370
 
168
371
  // src/client.ts
169
- var DEFAULT_SERVER_URL = `http://localhost:${DEFAULT_PORT}`;
170
- var isReactGrabApi = (value) => typeof value === "object" && value !== null && "setAgent" in value;
171
- var createOpenCodeAgentProvider = (options = {}) => {
172
- const { serverUrl = DEFAULT_SERVER_URL, getOptions } = options;
173
- const mergeOptions = (contextOptions) => ({
174
- ...getOptions?.() ?? {},
175
- ...contextOptions ?? {}
372
+ var AGENT_ID = "opencode";
373
+ var isReactGrabApi = (value) => typeof value === "object" && value !== null && "registerPlugin" in value;
374
+ var createOpenCodeAgentProvider = (providerOptions = {}) => {
375
+ const relayClient = providerOptions.relayClient ?? getDefaultRelayClient();
376
+ if (!relayClient) {
377
+ throw new Error("RelayClient is required in browser environments");
378
+ }
379
+ return createRelayAgentProvider({
380
+ relayClient,
381
+ agentId: AGENT_ID
176
382
  });
177
- const checkConnection = createCachedConnectionChecker(async () => {
178
- const response = await fetch(`${serverUrl}/health`, { method: "GET" });
179
- return response.ok;
180
- }, CONNECTION_CHECK_TTL_MS);
181
- return {
182
- send: async function* (context, signal) {
183
- const combinedContext = {
184
- ...context,
185
- options: mergeOptions(context.options)
186
- };
187
- yield* streamAgentStatusFromServer(
188
- { serverUrl, completedStatus: COMPLETED_STATUS },
189
- combinedContext,
190
- signal
191
- );
192
- },
193
- resume: async function* (sessionId, signal, storage) {
194
- const storedContext = getStoredAgentContext(storage, sessionId);
195
- const context = {
196
- content: storedContext.content,
197
- prompt: storedContext.prompt,
198
- options: storedContext.options,
199
- sessionId: storedContext.sessionId ?? sessionId
200
- };
201
- const combinedContext = {
202
- ...context,
203
- options: mergeOptions(context.options)
204
- };
205
- yield "Resuming...";
206
- yield* streamAgentStatusFromServer(
207
- { serverUrl, completedStatus: COMPLETED_STATUS },
208
- combinedContext,
209
- signal
210
- );
211
- },
212
- supportsResume: true,
213
- supportsFollowUp: true,
214
- checkConnection,
215
- undo: async () => {
216
- try {
217
- await fetch(`${serverUrl}/undo`, { method: "POST" });
218
- } catch {
219
- }
220
- }
221
- };
222
383
  };
223
384
  var attachAgent = async () => {
224
385
  if (typeof window === "undefined") return;
225
- const provider = createOpenCodeAgentProvider();
386
+ const relayClient = getDefaultRelayClient();
387
+ if (!relayClient) return;
388
+ try {
389
+ await relayClient.connect();
390
+ } catch {
391
+ return;
392
+ }
393
+ const provider = createRelayAgentProvider({
394
+ relayClient,
395
+ agentId: AGENT_ID
396
+ });
226
397
  const attach = (api) => {
227
- api.setAgent({ provider, storage: sessionStorage });
398
+ const agent = { provider, storage: sessionStorage };
399
+ const plugin = {
400
+ name: "opencode-agent",
401
+ actions: [
402
+ {
403
+ id: "edit-with-opencode",
404
+ label: "Edit with OpenCode",
405
+ shortcut: "Enter",
406
+ onAction: (actionContext) => {
407
+ actionContext.enterPromptMode?.(agent);
408
+ },
409
+ agent
410
+ }
411
+ ]
412
+ };
413
+ api.registerPlugin(plugin);
228
414
  };
229
415
  const existingApi = window.__REACT_GRAB__;
230
416
  if (isReactGrabApi(existingApi)) {
@@ -0,0 +1,16 @@
1
+ import { init } from 'react-grab/core';
2
+ export { AgentCompleteResult } from 'react-grab/core';
3
+ import { RelayClient, AgentProvider } from '@react-grab/relay/client';
4
+
5
+ interface OpenCodeAgentProviderOptions {
6
+ relayClient?: RelayClient;
7
+ }
8
+ declare const createOpenCodeAgentProvider: (providerOptions?: OpenCodeAgentProviderOptions) => AgentProvider;
9
+ declare global {
10
+ interface Window {
11
+ __REACT_GRAB__?: ReturnType<typeof init>;
12
+ }
13
+ }
14
+ declare const attachAgent: () => Promise<void>;
15
+
16
+ export { attachAgent, createOpenCodeAgentProvider };
@@ -0,0 +1,16 @@
1
+ import { init } from 'react-grab/core';
2
+ export { AgentCompleteResult } from 'react-grab/core';
3
+ import { RelayClient, AgentProvider } from '@react-grab/relay/client';
4
+
5
+ interface OpenCodeAgentProviderOptions {
6
+ relayClient?: RelayClient;
7
+ }
8
+ declare const createOpenCodeAgentProvider: (providerOptions?: OpenCodeAgentProviderOptions) => AgentProvider;
9
+ declare global {
10
+ interface Window {
11
+ __REACT_GRAB__?: ReturnType<typeof init>;
12
+ }
13
+ }
14
+ declare const attachAgent: () => Promise<void>;
15
+
16
+ export { attachAgent, createOpenCodeAgentProvider };