@react-grab/claude-code 0.0.67 → 0.0.69
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 +108 -1
- package/dist/cli.js +108 -1
- package/dist/client.cjs +4 -1
- package/dist/client.global.js +1 -1
- package/dist/client.js +4 -1
- package/dist/server.cjs +166 -65
- package/dist/server.js +166 -65
- package/package.json +3 -2
package/dist/cli.cjs
CHANGED
|
@@ -6,6 +6,112 @@ var url = require('url');
|
|
|
6
6
|
var path = require('path');
|
|
7
7
|
|
|
8
8
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
9
|
+
var __create = Object.create;
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
34
|
+
|
|
35
|
+
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
36
|
+
var require_picocolors = __commonJS({
|
|
37
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
38
|
+
var p = process || {};
|
|
39
|
+
var argv = p.argv || [];
|
|
40
|
+
var env = p.env || {};
|
|
41
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
42
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
43
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
44
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
45
|
+
};
|
|
46
|
+
var replaceClose = (string, close, replace, index) => {
|
|
47
|
+
let result = "", cursor = 0;
|
|
48
|
+
do {
|
|
49
|
+
result += string.substring(cursor, index) + replace;
|
|
50
|
+
cursor = index + close.length;
|
|
51
|
+
index = string.indexOf(close, cursor);
|
|
52
|
+
} while (~index);
|
|
53
|
+
return result + string.substring(cursor);
|
|
54
|
+
};
|
|
55
|
+
var createColors = (enabled = isColorSupported) => {
|
|
56
|
+
let f = enabled ? formatter : () => String;
|
|
57
|
+
return {
|
|
58
|
+
isColorSupported: enabled,
|
|
59
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
60
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
61
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
62
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
63
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
64
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
65
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
66
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
67
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
68
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
69
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
70
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
71
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
72
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
73
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
74
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
75
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
76
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
77
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
78
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
79
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
80
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
81
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
82
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
83
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
84
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
85
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
86
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
87
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
88
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
89
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
90
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
91
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
92
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
93
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
94
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
95
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
96
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
97
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
98
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
99
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
module.exports = createColors();
|
|
103
|
+
module.exports.createColors = createColors;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// src/cli.ts
|
|
108
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
109
|
+
|
|
110
|
+
// src/constants.ts
|
|
111
|
+
var DEFAULT_PORT = 4567;
|
|
112
|
+
|
|
113
|
+
// src/cli.ts
|
|
114
|
+
var VERSION = "0.0.69";
|
|
9
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)));
|
|
10
116
|
var __dirname$1 = path.dirname(__filename$1);
|
|
11
117
|
var serverPath = path.join(__dirname$1, "server.js");
|
|
@@ -13,4 +119,5 @@ child_process.spawn(process.execPath, [serverPath], {
|
|
|
13
119
|
detached: true,
|
|
14
120
|
stdio: "ignore"
|
|
15
121
|
}).unref();
|
|
16
|
-
console.log("
|
|
122
|
+
console.log(`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Claude Code)")}`);
|
|
123
|
+
console.log(`- Local: ${import_picocolors.default.cyan(`http://localhost:${DEFAULT_PORT}`)}`);
|
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,112 @@ import { spawn } from 'child_process';
|
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { dirname, join } from 'path';
|
|
5
5
|
|
|
6
|
+
var __create = Object.create;
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
13
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
|
|
32
|
+
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
33
|
+
var require_picocolors = __commonJS({
|
|
34
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
35
|
+
var p = process || {};
|
|
36
|
+
var argv = p.argv || [];
|
|
37
|
+
var env = p.env || {};
|
|
38
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
39
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
40
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
41
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
42
|
+
};
|
|
43
|
+
var replaceClose = (string, close, replace, index) => {
|
|
44
|
+
let result = "", cursor = 0;
|
|
45
|
+
do {
|
|
46
|
+
result += string.substring(cursor, index) + replace;
|
|
47
|
+
cursor = index + close.length;
|
|
48
|
+
index = string.indexOf(close, cursor);
|
|
49
|
+
} while (~index);
|
|
50
|
+
return result + string.substring(cursor);
|
|
51
|
+
};
|
|
52
|
+
var createColors = (enabled = isColorSupported) => {
|
|
53
|
+
let f = enabled ? formatter : () => String;
|
|
54
|
+
return {
|
|
55
|
+
isColorSupported: enabled,
|
|
56
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
57
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
58
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
59
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
60
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
61
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
62
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
63
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
64
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
65
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
66
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
67
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
68
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
69
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
70
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
71
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
72
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
73
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
74
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
75
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
76
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
77
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
78
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
79
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
80
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
81
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
82
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
83
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
84
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
85
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
86
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
87
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
88
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
89
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
90
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
91
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
92
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
93
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
94
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
95
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
96
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
module.exports = createColors();
|
|
100
|
+
module.exports.createColors = createColors;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// src/cli.ts
|
|
105
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
106
|
+
|
|
107
|
+
// src/constants.ts
|
|
108
|
+
var DEFAULT_PORT = 4567;
|
|
109
|
+
|
|
110
|
+
// src/cli.ts
|
|
111
|
+
var VERSION = "0.0.69";
|
|
6
112
|
var __filename = fileURLToPath(import.meta.url);
|
|
7
113
|
var __dirname = dirname(__filename);
|
|
8
114
|
var serverPath = join(__dirname, "server.js");
|
|
@@ -10,4 +116,5 @@ spawn(process.execPath, [serverPath], {
|
|
|
10
116
|
detached: true,
|
|
11
117
|
stdio: "ignore"
|
|
12
118
|
}).unref();
|
|
13
|
-
console.log("
|
|
119
|
+
console.log(`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Claude Code)")}`);
|
|
120
|
+
console.log(`- Local: ${import_picocolors.default.cyan(`http://localhost:${DEFAULT_PORT}`)}`);
|
package/dist/client.cjs
CHANGED
|
@@ -40,7 +40,10 @@ async function* streamSSE(stream) {
|
|
|
40
40
|
const { eventType, data } = parseSSEEvent(buffer.slice(0, boundary));
|
|
41
41
|
buffer = buffer.slice(boundary + 2);
|
|
42
42
|
if (eventType === "done") return;
|
|
43
|
-
if (eventType === "error")
|
|
43
|
+
if (eventType === "error") {
|
|
44
|
+
console.error("[react-grab]", data || "Agent error");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
44
47
|
if (data) yield data;
|
|
45
48
|
}
|
|
46
49
|
if (done) break;
|
package/dist/client.global.js
CHANGED
|
@@ -3,4 +3,4 @@ The user has selected an element from their UI and wants you to help modify it.
|
|
|
3
3
|
Provide clear, concise status updates as you work.`},model:"haiku",permissionMode:"bypassPermissions",maxTurns:10},A=n=>{let t="",o="";for(let e of n.split(`
|
|
4
4
|
`))e.startsWith("event:")?t=e.slice(6).trim():e.startsWith("data:")&&(o=e.slice(5).trim());return {eventType:t,data:o}};async function*S(n){let t=n.getReader(),o=new TextDecoder,e="";try{for(;;){let{done:s,value:i}=await t.read();i&&(e+=o.decode(i,{stream:!0}));let r;for(;(r=e.indexOf(`
|
|
5
5
|
|
|
6
|
-
`))!==-1;){let{eventType:a,data:
|
|
6
|
+
`))!==-1;){let{eventType:a,data:c}=A(e.slice(0,r));if(e=e.slice(r+2),a==="done")return;if(a==="error"){console.error("[react-grab]",c||"Agent error");return}c&&(yield c);}if(s)break}}finally{t.releaseLock();}}async function*p(n,t,o){let e=await fetch(`${n}/agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:o});if(!e.ok)throw new Error(`Server error: ${e.status}`);if(!e.body)throw new Error("No response body");yield*S(e.body);}var C=(n={})=>{let{serverUrl:t=f,getOptions:o}=n,e=s=>({...y,...o?.()??{},...s??{}});return {send:async function*(s,i){let r={...s,options:e(s.options)};yield*p(t,r,i);},resume:async function*(s,i,r){let a=r.getItem(m);if(!a)throw new Error("No sessions to resume");let d=JSON.parse(a)[s];if(!d)throw new Error(`Session ${s} not found`);let l=d.context,g={...l,options:e(l.options)};yield "Resuming...",yield*p(t,g,i);},supportsResume:true}},E=async()=>{if(typeof window>"u")return;let n=C(),t=window.__REACT_GRAB__;if(t){t.setAgent({provider:n,storage:sessionStorage});return}window.addEventListener("react-grab:init",o=>{o.detail.setAgent({provider:n,storage:sessionStorage});},{once:true});};E();exports.attachAgent=E;exports.createClaudeAgentProvider=C;return exports;})({});
|
package/dist/client.js
CHANGED
|
@@ -38,7 +38,10 @@ async function* streamSSE(stream) {
|
|
|
38
38
|
const { eventType, data } = parseSSEEvent(buffer.slice(0, boundary));
|
|
39
39
|
buffer = buffer.slice(boundary + 2);
|
|
40
40
|
if (eventType === "done") return;
|
|
41
|
-
if (eventType === "error")
|
|
41
|
+
if (eventType === "error") {
|
|
42
|
+
console.error("[react-grab]", data || "Agent error");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
42
45
|
if (data) yield data;
|
|
43
46
|
}
|
|
44
47
|
if (done) break;
|