@pmate/cli 0.30.2 → 0.32.0
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 +35 -6
- package/dist/index.d.ts +18 -0
- package/dist/index.js +636 -481
- package/dist/templates/electron/main.cjs +61 -0
- package/dist/templates/electron/resources.cjs +32 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -293,181 +293,181 @@ var init_sessionStore = __esm({
|
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
|
|
296
|
-
//
|
|
296
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/account.types.ts
|
|
297
297
|
var init_account_types = __esm({
|
|
298
|
-
"
|
|
298
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/account.types.ts"() {
|
|
299
299
|
"use strict";
|
|
300
300
|
}
|
|
301
301
|
});
|
|
302
302
|
|
|
303
|
-
//
|
|
303
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/achievements.types.ts
|
|
304
304
|
var init_achievements_types = __esm({
|
|
305
|
-
"
|
|
305
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/achievements.types.ts"() {
|
|
306
306
|
"use strict";
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
|
|
310
|
-
//
|
|
310
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/aigen.types.ts
|
|
311
311
|
var init_aigen_types = __esm({
|
|
312
|
-
"
|
|
312
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/aigen.types.ts"() {
|
|
313
313
|
"use strict";
|
|
314
314
|
}
|
|
315
315
|
});
|
|
316
316
|
|
|
317
|
-
//
|
|
317
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/agent.types.ts
|
|
318
318
|
var init_agent_types = __esm({
|
|
319
|
-
"
|
|
319
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/agent.types.ts"() {
|
|
320
320
|
"use strict";
|
|
321
321
|
}
|
|
322
322
|
});
|
|
323
323
|
|
|
324
|
-
//
|
|
324
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/agent-registry.types.ts
|
|
325
325
|
var init_agent_registry_types = __esm({
|
|
326
|
-
"
|
|
326
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/agent-registry.types.ts"() {
|
|
327
327
|
"use strict";
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
330
|
|
|
331
|
-
//
|
|
331
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/runner-registry.types.ts
|
|
332
332
|
var init_runner_registry_types = __esm({
|
|
333
|
-
"
|
|
333
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/runner-registry.types.ts"() {
|
|
334
334
|
"use strict";
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
337
|
|
|
338
|
-
//
|
|
338
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/function-registry.types.ts
|
|
339
339
|
var init_function_registry_types = __esm({
|
|
340
|
-
"
|
|
340
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/function-registry.types.ts"() {
|
|
341
341
|
"use strict";
|
|
342
342
|
}
|
|
343
343
|
});
|
|
344
344
|
|
|
345
|
-
//
|
|
345
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/worker-registry.types.ts
|
|
346
346
|
var init_worker_registry_types = __esm({
|
|
347
|
-
"
|
|
347
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/worker-registry.types.ts"() {
|
|
348
348
|
"use strict";
|
|
349
349
|
}
|
|
350
350
|
});
|
|
351
351
|
|
|
352
|
-
//
|
|
352
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/call.types.ts
|
|
353
353
|
var init_call_types = __esm({
|
|
354
|
-
"
|
|
354
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/call.types.ts"() {
|
|
355
355
|
"use strict";
|
|
356
356
|
}
|
|
357
357
|
});
|
|
358
358
|
|
|
359
|
-
//
|
|
359
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/blockchain.types.ts
|
|
360
360
|
var init_blockchain_types = __esm({
|
|
361
|
-
"
|
|
361
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/blockchain.types.ts"() {
|
|
362
362
|
"use strict";
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
365
|
|
|
366
|
-
//
|
|
366
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/breakdown.types.ts
|
|
367
367
|
var init_breakdown_types = __esm({
|
|
368
|
-
"
|
|
368
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/breakdown.types.ts"() {
|
|
369
369
|
"use strict";
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
372
|
|
|
373
|
-
//
|
|
373
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/chat.types.ts
|
|
374
374
|
var init_chat_types = __esm({
|
|
375
|
-
"
|
|
375
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/chat.types.ts"() {
|
|
376
376
|
"use strict";
|
|
377
377
|
}
|
|
378
378
|
});
|
|
379
379
|
|
|
380
|
-
//
|
|
380
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/companion.types.ts
|
|
381
381
|
var init_companion_types = __esm({
|
|
382
|
-
"
|
|
382
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/companion.types.ts"() {
|
|
383
383
|
"use strict";
|
|
384
384
|
}
|
|
385
385
|
});
|
|
386
386
|
|
|
387
|
-
//
|
|
387
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/enums.ts
|
|
388
388
|
var init_enums = __esm({
|
|
389
|
-
"
|
|
389
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/enums.ts"() {
|
|
390
390
|
"use strict";
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
393
|
|
|
394
|
-
//
|
|
394
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/lang.types.ts
|
|
395
395
|
var init_lang_types = __esm({
|
|
396
|
-
"
|
|
396
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/lang.types.ts"() {
|
|
397
397
|
"use strict";
|
|
398
398
|
}
|
|
399
399
|
});
|
|
400
400
|
|
|
401
|
-
//
|
|
401
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/logs.types.ts
|
|
402
402
|
var init_logs_types = __esm({
|
|
403
|
-
"
|
|
403
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/logs.types.ts"() {
|
|
404
404
|
"use strict";
|
|
405
405
|
}
|
|
406
406
|
});
|
|
407
407
|
|
|
408
|
-
//
|
|
408
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/message.types.ts
|
|
409
409
|
var PING, PONG;
|
|
410
410
|
var init_message_types = __esm({
|
|
411
|
-
"
|
|
411
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/message.types.ts"() {
|
|
412
412
|
"use strict";
|
|
413
413
|
PING = 1;
|
|
414
414
|
PONG = 2;
|
|
415
415
|
}
|
|
416
416
|
});
|
|
417
417
|
|
|
418
|
-
//
|
|
418
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/newLog.types.ts
|
|
419
419
|
var init_newLog_types = __esm({
|
|
420
|
-
"
|
|
420
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/newLog.types.ts"() {
|
|
421
421
|
"use strict";
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
424
|
|
|
425
|
-
//
|
|
425
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/novel.types.ts
|
|
426
426
|
var init_novel_types = __esm({
|
|
427
|
-
"
|
|
427
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/novel.types.ts"() {
|
|
428
428
|
"use strict";
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
431
|
|
|
432
|
-
//
|
|
432
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/offline.types.ts
|
|
433
433
|
var init_offline_types = __esm({
|
|
434
|
-
"
|
|
434
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/offline.types.ts"() {
|
|
435
435
|
"use strict";
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
-
//
|
|
439
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/prompt.types.ts
|
|
440
440
|
var init_prompt_types = __esm({
|
|
441
|
-
"
|
|
441
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/prompt.types.ts"() {
|
|
442
442
|
"use strict";
|
|
443
443
|
}
|
|
444
444
|
});
|
|
445
445
|
|
|
446
|
-
//
|
|
446
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/reading.types.ts
|
|
447
447
|
var init_reading_types = __esm({
|
|
448
|
-
"
|
|
448
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/reading.types.ts"() {
|
|
449
449
|
"use strict";
|
|
450
450
|
}
|
|
451
451
|
});
|
|
452
452
|
|
|
453
|
-
//
|
|
453
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/settings.types.ts
|
|
454
454
|
var init_settings_types = __esm({
|
|
455
|
-
"
|
|
455
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/settings.types.ts"() {
|
|
456
456
|
"use strict";
|
|
457
457
|
}
|
|
458
458
|
});
|
|
459
459
|
|
|
460
|
-
//
|
|
460
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/subscription.types.ts
|
|
461
461
|
var init_subscription_types = __esm({
|
|
462
|
-
"
|
|
462
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/subscription.types.ts"() {
|
|
463
463
|
"use strict";
|
|
464
464
|
}
|
|
465
465
|
});
|
|
466
466
|
|
|
467
|
-
//
|
|
467
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/types.ts
|
|
468
468
|
var buildVoiceKey, createVoice;
|
|
469
469
|
var init_types = __esm({
|
|
470
|
-
"
|
|
470
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/types.ts"() {
|
|
471
471
|
"use strict";
|
|
472
472
|
buildVoiceKey = (provider, name) => {
|
|
473
473
|
return `${provider}:${name}`;
|
|
@@ -489,44 +489,44 @@ var init_types = __esm({
|
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
|
|
492
|
-
//
|
|
492
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/wordv5.def.ts
|
|
493
493
|
var init_wordv5_def = __esm({
|
|
494
|
-
"
|
|
494
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/wordv5.def.ts"() {
|
|
495
495
|
"use strict";
|
|
496
496
|
}
|
|
497
497
|
});
|
|
498
498
|
|
|
499
|
-
//
|
|
499
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/auth.types.ts
|
|
500
500
|
var init_auth_types = __esm({
|
|
501
|
-
"
|
|
501
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/auth.types.ts"() {
|
|
502
502
|
"use strict";
|
|
503
503
|
}
|
|
504
504
|
});
|
|
505
505
|
|
|
506
|
-
//
|
|
506
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/apps.types.ts
|
|
507
507
|
var init_apps_types = __esm({
|
|
508
|
-
"
|
|
508
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/apps.types.ts"() {
|
|
509
509
|
"use strict";
|
|
510
510
|
}
|
|
511
511
|
});
|
|
512
512
|
|
|
513
|
-
//
|
|
513
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/response.types.ts
|
|
514
514
|
var init_response_types = __esm({
|
|
515
|
-
"
|
|
515
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/response.types.ts"() {
|
|
516
516
|
"use strict";
|
|
517
517
|
}
|
|
518
518
|
});
|
|
519
519
|
|
|
520
|
-
//
|
|
520
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/role.types.ts
|
|
521
521
|
var init_role_types = __esm({
|
|
522
|
-
"
|
|
522
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/role.types.ts"() {
|
|
523
523
|
"use strict";
|
|
524
524
|
}
|
|
525
525
|
});
|
|
526
526
|
|
|
527
|
-
//
|
|
527
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/index.ts
|
|
528
528
|
var init_types2 = __esm({
|
|
529
|
-
"
|
|
529
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/types/index.ts"() {
|
|
530
530
|
"use strict";
|
|
531
531
|
init_account_types();
|
|
532
532
|
init_achievements_types();
|
|
@@ -561,24 +561,24 @@ var init_types2 = __esm({
|
|
|
561
561
|
}
|
|
562
562
|
});
|
|
563
563
|
|
|
564
|
-
//
|
|
564
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/BizErrorCode.ts
|
|
565
565
|
var init_BizErrorCode = __esm({
|
|
566
|
-
"
|
|
566
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/BizErrorCode.ts"() {
|
|
567
567
|
"use strict";
|
|
568
568
|
}
|
|
569
569
|
});
|
|
570
570
|
|
|
571
|
-
//
|
|
571
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/consts.ts
|
|
572
572
|
var init_consts = __esm({
|
|
573
|
-
"
|
|
573
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/consts.ts"() {
|
|
574
574
|
"use strict";
|
|
575
575
|
}
|
|
576
576
|
});
|
|
577
577
|
|
|
578
|
-
//
|
|
578
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/TopicNames.ts
|
|
579
579
|
var TopicNames, topicKindMatchers;
|
|
580
580
|
var init_TopicNames = __esm({
|
|
581
|
-
"
|
|
581
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/TopicNames.ts"() {
|
|
582
582
|
"use strict";
|
|
583
583
|
init_types2();
|
|
584
584
|
TopicNames = class _TopicNames {
|
|
@@ -664,18 +664,18 @@ var init_TopicNames = __esm({
|
|
|
664
664
|
}
|
|
665
665
|
});
|
|
666
666
|
|
|
667
|
-
//
|
|
667
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/OSSKeys.ts
|
|
668
668
|
var init_OSSKeys = __esm({
|
|
669
|
-
"
|
|
669
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/OSSKeys.ts"() {
|
|
670
670
|
"use strict";
|
|
671
671
|
init_consts();
|
|
672
672
|
}
|
|
673
673
|
});
|
|
674
674
|
|
|
675
|
-
//
|
|
675
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/CompanionProfiles.ts
|
|
676
676
|
var openAICoral, openAIAsh, openAIBallad, openAINova, openAIVerse;
|
|
677
677
|
var init_CompanionProfiles = __esm({
|
|
678
|
-
"
|
|
678
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/CompanionProfiles.ts"() {
|
|
679
679
|
"use strict";
|
|
680
680
|
init_types2();
|
|
681
681
|
openAICoral = createVoice({
|
|
@@ -710,9 +710,9 @@ var init_CompanionProfiles = __esm({
|
|
|
710
710
|
}
|
|
711
711
|
});
|
|
712
712
|
|
|
713
|
-
//
|
|
713
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/index.ts
|
|
714
714
|
var init_config = __esm({
|
|
715
|
-
"
|
|
715
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/config/index.ts"() {
|
|
716
716
|
"use strict";
|
|
717
717
|
init_BizErrorCode();
|
|
718
718
|
init_consts();
|
|
@@ -722,83 +722,83 @@ var init_config = __esm({
|
|
|
722
722
|
}
|
|
723
723
|
});
|
|
724
724
|
|
|
725
|
-
//
|
|
725
|
+
// node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/index.ts
|
|
726
726
|
var init_src = __esm({
|
|
727
|
-
"
|
|
727
|
+
"node_modules/.pnpm/@pmate+meta@1.3.1/node_modules/@pmate/meta/src/index.ts"() {
|
|
728
728
|
"use strict";
|
|
729
729
|
init_types2();
|
|
730
730
|
init_config();
|
|
731
731
|
}
|
|
732
732
|
});
|
|
733
733
|
|
|
734
|
-
//
|
|
734
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/base64.ts
|
|
735
735
|
var init_base64 = __esm({
|
|
736
|
-
"
|
|
736
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/base64.ts"() {
|
|
737
737
|
"use strict";
|
|
738
738
|
}
|
|
739
739
|
});
|
|
740
740
|
|
|
741
|
-
//
|
|
741
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Cache.ts
|
|
742
742
|
var init_Cache = __esm({
|
|
743
|
-
"
|
|
743
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Cache.ts"() {
|
|
744
744
|
"use strict";
|
|
745
745
|
}
|
|
746
746
|
});
|
|
747
747
|
|
|
748
|
-
//
|
|
748
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/batchResolve.ts
|
|
749
749
|
var init_batchResolve = __esm({
|
|
750
|
-
"
|
|
750
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/batchResolve.ts"() {
|
|
751
751
|
"use strict";
|
|
752
752
|
init_Cache();
|
|
753
753
|
}
|
|
754
754
|
});
|
|
755
755
|
|
|
756
|
-
//
|
|
756
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/cn/sentenceSpliter.ts
|
|
757
757
|
var init_sentenceSpliter = __esm({
|
|
758
|
-
"
|
|
758
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/cn/sentenceSpliter.ts"() {
|
|
759
759
|
"use strict";
|
|
760
760
|
}
|
|
761
761
|
});
|
|
762
762
|
|
|
763
|
-
//
|
|
763
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/cn/sentenceTrim.ts
|
|
764
764
|
var init_sentenceTrim = __esm({
|
|
765
|
-
"
|
|
765
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/cn/sentenceTrim.ts"() {
|
|
766
766
|
"use strict";
|
|
767
767
|
}
|
|
768
768
|
});
|
|
769
769
|
|
|
770
|
-
//
|
|
770
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/cn/wordSpliter.ts
|
|
771
771
|
var init_wordSpliter = __esm({
|
|
772
|
-
"
|
|
772
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/cn/wordSpliter.ts"() {
|
|
773
773
|
"use strict";
|
|
774
774
|
}
|
|
775
775
|
});
|
|
776
776
|
|
|
777
|
-
//
|
|
777
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/en/regex.ts
|
|
778
778
|
var init_regex = __esm({
|
|
779
|
-
"
|
|
779
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/en/regex.ts"() {
|
|
780
780
|
"use strict";
|
|
781
781
|
}
|
|
782
782
|
});
|
|
783
783
|
|
|
784
|
-
//
|
|
784
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/en/sentenceSpliter.ts
|
|
785
785
|
var init_sentenceSpliter2 = __esm({
|
|
786
|
-
"
|
|
786
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/en/sentenceSpliter.ts"() {
|
|
787
787
|
"use strict";
|
|
788
788
|
}
|
|
789
789
|
});
|
|
790
790
|
|
|
791
|
-
//
|
|
791
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/en/sentenceTrim.ts
|
|
792
792
|
var init_sentenceTrim2 = __esm({
|
|
793
|
-
"
|
|
793
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/en/sentenceTrim.ts"() {
|
|
794
794
|
"use strict";
|
|
795
795
|
}
|
|
796
796
|
});
|
|
797
797
|
|
|
798
|
-
//
|
|
798
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/en/wordSpliter.ts
|
|
799
799
|
var regex;
|
|
800
800
|
var init_wordSpliter2 = __esm({
|
|
801
|
-
"
|
|
801
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/en/wordSpliter.ts"() {
|
|
802
802
|
"use strict";
|
|
803
803
|
regex = new RegExp(
|
|
804
804
|
[
|
|
@@ -834,23 +834,23 @@ var init_wordSpliter2 = __esm({
|
|
|
834
834
|
}
|
|
835
835
|
});
|
|
836
836
|
|
|
837
|
-
//
|
|
837
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/kr/sentenceSpliter.ts
|
|
838
838
|
var init_sentenceSpliter3 = __esm({
|
|
839
|
-
"
|
|
839
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/kr/sentenceSpliter.ts"() {
|
|
840
840
|
"use strict";
|
|
841
841
|
}
|
|
842
842
|
});
|
|
843
843
|
|
|
844
|
-
//
|
|
844
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/kr/wordSpliter.ts
|
|
845
845
|
var init_wordSpliter3 = __esm({
|
|
846
|
-
"
|
|
846
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/kr/wordSpliter.ts"() {
|
|
847
847
|
"use strict";
|
|
848
848
|
}
|
|
849
849
|
});
|
|
850
850
|
|
|
851
|
-
//
|
|
851
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/readingSettings.ts
|
|
852
852
|
var init_readingSettings = __esm({
|
|
853
|
-
"
|
|
853
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/readingSettings.ts"() {
|
|
854
854
|
"use strict";
|
|
855
855
|
init_sentenceSpliter();
|
|
856
856
|
init_wordSpliter();
|
|
@@ -861,17 +861,17 @@ var init_readingSettings = __esm({
|
|
|
861
861
|
}
|
|
862
862
|
});
|
|
863
863
|
|
|
864
|
-
//
|
|
864
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/utils.ts
|
|
865
865
|
var init_utils = __esm({
|
|
866
|
-
"
|
|
866
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/utils.ts"() {
|
|
867
867
|
"use strict";
|
|
868
868
|
init_src();
|
|
869
869
|
}
|
|
870
870
|
});
|
|
871
871
|
|
|
872
|
-
//
|
|
872
|
+
// node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/index.ts
|
|
873
873
|
var init_src2 = __esm({
|
|
874
|
-
"
|
|
874
|
+
"node_modules/.pnpm/@pmate+lang@1.0.4/node_modules/@pmate/lang/src/index.ts"() {
|
|
875
875
|
"use strict";
|
|
876
876
|
init_sentenceSpliter();
|
|
877
877
|
init_sentenceTrim();
|
|
@@ -887,32 +887,32 @@ var init_src2 = __esm({
|
|
|
887
887
|
}
|
|
888
888
|
});
|
|
889
889
|
|
|
890
|
-
//
|
|
890
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/bookStats.ts
|
|
891
891
|
var init_bookStats = __esm({
|
|
892
|
-
"
|
|
892
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/bookStats.ts"() {
|
|
893
893
|
"use strict";
|
|
894
894
|
init_src2();
|
|
895
895
|
}
|
|
896
896
|
});
|
|
897
897
|
|
|
898
|
-
//
|
|
898
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/BoundedConcurrentQueue.ts
|
|
899
899
|
var init_BoundedConcurrentQueue = __esm({
|
|
900
|
-
"
|
|
900
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/BoundedConcurrentQueue.ts"() {
|
|
901
901
|
"use strict";
|
|
902
902
|
}
|
|
903
903
|
});
|
|
904
904
|
|
|
905
|
-
//
|
|
905
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/lru.ts
|
|
906
906
|
var init_lru = __esm({
|
|
907
|
-
"
|
|
907
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/lru.ts"() {
|
|
908
908
|
"use strict";
|
|
909
909
|
init_Cache();
|
|
910
910
|
}
|
|
911
911
|
});
|
|
912
912
|
|
|
913
|
-
//
|
|
913
|
+
// node_modules/.pnpm/js-sha3@0.9.3/node_modules/js-sha3/src/sha3.js
|
|
914
914
|
var require_sha3 = __commonJS({
|
|
915
|
-
"
|
|
915
|
+
"node_modules/.pnpm/js-sha3@0.9.3/node_modules/js-sha3/src/sha3.js"(exports2, module2) {
|
|
916
916
|
"use strict";
|
|
917
917
|
(function() {
|
|
918
918
|
"use strict";
|
|
@@ -1557,24 +1557,24 @@ var require_sha3 = __commonJS({
|
|
|
1557
1557
|
}
|
|
1558
1558
|
});
|
|
1559
1559
|
|
|
1560
|
-
//
|
|
1560
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Maybe.ts
|
|
1561
1561
|
var init_Maybe = __esm({
|
|
1562
|
-
"
|
|
1562
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Maybe.ts"() {
|
|
1563
1563
|
"use strict";
|
|
1564
1564
|
}
|
|
1565
1565
|
});
|
|
1566
1566
|
|
|
1567
|
-
//
|
|
1567
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/cacheMethodInMem.ts
|
|
1568
1568
|
var import_js_sha3;
|
|
1569
1569
|
var init_cacheMethodInMem = __esm({
|
|
1570
|
-
"
|
|
1570
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/cacheMethodInMem.ts"() {
|
|
1571
1571
|
"use strict";
|
|
1572
1572
|
import_js_sha3 = __toESM(require_sha3(), 1);
|
|
1573
1573
|
init_Maybe();
|
|
1574
1574
|
}
|
|
1575
1575
|
});
|
|
1576
1576
|
|
|
1577
|
-
//
|
|
1577
|
+
// node_modules/.pnpm/pako@2.1.0/node_modules/pako/dist/pako.esm.mjs
|
|
1578
1578
|
function zero$1(buf) {
|
|
1579
1579
|
let len = buf.length;
|
|
1580
1580
|
while (--len >= 0) {
|
|
@@ -1862,7 +1862,7 @@ function inflateRaw$1(input, options) {
|
|
|
1862
1862
|
}
|
|
1863
1863
|
var Z_FIXED$1, Z_BINARY, Z_TEXT, Z_UNKNOWN$1, STORED_BLOCK, STATIC_TREES, DYN_TREES, MIN_MATCH$1, MAX_MATCH$1, LENGTH_CODES$1, LITERALS$1, L_CODES$1, D_CODES$1, BL_CODES$1, HEAP_SIZE$1, MAX_BITS$1, Buf_size, MAX_BL_BITS, END_BLOCK, REP_3_6, REPZ_3_10, REPZ_11_138, extra_lbits, extra_dbits, extra_blbits, bl_order, DIST_CODE_LEN, static_ltree, static_dtree, _dist_code, _length_code, base_length, base_dist, static_l_desc, static_d_desc, static_bl_desc, d_code, put_short, send_bits, send_code, bi_reverse, bi_flush, gen_bitlen, gen_codes, tr_static_init, init_block, bi_windup, smaller, pqdownheap, compress_block, build_tree, scan_tree, send_tree, build_bl_tree, send_all_trees, detect_data_type, static_init_done, _tr_init$1, _tr_stored_block$1, _tr_align$1, _tr_flush_block$1, _tr_tally$1, _tr_init_1, _tr_stored_block_1, _tr_flush_block_1, _tr_tally_1, _tr_align_1, trees, adler32, adler32_1, makeTable, crcTable, crc32, crc32_1, messages, constants$2, _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align, Z_NO_FLUSH$2, Z_PARTIAL_FLUSH, Z_FULL_FLUSH$1, Z_FINISH$3, Z_BLOCK$1, Z_OK$3, Z_STREAM_END$3, Z_STREAM_ERROR$2, Z_DATA_ERROR$2, Z_BUF_ERROR$1, Z_DEFAULT_COMPRESSION$1, Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED, Z_DEFAULT_STRATEGY$1, Z_UNKNOWN, Z_DEFLATED$2, MAX_MEM_LEVEL, MAX_WBITS$1, DEF_MEM_LEVEL, LENGTH_CODES, LITERALS, L_CODES, D_CODES, BL_CODES, HEAP_SIZE, MAX_BITS, MIN_MATCH, MAX_MATCH, MIN_LOOKAHEAD, PRESET_DICT, INIT_STATE, GZIP_STATE, EXTRA_STATE, NAME_STATE, COMMENT_STATE, HCRC_STATE, BUSY_STATE, FINISH_STATE, BS_NEED_MORE, BS_BLOCK_DONE, BS_FINISH_STARTED, BS_FINISH_DONE, OS_CODE, err, rank, zero, slide_hash, HASH_ZLIB, HASH, flush_pending, flush_block_only, put_byte, putShortMSB, read_buf, longest_match, fill_window, deflate_stored, deflate_fast, deflate_slow, deflate_rle, deflate_huff, configuration_table, lm_init, deflateStateCheck, deflateResetKeep, deflateReset, deflateSetHeader, deflateInit2, deflateInit, deflate$2, deflateEnd, deflateSetDictionary, deflateInit_1, deflateInit2_1, deflateReset_1, deflateResetKeep_1, deflateSetHeader_1, deflate_2$1, deflateEnd_1, deflateSetDictionary_1, deflateInfo, deflate_1$2, _has, assign, flattenChunks, common, STR_APPLY_UIA_OK, _utf8len, string2buf, buf2binstring, buf2string, utf8border, strings, zstream, toString$1, Z_NO_FLUSH$1, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH$2, Z_OK$2, Z_STREAM_END$2, Z_DEFAULT_COMPRESSION, Z_DEFAULT_STRATEGY, Z_DEFLATED$1, Deflate_1$1, deflate_2, deflateRaw_1$1, gzip_1$1, constants$1, deflate_1$1, BAD$1, TYPE$1, inffast, MAXBITS, ENOUGH_LENS$1, ENOUGH_DISTS$1, CODES$1, LENS$1, DISTS$1, lbase, lext, dbase, dext, inflate_table, inftrees, CODES, LENS, DISTS, Z_FINISH$1, Z_BLOCK, Z_TREES, Z_OK$1, Z_STREAM_END$1, Z_NEED_DICT$1, Z_STREAM_ERROR$1, Z_DATA_ERROR$1, Z_MEM_ERROR$1, Z_BUF_ERROR, Z_DEFLATED, HEAD, FLAGS, TIME, OS, EXLEN, EXTRA, NAME, COMMENT, HCRC, DICTID, DICT, TYPE, TYPEDO, STORED, COPY_, COPY, TABLE, LENLENS, CODELENS, LEN_, LEN, LENEXT, DIST, DISTEXT, MATCH, LIT, CHECK, LENGTH, DONE, BAD, MEM, SYNC, ENOUGH_LENS, ENOUGH_DISTS, MAX_WBITS, DEF_WBITS, zswap32, inflateStateCheck, inflateResetKeep, inflateReset, inflateReset2, inflateInit2, inflateInit, virgin, lenfix, distfix, fixedtables, updatewindow, inflate$2, inflateEnd, inflateGetHeader, inflateSetDictionary, inflateReset_1, inflateReset2_1, inflateResetKeep_1, inflateInit_1, inflateInit2_1, inflate_2$1, inflateEnd_1, inflateGetHeader_1, inflateSetDictionary_1, inflateInfo, inflate_1$2, gzheader, toString, Z_NO_FLUSH, Z_FINISH, Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR, Inflate_1$1, inflate_2, inflateRaw_1$1, ungzip$1, constants, inflate_1$1, Deflate, deflate, deflateRaw, gzip, Inflate, inflate, inflateRaw, ungzip, gzip_1;
|
|
1864
1864
|
var init_pako_esm = __esm({
|
|
1865
|
-
"
|
|
1865
|
+
"node_modules/.pnpm/pako@2.1.0/node_modules/pako/dist/pako.esm.mjs"() {
|
|
1866
1866
|
"use strict";
|
|
1867
1867
|
Z_FIXED$1 = 4;
|
|
1868
1868
|
Z_BINARY = 0;
|
|
@@ -5743,7 +5743,7 @@ var init_pako_esm = __esm({
|
|
|
5743
5743
|
}
|
|
5744
5744
|
});
|
|
5745
5745
|
|
|
5746
|
-
//
|
|
5746
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/compress.ts
|
|
5747
5747
|
async function gzipEncodeBlob(input) {
|
|
5748
5748
|
const array = await toUint8Array(input);
|
|
5749
5749
|
return gzip_1(array);
|
|
@@ -5769,16 +5769,16 @@ async function toUint8Array(input) {
|
|
|
5769
5769
|
throw new TypeError("Unsupported input type for gzipEncodeBlob");
|
|
5770
5770
|
}
|
|
5771
5771
|
var init_compress = __esm({
|
|
5772
|
-
"
|
|
5772
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/compress.ts"() {
|
|
5773
5773
|
"use strict";
|
|
5774
5774
|
init_pako_esm();
|
|
5775
5775
|
}
|
|
5776
5776
|
});
|
|
5777
5777
|
|
|
5778
|
-
//
|
|
5778
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/AsyncStream.ts
|
|
5779
5779
|
var AsyncStream;
|
|
5780
5780
|
var init_AsyncStream = __esm({
|
|
5781
|
-
"
|
|
5781
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/AsyncStream.ts"() {
|
|
5782
5782
|
"use strict";
|
|
5783
5783
|
AsyncStream = class _AsyncStream {
|
|
5784
5784
|
constructor() {
|
|
@@ -5966,10 +5966,10 @@ var init_AsyncStream = __esm({
|
|
|
5966
5966
|
}
|
|
5967
5967
|
});
|
|
5968
5968
|
|
|
5969
|
-
//
|
|
5969
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/uniqHash.ts
|
|
5970
5970
|
var import_js_sha32, sortKeys, uniqHash;
|
|
5971
5971
|
var init_uniqHash = __esm({
|
|
5972
|
-
"
|
|
5972
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/uniqHash.ts"() {
|
|
5973
5973
|
"use strict";
|
|
5974
5974
|
init_src();
|
|
5975
5975
|
import_js_sha32 = __toESM(require_sha3(), 1);
|
|
@@ -5999,69 +5999,69 @@ var init_uniqHash = __esm({
|
|
|
5999
5999
|
}
|
|
6000
6000
|
});
|
|
6001
6001
|
|
|
6002
|
-
//
|
|
6002
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/createMsg.ts
|
|
6003
6003
|
var init_createMsg = __esm({
|
|
6004
|
-
"
|
|
6004
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/createMsg.ts"() {
|
|
6005
6005
|
"use strict";
|
|
6006
6006
|
init_src();
|
|
6007
6007
|
init_uniqHash();
|
|
6008
6008
|
}
|
|
6009
6009
|
});
|
|
6010
6010
|
|
|
6011
|
-
//
|
|
6011
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/detectText.ts
|
|
6012
6012
|
var init_detectText = __esm({
|
|
6013
|
-
"
|
|
6013
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/detectText.ts"() {
|
|
6014
6014
|
"use strict";
|
|
6015
6015
|
}
|
|
6016
6016
|
});
|
|
6017
6017
|
|
|
6018
|
-
//
|
|
6018
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Emitter.ts
|
|
6019
6019
|
var init_Emitter = __esm({
|
|
6020
|
-
"
|
|
6020
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Emitter.ts"() {
|
|
6021
6021
|
"use strict";
|
|
6022
6022
|
}
|
|
6023
6023
|
});
|
|
6024
6024
|
|
|
6025
|
-
//
|
|
6025
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/EmitterV2.ts
|
|
6026
6026
|
var init_EmitterV2 = __esm({
|
|
6027
|
-
"
|
|
6027
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/EmitterV2.ts"() {
|
|
6028
6028
|
"use strict";
|
|
6029
6029
|
}
|
|
6030
6030
|
});
|
|
6031
6031
|
|
|
6032
|
-
//
|
|
6032
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/format/formatTime.ts
|
|
6033
6033
|
var init_formatTime = __esm({
|
|
6034
|
-
"
|
|
6034
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/format/formatTime.ts"() {
|
|
6035
6035
|
"use strict";
|
|
6036
6036
|
}
|
|
6037
6037
|
});
|
|
6038
6038
|
|
|
6039
|
-
//
|
|
6039
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/format/index.ts
|
|
6040
6040
|
var init_format = __esm({
|
|
6041
|
-
"
|
|
6041
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/format/index.ts"() {
|
|
6042
6042
|
"use strict";
|
|
6043
6043
|
init_formatTime();
|
|
6044
6044
|
}
|
|
6045
6045
|
});
|
|
6046
6046
|
|
|
6047
|
-
//
|
|
6047
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/isVolcabulary.ts
|
|
6048
6048
|
var init_isVolcabulary = __esm({
|
|
6049
|
-
"
|
|
6049
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/isVolcabulary.ts"() {
|
|
6050
6050
|
"use strict";
|
|
6051
6051
|
}
|
|
6052
6052
|
});
|
|
6053
6053
|
|
|
6054
|
-
//
|
|
6054
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Loadable.ts
|
|
6055
6055
|
var init_Loadable = __esm({
|
|
6056
|
-
"
|
|
6056
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Loadable.ts"() {
|
|
6057
6057
|
"use strict";
|
|
6058
6058
|
}
|
|
6059
6059
|
});
|
|
6060
6060
|
|
|
6061
|
-
//
|
|
6061
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Logger.ts
|
|
6062
6062
|
var Logger;
|
|
6063
6063
|
var init_Logger = __esm({
|
|
6064
|
-
"
|
|
6064
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Logger.ts"() {
|
|
6065
6065
|
"use strict";
|
|
6066
6066
|
Logger = class _Logger {
|
|
6067
6067
|
constructor(name) {
|
|
@@ -6086,21 +6086,21 @@ var init_Logger = __esm({
|
|
|
6086
6086
|
}
|
|
6087
6087
|
});
|
|
6088
6088
|
|
|
6089
|
-
//
|
|
6089
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/mapToReadingBook.ts
|
|
6090
6090
|
var init_mapToReadingBook = __esm({
|
|
6091
|
-
"
|
|
6091
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/mapToReadingBook.ts"() {
|
|
6092
6092
|
"use strict";
|
|
6093
6093
|
}
|
|
6094
6094
|
});
|
|
6095
6095
|
|
|
6096
|
-
//
|
|
6096
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/memoize.ts
|
|
6097
6097
|
var init_memoize = __esm({
|
|
6098
|
-
"
|
|
6098
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/memoize.ts"() {
|
|
6099
6099
|
"use strict";
|
|
6100
6100
|
}
|
|
6101
6101
|
});
|
|
6102
6102
|
|
|
6103
|
-
//
|
|
6103
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/utf8.mjs
|
|
6104
6104
|
function utf8Count(str) {
|
|
6105
6105
|
const strLength = str.length;
|
|
6106
6106
|
let byteLength = 0;
|
|
@@ -6227,7 +6227,7 @@ function utf8Decode(bytes, inputOffset, byteLength) {
|
|
|
6227
6227
|
}
|
|
6228
6228
|
var sharedTextEncoder, TEXT_ENCODER_THRESHOLD, CHUNK_SIZE, sharedTextDecoder, TEXT_DECODER_THRESHOLD;
|
|
6229
6229
|
var init_utf8 = __esm({
|
|
6230
|
-
"
|
|
6230
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/utf8.mjs"() {
|
|
6231
6231
|
"use strict";
|
|
6232
6232
|
sharedTextEncoder = new TextEncoder();
|
|
6233
6233
|
TEXT_ENCODER_THRESHOLD = 50;
|
|
@@ -6237,10 +6237,10 @@ var init_utf8 = __esm({
|
|
|
6237
6237
|
}
|
|
6238
6238
|
});
|
|
6239
6239
|
|
|
6240
|
-
//
|
|
6240
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/ExtData.mjs
|
|
6241
6241
|
var ExtData;
|
|
6242
6242
|
var init_ExtData = __esm({
|
|
6243
|
-
"
|
|
6243
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/ExtData.mjs"() {
|
|
6244
6244
|
"use strict";
|
|
6245
6245
|
ExtData = class {
|
|
6246
6246
|
type;
|
|
@@ -6253,10 +6253,10 @@ var init_ExtData = __esm({
|
|
|
6253
6253
|
}
|
|
6254
6254
|
});
|
|
6255
6255
|
|
|
6256
|
-
//
|
|
6256
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/DecodeError.mjs
|
|
6257
6257
|
var DecodeError;
|
|
6258
6258
|
var init_DecodeError = __esm({
|
|
6259
|
-
"
|
|
6259
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/DecodeError.mjs"() {
|
|
6260
6260
|
"use strict";
|
|
6261
6261
|
DecodeError = class _DecodeError extends Error {
|
|
6262
6262
|
constructor(message) {
|
|
@@ -6273,7 +6273,7 @@ var init_DecodeError = __esm({
|
|
|
6273
6273
|
}
|
|
6274
6274
|
});
|
|
6275
6275
|
|
|
6276
|
-
//
|
|
6276
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/int.mjs
|
|
6277
6277
|
function setUint64(view, offset, value) {
|
|
6278
6278
|
const high = value / 4294967296;
|
|
6279
6279
|
const low = value;
|
|
@@ -6298,13 +6298,13 @@ function getUint64(view, offset) {
|
|
|
6298
6298
|
}
|
|
6299
6299
|
var UINT32_MAX;
|
|
6300
6300
|
var init_int = __esm({
|
|
6301
|
-
"
|
|
6301
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/int.mjs"() {
|
|
6302
6302
|
"use strict";
|
|
6303
6303
|
UINT32_MAX = 4294967295;
|
|
6304
6304
|
}
|
|
6305
6305
|
});
|
|
6306
6306
|
|
|
6307
|
-
//
|
|
6307
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/timestamp.mjs
|
|
6308
6308
|
function encodeTimeSpecToTimestamp({ sec, nsec }) {
|
|
6309
6309
|
if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC) {
|
|
6310
6310
|
if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) {
|
|
@@ -6377,7 +6377,7 @@ function decodeTimestampExtension(data) {
|
|
|
6377
6377
|
}
|
|
6378
6378
|
var EXT_TIMESTAMP, TIMESTAMP32_MAX_SEC, TIMESTAMP64_MAX_SEC, timestampExtension;
|
|
6379
6379
|
var init_timestamp = __esm({
|
|
6380
|
-
"
|
|
6380
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/timestamp.mjs"() {
|
|
6381
6381
|
"use strict";
|
|
6382
6382
|
init_DecodeError();
|
|
6383
6383
|
init_int();
|
|
@@ -6392,10 +6392,10 @@ var init_timestamp = __esm({
|
|
|
6392
6392
|
}
|
|
6393
6393
|
});
|
|
6394
6394
|
|
|
6395
|
-
//
|
|
6395
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.mjs
|
|
6396
6396
|
var ExtensionCodec;
|
|
6397
6397
|
var init_ExtensionCodec = __esm({
|
|
6398
|
-
"
|
|
6398
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.mjs"() {
|
|
6399
6399
|
"use strict";
|
|
6400
6400
|
init_ExtData();
|
|
6401
6401
|
init_timestamp();
|
|
@@ -6462,7 +6462,7 @@ var init_ExtensionCodec = __esm({
|
|
|
6462
6462
|
}
|
|
6463
6463
|
});
|
|
6464
6464
|
|
|
6465
|
-
//
|
|
6465
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.mjs
|
|
6466
6466
|
function isArrayBufferLike(buffer) {
|
|
6467
6467
|
return buffer instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
|
|
6468
6468
|
}
|
|
@@ -6478,15 +6478,15 @@ function ensureUint8Array(buffer) {
|
|
|
6478
6478
|
}
|
|
6479
6479
|
}
|
|
6480
6480
|
var init_typedArrays = __esm({
|
|
6481
|
-
"
|
|
6481
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.mjs"() {
|
|
6482
6482
|
"use strict";
|
|
6483
6483
|
}
|
|
6484
6484
|
});
|
|
6485
6485
|
|
|
6486
|
-
//
|
|
6486
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/Encoder.mjs
|
|
6487
6487
|
var DEFAULT_MAX_DEPTH, DEFAULT_INITIAL_BUFFER_SIZE, Encoder;
|
|
6488
6488
|
var init_Encoder = __esm({
|
|
6489
|
-
"
|
|
6489
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/Encoder.mjs"() {
|
|
6490
6490
|
"use strict";
|
|
6491
6491
|
init_utf8();
|
|
6492
6492
|
init_ExtensionCodec();
|
|
@@ -6896,32 +6896,32 @@ var init_Encoder = __esm({
|
|
|
6896
6896
|
}
|
|
6897
6897
|
});
|
|
6898
6898
|
|
|
6899
|
-
//
|
|
6899
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/encode.mjs
|
|
6900
6900
|
function encode(value, options) {
|
|
6901
6901
|
const encoder2 = new Encoder(options);
|
|
6902
6902
|
return encoder2.encodeSharedRef(value);
|
|
6903
6903
|
}
|
|
6904
6904
|
var init_encode = __esm({
|
|
6905
|
-
"
|
|
6905
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/encode.mjs"() {
|
|
6906
6906
|
"use strict";
|
|
6907
6907
|
init_Encoder();
|
|
6908
6908
|
}
|
|
6909
6909
|
});
|
|
6910
6910
|
|
|
6911
|
-
//
|
|
6911
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.mjs
|
|
6912
6912
|
function prettyByte(byte) {
|
|
6913
6913
|
return `${byte < 0 ? "-" : ""}0x${Math.abs(byte).toString(16).padStart(2, "0")}`;
|
|
6914
6914
|
}
|
|
6915
6915
|
var init_prettyByte = __esm({
|
|
6916
|
-
"
|
|
6916
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.mjs"() {
|
|
6917
6917
|
"use strict";
|
|
6918
6918
|
}
|
|
6919
6919
|
});
|
|
6920
6920
|
|
|
6921
|
-
//
|
|
6921
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.mjs
|
|
6922
6922
|
var DEFAULT_MAX_KEY_LENGTH, DEFAULT_MAX_LENGTH_PER_KEY, CachedKeyDecoder;
|
|
6923
6923
|
var init_CachedKeyDecoder = __esm({
|
|
6924
|
-
"
|
|
6924
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.mjs"() {
|
|
6925
6925
|
"use strict";
|
|
6926
6926
|
init_utf8();
|
|
6927
6927
|
DEFAULT_MAX_KEY_LENGTH = 16;
|
|
@@ -6981,10 +6981,10 @@ var init_CachedKeyDecoder = __esm({
|
|
|
6981
6981
|
}
|
|
6982
6982
|
});
|
|
6983
6983
|
|
|
6984
|
-
//
|
|
6984
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/Decoder.mjs
|
|
6985
6985
|
var STATE_ARRAY, STATE_MAP_KEY, STATE_MAP_VALUE, mapKeyConverter, StackPool, HEAD_BYTE_REQUIRED, EMPTY_VIEW, EMPTY_BYTES, MORE_DATA, sharedCachedKeyDecoder, Decoder;
|
|
6986
6986
|
var init_Decoder = __esm({
|
|
6987
|
-
"
|
|
6987
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/Decoder.mjs"() {
|
|
6988
6988
|
"use strict";
|
|
6989
6989
|
init_prettyByte();
|
|
6990
6990
|
init_ExtensionCodec();
|
|
@@ -7622,31 +7622,31 @@ var init_Decoder = __esm({
|
|
|
7622
7622
|
}
|
|
7623
7623
|
});
|
|
7624
7624
|
|
|
7625
|
-
//
|
|
7625
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/decode.mjs
|
|
7626
7626
|
function decode(buffer, options) {
|
|
7627
7627
|
const decoder = new Decoder(options);
|
|
7628
7628
|
return decoder.decode(buffer);
|
|
7629
7629
|
}
|
|
7630
7630
|
var init_decode = __esm({
|
|
7631
|
-
"
|
|
7631
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/decode.mjs"() {
|
|
7632
7632
|
"use strict";
|
|
7633
7633
|
init_Decoder();
|
|
7634
7634
|
}
|
|
7635
7635
|
});
|
|
7636
7636
|
|
|
7637
|
-
//
|
|
7637
|
+
// node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/index.mjs
|
|
7638
7638
|
var init_dist = __esm({
|
|
7639
|
-
"
|
|
7639
|
+
"node_modules/.pnpm/@msgpack+msgpack@3.1.3/node_modules/@msgpack/msgpack/dist.esm/index.mjs"() {
|
|
7640
7640
|
"use strict";
|
|
7641
7641
|
init_encode();
|
|
7642
7642
|
init_decode();
|
|
7643
7643
|
}
|
|
7644
7644
|
});
|
|
7645
7645
|
|
|
7646
|
-
//
|
|
7646
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Msg.ts
|
|
7647
7647
|
var encoder, Msg;
|
|
7648
7648
|
var init_Msg = __esm({
|
|
7649
|
-
"
|
|
7649
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/Msg.ts"() {
|
|
7650
7650
|
"use strict";
|
|
7651
7651
|
init_dist();
|
|
7652
7652
|
init_src();
|
|
@@ -7774,106 +7774,106 @@ var init_Msg = __esm({
|
|
|
7774
7774
|
}
|
|
7775
7775
|
});
|
|
7776
7776
|
|
|
7777
|
-
//
|
|
7777
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/normalize.ts
|
|
7778
7778
|
var init_normalize = __esm({
|
|
7779
|
-
"
|
|
7779
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/normalize.ts"() {
|
|
7780
7780
|
"use strict";
|
|
7781
7781
|
}
|
|
7782
7782
|
});
|
|
7783
7783
|
|
|
7784
|
-
//
|
|
7784
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/pageURL.ts
|
|
7785
7785
|
var init_pageURL = __esm({
|
|
7786
|
-
"
|
|
7786
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/pageURL.ts"() {
|
|
7787
7787
|
"use strict";
|
|
7788
7788
|
}
|
|
7789
7789
|
});
|
|
7790
7790
|
|
|
7791
|
-
//
|
|
7791
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/PromiseQueue.ts
|
|
7792
7792
|
var init_PromiseQueue = __esm({
|
|
7793
|
-
"
|
|
7793
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/PromiseQueue.ts"() {
|
|
7794
7794
|
"use strict";
|
|
7795
7795
|
}
|
|
7796
7796
|
});
|
|
7797
7797
|
|
|
7798
|
-
//
|
|
7798
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/resourceKey.ts
|
|
7799
7799
|
var import_js_sha33;
|
|
7800
7800
|
var init_resourceKey = __esm({
|
|
7801
|
-
"
|
|
7801
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/resourceKey.ts"() {
|
|
7802
7802
|
"use strict";
|
|
7803
7803
|
import_js_sha33 = __toESM(require_sha3(), 1);
|
|
7804
7804
|
}
|
|
7805
7805
|
});
|
|
7806
7806
|
|
|
7807
|
-
//
|
|
7807
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/SelectionHelper.ts
|
|
7808
7808
|
var init_SelectionHelper = __esm({
|
|
7809
|
-
"
|
|
7809
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/SelectionHelper.ts"() {
|
|
7810
7810
|
"use strict";
|
|
7811
7811
|
}
|
|
7812
7812
|
});
|
|
7813
7813
|
|
|
7814
|
-
//
|
|
7814
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/setMinus.ts
|
|
7815
7815
|
var init_setMinus = __esm({
|
|
7816
|
-
"
|
|
7816
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/setMinus.ts"() {
|
|
7817
7817
|
"use strict";
|
|
7818
7818
|
}
|
|
7819
7819
|
});
|
|
7820
7820
|
|
|
7821
|
-
//
|
|
7821
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/sha1Hash.ts
|
|
7822
7822
|
var init_sha1Hash = __esm({
|
|
7823
|
-
"
|
|
7823
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/sha1Hash.ts"() {
|
|
7824
7824
|
"use strict";
|
|
7825
7825
|
}
|
|
7826
7826
|
});
|
|
7827
7827
|
|
|
7828
|
-
//
|
|
7828
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/TaskWaiter.ts
|
|
7829
7829
|
var init_TaskWaiter = __esm({
|
|
7830
|
-
"
|
|
7830
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/TaskWaiter.ts"() {
|
|
7831
7831
|
"use strict";
|
|
7832
7832
|
init_src3();
|
|
7833
7833
|
}
|
|
7834
7834
|
});
|
|
7835
7835
|
|
|
7836
|
-
//
|
|
7836
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/toSentenceAnalyze.ts
|
|
7837
7837
|
var init_toSentenceAnalyze = __esm({
|
|
7838
|
-
"
|
|
7838
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/toSentenceAnalyze.ts"() {
|
|
7839
7839
|
"use strict";
|
|
7840
7840
|
}
|
|
7841
7841
|
});
|
|
7842
7842
|
|
|
7843
|
-
//
|
|
7843
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/txtBookToJson.ts
|
|
7844
7844
|
var init_txtBookToJson = __esm({
|
|
7845
|
-
"
|
|
7845
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/txtBookToJson.ts"() {
|
|
7846
7846
|
"use strict";
|
|
7847
7847
|
init_src2();
|
|
7848
7848
|
}
|
|
7849
7849
|
});
|
|
7850
7850
|
|
|
7851
|
-
//
|
|
7851
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/VocabularyMap.ts
|
|
7852
7852
|
var init_VocabularyMap = __esm({
|
|
7853
|
-
"
|
|
7853
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/VocabularyMap.ts"() {
|
|
7854
7854
|
"use strict";
|
|
7855
7855
|
init_Emitter();
|
|
7856
7856
|
}
|
|
7857
7857
|
});
|
|
7858
7858
|
|
|
7859
|
-
//
|
|
7859
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/wait.ts
|
|
7860
7860
|
var init_wait = __esm({
|
|
7861
|
-
"
|
|
7861
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/wait.ts"() {
|
|
7862
7862
|
"use strict";
|
|
7863
7863
|
}
|
|
7864
7864
|
});
|
|
7865
7865
|
|
|
7866
|
-
//
|
|
7866
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/wordCount.ts
|
|
7867
7867
|
var init_wordCount = __esm({
|
|
7868
|
-
"
|
|
7868
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/wordCount.ts"() {
|
|
7869
7869
|
"use strict";
|
|
7870
7870
|
}
|
|
7871
7871
|
});
|
|
7872
7872
|
|
|
7873
|
-
//
|
|
7873
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/WebsocketHeartbeat.ts
|
|
7874
7874
|
var logger, WebsocketHeartbeat;
|
|
7875
7875
|
var init_WebsocketHeartbeat = __esm({
|
|
7876
|
-
"
|
|
7876
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/WebsocketHeartbeat.ts"() {
|
|
7877
7877
|
"use strict";
|
|
7878
7878
|
init_src();
|
|
7879
7879
|
init_Logger();
|
|
@@ -7914,10 +7914,10 @@ var init_WebsocketHeartbeat = __esm({
|
|
|
7914
7914
|
}
|
|
7915
7915
|
});
|
|
7916
7916
|
|
|
7917
|
-
//
|
|
7917
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/WebsocketClient.ts
|
|
7918
7918
|
var logger2;
|
|
7919
7919
|
var init_WebsocketClient = __esm({
|
|
7920
|
-
"
|
|
7920
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/WebsocketClient.ts"() {
|
|
7921
7921
|
"use strict";
|
|
7922
7922
|
init_src();
|
|
7923
7923
|
init_Emitter();
|
|
@@ -7928,7 +7928,7 @@ var init_WebsocketClient = __esm({
|
|
|
7928
7928
|
}
|
|
7929
7929
|
});
|
|
7930
7930
|
|
|
7931
|
-
//
|
|
7931
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/WebsocketClientV2.ts
|
|
7932
7932
|
function isEventLike(value) {
|
|
7933
7933
|
return typeof value === "object" && value !== null && "type" in value && typeof value.type === "string";
|
|
7934
7934
|
}
|
|
@@ -7937,7 +7937,7 @@ function isCloseEvent(value) {
|
|
|
7937
7937
|
}
|
|
7938
7938
|
var logger3, WebsocketClientV2;
|
|
7939
7939
|
var init_WebsocketClientV2 = __esm({
|
|
7940
|
-
"
|
|
7940
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/WebsocketClientV2.ts"() {
|
|
7941
7941
|
"use strict";
|
|
7942
7942
|
init_src();
|
|
7943
7943
|
init_AsyncStream();
|
|
@@ -8184,10 +8184,10 @@ var init_WebsocketClientV2 = __esm({
|
|
|
8184
8184
|
}
|
|
8185
8185
|
});
|
|
8186
8186
|
|
|
8187
|
-
//
|
|
8187
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/H3Client.ts
|
|
8188
8188
|
var logger4;
|
|
8189
8189
|
var init_H3Client = __esm({
|
|
8190
|
-
"
|
|
8190
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/H3Client.ts"() {
|
|
8191
8191
|
"use strict";
|
|
8192
8192
|
init_Emitter();
|
|
8193
8193
|
init_Logger();
|
|
@@ -8197,9 +8197,9 @@ var init_H3Client = __esm({
|
|
|
8197
8197
|
}
|
|
8198
8198
|
});
|
|
8199
8199
|
|
|
8200
|
-
//
|
|
8200
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/index.ts
|
|
8201
8201
|
var init_websocket = __esm({
|
|
8202
|
-
"
|
|
8202
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/websocket/index.ts"() {
|
|
8203
8203
|
"use strict";
|
|
8204
8204
|
init_WebsocketClient();
|
|
8205
8205
|
init_WebsocketClientV2();
|
|
@@ -8207,9 +8207,9 @@ var init_websocket = __esm({
|
|
|
8207
8207
|
}
|
|
8208
8208
|
});
|
|
8209
8209
|
|
|
8210
|
-
//
|
|
8210
|
+
// node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/index.ts
|
|
8211
8211
|
var init_src3 = __esm({
|
|
8212
|
-
"
|
|
8212
|
+
"node_modules/.pnpm/@pmate+utils@1.1.4/node_modules/@pmate/utils/src/index.ts"() {
|
|
8213
8213
|
"use strict";
|
|
8214
8214
|
init_base64();
|
|
8215
8215
|
init_batchResolve();
|
|
@@ -8249,23 +8249,23 @@ var init_src3 = __esm({
|
|
|
8249
8249
|
}
|
|
8250
8250
|
});
|
|
8251
8251
|
|
|
8252
|
-
//
|
|
8252
|
+
// node_modules/.pnpm/@pmate+hub-sdk@0.4.1/node_modules/@pmate/hub-sdk/dist/AgentClient.js
|
|
8253
8253
|
var init_AgentClient = __esm({
|
|
8254
|
-
"
|
|
8254
|
+
"node_modules/.pnpm/@pmate+hub-sdk@0.4.1/node_modules/@pmate/hub-sdk/dist/AgentClient.js"() {
|
|
8255
8255
|
"use strict";
|
|
8256
8256
|
init_src();
|
|
8257
8257
|
init_src3();
|
|
8258
8258
|
}
|
|
8259
8259
|
});
|
|
8260
8260
|
|
|
8261
|
-
//
|
|
8261
|
+
// node_modules/.pnpm/@pmate+hub-sdk@0.4.1/node_modules/@pmate/hub-sdk/dist/FunctionService.js
|
|
8262
8262
|
var init_FunctionService = __esm({
|
|
8263
|
-
"
|
|
8263
|
+
"node_modules/.pnpm/@pmate+hub-sdk@0.4.1/node_modules/@pmate/hub-sdk/dist/FunctionService.js"() {
|
|
8264
8264
|
"use strict";
|
|
8265
8265
|
}
|
|
8266
8266
|
});
|
|
8267
8267
|
|
|
8268
|
-
//
|
|
8268
|
+
// node_modules/.pnpm/@pmate+hub-sdk@0.4.1/node_modules/@pmate/hub-sdk/dist/HubClient.js
|
|
8269
8269
|
function createCallId(functionId) {
|
|
8270
8270
|
return uniqHash(`${functionId}-${Date.now()}-${Math.random()}`, "task-v1" /* Task */);
|
|
8271
8271
|
}
|
|
@@ -8326,7 +8326,7 @@ function withTimeout(promise, timeoutMs, message) {
|
|
|
8326
8326
|
}
|
|
8327
8327
|
var DEFAULT_TIMEOUT_MS, DEFAULT_STREAM_TIMEOUT_MS, HubClient, AsyncCallQueue;
|
|
8328
8328
|
var init_HubClient = __esm({
|
|
8329
|
-
"
|
|
8329
|
+
"node_modules/.pnpm/@pmate+hub-sdk@0.4.1/node_modules/@pmate/hub-sdk/dist/HubClient.js"() {
|
|
8330
8330
|
"use strict";
|
|
8331
8331
|
init_src();
|
|
8332
8332
|
init_src3();
|
|
@@ -8746,9 +8746,9 @@ var init_HubClient = __esm({
|
|
|
8746
8746
|
}
|
|
8747
8747
|
});
|
|
8748
8748
|
|
|
8749
|
-
//
|
|
8749
|
+
// node_modules/.pnpm/@pmate+hub-sdk@0.4.1/node_modules/@pmate/hub-sdk/dist/index.js
|
|
8750
8750
|
var init_dist2 = __esm({
|
|
8751
|
-
"
|
|
8751
|
+
"node_modules/.pnpm/@pmate+hub-sdk@0.4.1/node_modules/@pmate/hub-sdk/dist/index.js"() {
|
|
8752
8752
|
"use strict";
|
|
8753
8753
|
init_AgentClient();
|
|
8754
8754
|
init_FunctionService();
|
|
@@ -8818,8 +8818,8 @@ __export(index_exports, {
|
|
|
8818
8818
|
parseCommandArgs: () => parseCommandArgs
|
|
8819
8819
|
});
|
|
8820
8820
|
module.exports = __toCommonJS(index_exports);
|
|
8821
|
-
var
|
|
8822
|
-
var
|
|
8821
|
+
var import_node_fs27 = require("fs");
|
|
8822
|
+
var import_node_path32 = __toESM(require("path"));
|
|
8823
8823
|
|
|
8824
8824
|
// src/managedSession.ts
|
|
8825
8825
|
var import_node_fs = require("fs");
|
|
@@ -14240,9 +14240,9 @@ ${indent}\`\`\``;
|
|
|
14240
14240
|
static richTextToPlain(richText) {
|
|
14241
14241
|
return richText.map((item) => item.plain_text ?? item.text?.content ?? "").join("").trim();
|
|
14242
14242
|
}
|
|
14243
|
-
static async requestJson(
|
|
14243
|
+
static async requestJson(path32, init) {
|
|
14244
14244
|
const token = this.getToken();
|
|
14245
|
-
const response = await fetch(`${this.baseUrl}${
|
|
14245
|
+
const response = await fetch(`${this.baseUrl}${path32}`, {
|
|
14246
14246
|
method: init.method,
|
|
14247
14247
|
headers: {
|
|
14248
14248
|
Authorization: `Bearer ${token}`,
|
|
@@ -16947,8 +16947,8 @@ function descriptorPathSegments(descriptor) {
|
|
|
16947
16947
|
return ["chains", normalized.chain, "namespaces", normalized.ns, normalized.kind, normalized.name];
|
|
16948
16948
|
}
|
|
16949
16949
|
function buildPathUrl(baseUrl, pathSegments, query) {
|
|
16950
|
-
const
|
|
16951
|
-
const url = new URL(
|
|
16950
|
+
const path32 = `/${pathSegments.map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
16951
|
+
const url = new URL(path32, baseUrl);
|
|
16952
16952
|
if (query) {
|
|
16953
16953
|
for (const [key, value] of Object.entries(query)) {
|
|
16954
16954
|
url.searchParams.set(key, String(value));
|
|
@@ -17508,15 +17508,130 @@ var StoreCommandHandler = class {
|
|
|
17508
17508
|
}
|
|
17509
17509
|
};
|
|
17510
17510
|
|
|
17511
|
+
// src/electronBuild.ts
|
|
17512
|
+
var import_node_child_process9 = require("child_process");
|
|
17513
|
+
var import_node_crypto4 = require("crypto");
|
|
17514
|
+
var import_node_fs18 = require("fs");
|
|
17515
|
+
var import_node_os9 = require("os");
|
|
17516
|
+
var import_node_path23 = __toESM(require("path"));
|
|
17517
|
+
var ELECTRON_VERSION = "44.5.1";
|
|
17518
|
+
var BUILDER_VERSION = "26.15.3";
|
|
17519
|
+
function readDesktopConfig(file, appId) {
|
|
17520
|
+
const c = JSON.parse((0, import_node_fs18.readFileSync)(file, "utf8"));
|
|
17521
|
+
if (c.schemaVersion !== 1 || c.app !== appId) throw new Error("Desktop config schemaVersion/app mismatch");
|
|
17522
|
+
for (const key of ["productName", "bundleId", "version", "icon"]) {
|
|
17523
|
+
if (typeof c[key] !== "string" || !c[key].trim()) throw new Error(`Missing desktop ${key}`);
|
|
17524
|
+
}
|
|
17525
|
+
if (!/^[a-zA-Z][\w-]*(\.[a-zA-Z][\w-]*)+$/.test(c.bundleId)) throw new Error("Invalid desktop bundleId");
|
|
17526
|
+
if (!/^\d+\.\d+\.\d+(?:-[\w.-]+)?$/.test(c.version)) throw new Error("Invalid desktop version");
|
|
17527
|
+
const origin = (value) => {
|
|
17528
|
+
const url = new URL(value);
|
|
17529
|
+
if (url.protocol !== "https:" || url.origin !== value || url.username || url.password) throw new Error("Desktop origins must be exact HTTPS origins, without paths or credentials");
|
|
17530
|
+
};
|
|
17531
|
+
origin(c.origin);
|
|
17532
|
+
if (!Array.isArray(c.authOrigins)) throw new Error("authOrigins must be an array");
|
|
17533
|
+
c.authOrigins.forEach(origin);
|
|
17534
|
+
if (!c.web || typeof c.web.cwd !== "string" || typeof c.web.dist !== "string" || !c.web.dist.trim() || !Array.isArray(c.web.build) || !c.web.build.length || !c.web.build.every((v) => typeof v === "string" && v.length > 0)) throw new Error("Invalid web build configuration");
|
|
17535
|
+
return c;
|
|
17536
|
+
}
|
|
17537
|
+
function collectStaticFiles(root) {
|
|
17538
|
+
const files = [];
|
|
17539
|
+
const walk = (dir) => {
|
|
17540
|
+
for (const entry of (0, import_node_fs18.readdirSync)(dir, { withFileTypes: true })) {
|
|
17541
|
+
const full = import_node_path23.default.join(dir, entry.name);
|
|
17542
|
+
if (entry.isSymbolicLink()) throw new Error(`Symlinks are not allowed in desktop resources: ${entry.name}`);
|
|
17543
|
+
if (entry.name.startsWith(".") || /\.(?:pem|key|p12|pfx)$/i.test(entry.name) || /bot-key|session\.json/i.test(entry.name)) throw new Error(`Private or hidden file in desktop resources: ${entry.name}`);
|
|
17544
|
+
if (entry.isDirectory()) walk(full);
|
|
17545
|
+
else if (entry.isFile() && !entry.name.endsWith(".map")) files.push(import_node_path23.default.relative(root, full));
|
|
17546
|
+
else if (!entry.isFile()) throw new Error(`Unsupported resource: ${entry.name}`);
|
|
17547
|
+
}
|
|
17548
|
+
};
|
|
17549
|
+
if ((0, import_node_fs18.lstatSync)(root).isSymbolicLink()) throw new Error("Static resource root cannot be a symlink");
|
|
17550
|
+
walk(root);
|
|
17551
|
+
if (!files.includes("index.html")) throw new Error("Web build must produce index.html");
|
|
17552
|
+
return files.sort();
|
|
17553
|
+
}
|
|
17554
|
+
async function runBuildCommand(command, cwd, env = process.env) {
|
|
17555
|
+
await new Promise((resolve, reject) => {
|
|
17556
|
+
const child = (0, import_node_child_process9.spawn)(command[0], command.slice(1), { cwd, env, stdio: "inherit", shell: false });
|
|
17557
|
+
child.once("error", reject);
|
|
17558
|
+
child.once("exit", (code, signal) => code === 0 ? resolve() : reject(new Error(`${command[0]} failed (${signal ?? code})`)));
|
|
17559
|
+
});
|
|
17560
|
+
}
|
|
17561
|
+
async function buildDesktop(args) {
|
|
17562
|
+
const file = import_node_path23.default.resolve(args.config);
|
|
17563
|
+
const c = readDesktopConfig(file, args.id);
|
|
17564
|
+
const base = import_node_path23.default.dirname(file);
|
|
17565
|
+
const cwd = import_node_path23.default.resolve(base, c.web.cwd);
|
|
17566
|
+
const dist = import_node_path23.default.resolve(cwd, c.web.dist);
|
|
17567
|
+
const icon = import_node_path23.default.resolve(base, c.icon);
|
|
17568
|
+
const output = import_node_path23.default.resolve(args.outDir);
|
|
17569
|
+
if (!(0, import_node_fs18.existsSync)(icon) || !(0, import_node_fs18.statSync)(icon).isFile()) throw new Error(`Desktop icon not found: ${icon}`);
|
|
17570
|
+
if (args.platform !== "mac" || !["arm64", "x64"].includes(args.arch)) throw new Error("This release supports mac --arch arm64|x64; Windows/Linux are not yet supported");
|
|
17571
|
+
if (process.platform !== "darwin") throw new Error("macOS desktop packaging requires a macOS build host");
|
|
17572
|
+
const within = (parent, child) => {
|
|
17573
|
+
const rel = import_node_path23.default.relative(parent, child);
|
|
17574
|
+
return !rel || !rel.startsWith("..") && !import_node_path23.default.isAbsolute(rel);
|
|
17575
|
+
};
|
|
17576
|
+
if (within(dist, cwd) || within(dist, output) || within(output, cwd)) throw new Error("Build output, web source and static resource paths overlap");
|
|
17577
|
+
const plan = { app: c.app, productName: c.productName, version: c.version, target: args.platform, arch: args.arch, command: c.web.build, cwd, dist, output, electron: ELECTRON_VERSION, builder: BUILDER_VERSION, signed: args.signed };
|
|
17578
|
+
console.log(JSON.stringify({ phase: "plan", ...plan }, null, 2));
|
|
17579
|
+
if (args.dryRun) return;
|
|
17580
|
+
const started = Date.now();
|
|
17581
|
+
await runBuildCommand(c.web.build, cwd);
|
|
17582
|
+
if (!(0, import_node_fs18.existsSync)(import_node_path23.default.join(dist, "index.html")) || (0, import_node_fs18.statSync)(import_node_path23.default.join(dist, "index.html")).mtimeMs < started - 1e3) throw new Error("Build did not produce a fresh index.html; refusing stale resources");
|
|
17583
|
+
const files = collectStaticFiles(dist);
|
|
17584
|
+
(0, import_node_fs18.mkdirSync)(output, { recursive: true });
|
|
17585
|
+
const staging = (0, import_node_fs18.mkdtempSync)(import_node_path23.default.join(output, ".desktop-build-"));
|
|
17586
|
+
const appDir = import_node_path23.default.join(staging, "app");
|
|
17587
|
+
(0, import_node_fs18.mkdirSync)(import_node_path23.default.join(appDir, "renderer"), { recursive: true });
|
|
17588
|
+
const manifest = {};
|
|
17589
|
+
for (const name of files) {
|
|
17590
|
+
const source = import_node_path23.default.join(dist, name), target = import_node_path23.default.join(appDir, "renderer", name);
|
|
17591
|
+
(0, import_node_fs18.mkdirSync)(import_node_path23.default.dirname(target), { recursive: true });
|
|
17592
|
+
(0, import_node_fs18.cpSync)(source, target);
|
|
17593
|
+
manifest[name] = (0, import_node_crypto4.createHash)("sha256").update((0, import_node_fs18.readFileSync)(source)).digest("hex");
|
|
17594
|
+
}
|
|
17595
|
+
const templateDir = import_node_path23.default.join(__dirname, "templates", "electron");
|
|
17596
|
+
(0, import_node_fs18.cpSync)(templateDir, appDir, { recursive: true });
|
|
17597
|
+
(0, import_node_fs18.writeFileSync)(import_node_path23.default.join(appDir, "desktop-config.json"), JSON.stringify({ app: c.app, productName: c.productName, origin: c.origin, authOrigins: c.authOrigins, bundleId: c.bundleId }));
|
|
17598
|
+
(0, import_node_fs18.writeFileSync)(import_node_path23.default.join(appDir, "resource-manifest.json"), JSON.stringify(manifest, null, 2));
|
|
17599
|
+
(0, import_node_fs18.writeFileSync)(import_node_path23.default.join(appDir, "package.json"), JSON.stringify({ name: c.bundleId.replace(/\./g, "-"), version: c.version, description: `${c.productName} desktop application`, author: "PMate", main: "main.cjs" }));
|
|
17600
|
+
const cache = import_node_path23.default.join((0, import_node_os9.homedir)(), ".cache", "pmate", "electron", `${ELECTRON_VERSION}-${BUILDER_VERSION}`);
|
|
17601
|
+
(0, import_node_fs18.mkdirSync)(cache, { recursive: true });
|
|
17602
|
+
const toolPackage = { name: "pmate-desktop-toolchain", private: true, dependencies: { electron: ELECTRON_VERSION, "electron-builder": BUILDER_VERSION } };
|
|
17603
|
+
if (!(0, import_node_fs18.existsSync)(import_node_path23.default.join(cache, "node_modules", "electron", "dist", "Electron.app")) || !(0, import_node_fs18.existsSync)(import_node_path23.default.join(cache, "node_modules", "electron-builder", "cli.js"))) {
|
|
17604
|
+
(0, import_node_fs18.writeFileSync)(import_node_path23.default.join(cache, "package.json"), JSON.stringify(toolPackage));
|
|
17605
|
+
await runBuildCommand(["npm", (0, import_node_fs18.existsSync)(import_node_path23.default.join(cache, "package-lock.json")) ? "ci" : "install", "--no-audit", "--no-fund"], cache);
|
|
17606
|
+
}
|
|
17607
|
+
const builderConfig = {
|
|
17608
|
+
appId: c.bundleId,
|
|
17609
|
+
productName: c.productName,
|
|
17610
|
+
electronVersion: ELECTRON_VERSION,
|
|
17611
|
+
directories: { app: appDir, output: import_node_path23.default.join(staging, "artifacts") },
|
|
17612
|
+
files: ["**/*"],
|
|
17613
|
+
asar: true,
|
|
17614
|
+
artifactName: "${productName}-${version}-${arch}.${ext}",
|
|
17615
|
+
mac: { icon, target: args.dir ? ["dir"] : ["dmg", "zip"], category: "public.app-category.social-networking", hardenedRuntime: args.signed, extendInfo: { NSMicrophoneUsageDescription: `${c.productName} uses your microphone only when you record a voice message.` }, ...args.signed ? {} : { identity: "-", notarize: false } },
|
|
17616
|
+
forceCodeSigning: args.signed
|
|
17617
|
+
};
|
|
17618
|
+
const configPath = import_node_path23.default.join(staging, "builder.json");
|
|
17619
|
+
(0, import_node_fs18.writeFileSync)(configPath, JSON.stringify(builderConfig));
|
|
17620
|
+
await runBuildCommand([process.execPath, import_node_path23.default.join(cache, "node_modules", "electron-builder", "cli.js"), "--config", configPath, "--mac", `--${args.arch}`, "--publish", "never"], appDir, { ...process.env, ...args.signed ? {} : { CSC_IDENTITY_AUTO_DISCOVERY: "false" } });
|
|
17621
|
+
const result = { ...plan, signature: args.signed ? "configured-signing-required; verify notarization before distribution" : "ad-hoc; local development", artifacts: import_node_path23.default.join(staging, "artifacts"), resources: manifest };
|
|
17622
|
+
(0, import_node_fs18.writeFileSync)(import_node_path23.default.join(staging, "build-report.json"), JSON.stringify(result, null, 2));
|
|
17623
|
+
console.log(JSON.stringify({ phase: "complete", report: import_node_path23.default.join(staging, "build-report.json"), artifacts: result.artifacts, signature: result.signature }, null, 2));
|
|
17624
|
+
}
|
|
17625
|
+
|
|
17511
17626
|
// src/commands/AppCommandHandler.ts
|
|
17512
|
-
var
|
|
17513
|
-
var
|
|
17627
|
+
var import_node_fs20 = require("fs");
|
|
17628
|
+
var import_node_path25 = __toESM(require("path"));
|
|
17514
17629
|
init_sessionStore();
|
|
17515
17630
|
|
|
17516
17631
|
// src/appIcon.ts
|
|
17517
|
-
var
|
|
17518
|
-
var
|
|
17519
|
-
var
|
|
17632
|
+
var import_node_fs19 = require("fs");
|
|
17633
|
+
var import_node_os10 = __toESM(require("os"));
|
|
17634
|
+
var import_node_path24 = __toESM(require("path"));
|
|
17520
17635
|
var import_sharp = __toESM(require("sharp"));
|
|
17521
17636
|
init_namespacedRef();
|
|
17522
17637
|
var ANDROID_ICON_SPECS = [
|
|
@@ -17621,13 +17736,13 @@ function createAppIconExportPlans(input) {
|
|
|
17621
17736
|
if (!input.outDir) {
|
|
17622
17737
|
throw new Error("App icon preset export requires --out-dir.");
|
|
17623
17738
|
}
|
|
17624
|
-
const outDir =
|
|
17625
|
-
(0,
|
|
17739
|
+
const outDir = import_node_path24.default.resolve(input.cwd, input.outDir);
|
|
17740
|
+
(0, import_node_fs19.mkdirSync)(outDir, { recursive: true });
|
|
17626
17741
|
return specs.map((spec) => ({
|
|
17627
17742
|
width: spec.width,
|
|
17628
17743
|
height: spec.height,
|
|
17629
17744
|
format: "png",
|
|
17630
|
-
outputPath:
|
|
17745
|
+
outputPath: import_node_path24.default.join(
|
|
17631
17746
|
outDir,
|
|
17632
17747
|
`${namespace}-${objectId}-${spec.name}-${spec.width}x${spec.height}.png`
|
|
17633
17748
|
)
|
|
@@ -17640,8 +17755,8 @@ function createAppIconExportPlans(input) {
|
|
|
17640
17755
|
if (!input.output) {
|
|
17641
17756
|
throw new Error("Single-size app icon export requires --output.");
|
|
17642
17757
|
}
|
|
17643
|
-
const resolvedOutput =
|
|
17644
|
-
(0,
|
|
17758
|
+
const resolvedOutput = import_node_path24.default.resolve(input.cwd, input.output);
|
|
17759
|
+
(0, import_node_fs19.mkdirSync)(import_node_path24.default.dirname(resolvedOutput), { recursive: true });
|
|
17645
17760
|
return [
|
|
17646
17761
|
{
|
|
17647
17762
|
width: input.width,
|
|
@@ -17655,7 +17770,7 @@ async function exportAppIcon(icon, plans) {
|
|
|
17655
17770
|
const svg = await resolveAppIconSvg(icon);
|
|
17656
17771
|
for (const plan of plans) {
|
|
17657
17772
|
const bytes = await renderAppIcon(svg, plan.width, plan.height, plan.format);
|
|
17658
|
-
(0,
|
|
17773
|
+
(0, import_node_fs19.writeFileSync)(plan.outputPath, bytes);
|
|
17659
17774
|
}
|
|
17660
17775
|
}
|
|
17661
17776
|
async function renderAppIconVariant(input) {
|
|
@@ -17663,9 +17778,9 @@ async function renderAppIconVariant(input) {
|
|
|
17663
17778
|
const bytes = await renderAppIcon(svg, input.width, input.height, input.format);
|
|
17664
17779
|
let outputPath;
|
|
17665
17780
|
if (input.output) {
|
|
17666
|
-
outputPath =
|
|
17667
|
-
(0,
|
|
17668
|
-
(0,
|
|
17781
|
+
outputPath = import_node_path24.default.resolve(input.cwd, input.output);
|
|
17782
|
+
(0, import_node_fs19.mkdirSync)(import_node_path24.default.dirname(outputPath), { recursive: true });
|
|
17783
|
+
(0, import_node_fs19.writeFileSync)(outputPath, bytes);
|
|
17669
17784
|
}
|
|
17670
17785
|
if (input.name) {
|
|
17671
17786
|
return {
|
|
@@ -17686,7 +17801,7 @@ async function renderAppIconVariant(input) {
|
|
|
17686
17801
|
};
|
|
17687
17802
|
}
|
|
17688
17803
|
async function loadAppIconVariantFile(input) {
|
|
17689
|
-
const absolutePath =
|
|
17804
|
+
const absolutePath = import_node_path24.default.resolve(input.cwd, input.filePath);
|
|
17690
17805
|
const format = inferVariantFormatFromPath(absolutePath);
|
|
17691
17806
|
return {
|
|
17692
17807
|
value: input.name ? await uploadAppIconVariantAsset({
|
|
@@ -17695,7 +17810,7 @@ async function loadAppIconVariantFile(input) {
|
|
|
17695
17810
|
name: input.name,
|
|
17696
17811
|
format,
|
|
17697
17812
|
sourcePath: absolutePath
|
|
17698
|
-
}) : createImageDataUrl((0,
|
|
17813
|
+
}) : createImageDataUrl((0, import_node_fs19.readFileSync)(absolutePath), format),
|
|
17699
17814
|
format,
|
|
17700
17815
|
absolutePath
|
|
17701
17816
|
};
|
|
@@ -17754,7 +17869,7 @@ function shouldAutoGenerateDefaultVariant(icon) {
|
|
|
17754
17869
|
return looksLikeSvgMarkup(icon) || looksLikeSvgUrl(icon);
|
|
17755
17870
|
}
|
|
17756
17871
|
function inferVariantFormatFromPath(filePath) {
|
|
17757
|
-
const ext =
|
|
17872
|
+
const ext = import_node_path24.default.extname(filePath).toLowerCase();
|
|
17758
17873
|
switch (ext) {
|
|
17759
17874
|
case ".png":
|
|
17760
17875
|
return "png";
|
|
@@ -17825,13 +17940,13 @@ async function uploadAppIconVariantAsset(input) {
|
|
|
17825
17940
|
await AliyunService.uploadFile(sourcePath, DEFAULT_APP_ICON_VARIANT_BUCKET, objectKey);
|
|
17826
17941
|
} finally {
|
|
17827
17942
|
if (shouldCleanup) {
|
|
17828
|
-
(0,
|
|
17943
|
+
(0, import_node_fs19.rmSync)(import_node_path24.default.dirname(sourcePath), { recursive: true, force: true });
|
|
17829
17944
|
}
|
|
17830
17945
|
}
|
|
17831
17946
|
return `${DEFAULT_APP_ICON_VARIANT_PUBLIC_BASE_URL}/${objectKey}`;
|
|
17832
17947
|
}
|
|
17833
17948
|
function buildAppIconVariantObjectKey(input) {
|
|
17834
|
-
return
|
|
17949
|
+
return import_node_path24.default.posix.join(
|
|
17835
17950
|
"apps",
|
|
17836
17951
|
`${resolveAppIconAssetStem(input.icon, input.appRef)}-${input.name}.${extensionForIconFormat(input.format)}`
|
|
17837
17952
|
);
|
|
@@ -17840,8 +17955,8 @@ function resolveAppIconAssetStem(icon, appRef2) {
|
|
|
17840
17955
|
if (icon) {
|
|
17841
17956
|
try {
|
|
17842
17957
|
const url = new URL(icon);
|
|
17843
|
-
const ext =
|
|
17844
|
-
const basename =
|
|
17958
|
+
const ext = import_node_path24.default.posix.extname(url.pathname);
|
|
17959
|
+
const basename = import_node_path24.default.posix.basename(url.pathname, ext);
|
|
17845
17960
|
const normalized = sanitizeAppIconAssetStem(basename);
|
|
17846
17961
|
if (normalized) {
|
|
17847
17962
|
return normalized;
|
|
@@ -17870,9 +17985,9 @@ function writeTempAppIconVariantFile(objectKey, format, bytes) {
|
|
|
17870
17985
|
if (!bytes) {
|
|
17871
17986
|
throw new Error("App icon variant upload requires bytes or a source file.");
|
|
17872
17987
|
}
|
|
17873
|
-
const tempDir = (0,
|
|
17874
|
-
const tempPath =
|
|
17875
|
-
(0,
|
|
17988
|
+
const tempDir = (0, import_node_fs19.mkdtempSync)(import_node_path24.default.join(import_node_os10.default.tmpdir(), "pmate-app-icon-"));
|
|
17989
|
+
const tempPath = import_node_path24.default.join(tempDir, import_node_path24.default.basename(objectKey) || `variant.${extensionForIconFormat(format)}`);
|
|
17990
|
+
(0, import_node_fs19.writeFileSync)(tempPath, bytes);
|
|
17876
17991
|
return tempPath;
|
|
17877
17992
|
}
|
|
17878
17993
|
|
|
@@ -17880,6 +17995,7 @@ function writeTempAppIconVariantFile(objectKey, format, bytes) {
|
|
|
17880
17995
|
init_namespacedRef();
|
|
17881
17996
|
var AppCommandHandler = class {
|
|
17882
17997
|
async handle(args) {
|
|
17998
|
+
if (args.action === "build") return buildDesktop(args);
|
|
17883
17999
|
const token = this.readToken();
|
|
17884
18000
|
const baseUrl = this.resolveBaseUrl(args.baseUrl);
|
|
17885
18001
|
switch (args.action) {
|
|
@@ -18081,10 +18197,10 @@ var AppCommandHandler = class {
|
|
|
18081
18197
|
}
|
|
18082
18198
|
readJsonFile(filePath) {
|
|
18083
18199
|
const absolutePath = this.resolveFilePath(filePath);
|
|
18084
|
-
if (!(0,
|
|
18200
|
+
if (!(0, import_node_fs20.existsSync)(absolutePath)) {
|
|
18085
18201
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
18086
18202
|
}
|
|
18087
|
-
const raw = (0,
|
|
18203
|
+
const raw = (0, import_node_fs20.readFileSync)(absolutePath, "utf8");
|
|
18088
18204
|
try {
|
|
18089
18205
|
return JSON.parse(raw);
|
|
18090
18206
|
} catch (error) {
|
|
@@ -18094,10 +18210,10 @@ var AppCommandHandler = class {
|
|
|
18094
18210
|
}
|
|
18095
18211
|
async preparePayload(filePath, appRef2) {
|
|
18096
18212
|
const absolutePath = this.resolveFilePath(filePath);
|
|
18097
|
-
return prepareAppPayload(this.readJsonFile(filePath),
|
|
18213
|
+
return prepareAppPayload(this.readJsonFile(filePath), import_node_path25.default.dirname(absolutePath), { appRef: appRef2 });
|
|
18098
18214
|
}
|
|
18099
18215
|
resolveFilePath(filePath) {
|
|
18100
|
-
return
|
|
18216
|
+
return import_node_path25.default.resolve(process.cwd(), filePath);
|
|
18101
18217
|
}
|
|
18102
18218
|
async request(baseUrl, token, method, pathname, body) {
|
|
18103
18219
|
const response = await fetch(`${baseUrl}${pathname}`, {
|
|
@@ -18217,18 +18333,18 @@ function readNamespaceFromPayload(payload) {
|
|
|
18217
18333
|
}
|
|
18218
18334
|
|
|
18219
18335
|
// src/commands/ServiceCommandHandler.ts
|
|
18220
|
-
var
|
|
18336
|
+
var import_node_fs23 = require("fs");
|
|
18221
18337
|
var import_promises5 = require("fs/promises");
|
|
18222
|
-
var
|
|
18223
|
-
var
|
|
18338
|
+
var import_node_path28 = __toESM(require("path"));
|
|
18339
|
+
var import_node_child_process12 = require("child_process");
|
|
18224
18340
|
var import_promises6 = require("readline/promises");
|
|
18225
18341
|
|
|
18226
18342
|
// src/services/AndroidApkReleaseService.ts
|
|
18227
|
-
var
|
|
18228
|
-
var
|
|
18229
|
-
var
|
|
18230
|
-
var
|
|
18231
|
-
var
|
|
18343
|
+
var import_node_child_process10 = require("child_process");
|
|
18344
|
+
var import_node_crypto5 = require("crypto");
|
|
18345
|
+
var import_node_fs21 = require("fs");
|
|
18346
|
+
var import_node_os11 = __toESM(require("os"));
|
|
18347
|
+
var import_node_path26 = __toESM(require("path"));
|
|
18232
18348
|
var ANDROID_APK_BUCKET = "parrot-static";
|
|
18233
18349
|
var ANDROID_APK_PUBLIC_BASE_URL = "https://parrot-static.pmate.chat";
|
|
18234
18350
|
var AndroidApkReleaseService = class {
|
|
@@ -18262,7 +18378,7 @@ var AndroidApkReleaseService = class {
|
|
|
18262
18378
|
}
|
|
18263
18379
|
await AliyunService.uploadFile(apkPath, ANDROID_APK_BUCKET, objectKey);
|
|
18264
18380
|
const sha256 = await sha256File(apkPath);
|
|
18265
|
-
const size = (0,
|
|
18381
|
+
const size = (0, import_node_fs21.statSync)(apkPath).size;
|
|
18266
18382
|
const artifact = {
|
|
18267
18383
|
serviceId: service.id,
|
|
18268
18384
|
env: options.env,
|
|
@@ -18296,15 +18412,15 @@ var AndroidApkReleaseService = class {
|
|
|
18296
18412
|
minimumVersionCode: options.minimumVersionCode
|
|
18297
18413
|
});
|
|
18298
18414
|
const objectKey = buildAndroidLatestManifestObjectKey(service.namespace, service.name);
|
|
18299
|
-
const tempDir = (0,
|
|
18300
|
-
const manifestPath =
|
|
18415
|
+
const tempDir = (0, import_node_fs21.mkdtempSync)(import_node_path26.default.join(import_node_os11.default.tmpdir(), "pmate-apk-latest-"));
|
|
18416
|
+
const manifestPath = import_node_path26.default.join(tempDir, "latest.json");
|
|
18301
18417
|
try {
|
|
18302
|
-
(0,
|
|
18418
|
+
(0, import_node_fs21.writeFileSync)(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
18303
18419
|
`);
|
|
18304
18420
|
await AliyunService.uploadFile(manifestPath, ANDROID_APK_BUCKET, objectKey);
|
|
18305
18421
|
ui.success(`Published Android update manifest ${ANDROID_APK_PUBLIC_BASE_URL}/${objectKey}`);
|
|
18306
18422
|
} finally {
|
|
18307
|
-
(0,
|
|
18423
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
18308
18424
|
}
|
|
18309
18425
|
}
|
|
18310
18426
|
async list(service, options) {
|
|
@@ -18320,7 +18436,7 @@ var AndroidApkReleaseService = class {
|
|
|
18320
18436
|
const prefix = `apks/${service.namespace}/${service.name}`;
|
|
18321
18437
|
const objects = await AliyunService.listObjects(ANDROID_APK_BUCKET, prefix);
|
|
18322
18438
|
return objects.filter((item) => item.name.endsWith(".apk")).map((item) => {
|
|
18323
|
-
const versionName =
|
|
18439
|
+
const versionName = import_node_path26.default.basename(item.name, ".apk");
|
|
18324
18440
|
return {
|
|
18325
18441
|
serviceId,
|
|
18326
18442
|
env: options.env ?? "unknown",
|
|
@@ -18343,7 +18459,7 @@ var AndroidApkReleaseService = class {
|
|
|
18343
18459
|
}
|
|
18344
18460
|
}
|
|
18345
18461
|
resolveRepoRoot(service, cwd) {
|
|
18346
|
-
if (cwd) return
|
|
18462
|
+
if (cwd) return import_node_path26.default.resolve(process.cwd(), cwd);
|
|
18347
18463
|
const repository = this.getRepository(service);
|
|
18348
18464
|
if (repository) {
|
|
18349
18465
|
return resolveRepositoryLocalRoot(repository);
|
|
@@ -18355,8 +18471,8 @@ var AndroidApkReleaseService = class {
|
|
|
18355
18471
|
if (!dir) {
|
|
18356
18472
|
throw new Error(`Missing dir for android service ${service.id}`);
|
|
18357
18473
|
}
|
|
18358
|
-
const appDir =
|
|
18359
|
-
if (!(0,
|
|
18474
|
+
const appDir = import_node_path26.default.resolve(repoRoot, dir);
|
|
18475
|
+
if (!(0, import_node_fs21.existsSync)(appDir)) {
|
|
18360
18476
|
throw new Error(`Android app dir not found: ${appDir}`);
|
|
18361
18477
|
}
|
|
18362
18478
|
return appDir;
|
|
@@ -18372,11 +18488,11 @@ var AndroidApkReleaseService = class {
|
|
|
18372
18488
|
return void 0;
|
|
18373
18489
|
}
|
|
18374
18490
|
async runGradleAssembleAndFindApk(repoRoot, appDir, variant) {
|
|
18375
|
-
const gradlew = [
|
|
18491
|
+
const gradlew = [import_node_path26.default.join(appDir, "gradlew"), import_node_path26.default.join(repoRoot, "gradlew")].find((candidate) => (0, import_node_fs21.existsSync)(candidate));
|
|
18376
18492
|
if (!gradlew) {
|
|
18377
18493
|
throw new Error(`Gradle wrapper not found in ${appDir} or ${repoRoot}`);
|
|
18378
18494
|
}
|
|
18379
|
-
const gradleCwd =
|
|
18495
|
+
const gradleCwd = import_node_path26.default.dirname(gradlew);
|
|
18380
18496
|
const normalizedVariant = variant.toLowerCase();
|
|
18381
18497
|
const taskSuffix = `assemble${capitalize(normalizedVariant)}`;
|
|
18382
18498
|
const tasks = [`:app:${taskSuffix}`, taskSuffix];
|
|
@@ -18464,7 +18580,7 @@ function resolveRepositoryLocalRoot(repository) {
|
|
|
18464
18580
|
if (!repoName) {
|
|
18465
18581
|
throw new Error(`Invalid repository: ${repository}`);
|
|
18466
18582
|
}
|
|
18467
|
-
return
|
|
18583
|
+
return import_node_path26.default.join(import_node_os11.default.homedir(), "dev", "pmate", repoName);
|
|
18468
18584
|
}
|
|
18469
18585
|
function bumpAndroidGradleVersionText(source, bump) {
|
|
18470
18586
|
const versionNameMatch = source.match(/(^\s*versionName\s+["'])([^"']+)(["']\s*$)/m) ?? source.match(/(^\s*versionName\s*=\s*["'])([^"']+)(["']\s*$)/m);
|
|
@@ -18520,46 +18636,46 @@ function parseGradleOutputMetadata(source, apkFileName) {
|
|
|
18520
18636
|
}
|
|
18521
18637
|
function bumpAndroidProjectVersion(appDir, bump) {
|
|
18522
18638
|
const candidates = [
|
|
18523
|
-
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
18639
|
+
import_node_path26.default.join(appDir, "app", "build.gradle.kts"),
|
|
18640
|
+
import_node_path26.default.join(appDir, "app", "build.gradle"),
|
|
18641
|
+
import_node_path26.default.join(appDir, "build.gradle.kts"),
|
|
18642
|
+
import_node_path26.default.join(appDir, "build.gradle")
|
|
18527
18643
|
];
|
|
18528
18644
|
for (const candidate of candidates) {
|
|
18529
|
-
if (!(0,
|
|
18530
|
-
const result = bumpAndroidGradleVersionText((0,
|
|
18531
|
-
(0,
|
|
18645
|
+
if (!(0, import_node_fs21.existsSync)(candidate)) continue;
|
|
18646
|
+
const result = bumpAndroidGradleVersionText((0, import_node_fs21.readFileSync)(candidate, "utf8"), bump);
|
|
18647
|
+
(0, import_node_fs21.writeFileSync)(candidate, result.source);
|
|
18532
18648
|
return { filePath: candidate, ...result };
|
|
18533
18649
|
}
|
|
18534
18650
|
throw new Error(`No Android Gradle version file found under ${appDir}`);
|
|
18535
18651
|
}
|
|
18536
18652
|
function findLatestApk(repoRoot, appDir, variant) {
|
|
18537
18653
|
const dirs = [
|
|
18538
|
-
|
|
18539
|
-
|
|
18540
|
-
|
|
18654
|
+
import_node_path26.default.join(appDir, "app", "build", "outputs", "apk", variant),
|
|
18655
|
+
import_node_path26.default.join(appDir, "build", "outputs", "apk", variant),
|
|
18656
|
+
import_node_path26.default.join(repoRoot, "app", "build", "outputs", "apk", variant)
|
|
18541
18657
|
];
|
|
18542
18658
|
const files = dirs.flatMap((dir) => listApks(dir));
|
|
18543
18659
|
if (files.length === 0) {
|
|
18544
18660
|
throw new Error(`Cannot find APK output for variant ${variant}`);
|
|
18545
18661
|
}
|
|
18546
|
-
files.sort((a, b) => (0,
|
|
18662
|
+
files.sort((a, b) => (0, import_node_fs21.statSync)(b).mtimeMs - (0, import_node_fs21.statSync)(a).mtimeMs);
|
|
18547
18663
|
return files[0];
|
|
18548
18664
|
}
|
|
18549
18665
|
function readGradleOutputMetadata(apkPath) {
|
|
18550
|
-
const metadataPath =
|
|
18551
|
-
if (!(0,
|
|
18666
|
+
const metadataPath = import_node_path26.default.join(import_node_path26.default.dirname(apkPath), "output-metadata.json");
|
|
18667
|
+
if (!(0, import_node_fs21.existsSync)(metadataPath)) {
|
|
18552
18668
|
throw new Error(`Gradle output metadata not found: ${metadataPath}`);
|
|
18553
18669
|
}
|
|
18554
|
-
return parseGradleOutputMetadata((0,
|
|
18670
|
+
return parseGradleOutputMetadata((0, import_node_fs21.readFileSync)(metadataPath, "utf8"), import_node_path26.default.basename(apkPath));
|
|
18555
18671
|
}
|
|
18556
18672
|
function listApks(dir) {
|
|
18557
|
-
if (!(0,
|
|
18558
|
-
return (0,
|
|
18673
|
+
if (!(0, import_node_fs21.existsSync)(dir)) return [];
|
|
18674
|
+
return (0, import_node_fs21.readdirSync)(dir).filter((entry) => entry.endsWith(".apk")).map((entry) => import_node_path26.default.join(dir, entry)).filter((entry) => (0, import_node_fs21.statSync)(entry).isFile());
|
|
18559
18675
|
}
|
|
18560
18676
|
function runCommand(command, args, cwd) {
|
|
18561
18677
|
return new Promise((resolve, reject) => {
|
|
18562
|
-
const child = (0,
|
|
18678
|
+
const child = (0, import_node_child_process10.spawn)(command, args, { cwd, stdio: "inherit" });
|
|
18563
18679
|
child.on("error", reject);
|
|
18564
18680
|
child.on("close", (code) => {
|
|
18565
18681
|
if (code === 0) resolve();
|
|
@@ -18569,7 +18685,7 @@ function runCommand(command, args, cwd) {
|
|
|
18569
18685
|
}
|
|
18570
18686
|
function runCommandCapture(command, args, cwd) {
|
|
18571
18687
|
return new Promise((resolve, reject) => {
|
|
18572
|
-
const child = (0,
|
|
18688
|
+
const child = (0, import_node_child_process10.spawn)(command, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
18573
18689
|
const chunks = [];
|
|
18574
18690
|
const errorChunks = [];
|
|
18575
18691
|
child.stdout?.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
|
|
@@ -18589,26 +18705,26 @@ async function runAndroidSdkToolCapture(toolName, args) {
|
|
|
18589
18705
|
return runCommandCapture(toolPath, args);
|
|
18590
18706
|
}
|
|
18591
18707
|
function findAndroidSdkTool(toolName) {
|
|
18592
|
-
const sdkRoots = [process.env.ANDROID_HOME, process.env.ANDROID_SDK_ROOT].filter((item) => Boolean(item)).map((item) =>
|
|
18708
|
+
const sdkRoots = [process.env.ANDROID_HOME, process.env.ANDROID_SDK_ROOT].filter((item) => Boolean(item)).map((item) => import_node_path26.default.resolve(item));
|
|
18593
18709
|
for (const sdkRoot of sdkRoots) {
|
|
18594
|
-
const candidates = toolName === "aapt" ? listVersionedToolCandidates(
|
|
18595
|
-
|
|
18596
|
-
...listVersionedToolCandidates(
|
|
18597
|
-
|
|
18710
|
+
const candidates = toolName === "aapt" ? listVersionedToolCandidates(import_node_path26.default.join(sdkRoot, "build-tools"), toolName) : [
|
|
18711
|
+
import_node_path26.default.join(sdkRoot, "cmdline-tools", "latest", "bin", toolName),
|
|
18712
|
+
...listVersionedToolCandidates(import_node_path26.default.join(sdkRoot, "cmdline-tools"), import_node_path26.default.join("bin", toolName)),
|
|
18713
|
+
import_node_path26.default.join(sdkRoot, "tools", "bin", toolName)
|
|
18598
18714
|
];
|
|
18599
|
-
const match = candidates.find((candidate) => (0,
|
|
18715
|
+
const match = candidates.find((candidate) => (0, import_node_fs21.existsSync)(candidate));
|
|
18600
18716
|
if (match) return match;
|
|
18601
18717
|
}
|
|
18602
18718
|
return void 0;
|
|
18603
18719
|
}
|
|
18604
18720
|
function listVersionedToolCandidates(parentDir, relativeToolPath) {
|
|
18605
|
-
if (!(0,
|
|
18606
|
-
return (0,
|
|
18721
|
+
if (!(0, import_node_fs21.existsSync)(parentDir)) return [];
|
|
18722
|
+
return (0, import_node_fs21.readdirSync)(parentDir).map((entry) => import_node_path26.default.join(parentDir, entry)).filter((entry) => (0, import_node_fs21.statSync)(entry).isDirectory()).sort((a, b) => import_node_path26.default.basename(b).localeCompare(import_node_path26.default.basename(a), void 0, { numeric: true })).map((entry) => import_node_path26.default.join(entry, relativeToolPath));
|
|
18607
18723
|
}
|
|
18608
18724
|
function sha256File(filePath) {
|
|
18609
18725
|
return new Promise((resolve, reject) => {
|
|
18610
|
-
const hash = (0,
|
|
18611
|
-
const stream = (0,
|
|
18726
|
+
const hash = (0, import_node_crypto5.createHash)("sha256");
|
|
18727
|
+
const stream = (0, import_node_fs21.createReadStream)(filePath);
|
|
18612
18728
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
18613
18729
|
stream.on("error", reject);
|
|
18614
18730
|
stream.on("end", () => resolve(hash.digest("hex")));
|
|
@@ -18624,11 +18740,55 @@ function capitalize(value) {
|
|
|
18624
18740
|
return value.slice(0, 1).toUpperCase() + value.slice(1);
|
|
18625
18741
|
}
|
|
18626
18742
|
|
|
18743
|
+
// src/services/DeveloperLogsClient.ts
|
|
18744
|
+
init_sessionStore();
|
|
18745
|
+
init_namespacedRef();
|
|
18746
|
+
var appRef = "pmate:developers";
|
|
18747
|
+
async function queryDeveloperLogs(input, fetcher = fetch) {
|
|
18748
|
+
if (input.app) parseNamespacedRef(input.app, { entityLabel: "app ref" });
|
|
18749
|
+
parseNamespacedRef(input.service, { entityLabel: "service ref" });
|
|
18750
|
+
if (!Number.isSafeInteger(input.page) || input.page < 0) throw new Error("Invalid log page");
|
|
18751
|
+
if (input.sinceMs !== void 0 && (!Number.isSafeInteger(input.sinceMs) || input.sinceMs < 0)) throw new Error("Invalid log time");
|
|
18752
|
+
if (input.keyword && input.keyword.length > 256) throw new Error("Log search must be at most 256 characters");
|
|
18753
|
+
const session = readRequiredSession({ preferredApp: appRef, fallbackToActiveApp: true });
|
|
18754
|
+
if (Date.parse(session.expiresAt) <= Date.now() || !Number.isFinite(Date.parse(session.expiresAt)))
|
|
18755
|
+
throw new Error("Session expired. Run pmate login --app pmate:developers");
|
|
18756
|
+
async function request2(url, init) {
|
|
18757
|
+
let response;
|
|
18758
|
+
try {
|
|
18759
|
+
response = await fetcher(url, { ...init, redirect: "error", signal: AbortSignal.timeout(3e4) });
|
|
18760
|
+
} catch {
|
|
18761
|
+
throw new Error("Developers log request failed; no anonymous fallback was attempted");
|
|
18762
|
+
}
|
|
18763
|
+
if (!response.ok) throw new Error(`Developers log request failed (HTTP ${response.status}); check login, pmate:dev role`);
|
|
18764
|
+
let body;
|
|
18765
|
+
try {
|
|
18766
|
+
body = await response.json();
|
|
18767
|
+
} catch {
|
|
18768
|
+
throw new Error("Invalid Developers API response");
|
|
18769
|
+
}
|
|
18770
|
+
if (!body?.success) throw new Error("Developers API rejected the request");
|
|
18771
|
+
return body.data;
|
|
18772
|
+
}
|
|
18773
|
+
const exchanged = await request2("https://auth-api-v2.pmate.chat/session/exchange", {
|
|
18774
|
+
method: "POST",
|
|
18775
|
+
headers: { Authorization: `Bearer ${session.token}`, "Content-Type": "application/json" },
|
|
18776
|
+
body: JSON.stringify({ app: appRef })
|
|
18777
|
+
});
|
|
18778
|
+
if (exchanged?.session?.identity?.app !== appRef || exchanged.session.identity.accountId !== session.accountId || typeof exchanged.token !== "string" || !exchanged.token)
|
|
18779
|
+
throw new Error("Developers session identity mismatch");
|
|
18780
|
+
const params = new URLSearchParams({ service: input.service, page: String(input.page), topic: input.topic ?? "app" });
|
|
18781
|
+
for (const key of ["type", "level", "source", "requestId", "environment"]) if (input[key]) params.set(key, input[key]);
|
|
18782
|
+
if (input.keyword) params.set("keyword", input.keyword);
|
|
18783
|
+
if (input.sinceMs !== void 0) params.set("sinceMs", String(input.sinceMs));
|
|
18784
|
+
return request2(`https://dev-api.pmate.chat/api/logs?${params}`, { headers: { Authorization: `Bearer ${exchanged.token}` } });
|
|
18785
|
+
}
|
|
18786
|
+
|
|
18627
18787
|
// src/services/ServiceRuntimeRunner.ts
|
|
18628
|
-
var
|
|
18629
|
-
var
|
|
18630
|
-
var
|
|
18631
|
-
var
|
|
18788
|
+
var import_node_fs22 = require("fs");
|
|
18789
|
+
var import_node_os12 = __toESM(require("os"));
|
|
18790
|
+
var import_node_path27 = __toESM(require("path"));
|
|
18791
|
+
var import_node_child_process11 = require("child_process");
|
|
18632
18792
|
var import_node_readline = require("readline");
|
|
18633
18793
|
var import_chalk3 = __toESM(require("chalk"));
|
|
18634
18794
|
var import_dotenv = require("dotenv");
|
|
@@ -18995,15 +19155,21 @@ var ServiceRuntimeRunner = class {
|
|
|
18995
19155
|
const namespace = service.namespace;
|
|
18996
19156
|
const appName = service.name;
|
|
18997
19157
|
const page = await this.fetchLogPage(namespace, appName, {
|
|
19158
|
+
...options,
|
|
18998
19159
|
page: options.page ?? 0,
|
|
18999
19160
|
history: options.history ?? false,
|
|
19000
19161
|
search: options.search
|
|
19001
19162
|
});
|
|
19002
|
-
|
|
19163
|
+
if (options.json) {
|
|
19164
|
+
console.log(JSON.stringify(page));
|
|
19165
|
+
return;
|
|
19166
|
+
}
|
|
19167
|
+
ui.title(`Logs for ${namespace}/${appName} \xB7 ${options.topic ?? "app"}`);
|
|
19003
19168
|
ui.info("Source", { mode: options.history ? "history" : "online" });
|
|
19004
19169
|
this.renderPage(page);
|
|
19005
19170
|
if (options.follow) {
|
|
19006
19171
|
await this.followLogs(namespace, appName, {
|
|
19172
|
+
...options,
|
|
19007
19173
|
page: options.page ?? 0,
|
|
19008
19174
|
history: options.history ?? false,
|
|
19009
19175
|
search: options.search,
|
|
@@ -19020,7 +19186,7 @@ var ServiceRuntimeRunner = class {
|
|
|
19020
19186
|
interactive?.rl.on("close", () => {
|
|
19021
19187
|
running = false;
|
|
19022
19188
|
});
|
|
19023
|
-
const seen = new Set(options.seedItems.map((item) => item.hash));
|
|
19189
|
+
const seen = new Set(options.seedItems.map((item) => item.id ?? item.hash));
|
|
19024
19190
|
ui.info(
|
|
19025
19191
|
"Follow",
|
|
19026
19192
|
interactive ? "enabled (poll every 2s, Ctrl+C to stop, /help for filters)" : "enabled (poll every 2s, Ctrl+C to stop)"
|
|
@@ -19031,6 +19197,7 @@ var ServiceRuntimeRunner = class {
|
|
|
19031
19197
|
let page;
|
|
19032
19198
|
try {
|
|
19033
19199
|
page = await this.fetchLogPage(namespace, appName, {
|
|
19200
|
+
...options,
|
|
19034
19201
|
page: options.page,
|
|
19035
19202
|
history: options.history,
|
|
19036
19203
|
search: options.search
|
|
@@ -19040,12 +19207,12 @@ var ServiceRuntimeRunner = class {
|
|
|
19040
19207
|
ui.warn("Follow fetch failed", { message });
|
|
19041
19208
|
continue;
|
|
19042
19209
|
}
|
|
19043
|
-
const newItems = page.data.filter((item) => !seen.has(item.hash));
|
|
19210
|
+
const newItems = page.data.filter((item) => !seen.has(item.id ?? item.hash));
|
|
19044
19211
|
if (newItems.length === 0) {
|
|
19045
19212
|
continue;
|
|
19046
19213
|
}
|
|
19047
19214
|
for (const item of newItems) {
|
|
19048
|
-
seen.add(item.hash);
|
|
19215
|
+
seen.add(item.id ?? item.hash);
|
|
19049
19216
|
recent.unshift(item);
|
|
19050
19217
|
if (recent.length > 200) {
|
|
19051
19218
|
recent.pop();
|
|
@@ -19120,14 +19287,14 @@ var ServiceRuntimeRunner = class {
|
|
|
19120
19287
|
}
|
|
19121
19288
|
resolveRepoRoot(service, cwd) {
|
|
19122
19289
|
if (cwd) {
|
|
19123
|
-
return
|
|
19290
|
+
return import_node_path27.default.resolve(process.cwd(), cwd);
|
|
19124
19291
|
}
|
|
19125
19292
|
const repository = this.getType(service) === "vite" || this.getType(service) === "static" ? this.getRepoStaticSite(service).repository.trim() : this.getType(service) === "fc" ? this.getFc(service).repository?.trim() : this.getType(service) === "ios" || this.getType(service) === "android" ? void 0 : this.getNetwork(service).repository?.trim();
|
|
19126
19293
|
if (repository) {
|
|
19127
19294
|
const repoName = repository.replace(/\/+$/, "").split("/").pop()?.replace(/\.git$/i, "");
|
|
19128
19295
|
if (repoName) {
|
|
19129
|
-
const candidate =
|
|
19130
|
-
if ((0,
|
|
19296
|
+
const candidate = import_node_path27.default.join(import_node_os12.default.homedir(), "dev", "pmate", repoName);
|
|
19297
|
+
if ((0, import_node_fs22.existsSync)(candidate)) {
|
|
19131
19298
|
return candidate;
|
|
19132
19299
|
}
|
|
19133
19300
|
}
|
|
@@ -19140,13 +19307,13 @@ var ServiceRuntimeRunner = class {
|
|
|
19140
19307
|
if (!dir) {
|
|
19141
19308
|
throw new Error(`Missing service dir for ${service.id}`);
|
|
19142
19309
|
}
|
|
19143
|
-
return
|
|
19310
|
+
return import_node_path27.default.resolve(repoRoot, dir);
|
|
19144
19311
|
}
|
|
19145
19312
|
async deployVite(service, options) {
|
|
19146
19313
|
this.assertDeployableStaticSite(service);
|
|
19147
19314
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19148
|
-
const packageJsonPath =
|
|
19149
|
-
if (!(0,
|
|
19315
|
+
const packageJsonPath = import_node_path27.default.join(appDir, "package.json");
|
|
19316
|
+
if (!(0, import_node_fs22.existsSync)(packageJsonPath)) {
|
|
19150
19317
|
throw new Error(`No package.json found at ${packageJsonPath}`);
|
|
19151
19318
|
}
|
|
19152
19319
|
const pkg2 = this.loadPackageJson(packageJsonPath);
|
|
@@ -19161,8 +19328,8 @@ var ServiceRuntimeRunner = class {
|
|
|
19161
19328
|
this.resolveRepoRoot(service, options.cwd),
|
|
19162
19329
|
buildEnv
|
|
19163
19330
|
);
|
|
19164
|
-
const distDir =
|
|
19165
|
-
if (!(0,
|
|
19331
|
+
const distDir = import_node_path27.default.join(appDir, "dist");
|
|
19332
|
+
if (!(0, import_node_fs22.existsSync)(distDir)) {
|
|
19166
19333
|
throw new Error(`No dist directory found at ${distDir}`);
|
|
19167
19334
|
}
|
|
19168
19335
|
const site = this.getSite(service);
|
|
@@ -19175,8 +19342,8 @@ var ServiceRuntimeRunner = class {
|
|
|
19175
19342
|
async deployStatic(service, options) {
|
|
19176
19343
|
this.assertDeployableStaticSite(service);
|
|
19177
19344
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19178
|
-
const srcDir =
|
|
19179
|
-
if (!(0,
|
|
19345
|
+
const srcDir = import_node_path27.default.join(appDir, "src");
|
|
19346
|
+
if (!(0, import_node_fs22.existsSync)(srcDir)) {
|
|
19180
19347
|
throw new Error(`No src directory found at ${srcDir}`);
|
|
19181
19348
|
}
|
|
19182
19349
|
const site = this.getSite(service);
|
|
@@ -19210,8 +19377,8 @@ var ServiceRuntimeRunner = class {
|
|
|
19210
19377
|
this.validateFcConfig(service, fc);
|
|
19211
19378
|
const repoRoot = this.resolveRepoRoot(service, options.cwd);
|
|
19212
19379
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19213
|
-
const packageJsonPath =
|
|
19214
|
-
if (!(0,
|
|
19380
|
+
const packageJsonPath = import_node_path27.default.join(appDir, "package.json");
|
|
19381
|
+
if (!(0, import_node_fs22.existsSync)(packageJsonPath)) {
|
|
19215
19382
|
throw new Error(`No package.json found at ${packageJsonPath}`);
|
|
19216
19383
|
}
|
|
19217
19384
|
const pkg2 = this.loadPackageJson(packageJsonPath);
|
|
@@ -19264,15 +19431,15 @@ var ServiceRuntimeRunner = class {
|
|
|
19264
19431
|
const repoRoot = this.resolveRepoRoot(service, options.cwd);
|
|
19265
19432
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19266
19433
|
await this.ensurePnpmWorkspaceRoot(repoRoot);
|
|
19267
|
-
const configPath =
|
|
19268
|
-
if (!(0,
|
|
19434
|
+
const configPath = import_node_path27.default.join(appDir, fc.configFile ?? "s.yaml");
|
|
19435
|
+
if (!(0, import_node_fs22.existsSync)(configPath)) {
|
|
19269
19436
|
throw new Error(`Missing FC config file at ${configPath}`);
|
|
19270
19437
|
}
|
|
19271
|
-
const packageJsonPath =
|
|
19272
|
-
if (!(0,
|
|
19438
|
+
const packageJsonPath = import_node_path27.default.join(appDir, "package.json");
|
|
19439
|
+
if (!(0, import_node_fs22.existsSync)(packageJsonPath)) {
|
|
19273
19440
|
throw new Error(`No package.json found at ${packageJsonPath}`);
|
|
19274
19441
|
}
|
|
19275
|
-
const rawConfig = (0,
|
|
19442
|
+
const rawConfig = (0, import_node_fs22.readFileSync)(configPath, "utf8");
|
|
19276
19443
|
if (!rawConfig.includes(fc.functionName)) {
|
|
19277
19444
|
throw new Error(`FC config ${configPath} does not mention functionName ${fc.functionName}`);
|
|
19278
19445
|
}
|
|
@@ -19553,7 +19720,7 @@ var ServiceRuntimeRunner = class {
|
|
|
19553
19720
|
const serverAddress = await resolveServerAddress(server);
|
|
19554
19721
|
const templateName = exposeType === "websocket" ? "nginx.ws.template" : exposeType === "mixed" ? "nginx.mixed.template" : "nginx.rest.template";
|
|
19555
19722
|
const templatePath = this.resolveTemplatePath(templateName);
|
|
19556
|
-
const template = (0,
|
|
19723
|
+
const template = (0, import_node_fs22.readFileSync)(templatePath, "utf8");
|
|
19557
19724
|
const host = `${subdomain}.${("domain" in network ? network.domain?.trim() : void 0) || "pmate.chat"}`;
|
|
19558
19725
|
const rendered = template.replace(/\$\{\{PORT\}\}/g, String(port)).replace(/\$\{\{HOSTS\}\}/g, host).replace(/\$\{\{HOST\}\}/g, host);
|
|
19559
19726
|
const remotePath = `/etc/nginx/sites-enabled/${subdomain}.conf`;
|
|
@@ -19585,11 +19752,11 @@ var ServiceRuntimeRunner = class {
|
|
|
19585
19752
|
}
|
|
19586
19753
|
if (config.ensurePackageJson) {
|
|
19587
19754
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19588
|
-
const packageJsonPath =
|
|
19589
|
-
if (!(0,
|
|
19755
|
+
const packageJsonPath = import_node_path27.default.join(appDir, "package.json");
|
|
19756
|
+
if (!(0, import_node_fs22.existsSync)(packageJsonPath)) {
|
|
19590
19757
|
throw new Error(`Missing package.json at ${packageJsonPath}`);
|
|
19591
19758
|
}
|
|
19592
|
-
const pkgStat = (0,
|
|
19759
|
+
const pkgStat = (0, import_node_fs22.statSync)(packageJsonPath);
|
|
19593
19760
|
if (!pkgStat.isFile()) {
|
|
19594
19761
|
throw new Error(`package.json is not a file at ${packageJsonPath}`);
|
|
19595
19762
|
}
|
|
@@ -19631,35 +19798,19 @@ var ServiceRuntimeRunner = class {
|
|
|
19631
19798
|
await this.runRemoteCommand(server, command);
|
|
19632
19799
|
}
|
|
19633
19800
|
async fetchLogPage(namespace, appName, options) {
|
|
19634
|
-
|
|
19635
|
-
|
|
19636
|
-
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
|
|
19640
|
-
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
|
|
19644
|
-
|
|
19645
|
-
|
|
19646
|
-
const response = await fetch(url.toString(), {
|
|
19647
|
-
method: "GET",
|
|
19648
|
-
headers: { Accept: "application/json" }
|
|
19801
|
+
resolveLogChainId();
|
|
19802
|
+
return await queryDeveloperLogs({
|
|
19803
|
+
service: `${namespace}:${appName}`,
|
|
19804
|
+
page: options.page,
|
|
19805
|
+
keyword: options.search,
|
|
19806
|
+
topic: options.topic,
|
|
19807
|
+
type: options.logType,
|
|
19808
|
+
level: options.level,
|
|
19809
|
+
source: options.source,
|
|
19810
|
+
requestId: options.requestId,
|
|
19811
|
+
environment: options.envName,
|
|
19812
|
+
sinceMs: options.sinceMs
|
|
19649
19813
|
});
|
|
19650
|
-
const payload = await response.json();
|
|
19651
|
-
if (response.status === 404 && /resource not found/i.test(payload.message || "")) {
|
|
19652
|
-
return {
|
|
19653
|
-
page: options.page,
|
|
19654
|
-
totalPage: 0,
|
|
19655
|
-
pageSize: 100,
|
|
19656
|
-
data: []
|
|
19657
|
-
};
|
|
19658
|
-
}
|
|
19659
|
-
if (!response.ok || !payload.success || !payload.data) {
|
|
19660
|
-
throw new Error(payload.message || `Log request failed: ${response.status}`);
|
|
19661
|
-
}
|
|
19662
|
-
return payload.data;
|
|
19663
19814
|
}
|
|
19664
19815
|
envNameToStage(envName) {
|
|
19665
19816
|
if (envName === "dev" || envName === "preview" || envName === "prod") {
|
|
@@ -19685,8 +19836,8 @@ var ServiceRuntimeRunner = class {
|
|
|
19685
19836
|
const type = isErrorLike ? import_chalk3.default.bold.red(`[${item.type}]`) : import_chalk3.default.bold.blue(`[${item.type}]`);
|
|
19686
19837
|
const level = resolvedLevel ? `${isErrorLike ? import_chalk3.default.bold.red(resolvedLevel.toUpperCase()) : import_chalk3.default.bold.yellow(resolvedLevel.toUpperCase())} ` : "";
|
|
19687
19838
|
const data = this.formatLogData(item.data);
|
|
19688
|
-
const hash = import_chalk3.default.gray(`#${item.hash}`);
|
|
19689
|
-
return `${ts} ${level}${type} ${data} ${hash}`;
|
|
19839
|
+
const hash = import_chalk3.default.gray(`#${item.id ?? item.hash}`);
|
|
19840
|
+
return `${ts} ${level}${type} ${item.source ?? ""} ${item.message ?? ""} ${data} ${hash}`;
|
|
19690
19841
|
}
|
|
19691
19842
|
formatLogData(value) {
|
|
19692
19843
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -20018,9 +20169,9 @@ var ServiceRuntimeRunner = class {
|
|
|
20018
20169
|
return tokens;
|
|
20019
20170
|
}
|
|
20020
20171
|
readPathValue(source, pathExpr) {
|
|
20021
|
-
const
|
|
20172
|
+
const path32 = pathExpr.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
20022
20173
|
let cursor = source;
|
|
20023
|
-
for (const segment of
|
|
20174
|
+
for (const segment of path32) {
|
|
20024
20175
|
if (!cursor || typeof cursor !== "object" || Array.isArray(cursor)) {
|
|
20025
20176
|
return void 0;
|
|
20026
20177
|
}
|
|
@@ -20063,12 +20214,12 @@ var ServiceRuntimeRunner = class {
|
|
|
20063
20214
|
}
|
|
20064
20215
|
resolveTemplatePath(templateName) {
|
|
20065
20216
|
const candidates = [
|
|
20066
|
-
|
|
20067
|
-
|
|
20068
|
-
|
|
20217
|
+
import_node_path27.default.join(__dirname, "..", "templates", templateName),
|
|
20218
|
+
import_node_path27.default.join(__dirname, "..", "src", "templates", templateName),
|
|
20219
|
+
import_node_path27.default.join(__dirname, "templates", templateName)
|
|
20069
20220
|
];
|
|
20070
20221
|
for (const candidate of candidates) {
|
|
20071
|
-
if ((0,
|
|
20222
|
+
if ((0, import_node_fs22.existsSync)(candidate)) {
|
|
20072
20223
|
return candidate;
|
|
20073
20224
|
}
|
|
20074
20225
|
}
|
|
@@ -20077,7 +20228,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20077
20228
|
writeRemoteConfig(server, content, remotePath) {
|
|
20078
20229
|
return new Promise((resolve, reject) => {
|
|
20079
20230
|
const target = `pmate@${server}`;
|
|
20080
|
-
const child = (0,
|
|
20231
|
+
const child = (0, import_node_child_process11.spawn)("ssh", [target, "sudo", "tee", remotePath], {
|
|
20081
20232
|
stdio: ["pipe", "inherit", "inherit"]
|
|
20082
20233
|
});
|
|
20083
20234
|
child.on("error", reject);
|
|
@@ -20092,7 +20243,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20092
20243
|
reloadNginx(server) {
|
|
20093
20244
|
return new Promise((resolve, reject) => {
|
|
20094
20245
|
const target = `pmate@${server}`;
|
|
20095
|
-
const child = (0,
|
|
20246
|
+
const child = (0, import_node_child_process11.spawn)("ssh", [target, "sudo", "nginx", "-s", "reload"], {
|
|
20096
20247
|
stdio: ["ignore", "inherit", "inherit"]
|
|
20097
20248
|
});
|
|
20098
20249
|
child.on("error", reject);
|
|
@@ -20100,7 +20251,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20100
20251
|
});
|
|
20101
20252
|
}
|
|
20102
20253
|
loadPackageJson(packageJsonPath) {
|
|
20103
|
-
const raw = (0,
|
|
20254
|
+
const raw = (0, import_node_fs22.readFileSync)(packageJsonPath, "utf8");
|
|
20104
20255
|
const parsed = JSON.parse(raw);
|
|
20105
20256
|
if (!parsed || typeof parsed !== "object") {
|
|
20106
20257
|
throw new Error(`Invalid package.json at ${packageJsonPath}`);
|
|
@@ -20109,7 +20260,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20109
20260
|
}
|
|
20110
20261
|
writePackageJson(packageJsonPath, data) {
|
|
20111
20262
|
const serialized = JSON.stringify(data, null, 2);
|
|
20112
|
-
(0,
|
|
20263
|
+
(0, import_node_fs22.writeFileSync)(packageJsonPath, `${serialized}
|
|
20113
20264
|
`, "utf8");
|
|
20114
20265
|
}
|
|
20115
20266
|
validateFcConfig(service, fc) {
|
|
@@ -20136,8 +20287,8 @@ var ServiceRuntimeRunner = class {
|
|
|
20136
20287
|
}
|
|
20137
20288
|
}
|
|
20138
20289
|
async ensurePnpmWorkspaceRoot(repoRoot) {
|
|
20139
|
-
const workspacePath =
|
|
20140
|
-
if (!(0,
|
|
20290
|
+
const workspacePath = import_node_path27.default.join(repoRoot, "pnpm-workspace.yaml");
|
|
20291
|
+
if (!(0, import_node_fs22.existsSync)(workspacePath)) {
|
|
20141
20292
|
throw new Error(`Missing pnpm-workspace.yaml at ${workspacePath}`);
|
|
20142
20293
|
}
|
|
20143
20294
|
}
|
|
@@ -20211,16 +20362,16 @@ var ServiceRuntimeRunner = class {
|
|
|
20211
20362
|
if (!privateKeyPath) {
|
|
20212
20363
|
throw new Error("Missing ssl.prv in ~/.pmate/config.yaml.");
|
|
20213
20364
|
}
|
|
20214
|
-
if (!(0,
|
|
20365
|
+
if (!(0, import_node_fs22.existsSync)(certificatePath)) {
|
|
20215
20366
|
throw new Error(`SSL certificate file not found: ${certificatePath}`);
|
|
20216
20367
|
}
|
|
20217
|
-
if (!(0,
|
|
20368
|
+
if (!(0, import_node_fs22.existsSync)(privateKeyPath)) {
|
|
20218
20369
|
throw new Error(`SSL private key file not found: ${privateKeyPath}`);
|
|
20219
20370
|
}
|
|
20220
20371
|
return {
|
|
20221
20372
|
certName: host,
|
|
20222
|
-
certificate: (0,
|
|
20223
|
-
privateKey: (0,
|
|
20373
|
+
certificate: (0, import_node_fs22.readFileSync)(certificatePath, "utf8"),
|
|
20374
|
+
privateKey: (0, import_node_fs22.readFileSync)(privateKeyPath, "utf8")
|
|
20224
20375
|
};
|
|
20225
20376
|
}
|
|
20226
20377
|
resolveFcProtocol(fc, certConfig) {
|
|
@@ -20279,7 +20430,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20279
20430
|
}
|
|
20280
20431
|
runCommandWithEnv(command, args, cwd, env) {
|
|
20281
20432
|
return new Promise((resolve, reject) => {
|
|
20282
|
-
const child = (0,
|
|
20433
|
+
const child = (0, import_node_child_process11.spawn)(command, args, {
|
|
20283
20434
|
cwd,
|
|
20284
20435
|
stdio: "inherit",
|
|
20285
20436
|
env: { ...process.env, ...env ?? {} }
|
|
@@ -20290,7 +20441,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20290
20441
|
}
|
|
20291
20442
|
runShellCommand(command, cwd, env) {
|
|
20292
20443
|
return new Promise((resolve, reject) => {
|
|
20293
|
-
const child = (0,
|
|
20444
|
+
const child = (0, import_node_child_process11.spawn)(command, [], {
|
|
20294
20445
|
cwd,
|
|
20295
20446
|
stdio: "inherit",
|
|
20296
20447
|
shell: true,
|
|
@@ -20301,10 +20452,10 @@ var ServiceRuntimeRunner = class {
|
|
|
20301
20452
|
});
|
|
20302
20453
|
}
|
|
20303
20454
|
runRemoteCommand(server, command) {
|
|
20304
|
-
if (server === "local") return this.runCommandWithEnv("bash", ["-c", command],
|
|
20455
|
+
if (server === "local") return this.runCommandWithEnv("bash", ["-c", command], import_node_os12.default.homedir());
|
|
20305
20456
|
return new Promise((resolve, reject) => {
|
|
20306
20457
|
const target = `pmate@${server}`;
|
|
20307
|
-
const child = (0,
|
|
20458
|
+
const child = (0, import_node_child_process11.spawn)("ssh", buildSshBashArgs(target, command), { stdio: "inherit" });
|
|
20308
20459
|
child.on("error", reject);
|
|
20309
20460
|
child.on("close", (code) => code === 0 ? resolve() : reject(new Error(`ssh to ${server} exited with code ${code}`)));
|
|
20310
20461
|
});
|
|
@@ -20343,7 +20494,8 @@ var ServiceRuntimeRunner = class {
|
|
|
20343
20494
|
}
|
|
20344
20495
|
};
|
|
20345
20496
|
function resolveLogChainId(env = process.env) {
|
|
20346
|
-
|
|
20497
|
+
if (env.APP_LOG_CHAIN_ID && env.APP_LOG_CHAIN_ID !== "log") throw new Error("Logs require log chain");
|
|
20498
|
+
return "log";
|
|
20347
20499
|
}
|
|
20348
20500
|
function shellQuote2(value) {
|
|
20349
20501
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
@@ -20358,51 +20510,6 @@ function parseServiceRef(serviceId) {
|
|
|
20358
20510
|
|
|
20359
20511
|
// src/commands/ServiceCommandHandler.ts
|
|
20360
20512
|
init_namespacedRef();
|
|
20361
|
-
|
|
20362
|
-
// src/services/DeveloperLogsClient.ts
|
|
20363
|
-
init_sessionStore();
|
|
20364
|
-
init_namespacedRef();
|
|
20365
|
-
var appRef = "pmate:developers";
|
|
20366
|
-
async function queryDeveloperLogs(input, fetcher = fetch) {
|
|
20367
|
-
parseNamespacedRef(input.app, { entityLabel: "app ref" });
|
|
20368
|
-
parseNamespacedRef(input.service, { entityLabel: "service ref" });
|
|
20369
|
-
if (!Number.isSafeInteger(input.page) || input.page < 0) throw new Error("Invalid log page");
|
|
20370
|
-
if (input.sinceMs !== void 0 && (!Number.isSafeInteger(input.sinceMs) || input.sinceMs < 0)) throw new Error("Invalid log time");
|
|
20371
|
-
if (input.keyword && input.keyword.length > 256) throw new Error("Log search must be at most 256 characters");
|
|
20372
|
-
const session = readRequiredSession({ preferredApp: appRef, fallbackToActiveApp: true });
|
|
20373
|
-
if (Date.parse(session.expiresAt) <= Date.now() || !Number.isFinite(Date.parse(session.expiresAt)))
|
|
20374
|
-
throw new Error("Session expired. Run pmate login --app pmate:developers");
|
|
20375
|
-
async function request2(url, init) {
|
|
20376
|
-
let response;
|
|
20377
|
-
try {
|
|
20378
|
-
response = await fetcher(url, { ...init, redirect: "error", signal: AbortSignal.timeout(3e4) });
|
|
20379
|
-
} catch {
|
|
20380
|
-
throw new Error("Developers log request failed; no anonymous fallback was attempted");
|
|
20381
|
-
}
|
|
20382
|
-
if (!response.ok) throw new Error(`Developers log request failed (HTTP ${response.status}); check login, pmate:dev role and App-Service access`);
|
|
20383
|
-
let body;
|
|
20384
|
-
try {
|
|
20385
|
-
body = await response.json();
|
|
20386
|
-
} catch {
|
|
20387
|
-
throw new Error("Invalid Developers API response");
|
|
20388
|
-
}
|
|
20389
|
-
if (!body?.success) throw new Error("Developers API rejected the request");
|
|
20390
|
-
return body.data;
|
|
20391
|
-
}
|
|
20392
|
-
const exchanged = await request2("https://auth-api-v2.pmate.chat/session/exchange", {
|
|
20393
|
-
method: "POST",
|
|
20394
|
-
headers: { Authorization: `Bearer ${session.token}`, "Content-Type": "application/json" },
|
|
20395
|
-
body: JSON.stringify({ app: appRef })
|
|
20396
|
-
});
|
|
20397
|
-
if (exchanged?.session?.identity?.app !== appRef || exchanged.session.identity.accountId !== session.accountId || typeof exchanged.token !== "string" || !exchanged.token)
|
|
20398
|
-
throw new Error("Developers session identity mismatch");
|
|
20399
|
-
const params = new URLSearchParams({ app: input.app, service: input.service, page: String(input.page) });
|
|
20400
|
-
if (input.keyword) params.set("keyword", input.keyword);
|
|
20401
|
-
if (input.sinceMs !== void 0) params.set("sinceMs", String(input.sinceMs));
|
|
20402
|
-
return request2(`https://dev-api.pmate.chat/api/logs?${params}`, { headers: { Authorization: `Bearer ${exchanged.token}` } });
|
|
20403
|
-
}
|
|
20404
|
-
|
|
20405
|
-
// src/commands/ServiceCommandHandler.ts
|
|
20406
20513
|
var ServiceCommandHandler = class {
|
|
20407
20514
|
async handle(args) {
|
|
20408
20515
|
const baseUrl = this.resolveBaseUrl(args.baseUrl);
|
|
@@ -20600,7 +20707,7 @@ var ServiceCommandHandler = class {
|
|
|
20600
20707
|
}
|
|
20601
20708
|
case "log": {
|
|
20602
20709
|
if (args.app) {
|
|
20603
|
-
const result = await queryDeveloperLogs({ app: args.app, service: `${args.namespace}:${args.name}`, page: args.page, keyword: args.search, sinceMs: args.sinceMs });
|
|
20710
|
+
const result = await queryDeveloperLogs({ app: args.app, service: `${args.namespace}:${args.name}`, page: args.page, keyword: args.search, sinceMs: args.sinceMs, topic: args.topic, type: args.logType, level: args.level, source: args.source, requestId: args.requestId });
|
|
20604
20711
|
console.log(JSON.stringify(result, null, args.json ? void 0 : 2));
|
|
20605
20712
|
return;
|
|
20606
20713
|
}
|
|
@@ -20611,7 +20718,14 @@ var ServiceCommandHandler = class {
|
|
|
20611
20718
|
history: args.history,
|
|
20612
20719
|
search: args.search,
|
|
20613
20720
|
follow: args.follow,
|
|
20614
|
-
envName: args.env
|
|
20721
|
+
envName: args.env,
|
|
20722
|
+
topic: args.topic,
|
|
20723
|
+
level: args.level,
|
|
20724
|
+
source: args.source,
|
|
20725
|
+
requestId: args.requestId,
|
|
20726
|
+
logType: args.logType,
|
|
20727
|
+
sinceMs: args.sinceMs,
|
|
20728
|
+
json: args.json
|
|
20615
20729
|
});
|
|
20616
20730
|
return;
|
|
20617
20731
|
}
|
|
@@ -20733,7 +20847,7 @@ var ServiceCommandHandler = class {
|
|
|
20733
20847
|
format: "dotenv"
|
|
20734
20848
|
}
|
|
20735
20849
|
);
|
|
20736
|
-
const outputPath =
|
|
20850
|
+
const outputPath = import_node_path28.default.resolve(process.cwd(), args.output);
|
|
20737
20851
|
await (0, import_promises5.writeFile)(outputPath, payload.content, "utf8");
|
|
20738
20852
|
ui.success(`Wrote env file for ${args.appId} to ${outputPath}`);
|
|
20739
20853
|
this.renderJson({ ...payload, output: outputPath }, args.json);
|
|
@@ -20959,11 +21073,11 @@ var ServiceCommandHandler = class {
|
|
|
20959
21073
|
return (baseUrl || process.env.PMATE_APPS_API_BASE_URL || "https://apps-api.pmate.chat").replace(/\/+$/, "");
|
|
20960
21074
|
}
|
|
20961
21075
|
readJsonFile(filePath) {
|
|
20962
|
-
const absolutePath =
|
|
20963
|
-
if (!(0,
|
|
21076
|
+
const absolutePath = import_node_path28.default.resolve(process.cwd(), filePath);
|
|
21077
|
+
if (!(0, import_node_fs23.existsSync)(absolutePath)) {
|
|
20964
21078
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
20965
21079
|
}
|
|
20966
|
-
const raw = (0,
|
|
21080
|
+
const raw = (0, import_node_fs23.readFileSync)(absolutePath, "utf8");
|
|
20967
21081
|
try {
|
|
20968
21082
|
return JSON.parse(raw);
|
|
20969
21083
|
} catch (error) {
|
|
@@ -21487,7 +21601,7 @@ var ServiceCommandHandler = class {
|
|
|
21487
21601
|
removeRemoteConfig(server, remotePath) {
|
|
21488
21602
|
return new Promise((resolve, reject) => {
|
|
21489
21603
|
const target = `pmate@${server}`;
|
|
21490
|
-
const child = (0,
|
|
21604
|
+
const child = (0, import_node_child_process12.spawn)("ssh", [target, "sudo", "rm", "-f", remotePath], {
|
|
21491
21605
|
stdio: ["ignore", "inherit", "inherit"]
|
|
21492
21606
|
});
|
|
21493
21607
|
child.on("error", (error) => {
|
|
@@ -21505,7 +21619,7 @@ var ServiceCommandHandler = class {
|
|
|
21505
21619
|
reloadNginx(server) {
|
|
21506
21620
|
return new Promise((resolve, reject) => {
|
|
21507
21621
|
const target = `pmate@${server}`;
|
|
21508
|
-
const child = (0,
|
|
21622
|
+
const child = (0, import_node_child_process12.spawn)("ssh", [target, "sudo", "nginx", "-s", "reload"], {
|
|
21509
21623
|
stdio: ["ignore", "inherit", "inherit"]
|
|
21510
21624
|
});
|
|
21511
21625
|
child.on("error", (error) => {
|
|
@@ -21578,9 +21692,9 @@ function sleep3(ms) {
|
|
|
21578
21692
|
}
|
|
21579
21693
|
|
|
21580
21694
|
// src/commands/VercelCommandHandler.ts
|
|
21581
|
-
var
|
|
21695
|
+
var import_node_child_process13 = require("child_process");
|
|
21582
21696
|
var import_node_util = require("util");
|
|
21583
|
-
var execFileAsync = (0, import_node_util.promisify)(
|
|
21697
|
+
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process13.execFile);
|
|
21584
21698
|
function parseDeploymentTimestamp(deployment) {
|
|
21585
21699
|
const candidates = [deployment.createdAt, deployment.readyAt, deployment.ready];
|
|
21586
21700
|
for (const value of candidates) {
|
|
@@ -21771,9 +21885,9 @@ var RoleCommandHandler = class {
|
|
|
21771
21885
|
};
|
|
21772
21886
|
|
|
21773
21887
|
// src/commands/AccountCommandHandler.ts
|
|
21774
|
-
var
|
|
21775
|
-
var
|
|
21776
|
-
var
|
|
21888
|
+
var import_node_fs24 = require("fs");
|
|
21889
|
+
var import_node_crypto6 = require("crypto");
|
|
21890
|
+
var import_node_path29 = __toESM(require("path"));
|
|
21777
21891
|
init_sessionStore();
|
|
21778
21892
|
var AccountCommandHandler = class {
|
|
21779
21893
|
async handle(args) {
|
|
@@ -21781,9 +21895,9 @@ var AccountCommandHandler = class {
|
|
|
21781
21895
|
case "bot-keygen": {
|
|
21782
21896
|
const keyFile = this.generateBotKeyFile(args.app, args.name);
|
|
21783
21897
|
const outPath = args.out ? this.resolveFilePath(args.out) : this.resolveDefaultBotKeyPath(args.app, args.name);
|
|
21784
|
-
(0,
|
|
21785
|
-
(0,
|
|
21786
|
-
(0,
|
|
21898
|
+
(0, import_node_fs24.mkdirSync)(import_node_path29.default.dirname(outPath), { recursive: true });
|
|
21899
|
+
(0, import_node_fs24.writeFileSync)(outPath, JSON.stringify(keyFile, null, 2), { mode: 384 });
|
|
21900
|
+
(0, import_node_fs24.chmodSync)(outPath, 384);
|
|
21787
21901
|
if (!args.json) {
|
|
21788
21902
|
ui.success(`Bot key saved to ${outPath}`);
|
|
21789
21903
|
}
|
|
@@ -22343,10 +22457,10 @@ var AccountCommandHandler = class {
|
|
|
22343
22457
|
throw new Error("Missing visible apps input");
|
|
22344
22458
|
}
|
|
22345
22459
|
const absolutePath = this.resolveFilePath(args.filePath);
|
|
22346
|
-
if (!(0,
|
|
22460
|
+
if (!(0, import_node_fs24.existsSync)(absolutePath)) {
|
|
22347
22461
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
22348
22462
|
}
|
|
22349
|
-
const raw = (0,
|
|
22463
|
+
const raw = (0, import_node_fs24.readFileSync)(absolutePath, "utf8");
|
|
22350
22464
|
let parsed;
|
|
22351
22465
|
try {
|
|
22352
22466
|
parsed = JSON.parse(raw);
|
|
@@ -22360,19 +22474,19 @@ var AccountCommandHandler = class {
|
|
|
22360
22474
|
return parsed;
|
|
22361
22475
|
}
|
|
22362
22476
|
resolveFilePath(filePath) {
|
|
22363
|
-
return
|
|
22477
|
+
return import_node_path29.default.resolve(process.cwd(), filePath);
|
|
22364
22478
|
}
|
|
22365
22479
|
resolveDefaultBotKeyPath(app, name) {
|
|
22366
|
-
return
|
|
22480
|
+
return import_node_path29.default.join(this.homeDir(), ".pmate", "bots", app, `${name}.bot-key.json`);
|
|
22367
22481
|
}
|
|
22368
22482
|
resolveDefaultAccessKeyPath(app, name) {
|
|
22369
|
-
return
|
|
22483
|
+
return import_node_path29.default.join(this.homeDir(), ".pmate", "access-keys", app, `${name}.access-key.json`);
|
|
22370
22484
|
}
|
|
22371
22485
|
homeDir() {
|
|
22372
22486
|
return process.env.HOME || process.env.USERPROFILE || process.cwd();
|
|
22373
22487
|
}
|
|
22374
22488
|
generateBotKeyFile(app, name) {
|
|
22375
|
-
const { publicKey, privateKey } = (0,
|
|
22489
|
+
const { publicKey, privateKey } = (0, import_node_crypto6.generateKeyPairSync)("ed25519");
|
|
22376
22490
|
return {
|
|
22377
22491
|
type: "pmate-bot-key",
|
|
22378
22492
|
version: 1,
|
|
@@ -22386,14 +22500,14 @@ var AccountCommandHandler = class {
|
|
|
22386
22500
|
}
|
|
22387
22501
|
renameDefaultBotKeyFile(app, name, newName) {
|
|
22388
22502
|
const oldPath = this.resolveDefaultBotKeyPath(app, name);
|
|
22389
|
-
if (!(0,
|
|
22503
|
+
if (!(0, import_node_fs24.existsSync)(oldPath)) {
|
|
22390
22504
|
return void 0;
|
|
22391
22505
|
}
|
|
22392
22506
|
const keyFile = this.readBotKeyFile(oldPath, app, name);
|
|
22393
22507
|
const newPath = this.resolveDefaultBotKeyPath(app, newName);
|
|
22394
|
-
(0,
|
|
22395
|
-
(0,
|
|
22396
|
-
(0,
|
|
22508
|
+
(0, import_node_fs24.mkdirSync)(import_node_path29.default.dirname(newPath), { recursive: true, mode: 448 });
|
|
22509
|
+
(0, import_node_fs24.writeFileSync)(newPath, JSON.stringify({ ...keyFile, name: newName }, null, 2));
|
|
22510
|
+
(0, import_node_fs24.chmodSync)(newPath, 384);
|
|
22397
22511
|
return newPath;
|
|
22398
22512
|
}
|
|
22399
22513
|
readBotKeyFile(filePath, expectedApp, expectedName) {
|
|
@@ -22401,10 +22515,10 @@ var AccountCommandHandler = class {
|
|
|
22401
22515
|
throw new Error("Missing bot key file");
|
|
22402
22516
|
}
|
|
22403
22517
|
const absolutePath = this.resolveFilePath(filePath);
|
|
22404
|
-
if (!(0,
|
|
22518
|
+
if (!(0, import_node_fs24.existsSync)(absolutePath)) {
|
|
22405
22519
|
throw new Error(`Bot key file not found: ${absolutePath}`);
|
|
22406
22520
|
}
|
|
22407
|
-
const parsed = JSON.parse((0,
|
|
22521
|
+
const parsed = JSON.parse((0, import_node_fs24.readFileSync)(absolutePath, "utf8"));
|
|
22408
22522
|
if (parsed.type !== "pmate-bot-key" || parsed.version !== 1 || parsed.algorithm !== "ed25519" || !parsed.publicKey || !parsed.privateKey) {
|
|
22409
22523
|
throw new Error(`Invalid PMate bot key file: ${absolutePath}`);
|
|
22410
22524
|
}
|
|
@@ -22421,10 +22535,10 @@ var AccountCommandHandler = class {
|
|
|
22421
22535
|
throw new Error("Missing access key file");
|
|
22422
22536
|
}
|
|
22423
22537
|
const absolutePath = this.resolveFilePath(filePath);
|
|
22424
|
-
if (!(0,
|
|
22538
|
+
if (!(0, import_node_fs24.existsSync)(absolutePath)) {
|
|
22425
22539
|
throw new Error(`Access key file not found: ${absolutePath}`);
|
|
22426
22540
|
}
|
|
22427
|
-
const parsed = JSON.parse((0,
|
|
22541
|
+
const parsed = JSON.parse((0, import_node_fs24.readFileSync)(absolutePath, "utf8"));
|
|
22428
22542
|
if (parsed.type !== "pmate-access-key" || parsed.version !== 1 || !parsed.id || !parsed.app || !parsed.secret || !parsed.expiresAt) {
|
|
22429
22543
|
throw new Error(`Invalid PMate access key file: ${absolutePath}`);
|
|
22430
22544
|
}
|
|
@@ -22446,9 +22560,9 @@ var AccountCommandHandler = class {
|
|
|
22446
22560
|
createdAt: result.key.createdAt
|
|
22447
22561
|
};
|
|
22448
22562
|
const outPath = out ? this.resolveFilePath(out) : this.resolveDefaultAccessKeyPath(result.key.app, result.key.name);
|
|
22449
|
-
(0,
|
|
22450
|
-
(0,
|
|
22451
|
-
(0,
|
|
22563
|
+
(0, import_node_fs24.mkdirSync)(import_node_path29.default.dirname(outPath), { recursive: true });
|
|
22564
|
+
(0, import_node_fs24.writeFileSync)(outPath, JSON.stringify(keyFile, null, 2), { mode: 384 });
|
|
22565
|
+
(0, import_node_fs24.chmodSync)(outPath, 384);
|
|
22452
22566
|
}
|
|
22453
22567
|
renderAccessKeyCreateResult(result, asJson, out) {
|
|
22454
22568
|
if (asJson) {
|
|
@@ -22494,12 +22608,12 @@ var AccountCommandHandler = class {
|
|
|
22494
22608
|
});
|
|
22495
22609
|
}
|
|
22496
22610
|
signBotChallenge(challenge, privateKey) {
|
|
22497
|
-
const key = (0,
|
|
22611
|
+
const key = (0, import_node_crypto6.createPrivateKey)({
|
|
22498
22612
|
key: Buffer.from(privateKey, "base64url"),
|
|
22499
22613
|
format: "der",
|
|
22500
22614
|
type: "pkcs8"
|
|
22501
22615
|
});
|
|
22502
|
-
return (0,
|
|
22616
|
+
return (0, import_node_crypto6.sign)(
|
|
22503
22617
|
null,
|
|
22504
22618
|
Buffer.from(JSON.stringify({
|
|
22505
22619
|
id: challenge.id,
|
|
@@ -22533,8 +22647,8 @@ function encodePathSegment2(value) {
|
|
|
22533
22647
|
}
|
|
22534
22648
|
|
|
22535
22649
|
// src/commands/OrgCommandHandler.ts
|
|
22536
|
-
var
|
|
22537
|
-
var
|
|
22650
|
+
var import_node_fs25 = require("fs");
|
|
22651
|
+
var import_node_path30 = __toESM(require("path"));
|
|
22538
22652
|
init_sessionStore();
|
|
22539
22653
|
var OrgCommandHandler = class {
|
|
22540
22654
|
async handle(args) {
|
|
@@ -22704,11 +22818,11 @@ var OrgCommandHandler = class {
|
|
|
22704
22818
|
if (!filePath) {
|
|
22705
22819
|
throw new Error(`Missing ${itemLabel} input`);
|
|
22706
22820
|
}
|
|
22707
|
-
const absolutePath =
|
|
22708
|
-
if (!(0,
|
|
22821
|
+
const absolutePath = import_node_path30.default.resolve(process.cwd(), filePath);
|
|
22822
|
+
if (!(0, import_node_fs25.existsSync)(absolutePath)) {
|
|
22709
22823
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
22710
22824
|
}
|
|
22711
|
-
const raw = (0,
|
|
22825
|
+
const raw = (0, import_node_fs25.readFileSync)(absolutePath, "utf8");
|
|
22712
22826
|
let parsed;
|
|
22713
22827
|
try {
|
|
22714
22828
|
parsed = JSON.parse(raw);
|
|
@@ -22779,10 +22893,10 @@ function encodePathSegment3(value) {
|
|
|
22779
22893
|
}
|
|
22780
22894
|
|
|
22781
22895
|
// src/commands/HostCommandHandler.ts
|
|
22782
|
-
var
|
|
22783
|
-
var
|
|
22784
|
-
var
|
|
22785
|
-
var
|
|
22896
|
+
var import_node_fs26 = require("fs");
|
|
22897
|
+
var import_node_os13 = require("os");
|
|
22898
|
+
var import_node_path31 = __toESM(require("path"));
|
|
22899
|
+
var import_node_child_process14 = require("child_process");
|
|
22786
22900
|
var BLOCK_START = "# >>> pmate host env >>>";
|
|
22787
22901
|
var BLOCK_END = "# <<< pmate host env <<<";
|
|
22788
22902
|
var PROFILE_BLOCK = `${BLOCK_START}
|
|
@@ -22794,7 +22908,7 @@ fi
|
|
|
22794
22908
|
${BLOCK_END}`;
|
|
22795
22909
|
var HostCommandHandler = class {
|
|
22796
22910
|
async handle(args) {
|
|
22797
|
-
const hostId = normalizeHostId(args.host ?? process.env.PMATE_HOST_ID ?? (0,
|
|
22911
|
+
const hostId = normalizeHostId(args.host ?? process.env.PMATE_HOST_ID ?? (0, import_node_os13.hostname)());
|
|
22798
22912
|
const client = new ServiceRegistryClient(args.baseUrl);
|
|
22799
22913
|
if (args.action === "env-list") {
|
|
22800
22914
|
const items = await client.listHostEnv(hostId);
|
|
@@ -22825,7 +22939,7 @@ async function applyHostEnvRemote(host, values) {
|
|
|
22825
22939
|
const content = serializeHostEnv(values);
|
|
22826
22940
|
const script = buildRemoteApplyScript(Buffer.from(content, "utf8").toString("base64"));
|
|
22827
22941
|
await new Promise((resolve, reject) => {
|
|
22828
|
-
const child = (0,
|
|
22942
|
+
const child = (0, import_node_child_process14.spawn)("ssh", [target, "bash -s"], { stdio: ["pipe", "pipe", "pipe"] });
|
|
22829
22943
|
let stdout = "";
|
|
22830
22944
|
let stderr = "";
|
|
22831
22945
|
child.stdout.on("data", (chunk) => {
|
|
@@ -23288,6 +23402,26 @@ function parseAppArgs(tokens) {
|
|
|
23288
23402
|
if (!action) {
|
|
23289
23403
|
throw new Error("Missing app action. Use: app list|get|view|create|update|rename|move|icon|delete");
|
|
23290
23404
|
}
|
|
23405
|
+
if (action === "build") {
|
|
23406
|
+
const id = parseNamespacedRef(rest.shift() ?? "", { entityLabel: "app ref" }).fullId;
|
|
23407
|
+
const options = {};
|
|
23408
|
+
const switches = /* @__PURE__ */ new Set();
|
|
23409
|
+
while (rest.length) {
|
|
23410
|
+
const key = rest.shift();
|
|
23411
|
+
if (["--dry-run", "--signed", "--dir", "--json"].includes(key)) {
|
|
23412
|
+
if (switches.has(key)) throw new Error(`Duplicate option: ${key}`);
|
|
23413
|
+
switches.add(key);
|
|
23414
|
+
} else if (["--target", "--config", "--platform", "--arch", "--out-dir"].includes(key)) {
|
|
23415
|
+
if (options[key]) throw new Error(`Duplicate option: ${key}`);
|
|
23416
|
+
options[key] = requireValue3(rest, key);
|
|
23417
|
+
} else throw new Error(`Unknown app build option: ${key}`);
|
|
23418
|
+
}
|
|
23419
|
+
if (options["--target"] !== "electron" || !options["--config"]) throw new Error("Use app build <ns:app> --target electron --config <file>");
|
|
23420
|
+
const platform = options["--platform"] ?? (process.platform === "darwin" ? "mac" : process.platform);
|
|
23421
|
+
const arch = options["--arch"] ?? process.arch;
|
|
23422
|
+
if (platform !== "mac" || !["arm64", "x64"].includes(arch)) throw new Error("Supported target: --platform mac --arch arm64|x64");
|
|
23423
|
+
return { type: "app" /* App */, action, id, target: "electron", config: options["--config"], platform, arch, outDir: options["--out-dir"] ?? "release/desktop", dryRun: switches.has("--dry-run"), signed: switches.has("--signed"), dir: switches.has("--dir"), json: switches.has("--json") };
|
|
23424
|
+
}
|
|
23291
23425
|
let baseUrl;
|
|
23292
23426
|
let json = false;
|
|
23293
23427
|
const takeSharedOptions4 = () => {
|
|
@@ -23862,6 +23996,7 @@ function parseServiceArgs(tokens) {
|
|
|
23862
23996
|
let page = 0;
|
|
23863
23997
|
let app;
|
|
23864
23998
|
let sinceMs;
|
|
23999
|
+
const logFilters = {};
|
|
23865
24000
|
let history = false;
|
|
23866
24001
|
let search;
|
|
23867
24002
|
let follow = false;
|
|
@@ -23869,6 +24004,26 @@ function parseServiceArgs(tokens) {
|
|
|
23869
24004
|
while (rest.length > 0) {
|
|
23870
24005
|
const token = rest.shift();
|
|
23871
24006
|
switch (token) {
|
|
24007
|
+
case "--topic":
|
|
24008
|
+
case "--level":
|
|
24009
|
+
case "--source":
|
|
24010
|
+
case "--request-id":
|
|
24011
|
+
case "--type": {
|
|
24012
|
+
if (action !== "log") throw new Error(`Unknown service ${action} option: ${token}`);
|
|
24013
|
+
const value = requireValue4(rest, token);
|
|
24014
|
+
if (token === "--topic") {
|
|
24015
|
+
if (value !== "app" && value !== "runtime") throw new Error("Invalid --topic");
|
|
24016
|
+
logFilters.topic = value;
|
|
24017
|
+
} else if (token === "--level") {
|
|
24018
|
+
if (!["debug", "info", "warn", "error"].includes(value)) throw new Error("Invalid --level");
|
|
24019
|
+
logFilters.level = value;
|
|
24020
|
+
} else if (token === "--source") {
|
|
24021
|
+
if (!["pm2", "nginx", "application", "deployment"].includes(value)) throw new Error("Invalid --source");
|
|
24022
|
+
logFilters.source = value;
|
|
24023
|
+
} else if (token === "--request-id") logFilters.requestId = value;
|
|
24024
|
+
else logFilters.logType = value;
|
|
24025
|
+
break;
|
|
24026
|
+
}
|
|
23872
24027
|
case "--app":
|
|
23873
24028
|
if (action !== "log") throw new Error(`Unknown service ${action} option: ${token}`);
|
|
23874
24029
|
app = parseNamespacedRef(requireValue4(rest, token), { entityLabel: "app ref" }).fullId;
|
|
@@ -23919,8 +24074,7 @@ function parseServiceArgs(tokens) {
|
|
|
23919
24074
|
const name = parsedRef.objectId;
|
|
23920
24075
|
if (action === "log") {
|
|
23921
24076
|
if (app && (history || follow || env || baseUrl)) throw new Error("App logs do not support --history, --follow, --env or --base-url; use --page, --search and --since-ms");
|
|
23922
|
-
|
|
23923
|
-
return { type: "service" /* Service */, action, namespace, name, baseUrl, json, page, history, search, follow, env, ...app ? { app } : {}, ...sinceMs !== void 0 ? { sinceMs } : {} };
|
|
24077
|
+
return { type: "service" /* Service */, action, namespace, name, baseUrl, json, page, history, search, follow, env, ...logFilters, ...app ? { app } : {}, ...sinceMs !== void 0 ? { sinceMs } : {} };
|
|
23924
24078
|
}
|
|
23925
24079
|
if (action === "deploy-logs" || action === "deploy-history") {
|
|
23926
24080
|
return { type: "service" /* Service */, action, namespace, name, env, page, baseUrl, json };
|
|
@@ -25990,7 +26144,7 @@ function requireValue11(tokens, option) {
|
|
|
25990
26144
|
|
|
25991
26145
|
// src/index.ts
|
|
25992
26146
|
var pkg = JSON.parse(
|
|
25993
|
-
(0,
|
|
26147
|
+
(0, import_node_fs27.readFileSync)(import_node_path32.default.resolve(__dirname, "..", "package.json"), "utf8")
|
|
25994
26148
|
);
|
|
25995
26149
|
var HELP_TEXT = [
|
|
25996
26150
|
import_chalk4.default.bold(`pmate v${pkg.version}`),
|
|
@@ -26138,6 +26292,7 @@ var HELP_TEXT = [
|
|
|
26138
26292
|
` ${import_chalk4.default.gray(" kv list|get|exists|set|delete <name> [options]")}`,
|
|
26139
26293
|
` ${import_chalk4.default.gray(" defaults: chain=pmate namespace=pmate env base URLs from BLOCKCHAIN_BASE_URL / INDEXER_BASE_URL")}`,
|
|
26140
26294
|
` ${import_chalk4.default.cyan("app")} Manage app registry entries via apps-api`,
|
|
26295
|
+
` ${import_chalk4.default.gray(" build <ns:app> --target electron --config <file> [--platform mac] [--arch arm64|x64] [--out-dir <dir>] [--dir] [--dry-run] [--signed]")}`,
|
|
26141
26296
|
` ${import_chalk4.default.gray(" list [--ns <namespace>] [--all] [--base-url <url>] [--json]")}`,
|
|
26142
26297
|
` ${import_chalk4.default.gray(" get <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
26143
26298
|
` ${import_chalk4.default.gray(" view <ns:objectId> [--base-url <url>]")}`,
|
|
@@ -26166,7 +26321,7 @@ var HELP_TEXT = [
|
|
|
26166
26321
|
` ${import_chalk4.default.gray(" init <ns:objectId> [--cwd <dir>] [--base-url <url>]")}`,
|
|
26167
26322
|
` ${import_chalk4.default.gray(" ssl set <ns:objectId> --cert <key> [--base-url <url>] [--json]")}`,
|
|
26168
26323
|
` ${import_chalk4.default.gray(" ssl refresh <ns:objectId> [--cert <key>] [--dry-run] [--base-url <url>] [--json]")}`,
|
|
26169
|
-
` ${import_chalk4.default.gray(" log <ns:objectId> [--
|
|
26324
|
+
` ${import_chalk4.default.gray(" log <ns:objectId> [--topic app|runtime] [--env <env>] [--level <level>] [--source <source>] [--type <type>] [--request-id <id>] [--search <keyword>] [--since-ms <ms>] [--page <n>] [--follow|-f] [--json]")}`,
|
|
26170
26325
|
` ${import_chalk4.default.gray(" default base URL: https://apps-api.pmate.chat")}`,
|
|
26171
26326
|
` ${import_chalk4.default.cyan("host")} Manage host-level environment variables`,
|
|
26172
26327
|
` ${import_chalk4.default.gray(" env list [--host <id>] [--json]")}`,
|