@meetopenbot/slack 1.0.4 → 1.1.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/README.md +3 -3
- package/dist/agent.js +1 -1
- package/dist/config.js +4 -4
- package/dist/invoke.js +14 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Slack specialist agent for OpenBot: Events API ingress, simple LLM replies, and
|
|
|
5
5
|
## Features (MVP)
|
|
6
6
|
|
|
7
7
|
- **Ingress** — verify Slack webhooks, dedupe events, prefetch thread/channel context, turn messages into `agent:invoke`
|
|
8
|
-
- **Agent** — OpenAI + Slack MCP tools (`post_message`, `list_channels`, etc.)
|
|
8
|
+
- **Agent** — Claude Haiku 5.5 (or an OpenAI model) + Slack MCP tools (`post_message`, `list_channels`, etc.)
|
|
9
9
|
- **Egress** — post inbound-thread replies via `chat.postMessage`
|
|
10
10
|
|
|
11
11
|
## Setup
|
|
@@ -26,11 +26,11 @@ plugins:
|
|
|
26
26
|
botToken: xoxb-your-bot-token
|
|
27
27
|
teamId: T01234567
|
|
28
28
|
authMode: credits
|
|
29
|
-
model:
|
|
29
|
+
model: anthropic/claude-haiku-5-5
|
|
30
30
|
channelMappings: "C01234567:engineering,C89ABCDEF:support"
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
On cloud, `authMode: credits` uses your workspace credit balance. For BYOK (bring your own key), set `authMode: byok` and add `OPENAI_API_KEY` under workspace settings — no API key field in plugin config.
|
|
33
|
+
On cloud, `authMode: credits` uses your workspace credit balance. For BYOK (bring your own key), set `authMode: byok` and add `ANTHROPIC_API_KEY` (or `OPENAI_API_KEY` for OpenAI models) under workspace settings — no API key field in plugin config.
|
|
34
34
|
|
|
35
35
|
### Channel routing (webhook ingress)
|
|
36
36
|
|
package/dist/agent.js
CHANGED
package/dist/config.js
CHANGED
|
@@ -3,16 +3,16 @@ export const DEFAULT_OPENBOT_CHANNEL_ID = "general";
|
|
|
3
3
|
export const ROUTING_AGENT_ID = "system";
|
|
4
4
|
export const SLACK_USER_DISPLAY_NAME = "Slack user";
|
|
5
5
|
const modelField = await modelConfigField({
|
|
6
|
-
providers: ["openai"],
|
|
6
|
+
providers: ["anthropic", "openai"],
|
|
7
7
|
override: true,
|
|
8
|
-
defaultValue: "
|
|
8
|
+
defaultValue: "anthropic/claude-haiku-5-5",
|
|
9
9
|
});
|
|
10
10
|
export const pluginConfigSchema = {
|
|
11
11
|
type: "object",
|
|
12
12
|
properties: {
|
|
13
13
|
model: {
|
|
14
14
|
...modelField,
|
|
15
|
-
description: "Outbound —
|
|
15
|
+
description: "Outbound — model for direct Slack agent invocations",
|
|
16
16
|
},
|
|
17
17
|
channelMappings: {
|
|
18
18
|
type: "string",
|
|
@@ -69,7 +69,7 @@ export function resolveSlackCredentials(config) {
|
|
|
69
69
|
const signingSecret = lookupSecret({ envKeys: ["SLACK_SIGNING_SECRET"] }) ?? "";
|
|
70
70
|
const botToken = lookupSecret({ envKeys: ["SLACK_BOT_TOKEN"] });
|
|
71
71
|
const teamId = lookupSecret({ envKeys: ["SLACK_TEAM_ID"] });
|
|
72
|
-
const model = trimmedString(config.model) ?? "
|
|
72
|
+
const model = trimmedString(config.model) ?? "anthropic/claude-haiku-5-5";
|
|
73
73
|
const missing = [];
|
|
74
74
|
if (!botToken)
|
|
75
75
|
missing.push("botToken");
|
package/dist/invoke.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { agentOutput, creditsErrorMessage, hasLlmAuth, llmAuthNotConfiguredMessage, shouldHandleInvoke, toAgentTurnEvents, } from "@meetopenbot/plugin-sdk";
|
|
2
|
+
import { agentModelKeyEnv, agentModelProvider, 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";
|
|
@@ -187,16 +187,19 @@ export async function* handleSlackInvoke(args) {
|
|
|
187
187
|
});
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
|
-
|
|
191
|
-
yield agentOutput({
|
|
192
|
-
agentId: args.agentId,
|
|
193
|
-
content: llmAuthNotConfiguredMessage(),
|
|
194
|
-
threadId,
|
|
195
|
-
meta: args.event.meta,
|
|
196
|
-
});
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
190
|
+
let provider;
|
|
199
191
|
try {
|
|
192
|
+
const modelProvider = agentModelProvider(auth.credentials.model);
|
|
193
|
+
provider = modelProvider;
|
|
194
|
+
if (!hasLlmAuth(modelProvider)) {
|
|
195
|
+
yield agentOutput({
|
|
196
|
+
agentId: args.agentId,
|
|
197
|
+
content: llmAuthNotConfiguredMessage(agentModelKeyEnv(modelProvider)),
|
|
198
|
+
threadId,
|
|
199
|
+
meta: args.event.meta,
|
|
200
|
+
});
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
200
203
|
for await (const item of runSlackAgent({
|
|
201
204
|
prompt: userMessage,
|
|
202
205
|
botToken: auth.credentials.botToken,
|
|
@@ -210,7 +213,7 @@ export async function* handleSlackInvoke(args) {
|
|
|
210
213
|
const message = error instanceof Error ? error.message : String(error);
|
|
211
214
|
yield agentOutput({
|
|
212
215
|
agentId: args.agentId,
|
|
213
|
-
content: creditsErrorMessage(message, { agentName: "Slack" }) ??
|
|
216
|
+
content: creditsErrorMessage(message, { agentName: "Slack", provider }) ??
|
|
214
217
|
`Slack agent error: ${message}`,
|
|
215
218
|
threadId,
|
|
216
219
|
meta: args.event.meta,
|