@cursor/july 0.1.89 → 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 +20 -7
- 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/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/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/backend-client.d.ts +9 -1
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +19 -6
- 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/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/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/playground/assets/index-BpVS-paP.css +1 -0
- 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 +2 -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/src/ab.ts +1 -1
- package/src/artifacts.ts +1 -1
- package/src/bin/agent-serve.ts +20 -6
- 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/cli-convert-automation.ts +1 -1
- package/src/internal/cli-cursor.ts +18 -5
- package/src/internal/convert-automation/convert-workflow.ts +9 -9
- package/src/internal/convert-automation/types.ts +1 -1
- package/src/internal/cursor/backend-client.ts +29 -4
- package/src/internal/cursor/credentials.ts +87 -24
- 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/sdk-runner.ts +10 -4
- package/src/internal/server.ts +95 -33
- 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 +2 -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-DQGZnAI0.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/playground/assets/{index-BmiIjFlM.js → index-DxapiDj_.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,
|