@meetopenbot/slack 0.0.10 → 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.
Files changed (2) hide show
  1. package/dist/index.js +24 -20
  2. package/package.json +2 -2
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
- factory: (pluginContext) => (builder) => {
10
- const { agentId, config, host, publicBaseUrl } = pluginContext;
11
- const slackConfig = readSlackConfig(config);
12
- builder.on("action:webhook", async function* (event, ctx) {
13
- yield* handleSlackWebhook({
14
- event: event,
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
- builder.on("agent:invoke", async function* (event, ctx) {
20
- yield* handleSlackInvoke({
21
- event,
22
- ctx,
23
- agentId,
24
- config: slackConfig,
25
- host,
26
- publicBaseUrl: publicBaseUrl ?? "",
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
- builder.on("agent:output", async function* (event) {
30
- yield* handleSlackOutbound({ event, config: slackConfig });
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetopenbot/slack",
3
- "version": "0.0.10",
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.5.0"
22
+ "@meetopenbot/plugin-sdk": "^1.0.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^20.10.1",