@grok/agent-sdk 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (530) hide show
  1. package/AGENTS.md +40 -0
  2. package/dist/channels/github/forward.d.ts +5 -0
  3. package/dist/channels/github/forward.d.ts.map +1 -1
  4. package/dist/channels/github/forward.js +6 -3
  5. package/dist/channels/slack/api.d.ts +18 -0
  6. package/dist/channels/slack/api.d.ts.map +1 -1
  7. package/dist/channels/slack/api.js +31 -0
  8. package/dist/channels/slack/approvals.d.ts +19 -2
  9. package/dist/channels/slack/approvals.d.ts.map +1 -1
  10. package/dist/channels/slack/approvals.js +90 -19
  11. package/dist/channels/slack/attachments.d.ts +7 -2
  12. package/dist/channels/slack/attachments.d.ts.map +1 -1
  13. package/dist/channels/slack/attachments.js +318 -156
  14. package/dist/channels/slack/connect-card.d.ts +16 -0
  15. package/dist/channels/slack/connect-card.d.ts.map +1 -0
  16. package/dist/channels/slack/connect-card.js +31 -0
  17. package/dist/channels/slack/credentials.d.ts +10 -2
  18. package/dist/channels/slack/credentials.d.ts.map +1 -1
  19. package/dist/channels/slack/credentials.js +17 -15
  20. package/dist/channels/slack/defaults.d.ts.map +1 -1
  21. package/dist/channels/slack/defaults.js +18 -9
  22. package/dist/channels/slack/dispatch.d.ts +1 -1
  23. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  24. package/dist/channels/slack/dispatch.js +19 -3
  25. package/dist/channels/slack/inbound.d.ts +8 -2
  26. package/dist/channels/slack/inbound.d.ts.map +1 -1
  27. package/dist/channels/slack/inbound.js +25 -4
  28. package/dist/channels/slack/index.d.ts +3 -2
  29. package/dist/channels/slack/index.d.ts.map +1 -1
  30. package/dist/channels/slack/index.js +3 -2
  31. package/dist/channels/slack/init.d.ts.map +1 -1
  32. package/dist/channels/slack/init.js +2 -1
  33. package/dist/channels/slack/manifest.d.ts.map +1 -1
  34. package/dist/channels/slack/manifest.js +2 -15
  35. package/dist/channels/slack/mentions.d.ts +28 -0
  36. package/dist/channels/slack/mentions.d.ts.map +1 -0
  37. package/dist/channels/slack/mentions.js +178 -0
  38. package/dist/channels/slack/setup.js +1 -1
  39. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  40. package/dist/channels/slack/slack-channel.js +46 -3
  41. package/dist/channels/slack/stop.d.ts.map +1 -1
  42. package/dist/channels/slack/stop.js +7 -1
  43. package/dist/channels/slack/thread-context.d.ts +3 -0
  44. package/dist/channels/slack/thread-context.d.ts.map +1 -1
  45. package/dist/channels/slack/thread-context.js +17 -7
  46. package/dist/channels/slack/tool-approval-events.d.ts.map +1 -1
  47. package/dist/channels/slack/tool-approval-events.js +55 -2
  48. package/dist/channels/slack/types.d.ts +2 -0
  49. package/dist/channels/slack/types.d.ts.map +1 -1
  50. package/dist/channels/teams/activity.d.ts +33 -0
  51. package/dist/channels/teams/activity.d.ts.map +1 -0
  52. package/dist/channels/teams/activity.js +213 -0
  53. package/dist/channels/teams/auth.d.ts +25 -0
  54. package/dist/channels/teams/auth.d.ts.map +1 -0
  55. package/dist/channels/teams/auth.js +55 -0
  56. package/dist/channels/teams/bot-framework-auth.d.ts +33 -0
  57. package/dist/channels/teams/bot-framework-auth.d.ts.map +1 -0
  58. package/dist/channels/teams/bot-framework-auth.js +154 -0
  59. package/dist/channels/teams/cards.d.ts +23 -0
  60. package/dist/channels/teams/cards.d.ts.map +1 -0
  61. package/dist/channels/teams/cards.js +107 -0
  62. package/dist/channels/teams/connector.d.ts +48 -0
  63. package/dist/channels/teams/connector.d.ts.map +1 -0
  64. package/dist/channels/teams/connector.js +159 -0
  65. package/dist/channels/teams/credentials.d.ts +65 -0
  66. package/dist/channels/teams/credentials.d.ts.map +1 -0
  67. package/dist/channels/teams/credentials.js +84 -0
  68. package/dist/channels/teams/delivery.d.ts +14 -0
  69. package/dist/channels/teams/delivery.d.ts.map +1 -0
  70. package/dist/channels/teams/delivery.js +169 -0
  71. package/dist/channels/teams/dispatch.d.ts +45 -0
  72. package/dist/channels/teams/dispatch.d.ts.map +1 -0
  73. package/dist/channels/teams/dispatch.js +402 -0
  74. package/dist/channels/teams/engagement.d.ts +32 -0
  75. package/dist/channels/teams/engagement.d.ts.map +1 -0
  76. package/dist/channels/teams/engagement.js +120 -0
  77. package/dist/channels/teams/index.d.ts +21 -0
  78. package/dist/channels/teams/index.d.ts.map +1 -0
  79. package/dist/channels/teams/index.js +19 -0
  80. package/dist/channels/teams/marks.d.ts +19 -0
  81. package/dist/channels/teams/marks.d.ts.map +1 -0
  82. package/dist/channels/teams/marks.js +96 -0
  83. package/dist/channels/teams/senders.d.ts +27 -0
  84. package/dist/channels/teams/senders.d.ts.map +1 -0
  85. package/dist/channels/teams/senders.js +72 -0
  86. package/dist/channels/teams/teams-channel.d.ts +43 -0
  87. package/dist/channels/teams/teams-channel.d.ts.map +1 -0
  88. package/dist/channels/teams/teams-channel.js +278 -0
  89. package/dist/channels/teams/text.d.ts +7 -0
  90. package/dist/channels/teams/text.d.ts.map +1 -0
  91. package/dist/channels/teams/text.js +63 -0
  92. package/dist/channels/teams/types.d.ts +306 -0
  93. package/dist/channels/teams/types.d.ts.map +1 -0
  94. package/dist/channels/teams/types.js +1 -0
  95. package/dist/channels.d.ts +31 -0
  96. package/dist/channels.d.ts.map +1 -1
  97. package/dist/channels.js +37 -0
  98. package/dist/connections.d.ts +1 -1
  99. package/dist/connections.d.ts.map +1 -1
  100. package/dist/docs/404.html +3 -3
  101. package/dist/docs/assets/{app.CYdjweqP.js → app.Ch-048af.js} +4 -4
  102. package/dist/docs/assets/changelog.md.SoN0MK7o.js +1 -0
  103. package/dist/docs/assets/{changelog.md.BMrJ5WxW.lean.js → changelog.md.SoN0MK7o.lean.js} +1 -1
  104. package/dist/docs/assets/chunks/@localSearchIndexroot.BdYoBKxY.js +1 -0
  105. package/dist/docs/assets/chunks/{VPLocalSearchBox.CRATKS9J.js → VPLocalSearchBox.D7BIa9Su.js} +2 -2
  106. package/dist/docs/assets/chunks/{arc.BxM78ISR.js → arc.BIzu7OVF.js} +1 -1
  107. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.Bi6MuKaU.js → architectureDiagram-Q4EWVU46.DNznI0Sn.js} +1 -1
  108. package/dist/docs/assets/chunks/{baseUniq.L47qqpDG.js → baseUniq.B4y6Y5eG.js} +1 -1
  109. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.kHFF2FK5.js → blockDiagram-DXYQGD6D.BudnBsgw.js} +1 -1
  110. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.BTW85ll3.js → c4Diagram-AHTNJAMY._bB00GdB.js} +1 -1
  111. package/dist/docs/assets/chunks/channel.CgxlmuBS.js +1 -0
  112. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.Bbh3_48g.js → chunk-4BX2VUAB.CRftnUwS.js} +1 -1
  113. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.WeAmK3fK.js → chunk-4TB4RGXK.CSx1x2Ob.js} +1 -1
  114. package/dist/docs/assets/chunks/{chunk-55IACEB6.DTdUiVHf.js → chunk-55IACEB6.KkLHAAbH.js} +1 -1
  115. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.n5XzANDz.js → chunk-EDXVE4YY.DDeKCCtX.js} +1 -1
  116. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.D51eewCb.js → chunk-FMBD7UC4.DrLlsD9m.js} +1 -1
  117. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.BrY0U7ZV.js → chunk-OYMX7WX6.DeVYOGcT.js} +1 -1
  118. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.B0OA4aFV.js → chunk-QZHKN3VN.Cz4_bS6p.js} +1 -1
  119. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.Djt3Mjft.js → chunk-YZCP3GAM.CwrYtDVo.js} +1 -1
  120. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.DWroREP-.js +1 -0
  121. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.DWroREP-.js +1 -0
  122. package/dist/docs/assets/chunks/clone.F824-PNx.js +1 -0
  123. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.DiMcA6Q8.js → cose-bilkent-S5V4N54A.3d8hflz6.js} +1 -1
  124. package/dist/docs/assets/chunks/{dagre-KV5264BT.BGqI4vrS.js → dagre-KV5264BT.BVEgjiPg.js} +1 -1
  125. package/dist/docs/assets/chunks/{diagram-5BDNPKRD.bDqFuMoH.js → diagram-5BDNPKRD.j7dZpUK_.js} +1 -1
  126. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.Y0sxaXRU.js → diagram-G4DWMVQ6.4flIgIon.js} +1 -1
  127. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.Bg43b0yi.js → diagram-MMDJMWI5.BlJiFh-S.js} +1 -1
  128. package/dist/docs/assets/chunks/{diagram-TYMM5635.DCfVasEC.js → diagram-TYMM5635.DHAOHEyM.js} +1 -1
  129. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.C72GaD16.js → erDiagram-SMLLAGMA.DkmyG7xK.js} +1 -1
  130. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.DxRQj7pP.js → flowDiagram-DWJPFMVM.L_WiaAU6.js} +1 -1
  131. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.DiLZy5Q4.js → ganttDiagram-T4ZO3ILL.CT6kOI2a.js} +1 -1
  132. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.DL8XkRvh.js → gitGraphDiagram-UUTBAWPF.D8CRlLqh.js} +1 -1
  133. package/dist/docs/assets/chunks/{graph.3Xub80xJ.js → graph.CdOyJvsX.js} +1 -1
  134. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.O3lGaspu.js → infoDiagram-42DDH7IO.DcmXeSos.js} +1 -1
  135. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.w-pCiQzn.js → ishikawaDiagram-UXIWVN3A.BBjY4mxr.js} +1 -1
  136. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.Cg_oBs9j.js → journeyDiagram-VCZTEJTY.BrXteAB6.js} +1 -1
  137. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.BpfMGPwn.js → kanban-definition-6JOO6SKY.OlHsUJVV.js} +1 -1
  138. package/dist/docs/assets/chunks/{layout.CtwXs__p.js → layout.DDwvoQlY.js} +1 -1
  139. package/dist/docs/assets/chunks/{linear.NmCskOrP.js → linear.BRXPDWj3.js} +1 -1
  140. package/dist/docs/assets/chunks/{min.DpQtsLKs.js → min.3YwC0t3o.js} +1 -1
  141. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.B-P-aKVp.js → mindmap-definition-QFDTVHPH.mPHnT2lN.js} +1 -1
  142. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.BfjjqK7j.js → pieDiagram-DEJITSTG.DEK2--em.js} +1 -1
  143. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.BTzHo53F.js → quadrantDiagram-34T5L4WZ.NCdRAOzK.js} +1 -1
  144. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.DIT2FIKr.js → requirementDiagram-MS252O5E.DLAocFWZ.js} +1 -1
  145. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.NK1wCsgt.js → sankeyDiagram-XADWPNL6.afIOqpyT.js} +1 -1
  146. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.D9oElkvo.js → sequenceDiagram-FGHM5R23.DXBjvkkE.js} +1 -1
  147. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.IPksnixH.js → stateDiagram-FHFEXIEX.B_SGgvgs.js} +1 -1
  148. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.OKAy5Bz7.js +1 -0
  149. package/dist/docs/assets/chunks/{theme.CgKu7tr3.js → theme.bNyH5NPA.js} +2 -2
  150. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.CuAtJapY.js → timeline-definition-GMOUNBTQ.CE6S1iSb.js} +1 -1
  151. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.B87nNW9E.js → vennDiagram-DHZGUBPP.Blk7wb8V.js} +1 -1
  152. package/dist/docs/assets/chunks/wardley-RL74JXVD.DQqE3WF8.js +162 -0
  153. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.BELjSq8w.js → wardleyDiagram-NUSXRM2D.MUEQyRnz.js} +1 -1
  154. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.5zN5ZGsz.js → xychartDiagram-5P7HB3ND.DnJA2aXp.js} +1 -1
  155. package/dist/docs/assets/{deployment.md.DJtuDVLh.js → deployment.md.N9S5KC5R.js} +2 -2
  156. package/dist/docs/assets/{deployment.md.DJtuDVLh.lean.js → deployment.md.N9S5KC5R.lean.js} +1 -1
  157. package/dist/docs/assets/guides_cloud-agents.md.BdWqmUGb.js +14 -0
  158. package/dist/docs/assets/{guides_cloud-agents.md.CiXAW6on.lean.js → guides_cloud-agents.md.BdWqmUGb.lean.js} +1 -1
  159. package/dist/docs/assets/guides_teams.md.7Lz2sbqB.js +50 -0
  160. package/dist/docs/assets/guides_teams.md.7Lz2sbqB.lean.js +1 -0
  161. package/dist/docs/assets/{reference_channels.md.CPWOpdsC.js → reference_channels.md.CRvqgU0n.js} +1 -1
  162. package/dist/docs/assets/{reference_cli.md.DHm6DmYk.js → reference_cli.md.NS6U5a-7.js} +14 -4
  163. package/dist/docs/assets/{reference_cli.md.DHm6DmYk.lean.js → reference_cli.md.NS6U5a-7.lean.js} +1 -1
  164. package/dist/docs/assets/{reference_limits.md.CbdtFr4T.js → reference_limits.md.CW9PTdxr.js} +3 -3
  165. package/dist/docs/assets/{reference_limits.md.CbdtFr4T.lean.js → reference_limits.md.CW9PTdxr.lean.js} +1 -1
  166. package/dist/docs/assets/{reference_schedules.md.RhQ9ZLo1.js → reference_schedules.md.Dd8_d0WG.js} +3 -3
  167. package/dist/docs/assets/{reference_sessions.md.NXVQt9mP.js → reference_sessions.md.CoCyQLEz.js} +2 -2
  168. package/dist/docs/assets/{reference_sessions.md.NXVQt9mP.lean.js → reference_sessions.md.CoCyQLEz.lean.js} +1 -1
  169. package/dist/docs/assets/{reference_skills.md.DzCPNPkG.js → reference_skills.md.SFRZDC41.js} +4 -4
  170. package/dist/docs/assets/{reference_skills.md.DzCPNPkG.lean.js → reference_skills.md.SFRZDC41.lean.js} +1 -1
  171. package/dist/docs/assets/{style.DK0YX1WL.css → style.B7zPxANR.css} +1 -1
  172. package/dist/docs/assets/troubleshooting.md.CsQTleto.js +3 -0
  173. package/dist/docs/assets/{troubleshooting.md.DfKKvW1R.lean.js → troubleshooting.md.CsQTleto.lean.js} +1 -1
  174. package/dist/docs/building-with-agents.html +37 -37
  175. package/dist/docs/changelog.html +37 -37
  176. package/dist/docs/changelog.md +51 -0
  177. package/dist/docs/deployment.html +39 -39
  178. package/dist/docs/deployment.md +10 -0
  179. package/dist/docs/evals.html +37 -37
  180. package/dist/docs/guides/agent-to-agent.html +37 -37
  181. package/dist/docs/guides/bitbucket.html +37 -37
  182. package/dist/docs/guides/cloud-agents.html +43 -38
  183. package/dist/docs/guides/cloud-agents.md +47 -0
  184. package/dist/docs/guides/convert-automation.html +37 -37
  185. package/dist/docs/guides/github.html +37 -37
  186. package/dist/docs/guides/gitlab.html +37 -37
  187. package/dist/docs/guides/improve.html +37 -37
  188. package/dist/docs/guides/jev.html +37 -37
  189. package/dist/docs/guides/mcp-oauth.html +37 -37
  190. package/dist/docs/guides/migrate.html +37 -37
  191. package/dist/docs/guides/opentelemetry.html +37 -37
  192. package/dist/docs/guides/pagerduty.html +37 -37
  193. package/dist/docs/guides/slack.html +37 -37
  194. package/dist/docs/guides/teams.html +109 -0
  195. package/dist/docs/guides/teams.md +384 -0
  196. package/dist/docs/guides/webhooks.html +37 -37
  197. package/dist/docs/hashmap.json +1 -1
  198. package/dist/docs/hillclimbing.html +37 -37
  199. package/dist/docs/index.html +37 -37
  200. package/dist/docs/llms-full.txt +652 -4
  201. package/dist/docs/llms.txt +1 -0
  202. package/dist/docs/quickstart.html +37 -37
  203. package/dist/docs/reference/access.html +36 -36
  204. package/dist/docs/reference/agent-config.html +37 -37
  205. package/dist/docs/reference/artifacts.html +37 -37
  206. package/dist/docs/reference/channels.html +38 -38
  207. package/dist/docs/reference/channels.md +1 -0
  208. package/dist/docs/reference/cli.html +50 -40
  209. package/dist/docs/reference/cli.md +116 -0
  210. package/dist/docs/reference/connections.html +37 -37
  211. package/dist/docs/reference/evals.html +37 -37
  212. package/dist/docs/reference/extensions.html +37 -37
  213. package/dist/docs/reference/hooks.html +37 -37
  214. package/dist/docs/reference/http-api.html +37 -37
  215. package/dist/docs/reference/instructions.html +37 -37
  216. package/dist/docs/reference/limits.html +39 -39
  217. package/dist/docs/reference/limits.md +4 -4
  218. package/dist/docs/reference/memory.html +37 -37
  219. package/dist/docs/reference/playground.html +36 -36
  220. package/dist/docs/reference/project-layout.html +37 -37
  221. package/dist/docs/reference/schedules.html +40 -40
  222. package/dist/docs/reference/sessions.html +38 -38
  223. package/dist/docs/reference/sessions.md +13 -0
  224. package/dist/docs/reference/skills.html +40 -40
  225. package/dist/docs/reference/subagents.html +37 -37
  226. package/dist/docs/reference/tools.html +37 -37
  227. package/dist/docs/templates/agentic-owners.html +37 -37
  228. package/dist/docs/templates/reviews.html +37 -37
  229. package/dist/docs/troubleshooting.html +38 -38
  230. package/dist/docs/troubleshooting.md +21 -0
  231. package/dist/evals/run-facts.d.ts.map +1 -1
  232. package/dist/evals/run-facts.js +4 -0
  233. package/dist/extensions/cursor-cloud-agents/channels/cursor-cloud-agents.d.ts +12 -0
  234. package/dist/extensions/cursor-cloud-agents/channels/cursor-cloud-agents.d.ts.map +1 -0
  235. package/dist/extensions/cursor-cloud-agents/channels/cursor-cloud-agents.js +42 -0
  236. package/dist/extensions/cursor-cloud-agents/extension.d.ts +10 -7
  237. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
  238. package/dist/extensions/cursor-cloud-agents/extension.js +3 -2
  239. package/dist/extensions/cursor-cloud-agents/lib/agent-id.d.ts +5 -0
  240. package/dist/extensions/cursor-cloud-agents/lib/agent-id.d.ts.map +1 -0
  241. package/dist/extensions/cursor-cloud-agents/lib/agent-id.js +10 -0
  242. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts +57 -3
  243. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts.map +1 -1
  244. package/dist/extensions/cursor-cloud-agents/lib/backend.js +150 -35
  245. package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts +32 -4
  246. package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts.map +1 -1
  247. package/dist/extensions/cursor-cloud-agents/lib/fleet.js +93 -7
  248. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts +24 -7
  249. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts.map +1 -1
  250. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.js +158 -25
  251. package/dist/extensions/cursor-cloud-agents/lib/stop-signal.d.ts +18 -0
  252. package/dist/extensions/cursor-cloud-agents/lib/stop-signal.d.ts.map +1 -0
  253. package/dist/extensions/cursor-cloud-agents/lib/stop-signal.js +27 -0
  254. package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts.map +1 -1
  255. package/dist/extensions/cursor-cloud-agents/lib/transcript.js +2 -3
  256. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts +26 -12
  257. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts.map +1 -1
  258. package/dist/extensions/cursor-cloud-agents/lib/watch.js +115 -46
  259. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts +16 -5
  260. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts.map +1 -1
  261. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.js +76 -20
  262. package/dist/extensions/cursor-cloud-agents/skills/handoff.md +2 -2
  263. package/dist/extensions/cursor-cloud-agents/tools/get.js +2 -2
  264. package/dist/extensions/cursor-cloud-agents/tools/launch.js +1 -1
  265. package/dist/extensions.d.ts.map +1 -1
  266. package/dist/extensions.js +18 -3
  267. package/dist/files-backends/agent-store-presigned-url.js +5 -1
  268. package/dist/index.d.ts +1 -0
  269. package/dist/index.d.ts.map +1 -1
  270. package/dist/index.js +1 -0
  271. package/dist/internal/approval-gate.d.ts +6 -1
  272. package/dist/internal/approval-gate.d.ts.map +1 -1
  273. package/dist/internal/approval-gate.js +13 -2
  274. package/dist/internal/authored-loaders.js +1 -1
  275. package/dist/internal/channel-architecture.d.ts.map +1 -1
  276. package/dist/internal/channel-architecture.js +3 -1
  277. package/dist/internal/cli/commands/channels.d.ts +9 -3
  278. package/dist/internal/cli/commands/channels.d.ts.map +1 -1
  279. package/dist/internal/cli/commands/channels.js +193 -4
  280. package/dist/internal/cli/commands/index.d.ts.map +1 -1
  281. package/dist/internal/cli/commands/index.js +6 -1
  282. package/dist/internal/cli/commands/serve.d.ts.map +1 -1
  283. package/dist/internal/cli/commands/serve.js +25 -5
  284. package/dist/internal/cli/dispatch.d.ts.map +1 -1
  285. package/dist/internal/cli/dispatch.js +22 -8
  286. package/dist/internal/cli/flags.d.ts +14 -0
  287. package/dist/internal/cli/flags.d.ts.map +1 -1
  288. package/dist/internal/cli/flags.js +14 -0
  289. package/dist/internal/cli/help.d.ts.map +1 -1
  290. package/dist/internal/cli/help.js +3 -1
  291. package/dist/internal/cli-cursor.js +2 -2
  292. package/dist/internal/cli-deploy.d.ts +1 -0
  293. package/dist/internal/cli-deploy.d.ts.map +1 -1
  294. package/dist/internal/cli-deploy.js +31 -8
  295. package/dist/internal/cli-mcp.d.ts.map +1 -1
  296. package/dist/internal/cli-mcp.js +5 -3
  297. package/dist/internal/cli-teams-doctor.d.ts +39 -0
  298. package/dist/internal/cli-teams-doctor.d.ts.map +1 -0
  299. package/dist/internal/cli-teams-doctor.js +508 -0
  300. package/dist/internal/cli-teams-forward.d.ts +84 -0
  301. package/dist/internal/cli-teams-forward.d.ts.map +1 -0
  302. package/dist/internal/cli-teams-forward.js +386 -0
  303. package/dist/internal/cli-teams-package.d.ts +26 -0
  304. package/dist/internal/cli-teams-package.d.ts.map +1 -0
  305. package/dist/internal/cli-teams-package.js +123 -0
  306. package/dist/internal/cli-teams.d.ts +15 -0
  307. package/dist/internal/cli-teams.d.ts.map +1 -0
  308. package/dist/internal/cli-teams.js +253 -0
  309. package/dist/internal/connect-click.d.ts +12 -0
  310. package/dist/internal/connect-click.d.ts.map +1 -0
  311. package/dist/internal/connect-click.js +22 -0
  312. package/dist/internal/continuation-channel.d.ts +5 -1
  313. package/dist/internal/continuation-channel.d.ts.map +1 -1
  314. package/dist/internal/continuation-channel.js +34 -0
  315. package/dist/internal/continuation-identity.d.ts +7 -4
  316. package/dist/internal/continuation-identity.d.ts.map +1 -1
  317. package/dist/internal/continuation-identity.js +66 -1
  318. package/dist/internal/convert-automation/convert-workflow.js +2 -2
  319. package/dist/internal/credential-env-names.d.ts +36 -0
  320. package/dist/internal/credential-env-names.d.ts.map +1 -0
  321. package/dist/internal/credential-env-names.js +68 -0
  322. package/dist/internal/cursor/account-mcp.d.ts +67 -9
  323. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  324. package/dist/internal/cursor/account-mcp.js +206 -25
  325. package/dist/internal/cursor/backend-client.d.ts +10 -1
  326. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  327. package/dist/internal/cursor/backend-client.js +19 -7
  328. package/dist/internal/cursor/cloud-agent-identity.d.ts +81 -0
  329. package/dist/internal/cursor/cloud-agent-identity.d.ts.map +1 -0
  330. package/dist/internal/cursor/cloud-agent-identity.js +224 -0
  331. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  332. package/dist/internal/cursor/credentials.js +3 -1
  333. package/dist/internal/cursor-account-mcp-auth.d.ts +1 -0
  334. package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
  335. package/dist/internal/cursor-account-mcp-auth.js +2 -1
  336. package/dist/internal/deploy-client.d.ts.map +1 -1
  337. package/dist/internal/deploy-client.js +34 -2
  338. package/dist/internal/deploy-manifest.d.ts +51 -3
  339. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  340. package/dist/internal/deploy-manifest.js +96 -7
  341. package/dist/internal/discovery/agent-config.d.ts.map +1 -1
  342. package/dist/internal/discovery/agent-config.js +6 -1
  343. package/dist/internal/discovery/connections.d.ts.map +1 -1
  344. package/dist/internal/discovery/connections.js +53 -0
  345. package/dist/internal/discovery/extensions.d.ts.map +1 -1
  346. package/dist/internal/discovery/extensions.js +2 -0
  347. package/dist/internal/discovery/info.d.ts.map +1 -1
  348. package/dist/internal/discovery/info.js +4 -0
  349. package/dist/internal/env-file.d.ts +1 -0
  350. package/dist/internal/env-file.d.ts.map +1 -1
  351. package/dist/internal/env-file.js +18 -17
  352. package/dist/internal/env-prefix.d.ts +11 -0
  353. package/dist/internal/env-prefix.d.ts.map +1 -0
  354. package/dist/internal/env-prefix.js +23 -0
  355. package/dist/internal/event-id-dedupe.d.ts +12 -0
  356. package/dist/internal/event-id-dedupe.d.ts.map +1 -0
  357. package/dist/{channels/slack → internal}/event-id-dedupe.js +7 -4
  358. package/dist/internal/event-mapper.d.ts +7 -2
  359. package/dist/internal/event-mapper.d.ts.map +1 -1
  360. package/dist/internal/event-mapper.js +7 -0
  361. package/dist/internal/expected-delivery-failure.d.ts.map +1 -1
  362. package/dist/internal/expected-delivery-failure.js +3 -0
  363. package/dist/internal/extension-namespace.d.ts +9 -0
  364. package/dist/internal/extension-namespace.d.ts.map +1 -0
  365. package/dist/internal/extension-namespace.js +14 -0
  366. package/dist/internal/guid.d.ts +2 -0
  367. package/dist/internal/guid.d.ts.map +1 -0
  368. package/dist/internal/guid.js +4 -0
  369. package/dist/internal/host-kv-cas.d.ts +13 -0
  370. package/dist/internal/host-kv-cas.d.ts.map +1 -0
  371. package/dist/internal/host-kv-cas.js +8 -0
  372. package/dist/internal/host-kv.d.ts +4 -1
  373. package/dist/internal/host-kv.d.ts.map +1 -1
  374. package/dist/internal/host-kv.js +15 -2
  375. package/dist/internal/hosted-catch-protocol.d.ts +5 -0
  376. package/dist/internal/hosted-catch-protocol.d.ts.map +1 -1
  377. package/dist/internal/hosted-catch-protocol.js +5 -0
  378. package/dist/internal/hosted-catch.d.ts +2 -0
  379. package/dist/internal/hosted-catch.d.ts.map +1 -1
  380. package/dist/internal/hosted-catch.js +6 -1
  381. package/dist/internal/hosted-delivery-protocol.d.ts +6 -0
  382. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  383. package/dist/internal/hosted-delivery-protocol.js +71 -1
  384. package/dist/internal/hosted-delivery.d.ts +5 -2
  385. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  386. package/dist/internal/hosted-delivery.js +36 -12
  387. package/dist/internal/hosted-execution-latency.d.ts +3 -0
  388. package/dist/internal/hosted-execution-latency.d.ts.map +1 -1
  389. package/dist/internal/hosted-execution-latency.js +11 -0
  390. package/dist/internal/hosted-session-fixture.js +1 -1
  391. package/dist/internal/hosting.d.ts +5 -0
  392. package/dist/internal/hosting.d.ts.map +1 -1
  393. package/dist/internal/hosting.js +7 -1
  394. package/dist/internal/install-cursor-skills.d.ts +6 -7
  395. package/dist/internal/install-cursor-skills.d.ts.map +1 -1
  396. package/dist/internal/install-cursor-skills.js +15 -9
  397. package/dist/internal/interview/agent-questions.d.ts +1 -1
  398. package/dist/internal/interview/agent-questions.d.ts.map +1 -1
  399. package/dist/internal/interview/agent-questions.js +4 -3
  400. package/dist/internal/local-control-plane.d.ts.map +1 -1
  401. package/dist/internal/local-control-plane.js +24 -0
  402. package/dist/internal/mcp-allowlist-in-use.d.ts +23 -0
  403. package/dist/internal/mcp-allowlist-in-use.d.ts.map +1 -0
  404. package/dist/internal/mcp-allowlist-in-use.js +93 -0
  405. package/dist/internal/mcp-endpoint.d.ts.map +1 -1
  406. package/dist/internal/mcp-endpoint.js +8 -10
  407. package/dist/internal/mcp-host.d.ts +19 -1
  408. package/dist/internal/mcp-host.d.ts.map +1 -1
  409. package/dist/internal/mcp-host.js +67 -3
  410. package/dist/internal/mcp-oauth.d.ts.map +1 -1
  411. package/dist/internal/mcp-oauth.js +5 -7
  412. package/dist/internal/oidcAudiences.d.ts +22 -0
  413. package/dist/internal/oidcAudiences.d.ts.map +1 -0
  414. package/dist/internal/oidcAudiences.js +35 -0
  415. package/dist/internal/otel/collector.d.ts.map +1 -1
  416. package/dist/internal/otel/collector.js +2 -0
  417. package/dist/internal/platform-timers.d.ts +2 -0
  418. package/dist/internal/platform-timers.d.ts.map +1 -1
  419. package/dist/internal/platform-timers.js +14 -0
  420. package/dist/internal/private-file.d.ts +32 -1
  421. package/dist/internal/private-file.d.ts.map +1 -1
  422. package/dist/internal/private-file.js +209 -7
  423. package/dist/internal/redact-values.d.ts +3 -0
  424. package/dist/internal/redact-values.d.ts.map +1 -0
  425. package/dist/internal/redact-values.js +19 -0
  426. package/dist/internal/reminder-control-plane-protocol.d.ts +7 -1
  427. package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -1
  428. package/dist/internal/reminder-followup-error.d.ts +23 -0
  429. package/dist/internal/reminder-followup-error.d.ts.map +1 -0
  430. package/dist/internal/reminder-followup-error.js +12 -0
  431. package/dist/internal/reminder-runner.d.ts +15 -1
  432. package/dist/internal/reminder-runner.d.ts.map +1 -1
  433. package/dist/internal/reminder-runner.js +95 -21
  434. package/dist/internal/resolved-connections.d.ts.map +1 -1
  435. package/dist/internal/resolved-connections.js +23 -3
  436. package/dist/internal/run-client.js +2 -1
  437. package/dist/internal/run-program.d.ts +31 -0
  438. package/dist/internal/run-program.d.ts.map +1 -0
  439. package/dist/internal/run-program.js +150 -0
  440. package/dist/internal/sdk-runner.d.ts +29 -3
  441. package/dist/internal/sdk-runner.d.ts.map +1 -1
  442. package/dist/internal/sdk-runner.js +304 -38
  443. package/dist/internal/server.d.ts.map +1 -1
  444. package/dist/internal/server.js +53 -8
  445. package/dist/internal/session-credential.d.ts +14 -0
  446. package/dist/internal/session-credential.d.ts.map +1 -0
  447. package/dist/internal/session-credential.js +25 -0
  448. package/dist/internal/session-engine.d.ts +137 -5
  449. package/dist/internal/session-engine.d.ts.map +1 -1
  450. package/dist/internal/session-engine.js +606 -92
  451. package/dist/internal/storage-coordinator.d.ts +3 -1
  452. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  453. package/dist/internal/storage-coordinator.js +13 -0
  454. package/dist/internal/storage-roles.d.ts +9 -1
  455. package/dist/internal/storage-roles.d.ts.map +1 -1
  456. package/dist/internal/tcp-address.d.ts +3 -1
  457. package/dist/internal/tcp-address.d.ts.map +1 -1
  458. package/dist/internal/tcp-address.js +6 -0
  459. package/dist/internal/teams-channel-profile.d.ts +41 -0
  460. package/dist/internal/teams-channel-profile.d.ts.map +1 -0
  461. package/dist/internal/teams-channel-profile.js +91 -0
  462. package/dist/internal/teams-devtunnel.d.ts +55 -0
  463. package/dist/internal/teams-devtunnel.d.ts.map +1 -0
  464. package/dist/internal/teams-devtunnel.js +205 -0
  465. package/dist/internal/teams-tunnel-proxy.d.ts +17 -0
  466. package/dist/internal/teams-tunnel-proxy.d.ts.map +1 -0
  467. package/dist/internal/teams-tunnel-proxy.js +100 -0
  468. package/dist/internal/testing/conversation-identity-vectors.d.ts +7 -1
  469. package/dist/internal/testing/conversation-identity-vectors.d.ts.map +1 -1
  470. package/dist/internal/testing/conversation-identity-vectors.js +67 -0
  471. package/dist/internal/testing/hosted-http.d.ts +15 -0
  472. package/dist/internal/testing/hosted-http.d.ts.map +1 -0
  473. package/dist/internal/testing/hosted-http.js +86 -0
  474. package/dist/internal/testing/teams-activity-fixtures.d.ts +28 -0
  475. package/dist/internal/testing/teams-activity-fixtures.d.ts.map +1 -0
  476. package/dist/internal/testing/teams-activity-fixtures.js +236 -0
  477. package/dist/internal/testing/teams-doctor-fixtures.d.ts +76 -0
  478. package/dist/internal/testing/teams-doctor-fixtures.d.ts.map +1 -0
  479. package/dist/internal/testing/teams-doctor-fixtures.js +216 -0
  480. package/dist/internal/tunnel-process.d.ts +29 -0
  481. package/dist/internal/tunnel-process.d.ts.map +1 -0
  482. package/dist/internal/tunnel-process.js +105 -0
  483. package/dist/internal/turn-context.d.ts +28 -0
  484. package/dist/internal/turn-context.d.ts.map +1 -0
  485. package/dist/internal/turn-context.js +1 -0
  486. package/dist/oidc-token.d.ts +127 -0
  487. package/dist/oidc-token.d.ts.map +1 -0
  488. package/dist/oidc-token.js +221 -0
  489. package/dist/playground/assets/index-BaBSZXki.css +1 -0
  490. package/dist/playground/assets/index-BkAF8YlO.js +62 -0
  491. package/dist/playground/index.html +2 -2
  492. package/dist/teams-app-package.d.ts +78 -0
  493. package/dist/teams-app-package.d.ts.map +1 -0
  494. package/dist/teams-app-package.js +204 -0
  495. package/dist/tools.d.ts +1 -1
  496. package/dist/tools.d.ts.map +1 -1
  497. package/dist/types.d.ts +278 -2
  498. package/dist/types.d.ts.map +1 -1
  499. package/docs/changelog.md +51 -0
  500. package/docs/deployment.md +10 -0
  501. package/docs/guides/cloud-agents.md +47 -0
  502. package/docs/guides/teams.md +389 -0
  503. package/docs/reference/channels.md +1 -0
  504. package/docs/reference/cli.md +116 -0
  505. package/docs/reference/limits.md +4 -4
  506. package/docs/reference/sessions.md +13 -0
  507. package/docs/troubleshooting.md +21 -0
  508. package/package.json +21 -46
  509. package/skills/create-agent/SKILL.md +17 -4
  510. package/skills/debug/SKILL.md +1 -0
  511. package/skills/deploy/SKILL.md +1 -1
  512. package/skills/framework-map/SKILL.md +1 -0
  513. package/skills/setup-teams/SKILL.md +141 -0
  514. package/templates/agentic-owners/bot/lib/owners/parse.ts +1 -0
  515. package/dist/channels/slack/event-id-dedupe.d.ts +0 -10
  516. package/dist/channels/slack/event-id-dedupe.d.ts.map +0 -1
  517. package/dist/docs/assets/changelog.md.BMrJ5WxW.js +0 -1
  518. package/dist/docs/assets/chunks/@localSearchIndexroot.dUaE1f8e.js +0 -1
  519. package/dist/docs/assets/chunks/channel.ljJtQtBi.js +0 -1
  520. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.BZ3Uc-XU.js +0 -1
  521. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.BZ3Uc-XU.js +0 -1
  522. package/dist/docs/assets/chunks/clone.BDtbEo69.js +0 -1
  523. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CbhzVsQE.js +0 -1
  524. package/dist/docs/assets/chunks/wardley-RL74JXVD.BFIVMaoi.js +0 -162
  525. package/dist/docs/assets/guides_cloud-agents.md.CiXAW6on.js +0 -9
  526. package/dist/docs/assets/troubleshooting.md.DfKKvW1R.js +0 -3
  527. package/dist/playground/assets/index-D0-FHg1x.css +0 -1
  528. package/dist/playground/assets/index-D5SLKUy6.js +0 -62
  529. /package/dist/docs/assets/{reference_channels.md.CPWOpdsC.lean.js → reference_channels.md.CRvqgU0n.lean.js} +0 -0
  530. /package/dist/docs/assets/{reference_schedules.md.RhQ9ZLo1.lean.js → reference_schedules.md.Dd8_d0WG.lean.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{_ as y,s as Nt,g as zt,t as At,q as Xt,a as Ct,b as Et,l as et,L as Tt,e as Yt,A as Bt,c as H,i as Rt}from"../app.CYdjweqP.js";import{p as Ft}from"./chunk-4BX2VUAB.Bbh3_48g.js";import{p as Ot}from"./wardley-RL74JXVD.BFIVMaoi.js";import"./framework.BNw1pucY.js";import"./theme.CgKu7tr3.js";import"./min.DpQtsLKs.js";import"./baseUniq.L47qqpDG.js";var q=y((a,r)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),Y=y((a,r,e)=>({x:q(r,`${e} evolution`),y:q(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),It=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const r=/^\+'([^']*)'/.exec(a),e=r==null?void 0:r[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=y((a,r)=>{if(Ft(a,r),a.size&&r.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(o=>o.secondName?`${o.name.trim()} / ${o.secondName.trim()}`:o.name.trim()),h=a.evolution.stages.filter(o=>o.boundary!==void 0).map(o=>o.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(a.anchors.forEach(e=>{const h=Y(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),a.components.forEach(e=>{var v;const h=Y(e.visibility,e.evolution,`Component "${e.name}"`),o=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",o,d,e.inertia,m)}),a.notes.forEach(e=>{const h=Y(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),a.pipelines.forEach(e=>{const h=r.getNode(e.parent);if(!h||typeof h.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const o=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,X=q(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(m,d.name,X,o,"pipeline-component",v,g),r.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const h=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let o=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=It(e.arrow);!o&&d&&(o=d);const v=e.linkLabel,g=m??v;r.addLink(e.from,e.to,h,g,o)}),a.evolves.forEach(e=>{const h=r.getNode(e.component);if((h==null?void 0:h.y)!==void 0){const o=q(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,o,h.y)}}),a.annotations.length>0){const e=a.annotations[0],h=Y(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}a.annotation.forEach(e=>{const h=Y(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),a.accelerators.forEach(e=>{const h=Y(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),a.deaccelerators.forEach(e=>{const h=Y(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var h;const r=await Ot("wardley",a);et.debug(r);const e=(h=at.parser)==null?void 0:h.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(r,e)},"parse")},R,Dt=(R=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const h=this.pipelines.get(r);h&&h.componentIds.push(e);const o=this.nodes.get(e);o&&(o.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(R,"WardleyBuilder"),R),P=new Dt;function L(a){const r=H();return Rt(a.trim(),r)}y(L,"textSanitizer");function rt(){return H()["wardley-beta"]}y(rt,"getConfig");function ot(a,r,e,h,o,d,m,v,g){P.addNode({id:a,label:L(r),x:e,y:h,className:o,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,r,e=!1,h,o){P.addLink({source:a,target:r,dashed:e,label:h,flow:o})}y(st,"addLink");function nt(a,r,e){P.addTrend({nodeId:a,targetX:r,targetY:e})}y(nt,"addTrend");function it(a,r,e){P.addAnnotation({number:a,coordinates:r,text:e?L(e):void 0})}y(it,"addAnnotation");function dt(a,r,e){P.addNote({text:L(a),x:r,y:e})}y(dt,"addNote");function lt(a,r,e){P.addAccelerator({name:L(a),x:r,y:e})}y(lt,"addAccelerator");function ct(a,r,e){P.addDeaccelerator({name:L(a),x:r,y:e})}y(ct,"addDeaccelerator");function pt(a,r){P.setAnnotationsBox(a,r)}y(pt,"setAnnotationsBox");function ht(a,r){P.setSize(a,r)}y(ht,"setSize");function xt(a){P.startPipeline(a)}y(xt,"startPipeline");function ft(a,r){P.addPipelineComponent(a,r)}y(ft,"addPipelineComponent");function gt(a){const r={};a.xLabel&&(r.xLabel=L(a.xLabel)),a.yLabel&&(r.yLabel=L(a.yLabel)),a.stages&&(r.stages=a.stages.map(e=>L(e))),a.stageBoundaries&&(r.stageBoundaries=a.stageBoundaries),P.setAxes(r)}y(gt,"updateAxes");function ut(a){return P.getNode(a)}y(ut,"getNode");function yt(){return P.build()}y(yt,"getWardleyData");function mt(){P.clear(),Bt()}y(mt,"clear");var Gt={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,getWardleyData:yt,clear:mt,setAccTitle:Et,getAccTitle:Ct,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:zt,setAccDescription:Nt},qt=["Genesis","Custom Built","Product","Commodity"],Ht=y(()=>{var r,e,h,o,d,m,v,g,X,M,b,N;const{themeVariables:a}=H();return{backgroundColor:((r=a.wardley)==null?void 0:r.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((h=a.wardley)==null?void 0:h.axisTextColor)??a.primaryTextColor??"#222",gridColor:((o=a.wardley)==null?void 0:o.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((X=a.wardley)==null?void 0:X.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((b=a.wardley)==null?void 0:b.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),jt=y(()=>{const a=H()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),_t=y((a,r,e,h)=>{var K,Q;et.debug(`Rendering Wardley map
1
+ import{_ as y,s as Nt,g as zt,t as At,q as Xt,a as Ct,b as Et,l as et,L as Tt,e as Yt,A as Bt,c as H,i as Rt}from"../app.Ch-048af.js";import{p as Ft}from"./chunk-4BX2VUAB.CRftnUwS.js";import{p as Ot}from"./wardley-RL74JXVD.DQqE3WF8.js";import"./framework.BNw1pucY.js";import"./theme.bNyH5NPA.js";import"./min.3YwC0t3o.js";import"./baseUniq.B4y6Y5eG.js";var q=y((a,r)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),Y=y((a,r,e)=>({x:q(r,`${e} evolution`),y:q(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),It=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const r=/^\+'([^']*)'/.exec(a),e=r==null?void 0:r[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=y((a,r)=>{if(Ft(a,r),a.size&&r.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(o=>o.secondName?`${o.name.trim()} / ${o.secondName.trim()}`:o.name.trim()),h=a.evolution.stages.filter(o=>o.boundary!==void 0).map(o=>o.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(a.anchors.forEach(e=>{const h=Y(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),a.components.forEach(e=>{var v;const h=Y(e.visibility,e.evolution,`Component "${e.name}"`),o=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",o,d,e.inertia,m)}),a.notes.forEach(e=>{const h=Y(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),a.pipelines.forEach(e=>{const h=r.getNode(e.parent);if(!h||typeof h.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const o=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,X=q(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(m,d.name,X,o,"pipeline-component",v,g),r.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const h=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let o=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=It(e.arrow);!o&&d&&(o=d);const v=e.linkLabel,g=m??v;r.addLink(e.from,e.to,h,g,o)}),a.evolves.forEach(e=>{const h=r.getNode(e.component);if((h==null?void 0:h.y)!==void 0){const o=q(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,o,h.y)}}),a.annotations.length>0){const e=a.annotations[0],h=Y(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}a.annotation.forEach(e=>{const h=Y(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),a.accelerators.forEach(e=>{const h=Y(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),a.deaccelerators.forEach(e=>{const h=Y(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var h;const r=await Ot("wardley",a);et.debug(r);const e=(h=at.parser)==null?void 0:h.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(r,e)},"parse")},R,Dt=(R=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const h=this.pipelines.get(r);h&&h.componentIds.push(e);const o=this.nodes.get(e);o&&(o.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(R,"WardleyBuilder"),R),P=new Dt;function L(a){const r=H();return Rt(a.trim(),r)}y(L,"textSanitizer");function rt(){return H()["wardley-beta"]}y(rt,"getConfig");function ot(a,r,e,h,o,d,m,v,g){P.addNode({id:a,label:L(r),x:e,y:h,className:o,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,r,e=!1,h,o){P.addLink({source:a,target:r,dashed:e,label:h,flow:o})}y(st,"addLink");function nt(a,r,e){P.addTrend({nodeId:a,targetX:r,targetY:e})}y(nt,"addTrend");function it(a,r,e){P.addAnnotation({number:a,coordinates:r,text:e?L(e):void 0})}y(it,"addAnnotation");function dt(a,r,e){P.addNote({text:L(a),x:r,y:e})}y(dt,"addNote");function lt(a,r,e){P.addAccelerator({name:L(a),x:r,y:e})}y(lt,"addAccelerator");function ct(a,r,e){P.addDeaccelerator({name:L(a),x:r,y:e})}y(ct,"addDeaccelerator");function pt(a,r){P.setAnnotationsBox(a,r)}y(pt,"setAnnotationsBox");function ht(a,r){P.setSize(a,r)}y(ht,"setSize");function xt(a){P.startPipeline(a)}y(xt,"startPipeline");function ft(a,r){P.addPipelineComponent(a,r)}y(ft,"addPipelineComponent");function gt(a){const r={};a.xLabel&&(r.xLabel=L(a.xLabel)),a.yLabel&&(r.yLabel=L(a.yLabel)),a.stages&&(r.stages=a.stages.map(e=>L(e))),a.stageBoundaries&&(r.stageBoundaries=a.stageBoundaries),P.setAxes(r)}y(gt,"updateAxes");function ut(a){return P.getNode(a)}y(ut,"getNode");function yt(){return P.build()}y(yt,"getWardleyData");function mt(){P.clear(),Bt()}y(mt,"clear");var Gt={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,getWardleyData:yt,clear:mt,setAccTitle:Et,getAccTitle:Ct,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:zt,setAccDescription:Nt},qt=["Genesis","Custom Built","Product","Commodity"],Ht=y(()=>{var r,e,h,o,d,m,v,g,X,M,b,N;const{themeVariables:a}=H();return{backgroundColor:((r=a.wardley)==null?void 0:r.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((h=a.wardley)==null?void 0:h.axisTextColor)??a.primaryTextColor??"#222",gridColor:((o=a.wardley)==null?void 0:o.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((X=a.wardley)==null?void 0:X.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((b=a.wardley)==null?void 0:b.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),jt=y(()=>{const a=H()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),_t=y((a,r,e,h)=>{var K,Q;et.debug(`Rendering Wardley map
2
2
  `+a);const o=jt(),d=Ht(),m=o.nodeRadius*1.6,v=h.db,g=v.getWardleyData(),X=v.getDiagramTitle(),M=((K=g.size)==null?void 0:K.width)??o.width,b=((Q=g.size)==null?void 0:Q.height)??o.height,N=Tt(r);N.selectAll("*").remove(),Yt(N,b,M,o.useMaxWidth),N.attr("viewBox",`0 0 ${M} ${b}`);const S=N.append("g").attr("class","wardley-map"),j=N.append("defs");j.append("marker").attr("id",`arrow-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),j.append("marker").attr("id",`link-arrow-end-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),j.append("marker").attr("id",`link-arrow-start-${r}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),S.append("rect").attr("class","wardley-background").attr("width",M).attr("height",b).attr("fill",d.backgroundColor);const F=M-o.padding*2,O=b-o.padding*2;X&&S.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",o.padding/2).attr("fill",d.axisTextColor).attr("font-size",o.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(X);const C=y(t=>o.padding+t/100*F,"projectX"),E=y(t=>b-o.padding-t/100*O,"projectY"),W=S.append("g").attr("class","wardley-axes");W.append("line").attr("x1",o.padding).attr("x2",M-o.padding).attr("y1",b-o.padding).attr("y2",b-o.padding).attr("stroke",d.axisColor).attr("stroke-width",1),W.append("line").attr("x1",o.padding).attr("x2",o.padding).attr("y1",o.padding).attr("y2",b-o.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const wt=g.axes.xLabel??"Evolution",bt=g.axes.yLabel??"Visibility";W.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",o.padding+F/2).attr("y",b-o.padding/4).attr("fill",d.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(wt),W.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",o.padding/3).attr("y",o.padding+O/2).attr("fill",d.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${o.padding/3} ${o.padding+O/2})`).text(bt);const I=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:qt;if(I.length>0){const t=S.append("g").attr("class","wardley-stages"),n=g.axes.stageBoundaries,s=[];if(n&&n.length===I.length){let i=0;n.forEach(p=>{s.push({start:i,end:p}),i=p})}else{const i=1/I.length;I.forEach((p,l)=>{s.push({start:l*i,end:(l+1)*i})})}I.forEach((i,p)=>{const l=s[p],x=o.padding+l.start*F,f=o.padding+l.end*F,u=(x+f)/2;p>0&&t.append("line").attr("x1",x).attr("x2",x).attr("y1",o.padding).attr("y2",b-o.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",b-o.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",o.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(o.showGrid){const t=S.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){const s=n/4,i=o.padding+F*s;t.append("line").attr("x1",i).attr("x2",i).attr("y1",o.padding).attr("y2",b-o.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",o.padding).attr("x2",M-o.padding).attr("y1",b-o.padding-O*s).attr("y2",b-o.padding-O*s).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:C(t.x),y:E(t.y),node:t})}),g.pipelines.length>0){const t=S.append("g").attr("class","wardley-pipelines"),n=S.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(s=>{if(s.componentIds.length===0)return;const i=s.componentIds.map(f=>({id:f,pos:c.get(f),node:g.nodes.find(u=>u.id===f)})).filter(f=>f.pos&&f.node).sort((f,u)=>f.node.x-u.node.x);for(let f=0;f<i.length-1;f++){const u=i[f],w=i[f+1];n.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",u.pos.x).attr("y1",u.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let p=1/0,l=-1/0,x=0;if(s.componentIds.forEach(f=>{const u=c.get(f);u&&(p=Math.min(p,u.x),l=Math.max(l,u.x),x=u.y)}),p!==1/0&&l!==-1/0){const u=o.nodeRadius*4,w=x-u/2,$=c.get(s.nodeId);if($){const A=(p+l)/2;$.x=A,$.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",p-15).attr("y",w).attr("width",l-p+15*2).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const Z=S.append("g").attr("class","wardley-links"),U=new Map;g.pipelines.forEach(t=>{U.set(t.nodeId,new Set(t.componentIds))});const J=g.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const n=U.get(t.target);return!(n!=null&&n.has(t.source))});Z.selectAll("line").data(J).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const n=c.get(t.source),s=c.get(t.target),p=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):o.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.x+l/f*p}).attr("y1",t=>{const n=c.get(t.source),s=c.get(t.target),p=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):o.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.y+x/f*p}).attr("x2",t=>{const n=c.get(t.source),s=c.get(t.target),p=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):o.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.x+l/f*p}).attr("y2",t=>{const n=c.get(t.source),s=c.get(t.target),p=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):o.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.y+x/f*p}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${r})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${r})`:null),Z.selectAll("text").data(J.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,p=s.y-n.y,l=s.x-n.x,x=Math.sqrt(l*l+p*p),f=8,u=p/x;return i+u*f}).attr("y",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.y+s.y)/2,p=s.x-n.x,l=s.y-n.y,x=Math.sqrt(p*p+l*l),f=8,u=-p/x;return i+u*f}).attr("fill",d.axisTextColor).attr("font-size",o.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,p=(n.y+s.y)/2,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x),u=8,w=x/f,$=-l/f,A=i+w*u,D=p+$*u;let B=Math.atan2(x,l)*180/Math.PI;return(B>90||B<-90)&&(B+=180),`rotate(${B} ${A} ${D})`}).text(t=>t.label);const kt=S.append("g").attr("class","wardley-trends"),Pt=g.trends.map(t=>{const n=c.get(t.nodeId);if(!n)return null;const s=C(t.targetX),i=E(t.targetY),p=s-n.x,l=i-n.y,x=Math.sqrt(p*p+l*l),f=o.nodeRadius+2,u=x>f?s-p/x*f:s,w=x>f?i-l/x*f:i;return{origin:n,targetX:s,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);kt.selectAll("line").data(Pt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${r})`);const z=S.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));z.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),z.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),z.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const T=z.filter(t=>t.sourceStrategy==="market");T.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),z.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",o.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const _=o.nodeRadius*.7,k=o.nodeRadius*1.2;if(T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-k).attr("x2",t=>c.get(t.id).x-k*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+k*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-k*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+k*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+k*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+k*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+k*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+k*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-k).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-k).attr("r",_).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-k*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+k*Math.sin(Math.PI/6)).attr("r",_).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+k*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+k*Math.sin(Math.PI/6)).attr("r",_).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),z.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),z.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:o.nodeRadius+15;return t.sourceStrategy&&(s+=o.nodeRadius+10),n.x+s}).attr("y1",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:o.nodeRadius*2;return n.y-s/2}).attr("x2",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:o.nodeRadius+15;return t.sourceStrategy&&(s+=o.nodeRadius+10),n.x+s}).attr("y2",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:o.nodeRadius*2;return n.y+s/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),z.append("text").attr("x",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let s=o.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(s+=10);const i=t.labelOffsetX??s;return n.x+i}).attr("y",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let s=-o.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(s-=10);const i=t.labelOffsetY??s;return n.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",o.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=S.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(n=>{const s=n.coordinates.map(i=>({x:C(i.x),y:E(i.y)}));if(s.length>1)for(let i=0;i<s.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",s[i].x).attr("y1",s[i].y).attr("x2",s[i+1].x).attr("y2",s[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");s.forEach(i=>{const p=t.append("g").attr("class","wardley-annotation");p.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),p.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.number)})}),g.annotationsBox){let n=C(g.annotationsBox.x),s=E(g.annotationsBox.y);const i=10,p=16,l=11,x=t.append("g").attr("class","wardley-annotations-box"),f=[...g.annotations].filter(w=>w.text).sort((w,$)=>w.number-$.number),u=[];if(f.forEach((w,$)=>{const A=x.append("text").attr("x",n+i).attr("y",s+i+($+1)*p).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(A)}),u.length>0){let w=0,$=0;u.forEach(V=>{const G=V.node(),Mt=G.getComputedTextLength();w=Math.max(w,Mt);const Lt=G.getBBox();$=Math.max($,Lt.height)});const A=w+i*2+105,D=f.length*p+i*2+$/2,B=o.padding,vt=M-o.padding-A,St=o.padding,$t=b-o.padding-D;n=Math.max(B,Math.min(n,vt)),s=Math.max(St,Math.min(s,$t)),u.forEach((V,G)=>{V.attr("x",n+i).attr("y",s+i+(G+1)*p)}),x.insert("rect","text").attr("x",n).attr("y",s).attr("width",A).attr("height",D).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=S.append("g").attr("class","wardley-notes");g.notes.forEach(n=>{const s=C(n.x),i=E(n.y);t.append("text").attr("x",s).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.text)})}if(g.accelerators.length>0){const t=S.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(n=>{const s=C(n.x),i=E(n.y),p=60,l=30,x=20,f=`
3
3
  M ${s} ${i-l/2}
4
4
  L ${s+p-x} ${i-l/2}
@@ -1,4 +1,4 @@
1
- import{_ as a,s as gi,g as xi,t as Xt,q as di,a as fi,b as pi,l as Yt,L as mi,e as yi,A as bi,F as _t,H as Nt,I as Ai,a1 as wi,i as Ci,aC as Si,a9 as Wt}from"../app.CYdjweqP.js";import{i as _i}from"./init.Gi6I4Gst.js";import{o as ki}from"./ordinal.DBvzRdQf.js";import{l as zt}from"./linear.NmCskOrP.js";import"./framework.BNw1pucY.js";import"./theme.CgKu7tr3.js";import"./defaultLocale.C4B-KCzX.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function bt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,p=!1,f=0,T=0,P=.5;delete e.unknown;function _(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-f+T*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var I=Ri(y).map(function(m){return v+o*m});return i(E?I.reverse():I)}return e.domain=function(y){return arguments.length?(t(y),_()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,_()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,_()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,_()):p},e.padding=function(y){return arguments.length?(f=Math.min(1,T=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(T=+y,_()):T},e.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),_()):P},e.copy=function(){return bt(t(),[s,n]).round(p).paddingInner(f).paddingOuter(T).align(P)},_i.apply(_(),arguments)}var At=function(){var e=a(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],T=[1,26],P=[1,28],_=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],I=[1,34],m=[1,35],R=[1,36],l=[1,37],W=[1,43],O=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],U=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],b=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],w=[1,64],V={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,C,r,rt){var d=r.length-1;switch(C){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:39,13:38,24:W,27:O,29:40,30:41,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:49,17:48,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:52,17:51,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(U,[2,37],{40:55,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l}),e(U,[2,38]),e(U,[2,39]),e(b,[2,40]),e(b,[2,42]),e(b,[2,43]),e(b,[2,44]),e(b,[2,45]),e(b,[2,46]),e(b,[2,47]),e(b,[2,48]),e(b,[2,49]),e(b,[2,50]),e(b,[2,51]),e(S,[2,10]),e(S,[2,22],{30:41,29:56,24:W,27:O}),e(S,[2,24]),e(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,11]),e(S,[2,30],{33:60,27:X}),e(S,[2,32]),{31:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:w},e(S,[2,14]),{17:65,24:Y},e(S,[2,16]),e(S,[2,17]),e(b,[2,41]),e(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(S,[2,31]),{27:[1,69]},e(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(S,[2,15]),e(S,[2,26]),e(S,[2,27]),{11:59,32:72,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,33]),e(S,[2,19]),{25:73,27:w},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],C=[null],r=[],rt=this.table,d="",ct=0,It=0,hi=2,Mt=1,li=r.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&($.yy[ft]=this.yy[ft]);D.setInput(h,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ci=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(B){g.length=g.length-2*B,C.length=C.length-B,r.length=r.length-B}a(ui,"popStack");function Vt(){var B;return B=x.pop()||D.lex()||Mt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}a(Vt,"lex");for(var M,q,z,mt,G={},ut,N,Bt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?z=this.defaultActions[q]:((M===null||typeof M>"u")&&(M=Vt()),z=rt[q]&&rt[q][M]),typeof z>"u"||!z.length||!z[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>hi&&gt.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
1
+ import{_ as a,s as gi,g as xi,t as Xt,q as di,a as fi,b as pi,l as Yt,L as mi,e as yi,A as bi,F as _t,H as Nt,I as Ai,a1 as wi,i as Ci,aC as Si,a9 as Wt}from"../app.Ch-048af.js";import{i as _i}from"./init.Gi6I4Gst.js";import{o as ki}from"./ordinal.DBvzRdQf.js";import{l as zt}from"./linear.BRXPDWj3.js";import"./framework.BNw1pucY.js";import"./theme.bNyH5NPA.js";import"./defaultLocale.C4B-KCzX.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function bt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,p=!1,f=0,T=0,P=.5;delete e.unknown;function _(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-f+T*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var I=Ri(y).map(function(m){return v+o*m});return i(E?I.reverse():I)}return e.domain=function(y){return arguments.length?(t(y),_()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,_()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,_()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,_()):p},e.padding=function(y){return arguments.length?(f=Math.min(1,T=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(T=+y,_()):T},e.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),_()):P},e.copy=function(){return bt(t(),[s,n]).round(p).paddingInner(f).paddingOuter(T).align(P)},_i.apply(_(),arguments)}var At=function(){var e=a(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],T=[1,26],P=[1,28],_=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],I=[1,34],m=[1,35],R=[1,36],l=[1,37],W=[1,43],O=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],U=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],b=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],w=[1,64],V={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,C,r,rt){var d=r.length-1;switch(C){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:39,13:38,24:W,27:O,29:40,30:41,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:49,17:48,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:52,17:51,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(U,[2,37],{40:55,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l}),e(U,[2,38]),e(U,[2,39]),e(b,[2,40]),e(b,[2,42]),e(b,[2,43]),e(b,[2,44]),e(b,[2,45]),e(b,[2,46]),e(b,[2,47]),e(b,[2,48]),e(b,[2,49]),e(b,[2,50]),e(b,[2,51]),e(S,[2,10]),e(S,[2,22],{30:41,29:56,24:W,27:O}),e(S,[2,24]),e(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,11]),e(S,[2,30],{33:60,27:X}),e(S,[2,32]),{31:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:w},e(S,[2,14]),{17:65,24:Y},e(S,[2,16]),e(S,[2,17]),e(b,[2,41]),e(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(S,[2,31]),{27:[1,69]},e(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(S,[2,15]),e(S,[2,26]),e(S,[2,27]),{11:59,32:72,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,33]),e(S,[2,19]),{25:73,27:w},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],C=[null],r=[],rt=this.table,d="",ct=0,It=0,hi=2,Mt=1,li=r.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&($.yy[ft]=this.yy[ft]);D.setInput(h,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ci=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(B){g.length=g.length-2*B,C.length=C.length-B,r.length=r.length-B}a(ui,"popStack");function Vt(){var B;return B=x.pop()||D.lex()||Mt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}a(Vt,"lex");for(var M,q,z,mt,G={},ut,N,Bt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?z=this.defaultActions[q]:((M===null||typeof M>"u")&&(M=Vt()),z=rt[q]&&rt[q][M]),typeof z>"u"||!z.length||!z[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>hi&&gt.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
2
2
  `+D.showPosition()+`
3
3
  Expecting `+gt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":yt="Parse error on line "+(ct+1)+": Unexpected "+(M==Mt?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(yt,{text:D.match,token:this.terminals_[M]||M,line:D.yylineno,loc:pt,expected:gt})}if(z[0]instanceof Array&&z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+M);switch(z[0]){case 1:g.push(M),C.push(D.yytext),r.push(D.yylloc),g.push(z[1]),M=null,It=D.yyleng,d=D.yytext,ct=D.yylineno,pt=D.yylloc;break;case 2:if(N=this.productions_[z[1]][1],G.$=C[C.length-N],G._$={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},ci&&(G._$.range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(G,[d,It,ct,$.yy,z[1],C,r].concat(li)),typeof mt<"u")return mt;N&&(g=g.slice(0,-1*N*2),C=C.slice(0,-1*N),r=r.slice(0,-1*N)),g.push(this.productions_[z[1]][0]),C.push(G.$),r.push(G._$),Bt=rt[g[g.length-2]][g[g.length-1]],g.push(Bt);break;case 3:return!0}}return!0},"parse")},k=function(){var F={EOF:1,parseError:a(function(c,g){if(this.yy.parser)this.yy.parser.parseError(c,g);else throw new Error(c)},"parseError"),setInput:a(function(h,c){return this.yy=c||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var c=h.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var c=h.length,g=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),c=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
@@ -20,7 +20,7 @@ import{_ as e,c as a,o as t,a3 as i}from"./chunks/framework.BNw1pucY.js";const c
20
20
  <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> logs</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --prod</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --slug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> weather-agent</span></span></code></pre></div><p>Without <code>--wait</code>, the command returns before the session exists, so the output has no <code>sessionId</code> yet. A long turn can show <code>running</code> with no logs for several minutes. If the event count keeps going up, the turn is still working.</p><h3 id="send-work-to-the-deployment" tabindex="-1">Send work to the deployment <a class="header-anchor" href="#send-work-to-the-deployment" aria-label="Permalink to &quot;Send work to the deployment&quot;">​</a></h3><p>Call a custom route on the stable alias URL with the alias token:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$AGENT_ALIAS_URL</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">/v1/channels/tickets/ticket&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
21
21
  <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;X-Agent-Alias-Token: </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$AGENT_ALIAS_TOKEN</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
22
22
  <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;content-type: application/json&#39;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
23
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;ticketId&quot;:&quot;ENG-142&quot;,&quot;message&quot;:&quot;CSV export returns 500&quot;}&#39;</span></span></code></pre></div><p>See <a href="./reference/channels.html#route-responses">Route responses</a> for what the caller gets back. To confirm the work started, run <code>agent-sdk session list --prod --slug weather-agent</code>.</p><h3 id="protect-the-alias-token" tabindex="-1">Protect the alias token <a class="header-anchor" href="#protect-the-alias-token" aria-label="Permalink to &quot;Protect the alias token&quot;">​</a></h3><p>The first deploy prints the alias token once. If it leaks or you lose it, run <code>agent-sdk deployment rotate-token weather-agent</code>. Output from <code>deployment --json</code> can include access headers, so guard it the same way.</p><p>Use <a href="./guides/webhooks.html"><code>publicEndpoint()</code></a> only for a webhook provider that can&#39;t send the token and whose signature the channel verifies.</p><h2 id="update-the-deployment" tabindex="-1">Update the deployment <a class="header-anchor" href="#update-the-deployment" aria-label="Permalink to &quot;Update the deployment&quot;">​</a></h2><p>Push the new ref and deploy the same slug. Each redeploy replaces the watched repositories, so pass every <code>--cursor-events-repo</code> value again, or the deployment watches only its GitHub source repository. Run <code>agent-sdk deployment get weather-agent</code> to check a rollout.</p><h2 id="keep-state-across-replacements" tabindex="-1">Keep state across replacements <a class="header-anchor" href="#keep-state-across-replacements" aria-label="Permalink to &quot;Keep state across replacements&quot;">​</a></h2><p>Sessions, <code>ctx.host.kv</code>, and <code>ctx.host.files</code> survive restarts and redeploys. Anything else the agent writes to disk can disappear.</p><h2 id="self-host-securely" tabindex="-1">Self-host securely <a class="header-anchor" href="#self-host-securely" aria-label="Permalink to &quot;Self-host securely&quot;">​</a></h2><p>Run Agent SDK under Node 22.13 or newer, never Bun. One process can serve every agent under a directory:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> CURSOR_API_KEY</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&lt;cursor-api-key&gt;&quot;</span></span>
23
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;{&quot;ticketId&quot;:&quot;ENG-142&quot;,&quot;message&quot;:&quot;CSV export returns 500&quot;}&#39;</span></span></code></pre></div><p>See <a href="./reference/channels.html#route-responses">Route responses</a> for what the caller gets back. To confirm the work started, run <code>agent-sdk session list --prod --slug weather-agent</code>.</p><h3 id="protect-the-alias-token" tabindex="-1">Protect the alias token <a class="header-anchor" href="#protect-the-alias-token" aria-label="Permalink to &quot;Protect the alias token&quot;">​</a></h3><p>The first deploy prints the alias token once. If it leaks or you lose it, run <code>agent-sdk deployment rotate-token weather-agent</code>. Output from <code>deployment --json</code> can include access headers, so guard it the same way.</p><p>Use <a href="./guides/webhooks.html"><code>publicEndpoint()</code></a> only for a webhook provider that can&#39;t send the token and whose signature the channel verifies.</p><h2 id="update-the-deployment" tabindex="-1">Update the deployment <a class="header-anchor" href="#update-the-deployment" aria-label="Permalink to &quot;Update the deployment&quot;">​</a></h2><p>Push the new ref and deploy the same slug. Each redeploy replaces the watched repositories, so pass every <code>--cursor-events-repo</code> value again, or the deployment watches only its GitHub source repository. Run <code>agent-sdk deployment get weather-agent</code> to check a rollout.</p><h2 id="keep-state-across-replacements" tabindex="-1">Keep state across replacements <a class="header-anchor" href="#keep-state-across-replacements" aria-label="Permalink to &quot;Keep state across replacements&quot;">​</a></h2><p>Sessions, <code>ctx.host.kv</code>, and <code>ctx.host.files</code> survive restarts and redeploys. Anything else the agent writes to disk can disappear.</p><h2 id="startup-runs-before-secrets-are-available" tabindex="-1">Startup runs before secrets are available <a class="header-anchor" href="#startup-runs-before-secrets-are-available" aria-label="Permalink to &quot;Startup runs before secrets are available&quot;">​</a></h2><p>A hosted deploy starts your agent once to take a snapshot, before its secrets, including <code>CURSOR_API_KEY</code>, are available. They arrive when a session starts. Do not call the Cursor API, hosted storage, or reminders at startup. Call them from a handler. Startup log lines such as <code>requires CURSOR_API_KEY (deployment pod credential on Cursor hosting)</code> come from this step and are expected.</p><h2 id="self-host-securely" tabindex="-1">Self-host securely <a class="header-anchor" href="#self-host-securely" aria-label="Permalink to &quot;Self-host securely&quot;">​</a></h2><p>Run Agent SDK under Node 22.13 or newer, never Bun. One process can serve every agent under a directory:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> CURSOR_API_KEY</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&lt;cursor-api-key&gt;&quot;</span></span>
24
24
  <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> AGENT_SDK_BEARER_TOKEN</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;$(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">openssl</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> rand </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">-hex</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 32</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">)&quot;</span></span>
25
25
  <span class="line"></span>
26
26
  <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> serve</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
@@ -28,4 +28,4 @@ import{_ as e,c as a,o as t,a3 as i}from"./chunks/framework.BNw1pucY.js";const c
28
28
  <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --host</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 127.0.0.1</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
29
29
  <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --port</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 3000</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
30
30
  <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --state-root</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /var/lib/agent-sdk</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
31
- <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --bearer-token</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$AGENT_SDK_BEARER_TOKEN</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;</span></span></code></pre></div><p>Before you expose the host:</p><ul><li>Put TLS or an authenticating proxy in front of the server.</li><li>Keep <code>--bearer-token</code> unless a proxy authenticates every caller.</li><li>Keep <code>--state-root</code> on a backed-up persistent volume outside the repository.</li><li>Turn on schedules in only one process per project.</li></ul><p>In a container, use <code>--host 0.0.0.0</code> behind an authenticating network boundary.</p>`,50)])])}const g=e(n,[["render",o]]);export{c as __pageData,g as default};
31
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --bearer-token</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$AGENT_SDK_BEARER_TOKEN</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;</span></span></code></pre></div><p>Before you expose the host:</p><ul><li>Put TLS or an authenticating proxy in front of the server.</li><li>Keep <code>--bearer-token</code> unless a proxy authenticates every caller.</li><li>Keep <code>--state-root</code> on a backed-up persistent volume outside the repository.</li><li>Turn on schedules in only one process per project.</li></ul><p>In a container, use <code>--host 0.0.0.0</code> behind an authenticating network boundary.</p>`,52)])])}const g=e(n,[["render",o]]);export{c as __pageData,g as default};
@@ -1 +1 @@
1
- import{_ as e,c as a,o as t,a3 as i}from"./chunks/framework.BNw1pucY.js";const c=JSON.parse('{"title":"Deployment","description":"Deploy an Agent SDK project from Git with Cursor-managed hosting, or run one secure process on your own infrastructure.","frontmatter":{"title":"Deployment","description":"Deploy an Agent SDK project from Git with Cursor-managed hosting, or run one secure process on your own infrastructure."},"headers":[],"relativePath":"deployment.md","filePath":"deployment.md"}'),n={name:"deployment.md"};function o(h,s,l,r,p,d){return t(),a("div",null,[...s[0]||(s[0]=[i("",50)])])}const g=e(n,[["render",o]]);export{c as __pageData,g as default};
1
+ import{_ as e,c as a,o as t,a3 as i}from"./chunks/framework.BNw1pucY.js";const c=JSON.parse('{"title":"Deployment","description":"Deploy an Agent SDK project from Git with Cursor-managed hosting, or run one secure process on your own infrastructure.","frontmatter":{"title":"Deployment","description":"Deploy an Agent SDK project from Git with Cursor-managed hosting, or run one secure process on your own infrastructure."},"headers":[],"relativePath":"deployment.md","filePath":"deployment.md"}'),n={name:"deployment.md"};function o(h,s,l,r,p,d){return t(),a("div",null,[...s[0]||(s[0]=[i("",52)])])}const g=e(n,[["render",o]]);export{c as __pageData,g as default};
@@ -0,0 +1,14 @@
1
+ import{_ as t,c as s,o as a,a3 as n}from"./chunks/framework.BNw1pucY.js";const u=JSON.parse('{"title":"Cursor cloud agents","description":"Let an Agent SDK agent hand coding work to Cursor cloud agents and steer them: mount the extension and pick the repositories it may touch.","frontmatter":{"title":"Cursor cloud agents","description":"Let an Agent SDK agent hand coding work to Cursor cloud agents and steer them: mount the extension and pick the repositories it may touch."},"headers":[],"relativePath":"guides/cloud-agents.md","filePath":"guides/cloud-agents.md"}'),i={name:"guides/cloud-agents.md"};function o(h,e,d,l,r,c){return a(),s("div",null,[...e[0]||(e[0]=[n(`<h1 id="cloud-agents" tabindex="-1">Cloud agents <a class="header-anchor" href="#cloud-agents" aria-label="Permalink to &quot;Cloud agents&quot;">​</a></h1><p>The <code>cursor-cloud-agents</code> extension lets an Agent SDK agent hand coding work to Cursor cloud agents. A cloud agent works in a repository checkout and pushes branches and pull requests while your agent keeps talking to the person.</p><h2 id="mount-it" tabindex="-1">Mount it <a class="header-anchor" href="#mount-it" aria-label="Permalink to &quot;Mount it&quot;">​</a></h2><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// bot/extensions/cloud.ts</span></span>
2
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> cursorCloudAgents </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk/extensions/cursor-cloud-agents&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
3
+ <span class="line"></span>
4
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> cursorCloudAgents</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
5
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> cloud: {</span></span>
6
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> repos: [{ url: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://github.com/acme/api&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, startingRef: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;main&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }],</span></span>
7
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> autoCreatePR: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
8
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
9
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Launches run under the host&#39;s signed-in account (<code>agent-sdk login</code>, <code>CURSOR_API_KEY</code>, or <code>CURSOR_SERVICE_ACCOUNT_KEY</code>) and spend its cloud-agent budget.</p><h2 id="what-the-agent-can-do" tabindex="-1">What the agent can do <a class="header-anchor" href="#what-the-agent-can-do" aria-label="Permalink to &quot;What the agent can do&quot;">​</a></h2><p>With the extension mounted, the agent can launch a cloud agent on a repository or pull request, check its status, read its conversation and edits, steer or stop it, and list the agents it launched. A bundled skill teaches the model when to delegate and how to write a brief a cloud agent can act on alone.</p><p>Each caller can only see and steer the cloud agents they launched. If every caller uses the same bearer token, the extension treats them all as one person. Use <a href="./../reference/channels.html#auth-policies">authored auth</a> to keep callers apart.</p><p>When a cloud agent the conversation launched stops, the extension wakes that conversation once. The wake message gives the agent id and its status, and tells the model to call <code>cloud__get</code>. That tool returns the agent&#39;s <code>result</code>, the final answer of its latest run.</p><p>On Cursor hosting, the wake comes when the agent&#39;s run stops. This includes a run that someone else cancels. If the wake does not reach the conversation, the extension tries again every minute, up to 10 times. You configure nothing for this.</p><p>Nothing polls the agent. If no wake comes, ask the bot to check the agent with <code>cloud__get</code>. A stop in the middle of a turn does not wake the conversation yet. The extension stops waiting for a wake after 24 hours.</p><p>Some launches get no wake: launches off Cursor hosting, launches from a mount that sets its own <code>apiKey</code>, and launches with <code>envVars</code>. A launch that Cursor hosting cannot watch also gets no wake. For these launches, the launch result says <code>watching: false</code>. Ask the bot to check the agent when you need its result.</p><h2 id="read-a-result-from-your-code" tabindex="-1">Read a result from your code <a class="header-anchor" href="#read-a-result-from-your-code" aria-label="Permalink to &quot;Read a result from your code&quot;">​</a></h2><p>Your own code, such as a tool or a reminder, can launch a cloud agent with <code>launchCloudAgent</code> and read it back with <code>getCloudAgent</code>. When the agent has stopped and its latest run finished, <code>result</code> holds the final answer of that run. An errored or expired run has no <code>result</code>. Ask the agent to end with its report or its JSON, and parse <code>result</code>.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { getCloudAgent } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk/extensions/cursor-cloud-agents&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
10
+ <span class="line"></span>
11
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> agent</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> await</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> getCloudAgent</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(agentId);</span></span>
12
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (agent.status </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">===</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;finished&quot;</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &amp;&amp;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> agent.result </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">!==</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> undefined</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
13
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> report</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> JSON</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">parse</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(agent.result);</span></span>
14
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p><code>getCloudAgent</code> does not check who launched the agent. Pass only ids that your code launched, never an id that a model chose.</p><p><code>launchCloudAgent</code> takes an optional <code>agentId</code>, a <code>bc-&lt;uuid&gt;</code>. When you omit it, the extension makes one. To retry a launch that timed out or failed, pass the same <code>agentId</code> again. If the first launch created the agent, you get that agent back and no second agent starts. The extension returns an existing agent only when this principal launched it through the extension. A launch with <code>cloud.envVars</code> cannot take an <code>agentId</code>.</p><h2 id="configure-it" tabindex="-1">Configure it <a class="header-anchor" href="#configure-it" aria-label="Permalink to &quot;Configure it&quot;">​</a></h2><table tabindex="0"><thead><tr><th>Option</th><th>What it controls</th></tr></thead><tbody><tr><td><code>cloud</code></td><td>Launch defaults for repositories, environment, and pull request behavior.</td></tr><tr><td><code>cloud.repos</code></td><td>The repositories the agent may hand work to, each with a default branch or pull request. Without it, launches run with no repository, so secrets in <code>cloud.envVars</code> never reach a repository you didn&#39;t list.</td></tr><tr><td><code>cloud.teamMcpServers</code></td><td>Up to 50 team MCP server names that launched agents may use, matched case-insensitively. Omit it to allow every team server the account can use. Personal servers and <code>cloud.mcpServers</code> aren&#39;t filtered.</td></tr><tr><td><code>model</code></td><td>The model launched agents run. Omit it to use the account default.</td></tr><tr><td><code>apiKey</code></td><td>A Cursor API key to launch with instead of the host&#39;s own.</td></tr></tbody></table><h2 id="adjust-it" tabindex="-1">Adjust it <a class="header-anchor" href="#adjust-it" aria-label="Permalink to &quot;Adjust it&quot;">​</a></h2><p>To remove a capability such as sending follow-ups, mount the extension as a directory and disable that tool. See <a href="./../reference/extensions.html#adjust-a-mounted-extension">Adjust a mounted extension</a>.</p>`,21)])])}const k=t(i,[["render",o]]);export{u as __pageData,k as default};
@@ -1 +1 @@
1
- import{_ as t,c as a,o as s,a3 as n}from"./chunks/framework.BNw1pucY.js";const p=JSON.parse('{"title":"Cursor cloud agents","description":"Let an Agent SDK agent hand coding work to Cursor cloud agents and steer them: mount the extension and pick the repositories it may touch.","frontmatter":{"title":"Cursor cloud agents","description":"Let an Agent SDK agent hand coding work to Cursor cloud agents and steer them: mount the extension and pick the repositories it may touch."},"headers":[],"relativePath":"guides/cloud-agents.md","filePath":"guides/cloud-agents.md"}'),i={name:"guides/cloud-agents.md"};function o(d,e,r,l,h,c){return s(),a("div",null,[...e[0]||(e[0]=[n("",12)])])}const k=t(i,[["render",o]]);export{p as __pageData,k as default};
1
+ import{_ as t,c as s,o as a,a3 as n}from"./chunks/framework.BNw1pucY.js";const u=JSON.parse('{"title":"Cursor cloud agents","description":"Let an Agent SDK agent hand coding work to Cursor cloud agents and steer them: mount the extension and pick the repositories it may touch.","frontmatter":{"title":"Cursor cloud agents","description":"Let an Agent SDK agent hand coding work to Cursor cloud agents and steer them: mount the extension and pick the repositories it may touch."},"headers":[],"relativePath":"guides/cloud-agents.md","filePath":"guides/cloud-agents.md"}'),i={name:"guides/cloud-agents.md"};function o(h,e,d,l,r,c){return a(),s("div",null,[...e[0]||(e[0]=[n("",21)])])}const k=t(i,[["render",o]]);export{u as __pageData,k as default};
@@ -0,0 +1,50 @@
1
+ import{_ as e,c as a,o as t,a3 as i}from"./chunks/framework.BNw1pucY.js";const k=JSON.parse('{"title":"Microsoft Teams","description":"Answer mentions, personal chats, and watched channel posts in Microsoft Teams with your own Azure Bot.","frontmatter":{"title":"Microsoft Teams","description":"Answer mentions, personal chats, and watched channel posts in Microsoft Teams with your own Azure Bot."},"headers":[],"relativePath":"guides/teams.md","filePath":"guides/teams.md"}'),n={name:"guides/teams.md"};function o(h,s,l,p,d,r){return t(),a("div",null,[...s[0]||(s[0]=[i(`<h1 id="microsoft-teams-agents" tabindex="-1">Microsoft Teams agents <a class="header-anchor" href="#microsoft-teams-agents" aria-label="Permalink to &quot;Microsoft Teams agents&quot;">​</a></h1><p>A Teams agent wakes when someone @mentions it in a channel or group chat, messages it in a personal chat, or posts in a channel it watches. It answers in the same reply chain. <code>teamsChannel()</code> takes the same engagement options as <code>slackChannel()</code>, so an agent that already runs in Slack can run in Teams with the same shape of config.</p><p>The agent answers as an Azure Bot that you register and own. Teams sends each message to the bot&#39;s messaging endpoint, and the channel checks the Bot Framework token on every request before it starts a turn.</p><h2 id="set-up-with-the-cli" tabindex="-1">Set up with the CLI <a class="header-anchor" href="#set-up-with-the-cli" aria-label="Permalink to &quot;Set up with the CLI&quot;">​</a></h2><p>The <code>agent-sdk channels teams</code> commands do every step except the clicks in the Azure portal and in Teams:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> channels</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> teams</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> setup</span></span>
2
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">printf</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> %s</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$CLIENT_SECRET</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> |</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> channels</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> teams</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> init</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
3
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --app-id</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">microsoft-app-i</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">d</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&gt;</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --tenant-id</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">app-tenant-i</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">d</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&gt;</span></span>
4
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> channels</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> teams</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> package</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span></span>
5
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> dev</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span></span>
6
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> channels</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> teams</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> doctor</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --endpoint</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> &lt;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">printed</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> UR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">L</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&gt;</span></span></code></pre></div><ol><li><code>setup</code> prints the Azure portal steps in <a href="#register-the-azure-bot">Register the Azure Bot</a>.</li><li><code>init</code> writes <code>bot/channels/teams.ts</code> and puts the app id, the client secret, and the tenant id in <code>.env.local</code>. It reads the secret from a hidden prompt or stdin, never from an argument.</li><li><code>package</code> writes <code>helm-teams-app.zip</code>. Upload it in Teams, as <a href="#install-the-bot-in-teams">Install the bot in Teams</a> describes.</li><li><code>dev</code> opens a tunnel and prints the messaging endpoint. Set it on the Azure Bot.</li><li><code>doctor</code> checks the env names, the token, the Azure Bot, and the endpoint, and names the part that fails.</li></ol><p>The <a href="./../reference/cli.html#teams">CLI reference</a> lists every flag. The rest of this guide explains what the commands write and how the channel behaves.</p><h2 id="answer-a-mention-or-personal-chat" tabindex="-1">Answer a mention or personal chat <a class="header-anchor" href="#answer-a-mention-or-personal-chat" aria-label="Permalink to &quot;Answer a mention or personal chat&quot;">​</a></h2><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// bot/channels/teams.ts</span></span>
7
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { teamsChannel } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk/channels/teams&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
8
+ <span class="line"></span>
9
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">();</span></span></code></pre></div><p>By default the agent answers @mentions in channels and group chats, and every message in a personal chat. While a turn runs, Teams shows the typing indicator, and the reply arrives as one message in the reply chain. In a channel, each reply chain is its own conversation. A personal chat and a group chat have no reply chains, so each one is a single conversation.</p><p>The channel reads three variables:</p><table tabindex="0"><thead><tr><th>Variable</th><th>Value</th></tr></thead><tbody><tr><td><code>TEAMS_APP_ID</code></td><td>The Azure Bot&#39;s Microsoft App ID</td></tr><tr><td><code>TEAMS_APP_PASSWORD</code></td><td>A client secret of that app registration</td></tr><tr><td><code>TEAMS_TENANT_ID</code></td><td>Required. The home tenant of your single-tenant Azure Bot</td></tr></tbody></table><p>The Azure Bot is a single-tenant bot in your own tenant, because Azure does not create new multi-tenant bots after July 31, 2025. The channel mints its Bot Connector token in that tenant and ignores activities from any other tenant. To run several agents in one <code>agent-sdk dev</code>, give each its own bot and an <code>envPrefix</code>. <code>channels teams init --prefix HELPDESK</code> writes it for you. The prefix starts with a letter.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ envPrefix: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;HELPDESK&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span>
10
+ <span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// HELPDESK_TEAMS_APP_ID, HELPDESK_TEAMS_APP_PASSWORD, HELPDESK_TEAMS_TENANT_ID</span></span></code></pre></div><p>The channel file owns these names. When the file exists, <code>init</code> writes the names it reads, and <code>doctor</code> and <code>package</code> read them from the loaded channel.</p><h2 id="register-the-azure-bot" tabindex="-1">Register the Azure Bot <a class="header-anchor" href="#register-the-azure-bot" aria-label="Permalink to &quot;Register the Azure Bot&quot;">​</a></h2><ol><li>In the Azure portal, create an <strong>Azure Bot</strong> resource. Set <strong>Type of App</strong> to <strong>Single Tenant</strong> and <strong>Creation type</strong> to <strong>Create new Microsoft App ID</strong>.</li><li>Open the bot&#39;s <strong>Configuration</strong> page. Copy <strong>Microsoft App ID</strong> and <strong>App Tenant ID</strong>. <code>init</code> takes them as <code>--app-id</code> and <code>--tenant-id</code>.</li><li>From <strong>Configuration</strong>, open <strong>Manage Password</strong>, add a client secret, and copy its value. Azure shows the value once. <code>init</code> reads it from the hidden prompt or stdin.</li><li>Under <strong>Channels</strong>, add <strong>Microsoft Teams</strong>.</li><li>Set <strong>Messaging endpoint</strong> to the URL in <a href="#messaging-endpoint">Messaging endpoint</a>, or for a hosted deploy, the URL in <a href="#deploy">Deploy</a>.</li></ol><h2 id="install-the-bot-in-teams" tabindex="-1">Install the bot in Teams <a class="header-anchor" href="#install-the-bot-in-teams" aria-label="Permalink to &quot;Install the bot in Teams&quot;">​</a></h2><p>Teams installs a bot from an app package: a zip of <code>manifest.json</code> and two icons. <code>agent-sdk channels teams package</code> builds it from the channel. The <code>bots</code> entry names the Azure Bot by its app ID and the places people can talk to it:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
11
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;id&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&lt;TEAMS_APP_ID&gt;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
12
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;bots&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span></span>
13
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
14
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;botId&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&lt;TEAMS_APP_ID&gt;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
15
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;scopes&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;personal&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;team&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;groupChat&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">],</span></span>
16
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;isNotificationOnly&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span></span>
17
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
18
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ]</span></span>
19
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>A full manifest also needs <code>manifestVersion</code>, <code>version</code>, <code>developer</code>, <code>name</code>, <code>description</code>, <code>icons</code>, and <code>accentColor</code>; see the <a href="https://learn.microsoft.com/microsoftteams/platform/resources/schema/manifest-schema" target="_blank" rel="noreferrer">app manifest schema</a>. Upload the package in Teams under <strong>Apps</strong> &gt; <strong>Manage your apps</strong> &gt; <strong>Upload an app</strong>, or have a Teams admin publish it to your organization in the Teams admin center. Then add the app to a team, a group chat, or a personal chat.</p><h2 id="wake-on-a-channel-post" tabindex="-1">Wake on a channel post <a class="header-anchor" href="#wake-on-a-channel-post" aria-label="Permalink to &quot;Wake on a channel post&quot;">​</a></h2><p>Teams sends a channel post without a mention only to an app that holds the resource-specific consent permission <code>ChannelMessage.Read.Group</code>. <code>package</code> adds it when the channel sets <code>engagement.channelPosts</code>, and a team owner grants it when they add the app to the team:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
20
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;webApplicationInfo&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: { </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">&quot;id&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&lt;TEAMS_APP_ID&gt;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
21
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;authorization&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
22
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;permissions&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
23
+ <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;resourceSpecific&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [{ </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">&quot;name&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;ChannelMessage.Read.Group&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">&quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Application&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }]</span></span>
24
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
25
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
26
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>Then name the channels to watch. Copy a channel&#39;s ID from its <strong>Get link to channel</strong> URL: it&#39;s the <code>19:…@thread.tacv2</code> part.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
27
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> engagement: {</span></span>
28
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> channelPosts: {</span></span>
29
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> allow: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;19:4b7c2f9e1d6a4e8f9a3b5c7d1e2f3a4b@thread.tacv2&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">],</span></span>
30
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> posts: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;all&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
31
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
32
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
33
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Watched posts go to <code>onChannelPost</code> when you set it, the same way mentions go to <code>onAppMention</code> and personal chats to <code>onDirectMessage</code>. Return <code>null</code> from a hook to skip a message. <code>posts</code> is <code>&quot;top-level&quot;</code> (the default), <code>&quot;replies&quot;</code>, or <code>&quot;all&quot;</code>. Use <code>allow: [&quot;*&quot;]</code> to watch every channel the app is in, and <code>replies: &quot;joined&quot;</code> to also answer replies in any reply chain the agent already answered. Bot posts stay out unless you set <code>includeBotPosts: true</code>; the agent&#39;s own posts never start a turn.</p><p>To let another bot wake the agent with an @mention, list it in <code>engagement.botMentions.allowFrom</code> as <code>28:&lt;its app ID&gt;</code>. Each thread allows 5 bot wakes an hour and 20 in total by default (<code>maxPerThreadPerHour</code>, <code>maxPerThreadTotal</code>).</p><h2 id="stream-the-reply" tabindex="-1">Stream the reply <a class="header-anchor" href="#stream-the-reply" aria-label="Permalink to &quot;Stream the reply&quot;">​</a></h2><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ reply: { mode: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;stream&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } });</span></span></code></pre></div><p>In stream mode the agent posts one message as soon as it starts working. That message names the tool the agent is running until text arrives, then fills in as the reply grows, and it ends as the final answer. Teams limits how often a bot can edit a message, so the channel edits at most once every 1.5 seconds; set <code>updateIntervalMs</code> to change that.</p><h2 id="approve-tool-calls-in-teams" tabindex="-1">Approve tool calls in Teams <a class="header-anchor" href="#approve-tool-calls-in-teams" aria-label="Permalink to &quot;Approve tool calls in Teams&quot;">​</a></h2><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ toolApprovals: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> });</span></span></code></pre></div><p>When a server tool with <code>needsApproval</code> is about to run, the agent posts an Adaptive Card in the thread with the tool&#39;s arguments, secrets redacted, and <strong>Approve</strong> and <strong>Deny</strong> buttons. Anyone who could continue the conversation can decide; set <code>policy: { respondTo: &quot;author&quot; }</code> to limit that, and follow-ups, to the person who started it. After the click, the card shows the decision and who made it.</p><p>For your own cards, handle other <code>Action.Submit</code> clicks in <code>onCardAction</code>, which receives the submitted data and can start a turn in the card&#39;s thread.</p><h2 id="refuse-guests-and-other-tenants" tabindex="-1">Refuse guests and other tenants <a class="header-anchor" href="#refuse-guests-and-other-tenants" aria-label="Permalink to &quot;Refuse guests and other tenants&quot;">​</a></h2><p>By default the channel answers only members and owners of the bot&#39;s tenant. It asks Teams for the sender&#39;s role and tenant. It refuses a guest, an anonymous meeting user, or a person from another organization. This applies when they message the agent and when they click a card. <strong>Approve</strong> and <strong>Deny</strong> are card clicks. A sender with no role is refused. A sender Teams does not list is refused too.</p><p>The agent posts one short reply to a refused sender. It posts at most once per conversation and sender per hour. The default text is &quot;I can only help members of this organization. Ask the agent owner to allow guests.&quot;</p><p>Set <code>policy.refusalMessage</code> to change the default text. Set <code>policy.refusalMessage</code> to <code>false</code> to stay silent. Silence applies to a refused sender and to a sender the lookup could not verify.</p><p>A failed lookup gets the reply &quot;I couldn&#39;t verify your access, try again shortly.&quot; The agent does not reply to a card click from a refused sender. The agent ignores a card click from a bot, including a bot that <code>engagement.botMentions</code> allows. The agent does not reply to an activity from another tenant.</p><p>To let guests and external members in, set <code>blockExternals</code> to <code>false</code>.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({ policy: { blockExternals: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } });</span></span></code></pre></div><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
34
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> policy: {</span></span>
35
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> refusalMessage: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Ask your team owner to add you to this organization.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
36
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
37
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h2 id="welcome-message" tabindex="-1">Welcome message <a class="header-anchor" href="#welcome-message" aria-label="Permalink to &quot;Welcome message&quot;">​</a></h2><p>When someone installs the app in a conversation, the agent posts one greeting there. Teams reports the install as an <code>installationUpdate</code> activity whose action is <code>add</code>. The greeting does not start a model turn. The agent posts it once per conversation.</p><p>The default text is &quot;Hi! Mention me in a channel, or message me here, to get started.&quot;</p><p>Set <code>welcome</code> to change the greeting. Set <code>welcome</code> to <code>false</code> to turn it off.</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> teamsChannel</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
38
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> welcome: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;Hi. Mention me when you want help with a laptop.&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
39
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><h2 id="messaging-endpoint" tabindex="-1">Messaging endpoint <a class="header-anchor" href="#messaging-endpoint" aria-label="Permalink to &quot;Messaging endpoint&quot;">​</a></h2><p>Under <code>agent-sdk dev</code> or self-hosted <code>agent-sdk serve</code>, the Azure Bot&#39;s messaging endpoint is the server&#39;s public origin plus the channel&#39;s path:</p><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>https://&lt;origin&gt;/&lt;slug&gt;/v1/channels/&lt;channel&gt;</span></span></code></pre></div><p><code>&lt;slug&gt;</code> is the agent&#39;s slug and <code>&lt;channel&gt;</code> is the channel file&#39;s name, so <code>bot/channels/teams.ts</code> in the <code>helm</code> agent answers at <code>https://&lt;origin&gt;/helm/v1/channels/teams</code>. The URL has no trailing slash. With <code>teamsChannel({ path: &quot;/messages&quot; })</code>, the channel appends that path: <code>https://&lt;origin&gt;/helm/v1/channels/teams/messages</code>. A hosted deploy has a different URL; see <a href="#deploy">Deploy</a>.</p><h2 id="test-locally" tabindex="-1">Test locally <a class="header-anchor" href="#test-locally" aria-label="Permalink to &quot;Test locally&quot;">​</a></h2><p>Teams reaches the bot only at a public HTTPS URL. <code>agent-sdk dev</code> opens a <code>cloudflared</code> tunnel and prints the messaging endpoint on the tunnel&#39;s origin:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> dev</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span></span></code></pre></div><p>Copy the printed URL into the Azure Bot&#39;s <strong>Messaging endpoint</strong>, then mention the bot in Teams. <code>--tunnel devtunnel</code> keeps one URL across restarts. Next to a plain <code>agent-sdk serve</code>, <code>agent-sdk channels teams forward</code> opens the same tunnel. <code>agent-sdk dev --mode single</code> serves one agent without a slug, so its endpoint is <code>https://&lt;origin&gt;/v1/channels/teams</code>. Without <code>--mode single</code>, the endpoint includes the agent&#39;s slug: <code>https://&lt;origin&gt;/helm/v1/channels/teams</code>.</p><p>To run your own tunnel instead, serve with plain <code>agent-sdk serve</code>, which opens no tunnel, and point <code>cloudflared</code> at its port:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> serve</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./helm</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --mode</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> single</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --port</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 3978</span></span>
40
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cloudflared</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> tunnel</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --url</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://localhost:3978</span></span></code></pre></div><p>Add <code>--protocol http2</code> to <code>cloudflared</code> if your network blocks QUIC. Set the Azure Bot&#39;s <strong>Messaging endpoint</strong> to the printed <code>&lt;public-url&gt;</code> plus <code>/v1/channels/teams</code>, or <code>&lt;public-url&gt;/helm/v1/channels/teams</code> without <code>--mode single</code>. The built-in tunnel forwards only <code>POST</code> requests to the Teams messaging paths. A tunnel you run yourself exposes every route on the port.</p><p>Requests through a tunnel always get the Bot Framework token check, so only Teams can start turns there. A tunnel adds proxy headers or forwards its public hostname, and the dev exception for unsigned activities refuses both. To replay a saved activity without Teams, POST it to the same path on <code>http://127.0.0.1:&lt;port&gt;</code> from the same machine; <code>agent-sdk dev</code> admits unsigned activities from loopback only.</p><h2 id="deploy" tabindex="-1">Deploy <a class="header-anchor" href="#deploy" aria-label="Permalink to &quot;Deploy&quot;">​</a></h2><p>Hosted, the agent needs its three secrets:</p><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// bot/agent.ts</span></span>
41
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { defineAgent } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;@grok/agent-sdk&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
42
+ <span class="line"></span>
43
+ <span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> defineAgent</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">({</span></span>
44
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> hosting: {</span></span>
45
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> secretNames: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;TEAMS_APP_ID&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;TEAMS_APP_PASSWORD&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;TEAMS_TENANT_ID&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">],</span></span>
46
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
47
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>Hosting adds the Microsoft hosts that a Teams channel calls (<code>login.microsoftonline.com</code>, <code>login.botframework.com</code>, and <code>smba.trafficmanager.net</code>), so you do not list them in <code>egressDomains</code>. Your team&#39;s network settings still apply to them. If your team restricts egress, its allowlist must include all three hosts, or the agent&#39;s replies fail.</p><p>An <code>envPrefix</code> changes the secret names. With <code>teamsChannel({ envPrefix: &quot;ECHO&quot; })</code>, list <code>ECHO_TEAMS_APP_ID</code>, <code>ECHO_TEAMS_APP_PASSWORD</code>, and <code>ECHO_TEAMS_TENANT_ID</code> in <code>secretNames</code>, and set those names with <code>agent-sdk secret set</code>.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> deploy</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --dir</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --slug</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> helpdesk</span></span>
48
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> secret</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> set</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> helpdesk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> TEAMS_APP_ID</span></span>
49
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> secret</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> set</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> helpdesk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> TEAMS_APP_PASSWORD</span></span>
50
+ <span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> secret</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> set</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> helpdesk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> TEAMS_TENANT_ID</span></span></code></pre></div><p><code>agent-sdk deploy</code> prints the hosted messaging endpoint on a <code>public:</code> line that ends in <code>/v1/channels/teams</code>. Set the Azure Bot&#39;s <strong>Messaging endpoint</strong> to that URL, not to the slug URL from local testing. With a custom <code>path</code>, add it after the printed URL.</p><p>On hosting, Cursor checks the Bot Framework token and the tenant before the agent starts. Activities that the channel cannot act on, such as a reaction or an unmentioned post outside <code>channelPosts</code>, stop there and use no compute. Each personal or group chat is one session, and each channel reply chain is one session. Tool approvals work on hosting: an Approve or Deny click reaches the turn that waits for it, and a call that nobody approves in 10 minutes is denied.</p><p>Hosting runs Teams channels only in the commercial Microsoft cloud, and only for teams that have Teams channels turned on. The deploy fails otherwise.</p><h2 id="how-teams-differs-from-slack" tabindex="-1">How Teams differs from Slack <a class="header-anchor" href="#how-teams-differs-from-slack" aria-label="Permalink to &quot;How Teams differs from Slack&quot;">​</a></h2><table tabindex="0"><thead><tr><th></th><th>Slack</th><th>Teams</th></tr></thead><tbody><tr><td>App</td><td>Your Slack app&#39;s bot and app tokens</td><td>Your Azure Bot&#39;s app ID, client secret, and tenant</td></tr><tr><td>Local transport</td><td>Socket Mode, no public URL</td><td><code>agent-sdk dev</code> opens a tunnel to the messaging endpoint</td></tr><tr><td>Watch channel posts</td><td><code>message.channels</code> subscription</td><td><code>ChannelMessage.Read.Group</code> consent at install</td></tr><tr><td>Threads</td><td>Every message can start a thread</td><td>Reply chains in channels; personal and group chats are one conversation each</td></tr><tr><td>Bot-to-bot wakes</td><td><code>maxDepth</code> from message metadata, plus per-thread caps</td><td>Per-thread caps only</td></tr><tr><td>Progress</td><td>Status chip, streaming API, tool and reasoning cards</td><td>Typing indicator, or one edited message in stream mode</td></tr><tr><td>Approvals</td><td>Block Kit buttons</td><td>Adaptive Card buttons</td></tr><tr><td>Hosted sessions</td><td>One per thread</td><td>One per chat, or one per channel reply chain</td></tr><tr><td>Not available in Teams</td><td></td><td>Reactions, file uploads and downloads, suggested prompts, <code>eval</code> commands, edit debounce</td></tr></tbody></table><h2 id="related" tabindex="-1">Related <a class="header-anchor" href="#related" aria-label="Permalink to &quot;Related&quot;">​</a></h2><ul><li><a href="./slack.html">Slack</a></li><li><a href="./webhooks.html">Webhooks</a></li><li><a href="./../deployment.html">Deployment</a></li><li><a href="./../reference/channels.html">Channels reference</a></li></ul>`,74)])])}const g=e(n,[["render",o]]);export{k as __pageData,g as default};
@@ -0,0 +1 @@
1
+ import{_ as e,c as a,o as t,a3 as i}from"./chunks/framework.BNw1pucY.js";const k=JSON.parse('{"title":"Microsoft Teams","description":"Answer mentions, personal chats, and watched channel posts in Microsoft Teams with your own Azure Bot.","frontmatter":{"title":"Microsoft Teams","description":"Answer mentions, personal chats, and watched channel posts in Microsoft Teams with your own Azure Bot."},"headers":[],"relativePath":"guides/teams.md","filePath":"guides/teams.md"}'),n={name:"guides/teams.md"};function o(h,s,l,p,d,r){return t(),a("div",null,[...s[0]||(s[0]=[i("",74)])])}const g=e(n,[["render",o]]);export{k as __pageData,g as default};
@@ -18,4 +18,4 @@ import{_ as t,c as s,o as a,a3 as n}from"./chunks/framework.BNw1pucY.js";const u
18
18
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
19
19
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }),</span></span>
20
20
  <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ],</span></span>
21
- <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>This route is <code>POST /v1/channels/&lt;id&gt;/review</code>. Calls for the same pull request pass the same <a href="./sessions.html#session-identifiers">continuation token</a>, so they share one conversation.</p><h2 id="route-responses" tabindex="-1">Route responses <a class="header-anchor" href="#route-responses" aria-label="Permalink to &quot;Route responses&quot;">​</a></h2><p>On Cursor hosting, the deployment answers every custom route with an empty <code>202 Accepted</code> as soon as the request arrives, then runs the handler. The caller never sees the handler&#39;s <code>Response</code>, so a route can&#39;t return a session ID, a result, or an error status. A request that fails the alias token, <code>sharedSecretAuth</code>, or <code>hmacSignatureAuth</code> check still gets <code>401</code>.</p><p>Deliver results through <a href="#events"><code>events</code></a> handlers, a callback to the sender, or a tool the turn calls. Local <code>serve</code> returns the handler&#39;s response, so return <code>new Response(null, { status: 202 })</code> to match hosting.</p><h2 id="route-verbs-and-schemas" tabindex="-1">Route verbs and schemas <a class="header-anchor" href="#route-verbs-and-schemas" aria-label="Permalink to &quot;Route verbs and schemas&quot;">​</a></h2><p>Route paths must begin with <code>/</code>.</p><p><code>GET</code> requires a <code>querySchema</code>.</p><p><code>POST</code>, <code>PUT</code>, and <code>PATCH</code> require a <code>bodySchema</code>. They also accept a <code>querySchema</code>.</p><p><code>DELETE</code> takes a <code>bodySchema</code>, a <code>querySchema</code>, either, or neither.</p><p>Plain JSON Schema objects don&#39;t type-check, so use <code>z.object({})</code> or <code>z.unknown()</code> for an open surface. The host validates input before the handler runs, and declared schemas appear in <code>GET /v1/info</code> for the playground and slash commands.</p><h2 id="handler-arguments" tabindex="-1">Handler arguments <a class="header-anchor" href="#handler-arguments" aria-label="Permalink to &quot;Handler arguments&quot;">​</a></h2><p>A handler receives the Fetch <code>Request</code> and these arguments:</p><table tabindex="0"><thead><tr><th>Member</th><th>Contract</th></tr></thead><tbody><tr><td><code>send(message, options?)</code></td><td>Start or resume a session on this channel</td></tr><tr><td><code>getSession(sessionId)</code></td><td>This channel&#39;s session, or <code>null</code></td></tr><tr><td><code>receive(channel, input)</code></td><td>Hand work to another channel</td></tr><tr><td><code>callTool(name, input, options?)</code></td><td><a href="./tools.html#call-a-tool-without-a-model-turn">Call a server tool</a> without a model turn</td></tr><tr><td><code>body</code>, <code>query</code>, <code>params</code></td><td>Validated inputs and <code>:param</code> path segments</td></tr><tr><td><code>auth</code></td><td>The <code>AuthContext</code> from the route&#39;s auth chain</td></tr><tr><td><code>requestIp</code></td><td>The TCP peer address, or <code>null</code></td></tr><tr><td><code>host</code></td><td>Host services such as MCP, storage, telemetry, and reminders</td></tr><tr><td><code>waitUntil(promise)</code></td><td>Keep work running after the handler returns</td></tr><tr><td><code>sessionUrls(request, sessionId)</code></td><td>Playground and trace URLs for a session</td></tr><tr><td><code>artifacts</code></td><td>List or tag <a href="./artifacts.html">artifacts</a></td></tr></tbody></table><h3 id="send-options" tabindex="-1"><code>send</code> options <a class="header-anchor" href="#send-options" aria-label="Permalink to &quot;\`send\` options&quot;">​</a></h3><table tabindex="0"><thead><tr><th>Option</th><th>Contract</th></tr></thead><tbody><tr><td><code>continuationToken</code></td><td>Channel-local key that resumes its session, or creates one when new</td></tr><tr><td><code>admission</code></td><td><code>&quot;preempt&quot;</code> (the default) interrupts a busy turn. <code>&quot;coalesce&quot;</code> queues behind it</td></tr><tr><td><code>workspaceFiles</code></td><td>Relative files to add before the next turn</td></tr><tr><td><code>workspaceDir</code></td><td>Absolute local working directory</td></tr><tr><td><code>auth</code></td><td>Session principal. Defaults to the request principal</td></tr><tr><td><code>state</code></td><td>Starting channel state for a new session</td></tr><tr><td><code>title</code>, <code>purpose</code>, <code>dryRun</code>, <code>asOf</code></td><td>Set up a new session, as in the <a href="./http-api.html#start-a-session"><code>POST /v1/session</code> body</a></td></tr><tr><td><code>deliveryId</code></td><td>Names this send on the session&#39;s <a href="./sessions.html#track-which-follow-up-reached-the-agent">events</a>, up to 256 characters. Defaults to a fresh <code>dlv_…</code> ID</td></tr></tbody></table><p><code>send</code> returns a <code>ChannelSession</code> with <code>id</code>, the current <code>continuationToken</code>, <code>isNew</code>, and <code>coalesced: true</code> for a coalesced call. On Cursor hosting, it returns the ID before the session exists.</p><h2 id="events" tabindex="-1">Events <a class="header-anchor" href="#events" aria-label="Permalink to &quot;Events&quot;">​</a></h2><p>The <code>events</code> map subscribes the channel to stream events for its sessions. Keys are types from the <a href="./sessions.html#stream-events">event vocabulary</a>, or <code>&quot;*&quot;</code>. Each handler receives <code>(event, channel, ctx)</code> with <code>channel.state</code>, session info, and host services, so it can post progress and replies. <code>state</code> on the channel definition is each new session&#39;s starting JSON, unless a route passes <code>state</code> to <code>send</code>, and handlers update it through <code>channel.state</code>.</p><h2 id="start-and-stop-a-channel" tabindex="-1">Start and stop a channel <a class="header-anchor" href="#start-and-stop-a-channel" aria-label="Permalink to &quot;Start and stop a channel&quot;">​</a></h2><p><code>onStart(args)</code> runs when the channel mounts, and <code>onStop()</code> runs when the host stops. Besides the route helpers, <code>onStart</code> receives <code>emitAssistantMessage(sessionId, text)</code>, which appends assistant text without a model turn, and <code>hasContinuationSession</code>, <code>isContinuationBusy</code>, and <code>interruptContinuation</code>, which check or stop the session behind a token.</p><h2 id="auth-policies" tabindex="-1">Auth policies <a class="header-anchor" href="#auth-policies" aria-label="Permalink to &quot;Auth policies&quot;">​</a></h2><p>Every route runs the channel&#39;s <code>auth</code> array, which defaults to <code>[localDevStrict()]</code>. The first policy to return an <code>AuthContext</code> admits the request, and if every policy returns <code>null</code>, the route answers <code>401</code>.</p><table tabindex="0"><thead><tr><th>Policy</th><th>Admits</th></tr></thead><tbody><tr><td><code>localDevStrict()</code></td><td>Direct loopback requests with a loopback hostname and no forwarding headers</td></tr><tr><td><code>localDev()</code></td><td>The same, with any hostname</td></tr><tr><td><code>loopbackOnly()</code></td><td>Any loopback peer, including relays that add forwarding headers</td></tr><tr><td><code>bearerAuth(tokenOrVerify)</code></td><td>A matching bearer token, or one the verifier accepts</td></tr><tr><td><code>sharedSecretAuth({ header, secret })</code></td><td>A header that matches the named secret</td></tr><tr><td><code>hmacSignatureAuth({ header, secret, prefix?, separator? })</code></td><td>A hex HMAC-SHA256 signature of the raw body under the named secret, or any of several signatures split by <code>separator</code>. The secret can hold up to 32 values, one per line, and any of them verifies</td></tr><tr><td><code>allowAll()</code></td><td>Every caller, as an anonymous principal</td></tr><tr><td><code>publicEndpoint()</code></td><td>Every caller, with no alias token on hosting. The handler must verify the provider&#39;s signature</td></tr></tbody></table><p>Use <code>allowAll()</code> only for a public surface or one protected upstream. <code>publicEndpoint()</code> applies only to custom channel routes and doesn&#39;t open the built-in session or tool API.</p><p>The admitted <code>AuthContext</code> becomes the request principal, which <a href="./sessions.html#session-contents">owns the sessions it creates</a>.</p><p>On a channel without its own <code>auth</code>, <code>--bearer-token</code> swaps the default for <code>bearerAuth(...)</code> and <code>--allow-anonymous</code> swaps it for <code>allowAll()</code>.</p><h2 id="prebuilt-channels" tabindex="-1">Prebuilt channels <a class="header-anchor" href="#prebuilt-channels" aria-label="Permalink to &quot;Prebuilt channels&quot;">​</a></h2><p>Import each one from <code>@grok/agent-sdk/channels/&lt;name&gt;</code>.</p><table tabindex="0"><thead><tr><th>Function</th><th>Details</th></tr></thead><tbody><tr><td><code>slackChannel()</code></td><td><a href="./../guides/slack.html">Slack</a></td></tr><tr><td><code>githubChannel()</code></td><td><a href="./../guides/github.html">GitHub</a></td></tr><tr><td><code>gitlabChannel()</code></td><td><a href="./../guides/gitlab.html">GitLab</a></td></tr><tr><td><code>bitbucketChannel()</code></td><td><a href="./../guides/bitbucket.html">Bitbucket</a></td></tr><tr><td><code>pagerdutyChannel()</code></td><td><a href="./../guides/pagerduty.html">PagerDuty</a></td></tr><tr><td><code>deploymentsChannel()</code></td><td>Deployment events filtered by source, environment, or event name</td></tr></tbody></table><p>Use <code>defineChannel</code> for other platforms, such as Discord.</p><h2 id="handler-results" tabindex="-1">Handler results <a class="header-anchor" href="#handler-results" aria-label="Permalink to &quot;Handler results&quot;">​</a></h2><p>Hooks on the GitHub, GitLab, Bitbucket, and PagerDuty channels, such as <code>onPullRequest</code> or <code>onIncident</code>, return one of three results:</p><table tabindex="0"><thead><tr><th>Return value</th><th>What happens</th></tr></thead><tbody><tr><td><code>{ auth }</code></td><td>Runs the model turn with that auth. It can also set the turn&#39;s <code>message</code>, <code>title</code>, or <code>context</code></td></tr><tr><td><code>{ task }</code></td><td>Runs your function on the host. That function can call <code>send</code> to start a model turn</td></tr><tr><td><code>null</code></td><td>Ignores the event</td></tr></tbody></table><h2 id="hosted-session-keys" tabindex="-1">Hosted session keys <a class="header-anchor" href="#hosted-session-keys" aria-label="Permalink to &quot;Hosted session keys&quot;">​</a></h2><p>On Cursor hosting, each request to a <code>defineChannel</code> route starts a new session unless it carries <code>X-BDK-Session-Key</code>. Requests with the same value on one channel share one session, in arrival order. The handler&#39;s <code>continuationToken</code> doesn&#39;t change that choice, and local <code>serve</code> ignores the header.</p><table tabindex="0"><thead><tr><th>Rule</th><th>Contract</th></tr></thead><tbody><tr><td>Auth</td><td>The alias token or <code>sharedSecretAuth()</code>. Routes admitted by <code>hmacSignatureAuth()</code> or <code>publicEndpoint()</code> answer <code>400</code></td></tr><tr><td>Value</td><td>1 to 256 printable ASCII characters with no space or comma, or the request gets <code>400</code>. Hosting stores the value, so keep secrets and personal data out of it</td></tr><tr><td>Scope</td><td>One channel on one deployment. Prebuilt channels ignore the header</td></tr><tr><td>Retries</td><td>Hosting doesn&#39;t deduplicate. A retry runs a second turn</td></tr></tbody></table><h2 id="related" tabindex="-1">Related <a class="header-anchor" href="#related" aria-label="Permalink to &quot;Related&quot;">​</a></h2><ul><li><a href="./../guides/webhooks.html">Webhooks</a></li><li><a href="./sessions.html">Sessions</a></li></ul>`,43)])])}const k=t(i,[["render",o]]);export{u as __pageData,k as default};
21
+ <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">});</span></span></code></pre></div><p>This route is <code>POST /v1/channels/&lt;id&gt;/review</code>. Calls for the same pull request pass the same <a href="./sessions.html#session-identifiers">continuation token</a>, so they share one conversation.</p><h2 id="route-responses" tabindex="-1">Route responses <a class="header-anchor" href="#route-responses" aria-label="Permalink to &quot;Route responses&quot;">​</a></h2><p>On Cursor hosting, the deployment answers every custom route with an empty <code>202 Accepted</code> as soon as the request arrives, then runs the handler. The caller never sees the handler&#39;s <code>Response</code>, so a route can&#39;t return a session ID, a result, or an error status. A request that fails the alias token, <code>sharedSecretAuth</code>, or <code>hmacSignatureAuth</code> check still gets <code>401</code>.</p><p>Deliver results through <a href="#events"><code>events</code></a> handlers, a callback to the sender, or a tool the turn calls. Local <code>serve</code> returns the handler&#39;s response, so return <code>new Response(null, { status: 202 })</code> to match hosting.</p><h2 id="route-verbs-and-schemas" tabindex="-1">Route verbs and schemas <a class="header-anchor" href="#route-verbs-and-schemas" aria-label="Permalink to &quot;Route verbs and schemas&quot;">​</a></h2><p>Route paths must begin with <code>/</code>.</p><p><code>GET</code> requires a <code>querySchema</code>.</p><p><code>POST</code>, <code>PUT</code>, and <code>PATCH</code> require a <code>bodySchema</code>. They also accept a <code>querySchema</code>.</p><p><code>DELETE</code> takes a <code>bodySchema</code>, a <code>querySchema</code>, either, or neither.</p><p>Plain JSON Schema objects don&#39;t type-check, so use <code>z.object({})</code> or <code>z.unknown()</code> for an open surface. The host validates input before the handler runs, and declared schemas appear in <code>GET /v1/info</code> for the playground and slash commands.</p><h2 id="handler-arguments" tabindex="-1">Handler arguments <a class="header-anchor" href="#handler-arguments" aria-label="Permalink to &quot;Handler arguments&quot;">​</a></h2><p>A handler receives the Fetch <code>Request</code> and these arguments:</p><table tabindex="0"><thead><tr><th>Member</th><th>Contract</th></tr></thead><tbody><tr><td><code>send(message, options?)</code></td><td>Start or resume a session on this channel</td></tr><tr><td><code>getSession(sessionId)</code></td><td>This channel&#39;s session, or <code>null</code></td></tr><tr><td><code>receive(channel, input)</code></td><td>Hand work to another channel</td></tr><tr><td><code>callTool(name, input, options?)</code></td><td><a href="./tools.html#call-a-tool-without-a-model-turn">Call a server tool</a> without a model turn</td></tr><tr><td><code>body</code>, <code>query</code>, <code>params</code></td><td>Validated inputs and <code>:param</code> path segments</td></tr><tr><td><code>auth</code></td><td>The <code>AuthContext</code> from the route&#39;s auth chain</td></tr><tr><td><code>requestIp</code></td><td>The TCP peer address, or <code>null</code></td></tr><tr><td><code>host</code></td><td>Host services such as MCP, storage, telemetry, and reminders</td></tr><tr><td><code>waitUntil(promise)</code></td><td>Keep work running after the handler returns</td></tr><tr><td><code>sessionUrls(request, sessionId)</code></td><td>Playground and trace URLs for a session</td></tr><tr><td><code>artifacts</code></td><td>List or tag <a href="./artifacts.html">artifacts</a></td></tr></tbody></table><h3 id="send-options" tabindex="-1"><code>send</code> options <a class="header-anchor" href="#send-options" aria-label="Permalink to &quot;\`send\` options&quot;">​</a></h3><table tabindex="0"><thead><tr><th>Option</th><th>Contract</th></tr></thead><tbody><tr><td><code>continuationToken</code></td><td>Channel-local key that resumes its session, or creates one when new</td></tr><tr><td><code>admission</code></td><td><code>&quot;preempt&quot;</code> (the default) interrupts a busy turn. <code>&quot;coalesce&quot;</code> queues behind it</td></tr><tr><td><code>workspaceFiles</code></td><td>Relative files to add before the next turn</td></tr><tr><td><code>workspaceDir</code></td><td>Absolute local working directory</td></tr><tr><td><code>auth</code></td><td>Session principal. Defaults to the request principal</td></tr><tr><td><code>state</code></td><td>Starting channel state for a new session</td></tr><tr><td><code>title</code>, <code>purpose</code>, <code>dryRun</code>, <code>asOf</code></td><td>Set up a new session, as in the <a href="./http-api.html#start-a-session"><code>POST /v1/session</code> body</a></td></tr><tr><td><code>deliveryId</code></td><td>Names this send on the session&#39;s <a href="./sessions.html#track-which-follow-up-reached-the-agent">events</a>, up to 256 characters. Defaults to a fresh <code>dlv_…</code> ID</td></tr></tbody></table><p><code>send</code> returns a <code>ChannelSession</code> with <code>id</code>, the current <code>continuationToken</code>, <code>isNew</code>, and <code>coalesced: true</code> for a coalesced call. On Cursor hosting, it returns the ID before the session exists.</p><h2 id="events" tabindex="-1">Events <a class="header-anchor" href="#events" aria-label="Permalink to &quot;Events&quot;">​</a></h2><p>The <code>events</code> map subscribes the channel to stream events for its sessions. Keys are types from the <a href="./sessions.html#stream-events">event vocabulary</a>, or <code>&quot;*&quot;</code>. Each handler receives <code>(event, channel, ctx)</code> with <code>channel.state</code>, session info, and host services, so it can post progress and replies. <code>state</code> on the channel definition is each new session&#39;s starting JSON, unless a route passes <code>state</code> to <code>send</code>, and handlers update it through <code>channel.state</code>.</p><h2 id="start-and-stop-a-channel" tabindex="-1">Start and stop a channel <a class="header-anchor" href="#start-and-stop-a-channel" aria-label="Permalink to &quot;Start and stop a channel&quot;">​</a></h2><p><code>onStart(args)</code> runs when the channel mounts, and <code>onStop()</code> runs when the host stops. Besides the route helpers, <code>onStart</code> receives <code>emitAssistantMessage(sessionId, text)</code>, which appends assistant text without a model turn, and <code>hasContinuationSession</code>, <code>isContinuationBusy</code>, and <code>interruptContinuation</code>, which check or stop the session behind a token.</p><h2 id="auth-policies" tabindex="-1">Auth policies <a class="header-anchor" href="#auth-policies" aria-label="Permalink to &quot;Auth policies&quot;">​</a></h2><p>Every route runs the channel&#39;s <code>auth</code> array, which defaults to <code>[localDevStrict()]</code>. The first policy to return an <code>AuthContext</code> admits the request, and if every policy returns <code>null</code>, the route answers <code>401</code>.</p><table tabindex="0"><thead><tr><th>Policy</th><th>Admits</th></tr></thead><tbody><tr><td><code>localDevStrict()</code></td><td>Direct loopback requests with a loopback hostname and no forwarding headers</td></tr><tr><td><code>localDev()</code></td><td>The same, with any hostname</td></tr><tr><td><code>loopbackOnly()</code></td><td>Any loopback peer, including relays that add forwarding headers</td></tr><tr><td><code>bearerAuth(tokenOrVerify)</code></td><td>A matching bearer token, or one the verifier accepts</td></tr><tr><td><code>sharedSecretAuth({ header, secret })</code></td><td>A header that matches the named secret</td></tr><tr><td><code>hmacSignatureAuth({ header, secret, prefix?, separator? })</code></td><td>A hex HMAC-SHA256 signature of the raw body under the named secret, or any of several signatures split by <code>separator</code>. The secret can hold up to 32 values, one per line, and any of them verifies</td></tr><tr><td><code>allowAll()</code></td><td>Every caller, as an anonymous principal</td></tr><tr><td><code>publicEndpoint()</code></td><td>Every caller, with no alias token on hosting. The handler must verify the provider&#39;s signature</td></tr></tbody></table><p>Use <code>allowAll()</code> only for a public surface or one protected upstream. <code>publicEndpoint()</code> applies only to custom channel routes and doesn&#39;t open the built-in session or tool API.</p><p>The admitted <code>AuthContext</code> becomes the request principal, which <a href="./sessions.html#session-contents">owns the sessions it creates</a>.</p><p>On a channel without its own <code>auth</code>, <code>--bearer-token</code> swaps the default for <code>bearerAuth(...)</code> and <code>--allow-anonymous</code> swaps it for <code>allowAll()</code>.</p><h2 id="prebuilt-channels" tabindex="-1">Prebuilt channels <a class="header-anchor" href="#prebuilt-channels" aria-label="Permalink to &quot;Prebuilt channels&quot;">​</a></h2><p>Import each one from <code>@grok/agent-sdk/channels/&lt;name&gt;</code>.</p><table tabindex="0"><thead><tr><th>Function</th><th>Details</th></tr></thead><tbody><tr><td><code>slackChannel()</code></td><td><a href="./../guides/slack.html">Slack</a></td></tr><tr><td><code>teamsChannel()</code></td><td><a href="./../guides/teams.html">Microsoft Teams</a></td></tr><tr><td><code>githubChannel()</code></td><td><a href="./../guides/github.html">GitHub</a></td></tr><tr><td><code>gitlabChannel()</code></td><td><a href="./../guides/gitlab.html">GitLab</a></td></tr><tr><td><code>bitbucketChannel()</code></td><td><a href="./../guides/bitbucket.html">Bitbucket</a></td></tr><tr><td><code>pagerdutyChannel()</code></td><td><a href="./../guides/pagerduty.html">PagerDuty</a></td></tr><tr><td><code>deploymentsChannel()</code></td><td>Deployment events filtered by source, environment, or event name</td></tr></tbody></table><p>Use <code>defineChannel</code> for other platforms, such as Discord.</p><h2 id="handler-results" tabindex="-1">Handler results <a class="header-anchor" href="#handler-results" aria-label="Permalink to &quot;Handler results&quot;">​</a></h2><p>Hooks on the GitHub, GitLab, Bitbucket, and PagerDuty channels, such as <code>onPullRequest</code> or <code>onIncident</code>, return one of three results:</p><table tabindex="0"><thead><tr><th>Return value</th><th>What happens</th></tr></thead><tbody><tr><td><code>{ auth }</code></td><td>Runs the model turn with that auth. It can also set the turn&#39;s <code>message</code>, <code>title</code>, or <code>context</code></td></tr><tr><td><code>{ task }</code></td><td>Runs your function on the host. That function can call <code>send</code> to start a model turn</td></tr><tr><td><code>null</code></td><td>Ignores the event</td></tr></tbody></table><h2 id="hosted-session-keys" tabindex="-1">Hosted session keys <a class="header-anchor" href="#hosted-session-keys" aria-label="Permalink to &quot;Hosted session keys&quot;">​</a></h2><p>On Cursor hosting, each request to a <code>defineChannel</code> route starts a new session unless it carries <code>X-BDK-Session-Key</code>. Requests with the same value on one channel share one session, in arrival order. The handler&#39;s <code>continuationToken</code> doesn&#39;t change that choice, and local <code>serve</code> ignores the header.</p><table tabindex="0"><thead><tr><th>Rule</th><th>Contract</th></tr></thead><tbody><tr><td>Auth</td><td>The alias token or <code>sharedSecretAuth()</code>. Routes admitted by <code>hmacSignatureAuth()</code> or <code>publicEndpoint()</code> answer <code>400</code></td></tr><tr><td>Value</td><td>1 to 256 printable ASCII characters with no space or comma, or the request gets <code>400</code>. Hosting stores the value, so keep secrets and personal data out of it</td></tr><tr><td>Scope</td><td>One channel on one deployment. Prebuilt channels ignore the header</td></tr><tr><td>Retries</td><td>Hosting doesn&#39;t deduplicate. A retry runs a second turn</td></tr></tbody></table><h2 id="related" tabindex="-1">Related <a class="header-anchor" href="#related" aria-label="Permalink to &quot;Related&quot;">​</a></h2><ul><li><a href="./../guides/webhooks.html">Webhooks</a></li><li><a href="./sessions.html">Sessions</a></li></ul>`,43)])])}const k=t(i,[["render",o]]);export{u as __pageData,k as default};