@openclaw/matrix 2026.7.1 → 2026.7.2-beta.2
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/{account-selection-5e4mHR1m.js → account-selection-Bz00QTmQ.js} +4 -3
- package/dist/api.js +8 -8
- package/dist/{approval-handler.runtime-DI5x9r8I.js → approval-handler.runtime-BQZdg_dJ.js} +27 -17
- package/dist/{approval-ids-ZgqbspmS.js → approval-ids-De4IhOSN.js} +1 -1
- package/dist/{approval-reaction-auth-D9LijQhr.js → approval-reaction-auth-BLJKPLku.js} +2 -2
- package/dist/approval-reactions-D-BxBK_L.js +202 -0
- package/dist/auth-presence.js +1 -1
- package/dist/{channel-jUTBsjHU.js → channel-B1woOUgk.js} +103 -143
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-DO1Nv9ed.js → channel.runtime-BvJm9z0w.js} +7 -7
- package/dist/{cli-CEfWwCKx.js → cli-CLWOkMvw.js} +15 -12
- package/dist/{cli-metadata-CfiEO-CE.js → cli-metadata-9Naf7in0.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-FRuyCNju.js → client-BUai6s29.js} +2 -2
- package/dist/{client-tgnlQJk4.js → client-CPuYbNL8.js} +4 -4
- package/dist/{client-bootstrap-DjFJ7e0N.js → client-bootstrap-CNVF73sF.js} +1 -1
- package/dist/{config-schema-DtnhNYd-.js → config-schema-BTSatSY3.js} +27 -63
- package/dist/contract-api.js +2 -2
- package/dist/{create-client-CNakT7zF.js → create-client-85ttAWDP.js} +3 -3
- package/dist/{credentials-Ds9V1mn2.js → credentials-CncWUieb.js} +1 -1
- package/dist/{credentials-read-BlkvsNFg.js → credentials-read-CwNJrmwu.js} +2 -2
- package/dist/{credentials-write.runtime-CTqqxcut.js → credentials-write.runtime-BDtpqvj0.js} +1 -1
- package/dist/{crypto-runtime-B74cTS6A.js → crypto-runtime-DoEB5RpM.js} +74 -44
- package/dist/{deps-CdjHvnmh.js → deps-DDbghaZH.js} +23 -90
- package/dist/{directory-live-Ufd4qSpX.js → directory-live-0TyS9xep.js} +3 -3
- package/dist/doctor-BGTs609f.js +64 -0
- package/dist/{doctor-contract-BAja_fmb.js → doctor-contract-D2qTLe-C.js} +72 -6
- package/dist/doctor-contract-api.js +323 -45
- package/dist/{draft-stream-D4EH25gv.js → draft-stream-GOdPZMBm.js} +1 -1
- package/dist/{encryption-guidance-D8walY04.js → encryption-guidance-BFfgq7c7.js} +1 -1
- package/dist/{env-auth-DIzOApj0.js → env-auth-CQsYbz-p.js} +1 -1
- package/dist/{env-vars-KzaYveuy.js → env-vars-B0NxQnPk.js} +3 -1
- package/dist/{exec-approval-resolver-f9j6staN.js → exec-approval-resolver-BCgqRtZS.js} +2 -1
- package/dist/{file-sync-store-DVm0ACml.js → file-sync-store-CUE9WwD2.js} +2 -3
- package/dist/helper-api.js +4 -4
- package/dist/{http-client-nSmFiVgk.js → http-client-Jw5_bwQo.js} +18 -34
- package/dist/{idb-persistence-BHm97th-.js → idb-persistence-BiHEEzD7.js} +1 -1
- package/dist/inbound-dedupe-CaBLblef.js +48 -0
- package/dist/index.js +1 -1
- package/dist/{media-text-p-LP21qs.js → media-text-DPCtdFjk.js} +1 -1
- package/dist/{messages-DRKkiEY-.js → messages-DCRbGLMh.js} +3 -3
- package/dist/{monitor-CsGOGdwu.js → monitor-C5EOF9et.js} +90 -427
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-BBvciVfo.js +3 -0
- package/dist/{profile-update-Ucc8RrJL.js → profile-update-DompcDyu.js} +2 -2
- package/dist/{reaction-events-DentrVii.js → reaction-events-QUgxkQKQ.js} +60 -10
- package/dist/record-shared-CvzjvHRn.js +2 -0
- package/dist/{recovery-key-store-DSeLFvNx.js → recovery-key-store-B2RglalK.js} +1 -1
- package/dist/{resolve-targets-DcV_KfgX.js → resolve-targets-Cx1VVArA.js} +1 -1
- package/dist/{resolver.runtime-Hr6bO5zl.js → resolver.runtime-PPrv3ZHu.js} +1 -1
- package/dist/room-info-B6vKD5DF.js +86 -0
- package/dist/{runtime-api-CsBoesCU.js → runtime-api-D1xI_cvh.js} +3 -3
- package/dist/runtime-api.js +6 -6
- package/dist/{sdk-AZYVl34z.js → sdk-1TXuSiXZ.js} +10 -15
- package/dist/{secret-contract-DTgQyQxc.js → secret-contract-OZoQf0kI.js} +7 -48
- package/dist/secret-contract-api.js +1 -1
- package/dist/{send-D92v6Yy0.js → send-yre1krm8.js} +9 -3
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-Da564w5f.js → setup-bootstrap-DXVRCd4G.js} +2 -2
- package/dist/{setup-core-BGgbrdaJ.js → setup-core-CYQRY2oG.js} +9 -7
- package/dist/setup-plugin-api.js +3 -3
- package/dist/{setup-surface-iJ6pd-t5.js → setup-surface-BjvRQzK6.js} +7 -7
- package/dist/{shared-DkFfq7mH.js → shared-BfW4lxGu.js} +13 -8
- package/dist/{startup-verification-BKMAXvcV.js → startup-verification-DSiyDKM5.js} +2 -3
- package/dist/storage-DD-EnNJE.js +718 -0
- package/dist/{storage-paths-BWo_ZEMC.js → storage-paths-B4_I9iqO.js} +1 -12
- package/dist/{thread-bindings-BX5nmWpw.js → thread-bindings-U5ZroBeZ.js} +3 -4
- package/dist/{tool-actions.runtime-C1d5fxE_.js → tool-actions.runtime-BlfTr9b0.js} +246 -53
- package/dist/{verification-BGCMiO1p.js → verification-CGnI9k1O.js} +2 -2
- package/npm-shrinkwrap.json +3 -3
- package/openclaw.plugin.json +136 -125
- package/package.json +4 -4
- package/dist/approval-reactions-BdUaUXVw.js +0 -113
- package/dist/crypto-state-store-Jy3qwhdy.js +0 -352
- package/dist/doctor-DfaOqFtr.js +0 -167
- package/dist/legacy-crypto-inspector-vzXSkm18.js +0 -42
- package/dist/legacy-crypto-restore-CIBfOmLn.js +0 -93
- package/dist/matrix-migration.runtime-BMCyrANT.js +0 -524
- package/dist/migration-snapshot-backup-YcCrSjbE.js +0 -69
- package/dist/migration-snapshot.runtime-VGD4QfeS.js +0 -2
- package/dist/probe.runtime-2MZLc6ng.js +0 -3
- package/dist/runtime-heavy-api.js +0 -3
- package/dist/storage-CQdyKcGg.js +0 -430
package/openclaw.plugin.json
CHANGED
|
@@ -349,12 +349,10 @@
|
|
|
349
349
|
"allowlist_quote"
|
|
350
350
|
]
|
|
351
351
|
},
|
|
352
|
-
"blockStreaming": {
|
|
353
|
-
"type": "boolean"
|
|
354
|
-
},
|
|
355
352
|
"streaming": {
|
|
356
|
-
"
|
|
357
|
-
|
|
353
|
+
"type": "object",
|
|
354
|
+
"properties": {
|
|
355
|
+
"mode": {
|
|
358
356
|
"type": "string",
|
|
359
357
|
"enum": [
|
|
360
358
|
"partial",
|
|
@@ -363,70 +361,90 @@
|
|
|
363
361
|
"off"
|
|
364
362
|
]
|
|
365
363
|
},
|
|
366
|
-
{
|
|
367
|
-
"type": "
|
|
364
|
+
"chunkMode": {
|
|
365
|
+
"type": "string",
|
|
366
|
+
"enum": [
|
|
367
|
+
"length",
|
|
368
|
+
"newline"
|
|
369
|
+
]
|
|
368
370
|
},
|
|
369
|
-
{
|
|
371
|
+
"block": {
|
|
370
372
|
"type": "object",
|
|
371
373
|
"properties": {
|
|
372
|
-
"
|
|
373
|
-
"type": "
|
|
374
|
-
"enum": [
|
|
375
|
-
"partial",
|
|
376
|
-
"quiet",
|
|
377
|
-
"progress",
|
|
378
|
-
"off"
|
|
379
|
-
]
|
|
374
|
+
"enabled": {
|
|
375
|
+
"type": "boolean"
|
|
380
376
|
},
|
|
381
|
-
"
|
|
377
|
+
"coalesce": {
|
|
382
378
|
"type": "object",
|
|
383
379
|
"properties": {
|
|
384
|
-
"
|
|
385
|
-
"anyOf": [
|
|
386
|
-
{
|
|
387
|
-
"type": "string"
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
"type": "boolean",
|
|
391
|
-
"const": false
|
|
392
|
-
}
|
|
393
|
-
]
|
|
394
|
-
},
|
|
395
|
-
"labels": {
|
|
396
|
-
"type": "array",
|
|
397
|
-
"items": {
|
|
398
|
-
"type": "string"
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
"maxLines": {
|
|
380
|
+
"minChars": {
|
|
402
381
|
"type": "integer",
|
|
403
382
|
"exclusiveMinimum": 0,
|
|
404
383
|
"maximum": 9007199254740991
|
|
405
384
|
},
|
|
406
|
-
"
|
|
385
|
+
"maxChars": {
|
|
407
386
|
"type": "integer",
|
|
408
387
|
"exclusiveMinimum": 0,
|
|
409
388
|
"maximum": 9007199254740991
|
|
410
389
|
},
|
|
411
|
-
"
|
|
412
|
-
"type": "
|
|
390
|
+
"idleMs": {
|
|
391
|
+
"type": "integer",
|
|
392
|
+
"minimum": 0,
|
|
393
|
+
"maximum": 9007199254740991
|
|
413
394
|
}
|
|
414
395
|
},
|
|
415
396
|
"additionalProperties": false
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
"additionalProperties": false
|
|
400
|
+
},
|
|
401
|
+
"progress": {
|
|
402
|
+
"type": "object",
|
|
403
|
+
"properties": {
|
|
404
|
+
"label": {
|
|
405
|
+
"anyOf": [
|
|
406
|
+
{
|
|
407
|
+
"type": "string"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"type": "boolean",
|
|
411
|
+
"const": false
|
|
422
412
|
}
|
|
423
|
-
|
|
424
|
-
|
|
413
|
+
]
|
|
414
|
+
},
|
|
415
|
+
"labels": {
|
|
416
|
+
"type": "array",
|
|
417
|
+
"items": {
|
|
418
|
+
"type": "string"
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
"maxLines": {
|
|
422
|
+
"type": "integer",
|
|
423
|
+
"exclusiveMinimum": 0,
|
|
424
|
+
"maximum": 9007199254740991
|
|
425
|
+
},
|
|
426
|
+
"maxLineChars": {
|
|
427
|
+
"type": "integer",
|
|
428
|
+
"exclusiveMinimum": 0,
|
|
429
|
+
"maximum": 9007199254740991
|
|
430
|
+
},
|
|
431
|
+
"toolProgress": {
|
|
432
|
+
"type": "boolean"
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
"additionalProperties": false
|
|
436
|
+
},
|
|
437
|
+
"preview": {
|
|
438
|
+
"type": "object",
|
|
439
|
+
"properties": {
|
|
440
|
+
"toolProgress": {
|
|
441
|
+
"type": "boolean"
|
|
425
442
|
}
|
|
426
443
|
},
|
|
427
444
|
"additionalProperties": false
|
|
428
445
|
}
|
|
429
|
-
|
|
446
|
+
},
|
|
447
|
+
"additionalProperties": false
|
|
430
448
|
},
|
|
431
449
|
"replyToMode": {
|
|
432
450
|
"type": "string",
|
|
@@ -448,13 +466,6 @@
|
|
|
448
466
|
"textChunkLimit": {
|
|
449
467
|
"type": "number"
|
|
450
468
|
},
|
|
451
|
-
"chunkMode": {
|
|
452
|
-
"type": "string",
|
|
453
|
-
"enum": [
|
|
454
|
-
"length",
|
|
455
|
-
"newline"
|
|
456
|
-
]
|
|
457
|
-
},
|
|
458
469
|
"responsePrefix": {
|
|
459
470
|
"type": "string"
|
|
460
471
|
},
|
|
@@ -658,14 +669,47 @@
|
|
|
658
669
|
"additionalProperties": {
|
|
659
670
|
"type": "object",
|
|
660
671
|
"properties": {
|
|
661
|
-
"
|
|
662
|
-
"type": "
|
|
672
|
+
"requireMention": {
|
|
673
|
+
"type": "boolean"
|
|
674
|
+
},
|
|
675
|
+
"tools": {
|
|
676
|
+
"type": "object",
|
|
677
|
+
"properties": {
|
|
678
|
+
"allow": {
|
|
679
|
+
"type": "array",
|
|
680
|
+
"items": {
|
|
681
|
+
"type": "string"
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
"alsoAllow": {
|
|
685
|
+
"type": "array",
|
|
686
|
+
"items": {
|
|
687
|
+
"type": "string"
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
"deny": {
|
|
691
|
+
"type": "array",
|
|
692
|
+
"items": {
|
|
693
|
+
"type": "string"
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
"additionalProperties": false
|
|
698
|
+
},
|
|
699
|
+
"skills": {
|
|
700
|
+
"type": "array",
|
|
701
|
+
"items": {
|
|
702
|
+
"type": "string"
|
|
703
|
+
}
|
|
663
704
|
},
|
|
664
705
|
"enabled": {
|
|
665
706
|
"type": "boolean"
|
|
666
707
|
},
|
|
667
|
-
"
|
|
668
|
-
"type": "
|
|
708
|
+
"systemPrompt": {
|
|
709
|
+
"type": "string"
|
|
710
|
+
},
|
|
711
|
+
"account": {
|
|
712
|
+
"type": "string"
|
|
669
713
|
},
|
|
670
714
|
"allowBots": {
|
|
671
715
|
"anyOf": [
|
|
@@ -702,6 +746,35 @@
|
|
|
702
746
|
},
|
|
703
747
|
"additionalProperties": false
|
|
704
748
|
},
|
|
749
|
+
"autoReply": {
|
|
750
|
+
"type": "boolean"
|
|
751
|
+
},
|
|
752
|
+
"users": {
|
|
753
|
+
"type": "array",
|
|
754
|
+
"items": {
|
|
755
|
+
"anyOf": [
|
|
756
|
+
{
|
|
757
|
+
"type": "string"
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
"type": "number"
|
|
761
|
+
}
|
|
762
|
+
]
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
"additionalProperties": false
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
"rooms": {
|
|
770
|
+
"type": "object",
|
|
771
|
+
"properties": {},
|
|
772
|
+
"additionalProperties": {
|
|
773
|
+
"type": "object",
|
|
774
|
+
"properties": {
|
|
775
|
+
"requireMention": {
|
|
776
|
+
"type": "boolean"
|
|
777
|
+
},
|
|
705
778
|
"tools": {
|
|
706
779
|
"type": "object",
|
|
707
780
|
"properties": {
|
|
@@ -726,50 +799,21 @@
|
|
|
726
799
|
},
|
|
727
800
|
"additionalProperties": false
|
|
728
801
|
},
|
|
729
|
-
"autoReply": {
|
|
730
|
-
"type": "boolean"
|
|
731
|
-
},
|
|
732
|
-
"users": {
|
|
733
|
-
"type": "array",
|
|
734
|
-
"items": {
|
|
735
|
-
"anyOf": [
|
|
736
|
-
{
|
|
737
|
-
"type": "string"
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
"type": "number"
|
|
741
|
-
}
|
|
742
|
-
]
|
|
743
|
-
}
|
|
744
|
-
},
|
|
745
802
|
"skills": {
|
|
746
803
|
"type": "array",
|
|
747
804
|
"items": {
|
|
748
805
|
"type": "string"
|
|
749
806
|
}
|
|
750
807
|
},
|
|
808
|
+
"enabled": {
|
|
809
|
+
"type": "boolean"
|
|
810
|
+
},
|
|
751
811
|
"systemPrompt": {
|
|
752
812
|
"type": "string"
|
|
753
|
-
}
|
|
754
|
-
},
|
|
755
|
-
"additionalProperties": false
|
|
756
|
-
}
|
|
757
|
-
},
|
|
758
|
-
"rooms": {
|
|
759
|
-
"type": "object",
|
|
760
|
-
"properties": {},
|
|
761
|
-
"additionalProperties": {
|
|
762
|
-
"type": "object",
|
|
763
|
-
"properties": {
|
|
813
|
+
},
|
|
764
814
|
"account": {
|
|
765
815
|
"type": "string"
|
|
766
816
|
},
|
|
767
|
-
"enabled": {
|
|
768
|
-
"type": "boolean"
|
|
769
|
-
},
|
|
770
|
-
"requireMention": {
|
|
771
|
-
"type": "boolean"
|
|
772
|
-
},
|
|
773
817
|
"allowBots": {
|
|
774
818
|
"anyOf": [
|
|
775
819
|
{
|
|
@@ -805,30 +849,6 @@
|
|
|
805
849
|
},
|
|
806
850
|
"additionalProperties": false
|
|
807
851
|
},
|
|
808
|
-
"tools": {
|
|
809
|
-
"type": "object",
|
|
810
|
-
"properties": {
|
|
811
|
-
"allow": {
|
|
812
|
-
"type": "array",
|
|
813
|
-
"items": {
|
|
814
|
-
"type": "string"
|
|
815
|
-
}
|
|
816
|
-
},
|
|
817
|
-
"alsoAllow": {
|
|
818
|
-
"type": "array",
|
|
819
|
-
"items": {
|
|
820
|
-
"type": "string"
|
|
821
|
-
}
|
|
822
|
-
},
|
|
823
|
-
"deny": {
|
|
824
|
-
"type": "array",
|
|
825
|
-
"items": {
|
|
826
|
-
"type": "string"
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
},
|
|
830
|
-
"additionalProperties": false
|
|
831
|
-
},
|
|
832
852
|
"autoReply": {
|
|
833
853
|
"type": "boolean"
|
|
834
854
|
},
|
|
@@ -844,15 +864,6 @@
|
|
|
844
864
|
}
|
|
845
865
|
]
|
|
846
866
|
}
|
|
847
|
-
},
|
|
848
|
-
"skills": {
|
|
849
|
-
"type": "array",
|
|
850
|
-
"items": {
|
|
851
|
-
"type": "string"
|
|
852
|
-
}
|
|
853
|
-
},
|
|
854
|
-
"systemPrompt": {
|
|
855
|
-
"type": "string"
|
|
856
867
|
}
|
|
857
868
|
},
|
|
858
869
|
"additionalProperties": false
|
|
@@ -941,7 +952,7 @@
|
|
|
941
952
|
},
|
|
942
953
|
"streaming.progress.labels": {
|
|
943
954
|
"label": "Matrix Progress Label Pool",
|
|
944
|
-
"help": "Candidate labels for streaming.progress.label=\"auto\". Leave unset to use
|
|
955
|
+
"help": "Candidate labels for streaming.progress.label=\"auto\". Leave unset to use the built-in \"Working\" label."
|
|
945
956
|
},
|
|
946
957
|
"streaming.progress.maxLines": {
|
|
947
958
|
"label": "Matrix Progress Max Lines",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/matrix",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.2-beta.2",
|
|
4
4
|
"description": "OpenClaw Matrix channel plugin for rooms and direct messages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"zod": "4.4.3"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"openclaw": ">=2026.7.
|
|
21
|
+
"openclaw": ">=2026.7.2-beta.2"
|
|
22
22
|
},
|
|
23
23
|
"peerDependenciesMeta": {
|
|
24
24
|
"openclaw": {
|
|
@@ -84,10 +84,10 @@
|
|
|
84
84
|
"allowInvalidConfigRecovery": true
|
|
85
85
|
},
|
|
86
86
|
"compat": {
|
|
87
|
-
"pluginApi": ">=2026.7.
|
|
87
|
+
"pluginApi": ">=2026.7.2-beta.2"
|
|
88
88
|
},
|
|
89
89
|
"build": {
|
|
90
|
-
"openclawVersion": "2026.7.
|
|
90
|
+
"openclawVersion": "2026.7.2-beta.2"
|
|
91
91
|
},
|
|
92
92
|
"release": {
|
|
93
93
|
"publishToClawHub": true,
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { n as getOptionalMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import { createApprovalReactionTargetStore } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
3
|
-
//#region extensions/matrix/src/approval-reactions.ts
|
|
4
|
-
const MATRIX_APPROVAL_REACTION_META = {
|
|
5
|
-
"allow-once": {
|
|
6
|
-
emoji: "✅",
|
|
7
|
-
label: "Allow once"
|
|
8
|
-
},
|
|
9
|
-
"allow-always": {
|
|
10
|
-
emoji: "♾️",
|
|
11
|
-
label: "Allow always"
|
|
12
|
-
},
|
|
13
|
-
deny: {
|
|
14
|
-
emoji: "❌",
|
|
15
|
-
label: "Deny"
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const MATRIX_APPROVAL_REACTION_ORDER = [
|
|
19
|
-
"allow-once",
|
|
20
|
-
"allow-always",
|
|
21
|
-
"deny"
|
|
22
|
-
];
|
|
23
|
-
const PERSISTENT_NAMESPACE = "matrix.approval-reactions";
|
|
24
|
-
const PERSISTENT_MAX_ENTRIES = 1e3;
|
|
25
|
-
const DEFAULT_REACTION_TARGET_TTL_MS = 1440 * 60 * 1e3;
|
|
26
|
-
function reportPersistentApprovalReactionError(error) {
|
|
27
|
-
try {
|
|
28
|
-
getOptionalMatrixRuntime()?.logging.getChildLogger({
|
|
29
|
-
plugin: "matrix",
|
|
30
|
-
feature: "approval-reaction-state"
|
|
31
|
-
}).warn("Matrix persistent approval reaction state failed", { error: String(error) });
|
|
32
|
-
} catch {}
|
|
33
|
-
}
|
|
34
|
-
function readPersistedTarget(target) {
|
|
35
|
-
const value = target;
|
|
36
|
-
if (!value || typeof value.approvalId !== "string" || !Array.isArray(value.allowedDecisions)) return null;
|
|
37
|
-
return {
|
|
38
|
-
approvalId: value.approvalId,
|
|
39
|
-
allowedDecisions: value.allowedDecisions
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const matrixApprovalReactionTargets = createApprovalReactionTargetStore({
|
|
43
|
-
namespace: PERSISTENT_NAMESPACE,
|
|
44
|
-
maxEntries: PERSISTENT_MAX_ENTRIES,
|
|
45
|
-
defaultTtlMs: DEFAULT_REACTION_TARGET_TTL_MS,
|
|
46
|
-
openStore: (storeParams) => getOptionalMatrixRuntime()?.state.openKeyedStore(storeParams),
|
|
47
|
-
logPersistentError: reportPersistentApprovalReactionError,
|
|
48
|
-
readPersistedTarget
|
|
49
|
-
});
|
|
50
|
-
function buildReactionTargetKey(roomId, eventId) {
|
|
51
|
-
const normalizedRoomId = roomId.trim();
|
|
52
|
-
const normalizedEventId = eventId.trim();
|
|
53
|
-
if (!normalizedRoomId || !normalizedEventId) return null;
|
|
54
|
-
return `${normalizedRoomId}:${normalizedEventId}`;
|
|
55
|
-
}
|
|
56
|
-
function listMatrixApprovalReactionBindings(allowedDecisions) {
|
|
57
|
-
const allowed = new Set(allowedDecisions);
|
|
58
|
-
return MATRIX_APPROVAL_REACTION_ORDER.filter((decision) => allowed.has(decision)).map((decision) => ({
|
|
59
|
-
decision,
|
|
60
|
-
emoji: MATRIX_APPROVAL_REACTION_META[decision].emoji,
|
|
61
|
-
label: MATRIX_APPROVAL_REACTION_META[decision].label
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
function buildMatrixApprovalReactionHint(allowedDecisions) {
|
|
65
|
-
const bindings = listMatrixApprovalReactionBindings(allowedDecisions);
|
|
66
|
-
if (bindings.length === 0) return null;
|
|
67
|
-
return `React here: ${bindings.map((binding) => `${binding.emoji} ${binding.label}`).join(", ")}`;
|
|
68
|
-
}
|
|
69
|
-
function resolveMatrixApprovalReactionDecision(reactionKey, allowedDecisions) {
|
|
70
|
-
const normalizedReaction = reactionKey.trim();
|
|
71
|
-
if (!normalizedReaction) return null;
|
|
72
|
-
const allowed = new Set(allowedDecisions);
|
|
73
|
-
for (const decision of MATRIX_APPROVAL_REACTION_ORDER) {
|
|
74
|
-
if (!allowed.has(decision)) continue;
|
|
75
|
-
if (MATRIX_APPROVAL_REACTION_META[decision].emoji === normalizedReaction) return decision;
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
function registerMatrixApprovalReactionTarget(params) {
|
|
80
|
-
const key = buildReactionTargetKey(params.roomId, params.eventId);
|
|
81
|
-
const approvalId = params.approvalId.trim();
|
|
82
|
-
const allowedDecisions = Array.from(new Set(params.allowedDecisions.filter((decision) => decision === "allow-once" || decision === "allow-always" || decision === "deny")));
|
|
83
|
-
if (!key || !approvalId || allowedDecisions.length === 0) return;
|
|
84
|
-
matrixApprovalReactionTargets.register(key, {
|
|
85
|
-
approvalId,
|
|
86
|
-
allowedDecisions
|
|
87
|
-
}, { ttlMs: params.ttlMs });
|
|
88
|
-
}
|
|
89
|
-
function unregisterMatrixApprovalReactionTarget(params) {
|
|
90
|
-
const key = buildReactionTargetKey(params.roomId, params.eventId);
|
|
91
|
-
if (!key) return;
|
|
92
|
-
matrixApprovalReactionTargets.delete(key);
|
|
93
|
-
}
|
|
94
|
-
function resolveTarget(params) {
|
|
95
|
-
const target = params.target;
|
|
96
|
-
if (!target) return null;
|
|
97
|
-
const decision = resolveMatrixApprovalReactionDecision(params.reactionKey, target.allowedDecisions);
|
|
98
|
-
if (!decision) return null;
|
|
99
|
-
return {
|
|
100
|
-
approvalId: target.approvalId,
|
|
101
|
-
decision
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
async function resolveMatrixApprovalReactionTargetWithPersistence(params) {
|
|
105
|
-
const key = buildReactionTargetKey(params.roomId, params.eventId);
|
|
106
|
-
if (!key) return null;
|
|
107
|
-
return resolveTarget({
|
|
108
|
-
target: await matrixApprovalReactionTargets.lookup(key),
|
|
109
|
-
reactionKey: params.reactionKey
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
//#endregion
|
|
113
|
-
export { unregisterMatrixApprovalReactionTarget as a, resolveMatrixApprovalReactionTargetWithPersistence as i, listMatrixApprovalReactionBindings as n, registerMatrixApprovalReactionTarget as r, buildMatrixApprovalReactionHint as t };
|