@grok/agent-sdk 0.6.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.
- package/AGENTS.md +40 -0
- 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/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.Ch-048af.js} +4 -4
- package/dist/docs/assets/changelog.md.SoN0MK7o.js +1 -0
- package/dist/docs/assets/{changelog.md.DVNB-ApU.lean.js → changelog.md.SoN0MK7o.lean.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.BdYoBKxY.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.v_dV4U2Q.js → VPLocalSearchBox.D7BIa9Su.js} +2 -2
- package/dist/docs/assets/chunks/{arc.5o92kOg5.js → arc.BIzu7OVF.js} +1 -1
- package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.C-oTwnNq.js → architectureDiagram-Q4EWVU46.DNznI0Sn.js} +1 -1
- package/dist/docs/assets/chunks/{baseUniq.zJ-VNOib.js → baseUniq.B4y6Y5eG.js} +1 -1
- package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.B9ZJZuPd.js → blockDiagram-DXYQGD6D.BudnBsgw.js} +1 -1
- package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.BBMwSIaN.js → c4Diagram-AHTNJAMY._bB00GdB.js} +1 -1
- package/dist/docs/assets/chunks/channel.CgxlmuBS.js +1 -0
- package/dist/docs/assets/chunks/{chunk-4BX2VUAB.D8qAJpDD.js → chunk-4BX2VUAB.CRftnUwS.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-4TB4RGXK.B8QR5cdE.js → chunk-4TB4RGXK.CSx1x2Ob.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-55IACEB6.BsWxVuew.js → chunk-55IACEB6.KkLHAAbH.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-EDXVE4YY.BeGygY_i.js → chunk-EDXVE4YY.DDeKCCtX.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-FMBD7UC4.DdwgH-ZH.js → chunk-FMBD7UC4.DrLlsD9m.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-OYMX7WX6.B9zC_ALe.js → chunk-OYMX7WX6.DeVYOGcT.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BIxJ0rcL.js → chunk-QZHKN3VN.Cz4_bS6p.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-YZCP3GAM.qiM_23_f.js → chunk-YZCP3GAM.CwrYtDVo.js} +1 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.DWroREP-.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.DWroREP-.js +1 -0
- package/dist/docs/assets/chunks/clone.F824-PNx.js +1 -0
- package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.BKB971D5.js → cose-bilkent-S5V4N54A.3d8hflz6.js} +1 -1
- package/dist/docs/assets/chunks/{dagre-KV5264BT.CcILjJgp.js → dagre-KV5264BT.BVEgjiPg.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-5BDNPKRD.DkY9A0nu.js → diagram-5BDNPKRD.j7dZpUK_.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.BbdzmjMt.js → diagram-G4DWMVQ6.4flIgIon.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-MMDJMWI5.Be0zy1cM.js → diagram-MMDJMWI5.BlJiFh-S.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-TYMM5635.zOiEycLe.js → diagram-TYMM5635.DHAOHEyM.js} +1 -1
- package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DUd_9HMF.js → erDiagram-SMLLAGMA.DkmyG7xK.js} +1 -1
- package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.2KPYoZBO.js → flowDiagram-DWJPFMVM.L_WiaAU6.js} +1 -1
- package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.DqE8_YpP.js → ganttDiagram-T4ZO3ILL.CT6kOI2a.js} +1 -1
- package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.CO0Tk47h.js → gitGraphDiagram-UUTBAWPF.D8CRlLqh.js} +1 -1
- package/dist/docs/assets/chunks/{graph.CNe5KbNy.js → graph.CdOyJvsX.js} +1 -1
- package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.BBhJ1X1B.js → infoDiagram-42DDH7IO.DcmXeSos.js} +1 -1
- package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.KSIw9w3I.js → ishikawaDiagram-UXIWVN3A.BBjY4mxr.js} +1 -1
- package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BN2Y5oUJ.js → journeyDiagram-VCZTEJTY.BrXteAB6.js} +1 -1
- package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.2KFuDYn_.js → kanban-definition-6JOO6SKY.OlHsUJVV.js} +1 -1
- package/dist/docs/assets/chunks/{layout.Demb_pzL.js → layout.DDwvoQlY.js} +1 -1
- package/dist/docs/assets/chunks/{linear.kYKxzbbR.js → linear.BRXPDWj3.js} +1 -1
- package/dist/docs/assets/chunks/{min.DwmCN5dF.js → min.3YwC0t3o.js} +1 -1
- package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.CGlz01QG.js → mindmap-definition-QFDTVHPH.mPHnT2lN.js} +1 -1
- package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.n3qsq4nA.js → pieDiagram-DEJITSTG.DEK2--em.js} +1 -1
- package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CGNJ1GSb.js → quadrantDiagram-34T5L4WZ.NCdRAOzK.js} +1 -1
- package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.VhAzHDwQ.js → requirementDiagram-MS252O5E.DLAocFWZ.js} +1 -1
- package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.DmHA5pW-.js → sankeyDiagram-XADWPNL6.afIOqpyT.js} +1 -1
- package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23._TC1aKhg.js → sequenceDiagram-FGHM5R23.DXBjvkkE.js} +1 -1
- package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.B-kLjV3O.js → stateDiagram-FHFEXIEX.B_SGgvgs.js} +1 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.OKAy5Bz7.js +1 -0
- package/dist/docs/assets/chunks/{theme.BaVlHHL-.js → theme.bNyH5NPA.js} +2 -2
- package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.CresbphV.js → timeline-definition-GMOUNBTQ.CE6S1iSb.js} +1 -1
- package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.CegHD8Y4.js → vennDiagram-DHZGUBPP.Blk7wb8V.js} +1 -1
- package/dist/docs/assets/chunks/{wardley-RL74JXVD.DjCmZrUO.js → wardley-RL74JXVD.DQqE3WF8.js} +1 -1
- package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.BJ7s1zdZ.js → wardleyDiagram-NUSXRM2D.MUEQyRnz.js} +1 -1
- package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.IrEXlemI.js → xychartDiagram-5P7HB3ND.DnJA2aXp.js} +1 -1
- package/dist/docs/assets/{deployment.md.DJtuDVLh.js → deployment.md.N9S5KC5R.js} +2 -2
- package/dist/docs/assets/{deployment.md.DJtuDVLh.lean.js → deployment.md.N9S5KC5R.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/{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 +35 -0
- package/dist/docs/deployment.html +39 -39
- package/dist/docs/deployment.md +10 -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/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +37 -37
- package/dist/docs/index.html +37 -37
- package/dist/docs/llms-full.txt +636 -4
- package/dist/docs/llms.txt +1 -0
- package/dist/docs/quickstart.html +37 -37
- package/dist/docs/reference/access.html +36 -36
- package/dist/docs/reference/agent-config.html +37 -37
- 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-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 +1 -0
- package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
- package/dist/internal/cursor-account-mcp-auth.js +2 -1
- 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/connections.d.ts.map +1 -1
- package/dist/internal/discovery/connections.js +53 -0
- 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 +8 -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 +3 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.js +69 -1
- package/dist/internal/hosted-delivery.d.ts +5 -2
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +11 -2
- 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/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/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 +45 -4
- 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 +136 -5
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +580 -92
- 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 +127 -0
- package/dist/oidc-token.d.ts.map +1 -0
- package/dist/oidc-token.js +221 -0
- package/dist/playground/assets/index-BaBSZXki.css +1 -0
- package/dist/playground/assets/index-BkAF8YlO.js +62 -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 +35 -0
- package/docs/deployment.md +10 -0
- package/docs/guides/cloud-agents.md +47 -0
- package/docs/guides/teams.md +389 -0
- 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 +21 -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
|
@@ -189,6 +189,7 @@ function rawSlackFile(value) {
|
|
|
189
189
|
name: value.name,
|
|
190
190
|
title: value.title,
|
|
191
191
|
size: value.size,
|
|
192
|
+
permalink: value.permalink,
|
|
192
193
|
url_private_download: value.url_private_download,
|
|
193
194
|
dataBase64: value.dataBase64,
|
|
194
195
|
};
|
|
@@ -202,7 +203,9 @@ function hasTextSlackHint(file) {
|
|
|
202
203
|
}
|
|
203
204
|
/**
|
|
204
205
|
* Classify a Slack file as image / document / video. Tolerates empty
|
|
205
|
-
* `mimetype` on snippets (Slack fills it asynchronously).
|
|
206
|
+
* `mimetype` on snippets (Slack fills it asynchronously). Every `image/*`
|
|
207
|
+
* is an image: formats the model cannot read (HEIC, TIFF) still have
|
|
208
|
+
* Slack's JPEG or PNG renditions.
|
|
206
209
|
*/
|
|
207
210
|
export function classifySlackFile(file) {
|
|
208
211
|
const populatedMimeType = typeof file.mimetype === "string" ? normalizeMimeType(file.mimetype) : "";
|
|
@@ -211,7 +214,7 @@ export function classifySlackFile(file) {
|
|
|
211
214
|
if (mimeType.length === 0) {
|
|
212
215
|
return undefined;
|
|
213
216
|
}
|
|
214
|
-
if (
|
|
217
|
+
if (mimeType.startsWith("image/")) {
|
|
215
218
|
return { kind: "image", mimeType };
|
|
216
219
|
}
|
|
217
220
|
const filename = typeof file.name === "string"
|
|
@@ -261,25 +264,28 @@ export function collectSlackMessageFiles(message) {
|
|
|
261
264
|
}
|
|
262
265
|
return files;
|
|
263
266
|
}
|
|
264
|
-
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const id = asString(file.id);
|
|
269
|
-
if (id === undefined || id.length === 0) {
|
|
270
|
-
continue;
|
|
271
|
-
}
|
|
272
|
-
refs.push({
|
|
273
|
-
id,
|
|
274
|
-
name: asString(file.name),
|
|
275
|
-
title: asString(file.title),
|
|
276
|
-
mimetype: asString(file.mimetype),
|
|
277
|
-
filetype: asString(file.filetype),
|
|
278
|
-
mode: asString(file.mode),
|
|
279
|
-
size: asNumber(file.size),
|
|
280
|
-
dataBase64: asString(file.dataBase64),
|
|
281
|
-
});
|
|
267
|
+
function slackFileRef(file) {
|
|
268
|
+
const id = asString(file.id);
|
|
269
|
+
if (id === undefined || id.length === 0) {
|
|
270
|
+
return undefined;
|
|
282
271
|
}
|
|
272
|
+
return {
|
|
273
|
+
id,
|
|
274
|
+
name: asString(file.name),
|
|
275
|
+
title: asString(file.title),
|
|
276
|
+
mimetype: asString(file.mimetype),
|
|
277
|
+
filetype: asString(file.filetype),
|
|
278
|
+
mode: asString(file.mode),
|
|
279
|
+
size: asNumber(file.size),
|
|
280
|
+
permalink: asString(file.permalink),
|
|
281
|
+
dataBase64: asString(file.dataBase64),
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
export function parseSlackFileRefs(message) {
|
|
285
|
+
const refs = collectSlackMessageFiles(message).flatMap((file) => {
|
|
286
|
+
const ref = slackFileRef(file);
|
|
287
|
+
return ref === undefined ? [] : [ref];
|
|
288
|
+
});
|
|
283
289
|
return refs.length > 0 ? refs : undefined;
|
|
284
290
|
}
|
|
285
291
|
function attachmentFilename(file) {
|
|
@@ -309,36 +315,20 @@ function isTextLikeBytes(args) {
|
|
|
309
315
|
args.mimeType === "application/x-yaml" ||
|
|
310
316
|
args.mimeType === "application/toml");
|
|
311
317
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
const file = asRecord(info.file);
|
|
327
|
-
if (file === null) {
|
|
328
|
-
return null;
|
|
329
|
-
}
|
|
330
|
-
const thumbnailUrl = args.preferImageThumbnail ? slackImageThumbnailUrl(file) : undefined;
|
|
331
|
-
const downloadUrl = thumbnailUrl ?? asString(file.url_private_download);
|
|
332
|
-
if (downloadUrl === undefined || downloadUrl.length === 0) {
|
|
333
|
-
return null;
|
|
334
|
-
}
|
|
335
|
-
// `file.size` is the original's size, which says nothing about the rendition.
|
|
336
|
-
if (thumbnailUrl === undefined) {
|
|
337
|
-
const fileSize = asNumber(file.size);
|
|
338
|
-
if (fileSize !== undefined && fileSize > args.maxBytes) {
|
|
339
|
-
return null;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
318
|
+
function nonEmptyString(value) {
|
|
319
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
320
|
+
}
|
|
321
|
+
function formatMegabytes(bytes) {
|
|
322
|
+
return `${(bytes / (1024 * 1024)).toFixed(1).replace(/\.0$/, "")} MB`;
|
|
323
|
+
}
|
|
324
|
+
function formatDuration(ms) {
|
|
325
|
+
const seconds = Math.round(ms / 1000);
|
|
326
|
+
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
327
|
+
}
|
|
328
|
+
function overLimit(maxBytes) {
|
|
329
|
+
return `it is over the ${formatMegabytes(maxBytes)} limit`;
|
|
330
|
+
}
|
|
331
|
+
async function downloadSlackUrl(args) {
|
|
342
332
|
const botToken = await tryResolveBotToken({ botToken: args.botToken });
|
|
343
333
|
const headers = {};
|
|
344
334
|
if (botToken !== undefined && botToken.length > 0) {
|
|
@@ -346,22 +336,22 @@ async function downloadSlackFileBytes(args) {
|
|
|
346
336
|
}
|
|
347
337
|
let response;
|
|
348
338
|
try {
|
|
349
|
-
response = await fetch(
|
|
339
|
+
response = await fetch(args.url, {
|
|
350
340
|
headers,
|
|
351
341
|
signal: AbortSignal.timeout(args.downloadTimeoutMs),
|
|
352
342
|
});
|
|
353
343
|
}
|
|
354
344
|
catch {
|
|
355
|
-
return
|
|
345
|
+
return { ok: false, reason: "the download failed or timed out" };
|
|
356
346
|
}
|
|
357
347
|
if (!response.ok) {
|
|
358
|
-
return
|
|
348
|
+
return { ok: false, reason: `Slack answered HTTP ${response.status} to the download` };
|
|
359
349
|
}
|
|
360
350
|
const contentLengthHeader = response.headers.get("content-length");
|
|
361
351
|
if (contentLengthHeader !== null && contentLengthHeader.length > 0) {
|
|
362
352
|
const contentLength = Number.parseInt(contentLengthHeader, 10);
|
|
363
353
|
if (!Number.isNaN(contentLength) && contentLength > args.maxBytes) {
|
|
364
|
-
return
|
|
354
|
+
return { ok: false, reason: overLimit(args.maxBytes) };
|
|
365
355
|
}
|
|
366
356
|
}
|
|
367
357
|
let buffer;
|
|
@@ -369,85 +359,223 @@ async function downloadSlackFileBytes(args) {
|
|
|
369
359
|
buffer = Buffer.from(await response.arrayBuffer());
|
|
370
360
|
}
|
|
371
361
|
catch {
|
|
372
|
-
return
|
|
362
|
+
return { ok: false, reason: "the download failed or timed out" };
|
|
373
363
|
}
|
|
374
364
|
if (buffer.length > args.maxBytes) {
|
|
375
|
-
return
|
|
365
|
+
return { ok: false, reason: overLimit(args.maxBytes) };
|
|
366
|
+
}
|
|
367
|
+
if (buffer.length === 0) {
|
|
368
|
+
return { ok: false, reason: "Slack returned an empty file" };
|
|
376
369
|
}
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
return
|
|
370
|
+
const responseMimeType = normalizeMimeType(response.headers.get("content-type") ?? undefined);
|
|
371
|
+
if (responseMimeType === "text/html" || looksLikeHtml(buffer)) {
|
|
372
|
+
return { ok: false, reason: "Slack returned a sign-in page instead of the file" };
|
|
380
373
|
}
|
|
381
|
-
const responseMimeType = normalizeMimeType(actualContentType ?? undefined);
|
|
382
|
-
const metadataMimeType = normalizeMimeType(asString(file.mimetype) ?? args.fallbackMimeType);
|
|
383
|
-
const effectiveMimeType = responseMimeType.length > 0 && responseMimeType !== "application/octet-stream"
|
|
384
|
-
? responseMimeType
|
|
385
|
-
: metadataMimeType;
|
|
386
374
|
return {
|
|
375
|
+
ok: true,
|
|
387
376
|
data: new Uint8Array(buffer),
|
|
388
|
-
mimeType:
|
|
389
|
-
|
|
377
|
+
mimeType: responseMimeType.length > 0 && responseMimeType !== "application/octet-stream"
|
|
378
|
+
? responseMimeType
|
|
379
|
+
: (sniffImageMimeType(buffer) ?? args.fallbackMimeType),
|
|
390
380
|
};
|
|
391
381
|
}
|
|
392
382
|
/**
|
|
393
|
-
*
|
|
394
|
-
*
|
|
383
|
+
* The image format the bytes start with. A rendition or poster frame of a
|
|
384
|
+
* HEIC or video original is JPEG or PNG, so the original's type is the wrong
|
|
385
|
+
* fallback when Slack sends no usable content type.
|
|
395
386
|
*/
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
387
|
+
function sniffImageMimeType(bytes) {
|
|
388
|
+
const startsWith = (offset, signature) => signature.every((byte, index) => bytes[offset + index] === byte);
|
|
389
|
+
if (startsWith(0, [0x89, 0x50, 0x4e, 0x47])) {
|
|
390
|
+
return "image/png";
|
|
391
|
+
}
|
|
392
|
+
if (startsWith(0, [0xff, 0xd8, 0xff])) {
|
|
393
|
+
return "image/jpeg";
|
|
394
|
+
}
|
|
395
|
+
if (startsWith(0, [0x47, 0x49, 0x46, 0x38])) {
|
|
396
|
+
return "image/gif";
|
|
397
|
+
}
|
|
398
|
+
if (startsWith(0, [0x52, 0x49, 0x46, 0x46]) && startsWith(8, [0x57, 0x45, 0x42, 0x50])) {
|
|
399
|
+
return "image/webp";
|
|
400
|
+
}
|
|
401
|
+
return undefined;
|
|
402
|
+
}
|
|
403
|
+
const SMALLER_IMAGE_RENDITIONS = ["thumb_720", "thumb_480", "thumb_360"];
|
|
404
|
+
/**
|
|
405
|
+
* Which bytes stand in for an image: Slack's 1024px rendition, else the
|
|
406
|
+
* original when the model reads its format, else the largest smaller
|
|
407
|
+
* rendition (Slack renders those as JPEG or PNG).
|
|
408
|
+
*/
|
|
409
|
+
function imageSource(info, originalReadable) {
|
|
410
|
+
const thumbnail = slackImageThumbnailUrl(info);
|
|
411
|
+
if (thumbnail !== undefined) {
|
|
412
|
+
return { url: thumbnail, rendition: true };
|
|
413
|
+
}
|
|
414
|
+
const original = nonEmptyString(info.url_private_download);
|
|
415
|
+
if (originalReadable && original !== undefined) {
|
|
416
|
+
return { url: original, rendition: false };
|
|
417
|
+
}
|
|
418
|
+
for (const key of SMALLER_IMAGE_RENDITIONS) {
|
|
419
|
+
const url = nonEmptyString(info[key]);
|
|
420
|
+
if (url !== undefined) {
|
|
421
|
+
return { url, rendition: true };
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return undefined;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Event and `conversations.replies` file objects can be stubs (only `id` and
|
|
428
|
+
* `file_access: "check_file_info"`, as in Slack Connect channels), so
|
|
429
|
+
* `files.info` fills in what classification and the annotation need.
|
|
430
|
+
*/
|
|
431
|
+
function hydrateSlackFile(file, info) {
|
|
432
|
+
return {
|
|
433
|
+
...file,
|
|
434
|
+
name: asString(info.name) ?? file.name,
|
|
435
|
+
title: asString(info.title) ?? file.title,
|
|
436
|
+
mimetype: nonEmptyString(info.mimetype) ?? file.mimetype,
|
|
437
|
+
filetype: nonEmptyString(info.filetype) ?? file.filetype,
|
|
438
|
+
mode: asString(info.mode) ?? file.mode,
|
|
439
|
+
size: asNumber(info.size) ?? file.size,
|
|
440
|
+
permalink: nonEmptyString(info.permalink) ?? file.permalink,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
const UNSUPPORTED_TYPE = "its file type is not supported";
|
|
444
|
+
const NO_DOWNLOAD_LINK = "Slack gave no download link for it";
|
|
445
|
+
async function loadSlackFile(file, ctx) {
|
|
446
|
+
const skipped = (target, reason) => ({
|
|
447
|
+
kind: "skipped",
|
|
448
|
+
file: target,
|
|
449
|
+
reason,
|
|
450
|
+
});
|
|
451
|
+
if (file.dataBase64 !== undefined && file.dataBase64.length > 0) {
|
|
405
452
|
const classification = classifySlackFile(file);
|
|
406
453
|
if (classification === undefined) {
|
|
407
|
-
return
|
|
454
|
+
return skipped(file, UNSUPPORTED_TYPE);
|
|
408
455
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (!skipsSizeGate && file.size !== undefined && file.size > maxFileBytes) {
|
|
412
|
-
options.log?.info("slack attachment skipped (size)", {
|
|
413
|
-
file_id: file.id,
|
|
414
|
-
size: file.size,
|
|
415
|
-
max: maxFileBytes,
|
|
416
|
-
});
|
|
417
|
-
return undefined;
|
|
456
|
+
if (file.size !== undefined && file.size > ctx.maxFileBytes) {
|
|
457
|
+
return skipped(file, overLimit(ctx.maxFileBytes));
|
|
418
458
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
classification,
|
|
423
|
-
bytes: new Uint8Array(Buffer.from(file.dataBase64, "base64")),
|
|
424
|
-
mimeType: classification.mimeType,
|
|
425
|
-
filename: attachmentFilename(file),
|
|
426
|
-
};
|
|
459
|
+
const data = new Uint8Array(Buffer.from(file.dataBase64, "base64"));
|
|
460
|
+
if (data.length > ctx.maxFileBytes) {
|
|
461
|
+
return skipped(file, overLimit(ctx.maxFileBytes));
|
|
427
462
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
fileId: file.id,
|
|
431
|
-
fallbackMimeType: classification.mimeType,
|
|
432
|
-
maxBytes: maxFileBytes,
|
|
433
|
-
downloadTimeoutMs,
|
|
434
|
-
preferImageThumbnail: classification.kind === "image",
|
|
435
|
-
});
|
|
436
|
-
if (downloaded === null) {
|
|
437
|
-
options.log?.info("slack attachment download failed", {
|
|
438
|
-
file_id: file.id,
|
|
439
|
-
kind: classification.kind,
|
|
440
|
-
});
|
|
441
|
-
return undefined;
|
|
463
|
+
if (classification.kind === "image" && !isSupportedImageFormat(classification.mimeType)) {
|
|
464
|
+
return skipped(file, `${classification.mimeType} is not an image format the model reads`);
|
|
442
465
|
}
|
|
443
466
|
return {
|
|
467
|
+
kind: "loaded",
|
|
444
468
|
file,
|
|
445
469
|
classification,
|
|
446
|
-
|
|
447
|
-
mimeType:
|
|
448
|
-
filename: downloaded.filename,
|
|
470
|
+
filename: attachmentFilename(file),
|
|
471
|
+
bytes: { data, mimeType: classification.mimeType },
|
|
449
472
|
};
|
|
450
|
-
}
|
|
473
|
+
}
|
|
474
|
+
// Transport callers cannot mint a Bearer for files.slack.com; they
|
|
475
|
+
// must pre-attach `dataBase64` on the file ref instead.
|
|
476
|
+
if (isSlackApiTransport(ctx.botToken)) {
|
|
477
|
+
return skipped(file, "this Slack connection cannot download files");
|
|
478
|
+
}
|
|
479
|
+
const info = await callSlackApiSoft({
|
|
480
|
+
botToken: ctx.botToken,
|
|
481
|
+
operation: "files.info",
|
|
482
|
+
body: { file: file.id },
|
|
483
|
+
});
|
|
484
|
+
const record = info.ok ? asRecord(info.file) : null;
|
|
485
|
+
if (record === null) {
|
|
486
|
+
const error = info.ok ? "no file returned" : info.error;
|
|
487
|
+
return skipped(file, `Slack would not share it with this app (files.info: ${error})`);
|
|
488
|
+
}
|
|
489
|
+
const hydrated = hydrateSlackFile(file, record);
|
|
490
|
+
const classification = classifySlackFile(hydrated);
|
|
491
|
+
if (classification === undefined) {
|
|
492
|
+
return skipped(hydrated, UNSUPPORTED_TYPE);
|
|
493
|
+
}
|
|
494
|
+
const filename = attachmentFilename(hydrated);
|
|
495
|
+
const tooBig = hydrated.size !== undefined && hydrated.size > ctx.maxFileBytes;
|
|
496
|
+
const download = (url) => downloadSlackUrl({
|
|
497
|
+
botToken: ctx.botToken,
|
|
498
|
+
url,
|
|
499
|
+
fallbackMimeType: classification.mimeType,
|
|
500
|
+
maxBytes: ctx.maxFileBytes,
|
|
501
|
+
downloadTimeoutMs: ctx.downloadTimeoutMs,
|
|
502
|
+
});
|
|
503
|
+
if (classification.kind === "image") {
|
|
504
|
+
const source = imageSource(record, isSupportedImageFormat(classification.mimeType));
|
|
505
|
+
if (source === undefined) {
|
|
506
|
+
return skipped(hydrated, "Slack has no copy of it in an image format the model reads");
|
|
507
|
+
}
|
|
508
|
+
// `size` is the original's, which says nothing about a rendition.
|
|
509
|
+
if (!source.rendition && tooBig) {
|
|
510
|
+
return skipped(hydrated, overLimit(ctx.maxFileBytes));
|
|
511
|
+
}
|
|
512
|
+
const result = await download(source.url);
|
|
513
|
+
if (!result.ok) {
|
|
514
|
+
return skipped(hydrated, result.reason);
|
|
515
|
+
}
|
|
516
|
+
if (!isSupportedImageFormat(result.mimeType)) {
|
|
517
|
+
return skipped(hydrated, `${result.mimeType} is not an image format the model reads`);
|
|
518
|
+
}
|
|
519
|
+
return { kind: "loaded", file: hydrated, classification, filename, bytes: result };
|
|
520
|
+
}
|
|
521
|
+
const fileUrl = nonEmptyString(record.url_private_download);
|
|
522
|
+
if (classification.kind === "document") {
|
|
523
|
+
if (fileUrl === undefined) {
|
|
524
|
+
return skipped(hydrated, NO_DOWNLOAD_LINK);
|
|
525
|
+
}
|
|
526
|
+
if (tooBig) {
|
|
527
|
+
return skipped(hydrated, overLimit(ctx.maxFileBytes));
|
|
528
|
+
}
|
|
529
|
+
const result = await download(fileUrl);
|
|
530
|
+
return result.ok
|
|
531
|
+
? { kind: "loaded", file: hydrated, classification, filename, bytes: result }
|
|
532
|
+
: skipped(hydrated, result.reason);
|
|
533
|
+
}
|
|
534
|
+
const posterUrl = nonEmptyString(record.thumb_video);
|
|
535
|
+
const [poster, video] = await Promise.all([
|
|
536
|
+
posterUrl === undefined ? undefined : download(posterUrl),
|
|
537
|
+
fileUrl === undefined
|
|
538
|
+
? { ok: false, reason: NO_DOWNLOAD_LINK }
|
|
539
|
+
: tooBig
|
|
540
|
+
? { ok: false, reason: overLimit(ctx.maxFileBytes) }
|
|
541
|
+
: download(fileUrl),
|
|
542
|
+
]);
|
|
543
|
+
const posterBytes = poster?.ok === true && isSupportedImageFormat(poster.mimeType) ? poster : undefined;
|
|
544
|
+
if (!video.ok && posterBytes === undefined) {
|
|
545
|
+
return skipped(hydrated, video.reason);
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
kind: "loaded",
|
|
549
|
+
file: hydrated,
|
|
550
|
+
classification,
|
|
551
|
+
filename,
|
|
552
|
+
bytes: video.ok ? video : undefined,
|
|
553
|
+
bytesSkipped: video.ok ? undefined : video.reason,
|
|
554
|
+
poster: posterBytes,
|
|
555
|
+
durationMs: asNumber(record.duration_ms),
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
function withPermalink(text, file) {
|
|
559
|
+
return file.permalink === undefined ? text : `${text}; ${file.permalink}`;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Download (or use pre-attached) Slack files and split them into vision
|
|
563
|
+
* images + workspace blobs for the turn. Every file the turn cannot attach
|
|
564
|
+
* still gets an annotation that says why, so the model never answers as if
|
|
565
|
+
* nothing was shared.
|
|
566
|
+
*/
|
|
567
|
+
export async function prepareSlackAttachments(options) {
|
|
568
|
+
const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
|
|
569
|
+
const maxFileBytes = options.maxFileBytes ?? DEFAULT_MAX_FILE_BYTES;
|
|
570
|
+
const maxTotalBytes = options.maxTotalBytes ?? DEFAULT_MAX_TOTAL_BYTES;
|
|
571
|
+
const downloadTimeoutMs = options.downloadTimeoutMs ?? DEFAULT_DOWNLOAD_TIMEOUT_MS;
|
|
572
|
+
const messageFileIds = new Set(options.files.map((file) => file.id));
|
|
573
|
+
const threadFiles = (options.threadFiles ?? []).filter((file) => !messageFileIds.has(file.id));
|
|
574
|
+
const threadFileIds = new Set(threadFiles.map((file) => file.id));
|
|
575
|
+
const allFiles = [...options.files, ...threadFiles];
|
|
576
|
+
const loaded = await Promise.all(allFiles
|
|
577
|
+
.slice(0, maxFiles)
|
|
578
|
+
.map((file) => loadSlackFile(file, { botToken: options.botToken, maxFileBytes, downloadTimeoutMs })));
|
|
451
579
|
const images = [];
|
|
452
580
|
const workspaceFiles = {};
|
|
453
581
|
const annotations = [];
|
|
@@ -455,66 +583,100 @@ export async function prepareSlackAttachments(options) {
|
|
|
455
583
|
let imageIndex = 0;
|
|
456
584
|
let documentIndex = 0;
|
|
457
585
|
let videoIndex = 0;
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
const { file, classification, bytes, mimeType, filename } = item;
|
|
463
|
-
if (bytes.length === 0) {
|
|
464
|
-
options.log?.info("slack attachment download failed", {
|
|
465
|
-
file_id: file.id,
|
|
466
|
-
kind: classification.kind,
|
|
467
|
-
});
|
|
468
|
-
continue;
|
|
586
|
+
const overBudget = `it would take this message past ${formatMegabytes(maxTotalBytes)} of attachments`;
|
|
587
|
+
const fitsBudget = (bytes) => {
|
|
588
|
+
if (totalBytes + bytes.data.length > maxTotalBytes) {
|
|
589
|
+
return false;
|
|
469
590
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
591
|
+
totalBytes += bytes.data.length;
|
|
592
|
+
return true;
|
|
593
|
+
};
|
|
594
|
+
const skip = (file, reason) => {
|
|
595
|
+
options.log?.info("slack attachment skipped", { file_id: file.id, reason });
|
|
596
|
+
const source = threadFileIds.has(file.id) ? " from the thread" : "";
|
|
597
|
+
const type = file.mimetype === undefined || file.mimetype === "" ? "" : ` (${file.mimetype})`;
|
|
598
|
+
annotations.push(`${withPermalink(`[Not attached: ${attachmentFilename(file)}${type}${source}: ${reason}`, file)}]`);
|
|
599
|
+
};
|
|
600
|
+
for (const item of loaded) {
|
|
601
|
+
if (item.kind === "skipped") {
|
|
602
|
+
skip(item.file, item.reason);
|
|
475
603
|
continue;
|
|
476
604
|
}
|
|
477
|
-
|
|
478
|
-
const relativePath = attachmentWorkspacePath(file, filename);
|
|
605
|
+
const { file, classification, filename, poster, durationMs } = item;
|
|
479
606
|
const source = threadFileIds.has(file.id) ? " from the thread" : "";
|
|
607
|
+
const relativePath = attachmentWorkspacePath(file, filename);
|
|
480
608
|
if (classification.kind === "image") {
|
|
481
|
-
if (!
|
|
609
|
+
if (item.bytes === undefined || !fitsBudget(item.bytes)) {
|
|
610
|
+
skip(file, overBudget);
|
|
482
611
|
continue;
|
|
483
612
|
}
|
|
484
613
|
imageIndex++;
|
|
614
|
+
const base64 = Buffer.from(item.bytes.data).toString("base64");
|
|
485
615
|
const imagePath = `${relativePath}.base64`;
|
|
486
|
-
workspaceFiles[imagePath] =
|
|
487
|
-
images.push({
|
|
488
|
-
|
|
489
|
-
mimeType,
|
|
490
|
-
});
|
|
491
|
-
annotations.push(`[Image ${imageIndex}: ${filename} (${mimeType})${source} → ${imagePath}]`);
|
|
616
|
+
workspaceFiles[imagePath] = base64;
|
|
617
|
+
images.push({ data: base64, mimeType: item.bytes.mimeType });
|
|
618
|
+
annotations.push(`[Image ${imageIndex}: ${filename} (${item.bytes.mimeType})${source} → ${imagePath}]`);
|
|
492
619
|
continue;
|
|
493
620
|
}
|
|
494
|
-
|
|
495
|
-
|
|
621
|
+
if (classification.kind === "document") {
|
|
622
|
+
if (item.bytes === undefined || !fitsBudget(item.bytes)) {
|
|
623
|
+
skip(file, overBudget);
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
const { data, mimeType } = item.bytes;
|
|
627
|
+
workspaceFiles[relativePath] = isTextLikeBytes({
|
|
496
628
|
mimeType,
|
|
497
629
|
isTextLike: classification.isTextLike,
|
|
498
|
-
bytes,
|
|
499
|
-
})
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
else {
|
|
504
|
-
workspaceFiles[relativePath] = {
|
|
505
|
-
encoding: "base64",
|
|
506
|
-
data: Buffer.from(bytes).toString("base64"),
|
|
507
|
-
mimeType,
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
if (classification.kind === "document") {
|
|
630
|
+
bytes: data,
|
|
631
|
+
})
|
|
632
|
+
? Buffer.from(data).toString("utf8")
|
|
633
|
+
: { encoding: "base64", data: Buffer.from(data).toString("base64"), mimeType };
|
|
511
634
|
documentIndex++;
|
|
512
635
|
annotations.push(`[Document ${documentIndex}: ${filename}${source} → ${relativePath}]`);
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
const posterIndex = poster !== undefined && fitsBudget(poster) ? ++imageIndex : undefined;
|
|
639
|
+
if (posterIndex !== undefined && poster !== undefined) {
|
|
640
|
+
images.push({ data: Buffer.from(poster.data).toString("base64"), mimeType: poster.mimeType });
|
|
641
|
+
}
|
|
642
|
+
let saved;
|
|
643
|
+
let notSaved = item.bytesSkipped;
|
|
644
|
+
if (item.bytes !== undefined) {
|
|
645
|
+
if (fitsBudget(item.bytes)) {
|
|
646
|
+
workspaceFiles[relativePath] = {
|
|
647
|
+
encoding: "base64",
|
|
648
|
+
data: Buffer.from(item.bytes.data).toString("base64"),
|
|
649
|
+
mimeType: item.bytes.mimeType,
|
|
650
|
+
};
|
|
651
|
+
saved = relativePath;
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
notSaved = overBudget;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (saved === undefined && posterIndex === undefined) {
|
|
658
|
+
skip(file, notSaved ?? overBudget);
|
|
659
|
+
continue;
|
|
513
660
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
661
|
+
videoIndex++;
|
|
662
|
+
const details = [classification.mimeType];
|
|
663
|
+
if (durationMs !== undefined) {
|
|
664
|
+
details.push(formatDuration(durationMs));
|
|
517
665
|
}
|
|
666
|
+
const parts = [
|
|
667
|
+
`[Video ${videoIndex}: ${filename} (${details.join(", ")})${source}${saved === undefined ? "" : ` → ${saved}`}`,
|
|
668
|
+
];
|
|
669
|
+
if (posterIndex !== undefined) {
|
|
670
|
+
parts.push(`its poster frame is attached as Image ${posterIndex}`);
|
|
671
|
+
}
|
|
672
|
+
if (saved === undefined && notSaved !== undefined) {
|
|
673
|
+
parts.push(`the video itself is not attached: ${notSaved}`);
|
|
674
|
+
}
|
|
675
|
+
annotations.push(`${withPermalink(parts.join("; "), file)}]`);
|
|
676
|
+
}
|
|
677
|
+
const leftOver = allFiles.length - Math.min(allFiles.length, maxFiles);
|
|
678
|
+
if (leftOver > 0) {
|
|
679
|
+
annotations.push(`[Not attached: ${leftOver} more file${leftOver === 1 ? "" : "s"}: over the ${maxFiles}-file limit]`);
|
|
518
680
|
}
|
|
519
681
|
return { images, workspaceFiles, annotations };
|
|
520
682
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The private Connect card's Connected and Cancel clicks. Each starts the
|
|
3
|
+
* clicker's next turn in the card's thread.
|
|
4
|
+
*/
|
|
5
|
+
import type { ApprovalDecision } from "../../types.js";
|
|
6
|
+
export declare const SLACK_CONNECT_DONE_ACTION_ID = "agent_serve_connect_done";
|
|
7
|
+
export declare const SLACK_CONNECT_CANCEL_ACTION_ID = "agent_serve_connect_cancel";
|
|
8
|
+
/** An ephemeral card's click may not carry its thread, so the button value does. */
|
|
9
|
+
export interface SlackConnectActionValue {
|
|
10
|
+
threadTs: string;
|
|
11
|
+
connection: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function parseConnectAction(actionId: string, raw: string): (SlackConnectActionValue & {
|
|
14
|
+
decision: ApprovalDecision;
|
|
15
|
+
}) | null;
|
|
16
|
+
//# sourceMappingURL=connect-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-card.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/connect-card.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AACvE,eAAO,MAAM,8BAA8B,+BAA+B,CAAC;AAE3E,oFAAoF;AACpF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,CAAC,uBAAuB,GAAG;IAAE,QAAQ,EAAE,gBAAgB,CAAA;CAAE,CAAC,GAAG,IAAI,CAyBnE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The private Connect card's Connected and Cancel clicks. Each starts the
|
|
3
|
+
* clicker's next turn in the card's thread.
|
|
4
|
+
*/
|
|
5
|
+
import { isRecord } from "../../internal/is-record.js";
|
|
6
|
+
export const SLACK_CONNECT_DONE_ACTION_ID = "agent_serve_connect_done";
|
|
7
|
+
export const SLACK_CONNECT_CANCEL_ACTION_ID = "agent_serve_connect_cancel";
|
|
8
|
+
export function parseConnectAction(actionId, raw) {
|
|
9
|
+
const decision = actionId === SLACK_CONNECT_DONE_ACTION_ID
|
|
10
|
+
? "approve"
|
|
11
|
+
: actionId === SLACK_CONNECT_CANCEL_ACTION_ID
|
|
12
|
+
? "deny"
|
|
13
|
+
: null;
|
|
14
|
+
if (decision === null) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const value = JSON.parse(raw);
|
|
19
|
+
if (!isRecord(value) ||
|
|
20
|
+
typeof value.threadTs !== "string" ||
|
|
21
|
+
typeof value.connection !== "string" ||
|
|
22
|
+
value.threadTs === "" ||
|
|
23
|
+
value.connection === "") {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return { threadTs: value.threadTs, connection: value.connection, decision };
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -5,9 +5,17 @@
|
|
|
5
5
|
* `envPrefix: "MY_AGENT"` so the pack reads `MY_AGENT_SLACK_BOT_TOKEN` /
|
|
6
6
|
* `MY_AGENT_SLACK_APP_TOKEN` instead of the shared globals.
|
|
7
7
|
*/
|
|
8
|
+
import { envPrefixFromName } from "../../internal/env-prefix.js";
|
|
8
9
|
import type { SlackCredentials } from "./types.js";
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
export { envPrefixFromName };
|
|
11
|
+
/** Prefix plus Slack env names from {@link storedEnvPrefix}. */
|
|
12
|
+
export declare function slackCredentialEnv(prefix?: string): {
|
|
13
|
+
envPrefix: string;
|
|
14
|
+
keys: {
|
|
15
|
+
bot: string;
|
|
16
|
+
app: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
11
19
|
/** Env var names for a Slack token pair. */
|
|
12
20
|
export declare function slackEnvKeys(prefix?: string): {
|
|
13
21
|
bot: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAElE,
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAW,iBAAiB,EAAmB,MAAM,8BAA8B,CAAC;AAC3F,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAO7B,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC,CASA;AAED,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAEA;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAMpE;AAeD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,gBAAgB,GAAG,SAAS,GACxC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAK7B;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,gBAAgB,GAAG,SAAS,GACxC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAK7B"}
|