@mastra/slack 1.4.0-alpha.0 → 1.5.0-alpha.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/CHANGELOG.md +61 -0
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
1
|
# @mastra/slack
|
|
2
2
|
|
|
3
|
+
## 1.5.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added `waitUntil` support for channels so background agent runs survive serverless responses. ([#17832](https://github.com/mastra-ai/mastra/pull/17832))
|
|
8
|
+
|
|
9
|
+
Without `waitUntil`, the runtime freezes the invocation as soon as the webhook response returns, killing the agent run mid-flight and leaving the user with no reply.
|
|
10
|
+
|
|
11
|
+
**Auto-detected (no config needed):**
|
|
12
|
+
- **Cloudflare Workers** — reads `c.executionCtx.waitUntil`
|
|
13
|
+
- **Netlify Functions** — reads `c.env.context.waitUntil`
|
|
14
|
+
|
|
15
|
+
**Requires explicit config:**
|
|
16
|
+
|
|
17
|
+
Vercel needs a `waitUntil` function passed directly because it exposes `waitUntil` via AsyncLocalStorage, not the request context. AWS Lambda doesn't need `waitUntil` — it waits for the event loop to drain naturally.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { waitUntil } from '@vercel/functions';
|
|
21
|
+
import { SlackProvider } from '@mastra/slack';
|
|
22
|
+
|
|
23
|
+
new SlackProvider({ waitUntil });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
new Agent({
|
|
28
|
+
channels: {
|
|
29
|
+
adapters: { slack: createSlackAdapter({ ... }) },
|
|
30
|
+
waitUntil,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
For runtimes where `waitUntil` lives on the request context but isn't covered by the default, pass `resolveWaitUntil: (c) => fn | undefined` instead.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
new Agent({
|
|
39
|
+
channels: {
|
|
40
|
+
adapters: { slack: createSlackAdapter({ ... }) },
|
|
41
|
+
resolveWaitUntil: c => c.var.runtime?.waitUntil,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Resolution order: `waitUntil` → `resolveWaitUntil(c)` → core default.
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [[`86623c1`](https://github.com/mastra-ai/mastra/commit/86623c1adf7d22de32cc916dda17f4155184db36), [`7c9dd77`](https://github.com/mastra-ai/mastra/commit/7c9dd77bd18cb8dc72797e25f1a0fbdc71a11347), [`9990965`](https://github.com/mastra-ai/mastra/commit/999096571635a83b42ef40841fd7028cfa630779), [`c0ffa3c`](https://github.com/mastra-ai/mastra/commit/c0ffa3c897ccd326de880df734740a7f0681a18f), [`0504bf5`](https://github.com/mastra-ai/mastra/commit/0504bf5e8cffc571a4b343326178de371e6f859b), [`5afe423`](https://github.com/mastra-ai/mastra/commit/5afe423e4badf040f1b0d4525183a856fcb8146e), [`86623c1`](https://github.com/mastra-ai/mastra/commit/86623c1adf7d22de32cc916dda17f4155184db36), [`8c9f1c0`](https://github.com/mastra-ai/mastra/commit/8c9f1c0361d89066f9bcd14a2f69e761b01766c8)]:
|
|
51
|
+
- @mastra/core@1.47.0-alpha.2
|
|
52
|
+
|
|
53
|
+
## 1.4.0
|
|
54
|
+
|
|
55
|
+
### Minor Changes
|
|
56
|
+
|
|
57
|
+
- Random bump ([#18178](https://github.com/mastra-ai/mastra/pull/18178))
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [[`7c0d868`](https://github.com/mastra-ai/mastra/commit/7c0d868d97d0fdbc04c14d0166dbf44d4c5a4a62), [`d9d2273`](https://github.com/mastra-ai/mastra/commit/d9d2273c702690c9a26eab2aebea879701d4355a), [`b04369d`](https://github.com/mastra-ai/mastra/commit/b04369d6b167c698ef103981171a8bf92808e756), [`8f3c262`](https://github.com/mastra-ai/mastra/commit/8f3c262587b335588a02d96b17fd6aca34c885b3)]:
|
|
62
|
+
- @mastra/core@1.45.0
|
|
63
|
+
|
|
3
64
|
## 1.4.0-alpha.0
|
|
4
65
|
|
|
5
66
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -15563,7 +15563,6 @@ var SlackProvider = class {
|
|
|
15563
15563
|
const slackEntry = Object.keys(adapterConfig).length > 0 ? { adapter, ...adapterConfig } : adapter;
|
|
15564
15564
|
const existing = agent.getChannels();
|
|
15565
15565
|
const existingConfig = existing?.channelConfig;
|
|
15566
|
-
existing?.close();
|
|
15567
15566
|
const agentChannels = new import_channels.AgentChannels({
|
|
15568
15567
|
...existingConfig,
|
|
15569
15568
|
...this.#forwardedChannelOptions(),
|
|
@@ -16051,8 +16050,13 @@ var SlackProvider = class {
|
|
|
16051
16050
|
headers: c.req.raw.headers,
|
|
16052
16051
|
body: rawBody
|
|
16053
16052
|
});
|
|
16053
|
+
const waitUntilFn = this.#channelConfig.waitUntil ?? this.#channelConfig.resolveWaitUntil?.(c) ?? (0, import_channels.resolveWaitUntil)(c);
|
|
16054
16054
|
try {
|
|
16055
|
-
return await agentChannels.handleWebhookEvent(
|
|
16055
|
+
return await agentChannels.handleWebhookEvent(
|
|
16056
|
+
"slack",
|
|
16057
|
+
delegateRequest,
|
|
16058
|
+
waitUntilFn ? { waitUntil: waitUntilFn } : void 0
|
|
16059
|
+
);
|
|
16056
16060
|
} catch (error51) {
|
|
16057
16061
|
console.error("[Slack] Error delegating to AgentChannels:", error51);
|
|
16058
16062
|
return c.json({ ok: true });
|
|
@@ -16106,7 +16110,7 @@ var SlackProvider = class {
|
|
|
16106
16110
|
signal: AbortSignal.timeout(3e4)
|
|
16107
16111
|
});
|
|
16108
16112
|
};
|
|
16109
|
-
(async () => {
|
|
16113
|
+
const task = (async () => {
|
|
16110
16114
|
try {
|
|
16111
16115
|
const result = await agent.generate(prompt);
|
|
16112
16116
|
const text = typeof result.text === "string" ? result.text : JSON.stringify(result.text);
|
|
@@ -16117,6 +16121,8 @@ var SlackProvider = class {
|
|
|
16117
16121
|
await sendDelayedResponse(`Error: ${message}`);
|
|
16118
16122
|
}
|
|
16119
16123
|
})();
|
|
16124
|
+
const slashWaitUntil = this.#channelConfig.waitUntil ?? this.#channelConfig.resolveWaitUntil?.(c) ?? (0, import_channels.resolveWaitUntil)(c);
|
|
16125
|
+
slashWaitUntil?.(task);
|
|
16120
16126
|
return c.json({ response_type: "ephemeral", text: "Processing..." });
|
|
16121
16127
|
}
|
|
16122
16128
|
// ===========================================================================
|