@cursor/july 0.1.92 → 0.1.93
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/README.md +117 -162
- package/dist/channels/deployments/deployments-channel.d.ts +7 -0
- package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
- package/dist/channels/deployments/deployments-channel.js +26 -2
- package/dist/channels/deployments/types.d.ts +8 -0
- package/dist/channels/deployments/types.d.ts.map +1 -1
- package/dist/channels/github/github-channel.d.ts +3 -0
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +28 -56
- package/dist/continuation.d.ts +1 -1
- package/dist/continuation.js +1 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +8 -8
- package/dist/docs/ab.md +7 -13
- package/dist/docs/assets/{ab.md.CVzWxLoB.js → ab.md.DJo5r4R-.js} +4 -4
- package/dist/docs/assets/{ab.md.CVzWxLoB.lean.js → ab.md.DJo5r4R-.lean.js} +1 -1
- package/dist/docs/assets/{app.Bci6CM9E.js → app.CjWU-x0z.js} +1 -1
- package/dist/docs/assets/building-with-agents.md.DI4mEzlt.js +13 -0
- package/dist/docs/assets/{building-with-agents.md.DH8A_cHA.lean.js → building-with-agents.md.DI4mEzlt.lean.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.ChpIC3Zy.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.BCPT6xA-.js → VPLocalSearchBox.Cxy8ySFQ.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BEA8BF3c.js → theme.Dvq1Bktu.js} +2 -2
- package/dist/docs/assets/concepts.md.F6AiPorA.js +1 -0
- package/dist/docs/assets/{concepts.md.CRfU3bVg.lean.js → concepts.md.F6AiPorA.lean.js} +1 -1
- package/dist/docs/assets/{deployment.md.DX_hc3ze.js → deployment.md.DoLFAzfm.js} +6 -6
- package/dist/docs/assets/{evals.md.a0SMN6r9.js → evals.md.lfJoEVc8.js} +6 -6
- package/dist/docs/assets/{evals.md.a0SMN6r9.lean.js → evals.md.lfJoEVc8.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_approval-buddy.md.DNL83puR.js → example-agents_approval-buddy.md.DmezILPg.js} +1 -1
- package/dist/docs/assets/{example-agents_benny.md.C40vHRLc.js → example-agents_benny.md.B0kwY7D_.js} +2 -4
- package/dist/docs/assets/{example-agents_benny.md.C40vHRLc.lean.js → example-agents_benny.md.B0kwY7D_.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_codebase-wiki.md.Dftj_tPp.js → example-agents_codebase-wiki.md.BBNw9Ekr.js} +3 -3
- package/dist/docs/assets/{example-agents_codebase-wiki.md.Dftj_tPp.lean.js → example-agents_codebase-wiki.md.BBNw9Ekr.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_concierge.md.MrKpQndp.js → example-agents_concierge.md.BzB2b20R.js} +2 -3
- package/dist/docs/assets/example-agents_index.md.ChBp0AX6.js +2 -0
- package/dist/docs/assets/example-agents_index.md.ChBp0AX6.lean.js +1 -0
- package/dist/docs/assets/{example-agents_knowledge-base.md.DqKqHQ9u.js → example-agents_knowledge-base.md.CrA85ig-.js} +1 -1
- package/dist/docs/assets/{example-agents_security-reviewer.md.Bai6D0Ee.js → example-agents_security-reviewer.md.74pPpWYj.js} +1 -1
- package/dist/docs/assets/{example-agents_weather-agent.md.lVEAbWFf.js → example-agents_weather-agent.md.CaGpmw3Y.js} +2 -2
- package/dist/docs/assets/{guides_agent-to-agent.md.BCeVdJRJ.js → guides_agent-to-agent.md.B3JIaAqz.js} +1 -1
- package/dist/docs/assets/{guides_cloud-runtime.md.BSMLIBHr.js → guides_cloud-runtime.md.BnvjPiia.js} +2 -2
- package/dist/docs/assets/{guides_cloud-runtime.md.BSMLIBHr.lean.js → guides_cloud-runtime.md.BnvjPiia.lean.js} +1 -1
- package/dist/docs/assets/{guides_convert-automation.md.D06eIzea.js → guides_convert-automation.md.Bboisykk.js} +1 -1
- package/dist/docs/assets/{guides_github.md.Cdt1s2QC.js → guides_github.md.DqJhuaN1.js} +5 -5
- package/dist/docs/assets/{guides_github.md.Cdt1s2QC.lean.js → guides_github.md.DqJhuaN1.lean.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.Du0f7pGU.js → guides_mcp-oauth.md.CJvrXtkN.js} +2 -2
- package/dist/docs/assets/{guides_slack.md.DiUmk_Oi.js → guides_slack.md.mqeNKs84.js} +2 -2
- package/dist/docs/assets/{guides_webhooks.md.BpnIdO0i.js → guides_webhooks.md.DKdA43Qm.js} +2 -2
- package/dist/docs/assets/{hillclimbing.md.ywF3yDAd.js → hillclimbing.md.DhESf3OO.js} +1 -1
- package/dist/docs/assets/{index.md.BAaMXLFd.js → index.md.B-lVR4wT.js} +3 -3
- package/dist/docs/assets/{index.md.BAaMXLFd.lean.js → index.md.B-lVR4wT.lean.js} +1 -1
- package/dist/docs/assets/{quickstart.md.DsrarzEg.js → quickstart.md.BrmfrrIr.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.Bqylgw50.js → reference_agent-config.md.Cp_x38Nl.js} +3 -3
- package/dist/docs/assets/{reference_channels.md.DQZjCnyh.js → reference_channels.md.Cd2f2iyV.js} +2 -2
- package/dist/docs/assets/{reference_channels.md.DQZjCnyh.lean.js → reference_channels.md.Cd2f2iyV.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.B7GkAJRC.js → reference_cli.md.D9KESDsD.js} +10 -11
- package/dist/docs/assets/{reference_cli.md.B7GkAJRC.lean.js → reference_cli.md.D9KESDsD.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.DYidrb-j.js → reference_connections.md.DB6SsN6U.js} +3 -3
- package/dist/docs/assets/reference_hooks.md.BxN87gCw.js +14 -0
- package/dist/docs/assets/{reference_hooks.md.B9FSgdDe.lean.js → reference_hooks.md.BxN87gCw.lean.js} +1 -1
- package/dist/docs/assets/reference_http-api.md.C68BERYr.js +11 -0
- package/dist/docs/assets/reference_http-api.md.C68BERYr.lean.js +1 -0
- package/dist/docs/assets/{reference_instructions.md.DhNCOl7r.js → reference_instructions.md.CR7XSsGk.js} +3 -3
- package/dist/docs/assets/{reference_instructions.md.DhNCOl7r.lean.js → reference_instructions.md.CR7XSsGk.lean.js} +1 -1
- package/dist/docs/assets/reference_playground.md.DnX5nL-B.js +1 -0
- package/dist/docs/assets/reference_playground.md.DnX5nL-B.lean.js +1 -0
- package/dist/docs/assets/{reference_project-layout.md.CwkSbEWT.js → reference_project-layout.md.WN9nwJht.js} +2 -2
- package/dist/docs/assets/{reference_prompt.md.DZUMtLPD.js → reference_prompt.md.DnaD5dNK.js} +1 -1
- package/dist/docs/assets/{reference_schedules.md.DNipebiG.js → reference_schedules.md.DI_JrHgq.js} +1 -1
- package/dist/docs/assets/reference_sessions.md.D0mIh4KK.js +1 -0
- package/dist/docs/assets/{reference_sessions.md.tUFzz98S.lean.js → reference_sessions.md.D0mIh4KK.lean.js} +1 -1
- package/dist/docs/assets/{reference_skills.md.B5ZEuHfG.js → reference_skills.md.BFW9retM.js} +1 -1
- package/dist/docs/assets/{reference_tools.md.wpaJtHn6.js → reference_tools.md.DuKvkYWG.js} +4 -4
- package/dist/docs/assets/{reference_tools.md.wpaJtHn6.lean.js → reference_tools.md.DuKvkYWG.lean.js} +1 -1
- package/dist/docs/assets/scaffolding-agents.md.D7UUkWw0.js +1 -0
- package/dist/docs/assets/{scaffolding-agents.md.CRDDUtYJ.lean.js → scaffolding-agents.md.D7UUkWw0.lean.js} +1 -1
- package/dist/docs/assets/{storage.md.JbjlHWZ6.js → storage.md.BOHeqk2M.js} +5 -5
- package/dist/docs/assets/{storage.md.JbjlHWZ6.lean.js → storage.md.BOHeqk2M.lean.js} +1 -1
- package/dist/docs/assets/{templates_agentic-owners.md.DSJSIpWU.js → templates_agentic-owners.md.DqtPdm6f.js} +2 -2
- package/dist/docs/assets/{templates_pr-autofixer.md.1HAR3RXE.js → templates_pr-autofixer.md.R4K_qytS.js} +2 -2
- package/dist/docs/assets/{templates_pr-autofixer.md.1HAR3RXE.lean.js → templates_pr-autofixer.md.R4K_qytS.lean.js} +1 -1
- package/dist/docs/assets/troubleshooting.md.vCWwvqcJ.js +1 -0
- package/dist/docs/assets/{troubleshooting.md.DYECCZiJ.lean.js → troubleshooting.md.vCWwvqcJ.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +7 -7
- package/dist/docs/building-with-agents.md +5 -11
- package/dist/docs/concepts.html +5 -8
- package/dist/docs/concepts.md +12 -17
- package/dist/docs/deployment.html +11 -11
- package/dist/docs/deployment.md +8 -10
- package/dist/docs/evals.html +10 -10
- package/dist/docs/evals.md +16 -37
- package/dist/docs/example-agents/approval-buddy.html +5 -5
- package/dist/docs/example-agents/approval-buddy.md +1 -1
- package/dist/docs/example-agents/benny.html +5 -7
- package/dist/docs/example-agents/benny.md +4 -13
- package/dist/docs/example-agents/bugbot.html +4 -4
- package/dist/docs/example-agents/codebase-wiki.html +6 -6
- package/dist/docs/example-agents/codebase-wiki.md +5 -8
- package/dist/docs/example-agents/codeowners-review.html +4 -4
- package/dist/docs/example-agents/concierge.html +7 -8
- package/dist/docs/example-agents/concierge.md +2 -3
- package/dist/docs/example-agents/index.html +6 -6
- package/dist/docs/example-agents/index.md +5 -8
- package/dist/docs/example-agents/knowledge-base.html +6 -6
- package/dist/docs/example-agents/knowledge-base.md +2 -2
- package/dist/docs/example-agents/oncall.html +4 -4
- package/dist/docs/example-agents/security-reviewer.html +7 -7
- package/dist/docs/example-agents/security-reviewer.md +5 -5
- package/dist/docs/example-agents/slack-agent.html +4 -4
- package/dist/docs/example-agents/weather-agent.html +7 -7
- package/dist/docs/example-agents/weather-agent.md +4 -3
- package/dist/docs/guides/agent-to-agent.html +5 -5
- package/dist/docs/guides/agent-to-agent.md +1 -1
- package/dist/docs/guides/cloud-runtime.html +6 -6
- package/dist/docs/guides/cloud-runtime.md +8 -25
- package/dist/docs/guides/convert-automation.html +6 -6
- package/dist/docs/guides/convert-automation.md +3 -3
- package/dist/docs/guides/github.html +9 -9
- package/dist/docs/guides/github.md +11 -23
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +6 -6
- package/dist/docs/guides/mcp-oauth.md +4 -4
- package/dist/docs/guides/opentelemetry.html +4 -4
- package/dist/docs/guides/slack.html +7 -7
- package/dist/docs/guides/slack.md +4 -4
- package/dist/docs/guides/webhooks.html +6 -6
- package/dist/docs/guides/webhooks.md +3 -3
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +6 -6
- package/dist/docs/hillclimbing.md +1 -1
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +2 -10
- package/dist/docs/llms-full.txt +300 -850
- package/dist/docs/llms.txt +2 -3
- package/dist/docs/quickstart.html +5 -5
- package/dist/docs/quickstart.md +1 -1
- package/dist/docs/reference/agent-config.html +8 -8
- package/dist/docs/reference/agent-config.md +10 -15
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +6 -6
- package/dist/docs/reference/channels.md +20 -31
- package/dist/docs/reference/cli.html +14 -15
- package/dist/docs/reference/cli.md +27 -37
- package/dist/docs/reference/connections.html +8 -8
- package/dist/docs/reference/connections.md +9 -14
- package/dist/docs/reference/hooks.html +6 -6
- package/dist/docs/reference/hooks.md +10 -14
- package/dist/docs/reference/http-api.html +7 -7
- package/dist/docs/reference/http-api.md +17 -37
- package/dist/docs/reference/instructions.html +6 -6
- package/dist/docs/reference/instructions.md +1 -1
- package/dist/docs/reference/playground.html +5 -5
- package/dist/docs/reference/playground.md +14 -19
- package/dist/docs/reference/project-layout.html +7 -7
- package/dist/docs/reference/project-layout.md +2 -2
- package/dist/docs/reference/prompt.html +6 -6
- package/dist/docs/reference/prompt.md +1 -1
- package/dist/docs/reference/schedules.html +6 -6
- package/dist/docs/reference/schedules.md +1 -2
- package/dist/docs/reference/sessions.html +5 -12
- package/dist/docs/reference/sessions.md +8 -19
- package/dist/docs/reference/skills.html +6 -6
- package/dist/docs/reference/skills.md +3 -3
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +8 -8
- package/dist/docs/reference/tools.md +12 -17
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/scaffolding-agents.md +4 -5
- package/dist/docs/storage.html +9 -9
- package/dist/docs/storage.md +37 -80
- package/dist/docs/templates/agentic-owners.html +7 -7
- package/dist/docs/templates/agentic-owners.md +2 -2
- package/dist/docs/templates/demo.html +4 -4
- package/dist/docs/templates/pr-autofixer.html +6 -6
- package/dist/docs/templates/pr-autofixer.md +3 -6
- package/dist/docs/templates/security-reviewer.html +4 -4
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/docs/troubleshooting.md +6 -6
- package/dist/internal/authored-alias-hooks.d.ts +14 -11
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
- package/dist/internal/authored-alias-hooks.js +14 -11
- package/dist/internal/authored-loaders.d.ts +7 -6
- package/dist/internal/authored-loaders.d.ts.map +1 -1
- package/dist/internal/authored-loaders.js +14 -10
- package/dist/internal/cli-deploy.d.ts +1 -1
- package/dist/internal/cli-deploy.js +5 -5
- package/dist/internal/continuation-channel.d.ts +6 -3
- package/dist/internal/continuation-channel.d.ts.map +1 -1
- package/dist/internal/continuation-channel.js +44 -40
- package/dist/internal/continuation-identity.d.ts +17 -16
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +109 -36
- package/dist/internal/deploy-manifest.d.ts +2 -2
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +4 -9
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +3 -0
- package/dist/internal/distribution.d.ts +4 -3
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +4 -3
- package/dist/internal/hosted-delivery-protocol.d.ts +38 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -0
- package/dist/internal/hosted-delivery-protocol.js +70 -0
- package/dist/internal/hosted-delivery.d.ts +35 -0
- package/dist/internal/hosted-delivery.d.ts.map +1 -0
- package/dist/internal/hosted-delivery.js +226 -0
- package/dist/internal/http-channel.d.ts.map +1 -1
- package/dist/internal/http-channel.js +1 -1
- package/dist/internal/review-comments.d.ts +186 -63
- package/dist/internal/review-comments.d.ts.map +1 -1
- package/dist/internal/review-comments.js +350 -168
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +21 -3
- package/dist/internal/session-engine.d.ts +5 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +13 -3
- package/dist/internal/shallow-clone.d.ts +8 -2
- package/dist/internal/shallow-clone.d.ts.map +1 -1
- package/dist/internal/shallow-clone.js +17 -10
- package/dist/playground/assets/{index-DDvyC2z6.js → index-D9MFzhNE.js} +1 -1
- package/dist/playground/index.html +1 -1
- package/dist/types.d.ts +9 -17
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +2 -10
- package/docs/ab.md +7 -13
- package/docs/building-with-agents.md +5 -11
- package/docs/concepts.md +12 -17
- package/docs/deployment.md +8 -10
- package/docs/evals.md +16 -37
- package/docs/example-agents/approval-buddy.md +1 -1
- package/docs/example-agents/benny.md +4 -13
- package/docs/example-agents/codebase-wiki.md +5 -8
- package/docs/example-agents/concierge.md +2 -3
- package/docs/example-agents/index.md +6 -9
- package/docs/example-agents/knowledge-base.md +2 -2
- package/docs/example-agents/security-reviewer.md +5 -5
- package/docs/example-agents/weather-agent.md +4 -3
- package/docs/guides/agent-to-agent.md +1 -1
- package/docs/guides/cloud-runtime.md +8 -25
- package/docs/guides/convert-automation.md +3 -3
- package/docs/guides/github.md +11 -23
- package/docs/guides/mcp-oauth.md +4 -4
- package/docs/guides/slack.md +4 -4
- package/docs/guides/webhooks.md +3 -3
- package/docs/hillclimbing.md +1 -1
- package/docs/quickstart.md +1 -1
- package/docs/reference/agent-config.md +10 -15
- package/docs/reference/channels.md +20 -31
- package/docs/reference/cli.md +27 -37
- package/docs/reference/connections.md +9 -14
- package/docs/reference/hooks.md +10 -14
- package/docs/reference/http-api.md +18 -38
- package/docs/reference/instructions.md +1 -1
- package/docs/reference/playground.md +14 -19
- package/docs/reference/project-layout.md +2 -2
- package/docs/reference/prompt.md +1 -1
- package/docs/reference/schedules.md +1 -2
- package/docs/reference/sessions.md +8 -19
- package/docs/reference/skills.md +3 -3
- package/docs/reference/tools.md +12 -17
- package/docs/scaffolding-agents.md +4 -5
- package/docs/storage.md +37 -80
- package/docs/templates/agentic-owners.md +2 -2
- package/docs/templates/pr-autofixer.md +3 -6
- package/docs/troubleshooting.md +6 -6
- package/package.json +8 -1
- package/src/channels/deployments/deployments-channel.ts +32 -2
- package/src/channels/deployments/types.ts +8 -0
- package/src/channels/github/github-channel.ts +71 -21
- package/src/continuation.ts +1 -1
- package/src/internal/authored-alias-hooks.ts +14 -11
- package/src/internal/authored-loaders.ts +14 -10
- package/src/internal/cli-deploy.ts +5 -5
- package/src/internal/continuation-channel.ts +62 -45
- package/src/internal/continuation-identity.ts +123 -38
- package/src/internal/deploy-manifest.ts +5 -9
- package/src/internal/discovery.ts +3 -0
- package/src/internal/distribution.ts +4 -3
- package/src/internal/hosted-delivery-protocol.ts +114 -0
- package/src/internal/hosted-delivery.ts +327 -0
- package/src/internal/http-channel.ts +0 -2
- package/src/internal/review-comments.ts +542 -229
- package/src/internal/server.ts +29 -2
- package/src/internal/session-engine.ts +25 -1
- package/src/internal/shallow-clone.ts +30 -16
- package/src/types.ts +9 -17
- package/dist/docs/assets/building-with-agents.md.DH8A_cHA.js +0 -13
- package/dist/docs/assets/chunks/@localSearchIndexroot.Dv-Q0XtU.js +0 -1
- package/dist/docs/assets/concepts.md.CRfU3bVg.js +0 -4
- package/dist/docs/assets/example-agents_fsd.md.ZWHWWZPE.js +0 -15
- package/dist/docs/assets/example-agents_fsd.md.ZWHWWZPE.lean.js +0 -1
- package/dist/docs/assets/example-agents_index.md.QZ8mhr6n.js +0 -2
- package/dist/docs/assets/example-agents_index.md.QZ8mhr6n.lean.js +0 -1
- package/dist/docs/assets/reference_hooks.md.B9FSgdDe.js +0 -14
- package/dist/docs/assets/reference_http-api.md.CSHVobzG.js +0 -11
- package/dist/docs/assets/reference_http-api.md.CSHVobzG.lean.js +0 -1
- package/dist/docs/assets/reference_playground.md.Dfb92yQf.js +0 -1
- package/dist/docs/assets/reference_playground.md.Dfb92yQf.lean.js +0 -1
- package/dist/docs/assets/reference_sessions.md.tUFzz98S.js +0 -8
- package/dist/docs/assets/scaffolding-agents.md.CRDDUtYJ.js +0 -1
- package/dist/docs/assets/troubleshooting.md.DYECCZiJ.js +0 -1
- package/dist/docs/example-agents/fsd.html +0 -41
- package/dist/docs/example-agents/fsd.md +0 -329
- package/docs/example-agents/fsd.md +0 -334
- /package/dist/docs/assets/{deployment.md.DX_hc3ze.lean.js → deployment.md.DoLFAzfm.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_approval-buddy.md.DNL83puR.lean.js → example-agents_approval-buddy.md.DmezILPg.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_concierge.md.MrKpQndp.lean.js → example-agents_concierge.md.BzB2b20R.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_knowledge-base.md.DqKqHQ9u.lean.js → example-agents_knowledge-base.md.CrA85ig-.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_security-reviewer.md.Bai6D0Ee.lean.js → example-agents_security-reviewer.md.74pPpWYj.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_weather-agent.md.lVEAbWFf.lean.js → example-agents_weather-agent.md.CaGpmw3Y.lean.js} +0 -0
- /package/dist/docs/assets/{guides_agent-to-agent.md.BCeVdJRJ.lean.js → guides_agent-to-agent.md.B3JIaAqz.lean.js} +0 -0
- /package/dist/docs/assets/{guides_convert-automation.md.D06eIzea.lean.js → guides_convert-automation.md.Bboisykk.lean.js} +0 -0
- /package/dist/docs/assets/{guides_mcp-oauth.md.Du0f7pGU.lean.js → guides_mcp-oauth.md.CJvrXtkN.lean.js} +0 -0
- /package/dist/docs/assets/{guides_slack.md.DiUmk_Oi.lean.js → guides_slack.md.mqeNKs84.lean.js} +0 -0
- /package/dist/docs/assets/{guides_webhooks.md.BpnIdO0i.lean.js → guides_webhooks.md.DKdA43Qm.lean.js} +0 -0
- /package/dist/docs/assets/{hillclimbing.md.ywF3yDAd.lean.js → hillclimbing.md.DhESf3OO.lean.js} +0 -0
- /package/dist/docs/assets/{quickstart.md.DsrarzEg.lean.js → quickstart.md.BrmfrrIr.lean.js} +0 -0
- /package/dist/docs/assets/{reference_agent-config.md.Bqylgw50.lean.js → reference_agent-config.md.Cp_x38Nl.lean.js} +0 -0
- /package/dist/docs/assets/{reference_connections.md.DYidrb-j.lean.js → reference_connections.md.DB6SsN6U.lean.js} +0 -0
- /package/dist/docs/assets/{reference_project-layout.md.CwkSbEWT.lean.js → reference_project-layout.md.WN9nwJht.lean.js} +0 -0
- /package/dist/docs/assets/{reference_prompt.md.DZUMtLPD.lean.js → reference_prompt.md.DnaD5dNK.lean.js} +0 -0
- /package/dist/docs/assets/{reference_schedules.md.DNipebiG.lean.js → reference_schedules.md.DI_JrHgq.lean.js} +0 -0
- /package/dist/docs/assets/{reference_skills.md.B5ZEuHfG.lean.js → reference_skills.md.BFW9retM.lean.js} +0 -0
- /package/dist/docs/assets/{templates_agentic-owners.md.DSJSIpWU.lean.js → templates_agentic-owners.md.DqtPdm6f.lean.js} +0 -0
|
@@ -2,20 +2,27 @@
|
|
|
2
2
|
* Continuation identity is a closed selector string. Omitted `continuation`
|
|
3
3
|
* on a channel constructor stays `/v1` (engine pack minting) so existing
|
|
4
4
|
* agents do not change: `githubChannel()` → `github.pr/v1`, `slackChannel()`
|
|
5
|
-
* → `slack.thread/v1`, `originChannel()` → `origin.pr/v1`,
|
|
6
|
-
* → `none/v1
|
|
5
|
+
* → `slack.thread/v1`, `originChannel()` → `origin.pr/v1`,
|
|
6
|
+
* `deploymentsChannel()` → `deployments.none/v1`, `httpChannel()` →
|
|
7
|
+
* `none/v1`.
|
|
7
8
|
*
|
|
8
9
|
* Opt the whole agent into the v2 control plane with
|
|
9
10
|
* `defineAgent({ architecture: "v2" })`. That stamps `/v2` defaults from
|
|
10
11
|
* the channel kind and declared events (`github.pr/v2`, `github.issue/v2`,
|
|
11
|
-
* `github.none/v2`, `slack.thread/v2`,
|
|
12
|
-
*
|
|
12
|
+
* `github.none/v2`, `slack.thread/v2`, `origin.pr/v2`,
|
|
13
|
+
* `deployments.deployment/v2`, …) onto every channel that omitted a
|
|
14
|
+
* selector. An explicit per-channel selector still overrides. JSONPath
|
|
13
15
|
* and per-agent format strings are rejected.
|
|
14
16
|
*/
|
|
15
17
|
|
|
16
18
|
import { randomBytes } from "node:crypto";
|
|
17
19
|
|
|
18
|
-
export type ConversationType =
|
|
20
|
+
export type ConversationType =
|
|
21
|
+
| "pr"
|
|
22
|
+
| "issue"
|
|
23
|
+
| "thread"
|
|
24
|
+
| "origin-pr"
|
|
25
|
+
| "deployment";
|
|
19
26
|
|
|
20
27
|
export const CONTINUATION_SELECTORS = [
|
|
21
28
|
"github.pr/v1",
|
|
@@ -29,6 +36,9 @@ export const CONTINUATION_SELECTORS = [
|
|
|
29
36
|
"origin.pr/v1",
|
|
30
37
|
"origin.pr/v2",
|
|
31
38
|
"origin.none/v2",
|
|
39
|
+
"deployments.none/v1",
|
|
40
|
+
"deployments.none/v2",
|
|
41
|
+
"deployments.deployment/v2",
|
|
32
42
|
"none/v1",
|
|
33
43
|
"none/v2",
|
|
34
44
|
] as const;
|
|
@@ -42,7 +52,7 @@ export type ParsedContinuation = {
|
|
|
42
52
|
selector: ContinuationSelector;
|
|
43
53
|
version: 1 | 2;
|
|
44
54
|
type: ConversationType | "none";
|
|
45
|
-
kind: "github" | "slack" | "origin" | "http";
|
|
55
|
+
kind: "github" | "slack" | "origin" | "deployments" | "http";
|
|
46
56
|
};
|
|
47
57
|
|
|
48
58
|
export type ContinuationClaim = {
|
|
@@ -50,7 +60,8 @@ export type ContinuationClaim = {
|
|
|
50
60
|
resource:
|
|
51
61
|
| { owner: string; repo: string; number: number }
|
|
52
62
|
| { channelId: string; threadTs: string }
|
|
53
|
-
| { fullName: string; number: number }
|
|
63
|
+
| { fullName: string; number: number }
|
|
64
|
+
| { deploymentId: string };
|
|
54
65
|
};
|
|
55
66
|
|
|
56
67
|
export type MailboxContinuation = {
|
|
@@ -59,7 +70,7 @@ export type MailboxContinuation = {
|
|
|
59
70
|
|
|
60
71
|
export type ContinuationBuiltin = {
|
|
61
72
|
type: ConversationType;
|
|
62
|
-
kind: "github" | "slack" | "origin";
|
|
73
|
+
kind: "github" | "slack" | "origin" | "deployments";
|
|
63
74
|
events: readonly string[];
|
|
64
75
|
format: string;
|
|
65
76
|
};
|
|
@@ -105,6 +116,12 @@ export const BUILTINS: readonly ContinuationBuiltin[] = [
|
|
|
105
116
|
],
|
|
106
117
|
format: "origin-pr:{fullName}#{number}",
|
|
107
118
|
},
|
|
119
|
+
{
|
|
120
|
+
type: "deployment",
|
|
121
|
+
kind: "deployments",
|
|
122
|
+
events: ["deployment.created", "deployment.succeeded"],
|
|
123
|
+
format: "deployments:{deploymentId}",
|
|
124
|
+
},
|
|
108
125
|
] as const;
|
|
109
126
|
|
|
110
127
|
export class V2EngineError extends Error {
|
|
@@ -128,6 +145,13 @@ const SELECTOR_FIELDS: {
|
|
|
128
145
|
"origin.pr/v1": { version: 1, type: "origin-pr", kind: "origin" },
|
|
129
146
|
"origin.pr/v2": { version: 2, type: "origin-pr", kind: "origin" },
|
|
130
147
|
"origin.none/v2": { version: 2, type: "none", kind: "origin" },
|
|
148
|
+
"deployments.none/v1": { version: 1, type: "none", kind: "deployments" },
|
|
149
|
+
"deployments.none/v2": { version: 2, type: "none", kind: "deployments" },
|
|
150
|
+
"deployments.deployment/v2": {
|
|
151
|
+
version: 2,
|
|
152
|
+
type: "deployment",
|
|
153
|
+
kind: "deployments",
|
|
154
|
+
},
|
|
131
155
|
"none/v1": { version: 1, type: "none", kind: "http" },
|
|
132
156
|
"none/v2": { version: 2, type: "none", kind: "http" },
|
|
133
157
|
};
|
|
@@ -151,6 +175,8 @@ export function defaultContinuationSelector(
|
|
|
151
175
|
return "slack.thread/v1";
|
|
152
176
|
case "origin":
|
|
153
177
|
return "origin.pr/v1";
|
|
178
|
+
case "deployments":
|
|
179
|
+
return "deployments.none/v1";
|
|
154
180
|
default:
|
|
155
181
|
return "none/v1";
|
|
156
182
|
}
|
|
@@ -162,6 +188,8 @@ export function defaultContinuationSelector(
|
|
|
162
188
|
return "slack.thread/v2";
|
|
163
189
|
case "origin":
|
|
164
190
|
return originV2Default(eventTypes);
|
|
191
|
+
case "deployments":
|
|
192
|
+
return deploymentsV2Default(eventTypes);
|
|
165
193
|
default:
|
|
166
194
|
return "none/v2";
|
|
167
195
|
}
|
|
@@ -189,6 +217,17 @@ function originV2Default(eventTypes?: readonly string[]): ContinuationSelector {
|
|
|
189
217
|
return "origin.pr/v2";
|
|
190
218
|
}
|
|
191
219
|
|
|
220
|
+
function deploymentsV2Default(
|
|
221
|
+
eventTypes?: readonly string[]
|
|
222
|
+
): ContinuationSelector {
|
|
223
|
+
const events = eventTypes ?? [];
|
|
224
|
+
const deploymentEvents = new Set(builtinForType("deployment")?.events ?? []);
|
|
225
|
+
if (events.some((event) => !deploymentEvents.has(event))) {
|
|
226
|
+
return "deployments.none/v2";
|
|
227
|
+
}
|
|
228
|
+
return "deployments.deployment/v2";
|
|
229
|
+
}
|
|
230
|
+
|
|
192
231
|
export function parseContinuationSelector(
|
|
193
232
|
selector: string
|
|
194
233
|
): ParsedContinuation | undefined {
|
|
@@ -249,6 +288,7 @@ export function formatConversationKey(
|
|
|
249
288
|
number?: number;
|
|
250
289
|
channelId?: string;
|
|
251
290
|
threadTs?: string;
|
|
291
|
+
deploymentId?: string;
|
|
252
292
|
}
|
|
253
293
|
): string {
|
|
254
294
|
switch (type) {
|
|
@@ -260,30 +300,51 @@ export function formatConversationKey(
|
|
|
260
300
|
return `origin-pr:${fields.fullName}#${fields.number}`;
|
|
261
301
|
case "thread":
|
|
262
302
|
return `${fields.channelId}:${fields.threadTs}`;
|
|
303
|
+
case "deployment":
|
|
304
|
+
return `deployments:${fields.deploymentId}`;
|
|
263
305
|
}
|
|
264
306
|
}
|
|
265
307
|
|
|
266
308
|
export function mintClaim(claim: ContinuationClaim): string {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
309
|
+
switch (claim.type) {
|
|
310
|
+
case "thread": {
|
|
311
|
+
const resource = claim.resource;
|
|
312
|
+
if (!("channelId" in resource && "threadTs" in resource)) {
|
|
313
|
+
throw new V2EngineError(
|
|
314
|
+
"v2: thread claim requires channelId and threadTs"
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
return `cont:${formatConversationKey("thread", resource)}`;
|
|
318
|
+
}
|
|
319
|
+
case "deployment": {
|
|
320
|
+
const resource = claim.resource;
|
|
321
|
+
if (!("deploymentId" in resource)) {
|
|
322
|
+
throw new V2EngineError("v2: deployment claim requires deploymentId");
|
|
323
|
+
}
|
|
324
|
+
return `cont:${formatConversationKey("deployment", resource)}`;
|
|
325
|
+
}
|
|
326
|
+
case "pr":
|
|
327
|
+
case "issue":
|
|
328
|
+
case "origin-pr": {
|
|
329
|
+
const resource = claim.resource;
|
|
330
|
+
const fullName =
|
|
331
|
+
"fullName" in resource
|
|
332
|
+
? resource.fullName
|
|
333
|
+
: "owner" in resource
|
|
334
|
+
? `${resource.owner}/${resource.repo}`
|
|
335
|
+
: undefined;
|
|
336
|
+
const number = "number" in resource ? resource.number : undefined;
|
|
337
|
+
if (fullName === undefined || number === undefined) {
|
|
338
|
+
throw new V2EngineError(
|
|
339
|
+
`v2: ${claim.type} claim requires repository and number`
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
return `cont:${formatConversationKey(claim.type, {
|
|
343
|
+
fullName,
|
|
344
|
+
number,
|
|
345
|
+
})}`;
|
|
273
346
|
}
|
|
274
|
-
return `cont:${formatConversationKey("thread", resource)}`;
|
|
275
|
-
}
|
|
276
|
-
const fullName =
|
|
277
|
-
"fullName" in resource
|
|
278
|
-
? resource.fullName
|
|
279
|
-
: `${resource.owner}/${resource.repo}`;
|
|
280
|
-
if (claim.type === "thread") {
|
|
281
|
-
throw new V2EngineError("v2: thread claim requires channelId and threadTs");
|
|
282
347
|
}
|
|
283
|
-
return `cont:${formatConversationKey(claim.type, {
|
|
284
|
-
fullName,
|
|
285
|
-
number: resource.number,
|
|
286
|
-
})}`;
|
|
287
348
|
}
|
|
288
349
|
|
|
289
350
|
export function handshakeContinuation(input: {
|
|
@@ -358,18 +419,16 @@ export function extractContinuation(
|
|
|
358
419
|
return extractSlack(payload);
|
|
359
420
|
case "origin-pr":
|
|
360
421
|
return extractOrigin(payload);
|
|
422
|
+
case "deployment":
|
|
423
|
+
return extractDeployment(payload);
|
|
361
424
|
}
|
|
362
425
|
}
|
|
363
426
|
|
|
364
427
|
/**
|
|
365
|
-
*
|
|
366
|
-
* `
|
|
367
|
-
*
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* Extract primitive used by the control plane (hosted
|
|
371
|
-
* `routeVerifiedIngressContinuation` and local
|
|
372
|
-
* `routeLocalIngressContinuation`). Channel adapters must not call this.
|
|
428
|
+
* CP mailbox stamp. Hosted `routeVerifiedIngressContinuation` and local
|
|
429
|
+
* `routeLocalIngressContinuation` call this; channel adapters must not.
|
|
430
|
+
* Membership miss or missing identity fields stamp `evt:` instead of
|
|
431
|
+
* joining the conversation index.
|
|
373
432
|
*/
|
|
374
433
|
export function stampMailboxContinuation(
|
|
375
434
|
identity: ContinuationIdentity,
|
|
@@ -533,15 +592,13 @@ function extractSlack(payload: unknown): string | undefined {
|
|
|
533
592
|
}
|
|
534
593
|
|
|
535
594
|
function extractOrigin(payload: unknown): string | undefined {
|
|
536
|
-
const record =
|
|
595
|
+
const record = originExtractRecord(payload);
|
|
537
596
|
if (record === undefined) {
|
|
538
597
|
return undefined;
|
|
539
598
|
}
|
|
540
599
|
const inner = asRecord(record.pullRequest) ?? asRecord(record.pull_request);
|
|
541
600
|
const number = positiveInt(inner?.number);
|
|
542
|
-
const repository =
|
|
543
|
-
asRecord(record.repository) ??
|
|
544
|
-
asRecord(asRecord(asRecord(record.event)?.payload)?.repository);
|
|
601
|
+
const repository = asRecord(record.repository) ?? asRecord(inner?.repository);
|
|
545
602
|
const fullName =
|
|
546
603
|
nonEmpty(asRecord(repository)?.fullName) ??
|
|
547
604
|
nonEmpty(asRecord(repository)?.full_name) ??
|
|
@@ -552,6 +609,33 @@ function extractOrigin(payload: unknown): string | undefined {
|
|
|
552
609
|
return `cont:${formatConversationKey("origin-pr", { fullName, number })}`;
|
|
553
610
|
}
|
|
554
611
|
|
|
612
|
+
/**
|
|
613
|
+
* Mailbox stores the Origin delivery envelope; local/hosted CP extract
|
|
614
|
+
* also accepts the compact `{ pullRequest, repository }` shape.
|
|
615
|
+
*/
|
|
616
|
+
function originExtractRecord(
|
|
617
|
+
payload: unknown
|
|
618
|
+
): Record<string, unknown> | undefined {
|
|
619
|
+
const record = asRecord(payload);
|
|
620
|
+
if (record === undefined) {
|
|
621
|
+
return undefined;
|
|
622
|
+
}
|
|
623
|
+
const nested = asRecord(asRecord(record.event)?.payload);
|
|
624
|
+
if (nested !== undefined && asRecord(record.pullRequest) === undefined) {
|
|
625
|
+
return nested;
|
|
626
|
+
}
|
|
627
|
+
return record;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function extractDeployment(payload: unknown): string | undefined {
|
|
631
|
+
const record = asRecord(payload);
|
|
632
|
+
const deploymentId = nonEmpty(record?.deploymentId);
|
|
633
|
+
if (deploymentId === undefined) {
|
|
634
|
+
return undefined;
|
|
635
|
+
}
|
|
636
|
+
return `cont:${formatConversationKey("deployment", { deploymentId })}`;
|
|
637
|
+
}
|
|
638
|
+
|
|
555
639
|
function githubFullName(payload: Record<string, unknown>): string | undefined {
|
|
556
640
|
const repository = asRecord(payload.repository);
|
|
557
641
|
return nonEmpty(repository?.full_name) ?? originFullName(repository);
|
|
@@ -564,6 +648,7 @@ function originFullName(
|
|
|
564
648
|
return undefined;
|
|
565
649
|
}
|
|
566
650
|
const owner =
|
|
651
|
+
nonEmpty(asRecord(repository.owner)?.slug) ??
|
|
567
652
|
nonEmpty(repository.owner) ??
|
|
568
653
|
nonEmpty(asRecord(repository.owner)?.login) ??
|
|
569
654
|
nonEmpty(asRecord(repository.owner)?.name);
|
|
@@ -37,6 +37,7 @@ import type { AgentProject, AgentProjectInfo } from "../types.js";
|
|
|
37
37
|
import {
|
|
38
38
|
applyAgentContinuationDefaults,
|
|
39
39
|
channelContinuationIdentity,
|
|
40
|
+
channelDeclaredEventTypes,
|
|
40
41
|
handshakeChannelContinuation,
|
|
41
42
|
} from "./continuation-channel.js";
|
|
42
43
|
import { CONTINUATION_SELECTORS } from "./continuation-identity.js";
|
|
@@ -95,8 +96,8 @@ export interface AgentDeployManifestDeclarations {
|
|
|
95
96
|
* Scope keys are installation config and are never extracted here.
|
|
96
97
|
* Omitted channel `continuation` is `/v1` (engine minting) unless the
|
|
97
98
|
* agent set `architecture: "v2"`, which stamps kind `/v2` defaults
|
|
98
|
-
* (`github.pr/v2`, `slack.thread/v2`, `origin.pr/v2
|
|
99
|
-
* selectors still override type.
|
|
99
|
+
* (`github.pr/v2`, `slack.thread/v2`, `origin.pr/v2`,
|
|
100
|
+
* `deployments.deployment/v2`). Per-channel selectors still override type.
|
|
100
101
|
*/
|
|
101
102
|
channels: Array<{
|
|
102
103
|
id: string;
|
|
@@ -141,14 +142,9 @@ export function buildAgentDeployManifest(
|
|
|
141
142
|
throw new Error(handshake.error);
|
|
142
143
|
}
|
|
143
144
|
const kind = channel.definition.meta?.kind;
|
|
144
|
-
const
|
|
145
|
-
const originEvents = channel.definition.meta?.originWebhookEvents;
|
|
145
|
+
const declaredEvents = channelDeclaredEventTypes(channel.definition.meta);
|
|
146
146
|
const eventTypes =
|
|
147
|
-
|
|
148
|
-
? [...githubEvents].sort()
|
|
149
|
-
: originEvents !== undefined
|
|
150
|
-
? [...originEvents].sort()
|
|
151
|
-
: undefined;
|
|
147
|
+
declaredEvents === undefined ? undefined : [...declaredEvents].sort();
|
|
152
148
|
return {
|
|
153
149
|
id: channel.id,
|
|
154
150
|
kind,
|
|
@@ -2311,6 +2311,9 @@ export function projectInfo(project: AgentProject): AgentProjectInfo {
|
|
|
2311
2311
|
if (meta?.originWebhookEvents !== undefined) {
|
|
2312
2312
|
info.originWebhookEvents = meta.originWebhookEvents;
|
|
2313
2313
|
}
|
|
2314
|
+
if (meta?.deploymentEventTypes !== undefined) {
|
|
2315
|
+
info.deploymentEventTypes = meta.deploymentEventTypes;
|
|
2316
|
+
}
|
|
2314
2317
|
if (meta?.slackChannelPosts !== undefined) {
|
|
2315
2318
|
info.slackChannelPosts = meta.slackChannelPosts;
|
|
2316
2319
|
}
|
|
@@ -21,8 +21,9 @@ export const PACKAGE_NAME = "@cursor/july";
|
|
|
21
21
|
export const LEGACY_PACKAGE_NAME = "@anysphere/agent-serve";
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Future public package name; aliased with the same
|
|
25
|
-
* as PACKAGE_NAME so the eventual rename keeps authored imports
|
|
24
|
+
* Future public package name; aliased with the same direct-to-running-dist
|
|
25
|
+
* semantics as PACKAGE_NAME so the eventual rename keeps authored imports
|
|
26
|
+
* on the CLI's module identity.
|
|
26
27
|
*/
|
|
27
28
|
export const AGENTKIT_PACKAGE_NAME = "@cursor/agentkit";
|
|
28
29
|
|
|
@@ -117,7 +118,7 @@ export function formatCliVersion(options?: { json?: boolean }): string {
|
|
|
117
118
|
* runtime mirror of the package `exports` map (the source of truth;
|
|
118
119
|
* `authored-loaders.test.ts` asserts they stay identical). The alias hooks
|
|
119
120
|
* derive `@anysphere/agent-serve[/x]`, `@cursor/july[/x]`, and
|
|
120
|
-
* `@cursor/agentkit[/x]` targets from this list.
|
|
121
|
+
* `@cursor/agentkit[/x]` direct targets from this list.
|
|
121
122
|
*/
|
|
122
123
|
export const AUTHORING_ENTRY_FILES: ReadonlyArray<
|
|
123
124
|
readonly [subpath: string, file: string]
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export const HOSTED_DELIVERY_PROTOCOL_VERSION = 2;
|
|
2
|
+
export const HOSTED_DELIVERY_HEADER = "x-agent-sdk-hosted-delivery";
|
|
3
|
+
export const HOSTED_ADMISSION_PATH = "/v1/internal/hosted-admission";
|
|
4
|
+
export const HOSTED_EXECUTION_PATH = "/v1/internal/hosted-execution";
|
|
5
|
+
|
|
6
|
+
export type HostedAdmission = {
|
|
7
|
+
v: 2;
|
|
8
|
+
channelId: string;
|
|
9
|
+
channelKind: "github";
|
|
10
|
+
eventType: string;
|
|
11
|
+
deliveryId: string;
|
|
12
|
+
sessionMode: "event" | "continuation";
|
|
13
|
+
mailboxContinuationKey: string;
|
|
14
|
+
payload: unknown;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type HostedAdmissionOutcome =
|
|
18
|
+
| { ok: true; v: 2; outcome: "skip" | "task" }
|
|
19
|
+
| { ok: true; v: 2; outcome: "send"; admissionToken: string };
|
|
20
|
+
|
|
21
|
+
export type HostedExecution = {
|
|
22
|
+
v: 2;
|
|
23
|
+
admissionToken: string;
|
|
24
|
+
sessionPublicId: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type HostedExecutionOutcome = {
|
|
28
|
+
ok: true;
|
|
29
|
+
v: 2;
|
|
30
|
+
outcome: "send";
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const DELIVERY_KEYS = new Set([
|
|
34
|
+
"v",
|
|
35
|
+
"channelId",
|
|
36
|
+
"channelKind",
|
|
37
|
+
"eventType",
|
|
38
|
+
"deliveryId",
|
|
39
|
+
"sessionMode",
|
|
40
|
+
"mailboxContinuationKey",
|
|
41
|
+
"payload",
|
|
42
|
+
]);
|
|
43
|
+
const EXECUTION_KEYS = new Set(["v", "admissionToken", "sessionPublicId"]);
|
|
44
|
+
|
|
45
|
+
function boundedString(value: unknown, max: number): value is string {
|
|
46
|
+
return typeof value === "string" && value.length > 0 && value.length <= max;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function parseHostedAdmission(
|
|
50
|
+
value: unknown
|
|
51
|
+
): HostedAdmission | undefined {
|
|
52
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const body = value as Record<string, unknown>;
|
|
56
|
+
if (
|
|
57
|
+
Object.keys(body).some((key) => !DELIVERY_KEYS.has(key)) ||
|
|
58
|
+
!Object.hasOwn(body, "payload") ||
|
|
59
|
+
body.v !== HOSTED_DELIVERY_PROTOCOL_VERSION ||
|
|
60
|
+
!boundedString(body.channelId, 128) ||
|
|
61
|
+
body.channelKind !== "github" ||
|
|
62
|
+
!boundedString(body.eventType, 128) ||
|
|
63
|
+
!boundedString(body.deliveryId, 256) ||
|
|
64
|
+
(body.sessionMode !== "event" && body.sessionMode !== "continuation") ||
|
|
65
|
+
!boundedString(body.mailboxContinuationKey, 512)
|
|
66
|
+
) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const prefix = body.sessionMode === "event" ? "evt:" : "cont:";
|
|
70
|
+
return body.mailboxContinuationKey.startsWith(prefix)
|
|
71
|
+
? (body as HostedAdmission)
|
|
72
|
+
: undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function parseHostedExecution(
|
|
76
|
+
value: unknown
|
|
77
|
+
): HostedExecution | undefined {
|
|
78
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
const body = value as Record<string, unknown>;
|
|
82
|
+
if (
|
|
83
|
+
Object.keys(body).some((key) => !EXECUTION_KEYS.has(key)) ||
|
|
84
|
+
body.v !== HOSTED_DELIVERY_PROTOCOL_VERSION ||
|
|
85
|
+
!boundedString(body.admissionToken, 128) ||
|
|
86
|
+
typeof body.sessionPublicId !== "string" ||
|
|
87
|
+
!/^ses_[a-f0-9]{24}$/.test(body.sessionPublicId)
|
|
88
|
+
) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
return body as HostedExecution;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function parseHostedAdmissionOutcome(
|
|
95
|
+
value: unknown
|
|
96
|
+
): HostedAdmissionOutcome | undefined {
|
|
97
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
const body = value as Record<string, unknown>;
|
|
101
|
+
if (
|
|
102
|
+
body.ok !== true ||
|
|
103
|
+
body.v !== HOSTED_DELIVERY_PROTOCOL_VERSION ||
|
|
104
|
+
(body.outcome !== "skip" &&
|
|
105
|
+
body.outcome !== "send" &&
|
|
106
|
+
body.outcome !== "task")
|
|
107
|
+
) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
if (body.outcome === "send" && !boundedString(body.admissionToken, 128)) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
return body as HostedAdmissionOutcome;
|
|
114
|
+
}
|