@cursor/july 0.1.55 → 0.1.61
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 +30 -23
- package/dist/channels/github/github-channel.d.ts +12 -0
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +67 -15
- package/dist/channels/github/types.d.ts +27 -1
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/origin/cursor-account.d.ts +22 -0
- package/dist/channels/origin/cursor-account.d.ts.map +1 -0
- package/dist/channels/origin/cursor-account.js +35 -0
- package/dist/channels/origin/events.d.ts +10 -0
- package/dist/channels/origin/events.d.ts.map +1 -0
- package/dist/channels/origin/events.js +27 -0
- package/dist/channels/origin/index.d.ts +29 -0
- package/dist/channels/origin/index.d.ts.map +1 -0
- package/dist/channels/origin/index.js +28 -0
- package/dist/channels/origin/origin-channel.d.ts +68 -0
- package/dist/channels/origin/origin-channel.d.ts.map +1 -0
- package/dist/channels/origin/origin-channel.js +567 -0
- package/dist/channels/origin/origin-webhook.d.ts +38 -0
- package/dist/channels/origin/origin-webhook.d.ts.map +1 -0
- package/dist/channels/origin/origin-webhook.js +151 -0
- package/dist/channels/origin/types.d.ts +152 -0
- package/dist/channels/origin/types.d.ts.map +1 -0
- package/dist/channels/origin/types.js +1 -0
- package/dist/channels/slack/doctor.d.ts +17 -1
- package/dist/channels/slack/doctor.d.ts.map +1 -1
- package/dist/channels/slack/doctor.js +186 -10
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.CVQxhV85.js → app.CW3KJh72.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.BuymfBAo.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.QAPzJjql.js → VPLocalSearchBox.Bk6EWpPj.js} +1 -1
- package/dist/docs/assets/chunks/{theme.CSxTCOFu.js → theme.Bz9AodBA.js} +2 -2
- package/dist/docs/assets/{example-agents_fsd.md.DPz9ezO4.js → example-agents_fsd.md.ZeGEpAw_.js} +2 -2
- package/dist/docs/assets/{example-agents_fsd.md.DPz9ezO4.lean.js → example-agents_fsd.md.ZeGEpAw_.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_security-reviewer.md.Dkf1gyo6.js → example-agents_security-reviewer.md.DBL1TwtP.js} +2 -2
- package/dist/docs/assets/{example-agents_security-reviewer.md.Dkf1gyo6.lean.js → example-agents_security-reviewer.md.DBL1TwtP.lean.js} +1 -1
- package/dist/docs/assets/guides_convert-automation.md.BhMzTkE5.js +12 -0
- package/dist/docs/assets/guides_convert-automation.md.BhMzTkE5.lean.js +1 -0
- package/dist/docs/assets/{guides_github.md.B8QKtIpw.js → guides_github.md.CLLQJKRB.js} +4 -4
- package/dist/docs/assets/{guides_github.md.B8QKtIpw.lean.js → guides_github.md.CLLQJKRB.lean.js} +1 -1
- package/dist/docs/assets/index.md.DhRHS_-L.js +5 -0
- package/dist/docs/assets/{index.md.COeoSkcF.lean.js → index.md.DhRHS_-L.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.D_CCfG8R.js → reference_cli.md.Cl14Jfo3.js} +8 -2
- package/dist/docs/assets/{reference_cli.md.D_CCfG8R.lean.js → reference_cli.md.Cl14Jfo3.lean.js} +1 -1
- package/dist/docs/assets/scaffolding-agents.md.CrWSA0Ko.js +1 -0
- package/dist/docs/assets/{scaffolding-agents.md.mkc3B_ZW.lean.js → scaffolding-agents.md.CrWSA0Ko.lean.js} +1 -1
- package/dist/docs/assets/templates_agentic-owners.md.BkTLORaU.js +14 -0
- package/dist/docs/assets/templates_agentic-owners.md.BkTLORaU.lean.js +1 -0
- package/dist/docs/assets/templates_demo.md.Bgd6MBaZ.js +4 -0
- package/dist/docs/assets/templates_demo.md.Bgd6MBaZ.lean.js +1 -0
- package/dist/docs/assets/templates_pr-autofixer.md.DcmoeUNZ.js +8 -0
- package/dist/docs/assets/templates_pr-autofixer.md.DcmoeUNZ.lean.js +1 -0
- package/dist/docs/assets/templates_security-reviewer.md.C0yIUaYs.js +2 -0
- package/dist/docs/assets/templates_security-reviewer.md.C0yIUaYs.lean.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/deployment.html +4 -4
- package/dist/docs/evals.html +4 -4
- package/dist/docs/example-agents/approval-buddy.html +4 -4
- package/dist/docs/example-agents/benny.html +4 -4
- package/dist/docs/example-agents/bugbot.html +4 -4
- package/dist/docs/example-agents/codebase-wiki.html +4 -4
- package/dist/docs/example-agents/codeowners-review.html +4 -4
- package/dist/docs/example-agents/concierge.html +4 -4
- package/dist/docs/example-agents/fsd.html +5 -5
- package/dist/docs/example-agents/index.html +4 -4
- package/dist/docs/example-agents/knowledge-base.html +4 -4
- package/dist/docs/example-agents/oncall.html +4 -4
- package/dist/docs/example-agents/security-reviewer.html +5 -5
- package/dist/docs/example-agents/slack-agent.html +4 -4
- package/dist/docs/example-agents/weather-agent.html +4 -4
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-runtime.html +4 -4
- package/dist/docs/guides/convert-automation.html +36 -0
- package/dist/docs/guides/github.html +7 -7
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +4 -4
- package/dist/docs/guides/slack.html +4 -4
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +6 -6
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +12 -6
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +4 -4
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +4 -4
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/agentic-owners.html +38 -0
- package/dist/docs/templates/demo.html +28 -0
- package/dist/docs/templates/pr-autofixer.html +32 -0
- package/dist/docs/templates/security-reviewer.html +26 -0
- package/dist/docs/templates/triage.html +5 -5
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/internal/cli-ax.d.ts +2 -0
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +20 -0
- package/dist/internal/cli-slack.d.ts +2 -0
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +11 -2
- package/dist/internal/cursor-event-relay.d.ts +59 -11
- package/dist/internal/cursor-event-relay.d.ts.map +1 -1
- package/dist/internal/cursor-event-relay.js +133 -26
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +11 -2
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +1 -0
- package/dist/internal/handleAgentServeTrigger.d.ts +33 -6
- package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -1
- package/dist/internal/handleAgentServeTrigger.js +97 -19
- package/dist/internal/init-interview.d.ts +67 -0
- package/dist/internal/init-interview.d.ts.map +1 -0
- package/dist/internal/init-interview.js +300 -0
- package/dist/internal/init-project.d.ts +4 -0
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +40 -16
- package/dist/internal/mcp-endpoint.d.ts +7 -0
- package/dist/internal/mcp-endpoint.d.ts.map +1 -1
- package/dist/internal/mcp-endpoint.js +7 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +159 -57
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +20 -21
- package/dist/internal/session-links.d.ts +14 -0
- package/dist/internal/session-links.d.ts.map +1 -0
- package/dist/internal/session-links.js +69 -0
- package/dist/internal/sessions-client.d.ts.map +1 -1
- package/dist/internal/sessions-client.js +1 -0
- package/dist/playground/assets/index-ClbuaLpm.css +1 -0
- package/dist/playground/assets/{index-0oqXUkrR.js → index-SqkR13k_.js} +39 -39
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +19 -12
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +15 -0
- package/docs/example-agents/fsd.md +3 -0
- package/docs/example-agents/security-reviewer.md +3 -0
- package/docs/guides/convert-automation.md +176 -0
- package/docs/guides/github.md +6 -2
- package/docs/reference/cli.md +34 -10
- package/docs/scaffolding-agents.md +3 -0
- package/docs/templates/agentic-owners.md +97 -0
- package/docs/templates/demo.md +84 -0
- package/docs/templates/pr-autofixer.md +136 -0
- package/docs/templates/security-reviewer.md +89 -0
- package/package.json +9 -1
- package/skills/github/SKILL.md +4 -5
- package/src/bin/agent-serve.ts +13 -6
- package/src/channels/github/github-channel.ts +95 -18
- package/src/channels/github/types.ts +31 -0
- package/src/channels/origin/cursor-account.ts +64 -0
- package/src/channels/origin/events.ts +41 -0
- package/src/channels/origin/index.ts +29 -0
- package/src/channels/origin/origin-channel.ts +784 -0
- package/src/channels/origin/origin-webhook.ts +202 -0
- package/src/channels/origin/types.ts +186 -0
- package/src/channels/slack/doctor.ts +218 -5
- package/src/index.ts +3 -1
- package/src/internal/cli-ax.ts +23 -0
- package/src/internal/cli-slack.ts +11 -1
- package/src/internal/cursor-event-relay.ts +193 -31
- package/src/internal/discovery.ts +15 -5
- package/src/internal/distribution.ts +1 -0
- package/src/internal/handleAgentServeTrigger.ts +129 -19
- package/src/internal/init-interview.ts +384 -0
- package/src/internal/init-project.ts +70 -15
- package/src/internal/mcp-endpoint.ts +7 -0
- package/src/internal/server.ts +188 -58
- package/src/internal/session-engine.ts +5 -21
- package/src/internal/session-links.ts +88 -0
- package/src/internal/sessions-client.ts +1 -0
- package/src/types.ts +19 -12
- package/templates/agentic-owners/README.md +73 -0
- package/templates/agentic-owners/agent/agent.ts +15 -0
- package/templates/agentic-owners/agent/channels/github.ts +85 -0
- package/templates/agentic-owners/agent/instructions.md +34 -0
- package/templates/agentic-owners/agent/lib/config.ts +13 -0
- package/templates/agentic-owners/agent/lib/github.ts +241 -0
- package/templates/agentic-owners/agent/lib/owners/README.md +50 -0
- package/templates/agentic-owners/agent/lib/owners/constants.ts +22 -0
- package/templates/agentic-owners/agent/lib/owners/decision.ts +485 -0
- package/templates/agentic-owners/agent/lib/owners/handles.ts +54 -0
- package/templates/agentic-owners/agent/lib/owners/match.ts +177 -0
- package/templates/agentic-owners/agent/lib/owners/matching.ts +95 -0
- package/templates/agentic-owners/agent/lib/owners/parse.ts +589 -0
- package/templates/agentic-owners/agent/lib/owners/policyMode.ts +65 -0
- package/templates/agentic-owners/agent/lib/owners/prompt.ts +66 -0
- package/templates/agentic-owners/agent/lib/owners/prompts/base-review.md +105 -0
- package/templates/agentic-owners/agent/lib/owners/types.ts +45 -0
- package/templates/agentic-owners/agent/lib/review.ts +777 -0
- package/templates/agentic-owners/agent/tools/record_review.ts +69 -0
- package/templates/agentic-owners/evals/evals.config.ts +5 -0
- package/templates/agentic-owners/evals/owners.eval.ts +116 -0
- package/templates/agentic-owners/package.json +20 -0
- package/templates/agentic-owners/tsconfig.json +12 -0
- package/templates/demo/README.md +33 -0
- package/templates/demo/agent/agent.ts +15 -0
- package/templates/demo/agent/channels/github.ts +50 -0
- package/templates/demo/agent/channels/queue.ts +30 -0
- package/templates/demo/agent/instructions.md +8 -0
- package/templates/demo/agent/lib/collect.ts +78 -0
- package/templates/demo/agent/tools/record_demo.ts +40 -0
- package/templates/demo/evals/demo.eval.ts +33 -0
- package/templates/demo/evals/evals.config.ts +5 -0
- package/templates/demo/package.json +18 -0
- package/templates/demo/tsconfig.json +12 -0
- package/templates/pr-autofixer/README.md +44 -0
- package/templates/pr-autofixer/agent/agent.ts +22 -0
- package/templates/pr-autofixer/agent/channels/drive.ts +40 -0
- package/templates/pr-autofixer/agent/channels/github.ts +167 -0
- package/templates/pr-autofixer/agent/channels/slack.ts +17 -0
- package/templates/pr-autofixer/agent/hooks/bind-agent.ts +19 -0
- package/templates/pr-autofixer/agent/instructions.md +83 -0
- package/templates/pr-autofixer/agent/lib/affinity.ts +33 -0
- package/templates/pr-autofixer/agent/lib/drive-schemas.ts +15 -0
- package/templates/pr-autofixer/agent/lib/drive.ts +79 -0
- package/templates/pr-autofixer/agent/lib/merge-watch.ts +123 -0
- package/templates/pr-autofixer/agent/lib/pr-state.ts +54 -0
- package/templates/pr-autofixer/agent/lib/repos.ts +19 -0
- package/templates/pr-autofixer/agent/lib/start-drive.ts +122 -0
- package/templates/pr-autofixer/agent/lib/webhook-buffer.ts +225 -0
- package/templates/pr-autofixer/agent/lib/webhook-routing.ts +231 -0
- package/templates/pr-autofixer/agent/storage.ts +7 -0
- package/templates/pr-autofixer/agent/tools/drive_pr.ts +22 -0
- package/templates/pr-autofixer/evals/coordinator.eval.ts +16 -0
- package/templates/pr-autofixer/evals/evals.config.ts +5 -0
- package/templates/pr-autofixer/init.json +25 -0
- package/templates/pr-autofixer/package.json +18 -0
- package/templates/pr-autofixer/tsconfig.json +12 -0
- package/templates/security-reviewer/README.md +31 -0
- package/templates/security-reviewer/agent/agent.ts +15 -0
- package/templates/security-reviewer/agent/channels/github.ts +46 -0
- package/templates/security-reviewer/agent/instructions.md +22 -0
- package/templates/security-reviewer/agent/lib/repos.ts +5 -0
- package/templates/security-reviewer/agent/tools/post_findings.ts +72 -0
- package/templates/security-reviewer/evals/evals.config.ts +5 -0
- package/templates/security-reviewer/evals/review.eval.ts +53 -0
- package/templates/security-reviewer/init.json +25 -0
- package/templates/security-reviewer/package.json +18 -0
- package/templates/security-reviewer/tsconfig.json +12 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.BFpWSo6D.js +0 -1
- package/dist/docs/assets/index.md.COeoSkcF.js +0 -5
- package/dist/docs/assets/scaffolding-agents.md.mkc3B_ZW.js +0 -1
- package/dist/playground/assets/index-tHCjJxv4.css +0 -1
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
ChannelEventHandlers,
|
|
7
7
|
ChannelStartArgs,
|
|
8
8
|
HostContext,
|
|
9
|
+
SendMessageOptions,
|
|
9
10
|
} from "../../types.js";
|
|
10
11
|
import type { GitHubApiOptions } from "./api.js";
|
|
11
12
|
import type { GitHubHandle, GitHubThread } from "./binding.js";
|
|
@@ -165,6 +166,13 @@ export type GitHubPullRequestPayload = {
|
|
|
165
166
|
sha?: string;
|
|
166
167
|
};
|
|
167
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* Present on `edited` deliveries; `changes.base.ref.from` carries the
|
|
171
|
+
* previous base branch when the PR was retargeted.
|
|
172
|
+
*/
|
|
173
|
+
changes?: {
|
|
174
|
+
base?: { ref?: { from?: string } };
|
|
175
|
+
} | null;
|
|
168
176
|
sender?: {
|
|
169
177
|
login?: string;
|
|
170
178
|
id?: number;
|
|
@@ -186,6 +194,13 @@ export interface GitHubPullRequestEvent {
|
|
|
186
194
|
headSha: string;
|
|
187
195
|
baseRef: string;
|
|
188
196
|
baseSha?: string;
|
|
197
|
+
/**
|
|
198
|
+
* On `edited` deliveries where the PR base was retargeted, the previous
|
|
199
|
+
* base branch (`changes.base.ref.from`). Undefined for every other edit
|
|
200
|
+
* (title / body), so `action === "edited" && baseRefChangedFrom` gates
|
|
201
|
+
* base-retarget handling without waking on prose edits.
|
|
202
|
+
*/
|
|
203
|
+
baseRefChangedFrom?: string;
|
|
189
204
|
draft: boolean;
|
|
190
205
|
/** True when the PR was merged (from the webhook payload). */
|
|
191
206
|
merged: boolean;
|
|
@@ -324,6 +339,11 @@ export interface GitHubEventContext {
|
|
|
324
339
|
*/
|
|
325
340
|
export type GitHubDispatch = GitHubTurnDispatch | GitHubTaskDispatch;
|
|
326
341
|
|
|
342
|
+
/** Files seeded into the session workspace before the turn. */
|
|
343
|
+
export type GitHubWorkspaceFiles = NonNullable<
|
|
344
|
+
SendMessageOptions["workspaceFiles"]
|
|
345
|
+
>;
|
|
346
|
+
|
|
327
347
|
/** Start (or resume) a model turn for the event. */
|
|
328
348
|
export interface GitHubTurnDispatch {
|
|
329
349
|
/** Who the turn runs as. Use `defaultGitHubAuth(ctx)` to derive it from the actor. */
|
|
@@ -334,6 +354,17 @@ export interface GitHubTurnDispatch {
|
|
|
334
354
|
message?: string;
|
|
335
355
|
/** Optional session title override. */
|
|
336
356
|
title?: string;
|
|
357
|
+
/**
|
|
358
|
+
* Seeded into the session workspace before the turn (`send`'s
|
|
359
|
+
* `workspaceFiles`). A function runs after the webhook is
|
|
360
|
+
* acknowledged (202) so fetch I/O can outlive GitHub's ~10s window.
|
|
361
|
+
*/
|
|
362
|
+
workspaceFiles?:
|
|
363
|
+
| GitHubWorkspaceFiles
|
|
364
|
+
| (() =>
|
|
365
|
+
| GitHubWorkspaceFiles
|
|
366
|
+
| undefined
|
|
367
|
+
| Promise<GitHubWorkspaceFiles | undefined>);
|
|
337
368
|
}
|
|
338
369
|
|
|
339
370
|
/**
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor-account mode for Origin channels.
|
|
3
|
+
*
|
|
4
|
+
* Origin identity is the signed-in Cursor user (no third-party OAuth). The
|
|
5
|
+
* channel declares repos at definition time; the serve host subscribes
|
|
6
|
+
* `/v0/scm-events` with `provider: "origin"` as that user. Unlike GitHub,
|
|
7
|
+
* there is no installation token to mint — outbound Origin API calls already
|
|
8
|
+
* authenticate as the Cursor principal.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { OriginChannelOptions } from "./types.js";
|
|
12
|
+
|
|
13
|
+
export const CURSOR_ORIGIN_MAX_REPOS = 20;
|
|
14
|
+
const CURSOR_ORIGIN_REPO_PATTERN = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
15
|
+
|
|
16
|
+
export interface CursorOriginRepoScope {
|
|
17
|
+
repos: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface OriginCursorAccountRuntime {
|
|
21
|
+
options: OriginChannelOptions;
|
|
22
|
+
scope: CursorOriginRepoScope | undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const runtimeByDefinition = new WeakMap<object, OriginCursorAccountRuntime>();
|
|
26
|
+
|
|
27
|
+
export function parseCursorOriginRepoScope(
|
|
28
|
+
values: readonly string[]
|
|
29
|
+
): CursorOriginRepoScope {
|
|
30
|
+
const repos = [
|
|
31
|
+
...new Set(values.map((repo) => repo.trim().toLowerCase()).filter(Boolean)),
|
|
32
|
+
];
|
|
33
|
+
if (repos.length === 0) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
"originChannel({ cursorAccount }) requires at least one repository."
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
if (repos.length > CURSOR_ORIGIN_MAX_REPOS) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
`originChannel({ cursorAccount }) supports at most ${CURSOR_ORIGIN_MAX_REPOS} repositories.`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
for (const repo of repos) {
|
|
44
|
+
if (!CURSOR_ORIGIN_REPO_PATTERN.test(repo) || repo.includes("..")) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
`Invalid Origin repository "${repo}"; expected owner/repo.`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return { repos };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function registerOriginCursorAccountRuntime(
|
|
54
|
+
definition: object,
|
|
55
|
+
runtime: OriginCursorAccountRuntime
|
|
56
|
+
): void {
|
|
57
|
+
runtimeByDefinition.set(definition, runtime);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function getOriginCursorAccountRuntime(
|
|
61
|
+
definition: object
|
|
62
|
+
): OriginCursorAccountRuntime | undefined {
|
|
63
|
+
return runtimeByDefinition.get(definition);
|
|
64
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** {@link ChannelMeta.kind} value used by {@link originChannel}. */
|
|
2
|
+
export const ORIGIN_CHANNEL_KIND = "origin";
|
|
3
|
+
|
|
4
|
+
const BASE_WEBHOOK_EVENTS: readonly string[] = [
|
|
5
|
+
"pull_request.created",
|
|
6
|
+
"pull_request.published",
|
|
7
|
+
"pull_request.head_ref.pushed",
|
|
8
|
+
"pull_request.base_ref.updated",
|
|
9
|
+
"pull_request.closed",
|
|
10
|
+
"pull_request.merged",
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const COMMENT_EVENTS: readonly string[] = ["pull_request.comment.created"];
|
|
14
|
+
const REVIEW_EVENTS: readonly string[] = ["pull_request.review.submitted"];
|
|
15
|
+
|
|
16
|
+
export interface OriginWebhookEventOptions {
|
|
17
|
+
webhookEvents?: readonly string[];
|
|
18
|
+
onComment?: unknown;
|
|
19
|
+
onReview?: unknown;
|
|
20
|
+
onEvent?: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function deriveOriginWebhookEvents(
|
|
24
|
+
options: OriginWebhookEventOptions
|
|
25
|
+
): string[] {
|
|
26
|
+
if (options.webhookEvents !== undefined) {
|
|
27
|
+
return [
|
|
28
|
+
...new Set(
|
|
29
|
+
options.webhookEvents.map((event) => event.trim()).filter(Boolean)
|
|
30
|
+
),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
const events: string[] = [...BASE_WEBHOOK_EVENTS];
|
|
34
|
+
if (options.onComment !== undefined) {
|
|
35
|
+
events.push(...COMMENT_EVENTS);
|
|
36
|
+
}
|
|
37
|
+
if (options.onReview !== undefined) {
|
|
38
|
+
events.push(...REVIEW_EVENTS);
|
|
39
|
+
}
|
|
40
|
+
return [...new Set(events)];
|
|
41
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Origin webhook channel pack for agent-serve.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* import { defaultOriginAuth, originChannel } from "@cursor/july/channels/origin";
|
|
6
|
+
*
|
|
7
|
+
* export default originChannel({
|
|
8
|
+
* cursorAccount: { repos: ["owner/repo"] },
|
|
9
|
+
* onPullRequest: (ctx) => ({ auth: defaultOriginAuth(ctx) }),
|
|
10
|
+
* onComment: (ctx) => ({ auth: defaultOriginAuth(ctx) }),
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Direct webhook mode verifies Standard-Webhooks v1ed signatures **and**
|
|
15
|
+
* binds `envelope.appId` to {@link OriginChannelOptions.appId} (or
|
|
16
|
+
* `AGENT_SERVE_ORIGIN_APP_ID`). v1ed alone is not channel auth — Origin
|
|
17
|
+
* signs every app's deliveries with the same JWKS. Pass
|
|
18
|
+
* `{ cursorAccount: true }` to receive events from
|
|
19
|
+
* `serve({ cursor: { events: true } })` after `/v0/scm-events`
|
|
20
|
+
* (`provider: "origin"`) already verified them. The turn principal is
|
|
21
|
+
* `origin-webhook` plus the Origin actor — not the Cursor subscriber —
|
|
22
|
+
* matching GitHub's `github-webhook` pattern.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export * from "./cursor-account.js";
|
|
26
|
+
export * from "./events.js";
|
|
27
|
+
export * from "./origin-channel.js";
|
|
28
|
+
export * from "./origin-webhook.js";
|
|
29
|
+
export * from "./types.js";
|