@cursor/july 0.1.34 → 0.1.36
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 +5 -9
- package/README.md +5 -9
- package/dist/channels/github/github-channel.d.ts +1 -1
- package/dist/channels/github/github-channel.js +1 -1
- package/dist/channels/github/index.d.ts +1 -1
- package/dist/channels/github/index.js +1 -1
- package/dist/channels/slack/index.d.ts +1 -1
- package/dist/channels/slack/index.js +1 -1
- package/dist/channels/slack/init.d.ts.map +1 -1
- package/dist/channels/slack/init.js +2 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +8 -17
- package/dist/docs/assets/{ab.md.DAQoJ-up.js → ab.md.6cLOW7--.js} +4 -13
- package/dist/docs/assets/{ab.md.DAQoJ-up.lean.js → ab.md.6cLOW7--.lean.js} +1 -1
- package/dist/docs/assets/{app.FPupl4SP.js → app.DEcxy4oz.js} +1 -1
- package/dist/docs/assets/{building-with-agents.md.CnHqvYDd.js → building-with-agents.md.txrcGU2B.js} +2 -2
- package/dist/docs/assets/chunks/@localSearchIndexroot.ByFYcFly.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.Cd182Cu0.js → VPLocalSearchBox.n1VOZcy3.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BEM3Okcd.js → theme.BaF1MQ9c.js} +2 -2
- package/dist/docs/assets/{concepts.md.DFaQEFkA.js → concepts.md.CqOsxbMU.js} +1 -1
- package/dist/docs/assets/{deployment.md.9MYBuKM1.js → deployment.md.CuK5SNjN.js} +1 -1
- package/dist/docs/assets/{evals.md.BIUoVZ6X.js → evals.md.BQXI3rXy.js} +9 -15
- package/dist/docs/assets/{evals.md.BIUoVZ6X.lean.js → evals.md.BQXI3rXy.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_approval-buddy.md.BhEfleVx.js → example-agents_approval-buddy.md.CIiZ9coo.js} +1 -1
- package/dist/docs/assets/{example-agents_benny.md.2Et1qa8f.js → example-agents_benny.md.l7JTmm8X.js} +1 -1
- package/dist/docs/assets/{example-agents_bugbot.md.ByUexi5i.js → example-agents_bugbot.md.Dp5JqHSQ.js} +2 -2
- package/dist/docs/assets/{example-agents_bugbot.md.ByUexi5i.lean.js → example-agents_bugbot.md.Dp5JqHSQ.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_codebase-wiki.md.B4y-7ZVW.js → example-agents_codebase-wiki.md.D-lteFf0.js} +1 -1
- package/dist/docs/assets/{example-agents_codebase-wiki.md.B4y-7ZVW.lean.js → example-agents_codebase-wiki.md.D-lteFf0.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_codeowners-review.md.D6ay4nvf.js → example-agents_codeowners-review.md.BU2ZXLf-.js} +1 -1
- package/dist/docs/assets/{example-agents_codeowners-review.md.D6ay4nvf.lean.js → example-agents_codeowners-review.md.BU2ZXLf-.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_concierge.md.lL8rhYlj.js → example-agents_concierge.md.DA2al_NK.js} +2 -2
- package/dist/docs/assets/{example-agents_concierge.md.lL8rhYlj.lean.js → example-agents_concierge.md.DA2al_NK.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_fsd.md.DfNKQTHz.js → example-agents_fsd.md.DPz9ezO4.js} +1 -1
- package/dist/docs/assets/{example-agents_knowledge-base.md.CzyZ2DCr.js → example-agents_knowledge-base.md.IneynQSR.js} +1 -1
- package/dist/docs/assets/{example-agents_oncall.md.wFFXXEyW.js → example-agents_oncall.md.ZE0n6ZFN.js} +1 -1
- package/dist/docs/assets/{example-agents_slack-agent.md.DvgvT4nn.js → example-agents_slack-agent.md.06jQXTAI.js} +1 -1
- package/dist/docs/assets/{example-agents_weather-agent.md.BADkPqxQ.js → example-agents_weather-agent.md.CrGZ0SqR.js} +3 -3
- package/dist/docs/assets/{example-agents_weather-agent.md.BADkPqxQ.lean.js → example-agents_weather-agent.md.CrGZ0SqR.lean.js} +1 -1
- package/dist/docs/assets/guides_cloud-runtime.md.V5igN4Sq.js +9 -0
- package/dist/docs/assets/guides_cloud-runtime.md.V5igN4Sq.lean.js +1 -0
- package/dist/docs/assets/{guides_webhooks.md.DiAwSR42.js → guides_webhooks.md.BERuBSJW.js} +1 -1
- package/dist/docs/assets/{hillclimbing.md.D9Y1_bYh.js → hillclimbing.md.yXqdlv2R.js} +1 -1
- package/dist/docs/assets/index.md.CmhptOmN.js +24 -0
- package/dist/docs/assets/{index.md.CZqbBJPB.lean.js → index.md.CmhptOmN.lean.js} +1 -1
- package/dist/docs/assets/{quickstart.md.TnEXYgYW.js → quickstart.md.C_b6ESpD.js} +7 -4
- package/dist/docs/assets/{quickstart.md.TnEXYgYW.lean.js → quickstart.md.C_b6ESpD.lean.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.kuN6-OxK.js → reference_agent-config.md.CRmkoxd6.js} +6 -4
- package/dist/docs/assets/{reference_agent-config.md.kuN6-OxK.lean.js → reference_agent-config.md.CRmkoxd6.lean.js} +1 -1
- package/dist/docs/assets/reference_artifacts.md.BGG4bZo-.js +19 -0
- package/dist/docs/assets/reference_artifacts.md.BGG4bZo-.lean.js +1 -0
- package/dist/docs/assets/{reference_channels.md.CDhTRfUz.js → reference_channels.md.BIabFUAI.js} +2 -2
- package/dist/docs/assets/{reference_channels.md.CDhTRfUz.lean.js → reference_channels.md.BIabFUAI.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.sD-IUWjg.js → reference_cli.md.Byvrg8eu.js} +15 -9
- package/dist/docs/assets/{reference_cli.md.sD-IUWjg.lean.js → reference_cli.md.Byvrg8eu.lean.js} +1 -1
- package/dist/docs/assets/{reference_hooks.md.DyLVfE1O.js → reference_hooks.md.BGDw4VLm.js} +2 -2
- package/dist/docs/assets/{reference_hooks.md.DyLVfE1O.lean.js → reference_hooks.md.BGDw4VLm.lean.js} +1 -1
- package/dist/docs/assets/reference_http-api.md.DGrw_wOu.js +11 -0
- package/dist/docs/assets/reference_http-api.md.DGrw_wOu.lean.js +1 -0
- package/dist/docs/assets/{reference_project-layout.md.D8E6ZmHJ.js → reference_project-layout.md._XdeMahr.js} +2 -2
- package/dist/docs/assets/{reference_project-layout.md.D8E6ZmHJ.lean.js → reference_project-layout.md._XdeMahr.lean.js} +1 -1
- package/dist/docs/assets/{reference_sessions.md.C_ouF_uf.js → reference_sessions.md.DBVFi2Sx.js} +2 -2
- package/dist/docs/assets/{reference_subagents.md.zWAMNfi1.js → reference_subagents.md.DSrGLIuB.js} +2 -2
- package/dist/docs/assets/{reference_subagents.md.zWAMNfi1.lean.js → reference_subagents.md.DSrGLIuB.lean.js} +1 -1
- package/dist/docs/assets/{reference_tools.md.BswAQM41.js → reference_tools.md.lSrsTxYJ.js} +4 -4
- package/dist/docs/assets/{reference_tools.md.BswAQM41.lean.js → reference_tools.md.lSrsTxYJ.lean.js} +1 -1
- package/dist/docs/assets/scaffolding-agents.md.mkc3B_ZW.js +1 -0
- package/dist/docs/assets/{scaffolding-agents.md.Bsr9Pwzu.lean.js → scaffolding-agents.md.mkc3B_ZW.lean.js} +1 -1
- package/dist/docs/assets/{storage.md.xZoiGM58.js → storage.md.mQDtIULc.js} +3 -3
- package/dist/docs/assets/{storage.md.xZoiGM58.lean.js → storage.md.mQDtIULc.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +6 -6
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/deployment.html +6 -6
- package/dist/docs/evals.html +13 -19
- package/dist/docs/example-agents/approval-buddy.html +5 -5
- package/dist/docs/example-agents/benny.html +5 -5
- package/dist/docs/example-agents/bugbot.html +5 -5
- package/dist/docs/example-agents/codebase-wiki.html +5 -5
- package/dist/docs/example-agents/codeowners-review.html +5 -5
- package/dist/docs/example-agents/concierge.html +6 -6
- package/dist/docs/example-agents/fsd.html +5 -5
- package/dist/docs/example-agents/index.html +4 -4
- package/dist/docs/example-agents/knowledge-base.html +5 -5
- package/dist/docs/example-agents/oncall.html +5 -5
- package/dist/docs/example-agents/security-reviewer.html +4 -4
- package/dist/docs/example-agents/slack-agent.html +5 -5
- package/dist/docs/example-agents/weather-agent.html +6 -6
- package/dist/docs/guides/agent-to-agent.html +5 -5
- package/dist/docs/guides/cloud-runtime.html +6 -6
- package/dist/docs/guides/github.html +4 -4
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +5 -5
- package/dist/docs/guides/slack.html +4 -4
- package/dist/docs/guides/webhooks.html +6 -6
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +6 -6
- package/dist/docs/index.html +11 -7
- package/dist/docs/quickstart.html +10 -7
- package/dist/docs/reference/agent-config.html +10 -8
- package/dist/docs/reference/artifacts.html +43 -0
- package/dist/docs/reference/channels.html +6 -6
- package/dist/docs/reference/cli.html +18 -12
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/hooks.html +6 -6
- package/dist/docs/reference/http-api.html +7 -7
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +6 -6
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +7 -7
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +6 -6
- package/dist/docs/reference/tools.html +7 -7
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/storage.html +6 -6
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/files-backends/agent-store-presigned-url.d.ts.map +1 -1
- package/dist/files-backends/agent-store-presigned-url.js +15 -22
- package/dist/internal/cli-github.d.ts.map +1 -1
- package/dist/internal/cli-github.js +8 -7
- package/dist/internal/cli-slack.js +9 -9
- package/dist/internal/event-mapper.d.ts +3 -3
- package/dist/internal/event-mapper.d.ts.map +1 -1
- package/dist/internal/event-mapper.js +7 -4
- package/dist/internal/host-kv.d.ts +6 -2
- package/dist/internal/host-kv.d.ts.map +1 -1
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +15 -6
- package/dist/internal/storage-coordinator.d.ts +9 -1
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +7 -0
- package/dist/internal/storage-roles.d.ts +78 -0
- package/dist/internal/storage-roles.d.ts.map +1 -0
- package/dist/internal/storage-roles.js +24 -0
- package/dist/internal/workspace.d.ts +28 -0
- package/dist/internal/workspace.d.ts.map +1 -1
- package/dist/internal/workspace.js +57 -0
- package/dist/playground/assets/{index-CDDWw0YX.js → index-DOnKC85G.js} +40 -40
- package/dist/playground/assets/index-DoQjqj5w.css +1 -0
- package/dist/playground/index.html +2 -2
- package/docs/README.md +32 -13
- package/docs/ab.md +23 -36
- package/docs/building-with-agents.md +2 -2
- package/docs/concepts.md +3 -2
- package/docs/deployment.md +1 -1
- package/docs/evals.md +102 -33
- package/docs/example-agents/approval-buddy.md +2 -1
- package/docs/example-agents/benny.md +2 -0
- package/docs/example-agents/bugbot.md +3 -0
- package/docs/example-agents/codebase-wiki.md +2 -0
- package/docs/example-agents/codeowners-review.md +2 -0
- package/docs/example-agents/concierge.md +1 -0
- package/docs/example-agents/fsd.md +1 -0
- package/docs/example-agents/knowledge-base.md +2 -0
- package/docs/example-agents/oncall.md +2 -0
- package/docs/example-agents/slack-agent.md +1 -0
- package/docs/example-agents/weather-agent.md +9 -4
- package/docs/guides/cloud-runtime.md +11 -4
- package/docs/guides/webhooks.md +1 -1
- package/docs/hillclimbing.md +1 -1
- package/docs/quickstart.md +39 -7
- package/docs/reference/agent-config.md +74 -14
- package/docs/reference/artifacts.md +117 -0
- package/docs/reference/channels.md +45 -15
- package/docs/reference/cli.md +141 -20
- package/docs/reference/hooks.md +11 -4
- package/docs/reference/http-api.md +50 -4
- package/docs/reference/project-layout.md +6 -0
- package/docs/reference/sessions.md +5 -4
- package/docs/reference/subagents.md +5 -3
- package/docs/reference/tools.md +23 -7
- package/docs/scaffolding-agents.md +11 -2
- package/docs/storage.md +27 -2
- package/package.json +1 -1
- package/src/channels/github/github-channel.ts +1 -1
- package/src/channels/github/index.ts +1 -1
- package/src/channels/slack/index.ts +1 -1
- package/src/channels/slack/init.ts +2 -1
- package/src/files-backends/agent-store-presigned-url.ts +2 -1
- package/src/internal/cli-github.ts +8 -7
- package/src/internal/cli-slack.ts +9 -9
- package/src/internal/event-mapper.ts +9 -4
- package/src/internal/host-kv.ts +6 -2
- package/src/internal/session-engine.ts +20 -8
- package/src/internal/storage-coordinator.ts +15 -1
- package/src/internal/storage-roles.ts +86 -0
- package/src/internal/workspace.ts +66 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.WoYunhnT.js +0 -1
- package/dist/docs/assets/guides_cloud-runtime.md.CDJGvVC4.js +0 -9
- package/dist/docs/assets/guides_cloud-runtime.md.CDJGvVC4.lean.js +0 -1
- package/dist/docs/assets/index.md.CZqbBJPB.js +0 -20
- package/dist/docs/assets/reference_http-api.md.CfVM_ICa.js +0 -11
- package/dist/docs/assets/reference_http-api.md.CfVM_ICa.lean.js +0 -1
- package/dist/docs/assets/scaffolding-agents.md.Bsr9Pwzu.js +0 -1
- package/dist/playground/assets/index-MVuNTd8v.css +0 -1
- /package/dist/docs/assets/{building-with-agents.md.CnHqvYDd.lean.js → building-with-agents.md.txrcGU2B.lean.js} +0 -0
- /package/dist/docs/assets/{concepts.md.DFaQEFkA.lean.js → concepts.md.CqOsxbMU.lean.js} +0 -0
- /package/dist/docs/assets/{deployment.md.9MYBuKM1.lean.js → deployment.md.CuK5SNjN.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_approval-buddy.md.BhEfleVx.lean.js → example-agents_approval-buddy.md.CIiZ9coo.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_benny.md.2Et1qa8f.lean.js → example-agents_benny.md.l7JTmm8X.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_fsd.md.DfNKQTHz.lean.js → example-agents_fsd.md.DPz9ezO4.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_knowledge-base.md.CzyZ2DCr.lean.js → example-agents_knowledge-base.md.IneynQSR.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_oncall.md.wFFXXEyW.lean.js → example-agents_oncall.md.ZE0n6ZFN.lean.js} +0 -0
- /package/dist/docs/assets/{example-agents_slack-agent.md.DvgvT4nn.lean.js → example-agents_slack-agent.md.06jQXTAI.lean.js} +0 -0
- /package/dist/docs/assets/{guides_webhooks.md.DiAwSR42.lean.js → guides_webhooks.md.BERuBSJW.lean.js} +0 -0
- /package/dist/docs/assets/{hillclimbing.md.D9Y1_bYh.lean.js → hillclimbing.md.yXqdlv2R.lean.js} +0 -0
- /package/dist/docs/assets/{reference_sessions.md.C_ouF_uf.lean.js → reference_sessions.md.DBVFi2Sx.lean.js} +0 -0
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* root is a barrel over the whole library, and bundling through it inlines
|
|
6
6
|
* every module the barrel can reach (sync engine, local sqlite index, secure
|
|
7
7
|
* open) into the published tarball. This module has no imports of its own, so
|
|
8
|
-
* the bundle stays limited to the validator.
|
|
8
|
+
* the bundle stays limited to the validator. The bundler resolves that entry
|
|
9
|
+
* via the `anysphere-source` export so it does not need a prebuilt `dist/`.
|
|
9
10
|
*/
|
|
10
11
|
export { createAgentStorePresignedUrlValidatorForBackend } from "@anysphere/agent-store-sync/presigned-url";
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
synthesizeGitHubEvent,
|
|
43
43
|
} from "../channels/github/replay.js";
|
|
44
44
|
import { resolveAgentMounts } from "./discovery.js";
|
|
45
|
+
import { CLI_COMMAND_NAME as CLI } from "./distribution.js";
|
|
45
46
|
import { startFanoutServer } from "./github-fanout.js";
|
|
46
47
|
|
|
47
48
|
const execFileAsync = promisify(execFile);
|
|
@@ -88,21 +89,21 @@ export interface GithubCliOptions {
|
|
|
88
89
|
out?: string;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
const GITHUB_HELP =
|
|
92
|
+
const GITHUB_HELP = `${CLI} github — forward live GitHub webhooks to a local agent
|
|
92
93
|
|
|
93
94
|
Usage:
|
|
94
|
-
|
|
95
|
+
${CLI} github forward [--dir .] [--slug S] [--channel C]
|
|
95
96
|
[--repo owner/repo | --org ORG]
|
|
96
97
|
[--events a,b,c] [--url URL]
|
|
97
98
|
[--host 127.0.0.1] [--port 3000]
|
|
98
99
|
[--secret S] [--install]
|
|
99
|
-
|
|
100
|
+
${CLI} github replay <pr_url|owner/repo#N> [--events a,b,c | *]
|
|
100
101
|
[--action A] [--conclusion C] [--comment "…"]
|
|
101
102
|
[--context CTX] [--dir .] [--slug S] [--channel C]
|
|
102
103
|
[--host H] [--port N] [--url URL] [--secret S]
|
|
103
104
|
[--dry-run] [--out DIR] [--json]
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
${CLI} github events [--dir .] [--host H] [--port N] [--json]
|
|
106
|
+
${CLI} github doctor [--install] [--json]
|
|
106
107
|
|
|
107
108
|
Commands:
|
|
108
109
|
forward Run \`gh webhook forward\` for the discovered githubChannel()s.
|
|
@@ -122,8 +123,8 @@ Commands:
|
|
|
122
123
|
|
|
123
124
|
Prerequisites:
|
|
124
125
|
- gh CLI logged in (\`gh auth login\`).
|
|
125
|
-
- ${GITHUB_WEBHOOK_EXTENSION} extension (
|
|
126
|
-
- The agent already serving (
|
|
126
|
+
- ${GITHUB_WEBHOOK_EXTENSION} extension (\`${CLI} github doctor --install\`).
|
|
127
|
+
- The agent already serving (\`${CLI} serve --dir . --dev\`).
|
|
127
128
|
|
|
128
129
|
Notes:
|
|
129
130
|
- Set GITHUB_WEBHOOK_SECRET (or pass --secret) so the forwarded deliveries
|
|
@@ -71,22 +71,22 @@ export interface SlackCliOptions {
|
|
|
71
71
|
err?: (text: string) => void;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const SLACK_HELP =
|
|
74
|
+
const SLACK_HELP = `${CLI} slack — Slack channel pack helpers (Socket Mode)
|
|
75
75
|
|
|
76
76
|
Usage:
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
${CLI} slack setup
|
|
78
|
+
${CLI} slack create [--dir .] [--name NAME] [--slack-team T0123ABCD]
|
|
79
79
|
[--prod] [--team <id>] [--icon URL-or-FILE]
|
|
80
80
|
[--force] [--prefix PREFIX | --no-prefix] [--json]
|
|
81
|
-
|
|
81
|
+
${CLI} slack destroy [--dir .] [--slack-team T0123ABCD] [--prod]
|
|
82
82
|
[--team <id>] [--json]
|
|
83
|
-
|
|
83
|
+
${CLI} slack icon <URL-or-FILE> [--dir .] [--slack-team T0123ABCD]
|
|
84
84
|
[--prod] [--team <id>] [--json]
|
|
85
|
-
|
|
85
|
+
${CLI} slack init [--dir .] [--name NAME] [--prefix PREFIX | --no-prefix]
|
|
86
86
|
[--channel-posts]
|
|
87
|
-
|
|
87
|
+
${CLI} slack manifest --env dev|prod|both [--dir .] [--name NAME]
|
|
88
88
|
[--print]
|
|
89
|
-
|
|
89
|
+
${CLI} slack doctor [--dir .] [--prefix PREFIX | --no-prefix] [--json]
|
|
90
90
|
|
|
91
91
|
create/destroy/icon — Cursor "Add to Slack" managed provisioning:
|
|
92
92
|
create One-command Path B setup: connects the Slack workspace (browser
|
|
@@ -94,7 +94,7 @@ create/destroy/icon — Cursor "Add to Slack" managed provisioning:
|
|
|
94
94
|
Socket Mode app from the generated manifest, writes the token
|
|
95
95
|
pair into <dir>/.env.local, then runs doctor (prose mode; --json
|
|
96
96
|
reports without the doctor pass). Requires
|
|
97
|
-
|
|
97
|
+
\`${CLI} login\` (or CURSOR_API_KEY) and the feature gate.
|
|
98
98
|
--prod provisions the prod app (default dev); --slack-team picks
|
|
99
99
|
the workspace when several are connected. --icon sets the app's
|
|
100
100
|
icon (best-effort: a bad icon warns, never fails the create).
|
|
@@ -11,6 +11,8 @@ import type {
|
|
|
11
11
|
import type { SessionEventPayload, TurnUsage } from "../types.js";
|
|
12
12
|
|
|
13
13
|
const CUSTOM_TOOLS_PROVIDER = "custom-user-tools";
|
|
14
|
+
/** Authored server tools on cloud turns; keep in sync with `SERVER_TOOLS_MCP_SERVER_NAME`. */
|
|
15
|
+
const SERVER_TOOLS_PROVIDER = "agentsdk-tools";
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Nested interaction updates from a task/subagent tool-call-delta.
|
|
@@ -354,16 +356,19 @@ export class TurnEventMapper {
|
|
|
354
356
|
}
|
|
355
357
|
|
|
356
358
|
/**
|
|
357
|
-
* Human-meaningful tool identity for stream events.
|
|
358
|
-
* arrive as MCP calls against
|
|
359
|
-
* surface under the customer's bare tool name.
|
|
359
|
+
* Human-meaningful tool identity for stream events. Authored server tools
|
|
360
|
+
* arrive as MCP calls against `custom-user-tools` (local) or `agentsdk-tools`
|
|
361
|
+
* (cloud); both surface under the customer's bare tool name.
|
|
360
362
|
*/
|
|
361
363
|
export function describeToolCall(toolCall: ToolCall): ToolCallDescription {
|
|
362
364
|
switch (toolCall.type) {
|
|
363
365
|
case "mcp": {
|
|
364
366
|
const providerIdentifier = toolCall.args.providerIdentifier;
|
|
365
367
|
const toolName = toolCall.args.toolName;
|
|
366
|
-
if (
|
|
368
|
+
if (
|
|
369
|
+
providerIdentifier === CUSTOM_TOOLS_PROVIDER ||
|
|
370
|
+
providerIdentifier === SERVER_TOOLS_PROVIDER
|
|
371
|
+
) {
|
|
367
372
|
return {
|
|
368
373
|
toolName: toolName ?? "custom-tool",
|
|
369
374
|
args: toolCall.args.args,
|
package/src/internal/host-kv.ts
CHANGED
|
@@ -11,12 +11,16 @@ import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import { storageKeys } from "../storage.js";
|
|
13
13
|
import type { HostKvApi, JsonValue } from "../types.js";
|
|
14
|
-
import type {
|
|
14
|
+
import type { AuthorKvStore } from "./storage-roles.js";
|
|
15
15
|
|
|
16
16
|
export interface CreateHostKvApiOptions {
|
|
17
17
|
agentName: string;
|
|
18
18
|
stateRoot: string;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Author KV backend. Narrowed to {@link AuthorKvStore} so this path cannot
|
|
21
|
+
* reach framework session state, which is headed somewhere else entirely.
|
|
22
|
+
*/
|
|
23
|
+
storage?: AuthorKvStore;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
/** Build the host KV API for one agent process. */
|
|
@@ -103,6 +103,7 @@ import { assertCloudCanHonorAccountServersFilters } from "./resolved-connections
|
|
|
103
103
|
import type { AgentRunner } from "./sdk-runner.js";
|
|
104
104
|
import { SessionStore } from "./session-store.js";
|
|
105
105
|
import { StorageCoordinator } from "./storage-coordinator.js";
|
|
106
|
+
import type { FrameworkSessionStore } from "./storage-roles.js";
|
|
106
107
|
import { normalizeToolResult, toolCallErrorMessage } from "./tool-result.js";
|
|
107
108
|
import {
|
|
108
109
|
type EstimateTurnCostFn,
|
|
@@ -115,6 +116,7 @@ import {
|
|
|
115
116
|
buildCloudMemorySection,
|
|
116
117
|
isNestedInGitRepo,
|
|
117
118
|
materializeWorkspace,
|
|
119
|
+
SERVER_TOOLS_MCP_SERVER_NAME,
|
|
118
120
|
writeWorkspaceFiles,
|
|
119
121
|
} from "./workspace.js";
|
|
120
122
|
|
|
@@ -1463,8 +1465,18 @@ export class SessionEngine {
|
|
|
1463
1465
|
if (runtime === "cloud") {
|
|
1464
1466
|
// Cloud VMs have no materialized workspace: ship the full context,
|
|
1465
1467
|
// including agent tool script bodies. On hosted deployments the
|
|
1466
|
-
// shared memory journal is on the store mount — say where.
|
|
1467
|
-
|
|
1468
|
+
// shared memory journal is on the store mount — say where. When the
|
|
1469
|
+
// turn carries the session-bound server-tool MCP endpoint, the
|
|
1470
|
+
// preamble catalogs server tools under that MCP server name *before*
|
|
1471
|
+
// the agent-tool "write the script if missing" recipe, so a model
|
|
1472
|
+
// told to "use <server tool>" calls MCP instead of inventing a .sh.
|
|
1473
|
+
const preamble = buildAgentsMdContent(agent, {
|
|
1474
|
+
includeScripts: true,
|
|
1475
|
+
serverToolsMcpName:
|
|
1476
|
+
this.cloudServerToolsConnection === undefined
|
|
1477
|
+
? undefined
|
|
1478
|
+
: SERVER_TOOLS_MCP_SERVER_NAME,
|
|
1479
|
+
});
|
|
1468
1480
|
const memorySection = isCursorHostedFilesAvailable()
|
|
1469
1481
|
? `\n\n${buildCloudMemorySection(this.project.name)}`
|
|
1470
1482
|
: "";
|
|
@@ -1677,16 +1689,16 @@ export class SessionEngine {
|
|
|
1677
1689
|
this.cloudServerToolsConnection !== undefined &&
|
|
1678
1690
|
this.project.agent.tools.some((tool) => tool.execution === "server")
|
|
1679
1691
|
) {
|
|
1680
|
-
if (servers[
|
|
1692
|
+
if (servers[SERVER_TOOLS_MCP_SERVER_NAME] !== undefined) {
|
|
1681
1693
|
throw new Error(
|
|
1682
|
-
|
|
1694
|
+
`MCP connection name "${SERVER_TOOLS_MCP_SERVER_NAME}" is reserved for authored server tools on cloud turns.`
|
|
1683
1695
|
);
|
|
1684
1696
|
}
|
|
1685
1697
|
const connection = this.cloudServerToolsConnection;
|
|
1686
1698
|
if ("url" in connection) {
|
|
1687
1699
|
const url = new URL(connection.url);
|
|
1688
1700
|
url.searchParams.set("agentkitSessionId", sessionId);
|
|
1689
|
-
servers[
|
|
1701
|
+
servers[SERVER_TOOLS_MCP_SERVER_NAME] = {
|
|
1690
1702
|
...connection,
|
|
1691
1703
|
url: url.toString(),
|
|
1692
1704
|
};
|
|
@@ -2938,7 +2950,7 @@ export class SessionEngine {
|
|
|
2938
2950
|
}
|
|
2939
2951
|
|
|
2940
2952
|
private async runBulkRestore(
|
|
2941
|
-
storage:
|
|
2953
|
+
storage: FrameworkSessionStore,
|
|
2942
2954
|
policy: { maxSessions: number; maxAgeMs: number; maxTotalBytes: number }
|
|
2943
2955
|
): Promise<void> {
|
|
2944
2956
|
const loaded = await storage.listSessions();
|
|
@@ -3099,7 +3111,7 @@ export class SessionEngine {
|
|
|
3099
3111
|
}
|
|
3100
3112
|
|
|
3101
3113
|
private async loadAndMaterializeByContinuation(
|
|
3102
|
-
storage:
|
|
3114
|
+
storage: FrameworkSessionStore,
|
|
3103
3115
|
channelId: string,
|
|
3104
3116
|
continuationKey: string
|
|
3105
3117
|
): Promise<SessionRecord | undefined> {
|
|
@@ -3115,7 +3127,7 @@ export class SessionEngine {
|
|
|
3115
3127
|
}
|
|
3116
3128
|
|
|
3117
3129
|
private async loadAndMaterializeById(
|
|
3118
|
-
storage:
|
|
3130
|
+
storage: FrameworkSessionStore,
|
|
3119
3131
|
sessionId: string
|
|
3120
3132
|
): Promise<SessionRecord | undefined> {
|
|
3121
3133
|
const record = await storage.getSessionById(sessionId);
|
|
@@ -14,6 +14,13 @@
|
|
|
14
14
|
* and A/B metrics go to their dedicated tables (`evals` / `abs`).
|
|
15
15
|
* Reminder documents live on the control plane. Everything shares one
|
|
16
16
|
* bounded, serialized queue.
|
|
17
|
+
*
|
|
18
|
+
* It does three unrelated jobs, declared separately as
|
|
19
|
+
* {@link FrameworkSessionStore}, {@link AuthorKvStore}, and
|
|
20
|
+
* {@link EvalAbStore} — see `storage-roles.ts` for why they differ and where
|
|
21
|
+
* each is headed. The queue stays shared: it is one bounded, serialized chain
|
|
22
|
+
* per agent, and splitting it would change backpressure behavior, which this
|
|
23
|
+
* seam deliberately does not touch.
|
|
17
24
|
*/
|
|
18
25
|
|
|
19
26
|
import type { ABMetricSample } from "../ab.js";
|
|
@@ -30,6 +37,11 @@ import type { JsonValue, SessionEvent, SessionRecord } from "../types.js";
|
|
|
30
37
|
import type { ABSnapshot } from "./ab-snapshot.js";
|
|
31
38
|
import { describeError } from "./describe-error.js";
|
|
32
39
|
import type { EvalRunStorage } from "./eval-run-store.js";
|
|
40
|
+
import type {
|
|
41
|
+
AuthorKvStore,
|
|
42
|
+
EvalAbStore,
|
|
43
|
+
FrameworkSessionStore,
|
|
44
|
+
} from "./storage-roles.js";
|
|
33
45
|
|
|
34
46
|
/** Event types that close a unit of work — flush point for turn-end batching. */
|
|
35
47
|
const TURN_BOUNDARY_EVENTS: ReadonlySet<SessionEvent["type"]> = new Set([
|
|
@@ -85,7 +97,9 @@ interface SessionBuffer {
|
|
|
85
97
|
debounceTimer?: ReturnType<typeof setTimeout>;
|
|
86
98
|
}
|
|
87
99
|
|
|
88
|
-
export class StorageCoordinator
|
|
100
|
+
export class StorageCoordinator
|
|
101
|
+
implements FrameworkSessionStore, AuthorKvStore, EvalAbStore
|
|
102
|
+
{
|
|
89
103
|
readonly policy: ResolvedStoragePolicy;
|
|
90
104
|
|
|
91
105
|
private readonly definition: StorageDefinition;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three unrelated jobs `defineStorage` currently does, named separately.
|
|
3
|
+
*
|
|
4
|
+
* {@link import("./storage-coordinator.js").StorageCoordinator} implements all
|
|
5
|
+
* three today over one sink and one delivery queue. Splitting the *types* is
|
|
6
|
+
* the seam that lets each job change independently:
|
|
7
|
+
*
|
|
8
|
+
* - {@link FrameworkSessionStore} is framework state. Session records, event
|
|
9
|
+
* chunks, and the continuation index are how a session survives the process,
|
|
10
|
+
* so they belong to Agent Serve, not to the agent. Today they persist only
|
|
11
|
+
* when the author writes `agent/storage.ts` — the defect this seam exists to
|
|
12
|
+
* let us fix, by giving the framework its own provider that is automatic and
|
|
13
|
+
* not author-configurable.
|
|
14
|
+
* - {@link AuthorKvStore} is author state: whatever `ctx.host.kv` was handed.
|
|
15
|
+
* It converges onto the author file plane, which is a different destination
|
|
16
|
+
* from the one above.
|
|
17
|
+
* - {@link EvalAbStore} is playground/experiment bookkeeping with its own
|
|
18
|
+
* dedicated tables, and follows neither.
|
|
19
|
+
*
|
|
20
|
+
* Consumers should depend on the narrowest role they use. That is what keeps a
|
|
21
|
+
* later change to framework persistence from silently reaching author KV, and
|
|
22
|
+
* it is why these are interfaces rather than a comment on one class.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { ABMetricSample } from "../ab.js";
|
|
26
|
+
import type { StorageContext } from "../storage.js";
|
|
27
|
+
import type { JsonValue, SessionEvent, SessionRecord } from "../types.js";
|
|
28
|
+
import type { ABSnapshot } from "./ab-snapshot.js";
|
|
29
|
+
import type { EvalRunStorage } from "./eval-run-store.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Framework-owned session durability: what has to be true for a session to
|
|
33
|
+
* outlive the process that served it.
|
|
34
|
+
*
|
|
35
|
+
* Writes are fire-and-forget by design — a throwing backend is logged and its
|
|
36
|
+
* write dropped, because storage must never stall or fail a turn. That is
|
|
37
|
+
* at-most-once, and it is the property Track F later has to tighten, since a
|
|
38
|
+
* dropped record is a session that cannot be restored.
|
|
39
|
+
*/
|
|
40
|
+
export interface FrameworkSessionStore {
|
|
41
|
+
/** Durable session-record update; coalesced until the next flush. */
|
|
42
|
+
sessionRecord(record: SessionRecord): void;
|
|
43
|
+
/** One appended session event; batched per turn or debounce window. */
|
|
44
|
+
event(event: SessionEvent): void;
|
|
45
|
+
/** Marks an event delivered, for backends that track dispatch. */
|
|
46
|
+
eventDispatched(event: SessionEvent): void;
|
|
47
|
+
/** Flush everything buffered for one session (ordered: events, record). */
|
|
48
|
+
flushSession(sessionId: string, reason?: StorageContext["reason"]): void;
|
|
49
|
+
|
|
50
|
+
/** True when the backend can list every session in one bulk read. */
|
|
51
|
+
readonly canBulkRestore: boolean;
|
|
52
|
+
/** True when the backend is the Cursor-hosted one rather than an authored sink. */
|
|
53
|
+
readonly isCursorHosted: boolean;
|
|
54
|
+
|
|
55
|
+
listSessions(): Promise<SessionRecord[]>;
|
|
56
|
+
listSessionsFromSink(): Promise<SessionRecord[]>;
|
|
57
|
+
listSessionEvents(sessionId: string): Promise<SessionEvent[]>;
|
|
58
|
+
getSessionById(sessionId: string): Promise<SessionRecord | undefined>;
|
|
59
|
+
getSessionByContinuation(
|
|
60
|
+
channelId: string,
|
|
61
|
+
continuationKey: string
|
|
62
|
+
): Promise<SessionRecord | undefined>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Author-facing durable JSON behind `ctx.host.kv`.
|
|
67
|
+
*
|
|
68
|
+
* Deployment-wide on purpose: the point is state an author saves in one
|
|
69
|
+
* session and reads back in a later one, so unlike `ctx.host.files` there is
|
|
70
|
+
* no session scope to default to.
|
|
71
|
+
*/
|
|
72
|
+
export interface AuthorKvStore {
|
|
73
|
+
/** False when no backend is configured; callers fall back to local disk. */
|
|
74
|
+
readonly supportsAuthorKv: boolean;
|
|
75
|
+
kvGet(authorKey: string): Promise<JsonValue | undefined>;
|
|
76
|
+
kvPut(authorKey: string, value: JsonValue): Promise<void>;
|
|
77
|
+
kvDelete(authorKey: string): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Playground eval batches and live A/B metrics, on their own tables. */
|
|
81
|
+
export interface EvalAbStore {
|
|
82
|
+
evalRuns(): EvalRunStorage | undefined;
|
|
83
|
+
abSample(sample: ABMetricSample): void;
|
|
84
|
+
abSnapshot(snapshot: ABSnapshot): void;
|
|
85
|
+
getLatestAbSnapshot(): Promise<ABSnapshot | undefined>;
|
|
86
|
+
}
|
|
@@ -66,6 +66,14 @@ export function agentToolScriptPath(toolName: string): string {
|
|
|
66
66
|
return `.agent-serve/tools/${toolName}.sh`;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Reserved MCP connection name under which authored server tools are served
|
|
71
|
+
* to cloud turns (the session-bound tool MCP endpoint). Shared between the
|
|
72
|
+
* turn's MCP config and the first-prompt server-tool catalog so the model is
|
|
73
|
+
* told exactly where those tools live.
|
|
74
|
+
*/
|
|
75
|
+
export const SERVER_TOOLS_MCP_SERVER_NAME = "agentsdk-tools";
|
|
76
|
+
|
|
69
77
|
/**
|
|
70
78
|
* Always-on identity line prepended when composing instructions. Sourced from
|
|
71
79
|
* {@link ResolvedAgent.name} (`defineAgent({ name })`, else package/dir name)
|
|
@@ -121,6 +129,7 @@ export function buildAgentToolsCatalog(
|
|
|
121
129
|
"",
|
|
122
130
|
"These tools run in the agent environment (not on the agent-serve host).",
|
|
123
131
|
"Pass a JSON object on stdin matching the input schema; read the result from stdout.",
|
|
132
|
+
"Only the tools in this section are scripts. Do not create, edit, or run a script for any other tool name.",
|
|
124
133
|
"",
|
|
125
134
|
];
|
|
126
135
|
|
|
@@ -157,20 +166,76 @@ export function buildAgentToolsCatalog(
|
|
|
157
166
|
return `${parts.join("\n").trimEnd()}\n`;
|
|
158
167
|
}
|
|
159
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Markdown catalog of authored server tools for the cloud first prompt.
|
|
171
|
+
*
|
|
172
|
+
* Server tools execute on the serve host and reach cloud turns only as MCP
|
|
173
|
+
* tools on {@link SERVER_TOOLS_MCP_SERVER_NAME}. Instructions reference them
|
|
174
|
+
* by bare name. The agent-tool catalog still teaches "write the script if
|
|
175
|
+
* missing" for *agent* tools; this section must come first on cloud and
|
|
176
|
+
* say that server tools are MCP-only, or the model copies that recipe onto
|
|
177
|
+
* a host tool and the host-side marker never appears.
|
|
178
|
+
*/
|
|
179
|
+
export function buildServerToolsCatalog(
|
|
180
|
+
tools: DiscoveredTool[],
|
|
181
|
+
options: { mcpServerName: string }
|
|
182
|
+
): string {
|
|
183
|
+
const serverTools = tools.filter((tool) => tool.execution === "server");
|
|
184
|
+
if (serverTools.length === 0) {
|
|
185
|
+
return "";
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const parts: string[] = [
|
|
189
|
+
"## Server tools",
|
|
190
|
+
"",
|
|
191
|
+
`These tools execute on the agent-serve host, not in this environment. They are available ONLY as MCP tools on the \`${options.mcpServerName}\` MCP server.`,
|
|
192
|
+
"Call them through your MCP tooling: list that server's tools, then invoke the tool by its exact name (GetMcpTools / CallMcpTool, or the equivalent). There is no `.agent-serve/tools/<name>.sh` for any tool in this section.",
|
|
193
|
+
`If the \`${options.mcpServerName}\` server is not in your MCP server list, stop and report that. Do not write, edit, or run a local script or other substitute. A local re-implementation cannot produce the host-side marker, logs, or session events.`,
|
|
194
|
+
"",
|
|
195
|
+
];
|
|
196
|
+
|
|
197
|
+
for (const tool of serverTools) {
|
|
198
|
+
parts.push(`### \`${tool.name}\``);
|
|
199
|
+
parts.push("");
|
|
200
|
+
parts.push(tool.description.trim());
|
|
201
|
+
parts.push("");
|
|
202
|
+
parts.push("Input schema:");
|
|
203
|
+
parts.push("");
|
|
204
|
+
parts.push("```json");
|
|
205
|
+
parts.push(JSON.stringify(tool.inputSchema, null, 2));
|
|
206
|
+
parts.push("```");
|
|
207
|
+
parts.push("");
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return `${parts.join("\n").trimEnd()}\n`;
|
|
211
|
+
}
|
|
212
|
+
|
|
160
213
|
/**
|
|
161
214
|
* The full AGENTS.md-equivalent context for an agent: instructions, identity
|
|
162
215
|
* section, and the agent-side tool catalog. Written to the session workspace
|
|
163
216
|
* as `AGENTS.md`, and inlined into the first turn's prompt when the harness
|
|
164
217
|
* cannot discover that file (cloud runtime, or a local workspace the harness
|
|
165
218
|
* will not treat as the project root — see {@link isNestedInGitRepo}).
|
|
219
|
+
*
|
|
220
|
+
* `serverToolsMcpName` is cloud-only: when the turn's MCP config carries the
|
|
221
|
+
* session-bound server-tool endpoint, the catalog names that server so the
|
|
222
|
+
* model calls the real tools instead of inventing local stand-ins. It is
|
|
223
|
+
* emitted *before* the agent-tool catalog so "write the script if missing"
|
|
224
|
+
* cannot be read as applying to server-tool names. Local runtimes omit it —
|
|
225
|
+
* there the harness exposes server tools natively.
|
|
166
226
|
*/
|
|
167
227
|
export function buildAgentsMdContent(
|
|
168
228
|
agent: ResolvedAgent,
|
|
169
|
-
options: { includeScripts: boolean }
|
|
229
|
+
options: { includeScripts: boolean; serverToolsMcpName?: string }
|
|
170
230
|
): string {
|
|
171
231
|
return [
|
|
172
232
|
agent.instructions?.trim() ?? "",
|
|
173
233
|
buildIdentitySection(agent),
|
|
234
|
+
options.serverToolsMcpName === undefined
|
|
235
|
+
? ""
|
|
236
|
+
: buildServerToolsCatalog(agent.tools, {
|
|
237
|
+
mcpServerName: options.serverToolsMcpName,
|
|
238
|
+
}),
|
|
174
239
|
buildAgentToolsCatalog(agent.tools, {
|
|
175
240
|
includeScripts: options.includeScripts,
|
|
176
241
|
}),
|