@pmate/cli 0.30.1 → 0.31.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 +29 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +655 -497
- 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
|
@@ -88,7 +88,7 @@ var init_namespacedRef = __esm({
|
|
|
88
88
|
|
|
89
89
|
// src/sessionStore.ts
|
|
90
90
|
function buildSessionStorePath() {
|
|
91
|
-
return process.env.PMATE_SESSION_FILE?.trim() ||
|
|
91
|
+
return process.env.PMATE_SESSION_FILE?.trim() || import_node_path5.default.join(import_node_os4.default.homedir(), ".pmate", "session.json");
|
|
92
92
|
}
|
|
93
93
|
function assertValidAppRef(appRef2) {
|
|
94
94
|
return parseNamespacedRef(appRef2, { entityLabel: "app ref" }).fullId;
|
|
@@ -265,7 +265,7 @@ function resolveReadApp(store, options) {
|
|
|
265
265
|
}
|
|
266
266
|
function writeSessionStore(store) {
|
|
267
267
|
const sessionPath = buildSessionStorePath();
|
|
268
|
-
(0, import_node_fs4.mkdirSync)(
|
|
268
|
+
(0, import_node_fs4.mkdirSync)(import_node_path5.default.dirname(sessionPath), { recursive: true });
|
|
269
269
|
(0, import_node_fs4.writeFileSync)(sessionPath, JSON.stringify(store, null, 2), {
|
|
270
270
|
mode: 384
|
|
271
271
|
});
|
|
@@ -280,194 +280,194 @@ function buildMissingSessionMessage(sessionPath, app) {
|
|
|
280
280
|
}
|
|
281
281
|
return `Missing session for app ${app} in ${sessionPath}. Run "pmate login --app ${app}" first.`;
|
|
282
282
|
}
|
|
283
|
-
var import_node_fs4,
|
|
283
|
+
var import_node_fs4, import_node_os4, import_node_path5, DEFAULT_APP_ID, SESSION_STORE_VERSION;
|
|
284
284
|
var init_sessionStore = __esm({
|
|
285
285
|
"src/sessionStore.ts"() {
|
|
286
286
|
"use strict";
|
|
287
287
|
import_node_fs4 = require("fs");
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
import_node_os4 = __toESM(require("os"));
|
|
289
|
+
import_node_path5 = __toESM(require("path"));
|
|
290
290
|
init_namespacedRef();
|
|
291
291
|
DEFAULT_APP_ID = "pmate:factory";
|
|
292
292
|
SESSION_STORE_VERSION = 4;
|
|
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,12 +8818,33 @@ __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");
|
|
8826
|
+
var import_node_os = require("os");
|
|
8827
|
+
var import_node_path = require("path");
|
|
8826
8828
|
async function ensureManagedSession(env = process.env, fetcher = fetch) {
|
|
8829
|
+
if (env.HEBO_MEMORY_TOKEN?.trim()) {
|
|
8830
|
+
const token = env.HEBO_MEMORY_TOKEN.trim(), app = "pmate:factory";
|
|
8831
|
+
const base = (env.AUTH_API_BASE_URL ?? "https://auth-api-v2.pmate.chat").replace(/\/+$/, "");
|
|
8832
|
+
const headers = { authorization: `Bearer ${token}` };
|
|
8833
|
+
const r2 = await fetcher(`${base}/session?app=${encodeURIComponent(app)}`, { headers, signal: AbortSignal.timeout(15e3) });
|
|
8834
|
+
const body = await r2.json(), session = body.data;
|
|
8835
|
+
if (!r2.ok || !body.success || session?.identity?.app !== app || !session.identity.accountId || !session.issuedAt || !Number.isFinite(Date.parse(session.expiresAt)) || Date.parse(session.expiresAt) <= Date.now()) throw Error("Delegated user session is invalid or expired");
|
|
8836
|
+
const pr = await fetcher(`${base}/profiles?app=${encodeURIComponent(app)}&account=${encodeURIComponent(session.identity.accountId)}`, { headers, signal: AbortSignal.timeout(15e3) });
|
|
8837
|
+
const profiles = await pr.json(), profileId = profiles.data?.[0]?.id;
|
|
8838
|
+
if (!pr.ok || !profiles.success || !profileId) throw Error("Delegated user profile unavailable");
|
|
8839
|
+
const dir = (0, import_node_fs.mkdtempSync)((0, import_node_path.join)((0, import_node_os.tmpdir)(), "pmate-delegated-")), file = (0, import_node_path.join)(dir, "session.json");
|
|
8840
|
+
(0, import_node_fs.writeFileSync)(file, JSON.stringify({ version: 4, activeAppRef: app, sessions: { [app]: { token, accountId: session.identity.accountId, profileId, issuedAt: session.issuedAt, expiresAt: session.expiresAt, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } } }), { mode: 384 });
|
|
8841
|
+
env.PMATE_SESSION_FILE = file;
|
|
8842
|
+
env.PCS_AGENT_SESSION_MANAGED = "0";
|
|
8843
|
+
process.once("exit", () => {
|
|
8844
|
+
(0, import_node_fs.rmSync)(dir, { recursive: true, force: true });
|
|
8845
|
+
});
|
|
8846
|
+
return;
|
|
8847
|
+
}
|
|
8827
8848
|
if (env.PCS_AGENT_SESSION_MANAGED !== "1") return;
|
|
8828
8849
|
if (!env.PMATE_SESSION_FILE) throw Error("Managed session file is required");
|
|
8829
8850
|
const state = JSON.parse((0, import_node_fs.readFileSync)(env.PMATE_SESSION_FILE, "utf8"));
|
|
@@ -8881,12 +8902,12 @@ var ui = {
|
|
|
8881
8902
|
};
|
|
8882
8903
|
|
|
8883
8904
|
// src/commands/ListCommandHandler.ts
|
|
8884
|
-
var
|
|
8905
|
+
var import_node_path3 = __toESM(require("path"));
|
|
8885
8906
|
|
|
8886
8907
|
// src/config.ts
|
|
8887
8908
|
var import_node_fs2 = require("fs");
|
|
8888
|
-
var
|
|
8889
|
-
var
|
|
8909
|
+
var import_node_os2 = __toESM(require("os"));
|
|
8910
|
+
var import_node_path2 = __toESM(require("path"));
|
|
8890
8911
|
var import_ajv = __toESM(require("ajv"));
|
|
8891
8912
|
var import_yaml = __toESM(require("yaml"));
|
|
8892
8913
|
var cachedConfig;
|
|
@@ -9010,8 +9031,8 @@ function loadPmateConfig() {
|
|
|
9010
9031
|
if (cachedConfig !== void 0) {
|
|
9011
9032
|
return cachedConfig ?? {};
|
|
9012
9033
|
}
|
|
9013
|
-
const pmateDir =
|
|
9014
|
-
const yamlPath =
|
|
9034
|
+
const pmateDir = import_node_path2.default.join(import_node_os2.default.homedir(), ".pmate");
|
|
9035
|
+
const yamlPath = import_node_path2.default.join(pmateDir, "config.yaml");
|
|
9015
9036
|
let yamlConfig = null;
|
|
9016
9037
|
if ((0, import_node_fs2.existsSync)(yamlPath)) {
|
|
9017
9038
|
const raw = (0, import_node_fs2.readFileSync)(yamlPath, "utf8");
|
|
@@ -9076,11 +9097,11 @@ ${detail}`);
|
|
|
9076
9097
|
return value;
|
|
9077
9098
|
}
|
|
9078
9099
|
function findRepoConfigPaths(cwd, searchParents) {
|
|
9079
|
-
let current =
|
|
9100
|
+
let current = import_node_path2.default.resolve(cwd);
|
|
9080
9101
|
while (true) {
|
|
9081
|
-
const candidate =
|
|
9102
|
+
const candidate = import_node_path2.default.join(current, ".pmate.yaml");
|
|
9082
9103
|
if ((0, import_node_fs2.existsSync)(candidate)) {
|
|
9083
|
-
const localCandidate =
|
|
9104
|
+
const localCandidate = import_node_path2.default.join(current, ".pmate.local.yaml");
|
|
9084
9105
|
return {
|
|
9085
9106
|
rootDir: current,
|
|
9086
9107
|
configPath: candidate,
|
|
@@ -9090,7 +9111,7 @@ function findRepoConfigPaths(cwd, searchParents) {
|
|
|
9090
9111
|
if (!searchParents) {
|
|
9091
9112
|
return null;
|
|
9092
9113
|
}
|
|
9093
|
-
const parent =
|
|
9114
|
+
const parent = import_node_path2.default.dirname(current);
|
|
9094
9115
|
if (parent === current) {
|
|
9095
9116
|
return null;
|
|
9096
9117
|
}
|
|
@@ -9261,7 +9282,7 @@ var ListCommandHandler = class {
|
|
|
9261
9282
|
}
|
|
9262
9283
|
}
|
|
9263
9284
|
resolveTargetDir(targetPath) {
|
|
9264
|
-
return targetPath ?
|
|
9285
|
+
return targetPath ? import_node_path3.default.resolve(process.cwd(), targetPath) : process.cwd();
|
|
9265
9286
|
}
|
|
9266
9287
|
loadConfig(targetDir) {
|
|
9267
9288
|
return loadAppConfig(targetDir).config;
|
|
@@ -9270,14 +9291,14 @@ var ListCommandHandler = class {
|
|
|
9270
9291
|
|
|
9271
9292
|
// src/commands/LoginCommandHandler.ts
|
|
9272
9293
|
var import_node_child_process = require("child_process");
|
|
9273
|
-
var
|
|
9294
|
+
var import_node_path6 = __toESM(require("path"));
|
|
9274
9295
|
var import_node_http = require("http");
|
|
9275
9296
|
var import_promises = require("readline/promises");
|
|
9276
9297
|
|
|
9277
9298
|
// src/accessKeyFile.ts
|
|
9278
9299
|
var import_node_fs3 = require("fs");
|
|
9279
|
-
var
|
|
9280
|
-
var
|
|
9300
|
+
var import_node_os3 = __toESM(require("os"));
|
|
9301
|
+
var import_node_path4 = __toESM(require("path"));
|
|
9281
9302
|
function readAccessKeyFile(filePath, options = {}) {
|
|
9282
9303
|
const absolutePath = resolveFilePath(filePath, options.cwd);
|
|
9283
9304
|
if (!(0, import_node_fs3.existsSync)(absolutePath)) {
|
|
@@ -9305,7 +9326,7 @@ function scanAccessKeyFiles(app) {
|
|
|
9305
9326
|
if (!(0, import_node_fs3.existsSync)(dir)) {
|
|
9306
9327
|
return [];
|
|
9307
9328
|
}
|
|
9308
|
-
return (0, import_node_fs3.readdirSync)(dir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".access-key.json")).map((entry) =>
|
|
9329
|
+
return (0, import_node_fs3.readdirSync)(dir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".access-key.json")).map((entry) => import_node_path4.default.join(dir, entry.name)).flatMap((filePath) => {
|
|
9309
9330
|
try {
|
|
9310
9331
|
return [{ filePath, key: readAccessKeyFile(filePath, { expectedApp: app }) }];
|
|
9311
9332
|
} catch {
|
|
@@ -9314,13 +9335,13 @@ function scanAccessKeyFiles(app) {
|
|
|
9314
9335
|
}).sort((a, b) => a.key.name.localeCompare(b.key.name) || a.filePath.localeCompare(b.filePath));
|
|
9315
9336
|
}
|
|
9316
9337
|
function resolveAccessKeyDir(app) {
|
|
9317
|
-
return
|
|
9338
|
+
return import_node_path4.default.join(homeDir(), ".pmate", "access-keys", app);
|
|
9318
9339
|
}
|
|
9319
9340
|
function resolveFilePath(filePath, cwd = process.cwd()) {
|
|
9320
|
-
return
|
|
9341
|
+
return import_node_path4.default.isAbsolute(filePath) ? filePath : import_node_path4.default.resolve(cwd, filePath);
|
|
9321
9342
|
}
|
|
9322
9343
|
function homeDir() {
|
|
9323
|
-
return process.env.HOME || process.env.USERPROFILE ||
|
|
9344
|
+
return process.env.HOME || process.env.USERPROFILE || import_node_os3.default.homedir() || process.cwd();
|
|
9324
9345
|
}
|
|
9325
9346
|
function isAccessKeyFile(value) {
|
|
9326
9347
|
if (!value || typeof value !== "object") {
|
|
@@ -9608,7 +9629,7 @@ var LoginCommandHandler = class {
|
|
|
9608
9629
|
key.id?.trim(),
|
|
9609
9630
|
key.namespace?.trim(),
|
|
9610
9631
|
`expires ${key.expiresAt}`,
|
|
9611
|
-
|
|
9632
|
+
import_node_path6.default.relative(process.cwd(), candidate.filePath)
|
|
9612
9633
|
].filter(Boolean);
|
|
9613
9634
|
return parts.join(" / ");
|
|
9614
9635
|
}
|
|
@@ -9828,7 +9849,7 @@ var import_sts20150401 = __toESM(require("@alicloud/sts20150401"));
|
|
|
9828
9849
|
var import_ali_oss = __toESM(require("ali-oss"));
|
|
9829
9850
|
var import_node_crypto = require("crypto");
|
|
9830
9851
|
var import_node_fs5 = require("fs");
|
|
9831
|
-
var
|
|
9852
|
+
var import_node_path7 = __toESM(require("path"));
|
|
9832
9853
|
|
|
9833
9854
|
// src/certs.ts
|
|
9834
9855
|
var DEFAULT_SSL_CERT_KEY = "pmate-01";
|
|
@@ -10121,7 +10142,7 @@ var AliyunService = class {
|
|
|
10121
10142
|
])
|
|
10122
10143
|
);
|
|
10123
10144
|
for (const filePath of files) {
|
|
10124
|
-
const relativePath =
|
|
10145
|
+
const relativePath = import_node_path7.default.relative(localDir, filePath);
|
|
10125
10146
|
const objectKey = this.toObjectKey(normalizedPrefix, relativePath);
|
|
10126
10147
|
const contentType = this.getContentType(filePath);
|
|
10127
10148
|
const cacheControl = this.getStaticAssetCacheControl(relativePath);
|
|
@@ -10506,7 +10527,7 @@ var AliyunService = class {
|
|
|
10506
10527
|
const entries = await import_node_fs5.promises.readdir(dir, { withFileTypes: true });
|
|
10507
10528
|
const files = [];
|
|
10508
10529
|
for (const entry of entries) {
|
|
10509
|
-
const fullPath =
|
|
10530
|
+
const fullPath = import_node_path7.default.join(dir, entry.name);
|
|
10510
10531
|
if (entry.isDirectory()) {
|
|
10511
10532
|
files.push(...await this.collectFiles(fullPath));
|
|
10512
10533
|
} else if (entry.isFile()) {
|
|
@@ -10568,17 +10589,17 @@ var AliyunService = class {
|
|
|
10568
10589
|
});
|
|
10569
10590
|
}
|
|
10570
10591
|
static toObjectKey(prefix, relativePath) {
|
|
10571
|
-
const normalizedPath = relativePath.split(
|
|
10592
|
+
const normalizedPath = relativePath.split(import_node_path7.default.sep).join("/");
|
|
10572
10593
|
if (!prefix) {
|
|
10573
10594
|
return normalizedPath;
|
|
10574
10595
|
}
|
|
10575
10596
|
return `${prefix}/${normalizedPath}`;
|
|
10576
10597
|
}
|
|
10577
10598
|
static getContentType(filePath) {
|
|
10578
|
-
if (
|
|
10599
|
+
if (import_node_path7.default.basename(filePath).toLowerCase() === "apple-app-site-association") {
|
|
10579
10600
|
return "application/json";
|
|
10580
10601
|
}
|
|
10581
|
-
const ext =
|
|
10602
|
+
const ext = import_node_path7.default.extname(filePath).toLowerCase();
|
|
10582
10603
|
switch (ext) {
|
|
10583
10604
|
case ".html":
|
|
10584
10605
|
return "text/html";
|
|
@@ -10621,7 +10642,7 @@ var AliyunService = class {
|
|
|
10621
10642
|
}
|
|
10622
10643
|
static getStaticAssetCacheControl(filePath) {
|
|
10623
10644
|
const normalized = filePath.replace(/\\/g, "/");
|
|
10624
|
-
const base =
|
|
10645
|
+
const base = import_node_path7.default.posix.basename(normalized).toLowerCase();
|
|
10625
10646
|
if (base === "index.html" || base === "200.html" || base === "404.html" || base === "latest.json" || base === "apple-app-site-association") {
|
|
10626
10647
|
return "no-cache, no-store, must-revalidate";
|
|
10627
10648
|
}
|
|
@@ -10838,7 +10859,7 @@ var BucketCommandHandler = class {
|
|
|
10838
10859
|
};
|
|
10839
10860
|
|
|
10840
10861
|
// src/commands/DeleteCommandHandler.ts
|
|
10841
|
-
var
|
|
10862
|
+
var import_node_path8 = __toESM(require("path"));
|
|
10842
10863
|
var import_node_child_process2 = require("child_process");
|
|
10843
10864
|
|
|
10844
10865
|
// src/serverAddress.ts
|
|
@@ -10996,17 +11017,17 @@ var DeleteCommandHandler = class {
|
|
|
10996
11017
|
});
|
|
10997
11018
|
}
|
|
10998
11019
|
resolveCwd(target) {
|
|
10999
|
-
return target ?
|
|
11020
|
+
return target ? import_node_path8.default.resolve(process.cwd(), target) : process.cwd();
|
|
11000
11021
|
}
|
|
11001
11022
|
};
|
|
11002
11023
|
|
|
11003
11024
|
// src/commands/DevCommandHandler.ts
|
|
11004
11025
|
var import_node_fs6 = require("fs");
|
|
11005
|
-
var
|
|
11026
|
+
var import_node_path10 = __toESM(require("path"));
|
|
11006
11027
|
var import_node_child_process3 = require("child_process");
|
|
11007
11028
|
|
|
11008
11029
|
// src/appDir.ts
|
|
11009
|
-
var
|
|
11030
|
+
var import_node_path9 = __toESM(require("path"));
|
|
11010
11031
|
function normalizeRelativeDir(input, appName) {
|
|
11011
11032
|
if (typeof input !== "string") {
|
|
11012
11033
|
throw new Error(`Missing dir for ${appName} in .pmate.yaml`);
|
|
@@ -11019,7 +11040,7 @@ function normalizeRelativeDir(input, appName) {
|
|
|
11019
11040
|
if (unixLike.startsWith("/")) {
|
|
11020
11041
|
throw new Error(`Invalid dir for ${appName} in .pmate.yaml: must be relative`);
|
|
11021
11042
|
}
|
|
11022
|
-
const normalized =
|
|
11043
|
+
const normalized = import_node_path9.default.posix.normalize(unixLike);
|
|
11023
11044
|
if (normalized.startsWith("../") || normalized === "..") {
|
|
11024
11045
|
throw new Error(
|
|
11025
11046
|
`Invalid dir for ${appName} in .pmate.yaml: must stay within repo`
|
|
@@ -11029,7 +11050,7 @@ function normalizeRelativeDir(input, appName) {
|
|
|
11029
11050
|
}
|
|
11030
11051
|
function resolveLocalAppDir(repoRoot, appName, dir) {
|
|
11031
11052
|
const relative = normalizeRelativeDir(dir, appName);
|
|
11032
|
-
return
|
|
11053
|
+
return import_node_path9.default.resolve(repoRoot, relative);
|
|
11033
11054
|
}
|
|
11034
11055
|
function resolveRemoteAppDir(appName, dir) {
|
|
11035
11056
|
return normalizeRelativeDir(dir, appName);
|
|
@@ -11052,7 +11073,7 @@ var DevCommandHandler = class {
|
|
|
11052
11073
|
);
|
|
11053
11074
|
}
|
|
11054
11075
|
const appDir = resolveLocalAppDir(cwd, appName, appConfig.dir);
|
|
11055
|
-
const packageJsonPath =
|
|
11076
|
+
const packageJsonPath = import_node_path10.default.join(appDir, "package.json");
|
|
11056
11077
|
if (!(0, import_node_fs6.existsSync)(packageJsonPath)) {
|
|
11057
11078
|
throw new Error(`No package.json found at ${packageJsonPath}`);
|
|
11058
11079
|
}
|
|
@@ -11067,7 +11088,7 @@ var DevCommandHandler = class {
|
|
|
11067
11088
|
await this.runCommand("pnpm", ["--filter", pkgName, "run", "dev"], cwd);
|
|
11068
11089
|
}
|
|
11069
11090
|
resolveCwd(target) {
|
|
11070
|
-
return target ?
|
|
11091
|
+
return target ? import_node_path10.default.resolve(process.cwd(), target) : process.cwd();
|
|
11071
11092
|
}
|
|
11072
11093
|
loadConfig(cwd) {
|
|
11073
11094
|
return loadAppConfig(cwd);
|
|
@@ -11102,7 +11123,7 @@ var DevCommandHandler = class {
|
|
|
11102
11123
|
|
|
11103
11124
|
// src/commands/OssCommandHandler.ts
|
|
11104
11125
|
var import_node_fs7 = require("fs");
|
|
11105
|
-
var
|
|
11126
|
+
var import_node_path11 = __toESM(require("path"));
|
|
11106
11127
|
var PARROT_STATIC_PUBLIC_BASE_URL = "https://parrot-static.pmate.chat";
|
|
11107
11128
|
var OssCommandHandler = class _OssCommandHandler {
|
|
11108
11129
|
static {
|
|
@@ -11120,7 +11141,7 @@ var OssCommandHandler = class _OssCommandHandler {
|
|
|
11120
11141
|
}
|
|
11121
11142
|
return;
|
|
11122
11143
|
}
|
|
11123
|
-
const resolvedFile =
|
|
11144
|
+
const resolvedFile = import_node_path11.default.resolve(process.cwd(), args.filePath);
|
|
11124
11145
|
this.assertFile(resolvedFile);
|
|
11125
11146
|
const objectKey = this.normalizeObjectKey(args.objectKey);
|
|
11126
11147
|
const bucket = this.resolveBucket(args.bucket);
|
|
@@ -11161,7 +11182,7 @@ function buildOssPublicUrl(bucket, objectKey) {
|
|
|
11161
11182
|
}
|
|
11162
11183
|
|
|
11163
11184
|
// src/commands/EnvCommandHandler.ts
|
|
11164
|
-
var
|
|
11185
|
+
var import_node_path12 = __toESM(require("path"));
|
|
11165
11186
|
var import_node_child_process4 = require("child_process");
|
|
11166
11187
|
|
|
11167
11188
|
// src/shell.ts
|
|
@@ -11245,8 +11266,8 @@ var EnvCommandHandler = class {
|
|
|
11245
11266
|
ui.success(`Set ${envKey} in .env.local`, appName);
|
|
11246
11267
|
}
|
|
11247
11268
|
async listEnvKeys(server, repoDir, appDir, verbose) {
|
|
11248
|
-
const envLocalPath =
|
|
11249
|
-
const envPath =
|
|
11269
|
+
const envLocalPath = import_node_path12.default.posix.join(appDir, ".env.local");
|
|
11270
|
+
const envPath = import_node_path12.default.posix.join(appDir, ".env");
|
|
11250
11271
|
if (verbose) {
|
|
11251
11272
|
const repoPath = `$HOME/${repoDir}`;
|
|
11252
11273
|
ui.info("Env list target", {
|
|
@@ -11339,8 +11360,8 @@ var EnvCommandHandler = class {
|
|
|
11339
11360
|
}
|
|
11340
11361
|
}
|
|
11341
11362
|
async appendEnvLine(server, repoDir, appDir, envKey, envLine, verbose) {
|
|
11342
|
-
const envLocalPath =
|
|
11343
|
-
const envPath =
|
|
11363
|
+
const envLocalPath = import_node_path12.default.posix.join(appDir, ".env.local");
|
|
11364
|
+
const envPath = import_node_path12.default.posix.join(appDir, ".env");
|
|
11344
11365
|
if (verbose) {
|
|
11345
11366
|
const repoPath = `$HOME/${repoDir}`;
|
|
11346
11367
|
ui.info("Env add target", {
|
|
@@ -11388,8 +11409,8 @@ var EnvCommandHandler = class {
|
|
|
11388
11409
|
await this.runRemoteCommand(server, command);
|
|
11389
11410
|
}
|
|
11390
11411
|
async deleteEnvKey(server, repoDir, appDir, envKey, verbose) {
|
|
11391
|
-
const envLocalPath =
|
|
11392
|
-
const envPath =
|
|
11412
|
+
const envLocalPath = import_node_path12.default.posix.join(appDir, ".env.local");
|
|
11413
|
+
const envPath = import_node_path12.default.posix.join(appDir, ".env");
|
|
11393
11414
|
if (verbose) {
|
|
11394
11415
|
const repoPath = `$HOME/${repoDir}`;
|
|
11395
11416
|
ui.info("Env delete target", {
|
|
@@ -12157,7 +12178,7 @@ var CommitCommandHandler = class {
|
|
|
12157
12178
|
|
|
12158
12179
|
// src/commands/SummaryCommandHandler.ts
|
|
12159
12180
|
var import_node_child_process6 = require("child_process");
|
|
12160
|
-
var
|
|
12181
|
+
var import_node_path13 = __toESM(require("path"));
|
|
12161
12182
|
var SummaryCommandHandler = class {
|
|
12162
12183
|
async handle(args) {
|
|
12163
12184
|
const cwd = this.resolveCwd(args.cwd);
|
|
@@ -12342,7 +12363,7 @@ var SummaryCommandHandler = class {
|
|
|
12342
12363
|
return this.runCapture("gh", args, allowFailure, await this.getGhEnv(cwd), cwd);
|
|
12343
12364
|
}
|
|
12344
12365
|
resolveCwd(value) {
|
|
12345
|
-
return value ?
|
|
12366
|
+
return value ? import_node_path13.default.resolve(process.cwd(), value) : process.cwd();
|
|
12346
12367
|
}
|
|
12347
12368
|
};
|
|
12348
12369
|
function truncate2(value, limit) {
|
|
@@ -12356,8 +12377,8 @@ function truncate2(value, limit) {
|
|
|
12356
12377
|
// src/commands/LinearCommandHandler.ts
|
|
12357
12378
|
var import_node_child_process7 = require("child_process");
|
|
12358
12379
|
var import_node_fs8 = require("fs");
|
|
12359
|
-
var
|
|
12360
|
-
var
|
|
12380
|
+
var import_node_os5 = __toESM(require("os"));
|
|
12381
|
+
var import_node_path14 = __toESM(require("path"));
|
|
12361
12382
|
var import_promises3 = require("readline/promises");
|
|
12362
12383
|
var import_openai = __toESM(require("openai"));
|
|
12363
12384
|
var import_sdk = require("@linear/sdk");
|
|
@@ -13241,7 +13262,7 @@ var LinearCommandHandler = class {
|
|
|
13241
13262
|
}
|
|
13242
13263
|
}
|
|
13243
13264
|
getLinearSelectionPath() {
|
|
13244
|
-
return
|
|
13265
|
+
return import_node_path14.default.join(import_node_os5.default.homedir(), ".pmate", "linear-selection.json");
|
|
13245
13266
|
}
|
|
13246
13267
|
readCachedLinearSelection(cwd) {
|
|
13247
13268
|
const selectionPath = this.getLinearSelectionPath();
|
|
@@ -13260,7 +13281,7 @@ var LinearCommandHandler = class {
|
|
|
13260
13281
|
}
|
|
13261
13282
|
writeCachedLinearSelection(cwd, title) {
|
|
13262
13283
|
const selectionPath = this.getLinearSelectionPath();
|
|
13263
|
-
const dir =
|
|
13284
|
+
const dir = import_node_path14.default.dirname(selectionPath);
|
|
13264
13285
|
(0, import_node_fs8.mkdirSync)(dir, { recursive: true });
|
|
13265
13286
|
let data = {};
|
|
13266
13287
|
if ((0, import_node_fs8.existsSync)(selectionPath)) {
|
|
@@ -13451,8 +13472,8 @@ var LinearCommandHandler = class {
|
|
|
13451
13472
|
if (process.platform !== "darwin") {
|
|
13452
13473
|
throw new Error("Screenshot capture only supports macOS.");
|
|
13453
13474
|
}
|
|
13454
|
-
const dir = await import_node_fs8.promises.mkdtemp(
|
|
13455
|
-
const filePath =
|
|
13475
|
+
const dir = await import_node_fs8.promises.mkdtemp(import_node_path14.default.join(import_node_os5.default.tmpdir(), "pmate-screenshot-"));
|
|
13476
|
+
const filePath = import_node_path14.default.join(dir, `screenshot-${index}.png`);
|
|
13456
13477
|
try {
|
|
13457
13478
|
const code = await this.run("screencapture", ["-i", "-x", filePath], true);
|
|
13458
13479
|
if (code !== 0) {
|
|
@@ -13614,9 +13635,9 @@ var LinearCommandHandler = class {
|
|
|
13614
13635
|
return compact.length > limit ? `${compact.slice(0, limit)}...` : compact;
|
|
13615
13636
|
}
|
|
13616
13637
|
async convertToPng(buffer, ext) {
|
|
13617
|
-
const dir = await import_node_fs8.promises.mkdtemp(
|
|
13618
|
-
const inputPath =
|
|
13619
|
-
const outputPath =
|
|
13638
|
+
const dir = await import_node_fs8.promises.mkdtemp(import_node_path14.default.join(import_node_os5.default.tmpdir(), "pmate-"));
|
|
13639
|
+
const inputPath = import_node_path14.default.join(dir, `clipboard.${ext}`);
|
|
13640
|
+
const outputPath = import_node_path14.default.join(dir, "clipboard.png");
|
|
13620
13641
|
try {
|
|
13621
13642
|
await import_node_fs8.promises.writeFile(inputPath, buffer);
|
|
13622
13643
|
const stderr = await this.runCapture(
|
|
@@ -13927,7 +13948,7 @@ var LinearCommandHandler = class {
|
|
|
13927
13948
|
return this.runCapture("gh", args, allowFailure, await this.getGhEnv(cwd), cwd);
|
|
13928
13949
|
}
|
|
13929
13950
|
resolveCwd(value) {
|
|
13930
|
-
return value ?
|
|
13951
|
+
return value ? import_node_path14.default.resolve(process.cwd(), value) : process.cwd();
|
|
13931
13952
|
}
|
|
13932
13953
|
createOpenAiClient() {
|
|
13933
13954
|
const config = loadPmateConfig();
|
|
@@ -13980,7 +14001,7 @@ function sleep2(ms) {
|
|
|
13980
14001
|
|
|
13981
14002
|
// src/commands/NotionCommandHandler.ts
|
|
13982
14003
|
var import_node_fs9 = require("fs");
|
|
13983
|
-
var
|
|
14004
|
+
var import_node_path15 = __toESM(require("path"));
|
|
13984
14005
|
|
|
13985
14006
|
// src/services/NotionService.ts
|
|
13986
14007
|
var NotionService = class {
|
|
@@ -14219,9 +14240,9 @@ ${indent}\`\`\``;
|
|
|
14219
14240
|
static richTextToPlain(richText) {
|
|
14220
14241
|
return richText.map((item) => item.plain_text ?? item.text?.content ?? "").join("").trim();
|
|
14221
14242
|
}
|
|
14222
|
-
static async requestJson(
|
|
14243
|
+
static async requestJson(path32, init) {
|
|
14223
14244
|
const token = this.getToken();
|
|
14224
|
-
const response = await fetch(`${this.baseUrl}${
|
|
14245
|
+
const response = await fetch(`${this.baseUrl}${path32}`, {
|
|
14225
14246
|
method: init.method,
|
|
14226
14247
|
headers: {
|
|
14227
14248
|
Authorization: `Bearer ${token}`,
|
|
@@ -14319,7 +14340,7 @@ var NotionCommandHandler = class {
|
|
|
14319
14340
|
if (!args.filePath) {
|
|
14320
14341
|
return "";
|
|
14321
14342
|
}
|
|
14322
|
-
const resolved =
|
|
14343
|
+
const resolved = import_node_path15.default.resolve(process.cwd(), args.filePath);
|
|
14323
14344
|
return (0, import_node_fs9.readFileSync)(resolved, "utf8");
|
|
14324
14345
|
}
|
|
14325
14346
|
};
|
|
@@ -14327,8 +14348,8 @@ var NotionCommandHandler = class {
|
|
|
14327
14348
|
// src/commands/QrcodeCommandHandler.ts
|
|
14328
14349
|
var import_node_child_process8 = require("child_process");
|
|
14329
14350
|
var import_node_fs10 = require("fs");
|
|
14330
|
-
var
|
|
14331
|
-
var
|
|
14351
|
+
var import_node_os6 = __toESM(require("os"));
|
|
14352
|
+
var import_node_path16 = __toESM(require("path"));
|
|
14332
14353
|
var import_promises4 = require("readline/promises");
|
|
14333
14354
|
var import_jsqr = __toESM(require("jsqr"));
|
|
14334
14355
|
var import_pngjs = require("pngjs");
|
|
@@ -14370,8 +14391,8 @@ var QrcodeCommandHandler = class {
|
|
|
14370
14391
|
} finally {
|
|
14371
14392
|
rl.close();
|
|
14372
14393
|
}
|
|
14373
|
-
const dir = await import_node_fs10.promises.mkdtemp(
|
|
14374
|
-
const filePath =
|
|
14394
|
+
const dir = await import_node_fs10.promises.mkdtemp(import_node_path16.default.join(import_node_os6.default.tmpdir(), "pmate-qrcode-"));
|
|
14395
|
+
const filePath = import_node_path16.default.join(dir, "qrcode.png");
|
|
14375
14396
|
const code = await this.run("screencapture", ["-i", "-x", filePath], true);
|
|
14376
14397
|
if (code !== 0) {
|
|
14377
14398
|
throw new Error("Screenshot capture canceled or failed.");
|
|
@@ -14651,7 +14672,7 @@ function clampNumber(value, min, max, fallback) {
|
|
|
14651
14672
|
|
|
14652
14673
|
// src/commands/QuizCommandHandler.ts
|
|
14653
14674
|
var import_node_fs11 = require("fs");
|
|
14654
|
-
var
|
|
14675
|
+
var import_node_path17 = __toESM(require("path"));
|
|
14655
14676
|
init_sessionStore();
|
|
14656
14677
|
|
|
14657
14678
|
// src/services/QuizService.ts
|
|
@@ -15196,7 +15217,7 @@ var QuizCommandHandler = class {
|
|
|
15196
15217
|
return;
|
|
15197
15218
|
}
|
|
15198
15219
|
if (args.action === "update-meta") {
|
|
15199
|
-
const resolvedFilePath =
|
|
15220
|
+
const resolvedFilePath = import_node_path17.default.resolve(process.cwd(), args.filePath);
|
|
15200
15221
|
const metadata = JSON.parse((0, import_node_fs11.readFileSync)(resolvedFilePath, "utf8"));
|
|
15201
15222
|
const result = await updateQuizPaperMetadata({
|
|
15202
15223
|
apiBaseUrl,
|
|
@@ -15209,7 +15230,7 @@ var QuizCommandHandler = class {
|
|
|
15209
15230
|
return;
|
|
15210
15231
|
}
|
|
15211
15232
|
if (args.action === "append-step") {
|
|
15212
|
-
const resolvedFilePath =
|
|
15233
|
+
const resolvedFilePath = import_node_path17.default.resolve(process.cwd(), args.filePath);
|
|
15213
15234
|
const step = JSON.parse((0, import_node_fs11.readFileSync)(resolvedFilePath, "utf8"));
|
|
15214
15235
|
const result = await appendQuizPaperStep({
|
|
15215
15236
|
apiBaseUrl,
|
|
@@ -15223,7 +15244,7 @@ var QuizCommandHandler = class {
|
|
|
15223
15244
|
return;
|
|
15224
15245
|
}
|
|
15225
15246
|
if (args.action === "update-step") {
|
|
15226
|
-
const resolvedFilePath =
|
|
15247
|
+
const resolvedFilePath = import_node_path17.default.resolve(process.cwd(), args.filePath);
|
|
15227
15248
|
const step = JSON.parse((0, import_node_fs11.readFileSync)(resolvedFilePath, "utf8"));
|
|
15228
15249
|
step.stepId = args.stepId;
|
|
15229
15250
|
const result = await updateQuizPaperStep({
|
|
@@ -15287,7 +15308,7 @@ var QuizCommandHandler = class {
|
|
|
15287
15308
|
if (targetIndex < 0) {
|
|
15288
15309
|
throw new Error(`\u672A\u627E\u5230 stepId=${args.stepId}\uFF0C\u65E0\u6CD5\u66F4\u65B0\u8BE5\u9898\u76EE\u3002`);
|
|
15289
15310
|
}
|
|
15290
|
-
const resolvedFilePath =
|
|
15311
|
+
const resolvedFilePath = import_node_path17.default.resolve(process.cwd(), args.filePath);
|
|
15291
15312
|
const nextStep = JSON.parse((0, import_node_fs11.readFileSync)(resolvedFilePath, "utf8"));
|
|
15292
15313
|
nextStep.stepId = args.stepId;
|
|
15293
15314
|
const nextSteps = [...basePaper.steps];
|
|
@@ -15339,8 +15360,8 @@ var QuizCommandHandler = class {
|
|
|
15339
15360
|
|
|
15340
15361
|
// src/commands/CollectCommandHandler.ts
|
|
15341
15362
|
var import_node_fs13 = require("fs");
|
|
15342
|
-
var
|
|
15343
|
-
var
|
|
15363
|
+
var import_node_os8 = __toESM(require("os"));
|
|
15364
|
+
var import_node_path19 = __toESM(require("path"));
|
|
15344
15365
|
var import_playwright = require("playwright");
|
|
15345
15366
|
|
|
15346
15367
|
// src/im1BotClient.ts
|
|
@@ -15425,12 +15446,12 @@ var Im1BotClient = class {
|
|
|
15425
15446
|
// src/collectStore.ts
|
|
15426
15447
|
var import_node_crypto3 = require("crypto");
|
|
15427
15448
|
var import_node_fs12 = require("fs");
|
|
15428
|
-
var
|
|
15429
|
-
var
|
|
15449
|
+
var import_node_os7 = __toESM(require("os"));
|
|
15450
|
+
var import_node_path18 = __toESM(require("path"));
|
|
15430
15451
|
function resolveCollectTarget(input) {
|
|
15431
15452
|
const endpoint = input.endpoint ?? (input.source === "cc" ? "http://localhost:9223" : "http://localhost:9222");
|
|
15432
15453
|
const sourceKey = input.source ?? `endpoint-${(0, import_node_crypto3.createHash)("sha1").update(endpoint).digest("hex").slice(0, 8)}`;
|
|
15433
|
-
const rootDir =
|
|
15454
|
+
const rootDir = import_node_path18.default.join(import_node_os7.default.homedir(), ".pmate", "collect", sourceKey);
|
|
15434
15455
|
return { sourceKey, endpoint, rootDir };
|
|
15435
15456
|
}
|
|
15436
15457
|
function toThreadKey(name) {
|
|
@@ -15460,14 +15481,14 @@ async function writeStoredThread(rootDir, thread) {
|
|
|
15460
15481
|
const metaPath = getThreadMetaFilePath(rootDir, thread.threadKey);
|
|
15461
15482
|
const messagePath = getThreadMessagesFilePath(rootDir, thread.threadKey);
|
|
15462
15483
|
const { messages: messages2, ...meta } = thread;
|
|
15463
|
-
await import_node_fs12.promises.mkdir(
|
|
15484
|
+
await import_node_fs12.promises.mkdir(import_node_path18.default.dirname(metaPath), { recursive: true });
|
|
15464
15485
|
await import_node_fs12.promises.writeFile(metaPath, JSON.stringify(meta, null, 2) + "\n", "utf8");
|
|
15465
15486
|
const body = messages2.map((message) => JSON.stringify(message)).join("\n");
|
|
15466
15487
|
await import_node_fs12.promises.writeFile(messagePath, `${body}${body ? "\n" : ""}`, "utf8");
|
|
15467
15488
|
}
|
|
15468
15489
|
async function writeStoredIndex(rootDir, index) {
|
|
15469
15490
|
await import_node_fs12.promises.mkdir(rootDir, { recursive: true });
|
|
15470
|
-
const filePath =
|
|
15491
|
+
const filePath = import_node_path18.default.join(rootDir, "index.json");
|
|
15471
15492
|
await import_node_fs12.promises.writeFile(filePath, JSON.stringify(index, null, 2) + "\n", "utf8");
|
|
15472
15493
|
}
|
|
15473
15494
|
function diffMessages(existing, incoming) {
|
|
@@ -15558,13 +15579,13 @@ async function readLegacyStoredThread(rootDir, threadKey) {
|
|
|
15558
15579
|
}
|
|
15559
15580
|
}
|
|
15560
15581
|
function getThreadMetaFilePath(rootDir, threadKey) {
|
|
15561
|
-
return
|
|
15582
|
+
return import_node_path18.default.join(rootDir, "threads", `${threadKey}.json`);
|
|
15562
15583
|
}
|
|
15563
15584
|
function getThreadMessagesFilePath(rootDir, threadKey) {
|
|
15564
|
-
return
|
|
15585
|
+
return import_node_path18.default.join(rootDir, "threads", `${threadKey}.jsonl`);
|
|
15565
15586
|
}
|
|
15566
15587
|
function getLegacyThreadFilePath(rootDir, threadKey) {
|
|
15567
|
-
return
|
|
15588
|
+
return import_node_path18.default.join(rootDir, "threads", `${threadKey}.json`);
|
|
15568
15589
|
}
|
|
15569
15590
|
function normalizeStoredMessage(message) {
|
|
15570
15591
|
return {
|
|
@@ -15580,9 +15601,9 @@ function normalizeStoredMessage(message) {
|
|
|
15580
15601
|
|
|
15581
15602
|
// src/commands/CollectCommandHandler.ts
|
|
15582
15603
|
async function readOutgoingAttachment(filePath) {
|
|
15583
|
-
const resolved =
|
|
15604
|
+
const resolved = import_node_path19.default.resolve(filePath);
|
|
15584
15605
|
const data = await import_node_fs13.promises.readFile(resolved);
|
|
15585
|
-
const extension =
|
|
15606
|
+
const extension = import_node_path19.default.extname(resolved).toLowerCase();
|
|
15586
15607
|
const contentTypes = {
|
|
15587
15608
|
".png": "image/png",
|
|
15588
15609
|
".jpg": "image/jpeg",
|
|
@@ -15597,7 +15618,7 @@ async function readOutgoingAttachment(filePath) {
|
|
|
15597
15618
|
};
|
|
15598
15619
|
return {
|
|
15599
15620
|
base64: data.toString("base64"),
|
|
15600
|
-
fileName:
|
|
15621
|
+
fileName: import_node_path19.default.basename(resolved),
|
|
15601
15622
|
contentType: contentTypes[extension] ?? "application/octet-stream",
|
|
15602
15623
|
size: data.byteLength
|
|
15603
15624
|
};
|
|
@@ -15867,7 +15888,7 @@ var CollectCommandHandler = class {
|
|
|
15867
15888
|
}
|
|
15868
15889
|
async writeSyncReport(rootDir, target, results, failures, syncedAt) {
|
|
15869
15890
|
const syncId = toSyncId(syncedAt);
|
|
15870
|
-
const reportPath =
|
|
15891
|
+
const reportPath = import_node_path19.default.join(rootDir, "syncs", `${syncId}.json`);
|
|
15871
15892
|
const threadReports = results.map((result) => ({
|
|
15872
15893
|
threadKey: result.thread.threadKey,
|
|
15873
15894
|
threadName: result.thread.threadName,
|
|
@@ -15876,7 +15897,7 @@ var CollectCommandHandler = class {
|
|
|
15876
15897
|
addedMessages: result.diff.added,
|
|
15877
15898
|
upgradedMessages: result.diff.upgraded
|
|
15878
15899
|
})).filter((thread) => thread.addedCount > 0 || thread.upgradedCount > 0);
|
|
15879
|
-
await import_node_fs13.promises.mkdir(
|
|
15900
|
+
await import_node_fs13.promises.mkdir(import_node_path19.default.dirname(reportPath), { recursive: true });
|
|
15880
15901
|
await import_node_fs13.promises.writeFile(
|
|
15881
15902
|
reportPath,
|
|
15882
15903
|
JSON.stringify(
|
|
@@ -16055,18 +16076,18 @@ async function archiveMessageImage(rootDir, attachmentRoot, threadKey, imagePath
|
|
|
16055
16076
|
if (!imagePath || isExternalImageRef(imagePath)) {
|
|
16056
16077
|
return imagePath;
|
|
16057
16078
|
}
|
|
16058
|
-
const normalized =
|
|
16079
|
+
const normalized = import_node_path19.default.posix.normalize(imagePath.replace(/\\/g, "/"));
|
|
16059
16080
|
if (normalized.startsWith("attachments/")) {
|
|
16060
|
-
return
|
|
16081
|
+
return import_node_path19.default.join(rootDir, ...normalized.split("/"));
|
|
16061
16082
|
}
|
|
16062
|
-
if (normalized.startsWith("../") ||
|
|
16083
|
+
if (normalized.startsWith("../") || import_node_path19.default.posix.isAbsolute(normalized)) {
|
|
16063
16084
|
return imagePath;
|
|
16064
16085
|
}
|
|
16065
|
-
const sourcePath =
|
|
16066
|
-
const destinationRelativePath =
|
|
16067
|
-
const destinationPath =
|
|
16086
|
+
const sourcePath = import_node_path19.default.join(attachmentRoot, ...normalized.split("/"));
|
|
16087
|
+
const destinationRelativePath = import_node_path19.default.posix.join("attachments", threadKey, normalized);
|
|
16088
|
+
const destinationPath = import_node_path19.default.join(rootDir, ...destinationRelativePath.split("/"));
|
|
16068
16089
|
try {
|
|
16069
|
-
await import_node_fs13.promises.mkdir(
|
|
16090
|
+
await import_node_fs13.promises.mkdir(import_node_path19.default.dirname(destinationPath), { recursive: true });
|
|
16070
16091
|
await import_node_fs13.promises.copyFile(sourcePath, destinationPath);
|
|
16071
16092
|
return destinationPath;
|
|
16072
16093
|
} catch {
|
|
@@ -16077,7 +16098,7 @@ function resolveLocalAttachmentRoot(sourceKey) {
|
|
|
16077
16098
|
if (sourceKey !== "cc" && sourceKey !== "yelling") {
|
|
16078
16099
|
return null;
|
|
16079
16100
|
}
|
|
16080
|
-
return
|
|
16101
|
+
return import_node_path19.default.join(import_node_os8.default.homedir(), "Library", "Application Support", sourceKey, "attachments.noindex");
|
|
16081
16102
|
}
|
|
16082
16103
|
function isExternalImageRef(imagePath) {
|
|
16083
16104
|
return /^[a-z][a-z0-9+.-]*:/i.test(imagePath);
|
|
@@ -16784,7 +16805,7 @@ async function loadChatSdk() {
|
|
|
16784
16805
|
|
|
16785
16806
|
// src/commands/RegistryResourceCommandHandler.ts
|
|
16786
16807
|
var import_node_fs15 = require("fs");
|
|
16787
|
-
var
|
|
16808
|
+
var import_node_path20 = __toESM(require("path"));
|
|
16788
16809
|
init_sessionStore();
|
|
16789
16810
|
var RegistryResourceCommandHandler = class {
|
|
16790
16811
|
async handle(args) {
|
|
@@ -16819,7 +16840,7 @@ var RegistryResourceCommandHandler = class {
|
|
|
16819
16840
|
}
|
|
16820
16841
|
};
|
|
16821
16842
|
function readJson(filePath) {
|
|
16822
|
-
const absolutePath =
|
|
16843
|
+
const absolutePath = import_node_path20.default.resolve(process.cwd(), filePath);
|
|
16823
16844
|
if (!(0, import_node_fs15.existsSync)(absolutePath)) throw new Error(`JSON file not found: ${absolutePath}`);
|
|
16824
16845
|
return JSON.parse((0, import_node_fs15.readFileSync)(absolutePath, "utf8"));
|
|
16825
16846
|
}
|
|
@@ -16836,7 +16857,7 @@ async function request(baseUrl, token, method, pathname, body) {
|
|
|
16836
16857
|
|
|
16837
16858
|
// src/commands/CallCommandHandler.ts
|
|
16838
16859
|
var import_node_fs16 = require("fs");
|
|
16839
|
-
var
|
|
16860
|
+
var import_node_path21 = __toESM(require("path"));
|
|
16840
16861
|
init_dist2();
|
|
16841
16862
|
init_sessionStore();
|
|
16842
16863
|
var CallCommandHandler = class {
|
|
@@ -16859,7 +16880,7 @@ var CallCommandHandler = class {
|
|
|
16859
16880
|
}
|
|
16860
16881
|
};
|
|
16861
16882
|
async function callWithBinaryFile(hub, functionId, filePath, contentType, timeoutMs) {
|
|
16862
|
-
const absolutePath =
|
|
16883
|
+
const absolutePath = import_node_path21.default.resolve(process.cwd(), filePath);
|
|
16863
16884
|
if (!(0, import_node_fs16.existsSync)(absolutePath)) throw new Error(`Binary file not found: ${absolutePath}`);
|
|
16864
16885
|
const mimeType = contentType || inferContentType(absolutePath);
|
|
16865
16886
|
const result = hub.stream({
|
|
@@ -16885,10 +16906,10 @@ function inferContentType(filePath) {
|
|
|
16885
16906
|
".wav": "audio/wav",
|
|
16886
16907
|
".webm": "audio/webm"
|
|
16887
16908
|
};
|
|
16888
|
-
return contentTypes[
|
|
16909
|
+
return contentTypes[import_node_path21.default.extname(filePath).toLowerCase()] || "application/octet-stream";
|
|
16889
16910
|
}
|
|
16890
16911
|
function readJson2(filePath) {
|
|
16891
|
-
const absolutePath =
|
|
16912
|
+
const absolutePath = import_node_path21.default.resolve(process.cwd(), filePath);
|
|
16892
16913
|
if (!(0, import_node_fs16.existsSync)(absolutePath)) throw new Error(`JSON file not found: ${absolutePath}`);
|
|
16893
16914
|
const decoded = JSON.parse((0, import_node_fs16.readFileSync)(absolutePath, "utf8"));
|
|
16894
16915
|
if (!decoded || typeof decoded !== "object" || Array.isArray(decoded)) {
|
|
@@ -16926,8 +16947,8 @@ function descriptorPathSegments(descriptor) {
|
|
|
16926
16947
|
return ["chains", normalized.chain, "namespaces", normalized.ns, normalized.kind, normalized.name];
|
|
16927
16948
|
}
|
|
16928
16949
|
function buildPathUrl(baseUrl, pathSegments, query) {
|
|
16929
|
-
const
|
|
16930
|
-
const url = new URL(
|
|
16950
|
+
const path32 = `/${pathSegments.map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
16951
|
+
const url = new URL(path32, baseUrl);
|
|
16931
16952
|
if (query) {
|
|
16932
16953
|
for (const [key, value] of Object.entries(query)) {
|
|
16933
16954
|
url.searchParams.set(key, String(value));
|
|
@@ -17278,7 +17299,7 @@ var NsCommandHandler = class {
|
|
|
17278
17299
|
|
|
17279
17300
|
// src/commands/StoreCommandHandler.ts
|
|
17280
17301
|
var import_node_fs17 = require("fs");
|
|
17281
|
-
var
|
|
17302
|
+
var import_node_path22 = __toESM(require("path"));
|
|
17282
17303
|
init_sessionStore();
|
|
17283
17304
|
var StoreCommandHandler = class {
|
|
17284
17305
|
async handle(args) {
|
|
@@ -17432,7 +17453,7 @@ var StoreCommandHandler = class {
|
|
|
17432
17453
|
return payload.data ?? [];
|
|
17433
17454
|
}
|
|
17434
17455
|
readJsonFile(filePath) {
|
|
17435
|
-
const absolutePath =
|
|
17456
|
+
const absolutePath = import_node_path22.default.resolve(process.cwd(), filePath);
|
|
17436
17457
|
if (!(0, import_node_fs17.existsSync)(absolutePath)) {
|
|
17437
17458
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
17438
17459
|
}
|
|
@@ -17487,15 +17508,130 @@ var StoreCommandHandler = class {
|
|
|
17487
17508
|
}
|
|
17488
17509
|
};
|
|
17489
17510
|
|
|
17490
|
-
// src/
|
|
17491
|
-
var
|
|
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");
|
|
17492
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
|
+
|
|
17626
|
+
// src/commands/AppCommandHandler.ts
|
|
17627
|
+
var import_node_fs20 = require("fs");
|
|
17628
|
+
var import_node_path25 = __toESM(require("path"));
|
|
17493
17629
|
init_sessionStore();
|
|
17494
17630
|
|
|
17495
17631
|
// src/appIcon.ts
|
|
17496
|
-
var
|
|
17497
|
-
var
|
|
17498
|
-
var
|
|
17632
|
+
var import_node_fs19 = require("fs");
|
|
17633
|
+
var import_node_os10 = __toESM(require("os"));
|
|
17634
|
+
var import_node_path24 = __toESM(require("path"));
|
|
17499
17635
|
var import_sharp = __toESM(require("sharp"));
|
|
17500
17636
|
init_namespacedRef();
|
|
17501
17637
|
var ANDROID_ICON_SPECS = [
|
|
@@ -17600,13 +17736,13 @@ function createAppIconExportPlans(input) {
|
|
|
17600
17736
|
if (!input.outDir) {
|
|
17601
17737
|
throw new Error("App icon preset export requires --out-dir.");
|
|
17602
17738
|
}
|
|
17603
|
-
const outDir =
|
|
17604
|
-
(0,
|
|
17739
|
+
const outDir = import_node_path24.default.resolve(input.cwd, input.outDir);
|
|
17740
|
+
(0, import_node_fs19.mkdirSync)(outDir, { recursive: true });
|
|
17605
17741
|
return specs.map((spec) => ({
|
|
17606
17742
|
width: spec.width,
|
|
17607
17743
|
height: spec.height,
|
|
17608
17744
|
format: "png",
|
|
17609
|
-
outputPath:
|
|
17745
|
+
outputPath: import_node_path24.default.join(
|
|
17610
17746
|
outDir,
|
|
17611
17747
|
`${namespace}-${objectId}-${spec.name}-${spec.width}x${spec.height}.png`
|
|
17612
17748
|
)
|
|
@@ -17619,8 +17755,8 @@ function createAppIconExportPlans(input) {
|
|
|
17619
17755
|
if (!input.output) {
|
|
17620
17756
|
throw new Error("Single-size app icon export requires --output.");
|
|
17621
17757
|
}
|
|
17622
|
-
const resolvedOutput =
|
|
17623
|
-
(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 });
|
|
17624
17760
|
return [
|
|
17625
17761
|
{
|
|
17626
17762
|
width: input.width,
|
|
@@ -17634,7 +17770,7 @@ async function exportAppIcon(icon, plans) {
|
|
|
17634
17770
|
const svg = await resolveAppIconSvg(icon);
|
|
17635
17771
|
for (const plan of plans) {
|
|
17636
17772
|
const bytes = await renderAppIcon(svg, plan.width, plan.height, plan.format);
|
|
17637
|
-
(0,
|
|
17773
|
+
(0, import_node_fs19.writeFileSync)(plan.outputPath, bytes);
|
|
17638
17774
|
}
|
|
17639
17775
|
}
|
|
17640
17776
|
async function renderAppIconVariant(input) {
|
|
@@ -17642,9 +17778,9 @@ async function renderAppIconVariant(input) {
|
|
|
17642
17778
|
const bytes = await renderAppIcon(svg, input.width, input.height, input.format);
|
|
17643
17779
|
let outputPath;
|
|
17644
17780
|
if (input.output) {
|
|
17645
|
-
outputPath =
|
|
17646
|
-
(0,
|
|
17647
|
-
(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);
|
|
17648
17784
|
}
|
|
17649
17785
|
if (input.name) {
|
|
17650
17786
|
return {
|
|
@@ -17665,7 +17801,7 @@ async function renderAppIconVariant(input) {
|
|
|
17665
17801
|
};
|
|
17666
17802
|
}
|
|
17667
17803
|
async function loadAppIconVariantFile(input) {
|
|
17668
|
-
const absolutePath =
|
|
17804
|
+
const absolutePath = import_node_path24.default.resolve(input.cwd, input.filePath);
|
|
17669
17805
|
const format = inferVariantFormatFromPath(absolutePath);
|
|
17670
17806
|
return {
|
|
17671
17807
|
value: input.name ? await uploadAppIconVariantAsset({
|
|
@@ -17674,7 +17810,7 @@ async function loadAppIconVariantFile(input) {
|
|
|
17674
17810
|
name: input.name,
|
|
17675
17811
|
format,
|
|
17676
17812
|
sourcePath: absolutePath
|
|
17677
|
-
}) : createImageDataUrl((0,
|
|
17813
|
+
}) : createImageDataUrl((0, import_node_fs19.readFileSync)(absolutePath), format),
|
|
17678
17814
|
format,
|
|
17679
17815
|
absolutePath
|
|
17680
17816
|
};
|
|
@@ -17733,7 +17869,7 @@ function shouldAutoGenerateDefaultVariant(icon) {
|
|
|
17733
17869
|
return looksLikeSvgMarkup(icon) || looksLikeSvgUrl(icon);
|
|
17734
17870
|
}
|
|
17735
17871
|
function inferVariantFormatFromPath(filePath) {
|
|
17736
|
-
const ext =
|
|
17872
|
+
const ext = import_node_path24.default.extname(filePath).toLowerCase();
|
|
17737
17873
|
switch (ext) {
|
|
17738
17874
|
case ".png":
|
|
17739
17875
|
return "png";
|
|
@@ -17804,13 +17940,13 @@ async function uploadAppIconVariantAsset(input) {
|
|
|
17804
17940
|
await AliyunService.uploadFile(sourcePath, DEFAULT_APP_ICON_VARIANT_BUCKET, objectKey);
|
|
17805
17941
|
} finally {
|
|
17806
17942
|
if (shouldCleanup) {
|
|
17807
|
-
(0,
|
|
17943
|
+
(0, import_node_fs19.rmSync)(import_node_path24.default.dirname(sourcePath), { recursive: true, force: true });
|
|
17808
17944
|
}
|
|
17809
17945
|
}
|
|
17810
17946
|
return `${DEFAULT_APP_ICON_VARIANT_PUBLIC_BASE_URL}/${objectKey}`;
|
|
17811
17947
|
}
|
|
17812
17948
|
function buildAppIconVariantObjectKey(input) {
|
|
17813
|
-
return
|
|
17949
|
+
return import_node_path24.default.posix.join(
|
|
17814
17950
|
"apps",
|
|
17815
17951
|
`${resolveAppIconAssetStem(input.icon, input.appRef)}-${input.name}.${extensionForIconFormat(input.format)}`
|
|
17816
17952
|
);
|
|
@@ -17819,8 +17955,8 @@ function resolveAppIconAssetStem(icon, appRef2) {
|
|
|
17819
17955
|
if (icon) {
|
|
17820
17956
|
try {
|
|
17821
17957
|
const url = new URL(icon);
|
|
17822
|
-
const ext =
|
|
17823
|
-
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);
|
|
17824
17960
|
const normalized = sanitizeAppIconAssetStem(basename);
|
|
17825
17961
|
if (normalized) {
|
|
17826
17962
|
return normalized;
|
|
@@ -17849,9 +17985,9 @@ function writeTempAppIconVariantFile(objectKey, format, bytes) {
|
|
|
17849
17985
|
if (!bytes) {
|
|
17850
17986
|
throw new Error("App icon variant upload requires bytes or a source file.");
|
|
17851
17987
|
}
|
|
17852
|
-
const tempDir = (0,
|
|
17853
|
-
const tempPath =
|
|
17854
|
-
(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);
|
|
17855
17991
|
return tempPath;
|
|
17856
17992
|
}
|
|
17857
17993
|
|
|
@@ -17859,6 +17995,7 @@ function writeTempAppIconVariantFile(objectKey, format, bytes) {
|
|
|
17859
17995
|
init_namespacedRef();
|
|
17860
17996
|
var AppCommandHandler = class {
|
|
17861
17997
|
async handle(args) {
|
|
17998
|
+
if (args.action === "build") return buildDesktop(args);
|
|
17862
17999
|
const token = this.readToken();
|
|
17863
18000
|
const baseUrl = this.resolveBaseUrl(args.baseUrl);
|
|
17864
18001
|
switch (args.action) {
|
|
@@ -18060,10 +18197,10 @@ var AppCommandHandler = class {
|
|
|
18060
18197
|
}
|
|
18061
18198
|
readJsonFile(filePath) {
|
|
18062
18199
|
const absolutePath = this.resolveFilePath(filePath);
|
|
18063
|
-
if (!(0,
|
|
18200
|
+
if (!(0, import_node_fs20.existsSync)(absolutePath)) {
|
|
18064
18201
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
18065
18202
|
}
|
|
18066
|
-
const raw = (0,
|
|
18203
|
+
const raw = (0, import_node_fs20.readFileSync)(absolutePath, "utf8");
|
|
18067
18204
|
try {
|
|
18068
18205
|
return JSON.parse(raw);
|
|
18069
18206
|
} catch (error) {
|
|
@@ -18073,10 +18210,10 @@ var AppCommandHandler = class {
|
|
|
18073
18210
|
}
|
|
18074
18211
|
async preparePayload(filePath, appRef2) {
|
|
18075
18212
|
const absolutePath = this.resolveFilePath(filePath);
|
|
18076
|
-
return prepareAppPayload(this.readJsonFile(filePath),
|
|
18213
|
+
return prepareAppPayload(this.readJsonFile(filePath), import_node_path25.default.dirname(absolutePath), { appRef: appRef2 });
|
|
18077
18214
|
}
|
|
18078
18215
|
resolveFilePath(filePath) {
|
|
18079
|
-
return
|
|
18216
|
+
return import_node_path25.default.resolve(process.cwd(), filePath);
|
|
18080
18217
|
}
|
|
18081
18218
|
async request(baseUrl, token, method, pathname, body) {
|
|
18082
18219
|
const response = await fetch(`${baseUrl}${pathname}`, {
|
|
@@ -18196,18 +18333,18 @@ function readNamespaceFromPayload(payload) {
|
|
|
18196
18333
|
}
|
|
18197
18334
|
|
|
18198
18335
|
// src/commands/ServiceCommandHandler.ts
|
|
18199
|
-
var
|
|
18336
|
+
var import_node_fs23 = require("fs");
|
|
18200
18337
|
var import_promises5 = require("fs/promises");
|
|
18201
|
-
var
|
|
18202
|
-
var
|
|
18338
|
+
var import_node_path28 = __toESM(require("path"));
|
|
18339
|
+
var import_node_child_process12 = require("child_process");
|
|
18203
18340
|
var import_promises6 = require("readline/promises");
|
|
18204
18341
|
|
|
18205
18342
|
// src/services/AndroidApkReleaseService.ts
|
|
18206
|
-
var
|
|
18207
|
-
var
|
|
18208
|
-
var
|
|
18209
|
-
var
|
|
18210
|
-
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"));
|
|
18211
18348
|
var ANDROID_APK_BUCKET = "parrot-static";
|
|
18212
18349
|
var ANDROID_APK_PUBLIC_BASE_URL = "https://parrot-static.pmate.chat";
|
|
18213
18350
|
var AndroidApkReleaseService = class {
|
|
@@ -18241,7 +18378,7 @@ var AndroidApkReleaseService = class {
|
|
|
18241
18378
|
}
|
|
18242
18379
|
await AliyunService.uploadFile(apkPath, ANDROID_APK_BUCKET, objectKey);
|
|
18243
18380
|
const sha256 = await sha256File(apkPath);
|
|
18244
|
-
const size = (0,
|
|
18381
|
+
const size = (0, import_node_fs21.statSync)(apkPath).size;
|
|
18245
18382
|
const artifact = {
|
|
18246
18383
|
serviceId: service.id,
|
|
18247
18384
|
env: options.env,
|
|
@@ -18275,15 +18412,15 @@ var AndroidApkReleaseService = class {
|
|
|
18275
18412
|
minimumVersionCode: options.minimumVersionCode
|
|
18276
18413
|
});
|
|
18277
18414
|
const objectKey = buildAndroidLatestManifestObjectKey(service.namespace, service.name);
|
|
18278
|
-
const tempDir = (0,
|
|
18279
|
-
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");
|
|
18280
18417
|
try {
|
|
18281
|
-
(0,
|
|
18418
|
+
(0, import_node_fs21.writeFileSync)(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
18282
18419
|
`);
|
|
18283
18420
|
await AliyunService.uploadFile(manifestPath, ANDROID_APK_BUCKET, objectKey);
|
|
18284
18421
|
ui.success(`Published Android update manifest ${ANDROID_APK_PUBLIC_BASE_URL}/${objectKey}`);
|
|
18285
18422
|
} finally {
|
|
18286
|
-
(0,
|
|
18423
|
+
(0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
|
|
18287
18424
|
}
|
|
18288
18425
|
}
|
|
18289
18426
|
async list(service, options) {
|
|
@@ -18299,7 +18436,7 @@ var AndroidApkReleaseService = class {
|
|
|
18299
18436
|
const prefix = `apks/${service.namespace}/${service.name}`;
|
|
18300
18437
|
const objects = await AliyunService.listObjects(ANDROID_APK_BUCKET, prefix);
|
|
18301
18438
|
return objects.filter((item) => item.name.endsWith(".apk")).map((item) => {
|
|
18302
|
-
const versionName =
|
|
18439
|
+
const versionName = import_node_path26.default.basename(item.name, ".apk");
|
|
18303
18440
|
return {
|
|
18304
18441
|
serviceId,
|
|
18305
18442
|
env: options.env ?? "unknown",
|
|
@@ -18322,7 +18459,7 @@ var AndroidApkReleaseService = class {
|
|
|
18322
18459
|
}
|
|
18323
18460
|
}
|
|
18324
18461
|
resolveRepoRoot(service, cwd) {
|
|
18325
|
-
if (cwd) return
|
|
18462
|
+
if (cwd) return import_node_path26.default.resolve(process.cwd(), cwd);
|
|
18326
18463
|
const repository = this.getRepository(service);
|
|
18327
18464
|
if (repository) {
|
|
18328
18465
|
return resolveRepositoryLocalRoot(repository);
|
|
@@ -18334,8 +18471,8 @@ var AndroidApkReleaseService = class {
|
|
|
18334
18471
|
if (!dir) {
|
|
18335
18472
|
throw new Error(`Missing dir for android service ${service.id}`);
|
|
18336
18473
|
}
|
|
18337
|
-
const appDir =
|
|
18338
|
-
if (!(0,
|
|
18474
|
+
const appDir = import_node_path26.default.resolve(repoRoot, dir);
|
|
18475
|
+
if (!(0, import_node_fs21.existsSync)(appDir)) {
|
|
18339
18476
|
throw new Error(`Android app dir not found: ${appDir}`);
|
|
18340
18477
|
}
|
|
18341
18478
|
return appDir;
|
|
@@ -18351,11 +18488,11 @@ var AndroidApkReleaseService = class {
|
|
|
18351
18488
|
return void 0;
|
|
18352
18489
|
}
|
|
18353
18490
|
async runGradleAssembleAndFindApk(repoRoot, appDir, variant) {
|
|
18354
|
-
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));
|
|
18355
18492
|
if (!gradlew) {
|
|
18356
18493
|
throw new Error(`Gradle wrapper not found in ${appDir} or ${repoRoot}`);
|
|
18357
18494
|
}
|
|
18358
|
-
const gradleCwd =
|
|
18495
|
+
const gradleCwd = import_node_path26.default.dirname(gradlew);
|
|
18359
18496
|
const normalizedVariant = variant.toLowerCase();
|
|
18360
18497
|
const taskSuffix = `assemble${capitalize(normalizedVariant)}`;
|
|
18361
18498
|
const tasks = [`:app:${taskSuffix}`, taskSuffix];
|
|
@@ -18443,7 +18580,7 @@ function resolveRepositoryLocalRoot(repository) {
|
|
|
18443
18580
|
if (!repoName) {
|
|
18444
18581
|
throw new Error(`Invalid repository: ${repository}`);
|
|
18445
18582
|
}
|
|
18446
|
-
return
|
|
18583
|
+
return import_node_path26.default.join(import_node_os11.default.homedir(), "dev", "pmate", repoName);
|
|
18447
18584
|
}
|
|
18448
18585
|
function bumpAndroidGradleVersionText(source, bump) {
|
|
18449
18586
|
const versionNameMatch = source.match(/(^\s*versionName\s+["'])([^"']+)(["']\s*$)/m) ?? source.match(/(^\s*versionName\s*=\s*["'])([^"']+)(["']\s*$)/m);
|
|
@@ -18499,46 +18636,46 @@ function parseGradleOutputMetadata(source, apkFileName) {
|
|
|
18499
18636
|
}
|
|
18500
18637
|
function bumpAndroidProjectVersion(appDir, bump) {
|
|
18501
18638
|
const candidates = [
|
|
18502
|
-
|
|
18503
|
-
|
|
18504
|
-
|
|
18505
|
-
|
|
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")
|
|
18506
18643
|
];
|
|
18507
18644
|
for (const candidate of candidates) {
|
|
18508
|
-
if (!(0,
|
|
18509
|
-
const result = bumpAndroidGradleVersionText((0,
|
|
18510
|
-
(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);
|
|
18511
18648
|
return { filePath: candidate, ...result };
|
|
18512
18649
|
}
|
|
18513
18650
|
throw new Error(`No Android Gradle version file found under ${appDir}`);
|
|
18514
18651
|
}
|
|
18515
18652
|
function findLatestApk(repoRoot, appDir, variant) {
|
|
18516
18653
|
const dirs = [
|
|
18517
|
-
|
|
18518
|
-
|
|
18519
|
-
|
|
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)
|
|
18520
18657
|
];
|
|
18521
18658
|
const files = dirs.flatMap((dir) => listApks(dir));
|
|
18522
18659
|
if (files.length === 0) {
|
|
18523
18660
|
throw new Error(`Cannot find APK output for variant ${variant}`);
|
|
18524
18661
|
}
|
|
18525
|
-
files.sort((a, b) => (0,
|
|
18662
|
+
files.sort((a, b) => (0, import_node_fs21.statSync)(b).mtimeMs - (0, import_node_fs21.statSync)(a).mtimeMs);
|
|
18526
18663
|
return files[0];
|
|
18527
18664
|
}
|
|
18528
18665
|
function readGradleOutputMetadata(apkPath) {
|
|
18529
|
-
const metadataPath =
|
|
18530
|
-
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)) {
|
|
18531
18668
|
throw new Error(`Gradle output metadata not found: ${metadataPath}`);
|
|
18532
18669
|
}
|
|
18533
|
-
return parseGradleOutputMetadata((0,
|
|
18670
|
+
return parseGradleOutputMetadata((0, import_node_fs21.readFileSync)(metadataPath, "utf8"), import_node_path26.default.basename(apkPath));
|
|
18534
18671
|
}
|
|
18535
18672
|
function listApks(dir) {
|
|
18536
|
-
if (!(0,
|
|
18537
|
-
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());
|
|
18538
18675
|
}
|
|
18539
18676
|
function runCommand(command, args, cwd) {
|
|
18540
18677
|
return new Promise((resolve, reject) => {
|
|
18541
|
-
const child = (0,
|
|
18678
|
+
const child = (0, import_node_child_process10.spawn)(command, args, { cwd, stdio: "inherit" });
|
|
18542
18679
|
child.on("error", reject);
|
|
18543
18680
|
child.on("close", (code) => {
|
|
18544
18681
|
if (code === 0) resolve();
|
|
@@ -18548,7 +18685,7 @@ function runCommand(command, args, cwd) {
|
|
|
18548
18685
|
}
|
|
18549
18686
|
function runCommandCapture(command, args, cwd) {
|
|
18550
18687
|
return new Promise((resolve, reject) => {
|
|
18551
|
-
const child = (0,
|
|
18688
|
+
const child = (0, import_node_child_process10.spawn)(command, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
18552
18689
|
const chunks = [];
|
|
18553
18690
|
const errorChunks = [];
|
|
18554
18691
|
child.stdout?.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
|
|
@@ -18568,26 +18705,26 @@ async function runAndroidSdkToolCapture(toolName, args) {
|
|
|
18568
18705
|
return runCommandCapture(toolPath, args);
|
|
18569
18706
|
}
|
|
18570
18707
|
function findAndroidSdkTool(toolName) {
|
|
18571
|
-
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));
|
|
18572
18709
|
for (const sdkRoot of sdkRoots) {
|
|
18573
|
-
const candidates = toolName === "aapt" ? listVersionedToolCandidates(
|
|
18574
|
-
|
|
18575
|
-
...listVersionedToolCandidates(
|
|
18576
|
-
|
|
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)
|
|
18577
18714
|
];
|
|
18578
|
-
const match = candidates.find((candidate) => (0,
|
|
18715
|
+
const match = candidates.find((candidate) => (0, import_node_fs21.existsSync)(candidate));
|
|
18579
18716
|
if (match) return match;
|
|
18580
18717
|
}
|
|
18581
18718
|
return void 0;
|
|
18582
18719
|
}
|
|
18583
18720
|
function listVersionedToolCandidates(parentDir, relativeToolPath) {
|
|
18584
|
-
if (!(0,
|
|
18585
|
-
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));
|
|
18586
18723
|
}
|
|
18587
18724
|
function sha256File(filePath) {
|
|
18588
18725
|
return new Promise((resolve, reject) => {
|
|
18589
|
-
const hash = (0,
|
|
18590
|
-
const stream = (0,
|
|
18726
|
+
const hash = (0, import_node_crypto5.createHash)("sha256");
|
|
18727
|
+
const stream = (0, import_node_fs21.createReadStream)(filePath);
|
|
18591
18728
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
18592
18729
|
stream.on("error", reject);
|
|
18593
18730
|
stream.on("end", () => resolve(hash.digest("hex")));
|
|
@@ -18604,10 +18741,10 @@ function capitalize(value) {
|
|
|
18604
18741
|
}
|
|
18605
18742
|
|
|
18606
18743
|
// src/services/ServiceRuntimeRunner.ts
|
|
18607
|
-
var
|
|
18608
|
-
var
|
|
18609
|
-
var
|
|
18610
|
-
var
|
|
18744
|
+
var import_node_fs22 = require("fs");
|
|
18745
|
+
var import_node_os12 = __toESM(require("os"));
|
|
18746
|
+
var import_node_path27 = __toESM(require("path"));
|
|
18747
|
+
var import_node_child_process11 = require("child_process");
|
|
18611
18748
|
var import_node_readline = require("readline");
|
|
18612
18749
|
var import_chalk3 = __toESM(require("chalk"));
|
|
18613
18750
|
var import_dotenv = require("dotenv");
|
|
@@ -19099,14 +19236,14 @@ var ServiceRuntimeRunner = class {
|
|
|
19099
19236
|
}
|
|
19100
19237
|
resolveRepoRoot(service, cwd) {
|
|
19101
19238
|
if (cwd) {
|
|
19102
|
-
return
|
|
19239
|
+
return import_node_path27.default.resolve(process.cwd(), cwd);
|
|
19103
19240
|
}
|
|
19104
19241
|
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();
|
|
19105
19242
|
if (repository) {
|
|
19106
19243
|
const repoName = repository.replace(/\/+$/, "").split("/").pop()?.replace(/\.git$/i, "");
|
|
19107
19244
|
if (repoName) {
|
|
19108
|
-
const candidate =
|
|
19109
|
-
if ((0,
|
|
19245
|
+
const candidate = import_node_path27.default.join(import_node_os12.default.homedir(), "dev", "pmate", repoName);
|
|
19246
|
+
if ((0, import_node_fs22.existsSync)(candidate)) {
|
|
19110
19247
|
return candidate;
|
|
19111
19248
|
}
|
|
19112
19249
|
}
|
|
@@ -19119,13 +19256,13 @@ var ServiceRuntimeRunner = class {
|
|
|
19119
19256
|
if (!dir) {
|
|
19120
19257
|
throw new Error(`Missing service dir for ${service.id}`);
|
|
19121
19258
|
}
|
|
19122
|
-
return
|
|
19259
|
+
return import_node_path27.default.resolve(repoRoot, dir);
|
|
19123
19260
|
}
|
|
19124
19261
|
async deployVite(service, options) {
|
|
19125
19262
|
this.assertDeployableStaticSite(service);
|
|
19126
19263
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19127
|
-
const packageJsonPath =
|
|
19128
|
-
if (!(0,
|
|
19264
|
+
const packageJsonPath = import_node_path27.default.join(appDir, "package.json");
|
|
19265
|
+
if (!(0, import_node_fs22.existsSync)(packageJsonPath)) {
|
|
19129
19266
|
throw new Error(`No package.json found at ${packageJsonPath}`);
|
|
19130
19267
|
}
|
|
19131
19268
|
const pkg2 = this.loadPackageJson(packageJsonPath);
|
|
@@ -19140,8 +19277,8 @@ var ServiceRuntimeRunner = class {
|
|
|
19140
19277
|
this.resolveRepoRoot(service, options.cwd),
|
|
19141
19278
|
buildEnv
|
|
19142
19279
|
);
|
|
19143
|
-
const distDir =
|
|
19144
|
-
if (!(0,
|
|
19280
|
+
const distDir = import_node_path27.default.join(appDir, "dist");
|
|
19281
|
+
if (!(0, import_node_fs22.existsSync)(distDir)) {
|
|
19145
19282
|
throw new Error(`No dist directory found at ${distDir}`);
|
|
19146
19283
|
}
|
|
19147
19284
|
const site = this.getSite(service);
|
|
@@ -19154,8 +19291,8 @@ var ServiceRuntimeRunner = class {
|
|
|
19154
19291
|
async deployStatic(service, options) {
|
|
19155
19292
|
this.assertDeployableStaticSite(service);
|
|
19156
19293
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19157
|
-
const srcDir =
|
|
19158
|
-
if (!(0,
|
|
19294
|
+
const srcDir = import_node_path27.default.join(appDir, "src");
|
|
19295
|
+
if (!(0, import_node_fs22.existsSync)(srcDir)) {
|
|
19159
19296
|
throw new Error(`No src directory found at ${srcDir}`);
|
|
19160
19297
|
}
|
|
19161
19298
|
const site = this.getSite(service);
|
|
@@ -19189,8 +19326,8 @@ var ServiceRuntimeRunner = class {
|
|
|
19189
19326
|
this.validateFcConfig(service, fc);
|
|
19190
19327
|
const repoRoot = this.resolveRepoRoot(service, options.cwd);
|
|
19191
19328
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19192
|
-
const packageJsonPath =
|
|
19193
|
-
if (!(0,
|
|
19329
|
+
const packageJsonPath = import_node_path27.default.join(appDir, "package.json");
|
|
19330
|
+
if (!(0, import_node_fs22.existsSync)(packageJsonPath)) {
|
|
19194
19331
|
throw new Error(`No package.json found at ${packageJsonPath}`);
|
|
19195
19332
|
}
|
|
19196
19333
|
const pkg2 = this.loadPackageJson(packageJsonPath);
|
|
@@ -19243,15 +19380,15 @@ var ServiceRuntimeRunner = class {
|
|
|
19243
19380
|
const repoRoot = this.resolveRepoRoot(service, options.cwd);
|
|
19244
19381
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19245
19382
|
await this.ensurePnpmWorkspaceRoot(repoRoot);
|
|
19246
|
-
const configPath =
|
|
19247
|
-
if (!(0,
|
|
19383
|
+
const configPath = import_node_path27.default.join(appDir, fc.configFile ?? "s.yaml");
|
|
19384
|
+
if (!(0, import_node_fs22.existsSync)(configPath)) {
|
|
19248
19385
|
throw new Error(`Missing FC config file at ${configPath}`);
|
|
19249
19386
|
}
|
|
19250
|
-
const packageJsonPath =
|
|
19251
|
-
if (!(0,
|
|
19387
|
+
const packageJsonPath = import_node_path27.default.join(appDir, "package.json");
|
|
19388
|
+
if (!(0, import_node_fs22.existsSync)(packageJsonPath)) {
|
|
19252
19389
|
throw new Error(`No package.json found at ${packageJsonPath}`);
|
|
19253
19390
|
}
|
|
19254
|
-
const rawConfig = (0,
|
|
19391
|
+
const rawConfig = (0, import_node_fs22.readFileSync)(configPath, "utf8");
|
|
19255
19392
|
if (!rawConfig.includes(fc.functionName)) {
|
|
19256
19393
|
throw new Error(`FC config ${configPath} does not mention functionName ${fc.functionName}`);
|
|
19257
19394
|
}
|
|
@@ -19532,7 +19669,7 @@ var ServiceRuntimeRunner = class {
|
|
|
19532
19669
|
const serverAddress = await resolveServerAddress(server);
|
|
19533
19670
|
const templateName = exposeType === "websocket" ? "nginx.ws.template" : exposeType === "mixed" ? "nginx.mixed.template" : "nginx.rest.template";
|
|
19534
19671
|
const templatePath = this.resolveTemplatePath(templateName);
|
|
19535
|
-
const template = (0,
|
|
19672
|
+
const template = (0, import_node_fs22.readFileSync)(templatePath, "utf8");
|
|
19536
19673
|
const host = `${subdomain}.${("domain" in network ? network.domain?.trim() : void 0) || "pmate.chat"}`;
|
|
19537
19674
|
const rendered = template.replace(/\$\{\{PORT\}\}/g, String(port)).replace(/\$\{\{HOSTS\}\}/g, host).replace(/\$\{\{HOST\}\}/g, host);
|
|
19538
19675
|
const remotePath = `/etc/nginx/sites-enabled/${subdomain}.conf`;
|
|
@@ -19564,11 +19701,11 @@ var ServiceRuntimeRunner = class {
|
|
|
19564
19701
|
}
|
|
19565
19702
|
if (config.ensurePackageJson) {
|
|
19566
19703
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
19567
|
-
const packageJsonPath =
|
|
19568
|
-
if (!(0,
|
|
19704
|
+
const packageJsonPath = import_node_path27.default.join(appDir, "package.json");
|
|
19705
|
+
if (!(0, import_node_fs22.existsSync)(packageJsonPath)) {
|
|
19569
19706
|
throw new Error(`Missing package.json at ${packageJsonPath}`);
|
|
19570
19707
|
}
|
|
19571
|
-
const pkgStat = (0,
|
|
19708
|
+
const pkgStat = (0, import_node_fs22.statSync)(packageJsonPath);
|
|
19572
19709
|
if (!pkgStat.isFile()) {
|
|
19573
19710
|
throw new Error(`package.json is not a file at ${packageJsonPath}`);
|
|
19574
19711
|
}
|
|
@@ -19997,9 +20134,9 @@ var ServiceRuntimeRunner = class {
|
|
|
19997
20134
|
return tokens;
|
|
19998
20135
|
}
|
|
19999
20136
|
readPathValue(source, pathExpr) {
|
|
20000
|
-
const
|
|
20137
|
+
const path32 = pathExpr.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
20001
20138
|
let cursor = source;
|
|
20002
|
-
for (const segment of
|
|
20139
|
+
for (const segment of path32) {
|
|
20003
20140
|
if (!cursor || typeof cursor !== "object" || Array.isArray(cursor)) {
|
|
20004
20141
|
return void 0;
|
|
20005
20142
|
}
|
|
@@ -20042,12 +20179,12 @@ var ServiceRuntimeRunner = class {
|
|
|
20042
20179
|
}
|
|
20043
20180
|
resolveTemplatePath(templateName) {
|
|
20044
20181
|
const candidates = [
|
|
20045
|
-
|
|
20046
|
-
|
|
20047
|
-
|
|
20182
|
+
import_node_path27.default.join(__dirname, "..", "templates", templateName),
|
|
20183
|
+
import_node_path27.default.join(__dirname, "..", "src", "templates", templateName),
|
|
20184
|
+
import_node_path27.default.join(__dirname, "templates", templateName)
|
|
20048
20185
|
];
|
|
20049
20186
|
for (const candidate of candidates) {
|
|
20050
|
-
if ((0,
|
|
20187
|
+
if ((0, import_node_fs22.existsSync)(candidate)) {
|
|
20051
20188
|
return candidate;
|
|
20052
20189
|
}
|
|
20053
20190
|
}
|
|
@@ -20056,7 +20193,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20056
20193
|
writeRemoteConfig(server, content, remotePath) {
|
|
20057
20194
|
return new Promise((resolve, reject) => {
|
|
20058
20195
|
const target = `pmate@${server}`;
|
|
20059
|
-
const child = (0,
|
|
20196
|
+
const child = (0, import_node_child_process11.spawn)("ssh", [target, "sudo", "tee", remotePath], {
|
|
20060
20197
|
stdio: ["pipe", "inherit", "inherit"]
|
|
20061
20198
|
});
|
|
20062
20199
|
child.on("error", reject);
|
|
@@ -20071,7 +20208,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20071
20208
|
reloadNginx(server) {
|
|
20072
20209
|
return new Promise((resolve, reject) => {
|
|
20073
20210
|
const target = `pmate@${server}`;
|
|
20074
|
-
const child = (0,
|
|
20211
|
+
const child = (0, import_node_child_process11.spawn)("ssh", [target, "sudo", "nginx", "-s", "reload"], {
|
|
20075
20212
|
stdio: ["ignore", "inherit", "inherit"]
|
|
20076
20213
|
});
|
|
20077
20214
|
child.on("error", reject);
|
|
@@ -20079,7 +20216,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20079
20216
|
});
|
|
20080
20217
|
}
|
|
20081
20218
|
loadPackageJson(packageJsonPath) {
|
|
20082
|
-
const raw = (0,
|
|
20219
|
+
const raw = (0, import_node_fs22.readFileSync)(packageJsonPath, "utf8");
|
|
20083
20220
|
const parsed = JSON.parse(raw);
|
|
20084
20221
|
if (!parsed || typeof parsed !== "object") {
|
|
20085
20222
|
throw new Error(`Invalid package.json at ${packageJsonPath}`);
|
|
@@ -20088,7 +20225,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20088
20225
|
}
|
|
20089
20226
|
writePackageJson(packageJsonPath, data) {
|
|
20090
20227
|
const serialized = JSON.stringify(data, null, 2);
|
|
20091
|
-
(0,
|
|
20228
|
+
(0, import_node_fs22.writeFileSync)(packageJsonPath, `${serialized}
|
|
20092
20229
|
`, "utf8");
|
|
20093
20230
|
}
|
|
20094
20231
|
validateFcConfig(service, fc) {
|
|
@@ -20115,8 +20252,8 @@ var ServiceRuntimeRunner = class {
|
|
|
20115
20252
|
}
|
|
20116
20253
|
}
|
|
20117
20254
|
async ensurePnpmWorkspaceRoot(repoRoot) {
|
|
20118
|
-
const workspacePath =
|
|
20119
|
-
if (!(0,
|
|
20255
|
+
const workspacePath = import_node_path27.default.join(repoRoot, "pnpm-workspace.yaml");
|
|
20256
|
+
if (!(0, import_node_fs22.existsSync)(workspacePath)) {
|
|
20120
20257
|
throw new Error(`Missing pnpm-workspace.yaml at ${workspacePath}`);
|
|
20121
20258
|
}
|
|
20122
20259
|
}
|
|
@@ -20190,16 +20327,16 @@ var ServiceRuntimeRunner = class {
|
|
|
20190
20327
|
if (!privateKeyPath) {
|
|
20191
20328
|
throw new Error("Missing ssl.prv in ~/.pmate/config.yaml.");
|
|
20192
20329
|
}
|
|
20193
|
-
if (!(0,
|
|
20330
|
+
if (!(0, import_node_fs22.existsSync)(certificatePath)) {
|
|
20194
20331
|
throw new Error(`SSL certificate file not found: ${certificatePath}`);
|
|
20195
20332
|
}
|
|
20196
|
-
if (!(0,
|
|
20333
|
+
if (!(0, import_node_fs22.existsSync)(privateKeyPath)) {
|
|
20197
20334
|
throw new Error(`SSL private key file not found: ${privateKeyPath}`);
|
|
20198
20335
|
}
|
|
20199
20336
|
return {
|
|
20200
20337
|
certName: host,
|
|
20201
|
-
certificate: (0,
|
|
20202
|
-
privateKey: (0,
|
|
20338
|
+
certificate: (0, import_node_fs22.readFileSync)(certificatePath, "utf8"),
|
|
20339
|
+
privateKey: (0, import_node_fs22.readFileSync)(privateKeyPath, "utf8")
|
|
20203
20340
|
};
|
|
20204
20341
|
}
|
|
20205
20342
|
resolveFcProtocol(fc, certConfig) {
|
|
@@ -20258,7 +20395,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20258
20395
|
}
|
|
20259
20396
|
runCommandWithEnv(command, args, cwd, env) {
|
|
20260
20397
|
return new Promise((resolve, reject) => {
|
|
20261
|
-
const child = (0,
|
|
20398
|
+
const child = (0, import_node_child_process11.spawn)(command, args, {
|
|
20262
20399
|
cwd,
|
|
20263
20400
|
stdio: "inherit",
|
|
20264
20401
|
env: { ...process.env, ...env ?? {} }
|
|
@@ -20269,7 +20406,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20269
20406
|
}
|
|
20270
20407
|
runShellCommand(command, cwd, env) {
|
|
20271
20408
|
return new Promise((resolve, reject) => {
|
|
20272
|
-
const child = (0,
|
|
20409
|
+
const child = (0, import_node_child_process11.spawn)(command, [], {
|
|
20273
20410
|
cwd,
|
|
20274
20411
|
stdio: "inherit",
|
|
20275
20412
|
shell: true,
|
|
@@ -20280,10 +20417,10 @@ var ServiceRuntimeRunner = class {
|
|
|
20280
20417
|
});
|
|
20281
20418
|
}
|
|
20282
20419
|
runRemoteCommand(server, command) {
|
|
20283
|
-
if (server === "local") return this.runCommandWithEnv("bash", ["-c", command],
|
|
20420
|
+
if (server === "local") return this.runCommandWithEnv("bash", ["-c", command], import_node_os12.default.homedir());
|
|
20284
20421
|
return new Promise((resolve, reject) => {
|
|
20285
20422
|
const target = `pmate@${server}`;
|
|
20286
|
-
const child = (0,
|
|
20423
|
+
const child = (0, import_node_child_process11.spawn)("ssh", buildSshBashArgs(target, command), { stdio: "inherit" });
|
|
20287
20424
|
child.on("error", reject);
|
|
20288
20425
|
child.on("close", (code) => code === 0 ? resolve() : reject(new Error(`ssh to ${server} exited with code ${code}`)));
|
|
20289
20426
|
});
|
|
@@ -20712,7 +20849,7 @@ var ServiceCommandHandler = class {
|
|
|
20712
20849
|
format: "dotenv"
|
|
20713
20850
|
}
|
|
20714
20851
|
);
|
|
20715
|
-
const outputPath =
|
|
20852
|
+
const outputPath = import_node_path28.default.resolve(process.cwd(), args.output);
|
|
20716
20853
|
await (0, import_promises5.writeFile)(outputPath, payload.content, "utf8");
|
|
20717
20854
|
ui.success(`Wrote env file for ${args.appId} to ${outputPath}`);
|
|
20718
20855
|
this.renderJson({ ...payload, output: outputPath }, args.json);
|
|
@@ -20938,11 +21075,11 @@ var ServiceCommandHandler = class {
|
|
|
20938
21075
|
return (baseUrl || process.env.PMATE_APPS_API_BASE_URL || "https://apps-api.pmate.chat").replace(/\/+$/, "");
|
|
20939
21076
|
}
|
|
20940
21077
|
readJsonFile(filePath) {
|
|
20941
|
-
const absolutePath =
|
|
20942
|
-
if (!(0,
|
|
21078
|
+
const absolutePath = import_node_path28.default.resolve(process.cwd(), filePath);
|
|
21079
|
+
if (!(0, import_node_fs23.existsSync)(absolutePath)) {
|
|
20943
21080
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
20944
21081
|
}
|
|
20945
|
-
const raw = (0,
|
|
21082
|
+
const raw = (0, import_node_fs23.readFileSync)(absolutePath, "utf8");
|
|
20946
21083
|
try {
|
|
20947
21084
|
return JSON.parse(raw);
|
|
20948
21085
|
} catch (error) {
|
|
@@ -21466,7 +21603,7 @@ var ServiceCommandHandler = class {
|
|
|
21466
21603
|
removeRemoteConfig(server, remotePath) {
|
|
21467
21604
|
return new Promise((resolve, reject) => {
|
|
21468
21605
|
const target = `pmate@${server}`;
|
|
21469
|
-
const child = (0,
|
|
21606
|
+
const child = (0, import_node_child_process12.spawn)("ssh", [target, "sudo", "rm", "-f", remotePath], {
|
|
21470
21607
|
stdio: ["ignore", "inherit", "inherit"]
|
|
21471
21608
|
});
|
|
21472
21609
|
child.on("error", (error) => {
|
|
@@ -21484,7 +21621,7 @@ var ServiceCommandHandler = class {
|
|
|
21484
21621
|
reloadNginx(server) {
|
|
21485
21622
|
return new Promise((resolve, reject) => {
|
|
21486
21623
|
const target = `pmate@${server}`;
|
|
21487
|
-
const child = (0,
|
|
21624
|
+
const child = (0, import_node_child_process12.spawn)("ssh", [target, "sudo", "nginx", "-s", "reload"], {
|
|
21488
21625
|
stdio: ["ignore", "inherit", "inherit"]
|
|
21489
21626
|
});
|
|
21490
21627
|
child.on("error", (error) => {
|
|
@@ -21557,9 +21694,9 @@ function sleep3(ms) {
|
|
|
21557
21694
|
}
|
|
21558
21695
|
|
|
21559
21696
|
// src/commands/VercelCommandHandler.ts
|
|
21560
|
-
var
|
|
21697
|
+
var import_node_child_process13 = require("child_process");
|
|
21561
21698
|
var import_node_util = require("util");
|
|
21562
|
-
var execFileAsync = (0, import_node_util.promisify)(
|
|
21699
|
+
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process13.execFile);
|
|
21563
21700
|
function parseDeploymentTimestamp(deployment) {
|
|
21564
21701
|
const candidates = [deployment.createdAt, deployment.readyAt, deployment.ready];
|
|
21565
21702
|
for (const value of candidates) {
|
|
@@ -21750,9 +21887,9 @@ var RoleCommandHandler = class {
|
|
|
21750
21887
|
};
|
|
21751
21888
|
|
|
21752
21889
|
// src/commands/AccountCommandHandler.ts
|
|
21753
|
-
var
|
|
21754
|
-
var
|
|
21755
|
-
var
|
|
21890
|
+
var import_node_fs24 = require("fs");
|
|
21891
|
+
var import_node_crypto6 = require("crypto");
|
|
21892
|
+
var import_node_path29 = __toESM(require("path"));
|
|
21756
21893
|
init_sessionStore();
|
|
21757
21894
|
var AccountCommandHandler = class {
|
|
21758
21895
|
async handle(args) {
|
|
@@ -21760,9 +21897,9 @@ var AccountCommandHandler = class {
|
|
|
21760
21897
|
case "bot-keygen": {
|
|
21761
21898
|
const keyFile = this.generateBotKeyFile(args.app, args.name);
|
|
21762
21899
|
const outPath = args.out ? this.resolveFilePath(args.out) : this.resolveDefaultBotKeyPath(args.app, args.name);
|
|
21763
|
-
(0,
|
|
21764
|
-
(0,
|
|
21765
|
-
(0,
|
|
21900
|
+
(0, import_node_fs24.mkdirSync)(import_node_path29.default.dirname(outPath), { recursive: true });
|
|
21901
|
+
(0, import_node_fs24.writeFileSync)(outPath, JSON.stringify(keyFile, null, 2), { mode: 384 });
|
|
21902
|
+
(0, import_node_fs24.chmodSync)(outPath, 384);
|
|
21766
21903
|
if (!args.json) {
|
|
21767
21904
|
ui.success(`Bot key saved to ${outPath}`);
|
|
21768
21905
|
}
|
|
@@ -22322,10 +22459,10 @@ var AccountCommandHandler = class {
|
|
|
22322
22459
|
throw new Error("Missing visible apps input");
|
|
22323
22460
|
}
|
|
22324
22461
|
const absolutePath = this.resolveFilePath(args.filePath);
|
|
22325
|
-
if (!(0,
|
|
22462
|
+
if (!(0, import_node_fs24.existsSync)(absolutePath)) {
|
|
22326
22463
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
22327
22464
|
}
|
|
22328
|
-
const raw = (0,
|
|
22465
|
+
const raw = (0, import_node_fs24.readFileSync)(absolutePath, "utf8");
|
|
22329
22466
|
let parsed;
|
|
22330
22467
|
try {
|
|
22331
22468
|
parsed = JSON.parse(raw);
|
|
@@ -22339,19 +22476,19 @@ var AccountCommandHandler = class {
|
|
|
22339
22476
|
return parsed;
|
|
22340
22477
|
}
|
|
22341
22478
|
resolveFilePath(filePath) {
|
|
22342
|
-
return
|
|
22479
|
+
return import_node_path29.default.resolve(process.cwd(), filePath);
|
|
22343
22480
|
}
|
|
22344
22481
|
resolveDefaultBotKeyPath(app, name) {
|
|
22345
|
-
return
|
|
22482
|
+
return import_node_path29.default.join(this.homeDir(), ".pmate", "bots", app, `${name}.bot-key.json`);
|
|
22346
22483
|
}
|
|
22347
22484
|
resolveDefaultAccessKeyPath(app, name) {
|
|
22348
|
-
return
|
|
22485
|
+
return import_node_path29.default.join(this.homeDir(), ".pmate", "access-keys", app, `${name}.access-key.json`);
|
|
22349
22486
|
}
|
|
22350
22487
|
homeDir() {
|
|
22351
22488
|
return process.env.HOME || process.env.USERPROFILE || process.cwd();
|
|
22352
22489
|
}
|
|
22353
22490
|
generateBotKeyFile(app, name) {
|
|
22354
|
-
const { publicKey, privateKey } = (0,
|
|
22491
|
+
const { publicKey, privateKey } = (0, import_node_crypto6.generateKeyPairSync)("ed25519");
|
|
22355
22492
|
return {
|
|
22356
22493
|
type: "pmate-bot-key",
|
|
22357
22494
|
version: 1,
|
|
@@ -22365,14 +22502,14 @@ var AccountCommandHandler = class {
|
|
|
22365
22502
|
}
|
|
22366
22503
|
renameDefaultBotKeyFile(app, name, newName) {
|
|
22367
22504
|
const oldPath = this.resolveDefaultBotKeyPath(app, name);
|
|
22368
|
-
if (!(0,
|
|
22505
|
+
if (!(0, import_node_fs24.existsSync)(oldPath)) {
|
|
22369
22506
|
return void 0;
|
|
22370
22507
|
}
|
|
22371
22508
|
const keyFile = this.readBotKeyFile(oldPath, app, name);
|
|
22372
22509
|
const newPath = this.resolveDefaultBotKeyPath(app, newName);
|
|
22373
|
-
(0,
|
|
22374
|
-
(0,
|
|
22375
|
-
(0,
|
|
22510
|
+
(0, import_node_fs24.mkdirSync)(import_node_path29.default.dirname(newPath), { recursive: true, mode: 448 });
|
|
22511
|
+
(0, import_node_fs24.writeFileSync)(newPath, JSON.stringify({ ...keyFile, name: newName }, null, 2));
|
|
22512
|
+
(0, import_node_fs24.chmodSync)(newPath, 384);
|
|
22376
22513
|
return newPath;
|
|
22377
22514
|
}
|
|
22378
22515
|
readBotKeyFile(filePath, expectedApp, expectedName) {
|
|
@@ -22380,10 +22517,10 @@ var AccountCommandHandler = class {
|
|
|
22380
22517
|
throw new Error("Missing bot key file");
|
|
22381
22518
|
}
|
|
22382
22519
|
const absolutePath = this.resolveFilePath(filePath);
|
|
22383
|
-
if (!(0,
|
|
22520
|
+
if (!(0, import_node_fs24.existsSync)(absolutePath)) {
|
|
22384
22521
|
throw new Error(`Bot key file not found: ${absolutePath}`);
|
|
22385
22522
|
}
|
|
22386
|
-
const parsed = JSON.parse((0,
|
|
22523
|
+
const parsed = JSON.parse((0, import_node_fs24.readFileSync)(absolutePath, "utf8"));
|
|
22387
22524
|
if (parsed.type !== "pmate-bot-key" || parsed.version !== 1 || parsed.algorithm !== "ed25519" || !parsed.publicKey || !parsed.privateKey) {
|
|
22388
22525
|
throw new Error(`Invalid PMate bot key file: ${absolutePath}`);
|
|
22389
22526
|
}
|
|
@@ -22400,10 +22537,10 @@ var AccountCommandHandler = class {
|
|
|
22400
22537
|
throw new Error("Missing access key file");
|
|
22401
22538
|
}
|
|
22402
22539
|
const absolutePath = this.resolveFilePath(filePath);
|
|
22403
|
-
if (!(0,
|
|
22540
|
+
if (!(0, import_node_fs24.existsSync)(absolutePath)) {
|
|
22404
22541
|
throw new Error(`Access key file not found: ${absolutePath}`);
|
|
22405
22542
|
}
|
|
22406
|
-
const parsed = JSON.parse((0,
|
|
22543
|
+
const parsed = JSON.parse((0, import_node_fs24.readFileSync)(absolutePath, "utf8"));
|
|
22407
22544
|
if (parsed.type !== "pmate-access-key" || parsed.version !== 1 || !parsed.id || !parsed.app || !parsed.secret || !parsed.expiresAt) {
|
|
22408
22545
|
throw new Error(`Invalid PMate access key file: ${absolutePath}`);
|
|
22409
22546
|
}
|
|
@@ -22425,9 +22562,9 @@ var AccountCommandHandler = class {
|
|
|
22425
22562
|
createdAt: result.key.createdAt
|
|
22426
22563
|
};
|
|
22427
22564
|
const outPath = out ? this.resolveFilePath(out) : this.resolveDefaultAccessKeyPath(result.key.app, result.key.name);
|
|
22428
|
-
(0,
|
|
22429
|
-
(0,
|
|
22430
|
-
(0,
|
|
22565
|
+
(0, import_node_fs24.mkdirSync)(import_node_path29.default.dirname(outPath), { recursive: true });
|
|
22566
|
+
(0, import_node_fs24.writeFileSync)(outPath, JSON.stringify(keyFile, null, 2), { mode: 384 });
|
|
22567
|
+
(0, import_node_fs24.chmodSync)(outPath, 384);
|
|
22431
22568
|
}
|
|
22432
22569
|
renderAccessKeyCreateResult(result, asJson, out) {
|
|
22433
22570
|
if (asJson) {
|
|
@@ -22473,12 +22610,12 @@ var AccountCommandHandler = class {
|
|
|
22473
22610
|
});
|
|
22474
22611
|
}
|
|
22475
22612
|
signBotChallenge(challenge, privateKey) {
|
|
22476
|
-
const key = (0,
|
|
22613
|
+
const key = (0, import_node_crypto6.createPrivateKey)({
|
|
22477
22614
|
key: Buffer.from(privateKey, "base64url"),
|
|
22478
22615
|
format: "der",
|
|
22479
22616
|
type: "pkcs8"
|
|
22480
22617
|
});
|
|
22481
|
-
return (0,
|
|
22618
|
+
return (0, import_node_crypto6.sign)(
|
|
22482
22619
|
null,
|
|
22483
22620
|
Buffer.from(JSON.stringify({
|
|
22484
22621
|
id: challenge.id,
|
|
@@ -22512,8 +22649,8 @@ function encodePathSegment2(value) {
|
|
|
22512
22649
|
}
|
|
22513
22650
|
|
|
22514
22651
|
// src/commands/OrgCommandHandler.ts
|
|
22515
|
-
var
|
|
22516
|
-
var
|
|
22652
|
+
var import_node_fs25 = require("fs");
|
|
22653
|
+
var import_node_path30 = __toESM(require("path"));
|
|
22517
22654
|
init_sessionStore();
|
|
22518
22655
|
var OrgCommandHandler = class {
|
|
22519
22656
|
async handle(args) {
|
|
@@ -22683,11 +22820,11 @@ var OrgCommandHandler = class {
|
|
|
22683
22820
|
if (!filePath) {
|
|
22684
22821
|
throw new Error(`Missing ${itemLabel} input`);
|
|
22685
22822
|
}
|
|
22686
|
-
const absolutePath =
|
|
22687
|
-
if (!(0,
|
|
22823
|
+
const absolutePath = import_node_path30.default.resolve(process.cwd(), filePath);
|
|
22824
|
+
if (!(0, import_node_fs25.existsSync)(absolutePath)) {
|
|
22688
22825
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
22689
22826
|
}
|
|
22690
|
-
const raw = (0,
|
|
22827
|
+
const raw = (0, import_node_fs25.readFileSync)(absolutePath, "utf8");
|
|
22691
22828
|
let parsed;
|
|
22692
22829
|
try {
|
|
22693
22830
|
parsed = JSON.parse(raw);
|
|
@@ -22758,10 +22895,10 @@ function encodePathSegment3(value) {
|
|
|
22758
22895
|
}
|
|
22759
22896
|
|
|
22760
22897
|
// src/commands/HostCommandHandler.ts
|
|
22761
|
-
var
|
|
22762
|
-
var
|
|
22763
|
-
var
|
|
22764
|
-
var
|
|
22898
|
+
var import_node_fs26 = require("fs");
|
|
22899
|
+
var import_node_os13 = require("os");
|
|
22900
|
+
var import_node_path31 = __toESM(require("path"));
|
|
22901
|
+
var import_node_child_process14 = require("child_process");
|
|
22765
22902
|
var BLOCK_START = "# >>> pmate host env >>>";
|
|
22766
22903
|
var BLOCK_END = "# <<< pmate host env <<<";
|
|
22767
22904
|
var PROFILE_BLOCK = `${BLOCK_START}
|
|
@@ -22773,7 +22910,7 @@ fi
|
|
|
22773
22910
|
${BLOCK_END}`;
|
|
22774
22911
|
var HostCommandHandler = class {
|
|
22775
22912
|
async handle(args) {
|
|
22776
|
-
const hostId = normalizeHostId(args.host ?? process.env.PMATE_HOST_ID ?? (0,
|
|
22913
|
+
const hostId = normalizeHostId(args.host ?? process.env.PMATE_HOST_ID ?? (0, import_node_os13.hostname)());
|
|
22777
22914
|
const client = new ServiceRegistryClient(args.baseUrl);
|
|
22778
22915
|
if (args.action === "env-list") {
|
|
22779
22916
|
const items = await client.listHostEnv(hostId);
|
|
@@ -22804,7 +22941,7 @@ async function applyHostEnvRemote(host, values) {
|
|
|
22804
22941
|
const content = serializeHostEnv(values);
|
|
22805
22942
|
const script = buildRemoteApplyScript(Buffer.from(content, "utf8").toString("base64"));
|
|
22806
22943
|
await new Promise((resolve, reject) => {
|
|
22807
|
-
const child = (0,
|
|
22944
|
+
const child = (0, import_node_child_process14.spawn)("ssh", [target, "bash -s"], { stdio: ["pipe", "pipe", "pipe"] });
|
|
22808
22945
|
let stdout = "";
|
|
22809
22946
|
let stderr = "";
|
|
22810
22947
|
child.stdout.on("data", (chunk) => {
|
|
@@ -23267,6 +23404,26 @@ function parseAppArgs(tokens) {
|
|
|
23267
23404
|
if (!action) {
|
|
23268
23405
|
throw new Error("Missing app action. Use: app list|get|view|create|update|rename|move|icon|delete");
|
|
23269
23406
|
}
|
|
23407
|
+
if (action === "build") {
|
|
23408
|
+
const id = parseNamespacedRef(rest.shift() ?? "", { entityLabel: "app ref" }).fullId;
|
|
23409
|
+
const options = {};
|
|
23410
|
+
const switches = /* @__PURE__ */ new Set();
|
|
23411
|
+
while (rest.length) {
|
|
23412
|
+
const key = rest.shift();
|
|
23413
|
+
if (["--dry-run", "--signed", "--dir", "--json"].includes(key)) {
|
|
23414
|
+
if (switches.has(key)) throw new Error(`Duplicate option: ${key}`);
|
|
23415
|
+
switches.add(key);
|
|
23416
|
+
} else if (["--target", "--config", "--platform", "--arch", "--out-dir"].includes(key)) {
|
|
23417
|
+
if (options[key]) throw new Error(`Duplicate option: ${key}`);
|
|
23418
|
+
options[key] = requireValue3(rest, key);
|
|
23419
|
+
} else throw new Error(`Unknown app build option: ${key}`);
|
|
23420
|
+
}
|
|
23421
|
+
if (options["--target"] !== "electron" || !options["--config"]) throw new Error("Use app build <ns:app> --target electron --config <file>");
|
|
23422
|
+
const platform = options["--platform"] ?? (process.platform === "darwin" ? "mac" : process.platform);
|
|
23423
|
+
const arch = options["--arch"] ?? process.arch;
|
|
23424
|
+
if (platform !== "mac" || !["arm64", "x64"].includes(arch)) throw new Error("Supported target: --platform mac --arch arm64|x64");
|
|
23425
|
+
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") };
|
|
23426
|
+
}
|
|
23270
23427
|
let baseUrl;
|
|
23271
23428
|
let json = false;
|
|
23272
23429
|
const takeSharedOptions4 = () => {
|
|
@@ -25969,7 +26126,7 @@ function requireValue11(tokens, option) {
|
|
|
25969
26126
|
|
|
25970
26127
|
// src/index.ts
|
|
25971
26128
|
var pkg = JSON.parse(
|
|
25972
|
-
(0,
|
|
26129
|
+
(0, import_node_fs27.readFileSync)(import_node_path32.default.resolve(__dirname, "..", "package.json"), "utf8")
|
|
25973
26130
|
);
|
|
25974
26131
|
var HELP_TEXT = [
|
|
25975
26132
|
import_chalk4.default.bold(`pmate v${pkg.version}`),
|
|
@@ -26117,6 +26274,7 @@ var HELP_TEXT = [
|
|
|
26117
26274
|
` ${import_chalk4.default.gray(" kv list|get|exists|set|delete <name> [options]")}`,
|
|
26118
26275
|
` ${import_chalk4.default.gray(" defaults: chain=pmate namespace=pmate env base URLs from BLOCKCHAIN_BASE_URL / INDEXER_BASE_URL")}`,
|
|
26119
26276
|
` ${import_chalk4.default.cyan("app")} Manage app registry entries via apps-api`,
|
|
26277
|
+
` ${import_chalk4.default.gray(" build <ns:app> --target electron --config <file> [--platform mac] [--arch arm64|x64] [--out-dir <dir>] [--dir] [--dry-run] [--signed]")}`,
|
|
26120
26278
|
` ${import_chalk4.default.gray(" list [--ns <namespace>] [--all] [--base-url <url>] [--json]")}`,
|
|
26121
26279
|
` ${import_chalk4.default.gray(" get <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
26122
26280
|
` ${import_chalk4.default.gray(" view <ns:objectId> [--base-url <url>]")}`,
|