@midscene/mcp 0.30.8 → 0.30.9

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.
@@ -1,14 +1,728 @@
1
- "use strict";
2
1
  exports.ids = [
3
- "290"
2
+ "217"
4
3
  ];
5
4
  exports.modules = {
5
+ "../../node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js": function(module) {
6
+ "use strict";
7
+ var has = Object.prototype.hasOwnProperty, prefix = '~';
8
+ function Events() {}
9
+ if (Object.create) {
10
+ Events.prototype = Object.create(null);
11
+ if (!new Events().__proto__) prefix = false;
12
+ }
13
+ function EE(fn, context, once) {
14
+ this.fn = fn;
15
+ this.context = context;
16
+ this.once = once || false;
17
+ }
18
+ function addListener(emitter, event, fn, context, once) {
19
+ if ('function' != typeof fn) throw new TypeError('The listener must be a function');
20
+ var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
21
+ if (emitter._events[evt]) if (emitter._events[evt].fn) emitter._events[evt] = [
22
+ emitter._events[evt],
23
+ listener
24
+ ];
25
+ else emitter._events[evt].push(listener);
26
+ else emitter._events[evt] = listener, emitter._eventsCount++;
27
+ return emitter;
28
+ }
29
+ function clearEvent(emitter, evt) {
30
+ if (0 === --emitter._eventsCount) emitter._events = new Events();
31
+ else delete emitter._events[evt];
32
+ }
33
+ function EventEmitter() {
34
+ this._events = new Events();
35
+ this._eventsCount = 0;
36
+ }
37
+ EventEmitter.prototype.eventNames = function() {
38
+ var names = [], events, name;
39
+ if (0 === this._eventsCount) return names;
40
+ for(name in events = this._events)if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
41
+ if (Object.getOwnPropertySymbols) return names.concat(Object.getOwnPropertySymbols(events));
42
+ return names;
43
+ };
44
+ EventEmitter.prototype.listeners = function(event) {
45
+ var evt = prefix ? prefix + event : event, handlers = this._events[evt];
46
+ if (!handlers) return [];
47
+ if (handlers.fn) return [
48
+ handlers.fn
49
+ ];
50
+ for(var i = 0, l = handlers.length, ee = new Array(l); i < l; i++)ee[i] = handlers[i].fn;
51
+ return ee;
52
+ };
53
+ EventEmitter.prototype.listenerCount = function(event) {
54
+ var evt = prefix ? prefix + event : event, listeners = this._events[evt];
55
+ if (!listeners) return 0;
56
+ if (listeners.fn) return 1;
57
+ return listeners.length;
58
+ };
59
+ EventEmitter.prototype.emit = function(event, a1, a2, a3, a4, a5) {
60
+ var evt = prefix ? prefix + event : event;
61
+ if (!this._events[evt]) return false;
62
+ var listeners = this._events[evt], len = arguments.length, args, i;
63
+ if (listeners.fn) {
64
+ if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
65
+ switch(len){
66
+ case 1:
67
+ return listeners.fn.call(listeners.context), true;
68
+ case 2:
69
+ return listeners.fn.call(listeners.context, a1), true;
70
+ case 3:
71
+ return listeners.fn.call(listeners.context, a1, a2), true;
72
+ case 4:
73
+ return listeners.fn.call(listeners.context, a1, a2, a3), true;
74
+ case 5:
75
+ return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
76
+ case 6:
77
+ return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
78
+ }
79
+ for(i = 1, args = new Array(len - 1); i < len; i++)args[i - 1] = arguments[i];
80
+ listeners.fn.apply(listeners.context, args);
81
+ } else {
82
+ var length = listeners.length, j;
83
+ for(i = 0; i < length; i++){
84
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
85
+ switch(len){
86
+ case 1:
87
+ listeners[i].fn.call(listeners[i].context);
88
+ break;
89
+ case 2:
90
+ listeners[i].fn.call(listeners[i].context, a1);
91
+ break;
92
+ case 3:
93
+ listeners[i].fn.call(listeners[i].context, a1, a2);
94
+ break;
95
+ case 4:
96
+ listeners[i].fn.call(listeners[i].context, a1, a2, a3);
97
+ break;
98
+ default:
99
+ if (!args) for(j = 1, args = new Array(len - 1); j < len; j++)args[j - 1] = arguments[j];
100
+ listeners[i].fn.apply(listeners[i].context, args);
101
+ }
102
+ }
103
+ }
104
+ return true;
105
+ };
106
+ EventEmitter.prototype.on = function(event, fn, context) {
107
+ return addListener(this, event, fn, context, false);
108
+ };
109
+ EventEmitter.prototype.once = function(event, fn, context) {
110
+ return addListener(this, event, fn, context, true);
111
+ };
112
+ EventEmitter.prototype.removeListener = function(event, fn, context, once) {
113
+ var evt = prefix ? prefix + event : event;
114
+ if (!this._events[evt]) return this;
115
+ if (!fn) {
116
+ clearEvent(this, evt);
117
+ return this;
118
+ }
119
+ var listeners = this._events[evt];
120
+ if (listeners.fn) {
121
+ if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) clearEvent(this, evt);
122
+ } else {
123
+ for(var i = 0, events = [], length = listeners.length; i < length; i++)if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) events.push(listeners[i]);
124
+ if (events.length) this._events[evt] = 1 === events.length ? events[0] : events;
125
+ else clearEvent(this, evt);
126
+ }
127
+ return this;
128
+ };
129
+ EventEmitter.prototype.removeAllListeners = function(event) {
130
+ var evt;
131
+ if (event) {
132
+ evt = prefix ? prefix + event : event;
133
+ if (this._events[evt]) clearEvent(this, evt);
134
+ } else {
135
+ this._events = new Events();
136
+ this._eventsCount = 0;
137
+ }
138
+ return this;
139
+ };
140
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
141
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
142
+ EventEmitter.prefixed = prefix;
143
+ EventEmitter.EventEmitter = EventEmitter;
144
+ module.exports = EventEmitter;
145
+ },
146
+ "../../node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.js": function(module) {
147
+ "use strict";
148
+ module.exports = (promise, onFinally)=>{
149
+ onFinally = onFinally || (()=>{});
150
+ return promise.then((val)=>new Promise((resolve)=>{
151
+ resolve(onFinally());
152
+ }).then(()=>val), (err)=>new Promise((resolve)=>{
153
+ resolve(onFinally());
154
+ }).then(()=>{
155
+ throw err;
156
+ }));
157
+ };
158
+ },
159
+ "../../node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.js": function(__unused_webpack_module, exports1, __webpack_require__) {
160
+ "use strict";
161
+ Object.defineProperty(exports1, "__esModule", {
162
+ value: true
163
+ });
164
+ const EventEmitter = __webpack_require__("../../node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js");
165
+ const p_timeout_1 = __webpack_require__("../../node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.js");
166
+ const priority_queue_1 = __webpack_require__("../../node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.js");
167
+ const empty = ()=>{};
168
+ const timeoutError = new p_timeout_1.TimeoutError();
169
+ class PQueue extends EventEmitter {
170
+ constructor(options){
171
+ var _a, _b, _c, _d;
172
+ super();
173
+ this._intervalCount = 0;
174
+ this._intervalEnd = 0;
175
+ this._pendingCount = 0;
176
+ this._resolveEmpty = empty;
177
+ this._resolveIdle = empty;
178
+ options = Object.assign({
179
+ carryoverConcurrencyCount: false,
180
+ intervalCap: 1 / 0,
181
+ interval: 0,
182
+ concurrency: 1 / 0,
183
+ autoStart: true,
184
+ queueClass: priority_queue_1.default
185
+ }, options);
186
+ if (!('number' == typeof options.intervalCap && options.intervalCap >= 1)) throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null != (_b = null == (_a = options.intervalCap) ? void 0 : _a.toString()) ? _b : ''}\` (${typeof options.intervalCap})`);
187
+ if (void 0 === options.interval || !(Number.isFinite(options.interval) && options.interval >= 0)) throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null != (_d = null == (_c = options.interval) ? void 0 : _c.toString()) ? _d : ''}\` (${typeof options.interval})`);
188
+ this._carryoverConcurrencyCount = options.carryoverConcurrencyCount;
189
+ this._isIntervalIgnored = options.intervalCap === 1 / 0 || 0 === options.interval;
190
+ this._intervalCap = options.intervalCap;
191
+ this._interval = options.interval;
192
+ this._queue = new options.queueClass();
193
+ this._queueClass = options.queueClass;
194
+ this.concurrency = options.concurrency;
195
+ this._timeout = options.timeout;
196
+ this._throwOnTimeout = true === options.throwOnTimeout;
197
+ this._isPaused = false === options.autoStart;
198
+ }
199
+ get _doesIntervalAllowAnother() {
200
+ return this._isIntervalIgnored || this._intervalCount < this._intervalCap;
201
+ }
202
+ get _doesConcurrentAllowAnother() {
203
+ return this._pendingCount < this._concurrency;
204
+ }
205
+ _next() {
206
+ this._pendingCount--;
207
+ this._tryToStartAnother();
208
+ this.emit('next');
209
+ }
210
+ _resolvePromises() {
211
+ this._resolveEmpty();
212
+ this._resolveEmpty = empty;
213
+ if (0 === this._pendingCount) {
214
+ this._resolveIdle();
215
+ this._resolveIdle = empty;
216
+ this.emit('idle');
217
+ }
218
+ }
219
+ _onResumeInterval() {
220
+ this._onInterval();
221
+ this._initializeIntervalIfNeeded();
222
+ this._timeoutId = void 0;
223
+ }
224
+ _isIntervalPaused() {
225
+ const now = Date.now();
226
+ if (void 0 === this._intervalId) {
227
+ const delay = this._intervalEnd - now;
228
+ if (delay < 0) this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
229
+ else {
230
+ if (void 0 === this._timeoutId) this._timeoutId = setTimeout(()=>{
231
+ this._onResumeInterval();
232
+ }, delay);
233
+ return true;
234
+ }
235
+ }
236
+ return false;
237
+ }
238
+ _tryToStartAnother() {
239
+ if (0 === this._queue.size) {
240
+ if (this._intervalId) clearInterval(this._intervalId);
241
+ this._intervalId = void 0;
242
+ this._resolvePromises();
243
+ return false;
244
+ }
245
+ if (!this._isPaused) {
246
+ const canInitializeInterval = !this._isIntervalPaused();
247
+ if (this._doesIntervalAllowAnother && this._doesConcurrentAllowAnother) {
248
+ const job = this._queue.dequeue();
249
+ if (!job) return false;
250
+ this.emit('active');
251
+ job();
252
+ if (canInitializeInterval) this._initializeIntervalIfNeeded();
253
+ return true;
254
+ }
255
+ }
256
+ return false;
257
+ }
258
+ _initializeIntervalIfNeeded() {
259
+ if (this._isIntervalIgnored || void 0 !== this._intervalId) return;
260
+ this._intervalId = setInterval(()=>{
261
+ this._onInterval();
262
+ }, this._interval);
263
+ this._intervalEnd = Date.now() + this._interval;
264
+ }
265
+ _onInterval() {
266
+ if (0 === this._intervalCount && 0 === this._pendingCount && this._intervalId) {
267
+ clearInterval(this._intervalId);
268
+ this._intervalId = void 0;
269
+ }
270
+ this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
271
+ this._processQueue();
272
+ }
273
+ _processQueue() {
274
+ while(this._tryToStartAnother());
275
+ }
276
+ get concurrency() {
277
+ return this._concurrency;
278
+ }
279
+ set concurrency(newConcurrency) {
280
+ if (!('number' == typeof newConcurrency && newConcurrency >= 1)) throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${newConcurrency}\` (${typeof newConcurrency})`);
281
+ this._concurrency = newConcurrency;
282
+ this._processQueue();
283
+ }
284
+ async add(fn, options = {}) {
285
+ return new Promise((resolve, reject)=>{
286
+ const run = async ()=>{
287
+ this._pendingCount++;
288
+ this._intervalCount++;
289
+ try {
290
+ const operation = void 0 === this._timeout && void 0 === options.timeout ? fn() : p_timeout_1.default(Promise.resolve(fn()), void 0 === options.timeout ? this._timeout : options.timeout, ()=>{
291
+ if (void 0 === options.throwOnTimeout ? this._throwOnTimeout : options.throwOnTimeout) reject(timeoutError);
292
+ });
293
+ resolve(await operation);
294
+ } catch (error) {
295
+ reject(error);
296
+ }
297
+ this._next();
298
+ };
299
+ this._queue.enqueue(run, options);
300
+ this._tryToStartAnother();
301
+ this.emit('add');
302
+ });
303
+ }
304
+ async addAll(functions, options) {
305
+ return Promise.all(functions.map(async (function_)=>this.add(function_, options)));
306
+ }
307
+ start() {
308
+ if (!this._isPaused) return this;
309
+ this._isPaused = false;
310
+ this._processQueue();
311
+ return this;
312
+ }
313
+ pause() {
314
+ this._isPaused = true;
315
+ }
316
+ clear() {
317
+ this._queue = new this._queueClass();
318
+ }
319
+ async onEmpty() {
320
+ if (0 === this._queue.size) return;
321
+ return new Promise((resolve)=>{
322
+ const existingResolve = this._resolveEmpty;
323
+ this._resolveEmpty = ()=>{
324
+ existingResolve();
325
+ resolve();
326
+ };
327
+ });
328
+ }
329
+ async onIdle() {
330
+ if (0 === this._pendingCount && 0 === this._queue.size) return;
331
+ return new Promise((resolve)=>{
332
+ const existingResolve = this._resolveIdle;
333
+ this._resolveIdle = ()=>{
334
+ existingResolve();
335
+ resolve();
336
+ };
337
+ });
338
+ }
339
+ get size() {
340
+ return this._queue.size;
341
+ }
342
+ sizeBy(options) {
343
+ return this._queue.filter(options).length;
344
+ }
345
+ get pending() {
346
+ return this._pendingCount;
347
+ }
348
+ get isPaused() {
349
+ return this._isPaused;
350
+ }
351
+ get timeout() {
352
+ return this._timeout;
353
+ }
354
+ set timeout(milliseconds) {
355
+ this._timeout = milliseconds;
356
+ }
357
+ }
358
+ exports1["default"] = PQueue;
359
+ },
360
+ "../../node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.js": function(__unused_webpack_module, exports1) {
361
+ "use strict";
362
+ Object.defineProperty(exports1, "__esModule", {
363
+ value: true
364
+ });
365
+ function lowerBound(array, value, comparator) {
366
+ let first = 0;
367
+ let count = array.length;
368
+ while(count > 0){
369
+ const step = count / 2 | 0;
370
+ let it = first + step;
371
+ if (comparator(array[it], value) <= 0) {
372
+ first = ++it;
373
+ count -= step + 1;
374
+ } else count = step;
375
+ }
376
+ return first;
377
+ }
378
+ exports1["default"] = lowerBound;
379
+ },
380
+ "../../node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.js": function(__unused_webpack_module, exports1, __webpack_require__) {
381
+ "use strict";
382
+ Object.defineProperty(exports1, "__esModule", {
383
+ value: true
384
+ });
385
+ const lower_bound_1 = __webpack_require__("../../node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.js");
386
+ class PriorityQueue {
387
+ constructor(){
388
+ this._queue = [];
389
+ }
390
+ enqueue(run, options) {
391
+ options = Object.assign({
392
+ priority: 0
393
+ }, options);
394
+ const element = {
395
+ priority: options.priority,
396
+ run
397
+ };
398
+ if (this.size && this._queue[this.size - 1].priority >= options.priority) return void this._queue.push(element);
399
+ const index = lower_bound_1.default(this._queue, element, (a, b)=>b.priority - a.priority);
400
+ this._queue.splice(index, 0, element);
401
+ }
402
+ dequeue() {
403
+ const item = this._queue.shift();
404
+ return null == item ? void 0 : item.run;
405
+ }
406
+ filter(options) {
407
+ return this._queue.filter((element)=>element.priority === options.priority).map((element)=>element.run);
408
+ }
409
+ get size() {
410
+ return this._queue.length;
411
+ }
412
+ }
413
+ exports1["default"] = PriorityQueue;
414
+ },
415
+ "../../node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
416
+ "use strict";
417
+ const retry = __webpack_require__("../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js");
418
+ const networkErrorMsgs = [
419
+ 'Failed to fetch',
420
+ 'NetworkError when attempting to fetch resource.',
421
+ 'The Internet connection appears to be offline.',
422
+ 'Network request failed'
423
+ ];
424
+ class AbortError extends Error {
425
+ constructor(message){
426
+ super();
427
+ if (message instanceof Error) {
428
+ this.originalError = message;
429
+ ({ message } = message);
430
+ } else {
431
+ this.originalError = new Error(message);
432
+ this.originalError.stack = this.stack;
433
+ }
434
+ this.name = 'AbortError';
435
+ this.message = message;
436
+ }
437
+ }
438
+ const decorateErrorWithCounts = (error, attemptNumber, options)=>{
439
+ const retriesLeft = options.retries - (attemptNumber - 1);
440
+ error.attemptNumber = attemptNumber;
441
+ error.retriesLeft = retriesLeft;
442
+ return error;
443
+ };
444
+ const isNetworkError = (errorMessage)=>networkErrorMsgs.includes(errorMessage);
445
+ const pRetry = (input, options)=>new Promise((resolve, reject)=>{
446
+ options = {
447
+ onFailedAttempt: ()=>{},
448
+ retries: 10,
449
+ ...options
450
+ };
451
+ const operation = retry.operation(options);
452
+ operation.attempt(async (attemptNumber)=>{
453
+ try {
454
+ resolve(await input(attemptNumber));
455
+ } catch (error) {
456
+ if (!(error instanceof Error)) return void reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
457
+ if (error instanceof AbortError) {
458
+ operation.stop();
459
+ reject(error.originalError);
460
+ } else if (error instanceof TypeError && !isNetworkError(error.message)) {
461
+ operation.stop();
462
+ reject(error);
463
+ } else {
464
+ decorateErrorWithCounts(error, attemptNumber, options);
465
+ try {
466
+ await options.onFailedAttempt(error);
467
+ } catch (error) {
468
+ reject(error);
469
+ return;
470
+ }
471
+ if (!operation.retry(error)) reject(operation.mainError());
472
+ }
473
+ }
474
+ });
475
+ });
476
+ module.exports = pRetry;
477
+ module.exports["default"] = pRetry;
478
+ module.exports.AbortError = AbortError;
479
+ },
480
+ "../../node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
481
+ "use strict";
482
+ const pFinally = __webpack_require__("../../node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.js");
483
+ class TimeoutError extends Error {
484
+ constructor(message){
485
+ super(message);
486
+ this.name = 'TimeoutError';
487
+ }
488
+ }
489
+ const pTimeout = (promise, milliseconds, fallback)=>new Promise((resolve, reject)=>{
490
+ if ('number' != typeof milliseconds || milliseconds < 0) throw new TypeError('Expected `milliseconds` to be a positive number');
491
+ if (milliseconds === 1 / 0) return void resolve(promise);
492
+ const timer = setTimeout(()=>{
493
+ if ('function' == typeof fallback) {
494
+ try {
495
+ resolve(fallback());
496
+ } catch (error) {
497
+ reject(error);
498
+ }
499
+ return;
500
+ }
501
+ const message = 'string' == typeof fallback ? fallback : `Promise timed out after ${milliseconds} milliseconds`;
502
+ const timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);
503
+ if ('function' == typeof promise.cancel) promise.cancel();
504
+ reject(timeoutError);
505
+ }, milliseconds);
506
+ pFinally(promise.then(resolve, reject), ()=>{
507
+ clearTimeout(timer);
508
+ });
509
+ });
510
+ module.exports = pTimeout;
511
+ module.exports["default"] = pTimeout;
512
+ module.exports.TimeoutError = TimeoutError;
513
+ },
514
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
515
+ module.exports = __webpack_require__("../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js");
516
+ },
517
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js": function(__unused_webpack_module, exports1, __webpack_require__) {
518
+ var RetryOperation = __webpack_require__("../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js");
519
+ exports1.operation = function(options) {
520
+ var timeouts = exports1.timeouts(options);
521
+ return new RetryOperation(timeouts, {
522
+ forever: options && (options.forever || options.retries === 1 / 0),
523
+ unref: options && options.unref,
524
+ maxRetryTime: options && options.maxRetryTime
525
+ });
526
+ };
527
+ exports1.timeouts = function(options) {
528
+ if (options instanceof Array) return [].concat(options);
529
+ var opts = {
530
+ retries: 10,
531
+ factor: 2,
532
+ minTimeout: 1000,
533
+ maxTimeout: 1 / 0,
534
+ randomize: false
535
+ };
536
+ for(var key in options)opts[key] = options[key];
537
+ if (opts.minTimeout > opts.maxTimeout) throw new Error('minTimeout is greater than maxTimeout');
538
+ var timeouts = [];
539
+ for(var i = 0; i < opts.retries; i++)timeouts.push(this.createTimeout(i, opts));
540
+ if (options && options.forever && !timeouts.length) timeouts.push(this.createTimeout(i, opts));
541
+ timeouts.sort(function(a, b) {
542
+ return a - b;
543
+ });
544
+ return timeouts;
545
+ };
546
+ exports1.createTimeout = function(attempt, opts) {
547
+ var random = opts.randomize ? Math.random() + 1 : 1;
548
+ var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
549
+ timeout = Math.min(timeout, opts.maxTimeout);
550
+ return timeout;
551
+ };
552
+ exports1.wrap = function(obj, options, methods) {
553
+ if (options instanceof Array) {
554
+ methods = options;
555
+ options = null;
556
+ }
557
+ if (!methods) {
558
+ methods = [];
559
+ for(var key in obj)if ('function' == typeof obj[key]) methods.push(key);
560
+ }
561
+ for(var i = 0; i < methods.length; i++){
562
+ var method = methods[i];
563
+ var original = obj[method];
564
+ obj[method] = (function(original) {
565
+ var op = exports1.operation(options);
566
+ var args = Array.prototype.slice.call(arguments, 1);
567
+ var callback = args.pop();
568
+ args.push(function(err) {
569
+ if (op.retry(err)) return;
570
+ if (err) arguments[0] = op.mainError();
571
+ callback.apply(this, arguments);
572
+ });
573
+ op.attempt(function() {
574
+ original.apply(obj, args);
575
+ });
576
+ }).bind(obj, original);
577
+ obj[method].options = options;
578
+ }
579
+ };
580
+ },
581
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js": function(module) {
582
+ function RetryOperation(timeouts, options) {
583
+ if ('boolean' == typeof options) options = {
584
+ forever: options
585
+ };
586
+ this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
587
+ this._timeouts = timeouts;
588
+ this._options = options || {};
589
+ this._maxRetryTime = options && options.maxRetryTime || 1 / 0;
590
+ this._fn = null;
591
+ this._errors = [];
592
+ this._attempts = 1;
593
+ this._operationTimeout = null;
594
+ this._operationTimeoutCb = null;
595
+ this._timeout = null;
596
+ this._operationStart = null;
597
+ this._timer = null;
598
+ if (this._options.forever) this._cachedTimeouts = this._timeouts.slice(0);
599
+ }
600
+ module.exports = RetryOperation;
601
+ RetryOperation.prototype.reset = function() {
602
+ this._attempts = 1;
603
+ this._timeouts = this._originalTimeouts.slice(0);
604
+ };
605
+ RetryOperation.prototype.stop = function() {
606
+ if (this._timeout) clearTimeout(this._timeout);
607
+ if (this._timer) clearTimeout(this._timer);
608
+ this._timeouts = [];
609
+ this._cachedTimeouts = null;
610
+ };
611
+ RetryOperation.prototype.retry = function(err) {
612
+ if (this._timeout) clearTimeout(this._timeout);
613
+ if (!err) return false;
614
+ var currentTime = new Date().getTime();
615
+ if (err && currentTime - this._operationStart >= this._maxRetryTime) {
616
+ this._errors.push(err);
617
+ this._errors.unshift(new Error('RetryOperation timeout occurred'));
618
+ return false;
619
+ }
620
+ this._errors.push(err);
621
+ var timeout = this._timeouts.shift();
622
+ if (void 0 === timeout) if (!this._cachedTimeouts) return false;
623
+ else {
624
+ this._errors.splice(0, this._errors.length - 1);
625
+ timeout = this._cachedTimeouts.slice(-1);
626
+ }
627
+ var self = this;
628
+ this._timer = setTimeout(function() {
629
+ self._attempts++;
630
+ if (self._operationTimeoutCb) {
631
+ self._timeout = setTimeout(function() {
632
+ self._operationTimeoutCb(self._attempts);
633
+ }, self._operationTimeout);
634
+ if (self._options.unref) self._timeout.unref();
635
+ }
636
+ self._fn(self._attempts);
637
+ }, timeout);
638
+ if (this._options.unref) this._timer.unref();
639
+ return true;
640
+ };
641
+ RetryOperation.prototype.attempt = function(fn, timeoutOps) {
642
+ this._fn = fn;
643
+ if (timeoutOps) {
644
+ if (timeoutOps.timeout) this._operationTimeout = timeoutOps.timeout;
645
+ if (timeoutOps.cb) this._operationTimeoutCb = timeoutOps.cb;
646
+ }
647
+ var self = this;
648
+ if (this._operationTimeoutCb) this._timeout = setTimeout(function() {
649
+ self._operationTimeoutCb();
650
+ }, self._operationTimeout);
651
+ this._operationStart = new Date().getTime();
652
+ this._fn(this._attempts);
653
+ };
654
+ RetryOperation.prototype.try = function(fn) {
655
+ console.log('Using RetryOperation.try() is deprecated');
656
+ this.attempt(fn);
657
+ };
658
+ RetryOperation.prototype.start = function(fn) {
659
+ console.log('Using RetryOperation.start() is deprecated');
660
+ this.attempt(fn);
661
+ };
662
+ RetryOperation.prototype.start = RetryOperation.prototype.try;
663
+ RetryOperation.prototype.errors = function() {
664
+ return this._errors;
665
+ };
666
+ RetryOperation.prototype.attempts = function() {
667
+ return this._attempts;
668
+ };
669
+ RetryOperation.prototype.mainError = function() {
670
+ if (0 === this._errors.length) return null;
671
+ var counts = {};
672
+ var mainError = null;
673
+ var mainErrorCount = 0;
674
+ for(var i = 0; i < this._errors.length; i++){
675
+ var error = this._errors[i];
676
+ var message = error.message;
677
+ var count = (counts[message] || 0) + 1;
678
+ counts[message] = count;
679
+ if (count >= mainErrorCount) {
680
+ mainError = error;
681
+ mainErrorCount = count;
682
+ }
683
+ }
684
+ return mainError;
685
+ };
686
+ },
6
687
  "../../node_modules/.pnpm/langsmith@0.3.7_openai@4.81.0_ws@8.18.3_zod@3.24.3_/node_modules/langsmith/wrappers.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
688
+ "use strict";
7
689
  __webpack_require__.d(__webpack_exports__, {
8
690
  wrapOpenAI: ()=>wrapOpenAI
9
691
  });
10
692
  var external_node_async_hooks_ = __webpack_require__("node:async_hooks");
11
- var v4 = __webpack_require__("../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v4.js");
693
+ var external_node_crypto_ = __webpack_require__("node:crypto");
694
+ var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_);
695
+ const esm_node_native = {
696
+ randomUUID: external_node_crypto_default().randomUUID
697
+ };
698
+ const rnds8Pool = new Uint8Array(256);
699
+ let poolPtr = rnds8Pool.length;
700
+ function rng() {
701
+ if (poolPtr > rnds8Pool.length - 16) {
702
+ external_node_crypto_default().randomFillSync(rnds8Pool);
703
+ poolPtr = 0;
704
+ }
705
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
706
+ }
707
+ const byteToHex = [];
708
+ for(let i = 0; i < 256; ++i)byteToHex.push((i + 0x100).toString(16).slice(1));
709
+ function unsafeStringify(arr, offset = 0) {
710
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
711
+ }
712
+ function v4_v4(options, buf, offset) {
713
+ if (esm_node_native.randomUUID && !buf && !options) return esm_node_native.randomUUID();
714
+ options = options || {};
715
+ const rnds = options.random || (options.rng || rng)();
716
+ rnds[6] = 0x0f & rnds[6] | 0x40;
717
+ rnds[8] = 0x3f & rnds[8] | 0x80;
718
+ if (buf) {
719
+ offset = offset || 0;
720
+ for(let i = 0; i < 16; ++i)buf[offset + i] = rnds[i];
721
+ return buf;
722
+ }
723
+ return unsafeStringify(rnds);
724
+ }
725
+ const v4 = v4_v4;
12
726
  var p_retry = __webpack_require__("../../node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js");
13
727
  var dist = __webpack_require__("../../node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.js");
14
728
  const DEFAULT_FETCH_IMPLEMENTATION = (...args)=>fetch(...args);
@@ -116,9 +830,13 @@ exports.modules = {
116
830
  };
117
831
  return converted;
118
832
  }
119
- var validate = __webpack_require__("../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/validate.js");
833
+ const regex = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
834
+ function validate_validate(uuid) {
835
+ return 'string' == typeof uuid && regex.test(uuid);
836
+ }
837
+ const esm_node_validate = validate_validate;
120
838
  function assertUuid(str, which) {
121
- if (!validate.Z(str)) {
839
+ if (!esm_node_validate(str)) {
122
840
  const msg = void 0 !== which ? `Invalid UUID for ${which}: ${str}` : `Invalid UUID: ${str}`;
123
841
  throw new Error(msg);
124
842
  }
@@ -173,7 +891,7 @@ exports.modules = {
173
891
  var CIRCULAR_REPLACE_NODE = {
174
892
  result: "[Circular]"
175
893
  };
176
- var arr = [];
894
+ var fast_safe_stringify_arr = [];
177
895
  var replacerStack = [];
178
896
  const encoder = new TextEncoder();
179
897
  function defaultOptions() {
@@ -203,8 +921,8 @@ exports.modules = {
203
921
  } catch (_) {
204
922
  return encodeString("[unable to serialize, circular reference is too complex to analyze]");
205
923
  } finally{
206
- while(0 !== arr.length){
207
- const part = arr.pop();
924
+ while(0 !== fast_safe_stringify_arr.length){
925
+ const part = fast_safe_stringify_arr.pop();
208
926
  if (4 === part.length) Object.defineProperty(part[0], part[1], part[3]);
209
927
  else part[0][part[1]] = part[2];
210
928
  }
@@ -218,7 +936,7 @@ exports.modules = {
218
936
  Object.defineProperty(parent, k, {
219
937
  value: replace
220
938
  });
221
- arr.push([
939
+ fast_safe_stringify_arr.push([
222
940
  parent,
223
941
  k,
224
942
  val,
@@ -231,7 +949,7 @@ exports.modules = {
231
949
  ]);
232
950
  else {
233
951
  parent[k] = replace;
234
- arr.push([
952
+ fast_safe_stringify_arr.push([
235
953
  parent,
236
954
  k,
237
955
  val
@@ -1205,7 +1923,7 @@ exports.modules = {
1205
1923
  async shareRun(runId, { shareId } = {}) {
1206
1924
  const data = {
1207
1925
  run_id: runId,
1208
- share_token: shareId || v4.Z()
1926
+ share_token: shareId || v4()
1209
1927
  };
1210
1928
  assertUuid(runId);
1211
1929
  const response = await this.caller.call(_getFetchImplementation(), `${this.apiUrl}/runs/${runId}/share`, {
@@ -2028,7 +2746,7 @@ exports.modules = {
2028
2746
  };
2029
2747
  if (feedback_source?.metadata !== void 0 && feedback_source.metadata["__run"]?.run_id !== void 0) assertUuid(feedback_source.metadata["__run"].run_id);
2030
2748
  const feedback = {
2031
- id: feedbackId ?? v4.Z(),
2749
+ id: feedbackId ?? v4(),
2032
2750
  run_id: runId,
2033
2751
  key,
2034
2752
  score,
@@ -2219,7 +2937,7 @@ exports.modules = {
2219
2937
  const body = {
2220
2938
  name,
2221
2939
  description,
2222
- id: queueId || v4.Z()
2940
+ id: queueId || v4()
2223
2941
  };
2224
2942
  const response = await this.caller.call(_getFetchImplementation(), `${this.apiUrl}/annotation-queues`, {
2225
2943
  method: "POST",
@@ -2541,7 +3259,7 @@ exports.modules = {
2541
3259
  if (!await this._getMultiPartSupport()) throw new Error("Your LangSmith version does not allow using the multipart examples endpoint, please update to the latest version.");
2542
3260
  const formData = new FormData();
2543
3261
  for (const example of uploads){
2544
- const exampleId = (example.id ?? v4.Z()).toString();
3262
+ const exampleId = (example.id ?? v4()).toString();
2545
3263
  const exampleBody = {
2546
3264
  created_at: example.created_at,
2547
3265
  ...example.metadata && {
@@ -3069,7 +3787,7 @@ exports.modules = {
3069
3787
  }
3070
3788
  static getDefaultConfig() {
3071
3789
  return {
3072
- id: v4.Z(),
3790
+ id: v4(),
3073
3791
  run_type: "chain",
3074
3792
  project_name: getLangSmithEnvironmentVariable("PROJECT") ?? getEnvironmentVariable("LANGCHAIN_SESSION") ?? "default",
3075
3793
  child_runs: [],