@elizaos/plugin-discord 2.0.3-beta.2 → 2.0.3-beta.4
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-client-pool.d.ts +35 -0
- package/dist/account-client-pool.d.ts.map +1 -0
- package/dist/accounts.d.ts +164 -0
- package/dist/accounts.d.ts.map +1 -0
- package/dist/actions/actionResultSemantics.d.ts +9 -0
- package/dist/actions/actionResultSemantics.d.ts.map +1 -0
- package/dist/actions/setup-credentials.d.ts +22 -0
- package/dist/actions/setup-credentials.d.ts.map +1 -0
- package/dist/addressing.d.ts +15 -0
- package/dist/addressing.d.ts.map +1 -0
- package/dist/allowlist.d.ts +198 -0
- package/dist/allowlist.d.ts.map +1 -0
- package/dist/attachments.d.ts +93 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/auto-enable.d.ts +4 -0
- package/dist/auto-enable.d.ts.map +1 -0
- package/dist/banner.d.ts +39 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/catalog-commands.d.ts +65 -0
- package/dist/catalog-commands.d.ts.map +1 -0
- package/dist/compat.d.ts +32 -0
- package/dist/compat.d.ts.map +1 -0
- package/dist/config.d.ts +156 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/connector-account-provider.d.ts +27 -0
- package/dist/connector-account-provider.d.ts.map +1 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/data-routes.d.ts +22 -0
- package/dist/data-routes.d.ts.map +1 -0
- package/dist/debouncer.d.ts +42 -0
- package/dist/debouncer.d.ts.map +1 -0
- package/dist/discord-avatar-cache.d.ts +10 -0
- package/dist/discord-avatar-cache.d.ts.map +1 -0
- package/dist/discord-commands.d.ts +16 -0
- package/dist/discord-commands.d.ts.map +1 -0
- package/dist/discord-events.d.ts +57 -0
- package/dist/discord-events.d.ts.map +1 -0
- package/dist/discord-history.d.ts +56 -0
- package/dist/discord-history.d.ts.map +1 -0
- package/dist/discord-interactions.d.ts +47 -0
- package/dist/discord-interactions.d.ts.map +1 -0
- package/dist/discord-local-service.d.ts +102 -0
- package/dist/discord-local-service.d.ts.map +1 -0
- package/dist/discord-profiles.d.ts +26 -0
- package/dist/discord-profiles.d.ts.map +1 -0
- package/dist/discord-reactions.d.ts +30 -0
- package/dist/discord-reactions.d.ts.map +1 -0
- package/dist/draft-chunking.d.ts +9 -0
- package/dist/draft-chunking.d.ts.map +1 -0
- package/dist/draft-stream.d.ts +23 -0
- package/dist/draft-stream.d.ts.map +1 -0
- package/dist/environment.d.ts +23 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/generated/specs/spec-helpers.d.ts +36 -0
- package/dist/generated/specs/spec-helpers.d.ts.map +1 -0
- package/dist/generated/specs/specs.d.ts +40 -0
- package/dist/generated/specs/specs.d.ts.map +1 -0
- package/dist/identity.d.ts +8 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/inbound-envelope.d.ts +15 -0
- package/dist/inbound-envelope.d.ts.map +1 -0
- package/dist/index.browser.d.ts +34 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14414 -0
- package/dist/index.js.map +59 -0
- package/dist/interactions.d.ts +35 -0
- package/dist/interactions.d.ts.map +1 -0
- package/dist/message-coalesce.d.ts +31 -0
- package/dist/message-coalesce.d.ts.map +1 -0
- package/dist/messages.d.ts +70 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messaging.d.ts +129 -0
- package/dist/messaging.d.ts.map +1 -0
- package/dist/native-commands.d.ts +142 -0
- package/dist/native-commands.d.ts.map +1 -0
- package/dist/owner-pairing-service.d.ts +73 -0
- package/dist/owner-pairing-service.d.ts.map +1 -0
- package/dist/permissionEvents.d.ts +42 -0
- package/dist/permissionEvents.d.ts.map +1 -0
- package/dist/permissions.d.ts +36 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/profileSync.d.ts +8 -0
- package/dist/profileSync.d.ts.map +1 -0
- package/dist/reasoning-tags.d.ts +2 -0
- package/dist/reasoning-tags.d.ts.map +1 -0
- package/dist/sensitive-request-adapter.d.ts +19 -0
- package/dist/sensitive-request-adapter.d.ts.map +1 -0
- package/dist/service.d.ts +315 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/setup-routes.d.ts +28 -0
- package/dist/setup-routes.d.ts.map +1 -0
- package/dist/slash-commands.d.ts +38 -0
- package/dist/slash-commands.d.ts.map +1 -0
- package/dist/staleness.d.ts +25 -0
- package/dist/staleness.d.ts.map +1 -0
- package/dist/status-reactions.d.ts +11 -0
- package/dist/status-reactions.d.ts.map +1 -0
- package/dist/test-setup.d.ts +1 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/tests.d.ts +123 -0
- package/dist/tests.d.ts.map +1 -0
- package/dist/types.d.ts +345 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/typing.d.ts +7 -0
- package/dist/typing.d.ts.map +1 -0
- package/dist/user-account-scraper/discord-browser-scraper.d.ts +118 -0
- package/dist/user-account-scraper/discord-browser-scraper.d.ts.map +1 -0
- package/dist/user-account-scraper/discord-desktop-cdp.d.ts +33 -0
- package/dist/user-account-scraper/discord-desktop-cdp.d.ts.map +1 -0
- package/dist/user-account-scraper/index.d.ts +15 -0
- package/dist/user-account-scraper/index.d.ts.map +1 -0
- package/dist/user-account-scraper/service.d.ts +92 -0
- package/dist/user-account-scraper/service.d.ts.map +1 -0
- package/dist/utils.d.ts +53 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/voice.d.ts +242 -0
- package/dist/voice.d.ts.map +1 -0
- package/package.json +14 -6
- package/registry-entry.json +120 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Client as DiscordJsClient } from "discord.js";
|
|
2
|
+
import { type ResolvedDiscordAccount } from "./accounts.js";
|
|
3
|
+
import type { ChannelDebouncer, MessageDebouncer } from "./debouncer.js";
|
|
4
|
+
import type { MessageManager } from "./messages.js";
|
|
5
|
+
import type { DiscordSettings } from "./types.js";
|
|
6
|
+
import type { VoiceManager } from "./voice.js";
|
|
7
|
+
export interface DiscordAccountClientState {
|
|
8
|
+
accountId: string;
|
|
9
|
+
account: ResolvedDiscordAccount;
|
|
10
|
+
client: DiscordJsClient | null;
|
|
11
|
+
settings: DiscordSettings;
|
|
12
|
+
allowedChannelIds?: string[];
|
|
13
|
+
listenChannelIds?: string[];
|
|
14
|
+
dynamicChannelIds: Set<string>;
|
|
15
|
+
clientReadyPromise: Promise<void> | null;
|
|
16
|
+
loginFailed: boolean;
|
|
17
|
+
messageManager?: MessageManager;
|
|
18
|
+
voiceManager?: VoiceManager;
|
|
19
|
+
messageDebouncer?: MessageDebouncer;
|
|
20
|
+
channelDebouncer?: ChannelDebouncer;
|
|
21
|
+
}
|
|
22
|
+
export declare class DiscordAccountClientPool {
|
|
23
|
+
private defaultAccountId;
|
|
24
|
+
private readonly clients;
|
|
25
|
+
constructor(defaultAccountId?: string);
|
|
26
|
+
setDefaultAccountId(accountId: string): void;
|
|
27
|
+
getDefaultAccountId(): string;
|
|
28
|
+
set(state: DiscordAccountClientState): void;
|
|
29
|
+
get(accountId?: string | null): DiscordAccountClientState | null;
|
|
30
|
+
getDefault(): DiscordAccountClientState | null;
|
|
31
|
+
list(): DiscordAccountClientState[];
|
|
32
|
+
listAccountIds(): string[];
|
|
33
|
+
clear(): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=account-client-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-client-pool.d.ts","sourceRoot":"","sources":["../account-client-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAGN,KAAK,sBAAsB,EAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE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|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* Default account identifier used when no specific account is configured
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_ACCOUNT_ID = "default";
|
|
6
|
+
/**
|
|
7
|
+
* Source of the Discord token
|
|
8
|
+
*/
|
|
9
|
+
export type DiscordTokenSource = "env" | "config" | "character" | "none";
|
|
10
|
+
/**
|
|
11
|
+
* Result of token resolution
|
|
12
|
+
*/
|
|
13
|
+
export interface DiscordTokenResolution {
|
|
14
|
+
token: string;
|
|
15
|
+
source: DiscordTokenSource;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for a single Discord account
|
|
19
|
+
*/
|
|
20
|
+
export interface DiscordAccountConfig {
|
|
21
|
+
/** Optional display name for this account */
|
|
22
|
+
name?: string;
|
|
23
|
+
/** If false, do not start this Discord account */
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
/** Discord bot token for this account */
|
|
26
|
+
token?: string;
|
|
27
|
+
/** Allow bot-authored messages to trigger replies */
|
|
28
|
+
allowBots?: boolean;
|
|
29
|
+
/** Controls how guild channel messages are handled */
|
|
30
|
+
groupPolicy?: "open" | "disabled" | "allowlist";
|
|
31
|
+
/** Outbound text chunk size (chars) */
|
|
32
|
+
textChunkLimit?: number;
|
|
33
|
+
/** Max lines per message */
|
|
34
|
+
maxLinesPerMessage?: number;
|
|
35
|
+
/** Max media size in MB */
|
|
36
|
+
mediaMaxMb?: number;
|
|
37
|
+
/** History limit for context */
|
|
38
|
+
historyLimit?: number;
|
|
39
|
+
/** Max DM turns to keep as history context */
|
|
40
|
+
dmHistoryLimit?: number;
|
|
41
|
+
/** DM configuration */
|
|
42
|
+
dm?: DiscordDmConfig;
|
|
43
|
+
/** Per-guild configuration */
|
|
44
|
+
guilds?: Record<string, DiscordGuildEntry>;
|
|
45
|
+
/** Channel IDs to allow */
|
|
46
|
+
channelIds?: string[];
|
|
47
|
+
/** Listen-only channel IDs */
|
|
48
|
+
listenChannelIds?: string[];
|
|
49
|
+
/** Whether to ignore bot messages */
|
|
50
|
+
shouldIgnoreBotMessages?: boolean;
|
|
51
|
+
/** Whether to ignore direct messages */
|
|
52
|
+
shouldIgnoreDirectMessages?: boolean;
|
|
53
|
+
/** Whether to respond only to mentions */
|
|
54
|
+
shouldRespondOnlyToMentions?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* DM-specific configuration
|
|
58
|
+
*/
|
|
59
|
+
export interface DiscordDmConfig {
|
|
60
|
+
/** If false, ignore all incoming Discord DMs */
|
|
61
|
+
enabled?: boolean;
|
|
62
|
+
/** Direct message access policy */
|
|
63
|
+
policy?: "open" | "disabled" | "allowlist" | "pairing";
|
|
64
|
+
/** Allowlist for DM senders (ids or names) */
|
|
65
|
+
allowFrom?: Array<string | number>;
|
|
66
|
+
/** If true, allow group DMs */
|
|
67
|
+
groupEnabled?: boolean;
|
|
68
|
+
/** Optional allowlist for group DM channels */
|
|
69
|
+
groupChannels?: Array<string | number>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Channel-specific configuration within a guild
|
|
73
|
+
*/
|
|
74
|
+
export interface DiscordGuildChannelConfig {
|
|
75
|
+
/** Whether this channel is allowed */
|
|
76
|
+
allow?: boolean;
|
|
77
|
+
/** Require bot mention to respond */
|
|
78
|
+
requireMention?: boolean;
|
|
79
|
+
/** Skills to load for this channel */
|
|
80
|
+
skills?: string[];
|
|
81
|
+
/** If false, disable the bot for this channel */
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
/** Allowlist for channel senders */
|
|
84
|
+
users?: Array<string | number>;
|
|
85
|
+
/** System prompt snippet for this channel */
|
|
86
|
+
systemPrompt?: string;
|
|
87
|
+
/** Auto-create threads for replies */
|
|
88
|
+
autoThread?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Guild-level configuration
|
|
92
|
+
*/
|
|
93
|
+
export interface DiscordGuildEntry {
|
|
94
|
+
/** Guild slug for name-based matching */
|
|
95
|
+
slug?: string;
|
|
96
|
+
/** Require bot mention to respond */
|
|
97
|
+
requireMention?: boolean;
|
|
98
|
+
/** Reaction notification mode */
|
|
99
|
+
reactionNotifications?: "off" | "own" | "all" | "allowlist";
|
|
100
|
+
/** Allowlist for guild users */
|
|
101
|
+
users?: Array<string | number>;
|
|
102
|
+
/** Per-channel configuration */
|
|
103
|
+
channels?: Record<string, DiscordGuildChannelConfig>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Multi-account Discord configuration structure
|
|
107
|
+
*/
|
|
108
|
+
export interface DiscordMultiAccountConfig {
|
|
109
|
+
/** Default/base configuration applied to all accounts */
|
|
110
|
+
enabled?: boolean;
|
|
111
|
+
token?: string;
|
|
112
|
+
/** Per-account configuration overrides */
|
|
113
|
+
accounts?: Record<string, DiscordAccountConfig>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Resolved Discord account with all configuration merged
|
|
117
|
+
*/
|
|
118
|
+
export interface ResolvedDiscordAccount {
|
|
119
|
+
accountId: string;
|
|
120
|
+
enabled: boolean;
|
|
121
|
+
name?: string;
|
|
122
|
+
token: string;
|
|
123
|
+
tokenSource: DiscordTokenSource;
|
|
124
|
+
config: DiscordAccountConfig;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Normalizes an account ID, returning the default if not provided
|
|
128
|
+
*/
|
|
129
|
+
export declare function normalizeAccountId(accountId?: string | null): string;
|
|
130
|
+
/**
|
|
131
|
+
* Normalizes a Discord token by trimming and removing "Bot " prefix
|
|
132
|
+
*/
|
|
133
|
+
export declare function normalizeDiscordToken(raw?: string | null): string | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Gets the account configuration records from runtime settings
|
|
136
|
+
*/
|
|
137
|
+
export declare function getMultiAccountConfig(runtime: IAgentRuntime): DiscordMultiAccountConfig;
|
|
138
|
+
/**
|
|
139
|
+
* Lists all configured account IDs
|
|
140
|
+
*/
|
|
141
|
+
export declare function listDiscordAccountIds(runtime: IAgentRuntime): string[];
|
|
142
|
+
/**
|
|
143
|
+
* Resolves the default account ID to use
|
|
144
|
+
*/
|
|
145
|
+
export declare function resolveDefaultDiscordAccountId(runtime: IAgentRuntime): string;
|
|
146
|
+
/**
|
|
147
|
+
* Resolves the Discord token for a specific account
|
|
148
|
+
*/
|
|
149
|
+
export declare function resolveDiscordToken(runtime: IAgentRuntime, opts?: {
|
|
150
|
+
accountId?: string | null;
|
|
151
|
+
}): DiscordTokenResolution;
|
|
152
|
+
/**
|
|
153
|
+
* Resolves a complete Discord account configuration
|
|
154
|
+
*/
|
|
155
|
+
export declare function resolveDiscordAccount(runtime: IAgentRuntime, accountId?: string | null): ResolvedDiscordAccount;
|
|
156
|
+
/**
|
|
157
|
+
* Lists all enabled Discord accounts
|
|
158
|
+
*/
|
|
159
|
+
export declare function listEnabledDiscordAccounts(runtime: IAgentRuntime): ResolvedDiscordAccount[];
|
|
160
|
+
/**
|
|
161
|
+
* Checks whether more than one enabled account is configured
|
|
162
|
+
*/
|
|
163
|
+
export declare function isMultiAccountEnabled(runtime: IAgentRuntime): boolean;
|
|
164
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,kBAAkB,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;I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C;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,kBAAkB,CAAC;IAChC,MAAM,EAAE,oBAAoB,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAMpE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAG7E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,aAAa,GACpB,yBAAyB,CAU3B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE,CActE;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAM7E;AAyGD;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,aAAa,EACtB,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GACtC,sBAAsB,CAiCxB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,aAAa,EACtB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GACvB,sBAAsB,CAqBxB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,aAAa,GACpB,sBAAsB,EAAE,CAI1B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAGrE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ActionResult } from "@elizaos/core";
|
|
2
|
+
type ActionResultData = NonNullable<ActionResult["data"]>;
|
|
3
|
+
export declare const terminalActionInteractionSemantics: {
|
|
4
|
+
readonly suppressPostActionContinuation: true;
|
|
5
|
+
readonly suppressActionResultClipboard: true;
|
|
6
|
+
};
|
|
7
|
+
export declare function terminalActionResultData(data?: ActionResultData): ActionResultData;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=actionResultSemantics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionResultSemantics.d.ts","sourceRoot":"","sources":["../../actions/actionResultSemantics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,KAAK,gBAAgB,GAAG,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AAE1D,eAAO,MAAM,kCAAkC;;;CAGrC,CAAC;AAEX,wBAAgB,wBAAwB,CACvC,IAAI,GAAE,gBAAqB,GACzB,gBAAgB,CAMlB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface CredentialPreset {
|
|
2
|
+
name: string;
|
|
3
|
+
displayName: string;
|
|
4
|
+
fields: CredentialField[];
|
|
5
|
+
helpUrl: string;
|
|
6
|
+
helpText: string;
|
|
7
|
+
validate: (credentials: Record<string, string>) => Promise<{
|
|
8
|
+
valid: boolean;
|
|
9
|
+
identity?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export interface CredentialField {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
secret: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function registerPreset(preset: CredentialPreset): void;
|
|
19
|
+
export declare function getPreset(name: string): CredentialPreset | undefined;
|
|
20
|
+
export declare function listPresets(): string[];
|
|
21
|
+
export declare function loadCredentials(service: string): Record<string, string> | null;
|
|
22
|
+
//# sourceMappingURL=setup-credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-credentials.d.ts","sourceRoot":"","sources":["../../actions/setup-credentials.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,CACT,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC/B,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,eAAe;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CAChB;AAoBD,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAQ7D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEpE;AAED,wBAAgB,WAAW,IAAI,MAAM,EAAE,CAEtC;AA4OD,wBAAgB,eAAe,CAC9B,OAAO,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAa/B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discord-native addressing helper.
|
|
3
|
+
*
|
|
4
|
+
* A bot can be mentioned as the subject of a message addressed to someone else.
|
|
5
|
+
* Connector routing should only treat the bot as directly addressed when the
|
|
6
|
+
* platform facts say so: the message replies to the bot, or the first user
|
|
7
|
+
* mention in the raw Discord content is the bot.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isDiscordUserAddressed({ text, userId, hasMessageReference, repliedUserId, }: {
|
|
10
|
+
text?: string | null;
|
|
11
|
+
userId?: string | null;
|
|
12
|
+
hasMessageReference?: boolean;
|
|
13
|
+
repliedUserId?: string | null;
|
|
14
|
+
}): boolean;
|
|
15
|
+
//# sourceMappingURL=addressing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addressing.d.ts","sourceRoot":"","sources":["../addressing.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAyBH,wBAAgB,sBAAsB,CAAC,EACtC,IAAI,EACJ,MAAM,EACN,mBAA2B,EAC3B,aAAa,GACb,EAAE;IACF,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,OAAO,CASV"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { Guild, GuildMember, User } from "discord.js";
|
|
2
|
+
import type { DiscordAccountConfig, DiscordGuildEntry } from "./accounts.js";
|
|
3
|
+
/**
|
|
4
|
+
* Normalized allowlist structure for Discord entities
|
|
5
|
+
*/
|
|
6
|
+
export interface DiscordAllowList {
|
|
7
|
+
allowAll: boolean;
|
|
8
|
+
ids: Set<string>;
|
|
9
|
+
names: Set<string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Match source type for allowlist matching
|
|
13
|
+
*/
|
|
14
|
+
export type AllowListMatchSource = "wildcard" | "id" | "name" | "tag";
|
|
15
|
+
/**
|
|
16
|
+
* Result of an allowlist match operation
|
|
17
|
+
*/
|
|
18
|
+
export interface DiscordAllowListMatch {
|
|
19
|
+
allowed: boolean;
|
|
20
|
+
matchKey?: string;
|
|
21
|
+
matchSource?: AllowListMatchSource;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Match source for channel configuration
|
|
25
|
+
*/
|
|
26
|
+
export type ChannelMatchSource = "id" | "name" | "slug" | "wildcard" | "parent";
|
|
27
|
+
/**
|
|
28
|
+
* Resolved channel configuration with match metadata
|
|
29
|
+
*/
|
|
30
|
+
export interface DiscordChannelConfigResolved {
|
|
31
|
+
allowed: boolean;
|
|
32
|
+
requireMention?: boolean;
|
|
33
|
+
skills?: string[];
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
users?: Array<string | number>;
|
|
36
|
+
systemPrompt?: string;
|
|
37
|
+
autoThread?: boolean;
|
|
38
|
+
matchKey?: string;
|
|
39
|
+
matchSource?: ChannelMatchSource;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Normalizes a Discord slug (channel name, guild name, etc.)
|
|
43
|
+
* Converts to lowercase, removes special characters, replaces spaces with dashes
|
|
44
|
+
*/
|
|
45
|
+
export declare function normalizeDiscordSlug(value: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Formats a Discord user tag for matching
|
|
48
|
+
*/
|
|
49
|
+
export declare function formatDiscordUserTag(user: User | GuildMember): string;
|
|
50
|
+
/**
|
|
51
|
+
* Normalizes a raw allowlist array into a structured DiscordAllowList
|
|
52
|
+
*/
|
|
53
|
+
export declare function normalizeDiscordAllowList(raw: Array<string | number> | undefined, prefixes?: string[]): DiscordAllowList | null;
|
|
54
|
+
/**
|
|
55
|
+
* Checks if a candidate matches the allowlist
|
|
56
|
+
*/
|
|
57
|
+
export declare function allowListMatches(list: DiscordAllowList, candidate: {
|
|
58
|
+
id?: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
tag?: string;
|
|
61
|
+
}): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves an allowlist match with detailed match information
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveDiscordAllowListMatch(params: {
|
|
66
|
+
allowList: DiscordAllowList;
|
|
67
|
+
candidate: {
|
|
68
|
+
id?: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
tag?: string;
|
|
71
|
+
};
|
|
72
|
+
}): DiscordAllowListMatch;
|
|
73
|
+
/**
|
|
74
|
+
* Checks if a Discord user is allowed based on an allowlist
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveDiscordUserAllowed(params: {
|
|
77
|
+
allowList?: Array<string | number>;
|
|
78
|
+
userId: string;
|
|
79
|
+
userName?: string;
|
|
80
|
+
userTag?: string;
|
|
81
|
+
}): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Checks if a user is authorized for commands in DMs
|
|
84
|
+
*/
|
|
85
|
+
export declare function resolveDiscordCommandAuthorized(params: {
|
|
86
|
+
isDirectMessage: boolean;
|
|
87
|
+
allowFrom?: Array<string | number>;
|
|
88
|
+
author: User;
|
|
89
|
+
}): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Resolves guild entry configuration by ID or slug
|
|
92
|
+
*/
|
|
93
|
+
export declare function resolveDiscordGuildEntry(params: {
|
|
94
|
+
guild?: Guild | null;
|
|
95
|
+
guildEntries?: Record<string, DiscordGuildEntry>;
|
|
96
|
+
}): (DiscordGuildEntry & {
|
|
97
|
+
id?: string;
|
|
98
|
+
}) | null;
|
|
99
|
+
/**
|
|
100
|
+
* Resolves channel configuration from guild info
|
|
101
|
+
*/
|
|
102
|
+
export declare function resolveDiscordChannelConfig(params: {
|
|
103
|
+
guildInfo?: (DiscordGuildEntry & {
|
|
104
|
+
id?: string;
|
|
105
|
+
}) | null;
|
|
106
|
+
channelId: string;
|
|
107
|
+
channelName?: string;
|
|
108
|
+
channelSlug?: string;
|
|
109
|
+
}): DiscordChannelConfigResolved | null;
|
|
110
|
+
/**
|
|
111
|
+
* Resolves channel configuration with thread/parent fallback
|
|
112
|
+
*/
|
|
113
|
+
export declare function resolveDiscordChannelConfigWithFallback(params: {
|
|
114
|
+
guildInfo?: (DiscordGuildEntry & {
|
|
115
|
+
id?: string;
|
|
116
|
+
}) | null;
|
|
117
|
+
channelId: string;
|
|
118
|
+
channelName?: string;
|
|
119
|
+
channelSlug?: string;
|
|
120
|
+
parentId?: string;
|
|
121
|
+
parentName?: string;
|
|
122
|
+
parentSlug?: string;
|
|
123
|
+
isThread?: boolean;
|
|
124
|
+
}): DiscordChannelConfigResolved | null;
|
|
125
|
+
/**
|
|
126
|
+
* Determines if a mention is required for the bot to respond
|
|
127
|
+
*/
|
|
128
|
+
export declare function resolveDiscordShouldRequireMention(params: {
|
|
129
|
+
isGuildMessage: boolean;
|
|
130
|
+
isThread: boolean;
|
|
131
|
+
botId?: string | null;
|
|
132
|
+
threadOwnerId?: string | null;
|
|
133
|
+
channelConfig?: DiscordChannelConfigResolved | null;
|
|
134
|
+
guildInfo?: (DiscordGuildEntry & {
|
|
135
|
+
id?: string;
|
|
136
|
+
}) | null;
|
|
137
|
+
isAutoThreadOwnedByBot?: boolean;
|
|
138
|
+
}): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Checks if a thread was created by the bot via autoThread feature
|
|
141
|
+
*/
|
|
142
|
+
export declare function isDiscordAutoThreadOwnedByBot(params: {
|
|
143
|
+
isThread: boolean;
|
|
144
|
+
channelConfig?: DiscordChannelConfigResolved | null;
|
|
145
|
+
botId?: string | null;
|
|
146
|
+
threadOwnerId?: string | null;
|
|
147
|
+
}): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Checks if a group (guild channel) is allowed by the policy
|
|
150
|
+
*/
|
|
151
|
+
export declare function isDiscordGroupAllowedByPolicy(params: {
|
|
152
|
+
groupPolicy: "open" | "disabled" | "allowlist";
|
|
153
|
+
guildAllowlisted: boolean;
|
|
154
|
+
channelAllowlistConfigured: boolean;
|
|
155
|
+
channelAllowed: boolean;
|
|
156
|
+
}): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Resolves if a group DM is allowed
|
|
159
|
+
*/
|
|
160
|
+
export declare function resolveGroupDmAllow(params: {
|
|
161
|
+
channels?: Array<string | number>;
|
|
162
|
+
channelId: string;
|
|
163
|
+
channelName?: string;
|
|
164
|
+
channelSlug?: string;
|
|
165
|
+
}): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Determines if a reaction notification should be emitted
|
|
168
|
+
*/
|
|
169
|
+
export declare function shouldEmitDiscordReactionNotification(params: {
|
|
170
|
+
mode?: "off" | "own" | "all" | "allowlist";
|
|
171
|
+
botId?: string;
|
|
172
|
+
messageAuthorId?: string;
|
|
173
|
+
userId: string;
|
|
174
|
+
userName?: string;
|
|
175
|
+
userTag?: string;
|
|
176
|
+
allowlist?: Array<string | number>;
|
|
177
|
+
}): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Validates a message against all allowlist policies
|
|
180
|
+
*/
|
|
181
|
+
export declare function validateMessageAllowed(params: {
|
|
182
|
+
accountConfig: DiscordAccountConfig;
|
|
183
|
+
isDirectMessage: boolean;
|
|
184
|
+
isGroupDm: boolean;
|
|
185
|
+
guild?: Guild | null;
|
|
186
|
+
channelId: string;
|
|
187
|
+
channelName?: string;
|
|
188
|
+
author: User;
|
|
189
|
+
botId?: string;
|
|
190
|
+
}): {
|
|
191
|
+
allowed: boolean;
|
|
192
|
+
reason?: string;
|
|
193
|
+
channelConfig?: DiscordChannelConfigResolved | null;
|
|
194
|
+
guildInfo?: (DiscordGuildEntry & {
|
|
195
|
+
id?: string;
|
|
196
|
+
}) | null;
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=allowlist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowlist.d.ts","sourceRoot":"","sources":["../allowlist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EACX,oBAAoB,EAEpB,iBAAiB,EACjB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;AAEtE;;GAEG;AACH,MAAM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pD,SAAS,CAAC,EAAE,CAAC,iBAAiB,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;CACzD,CAwIA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type IAgentRuntime, type Media } from "@elizaos/core";
|
|
2
|
+
import { type Attachment, Collection } from "discord.js";
|
|
3
|
+
/**
|
|
4
|
+
* Class representing an Attachment Manager.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AttachmentManager {
|
|
7
|
+
private attachmentCache;
|
|
8
|
+
private runtime;
|
|
9
|
+
/**
|
|
10
|
+
* Constructor for creating a new instance of the class.
|
|
11
|
+
*
|
|
12
|
+
* @param {IAgentRuntime} runtime The runtime object to be injected into the instance.
|
|
13
|
+
*/
|
|
14
|
+
constructor(runtime: IAgentRuntime);
|
|
15
|
+
private isImageDescriptionEnabled;
|
|
16
|
+
/**
|
|
17
|
+
* Processes attachments and returns an array of Media objects.
|
|
18
|
+
* @param {Collection<string, Attachment> | Attachment[]} attachments - The attachments to be processed
|
|
19
|
+
* @returns {Promise<Media[]>} - An array of processed Media objects
|
|
20
|
+
*/
|
|
21
|
+
processAttachments(attachments: Collection<string, Attachment> | Attachment[]): Promise<Media[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Processes the provided attachment to generate a media object.
|
|
24
|
+
* If the media for the attachment URL is already cached, it will return the cached media.
|
|
25
|
+
* Otherwise, it will determine the type of attachment (PDF, text, audio, video, image, generic)
|
|
26
|
+
* and call the corresponding processing method to generate the media object.
|
|
27
|
+
*
|
|
28
|
+
* @param attachment The attachment to process
|
|
29
|
+
* @returns A promise that resolves to a Media object representing the attachment, or null if the attachment could not be processed
|
|
30
|
+
*/
|
|
31
|
+
processAttachment(attachment: Attachment): Promise<Media | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Asynchronously processes an audio or video attachment provided as input and returns a Media object.
|
|
34
|
+
* @param {Attachment} attachment - The attachment object containing information about the audio/video file.
|
|
35
|
+
* @returns {Promise<Media>} A Promise that resolves to a Media object representing the processed audio/video attachment.
|
|
36
|
+
*/
|
|
37
|
+
private processAudioVideoAttachment;
|
|
38
|
+
/**
|
|
39
|
+
* Extracts the audio stream from the provided MP4 data and converts it to MP3 format.
|
|
40
|
+
*
|
|
41
|
+
* @param {ArrayBuffer} mp4Data - The MP4 data to extract audio from
|
|
42
|
+
* @returns {Promise<Buffer>} - A Promise that resolves with the converted audio data as a Buffer
|
|
43
|
+
*/
|
|
44
|
+
private extractAudioFromMP4;
|
|
45
|
+
/**
|
|
46
|
+
* Processes a PDF attachment by fetching the PDF file from the specified URL,
|
|
47
|
+
* converting it to text, generating a summary, and returning a Media object
|
|
48
|
+
* with the extracted information.
|
|
49
|
+
* If an error occurs during processing, an error Media object is returned
|
|
50
|
+
* with an error message.
|
|
51
|
+
*
|
|
52
|
+
* @param {Attachment} attachment - The PDF attachment to process.
|
|
53
|
+
* @returns {Promise<Media>} A promise that resolves to a Media object representing
|
|
54
|
+
* the processed PDF attachment.
|
|
55
|
+
*/
|
|
56
|
+
private processPdfAttachment;
|
|
57
|
+
/**
|
|
58
|
+
* Processes a plaintext attachment by fetching its content, generating a summary, and returning a Media object.
|
|
59
|
+
* @param {Attachment} attachment - The attachment object to process.
|
|
60
|
+
* @returns {Promise<Media>} A promise that resolves to a Media object representing the processed plaintext attachment.
|
|
61
|
+
*/
|
|
62
|
+
private processPlaintextAttachment;
|
|
63
|
+
/**
|
|
64
|
+
* Process the image attachment by fetching description and title using the IMAGE_DESCRIPTION model.
|
|
65
|
+
* If successful, returns a Media object populated with the details. If unsuccessful, creates a fallback
|
|
66
|
+
* Media object and logs the error.
|
|
67
|
+
*
|
|
68
|
+
* @param {Attachment} attachment - The attachment object containing the image details.
|
|
69
|
+
* @returns {Promise<Media>} A promise that resolves to a Media object.
|
|
70
|
+
*/
|
|
71
|
+
private processImageAttachment;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a fallback Media object for image attachments that could not be recognized.
|
|
74
|
+
*
|
|
75
|
+
* @param {Attachment} attachment - The attachment object containing image details.
|
|
76
|
+
* @returns {Media} - The fallback Media object with basic information about the image attachment.
|
|
77
|
+
*/
|
|
78
|
+
private createFallbackImageMedia;
|
|
79
|
+
/**
|
|
80
|
+
* Process a video attachment to extract video information.
|
|
81
|
+
* @param {Attachment} attachment - The attachment object containing video information.
|
|
82
|
+
* @returns {Promise<Media>} A promise that resolves to a Media object with video details.
|
|
83
|
+
* @throws {Error} If video service is not available.
|
|
84
|
+
*/
|
|
85
|
+
private processVideoAttachment;
|
|
86
|
+
/**
|
|
87
|
+
* Process a generic attachment and return a Media object with specified properties.
|
|
88
|
+
* @param {Attachment} attachment - The attachment object to process.
|
|
89
|
+
* @returns {Promise<Media>} A Promise that resolves to a Media object with specified properties.
|
|
90
|
+
*/
|
|
91
|
+
private processGenericAttachment;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=attachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../attachments.ts"],"names":[],"mappings":"AAGA,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,KAAK,EAIV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA6EzD;;GAEG;AACH,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,eAAe,CAAiC;IACxD,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;;OAIG;gBACS,OAAO,EAAE,aAAa;IAIlC,OAAO,CAAC,yBAAyB;IAejC;;;;OAIG;IACG,kBAAkB,CACvB,WAAW,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,UAAU,EAAE,GACxD,OAAO,CAAC,KAAK,EAAE,CAAC;IAiBnB;;;;;;;;OAQG;IACG,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAkDtE;;;;OAIG;YACW,2BAA2B;IA2IzC;;;;;OAKG;YACW,mBAAmB;IAwGjC;;;;;;;;;;OAUG;YACW,oBAAoB;IAuDlC;;;;OAIG;YACW,0BAA0B;IAkDxC;;;;;;;OAOG;YACW,sBAAsB;IA4CpC;;;;;OAKG;IAEH,OAAO,CAAC,wBAAwB;IAYhC;;;;;OAKG;YACW,sBAAsB;IA0DpC;;;;OAIG;YACW,wBAAwB;CAYtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-enable.d.ts","sourceRoot":"","sources":["../auto-enable.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAWlE"}
|
package/dist/banner.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discord Plugin Settings Banner
|
|
3
|
+
* Beautiful ANSI art display for configuration on startup
|
|
4
|
+
* Includes tiered permission system for invite URLs
|
|
5
|
+
*/
|
|
6
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
7
|
+
import { type DiscordPermissionValues } from "./permissions.js";
|
|
8
|
+
export interface PluginSetting {
|
|
9
|
+
name: string;
|
|
10
|
+
value: unknown;
|
|
11
|
+
defaultValue?: unknown;
|
|
12
|
+
sensitive?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface BannerOptions {
|
|
16
|
+
pluginName: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
settings: PluginSetting[];
|
|
19
|
+
runtime: IAgentRuntime;
|
|
20
|
+
/** Discord Application ID for generating invite URLs */
|
|
21
|
+
applicationId?: string;
|
|
22
|
+
/** Permission values for the 3x2 tier matrix */
|
|
23
|
+
discordPermissions?: DiscordPermissionValues;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Render a framed ANSI banner that displays plugin settings and, when available, tiered Discord invite URLs.
|
|
27
|
+
*
|
|
28
|
+
* The banner lists each setting with masked or truncated values, a status (custom/default/unset/required),
|
|
29
|
+
* and an optional Discord invite section generated from `applicationId` and `discordPermissions`.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Configuration for the banner, including `settings`, the `runtime` used to emit the banner,
|
|
32
|
+
* and optional Discord invite data (`applicationId`, `discordPermissions`).
|
|
33
|
+
*/
|
|
34
|
+
export declare function printBanner(options: BannerOptions): void;
|
|
35
|
+
/**
|
|
36
|
+
* Print the Discord plugin banner with current settings.
|
|
37
|
+
*/
|
|
38
|
+
export declare function printDiscordBanner(runtime: IAgentRuntime): void;
|
|
39
|
+
//# sourceMappingURL=banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../banner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACN,KAAK,uBAAuB,EAE5B,MAAM,eAAe,CAAC;AAgBvB,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC;IACvB,wDAAwD;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,kBAAkB,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAoFD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAoIxD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CA6C/D"}
|