@elizaos/plugin-discord 2.0.0-alpha.5 → 2.0.0-alpha.537
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/LICENSE +21 -0
- package/README.md +549 -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/chatWithAttachments.d.ts +4 -0
- package/dist/actions/chatWithAttachments.d.ts.map +1 -0
- package/dist/actions/createPoll.d.ts +4 -0
- package/dist/actions/createPoll.d.ts.map +1 -0
- package/dist/actions/deleteMessage.d.ts +4 -0
- package/dist/actions/deleteMessage.d.ts.map +1 -0
- package/dist/actions/downloadMedia.d.ts +4 -0
- package/dist/actions/downloadMedia.d.ts.map +1 -0
- package/dist/actions/editMessage.d.ts +4 -0
- package/dist/actions/editMessage.d.ts.map +1 -0
- package/dist/actions/getUserInfo.d.ts +4 -0
- package/dist/actions/getUserInfo.d.ts.map +1 -0
- package/dist/actions/joinChannel.d.ts +4 -0
- package/dist/actions/joinChannel.d.ts.map +1 -0
- package/dist/actions/leaveChannel.d.ts +4 -0
- package/dist/actions/leaveChannel.d.ts.map +1 -0
- package/dist/actions/listChannels.d.ts +4 -0
- package/dist/actions/listChannels.d.ts.map +1 -0
- package/dist/actions/pinMessage.d.ts +4 -0
- package/dist/actions/pinMessage.d.ts.map +1 -0
- package/dist/actions/reactToMessage.d.ts +4 -0
- package/dist/actions/reactToMessage.d.ts.map +1 -0
- package/dist/actions/readChannel.d.ts +4 -0
- package/dist/actions/readChannel.d.ts.map +1 -0
- package/dist/actions/searchMessages.d.ts +4 -0
- package/dist/actions/searchMessages.d.ts.map +1 -0
- package/dist/actions/sendDM.d.ts +4 -0
- package/dist/actions/sendDM.d.ts.map +1 -0
- package/dist/actions/sendMessage.d.ts +4 -0
- package/dist/actions/sendMessage.d.ts.map +1 -0
- package/dist/actions/serverInfo.d.ts +4 -0
- package/dist/actions/serverInfo.d.ts.map +1 -0
- package/dist/actions/setup-credentials.d.ts +25 -0
- package/dist/actions/setup-credentials.d.ts.map +1 -0
- package/dist/actions/summarizeConversation.d.ts +4 -0
- package/dist/actions/summarizeConversation.d.ts.map +1 -0
- package/dist/actions/transcribeMedia.d.ts +4 -0
- package/dist/actions/transcribeMedia.d.ts.map +1 -0
- package/dist/actions/unpinMessage.d.ts +4 -0
- package/dist/actions/unpinMessage.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/banner.d.ts +39 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/compat.d.ts +57 -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/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/debouncer.d.ts +25 -0
- package/dist/debouncer.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 +54 -0
- package/dist/discord-events.d.ts.map +1 -0
- package/dist/discord-history.d.ts +49 -0
- package/dist/discord-history.d.ts.map +1 -0
- package/dist/discord-interactions.d.ts +45 -0
- package/dist/discord-interactions.d.ts.map +1 -0
- package/dist/discord-local-service.d.ts +94 -0
- package/dist/discord-local-service.d.ts.map +1 -0
- package/dist/discord-reactions.d.ts +29 -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/prompts/typescript/prompts.d.ts +44 -0
- package/dist/generated/prompts/typescript/prompts.d.ts.map +1 -0
- package/dist/generated/specs/spec-helpers.d.ts +49 -0
- package/dist/generated/specs/spec-helpers.d.ts.map +1 -0
- package/dist/generated/specs/specs.d.ts +90 -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 +8 -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 +19 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15379 -0
- package/dist/index.js.map +72 -0
- package/dist/messages.d.ts +62 -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/providers/channelState.d.ts +14 -0
- package/dist/providers/channelState.d.ts.map +1 -0
- package/dist/providers/guildInfo.d.ts +15 -0
- package/dist/providers/guildInfo.d.ts.map +1 -0
- package/dist/providers/voiceState.d.ts +12 -0
- package/dist/providers/voiceState.d.ts.map +1 -0
- package/dist/reasoning-tags.d.ts +2 -0
- package/dist/reasoning-tags.d.ts.map +1 -0
- package/dist/service.d.ts +207 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/setup-routes.d.ts +23 -0
- package/dist/setup-routes.d.ts.map +1 -0
- package/dist/slash-commands.d.ts +39 -0
- package/dist/slash-commands.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 +329 -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/utils.d.ts +48 -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 +234 -0
- package/dist/voice.d.ts.map +1 -0
- package/package.json +25 -20
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discord local IPC connector.
|
|
3
|
+
*
|
|
4
|
+
* Connects to the Discord desktop app via the local RPC socket, enabling
|
|
5
|
+
* message ingestion and macOS UI-automation-based replies. Previously
|
|
6
|
+
* lived in `@elizaos/agent` as `discord-local-plugin.ts`; moved here so
|
|
7
|
+
* the Discord plugin package owns its own runtime service.
|
|
8
|
+
*/
|
|
9
|
+
import { type IAgentRuntime, type Plugin, Service } from "@elizaos/core";
|
|
10
|
+
export declare const DISCORD_LOCAL_PLUGIN_NAME = "@elizaos/plugin-discord-local";
|
|
11
|
+
export declare const DISCORD_LOCAL_SERVICE_NAME = "discord-local";
|
|
12
|
+
type DiscordLocalUser = {
|
|
13
|
+
id: string;
|
|
14
|
+
username: string;
|
|
15
|
+
global_name?: string | null;
|
|
16
|
+
avatar?: string | null;
|
|
17
|
+
};
|
|
18
|
+
type DiscordLocalChannel = {
|
|
19
|
+
id: string;
|
|
20
|
+
guild_id?: string | null;
|
|
21
|
+
type?: number;
|
|
22
|
+
name?: string | null;
|
|
23
|
+
recipients?: DiscordLocalUser[];
|
|
24
|
+
};
|
|
25
|
+
type DiscordLocalGuild = {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
29
|
+
export declare class DiscordLocalService extends Service {
|
|
30
|
+
static serviceType: string;
|
|
31
|
+
capabilityDescription: string;
|
|
32
|
+
private readonly sessionPath;
|
|
33
|
+
private readonly pendingRequests;
|
|
34
|
+
private readonly channelCache;
|
|
35
|
+
private readonly guildCache;
|
|
36
|
+
private readonly subscribedChannelIds;
|
|
37
|
+
private connectorConfig;
|
|
38
|
+
private socket;
|
|
39
|
+
private connectedIpcPath;
|
|
40
|
+
private readBuffer;
|
|
41
|
+
private readyPromise;
|
|
42
|
+
private readyResolve;
|
|
43
|
+
private readyReject;
|
|
44
|
+
private reconnectTimer;
|
|
45
|
+
private session;
|
|
46
|
+
private currentUser;
|
|
47
|
+
private connected;
|
|
48
|
+
private authenticated;
|
|
49
|
+
private lastError;
|
|
50
|
+
constructor(runtime?: IAgentRuntime);
|
|
51
|
+
static start(runtime: IAgentRuntime): Promise<DiscordLocalService>;
|
|
52
|
+
static registerSendHandlers(runtime: IAgentRuntime, service: DiscordLocalService): void;
|
|
53
|
+
stop(): Promise<void>;
|
|
54
|
+
isConnected(): boolean;
|
|
55
|
+
isAuthenticated(): boolean;
|
|
56
|
+
getStatus(): {
|
|
57
|
+
available: boolean;
|
|
58
|
+
connected: boolean;
|
|
59
|
+
authenticated: boolean;
|
|
60
|
+
currentUser: DiscordLocalUser;
|
|
61
|
+
subscribedChannelIds: string[];
|
|
62
|
+
configuredChannelIds: string[];
|
|
63
|
+
scopes: string[];
|
|
64
|
+
lastError: string;
|
|
65
|
+
ipcPath: string;
|
|
66
|
+
};
|
|
67
|
+
authorize(): Promise<ReturnType<DiscordLocalService["getStatus"]>>;
|
|
68
|
+
disconnectSession(): Promise<void>;
|
|
69
|
+
listGuilds(): Promise<DiscordLocalGuild[]>;
|
|
70
|
+
listChannels(guildId: string): Promise<DiscordLocalChannel[]>;
|
|
71
|
+
subscribeChannelMessages(channelIds: string[]): Promise<string[]>;
|
|
72
|
+
getChannel(channelId: string): Promise<DiscordLocalChannel | null>;
|
|
73
|
+
private requireConfig;
|
|
74
|
+
private startService;
|
|
75
|
+
private ensureAuthenticated;
|
|
76
|
+
private subscribeNotifications;
|
|
77
|
+
private subscribeConfiguredChannels;
|
|
78
|
+
private exchangeAuthorizationCode;
|
|
79
|
+
private refreshAccessToken;
|
|
80
|
+
private storeTokenResponse;
|
|
81
|
+
private loadSession;
|
|
82
|
+
private ensureRpcConnection;
|
|
83
|
+
private scheduleReconnect;
|
|
84
|
+
private handleSocketData;
|
|
85
|
+
private handleRpcPayload;
|
|
86
|
+
private writeFrame;
|
|
87
|
+
private sendRpcCommand;
|
|
88
|
+
private rejectPendingRequests;
|
|
89
|
+
private ingestMessage;
|
|
90
|
+
private sendUiMessage;
|
|
91
|
+
}
|
|
92
|
+
declare const discordLocalPlugin: Plugin;
|
|
93
|
+
export default discordLocalPlugin;
|
|
94
|
+
//# sourceMappingURL=discord-local-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discord-local-service.d.ts","sourceRoot":"","sources":["../discord-local-service.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discord reaction handling — extracted from service.ts
|
|
3
|
+
*
|
|
4
|
+
* Contains handleReaction(), handleReactionAdd(), handleReactionRemove().
|
|
5
|
+
*/
|
|
6
|
+
import { type ChannelType, type UUID } from "@elizaos/core";
|
|
7
|
+
import type { Channel, MessageReaction, PartialMessageReaction, PartialUser, User } from "discord.js";
|
|
8
|
+
import type { DiscordService } from "./service";
|
|
9
|
+
/**
|
|
10
|
+
* Subset of DiscordService fields needed by reaction handlers.
|
|
11
|
+
*/
|
|
12
|
+
export interface ReactionServiceInternals {
|
|
13
|
+
runtime: DiscordService["runtime"];
|
|
14
|
+
resolveDiscordEntityId(userId: string): UUID;
|
|
15
|
+
getChannelType(channel: Channel): Promise<ChannelType>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generic handler for reaction events (add/remove).
|
|
19
|
+
*/
|
|
20
|
+
export declare function handleReaction(service: ReactionServiceInternals, reaction: MessageReaction | PartialMessageReaction, user: User | PartialUser, type: "add" | "remove"): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Handles reaction addition.
|
|
23
|
+
*/
|
|
24
|
+
export declare function handleReactionAdd(service: ReactionServiceInternals, reaction: MessageReaction | PartialMessageReaction, user: User | PartialUser): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Handles reaction removal.
|
|
27
|
+
*/
|
|
28
|
+
export declare function handleReactionRemove(service: ReactionServiceInternals, reaction: MessageReaction | PartialMessageReaction, user: User | PartialUser): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=discord-reactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discord-reactions.d.ts","sourceRoot":"","sources":["../discord-reactions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACN,KAAK,WAAW,EAOhB,KAAK,IAAI,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACX,OAAO,EACP,eAAe,EACf,sBAAsB,EACtB,WAAW,EAEX,IAAI,EACJ,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACnC,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACvD;AAED;;GAEG;AACH,wBAAsB,cAAc,CACnC,OAAO,EAAE,wBAAwB,EACjC,QAAQ,EAAE,eAAe,GAAG,sBAAsB,EAClD,IAAI,EAAE,IAAI,GAAG,WAAW,EACxB,IAAI,EAAE,KAAK,GAAG,QAAQ,GACpB,OAAO,CAAC,IAAI,CAAC,CA8Lf;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,wBAAwB,EACjC,QAAQ,EAAE,eAAe,GAAG,sBAAsB,EAClD,IAAI,EAAE,IAAI,GAAG,WAAW,GACtB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,wBAAwB,EACjC,QAAQ,EAAE,eAAe,GAAG,sBAAsB,EAClD,IAAI,EAAE,IAAI,GAAG,WAAW,GACtB,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type BreakPreference = "paragraph" | "newline" | "sentence";
|
|
2
|
+
export interface DraftChunkConfig {
|
|
3
|
+
minChars: number;
|
|
4
|
+
maxChars: number;
|
|
5
|
+
breakPreference: BreakPreference;
|
|
6
|
+
}
|
|
7
|
+
export declare const DEFAULT_DRAFT_CHUNK_CONFIG: DraftChunkConfig;
|
|
8
|
+
export declare function findBreakPoint(text: string, maxLen: number, breakPreference?: BreakPreference): number;
|
|
9
|
+
//# sourceMappingURL=draft-chunking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-chunking.d.ts","sourceRoot":"","sources":["../draft-chunking.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAEnE,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;CACjC;AAED,eAAO,MAAM,0BAA0B,EAAE,gBAIxC,CAAC;AAEF,wBAAgB,cAAc,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,eAAe,GAAE,eAA4B,GAC3C,MAAM,CAyCR"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Message as DiscordMessage, TextChannel } from "discord.js";
|
|
2
|
+
import { type DraftChunkConfig } from "./draft-chunking";
|
|
3
|
+
type DraftReplyToMode = "off" | "first" | "all";
|
|
4
|
+
export interface DraftStreamOptions {
|
|
5
|
+
throttleMs?: number;
|
|
6
|
+
minInitialChars?: number;
|
|
7
|
+
maxChars?: number;
|
|
8
|
+
chunkConfig?: Partial<DraftChunkConfig>;
|
|
9
|
+
log?: (msg: string) => void;
|
|
10
|
+
warn?: (msg: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface DraftStreamController {
|
|
13
|
+
start: (channel: TextChannel, replyToMessageId?: string, replyToMode?: DraftReplyToMode) => Promise<DiscordMessage | null>;
|
|
14
|
+
update: (text: string) => void;
|
|
15
|
+
finalize: (text: string) => Promise<DiscordMessage[]>;
|
|
16
|
+
abort: (reason?: string) => Promise<void>;
|
|
17
|
+
messageId: () => string | undefined;
|
|
18
|
+
isStarted: () => boolean;
|
|
19
|
+
isDone: () => boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function createDraftStreamController(options?: DraftStreamOptions): DraftStreamController;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=draft-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-stream.d.ts","sourceRoot":"","sources":["../draft-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAEN,KAAK,gBAAgB,EAErB,MAAM,kBAAkB,CAAC;AAE1B,KAAK,gBAAgB,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACrC,KAAK,EAAE,CACN,OAAO,EAAE,WAAW,EACpB,gBAAgB,CAAC,EAAE,MAAM,EACzB,WAAW,CAAC,EAAE,gBAAgB,KAC1B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACtD,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,SAAS,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,OAAO,CAAC;CACtB;AAMD,wBAAgB,2BAA2B,CAC1C,OAAO,GAAE,kBAAuB,GAC9B,qBAAqB,CA8NvB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { DiscordSettings } from "./types";
|
|
4
|
+
export declare const DISCORD_DEFAULTS: {
|
|
5
|
+
readonly SHOULD_IGNORE_BOT_MESSAGES: boolean;
|
|
6
|
+
readonly SHOULD_IGNORE_DIRECT_MESSAGES: boolean;
|
|
7
|
+
readonly SHOULD_RESPOND_ONLY_TO_MENTIONS: boolean;
|
|
8
|
+
readonly ALLOWED_CHANNEL_IDS: string[];
|
|
9
|
+
readonly DM_POLICY: "open" | "allowlist" | "pairing" | "disabled";
|
|
10
|
+
readonly ALLOW_FROM: string[];
|
|
11
|
+
readonly SYNC_PROFILE: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const discordEnvSchema: z.ZodObject<{
|
|
14
|
+
DISCORD_API_TOKEN: z.ZodString;
|
|
15
|
+
CHANNEL_IDS: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string[], string>>;
|
|
16
|
+
DISCORD_SHOULD_IGNORE_BOT_MESSAGES: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<boolean, string>>;
|
|
17
|
+
DISCORD_SHOULD_IGNORE_DIRECT_MESSAGES: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<boolean, string>>;
|
|
18
|
+
DISCORD_SHOULD_RESPOND_ONLY_TO_MENTIONS: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<boolean, string>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type DiscordConfig = z.infer<typeof discordEnvSchema>;
|
|
21
|
+
export declare function getDiscordSettings(runtime: IAgentRuntime): DiscordSettings;
|
|
22
|
+
export declare function validateDiscordConfig(runtime: IAgentRuntime): Promise<DiscordConfig>;
|
|
23
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAqB/C,eAAO,MAAM,gBAAgB;;;;;wBAezB,MAAM,GACN,WAAW,GACX,SAAS,GACT,UAAU;;;CAGJ,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;iBAyB3B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE7D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAgH1E;AAED,wBAAsB,qBAAqB,CAC1C,OAAO,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,CAAC,CA4BxB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated prompt templates
|
|
3
|
+
* DO NOT EDIT - Generated from ../../../prompts/*.txt
|
|
4
|
+
*
|
|
5
|
+
* These prompts use Handlebars-style template syntax:
|
|
6
|
+
* - {{variableName}} for simple substitution
|
|
7
|
+
* - {{#each items}}...{{/each}} for iteration
|
|
8
|
+
* - {{#if condition}}...{{/if}} for conditionals
|
|
9
|
+
*/
|
|
10
|
+
export declare const attachmentIdsTemplate = "# Messages we are summarizing\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting a summary of specific attachments. Your goal is to determine their objective, along with the list of attachment IDs to summarize.\nThe \"objective\" is a detailed description of what the user wants to summarize based on the conversation.\nThe \"attachmentIds\" is an array of attachment IDs that the user wants to summarize. If not specified, default to including all attachments from the conversation.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"objective\": \"<What the user wants to summarize>\",\n \"attachmentIds\": [\"<Attachment ID 1>\", \"<Attachment ID 2>\", ...]\n}\n```";
|
|
11
|
+
export declare const ATTACHMENT_IDS_TEMPLATE = "# Messages we are summarizing\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting a summary of specific attachments. Your goal is to determine their objective, along with the list of attachment IDs to summarize.\nThe \"objective\" is a detailed description of what the user wants to summarize based on the conversation.\nThe \"attachmentIds\" is an array of attachment IDs that the user wants to summarize. If not specified, default to including all attachments from the conversation.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"objective\": \"<What the user wants to summarize>\",\n \"attachmentIds\": [\"<Attachment ID 1>\", \"<Attachment ID 2>\", ...]\n}\n```";
|
|
12
|
+
export declare const attachmentSummarizationTemplate = "# Summarized so far (we are adding to this)\n{{currentSummary}}\n\n# Current attachments we are summarizing\n{{attachmentsWithText}}\n\nSummarization objective: {{objective}}\n\n# Instructions: Summarize the attachments. Return the summary. Do not acknowledge this request, just summarize and continue the existing summary if there is one. Capture any important details based on the objective. Only respond with the new summary text.";
|
|
13
|
+
export declare const ATTACHMENT_SUMMARIZATION_TEMPLATE = "# Summarized so far (we are adding to this)\n{{currentSummary}}\n\n# Current attachments we are summarizing\n{{attachmentsWithText}}\n\nSummarization objective: {{objective}}\n\n# Instructions: Summarize the attachments. Return the summary. Do not acknowledge this request, just summarize and continue the existing summary if there is one. Capture any important details based on the objective. Only respond with the new summary text.";
|
|
14
|
+
export declare const channelInfoTemplate = "# Messages we are searching for channel information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to read messages from a specific Discord channel. Your goal is to determine:\n1. The channel they want to read from (could be the current channel or a mentioned channel)\n2. How many messages they want to read (default to 10 if not specified)\n3. Whether they want a summary or just the messages\n4. If they're looking for messages from a specific person\n\nIf they say \"this channel\" or \"here\", use the current channel.\nIf they mention a specific channel name or ID, extract that.\nIf they ask to \"summarize\" or mention what someone is \"talking about\", set summarize to true.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"channelIdentifier\": \"<current|channel-name|channel-id>\",\n \"messageCount\": <number between 1 and 50>,\n \"summarize\": true/false,\n \"focusUser\": \"<username or null>\"\n}\n```";
|
|
15
|
+
export declare const CHANNEL_INFO_TEMPLATE = "# Messages we are searching for channel information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to read messages from a specific Discord channel. Your goal is to determine:\n1. The channel they want to read from (could be the current channel or a mentioned channel)\n2. How many messages they want to read (default to 10 if not specified)\n3. Whether they want a summary or just the messages\n4. If they're looking for messages from a specific person\n\nIf they say \"this channel\" or \"here\", use the current channel.\nIf they mention a specific channel name or ID, extract that.\nIf they ask to \"summarize\" or mention what someone is \"talking about\", set summarize to true.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"channelIdentifier\": \"<current|channel-name|channel-id>\",\n \"messageCount\": <number between 1 and 50>,\n \"summarize\": true/false,\n \"focusUser\": \"<username or null>\"\n}\n```";
|
|
16
|
+
export declare const createPollTemplate = "# Creating a Discord poll\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to create a poll. Extract:\n1. The poll question\n2. The poll options (2-10 options)\n3. Whether to use emoji reactions (default: true)\n\nExamples:\n- \"create a poll: What game should we play? Options: Minecraft, Fortnite, Among Us\" \n -> question: \"What game should we play?\", options: [\"Minecraft\", \"Fortnite\", \"Among Us\"]\n- \"poll: Should we have a meeting tomorrow? Yes/No\"\n -> question: \"Should we have a meeting tomorrow?\", options: [\"Yes\", \"No\"]\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"question\": \"<poll question>\",\n \"options\": [\"<option1>\", \"<option2>\", ...],\n \"useEmojis\": true/false\n}\n```";
|
|
17
|
+
export declare const CREATE_POLL_TEMPLATE = "# Creating a Discord poll\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to create a poll. Extract:\n1. The poll question\n2. The poll options (2-10 options)\n3. Whether to use emoji reactions (default: true)\n\nExamples:\n- \"create a poll: What game should we play? Options: Minecraft, Fortnite, Among Us\" \n -> question: \"What game should we play?\", options: [\"Minecraft\", \"Fortnite\", \"Among Us\"]\n- \"poll: Should we have a meeting tomorrow? Yes/No\"\n -> question: \"Should we have a meeting tomorrow?\", options: [\"Yes\", \"No\"]\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"question\": \"<poll question>\",\n \"options\": [\"<option1>\", \"<option2>\", ...],\n \"useEmojis\": true/false\n}\n```";
|
|
18
|
+
export declare const dateRangeTemplate = "# Messages we are summarizing (the conversation is continued after this)\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting a summary of the conversation. Your goal is to determine their objective, along with the range of dates that their request covers.\nThe \"objective\" is a detailed description of what the user wants to summarize based on the conversation. If they just ask for a general summary, you can either base it off the conversation if the summary range is very recent, or set the object to be general, like \"a detailed summary of the conversation between all users\".\nThe \"start\" and \"end\" are the range of dates that the user wants to summarize, relative to the current time. The start and end should be relative to the current time, and measured in seconds, minutes, hours and days. The format is \"2 days ago\" or \"3 hours ago\" or \"4 minutes ago\" or \"5 seconds ago\", i.e. \"<integer> <unit> ago\".\nIf you aren't sure, you can use a default range of \"0 minutes ago\" to \"2 hours ago\" or more. Better to err on the side of including too much than too little.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"objective\": \"<What the user wants to summarize>\",\n \"start\": \"0 minutes ago\",\n \"end\": \"2 hours ago\"\n}\n```";
|
|
19
|
+
export declare const DATE_RANGE_TEMPLATE = "# Messages we are summarizing (the conversation is continued after this)\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting a summary of the conversation. Your goal is to determine their objective, along with the range of dates that their request covers.\nThe \"objective\" is a detailed description of what the user wants to summarize based on the conversation. If they just ask for a general summary, you can either base it off the conversation if the summary range is very recent, or set the object to be general, like \"a detailed summary of the conversation between all users\".\nThe \"start\" and \"end\" are the range of dates that the user wants to summarize, relative to the current time. The start and end should be relative to the current time, and measured in seconds, minutes, hours and days. The format is \"2 days ago\" or \"3 hours ago\" or \"4 minutes ago\" or \"5 seconds ago\", i.e. \"<integer> <unit> ago\".\nIf you aren't sure, you can use a default range of \"0 minutes ago\" to \"2 hours ago\" or more. Better to err on the side of including too much than too little.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"objective\": \"<What the user wants to summarize>\",\n \"start\": \"0 minutes ago\",\n \"end\": \"2 hours ago\"\n}\n```";
|
|
20
|
+
export declare const getUserInfoTemplate = "# Getting Discord user information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting information about a Discord user. Extract:\n1. The user identifier (username, user ID, or mention)\n2. Whether they want detailed server-specific info\n\nExamples:\n- \"who is @john?\" -> userIdentifier: \"john\", detailed: false\n- \"tell me about user 123456789\" -> userIdentifier: \"123456789\", detailed: false \n- \"get detailed info on @admin\" -> userIdentifier: \"admin\", detailed: true\n- \"who am I?\" -> userIdentifier: \"self\", detailed: false\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"userIdentifier\": \"<username|user-id|mention|self>\",\n \"detailed\": true/false\n}\n```";
|
|
21
|
+
export declare const GET_USER_INFO_TEMPLATE = "# Getting Discord user information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting information about a Discord user. Extract:\n1. The user identifier (username, user ID, or mention)\n2. Whether they want detailed server-specific info\n\nExamples:\n- \"who is @john?\" -> userIdentifier: \"john\", detailed: false\n- \"tell me about user 123456789\" -> userIdentifier: \"123456789\", detailed: false \n- \"get detailed info on @admin\" -> userIdentifier: \"admin\", detailed: true\n- \"who am I?\" -> userIdentifier: \"self\", detailed: false\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"userIdentifier\": \"<username|user-id|mention|self>\",\n \"detailed\": true/false\n}\n```";
|
|
22
|
+
export declare const joinChannelTemplate = "# Messages we are searching for channel join information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting the bot to join a specific Discord channel (text or voice). Your goal is to determine which channel they want to join.\n\nExtract the channel identifier from their request:\n- If they mention a channel like #general or <#channelid>, extract that\n- If they provide a channel name, extract that\n- If they provide a channel ID (long number), extract that\n- If they mention \"voice\", \"vc\", \"voice channel\", include that as a hint\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"channelIdentifier\": \"<channel-name|channel-id|#mention>\",\n \"isVoiceChannel\": true/false\n}\n```";
|
|
23
|
+
export declare const JOIN_CHANNEL_TEMPLATE = "# Messages we are searching for channel join information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting the bot to join a specific Discord channel (text or voice). Your goal is to determine which channel they want to join.\n\nExtract the channel identifier from their request:\n- If they mention a channel like #general or <#channelid>, extract that\n- If they provide a channel name, extract that\n- If they provide a channel ID (long number), extract that\n- If they mention \"voice\", \"vc\", \"voice channel\", include that as a hint\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"channelIdentifier\": \"<channel-name|channel-id|#mention>\",\n \"isVoiceChannel\": true/false\n}\n```";
|
|
24
|
+
export declare const leaveChannelTemplate = "# Messages we are searching for channel leave information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting the bot to leave a specific Discord channel (text or voice). Your goal is to determine which channel they want to leave.\n\nExtract the channel identifier from their request:\n- If they mention a channel like #general or <#channelid>, extract that\n- If they provide a channel name (like \"dev-voice\" or \"general\"), extract just the name\n- If they provide a channel ID (long number), extract that\n- If they say \"this channel\" or \"here\", use \"current\"\n- If they don't specify a channel but mention \"voice\", \"vc\", use \"current\" and mark as voice\n\nExamples:\n- \"leave the dev-voice channel\" -> channelIdentifier: \"dev-voice\", isVoiceChannel: true\n- \"leave #general\" -> channelIdentifier: \"general\", isVoiceChannel: false\n- \"leave voice\" -> channelIdentifier: \"current\", isVoiceChannel: true\n- \"stop listening to this channel\" -> channelIdentifier: \"current\", isVoiceChannel: false\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"channelIdentifier\": \"<actual-channel-name-or-id-or-current>\",\n \"isVoiceChannel\": true/false\n}\n```";
|
|
25
|
+
export declare const LEAVE_CHANNEL_TEMPLATE = "# Messages we are searching for channel leave information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting the bot to leave a specific Discord channel (text or voice). Your goal is to determine which channel they want to leave.\n\nExtract the channel identifier from their request:\n- If they mention a channel like #general or <#channelid>, extract that\n- If they provide a channel name (like \"dev-voice\" or \"general\"), extract just the name\n- If they provide a channel ID (long number), extract that\n- If they say \"this channel\" or \"here\", use \"current\"\n- If they don't specify a channel but mention \"voice\", \"vc\", use \"current\" and mark as voice\n\nExamples:\n- \"leave the dev-voice channel\" -> channelIdentifier: \"dev-voice\", isVoiceChannel: true\n- \"leave #general\" -> channelIdentifier: \"general\", isVoiceChannel: false\n- \"leave voice\" -> channelIdentifier: \"current\", isVoiceChannel: true\n- \"stop listening to this channel\" -> channelIdentifier: \"current\", isVoiceChannel: false\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"channelIdentifier\": \"<actual-channel-name-or-id-or-current>\",\n \"isVoiceChannel\": true/false\n}\n```";
|
|
26
|
+
export declare const mediaAttachmentIdTemplate = "# Messages we are transcribing\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting a transcription of a specific media file (audio or video). Your goal is to determine the ID of the attachment they want transcribed.\nThe \"attachmentId\" is the ID of the media file attachment that the user wants transcribed. If not specified, return null.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"attachmentId\": \"<Attachment ID>\"\n}\n```";
|
|
27
|
+
export declare const MEDIA_ATTACHMENT_ID_TEMPLATE = "# Messages we are transcribing\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting a transcription of a specific media file (audio or video). Your goal is to determine the ID of the attachment they want transcribed.\nThe \"attachmentId\" is the ID of the media file attachment that the user wants transcribed. If not specified, return null.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"attachmentId\": \"<Attachment ID>\"\n}\n```";
|
|
28
|
+
export declare const mediaUrlTemplate = "# Messages we are searching for a media URL\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to download a specific media file (video or audio). Your goal is to determine the URL of the media they want to download.\nThe \"mediaUrl\" is the URL of the media file that the user wants downloaded. If not specified, return null.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"mediaUrl\": \"<Media URL>\"\n}\n```";
|
|
29
|
+
export declare const MEDIA_URL_TEMPLATE = "# Messages we are searching for a media URL\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to download a specific media file (video or audio). Your goal is to determine the URL of the media they want to download.\nThe \"mediaUrl\" is the URL of the media file that the user wants downloaded. If not specified, return null.\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"mediaUrl\": \"<Media URL>\"\n}\n```";
|
|
30
|
+
export declare const pinMessageTemplate = "# Pinning a Discord message\n{{recentMessages}}\n\n# Instructions: {{senderName}} wants to pin a message. Extract which message they want to pin.\n\nExamples:\n- \"pin that message\" -> messageRef: \"last\"\n- \"pin the last message\" -> messageRef: \"last\"\n- \"pin john's message about the meeting\" -> messageRef: \"john meeting\"\n- \"pin message 123456789\" -> messageRef: \"123456789\"\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"messageRef\": \"<last|previous|message-id|search-text>\"\n}\n```";
|
|
31
|
+
export declare const PIN_MESSAGE_TEMPLATE = "# Pinning a Discord message\n{{recentMessages}}\n\n# Instructions: {{senderName}} wants to pin a message. Extract which message they want to pin.\n\nExamples:\n- \"pin that message\" -> messageRef: \"last\"\n- \"pin the last message\" -> messageRef: \"last\"\n- \"pin john's message about the meeting\" -> messageRef: \"john meeting\"\n- \"pin message 123456789\" -> messageRef: \"123456789\"\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"messageRef\": \"<last|previous|message-id|search-text>\"\n}\n```";
|
|
32
|
+
export declare const reactToMessageTemplate = "# Adding reactions to Discord messages\n{{recentMessages}}\n\n# Instructions: {{senderName}} wants to add a reaction to a message. Extract:\n1. Which message to react to (last, specific message reference, or by content)\n2. What emoji/reaction to add\n\nExamples:\n- \"react with \uD83D\uDC4D to the last message\" -> messageRef: \"last\", emoji: \"\uD83D\uDC4D\"\n- \"add :fire: reaction\" -> messageRef: \"last\", emoji: \"\uD83D\uDD25\" or \":fire:\"\n- \"react to that message with \u2764\uFE0F\" -> messageRef: \"previous\", emoji: \"\u2764\uFE0F\"\n- \"add a thumbs up to john's message about the meeting\" -> messageRef: \"john meeting\", emoji: \"\uD83D\uDC4D\"\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"messageRef\": \"<last|previous|message-id|search-text>\",\n \"emoji\": \"<emoji-character|:emoji-name:>\"\n}\n```";
|
|
33
|
+
export declare const REACT_TO_MESSAGE_TEMPLATE = "# Adding reactions to Discord messages\n{{recentMessages}}\n\n# Instructions: {{senderName}} wants to add a reaction to a message. Extract:\n1. Which message to react to (last, specific message reference, or by content)\n2. What emoji/reaction to add\n\nExamples:\n- \"react with \uD83D\uDC4D to the last message\" -> messageRef: \"last\", emoji: \"\uD83D\uDC4D\"\n- \"add :fire: reaction\" -> messageRef: \"last\", emoji: \"\uD83D\uDD25\" or \":fire:\"\n- \"react to that message with \u2764\uFE0F\" -> messageRef: \"previous\", emoji: \"\u2764\uFE0F\"\n- \"add a thumbs up to john's message about the meeting\" -> messageRef: \"john meeting\", emoji: \"\uD83D\uDC4D\"\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"messageRef\": \"<last|previous|message-id|search-text>\",\n \"emoji\": \"<emoji-character|:emoji-name:>\"\n}\n```";
|
|
34
|
+
export declare const searchMessagesTemplate = "# Searching for Discord messages\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to search for messages in Discord. Extract:\n1. The search query/keywords\n2. The channel to search in (current if not specified)\n3. Optional filters like author, time range, or message count\n\nExamples:\n- \"search for messages containing 'meeting'\" -> query: \"meeting\", channelIdentifier: \"current\", NO author field\n- \"find messages from @user about bugs\" -> query: \"bugs\", channelIdentifier: \"current\", author: \"user\"\n- \"search #general for links from last week\" -> query: \"links\", channelIdentifier: \"general\", timeRange: \"week\"\n- \"search for messages about 'spartan' in this channel\" -> query: \"spartan\", channelIdentifier: \"current\"\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"query\": \"<search keywords>\",\n \"channelIdentifier\": \"<channel-name|channel-id|current>\",\n \"author\": \"<username>\",\n \"timeRange\": \"<hour|day|week|month>\",\n \"limit\": <number between 1-100, default 20>\n}\n```";
|
|
35
|
+
export declare const SEARCH_MESSAGES_TEMPLATE = "# Searching for Discord messages\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to search for messages in Discord. Extract:\n1. The search query/keywords\n2. The channel to search in (current if not specified)\n3. Optional filters like author, time range, or message count\n\nExamples:\n- \"search for messages containing 'meeting'\" -> query: \"meeting\", channelIdentifier: \"current\", NO author field\n- \"find messages from @user about bugs\" -> query: \"bugs\", channelIdentifier: \"current\", author: \"user\"\n- \"search #general for links from last week\" -> query: \"links\", channelIdentifier: \"general\", timeRange: \"week\"\n- \"search for messages about 'spartan' in this channel\" -> query: \"spartan\", channelIdentifier: \"current\"\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"query\": \"<search keywords>\",\n \"channelIdentifier\": \"<channel-name|channel-id|current>\",\n \"author\": \"<username>\",\n \"timeRange\": \"<hour|day|week|month>\",\n \"limit\": <number between 1-100, default 20>\n}\n```";
|
|
36
|
+
export declare const sendDmTemplate = "# Messages we are searching for DM information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to send a direct message to a specific Discord user. Your goal is to determine:\n1. The recipient they want to message (could be a username, user ID, or mentioned user)\n2. The message content they want to send\n\nExtract the recipient identifier and the message content from their request.\n- If they mention a user like @username or <@userid>, extract that\n- If they provide a username or display name, extract that\n- If they provide a user ID (long number), extract that\n- Extract the complete message they want to send\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"recipientIdentifier\": \"<username|user-id|@mention>\",\n \"messageContent\": \"<the message to send>\"\n}\n```";
|
|
37
|
+
export declare const SEND_DM_TEMPLATE = "# Messages we are searching for DM information\n{{recentMessages}}\n\n# Instructions: {{senderName}} is requesting to send a direct message to a specific Discord user. Your goal is to determine:\n1. The recipient they want to message (could be a username, user ID, or mentioned user)\n2. The message content they want to send\n\nExtract the recipient identifier and the message content from their request.\n- If they mention a user like @username or <@userid>, extract that\n- If they provide a username or display name, extract that\n- If they provide a user ID (long number), extract that\n- Extract the complete message they want to send\n\nYour response must be formatted as a JSON block with this structure:\n```json\n{\n \"recipientIdentifier\": \"<username|user-id|@mention>\",\n \"messageContent\": \"<the message to send>\"\n}\n```";
|
|
38
|
+
export declare const summarizationTemplate = "# Summarized so far (we are adding to this)\n{{currentSummary}}\n\n# Current conversation chunk we are summarizing (includes attachments)\n{{memoriesWithAttachments}}\n\nSummarization objective: {{objective}}\n\n# Instructions: Summarize the conversation so far. Return the summary. Do not acknowledge this request, just summarize and continue the existing summary if there is one. Capture any important details to the objective. Only respond with the new summary text.\nYour response should be extremely detailed and include any and all relevant information.";
|
|
39
|
+
export declare const SUMMARIZATION_TEMPLATE = "# Summarized so far (we are adding to this)\n{{currentSummary}}\n\n# Current conversation chunk we are summarizing (includes attachments)\n{{memoriesWithAttachments}}\n\nSummarization objective: {{objective}}\n\n# Instructions: Summarize the conversation so far. Return the summary. Do not acknowledge this request, just summarize and continue the existing summary if there is one. Capture any important details to the objective. Only respond with the new summary text.\nYour response should be extremely detailed and include any and all relevant information.";
|
|
40
|
+
export declare const transcriptionTemplate = "# Transcription of media file\n{{mediaTranscript}}\n\n# Instructions: Return only the full transcript of the media file without any additional prompt or commentary.";
|
|
41
|
+
export declare const TRANSCRIPTION_TEMPLATE = "# Transcription of media file\n{{mediaTranscript}}\n\n# Instructions: Return only the full transcript of the media file without any additional prompt or commentary.";
|
|
42
|
+
export declare const unpinMessageTemplate = "# Unpinning a Discord message\n{{recentMessages}}\n\n# Instructions: {{senderName}} wants to unpin a message. Extract which message they want to unpin.\n\nExamples:\n- \"unpin that message\" -> messageRef: \"last_pinned\"\n- \"unpin the last pinned message\" -> messageRef: \"last_pinned\"\n- \"unpin john's message\" -> messageRef: \"john\"\n- \"unpin message about the meeting\" -> messageRef: \"meeting\"\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"messageRef\": \"<last_pinned|message-id|search-text>\"\n}\n```";
|
|
43
|
+
export declare const UNPIN_MESSAGE_TEMPLATE = "# Unpinning a Discord message\n{{recentMessages}}\n\n# Instructions: {{senderName}} wants to unpin a message. Extract which message they want to unpin.\n\nExamples:\n- \"unpin that message\" -> messageRef: \"last_pinned\"\n- \"unpin the last pinned message\" -> messageRef: \"last_pinned\"\n- \"unpin john's message\" -> messageRef: \"john\"\n- \"unpin message about the meeting\" -> messageRef: \"meeting\"\n\nYour response must be formatted as a JSON block:\n```json\n{\n \"messageRef\": \"<last_pinned|message-id|search-text>\"\n}\n```";
|
|
44
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../generated/prompts/typescript/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,qBAAqB,ytBAa3B,CAAC;AAER,eAAO,MAAM,uBAAuB,ytBAAwB,CAAC;AAE7D,eAAO,MAAM,+BAA+B,sbAQoN,CAAC;AAEjQ,eAAO,MAAM,iCAAiC,sbAAkC,CAAC;AAEjF,eAAO,MAAM,mBAAmB,09BAqBzB,CAAC;AAER,eAAO,MAAM,qBAAqB,09BAAsB,CAAC;AAEzD,eAAO,MAAM,kBAAkB,6vBAqBxB,CAAC;AAER,eAAO,MAAM,oBAAoB,6vBAAqB,CAAC;AAEvD,eAAO,MAAM,iBAAiB,2yCAevB,CAAC;AAER,eAAO,MAAM,mBAAmB,2yCAAoB,CAAC;AAErD,eAAO,MAAM,mBAAmB,utBAmBzB,CAAC;AAER,eAAO,MAAM,sBAAsB,utBAAsB,CAAC;AAE1D,eAAO,MAAM,mBAAmB,mvBAiBzB,CAAC;AAER,eAAO,MAAM,qBAAqB,mvBAAsB,CAAC;AAEzD,eAAO,MAAM,oBAAoB,2tCAwB1B,CAAC;AAER,eAAO,MAAM,sBAAsB,2tCAAuB,CAAC;AAE3D,eAAO,MAAM,yBAAyB,8eAW/B,CAAC;AAER,eAAO,MAAM,4BAA4B,8eAA4B,CAAC;AAEtE,eAAO,MAAM,gBAAgB,ydAWtB,CAAC;AAER,eAAO,MAAM,kBAAkB,ydAAmB,CAAC;AAEnD,eAAO,MAAM,kBAAkB,mhBAgBxB,CAAC;AAER,eAAO,MAAM,oBAAoB,mhBAAqB,CAAC;AAEvD,eAAO,MAAM,sBAAsB,01BAmB5B,CAAC;AAER,eAAO,MAAM,yBAAyB,01BAAyB,CAAC;AAEhE,eAAO,MAAM,sBAAsB,mjCAuB5B,CAAC;AAER,eAAO,MAAM,wBAAwB,mjCAAyB,CAAC;AAE/D,eAAO,MAAM,cAAc,+0BAmBpB,CAAC;AAER,eAAO,MAAM,gBAAgB,+0BAAiB,CAAC;AAE/C,eAAO,MAAM,qBAAqB,ojBASuD,CAAC;AAE1F,eAAO,MAAM,sBAAsB,ojBAAwB,CAAC;AAE5D,eAAO,MAAM,qBAAqB,yKAG6E,CAAC;AAEhH,eAAO,MAAM,sBAAsB,yKAAwB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,giBAgB1B,CAAC;AAER,eAAO,MAAM,sBAAsB,giBAAuB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions to lookup action/provider/evaluator specs by name.
|
|
3
|
+
* These allow language-specific implementations to import their text content
|
|
4
|
+
* (description, similes, examples) from the centralized specs.
|
|
5
|
+
*
|
|
6
|
+
* DO NOT EDIT the spec data - update prompts/actions.json, prompts/providers.json, prompts/evaluators.json and regenerate.
|
|
7
|
+
*/
|
|
8
|
+
import { type ActionDoc, type EvaluatorDoc, type ProviderDoc } from "./specs";
|
|
9
|
+
/**
|
|
10
|
+
* Get an action spec by name from the core specs.
|
|
11
|
+
* @param name - The action name
|
|
12
|
+
* @returns The action spec or undefined if not found
|
|
13
|
+
*/
|
|
14
|
+
export declare function getActionSpec(name: string): ActionDoc | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Get an action spec by name, throwing if not found.
|
|
17
|
+
* @param name - The action name
|
|
18
|
+
* @returns The action spec
|
|
19
|
+
* @throws Error if the action is not found
|
|
20
|
+
*/
|
|
21
|
+
export declare function requireActionSpec(name: string): ActionDoc;
|
|
22
|
+
/**
|
|
23
|
+
* Get a provider spec by name from the core specs.
|
|
24
|
+
* @param name - The provider name
|
|
25
|
+
* @returns The provider spec or undefined if not found
|
|
26
|
+
*/
|
|
27
|
+
export declare function getProviderSpec(name: string): ProviderDoc | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Get a provider spec by name, throwing if not found.
|
|
30
|
+
* @param name - The provider name
|
|
31
|
+
* @returns The provider spec
|
|
32
|
+
* @throws Error if the provider is not found
|
|
33
|
+
*/
|
|
34
|
+
export declare function requireProviderSpec(name: string): ProviderDoc;
|
|
35
|
+
/**
|
|
36
|
+
* Get an evaluator spec by name from the core specs.
|
|
37
|
+
* @param name - The evaluator name
|
|
38
|
+
* @returns The evaluator spec or undefined if not found
|
|
39
|
+
*/
|
|
40
|
+
export declare function getEvaluatorSpec(name: string): EvaluatorDoc | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get an evaluator spec by name, throwing if not found.
|
|
43
|
+
* @param name - The evaluator name
|
|
44
|
+
* @returns The evaluator spec
|
|
45
|
+
* @throws Error if the evaluator is not found
|
|
46
|
+
*/
|
|
47
|
+
export declare function requireEvaluatorSpec(name: string): EvaluatorDoc;
|
|
48
|
+
export type { ActionDoc, EvaluatorDoc, ProviderDoc };
|
|
49
|
+
//# sourceMappingURL=spec-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-helpers.d.ts","sourceRoot":"","sources":["../../../generated/specs/spec-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACN,KAAK,SAAS,EAOd,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,MAAM,SAAS,CAAC;AAsBjB;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAWzD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAM7D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAM/D;AAGD,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated canonical action/provider/evaluator docs for plugin-discord.
|
|
3
|
+
* DO NOT EDIT - Generated from prompts/specs/**.
|
|
4
|
+
*/
|
|
5
|
+
export type ActionDoc = {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
descriptionCompressed?: string;
|
|
9
|
+
similes?: readonly string[];
|
|
10
|
+
parameters?: readonly unknown[];
|
|
11
|
+
examples?: readonly (readonly unknown[])[];
|
|
12
|
+
};
|
|
13
|
+
export type ProviderDoc = {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
descriptionCompressed?: string;
|
|
17
|
+
position?: number;
|
|
18
|
+
dynamic?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type EvaluatorDoc = {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
descriptionCompressed?: string;
|
|
24
|
+
similes?: readonly string[];
|
|
25
|
+
alwaysRun?: boolean;
|
|
26
|
+
examples?: readonly unknown[];
|
|
27
|
+
};
|
|
28
|
+
export declare const coreActionsSpec: {
|
|
29
|
+
readonly version: "1.0.0";
|
|
30
|
+
readonly actions: readonly [{
|
|
31
|
+
readonly name: "name";
|
|
32
|
+
readonly description: "";
|
|
33
|
+
readonly parameters: readonly [];
|
|
34
|
+
}];
|
|
35
|
+
};
|
|
36
|
+
export declare const allActionsSpec: {
|
|
37
|
+
readonly version: "1.0.0";
|
|
38
|
+
readonly actions: readonly [{
|
|
39
|
+
readonly name: "name";
|
|
40
|
+
readonly description: "";
|
|
41
|
+
readonly parameters: readonly [];
|
|
42
|
+
}];
|
|
43
|
+
};
|
|
44
|
+
export declare const coreProvidersSpec: {
|
|
45
|
+
readonly version: "1.0.0";
|
|
46
|
+
readonly providers: readonly [{
|
|
47
|
+
readonly name: "channelState";
|
|
48
|
+
readonly description: "Provides information about the current Discord channel state, including whether it's a DM or group channel, channel name, and server name.";
|
|
49
|
+
readonly dynamic: true;
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "guildInfo";
|
|
52
|
+
readonly description: "Provides information about the current Discord server/guild including member count, creation date, channels, roles, and bot permissions.";
|
|
53
|
+
readonly dynamic: true;
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "voiceState";
|
|
56
|
+
readonly description: "Provides information about the voice state of the agent, including whether it is currently in a voice channel.";
|
|
57
|
+
readonly dynamic: true;
|
|
58
|
+
}];
|
|
59
|
+
};
|
|
60
|
+
export declare const allProvidersSpec: {
|
|
61
|
+
readonly version: "1.0.0";
|
|
62
|
+
readonly providers: readonly [{
|
|
63
|
+
readonly name: "channelState";
|
|
64
|
+
readonly description: "Provides information about the current Discord channel state, including whether it's a DM or group channel, channel name, and server name.";
|
|
65
|
+
readonly dynamic: true;
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "guildInfo";
|
|
68
|
+
readonly description: "Provides information about the current Discord server/guild including member count, creation date, channels, roles, and bot permissions.";
|
|
69
|
+
readonly dynamic: true;
|
|
70
|
+
}, {
|
|
71
|
+
readonly name: "voiceState";
|
|
72
|
+
readonly description: "Provides information about the voice state of the agent, including whether it is currently in a voice channel.";
|
|
73
|
+
readonly dynamic: true;
|
|
74
|
+
}];
|
|
75
|
+
};
|
|
76
|
+
export declare const coreEvaluatorsSpec: {
|
|
77
|
+
readonly version: "1.0.0";
|
|
78
|
+
readonly evaluators: readonly [];
|
|
79
|
+
};
|
|
80
|
+
export declare const allEvaluatorsSpec: {
|
|
81
|
+
readonly version: "1.0.0";
|
|
82
|
+
readonly evaluators: readonly [];
|
|
83
|
+
};
|
|
84
|
+
export declare const coreActionDocs: readonly ActionDoc[];
|
|
85
|
+
export declare const allActionDocs: readonly ActionDoc[];
|
|
86
|
+
export declare const coreProviderDocs: readonly ProviderDoc[];
|
|
87
|
+
export declare const allProviderDocs: readonly ProviderDoc[];
|
|
88
|
+
export declare const coreEvaluatorDocs: readonly EvaluatorDoc[];
|
|
89
|
+
export declare const allEvaluatorDocs: readonly EvaluatorDoc[];
|
|
90
|
+
//# sourceMappingURL=specs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../../generated/specs/specs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;CASlB,CAAC;AACX,eAAO,MAAM,cAAc;;;;;;;CASjB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;CAsBpB,CAAC;AACX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;CAsBnB,CAAC;AACX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,cAAc,EAAE,SAAS,SAAS,EAA4B,CAAC;AAC5E,eAAO,MAAM,aAAa,EAAE,SAAS,SAAS,EAA2B,CAAC;AAC1E,eAAO,MAAM,gBAAgB,EAAE,SAAS,WAAW,EACvB,CAAC;AAC7B,eAAO,MAAM,eAAe,EAAE,SAAS,WAAW,EACvB,CAAC;AAC5B,eAAO,MAAM,iBAAiB,EAAE,SAAS,YAAY,EACvB,CAAC;AAC/B,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EACvB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IAgentRuntime, type Metadata } from "@elizaos/core";
|
|
2
|
+
export declare function resolveElizaOwnerEntityId(runtime: IAgentRuntime): string;
|
|
3
|
+
export declare function resolveDiscordRuntimeEntityId(runtime: IAgentRuntime, userId: string, ownerDiscordUserIds?: Iterable<string>): string;
|
|
4
|
+
export declare function extractDiscordOwnerUserIds(application: unknown): string[];
|
|
5
|
+
export declare function parseDiscordOwnerUserIds(value: unknown): string[];
|
|
6
|
+
export declare function buildDiscordWorldMetadata(runtime: IAgentRuntime, guildOwnerId: string | undefined): Metadata | undefined;
|
|
7
|
+
export declare function buildDiscordEntityMetadata(userId: string, userName: string, name: string, globalName?: string, avatarUrl?: string): Metadata;
|
|
8
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,QAAQ,EAGb,MAAM,eAAe,CAAC;AA+CvB,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAQxE;AAED,wBAAgB,6BAA6B,CAC5C,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,MAAM,EACd,mBAAmB,GAAE,QAAQ,CAAC,MAAM,CAAM,GACxC,MAAM,CAOR;AAED,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE,CA2CzE;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAmBjE;AAED,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,MAAM,GAAG,SAAS,GAC9B,QAAQ,GAAG,SAAS,CAqBtB;AAED,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GAChB,QAAQ,CA6BV"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Message as DiscordMessage } from "discord.js";
|
|
2
|
+
export type ChatType = "dm" | "channel" | "thread" | "forum";
|
|
3
|
+
export interface EnvelopeResult {
|
|
4
|
+
formattedContent: string;
|
|
5
|
+
chatType: ChatType;
|
|
6
|
+
}
|
|
7
|
+
export declare function formatInboundEnvelope(message: DiscordMessage, rawContent: string): Promise<EnvelopeResult>;
|
|
8
|
+
//# sourceMappingURL=inbound-envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbound-envelope.d.ts","sourceRoot":"","sources":["../inbound-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,OAAO,IAAI,cAAc,EAG9B,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAkFD,wBAAsB,qBAAqB,CAC1C,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC,CAgCzB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Entry Point for Discord Plugin
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: This file provides a browser-compatible stub for the Discord plugin.
|
|
5
|
+
* The Discord.js library requires Node.js APIs (WebSocket, Buffer, etc.) that are
|
|
6
|
+
* not available in browser environments.
|
|
7
|
+
*
|
|
8
|
+
* LIMITATIONS:
|
|
9
|
+
* - No direct Discord Gateway connection (WebSocket unavailable)
|
|
10
|
+
* - No bot token authentication
|
|
11
|
+
* - No event handling or message processing
|
|
12
|
+
* - No slash command registration
|
|
13
|
+
*
|
|
14
|
+
* RECOMMENDED ALTERNATIVES:
|
|
15
|
+
* 1. Server Proxy: Run the full Discord plugin on a Node.js server and communicate
|
|
16
|
+
* via API endpoints from your browser application.
|
|
17
|
+
* 2. OAuth Flow: For user-facing apps, implement Discord OAuth2 in the browser
|
|
18
|
+
* and handle bot operations server-side.
|
|
19
|
+
* 3. Webhooks: For simple message sending, Discord webhooks work from browsers
|
|
20
|
+
* (though they're one-way communication only).
|
|
21
|
+
*
|
|
22
|
+
* @module plugin-discord/browser
|
|
23
|
+
*/
|
|
24
|
+
import type { Plugin } from "@elizaos/core";
|
|
25
|
+
/**
|
|
26
|
+
* Browser stub for the Discord plugin.
|
|
27
|
+
*
|
|
28
|
+
* This stub provides the same interface as the full plugin but does not
|
|
29
|
+
* implement any Discord functionality. It exists to prevent build errors
|
|
30
|
+
* when the plugin is bundled for browser targets.
|
|
31
|
+
*/
|
|
32
|
+
export declare const discordPlugin: Plugin;
|
|
33
|
+
export default discordPlugin;
|
|
34
|
+
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../index.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAK3D;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,MAU3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type Plugin } from "@elizaos/core";
|
|
2
|
+
declare const discordPlugin: Plugin;
|
|
3
|
+
export default discordPlugin;
|
|
4
|
+
export { DEFAULT_ACCOUNT_ID, type DiscordMultiAccountConfig, type DiscordTokenResolution, type DiscordTokenSource, isMultiAccountEnabled, listDiscordAccountIds, listEnabledDiscordAccounts, normalizeAccountId, normalizeDiscordToken, type ResolvedDiscordAccount, resolveDefaultDiscordAccountId, resolveDiscordAccount, resolveDiscordToken, } from "./accounts";
|
|
5
|
+
export { type AllowListMatchSource, allowListMatches, type ChannelMatchSource, type DiscordAllowList, type DiscordAllowListMatch, type DiscordChannelConfigResolved, formatDiscordUserTag, isDiscordAutoThreadOwnedByBot, isDiscordGroupAllowedByPolicy, normalizeDiscordAllowList, normalizeDiscordSlug, resolveDiscordAllowListMatch, resolveDiscordChannelConfig, resolveDiscordChannelConfigWithFallback, resolveDiscordCommandAuthorized, resolveDiscordGuildEntry, resolveDiscordShouldRequireMention, resolveDiscordUserAllowed, resolveGroupDmAllow, shouldEmitDiscordReactionNotification, validateMessageAllowed, } from "./allowlist";
|
|
6
|
+
export type { DiscordAccountConfig, DiscordActionConfig, DiscordChannelConfig, DiscordConfig, DiscordDmConfig, DiscordExecApprovalConfig, DiscordGuildChannelConfig, DiscordGuildEntry, DiscordIntentsConfig, DiscordPluralKitConfig, DiscordReactionNotificationMode, } from "./config";
|
|
7
|
+
export { DISCORD_SERVICE_NAME } from "./constants";
|
|
8
|
+
export { DISCORD_LOCAL_PLUGIN_NAME, DISCORD_LOCAL_SERVICE_NAME, DiscordLocalService, default as discordLocalPlugin, } from "./discord-local-service";
|
|
9
|
+
export { buildChannelLink, buildMessageLink, type ChunkDiscordTextOpts, chunkDiscordText, chunkDiscordTextWithMode, escapeDiscordMarkdown, extractAllChannelMentions, extractAllRoleMentions, extractAllUserMentions, extractChannelIdFromMention, extractRoleIdFromMention, extractUserIdFromMention, formatDiscordChannelMention, formatDiscordReactionEmoji, formatDiscordRoleMention, formatDiscordTimestamp, formatDiscordUserMention, formatMessageReactionEmoji, messageContainsMention, parseMessageLink, resolveDiscordSystemLocation, resolveTimestampMs, sanitizeThreadName, stripDiscordFormatting, truncateText, truncateUtf16Safe, } from "./messaging";
|
|
10
|
+
export { type BuiltCommandOption, buildCommandArgCustomId, buildCommandArgMenu, buildCommandText, buildDiscordCommandOptions, buildDiscordSlashCommand, COMMAND_ARG_CUSTOM_ID_KEY, type CommandArgButton, type CommandArgButtonRow, type CommandArgDefinition, type CommandArgMenu, type CommandArgs, type CommandArgValues, createCommandArgs, decodeCommandArgValue, encodeCommandArgValue, isUnknownInteractionError, type NativeCommandSpec, parseCommandArgCustomId, safeInteractionCall, serializeCommandArgs, } from "./native-commands";
|
|
11
|
+
export { DISCORD_OWNER_PAIRING_SERVICE_TYPE, type DiscordOwnerPairingService, DiscordOwnerPairingServiceImpl, } from "./owner-pairing-service";
|
|
12
|
+
export { ELEVATED_PERMISSIONS, hasElevatedPermissions, isElevatedRole, } from "./permissionEvents";
|
|
13
|
+
export { type DiscordPermissionTier, DiscordPermissionTiers, type DiscordPermissionValues, generateAllInviteUrls, generateInviteUrl, getPermissionValues, } from "./permissions";
|
|
14
|
+
export type { DiscordService as IDiscordService } from "./service";
|
|
15
|
+
export { DiscordService } from "./service";
|
|
16
|
+
export { discordSetupRoutes } from "./setup-routes";
|
|
17
|
+
export type { AuditInfo, ChannelPermissionsChangedPayload, MemberRolesChangedPayload, PermissionDiff, PermissionState, RoleLifecyclePayload, RolePermissionsChangedPayload, } from "./types";
|
|
18
|
+
export { DiscordEventTypes } from "./types";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"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"}
|