@helyx/bot 0.4.11 → 0.4.13
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/CHANGELOG.md +33 -0
- package/dist/control-server.d.ts +38 -3
- package/dist/control-server.js +124 -5
- package/dist/events.d.ts +29 -1
- package/dist/events.js +786 -2
- package/dist/guilds.d.ts +20 -1
- package/dist/guilds.js +149 -9
- package/dist/index.js +21 -5
- package/dist/interactions.js +22 -6
- package/dist/management-module.d.ts +1 -1
- package/dist/shard-contracts.d.ts +324 -0
- package/dist/shard-contracts.js +47 -2
- package/dist/shard-router.d.ts +3 -0
- package/dist/shard-router.js +42 -0
- package/dist/shard-supervisor.d.ts +2 -0
- package/dist/shard-supervisor.js +54 -6
- package/dist/shard-worker.d.ts +6 -0
- package/dist/shard-worker.js +23 -6
- package/dist/verification-service.d.ts +50 -0
- package/dist/verification-service.js +166 -0
- package/package.json +10 -9
|
@@ -169,6 +169,10 @@ export type ShardHealthSnapshot = z.infer<typeof shardHealthSnapshotSchema>;
|
|
|
169
169
|
export declare const shardControlOperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
170
170
|
kind: z.ZodLiteral<"guild.state.get">;
|
|
171
171
|
guildId: z.ZodString;
|
|
172
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
173
|
+
kind: z.ZodLiteral<"guild.presence.list">;
|
|
174
|
+
guildIds: z.ZodArray<z.ZodString>;
|
|
175
|
+
correlationId: z.ZodUUID;
|
|
172
176
|
}, z.core.$strict>, z.ZodObject<{
|
|
173
177
|
actorUserId: z.ZodString;
|
|
174
178
|
correlationId: z.ZodString;
|
|
@@ -234,6 +238,16 @@ export declare const shardControlOperationSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
234
238
|
guildId: z.ZodString;
|
|
235
239
|
moduleId: z.ZodString;
|
|
236
240
|
actionId: z.ZodString;
|
|
241
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
242
|
+
kind: z.ZodLiteral<"guild.module.resource.access">;
|
|
243
|
+
guildId: z.ZodString;
|
|
244
|
+
moduleId: z.ZodString;
|
|
245
|
+
resourceType: z.ZodString;
|
|
246
|
+
operation: z.ZodEnum<{
|
|
247
|
+
list: "list";
|
|
248
|
+
read: "read";
|
|
249
|
+
}>;
|
|
250
|
+
actorUserId: z.ZodString;
|
|
237
251
|
}, z.core.$strict>, z.ZodObject<{
|
|
238
252
|
actorUserId: z.ZodString;
|
|
239
253
|
correlationId: z.ZodString;
|
|
@@ -338,6 +352,100 @@ export declare const shardControlOperationSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
338
352
|
readonly dashboard_security: "dashboard_security";
|
|
339
353
|
readonly discord_command: "discord_command";
|
|
340
354
|
}>;
|
|
355
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
356
|
+
kind: z.ZodLiteral<"verification.result.accept">;
|
|
357
|
+
envelope: z.ZodObject<{
|
|
358
|
+
payload: z.ZodObject<{
|
|
359
|
+
protocolVersion: z.ZodLiteral<"1.0">;
|
|
360
|
+
scoreVersion: z.ZodString;
|
|
361
|
+
policyVersion: z.ZodString;
|
|
362
|
+
installationId: z.ZodUUID;
|
|
363
|
+
deploymentSourceClassification: z.ZodEnum<{
|
|
364
|
+
helyx_hosted: "helyx_hosted";
|
|
365
|
+
self_hosted_reported: "self_hosted_reported";
|
|
366
|
+
}>;
|
|
367
|
+
evidenceSources: z.ZodObject<{
|
|
368
|
+
discord: z.ZodEnum<{
|
|
369
|
+
helyx_hosted: "helyx_hosted";
|
|
370
|
+
self_hosted_reported: "self_hosted_reported";
|
|
371
|
+
}>;
|
|
372
|
+
browser: z.ZodLiteral<"helyx_observed_web">;
|
|
373
|
+
network: z.ZodLiteral<"provider_observed">;
|
|
374
|
+
}, z.core.$strict>;
|
|
375
|
+
guildId: z.ZodString;
|
|
376
|
+
userId: z.ZodString;
|
|
377
|
+
challengeId: z.ZodUUID;
|
|
378
|
+
attemptId: z.ZodUUID;
|
|
379
|
+
decision: z.ZodEnum<{
|
|
380
|
+
pass: "pass";
|
|
381
|
+
review: "review";
|
|
382
|
+
deny: "deny";
|
|
383
|
+
temporary_failure: "temporary_failure";
|
|
384
|
+
}>;
|
|
385
|
+
riskScore: z.ZodNullable<z.ZodNumber>;
|
|
386
|
+
riskBand: z.ZodEnum<{
|
|
387
|
+
low: "low";
|
|
388
|
+
medium: "medium";
|
|
389
|
+
high: "high";
|
|
390
|
+
incomplete: "incomplete";
|
|
391
|
+
}>;
|
|
392
|
+
reasonCodes: z.ZodArray<z.ZodEnum<{
|
|
393
|
+
"network.proxy": "network.proxy";
|
|
394
|
+
"network.vpn": "network.vpn";
|
|
395
|
+
"network.compromised": "network.compromised";
|
|
396
|
+
"network.scraper": "network.scraper";
|
|
397
|
+
"network.tor": "network.tor";
|
|
398
|
+
"network.hosting": "network.hosting";
|
|
399
|
+
"network.anonymous": "network.anonymous";
|
|
400
|
+
"network.country_policy": "network.country_policy";
|
|
401
|
+
"account.too_new": "account.too_new";
|
|
402
|
+
"account.name_quarantined": "account.name_quarantined";
|
|
403
|
+
"relationship.exact_device_server_enforced": "relationship.exact_device_server_enforced";
|
|
404
|
+
"relationship.strong_server_enforced": "relationship.strong_server_enforced";
|
|
405
|
+
"relationship.exact_device": "relationship.exact_device";
|
|
406
|
+
"relationship.strong": "relationship.strong";
|
|
407
|
+
"relationship.possible": "relationship.possible";
|
|
408
|
+
"relationship.ip_only": "relationship.ip_only";
|
|
409
|
+
"abuse.concurrent_submission": "abuse.concurrent_submission";
|
|
410
|
+
"abuse.token_replay": "abuse.token_replay";
|
|
411
|
+
"trust.prior_server_success": "trust.prior_server_success";
|
|
412
|
+
"trust.other_server_success": "trust.other_server_success";
|
|
413
|
+
"trust.reviewed_public_flag": "trust.reviewed_public_flag";
|
|
414
|
+
"rule.account_age": "rule.account_age";
|
|
415
|
+
"rule.network_category": "rule.network_category";
|
|
416
|
+
"rule.country": "rule.country";
|
|
417
|
+
"rule.banned_account_relationship": "rule.banned_account_relationship";
|
|
418
|
+
"evidence.network_incomplete": "evidence.network_incomplete";
|
|
419
|
+
"service.temporary_failure": "service.temporary_failure";
|
|
420
|
+
}>>;
|
|
421
|
+
overridingRule: z.ZodOptional<z.ZodEnum<{
|
|
422
|
+
"rule.account_age": "rule.account_age";
|
|
423
|
+
"rule.network_category": "rule.network_category";
|
|
424
|
+
"rule.country": "rule.country";
|
|
425
|
+
"rule.banned_account_relationship": "rule.banned_account_relationship";
|
|
426
|
+
}>>;
|
|
427
|
+
actionBoundary: z.ZodObject<{
|
|
428
|
+
recommendedAction: z.ZodEnum<{
|
|
429
|
+
none: "none";
|
|
430
|
+
grant_role: "grant_role";
|
|
431
|
+
kick: "kick";
|
|
432
|
+
ban: "ban";
|
|
433
|
+
}>;
|
|
434
|
+
allowedActions: z.ZodArray<z.ZodEnum<{
|
|
435
|
+
none: "none";
|
|
436
|
+
grant_role: "grant_role";
|
|
437
|
+
kick: "kick";
|
|
438
|
+
ban: "ban";
|
|
439
|
+
}>>;
|
|
440
|
+
}, z.core.$strict>;
|
|
441
|
+
issuedAt: z.ZodISODateTime;
|
|
442
|
+
expiresAt: z.ZodISODateTime;
|
|
443
|
+
resultNonce: z.ZodString;
|
|
444
|
+
}, z.core.$strict>;
|
|
445
|
+
signature: z.ZodString;
|
|
446
|
+
keyId: z.ZodString;
|
|
447
|
+
algorithm: z.ZodLiteral<"Ed25519">;
|
|
448
|
+
}, z.core.$strict>;
|
|
341
449
|
}, z.core.$strict>, z.ZodObject<{
|
|
342
450
|
kind: z.ZodLiteral<"privacy.providers.list">;
|
|
343
451
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -368,6 +476,10 @@ export declare const shardControlRequestSchema: z.ZodObject<{
|
|
|
368
476
|
operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
369
477
|
kind: z.ZodLiteral<"guild.state.get">;
|
|
370
478
|
guildId: z.ZodString;
|
|
479
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
480
|
+
kind: z.ZodLiteral<"guild.presence.list">;
|
|
481
|
+
guildIds: z.ZodArray<z.ZodString>;
|
|
482
|
+
correlationId: z.ZodUUID;
|
|
371
483
|
}, z.core.$strict>, z.ZodObject<{
|
|
372
484
|
actorUserId: z.ZodString;
|
|
373
485
|
correlationId: z.ZodString;
|
|
@@ -433,6 +545,16 @@ export declare const shardControlRequestSchema: z.ZodObject<{
|
|
|
433
545
|
guildId: z.ZodString;
|
|
434
546
|
moduleId: z.ZodString;
|
|
435
547
|
actionId: z.ZodString;
|
|
548
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
549
|
+
kind: z.ZodLiteral<"guild.module.resource.access">;
|
|
550
|
+
guildId: z.ZodString;
|
|
551
|
+
moduleId: z.ZodString;
|
|
552
|
+
resourceType: z.ZodString;
|
|
553
|
+
operation: z.ZodEnum<{
|
|
554
|
+
list: "list";
|
|
555
|
+
read: "read";
|
|
556
|
+
}>;
|
|
557
|
+
actorUserId: z.ZodString;
|
|
436
558
|
}, z.core.$strict>, z.ZodObject<{
|
|
437
559
|
actorUserId: z.ZodString;
|
|
438
560
|
correlationId: z.ZodString;
|
|
@@ -537,6 +659,100 @@ export declare const shardControlRequestSchema: z.ZodObject<{
|
|
|
537
659
|
readonly dashboard_security: "dashboard_security";
|
|
538
660
|
readonly discord_command: "discord_command";
|
|
539
661
|
}>;
|
|
662
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
663
|
+
kind: z.ZodLiteral<"verification.result.accept">;
|
|
664
|
+
envelope: z.ZodObject<{
|
|
665
|
+
payload: z.ZodObject<{
|
|
666
|
+
protocolVersion: z.ZodLiteral<"1.0">;
|
|
667
|
+
scoreVersion: z.ZodString;
|
|
668
|
+
policyVersion: z.ZodString;
|
|
669
|
+
installationId: z.ZodUUID;
|
|
670
|
+
deploymentSourceClassification: z.ZodEnum<{
|
|
671
|
+
helyx_hosted: "helyx_hosted";
|
|
672
|
+
self_hosted_reported: "self_hosted_reported";
|
|
673
|
+
}>;
|
|
674
|
+
evidenceSources: z.ZodObject<{
|
|
675
|
+
discord: z.ZodEnum<{
|
|
676
|
+
helyx_hosted: "helyx_hosted";
|
|
677
|
+
self_hosted_reported: "self_hosted_reported";
|
|
678
|
+
}>;
|
|
679
|
+
browser: z.ZodLiteral<"helyx_observed_web">;
|
|
680
|
+
network: z.ZodLiteral<"provider_observed">;
|
|
681
|
+
}, z.core.$strict>;
|
|
682
|
+
guildId: z.ZodString;
|
|
683
|
+
userId: z.ZodString;
|
|
684
|
+
challengeId: z.ZodUUID;
|
|
685
|
+
attemptId: z.ZodUUID;
|
|
686
|
+
decision: z.ZodEnum<{
|
|
687
|
+
pass: "pass";
|
|
688
|
+
review: "review";
|
|
689
|
+
deny: "deny";
|
|
690
|
+
temporary_failure: "temporary_failure";
|
|
691
|
+
}>;
|
|
692
|
+
riskScore: z.ZodNullable<z.ZodNumber>;
|
|
693
|
+
riskBand: z.ZodEnum<{
|
|
694
|
+
low: "low";
|
|
695
|
+
medium: "medium";
|
|
696
|
+
high: "high";
|
|
697
|
+
incomplete: "incomplete";
|
|
698
|
+
}>;
|
|
699
|
+
reasonCodes: z.ZodArray<z.ZodEnum<{
|
|
700
|
+
"network.proxy": "network.proxy";
|
|
701
|
+
"network.vpn": "network.vpn";
|
|
702
|
+
"network.compromised": "network.compromised";
|
|
703
|
+
"network.scraper": "network.scraper";
|
|
704
|
+
"network.tor": "network.tor";
|
|
705
|
+
"network.hosting": "network.hosting";
|
|
706
|
+
"network.anonymous": "network.anonymous";
|
|
707
|
+
"network.country_policy": "network.country_policy";
|
|
708
|
+
"account.too_new": "account.too_new";
|
|
709
|
+
"account.name_quarantined": "account.name_quarantined";
|
|
710
|
+
"relationship.exact_device_server_enforced": "relationship.exact_device_server_enforced";
|
|
711
|
+
"relationship.strong_server_enforced": "relationship.strong_server_enforced";
|
|
712
|
+
"relationship.exact_device": "relationship.exact_device";
|
|
713
|
+
"relationship.strong": "relationship.strong";
|
|
714
|
+
"relationship.possible": "relationship.possible";
|
|
715
|
+
"relationship.ip_only": "relationship.ip_only";
|
|
716
|
+
"abuse.concurrent_submission": "abuse.concurrent_submission";
|
|
717
|
+
"abuse.token_replay": "abuse.token_replay";
|
|
718
|
+
"trust.prior_server_success": "trust.prior_server_success";
|
|
719
|
+
"trust.other_server_success": "trust.other_server_success";
|
|
720
|
+
"trust.reviewed_public_flag": "trust.reviewed_public_flag";
|
|
721
|
+
"rule.account_age": "rule.account_age";
|
|
722
|
+
"rule.network_category": "rule.network_category";
|
|
723
|
+
"rule.country": "rule.country";
|
|
724
|
+
"rule.banned_account_relationship": "rule.banned_account_relationship";
|
|
725
|
+
"evidence.network_incomplete": "evidence.network_incomplete";
|
|
726
|
+
"service.temporary_failure": "service.temporary_failure";
|
|
727
|
+
}>>;
|
|
728
|
+
overridingRule: z.ZodOptional<z.ZodEnum<{
|
|
729
|
+
"rule.account_age": "rule.account_age";
|
|
730
|
+
"rule.network_category": "rule.network_category";
|
|
731
|
+
"rule.country": "rule.country";
|
|
732
|
+
"rule.banned_account_relationship": "rule.banned_account_relationship";
|
|
733
|
+
}>>;
|
|
734
|
+
actionBoundary: z.ZodObject<{
|
|
735
|
+
recommendedAction: z.ZodEnum<{
|
|
736
|
+
none: "none";
|
|
737
|
+
grant_role: "grant_role";
|
|
738
|
+
kick: "kick";
|
|
739
|
+
ban: "ban";
|
|
740
|
+
}>;
|
|
741
|
+
allowedActions: z.ZodArray<z.ZodEnum<{
|
|
742
|
+
none: "none";
|
|
743
|
+
grant_role: "grant_role";
|
|
744
|
+
kick: "kick";
|
|
745
|
+
ban: "ban";
|
|
746
|
+
}>>;
|
|
747
|
+
}, z.core.$strict>;
|
|
748
|
+
issuedAt: z.ZodISODateTime;
|
|
749
|
+
expiresAt: z.ZodISODateTime;
|
|
750
|
+
resultNonce: z.ZodString;
|
|
751
|
+
}, z.core.$strict>;
|
|
752
|
+
signature: z.ZodString;
|
|
753
|
+
keyId: z.ZodString;
|
|
754
|
+
algorithm: z.ZodLiteral<"Ed25519">;
|
|
755
|
+
}, z.core.$strict>;
|
|
540
756
|
}, z.core.$strict>, z.ZodObject<{
|
|
541
757
|
kind: z.ZodLiteral<"privacy.providers.list">;
|
|
542
758
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1072,6 +1288,10 @@ export declare const supervisorMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1072
1288
|
operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1073
1289
|
kind: z.ZodLiteral<"guild.state.get">;
|
|
1074
1290
|
guildId: z.ZodString;
|
|
1291
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1292
|
+
kind: z.ZodLiteral<"guild.presence.list">;
|
|
1293
|
+
guildIds: z.ZodArray<z.ZodString>;
|
|
1294
|
+
correlationId: z.ZodUUID;
|
|
1075
1295
|
}, z.core.$strict>, z.ZodObject<{
|
|
1076
1296
|
actorUserId: z.ZodString;
|
|
1077
1297
|
correlationId: z.ZodString;
|
|
@@ -1137,6 +1357,16 @@ export declare const supervisorMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1137
1357
|
guildId: z.ZodString;
|
|
1138
1358
|
moduleId: z.ZodString;
|
|
1139
1359
|
actionId: z.ZodString;
|
|
1360
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1361
|
+
kind: z.ZodLiteral<"guild.module.resource.access">;
|
|
1362
|
+
guildId: z.ZodString;
|
|
1363
|
+
moduleId: z.ZodString;
|
|
1364
|
+
resourceType: z.ZodString;
|
|
1365
|
+
operation: z.ZodEnum<{
|
|
1366
|
+
list: "list";
|
|
1367
|
+
read: "read";
|
|
1368
|
+
}>;
|
|
1369
|
+
actorUserId: z.ZodString;
|
|
1140
1370
|
}, z.core.$strict>, z.ZodObject<{
|
|
1141
1371
|
actorUserId: z.ZodString;
|
|
1142
1372
|
correlationId: z.ZodString;
|
|
@@ -1241,6 +1471,100 @@ export declare const supervisorMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1241
1471
|
readonly dashboard_security: "dashboard_security";
|
|
1242
1472
|
readonly discord_command: "discord_command";
|
|
1243
1473
|
}>;
|
|
1474
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1475
|
+
kind: z.ZodLiteral<"verification.result.accept">;
|
|
1476
|
+
envelope: z.ZodObject<{
|
|
1477
|
+
payload: z.ZodObject<{
|
|
1478
|
+
protocolVersion: z.ZodLiteral<"1.0">;
|
|
1479
|
+
scoreVersion: z.ZodString;
|
|
1480
|
+
policyVersion: z.ZodString;
|
|
1481
|
+
installationId: z.ZodUUID;
|
|
1482
|
+
deploymentSourceClassification: z.ZodEnum<{
|
|
1483
|
+
helyx_hosted: "helyx_hosted";
|
|
1484
|
+
self_hosted_reported: "self_hosted_reported";
|
|
1485
|
+
}>;
|
|
1486
|
+
evidenceSources: z.ZodObject<{
|
|
1487
|
+
discord: z.ZodEnum<{
|
|
1488
|
+
helyx_hosted: "helyx_hosted";
|
|
1489
|
+
self_hosted_reported: "self_hosted_reported";
|
|
1490
|
+
}>;
|
|
1491
|
+
browser: z.ZodLiteral<"helyx_observed_web">;
|
|
1492
|
+
network: z.ZodLiteral<"provider_observed">;
|
|
1493
|
+
}, z.core.$strict>;
|
|
1494
|
+
guildId: z.ZodString;
|
|
1495
|
+
userId: z.ZodString;
|
|
1496
|
+
challengeId: z.ZodUUID;
|
|
1497
|
+
attemptId: z.ZodUUID;
|
|
1498
|
+
decision: z.ZodEnum<{
|
|
1499
|
+
pass: "pass";
|
|
1500
|
+
review: "review";
|
|
1501
|
+
deny: "deny";
|
|
1502
|
+
temporary_failure: "temporary_failure";
|
|
1503
|
+
}>;
|
|
1504
|
+
riskScore: z.ZodNullable<z.ZodNumber>;
|
|
1505
|
+
riskBand: z.ZodEnum<{
|
|
1506
|
+
low: "low";
|
|
1507
|
+
medium: "medium";
|
|
1508
|
+
high: "high";
|
|
1509
|
+
incomplete: "incomplete";
|
|
1510
|
+
}>;
|
|
1511
|
+
reasonCodes: z.ZodArray<z.ZodEnum<{
|
|
1512
|
+
"network.proxy": "network.proxy";
|
|
1513
|
+
"network.vpn": "network.vpn";
|
|
1514
|
+
"network.compromised": "network.compromised";
|
|
1515
|
+
"network.scraper": "network.scraper";
|
|
1516
|
+
"network.tor": "network.tor";
|
|
1517
|
+
"network.hosting": "network.hosting";
|
|
1518
|
+
"network.anonymous": "network.anonymous";
|
|
1519
|
+
"network.country_policy": "network.country_policy";
|
|
1520
|
+
"account.too_new": "account.too_new";
|
|
1521
|
+
"account.name_quarantined": "account.name_quarantined";
|
|
1522
|
+
"relationship.exact_device_server_enforced": "relationship.exact_device_server_enforced";
|
|
1523
|
+
"relationship.strong_server_enforced": "relationship.strong_server_enforced";
|
|
1524
|
+
"relationship.exact_device": "relationship.exact_device";
|
|
1525
|
+
"relationship.strong": "relationship.strong";
|
|
1526
|
+
"relationship.possible": "relationship.possible";
|
|
1527
|
+
"relationship.ip_only": "relationship.ip_only";
|
|
1528
|
+
"abuse.concurrent_submission": "abuse.concurrent_submission";
|
|
1529
|
+
"abuse.token_replay": "abuse.token_replay";
|
|
1530
|
+
"trust.prior_server_success": "trust.prior_server_success";
|
|
1531
|
+
"trust.other_server_success": "trust.other_server_success";
|
|
1532
|
+
"trust.reviewed_public_flag": "trust.reviewed_public_flag";
|
|
1533
|
+
"rule.account_age": "rule.account_age";
|
|
1534
|
+
"rule.network_category": "rule.network_category";
|
|
1535
|
+
"rule.country": "rule.country";
|
|
1536
|
+
"rule.banned_account_relationship": "rule.banned_account_relationship";
|
|
1537
|
+
"evidence.network_incomplete": "evidence.network_incomplete";
|
|
1538
|
+
"service.temporary_failure": "service.temporary_failure";
|
|
1539
|
+
}>>;
|
|
1540
|
+
overridingRule: z.ZodOptional<z.ZodEnum<{
|
|
1541
|
+
"rule.account_age": "rule.account_age";
|
|
1542
|
+
"rule.network_category": "rule.network_category";
|
|
1543
|
+
"rule.country": "rule.country";
|
|
1544
|
+
"rule.banned_account_relationship": "rule.banned_account_relationship";
|
|
1545
|
+
}>>;
|
|
1546
|
+
actionBoundary: z.ZodObject<{
|
|
1547
|
+
recommendedAction: z.ZodEnum<{
|
|
1548
|
+
none: "none";
|
|
1549
|
+
grant_role: "grant_role";
|
|
1550
|
+
kick: "kick";
|
|
1551
|
+
ban: "ban";
|
|
1552
|
+
}>;
|
|
1553
|
+
allowedActions: z.ZodArray<z.ZodEnum<{
|
|
1554
|
+
none: "none";
|
|
1555
|
+
grant_role: "grant_role";
|
|
1556
|
+
kick: "kick";
|
|
1557
|
+
ban: "ban";
|
|
1558
|
+
}>>;
|
|
1559
|
+
}, z.core.$strict>;
|
|
1560
|
+
issuedAt: z.ZodISODateTime;
|
|
1561
|
+
expiresAt: z.ZodISODateTime;
|
|
1562
|
+
resultNonce: z.ZodString;
|
|
1563
|
+
}, z.core.$strict>;
|
|
1564
|
+
signature: z.ZodString;
|
|
1565
|
+
keyId: z.ZodString;
|
|
1566
|
+
algorithm: z.ZodLiteral<"Ed25519">;
|
|
1567
|
+
}, z.core.$strict>;
|
|
1244
1568
|
}, z.core.$strict>, z.ZodObject<{
|
|
1245
1569
|
kind: z.ZodLiteral<"privacy.providers.list">;
|
|
1246
1570
|
}, z.core.$strict>, z.ZodObject<{
|
package/dist/shard-contracts.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { signedAssessmentEnvelopeSchema } from "@helyx/verification-contracts";
|
|
2
3
|
export const SHARD_CONTRACT_VERSION = 1;
|
|
3
4
|
// Guild dashboard state includes the bounded module catalogue as well as the
|
|
4
5
|
// guild's Discord resources. Keep this aligned with the cloud-control message
|
|
@@ -61,7 +62,7 @@ const managedResourceObject = z
|
|
|
61
62
|
.refine(hasBoundedManagedResourceBytes);
|
|
62
63
|
const managedResourceFilters = z
|
|
63
64
|
.record(z.string().regex(/^[a-z][a-zA-Z0-9_]*$/u), z.string().trim().min(1).max(100))
|
|
64
|
-
.refine((value) => Object.keys(value).length <=
|
|
65
|
+
.refine((value) => Object.keys(value).length <= 8);
|
|
65
66
|
const scheduledTaskPayload = z
|
|
66
67
|
.record(z.string().regex(/^[a-z][A-Za-z0-9]{0,62}Id$/u), z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/u))
|
|
67
68
|
.refine((value) => Object.keys(value).length <= 20)
|
|
@@ -221,6 +222,13 @@ export const shardHealthSnapshotSchema = z
|
|
|
221
222
|
});
|
|
222
223
|
export const shardControlOperationSchema = z.discriminatedUnion("kind", [
|
|
223
224
|
z.object({ kind: z.literal("guild.state.get"), guildId: snowflake }).strict(),
|
|
225
|
+
z
|
|
226
|
+
.object({
|
|
227
|
+
kind: z.literal("guild.presence.list"),
|
|
228
|
+
guildIds: z.array(snowflake).min(1).max(200),
|
|
229
|
+
correlationId: z.uuid(),
|
|
230
|
+
})
|
|
231
|
+
.strict(),
|
|
224
232
|
z
|
|
225
233
|
.object({
|
|
226
234
|
kind: z.literal("guild.module.status.set"),
|
|
@@ -269,6 +277,16 @@ export const shardControlOperationSchema = z.discriminatedUnion("kind", [
|
|
|
269
277
|
...mutationContext.shape,
|
|
270
278
|
})
|
|
271
279
|
.strict(),
|
|
280
|
+
z
|
|
281
|
+
.object({
|
|
282
|
+
kind: z.literal("guild.module.resource.access"),
|
|
283
|
+
guildId: snowflake,
|
|
284
|
+
moduleId,
|
|
285
|
+
resourceType,
|
|
286
|
+
operation: z.enum(["list", "read"]),
|
|
287
|
+
actorUserId: snowflake,
|
|
288
|
+
})
|
|
289
|
+
.strict(),
|
|
272
290
|
z
|
|
273
291
|
.object({
|
|
274
292
|
kind: z.literal("guild.module.resource.list"),
|
|
@@ -391,6 +409,12 @@ export const shardControlOperationSchema = z.discriminatedUnion("kind", [
|
|
|
391
409
|
}),
|
|
392
410
|
})
|
|
393
411
|
.strict(),
|
|
412
|
+
z
|
|
413
|
+
.object({
|
|
414
|
+
kind: z.literal("verification.result.accept"),
|
|
415
|
+
envelope: signedAssessmentEnvelopeSchema,
|
|
416
|
+
})
|
|
417
|
+
.strict(),
|
|
394
418
|
z.object({ kind: z.literal("privacy.providers.list") }).strict(),
|
|
395
419
|
z
|
|
396
420
|
.object({
|
|
@@ -856,7 +880,13 @@ export function guildIdToShardId(guildId, shardCount) {
|
|
|
856
880
|
return Number((BigInt(parsedGuildId) >> 22n) % BigInt(shardCount));
|
|
857
881
|
}
|
|
858
882
|
export function controlOperationGuildId(operation) {
|
|
859
|
-
|
|
883
|
+
if ("guildId" in operation)
|
|
884
|
+
return operation.guildId;
|
|
885
|
+
if (operation.kind === "verification.result.accept")
|
|
886
|
+
return operation.envelope.payload.guildId;
|
|
887
|
+
return operation.kind === "guild.presence.list"
|
|
888
|
+
? operation.guildIds[0]
|
|
889
|
+
: undefined;
|
|
860
890
|
}
|
|
861
891
|
export function assertShardMessageSize(value) {
|
|
862
892
|
if (Buffer.byteLength(JSON.stringify(value), "utf8") > SHARD_CONTROL_MAX_BYTES)
|
|
@@ -864,8 +894,21 @@ export function assertShardMessageSize(value) {
|
|
|
864
894
|
}
|
|
865
895
|
export async function executeShardControlOperation(handler, operation) {
|
|
866
896
|
switch (operation.kind) {
|
|
897
|
+
case "guild.presence.list":
|
|
898
|
+
return handler.listGuildPresence({
|
|
899
|
+
guildIds: operation.guildIds,
|
|
900
|
+
correlationId: operation.correlationId,
|
|
901
|
+
});
|
|
867
902
|
case "guild.state.get":
|
|
868
903
|
return handler.getGuildState(operation.guildId);
|
|
904
|
+
case "guild.module.resource.access":
|
|
905
|
+
return handler.canAccessManagedResource({
|
|
906
|
+
guildId: operation.guildId,
|
|
907
|
+
moduleId: operation.moduleId,
|
|
908
|
+
resourceType: operation.resourceType,
|
|
909
|
+
operation: operation.operation,
|
|
910
|
+
actorUserId: operation.actorUserId,
|
|
911
|
+
});
|
|
869
912
|
case "guild.module.status.set": {
|
|
870
913
|
return handler.setModuleStatus({
|
|
871
914
|
guildId: operation.guildId,
|
|
@@ -1014,6 +1057,8 @@ export async function executeShardControlOperation(handler, operation) {
|
|
|
1014
1057
|
source: operation.source,
|
|
1015
1058
|
});
|
|
1016
1059
|
}
|
|
1060
|
+
case "verification.result.accept":
|
|
1061
|
+
return handler.acceptVerificationResult(operation.envelope);
|
|
1017
1062
|
case "privacy.providers.list":
|
|
1018
1063
|
return handler.listPrivacyProviders();
|
|
1019
1064
|
case "privacy.capture": {
|
package/dist/shard-router.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export declare class ShardControlRouter implements BotControlHandler {
|
|
|
16
16
|
notificationGuildId?: string;
|
|
17
17
|
});
|
|
18
18
|
getGuildState(guildId: string): ReturnType<BotControlHandler["getGuildState"]>;
|
|
19
|
+
canAccessManagedResource(input: Parameters<BotControlHandler["canAccessManagedResource"]>[0]): ReturnType<BotControlHandler["canAccessManagedResource"]>;
|
|
20
|
+
listGuildPresence(input: Parameters<BotControlHandler["listGuildPresence"]>[0]): ReturnType<BotControlHandler["listGuildPresence"]>;
|
|
19
21
|
setModuleStatus(input: Parameters<BotControlHandler["setModuleStatus"]>[0]): ReturnType<BotControlHandler["setModuleStatus"]>;
|
|
20
22
|
updateConfiguration(input: Parameters<BotControlHandler["updateConfiguration"]>[0]): ReturnType<BotControlHandler["updateConfiguration"]>;
|
|
21
23
|
updatePermissions(input: Parameters<BotControlHandler["updatePermissions"]>[0]): ReturnType<BotControlHandler["updatePermissions"]>;
|
|
@@ -30,6 +32,7 @@ export declare class ShardControlRouter implements BotControlHandler {
|
|
|
30
32
|
deleteManagedResource(input: Parameters<BotControlHandler["deleteManagedResource"]>[0]): ReturnType<BotControlHandler["deleteManagedResource"]>;
|
|
31
33
|
executeManagedResourceAction(input: Parameters<BotControlHandler["executeManagedResourceAction"]>[0]): ReturnType<BotControlHandler["executeManagedResourceAction"]>;
|
|
32
34
|
sendSupportNotification(input: Parameters<BotControlHandler["sendSupportNotification"]>[0]): ReturnType<BotControlHandler["sendSupportNotification"]>;
|
|
35
|
+
acceptVerificationResult(envelope: Parameters<BotControlHandler["acceptVerificationResult"]>[0]): ReturnType<BotControlHandler["acceptVerificationResult"]>;
|
|
33
36
|
listPrivacyProviders(): ReturnType<BotControlHandler["listPrivacyProviders"]>;
|
|
34
37
|
capturePrivacy(input: Parameters<BotControlHandler["capturePrivacy"]>[0]): ReturnType<BotControlHandler["capturePrivacy"]>;
|
|
35
38
|
erasePrivacy(input: Parameters<BotControlHandler["erasePrivacy"]>[0]): ReturnType<BotControlHandler["erasePrivacy"]>;
|
package/dist/shard-router.js
CHANGED
|
@@ -10,6 +10,42 @@ export class ShardControlRouter {
|
|
|
10
10
|
getGuildState(guildId) {
|
|
11
11
|
return this.#route({ kind: "guild.state.get", guildId });
|
|
12
12
|
}
|
|
13
|
+
canAccessManagedResource(input) {
|
|
14
|
+
return this.#route({
|
|
15
|
+
kind: "guild.module.resource.access",
|
|
16
|
+
...input,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async listGuildPresence(input) {
|
|
20
|
+
const observations = new Map();
|
|
21
|
+
const byShard = new Map();
|
|
22
|
+
for (const guildId of [...new Set(input.guildIds)]) {
|
|
23
|
+
const shardId = guildIdToShardId(guildId, this.input.shardCount);
|
|
24
|
+
const guildIds = byShard.get(shardId) ?? [];
|
|
25
|
+
guildIds.push(guildId);
|
|
26
|
+
byShard.set(shardId, guildIds);
|
|
27
|
+
}
|
|
28
|
+
await Promise.all([...byShard.values()].map(async (guildIds) => {
|
|
29
|
+
try {
|
|
30
|
+
const result = await this.#route({
|
|
31
|
+
kind: "guild.presence.list",
|
|
32
|
+
guildIds,
|
|
33
|
+
correlationId: input.correlationId,
|
|
34
|
+
});
|
|
35
|
+
for (const observation of result)
|
|
36
|
+
observations.set(observation.guildId, observation);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// A starting, draining, or reassigned shard is unknown, never absent.
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
const observedAt = new Date().toISOString();
|
|
43
|
+
return [...new Set(input.guildIds)].map((guildId) => observations.get(guildId) ?? {
|
|
44
|
+
guildId,
|
|
45
|
+
state: "unknown",
|
|
46
|
+
observedAt,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
13
49
|
setModuleStatus(input) {
|
|
14
50
|
return this.#route({ kind: "guild.module.status.set", ...input });
|
|
15
51
|
}
|
|
@@ -85,6 +121,12 @@ export class ShardControlRouter {
|
|
|
85
121
|
...input,
|
|
86
122
|
});
|
|
87
123
|
}
|
|
124
|
+
acceptVerificationResult(envelope) {
|
|
125
|
+
return this.#route({
|
|
126
|
+
kind: "verification.result.accept",
|
|
127
|
+
envelope,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
88
130
|
listPrivacyProviders() {
|
|
89
131
|
return this.#routeLeader({ kind: "privacy.providers.list" });
|
|
90
132
|
}
|
|
@@ -5,6 +5,7 @@ import { type ShardCloudRequest, type ShardIdentity, type ShardProcessHealth } f
|
|
|
5
5
|
import { type ShardCoordinator, type ShardGenerationDescriptor, type ShardLeaderLease, type ShardLease } from "./shard-coordinator.js";
|
|
6
6
|
import type { BotHandle } from "./index.js";
|
|
7
7
|
export declare const STEADY_STATE_LEASE_LOSS_BOUND_MS: number;
|
|
8
|
+
export declare function supervisorShutdownExitCode(reason: string): number | undefined;
|
|
8
9
|
export declare function createStartupWorkerHeartbeatMaintenance(heartbeat: () => void, intervalMs?: number): {
|
|
9
10
|
stop(): void;
|
|
10
11
|
};
|
|
@@ -20,6 +21,7 @@ export interface SteadyStateOwnershipRenewal {
|
|
|
20
21
|
leaderRenewed: boolean;
|
|
21
22
|
leaderAvailable: boolean;
|
|
22
23
|
}
|
|
24
|
+
export declare function retryOwnershipRenewal<T>(renew: () => Promise<T>, attempts?: number): Promise<T>;
|
|
23
25
|
export declare function selectFencedShardHealth(input: {
|
|
24
26
|
generation: string;
|
|
25
27
|
shardCount: number;
|