@notionhq/apps 0.0.13 → 0.0.15
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 +110 -49
- package/dist/box.generated.d.ts +164 -0
- package/dist/box.generated.d.ts.map +1 -0
- package/dist/box.generated.js +24 -0
- package/dist/calendar.generated.d.ts +1036 -0
- package/dist/calendar.generated.d.ts.map +1 -0
- package/dist/calendar.generated.js +42 -0
- package/dist/cli/build.js +7 -6
- package/dist/cli/emit-manifest.d.ts.map +1 -1
- package/dist/cli/emit-manifest.js +1 -4
- package/dist/confluence.generated.d.ts +98 -0
- package/dist/confluence.generated.d.ts.map +1 -0
- package/dist/confluence.generated.js +18 -0
- package/dist/connection-actions.d.ts +2 -0
- package/dist/connection-actions.d.ts.map +1 -0
- package/dist/connection-actions.js +0 -0
- package/dist/connection-trigger-definitions.generated.d.ts +34 -0
- package/dist/connection-trigger-definitions.generated.d.ts.map +1 -0
- package/dist/connection-trigger-definitions.generated.js +45 -0
- package/dist/connections.d.ts +15 -0
- package/dist/connections.d.ts.map +1 -0
- package/dist/connections.js +79 -0
- package/dist/connections.test.d.ts +2 -0
- package/dist/connections.test.d.ts.map +1 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +3 -0
- package/dist/context.test.d.ts +2 -0
- package/dist/context.test.d.ts.map +1 -0
- package/dist/cursor.generated.d.ts +154 -0
- package/dist/cursor.generated.d.ts.map +1 -0
- package/dist/cursor.generated.js +18 -0
- package/dist/custom-block.d.ts +1 -1
- package/dist/custom-block.d.ts.map +1 -1
- package/dist/custom-block.js +3 -3
- package/dist/discord.generated.d.ts +279 -0
- package/dist/discord.generated.d.ts.map +1 -0
- package/dist/discord.generated.js +33 -0
- package/dist/gmail.generated.d.ts +184 -0
- package/dist/gmail.generated.d.ts.map +1 -0
- package/dist/gmail.generated.js +21 -0
- package/dist/googleCalendar.generated.d.ts +83 -0
- package/dist/googleCalendar.generated.d.ts.map +1 -0
- package/dist/googleCalendar.generated.js +15 -0
- package/dist/googleDrive.generated.d.ts +210 -0
- package/dist/googleDrive.generated.d.ts.map +1 -0
- package/dist/googleDrive.generated.js +27 -0
- package/dist/googleDriveOauth.generated.d.ts +851 -0
- package/dist/googleDriveOauth.generated.d.ts.map +1 -0
- package/dist/googleDriveOauth.generated.js +84 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/outlook.generated.d.ts +224 -0
- package/dist/outlook.generated.d.ts.map +1 -0
- package/dist/outlook.generated.js +24 -0
- package/dist/providers.generated.d.ts +117 -0
- package/dist/providers.generated.d.ts.map +1 -0
- package/dist/providers.generated.js +108 -0
- package/dist/salesforce.generated.d.ts +151 -0
- package/dist/salesforce.generated.d.ts.map +1 -0
- package/dist/salesforce.generated.js +24 -0
- package/dist/slack.generated.d.ts +290 -0
- package/dist/slack.generated.d.ts.map +1 -0
- package/dist/slack.generated.js +30 -0
- package/dist/sync.d.ts +2 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +3 -3
- package/dist/triggers.generated.d.ts +107 -32
- package/dist/triggers.generated.d.ts.map +1 -1
- package/dist/triggers.generated.js +36 -24
- package/dist/workflow-connections-types.test.d.ts +2 -0
- package/dist/workflow-connections-types.test.d.ts.map +1 -0
- package/dist/workflow-types.test.d.ts +2 -0
- package/dist/workflow-types.test.d.ts.map +1 -0
- package/dist/workflow.d.ts +24 -20
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +16 -19
- package/docs/BUILD.md +83 -14
- package/docs/CONNECTIONS.md +130 -0
- package/package.json +5 -1
- package/src/box.generated.ts +187 -0
- package/src/calendar.generated.ts +1117 -0
- package/src/cli/build.test.ts +35 -4
- package/src/cli/build.ts +6 -5
- package/src/cli/emit-manifest.ts +1 -5
- package/src/confluence.generated.ts +109 -0
- package/src/connection-actions.ts +2 -0
- package/src/connection-trigger-definitions.generated.ts +48 -0
- package/src/connections.test.ts +157 -0
- package/src/connections.ts +126 -0
- package/src/context.test.ts +26 -0
- package/src/context.ts +8 -0
- package/src/cursor.generated.ts +167 -0
- package/src/custom-block.test.ts +4 -4
- package/src/custom-block.ts +2 -2
- package/src/discord.generated.ts +318 -0
- package/src/gmail.generated.ts +205 -0
- package/src/googleCalendar.generated.ts +95 -0
- package/src/googleDrive.generated.ts +235 -0
- package/src/googleDriveOauth.generated.ts +980 -0
- package/src/index.ts +7 -0
- package/src/outlook.generated.ts +249 -0
- package/src/providers.generated.ts +207 -0
- package/src/salesforce.generated.ts +170 -0
- package/src/slack.generated.ts +330 -0
- package/src/sync.ts +2 -2
- package/src/triggers.generated.ts +112 -32
- package/src/workflow-connections-types.test.ts +59 -0
- package/src/workflow-types.test.ts +144 -0
- package/src/workflow.test.ts +135 -25
- package/src/workflow.ts +63 -34
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Generated by notion tool-core codegen-script-types --connections. Do not edit.
|
|
2
|
+
import type { ConnectionActionInvoker } from "./connection-actions.js"
|
|
3
|
+
/**
|
|
4
|
+
* Script input for the "Create Cursor agent" effect (`cursor.createAgent`),
|
|
5
|
+
* derived from its Tool Core definition's call_function input projection.
|
|
6
|
+
*
|
|
7
|
+
* Create a new Cursor agent
|
|
8
|
+
*/
|
|
9
|
+
export type CreateAgentScriptInput = {
|
|
10
|
+
/**
|
|
11
|
+
* What you want the agent to do
|
|
12
|
+
*/
|
|
13
|
+
prompt: string
|
|
14
|
+
/**
|
|
15
|
+
* GitHub repository URL or owner/repo format (e.g. 'owner/repo' or 'https://github.com/owner/repo')
|
|
16
|
+
*/
|
|
17
|
+
repository: string
|
|
18
|
+
/**
|
|
19
|
+
* Optional branch or ref to work from (e.g. 'main', 'develop')
|
|
20
|
+
*/
|
|
21
|
+
ref?: string
|
|
22
|
+
/**
|
|
23
|
+
* Custom branch name for the agent to create in the target repository.
|
|
24
|
+
*/
|
|
25
|
+
branchName?: string
|
|
26
|
+
/**
|
|
27
|
+
* Whether to open the pull request as the Cursor GitHub App instead of as the user (default: true). Only applies when a PR is auto-created.
|
|
28
|
+
*/
|
|
29
|
+
openAsCursorGithubApp?: boolean
|
|
30
|
+
/**
|
|
31
|
+
* Whether to skip adding the user as a reviewer on the pull request. Only applies if autoCreatePr is true and the PR is opened as the Cursor GitHub App (default: false).
|
|
32
|
+
*/
|
|
33
|
+
skipReviewerRequest?: boolean
|
|
34
|
+
webhook?: {
|
|
35
|
+
/**
|
|
36
|
+
* Webhook URL to receive agent status updates.
|
|
37
|
+
*/
|
|
38
|
+
url: string
|
|
39
|
+
/**
|
|
40
|
+
* Optional shared secret for verifying webhook signatures.
|
|
41
|
+
*/
|
|
42
|
+
secret?: string
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Canonical Tool Core output for the "Create Cursor agent" effect (`cursor.createAgent`).
|
|
48
|
+
* This is the definition's output schema; the effect's script surface may
|
|
49
|
+
* re-encode it before returning.
|
|
50
|
+
*/
|
|
51
|
+
export type CreateAgentScriptOutput = {
|
|
52
|
+
id: string
|
|
53
|
+
name: string
|
|
54
|
+
/**
|
|
55
|
+
* One of: `CREATING`, `RUNNING`, `FINISHED`, `ERROR`, `EXPIRED`
|
|
56
|
+
*/
|
|
57
|
+
status: "CREATING" | "RUNNING" | "FINISHED" | "ERROR" | "EXPIRED"
|
|
58
|
+
source: {
|
|
59
|
+
repository: string
|
|
60
|
+
ref?: string
|
|
61
|
+
}
|
|
62
|
+
target: {
|
|
63
|
+
url: string
|
|
64
|
+
prUrl?: string
|
|
65
|
+
branchName?: string
|
|
66
|
+
autoCreatePr?: boolean
|
|
67
|
+
autoBranch?: boolean
|
|
68
|
+
openAsCursorGithubApp?: boolean
|
|
69
|
+
skipReviewerRequest?: boolean
|
|
70
|
+
}
|
|
71
|
+
createdAt: string
|
|
72
|
+
summary?: string
|
|
73
|
+
conversation?: {
|
|
74
|
+
id: string
|
|
75
|
+
messages: Array<{
|
|
76
|
+
id: string
|
|
77
|
+
type: string
|
|
78
|
+
text: string
|
|
79
|
+
}>
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Script input for the "Get Cursor agent" effect (`cursor.getAgent`),
|
|
85
|
+
* derived from its Tool Core definition's call_function input projection.
|
|
86
|
+
*
|
|
87
|
+
* Get a Cursor agent by ID
|
|
88
|
+
*/
|
|
89
|
+
export type GetAgentScriptInput = {
|
|
90
|
+
/**
|
|
91
|
+
* The ID of the Cursor agent to get (e.g. 'agent-123')
|
|
92
|
+
*/
|
|
93
|
+
agentId: string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Canonical Tool Core output for the "Get Cursor agent" effect (`cursor.getAgent`).
|
|
98
|
+
* This is the definition's output schema; the effect's script surface may
|
|
99
|
+
* re-encode it before returning.
|
|
100
|
+
*/
|
|
101
|
+
export type GetAgentScriptOutput = {
|
|
102
|
+
id: string
|
|
103
|
+
name: string
|
|
104
|
+
/**
|
|
105
|
+
* One of: `CREATING`, `RUNNING`, `FINISHED`, `ERROR`, `EXPIRED`
|
|
106
|
+
*/
|
|
107
|
+
status: "CREATING" | "RUNNING" | "FINISHED" | "ERROR" | "EXPIRED"
|
|
108
|
+
source: {
|
|
109
|
+
repository: string
|
|
110
|
+
ref?: string
|
|
111
|
+
}
|
|
112
|
+
target: {
|
|
113
|
+
url: string
|
|
114
|
+
prUrl?: string
|
|
115
|
+
branchName?: string
|
|
116
|
+
autoCreatePr?: boolean
|
|
117
|
+
autoBranch?: boolean
|
|
118
|
+
openAsCursorGithubApp?: boolean
|
|
119
|
+
skipReviewerRequest?: boolean
|
|
120
|
+
}
|
|
121
|
+
createdAt: string
|
|
122
|
+
summary?: string
|
|
123
|
+
conversation?: {
|
|
124
|
+
id: string
|
|
125
|
+
messages: Array<{
|
|
126
|
+
id: string
|
|
127
|
+
type: string
|
|
128
|
+
text: string
|
|
129
|
+
}>
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Script input for the "List Cursor repositories" effect (`cursor.listRepositories`),
|
|
135
|
+
* derived from its Tool Core definition's call_function input projection.
|
|
136
|
+
*
|
|
137
|
+
* List accessible Cursor repositories
|
|
138
|
+
*/
|
|
139
|
+
export type ListRepositoriesScriptInput = Record<string, never>
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Canonical Tool Core output for the "List Cursor repositories" effect (`cursor.listRepositories`).
|
|
143
|
+
* This is the definition's output schema; the effect's script surface may
|
|
144
|
+
* re-encode it before returning.
|
|
145
|
+
*/
|
|
146
|
+
export type ListRepositoriesScriptOutput = {
|
|
147
|
+
repositories: Array<{
|
|
148
|
+
owner: string
|
|
149
|
+
name: string
|
|
150
|
+
repository: string
|
|
151
|
+
}>
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export class CursorConnectionClient {
|
|
155
|
+
constructor(private readonly invoke: ConnectionActionInvoker) {}
|
|
156
|
+
createAgent(args: CreateAgentScriptInput): Promise<CreateAgentScriptOutput> {
|
|
157
|
+
return this.invoke<CreateAgentScriptOutput>("createAgent", args)
|
|
158
|
+
}
|
|
159
|
+
getAgent(args: GetAgentScriptInput): Promise<GetAgentScriptOutput> {
|
|
160
|
+
return this.invoke<GetAgentScriptOutput>("getAgent", args)
|
|
161
|
+
}
|
|
162
|
+
listRepositories(
|
|
163
|
+
args: ListRepositoriesScriptInput,
|
|
164
|
+
): Promise<ListRepositoriesScriptOutput> {
|
|
165
|
+
return this.invoke<ListRepositoriesScriptOutput>("listRepositories", args)
|
|
166
|
+
}
|
|
167
|
+
}
|
package/src/custom-block.test.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
2
|
+
import { customBlock } from "./custom-block.js";
|
|
3
3
|
|
|
4
|
-
describe("
|
|
4
|
+
describe("customBlock", () => {
|
|
5
5
|
it("supports static assets without a build command", () => {
|
|
6
|
-
expect(
|
|
6
|
+
expect(customBlock({ path: "assets", static: true }).config.source).toEqual({
|
|
7
7
|
type: "static",
|
|
8
8
|
path: "assets",
|
|
9
9
|
});
|
|
@@ -11,7 +11,7 @@ describe("createCustomBlock", () => {
|
|
|
11
11
|
it.each(["//hello", "Hello", "-hello", "", "a".repeat(65)])(
|
|
12
12
|
"rejects invalid slash command %s",
|
|
13
13
|
(slashCommand) => {
|
|
14
|
-
expect(() =>
|
|
14
|
+
expect(() => customBlock({ path: "blocks/hello", slashCommand })).toThrow(
|
|
15
15
|
/slashCommand/,
|
|
16
16
|
);
|
|
17
17
|
},
|
package/src/custom-block.ts
CHANGED
|
@@ -10,9 +10,9 @@ export type CustomBlockOptions = {
|
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
/** Declare a browser project. Its filename under src/customBlocks supplies its key. */
|
|
13
|
-
export function
|
|
13
|
+
export function customBlock(options: CustomBlockOptions) {
|
|
14
14
|
if (typeof options.path !== "string" || options.path.trim() === "") {
|
|
15
|
-
throw new Error("
|
|
15
|
+
throw new Error("customBlock requires a non-empty path relative to the app root");
|
|
16
16
|
}
|
|
17
17
|
const slashCommand = options.slashCommand?.replace(/^\//, "");
|
|
18
18
|
if (slashCommand !== undefined && !/^[a-z0-9][a-z0-9_-]{0,63}$/.test(slashCommand)) {
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
// Generated by notion tool-core codegen-script-types --connections. Do not edit.
|
|
2
|
+
import type { ConnectionActionInvoker } from "./connection-actions.js"
|
|
3
|
+
/**
|
|
4
|
+
* Script input for the "Add Discord reaction" effect (`discord.addReaction`),
|
|
5
|
+
* derived from its Tool Core definition's call_function input projection.
|
|
6
|
+
*
|
|
7
|
+
* Add a reaction to a Discord message
|
|
8
|
+
*/
|
|
9
|
+
export type AddReactionScriptInput = {
|
|
10
|
+
/**
|
|
11
|
+
* The Discord channel ID containing the message.
|
|
12
|
+
*/
|
|
13
|
+
channelId: string
|
|
14
|
+
/**
|
|
15
|
+
* The Discord message ID to react to.
|
|
16
|
+
*/
|
|
17
|
+
messageId: string
|
|
18
|
+
/**
|
|
19
|
+
* The emoji to react with. Use Unicode emoji (e.g. "👍") or custom emoji in the format "name:id" (e.g. "notionlogo:123456789").
|
|
20
|
+
*/
|
|
21
|
+
emoji: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Canonical Tool Core output for the "Add Discord reaction" effect (`discord.addReaction`).
|
|
26
|
+
* This is the definition's output schema; the effect's script surface may
|
|
27
|
+
* re-encode it before returning.
|
|
28
|
+
*/
|
|
29
|
+
export type AddReactionScriptOutput = Record<string, never>
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Script input for the "Get recent Discord channel messages" effect (`discord.getRecentChannelMessages`),
|
|
33
|
+
* derived from its Tool Core definition's call_function input projection.
|
|
34
|
+
*
|
|
35
|
+
* Get recent messages from a Discord channel
|
|
36
|
+
*/
|
|
37
|
+
export type GetRecentChannelMessagesScriptInput = {
|
|
38
|
+
/**
|
|
39
|
+
* The Discord channel ID to read messages from.
|
|
40
|
+
*/
|
|
41
|
+
channelId: string
|
|
42
|
+
/**
|
|
43
|
+
* Number of messages to retrieve (1-50, default 25).
|
|
44
|
+
*/
|
|
45
|
+
limit?: number
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Canonical Tool Core output for the "Get recent Discord channel messages" effect (`discord.getRecentChannelMessages`).
|
|
50
|
+
* This is the definition's output schema; the effect's script surface may
|
|
51
|
+
* re-encode it before returning.
|
|
52
|
+
*/
|
|
53
|
+
export type GetRecentChannelMessagesScriptOutput = Array<{
|
|
54
|
+
/**
|
|
55
|
+
* The Discord message ID (snowflake).
|
|
56
|
+
*/
|
|
57
|
+
id: string
|
|
58
|
+
/**
|
|
59
|
+
* The Discord channel ID containing the message.
|
|
60
|
+
*/
|
|
61
|
+
channelId: string
|
|
62
|
+
/**
|
|
63
|
+
* The Discord guild (server) ID.
|
|
64
|
+
*/
|
|
65
|
+
guildId: string
|
|
66
|
+
/**
|
|
67
|
+
* The Discord markdown message content.
|
|
68
|
+
*/
|
|
69
|
+
content: string
|
|
70
|
+
/**
|
|
71
|
+
* Whether the message was sent by the bot.
|
|
72
|
+
*/
|
|
73
|
+
fromBot: boolean
|
|
74
|
+
/**
|
|
75
|
+
* The message timestamp in ISO 8601 format.
|
|
76
|
+
*/
|
|
77
|
+
timestamp: string
|
|
78
|
+
/**
|
|
79
|
+
* A user-navigable URL to the message.
|
|
80
|
+
*/
|
|
81
|
+
url: string
|
|
82
|
+
/**
|
|
83
|
+
* The channel name, when available.
|
|
84
|
+
*/
|
|
85
|
+
channelName?: string
|
|
86
|
+
}>
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Script input for the "List Discord channels" effect (`discord.listChannels`),
|
|
90
|
+
* derived from its Tool Core definition's call_function input projection.
|
|
91
|
+
*
|
|
92
|
+
* List text channels in the Discord server
|
|
93
|
+
*/
|
|
94
|
+
export type ListChannelsScriptInput = Record<string, never>
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Canonical Tool Core output for the "List Discord channels" effect (`discord.listChannels`).
|
|
98
|
+
* This is the definition's output schema; the effect's script surface may
|
|
99
|
+
* re-encode it before returning.
|
|
100
|
+
*/
|
|
101
|
+
export type ListChannelsScriptOutput = Array<{
|
|
102
|
+
/**
|
|
103
|
+
* The Discord channel ID (snowflake).
|
|
104
|
+
*/
|
|
105
|
+
id: string
|
|
106
|
+
/**
|
|
107
|
+
* The channel name.
|
|
108
|
+
*/
|
|
109
|
+
name: string
|
|
110
|
+
/**
|
|
111
|
+
* The channel type: "text", "announcement", "forum", or "media".
|
|
112
|
+
*/
|
|
113
|
+
type: string
|
|
114
|
+
}>
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Script input for the "Remove Discord reaction" effect (`discord.removeReaction`),
|
|
118
|
+
* derived from its Tool Core definition's call_function input projection.
|
|
119
|
+
*
|
|
120
|
+
* Remove a reaction from a Discord message
|
|
121
|
+
*/
|
|
122
|
+
export type RemoveReactionScriptInput = {
|
|
123
|
+
/**
|
|
124
|
+
* The Discord channel ID containing the message.
|
|
125
|
+
*/
|
|
126
|
+
channelId: string
|
|
127
|
+
/**
|
|
128
|
+
* The Discord message ID to remove the reaction from.
|
|
129
|
+
*/
|
|
130
|
+
messageId: string
|
|
131
|
+
/**
|
|
132
|
+
* The emoji to remove. Use Unicode emoji (e.g. "👍") or custom emoji in the format "name:id" (e.g. "notionlogo:123456789").
|
|
133
|
+
*/
|
|
134
|
+
emoji: string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Canonical Tool Core output for the "Remove Discord reaction" effect (`discord.removeReaction`).
|
|
139
|
+
* This is the definition's output schema; the effect's script surface may
|
|
140
|
+
* re-encode it before returning.
|
|
141
|
+
*/
|
|
142
|
+
export type RemoveReactionScriptOutput = Record<string, never>
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Script input for the "Send Discord channel message" effect (`discord.sendMessageToChannel`),
|
|
146
|
+
* derived from its Tool Core definition's call_function input projection.
|
|
147
|
+
*
|
|
148
|
+
* Send a new message to a Discord channel
|
|
149
|
+
*/
|
|
150
|
+
export type SendMessageToChannelScriptInput = {
|
|
151
|
+
/**
|
|
152
|
+
* The Discord channel ID (snowflake) to send the message to.
|
|
153
|
+
*/
|
|
154
|
+
channelId: string
|
|
155
|
+
/**
|
|
156
|
+
* ## Follow these guidelines when sending Discord messages:
|
|
157
|
+
* **Response Length:**
|
|
158
|
+
* - Keep responses to 1-2 short sentences maximum
|
|
159
|
+
* - No long paragraphs or blocks of text
|
|
160
|
+
* - Break longer content into bullets or line breaks
|
|
161
|
+
* - Every response must be instantly scannable
|
|
162
|
+
*
|
|
163
|
+
* **Tone:**
|
|
164
|
+
* - Write like a friendly human co-worker
|
|
165
|
+
* - Be concise and direct
|
|
166
|
+
*
|
|
167
|
+
* **Formatting:**
|
|
168
|
+
* - Use standard Discord markdown
|
|
169
|
+
* - Use bullets for lists
|
|
170
|
+
* - Use **bold** for emphasis
|
|
171
|
+
* - Use line breaks for clarity
|
|
172
|
+
* - Emojis allowed sparingly for clarity or tone
|
|
173
|
+
*
|
|
174
|
+
* **Links:**
|
|
175
|
+
* - Always use markdown link syntax: [link text](url)
|
|
176
|
+
* - Never use raw URLs
|
|
177
|
+
*/
|
|
178
|
+
content: string
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Canonical Tool Core output for the "Send Discord channel message" effect (`discord.sendMessageToChannel`).
|
|
183
|
+
* This is the definition's output schema; the effect's script surface may
|
|
184
|
+
* re-encode it before returning.
|
|
185
|
+
*/
|
|
186
|
+
export type SendMessageToChannelScriptOutput = {
|
|
187
|
+
/**
|
|
188
|
+
* The Discord message ID (snowflake).
|
|
189
|
+
*/
|
|
190
|
+
id: string
|
|
191
|
+
/**
|
|
192
|
+
* The Discord channel ID containing the message.
|
|
193
|
+
*/
|
|
194
|
+
channelId: string
|
|
195
|
+
/**
|
|
196
|
+
* The Discord guild (server) ID.
|
|
197
|
+
*/
|
|
198
|
+
guildId: string
|
|
199
|
+
/**
|
|
200
|
+
* The Discord markdown message content.
|
|
201
|
+
*/
|
|
202
|
+
content: string
|
|
203
|
+
/**
|
|
204
|
+
* Whether the message was sent by the bot.
|
|
205
|
+
*/
|
|
206
|
+
fromBot: boolean
|
|
207
|
+
/**
|
|
208
|
+
* The message timestamp in ISO 8601 format.
|
|
209
|
+
*/
|
|
210
|
+
timestamp: string
|
|
211
|
+
/**
|
|
212
|
+
* A user-navigable URL to the message.
|
|
213
|
+
*/
|
|
214
|
+
url: string
|
|
215
|
+
/**
|
|
216
|
+
* The channel name, when available.
|
|
217
|
+
*/
|
|
218
|
+
channelName?: string
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Script input for the "Update Discord message" effect (`discord.updateMessage`),
|
|
223
|
+
* derived from its Tool Core definition's call_function input projection.
|
|
224
|
+
*
|
|
225
|
+
* Update an existing Discord message
|
|
226
|
+
*/
|
|
227
|
+
export type UpdateMessageScriptInput = {
|
|
228
|
+
/**
|
|
229
|
+
* The Discord channel ID containing the message.
|
|
230
|
+
*/
|
|
231
|
+
channelId: string
|
|
232
|
+
/**
|
|
233
|
+
* The Discord message ID to update.
|
|
234
|
+
*/
|
|
235
|
+
messageId: string
|
|
236
|
+
/**
|
|
237
|
+
* The new content for the message (Discord markdown).
|
|
238
|
+
*/
|
|
239
|
+
content: string
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Canonical Tool Core output for the "Update Discord message" effect (`discord.updateMessage`).
|
|
244
|
+
* This is the definition's output schema; the effect's script surface may
|
|
245
|
+
* re-encode it before returning.
|
|
246
|
+
*/
|
|
247
|
+
export type UpdateMessageScriptOutput = {
|
|
248
|
+
/**
|
|
249
|
+
* The Discord message ID (snowflake).
|
|
250
|
+
*/
|
|
251
|
+
id: string
|
|
252
|
+
/**
|
|
253
|
+
* The Discord channel ID containing the message.
|
|
254
|
+
*/
|
|
255
|
+
channelId: string
|
|
256
|
+
/**
|
|
257
|
+
* The Discord guild (server) ID.
|
|
258
|
+
*/
|
|
259
|
+
guildId: string
|
|
260
|
+
/**
|
|
261
|
+
* The Discord markdown message content.
|
|
262
|
+
*/
|
|
263
|
+
content: string
|
|
264
|
+
/**
|
|
265
|
+
* Whether the message was sent by the bot.
|
|
266
|
+
*/
|
|
267
|
+
fromBot: boolean
|
|
268
|
+
/**
|
|
269
|
+
* The message timestamp in ISO 8601 format.
|
|
270
|
+
*/
|
|
271
|
+
timestamp: string
|
|
272
|
+
/**
|
|
273
|
+
* A user-navigable URL to the message.
|
|
274
|
+
*/
|
|
275
|
+
url: string
|
|
276
|
+
/**
|
|
277
|
+
* The channel name, when available.
|
|
278
|
+
*/
|
|
279
|
+
channelName?: string
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export class DiscordConnectionClient {
|
|
283
|
+
constructor(private readonly invoke: ConnectionActionInvoker) {}
|
|
284
|
+
addReaction(args: AddReactionScriptInput): Promise<AddReactionScriptOutput> {
|
|
285
|
+
return this.invoke<AddReactionScriptOutput>("addReaction", args)
|
|
286
|
+
}
|
|
287
|
+
getRecentChannelMessages(
|
|
288
|
+
args: GetRecentChannelMessagesScriptInput,
|
|
289
|
+
): Promise<GetRecentChannelMessagesScriptOutput> {
|
|
290
|
+
return this.invoke<GetRecentChannelMessagesScriptOutput>(
|
|
291
|
+
"getRecentChannelMessages",
|
|
292
|
+
args,
|
|
293
|
+
)
|
|
294
|
+
}
|
|
295
|
+
listChannels(
|
|
296
|
+
args: ListChannelsScriptInput,
|
|
297
|
+
): Promise<ListChannelsScriptOutput> {
|
|
298
|
+
return this.invoke<ListChannelsScriptOutput>("listChannels", args)
|
|
299
|
+
}
|
|
300
|
+
removeReaction(
|
|
301
|
+
args: RemoveReactionScriptInput,
|
|
302
|
+
): Promise<RemoveReactionScriptOutput> {
|
|
303
|
+
return this.invoke<RemoveReactionScriptOutput>("removeReaction", args)
|
|
304
|
+
}
|
|
305
|
+
sendMessageToChannel(
|
|
306
|
+
args: SendMessageToChannelScriptInput,
|
|
307
|
+
): Promise<SendMessageToChannelScriptOutput> {
|
|
308
|
+
return this.invoke<SendMessageToChannelScriptOutput>(
|
|
309
|
+
"sendMessageToChannel",
|
|
310
|
+
args,
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
updateMessage(
|
|
314
|
+
args: UpdateMessageScriptInput,
|
|
315
|
+
): Promise<UpdateMessageScriptOutput> {
|
|
316
|
+
return this.invoke<UpdateMessageScriptOutput>("updateMessage", args)
|
|
317
|
+
}
|
|
318
|
+
}
|