@react-grab/ami 0.0.81 → 0.0.83
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 +107 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +105 -0
- package/dist/client.cjs +44 -10
- package/dist/client.global.js +19 -19
- package/dist/client.js +44 -10
- package/dist/server.cjs +18 -0
- package/dist/server.d.cts +3 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +12 -0
- package/package.json +12 -3
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
|
|
30
|
+
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
31
|
+
var require_picocolors = __commonJS({
|
|
32
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
33
|
+
var p = process || {};
|
|
34
|
+
var argv = p.argv || [];
|
|
35
|
+
var env = p.env || {};
|
|
36
|
+
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);
|
|
37
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
38
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
39
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
40
|
+
};
|
|
41
|
+
var replaceClose = (string, close, replace, index) => {
|
|
42
|
+
let result = "", cursor = 0;
|
|
43
|
+
do {
|
|
44
|
+
result += string.substring(cursor, index) + replace;
|
|
45
|
+
cursor = index + close.length;
|
|
46
|
+
index = string.indexOf(close, cursor);
|
|
47
|
+
} while (~index);
|
|
48
|
+
return result + string.substring(cursor);
|
|
49
|
+
};
|
|
50
|
+
var createColors = (enabled = isColorSupported) => {
|
|
51
|
+
let f = enabled ? formatter : () => String;
|
|
52
|
+
return {
|
|
53
|
+
isColorSupported: enabled,
|
|
54
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
55
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
56
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
57
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
58
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
59
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
60
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
61
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
62
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
63
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
64
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
65
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
66
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
67
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
68
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
69
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
70
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
71
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
72
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
73
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
74
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
75
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
76
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
77
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
78
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
79
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
80
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
81
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
82
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
83
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
84
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
85
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
86
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
87
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
88
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
89
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
90
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
91
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
92
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
93
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
94
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
module.exports = createColors();
|
|
98
|
+
module.exports.createColors = createColors;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// src/cli.ts
|
|
103
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
104
|
+
var VERSION = "0.0.83";
|
|
105
|
+
console.log(
|
|
106
|
+
`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Ami)")}`
|
|
107
|
+
);
|
package/dist/cli.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
|
|
28
|
+
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
29
|
+
var require_picocolors = __commonJS({
|
|
30
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
31
|
+
var p = process || {};
|
|
32
|
+
var argv = p.argv || [];
|
|
33
|
+
var env = p.env || {};
|
|
34
|
+
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);
|
|
35
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
36
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
37
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
38
|
+
};
|
|
39
|
+
var replaceClose = (string, close, replace, index) => {
|
|
40
|
+
let result = "", cursor = 0;
|
|
41
|
+
do {
|
|
42
|
+
result += string.substring(cursor, index) + replace;
|
|
43
|
+
cursor = index + close.length;
|
|
44
|
+
index = string.indexOf(close, cursor);
|
|
45
|
+
} while (~index);
|
|
46
|
+
return result + string.substring(cursor);
|
|
47
|
+
};
|
|
48
|
+
var createColors = (enabled = isColorSupported) => {
|
|
49
|
+
let f = enabled ? formatter : () => String;
|
|
50
|
+
return {
|
|
51
|
+
isColorSupported: enabled,
|
|
52
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
53
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
54
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
55
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
56
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
57
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
58
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
59
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
60
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
61
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
62
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
63
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
64
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
65
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
66
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
67
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
68
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
69
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
70
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
71
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
72
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
73
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
74
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
75
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
76
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
77
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
78
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
79
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
80
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
81
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
82
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
83
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
84
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
85
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
86
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
87
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
88
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
89
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
90
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
91
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
92
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
module.exports = createColors();
|
|
96
|
+
module.exports.createColors = createColors;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// src/cli.ts
|
|
101
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
102
|
+
var VERSION = "0.0.83";
|
|
103
|
+
console.log(
|
|
104
|
+
`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Ami)")}`
|
|
105
|
+
);
|
package/dist/client.cjs
CHANGED
|
@@ -17502,6 +17502,7 @@ var createAmiAgentProvider = (projectId) => {
|
|
|
17502
17502
|
};
|
|
17503
17503
|
return {
|
|
17504
17504
|
send: async function* (context, signal) {
|
|
17505
|
+
const startTime = Date.now();
|
|
17505
17506
|
const auth = await getOrCreateAuth();
|
|
17506
17507
|
projectId = await getLatestProjectId(auth.token);
|
|
17507
17508
|
if (!projectId) {
|
|
@@ -17562,21 +17563,37 @@ var createAmiAgentProvider = (projectId) => {
|
|
|
17562
17563
|
resolveWait = null;
|
|
17563
17564
|
}
|
|
17564
17565
|
});
|
|
17566
|
+
const yieldStatus = (status) => {
|
|
17567
|
+
if (status === "Completed successfully") {
|
|
17568
|
+
const totalSeconds = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
17569
|
+
return `Completed in ${totalSeconds}s`;
|
|
17570
|
+
}
|
|
17571
|
+
return status;
|
|
17572
|
+
};
|
|
17565
17573
|
try {
|
|
17566
17574
|
while (!done && !aborted2) {
|
|
17567
17575
|
if (signal.aborted) {
|
|
17568
17576
|
throw new DOMException("Aborted", "AbortError");
|
|
17569
17577
|
}
|
|
17570
17578
|
if (statusQueue.length > 0) {
|
|
17571
|
-
yield statusQueue.shift();
|
|
17579
|
+
yield yieldStatus(statusQueue.shift());
|
|
17572
17580
|
} else {
|
|
17573
|
-
await
|
|
17574
|
-
|
|
17575
|
-
|
|
17581
|
+
const waitResult = await Promise.race([
|
|
17582
|
+
new Promise((resolve3) => {
|
|
17583
|
+
resolveWait = () => resolve3("status");
|
|
17584
|
+
}),
|
|
17585
|
+
new Promise(
|
|
17586
|
+
(resolve3) => setTimeout(() => resolve3("timeout"), 100)
|
|
17587
|
+
)
|
|
17588
|
+
]);
|
|
17589
|
+
if (waitResult === "timeout" && !done && !aborted2) {
|
|
17590
|
+
const elapsedSeconds = (Date.now() - startTime) / 1e3;
|
|
17591
|
+
yield `Working\u2026 ${elapsedSeconds.toFixed(1)}s`;
|
|
17592
|
+
}
|
|
17576
17593
|
}
|
|
17577
17594
|
}
|
|
17578
17595
|
while (statusQueue.length > 0 && !aborted2) {
|
|
17579
|
-
yield statusQueue.shift();
|
|
17596
|
+
yield yieldStatus(statusQueue.shift());
|
|
17580
17597
|
}
|
|
17581
17598
|
if (aborted2) {
|
|
17582
17599
|
throw new DOMException("Aborted", "AbortError");
|
|
@@ -17589,6 +17606,7 @@ var createAmiAgentProvider = (projectId) => {
|
|
|
17589
17606
|
}
|
|
17590
17607
|
},
|
|
17591
17608
|
resume: async function* (sessionId, signal, storage) {
|
|
17609
|
+
const startTime = Date.now();
|
|
17592
17610
|
const savedSessions = storage.getItem(STORAGE_KEY);
|
|
17593
17611
|
if (!savedSessions) {
|
|
17594
17612
|
throw new Error("No sessions to resume");
|
|
@@ -17645,21 +17663,37 @@ var createAmiAgentProvider = (projectId) => {
|
|
|
17645
17663
|
resolveWait = null;
|
|
17646
17664
|
}
|
|
17647
17665
|
});
|
|
17666
|
+
const yieldStatus = (status) => {
|
|
17667
|
+
if (status === "Completed successfully") {
|
|
17668
|
+
const totalSeconds = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
17669
|
+
return `Completed in ${totalSeconds}s`;
|
|
17670
|
+
}
|
|
17671
|
+
return status;
|
|
17672
|
+
};
|
|
17648
17673
|
try {
|
|
17649
17674
|
while (!done && !aborted2) {
|
|
17650
17675
|
if (signal.aborted) {
|
|
17651
17676
|
throw new DOMException("Aborted", "AbortError");
|
|
17652
17677
|
}
|
|
17653
17678
|
if (statusQueue.length > 0) {
|
|
17654
|
-
yield statusQueue.shift();
|
|
17679
|
+
yield yieldStatus(statusQueue.shift());
|
|
17655
17680
|
} else {
|
|
17656
|
-
await
|
|
17657
|
-
|
|
17658
|
-
|
|
17681
|
+
const waitResult = await Promise.race([
|
|
17682
|
+
new Promise((resolve3) => {
|
|
17683
|
+
resolveWait = () => resolve3("status");
|
|
17684
|
+
}),
|
|
17685
|
+
new Promise(
|
|
17686
|
+
(resolve3) => setTimeout(() => resolve3("timeout"), 100)
|
|
17687
|
+
)
|
|
17688
|
+
]);
|
|
17689
|
+
if (waitResult === "timeout" && !done && !aborted2) {
|
|
17690
|
+
const elapsedSeconds = (Date.now() - startTime) / 1e3;
|
|
17691
|
+
yield `Working\u2026 ${elapsedSeconds.toFixed(1)}s`;
|
|
17692
|
+
}
|
|
17659
17693
|
}
|
|
17660
17694
|
}
|
|
17661
17695
|
while (statusQueue.length > 0 && !aborted2) {
|
|
17662
|
-
yield statusQueue.shift();
|
|
17696
|
+
yield yieldStatus(statusQueue.shift());
|
|
17663
17697
|
}
|
|
17664
17698
|
if (aborted2) {
|
|
17665
17699
|
throw new DOMException("Aborted", "AbortError");
|