@openclaw/buzz 2026.9.1-beta.1 → 2026.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter.runtime-DA6guOQ_.js → adapter.runtime-CaDdxQ2C.js} +4 -4
- package/dist/api.js +2 -2
- package/dist/{channel-BulZqShF.js → channel-B50upNWy.js} +189 -66
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{directory-config-BesCse0q.js → directory-config-B0shiBa4.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{message-event-CFw7gGLi.js → message-event-X_aBiM1X.js} +5 -8
- package/dist/qa-runner-api.js +1 -1
- package/dist/{room-membership-DSAkyE0a.js → room-membership-a8IHfdgL.js} +7 -5
- package/dist/secret-contract-DNuqbK64.js +50 -0
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +6 -3
- package/dist/{setup-surface-BvQgEJ7O.js → setup-surface-DDUmAluL.js} +197 -170
- package/dist/types-CeupBG0P.js +160 -0
- package/node_modules/nostr-tools/lib/cjs/index.js +20 -4
- package/node_modules/nostr-tools/lib/cjs/index.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip17.js +19 -3
- package/node_modules/nostr-tools/lib/cjs/nip17.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip46.js +7 -3
- package/node_modules/nostr-tools/lib/cjs/nip46.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip59.js +19 -3
- package/node_modules/nostr-tools/lib/cjs/nip59.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip98.js +1 -1
- package/node_modules/nostr-tools/lib/cjs/nip98.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nipad.js +55 -0
- package/node_modules/nostr-tools/lib/cjs/nipad.js.map +7 -0
- package/node_modules/nostr-tools/lib/esm/index.js +20 -4
- package/node_modules/nostr-tools/lib/esm/index.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip17.js +19 -3
- package/node_modules/nostr-tools/lib/esm/nip17.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip46.js +7 -3
- package/node_modules/nostr-tools/lib/esm/nip46.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip59.js +19 -3
- package/node_modules/nostr-tools/lib/esm/nip59.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip98.js +1 -1
- package/node_modules/nostr-tools/lib/esm/nip98.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nipad.js +34 -0
- package/node_modules/nostr-tools/lib/esm/nipad.js.map +7 -0
- package/node_modules/nostr-tools/lib/nostr.bundle.js +20 -4
- package/node_modules/nostr-tools/lib/nostr.bundle.js.map +2 -2
- package/node_modules/nostr-tools/lib/types/nip46.test.d.ts +1 -0
- package/node_modules/nostr-tools/lib/types/nip98.d.ts +1 -1
- package/node_modules/nostr-tools/lib/types/nipad.d.ts +16 -0
- package/node_modules/nostr-tools/package.json +7 -1
- package/openclaw.plugin.json +346 -0
- package/package.json +8 -5
- package/dist/secret-contract-D19RiJv_.js +0 -12
- package/dist/types-BN_HOsnq.js +0 -101
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -25,7 +25,7 @@ export declare function unpackEventFromToken(token: string): Promise<Event>;
|
|
|
25
25
|
/**
|
|
26
26
|
* Validates the timestamp of an event.
|
|
27
27
|
* @param event - The event object to validate.
|
|
28
|
-
* @returns A boolean indicating whether the event timestamp is within
|
|
28
|
+
* @returns A boolean indicating whether the event timestamp is within 60 seconds of now.
|
|
29
29
|
*/
|
|
30
30
|
export declare function validateEventTimestamp(event: Event): boolean;
|
|
31
31
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Filter } from './filter.ts';
|
|
2
|
+
export type WebAddressPointer = {
|
|
3
|
+
filter: Filter;
|
|
4
|
+
relays?: string[];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* NIP-AD regex. Matches a web URL with a path that may have a Nostr counterpart.
|
|
8
|
+
*
|
|
9
|
+
* - 0: full match
|
|
10
|
+
* - 1: domain
|
|
11
|
+
* - 2: path
|
|
12
|
+
*/
|
|
13
|
+
export declare const AD_REGEX: RegExp;
|
|
14
|
+
export declare const isWebAddress: (value?: string | null) => value is string;
|
|
15
|
+
export declare function useFetchImplementation(fetchImplementation: unknown): void;
|
|
16
|
+
export declare function queryWebAddress(url: string): Promise<WebAddressPointer | null>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "nostr-tools",
|
|
4
|
-
"version": "2.24.
|
|
4
|
+
"version": "2.24.3",
|
|
5
5
|
"description": "Tools for making a Nostr client.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -258,6 +258,12 @@
|
|
|
258
258
|
"require": "./lib/cjs/nip98.js",
|
|
259
259
|
"types": "./lib/types/nip98.d.ts"
|
|
260
260
|
},
|
|
261
|
+
"./nipad": {
|
|
262
|
+
"source": "./nipad.ts",
|
|
263
|
+
"import": "./lib/esm/nipad.js",
|
|
264
|
+
"require": "./lib/cjs/nipad.js",
|
|
265
|
+
"types": "./lib/types/nipad.d.ts"
|
|
266
|
+
},
|
|
261
267
|
"./nip99": {
|
|
262
268
|
"source": "./nip99.ts",
|
|
263
269
|
"import": "./lib/esm/nip99.js",
|
package/openclaw.plugin.json
CHANGED
|
@@ -32,6 +32,13 @@
|
|
|
32
32
|
"responsePrefix": {
|
|
33
33
|
"type": "string"
|
|
34
34
|
},
|
|
35
|
+
"replyToMode": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"enum": [
|
|
38
|
+
"off",
|
|
39
|
+
"all"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
35
42
|
"markdown": {
|
|
36
43
|
"type": "object",
|
|
37
44
|
"properties": {
|
|
@@ -323,8 +330,347 @@
|
|
|
323
330
|
"additionalProperties": false
|
|
324
331
|
}
|
|
325
332
|
},
|
|
333
|
+
"historyLimit": {
|
|
334
|
+
"type": "integer",
|
|
335
|
+
"minimum": 0,
|
|
336
|
+
"maximum": 20
|
|
337
|
+
},
|
|
326
338
|
"defaultTo": {
|
|
327
339
|
"type": "string"
|
|
340
|
+
},
|
|
341
|
+
"accounts": {
|
|
342
|
+
"type": "object",
|
|
343
|
+
"propertyNames": {
|
|
344
|
+
"type": "string",
|
|
345
|
+
"pattern": "^(?!(?:constructor|prototype)$)[a-z0-9][a-z0-9_-]{0,63}$"
|
|
346
|
+
},
|
|
347
|
+
"additionalProperties": {
|
|
348
|
+
"type": "object",
|
|
349
|
+
"properties": {
|
|
350
|
+
"name": {
|
|
351
|
+
"type": "string"
|
|
352
|
+
},
|
|
353
|
+
"enabled": {
|
|
354
|
+
"type": "boolean"
|
|
355
|
+
},
|
|
356
|
+
"configWrites": {
|
|
357
|
+
"type": "boolean"
|
|
358
|
+
},
|
|
359
|
+
"responsePrefix": {
|
|
360
|
+
"type": "string"
|
|
361
|
+
},
|
|
362
|
+
"replyToMode": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"enum": [
|
|
365
|
+
"off",
|
|
366
|
+
"all"
|
|
367
|
+
]
|
|
368
|
+
},
|
|
369
|
+
"markdown": {
|
|
370
|
+
"type": "object",
|
|
371
|
+
"properties": {
|
|
372
|
+
"tables": {
|
|
373
|
+
"type": "string",
|
|
374
|
+
"enum": [
|
|
375
|
+
"off",
|
|
376
|
+
"bullets",
|
|
377
|
+
"code",
|
|
378
|
+
"block"
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"additionalProperties": false
|
|
383
|
+
},
|
|
384
|
+
"relayUrl": {
|
|
385
|
+
"allOf": [
|
|
386
|
+
{
|
|
387
|
+
"type": "string",
|
|
388
|
+
"format": "uri"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"type": "string",
|
|
392
|
+
"pattern": "^[wW][sS][sS]?:\\/\\/"
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
},
|
|
396
|
+
"privateKey": {
|
|
397
|
+
"anyOf": [
|
|
398
|
+
{
|
|
399
|
+
"type": "string"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"oneOf": [
|
|
403
|
+
{
|
|
404
|
+
"type": "object",
|
|
405
|
+
"properties": {
|
|
406
|
+
"source": {
|
|
407
|
+
"type": "string",
|
|
408
|
+
"const": "env"
|
|
409
|
+
},
|
|
410
|
+
"provider": {
|
|
411
|
+
"type": "string",
|
|
412
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
413
|
+
},
|
|
414
|
+
"id": {
|
|
415
|
+
"type": "string",
|
|
416
|
+
"pattern": "^[A-Z][A-Z0-9_]{0,127}$"
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
"required": [
|
|
420
|
+
"source",
|
|
421
|
+
"provider",
|
|
422
|
+
"id"
|
|
423
|
+
],
|
|
424
|
+
"additionalProperties": false
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"type": "object",
|
|
428
|
+
"properties": {
|
|
429
|
+
"source": {
|
|
430
|
+
"type": "string",
|
|
431
|
+
"const": "store"
|
|
432
|
+
},
|
|
433
|
+
"provider": {
|
|
434
|
+
"type": "string",
|
|
435
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
436
|
+
},
|
|
437
|
+
"id": {
|
|
438
|
+
"type": "string",
|
|
439
|
+
"pattern": "^[A-Z][A-Z0-9_]{0,127}$"
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
"required": [
|
|
443
|
+
"source",
|
|
444
|
+
"provider",
|
|
445
|
+
"id"
|
|
446
|
+
],
|
|
447
|
+
"additionalProperties": false
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"type": "object",
|
|
451
|
+
"properties": {
|
|
452
|
+
"source": {
|
|
453
|
+
"type": "string",
|
|
454
|
+
"const": "file"
|
|
455
|
+
},
|
|
456
|
+
"provider": {
|
|
457
|
+
"type": "string",
|
|
458
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
459
|
+
},
|
|
460
|
+
"id": {
|
|
461
|
+
"type": "string"
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
"required": [
|
|
465
|
+
"source",
|
|
466
|
+
"provider",
|
|
467
|
+
"id"
|
|
468
|
+
],
|
|
469
|
+
"additionalProperties": false
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"type": "object",
|
|
473
|
+
"properties": {
|
|
474
|
+
"source": {
|
|
475
|
+
"type": "string",
|
|
476
|
+
"const": "exec"
|
|
477
|
+
},
|
|
478
|
+
"provider": {
|
|
479
|
+
"type": "string",
|
|
480
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
481
|
+
},
|
|
482
|
+
"id": {
|
|
483
|
+
"type": "string"
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
"required": [
|
|
487
|
+
"source",
|
|
488
|
+
"provider",
|
|
489
|
+
"id"
|
|
490
|
+
],
|
|
491
|
+
"additionalProperties": false
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
]
|
|
496
|
+
},
|
|
497
|
+
"authTag": {
|
|
498
|
+
"anyOf": [
|
|
499
|
+
{
|
|
500
|
+
"type": "string"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"oneOf": [
|
|
504
|
+
{
|
|
505
|
+
"type": "object",
|
|
506
|
+
"properties": {
|
|
507
|
+
"source": {
|
|
508
|
+
"type": "string",
|
|
509
|
+
"const": "env"
|
|
510
|
+
},
|
|
511
|
+
"provider": {
|
|
512
|
+
"type": "string",
|
|
513
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
514
|
+
},
|
|
515
|
+
"id": {
|
|
516
|
+
"type": "string",
|
|
517
|
+
"pattern": "^[A-Z][A-Z0-9_]{0,127}$"
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
"required": [
|
|
521
|
+
"source",
|
|
522
|
+
"provider",
|
|
523
|
+
"id"
|
|
524
|
+
],
|
|
525
|
+
"additionalProperties": false
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"type": "object",
|
|
529
|
+
"properties": {
|
|
530
|
+
"source": {
|
|
531
|
+
"type": "string",
|
|
532
|
+
"const": "store"
|
|
533
|
+
},
|
|
534
|
+
"provider": {
|
|
535
|
+
"type": "string",
|
|
536
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
537
|
+
},
|
|
538
|
+
"id": {
|
|
539
|
+
"type": "string",
|
|
540
|
+
"pattern": "^[A-Z][A-Z0-9_]{0,127}$"
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
"required": [
|
|
544
|
+
"source",
|
|
545
|
+
"provider",
|
|
546
|
+
"id"
|
|
547
|
+
],
|
|
548
|
+
"additionalProperties": false
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
"type": "object",
|
|
552
|
+
"properties": {
|
|
553
|
+
"source": {
|
|
554
|
+
"type": "string",
|
|
555
|
+
"const": "file"
|
|
556
|
+
},
|
|
557
|
+
"provider": {
|
|
558
|
+
"type": "string",
|
|
559
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
560
|
+
},
|
|
561
|
+
"id": {
|
|
562
|
+
"type": "string"
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
"required": [
|
|
566
|
+
"source",
|
|
567
|
+
"provider",
|
|
568
|
+
"id"
|
|
569
|
+
],
|
|
570
|
+
"additionalProperties": false
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"type": "object",
|
|
574
|
+
"properties": {
|
|
575
|
+
"source": {
|
|
576
|
+
"type": "string",
|
|
577
|
+
"const": "exec"
|
|
578
|
+
},
|
|
579
|
+
"provider": {
|
|
580
|
+
"type": "string",
|
|
581
|
+
"pattern": "^[a-z][a-z0-9_-]{0,63}$"
|
|
582
|
+
},
|
|
583
|
+
"id": {
|
|
584
|
+
"type": "string"
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
"required": [
|
|
588
|
+
"source",
|
|
589
|
+
"provider",
|
|
590
|
+
"id"
|
|
591
|
+
],
|
|
592
|
+
"additionalProperties": false
|
|
593
|
+
}
|
|
594
|
+
]
|
|
595
|
+
}
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
"groupPolicy": {
|
|
599
|
+
"type": "string",
|
|
600
|
+
"enum": [
|
|
601
|
+
"open",
|
|
602
|
+
"disabled",
|
|
603
|
+
"allowlist"
|
|
604
|
+
]
|
|
605
|
+
},
|
|
606
|
+
"groupAllowFrom": {
|
|
607
|
+
"type": "array",
|
|
608
|
+
"items": {
|
|
609
|
+
"anyOf": [
|
|
610
|
+
{
|
|
611
|
+
"type": "string"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"type": "number"
|
|
615
|
+
}
|
|
616
|
+
]
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
"groups": {
|
|
620
|
+
"type": "object",
|
|
621
|
+
"propertyNames": {
|
|
622
|
+
"type": "string",
|
|
623
|
+
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
|
|
624
|
+
},
|
|
625
|
+
"additionalProperties": {
|
|
626
|
+
"type": "object",
|
|
627
|
+
"properties": {
|
|
628
|
+
"enabled": {
|
|
629
|
+
"type": "boolean"
|
|
630
|
+
},
|
|
631
|
+
"requireMention": {
|
|
632
|
+
"type": "boolean"
|
|
633
|
+
},
|
|
634
|
+
"groupPolicy": {
|
|
635
|
+
"type": "string",
|
|
636
|
+
"enum": [
|
|
637
|
+
"open",
|
|
638
|
+
"disabled",
|
|
639
|
+
"allowlist"
|
|
640
|
+
]
|
|
641
|
+
},
|
|
642
|
+
"groupAllowFrom": {
|
|
643
|
+
"type": "array",
|
|
644
|
+
"items": {
|
|
645
|
+
"anyOf": [
|
|
646
|
+
{
|
|
647
|
+
"type": "string"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
"type": "number"
|
|
651
|
+
}
|
|
652
|
+
]
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
"additionalProperties": false
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
"historyLimit": {
|
|
660
|
+
"type": "integer",
|
|
661
|
+
"minimum": 0,
|
|
662
|
+
"maximum": 20
|
|
663
|
+
},
|
|
664
|
+
"defaultTo": {
|
|
665
|
+
"type": "string"
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
"additionalProperties": false
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
"defaultAccount": {
|
|
672
|
+
"type": "string",
|
|
673
|
+
"pattern": "^(?!(?:constructor|prototype)$)[a-z0-9][a-z0-9_-]{0,63}$"
|
|
328
674
|
}
|
|
329
675
|
},
|
|
330
676
|
"required": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/buzz",
|
|
3
|
-
"version": "2026.9.1
|
|
3
|
+
"version": "2026.9.1",
|
|
4
4
|
"description": "Connect OpenClaw agents to Buzz rooms",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"nostr-tools": "2.24.
|
|
11
|
+
"nostr-tools": "2.24.3",
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.9.1
|
|
15
|
+
"openclaw": ">=2026.9.1"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
"./index.ts"
|
|
25
25
|
],
|
|
26
26
|
"setupEntry": "./dist/setup-entry.js",
|
|
27
|
+
"setupFeatures": {
|
|
28
|
+
"configPromotion": "preserve-root"
|
|
29
|
+
},
|
|
27
30
|
"channel": {
|
|
28
31
|
"id": "buzz",
|
|
29
32
|
"configuredState": {
|
|
@@ -81,10 +84,10 @@
|
|
|
81
84
|
"minHostVersion": ">=2026.7.2"
|
|
82
85
|
},
|
|
83
86
|
"compat": {
|
|
84
|
-
"pluginApi": ">=2026.9.1
|
|
87
|
+
"pluginApi": ">=2026.9.1"
|
|
85
88
|
},
|
|
86
89
|
"build": {
|
|
87
|
-
"openclawVersion": "2026.9.1
|
|
90
|
+
"openclawVersion": "2026.9.1"
|
|
88
91
|
},
|
|
89
92
|
"release": {
|
|
90
93
|
"publishToClawHub": true,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createSimpleChannelSecretContract } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
2
|
-
//#region extensions/buzz/src/secret-contract.ts
|
|
3
|
-
const channelSecrets = createSimpleChannelSecretContract({
|
|
4
|
-
channelKey: "buzz",
|
|
5
|
-
label: "Buzz",
|
|
6
|
-
accountFields: [],
|
|
7
|
-
channelFields: ["privateKey", "authTag"],
|
|
8
|
-
mode: "channel-surface"
|
|
9
|
-
});
|
|
10
|
-
const { secretTargetRegistryEntries, collectRuntimeConfigAssignments } = channelSecrets;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { collectRuntimeConfigAssignments as n, secretTargetRegistryEntries as r, channelSecrets as t };
|
package/dist/types-BN_HOsnq.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { hasConfiguredSecretInput, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
2
|
-
import { getPublicKey, nip19 } from "nostr-tools";
|
|
3
|
-
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
4
|
-
import { assertSecretOwnerAvailable } from "openclaw/plugin-sdk/channel-secret-owner-runtime";
|
|
5
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
-
//#region extensions/buzz/src/target.ts
|
|
7
|
-
const BUZZ_CHANNEL_ID_PATTERN = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/u;
|
|
8
|
-
function normalizeBuzzTarget(target) {
|
|
9
|
-
return target.trim().replace(/^buzz:/iu, "").replace(/^channel:/iu, "");
|
|
10
|
-
}
|
|
11
|
-
function parseBuzzTarget(target) {
|
|
12
|
-
const channelId = normalizeBuzzTarget(target);
|
|
13
|
-
if (!BUZZ_CHANNEL_ID_PATTERN.test(channelId)) throw new Error("Buzz target must be a channel UUID");
|
|
14
|
-
return channelId.toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
function isConfiguredBuzzChannel(configuredChannelIds, channelId) {
|
|
17
|
-
try {
|
|
18
|
-
return configuredChannelIds.has(parseBuzzTarget(channelId));
|
|
19
|
-
} catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function buildBuzzTarget(channelId) {
|
|
24
|
-
return `buzz:${parseBuzzTarget(channelId)}`;
|
|
25
|
-
}
|
|
26
|
-
function looksLikeBuzzTarget(target) {
|
|
27
|
-
try {
|
|
28
|
-
parseBuzzTarget(target);
|
|
29
|
-
return true;
|
|
30
|
-
} catch {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region extensions/buzz/src/types.ts
|
|
36
|
-
function resolveChannelConfig(cfg) {
|
|
37
|
-
return cfg.channels?.buzz;
|
|
38
|
-
}
|
|
39
|
-
function normalizeBuzzGroups(groups) {
|
|
40
|
-
if (!groups) return;
|
|
41
|
-
return Object.fromEntries(Object.entries(groups).map(([channelId, group]) => [parseBuzzTarget(channelId), group]));
|
|
42
|
-
}
|
|
43
|
-
function decodeBuzzPrivateKey(value) {
|
|
44
|
-
const trimmed = value.trim();
|
|
45
|
-
if (/^[0-9a-f]{64}$/iu.test(trimmed)) return Uint8Array.from(Buffer.from(trimmed, "hex"));
|
|
46
|
-
const decoded = nip19.decode(trimmed);
|
|
47
|
-
if (decoded.type !== "nsec") throw new Error("Buzz private key must be nsec or 64-character hex");
|
|
48
|
-
return decoded.data;
|
|
49
|
-
}
|
|
50
|
-
function resolveBuzzPublicKey(privateKey) {
|
|
51
|
-
return getPublicKey(decodeBuzzPrivateKey(privateKey));
|
|
52
|
-
}
|
|
53
|
-
function listBuzzAccountIds(cfg) {
|
|
54
|
-
const config = resolveChannelConfig(cfg);
|
|
55
|
-
const relayUrl = config?.relayUrl?.trim() || process.env.BUZZ_RELAY_URL?.trim();
|
|
56
|
-
const privateKeyConfigured = hasConfiguredSecretInput(config?.privateKey, cfg.secrets?.defaults) || Boolean(process.env.BUZZ_PRIVATE_KEY?.trim());
|
|
57
|
-
return relayUrl || privateKeyConfigured ? [DEFAULT_ACCOUNT_ID] : [];
|
|
58
|
-
}
|
|
59
|
-
function resolveDefaultBuzzAccountId(_cfg) {
|
|
60
|
-
return DEFAULT_ACCOUNT_ID;
|
|
61
|
-
}
|
|
62
|
-
function resolveBuzzAccount(params) {
|
|
63
|
-
const rawConfig = resolveChannelConfig(params.cfg) ?? {};
|
|
64
|
-
const config = {
|
|
65
|
-
...rawConfig,
|
|
66
|
-
groupPolicy: rawConfig.groupPolicy ?? "allowlist",
|
|
67
|
-
groups: normalizeBuzzGroups(rawConfig.groups)
|
|
68
|
-
};
|
|
69
|
-
const relayUrl = config.relayUrl?.trim() || process.env.BUZZ_RELAY_URL?.trim() || "";
|
|
70
|
-
const resolveCredential = (field) => resolveSecretInputString({
|
|
71
|
-
value: config[field],
|
|
72
|
-
path: `channels.buzz.${field}`,
|
|
73
|
-
mode: "inspect"
|
|
74
|
-
});
|
|
75
|
-
const privateKeyResolution = resolveCredential("privateKey");
|
|
76
|
-
const authTagResolution = resolveCredential("authTag");
|
|
77
|
-
const privateKey = privateKeyResolution.value ?? (privateKeyResolution.status === "missing" ? process.env.BUZZ_PRIVATE_KEY?.trim() || "" : "");
|
|
78
|
-
const authTag = authTagResolution.value ?? (authTagResolution.status === "missing" ? process.env.BUZZ_AUTH_TAG?.trim() || "" : "");
|
|
79
|
-
let publicKey = "";
|
|
80
|
-
if (privateKey) try {
|
|
81
|
-
publicKey = resolveBuzzPublicKey(privateKey);
|
|
82
|
-
} catch {}
|
|
83
|
-
return {
|
|
84
|
-
accountId: DEFAULT_ACCOUNT_ID,
|
|
85
|
-
name: normalizeOptionalString(config.name) ?? "OpenClaw",
|
|
86
|
-
enabled: config.enabled !== false,
|
|
87
|
-
configured: Boolean(relayUrl && (privateKey || privateKeyResolution.ref)),
|
|
88
|
-
relayUrl,
|
|
89
|
-
privateKey,
|
|
90
|
-
authTag,
|
|
91
|
-
publicKey,
|
|
92
|
-
tokenStatus: privateKeyResolution.ref || authTagResolution.ref ? "configured_unavailable" : privateKey ? "available" : "missing",
|
|
93
|
-
config
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function assertBuzzAccountAvailable(account) {
|
|
97
|
-
assertSecretOwnerAvailable("account", `buzz:${account.accountId}`);
|
|
98
|
-
if (account.tokenStatus === "configured_unavailable") throw new Error(`Buzz credentials for account "${account.accountId}" are configured but unavailable.`);
|
|
99
|
-
}
|
|
100
|
-
//#endregion
|
|
101
|
-
export { resolveBuzzPublicKey as a, buildBuzzTarget as c, normalizeBuzzTarget as d, parseBuzzTarget as f, resolveBuzzAccount as i, isConfiguredBuzzChannel as l, decodeBuzzPrivateKey as n, resolveDefaultBuzzAccountId as o, listBuzzAccountIds as r, BUZZ_CHANNEL_ID_PATTERN as s, assertBuzzAccountAvailable as t, looksLikeBuzzTarget as u };
|