@cursor/july 0.1.23 → 0.1.24

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.
Files changed (174) hide show
  1. package/dist/bin/agent-serve.js +0 -0
  2. package/dist/docs/404.html +1 -1
  3. package/dist/docs/ab.html +2 -2
  4. package/dist/docs/assets/{app.DYcC9FY-.js → app.CvSGaAxk.js} +1 -1
  5. package/dist/docs/assets/chunks/@localSearchIndexroot.CL2Y0Zmh.js +1 -0
  6. package/dist/docs/assets/chunks/{VPLocalSearchBox.o4N_knTV.js → VPLocalSearchBox.J1jJbCvs.js} +1 -1
  7. package/dist/docs/assets/chunks/{theme.DQ-njyo0.js → theme.C7vfzr7h.js} +2 -2
  8. package/dist/docs/building-with-agents.html +2 -2
  9. package/dist/docs/concepts.html +2 -2
  10. package/dist/docs/deployment.html +2 -2
  11. package/dist/docs/evals.html +2 -2
  12. package/dist/docs/example-agents/approval-buddy.html +2 -2
  13. package/dist/docs/example-agents/benny.html +2 -2
  14. package/dist/docs/example-agents/bugbot.html +2 -2
  15. package/dist/docs/example-agents/codebase-wiki.html +2 -2
  16. package/dist/docs/example-agents/codeowners-review.html +2 -2
  17. package/dist/docs/example-agents/concierge.html +2 -2
  18. package/dist/docs/example-agents/fsd.html +2 -2
  19. package/dist/docs/example-agents/index.html +2 -2
  20. package/dist/docs/example-agents/knowledge-base.html +2 -2
  21. package/dist/docs/example-agents/oncall.html +2 -2
  22. package/dist/docs/example-agents/security-reviewer.html +2 -2
  23. package/dist/docs/example-agents/slack-agent.html +2 -2
  24. package/dist/docs/example-agents/weather-agent.html +2 -2
  25. package/dist/docs/guides/agent-to-agent.html +2 -2
  26. package/dist/docs/guides/cloud-runtime.html +2 -2
  27. package/dist/docs/guides/github.html +2 -2
  28. package/dist/docs/guides/human-in-the-loop.html +2 -2
  29. package/dist/docs/guides/mcp-oauth.html +2 -2
  30. package/dist/docs/guides/slack.html +2 -2
  31. package/dist/docs/guides/webhooks.html +2 -2
  32. package/dist/docs/hillclimbing.html +2 -2
  33. package/dist/docs/index.html +2 -2
  34. package/dist/docs/quickstart.html +2 -2
  35. package/dist/docs/reference/agent-config.html +2 -2
  36. package/dist/docs/reference/channels.html +2 -2
  37. package/dist/docs/reference/cli.html +2 -2
  38. package/dist/docs/reference/connections.html +2 -2
  39. package/dist/docs/reference/hooks.html +2 -2
  40. package/dist/docs/reference/http-api.html +2 -2
  41. package/dist/docs/reference/instructions.html +2 -2
  42. package/dist/docs/reference/playground.html +2 -2
  43. package/dist/docs/reference/project-layout.html +2 -2
  44. package/dist/docs/reference/prompt.html +2 -2
  45. package/dist/docs/reference/schedules.html +2 -2
  46. package/dist/docs/reference/sessions.html +2 -2
  47. package/dist/docs/reference/skills.html +2 -2
  48. package/dist/docs/reference/subagents.html +2 -2
  49. package/dist/docs/reference/tools.html +2 -2
  50. package/dist/docs/scaffolding-agents.html +2 -2
  51. package/dist/docs/storage.html +2 -2
  52. package/dist/docs/troubleshooting.html +2 -2
  53. package/dist/playground/assets/index-CidizGZv.css +1 -0
  54. package/dist/playground/assets/{index-DqXdAFGa.js → index-DTG9OsPV.js} +41 -41
  55. package/dist/playground/index.html +2 -2
  56. package/package.json +24 -24
  57. package/dist/channels/github/instrument.d.ts +0 -20
  58. package/dist/channels/github/instrument.d.ts.map +0 -1
  59. package/dist/docs/assets/chunks/@localSearchIndexroot.BQTzJjR_.js +0 -1
  60. package/dist/internal/json-dir-store.d.ts +0 -32
  61. package/dist/internal/json-dir-store.d.ts.map +0 -1
  62. package/dist/internal/json-dir-store.js +0 -100
  63. package/dist/playground/assets/index-CjOQ4hN9.css +0 -1
  64. package/src/bin/agent-serve.version.test.ts +0 -64
  65. package/src/channels/github/api.test.ts +0 -64
  66. package/src/channels/github/auth.test.ts +0 -105
  67. package/src/channels/github/cursor-account.test.ts +0 -204
  68. package/src/channels/github/forward.test.ts +0 -457
  69. package/src/channels/github/github.test.ts +0 -937
  70. package/src/channels/github/replay.test.ts +0 -179
  71. package/src/channels/slack/api.post-message.test.ts +0 -148
  72. package/src/channels/slack/approvals.test.ts +0 -328
  73. package/src/channels/slack/block-actions.test.ts +0 -452
  74. package/src/channels/slack/bot-mentions.test.ts +0 -267
  75. package/src/channels/slack/channel-watch.test.ts +0 -363
  76. package/src/channels/slack/cursor-account.test.ts +0 -253
  77. package/src/channels/slack/defaults.final-post.test.ts +0 -182
  78. package/src/channels/slack/dispatch.test.ts +0 -795
  79. package/src/channels/slack/eval-directive.test.ts +0 -273
  80. package/src/channels/slack/message-body.test.ts +0 -54
  81. package/src/channels/slack/nudge-store.test.ts +0 -143
  82. package/src/channels/slack/slack.test.ts +0 -391
  83. package/src/channels/slack/stop.test.ts +0 -23
  84. package/src/channels/slack/thread-context.test.ts +0 -202
  85. package/src/evals/assertions.test.ts +0 -580
  86. package/src/evals/expect.test.ts +0 -144
  87. package/src/evals/judge.test.ts +0 -181
  88. package/src/evals/loaders.test.ts +0 -132
  89. package/src/evals/matchers.test.ts +0 -95
  90. package/src/evals/reporters.test.ts +0 -303
  91. package/src/evals/run-facts.test.ts +0 -259
  92. package/src/internal/ab-snapshot.test.ts +0 -325
  93. package/src/internal/approval-gate.test.ts +0 -49
  94. package/src/internal/approvals.integration.test.ts +0 -383
  95. package/src/internal/authored-loaders.test.ts +0 -31
  96. package/src/internal/builtin-tools/reminders.test.ts +0 -201
  97. package/src/internal/channel-route-schema.test.ts +0 -294
  98. package/src/internal/chat-attach.test.ts +0 -262
  99. package/src/internal/cli-deploy.test.ts +0 -1991
  100. package/src/internal/cli-docs.test.ts +0 -161
  101. package/src/internal/cli-mcp.test.ts +0 -789
  102. package/src/internal/cli-skills.test.ts +0 -133
  103. package/src/internal/cli-slack.test.ts +0 -1647
  104. package/src/internal/cloud-merge.test.ts +0 -74
  105. package/src/internal/cron.test.ts +0 -22
  106. package/src/internal/cursor/account-mcp.test.ts +0 -807
  107. package/src/internal/cursor/backend-client.test.ts +0 -591
  108. package/src/internal/cursor/credentials.test.ts +0 -351
  109. package/src/internal/cursor/github-credentials.test.ts +0 -136
  110. package/src/internal/cursor-account-mcp-auth.test.ts +0 -310
  111. package/src/internal/cursor-account.integration.test.ts +0 -441
  112. package/src/internal/cursor-event-relay.test.ts +0 -746
  113. package/src/internal/cursor-github-credentials.integration.test.ts +0 -271
  114. package/src/internal/cursor-slack-relay.test.ts +0 -525
  115. package/src/internal/deploy-source.test.ts +0 -111
  116. package/src/internal/discovery.builtin-tools.test.ts +0 -94
  117. package/src/internal/discovery.concurrency.test.ts +0 -60
  118. package/src/internal/discovery.cursor-account.test.ts +0 -133
  119. package/src/internal/discovery.cwd.test.ts +0 -83
  120. package/src/internal/discovery.hosting.test.ts +0 -80
  121. package/src/internal/discovery.identity.test.ts +0 -44
  122. package/src/internal/docs-site.test.ts +0 -66
  123. package/src/internal/duration.test.ts +0 -29
  124. package/src/internal/eval-judge-model.test.ts +0 -187
  125. package/src/internal/eval-run-store.cancel.test.ts +0 -142
  126. package/src/internal/eval-run-store.storage.test.ts +0 -211
  127. package/src/internal/eval-runner.http.test.ts +0 -403
  128. package/src/internal/eval-runner.run.test.ts +0 -928
  129. package/src/internal/evals-client.test.ts +0 -307
  130. package/src/internal/event-mapper.test.ts +0 -243
  131. package/src/internal/github-fanout.test.ts +0 -213
  132. package/src/internal/handleAgentServeTrigger.test.ts +0 -179
  133. package/src/internal/host-kv.test.ts +0 -82
  134. package/src/internal/host-platforms.test.ts +0 -126
  135. package/src/internal/http-channel.test.ts +0 -402
  136. package/src/internal/init-project.test.ts +0 -270
  137. package/src/internal/install-cursor-skills.test.ts +0 -262
  138. package/src/internal/local-env.test.ts +0 -120
  139. package/src/internal/log-ring.test.ts +0 -31
  140. package/src/internal/logs-client.test.ts +0 -350
  141. package/src/internal/mcp-endpoint.test.ts +0 -436
  142. package/src/internal/mcp-host.test.ts +0 -298
  143. package/src/internal/mcp-oauth.test.ts +0 -148
  144. package/src/internal/net.test.ts +0 -17
  145. package/src/internal/peer-connections.test.ts +0 -128
  146. package/src/internal/peer-mcp.integration.test.ts +0 -289
  147. package/src/internal/playground/toolchain.test.ts +0 -53
  148. package/src/internal/playground-cli.test.ts +0 -187
  149. package/src/internal/playground-proxy.test.ts +0 -376
  150. package/src/internal/prompt-context.integration.test.ts +0 -232
  151. package/src/internal/prompt-context.test.ts +0 -127
  152. package/src/internal/reminder-runner.test.ts +0 -390
  153. package/src/internal/reminder-store.test.ts +0 -53
  154. package/src/internal/request-headers.test.ts +0 -27
  155. package/src/internal/resolve-prod-target.test.ts +0 -787
  156. package/src/internal/resolved-connections.test.ts +0 -295
  157. package/src/internal/router.test.ts +0 -57
  158. package/src/internal/sdk-runner.test.ts +0 -290
  159. package/src/internal/session-engine.coalesce.test.ts +0 -169
  160. package/src/internal/session-engine.concurrency.test.ts +0 -250
  161. package/src/internal/session-engine.host-oauth-mcp.test.ts +0 -110
  162. package/src/internal/session-engine.interrupt.test.ts +0 -577
  163. package/src/internal/session-engine.storage.test.ts +0 -547
  164. package/src/internal/session-urls.test.ts +0 -28
  165. package/src/internal/sessions-client.test.ts +0 -518
  166. package/src/internal/storage-coordinator.test.ts +0 -517
  167. package/src/internal/tool-call.test.ts +0 -458
  168. package/src/internal/tool-result.test.ts +0 -52
  169. package/src/internal/trajectory.approvals.test.ts +0 -83
  170. package/src/internal/trajectory.subagents.test.ts +0 -198
  171. package/src/internal/turn-governor.test.ts +0 -137
  172. package/src/internal/update-check.test.ts +0 -485
  173. package/src/internal/workspace.test.ts +0 -207
  174. package/src/storage-backends/cursor-hosted.test.ts +0 -121
@@ -1,271 +0,0 @@
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
- });