@cursor/july 0.1.39 → 0.1.40
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/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +18 -8
- package/dist/channels/slack/defaults.d.ts.map +1 -1
- package/dist/channels/slack/defaults.js +26 -17
- package/dist/channels/slack/live-delivery.d.ts.map +1 -1
- package/dist/channels/slack/live-delivery.js +16 -4
- package/dist/docs/404.html +1 -1
- package/dist/docs/ab.html +2 -2
- package/dist/docs/assets/{app.BQ8Hihdf.js → app.DpGLSiym.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.D82_RVtF.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.BBCr8Yuy.js → VPLocalSearchBox.B11XEMST.js} +1 -1
- package/dist/docs/assets/chunks/{theme.CK_NiGC-.js → theme.iTidHsAx.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/artifacts.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/cli-mcp-oauth.d.ts.map +1 -1
- package/dist/internal/cli-mcp-oauth.js +3 -1
- package/dist/internal/cursor-event-relay.d.ts +45 -0
- package/dist/internal/cursor-event-relay.d.ts.map +1 -1
- package/dist/internal/cursor-event-relay.js +96 -2
- package/dist/internal/mcp-oauth.d.ts +12 -1
- package/dist/internal/mcp-oauth.d.ts.map +1 -1
- package/dist/internal/mcp-oauth.js +25 -3
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +6 -2
- package/dist/playground/assets/{index-_2WKw9a-.js → index-Bc1oFgFG.js} +49 -49
- package/dist/playground/index.html +1 -1
- package/package.json +1 -1
- package/src/channels/slack/api.ts +19 -14
- package/src/channels/slack/defaults.ts +34 -18
- package/src/channels/slack/live-delivery.ts +17 -3
- package/src/internal/cli-mcp-oauth.ts +3 -1
- package/src/internal/cursor-event-relay.ts +168 -0
- package/src/internal/mcp-oauth.ts +29 -4
- package/src/internal/server.ts +8 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.B-VTH4As.js +0 -1
|
@@ -36,22 +36,44 @@ export function formatCursorScmEventLog(event) {
|
|
|
36
36
|
const delivery = (_a = event.deliveryId) !== null && _a !== void 0 ? _a : "no delivery id";
|
|
37
37
|
return `${event.eventName}${action} on ${pr} received=${received}${occurred} (${delivery})`;
|
|
38
38
|
}
|
|
39
|
+
/** Relay log suffix for one fan-out target, including parse errors on 4xx. */
|
|
40
|
+
export function formatCursorScmDispatchOutcome(target) {
|
|
41
|
+
const slug = target.slug === "" ? "default" : target.slug;
|
|
42
|
+
if (target.status < 400) {
|
|
43
|
+
return `${slug}:${target.status}`;
|
|
44
|
+
}
|
|
45
|
+
const error = readDispatchError(target.body);
|
|
46
|
+
return error === undefined
|
|
47
|
+
? `${slug}:${target.status}`
|
|
48
|
+
: `${slug}:${target.status} ${error}`;
|
|
49
|
+
}
|
|
50
|
+
function readDispatchError(body) {
|
|
51
|
+
if (typeof body !== "object" || body === null)
|
|
52
|
+
return undefined;
|
|
53
|
+
if (!("error" in body))
|
|
54
|
+
return undefined;
|
|
55
|
+
const error = body.error;
|
|
56
|
+
return typeof error === "string" && error !== "" ? error : undefined;
|
|
57
|
+
}
|
|
39
58
|
/**
|
|
40
59
|
* Minimal GitHub webhook body from an SCM-events metadata envelope.
|
|
41
60
|
* When `pullRequest` has title + head/base refs+shas, emits a Zod-valid
|
|
42
61
|
* `pull_request` object for `onPullRequest`; otherwise identity-only stubs.
|
|
43
62
|
* When `comment` is present, emits a Zod-valid `comment` object so relayed
|
|
44
63
|
* `issue_comment` / `pull_request_review_comment` deliveries dispatch.
|
|
64
|
+
* When a CI snapshot is present, emits `check_run` / `check_suite` /
|
|
65
|
+
* `workflow_run` so those typed hooks parse on the `--cursor-events` path.
|
|
45
66
|
*/
|
|
46
67
|
export function scmMetadataToGitHubPayload(event) {
|
|
47
68
|
var _a, _b, _c;
|
|
69
|
+
var _d, _e, _f, _g, _h;
|
|
48
70
|
const slash = event.repo.indexOf("/");
|
|
49
71
|
const owner = slash === -1 ? "" : event.repo.slice(0, slash);
|
|
50
72
|
const name = slash === -1 ? event.repo : event.repo.slice(slash + 1);
|
|
51
73
|
const repoUrl = `https://github.com/${event.repo}`;
|
|
52
74
|
const prMeta = event.pullRequest;
|
|
53
|
-
const prNumber = (
|
|
54
|
-
const prUrl = (
|
|
75
|
+
const prNumber = (_d = prMeta === null || prMeta === void 0 ? void 0 : prMeta.number) !== null && _d !== void 0 ? _d : event.prNumber;
|
|
76
|
+
const prUrl = (_f = (_e = prMeta === null || prMeta === void 0 ? void 0 : prMeta.url) !== null && _e !== void 0 ? _e : event.prUrl) !== null && _f !== void 0 ? _f : (prNumber !== undefined ? `${repoUrl}/pull/${prNumber}` : undefined);
|
|
55
77
|
const payload = {
|
|
56
78
|
repository: {
|
|
57
79
|
full_name: event.repo,
|
|
@@ -96,6 +118,20 @@ export function scmMetadataToGitHubPayload(event) {
|
|
|
96
118
|
}
|
|
97
119
|
payload.comment = comment;
|
|
98
120
|
}
|
|
121
|
+
const checkPullRequests = stubGitHubCiPullRequests({
|
|
122
|
+
snapshot: (_h = (_g = (_a = event.checkRun) === null || _a === void 0 ? void 0 : _a.pullRequests) !== null && _g !== void 0 ? _g : (_b = event.checkSuite) === null || _b === void 0 ? void 0 : _b.pullRequests) !== null && _h !== void 0 ? _h : (_c = event.workflowRun) === null || _c === void 0 ? void 0 : _c.pullRequests,
|
|
123
|
+
prNumber,
|
|
124
|
+
prUrl,
|
|
125
|
+
});
|
|
126
|
+
if (event.checkRun !== undefined) {
|
|
127
|
+
payload.check_run = stubGitHubCheckRun(event.checkRun, checkPullRequests);
|
|
128
|
+
}
|
|
129
|
+
if (event.checkSuite !== undefined) {
|
|
130
|
+
payload.check_suite = stubGitHubCheckSuite(event.checkSuite, checkPullRequests);
|
|
131
|
+
}
|
|
132
|
+
if (event.workflowRun !== undefined) {
|
|
133
|
+
payload.workflow_run = stubGitHubWorkflowRun(event.workflowRun, checkPullRequests);
|
|
134
|
+
}
|
|
99
135
|
const title = prMeta === null || prMeta === void 0 ? void 0 : prMeta.title;
|
|
100
136
|
const headRef = prMeta === null || prMeta === void 0 ? void 0 : prMeta.headRef;
|
|
101
137
|
const headSha = prMeta === null || prMeta === void 0 ? void 0 : prMeta.headSha;
|
|
@@ -143,6 +179,64 @@ export function scmMetadataToGitHubPayload(event) {
|
|
|
143
179
|
}
|
|
144
180
|
return payload;
|
|
145
181
|
}
|
|
182
|
+
function stubGitHubCiPullRequests(input) {
|
|
183
|
+
if (input.snapshot !== undefined && input.snapshot.length > 0) {
|
|
184
|
+
return input.snapshot.map((pr) => (Object.assign({ number: pr.number }, (pr.url === undefined ? {} : { html_url: pr.url }))));
|
|
185
|
+
}
|
|
186
|
+
if (input.prNumber === undefined)
|
|
187
|
+
return [];
|
|
188
|
+
return [
|
|
189
|
+
Object.assign({ number: input.prNumber }, (input.prUrl === undefined ? {} : { html_url: input.prUrl })),
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
function stubGitHubCiApp(app) {
|
|
193
|
+
if (app === undefined)
|
|
194
|
+
return undefined;
|
|
195
|
+
const out = {};
|
|
196
|
+
if (app.slug !== undefined)
|
|
197
|
+
out.slug = app.slug;
|
|
198
|
+
if (app.name !== undefined)
|
|
199
|
+
out.name = app.name;
|
|
200
|
+
return out;
|
|
201
|
+
}
|
|
202
|
+
function stubGitHubCiBase(meta, pullRequests) {
|
|
203
|
+
const object = {
|
|
204
|
+
id: meta.id,
|
|
205
|
+
head_sha: meta.headSha,
|
|
206
|
+
};
|
|
207
|
+
if (meta.status !== undefined)
|
|
208
|
+
object.status = meta.status;
|
|
209
|
+
if (meta.conclusion !== undefined)
|
|
210
|
+
object.conclusion = meta.conclusion;
|
|
211
|
+
if (meta.htmlUrl !== undefined)
|
|
212
|
+
object.html_url = meta.htmlUrl;
|
|
213
|
+
const app = stubGitHubCiApp(meta.app);
|
|
214
|
+
if (app !== undefined)
|
|
215
|
+
object.app = app;
|
|
216
|
+
if (pullRequests.length > 0)
|
|
217
|
+
object.pull_requests = pullRequests;
|
|
218
|
+
return object;
|
|
219
|
+
}
|
|
220
|
+
function stubGitHubCheckRun(meta, pullRequests) {
|
|
221
|
+
const object = stubGitHubCiBase(meta, pullRequests);
|
|
222
|
+
if (meta.name !== undefined)
|
|
223
|
+
object.name = meta.name;
|
|
224
|
+
if (meta.checkSuiteId !== undefined) {
|
|
225
|
+
object.check_suite = { id: meta.checkSuiteId };
|
|
226
|
+
}
|
|
227
|
+
return object;
|
|
228
|
+
}
|
|
229
|
+
function stubGitHubCheckSuite(meta, pullRequests) {
|
|
230
|
+
return stubGitHubCiBase(meta, pullRequests);
|
|
231
|
+
}
|
|
232
|
+
function stubGitHubWorkflowRun(meta, pullRequests) {
|
|
233
|
+
const object = stubGitHubCiBase(meta, pullRequests);
|
|
234
|
+
if (meta.name !== undefined)
|
|
235
|
+
object.name = meta.name;
|
|
236
|
+
if (meta.workflowId !== undefined)
|
|
237
|
+
object.workflow_id = meta.workflowId;
|
|
238
|
+
return object;
|
|
239
|
+
}
|
|
146
240
|
/**
|
|
147
241
|
* GitHub SCM-events relay: a thin {@link CursorRelayCore} adapter. Consumers
|
|
148
242
|
* keep the same `new CursorEventRelay(options).start()/.stop()` surface.
|
|
@@ -78,7 +78,18 @@ export type OAuthCallbackResult = {
|
|
|
78
78
|
code: string;
|
|
79
79
|
state?: string;
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Deliberately not `@anysphere/mcp-core/oauth/loopback`, which is the canonical
|
|
83
|
+
* implementation every other Cursor surface shares. `@cursor/july` publishes to
|
|
84
|
+
* public npm with no private workspace dependencies, and its OAuth state is a
|
|
85
|
+
* bare UUID rather than the payload that module's validator expects.
|
|
86
|
+
*
|
|
87
|
+
* Nothing here reads Statsig, so this listener is outside
|
|
88
|
+
* `unified_mcp_loopback`: turning that gate off restores the other surfaces'
|
|
89
|
+
* original servers but leaves this one, and its state check, in place.
|
|
90
|
+
*/
|
|
91
|
+
export declare function waitForMcpOAuthCallback(args: {
|
|
92
|
+
authorizationUrl: string;
|
|
82
93
|
port?: number;
|
|
83
94
|
path?: string;
|
|
84
95
|
timeoutMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-oauth.d.ts","sourceRoot":"","sources":["../../src/internal/mcp-oauth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,KAAK,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACZ,MAAM,0CAA0C,CAAC;AAGlD,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,uBAAuB,cAAc,CAAC;AACnD,eAAO,MAAM,sBAAsB,EAAE,MAAgF,CAAC;AAEtH,uCAAuC;AACvC,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAO5D;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,CAO3E;AAED,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,EAClB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,WAAW,GAAG,SAAS,CAazB;AAED,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,0BAA0B,GAAG,SAAS,CASxC;AAaD,oEAAoE;AACpE,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgB3D;AAED,qBAAa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,EAAE,MAAM,GAAG,IAAI,CAsB7C"}
|
|
@@ -307,12 +307,23 @@ export function createHostMcpOAuthProvider(args) {
|
|
|
307
307
|
});
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Deliberately not `@anysphere/mcp-core/oauth/loopback`, which is the canonical
|
|
312
|
+
* implementation every other Cursor surface shares. `@cursor/july` publishes to
|
|
313
|
+
* public npm with no private workspace dependencies, and its OAuth state is a
|
|
314
|
+
* bare UUID rather than the payload that module's validator expects.
|
|
315
|
+
*
|
|
316
|
+
* Nothing here reads Statsig, so this listener is outside
|
|
317
|
+
* `unified_mcp_loopback`: turning that gate off restores the other surfaces'
|
|
318
|
+
* original servers but leaves this one, and its state check, in place.
|
|
319
|
+
*/
|
|
310
320
|
export function waitForMcpOAuthCallback(args) {
|
|
311
321
|
return __awaiter(this, void 0, void 0, function* () {
|
|
312
322
|
var _a, _b, _c;
|
|
313
|
-
const port = (_a = args
|
|
314
|
-
const path = (_b = args
|
|
315
|
-
const timeoutMs = (_c = args
|
|
323
|
+
const port = (_a = args.port) !== null && _a !== void 0 ? _a : MCP_OAUTH_CALLBACK_PORT;
|
|
324
|
+
const path = (_b = args.path) !== null && _b !== void 0 ? _b : MCP_OAUTH_CALLBACK_PATH;
|
|
325
|
+
const timeoutMs = (_c = args.timeoutMs) !== null && _c !== void 0 ? _c : 5 * 60 * 1000;
|
|
326
|
+
const expectedState = new URL(args.authorizationUrl).searchParams.get("state");
|
|
316
327
|
return new Promise((resolve, reject) => {
|
|
317
328
|
let done = false;
|
|
318
329
|
const finish = (result, error) => {
|
|
@@ -344,6 +355,17 @@ export function waitForMcpOAuthCallback(args) {
|
|
|
344
355
|
const code = url.searchParams.get("code");
|
|
345
356
|
const oauthError = url.searchParams.get("error");
|
|
346
357
|
const state = (_b = url.searchParams.get("state")) !== null && _b !== void 0 ? _b : undefined;
|
|
358
|
+
// Without this, any page that can reach the loopback port during a login
|
|
359
|
+
// can inject its own authorization code into the exchange. Ignore what is
|
|
360
|
+
// not ours rather than failing the login: treating a stray request as
|
|
361
|
+
// fatal would let any page cancel a login, and free the port for someone
|
|
362
|
+
// else to bind before the real callback arrives.
|
|
363
|
+
if (state !== (expectedState !== null && expectedState !== void 0 ? expectedState : undefined)) {
|
|
364
|
+
res
|
|
365
|
+
.writeHead(404, { "content-type": "text/html; charset=utf-8" })
|
|
366
|
+
.end("<!doctype html><html><body><h1>Not found</h1></body></html>");
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
347
369
|
if (code) {
|
|
348
370
|
res
|
|
349
371
|
.writeHead(200, { "content-type": "text/html; charset=utf-8" })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4BH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4BH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;AAoGrB,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAiBpE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAaD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,CAmuB3B"}
|
package/dist/internal/server.js
CHANGED
|
@@ -44,7 +44,7 @@ import { CursorAccountMcpBridge, collectCursorAccountConnections, cursorAccountM
|
|
|
44
44
|
import { CursorBackendClient } from "./cursor/backend-client.js";
|
|
45
45
|
import { cursorExternalApiUrl, resolveApiKey, SIGN_IN_HINT, } from "./cursor/credentials.js";
|
|
46
46
|
import { CursorGithubCredentialProvider } from "./cursor/github-credentials.js";
|
|
47
|
-
import { CursorEventRelay, formatCursorScmEventLog, scmMetadataToGitHubPayload, } from "./cursor-event-relay.js";
|
|
47
|
+
import { CursorEventRelay, formatCursorScmDispatchOutcome, formatCursorScmEventLog, scmMetadataToGitHubPayload, } from "./cursor-event-relay.js";
|
|
48
48
|
import { CursorSlackRelay, createCursorSlackApiCaller, formatCursorSlackEventLog, } from "./cursor-slack-relay.js";
|
|
49
49
|
import { formatDiagnostics, hasErrorDiagnostics, projectInfo, } from "./discovery.js";
|
|
50
50
|
import { packageVersion } from "./distribution.js";
|
|
@@ -1401,8 +1401,12 @@ function startCursorEventRelay(input) {
|
|
|
1401
1401
|
targets,
|
|
1402
1402
|
});
|
|
1403
1403
|
const outcomes = result.targets
|
|
1404
|
-
.map((target) =>
|
|
1404
|
+
.map((target) => formatCursorScmDispatchOutcome(target))
|
|
1405
1405
|
.join(", ");
|
|
1406
|
+
const rejected = result.targets.filter((target) => target.status >= 400);
|
|
1407
|
+
if (rejected.length > 0) {
|
|
1408
|
+
logger(`[agent-sdk] cursor-events: dropped ${formatCursorScmEventLog(event)} before hook: ${rejected.map(formatCursorScmDispatchOutcome).join(", ")}`);
|
|
1409
|
+
}
|
|
1406
1410
|
logger(`[agent-sdk] cursor-events: dispatched ${formatCursorScmEventLog(event)}${outcomes === "" ? "" : ` → ${outcomes}`}`);
|
|
1407
1411
|
}),
|
|
1408
1412
|
});
|