@cursor/july 0.1.62 → 0.1.73
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/AGENTS.md +4 -5
- package/README.md +23 -11
- package/dist/bin/agent-serve.js +11 -2
- package/dist/channels/github/api.d.ts +2 -0
- package/dist/channels/github/api.d.ts.map +1 -1
- package/dist/channels/github/api.js +2 -1
- package/dist/channels/github/binding.d.ts +7 -0
- package/dist/channels/github/binding.d.ts.map +1 -1
- package/dist/channels/github/binding.js +4 -0
- package/dist/channels/github/checks.d.ts +99 -0
- package/dist/channels/github/checks.d.ts.map +1 -0
- package/dist/channels/github/checks.js +108 -0
- package/dist/channels/github/cursor-account.d.ts +4 -4
- package/dist/channels/github/cursor-account.d.ts.map +1 -1
- package/dist/channels/github/cursor-account.js +7 -5
- package/dist/channels/github/index.d.ts +1 -0
- package/dist/channels/github/index.d.ts.map +1 -1
- package/dist/channels/github/index.js +1 -0
- package/dist/channels/github/types.d.ts +8 -0
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/slack/channel-watch.d.ts +2 -1
- package/dist/channels/slack/channel-watch.d.ts.map +1 -1
- package/dist/channels/slack/channel-watch.js +7 -3
- package/dist/channels/slack/dispatch.d.ts +9 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +41 -21
- package/dist/channels/slack/manifest.d.ts +2 -2
- package/dist/channels/slack/manifest.d.ts.map +1 -1
- package/dist/channels/slack/manifest.js +14 -11
- package/dist/channels/slack/nudge-store.d.ts +16 -0
- package/dist/channels/slack/nudge-store.d.ts.map +1 -1
- package/dist/channels/slack/nudge-store.js +53 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +4 -1
- package/dist/channels/slack/types.d.ts +24 -7
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/connections.d.ts +17 -5
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +17 -5
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +3 -3
- package/dist/docs/assets/{app.B-biogkN.js → app.CdbcFD8T.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DQad--_z.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DZqKtFZS.js → VPLocalSearchBox.D_NKImM7.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BwC5zP2r.js → theme.CMvz7cu9.js} +2 -2
- package/dist/docs/assets/{concepts.md.CqOsxbMU.js → concepts.md.BXAm6G-C.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.C7G7IykG.js → guides_mcp-oauth.md.CzEB6RaG.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.DHkkvcEZ.js → reference_agent-config.md.BZnEKfEc.js} +3 -4
- package/dist/docs/assets/{reference_agent-config.md.DHkkvcEZ.lean.js → reference_agent-config.md.BZnEKfEc.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.CSQiNzre.js → reference_connections.md.Cu3N-S3Q.js} +26 -9
- package/dist/docs/assets/reference_connections.md.Cu3N-S3Q.lean.js +1 -0
- package/dist/docs/assets/{reference_sessions.md.DBVFi2Sx.js → reference_sessions.md.B0DdlM-K.js} +1 -1
- package/dist/docs/assets/{reference_tools.md.kJfJAP2m.js → reference_tools.md.DTg_kEsx.js} +2 -2
- package/dist/docs/assets/{reference_tools.md.kJfJAP2m.lean.js → reference_tools.md.DTg_kEsx.lean.js} +1 -1
- package/dist/docs/assets/troubleshooting.md.DQ-hYuZT.js +1 -0
- package/dist/docs/building-with-agents.html +3 -3
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/deployment.html +3 -3
- package/dist/docs/evals.html +3 -3
- package/dist/docs/example-agents/approval-buddy.html +3 -3
- package/dist/docs/example-agents/benny.html +3 -3
- package/dist/docs/example-agents/bugbot.html +3 -3
- package/dist/docs/example-agents/codebase-wiki.html +3 -3
- package/dist/docs/example-agents/codeowners-review.html +3 -3
- package/dist/docs/example-agents/concierge.html +3 -3
- package/dist/docs/example-agents/fsd.html +3 -3
- package/dist/docs/example-agents/index.html +3 -3
- package/dist/docs/example-agents/knowledge-base.html +3 -3
- package/dist/docs/example-agents/oncall.html +3 -3
- package/dist/docs/example-agents/security-reviewer.html +3 -3
- package/dist/docs/example-agents/slack-agent.html +3 -3
- package/dist/docs/example-agents/weather-agent.html +3 -3
- package/dist/docs/guides/agent-to-agent.html +3 -3
- package/dist/docs/guides/cloud-runtime.html +3 -3
- package/dist/docs/guides/convert-automation.html +3 -3
- package/dist/docs/guides/github.html +3 -3
- package/dist/docs/guides/human-in-the-loop.html +3 -3
- package/dist/docs/guides/mcp-oauth.html +5 -5
- package/dist/docs/guides/opentelemetry.html +3 -3
- package/dist/docs/guides/slack.html +3 -3
- package/dist/docs/guides/webhooks.html +3 -3
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +3 -3
- package/dist/docs/index.html +3 -3
- package/dist/docs/quickstart.html +3 -3
- package/dist/docs/reference/agent-config.html +5 -6
- package/dist/docs/reference/artifacts.html +3 -3
- package/dist/docs/reference/channels.html +3 -3
- package/dist/docs/reference/cli.html +3 -3
- package/dist/docs/reference/connections.html +28 -11
- package/dist/docs/reference/hooks.html +3 -3
- package/dist/docs/reference/http-api.html +3 -3
- package/dist/docs/reference/instructions.html +3 -3
- package/dist/docs/reference/playground.html +3 -3
- package/dist/docs/reference/project-layout.html +3 -3
- package/dist/docs/reference/prompt.html +3 -3
- package/dist/docs/reference/schedules.html +3 -3
- package/dist/docs/reference/sessions.html +5 -5
- package/dist/docs/reference/skills.html +3 -3
- package/dist/docs/reference/subagents.html +3 -3
- package/dist/docs/reference/tools.html +5 -5
- package/dist/docs/scaffolding-agents.html +3 -3
- package/dist/docs/storage.html +3 -3
- package/dist/docs/templates/agentic-owners.html +3 -3
- package/dist/docs/templates/demo.html +3 -3
- package/dist/docs/templates/pr-autofixer.html +3 -3
- package/dist/docs/templates/security-reviewer.html +3 -3
- package/dist/docs/templates/triage.html +3 -3
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/files-backends/agent-store-presigned-url.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/advertise-tools.d.ts +79 -0
- package/dist/internal/advertise-tools.d.ts.map +1 -0
- package/dist/internal/advertise-tools.js +185 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +7 -1
- package/dist/internal/cli-manifest.d.ts +19 -0
- package/dist/internal/cli-manifest.d.ts.map +1 -0
- package/dist/internal/cli-manifest.js +49 -0
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +9 -1
- package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -1
- package/dist/internal/convert-automation/convert-workflow.js +2 -10
- package/dist/internal/cursor/account-mcp.d.ts +29 -3
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
- package/dist/internal/cursor/account-mcp.js +147 -67
- package/dist/internal/cursor/backend-client.d.ts +11 -6
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +32 -10
- package/dist/internal/cursor-account-mcp-auth.d.ts +11 -0
- package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
- package/dist/internal/cursor-account-mcp-auth.js +69 -0
- package/dist/internal/cursor-agent-template.d.ts +9 -0
- package/dist/internal/cursor-agent-template.d.ts.map +1 -0
- package/dist/internal/cursor-agent-template.js +37 -0
- package/dist/internal/deploy-client.d.ts +1 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +18 -2
- package/dist/internal/deploy-manifest.d.ts +76 -0
- package/dist/internal/deploy-manifest.d.ts.map +1 -0
- package/dist/internal/deploy-manifest.js +117 -0
- package/dist/internal/deployment-scm-event-stream.d.ts +116 -0
- package/dist/internal/deployment-scm-event-stream.d.ts.map +1 -0
- package/dist/internal/deployment-scm-event-stream.js +474 -0
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +111 -10
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +12 -123
- package/dist/internal/init-scaffold.d.ts +8 -0
- package/dist/internal/init-scaffold.d.ts.map +1 -0
- package/dist/internal/init-scaffold.js +168 -0
- package/dist/internal/inline-stdio-mcp.d.ts +2 -0
- package/dist/internal/inline-stdio-mcp.d.ts.map +1 -1
- package/dist/internal/inline-stdio-mcp.js +10 -8
- package/dist/internal/json-schema.d.ts +7 -0
- package/dist/internal/json-schema.d.ts.map +1 -1
- package/dist/internal/json-schema.js +18 -3
- package/dist/internal/mcp-endpoint.js +7 -7
- package/dist/internal/mcp-host.d.ts +18 -0
- package/dist/internal/mcp-host.d.ts.map +1 -1
- package/dist/internal/mcp-host.js +43 -5
- package/dist/internal/mcp-oauth.d.ts +22 -0
- package/dist/internal/mcp-oauth.d.ts.map +1 -1
- package/dist/internal/mcp-oauth.js +40 -1
- package/dist/internal/package-inline-stdio.d.ts.map +1 -1
- package/dist/internal/package-inline-stdio.js +5 -5
- package/dist/internal/review-comments.d.ts +97 -0
- package/dist/internal/review-comments.d.ts.map +1 -1
- package/dist/internal/review-comments.js +151 -0
- package/dist/internal/sanitize-mcp-tool-name.d.ts +20 -0
- package/dist/internal/sanitize-mcp-tool-name.d.ts.map +1 -0
- package/dist/internal/sanitize-mcp-tool-name.js +30 -0
- package/dist/internal/sdk-runner.d.ts +1 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +36 -13
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +18 -0
- package/dist/internal/session-engine.d.ts +66 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +428 -110
- package/dist/internal/shallow-clone.d.ts +170 -0
- package/dist/internal/shallow-clone.d.ts.map +1 -0
- package/dist/internal/shallow-clone.js +412 -0
- package/dist/internal/slack-provision-client.d.ts +2 -0
- package/dist/internal/slack-provision-client.d.ts.map +1 -1
- package/dist/internal/slack-provision-client.js +1 -0
- package/dist/internal/terminal-style.d.ts +18 -0
- package/dist/internal/terminal-style.d.ts.map +1 -1
- package/dist/internal/terminal-style.js +46 -1
- package/dist/internal/turn-lease-store.d.ts +44 -0
- package/dist/internal/turn-lease-store.d.ts.map +1 -0
- package/dist/internal/turn-lease-store.js +139 -0
- package/dist/internal/workspace.d.ts +14 -0
- package/dist/internal/workspace.d.ts.map +1 -1
- package/dist/internal/workspace.js +33 -0
- package/dist/playground/assets/index-77uhu5Kr.css +1 -0
- package/dist/playground/assets/index-D4buox4m.js +85 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-protocol.d.ts +122 -0
- package/dist/storage-protocol.d.ts.map +1 -0
- package/dist/storage-protocol.js +173 -0
- package/dist/storage.d.ts +2 -72
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +2 -82
- package/dist/tools.d.ts +7 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/types.d.ts +141 -6
- package/dist/types.d.ts.map +1 -1
- package/docs/concepts.md +4 -4
- package/docs/guides/mcp-oauth.md +3 -1
- package/docs/reference/agent-config.md +11 -12
- package/docs/reference/connections.md +108 -10
- package/docs/reference/sessions.md +2 -2
- package/docs/reference/tools.md +14 -0
- package/docs/troubleshooting.md +3 -2
- package/package.json +7 -2
- package/skills/create-agent/SKILL.md +12 -9
- package/skills/debug/SKILL.md +2 -1
- package/skills/framework-map/SKILL.md +6 -6
- package/skills/mcp-auth/SKILL.md +8 -6
- package/src/bin/agent-serve.ts +12 -2
- package/src/channels/github/api.ts +6 -1
- package/src/channels/github/binding.ts +21 -0
- package/src/channels/github/checks.ts +179 -0
- package/src/channels/github/cursor-account.ts +9 -6
- package/src/channels/github/index.ts +1 -0
- package/src/channels/github/types.ts +8 -0
- package/src/channels/slack/channel-watch.ts +6 -3
- package/src/channels/slack/dispatch.ts +40 -3
- package/src/channels/slack/manifest.ts +9 -10
- package/src/channels/slack/nudge-store.ts +56 -0
- package/src/channels/slack/slack-channel.ts +3 -0
- package/src/channels/slack/types.ts +24 -7
- package/src/connections.ts +17 -5
- package/src/index.ts +5 -0
- package/src/internal/advertise-tools.ts +278 -0
- package/src/internal/cli-deploy.ts +11 -1
- package/src/internal/cli-manifest.ts +63 -0
- package/src/internal/cli-slack.ts +10 -1
- package/src/internal/convert-automation/convert-workflow.ts +2 -11
- package/src/internal/cursor/account-mcp.ts +208 -73
- package/src/internal/cursor/backend-client.ts +45 -11
- package/src/internal/cursor-account-mcp-auth.ts +83 -0
- package/src/internal/cursor-agent-template.ts +46 -0
- package/src/internal/deploy-client.ts +25 -6
- package/src/internal/deploy-manifest.ts +161 -0
- package/src/internal/deployment-scm-event-stream.ts +593 -0
- package/src/internal/discovery.ts +132 -3
- package/src/internal/init-project.ts +18 -153
- package/src/internal/init-scaffold.ts +176 -0
- package/src/internal/inline-stdio-mcp.ts +13 -0
- package/src/internal/json-schema.ts +24 -3
- package/src/internal/mcp-endpoint.ts +6 -0
- package/src/internal/mcp-host.ts +70 -9
- package/src/internal/mcp-oauth.ts +55 -1
- package/src/internal/package-inline-stdio.ts +5 -1
- package/src/internal/review-comments.ts +245 -0
- package/src/internal/sanitize-mcp-tool-name.ts +33 -0
- package/src/internal/sdk-runner.ts +50 -11
- package/src/internal/server.ts +19 -0
- package/src/internal/session-engine.ts +392 -19
- package/src/internal/shallow-clone.ts +595 -0
- package/src/internal/slack-provision-client.ts +3 -0
- package/src/internal/terminal-style.ts +67 -1
- package/src/internal/turn-lease-store.ts +147 -0
- package/src/internal/workspace.ts +33 -0
- package/src/storage-protocol.ts +247 -0
- package/src/storage.ts +16 -110
- package/src/tools.ts +7 -0
- package/src/types.ts +149 -7
- package/templates/agentic-owners/agent/agent.ts +3 -0
- package/templates/demo/agent/agent.ts +3 -0
- package/templates/pr-autofixer/agent/lib/drive-schemas.ts +4 -1
- package/templates/security-reviewer/agent/agent.ts +3 -0
- package/templates/triage/agent/agent.ts +3 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.5ozYNf74.js +0 -1
- package/dist/docs/assets/reference_connections.md.CSQiNzre.lean.js +0 -1
- package/dist/docs/assets/troubleshooting.md.CuVztCKs.js +0 -1
- package/dist/playground/assets/index-B4rcOgeP.css +0 -1
- package/dist/playground/assets/index-DXcY42Jv.js +0 -85
- /package/dist/docs/assets/{concepts.md.CqOsxbMU.lean.js → concepts.md.BXAm6G-C.lean.js} +0 -0
- /package/dist/docs/assets/{guides_mcp-oauth.md.C7G7IykG.lean.js → guides_mcp-oauth.md.CzEB6RaG.lean.js} +0 -0
- /package/dist/docs/assets/{reference_sessions.md.DBVFi2Sx.lean.js → reference_sessions.md.B0DdlM-K.lean.js} +0 -0
- /package/dist/docs/assets/{troubleshooting.md.CuVztCKs.lean.js → troubleshooting.md.DQ-hYuZT.lean.js} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offline deploy manifest (workstream Wd of
|
|
3
|
+
* `docs/agent-serve/agent-sdk-event-ingress-plan.md`, Wd-0/Wd-1).
|
|
4
|
+
*
|
|
5
|
+
* The manifest is every piece of deployment metadata that is statically
|
|
6
|
+
* derivable from the agent project — extracted at build/deploy time, with no
|
|
7
|
+
* VM, no engine, and no network — so the control plane can store it before
|
|
8
|
+
* any pod starts and keep answering metadata questions while a deployment is
|
|
9
|
+
* offline or hibernated.
|
|
10
|
+
*
|
|
11
|
+
* Two layers with different stability contracts:
|
|
12
|
+
*
|
|
13
|
+
* - `declarations` is the **versioned wire contract** consumed by the
|
|
14
|
+
* control plane (Wd-2): per-channel event capabilities, egress domains,
|
|
15
|
+
* and public route paths. Validated by {@link agentDeployManifestV1Schema};
|
|
16
|
+
* the CP stores these as columns / column views. Repos are deliberately
|
|
17
|
+
* NOT here — which repos a deployment watches is per-instance deploy
|
|
18
|
+
* configuration, not a property of the code.
|
|
19
|
+
* - `info` is the full static project description — the same payload the
|
|
20
|
+
* engine serves at `GET /v1/info` (`projectInfo`). Stored opaquely by the
|
|
21
|
+
* CP so `/v1/info`-class reads can be served for offline deployments
|
|
22
|
+
* (Wd-5). Its shape evolves with the SDK and is intentionally not pinned
|
|
23
|
+
* by the wire schema beyond "is an object".
|
|
24
|
+
*
|
|
25
|
+
* Event derivation note: each mounted channel publishes its event set in its
|
|
26
|
+
* own `channels[].eventTypes` declaration. A project with no GitHub channel
|
|
27
|
+
* subscribes to no GitHub events, regardless of configured repository scope.
|
|
28
|
+
* Keep that capability per-channel: do not reintroduce a provider-wide event
|
|
29
|
+
* union for control-plane consumers.
|
|
30
|
+
*/
|
|
31
|
+
import type { AgentProject, AgentProjectInfo } from "../types.js";
|
|
32
|
+
export declare const DEPLOY_MANIFEST_VERSION: 1;
|
|
33
|
+
export interface AgentDeployManifestDeclarations {
|
|
34
|
+
egressDomains: string[];
|
|
35
|
+
publicRoutePaths: string[];
|
|
36
|
+
/** Where this runtime mirrors framework-owned sessions and event chunks. */
|
|
37
|
+
frameworkStorage?: "cursor-hosted" | "other" | "none";
|
|
38
|
+
/**
|
|
39
|
+
* Mounted channels with their kinds and per-channel event capability.
|
|
40
|
+
* Scope keys are installation config and are never extracted here.
|
|
41
|
+
* Continuation is opt-in: without a deterministic selector key, every
|
|
42
|
+
* inbound event starts a fresh session. Selector encoding remains open.
|
|
43
|
+
*/
|
|
44
|
+
channels: Array<{
|
|
45
|
+
id: string;
|
|
46
|
+
kind?: string;
|
|
47
|
+
eventTypes?: string[];
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
50
|
+
export interface AgentDeployManifestV1 {
|
|
51
|
+
manifestVersion: 1;
|
|
52
|
+
/** Unix ms at extraction. */
|
|
53
|
+
generatedAtMs: number;
|
|
54
|
+
/** `@cursor/july` version that produced the manifest. */
|
|
55
|
+
cliVersion: string;
|
|
56
|
+
declarations: AgentDeployManifestDeclarations;
|
|
57
|
+
/**
|
|
58
|
+
* Full `projectInfo` payload (see `GET /v1/info`). Opaque to the wire
|
|
59
|
+
* contract; the CP stores it verbatim.
|
|
60
|
+
*/
|
|
61
|
+
info: AgentProjectInfo;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Extract the offline deploy manifest from a loaded project. Pure: no
|
|
65
|
+
* network, no filesystem beyond what `loadAgentProject` already read.
|
|
66
|
+
*/
|
|
67
|
+
export declare function buildAgentDeployManifest(project: AgentProject, options?: {
|
|
68
|
+
nowMs?: number;
|
|
69
|
+
cliVersion?: string;
|
|
70
|
+
}): AgentDeployManifestV1;
|
|
71
|
+
/**
|
|
72
|
+
* Parse an untrusted manifest (round-trip check for the CLI's own output;
|
|
73
|
+
* the CP re-validates server-side with its own copy of the contract).
|
|
74
|
+
*/
|
|
75
|
+
export declare function parseAgentDeployManifest(raw: unknown): AgentDeployManifestV1 | undefined;
|
|
76
|
+
//# sourceMappingURL=deploy-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-manifest.d.ts","sourceRoot":"","sources":["../../src/internal/deploy-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIlE,eAAO,MAAM,uBAAuB,EAAE,CAAK,CAAC;AA6B5C,MAAM,WAAW,+BAA+B;IAC9C,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;IACtD;;;;;OAKG;IACH,QAAQ,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CACvE;AAED,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,CAAC,CAAC;IACnB,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,+BAA+B,CAAC;IAC9C;;;OAGG;IACH,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAChD,qBAAqB,CA2CvB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,OAAO,GACX,qBAAqB,GAAG,SAAS,CAOnC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offline deploy manifest (workstream Wd of
|
|
3
|
+
* `docs/agent-serve/agent-sdk-event-ingress-plan.md`, Wd-0/Wd-1).
|
|
4
|
+
*
|
|
5
|
+
* The manifest is every piece of deployment metadata that is statically
|
|
6
|
+
* derivable from the agent project — extracted at build/deploy time, with no
|
|
7
|
+
* VM, no engine, and no network — so the control plane can store it before
|
|
8
|
+
* any pod starts and keep answering metadata questions while a deployment is
|
|
9
|
+
* offline or hibernated.
|
|
10
|
+
*
|
|
11
|
+
* Two layers with different stability contracts:
|
|
12
|
+
*
|
|
13
|
+
* - `declarations` is the **versioned wire contract** consumed by the
|
|
14
|
+
* control plane (Wd-2): per-channel event capabilities, egress domains,
|
|
15
|
+
* and public route paths. Validated by {@link agentDeployManifestV1Schema};
|
|
16
|
+
* the CP stores these as columns / column views. Repos are deliberately
|
|
17
|
+
* NOT here — which repos a deployment watches is per-instance deploy
|
|
18
|
+
* configuration, not a property of the code.
|
|
19
|
+
* - `info` is the full static project description — the same payload the
|
|
20
|
+
* engine serves at `GET /v1/info` (`projectInfo`). Stored opaquely by the
|
|
21
|
+
* CP so `/v1/info`-class reads can be served for offline deployments
|
|
22
|
+
* (Wd-5). Its shape evolves with the SDK and is intentionally not pinned
|
|
23
|
+
* by the wire schema beyond "is an object".
|
|
24
|
+
*
|
|
25
|
+
* Event derivation note: each mounted channel publishes its event set in its
|
|
26
|
+
* own `channels[].eventTypes` declaration. A project with no GitHub channel
|
|
27
|
+
* subscribes to no GitHub events, regardless of configured repository scope.
|
|
28
|
+
* Keep that capability per-channel: do not reintroduce a provider-wide event
|
|
29
|
+
* union for control-plane consumers.
|
|
30
|
+
*/
|
|
31
|
+
import { z } from "zod";
|
|
32
|
+
import { isPublicEndpointPolicy } from "../channels.js";
|
|
33
|
+
import { isCursorHostedStorage } from "../storage-backends/cursor-hosted.js";
|
|
34
|
+
import { projectInfo } from "./discovery.js";
|
|
35
|
+
import { packageVersion } from "./distribution.js";
|
|
36
|
+
export const DEPLOY_MANIFEST_VERSION = 1;
|
|
37
|
+
/**
|
|
38
|
+
* Versioned wire contract for the CP-consumed declaration fields. Kept
|
|
39
|
+
* module-private (the package builds with isolated declarations); consumers
|
|
40
|
+
* use {@link parseAgentDeployManifest} and the explicit interfaces below.
|
|
41
|
+
*/
|
|
42
|
+
const agentDeployManifestV1Schema = z.object({
|
|
43
|
+
manifestVersion: z.literal(DEPLOY_MANIFEST_VERSION),
|
|
44
|
+
generatedAtMs: z.number().int().nonnegative(),
|
|
45
|
+
cliVersion: z.string().min(1),
|
|
46
|
+
declarations: z.object({
|
|
47
|
+
egressDomains: z.array(z.string().min(1)).max(64),
|
|
48
|
+
publicRoutePaths: z.array(z.string().min(1)).max(64),
|
|
49
|
+
frameworkStorage: z.enum(["cursor-hosted", "other", "none"]).optional(),
|
|
50
|
+
channels: z
|
|
51
|
+
.array(z.object({
|
|
52
|
+
id: z.string().min(1).max(128),
|
|
53
|
+
kind: z.string().min(1).max(32).optional(),
|
|
54
|
+
eventTypes: z.array(z.string().min(1).max(64)).max(64).optional(),
|
|
55
|
+
}))
|
|
56
|
+
.max(64),
|
|
57
|
+
}),
|
|
58
|
+
// Full `projectInfo` payload — opaque to the wire contract.
|
|
59
|
+
info: z.record(z.unknown()),
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Extract the offline deploy manifest from a loaded project. Pure: no
|
|
63
|
+
* network, no filesystem beyond what `loadAgentProject` already read.
|
|
64
|
+
*/
|
|
65
|
+
export function buildAgentDeployManifest(project, options) {
|
|
66
|
+
var _a;
|
|
67
|
+
var _b, _c, _d;
|
|
68
|
+
const channels = project.channels.map((channel) => {
|
|
69
|
+
var _a, _b, _c;
|
|
70
|
+
const kind = (_a = channel.definition.meta) === null || _a === void 0 ? void 0 : _a.kind;
|
|
71
|
+
const githubEvents = (_b = channel.definition.meta) === null || _b === void 0 ? void 0 : _b.githubWebhookEvents;
|
|
72
|
+
const originEvents = (_c = channel.definition.meta) === null || _c === void 0 ? void 0 : _c.originWebhookEvents;
|
|
73
|
+
const eventTypes = githubEvents !== undefined
|
|
74
|
+
? [...githubEvents].sort()
|
|
75
|
+
: originEvents !== undefined
|
|
76
|
+
? [...originEvents].sort()
|
|
77
|
+
: undefined;
|
|
78
|
+
return {
|
|
79
|
+
id: channel.id,
|
|
80
|
+
kind,
|
|
81
|
+
eventTypes,
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
// Same mapping as `july deploy` (cli-deploy.ts): channels declared public
|
|
85
|
+
// via `publicEndpoint()` become alias-token-free route prefixes.
|
|
86
|
+
const publicRoutePaths = project.channels
|
|
87
|
+
.filter((channel) => { var _a; return ((_a = channel.definition.auth) !== null && _a !== void 0 ? _a : []).some(isPublicEndpointPolicy); })
|
|
88
|
+
.map((channel) => `/v1/channels/${channel.id}`);
|
|
89
|
+
return {
|
|
90
|
+
manifestVersion: DEPLOY_MANIFEST_VERSION,
|
|
91
|
+
generatedAtMs: (_b = options === null || options === void 0 ? void 0 : options.nowMs) !== null && _b !== void 0 ? _b : Date.now(),
|
|
92
|
+
cliVersion: (_c = options === null || options === void 0 ? void 0 : options.cliVersion) !== null && _c !== void 0 ? _c : packageVersion(),
|
|
93
|
+
declarations: {
|
|
94
|
+
egressDomains: [...((_d = (_a = project.agent.hosting) === null || _a === void 0 ? void 0 : _a.egressDomains) !== null && _d !== void 0 ? _d : [])],
|
|
95
|
+
publicRoutePaths,
|
|
96
|
+
frameworkStorage: project.storage === undefined
|
|
97
|
+
? "none"
|
|
98
|
+
: isCursorHostedStorage(project.storage)
|
|
99
|
+
? "cursor-hosted"
|
|
100
|
+
: "other",
|
|
101
|
+
channels,
|
|
102
|
+
},
|
|
103
|
+
info: projectInfo(project),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Parse an untrusted manifest (round-trip check for the CLI's own output;
|
|
108
|
+
* the CP re-validates server-side with its own copy of the contract).
|
|
109
|
+
*/
|
|
110
|
+
export function parseAgentDeployManifest(raw) {
|
|
111
|
+
const parsed = agentDeployManifestV1Schema.safeParse(raw);
|
|
112
|
+
// `info` is opaque to the wire schema (validated as a plain object) but
|
|
113
|
+
// typed as AgentProjectInfo for producers/consumers inside the SDK.
|
|
114
|
+
return parsed.success
|
|
115
|
+
? parsed.data
|
|
116
|
+
: undefined;
|
|
117
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment-scoped SCM event intake for hosted multi-tenant agents.
|
|
3
|
+
*
|
|
4
|
+
* Instead of receiving HMAC-signed webhook forwards from the backend (which
|
|
5
|
+
* required a shared `GITHUB_WEBHOOK_SECRET` / forward-secret pair), the
|
|
6
|
+
* engine pulls its deliveries from the control plane's deployment-scoped
|
|
7
|
+
* event stream:
|
|
8
|
+
*
|
|
9
|
+
* GET /internal/agent-serve/automation-agent-sdk/events
|
|
10
|
+
*
|
|
11
|
+
* authenticated with the engine pod's `CURSOR_API_KEY` — the same
|
|
12
|
+
* credential (and server-side deployment allowlist) that authorizes the
|
|
13
|
+
* consuming agent's customer list read. The backend writes each envelope's
|
|
14
|
+
* `installationId` itself from the verified GitHub delivery, so agent-side
|
|
15
|
+
* tenant binding does not depend on an HMAC-covered payload.
|
|
16
|
+
*
|
|
17
|
+
* Each envelope is stubbed into a GitHub-shaped `pull_request` webhook body
|
|
18
|
+
* and POSTed to this process's own github channel route over loopback
|
|
19
|
+
* (admitted by the channel's no-secret `localDevStrict` policy), so the
|
|
20
|
+
* consuming agent's whole pipeline — Zod parse, cursorAccount credential
|
|
21
|
+
* lease, customer routing, tools — runs unchanged. Loopback (rather than
|
|
22
|
+
* the in-process `handleAgentServeTrigger` fan-out the `--cursor-events`
|
|
23
|
+
* relay uses) is deliberate: this stream is started from a channel's
|
|
24
|
+
* `onStart`, which cannot reach the serve-level mount/handler wiring.
|
|
25
|
+
*
|
|
26
|
+
* Offsets are client-owned (`<ms>-<seq>` Redis stream ids) and persisted
|
|
27
|
+
* under the state dir so a restart resumes where it left off instead of
|
|
28
|
+
* dropping deliveries (the old push path was fire-and-forget).
|
|
29
|
+
*
|
|
30
|
+
* INTERNAL: first-party host plumbing shared by agents in `factory/*`.
|
|
31
|
+
* Consumed via relative source imports, following
|
|
32
|
+
* `tenant-mcp/run-mcp-registry.ts`. Policy (which deliveries to act on,
|
|
33
|
+
* tenant routing) stays in the consuming agent; this module is transport
|
|
34
|
+
* only.
|
|
35
|
+
*/
|
|
36
|
+
export interface AgentSdkScmPullRequestMeta {
|
|
37
|
+
number: number;
|
|
38
|
+
url: string;
|
|
39
|
+
title: string;
|
|
40
|
+
body?: string | null | undefined;
|
|
41
|
+
draft?: boolean | undefined;
|
|
42
|
+
merged?: boolean | undefined;
|
|
43
|
+
authorLogin?: string | undefined;
|
|
44
|
+
headRef: string;
|
|
45
|
+
headSha: string;
|
|
46
|
+
baseRef: string;
|
|
47
|
+
baseSha?: string | undefined;
|
|
48
|
+
}
|
|
49
|
+
/** One entry from the deployment-scoped control-plane event stream. */
|
|
50
|
+
export interface AgentSdkScmEventEnvelope {
|
|
51
|
+
provider: "github";
|
|
52
|
+
eventName: string;
|
|
53
|
+
deliveryId: string;
|
|
54
|
+
repo: string;
|
|
55
|
+
receivedAtMs: number;
|
|
56
|
+
action: string;
|
|
57
|
+
/** Tenant-binding material, written by the control plane. */
|
|
58
|
+
installationId: number;
|
|
59
|
+
pullRequest: AgentSdkScmPullRequestMeta;
|
|
60
|
+
occurredAtMs?: number | undefined;
|
|
61
|
+
}
|
|
62
|
+
/** Unknown envelope shapes return undefined (skipped, forward compat). */
|
|
63
|
+
export declare function parseAgentSdkScmEventEnvelope(value: unknown): AgentSdkScmEventEnvelope | undefined;
|
|
64
|
+
/** Whether a webhook body was self-dispatched by this event stream. */
|
|
65
|
+
export declare function isDeploymentEventStreamPayload(payload: unknown): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Stub a GitHub-shaped `pull_request` webhook body from an envelope —
|
|
68
|
+
* enough for agent-serve's pull_request Zod schema, plus `installation.id`
|
|
69
|
+
* so the channel's `ctx.installationId` tenant binding keeps working, plus
|
|
70
|
+
* the {@link isDeploymentEventStreamPayload} source marker.
|
|
71
|
+
* Pure — exported for tests.
|
|
72
|
+
*/
|
|
73
|
+
export declare function envelopeToGitHubPayload(envelope: AgentSdkScmEventEnvelope): Record<string, unknown>;
|
|
74
|
+
export interface AgentSdkEventStreamOptions {
|
|
75
|
+
logger?: (line: string) => void;
|
|
76
|
+
env?: NodeJS.ProcessEnv;
|
|
77
|
+
/** Injected for tests. */
|
|
78
|
+
fetch?: typeof fetch;
|
|
79
|
+
/** Injected for tests (default `process.argv`). */
|
|
80
|
+
argv?: readonly string[];
|
|
81
|
+
/**
|
|
82
|
+
* Prefix for the consumer-scoped env overrides
|
|
83
|
+
* `<prefix>_SELF_WEBHOOK_URL` and `<prefix>_EVENTS_STATE_DIR`
|
|
84
|
+
* (default `AGENT_SERVE`; e.g. the security reviewer passes
|
|
85
|
+
* `SECURITY_REVIEWER` to keep its existing deployment env vars working).
|
|
86
|
+
*/
|
|
87
|
+
envPrefix?: string;
|
|
88
|
+
/** Log-line prefix (default `agent-sdk/deployment-events`). */
|
|
89
|
+
logLabel?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Offset state directory name under `<cwd>/.agent-serve`
|
|
92
|
+
* (default `deployment-events`). Consumers with persisted offsets must
|
|
93
|
+
* keep their historical name or a restart re-anchors at `$`.
|
|
94
|
+
*/
|
|
95
|
+
stateDirName?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Port the serve process is actually listening on, read from its own argv.
|
|
99
|
+
*
|
|
100
|
+
* The channel runs inside the serve process, so `--port <n>` / `--port=<n>`
|
|
101
|
+
* on the command line is authoritative. Hosted-platform engines start with
|
|
102
|
+
* `--port 26100` and export no `PORT` env, so guessing a fixed default posts
|
|
103
|
+
* self-dispatches at a port nothing listens on ("fetch failed" for every
|
|
104
|
+
* delivery).
|
|
105
|
+
*/
|
|
106
|
+
export declare function servePortFromArgv(argv: readonly string[]): string | undefined;
|
|
107
|
+
export interface AgentSdkEventStream {
|
|
108
|
+
stop(): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Start the pull loop. Returns undefined (with a log line) when required
|
|
112
|
+
* config is missing so `serve` still starts — mirroring how other relays
|
|
113
|
+
* degrade instead of failing the host.
|
|
114
|
+
*/
|
|
115
|
+
export declare function startAgentSdkEventStream(options?: AgentSdkEventStreamOptions): AgentSdkEventStream | undefined;
|
|
116
|
+
//# sourceMappingURL=deployment-scm-event-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-scm-event-stream.d.ts","sourceRoot":"","sources":["../../src/internal/deployment-scm-event-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AA2BH,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,uEAAuE;AACvE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,0BAA0B,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAiED,0EAA0E;AAC1E,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,GACb,wBAAwB,GAAG,SAAS,CAqCtC;AA8CD,uEAAuE;AACvE,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAExE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,wBAAwB,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4BzB;AAmDD,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,mDAAmD;IACnD,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAkB7E;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAeD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,0BAA+B,GACvC,mBAAmB,GAAG,SAAS,CAwLjC"}
|