@copilotkit/channels-discord 0.0.3 → 0.2.1-canary.1784916581
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/README.md +32 -7
- package/dist/adapter.d.ts +8 -8
- package/dist/adapter.d.ts.map +1 -1
- package/dist/built-in-context.d.ts +3 -3
- package/dist/built-in-context.d.ts.map +1 -1
- package/dist/built-in-context.js +1 -1
- package/dist/built-in-tools.d.ts +3 -3
- package/dist/built-in-tools.d.ts.map +1 -1
- package/dist/built-in-tools.js +2 -2
- package/dist/commands.d.ts +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/conversation-store.d.ts +1 -1
- package/dist/conversation-store.d.ts.map +1 -1
- package/dist/discord-listener.d.ts +1 -1
- package/dist/discord-listener.d.ts.map +1 -1
- package/dist/event-renderer.d.ts +1 -1
- package/dist/event-renderer.d.ts.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.d.ts.map +1 -1
- package/dist/render/components-v2.d.ts +3 -3
- package/dist/render/components-v2.d.ts.map +1 -1
- package/dist/render/components-v2.test.js +4 -1
- package/dist/render/modal.d.ts +2 -2
- package/dist/render/modal.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@ streaming, opaque-id interactions, and HITL.
|
|
|
8
8
|
You write your UI as JSX once (`@copilotkit/channels-ui`) and drive the bot with
|
|
9
9
|
`@copilotkit/channels`; this package is the only one that talks to Discord.
|
|
10
10
|
|
|
11
|
+
The adapter keeps its own Discord credentials (`botToken` / `appId` / …) — but
|
|
12
|
+
the Channel itself only runs inside a CopilotKit Intelligence-configured
|
|
13
|
+
`CopilotRuntime` (an API key; a free tier is available). There is no
|
|
14
|
+
standalone / DIY runner and no `channel.start()`; the runtime starts and owns
|
|
15
|
+
the channel because Intelligence is configured.
|
|
16
|
+
|
|
11
17
|
## Install
|
|
12
18
|
|
|
13
19
|
```sh
|
|
@@ -17,14 +23,20 @@ pnpm add @copilotkit/channels-discord @copilotkit/channels @copilotkit/channels-
|
|
|
17
23
|
## Quickstart
|
|
18
24
|
|
|
19
25
|
```ts
|
|
20
|
-
import {
|
|
26
|
+
import { createChannel } from "@copilotkit/channels";
|
|
21
27
|
import {
|
|
22
28
|
discord,
|
|
23
29
|
defaultDiscordTools,
|
|
24
30
|
defaultDiscordContext,
|
|
25
31
|
} from "@copilotkit/channels-discord";
|
|
32
|
+
import {
|
|
33
|
+
CopilotRuntime,
|
|
34
|
+
CopilotKitIntelligence,
|
|
35
|
+
createCopilotRuntimeHandler,
|
|
36
|
+
} from "@copilotkit/runtime/v2";
|
|
26
37
|
|
|
27
|
-
const bot =
|
|
38
|
+
const bot = createChannel({
|
|
39
|
+
name: "support-bot", // project-unique Intelligence Channel name
|
|
28
40
|
adapters: [
|
|
29
41
|
discord({
|
|
30
42
|
botToken: process.env.DISCORD_BOT_TOKEN!, // Bot token — Gateway + REST
|
|
@@ -48,7 +60,19 @@ const bot = createBot({
|
|
|
48
60
|
|
|
49
61
|
bot.onMention(({ thread }) => thread.runAgent());
|
|
50
62
|
|
|
51
|
-
|
|
63
|
+
// The runtime owns the channel's lifecycle — there is no `bot.start()`.
|
|
64
|
+
const runtime = new CopilotRuntime({
|
|
65
|
+
intelligence: new CopilotKitIntelligence({
|
|
66
|
+
apiUrl: "https://api.copilotkit.ai",
|
|
67
|
+
wsUrl: "wss://api.copilotkit.ai",
|
|
68
|
+
apiKey: process.env.COPILOTKIT_INTELLIGENCE_API_KEY!, // free tier available
|
|
69
|
+
}),
|
|
70
|
+
identifyUser: async () => ({ id: "support-bot", name: "Support Bot" }),
|
|
71
|
+
channels: [bot],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const handler = createCopilotRuntimeHandler({ runtime });
|
|
75
|
+
await handler.channels.ready(); // starts the channel; handler.channels.stop() tears it down
|
|
52
76
|
```
|
|
53
77
|
|
|
54
78
|
`discord(opts)` returns a `DiscordAdapter`. The adapter connects via the
|
|
@@ -233,7 +257,7 @@ back out via `thread.postFile(...)`.
|
|
|
233
257
|
|
|
234
258
|
## Tool context
|
|
235
259
|
|
|
236
|
-
Tools receive the single shared `
|
|
260
|
+
Tools receive the single shared `ChannelToolContext` from `@copilotkit/channels`
|
|
237
261
|
(`{ thread, message?, user?, signal?, platform }`) and reach Discord power
|
|
238
262
|
only through capability-gated `thread` methods, which this adapter backs:
|
|
239
263
|
|
|
@@ -245,13 +269,14 @@ isBot? }`).
|
|
|
245
269
|
- `thread.postFile({ bytes, filename, title?, altText? })` — upload a file
|
|
246
270
|
into the channel as an attachment.
|
|
247
271
|
|
|
248
|
-
This keeps tools portable: define them with `
|
|
272
|
+
This keeps tools portable: define them with `defineChannelTool({...})` and they
|
|
249
273
|
work against any adapter that advertises the same capabilities.
|
|
250
274
|
|
|
251
275
|
## Slash commands
|
|
252
276
|
|
|
253
|
-
Slash commands are registered up front
|
|
254
|
-
|
|
277
|
+
Slash commands are registered up front — when the runtime activates the
|
|
278
|
+
channel (`await handler.channels.ready()`) — via `registerCommands`. When
|
|
279
|
+
`guildId` is set they register to that guild instantly; without it they
|
|
255
280
|
register globally and take ~1 hour to propagate. Register handlers with
|
|
256
281
|
`bot.onCommand`:
|
|
257
282
|
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client, GatewayIntentBits, Partials } from "discord.js";
|
|
2
|
-
import type { PlatformAdapter, SurfaceCapabilities, IngressSink, InteractionEvent, RunRenderer, ReplyTarget as BotReplyTarget, ConversationStore, MessageRef, PlatformUser, UserQuery, CommandSpec, NativePayload } from "@copilotkit/channels";
|
|
3
|
-
import type {
|
|
2
|
+
import type { PlatformAdapter, SurfaceCapabilities, IngressSink, InteractionEvent, RunRenderer, ReplyTarget as BotReplyTarget, ConversationStore, MessageRef, PlatformUser, UserQuery, CommandSpec, NativePayload } from "@copilotkit/channels-core";
|
|
3
|
+
import type { ChannelNode, ThreadMessage, EmojiValue, EphemeralResult } from "@copilotkit/channels-ui";
|
|
4
4
|
import type { RestLike } from "./commands.js";
|
|
5
5
|
export interface DiscordAdapterOptions {
|
|
6
6
|
botToken: string;
|
|
@@ -68,9 +68,9 @@ export declare class DiscordAdapter implements PlatformAdapter {
|
|
|
68
68
|
private publishCommands;
|
|
69
69
|
start(sink: IngressSink): Promise<void>;
|
|
70
70
|
stop(): Promise<void>;
|
|
71
|
-
render(ir:
|
|
72
|
-
post(target: BotReplyTarget, ir:
|
|
73
|
-
update(ref: MessageRef, ir:
|
|
71
|
+
render(ir: ChannelNode[]): import("discord.js").ContainerBuilder;
|
|
72
|
+
post(target: BotReplyTarget, ir: ChannelNode[]): Promise<MessageRef>;
|
|
73
|
+
update(ref: MessageRef, ir: ChannelNode[]): Promise<void>;
|
|
74
74
|
stream(target: BotReplyTarget, chunks: AsyncIterable<string>): Promise<MessageRef>;
|
|
75
75
|
delete(ref: MessageRef): Promise<void>;
|
|
76
76
|
createRunRenderer(target: BotReplyTarget): RunRenderer;
|
|
@@ -96,11 +96,11 @@ export declare class DiscordAdapter implements PlatformAdapter {
|
|
|
96
96
|
ok: boolean;
|
|
97
97
|
error?: string;
|
|
98
98
|
}>;
|
|
99
|
-
postEphemeral(_target: BotReplyTarget, user: PlatformUser | string, ir:
|
|
99
|
+
postEphemeral(_target: BotReplyTarget, user: PlatformUser | string, ir: ChannelNode[], opts: {
|
|
100
100
|
fallbackToDM: boolean;
|
|
101
101
|
}): Promise<EphemeralResult | null>;
|
|
102
|
-
renderModal(ir:
|
|
103
|
-
openModal(_target: BotReplyTarget, triggerId: string, ir:
|
|
102
|
+
renderModal(ir: ChannelNode[]): NativePayload;
|
|
103
|
+
openModal(_target: BotReplyTarget, triggerId: string, ir: ChannelNode[]): Promise<{
|
|
104
104
|
ok: boolean;
|
|
105
105
|
error?: string;
|
|
106
106
|
}>;
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,iBAAiB,EAEjB,QAAQ,EAET,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,WAAW,IAAI,cAAc,EAC7B,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,SAAS,EACT,WAAW,EACX,aAAa,EACd,MAAM,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,iBAAiB,EAEjB,QAAQ,EAET,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,WAAW,IAAI,cAAc,EAC7B,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,SAAS,EACT,WAAW,EACX,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,UAAU,EACV,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAcjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAS9C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAqBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,6PAW1B,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,kEAI3B,CAAC;AAEX,qBAAa,cAAe,YAAW,eAAe;IAkClD,OAAO,CAAC,QAAQ,CAAC,IAAI;IAjCvB,QAAQ,CAAC,QAAQ,aAAa;IAC9B,QAAQ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ACb,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,WAAW,EAAE,GAChB,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAiCrC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAqBxD,OAAO,CAAC,WAAW;YAIL,aAAa;IAQ3B;;;;OAIG;YACW,YAAY;CAkD3B;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc,CAEnE"}
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* Discord-platform-universal context entries — knowledge the LLM needs
|
|
3
3
|
* about Discord itself (tagging procedure, formatting, conversation
|
|
4
4
|
* model). Apps spread `defaultDiscordContext` into the `context:` config
|
|
5
|
-
* they pass to `
|
|
5
|
+
* they pass to `createChannel`.
|
|
6
6
|
*
|
|
7
7
|
* Each entry is exported individually too so apps can cherry-pick.
|
|
8
8
|
*/
|
|
9
|
-
import type { ContextEntry } from "@copilotkit/channels";
|
|
9
|
+
import type { ContextEntry } from "@copilotkit/channels-core";
|
|
10
10
|
export declare const discordTaggingContext: ContextEntry;
|
|
11
11
|
export declare const discordFormattingContext: ContextEntry;
|
|
12
12
|
export declare const discordConversationModelContext: ContextEntry;
|
|
13
13
|
/**
|
|
14
14
|
* The default context entries the SDK ships. Spread into your
|
|
15
|
-
* `
|
|
15
|
+
* `createChannel({context: …})`:
|
|
16
16
|
*
|
|
17
17
|
* context: [...defaultDiscordContext, ...myAppContext],
|
|
18
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"built-in-context.d.ts","sourceRoot":"","sources":["../src/built-in-context.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"built-in-context.d.ts","sourceRoot":"","sources":["../src/built-in-context.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,eAAO,MAAM,qBAAqB,EAAE,YAMnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,YAOtC,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,YAM7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAAY,EAI/C,CAAC"}
|
package/dist/built-in-context.js
CHANGED
|
@@ -19,7 +19,7 @@ export const discordConversationModelContext = {
|
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* The default context entries the SDK ships. Spread into your
|
|
22
|
-
* `
|
|
22
|
+
* `createChannel({context: …})`:
|
|
23
23
|
*
|
|
24
24
|
* context: [...defaultDiscordContext, ...myAppContext],
|
|
25
25
|
*/
|
package/dist/built-in-tools.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const lookupDiscordUserTool:
|
|
3
|
-
export declare const defaultDiscordTools:
|
|
1
|
+
import type { ChannelTool } from "@copilotkit/channels-core";
|
|
2
|
+
export declare const lookupDiscordUserTool: ChannelTool;
|
|
3
|
+
export declare const defaultDiscordTools: ChannelTool[];
|
|
4
4
|
//# sourceMappingURL=built-in-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"built-in-tools.d.ts","sourceRoot":"","sources":["../src/built-in-tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"built-in-tools.d.ts","sourceRoot":"","sources":["../src/built-in-tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,eAAO,MAAM,qBAAqB,EAAE,WAsBlC,CAAC;AAEH,eAAO,MAAM,mBAAmB,EAAE,WAAW,EAA4B,CAAC"}
|
package/dist/built-in-tools.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
export const lookupDiscordUserTool =
|
|
2
|
+
import { defineChannelTool } from "@copilotkit/channels-core";
|
|
3
|
+
export const lookupDiscordUserTool = defineChannelTool({
|
|
4
4
|
name: "lookup_discord_user",
|
|
5
5
|
description: "Resolve a person's name, display name, or handle to a Discord user id and a " +
|
|
6
6
|
"ready-to-use <@id> mention.",
|
package/dist/commands.d.ts
CHANGED
package/dist/commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAmC7D,4DAA4D;AAC5D,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,KAAK,EAAE,IAAI,MAAM,EAAE,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxE;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EAAE,CAAC;CACtD;AAoDD,sFAAsF;AACtF,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,aAAa,EAAE,CA4EjB;AAwCD,iDAAiD;AACjD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B,CAMA;AAED,2FAA2F;AAC3F,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,KAAK,EAAE,SAAS,WAAW,EAAE,GAC5B,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AbstractAgent } from "@ag-ui/client";
|
|
2
|
-
import type { ConversationStore, AgentSession, ReplyTarget as BotReplyTarget } from "@copilotkit/channels";
|
|
2
|
+
import type { ConversationStore, AgentSession, ReplyTarget as BotReplyTarget } from "@copilotkit/channels-core";
|
|
3
3
|
import type { DiscordAttachmentRef, FileDeliveryConfig } from "./download-files.js";
|
|
4
4
|
/** A single Discord message, normalized for history reconstruction. */
|
|
5
5
|
export interface DiscordHistoryMessage {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-store.d.ts","sourceRoot":"","sources":["../src/conversation-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,WAAW,IAAI,cAAc,EAC9B,MAAM,
|
|
1
|
+
{"version":3,"file":"conversation-store.d.ts","sourceRoot":"","sources":["../src/conversation-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,WAAW,IAAI,cAAc,EAC9B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAEV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAG7B,uEAAuE;AACvE,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,qBAAa,wBAAyB,YAAW,iBAAiB;IAE9D,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE;QACZ,sCAAsC;QACtC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;QACtE,6DAA6D;QAC7D,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,iEAAiE;QACjE,WAAW,CAAC,EAAE,kBAAkB,CAAC;KAClC;IAGH;;;;OAIG;IACG,WAAW,CACf,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,cAAc,EAC5B,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,aAAa,GAC7C,OAAO,CAAC,YAAY,CAAC;IAOxB;;;;;;OAMG;YACW,WAAW;CA+C1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IncomingReaction } from "@copilotkit/channels";
|
|
1
|
+
import type { IncomingReaction } from "@copilotkit/channels-core";
|
|
2
2
|
import type { IncomingTurn, ReplyTarget } from "./types.js";
|
|
3
3
|
import type { PendingInteractions } from "./pending-interactions.js";
|
|
4
4
|
interface MessageLike {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord-listener.d.ts","sourceRoot":"","sources":["../src/discord-listener.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"discord-listener.d.ts","sourceRoot":"","sources":["../src/discord-listener.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,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AAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D;;;;;OAKG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAED,qFAAqF;AACrF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAiG/D"}
|
package/dist/event-renderer.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-renderer.d.ts","sourceRoot":"","sources":["../src/event-renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAGZ,MAAM,
|
|
1
|
+
{"version":3,"file":"event-renderer.d.ts","sourceRoot":"","sources":["../src/event-renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAGZ,MAAM,2BAA2B,CAAC;AAwBnC;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QACnD,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACzD,CAAC,CAAC;CACJ;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,OAAO,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C,GAAG,WAAW,CAqQd"}
|
package/dist/interaction.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InteractionEvent, IncomingReaction, IncomingModalSubmit } from "@copilotkit/channels";
|
|
1
|
+
import type { InteractionEvent, IncomingReaction, IncomingModalSubmit } from "@copilotkit/channels-core";
|
|
2
2
|
/** Decode a discord.js component interaction into the engine's opaque InteractionEvent. */
|
|
3
3
|
export declare function decodeInteraction(raw: unknown): InteractionEvent | undefined;
|
|
4
4
|
/** Decode a discord.js `ModalSubmitInteraction` into an `IncomingModalSubmit`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../src/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,
|
|
1
|
+
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../src/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAqBnC,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAkD5E;AA4DD,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,OAAO,GAAG,mBAAmB,CAmB3E;AAMD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,OAAO,EACjB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,OAAO,GACb,gBAAgB,GAAG,SAAS,CAsB9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContainerBuilder } from "discord.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ChannelNode } from "@copilotkit/channels-ui";
|
|
3
3
|
/**
|
|
4
4
|
* Render a cross-platform IR tree (already expanded + action-bound, so event
|
|
5
5
|
* props are `{ id }`) into a single top-level Components V2 `ContainerBuilder`.
|
|
@@ -7,9 +7,9 @@ import type { BotNode } from "@copilotkit/channels-ui";
|
|
|
7
7
|
* Total renderer: unknown intrinsics are skipped, never thrown. Per-element
|
|
8
8
|
* limits apply via truncate/clamp; nothing is silently dropped.
|
|
9
9
|
*/
|
|
10
|
-
export declare function renderComponents(ir:
|
|
10
|
+
export declare function renderComponents(ir: ChannelNode[]): ContainerBuilder;
|
|
11
11
|
/** Ready-to-send payload for channel.send / message.edit. */
|
|
12
|
-
export declare function renderDiscordMessage(ir:
|
|
12
|
+
export declare function renderDiscordMessage(ir: ChannelNode[]): {
|
|
13
13
|
components: ContainerBuilder[];
|
|
14
14
|
flags: number;
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-v2.d.ts","sourceRoot":"","sources":["../../src/render/components-v2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAYjB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"components-v2.d.ts","sourceRoot":"","sources":["../../src/render/components-v2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAYjB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAwF3D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,GAAG,gBAAgB,CAiBpE;AAED,6DAA6D;AAC7D,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,EAAE,GAAG;IACvD,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAKA"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from "vitest";
|
|
2
2
|
import { ComponentType, ButtonStyle } from "discord.js";
|
|
3
3
|
import { renderComponents } from "./components-v2.js";
|
|
4
|
-
const text = (value) => ({
|
|
4
|
+
const text = (value) => ({
|
|
5
|
+
type: "text",
|
|
6
|
+
props: { value },
|
|
7
|
+
});
|
|
5
8
|
const node = (type, props = {}) => ({
|
|
6
9
|
type,
|
|
7
10
|
props,
|
package/dist/render/modal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChannelNode } from "@copilotkit/channels-ui";
|
|
2
2
|
import { ModalBuilder } from "discord.js";
|
|
3
3
|
/**
|
|
4
4
|
* Lower a modal IR tree to a discord.js {@link ModalBuilder}.
|
|
@@ -8,5 +8,5 @@ import { ModalBuilder } from "discord.js";
|
|
|
8
8
|
* a {@link ModalRenderError}, which `adapter.openModal` translates to
|
|
9
9
|
* `{ ok: false, error }` (degrade-never-throw at the boundary).
|
|
10
10
|
*/
|
|
11
|
-
export declare function renderDiscordModal(ir:
|
|
11
|
+
export declare function renderDiscordModal(ir: ChannelNode[]): ModalBuilder;
|
|
12
12
|
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/render/modal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/render/modal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAEL,YAAY,EAGb,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,WAAW,EAAE,GAAG,YAAY,CAkClE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/channels-discord",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1-canary.1784916581",
|
|
4
4
|
"description": "Discord PlatformAdapter for @copilotkit/channels.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@ag-ui/client": "0.0.57",
|
|
37
37
|
"discord.js": "^14.16.0",
|
|
38
38
|
"zod": "^3.25.76",
|
|
39
|
-
"@copilotkit/channels": "0.1.
|
|
40
|
-
"@copilotkit/channels-ui": "0.1.
|
|
39
|
+
"@copilotkit/channels-core": "^0.2.1-canary.1784916581",
|
|
40
|
+
"@copilotkit/channels-ui": "^0.2.1-canary.1784916581"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^22.10.0",
|