@meetopenbot/slack 0.0.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +3 -2
- package/dist/index.js +24 -20
- package/dist/invoke.js +5 -9
- package/package.json +2 -2
package/dist/agent.js
CHANGED
|
@@ -2,8 +2,8 @@ import { runMcpTurn } from "@meetopenbot/plugin-sdk";
|
|
|
2
2
|
const SYSTEM_PROMPT = `You are the OpenBot Slack specialist agent.
|
|
3
3
|
Use Slack MCP tools to post messages, list channels, read history, and perform other workspace actions when needed.
|
|
4
4
|
Summarize results clearly in plain text for the user. Be concise and friendly.`;
|
|
5
|
-
export async function runSlackAgent(args) {
|
|
6
|
-
|
|
5
|
+
export async function* runSlackAgent(args) {
|
|
6
|
+
yield* runMcpTurn({
|
|
7
7
|
mcp: {
|
|
8
8
|
command: "npx",
|
|
9
9
|
args: ["-y", "@modelcontextprotocol/server-slack"],
|
|
@@ -17,5 +17,6 @@ export async function runSlackAgent(args) {
|
|
|
17
17
|
system: SYSTEM_PROMPT,
|
|
18
18
|
prompt: args.prompt,
|
|
19
19
|
maxSteps: 10,
|
|
20
|
+
groupId: "Slack:tools",
|
|
20
21
|
});
|
|
21
22
|
}
|
package/dist/index.js
CHANGED
|
@@ -6,28 +6,32 @@ export const plugin = definePlugin({
|
|
|
6
6
|
name: "Slack",
|
|
7
7
|
description: "Slack Events API ingress, local agent runtime, and system delegation for webhooks",
|
|
8
8
|
configSchema: pluginConfigSchema,
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ctx,
|
|
16
|
-
config: slackConfig,
|
|
17
|
-
});
|
|
9
|
+
async *onWebhook({ event, state, context }) {
|
|
10
|
+
const slackConfig = readSlackConfig(context.config);
|
|
11
|
+
yield* handleSlackWebhook({
|
|
12
|
+
event: event,
|
|
13
|
+
ctx: { state },
|
|
14
|
+
config: slackConfig,
|
|
18
15
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
},
|
|
17
|
+
async *run({ event, handlerCtx, context }) {
|
|
18
|
+
const slackConfig = readSlackConfig(context.config);
|
|
19
|
+
yield* handleSlackInvoke({
|
|
20
|
+
event,
|
|
21
|
+
ctx: handlerCtx,
|
|
22
|
+
agentId: context.agentId,
|
|
23
|
+
config: slackConfig,
|
|
24
|
+
host: context.host,
|
|
25
|
+
publicBaseUrl: context.publicBaseUrl,
|
|
28
26
|
});
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
},
|
|
28
|
+
async *onEvent(event, context) {
|
|
29
|
+
if (event.type !== "agent:output")
|
|
30
|
+
return;
|
|
31
|
+
const slackConfig = readSlackConfig(context.config);
|
|
32
|
+
yield* handleSlackOutbound({
|
|
33
|
+
event: event,
|
|
34
|
+
config: slackConfig,
|
|
31
35
|
});
|
|
32
36
|
},
|
|
33
37
|
});
|
package/dist/invoke.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { agentOutput, creditsErrorMessage, hasLlmAuth, llmAuthNotConfiguredMessage, shouldHandleInvoke, } from "@meetopenbot/plugin-sdk";
|
|
2
|
+
import { agentOutput, creditsErrorMessage, hasLlmAuth, llmAuthNotConfiguredMessage, shouldHandleInvoke, toAgentTurnEvents, } from "@meetopenbot/plugin-sdk";
|
|
3
3
|
import { runSlackAgent } from "./agent.js";
|
|
4
4
|
import { formatMissingCredentials, resolveOpenBotChannelId, resolveSlackCredentials, ROUTING_AGENT_ID, SLACK_USER_DISPLAY_NAME, } from "./config.js";
|
|
5
5
|
import { buildPromptWithSlackContext } from "./context.js";
|
|
@@ -197,18 +197,14 @@ export async function* handleSlackInvoke(args) {
|
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
try {
|
|
200
|
-
const
|
|
200
|
+
for await (const item of runSlackAgent({
|
|
201
201
|
prompt: userMessage,
|
|
202
202
|
botToken: auth.credentials.botToken,
|
|
203
203
|
teamId: auth.credentials.teamId,
|
|
204
204
|
model: auth.credentials.model,
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
content: reply,
|
|
209
|
-
threadId,
|
|
210
|
-
meta: args.event.meta,
|
|
211
|
-
});
|
|
205
|
+
})) {
|
|
206
|
+
yield* toAgentTurnEvents(item, args.agentId, threadId, args.event.meta);
|
|
207
|
+
}
|
|
212
208
|
}
|
|
213
209
|
catch (error) {
|
|
214
210
|
const message = error instanceof Error ? error.message : String(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meetopenbot/slack",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Slack Events API ingress, simple agent replies, and thread delivery for OpenBot",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@meetopenbot/plugin-sdk": "^0.
|
|
22
|
+
"@meetopenbot/plugin-sdk": "^1.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^20.10.1",
|