managed-deepagents 0.8.7-dev.1 → 0.8.7-dev.3

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 (189) hide show
  1. package/README.md +116 -36
  2. package/dist/agent-entry.d.ts +6 -0
  3. package/dist/agent-entry.d.ts.map +1 -0
  4. package/dist/agent-entry.js +2 -0
  5. package/dist/agent-entry.js.map +1 -0
  6. package/dist/channels/binding.d.ts +5 -0
  7. package/dist/channels/binding.d.ts.map +1 -1
  8. package/dist/channels/binding.js +4 -1
  9. package/dist/channels/binding.js.map +1 -1
  10. package/dist/channels/http/index.d.ts.map +1 -1
  11. package/dist/channels/http/index.js +5 -1
  12. package/dist/channels/http/index.js.map +1 -1
  13. package/dist/channels/http/types.d.ts +2 -0
  14. package/dist/channels/http/types.d.ts.map +1 -1
  15. package/dist/channels/messaging-registry.d.ts +2 -0
  16. package/dist/channels/messaging-registry.d.ts.map +1 -1
  17. package/dist/channels/messaging-registry.js +10 -0
  18. package/dist/channels/messaging-registry.js.map +1 -1
  19. package/dist/channels/reactions.d.ts +32 -0
  20. package/dist/channels/reactions.d.ts.map +1 -0
  21. package/dist/channels/reactions.js +53 -0
  22. package/dist/channels/reactions.js.map +1 -0
  23. package/dist/channels/response-format.d.ts +1 -0
  24. package/dist/channels/response-format.d.ts.map +1 -1
  25. package/dist/channels/response-format.js +30 -4
  26. package/dist/channels/response-format.js.map +1 -1
  27. package/dist/channels/runtime.d.ts +1 -0
  28. package/dist/channels/runtime.d.ts.map +1 -1
  29. package/dist/channels/runtime.js +7 -1
  30. package/dist/channels/runtime.js.map +1 -1
  31. package/dist/channels/schedule-delivery.d.ts +3 -25
  32. package/dist/channels/schedule-delivery.d.ts.map +1 -1
  33. package/dist/channels/schedule-delivery.js +28 -31
  34. package/dist/channels/schedule-delivery.js.map +1 -1
  35. package/dist/channels/slack/files-middleware.d.ts +4 -4
  36. package/dist/channels/slack/files-middleware.d.ts.map +1 -1
  37. package/dist/channels/slack/files-middleware.js +11 -9
  38. package/dist/channels/slack/files-middleware.js.map +1 -1
  39. package/dist/channels/slack/files.d.ts +3 -2
  40. package/dist/channels/slack/files.d.ts.map +1 -1
  41. package/dist/channels/slack/files.js +35 -15
  42. package/dist/channels/slack/files.js.map +1 -1
  43. package/dist/channels/slack/index.d.ts +8 -0
  44. package/dist/channels/slack/index.d.ts.map +1 -1
  45. package/dist/channels/slack/index.js +10 -0
  46. package/dist/channels/slack/index.js.map +1 -1
  47. package/dist/channels/slack/transport.d.ts.map +1 -1
  48. package/dist/channels/slack/transport.js +1 -1
  49. package/dist/channels/slack/transport.js.map +1 -1
  50. package/dist/channels/trigger/http.d.ts +3 -0
  51. package/dist/channels/trigger/http.d.ts.map +1 -1
  52. package/dist/channels/trigger/http.js +84 -37
  53. package/dist/channels/trigger/http.js.map +1 -1
  54. package/dist/channels/trigger/transport.d.ts.map +1 -1
  55. package/dist/channels/trigger/transport.js +6 -3
  56. package/dist/channels/trigger/transport.js.map +1 -1
  57. package/dist/channels/trigger/types.d.ts +21 -2
  58. package/dist/channels/trigger/types.d.ts.map +1 -1
  59. package/dist/channels/trigger/types.js.map +1 -1
  60. package/dist/channels/types.d.ts +3 -0
  61. package/dist/channels/types.d.ts.map +1 -1
  62. package/dist/channels/types.js.map +1 -1
  63. package/dist/connection-authorization.d.ts +7 -0
  64. package/dist/connection-authorization.d.ts.map +1 -1
  65. package/dist/connection-authorization.js +1 -1
  66. package/dist/connection-authorization.js.map +1 -1
  67. package/dist/connectors/mcp/index.d.ts +12 -12
  68. package/dist/connectors/mcp/index.d.ts.map +1 -1
  69. package/dist/connectors/mcp/index.js +75 -77
  70. package/dist/connectors/mcp/index.js.map +1 -1
  71. package/dist/connectors/mcp/schema.d.ts +4 -13
  72. package/dist/connectors/mcp/schema.d.ts.map +1 -1
  73. package/dist/connectors/mcp/schema.js +57 -96
  74. package/dist/connectors/mcp/schema.js.map +1 -1
  75. package/dist/connectors/mcp/types.d.ts +17 -51
  76. package/dist/connectors/mcp/types.d.ts.map +1 -1
  77. package/dist/credential-gate.d.ts.map +1 -1
  78. package/dist/credential-gate.js +2 -4
  79. package/dist/credential-gate.js.map +1 -1
  80. package/dist/define-deep-agent.d.ts +7 -5
  81. package/dist/define-deep-agent.d.ts.map +1 -1
  82. package/dist/define-deep-agent.js +13 -17
  83. package/dist/define-deep-agent.js.map +1 -1
  84. package/dist/index.d.ts +7 -3
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +1 -0
  87. package/dist/index.js.map +1 -1
  88. package/dist/managed-composition.d.ts +21 -0
  89. package/dist/managed-composition.d.ts.map +1 -0
  90. package/dist/managed-composition.js +244 -0
  91. package/dist/managed-composition.js.map +1 -0
  92. package/dist/memory/define-memory.d.ts.map +1 -1
  93. package/dist/memory/define-memory.js +4 -5
  94. package/dist/memory/define-memory.js.map +1 -1
  95. package/dist/memory/types.d.ts +18 -3
  96. package/dist/memory/types.d.ts.map +1 -1
  97. package/dist/run-context.d.ts +6 -0
  98. package/dist/run-context.d.ts.map +1 -1
  99. package/dist/run-context.js +1 -0
  100. package/dist/run-context.js.map +1 -1
  101. package/dist/runtime/agent-entry.d.ts +6 -0
  102. package/dist/runtime/agent-entry.d.ts.map +1 -0
  103. package/dist/runtime/agent-entry.js +38 -0
  104. package/dist/runtime/agent-entry.js.map +1 -0
  105. package/dist/runtime/auth.d.ts +3 -6
  106. package/dist/runtime/auth.d.ts.map +1 -1
  107. package/dist/runtime/auth.js +9 -7
  108. package/dist/runtime/auth.js.map +1 -1
  109. package/dist/runtime/backend.d.ts +1 -0
  110. package/dist/runtime/backend.d.ts.map +1 -1
  111. package/dist/runtime/backend.js +9 -6
  112. package/dist/runtime/backend.js.map +1 -1
  113. package/dist/runtime/eval-filesystem.d.ts +4 -2
  114. package/dist/runtime/eval-filesystem.d.ts.map +1 -1
  115. package/dist/runtime/eval-filesystem.js +134 -8
  116. package/dist/runtime/eval-filesystem.js.map +1 -1
  117. package/dist/runtime/identity-runtime.d.ts +6 -8
  118. package/dist/runtime/identity-runtime.d.ts.map +1 -1
  119. package/dist/runtime/identity-runtime.js +12 -8
  120. package/dist/runtime/identity-runtime.js.map +1 -1
  121. package/dist/runtime/index.d.ts +4 -221
  122. package/dist/runtime/index.d.ts.map +1 -1
  123. package/dist/runtime/index.js +164 -48
  124. package/dist/runtime/index.js.map +1 -1
  125. package/dist/runtime/managed-tools.d.ts +7 -9
  126. package/dist/runtime/managed-tools.d.ts.map +1 -1
  127. package/dist/runtime/managed-tools.js +1 -11
  128. package/dist/runtime/managed-tools.js.map +1 -1
  129. package/dist/runtime/memory/index.d.ts +1 -1
  130. package/dist/runtime/memory/index.d.ts.map +1 -1
  131. package/dist/runtime/memory/index.js +1 -1
  132. package/dist/runtime/memory/index.js.map +1 -1
  133. package/dist/runtime/memory/mounts.d.ts +3 -2
  134. package/dist/runtime/memory/mounts.d.ts.map +1 -1
  135. package/dist/runtime/memory/mounts.js +11 -15
  136. package/dist/runtime/memory/mounts.js.map +1 -1
  137. package/dist/runtime/memory/paths.d.ts +1 -0
  138. package/dist/runtime/memory/paths.d.ts.map +1 -1
  139. package/dist/runtime/memory/paths.js +10 -0
  140. package/dist/runtime/memory/paths.js.map +1 -1
  141. package/dist/runtime/memory/policy.d.ts +1 -1
  142. package/dist/runtime/memory/policy.d.ts.map +1 -1
  143. package/dist/runtime/memory/policy.js +6 -2
  144. package/dist/runtime/memory/policy.js.map +1 -1
  145. package/dist/runtime/run-input.d.ts +35 -28
  146. package/dist/runtime/run-input.d.ts.map +1 -1
  147. package/dist/runtime/run-input.js +64 -8
  148. package/dist/runtime/run-input.js.map +1 -1
  149. package/dist/runtime/sandbox-manager.d.ts +14 -2
  150. package/dist/runtime/sandbox-manager.d.ts.map +1 -1
  151. package/dist/runtime/sandbox-manager.js +90 -12
  152. package/dist/runtime/sandbox-manager.js.map +1 -1
  153. package/dist/runtime/schedule-auth.d.ts +51 -0
  154. package/dist/runtime/schedule-auth.d.ts.map +1 -0
  155. package/dist/runtime/schedule-auth.js +180 -0
  156. package/dist/runtime/schedule-auth.js.map +1 -0
  157. package/dist/runtime/selected-skills-backend.d.ts +22 -0
  158. package/dist/runtime/selected-skills-backend.d.ts.map +1 -0
  159. package/dist/runtime/selected-skills-backend.js +238 -0
  160. package/dist/runtime/selected-skills-backend.js.map +1 -0
  161. package/dist/runtime/selected-skills.d.ts +13 -0
  162. package/dist/runtime/selected-skills.d.ts.map +1 -0
  163. package/dist/runtime/selected-skills.js +257 -0
  164. package/dist/runtime/selected-skills.js.map +1 -0
  165. package/dist/runtime/static-entry.d.ts +4 -0
  166. package/dist/runtime/static-entry.d.ts.map +1 -0
  167. package/dist/runtime/static-entry.js +16 -0
  168. package/dist/runtime/static-entry.js.map +1 -0
  169. package/dist/runtime/types.d.ts +6 -8
  170. package/dist/runtime/types.d.ts.map +1 -1
  171. package/dist/runtime-schedules.d.ts +101 -0
  172. package/dist/runtime-schedules.d.ts.map +1 -0
  173. package/dist/runtime-schedules.js +465 -0
  174. package/dist/runtime-schedules.js.map +1 -0
  175. package/dist/sandbox.d.ts +2 -1
  176. package/dist/sandbox.d.ts.map +1 -1
  177. package/dist/sandbox.js.map +1 -1
  178. package/dist/schedule-channel.d.ts +3 -0
  179. package/dist/schedule-channel.d.ts.map +1 -0
  180. package/dist/schedule-channel.js +21 -0
  181. package/dist/schedule-channel.js.map +1 -0
  182. package/dist/schedule-time.d.ts +12 -0
  183. package/dist/schedule-time.d.ts.map +1 -0
  184. package/dist/schedule-time.js +101 -0
  185. package/dist/schedule-time.js.map +1 -0
  186. package/dist/types.d.ts +39 -16
  187. package/dist/types.d.ts.map +1 -1
  188. package/dist/types.js.map +1 -1
  189. package/package.json +10 -10
package/README.md CHANGED
@@ -125,7 +125,38 @@ export const agent = defineDeepAgent({
125
125
  });
126
126
  ```
127
127
 
128
- `defineDeepAgent` requires a static `name` (LangGraph assistant id and default LangSmith deployment name) and otherwise accepts the [`createDeepAgent`](https://reference.langchain.com/javascript/deepagents/agent/createDeepAgent) configuration surface minus the managed keys: `backend`, `store`, `checkpointer`, `memory`, `skills`, and `systemPrompt`. Those are provided by the managed runtime when your agent is deployed. Write the system prompt in `instructions.md` next to `agent.ts`; the CLI embeds it at deploy time.
128
+ `defineDeepAgent` requires `name` and supports the [`createDeepAgent`](https://reference.langchain.com/javascript/deepagents/agent/createDeepAgent) options except the platform-owned `backend`, `store`, `checkpointer`, `systemPrompt`, and `memory` fields. Static agents use `instructions.md` and all discovered skills.
129
+
130
+ Export a sync or async factory as `agent` to select configuration per run:
131
+
132
+ ```ts
133
+ import { defineDeepAgent, type ManagedServerRuntime } from "managed-deepagents";
134
+
135
+ export function agent(runtime: ManagedServerRuntime) {
136
+ const ctx = runtime.executionRuntime?.context ?? {};
137
+ return defineDeepAgent({
138
+ name: "support",
139
+ model: "tier" in ctx && ctx.tier === "fast" ? "openai:gpt-5-mini" : "openai:gpt-5.5",
140
+ });
141
+ }
142
+ ```
143
+
144
+ The factory can select tools, middleware, instructions, skills, MCP definitions,
145
+ a sandbox, and memory. Omitted selections use project resources. `null` disables
146
+ an instruction, skill, MCP, sandbox, or memory selection for that run. Empty
147
+ strings and arrays remain explicit selections. Select memory with `defineMemory(...)`;
148
+ selected memory cannot use `allow`. Root `memory.ts` remains the fallback.
149
+
150
+ On direct runs, `executionRuntime.context` is application context or `undefined`.
151
+ On channel runs, it is `undefined`; read delivery data from `runtime.channel`.
152
+ `ManagedServerRuntime<AppContext>` preserves the application's context type.
153
+ `accessContext` identifies the Agent Server operation that called the factory.
154
+ During inspection, `executionRuntime` is `null`. Keep the factory repeatable and
155
+ preserve graph structure and schemas. MDA skips managed resource reads and
156
+ allocation. Context is application data; tools must check authorization.
157
+
158
+ `mda build` reads the inline literal `name` without calling the factory. Install
159
+ all model integrations the factory can select.
129
160
 
130
161
  To authenticate SDK and API requests with a LangSmith workspace key while
131
162
  retaining MDA's thread and store authorization, declare it explicitly:
@@ -159,8 +190,9 @@ DMs (`context.channel.rawEvent.channel_type == "im"`). Shared conversations,
159
190
  missing event data, and direct API runs get no user mount unless an authored
160
191
  policy allows it.
161
192
 
162
- Either layer can use a sync or async `allow(context)` callback to replace its
163
- default policy:
193
+ For compatibility, an autodiscovered root declaration can still use a sync or
194
+ async `allow(context)` callback to replace its default policy. `allow` is
195
+ deprecated; prefer selecting memory from a dynamic agent:
164
196
 
165
197
  ```ts
166
198
  export const memory = defineMemory<{ remember: boolean }>({
@@ -206,7 +238,7 @@ current channel delivery:
206
238
 
207
239
  ```text
208
240
  runtime
209
- .context // Application data, or { channel: … } for managed channels
241
+ .context // Application data on direct runs
210
242
  .serverInfo // Trusted caller and server information
211
243
  .channel // Present for a managed channel delivery
212
244
  .name // Configured channel name
@@ -226,30 +258,25 @@ await client.runs.create(threadId, assistantId, {
226
258
  });
227
259
  ```
228
260
 
229
- Direct API runs use your authored `contextSchema`. Managed channel runs instead
230
- use MDA's Zod context schema and receive `{ channel: … }`, including the current
231
- event and reply routing data. Your application's required context fields do not
232
- apply to channel runs. Tools, middleware, and memory policies that handle both
233
- run sources must account for both context shapes.
234
-
235
- The factory selects the schema from the authenticated run source and passes it
236
- to LangGraph. Context follows native LangGraph validation and parsing behavior;
237
- MDA does not replace context during execution. Supplying a `channel` field in a
261
+ Direct API runs use your authored `contextSchema` and native LangGraph context
262
+ validation. On channel runs, tools and authored factories receive `undefined`
263
+ as context. Native middleware receives an empty context. Use
264
+ `runtime.channel.event` for the typed event and `runtime.channel.rawEvent` for
265
+ optional provider data. The application schema stays on the graph, but its
266
+ required fields do not apply to channel runs. Supplying a `channel` field in a
238
267
  direct API call does not establish a trusted channel source.
239
268
 
240
- `ManagedChannelContext`, `ChannelContext`, and their Zod schemas
241
- (`managedChannelContextSchema`, `channelContextSchema`) are exported by
242
- `managed-deepagents`. Middleware follows native context filtering; declare its
243
- context schema when its hooks need `context.channel`.
244
-
245
- MDA prepares context and memory access in the graph factory for each run or
246
- resume. Native Node Agent Server must pass the current run's `context` to that
247
- factory. Direct callers of the managed compiler must build a fresh graph with
248
- the execution's context; a compiled graph is scoped to that execution.
269
+ Agent Server passes the current delivery to MDA through its `context` input.
270
+ MDA resolves the verified channel before it calls the authored factory and
271
+ removes delivery data before native graph execution. MDA prepares memory access
272
+ in the graph factory for each run or resume. Direct callers of the managed
273
+ compiler must build a fresh graph with the execution's context; a compiled graph
274
+ is scoped to that execution.
249
275
 
250
276
  `runtime.channel` describes the current verified delivery. It is absent on
251
277
  ordinary API and schedule runs. Its facts are available even when the channel
252
- cannot send. `post` uses the verified reply target from `context.channel`.
278
+ cannot send. `post` uses a private, verified reply target. The channel helper
279
+ does not expose the target or let callers replace it.
253
280
 
254
281
  ```ts
255
282
  if (runtime.channel?.post) {
@@ -266,7 +293,7 @@ wrapper. The `runtime.channel` helper has no `address`, `update`, or destination
266
293
  A post sends an additional message; the normal final agent reply remains automatic.
267
294
 
268
295
  Managed Slack channels save incoming files under `/workspace/attachments/` and
269
- add `attach_file(path)` so the agent can attach completed workspace files
296
+ add `upload_files(paths)` so the agent can attach completed workspace files
270
297
  to its reply. This requires a managed sandbox.
271
298
  On each message, the runtime also checks up to five pages of Slack thread history
272
299
  for files, requesting 100 messages per page. This requires the bot's history scope
@@ -295,6 +322,14 @@ when available. Its `link.status` currently reports `not_required`; it does not
295
322
  perform an account-link lookup. Its source thread identifier retains the existing
296
323
  provider-thread/LangGraph-thread fallback behavior.
297
324
 
325
+ ## Tool and middleware runtime types
326
+
327
+ Use `ManagedToolRuntime<State, Context>` for tools and tool-call hooks. Use
328
+ `ManagedRuntime<Context>` for lifecycle and model hooks. These types preserve
329
+ native fields and your declared context type. `ManagedDeepAgentRuntime` is an
330
+ alias for the tool type. MDA adds `serverInfo`, `channel`, and `backend`; channel
331
+ and backend are optional.
332
+
298
333
  ## HTTP channels
299
334
 
300
335
  Use `channels.http({ provider, verify, parse, post })` for a provider webhook.
@@ -306,8 +341,9 @@ to use Trigger.
306
341
  A message returned by `parse` contains `userId`, `threadId`, `content`, and `target`.
307
342
  `threadId` is the stable LangGraph thread UUID. `target` is separate JSON that the
308
343
  adapter needs to reply, such as a Photon conversation ID or a Slack channel and
309
- thread timestamp. MDA exposes this target at `runtime.context.channel.target`
310
- and binds it to `runtime.channel.post`; `post` receives the target for reply routing.
344
+ thread timestamp. MDA keeps this target private and binds it to
345
+ `runtime.channel.post`. The adapter's `post` callback receives the target for
346
+ reply routing.
311
347
 
312
348
  `verify` runs first with the original bytes and headers. `verify` and `parse`
313
349
  each get a separately readable request body. `parse` owns body decoding and can
@@ -316,13 +352,11 @@ result. MDA creates `runtime.channel.event` from the parsed message.
316
352
 
317
353
  To expose provider data, return
318
354
  `{ type: "message", message, rawEvent: event }` from `parse`. MDA validates this
319
- value as finite, acyclic JSON and copies it into `runtime.channel.rawEvent` and
320
- `runtime.context.channel.rawEvent`. If you omit `rawEvent`, it stays absent;
321
- MDA does not decode the body again. An explicit `null` is a valid event value.
355
+ value as finite, acyclic JSON and copies it into `runtime.channel.rawEvent`.
356
+ If you omit `rawEvent`, it stays absent. MDA does not decode the body again.
357
+ An explicit `null` is a valid event value.
322
358
 
323
- HTTP runs use the same managed Zod context schema as Slack Trigger runs. Memory
324
- policies receive `allow(context)` and can read the delivery at `context.channel`.
325
- Direct API runs continue to use the authored context schema.
359
+ HTTP and Slack Trigger runs expose delivery through `runtime.channel`.
326
360
 
327
361
  The optional method has this signature:
328
362
 
@@ -414,6 +448,45 @@ live. Declarations must be statically serializable literals or top-level
414
448
  constants; prompt schedules become user-message input, and stateless runs clean
415
449
  up their temporary thread after completion.
416
450
 
451
+ ### Runtime schedules
452
+
453
+ Use `schedules` in a tool or middleware to create schedules while the agent runs.
454
+ Each schedule belongs to the current user or to the agent. You can list, get,
455
+ update, and delete the schedules of an owner.
456
+
457
+ ```ts
458
+ import { schedules } from "managed-deepagents";
459
+
460
+ const owner = { type: "user" } as const;
461
+ const item = await schedules.create({
462
+ owner,
463
+ cron: "0 9 * * 1-5",
464
+ timezone: "America/Los_Angeles",
465
+ prompt: "Review my tasks.",
466
+ });
467
+ const page = await schedules.list({ owner });
468
+ await schedules.update(item.id, { paused: true }, { owner });
469
+ await schedules.delete(item.id, { owner });
470
+ ```
471
+
472
+ To run a schedule once, give `at` in place of `cron`.
473
+
474
+ ```ts
475
+ await schedules.create({
476
+ owner,
477
+ at: new Date(Date.now() + 60 * 60_000),
478
+ prompt: "Remind me to check the deploy.",
479
+ });
480
+ ```
481
+
482
+ Set `newThread` to choose whether a run starts a new thread or continues the
483
+ current thread. When a schedule is created from a channel such as Slack,
484
+ each run posts its final answer to that channel. Runtime schedules stay when you deploy again.
485
+
486
+ A run started by a schedule cannot create schedules, so a schedule cannot
487
+ replicate itself. It can still list, get, update, and delete schedules, for
488
+ example to reschedule or remove the schedule that started it.
489
+
417
490
  ## Sandbox
418
491
 
419
492
  `mda init` scaffolds `sandbox/index.ts` with a LangSmith sandbox. MDA only
@@ -436,9 +509,9 @@ Authored tools and middleware can use the Deep Agents backend interface at
436
509
  `runtime.backend`. It is `undefined` when the project has no sandbox:
437
510
 
438
511
  ```ts
439
- import type { ManagedDeepAgentRuntime } from "managed-deepagents";
512
+ import type { ManagedToolRuntime } from "managed-deepagents";
440
513
 
441
- async function writeReport(runtime: ManagedDeepAgentRuntime) {
514
+ async function writeReport(runtime: ManagedToolRuntime) {
442
515
  if (!runtime.backend) throw new Error("This tool requires a sandbox");
443
516
  const result = await runtime.backend.write("/workspace/report.txt", "Report ready");
444
517
  if (result.error) throw new Error(result.error);
@@ -524,9 +597,16 @@ deployment, so the command refuses to create one before `mda deploy`.
524
597
  workspace.
525
598
 
526
599
  Use `includeTools` or `excludeTools` inside a server config to select a subset.
527
- Tool names are raw MCP tool names before the managed `{server}__` prefix is
600
+ Tool names are raw MCP tool names before the managed `{server}_` prefix is
528
601
  applied, so `includeTools: ["search"]` on server `langchainDocs` exposes
529
- `langchainDocs__search` when prefixing is enabled.
602
+ `langchainDocs_search` when prefixing is enabled.
603
+
604
+ ### Migration from 0.8
605
+
606
+ - `mcpServers` → `servers`, and `type` → `transport`.
607
+ - Remove `useStandardContentBlocks`.
608
+ - `reconnect` and `automaticSSEFallback` now need `mode: "legacy"`.
609
+ - `HttpMcpServerConfig`, `SseMcpServerConfig`, and `RemoteMcpServerBaseConfig` → `RemoteMcpServerConfig`.
530
610
 
531
611
  ## Connections in the sandbox proxy
532
612
 
@@ -0,0 +1,6 @@
1
+ import type { ManagedServerRuntime } from "./runtime/types.js";
2
+ import type { DeepAgentDefinition } from "./types.js";
3
+ /** Resolve one managed agent definition for a server invocation. */
4
+ export type AgentFactory<TDefinition extends DeepAgentDefinition = DeepAgentDefinition> = (runtime: ManagedServerRuntime) => TDefinition | Promise<TDefinition>;
5
+ export type AgentEntry = DeepAgentDefinition | AgentFactory;
6
+ //# sourceMappingURL=agent-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-entry.d.ts","sourceRoot":"","sources":["../src/agent-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,oEAAoE;AACpE,MAAM,MAAM,YAAY,CACtB,WAAW,SAAS,mBAAmB,GAAG,mBAAmB,IAC3D,CAAC,OAAO,EAAE,oBAAoB,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAE1E,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-entry.js","sourceRoot":"","sources":["../src/agent-entry.ts"],"names":[],"mappings":""}
@@ -1,9 +1,14 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
1
2
  import type { ChannelMessagingAdapter } from "./runtime.js";
2
3
  import type { ChannelInfo, RuntimeChannel } from "./types.js";
3
4
  import { type ChannelContext } from "../run-context.js";
4
5
  export declare const SLACK_BOT_TOKEN_ENV = "SLACK_BOT_TOKEN";
5
6
  /** The serializable channel data sent by managed ingress. */
6
7
  export type ChannelBinding = ChannelContext;
8
+ export declare const currentChannelBinding: AsyncLocalStorage<{
9
+ binding?: ChannelBinding;
10
+ channelRun: boolean;
11
+ }>;
7
12
  /** Validate delivery context against the authenticated source and declared channel. */
8
13
  export declare function resolveChannelBinding(context: unknown, configurable: Record<string, unknown> | undefined): ChannelBinding | undefined;
9
14
  export declare function resolveChannelInfo(context: unknown, configurable: Record<string, unknown> | undefined): ChannelInfo | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../src/channels/binding.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAO5D,OAAO,KAAK,EAAE,WAAW,EAAa,cAAc,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9E,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,6DAA6D;AAC7D,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC;AAiB5C,uFAAuF;AACvF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAChD,cAAc,GAAG,SAAS,CAsB5B;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAChD,WAAW,GAAG,SAAS,CAGzB;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACjD,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,uBAAuB,GAAG,SAAS,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AC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAChD,MAAM,GAAG,SAAS,CAYpB"}
@@ -1,5 +1,6 @@
1
1
  /** Serializable current-delivery authority, installed only by managed ingress. */
2
2
  import { z } from "zod";
3
+ import { AsyncLocalStorage } from "node:async_hooks";
3
4
  import { channelInfo, createRuntimeChannel } from "./runtime.js";
4
5
  import { isJsonValue } from "./message-schema.js";
5
6
  import { channelProviderForName, messagingTransportForName, } from "./messaging-registry.js";
@@ -7,6 +8,7 @@ import { createTriggerClient } from "./trigger/client.js";
7
8
  import { createTriggerTransport } from "./trigger/transport.js";
8
9
  import { channelContextSchema } from "../run-context.js";
9
10
  export const SLACK_BOT_TOKEN_ENV = "SLACK_BOT_TOKEN";
11
+ export const currentChannelBinding = new AsyncLocalStorage();
10
12
  function record(value) {
11
13
  return value !== null && typeof value === "object" && !Array.isArray(value);
12
14
  }
@@ -19,7 +21,8 @@ const triggerTargetSchema = z.object({
19
21
  });
20
22
  /** Validate delivery context against the authenticated source and declared channel. */
21
23
  export function resolveChannelBinding(context, configurable) {
22
- const raw = record(context) ? context.channel : undefined;
24
+ const raw = (record(context) ? context.channel : undefined) ??
25
+ currentChannelBinding.getStore()?.binding;
23
26
  const parsed = channelContextSchema.safeParse(raw);
24
27
  if (!parsed.success)
25
28
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/channels/binding.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EACL,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAA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AC;AAED,uFAAuF;AACvF,MAAM,UAAU,sBAAsB,CACpC,YAAiD;IAEjD,MAAM,IAAI,GAAG,YAAY,EAAE,mBAAmB,CAAC;IAC/C,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7D,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,QAAQ,GAAI,IAA0C;SACzD,mBAAmB,CAAC;IACvB,OAAO,QAAQ,KAAK,SAAS;QAC3B,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,OAAO,QAAQ,KAAK,QAAQ;YAC5B,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,SAAS,CAAC;AAClB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/http/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAEL,KAAK,OAAO,EAEb,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAyBpE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/http/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAEL,KAAK,OAAO,EAEb,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CA+BpE"}
@@ -9,7 +9,11 @@ export function httpChannel(adapter) {
9
9
  const post = adapter.post?.bind(adapter);
10
10
  if (post) {
11
11
  hide(channel, "messaging", () => ({
12
- post: ({ message, target }) => post(immutableCopy({ ...message, target })),
12
+ post: ({ message, target, newThread }) => post(immutableCopy({
13
+ ...message,
14
+ target,
15
+ ...(newThread === undefined ? {} : { newThread }),
16
+ })),
13
17
  }));
14
18
  }
15
19
  hide(channel, "requirements", (name) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/channels/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgC,MAAM,eAAe,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EACL,aAAa,GAGd,MAAM,0BAA0B,CAAC;AAalC,MAAM,UAAU,WAAW,CAAC,OAA2B;IACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC;IAElD,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAyB,EAAE,EAAE,CACpD,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,CAChC,CAAC;IACF,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,IAAI,EAAE,CAAC;QACT,IAAI,CAAC,OAAO,EAA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AI,KAAK,CAAC,GAAG,KAAK,6BAA6B,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,IAAI,CAAC,MAAc,EAAE,GAAoB,EAAE,KAAc;IAChE,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AACnE,CAAC"}
@@ -19,6 +19,8 @@ export type HttpChannelParseResult = {
19
19
  /** MDA adds the verified reply target to the validated message. */
20
20
  export type HttpChannelPostInput = ChannelMessage & {
21
21
  target: JsonValue;
22
+ /** Scheduled posts: start a new thread when true; keep the target unchanged. */
23
+ newThread?: boolean;
22
24
  };
23
25
  export interface HttpPostedMessage {
24
26
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/channels/http/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7E,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,MAAM,sBAAsB,GAC9B;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,yBAAyB,CAAC;IACnC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE5C,mEAAmE;AACnE,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAE1E,MAAM,WAAW,iBAAiB;I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AAM,oBAAoB,GAAG,cAAc,GAAG;IAClD,MAAM,EAAE,SAAS,CAAC;IAClB,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,iEAAiE;IACjE,KAAK,CACH,OAAO,EAAE,kBAAkB,GAC1B,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC5D,IAAI,CAAC,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC/D,OAAO,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC;CACrB"}
@@ -5,10 +5,12 @@
5
5
  * GitHub) are mounted / collected. `resolveRuntimeChannel` and schedule
6
6
  * delivery look up transports by file-stem name.
7
7
  */
8
+ import type { JsonObject } from "./manifest.js";
8
9
  import type { ChannelMessagingAdapter } from "./runtime.js";
9
10
  import type { Channel } from "../runtime/channel.js";
10
11
  import type { Connector } from "../runtime/connector.js";
11
12
  export declare function channelProviderForName(name: string): string | undefined;
13
+ export declare function channelProviderConfigForName(name: string): JsonObject | undefined;
12
14
  /** Register messaging factories from collected channels. */
13
15
  export declare function registerChannelMessaging(channels: readonly Channel[]): void;
14
16
  /** Register messaging factories from collected connectors (e.g. GitHub). */
@@ -1 +1 @@
1
- {"version":3,"file":"messaging-registry.d.ts","sourceRoot":"","sources":["../../src/channels/messaging-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAezD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AA0BD,4DAA4D;AAC5D,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAE3E;AAED,4EAA4E;AAC5E,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,IAAI,CAEN;AAED,gEAAgE;AAChE,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,uBAAuB,GAAG,SAAS,CAErC"}
1
+ {"version":3,"file":"messaging-registry.d.ts","sourceRoot":"","sources":["../../src/channels/messaging-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAmBzD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,GACX,UAAU,GAAG,SAAS,CAExB;AA+BD,4DAA4D;AAC5D,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAE3E;AAED,4EAA4E;AAC5E,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,IAAI,CAEN;AAED,gEAAgE;AAChE,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,uBAAuB,GAAG,SAAS,CAErC"}
@@ -7,9 +7,13 @@
7
7
  */
8
8
  import { registerDeclaredSourceProviders } from "./source-providers.js";
9
9
  const providerByName = new Map();
10
+ const providerConfigByName = new Map();
10
11
  export function channelProviderForName(name) {
11
12
  return providerByName.get(name);
12
13
  }
14
+ export function channelProviderConfigForName(name) {
15
+ return providerConfigByName.get(name);
16
+ }
13
17
  const byName = new Map();
14
18
  function registerMessagingSources(sources) {
15
19
  registerDeclaredSourceProviders(sources);
@@ -31,6 +35,12 @@ function registerMessagingSources(sources) {
31
35
  if (requirements?.provider) {
32
36
  providerByName.set(source.name, requirements.provider);
33
37
  }
38
+ if (requirements?.providerConfig) {
39
+ providerConfigByName.set(source.name, requirements.providerConfig);
40
+ }
41
+ else {
42
+ providerConfigByName.delete(source.name);
43
+ }
34
44
  }
35
45
  }
36
46
  /** Register messaging factories from collected channels. */
@@ -1 +1 @@
1
- {"version":3,"file":"messaging-registry.js","sourceRoot":"","sources":["../../src/channels/messaging-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAgBxE,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEjD,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAA4B,CAAC;AAEnD,SAAS,wBAAwB,CAAC,OAAmC;IACnE,+BAA+B,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,IAAI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M,CAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,YAAY,EAAE,cAAc,EAAE,CAAC;YACjC,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;QACrE,CAAC;aAAM,CAAC;YACN,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,wBAAwB,CAAC,QAA4B;IACnE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,0BAA0B,CACxC,UAAgC;IAEhC,wBAAwB,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,yBAAyB,CACvC,IAAY,EACZ,GAAG,GAAsB,OAAO,CAAC,GAAG;IAEpC,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Resolve the emoji the agent reacts with when it picks up an inbound message.
3
+ *
4
+ * The reaction is a courtesy and must never fail a run or delay a reply, so a
5
+ * chooser that throws, hangs, or answers with something that is not an emoji
6
+ * short name yields {@link DEFAULT_REACTION_EMOJI} instead. Returning `null`
7
+ * skips the reaction.
8
+ */
9
+ /** The default reaction, and the fallback whenever a chooser does not answer. */
10
+ export declare const DEFAULT_REACTION_EMOJI = "eyes";
11
+ /** What a chooser is told about the message it is reacting to. */
12
+ export interface ReactionContext {
13
+ /** The inbound message text. Attacker-controlled; treat it as data. */
14
+ readonly text: string;
15
+ }
16
+ /**
17
+ * Picks the emoji for one inbound message, or `null` for none. May be sync or async.
18
+ *
19
+ * A sync chooser runs on the event loop, where the timeout cannot stop it, so
20
+ * do slow work in an async one.
21
+ */
22
+ export type ReactionChooser = (context: ReactionContext) => string | null | Promise<string | null>;
23
+ /**
24
+ * How a channel reacts: `true` with the default, `false` not at all, a short
25
+ * name always that emoji, or a function per message.
26
+ */
27
+ export type ReactionChoice = boolean | string | ReactionChooser;
28
+ /** Whether `value` is a usable emoji short name. */
29
+ export declare function isEmojiName(value: unknown): value is string;
30
+ /** Resolve the reaction for one message. Never throws. */
31
+ export declare function resolveReactionEmoji(choice: Exclude<ReactionChoice, false>, context: ReactionContext): Promise<string | null>;
32
+ //# sourceMappingURL=reactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactions.d.ts","sourceRoot":"","sources":["../../src/channels/reactions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,iFAAiF;AACjF,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAa7C,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,eAAe,KACrB,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,eAAe,CAAC;AAEhE,oDAAoD;AACpD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE3D;AAED,0DAA0D;AAC1D,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,EACtC,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BxB"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Resolve the emoji the agent reacts with when it picks up an inbound message.
3
+ *
4
+ * The reaction is a courtesy and must never fail a run or delay a reply, so a
5
+ * chooser that throws, hangs, or answers with something that is not an emoji
6
+ * short name yields {@link DEFAULT_REACTION_EMOJI} instead. Returning `null`
7
+ * skips the reaction.
8
+ */
9
+ import { logger } from "../runtime/log.js";
10
+ /** The default reaction, and the fallback whenever a chooser does not answer. */
11
+ export const DEFAULT_REACTION_EMOJI = "eyes";
12
+ /**
13
+ * Slack emoji short name, without the surrounding colons.
14
+ *
15
+ * Well-formedness is all that can be checked here; whether Slack knows the
16
+ * name is Slack's to say, and it rejects an unknown one by doing nothing.
17
+ */
18
+ const EMOJI_NAME = /^[a-z0-9+-][a-z0-9_+-]{0,59}$/;
19
+ /** How long a chooser may take before the default is used instead. */
20
+ const CHOOSER_TIMEOUT_MS = 5_000;
21
+ /** Whether `value` is a usable emoji short name. */
22
+ export function isEmojiName(value) {
23
+ return typeof value === "string" && EMOJI_NAME.test(value);
24
+ }
25
+ /** Resolve the reaction for one message. Never throws. */
26
+ export async function resolveReactionEmoji(choice, context) {
27
+ if (typeof choice === "string") {
28
+ return isEmojiName(choice) ? choice : DEFAULT_REACTION_EMOJI;
29
+ }
30
+ if (typeof choice !== "function")
31
+ return DEFAULT_REACTION_EMOJI;
32
+ let timer;
33
+ try {
34
+ const chosen = await Promise.race([
35
+ Promise.resolve(choice(context)),
36
+ new Promise((_, reject) => {
37
+ timer = setTimeout(() => reject(new Error(`timed out after ${CHOOSER_TIMEOUT_MS}ms`)), CHOOSER_TIMEOUT_MS);
38
+ }),
39
+ ]);
40
+ if (chosen === null || isEmojiName(chosen))
41
+ return chosen;
42
+ logger.warn("Channel reaction chooser did not answer with an emoji short name; using the default.");
43
+ }
44
+ catch (error) {
45
+ logger.warn(`Channel reaction chooser failed (${logger.safeErrorLabel(error)}); using the default.`);
46
+ }
47
+ finally {
48
+ if (timer !== undefined)
49
+ clearTimeout(timer);
50
+ }
51
+ return DEFAULT_REACTION_EMOJI;
52
+ }
53
+ //# sourceMappingURL=reactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactions.js","sourceRoot":"","sources":["../../src/chann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AsF,CACvF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CACT,oCAAoC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,uBAAuB,CACxF,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,IAAI,KAAK,KAAK,SAAS;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { createMiddleware } from "langchain";
2
2
  export declare const CHANNEL_RESPONSE_FORMAT_MIDDLEWARE_NAME = "mda-channel-response-format";
3
3
  export declare const SLACK_MARKDOWN_INSTRUCTIONS: string;
4
+ export declare const SLACK_CONVERSATION_INSTRUCTIONS: string;
4
5
  export declare function createChannelResponseFormatMiddleware(): ReturnType<typeof createMiddleware>;
5
6
  //# sourceMappingURL=response-format.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"response-format.d.ts","sourceRoot":"","sources":["../../src/channels/response-format.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAOhE,eAAO,MAAM,uCAAuC,gCACrB,CAAC;AAEhC,eAAO,MAAM,2BAA2B,QAGV,CAAC;AAkC/B,wBAAgB,qCAAqC,IAAI,UAAU,CACjE,OAAO,gBAAgB,CACxB,CAWA"}
1
+ {"version":3,"file":"response-format.d.ts","sourceRoot":"","sources":["../../src/channels/response-format.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAUhE,eAAO,MAAM,uCAAuC,gCACrB,CAAC;AAEhC,eAAO,MAAM,2BAA2B,QAGV,CAAC;AAE/B,eAAO,MAAM,+BAA+B,QAGF,CAAC;AAsD3C,wBAAgB,qCAAqC,IAAI,UAAU,CACjE,OAAO,gBAAgB,CACxB,CAuBA"}
@@ -1,10 +1,23 @@
1
1
  import { SystemMessage } from "@langchain/core/messages";
2
2
  import { createMiddleware } from "langchain";
3
+ import { resolveChannelBinding } from "./binding.js";
4
+ import { channelProviderConfigForName } from "./messaging-registry.js";
3
5
  import { resolveRuntimeConfigurable, } from "../runtime/identity-runtime.js";
4
6
  export const CHANNEL_RESPONSE_FORMAT_MIDDLEWARE_NAME = "mda-channel-response-format";
5
7
  export const SLACK_MARKDOWN_INSTRUCTIONS = "<channel_response_format>\n" +
6
8
  "Write your final response using standard Markdown. In prose, format URLs as explicit Markdown links, such as [label](https://example.com), or autolinks, such as <https://example.com>, rather than bare URLs. Preserve literal URLs inside code.\n" +
7
9
  "</channel_response_format>";
10
+ export const SLACK_CONVERSATION_INSTRUCTIONS = "Mention another Slack agent as <@USER_ID> on each message that needs its reply. " +
11
+ "Use its verified Slack user ID; a name or thread reply alone is insufficient. " +
12
+ "The recipient must allow bot triggers.";
13
+ function slackConversationInstructions(allowBotTriggers) {
14
+ const behavior = allowBotTriggers
15
+ ? "Bot triggers are enabled. Reply to bot messages only when they request action. " +
16
+ "Finish completed tasks without another bot mention."
17
+ : "Bot triggers are disabled. Bot messages cannot trigger you, even with a mention. " +
18
+ "You can message another agent, but its reply cannot start your next turn.";
19
+ return `<slack_conversation>\n${SLACK_CONVERSATION_INSTRUCTIONS}\n${behavior}\n</slack_conversation>`;
20
+ }
8
21
  function sourceProvider(request) {
9
22
  const configurable = resolveRuntimeConfigurable(request.runtime);
10
23
  const user = configurable?.langgraph_auth_user;
@@ -19,13 +32,21 @@ function systemMessageBlocks(request) {
19
32
  }
20
33
  return Array.isArray(existing) ? existing : [];
21
34
  }
22
- function appendSlackMarkdownInstructions(request) {
35
+ function appendSlackInstructions(request, allowBotTriggers) {
23
36
  return {
24
37
  ...request,
25
38
  systemMessage: new SystemMessage({
26
39
  content: [
27
40
  ...systemMessageBlocks(request),
28
41
  { type: "text", text: SLACK_MARKDOWN_INSTRUCTIONS },
42
+ ...(allowBotTriggers !== undefined
43
+ ? [
44
+ {
45
+ type: "text",
46
+ text: slackConversationInstructions(allowBotTriggers),
47
+ },
48
+ ]
49
+ : []),
29
50
  ],
30
51
  }),
31
52
  };
@@ -34,9 +55,14 @@ export function createChannelResponseFormatMiddleware() {
34
55
  return createMiddleware({
35
56
  name: CHANNEL_RESPONSE_FORMAT_MIDDLEWARE_NAME,
36
57
  async wrapModelCall(request, handler) {
37
- return handler(sourceProvider(request) === "slack"
38
- ? appendSlackMarkdownInstructions(request)
39
- : request);
58
+ if (sourceProvider(request) !== "slack")
59
+ return handler(request);
60
+ const binding = resolveChannelBinding(request.runtime.context, resolveRuntimeConfigurable(request.runtime));
61
+ const config = binding
62
+ ? channelProviderConfigForName(binding.name)
63
+ : undefined;
64
+ const allowBotTriggers = config?.allowBotTriggers;
65
+ return handler(appendSlackInstructions(request, typeof allowBotTriggers === "boolean" ? allowBotTriggers : undefined));
40
66
  },
41
67
  });
42
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"response-format.js","sourceRoot":"","sources":["../../src/channels/response-format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAEhE,OAAO,EACL,0BAA0B,GAE3B,MAAM,gCAAgC,CAAC;AAExC,MAAM,CAAC,MAAM,uCAAuC,GAClD,6BAA6B,CAAC;AAEhC,MAAM,CAAC,MAAM,2BAA2B,GACtC,6BAA6B;IAC7B,qPAAqP;IACrP,4BAA4B,CAAC;AAI/B,SAAS,cAAc,CAAC,OAAqB;IAC3C,MAAM,YAAY,GAAG,0BAA0B,CAC7C,OAAO,CAAC,OAAuC,CAChD,CAAC;IACF,MAAM,IAAI,GAAG,YAAY,EAAE,mBAAmB,CAAC;IAC/C,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QACrC,CAAC,CAAE,IAA0C,CAAC,mBAAmB;QACjE,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAC,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