@react-grab/cursor 0.0.72 → 0.0.73
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/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/client.cjs +6 -0
- package/dist/client.d.cts +9 -2
- package/dist/client.d.ts +9 -2
- package/dist/client.global.js +3 -3
- package/dist/client.js +6 -0
- package/dist/server.cjs +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -111,7 +111,7 @@ var import_picocolors = __toESM(require_picocolors());
|
|
|
111
111
|
var DEFAULT_PORT = 5567;
|
|
112
112
|
|
|
113
113
|
// src/cli.ts
|
|
114
|
-
var VERSION = "0.0.
|
|
114
|
+
var VERSION = "0.0.73";
|
|
115
115
|
var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
|
|
116
116
|
var __dirname$1 = path.dirname(__filename$1);
|
|
117
117
|
var serverPath = path.join(__dirname$1, "server.js");
|
package/dist/cli.js
CHANGED
|
@@ -108,7 +108,7 @@ var import_picocolors = __toESM(require_picocolors());
|
|
|
108
108
|
var DEFAULT_PORT = 5567;
|
|
109
109
|
|
|
110
110
|
// src/cli.ts
|
|
111
|
-
var VERSION = "0.0.
|
|
111
|
+
var VERSION = "0.0.73";
|
|
112
112
|
var __filename = fileURLToPath(import.meta.url);
|
|
113
113
|
var __dirname = dirname(__filename);
|
|
114
114
|
var serverPath = join(__dirname, "server.js");
|
package/dist/client.cjs
CHANGED
|
@@ -122,6 +122,12 @@ var createCursorAgentProvider = (providerOptions = {}) => {
|
|
|
122
122
|
connectionCache = { result: false, timestamp: now };
|
|
123
123
|
return false;
|
|
124
124
|
}
|
|
125
|
+
},
|
|
126
|
+
undo: async () => {
|
|
127
|
+
try {
|
|
128
|
+
await fetch(`${serverUrl}/undo`, { method: "POST" });
|
|
129
|
+
} catch {
|
|
130
|
+
}
|
|
125
131
|
}
|
|
126
132
|
};
|
|
127
133
|
};
|
package/dist/client.d.cts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { init,
|
|
1
|
+
import { init, AgentContext, AgentSessionStorage } from 'react-grab/core';
|
|
2
2
|
|
|
3
3
|
interface CursorAgentOptions {
|
|
4
4
|
model?: string;
|
|
5
5
|
workspace?: string;
|
|
6
6
|
}
|
|
7
|
+
type CursorAgentContext = AgentContext<CursorAgentOptions>;
|
|
7
8
|
interface CursorAgentProviderOptions {
|
|
8
9
|
serverUrl?: string;
|
|
9
10
|
getOptions?: () => Partial<CursorAgentOptions>;
|
|
10
11
|
}
|
|
11
|
-
declare const createCursorAgentProvider: (providerOptions?: CursorAgentProviderOptions) =>
|
|
12
|
+
declare const createCursorAgentProvider: (providerOptions?: CursorAgentProviderOptions) => {
|
|
13
|
+
send: (context: CursorAgentContext, signal: AbortSignal) => AsyncGenerator<string, void, unknown>;
|
|
14
|
+
resume: (sessionId: string, signal: AbortSignal, storage: AgentSessionStorage) => AsyncGenerator<string, void, unknown>;
|
|
15
|
+
supportsResume: boolean;
|
|
16
|
+
checkConnection: () => Promise<boolean>;
|
|
17
|
+
undo: () => Promise<void>;
|
|
18
|
+
};
|
|
12
19
|
declare global {
|
|
13
20
|
interface Window {
|
|
14
21
|
__REACT_GRAB__?: ReturnType<typeof init>;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { init,
|
|
1
|
+
import { init, AgentContext, AgentSessionStorage } from 'react-grab/core';
|
|
2
2
|
|
|
3
3
|
interface CursorAgentOptions {
|
|
4
4
|
model?: string;
|
|
5
5
|
workspace?: string;
|
|
6
6
|
}
|
|
7
|
+
type CursorAgentContext = AgentContext<CursorAgentOptions>;
|
|
7
8
|
interface CursorAgentProviderOptions {
|
|
8
9
|
serverUrl?: string;
|
|
9
10
|
getOptions?: () => Partial<CursorAgentOptions>;
|
|
10
11
|
}
|
|
11
|
-
declare const createCursorAgentProvider: (providerOptions?: CursorAgentProviderOptions) =>
|
|
12
|
+
declare const createCursorAgentProvider: (providerOptions?: CursorAgentProviderOptions) => {
|
|
13
|
+
send: (context: CursorAgentContext, signal: AbortSignal) => AsyncGenerator<string, void, unknown>;
|
|
14
|
+
resume: (sessionId: string, signal: AbortSignal, storage: AgentSessionStorage) => AsyncGenerator<string, void, unknown>;
|
|
15
|
+
supportsResume: boolean;
|
|
16
|
+
checkConnection: () => Promise<boolean>;
|
|
17
|
+
undo: () => Promise<void>;
|
|
18
|
+
};
|
|
12
19
|
declare global {
|
|
13
20
|
interface Window {
|
|
14
21
|
__REACT_GRAB__?: ReturnType<typeof init>;
|
package/dist/client.global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ReactGrabCursor=(function(exports){'use strict';var
|
|
2
|
-
`))e.startsWith("event:")?t=e.slice(6).trim():e.startsWith("data:")&&(n=e.slice(5).trim());return {eventType:t,data:n}};async function*b(o,t){let n=o.getReader(),e=new TextDecoder,s="",r=false,a=()=>{r=true,n.cancel().catch(()=>{});};t.addEventListener("abort",a);try{if(t.aborted)throw new DOMException("Aborted","AbortError");for(;;){let i=await n.read();if(r||t.aborted)throw new DOMException("Aborted","AbortError");let{done:
|
|
1
|
+
var ReactGrabCursor=(function(exports){'use strict';var m=`http://localhost:${5567}`,E="react-grab:agent-sessions",C=o=>{let t="",n="";for(let e of o.split(`
|
|
2
|
+
`))e.startsWith("event:")?t=e.slice(6).trim():e.startsWith("data:")&&(n=e.slice(5).trim());return {eventType:t,data:n}};async function*b(o,t){let n=o.getReader(),e=new TextDecoder,s="",r=false,a=()=>{r=true,n.cancel().catch(()=>{});};t.addEventListener("abort",a);try{if(t.aborted)throw new DOMException("Aborted","AbortError");for(;;){let i=await n.read();if(r||t.aborted)throw new DOMException("Aborted","AbortError");let{done:g,value:l}=i;l&&(s+=e.decode(l,{stream:!0}));let c;for(;(c=s.indexOf(`
|
|
3
3
|
|
|
4
|
-
`))!==-1;){let{eventType:d,data:
|
|
4
|
+
`))!==-1;){let{eventType:d,data:u}=C(s.slice(0,c));if(s=s.slice(c+2),d==="done")return;if(d==="error"){console.error("[react-grab]",u||"Agent error");return}u&&(yield u);}if(g)break}}finally{t.removeEventListener("abort",a);try{n.releaseLock();}catch{}}}async function*p(o,t,n){let e=await fetch(`${o}/agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});if(!e.ok)throw new Error(`Server error: ${e.status}`);if(!e.body)throw new Error("No response body");yield*b(e.body,n);}var y=(o={})=>{let{serverUrl:t=m,getOptions:n}=o,e=null,s=r=>({...n?.()??{},...r??{}});return {send:async function*(r,a){let i={...r,options:s(r.options)};yield*p(t,i,a);},resume:async function*(r,a,i){let g=i.getItem(E);if(!g)throw new Error("No sessions to resume");let c=JSON.parse(g)[r];if(!c)throw new Error(`Session ${r} not found`);let d=c.context,u={...d,options:s(d.options)};yield "Resuming...",yield*p(t,u,a);},supportsResume:true,checkConnection:async()=>{let r=Date.now();if(e&&r-e.timestamp<5e3)return e.result;try{let i=(await fetch(`${t}/health`,{method:"GET"})).ok;return e={result:i,timestamp:r},i}catch{return e={result:false,timestamp:r},false}},undo:async()=>{try{await fetch(`${t}/undo`,{method:"POST"});}catch{}}}},S=async()=>{if(typeof window>"u")return;let o=y(),t=window.__REACT_GRAB__;if(t){t.setAgent({provider:o,storage:sessionStorage});return}window.addEventListener("react-grab:init",n=>{n.detail.setAgent({provider:o,storage:sessionStorage});},{once:true});};S();exports.attachAgent=S;exports.createCursorAgentProvider=y;return exports;})({});
|
package/dist/client.js
CHANGED
|
@@ -120,6 +120,12 @@ var createCursorAgentProvider = (providerOptions = {}) => {
|
|
|
120
120
|
connectionCache = { result: false, timestamp: now };
|
|
121
121
|
return false;
|
|
122
122
|
}
|
|
123
|
+
},
|
|
124
|
+
undo: async () => {
|
|
125
|
+
try {
|
|
126
|
+
await fetch(`${serverUrl}/undo`, { method: "POST" });
|
|
127
|
+
} catch {
|
|
128
|
+
}
|
|
123
129
|
}
|
|
124
130
|
};
|
|
125
131
|
};
|
package/dist/server.cjs
CHANGED
|
@@ -2366,7 +2366,7 @@ var import_picocolors = __toESM(require_picocolors());
|
|
|
2366
2366
|
var DEFAULT_PORT = 5567;
|
|
2367
2367
|
|
|
2368
2368
|
// src/server.ts
|
|
2369
|
-
var VERSION = "0.0.
|
|
2369
|
+
var VERSION = "0.0.73";
|
|
2370
2370
|
var parseStreamLine = (line) => {
|
|
2371
2371
|
const trimmed = line.trim();
|
|
2372
2372
|
if (!trimmed) return null;
|
package/dist/server.js
CHANGED
|
@@ -2358,7 +2358,7 @@ var import_picocolors = __toESM(require_picocolors());
|
|
|
2358
2358
|
var DEFAULT_PORT = 5567;
|
|
2359
2359
|
|
|
2360
2360
|
// src/server.ts
|
|
2361
|
-
var VERSION = "0.0.
|
|
2361
|
+
var VERSION = "0.0.73";
|
|
2362
2362
|
var parseStreamLine = (line) => {
|
|
2363
2363
|
const trimmed = line.trim();
|
|
2364
2364
|
if (!trimmed) return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-grab/cursor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.73",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"react-grab-cursor": "./dist/cli.js"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@hono/node-server": "^1.19.6",
|
|
31
31
|
"hono": "^4.0.0",
|
|
32
32
|
"picocolors": "^1.1.1",
|
|
33
|
-
"react-grab": "0.0.
|
|
33
|
+
"react-grab": "0.0.73"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"dev": "tsup --watch",
|