@desplega.ai/agent-swarm 1.148.0 → 1.149.1

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 (191) hide show
  1. package/README.md +2 -1
  2. package/dist/{acp-adapter-grez7xhd.js → acp-adapter-vhkzfpjg.js} +12 -5
  3. package/dist/{actions-kweznh5a.js → actions-9d2694yk.js} +10 -9
  4. package/dist/{app-5fvvjv9m.js → app-fq2ggynt.js} +6 -6
  5. package/dist/{assistant-40m4w50s.js → assistant-edb6n9nn.js} +13 -11
  6. package/dist/{boot-reembed-9rxmb26n.js → boot-reembed-msweabbp.js} +8 -8
  7. package/dist/{boot-reembed-cn357y5n.js → boot-reembed-q5wd3tha.js} +7 -7
  8. package/dist/{boot-scrub-logs-5tpp0x3y.js → boot-scrub-logs-3g1az933.js} +5 -5
  9. package/dist/{claude-adapter-9pz5q2pb.js → claude-adapter-v3rnzsdc.js} +9 -9
  10. package/dist/{claude-managed-adapter-sactwn31.js → claude-managed-adapter-qvsmh6mv.js} +2 -2
  11. package/dist/{claude-sdk-session-v8w0s7qm.js → claude-sdk-session-qxrpsna1.js} +9 -9
  12. package/dist/{cli-cdjezzc7.js → cli-01g3x1ca.js} +8 -5
  13. package/dist/{cli-y6b6fb76.js → cli-08b07b4r.js} +1 -1
  14. package/dist/{cli-8fc8de14.js → cli-0z2v4nhw.js} +1 -1
  15. package/dist/{cli-qy6h009w.js → cli-1c94wvcw.js} +7 -6
  16. package/dist/{cli-kpv03zhj.js → cli-3apbzgyk.js} +27 -15
  17. package/dist/{cli-dk3me3qs.js → cli-3sysyjve.js} +8 -8
  18. package/dist/{cli-kzvhgvk3.js → cli-3z634pqe.js} +3 -3
  19. package/dist/{cli-n9grk3yd.js → cli-4260r1tg.js} +37 -26
  20. package/dist/{cli-d8brzxjb.js → cli-4wtq5jjv.js} +2 -2
  21. package/dist/{cli-0amc6myn.js → cli-5m0qmvdp.js} +1 -1
  22. package/dist/{cli-ct0et58h.js → cli-5my3bjsd.js} +1 -1
  23. package/dist/{cli-cn6mmc7f.js → cli-6664w7y4.js} +1 -1
  24. package/dist/{cli-hzhhrt7b.js → cli-6skz3rk8.js} +1 -1
  25. package/dist/{cli-v3e51x7w.js → cli-73gq0zxn.js} +3 -3
  26. package/dist/{cli-9216xm24.js → cli-7evafqvy.js} +20 -20
  27. package/dist/{cli-56y3hch2.js → cli-7fehefdf.js} +133 -22
  28. package/dist/{cli-hp2est46.js → cli-7xx10h0a.js} +3 -3
  29. package/dist/{cli-n2cwscdd.js → cli-9br8ypfv.js} +2 -2
  30. package/dist/{cli-7gn7c2af.js → cli-ayvy5kde.js} +1 -1
  31. package/dist/{cli-dcem3pr1.js → cli-cd60fv6j.js} +2 -2
  32. package/dist/{cli-p73drk6p.js → cli-cv7s5zdq.js} +167 -40
  33. package/dist/{cli-f8j56xv2.js → cli-ddfw1mc4.js} +53 -13
  34. package/dist/{cli-anedxf1w.js → cli-e06a8a7y.js} +1 -1
  35. package/dist/{cli-tebsjpk7.js → cli-hzqmgcm2.js} +2 -2
  36. package/dist/{cli-xqcpg1st.js → cli-j4d4f6hv.js} +1 -1
  37. package/dist/{cli-rvqz34y5.js → cli-jecc01cb.js} +1 -1
  38. package/dist/{cli-5khqvvnq.js → cli-jezx9b9c.js} +2 -2
  39. package/dist/{cli-m1p5cysp.js → cli-k351hv5k.js} +3 -3
  40. package/dist/{cli-6s2y152y.js → cli-qgd4sqz5.js} +286 -11
  41. package/dist/{cli-xqcq9y5e.js → cli-r2ap2czm.js} +1 -0
  42. package/dist/{cli-hz8xhefy.js → cli-sdzq01t9.js} +4 -4
  43. package/dist/{cli-0er5m69z.js → cli-svbrpf5q.js} +4 -4
  44. package/dist/{cli-brxyat7h.js → cli-tg8qj8ee.js} +5 -5
  45. package/dist/{cli-ztn0ga15.js → cli-wby1xnnb.js} +1 -1
  46. package/dist/{cli-0b6y7kxm.js → cli-xm87hzbw.js} +1 -1
  47. package/dist/{cli-3n7cbfjn.js → cli-y3pq4v9g.js} +6 -2
  48. package/dist/{cli-m9sxbkhm.js → cli-zvz62chv.js} +3 -3
  49. package/dist/cli.js +14 -14
  50. package/dist/{codex-adapter-ehhj2qwc.js → codex-adapter-jyw7a91z.js} +4 -4
  51. package/dist/{codex-hook-bw8p5nh4.js → codex-hook-hfrt9shr.js} +2 -2
  52. package/dist/{codex-session-runner-5hne566k.js → codex-session-runner-bmngj0s5.js} +4 -4
  53. package/dist/{commands-xnvh951h.js → commands-n755g391.js} +5 -5
  54. package/dist/{db-ycr5zfr4.js → db-s1cgh5gv.js} +5 -5
  55. package/dist/{e2b-6hb103d8.js → e2b-p04vmtx0.js} +1 -1
  56. package/dist/{handlers-1vt77kgq.js → handlers-nsg0bcye.js} +14 -11
  57. package/dist/{hook-91ntpmff.js → hook-h9cqrm8q.js} +7 -7
  58. package/dist/{hook-qfwjydvn.js → hook-jf0xe8zh.js} +8 -8
  59. package/dist/{http-h6g7bv5b.js → http-nc6pydw5.js} +96 -45
  60. package/dist/{index-d2mytx95.js → index-0wdy6gwc.js} +13 -13
  61. package/dist/{index-antf9t4p.js → index-769nc012.js} +14 -14
  62. package/dist/{index-47ghesbn.js → index-ezxkds2n.js} +575 -152
  63. package/dist/{index-0ez2aack.js → index-x1zcj09z.js} +15 -15
  64. package/dist/{keepalive-c4sp7yvd.js → keepalive-nesm3xb6.js} +7 -7
  65. package/dist/{lead-4r7z9e8v.js → lead-bwy6t2za.js} +32 -32
  66. package/dist/{maintenance-yqjfdjas.js → maintenance-8w393zf0.js} +8 -8
  67. package/dist/{oauth-refresh-sweep-wtqgnh3c.js → oauth-refresh-sweep-sh8xjy08.js} +6 -6
  68. package/dist/{onboard-a4krmh46.js → onboard-25ps29h1.js} +4 -3
  69. package/dist/{opencode-adapter-fef1mrn2.js → opencode-adapter-dce4wskd.js} +2 -2
  70. package/dist/{otel-impl-725kq0vp.js → otel-impl-b93gxnz5.js} +2 -2
  71. package/dist/{pi-mono-adapter-2has4gnp.js → pi-mono-adapter-zvshk5cj.js} +2 -2
  72. package/dist/{pricing-refresh-kqxd7w9h.js → pricing-refresh-5v56x7gb.js} +7 -7
  73. package/dist/{rbac-roles-t3wygpth.js → rbac-roles-0p0s6pbj.js} +6 -6
  74. package/dist/{rbac-roles-gws5xej6.js → rbac-roles-x55cnezn.js} +5 -5
  75. package/dist/{render-v2-x1wxvn51.js → render-v2-hyd45w8b.js} +6 -6
  76. package/dist/{seed-pricing-t6y8d0vf.js → seed-pricing-49gbgn96.js} +6 -6
  77. package/dist/{setup-x50py6xg.js → setup-qvq64vzq.js} +2 -2
  78. package/dist/{worker-zsz0qfxk.js → worker-scj60cxg.js} +32 -32
  79. package/dist/{x-n2phr5vm.js → x-n3e0v3xa.js} +2 -2
  80. package/openapi.json +46 -4
  81. package/package.json +1 -1
  82. package/src/agentmail/handlers.ts +5 -0
  83. package/src/automation-preflight-alert.ts +41 -0
  84. package/src/be/automation-preflight.ts +3 -3
  85. package/src/be/budget-refusal-notify.ts +1 -0
  86. package/src/be/db/tasks/read.ts +5 -0
  87. package/src/be/db.ts +132 -2
  88. package/src/be/migrations/150_deferred_task_waits.sql +18 -0
  89. package/src/be/migrations/151_repair_scheduled_task_required_params.sql +39 -0
  90. package/src/be/migrations/152_routing_decisions.sql +44 -0
  91. package/src/be/scripts/typecheck.ts +33 -22
  92. package/src/be/seed/automation-toggle.ts +69 -0
  93. package/src/be/seed/schedules-seeder.ts +28 -6
  94. package/src/be/seed/workflows-seeder.ts +18 -6
  95. package/src/be/seed-scripts/catalog/delegate.ts +5 -1
  96. package/src/be/seed-skills/bundled-files.generated.json +10 -0
  97. package/src/be/seed-skills/index.ts +3 -0
  98. package/src/be/steering.ts +1 -0
  99. package/src/be/swarm-config-guard.ts +12 -0
  100. package/src/commands/onboard/steps/post-task.tsx +1 -0
  101. package/src/github/handlers.ts +9 -0
  102. package/src/gitlab/handlers.ts +4 -0
  103. package/src/heartbeat/heartbeat.ts +8 -0
  104. package/src/http/approval-requests.ts +1 -0
  105. package/src/http/apps.ts +1 -0
  106. package/src/http/config.ts +15 -6
  107. package/src/http/mcp.ts +31 -4
  108. package/src/http/script-runs.ts +6 -0
  109. package/src/http/tasks.ts +52 -30
  110. package/src/integrations/kapso/inbound.ts +1 -0
  111. package/src/jira/sync.ts +2 -0
  112. package/src/linear/sync.ts +2 -0
  113. package/src/prompts/session-templates.ts +29 -15
  114. package/src/scheduler/deferred-task-waits.ts +123 -0
  115. package/src/scheduler/schedule-task.ts +42 -0
  116. package/src/scheduler/scheduler.ts +22 -31
  117. package/src/script-workflows/workflow-ctx.ts +2 -0
  118. package/src/scripts-runtime/types/stdlib.d.ts +38 -24
  119. package/src/scripts-runtime/types/swarm-sdk.d.ts +38 -24
  120. package/src/server.ts +10 -1
  121. package/src/slack/actions.ts +1 -0
  122. package/src/slack/assistant.ts +2 -0
  123. package/src/slack/handlers.ts +3 -0
  124. package/src/slack/thread-buffer.ts +2 -0
  125. package/src/tasks/worker-follow-up.ts +9 -0
  126. package/src/tests/acp-adapter.test.ts +35 -6
  127. package/src/tests/acp-session-token.test.ts +67 -0
  128. package/src/tests/asset-key-api.test.ts +15 -2
  129. package/src/tests/asset-key-mcp.test.ts +2 -0
  130. package/src/tests/automation-preflight-alert.test.ts +91 -0
  131. package/src/tests/claude-worker-parity.test.ts +3 -0
  132. package/src/tests/config-session-auth.test.ts +143 -0
  133. package/src/tests/defer-task.test.ts +117 -6
  134. package/src/tests/deferred-task-wake.test.ts +456 -0
  135. package/src/tests/heartbeat-reroute-decision.test.ts +1 -0
  136. package/src/tests/http-api-integration.test.ts +33 -4
  137. package/src/tests/model-control.test.ts +18 -5
  138. package/src/tests/opencode-adapter.test.ts +2 -2
  139. package/src/tests/promote-draft-task-route.test.ts +4 -0
  140. package/src/tests/prompt-template-session.test.ts +13 -4
  141. package/src/tests/rbac-wire-e2e.test.ts +2 -2
  142. package/src/tests/routing-decision-persistence.test.ts +520 -0
  143. package/src/tests/routing-reason-contract.test.ts +89 -0
  144. package/src/tests/routing-reason-inventory.test.ts +55 -0
  145. package/src/tests/schedule-target-type.test.ts +48 -1
  146. package/src/tests/scheduled-task-required-params-migration.test.ts +182 -0
  147. package/src/tests/scheduled-tasks.test.ts +9 -5
  148. package/src/tests/script-connections.test.ts +4 -0
  149. package/src/tests/script-runs-http.test.ts +31 -0
  150. package/src/tests/scripts-typecheck.test.ts +11 -0
  151. package/src/tests/secret-scrubber.test.ts +12 -0
  152. package/src/tests/seed-registry.test.ts +2 -2
  153. package/src/tests/seed-schedules.test.ts +99 -3
  154. package/src/tests/seed-workflows.test.ts +74 -0
  155. package/src/tests/send-task-output-schema.test.ts +66 -1
  156. package/src/tests/send-task-requested-by.test.ts +1 -0
  157. package/src/tests/send-task-slack-routing-guard.test.ts +2 -0
  158. package/src/tests/store-progress-blocked-waiting-gate.test.ts +151 -0
  159. package/src/tests/swarm-tool-result-gate.test.ts +24 -0
  160. package/src/tests/task-tool-manifest.test.ts +47 -0
  161. package/src/tests/task-tool-preload-mcp.test.ts +125 -0
  162. package/src/tests/task-tools-ctx.test.ts +2 -0
  163. package/src/tests/tool-output-agent-id.test.ts +1 -0
  164. package/src/tests/ui-followup-lead-delegation.test.ts +6 -1
  165. package/src/tests/workflow-agent-task.test.ts +24 -1
  166. package/src/tests/workflow-engine-v2.test.ts +58 -2
  167. package/src/tools/defer-task.ts +73 -21
  168. package/src/tools/send-task.ts +31 -0
  169. package/src/tools/skills/skill-publish.ts +1 -0
  170. package/src/tools/store-progress.ts +43 -0
  171. package/src/tools/templates.ts +2 -1
  172. package/src/tools/utils.ts +33 -2
  173. package/src/types.ts +14 -1
  174. package/src/utils/acp-session-token.ts +14 -4
  175. package/src/utils/secret-scrubber.ts +2 -0
  176. package/src/utils/task-tool-manifest.ts +33 -0
  177. package/src/workflows/engine.ts +4 -1
  178. package/src/workflows/executors/agent-task.ts +7 -1
  179. package/templates/ai-toolbox.manifest.json +6 -1
  180. package/templates/schedules/daily-blocker-digest/config.json +6 -1
  181. package/templates/schedules/daily-compounding-reflection/config.json +1 -0
  182. package/templates/schedules/daily-status-report/config.json +6 -1
  183. package/templates/schedules/daily-swarm-update-check/config.json +19 -0
  184. package/templates/schedules/daily-swarm-update-check/content.md +49 -0
  185. package/templates/schedules/daily-workflow-health-audit/config.json +6 -1
  186. package/templates/skills/comms/config.json +18 -0
  187. package/templates/skills/comms/content.md +74 -0
  188. package/templates/skills/comms/files/references/ste-rules.md +73 -0
  189. package/templates/skills/comms/files/references/visual-shapes.md +112 -0
  190. package/templates/skills/swarm-scripts/SKILL.md +3 -2
  191. package/templates/skills/swarm-scripts/content.md +3 -2
@@ -10,7 +10,7 @@ import {
10
10
  init_templates,
11
11
  matchesDefaultClaudeMd,
12
12
  matchesDefaultIdentityMd
13
- } from "./cli-y6b6fb76.js";
13
+ } from "./cli-08b07b4r.js";
14
14
  import {
15
15
  configureDbResolver,
16
16
  getAllTemplateDefinitions,
@@ -20,7 +20,7 @@ import {
20
20
  init_steering_enabled,
21
21
  isSteeringEnabled,
22
22
  registerTemplate
23
- } from "./cli-kpv03zhj.js";
23
+ } from "./cli-3apbzgyk.js";
24
24
  import {
25
25
  MAX_PROFILE_FILE_LENGTH,
26
26
  init_constants
@@ -41,6 +41,7 @@ import {
41
41
  _enum,
42
42
  array,
43
43
  boolean,
44
+ exports_external,
44
45
  object,
45
46
  string,
46
47
  union
@@ -48,12 +49,12 @@ import {
48
49
  import {
49
50
  init_package,
50
51
  package_default
51
- } from "./cli-anedxf1w.js";
52
+ } from "./cli-e06a8a7y.js";
52
53
  import {
53
54
  init_secret_scrubber,
54
55
  registerVolatileSecret,
55
56
  scrubSecrets
56
- } from "./cli-xqcq9y5e.js";
57
+ } from "./cli-r2ap2czm.js";
57
58
  import {
58
59
  init_bus,
59
60
  realtimeBus
@@ -2186,7 +2187,7 @@ function resolveTaskModelSelection(opts) {
2186
2187
  function isTerminalTaskStatus(status) {
2187
2188
  return TERMINAL_TASK_STATUSES.includes(status);
2188
2189
  }
2189
- var AssetKeySchema, AssetEntityTypeSchema, AssetProviderRefSchema, AssetKeyMappingSchema, AssetSummarySchema, ModelTierSchema, MODEL_TIERS, ReasoningEffortSchema, LEGACY_MODEL_TO_TIER, DEFAULT_MODEL_TIER_MAP, AgentTaskStatusSchema, TERMINAL_TASK_STATUSES, InboxMessageStatusSchema, InboxMessageSchema, AgentTaskSourceSchema, ProviderNameSchema, SteerModeSchema, SteeringStatusSchema, SteeringSourceSchema, SteeringMessageSchema, SteerOutcomeSchema, OnUnsupportedSchema, SteerResultSchema, PROVIDER_STEER_CAPABILITIES, FollowUpConfigSchema, RoutingAffinitySchema, AgentTaskSchema, CreateTaskOptionsSchema, TaskAttachmentKindSchema, SERVER_GENERATED_ATTACHMENT_CAPABILITY = "_agentSwarmGeneratedBy", attachmentCapabilitiesSchema, attachmentCommonFields, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, UserCommsPrefsSchema, IdentityEventTypeSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, FavoriteItemTypeSchema, UserFavoriteSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentAvatarSchema, AgentSchema, AgentCredStatusLiveTestSchema, AgentLatestModelSchema, AgentBedrockStatusSchema, AcpSessionConfigSelectValueSchema, AcpSessionConfigSelectGroupSchema, AcpSessionConfigOptionSchema, AgentAcpStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, ChangeSourceSchema, VersionableFieldSchema, ContextVersionSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, AgentLogEventTypeSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostSourceSchema, SessionCostModelBreakdownSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, AutomationIntegrationIdSchema, ScheduledTaskTargetTypeSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, REPO_GUIDELINES_MAX_ENTRIES = 50, RepoGuidelinesInputSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RuntimeInstanceStatusSchema, RuntimeInstanceSchema, RetryPolicySchema, ExecutorMetaSchema, ValidationResultSchema, StepValidationConfigSchema, SwarmScriptNodeConfigSchema, WorkflowNodeSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, WebhookVerificationSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowTemplateSchema, WorkflowSnapshotSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSnapshotSchema, PageSchema, PageVersionSchema, MetricParamSchema, MetricVariableTypeSchema, MetricFormatSchema, MetricVisualizationSchema, MetricQuerySchema, MetricVariableSchema, MetricVizConfigSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSnapshotSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunKindSchema, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepStatusSchema, WorkflowRunStepSchema, WaitModeSchema, WaitStateStatusSchema, WaitStateRowSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, ScriptApiAuthModeSchema, ScriptApiRecordSchema, SkillTypeSchema, SkillScopeSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpServerTransportSchema, McpServerScopeSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KV_NAME_REGEX, KvNamespaceSchema, KvKeySchema, KvEntrySchema;
2190
+ var AssetKeySchema, AssetEntityTypeSchema, AssetProviderRefSchema, AssetKeyMappingSchema, AssetSummarySchema, ModelTierSchema, MODEL_TIERS, ReasoningEffortSchema, LEGACY_MODEL_TO_TIER, DEFAULT_MODEL_TIER_MAP, AgentTaskStatusSchema, TERMINAL_TASK_STATUSES, InboxMessageStatusSchema, InboxMessageSchema, AgentTaskSourceSchema, RoutingReasonSchema, ProviderNameSchema, SteerModeSchema, SteeringStatusSchema, SteeringSourceSchema, SteeringMessageSchema, SteerOutcomeSchema, OnUnsupportedSchema, SteerResultSchema, PROVIDER_STEER_CAPABILITIES, FollowUpConfigSchema, RoutingAffinitySchema, AgentTaskSchema, CreateTaskOptionsSchema, TaskAttachmentKindSchema, SERVER_GENERATED_ATTACHMENT_CAPABILITY = "_agentSwarmGeneratedBy", attachmentCapabilitiesSchema, attachmentCommonFields, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, UserCommsPrefsSchema, IdentityEventTypeSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, FavoriteItemTypeSchema, UserFavoriteSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentAvatarSchema, AgentSchema, AgentCredStatusLiveTestSchema, AgentLatestModelSchema, AgentBedrockStatusSchema, AcpSessionConfigSelectValueSchema, AcpSessionConfigSelectGroupSchema, AcpSessionConfigOptionSchema, AgentAcpStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, ChangeSourceSchema, VersionableFieldSchema, ContextVersionSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, AgentLogEventTypeSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostSourceSchema, SessionCostModelBreakdownSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, AutomationIntegrationIdSchema, ScheduledTaskTargetTypeSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, REPO_GUIDELINES_MAX_ENTRIES = 50, RepoGuidelinesInputSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RuntimeInstanceStatusSchema, RuntimeInstanceSchema, RetryPolicySchema, ExecutorMetaSchema, ValidationResultSchema, StepValidationConfigSchema, SwarmScriptNodeConfigSchema, WorkflowNodeSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, WebhookVerificationSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowTemplateSchema, WorkflowSnapshotSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSnapshotSchema, PageSchema, PageVersionSchema, MetricParamSchema, MetricVariableTypeSchema, MetricFormatSchema, MetricVisualizationSchema, MetricQuerySchema, MetricVariableSchema, MetricVizConfigSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSnapshotSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunKindSchema, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepStatusSchema, WorkflowRunStepSchema, WaitModeSchema, WaitStateStatusSchema, WaitStateRowSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, ScriptApiAuthModeSchema, ScriptApiRecordSchema, SkillTypeSchema, SkillScopeSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpServerTransportSchema, McpServerScopeSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KV_NAME_REGEX, KvNamespaceSchema, KvKeySchema, KvEntrySchema;
2190
2191
  var init_types = __esm(() => {
2191
2192
  init_key();
2192
2193
  init_constants();
@@ -2342,6 +2343,13 @@ var init_types = __esm(() => {
2342
2343
  "linear",
2343
2344
  "jira"
2344
2345
  ]);
2346
+ RoutingReasonSchema = exports_zod.enum([
2347
+ "skill",
2348
+ "continuity",
2349
+ "overflow",
2350
+ "human_pinned",
2351
+ "reroute_fault"
2352
+ ]);
2345
2353
  ProviderNameSchema = exports_zod.enum([
2346
2354
  "claude",
2347
2355
  "codex",
@@ -2416,6 +2424,8 @@ var init_types = __esm(() => {
2416
2424
  title: exports_zod.string().optional(),
2417
2425
  status: AgentTaskStatusSchema,
2418
2426
  source: AgentTaskSourceSchema.default("mcp"),
2427
+ routingReason: RoutingReasonSchema.optional(),
2428
+ routingNote: exports_zod.string().max(200).optional(),
2419
2429
  taskType: exports_zod.string().max(50).optional(),
2420
2430
  tags: exports_zod.array(exports_zod.string()).default([]),
2421
2431
  priority: exports_zod.number().int().min(0).max(100).default(50),
@@ -2486,6 +2496,8 @@ var init_types = __esm(() => {
2486
2496
  agentId: exports_zod.string().nullable().optional(),
2487
2497
  creatorAgentId: exports_zod.string().optional(),
2488
2498
  source: AgentTaskSourceSchema.optional(),
2499
+ routingReason: RoutingReasonSchema.optional(),
2500
+ routingNote: exports_zod.string().max(200).optional(),
2489
2501
  taskType: exports_zod.string().max(50).optional(),
2490
2502
  tags: exports_zod.array(exports_zod.string()).optional(),
2491
2503
  priority: exports_zod.number().int().min(0).max(100).optional(),
@@ -3182,7 +3194,7 @@ var init_types = __esm(() => {
3182
3194
  id: exports_zod.string().describe("Unique node identifier, used in 'next' and 'inputs' mappings"),
3183
3195
  type: exports_zod.string().describe("Executor type: 'agent-task', 'script', 'swarm-script', 'raw-llm', 'validate', 'property-match'"),
3184
3196
  label: exports_zod.string().optional().describe("Human-readable label for UI display"),
3185
- config: exports_zod.record(exports_zod.string(), exports_zod.unknown()).describe("Executor-specific config. For agent-task: { template, outputSchema?, agentId?, tags?, priority?, dir?, vcsRepo?, model? }. " + "For script: { runtime, script, args?, timeout? }. " + "For swarm-script: { scriptName, scope?, pinHash?, args?, fsMode?, timeoutMs? (1000-300000) }. " + "Agent-task templates and ordinary config values support {{interpolation}} from the node's inputs context, including trigger and declared upstream aliases. " + "SECURITY: executable source for script/swarm-script nodes does not interpolate trigger.* or upstream node outputs; only input/workflow/swarm/run values are allowed in inline script source, and named swarm-script source is not workflow-interpolated. " + "Pass dynamic values through config.args instead (inline script receives them as argv; swarm-script receives its args object). " + "NOTE: config.outputSchema on agent-task nodes validates the AGENT's raw JSON output, " + "while node-level outputSchema validates the EXECUTOR's return value ({taskId, taskOutput})."),
3197
+ config: exports_zod.record(exports_zod.string(), exports_zod.unknown()).describe("Executor-specific config. For agent-task: { template, outputSchema?, agentId?, routingReason?, routingNote?, tags?, priority?, dir?, vcsRepo?, model? }; configured agentId defaults routingReason to human_pinned. " + "For script: { runtime, script, args?, timeout? }. " + "For swarm-script: { scriptName, scope?, pinHash?, args?, fsMode?, timeoutMs? (1000-300000) }. " + "Agent-task templates and ordinary config values support {{interpolation}} from the node's inputs context, including trigger and declared upstream aliases. " + "SECURITY: executable source for script/swarm-script nodes does not interpolate trigger.* or upstream node outputs; only input/workflow/swarm/run values are allowed in inline script source, and named swarm-script source is not workflow-interpolated. " + "Pass dynamic values through config.args instead (inline script receives them as argv; swarm-script receives its args object). " + "NOTE: config.outputSchema on agent-task nodes validates the AGENT's raw JSON output, " + "while node-level outputSchema validates the EXECUTOR's return value ({taskId, taskOutput})."),
3186
3198
  next: exports_zod.union([exports_zod.string(), exports_zod.array(exports_zod.string()), exports_zod.record(exports_zod.string(), exports_zod.string())]).optional().describe("Next node(s): string for simple chaining, string[] for fan-out to parallel nodes, or record for port-based routing ({pass: 'a', fail: 'b'})"),
3187
3199
  validation: StepValidationConfigSchema.optional(),
3188
3200
  retry: RetryPolicySchema.optional(),
@@ -5184,6 +5196,7 @@ Use the crashed agent's identity above as context for who was on it and what kin
5184
5196
 
5185
5197
  Dispatch via \`send-task\` with ALL of:
5186
5198
  - an explicit \`agentId\` (the chosen worker) — REQUIRED. If you omit it, \`send-task\` auto-routes to the original task's agent, which is the dead worker, and the work re-strands.
5199
+ - \`routingReason: "reroute_fault"\`
5187
5200
  - \`taskType: "resume"\`
5188
5201
  - the tag \`resume-generation:{{generation_next}}\`
5189
5202
  - \`parentTaskId: {{original_task_id}}\`
@@ -5225,7 +5238,7 @@ Required capabilities: {{required_capabilities}}{{artifacts_block}}
5225
5238
 
5226
5239
  This task has been sitting unassigned because no currently-registered agent matches its required role/capabilities. Pick an agent to take this work over and RE-DELEGATE it — do NOT execute it yourself.
5227
5240
 
5228
- Dispatch via \`send-task\` with an explicit \`agentId\` (REQUIRED — omitting it re-pools the work under the same affinity tag and it will starve again) and \`parentTaskId: {{original_task_id}}\`.
5241
+ Dispatch via \`send-task\` with an explicit \`agentId\` (REQUIRED — omitting it re-pools the work under the same affinity tag and it will starve again), \`routingReason: "overflow"\`, and \`parentTaskId: {{original_task_id}}\`.
5229
5242
 
5230
5243
  This work will NOT fall back to the unassigned pool — you are the only re-delegation path.`,
5231
5244
  variables: [
@@ -5896,6 +5909,8 @@ function rowToAgentTask(row) {
5896
5909
  title: row.title ?? undefined,
5897
5910
  status: row.status,
5898
5911
  source: row.source,
5912
+ routingReason: row.routing_reason ?? undefined,
5913
+ routingNote: row.routing_note ?? undefined,
5899
5914
  taskType: row.taskType ?? undefined,
5900
5915
  tags: row.tags ? JSON.parse(row.tags) : [],
5901
5916
  priority: row.priority ?? 50,
@@ -7130,6 +7145,7 @@ async function getTaskSteeringFields(task) {
7130
7145
  async function promoteSteeringToTask(task, message) {
7131
7146
  return await createTaskExtended(message.body, {
7132
7147
  agentId: task.agentId,
7148
+ routingReason: task.agentId ? "continuity" : undefined,
7133
7149
  creatorAgentId: message.createdByAgentId,
7134
7150
  source: message.source === "script" ? "api" : message.source,
7135
7151
  taskType: "follow-up",
@@ -7288,6 +7304,177 @@ var init_reaction_shortcode = __esm(() => {
7288
7304
  SLACK_REACTION_SHORTCODE_PATTERN = /^[a-z0-9_+'-]+(::skin-tone-[2-6])?$/;
7289
7305
  });
7290
7306
 
7307
+ // src/tools/tool-config.ts
7308
+ var CORE_TOOLS, DEFERRED_TOOLS, ALL_TOOLS;
7309
+ var init_tool_config = __esm(() => {
7310
+ CORE_TOOLS = new Set([
7311
+ "join-swarm",
7312
+ "my-agent-info",
7313
+ "poll-task",
7314
+ "get-task-details",
7315
+ "store-progress",
7316
+ "task-action",
7317
+ "send-task",
7318
+ "get-tasks",
7319
+ "defer-task",
7320
+ "memory-search",
7321
+ "memory-get",
7322
+ "memory-store",
7323
+ "memory-delete",
7324
+ "memory_rate",
7325
+ "get-swarm",
7326
+ "script-run",
7327
+ "db-query",
7328
+ "kv-get",
7329
+ "script-query-types",
7330
+ "get-repos",
7331
+ "accept-steer",
7332
+ "memory-edit",
7333
+ "script-search",
7334
+ "steer-task",
7335
+ "kv-list",
7336
+ "get-config"
7337
+ ]);
7338
+ DEFERRED_TOOLS = new Set([
7339
+ "list-schedules",
7340
+ "create-schedule",
7341
+ "update-schedule",
7342
+ "patch-schedule",
7343
+ "delete-schedule",
7344
+ "run-schedule-now",
7345
+ "create-workflow",
7346
+ "list-workflows",
7347
+ "get-workflow",
7348
+ "update-workflow",
7349
+ "patch-workflow",
7350
+ "patch-workflow-node",
7351
+ "delete-workflow",
7352
+ "trigger-workflow",
7353
+ "list-workflow-runs",
7354
+ "get-workflow-run",
7355
+ "retry-workflow-run",
7356
+ "cancel-workflow-run",
7357
+ "register-service",
7358
+ "unregister-service",
7359
+ "list-services",
7360
+ "update-service-status",
7361
+ "set-config",
7362
+ "list-config",
7363
+ "delete-config",
7364
+ "credential-bindings",
7365
+ "script-connections",
7366
+ "update-repo",
7367
+ "update-profile",
7368
+ "context-history",
7369
+ "context-diff",
7370
+ "read-messages",
7371
+ "post-message",
7372
+ "slack-reply",
7373
+ "slack-read",
7374
+ "slack-upload-file",
7375
+ "slack-download-file",
7376
+ "slack-list-channels",
7377
+ "slack-post",
7378
+ "slack-start-thread",
7379
+ "slack-create-channel",
7380
+ "slack-invite-to-channel",
7381
+ "slack-archive-channel",
7382
+ "slack-delete",
7383
+ "slack-update",
7384
+ "create-channel",
7385
+ "delete-channel",
7386
+ "list-channels",
7387
+ "register-agentmail-inbox",
7388
+ "register-kapso-number",
7389
+ "unregister-kapso-number",
7390
+ "send-whatsapp-message",
7391
+ "reply-whatsapp-message",
7392
+ "tracker-status",
7393
+ "get-oauth-access-token",
7394
+ "tracker-link-task",
7395
+ "tracker-unlink",
7396
+ "tracker-sync-status",
7397
+ "tracker-map-agent",
7398
+ "list-prompt-templates",
7399
+ "get-prompt-template",
7400
+ "set-prompt-template",
7401
+ "delete-prompt-template",
7402
+ "preview-prompt-template",
7403
+ "create_metric",
7404
+ "request-human-input",
7405
+ "skill-create",
7406
+ "skill-update",
7407
+ "skill-delete",
7408
+ "skill-get",
7409
+ "skill-get-file",
7410
+ "skill-list",
7411
+ "skill-search",
7412
+ "skill-install",
7413
+ "skill-uninstall",
7414
+ "skill-install-remote",
7415
+ "skill-sync-remote",
7416
+ "skill-publish",
7417
+ "mcp-server-create",
7418
+ "mcp-server-delete",
7419
+ "mcp-server-get",
7420
+ "mcp-server-install",
7421
+ "mcp-server-list",
7422
+ "mcp-server-uninstall",
7423
+ "mcp-server-update",
7424
+ "resolve-user",
7425
+ "manage-user",
7426
+ "app-get",
7427
+ "app-list",
7428
+ "app-patch",
7429
+ "app-query",
7430
+ "app-sync",
7431
+ "app-upsert",
7432
+ "app-history",
7433
+ "app-diff",
7434
+ "app-rollback",
7435
+ "create_page",
7436
+ "delete-page",
7437
+ "kv-set",
7438
+ "kv-delete",
7439
+ "kv-incr",
7440
+ "room-get",
7441
+ "room-change",
7442
+ "room-reset",
7443
+ "room-decode",
7444
+ "script-upsert",
7445
+ "script-delete",
7446
+ "script-apis",
7447
+ "launch-script-run",
7448
+ "get-script-run",
7449
+ "list-script-runs",
7450
+ "swarm_x",
7451
+ "cancel-task",
7452
+ "inject-learning",
7453
+ "get-metrics"
7454
+ ]);
7455
+ ALL_TOOLS = new Set([...CORE_TOOLS, ...DEFERRED_TOOLS]);
7456
+ });
7457
+
7458
+ // src/utils/task-tool-manifest.ts
7459
+ function parseTaskToolManifest(value) {
7460
+ return taskToolManifestSchema.parse(JSON.parse(value));
7461
+ }
7462
+ function selectTaskTools(manifest, task) {
7463
+ const fromSchedule = task.scheduleId && Object.hasOwn(manifest.schedules ?? {}, task.scheduleId) ? manifest.schedules?.[task.scheduleId] : undefined;
7464
+ const fromType = task.taskType && Object.hasOwn(manifest.taskTypes ?? {}, task.taskType) ? manifest.taskTypes?.[task.taskType] : undefined;
7465
+ return [...new Set(fromSchedule ?? fromType ?? [])].filter((name) => !name.startsWith("slack-") || Boolean(task.slackChannelId));
7466
+ }
7467
+ var toolNames, taskToolManifestSchema;
7468
+ var init_task_tool_manifest = __esm(() => {
7469
+ init_zod();
7470
+ init_tool_config();
7471
+ toolNames = exports_external.array(exports_external.string().refine((name) => ALL_TOOLS.has(name), "Unknown swarm tool")).max(16);
7472
+ taskToolManifestSchema = exports_external.strictObject({
7473
+ taskTypes: exports_external.record(exports_external.string().min(1).max(50), toolNames).optional(),
7474
+ schedules: exports_external.record(exports_external.uuid(), toolNames).optional()
7475
+ });
7476
+ });
7477
+
7291
7478
  // src/be/swarm-config-guard.ts
7292
7479
  function isReservedConfigKey(key) {
7293
7480
  return RESERVED_KEYS.has(key.toUpperCase());
@@ -7370,6 +7557,7 @@ var RESERVED_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_T
7370
7557
  var init_swarm_config_guard = __esm(() => {
7371
7558
  init_reaction_shortcode();
7372
7559
  init_types();
7560
+ init_task_tool_manifest();
7373
7561
  RESERVED_KEYS = new Set(["API_KEY", "SECRETS_ENCRYPTION_KEY", "CORS_ALLOW_ANY_ORIGIN"]);
7374
7562
  BOOLEAN_LITERALS = ["true", "false", "1", "0"];
7375
7563
  DB_RETENTION_TUNING_BOUNDS = {
@@ -7378,6 +7566,16 @@ var init_swarm_config_guard = __esm(() => {
7378
7566
  DB_RETENTION_MAX_STATEMENT_MS: { min: 25, max: 5000 }
7379
7567
  };
7380
7568
  VALIDATED_KEYS = {
7569
+ TASK_TOOL_MANIFESTS: (value) => {
7570
+ try {
7571
+ if (typeof value !== "string")
7572
+ throw new Error("Expected JSON string");
7573
+ parseTaskToolManifest(value);
7574
+ return null;
7575
+ } catch {
7576
+ return "Invalid TASK_TOOL_MANIFESTS (expected JSON with taskTypes and/or schedules maps, each selecting at most 16 known swarm tools)";
7577
+ }
7578
+ },
7381
7579
  FEEDBACK_ENDPOINT: (value) => {
7382
7580
  if (typeof value !== "string") {
7383
7581
  return "Invalid FEEDBACK_ENDPOINT (must use HTTPS, or HTTP on a loopback host)";
@@ -7454,6 +7652,7 @@ var init_swarm_config_guard = __esm(() => {
7454
7652
  "HEARTBEAT_PIN_CRASH_RESUME",
7455
7653
  "POOL_AFFINITY_ENFORCEMENT",
7456
7654
  "SCRIPTS_ONLY_MCP",
7655
+ "TASK_TOOL_PRELOAD_ENABLED",
7457
7656
  "SLACK_DISABLE",
7458
7657
  "SLACK_RENDER_V2",
7459
7658
  "SLACK_RENDER_V2_DELEGATION",
@@ -7465,6 +7664,7 @@ var init_swarm_config_guard = __esm(() => {
7465
7664
  "ADDITIVE_SLACK",
7466
7665
  "SLACK_THREAD_FOLLOWUP_REQUIRE_MENTION",
7467
7666
  "RBAC_ENABLED",
7667
+ "SEED_AUTOMATIONS_ENABLED",
7468
7668
  "RBAC_AUDIT_DISABLED",
7469
7669
  "BUDGET_ADMISSION_DISABLED",
7470
7670
  "MCP_OAUTH_ALLOW_PRIVATE_HOSTS",
@@ -9041,6 +9241,51 @@ async function findRecentSimilarTasks(opts) {
9041
9241
  const rows = await getDbClient().query(query, params);
9042
9242
  return rows.map(rowToAgentTask);
9043
9243
  }
9244
+ async function findLatestRoutingCandidate(where, params) {
9245
+ const row = await getDbClient().get(`SELECT id AS taskId, ${ROUTING_HOLDER_SQL} AS agentId
9246
+ FROM agent_tasks
9247
+ WHERE ${where}
9248
+ AND ${ROUTING_HOLDER_SQL} IN (SELECT id FROM agents WHERE isLead = 0)
9249
+ ORDER BY createdAt DESC, rowid DESC
9250
+ LIMIT 1`, params);
9251
+ return row ?? null;
9252
+ }
9253
+ async function captureRoutingDecisionSnapshot(options) {
9254
+ const workerStatuses = await getDbClient().query(`SELECT agent.id AS agentId, agent.status,
9255
+ COUNT(task.id) AS openTaskCount,
9256
+ SUM(CASE WHEN task.status IN ('in_progress', 'reviewing') THEN 1 ELSE 0 END) AS activeTaskCount
9257
+ FROM agents agent
9258
+ LEFT JOIN agent_tasks task ON
9259
+ (task.agentId = agent.id OR task.offeredTo = agent.id)
9260
+ AND task.status NOT IN ('completed', 'failed', 'cancelled', 'superseded')
9261
+ WHERE agent.isLead = 0
9262
+ GROUP BY agent.id, agent.status
9263
+ ORDER BY agent.id`);
9264
+ const samePr = options.vcsRepo && options.vcsNumber != null ? await findLatestRoutingCandidate("vcsRepo = ? AND vcsNumber = ?", [
9265
+ options.vcsRepo,
9266
+ options.vcsNumber
9267
+ ]) : null;
9268
+ let sameThread = null;
9269
+ if (options.slackChannelId && options.slackThreadTs) {
9270
+ sameThread = await findLatestRoutingCandidate("slackChannelId = ? AND slackThreadTs = ?", [
9271
+ options.slackChannelId,
9272
+ options.slackThreadTs
9273
+ ]);
9274
+ } else if (options.agentmailThreadId) {
9275
+ sameThread = await findLatestRoutingCandidate("agentmailThreadId = ?", [
9276
+ options.agentmailThreadId
9277
+ ]);
9278
+ }
9279
+ const sameRepo = options.vcsRepo ? await findLatestRoutingCandidate("vcsRepo = ?", [options.vcsRepo]) : null;
9280
+ return {
9281
+ capturedAt: new Date().toISOString(),
9282
+ workerStatuses,
9283
+ continuityCandidates: { samePr, sameThread, sameRepo }
9284
+ };
9285
+ }
9286
+ function logRoutingDecisionFailure(taskId, stage, error) {
9287
+ console.warn(`[routing-decision] Failed to ${stage} snapshot for task ${taskId}:`, scrubSecrets(error instanceof Error ? error.message : String(error)));
9288
+ }
9044
9289
  async function createTaskExtended(task, options) {
9045
9290
  if (typeof task !== "string" || task.trim().length === 0) {
9046
9291
  throw new Error("createTaskExtended: 'task' must be a non-empty string");
@@ -9213,8 +9458,14 @@ async function createTaskExtended(task, options) {
9213
9458
  const existingTrackerWork = options?.bypassTrackerContextDedup ? null : await findExistingLinearTrackerContextWork(options?.contextKey);
9214
9459
  if (existingTrackerWork)
9215
9460
  return { existing: existingTrackerWork };
9461
+ let routingDecisionSnapshot = null;
9462
+ try {
9463
+ routingDecisionSnapshot = await captureRoutingDecisionSnapshot(options);
9464
+ } catch (error) {
9465
+ logRoutingDecisionFailure(id, "capture", error);
9466
+ }
9216
9467
  const inserted = await getDbClient().get(`INSERT INTO agent_tasks (
9217
- id, "key", agentId, creatorAgentId, task, status, source,
9468
+ id, "key", agentId, creatorAgentId, task, status, source, routing_reason, routing_note,
9218
9469
  taskType, tags, priority, dependsOn, offeredTo, offeredAt,
9219
9470
  slackChannelId, slackThreadTs, slackTriggerMessageTs, slackUserId,
9220
9471
  vcsProvider, vcsRepo, vcsEventType, vcsNumber, vcsCommentId, vcsAuthor, vcsUrl,
@@ -9222,7 +9473,7 @@ async function createTaskExtended(task, options) {
9222
9473
  agentmailInboxId, agentmailMessageId, agentmailThreadId,
9223
9474
  mentionMessageId, mentionChannelId, dir, parentTaskId, model, modelTier, effort, scheduleId,
9224
9475
  workflowRunId, workflowRunStepId, outputSchema, followUpConfig, requestedByUserId, requestedByUserIdInherited, contextKey, routingAffinity, swarmVersion, createdAt, lastUpdatedAt, created_by, updated_by
9225
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
9476
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
9226
9477
  id,
9227
9478
  assetKey,
9228
9479
  options?.agentId ?? null,
@@ -9230,6 +9481,8 @@ async function createTaskExtended(task, options) {
9230
9481
  task,
9231
9482
  status,
9232
9483
  options?.source ?? "mcp",
9484
+ options?.routingReason ?? null,
9485
+ options?.routingNote ?? null,
9233
9486
  options?.taskType ?? null,
9234
9487
  JSON.stringify(options?.tags ?? []),
9235
9488
  options?.priority ?? 50,
@@ -9276,6 +9529,24 @@ async function createTaskExtended(task, options) {
9276
9529
  ]);
9277
9530
  if (!inserted)
9278
9531
  throw new Error("Failed to create task");
9532
+ if (routingDecisionSnapshot) {
9533
+ try {
9534
+ await getDbClient().run(`INSERT INTO routing_decisions (
9535
+ task_id, selected_agent_id, captured_at, worker_statuses,
9536
+ continuity_candidates, created_by, updated_by
9537
+ ) VALUES (?, ?, ?, ?, ?, ?, ?)`, [
9538
+ id,
9539
+ options.offeredTo ?? options.agentId ?? null,
9540
+ routingDecisionSnapshot.capturedAt,
9541
+ JSON.stringify(routingDecisionSnapshot.workerStatuses),
9542
+ JSON.stringify(routingDecisionSnapshot.continuityCandidates),
9543
+ auditUserId,
9544
+ auditUserId
9545
+ ]);
9546
+ } catch (error) {
9547
+ logRoutingDecisionFailure(id, "write", error);
9548
+ }
9549
+ }
9279
9550
  return { row: inserted };
9280
9551
  });
9281
9552
  if ("existing" in claim) {
@@ -9893,6 +10164,7 @@ async function postMessage(channelId, agentId, content, options) {
9893
10164
  const taskDescription = `Task from ${senderName} in #${channelName}: "${truncated}"`;
9894
10165
  const task = await createTaskExtended(taskDescription, {
9895
10166
  agentId: mentionedAgentId,
10167
+ routingReason: "human_pinned",
9896
10168
  creatorAgentId: agentId ?? undefined,
9897
10169
  source: "mcp",
9898
10170
  taskType: "task",
@@ -15055,7 +15327,10 @@ async function countScriptRunJournalAgentTaskSteps(runId) {
15055
15327
  const row = await getDbClient().get("SELECT COUNT(*) AS count FROM script_run_journal WHERE runId = ? AND stepType = 'agent-task'", [runId]);
15056
15328
  return row?.count ?? 0;
15057
15329
  }
15058
- var VERSIONABLE_FIELDS2, BUDGETED_IDENTITY_FIELDS, PENDING_SLACK_MESSAGE_TS_PREFIX = "pending:", GENERATED_PULL_REQUEST_PROVIDER_ID = "github", GENERATED_PULL_REQUEST_INTENT = "task-deliverable", GENERATED_PULL_REQUEST_DESCRIPTION = "Pull request shipped by this task", GENERATED_PULL_REQUEST_SOURCE = "task-pull-request-recorder", ELIGIBILITY_SCAN_BATCH_SIZE, ELIGIBILITY_SCAN_CAP, UNATTRIBUTED_USER_ID = "unattributed", HUMAN_FREE_TASKS_CTE = `human_free_tasks(id) AS (
15330
+ var VERSIONABLE_FIELDS2, BUDGETED_IDENTITY_FIELDS, PENDING_SLACK_MESSAGE_TS_PREFIX = "pending:", GENERATED_PULL_REQUEST_PROVIDER_ID = "github", GENERATED_PULL_REQUEST_INTENT = "task-deliverable", GENERATED_PULL_REQUEST_DESCRIPTION = "Pull request shipped by this task", GENERATED_PULL_REQUEST_SOURCE = "task-pull-request-recorder", ROUTING_HOLDER_SQL = `CASE
15331
+ WHEN status IN ('draft', 'offered', 'reviewing') AND offeredTo IS NOT NULL THEN offeredTo
15332
+ ELSE COALESCE(agentId, offeredTo)
15333
+ END`, ELIGIBILITY_SCAN_BATCH_SIZE, ELIGIBILITY_SCAN_CAP, UNATTRIBUTED_USER_ID = "unattributed", HUMAN_FREE_TASKS_CTE = `human_free_tasks(id) AS (
15059
15334
  SELECT task.id
15060
15335
  FROM agent_tasks task
15061
15336
  LEFT JOIN agent_tasks parent ON parent.id = task.parentTaskId
@@ -15183,4 +15458,4 @@ var init_db = __esm(() => {
15183
15458
  };
15184
15459
  });
15185
15460
 
15186
- export { normalizeAssetKey, defaultAssetKey, parseAssetKey, canWriteAssetKey, init_key, slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, telemetry, emitIntegrationConnected, init_telemetry, $OpenAPIRegistry, $OpenApiGeneratorV31, init_dist, init_zod_openapi, AssetKeySchema, AssetEntityTypeSchema, AssetKeyMappingSchema, AssetSummarySchema, ModelTierSchema, ReasoningEffortSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, ProviderNameSchema, SteerModeSchema, SteeringSourceSchema, SteeringMessageSchema, SteerOutcomeSchema, OnUnsupportedSchema, SteerResultSchema, FollowUpConfigSchema, AgentTaskSchema, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, UserCommsPrefsSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, FavoriteItemTypeSchema, UserFavoriteSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentAvatarSchema, AgentSchema, AgentLatestModelSchema, AgentAcpStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, VersionableFieldSchema, ChannelTypeSchema, ServiceStatusSchema, ServiceSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostModelBreakdownSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, AutomationIntegrationIdSchema, ScheduledTaskTargetTypeSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesInputSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RuntimeInstanceSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSchema, PageVersionSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, ScriptApiAuthModeSchema, ScriptApiRecordSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, KvEntrySchema, init_types, HeartbeatExpiryError, init_heartbeat_expiry, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, getTaskById, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, onTaskStarted, init_task_lifecycle_events, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, init_reaction_shortcode, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateConfigValue, init_swarm_config_guard, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
15461
+ export { normalizeAssetKey, defaultAssetKey, parseAssetKey, canWriteAssetKey, init_key, slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, telemetry, emitIntegrationConnected, init_telemetry, $OpenAPIRegistry, $OpenApiGeneratorV31, init_dist, init_zod_openapi, AssetKeySchema, AssetEntityTypeSchema, AssetKeyMappingSchema, AssetSummarySchema, ModelTierSchema, ReasoningEffortSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, RoutingReasonSchema, ProviderNameSchema, SteerModeSchema, SteeringSourceSchema, SteeringMessageSchema, SteerOutcomeSchema, OnUnsupportedSchema, SteerResultSchema, FollowUpConfigSchema, AgentTaskSchema, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, UserCommsPrefsSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, FavoriteItemTypeSchema, UserFavoriteSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentAvatarSchema, AgentSchema, AgentLatestModelSchema, AgentAcpStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, VersionableFieldSchema, ChannelTypeSchema, ServiceStatusSchema, ServiceSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostModelBreakdownSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, AutomationIntegrationIdSchema, ScheduledTaskTargetTypeSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesInputSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RuntimeInstanceSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSchema, PageVersionSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, ScriptApiAuthModeSchema, ScriptApiRecordSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, KvEntrySchema, init_types, HeartbeatExpiryError, init_heartbeat_expiry, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, getTaskById, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, onTaskStarted, init_task_lifecycle_events, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, init_reaction_shortcode, parseTaskToolManifest, selectTaskTools, init_task_tool_manifest, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateConfigValue, init_swarm_config_guard, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
@@ -164,6 +164,7 @@ var init_secret_scrubber = __esm(() => {
164
164
  TOKEN_REGEXES = [
165
165
  { name: "github_pat", re: /github_pat_[A-Za-z0-9_]{20,}/g },
166
166
  { name: "github_token", re: new RegExp(String.raw`${TB}gh[pousr]_[A-Za-z0-9]{20,}\b`, "g") },
167
+ { name: "acp_session_token", re: new RegExp(String.raw`${TB}aseph_[A-Za-z0-9]{20,}\b`, "g") },
167
168
  { name: "gitlab_pat", re: new RegExp(String.raw`${TB}glpat-[A-Za-z0-9_-]{20,}\b`, "g") },
168
169
  { name: "anthropic_key", re: new RegExp(String.raw`${TB}sk-ant-[A-Za-z0-9_-]{20,}\b`, "g") },
169
170
  { name: "openai_proj_key", re: new RegExp(String.raw`${TB}sk-proj-[A-Za-z0-9_-]{20,}\b`, "g") },
@@ -4,7 +4,7 @@ import {
4
4
  } from "./cli-jsp14b6c.js";
5
5
  import {
6
6
  createTaskWithSiblingAwareness
7
- } from "./cli-7gn7c2af.js";
7
+ } from "./cli-ayvy5kde.js";
8
8
  import {
9
9
  init_task_attachment_links,
10
10
  taskAttachmentFetchCommand
@@ -19,13 +19,13 @@ import {
19
19
  insertTaskAttachment,
20
20
  promoteDraftTask,
21
21
  refreshDraftTaskLease
22
- } from "./cli-6s2y152y.js";
22
+ } from "./cli-qgd4sqz5.js";
23
23
  import {
24
24
  init_registry,
25
25
  init_resolver,
26
26
  registerTemplate,
27
27
  resolveTemplate
28
- } from "./cli-kpv03zhj.js";
28
+ } from "./cli-3apbzgyk.js";
29
29
  import {
30
30
  init_env_flag,
31
31
  isEnvFlagEnabled
@@ -33,7 +33,7 @@ import {
33
33
  import {
34
34
  init_secret_scrubber,
35
35
  scrubSecrets
36
- } from "./cli-xqcq9y5e.js";
36
+ } from "./cli-r2ap2czm.js";
37
37
  import {
38
38
  __callDispose,
39
39
  __using
@@ -3,7 +3,7 @@ import {
3
3
  } from "./cli-epan13p1.js";
4
4
  import {
5
5
  embedScript
6
- } from "./cli-kzvhgvk3.js";
6
+ } from "./cli-3z634pqe.js";
7
7
  import {
8
8
  detachedProcessGroup,
9
9
  registerProcessGroup,
@@ -23,7 +23,7 @@ import {
23
23
  oauthAppRowToProviderConfig,
24
24
  updateAuthorizationTokens,
25
25
  upsertAuthorization
26
- } from "./cli-dcem3pr1.js";
26
+ } from "./cli-cd60fv6j.js";
27
27
  import {
28
28
  CredentialBroker,
29
29
  DEFAULT_CREDENTIAL_BINDINGS,
@@ -44,7 +44,7 @@ import {
44
44
  normalizeDateRequired,
45
45
  placeholderForConfigKey,
46
46
  upsertSwarmConfig
47
- } from "./cli-6s2y152y.js";
47
+ } from "./cli-qgd4sqz5.js";
48
48
  import {
49
49
  init_env_flag,
50
50
  isEnvFlagEnabled
@@ -61,7 +61,7 @@ import {
61
61
  registerVolatileSecret,
62
62
  scrubObject,
63
63
  scrubSecrets
64
- } from "./cli-xqcq9y5e.js";
64
+ } from "./cli-r2ap2czm.js";
65
65
  import {
66
66
  __commonJS,
67
67
  __require,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  materializeClaudeMd,
3
3
  stopClaudeMd
4
- } from "./cli-d8brzxjb.js";
4
+ } from "./cli-4wtq5jjv.js";
5
5
  import {
6
6
  summarizeSession
7
- } from "./cli-rvqz34y5.js";
7
+ } from "./cli-jecc01cb.js";
8
8
  import {
9
9
  checkToolLoop,
10
10
  clearToolHistory
@@ -26,7 +26,7 @@ import {
26
26
  init_profile_sync,
27
27
  readIdentityBaselines,
28
28
  warnProfileFileTooLarge
29
- } from "./cli-m9sxbkhm.js";
29
+ } from "./cli-zvz62chv.js";
30
30
  import {
31
31
  MAX_PROFILE_FILE_LENGTH,
32
32
  getMcpBaseUrl,
@@ -35,11 +35,11 @@ import {
35
35
  import {
36
36
  init_package,
37
37
  package_default
38
- } from "./cli-anedxf1w.js";
38
+ } from "./cli-e06a8a7y.js";
39
39
  import {
40
40
  init_secret_scrubber,
41
41
  scrubSecrets
42
- } from "./cli-xqcq9y5e.js";
42
+ } from "./cli-r2ap2czm.js";
43
43
 
44
44
  // src/hooks/hook.ts
45
45
  init_package();