@react-grab/ami 0.0.82 → 0.0.84
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 +63 -46
- package/dist/cli.js +63 -46
- package/dist/client.cjs +44 -10
- package/dist/client.global.js +19 -19
- package/dist/client.js +44 -10
- package/dist/server.cjs +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -7,13 +7,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
7
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var
|
|
11
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
12
|
-
}) : x)(function(x) {
|
|
13
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
15
|
-
});
|
|
16
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
17
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
12
|
};
|
|
19
13
|
var __copyProps = (to, from, except, desc) => {
|
|
@@ -33,50 +27,73 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
27
|
mod
|
|
34
28
|
));
|
|
35
29
|
|
|
36
|
-
//
|
|
30
|
+
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
37
31
|
var require_picocolors = __commonJS({
|
|
38
|
-
"
|
|
39
|
-
var
|
|
40
|
-
var
|
|
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);
|
|
41
37
|
var formatter = (open, close, replace = open) => (input) => {
|
|
42
|
-
let string = "" + input;
|
|
43
|
-
let index = string.indexOf(close, open.length);
|
|
38
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
44
39
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
45
40
|
};
|
|
46
41
|
var replaceClose = (string, close, replace, index) => {
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
};
|
|
51
96
|
};
|
|
52
|
-
var createColors = (enabled = isColorSupported) => ({
|
|
53
|
-
isColorSupported: enabled,
|
|
54
|
-
reset: enabled ? (s) => `\x1B[0m${s}\x1B[0m` : String,
|
|
55
|
-
bold: enabled ? formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m") : String,
|
|
56
|
-
dim: enabled ? formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m") : String,
|
|
57
|
-
italic: enabled ? formatter("\x1B[3m", "\x1B[23m") : String,
|
|
58
|
-
underline: enabled ? formatter("\x1B[4m", "\x1B[24m") : String,
|
|
59
|
-
inverse: enabled ? formatter("\x1B[7m", "\x1B[27m") : String,
|
|
60
|
-
hidden: enabled ? formatter("\x1B[8m", "\x1B[28m") : String,
|
|
61
|
-
strikethrough: enabled ? formatter("\x1B[9m", "\x1B[29m") : String,
|
|
62
|
-
black: enabled ? formatter("\x1B[30m", "\x1B[39m") : String,
|
|
63
|
-
red: enabled ? formatter("\x1B[31m", "\x1B[39m") : String,
|
|
64
|
-
green: enabled ? formatter("\x1B[32m", "\x1B[39m") : String,
|
|
65
|
-
yellow: enabled ? formatter("\x1B[33m", "\x1B[39m") : String,
|
|
66
|
-
blue: enabled ? formatter("\x1B[34m", "\x1B[39m") : String,
|
|
67
|
-
magenta: enabled ? formatter("\x1B[35m", "\x1B[39m") : String,
|
|
68
|
-
cyan: enabled ? formatter("\x1B[36m", "\x1B[39m") : String,
|
|
69
|
-
white: enabled ? formatter("\x1B[37m", "\x1B[39m") : String,
|
|
70
|
-
gray: enabled ? formatter("\x1B[90m", "\x1B[39m") : String,
|
|
71
|
-
bgBlack: enabled ? formatter("\x1B[40m", "\x1B[49m") : String,
|
|
72
|
-
bgRed: enabled ? formatter("\x1B[41m", "\x1B[49m") : String,
|
|
73
|
-
bgGreen: enabled ? formatter("\x1B[42m", "\x1B[49m") : String,
|
|
74
|
-
bgYellow: enabled ? formatter("\x1B[43m", "\x1B[49m") : String,
|
|
75
|
-
bgBlue: enabled ? formatter("\x1B[44m", "\x1B[49m") : String,
|
|
76
|
-
bgMagenta: enabled ? formatter("\x1B[45m", "\x1B[49m") : String,
|
|
77
|
-
bgCyan: enabled ? formatter("\x1B[46m", "\x1B[49m") : String,
|
|
78
|
-
bgWhite: enabled ? formatter("\x1B[47m", "\x1B[49m") : String
|
|
79
|
-
});
|
|
80
97
|
module.exports = createColors();
|
|
81
98
|
module.exports.createColors = createColors;
|
|
82
99
|
}
|
|
@@ -84,7 +101,7 @@ var require_picocolors = __commonJS({
|
|
|
84
101
|
|
|
85
102
|
// src/cli.ts
|
|
86
103
|
var import_picocolors = __toESM(require_picocolors());
|
|
87
|
-
var VERSION = "0.0.
|
|
104
|
+
var VERSION = "0.0.84";
|
|
88
105
|
console.log(
|
|
89
106
|
`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Ami)")}`
|
|
90
107
|
);
|
package/dist/cli.js
CHANGED
|
@@ -5,13 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
14
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
15
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
10
|
};
|
|
17
11
|
var __copyProps = (to, from, except, desc) => {
|
|
@@ -31,50 +25,73 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
25
|
mod
|
|
32
26
|
));
|
|
33
27
|
|
|
34
|
-
//
|
|
28
|
+
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
35
29
|
var require_picocolors = __commonJS({
|
|
36
|
-
"
|
|
37
|
-
var
|
|
38
|
-
var
|
|
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);
|
|
39
35
|
var formatter = (open, close, replace = open) => (input) => {
|
|
40
|
-
let string = "" + input;
|
|
41
|
-
let index = string.indexOf(close, open.length);
|
|
36
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
42
37
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
43
38
|
};
|
|
44
39
|
var replaceClose = (string, close, replace, index) => {
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
+
};
|
|
49
94
|
};
|
|
50
|
-
var createColors = (enabled = isColorSupported) => ({
|
|
51
|
-
isColorSupported: enabled,
|
|
52
|
-
reset: enabled ? (s) => `\x1B[0m${s}\x1B[0m` : String,
|
|
53
|
-
bold: enabled ? formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m") : String,
|
|
54
|
-
dim: enabled ? formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m") : String,
|
|
55
|
-
italic: enabled ? formatter("\x1B[3m", "\x1B[23m") : String,
|
|
56
|
-
underline: enabled ? formatter("\x1B[4m", "\x1B[24m") : String,
|
|
57
|
-
inverse: enabled ? formatter("\x1B[7m", "\x1B[27m") : String,
|
|
58
|
-
hidden: enabled ? formatter("\x1B[8m", "\x1B[28m") : String,
|
|
59
|
-
strikethrough: enabled ? formatter("\x1B[9m", "\x1B[29m") : String,
|
|
60
|
-
black: enabled ? formatter("\x1B[30m", "\x1B[39m") : String,
|
|
61
|
-
red: enabled ? formatter("\x1B[31m", "\x1B[39m") : String,
|
|
62
|
-
green: enabled ? formatter("\x1B[32m", "\x1B[39m") : String,
|
|
63
|
-
yellow: enabled ? formatter("\x1B[33m", "\x1B[39m") : String,
|
|
64
|
-
blue: enabled ? formatter("\x1B[34m", "\x1B[39m") : String,
|
|
65
|
-
magenta: enabled ? formatter("\x1B[35m", "\x1B[39m") : String,
|
|
66
|
-
cyan: enabled ? formatter("\x1B[36m", "\x1B[39m") : String,
|
|
67
|
-
white: enabled ? formatter("\x1B[37m", "\x1B[39m") : String,
|
|
68
|
-
gray: enabled ? formatter("\x1B[90m", "\x1B[39m") : String,
|
|
69
|
-
bgBlack: enabled ? formatter("\x1B[40m", "\x1B[49m") : String,
|
|
70
|
-
bgRed: enabled ? formatter("\x1B[41m", "\x1B[49m") : String,
|
|
71
|
-
bgGreen: enabled ? formatter("\x1B[42m", "\x1B[49m") : String,
|
|
72
|
-
bgYellow: enabled ? formatter("\x1B[43m", "\x1B[49m") : String,
|
|
73
|
-
bgBlue: enabled ? formatter("\x1B[44m", "\x1B[49m") : String,
|
|
74
|
-
bgMagenta: enabled ? formatter("\x1B[45m", "\x1B[49m") : String,
|
|
75
|
-
bgCyan: enabled ? formatter("\x1B[46m", "\x1B[49m") : String,
|
|
76
|
-
bgWhite: enabled ? formatter("\x1B[47m", "\x1B[49m") : String
|
|
77
|
-
});
|
|
78
95
|
module.exports = createColors();
|
|
79
96
|
module.exports.createColors = createColors;
|
|
80
97
|
}
|
|
@@ -82,7 +99,7 @@ var require_picocolors = __commonJS({
|
|
|
82
99
|
|
|
83
100
|
// src/cli.ts
|
|
84
101
|
var import_picocolors = __toESM(require_picocolors());
|
|
85
|
-
var VERSION = "0.0.
|
|
102
|
+
var VERSION = "0.0.84";
|
|
86
103
|
console.log(
|
|
87
104
|
`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Ami)")}`
|
|
88
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");
|