@cursor/july 0.1.33 → 0.1.35

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.
Files changed (171) hide show
  1. package/README.md +1 -1
  2. package/dist/artifacts.d.ts.map +1 -1
  3. package/dist/artifacts.js +0 -5
  4. package/dist/bin/agent-serve.d.ts +1 -0
  5. package/dist/bin/agent-serve.d.ts.map +1 -1
  6. package/dist/bin/agent-serve.js +32 -2
  7. package/dist/channels/github/types.d.ts +10 -7
  8. package/dist/channels/github/types.d.ts.map +1 -1
  9. package/dist/docs/404.html +2 -2
  10. package/dist/docs/ab.html +3 -3
  11. package/dist/docs/assets/{app.CgZqLyWL.js → app.D5Mv1T0U.js} +1 -1
  12. package/dist/docs/assets/chunks/@localSearchIndexroot.Cu7b6o1D.js +1 -0
  13. package/dist/docs/assets/chunks/{VPLocalSearchBox.C4KigoQn.js → VPLocalSearchBox.CMq_BQce.js} +1 -1
  14. package/dist/docs/assets/chunks/{theme.C_Ty4yT7.js → theme.C6D9UPLK.js} +2 -2
  15. package/dist/docs/assets/{example-agents_weather-agent.md.Dmrcphhl.js → example-agents_weather-agent.md.BADkPqxQ.js} +6 -4
  16. package/dist/docs/assets/example-agents_weather-agent.md.BADkPqxQ.lean.js +1 -0
  17. package/dist/docs/assets/guides_cloud-runtime.md.CDJGvVC4.js +9 -0
  18. package/dist/docs/assets/guides_cloud-runtime.md.CDJGvVC4.lean.js +1 -0
  19. package/dist/docs/building-with-agents.html +3 -3
  20. package/dist/docs/concepts.html +3 -3
  21. package/dist/docs/deployment.html +3 -3
  22. package/dist/docs/evals.html +3 -3
  23. package/dist/docs/example-agents/approval-buddy.html +3 -3
  24. package/dist/docs/example-agents/benny.html +3 -3
  25. package/dist/docs/example-agents/bugbot.html +3 -3
  26. package/dist/docs/example-agents/codebase-wiki.html +3 -3
  27. package/dist/docs/example-agents/codeowners-review.html +3 -3
  28. package/dist/docs/example-agents/concierge.html +3 -3
  29. package/dist/docs/example-agents/fsd.html +3 -3
  30. package/dist/docs/example-agents/index.html +3 -3
  31. package/dist/docs/example-agents/knowledge-base.html +3 -3
  32. package/dist/docs/example-agents/oncall.html +3 -3
  33. package/dist/docs/example-agents/security-reviewer.html +3 -3
  34. package/dist/docs/example-agents/slack-agent.html +3 -3
  35. package/dist/docs/example-agents/weather-agent.html +10 -8
  36. package/dist/docs/guides/agent-to-agent.html +3 -3
  37. package/dist/docs/guides/cloud-runtime.html +5 -5
  38. package/dist/docs/guides/github.html +3 -3
  39. package/dist/docs/guides/human-in-the-loop.html +3 -3
  40. package/dist/docs/guides/mcp-oauth.html +3 -3
  41. package/dist/docs/guides/slack.html +3 -3
  42. package/dist/docs/guides/webhooks.html +3 -3
  43. package/dist/docs/hashmap.json +1 -1
  44. package/dist/docs/hillclimbing.html +3 -3
  45. package/dist/docs/index.html +3 -3
  46. package/dist/docs/quickstart.html +3 -3
  47. package/dist/docs/reference/agent-config.html +3 -3
  48. package/dist/docs/reference/channels.html +3 -3
  49. package/dist/docs/reference/cli.html +3 -3
  50. package/dist/docs/reference/connections.html +3 -3
  51. package/dist/docs/reference/hooks.html +3 -3
  52. package/dist/docs/reference/http-api.html +3 -3
  53. package/dist/docs/reference/instructions.html +3 -3
  54. package/dist/docs/reference/playground.html +3 -3
  55. package/dist/docs/reference/project-layout.html +3 -3
  56. package/dist/docs/reference/prompt.html +3 -3
  57. package/dist/docs/reference/schedules.html +3 -3
  58. package/dist/docs/reference/sessions.html +3 -3
  59. package/dist/docs/reference/skills.html +3 -3
  60. package/dist/docs/reference/subagents.html +3 -3
  61. package/dist/docs/reference/tools.html +3 -3
  62. package/dist/docs/scaffolding-agents.html +3 -3
  63. package/dist/docs/storage.html +3 -3
  64. package/dist/docs/troubleshooting.html +3 -3
  65. package/dist/files-backends/agent-store-presigned-url.d.ts +3 -11
  66. package/dist/files.d.ts +20 -0
  67. package/dist/files.d.ts.map +1 -1
  68. package/dist/files.js +20 -0
  69. package/dist/index.d.ts +2 -2
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +2 -2
  72. package/dist/internal/artifacts-store.d.ts +14 -6
  73. package/dist/internal/artifacts-store.d.ts.map +1 -1
  74. package/dist/internal/artifacts-store.js +160 -16
  75. package/dist/internal/cli-convert-automation.d.ts +39 -0
  76. package/dist/internal/cli-convert-automation.d.ts.map +1 -0
  77. package/dist/internal/cli-convert-automation.js +280 -0
  78. package/dist/internal/cli-deploy.d.ts +2 -0
  79. package/dist/internal/cli-deploy.d.ts.map +1 -1
  80. package/dist/internal/cli-deploy.js +1 -1
  81. package/dist/internal/cli-mcp-oauth.d.ts +23 -0
  82. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
  83. package/dist/internal/cli-mcp-oauth.js +57 -33
  84. package/dist/internal/convert-automation/convert-workflow.d.ts +10 -0
  85. package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -0
  86. package/dist/internal/convert-automation/convert-workflow.js +998 -0
  87. package/dist/internal/convert-automation/index.d.ts +3 -0
  88. package/dist/internal/convert-automation/index.d.ts.map +1 -0
  89. package/dist/internal/convert-automation/index.js +1 -0
  90. package/dist/internal/convert-automation/slug.d.ts +11 -0
  91. package/dist/internal/convert-automation/slug.d.ts.map +1 -0
  92. package/dist/internal/convert-automation/slug.js +36 -0
  93. package/dist/internal/convert-automation/types.d.ts +191 -0
  94. package/dist/internal/convert-automation/types.d.ts.map +1 -0
  95. package/dist/internal/convert-automation/types.js +13 -0
  96. package/dist/internal/deploy-client.d.ts +31 -0
  97. package/dist/internal/deploy-client.d.ts.map +1 -1
  98. package/dist/internal/deploy-client.js +48 -0
  99. package/dist/internal/discovery.d.ts.map +1 -1
  100. package/dist/internal/discovery.js +3 -32
  101. package/dist/internal/host-kv.d.ts +6 -2
  102. package/dist/internal/host-kv.d.ts.map +1 -1
  103. package/dist/internal/init-project.d.ts +1 -0
  104. package/dist/internal/init-project.d.ts.map +1 -1
  105. package/dist/internal/init-project.js +1 -1
  106. package/dist/internal/mcp-endpoint.d.ts +6 -0
  107. package/dist/internal/mcp-endpoint.d.ts.map +1 -1
  108. package/dist/internal/mcp-endpoint.js +168 -0
  109. package/dist/internal/resolved-connections.d.ts +15 -0
  110. package/dist/internal/resolved-connections.d.ts.map +1 -1
  111. package/dist/internal/resolved-connections.js +12 -5
  112. package/dist/internal/server.d.ts.map +1 -1
  113. package/dist/internal/server.js +75 -7
  114. package/dist/internal/session-engine.d.ts +56 -3
  115. package/dist/internal/session-engine.d.ts.map +1 -1
  116. package/dist/internal/session-engine.js +262 -84
  117. package/dist/internal/storage-coordinator.d.ts +9 -16
  118. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  119. package/dist/internal/storage-coordinator.js +7 -52
  120. package/dist/internal/storage-roles.d.ts +78 -0
  121. package/dist/internal/storage-roles.d.ts.map +1 -0
  122. package/dist/internal/storage-roles.js +24 -0
  123. package/dist/internal/workspace.d.ts +36 -5
  124. package/dist/internal/workspace.d.ts.map +1 -1
  125. package/dist/internal/workspace.js +66 -0
  126. package/dist/memory.d.ts +22 -6
  127. package/dist/memory.d.ts.map +1 -1
  128. package/dist/memory.js +100 -8
  129. package/dist/playground/assets/{index-CVlCAcUx.js → index-D7OV8B_H.js} +50 -50
  130. package/dist/playground/assets/index-DOb96C0M.css +1 -0
  131. package/dist/playground/index.html +2 -2
  132. package/dist/storage.d.ts +0 -4
  133. package/dist/storage.d.ts.map +1 -1
  134. package/dist/storage.js +0 -4
  135. package/dist/types.d.ts +18 -0
  136. package/dist/types.d.ts.map +1 -1
  137. package/docs/example-agents/weather-agent.md +29 -11
  138. package/docs/guides/cloud-runtime.md +6 -4
  139. package/package.json +3 -1
  140. package/src/artifacts.ts +0 -6
  141. package/src/bin/agent-serve.ts +36 -2
  142. package/src/channels/github/types.ts +10 -7
  143. package/src/files.ts +27 -0
  144. package/src/index.ts +6 -1
  145. package/src/internal/artifacts-store.ts +185 -22
  146. package/src/internal/cli-convert-automation.ts +352 -0
  147. package/src/internal/cli-deploy.ts +1 -1
  148. package/src/internal/cli-mcp-oauth.ts +69 -31
  149. package/src/internal/convert-automation/convert-workflow.ts +1422 -0
  150. package/src/internal/convert-automation/index.ts +10 -0
  151. package/src/internal/convert-automation/slug.ts +38 -0
  152. package/src/internal/convert-automation/types.ts +199 -0
  153. package/src/internal/deploy-client.ts +78 -0
  154. package/src/internal/discovery.ts +3 -37
  155. package/src/internal/host-kv.ts +6 -2
  156. package/src/internal/init-project.ts +1 -1
  157. package/src/internal/mcp-endpoint.ts +243 -0
  158. package/src/internal/resolved-connections.ts +32 -6
  159. package/src/internal/server.ts +99 -1
  160. package/src/internal/session-engine.ts +345 -103
  161. package/src/internal/storage-coordinator.ts +15 -63
  162. package/src/internal/storage-roles.ts +86 -0
  163. package/src/internal/workspace.ts +81 -6
  164. package/src/memory.ts +126 -10
  165. package/src/storage.ts +0 -6
  166. package/src/types.ts +15 -0
  167. package/dist/docs/assets/chunks/@localSearchIndexroot.B1uHGxBZ.js +0 -1
  168. package/dist/docs/assets/example-agents_weather-agent.md.Dmrcphhl.lean.js +0 -1
  169. package/dist/docs/assets/guides_cloud-runtime.md.BZ2GA7Es.js +0 -9
  170. package/dist/docs/assets/guides_cloud-runtime.md.BZ2GA7Es.lean.js +0 -1
  171. package/dist/playground/assets/index-BRhBbnd4.css +0 -1
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `agent-serve convert-automation <url>` — export a Cursor Automation into
3
+ * an agentkit project.
4
+ *
5
+ * Fetches the automation's workflow from the backend export endpoint
6
+ * (Bearer user API key, same credential chain as deploy), runs the pure
7
+ * converter, writes the converted files (wx — existing files are kept),
8
+ * fills in the init scaffold around them, and installs npm dependencies
9
+ * (like `init`). MCP servers convert to Cursor-account connections resolved
10
+ * at runtime (no URLs or credentials in the project; authorization is
11
+ * managed in Cursor, dashboard → MCP). The generated project is NEVER
12
+ * imported/executed here — it embeds server-derived data, so checking it is
13
+ * left to an explicit `validate` next step the user runs after review.
14
+ * Exit 0 even with warnings; nonzero only for bad args, auth/fetch
15
+ * failures, or filesystem write failures.
16
+ */
17
+ import { installScaffoldDependencies } from "./init-project.js";
18
+ export interface ConvertAutomationCliOptions {
19
+ /** Positional: automation URL or bare uuid. */
20
+ url?: string;
21
+ /** Target directory; defaults to ./<automation-name-slug>. */
22
+ dir?: string;
23
+ json?: boolean;
24
+ apiKey?: string;
25
+ /** Test seams. */
26
+ fetchImpl?: typeof fetch;
27
+ out?: (text: string) => void;
28
+ err?: (text: string) => void;
29
+ installImpl?: typeof installScaffoldDependencies;
30
+ cwd?: string;
31
+ }
32
+ /**
33
+ * Extract the automation uuid from a dashboard URL
34
+ * (`/automations/<uuid>` or `/custom-agents/<uuid>`, any origin — dev
35
+ * hosts included) or a bare uuid. Undefined when nothing matches.
36
+ */
37
+ export declare function parseAutomationRef(input: string): string | undefined;
38
+ export declare function cmdConvertAutomation(options: ConvertAutomationCliOptions): Promise<number>;
39
+ //# sourceMappingURL=cli-convert-automation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-convert-automation.d.ts","sourceRoot":"","sources":["../../src/internal/cli-convert-automation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAsBH,OAAO,EAIL,2BAA2B,EAE5B,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,2BAA2B;IAC1C,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,2BAA2B,CAAC;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA0BpE;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,MAAM,CAAC,CA8HjB"}
@@ -0,0 +1,280 @@
1
+ /**
2
+ * `agent-serve convert-automation <url>` — export a Cursor Automation into
3
+ * an agentkit project.
4
+ *
5
+ * Fetches the automation's workflow from the backend export endpoint
6
+ * (Bearer user API key, same credential chain as deploy), runs the pure
7
+ * converter, writes the converted files (wx — existing files are kept),
8
+ * fills in the init scaffold around them, and installs npm dependencies
9
+ * (like `init`). MCP servers convert to Cursor-account connections resolved
10
+ * at runtime (no URLs or credentials in the project; authorization is
11
+ * managed in Cursor, dashboard → MCP). The generated project is NEVER
12
+ * imported/executed here — it embeds server-derived data, so checking it is
13
+ * left to an explicit `validate` next step the user runs after review.
14
+ * Exit 0 even with warnings; nonzero only for bad args, auth/fetch
15
+ * failures, or filesystem write failures.
16
+ */
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ import { mkdir, rm, writeFile } from "node:fs/promises";
27
+ import { dirname, join, resolve } from "node:path";
28
+ import { convertWorkflow, } from "./convert-automation/index.js";
29
+ import { slugify } from "./convert-automation/slug.js";
30
+ import { cursorExternalApiUrl, resolveApiKey, SIGN_IN_HINT, } from "./cursor/credentials.js";
31
+ import { AgentServeDeployClient, DeployApiError, } from "./deploy-client.js";
32
+ import { CLI_COMMAND_NAME as CLI } from "./distribution.js";
33
+ import { formatCdCommand, initProject, installScaffoldDependencies, isEexist, } from "./init-project.js";
34
+ import { stdoutPalette } from "./terminal-style.js";
35
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
36
+ /**
37
+ * Extract the automation uuid from a dashboard URL
38
+ * (`/automations/<uuid>` or `/custom-agents/<uuid>`, any origin — dev
39
+ * hosts included) or a bare uuid. Undefined when nothing matches.
40
+ */
41
+ export function parseAutomationRef(input) {
42
+ const trimmed = input.trim();
43
+ if (UUID_PATTERN.test(trimmed)) {
44
+ return trimmed.toLowerCase();
45
+ }
46
+ let parsed;
47
+ try {
48
+ parsed = new URL(trimmed);
49
+ }
50
+ catch (_a) {
51
+ return undefined;
52
+ }
53
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
54
+ return undefined;
55
+ }
56
+ const segments = parsed.pathname.split("/").filter((s) => s !== "");
57
+ if (segments.length !== 2) {
58
+ return undefined;
59
+ }
60
+ const [kind, uuid] = segments;
61
+ if (kind !== "automations" && kind !== "custom-agents") {
62
+ return undefined;
63
+ }
64
+ if (uuid === undefined || !UUID_PATTERN.test(uuid)) {
65
+ return undefined;
66
+ }
67
+ return uuid.toLowerCase();
68
+ }
69
+ export function cmdConvertAutomation(options) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ var _a, _b, _c, _d, _e, _f;
72
+ const out = (_a = options.out) !== null && _a !== void 0 ? _a : ((text) => void process.stdout.write(text));
73
+ const err = (_b = options.err) !== null && _b !== void 0 ? _b : ((text) => void process.stderr.write(text));
74
+ const json = options.json === true;
75
+ // Failures stay machine-readable under --json (stderr keeps the prose).
76
+ const fail = (message) => {
77
+ if (json) {
78
+ out(`${JSON.stringify({ ok: false, error: message })}\n`);
79
+ }
80
+ err(`${message}\n`);
81
+ return 1;
82
+ };
83
+ if (options.url === undefined || options.url.trim() === "") {
84
+ return fail(`Usage: ${CLI} convert-automation <automation-url-or-uuid> [--dir <path>] [--json]`);
85
+ }
86
+ const uuid = parseAutomationRef(options.url);
87
+ if (uuid === undefined) {
88
+ return fail(`Could not parse ${JSON.stringify(options.url)} — expected an automation URL (https://cursor.com/automations/<uuid> or .../custom-agents/<uuid>) or a bare uuid.`);
89
+ }
90
+ const resolved = yield resolveApiKey({ apiKey: options.apiKey });
91
+ if (resolved === undefined) {
92
+ return fail(`Not signed in to Cursor. ${SIGN_IN_HINT}`);
93
+ }
94
+ const client = new AgentServeDeployClient({
95
+ backendUrl: cursorExternalApiUrl(),
96
+ apiKey: resolved.apiKey,
97
+ fetchImpl: options.fetchImpl,
98
+ });
99
+ let payload;
100
+ try {
101
+ payload = yield client.exportAutomation({ uuid });
102
+ }
103
+ catch (error) {
104
+ if (error instanceof DeployApiError) {
105
+ return fail(error.message);
106
+ }
107
+ throw error;
108
+ }
109
+ const result = convertWorkflow({
110
+ automation: payload.automation,
111
+ workflow: payload.workflow,
112
+ mcpServers: payload.mcpServers,
113
+ exportedAt: new Date().toISOString(),
114
+ });
115
+ const displayDir = (_c = options.dir) !== null && _c !== void 0 ? _c : `./${slugify(payload.automation.name, "automation")}`;
116
+ const rootDir = resolve((_d = options.cwd) !== null && _d !== void 0 ? _d : process.cwd(), displayDir);
117
+ let files;
118
+ try {
119
+ files = yield writeProjectFiles(rootDir, result);
120
+ }
121
+ catch (error) {
122
+ return fail(`Could not write project files under ${rootDir}: ${describe(error)}`);
123
+ }
124
+ // Same npm install as `init`, so the printed `validate` / `dev` next steps
125
+ // work immediately. Failure (npm exit or spawn error) is loud but never
126
+ // fails the conversion.
127
+ const install = (_e = options.installImpl) !== null && _e !== void 0 ? _e : installScaffoldDependencies;
128
+ if (!json) {
129
+ out("\nInstalling npm packages\n");
130
+ }
131
+ let installed;
132
+ try {
133
+ installed = yield install(rootDir, {
134
+ stdio: json ? "pipe" : "inherit",
135
+ });
136
+ }
137
+ catch (error) {
138
+ installed = { ok: false, exitCode: -1, stderr: describe(error) };
139
+ }
140
+ if (!installed.ok && !json) {
141
+ const reason = installed.stderr.trim() || `exit ${installed.exitCode}`;
142
+ err(`npm install failed (${reason}); run \`npm install\` in ${displayDir} before \`${CLI} dev\`.\n`);
143
+ }
144
+ if (json) {
145
+ out(`${JSON.stringify({
146
+ ok: true,
147
+ directory: rootDir,
148
+ files: files.map(({ path, action }) => ({ path, action })),
149
+ warnings: result.warnings,
150
+ setupSteps: result.setupSteps,
151
+ installed: installed.ok,
152
+ installError: installed.ok
153
+ ? null
154
+ : installed.stderr.trim() ||
155
+ `npm install exited ${installed.exitCode}`,
156
+ mcpConnections: result.mcpConnections.map((connection) => ({
157
+ name: connection.name,
158
+ kind: connection.kind,
159
+ })),
160
+ }, null, 2)}\n`);
161
+ return 0;
162
+ }
163
+ out(renderSummary({
164
+ automationName: payload.automation.name,
165
+ displayDir,
166
+ rootDir,
167
+ cwd: (_f = options.cwd) !== null && _f !== void 0 ? _f : process.cwd(),
168
+ files,
169
+ result,
170
+ }));
171
+ return 0;
172
+ });
173
+ }
174
+ /**
175
+ * Converter files first (wx — existing files are kept), then the init
176
+ * scaffold fills in around them with the same skip-existing semantics.
177
+ */
178
+ function writeProjectFiles(rootDir, result) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ const entries = [];
181
+ const converterPaths = new Set();
182
+ yield mkdir(rootDir, { recursive: true });
183
+ for (const file of result.files) {
184
+ converterPaths.add(file.path);
185
+ const abs = join(rootDir, file.path);
186
+ yield mkdir(dirname(abs), { recursive: true });
187
+ try {
188
+ yield writeFile(abs, file.contents, { flag: "wx" });
189
+ entries.push({ path: file.path, action: "create" });
190
+ }
191
+ catch (error) {
192
+ if (!isEexist(error)) {
193
+ throw error;
194
+ }
195
+ entries.push({ path: file.path, action: "exist" });
196
+ }
197
+ }
198
+ const init = yield initProject({ dir: rootDir });
199
+ // Scaffold files that make sense in a fresh `init` but not in an exported
200
+ // automation: the default memory hook (only when the automation had memory
201
+ // enabled — the converter emits its own copy then) and the echo demo tool.
202
+ const dropPaths = new Set();
203
+ for (const scaffoldPath of ["agent/hooks/memory.ts", "agent/tools/echo.ts"]) {
204
+ if (!converterPaths.has(scaffoldPath) &&
205
+ init.created.includes(scaffoldPath)) {
206
+ dropPaths.add(scaffoldPath);
207
+ yield rm(join(rootDir, scaffoldPath));
208
+ }
209
+ }
210
+ for (const entry of init.files) {
211
+ if (converterPaths.has(entry.path) || dropPaths.has(entry.path)) {
212
+ continue;
213
+ }
214
+ entries.push(entry);
215
+ }
216
+ return entries;
217
+ });
218
+ }
219
+ function renderSummary(args) {
220
+ const c = stdoutPalette();
221
+ const lines = [];
222
+ lines.push("");
223
+ lines.push(`Converted "${args.automationName}" → ${args.displayDir}`);
224
+ lines.push("");
225
+ let anyExisting = false;
226
+ for (const file of args.files) {
227
+ if (file.path.endsWith(".gitkeep")) {
228
+ continue;
229
+ }
230
+ anyExisting || (anyExisting = file.action === "exist");
231
+ lines.push(c.dim(`${file.action.padStart(12)} ${file.path}`));
232
+ }
233
+ if (anyExisting) {
234
+ lines.push(c.dim(`\n "exist" files already existed and were kept as-is.`));
235
+ }
236
+ const warnings = args.result.warnings;
237
+ if (warnings.length > 0) {
238
+ lines.push("");
239
+ lines.push("Warnings:");
240
+ for (const warning of warnings) {
241
+ lines.push(` - ${warning}`);
242
+ }
243
+ }
244
+ if (args.result.setupSteps.length > 0) {
245
+ lines.push("");
246
+ lines.push("Setup steps:");
247
+ for (const [index, step] of args.result.setupSteps.entries()) {
248
+ lines.push(` ${index + 1}. ${step}`);
249
+ }
250
+ }
251
+ if (args.result.mcpConnections.length > 0) {
252
+ lines.push("");
253
+ lines.push("MCP connections:");
254
+ for (const connection of args.result.mcpConnections) {
255
+ lines.push(` - ${connection.name}: ${connectionStatus(connection)}`);
256
+ }
257
+ }
258
+ lines.push("");
259
+ lines.push("Next steps:");
260
+ const cd = formatCdCommand(args.cwd, args.rootDir);
261
+ const steps = [
262
+ ...(cd === undefined ? [] : [cd]),
263
+ `${CLI} validate`,
264
+ `${CLI} dev`,
265
+ ];
266
+ for (const [index, step] of steps.entries()) {
267
+ lines.push(` ${index + 1}. ${step}`);
268
+ }
269
+ lines.push("");
270
+ return `${lines.join("\n")}\n`;
271
+ }
272
+ function connectionStatus(connection) {
273
+ if (connection.kind === "cursorAccount") {
274
+ return "resolved from your Cursor account at runtime — manage authorization in Cursor (dashboard → MCP)";
275
+ }
276
+ return "needs manual setup — see the stub file and warnings above";
277
+ }
278
+ function describe(error) {
279
+ return error instanceof Error ? error.message : String(error);
280
+ }
@@ -113,4 +113,6 @@ export declare function cmdRotatePodCredential(slug: string | undefined, options
113
113
  export declare function cmdSecretsSet(slug: string | undefined, specs: string[], options: DeployCliOptions): Promise<number>;
114
114
  export declare function cmdSecretsList(slug: string | undefined, options: DeployCliOptions): Promise<number>;
115
115
  export declare function cmdSecretsUnset(slug: string | undefined, name: string | undefined, options: DeployCliOptions): Promise<number>;
116
+ /** Buffered line reader over a piped stream; undefined once it ends. */
117
+ export declare function createLineReader(stream: NodeJS.ReadableStream): () => Promise<string | undefined>;
116
118
  //# sourceMappingURL=cli-deploy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-deploy.d.ts","sourceRoot":"","sources":["../../src/internal/cli-deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,OAAO,EACL,sBAAsB,EAavB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,SAAS,EAAwB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,gBAAgB,CAAC;AAaxB,8EAA8E;AAC9E,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,MAAM,EAAE,SAAS,YAAY,EAAE,KAC5B,OAAO,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC;AAEpC,MAA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BAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CA2FjB;AAMD,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAqCjB;AAMD,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CA4BjB;AAMD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CA6BjB;AAMD,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAgEjB;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CA4BjB;AAoED,wEAAwE;AACxE,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,CAAC,cAAc,GAC5B,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAuCnC"}
@@ -1000,7 +1000,7 @@ function promptHidden(stdin, err, prompt) {
1000
1000
  });
1001
1001
  }
1002
1002
  /** Buffered line reader over a piped stream; undefined once it ends. */
1003
- function createLineReader(stream) {
1003
+ export function createLineReader(stream) {
1004
1004
  let buffer = "";
1005
1005
  let ended = false;
1006
1006
  const waiters = [];
@@ -7,6 +7,7 @@
7
7
  * stored backend-side against the hosted deployment's service account — see
8
8
  * `cursor-account-mcp-auth.ts`).
9
9
  */
10
+ import type { OAuthTokens } from "@modelcontextprotocol/sdk/shared/auth.js";
10
11
  export type McpOauthCliOptions = {
11
12
  dir: string;
12
13
  connection: string;
@@ -25,4 +26,26 @@ export type McpOauthCliOptions = {
25
26
  pollTimeoutMs?: number;
26
27
  };
27
28
  export declare function cmdMcpOauth(options: McpOauthCliOptions): Promise<number>;
29
+ export interface HostMcpOauthArgs {
30
+ /** Connection name — the local token-store identifier. */
31
+ connection: string;
32
+ url: string;
33
+ type?: "http" | "sse";
34
+ headers?: Record<string, string>;
35
+ out: (text: string) => void;
36
+ err: (text: string) => void;
37
+ }
38
+ export type HostMcpOauthResult = {
39
+ ok: true;
40
+ tokens: OAuthTokens | undefined;
41
+ clientId: string | undefined;
42
+ } | {
43
+ ok: false;
44
+ };
45
+ /**
46
+ * The interactive host-OAuth browser flow against an MCP server URL. Takes
47
+ * the transport metadata directly so callers that already hold it never have
48
+ * to load the authored project to authorize.
49
+ */
50
+ export declare function authorizeHostMcpOauth(args: HostMcpOauthArgs): Promise<HostMcpOauthResult>;
28
51
  //# sourceMappingURL=cli-mcp-oauth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-mcp-oauth.d.ts","sourceRoot":"","sources":["../../src/internal/cli-mcp-oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAuBH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAA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C,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAiBF,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA0DjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,kBAAkB,GAC1B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC3E;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC;AAElB;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAkG7B"}
@@ -43,10 +43,9 @@ function describe(error) {
43
43
  }
44
44
  export function cmdMcpOauth(options) {
45
45
  return __awaiter(this, void 0, void 0, function* () {
46
- var _a;
47
- var _b, _c;
48
- const err = (_b = options.err) !== null && _b !== void 0 ? _b : ((text) => process.stderr.write(text));
49
- const out = (_c = options.out) !== null && _c !== void 0 ? _c : ((text) => process.stdout.write(text));
46
+ var _a, _b;
47
+ const err = (_a = options.err) !== null && _a !== void 0 ? _a : ((text) => process.stderr.write(text));
48
+ const out = (_b = options.out) !== null && _b !== void 0 ? _b : ((text) => process.stdout.write(text));
50
49
  const project = yield loadAgentProject(options.dir);
51
50
  const connection = project.agent.connections.find((entry) => entry.name === options.connection);
52
51
  if (connection === undefined) {
@@ -67,22 +66,56 @@ export function cmdMcpOauth(options) {
67
66
  err(`${LOG_PREFIX} "${options.connection}" must be defineConnection({ url, oauth: true }) or defineConnection({ cursorAccount: true }).\n`);
68
67
  return 1;
69
68
  }
70
- out(`${LOG_PREFIX} Authorizing "${options.connection}" (${transport.url})…\n`);
69
+ const flow = yield authorizeHostMcpOauth({
70
+ connection: options.connection,
71
+ url: transport.url,
72
+ type: transport.type === "sse" ? "sse" : "http",
73
+ headers: transport.headers,
74
+ out,
75
+ err,
76
+ });
77
+ if (!flow.ok) {
78
+ return 1;
79
+ }
80
+ if (options.store !== true) {
81
+ return 0;
82
+ }
83
+ return storeOauthSecrets({
84
+ connection: options.connection,
85
+ dir: options.dir,
86
+ slug: options.slug,
87
+ team: options.team,
88
+ apiKey: options.apiKey,
89
+ tokens: flow.tokens,
90
+ clientId: flow.clientId,
91
+ err,
92
+ out,
93
+ });
94
+ });
95
+ }
96
+ /**
97
+ * The interactive host-OAuth browser flow against an MCP server URL. Takes
98
+ * the transport metadata directly so callers that already hold it never have
99
+ * to load the authored project to authorize.
100
+ */
101
+ export function authorizeHostMcpOauth(args) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ var _a;
104
+ const { connection, out, err } = args;
105
+ out(`${LOG_PREFIX} Authorizing "${connection}" (${args.url})…\n`);
71
106
  let authorizationUrl;
72
107
  const provider = yield createHostMcpOAuthProvider({
73
- identifier: options.connection,
74
- resourceUrl: transport.url,
108
+ identifier: connection,
109
+ resourceUrl: args.url,
75
110
  onRedirect: (url) => {
76
111
  authorizationUrl = url;
77
112
  },
78
113
  });
79
114
  const client = new Client({ name: "agent-sdk-mcp-oauth", version: "0.1.0" });
80
- const url = new URL(transport.url);
81
- const requestInit = transport.headers === undefined
82
- ? undefined
83
- : { headers: transport.headers };
115
+ const url = new URL(args.url);
116
+ const requestInit = args.headers === undefined ? undefined : { headers: args.headers };
84
117
  const makeTransport = () => {
85
- if (transport.type === "sse") {
118
+ if (args.type === "sse") {
86
119
  return new SSEClientTransport(url, {
87
120
  authProvider: provider,
88
121
  requestInit,
@@ -97,21 +130,21 @@ export function cmdMcpOauth(options) {
97
130
  let authorized = false;
98
131
  try {
99
132
  yield client.connect(mcpTransport);
100
- out(`${LOG_PREFIX} "${options.connection}" already authorized.\n`);
133
+ out(`${LOG_PREFIX} "${connection}" already authorized.\n`);
101
134
  yield client.close().catch(() => undefined);
102
135
  authorized = true;
103
136
  }
104
137
  catch (error) {
105
138
  if (!(error instanceof UnauthorizedError)) {
106
- err(`${LOG_PREFIX} Failed to connect to "${options.connection}": ${describe(error)}\n`);
107
- return 1;
139
+ err(`${LOG_PREFIX} Failed to connect to "${connection}": ${describe(error)}\n`);
140
+ return { ok: false };
108
141
  }
109
142
  }
110
143
  if (!authorized) {
111
144
  const redirect = authorizationUrl !== null && authorizationUrl !== void 0 ? authorizationUrl : provider.lastRedirectUrl;
112
145
  if (redirect === undefined) {
113
146
  err(`${LOG_PREFIX} Auth required but no authorization URL was provided.\n`);
114
- return 1;
147
+ return { ok: false };
115
148
  }
116
149
  out(`${LOG_PREFIX} Open if needed:\n ${redirect.toString()}\n`);
117
150
  out(`${LOG_PREFIX} Waiting on ${MCP_OAUTH_CALLBACK_URL}…\n`);
@@ -122,41 +155,32 @@ export function cmdMcpOauth(options) {
122
155
  }
123
156
  catch (error) {
124
157
  err(`${LOG_PREFIX} OAuth callback failed: ${describe(error)}\n`);
125
- return 1;
158
+ return { ok: false };
126
159
  }
127
160
  try {
128
161
  yield mcpTransport.finishAuth(callback.code);
129
162
  }
130
163
  catch (error) {
131
164
  err(`${LOG_PREFIX} Token exchange failed: ${describe(error)}\n`);
132
- return 1;
165
+ return { ok: false };
133
166
  }
134
167
  mcpTransport = makeTransport();
135
168
  try {
136
169
  yield client.connect(mcpTransport);
137
170
  const tools = yield client.listTools();
138
- out(`${LOG_PREFIX} Authorized "${options.connection}" (${tools.tools.length} tools). Local tokens in the agent-serve config dir.\n`);
171
+ out(`${LOG_PREFIX} Authorized "${connection}" (${tools.tools.length} tools). Local tokens in the agent-serve config dir.\n`);
139
172
  yield client.close().catch(() => undefined);
140
173
  }
141
174
  catch (error) {
142
- err(`${LOG_PREFIX} Reconnect failed: ${describe(error)}. Re-run \`${CLI} mcp oauth ${options.connection}\`.\n`);
143
- return 1;
175
+ err(`${LOG_PREFIX} Reconnect failed: ${describe(error)}. Re-run \`${CLI} mcp oauth ${connection}\`.\n`);
176
+ return { ok: false };
144
177
  }
145
178
  }
146
- if (options.store !== true) {
147
- return 0;
148
- }
149
- return storeOauthSecrets({
150
- connection: options.connection,
151
- dir: options.dir,
152
- slug: options.slug,
153
- team: options.team,
154
- apiKey: options.apiKey,
179
+ return {
180
+ ok: true,
155
181
  tokens: provider.tokens(),
156
182
  clientId: (_a = provider.clientInformation()) === null || _a === void 0 ? void 0 : _a.client_id,
157
- err,
158
- out,
159
- });
183
+ };
160
184
  });
161
185
  }
162
186
  /**
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Pure Workflow → agentkit project converter.
3
+ *
4
+ * Maps an exported Cursor automation (proto3 workflow JSON + enriched MCP
5
+ * server list) to project files, warnings, and setup steps. No I/O, no
6
+ * clock — `exportedAt` comes from the caller.
7
+ */
8
+ import type { ConvertWorkflowInput, ConvertWorkflowResult } from "./types.js";
9
+ export declare function convertWorkflow(input: ConvertWorkflowInput): ConvertWorkflowResult;
10
+ //# sourceMappingURL=convert-workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-workflow.d.ts","sourceRoot":"","sources":["../../../src/internal/convert-automation/convert-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAKV,oBAAoB,EACpB,qBAAqB,EAQtB,MAAM,YAAY,CAAC;AAUpB,wBAAgB,eAAe,CAC7B,KAAK,EAAE,oBAAoB,GAC1B,qBAAqB,CA4GvB"}