voice-page-agent 2.7.4 → 2.7.6
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/README.md +2 -0
- package/dist/index.cjs +268 -668
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +157 -60
- package/dist/{page-agent-H32WE3CG.js → page-agent-ZROQ54L4.js} +105 -580
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,17 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var process = require('process');
|
|
6
|
-
var os = require('os');
|
|
7
|
-
var tty = require('tty');
|
|
8
5
|
var vueDemi = require('vue-demi');
|
|
9
6
|
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var process__default = /*#__PURE__*/_interopDefault(process);
|
|
13
|
-
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
14
|
-
var tty__default = /*#__PURE__*/_interopDefault(tty);
|
|
15
|
-
|
|
16
7
|
var __defProp = Object.defineProperty;
|
|
17
8
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
18
9
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -25,514 +16,26 @@ var __export = (target, all) => {
|
|
|
25
16
|
};
|
|
26
17
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
27
18
|
|
|
28
|
-
//
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
group[styleName] = styles[styleName];
|
|
38
|
-
codes.set(style[0], style[1]);
|
|
39
|
-
}
|
|
40
|
-
Object.defineProperty(styles, groupName, {
|
|
41
|
-
value: group,
|
|
42
|
-
enumerable: false
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
Object.defineProperty(styles, "codes", {
|
|
46
|
-
value: codes,
|
|
47
|
-
enumerable: false
|
|
48
|
-
});
|
|
49
|
-
styles.color.close = "\x1B[39m";
|
|
50
|
-
styles.bgColor.close = "\x1B[49m";
|
|
51
|
-
styles.color.ansi = wrapAnsi16();
|
|
52
|
-
styles.color.ansi256 = wrapAnsi256();
|
|
53
|
-
styles.color.ansi16m = wrapAnsi16m();
|
|
54
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
55
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
56
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
57
|
-
Object.defineProperties(styles, {
|
|
58
|
-
rgbToAnsi256: {
|
|
59
|
-
value(red, green, blue) {
|
|
60
|
-
if (red === green && green === blue) {
|
|
61
|
-
if (red < 8) {
|
|
62
|
-
return 16;
|
|
63
|
-
}
|
|
64
|
-
if (red > 248) {
|
|
65
|
-
return 231;
|
|
66
|
-
}
|
|
67
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
68
|
-
}
|
|
69
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
70
|
-
},
|
|
71
|
-
enumerable: false
|
|
72
|
-
},
|
|
73
|
-
hexToRgb: {
|
|
74
|
-
value(hex3) {
|
|
75
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
|
|
76
|
-
if (!matches) {
|
|
77
|
-
return [0, 0, 0];
|
|
78
|
-
}
|
|
79
|
-
let [colorString] = matches;
|
|
80
|
-
if (colorString.length === 3) {
|
|
81
|
-
colorString = [...colorString].map((character) => character + character).join("");
|
|
82
|
-
}
|
|
83
|
-
const integer2 = Number.parseInt(colorString, 16);
|
|
84
|
-
return [
|
|
85
|
-
/* eslint-disable no-bitwise */
|
|
86
|
-
integer2 >> 16 & 255,
|
|
87
|
-
integer2 >> 8 & 255,
|
|
88
|
-
integer2 & 255
|
|
89
|
-
/* eslint-enable no-bitwise */
|
|
90
|
-
];
|
|
91
|
-
},
|
|
92
|
-
enumerable: false
|
|
93
|
-
},
|
|
94
|
-
hexToAnsi256: {
|
|
95
|
-
value: (hex3) => styles.rgbToAnsi256(...styles.hexToRgb(hex3)),
|
|
96
|
-
enumerable: false
|
|
97
|
-
},
|
|
98
|
-
ansi256ToAnsi: {
|
|
99
|
-
value(code) {
|
|
100
|
-
if (code < 8) {
|
|
101
|
-
return 30 + code;
|
|
102
|
-
}
|
|
103
|
-
if (code < 16) {
|
|
104
|
-
return 90 + (code - 8);
|
|
105
|
-
}
|
|
106
|
-
let red;
|
|
107
|
-
let green;
|
|
108
|
-
let blue;
|
|
109
|
-
if (code >= 232) {
|
|
110
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
111
|
-
green = red;
|
|
112
|
-
blue = red;
|
|
113
|
-
} else {
|
|
114
|
-
code -= 16;
|
|
115
|
-
const remainder = code % 36;
|
|
116
|
-
red = Math.floor(code / 36) / 5;
|
|
117
|
-
green = Math.floor(remainder / 6) / 5;
|
|
118
|
-
blue = remainder % 6 / 5;
|
|
119
|
-
}
|
|
120
|
-
const value = Math.max(red, green, blue) * 2;
|
|
121
|
-
if (value === 0) {
|
|
122
|
-
return 30;
|
|
123
|
-
}
|
|
124
|
-
let result2 = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
125
|
-
if (value === 2) {
|
|
126
|
-
result2 += 60;
|
|
127
|
-
}
|
|
128
|
-
return result2;
|
|
129
|
-
},
|
|
130
|
-
enumerable: false
|
|
131
|
-
},
|
|
132
|
-
rgbToAnsi: {
|
|
133
|
-
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
134
|
-
enumerable: false
|
|
19
|
+
// src/shims/chalk.ts
|
|
20
|
+
function joinArgs(args) {
|
|
21
|
+
return args.map((item) => String(item)).join(" ");
|
|
22
|
+
}
|
|
23
|
+
function createChalk() {
|
|
24
|
+
const base = ((...args) => joinArgs(args));
|
|
25
|
+
return new Proxy(base, {
|
|
26
|
+
get() {
|
|
27
|
+
return createChalk();
|
|
135
28
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
enumerable: false
|
|
29
|
+
apply(_, __, args) {
|
|
30
|
+
return joinArgs(args);
|
|
139
31
|
}
|
|
140
32
|
});
|
|
141
|
-
return styles;
|
|
142
|
-
}
|
|
143
|
-
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, foregroundColorNames, backgroundColorNames, ansiStyles, ansi_styles_default;
|
|
144
|
-
var init_ansi_styles = __esm({
|
|
145
|
-
"node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
|
146
|
-
ANSI_BACKGROUND_OFFSET = 10;
|
|
147
|
-
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
148
|
-
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
149
|
-
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
150
|
-
styles = {
|
|
151
|
-
modifier: {
|
|
152
|
-
reset: [0, 0],
|
|
153
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
154
|
-
bold: [1, 22],
|
|
155
|
-
dim: [2, 22],
|
|
156
|
-
italic: [3, 23],
|
|
157
|
-
underline: [4, 24],
|
|
158
|
-
overline: [53, 55],
|
|
159
|
-
inverse: [7, 27],
|
|
160
|
-
hidden: [8, 28],
|
|
161
|
-
strikethrough: [9, 29]
|
|
162
|
-
},
|
|
163
|
-
color: {
|
|
164
|
-
black: [30, 39],
|
|
165
|
-
red: [31, 39],
|
|
166
|
-
green: [32, 39],
|
|
167
|
-
yellow: [33, 39],
|
|
168
|
-
blue: [34, 39],
|
|
169
|
-
magenta: [35, 39],
|
|
170
|
-
cyan: [36, 39],
|
|
171
|
-
white: [37, 39],
|
|
172
|
-
// Bright color
|
|
173
|
-
blackBright: [90, 39],
|
|
174
|
-
gray: [90, 39],
|
|
175
|
-
// Alias of `blackBright`
|
|
176
|
-
grey: [90, 39],
|
|
177
|
-
// Alias of `blackBright`
|
|
178
|
-
redBright: [91, 39],
|
|
179
|
-
greenBright: [92, 39],
|
|
180
|
-
yellowBright: [93, 39],
|
|
181
|
-
blueBright: [94, 39],
|
|
182
|
-
magentaBright: [95, 39],
|
|
183
|
-
cyanBright: [96, 39],
|
|
184
|
-
whiteBright: [97, 39]
|
|
185
|
-
},
|
|
186
|
-
bgColor: {
|
|
187
|
-
bgBlack: [40, 49],
|
|
188
|
-
bgRed: [41, 49],
|
|
189
|
-
bgGreen: [42, 49],
|
|
190
|
-
bgYellow: [43, 49],
|
|
191
|
-
bgBlue: [44, 49],
|
|
192
|
-
bgMagenta: [45, 49],
|
|
193
|
-
bgCyan: [46, 49],
|
|
194
|
-
bgWhite: [47, 49],
|
|
195
|
-
// Bright color
|
|
196
|
-
bgBlackBright: [100, 49],
|
|
197
|
-
bgGray: [100, 49],
|
|
198
|
-
// Alias of `bgBlackBright`
|
|
199
|
-
bgGrey: [100, 49],
|
|
200
|
-
// Alias of `bgBlackBright`
|
|
201
|
-
bgRedBright: [101, 49],
|
|
202
|
-
bgGreenBright: [102, 49],
|
|
203
|
-
bgYellowBright: [103, 49],
|
|
204
|
-
bgBlueBright: [104, 49],
|
|
205
|
-
bgMagentaBright: [105, 49],
|
|
206
|
-
bgCyanBright: [106, 49],
|
|
207
|
-
bgWhiteBright: [107, 49]
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
Object.keys(styles.modifier);
|
|
211
|
-
foregroundColorNames = Object.keys(styles.color);
|
|
212
|
-
backgroundColorNames = Object.keys(styles.bgColor);
|
|
213
|
-
[...foregroundColorNames, ...backgroundColorNames];
|
|
214
|
-
ansiStyles = assembleStyles();
|
|
215
|
-
ansi_styles_default = ansiStyles;
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process__default.default.argv) {
|
|
219
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
220
|
-
const position = argv.indexOf(prefix + flag);
|
|
221
|
-
const terminatorPosition = argv.indexOf("--");
|
|
222
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
223
|
-
}
|
|
224
|
-
function envForceColor() {
|
|
225
|
-
if ("FORCE_COLOR" in env) {
|
|
226
|
-
if (env.FORCE_COLOR === "true") {
|
|
227
|
-
return 1;
|
|
228
|
-
}
|
|
229
|
-
if (env.FORCE_COLOR === "false") {
|
|
230
|
-
return 0;
|
|
231
|
-
}
|
|
232
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function translateLevel(level) {
|
|
236
|
-
if (level === 0) {
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
239
|
-
return {
|
|
240
|
-
level,
|
|
241
|
-
hasBasic: true,
|
|
242
|
-
has256: level >= 2,
|
|
243
|
-
has16m: level >= 3
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
247
|
-
const noFlagForceColor = envForceColor();
|
|
248
|
-
if (noFlagForceColor !== void 0) {
|
|
249
|
-
flagForceColor = noFlagForceColor;
|
|
250
|
-
}
|
|
251
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
252
|
-
if (forceColor === 0) {
|
|
253
|
-
return 0;
|
|
254
|
-
}
|
|
255
|
-
if (sniffFlags) {
|
|
256
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
257
|
-
return 3;
|
|
258
|
-
}
|
|
259
|
-
if (hasFlag("color=256")) {
|
|
260
|
-
return 2;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
264
|
-
return 1;
|
|
265
|
-
}
|
|
266
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
267
|
-
return 0;
|
|
268
|
-
}
|
|
269
|
-
const min = forceColor || 0;
|
|
270
|
-
if (env.TERM === "dumb") {
|
|
271
|
-
return min;
|
|
272
|
-
}
|
|
273
|
-
if (process__default.default.platform === "win32") {
|
|
274
|
-
const osRelease = os__default.default.release().split(".");
|
|
275
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
276
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
277
|
-
}
|
|
278
|
-
return 1;
|
|
279
|
-
}
|
|
280
|
-
if ("CI" in env) {
|
|
281
|
-
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
282
|
-
return 3;
|
|
283
|
-
}
|
|
284
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
285
|
-
return 1;
|
|
286
|
-
}
|
|
287
|
-
return min;
|
|
288
|
-
}
|
|
289
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
290
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
291
|
-
}
|
|
292
|
-
if (env.COLORTERM === "truecolor") {
|
|
293
|
-
return 3;
|
|
294
|
-
}
|
|
295
|
-
if (env.TERM === "xterm-kitty") {
|
|
296
|
-
return 3;
|
|
297
|
-
}
|
|
298
|
-
if (env.TERM === "xterm-ghostty") {
|
|
299
|
-
return 3;
|
|
300
|
-
}
|
|
301
|
-
if (env.TERM === "wezterm") {
|
|
302
|
-
return 3;
|
|
303
|
-
}
|
|
304
|
-
if ("TERM_PROGRAM" in env) {
|
|
305
|
-
const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
306
|
-
switch (env.TERM_PROGRAM) {
|
|
307
|
-
case "iTerm.app": {
|
|
308
|
-
return version2 >= 3 ? 3 : 2;
|
|
309
|
-
}
|
|
310
|
-
case "Apple_Terminal": {
|
|
311
|
-
return 2;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
316
|
-
return 2;
|
|
317
|
-
}
|
|
318
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
319
|
-
return 1;
|
|
320
|
-
}
|
|
321
|
-
if ("COLORTERM" in env) {
|
|
322
|
-
return 1;
|
|
323
|
-
}
|
|
324
|
-
return min;
|
|
325
33
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
...options
|
|
330
|
-
});
|
|
331
|
-
return translateLevel(level);
|
|
332
|
-
}
|
|
333
|
-
var env, flagForceColor, supportsColor, supports_color_default;
|
|
334
|
-
var init_supports_color = __esm({
|
|
335
|
-
"node_modules/chalk/source/vendor/supports-color/index.js"() {
|
|
336
|
-
({ env } = process__default.default);
|
|
337
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
338
|
-
flagForceColor = 0;
|
|
339
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
340
|
-
flagForceColor = 1;
|
|
341
|
-
}
|
|
342
|
-
supportsColor = {
|
|
343
|
-
stdout: createSupportsColor({ isTTY: tty__default.default.isatty(1) }),
|
|
344
|
-
stderr: createSupportsColor({ isTTY: tty__default.default.isatty(2) })
|
|
345
|
-
};
|
|
346
|
-
supports_color_default = supportsColor;
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
// node_modules/chalk/source/utilities.js
|
|
351
|
-
function stringReplaceAll(string4, substring, replacer) {
|
|
352
|
-
let index = string4.indexOf(substring);
|
|
353
|
-
if (index === -1) {
|
|
354
|
-
return string4;
|
|
355
|
-
}
|
|
356
|
-
const substringLength = substring.length;
|
|
357
|
-
let endIndex = 0;
|
|
358
|
-
let returnValue = "";
|
|
359
|
-
do {
|
|
360
|
-
returnValue += string4.slice(endIndex, index) + substring + replacer;
|
|
361
|
-
endIndex = index + substringLength;
|
|
362
|
-
index = string4.indexOf(substring, endIndex);
|
|
363
|
-
} while (index !== -1);
|
|
364
|
-
returnValue += string4.slice(endIndex);
|
|
365
|
-
return returnValue;
|
|
366
|
-
}
|
|
367
|
-
function stringEncaseCRLFWithFirstIndex(string4, prefix, postfix, index) {
|
|
368
|
-
let endIndex = 0;
|
|
369
|
-
let returnValue = "";
|
|
370
|
-
do {
|
|
371
|
-
const gotCR = string4[index - 1] === "\r";
|
|
372
|
-
returnValue += string4.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
373
|
-
endIndex = index + 1;
|
|
374
|
-
index = string4.indexOf("\n", endIndex);
|
|
375
|
-
} while (index !== -1);
|
|
376
|
-
returnValue += string4.slice(endIndex);
|
|
377
|
-
return returnValue;
|
|
378
|
-
}
|
|
379
|
-
var init_utilities = __esm({
|
|
380
|
-
"node_modules/chalk/source/utilities.js"() {
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
// node_modules/chalk/source/index.js
|
|
385
|
-
function createChalk(options) {
|
|
386
|
-
return chalkFactory(options);
|
|
387
|
-
}
|
|
388
|
-
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, source_default;
|
|
389
|
-
var init_source = __esm({
|
|
390
|
-
"node_modules/chalk/source/index.js"() {
|
|
391
|
-
init_ansi_styles();
|
|
392
|
-
init_supports_color();
|
|
393
|
-
init_utilities();
|
|
394
|
-
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
|
|
395
|
-
GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
396
|
-
STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
397
|
-
IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
398
|
-
levelMapping = [
|
|
399
|
-
"ansi",
|
|
400
|
-
"ansi",
|
|
401
|
-
"ansi256",
|
|
402
|
-
"ansi16m"
|
|
403
|
-
];
|
|
404
|
-
styles2 = /* @__PURE__ */ Object.create(null);
|
|
405
|
-
applyOptions = (object2, options = {}) => {
|
|
406
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
407
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
408
|
-
}
|
|
409
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
410
|
-
object2.level = options.level === void 0 ? colorLevel : options.level;
|
|
411
|
-
};
|
|
412
|
-
chalkFactory = (options) => {
|
|
413
|
-
const chalk2 = (...strings) => strings.join(" ");
|
|
414
|
-
applyOptions(chalk2, options);
|
|
415
|
-
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
416
|
-
return chalk2;
|
|
417
|
-
};
|
|
418
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
419
|
-
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
420
|
-
styles2[styleName] = {
|
|
421
|
-
get() {
|
|
422
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
423
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
424
|
-
return builder;
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
styles2.visible = {
|
|
429
|
-
get() {
|
|
430
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
431
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
432
|
-
return builder;
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
getModelAnsi = (model, level, type, ...arguments_) => {
|
|
436
|
-
if (model === "rgb") {
|
|
437
|
-
if (level === "ansi16m") {
|
|
438
|
-
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
439
|
-
}
|
|
440
|
-
if (level === "ansi256") {
|
|
441
|
-
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
442
|
-
}
|
|
443
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
444
|
-
}
|
|
445
|
-
if (model === "hex") {
|
|
446
|
-
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
447
|
-
}
|
|
448
|
-
return ansi_styles_default[type][model](...arguments_);
|
|
449
|
-
};
|
|
450
|
-
usedModels = ["rgb", "hex", "ansi256"];
|
|
451
|
-
for (const model of usedModels) {
|
|
452
|
-
styles2[model] = {
|
|
453
|
-
get() {
|
|
454
|
-
const { level } = this;
|
|
455
|
-
return function(...arguments_) {
|
|
456
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
457
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
462
|
-
styles2[bgModel] = {
|
|
463
|
-
get() {
|
|
464
|
-
const { level } = this;
|
|
465
|
-
return function(...arguments_) {
|
|
466
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
467
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
proto = Object.defineProperties(() => {
|
|
473
|
-
}, {
|
|
474
|
-
...styles2,
|
|
475
|
-
level: {
|
|
476
|
-
enumerable: true,
|
|
477
|
-
get() {
|
|
478
|
-
return this[GENERATOR].level;
|
|
479
|
-
},
|
|
480
|
-
set(level) {
|
|
481
|
-
this[GENERATOR].level = level;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
createStyler = (open, close, parent) => {
|
|
486
|
-
let openAll;
|
|
487
|
-
let closeAll;
|
|
488
|
-
if (parent === void 0) {
|
|
489
|
-
openAll = open;
|
|
490
|
-
closeAll = close;
|
|
491
|
-
} else {
|
|
492
|
-
openAll = parent.openAll + open;
|
|
493
|
-
closeAll = close + parent.closeAll;
|
|
494
|
-
}
|
|
495
|
-
return {
|
|
496
|
-
open,
|
|
497
|
-
close,
|
|
498
|
-
openAll,
|
|
499
|
-
closeAll,
|
|
500
|
-
parent
|
|
501
|
-
};
|
|
502
|
-
};
|
|
503
|
-
createBuilder = (self, _styler, _isEmpty) => {
|
|
504
|
-
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
505
|
-
Object.setPrototypeOf(builder, proto);
|
|
506
|
-
builder[GENERATOR] = self;
|
|
507
|
-
builder[STYLER] = _styler;
|
|
508
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
509
|
-
return builder;
|
|
510
|
-
};
|
|
511
|
-
applyStyle = (self, string4) => {
|
|
512
|
-
if (self.level <= 0 || !string4) {
|
|
513
|
-
return self[IS_EMPTY] ? "" : string4;
|
|
514
|
-
}
|
|
515
|
-
let styler = self[STYLER];
|
|
516
|
-
if (styler === void 0) {
|
|
517
|
-
return string4;
|
|
518
|
-
}
|
|
519
|
-
const { openAll, closeAll } = styler;
|
|
520
|
-
if (string4.includes("\x1B")) {
|
|
521
|
-
while (styler !== void 0) {
|
|
522
|
-
string4 = stringReplaceAll(string4, styler.close, styler.open);
|
|
523
|
-
styler = styler.parent;
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
const lfIndex = string4.indexOf("\n");
|
|
527
|
-
if (lfIndex !== -1) {
|
|
528
|
-
string4 = stringEncaseCRLFWithFirstIndex(string4, closeAll, openAll, lfIndex);
|
|
529
|
-
}
|
|
530
|
-
return openAll + string4 + closeAll;
|
|
531
|
-
};
|
|
532
|
-
Object.defineProperties(createChalk.prototype, styles2);
|
|
34
|
+
var chalk, chalk_default;
|
|
35
|
+
var init_chalk = __esm({
|
|
36
|
+
"src/shims/chalk.ts"() {
|
|
533
37
|
chalk = createChalk();
|
|
534
|
-
|
|
535
|
-
source_default = chalk;
|
|
38
|
+
chalk_default = chalk;
|
|
536
39
|
}
|
|
537
40
|
});
|
|
538
41
|
|
|
@@ -556,12 +59,12 @@ function $constructor(name, initializer3, params) {
|
|
|
556
59
|
}
|
|
557
60
|
inst._zod.traits.add(name);
|
|
558
61
|
initializer3(inst, def);
|
|
559
|
-
const
|
|
560
|
-
const keys = Object.keys(
|
|
62
|
+
const proto = _.prototype;
|
|
63
|
+
const keys = Object.keys(proto);
|
|
561
64
|
for (let i = 0; i < keys.length; i++) {
|
|
562
65
|
const k = keys[i];
|
|
563
66
|
if (!(k in inst)) {
|
|
564
|
-
inst[k] =
|
|
67
|
+
inst[k] = proto[k].bind(inst);
|
|
565
68
|
}
|
|
566
69
|
}
|
|
567
70
|
}
|
|
@@ -11534,7 +11037,7 @@ function initializeContext(params) {
|
|
|
11534
11037
|
external: (_i = params == null ? void 0 : params.external) != null ? _i : void 0
|
|
11535
11038
|
};
|
|
11536
11039
|
}
|
|
11537
|
-
function
|
|
11040
|
+
function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
11538
11041
|
var _a4, _b, _c;
|
|
11539
11042
|
var _a3;
|
|
11540
11043
|
const def = schema._zod.def;
|
|
@@ -11572,7 +11075,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
11572
11075
|
if (parent) {
|
|
11573
11076
|
if (!result2.ref)
|
|
11574
11077
|
result2.ref = parent;
|
|
11575
|
-
|
|
11078
|
+
process(parent, ctx, params);
|
|
11576
11079
|
ctx.seen.get(parent).isParent = true;
|
|
11577
11080
|
}
|
|
11578
11081
|
}
|
|
@@ -11858,14 +11361,14 @@ var init_to_json_schema = __esm({
|
|
|
11858
11361
|
init_registries();
|
|
11859
11362
|
createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
11860
11363
|
const ctx = initializeContext({ ...params, processors });
|
|
11861
|
-
|
|
11364
|
+
process(schema, ctx);
|
|
11862
11365
|
extractDefs(ctx, schema);
|
|
11863
11366
|
return finalize(ctx, schema);
|
|
11864
11367
|
};
|
|
11865
11368
|
createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
11866
11369
|
const { libraryOptions, target } = params != null ? params : {};
|
|
11867
11370
|
const ctx = initializeContext({ ...libraryOptions != null ? libraryOptions : {}, target, io, processors });
|
|
11868
|
-
|
|
11371
|
+
process(schema, ctx);
|
|
11869
11372
|
extractDefs(ctx, schema);
|
|
11870
11373
|
return finalize(ctx, schema);
|
|
11871
11374
|
};
|
|
@@ -11880,7 +11383,7 @@ function toJSONSchema(input2, params) {
|
|
|
11880
11383
|
const defs = {};
|
|
11881
11384
|
for (const entry of registry2._idmap.entries()) {
|
|
11882
11385
|
const [_, schema] = entry;
|
|
11883
|
-
|
|
11386
|
+
process(schema, ctx2);
|
|
11884
11387
|
}
|
|
11885
11388
|
const schemas = {};
|
|
11886
11389
|
const external = {
|
|
@@ -11903,7 +11406,7 @@ function toJSONSchema(input2, params) {
|
|
|
11903
11406
|
return { schemas };
|
|
11904
11407
|
}
|
|
11905
11408
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
11906
|
-
|
|
11409
|
+
process(input2, ctx);
|
|
11907
11410
|
extractDefs(ctx, input2);
|
|
11908
11411
|
return finalize(ctx, input2);
|
|
11909
11412
|
}
|
|
@@ -12162,7 +11665,7 @@ var init_json_schema_processors = __esm({
|
|
|
12162
11665
|
if (typeof maximum === "number")
|
|
12163
11666
|
json2.maxItems = maximum;
|
|
12164
11667
|
json2.type = "array";
|
|
12165
|
-
json2.items =
|
|
11668
|
+
json2.items = process(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
12166
11669
|
};
|
|
12167
11670
|
objectProcessor = (schema, ctx, _json, params) => {
|
|
12168
11671
|
var _a3;
|
|
@@ -12172,7 +11675,7 @@ var init_json_schema_processors = __esm({
|
|
|
12172
11675
|
json2.properties = {};
|
|
12173
11676
|
const shape = def.shape;
|
|
12174
11677
|
for (const key in shape) {
|
|
12175
|
-
json2.properties[key] =
|
|
11678
|
+
json2.properties[key] = process(shape[key], ctx, {
|
|
12176
11679
|
...params,
|
|
12177
11680
|
path: [...params.path, "properties", key]
|
|
12178
11681
|
});
|
|
@@ -12195,7 +11698,7 @@ var init_json_schema_processors = __esm({
|
|
|
12195
11698
|
if (ctx.io === "output")
|
|
12196
11699
|
json2.additionalProperties = false;
|
|
12197
11700
|
} else if (def.catchall) {
|
|
12198
|
-
json2.additionalProperties =
|
|
11701
|
+
json2.additionalProperties = process(def.catchall, ctx, {
|
|
12199
11702
|
...params,
|
|
12200
11703
|
path: [...params.path, "additionalProperties"]
|
|
12201
11704
|
});
|
|
@@ -12204,7 +11707,7 @@ var init_json_schema_processors = __esm({
|
|
|
12204
11707
|
unionProcessor = (schema, ctx, json2, params) => {
|
|
12205
11708
|
const def = schema._zod.def;
|
|
12206
11709
|
const isExclusive = def.inclusive === false;
|
|
12207
|
-
const options = def.options.map((x, i) =>
|
|
11710
|
+
const options = def.options.map((x, i) => process(x, ctx, {
|
|
12208
11711
|
...params,
|
|
12209
11712
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
12210
11713
|
}));
|
|
@@ -12216,11 +11719,11 @@ var init_json_schema_processors = __esm({
|
|
|
12216
11719
|
};
|
|
12217
11720
|
intersectionProcessor = (schema, ctx, json2, params) => {
|
|
12218
11721
|
const def = schema._zod.def;
|
|
12219
|
-
const a =
|
|
11722
|
+
const a = process(def.left, ctx, {
|
|
12220
11723
|
...params,
|
|
12221
11724
|
path: [...params.path, "allOf", 0]
|
|
12222
11725
|
});
|
|
12223
|
-
const b =
|
|
11726
|
+
const b = process(def.right, ctx, {
|
|
12224
11727
|
...params,
|
|
12225
11728
|
path: [...params.path, "allOf", 1]
|
|
12226
11729
|
});
|
|
@@ -12237,11 +11740,11 @@ var init_json_schema_processors = __esm({
|
|
|
12237
11740
|
json2.type = "array";
|
|
12238
11741
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
12239
11742
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
12240
|
-
const prefixItems = def.items.map((x, i) =>
|
|
11743
|
+
const prefixItems = def.items.map((x, i) => process(x, ctx, {
|
|
12241
11744
|
...params,
|
|
12242
11745
|
path: [...params.path, prefixPath, i]
|
|
12243
11746
|
}));
|
|
12244
|
-
const rest = def.rest ?
|
|
11747
|
+
const rest = def.rest ? process(def.rest, ctx, {
|
|
12245
11748
|
...params,
|
|
12246
11749
|
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
12247
11750
|
}) : null;
|
|
@@ -12281,7 +11784,7 @@ var init_json_schema_processors = __esm({
|
|
|
12281
11784
|
const keyBag = keyType._zod.bag;
|
|
12282
11785
|
const patterns = keyBag == null ? void 0 : keyBag.patterns;
|
|
12283
11786
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
12284
|
-
const valueSchema =
|
|
11787
|
+
const valueSchema = process(def.valueType, ctx, {
|
|
12285
11788
|
...params,
|
|
12286
11789
|
path: [...params.path, "patternProperties", "*"]
|
|
12287
11790
|
});
|
|
@@ -12291,12 +11794,12 @@ var init_json_schema_processors = __esm({
|
|
|
12291
11794
|
}
|
|
12292
11795
|
} else {
|
|
12293
11796
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
12294
|
-
json2.propertyNames =
|
|
11797
|
+
json2.propertyNames = process(def.keyType, ctx, {
|
|
12295
11798
|
...params,
|
|
12296
11799
|
path: [...params.path, "propertyNames"]
|
|
12297
11800
|
});
|
|
12298
11801
|
}
|
|
12299
|
-
json2.additionalProperties =
|
|
11802
|
+
json2.additionalProperties = process(def.valueType, ctx, {
|
|
12300
11803
|
...params,
|
|
12301
11804
|
path: [...params.path, "additionalProperties"]
|
|
12302
11805
|
});
|
|
@@ -12311,7 +11814,7 @@ var init_json_schema_processors = __esm({
|
|
|
12311
11814
|
};
|
|
12312
11815
|
nullableProcessor = (schema, ctx, json2, params) => {
|
|
12313
11816
|
const def = schema._zod.def;
|
|
12314
|
-
const inner =
|
|
11817
|
+
const inner = process(def.innerType, ctx, params);
|
|
12315
11818
|
const seen = ctx.seen.get(schema);
|
|
12316
11819
|
if (ctx.target === "openapi-3.0") {
|
|
12317
11820
|
seen.ref = def.innerType;
|
|
@@ -12322,20 +11825,20 @@ var init_json_schema_processors = __esm({
|
|
|
12322
11825
|
};
|
|
12323
11826
|
nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
12324
11827
|
const def = schema._zod.def;
|
|
12325
|
-
|
|
11828
|
+
process(def.innerType, ctx, params);
|
|
12326
11829
|
const seen = ctx.seen.get(schema);
|
|
12327
11830
|
seen.ref = def.innerType;
|
|
12328
11831
|
};
|
|
12329
11832
|
defaultProcessor = (schema, ctx, json2, params) => {
|
|
12330
11833
|
const def = schema._zod.def;
|
|
12331
|
-
|
|
11834
|
+
process(def.innerType, ctx, params);
|
|
12332
11835
|
const seen = ctx.seen.get(schema);
|
|
12333
11836
|
seen.ref = def.innerType;
|
|
12334
11837
|
json2.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
12335
11838
|
};
|
|
12336
11839
|
prefaultProcessor = (schema, ctx, json2, params) => {
|
|
12337
11840
|
const def = schema._zod.def;
|
|
12338
|
-
|
|
11841
|
+
process(def.innerType, ctx, params);
|
|
12339
11842
|
const seen = ctx.seen.get(schema);
|
|
12340
11843
|
seen.ref = def.innerType;
|
|
12341
11844
|
if (ctx.io === "input")
|
|
@@ -12343,7 +11846,7 @@ var init_json_schema_processors = __esm({
|
|
|
12343
11846
|
};
|
|
12344
11847
|
catchProcessor = (schema, ctx, json2, params) => {
|
|
12345
11848
|
const def = schema._zod.def;
|
|
12346
|
-
|
|
11849
|
+
process(def.innerType, ctx, params);
|
|
12347
11850
|
const seen = ctx.seen.get(schema);
|
|
12348
11851
|
seen.ref = def.innerType;
|
|
12349
11852
|
let catchValue;
|
|
@@ -12357,32 +11860,32 @@ var init_json_schema_processors = __esm({
|
|
|
12357
11860
|
pipeProcessor = (schema, ctx, _json, params) => {
|
|
12358
11861
|
const def = schema._zod.def;
|
|
12359
11862
|
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
12360
|
-
|
|
11863
|
+
process(innerType, ctx, params);
|
|
12361
11864
|
const seen = ctx.seen.get(schema);
|
|
12362
11865
|
seen.ref = innerType;
|
|
12363
11866
|
};
|
|
12364
11867
|
readonlyProcessor = (schema, ctx, json2, params) => {
|
|
12365
11868
|
const def = schema._zod.def;
|
|
12366
|
-
|
|
11869
|
+
process(def.innerType, ctx, params);
|
|
12367
11870
|
const seen = ctx.seen.get(schema);
|
|
12368
11871
|
seen.ref = def.innerType;
|
|
12369
11872
|
json2.readOnly = true;
|
|
12370
11873
|
};
|
|
12371
11874
|
promiseProcessor = (schema, ctx, _json, params) => {
|
|
12372
11875
|
const def = schema._zod.def;
|
|
12373
|
-
|
|
11876
|
+
process(def.innerType, ctx, params);
|
|
12374
11877
|
const seen = ctx.seen.get(schema);
|
|
12375
11878
|
seen.ref = def.innerType;
|
|
12376
11879
|
};
|
|
12377
11880
|
optionalProcessor = (schema, ctx, _json, params) => {
|
|
12378
11881
|
const def = schema._zod.def;
|
|
12379
|
-
|
|
11882
|
+
process(def.innerType, ctx, params);
|
|
12380
11883
|
const seen = ctx.seen.get(schema);
|
|
12381
11884
|
seen.ref = def.innerType;
|
|
12382
11885
|
};
|
|
12383
11886
|
lazyProcessor = (schema, ctx, _json, params) => {
|
|
12384
11887
|
const innerType = schema._zod.innerType;
|
|
12385
|
-
|
|
11888
|
+
process(innerType, ctx, params);
|
|
12386
11889
|
const seen = ctx.seen.get(schema);
|
|
12387
11890
|
seen.ref = innerType;
|
|
12388
11891
|
};
|
|
@@ -12489,7 +11992,7 @@ var init_json_schema_generator = __esm({
|
|
|
12489
11992
|
* This must be called before emit().
|
|
12490
11993
|
*/
|
|
12491
11994
|
process(schema, _params = { path: [], schemaPath: [] }) {
|
|
12492
|
-
return
|
|
11995
|
+
return process(schema, this.ctx, _params);
|
|
12493
11996
|
}
|
|
12494
11997
|
/**
|
|
12495
11998
|
* Emit the final JSON Schema after processing.
|
|
@@ -12782,7 +12285,7 @@ __export(core_exports2, {
|
|
|
12782
12285
|
parse: () => parse,
|
|
12783
12286
|
parseAsync: () => parseAsync,
|
|
12784
12287
|
prettifyError: () => prettifyError,
|
|
12785
|
-
process: () =>
|
|
12288
|
+
process: () => process,
|
|
12786
12289
|
regexes: () => regexes_exports,
|
|
12787
12290
|
registry: () => registry,
|
|
12788
12291
|
safeDecode: () => safeDecode,
|
|
@@ -15061,7 +14564,7 @@ var init_zod = __esm({
|
|
|
15061
14564
|
|
|
15062
14565
|
// node_modules/@page-agent/llms/dist/lib/page-agent-llms.js
|
|
15063
14566
|
function debug(message) {
|
|
15064
|
-
console.debug(
|
|
14567
|
+
console.debug(chalk_default.gray("[LLM]"), message);
|
|
15065
14568
|
}
|
|
15066
14569
|
function zodToOpenAITool(name, tool2) {
|
|
15067
14570
|
return {
|
|
@@ -15171,7 +14674,7 @@ async function withRetry(fn, settings) {
|
|
|
15171
14674
|
var __defProp2, __name, InvokeErrorType, _InvokeError, InvokeError, _OpenAIClient, OpenAIClient, LLM_MAX_RETRIES, DEFAULT_TEMPERATURE, _LLM, LLM;
|
|
15172
14675
|
var init_page_agent_llms = __esm({
|
|
15173
14676
|
"node_modules/@page-agent/llms/dist/lib/page-agent-llms.js"() {
|
|
15174
|
-
|
|
14677
|
+
init_chalk();
|
|
15175
14678
|
init_zod();
|
|
15176
14679
|
__defProp2 = Object.defineProperty;
|
|
15177
14680
|
__name = (target, value) => __defProp2(target, "name", { value, configurable: true });
|
|
@@ -16720,7 +16223,7 @@ function patchReact(pageController) {
|
|
|
16720
16223
|
element.setAttribute("data-page-agent-not-interactive", "true");
|
|
16721
16224
|
}
|
|
16722
16225
|
}
|
|
16723
|
-
var __defProp3, __typeError, __defNormalProp2, __name2, __publicField2, __accessCheck, __privateGet, __privateAdd, __privateSet, __privateMethod, _cursor, _currentCursorX, _currentCursorY, _targetCursorX, _targetCursorY, _SimulatorMask_instances, createCursor_fn, moveCursorToTarget_fn, lastClickedElement, nativeInputValueSetter, nativeTextAreaValueSetter, VIEWPORT_EXPANSION, domTree, newElementsCache, getAllTextTillNextClickableElement, navigation, wrapper,
|
|
16226
|
+
var __defProp3, __typeError, __defNormalProp2, __name2, __publicField2, __accessCheck, __privateGet, __privateAdd, __privateSet, __privateMethod, _cursor, _currentCursorX, _currentCursorY, _targetCursorX, _targetCursorY, _SimulatorMask_instances, createCursor_fn, moveCursorToTarget_fn, lastClickedElement, nativeInputValueSetter, nativeTextAreaValueSetter, VIEWPORT_EXPANSION, domTree, newElementsCache, getAllTextTillNextClickableElement, navigation, wrapper, styles, cursor, cursorBorder, cursorFilling, cursorRipple, clicking, cursorStyles, _SimulatorMask, SimulatorMask, _PageController, PageController;
|
|
16724
16227
|
var init_page_controller = __esm({
|
|
16725
16228
|
"node_modules/@page-agent/page-controller/dist/lib/page-controller.js"() {
|
|
16726
16229
|
init_Motion();
|
|
@@ -17852,7 +17355,7 @@ var init_page_controller = __esm({
|
|
|
17852
17355
|
__name2(isBackgroundDark, "isBackgroundDark");
|
|
17853
17356
|
__name2(isPageDark, "isPageDark");
|
|
17854
17357
|
wrapper = "_wrapper_1oy2s_1";
|
|
17855
|
-
|
|
17358
|
+
styles = {
|
|
17856
17359
|
wrapper
|
|
17857
17360
|
};
|
|
17858
17361
|
cursor = "_cursor_1vrf3_2";
|
|
@@ -17884,7 +17387,7 @@ var init_page_controller = __esm({
|
|
|
17884
17387
|
__privateAdd(this, _targetCursorX, 0);
|
|
17885
17388
|
__privateAdd(this, _targetCursorY, 0);
|
|
17886
17389
|
this.wrapper.id = "page-agent-runtime_simulator-mask";
|
|
17887
|
-
this.wrapper.className =
|
|
17390
|
+
this.wrapper.className = styles.wrapper;
|
|
17888
17391
|
this.wrapper.setAttribute("data-browser-use-ignore", "true");
|
|
17889
17392
|
this.wrapper.appendChild(this.motion.element);
|
|
17890
17393
|
this.motion.autoResize(this.wrapper);
|
|
@@ -18277,7 +17780,7 @@ function truncate(text, maxLength) {
|
|
|
18277
17780
|
function escapeHtml(text) {
|
|
18278
17781
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
18279
17782
|
}
|
|
18280
|
-
var __defProp4, __typeError2, __name3, __accessCheck2, __privateGet2, __privateAdd2, __privateSet2, __privateMethod2, _wrapper, _indicator, _statusText, _historySection, _expandButton, _stopButton, _inputSection, _taskInput, _state, _isExpanded, _config, _i18n, _userAnswerResolver, _isWaitingForUserAnswer, _headerUpdateTimer, _pendingHeaderText, _isAnimating, _Panel_instances, toStepData_fn, getToolExecutingText_fn, getToolCompletedText_fn, updateInternal_fn, stopAgent_fn, submitTask_fn, handleUserAnswer_fn, showInputArea_fn, hideInputArea_fn, shouldShowInputArea_fn, createWrapper_fn, setupEventListeners_fn, toggle_fn, expand_fn, collapse_fn, startHeaderUpdateLoop_fn, stopHeaderUpdateLoop_fn, checkAndUpdateHeader_fn, animateTextChange_fn, updateStatusIndicator_fn, updateHistory_fn, scrollToBottom_fn, createHistoryItem_fn, _UIState, UIState, enUS, zhCN, locales, _I18n, I18n, wrapper2, background, header, pulse, retryPulse, statusTextFadeOut, statusTextFadeIn, statusSection, indicator, thinking, tool_executing, retry, completed, input, output, error48, statusText, fadeOut, fadeIn, controls, controlButton, stopButton, historySectionWrapper, shimmer, celebrate, expanded, historySection, historyItem, observation, doneSuccess, historyContent, statusIcon, doneError, historyMeta, inputSectionWrapper, hidden, inputSection, taskInput,
|
|
17783
|
+
var __defProp4, __typeError2, __name3, __accessCheck2, __privateGet2, __privateAdd2, __privateSet2, __privateMethod2, _wrapper, _indicator, _statusText, _historySection, _expandButton, _stopButton, _inputSection, _taskInput, _state, _isExpanded, _config, _i18n, _userAnswerResolver, _isWaitingForUserAnswer, _headerUpdateTimer, _pendingHeaderText, _isAnimating, _Panel_instances, toStepData_fn, getToolExecutingText_fn, getToolCompletedText_fn, updateInternal_fn, stopAgent_fn, submitTask_fn, handleUserAnswer_fn, showInputArea_fn, hideInputArea_fn, shouldShowInputArea_fn, createWrapper_fn, setupEventListeners_fn, toggle_fn, expand_fn, collapse_fn, startHeaderUpdateLoop_fn, stopHeaderUpdateLoop_fn, checkAndUpdateHeader_fn, animateTextChange_fn, updateStatusIndicator_fn, updateHistory_fn, scrollToBottom_fn, createHistoryItem_fn, _UIState, UIState, enUS, zhCN, locales, _I18n, I18n, wrapper2, background, header, pulse, retryPulse, statusTextFadeOut, statusTextFadeIn, statusSection, indicator, thinking, tool_executing, retry, completed, input, output, error48, statusText, fadeOut, fadeIn, controls, controlButton, stopButton, historySectionWrapper, shimmer, celebrate, expanded, historySection, historyItem, observation, doneSuccess, historyContent, statusIcon, doneError, historyMeta, inputSectionWrapper, hidden, inputSection, taskInput, styles2, _Panel, Panel;
|
|
18281
17784
|
var init_page_agent_ui = __esm({
|
|
18282
17785
|
"node_modules/@page-agent/ui/dist/lib/page-agent-ui.js"() {
|
|
18283
17786
|
(function() {
|
|
@@ -18528,7 +18031,7 @@ var init_page_agent_ui = __esm({
|
|
|
18528
18031
|
hidden = "_hidden_1x12x_551";
|
|
18529
18032
|
inputSection = "_inputSection_1x12x_528";
|
|
18530
18033
|
taskInput = "_taskInput_1x12x_562";
|
|
18531
|
-
|
|
18034
|
+
styles2 = {
|
|
18532
18035
|
wrapper: wrapper2,
|
|
18533
18036
|
"mask-running": "_mask-running_1x12x_1",
|
|
18534
18037
|
background,
|
|
@@ -18593,13 +18096,13 @@ var init_page_agent_ui = __esm({
|
|
|
18593
18096
|
__privateSet2(this, _config, config2);
|
|
18594
18097
|
__privateSet2(this, _i18n, new I18n((_a3 = config2.language) != null ? _a3 : "en-US"));
|
|
18595
18098
|
__privateSet2(this, _wrapper, __privateMethod2(this, _Panel_instances, createWrapper_fn).call(this));
|
|
18596
|
-
__privateSet2(this, _indicator, __privateGet2(this, _wrapper).querySelector(`.${
|
|
18597
|
-
__privateSet2(this, _statusText, __privateGet2(this, _wrapper).querySelector(`.${
|
|
18598
|
-
__privateSet2(this, _historySection, __privateGet2(this, _wrapper).querySelector(`.${
|
|
18599
|
-
__privateSet2(this, _expandButton, __privateGet2(this, _wrapper).querySelector(`.${
|
|
18600
|
-
__privateSet2(this, _stopButton, __privateGet2(this, _wrapper).querySelector(`.${
|
|
18601
|
-
__privateSet2(this, _inputSection, __privateGet2(this, _wrapper).querySelector(`.${
|
|
18602
|
-
__privateSet2(this, _taskInput, __privateGet2(this, _wrapper).querySelector(`.${
|
|
18099
|
+
__privateSet2(this, _indicator, __privateGet2(this, _wrapper).querySelector(`.${styles2.indicator}`));
|
|
18100
|
+
__privateSet2(this, _statusText, __privateGet2(this, _wrapper).querySelector(`.${styles2.statusText}`));
|
|
18101
|
+
__privateSet2(this, _historySection, __privateGet2(this, _wrapper).querySelector(`.${styles2.historySection}`));
|
|
18102
|
+
__privateSet2(this, _expandButton, __privateGet2(this, _wrapper).querySelector(`.${styles2.expandButton}`));
|
|
18103
|
+
__privateSet2(this, _stopButton, __privateGet2(this, _wrapper).querySelector(`.${styles2.stopButton}`));
|
|
18104
|
+
__privateSet2(this, _inputSection, __privateGet2(this, _wrapper).querySelector(`.${styles2.inputSectionWrapper}`));
|
|
18105
|
+
__privateSet2(this, _taskInput, __privateGet2(this, _wrapper).querySelector(`.${styles2.taskInput}`));
|
|
18603
18106
|
__privateMethod2(this, _Panel_instances, setupEventListeners_fn).call(this);
|
|
18604
18107
|
__privateMethod2(this, _Panel_instances, startHeaderUpdateLoop_fn).call(this);
|
|
18605
18108
|
__privateMethod2(this, _Panel_instances, showInputArea_fn).call(this);
|
|
@@ -18820,13 +18323,13 @@ var init_page_agent_ui = __esm({
|
|
|
18820
18323
|
showInputArea_fn = /* @__PURE__ */ __name3(function(placeholder) {
|
|
18821
18324
|
__privateGet2(this, _taskInput).value = "";
|
|
18822
18325
|
__privateGet2(this, _taskInput).placeholder = placeholder || __privateGet2(this, _i18n).t("ui.panel.taskInput");
|
|
18823
|
-
__privateGet2(this, _inputSection).classList.remove(
|
|
18326
|
+
__privateGet2(this, _inputSection).classList.remove(styles2.hidden);
|
|
18824
18327
|
setTimeout(() => {
|
|
18825
18328
|
__privateGet2(this, _taskInput).focus();
|
|
18826
18329
|
}, 100);
|
|
18827
18330
|
}, "#showInputArea");
|
|
18828
18331
|
hideInputArea_fn = /* @__PURE__ */ __name3(function() {
|
|
18829
|
-
__privateGet2(this, _inputSection).classList.add(
|
|
18332
|
+
__privateGet2(this, _inputSection).classList.add(styles2.hidden);
|
|
18830
18333
|
}, "#hideInputArea");
|
|
18831
18334
|
shouldShowInputArea_fn = /* @__PURE__ */ __name3(function() {
|
|
18832
18335
|
var _a3;
|
|
@@ -18845,12 +18348,12 @@ var init_page_agent_ui = __esm({
|
|
|
18845
18348
|
createWrapper_fn = /* @__PURE__ */ __name3(function() {
|
|
18846
18349
|
const wrapper22 = document.createElement("div");
|
|
18847
18350
|
wrapper22.id = "page-agent-runtime_agent-panel";
|
|
18848
|
-
wrapper22.className =
|
|
18351
|
+
wrapper22.className = styles2.wrapper;
|
|
18849
18352
|
wrapper22.setAttribute("data-browser-use-ignore", "true");
|
|
18850
18353
|
wrapper22.innerHTML = `
|
|
18851
|
-
<div class="${
|
|
18852
|
-
<div class="${
|
|
18853
|
-
<div class="${
|
|
18354
|
+
<div class="${styles2.background}"></div>
|
|
18355
|
+
<div class="${styles2.historySectionWrapper}">
|
|
18356
|
+
<div class="${styles2.historySection}">
|
|
18854
18357
|
${__privateMethod2(this, _Panel_instances, createHistoryItem_fn).call(this, {
|
|
18855
18358
|
id: "placeholder",
|
|
18856
18359
|
stepNumber: 0,
|
|
@@ -18860,25 +18363,25 @@ var init_page_agent_ui = __esm({
|
|
|
18860
18363
|
})}
|
|
18861
18364
|
</div>
|
|
18862
18365
|
</div>
|
|
18863
|
-
<div class="${
|
|
18864
|
-
<div class="${
|
|
18865
|
-
<div class="${
|
|
18866
|
-
<div class="${
|
|
18366
|
+
<div class="${styles2.header}">
|
|
18367
|
+
<div class="${styles2.statusSection}">
|
|
18368
|
+
<div class="${styles2.indicator} ${styles2.thinking}"></div>
|
|
18369
|
+
<div class="${styles2.statusText}">${__privateGet2(this, _i18n).t("ui.panel.ready")}</div>
|
|
18867
18370
|
</div>
|
|
18868
|
-
<div class="${
|
|
18869
|
-
<button class="${
|
|
18371
|
+
<div class="${styles2.controls}">
|
|
18372
|
+
<button class="${styles2.controlButton} ${styles2.expandButton}" title="${__privateGet2(this, _i18n).t("ui.panel.expand")}">
|
|
18870
18373
|
\u25BC
|
|
18871
18374
|
</button>
|
|
18872
|
-
<button class="${
|
|
18375
|
+
<button class="${styles2.controlButton} ${styles2.stopButton}" title="${__privateGet2(this, _i18n).t("ui.panel.stop")}">
|
|
18873
18376
|
X
|
|
18874
18377
|
</button>
|
|
18875
18378
|
</div>
|
|
18876
18379
|
</div>
|
|
18877
|
-
<div class="${
|
|
18878
|
-
<div class="${
|
|
18380
|
+
<div class="${styles2.inputSectionWrapper} ${styles2.hidden}">
|
|
18381
|
+
<div class="${styles2.inputSection}">
|
|
18879
18382
|
<input
|
|
18880
18383
|
type="text"
|
|
18881
|
-
class="${
|
|
18384
|
+
class="${styles2.taskInput}"
|
|
18882
18385
|
maxlength="200"
|
|
18883
18386
|
/>
|
|
18884
18387
|
</div>
|
|
@@ -18888,9 +18391,9 @@ var init_page_agent_ui = __esm({
|
|
|
18888
18391
|
return wrapper22;
|
|
18889
18392
|
}, "#createWrapper");
|
|
18890
18393
|
setupEventListeners_fn = /* @__PURE__ */ __name3(function() {
|
|
18891
|
-
const header2 = this.wrapper.querySelector(`.${
|
|
18394
|
+
const header2 = this.wrapper.querySelector(`.${styles2.header}`);
|
|
18892
18395
|
header2.addEventListener("click", (e) => {
|
|
18893
|
-
if (e.target.closest(`.${
|
|
18396
|
+
if (e.target.closest(`.${styles2.controlButton}`)) {
|
|
18894
18397
|
return;
|
|
18895
18398
|
}
|
|
18896
18399
|
__privateMethod2(this, _Panel_instances, toggle_fn).call(this);
|
|
@@ -18923,12 +18426,12 @@ var init_page_agent_ui = __esm({
|
|
|
18923
18426
|
}, "#toggle");
|
|
18924
18427
|
expand_fn = /* @__PURE__ */ __name3(function() {
|
|
18925
18428
|
__privateSet2(this, _isExpanded, true);
|
|
18926
|
-
this.wrapper.classList.add(
|
|
18429
|
+
this.wrapper.classList.add(styles2.expanded);
|
|
18927
18430
|
__privateGet2(this, _expandButton).textContent = "\u25B2";
|
|
18928
18431
|
}, "#expand");
|
|
18929
18432
|
collapse_fn = /* @__PURE__ */ __name3(function() {
|
|
18930
18433
|
__privateSet2(this, _isExpanded, false);
|
|
18931
|
-
this.wrapper.classList.remove(
|
|
18434
|
+
this.wrapper.classList.remove(styles2.expanded);
|
|
18932
18435
|
__privateGet2(this, _expandButton).textContent = "\u25BC";
|
|
18933
18436
|
}, "#collapse");
|
|
18934
18437
|
startHeaderUpdateLoop_fn = /* @__PURE__ */ __name3(function() {
|
|
@@ -18956,20 +18459,20 @@ var init_page_agent_ui = __esm({
|
|
|
18956
18459
|
}, "#checkAndUpdateHeader");
|
|
18957
18460
|
animateTextChange_fn = /* @__PURE__ */ __name3(function(newText) {
|
|
18958
18461
|
__privateSet2(this, _isAnimating, true);
|
|
18959
|
-
__privateGet2(this, _statusText).classList.add(
|
|
18462
|
+
__privateGet2(this, _statusText).classList.add(styles2.fadeOut);
|
|
18960
18463
|
setTimeout(() => {
|
|
18961
18464
|
__privateGet2(this, _statusText).textContent = newText;
|
|
18962
|
-
__privateGet2(this, _statusText).classList.remove(
|
|
18963
|
-
__privateGet2(this, _statusText).classList.add(
|
|
18465
|
+
__privateGet2(this, _statusText).classList.remove(styles2.fadeOut);
|
|
18466
|
+
__privateGet2(this, _statusText).classList.add(styles2.fadeIn);
|
|
18964
18467
|
setTimeout(() => {
|
|
18965
|
-
__privateGet2(this, _statusText).classList.remove(
|
|
18468
|
+
__privateGet2(this, _statusText).classList.remove(styles2.fadeIn);
|
|
18966
18469
|
__privateSet2(this, _isAnimating, false);
|
|
18967
18470
|
}, 300);
|
|
18968
18471
|
}, 150);
|
|
18969
18472
|
}, "#animateTextChange");
|
|
18970
18473
|
updateStatusIndicator_fn = /* @__PURE__ */ __name3(function(type) {
|
|
18971
|
-
__privateGet2(this, _indicator).className =
|
|
18972
|
-
__privateGet2(this, _indicator).classList.add(
|
|
18474
|
+
__privateGet2(this, _indicator).className = styles2.indicator;
|
|
18475
|
+
__privateGet2(this, _indicator).classList.add(styles2[type]);
|
|
18973
18476
|
}, "#updateStatusIndicator");
|
|
18974
18477
|
updateHistory_fn = /* @__PURE__ */ __name3(function() {
|
|
18975
18478
|
const steps = __privateGet2(this, _state).getAllSteps();
|
|
@@ -18995,28 +18498,28 @@ var init_page_agent_ui = __esm({
|
|
|
18995
18498
|
const failureKeyword = __privateGet2(this, _i18n).t("ui.tools.resultFailure");
|
|
18996
18499
|
const errorKeyword = __privateGet2(this, _i18n).t("ui.tools.resultError");
|
|
18997
18500
|
const isSuccess = !step.toolResult || !step.toolResult.includes(failureKeyword) && !step.toolResult.includes(errorKeyword);
|
|
18998
|
-
typeClass = isSuccess ?
|
|
18501
|
+
typeClass = isSuccess ? styles2.doneSuccess : styles2.doneError;
|
|
18999
18502
|
statusIcon2 = isSuccess ? "\u{1F389}" : "\u274C";
|
|
19000
18503
|
} else {
|
|
19001
|
-
typeClass =
|
|
18504
|
+
typeClass = styles2.completed;
|
|
19002
18505
|
statusIcon2 = "\u2705";
|
|
19003
18506
|
}
|
|
19004
18507
|
} else if (step.type === "error") {
|
|
19005
|
-
typeClass =
|
|
18508
|
+
typeClass = styles2.error;
|
|
19006
18509
|
statusIcon2 = "\u274C";
|
|
19007
18510
|
} else if (step.type === "tool_executing") {
|
|
19008
18511
|
statusIcon2 = "\u{1F528}";
|
|
19009
18512
|
} else if (step.type === "output") {
|
|
19010
|
-
typeClass =
|
|
18513
|
+
typeClass = styles2.output;
|
|
19011
18514
|
statusIcon2 = "\u{1F916}";
|
|
19012
18515
|
} else if (step.type === "input") {
|
|
19013
|
-
typeClass =
|
|
18516
|
+
typeClass = styles2.input;
|
|
19014
18517
|
statusIcon2 = "\u{1F3AF}";
|
|
19015
18518
|
} else if (step.type === "retry") {
|
|
19016
|
-
typeClass =
|
|
18519
|
+
typeClass = styles2.retry;
|
|
19017
18520
|
statusIcon2 = "\u{1F504}";
|
|
19018
18521
|
} else if (step.type === "observation") {
|
|
19019
|
-
typeClass =
|
|
18522
|
+
typeClass = styles2.observation;
|
|
19020
18523
|
statusIcon2 = "\u{1F441}\uFE0F";
|
|
19021
18524
|
} else {
|
|
19022
18525
|
statusIcon2 = "\u{1F9E0}";
|
|
@@ -19029,12 +18532,12 @@ var init_page_agent_ui = __esm({
|
|
|
19029
18532
|
// Explicitly pass empty string to replace template
|
|
19030
18533
|
});
|
|
19031
18534
|
return `
|
|
19032
|
-
<div class="${
|
|
19033
|
-
<div class="${
|
|
19034
|
-
<span class="${
|
|
18535
|
+
<div class="${styles2.historyItem} ${typeClass}">
|
|
18536
|
+
<div class="${styles2.historyContent}">
|
|
18537
|
+
<span class="${styles2.statusIcon}">${statusIcon2}</span>
|
|
19035
18538
|
<span>${escapeHtml(step.displayText)}</span>
|
|
19036
18539
|
</div>
|
|
19037
|
-
<div class="${
|
|
18540
|
+
<div class="${styles2.historyMeta}">
|
|
19038
18541
|
${stepLabel}
|
|
19039
18542
|
</div>
|
|
19040
18543
|
</div>
|
|
@@ -19062,7 +18565,7 @@ function normalizeResponse(response) {
|
|
|
19062
18565
|
if ((_c = toolCall == null ? void 0 : toolCall.function) == null ? void 0 : _c.arguments) {
|
|
19063
18566
|
resolvedArguments = safeJsonParse(toolCall.function.arguments);
|
|
19064
18567
|
if (toolCall.function.name && toolCall.function.name !== "AgentOutput") {
|
|
19065
|
-
console.log(
|
|
18568
|
+
console.log(chalk_default.yellow(`[normalizeResponse] #1: fixing tool_call`));
|
|
19066
18569
|
resolvedArguments = { action: safeJsonParse(resolvedArguments) };
|
|
19067
18570
|
}
|
|
19068
18571
|
} else {
|
|
@@ -19072,15 +18575,15 @@ function normalizeResponse(response) {
|
|
|
19072
18575
|
if (jsonInContent) {
|
|
19073
18576
|
resolvedArguments = safeJsonParse(jsonInContent);
|
|
19074
18577
|
if ((resolvedArguments == null ? void 0 : resolvedArguments.name) === "AgentOutput") {
|
|
19075
|
-
console.log(
|
|
18578
|
+
console.log(chalk_default.yellow(`[normalizeResponse] #2: fixing tool_call`));
|
|
19076
18579
|
resolvedArguments = safeJsonParse(resolvedArguments.arguments);
|
|
19077
18580
|
}
|
|
19078
18581
|
if ((resolvedArguments == null ? void 0 : resolvedArguments.type) === "function") {
|
|
19079
|
-
console.log(
|
|
18582
|
+
console.log(chalk_default.yellow(`[normalizeResponse] #3: fixing tool_call`));
|
|
19080
18583
|
resolvedArguments = safeJsonParse(resolvedArguments.function.arguments);
|
|
19081
18584
|
}
|
|
19082
18585
|
if (!(resolvedArguments == null ? void 0 : resolvedArguments.action) && !(resolvedArguments == null ? void 0 : resolvedArguments.evaluation_previous_goal) && !(resolvedArguments == null ? void 0 : resolvedArguments.memory) && !(resolvedArguments == null ? void 0 : resolvedArguments.next_goal) && !(resolvedArguments == null ? void 0 : resolvedArguments.thinking)) {
|
|
19083
|
-
console.log(
|
|
18586
|
+
console.log(chalk_default.yellow(`[normalizeResponse] #4: fixing tool_call`));
|
|
19084
18587
|
resolvedArguments = { action: safeJsonParse(resolvedArguments) };
|
|
19085
18588
|
}
|
|
19086
18589
|
} else {
|
|
@@ -19095,7 +18598,7 @@ function normalizeResponse(response) {
|
|
|
19095
18598
|
resolvedArguments.action = safeJsonParse(resolvedArguments.action);
|
|
19096
18599
|
}
|
|
19097
18600
|
if (!resolvedArguments.action) {
|
|
19098
|
-
console.log(
|
|
18601
|
+
console.log(chalk_default.yellow(`[normalizeResponse] #5: fixing tool_call`));
|
|
19099
18602
|
resolvedArguments.action = { name: "wait", input: { seconds: 1 } };
|
|
19100
18603
|
}
|
|
19101
18604
|
return {
|
|
@@ -19175,7 +18678,7 @@ function tool(options) {
|
|
|
19175
18678
|
function assert2(condition, message, silent) {
|
|
19176
18679
|
if (!condition) {
|
|
19177
18680
|
const errorMessage = message != null ? message : "Assertion failed";
|
|
19178
|
-
console.error(
|
|
18681
|
+
console.error(chalk_default.red(`\u274C assert: ${errorMessage}`));
|
|
19179
18682
|
throw new Error(errorMessage);
|
|
19180
18683
|
}
|
|
19181
18684
|
}
|
|
@@ -19185,7 +18688,7 @@ var init_page_agent = __esm({
|
|
|
19185
18688
|
init_page_agent_llms();
|
|
19186
18689
|
init_page_controller();
|
|
19187
18690
|
init_page_agent_ui();
|
|
19188
|
-
|
|
18691
|
+
init_chalk();
|
|
19189
18692
|
init_zod();
|
|
19190
18693
|
__defProp5 = Object.defineProperty;
|
|
19191
18694
|
__typeError3 = (msg) => {
|
|
@@ -19465,7 +18968,7 @@ var init_page_agent = __esm({
|
|
|
19465
18968
|
await onBeforeStep.call(this, step);
|
|
19466
18969
|
console.group(`step: ${step}`);
|
|
19467
18970
|
if (__privateGet3(this, _abortController).signal.aborted) throw new Error("AbortError");
|
|
19468
|
-
console.log(
|
|
18971
|
+
console.log(chalk_default.blue("Thinking..."));
|
|
19469
18972
|
(_d = this.panel) == null ? void 0 : _d.update({ type: "thinking" });
|
|
19470
18973
|
const result2 = await __privateGet3(this, _llm).invoke(
|
|
19471
18974
|
[
|
|
@@ -19505,7 +19008,7 @@ var init_page_agent = __esm({
|
|
|
19505
19008
|
action,
|
|
19506
19009
|
usage: result2.usage
|
|
19507
19010
|
});
|
|
19508
|
-
console.log(
|
|
19011
|
+
console.log(chalk_default.green("Step finished:"), actionName);
|
|
19509
19012
|
console.groupEnd();
|
|
19510
19013
|
await onAfterStep.call(this, step, this.history);
|
|
19511
19014
|
step++;
|
|
@@ -19522,7 +19025,7 @@ var init_page_agent = __esm({
|
|
|
19522
19025
|
if (actionName === "done") {
|
|
19523
19026
|
const success2 = (_f = (_e = action.input) == null ? void 0 : _e.success) != null ? _f : false;
|
|
19524
19027
|
const text = ((_g = action.input) == null ? void 0 : _g.text) || "no text provided";
|
|
19525
|
-
console.log(
|
|
19028
|
+
console.log(chalk_default.green.bold("Task completed"), success2, text);
|
|
19526
19029
|
__privateMethod3(this, _PageAgent_instances, onDone_fn).call(this, text, success2);
|
|
19527
19030
|
const result22 = {
|
|
19528
19031
|
success: success2,
|
|
@@ -19595,7 +19098,7 @@ var init_page_agent = __esm({
|
|
|
19595
19098
|
execute: /* @__PURE__ */ __name4(async (input2) => {
|
|
19596
19099
|
var _a3, _b, _c;
|
|
19597
19100
|
if (__privateGet3(this, _abortController).signal.aborted) throw new Error("AbortError");
|
|
19598
|
-
console.log(
|
|
19101
|
+
console.log(chalk_default.blue.bold("MacroTool execute"), input2);
|
|
19599
19102
|
const action = input2.action;
|
|
19600
19103
|
const toolName = Object.keys(action)[0];
|
|
19601
19104
|
const toolInput = action[toolName];
|
|
@@ -19611,12 +19114,12 @@ var init_page_agent = __esm({
|
|
|
19611
19114
|
}
|
|
19612
19115
|
const tool2 = tools2.get(toolName);
|
|
19613
19116
|
assert2(tool2, `Tool ${toolName} not found. (@note should have been caught before this!!!)`);
|
|
19614
|
-
console.log(
|
|
19117
|
+
console.log(chalk_default.blue.bold(`Executing tool: ${toolName}`), toolInput);
|
|
19615
19118
|
(_b = this.panel) == null ? void 0 : _b.update({ type: "toolExecuting", toolName, args: toolInput });
|
|
19616
19119
|
const startTime = Date.now();
|
|
19617
19120
|
const result2 = await tool2.execute.bind(this)(toolInput);
|
|
19618
19121
|
const duration3 = Date.now() - startTime;
|
|
19619
|
-
console.log(
|
|
19122
|
+
console.log(chalk_default.green.bold(`Tool (${toolName}) executed for ${duration3}ms`), result2);
|
|
19620
19123
|
if (toolName !== "wait") {
|
|
19621
19124
|
this.states.totalWaitTime = 0;
|
|
19622
19125
|
}
|
|
@@ -19656,7 +19159,7 @@ var init_page_agent = __esm({
|
|
|
19656
19159
|
pageInstructions = (_b = instructions.getPageInstructions(url2)) == null ? void 0 : _b.trim();
|
|
19657
19160
|
} catch (error49) {
|
|
19658
19161
|
console.error(
|
|
19659
|
-
|
|
19162
|
+
chalk_default.red("[PageAgent] Failed to execute getPageInstructions callback:"),
|
|
19660
19163
|
error49
|
|
19661
19164
|
);
|
|
19662
19165
|
}
|
|
@@ -19896,6 +19399,14 @@ var VoicePageAgentController = class {
|
|
|
19896
19399
|
async openAgent() {
|
|
19897
19400
|
return this.ensureAgent();
|
|
19898
19401
|
}
|
|
19402
|
+
async toggleAgentPanel() {
|
|
19403
|
+
if (typeof window === "undefined") return;
|
|
19404
|
+
if (this.isAgentPanelVisible()) {
|
|
19405
|
+
this.hideAgentPanel();
|
|
19406
|
+
return;
|
|
19407
|
+
}
|
|
19408
|
+
await this.openAgent();
|
|
19409
|
+
}
|
|
19899
19410
|
async startWake() {
|
|
19900
19411
|
if (this.disposed) return;
|
|
19901
19412
|
if (!this.hasSpeechSupport()) {
|
|
@@ -20078,26 +19589,55 @@ var VoicePageAgentController = class {
|
|
|
20078
19589
|
}
|
|
20079
19590
|
}
|
|
20080
19591
|
async ensureAgent() {
|
|
19592
|
+
var _a3;
|
|
20081
19593
|
if (typeof window === "undefined") return null;
|
|
20082
19594
|
const runtimeWindow = window;
|
|
20083
|
-
|
|
20084
|
-
|
|
20085
|
-
|
|
20086
|
-
|
|
19595
|
+
const existingAgent = runtimeWindow.pageAgent;
|
|
19596
|
+
if (existingAgent) {
|
|
19597
|
+
const panelNode = document.getElementById("page-agent-runtime_agent-panel");
|
|
19598
|
+
const canReuse = Boolean(existingAgent.panel && (panelNode == null ? void 0 : panelNode.isConnected) && !existingAgent.disposed);
|
|
19599
|
+
if (canReuse && existingAgent.panel) {
|
|
19600
|
+
existingAgent.panel.show();
|
|
19601
|
+
existingAgent.panel.expand();
|
|
19602
|
+
return existingAgent;
|
|
19603
|
+
}
|
|
19604
|
+
try {
|
|
19605
|
+
(_a3 = existingAgent.dispose) == null ? void 0 : _a3.call(existingAgent, "RECREATE_WITH_PANEL");
|
|
19606
|
+
} catch {
|
|
19607
|
+
}
|
|
19608
|
+
runtimeWindow.pageAgent = void 0;
|
|
20087
19609
|
}
|
|
20088
19610
|
if (this.initAgentPromise) return this.initAgentPromise;
|
|
20089
19611
|
this.initAgentPromise = (async () => {
|
|
20090
19612
|
const mod = await Promise.resolve().then(() => (init_page_agent(), page_agent_exports));
|
|
20091
19613
|
const Agent = mod.PageAgent;
|
|
20092
|
-
|
|
19614
|
+
let agent;
|
|
19615
|
+
try {
|
|
19616
|
+
agent = new Agent(this.options.pageAgent);
|
|
19617
|
+
} catch (err) {
|
|
19618
|
+
const message = err instanceof Error ? err.message : String(err || "");
|
|
19619
|
+
const webglUnavailable = /webgl2 is required/i.test(message) || /webgl/i.test(message);
|
|
19620
|
+
if (!webglUnavailable) {
|
|
19621
|
+
throw err;
|
|
19622
|
+
}
|
|
19623
|
+
const fallbackConfig = {
|
|
19624
|
+
...this.options.pageAgent,
|
|
19625
|
+
enableMask: false
|
|
19626
|
+
};
|
|
19627
|
+
agent = new Agent(fallbackConfig);
|
|
19628
|
+
}
|
|
20093
19629
|
runtimeWindow.pageAgent = agent;
|
|
19630
|
+
if (!agent.panel) {
|
|
19631
|
+
throw new Error("Page Agent panel is disabled. Set pageAgent.enablePanel=true.");
|
|
19632
|
+
}
|
|
20094
19633
|
agent.panel.show();
|
|
20095
19634
|
agent.panel.expand();
|
|
20096
19635
|
return agent;
|
|
20097
19636
|
})().catch((err) => {
|
|
19637
|
+
console.error("[voice-page-agent] ensureAgent failed:", err);
|
|
20098
19638
|
this.patchState({
|
|
20099
19639
|
status: "error",
|
|
20100
|
-
message: err
|
|
19640
|
+
message: this.resolveAgentInitErrorMessage(err)
|
|
20101
19641
|
});
|
|
20102
19642
|
return null;
|
|
20103
19643
|
}).finally(() => {
|
|
@@ -20105,6 +19645,33 @@ var VoicePageAgentController = class {
|
|
|
20105
19645
|
});
|
|
20106
19646
|
return this.initAgentPromise;
|
|
20107
19647
|
}
|
|
19648
|
+
isAgentPanelVisible() {
|
|
19649
|
+
const panelNode = document.getElementById("page-agent-runtime_agent-panel");
|
|
19650
|
+
if (!panelNode) return false;
|
|
19651
|
+
const style = window.getComputedStyle(panelNode);
|
|
19652
|
+
return style.display !== "none" && style.visibility !== "hidden" && style.opacity !== "0";
|
|
19653
|
+
}
|
|
19654
|
+
hideAgentPanel() {
|
|
19655
|
+
var _a3, _b, _c, _d;
|
|
19656
|
+
const runtimeWindow = window;
|
|
19657
|
+
const agent = runtimeWindow.pageAgent;
|
|
19658
|
+
if (agent == null ? void 0 : agent.panel) {
|
|
19659
|
+
(_b = (_a3 = agent.panel).collapse) == null ? void 0 : _b.call(_a3);
|
|
19660
|
+
(_d = (_c = agent.panel).hide) == null ? void 0 : _d.call(_c);
|
|
19661
|
+
}
|
|
19662
|
+
const panelNode = document.getElementById("page-agent-runtime_agent-panel");
|
|
19663
|
+
if (panelNode) {
|
|
19664
|
+
panelNode.style.display = "none";
|
|
19665
|
+
panelNode.style.opacity = "0";
|
|
19666
|
+
}
|
|
19667
|
+
}
|
|
19668
|
+
resolveAgentInitErrorMessage(error49) {
|
|
19669
|
+
const raw = error49 instanceof Error ? error49.message : String(error49 || "");
|
|
19670
|
+
if (/Cannot read properties of undefined \(reading 'indexOf'\)/i.test(raw)) {
|
|
19671
|
+
return "Page Agent \u8FD0\u884C\u65F6\u4F9D\u8D56\u52A0\u8F7D\u5931\u8D25\uFF08\u65E7\u7248\u6784\u5EFA\u517C\u5BB9\u95EE\u9898\uFF09\uFF0C\u8BF7\u5347\u7EA7 voice-page-agent \u5E76\u91CD\u88C5\u4F9D\u8D56\u3002";
|
|
19672
|
+
}
|
|
19673
|
+
return raw || "Page Agent \u521D\u59CB\u5316\u5931\u8D25";
|
|
19674
|
+
}
|
|
20108
19675
|
async executeVoiceCommand(rawCommand) {
|
|
20109
19676
|
const command = this.sanitizeVoiceCommand(rawCommand);
|
|
20110
19677
|
if (!command) {
|
|
@@ -20243,102 +19810,122 @@ var VOICE_PAGE_AGENT_KEY = "VOICE_PAGE_AGENT_INSTANCE";
|
|
|
20243
19810
|
var VOICE_PAGE_AGENT_STYLE_ID = "voice-page-agent-style";
|
|
20244
19811
|
var VOICE_PAGE_AGENT_STYLE_TEXT = `
|
|
20245
19812
|
.voice-page-agent-root {
|
|
20246
|
-
--voice-page-agent-wake-bg: linear-gradient(135deg, #
|
|
19813
|
+
--voice-page-agent-wake-bg: linear-gradient(135deg, #7f67ff, #5a8dff);
|
|
20247
19814
|
--voice-page-agent-wake-color: #ffffff;
|
|
20248
|
-
--voice-page-agent-open-bg: linear-gradient(
|
|
20249
|
-
--voice-page-agent-open-color: #
|
|
20250
|
-
--voice-page-agent-status-color: #
|
|
20251
|
-
--voice-page-agent-surface-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.9));
|
|
20252
|
-
--voice-page-agent-surface-border: rgba(148, 163, 184, 0.3);
|
|
19815
|
+
--voice-page-agent-open-bg: linear-gradient(180deg, #ffffff, #f7f4ff);
|
|
19816
|
+
--voice-page-agent-open-color: #30264d;
|
|
19817
|
+
--voice-page-agent-status-color: #5f5a79;
|
|
20253
19818
|
|
|
20254
|
-
position: relative;
|
|
20255
19819
|
display: flex;
|
|
20256
19820
|
flex-direction: column;
|
|
19821
|
+
align-items: flex-end;
|
|
20257
19822
|
gap: 12px;
|
|
20258
|
-
margin
|
|
20259
|
-
padding:
|
|
20260
|
-
border
|
|
20261
|
-
|
|
20262
|
-
|
|
20263
|
-
box-shadow:
|
|
20264
|
-
0 16px 34px -26px rgba(15, 23, 42, 0.9),
|
|
20265
|
-
inset 0 1px 0 rgba(255, 255, 255, 0.12);
|
|
20266
|
-
overflow: hidden;
|
|
20267
|
-
}
|
|
20268
|
-
|
|
20269
|
-
.voice-page-agent-root::before {
|
|
20270
|
-
content: "";
|
|
20271
|
-
position: absolute;
|
|
20272
|
-
inset: -35% -10% auto;
|
|
20273
|
-
height: 58%;
|
|
20274
|
-
background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0));
|
|
20275
|
-
pointer-events: none;
|
|
19823
|
+
margin: 0;
|
|
19824
|
+
padding: 0;
|
|
19825
|
+
border: 0;
|
|
19826
|
+
background: transparent;
|
|
19827
|
+
box-shadow: none;
|
|
20276
19828
|
}
|
|
20277
19829
|
|
|
20278
19830
|
.voice-page-agent-actions {
|
|
20279
|
-
position: relative;
|
|
20280
|
-
z-index: 1;
|
|
20281
19831
|
display: flex;
|
|
20282
|
-
|
|
19832
|
+
align-items: center;
|
|
19833
|
+
justify-content: flex-end;
|
|
19834
|
+
flex-wrap: nowrap;
|
|
20283
19835
|
gap: 10px;
|
|
20284
19836
|
}
|
|
20285
19837
|
|
|
20286
19838
|
.voice-page-agent-btn {
|
|
20287
|
-
border:
|
|
19839
|
+
border: 1px solid transparent;
|
|
20288
19840
|
border-radius: 999px;
|
|
20289
|
-
padding:
|
|
20290
|
-
font-size:
|
|
20291
|
-
line-height: 1.
|
|
19841
|
+
padding: 10px 16px;
|
|
19842
|
+
font-size: 16px;
|
|
19843
|
+
line-height: 1.2;
|
|
20292
19844
|
font-weight: 600;
|
|
20293
|
-
letter-spacing: 0
|
|
19845
|
+
letter-spacing: 0;
|
|
20294
19846
|
cursor: pointer;
|
|
20295
|
-
box-shadow
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
|
|
19847
|
+
transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
|
|
19848
|
+
white-space: nowrap;
|
|
19849
|
+
user-select: none;
|
|
20299
19850
|
}
|
|
20300
19851
|
|
|
20301
19852
|
.voice-page-agent-btn--wake {
|
|
20302
19853
|
background: var(--voice-page-agent-wake-bg);
|
|
20303
19854
|
color: var(--voice-page-agent-wake-color);
|
|
19855
|
+
border-color: rgba(129, 111, 214, 0.4);
|
|
19856
|
+
box-shadow:
|
|
19857
|
+
0 8px 20px -14px rgba(95, 77, 170, 0.8),
|
|
19858
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.24);
|
|
20304
19859
|
}
|
|
20305
19860
|
|
|
20306
19861
|
.voice-page-agent-btn--open {
|
|
20307
19862
|
background: var(--voice-page-agent-open-bg);
|
|
20308
19863
|
color: var(--voice-page-agent-open-color);
|
|
19864
|
+
border-color: rgba(169, 149, 255, 0.48);
|
|
19865
|
+
box-shadow:
|
|
19866
|
+
0 8px 18px -14px rgba(102, 80, 188, 0.7),
|
|
19867
|
+
0 2px 8px rgba(155, 129, 247, 0.18);
|
|
19868
|
+
display: inline-flex;
|
|
19869
|
+
align-items: center;
|
|
19870
|
+
gap: 10px;
|
|
19871
|
+
min-height: 48px;
|
|
19872
|
+
padding: 10px 20px;
|
|
20309
19873
|
}
|
|
20310
19874
|
|
|
20311
19875
|
.voice-page-agent-btn:hover {
|
|
20312
19876
|
transform: translateY(-1px);
|
|
20313
|
-
filter: brightness(1.
|
|
20314
|
-
box-shadow:
|
|
20315
|
-
0 14px 24px -14px rgba(15, 23, 42, 0.95),
|
|
20316
|
-
inset 0 1px 0 rgba(255, 255, 255, 0.24);
|
|
19877
|
+
filter: brightness(1.01);
|
|
20317
19878
|
}
|
|
20318
19879
|
|
|
20319
19880
|
.voice-page-agent-btn:active {
|
|
20320
19881
|
transform: translateY(0);
|
|
20321
|
-
filter: brightness(0.
|
|
19882
|
+
filter: brightness(0.99);
|
|
19883
|
+
}
|
|
19884
|
+
|
|
19885
|
+
.voice-page-agent-open-icon {
|
|
19886
|
+
width: 20px;
|
|
19887
|
+
height: 20px;
|
|
19888
|
+
border-radius: 6px;
|
|
19889
|
+
border: 2px solid #9d84ff;
|
|
19890
|
+
color: #9d84ff;
|
|
19891
|
+
display: inline-flex;
|
|
19892
|
+
align-items: center;
|
|
19893
|
+
justify-content: center;
|
|
19894
|
+
font-size: 11px;
|
|
19895
|
+
line-height: 1;
|
|
19896
|
+
box-sizing: border-box;
|
|
19897
|
+
}
|
|
19898
|
+
|
|
19899
|
+
.voice-page-agent-open-icon::before {
|
|
19900
|
+
content: "\u2726";
|
|
19901
|
+
}
|
|
19902
|
+
|
|
19903
|
+
.voice-page-agent-open-label {
|
|
19904
|
+
line-height: 1;
|
|
20322
19905
|
}
|
|
20323
19906
|
|
|
20324
19907
|
.voice-page-agent-status {
|
|
20325
19908
|
margin: 0;
|
|
20326
|
-
|
|
20327
|
-
|
|
19909
|
+
max-width: min(420px, calc(100vw - 24px));
|
|
19910
|
+
padding: 10px 16px;
|
|
19911
|
+
border-radius: 999px;
|
|
19912
|
+
border: 1px solid rgba(180, 166, 255, 0.56);
|
|
19913
|
+
background: rgba(250, 248, 255, 0.9);
|
|
20328
19914
|
color: var(--voice-page-agent-status-color);
|
|
20329
|
-
font-size:
|
|
19915
|
+
font-size: 15px;
|
|
20330
19916
|
line-height: 1.4;
|
|
20331
|
-
|
|
19917
|
+
box-shadow: 0 8px 20px -18px rgba(98, 78, 170, 0.7);
|
|
19918
|
+
backdrop-filter: blur(6px);
|
|
20332
19919
|
}
|
|
20333
19920
|
`;
|
|
20334
19921
|
var DEFAULT_BUTTON_CONFIG = {
|
|
20335
19922
|
startText: "\u5F00\u542F\u8BED\u97F3\u5524\u9192",
|
|
20336
19923
|
wakeOnText: "\u8BED\u97F3\u5524\u9192\u4E2D",
|
|
20337
19924
|
openText: "\u7F51\u9875\u52A9\u624B",
|
|
20338
|
-
wakeButtonBackground: "linear-gradient(135deg, #
|
|
19925
|
+
wakeButtonBackground: "linear-gradient(135deg, #7f67ff, #5a8dff)",
|
|
20339
19926
|
wakeButtonTextColor: "#ffffff",
|
|
20340
|
-
openButtonBackground: "linear-gradient(
|
|
20341
|
-
openButtonTextColor: "#
|
|
19927
|
+
openButtonBackground: "linear-gradient(180deg, #ffffff, #f7f4ff)",
|
|
19928
|
+
openButtonTextColor: "#30264d"
|
|
20342
19929
|
};
|
|
20343
19930
|
var globalButtonConfig = {
|
|
20344
19931
|
...DEFAULT_BUTTON_CONFIG
|
|
@@ -20399,6 +19986,16 @@ function useVoicePageAgent() {
|
|
|
20399
19986
|
if (defaultController) return defaultController;
|
|
20400
19987
|
throw new Error("voice-page-agent: controller not found, please install plugin first.");
|
|
20401
19988
|
}
|
|
19989
|
+
function resolveClickProps(handler) {
|
|
19990
|
+
return {
|
|
19991
|
+
// Vue3
|
|
19992
|
+
onClick: handler,
|
|
19993
|
+
// Vue2 render function listeners
|
|
19994
|
+
on: {
|
|
19995
|
+
click: handler
|
|
19996
|
+
}
|
|
19997
|
+
};
|
|
19998
|
+
}
|
|
20402
19999
|
var VoicePageAgentButton = vueDemi.defineComponent({
|
|
20403
20000
|
name: "VoicePageAgentButton",
|
|
20404
20001
|
props: {
|
|
@@ -20457,7 +20054,7 @@ var VoicePageAgentButton = vueDemi.defineComponent({
|
|
|
20457
20054
|
}
|
|
20458
20055
|
};
|
|
20459
20056
|
const handleOpenClick = () => {
|
|
20460
|
-
void controller.
|
|
20057
|
+
void controller.toggleAgentPanel();
|
|
20461
20058
|
};
|
|
20462
20059
|
return () => {
|
|
20463
20060
|
var _a3, _b, _c, _d, _e, _f, _g;
|
|
@@ -20481,7 +20078,7 @@ var VoicePageAgentButton = vueDemi.defineComponent({
|
|
|
20481
20078
|
{
|
|
20482
20079
|
type: "button",
|
|
20483
20080
|
class: "voice-page-agent-btn voice-page-agent-btn--wake",
|
|
20484
|
-
|
|
20081
|
+
...resolveClickProps(handleWakeClick)
|
|
20485
20082
|
},
|
|
20486
20083
|
state.value.enabled ? resolvedWakeOnText : resolvedStartText
|
|
20487
20084
|
) : null,
|
|
@@ -20490,9 +20087,12 @@ var VoicePageAgentButton = vueDemi.defineComponent({
|
|
|
20490
20087
|
{
|
|
20491
20088
|
type: "button",
|
|
20492
20089
|
class: "voice-page-agent-btn voice-page-agent-btn--open",
|
|
20493
|
-
|
|
20090
|
+
...resolveClickProps(handleOpenClick)
|
|
20494
20091
|
},
|
|
20495
|
-
|
|
20092
|
+
[
|
|
20093
|
+
vueDemi.h("span", { class: "voice-page-agent-open-icon", "aria-hidden": "true" }),
|
|
20094
|
+
vueDemi.h("span", { class: "voice-page-agent-open-label" }, resolvedOpenText)
|
|
20095
|
+
]
|
|
20496
20096
|
)
|
|
20497
20097
|
]),
|
|
20498
20098
|
props.showStatus ? vueDemi.h("p", { class: "voice-page-agent-status" }, state.value.message) : null
|