eve 0.79.1 → 0.80.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 (171) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/src/channel/pending-authorization.d.ts +10 -0
  3. package/dist/src/channel/pending-authorization.js +1 -0
  4. package/dist/src/compiled/.vendor-stamp.json +7 -7
  5. package/dist/src/compiled/@chat-adapter/slack/api.d.ts +6 -0
  6. package/dist/src/compiled/@chat-adapter/slack/api.js +1 -1
  7. package/dist/src/compiled/@chat-adapter/slack/blocks.js +1 -1
  8. package/dist/src/compiled/@chat-adapter/slack/format.js +1 -1
  9. package/dist/src/compiled/@chat-adapter/slack/index.d.ts +14 -8
  10. package/dist/src/compiled/@chat-adapter/slack/index.js +33 -32
  11. package/dist/src/compiled/@chat-adapter/twilio/index.d.ts +37 -1
  12. package/dist/src/compiled/@chat-adapter/twilio/index.js +2 -2
  13. package/dist/src/compiled/@eve/tracing/index.js +1 -1
  14. package/dist/src/compiled/@eve/tracing/otel.js +1 -1
  15. package/dist/src/compiled/@linqapp/chat-sdk-adapter/index.js +1 -1
  16. package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +1 -1
  17. package/dist/src/compiled/@vercel/connect/index.js +5 -5
  18. package/dist/src/compiled/@vercel/connect/token.d.ts +11 -1
  19. package/dist/src/compiled/_chunks/node/chunk-NBSLXVG3-Bt7pDfyn.js +12 -0
  20. package/dist/src/compiled/_chunks/node/dist-BKsV21Vu.js +6 -0
  21. package/dist/src/compiled/_chunks/node/dist-CO_n_hUa.js +98 -0
  22. package/dist/src/compiled/_chunks/workflow/{mcp-C01bDEX-.js → mcp-Bwx_LQ4q.js} +4 -4
  23. package/dist/src/compiled/chat/index.js +1 -1
  24. package/dist/src/compiler/extension-compatibility.d.ts +18 -18
  25. package/dist/src/compiler/extension-compatibility.js +1 -1
  26. package/dist/src/compiler/manifest.d.ts +8 -4
  27. package/dist/src/compiler/manifest.js +1 -1
  28. package/dist/src/compiler/normalize-connection.js +1 -1
  29. package/dist/src/compiler/normalize-manifest.js +1 -1
  30. package/dist/src/context/schedule-collection-tools.js +1 -1
  31. package/dist/src/execution/catalog/connection-auth.d.ts +4 -2
  32. package/dist/src/execution/catalog/connection-auth.js +1 -1
  33. package/dist/src/execution/catalog/connection-entry.js +1 -1
  34. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  35. package/dist/src/execution/proxied-deliver-step.js +1 -1
  36. package/dist/src/execution/publish-session-events.d.ts +13 -3
  37. package/dist/src/execution/publish-session-events.js +1 -1
  38. package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -1
  39. package/dist/src/execution/session/active-turn.d.ts +2 -1
  40. package/dist/src/execution/session/active-turn.js +1 -1
  41. package/dist/src/execution/session/entry.js +1 -1
  42. package/dist/src/execution/session/turn-step.js +1 -1
  43. package/dist/src/execution/session/turn.d.ts +1 -0
  44. package/dist/src/execution/session/turn.js +1 -1
  45. package/dist/src/execution/session-event-stream.js +1 -1
  46. package/dist/src/execution/stable-workflow-names.d.ts +2 -0
  47. package/dist/src/execution/stable-workflow-names.js +1 -1
  48. package/dist/src/execution/tasks/task-id-input.js +1 -1
  49. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  50. package/dist/src/execution/tools/workflow/apply-run-messages-step.d.ts +6 -2
  51. package/dist/src/execution/tools/workflow/apply-run-messages-step.js +1 -1
  52. package/dist/src/execution/tools/workflow/body.d.ts +10 -1
  53. package/dist/src/execution/tools/workflow/body.js +1 -1
  54. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  55. package/dist/src/execution/tools/workflow/serve.js +1 -1
  56. package/dist/src/execution/web-fetch/execute.js +1 -1
  57. package/dist/src/execution/workflow-runtime.d.ts +6 -0
  58. package/dist/src/execution/workflow-runtime.js +1 -1
  59. package/dist/src/extensions/git/extension/extension.d.ts +3 -1
  60. package/dist/src/extensions/git/extension/extension.js +1 -1
  61. package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
  62. package/dist/src/extensions/git/extension/lib/github-shell.d.ts +14 -0
  63. package/dist/src/extensions/git/extension/lib/github-shell.js +1 -1
  64. package/dist/src/harness/action-result-helpers.js +1 -1
  65. package/dist/src/harness/attachment-staging.js +1 -1
  66. package/dist/src/harness/compaction/engine.js +3 -1
  67. package/dist/src/harness/compaction/prompt.d.ts +7 -0
  68. package/dist/src/harness/compaction/prompt.js +1 -1
  69. package/dist/src/harness/hitl/approvals.js +1 -1
  70. package/dist/src/harness/hitl/approved-calls.js +1 -1
  71. package/dist/src/harness/input-request-resolution.d.ts +2 -1
  72. package/dist/src/harness/input-request-resolution.js +1 -1
  73. package/dist/src/harness/model-call/call.js +1 -1
  74. package/dist/src/harness/model-call/errors.d.ts +2 -2
  75. package/dist/src/harness/model-call/recovery.d.ts +2 -3
  76. package/dist/src/instrumentation/native-events.js +1 -1
  77. package/dist/src/instrumentation/session-init.d.ts +2 -1
  78. package/dist/src/instrumentation/session-init.js +1 -1
  79. package/dist/src/internal/application/optional-package-import.d.ts +5 -0
  80. package/dist/src/internal/application/optional-package-import.js +1 -1
  81. package/dist/src/internal/application/stamped-package-version.js +1 -1
  82. package/dist/src/internal/authored-definition/connection.js +1 -1
  83. package/dist/src/internal/authored-definition/schedule-collection.js +1 -1
  84. package/dist/src/internal/nitro/host/application-route-registry.d.ts +7 -2
  85. package/dist/src/internal/nitro/host/application-route-registry.js +1 -1
  86. package/dist/src/internal/nitro/host/configure-nitro-routes.js +1 -1
  87. package/dist/src/internal/nitro/host/start-production-server.js +2 -2
  88. package/dist/src/internal/nitro/routes/channel-request-instrumentation.d.ts +3 -1
  89. package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
  90. package/dist/src/internal/nitro/routes/connection-events.d.ts +5 -0
  91. package/dist/src/internal/nitro/routes/connection-events.js +1 -0
  92. package/dist/src/internal/workflow-bundle/builder.js +1 -1
  93. package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.js +1 -1
  94. package/dist/src/protocol/message.d.ts +2 -0
  95. package/dist/src/protocol/message.js +1 -1
  96. package/dist/src/public/channels/slack/blocks.js +2 -2
  97. package/dist/src/public/channels/teams/authorization.d.ts +53 -0
  98. package/dist/src/public/channels/teams/authorization.js +1 -0
  99. package/dist/src/public/channels/teams/defaults.js +2 -2
  100. package/dist/src/public/channels/teams/hitl.d.ts +2 -1
  101. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  102. package/dist/src/public/channels/telegram/authorization-callback.js +1 -1
  103. package/dist/src/public/connections/index.d.ts +1 -0
  104. package/dist/src/public/definitions/connections/events.d.ts +43 -0
  105. package/dist/src/public/definitions/connections/events.js +1 -0
  106. package/dist/src/public/definitions/connections/mcp.d.ts +3 -0
  107. package/dist/src/public/next/index.js +1 -1
  108. package/dist/src/public/next/server.d.ts +11 -2
  109. package/dist/src/public/next/server.js +1 -1
  110. package/dist/src/public/schedules/subscription.d.ts +4 -3
  111. package/dist/src/runtime/connections/events/actions.d.ts +17 -0
  112. package/dist/src/runtime/connections/events/actions.js +1 -0
  113. package/dist/src/runtime/connections/events/delivery.d.ts +10 -0
  114. package/dist/src/runtime/connections/events/delivery.js +1 -0
  115. package/dist/src/runtime/connections/events/dispatch-step.d.ts +20 -0
  116. package/dist/src/runtime/connections/events/dispatch-step.js +1 -0
  117. package/dist/src/runtime/connections/events/lifecycle-step.d.ts +42 -0
  118. package/dist/src/runtime/connections/events/lifecycle-step.js +1 -0
  119. package/dist/src/runtime/connections/events/owner.d.ts +38 -0
  120. package/dist/src/runtime/connections/events/owner.js +1 -0
  121. package/dist/src/runtime/connections/events/path.d.ts +4 -0
  122. package/dist/src/runtime/connections/events/path.js +1 -0
  123. package/dist/src/runtime/connections/events/state.d.ts +37 -0
  124. package/dist/src/runtime/connections/events/state.js +1 -0
  125. package/dist/src/runtime/connections/events/workflow.d.ts +28 -0
  126. package/dist/src/runtime/connections/events/workflow.js +1 -0
  127. package/dist/src/runtime/connections/mcp-client.d.ts +4 -2
  128. package/dist/src/runtime/connections/mcp-client.js +1 -1
  129. package/dist/src/runtime/connections/openapi-client.js +1 -1
  130. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  131. package/dist/src/runtime/resolve-connection.js +1 -1
  132. package/dist/src/runtime/schedules/collection-client.d.ts +0 -2
  133. package/dist/src/runtime/schedules/collection-client.js +1 -1
  134. package/dist/src/runtime/types.d.ts +11 -0
  135. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  136. package/dist/src/setup/scaffold/create/project.js +2 -2
  137. package/dist/src/setup/scaffold/update/channels.js +1 -1
  138. package/dist/src/setup/scaffold/update/connections.js +2 -2
  139. package/dist/src/setup/scaffold/version-tokens.d.ts +1 -1
  140. package/dist/src/setup/scaffold/version-tokens.js +1 -1
  141. package/dist/src/shared/action-types.d.ts +1 -0
  142. package/dist/src/shared/action-types.js +1 -1
  143. package/dist/src/shared/agent-definition.d.ts +12 -4
  144. package/dist/src/shared/connection-events.d.ts +84 -0
  145. package/dist/src/shared/connection-events.js +1 -0
  146. package/dist/src/shared/connection-types.d.ts +10 -0
  147. package/dist/src/shared/validate-authorization.js +1 -1
  148. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  149. package/dist/src/tools/provided/no-reply.d.ts +5 -0
  150. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  151. package/dist/src/tools/signature.d.ts +4 -2
  152. package/dist/src/tools/signature.js +1 -1
  153. package/dist/src/tracing/eve/connection-events.d.ts +25 -0
  154. package/dist/src/tracing/eve/connection-events.js +1 -0
  155. package/dist/src/tracing/eve/install-instrumentation-runtime.js +1 -1
  156. package/dist/src/tracing/eve/mcp.d.ts +1 -0
  157. package/dist/src/tracing/eve/mcp.js +1 -1
  158. package/dist/src/tracing/eve/otel-declaration.d.ts +5 -0
  159. package/docs/agent-config.md +38 -13
  160. package/docs/channels/teams.mdx +6 -0
  161. package/docs/code-extension.mdx +28 -0
  162. package/docs/concepts/built-in-tools.md +3 -1
  163. package/docs/connections/mcp.mdx +105 -0
  164. package/docs/guides/hooks.md +4 -0
  165. package/docs/guides/instrumentation/instrumentation.mdx +2 -0
  166. package/docs/guides/instrumentation/otel.mdx +10 -0
  167. package/docs/sandbox/vercel.mdx +46 -0
  168. package/package.json +7 -7
  169. package/dist/src/compiled/_chunks/node/chunk-6QHBXN7B-gl4n6nmi.js +0 -12
  170. package/dist/src/compiled/_chunks/node/dist-DYDVZ-FS.js +0 -98
  171. package/dist/src/compiled/_chunks/node/dist-iEFkK9qw.js +0 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # eve
2
2
 
3
+ ## 0.80.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4210766: `git({ github })` accepts an optional `authorize` callback that runs once per `gh` tool invocation with the caller, declared repository, and repository-scoped token; returning `false` blocks the command. It gates caller/repository access, not individual API requests or operations, and allowed commands use the app token's permissions rather than the caller's GitHub permissions.
8
+ - 3fea287: Dropped traces and policies excluding either content direction now request Workflow data deletion when the run ends; set `experimental.workflow.retention: "default"` to retain completed transcripts independently of tracing. Expired session-history reads return `410 session_expired` before streaming, including when the World retains purged chunk records.
9
+
10
+ ### Patch Changes
11
+
12
+ - a5e33ec: Root sessions now accept empty model responses with `finishReason: "stop"` without retrying them or reporting a model-call failure. Recovery for delegated sessions, incomplete streams, and empty non-`stop` responses is unchanged.
13
+ - aa3d3fc: Scheduled sessions and their locally delegated tasks can now use dynamic scheduling tools and the schedule client to manage schedules, including conditional updates or disabling future occurrences. Collection scope authorization and tool approval policies still apply.
14
+ - b1de5d3: eve now vendors chat 4.42.0 and requires the optional `chat` peer at `^4.42.0`. chat 4.41 broke Workflow DevKit workflows in host apps (vercel/chat#969).
15
+ - 1f410e9: Dynamic schedule collections can defer their generated management tools to the catalog with `tool: "deferred"`, keeping them out of the model's initial tool list while still making them searchable and callable.
16
+ - a475f2d: Dynamic tools now capture locals bound by an array rest element (`const [first, ...rest] = ...`) or a rest parameter (`(...args) =>`). Before, the hoisted callback threw `ReferenceError` and the resolver's tools were dropped.
17
+ - 6d67e9a: Add experimental MCP connection event callback definitions and preserve the Connect runtime events bridge while keeping compiler metadata serializable.
18
+ - 3aa7dc5: Add experimental Connect-managed event subscriptions and per-connection webhook receivers. Durable event handlers run independently of conversation sessions; only an explicit `attachSession(...).send(...)` enters a session. Each watch saves its binding before subscribing, and each delivery runs independently under that binding. Subscribe with `ttlMs` in milliseconds or `null` to watch until stopped; `expiresAt` is returned as the calculated deadline. Requires `@vercel/connect@2.5.2` or later.
19
+
20
+ Return immediately from the durable sleep tool when steering has already interrupted its execution.
21
+ - 6d67e9a: Keep a session's deadline stable across workflow replay and compaction handoffs.
22
+ - 5243d1d: `web_fetch` now converts HTML pages served without a `Content-Type` header instead of returning truncated raw source.
23
+
24
+ ## 0.79.2
25
+
26
+ ### Patch Changes
27
+
28
+ - 910705c: An agent or `serve` tool call with an empty `taskId` now starts a new task instead of failing with `UNKNOWN_TASK`. Some models send `""` for the optional `taskId` rather than omitting it.
29
+ - 3ac1bd0: `eve start` no longer keeps the server's stdout and stderr in memory after startup. Output is still forwarded, and an unexpected exit no longer repeats the full log history in its error.
30
+ - 4c8ffa6: Keep successful tool calls completed when their output includes `code` and `message` fields.
31
+ - ee0c6c0: `ctx.cancel()` in a `message.received` hook now cancels the turn when the message is a plain-text answer to a pending `ask_question` or `ctx.ask()` question. The question resolves as `cancelled` and the tool call never receives the text. Before, eve logged a warning and delivered the answer. `ctx.cancel()` in an `action.partial` hook for a workflow tool's report now cancels the turn waiting on that tool too.
32
+ - bc4edd9: Attachments no longer fail a step when the session's sandbox cannot be resumed, for example when a follow-up lands on another replica. Earlier attachments and tool-result files in history reach the model as a "FileNotFound" note, and new inbound attachments and tool-returned files become a "could not be stored" note. Tools that use the sandbox still report the resume error.
33
+ - 2de4011: Fail fast with an actionable error when the project has an unsupported `microsandbox` version (such as 0.7), instead of every sandbox operation throwing `isInstalled is not a function`.
34
+ - 394ed22: Start built, managed eve agents when a local production Next.js server loads its configuration, so `next start` can serve eve routes.
35
+ - f6bf73e: Keep every property name in `eve__search` tool signatures that run past the length cap. A long signature now drops its property descriptions before any property name, so the model no longer misses fields a large MCP tool such as Linear's `save_issue` supports.
36
+ - b382594: Compaction no longer re-caps a tool result it already capped. A capped result now fits the size limit it was measured against, so later compactions leave it as it is instead of nesting another truncation notice and keeping less of the original content. A summary written after a cap also sees the whole content the capped result kept.
37
+ - a1c18f5: Teams group chats and channels no longer show connection sign-in links or confirmation codes in the shared thread. The card now has a **Sign in** button, and Teams shows the link only to the person who has to sign in, so another member can't connect their own account under the requester's identity.
38
+ - 9f3a634: Snapshot retained tracing arguments and errors so later mutations cannot introduce private content into telemetry or checkpoints. Apply accepted delegation capture ceilings when re-entering durable turns, including through `resume()`.
39
+ - ec2862e: When a tool throws, the error on its `tool.call.failed` instrumentation event now keeps the thrown error's `name`, such as `QuotaError`, instead of always reading `Error`. The `action.result` stream event reports the same name as `error.name`.
40
+ - c1880f4: Parse a workflow tool's result as JSON when its run completes, the way a local tool's result already is. A tool that returns `ctx.ask()`'s answer directly, after the person picked an option, no longer fails the turn with `Cannot convert undefined or null to object`: undefined properties are omitted, a tool that returns nothing reports `null`, and the same applies to `ctx.reply()` in `serve` tools. A result JSON can't carry, such as a `Date` or `Map`, now fails the call with a serialization error instead of reaching the model as `{}`.
41
+
3
42
  ## 0.79.1
4
43
 
5
44
  ### Patch Changes
@@ -0,0 +1,10 @@
1
+ import type { Session } from "#channel/session.js";
2
+ import type { AuthorizationRequiredStreamEvent } from "#protocol/message.js";
3
+ type AuthorizationRequired = AuthorizationRequiredStreamEvent["data"];
4
+ /**
5
+ * The newest sign-in that `matches` and hasn't completed yet, from the
6
+ * session's recent events. Attempts are keyed by connection name and
7
+ * `attemptId`, so one attempt completing never hides another still pending.
8
+ */
9
+ export declare function findPendingAuthorization(session: Pick<Session, "getEventStream">, matches: (event: AuthorizationRequired) => boolean): Promise<AuthorizationRequired | undefined>;
10
+ export {};
@@ -0,0 +1 @@
1
+ async function findPendingAuthorization(e,t){let n=new Map,r=(await e.getEventStream({follow:!1,startIndex:-500})).getReader();try{for(;;){let e=await r.read();if(e.done)break;let i=e.value;if(i.type===`authorization.required`&&t(i.data)){let e=attemptKey(i.data);n.delete(e),n.set(e,i.data)}else i.type===`authorization.completed`&&n.delete(attemptKey(i.data))}}finally{await r.cancel().catch(()=>{})}return[...n.values()].at(-1)}function attemptKey(e){return JSON.stringify([e.name,e.attemptId??null])}export{findPendingAuthorization};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "moduleFingerprints": {
3
3
  "@eve/catalog": "d5babf703f0f589f123ee2043b72bcb4823ccccbe5034315c3b70fbae7cd76a0",
4
- "@eve/tracing": "db045e46c45dfa0c1d045789bb04cfbe21999a0c35a848844b25e011ed332004",
4
+ "@eve/tracing": "f9d137e4e8838f1a359a8897b7229ecb243f441386b8e5e78fd71445be04b4ad",
5
5
  "just-secrets": "1ce67d437d0bb06df02e4e99180a3c5f5edf0010314010226e97b96d462bba5d",
6
6
  "@workflow/world-local": "a10e78551f65fc607cf75261a569d852c40bc9cfac13a7fb6e15c88bf1ccf429"
7
7
  },
@@ -10,10 +10,10 @@
10
10
  "@ai-sdk/anthropic": "4.0.78",
11
11
  "@cfworker/json-schema": "4.1.1",
12
12
  "@ai-sdk/code-mode": "1.0.94",
13
- "chat": "4.41.0",
14
- "@chat-adapter/slack": "4.41.0",
15
- "@chat-adapter/state-memory": "4.41.0",
16
- "@chat-adapter/twilio": "4.41.0",
13
+ "chat": "4.42.0",
14
+ "@chat-adapter/slack": "4.42.0",
15
+ "@chat-adapter/state-memory": "4.42.0",
16
+ "@chat-adapter/twilio": "4.42.0",
17
17
  "@clack/core": "1.3.1",
18
18
  "chokidar": "5.0.0",
19
19
  "commander": "14.0.3",
@@ -44,7 +44,7 @@
44
44
  "@standard-schema/spec": "1.1.0",
45
45
  "turndown": "7.2.4",
46
46
  "@vercel/blob": "2.8.0",
47
- "@vercel/connect": "2.3.3",
47
+ "@vercel/connect": "2.5.2",
48
48
  "@vercel/detect-agent": "1.2.3",
49
49
  "@vercel/oidc": "3.8.0",
50
50
  "@vercel/otel": "2.1.3",
@@ -61,7 +61,7 @@
61
61
  "zod": "4.5.4",
62
62
  "zod-validation-error": "5.0.0"
63
63
  },
64
- "scriptHash": "ad76180bc219ba33360a00db361000cab844f139baecb30faf54c133084f24b4",
64
+ "scriptHash": "a1ab8d11b1c1e2119c10ced6a32ad040a0a0b15d8319701b47d3e2c3ae9a2566",
65
65
  "toolVersions": {
66
66
  "rolldown": "1.2.9",
67
67
  "typescript": "7.0.2"
@@ -67,6 +67,12 @@ interface SlackFileUpload {
67
67
  title?: string;
68
68
  }
69
69
  interface SlackUploadOptions extends SlackApiOptions {
70
+ /**
71
+ * Block Kit blocks for the message that shares the files. Slack renders the
72
+ * files below the blocks. Cannot be combined with `initialComment`, which
73
+ * Slack would otherwise use while silently ignoring `blocks`.
74
+ */
75
+ blocks?: unknown[];
70
76
  channelId?: string;
71
77
  initialComment?: string;
72
78
  threadTs?: string;
@@ -1 +1 @@
1
- import{t as e}from"../../_chunks/node/chunk-7WDLOIRP-B_IWkVtZ.js";var t=class extends Error{method;response;status;constructor(e,t){super(e),this.name=`SlackApiError`,this.method=t.method,this.response=t.response,this.status=t.status}},n=`https://slack.com/api/`;async function r(e){return typeof e==`function`?await e():e}async function i(e,i,a){let o=await r(a.token),s=f(i,a.contentType??`form`),c=await(a.fetch??fetch)(new URL(e,a.apiUrl??n),{body:s.body,headers:{authorization:`Bearer ${o}`,"content-type":s.contentType},method:`POST`}),l=await c.json();if(!c.ok)throw new t(`Slack ${e} returned HTTP ${c.status}`,{method:e,response:l,status:c.status});return l}async function a(e){let t=await i(`chat.postMessage`,m(e),e);return p(`chat.postMessage`,t),{channel:x(t.channel),id:b(t.ts),raw:t}}async function o(e){let t=await i(`chat.postEphemeral`,{...m(e),user:e.user},e);return p(`chat.postEphemeral`,t),{channel:x(t.channel),id:b(t.message_ts),raw:t}}async function s(e){let t=await i(`chat.update`,{...m(e),ts:e.ts},e);return p(`chat.update`,t),{channel:x(t.channel),id:b(t.ts),raw:t}}async function c(e){let t=await i(`chat.delete`,{channel:e.channel,ts:e.ts},e);return p(`chat.delete`,t),t}async function l(e,n,r={}){let i=await(r.fetch??fetch)(e,{body:JSON.stringify(h(n)),headers:{"content-type":`application/json`},method:`POST`});if(!i.ok)throw new t(`Slack response_url returned HTTP ${i.status}`,{method:`response_url`,status:i.status})}async function u(e,n){if(e.length===0)return{fileIds:[],raw:{ok:!0}};let a=await r(n.token),o=n.fetch??fetch,s=[];for(let r of e){let e=await y(r.data),c=await i(`files.getUploadURLExternal`,{alt_txt:r.altText,filename:r.filename,length:e.byteLength,snippet_type:r.snippetType},n);p(`files.getUploadURLExternal`,c);let l=b(c.upload_url),u=b(c.file_id);if(!(l&&u))throw new t(`Slack files.getUploadURLExternal returned no upload URL`,{method:`files.getUploadURLExternal`,response:c});let d=await o(l,{body:e,headers:{authorization:`Bearer ${a}`,"content-type":`application/octet-stream`},method:`POST`});if(!d.ok)throw new t(`Slack file upload returned HTTP ${d.status}`,{method:`files.upload`,status:d.status});s.push(u)}let c=await i(`files.completeUploadExternal`,{channel_id:n.channelId,files:e.map((e,t)=>({id:s[t],title:e.title??e.filename})),initial_comment:n.initialComment,thread_ts:n.threadTs},n);return p(`files.completeUploadExternal`,c),{fileIds:s,raw:c}}async function d(n){let i=n.fetch??fetch,a=e(n.url,n.apiUrl)?await r(n.token):void 0,o=await i(n.url,{headers:a?{authorization:`Bearer ${a}`}:void 0});if(!o.ok)throw new t(`Slack file fetch returned HTTP ${o.status}`,{method:`files.fetch`,status:o.status});return o}function f(e,t=`form`){if(t===`json`)return{body:JSON.stringify(v(e)),contentType:`application/json`};let n=new URLSearchParams;for(let[t,r]of Object.entries(e))r!=null&&n.set(t,_(r));return{body:n.toString(),contentType:`application/x-www-form-urlencoded`}}function p(e,n){if(n.ok!==!0)throw new t(`Slack ${e} failed: ${n.error??`unknown_error`}`,{method:e,response:n})}function m(e){return g(e),{blocks:e.blocks,channel:e.channel,markdown_text:e.markdownText,metadata:e.metadata,reply_broadcast:e.replyBroadcast,text:e.text,thread_ts:e.threadTs,unfurl_links:e.unfurlLinks,unfurl_media:e.unfurlMedia}}function h(e){return{blocks:e.blocks,delete_original:e.deleteOriginal,replace_original:e.replaceOriginal,response_type:e.responseType,text:e.text,thread_ts:e.threadTs}}function g(e){if(e.markdownText!==void 0&&(e.text!==void 0||e.blocks!==void 0))throw TypeError(`markdownText cannot be used with text or blocks`)}function _(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}function v(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}async function y(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(await e.arrayBuffer())}function b(e){return typeof e==`string`?e:``}function x(e){return typeof e==`string`?e:void 0}async function S(e){let t=await i(`conversations.replies`,{channel:e.channel,cursor:e.cursor,include_all_metadata:e.includeAllMetadata,inclusive:e.inclusive,latest:e.latest,limit:e.limit,oldest:e.oldest,ts:e.ts},e);return p(`conversations.replies`,t),{messages:Array.isArray(t.messages)?t.messages:[],nextCursor:w(t),raw:t}}async function C(e){if(!(e.triggerId||e.interactivityPointer))throw TypeError(`triggerId or interactivityPointer is required`);let t=await i(`views.open`,{interactivity_pointer:e.interactivityPointer,trigger_id:e.triggerId,view:e.view},e);return p(`views.open`,t),{raw:t,view:t.view}}function w(e){let t=e.response_metadata?.next_cursor;return typeof t==`string`&&t.length>0?t:void 0}export{t as SlackApiError,p as assertSlackOk,i as callSlackApi,c as deleteSlackMessage,f as encodeSlackApiBody,d as fetchSlackFile,S as fetchSlackThreadReplies,C as openSlackView,o as postSlackEphemeral,a as postSlackMessage,r as resolveSlackBotToken,l as sendSlackResponseUrl,s as updateSlackMessage,u as uploadSlackFiles};
1
+ import{t as e}from"../../_chunks/node/chunk-7WDLOIRP-B_IWkVtZ.js";var t=class extends Error{method;response;status;constructor(e,t){super(e),this.name=`SlackApiError`,this.method=t.method,this.response=t.response,this.status=t.status}},n=`https://slack.com/api/`;async function r(e){return typeof e==`function`?await e():e}async function i(e,i,a){let o=await r(a.token),s=f(i,a.contentType??`form`),c=await(a.fetch??fetch)(new URL(e,a.apiUrl??n),{body:s.body,headers:{authorization:`Bearer ${o}`,"content-type":s.contentType},method:`POST`}),l=await c.json();if(!c.ok)throw new t(`Slack ${e} returned HTTP ${c.status}`,{method:e,response:l,status:c.status});return l}async function a(e){let t=await i(`chat.postMessage`,m(e),e);return p(`chat.postMessage`,t),{channel:x(t.channel),id:b(t.ts),raw:t}}async function o(e){let t=await i(`chat.postEphemeral`,{...m(e),user:e.user},e);return p(`chat.postEphemeral`,t),{channel:x(t.channel),id:b(t.message_ts),raw:t}}async function s(e){let t=await i(`chat.update`,{...m(e),ts:e.ts},e);return p(`chat.update`,t),{channel:x(t.channel),id:b(t.ts),raw:t}}async function c(e){let t=await i(`chat.delete`,{channel:e.channel,ts:e.ts},e);return p(`chat.delete`,t),t}async function l(e,n,r={}){let i=await(r.fetch??fetch)(e,{body:JSON.stringify(h(n)),headers:{"content-type":`application/json`},method:`POST`});if(!i.ok)throw new t(`Slack response_url returned HTTP ${i.status}`,{method:`response_url`,status:i.status})}async function u(e,n){if(n.blocks!==void 0&&n.initialComment!==void 0)throw TypeError(`blocks cannot be used with initialComment`);if(e.length===0)return{fileIds:[],raw:{ok:!0}};let a=await r(n.token),o=n.fetch??fetch,s=[];for(let r of e){let e=await y(r.data),c=await i(`files.getUploadURLExternal`,{alt_txt:r.altText,filename:r.filename,length:e.byteLength,snippet_type:r.snippetType},n);p(`files.getUploadURLExternal`,c);let l=b(c.upload_url),u=b(c.file_id);if(!(l&&u))throw new t(`Slack files.getUploadURLExternal returned no upload URL`,{method:`files.getUploadURLExternal`,response:c});let d=await o(l,{body:e,headers:{authorization:`Bearer ${a}`,"content-type":`application/octet-stream`},method:`POST`});if(!d.ok)throw new t(`Slack file upload returned HTTP ${d.status}`,{method:`files.upload`,status:d.status});s.push(u)}let c=await i(`files.completeUploadExternal`,{blocks:n.blocks,channel_id:n.channelId,files:e.map((e,t)=>({id:s[t],title:e.title??e.filename})),initial_comment:n.initialComment,thread_ts:n.threadTs},n);return p(`files.completeUploadExternal`,c),{fileIds:s,raw:c}}async function d(n){let i=n.fetch??fetch,a=e(n.url,n.apiUrl)?await r(n.token):void 0,o=await i(n.url,{headers:a?{authorization:`Bearer ${a}`}:void 0});if(!o.ok)throw new t(`Slack file fetch returned HTTP ${o.status}`,{method:`files.fetch`,status:o.status});return o}function f(e,t=`form`){if(t===`json`)return{body:JSON.stringify(v(e)),contentType:`application/json`};let n=new URLSearchParams;for(let[t,r]of Object.entries(e))r!=null&&n.set(t,_(r));return{body:n.toString(),contentType:`application/x-www-form-urlencoded`}}function p(e,n){if(n.ok!==!0)throw new t(`Slack ${e} failed: ${n.error??`unknown_error`}`,{method:e,response:n})}function m(e){return g(e),{blocks:e.blocks,channel:e.channel,markdown_text:e.markdownText,metadata:e.metadata,reply_broadcast:e.replyBroadcast,text:e.text,thread_ts:e.threadTs,unfurl_links:e.unfurlLinks,unfurl_media:e.unfurlMedia}}function h(e){return{blocks:e.blocks,delete_original:e.deleteOriginal,replace_original:e.replaceOriginal,response_type:e.responseType,text:e.text,thread_ts:e.threadTs}}function g(e){if(e.markdownText!==void 0&&(e.text!==void 0||e.blocks!==void 0))throw TypeError(`markdownText cannot be used with text or blocks`)}function _(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}function v(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}async function y(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(await e.arrayBuffer())}function b(e){return typeof e==`string`?e:``}function x(e){return typeof e==`string`?e:void 0}async function S(e){let t=await i(`conversations.replies`,{channel:e.channel,cursor:e.cursor,include_all_metadata:e.includeAllMetadata,inclusive:e.inclusive,latest:e.latest,limit:e.limit,oldest:e.oldest,ts:e.ts},e);return p(`conversations.replies`,t),{messages:Array.isArray(t.messages)?t.messages:[],nextCursor:w(t),raw:t}}async function C(e){if(!(e.triggerId||e.interactivityPointer))throw TypeError(`triggerId or interactivityPointer is required`);let t=await i(`views.open`,{interactivity_pointer:e.interactivityPointer,trigger_id:e.triggerId,view:e.view},e);return p(`views.open`,t),{raw:t,view:t.view}}function w(e){let t=e.response_metadata?.next_cursor;return typeof t==`string`&&t.length>0?t:void 0}export{t as SlackApiError,p as assertSlackOk,i as callSlackApi,c as deleteSlackMessage,f as encodeSlackApiBody,d as fetchSlackFile,S as fetchSlackThreadReplies,C as openSlackView,o as postSlackEphemeral,a as postSlackMessage,r as resolveSlackBotToken,l as sendSlackResponseUrl,s as updateSlackMessage,u as uploadSlackFiles};
@@ -1,4 +1,4 @@
1
- import{d as e}from"../../_chunks/node/chunk-6QHBXN7B-gl4n6nmi.js";var t=class extends Error{constructor(e){super(e),this.name=`SlackBlockError`}},n={actionId:255,actionsElements:25,blockId:255,blocks:50,buttonText:75,buttonUrl:3e3,buttonValue:2e3,chartDataPoints:20,chartLabel:20,chartsPerMessage:2,chartSegments:12,chartSeries:12,chartTitle:50,fields:10,fieldText:2e3,headerText:150,imageAlt:2e3,imageUrl:3e3,optionDescription:75,optionText:75,optionValue:150,options:100,placeholder:150,radioOptions:10,sectionText:3e3,tableChars:1e4,tableColumns:20,tablePageSize:100,tableRows:100,textObject:3e3},r=`input:`,i=`input-freeform:`,a=`input-freeform-submit`,o=`input-freeform-block`,s=`input-freeform-text`,ee=/^(?<requestId>.+):button:\d+$/u;function c(e){let t={text:{text:g(e.prompt,n.sectionText),type:`mrkdwn`},type:`section`},r=e.options??[];if(r.length===0)return[t,{elements:[p(e.requestId)],type:`actions`}];let i=e.allowFreeform?[p(e.requestId)]:[];if(e.display===`radio`)return[t,{elements:[te(e),...i],type:`actions`}];if(e.display===`select`)return[t,{elements:[h(e),...i],type:`actions`}];let a=i.length>0?n.actionsElements-1:n.actionsElements;return[t,{elements:r.slice(0,a).map((t,n)=>m(e.requestId,t,n)).concat(i),type:`actions`}]}function l(e){if(!e.actionId.startsWith(`input:`))return null;let t=e.actionId.slice(r.length);if(e.selectedOptionValue!==void 0)return t?{optionId:e.selectedOptionValue,requestId:t}:null;let n=ee.exec(t)?.groups?.requestId;return n&&e.value!==void 0?{optionId:e.value,requestId:n}:null}function u(e){let t=g(e.title??e.prompt??`Your answer`,24),r=[];return e.prompt&&r.push({text:{text:g(e.prompt,n.sectionText),type:`mrkdwn`},type:`section`}),r.push({block_id:o,element:{action_id:s,multiline:!0,type:`plain_text_input`},label:{text:`Answer`,type:`plain_text`},type:`input`}),{blocks:r,callback_id:a,close:{text:`Cancel`,type:`plain_text`},private_metadata:typeof e.metadata==`string`?e.metadata:JSON.stringify(e.metadata),submit:{text:`Submit`,type:`plain_text`},title:{text:t,type:`plain_text`},type:`modal`}}function d(e){return e.find(e=>e.blockId===`input-freeform-block`&&e.actionId===`input-freeform-text`)?.value}function f(e){let t=[];return e.promptBlock&&typeof e.promptBlock==`object`&&t.push(e.promptBlock),t.push({text:{text:`:white_check_mark: *${e.answer}*`,type:`mrkdwn`},type:`section`}),e.userId&&t.push({elements:[{text:`Answered by <@${e.userId}>`,type:`mrkdwn`}],type:`context`}),t}function p(e){return{action_id:`${i}${e}`,style:`primary`,text:{text:`Type your answer`,type:`plain_text`},type:`button`,value:e}}function m(e,t,i){return _({action_id:`${r}${e}:button:${i}`,style:t.style===`primary`||t.style===`danger`?t.style:void 0,text:{text:g(t.label,n.buttonText),type:`plain_text`},type:`button`,value:g(t.id,n.buttonValue)})}function h(e){let t=(e.options??[]).map(e=>({text:{text:g(e.label,n.optionText),type:`plain_text`},value:g(e.id,n.optionValue)}));return{action_id:`${r}${e.requestId}`,options:t.slice(0,n.options),placeholder:{text:`Choose an option`,type:`plain_text`},type:`static_select`}}function te(e){let t=(e.options??[]).map(e=>({text:{text:g(e.label,n.optionText),type:`plain_text`},value:g(e.id,n.optionValue)}));return t.length>n.radioOptions?h(e):{action_id:`${r}${e.requestId}`,options:t,type:`radio_buttons`}}function g(e,t){return e.length>t?e.slice(0,t):e}function _(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}var v=` `,y=/\{\{emoji:([a-zA-Z0-9_+-]+)\}\}/g;function b(e,t={}){let r=[],i={chartCount:0,convertEmoji:t.convertEmoji??w,maxBlocks:t.maxBlocks??n.blocks,usedTable:!1};e.title&&r.push({text:K(e.title,i.convertEmoji,n.headerText),type:`header`}),e.subtitle&&r.push({elements:[G(e.subtitle,i.convertEmoji,n.textObject)],type:`context`}),e.imageUrl&&r.push({alt_text:Y(i.convertEmoji(e.title||`Card image`),n.imageAlt),image_url:Y(e.imageUrl,n.imageUrl),type:`image`});for(let t of e.children)r.push(...T(t,i));return r.slice(0,i.maxBlocks)}var x=b;function S(e,t={}){let n=t.convertEmoji??w,r=[];e.title&&r.push(`*${n(e.title)}*`),e.subtitle&&r.push(n(e.subtitle));for(let t of e.children){let e=W(t,n);e&&r.push(e)}return r.join(`
1
+ import{d as e}from"../../_chunks/node/chunk-NBSLXVG3-Bt7pDfyn.js";var t=class extends Error{constructor(e){super(e),this.name=`SlackBlockError`}},n={actionId:255,actionsElements:25,blockId:255,blocks:50,buttonText:75,buttonUrl:3e3,buttonValue:2e3,chartDataPoints:20,chartLabel:20,chartsPerMessage:2,chartSegments:12,chartSeries:12,chartTitle:50,fields:10,fieldText:2e3,headerText:150,imageAlt:2e3,imageUrl:3e3,optionDescription:75,optionText:75,optionValue:150,options:100,placeholder:150,radioOptions:10,sectionText:3e3,tableChars:1e4,tableColumns:20,tablePageSize:100,tableRows:100,textObject:3e3},r=`input:`,i=`input-freeform:`,a=`input-freeform-submit`,o=`input-freeform-block`,s=`input-freeform-text`,ee=/^(?<requestId>.+):button:\d+$/u;function c(e){let t={text:{text:g(e.prompt,n.sectionText),type:`mrkdwn`},type:`section`},r=e.options??[];if(r.length===0)return[t,{elements:[p(e.requestId)],type:`actions`}];let i=e.allowFreeform?[p(e.requestId)]:[];if(e.display===`radio`)return[t,{elements:[te(e),...i],type:`actions`}];if(e.display===`select`)return[t,{elements:[h(e),...i],type:`actions`}];let a=i.length>0?n.actionsElements-1:n.actionsElements;return[t,{elements:r.slice(0,a).map((t,n)=>m(e.requestId,t,n)).concat(i),type:`actions`}]}function l(e){if(!e.actionId.startsWith(`input:`))return null;let t=e.actionId.slice(r.length);if(e.selectedOptionValue!==void 0)return t?{optionId:e.selectedOptionValue,requestId:t}:null;let n=ee.exec(t)?.groups?.requestId;return n&&e.value!==void 0?{optionId:e.value,requestId:n}:null}function u(e){let t=g(e.title??e.prompt??`Your answer`,24),r=[];return e.prompt&&r.push({text:{text:g(e.prompt,n.sectionText),type:`mrkdwn`},type:`section`}),r.push({block_id:o,element:{action_id:s,multiline:!0,type:`plain_text_input`},label:{text:`Answer`,type:`plain_text`},type:`input`}),{blocks:r,callback_id:a,close:{text:`Cancel`,type:`plain_text`},private_metadata:typeof e.metadata==`string`?e.metadata:JSON.stringify(e.metadata),submit:{text:`Submit`,type:`plain_text`},title:{text:t,type:`plain_text`},type:`modal`}}function d(e){return e.find(e=>e.blockId===`input-freeform-block`&&e.actionId===`input-freeform-text`)?.value}function f(e){let t=[];return e.promptBlock&&typeof e.promptBlock==`object`&&t.push(e.promptBlock),t.push({text:{text:`:white_check_mark: *${e.answer}*`,type:`mrkdwn`},type:`section`}),e.userId&&t.push({elements:[{text:`Answered by <@${e.userId}>`,type:`mrkdwn`}],type:`context`}),t}function p(e){return{action_id:`${i}${e}`,style:`primary`,text:{text:`Type your answer`,type:`plain_text`},type:`button`,value:e}}function m(e,t,i){return _({action_id:`${r}${e}:button:${i}`,style:t.style===`primary`||t.style===`danger`?t.style:void 0,text:{text:g(t.label,n.buttonText),type:`plain_text`},type:`button`,value:g(t.id,n.buttonValue)})}function h(e){let t=(e.options??[]).map(e=>({text:{text:g(e.label,n.optionText),type:`plain_text`},value:g(e.id,n.optionValue)}));return{action_id:`${r}${e.requestId}`,options:t.slice(0,n.options),placeholder:{text:`Choose an option`,type:`plain_text`},type:`static_select`}}function te(e){let t=(e.options??[]).map(e=>({text:{text:g(e.label,n.optionText),type:`plain_text`},value:g(e.id,n.optionValue)}));return t.length>n.radioOptions?h(e):{action_id:`${r}${e.requestId}`,options:t,type:`radio_buttons`}}function g(e,t){return e.length>t?e.slice(0,t):e}function _(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}var v=` `,y=/\{\{emoji:([a-zA-Z0-9_+-]+)\}\}/g;function b(e,t={}){let r=[],i={chartCount:0,convertEmoji:t.convertEmoji??w,maxBlocks:t.maxBlocks??n.blocks,usedTable:!1};e.title&&r.push({text:K(e.title,i.convertEmoji,n.headerText),type:`header`}),e.subtitle&&r.push({elements:[G(e.subtitle,i.convertEmoji,n.textObject)],type:`context`}),e.imageUrl&&r.push({alt_text:Y(i.convertEmoji(e.title||`Card image`),n.imageAlt),image_url:Y(e.imageUrl,n.imageUrl),type:`image`});for(let t of e.children)r.push(...T(t,i));return r.slice(0,i.maxBlocks)}var x=b;function S(e,t={}){let n=t.convertEmoji??w,r=[];e.title&&r.push(`*${n(e.title)}*`),e.subtitle&&r.push(n(e.subtitle));for(let t of e.children){let e=W(t,n);e&&r.push(e)}return r.join(`
2
2
  `)}var C=S;function w(e){return e.replace(y,`:$1:`)}function T(e,t){switch(e.type){case`actions`:return[k(e,t.convertEmoji)];case`chart`:return[z(e,t)];case`divider`:return[{type:`divider`}];case`fields`:return[L(e,t.convertEmoji)];case`image`:return[D(e,t.convertEmoji)];case`link`:return[O(e,t.convertEmoji)];case`section`:return e.children.flatMap(e=>T(e,t));case`table`:return R(e,t);case`text`:return[E(e,t.convertEmoji)];default:return Z(e)}}function E(t,r){let i=e(r(t.content));return t.style===`muted`?{elements:[G(i,e=>e,n.textObject)],type:`context`}:{text:G(t.style===`bold`?`*${i}*`:i,e=>e,n.sectionText),type:`section`}}function D(e,t){return{alt_text:Y(t(e.alt||`Image`),n.imageAlt),image_url:Y(e.url,n.imageUrl),type:`image`}}function O(e,t){return{text:G(`<${e.url}|${t(e.label)}>`,e=>e,n.sectionText),type:`section`}}function k(e,t){return{elements:e.children.slice(0,n.actionsElements).map(e=>A(e,t)),type:`actions`}}function A(e,t){switch(e.type){case`button`:return j(e,t);case`link-button`:return M(e,t);case`radio_select`:return P(e,t);case`select`:return N(e,t);default:return Z(e)}}function j(e,t){return Q({action_id:Y(e.id,n.actionId),style:J(e.style),text:K(e.label,t,n.buttonText),type:`button`,value:e.value===void 0?void 0:Y(e.value,n.buttonValue)})}function M(e,t){return Q({action_id:Y(e.id??`link-${e.url}`,n.actionId),style:J(e.style),text:K(e.label,t,n.buttonText),type:`button`,url:Y(e.url,n.buttonUrl)})}function N(e,t){let r=e.options.slice(0,n.options).map(e=>I(e,t,`plain_text`));return Q({action_id:Y(e.id,n.actionId),initial_option:F(r,e.initialOption),options:r,placeholder:e.placeholder?K(e.placeholder,t,n.placeholder):void 0,type:`static_select`})}function P(e,t){let r=e.options.slice(0,n.radioOptions).map(e=>I(e,t,`mrkdwn`));return Q({action_id:Y(e.id,n.actionId),initial_option:F(r,e.initialOption),options:r,type:`radio_buttons`})}function F(e,t){if(t===void 0)return;let r=Y(t,n.optionValue);return e.find(e=>e.value===r)}function I(e,t,r){return Q({description:e.description?{text:Y(t(e.description),n.optionDescription),type:r}:void 0,text:{text:Y(t(e.label),n.optionText),type:r},value:Y(e.value,n.optionValue)})}function L(t,r){return{fields:t.children.slice(0,n.fields).map(t=>G(`*${e(r(t.label))}*
3
3
  ${e(r(t.value))}`,e=>e,n.fieldText)),type:`section`}}function R(e,t){let r=[e.headers,...e.rows].flat().reduce((e,t)=>e+t.length,0);if(t.usedTable||e.rows.length+1>n.tableRows||e.headers.length>n.tableColumns||r>n.tableChars)return[{text:B($(e)),type:`section`}];t.usedTable=!0;let i=[e.headers.map(e=>q(e,t.convertEmoji)),...e.rows.map(e=>e.map(e=>q(e,t.convertEmoji)))];return e.rows.length===0?[Q({column_settings:e.align?.slice(0,n.tableColumns).map(e=>e?{align:e}:null),rows:i,type:`table`})]:[Q({caption:t.convertEmoji(e.caption||`Table`),page_size:e.pageSize===void 0?void 0:Math.min(n.tablePageSize,Math.max(1,Math.floor(e.pageSize))),rows:i,type:`data_table`})]}function z(e,t){let r=t.chartCount<n.chartsPerMessage?V(e,t.convertEmoji):null;return r?(t.chartCount+=1,r):{text:B(U(e)),type:`section`}}function B(e){let t=e=>`\`\`\`
4
4
  ${e}
@@ -1 +1 @@
1
- import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,p as c,r as l,s as u,t as d,u as f}from"../../_chunks/node/chunk-6QHBXN7B-gl4n6nmi.js";export{d as createSlackMrkdwn,o as createSlackPlainText,l as escapeSlackText,i as formatSlackChannel,e as formatSlackDate,s as formatSlackLink,u as formatSlackSpecialMention,t as formatSlackUser,a as formatSlackUserGroup,f as linkBareSlackMentions,n as markdownBoldToSlackMrkdwn,r as slackMrkdwnToMarkdown,c as unescapeSlackText};
1
+ import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,p as c,r as l,s as u,t as d,u as f}from"../../_chunks/node/chunk-NBSLXVG3-Bt7pDfyn.js";export{d as createSlackMrkdwn,o as createSlackPlainText,l as escapeSlackText,i as formatSlackChannel,e as formatSlackDate,s as formatSlackLink,u as formatSlackSpecialMention,t as formatSlackUser,a as formatSlackUserGroup,f as linkBareSlackMentions,n as markdownBoldToSlackMrkdwn,r as slackMrkdwnToMarkdown,c as unescapeSlackText};
@@ -2,7 +2,7 @@ import { AsyncLocalStorage } from 'node:async_hooks';
2
2
  import { AttachmentTransport } from './_chat-adapter-shared.js';
3
3
  export { AttachmentTransport, EncryptedTokenData, decodeKey } from './_chat-adapter-shared.js';
4
4
  import { WebClientOptions, WebClient } from './_slack-web-api.js';
5
- import { Message, AppContextEntity, CardElement, BaseFormatConverter, Root, AdapterPostableMessage, Logger, Adapter, ChatInstance, UserInfo, WebhookOptions, OptionsLoadResult, ModalResponse, ModalElement, AgentSessionStatus, LinkPreview, Attachment, RawMessage, EphemeralMessage, ScheduledMessage, FileUpload, PlanModel, PlanContent, EmojiValue, TypingOptions, StreamChunk, StreamOptions, FetchOptions, FetchResult, ThreadInfo, ChannelVisibility, FormattedContent, ListThreadsOptions, ListThreadsResult, ChannelInfo } from '#compiled/chat/index.js';
5
+ import { Message, AppContextEntity, CardElement, BaseFormatConverter, Root, AdapterPostableMessage, Logger, RawMessage, Adapter, ChatInstance, UserInfo, WebhookOptions, OptionsLoadResult, ModalResponse, ModalElement, AgentSessionStatus, LinkPreview, Attachment, EphemeralMessage, ScheduledMessage, FileUpload, PlanModel, PlanContent, EmojiValue, TypingOptions, StreamChunk, StreamOptions, FetchOptions, FetchResult, ThreadInfo, ChannelVisibility, FormattedContent, ListThreadsOptions, ListThreadsResult, ChannelInfo } from '#compiled/chat/index.js';
6
6
  import { S as SlackFetch } from './fetch-QqNM_Ef3.js';
7
7
  import { S as SlackWebhookVerifier } from './types-CdGmMyOr.js';
8
8
 
@@ -216,6 +216,14 @@ interface SlackSuggestedPromptsContext {
216
216
  * resolver to skip setting prompts for that thread.
217
217
  */
218
218
  type SlackSuggestedPrompts = SlackSuggestedPromptsOptions | ((context: SlackSuggestedPromptsContext) => SlackSuggestedPromptsOptions | null | undefined | Promise<SlackSuggestedPromptsOptions | null | undefined>);
219
+ /**
220
+ * Result of `SlackAdapter.stream()`. A reply that streams longer than
221
+ * `streamSegmentMaxAgeMs` is split into several Slack messages; `id` is the
222
+ * last one and `messageIds` lists all of them in order, ending with `id`.
223
+ */
224
+ interface SlackStreamResult extends RawMessage<unknown> {
225
+ messageIds: string[];
226
+ }
219
227
  /** Context passed to a dynamic agent-session title resolver. */
220
228
  interface SlackSessionTitleContext {
221
229
  channelId: string;
@@ -875,6 +883,7 @@ declare class SlackAdapter implements Adapter<SlackThreadId, unknown> {
875
883
  * (single-workspace) → throws.
876
884
  */
877
885
  protected getToken(): Promise<string>;
886
+ getConcurrencyScope(): string | undefined;
878
887
  /**
879
888
  * Add the current token to API call options.
880
889
  * Workaround for Slack WebClient types not including `token` in per-method args.
@@ -1318,11 +1327,11 @@ declare class SlackAdapter implements Adapter<SlackThreadId, unknown> {
1318
1327
  * Slack expires a native stream after roughly five minutes, so a reply
1319
1328
  * that streams longer than `streamSegmentMaxAgeMs` is finalized and
1320
1329
  * continued in a new message. The returned `id` is the last message of
1321
- * the reply; earlier segments are already final and are not tracked.
1330
+ * the reply, and `messageIds` lists every message of the reply in order.
1322
1331
  *
1323
1332
  * Falls back to post-and-edit when the thread lacks native stream context.
1324
1333
  */
1325
- stream(threadId: string, textStream: AsyncIterable<string | StreamChunk>, options?: StreamOptions): Promise<RawMessage<unknown> | null>;
1334
+ stream(threadId: string, textStream: AsyncIterable<string | StreamChunk>, options?: StreamOptions): Promise<SlackStreamResult | null>;
1326
1335
  /**
1327
1336
  * Open a direct message conversation with a user.
1328
1337
  * Returns a thread ID that can be used to post messages.
@@ -1339,11 +1348,8 @@ declare class SlackAdapter implements Adapter<SlackThreadId, unknown> {
1339
1348
  *
1340
1349
  * Slack's API returns oldest-first, so for backward direction we:
1341
1350
  * 1. Use `latest` parameter to fetch messages before a timestamp (cursor)
1342
- * 2. Fetch up to 1000 messages (API limit) and take the last N
1351
+ * 2. Follow Slack's native cursors to the end, retaining the last N plus one
1343
1352
  * 3. Return messages in chronological order (oldest first within the page)
1344
- *
1345
- * Note: For very large threads (>1000 messages), the first backward call
1346
- * may not return the absolute most recent messages. This is a Slack API limitation.
1347
1353
  */
1348
1354
  protected fetchMessagesBackward(channel: string, threadTs: string, threadId: string, limit: number, cursor?: string): Promise<FetchResult<unknown>>;
1349
1355
  fetchThread(threadId: string): Promise<ThreadInfo>;
@@ -1479,4 +1485,4 @@ declare class SlackAdapter implements Adapter<SlackThreadId, unknown> {
1479
1485
  }
1480
1486
  declare function createSlackAdapter(config?: SlackAdapterConfig): SlackAdapter;
1481
1487
 
1482
- export { SlackAdapter, type SlackAdapterConfig, type SlackAdapterMode, type SlackAppContext, type SlackAppContextChangedEvent, type SlackAppContextEntity, type SlackBlock, type SlackBotToken, type SlackEvent, type SlackFeedbackButtonsOptions, SlackFormatConverter, type SlackInstallation, SlackFormatConverter as SlackMarkdownConverter, type SlackMessageBlock, type SlackOAuthCallbackOptions, type SlackReactionEvent, type SlackSessionTitle, type SlackSessionTitleContext, type SlackSuggestedPrompt, type SlackSuggestedPrompts, type SlackSuggestedPromptsContext, type SlackSuggestedPromptsOptions, type SlackThreadId, buildFeedbackButtonsBlock, cardToBlockKit, cardToFallbackText, createSlackAdapter, getAppContext, normalizeAppContextEntities };
1488
+ export { SlackAdapter, type SlackAdapterConfig, type SlackAdapterMode, type SlackAppContext, type SlackAppContextChangedEvent, type SlackAppContextEntity, type SlackBlock, type SlackBotToken, type SlackEvent, type SlackFeedbackButtonsOptions, SlackFormatConverter, type SlackInstallation, SlackFormatConverter as SlackMarkdownConverter, type SlackMessageBlock, type SlackOAuthCallbackOptions, type SlackReactionEvent, type SlackSessionTitle, type SlackSessionTitleContext, type SlackStreamResult, type SlackSuggestedPrompt, type SlackSuggestedPrompts, type SlackSuggestedPromptsContext, type SlackSuggestedPromptsOptions, type SlackThreadId, buildFeedbackButtonsBlock, cardToBlockKit, cardToFallbackText, createSlackAdapter, getAppContext, normalizeAppContextEntities };