@cursor/july 0.1.30 → 0.1.31
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 +1 -1
- package/README.md +10 -5
- package/dist/bin/agent-serve.js +4 -4
- package/dist/channels/github/index.d.ts +1 -1
- package/dist/channels/github/index.js +1 -1
- package/dist/channels/slack/bot-mentions.d.ts +1 -1
- package/dist/channels/slack/bot-mentions.d.ts.map +1 -1
- package/dist/channels/slack/bot-mentions.js +1 -1
- package/dist/channels/slack/eval-directive.js +1 -1
- package/dist/channels/slack/external-policy.d.ts +1 -1
- package/dist/channels/slack/external-policy.js +1 -1
- package/dist/channels/slack/log.d.ts +1 -1
- package/dist/channels/slack/log.js +1 -1
- package/dist/channels/slack/setup.js +1 -1
- package/dist/channels/slack/socket-mode.js +1 -1
- package/dist/docs/404.html +3 -3
- package/dist/docs/ab.html +11 -11
- package/dist/docs/assets/{ab.md.BMCZ6Hd7.js → ab.md.DAQoJ-up.js} +6 -6
- package/dist/docs/assets/{ab.md.BMCZ6Hd7.lean.js → ab.md.DAQoJ-up.lean.js} +1 -1
- package/dist/docs/assets/{app.Cm4lsMc4.js → app.DigB_9cQ.js} +1 -1
- package/dist/docs/assets/building-with-agents.md.CnHqvYDd.js +13 -0
- package/dist/docs/assets/{building-with-agents.md.CJCtZCyi.lean.js → building-with-agents.md.CnHqvYDd.lean.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.CnFFl07y.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.CYUFXspH.js → VPLocalSearchBox.BCMX25Bv.js} +1 -1
- package/dist/docs/assets/chunks/{theme.CTjkX9vc.js → theme.BDDWeELx.js} +2 -2
- package/dist/docs/assets/concepts.md.DFaQEFkA.js +4 -0
- package/dist/docs/assets/concepts.md.DFaQEFkA.lean.js +1 -0
- package/dist/docs/assets/deployment.md.9MYBuKM1.js +55 -0
- package/dist/docs/assets/deployment.md.9MYBuKM1.lean.js +1 -0
- package/dist/docs/assets/{evals.md.DYOjkRCX.js → evals.md.BIUoVZ6X.js} +13 -13
- package/dist/docs/assets/evals.md.BIUoVZ6X.lean.js +1 -0
- package/dist/docs/assets/{example-agents_approval-buddy.md.DFGBYLcc.js → example-agents_approval-buddy.md.BhEfleVx.js} +4 -4
- package/dist/docs/assets/{example-agents_approval-buddy.md.DFGBYLcc.lean.js → example-agents_approval-buddy.md.BhEfleVx.lean.js} +1 -1
- package/dist/docs/assets/example-agents_benny.md.2Et1qa8f.js +7 -0
- package/dist/docs/assets/{example-agents_bugbot.md.DelIdhxB.js → example-agents_bugbot.md.ByUexi5i.js} +5 -5
- package/dist/docs/assets/{example-agents_codebase-wiki.md.DC6sgwn0.js → example-agents_codebase-wiki.md.B4y-7ZVW.js} +6 -6
- package/dist/docs/assets/{example-agents_codebase-wiki.md.DC6sgwn0.lean.js → example-agents_codebase-wiki.md.B4y-7ZVW.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_codeowners-review.md.Ku_tG2RY.js → example-agents_codeowners-review.md.D6ay4nvf.js} +6 -6
- package/dist/docs/assets/{example-agents_codeowners-review.md.Ku_tG2RY.lean.js → example-agents_codeowners-review.md.D6ay4nvf.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_concierge.md.4rQTSMXt.js → example-agents_concierge.md.lL8rhYlj.js} +7 -7
- package/dist/docs/assets/{example-agents_fsd.md.CzgUrDfi.js → example-agents_fsd.md.DfNKQTHz.js} +5 -5
- package/dist/docs/assets/example-agents_index.md.DgGBwckv.js +2 -0
- package/dist/docs/assets/example-agents_index.md.DgGBwckv.lean.js +1 -0
- package/dist/docs/assets/{example-agents_knowledge-base.md.BPJiVueF.js → example-agents_knowledge-base.md.CzyZ2DCr.js} +5 -5
- package/dist/docs/assets/{example-agents_knowledge-base.md.BPJiVueF.lean.js → example-agents_knowledge-base.md.CzyZ2DCr.lean.js} +1 -1
- package/dist/docs/assets/example-agents_oncall.md.wFFXXEyW.js +10 -0
- package/dist/docs/assets/{example-agents_security-reviewer.md.Dhj_m7_B.js → example-agents_security-reviewer.md.Dkf1gyo6.js} +8 -8
- package/dist/docs/assets/example-agents_slack-agent.md.DvgvT4nn.js +5 -0
- package/dist/docs/assets/example-agents_weather-agent.md.Dmrcphhl.js +24 -0
- package/dist/docs/assets/example-agents_weather-agent.md.Dmrcphhl.lean.js +1 -0
- package/dist/docs/assets/{guides_agent-to-agent.md.Bpzgq2Pq.js → guides_agent-to-agent.md.Bmbxy-FA.js} +4 -4
- package/dist/docs/assets/guides_cloud-runtime.md.BZ2GA7Es.js +9 -0
- package/dist/docs/assets/{guides_github.md.DOOCpqsW.js → guides_github.md.R2QlpR75.js} +5 -5
- package/dist/docs/assets/{guides_human-in-the-loop.md.DlUqsp1S.js → guides_human-in-the-loop.md.BWvT7UqY.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.Dd8EgSem.js → guides_mcp-oauth.md.C7G7IykG.js} +5 -5
- package/dist/docs/assets/guides_mcp-oauth.md.C7G7IykG.lean.js +1 -0
- package/dist/docs/assets/guides_slack.md.zriQpU_9.js +47 -0
- package/dist/docs/assets/guides_slack.md.zriQpU_9.lean.js +1 -0
- package/dist/docs/assets/{guides_webhooks.md.wSOYas3X.js → guides_webhooks.md.DiAwSR42.js} +1 -1
- package/dist/docs/assets/{hillclimbing.md.DHNast08.js → hillclimbing.md.D9Y1_bYh.js} +1 -1
- package/dist/docs/assets/index.md.CZqbBJPB.js +20 -0
- package/dist/docs/assets/index.md.CZqbBJPB.lean.js +1 -0
- package/dist/docs/assets/{quickstart.md.BU6Iwi_9.js → quickstart.md.TnEXYgYW.js} +12 -12
- package/dist/docs/assets/{reference_agent-config.md.DrW2JUM8.js → reference_agent-config.md.kuN6-OxK.js} +1 -1
- package/dist/docs/assets/reference_cli.md.sD-IUWjg.js +73 -0
- package/dist/docs/assets/{reference_cli.md.ccoKOoXt.lean.js → reference_cli.md.sD-IUWjg.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.B9Q3TOve.js → reference_connections.md.DGqAsFXb.js} +3 -3
- package/dist/docs/assets/reference_http-api.md.CfVM_ICa.js +11 -0
- package/dist/docs/assets/{reference_project-layout.md.Bd_CKtNS.js → reference_project-layout.md.D8E6ZmHJ.js} +4 -4
- package/dist/docs/assets/{reference_project-layout.md.Bd_CKtNS.lean.js → reference_project-layout.md.D8E6ZmHJ.lean.js} +1 -1
- package/dist/docs/assets/{reference_schedules.md.w_F2mXB6.js → reference_schedules.md.gmfYzf_I.js} +1 -1
- package/dist/docs/assets/{reference_sessions.md.DLd6mvbv.js → reference_sessions.md.C_ouF_uf.js} +3 -3
- package/dist/docs/assets/{reference_tools.md.BRSDnTbN.js → reference_tools.md.BswAQM41.js} +3 -3
- package/dist/docs/assets/{scaffolding-agents.md.C3pTrmoE.js → scaffolding-agents.md.Bsr9Pwzu.js} +1 -1
- package/dist/docs/assets/{scaffolding-agents.md.C3pTrmoE.lean.js → scaffolding-agents.md.Bsr9Pwzu.lean.js} +1 -1
- package/dist/docs/assets/{storage.md.DRTdnFvd.js → storage.md.xZoiGM58.js} +3 -3
- package/dist/docs/assets/storage.md.xZoiGM58.lean.js +1 -0
- package/dist/docs/assets/troubleshooting.md.B5RVX_tL.js +1 -0
- package/dist/docs/assets/{troubleshooting.md.CmQkmnzC.lean.js → troubleshooting.md.B5RVX_tL.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +12 -12
- package/dist/docs/concepts.html +6 -6
- package/dist/docs/deployment.html +32 -32
- package/dist/docs/evals.html +19 -19
- package/dist/docs/example-agents/approval-buddy.html +9 -9
- package/dist/docs/example-agents/benny.html +11 -11
- package/dist/docs/example-agents/bugbot.html +10 -10
- package/dist/docs/example-agents/codebase-wiki.html +11 -11
- package/dist/docs/example-agents/codeowners-review.html +11 -11
- package/dist/docs/example-agents/concierge.html +12 -12
- package/dist/docs/example-agents/fsd.html +10 -10
- package/dist/docs/example-agents/index.html +7 -7
- package/dist/docs/example-agents/knowledge-base.html +10 -10
- package/dist/docs/example-agents/oncall.html +10 -10
- package/dist/docs/example-agents/security-reviewer.html +13 -13
- package/dist/docs/example-agents/slack-agent.html +10 -10
- package/dist/docs/example-agents/weather-agent.html +16 -16
- package/dist/docs/guides/agent-to-agent.html +9 -9
- package/dist/docs/guides/cloud-runtime.html +7 -7
- package/dist/docs/guides/github.html +10 -10
- package/dist/docs/guides/human-in-the-loop.html +7 -7
- package/dist/docs/guides/mcp-oauth.html +11 -11
- package/dist/docs/guides/slack.html +22 -17
- package/dist/docs/guides/webhooks.html +7 -7
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +7 -7
- package/dist/docs/index.html +9 -9
- package/dist/docs/quickstart.html +17 -17
- package/dist/docs/reference/agent-config.html +7 -7
- package/dist/docs/reference/channels.html +5 -5
- package/dist/docs/reference/cli.html +56 -48
- package/dist/docs/reference/connections.html +9 -9
- package/dist/docs/reference/hooks.html +5 -5
- package/dist/docs/reference/http-api.html +7 -7
- package/dist/docs/reference/instructions.html +5 -5
- package/dist/docs/reference/playground.html +5 -5
- package/dist/docs/reference/project-layout.html +9 -9
- package/dist/docs/reference/prompt.html +5 -5
- package/dist/docs/reference/schedules.html +7 -7
- package/dist/docs/reference/sessions.html +8 -8
- package/dist/docs/reference/skills.html +5 -5
- package/dist/docs/reference/subagents.html +5 -5
- package/dist/docs/reference/tools.html +9 -9
- package/dist/docs/scaffolding-agents.html +6 -6
- package/dist/docs/storage.html +9 -9
- package/dist/docs/troubleshooting.html +6 -6
- package/dist/evals/reporters.d.ts +1 -1
- package/dist/evals/reporters.js +1 -1
- package/dist/evals.d.ts +2 -2
- package/dist/files-backends/agent-store-presigned-url.d.ts +100 -0
- package/dist/files-backends/agent-store-presigned-url.d.ts.map +1 -0
- package/dist/files-backends/agent-store-presigned-url.js +347 -0
- package/dist/files-backends/cursor-hosted.d.ts +87 -0
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -0
- package/dist/files-backends/cursor-hosted.js +540 -0
- package/dist/files-backends/local-fs.d.ts +33 -0
- package/dist/files-backends/local-fs.d.ts.map +1 -0
- package/dist/files-backends/local-fs.js +199 -0
- package/dist/files.d.ts +139 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +89 -0
- package/dist/internal/ab-collector.js +2 -2
- package/dist/internal/ab-fold.js +1 -1
- package/dist/internal/cli-ax.d.ts +2 -2
- package/dist/internal/cli-ax.js +2 -2
- package/dist/internal/cli-deploy.d.ts +1 -1
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +7 -2
- package/dist/internal/cli-docs.d.ts +1 -1
- package/dist/internal/cli-docs.js +1 -1
- package/dist/internal/cli-github.js +13 -13
- package/dist/internal/cli-mcp-oauth.d.ts +1 -1
- package/dist/internal/cli-mcp-oauth.js +2 -2
- package/dist/internal/cli-mcp.d.ts +3 -3
- package/dist/internal/cli-mcp.js +4 -4
- package/dist/internal/cli-skills.js +1 -1
- package/dist/internal/cloud-turn-cost.d.ts +9 -1
- package/dist/internal/cloud-turn-cost.d.ts.map +1 -1
- package/dist/internal/cloud-turn-cost.js +14 -4
- package/dist/internal/cursor/account-mcp.js +5 -5
- package/dist/internal/cursor/backend-client.js +1 -1
- package/dist/internal/cursor/github-credentials.js +3 -3
- package/dist/internal/cursor-account-mcp-auth.d.ts +1 -1
- package/dist/internal/cursor-account-mcp-auth.js +1 -1
- package/dist/internal/cursor-event-relay.js +1 -1
- package/dist/internal/cursor-relay-core.d.ts +1 -1
- package/dist/internal/cursor-relay-core.d.ts.map +1 -1
- package/dist/internal/cursor-slack-relay.js +1 -1
- package/dist/internal/deploy-client.d.ts +6 -1
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +3 -2
- package/dist/internal/deploy-source.d.ts +2 -2
- package/dist/internal/deploy-source.js +2 -2
- package/dist/internal/discovery.js +2 -2
- package/dist/internal/distribution.d.ts +5 -5
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +6 -6
- package/dist/internal/docs-site.js +5 -5
- package/dist/internal/eval-run-store.js +8 -8
- package/dist/internal/evals-client.d.ts +1 -1
- package/dist/internal/evals-client.js +1 -1
- package/dist/internal/github-fanout.js +2 -2
- package/dist/internal/host-files.d.ts +29 -0
- package/dist/internal/host-files.d.ts.map +1 -0
- package/dist/internal/host-files.js +283 -0
- package/dist/internal/host-platforms.js +5 -5
- package/dist/internal/hosting.d.ts +1 -1
- package/dist/internal/hosting.js +1 -1
- package/dist/internal/http-channel.d.ts.map +1 -1
- package/dist/internal/http-channel.js +26 -0
- package/dist/internal/install-cursor-skills.d.ts +1 -1
- package/dist/internal/install-cursor-skills.d.ts.map +1 -1
- package/dist/internal/install-cursor-skills.js +33 -4
- package/dist/internal/local-control-plane.js +2 -2
- package/dist/internal/logs-client.d.ts +2 -2
- package/dist/internal/logs-client.js +2 -2
- package/dist/internal/mcp-endpoint.js +1 -1
- package/dist/internal/mcp-oauth.js +2 -2
- package/dist/internal/platform-schedule-sync.js +2 -2
- package/dist/internal/playground/toolchain.js +6 -6
- package/dist/internal/reminder-runner.js +13 -13
- package/dist/internal/resolved-connections.js +6 -6
- package/dist/internal/schedule-runner.js +1 -1
- package/dist/internal/sdk-runner.js +5 -5
- package/dist/internal/server.js +16 -16
- package/dist/internal/session-cost.d.ts +3 -2
- package/dist/internal/session-cost.d.ts.map +1 -1
- package/dist/internal/session-cost.js +7 -6
- package/dist/internal/session-engine.d.ts +31 -1
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +119 -31
- package/dist/internal/slack-provision-client.js +1 -1
- package/dist/internal/storage-coordinator.js +7 -7
- package/dist/internal/trajectory.js +2 -2
- package/dist/internal/turn-cost.d.ts +27 -0
- package/dist/internal/turn-cost.d.ts.map +1 -0
- package/dist/internal/turn-cost.js +83 -0
- package/dist/internal/update-check.d.ts +3 -3
- package/dist/internal/update-check.d.ts.map +1 -1
- package/dist/internal/update-check.js +5 -5
- package/dist/memory.d.ts +1 -1
- package/dist/memory.js +1 -1
- package/dist/playground/assets/index-50PKeJlG.css +1 -0
- package/dist/playground/assets/index-C0f2Wl1q.js +85 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +1 -1
- package/dist/types.d.ts +120 -16
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +23 -23
- package/docs/ab.md +12 -12
- package/docs/building-with-agents.md +9 -9
- package/docs/concepts.md +11 -11
- package/docs/deployment.md +55 -43
- package/docs/evals.md +20 -20
- package/docs/example-agents/approval-buddy.md +9 -9
- package/docs/example-agents/benny.md +13 -13
- package/docs/example-agents/bugbot.md +6 -6
- package/docs/example-agents/codebase-wiki.md +8 -8
- package/docs/example-agents/codeowners-review.md +8 -8
- package/docs/example-agents/concierge.md +10 -10
- package/docs/example-agents/fsd.md +7 -7
- package/docs/example-agents/index.md +8 -8
- package/docs/example-agents/knowledge-base.md +9 -9
- package/docs/example-agents/oncall.md +7 -7
- package/docs/example-agents/security-reviewer.md +12 -12
- package/docs/example-agents/slack-agent.md +10 -10
- package/docs/example-agents/weather-agent.md +30 -26
- package/docs/guides/agent-to-agent.md +4 -4
- package/docs/guides/cloud-runtime.md +3 -3
- package/docs/guides/github.md +6 -6
- package/docs/guides/human-in-the-loop.md +1 -1
- package/docs/guides/mcp-oauth.md +9 -9
- package/docs/guides/slack.md +94 -21
- package/docs/guides/webhooks.md +1 -1
- package/docs/hillclimbing.md +3 -3
- package/docs/quickstart.md +18 -18
- package/docs/reference/agent-config.md +1 -1
- package/docs/reference/cli.md +110 -79
- package/docs/reference/connections.md +3 -3
- package/docs/reference/http-api.md +2 -2
- package/docs/reference/project-layout.md +7 -7
- package/docs/reference/schedules.md +1 -1
- package/docs/reference/sessions.md +7 -7
- package/docs/reference/tools.md +3 -3
- package/docs/scaffolding-agents.md +2 -2
- package/docs/storage.md +5 -5
- package/docs/troubleshooting.md +11 -10
- package/package.json +3 -1
- package/skills/ab/SKILL.md +5 -5
- package/skills/create-agent/SKILL.md +17 -17
- package/skills/debug/SKILL.md +10 -10
- package/skills/evals/SKILL.md +13 -13
- package/skills/framework-map/SKILL.md +3 -3
- package/skills/github/SKILL.md +11 -11
- package/skills/hillclimb/SKILL.md +9 -9
- package/skills/mcp-auth/SKILL.md +11 -11
- package/skills/setup-slack/SKILL.md +28 -28
- package/src/bin/agent-serve.ts +4 -4
- package/src/channels/github/index.ts +1 -1
- package/src/channels/slack/bot-mentions.ts +1 -1
- package/src/channels/slack/eval-directive.ts +1 -1
- package/src/channels/slack/external-policy.ts +1 -1
- package/src/channels/slack/log.ts +1 -1
- package/src/channels/slack/setup.ts +1 -1
- package/src/channels/slack/socket-mode.ts +1 -1
- package/src/evals/reporters.ts +1 -1
- package/src/evals.ts +2 -2
- package/src/files-backends/agent-store-presigned-url.ts +402 -0
- package/src/files-backends/cursor-hosted.ts +698 -0
- package/src/files-backends/local-fs.ts +178 -0
- package/src/files.ts +195 -0
- package/src/internal/ab-collector.ts +2 -2
- package/src/internal/ab-fold.ts +1 -1
- package/src/internal/cli-ax.ts +2 -2
- package/src/internal/cli-deploy.ts +7 -2
- package/src/internal/cli-docs.ts +1 -1
- package/src/internal/cli-github.ts +13 -13
- package/src/internal/cli-mcp-oauth.ts +2 -2
- package/src/internal/cli-mcp.ts +4 -4
- package/src/internal/cli-skills.ts +1 -1
- package/src/internal/cloud-turn-cost.ts +20 -4
- package/src/internal/cursor/account-mcp.ts +5 -5
- package/src/internal/cursor/backend-client.ts +1 -1
- package/src/internal/cursor/github-credentials.ts +3 -3
- package/src/internal/cursor-account-mcp-auth.ts +1 -1
- package/src/internal/cursor-event-relay.ts +1 -1
- package/src/internal/cursor-relay-core.ts +1 -1
- package/src/internal/cursor-slack-relay.ts +1 -1
- package/src/internal/deploy-client.ts +8 -2
- package/src/internal/deploy-source.ts +2 -2
- package/src/internal/discovery.ts +2 -2
- package/src/internal/distribution.ts +6 -6
- package/src/internal/docs-site.ts +5 -5
- package/src/internal/eval-run-store.ts +8 -8
- package/src/internal/evals-client.ts +1 -1
- package/src/internal/github-fanout.ts +2 -2
- package/src/internal/host-files.ts +372 -0
- package/src/internal/host-platforms.ts +5 -5
- package/src/internal/hosting.ts +1 -1
- package/src/internal/http-channel.ts +30 -0
- package/src/internal/install-cursor-skills.ts +31 -3
- package/src/internal/local-control-plane.ts +2 -2
- package/src/internal/logs-client.ts +2 -2
- package/src/internal/mcp-endpoint.ts +1 -1
- package/src/internal/mcp-oauth.ts +2 -2
- package/src/internal/platform-schedule-sync.ts +2 -2
- package/src/internal/playground/toolchain.ts +6 -6
- package/src/internal/reminder-runner.ts +13 -13
- package/src/internal/resolved-connections.ts +6 -6
- package/src/internal/schedule-runner.ts +1 -1
- package/src/internal/sdk-runner.ts +5 -5
- package/src/internal/server.ts +16 -16
- package/src/internal/session-cost.ts +7 -6
- package/src/internal/session-engine.ts +141 -28
- package/src/internal/slack-provision-client.ts +1 -1
- package/src/internal/storage-coordinator.ts +7 -7
- package/src/internal/trajectory.ts +2 -2
- package/src/internal/turn-cost.ts +110 -0
- package/src/internal/update-check.ts +6 -6
- package/src/memory.ts +1 -1
- package/src/storage.ts +1 -1
- package/src/types.ts +148 -16
- package/dist/docs/assets/building-with-agents.md.CJCtZCyi.js +0 -13
- package/dist/docs/assets/chunks/@localSearchIndexroot.CbQshWFK.js +0 -1
- package/dist/docs/assets/concepts.md.Cfb9b-k1.js +0 -4
- package/dist/docs/assets/concepts.md.Cfb9b-k1.lean.js +0 -1
- package/dist/docs/assets/deployment.md.TecHo0_2.js +0 -55
- package/dist/docs/assets/deployment.md.TecHo0_2.lean.js +0 -1
- package/dist/docs/assets/evals.md.DYOjkRCX.lean.js +0 -1
- package/dist/docs/assets/example-agents_benny.md.B0gjhI-p.js +0 -7
- package/dist/docs/assets/example-agents_index.md.D2PEVSXl.js +0 -2
- package/dist/docs/assets/example-agents_index.md.D2PEVSXl.lean.js +0 -1
- package/dist/docs/assets/example-agents_oncall.md.BG_sUMly.js +0 -10
- package/dist/docs/assets/example-agents_slack-agent.md.buLbgvBf.js +0 -5
- package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.js +0 -24
- package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.lean.js +0 -1
- package/dist/docs/assets/guides_cloud-runtime.md.gVzabdQL.js +0 -9
- package/dist/docs/assets/guides_mcp-oauth.md.Dd8EgSem.lean.js +0 -1
- package/dist/docs/assets/guides_slack.md.CjmJSvZS.js +0 -42
- package/dist/docs/assets/guides_slack.md.CjmJSvZS.lean.js +0 -1
- package/dist/docs/assets/index.md.CH_s5uZe.js +0 -20
- package/dist/docs/assets/index.md.CH_s5uZe.lean.js +0 -1
- package/dist/docs/assets/reference_cli.md.ccoKOoXt.js +0 -65
- package/dist/docs/assets/reference_http-api.md.BncLd3PZ.js +0 -11
- package/dist/docs/assets/storage.md.DRTdnFvd.lean.js +0 -1
- package/dist/docs/assets/troubleshooting.md.CmQkmnzC.js +0 -1
- package/dist/internal/model-pricing.d.ts +0 -49
- package/dist/internal/model-pricing.d.ts.map +0 -1
- package/dist/internal/model-pricing.js +0 -377
- package/dist/playground/assets/index-CquRB-l0.js +0 -85
- package/dist/playground/assets/index-Dj0bWpkn.css +0 -1
- package/src/internal/model-pricing.ts +0 -426
- /package/dist/docs/assets/{example-agents_benny.md.B0gjhI-p.lean.js → example-agents_benny.md.2Et1qa8f.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_bugbot.md.DelIdhxB.lean.js → example-agents_bugbot.md.ByUexi5i.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_concierge.md.4rQTSMXt.lean.js → example-agents_concierge.md.lL8rhYlj.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_fsd.md.CzgUrDfi.lean.js → example-agents_fsd.md.DfNKQTHz.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_oncall.md.BG_sUMly.lean.js → example-agents_oncall.md.wFFXXEyW.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_security-reviewer.md.Dhj_m7_B.lean.js → example-agents_security-reviewer.md.Dkf1gyo6.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_slack-agent.md.buLbgvBf.lean.js → example-agents_slack-agent.md.DvgvT4nn.lean.js} +0 -0
- /package/dist/docs/assets/{guides_agent-to-agent.md.Bpzgq2Pq.lean.js → guides_agent-to-agent.md.Bmbxy-FA.lean.js} +0 -0
- /package/dist/docs/assets/{guides_cloud-runtime.md.gVzabdQL.lean.js → guides_cloud-runtime.md.BZ2GA7Es.lean.js} +0 -0
- /package/dist/docs/assets/{guides_github.md.DOOCpqsW.lean.js → guides_github.md.R2QlpR75.lean.js} +0 -0
- /package/dist/docs/assets/{guides_human-in-the-loop.md.DlUqsp1S.lean.js → guides_human-in-the-loop.md.BWvT7UqY.lean.js} +0 -0
- /package/dist/docs/assets/{guides_webhooks.md.wSOYas3X.lean.js → guides_webhooks.md.DiAwSR42.lean.js} +0 -0
- /package/dist/docs/assets/{hillclimbing.md.DHNast08.lean.js → hillclimbing.md.D9Y1_bYh.lean.js} +0 -0
- /package/dist/docs/assets/{quickstart.md.BU6Iwi_9.lean.js → quickstart.md.TnEXYgYW.lean.js} +0 -0
- /package/dist/docs/assets/{reference_agent-config.md.DrW2JUM8.lean.js → reference_agent-config.md.kuN6-OxK.lean.js} +0 -0
- /package/dist/docs/assets/{reference_connections.md.B9Q3TOve.lean.js → reference_connections.md.DGqAsFXb.lean.js} +0 -0
- /package/dist/docs/assets/{reference_http-api.md.BncLd3PZ.lean.js → reference_http-api.md.CfVM_ICa.lean.js} +0 -0
- /package/dist/docs/assets/{reference_schedules.md.w_F2mXB6.lean.js → reference_schedules.md.gmfYzf_I.lean.js} +0 -0
- /package/dist/docs/assets/{reference_sessions.md.DLd6mvbv.lean.js → reference_sessions.md.C_ouF_uf.lean.js} +0 -0
- /package/dist/docs/assets/{reference_tools.md.BRSDnTbN.lean.js → reference_tools.md.BswAQM41.lean.js} +0 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendored from `@anysphere/agent-store-sync` `presigned-url.ts` so the
|
|
3
|
+
* published `@cursor/july` tarball does not depend on that private workspace
|
|
4
|
+
* package (not on npm). Keep in sync when the source validator changes.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Validators the engine runs against every server-returned presigned URL
|
|
8
|
+
// before fetching, so a compromised transport can't turn inbound sync
|
|
9
|
+
// into an SSRF gadget. Production wiring should pin the bucket host via
|
|
10
|
+
// `createHostAllowlistValidator` on top of the strict default.
|
|
11
|
+
|
|
12
|
+
export type PresignedUrlValidator = (url: URL) => void;
|
|
13
|
+
|
|
14
|
+
export type PresignedUrlRejectionCode =
|
|
15
|
+
| "scheme_not_allowed"
|
|
16
|
+
| "userinfo_not_allowed"
|
|
17
|
+
| "host_not_allowed"
|
|
18
|
+
| "private_host_not_allowed";
|
|
19
|
+
|
|
20
|
+
export interface PresignedUrlRejectionOptions {
|
|
21
|
+
code: PresignedUrlRejectionCode;
|
|
22
|
+
message: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class PresignedUrlRejectedError extends Error {
|
|
27
|
+
public readonly code: PresignedUrlRejectionCode;
|
|
28
|
+
/** The host that triggered the rejection (never the full URL). */
|
|
29
|
+
public readonly url: string | undefined;
|
|
30
|
+
|
|
31
|
+
constructor(options: PresignedUrlRejectionOptions) {
|
|
32
|
+
super(options.message);
|
|
33
|
+
this.name = "PresignedUrlRejectedError";
|
|
34
|
+
this.code = options.code;
|
|
35
|
+
this.url = options.url;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Strict default: accepts `https:` URLs to an AWS S3 endpoint with no
|
|
41
|
+
* userinfo and no private/internal address. Rejects DNS hosts that
|
|
42
|
+
* resolve into the private IP space and IPv4-mapped IPv6 literals.
|
|
43
|
+
*/
|
|
44
|
+
export function defaultPresignedUrlValidator(url: URL): void {
|
|
45
|
+
assertSafeAuthority(url);
|
|
46
|
+
if (url.protocol !== "https:") {
|
|
47
|
+
throw new PresignedUrlRejectedError({
|
|
48
|
+
code: "scheme_not_allowed",
|
|
49
|
+
message: `Refused presigned URL with non-https scheme: ${url.protocol}`,
|
|
50
|
+
url: redactPresignedUrlString(url),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const hostname = stripIPv6Brackets(url.hostname);
|
|
54
|
+
if (isLocalOrInternalHost(hostname)) {
|
|
55
|
+
throw new PresignedUrlRejectedError({
|
|
56
|
+
code: "private_host_not_allowed",
|
|
57
|
+
message: `Refused https presigned URL with private/internal host: ${hostname}`,
|
|
58
|
+
url: redactPresignedUrlString(url),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (!isAwsS3Hostname(hostname)) {
|
|
62
|
+
throw new PresignedUrlRejectedError({
|
|
63
|
+
code: "host_not_allowed",
|
|
64
|
+
message: `Refused presigned URL whose host is not an AWS S3 endpoint: ${hostname}`,
|
|
65
|
+
url: redactPresignedUrlString(url),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* True when `hostname` is an AWS S3 object-storage endpoint:
|
|
72
|
+
* `*.amazonaws.com` with at least one label in
|
|
73
|
+
* {@link S3_OBJECT_LABELS}. Covers modern virtual-host, path-style,
|
|
74
|
+
* dualstack, accelerate, and FIPS URLs. Rejects the S3-named control
|
|
75
|
+
* planes (`s3-control`, `s3-outposts`, `s3-object-lambda`) and the
|
|
76
|
+
* legacy regional virtual-host form AWS deprecated in 2019, both of
|
|
77
|
+
* which would otherwise let a tampered presign issuer turn the sync
|
|
78
|
+
* client into a signed-request gadget against non-storage APIs.
|
|
79
|
+
*/
|
|
80
|
+
export function isAwsS3Hostname(hostname: string): boolean {
|
|
81
|
+
const lowered = hostname.toLowerCase();
|
|
82
|
+
if (lowered !== "amazonaws.com" && !lowered.endsWith(".amazonaws.com")) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const labels = lowered.split(".");
|
|
86
|
+
return labels.some(label => S3_OBJECT_LABELS.has(label));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const S3_OBJECT_LABELS = new Set(["s3", "s3-accelerate", "s3-fips"]);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Like {@link defaultPresignedUrlValidator} plus a case-insensitive
|
|
93
|
+
* exact-match check against `allowedHosts` (no subdomain wildcards).
|
|
94
|
+
*/
|
|
95
|
+
export function createHostAllowlistValidator(
|
|
96
|
+
allowedHosts: readonly string[]
|
|
97
|
+
): PresignedUrlValidator {
|
|
98
|
+
const allowed = new Set(allowedHosts.map(host => host.toLowerCase()));
|
|
99
|
+
return (url: URL): void => {
|
|
100
|
+
defaultPresignedUrlValidator(url);
|
|
101
|
+
if (!allowed.has(url.hostname.toLowerCase())) {
|
|
102
|
+
throw new PresignedUrlRejectedError({
|
|
103
|
+
code: "host_not_allowed",
|
|
104
|
+
message: `Refused presigned URL whose host is not in the allowlist: ${url.hostname}`,
|
|
105
|
+
url: redactPresignedUrlString(url),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Virtual-host S3 endpoints for the production `agent-stores` bucket
|
|
113
|
+
* (matches backend `getAgentStoreBucket()` in
|
|
114
|
+
* `backend/server/src/agent-stores/utils/agentStoreS3.ts`, which presigns
|
|
115
|
+
* with a `us-east-1` `S3Client` and the SDK's default virtual-host
|
|
116
|
+
* addressing). Both the regional form emitted by modern AWS SDK v3 and
|
|
117
|
+
* the legacy global form are listed so a presign issuer upgrade or
|
|
118
|
+
* downgrade can't trip the allowlist. Path-style (`s3.amazonaws.com/agent-stores/…`)
|
|
119
|
+
* is intentionally not listed: the server never sets `forcePathStyle`,
|
|
120
|
+
* and admitting bare `s3.amazonaws.com` would re-open the "any bucket"
|
|
121
|
+
* gap this allowlist exists to close.
|
|
122
|
+
*/
|
|
123
|
+
export const BCS_AGENT_STORE_BUCKET_HOSTS: readonly string[] = [
|
|
124
|
+
"agent-stores.s3.us-east-1.amazonaws.com",
|
|
125
|
+
"agent-stores.s3.amazonaws.com",
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
const PLAYGROUND_AGENT_STORE_BUCKET_HOSTS: readonly string[] = [
|
|
129
|
+
"agent-stores-928182716709-us-west-2-an.s3.us-west-2.amazonaws.com",
|
|
130
|
+
"agent-stores-928182716709-us-west-2-an.s3.amazonaws.com",
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Production validator for the BCS agent-store sync transport: strict
|
|
135
|
+
* default (https, S3 endpoint, no private hosts, no userinfo) plus the
|
|
136
|
+
* {@link BCS_AGENT_STORE_BUCKET_HOSTS} pin. Pre-built so callers don't
|
|
137
|
+
* accidentally pass {@link defaultPresignedUrlValidator}, which would
|
|
138
|
+
* accept any AWS S3 bucket on the internet and let a buggy or
|
|
139
|
+
* compromised presign issuer redirect sync traffic away from the real
|
|
140
|
+
* `agent-stores` bucket.
|
|
141
|
+
*/
|
|
142
|
+
export function createBcsPresignedUrlValidator(): PresignedUrlValidator {
|
|
143
|
+
return createHostAllowlistValidator(BCS_AGENT_STORE_BUCKET_HOSTS);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* True when `backendUrl` targets a local dev backend (localhost or
|
|
148
|
+
* lclhst.build). Matches IDE checks in `cursor-always-local` /
|
|
149
|
+
* `cursorCredsService`.
|
|
150
|
+
*/
|
|
151
|
+
export function isLocalAgentStoreBackendUrl(backendUrl: string): boolean {
|
|
152
|
+
const trimmed = backendUrl.trim();
|
|
153
|
+
if (trimmed === "") {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
return trimmed.includes("localhost") || trimmed.includes("lclhst.build");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function isPlaygroundAgentStoreBackendUrl(backendUrl: string): boolean {
|
|
160
|
+
try {
|
|
161
|
+
const hostname = new URL(backendUrl).hostname.toLowerCase();
|
|
162
|
+
return (
|
|
163
|
+
hostname === "playground.cursor.sh" ||
|
|
164
|
+
hostname.endsWith(".playground.cursor.sh")
|
|
165
|
+
);
|
|
166
|
+
} catch {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Presign validator for the sync client. Production/staging and playground
|
|
173
|
+
* backends are pinned to their respective agent-store buckets. For a local dev API (see
|
|
174
|
+
* {@link isLocalAgentStoreBackendUrl}), allow `http:` to loopback only
|
|
175
|
+
* (LocalStack) and still pin all other URLs to {@link BCS_AGENT_STORE_BUCKET_HOSTS}.
|
|
176
|
+
*/
|
|
177
|
+
export function createAgentStorePresignedUrlValidatorForBackend(
|
|
178
|
+
backendUrl: string
|
|
179
|
+
): PresignedUrlValidator {
|
|
180
|
+
if (isLocalAgentStoreBackendUrl(backendUrl)) {
|
|
181
|
+
return createLocalDevAgentStorePresignedUrlValidator();
|
|
182
|
+
}
|
|
183
|
+
if (isPlaygroundAgentStoreBackendUrl(backendUrl)) {
|
|
184
|
+
return createHostAllowlistValidator(PLAYGROUND_AGENT_STORE_BUCKET_HOSTS);
|
|
185
|
+
}
|
|
186
|
+
return createBcsPresignedUrlValidator();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function createLocalDevAgentStorePresignedUrlValidator(): PresignedUrlValidator {
|
|
190
|
+
const bcsValidator = createBcsPresignedUrlValidator();
|
|
191
|
+
return (url: URL): void => {
|
|
192
|
+
assertSafeAuthority(url);
|
|
193
|
+
const hostname = stripIPv6Brackets(url.hostname);
|
|
194
|
+
if (url.protocol === "http:" && isLoopbackHostName(hostname)) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
bcsValidator(url);
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Like {@link defaultPresignedUrlValidator} plus `http://localhost` /
|
|
203
|
+
* `127.0.0.1` / `[::1]` (any port) for LocalStack-backed unit tests.
|
|
204
|
+
* Non-loopback `https:` URLs fall through to the strict default (any S3
|
|
205
|
+
* bucket). Do not use for IDE wiring — use
|
|
206
|
+
* {@link createAgentStorePresignedUrlValidatorForBackend} instead.
|
|
207
|
+
*/
|
|
208
|
+
export function localhostPermissivePresignedUrlValidator(url: URL): void {
|
|
209
|
+
assertSafeAuthority(url);
|
|
210
|
+
const hostname = stripIPv6Brackets(url.hostname);
|
|
211
|
+
if (url.protocol === "http:" && isLoopbackHostName(hostname)) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
defaultPresignedUrlValidator(url);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function assertSafeAuthority(url: URL): void {
|
|
218
|
+
if (url.username !== "" || url.password !== "") {
|
|
219
|
+
throw new PresignedUrlRejectedError({
|
|
220
|
+
code: "userinfo_not_allowed",
|
|
221
|
+
message: "Refused presigned URL with embedded userinfo",
|
|
222
|
+
url: redactPresignedUrlString(url),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Strip the query string and userinfo from a presigned URL so the AWS
|
|
229
|
+
* SigV4 signature never reaches error messages or telemetry.
|
|
230
|
+
*/
|
|
231
|
+
export function redactPresignedUrlString(url: URL | string): string {
|
|
232
|
+
try {
|
|
233
|
+
const parsed = typeof url === "string" ? new URL(url) : url;
|
|
234
|
+
return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
|
|
235
|
+
} catch {
|
|
236
|
+
return "<unparseable-presigned-url>";
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Parse and validate a server-returned presigned URL before fetch. Uses
|
|
242
|
+
* {@link relPath} in error text (never the raw URL) so SigV4 credentials
|
|
243
|
+
* cannot leak into messages.
|
|
244
|
+
*/
|
|
245
|
+
export function assertPresignedUrlSafe(args: {
|
|
246
|
+
readonly rawUrl: string;
|
|
247
|
+
readonly relPath: string;
|
|
248
|
+
readonly validatePresignedUrl: PresignedUrlValidator;
|
|
249
|
+
}): void {
|
|
250
|
+
let parsed: URL;
|
|
251
|
+
try {
|
|
252
|
+
parsed = new URL(args.rawUrl);
|
|
253
|
+
} catch {
|
|
254
|
+
throw new Error(`Refusing unparseable presigned URL for ${args.relPath}`);
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
args.validatePresignedUrl(parsed);
|
|
258
|
+
} catch (error) {
|
|
259
|
+
throw new Error(
|
|
260
|
+
`Refusing presigned URL for ${args.relPath}: ${
|
|
261
|
+
error instanceof Error ? error.message : String(error)
|
|
262
|
+
}`,
|
|
263
|
+
{ cause: error instanceof Error ? error : undefined }
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function isLoopbackHostName(hostname: string): boolean {
|
|
269
|
+
const lowered = hostname.toLowerCase();
|
|
270
|
+
return (
|
|
271
|
+
lowered === "localhost" ||
|
|
272
|
+
lowered === "ip6-localhost" ||
|
|
273
|
+
lowered === "127.0.0.1" ||
|
|
274
|
+
lowered === "::1" ||
|
|
275
|
+
lowered === "0:0:0:0:0:0:0:1"
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function isLocalOrInternalHost(hostname: string): boolean {
|
|
280
|
+
if (hostname.length === 0) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
if (isLoopbackHostName(hostname)) {
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
if (isIPv4Address(hostname)) {
|
|
287
|
+
return isPrivateOrInternalIPv4(hostname);
|
|
288
|
+
}
|
|
289
|
+
if (isIPv6Address(hostname)) {
|
|
290
|
+
return isPrivateOrInternalIPv6(hostname);
|
|
291
|
+
}
|
|
292
|
+
// DNS hostnames can't be classified without resolving; the caller
|
|
293
|
+
// relies on transport-level allowlists for those.
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function stripIPv6Brackets(hostname: string): string {
|
|
298
|
+
return hostname.startsWith("[") && hostname.endsWith("]")
|
|
299
|
+
? hostname.slice(1, -1)
|
|
300
|
+
: hostname;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function isIPv4Address(hostname: string): boolean {
|
|
304
|
+
const parts = hostname.split(".");
|
|
305
|
+
if (parts.length !== 4) {
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
return parts.every(part => {
|
|
309
|
+
if (part.length === 0 || part.length > 3) {
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
if (!/^\d+$/.test(part)) {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
const n = Number(part);
|
|
316
|
+
return Number.isInteger(n) && n >= 0 && n <= 255;
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function isPrivateOrInternalIPv4(hostname: string): boolean {
|
|
321
|
+
const [a, b] = hostname.split(".").map(Number);
|
|
322
|
+
if (a === undefined || b === undefined) {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
// RFC1918, loopback, link-local, multicast, unspecified, broadcast,
|
|
326
|
+
// carrier-grade NAT, and reserved blocks.
|
|
327
|
+
if (a === 0) return true;
|
|
328
|
+
if (a === 10) return true;
|
|
329
|
+
if (a === 127) return true;
|
|
330
|
+
if (a === 169 && b === 254) return true;
|
|
331
|
+
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
332
|
+
if (a === 192 && b === 168) return true;
|
|
333
|
+
if (a === 100 && b >= 64 && b <= 127) return true;
|
|
334
|
+
if (a >= 224 && a <= 239) return true;
|
|
335
|
+
if (a >= 240) return true;
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function isIPv6Address(hostname: string): boolean {
|
|
340
|
+
// Loose check — just enough to route the host to the IPv6 classifier.
|
|
341
|
+
return hostname.includes(":");
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function isPrivateOrInternalIPv6(hostname: string): boolean {
|
|
345
|
+
const lowered = hostname.toLowerCase();
|
|
346
|
+
if (lowered === "::" || lowered === "::1") {
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
// IPv4-mapped IPv6 (RFC4291) routes back through the IPv4 classifier
|
|
350
|
+
// so `[::ffff:169.254.169.254]` can't slip past the private-IP check.
|
|
351
|
+
const mapped = extractIPv4MappedAddress(lowered);
|
|
352
|
+
if (mapped !== undefined) {
|
|
353
|
+
return isPrivateOrInternalIPv4(mapped);
|
|
354
|
+
}
|
|
355
|
+
// ULA fc00::/7, link-local fe80::/10, multicast ff00::/8.
|
|
356
|
+
if (lowered.startsWith("fc") || lowered.startsWith("fd")) {
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
if (lowered.startsWith("fe8") || lowered.startsWith("fe9")) {
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
if (lowered.startsWith("fea") || lowered.startsWith("feb")) {
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
if (lowered.startsWith("ff")) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// Convert an IPv4-mapped IPv6 literal (`::ffff:a.b.c.d` or
|
|
372
|
+
// `::ffff:hhhh:hhhh`) to its dotted-quad form. Returns undefined otherwise.
|
|
373
|
+
function extractIPv4MappedAddress(hostname: string): string | undefined {
|
|
374
|
+
const dotted = hostname.match(
|
|
375
|
+
/^(?:0:0:0:0:0|::):?ffff:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/i
|
|
376
|
+
);
|
|
377
|
+
if (dotted) {
|
|
378
|
+
return dotted[1];
|
|
379
|
+
}
|
|
380
|
+
if (hostname.startsWith("::ffff:")) {
|
|
381
|
+
const tail = hostname.slice("::ffff:".length);
|
|
382
|
+
if (isIPv4Address(tail)) {
|
|
383
|
+
return tail;
|
|
384
|
+
}
|
|
385
|
+
const hex = tail.match(/^([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);
|
|
386
|
+
if (hex) {
|
|
387
|
+
const high = Number.parseInt(hex[1], 16);
|
|
388
|
+
const low = Number.parseInt(hex[2], 16);
|
|
389
|
+
if (
|
|
390
|
+
Number.isFinite(high) &&
|
|
391
|
+
Number.isFinite(low) &&
|
|
392
|
+
high >= 0 &&
|
|
393
|
+
high <= 0xffff &&
|
|
394
|
+
low >= 0 &&
|
|
395
|
+
low <= 0xffff
|
|
396
|
+
) {
|
|
397
|
+
return `${(high >> 8) & 0xff}.${high & 0xff}.${(low >> 8) & 0xff}.${low & 0xff}`;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return undefined;
|
|
402
|
+
}
|