@cursor/july 0.1.88 → 0.1.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -94
- package/dist/ab.d.ts +1 -1
- package/dist/ab.js +1 -1
- package/dist/artifacts.d.ts +1 -1
- package/dist/artifacts.js +1 -1
- package/dist/bin/agent-serve.js +21 -8
- package/dist/channels.d.ts +1 -1
- package/dist/channels.js +1 -1
- package/dist/connections.d.ts +1 -1
- package/dist/connections.js +1 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +3 -3
- package/dist/docs/assets/{app.DUOPbN18.js → app.wiNkt6G7.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.FV0R6kOb.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.CmWbGcGk.js → VPLocalSearchBox.ByhUGu47.js} +1 -1
- package/dist/docs/assets/chunks/{theme.S57OeOLA.js → theme.Dx7j_-0n.js} +2 -2
- package/dist/docs/assets/{concepts.md.BXAm6G-C.js → concepts.md.2NfkGjqM.js} +1 -1
- package/dist/docs/assets/{reference_project-layout.md.D3MdHM2z.js → reference_project-layout.md.CueaKpjr.js} +5 -20
- package/dist/docs/assets/reference_project-layout.md.CueaKpjr.lean.js +1 -0
- package/dist/docs/assets/{reference_tools.md.DTg_kEsx.js → reference_tools.md.XmeFP_3d.js} +23 -2
- package/dist/docs/assets/{reference_tools.md.DTg_kEsx.lean.js → reference_tools.md.XmeFP_3d.lean.js} +1 -1
- package/dist/docs/assets/{scaffolding-agents.md.CiGsJ1aw.js → scaffolding-agents.md.BpMFXv2J.js} +1 -1
- package/dist/docs/building-with-agents.html +3 -3
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/deployment.html +3 -3
- package/dist/docs/evals.html +3 -3
- package/dist/docs/example-agents/approval-buddy.html +3 -3
- package/dist/docs/example-agents/benny.html +3 -3
- package/dist/docs/example-agents/bugbot.html +3 -3
- package/dist/docs/example-agents/codebase-wiki.html +3 -3
- package/dist/docs/example-agents/codeowners-review.html +3 -3
- package/dist/docs/example-agents/concierge.html +3 -3
- package/dist/docs/example-agents/fsd.html +3 -3
- package/dist/docs/example-agents/index.html +3 -3
- package/dist/docs/example-agents/knowledge-base.html +3 -3
- package/dist/docs/example-agents/oncall.html +3 -3
- package/dist/docs/example-agents/security-reviewer.html +3 -3
- package/dist/docs/example-agents/slack-agent.html +3 -3
- package/dist/docs/example-agents/weather-agent.html +3 -3
- package/dist/docs/guides/agent-to-agent.html +3 -3
- package/dist/docs/guides/cloud-runtime.html +3 -3
- package/dist/docs/guides/convert-automation.html +3 -3
- package/dist/docs/guides/github.html +3 -3
- package/dist/docs/guides/human-in-the-loop.html +3 -3
- package/dist/docs/guides/mcp-oauth.html +3 -3
- package/dist/docs/guides/opentelemetry.html +3 -3
- package/dist/docs/guides/slack.html +3 -3
- package/dist/docs/guides/webhooks.html +3 -3
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +3 -3
- package/dist/docs/index.html +3 -3
- package/dist/docs/quickstart.html +3 -3
- package/dist/docs/reference/agent-config.html +3 -3
- package/dist/docs/reference/artifacts.html +3 -3
- package/dist/docs/reference/channels.html +3 -3
- package/dist/docs/reference/cli.html +3 -3
- package/dist/docs/reference/connections.html +3 -3
- package/dist/docs/reference/hooks.html +3 -3
- package/dist/docs/reference/http-api.html +3 -3
- package/dist/docs/reference/instructions.html +3 -3
- package/dist/docs/reference/playground.html +3 -3
- package/dist/docs/reference/project-layout.html +8 -23
- package/dist/docs/reference/prompt.html +3 -3
- package/dist/docs/reference/schedules.html +3 -3
- package/dist/docs/reference/sessions.html +3 -3
- package/dist/docs/reference/skills.html +3 -3
- package/dist/docs/reference/subagents.html +3 -3
- package/dist/docs/reference/tools.html +27 -6
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/storage.html +3 -3
- package/dist/docs/templates/agentic-owners.html +3 -3
- package/dist/docs/templates/demo.html +3 -3
- package/dist/docs/templates/pr-autofixer.html +3 -3
- package/dist/docs/templates/security-reviewer.html +3 -3
- package/dist/docs/templates/triage.html +3 -3
- package/dist/docs/troubleshooting.html +3 -3
- package/dist/evals.d.ts +1 -1
- package/dist/evals.js +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal/advertise-tools.d.ts.map +1 -1
- package/dist/internal/advertise-tools.js +1 -1
- package/dist/internal/cli-ax.js +1 -1
- package/dist/internal/cli-convert-automation.d.ts +1 -1
- package/dist/internal/cli-convert-automation.js +1 -1
- package/dist/internal/cli-cursor.d.ts +12 -4
- package/dist/internal/cli-cursor.d.ts.map +1 -1
- package/dist/internal/cli-cursor.js +11 -4
- package/dist/internal/cli-deploy.d.ts +3 -2
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +84 -9
- package/dist/internal/convert-automation/convert-workflow.d.ts +1 -1
- package/dist/internal/convert-automation/convert-workflow.js +9 -9
- package/dist/internal/convert-automation/types.d.ts +1 -1
- package/dist/internal/convert-automation/types.js +1 -1
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
- package/dist/internal/cursor/account-mcp.js +8 -4
- package/dist/internal/cursor/backend-client.d.ts +17 -1
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +42 -7
- package/dist/internal/cursor/credentials.d.ts +35 -9
- package/dist/internal/cursor/credentials.d.ts.map +1 -1
- package/dist/internal/cursor/credentials.js +92 -39
- package/dist/internal/deploy-client.d.ts +42 -1
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +70 -2
- package/dist/internal/discovery.js +1 -1
- package/dist/internal/distribution.d.ts +18 -0
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +19 -0
- package/dist/internal/eval-runner.js +1 -1
- package/dist/internal/grokbot/runner.d.ts +5 -2
- package/dist/internal/grokbot/runner.d.ts.map +1 -1
- package/dist/internal/grokbot/runner.js +10 -6
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +8 -1
- package/dist/internal/mcp-endpoint.js +2 -1
- package/dist/internal/sdk-runner.d.ts +5 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +10 -5
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +80 -36
- package/dist/internal/session-engine.d.ts +9 -2
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +85 -28
- package/dist/internal/tool-policy.d.ts +33 -1
- package/dist/internal/tool-policy.d.ts.map +1 -1
- package/dist/internal/tool-policy.js +53 -0
- package/dist/playground/assets/index-BpVS-paP.css +1 -0
- package/dist/playground/assets/{index-Bqn91tW4.js → index-DxapiDj_.js} +45 -45
- package/dist/playground/index.html +2 -2
- package/dist/reminders.d.ts +1 -1
- package/dist/reminders.js +1 -1
- package/dist/schedules.d.ts +1 -1
- package/dist/schedules.js +1 -1
- package/dist/skills.d.ts +1 -1
- package/dist/skills.js +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +1 -1
- package/dist/types.d.ts +24 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/docs/concepts.md +2 -1
- package/docs/reference/project-layout.md +5 -20
- package/docs/reference/tools.md +53 -3
- package/docs/scaffolding-agents.md +2 -0
- package/package.json +2 -1
- package/skills/debug/SKILL.md +1 -2
- package/skills/framework-map/SKILL.md +1 -2
- package/src/ab.ts +1 -1
- package/src/artifacts.ts +1 -1
- package/src/bin/agent-serve.ts +21 -7
- package/src/channels.ts +1 -1
- package/src/connections.ts +1 -1
- package/src/evals.ts +1 -1
- package/src/hooks.ts +1 -1
- package/src/index.ts +2 -2
- package/src/internal/advertise-tools.ts +1 -0
- package/src/internal/cli-ax.ts +1 -1
- package/src/internal/cli-convert-automation.ts +1 -1
- package/src/internal/cli-cursor.ts +18 -5
- package/src/internal/cli-deploy.ts +123 -15
- package/src/internal/convert-automation/convert-workflow.ts +9 -9
- package/src/internal/convert-automation/types.ts +1 -1
- package/src/internal/cursor/account-mcp.ts +15 -1
- package/src/internal/cursor/backend-client.ts +62 -4
- package/src/internal/cursor/credentials.ts +87 -24
- package/src/internal/deploy-client.ts +122 -2
- package/src/internal/discovery.ts +1 -1
- package/src/internal/distribution.ts +31 -0
- package/src/internal/eval-runner.ts +1 -1
- package/src/internal/grokbot/runner.ts +15 -6
- package/src/internal/init-project.ts +11 -1
- package/src/internal/mcp-endpoint.ts +2 -1
- package/src/internal/sdk-runner.ts +10 -4
- package/src/internal/server.ts +95 -33
- package/src/internal/session-engine.ts +86 -6
- package/src/internal/tool-policy.ts +80 -1
- package/src/reminders.ts +1 -1
- package/src/schedules.ts +1 -1
- package/src/skills.ts +1 -1
- package/src/storage.ts +1 -1
- package/src/tools.ts +1 -1
- package/src/types.ts +21 -2
- package/dist/docs/assets/chunks/@localSearchIndexroot.CxCtxfDE.js +0 -1
- package/dist/docs/assets/reference_project-layout.md.D3MdHM2z.lean.js +0 -1
- package/dist/playground/assets/index-C0_5hOsf.css +0 -1
- /package/dist/docs/assets/{concepts.md.BXAm6G-C.lean.js → concepts.md.2NfkGjqM.lean.js} +0 -0
- /package/dist/docs/assets/{scaffolding-agents.md.CiGsJ1aw.lean.js → scaffolding-agents.md.BpMFXv2J.lean.js} +0 -0
package/dist/internal/server.js
CHANGED
|
@@ -45,7 +45,7 @@ import { assertSlackCursorAgentName } from "../channels/slack/types.js";
|
|
|
45
45
|
import { allowAll, bearerAuth, localDevStrict } from "../channels.js";
|
|
46
46
|
import { CursorAccountMcpBridge, collectCursorAccountConnections, cursorAccountMcpPath, } from "./cursor/account-mcp.js";
|
|
47
47
|
import { CursorBackendClient } from "./cursor/backend-client.js";
|
|
48
|
-
import { cursorExternalApiUrl, resolveApiKey, SIGN_IN_HINT, } from "./cursor/credentials.js";
|
|
48
|
+
import { cursorBackendUrl, cursorExternalApiUrl, resolveApiKey, resolveApiKeySync, SIGN_IN_HINT, } from "./cursor/credentials.js";
|
|
49
49
|
import { CursorGithubCredentialProvider } from "./cursor/github-credentials.js";
|
|
50
50
|
import { DeploymentEventRelay, fanOutDeploymentEvent, resolveDeploymentSubscriptions, } from "./cursor-deployment-relay.js";
|
|
51
51
|
import { CursorEventRelay, formatCursorScmDispatchOutcome, formatCursorScmEventLog, scmEventToGitHubPayload, scmMetadataToOriginPayload, } from "./cursor-event-relay.js";
|
|
@@ -115,8 +115,8 @@ function isV2Project(project) {
|
|
|
115
115
|
export function startServer(mounts_1) {
|
|
116
116
|
return __awaiter(this, arguments, void 0, function* (mounts, options = {}) {
|
|
117
117
|
var _a, _b, _c, _d, _e, _f;
|
|
118
|
-
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
119
|
-
var
|
|
118
|
+
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
119
|
+
var _3;
|
|
120
120
|
if (mounts.length === 0) {
|
|
121
121
|
throw new Error("startServer requires at least one agent mount");
|
|
122
122
|
}
|
|
@@ -134,10 +134,10 @@ export function startServer(mounts_1) {
|
|
|
134
134
|
const noControlPlane = options.noControlPlane === true;
|
|
135
135
|
const runSchedules = (_k = options.schedules) !== null && _k !== void 0 ? _k : !dev;
|
|
136
136
|
const runReminders = (_l = options.reminders) !== null && _l !== void 0 ? _l : !dev;
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
// agentkit_enabled gate
|
|
140
|
-
(_m = (
|
|
137
|
+
// CURSOR_AGENTKIT_VERSION is still the env the SDK reads when building
|
|
138
|
+
// its client-version header (wire prefix remains `agentkit-`). Setting it
|
|
139
|
+
// here makes the internal-only agentkit_enabled gate apply to every turn.
|
|
140
|
+
(_m = (_3 = process.env).CURSOR_AGENTKIT_VERSION) !== null && _m !== void 0 ? _m : (_3.CURSOR_AGENTKIT_VERSION = packageVersion());
|
|
141
141
|
const authoredOtel = pickAuthoredOtel(mounts.map((m) => ({
|
|
142
142
|
slug: m.slug,
|
|
143
143
|
name: m.project.name,
|
|
@@ -167,8 +167,13 @@ export function startServer(mounts_1) {
|
|
|
167
167
|
: { repos: [...cursorOriginScope.repos] });
|
|
168
168
|
// One resolution for every Cursor credential consumer (SDK runner, account
|
|
169
169
|
// MCP bridge, SCM event relay, GitHub credentials): explicit option →
|
|
170
|
-
// CURSOR_API_KEY →
|
|
170
|
+
// CURSOR_API_KEY → CURSOR_API_KEY_FILE (or the hosted default path) →
|
|
171
|
+
// stored `agent-serve login`. SDK / GitHub / account MCP re-read later;
|
|
172
|
+
// Slack and deployment-event relays capture the key at start.
|
|
171
173
|
const accountKey = yield resolveApiKey(options.apiKey === undefined ? {} : { apiKey: options.apiKey });
|
|
174
|
+
// First present source wins (we define the order): option → env → file →
|
|
175
|
+
// stored login. Re-read so bind can drop env or file onto a listening process.
|
|
176
|
+
const liveCursorApiKey = () => { var _a; return (_a = resolveApiKeySync(options.apiKey === undefined ? {} : { apiKey: options.apiKey })) === null || _a === void 0 ? void 0 : _a.apiKey; };
|
|
172
177
|
// The SCM relay reads the event stream as the signed-in user, so
|
|
173
178
|
// `cursorEvents` cannot work signed out. Require the credential before any
|
|
174
179
|
// slow or stateful startup work (playground build, channel onStart, cron).
|
|
@@ -197,13 +202,15 @@ export function startServer(mounts_1) {
|
|
|
197
202
|
const githubProxyRequested = options.cursorGithubProxy === true;
|
|
198
203
|
const needsGithubAuth = cursorGithubConfig.scope !== undefined || githubProxyRequested;
|
|
199
204
|
if (needsGithubAuth) {
|
|
200
|
-
const
|
|
201
|
-
?
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
const currentGithubApiKey = () => {
|
|
206
|
+
const fromEvents = cursorEventsAuth === null || cursorEventsAuth === void 0 ? void 0 : cursorEventsAuth.apiKey.trim();
|
|
207
|
+
if (fromEvents !== undefined && fromEvents !== "") {
|
|
208
|
+
return fromEvents;
|
|
204
209
|
}
|
|
205
|
-
|
|
206
|
-
|
|
210
|
+
return liveCursorApiKey();
|
|
211
|
+
};
|
|
212
|
+
const githubApiKeyNow = currentGithubApiKey();
|
|
213
|
+
if (githubApiKeyNow === undefined && options.allowAnonymous !== true) {
|
|
207
214
|
throw new Error("githubChannel({ cursorAccount: true }) could not resolve Cursor event authentication.");
|
|
208
215
|
}
|
|
209
216
|
if (options.allowAnonymous === true) {
|
|
@@ -211,18 +218,31 @@ export function startServer(mounts_1) {
|
|
|
211
218
|
throw new Error("githubChannel({ cursorAccount: true }) cannot be served with --allow-anonymous because admitted callers could use the signed-in account's GitHub access. If every admitted caller is trusted (e.g. behind an SSO proxy), opt in with --allow-anonymous-cursor-github.");
|
|
212
219
|
}
|
|
213
220
|
logger("[agent-sdk] warning: --allow-anonymous-cursor-github — every admitted HTTP caller can drive sessions holding the signed-in account's repo-scoped GitHub credential; serve this only behind a trusted boundary (e.g. an SSO proxy)");
|
|
221
|
+
if (githubApiKeyNow === undefined) {
|
|
222
|
+
logger("[agent-sdk] GitHub auth: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
|
|
223
|
+
}
|
|
214
224
|
}
|
|
215
225
|
if (cursorGithubConfig.permissions === "contents-write") {
|
|
216
226
|
logger('[agent-sdk] warning: Cursor GitHub credentials include contents:write — the host holds a push-capable token shared with model-driven tools and untrusted webhook content; prefer permissions: "pr-write" unless this agent must push code');
|
|
217
227
|
}
|
|
228
|
+
const githubAuthBaseUrl = cursorExternalApiUrl();
|
|
229
|
+
const requireGithubApiKey = () => __awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
const apiKey = currentGithubApiKey();
|
|
231
|
+
if (apiKey === undefined) {
|
|
232
|
+
throw new Error(`githubChannel({ cursorAccount: true }) has no Cursor credential yet. ${SIGN_IN_HINT}`);
|
|
233
|
+
}
|
|
234
|
+
return apiKey;
|
|
235
|
+
});
|
|
218
236
|
const githubProxyUrl = githubProxyRequested
|
|
219
|
-
? resolveCursorGithubProxyUrl(
|
|
237
|
+
? resolveCursorGithubProxyUrl(githubAuthBaseUrl)
|
|
220
238
|
: undefined;
|
|
221
|
-
if (cursorGithubConfig.scope !== undefined
|
|
239
|
+
if (cursorGithubConfig.scope !== undefined &&
|
|
240
|
+
githubApiKeyNow !== undefined) {
|
|
222
241
|
const provider = new CursorGithubCredentialProvider({
|
|
223
242
|
client: new CursorBackendClient({
|
|
224
|
-
backendUrl:
|
|
225
|
-
apiKey:
|
|
243
|
+
backendUrl: githubAuthBaseUrl,
|
|
244
|
+
apiKey: githubApiKeyNow,
|
|
245
|
+
getApiKey: () => { var _a; return (_a = currentGithubApiKey()) !== null && _a !== void 0 ? _a : ""; },
|
|
226
246
|
logger,
|
|
227
247
|
}),
|
|
228
248
|
scope: cursorGithubConfig.scope,
|
|
@@ -242,7 +262,7 @@ export function startServer(mounts_1) {
|
|
|
242
262
|
},
|
|
243
263
|
};
|
|
244
264
|
for (const target of cursorGithubTargets) {
|
|
245
|
-
target.accountRuntime.credentials.bind(
|
|
265
|
+
target.accountRuntime.credentials.bind(requireGithubApiKey);
|
|
246
266
|
target.accountRuntime.credentials.bindProxyTransport(proxyTransport);
|
|
247
267
|
}
|
|
248
268
|
logger(`[agent-sdk] GitHub auth: channel API calls route through ${githubProxyUrl}`);
|
|
@@ -256,8 +276,8 @@ export function startServer(mounts_1) {
|
|
|
256
276
|
else if (githubProxyUrl !== undefined) {
|
|
257
277
|
// `cursorAccount: true` with no `--repo`: skip the startup token mint
|
|
258
278
|
// (it requires a repo list) and let github-proxy take the repo from
|
|
259
|
-
// each Octokit call. Hosted
|
|
260
|
-
//
|
|
279
|
+
// each Octokit call. Hosted freeze bakes this flag into the template
|
|
280
|
+
// so restore is GitHub-ready once Bind drops the key.
|
|
261
281
|
const proxyTransport = {
|
|
262
282
|
apiBaseUrl: githubProxyUrl,
|
|
263
283
|
headers: {
|
|
@@ -265,14 +285,14 @@ export function startServer(mounts_1) {
|
|
|
265
285
|
},
|
|
266
286
|
};
|
|
267
287
|
for (const target of cursorGithubTargets) {
|
|
268
|
-
target.accountRuntime.credentials.bind(
|
|
288
|
+
target.accountRuntime.credentials.bind(requireGithubApiKey);
|
|
269
289
|
target.accountRuntime.credentials.bindProxyTransport(proxyTransport);
|
|
270
290
|
}
|
|
271
291
|
// `ctx.host.github` gets the same proxy transport; without this it
|
|
272
292
|
// would fall back to ambient auth (env token / `gh`) or an
|
|
273
293
|
// unauthenticated Octokit, and every host GitHub call would 404.
|
|
274
294
|
hostGithubProxyResolver = createCursorGithubProxyHostResolver({
|
|
275
|
-
getApiKey:
|
|
295
|
+
getApiKey: requireGithubApiKey,
|
|
276
296
|
transport: proxyTransport,
|
|
277
297
|
});
|
|
278
298
|
logger(`[agent-sdk] GitHub auth: channel and host API calls route through ${githubProxyUrl} (repo scope per request)`);
|
|
@@ -299,7 +319,9 @@ export function startServer(mounts_1) {
|
|
|
299
319
|
if (options.allowAnonymous === true) {
|
|
300
320
|
logger("[agent-sdk] warning: --allow-anonymous admits every HTTP caller as the same principal; use only on a trusted network (e.g. Tailscale) and prefer --bearer-token for shared hosts");
|
|
301
321
|
}
|
|
302
|
-
const sdkRunner = (_t = options.runner) !== null && _t !== void 0 ? _t : new CursorSdkRunner({ apiKey
|
|
322
|
+
const sdkRunner = (_t = options.runner) !== null && _t !== void 0 ? _t : new CursorSdkRunner(Object.assign(Object.assign({}, (options.apiKey === undefined || options.apiKey.trim() === ""
|
|
323
|
+
? {}
|
|
324
|
+
: { apiKey: options.apiKey })), { logger }));
|
|
303
325
|
// Grok Bot turns run on Cursor's hosted Grok Bot (Sand) harness through
|
|
304
326
|
// the /v0/grokbot session API; the SDK side is a thin remote client. The
|
|
305
327
|
// dispatching runner is only interposed when a mount needs it. An
|
|
@@ -318,7 +340,14 @@ export function startServer(mounts_1) {
|
|
|
318
340
|
if (hasGrokBotMounts && options.runner === undefined) {
|
|
319
341
|
runner = new RuntimeDispatchingRunner({
|
|
320
342
|
sdkRunner,
|
|
321
|
-
grokbot: { apiKey
|
|
343
|
+
grokbot: Object.assign(Object.assign({}, (options.apiKey === undefined || options.apiKey.trim() === ""
|
|
344
|
+
? {}
|
|
345
|
+
: { apiKey: options.apiKey })), {
|
|
346
|
+
// `/v0/grokbot` lives on the external API (api.cursor.com), not
|
|
347
|
+
// api2. Prefer that default over the account key's backendUrl.
|
|
348
|
+
// Do not pass stored login as apiKey: that would pin it as an
|
|
349
|
+
// option and beat a later CURSOR_API_KEY_FILE bind.
|
|
350
|
+
backendUrl: cursorExternalApiUrl() }),
|
|
322
351
|
});
|
|
323
352
|
logger("[agent-sdk] grokbot runtime: remote client (turns run on the hosted Grok Bot harness)");
|
|
324
353
|
}
|
|
@@ -347,13 +376,17 @@ export function startServer(mounts_1) {
|
|
|
347
376
|
}
|
|
348
377
|
let accountBridge;
|
|
349
378
|
if (accountRefsBySlug.size > 0) {
|
|
350
|
-
if (accountKey === undefined) {
|
|
379
|
+
if (accountKey === undefined && options.allowAnonymous !== true) {
|
|
351
380
|
throw new Error(`This project has Cursor account MCP connections (defineConnection({ cursorAccount: true })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`);
|
|
352
381
|
}
|
|
382
|
+
if (accountKey === undefined) {
|
|
383
|
+
logger("[agent-sdk] Cursor account MCP: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
|
|
384
|
+
}
|
|
353
385
|
accountBridge = new CursorAccountMcpBridge({
|
|
354
386
|
client: new CursorBackendClient({
|
|
355
|
-
backendUrl: accountKey.backendUrl,
|
|
356
|
-
apiKey: accountKey.apiKey,
|
|
387
|
+
backendUrl: (_u = accountKey === null || accountKey === void 0 ? void 0 : accountKey.backendUrl) !== null && _u !== void 0 ? _u : cursorBackendUrl(),
|
|
388
|
+
apiKey: (_v = accountKey === null || accountKey === void 0 ? void 0 : accountKey.apiKey) !== null && _v !== void 0 ? _v : "",
|
|
389
|
+
getApiKey: () => { var _a; return (_a = liveCursorApiKey()) !== null && _a !== void 0 ? _a : ""; },
|
|
357
390
|
logger,
|
|
358
391
|
}),
|
|
359
392
|
logger,
|
|
@@ -364,7 +397,7 @@ export function startServer(mounts_1) {
|
|
|
364
397
|
}
|
|
365
398
|
for (const { slug, project } of mounts) {
|
|
366
399
|
// Each agent gets an isolated state root so their sessions never mix.
|
|
367
|
-
const baseStateRoot = (
|
|
400
|
+
const baseStateRoot = (_w = options.stateRoot) !== null && _w !== void 0 ? _w : join(project.rootDir, ".agent-serve");
|
|
368
401
|
const stateRoot = slug === "" ? baseStateRoot : join(baseStateRoot, slug);
|
|
369
402
|
const otelCollector = otelRuntime === undefined
|
|
370
403
|
? undefined
|
|
@@ -480,7 +513,7 @@ export function startServer(mounts_1) {
|
|
|
480
513
|
}
|
|
481
514
|
catch (error) {
|
|
482
515
|
logger(`[agent-sdk] channel "${channel.id}" onStart failed: ${error instanceof Error
|
|
483
|
-
? ((
|
|
516
|
+
? ((_x = error.stack) !== null && _x !== void 0 ? _x : error.message)
|
|
484
517
|
: String(error)}`);
|
|
485
518
|
}
|
|
486
519
|
}
|
|
@@ -620,8 +653,8 @@ export function startServer(mounts_1) {
|
|
|
620
653
|
const routeContinuation = localControlPlaneRoute(runtimes);
|
|
621
654
|
const cursorEventsCommon = {
|
|
622
655
|
config: effectiveCursorEvents,
|
|
623
|
-
githubRepos: (
|
|
624
|
-
originRepos: (
|
|
656
|
+
githubRepos: (_y = (_e = cursorGithubConfig.cursorEvents) === null || _e === void 0 ? void 0 : _e.repos) !== null && _y !== void 0 ? _y : [],
|
|
657
|
+
originRepos: (_z = cursorOriginScope === null || cursorOriginScope === void 0 ? void 0 : cursorOriginScope.repos) !== null && _z !== void 0 ? _z : [],
|
|
625
658
|
stateRoot: options.stateRoot,
|
|
626
659
|
auth: cursorEventsAuth,
|
|
627
660
|
logger,
|
|
@@ -650,9 +683,9 @@ export function startServer(mounts_1) {
|
|
|
650
683
|
const server = createServer((req, res) => {
|
|
651
684
|
void instrumentHttp(otelRuntime, req, res, () => handleRequest(router, req, res, logger));
|
|
652
685
|
});
|
|
653
|
-
const host = (
|
|
686
|
+
const host = (_0 = options.host) !== null && _0 !== void 0 ? _0 : "127.0.0.1";
|
|
654
687
|
const portWasExplicit = options.port !== undefined;
|
|
655
|
-
const requestedPort = (
|
|
688
|
+
const requestedPort = (_1 = options.port) !== null && _1 !== void 0 ? _1 : DEFAULT_SERVE_PORT;
|
|
656
689
|
let boundPort;
|
|
657
690
|
try {
|
|
658
691
|
boundPort = yield listenHttpServer({
|
|
@@ -698,7 +731,7 @@ export function startServer(mounts_1) {
|
|
|
698
731
|
runtime.project.agent.cloud !== undefined;
|
|
699
732
|
if ((hasServerTools || bridgeableNames.length > 0) && cloudCapable) {
|
|
700
733
|
const basePath = runtime.slug === "" ? "" : `/${runtime.slug}`;
|
|
701
|
-
const publicToolsUrl = (
|
|
734
|
+
const publicToolsUrl = (_2 = options.cloudToolsUrl) !== null && _2 !== void 0 ? _2 : (options.publicUrl === undefined
|
|
702
735
|
? undefined
|
|
703
736
|
: `${options.publicUrl.replace(/\/$/, "")}${basePath}${TOOL_MCP_ENDPOINT_PATH}`);
|
|
704
737
|
if (publicToolsUrl === undefined) {
|
|
@@ -715,7 +748,10 @@ export function startServer(mounts_1) {
|
|
|
715
748
|
? undefined
|
|
716
749
|
: { authorization: `Bearer ${options.authToken}` };
|
|
717
750
|
if (options.cloudToolsUrl !== undefined && headers === undefined) {
|
|
718
|
-
|
|
751
|
+
if (options.allowAnonymous !== true) {
|
|
752
|
+
throw new Error(`Agent "${runtime.project.name}" needs a Cursor API key to authenticate --cloud-tools-url. ${SIGN_IN_HINT}`);
|
|
753
|
+
}
|
|
754
|
+
logger(`[agent-sdk] --cloud-tools-url: listening unsigned; Bearer is taken from the key present at start`);
|
|
719
755
|
}
|
|
720
756
|
runtime.engine.setCloudServerToolsConnection(Object.assign({ type: "http", url: publicToolsUrl }, (headers === undefined ? {} : { headers })));
|
|
721
757
|
}
|
|
@@ -1873,6 +1909,10 @@ function startCursorDeploymentRelay(input) {
|
|
|
1873
1909
|
return undefined;
|
|
1874
1910
|
}
|
|
1875
1911
|
if (accountKey === undefined) {
|
|
1912
|
+
if (input.options.allowAnonymous === true) {
|
|
1913
|
+
logger("[agent-sdk] deployment-events: skipped while unsigned; long-poll relays need a key at start");
|
|
1914
|
+
return undefined;
|
|
1915
|
+
}
|
|
1876
1916
|
throw new Error(`This project has channels subscribed to deployment events (deploymentsChannel({ deploySourceUris })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`);
|
|
1877
1917
|
}
|
|
1878
1918
|
// Union across channels: one registration per deploy source for the whole
|
|
@@ -1946,6 +1986,10 @@ function startCursorSlackRelay(input) {
|
|
|
1946
1986
|
return undefined;
|
|
1947
1987
|
}
|
|
1948
1988
|
if (accountKey === undefined) {
|
|
1989
|
+
if (options.allowAnonymous === true) {
|
|
1990
|
+
logger("[agent-sdk] cursor-slack: skipped while unsigned; long-poll relays need a key at start");
|
|
1991
|
+
return undefined;
|
|
1992
|
+
}
|
|
1949
1993
|
throw new Error(`This project has Slack channels using the Cursor account connection (slackChannel({ cursorAccount: true })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`);
|
|
1950
1994
|
}
|
|
1951
1995
|
// Same host split as scm-events: `/v0/slack-events/*` is on api.cursor.com,
|
|
@@ -519,13 +519,20 @@ export declare class SessionEngine {
|
|
|
519
519
|
*/
|
|
520
520
|
bridgedCallAnswer(args: {
|
|
521
521
|
sessionId: string;
|
|
522
|
+
connectionName: string;
|
|
522
523
|
toolName: string;
|
|
523
|
-
}): {
|
|
524
|
+
}): Promise<{
|
|
524
525
|
answered: true;
|
|
525
526
|
result: SDKCustomToolResult;
|
|
526
527
|
} | {
|
|
527
528
|
answered: false;
|
|
528
|
-
}
|
|
529
|
+
}>;
|
|
530
|
+
/**
|
|
531
|
+
* The bounded annotations a connection's listing declares for one tool, or
|
|
532
|
+
* undefined when the tool is unlisted, unannotated, or the listing fails —
|
|
533
|
+
* all of which the policy reads as unclassified, the refusing state.
|
|
534
|
+
*/
|
|
535
|
+
private bridgedToolAnnotations;
|
|
529
536
|
private appendEvent;
|
|
530
537
|
private queueDispatch;
|
|
531
538
|
private dispatchEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-engine.d.ts","sourceRoot":"","sources":["../../src/internal/session-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAiB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAShD,OAAO,EACL,mBAAmB,EACnB,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAW1C,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEtB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAIxB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAG1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,YAAY,EAKjB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,KAAK,eAAe,EAGpB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAMpE,OAAO,EAEL,KAAK,eAAe,EAIrB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAAE,KAAK,mBAAmB,EAAiB,MAAM,gBAAgB,CAAC;AAMzE,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAS7B,OAAO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G,SAAS,GAC3B,SAAS,GAAG,SAAS,CAuBvB"}
|
|
@@ -1795,17 +1795,28 @@ export class SessionEngine {
|
|
|
1795
1795
|
try {
|
|
1796
1796
|
// Before the approval gate: a dry run is unattended, so parking a write
|
|
1797
1797
|
// for a human would hang the turn rather than answer it.
|
|
1798
|
-
const decision = decideToolCall({
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1798
|
+
const decision = decideToolCall(Object.assign(Object.assign({ dryRun: args.record.dryRun === true, effect: args.tool.definition.effect }, (args.tool.advertised === true
|
|
1799
|
+
? {
|
|
1800
|
+
mcpTool: {
|
|
1801
|
+
name: args.tool.name,
|
|
1802
|
+
annotations: args.tool.annotations,
|
|
1803
|
+
},
|
|
1804
|
+
}
|
|
1805
|
+
: {})), { dryRunResult: args.tool.definition.dryRunResult, input: validation.value }));
|
|
1804
1806
|
if (decision.kind === "answer") {
|
|
1805
1807
|
(_a = this.stubbedCallIds.get(args.record.sessionId)) === null || _a === void 0 ? void 0 : _a.add(toolCallId);
|
|
1806
1808
|
this.logger(`[session] tool ${args.tool.name} answered by host (${toolCallId})`);
|
|
1807
1809
|
return normalizeToolResult(decision.result);
|
|
1808
1810
|
}
|
|
1811
|
+
if (decision.kind === "refuse") {
|
|
1812
|
+
this.logger(`[session] tool ${args.tool.name} refused, effect unclassified (${toolCallId})`);
|
|
1813
|
+
// The coverage signal: a run reports how much of itself was runnable.
|
|
1814
|
+
args.emit({
|
|
1815
|
+
type: "action.effect_unclassified",
|
|
1816
|
+
data: { callId: toolCallId, toolName: args.tool.name },
|
|
1817
|
+
});
|
|
1818
|
+
return toolErrorResult(decision.message);
|
|
1819
|
+
}
|
|
1809
1820
|
const needsGate = yield evaluateNeedsApproval(args.tool.definition.needsApproval, validation.value);
|
|
1810
1821
|
if (needsGate) {
|
|
1811
1822
|
const decision = yield this.parkForApproval({
|
|
@@ -2027,12 +2038,9 @@ export class SessionEngine {
|
|
|
2027
2038
|
// A separate body from the model path, so it asks the same policy: a
|
|
2028
2039
|
// session-bound `POST /v1/tools/:name`, `call --session`, or
|
|
2029
2040
|
// `handle.callTool` performs a write just as readily.
|
|
2030
|
-
const decision = decideToolCall({
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
dryRunResult: tool.definition.dryRunResult,
|
|
2034
|
-
input: validation.value,
|
|
2035
|
-
});
|
|
2041
|
+
const decision = decideToolCall(Object.assign(Object.assign({ dryRun: (record === null || record === void 0 ? void 0 : record.dryRun) === true, effect: tool.definition.effect }, (tool.advertised === true
|
|
2042
|
+
? { mcpTool: { name: tool.name, annotations: tool.annotations } }
|
|
2043
|
+
: {})), { dryRunResult: tool.definition.dryRunResult, input: validation.value }));
|
|
2036
2044
|
const started = Date.now();
|
|
2037
2045
|
this.logger(`[session] tool ${toolName} start (direct ${callId})`);
|
|
2038
2046
|
let result;
|
|
@@ -2045,7 +2053,16 @@ export class SessionEngine {
|
|
|
2045
2053
|
void this.appendEvent(live.sessionId, Object.assign(Object.assign({}, payload), { turnId: callId })).catch(() => { });
|
|
2046
2054
|
};
|
|
2047
2055
|
try {
|
|
2048
|
-
if (decision.kind === "
|
|
2056
|
+
if (decision.kind === "refuse") {
|
|
2057
|
+
this.logger(`[session] tool ${toolName} refused, effect unclassified (direct ${callId})`);
|
|
2058
|
+
emit === null || emit === void 0 ? void 0 : emit({
|
|
2059
|
+
type: "action.effect_unclassified",
|
|
2060
|
+
data: { callId, toolName },
|
|
2061
|
+
});
|
|
2062
|
+
result = normalizeToolResult(toolErrorResult(decision.message));
|
|
2063
|
+
isError = true;
|
|
2064
|
+
}
|
|
2065
|
+
else if (decision.kind === "answer") {
|
|
2049
2066
|
this.logger(`[session] tool ${toolName} answered by host (direct ${callId})`);
|
|
2050
2067
|
result = normalizeToolResult(decision.result);
|
|
2051
2068
|
isError = false;
|
|
@@ -2121,21 +2138,61 @@ export class SessionEngine {
|
|
|
2121
2138
|
* next unit's work.
|
|
2122
2139
|
*/
|
|
2123
2140
|
bridgedCallAnswer(args) {
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2142
|
+
// Read off the in-flight turn's context rather than the session store:
|
|
2143
|
+
// the bridge already refuses a call with no active turn, so the record is
|
|
2144
|
+
// in memory. That keeps this free for the sessions that are not dry runs,
|
|
2145
|
+
// which is every session today — the listing below is only paid inside a
|
|
2146
|
+
// dry run.
|
|
2147
|
+
const context = this.activeToolContexts.get(args.sessionId);
|
|
2148
|
+
if ((context === null || context === void 0 ? void 0 : context.record.dryRun) !== true) {
|
|
2149
|
+
return { answered: false };
|
|
2150
|
+
}
|
|
2151
|
+
// A bridged tool carries no `defineTool`, so its effect comes from the
|
|
2152
|
+
// server's own listing annotations; a tool the listing cannot classify
|
|
2153
|
+
// refuses rather than being stubbed. A failed listing classifies nothing,
|
|
2154
|
+
// which lands on the same refusal — never on a run.
|
|
2155
|
+
const annotations = yield this.bridgedToolAnnotations(args.connectionName, args.toolName);
|
|
2156
|
+
const decision = decideToolCall({
|
|
2157
|
+
dryRun: true,
|
|
2158
|
+
effect: undefined,
|
|
2159
|
+
mcpTool: { name: args.toolName, annotations },
|
|
2160
|
+
});
|
|
2161
|
+
if (decision.kind === "run") {
|
|
2162
|
+
return { answered: false };
|
|
2163
|
+
}
|
|
2164
|
+
if (decision.kind === "refuse") {
|
|
2165
|
+
this.logger(`[session] bridged tool ${args.toolName} refused, effect unclassified (${args.sessionId})`);
|
|
2166
|
+
context.emit({
|
|
2167
|
+
type: "action.effect_unclassified",
|
|
2168
|
+
data: {
|
|
2169
|
+
callId: newToolCallId(args.toolName),
|
|
2170
|
+
toolName: args.toolName,
|
|
2171
|
+
connection: args.connectionName,
|
|
2172
|
+
},
|
|
2173
|
+
});
|
|
2174
|
+
return { answered: true, result: toolErrorResult(decision.message) };
|
|
2175
|
+
}
|
|
2176
|
+
this.logger(`[session] bridged tool ${args.toolName} answered by host (${args.sessionId})`);
|
|
2177
|
+
return { answered: true, result: normalizeToolResult(decision.result) };
|
|
2178
|
+
});
|
|
2179
|
+
}
|
|
2180
|
+
/**
|
|
2181
|
+
* The bounded annotations a connection's listing declares for one tool, or
|
|
2182
|
+
* undefined when the tool is unlisted, unannotated, or the listing fails —
|
|
2183
|
+
* all of which the policy reads as unclassified, the refusing state.
|
|
2184
|
+
*/
|
|
2185
|
+
bridgedToolAnnotations(connectionName, toolName) {
|
|
2186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2187
|
+
var _a;
|
|
2188
|
+
try {
|
|
2189
|
+
const listed = yield this.host.mcp.listTools(connectionName);
|
|
2190
|
+
return (_a = listed.find((tool) => tool.name === toolName)) === null || _a === void 0 ? void 0 : _a.annotations;
|
|
2191
|
+
}
|
|
2192
|
+
catch (_b) {
|
|
2193
|
+
return undefined;
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2139
2196
|
}
|
|
2140
2197
|
// ==========================================================================
|
|
2141
2198
|
// Events: append, dispatch to channel handlers + hooks
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* decision lives here, in one pure function, and every path asks it rather
|
|
9
9
|
* than re-implementing it.
|
|
10
10
|
*/
|
|
11
|
-
import type { ToolEffect, ToolEffectDeclaration, ToolExecuteResult } from "../types.js";
|
|
11
|
+
import type { McpToolAnnotations, ToolEffect, ToolEffectDeclaration, ToolExecuteResult } from "../types.js";
|
|
12
12
|
/** What the host does with one tool call. */
|
|
13
13
|
export type ToolDecision =
|
|
14
14
|
/** Run the tool body. */
|
|
@@ -19,6 +19,16 @@ export type ToolDecision =
|
|
|
19
19
|
| {
|
|
20
20
|
kind: "answer";
|
|
21
21
|
result: ToolExecuteResult;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Do not run it; fail the call with this message. Only ever produced in a
|
|
25
|
+
* dry run, for an MCP tool nothing classifies: stubbing it would let the
|
|
26
|
+
* run reach a confident conclusion from no data, and running it could leak
|
|
27
|
+
* a real write — refusing is the one failure that is loud.
|
|
28
|
+
*/
|
|
29
|
+
| {
|
|
30
|
+
kind: "refuse";
|
|
31
|
+
message: string;
|
|
22
32
|
};
|
|
23
33
|
/** What a policy decision needs to know about the call. */
|
|
24
34
|
export interface ToolCallFacts {
|
|
@@ -26,6 +36,17 @@ export interface ToolCallFacts {
|
|
|
26
36
|
dryRun: boolean;
|
|
27
37
|
/** The tool's declaration, if it made one. */
|
|
28
38
|
effect: ToolEffectDeclaration<never> | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Present when the call targets a tool nobody authored — an advertised MCP
|
|
41
|
+
* passthrough or a bridged MCP call. Consulted only when {@link effect} is
|
|
42
|
+
* undeclared: the server's own annotations classify the call, and a tool
|
|
43
|
+
* they cannot classify refuses in a dry run instead of being stubbed as a
|
|
44
|
+
* write the way an undeclared authored tool is.
|
|
45
|
+
*/
|
|
46
|
+
mcpTool?: {
|
|
47
|
+
name: string;
|
|
48
|
+
annotations?: McpToolAnnotations;
|
|
49
|
+
};
|
|
29
50
|
/** What a stubbed write should answer with, if the tool supplied one. */
|
|
30
51
|
dryRunResult?: ToolExecuteResult | ((input: never) => ToolExecuteResult);
|
|
31
52
|
/**
|
|
@@ -45,6 +66,17 @@ export interface ToolCallFacts {
|
|
|
45
66
|
* rather than the one that leaks a real write.
|
|
46
67
|
*/
|
|
47
68
|
export declare function resolveEffect(effect: ToolEffectDeclaration<never> | undefined, input: unknown): ToolEffect;
|
|
69
|
+
/**
|
|
70
|
+
* The effect an MCP server's own annotations declare, fail-closed.
|
|
71
|
+
*
|
|
72
|
+
* `readOnlyHint: true` without `destructiveHint: true` is a read; either
|
|
73
|
+
* negative signal is a write; anything else — absent annotations, or
|
|
74
|
+
* annotations that carry no effect signal (a bare `title`) — is `undefined`,
|
|
75
|
+
* unclassified. Mirrors `@anysphere/mcp-core/mcp-tool-annotations`
|
|
76
|
+
* (`classifyMcpToolAnnotationRisk`), which this package cannot import (npm
|
|
77
|
+
* publish, workspace-only dependency); keep the two in sync.
|
|
78
|
+
*/
|
|
79
|
+
export declare function classifyAnnotationsEffect(annotations: McpToolAnnotations | undefined): ToolEffect | undefined;
|
|
48
80
|
/** Decide what to do with one tool call. Pure; no I/O, no session state. */
|
|
49
81
|
export declare function decideToolCall(facts: ToolCallFacts): ToolDecision;
|
|
50
82
|
//# sourceMappingURL=tool-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-policy.d.ts","sourceRoot":"","sources":["../../src/internal/tool-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,6CAA6C;AAC7C,MAAM,MAAM,YAAY;AACtB,yBAAyB;AACvB;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE;AACjB,uDAAuD;GACrD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-policy.d.ts","sourceRoot":"","sources":["../../src/internal/tool-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,6CAA6C;AAC7C,MAAM,MAAM,YAAY;AACtB,yBAAyB;AACvB;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE;AACjB,uDAAuD;GACrD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE;AAC/C;;;;;GAKG;GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,MAAM,EAAE,OAAO,CAAC;IAChB,8CAA8C;IAC9C,MAAM,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IACjD;;;;;;OAMG;IACH,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,kBAAkB,CAAA;KAAE,CAAC;IAC7D,yEAAyE;IACzE,YAAY,CAAC,EAAE,iBAAiB,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,iBAAiB,CAAC,CAAC;IACzE;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAUD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAAG,SAAS,EAChD,KAAK,EAAE,OAAO,GACb,UAAU,CAIZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,kBAAkB,GAAG,SAAS,GAC1C,UAAU,GAAG,SAAS,CAiBxB;AAkBD,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CA2BjE"}
|
|
@@ -27,11 +27,64 @@ export function resolveEffect(effect, input) {
|
|
|
27
27
|
const declared = typeof effect === "function" ? effect(input) : effect;
|
|
28
28
|
return declared === "read" ? "read" : "write";
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The effect an MCP server's own annotations declare, fail-closed.
|
|
32
|
+
*
|
|
33
|
+
* `readOnlyHint: true` without `destructiveHint: true` is a read; either
|
|
34
|
+
* negative signal is a write; anything else — absent annotations, or
|
|
35
|
+
* annotations that carry no effect signal (a bare `title`) — is `undefined`,
|
|
36
|
+
* unclassified. Mirrors `@anysphere/mcp-core/mcp-tool-annotations`
|
|
37
|
+
* (`classifyMcpToolAnnotationRisk`), which this package cannot import (npm
|
|
38
|
+
* publish, workspace-only dependency); keep the two in sync.
|
|
39
|
+
*/
|
|
40
|
+
export function classifyAnnotationsEffect(annotations) {
|
|
41
|
+
if (annotations === undefined) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
if (annotations.destructiveHint !== true &&
|
|
45
|
+
annotations.readOnlyHint === true) {
|
|
46
|
+
return "read";
|
|
47
|
+
}
|
|
48
|
+
if (annotations.readOnlyHint === false ||
|
|
49
|
+
annotations.destructiveHint === true) {
|
|
50
|
+
return "write";
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* What a dry run answers when nothing classifies an MCP tool. Deliberately
|
|
56
|
+
* reads as a strict API rather than disclosing the session's posture (see
|
|
57
|
+
* {@link ACKNOWLEDGED}), and names what is missing so the fix — the server
|
|
58
|
+
* annotating, or a server-side classification entry — is one step away.
|
|
59
|
+
*/
|
|
60
|
+
function unclassifiedRefusal(toolName) {
|
|
61
|
+
return (`Tool "${toolName}" is not available in this session: its MCP server ` +
|
|
62
|
+
`does not declare whether it reads or writes (readOnlyHint/` +
|
|
63
|
+
`destructiveHint), and no server-side classification exists for it, so ` +
|
|
64
|
+
`this session cannot tell whether calling it would change anything ` +
|
|
65
|
+
`outside the session. Use a tool that declares its effect.`);
|
|
66
|
+
}
|
|
30
67
|
/** Decide what to do with one tool call. Pure; no I/O, no session state. */
|
|
31
68
|
export function decideToolCall(facts) {
|
|
32
69
|
if (!facts.dryRun) {
|
|
33
70
|
return { kind: "run" };
|
|
34
71
|
}
|
|
72
|
+
if (facts.effect === undefined && facts.mcpTool !== undefined) {
|
|
73
|
+
const effect = classifyAnnotationsEffect(facts.mcpTool.annotations);
|
|
74
|
+
if (effect === undefined) {
|
|
75
|
+
return {
|
|
76
|
+
kind: "refuse",
|
|
77
|
+
message: unclassifiedRefusal(facts.mcpTool.name),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (effect === "read") {
|
|
81
|
+
return { kind: "run" };
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
kind: "answer",
|
|
85
|
+
result: dryRunAnswer(facts.dryRunResult, facts.input),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
35
88
|
if (resolveEffect(facts.effect, facts.input) === "read") {
|
|
36
89
|
return { kind: "run" };
|
|
37
90
|
}
|