@cursor/july 0.1.107 → 0.1.109
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 +2 -6
- package/README.md +13 -11
- package/dist/bin/agent-serve.js +30 -8
- package/dist/channels/bitbucket/api.d.ts +41 -0
- package/dist/channels/bitbucket/api.d.ts.map +1 -1
- package/dist/channels/bitbucket/api.js +260 -0
- package/dist/channels/bitbucket/binding.d.ts +4 -0
- package/dist/channels/bitbucket/binding.d.ts.map +1 -1
- package/dist/channels/bitbucket/binding.js +16 -0
- package/dist/channels/bitbucket/index.d.ts +1 -1
- package/dist/channels/bitbucket/index.d.ts.map +1 -1
- package/dist/channels/bitbucket/index.js +1 -1
- package/dist/channels/github/github-channel.js +8 -5
- package/dist/channels/github/types.d.ts +5 -1
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/gitlab/api.d.ts +27 -0
- package/dist/channels/gitlab/api.d.ts.map +1 -1
- package/dist/channels/gitlab/api.js +88 -0
- package/dist/channels/gitlab/binding.d.ts +5 -0
- package/dist/channels/gitlab/binding.d.ts.map +1 -1
- package/dist/channels/gitlab/binding.js +10 -0
- package/dist/channels/gitlab/index.d.ts +1 -1
- package/dist/channels/gitlab/index.d.ts.map +1 -1
- package/dist/channels/gitlab/index.js +1 -1
- package/dist/channels/origin/origin-channel.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.js +27 -13
- package/dist/channels/origin/types.d.ts +5 -1
- package/dist/channels/origin/types.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.d.ts +10 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +20 -3
- package/dist/channels/slack/slack-channel.d.ts +12 -5
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +59 -8
- package/dist/channels.d.ts +45 -0
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js +106 -7
- package/dist/connections.d.ts +2 -1
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +2 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/assets/{app.CtuckIiL.js → app.Cr-wVbnB.js} +1 -1
- package/dist/docs/assets/{building-with-agents.md.CUSWxlP_.js → building-with-agents.md.D0KbSkJn.js} +2 -2
- package/dist/docs/assets/{building-with-agents.md.CUSWxlP_.lean.js → building-with-agents.md.D0KbSkJn.lean.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.CFVQ4S17.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.Bkkhnu8K.js → VPLocalSearchBox.CVQERt56.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DhpIe0Pa.js → theme.Dnsd3XOn.js} +2 -2
- package/dist/docs/assets/concepts.md.B4o63Gul.js +1 -0
- package/dist/docs/assets/{deployment.md.MFPKqsqI.js → deployment.md.JenwuCCB.js} +4 -4
- package/dist/docs/assets/{deployment.md.MFPKqsqI.lean.js → deployment.md.JenwuCCB.lean.js} +1 -1
- package/dist/docs/assets/evals.md.C7JLjoEP.js +211 -0
- package/dist/docs/assets/evals.md.C7JLjoEP.lean.js +1 -0
- package/dist/docs/assets/guides_bitbucket.md.DZPzmUjU.js +10 -0
- package/dist/docs/assets/guides_bitbucket.md.DZPzmUjU.lean.js +1 -0
- package/dist/docs/assets/guides_cloud-agents.md.BsloyHdY.js +9 -0
- package/dist/docs/assets/{guides_cloud-agents.md.DS8RIjwx.lean.js → guides_cloud-agents.md.BsloyHdY.lean.js} +1 -1
- package/dist/docs/assets/{guides_github.md.c0gdGJ-D.js → guides_github.md.TZaTZlfz.js} +13 -3
- package/dist/docs/assets/{guides_github.md.c0gdGJ-D.lean.js → guides_github.md.TZaTZlfz.lean.js} +1 -1
- package/dist/docs/assets/guides_gitlab.md.BmqwQfdG.js +14 -0
- package/dist/docs/assets/guides_gitlab.md.BmqwQfdG.lean.js +1 -0
- package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.js → guides_grokbot-agents.md.DyV-WArv.js} +1 -1
- package/dist/docs/assets/guides_improve.md.BGVk32bK.js +14 -0
- package/dist/docs/assets/guides_improve.md.BGVk32bK.lean.js +1 -0
- package/dist/docs/assets/{guides_slack.md.9oHPye9o.js → guides_slack.md.D4RVMM4G.js} +3 -3
- package/dist/docs/assets/{guides_slack.md.9oHPye9o.lean.js → guides_slack.md.D4RVMM4G.lean.js} +1 -1
- package/dist/docs/assets/{guides_webhooks.md.DKdA43Qm.js → guides_webhooks.md.CJK484ex.js} +2 -2
- package/dist/docs/assets/{hillclimbing.md.CpTGTCle.js → hillclimbing.md.BOiVo1tf.js} +1 -1
- package/dist/docs/assets/index.md.DD9Q2XuJ.js +5 -0
- package/dist/docs/assets/{index.md.BW_6tOgR.lean.js → index.md.DD9Q2XuJ.lean.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.js → reference_agent-config.md.CvoL6pof.js} +1 -1
- package/dist/docs/assets/{reference_channels.md.D-qTqwcq.js → reference_channels.md.CAo-iK4j.js} +2 -2
- package/dist/docs/assets/{reference_channels.md.D-qTqwcq.lean.js → reference_channels.md.CAo-iK4j.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.Dm67hd2D.js → reference_cli.md.Deg7849l.js} +7 -7
- package/dist/docs/assets/{reference_cli.md.Dm67hd2D.lean.js → reference_cli.md.Deg7849l.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.Di6jJAXF.js → reference_connections.md.BojkC6c5.js} +1 -1
- package/dist/docs/assets/{reference_extensions.md.CGmMLblt.js → reference_extensions.md.ZAVUyuEX.js} +3 -3
- package/dist/docs/assets/{reference_hooks.md.Ddt5DdgJ.js → reference_hooks.md.BlM_bOg6.js} +3 -3
- package/dist/docs/assets/{reference_hooks.md.Ddt5DdgJ.lean.js → reference_hooks.md.BlM_bOg6.lean.js} +1 -1
- package/dist/docs/assets/{reference_http-api.md.oySXBO8o.js → reference_http-api.md.BwaCo-VO.js} +1 -1
- package/dist/docs/assets/{reference_playground.md.4myJPxrf.js → reference_playground.md.DLnoaczX.js} +1 -1
- package/dist/docs/assets/{reference_playground.md.4myJPxrf.lean.js → reference_playground.md.DLnoaczX.lean.js} +1 -1
- package/dist/docs/assets/{reference_project-layout.md.DuBu9a96.js → reference_project-layout.md.BEU8MtQV.js} +3 -3
- package/dist/docs/assets/{reference_project-layout.md.DuBu9a96.lean.js → reference_project-layout.md.BEU8MtQV.lean.js} +1 -1
- package/dist/docs/assets/reference_sessions.md.CyXV1MUw.js +1 -0
- package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.js → scaffolding-agents.md.Kctn3OVb.js} +1 -1
- package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.js → skills_create-agent.md.Q3h6Je-e.js} +1 -1
- package/dist/docs/assets/{skills_debug.md.CDbPhHfg.js → skills_debug.md.CVjCXMFF.js} +1 -1
- package/dist/docs/assets/{skills_debug.md.CDbPhHfg.lean.js → skills_debug.md.CVjCXMFF.lean.js} +1 -1
- package/dist/docs/assets/skills_deploy.md.CWqi_ZxW.js +35 -0
- package/dist/docs/assets/skills_deploy.md.CWqi_ZxW.lean.js +1 -0
- package/dist/docs/assets/skills_evals.md.DFxYPErF.js +25 -0
- package/dist/docs/assets/skills_evals.md.DFxYPErF.lean.js +1 -0
- package/dist/docs/assets/skills_framework-map.md.BxLSOhSY.js +1 -0
- package/dist/docs/assets/{skills_framework-map.md.haibFyoB.lean.js → skills_framework-map.md.BxLSOhSY.lean.js} +1 -1
- package/dist/docs/assets/{skills_github.md.D0JahM8c.js → skills_github.md.hgFX_oKY.js} +1 -1
- package/dist/docs/assets/skills_index.md.DL7EHaQ-.js +1 -0
- package/dist/docs/assets/skills_index.md.DL7EHaQ-.lean.js +1 -0
- package/dist/docs/assets/{storage.md.BOHeqk2M.js → storage.md.BUrhJ-Zz.js} +4 -4
- package/dist/docs/assets/{storage.md.BOHeqk2M.lean.js → storage.md.BUrhJ-Zz.lean.js} +1 -1
- package/dist/docs/assets/troubleshooting.md.CYEAO9bM.js +1 -0
- package/dist/docs/building-with-agents.html +5 -5
- package/dist/docs/building-with-agents.md +3 -2
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/concepts.md +2 -4
- package/dist/docs/deployment.html +7 -7
- package/dist/docs/deployment.md +7 -2
- package/dist/docs/evals.html +161 -35
- package/dist/docs/evals.md +612 -296
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/bitbucket.html +36 -0
- package/dist/docs/guides/bitbucket.md +84 -0
- package/dist/docs/guides/cloud-agents.html +6 -6
- package/dist/docs/guides/cloud-agents.md +4 -3
- package/dist/docs/guides/convert-automation.html +4 -4
- package/dist/docs/guides/github.html +17 -7
- package/dist/docs/guides/github.md +33 -1
- package/dist/docs/guides/gitlab.html +40 -0
- package/dist/docs/guides/gitlab.md +92 -0
- package/dist/docs/guides/grokbot-agents.html +6 -6
- package/dist/docs/guides/grokbot-agents.md +2 -2
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/improve.html +40 -0
- package/dist/docs/guides/improve.md +91 -0
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +5 -5
- package/dist/docs/guides/slack.html +7 -7
- package/dist/docs/guides/slack.md +2 -1
- package/dist/docs/guides/webhooks.html +6 -6
- package/dist/docs/guides/webhooks.md +4 -2
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +6 -6
- package/dist/docs/hillclimbing.md +2 -2
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +14 -6
- package/dist/docs/llms-full.txt +1274 -814
- package/dist/docs/llms.txt +7 -5
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +6 -6
- package/dist/docs/reference/agent-config.md +5 -2
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +6 -6
- package/dist/docs/reference/channels.md +16 -3
- package/dist/docs/reference/cli.html +11 -11
- package/dist/docs/reference/cli.md +24 -15
- package/dist/docs/reference/connections.html +6 -6
- package/dist/docs/reference/connections.md +2 -1
- package/dist/docs/reference/extensions.html +8 -8
- package/dist/docs/reference/extensions.md +2 -3
- package/dist/docs/reference/hooks.html +7 -7
- package/dist/docs/reference/hooks.md +9 -12
- package/dist/docs/reference/http-api.html +6 -6
- package/dist/docs/reference/http-api.md +2 -3
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +5 -5
- package/dist/docs/reference/playground.md +0 -4
- package/dist/docs/reference/project-layout.html +7 -7
- package/dist/docs/reference/project-layout.md +1 -8
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/result.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +5 -5
- package/dist/docs/reference/sessions.md +1 -2
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/scaffolding-agents.md +2 -1
- package/dist/docs/skills/create-agent.html +6 -6
- package/dist/docs/skills/create-agent.md +1 -1
- package/dist/docs/skills/debug.html +5 -5
- package/dist/docs/skills/debug.md +1 -1
- package/dist/docs/skills/deploy.html +61 -0
- package/dist/docs/skills/deploy.md +161 -0
- package/dist/docs/skills/evals.html +8 -8
- package/dist/docs/skills/evals.md +44 -6
- package/dist/docs/skills/framework-map.html +5 -5
- package/dist/docs/skills/framework-map.md +5 -4
- package/dist/docs/skills/github.html +6 -6
- package/dist/docs/skills/github.md +1 -1
- package/dist/docs/skills/hillclimb.html +4 -4
- package/dist/docs/skills/index.html +6 -6
- package/dist/docs/skills/index.md +1 -1
- package/dist/docs/skills/mcp-auth.html +4 -4
- package/dist/docs/skills/otel.html +4 -4
- package/dist/docs/skills/setup-slack.html +4 -4
- package/dist/docs/storage.html +8 -8
- package/dist/docs/storage.md +15 -24
- package/dist/docs/templates/agentic-owners.html +4 -4
- package/dist/docs/templates/agents-md.html +4 -4
- package/dist/docs/templates/code-wiki.html +4 -4
- package/dist/docs/templates/demo.html +4 -4
- package/dist/docs/templates/grokbot-agents.html +4 -4
- package/dist/docs/templates/pr-autofixer.html +4 -4
- package/dist/docs/templates/security-help.html +4 -4
- 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 +1 -1
- package/dist/extensions/improve/extension.d.ts +46 -0
- package/dist/extensions/improve/extension.d.ts.map +1 -0
- package/dist/extensions/improve/extension.js +41 -0
- package/dist/extensions/improve/skills/yourself.d.ts +4 -0
- package/dist/extensions/improve/skills/yourself.d.ts.map +1 -0
- package/dist/extensions/improve/skills/yourself.js +43 -0
- package/dist/extensions.d.ts +2 -3
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +2 -5
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/internal/authored-alias-hooks.d.ts +5 -0
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
- package/dist/internal/authored-alias-hooks.js +17 -0
- package/dist/internal/authored-loaders.d.ts +4 -0
- package/dist/internal/authored-loaders.d.ts.map +1 -1
- package/dist/internal/authored-loaders.js +21 -2
- package/dist/internal/builtin-tools/artifacts.d.ts.map +1 -1
- package/dist/internal/builtin-tools/artifacts.js +2 -3
- package/dist/internal/channel-route-dispatch.d.ts +13 -0
- package/dist/internal/channel-route-dispatch.d.ts.map +1 -0
- package/dist/internal/channel-route-dispatch.js +62 -0
- package/dist/internal/channel-state.d.ts +17 -0
- package/dist/internal/channel-state.d.ts.map +1 -0
- package/dist/internal/channel-state.js +78 -0
- package/dist/internal/cli-ax.d.ts +8 -2
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +100 -3
- package/dist/internal/cli-cursor.d.ts.map +1 -1
- package/dist/internal/cli-cursor.js +2 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +38 -14
- package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
- package/dist/internal/cli-mcp-oauth.js +15 -0
- package/dist/internal/cli-mcp.d.ts.map +1 -1
- package/dist/internal/cli-mcp.js +12 -0
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +8 -2
- package/dist/internal/continuation-channel.d.ts.map +1 -1
- package/dist/internal/continuation-channel.js +2 -2
- package/dist/internal/continuation-identity.js +8 -3
- package/dist/internal/cursor/credentials.d.ts +8 -2
- package/dist/internal/cursor/credentials.d.ts.map +1 -1
- package/dist/internal/cursor/credentials.js +27 -5
- package/dist/internal/deploy-client.d.ts +27 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +32 -0
- package/dist/internal/deploy-manifest.d.ts +23 -0
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +84 -1
- package/dist/internal/describe-error.d.ts +1 -0
- package/dist/internal/describe-error.d.ts.map +1 -1
- package/dist/internal/describe-error.js +25 -0
- package/dist/internal/discovery/agent.d.ts +1 -1
- package/dist/internal/discovery/agent.d.ts.map +1 -1
- package/dist/internal/discovery/agent.js +0 -5
- package/dist/internal/discovery/extension-overlay.d.ts +1 -2
- package/dist/internal/discovery/extension-overlay.d.ts.map +1 -1
- package/dist/internal/discovery/extension-overlay.js +0 -14
- package/dist/internal/discovery/extensions.d.ts +1 -2
- package/dist/internal/discovery/extensions.d.ts.map +1 -1
- package/dist/internal/discovery/extensions.js +4 -22
- package/dist/internal/discovery/info.d.ts.map +1 -1
- package/dist/internal/discovery/info.js +42 -24
- package/dist/internal/discovery/modules.js +0 -1
- package/dist/internal/discovery/project.d.ts.map +1 -1
- package/dist/internal/discovery/project.js +0 -16
- package/dist/internal/eval-runner.js +0 -1
- package/dist/internal/framework-file-storage.d.ts +4 -5
- package/dist/internal/framework-file-storage.d.ts.map +1 -1
- package/dist/internal/framework-file-storage.js +4 -5
- package/dist/internal/framework-storage-selection.d.ts +2 -2
- package/dist/internal/framework-storage-selection.js +2 -2
- package/dist/internal/guest-network.d.ts +4 -10
- package/dist/internal/guest-network.d.ts.map +1 -1
- package/dist/internal/guest-network.js +42 -26
- package/dist/internal/hosted-admission-adapter.d.ts +2 -0
- package/dist/internal/hosted-admission-adapter.d.ts.map +1 -1
- package/dist/internal/hosted-catch-protocol.d.ts +51 -0
- package/dist/internal/hosted-catch-protocol.d.ts.map +1 -0
- package/dist/internal/hosted-catch-protocol.js +103 -0
- package/dist/internal/hosted-catch.d.ts +40 -0
- package/dist/internal/hosted-catch.d.ts.map +1 -0
- package/dist/internal/hosted-catch.js +149 -0
- package/dist/internal/hosted-delivery-protocol.d.ts +41 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.js +249 -0
- package/dist/internal/hosted-delivery.d.ts +10 -1
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +100 -22
- package/dist/internal/hosted-execution-diag.d.ts +4 -1
- package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
- package/dist/internal/hosted-execution-diag.js +13 -4
- package/dist/internal/hosted-execution-flush.d.ts +3 -0
- package/dist/internal/hosted-execution-flush.d.ts.map +1 -1
- package/dist/internal/hosted-execution-flush.js +2 -4
- package/dist/internal/http-control-plane-session.d.ts +30 -0
- package/dist/internal/http-control-plane-session.d.ts.map +1 -0
- package/dist/internal/http-control-plane-session.js +83 -0
- package/dist/internal/init-scaffold.d.ts.map +1 -1
- package/dist/internal/init-scaffold.js +1 -2
- package/dist/internal/install-cursor-skills.d.ts +5 -2
- package/dist/internal/install-cursor-skills.d.ts.map +1 -1
- package/dist/internal/install-cursor-skills.js +25 -5
- package/dist/internal/legacy-command-guard.d.ts +22 -0
- package/dist/internal/legacy-command-guard.d.ts.map +1 -0
- package/dist/internal/legacy-command-guard.js +51 -0
- package/dist/internal/platform-timers.d.ts +7 -0
- package/dist/internal/platform-timers.d.ts.map +1 -1
- package/dist/internal/platform-timers.js +139 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts +2 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -1
- package/dist/internal/reminder-control-plane-protocol.js +9 -2
- package/dist/internal/reminder-runner.d.ts +8 -0
- package/dist/internal/reminder-runner.d.ts.map +1 -1
- package/dist/internal/reminder-runner.js +36 -9
- package/dist/internal/resolve-prod-target.d.ts +2 -0
- package/dist/internal/resolve-prod-target.d.ts.map +1 -1
- package/dist/internal/resolve-prod-target.js +13 -0
- package/dist/internal/run-client.d.ts +1 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +5 -4
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +57 -70
- package/dist/internal/session-engine.d.ts +7 -41
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +110 -227
- package/dist/internal/storage-coordinator.d.ts +5 -19
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +3 -62
- package/dist/internal/storage-roles.d.ts +4 -9
- package/dist/internal/storage-roles.d.ts.map +1 -1
- package/dist/internal/storage-roles.js +2 -2
- package/dist/playground/assets/index-Bhxzrcf6.css +1 -0
- package/dist/playground/assets/index-CqLX5uF3.js +67 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted-v2.d.ts +4 -5
- package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted-v2.js +4 -5
- package/dist/storage-backends/cursor-hosted.d.ts +7 -2
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +29 -31
- package/dist/storage-backends/file-kv.d.ts +9 -12
- package/dist/storage-backends/file-kv.d.ts.map +1 -1
- package/dist/storage-backends/file-kv.js +11 -47
- package/dist/storage-protocol.d.ts +3 -11
- package/dist/storage-protocol.d.ts.map +1 -1
- package/dist/storage-protocol.js +3 -11
- package/dist/storage.d.ts +8 -36
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +8 -44
- package/dist/types.d.ts +53 -62
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +14 -6
- package/docs/building-with-agents.md +3 -2
- package/docs/concepts.md +2 -4
- package/docs/deployment.md +7 -2
- package/docs/evals.md +613 -297
- package/docs/guides/bitbucket.md +89 -0
- package/docs/guides/cloud-agents.md +4 -3
- package/docs/guides/github.md +33 -1
- package/docs/guides/gitlab.md +97 -0
- package/docs/guides/grokbot-agents.md +2 -2
- package/docs/guides/improve.md +96 -0
- package/docs/guides/slack.md +2 -1
- package/docs/guides/webhooks.md +4 -2
- package/docs/hillclimbing.md +2 -2
- package/docs/reference/agent-config.md +5 -2
- package/docs/reference/channels.md +16 -3
- package/docs/reference/cli.md +24 -15
- package/docs/reference/connections.md +2 -1
- package/docs/reference/extensions.md +2 -3
- package/docs/reference/hooks.md +9 -12
- package/docs/reference/http-api.md +2 -3
- package/docs/reference/playground.md +0 -4
- package/docs/reference/project-layout.md +1 -8
- package/docs/reference/sessions.md +1 -2
- package/docs/scaffolding-agents.md +2 -1
- package/docs/skills/index.md +2 -2
- package/docs/storage.md +15 -24
- package/docs/troubleshooting.md +1 -1
- package/package.json +8 -7
- package/skills/create-agent/SKILL.md +1 -1
- package/skills/debug/SKILL.md +1 -1
- package/skills/deploy/SKILL.md +169 -0
- package/skills/evals/SKILL.md +45 -8
- package/skills/framework-map/SKILL.md +5 -4
- package/skills/github/SKILL.md +1 -1
- package/src/bin/agent-serve.ts +27 -2
- package/src/channels/bitbucket/api.ts +341 -0
- package/src/channels/bitbucket/binding.ts +25 -0
- package/src/channels/bitbucket/index.ts +2 -0
- package/src/channels/github/github-channel.ts +8 -8
- package/src/channels/github/types.ts +5 -0
- package/src/channels/gitlab/api.ts +123 -0
- package/src/channels/gitlab/binding.ts +12 -0
- package/src/channels/gitlab/index.ts +1 -0
- package/src/channels/origin/origin-channel.ts +29 -13
- package/src/channels/origin/types.ts +5 -0
- package/src/channels/slack/dispatch.ts +30 -0
- package/src/channels/slack/slack-channel.ts +69 -7
- package/src/channels.ts +157 -10
- package/src/connections.ts +2 -1
- package/src/extensions/improve/extension.ts +70 -0
- package/src/extensions/improve/skills/yourself.ts +50 -0
- package/src/extensions.ts +2 -6
- package/src/index.ts +0 -3
- package/src/internal/authored-alias-hooks.ts +32 -0
- package/src/internal/authored-loaders.ts +26 -2
- package/src/internal/builtin-tools/artifacts.ts +2 -3
- package/src/internal/channel-route-dispatch.ts +66 -0
- package/src/internal/channel-state.ts +96 -0
- package/src/internal/cli-ax.ts +111 -3
- package/src/internal/cli-cursor.ts +4 -1
- package/src/internal/cli-deploy.ts +50 -10
- package/src/internal/cli-mcp-oauth.ts +18 -0
- package/src/internal/cli-mcp.ts +11 -0
- package/src/internal/cli-slack.ts +15 -2
- package/src/internal/continuation-channel.ts +2 -1
- package/src/internal/continuation-identity.ts +10 -2
- package/src/internal/cursor/credentials.ts +35 -7
- package/src/internal/deploy-client.ts +54 -0
- package/src/internal/deploy-manifest.ts +115 -1
- package/src/internal/describe-error.ts +28 -0
- package/src/internal/discovery/agent.ts +1 -7
- package/src/internal/discovery/extension-overlay.ts +0 -18
- package/src/internal/discovery/extensions.ts +2 -26
- package/src/internal/discovery/info.ts +3 -13
- package/src/internal/discovery/modules.ts +0 -1
- package/src/internal/discovery/project.ts +0 -16
- package/src/internal/eval-runner.ts +0 -1
- package/src/internal/framework-file-storage.ts +4 -5
- package/src/internal/framework-storage-selection.ts +2 -2
- package/src/internal/guest-network.ts +43 -29
- package/src/internal/hosted-admission-adapter.ts +2 -0
- package/src/internal/hosted-catch-protocol.ts +130 -0
- package/src/internal/hosted-catch.ts +192 -0
- package/src/internal/hosted-delivery-protocol.ts +387 -0
- package/src/internal/hosted-delivery.ts +155 -22
- package/src/internal/hosted-execution-diag.ts +21 -3
- package/src/internal/hosted-execution-flush.ts +6 -3
- package/src/internal/http-control-plane-session.ts +104 -0
- package/src/internal/init-scaffold.ts +1 -2
- package/src/internal/install-cursor-skills.ts +38 -5
- package/src/internal/legacy-command-guard.ts +59 -0
- package/src/internal/platform-timers.ts +191 -0
- package/src/internal/reminder-control-plane-protocol.ts +15 -2
- package/src/internal/reminder-runner.ts +60 -9
- package/src/internal/resolve-prod-target.ts +15 -0
- package/src/internal/run-client.ts +1 -1
- package/src/internal/sdk-runner.ts +3 -2
- package/src/internal/server.ts +89 -95
- package/src/internal/session-engine.ts +155 -285
- package/src/internal/storage-coordinator.ts +5 -76
- package/src/internal/storage-roles.ts +4 -9
- package/src/storage-backends/cursor-hosted-v2.ts +4 -7
- package/src/storage-backends/cursor-hosted.ts +40 -38
- package/src/storage-backends/file-kv.ts +10 -51
- package/src/storage-protocol.ts +3 -17
- package/src/storage.ts +10 -101
- package/src/types.ts +58 -62
- package/templates/demo/README.md +10 -6
- package/templates/demo/agent/channels/github.ts +2 -0
- package/templates/demo/agent/channels/queue.ts +6 -2
- package/templates/demo/agent/lib/repos.ts +5 -0
- package/templates/demo/init.json +25 -0
- package/dist/ab.d.ts +0 -209
- package/dist/ab.d.ts.map +0 -1
- package/dist/ab.js +0 -246
- package/dist/docs/ab.html +0 -80
- package/dist/docs/ab.md +0 -332
- package/dist/docs/assets/ab.md.mlVgqvSk.js +0 -54
- package/dist/docs/assets/ab.md.mlVgqvSk.lean.js +0 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DXXZxiMv.js +0 -1
- package/dist/docs/assets/concepts.md.DgEcZOfT.js +0 -1
- package/dist/docs/assets/evals.md.CbMoebP1.js +0 -85
- package/dist/docs/assets/evals.md.CbMoebP1.lean.js +0 -1
- package/dist/docs/assets/guides_cloud-agents.md.DS8RIjwx.js +0 -9
- package/dist/docs/assets/index.md.BW_6tOgR.js +0 -5
- package/dist/docs/assets/reference_sessions.md.CueyOHSL.js +0 -1
- package/dist/docs/assets/skills_ab.md.CsFNatVx.js +0 -26
- package/dist/docs/assets/skills_ab.md.CsFNatVx.lean.js +0 -1
- package/dist/docs/assets/skills_evals.md.723kpUmA.js +0 -25
- package/dist/docs/assets/skills_evals.md.723kpUmA.lean.js +0 -1
- package/dist/docs/assets/skills_framework-map.md.haibFyoB.js +0 -1
- package/dist/docs/assets/skills_index.md.DKwIxzGg.js +0 -1
- package/dist/docs/assets/skills_index.md.DKwIxzGg.lean.js +0 -1
- package/dist/docs/assets/troubleshooting.md.Cus_YZga.js +0 -1
- package/dist/docs/skills/ab.html +0 -52
- package/dist/docs/skills/ab.md +0 -50
- package/dist/internal/ab-collector.d.ts +0 -44
- package/dist/internal/ab-collector.d.ts.map +0 -1
- package/dist/internal/ab-collector.js +0 -142
- package/dist/internal/ab-fold.d.ts +0 -36
- package/dist/internal/ab-fold.d.ts.map +0 -1
- package/dist/internal/ab-fold.js +0 -175
- package/dist/internal/ab-snapshot.d.ts +0 -68
- package/dist/internal/ab-snapshot.d.ts.map +0 -1
- package/dist/internal/ab-snapshot.js +0 -208
- package/dist/internal/discovery/ab.d.ts +0 -9
- package/dist/internal/discovery/ab.d.ts.map +0 -1
- package/dist/internal/discovery/ab.js +0 -113
- package/dist/playground/assets/index-Bq2HpEQB.js +0 -67
- package/dist/playground/assets/index-CZKKNlmb.css +0 -1
- package/docs/ab.md +0 -337
- package/skills/ab/SKILL.md +0 -58
- package/src/ab.ts +0 -430
- package/src/internal/ab-collector.ts +0 -200
- package/src/internal/ab-fold.ts +0 -232
- package/src/internal/ab-snapshot.ts +0 -331
- package/src/internal/discovery/ab.ts +0 -131
- /package/dist/docs/assets/{concepts.md.DgEcZOfT.lean.js → concepts.md.B4o63Gul.lean.js} +0 -0
- /package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.lean.js → guides_grokbot-agents.md.DyV-WArv.lean.js} +0 -0
- /package/dist/docs/assets/{guides_webhooks.md.DKdA43Qm.lean.js → guides_webhooks.md.CJK484ex.lean.js} +0 -0
- /package/dist/docs/assets/{hillclimbing.md.CpTGTCle.lean.js → hillclimbing.md.BOiVo1tf.lean.js} +0 -0
- /package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.lean.js → reference_agent-config.md.CvoL6pof.lean.js} +0 -0
- /package/dist/docs/assets/{reference_connections.md.Di6jJAXF.lean.js → reference_connections.md.BojkC6c5.lean.js} +0 -0
- /package/dist/docs/assets/{reference_extensions.md.CGmMLblt.lean.js → reference_extensions.md.ZAVUyuEX.lean.js} +0 -0
- /package/dist/docs/assets/{reference_http-api.md.oySXBO8o.lean.js → reference_http-api.md.BwaCo-VO.lean.js} +0 -0
- /package/dist/docs/assets/{reference_sessions.md.CueyOHSL.lean.js → reference_sessions.md.CyXV1MUw.lean.js} +0 -0
- /package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.lean.js → scaffolding-agents.md.Kctn3OVb.lean.js} +0 -0
- /package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.lean.js → skills_create-agent.md.Q3h6Je-e.lean.js} +0 -0
- /package/dist/docs/assets/{skills_github.md.D0JahM8c.lean.js → skills_github.md.hgFX_oKY.lean.js} +0 -0
- /package/dist/docs/assets/{troubleshooting.md.Cus_YZga.lean.js → troubleshooting.md.CYEAO9bM.lean.js} +0 -0
|
@@ -11,19 +11,17 @@
|
|
|
11
11
|
* must never stall or fail a turn.
|
|
12
12
|
*
|
|
13
13
|
* Scaling shape: sessions reduce to keyed puts on the KV sink; eval runs
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* bounded, serialized queue.
|
|
14
|
+
* go to their dedicated `evals` table. Reminder documents live on the
|
|
15
|
+
* control plane. Everything shares one bounded, serialized queue.
|
|
17
16
|
*
|
|
18
17
|
* It does three unrelated jobs, declared separately as
|
|
19
18
|
* {@link FrameworkSessionStore}, {@link AuthorKvStore}, and
|
|
20
|
-
* {@link
|
|
19
|
+
* {@link EvalStore} — see `storage-roles.ts` for why they differ and where
|
|
21
20
|
* each is headed. The queue stays shared: it is one bounded, serialized chain
|
|
22
21
|
* per agent, and splitting it would change backpressure behavior, which this
|
|
23
22
|
* seam deliberately does not touch.
|
|
24
23
|
*/
|
|
25
24
|
|
|
26
|
-
import type { ABMetricSample } from "../ab.js";
|
|
27
25
|
import type { EvalRunSnapshot } from "../evals.js";
|
|
28
26
|
import {
|
|
29
27
|
type ResolvedStoragePolicy,
|
|
@@ -36,12 +34,11 @@ import {
|
|
|
36
34
|
} from "../storage.js";
|
|
37
35
|
import { isCursorHostedStorage } from "../storage-backends/cursor-hosted.js";
|
|
38
36
|
import type { JsonValue, SessionEvent, SessionRecord } from "../types.js";
|
|
39
|
-
import type { ABSnapshot } from "./ab-snapshot.js";
|
|
40
37
|
import { describeError } from "./describe-error.js";
|
|
41
38
|
import type { EvalRunStorage } from "./eval-run-store.js";
|
|
42
39
|
import type {
|
|
43
40
|
AuthorKvStore,
|
|
44
|
-
|
|
41
|
+
EvalStore,
|
|
45
42
|
FrameworkSessionStore,
|
|
46
43
|
} from "./storage-roles.js";
|
|
47
44
|
|
|
@@ -71,13 +68,6 @@ const CLOSE_DRAIN_TIMEOUT_MS = 10_000;
|
|
|
71
68
|
/** Debounced event batching flushes early past this many buffered events. */
|
|
72
69
|
const DEBOUNCE_MAX_BATCH = 200;
|
|
73
70
|
|
|
74
|
-
/**
|
|
75
|
-
* Aggregate A/B snapshots are refreshed at most this often — the
|
|
76
|
-
* playground polls `GET /v1/abs` every few seconds, and the snapshot is a
|
|
77
|
-
* convenience backfill, not a source of truth.
|
|
78
|
-
*/
|
|
79
|
-
const AB_SNAPSHOT_MIN_INTERVAL_MS = 60_000;
|
|
80
|
-
|
|
81
71
|
/** One queued sink call (KV put/delete or a dedicated-table write). */
|
|
82
72
|
interface StorageOp {
|
|
83
73
|
/** Human-readable op label for failure logs, e.g. `put({root}/...)`. */
|
|
@@ -114,7 +104,7 @@ function sessionRecordsOf(entries: readonly StorageEntry[]): SessionRecord[] {
|
|
|
114
104
|
}
|
|
115
105
|
|
|
116
106
|
export class StorageCoordinator
|
|
117
|
-
implements FrameworkSessionStore, AuthorKvStore,
|
|
107
|
+
implements FrameworkSessionStore, AuthorKvStore, EvalStore
|
|
118
108
|
{
|
|
119
109
|
readonly policy: ResolvedStoragePolicy;
|
|
120
110
|
|
|
@@ -136,7 +126,6 @@ export class StorageCoordinator
|
|
|
136
126
|
private pending = 0;
|
|
137
127
|
/** Ops dropped because the queue was full. */
|
|
138
128
|
private dropped = 0;
|
|
139
|
-
private lastAbSnapshotAt = 0;
|
|
140
129
|
private closed = false;
|
|
141
130
|
|
|
142
131
|
constructor(options: StorageCoordinatorOptions) {
|
|
@@ -559,66 +548,6 @@ export class StorageCoordinator
|
|
|
559
548
|
};
|
|
560
549
|
}
|
|
561
550
|
|
|
562
|
-
// ==========================================================================
|
|
563
|
-
// A/Bs (dedicated `abs` table)
|
|
564
|
-
// ==========================================================================
|
|
565
|
-
|
|
566
|
-
/** Append one metric sample to the `abs` table (no-op without it). */
|
|
567
|
-
abSample(sample: ABMetricSample): void {
|
|
568
|
-
const table = this.definition.abs;
|
|
569
|
-
if (this.closed || table === undefined) {
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
this.enqueue(
|
|
573
|
-
[
|
|
574
|
-
{
|
|
575
|
-
label: `abs.putSample(${sample.sessionId})`,
|
|
576
|
-
run: (ctx) => table.putSample(sample, ctx),
|
|
577
|
-
},
|
|
578
|
-
],
|
|
579
|
-
"policy"
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* Refresh the persisted aggregate A/B snapshot, throttled to once per
|
|
585
|
-
* {@link AB_SNAPSHOT_MIN_INTERVAL_MS} (the playground recomputes the
|
|
586
|
-
* fold on every `GET /v1/abs` poll). No-op without `abs.putSnapshot`.
|
|
587
|
-
*/
|
|
588
|
-
abSnapshot(snapshot: ABSnapshot): void {
|
|
589
|
-
const putSnapshot = this.definition.abs?.putSnapshot;
|
|
590
|
-
const now = Date.now();
|
|
591
|
-
if (
|
|
592
|
-
this.closed ||
|
|
593
|
-
putSnapshot === undefined ||
|
|
594
|
-
now - this.lastAbSnapshotAt < AB_SNAPSHOT_MIN_INTERVAL_MS
|
|
595
|
-
) {
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
this.lastAbSnapshotAt = now;
|
|
599
|
-
this.enqueue(
|
|
600
|
-
[{ label: "abs.putSnapshot", run: (ctx) => putSnapshot(snapshot, ctx) }],
|
|
601
|
-
"policy"
|
|
602
|
-
);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/** Latest persisted aggregate A/B snapshot; errors read as absent. */
|
|
606
|
-
async getLatestAbSnapshot(): Promise<ABSnapshot | undefined> {
|
|
607
|
-
const getSnapshot = this.definition.abs?.getSnapshot;
|
|
608
|
-
if (getSnapshot === undefined) {
|
|
609
|
-
return undefined;
|
|
610
|
-
}
|
|
611
|
-
try {
|
|
612
|
-
const value = await getSnapshot(this.context("restore"));
|
|
613
|
-
return value ?? undefined;
|
|
614
|
-
} catch (error) {
|
|
615
|
-
this.logger(
|
|
616
|
-
`[agent-sdk] storage abs.getSnapshot() failed: ${describeError(error)}`
|
|
617
|
-
);
|
|
618
|
-
return undefined;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
|
|
622
551
|
// ==========================================================================
|
|
623
552
|
// Delivery
|
|
624
553
|
// ==========================================================================
|
|
@@ -14,18 +14,16 @@
|
|
|
14
14
|
* - {@link AuthorKvStore} is author state: whatever `ctx.host.kv` was handed.
|
|
15
15
|
* It converges onto the author file plane, which is a different destination
|
|
16
16
|
* from the one above.
|
|
17
|
-
* - {@link
|
|
18
|
-
*
|
|
17
|
+
* - {@link EvalStore} is playground eval bookkeeping with its own dedicated
|
|
18
|
+
* table, and follows neither.
|
|
19
19
|
*
|
|
20
20
|
* Consumers should depend on the narrowest role they use. That is what keeps a
|
|
21
21
|
* later change to framework persistence from silently reaching author KV, and
|
|
22
22
|
* it is why these are interfaces rather than a comment on one class.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import type { ABMetricSample } from "../ab.js";
|
|
26
25
|
import type { StorageContext } from "../storage.js";
|
|
27
26
|
import type { JsonValue, SessionEvent, SessionRecord } from "../types.js";
|
|
28
|
-
import type { ABSnapshot } from "./ab-snapshot.js";
|
|
29
27
|
import type { EvalRunStorage } from "./eval-run-store.js";
|
|
30
28
|
|
|
31
29
|
/**
|
|
@@ -84,10 +82,7 @@ export interface AuthorKvStore {
|
|
|
84
82
|
kvDelete(authorKey: string): Promise<void>;
|
|
85
83
|
}
|
|
86
84
|
|
|
87
|
-
/** Playground eval batches
|
|
88
|
-
export interface
|
|
85
|
+
/** Playground eval batches, on their own table. */
|
|
86
|
+
export interface EvalStore {
|
|
89
87
|
evalRuns(): EvalRunStorage | undefined;
|
|
90
|
-
abSample(sample: ABMetricSample): void;
|
|
91
|
-
abSnapshot(snapshot: ABSnapshot): void;
|
|
92
|
-
getLatestAbSnapshot(): Promise<ABSnapshot | undefined>;
|
|
93
88
|
}
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
* pagination. `list` / `listKeys` below drain every page, so the v1
|
|
26
26
|
* truncated-scan failure mode does not exist here.
|
|
27
27
|
*
|
|
28
|
-
* Eval runs
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* Eval runs still ride the v1 storage proxy's dedicated table (`evals`
|
|
29
|
+
* below); moving them to factorydb is a separate follow-up from the KV
|
|
30
|
+
* cutover.
|
|
31
31
|
*
|
|
32
32
|
* This backend is platform-selected for architecture v2
|
|
33
33
|
* (framework-storage-selection.ts) — authors never import it; `agent/storage.ts`
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
import type {
|
|
38
|
-
StorageABTable,
|
|
39
38
|
StorageCasTable,
|
|
40
39
|
StorageConfig,
|
|
41
40
|
StorageEntry,
|
|
@@ -85,7 +84,6 @@ type CursorHostedStorageV2Methods = Required<
|
|
|
85
84
|
readonly [CURSOR_HOSTED_STORAGE]: true;
|
|
86
85
|
cas: StorageCasTable;
|
|
87
86
|
evals: StorageEvalsTable;
|
|
88
|
-
abs: StorageABTable;
|
|
89
87
|
};
|
|
90
88
|
|
|
91
89
|
function toCasResult(response: KvV2PutResponse): KvCasResult {
|
|
@@ -149,7 +147,7 @@ async function listAllPages(
|
|
|
149
147
|
export function cursorHostedStorageV2(
|
|
150
148
|
options: CursorHostedStorageOptions = {}
|
|
151
149
|
): CursorHostedStorageV2Methods {
|
|
152
|
-
// Eval runs
|
|
150
|
+
// Eval runs stay on the v1 proxy's dedicated table.
|
|
153
151
|
const v1 = cursorHostedStorage(options);
|
|
154
152
|
return {
|
|
155
153
|
[CURSOR_HOSTED_STORAGE]: true,
|
|
@@ -214,6 +212,5 @@ export function cursorHostedStorageV2(
|
|
|
214
212
|
},
|
|
215
213
|
},
|
|
216
214
|
evals: v1.evals,
|
|
217
|
-
abs: v1.abs,
|
|
218
215
|
};
|
|
219
216
|
}
|
|
@@ -22,11 +22,9 @@
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import type { ABSnapshot } from "../ab.js";
|
|
26
25
|
import type { EvalRunSnapshot } from "../evals.js";
|
|
27
26
|
import { injectActiveTraceContext } from "../otel.js";
|
|
28
27
|
import type {
|
|
29
|
-
StorageABTable,
|
|
30
28
|
StorageCasTable,
|
|
31
29
|
StorageConfig,
|
|
32
30
|
StorageEntry,
|
|
@@ -114,7 +112,6 @@ type CursorHostedStorageMethods = Required<
|
|
|
114
112
|
readonly [CURSOR_HOSTED_STORAGE]: true;
|
|
115
113
|
cas: StorageCasTable;
|
|
116
114
|
evals: StorageEvalsTable;
|
|
117
|
-
abs: StorageABTable;
|
|
118
115
|
};
|
|
119
116
|
|
|
120
117
|
// ============================================================================
|
|
@@ -169,6 +166,30 @@ export interface KvListKeysResponse {
|
|
|
169
166
|
truncated?: boolean;
|
|
170
167
|
}
|
|
171
168
|
|
|
169
|
+
const STORAGE_RPC_ERROR_CODES = new Set([
|
|
170
|
+
"agentsdk_kv_credential_missing",
|
|
171
|
+
"agentsdk_kv_cursor_invalid",
|
|
172
|
+
"agentsdk_kv_deployment_unbound",
|
|
173
|
+
"agentsdk_kv_key_invalid",
|
|
174
|
+
"agentsdk_kv_request_invalid",
|
|
175
|
+
"agentsdk_kv_storage_not_allowed",
|
|
176
|
+
"agentsdk_kv_value_invalid",
|
|
177
|
+
"agentsdk_kv_version_invalid",
|
|
178
|
+
]);
|
|
179
|
+
|
|
180
|
+
export class StorageRpcError extends Error {
|
|
181
|
+
readonly code = "agent_dependency_failed";
|
|
182
|
+
readonly reasonCode: string;
|
|
183
|
+
readonly status: number;
|
|
184
|
+
|
|
185
|
+
constructor(message: string, reasonCode: string, status: number) {
|
|
186
|
+
super(message);
|
|
187
|
+
this.name = "StorageRpcError";
|
|
188
|
+
this.reasonCode = reasonCode;
|
|
189
|
+
this.status = status;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
172
193
|
function toCasResult(response: KvCasResponse): KvCasResult {
|
|
173
194
|
if (response.ok) {
|
|
174
195
|
if (response.version === null) {
|
|
@@ -251,7 +272,22 @@ export async function storageRpc<T>(
|
|
|
251
272
|
typeof (parsed as { error: unknown }).error === "string"
|
|
252
273
|
? (parsed as { error: string }).error
|
|
253
274
|
: `HTTP ${response.status}`;
|
|
254
|
-
|
|
275
|
+
const candidate =
|
|
276
|
+
parsed !== null &&
|
|
277
|
+
typeof parsed === "object" &&
|
|
278
|
+
"code" in parsed &&
|
|
279
|
+
typeof (parsed as { code: unknown }).code === "string"
|
|
280
|
+
? (parsed as { code: string }).code
|
|
281
|
+
: undefined;
|
|
282
|
+
const code =
|
|
283
|
+
candidate !== undefined && STORAGE_RPC_ERROR_CODES.has(candidate)
|
|
284
|
+
? candidate
|
|
285
|
+
: "agentsdk_storage_http_error";
|
|
286
|
+
throw new StorageRpcError(
|
|
287
|
+
`cursorHostedStorage ${path}: ${error}`,
|
|
288
|
+
code,
|
|
289
|
+
response.status
|
|
290
|
+
);
|
|
255
291
|
}
|
|
256
292
|
return parsed as T;
|
|
257
293
|
}
|
|
@@ -378,39 +414,5 @@ export function cursorHostedStorage(
|
|
|
378
414
|
return result.runs;
|
|
379
415
|
},
|
|
380
416
|
},
|
|
381
|
-
abs: {
|
|
382
|
-
async putSample(sample, ctx): Promise<void> {
|
|
383
|
-
await storageRpc(
|
|
384
|
-
options,
|
|
385
|
-
"/internal/agent-serve/storage/abs/put-sample",
|
|
386
|
-
{
|
|
387
|
-
agentName: ctx.agentName,
|
|
388
|
-
sample,
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
},
|
|
392
|
-
async putSnapshot(snapshot, ctx): Promise<void> {
|
|
393
|
-
await storageRpc(
|
|
394
|
-
options,
|
|
395
|
-
"/internal/agent-serve/storage/abs/put-snapshot",
|
|
396
|
-
{
|
|
397
|
-
agentName: ctx.agentName,
|
|
398
|
-
snapshot,
|
|
399
|
-
}
|
|
400
|
-
);
|
|
401
|
-
},
|
|
402
|
-
async getSnapshot(ctx): Promise<ABSnapshot | undefined> {
|
|
403
|
-
const result = await storageRpc<{
|
|
404
|
-
found: boolean;
|
|
405
|
-
snapshot: ABSnapshot | null;
|
|
406
|
-
}>(options, "/internal/agent-serve/storage/abs/get-snapshot", {
|
|
407
|
-
agentName: ctx.agentName,
|
|
408
|
-
});
|
|
409
|
-
if (!result.found) {
|
|
410
|
-
return undefined;
|
|
411
|
-
}
|
|
412
|
-
return result.snapshot ?? undefined;
|
|
413
|
-
},
|
|
414
|
-
},
|
|
415
417
|
};
|
|
416
418
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* File-backed `defineStorage` helper: a file-per-key KV store plus
|
|
3
|
-
* file-backed `evals`
|
|
2
|
+
* File-backed `defineStorage` helper: a file-per-key KV store plus a
|
|
3
|
+
* file-backed `evals` table.
|
|
4
4
|
*
|
|
5
5
|
* Implements the whole `defineStorage` surface with zero external
|
|
6
6
|
* dependencies: the four KV methods against a flat directory of JSON files
|
|
7
7
|
* (one file per key, filename = URI-encoded key), the `cas`
|
|
8
8
|
* group (single-process conditional writes — see the `cas` member below),
|
|
9
|
-
* eval runs as
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* overwriting each other's history. Swap this for a real backend
|
|
16
|
-
* (Postgres, S3, …) in production; the contracts are identical.
|
|
9
|
+
* and eval runs as `eval-runs/<agent>/<runId>.json`. KV keys carry the
|
|
10
|
+
* agent name inside the framework key scheme, but the evals table has no
|
|
11
|
+
* such scheme — the agent subdirectory keeps agents sharing one storage
|
|
12
|
+
* `dir` from mixing or overwriting each other's history. Swap this for a
|
|
13
|
+
* real backend (Postgres, S3, …) in production; the contracts are
|
|
14
|
+
* identical.
|
|
17
15
|
*
|
|
18
16
|
* Layout notes:
|
|
19
17
|
* - KV filenames encode the full key (`encodeURIComponent(key) + ".json"`),
|
|
@@ -29,7 +27,6 @@
|
|
|
29
27
|
|
|
30
28
|
import { createHash, randomUUID } from "node:crypto";
|
|
31
29
|
import {
|
|
32
|
-
appendFile,
|
|
33
30
|
mkdir,
|
|
34
31
|
readdir,
|
|
35
32
|
readFile,
|
|
@@ -38,10 +35,8 @@ import {
|
|
|
38
35
|
writeFile,
|
|
39
36
|
} from "node:fs/promises";
|
|
40
37
|
import { isAbsolute, join } from "node:path";
|
|
41
|
-
import type { ABSnapshot } from "../ab.js";
|
|
42
38
|
import type { EvalRunSnapshot } from "../evals.js";
|
|
43
39
|
import type {
|
|
44
|
-
StorageABTable,
|
|
45
40
|
StorageCasTable,
|
|
46
41
|
StorageConfig,
|
|
47
42
|
StorageContext,
|
|
@@ -63,7 +58,6 @@ type FileKvMethods = Required<
|
|
|
63
58
|
> & {
|
|
64
59
|
cas: StorageCasTable;
|
|
65
60
|
evals: StorageEvalsTable;
|
|
66
|
-
abs: StorageABTable;
|
|
67
61
|
};
|
|
68
62
|
|
|
69
63
|
/** File-backed `defineStorage` methods, ready to spread into `defineStorage({...})`. */
|
|
@@ -72,12 +66,10 @@ export function fileKv(options?: FileKvOptions): FileKvMethods {
|
|
|
72
66
|
const dir = options?.dir ?? ".agent-serve/kv";
|
|
73
67
|
return isAbsolute(dir) ? dir : join(ctx.projectRoot, dir);
|
|
74
68
|
};
|
|
75
|
-
// The evals
|
|
76
|
-
//
|
|
69
|
+
// The evals table is scoped per agent (KV keys already carry the agent
|
|
70
|
+
// name via the framework key scheme).
|
|
77
71
|
const evalRunsDir = (ctx: StorageContext): string =>
|
|
78
72
|
join(resolveDir(ctx), "eval-runs", encodeURIComponent(ctx.agentName));
|
|
79
|
-
const abDir = (ctx: StorageContext): string =>
|
|
80
|
-
join(resolveDir(ctx), "ab", encodeURIComponent(ctx.agentName));
|
|
81
73
|
const filePath = (ctx: StorageContext, key: string): string =>
|
|
82
74
|
join(resolveDir(ctx), `${encodeURIComponent(key)}.json`);
|
|
83
75
|
const readRaw = async (
|
|
@@ -270,39 +262,6 @@ export function fileKv(options?: FileKvOptions): FileKvMethods {
|
|
|
270
262
|
return runs;
|
|
271
263
|
},
|
|
272
264
|
},
|
|
273
|
-
|
|
274
|
-
// A/B metrics: append-only sample log + latest aggregate snapshot,
|
|
275
|
-
// both under ab/<agent>/.
|
|
276
|
-
abs: {
|
|
277
|
-
async putSample(sample, ctx): Promise<void> {
|
|
278
|
-
const dir = abDir(ctx);
|
|
279
|
-
await mkdir(dir, { recursive: true });
|
|
280
|
-
await appendFile(
|
|
281
|
-
join(dir, "samples.ndjson"),
|
|
282
|
-
`${JSON.stringify(sample)}\n`,
|
|
283
|
-
"utf8"
|
|
284
|
-
);
|
|
285
|
-
},
|
|
286
|
-
async putSnapshot(snapshot, ctx): Promise<void> {
|
|
287
|
-
await writeJsonAtomic({
|
|
288
|
-
dir: abDir(ctx),
|
|
289
|
-
fileName: "snapshot.json",
|
|
290
|
-
value: snapshot,
|
|
291
|
-
});
|
|
292
|
-
},
|
|
293
|
-
async getSnapshot(ctx): Promise<ABSnapshot | undefined> {
|
|
294
|
-
try {
|
|
295
|
-
return JSON.parse(
|
|
296
|
-
await readFile(join(abDir(ctx), "snapshot.json"), "utf8")
|
|
297
|
-
) as ABSnapshot;
|
|
298
|
-
} catch (error) {
|
|
299
|
-
if ((error as NodeJS.ErrnoException).code === "ENOENT") {
|
|
300
|
-
return undefined;
|
|
301
|
-
}
|
|
302
|
-
throw error;
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
},
|
|
306
265
|
};
|
|
307
266
|
}
|
|
308
267
|
|
package/src/storage-protocol.ts
CHANGED
|
@@ -39,10 +39,9 @@ const DURABLE_SESSION_RECORD_KEY_RE =
|
|
|
39
39
|
* | `{root}/{agent}/continuation/{channelId}/{token}` | `{ sessionId }` |
|
|
40
40
|
* | `{root}/{agent}/kv/{key}` | Author JSON via `HostContext.kv` |
|
|
41
41
|
*
|
|
42
|
-
* The `eval-runs`
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* sees them.
|
|
42
|
+
* The `eval-runs` family is minted only by the table `defineStorage`
|
|
43
|
+
* derives over the KV core; a backend that authors a dedicated
|
|
44
|
+
* `StorageConfig.evals` group never sees it.
|
|
46
45
|
*/
|
|
47
46
|
function createStorageKeys(root: string) {
|
|
48
47
|
return {
|
|
@@ -94,19 +93,6 @@ function createStorageKeys(root: string) {
|
|
|
94
93
|
evalRun: (agent: string, runId: string): string =>
|
|
95
94
|
`${root}/${agent}/eval-runs/${keySegment(runId)}`,
|
|
96
95
|
evalRunsPrefix: (agent: string): string => `${root}/${agent}/eval-runs/`,
|
|
97
|
-
/**
|
|
98
|
-
* One A/B metric sample (derived `abs` table); the segments mirror the
|
|
99
|
-
* dedicated table's row identity (experiment + sessionId + at).
|
|
100
|
-
*/
|
|
101
|
-
abSample: (
|
|
102
|
-
agent: string,
|
|
103
|
-
experiment: string,
|
|
104
|
-
sessionId: string,
|
|
105
|
-
at: string
|
|
106
|
-
): string =>
|
|
107
|
-
`${root}/${agent}/ab-samples/${keySegment(experiment)}/${keySegment(sessionId)}/${keySegment(at)}`,
|
|
108
|
-
/** Latest aggregate A/B snapshot (derived `abs` table, LWW). */
|
|
109
|
-
abSnapshot: (agent: string): string => `${root}/${agent}/ab-snapshot`,
|
|
110
96
|
} as const;
|
|
111
97
|
}
|
|
112
98
|
|
package/src/storage.ts
CHANGED
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
* Author `agent/storage.ts` with {@link defineStorage} to mirror the
|
|
5
5
|
* framework's durable state into storage you own (a database, S3, a data
|
|
6
6
|
* pipeline, …). Without it, state lives under `--state-root` on local disk
|
|
7
|
-
* only, and eval
|
|
7
|
+
* only, and eval history stays in process memory.
|
|
8
8
|
*
|
|
9
9
|
* The sink is a plain key-value store — put/get/delete/list, no schema —
|
|
10
10
|
* plus a conditional-write group ({@link StorageConfig.cas}; optional).
|
|
11
11
|
* Implementing that small KV core is enough for
|
|
12
|
-
* FULL functionality: eval-run
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* not as required-or-lose-history hooks:
|
|
12
|
+
* FULL functionality: eval-run history is derived over the core when the
|
|
13
|
+
* optional dedicated table ({@link StorageConfig.evals}) is not authored —
|
|
14
|
+
* that group exists as a backend-native optimization (a real table, an
|
|
15
|
+
* analytics pipeline), not as a required-or-lose-history hook:
|
|
17
16
|
*
|
|
18
17
|
* ```ts
|
|
19
18
|
* import { defineStorage } from "@cursor/july/storage";
|
|
@@ -25,7 +24,6 @@
|
|
|
25
24
|
* list: (prefix) => db.listByPrefix(prefix), // [{ key, value }] in key order
|
|
26
25
|
* cas: { getWithVersion: ..., putIfAbsent: ..., putIfVersion: ..., listKeys: ... },
|
|
27
26
|
* evals: { put: ..., delete: ..., list: ... }, // eval-runs table
|
|
28
|
-
* abs: { putSample: ... }, // A/B table
|
|
29
27
|
* });
|
|
30
28
|
* ```
|
|
31
29
|
*
|
|
@@ -51,9 +49,7 @@
|
|
|
51
49
|
* interface is the durable mirror.
|
|
52
50
|
*/
|
|
53
51
|
|
|
54
|
-
import type { ABMetricSample } from "./ab.js";
|
|
55
52
|
import type { EvalRunSnapshot } from "./evals.js";
|
|
56
|
-
import type { ABSnapshot } from "./internal/ab-snapshot.js";
|
|
57
53
|
import { brandDefinition } from "./internal/brand.js";
|
|
58
54
|
import { storageKeys } from "./storage-protocol.js";
|
|
59
55
|
import type { JsonValue, KvCasResult, KvVersionedEntry } from "./types.js";
|
|
@@ -161,24 +157,6 @@ export interface StorageEvalsTable {
|
|
|
161
157
|
list(ctx: StorageContext): EvalRunSnapshot[] | Promise<EvalRunSnapshot[]>;
|
|
162
158
|
}
|
|
163
159
|
|
|
164
|
-
/**
|
|
165
|
-
* Dedicated table for live A/B metrics: one row per cumulative metric
|
|
166
|
-
* sample (unique per `experiment` + `sessionId` + `at` — one boundary
|
|
167
|
-
* event emits a sample per enrolled experiment), plus — optionally — the latest
|
|
168
|
-
* aggregate snapshot so a replacement host with no local sessions can
|
|
169
|
-
* still serve the A/Bs surface.
|
|
170
|
-
*/
|
|
171
|
-
export interface StorageABTable {
|
|
172
|
-
/** Append one cumulative metric sample (turn complete/fail). */
|
|
173
|
-
putSample(sample: ABMetricSample, ctx: StorageContext): void | Promise<void>;
|
|
174
|
-
/** Upsert the latest aggregate snapshot (framework-throttled). Optional. */
|
|
175
|
-
putSnapshot?(snapshot: ABSnapshot, ctx: StorageContext): void | Promise<void>;
|
|
176
|
-
/** Latest saved aggregate snapshot (replacement-host backfill). Optional. */
|
|
177
|
-
getSnapshot?(
|
|
178
|
-
ctx: StorageContext
|
|
179
|
-
): ABSnapshot | undefined | null | Promise<ABSnapshot | undefined | null>;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
160
|
/**
|
|
183
161
|
* Conditional writes (CAS) — the coordination tier of the storage backend
|
|
184
162
|
* contract. Plain storage works without it, so existing backends keep
|
|
@@ -186,9 +164,8 @@ export interface StorageABTable {
|
|
|
186
164
|
* it, so implementing this group yourself only comes up for BYO storage.
|
|
187
165
|
*
|
|
188
166
|
* Grouped under {@link StorageConfig.cas} rather than as loose methods —
|
|
189
|
-
* matching the `evals`
|
|
190
|
-
*
|
|
191
|
-
* half-implementation.
|
|
167
|
+
* matching the `evals` table group — so `defineStorage` validates the
|
|
168
|
+
* whole group at once: there is no meaningful half-implementation.
|
|
192
169
|
*
|
|
193
170
|
* Version tokens are opaque per-key strings that change on every
|
|
194
171
|
* successful write (counter, UUID, content hash — whatever is cheap for
|
|
@@ -234,14 +211,6 @@ export interface StorageConfig {
|
|
|
234
211
|
* memory (lost on restart).
|
|
235
212
|
*/
|
|
236
213
|
evals?: StorageEvalsTable;
|
|
237
|
-
/**
|
|
238
|
-
* Dedicated A/B table — a backend-native optimization, not a
|
|
239
|
-
* requirement. When omitted, `defineStorage` derives it over the KV
|
|
240
|
-
* core: `putSample` and `putSnapshot` need only core `put` (always
|
|
241
|
-
* present), `getSnapshot` additionally needs core `get`. Session event
|
|
242
|
-
* logs remain the assignment/fold source of truth either way.
|
|
243
|
-
*/
|
|
244
|
-
abs?: StorageABTable;
|
|
245
214
|
/**
|
|
246
215
|
* Conditional writes (CAS). Optional for plain storage — existing
|
|
247
216
|
* backends keep working without it. The built-in backends (`fileKv`,
|
|
@@ -260,7 +229,7 @@ export interface StorageConfig {
|
|
|
260
229
|
delete?(key: string, ctx: StorageContext): void | Promise<void>;
|
|
261
230
|
/**
|
|
262
231
|
* Point lookup. Optional — required for **lazy restore** (resolving a
|
|
263
|
-
* continuation token on a replacement host)
|
|
232
|
+
* continuation token on a replacement host).
|
|
264
233
|
* Return `undefined`/`null` only for a **definitive** miss: on the lazy
|
|
265
234
|
* restore path a throw propagates and fails the follow-up (retryable) —
|
|
266
235
|
* a store outage must not read as "unknown token", which would fork the
|
|
@@ -346,34 +315,16 @@ export function defineStorage(config: StorageConfig): StorageDefinition {
|
|
|
346
315
|
);
|
|
347
316
|
}
|
|
348
317
|
}
|
|
349
|
-
if (config.abs !== undefined) {
|
|
350
|
-
if (typeof config.abs.putSample !== "function") {
|
|
351
|
-
throw new Error(
|
|
352
|
-
"defineStorage: abs.putSample must be a function when the abs table is set"
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
for (const hook of ["putSnapshot", "getSnapshot"] as const) {
|
|
356
|
-
const value = config.abs[hook];
|
|
357
|
-
if (value !== undefined && typeof value !== "function") {
|
|
358
|
-
throw new Error(
|
|
359
|
-
`defineStorage: abs.${hook} must be a function when set`
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
318
|
// Validate eagerly so a bad policy fails at discovery, not first flush.
|
|
365
319
|
resolveStoragePolicy(config.policy);
|
|
366
320
|
// A backend that implements only the KV core gets full functionality:
|
|
367
|
-
// the dedicated
|
|
368
|
-
// the core when absent.
|
|
321
|
+
// the dedicated table is a backend-native optimization, derived over
|
|
322
|
+
// the core when absent. An authored group always wins.
|
|
369
323
|
const derivedEvals =
|
|
370
324
|
config.evals === undefined ? deriveEvalsTable(config) : undefined;
|
|
371
|
-
const derivedAbs =
|
|
372
|
-
config.abs === undefined ? deriveAbsTable(config) : undefined;
|
|
373
325
|
return brandDefinition("storage", {
|
|
374
326
|
...config,
|
|
375
327
|
...(derivedEvals === undefined ? {} : { evals: derivedEvals }),
|
|
376
|
-
...(derivedAbs === undefined ? {} : { abs: derivedAbs }),
|
|
377
328
|
});
|
|
378
329
|
}
|
|
379
330
|
|
|
@@ -408,48 +359,6 @@ function deriveEvalsTable(
|
|
|
408
359
|
};
|
|
409
360
|
}
|
|
410
361
|
|
|
411
|
-
/**
|
|
412
|
-
* A/B table over the KV core. Each sample lands as its own key (identity
|
|
413
|
-
* = experiment + sessionId + at, matching the dedicated table's row
|
|
414
|
-
* uniqueness): appending to one array value would need read-modify-write
|
|
415
|
-
* — lost updates under concurrent writers without CAS, and unbounded
|
|
416
|
-
* value growth — while a key per sample keeps `putSample` a blind put
|
|
417
|
-
* with real append-only semantics. The aggregate snapshot lives at one
|
|
418
|
-
* fixed key via plain `put` (last-write-wins is correct for "latest").
|
|
419
|
-
* Requires only core `put`; `getSnapshot` is included when core `get`
|
|
420
|
-
* exists.
|
|
421
|
-
*/
|
|
422
|
-
function deriveAbsTable(config: StorageConfig): StorageABTable {
|
|
423
|
-
const get = config.get;
|
|
424
|
-
return {
|
|
425
|
-
putSample: (sample, ctx) =>
|
|
426
|
-
config.put(
|
|
427
|
-
storageKeys.abSample(
|
|
428
|
-
ctx.agentName,
|
|
429
|
-
sample.experiment,
|
|
430
|
-
sample.sessionId,
|
|
431
|
-
sample.at
|
|
432
|
-
),
|
|
433
|
-
sample as unknown as JsonValue,
|
|
434
|
-
ctx
|
|
435
|
-
),
|
|
436
|
-
putSnapshot: (snapshot, ctx) =>
|
|
437
|
-
config.put(
|
|
438
|
-
storageKeys.abSnapshot(ctx.agentName),
|
|
439
|
-
snapshot as unknown as JsonValue,
|
|
440
|
-
ctx
|
|
441
|
-
),
|
|
442
|
-
...(get === undefined
|
|
443
|
-
? {}
|
|
444
|
-
: {
|
|
445
|
-
getSnapshot: async (ctx: StorageContext) => {
|
|
446
|
-
const value = await get(storageKeys.abSnapshot(ctx.agentName), ctx);
|
|
447
|
-
return (value ?? undefined) as ABSnapshot | undefined;
|
|
448
|
-
},
|
|
449
|
-
}),
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
|
|
453
362
|
// ============================================================================
|
|
454
363
|
// Policy resolution
|
|
455
364
|
// ============================================================================
|