@meetopenbot/slack 1.6.1 → 1.6.2
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/index.js +0 -11
- package/dist/invoke.js +10 -0
- package/dist/needs-input.js +3 -1
- package/dist/webhook.js +0 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { definePlugin } from "@meetopenbot/plugin-sdk";
|
|
2
2
|
import { pluginConfigSchema, readSlackConfig, SLACK_BOT_SCOPES, slackCredentials, } from "./config.js";
|
|
3
3
|
import { handleSlackInvoke } from "./invoke.js";
|
|
4
|
-
import { addSlackReaction } from "./reactions.js";
|
|
5
4
|
import { handleSlackWebhook } from "./webhook.js";
|
|
6
5
|
export const plugin = definePlugin({
|
|
7
6
|
name: "Slack",
|
|
@@ -33,16 +32,6 @@ export const plugin = definePlugin({
|
|
|
33
32
|
return !!state && typeof state === "object" && Object.keys(state).length > 0;
|
|
34
33
|
},
|
|
35
34
|
storage: context.storage,
|
|
36
|
-
acknowledge: (message) => {
|
|
37
|
-
const credentials = slackCredentials(context);
|
|
38
|
-
if (!credentials)
|
|
39
|
-
return;
|
|
40
|
-
void addSlackReaction({
|
|
41
|
-
token: credentials.botToken,
|
|
42
|
-
channel: message.channel,
|
|
43
|
-
timestamp: message.ts,
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
35
|
});
|
|
47
36
|
},
|
|
48
37
|
async *run({ event, handlerCtx, context }) {
|
package/dist/invoke.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolveSlackSpace, updateSlackPluginConfig } from "./bindings.js";
|
|
|
5
5
|
import { resolveSlackModel, ROUTING_AGENT_ID, SLACK_USER_DISPLAY_NAME, } from "./config.js";
|
|
6
6
|
import { buildPromptWithSlackContext } from "./context.js";
|
|
7
7
|
import { fetchSlackUserFlags, postSlackMessage } from "./post.js";
|
|
8
|
+
import { addSlackReaction } from "./reactions.js";
|
|
8
9
|
import { ambiguousSpaceMessage, boundMessage, canRouteSlackChannel, findSpace, missingSpaceMessage, parseUseSpaceCommand, ROUTING_FORBIDDEN, ROUTING_HINT, ROUTING_UNNAMED_CHANNEL, withChannelBinding, withHintedChannel, } from "./routing.js";
|
|
9
10
|
import { slackNeedsInputNotice, SLACK_THREAD_STATE_KEY, } from "./needs-input.js";
|
|
10
11
|
import { getSlackThreadMeta, isSlackWebhookIngress } from "./webhook.js";
|
|
@@ -184,6 +185,15 @@ export async function* handleSlackInvoke(args) {
|
|
|
184
185
|
}
|
|
185
186
|
const slackMeta = getSlackThreadMeta(args.event.meta);
|
|
186
187
|
const slackChannelId = slackMeta?.channel;
|
|
188
|
+
// Show the person the bot has seen the message. The webhook handler has no Slack token
|
|
189
|
+
// (only a run is connected), so this is the earliest the reaction can be added.
|
|
190
|
+
if (slackChannelId && slackMeta?.ts) {
|
|
191
|
+
void addSlackReaction({
|
|
192
|
+
token: credentials.botToken,
|
|
193
|
+
channel: slackChannelId,
|
|
194
|
+
timestamp: slackMeta.ts,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
187
197
|
const postToSlack = async (text) => {
|
|
188
198
|
if (!slackChannelId || !text.trim())
|
|
189
199
|
return;
|
package/dist/needs-input.js
CHANGED
|
@@ -17,7 +17,9 @@ export function slackNeedsInputNotice(event) {
|
|
|
17
17
|
return undefined;
|
|
18
18
|
const hasInput = (Array.isArray(widget.actions) && widget.actions.length > 0) ||
|
|
19
19
|
("fields" in widget && Array.isArray(widget.fields) && widget.fields.length > 0);
|
|
20
|
-
|
|
20
|
+
// A connect card has a button in the app but carries no actions of its own.
|
|
21
|
+
const isConnect = widget.metadata?.type === "connection_request";
|
|
22
|
+
if (!hasInput && !isConnect)
|
|
21
23
|
return undefined;
|
|
22
24
|
const title = widget.title?.trim();
|
|
23
25
|
return `I need your input to continue${title ? `: ${title}` : ""}. Open this conversation in OpenBot to answer, and I'll carry on from there.`;
|
package/dist/webhook.js
CHANGED
|
@@ -95,9 +95,6 @@ export async function* handleSlackWebhook(args) {
|
|
|
95
95
|
yield webhookHttpResponse({ status: 200, body: {} });
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
-
if (slackEvent.channel && slackEvent.ts) {
|
|
99
|
-
args.acknowledge?.({ channel: slackEvent.channel, ts: slackEvent.ts });
|
|
100
|
-
}
|
|
101
98
|
args.ctx.state.threadId = threadId;
|
|
102
99
|
const slackMeta = {
|
|
103
100
|
teamId: payload.team_id,
|