@pmate/cli 0.25.9 → 0.25.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +418 -240
- package/package.json +10 -17
package/dist/index.js
CHANGED
|
@@ -293,160 +293,160 @@ var init_sessionStore = __esm({
|
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
|
|
296
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
296
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/account.types.ts
|
|
297
297
|
var init_account_types = __esm({
|
|
298
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
298
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/account.types.ts"() {
|
|
299
299
|
"use strict";
|
|
300
300
|
}
|
|
301
301
|
});
|
|
302
302
|
|
|
303
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
303
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/achievements.types.ts
|
|
304
304
|
var init_achievements_types = __esm({
|
|
305
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
305
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/achievements.types.ts"() {
|
|
306
306
|
"use strict";
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
|
|
310
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
310
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/aigen.types.ts
|
|
311
311
|
var init_aigen_types = __esm({
|
|
312
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
312
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/aigen.types.ts"() {
|
|
313
313
|
"use strict";
|
|
314
314
|
}
|
|
315
315
|
});
|
|
316
316
|
|
|
317
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
317
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/agent.types.ts
|
|
318
318
|
var init_agent_types = __esm({
|
|
319
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
319
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/agent.types.ts"() {
|
|
320
320
|
"use strict";
|
|
321
321
|
}
|
|
322
322
|
});
|
|
323
323
|
|
|
324
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
324
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/agent-registry.types.ts
|
|
325
325
|
var init_agent_registry_types = __esm({
|
|
326
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
326
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/agent-registry.types.ts"() {
|
|
327
327
|
"use strict";
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
330
|
|
|
331
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
331
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/runner-registry.types.ts
|
|
332
332
|
var init_runner_registry_types = __esm({
|
|
333
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
333
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/runner-registry.types.ts"() {
|
|
334
334
|
"use strict";
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
337
|
|
|
338
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
338
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/blockchain.types.ts
|
|
339
339
|
var init_blockchain_types = __esm({
|
|
340
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
340
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/blockchain.types.ts"() {
|
|
341
341
|
"use strict";
|
|
342
342
|
}
|
|
343
343
|
});
|
|
344
344
|
|
|
345
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
345
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/breakdown.types.ts
|
|
346
346
|
var init_breakdown_types = __esm({
|
|
347
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
347
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/breakdown.types.ts"() {
|
|
348
348
|
"use strict";
|
|
349
349
|
}
|
|
350
350
|
});
|
|
351
351
|
|
|
352
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
352
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/chat.types.ts
|
|
353
353
|
var init_chat_types = __esm({
|
|
354
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
354
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/chat.types.ts"() {
|
|
355
355
|
"use strict";
|
|
356
356
|
}
|
|
357
357
|
});
|
|
358
358
|
|
|
359
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
359
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/companion.types.ts
|
|
360
360
|
var init_companion_types = __esm({
|
|
361
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
361
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/companion.types.ts"() {
|
|
362
362
|
"use strict";
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
365
|
|
|
366
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
366
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/enums.ts
|
|
367
367
|
var init_enums = __esm({
|
|
368
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
368
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/enums.ts"() {
|
|
369
369
|
"use strict";
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
372
|
|
|
373
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
373
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/lang.types.ts
|
|
374
374
|
var init_lang_types = __esm({
|
|
375
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
375
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/lang.types.ts"() {
|
|
376
376
|
"use strict";
|
|
377
377
|
}
|
|
378
378
|
});
|
|
379
379
|
|
|
380
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
380
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/logs.types.ts
|
|
381
381
|
var init_logs_types = __esm({
|
|
382
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
382
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/logs.types.ts"() {
|
|
383
383
|
"use strict";
|
|
384
384
|
}
|
|
385
385
|
});
|
|
386
386
|
|
|
387
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
387
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/message.types.ts
|
|
388
388
|
var PING, PONG;
|
|
389
389
|
var init_message_types = __esm({
|
|
390
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
390
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/message.types.ts"() {
|
|
391
391
|
"use strict";
|
|
392
392
|
PING = 1;
|
|
393
393
|
PONG = 2;
|
|
394
394
|
}
|
|
395
395
|
});
|
|
396
396
|
|
|
397
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
397
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/newLog.types.ts
|
|
398
398
|
var init_newLog_types = __esm({
|
|
399
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
399
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/newLog.types.ts"() {
|
|
400
400
|
"use strict";
|
|
401
401
|
}
|
|
402
402
|
});
|
|
403
403
|
|
|
404
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
404
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/novel.types.ts
|
|
405
405
|
var init_novel_types = __esm({
|
|
406
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
406
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/novel.types.ts"() {
|
|
407
407
|
"use strict";
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
410
|
|
|
411
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
411
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/offline.types.ts
|
|
412
412
|
var init_offline_types = __esm({
|
|
413
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
413
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/offline.types.ts"() {
|
|
414
414
|
"use strict";
|
|
415
415
|
}
|
|
416
416
|
});
|
|
417
417
|
|
|
418
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
418
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/prompt.types.ts
|
|
419
419
|
var init_prompt_types = __esm({
|
|
420
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
420
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/prompt.types.ts"() {
|
|
421
421
|
"use strict";
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
424
|
|
|
425
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
425
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/reading.types.ts
|
|
426
426
|
var init_reading_types = __esm({
|
|
427
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
427
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/reading.types.ts"() {
|
|
428
428
|
"use strict";
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
431
|
|
|
432
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
432
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/settings.types.ts
|
|
433
433
|
var init_settings_types = __esm({
|
|
434
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
434
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/settings.types.ts"() {
|
|
435
435
|
"use strict";
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
439
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/subscription.types.ts
|
|
440
440
|
var init_subscription_types = __esm({
|
|
441
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
441
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/subscription.types.ts"() {
|
|
442
442
|
"use strict";
|
|
443
443
|
}
|
|
444
444
|
});
|
|
445
445
|
|
|
446
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
446
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/types.ts
|
|
447
447
|
var buildVoiceKey, createVoice;
|
|
448
448
|
var init_types = __esm({
|
|
449
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
449
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/types.ts"() {
|
|
450
450
|
"use strict";
|
|
451
451
|
buildVoiceKey = (provider, name) => {
|
|
452
452
|
return `${provider}:${name}`;
|
|
@@ -468,44 +468,44 @@ var init_types = __esm({
|
|
|
468
468
|
}
|
|
469
469
|
});
|
|
470
470
|
|
|
471
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
471
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/wordv5.def.ts
|
|
472
472
|
var init_wordv5_def = __esm({
|
|
473
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
473
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/wordv5.def.ts"() {
|
|
474
474
|
"use strict";
|
|
475
475
|
}
|
|
476
476
|
});
|
|
477
477
|
|
|
478
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
478
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/auth.types.ts
|
|
479
479
|
var init_auth_types = __esm({
|
|
480
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
480
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/auth.types.ts"() {
|
|
481
481
|
"use strict";
|
|
482
482
|
}
|
|
483
483
|
});
|
|
484
484
|
|
|
485
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
485
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/apps.types.ts
|
|
486
486
|
var init_apps_types = __esm({
|
|
487
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
487
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/apps.types.ts"() {
|
|
488
488
|
"use strict";
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
|
|
492
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
492
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/response.types.ts
|
|
493
493
|
var init_response_types = __esm({
|
|
494
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
494
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/response.types.ts"() {
|
|
495
495
|
"use strict";
|
|
496
496
|
}
|
|
497
497
|
});
|
|
498
498
|
|
|
499
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
499
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/role.types.ts
|
|
500
500
|
var init_role_types = __esm({
|
|
501
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
501
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/role.types.ts"() {
|
|
502
502
|
"use strict";
|
|
503
503
|
}
|
|
504
504
|
});
|
|
505
505
|
|
|
506
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
506
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/index.ts
|
|
507
507
|
var init_types2 = __esm({
|
|
508
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
508
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/types/index.ts"() {
|
|
509
509
|
"use strict";
|
|
510
510
|
init_account_types();
|
|
511
511
|
init_achievements_types();
|
|
@@ -537,24 +537,24 @@ var init_types2 = __esm({
|
|
|
537
537
|
}
|
|
538
538
|
});
|
|
539
539
|
|
|
540
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
540
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/BizErrorCode.ts
|
|
541
541
|
var init_BizErrorCode = __esm({
|
|
542
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
542
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/BizErrorCode.ts"() {
|
|
543
543
|
"use strict";
|
|
544
544
|
}
|
|
545
545
|
});
|
|
546
546
|
|
|
547
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
547
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/consts.ts
|
|
548
548
|
var init_consts = __esm({
|
|
549
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
549
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/consts.ts"() {
|
|
550
550
|
"use strict";
|
|
551
551
|
}
|
|
552
552
|
});
|
|
553
553
|
|
|
554
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
554
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/TopicNames.ts
|
|
555
555
|
var TopicNames, topicKindMatchers;
|
|
556
556
|
var init_TopicNames = __esm({
|
|
557
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
557
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/TopicNames.ts"() {
|
|
558
558
|
"use strict";
|
|
559
559
|
init_types2();
|
|
560
560
|
TopicNames = class _TopicNames {
|
|
@@ -640,18 +640,18 @@ var init_TopicNames = __esm({
|
|
|
640
640
|
}
|
|
641
641
|
});
|
|
642
642
|
|
|
643
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
643
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/OSSKeys.ts
|
|
644
644
|
var init_OSSKeys = __esm({
|
|
645
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
645
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/OSSKeys.ts"() {
|
|
646
646
|
"use strict";
|
|
647
647
|
init_consts();
|
|
648
648
|
}
|
|
649
649
|
});
|
|
650
650
|
|
|
651
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
651
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/CompanionProfiles.ts
|
|
652
652
|
var openAICoral, openAIAsh, openAIBallad, openAINova, openAIVerse;
|
|
653
653
|
var init_CompanionProfiles = __esm({
|
|
654
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
654
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/CompanionProfiles.ts"() {
|
|
655
655
|
"use strict";
|
|
656
656
|
init_types2();
|
|
657
657
|
openAICoral = createVoice({
|
|
@@ -686,9 +686,9 @@ var init_CompanionProfiles = __esm({
|
|
|
686
686
|
}
|
|
687
687
|
});
|
|
688
688
|
|
|
689
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
689
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/index.ts
|
|
690
690
|
var init_config = __esm({
|
|
691
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
691
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/config/index.ts"() {
|
|
692
692
|
"use strict";
|
|
693
693
|
init_BizErrorCode();
|
|
694
694
|
init_consts();
|
|
@@ -698,9 +698,9 @@ var init_config = __esm({
|
|
|
698
698
|
}
|
|
699
699
|
});
|
|
700
700
|
|
|
701
|
-
// node_modules/.pnpm/@pmate+meta@1.1.
|
|
701
|
+
// node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/index.ts
|
|
702
702
|
var init_src = __esm({
|
|
703
|
-
"node_modules/.pnpm/@pmate+meta@1.1.
|
|
703
|
+
"node_modules/.pnpm/@pmate+meta@1.1.15/node_modules/@pmate/meta/src/index.ts"() {
|
|
704
704
|
"use strict";
|
|
705
705
|
init_types2();
|
|
706
706
|
init_config();
|
|
@@ -8277,7 +8277,7 @@ var init_src3 = __esm({
|
|
|
8277
8277
|
}
|
|
8278
8278
|
});
|
|
8279
8279
|
|
|
8280
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
8280
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/debug.js
|
|
8281
8281
|
function isDebugEnabled() {
|
|
8282
8282
|
return process.env.DEBUG === "1";
|
|
8283
8283
|
}
|
|
@@ -8292,15 +8292,294 @@ function debugLog(message, data) {
|
|
|
8292
8292
|
console.log(message, data);
|
|
8293
8293
|
}
|
|
8294
8294
|
var init_debug = __esm({
|
|
8295
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
8295
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/debug.js"() {
|
|
8296
8296
|
"use strict";
|
|
8297
8297
|
}
|
|
8298
8298
|
});
|
|
8299
8299
|
|
|
8300
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
8300
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentConnectionPool.js
|
|
8301
|
+
function ensureProtocol(value, protocol) {
|
|
8302
|
+
if (!value) {
|
|
8303
|
+
return "";
|
|
8304
|
+
}
|
|
8305
|
+
if (/^[a-z]+:\/\//i.test(value)) {
|
|
8306
|
+
try {
|
|
8307
|
+
const url = new URL(value);
|
|
8308
|
+
url.protocol = `${protocol}:`;
|
|
8309
|
+
return url.toString();
|
|
8310
|
+
} catch {
|
|
8311
|
+
return value;
|
|
8312
|
+
}
|
|
8313
|
+
}
|
|
8314
|
+
if (value.startsWith("//")) {
|
|
8315
|
+
return `${protocol}:${value}`;
|
|
8316
|
+
}
|
|
8317
|
+
return `${protocol}://${value}`;
|
|
8318
|
+
}
|
|
8319
|
+
function createPoolKey(wsUrl, profileId, token) {
|
|
8320
|
+
return `${wsUrl}|${profileId}|${hashToken(token)}`;
|
|
8321
|
+
}
|
|
8322
|
+
function hashToken(token) {
|
|
8323
|
+
let hash = 2166136261;
|
|
8324
|
+
for (let i = 0; i < token.length; i += 1) {
|
|
8325
|
+
hash ^= token.charCodeAt(i);
|
|
8326
|
+
hash = Math.imul(hash, 16777619);
|
|
8327
|
+
}
|
|
8328
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
8329
|
+
}
|
|
8330
|
+
var IDLE_CLOSE_MS, pool, AgentConnectionPool, AgentPooledConnection;
|
|
8331
|
+
var init_AgentConnectionPool = __esm({
|
|
8332
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentConnectionPool.js"() {
|
|
8333
|
+
"use strict";
|
|
8334
|
+
init_src();
|
|
8335
|
+
init_src3();
|
|
8336
|
+
init_debug();
|
|
8337
|
+
IDLE_CLOSE_MS = 5e3;
|
|
8338
|
+
pool = /* @__PURE__ */ new Map();
|
|
8339
|
+
AgentConnectionPool = class {
|
|
8340
|
+
static acquire(options) {
|
|
8341
|
+
const wsUrl = ensureProtocol(options.baseUrl, "wss");
|
|
8342
|
+
const key = createPoolKey(wsUrl, options.profileId, options.token);
|
|
8343
|
+
let entry = pool.get(key);
|
|
8344
|
+
if (!entry) {
|
|
8345
|
+
entry = {
|
|
8346
|
+
connection: new AgentPooledConnection(wsUrl, options.profileId, options.token),
|
|
8347
|
+
refCount: 0,
|
|
8348
|
+
idleTimer: null
|
|
8349
|
+
};
|
|
8350
|
+
pool.set(key, entry);
|
|
8351
|
+
}
|
|
8352
|
+
if (entry.idleTimer) {
|
|
8353
|
+
clearTimeout(entry.idleTimer);
|
|
8354
|
+
entry.idleTimer = null;
|
|
8355
|
+
}
|
|
8356
|
+
entry.refCount += 1;
|
|
8357
|
+
return {
|
|
8358
|
+
key,
|
|
8359
|
+
connection: entry.connection
|
|
8360
|
+
};
|
|
8361
|
+
}
|
|
8362
|
+
static release(lease) {
|
|
8363
|
+
const entry = pool.get(lease.key);
|
|
8364
|
+
if (!entry) {
|
|
8365
|
+
return;
|
|
8366
|
+
}
|
|
8367
|
+
entry.refCount = Math.max(0, entry.refCount - 1);
|
|
8368
|
+
if (entry.refCount > 0 || entry.idleTimer) {
|
|
8369
|
+
return;
|
|
8370
|
+
}
|
|
8371
|
+
entry.idleTimer = setTimeout(() => {
|
|
8372
|
+
const current = pool.get(lease.key);
|
|
8373
|
+
if (!current || current.refCount > 0) {
|
|
8374
|
+
return;
|
|
8375
|
+
}
|
|
8376
|
+
current.connection.close();
|
|
8377
|
+
pool.delete(lease.key);
|
|
8378
|
+
}, IDLE_CLOSE_MS);
|
|
8379
|
+
}
|
|
8380
|
+
static clearForTests() {
|
|
8381
|
+
for (const [key, entry] of pool.entries()) {
|
|
8382
|
+
if (entry.idleTimer) {
|
|
8383
|
+
clearTimeout(entry.idleTimer);
|
|
8384
|
+
}
|
|
8385
|
+
entry.connection.close();
|
|
8386
|
+
pool.delete(key);
|
|
8387
|
+
}
|
|
8388
|
+
}
|
|
8389
|
+
};
|
|
8390
|
+
AgentPooledConnection = class {
|
|
8391
|
+
constructor(wsUrl, profileId, token) {
|
|
8392
|
+
this.profileId = profileId;
|
|
8393
|
+
this.token = token;
|
|
8394
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
8395
|
+
this.authPromise = null;
|
|
8396
|
+
this.authResolve = null;
|
|
8397
|
+
this.authReject = null;
|
|
8398
|
+
this.authTimer = null;
|
|
8399
|
+
this.authenticated = false;
|
|
8400
|
+
this.authStarted = false;
|
|
8401
|
+
this.ws = new WebsocketClientV2(wsUrl);
|
|
8402
|
+
this.startWsStream();
|
|
8403
|
+
}
|
|
8404
|
+
addListener(listener) {
|
|
8405
|
+
this.listeners.add(listener);
|
|
8406
|
+
}
|
|
8407
|
+
removeListener(listener) {
|
|
8408
|
+
this.listeners.delete(listener);
|
|
8409
|
+
}
|
|
8410
|
+
isConnected() {
|
|
8411
|
+
return this.ws.isConnected();
|
|
8412
|
+
}
|
|
8413
|
+
async authenticate(timeoutMs) {
|
|
8414
|
+
await this.waitForConnection(timeoutMs);
|
|
8415
|
+
if (this.authenticated) {
|
|
8416
|
+
debugLog("[agent-connection-pool] auth reused", {
|
|
8417
|
+
profileId: this.profileId
|
|
8418
|
+
});
|
|
8419
|
+
return;
|
|
8420
|
+
}
|
|
8421
|
+
const waiter = this.waitForAuthAck(timeoutMs);
|
|
8422
|
+
if (!this.authStarted) {
|
|
8423
|
+
this.authStarted = true;
|
|
8424
|
+
const msg = Msg.create(this.profileId, "@hub", 4 /* AUTH */, {
|
|
8425
|
+
token: this.token,
|
|
8426
|
+
as: "user",
|
|
8427
|
+
profileId: this.profileId
|
|
8428
|
+
});
|
|
8429
|
+
debugLog("[agent-connection-pool] auth sent", {
|
|
8430
|
+
profileId: this.profileId
|
|
8431
|
+
});
|
|
8432
|
+
await this.ws.sendMsg(msg);
|
|
8433
|
+
}
|
|
8434
|
+
await waiter;
|
|
8435
|
+
}
|
|
8436
|
+
sendMsg(msg) {
|
|
8437
|
+
return this.ws.sendMsg(msg);
|
|
8438
|
+
}
|
|
8439
|
+
close() {
|
|
8440
|
+
this.ws.close();
|
|
8441
|
+
this.rejectAuth(new Error("Agent websocket closed before auth ack"));
|
|
8442
|
+
this.listeners.clear();
|
|
8443
|
+
}
|
|
8444
|
+
async startWsStream() {
|
|
8445
|
+
const stream = this.ws.getStream();
|
|
8446
|
+
try {
|
|
8447
|
+
for await (const event of stream) {
|
|
8448
|
+
this.handleWsEvent(event);
|
|
8449
|
+
}
|
|
8450
|
+
} catch {
|
|
8451
|
+
}
|
|
8452
|
+
}
|
|
8453
|
+
handleWsEvent(event) {
|
|
8454
|
+
if (event.type === "message") {
|
|
8455
|
+
this.handleIncomingMessage(event.data);
|
|
8456
|
+
return;
|
|
8457
|
+
}
|
|
8458
|
+
if (event.type === "connected" && !event.data) {
|
|
8459
|
+
this.authenticated = false;
|
|
8460
|
+
this.rejectAuth(new Error("Agent websocket disconnected before auth ack"));
|
|
8461
|
+
}
|
|
8462
|
+
if (event.type === "error") {
|
|
8463
|
+
this.rejectAuth(new Error("Agent websocket error before auth ack"));
|
|
8464
|
+
}
|
|
8465
|
+
this.broadcast(event);
|
|
8466
|
+
}
|
|
8467
|
+
handleIncomingMessage(message) {
|
|
8468
|
+
if (!message || typeof message !== "object") {
|
|
8469
|
+
return;
|
|
8470
|
+
}
|
|
8471
|
+
if (message.opcode === 3 /* ACK */) {
|
|
8472
|
+
const ack = message.body;
|
|
8473
|
+
const success = ack?.status === "ok";
|
|
8474
|
+
debugLog("[agent-connection-pool] ack received", {
|
|
8475
|
+
profileId: this.profileId,
|
|
8476
|
+
success
|
|
8477
|
+
});
|
|
8478
|
+
if (!success) {
|
|
8479
|
+
this.rejectAuth(new Error(ack?.message ?? ack?.code ?? "Auth failed"));
|
|
8480
|
+
return;
|
|
8481
|
+
}
|
|
8482
|
+
this.authenticated = true;
|
|
8483
|
+
this.resolveAuth();
|
|
8484
|
+
return;
|
|
8485
|
+
}
|
|
8486
|
+
debugLog("[agent-connection-pool] message broadcast", {
|
|
8487
|
+
opcode: message.opcode,
|
|
8488
|
+
from: message.from,
|
|
8489
|
+
to: message.to
|
|
8490
|
+
});
|
|
8491
|
+
this.broadcast({ type: "message", data: message });
|
|
8492
|
+
}
|
|
8493
|
+
broadcast(event) {
|
|
8494
|
+
for (const listener of this.listeners) {
|
|
8495
|
+
listener.onConnectionEvent(event);
|
|
8496
|
+
}
|
|
8497
|
+
}
|
|
8498
|
+
waitForConnection(timeoutMs) {
|
|
8499
|
+
if (this.ws.isConnected()) {
|
|
8500
|
+
return Promise.resolve();
|
|
8501
|
+
}
|
|
8502
|
+
return new Promise((resolve, reject) => {
|
|
8503
|
+
const timer = setTimeout(() => {
|
|
8504
|
+
off();
|
|
8505
|
+
reject(new Error("Websocket connect timeout"));
|
|
8506
|
+
}, timeoutMs);
|
|
8507
|
+
const off = this.createOneShotListener("connected" /* Connected */, (connected) => {
|
|
8508
|
+
if (connected) {
|
|
8509
|
+
clearTimeout(timer);
|
|
8510
|
+
off();
|
|
8511
|
+
resolve();
|
|
8512
|
+
}
|
|
8513
|
+
});
|
|
8514
|
+
});
|
|
8515
|
+
}
|
|
8516
|
+
waitForAuthAck(timeoutMs) {
|
|
8517
|
+
if (this.authenticated) {
|
|
8518
|
+
return Promise.resolve();
|
|
8519
|
+
}
|
|
8520
|
+
if (this.authPromise) {
|
|
8521
|
+
return this.authPromise;
|
|
8522
|
+
}
|
|
8523
|
+
this.authPromise = new Promise((resolve, reject) => {
|
|
8524
|
+
this.authResolve = resolve;
|
|
8525
|
+
this.authReject = reject;
|
|
8526
|
+
this.authTimer = setTimeout(() => {
|
|
8527
|
+
this.clearAuthWaiter();
|
|
8528
|
+
this.authStarted = false;
|
|
8529
|
+
reject(new Error("Auth timeout"));
|
|
8530
|
+
}, timeoutMs);
|
|
8531
|
+
});
|
|
8532
|
+
return this.authPromise;
|
|
8533
|
+
}
|
|
8534
|
+
resolveAuth() {
|
|
8535
|
+
if (!this.authResolve) {
|
|
8536
|
+
return;
|
|
8537
|
+
}
|
|
8538
|
+
const resolve = this.authResolve;
|
|
8539
|
+
this.clearAuthWaiter();
|
|
8540
|
+
this.authStarted = false;
|
|
8541
|
+
resolve();
|
|
8542
|
+
}
|
|
8543
|
+
rejectAuth(error) {
|
|
8544
|
+
if (!this.authReject) {
|
|
8545
|
+
return;
|
|
8546
|
+
}
|
|
8547
|
+
const reject = this.authReject;
|
|
8548
|
+
this.clearAuthWaiter();
|
|
8549
|
+
this.authStarted = false;
|
|
8550
|
+
reject(error);
|
|
8551
|
+
}
|
|
8552
|
+
clearAuthWaiter() {
|
|
8553
|
+
if (this.authTimer) {
|
|
8554
|
+
clearTimeout(this.authTimer);
|
|
8555
|
+
this.authTimer = null;
|
|
8556
|
+
}
|
|
8557
|
+
this.authPromise = null;
|
|
8558
|
+
this.authResolve = null;
|
|
8559
|
+
this.authReject = null;
|
|
8560
|
+
}
|
|
8561
|
+
createOneShotListener(eventName, handler) {
|
|
8562
|
+
const listener = {
|
|
8563
|
+
onConnectionEvent: (event) => {
|
|
8564
|
+
if (eventName === "connected" /* Connected */ && event.type === "connected") {
|
|
8565
|
+
;
|
|
8566
|
+
handler(event.data);
|
|
8567
|
+
}
|
|
8568
|
+
}
|
|
8569
|
+
};
|
|
8570
|
+
this.addListener(listener);
|
|
8571
|
+
return () => {
|
|
8572
|
+
this.removeListener(listener);
|
|
8573
|
+
};
|
|
8574
|
+
}
|
|
8575
|
+
};
|
|
8576
|
+
}
|
|
8577
|
+
});
|
|
8578
|
+
|
|
8579
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentTaskManager.js
|
|
8301
8580
|
var AgentTaskManager;
|
|
8302
8581
|
var init_AgentTaskManager = __esm({
|
|
8303
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
8582
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentTaskManager.js"() {
|
|
8304
8583
|
"use strict";
|
|
8305
8584
|
init_src3();
|
|
8306
8585
|
init_debug();
|
|
@@ -8469,7 +8748,7 @@ var init_AgentTaskManager = __esm({
|
|
|
8469
8748
|
}
|
|
8470
8749
|
});
|
|
8471
8750
|
|
|
8472
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
8751
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentClient.js
|
|
8473
8752
|
function createAgentRequestBody(payload) {
|
|
8474
8753
|
return {
|
|
8475
8754
|
kind: "request",
|
|
@@ -8478,10 +8757,11 @@ function createAgentRequestBody(payload) {
|
|
|
8478
8757
|
}
|
|
8479
8758
|
var logger5, DEFAULT_TIMEOUT_MS, DEFAULT_STREAM_TIMEOUT_MS, DEFAULT_MIN_CHUNK_SIZE_BYTES, AgentClient;
|
|
8480
8759
|
var init_AgentClient = __esm({
|
|
8481
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
8760
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentClient.js"() {
|
|
8482
8761
|
"use strict";
|
|
8483
8762
|
init_src();
|
|
8484
8763
|
init_src3();
|
|
8764
|
+
init_AgentConnectionPool();
|
|
8485
8765
|
init_AgentTaskManager();
|
|
8486
8766
|
init_debug();
|
|
8487
8767
|
logger5 = Logger.getDebugger("AgentClient");
|
|
@@ -8492,11 +8772,6 @@ var init_AgentClient = __esm({
|
|
|
8492
8772
|
constructor(options) {
|
|
8493
8773
|
super();
|
|
8494
8774
|
this.tasks = new AgentTaskManager();
|
|
8495
|
-
this.authPromise = null;
|
|
8496
|
-
this.authResolve = null;
|
|
8497
|
-
this.authReject = null;
|
|
8498
|
-
this.authTimer = null;
|
|
8499
|
-
this.wsGeneration = 0;
|
|
8500
8775
|
this.defaultRequestType = "application/json";
|
|
8501
8776
|
this.defaultBinaryType = "application/octet-stream";
|
|
8502
8777
|
this.baseUrl = options.baseUrl;
|
|
@@ -8504,13 +8779,12 @@ var init_AgentClient = __esm({
|
|
|
8504
8779
|
this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
8505
8780
|
this.streamTimeoutMs = options.streamTimeoutMs ?? DEFAULT_STREAM_TIMEOUT_MS;
|
|
8506
8781
|
this.minChunkSizeBytes = options.minChunkSizeBytes ?? DEFAULT_MIN_CHUNK_SIZE_BYTES;
|
|
8507
|
-
this.resetWebsocket(this.baseUrl);
|
|
8508
8782
|
}
|
|
8509
8783
|
isConnected() {
|
|
8510
|
-
return this.
|
|
8784
|
+
return this.lease?.connection.isConnected() ?? false;
|
|
8511
8785
|
}
|
|
8512
8786
|
close() {
|
|
8513
|
-
this.
|
|
8787
|
+
this.releaseConnection();
|
|
8514
8788
|
}
|
|
8515
8789
|
async login(options) {
|
|
8516
8790
|
const profileId = options?.profileId;
|
|
@@ -8519,13 +8793,19 @@ var init_AgentClient = __esm({
|
|
|
8519
8793
|
}
|
|
8520
8794
|
this.from = profileId;
|
|
8521
8795
|
const baseUrl = options?.baseUrl ?? this.baseUrl;
|
|
8522
|
-
if (baseUrl !== this.baseUrl) {
|
|
8523
|
-
this.resetWebsocket(baseUrl);
|
|
8524
|
-
}
|
|
8525
8796
|
const timeoutMs = options?.timeoutMs ?? this.timeoutMs;
|
|
8526
|
-
await this.waitForConnection(timeoutMs);
|
|
8527
8797
|
const token = options?.token ?? "";
|
|
8528
|
-
|
|
8798
|
+
this.auth = { token, profileId };
|
|
8799
|
+
const lease = AgentConnectionPool.acquire({ baseUrl, token, profileId });
|
|
8800
|
+
if (this.lease?.key !== lease.key) {
|
|
8801
|
+
this.releaseConnection();
|
|
8802
|
+
this.lease = lease;
|
|
8803
|
+
this.lease.connection.addListener(this);
|
|
8804
|
+
} else {
|
|
8805
|
+
AgentConnectionPool.release(lease);
|
|
8806
|
+
}
|
|
8807
|
+
this.baseUrl = baseUrl;
|
|
8808
|
+
await this.lease.connection.authenticate(timeoutMs);
|
|
8529
8809
|
return true;
|
|
8530
8810
|
}
|
|
8531
8811
|
async prompt(request) {
|
|
@@ -8562,11 +8842,18 @@ var init_AgentClient = __esm({
|
|
|
8562
8842
|
taskId,
|
|
8563
8843
|
agentId: request.agentId,
|
|
8564
8844
|
op: 0 /* Start */,
|
|
8845
|
+
auth: this.auth,
|
|
8565
8846
|
type: this.defaultRequestType,
|
|
8566
8847
|
...request.payload ? { payload: request.payload } : {}
|
|
8567
8848
|
};
|
|
8568
8849
|
const msg = Msg.create(this.from, hubTo, 2 /* AGENT */, createAgentRequestBody(startPayload), 0 /* PIPELINE */);
|
|
8569
|
-
|
|
8850
|
+
debugLog("[agent-client] sending agent request", {
|
|
8851
|
+
taskId,
|
|
8852
|
+
agentId: request.agentId,
|
|
8853
|
+
from: this.from,
|
|
8854
|
+
to: hubTo
|
|
8855
|
+
});
|
|
8856
|
+
await this.lease.connection.sendMsg(msg);
|
|
8570
8857
|
return await waiter;
|
|
8571
8858
|
}
|
|
8572
8859
|
stream(request) {
|
|
@@ -8578,7 +8865,7 @@ var init_AgentClient = __esm({
|
|
|
8578
8865
|
timeoutMode: "reject"
|
|
8579
8866
|
});
|
|
8580
8867
|
const from = this.from;
|
|
8581
|
-
const
|
|
8868
|
+
const connection = this.lease.connection;
|
|
8582
8869
|
const minChunkSizeBytes = request.minChunkSizeBytes ?? this.minChunkSizeBytes;
|
|
8583
8870
|
const inputStream = minChunkSizeBytes > 0 ? AsyncStream.chunkBlob(request.stream, {
|
|
8584
8871
|
minBytes: minChunkSizeBytes
|
|
@@ -8620,29 +8907,32 @@ var init_AgentClient = __esm({
|
|
|
8620
8907
|
taskId,
|
|
8621
8908
|
agentId: request.agentId,
|
|
8622
8909
|
op: 0 /* Start */,
|
|
8910
|
+
auth: this.auth,
|
|
8623
8911
|
type: this.defaultRequestType,
|
|
8624
8912
|
...request.params ? { payload: request.params } : {}
|
|
8625
8913
|
}), 0 /* PIPELINE */);
|
|
8626
|
-
await
|
|
8914
|
+
await connection.sendMsg(startMsg);
|
|
8627
8915
|
for await (const payload of inputStream) {
|
|
8628
8916
|
const dataType = payload instanceof Blob ? payload.type || this.defaultBinaryType : payload instanceof Uint8Array || payload instanceof ArrayBuffer ? this.defaultBinaryType : typeof payload === "string" ? "text" : this.defaultRequestType;
|
|
8629
8917
|
const body = {
|
|
8630
8918
|
taskId,
|
|
8631
8919
|
agentId: request.agentId,
|
|
8632
8920
|
op: 1 /* Data */,
|
|
8921
|
+
auth: this.auth,
|
|
8633
8922
|
type: dataType,
|
|
8634
8923
|
payload
|
|
8635
8924
|
};
|
|
8636
8925
|
const msg = Msg.create(from, hubTo, 2 /* AGENT */, createAgentRequestBody(body), 0 /* PIPELINE */);
|
|
8637
|
-
await
|
|
8926
|
+
await connection.sendMsg(msg);
|
|
8638
8927
|
}
|
|
8639
8928
|
const endMsg = Msg.create(from, hubTo, 2 /* AGENT */, createAgentRequestBody({
|
|
8640
8929
|
taskId,
|
|
8641
8930
|
agentId: request.agentId,
|
|
8642
8931
|
op: 2 /* End */,
|
|
8932
|
+
auth: this.auth,
|
|
8643
8933
|
type: this.defaultRequestType
|
|
8644
8934
|
}), 0 /* PIPELINE */);
|
|
8645
|
-
await
|
|
8935
|
+
await connection.sendMsg(endMsg);
|
|
8646
8936
|
};
|
|
8647
8937
|
void startDataStream();
|
|
8648
8938
|
const agentStream = outputStream;
|
|
@@ -8693,7 +8983,7 @@ var init_AgentClient = __esm({
|
|
|
8693
8983
|
return agentStream;
|
|
8694
8984
|
}
|
|
8695
8985
|
ensureReady() {
|
|
8696
|
-
if (!this.
|
|
8986
|
+
if (!this.lease || !this.from || !this.auth) {
|
|
8697
8987
|
throw new Error("AgentClient not logged in");
|
|
8698
8988
|
}
|
|
8699
8989
|
}
|
|
@@ -8701,31 +8991,7 @@ var init_AgentClient = __esm({
|
|
|
8701
8991
|
const rnd = Math.floor(Math.random() * 1e12);
|
|
8702
8992
|
return uniqHash(`${agentId}-${Date.now()}-${rnd}`, "task-v1" /* Task */);
|
|
8703
8993
|
}
|
|
8704
|
-
|
|
8705
|
-
return new WebsocketClientV2(this.ensureProtocol(baseUrl, "wss"));
|
|
8706
|
-
}
|
|
8707
|
-
resetWebsocket(baseUrl) {
|
|
8708
|
-
this.baseUrl = baseUrl;
|
|
8709
|
-
if (this.ws) {
|
|
8710
|
-
this.ws.close();
|
|
8711
|
-
}
|
|
8712
|
-
this.ws = this.createWebsocketClient(this.baseUrl);
|
|
8713
|
-
this.wsGeneration += 1;
|
|
8714
|
-
this.startWsStream(this.ws, this.wsGeneration);
|
|
8715
|
-
}
|
|
8716
|
-
async startWsStream(ws, generation) {
|
|
8717
|
-
const stream = ws.getStream();
|
|
8718
|
-
try {
|
|
8719
|
-
for await (const event of stream) {
|
|
8720
|
-
if (generation !== this.wsGeneration) {
|
|
8721
|
-
break;
|
|
8722
|
-
}
|
|
8723
|
-
this.handleWsEvent(event);
|
|
8724
|
-
}
|
|
8725
|
-
} catch {
|
|
8726
|
-
}
|
|
8727
|
-
}
|
|
8728
|
-
handleWsEvent(event) {
|
|
8994
|
+
onConnectionEvent(event) {
|
|
8729
8995
|
if (event.type === "message") {
|
|
8730
8996
|
this.handleIncomingMessage(event.data);
|
|
8731
8997
|
return;
|
|
@@ -8736,30 +9002,16 @@ var init_AgentClient = __esm({
|
|
|
8736
9002
|
}
|
|
8737
9003
|
if (event.type === "connected") {
|
|
8738
9004
|
this.emit("connected" /* Connected */, event.data);
|
|
8739
|
-
if (!event.data) {
|
|
8740
|
-
this.rejectAuth(new Error("Agent websocket disconnected before auth ack"));
|
|
8741
|
-
}
|
|
8742
9005
|
return;
|
|
8743
9006
|
}
|
|
8744
9007
|
if (event.type === "error") {
|
|
8745
9008
|
this.emit("error" /* Error */, event.data);
|
|
8746
|
-
this.rejectAuth(new Error("Agent websocket error before auth ack"));
|
|
8747
9009
|
}
|
|
8748
9010
|
}
|
|
8749
9011
|
handleIncomingMessage(message) {
|
|
8750
9012
|
if (!message || typeof message !== "object") {
|
|
8751
9013
|
return;
|
|
8752
9014
|
}
|
|
8753
|
-
if (message.opcode === 3 /* ACK */) {
|
|
8754
|
-
const ack = message.body;
|
|
8755
|
-
const success = ack?.status === "ok";
|
|
8756
|
-
if (!success) {
|
|
8757
|
-
this.rejectAuth(new Error(ack?.message ?? ack?.code ?? "Auth failed"));
|
|
8758
|
-
return;
|
|
8759
|
-
}
|
|
8760
|
-
this.resolveAuth();
|
|
8761
|
-
return;
|
|
8762
|
-
}
|
|
8763
9015
|
if (message.opcode === 2 /* AGENT */) {
|
|
8764
9016
|
const agentBody = message.body;
|
|
8765
9017
|
if (agentBody?.kind !== "response") {
|
|
@@ -8777,121 +9029,38 @@ var init_AgentClient = __esm({
|
|
|
8777
9029
|
this.tasks.handleResponse(body);
|
|
8778
9030
|
}
|
|
8779
9031
|
}
|
|
8780
|
-
|
|
8781
|
-
if (!
|
|
8782
|
-
return "";
|
|
8783
|
-
}
|
|
8784
|
-
if (/^[a-z]+:\/\//i.test(value)) {
|
|
8785
|
-
try {
|
|
8786
|
-
const url = new URL(value);
|
|
8787
|
-
url.protocol = `${protocol}:`;
|
|
8788
|
-
return url.toString();
|
|
8789
|
-
} catch {
|
|
8790
|
-
return value;
|
|
8791
|
-
}
|
|
8792
|
-
}
|
|
8793
|
-
if (value.startsWith("//")) {
|
|
8794
|
-
return `${protocol}:${value}`;
|
|
8795
|
-
}
|
|
8796
|
-
return `${protocol}://${value}`;
|
|
8797
|
-
}
|
|
8798
|
-
waitForConnection(timeoutMs) {
|
|
8799
|
-
if (!this.ws) {
|
|
8800
|
-
return Promise.reject(new Error("Websocket client not initialized"));
|
|
8801
|
-
}
|
|
8802
|
-
if (this.ws.isConnected()) {
|
|
8803
|
-
return Promise.resolve();
|
|
8804
|
-
}
|
|
8805
|
-
return new Promise((resolve, reject) => {
|
|
8806
|
-
const timer = setTimeout(() => {
|
|
8807
|
-
off();
|
|
8808
|
-
reject(new Error("Websocket connect timeout"));
|
|
8809
|
-
}, timeoutMs);
|
|
8810
|
-
const off = this.on("connected" /* Connected */, (connected) => {
|
|
8811
|
-
if (connected) {
|
|
8812
|
-
clearTimeout(timer);
|
|
8813
|
-
off();
|
|
8814
|
-
resolve();
|
|
8815
|
-
}
|
|
8816
|
-
});
|
|
8817
|
-
});
|
|
8818
|
-
}
|
|
8819
|
-
async sendAuth(token, timeoutMs, profileId) {
|
|
8820
|
-
if (!this.ws || !this.from) {
|
|
8821
|
-
throw new Error("AgentClient not initialized");
|
|
8822
|
-
}
|
|
8823
|
-
const body = {
|
|
8824
|
-
token,
|
|
8825
|
-
as: "user",
|
|
8826
|
-
profileId
|
|
8827
|
-
};
|
|
8828
|
-
const msg = Msg.create(this.from, "@hub", 4 /* AUTH */, body);
|
|
8829
|
-
const waiter = this.waitForAuthAck(timeoutMs);
|
|
8830
|
-
await this.ws.sendMsg(msg);
|
|
8831
|
-
await waiter;
|
|
8832
|
-
}
|
|
8833
|
-
waitForAuthAck(timeoutMs) {
|
|
8834
|
-
if (this.authPromise) {
|
|
8835
|
-
return this.authPromise;
|
|
8836
|
-
}
|
|
8837
|
-
this.authPromise = new Promise((resolve, reject) => {
|
|
8838
|
-
this.authResolve = resolve;
|
|
8839
|
-
this.authReject = reject;
|
|
8840
|
-
this.authTimer = setTimeout(() => {
|
|
8841
|
-
this.clearAuthWaiter();
|
|
8842
|
-
reject(new Error("Auth timeout"));
|
|
8843
|
-
}, timeoutMs);
|
|
8844
|
-
});
|
|
8845
|
-
return this.authPromise;
|
|
8846
|
-
}
|
|
8847
|
-
resolveAuth() {
|
|
8848
|
-
if (!this.authResolve) {
|
|
9032
|
+
releaseConnection() {
|
|
9033
|
+
if (!this.lease) {
|
|
8849
9034
|
return;
|
|
8850
9035
|
}
|
|
8851
|
-
|
|
8852
|
-
this.
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
rejectAuth(error) {
|
|
8856
|
-
if (!this.authReject) {
|
|
8857
|
-
return;
|
|
8858
|
-
}
|
|
8859
|
-
const reject = this.authReject;
|
|
8860
|
-
this.clearAuthWaiter();
|
|
8861
|
-
reject(error);
|
|
8862
|
-
}
|
|
8863
|
-
clearAuthWaiter() {
|
|
8864
|
-
if (this.authTimer) {
|
|
8865
|
-
clearTimeout(this.authTimer);
|
|
8866
|
-
this.authTimer = null;
|
|
8867
|
-
}
|
|
8868
|
-
this.authPromise = null;
|
|
8869
|
-
this.authResolve = null;
|
|
8870
|
-
this.authReject = null;
|
|
9036
|
+
this.lease.connection.removeListener(this);
|
|
9037
|
+
AgentConnectionPool.release(this.lease);
|
|
9038
|
+
this.lease = void 0;
|
|
9039
|
+
this.auth = void 0;
|
|
8871
9040
|
}
|
|
8872
9041
|
};
|
|
8873
9042
|
}
|
|
8874
9043
|
});
|
|
8875
9044
|
|
|
8876
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9045
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentRuntime.js
|
|
8877
9046
|
var init_AgentRuntime = __esm({
|
|
8878
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9047
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentRuntime.js"() {
|
|
8879
9048
|
"use strict";
|
|
8880
9049
|
init_src();
|
|
8881
9050
|
init_src3();
|
|
8882
9051
|
}
|
|
8883
9052
|
});
|
|
8884
9053
|
|
|
8885
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9054
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/PromptTaskContext.js
|
|
8886
9055
|
var init_PromptTaskContext = __esm({
|
|
8887
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9056
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/PromptTaskContext.js"() {
|
|
8888
9057
|
"use strict";
|
|
8889
9058
|
}
|
|
8890
9059
|
});
|
|
8891
9060
|
|
|
8892
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9061
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/PromptAgent.js
|
|
8893
9062
|
var init_PromptAgent = __esm({
|
|
8894
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9063
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/PromptAgent.js"() {
|
|
8895
9064
|
"use strict";
|
|
8896
9065
|
init_src();
|
|
8897
9066
|
init_src3();
|
|
@@ -8901,16 +9070,16 @@ var init_PromptAgent = __esm({
|
|
|
8901
9070
|
}
|
|
8902
9071
|
});
|
|
8903
9072
|
|
|
8904
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9073
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/StreamTaskContext.js
|
|
8905
9074
|
var init_StreamTaskContext = __esm({
|
|
8906
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9075
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/StreamTaskContext.js"() {
|
|
8907
9076
|
"use strict";
|
|
8908
9077
|
}
|
|
8909
9078
|
});
|
|
8910
9079
|
|
|
8911
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9080
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/StreamAgent.js
|
|
8912
9081
|
var init_StreamAgent = __esm({
|
|
8913
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9082
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/StreamAgent.js"() {
|
|
8914
9083
|
"use strict";
|
|
8915
9084
|
init_src();
|
|
8916
9085
|
init_src3();
|
|
@@ -8919,16 +9088,16 @@ var init_StreamAgent = __esm({
|
|
|
8919
9088
|
}
|
|
8920
9089
|
});
|
|
8921
9090
|
|
|
8922
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9091
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentFactory.js
|
|
8923
9092
|
var init_AgentFactory = __esm({
|
|
8924
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9093
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentFactory.js"() {
|
|
8925
9094
|
"use strict";
|
|
8926
9095
|
init_PromptAgent();
|
|
8927
9096
|
init_StreamAgent();
|
|
8928
9097
|
}
|
|
8929
9098
|
});
|
|
8930
9099
|
|
|
8931
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9100
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentService.js
|
|
8932
9101
|
function parseAgentId(agentId) {
|
|
8933
9102
|
const separatorIndex = agentId.indexOf(":");
|
|
8934
9103
|
if (separatorIndex <= 0 || separatorIndex === agentId.length - 1) {
|
|
@@ -8958,7 +9127,7 @@ function trimTrailingSlash(value) {
|
|
|
8958
9127
|
}
|
|
8959
9128
|
var AgentService;
|
|
8960
9129
|
var init_AgentService = __esm({
|
|
8961
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9130
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/AgentService.js"() {
|
|
8962
9131
|
"use strict";
|
|
8963
9132
|
AgentService = class {
|
|
8964
9133
|
constructor(options) {
|
|
@@ -8999,9 +9168,9 @@ var init_AgentService = __esm({
|
|
|
8999
9168
|
}
|
|
9000
9169
|
});
|
|
9001
9170
|
|
|
9002
|
-
// node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9171
|
+
// node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/index.js
|
|
9003
9172
|
var init_dist2 = __esm({
|
|
9004
|
-
"node_modules/.pnpm/@pmate+agent-sdk@1.1.
|
|
9173
|
+
"node_modules/.pnpm/@pmate+agent-sdk@1.1.16/node_modules/@pmate/agent-sdk/dist/index.js"() {
|
|
9005
9174
|
"use strict";
|
|
9006
9175
|
init_AgentClient();
|
|
9007
9176
|
init_AgentFactory();
|
|
@@ -16260,7 +16429,16 @@ function compareNullableIsoDesc(left, right) {
|
|
|
16260
16429
|
}
|
|
16261
16430
|
function formatBotMessage(message) {
|
|
16262
16431
|
const sender = message.sender ? `${message.sender}: ` : "";
|
|
16263
|
-
|
|
16432
|
+
const files = formatBotMessageFiles(message.files);
|
|
16433
|
+
return `[${message.sentAt}] ${sender}${message.body}${files ? ` ${files}` : ""}`;
|
|
16434
|
+
}
|
|
16435
|
+
function formatBotMessageFiles(files) {
|
|
16436
|
+
if (!Array.isArray(files) || files.length === 0) return "";
|
|
16437
|
+
return files.map((file) => {
|
|
16438
|
+
const label = file.kind === "image" ? "Image" : "File";
|
|
16439
|
+
const name = file.fileName || file.path || "attachment";
|
|
16440
|
+
return `[${label}: ${name}]`;
|
|
16441
|
+
}).join(" ");
|
|
16264
16442
|
}
|
|
16265
16443
|
function truncateCliPreview(value, maxLength) {
|
|
16266
16444
|
const normalized = value.replace(/\s+/g, " ").replace(/\u200B/g, "").trim();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pmate/cli",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.10",
|
|
4
4
|
"description": "CLI utilities for the pMate project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -11,16 +11,6 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "npm run clean && tsup --config tsup.config.ts && node scripts/copy-templates.js",
|
|
16
|
-
"clean": "rimraf dist",
|
|
17
|
-
"dev": "ts-node src/index.ts",
|
|
18
|
-
"release": "npm publish",
|
|
19
|
-
"start": "node dist/index.js",
|
|
20
|
-
"test": "vitest run src/tests",
|
|
21
|
-
"typecheck": "tsc --noEmit",
|
|
22
|
-
"prepare": "npm run build"
|
|
23
|
-
},
|
|
24
14
|
"keywords": [
|
|
25
15
|
"cli",
|
|
26
16
|
"typescript",
|
|
@@ -67,10 +57,13 @@
|
|
|
67
57
|
"typescript": "^5.9.3",
|
|
68
58
|
"vitest": "^4.0.17"
|
|
69
59
|
},
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "npm run clean && tsup --config tsup.config.ts && node scripts/copy-templates.js",
|
|
62
|
+
"clean": "rimraf dist",
|
|
63
|
+
"dev": "ts-node src/index.ts",
|
|
64
|
+
"release": "npm publish",
|
|
65
|
+
"start": "node dist/index.js",
|
|
66
|
+
"test": "vitest run src/tests",
|
|
67
|
+
"typecheck": "tsc --noEmit"
|
|
75
68
|
}
|
|
76
|
-
}
|
|
69
|
+
}
|