@helyx/bot 1.5.0 → 1.5.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/CHANGELOG.md +10 -0
- package/dist/command-registration-policy.js +1 -0
- package/dist/diagnostic-command.d.ts +76 -0
- package/dist/diagnostic-command.js +1962 -0
- package/dist/index.js +30 -1
- package/dist/shard-supervisor.js +7 -0
- package/dist/shard-worker.d.ts +1 -0
- package/dist/shard-worker.js +38 -1
- package/documentation/reference/environment.md +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add the server-scoped `/diag` command with administrator access, one active
|
|
8
|
+
run per server, guarded repair passes and fresh checks before reporting fixes.
|
|
9
|
+
Preserve records and configuration outside the explicitly supported repairs.
|
|
10
|
+
- Require PostgreSQL adapter 2.4.1 or MySQL adapter 0.2.1 for the active,
|
|
11
|
+
non-blacklisted server lookup used by diagnostic admission checks.
|
|
12
|
+
|
|
3
13
|
## 1.5.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { DatabasePool } from "@helyx/database";
|
|
2
|
+
import type { MysqlPool } from "@helyx/database-mysql";
|
|
3
|
+
import { type ModuleDefinition, type ModuleRecordService, type PermissionActor, type ServiceAccess } from "@helyx/sdk";
|
|
4
|
+
import { type Client } from "discord.js";
|
|
5
|
+
export interface DiagnosticIssue {
|
|
6
|
+
kind: "repairable" | "human" | "technical" | "incomplete";
|
|
7
|
+
message: string;
|
|
8
|
+
evidence?: Readonly<Record<string, unknown>>;
|
|
9
|
+
afterRepair?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DiagnosticProbe {
|
|
12
|
+
id: string;
|
|
13
|
+
moduleId?: string;
|
|
14
|
+
label: string;
|
|
15
|
+
inspect(this: void): Promise<DiagnosticIssue | null>;
|
|
16
|
+
repair?(round: 1 | 2, issue: DiagnosticIssue): Promise<"attempted" | "unchanged" | "stale">;
|
|
17
|
+
verify?(issue: DiagnosticIssue): Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
export interface DiagnosticLease {
|
|
20
|
+
signal: AbortSignal;
|
|
21
|
+
assertOwned(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export type DiagnosticRunExclusive = (guildId: string, operation: (lease: DiagnosticLease) => Promise<void>) => Promise<boolean>;
|
|
24
|
+
export interface DiagnosticResources {
|
|
25
|
+
actor(userId: string): Promise<PermissionActor>;
|
|
26
|
+
message(channelId: string, messageId: string): Promise<"present" | "absent" | "unknown">;
|
|
27
|
+
channel(channelId: string, types: readonly string[], permissions: readonly string[]): Promise<DiagnosticIssue | null>;
|
|
28
|
+
role(roleId: string, managed: boolean): Promise<DiagnosticIssue | null>;
|
|
29
|
+
capabilities(): {
|
|
30
|
+
guildMembers: boolean;
|
|
31
|
+
messageContent: boolean;
|
|
32
|
+
};
|
|
33
|
+
guildCommands?(): Promise<{
|
|
34
|
+
definitionHash: string;
|
|
35
|
+
rootCount: number;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
export interface DiagnosticModuleOptions {
|
|
39
|
+
modules: readonly ModuleDefinition[];
|
|
40
|
+
client?: Client;
|
|
41
|
+
resources?: (guildId: string) => DiagnosticResources;
|
|
42
|
+
runExclusive?: DiagnosticRunExclusive;
|
|
43
|
+
assertGuildAvailable?: (guildId: string) => Promise<void>;
|
|
44
|
+
listEnabledModules?: (guildId: string) => Promise<readonly {
|
|
45
|
+
moduleId: string;
|
|
46
|
+
}[]>;
|
|
47
|
+
commandStatus?: {
|
|
48
|
+
get(guildId: string): Promise<unknown>;
|
|
49
|
+
refresh(input: {
|
|
50
|
+
guildId: string;
|
|
51
|
+
actorUserId: string;
|
|
52
|
+
correlationId: string;
|
|
53
|
+
}): Promise<unknown>;
|
|
54
|
+
};
|
|
55
|
+
stageMilliseconds?: number;
|
|
56
|
+
maximumRunMilliseconds?: number;
|
|
57
|
+
}
|
|
58
|
+
export interface DiagnosticRecordEnvironment {
|
|
59
|
+
guildId: string;
|
|
60
|
+
actorUserId: string;
|
|
61
|
+
correlationId: string;
|
|
62
|
+
modules: readonly ModuleDefinition[];
|
|
63
|
+
records: ModuleRecordService;
|
|
64
|
+
services: ServiceAccess;
|
|
65
|
+
assertCanInspect(): Promise<void>;
|
|
66
|
+
assertCanMutate(moduleId: string): Promise<void>;
|
|
67
|
+
inspectMessage(channelId: string, messageId: string): Promise<"present" | "absent" | "unknown">;
|
|
68
|
+
now(): Date;
|
|
69
|
+
}
|
|
70
|
+
/** A core command, never a selectable module or a module-repair hook. */
|
|
71
|
+
export declare function createDiagnosticModule(options: DiagnosticModuleOptions): ModuleDefinition;
|
|
72
|
+
/** Reserve at most four sessions, leaving at least two pool slots for repairs. */
|
|
73
|
+
export declare function createPostgresDiagnosticLock(pool: DatabasePool): DiagnosticRunExclusive;
|
|
74
|
+
/** Reserve at most four sessions, leaving at least two pool slots for repairs. */
|
|
75
|
+
export declare function createMysqlDiagnosticLock(pool: MysqlPool): DiagnosticRunExclusive;
|
|
76
|
+
//# sourceMappingURL=diagnostic-command.d.ts.map
|