@react-grab/cursor 0.0.56 → 0.0.58
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 +26 -4
- package/dist/client.d.cts +8 -3
- package/dist/client.d.ts +8 -3
- package/dist/client.js +26 -4
- package/dist/server.cjs +16 -16
- package/dist/server.d.cts +2 -1
- package/dist/server.d.ts +2 -1
- package/dist/server.js +16 -17
- package/package.json +2 -2
package/dist/client.cjs
CHANGED
|
@@ -60,7 +60,10 @@ var createCursorAgentProvider = (providerOptions = {}) => {
|
|
|
60
60
|
});
|
|
61
61
|
return {
|
|
62
62
|
send: async function* (context, signal) {
|
|
63
|
-
const mergedContext = {
|
|
63
|
+
const mergedContext = {
|
|
64
|
+
...context,
|
|
65
|
+
options: mergeOptions(context.options)
|
|
66
|
+
};
|
|
64
67
|
yield* streamFromServer(serverUrl, mergedContext, signal);
|
|
65
68
|
},
|
|
66
69
|
resume: async function* (sessionId, signal) {
|
|
@@ -74,14 +77,33 @@ var createCursorAgentProvider = (providerOptions = {}) => {
|
|
|
74
77
|
throw new Error(`Session ${sessionId} not found`);
|
|
75
78
|
}
|
|
76
79
|
const context = session.context;
|
|
77
|
-
const mergedContext = {
|
|
80
|
+
const mergedContext = {
|
|
81
|
+
...context,
|
|
82
|
+
options: mergeOptions(context.options)
|
|
83
|
+
};
|
|
78
84
|
yield "Resuming...";
|
|
79
85
|
yield* streamFromServer(serverUrl, mergedContext, signal);
|
|
80
86
|
},
|
|
81
87
|
supportsResume: true
|
|
82
88
|
};
|
|
83
89
|
};
|
|
84
|
-
var
|
|
90
|
+
var attachAgent = async () => {
|
|
91
|
+
if (typeof window === "undefined") return;
|
|
92
|
+
const provider = createCursorAgentProvider();
|
|
93
|
+
const api = window.__REACT_GRAB__;
|
|
94
|
+
if (api) {
|
|
95
|
+
api.setAgent({ provider });
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
window.addEventListener(
|
|
99
|
+
"react-grab:init",
|
|
100
|
+
(event) => {
|
|
101
|
+
const customEvent = event;
|
|
102
|
+
customEvent.detail.setAgent({ provider });
|
|
103
|
+
},
|
|
104
|
+
{ once: true }
|
|
105
|
+
);
|
|
106
|
+
};
|
|
85
107
|
|
|
108
|
+
exports.attachAgent = attachAgent;
|
|
86
109
|
exports.createCursorAgentProvider = createCursorAgentProvider;
|
|
87
|
-
exports.defaultCursorAgentProvider = defaultCursorAgentProvider;
|
package/dist/client.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentProvider } from 'react-grab/core';
|
|
1
|
+
import { init, AgentProvider } from 'react-grab/core';
|
|
2
2
|
|
|
3
3
|
interface CursorAgentOptions {
|
|
4
4
|
model?: string;
|
|
@@ -9,6 +9,11 @@ interface CursorAgentProviderOptions {
|
|
|
9
9
|
getOptions?: () => Partial<CursorAgentOptions>;
|
|
10
10
|
}
|
|
11
11
|
declare const createCursorAgentProvider: (providerOptions?: CursorAgentProviderOptions) => AgentProvider<CursorAgentOptions>;
|
|
12
|
-
declare
|
|
12
|
+
declare global {
|
|
13
|
+
interface Window {
|
|
14
|
+
__REACT_GRAB__?: ReturnType<typeof init>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare const attachAgent: () => Promise<void>;
|
|
13
18
|
|
|
14
|
-
export {
|
|
19
|
+
export { attachAgent, createCursorAgentProvider };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentProvider } from 'react-grab/core';
|
|
1
|
+
import { init, AgentProvider } from 'react-grab/core';
|
|
2
2
|
|
|
3
3
|
interface CursorAgentOptions {
|
|
4
4
|
model?: string;
|
|
@@ -9,6 +9,11 @@ interface CursorAgentProviderOptions {
|
|
|
9
9
|
getOptions?: () => Partial<CursorAgentOptions>;
|
|
10
10
|
}
|
|
11
11
|
declare const createCursorAgentProvider: (providerOptions?: CursorAgentProviderOptions) => AgentProvider<CursorAgentOptions>;
|
|
12
|
-
declare
|
|
12
|
+
declare global {
|
|
13
|
+
interface Window {
|
|
14
|
+
__REACT_GRAB__?: ReturnType<typeof init>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare const attachAgent: () => Promise<void>;
|
|
13
18
|
|
|
14
|
-
export {
|
|
19
|
+
export { attachAgent, createCursorAgentProvider };
|
package/dist/client.js
CHANGED
|
@@ -58,7 +58,10 @@ var createCursorAgentProvider = (providerOptions = {}) => {
|
|
|
58
58
|
});
|
|
59
59
|
return {
|
|
60
60
|
send: async function* (context, signal) {
|
|
61
|
-
const mergedContext = {
|
|
61
|
+
const mergedContext = {
|
|
62
|
+
...context,
|
|
63
|
+
options: mergeOptions(context.options)
|
|
64
|
+
};
|
|
62
65
|
yield* streamFromServer(serverUrl, mergedContext, signal);
|
|
63
66
|
},
|
|
64
67
|
resume: async function* (sessionId, signal) {
|
|
@@ -72,13 +75,32 @@ var createCursorAgentProvider = (providerOptions = {}) => {
|
|
|
72
75
|
throw new Error(`Session ${sessionId} not found`);
|
|
73
76
|
}
|
|
74
77
|
const context = session.context;
|
|
75
|
-
const mergedContext = {
|
|
78
|
+
const mergedContext = {
|
|
79
|
+
...context,
|
|
80
|
+
options: mergeOptions(context.options)
|
|
81
|
+
};
|
|
76
82
|
yield "Resuming...";
|
|
77
83
|
yield* streamFromServer(serverUrl, mergedContext, signal);
|
|
78
84
|
},
|
|
79
85
|
supportsResume: true
|
|
80
86
|
};
|
|
81
87
|
};
|
|
82
|
-
var
|
|
88
|
+
var attachAgent = async () => {
|
|
89
|
+
if (typeof window === "undefined") return;
|
|
90
|
+
const provider = createCursorAgentProvider();
|
|
91
|
+
const api = window.__REACT_GRAB__;
|
|
92
|
+
if (api) {
|
|
93
|
+
api.setAgent({ provider });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
window.addEventListener(
|
|
97
|
+
"react-grab:init",
|
|
98
|
+
(event) => {
|
|
99
|
+
const customEvent = event;
|
|
100
|
+
customEvent.detail.setAgent({ provider });
|
|
101
|
+
},
|
|
102
|
+
{ once: true }
|
|
103
|
+
);
|
|
104
|
+
};
|
|
83
105
|
|
|
84
|
-
export {
|
|
106
|
+
export { attachAgent, createCursorAgentProvider };
|
package/dist/server.cjs
CHANGED
|
@@ -739,14 +739,14 @@ var Hono = class {
|
|
|
739
739
|
}
|
|
740
740
|
#notFoundHandler = notFoundHandler;
|
|
741
741
|
errorHandler = errorHandler;
|
|
742
|
-
route(path,
|
|
742
|
+
route(path, app) {
|
|
743
743
|
const subApp = this.basePath(path);
|
|
744
|
-
|
|
744
|
+
app.routes.map((r) => {
|
|
745
745
|
let handler;
|
|
746
|
-
if (
|
|
746
|
+
if (app.errorHandler === errorHandler) {
|
|
747
747
|
handler = r.handler;
|
|
748
748
|
} else {
|
|
749
|
-
handler = async (c, next) => (await compose([],
|
|
749
|
+
handler = async (c, next) => (await compose([], app.errorHandler)(c, () => r.handler(c, next))).res;
|
|
750
750
|
handler[COMPOSED_HANDLER] = r.handler;
|
|
751
751
|
}
|
|
752
752
|
subApp.#addRoute(r.method, r.path, handler);
|
|
@@ -2253,7 +2253,7 @@ var createAdaptorServer = (options) => {
|
|
|
2253
2253
|
};
|
|
2254
2254
|
var serve = (options, listeningListener) => {
|
|
2255
2255
|
const server = createAdaptorServer(options);
|
|
2256
|
-
server.listen(options?.port, options.hostname, () => {
|
|
2256
|
+
server.listen(options?.port ?? 3e3, options.hostname, () => {
|
|
2257
2257
|
server.address();
|
|
2258
2258
|
});
|
|
2259
2259
|
return server;
|
|
@@ -2277,9 +2277,9 @@ var extractTextFromMessage = (message) => {
|
|
|
2277
2277
|
return message.content.filter((block) => block.type === "text").map((block) => block.text).join(" ").trim();
|
|
2278
2278
|
};
|
|
2279
2279
|
var createServer = () => {
|
|
2280
|
-
const
|
|
2281
|
-
|
|
2282
|
-
|
|
2280
|
+
const app = new Hono2();
|
|
2281
|
+
app.use("/*", cors());
|
|
2282
|
+
app.post("/agent", async (context) => {
|
|
2283
2283
|
const body = await context.req.json();
|
|
2284
2284
|
const { content, prompt, options } = body;
|
|
2285
2285
|
const fullPrompt = `${prompt}
|
|
@@ -2394,16 +2394,16 @@ ${content}`;
|
|
|
2394
2394
|
}
|
|
2395
2395
|
});
|
|
2396
2396
|
});
|
|
2397
|
-
|
|
2397
|
+
app.get("/health", (context) => {
|
|
2398
2398
|
return context.json({ status: "ok", provider: "cursor" });
|
|
2399
2399
|
});
|
|
2400
|
-
return
|
|
2400
|
+
return app;
|
|
2401
|
+
};
|
|
2402
|
+
var startServer = (port = DEFAULT_PORT) => {
|
|
2403
|
+
const app = createServer();
|
|
2404
|
+
serve({ fetch: app.fetch, port });
|
|
2405
|
+
console.log("React Grab Cursor server running on port", port);
|
|
2401
2406
|
};
|
|
2402
|
-
var app = createServer();
|
|
2403
|
-
serve({
|
|
2404
|
-
fetch: app.fetch,
|
|
2405
|
-
port: DEFAULT_PORT
|
|
2406
|
-
});
|
|
2407
|
-
console.log("React Grab Cursor server running on port", DEFAULT_PORT);
|
|
2408
2407
|
|
|
2409
2408
|
exports.createServer = createServer;
|
|
2409
|
+
exports.startServer = startServer;
|
package/dist/server.d.cts
CHANGED
|
@@ -2,5 +2,6 @@ import * as hono_types from 'hono/types';
|
|
|
2
2
|
import { Hono } from 'hono';
|
|
3
3
|
|
|
4
4
|
declare const createServer: () => Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
5
|
+
declare const startServer: (port?: number) => void;
|
|
5
6
|
|
|
6
|
-
export { createServer };
|
|
7
|
+
export { createServer, startServer };
|
package/dist/server.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ import * as hono_types from 'hono/types';
|
|
|
2
2
|
import { Hono } from 'hono';
|
|
3
3
|
|
|
4
4
|
declare const createServer: () => Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
5
|
+
declare const startServer: (port?: number) => void;
|
|
5
6
|
|
|
6
|
-
export { createServer };
|
|
7
|
+
export { createServer, startServer };
|
package/dist/server.js
CHANGED
|
@@ -733,14 +733,14 @@ var Hono = class {
|
|
|
733
733
|
}
|
|
734
734
|
#notFoundHandler = notFoundHandler;
|
|
735
735
|
errorHandler = errorHandler;
|
|
736
|
-
route(path,
|
|
736
|
+
route(path, app) {
|
|
737
737
|
const subApp = this.basePath(path);
|
|
738
|
-
|
|
738
|
+
app.routes.map((r) => {
|
|
739
739
|
let handler;
|
|
740
|
-
if (
|
|
740
|
+
if (app.errorHandler === errorHandler) {
|
|
741
741
|
handler = r.handler;
|
|
742
742
|
} else {
|
|
743
|
-
handler = async (c, next) => (await compose([],
|
|
743
|
+
handler = async (c, next) => (await compose([], app.errorHandler)(c, () => r.handler(c, next))).res;
|
|
744
744
|
handler[COMPOSED_HANDLER] = r.handler;
|
|
745
745
|
}
|
|
746
746
|
subApp.#addRoute(r.method, r.path, handler);
|
|
@@ -2247,7 +2247,7 @@ var createAdaptorServer = (options) => {
|
|
|
2247
2247
|
};
|
|
2248
2248
|
var serve = (options, listeningListener) => {
|
|
2249
2249
|
const server = createAdaptorServer(options);
|
|
2250
|
-
server.listen(options?.port, options.hostname, () => {
|
|
2250
|
+
server.listen(options?.port ?? 3e3, options.hostname, () => {
|
|
2251
2251
|
server.address();
|
|
2252
2252
|
});
|
|
2253
2253
|
return server;
|
|
@@ -2271,9 +2271,9 @@ var extractTextFromMessage = (message) => {
|
|
|
2271
2271
|
return message.content.filter((block) => block.type === "text").map((block) => block.text).join(" ").trim();
|
|
2272
2272
|
};
|
|
2273
2273
|
var createServer = () => {
|
|
2274
|
-
const
|
|
2275
|
-
|
|
2276
|
-
|
|
2274
|
+
const app = new Hono2();
|
|
2275
|
+
app.use("/*", cors());
|
|
2276
|
+
app.post("/agent", async (context) => {
|
|
2277
2277
|
const body = await context.req.json();
|
|
2278
2278
|
const { content, prompt, options } = body;
|
|
2279
2279
|
const fullPrompt = `${prompt}
|
|
@@ -2388,16 +2388,15 @@ ${content}`;
|
|
|
2388
2388
|
}
|
|
2389
2389
|
});
|
|
2390
2390
|
});
|
|
2391
|
-
|
|
2391
|
+
app.get("/health", (context) => {
|
|
2392
2392
|
return context.json({ status: "ok", provider: "cursor" });
|
|
2393
2393
|
});
|
|
2394
|
-
return
|
|
2394
|
+
return app;
|
|
2395
|
+
};
|
|
2396
|
+
var startServer = (port = DEFAULT_PORT) => {
|
|
2397
|
+
const app = createServer();
|
|
2398
|
+
serve({ fetch: app.fetch, port });
|
|
2399
|
+
console.log("React Grab Cursor server running on port", port);
|
|
2395
2400
|
};
|
|
2396
|
-
var app = createServer();
|
|
2397
|
-
serve({
|
|
2398
|
-
fetch: app.fetch,
|
|
2399
|
-
port: DEFAULT_PORT
|
|
2400
|
-
});
|
|
2401
|
-
console.log("React Grab Cursor server running on port", DEFAULT_PORT);
|
|
2402
2401
|
|
|
2403
|
-
export { createServer };
|
|
2402
|
+
export { createServer, startServer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-grab/cursor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.58",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./client": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@hono/node-server": "^1.19.6",
|
|
25
25
|
"hono": "^4.0.0",
|
|
26
|
-
"react-grab": "0.0.
|
|
26
|
+
"react-grab": "0.0.58"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"dev": "tsup --watch",
|