@cursor/july 0.1.20 → 0.1.21
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 +0 -0
- package/dist/channels/github/instrument.d.ts +20 -0
- package/dist/channels/github/instrument.d.ts.map +1 -0
- package/dist/channels/slack/api.d.ts +2 -0
- package/dist/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +3 -0
- package/dist/channels/slack/bot-mentions.d.ts +106 -0
- package/dist/channels/slack/bot-mentions.d.ts.map +1 -0
- package/dist/channels/slack/bot-mentions.js +243 -0
- package/dist/channels/slack/dispatch.d.ts +6 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +24 -3
- package/dist/channels/slack/inbound.d.ts +10 -1
- package/dist/channels/slack/inbound.d.ts.map +1 -1
- package/dist/channels/slack/inbound.js +12 -4
- package/dist/channels/slack/index.d.ts +1 -0
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +1 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +61 -22
- package/dist/channels/slack/types.d.ts +58 -0
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/docs/404.html +1 -1
- package/dist/docs/ab.html +2 -2
- package/dist/docs/assets/{app.T-5ImnM3.js → app.jDxLzWv4.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DoJHJjqF.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.OMGMWH6H.js → VPLocalSearchBox.Y6bDR1-a.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DLg4yB4D.js → theme.CLazCWlJ.js} +2 -2
- package/dist/docs/building-with-agents.html +2 -2
- package/dist/docs/concepts.html +2 -2
- package/dist/docs/deployment.html +2 -2
- package/dist/docs/evals.html +2 -2
- package/dist/docs/example-agents/approval-buddy.html +2 -2
- package/dist/docs/example-agents/benny.html +2 -2
- package/dist/docs/example-agents/bugbot.html +2 -2
- package/dist/docs/example-agents/codebase-wiki.html +2 -2
- package/dist/docs/example-agents/codeowners-review.html +2 -2
- package/dist/docs/example-agents/concierge.html +2 -2
- package/dist/docs/example-agents/fsd.html +2 -2
- package/dist/docs/example-agents/index.html +2 -2
- package/dist/docs/example-agents/knowledge-base.html +2 -2
- package/dist/docs/example-agents/oncall.html +2 -2
- package/dist/docs/example-agents/security-reviewer.html +2 -2
- package/dist/docs/example-agents/slack-agent.html +2 -2
- package/dist/docs/example-agents/weather-agent.html +2 -2
- package/dist/docs/guides/agent-to-agent.html +2 -2
- package/dist/docs/guides/cloud-runtime.html +2 -2
- package/dist/docs/guides/github.html +2 -2
- package/dist/docs/guides/human-in-the-loop.html +2 -2
- package/dist/docs/guides/mcp-oauth.html +2 -2
- package/dist/docs/guides/slack.html +2 -2
- package/dist/docs/guides/webhooks.html +2 -2
- package/dist/docs/hillclimbing.html +2 -2
- package/dist/docs/index.html +2 -2
- package/dist/docs/quickstart.html +2 -2
- package/dist/docs/reference/agent-config.html +2 -2
- package/dist/docs/reference/channels.html +2 -2
- package/dist/docs/reference/cli.html +2 -2
- package/dist/docs/reference/connections.html +2 -2
- package/dist/docs/reference/hooks.html +2 -2
- package/dist/docs/reference/http-api.html +2 -2
- package/dist/docs/reference/instructions.html +2 -2
- package/dist/docs/reference/playground.html +2 -2
- package/dist/docs/reference/project-layout.html +2 -2
- package/dist/docs/reference/prompt.html +2 -2
- package/dist/docs/reference/schedules.html +2 -2
- package/dist/docs/reference/sessions.html +2 -2
- package/dist/docs/reference/skills.html +2 -2
- package/dist/docs/reference/subagents.html +2 -2
- package/dist/docs/reference/tools.html +2 -2
- package/dist/docs/scaffolding-agents.html +2 -2
- package/dist/docs/storage.html +2 -2
- package/dist/docs/troubleshooting.html +2 -2
- package/dist/internal/json-dir-store.d.ts +32 -0
- package/dist/internal/json-dir-store.d.ts.map +1 -0
- package/dist/internal/json-dir-store.js +100 -0
- package/dist/internal/resolved-connections.d.ts +1 -1
- package/dist/internal/resolved-connections.d.ts.map +1 -1
- package/dist/internal/resolved-connections.js +10 -0
- package/dist/internal/session-engine.d.ts +4 -1
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +13 -2
- package/dist/playground/assets/index-CjOQ4hN9.css +1 -0
- package/dist/playground/assets/index-dshZQJCp.js +85 -0
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +9 -0
- package/package.json +24 -24
- package/src/bin/agent-serve.version.test.ts +62 -0
- package/src/channels/github/api.test.ts +64 -0
- package/src/channels/github/auth.test.ts +105 -0
- package/src/channels/github/cursor-account.test.ts +204 -0
- package/src/channels/github/forward.test.ts +457 -0
- package/src/channels/github/github.test.ts +937 -0
- package/src/channels/github/replay.test.ts +179 -0
- package/src/channels/slack/api.post-message.test.ts +148 -0
- package/src/channels/slack/api.ts +5 -0
- package/src/channels/slack/approvals.test.ts +328 -0
- package/src/channels/slack/block-actions.test.ts +452 -0
- package/src/channels/slack/bot-mentions.test.ts +217 -0
- package/src/channels/slack/bot-mentions.ts +315 -0
- package/src/channels/slack/channel-watch.test.ts +363 -0
- package/src/channels/slack/cursor-account.test.ts +253 -0
- package/src/channels/slack/defaults.final-post.test.ts +182 -0
- package/src/channels/slack/dispatch.test.ts +795 -0
- package/src/channels/slack/dispatch.ts +27 -1
- package/src/channels/slack/eval-directive.test.ts +273 -0
- package/src/channels/slack/inbound.ts +25 -4
- package/src/channels/slack/index.ts +1 -0
- package/src/channels/slack/message-body.test.ts +54 -0
- package/src/channels/slack/nudge-store.test.ts +143 -0
- package/src/channels/slack/slack-channel.ts +66 -8
- package/src/channels/slack/slack.test.ts +391 -0
- package/src/channels/slack/stop.test.ts +23 -0
- package/src/channels/slack/thread-context.test.ts +202 -0
- package/src/channels/slack/types.ts +60 -0
- package/src/evals/assertions.test.ts +580 -0
- package/src/evals/expect.test.ts +144 -0
- package/src/evals/judge.test.ts +181 -0
- package/src/evals/loaders.test.ts +132 -0
- package/src/evals/matchers.test.ts +95 -0
- package/src/evals/reporters.test.ts +303 -0
- package/src/evals/run-facts.test.ts +259 -0
- package/src/internal/ab-snapshot.test.ts +325 -0
- package/src/internal/approval-gate.test.ts +49 -0
- package/src/internal/approvals.integration.test.ts +383 -0
- package/src/internal/authored-loaders.test.ts +31 -0
- package/src/internal/builtin-tools/reminders.test.ts +201 -0
- package/src/internal/channel-route-schema.test.ts +294 -0
- package/src/internal/chat-attach.test.ts +262 -0
- package/src/internal/cli-deploy.test.ts +1991 -0
- package/src/internal/cli-mcp.test.ts +789 -0
- package/src/internal/cli-skills.test.ts +133 -0
- package/src/internal/cli-slack.test.ts +1647 -0
- package/src/internal/cloud-merge.test.ts +74 -0
- package/src/internal/cron.test.ts +22 -0
- package/src/internal/cursor/account-mcp.test.ts +807 -0
- package/src/internal/cursor/backend-client.test.ts +591 -0
- package/src/internal/cursor/credentials.test.ts +351 -0
- package/src/internal/cursor/github-credentials.test.ts +136 -0
- package/src/internal/cursor-account-mcp-auth.test.ts +310 -0
- package/src/internal/cursor-account.integration.test.ts +441 -0
- package/src/internal/cursor-event-relay.test.ts +746 -0
- package/src/internal/cursor-github-credentials.integration.test.ts +271 -0
- package/src/internal/cursor-slack-relay.test.ts +525 -0
- package/src/internal/deploy-source.test.ts +111 -0
- package/src/internal/discovery.builtin-tools.test.ts +94 -0
- package/src/internal/discovery.concurrency.test.ts +60 -0
- package/src/internal/discovery.cursor-account.test.ts +133 -0
- package/src/internal/discovery.cwd.test.ts +83 -0
- package/src/internal/discovery.hosting.test.ts +80 -0
- package/src/internal/discovery.identity.test.ts +44 -0
- package/src/internal/docs-site.test.ts +66 -0
- package/src/internal/duration.test.ts +29 -0
- package/src/internal/eval-judge-model.test.ts +187 -0
- package/src/internal/eval-run-store.cancel.test.ts +142 -0
- package/src/internal/eval-run-store.storage.test.ts +211 -0
- package/src/internal/eval-runner.http.test.ts +403 -0
- package/src/internal/eval-runner.run.test.ts +928 -0
- package/src/internal/evals-client.test.ts +307 -0
- package/src/internal/event-mapper.test.ts +243 -0
- package/src/internal/github-fanout.test.ts +213 -0
- package/src/internal/handleAgentServeTrigger.test.ts +179 -0
- package/src/internal/host-kv.test.ts +82 -0
- package/src/internal/host-platforms.test.ts +126 -0
- package/src/internal/http-channel.test.ts +402 -0
- package/src/internal/init-project.test.ts +269 -0
- package/src/internal/install-cursor-skills.test.ts +262 -0
- package/src/internal/local-env.test.ts +100 -0
- package/src/internal/log-ring.test.ts +31 -0
- package/src/internal/logs-client.test.ts +350 -0
- package/src/internal/mcp-endpoint.test.ts +436 -0
- package/src/internal/mcp-host.test.ts +298 -0
- package/src/internal/mcp-oauth.test.ts +148 -0
- package/src/internal/net.test.ts +17 -0
- package/src/internal/peer-connections.test.ts +128 -0
- package/src/internal/peer-mcp.integration.test.ts +289 -0
- package/src/internal/playground/toolchain.test.ts +53 -0
- package/src/internal/playground-cli.test.ts +187 -0
- package/src/internal/playground-proxy.test.ts +376 -0
- package/src/internal/prompt-context.integration.test.ts +232 -0
- package/src/internal/prompt-context.test.ts +127 -0
- package/src/internal/reminder-runner.test.ts +390 -0
- package/src/internal/reminder-store.test.ts +53 -0
- package/src/internal/request-headers.test.ts +27 -0
- package/src/internal/resolve-prod-target.test.ts +787 -0
- package/src/internal/resolved-connections.test.ts +295 -0
- package/src/internal/resolved-connections.ts +18 -1
- package/src/internal/router.test.ts +57 -0
- package/src/internal/sdk-runner.test.ts +290 -0
- package/src/internal/session-engine.coalesce.test.ts +169 -0
- package/src/internal/session-engine.concurrency.test.ts +250 -0
- package/src/internal/session-engine.host-oauth-mcp.test.ts +110 -0
- package/src/internal/session-engine.interrupt.test.ts +577 -0
- package/src/internal/session-engine.storage.test.ts +547 -0
- package/src/internal/session-engine.ts +15 -1
- package/src/internal/session-urls.test.ts +28 -0
- package/src/internal/sessions-client.test.ts +518 -0
- package/src/internal/storage-coordinator.test.ts +517 -0
- package/src/internal/tool-call.test.ts +458 -0
- package/src/internal/tool-result.test.ts +52 -0
- package/src/internal/trajectory.approvals.test.ts +83 -0
- package/src/internal/trajectory.subagents.test.ts +198 -0
- package/src/internal/turn-governor.test.ts +137 -0
- package/src/internal/update-check.test.ts +485 -0
- package/src/internal/workspace.test.ts +81 -0
- package/src/storage-backends/cursor-hosted.test.ts +121 -0
- package/src/types.ts +12 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.CvejISXF.js +0 -1
- package/dist/playground/assets/index-CidizGZv.css +0 -1
- package/dist/playground/assets/index-CuiAKZaP.js +0 -85
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { getGithubCursorAccountRuntime } from "../channels/github/cursor-account.js";
|
|
6
|
+
import { githubChannel } from "../channels/github/github-channel.js";
|
|
7
|
+
import { httpChannel } from "../channels.js";
|
|
8
|
+
import type {
|
|
9
|
+
AgentProject,
|
|
10
|
+
AgentServeHandle,
|
|
11
|
+
ChannelDefinition,
|
|
12
|
+
} from "../types.js";
|
|
13
|
+
import type { AgentRunner } from "./sdk-runner.js";
|
|
14
|
+
import { startServer } from "./server.js";
|
|
15
|
+
|
|
16
|
+
interface RecordedRequest {
|
|
17
|
+
method: string;
|
|
18
|
+
url: string;
|
|
19
|
+
body?: unknown;
|
|
20
|
+
authorization?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe("serve with cursor-account GitHub channels", () => {
|
|
24
|
+
const savedEnv: Record<string, string | undefined> = {};
|
|
25
|
+
const requests: RecordedRequest[] = [];
|
|
26
|
+
let stateRoot: string | undefined;
|
|
27
|
+
let handle: AgentServeHandle | undefined;
|
|
28
|
+
|
|
29
|
+
const runner: AgentRunner = {
|
|
30
|
+
async runTurn() {
|
|
31
|
+
return { status: "finished", result: "unused" };
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function fixture(
|
|
36
|
+
cursorAccount: true | { repos: readonly string[] } = {
|
|
37
|
+
repos: ["acme/widgets", "acme/tools"],
|
|
38
|
+
}
|
|
39
|
+
): AgentProject {
|
|
40
|
+
return {
|
|
41
|
+
rootDir: "/tmp/cursor-github-fixture",
|
|
42
|
+
agentDir: "/tmp/cursor-github-fixture/agent",
|
|
43
|
+
name: "github-fixture",
|
|
44
|
+
agent: {
|
|
45
|
+
name: "github-fixture",
|
|
46
|
+
runtime: "local",
|
|
47
|
+
tools: [],
|
|
48
|
+
skills: [],
|
|
49
|
+
connections: [],
|
|
50
|
+
subagents: [],
|
|
51
|
+
seedFiles: [],
|
|
52
|
+
},
|
|
53
|
+
httpChannel: httpChannel(),
|
|
54
|
+
channels: [
|
|
55
|
+
{
|
|
56
|
+
id: "github",
|
|
57
|
+
definition: githubChannel({
|
|
58
|
+
cursorAccount,
|
|
59
|
+
}) as unknown as ChannelDefinition,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
schedules: [],
|
|
63
|
+
hooks: [],
|
|
64
|
+
abs: [],
|
|
65
|
+
diagnostics: [],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
beforeEach(() => {
|
|
70
|
+
requests.length = 0;
|
|
71
|
+
for (const key of [
|
|
72
|
+
"AGENT_SERVE_CONFIG_DIR",
|
|
73
|
+
"CURSOR_API_BASE_URL",
|
|
74
|
+
"CURSOR_API_KEY",
|
|
75
|
+
"GH_TOKEN",
|
|
76
|
+
]) {
|
|
77
|
+
savedEnv[key] = process.env[key];
|
|
78
|
+
delete process.env[key];
|
|
79
|
+
}
|
|
80
|
+
process.env.AGENT_SERVE_CONFIG_DIR = "/nonexistent-agent-serve-config";
|
|
81
|
+
vi.stubGlobal(
|
|
82
|
+
"fetch",
|
|
83
|
+
async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
84
|
+
const url = String(input);
|
|
85
|
+
const headers = new Headers(init?.headers);
|
|
86
|
+
const authorization = headers.get("authorization");
|
|
87
|
+
const body =
|
|
88
|
+
typeof init?.body === "string"
|
|
89
|
+
? (JSON.parse(init.body) as unknown)
|
|
90
|
+
: undefined;
|
|
91
|
+
requests.push({
|
|
92
|
+
method: init?.method ?? "GET",
|
|
93
|
+
url,
|
|
94
|
+
...(body === undefined ? {} : { body }),
|
|
95
|
+
...(authorization === null ? {} : { authorization }),
|
|
96
|
+
});
|
|
97
|
+
if (url.endsWith("/v0/scm-events/github-token")) {
|
|
98
|
+
return Response.json({
|
|
99
|
+
token: "ghs_cursor_account",
|
|
100
|
+
expiresAt: new Date(Date.now() + 45 * 60_000).toISOString(),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (url.includes("/v0/scm-events/subscriptions")) {
|
|
104
|
+
const subscriptions =
|
|
105
|
+
(
|
|
106
|
+
body as
|
|
107
|
+
| {
|
|
108
|
+
subscriptions?: Array<{
|
|
109
|
+
provider: string;
|
|
110
|
+
repo: string;
|
|
111
|
+
}>;
|
|
112
|
+
}
|
|
113
|
+
| undefined
|
|
114
|
+
)?.subscriptions ?? [];
|
|
115
|
+
return Response.json({
|
|
116
|
+
repos: subscriptions.map((subscription) => ({
|
|
117
|
+
...subscription,
|
|
118
|
+
isSubscribed: true,
|
|
119
|
+
})),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return Response.json({
|
|
123
|
+
events: [],
|
|
124
|
+
nextOffset: "",
|
|
125
|
+
gapDetected: false,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
afterEach(async () => {
|
|
132
|
+
await handle?.close();
|
|
133
|
+
handle = undefined;
|
|
134
|
+
if (stateRoot !== undefined) {
|
|
135
|
+
await rm(stateRoot, { recursive: true, force: true });
|
|
136
|
+
stateRoot = undefined;
|
|
137
|
+
}
|
|
138
|
+
vi.unstubAllGlobals();
|
|
139
|
+
for (const [key, value] of Object.entries(savedEnv)) {
|
|
140
|
+
if (value === undefined) {
|
|
141
|
+
delete process.env[key];
|
|
142
|
+
} else {
|
|
143
|
+
process.env[key] = value;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("requires the host to be signed in to Cursor", async () => {
|
|
149
|
+
stateRoot = await mkdtemp(join(tmpdir(), "agent-serve-cursor-github-"));
|
|
150
|
+
await expect(
|
|
151
|
+
startServer([{ slug: "", project: fixture() }], {
|
|
152
|
+
port: 0,
|
|
153
|
+
stateRoot,
|
|
154
|
+
playground: false,
|
|
155
|
+
runner,
|
|
156
|
+
})
|
|
157
|
+
).rejects.toThrow(
|
|
158
|
+
/cursor-events[\s\S]*signed-in Cursor[\s\S]*agentkit login/
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it("mints one credential covering every selected repository", async () => {
|
|
163
|
+
stateRoot = await mkdtemp(join(tmpdir(), "agent-serve-cursor-github-"));
|
|
164
|
+
process.env.CURSOR_API_KEY = "crsr_account";
|
|
165
|
+
process.env.CURSOR_API_BASE_URL = "https://backend.example";
|
|
166
|
+
const project = fixture();
|
|
167
|
+
const logs: string[] = [];
|
|
168
|
+
|
|
169
|
+
handle = await startServer([{ slug: "", project }], {
|
|
170
|
+
port: 0,
|
|
171
|
+
stateRoot,
|
|
172
|
+
playground: false,
|
|
173
|
+
runner,
|
|
174
|
+
logger: (line) => logs.push(line),
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const tokenRequest = requests.find((request) =>
|
|
178
|
+
request.url.endsWith("/v0/scm-events/github-token")
|
|
179
|
+
);
|
|
180
|
+
expect(tokenRequest).toMatchObject({
|
|
181
|
+
method: "POST",
|
|
182
|
+
body: {
|
|
183
|
+
repos: ["acme/widgets", "acme/tools"],
|
|
184
|
+
permissions: "pr-write",
|
|
185
|
+
},
|
|
186
|
+
authorization: "Bearer crsr_account",
|
|
187
|
+
});
|
|
188
|
+
expect(process.env.GH_TOKEN).toBe("ghs_cursor_account");
|
|
189
|
+
const definition = project.channels[0]?.definition;
|
|
190
|
+
if (definition === undefined) {
|
|
191
|
+
throw new Error("GitHub fixture channel is missing.");
|
|
192
|
+
}
|
|
193
|
+
const accountRuntime = getGithubCursorAccountRuntime(definition);
|
|
194
|
+
await expect(accountRuntime?.credentials.getToken()).resolves.toBe(
|
|
195
|
+
"ghs_cursor_account"
|
|
196
|
+
);
|
|
197
|
+
expect(
|
|
198
|
+
logs.some((line) =>
|
|
199
|
+
line.includes("Cursor account repo-scoped credential")
|
|
200
|
+
)
|
|
201
|
+
).toBe(true);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it("does not expose signed-in GitHub access through anonymous serving", async () => {
|
|
205
|
+
stateRoot = await mkdtemp(join(tmpdir(), "agent-serve-cursor-github-"));
|
|
206
|
+
process.env.CURSOR_API_KEY = "crsr_account";
|
|
207
|
+
process.env.CURSOR_API_BASE_URL = "https://backend.example";
|
|
208
|
+
|
|
209
|
+
await expect(
|
|
210
|
+
startServer([{ slug: "", project: fixture() }], {
|
|
211
|
+
port: 0,
|
|
212
|
+
stateRoot,
|
|
213
|
+
playground: false,
|
|
214
|
+
runner,
|
|
215
|
+
allowAnonymous: true,
|
|
216
|
+
})
|
|
217
|
+
).rejects.toThrow(/cannot be served with --allow-anonymous/);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("serves anonymously when allowAnonymousCursorGithub opts in", async () => {
|
|
221
|
+
stateRoot = await mkdtemp(join(tmpdir(), "agent-serve-cursor-github-"));
|
|
222
|
+
process.env.CURSOR_API_KEY = "crsr_account";
|
|
223
|
+
process.env.CURSOR_API_BASE_URL = "https://backend.example";
|
|
224
|
+
const logs: string[] = [];
|
|
225
|
+
|
|
226
|
+
handle = await startServer([{ slug: "", project: fixture() }], {
|
|
227
|
+
port: 0,
|
|
228
|
+
stateRoot,
|
|
229
|
+
playground: false,
|
|
230
|
+
runner,
|
|
231
|
+
allowAnonymous: true,
|
|
232
|
+
allowAnonymousCursorGithub: true,
|
|
233
|
+
logger: (line) => logs.push(line),
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
expect(
|
|
237
|
+
requests.find((request) =>
|
|
238
|
+
request.url.endsWith("/v0/scm-events/github-token")
|
|
239
|
+
)
|
|
240
|
+
).toBeDefined();
|
|
241
|
+
expect(
|
|
242
|
+
logs.some((line) => line.includes("--allow-anonymous-cursor-github"))
|
|
243
|
+
).toBe(true);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
it("accepts repository scope from serve options with cursorAccount true", async () => {
|
|
247
|
+
stateRoot = await mkdtemp(join(tmpdir(), "agent-serve-cursor-github-"));
|
|
248
|
+
process.env.CURSOR_API_BASE_URL = "https://backend.example";
|
|
249
|
+
|
|
250
|
+
handle = await startServer([{ slug: "", project: fixture(true) }], {
|
|
251
|
+
port: 0,
|
|
252
|
+
stateRoot,
|
|
253
|
+
playground: false,
|
|
254
|
+
runner,
|
|
255
|
+
cursorEvents: {
|
|
256
|
+
repos: ["acme/widgets"],
|
|
257
|
+
apiKey: "crsr_nested",
|
|
258
|
+
baseUrl: "https://backend.example",
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
expect(
|
|
263
|
+
requests.find((request) =>
|
|
264
|
+
request.url.endsWith("/v0/scm-events/github-token")
|
|
265
|
+
)
|
|
266
|
+
).toMatchObject({
|
|
267
|
+
body: { repos: ["acme/widgets"] },
|
|
268
|
+
authorization: "Bearer crsr_nested",
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
});
|