@cursor/july 0.1.7 → 0.1.9
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 +31 -2
- package/dist/channels/slack/channel-watch.d.ts +6 -1
- package/dist/channels/slack/channel-watch.d.ts.map +1 -1
- package/dist/channels/slack/channel-watch.js +22 -1
- package/dist/channels/slack/cursor-account.d.ts +4 -0
- package/dist/channels/slack/cursor-account.d.ts.map +1 -1
- package/dist/channels/slack/cursor-account.js +12 -2
- package/dist/channels/slack/defaults.d.ts +10 -5
- package/dist/channels/slack/defaults.d.ts.map +1 -1
- package/dist/channels/slack/defaults.js +39 -17
- package/dist/channels/slack/dispatch.d.ts +18 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +141 -38
- package/dist/channels/slack/inbound.d.ts +13 -3
- package/dist/channels/slack/inbound.d.ts.map +1 -1
- package/dist/channels/slack/inbound.js +17 -9
- package/dist/channels/slack/index.d.ts +4 -0
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +4 -0
- package/dist/channels/slack/live-delivery.d.ts.map +1 -1
- package/dist/channels/slack/live-delivery.js +1 -0
- package/dist/channels/slack/manifest.d.ts.map +1 -1
- package/dist/channels/slack/manifest.js +3 -0
- package/dist/channels/slack/nudge-carrier.d.ts +19 -0
- package/dist/channels/slack/nudge-carrier.d.ts.map +1 -0
- package/dist/channels/slack/nudge-carrier.js +166 -0
- package/dist/channels/slack/nudge-store.d.ts +61 -0
- package/dist/channels/slack/nudge-store.d.ts.map +1 -0
- package/dist/channels/slack/nudge-store.js +266 -0
- package/dist/channels/slack/post-update-delivery.js +318 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +74 -25
- package/dist/channels/slack/stop.d.ts +14 -0
- package/dist/channels/slack/stop.d.ts.map +1 -0
- package/dist/channels/slack/stop.js +22 -0
- package/dist/channels/slack/thread-context.d.ts +81 -0
- package/dist/channels/slack/thread-context.d.ts.map +1 -0
- package/dist/channels/slack/thread-context.js +470 -0
- package/dist/channels/slack/types.d.ts +27 -0
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.COTN7wgo.js → app.Ciosf24M.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.D154Detj.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.BW3TBdT0.js → VPLocalSearchBox.BcRDly7n.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BEJW0vE7.js → theme.CMpbjdfx.js} +2 -2
- package/dist/docs/assets/{deployment.md.BtfEsc9S.js → deployment.md.DC5-ImcM.js} +1 -1
- package/dist/docs/assets/{example-agents_approval-buddy.md.8R5phXb5.js → example-agents_approval-buddy.md.DFGBYLcc.js} +2 -2
- package/dist/docs/assets/{example-agents_approval-buddy.md.8R5phXb5.lean.js → example-agents_approval-buddy.md.DFGBYLcc.lean.js} +1 -1
- package/dist/docs/assets/example-agents_index.md.BPXjUtRB.js +2 -0
- package/dist/docs/assets/example-agents_index.md.BPXjUtRB.lean.js +1 -0
- package/dist/docs/assets/example-agents_oncall.md.BG_sUMly.js +10 -0
- package/dist/docs/assets/example-agents_oncall.md.BG_sUMly.lean.js +1 -0
- package/dist/docs/assets/{example-agents_security-reviewer.md.D2rtwDTO.js → example-agents_security-reviewer.md.CE9v-aKm.js} +2 -2
- package/dist/docs/assets/{example-agents_security-reviewer.md.D2rtwDTO.lean.js → example-agents_security-reviewer.md.CE9v-aKm.lean.js} +1 -1
- package/dist/docs/assets/{guides_slack.md.CCwqHvSV.js → guides_slack.md.FWale6Ip.js} +4 -3
- package/dist/docs/assets/{guides_slack.md.CCwqHvSV.lean.js → guides_slack.md.FWale6Ip.lean.js} +1 -1
- package/dist/docs/assets/{reference_sessions.md.DdjWabnN.js → reference_sessions.md.DLd6mvbv.js} +2 -2
- package/dist/docs/assets/{reference_sessions.md.DdjWabnN.lean.js → reference_sessions.md.DLd6mvbv.lean.js} +1 -1
- package/dist/docs/assets/{storage.md.CVnInNiN.js → storage.md.DRTdnFvd.js} +9 -2
- package/dist/docs/assets/{storage.md.CVnInNiN.lean.js → storage.md.DRTdnFvd.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +4 -4
- package/dist/docs/deployment.html +6 -6
- package/dist/docs/evals.html +4 -4
- package/dist/docs/example-agents/approval-buddy.html +5 -5
- package/dist/docs/example-agents/benny.html +5 -5
- package/dist/docs/example-agents/bugbot.html +5 -5
- 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 +4 -4
- package/dist/docs/example-agents/index.html +6 -6
- package/dist/docs/example-agents/knowledge-base.html +4 -4
- package/dist/docs/example-agents/oncall.html +34 -0
- package/dist/docs/example-agents/security-reviewer.html +6 -6
- 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/github.html +4 -4
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/slack.html +7 -6
- 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 +4 -4
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +4 -4
- 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/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +5 -5
- 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 +13 -6
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +45 -18
- package/dist/internal/cli-mcp.d.ts +64 -0
- package/dist/internal/cli-mcp.d.ts.map +1 -0
- package/dist/internal/cli-mcp.js +570 -0
- package/dist/internal/deploy-client.d.ts +7 -1
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +3 -0
- package/dist/internal/deploy-source.d.ts +3 -0
- package/dist/internal/deploy-source.d.ts.map +1 -1
- package/dist/internal/deploy-source.js +25 -7
- package/dist/internal/discovery.js +1 -1
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +3 -0
- package/dist/internal/host-kv.d.ts +17 -0
- package/dist/internal/host-kv.d.ts.map +1 -0
- package/dist/internal/host-kv.js +77 -0
- package/dist/internal/hosting.d.ts +12 -2
- package/dist/internal/hosting.d.ts.map +1 -1
- package/dist/internal/hosting.js +21 -4
- package/dist/internal/json-dir-store.js +100 -0
- package/dist/internal/logs-client.d.ts +16 -2
- package/dist/internal/logs-client.d.ts.map +1 -1
- package/dist/internal/logs-client.js +51 -16
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +8 -0
- package/dist/internal/session-engine.d.ts +42 -7
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +276 -66
- package/dist/internal/storage-coordinator.d.ts +18 -1
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +43 -0
- package/dist/internal/workspace.d.ts +19 -0
- package/dist/internal/workspace.d.ts.map +1 -1
- package/dist/internal/workspace.js +47 -13
- package/dist/playground/assets/{index-72vCOBWO.js → index-C0-QEG4O.js} +42 -42
- package/dist/playground/assets/index-z3JY9O2x.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted.d.ts +65 -0
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -0
- package/dist/storage-backends/cursor-hosted.js +203 -0
- package/dist/storage-backends/file-kv.d.ts +42 -0
- package/dist/storage-backends/file-kv.d.ts.map +1 -0
- package/dist/storage-backends/file-kv.js +190 -0
- package/dist/storage-backends/postgres-kv.d.ts +82 -0
- package/dist/storage-backends/postgres-kv.d.ts.map +1 -0
- package/dist/storage-backends/postgres-kv.js +185 -0
- package/dist/storage.d.ts +10 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +10 -1
- package/dist/types.d.ts +79 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/.vitepress/cache/deps/package.json +3 -0
- package/docs/deployment.md +7 -3
- package/docs/example-agents/approval-buddy.md +1 -1
- package/docs/example-agents/index.md +15 -10
- package/docs/example-agents/oncall.md +216 -0
- package/docs/example-agents/security-reviewer.md +5 -5
- package/docs/guides/slack.md +11 -2
- package/docs/reference/sessions.md +13 -4
- package/docs/storage.md +41 -0
- package/package.json +22 -1
- package/skills/framework-map/SKILL.md +6 -4
- package/src/bin/agent-serve.ts +32 -2
- package/src/channels/slack/channel-watch.ts +28 -1
- package/src/channels/slack/cursor-account.ts +20 -0
- package/src/channels/slack/defaults.ts +51 -20
- package/src/channels/slack/dispatch.ts +215 -40
- package/src/channels/slack/inbound.ts +30 -10
- package/src/channels/slack/index.ts +4 -0
- package/src/channels/slack/live-delivery.ts +1 -0
- package/src/channels/slack/manifest.ts +3 -0
- package/src/channels/slack/nudge-carrier.ts +182 -0
- package/src/channels/slack/nudge-store.ts +308 -0
- package/src/channels/slack/slack-channel.ts +106 -31
- package/src/channels/slack/stop.ts +25 -0
- package/src/channels/slack/thread-context.ts +572 -0
- package/src/channels/slack/types.ts +27 -0
- package/src/internal/cli-deploy.ts +58 -20
- package/src/internal/cli-mcp.ts +708 -0
- package/src/internal/deploy-client.ts +11 -0
- package/src/internal/deploy-source.ts +24 -6
- package/src/internal/discovery.ts +1 -1
- package/src/internal/distribution.ts +3 -0
- package/src/internal/host-kv.ts +85 -0
- package/src/internal/hosting.ts +24 -4
- package/src/internal/logs-client.ts +67 -21
- package/src/internal/server.ts +31 -0
- package/src/internal/session-engine.ts +379 -61
- package/src/internal/storage-coordinator.ts +41 -0
- package/src/internal/workspace.ts +48 -11
- package/src/storage-backends/cursor-hosted.ts +246 -0
- package/src/storage-backends/file-kv.ts +221 -0
- package/src/storage-backends/postgres-kv.ts +253 -0
- package/src/storage.ts +11 -1
- package/src/types.ts +83 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.B7UcKvIn.js +0 -1
- package/dist/docs/assets/example-agents_index.md.CRqJlnIf.js +0 -2
- package/dist/docs/assets/example-agents_index.md.CRqJlnIf.lean.js +0 -1
- package/dist/internal/persistence-coordinator.d.ts +0 -127
- package/dist/internal/persistence-coordinator.d.ts.map +0 -1
- package/dist/persistence.d.ts +0 -184
- package/dist/persistence.d.ts.map +0 -1
- package/dist/playground/assets/index-BjnMwYoR.css +0 -1
- /package/dist/docs/assets/{deployment.md.BtfEsc9S.lean.js → deployment.md.DC5-ImcM.lean.js} +0 -0
|
@@ -32,18 +32,36 @@ const defaultGitRunner = (args, cwd) => __awaiter(void 0, void 0, void 0, functi
|
|
|
32
32
|
* Normalize a git remote URL to the https form the control plane accepts
|
|
33
33
|
* (`https://host/owner/repo`, no `.git` suffix). Returns undefined for
|
|
34
34
|
* unrecognized shapes.
|
|
35
|
+
*
|
|
36
|
+
* Accepts HTTPS, `git@host:path`, GitHub org-scoped SSH
|
|
37
|
+
* (`org-123@github.com:owner/repo.git`), and `ssh://user@host[:port]/path`.
|
|
35
38
|
*/
|
|
36
39
|
export function httpsGitRepoUrlFromRemote(remote) {
|
|
37
40
|
let url = remote.trim();
|
|
38
41
|
if (url === "") {
|
|
39
42
|
return undefined;
|
|
40
43
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
// SCP-like SSH: user@host:owner/repo(.git) — includes git@ and GitHub
|
|
45
|
+
// org deploy keys (org-NNNN@github.com:…).
|
|
46
|
+
const scpMatch = /^([^@/\s]+)@([^:/\s]+):(.+)$/.exec(url);
|
|
47
|
+
if (scpMatch !== null) {
|
|
48
|
+
const host = scpMatch[2];
|
|
49
|
+
const path = scpMatch[3];
|
|
50
|
+
url = `https://${host}/${path}`;
|
|
44
51
|
}
|
|
45
|
-
else if (
|
|
46
|
-
|
|
52
|
+
else if (/^ssh:\/\//i.test(url)) {
|
|
53
|
+
// ssh://user@host[:port]/owner/repo → https://host/owner/repo
|
|
54
|
+
try {
|
|
55
|
+
const ssh = new URL(url);
|
|
56
|
+
const path = ssh.pathname.replace(/^\/+/, "");
|
|
57
|
+
if (ssh.hostname === "" || path === "") {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
url = `https://${ssh.hostname}/${path}`;
|
|
61
|
+
}
|
|
62
|
+
catch (_a) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
47
65
|
}
|
|
48
66
|
else if (!/^https?:\/\//i.test(url)) {
|
|
49
67
|
return undefined;
|
|
@@ -52,7 +70,7 @@ export function httpsGitRepoUrlFromRemote(remote) {
|
|
|
52
70
|
try {
|
|
53
71
|
parsed = new URL(url);
|
|
54
72
|
}
|
|
55
|
-
catch (
|
|
73
|
+
catch (_b) {
|
|
56
74
|
return undefined;
|
|
57
75
|
}
|
|
58
76
|
const path = parsed.pathname
|
|
@@ -62,7 +80,7 @@ export function httpsGitRepoUrlFromRemote(remote) {
|
|
|
62
80
|
if (path === "" || !path.includes("/")) {
|
|
63
81
|
return undefined;
|
|
64
82
|
}
|
|
65
|
-
// Use hostname (not host) so ssh
|
|
83
|
+
// Use hostname (not host) so ssh://…@github.com:22/… does not keep :22.
|
|
66
84
|
return `https://${parsed.hostname}/${path}`;
|
|
67
85
|
}
|
|
68
86
|
/**
|
|
@@ -341,7 +341,7 @@ function resolveHosting(ctx, agentDir, hosting) {
|
|
|
341
341
|
warn(`hosting.secretNames: ${nameError}`);
|
|
342
342
|
}
|
|
343
343
|
else if (isReservedSecretName(name)) {
|
|
344
|
-
warn(`hosting.secretNames: ${JSON.stringify(name)} is platform-
|
|
344
|
+
warn(`hosting.secretNames: ${JSON.stringify(name)} is platform-managed (CURSOR_* / Cursor-hosted storage) and injected automatically; omit it from secretNames.`);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
return Object.assign(Object.assign({}, (hosting.egressDomains === undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distribution.d.ts","sourceRoot":"","sources":["../../src/internal/distribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,qEAAqE;AACrE,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,UAAU,EAAE,MAA2B,CAAC;AACrD,eAAO,MAAM,gBAAgB,EAAE,MAAiC,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAA+B,CAAC;AAc/D;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAGhD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,kEAAkE;AAClE,wBAAgB,cAAc,IAAI,MAAM,CAOvC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAC/C,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"distribution.d.ts","sourceRoot":"","sources":["../../src/internal/distribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,qEAAqE;AACrE,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,UAAU,EAAE,MAA2B,CAAC;AACrD,eAAO,MAAM,gBAAgB,EAAE,MAAiC,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAA+B,CAAC;AAc/D;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAGhD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,kEAAkE;AAClE,wBAAgB,cAAc,IAAI,MAAM,CAOvC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAC/C,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAkBzC,CAAC"}
|
|
@@ -87,4 +87,7 @@ export const AUTHORING_ENTRY_FILES = [
|
|
|
87
87
|
["evals", "evals.js"],
|
|
88
88
|
["ab", "ab.js"],
|
|
89
89
|
["storage", "storage.js"],
|
|
90
|
+
["storage/file-kv", "storage-backends/file-kv.js"],
|
|
91
|
+
["storage/postgres-kv", "storage-backends/postgres-kv.js"],
|
|
92
|
+
["storage/cursor-hosted", "storage-backends/cursor-hosted.js"],
|
|
90
93
|
];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author-facing durable JSON KV for {@link HostContext.kv}.
|
|
3
|
+
*
|
|
4
|
+
* When `defineStorage` is authored and exposes `get`, values live in that
|
|
5
|
+
* sink under {@link storageKeys.kv}. Otherwise they land as one JSON file
|
|
6
|
+
* per key under `--state-root/kv` (local dogfood / no durable plug-in).
|
|
7
|
+
*/
|
|
8
|
+
import type { HostKvApi } from "../types.js";
|
|
9
|
+
import type { StorageCoordinator } from "./storage-coordinator.js";
|
|
10
|
+
export interface CreateHostKvApiOptions {
|
|
11
|
+
agentName: string;
|
|
12
|
+
stateRoot: string;
|
|
13
|
+
storage?: StorageCoordinator;
|
|
14
|
+
}
|
|
15
|
+
/** Build the host KV API for one agent process. */
|
|
16
|
+
export declare function createHostKvApi(options: CreateHostKvApiOptions): HostKvApi;
|
|
17
|
+
//# sourceMappingURL=host-kv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-kv.d.ts","sourceRoot":"","sources":["../../src/internal/host-kv.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,mDAAmD;AACnD,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,SAAS,CAa1E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author-facing durable JSON KV for {@link HostContext.kv}.
|
|
3
|
+
*
|
|
4
|
+
* When `defineStorage` is authored and exposes `get`, values live in that
|
|
5
|
+
* sink under {@link storageKeys.kv}. Otherwise they land as one JSON file
|
|
6
|
+
* per key under `--state-root/kv` (local dogfood / no durable plug-in).
|
|
7
|
+
*/
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
import { randomUUID } from "node:crypto";
|
|
18
|
+
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
import { storageKeys } from "../storage.js";
|
|
21
|
+
/** Build the host KV API for one agent process. */
|
|
22
|
+
export function createHostKvApi(options) {
|
|
23
|
+
const storage = options.storage;
|
|
24
|
+
if ((storage === null || storage === void 0 ? void 0 : storage.supportsAuthorKv) === true) {
|
|
25
|
+
return {
|
|
26
|
+
get: (key) => storage.kvGet(normalizeAuthorKey(key)),
|
|
27
|
+
put: (key, value) => storage.kvPut(normalizeAuthorKey(key), value),
|
|
28
|
+
delete: (key) => storage.kvDelete(normalizeAuthorKey(key)),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return createFilesystemKvApi({
|
|
32
|
+
agentName: options.agentName,
|
|
33
|
+
stateRoot: options.stateRoot,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function createFilesystemKvApi(options) {
|
|
37
|
+
const dir = join(options.stateRoot, "kv");
|
|
38
|
+
const filePath = (authorKey) => join(dir, `${encodeURIComponent(storageKeys.kv(options.agentName, authorKey))}.json`);
|
|
39
|
+
return {
|
|
40
|
+
get(key) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const authorKey = normalizeAuthorKey(key);
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(yield readFile(filePath(authorKey), "utf8"));
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (error.code === "ENOENT") {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
put(key, value) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const authorKey = normalizeAuthorKey(key);
|
|
57
|
+
yield mkdir(dir, { recursive: true });
|
|
58
|
+
const target = filePath(authorKey);
|
|
59
|
+
const tmp = join(dir, `.tmp-${randomUUID()}`);
|
|
60
|
+
yield writeFile(tmp, JSON.stringify(value), "utf8");
|
|
61
|
+
yield rename(tmp, target);
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
delete(key) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const authorKey = normalizeAuthorKey(key);
|
|
67
|
+
yield rm(filePath(authorKey), { force: true });
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function normalizeAuthorKey(key) {
|
|
73
|
+
if (typeof key !== "string" || key.trim() === "") {
|
|
74
|
+
throw new Error("host.kv key must be a non-empty string");
|
|
75
|
+
}
|
|
76
|
+
return key;
|
|
77
|
+
}
|
|
@@ -16,6 +16,13 @@ export declare const MAX_SECRET_VALUE_BYTES = 4096;
|
|
|
16
16
|
export declare const MAX_SECRET_NAME_LENGTH = 64;
|
|
17
17
|
/** Secret names the platform injects; user writes are rejected. */
|
|
18
18
|
export declare const RESERVED_SECRET_NAME_PREFIX = "CURSOR_";
|
|
19
|
+
/**
|
|
20
|
+
* Additional platform-managed env names for Cursor-hosted durable storage
|
|
21
|
+
* (Bugbot `agent_serve_*`). Mirrored from
|
|
22
|
+
* `@cursor/july/storage/cursor-hosted` so validate/secrets CLI stay in sync
|
|
23
|
+
* without importing the storage backend into the CLI graph.
|
|
24
|
+
*/
|
|
25
|
+
export declare const PLATFORM_HOSTED_STORAGE_SECRET_NAMES: readonly ["BUGBOTDB_URL", "AGENT_SERVE_DEPLOYMENT_ID"];
|
|
19
26
|
/** Returns a human error message, or undefined when the domain is valid. */
|
|
20
27
|
export declare function validateEgressDomain(domain: string): string | undefined;
|
|
21
28
|
/**
|
|
@@ -25,11 +32,14 @@ export declare function validateEgressDomain(domain: string): string | undefined
|
|
|
25
32
|
* diagnostic than the hard write-time rejection.
|
|
26
33
|
*/
|
|
27
34
|
export declare function validateSecretName(name: string): string | undefined;
|
|
28
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* True when the platform manages this name (`CURSOR_*` or hosted-storage
|
|
37
|
+
* env vars); user writes / deletes are rejected.
|
|
38
|
+
*/
|
|
29
39
|
export declare function isReservedSecretName(name: string): boolean;
|
|
30
40
|
/**
|
|
31
41
|
* Human error for a secret name a user is trying to write or delete:
|
|
32
|
-
* grammar plus
|
|
42
|
+
* grammar plus platform-managed names (`CURSOR_*`, hosted storage).
|
|
33
43
|
*/
|
|
34
44
|
export declare function validateSettableSecretName(name: string): string | undefined;
|
|
35
45
|
/** `owner/name` — mirrors the backend's cursor-event repo grammar. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosting.d.ts","sourceRoot":"","sources":["../../src/internal/hosting.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,kCAAkC;AAClC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,sCAAsC;AACtC,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,8BAA8B;AAC9B,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,mEAAmE;AACnE,eAAO,MAAM,2BAA2B,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"hosting.d.ts","sourceRoot":"","sources":["../../src/internal/hosting.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,kCAAkC;AAClC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,sCAAsC;AACtC,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,8BAA8B;AAC9B,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,mEAAmE;AACnE,eAAO,MAAM,2BAA2B,YAAY,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,YAC/C,cAAc,EACd,2BAA2B,CACnB,CAAC;AASX,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKvE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQnE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQ1D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAS3E;AAID,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
package/dist/internal/hosting.js
CHANGED
|
@@ -16,6 +16,16 @@ export const MAX_SECRET_VALUE_BYTES = 4096;
|
|
|
16
16
|
export const MAX_SECRET_NAME_LENGTH = 64;
|
|
17
17
|
/** Secret names the platform injects; user writes are rejected. */
|
|
18
18
|
export const RESERVED_SECRET_NAME_PREFIX = "CURSOR_";
|
|
19
|
+
/**
|
|
20
|
+
* Additional platform-managed env names for Cursor-hosted durable storage
|
|
21
|
+
* (Bugbot `agent_serve_*`). Mirrored from
|
|
22
|
+
* `@cursor/july/storage/cursor-hosted` so validate/secrets CLI stay in sync
|
|
23
|
+
* without importing the storage backend into the CLI graph.
|
|
24
|
+
*/
|
|
25
|
+
export const PLATFORM_HOSTED_STORAGE_SECRET_NAMES = [
|
|
26
|
+
"BUGBOTDB_URL",
|
|
27
|
+
"AGENT_SERVE_DEPLOYMENT_ID",
|
|
28
|
+
];
|
|
19
29
|
const SECRET_NAME_PATTERN = /^[A-Z][A-Z0-9_]*$/;
|
|
20
30
|
// Lowercase hostname with >=2 labels, an alphabetic TLD, and at most one
|
|
21
31
|
// leading `*.` wildcard. Labels: alphanumeric with interior hyphens.
|
|
@@ -42,13 +52,20 @@ export function validateSecretName(name) {
|
|
|
42
52
|
}
|
|
43
53
|
return undefined;
|
|
44
54
|
}
|
|
45
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* True when the platform manages this name (`CURSOR_*` or hosted-storage
|
|
57
|
+
* env vars); user writes / deletes are rejected.
|
|
58
|
+
*/
|
|
46
59
|
export function isReservedSecretName(name) {
|
|
47
|
-
|
|
60
|
+
if (name.startsWith(RESERVED_SECRET_NAME_PREFIX)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
const upper = name.toUpperCase();
|
|
64
|
+
return PLATFORM_HOSTED_STORAGE_SECRET_NAMES.some((managed) => managed === upper);
|
|
48
65
|
}
|
|
49
66
|
/**
|
|
50
67
|
* Human error for a secret name a user is trying to write or delete:
|
|
51
|
-
* grammar plus
|
|
68
|
+
* grammar plus platform-managed names (`CURSOR_*`, hosted storage).
|
|
52
69
|
*/
|
|
53
70
|
export function validateSettableSecretName(name) {
|
|
54
71
|
const nameError = validateSecretName(name);
|
|
@@ -56,7 +73,7 @@ export function validateSettableSecretName(name) {
|
|
|
56
73
|
return nameError;
|
|
57
74
|
}
|
|
58
75
|
if (isReservedSecretName(name)) {
|
|
59
|
-
return `Secret name ${JSON.stringify(name)} is platform-
|
|
76
|
+
return `Secret name ${JSON.stringify(name)} is platform-managed; the platform injects CURSOR_* and Cursor-hosted storage values automatically.`;
|
|
60
77
|
}
|
|
61
78
|
return undefined;
|
|
62
79
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small filesystem helpers for one-JSON-file-per-id persistence under a
|
|
3
|
+
* project-relative directory (eval run snapshots, A/B aggregate snapshots).
|
|
4
|
+
*/
|
|
5
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
import { randomBytes } from "node:crypto";
|
|
15
|
+
import { mkdir, readdir, readFile, rename, rm, writeFile, } from "node:fs/promises";
|
|
16
|
+
import { isAbsolute, join } from "node:path";
|
|
17
|
+
export function assertNonEmptyDir(dir, fnName) {
|
|
18
|
+
if (typeof dir !== "string" || dir.trim() === "") {
|
|
19
|
+
throw new Error(`${fnName}: dir must be a non-empty string`);
|
|
20
|
+
}
|
|
21
|
+
return dir;
|
|
22
|
+
}
|
|
23
|
+
/** Resolve `dir` against `projectRoot` when relative. */
|
|
24
|
+
export function resolveProjectRelativeDir(args) {
|
|
25
|
+
return isAbsolute(args.dir) ? args.dir : join(args.projectRoot, args.dir);
|
|
26
|
+
}
|
|
27
|
+
function isEnoent(error) {
|
|
28
|
+
return (error !== null &&
|
|
29
|
+
typeof error === "object" &&
|
|
30
|
+
"code" in error &&
|
|
31
|
+
error.code === "ENOENT");
|
|
32
|
+
}
|
|
33
|
+
/** List `*.json` basenames in `root` (any order). Missing dir → []. */
|
|
34
|
+
export function listJsonBasenames(root) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
let names;
|
|
37
|
+
try {
|
|
38
|
+
names = yield readdir(root);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (isEnoent(error)) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
return names.filter((name) => name.endsWith(".json"));
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Read and JSON.parse every `*.json` file under `root`. Missing dir → [].
|
|
51
|
+
* Unreadable or corrupt files are skipped so one bad snapshot cannot wipe
|
|
52
|
+
* the rest of the history.
|
|
53
|
+
*/
|
|
54
|
+
export function readJsonDir(root, options) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
let names = yield listJsonBasenames(root);
|
|
57
|
+
if ((options === null || options === void 0 ? void 0 : options.sortBasenames) === "asc") {
|
|
58
|
+
names = [...names].sort();
|
|
59
|
+
}
|
|
60
|
+
else if ((options === null || options === void 0 ? void 0 : options.sortBasenames) === "desc") {
|
|
61
|
+
names = [...names].sort().reverse();
|
|
62
|
+
}
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const name of names) {
|
|
65
|
+
try {
|
|
66
|
+
const raw = yield readFile(join(root, name), "utf8");
|
|
67
|
+
out.push(JSON.parse(raw));
|
|
68
|
+
}
|
|
69
|
+
catch (_a) {
|
|
70
|
+
// skip corrupt / unreadable files
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/** Atomically write JSON under `root`/`fileName` (temp file + rename). */
|
|
77
|
+
export function writeJsonFile(args) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const { root, fileName, value } = args;
|
|
80
|
+
// Serialize before any await so callers get a stable snapshot even if they
|
|
81
|
+
// mutate `value` afterward.
|
|
82
|
+
const body = `${JSON.stringify(value, null, 2)}\n`;
|
|
83
|
+
yield mkdir(root, { recursive: true });
|
|
84
|
+
const finalPath = join(root, fileName);
|
|
85
|
+
const tmpPath = `${finalPath}.${randomBytes(4).toString("hex")}.tmp`;
|
|
86
|
+
yield writeFile(tmpPath, body, "utf8");
|
|
87
|
+
yield rename(tmpPath, finalPath);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/** Best-effort delete; ignores missing files. */
|
|
91
|
+
export function deleteFileInDir(args) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
try {
|
|
94
|
+
yield rm(join(args.root, args.fileName), { force: true });
|
|
95
|
+
}
|
|
96
|
+
catch (_a) {
|
|
97
|
+
// ignore
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
@@ -14,10 +14,24 @@ export interface LogsResponse {
|
|
|
14
14
|
entries: LogRingEntry[];
|
|
15
15
|
nextAfter: number;
|
|
16
16
|
}
|
|
17
|
-
export type LogsProgress = DeploymentProgress | "queued" | "preparing" | "building" | "finalizing" | "running" | "failed" | "stopping" | "stopped" | "degraded";
|
|
18
|
-
|
|
17
|
+
export type LogsProgress = DeploymentProgress | "queued" | "preparing" | "creating" | "building" | "starting" | "finalizing" | "running" | "failed" | "stopping" | "stopped" | "degraded";
|
|
18
|
+
/**
|
|
19
|
+
* Customer-facing line for the current deploy step. Prefer the live
|
|
20
|
+
* `statusMessage` from the API when present; otherwise the progress
|
|
21
|
+
* vocabulary. Failed/degraded always append sanitized `lastError`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function progressMessage(progress: LogsProgress, lastError?: string | null, statusMessage?: string | null): string;
|
|
19
24
|
/** Strip obvious hosting internals from error text shown to customers. */
|
|
20
25
|
export declare function sanitizeCustomerError(message: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* One-line label for `agentkit deploy` polling (TTY spinner / non-TTY
|
|
28
|
+
* transitions). Uses statusMessage → progress → raw status.
|
|
29
|
+
*/
|
|
30
|
+
export declare function deployProgressLabel(detail: {
|
|
31
|
+
status: string;
|
|
32
|
+
progress?: DeploymentProgress;
|
|
33
|
+
statusMessage?: string | null;
|
|
34
|
+
}): string;
|
|
21
35
|
export declare function fetchLogs(args: {
|
|
22
36
|
baseUrl: string;
|
|
23
37
|
after?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs-client.d.ts","sourceRoot":"","sources":["../../src/internal/logs-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAW7E,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,QAAQ,GACR,WAAW,GACX,UAAU,GACV,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,UAAU,GACV,SAAS,GACT,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"logs-client.d.ts","sourceRoot":"","sources":["../../src/internal/logs-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAW7E,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,QAAQ,GACR,WAAW,GACX,UAAU,GACV,UAAU,GACV,UAAU,GACV,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,UAAU,GACV,SAAS,GACT,UAAU,CAAC;AAgBf;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,YAAY,EACtB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,EACzB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAC5B,MAAM,CAuBR;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAa7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,GAAG,MAAM,CAiBT;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,YAAY,CAAC,CA0BxB;AAED,MAAM,WAAW,kBAAkB;IACjC,+DAA+D;IAC/D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,iCAAiC;IACjC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAChD,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC5E"}
|
|
@@ -24,7 +24,9 @@ function isAborted(signal) {
|
|
|
24
24
|
const PROGRESS_MESSAGES = {
|
|
25
25
|
queued: "Waiting to start…",
|
|
26
26
|
preparing: "Preparing runtime…",
|
|
27
|
-
|
|
27
|
+
creating: "Creating runtime…",
|
|
28
|
+
building: "Checking out source and installing dependencies…",
|
|
29
|
+
starting: "Starting agent and waiting for health…",
|
|
28
30
|
finalizing: "Finishing deployment…",
|
|
29
31
|
running: "Deployment running",
|
|
30
32
|
failed: "Deploy failed",
|
|
@@ -32,7 +34,12 @@ const PROGRESS_MESSAGES = {
|
|
|
32
34
|
stopped: "Deployment stopped",
|
|
33
35
|
degraded: "Deployment degraded",
|
|
34
36
|
};
|
|
35
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Customer-facing line for the current deploy step. Prefer the live
|
|
39
|
+
* `statusMessage` from the API when present; otherwise the progress
|
|
40
|
+
* vocabulary. Failed/degraded always append sanitized `lastError`.
|
|
41
|
+
*/
|
|
42
|
+
export function progressMessage(progress, lastError, statusMessage) {
|
|
36
43
|
if (progress === "failed") {
|
|
37
44
|
const detail = lastError === null || lastError === undefined || lastError.trim() === ""
|
|
38
45
|
? ""
|
|
@@ -45,6 +52,11 @@ export function progressMessage(progress, lastError) {
|
|
|
45
52
|
: `: ${sanitizeCustomerError(lastError)}`;
|
|
46
53
|
return `Deployment degraded${detail}`;
|
|
47
54
|
}
|
|
55
|
+
if (statusMessage !== null &&
|
|
56
|
+
statusMessage !== undefined &&
|
|
57
|
+
statusMessage.trim() !== "") {
|
|
58
|
+
return statusMessage.trim();
|
|
59
|
+
}
|
|
48
60
|
return PROGRESS_MESSAGES[progress];
|
|
49
61
|
}
|
|
50
62
|
/** Strip obvious hosting internals from error text shown to customers. */
|
|
@@ -56,7 +68,31 @@ export function sanitizeCustomerError(message) {
|
|
|
56
68
|
.replace(/\bcursorvm\.com\b/gi, "host")
|
|
57
69
|
.replace(/\bx-anyrun-[a-z0-9-]+\b/gi, "header")
|
|
58
70
|
.replace(/\bPROVISIONING\b/g, "building")
|
|
59
|
-
.replace(/\bPLANNED\b/g, "preparing")
|
|
71
|
+
.replace(/\bPLANNED\b/g, "preparing")
|
|
72
|
+
.replace(/\bgitCloneCheckout\b/gi, "git clone")
|
|
73
|
+
.replace(/\bgitFetchCheckout\b/gi, "git fetch")
|
|
74
|
+
.replace(/\bgitCheckout:clone\b/gi, "checkout")
|
|
75
|
+
.replace(/\bgitCheckout:fetch\b/gi, "checkout");
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One-line label for `agentkit deploy` polling (TTY spinner / non-TTY
|
|
79
|
+
* transitions). Uses statusMessage → progress → raw status.
|
|
80
|
+
*/
|
|
81
|
+
export function deployProgressLabel(detail) {
|
|
82
|
+
if (detail.statusMessage !== null &&
|
|
83
|
+
detail.statusMessage !== undefined &&
|
|
84
|
+
detail.statusMessage.trim() !== "") {
|
|
85
|
+
return detail.statusMessage
|
|
86
|
+
.trim()
|
|
87
|
+
.replace(/…$/, "")
|
|
88
|
+
.replace(/\.\.\.$/, "");
|
|
89
|
+
}
|
|
90
|
+
if (detail.progress !== undefined) {
|
|
91
|
+
return PROGRESS_MESSAGES[detail.progress]
|
|
92
|
+
.replace(/…$/, "")
|
|
93
|
+
.replace(/\.\.\.$/, "");
|
|
94
|
+
}
|
|
95
|
+
return detail.status;
|
|
60
96
|
}
|
|
61
97
|
export function fetchLogs(args) {
|
|
62
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -139,7 +175,7 @@ function followProdLogs(args) {
|
|
|
139
175
|
// cmdLogs (which wires deploy auth).
|
|
140
176
|
throw new Error("Internal error: deploy progress requires a deployment lookup.");
|
|
141
177
|
}));
|
|
142
|
-
let
|
|
178
|
+
let lastEmittedKey;
|
|
143
179
|
const slugHint = args.slug !== undefined && args.slug !== "" ? args.slug : "";
|
|
144
180
|
if (args.once !== true) {
|
|
145
181
|
const label = slugHint !== "" ? slugHint : "deployment";
|
|
@@ -157,27 +193,27 @@ function followProdLogs(args) {
|
|
|
157
193
|
throw customerDeployLookupError(error);
|
|
158
194
|
}
|
|
159
195
|
const progress = resolveProgress(detail);
|
|
196
|
+
const message = progressMessage(progress, detail.lastError, detail.statusMessage);
|
|
197
|
+
const emitKey = `${progress}\0${message}`;
|
|
160
198
|
if (progress === "failed") {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
lastProgress = progress;
|
|
199
|
+
if (emitKey !== lastEmittedKey) {
|
|
200
|
+
lastEmittedKey = emitKey;
|
|
164
201
|
emitProgress(args.write, args.json === true, progress, message);
|
|
165
202
|
}
|
|
166
203
|
throw new Error(`Deployment "${detail.slug}" failed.`);
|
|
167
204
|
}
|
|
168
205
|
if (progress === "stopped") {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
lastProgress = progress;
|
|
206
|
+
if (emitKey !== lastEmittedKey) {
|
|
207
|
+
lastEmittedKey = emitKey;
|
|
172
208
|
emitProgress(args.write, args.json === true, progress, message);
|
|
173
209
|
}
|
|
174
210
|
throw new Error(`Deployment "${detail.slug}" is stopped.`);
|
|
175
211
|
}
|
|
176
212
|
if (progress === "running" || progress === "degraded") {
|
|
177
213
|
// Hand off to runtime logs. Print degraded once; skip a "running" line.
|
|
178
|
-
if (progress === "degraded" &&
|
|
179
|
-
|
|
180
|
-
emitProgress(args.write, args.json === true, progress,
|
|
214
|
+
if (progress === "degraded" && emitKey !== lastEmittedKey) {
|
|
215
|
+
lastEmittedKey = emitKey;
|
|
216
|
+
emitProgress(args.write, args.json === true, progress, message);
|
|
181
217
|
}
|
|
182
218
|
const runtime = yield resolveRuntime();
|
|
183
219
|
yield followRuntimeLogs({
|
|
@@ -196,9 +232,8 @@ function followProdLogs(args) {
|
|
|
196
232
|
});
|
|
197
233
|
return;
|
|
198
234
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
lastProgress = progress;
|
|
235
|
+
if (emitKey !== lastEmittedKey) {
|
|
236
|
+
lastEmittedKey = emitKey;
|
|
202
237
|
emitProgress(args.write, args.json === true, progress, message);
|
|
203
238
|
}
|
|
204
239
|
if (args.once === true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;AAoFrB,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAapE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAYD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;AAoFrB,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAapE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAYD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,CAsmB3B"}
|
package/dist/internal/server.js
CHANGED
|
@@ -272,6 +272,10 @@ export function startServer(mounts_1) {
|
|
|
272
272
|
engine.trackBackground(promise);
|
|
273
273
|
},
|
|
274
274
|
resolveApproval: (sessionId, callId, decision, auth) => engine.resolveApproval(sessionId, callId, decision, auth),
|
|
275
|
+
hasContinuationSession: (continuationToken) => engine.hasContinuationSession(channel.id, continuationToken),
|
|
276
|
+
isContinuationBusy: (continuationToken) => engine.isContinuationBusy(channel.id, continuationToken),
|
|
277
|
+
getContinuationLastBotMessageTs: (continuationToken) => engine.getContinuationLastBotMessageTs(channel.id, continuationToken),
|
|
278
|
+
interruptContinuation: (continuationToken) => engine.interruptContinuation(channel.id, continuationToken),
|
|
275
279
|
logger,
|
|
276
280
|
};
|
|
277
281
|
try {
|
|
@@ -1254,6 +1258,10 @@ function startCursorSlackRelay(input) {
|
|
|
1254
1258
|
envelope,
|
|
1255
1259
|
send: args.send,
|
|
1256
1260
|
host: args.host,
|
|
1261
|
+
hasContinuationSession: (continuationToken) => target.runtime.engine.hasContinuationSession(target.channelId, continuationToken),
|
|
1262
|
+
isContinuationBusy: (continuationToken) => target.runtime.engine.isContinuationBusy(target.channelId, continuationToken),
|
|
1263
|
+
getContinuationLastBotMessageTs: (continuationToken) => target.runtime.engine.getContinuationLastBotMessageTs(target.channelId, continuationToken),
|
|
1264
|
+
interruptContinuation: (continuationToken) => target.runtime.engine.interruptContinuation(target.channelId, continuationToken),
|
|
1257
1265
|
});
|
|
1258
1266
|
}),
|
|
1259
1267
|
});
|