@grok/agent-sdk 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +40 -0
- package/dist/channels/github/cursor-account.d.ts +1 -0
- package/dist/channels/github/cursor-account.d.ts.map +1 -1
- package/dist/channels/github/cursor-account.js +8 -2
- package/dist/channels/github/forward.d.ts +5 -0
- package/dist/channels/github/forward.d.ts.map +1 -1
- package/dist/channels/github/forward.js +6 -3
- package/dist/channels/origin/cursor-account.d.ts +6 -0
- package/dist/channels/origin/cursor-account.d.ts.map +1 -1
- package/dist/channels/origin/cursor-account.js +17 -0
- package/dist/channels/slack/api.d.ts +18 -0
- package/dist/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +31 -0
- package/dist/channels/slack/approvals.d.ts +19 -2
- package/dist/channels/slack/approvals.d.ts.map +1 -1
- package/dist/channels/slack/approvals.js +90 -19
- package/dist/channels/slack/attachments.d.ts +7 -2
- package/dist/channels/slack/attachments.d.ts.map +1 -1
- package/dist/channels/slack/attachments.js +318 -156
- package/dist/channels/slack/connect-card.d.ts +16 -0
- package/dist/channels/slack/connect-card.d.ts.map +1 -0
- package/dist/channels/slack/connect-card.js +31 -0
- package/dist/channels/slack/credentials.d.ts +10 -2
- package/dist/channels/slack/credentials.d.ts.map +1 -1
- package/dist/channels/slack/credentials.js +17 -15
- package/dist/channels/slack/defaults.d.ts.map +1 -1
- package/dist/channels/slack/defaults.js +18 -9
- package/dist/channels/slack/dispatch.d.ts +1 -1
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +19 -3
- package/dist/channels/slack/inbound.d.ts +8 -2
- package/dist/channels/slack/inbound.d.ts.map +1 -1
- package/dist/channels/slack/inbound.js +25 -4
- package/dist/channels/slack/index.d.ts +3 -2
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +3 -2
- package/dist/channels/slack/init.d.ts.map +1 -1
- package/dist/channels/slack/init.js +2 -1
- package/dist/channels/slack/mentions.d.ts +28 -0
- package/dist/channels/slack/mentions.d.ts.map +1 -0
- package/dist/channels/slack/mentions.js +178 -0
- package/dist/channels/slack/setup.js +1 -1
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +46 -3
- package/dist/channels/slack/stop.d.ts.map +1 -1
- package/dist/channels/slack/stop.js +7 -1
- package/dist/channels/slack/thread-context.d.ts +3 -0
- package/dist/channels/slack/thread-context.d.ts.map +1 -1
- package/dist/channels/slack/thread-context.js +17 -7
- package/dist/channels/slack/tool-approval-events.d.ts.map +1 -1
- package/dist/channels/slack/tool-approval-events.js +55 -2
- package/dist/channels/slack/types.d.ts +2 -0
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/channels/teams/activity.d.ts +33 -0
- package/dist/channels/teams/activity.d.ts.map +1 -0
- package/dist/channels/teams/activity.js +213 -0
- package/dist/channels/teams/auth.d.ts +25 -0
- package/dist/channels/teams/auth.d.ts.map +1 -0
- package/dist/channels/teams/auth.js +55 -0
- package/dist/channels/teams/bot-framework-auth.d.ts +33 -0
- package/dist/channels/teams/bot-framework-auth.d.ts.map +1 -0
- package/dist/channels/teams/bot-framework-auth.js +154 -0
- package/dist/channels/teams/cards.d.ts +23 -0
- package/dist/channels/teams/cards.d.ts.map +1 -0
- package/dist/channels/teams/cards.js +107 -0
- package/dist/channels/teams/connector.d.ts +48 -0
- package/dist/channels/teams/connector.d.ts.map +1 -0
- package/dist/channels/teams/connector.js +159 -0
- package/dist/channels/teams/credentials.d.ts +65 -0
- package/dist/channels/teams/credentials.d.ts.map +1 -0
- package/dist/channels/teams/credentials.js +84 -0
- package/dist/channels/teams/delivery.d.ts +14 -0
- package/dist/channels/teams/delivery.d.ts.map +1 -0
- package/dist/channels/teams/delivery.js +169 -0
- package/dist/channels/teams/dispatch.d.ts +45 -0
- package/dist/channels/teams/dispatch.d.ts.map +1 -0
- package/dist/channels/teams/dispatch.js +402 -0
- package/dist/channels/teams/engagement.d.ts +32 -0
- package/dist/channels/teams/engagement.d.ts.map +1 -0
- package/dist/channels/teams/engagement.js +120 -0
- package/dist/channels/teams/index.d.ts +21 -0
- package/dist/channels/teams/index.d.ts.map +1 -0
- package/dist/channels/teams/index.js +19 -0
- package/dist/channels/teams/marks.d.ts +19 -0
- package/dist/channels/teams/marks.d.ts.map +1 -0
- package/dist/channels/teams/marks.js +96 -0
- package/dist/channels/teams/senders.d.ts +27 -0
- package/dist/channels/teams/senders.d.ts.map +1 -0
- package/dist/channels/teams/senders.js +72 -0
- package/dist/channels/teams/teams-channel.d.ts +43 -0
- package/dist/channels/teams/teams-channel.d.ts.map +1 -0
- package/dist/channels/teams/teams-channel.js +278 -0
- package/dist/channels/teams/text.d.ts +7 -0
- package/dist/channels/teams/text.d.ts.map +1 -0
- package/dist/channels/teams/text.js +63 -0
- package/dist/channels/teams/types.d.ts +306 -0
- package/dist/channels/teams/types.d.ts.map +1 -0
- package/dist/channels/teams/types.js +1 -0
- package/dist/channels.d.ts +31 -0
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js +37 -0
- package/dist/connections.d.ts +1 -1
- package/dist/connections.d.ts.map +1 -1
- package/dist/docs/404.html +3 -3
- package/dist/docs/assets/{app.lt-BYgI2.js → app.CpLKJnOA.js} +4 -4
- package/dist/docs/assets/changelog.md.DoOgjnPC.js +1 -0
- package/dist/docs/assets/{changelog.md.DVNB-ApU.lean.js → changelog.md.DoOgjnPC.lean.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.BJ_1eI6D.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.v_dV4U2Q.js → VPLocalSearchBox.Cr1HJ_9k.js} +2 -2
- package/dist/docs/assets/chunks/{arc.5o92kOg5.js → arc.BjpgGAMM.js} +1 -1
- package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.C-oTwnNq.js → architectureDiagram-Q4EWVU46.CKdhNPPk.js} +1 -1
- package/dist/docs/assets/chunks/{baseUniq.zJ-VNOib.js → baseUniq.iovoEQbg.js} +1 -1
- package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.B9ZJZuPd.js → blockDiagram-DXYQGD6D.BYQIeDre.js} +1 -1
- package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.BBMwSIaN.js → c4Diagram-AHTNJAMY.gbWi2q8N.js} +1 -1
- package/dist/docs/assets/chunks/channel.BP0n324b.js +1 -0
- package/dist/docs/assets/chunks/{chunk-4BX2VUAB.D8qAJpDD.js → chunk-4BX2VUAB.1Mem4UG9.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-4TB4RGXK.B8QR5cdE.js → chunk-4TB4RGXK.Dn3H-X_H.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-55IACEB6.BsWxVuew.js → chunk-55IACEB6.BkpSDZwX.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-EDXVE4YY.BeGygY_i.js → chunk-EDXVE4YY.BScqy1zP.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-FMBD7UC4.DdwgH-ZH.js → chunk-FMBD7UC4.Cp394LWf.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-OYMX7WX6.B9zC_ALe.js → chunk-OYMX7WX6.BDv9LhoL.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BIxJ0rcL.js → chunk-QZHKN3VN.CsgCcrKO.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-YZCP3GAM.qiM_23_f.js → chunk-YZCP3GAM.BKBpIC5O.js} +1 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.BhTtyWMA.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.BhTtyWMA.js +1 -0
- package/dist/docs/assets/chunks/clone.BVK2rFqj.js +1 -0
- package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.BKB971D5.js → cose-bilkent-S5V4N54A.Bs3ZS9PC.js} +1 -1
- package/dist/docs/assets/chunks/{dagre-KV5264BT.CcILjJgp.js → dagre-KV5264BT.CgWi0tY2.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-5BDNPKRD.DkY9A0nu.js → diagram-5BDNPKRD.rn6qIo9N.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.BbdzmjMt.js → diagram-G4DWMVQ6.ChhW8oww.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-MMDJMWI5.Be0zy1cM.js → diagram-MMDJMWI5.C0wH5KSk.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-TYMM5635.zOiEycLe.js → diagram-TYMM5635.CNEcrwA0.js} +1 -1
- package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DUd_9HMF.js → erDiagram-SMLLAGMA.DCsnKO-7.js} +1 -1
- package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.2KPYoZBO.js → flowDiagram-DWJPFMVM.WCMkfvP0.js} +1 -1
- package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.DqE8_YpP.js → ganttDiagram-T4ZO3ILL.BUb1Sxfr.js} +1 -1
- package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.CO0Tk47h.js → gitGraphDiagram-UUTBAWPF._kORbCzm.js} +1 -1
- package/dist/docs/assets/chunks/{graph.CNe5KbNy.js → graph.PrGRm4KW.js} +1 -1
- package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.BBhJ1X1B.js → infoDiagram-42DDH7IO.BxhCjiQM.js} +1 -1
- package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.KSIw9w3I.js → ishikawaDiagram-UXIWVN3A.5ddTis2y.js} +1 -1
- package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BN2Y5oUJ.js → journeyDiagram-VCZTEJTY.BUStU27-.js} +1 -1
- package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.2KFuDYn_.js → kanban-definition-6JOO6SKY.CJd1psl3.js} +1 -1
- package/dist/docs/assets/chunks/{layout.Demb_pzL.js → layout.DqvbZSML.js} +1 -1
- package/dist/docs/assets/chunks/{linear.kYKxzbbR.js → linear.DOmz-1UB.js} +1 -1
- package/dist/docs/assets/chunks/{min.DwmCN5dF.js → min.33k2v8dM.js} +1 -1
- package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.CGlz01QG.js → mindmap-definition-QFDTVHPH.iISCqCXC.js} +1 -1
- package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.n3qsq4nA.js → pieDiagram-DEJITSTG.BHvVgzmD.js} +1 -1
- package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CGNJ1GSb.js → quadrantDiagram-34T5L4WZ.CY3w_-Cn.js} +1 -1
- package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.VhAzHDwQ.js → requirementDiagram-MS252O5E.CHXKQS1v.js} +1 -1
- package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.DmHA5pW-.js → sankeyDiagram-XADWPNL6.DTtRoGss.js} +1 -1
- package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23._TC1aKhg.js → sequenceDiagram-FGHM5R23.NnPcQ3eY.js} +1 -1
- package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.B-kLjV3O.js → stateDiagram-FHFEXIEX.D8DFciH7.js} +1 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.ESAwmMws.js +1 -0
- package/dist/docs/assets/chunks/{theme.BaVlHHL-.js → theme.CwkiT-Fo.js} +2 -2
- package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.CresbphV.js → timeline-definition-GMOUNBTQ._wIWkMU6.js} +1 -1
- package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.CegHD8Y4.js → vennDiagram-DHZGUBPP.NLVv7R6r.js} +1 -1
- package/dist/docs/assets/chunks/{wardley-RL74JXVD.DjCmZrUO.js → wardley-RL74JXVD.DbsCXUZp.js} +1 -1
- package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.BJ7s1zdZ.js → wardleyDiagram-NUSXRM2D.Dp5uAVDl.js} +1 -1
- package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.IrEXlemI.js → xychartDiagram-5P7HB3ND.eOEBq4rX.js} +1 -1
- package/dist/docs/assets/{deployment.md.DJtuDVLh.js → deployment.md.CIRydNl3.js} +3 -3
- package/dist/docs/assets/{deployment.md.DJtuDVLh.lean.js → deployment.md.CIRydNl3.lean.js} +1 -1
- package/dist/docs/assets/guides_cloud-agents.md.BdWqmUGb.js +14 -0
- package/dist/docs/assets/{guides_cloud-agents.md.CiXAW6on.lean.js → guides_cloud-agents.md.BdWqmUGb.lean.js} +1 -1
- package/dist/docs/assets/guides_teams.md.7Lz2sbqB.js +50 -0
- package/dist/docs/assets/guides_teams.md.7Lz2sbqB.lean.js +1 -0
- package/dist/docs/assets/guides_workload-identity.md.DBV6YkXX.js +82 -0
- package/dist/docs/assets/guides_workload-identity.md.DBV6YkXX.lean.js +1 -0
- package/dist/docs/assets/{reference_agent-config.md.Bbqf0lgS.js → reference_agent-config.md.CfM1S6Ac.js} +2 -2
- package/dist/docs/assets/{reference_agent-config.md.Bbqf0lgS.lean.js → reference_agent-config.md.CfM1S6Ac.lean.js} +1 -1
- package/dist/docs/assets/{reference_channels.md.CPWOpdsC.js → reference_channels.md.CRvqgU0n.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.DHm6DmYk.js → reference_cli.md.NS6U5a-7.js} +14 -4
- package/dist/docs/assets/{reference_cli.md.DHm6DmYk.lean.js → reference_cli.md.NS6U5a-7.lean.js} +1 -1
- package/dist/docs/assets/{reference_limits.md.CbdtFr4T.js → reference_limits.md.CW9PTdxr.js} +3 -3
- package/dist/docs/assets/{reference_limits.md.CbdtFr4T.lean.js → reference_limits.md.CW9PTdxr.lean.js} +1 -1
- package/dist/docs/assets/{reference_schedules.md.RhQ9ZLo1.js → reference_schedules.md.Dd8_d0WG.js} +3 -3
- package/dist/docs/assets/{reference_sessions.md.NXVQt9mP.js → reference_sessions.md.CoCyQLEz.js} +2 -2
- package/dist/docs/assets/{reference_sessions.md.NXVQt9mP.lean.js → reference_sessions.md.CoCyQLEz.lean.js} +1 -1
- package/dist/docs/assets/{reference_skills.md.DzCPNPkG.js → reference_skills.md.SFRZDC41.js} +4 -4
- package/dist/docs/assets/{reference_skills.md.DzCPNPkG.lean.js → reference_skills.md.SFRZDC41.lean.js} +1 -1
- package/dist/docs/assets/{style.DK0YX1WL.css → style.B7zPxANR.css} +1 -1
- package/dist/docs/assets/troubleshooting.md.CsQTleto.js +3 -0
- package/dist/docs/assets/{troubleshooting.md.DfKKvW1R.lean.js → troubleshooting.md.CsQTleto.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +37 -37
- package/dist/docs/changelog.html +37 -37
- package/dist/docs/changelog.md +43 -0
- package/dist/docs/deployment.html +40 -40
- package/dist/docs/deployment.md +14 -0
- package/dist/docs/evals.html +37 -37
- package/dist/docs/guides/agent-to-agent.html +37 -37
- package/dist/docs/guides/bitbucket.html +37 -37
- package/dist/docs/guides/cloud-agents.html +43 -38
- package/dist/docs/guides/cloud-agents.md +47 -0
- package/dist/docs/guides/convert-automation.html +37 -37
- package/dist/docs/guides/github.html +37 -37
- package/dist/docs/guides/gitlab.html +37 -37
- package/dist/docs/guides/improve.html +37 -37
- package/dist/docs/guides/jev.html +37 -37
- package/dist/docs/guides/mcp-oauth.html +37 -37
- package/dist/docs/guides/migrate.html +37 -37
- package/dist/docs/guides/opentelemetry.html +37 -37
- package/dist/docs/guides/pagerduty.html +37 -37
- package/dist/docs/guides/slack.html +37 -37
- package/dist/docs/guides/teams.html +109 -0
- package/dist/docs/guides/teams.md +384 -0
- package/dist/docs/guides/webhooks.html +37 -37
- package/dist/docs/guides/workload-identity.html +141 -0
- package/dist/docs/guides/workload-identity.md +227 -0
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +37 -37
- package/dist/docs/index.html +37 -37
- package/dist/docs/llms-full.txt +881 -5
- package/dist/docs/llms.txt +2 -0
- package/dist/docs/quickstart.html +37 -37
- package/dist/docs/reference/access.html +36 -36
- package/dist/docs/reference/agent-config.html +39 -39
- package/dist/docs/reference/agent-config.md +1 -1
- package/dist/docs/reference/artifacts.html +37 -37
- package/dist/docs/reference/channels.html +38 -38
- package/dist/docs/reference/channels.md +1 -0
- package/dist/docs/reference/cli.html +50 -40
- package/dist/docs/reference/cli.md +116 -0
- package/dist/docs/reference/connections.html +37 -37
- package/dist/docs/reference/evals.html +37 -37
- package/dist/docs/reference/extensions.html +37 -37
- package/dist/docs/reference/hooks.html +37 -37
- package/dist/docs/reference/http-api.html +37 -37
- package/dist/docs/reference/instructions.html +37 -37
- package/dist/docs/reference/limits.html +39 -39
- package/dist/docs/reference/limits.md +4 -4
- package/dist/docs/reference/memory.html +37 -37
- package/dist/docs/reference/playground.html +36 -36
- package/dist/docs/reference/project-layout.html +37 -37
- package/dist/docs/reference/schedules.html +40 -40
- package/dist/docs/reference/sessions.html +38 -38
- package/dist/docs/reference/sessions.md +13 -0
- package/dist/docs/reference/skills.html +40 -40
- package/dist/docs/reference/subagents.html +37 -37
- package/dist/docs/reference/tools.html +37 -37
- package/dist/docs/templates/agentic-owners.html +37 -37
- package/dist/docs/templates/reviews.html +37 -37
- package/dist/docs/troubleshooting.html +38 -38
- package/dist/docs/troubleshooting.md +21 -0
- package/dist/evals/run-facts.d.ts.map +1 -1
- package/dist/evals/run-facts.js +4 -0
- package/dist/extensions/cursor-cloud-agents/channels/cursor-cloud-agents.d.ts +12 -0
- package/dist/extensions/cursor-cloud-agents/channels/cursor-cloud-agents.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/channels/cursor-cloud-agents.js +42 -0
- package/dist/extensions/cursor-cloud-agents/extension.d.ts +10 -7
- package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/extension.js +3 -2
- package/dist/extensions/cursor-cloud-agents/lib/agent-id.d.ts +5 -0
- package/dist/extensions/cursor-cloud-agents/lib/agent-id.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/agent-id.js +10 -0
- package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts +57 -3
- package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/lib/backend.js +150 -35
- package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts +32 -4
- package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/lib/fleet.js +93 -7
- package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts +24 -7
- package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/lib/launch-agent.js +158 -25
- package/dist/extensions/cursor-cloud-agents/lib/stop-signal.d.ts +18 -0
- package/dist/extensions/cursor-cloud-agents/lib/stop-signal.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/stop-signal.js +27 -0
- package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/lib/transcript.js +2 -3
- package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts +26 -12
- package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/lib/watch.js +115 -46
- package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts +16 -5
- package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts.map +1 -1
- package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.js +76 -20
- package/dist/extensions/cursor-cloud-agents/skills/handoff.md +2 -2
- package/dist/extensions/cursor-cloud-agents/tools/get.js +2 -2
- package/dist/extensions/cursor-cloud-agents/tools/launch.js +1 -1
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +18 -3
- package/dist/files-backends/agent-store-presigned-url.js +5 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/internal/approval-gate.d.ts +6 -1
- package/dist/internal/approval-gate.d.ts.map +1 -1
- package/dist/internal/approval-gate.js +13 -2
- package/dist/internal/authored-loaders.js +1 -1
- package/dist/internal/channel-architecture.d.ts.map +1 -1
- package/dist/internal/channel-architecture.js +3 -1
- package/dist/internal/cli/commands/channels.d.ts +9 -3
- package/dist/internal/cli/commands/channels.d.ts.map +1 -1
- package/dist/internal/cli/commands/channels.js +193 -4
- package/dist/internal/cli/commands/index.d.ts.map +1 -1
- package/dist/internal/cli/commands/index.js +6 -1
- package/dist/internal/cli/commands/serve.d.ts.map +1 -1
- package/dist/internal/cli/commands/serve.js +25 -5
- package/dist/internal/cli/dispatch.d.ts.map +1 -1
- package/dist/internal/cli/dispatch.js +22 -8
- package/dist/internal/cli/flags.d.ts +14 -0
- package/dist/internal/cli/flags.d.ts.map +1 -1
- package/dist/internal/cli/flags.js +14 -0
- package/dist/internal/cli/help.d.ts.map +1 -1
- package/dist/internal/cli/help.js +3 -1
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +6 -3
- package/dist/internal/cli-cursor.js +2 -2
- package/dist/internal/cli-deploy.d.ts +1 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +19 -1
- package/dist/internal/cli-mcp.d.ts.map +1 -1
- package/dist/internal/cli-mcp.js +5 -3
- package/dist/internal/cli-teams-doctor.d.ts +39 -0
- package/dist/internal/cli-teams-doctor.d.ts.map +1 -0
- package/dist/internal/cli-teams-doctor.js +508 -0
- package/dist/internal/cli-teams-forward.d.ts +84 -0
- package/dist/internal/cli-teams-forward.d.ts.map +1 -0
- package/dist/internal/cli-teams-forward.js +386 -0
- package/dist/internal/cli-teams-package.d.ts +26 -0
- package/dist/internal/cli-teams-package.d.ts.map +1 -0
- package/dist/internal/cli-teams-package.js +123 -0
- package/dist/internal/cli-teams.d.ts +15 -0
- package/dist/internal/cli-teams.d.ts.map +1 -0
- package/dist/internal/cli-teams.js +253 -0
- package/dist/internal/connect-click.d.ts +12 -0
- package/dist/internal/connect-click.d.ts.map +1 -0
- package/dist/internal/connect-click.js +22 -0
- package/dist/internal/continuation-channel.d.ts +5 -1
- package/dist/internal/continuation-channel.d.ts.map +1 -1
- package/dist/internal/continuation-channel.js +34 -0
- package/dist/internal/continuation-identity.d.ts +7 -4
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +66 -1
- package/dist/internal/convert-automation/convert-workflow.js +2 -2
- package/dist/internal/credential-env-names.d.ts +36 -0
- package/dist/internal/credential-env-names.d.ts.map +1 -0
- package/dist/internal/credential-env-names.js +68 -0
- package/dist/internal/cursor/account-mcp.d.ts +67 -9
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
- package/dist/internal/cursor/account-mcp.js +206 -25
- package/dist/internal/cursor/backend-client.d.ts +10 -1
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +19 -7
- package/dist/internal/cursor/cloud-agent-identity.d.ts +81 -0
- package/dist/internal/cursor/cloud-agent-identity.d.ts.map +1 -0
- package/dist/internal/cursor/cloud-agent-identity.js +224 -0
- package/dist/internal/cursor/credentials.d.ts.map +1 -1
- package/dist/internal/cursor/credentials.js +3 -1
- package/dist/internal/cursor-account-mcp-auth.d.ts +8 -1
- package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
- package/dist/internal/cursor-account-mcp-auth.js +22 -6
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +34 -2
- package/dist/internal/deploy-manifest.d.ts +51 -3
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +96 -7
- package/dist/internal/discovery/agent-config.d.ts.map +1 -1
- package/dist/internal/discovery/agent-config.js +6 -1
- package/dist/internal/discovery/agent.d.ts.map +1 -1
- package/dist/internal/discovery/agent.js +2 -1
- package/dist/internal/discovery/connections.d.ts +5 -0
- package/dist/internal/discovery/connections.d.ts.map +1 -1
- package/dist/internal/discovery/connections.js +71 -1
- package/dist/internal/discovery/extensions.d.ts.map +1 -1
- package/dist/internal/discovery/extensions.js +2 -0
- package/dist/internal/discovery/info.d.ts.map +1 -1
- package/dist/internal/discovery/info.js +4 -0
- package/dist/internal/env-file.d.ts +1 -0
- package/dist/internal/env-file.d.ts.map +1 -1
- package/dist/internal/env-file.js +18 -17
- package/dist/internal/env-prefix.d.ts +11 -0
- package/dist/internal/env-prefix.d.ts.map +1 -0
- package/dist/internal/env-prefix.js +23 -0
- package/dist/internal/event-id-dedupe.d.ts +12 -0
- package/dist/internal/event-id-dedupe.d.ts.map +1 -0
- package/dist/{channels/slack → internal}/event-id-dedupe.js +7 -4
- package/dist/internal/event-mapper.d.ts +7 -2
- package/dist/internal/event-mapper.d.ts.map +1 -1
- package/dist/internal/event-mapper.js +7 -0
- package/dist/internal/expected-delivery-failure.d.ts.map +1 -1
- package/dist/internal/expected-delivery-failure.js +3 -0
- package/dist/internal/extension-namespace.d.ts +9 -0
- package/dist/internal/extension-namespace.d.ts.map +1 -0
- package/dist/internal/extension-namespace.js +14 -0
- package/dist/internal/guid.d.ts +2 -0
- package/dist/internal/guid.d.ts.map +1 -0
- package/dist/internal/guid.js +4 -0
- package/dist/internal/host-kv-cas.d.ts +13 -0
- package/dist/internal/host-kv-cas.d.ts.map +1 -0
- package/dist/internal/host-kv-cas.js +26 -0
- package/dist/internal/host-kv.d.ts +4 -1
- package/dist/internal/host-kv.d.ts.map +1 -1
- package/dist/internal/host-kv.js +15 -2
- package/dist/internal/hosted-catch-protocol.d.ts +5 -0
- package/dist/internal/hosted-catch-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-catch-protocol.js +5 -0
- package/dist/internal/hosted-catch.d.ts +2 -0
- package/dist/internal/hosted-catch.d.ts.map +1 -1
- package/dist/internal/hosted-catch.js +6 -1
- package/dist/internal/hosted-delivery-protocol.d.ts +4 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.js +73 -3
- package/dist/internal/hosted-delivery.d.ts +9 -3
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +14 -3
- package/dist/internal/hosted-session-fixture.js +1 -1
- package/dist/internal/hosting.d.ts +5 -0
- package/dist/internal/hosting.d.ts.map +1 -1
- package/dist/internal/hosting.js +7 -1
- package/dist/internal/ids.d.ts +2 -0
- package/dist/internal/ids.d.ts.map +1 -1
- package/dist/internal/ids.js +5 -0
- package/dist/internal/install-cursor-skills.d.ts +6 -7
- package/dist/internal/install-cursor-skills.d.ts.map +1 -1
- package/dist/internal/install-cursor-skills.js +15 -9
- package/dist/internal/interview/agent-questions.d.ts +1 -1
- package/dist/internal/interview/agent-questions.d.ts.map +1 -1
- package/dist/internal/interview/agent-questions.js +4 -3
- package/dist/internal/local-control-plane.d.ts.map +1 -1
- package/dist/internal/local-control-plane.js +24 -0
- package/dist/internal/mcp-allowlist-in-use.d.ts +23 -0
- package/dist/internal/mcp-allowlist-in-use.d.ts.map +1 -0
- package/dist/internal/mcp-allowlist-in-use.js +93 -0
- package/dist/internal/mcp-endpoint.d.ts.map +1 -1
- package/dist/internal/mcp-endpoint.js +8 -10
- package/dist/internal/mcp-host.d.ts +19 -1
- package/dist/internal/mcp-host.d.ts.map +1 -1
- package/dist/internal/mcp-host.js +67 -3
- package/dist/internal/mcp-oauth.d.ts.map +1 -1
- package/dist/internal/mcp-oauth.js +5 -7
- package/dist/internal/oidcAudiences.d.ts +22 -0
- package/dist/internal/oidcAudiences.d.ts.map +1 -0
- package/dist/internal/oidcAudiences.js +35 -0
- package/dist/internal/otel/collector.d.ts.map +1 -1
- package/dist/internal/otel/collector.js +2 -0
- package/dist/internal/platform-timers.d.ts +2 -0
- package/dist/internal/platform-timers.d.ts.map +1 -1
- package/dist/internal/platform-timers.js +14 -0
- package/dist/internal/private-file.d.ts +32 -1
- package/dist/internal/private-file.d.ts.map +1 -1
- package/dist/internal/private-file.js +209 -7
- package/dist/internal/redact-values.d.ts +3 -0
- package/dist/internal/redact-values.d.ts.map +1 -0
- package/dist/internal/redact-values.js +19 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts +7 -1
- package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -1
- package/dist/internal/reminder-followup-error.d.ts +23 -0
- package/dist/internal/reminder-followup-error.d.ts.map +1 -0
- package/dist/internal/reminder-followup-error.js +12 -0
- package/dist/internal/reminder-runner.d.ts +15 -1
- package/dist/internal/reminder-runner.d.ts.map +1 -1
- package/dist/internal/reminder-runner.js +95 -21
- package/dist/internal/resolved-connections.d.ts.map +1 -1
- package/dist/internal/resolved-connections.js +23 -3
- package/dist/internal/run-client.js +2 -1
- package/dist/internal/run-program.d.ts +31 -0
- package/dist/internal/run-program.d.ts.map +1 -0
- package/dist/internal/run-program.js +150 -0
- package/dist/internal/schedule-runner.d.ts +1 -0
- package/dist/internal/schedule-runner.d.ts.map +1 -1
- package/dist/internal/schedule-runner.js +10 -1
- package/dist/internal/sdk-runner.d.ts +28 -2
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +298 -38
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +53 -8
- package/dist/internal/session-credential.d.ts +14 -0
- package/dist/internal/session-credential.d.ts.map +1 -0
- package/dist/internal/session-credential.js +25 -0
- package/dist/internal/session-engine.d.ts +140 -6
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +583 -93
- package/dist/internal/storage-coordinator.d.ts +3 -1
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +13 -0
- package/dist/internal/storage-roles.d.ts +9 -1
- package/dist/internal/storage-roles.d.ts.map +1 -1
- package/dist/internal/teams-channel-profile.d.ts +41 -0
- package/dist/internal/teams-channel-profile.d.ts.map +1 -0
- package/dist/internal/teams-channel-profile.js +91 -0
- package/dist/internal/teams-devtunnel.d.ts +55 -0
- package/dist/internal/teams-devtunnel.d.ts.map +1 -0
- package/dist/internal/teams-devtunnel.js +205 -0
- package/dist/internal/teams-tunnel-proxy.d.ts +17 -0
- package/dist/internal/teams-tunnel-proxy.d.ts.map +1 -0
- package/dist/internal/teams-tunnel-proxy.js +100 -0
- package/dist/internal/testing/conversation-identity-vectors.d.ts +7 -1
- package/dist/internal/testing/conversation-identity-vectors.d.ts.map +1 -1
- package/dist/internal/testing/conversation-identity-vectors.js +67 -0
- package/dist/internal/testing/hosted-http.d.ts +15 -0
- package/dist/internal/testing/hosted-http.d.ts.map +1 -0
- package/dist/internal/testing/hosted-http.js +86 -0
- package/dist/internal/testing/teams-activity-fixtures.d.ts +28 -0
- package/dist/internal/testing/teams-activity-fixtures.d.ts.map +1 -0
- package/dist/internal/testing/teams-activity-fixtures.js +236 -0
- package/dist/internal/testing/teams-doctor-fixtures.d.ts +76 -0
- package/dist/internal/testing/teams-doctor-fixtures.d.ts.map +1 -0
- package/dist/internal/testing/teams-doctor-fixtures.js +216 -0
- package/dist/internal/tunnel-process.d.ts +29 -0
- package/dist/internal/tunnel-process.d.ts.map +1 -0
- package/dist/internal/tunnel-process.js +105 -0
- package/dist/internal/turn-context.d.ts +28 -0
- package/dist/internal/turn-context.d.ts.map +1 -0
- package/dist/internal/turn-context.js +1 -0
- package/dist/oidc-token.d.ts +131 -0
- package/dist/oidc-token.d.ts.map +1 -0
- package/dist/oidc-token.js +221 -0
- package/dist/playground/assets/chunk-YOKDWASO-BPO_8GRX.js +115 -0
- package/dist/playground/assets/highlighted-body-KPVGNVTW-CxEV-T_f.js +1 -0
- package/dist/playground/assets/index-CjFJhCtb.js +62 -0
- package/dist/playground/assets/index-vwUVwmk8.css +1 -0
- package/dist/playground/assets/mermaid-HWGCJPDP-eK-fpbFn.js +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/teams-app-package.d.ts +78 -0
- package/dist/teams-app-package.d.ts.map +1 -0
- package/dist/teams-app-package.js +204 -0
- package/dist/tools.d.ts +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/types.d.ts +271 -2
- package/dist/types.d.ts.map +1 -1
- package/docs/changelog.md +43 -0
- package/docs/deployment.md +14 -0
- package/docs/guides/cloud-agents.md +47 -0
- package/docs/guides/teams.md +389 -0
- package/docs/guides/workload-identity.md +232 -0
- package/docs/reference/agent-config.md +1 -1
- package/docs/reference/channels.md +1 -0
- package/docs/reference/cli.md +116 -0
- package/docs/reference/limits.md +4 -4
- package/docs/reference/sessions.md +13 -0
- package/docs/troubleshooting.md +21 -0
- package/package.json +23 -46
- package/skills/create-agent/SKILL.md +17 -4
- package/skills/debug/SKILL.md +1 -0
- package/skills/deploy/SKILL.md +1 -1
- package/skills/framework-map/SKILL.md +1 -0
- package/skills/setup-teams/SKILL.md +141 -0
- package/templates/agentic-owners/bot/lib/owners/parse.ts +1 -0
- package/dist/channels/slack/event-id-dedupe.d.ts +0 -10
- package/dist/channels/slack/event-id-dedupe.d.ts.map +0 -1
- package/dist/docs/assets/changelog.md.DVNB-ApU.js +0 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DdlR-9Oe.js +0 -1
- package/dist/docs/assets/chunks/channel.CdyTxaXV.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CeUcN6TW.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CeUcN6TW.js +0 -1
- package/dist/docs/assets/chunks/clone.DpIwUbur.js +0 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.HtBkUH4J.js +0 -1
- package/dist/docs/assets/guides_cloud-agents.md.CiXAW6on.js +0 -9
- package/dist/docs/assets/troubleshooting.md.DfKKvW1R.js +0 -3
- package/dist/playground/assets/index-CnFd5R1_.js +0 -62
- package/dist/playground/assets/index-DNzRv6G8.css +0 -1
- /package/dist/docs/assets/{reference_channels.md.CPWOpdsC.lean.js → reference_channels.md.CRvqgU0n.lean.js} +0 -0
- /package/dist/docs/assets/{reference_schedules.md.RhQ9ZLo1.lean.js → reference_schedules.md.Dd8_d0WG.lean.js} +0 -0
|
@@ -15,7 +15,8 @@ import { CursorBackendClient } from "./cursor/backend-client.js";
|
|
|
15
15
|
import { cursorExternalApiUrl, resolveApiKey, SIGN_IN_HINT } from "./cursor/credentials.js";
|
|
16
16
|
import { readDeployTemplate } from "./cursor-agent-template.js";
|
|
17
17
|
import { AgentServeDeployClient, SEVERAL_AGENTS_DEPLOY_ALONE, DeployApiError, SECRET_NOT_FOUND_MESSAGE, TERMINAL_AGENTKIT_DEPLOY_STATUSES, validateDeploymentSlug, } from "./deploy-client.js";
|
|
18
|
-
import {
|
|
18
|
+
import { credentialEnvMismatch, formatCredentialEnvMismatch, } from "./credential-env-names.js";
|
|
19
|
+
import { channelCatchSecretNames, channelCredentialSecretNames, channelSecretAlternatives, credentialEnvsFromChannels, } from "./deploy-manifest.js";
|
|
19
20
|
import { unmetSecretAlternatives } from "./secret-alternatives.js";
|
|
20
21
|
import { inferDeployGitSource } from "./deploy-source.js";
|
|
21
22
|
import { describeError } from "./describe-error.js";
|
|
@@ -178,6 +179,7 @@ export async function cmdDeploy(options) {
|
|
|
178
179
|
componentImage: Object.fromEntries(targets.flatMap((target, index) => manifests[index]?.image === undefined ? [] : [[target.slug, manifests[index].image]])),
|
|
179
180
|
hasScmChannels: manifests.some((manifest) => manifest.hasScmChannels),
|
|
180
181
|
declaredSecretNames: declaredSecretNames(manifests),
|
|
182
|
+
credentialEnvs: manifests.flatMap((manifest) => manifest.credentialEnvs),
|
|
181
183
|
hasDeploymentsChannels: manifests.some((manifest) => manifest.hasDeploymentsChannels),
|
|
182
184
|
});
|
|
183
185
|
}
|
|
@@ -504,6 +506,7 @@ async function deployOne(ctx, options, target) {
|
|
|
504
506
|
repositories: options.cursorEventsRepos,
|
|
505
507
|
hasScmChannels: manifest?.hasScmChannels === true,
|
|
506
508
|
declaredSecretNames: declaredSecretNames([manifest]),
|
|
509
|
+
credentialEnvs: manifest?.credentialEnvs ?? [],
|
|
507
510
|
hasDeploymentsChannels: manifest?.hasDeploymentsChannels === true,
|
|
508
511
|
multiTenant: options.multiTenant === true,
|
|
509
512
|
template: readDeployTemplate(dir),
|
|
@@ -573,6 +576,7 @@ async function deployAgentsdkApplication(ctx, options, targets, declarations) {
|
|
|
573
576
|
repositories: options.cursorEventsRepos,
|
|
574
577
|
hasScmChannels: declarations.hasScmChannels,
|
|
575
578
|
declaredSecretNames: declarations.declaredSecretNames,
|
|
579
|
+
credentialEnvs: declarations.credentialEnvs,
|
|
576
580
|
hasDeploymentsChannels: declarations.hasDeploymentsChannels,
|
|
577
581
|
multiTenant: options.multiTenant === true,
|
|
578
582
|
template: readDeployTemplate(parentDir),
|
|
@@ -645,6 +649,7 @@ async function deployOneAgentsdk(ctx, args) {
|
|
|
645
649
|
return 1;
|
|
646
650
|
}
|
|
647
651
|
warnMissingSecrets(ctx, slug, args.declaredSecretNames, detail.secretNames);
|
|
652
|
+
warnMismatchedCredentialPrefixes(ctx, slug, args.credentialEnvs, detail.secretNames ?? []);
|
|
648
653
|
const watchesRepositories = args.hasScmChannels || args.hasDeploymentsChannels === true;
|
|
649
654
|
ctx.out(`Deployed ${slug} (team ${ctx.teamId})\n` +
|
|
650
655
|
` status: running\n` +
|
|
@@ -712,6 +717,7 @@ async function readDeployManifest(dir) {
|
|
|
712
717
|
credentialSecretNames: [
|
|
713
718
|
...new Set(project.channels.flatMap((channel) => channelCredentialSecretNames(channel.definition))),
|
|
714
719
|
],
|
|
720
|
+
credentialEnvs: credentialEnvsFromChannels(project.channels),
|
|
715
721
|
secretAlternatives: project.channels.flatMap((channel) => channelSecretAlternatives(channel.definition)),
|
|
716
722
|
hasScmChannels: project.channels.some((channel) => {
|
|
717
723
|
const kind = channel.definition.meta?.kind;
|
|
@@ -765,6 +771,13 @@ function warnMissingSecrets(ctx, slug, declared, set) {
|
|
|
765
771
|
ctx.err(`warning: secrets declared in the agent manifest but not set on ${slug}: ${missing.join(", ")}\n` +
|
|
766
772
|
` set them with \`${CLI} secret set ${slug} ${missing.join(" ")}\`\n`);
|
|
767
773
|
}
|
|
774
|
+
function warnMismatchedCredentialPrefixes(ctx, slug, channels, set) {
|
|
775
|
+
const mismatch = credentialEnvMismatch(channels, set);
|
|
776
|
+
if (mismatch.stored.length === 0) {
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
ctx.err(formatCredentialEnvMismatch({ command: CLI, slug, mismatch }));
|
|
780
|
+
}
|
|
768
781
|
// ============================================================================
|
|
769
782
|
// deployments (list)
|
|
770
783
|
// ============================================================================
|
|
@@ -1471,6 +1484,11 @@ function createSecretValueReader(stdin, err) {
|
|
|
1471
1484
|
return line;
|
|
1472
1485
|
};
|
|
1473
1486
|
}
|
|
1487
|
+
export async function readSecretValue(stdin, err, name) {
|
|
1488
|
+
return stdin.isTTY === true
|
|
1489
|
+
? promptHidden(stdin, err, `Value for ${name}: `)
|
|
1490
|
+
: readWholeStdinValue(stdin, name);
|
|
1491
|
+
}
|
|
1474
1492
|
/** Longest mask run drawn while typing a secret; the count carries the rest. */
|
|
1475
1493
|
const SECRET_MASK_MAX_WIDTH = 24;
|
|
1476
1494
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-mcp.d.ts","sourceRoot":"","sources":["../../src/internal/cli-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"cli-mcp.d.ts","sourceRoot":"","sources":["../../src/internal/cli-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAuCH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gEAAgE;IAChE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC9B,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC3C,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,wBAAsB,MAAM,CAC1B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,EAAE,aAAa,GAAG;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GACA,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAMD,wBAAsB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAiFzE;AAoKD,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAoD3E;AAED,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,MAAsC,GAAG,MAAM,CAGtF;AA8DD,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQnD"}
|
package/dist/internal/cli-mcp.js
CHANGED
|
@@ -24,7 +24,7 @@ import { readFile } from "node:fs/promises";
|
|
|
24
24
|
import { homedir } from "node:os";
|
|
25
25
|
import { join } from "node:path";
|
|
26
26
|
import { CLI_COMMAND_NAME as CLI, LOG_PREFIX } from "./distribution.js";
|
|
27
|
-
import { writePrivateFile } from "./private-file.js";
|
|
27
|
+
import { resolveLinkedFile, restrictExistingPrivateFile, writePrivateFile, } from "./private-file.js";
|
|
28
28
|
import { sleep as defaultSleep } from "./sleep.js";
|
|
29
29
|
import { isRecord } from "./is-record.js";
|
|
30
30
|
/** Mount path of the MCP surface relative to an agent base URL. */
|
|
@@ -327,7 +327,9 @@ export function cursorMcpJsonPath(home = process.env.HOME ?? homedir()) {
|
|
|
327
327
|
const resolved = home.trim() === "" ? homedir() : home;
|
|
328
328
|
return join(resolved, ".cursor", "mcp.json");
|
|
329
329
|
}
|
|
330
|
-
async function upsertMcpJsonEntry(
|
|
330
|
+
async function upsertMcpJsonEntry(configPath, name, entry) {
|
|
331
|
+
const path = await resolveLinkedFile(configPath);
|
|
332
|
+
await restrictExistingPrivateFile(path, { privateDirectory: false });
|
|
331
333
|
let root = {};
|
|
332
334
|
let raw;
|
|
333
335
|
try {
|
|
@@ -356,7 +358,7 @@ async function upsertMcpJsonEntry(path, name, entry) {
|
|
|
356
358
|
const servers = isRecord(existing) ? existing : {};
|
|
357
359
|
servers[name] = entry;
|
|
358
360
|
root.mcpServers = servers;
|
|
359
|
-
await writePrivateFile(path, `${JSON.stringify(root, null, 2)}\n
|
|
361
|
+
await writePrivateFile(path, `${JSON.stringify(root, null, 2)}\n`, { privateDirectory: false });
|
|
360
362
|
}
|
|
361
363
|
function resolveServerName(name, fallback) {
|
|
362
364
|
const trimmed = name?.trim();
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type TeamsChannelProfile, type TeamsEnvKeys } from "./teams-channel-profile.js";
|
|
2
|
+
export type TeamsDoctorCheckId = "env" | "token" | "bot-tenant" | "bot-endpoint" | "teams-channel" | "endpoint";
|
|
3
|
+
export interface TeamsDoctorCheck {
|
|
4
|
+
id: TeamsDoctorCheckId;
|
|
5
|
+
status: "pass" | "fail" | "skip";
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TeamsDoctorResult {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
checks: TeamsDoctorCheck[];
|
|
11
|
+
/** Null when the channel sets its credentials in code. */
|
|
12
|
+
envKeys: TeamsEnvKeys | null;
|
|
13
|
+
}
|
|
14
|
+
export interface AzCommandResult {
|
|
15
|
+
code: number | null;
|
|
16
|
+
stdout: string;
|
|
17
|
+
stderr: string;
|
|
18
|
+
timedOut?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type RunAz = (args: readonly string[]) => Promise<AzCommandResult>;
|
|
21
|
+
export declare function runTeamsDoctor(input: {
|
|
22
|
+
env: NodeJS.ProcessEnv;
|
|
23
|
+
target: TeamsChannelProfile;
|
|
24
|
+
endpoint?: string;
|
|
25
|
+
fetchImpl?: typeof fetch;
|
|
26
|
+
runAz?: RunAz;
|
|
27
|
+
}): Promise<TeamsDoctorResult>;
|
|
28
|
+
export interface TeamsDoctorOptions {
|
|
29
|
+
dir: string;
|
|
30
|
+
slug?: string;
|
|
31
|
+
channel?: string;
|
|
32
|
+
endpoint?: string;
|
|
33
|
+
json?: boolean;
|
|
34
|
+
fetchImpl?: typeof fetch;
|
|
35
|
+
runAz?: RunAz;
|
|
36
|
+
out?: (text: string) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare function cmdTeamsDoctor(options: TeamsDoctorOptions): Promise<number>;
|
|
39
|
+
//# sourceMappingURL=cli-teams-doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-teams-doctor.d.ts","sourceRoot":"","sources":["../../src/internal/cli-teams-doctor.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAC1B,KAAK,GACL,OAAO,GACP,YAAY,GACZ,cAAc,GACd,eAAe,GACf,UAAU,CAAC;AAEf,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,kBAAkB,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,0DAA0D;IAC1D,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;AAukB1E,wBAAsB,cAAc,CAAC,KAAK,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAmD7B;AAaD,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BjF"}
|
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { channelRoutePath } from "../channels/github/forward.js";
|
|
3
|
+
import { CliUsageError } from "./cli/errors.js";
|
|
4
|
+
import { describeError, unknownErrorCode } from "./describe-error.js";
|
|
5
|
+
import { CLI_COMMAND_NAME as CLI } from "./distribution.js";
|
|
6
|
+
import { isRecord } from "./is-record.js";
|
|
7
|
+
import { loadAgentLocalEnv } from "./local-env.js";
|
|
8
|
+
import { isLoopbackHostname } from "./net.js";
|
|
9
|
+
import { runProgram } from "./run-program.js";
|
|
10
|
+
import { credentialsInCodeMessage, envKeyList, loadTeamsChannelProfile, } from "./teams-channel-profile.js";
|
|
11
|
+
const CHECK_MARK = {
|
|
12
|
+
pass: "ok",
|
|
13
|
+
fail: "!!",
|
|
14
|
+
skip: "--",
|
|
15
|
+
};
|
|
16
|
+
const PROBE_TIMEOUT_MS = 10_000;
|
|
17
|
+
const ENTRA_TIMEOUT_MS = 10_000;
|
|
18
|
+
const AZ_TIMEOUT_MS = 30_000;
|
|
19
|
+
const BOT_RESOURCE_TYPE = "Microsoft.BotService/botServices";
|
|
20
|
+
const PUBLIC_ENDPOINT = `the public URL that \`${CLI} dev\` or \`${CLI} channels teams forward\` prints`;
|
|
21
|
+
const ENDPOINT_OUTCOMES = [
|
|
22
|
+
{
|
|
23
|
+
when: (status, error) => status === 401 && error === "invalid_token",
|
|
24
|
+
status: "pass",
|
|
25
|
+
message: "the Teams channel answers here and resolves its credentials; it refused the unsigned probe as it should.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
// Cursor-managed hosting checks the token before the agent, so this proves reachability only.
|
|
29
|
+
when: (status, error, mount) => mount === "hosted" && status === 401 && error === "Unauthorized",
|
|
30
|
+
status: "pass",
|
|
31
|
+
message: "the hosted endpoint answers here and refused the unsigned probe. It does not show that the deployment has this channel's secrets or is this agent.",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
when: (status, error) => status === 503 && error === "teams_not_configured",
|
|
35
|
+
status: "fail",
|
|
36
|
+
message: "the server that serves this URL has no app id or password for this channel; check its envPrefix and secrets.",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
when: (status) => status === 404,
|
|
40
|
+
status: "fail",
|
|
41
|
+
message: (expectedPath) => `no Teams channel at this path; expected ${expectedPath}.`,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
when: (status) => status >= 300 && status < 400,
|
|
45
|
+
status: "fail",
|
|
46
|
+
message: "the URL redirects; a dev tunnel needs anonymous access (`devtunnel access create <id> --anonymous`).",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
when: (status) => status === 502 || status === 504 || status === 530,
|
|
50
|
+
status: "fail",
|
|
51
|
+
message: `the tunnel is up but nothing answers behind it; start \`${CLI} dev\` or \`${CLI} serve\`.`,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
function doctorCheck(id, status, message) {
|
|
55
|
+
return { id, status, message };
|
|
56
|
+
}
|
|
57
|
+
function publicHttpsUrl(raw) {
|
|
58
|
+
const url = URL.parse(raw);
|
|
59
|
+
if (url === null || url.protocol !== "https:" || isLoopbackHostname(url.hostname)) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
return url;
|
|
63
|
+
}
|
|
64
|
+
function defaultRunAz(args) {
|
|
65
|
+
return runProgram("az", args, {
|
|
66
|
+
timeoutMs: AZ_TIMEOUT_MS,
|
|
67
|
+
windowsShell: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async function callAz(runAz, args, command, timeoutStatus) {
|
|
71
|
+
try {
|
|
72
|
+
const result = await runAz(args);
|
|
73
|
+
if (result.timedOut === true) {
|
|
74
|
+
return {
|
|
75
|
+
kind: timeoutStatus,
|
|
76
|
+
message: `${command} did not answer within ${AZ_TIMEOUT_MS / 1000} s.`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (unknownErrorCode(error) === "ENOENT") {
|
|
83
|
+
return {
|
|
84
|
+
kind: "skip",
|
|
85
|
+
message: "az is not installed, so the Azure Bot tenant, messaging endpoint, and Teams channel were not checked.",
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return { kind: "fail", message: describeError(error) };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function isAzResult(value) {
|
|
92
|
+
return "code" in value;
|
|
93
|
+
}
|
|
94
|
+
function parseAzJson(stdout) {
|
|
95
|
+
try {
|
|
96
|
+
return JSON.parse(stdout);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function subscriptionName(body) {
|
|
103
|
+
if (!isRecord(body)) {
|
|
104
|
+
return "the current subscription";
|
|
105
|
+
}
|
|
106
|
+
if (typeof body.name === "string" && body.name !== "") {
|
|
107
|
+
return body.name;
|
|
108
|
+
}
|
|
109
|
+
if (typeof body.id === "string" && body.id !== "") {
|
|
110
|
+
return body.id;
|
|
111
|
+
}
|
|
112
|
+
return "the current subscription";
|
|
113
|
+
}
|
|
114
|
+
function parseResourceIds(body) {
|
|
115
|
+
if (!Array.isArray(body)) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
const ids = [];
|
|
119
|
+
for (const item of body) {
|
|
120
|
+
if (!isRecord(item)) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const id = textField(item.id);
|
|
124
|
+
if (id !== undefined) {
|
|
125
|
+
ids.push(id);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return ids;
|
|
129
|
+
}
|
|
130
|
+
function textField(value) {
|
|
131
|
+
if (typeof value !== "string") {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
const trimmed = value.trim();
|
|
135
|
+
return trimmed === "" ? undefined : trimmed;
|
|
136
|
+
}
|
|
137
|
+
const BOT_RESOURCE_ID = /\/resourceGroups\/([^/]+)\/providers\/Microsoft\.BotService\/botServices\/([^/]+)$/i;
|
|
138
|
+
// ARM GET can omit `resourceGroup`, but every resource id carries both parts.
|
|
139
|
+
function parseShownBot(body) {
|
|
140
|
+
if (!isRecord(body) || !isRecord(body.properties)) {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
const msaAppId = textField(body.properties.msaAppId);
|
|
144
|
+
const idParts = BOT_RESOURCE_ID.exec(textField(body.id) ?? "");
|
|
145
|
+
const resourceGroup = idParts?.[1];
|
|
146
|
+
const name = idParts?.[2];
|
|
147
|
+
if (msaAppId === undefined || resourceGroup === undefined || name === undefined) {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
const endpoint = body.properties.endpoint;
|
|
151
|
+
return {
|
|
152
|
+
name,
|
|
153
|
+
resourceGroup,
|
|
154
|
+
msaAppId,
|
|
155
|
+
endpoint: typeof endpoint === "string" && endpoint !== "" ? endpoint : undefined,
|
|
156
|
+
msaAppType: textField(body.properties.msaAppType),
|
|
157
|
+
msaAppTenantId: textField(body.properties.msaAppTenantId),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// `az resource show --ids` prints an object for one id and an array for several.
|
|
161
|
+
function parseShownBots(body) {
|
|
162
|
+
const items = Array.isArray(body) ? body : isRecord(body) ? [body] : undefined;
|
|
163
|
+
if (items === undefined) {
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
const bots = [];
|
|
167
|
+
for (const item of items) {
|
|
168
|
+
const bot = parseShownBot(item);
|
|
169
|
+
if (bot !== undefined) {
|
|
170
|
+
bots.push(bot);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return bots;
|
|
174
|
+
}
|
|
175
|
+
function sameAppId(left, right) {
|
|
176
|
+
return left.trim().toLowerCase() === right.trim().toLowerCase();
|
|
177
|
+
}
|
|
178
|
+
function azDetail(result, command) {
|
|
179
|
+
const line = result.stderr.trim().split("\n")[0] ?? "";
|
|
180
|
+
return line === "" ? `${command} exited ${result.code}` : line;
|
|
181
|
+
}
|
|
182
|
+
async function lookupAzureBot(appId, runAz) {
|
|
183
|
+
const account = await callAz(runAz, ["account", "show", "-o", "json"], "az account show", "skip");
|
|
184
|
+
if (!isAzResult(account)) {
|
|
185
|
+
return account;
|
|
186
|
+
}
|
|
187
|
+
if (account.code !== 0) {
|
|
188
|
+
return {
|
|
189
|
+
kind: "skip",
|
|
190
|
+
message: "run `az login` to check the Azure Bot tenant, messaging endpoint, and Teams channel.",
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const subscription = subscriptionName(parseAzJson(account.stdout));
|
|
194
|
+
const absent = `no Azure Bot in subscription ${subscription} has Microsoft App ID ${appId}. Check the app id, or run \`az account set\` for the bot's subscription.`;
|
|
195
|
+
const listed = await callAz(runAz, ["resource", "list", "--resource-type", BOT_RESOURCE_TYPE, "-o", "json"], "az resource list", "fail");
|
|
196
|
+
if (!isAzResult(listed)) {
|
|
197
|
+
return listed;
|
|
198
|
+
}
|
|
199
|
+
if (listed.code !== 0) {
|
|
200
|
+
return { kind: "fail", message: azDetail(listed, "az resource list") };
|
|
201
|
+
}
|
|
202
|
+
const ids = parseResourceIds(parseAzJson(listed.stdout));
|
|
203
|
+
if (ids === undefined) {
|
|
204
|
+
return { kind: "fail", message: "az resource list did not return a JSON array." };
|
|
205
|
+
}
|
|
206
|
+
if (ids.length === 0) {
|
|
207
|
+
return { kind: "fail", message: absent };
|
|
208
|
+
}
|
|
209
|
+
const shown = await callAz(runAz, ["resource", "show", "--ids", ...ids, "-o", "json"], "az resource show", "fail");
|
|
210
|
+
if (!isAzResult(shown)) {
|
|
211
|
+
return shown;
|
|
212
|
+
}
|
|
213
|
+
// One unreadable or deleted bot makes the call exit non-zero, but stdout still holds the rest.
|
|
214
|
+
const bots = parseShownBots(parseAzJson(shown.stdout));
|
|
215
|
+
const bot = bots?.find((candidate) => sameAppId(candidate.msaAppId, appId));
|
|
216
|
+
if (bot !== undefined) {
|
|
217
|
+
return {
|
|
218
|
+
kind: "found",
|
|
219
|
+
name: bot.name,
|
|
220
|
+
resourceGroup: bot.resourceGroup,
|
|
221
|
+
endpoint: bot.endpoint,
|
|
222
|
+
msaAppType: bot.msaAppType,
|
|
223
|
+
msaAppTenantId: bot.msaAppTenantId,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
if (shown.code !== 0) {
|
|
227
|
+
return { kind: "fail", message: azDetail(shown, "az resource show") };
|
|
228
|
+
}
|
|
229
|
+
if (bots === undefined) {
|
|
230
|
+
return { kind: "fail", message: "az resource show did not return JSON for the listed bots." };
|
|
231
|
+
}
|
|
232
|
+
return { kind: "fail", message: absent };
|
|
233
|
+
}
|
|
234
|
+
function checkBotTenant(bot, tenantId) {
|
|
235
|
+
if (bot.msaAppType === "SingleTenant" &&
|
|
236
|
+
bot.msaAppTenantId !== undefined &&
|
|
237
|
+
sameAppId(bot.msaAppTenantId, tenantId)) {
|
|
238
|
+
return doctorCheck("bot-tenant", "pass", `the Azure Bot is SingleTenant in tenant ${tenantId}.`);
|
|
239
|
+
}
|
|
240
|
+
if (bot.msaAppType !== "SingleTenant") {
|
|
241
|
+
const named = bot.msaAppType === undefined ? "has no app type" : `is ${bot.msaAppType}`;
|
|
242
|
+
return doctorCheck("bot-tenant", "fail", `the Azure Bot ${named}; create a Single Tenant bot in tenant ${tenantId}.`);
|
|
243
|
+
}
|
|
244
|
+
return doctorCheck("bot-tenant", "fail", `the Azure Bot's tenant is ${bot.msaAppTenantId ?? "missing"}, not ${tenantId}.`);
|
|
245
|
+
}
|
|
246
|
+
function checkBotEndpoint(bot, expected) {
|
|
247
|
+
if (bot.endpoint === undefined) {
|
|
248
|
+
return doctorCheck("bot-endpoint", "fail", "the Azure Bot has no messaging endpoint. Configuration, Messaging endpoint, Apply.");
|
|
249
|
+
}
|
|
250
|
+
if (expected === undefined) {
|
|
251
|
+
return doctorCheck("bot-endpoint", "pass", `Azure Bot messaging endpoint is ${bot.endpoint}.`);
|
|
252
|
+
}
|
|
253
|
+
const azure = URL.parse(bot.endpoint);
|
|
254
|
+
const wanted = URL.parse(expected);
|
|
255
|
+
if (azure !== null && wanted !== null && azure.href === wanted.href) {
|
|
256
|
+
return doctorCheck("bot-endpoint", "pass", `Azure Bot messaging endpoint matches ${expected}.`);
|
|
257
|
+
}
|
|
258
|
+
return doctorCheck("bot-endpoint", "fail", `Azure Bot messaging endpoint is ${bot.endpoint}, not ${expected}. Configuration, Messaging endpoint, Apply.`);
|
|
259
|
+
}
|
|
260
|
+
function readTeamsEnabled(body) {
|
|
261
|
+
if (!isRecord(body) || !isRecord(body.properties) || !isRecord(body.properties.properties)) {
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
const enabled = body.properties.properties.isEnabled;
|
|
265
|
+
return typeof enabled === "boolean" ? enabled : undefined;
|
|
266
|
+
}
|
|
267
|
+
async function checkTeamsChannel(bot, runAz) {
|
|
268
|
+
const shown = await callAz(runAz, ["bot", "msteams", "show", "-n", bot.name, "-g", bot.resourceGroup, "-o", "json"], "az bot msteams show", "fail");
|
|
269
|
+
if (!isAzResult(shown)) {
|
|
270
|
+
return doctorCheck("teams-channel", shown.kind, shown.message);
|
|
271
|
+
}
|
|
272
|
+
if (shown.code !== 0) {
|
|
273
|
+
// `az bot` needs the Bot Service extension, so other failures are CLI problems, not portal ones.
|
|
274
|
+
return /not ?found/i.test(shown.stderr)
|
|
275
|
+
? doctorCheck("teams-channel", "fail", "the Microsoft Teams channel is not added (Channels, Microsoft Teams, Apply).")
|
|
276
|
+
: doctorCheck("teams-channel", "fail", `could not read the Microsoft Teams channel: ${azDetail(shown, "az bot msteams show")}`);
|
|
277
|
+
}
|
|
278
|
+
const enabled = readTeamsEnabled(parseAzJson(shown.stdout));
|
|
279
|
+
if (enabled === true) {
|
|
280
|
+
return doctorCheck("teams-channel", "pass", "the Microsoft Teams channel is enabled.");
|
|
281
|
+
}
|
|
282
|
+
if (enabled === false) {
|
|
283
|
+
return doctorCheck("teams-channel", "fail", "the Microsoft Teams channel is turned off (Channels, Microsoft Teams, Apply).");
|
|
284
|
+
}
|
|
285
|
+
return doctorCheck("teams-channel", "fail", "the Microsoft Teams channel state could not be read.");
|
|
286
|
+
}
|
|
287
|
+
async function responseError(response) {
|
|
288
|
+
const body = await response.json().catch(() => undefined);
|
|
289
|
+
if (!isRecord(body) || typeof body.error !== "string") {
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
292
|
+
return body.error;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Another channel's endpoint also refuses an unsigned probe, so the path must
|
|
296
|
+
* name this channel: bare in a single-agent serve, after the slug in a
|
|
297
|
+
* multi-agent serve, or after `/engine` or `/engine/<slug>` on Cursor-managed
|
|
298
|
+
* hosting.
|
|
299
|
+
*/
|
|
300
|
+
function channelMount(url, target) {
|
|
301
|
+
const pathname = new URL(url).pathname;
|
|
302
|
+
const channelPath = channelRoutePath({ ...target, slug: "" });
|
|
303
|
+
if (!pathname.endsWith(channelPath)) {
|
|
304
|
+
return undefined;
|
|
305
|
+
}
|
|
306
|
+
const mount = pathname.slice(0, pathname.length - channelPath.length);
|
|
307
|
+
if (mount === "" || mount === `/${target.slug}`) {
|
|
308
|
+
return "local";
|
|
309
|
+
}
|
|
310
|
+
const hosted = mount.endsWith("/engine") || (target.slug !== "" && mount.endsWith(`/engine/${target.slug}`));
|
|
311
|
+
return hosted ? "hosted" : undefined;
|
|
312
|
+
}
|
|
313
|
+
async function checkEndpoint(input) {
|
|
314
|
+
if (input.url === undefined) {
|
|
315
|
+
return doctorCheck("endpoint", "skip", `no messaging endpoint to probe. Pass --endpoint, ${PUBLIC_ENDPOINT}.`);
|
|
316
|
+
}
|
|
317
|
+
const expectedPath = channelRoutePath(input.target);
|
|
318
|
+
const mount = channelMount(input.url, input.target);
|
|
319
|
+
if (mount === undefined) {
|
|
320
|
+
return doctorCheck("endpoint", "fail", `this URL is not this channel's messaging endpoint; its path must end in ${expectedPath}.`);
|
|
321
|
+
}
|
|
322
|
+
let response;
|
|
323
|
+
try {
|
|
324
|
+
response = await input.fetchImpl(input.url, {
|
|
325
|
+
method: "POST",
|
|
326
|
+
headers: { "content-type": "application/json" },
|
|
327
|
+
body: "{}",
|
|
328
|
+
redirect: "manual",
|
|
329
|
+
signal: AbortSignal.timeout(PROBE_TIMEOUT_MS),
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
return doctorCheck("endpoint", "fail", describeError(error));
|
|
334
|
+
}
|
|
335
|
+
const error = await responseError(response);
|
|
336
|
+
const outcome = ENDPOINT_OUTCOMES.find((row) => row.when(response.status, error, mount));
|
|
337
|
+
if (outcome === undefined) {
|
|
338
|
+
return doctorCheck("endpoint", "fail", `HTTP ${response.status}`);
|
|
339
|
+
}
|
|
340
|
+
const message = typeof outcome.message === "function" ? outcome.message(expectedPath) : outcome.message;
|
|
341
|
+
return doctorCheck("endpoint", outcome.status, message);
|
|
342
|
+
}
|
|
343
|
+
async function checkToken(input) {
|
|
344
|
+
const url = `https://login.microsoftonline.com/${encodeURIComponent(input.tenantId)}/oauth2/v2.0/token`;
|
|
345
|
+
let response;
|
|
346
|
+
try {
|
|
347
|
+
response = await input.fetchImpl(url, {
|
|
348
|
+
method: "POST",
|
|
349
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
350
|
+
body: new URLSearchParams({
|
|
351
|
+
grant_type: "client_credentials",
|
|
352
|
+
client_id: input.appId,
|
|
353
|
+
client_secret: input.appPassword,
|
|
354
|
+
scope: "https://api.botframework.com/.default",
|
|
355
|
+
}),
|
|
356
|
+
signal: AbortSignal.timeout(ENTRA_TIMEOUT_MS),
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
if (entraTimedOut(error)) {
|
|
361
|
+
return doctorCheck("token", "fail", `Microsoft Entra did not answer within ${ENTRA_TIMEOUT_MS / 1000} s`);
|
|
362
|
+
}
|
|
363
|
+
return doctorCheck("token", "fail", describeError(error));
|
|
364
|
+
}
|
|
365
|
+
const body = await response.json().catch(() => undefined);
|
|
366
|
+
if (response.status === 200 && isRecord(body) && typeof body.access_token === "string") {
|
|
367
|
+
return doctorCheck("token", "pass", `Bot Framework token issued for app ${input.appId} in tenant ${input.tenantId}`);
|
|
368
|
+
}
|
|
369
|
+
const description = isRecord(body) && typeof body.error_description === "string"
|
|
370
|
+
? body.error_description
|
|
371
|
+
: undefined;
|
|
372
|
+
if (description === undefined) {
|
|
373
|
+
return doctorCheck("token", "fail", `HTTP ${response.status}`);
|
|
374
|
+
}
|
|
375
|
+
// Entra appends trace, correlation, and timestamp ids that change on every call.
|
|
376
|
+
const traceAt = description.indexOf(" Trace ID:");
|
|
377
|
+
return doctorCheck("token", "fail", (traceAt === -1 ? description : description.slice(0, traceAt)).trim());
|
|
378
|
+
}
|
|
379
|
+
function entraTimedOut(error) {
|
|
380
|
+
if (typeof error !== "object" || error === null || !("name" in error)) {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
return error.name === "TimeoutError" || error.name === "AbortError";
|
|
384
|
+
}
|
|
385
|
+
function azureChecks(status, message) {
|
|
386
|
+
return [
|
|
387
|
+
doctorCheck("bot-tenant", status, message),
|
|
388
|
+
doctorCheck("bot-endpoint", status, message),
|
|
389
|
+
doctorCheck("teams-channel", status, message),
|
|
390
|
+
];
|
|
391
|
+
}
|
|
392
|
+
/** The env, token, and Azure checks for a channel that reads its credentials from env. */
|
|
393
|
+
async function checkCredentials(input) {
|
|
394
|
+
const { envKeys, env, fetchImpl, runAz } = input;
|
|
395
|
+
const read = (key) => env[key]?.trim() ?? "";
|
|
396
|
+
const missing = envKeyList(envKeys).filter((key) => read(key) === "");
|
|
397
|
+
const checks = [
|
|
398
|
+
doctorCheck("env", missing.length === 0 ? "pass" : "fail", missing.length === 0
|
|
399
|
+
? `${envKeyList(envKeys).join(", ")} set`
|
|
400
|
+
: `missing ${missing.join(", ")}. Run \`${CLI} channels teams init\`.`),
|
|
401
|
+
];
|
|
402
|
+
if (missing.length === 0) {
|
|
403
|
+
checks.push(await checkToken({
|
|
404
|
+
appId: read(envKeys.appId),
|
|
405
|
+
appPassword: read(envKeys.appPassword),
|
|
406
|
+
tenantId: read(envKeys.tenantId),
|
|
407
|
+
fetchImpl,
|
|
408
|
+
}));
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
const verb = missing.length === 1 ? "is" : "are";
|
|
412
|
+
checks.push(doctorCheck("token", "skip", `not checked: ${missing.join(", ")} ${verb} missing`));
|
|
413
|
+
}
|
|
414
|
+
const appId = read(envKeys.appId);
|
|
415
|
+
if (appId === "") {
|
|
416
|
+
checks.push(...azureChecks("skip", "no app id is set, so the Azure Bot tenant, messaging endpoint, and Teams channel were not checked."));
|
|
417
|
+
return { checks, azureEndpoint: undefined };
|
|
418
|
+
}
|
|
419
|
+
const lookup = await lookupAzureBot(appId, runAz);
|
|
420
|
+
if (lookup.kind !== "found") {
|
|
421
|
+
checks.push(...azureChecks(lookup.kind, lookup.message));
|
|
422
|
+
return { checks, azureEndpoint: undefined };
|
|
423
|
+
}
|
|
424
|
+
checks.push(checkBotTenant(lookup, read(envKeys.tenantId)));
|
|
425
|
+
checks.push(checkBotEndpoint(lookup, input.endpoint));
|
|
426
|
+
checks.push(await checkTeamsChannel(lookup, runAz));
|
|
427
|
+
return { checks, azureEndpoint: lookup.endpoint };
|
|
428
|
+
}
|
|
429
|
+
export async function runTeamsDoctor(input) {
|
|
430
|
+
const { env, target } = input;
|
|
431
|
+
const envKeys = target.credentialEnv?.keys;
|
|
432
|
+
const fetchImpl = input.fetchImpl ?? fetch;
|
|
433
|
+
const runAz = input.runAz ?? defaultRunAz;
|
|
434
|
+
let checks;
|
|
435
|
+
let azureEndpoint;
|
|
436
|
+
if (envKeys === undefined) {
|
|
437
|
+
const inCode = `${credentialsInCodeMessage(target)}; not checked.`;
|
|
438
|
+
checks = [
|
|
439
|
+
doctorCheck("env", "skip", inCode),
|
|
440
|
+
doctorCheck("token", "skip", inCode),
|
|
441
|
+
...azureChecks("skip", inCode),
|
|
442
|
+
];
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
({ checks, azureEndpoint } = await checkCredentials({
|
|
446
|
+
envKeys,
|
|
447
|
+
env,
|
|
448
|
+
endpoint: input.endpoint,
|
|
449
|
+
fetchImpl,
|
|
450
|
+
runAz,
|
|
451
|
+
}));
|
|
452
|
+
}
|
|
453
|
+
// An unsigned POST to loopback is admitted under `dev`, so only a public URL can fail closed.
|
|
454
|
+
const probeUrl = input.endpoint ??
|
|
455
|
+
(azureEndpoint !== undefined && publicHttpsUrl(azureEndpoint) !== undefined
|
|
456
|
+
? azureEndpoint
|
|
457
|
+
: undefined);
|
|
458
|
+
if (input.endpoint === undefined && azureEndpoint !== undefined && probeUrl === undefined) {
|
|
459
|
+
checks.push(doctorCheck("endpoint", "fail", `the Azure Bot messaging endpoint is not a public https URL, so it was not probed. Pass --endpoint, ${PUBLIC_ENDPOINT}.`));
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
checks.push(await checkEndpoint({
|
|
463
|
+
url: probeUrl,
|
|
464
|
+
target: input.target,
|
|
465
|
+
fetchImpl,
|
|
466
|
+
}));
|
|
467
|
+
}
|
|
468
|
+
return {
|
|
469
|
+
ok: checks.every((check) => check.status !== "fail"),
|
|
470
|
+
checks,
|
|
471
|
+
envKeys: envKeys ?? null,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function renderTeamsDoctorReport(result) {
|
|
475
|
+
const lines = [
|
|
476
|
+
`env: ${result.envKeys === null ? "set in code" : envKeyList(result.envKeys).join(" / ")}`,
|
|
477
|
+
];
|
|
478
|
+
for (const check of result.checks) {
|
|
479
|
+
lines.push(`${CHECK_MARK[check.status]} ${check.id}: ${check.message}`);
|
|
480
|
+
}
|
|
481
|
+
lines.push(result.ok ? "doctor: pass" : "doctor: fail");
|
|
482
|
+
return `${lines.join("\n")}\n`;
|
|
483
|
+
}
|
|
484
|
+
export async function cmdTeamsDoctor(options) {
|
|
485
|
+
if (options.endpoint !== undefined && publicHttpsUrl(options.endpoint) === undefined) {
|
|
486
|
+
throw new CliUsageError(`--endpoint must be ${PUBLIC_ENDPOINT}.`);
|
|
487
|
+
}
|
|
488
|
+
const endpoint = options.endpoint;
|
|
489
|
+
const out = options.out ?? ((text) => void process.stdout.write(text));
|
|
490
|
+
const dir = resolve(options.dir);
|
|
491
|
+
const profile = await loadTeamsChannelProfile({
|
|
492
|
+
dir: options.dir,
|
|
493
|
+
slug: options.slug,
|
|
494
|
+
channel: options.channel,
|
|
495
|
+
});
|
|
496
|
+
loadAgentLocalEnv(dir);
|
|
497
|
+
const result = await runTeamsDoctor({
|
|
498
|
+
env: process.env,
|
|
499
|
+
target: profile,
|
|
500
|
+
endpoint,
|
|
501
|
+
fetchImpl: options.fetchImpl,
|
|
502
|
+
runAz: options.runAz,
|
|
503
|
+
});
|
|
504
|
+
out(options.json === true
|
|
505
|
+
? `${JSON.stringify(result, null, 2)}\n`
|
|
506
|
+
: renderTeamsDoctorReport(result));
|
|
507
|
+
return result.ok ? 0 : 1;
|
|
508
|
+
}
|