@cursor/july 0.1.86 → 0.1.88
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/dist/bin/agent-serve.js +7 -0
- package/dist/internal/advertise-tools.d.ts.map +1 -1
- package/dist/internal/advertise-tools.js +4 -2
- package/dist/internal/cli-docs.js +11 -0
- package/dist/internal/cloud-merge.d.ts +3 -1
- package/dist/internal/cloud-merge.d.ts.map +1 -1
- package/dist/internal/cloud-merge.js +10 -2
- package/dist/internal/cursor/backend-client.d.ts +4 -0
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +4 -0
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +87 -11
- package/dist/internal/docs-site.d.ts +13 -2
- package/dist/internal/docs-site.d.ts.map +1 -1
- package/dist/internal/docs-site.js +76 -13
- package/dist/internal/grokbot/runner.d.ts +61 -0
- package/dist/internal/grokbot/runner.d.ts.map +1 -0
- package/dist/internal/grokbot/runner.js +278 -0
- package/dist/internal/mcp-endpoint.js +4 -2
- package/dist/internal/mcp-host.d.ts +14 -1
- package/dist/internal/mcp-host.d.ts.map +1 -1
- package/dist/internal/mcp-host.js +41 -2
- package/dist/internal/runtime-dispatch-runner.d.ts +30 -0
- package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -0
- package/dist/internal/runtime-dispatch-runner.js +60 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +7 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +24 -1
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +36 -18
- package/dist/types.d.ts +64 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bin/agent-serve.ts +8 -0
- package/src/internal/advertise-tools.ts +6 -0
- package/src/internal/cli-docs.ts +11 -0
- package/src/internal/cloud-merge.ts +12 -2
- package/src/internal/cursor/backend-client.ts +4 -0
- package/src/internal/discovery.ts +133 -13
- package/src/internal/docs-site.ts +83 -13
- package/src/internal/grokbot/runner.ts +361 -0
- package/src/internal/mcp-endpoint.ts +4 -0
- package/src/internal/mcp-host.ts +48 -0
- package/src/internal/runtime-dispatch-runner.ts +63 -0
- package/src/internal/sdk-runner.ts +9 -0
- package/src/internal/server.ts +32 -4
- package/src/internal/session-engine.ts +40 -15
- package/src/types.ts +65 -2
package/dist/bin/agent-serve.js
CHANGED
|
@@ -283,6 +283,11 @@ Options:
|
|
|
283
283
|
githubChannel({ cursorAccount }). Admitted callers can drive
|
|
284
284
|
sessions holding the account's repo-scoped GitHub credential,
|
|
285
285
|
so use only behind a trusted boundary (e.g. an SSO proxy).
|
|
286
|
+
--allow-anonymous-grokbot
|
|
287
|
+
serve: allow --allow-anonymous together with a
|
|
288
|
+
runtime: "grokbot" mount. Admitted callers can drive turns
|
|
289
|
+
on the signed-in account's hosted Grok Bot computer, so use
|
|
290
|
+
only behind a trusted boundary (e.g. an SSO proxy).
|
|
286
291
|
--allow-anonymous-cursor-account-mcp
|
|
287
292
|
serve: allow --allow-anonymous together with
|
|
288
293
|
defineConnection({ cursorAccount: true }). Admitted callers
|
|
@@ -459,6 +464,7 @@ function main(argv) {
|
|
|
459
464
|
"allow-anonymous": { type: "boolean", default: false },
|
|
460
465
|
"allow-anonymous-cursor-github": { type: "boolean", default: false },
|
|
461
466
|
"allow-anonymous-cursor-account-mcp": { type: "boolean", default: false },
|
|
467
|
+
"allow-anonymous-grokbot": { type: "boolean", default: false },
|
|
462
468
|
"cursor-github-proxy": { type: "boolean", default: false },
|
|
463
469
|
"no-schedules": { type: "boolean", default: false },
|
|
464
470
|
"no-control-plane": { type: "boolean", default: false },
|
|
@@ -1048,6 +1054,7 @@ function main(argv) {
|
|
|
1048
1054
|
allowAnonymousCursorAccountMcp: values["allow-anonymous-cursor-account-mcp"] === true
|
|
1049
1055
|
? true
|
|
1050
1056
|
: undefined,
|
|
1057
|
+
allowAnonymousGrokbot: values["allow-anonymous-grokbot"] === true ? true : undefined,
|
|
1051
1058
|
cursorGithubProxy: values["cursor-github-proxy"] === true ? true : undefined,
|
|
1052
1059
|
schedules: values["no-schedules"] === true ? false : undefined,
|
|
1053
1060
|
noControlPlane: values["no-control-plane"] === true ? true : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advertise-tools.d.ts","sourceRoot":"","sources":["../../src/internal/advertise-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,eAAe,EAEf,aAAa,EACb,WAAW,EAEZ,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAMnD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAC9D,QAAQ,CACN,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9B,MAAM,CAAC,UAAU,EAAE,oBAAoB,GAAG,aAAa,CAAC;CACzD;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAiC,CAAC;AAO7E,2DAA2D;AAC3D,MAAM,WAAW,oBAAoB;IACnC,SAAS,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACxC,QAAQ,CACN,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,KAAK,EAAE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AAE,CAAC,CAAC;IACxC,QAAQ,CACN,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,CACV,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,gBAAgB,KACtB,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACpC,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA4B5B;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,oBAAoB,CAAC,CAwB/B;AAyFD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,iBAAiB,GACxB,MAAM,CAkBR"}
|
|
@@ -157,8 +157,10 @@ function toDiscoveredTool(connection, info, exposedName, source) {
|
|
|
157
157
|
inputSchema }, (outputSchema === undefined ? {} : { outputSchema })), { execute: (input) => __awaiter(this, void 0, void 0, function* () {
|
|
158
158
|
return formatMcpToolResult(connection.name, info.name, yield source.callTool(info.name, input !== null && input !== void 0 ? input : {}));
|
|
159
159
|
}) }));
|
|
160
|
-
return Object.assign(Object.assign({ name: exposedName, description,
|
|
161
|
-
inputSchema }, (outputSchema === undefined ? {} : { outputSchema })), { execution: "server", needsApproval: false,
|
|
160
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ name: exposedName, description,
|
|
161
|
+
inputSchema }, (outputSchema === undefined ? {} : { outputSchema })), { execution: "server", needsApproval: false }), (info.annotations === undefined
|
|
162
|
+
? {}
|
|
163
|
+
: { annotations: info.annotations })), { definition });
|
|
162
164
|
}
|
|
163
165
|
/**
|
|
164
166
|
* Render an MCP call result for the model: text parts joined, non-text
|
|
@@ -129,6 +129,17 @@ function handleDocsRequest(req, res, renderFile) {
|
|
|
129
129
|
res.end();
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
+
if (pathname === "/v1/health" || pathname === "/v1/health/") {
|
|
133
|
+
// Same path the corp ALB / ECS check uses on agent-serve. Static docs
|
|
134
|
+
// has no runtimes; liveness is "the process accepted HTTP".
|
|
135
|
+
res.writeHead(200, { "content-type": "application/json; charset=utf-8" });
|
|
136
|
+
if (method === "HEAD") {
|
|
137
|
+
res.end();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
res.end(JSON.stringify({ ok: true }));
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
132
143
|
let requestPath = "";
|
|
133
144
|
if (pathname === "/docs" || pathname === "/docs/") {
|
|
134
145
|
requestPath = "";
|
|
@@ -14,7 +14,9 @@ export declare function mergeCloudOptions(args: {
|
|
|
14
14
|
}): AgentCloudOptions | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Session turn runtime: a per-session `cloud` attach forces cloud even when
|
|
17
|
-
* the agent defaults to local (chat server tools + Drive handoff).
|
|
17
|
+
* the agent defaults to local (chat server tools + Drive handoff). A
|
|
18
|
+
* grokbot agent refuses the attach — silently moving its session onto a
|
|
19
|
+
* cloud VM would swap the harness (and the box) out from under it.
|
|
18
20
|
*/
|
|
19
21
|
export declare function resolveSessionRuntime(args: {
|
|
20
22
|
agentRuntime: AgentRuntime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-merge.d.ts","sourceRoot":"","sources":["../../src/internal/cloud-merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnE;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,IAAI,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAC;CACzC,GAAG,iBAAiB,GAAG,SAAS,CAehC;AAED
|
|
1
|
+
{"version":3,"file":"cloud-merge.d.ts","sourceRoot":"","sources":["../../src/internal/cloud-merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnE;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,IAAI,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAC;CACzC,GAAG,iBAAiB,GAAG,SAAS,CAehC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAC9C,GAAG,YAAY,CAUf"}
|
|
@@ -21,8 +21,16 @@ export function mergeCloudOptions(args) {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Session turn runtime: a per-session `cloud` attach forces cloud even when
|
|
24
|
-
* the agent defaults to local (chat server tools + Drive handoff).
|
|
24
|
+
* the agent defaults to local (chat server tools + Drive handoff). A
|
|
25
|
+
* grokbot agent refuses the attach — silently moving its session onto a
|
|
26
|
+
* cloud VM would swap the harness (and the box) out from under it.
|
|
25
27
|
*/
|
|
26
28
|
export function resolveSessionRuntime(args) {
|
|
27
|
-
|
|
29
|
+
if (args.cloudOverride === undefined) {
|
|
30
|
+
return args.agentRuntime;
|
|
31
|
+
}
|
|
32
|
+
if (args.agentRuntime === "grokbot") {
|
|
33
|
+
throw new Error('Grok Bot sessions cannot attach cloud agents: per-session `cloud` options are not supported on runtime: "grokbot". Refusing the session rather than moving it onto a cloud VM.');
|
|
34
|
+
}
|
|
35
|
+
return "cloud";
|
|
28
36
|
}
|
|
@@ -133,6 +133,10 @@ export declare class CursorBackendClient {
|
|
|
133
133
|
permissions?: "read" | "pr-write" | "contents-write";
|
|
134
134
|
}): Promise<CursorGithubToken>;
|
|
135
135
|
private rpc;
|
|
136
|
+
/**
|
|
137
|
+
* Serve a cached access token for the account, exchanging the API key
|
|
138
|
+
* when none is cached or it is near expiry.
|
|
139
|
+
*/
|
|
136
140
|
private getAccessToken;
|
|
137
141
|
private exchangeApiKey;
|
|
138
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend-client.d.ts","sourceRoot":"","sources":["../../../src/internal/cursor/backend-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,qBAAa,kBAAmB,SAAQ,KAAK;IAGzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM;IAHhC,YACE,OAAO,EAAE,MAAM,EACN,MAAM,CAAC,EAAE,MAAM,YAAA,EACf,YAAY,CAAC,EAAE,MAAM,YAAA,EAI/B;CACF;AAMD,QAAA,MAAM,mBAAmB,EAAE,CAAC,CAAC,SAAS,CACpC;IACE,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAClC,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACrC,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnC,QAAQ,E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B,sBAAsB,CAAC,IAAI,EAAE;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAmChB"}
|
|
@@ -353,6 +353,10 @@ export class CursorBackendClient {
|
|
|
353
353
|
return parseRpcResponse(method, second);
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* Serve a cached access token for the account, exchanging the API key
|
|
358
|
+
* when none is cached or it is near expiry.
|
|
359
|
+
*/
|
|
356
360
|
getAccessToken() {
|
|
357
361
|
if (this.token !== undefined &&
|
|
358
362
|
Date.now() < this.token.expiresAtMs - TOKEN_EXPIRY_LEEWAY_MS) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/internal/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkBH,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EASrB,KAAK,UAAU,EAwBhB,MAAM,aAAa,CAAC;AAgCrB,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3E;AAmBD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASrE;AAED,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,GACd,OAAO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B,CA4JnE"}
|
|
@@ -313,7 +313,7 @@ function loadAgent(ctx, agentDir, options) {
|
|
|
313
313
|
const connections = yield loadConnections(ctx, yield resolveMcpConnectionsDir(ctx, agentDir));
|
|
314
314
|
const seedFiles = yield loadSeedFiles(ctx, agentDir);
|
|
315
315
|
const subagents = yield loadSubagents(ctx, join(agentDir, "subagents"));
|
|
316
|
-
const runtime = (config === null || config === void 0 ? void 0 : config.runtime)
|
|
316
|
+
const runtime = resolveRuntime(ctx, agentDir, config === null || config === void 0 ? void 0 : config.runtime);
|
|
317
317
|
// Keep authored `cloud` even when default runtime is local — per-session
|
|
318
318
|
// `send({ cloud })` merges it under cloudOverride for handoff sessions.
|
|
319
319
|
const cloud = config === null || config === void 0 ? void 0 : config.cloud;
|
|
@@ -332,25 +332,27 @@ function loadAgent(ctx, agentDir, options) {
|
|
|
332
332
|
const allowedTools = authoredAllowlist === undefined || authoredAllowlist.includes("mcp")
|
|
333
333
|
? authoredAllowlist
|
|
334
334
|
: [...authoredAllowlist, "mcp"];
|
|
335
|
-
// The allowlist states runtime-agnostic intent, but the
|
|
336
|
-
//
|
|
337
|
-
//
|
|
338
|
-
//
|
|
339
|
-
|
|
335
|
+
// The allowlist states runtime-agnostic intent, but only the local
|
|
336
|
+
// harness can enforce it (the Cursor SDK rejects tool restrictions on
|
|
337
|
+
// cloud agents, and the Grok Bot harness has its own fixed toolset) — a
|
|
338
|
+
// non-local agent that declares one must fail at serve start, never run
|
|
339
|
+
// unrestricted. (Hybrid per-send cloud sessions fail closed in the
|
|
340
|
+
// session engine.)
|
|
341
|
+
if (allowedTools !== undefined && runtime !== "local") {
|
|
340
342
|
ctx.diagnostics.push({
|
|
341
343
|
severity: "error",
|
|
342
344
|
path: displayPath(ctx, join(agentDir, "agent.ts")),
|
|
343
|
-
message:
|
|
345
|
+
message: `tools cannot be enforced on runtime: "${runtime}". Remove \`tools\` or run the agent on the local runtime.`,
|
|
344
346
|
});
|
|
345
347
|
}
|
|
346
348
|
// Per-session connection features (defineConnection auth/advertiseTools)
|
|
347
349
|
// only run on local turns: advertised tools are in-process server tools,
|
|
348
350
|
// and per-session headers cannot reach a cloud VM's MCP config. A
|
|
349
|
-
//
|
|
350
|
-
//
|
|
351
|
-
//
|
|
351
|
+
// non-local agent that declares them must fail at serve start — never
|
|
352
|
+
// run without the connection's tools or identity. (Hybrid per-send
|
|
353
|
+
// cloud sessions fail closed in the session engine.)
|
|
352
354
|
const perSessionConnection = connections.find((connection) => connection.advertiseTools === true || connection.auth !== undefined);
|
|
353
|
-
if (perSessionConnection !== undefined && runtime
|
|
355
|
+
if (perSessionConnection !== undefined && runtime !== "local") {
|
|
354
356
|
ctx.diagnostics.push({
|
|
355
357
|
severity: "error",
|
|
356
358
|
path: displayPath(ctx, join(agentDir, "agent.ts")),
|
|
@@ -395,6 +397,19 @@ function loadAgent(ctx, agentDir, options) {
|
|
|
395
397
|
});
|
|
396
398
|
}
|
|
397
399
|
appendBuiltinTools(ctx, agentDir, tools, config === null || config === void 0 ? void 0 : config.builtinTools);
|
|
400
|
+
// After appendBuiltinTools so opted-in built-ins (server-executed) count.
|
|
401
|
+
if (runtime === "grokbot") {
|
|
402
|
+
checkGrokBotRuntimeLimitations(ctx, agentDir, {
|
|
403
|
+
serverTools: tools.filter((tool) => tool.execution === "server").length,
|
|
404
|
+
agentTools: tools.filter((tool) => tool.execution === "agent").length,
|
|
405
|
+
skills: skills.length,
|
|
406
|
+
seedFiles: seedFiles.length,
|
|
407
|
+
connections: connections.length,
|
|
408
|
+
subagents: subagents.length,
|
|
409
|
+
hasCloudOptions: cloud !== undefined,
|
|
410
|
+
hasLocalSandbox: localSandbox,
|
|
411
|
+
});
|
|
412
|
+
}
|
|
398
413
|
return Object.assign(Object.assign(Object.assign(Object.assign({ name, description: config === null || config === void 0 ? void 0 : config.description,
|
|
399
414
|
// Root agents always get a concrete model: authored value or DEFAULT_MODEL.
|
|
400
415
|
model: isValidModelSetting(config === null || config === void 0 ? void 0 : config.model) ? config.model : DEFAULT_MODEL, instructions,
|
|
@@ -1263,6 +1278,67 @@ function appendBuiltinTools(ctx, agentDir, tools, config) {
|
|
|
1263
1278
|
tools.push(tool);
|
|
1264
1279
|
}
|
|
1265
1280
|
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Validate the authored runtime. An unrecognized value is an error
|
|
1283
|
+
* diagnostic and falls back to local — a typo must not silently pick a
|
|
1284
|
+
* different harness for every turn.
|
|
1285
|
+
*/
|
|
1286
|
+
function resolveRuntime(ctx, agentDir, runtime) {
|
|
1287
|
+
if (runtime === undefined ||
|
|
1288
|
+
runtime === "local" ||
|
|
1289
|
+
runtime === "cloud" ||
|
|
1290
|
+
runtime === "grokbot") {
|
|
1291
|
+
return runtime !== null && runtime !== void 0 ? runtime : "local";
|
|
1292
|
+
}
|
|
1293
|
+
ctx.diagnostics.push({
|
|
1294
|
+
severity: "error",
|
|
1295
|
+
path: displayPath(ctx, join(agentDir, "agent.ts")),
|
|
1296
|
+
message: `runtime must be "local", "cloud", or "grokbot"; got ${JSON.stringify(runtime)}.`,
|
|
1297
|
+
});
|
|
1298
|
+
return "local";
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Grok Bot turns run on the Sand harness with its own toolset: authored
|
|
1302
|
+
* server tools, MCP connections, and subagents have no path onto that
|
|
1303
|
+
* toolset yet, so an agent declaring them must fail at serve start rather
|
|
1304
|
+
* than run with capabilities silently missing.
|
|
1305
|
+
*/
|
|
1306
|
+
function checkGrokBotRuntimeLimitations(ctx, agentDir, counts) {
|
|
1307
|
+
const agentPath = displayPath(ctx, join(agentDir, "agent.ts"));
|
|
1308
|
+
const error = (path, message) => {
|
|
1309
|
+
ctx.diagnostics.push({ severity: "error", path, message });
|
|
1310
|
+
};
|
|
1311
|
+
const warn = (path, message) => {
|
|
1312
|
+
ctx.diagnostics.push({ severity: "warning", path, message });
|
|
1313
|
+
};
|
|
1314
|
+
if (counts.serverTools > 0) {
|
|
1315
|
+
error(displayPath(ctx, join(agentDir, "tools")), 'Server tools (execution: "server", including opted-in builtinTools) are not reachable from grokbot turns yet. Remove them or run the agent on the local runtime.');
|
|
1316
|
+
}
|
|
1317
|
+
if (counts.connections > 0) {
|
|
1318
|
+
error(displayPath(ctx, join(agentDir, "mcp-connections")), "MCP connections are not wired into grokbot turns yet. Remove them or run the agent on the local runtime.");
|
|
1319
|
+
}
|
|
1320
|
+
if (counts.subagents > 0) {
|
|
1321
|
+
error(displayPath(ctx, join(agentDir, "subagents")), "Authored subagents are not available on grokbot turns (the Grok Bot harness runs its own subagent set). Remove them or run the agent on the local runtime.");
|
|
1322
|
+
}
|
|
1323
|
+
// The remaining declarations mirror the cloud runtime's warnings: the
|
|
1324
|
+
// turn runs on a hosted machine (the account's box), so local-workspace
|
|
1325
|
+
// materialization never reaches it.
|
|
1326
|
+
if (counts.agentTools > 0) {
|
|
1327
|
+
warn(displayPath(ctx, join(agentDir, "tools")), 'Agent tools (execution: "agent") are described in the hosted session\'s instructions (with script bodies); they are not written onto the box filesystem automatically.');
|
|
1328
|
+
}
|
|
1329
|
+
if (counts.skills > 0) {
|
|
1330
|
+
warn(displayPath(ctx, join(agentDir, "skills")), "Authored skills are materialized into the local session workspace only; the hosted Grok Bot box does not see them.");
|
|
1331
|
+
}
|
|
1332
|
+
if (counts.seedFiles > 0) {
|
|
1333
|
+
warn(displayPath(ctx, join(agentDir, "sandbox")), "sandbox/workspace seed files apply to the local session workspace only; grokbot turns run on the account's hosted box.");
|
|
1334
|
+
}
|
|
1335
|
+
if (counts.hasCloudOptions) {
|
|
1336
|
+
warn(agentPath, 'The `cloud` block is unused on runtime: "grokbot", and grokbot sessions refuse per-session cloud attach.');
|
|
1337
|
+
}
|
|
1338
|
+
if (counts.hasLocalSandbox) {
|
|
1339
|
+
warn(agentPath, 'local.sandbox does not apply to runtime: "grokbot"; the box is the account\'s Cursor-hosted computer.');
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1266
1342
|
function warnCloudRuntimeLimitations(ctx, agentDir, counts) {
|
|
1267
1343
|
const agentPath = displayPath(ctx, join(agentDir, "agent.ts"));
|
|
1268
1344
|
if (!counts.hasCloudOptions) {
|
|
@@ -6,10 +6,21 @@
|
|
|
6
6
|
* resolve under the mount). `serve` auto-builds it when the local
|
|
7
7
|
* vitepress toolchain is present (source checkouts); published installs
|
|
8
8
|
* ship the prebuilt site inside `dist/**`.
|
|
9
|
+
*
|
|
10
|
+
* Set `AGENT_SERVE_DOCS_DIST` to an overlay directory that contains a built
|
|
11
|
+
* site (`index.html`). When that path exists, `/docs` is served from it so a
|
|
12
|
+
* long-lived host (corp ECS) can pick up the published `@cursor/july` docs
|
|
13
|
+
* without rebuilding the process image. Requests re-read the path, so an
|
|
14
|
+
* atomic symlink swap is visible without a restart.
|
|
15
|
+
*/
|
|
16
|
+
/** Absolute path of the VitePress site shipped in this install (ignores overlay). */
|
|
17
|
+
export declare function shippedDocsDistDir(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Directory `/docs` is served from. Prefers `AGENT_SERVE_DOCS_DIST` when that
|
|
20
|
+
* overlay has a built site; otherwise the install's `dist/docs/`.
|
|
9
21
|
*/
|
|
10
|
-
/** Absolute path of the built VitePress site shipped in this install. */
|
|
11
22
|
export declare function docsDistDir(): string;
|
|
12
|
-
/** Whether
|
|
23
|
+
/** Whether a built docs site is available at `distDir` (overlay or shipped). */
|
|
13
24
|
export declare function docsSiteExists(distDir?: string): boolean;
|
|
14
25
|
/**
|
|
15
26
|
* Resolve a request path under the docs mount to a file inside the built
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-site.d.ts","sourceRoot":"","sources":["../../src/internal/docs-site.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"docs-site.d.ts","sourceRoot":"","sources":["../../src/internal/docs-site.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0DH,qFAAqF;AACrF,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAMpC;AAED,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,MAAsB,GAC9B,MAAM,GAAG,SAAS,CAyBpB;AAED,+CAA+C;AAC/C,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,MAAsB,GAC9B,QAAQ,CAqCV;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAkB,GAC3C,OAAO,CAAC,IAAI,CAAC,CA8Bf"}
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
* resolve under the mount). `serve` auto-builds it when the local
|
|
7
7
|
* vitepress toolchain is present (source checkouts); published installs
|
|
8
8
|
* ship the prebuilt site inside `dist/**`.
|
|
9
|
+
*
|
|
10
|
+
* Set `AGENT_SERVE_DOCS_DIST` to an overlay directory that contains a built
|
|
11
|
+
* site (`index.html`). When that path exists, `/docs` is served from it so a
|
|
12
|
+
* long-lived host (corp ECS) can pick up the published `@cursor/july` docs
|
|
13
|
+
* without rebuilding the process image. Requests re-read the path, so an
|
|
14
|
+
* atomic symlink swap is visible without a restart.
|
|
9
15
|
*/
|
|
10
16
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
11
17
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -17,20 +23,69 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
17
23
|
});
|
|
18
24
|
};
|
|
19
25
|
import { spawn } from "node:child_process";
|
|
20
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
26
|
+
import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
21
27
|
import { createRequire } from "node:module";
|
|
22
28
|
import { dirname, extname, join, normalize, sep } from "node:path";
|
|
23
29
|
import { fileURLToPath } from "node:url";
|
|
24
30
|
import { STATIC_CONTENT_TYPES } from "./playground/static.js";
|
|
25
31
|
// src|dist/internal/docs-site.ts → packages/agent-serve/dist/docs/.
|
|
26
32
|
const DOCS_DIST_DIR = fileURLToPath(new URL("../../dist/docs/", import.meta.url));
|
|
27
|
-
|
|
33
|
+
const DOCS_OVERLAY_ENV = "AGENT_SERVE_DOCS_DIST";
|
|
34
|
+
function realDir(dir) {
|
|
35
|
+
try {
|
|
36
|
+
return realpathSync(dir);
|
|
37
|
+
}
|
|
38
|
+
catch (_a) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function isInsideRoot(fileReal, rootReal) {
|
|
43
|
+
const prefix = rootReal.endsWith(sep) ? rootReal : `${rootReal}${sep}`;
|
|
44
|
+
return fileReal === rootReal || fileReal.startsWith(prefix);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolve `candidate` to a regular file whose real path stays under
|
|
48
|
+
* `rootReal`. Follows overlay / site-root symlinks, but refuses a planted
|
|
49
|
+
* symlink (or hard-linked path) that escapes the docs tree.
|
|
50
|
+
*/
|
|
51
|
+
function containedFile(candidate, rootReal) {
|
|
52
|
+
try {
|
|
53
|
+
const real = realpathSync(candidate);
|
|
54
|
+
if (!isInsideRoot(real, rootReal) || !statSync(real).isFile()) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
return real;
|
|
58
|
+
}
|
|
59
|
+
catch (_a) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function hasDocsIndex(distDir) {
|
|
64
|
+
const root = realDir(distDir);
|
|
65
|
+
if (root === undefined) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return containedFile(join(distDir, "index.html"), root) !== undefined;
|
|
69
|
+
}
|
|
70
|
+
/** Absolute path of the VitePress site shipped in this install (ignores overlay). */
|
|
71
|
+
export function shippedDocsDistDir() {
|
|
72
|
+
return DOCS_DIST_DIR;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Directory `/docs` is served from. Prefers `AGENT_SERVE_DOCS_DIST` when that
|
|
76
|
+
* overlay has a built site; otherwise the install's `dist/docs/`.
|
|
77
|
+
*/
|
|
28
78
|
export function docsDistDir() {
|
|
79
|
+
var _a;
|
|
80
|
+
const overlay = (_a = process.env[DOCS_OVERLAY_ENV]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
81
|
+
if (overlay !== undefined && overlay !== "" && hasDocsIndex(overlay)) {
|
|
82
|
+
return overlay;
|
|
83
|
+
}
|
|
29
84
|
return DOCS_DIST_DIR;
|
|
30
85
|
}
|
|
31
|
-
/** Whether
|
|
32
|
-
export function docsSiteExists(distDir =
|
|
33
|
-
return
|
|
86
|
+
/** Whether a built docs site is available at `distDir` (overlay or shipped). */
|
|
87
|
+
export function docsSiteExists(distDir = docsDistDir()) {
|
|
88
|
+
return hasDocsIndex(distDir);
|
|
34
89
|
}
|
|
35
90
|
/**
|
|
36
91
|
* Resolve a request path under the docs mount to a file inside the built
|
|
@@ -38,7 +93,7 @@ export function docsSiteExists(distDir = DOCS_DIST_DIR) {
|
|
|
38
93
|
* emits one `.html` per page, so clean URLs resolve through the chain:
|
|
39
94
|
* exact file → directory `index.html` → `<path>.html`.
|
|
40
95
|
*/
|
|
41
|
-
export function resolveDocsFile(requestPath, distDir =
|
|
96
|
+
export function resolveDocsFile(requestPath, distDir = docsDistDir()) {
|
|
42
97
|
const decoded = requestPath
|
|
43
98
|
.split("/")
|
|
44
99
|
.filter((part) => part !== "")
|
|
@@ -47,20 +102,25 @@ export function resolveDocsFile(requestPath, distDir = DOCS_DIST_DIR) {
|
|
|
47
102
|
if (normalized.startsWith("..") || normalized.includes(`..${sep}`)) {
|
|
48
103
|
return undefined;
|
|
49
104
|
}
|
|
105
|
+
const rootReal = realDir(distDir);
|
|
106
|
+
if (rootReal === undefined) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
50
109
|
const root = distDir.endsWith(sep) ? distDir : `${distDir}${sep}`;
|
|
51
110
|
const base = join(root, normalized);
|
|
52
111
|
if (base !== root.slice(0, -1) && !base.startsWith(root)) {
|
|
53
112
|
return undefined;
|
|
54
113
|
}
|
|
55
114
|
for (const candidate of [base, join(base, "index.html"), `${base}.html`]) {
|
|
56
|
-
|
|
57
|
-
|
|
115
|
+
const file = containedFile(candidate, rootReal);
|
|
116
|
+
if (file !== undefined) {
|
|
117
|
+
return file;
|
|
58
118
|
}
|
|
59
119
|
}
|
|
60
120
|
return undefined;
|
|
61
121
|
}
|
|
62
122
|
/** Serve one path from the built docs site. */
|
|
63
|
-
export function renderDocsFile(requestPath, distDir =
|
|
123
|
+
export function renderDocsFile(requestPath, distDir = docsDistDir()) {
|
|
64
124
|
var _a;
|
|
65
125
|
if (!docsSiteExists(distDir)) {
|
|
66
126
|
return new Response(fallbackHtml(), {
|
|
@@ -70,8 +130,11 @@ export function renderDocsFile(requestPath, distDir = DOCS_DIST_DIR) {
|
|
|
70
130
|
}
|
|
71
131
|
const filePath = resolveDocsFile(requestPath, distDir);
|
|
72
132
|
if (filePath === undefined) {
|
|
73
|
-
const
|
|
74
|
-
|
|
133
|
+
const root = realDir(distDir);
|
|
134
|
+
const notFound = root === undefined
|
|
135
|
+
? undefined
|
|
136
|
+
: containedFile(join(distDir, "404.html"), root);
|
|
137
|
+
return new Response(notFound !== undefined ? readFileSync(notFound, "utf8") : "Not found", {
|
|
75
138
|
status: 404,
|
|
76
139
|
headers: { "content-type": "text/html; charset=utf-8" },
|
|
77
140
|
});
|
|
@@ -98,7 +161,7 @@ export function renderDocsFile(requestPath, distDir = DOCS_DIST_DIR) {
|
|
|
98
161
|
*/
|
|
99
162
|
export function ensureDocsSiteBundle() {
|
|
100
163
|
return __awaiter(this, arguments, void 0, function* (logger = console.log) {
|
|
101
|
-
if (docsSiteExists()) {
|
|
164
|
+
if (docsSiteExists(DOCS_DIST_DIR)) {
|
|
102
165
|
return;
|
|
103
166
|
}
|
|
104
167
|
const toolchain = resolveDocsToolchain();
|
|
@@ -115,7 +178,7 @@ export function ensureDocsSiteBundle() {
|
|
|
115
178
|
if (code !== 0) {
|
|
116
179
|
throw new Error(`docs vitepress build failed (exit ${code})`);
|
|
117
180
|
}
|
|
118
|
-
if (!docsSiteExists()) {
|
|
181
|
+
if (!docsSiteExists(DOCS_DIST_DIR)) {
|
|
119
182
|
throw new Error("docs vitepress build finished but dist/docs/index.html is missing");
|
|
120
183
|
}
|
|
121
184
|
logger("[agent-sdk] docs site build complete");
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The grokbot runtime's remote client — a thin client like `"cloud"`.
|
|
3
|
+
* Turns execute on Cursor's hosted Grok Bot (Sand) harness (the Temporal
|
|
4
|
+
* turn workflow and the account's own computer), reached through the
|
|
5
|
+
* public `/v0/grokbot` session API.
|
|
6
|
+
*
|
|
7
|
+
* Sand delivery contract, preserved end to end: only content the agent
|
|
8
|
+
* delivers through SendToUser becomes the user-visible reply. The hosted
|
|
9
|
+
* transcript exposes those deliveries as `send-message` entries; the
|
|
10
|
+
* agent's internal monologue never appears in the transcript, so it can
|
|
11
|
+
* never leak into the session reply.
|
|
12
|
+
*/
|
|
13
|
+
import type { RunnerTurnRequest, TurnOutcome } from "../../types.js";
|
|
14
|
+
import type { AgentRunner } from "./../sdk-runner.js";
|
|
15
|
+
export interface GrokBotRunnerOptions {
|
|
16
|
+
/** Cursor API key. Defaults to the `CURSOR_API_KEY` environment variable. */
|
|
17
|
+
apiKey?: string;
|
|
18
|
+
/** Test seam. Defaults to global fetch. */
|
|
19
|
+
fetchImpl?: typeof fetch;
|
|
20
|
+
/** Test seam. Defaults to {@link cursorBackendUrl}. */
|
|
21
|
+
backendUrl?: string;
|
|
22
|
+
/** Test seam. Poll interval while a turn runs. */
|
|
23
|
+
pollIntervalMs?: number;
|
|
24
|
+
/** Test seam. Hard turn deadline. */
|
|
25
|
+
turnTimeoutMs?: number;
|
|
26
|
+
}
|
|
27
|
+
/** One transcript entry as `/v0/grokbot/sessions/:id/entries` exposes it. */
|
|
28
|
+
export interface GrokBotEntry {
|
|
29
|
+
seq: string;
|
|
30
|
+
updatedSeq: string;
|
|
31
|
+
kind: string;
|
|
32
|
+
role?: string;
|
|
33
|
+
text?: string;
|
|
34
|
+
createdAtMs: number;
|
|
35
|
+
}
|
|
36
|
+
export declare class GrokBotRunner implements AgentRunner {
|
|
37
|
+
private readonly options;
|
|
38
|
+
/**
|
|
39
|
+
* One hosted Grok Bot agent per SDK agent name — the backend
|
|
40
|
+
* get-or-creates by name, so every SDK session forwards into the same
|
|
41
|
+
* hosted agent and conversation, and the Grok Bot app shows one agent
|
|
42
|
+
* rather than one per session.
|
|
43
|
+
*/
|
|
44
|
+
private readonly agents;
|
|
45
|
+
/**
|
|
46
|
+
* Per-hosted-agent turn chain. Sessions share one hosted conversation
|
|
47
|
+
* and one transcript cursor, so turns run one at a time per agent:
|
|
48
|
+
* deliveries attribute to the turn that sent them, and an abort only
|
|
49
|
+
* interrupts its own turn — mirroring the hosted workflow's own queue.
|
|
50
|
+
*/
|
|
51
|
+
private readonly turns;
|
|
52
|
+
private client;
|
|
53
|
+
constructor(options?: GrokBotRunnerOptions);
|
|
54
|
+
runTurn(request: RunnerTurnRequest): Promise<TurnOutcome>;
|
|
55
|
+
private executeTurn;
|
|
56
|
+
dispose(): Promise<void>;
|
|
57
|
+
private ensureClient;
|
|
58
|
+
private getAgent;
|
|
59
|
+
private sleep;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/internal/grokbot/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EA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