@cursor/july 0.1.95 → 0.1.96
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 +3 -4
- package/dist/channels/deployments/types.d.ts +1 -1
- package/dist/channels/deployments/types.d.ts.map +1 -1
- package/dist/channels/deployments/types.js +1 -0
- package/dist/channels/origin/api.d.ts +59 -13
- package/dist/channels/origin/api.d.ts.map +1 -1
- package/dist/channels/origin/api.js +168 -27
- package/dist/channels/origin/binding.d.ts +2 -2
- package/dist/channels/origin/checks.d.ts +6 -6
- package/dist/channels/origin/checks.js +6 -6
- package/dist/channels/origin/cursor-account.d.ts +5 -3
- package/dist/channels/origin/cursor-account.d.ts.map +1 -1
- package/dist/channels/origin/cursor-account.js +5 -3
- package/dist/channels/slack/api.d.ts +9 -0
- package/dist/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +36 -5
- package/dist/channels/slack/defaults.d.ts.map +1 -1
- package/dist/channels/slack/defaults.js +17 -46
- package/dist/channels/slack/dispatch.d.ts +7 -1
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +47 -23
- package/dist/channels/slack/inbound.d.ts +8 -0
- package/dist/channels/slack/inbound.d.ts.map +1 -1
- package/dist/channels/slack/inbound.js +32 -0
- package/dist/channels/slack/live-delivery.d.ts +26 -29
- package/dist/channels/slack/live-delivery.d.ts.map +1 -1
- package/dist/channels/slack/live-delivery.js +172 -73
- package/dist/channels/slack/manifest.d.ts.map +1 -1
- package/dist/channels/slack/manifest.js +5 -1
- package/dist/channels/slack/nudge-carrier.d.ts +2 -0
- package/dist/channels/slack/nudge-carrier.d.ts.map +1 -1
- package/dist/channels/slack/nudge-carrier.js +48 -1
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +2 -2
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.BBj0klBO.js → app.jXleCmOc.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DFoGuETX.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.CUEXpL78.js → VPLocalSearchBox.8LhyglIT.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DabmQnia.js → theme.9ged-pr2.js} +2 -2
- package/dist/docs/assets/index.md.CI93Ltlb.js +5 -0
- package/dist/docs/assets/{index.md.BoHaMdeZ.lean.js → index.md.CI93Ltlb.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.BsMOxDvh.js → reference_cli.md.CCnG-nJx.js} +2 -1
- package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.js +2 -0
- package/dist/docs/assets/templates_code-wiki.md.CDYZIBFN.lean.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +4 -4
- package/dist/docs/deployment.html +4 -4
- package/dist/docs/evals.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 +4 -4
- package/dist/docs/guides/github.html +4 -4
- 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/index.md +3 -1
- package/dist/docs/llms-full.txt +102 -3
- package/dist/docs/llms.txt +1 -0
- 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 +7 -6
- package/dist/docs/reference/cli.md +3 -2
- 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 +4 -4
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/agentic-owners.html +4 -4
- package/dist/docs/templates/code-wiki.html +28 -0
- package/dist/docs/templates/code-wiki.md +91 -0
- package/dist/docs/templates/demo.html +5 -5
- package/dist/docs/templates/pr-autofixer.html +4 -4
- package/dist/docs/templates/security-help.html +4 -4
- package/dist/docs/templates/security-reviewer.html +5 -5
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/files-backends/cursor-hosted.d.ts +26 -4
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/files-backends/cursor-hosted.js +32 -4
- package/dist/internal/advertise-tools.d.ts +2 -0
- package/dist/internal/advertise-tools.d.ts.map +1 -1
- package/dist/internal/advertise-tools.js +15 -1
- package/dist/internal/bounded.d.ts +7 -0
- package/dist/internal/bounded.d.ts.map +1 -0
- package/dist/internal/bounded.js +32 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +7 -1
- package/dist/internal/conversation-mirror.d.ts +11 -8
- package/dist/internal/conversation-mirror.d.ts.map +1 -1
- package/dist/internal/conversation-mirror.js +116 -55
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +22 -48
- package/dist/internal/cursor/session-token.d.ts +45 -0
- package/dist/internal/cursor/session-token.d.ts.map +1 -0
- package/dist/internal/cursor/session-token.js +99 -0
- package/dist/internal/cursor-agent-template.d.ts +1 -1
- package/dist/internal/cursor-agent-template.d.ts.map +1 -1
- package/dist/internal/cursor-agent-template.js +1 -0
- package/dist/internal/framework-file-storage.d.ts +61 -0
- package/dist/internal/framework-file-storage.d.ts.map +1 -0
- package/dist/internal/framework-file-storage.js +204 -0
- package/dist/internal/framework-storage-selection.d.ts +11 -5
- package/dist/internal/framework-storage-selection.d.ts.map +1 -1
- package/dist/internal/framework-storage-selection.js +38 -11
- package/dist/internal/hosted-delivery.d.ts +7 -0
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +4 -0
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +2 -0
- package/dist/internal/install-cursor-skills.d.ts.map +1 -1
- package/dist/internal/install-cursor-skills.js +1 -3
- package/dist/internal/managed-delivery.d.ts +80 -0
- package/dist/internal/managed-delivery.d.ts.map +1 -0
- package/dist/internal/managed-delivery.js +86 -0
- package/dist/internal/runtime-dispatch-runner.d.ts +5 -1
- package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
- package/dist/internal/runtime-dispatch-runner.js +7 -0
- package/dist/internal/sdk-runner.d.ts +11 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +39 -8
- package/dist/internal/server.js +1 -0
- package/dist/internal/session-engine.d.ts +13 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +62 -3
- package/dist/internal/steering.d.ts +15 -0
- package/dist/internal/steering.d.ts.map +1 -0
- package/dist/internal/steering.js +18 -0
- package/dist/playground/assets/index-B1DDvBeC.css +1 -0
- package/dist/playground/assets/{index-CZA1uEWA.js → index-Cx9CclK_.js} +51 -51
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted.d.ts +8 -5
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +4 -3
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +3 -1
- package/docs/reference/cli.md +3 -2
- package/docs/templates/code-wiki.md +96 -0
- package/package.json +2 -2
- package/skills/ab/SKILL.md +13 -97
- package/skills/create-agent/SKILL.md +123 -223
- package/skills/debug/SKILL.md +34 -68
- package/skills/evals/SKILL.md +55 -180
- package/skills/framework-map/SKILL.md +83 -145
- package/skills/github/SKILL.md +53 -111
- package/skills/hillclimb/SKILL.md +40 -163
- package/skills/mcp-auth/SKILL.md +48 -107
- package/skills/otel/SKILL.md +22 -68
- package/skills/setup-slack/SKILL.md +77 -208
- package/src/channels/deployments/types.ts +1 -0
- package/src/channels/origin/api.ts +242 -30
- package/src/channels/origin/binding.ts +2 -2
- package/src/channels/origin/checks.ts +6 -6
- package/src/channels/origin/cursor-account.ts +5 -3
- package/src/channels/slack/api.ts +41 -5
- package/src/channels/slack/defaults.ts +15 -49
- package/src/channels/slack/dispatch.ts +56 -22
- package/src/channels/slack/inbound.ts +43 -0
- package/src/channels/slack/live-delivery.ts +235 -114
- package/src/channels/slack/manifest.ts +5 -1
- package/src/channels/slack/nudge-carrier.ts +48 -1
- package/src/channels/slack/slack-channel.ts +2 -0
- package/src/files-backends/cursor-hosted.ts +40 -7
- package/src/internal/advertise-tools.ts +18 -2
- package/src/internal/bounded.ts +28 -0
- package/src/internal/cli-deploy.ts +12 -0
- package/src/internal/conversation-mirror.ts +145 -69
- package/src/internal/cursor/backend-client.ts +34 -58
- package/src/internal/cursor/session-token.ts +115 -0
- package/src/internal/cursor-agent-template.ts +1 -0
- package/src/internal/framework-file-storage.ts +222 -0
- package/src/internal/framework-storage-selection.ts +51 -11
- package/src/internal/hosted-delivery.ts +10 -0
- package/src/internal/init-project.ts +2 -0
- package/src/internal/install-cursor-skills.ts +1 -4
- package/src/internal/managed-delivery.ts +125 -0
- package/src/internal/runtime-dispatch-runner.ts +10 -0
- package/src/internal/sdk-runner.ts +56 -8
- package/src/internal/server.ts +2 -0
- package/src/internal/session-engine.ts +64 -4
- package/src/internal/steering.ts +17 -0
- package/src/storage-backends/cursor-hosted.ts +9 -7
- package/src/types.ts +2 -1
- package/templates/code-wiki/README.md +34 -0
- package/templates/code-wiki/agent/agent.ts +8 -0
- package/templates/code-wiki/agent/channels/github.ts +144 -0
- package/templates/code-wiki/agent/instructions.md +39 -0
- package/templates/code-wiki/agent/lib/repos.ts +5 -0
- package/templates/code-wiki/agent/lib/wiki.ts +22 -0
- package/templates/code-wiki/agent/tools/apply_wiki.ts +219 -0
- package/templates/code-wiki/evals/evals.config.ts +5 -0
- package/templates/code-wiki/evals/wiki.eval.ts +132 -0
- package/templates/code-wiki/init.json +25 -0
- package/templates/code-wiki/package.json +18 -0
- package/templates/code-wiki/tsconfig.json +12 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.oqPawjiD.js +0 -1
- package/dist/docs/assets/index.md.BoHaMdeZ.js +0 -5
- package/dist/internal/deployment-scm-event-stream.d.ts +0 -116
- package/dist/internal/deployment-scm-event-stream.d.ts.map +0 -1
- package/dist/internal/deployment-scm-event-stream.js +0 -474
- package/dist/playground/assets/index-CF7hUDnQ.css +0 -1
- package/src/internal/deployment-scm-event-stream.ts +0 -593
- /package/dist/docs/assets/{reference_cli.md.BsMOxDvh.lean.js → reference_cli.md.CCnG-nJx.lean.js} +0 -0
|
@@ -17,11 +17,17 @@
|
|
|
17
17
|
*
|
|
18
18
|
* - **Cursor-managed hosting** (the deployment-generation environment
|
|
19
19
|
* variable is set, same signal that registers `GET /v1/manifest`):
|
|
20
|
-
* the Cursor-hosted backend
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
20
|
+
* the Cursor-hosted backend. When the deployment carries a
|
|
21
|
+
* **framework-level file store**
|
|
22
|
+
* (`AGENT_SERVE_FRAMEWORK_STORE_SOURCE_ID`), session records, event
|
|
23
|
+
* transcripts, and the continuation index live there — file-shaped state
|
|
24
|
+
* on file storage, apart from the author-facing user store — while
|
|
25
|
+
* `host.kv`, eval runs, A/B samples, and conditional writes stay on the
|
|
26
|
+
* control-plane KV proxy (see framework-file-storage.ts). Without one
|
|
27
|
+
* (a deploy predating framework-store provisioning), everything goes to
|
|
28
|
+
* the KV proxy as before. The API key resolves through the full
|
|
29
|
+
* credential chain on every call because hosted freeze snapshots listen
|
|
30
|
+
* unsigned and the binder drops the key file after restore.
|
|
25
31
|
* - **Self-hosted**: no mirror. `--state-root` is the durable copy, which
|
|
26
32
|
* is correct when the operator owns the disk.
|
|
27
33
|
*
|
|
@@ -33,10 +39,12 @@
|
|
|
33
39
|
* the session store; what this selects is the durable mirror *beyond* the
|
|
34
40
|
* pod's filesystem.
|
|
35
41
|
*/
|
|
42
|
+
import { cursorFrameworkStoreSourceId, cursorHostedFiles, } from "../files-backends/cursor-hosted.js";
|
|
36
43
|
import { defineStorage } from "../storage.js";
|
|
37
44
|
import { cursorHostedStorage } from "../storage-backends/cursor-hosted.js";
|
|
38
45
|
import { resolveApiKeySync } from "./cursor/credentials.js";
|
|
39
46
|
import { AGENT_SERVE_GENERATION_ENV_VAR } from "./cursor-relay-core.js";
|
|
47
|
+
import { composeFrameworkStorage, fileSinkStorageCore, frameworkGuardedCas, } from "./framework-file-storage.js";
|
|
40
48
|
/**
|
|
41
49
|
* Pick the backend for framework session state.
|
|
42
50
|
*
|
|
@@ -60,10 +68,29 @@ export function selectFrameworkStorageDefinition(input) {
|
|
|
60
68
|
// Self-hosted v2: the state root is the durable copy.
|
|
61
69
|
return undefined;
|
|
62
70
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
71
|
+
// Hosted v2 pods wake per delivery: bulk-restoring up to the default
|
|
72
|
+
// 1000 sessions on every boot is waste (and against the file-store
|
|
73
|
+
// backend it is per-key HTTP round trips before the listener even
|
|
74
|
+
// comes up). Follow-ups restore lazily by continuation or session id;
|
|
75
|
+
// GET /v1/sessions lists from the sink either way.
|
|
76
|
+
const policy = { restore: "off" };
|
|
77
|
+
// Full chain (env → key file → stored login): frozen engines listen
|
|
78
|
+
// unsigned and bind CURSOR_API_KEY_FILE at task time, after this
|
|
79
|
+
// definition is constructed.
|
|
80
|
+
const resolveApiKey = () => { var _a; return (_a = resolveApiKeySync()) === null || _a === void 0 ? void 0 : _a.apiKey; };
|
|
81
|
+
const kv = cursorHostedStorage({ resolveApiKey });
|
|
82
|
+
const frameworkStoreId = cursorFrameworkStoreSourceId(env);
|
|
83
|
+
if (frameworkStoreId === undefined) {
|
|
84
|
+
return defineStorage(Object.assign({ name: "cursor-hosted", policy }, kv));
|
|
85
|
+
}
|
|
86
|
+
// Framework session state on the framework-level file store; author kv,
|
|
87
|
+
// evals, and A/B tables stay on the KV proxy (spread from `kv`, which
|
|
88
|
+
// also carries the cursor-hosted marker for GET /v1/sessions).
|
|
89
|
+
return defineStorage(Object.assign(Object.assign(Object.assign({ name: "cursor-hosted (framework files)", policy }, kv), composeFrameworkStorage({
|
|
90
|
+
kv,
|
|
91
|
+
files: fileSinkStorageCore(cursorHostedFiles({ storeSourceId: frameworkStoreId, resolveApiKey })),
|
|
92
|
+
})), {
|
|
93
|
+
// CAS stays on the KV proxy but must refuse framework-file keys, or a
|
|
94
|
+
// future coordination path would split-brain against the plain core.
|
|
95
|
+
cas: frameworkGuardedCas(kv.cas) }));
|
|
69
96
|
}
|
|
@@ -32,6 +32,13 @@ export declare function registerHostedDeliveryRoute(input: {
|
|
|
32
32
|
definition: object;
|
|
33
33
|
}>;
|
|
34
34
|
buildHandlerArgs(channelId: string, sessionPublicId?: string): ChannelHandlerArgs;
|
|
35
|
+
/**
|
|
36
|
+
* Await the session's durable mirror (dispatch chain + storage queue)
|
|
37
|
+
* before the execution reply: the control plane may park the pod the
|
|
38
|
+
* moment the reply lands, and a shed session-record flush would strand
|
|
39
|
+
* the conversation on the next wake.
|
|
40
|
+
*/
|
|
41
|
+
drainSessionDurability?(sessionId: string): Promise<void>;
|
|
35
42
|
}): void;
|
|
36
43
|
export {};
|
|
37
44
|
//# sourceMappingURL=hosted-delivery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AASrB,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AA6DF;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAa5B;AA2GD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,gBAAgB,CACd,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,MAAM,GACvB,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AASrB,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AA6DF;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAa5B;AA2GD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,gBAAgB,CACd,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,MAAM,GACvB,kBAAkB,CAAC;IACtB;;;;;OAKG;IACH,sBAAsB,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D,GAAG,IAAI,CAyKP"}
|
|
@@ -247,11 +247,15 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
247
247
|
}
|
|
248
248
|
admitted.sessionPublicId = execution.sessionPublicId;
|
|
249
249
|
(_a = admitted.execution) !== null && _a !== void 0 ? _a : (admitted.execution = (() => __awaiter(this, void 0, void 0, function* () {
|
|
250
|
+
var _a;
|
|
250
251
|
const args = input.buildHandlerArgs(admitted.send.channelId, execution.sessionPublicId);
|
|
251
252
|
const session = yield args.send(admitted.send.message, Object.assign(Object.assign({}, admitted.send.options), { mailboxContinuation: {
|
|
252
253
|
key: admitted.send.mailboxContinuationKey,
|
|
253
254
|
} }));
|
|
254
255
|
const outcome = yield session.waitForCompletion();
|
|
256
|
+
// Failed turns drain too: their record/continuation updates must
|
|
257
|
+
// survive the park just like a finished turn's.
|
|
258
|
+
yield (_a = input.drainSessionDurability) === null || _a === void 0 ? void 0 : _a.call(input, session.id);
|
|
255
259
|
if (outcome.status !== "finished") {
|
|
256
260
|
return {
|
|
257
261
|
status: 503,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-project.d.ts","sourceRoot":"","sources":["../../src/internal/init-project.ts"],"names":[],"mappings":"AAAA;;GAEG;AAoBH,OAAO,EAKL,KAAK,gBAAgB,EAEtB,MAAM,qBAAqB,CAAC;AAQ7B,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,iBAA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ACH,SAAS,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,0BAA0B,GACzD,oBAAoB,CAAC;AAMvB;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,MAAM,CAkBR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAgBzE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAErE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAQpB;AA8BD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,MAAM,EAAE,CAEX;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAkCrC"}
|
|
@@ -22,6 +22,7 @@ import { agentsMd, GITIGNORE, writeDefaultScaffold } from "./init-scaffold.js";
|
|
|
22
22
|
import { makePalette, stdoutPalette, } from "./terminal-style.js";
|
|
23
23
|
const TEMPLATES = {
|
|
24
24
|
"agentic-owners": { dir: "agentic-owners" },
|
|
25
|
+
"code-wiki": { dir: "code-wiki" },
|
|
25
26
|
demo: { dir: "demo" },
|
|
26
27
|
"pr-autofixer": { dir: "pr-autofixer" },
|
|
27
28
|
"security-help": { dir: "security-help" },
|
|
@@ -497,6 +498,7 @@ export function printInitGuide() {
|
|
|
497
498
|
Scaffold a project, then open the playground:
|
|
498
499
|
npx ${PACKAGE_NAME} init ./my-agent # installs deps + links agent-sdk onto PATH
|
|
499
500
|
npx ${PACKAGE_NAME} init ./my-demo --template demo # record a PR walkthrough
|
|
501
|
+
npx ${PACKAGE_NAME} init ./code-wiki --template code-wiki # keep wiki pages current after merge
|
|
500
502
|
npx ${PACKAGE_NAME} init ./my-reviewer --template security-reviewer # review PRs for security bugs
|
|
501
503
|
npx ${PACKAGE_NAME} init ./security-help --template security-help # answer security questions in Slack
|
|
502
504
|
npx ${PACKAGE_NAME} init ./my-triage --template triage-linear # comment on Linear issues
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-cursor-skills.d.ts","sourceRoot":"","sources":["../../src/internal/install-cursor-skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"install-cursor-skills.d.ts","sourceRoot":"","sources":["../../src/internal/install-cursor-skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmBH,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAElD,uFAAuF;AACvF,eAAO,MAAM,8BAA8B,aAAa,CAAC;AAEzD,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,2BAA2B,4BAA4B,CAAC;AAErE,qDAAqD;AACrD,eAAO,MAAM,kCAAkC,mCACb,CAAC;AAEnC,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAStD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAIrE;AAED,wEAAwE;AACxE,wBAAgB,uBAAuB,CACrC,UAAU,GAAE,MAA2B,GACtC,MAAM,CAER;AAED,8CAA8C;AAC9C,wBA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AAM,KAAK,IAAI,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAkEpD;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAsB9B"}
|
|
@@ -28,8 +28,6 @@ import { join } from "node:path";
|
|
|
28
28
|
import { CLI_COMMAND_NAME, packageRootDir } from "./distribution.js";
|
|
29
29
|
import { parseFrontmatter } from "./frontmatter.js";
|
|
30
30
|
import { stdoutPalette } from "./terminal-style.js";
|
|
31
|
-
/** Monorepo-only skill; excluded from the published package. */
|
|
32
|
-
const SKIP_SKILL_DIRS = new Set(["operate"]);
|
|
33
31
|
/** Category folder under ~/.cursor/skills (Cursor discovers nested skills). */
|
|
34
32
|
export const CURSOR_SKILLS_NAMESPACE = "agentsdk";
|
|
35
33
|
/** Pre-rename install folder. Install deletes this so `/agentkit-*` rows disappear. */
|
|
@@ -91,7 +89,7 @@ export function listShippedPackageSkills() {
|
|
|
91
89
|
}
|
|
92
90
|
const skills = [];
|
|
93
91
|
for (const entry of entries) {
|
|
94
|
-
if (!entry.isDirectory()
|
|
92
|
+
if (!entry.isDirectory()) {
|
|
95
93
|
continue;
|
|
96
94
|
}
|
|
97
95
|
const sourceDir = join(skillsRoot, entry.name);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Envelope-carried installation config for managed-product deliveries
|
|
3
|
+
* (plan 0002 Stack H1; envelope shape from Stack B1).
|
|
4
|
+
*
|
|
5
|
+
* On the v2 architecture a managed product (security-reviewer, …) is many
|
|
6
|
+
* single-tenant deployments: the pre-signal trigger gate matches the
|
|
7
|
+
* customer's automation trigger before a workflow starts and stamps the
|
|
8
|
+
* matched automation uuid + an opaque installation-config reference on the
|
|
9
|
+
* attributed session envelope. The delivery activity forwards the matched
|
|
10
|
+
* installation-config document to the fork **inside the webhook payload it
|
|
11
|
+
* POSTs to the channel**, under {@link MANAGED_DELIVERY_PAYLOAD_KEY} — the
|
|
12
|
+
* same embed-in-payload pattern the legacy deployment event stream used
|
|
13
|
+
* for its source marker.
|
|
14
|
+
*
|
|
15
|
+
* This module is the one contract both sides share: the control-plane
|
|
16
|
+
* delivery path embeds with {@link withManagedDeliveryConfig}; the agent's
|
|
17
|
+
* channels detect and read with {@link parseManagedDeliveryConfig}. The
|
|
18
|
+
* document mirrors the sync layer's `ManagedAutomationConfigDoc` **policy**
|
|
19
|
+
* fields that "ride the delivery envelope to the fork" (posting mode,
|
|
20
|
+
* managed config, trigger snapshots for the channel's staleness guard);
|
|
21
|
+
* readers ignore unknown fields so a newer sync can add material without
|
|
22
|
+
* breaking older forks. The automation's MCP server refs deliberately do
|
|
23
|
+
* NOT ride here: they travel on the hosted-admission envelope's
|
|
24
|
+
* `managedAutomation` slice (plan 0002 G2, `hosted-delivery-protocol.ts` /
|
|
25
|
+
* `hosted-managed-automation.ts`) so one mechanism owns MCP attach.
|
|
26
|
+
*
|
|
27
|
+
* INTERNAL: first-party host plumbing shared by agents in `factory/*`,
|
|
28
|
+
* consumed via relative source imports. Deliberately excluded from the
|
|
29
|
+
* published `@cursor/july` npm package (see the `files` whitelist).
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Key inside the delivered webhook payload under which the delivery
|
|
33
|
+
* activity embeds the matched installation config. Chosen to never
|
|
34
|
+
* collide with a provider webhook field (GitHub and Origin payloads have
|
|
35
|
+
* no `cursor*` keys).
|
|
36
|
+
*/
|
|
37
|
+
export declare const MANAGED_DELIVERY_PAYLOAD_KEY: "cursorManagedDelivery";
|
|
38
|
+
/**
|
|
39
|
+
* The matched installation-config document as it rides the delivery to
|
|
40
|
+
* the fork. Required: the matched automation uuid (B1 attribution).
|
|
41
|
+
* Everything else is optional; absent fields keep the channel's default
|
|
42
|
+
* posture (post, all modules enabled, no staleness guard).
|
|
43
|
+
*/
|
|
44
|
+
export interface ManagedDeliveryInstallationConfig {
|
|
45
|
+
/** Source managed automation uuid the pre-signal gate matched. */
|
|
46
|
+
matchedAutomationUuid: string;
|
|
47
|
+
/** Opaque `<installationId>@<resourceVersion>` config reference. */
|
|
48
|
+
installationConfigRef?: string;
|
|
49
|
+
managedType?: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Whether product output (PR comments, …) posts for this installation,
|
|
53
|
+
* or the run stays check/shadow-only. Channels post only on `"post"`
|
|
54
|
+
* (or when the field is absent) — any other value fails closed to
|
|
55
|
+
* shadow, so a newer mode name never posts by accident.
|
|
56
|
+
*/
|
|
57
|
+
postingMode?: string;
|
|
58
|
+
managedConfig?: Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* The automation's git triggers as `GitTrigger.toJson()` snapshots.
|
|
61
|
+
* The channel re-checks the delivery against them (staleness guard:
|
|
62
|
+
* the config may have changed between admission and delivery).
|
|
63
|
+
*/
|
|
64
|
+
triggerSnapshots?: unknown[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Read the embedded installation config out of a delivered webhook
|
|
68
|
+
* payload. Returns undefined for payloads without the key (legacy
|
|
69
|
+
* deliveries, host relay, fixtures) and for documents missing the
|
|
70
|
+
* required matched automation uuid — the channel then runs its legacy
|
|
71
|
+
* path unchanged. Malformed optional fields are dropped, not fatal.
|
|
72
|
+
*/
|
|
73
|
+
export declare function parseManagedDeliveryConfig(payload: unknown): ManagedDeliveryInstallationConfig | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Embed one matched installation config into the webhook payload the
|
|
76
|
+
* delivery activity POSTs to the channel. Pure; used by the control-plane
|
|
77
|
+
* delivery path and by channel tests building fixture envelopes.
|
|
78
|
+
*/
|
|
79
|
+
export declare function withManagedDeliveryConfig(payload: Record<string, unknown>, config: ManagedDeliveryInstallationConfig): Record<string, unknown>;
|
|
80
|
+
//# sourceMappingURL=managed-delivery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/managed-delivery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,EAAG,uBAAgC,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,WAAW,iCAAiC;IAChD,kEAAkE;IAClE,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oEAAoE;IACpE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;CAC9B;AAcD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,GACf,iCAAiC,GAAG,SAAS,CAuB/C;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,MAAM,EAAE,iCAAiC,GACxC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Envelope-carried installation config for managed-product deliveries
|
|
3
|
+
* (plan 0002 Stack H1; envelope shape from Stack B1).
|
|
4
|
+
*
|
|
5
|
+
* On the v2 architecture a managed product (security-reviewer, …) is many
|
|
6
|
+
* single-tenant deployments: the pre-signal trigger gate matches the
|
|
7
|
+
* customer's automation trigger before a workflow starts and stamps the
|
|
8
|
+
* matched automation uuid + an opaque installation-config reference on the
|
|
9
|
+
* attributed session envelope. The delivery activity forwards the matched
|
|
10
|
+
* installation-config document to the fork **inside the webhook payload it
|
|
11
|
+
* POSTs to the channel**, under {@link MANAGED_DELIVERY_PAYLOAD_KEY} — the
|
|
12
|
+
* same embed-in-payload pattern the legacy deployment event stream used
|
|
13
|
+
* for its source marker.
|
|
14
|
+
*
|
|
15
|
+
* This module is the one contract both sides share: the control-plane
|
|
16
|
+
* delivery path embeds with {@link withManagedDeliveryConfig}; the agent's
|
|
17
|
+
* channels detect and read with {@link parseManagedDeliveryConfig}. The
|
|
18
|
+
* document mirrors the sync layer's `ManagedAutomationConfigDoc` **policy**
|
|
19
|
+
* fields that "ride the delivery envelope to the fork" (posting mode,
|
|
20
|
+
* managed config, trigger snapshots for the channel's staleness guard);
|
|
21
|
+
* readers ignore unknown fields so a newer sync can add material without
|
|
22
|
+
* breaking older forks. The automation's MCP server refs deliberately do
|
|
23
|
+
* NOT ride here: they travel on the hosted-admission envelope's
|
|
24
|
+
* `managedAutomation` slice (plan 0002 G2, `hosted-delivery-protocol.ts` /
|
|
25
|
+
* `hosted-managed-automation.ts`) so one mechanism owns MCP attach.
|
|
26
|
+
*
|
|
27
|
+
* INTERNAL: first-party host plumbing shared by agents in `factory/*`,
|
|
28
|
+
* consumed via relative source imports. Deliberately excluded from the
|
|
29
|
+
* published `@cursor/july` npm package (see the `files` whitelist).
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Key inside the delivered webhook payload under which the delivery
|
|
33
|
+
* activity embeds the matched installation config. Chosen to never
|
|
34
|
+
* collide with a provider webhook field (GitHub and Origin payloads have
|
|
35
|
+
* no `cursor*` keys).
|
|
36
|
+
*/
|
|
37
|
+
export const MANAGED_DELIVERY_PAYLOAD_KEY = "cursorManagedDelivery";
|
|
38
|
+
function isRecord(value) {
|
|
39
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
40
|
+
}
|
|
41
|
+
function nonEmptyString(value) {
|
|
42
|
+
if (typeof value !== "string") {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const trimmed = value.trim();
|
|
46
|
+
return trimmed === "" ? undefined : trimmed;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Read the embedded installation config out of a delivered webhook
|
|
50
|
+
* payload. Returns undefined for payloads without the key (legacy
|
|
51
|
+
* deliveries, host relay, fixtures) and for documents missing the
|
|
52
|
+
* required matched automation uuid — the channel then runs its legacy
|
|
53
|
+
* path unchanged. Malformed optional fields are dropped, not fatal.
|
|
54
|
+
*/
|
|
55
|
+
export function parseManagedDeliveryConfig(payload) {
|
|
56
|
+
if (!isRecord(payload)) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const doc = payload[MANAGED_DELIVERY_PAYLOAD_KEY];
|
|
60
|
+
if (!isRecord(doc)) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const matchedAutomationUuid = nonEmptyString(doc.matchedAutomationUuid);
|
|
64
|
+
if (matchedAutomationUuid === undefined) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
matchedAutomationUuid,
|
|
69
|
+
installationConfigRef: nonEmptyString(doc.installationConfigRef),
|
|
70
|
+
managedType: nonEmptyString(doc.managedType),
|
|
71
|
+
name: nonEmptyString(doc.name),
|
|
72
|
+
postingMode: nonEmptyString(doc.postingMode),
|
|
73
|
+
managedConfig: isRecord(doc.managedConfig) ? doc.managedConfig : undefined,
|
|
74
|
+
triggerSnapshots: Array.isArray(doc.triggerSnapshots)
|
|
75
|
+
? doc.triggerSnapshots
|
|
76
|
+
: undefined,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Embed one matched installation config into the webhook payload the
|
|
81
|
+
* delivery activity POSTs to the channel. Pure; used by the control-plane
|
|
82
|
+
* delivery path and by channel tests building fixture envelopes.
|
|
83
|
+
*/
|
|
84
|
+
export function withManagedDeliveryConfig(payload, config) {
|
|
85
|
+
return Object.assign(Object.assign({}, payload), { [MANAGED_DELIVERY_PAYLOAD_KEY]: config });
|
|
86
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { RunnerTurnRequest, TurnOutcome } from "../types.js";
|
|
9
9
|
import type { GrokBotRunnerOptions } from "./grokbot/runner.js";
|
|
10
|
-
import type { AgentRunner, PrewarmOutcome, RunnerPrewarmRequest } from "./sdk-runner.js";
|
|
10
|
+
import type { AgentRunner, PrewarmOutcome, RunnerPrewarmRequest, SteerAckOutcome } from "./sdk-runner.js";
|
|
11
11
|
export interface RuntimeDispatchingRunnerOptions {
|
|
12
12
|
sdkRunner: AgentRunner;
|
|
13
13
|
grokbot?: GrokBotRunnerOptions;
|
|
@@ -24,6 +24,10 @@ export declare class RuntimeDispatchingRunner implements AgentRunner {
|
|
|
24
24
|
*/
|
|
25
25
|
ensureGrokBotRunner(): AgentRunner;
|
|
26
26
|
runTurn(request: RunnerTurnRequest): Promise<TurnOutcome>;
|
|
27
|
+
steer(request: {
|
|
28
|
+
sessionId: string;
|
|
29
|
+
text: string;
|
|
30
|
+
}): Promise<SteerAckOutcome>;
|
|
27
31
|
prewarm(request: RunnerPrewarmRequest): Promise<PrewarmOutcome>;
|
|
28
32
|
dispose(): Promise<void>;
|
|
29
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-dispatch-runner.d.ts","sourceRoot":"","sources":["../../src/internal/runtime-dispatch-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,
|
|
1
|
+
{"version":3,"file":"runtime-dispatch-runner.d.ts","sourceRoot":"","sources":["../../src/internal/runtime-dispatch-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,WAAW,CAAC;IACvB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,WAAW,CAAC;CACtE;AAED,qBAAa,wBAAyB,YAAW,WAAW;IAG9C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,aAAa,CAA0B;IAE/C,YAA6B,OAAO,EAAE,+BAA+B,EAAI;IAEzE;;;OAGG;IACH,mBAAmB,IAAI,WAAW,CAKjC;IAEK,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAK9D;IAEK,KAAK,CAAC,OAAO,EAAE;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,eAAe,CAAC,CAI3B;IAEK,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CASpE;IAEK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAG7B;CACF"}
|
|
@@ -38,6 +38,13 @@ export class RuntimeDispatchingRunner {
|
|
|
38
38
|
return this.options.sdkRunner.runTurn(request);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
+
steer(request) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
var _c;
|
|
45
|
+
return ((_c = (yield (_b = (_a = this.options.sdkRunner).steer) === null || _b === void 0 ? void 0 : _b.call(_a, request))) !== null && _c !== void 0 ? _c : "revert_to_followup");
|
|
46
|
+
});
|
|
47
|
+
}
|
|
41
48
|
prewarm(request) {
|
|
42
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
50
|
var _a, _b;
|
|
@@ -8,9 +8,15 @@
|
|
|
8
8
|
import { type LocalAgentStore, type ModelSelection, type RunResult } from "@cursor/sdk";
|
|
9
9
|
import { type ModelSetting, type RunnerTurnRequest, type TurnOutcome } from "../types.js";
|
|
10
10
|
import type { ConversationMirror } from "./conversation-mirror.js";
|
|
11
|
+
/** Mirrors @cursor/sdk's SteerAckOutcome; the published dist may predate it. */
|
|
12
|
+
export type SteerAckOutcome = "complete_delivered" | "revert_to_followup";
|
|
11
13
|
/** Internal seam between the session engine and the Cursor SDK harness. */
|
|
12
14
|
export interface AgentRunner {
|
|
13
15
|
runTurn(request: RunnerTurnRequest): Promise<TurnOutcome>;
|
|
16
|
+
steer?(request: {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
text: string;
|
|
19
|
+
}): Promise<SteerAckOutcome>;
|
|
14
20
|
/**
|
|
15
21
|
* Resolve a local workspace before any session needs it, so the first turn
|
|
16
22
|
* is not the one that pays for it. Best effort, hence the reported outcome:
|
|
@@ -83,11 +89,16 @@ export declare function isAuthErrorMessage(message: string | undefined): boolean
|
|
|
83
89
|
export declare class CursorSdkRunner implements AgentRunner {
|
|
84
90
|
private readonly options;
|
|
85
91
|
private readonly agents;
|
|
92
|
+
private readonly activeRuns;
|
|
86
93
|
private readonly stores;
|
|
87
94
|
private readonly prewarmReleases;
|
|
88
95
|
constructor(options?: CursorSdkRunnerOptions);
|
|
89
96
|
runTurn(request: RunnerTurnRequest): Promise<TurnOutcome>;
|
|
90
97
|
private runTurnAttempt;
|
|
98
|
+
steer(request: {
|
|
99
|
+
sessionId: string;
|
|
100
|
+
text: string;
|
|
101
|
+
}): Promise<SteerAckOutcome>;
|
|
91
102
|
/**
|
|
92
103
|
* Build the local executor for a workspace before any session asks for it.
|
|
93
104
|
* The warmed executor is reference counted, so the lease is held until
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-runner.d.ts","sourceRoot":"","sources":["../../src/internal/sdk-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"sdk-runner.d.ts","sourceRoot":"","sources":["../../src/internal/sdk-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,cAAc,EAEnB,KAAK,SAAS,EAEf,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAInE,gFAAgF;AAChF,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,oBAAoB,CAAC;AAE1E,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1D,KAAK,CAAC,CAAC,OAAO,EAAE;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,eAAe,CAAC,CAA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AAO,CAAC,GAAG,MAAM,CAExE"}
|
|
@@ -20,6 +20,7 @@ import { SqliteLocalAgentStore } from "@cursor/sdk/sqlite";
|
|
|
20
20
|
import { DEFAULT_MODEL, } from "../types.js";
|
|
21
21
|
import { mapSdkTokenUsage, usageTokenSum } from "./cloud-turn-cost.js";
|
|
22
22
|
import { resolveApiKeySync } from "./cursor/credentials.js";
|
|
23
|
+
import { describeError } from "./describe-error.js";
|
|
23
24
|
/**
|
|
24
25
|
* How long a non-`--dev` serve holds workspace scans (rules, skills,
|
|
25
26
|
* `AGENTS.md`, ignore files). The SDK default is 20s for an editor whose
|
|
@@ -96,6 +97,7 @@ export class CursorSdkRunner {
|
|
|
96
97
|
constructor(options = {}) {
|
|
97
98
|
this.options = options;
|
|
98
99
|
this.agents = new Map();
|
|
100
|
+
this.activeRuns = new Map();
|
|
99
101
|
this.stores = new Map();
|
|
100
102
|
this.prewarmReleases = [];
|
|
101
103
|
if (options.workspaceScanCacheTtlMs !== undefined) {
|
|
@@ -199,15 +201,9 @@ export class CursorSdkRunner {
|
|
|
199
201
|
run.requestId !== "") {
|
|
200
202
|
yield request.onRequestId(run.requestId);
|
|
201
203
|
}
|
|
204
|
+
this.activeRuns.set(request.sessionId, run);
|
|
202
205
|
try {
|
|
203
206
|
const result = yield run.wait();
|
|
204
|
-
// Mirror the conversation before replying: on hosted v2 the pod can
|
|
205
|
-
// be parked as soon as the execution reply lands, so a
|
|
206
|
-
// fire-and-forget write would race VM teardown. Failed turns still
|
|
207
|
-
// checkpoint the user message, so they persist too.
|
|
208
|
-
if (request.runtime === "local") {
|
|
209
|
-
yield this.persistConversation(request, agent.agentId);
|
|
210
|
-
}
|
|
211
207
|
let outcome = toTurnOutcome(result);
|
|
212
208
|
if (outcome.status === "error") {
|
|
213
209
|
// An error result usually means the handle's transport is poisoned
|
|
@@ -230,7 +226,23 @@ export class CursorSdkRunner {
|
|
|
230
226
|
return outcome;
|
|
231
227
|
}
|
|
232
228
|
finally {
|
|
229
|
+
if (this.activeRuns.get(request.sessionId) === run) {
|
|
230
|
+
this.activeRuns.delete(request.sessionId);
|
|
231
|
+
}
|
|
233
232
|
signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
233
|
+
// Mirror the conversation before replying: on hosted v2 the pod can
|
|
234
|
+
// be parked as soon as the execution reply lands, so a
|
|
235
|
+
// fire-and-forget write would race VM teardown. In the `finally` so
|
|
236
|
+
// a `wait()` that THROWS (transport death mid-turn, an abort with
|
|
237
|
+
// no follow-up) still persists the checkpoints the turn already
|
|
238
|
+
// wrote — the store is local SQLite, safe to read on the throw
|
|
239
|
+
// path, and persistConversation swallows its own errors. Guarded
|
|
240
|
+
// here (not just inside the helper) so unmirrored turns keep their
|
|
241
|
+
// exact post-wait sequencing.
|
|
242
|
+
if (request.runtime === "local" &&
|
|
243
|
+
this.options.conversationMirror !== undefined) {
|
|
244
|
+
yield this.persistConversation(request, agent.agentId);
|
|
245
|
+
}
|
|
234
246
|
}
|
|
235
247
|
}
|
|
236
248
|
catch (error) {
|
|
@@ -241,6 +253,21 @@ export class CursorSdkRunner {
|
|
|
241
253
|
}
|
|
242
254
|
});
|
|
243
255
|
}
|
|
256
|
+
steer(request) {
|
|
257
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
const run = this.activeRuns.get(request.sessionId);
|
|
259
|
+
if ((run === null || run === void 0 ? void 0 : run.steer) === undefined) {
|
|
260
|
+
return "revert_to_followup";
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
return yield run.steer(request.text);
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
this.log(`[agent-sdk] session ${request.sessionId}: steer failed: ${describeError(error)}`);
|
|
267
|
+
return "revert_to_followup";
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
244
271
|
/**
|
|
245
272
|
* Build the local executor for a workspace before any session asks for it.
|
|
246
273
|
* The warmed executor is reference counted, so the lease is held until
|
|
@@ -340,7 +367,11 @@ export class CursorSdkRunner {
|
|
|
340
367
|
*/
|
|
341
368
|
buildLocalOptions(request) {
|
|
342
369
|
return __awaiter(this, void 0, void 0, function* () {
|
|
343
|
-
|
|
370
|
+
var _a;
|
|
371
|
+
// Not resolveStore: an injected store is used synchronously (no
|
|
372
|
+
// microtask, no thenable assimilation), exactly as before the mirror
|
|
373
|
+
// existed.
|
|
374
|
+
const store = (_a = this.options.store) !== null && _a !== void 0 ? _a : (yield this.getStore(request.runnerStateDir));
|
|
344
375
|
return Object.assign(Object.assign(Object.assign({}, this.buildSharedOptions(request)), (request.tools === undefined ? {} : { tools: request.tools })), { local: Object.assign({ cwd: request.workspaceDir, settingSources: ["project"], store }, (request.sandbox === true
|
|
345
376
|
? { sandboxOptions: { enabled: true } }
|
|
346
377
|
: {})) });
|
package/dist/internal/server.js
CHANGED
|
@@ -938,6 +938,7 @@ function mountAgentRoutes(router, runtime, args) {
|
|
|
938
938
|
channelId,
|
|
939
939
|
hostedSessionId,
|
|
940
940
|
}),
|
|
941
|
+
drainSessionDurability: (sessionId) => engine.drainSessionDurability(sessionId),
|
|
941
942
|
});
|
|
942
943
|
}
|
|
943
944
|
// Playground lists/opens Slack (and other channel) sessions across
|
|
@@ -361,6 +361,7 @@ export declare class SessionEngine {
|
|
|
361
361
|
private settleDrainedFollowups;
|
|
362
362
|
private formatCoalescedFollowups;
|
|
363
363
|
private drainCoalescedFollowups;
|
|
364
|
+
private steerIntoRunningTurn;
|
|
364
365
|
private admitTurn;
|
|
365
366
|
/**
|
|
366
367
|
* Cancel the turn in flight for `sessionId` (if any) and wait for it to
|
|
@@ -585,6 +586,18 @@ export declare class SessionEngine {
|
|
|
585
586
|
private queueDispatch;
|
|
586
587
|
private dispatchEvent;
|
|
587
588
|
private channelEventHandlersFor;
|
|
589
|
+
/**
|
|
590
|
+
* Wait until everything this session has already emitted is durably
|
|
591
|
+
* mirrored: its dispatch chain first (the chain's tail runs the turn-end
|
|
592
|
+
* storage flush, so the record carries the boundary event's handler
|
|
593
|
+
* mutations), then the storage delivery queue. Hosted v2 awaits this
|
|
594
|
+
* before the execution reply — the pod can be parked the moment the
|
|
595
|
+
* reply lands, and an unflushed session record would strand a
|
|
596
|
+
* conversation whose blobs persisted but whose record (which selects the
|
|
597
|
+
* conversation to hydrate) never reached the sink. No-op without a
|
|
598
|
+
* storage mirror.
|
|
599
|
+
*/
|
|
600
|
+
drainSessionDurability(sessionId: string): Promise<void>;
|
|
588
601
|
waitForCompletion(sessionId: string): Promise<TurnOutcome>;
|
|
589
602
|
/**
|
|
590
603
|
* Sessions visible to `caller`, newest first (`GET /v1/sessions`).
|