@cursor/july 0.1.6 → 0.1.8

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 (179) hide show
  1. package/dist/bin/agent-serve.js +73 -19
  2. package/dist/channels/slack/channel-watch.d.ts +6 -1
  3. package/dist/channels/slack/channel-watch.d.ts.map +1 -1
  4. package/dist/channels/slack/channel-watch.js +22 -1
  5. package/dist/channels/slack/cursor-account.d.ts +4 -0
  6. package/dist/channels/slack/cursor-account.d.ts.map +1 -1
  7. package/dist/channels/slack/cursor-account.js +12 -2
  8. package/dist/channels/slack/defaults.d.ts +10 -5
  9. package/dist/channels/slack/defaults.d.ts.map +1 -1
  10. package/dist/channels/slack/defaults.js +39 -17
  11. package/dist/channels/slack/dispatch.d.ts +18 -0
  12. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  13. package/dist/channels/slack/dispatch.js +141 -38
  14. package/dist/channels/slack/inbound.d.ts +13 -3
  15. package/dist/channels/slack/inbound.d.ts.map +1 -1
  16. package/dist/channels/slack/inbound.js +17 -9
  17. package/dist/channels/slack/index.d.ts +4 -0
  18. package/dist/channels/slack/index.d.ts.map +1 -1
  19. package/dist/channels/slack/index.js +4 -0
  20. package/dist/channels/slack/live-delivery.d.ts.map +1 -1
  21. package/dist/channels/slack/live-delivery.js +1 -0
  22. package/dist/channels/slack/manifest.d.ts.map +1 -1
  23. package/dist/channels/slack/manifest.js +3 -0
  24. package/dist/channels/slack/nudge-carrier.d.ts +19 -0
  25. package/dist/channels/slack/nudge-carrier.d.ts.map +1 -0
  26. package/dist/channels/slack/nudge-carrier.js +166 -0
  27. package/dist/channels/slack/nudge-store.d.ts +61 -0
  28. package/dist/channels/slack/nudge-store.d.ts.map +1 -0
  29. package/dist/channels/slack/nudge-store.js +266 -0
  30. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  31. package/dist/channels/slack/slack-channel.js +74 -25
  32. package/dist/channels/slack/stop.d.ts +14 -0
  33. package/dist/channels/slack/stop.d.ts.map +1 -0
  34. package/dist/channels/slack/stop.js +22 -0
  35. package/dist/channels/slack/thread-context.d.ts +81 -0
  36. package/dist/channels/slack/thread-context.d.ts.map +1 -0
  37. package/dist/channels/slack/thread-context.js +470 -0
  38. package/dist/channels/slack/types.d.ts +27 -0
  39. package/dist/channels/slack/types.d.ts.map +1 -1
  40. package/dist/docs/404.html +2 -2
  41. package/dist/docs/ab.html +4 -4
  42. package/dist/docs/assets/{app.DMboGKUD.js → app.BP8mAVMW.js} +1 -1
  43. package/dist/docs/assets/chunks/@localSearchIndexroot.DevOabKJ.js +1 -0
  44. package/dist/docs/assets/chunks/{VPLocalSearchBox.DkEqEnJU.js → VPLocalSearchBox.1FXIZbz8.js} +1 -1
  45. package/dist/docs/assets/chunks/{theme.ASugdMNm.js → theme.Dm1R02v9.js} +2 -2
  46. package/dist/docs/assets/example-agents_index.md.CwtWu5ix.js +2 -0
  47. package/dist/docs/assets/{example-agents_index.md.CRqJlnIf.lean.js → example-agents_index.md.CwtWu5ix.lean.js} +1 -1
  48. package/dist/docs/assets/example-agents_oncall.md.BG_sUMly.js +10 -0
  49. package/dist/docs/assets/example-agents_oncall.md.BG_sUMly.lean.js +1 -0
  50. package/dist/docs/assets/{guides_slack.md.CCwqHvSV.js → guides_slack.md.FWale6Ip.js} +4 -3
  51. package/dist/docs/assets/{guides_slack.md.CCwqHvSV.lean.js → guides_slack.md.FWale6Ip.lean.js} +1 -1
  52. package/dist/docs/assets/{reference_sessions.md.DdjWabnN.js → reference_sessions.md.DLd6mvbv.js} +2 -2
  53. package/dist/docs/assets/{reference_sessions.md.DdjWabnN.lean.js → reference_sessions.md.DLd6mvbv.lean.js} +1 -1
  54. package/dist/docs/assets/{storage.md.CVnInNiN.js → storage.md.Cu3MwM2a.js} +3 -2
  55. package/dist/docs/assets/{storage.md.CVnInNiN.lean.js → storage.md.Cu3MwM2a.lean.js} +1 -1
  56. package/dist/docs/building-with-agents.html +4 -4
  57. package/dist/docs/concepts.html +4 -4
  58. package/dist/docs/deployment.html +4 -4
  59. package/dist/docs/evals.html +4 -4
  60. package/dist/docs/example-agents/approval-buddy.html +4 -4
  61. package/dist/docs/example-agents/benny.html +5 -5
  62. package/dist/docs/example-agents/bugbot.html +5 -5
  63. package/dist/docs/example-agents/codebase-wiki.html +4 -4
  64. package/dist/docs/example-agents/codeowners-review.html +4 -4
  65. package/dist/docs/example-agents/concierge.html +4 -4
  66. package/dist/docs/example-agents/fsd.html +4 -4
  67. package/dist/docs/example-agents/index.html +6 -6
  68. package/dist/docs/example-agents/knowledge-base.html +4 -4
  69. package/dist/docs/example-agents/oncall.html +34 -0
  70. package/dist/docs/example-agents/security-reviewer.html +4 -4
  71. package/dist/docs/example-agents/slack-agent.html +4 -4
  72. package/dist/docs/example-agents/weather-agent.html +4 -4
  73. package/dist/docs/guides/agent-to-agent.html +4 -4
  74. package/dist/docs/guides/cloud-runtime.html +4 -4
  75. package/dist/docs/guides/github.html +4 -4
  76. package/dist/docs/guides/human-in-the-loop.html +4 -4
  77. package/dist/docs/guides/slack.html +7 -6
  78. package/dist/docs/guides/webhooks.html +4 -4
  79. package/dist/docs/hashmap.json +1 -1
  80. package/dist/docs/hillclimbing.html +4 -4
  81. package/dist/docs/index.html +4 -4
  82. package/dist/docs/quickstart.html +4 -4
  83. package/dist/docs/reference/agent-config.html +4 -4
  84. package/dist/docs/reference/channels.html +4 -4
  85. package/dist/docs/reference/cli.html +4 -4
  86. package/dist/docs/reference/connections.html +4 -4
  87. package/dist/docs/reference/hooks.html +4 -4
  88. package/dist/docs/reference/http-api.html +4 -4
  89. package/dist/docs/reference/instructions.html +4 -4
  90. package/dist/docs/reference/playground.html +4 -4
  91. package/dist/docs/reference/project-layout.html +4 -4
  92. package/dist/docs/reference/schedules.html +4 -4
  93. package/dist/docs/reference/sessions.html +5 -5
  94. package/dist/docs/reference/skills.html +4 -4
  95. package/dist/docs/reference/subagents.html +4 -4
  96. package/dist/docs/reference/tools.html +4 -4
  97. package/dist/docs/scaffolding-agents.html +4 -4
  98. package/dist/docs/storage.html +7 -6
  99. package/dist/docs/troubleshooting.html +4 -4
  100. package/dist/evals.d.ts +2 -2
  101. package/dist/internal/cli-ax.d.ts +23 -10
  102. package/dist/internal/cli-ax.d.ts.map +1 -1
  103. package/dist/internal/cli-ax.js +358 -55
  104. package/dist/internal/cli-mcp.d.ts +64 -0
  105. package/dist/internal/cli-mcp.d.ts.map +1 -0
  106. package/dist/internal/cli-mcp.js +570 -0
  107. package/dist/internal/distribution.d.ts.map +1 -1
  108. package/dist/internal/distribution.js +2 -0
  109. package/dist/internal/eval-run-store.d.ts +2 -0
  110. package/dist/internal/eval-run-store.d.ts.map +1 -1
  111. package/dist/internal/eval-run-store.js +4 -4
  112. package/dist/internal/evals-client.d.ts +96 -0
  113. package/dist/internal/evals-client.d.ts.map +1 -0
  114. package/dist/internal/evals-client.js +262 -0
  115. package/dist/internal/host-kv.d.ts +17 -0
  116. package/dist/internal/host-kv.d.ts.map +1 -0
  117. package/dist/internal/host-kv.js +77 -0
  118. package/dist/internal/init-project.js +3 -3
  119. package/dist/internal/server.d.ts.map +1 -1
  120. package/dist/internal/server.js +19 -2
  121. package/dist/internal/session-engine.d.ts +42 -7
  122. package/dist/internal/session-engine.d.ts.map +1 -1
  123. package/dist/internal/session-engine.js +247 -51
  124. package/dist/internal/storage-coordinator.d.ts +18 -1
  125. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  126. package/dist/internal/storage-coordinator.js +43 -0
  127. package/dist/playground/assets/index-Bpr4Th4M.js +319 -0
  128. package/dist/playground/index.html +1 -1
  129. package/dist/storage-backends/file-kv.d.ts +42 -0
  130. package/dist/storage-backends/file-kv.d.ts.map +1 -0
  131. package/dist/storage-backends/file-kv.js +190 -0
  132. package/dist/storage-backends/postgres-kv.d.ts +77 -0
  133. package/dist/storage-backends/postgres-kv.d.ts.map +1 -0
  134. package/dist/storage-backends/postgres-kv.js +180 -0
  135. package/dist/storage.d.ts +10 -1
  136. package/dist/storage.d.ts.map +1 -1
  137. package/dist/storage.js +10 -1
  138. package/dist/types.d.ts +79 -0
  139. package/dist/types.d.ts.map +1 -1
  140. package/docs/example-agents/index.md +14 -9
  141. package/docs/example-agents/oncall.md +216 -0
  142. package/docs/guides/slack.md +11 -2
  143. package/docs/reference/sessions.md +13 -4
  144. package/docs/storage.md +27 -0
  145. package/package.json +15 -1
  146. package/skills/framework-map/SKILL.md +6 -4
  147. package/src/bin/agent-serve.ts +79 -18
  148. package/src/channels/slack/channel-watch.ts +28 -1
  149. package/src/channels/slack/cursor-account.ts +20 -0
  150. package/src/channels/slack/defaults.ts +51 -20
  151. package/src/channels/slack/dispatch.ts +215 -40
  152. package/src/channels/slack/inbound.ts +30 -10
  153. package/src/channels/slack/index.ts +4 -0
  154. package/src/channels/slack/live-delivery.ts +1 -0
  155. package/src/channels/slack/manifest.ts +3 -0
  156. package/src/channels/slack/nudge-carrier.ts +182 -0
  157. package/src/channels/slack/nudge-store.ts +308 -0
  158. package/src/channels/slack/slack-channel.ts +106 -31
  159. package/src/channels/slack/stop.ts +25 -0
  160. package/src/channels/slack/thread-context.ts +572 -0
  161. package/src/channels/slack/types.ts +27 -0
  162. package/src/evals.ts +2 -2
  163. package/src/internal/cli-ax.ts +466 -75
  164. package/src/internal/cli-mcp.ts +708 -0
  165. package/src/internal/distribution.ts +2 -0
  166. package/src/internal/eval-run-store.ts +5 -0
  167. package/src/internal/evals-client.ts +431 -0
  168. package/src/internal/host-kv.ts +85 -0
  169. package/src/internal/init-project.ts +3 -3
  170. package/src/internal/server.ts +43 -0
  171. package/src/internal/session-engine.ts +351 -50
  172. package/src/internal/storage-coordinator.ts +41 -0
  173. package/src/storage-backends/file-kv.ts +221 -0
  174. package/src/storage-backends/postgres-kv.ts +248 -0
  175. package/src/storage.ts +11 -1
  176. package/src/types.ts +83 -0
  177. package/dist/docs/assets/chunks/@localSearchIndexroot.O6eP7QZr.js +0 -1
  178. package/dist/docs/assets/example-agents_index.md.CRqJlnIf.js +0 -2
  179. package/dist/playground/assets/index-mux9aj5P.js +0 -319
@@ -46,17 +46,18 @@ export interface AxCliOptions {
46
46
  url?: string;
47
47
  /**
48
48
  * Route chat/resume/run/call/eval/logs/sessions at the team's hosted
49
- * deployment
50
- * instead of a local ephemeral server. Mutually exclusive with `--url`.
51
- * `eval` targets the deployment by default, so there `--prod` is just
52
- * being explicit.
49
+ * deployment instead of a local ephemeral server. Mutually exclusive with
50
+ * `--url`. For `eval`, this runs a server-side batch via
51
+ * `/v1/dev/evals/runs` (persisted when `defineStorage` has an `evals` table);
52
+ * without `--prod`, eval defaults to an ephemeral local harness.
53
53
  */
54
54
  prod?: boolean;
55
55
  /**
56
- * `eval`: run against an ephemeral local server instead of the hosted
57
- * deployment (the eval default). Mutually exclusive with `--url`/`--prod`.
56
+ * `eval` (`--prod` / `--url` only): start the batch via
57
+ * `POST /v1/dev/evals/runs` and return the `runId` without polling.
58
+ * Mutually exclusive with `--list`.
58
59
  */
59
- local?: boolean;
60
+ noWait?: boolean;
60
61
  /** Cursor team id for `--prod` (defaults to the account's team). */
61
62
  team?: string;
62
63
  /** Cursor API key override for `--prod` management calls. */
@@ -120,14 +121,26 @@ export declare function cmdRun(options: AxCliOptions): Promise<number>;
120
121
  export declare function cmdCall(options: AxCliOptions): Promise<number>;
121
122
  export declare function cmdTrajectory(options: AxCliOptions): Promise<number>;
122
123
  /**
123
- * Which surface `eval` should target. Deployment is the default; `--local`
124
- * opts into an ephemeral local server, `--url` into a running one.
124
+ * Which surface `eval` should target. Local (ephemeral) is the default;
125
+ * `--prod` uses the hosted deployment, `--url` a running server.
125
126
  * Exported for tests.
126
127
  */
127
- export declare function resolveEvalTargetMode(options: Pick<AxCliOptions, "local" | "prod" | "url">): "local" | "url" | "deployment" | {
128
+ export declare function resolveEvalTargetMode(options: Pick<AxCliOptions, "prod" | "url">): "local" | "url" | "deployment" | {
128
129
  error: string;
129
130
  };
130
131
  export declare function cmdEval(options: AxCliOptions): Promise<number>;
132
+ /**
133
+ * Flags to re-target the same surface from an `eval --no-wait` hint.
134
+ * Exported for tests.
135
+ */
136
+ export declare function formatEvalStatusFlags(options: Pick<AxCliOptions, "prod" | "url" | "slug" | "team">): string;
137
+ /**
138
+ * `eval status [runId]` — fetch one batch (or list recent) on the deployment /
139
+ * `--url` target. Exit `0` when the batch is completed with all cases passing,
140
+ * `1` when failed / any case failed / unknown, `2` for usage errors, `3` when
141
+ * the batch is still running (for poll loops after `--no-wait`).
142
+ */
143
+ export declare function cmdEvalStatus(runId: string | undefined, options: AxCliOptions): Promise<number>;
131
144
  /**
132
145
  * `logs` — follow deploy progress (`--prod`) then runtime agent logs.
133
146
  * Local / `--url` tails `/v1/logs` only.
@@ -1 +1 @@
1
- {"version":3,"file":"cli-ax.d.ts","sourceRoot":"","sources":["../../src/internal/cli-ax.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkDH,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gCAAgC;IAChC,OAAO,CAAC,EAAE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IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC,GAC1C,OAAO,GAAG,KAAK,GAAG,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAepD;AAiDD,wBAAsB,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA6KpE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC,GAC5D,MAAM,CAcR;AAuCD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC,CA4FjB;AA6KD;;;GAGG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAgFpE;AAmCD;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BxE;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC,CAkDjB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAoF1E"}
@@ -25,6 +25,7 @@ import { resolveDeployAuth } from "./cli-deploy.js";
25
25
  import { resolveApiKey } from "./cursor/credentials.js";
26
26
  import { CLI_COMMAND_NAME } from "./distribution.js";
27
27
  import { discoverEvals, filterDiscoveredEvals, runDiscoveredEvals, } from "./eval-runner.js";
28
+ import { getRemoteEvalRun, listRemoteEvalRuns, listRemoteEvals, RemoteEvalError, runRemoteEvals, startRemoteEvalRun, } from "./evals-client.js";
28
29
  import { formatInitNextSteps, formatInitScaffoldSummary, initNextCommands, initProject, installScaffoldDependencies, printInitGuide, } from "./init-project.js";
29
30
  import { offerInstallCursorSkills } from "./install-cursor-skills.js";
30
31
  import { runLogsTail, sanitizeCustomerError } from "./logs-client.js";
@@ -476,26 +477,25 @@ export function cmdTrajectory(options) {
476
477
  });
477
478
  }
478
479
  /**
479
- * Which surface `eval` should target. Deployment is the default; `--local`
480
- * opts into an ephemeral local server, `--url` into a running one.
480
+ * Which surface `eval` should target. Local (ephemeral) is the default;
481
+ * `--prod` uses the hosted deployment, `--url` a running server.
481
482
  * Exported for tests.
482
483
  */
483
484
  export function resolveEvalTargetMode(options) {
484
485
  const flags = [
485
- options.local === true ? "--local" : undefined,
486
486
  options.prod === true ? "--prod" : undefined,
487
487
  options.url !== undefined ? "--url" : undefined,
488
488
  ].filter((flag) => flag !== undefined);
489
489
  if (flags.length > 1) {
490
490
  return { error: `${flags.join(" and ")} are mutually exclusive` };
491
491
  }
492
- if (options.local === true) {
493
- return "local";
494
- }
495
492
  if (options.url !== undefined) {
496
493
  return "url";
497
494
  }
498
- return "deployment";
495
+ if (options.prod === true) {
496
+ return "deployment";
497
+ }
498
+ return "local";
499
499
  }
500
500
  /** Resolve the eval target; prints a CLI-ready error and returns an exit code on failure. */
501
501
  function resolveEvalTarget(options) {
@@ -528,13 +528,12 @@ function resolveEvalTarget(options) {
528
528
  // disabled feature gate, and the message distinguishes those from a
529
529
  // genuinely missing deployment.
530
530
  process.stderr.write(`${sanitizeCustomerError(error.message)}\n` +
531
- `Evals run on the hosted deployment by default.\n` +
532
531
  ` deploy it first: ${CLI_COMMAND_NAME} deploy --slug ${error.slug}\n` +
533
- ` or run locally: ${CLI_COMMAND_NAME} eval --local --dir ${options.dir}\n`);
532
+ ` or omit --prod: ${CLI_COMMAND_NAME} eval --dir ${options.dir}\n`);
534
533
  return 1;
535
534
  }
536
535
  process.stderr.write(`${sanitizeCustomerError(error instanceof Error ? error.message : String(error))}\n` +
537
- `Evals run on the hosted deployment by default; pass --local to run on an ephemeral local server.\n`);
536
+ `Pass --prod for the hosted deployment, or omit it to run on an ephemeral local server.\n`);
538
537
  return 1;
539
538
  }
540
539
  });
@@ -543,81 +542,385 @@ export function cmdEval(options) {
543
542
  return __awaiter(this, void 0, void 0, function* () {
544
543
  var _a;
545
544
  const projectRoot = resolve((_a = options.cwd) !== null && _a !== void 0 ? _a : process.cwd(), options.dir);
545
+ const mode = resolveEvalTargetMode(options);
546
+ if (typeof mode === "object") {
547
+ process.stderr.write(`${mode.error}\n`);
548
+ return 2;
549
+ }
550
+ if (options.noWait === true) {
551
+ if (options.list === true) {
552
+ process.stderr.write("--no-wait and --list are mutually exclusive\n");
553
+ return 2;
554
+ }
555
+ if (mode === "local") {
556
+ process.stderr.write("--no-wait requires --prod or --url (not the default local target)\n");
557
+ return 2;
558
+ }
559
+ }
560
+ const filterIds = options.evalIds === undefined || options.evalIds.length === 0
561
+ ? undefined
562
+ : options.evalIds;
563
+ const tags = options.tags === undefined || options.tags.length === 0
564
+ ? undefined
565
+ : options.tags;
546
566
  if (options.list) {
547
- const { evals } = yield discoverEvals(projectRoot);
548
- const listed = filterDiscoveredEvals(evals, {
549
- filterIds: options.evalIds,
550
- tags: options.tags,
551
- });
552
- if (options.json) {
553
- console.log(JSON.stringify(listed.map((e) => { var _a; return ({
567
+ // List the same surface a run will execute: local filesystem by default,
568
+ // GET /v1/dev/evals on --prod / --url.
569
+ if (mode === "local") {
570
+ return listLocalEvals(projectRoot, options, filterIds, tags);
571
+ }
572
+ const target = yield resolveEvalTarget(options);
573
+ if (typeof target === "number") {
574
+ return target;
575
+ }
576
+ try {
577
+ const listed = yield listRemoteEvals({
578
+ baseUrl: target.agentUrl,
579
+ auth: {
580
+ bearerToken: options.bearerToken,
581
+ headers: target.headers,
582
+ },
583
+ fetchImpl: options.fetchImpl,
584
+ filterIds,
585
+ tags,
586
+ });
587
+ return printListedEvals(listed.map((e) => { var _a; return ({
554
588
  id: e.id,
555
589
  fileId: e.fileId,
556
- path: e.path,
557
- description: e.definition.description,
558
- tags: (_a = e.definition.tags) !== null && _a !== void 0 ? _a : [],
559
- }); }), null, 2));
590
+ description: e.description,
591
+ tags: (_a = e.tags) !== null && _a !== void 0 ? _a : [],
592
+ }); }), options, `No evals on ${target.agentUrl}`);
560
593
  }
561
- else if (listed.length === 0) {
562
- process.stdout.write(`No evals under ${projectRoot}/evals\n`);
594
+ catch (error) {
595
+ process.stderr.write(`${sanitizeCustomerError(error instanceof Error ? error.message : String(error))}\n`);
596
+ return 1;
563
597
  }
564
- else {
565
- for (const e of listed) {
566
- const tags = e.definition.tags && e.definition.tags.length > 0
567
- ? ` [${e.definition.tags.join(", ")}]`
568
- : "";
569
- const desc = e.definition.description !== undefined
570
- ? ` — ${e.definition.description}`
571
- : "";
572
- process.stdout.write(`${e.id}${tags}${desc}\n`);
598
+ finally {
599
+ if (target.close !== undefined) {
600
+ yield target.close();
573
601
  }
574
602
  }
575
- return 0;
576
603
  }
577
604
  const target = yield resolveEvalTarget(options);
578
605
  if (typeof target === "number") {
579
606
  return target;
580
607
  }
581
608
  const stream = shouldStreamProgress(options);
582
- const progress = stream ? createStreamProgress() : undefined;
583
609
  try {
584
610
  if (options.verbose || stream) {
585
611
  process.stderr.write(`eval target: ${target.agentUrl}\n`);
586
612
  }
587
- const results = yield runDiscoveredEvals({
588
- projectRoot,
613
+ // Default local: ephemeral in-process harness against local eval sources.
614
+ // --prod / --url: run on the serve process via /v1/dev/evals/runs so the
615
+ // batch lands in playground history and defineStorage evals (when set).
616
+ if (mode === "local") {
617
+ const progress = stream ? createStreamProgress() : undefined;
618
+ try {
619
+ const results = yield runDiscoveredEvals({
620
+ projectRoot,
621
+ baseUrl: target.agentUrl,
622
+ filterIds,
623
+ tags,
624
+ timeoutMs: options.timeoutMs,
625
+ bearerToken: options.bearerToken,
626
+ headers: target.headers,
627
+ verbose: Boolean(options.verbose) || stream,
628
+ onEvent: progress === undefined ? undefined : (e) => progress.onEvent(e),
629
+ });
630
+ if (results.length === 0) {
631
+ process.stderr.write("No matching evals found.\n");
632
+ return 2;
633
+ }
634
+ return printEvalResults(results, options);
635
+ }
636
+ finally {
637
+ progress === null || progress === void 0 ? void 0 : progress.close();
638
+ }
639
+ }
640
+ try {
641
+ if (options.noWait === true) {
642
+ const started = yield startRemoteEvalRun({
643
+ baseUrl: target.agentUrl,
644
+ filterIds,
645
+ tags,
646
+ timeoutMs: options.timeoutMs,
647
+ verbose: Boolean(options.verbose),
648
+ auth: {
649
+ bearerToken: options.bearerToken,
650
+ headers: target.headers,
651
+ },
652
+ fetchImpl: options.fetchImpl,
653
+ });
654
+ return printEvalAccepted(started, options, target.agentUrl);
655
+ }
656
+ const progress = createRemoteEvalProgress(options.verbose === true || stream);
657
+ const { snapshot, results } = yield runRemoteEvals({
658
+ baseUrl: target.agentUrl,
659
+ filterIds,
660
+ tags,
661
+ timeoutMs: options.timeoutMs,
662
+ verbose: Boolean(options.verbose) || stream,
663
+ bearerToken: options.bearerToken,
664
+ headers: target.headers,
665
+ fetchImpl: options.fetchImpl,
666
+ onSnapshot: progress === undefined ? undefined : progress.onSnapshot,
667
+ });
668
+ if (results.length === 0 && snapshot.status !== "failed") {
669
+ process.stderr.write("No matching evals found.\n");
670
+ return 2;
671
+ }
672
+ return printEvalResults(results, options, {
673
+ runId: snapshot.runId,
674
+ status: snapshot.status,
675
+ error: snapshot.error,
676
+ });
677
+ }
678
+ catch (error) {
679
+ if (error instanceof RemoteEvalError &&
680
+ error.code === "no_matching_evals") {
681
+ process.stderr.write(`${error.message}\n`);
682
+ return 2;
683
+ }
684
+ process.stderr.write(`${sanitizeCustomerError(error instanceof Error ? error.message : String(error))}\n`);
685
+ return 1;
686
+ }
687
+ }
688
+ finally {
689
+ if (target.close !== undefined) {
690
+ yield target.close();
691
+ }
692
+ }
693
+ });
694
+ }
695
+ /**
696
+ * Flags to re-target the same surface from an `eval --no-wait` hint.
697
+ * Exported for tests.
698
+ */
699
+ export function formatEvalStatusFlags(options) {
700
+ const parts = [];
701
+ if (options.url !== undefined) {
702
+ parts.push(`--url ${options.url.replace(/\/$/, "")}`);
703
+ }
704
+ else {
705
+ parts.push("--prod");
706
+ if (options.slug !== undefined && options.slug !== "") {
707
+ parts.push(`--slug ${options.slug}`);
708
+ }
709
+ }
710
+ if (options.team !== undefined && options.team !== "") {
711
+ parts.push(`--team ${options.team}`);
712
+ }
713
+ return parts.length === 0 ? "" : ` ${parts.join(" ")}`;
714
+ }
715
+ /** `--no-wait`: print the accepted batch id (and how to poll) then exit. */
716
+ function printEvalAccepted(started, options, agentUrl) {
717
+ const pollPath = `${agentUrl.replace(/\/$/, "")}/v1/dev/evals/runs/${started.runId}`;
718
+ const statusFlags = formatEvalStatusFlags(options);
719
+ if (options.json) {
720
+ console.log(JSON.stringify({
721
+ ok: true,
722
+ accepted: true,
723
+ runId: started.runId,
724
+ status: started.status,
725
+ summary: started.summary,
726
+ pollUrl: pollPath,
727
+ durableRuns: started.config.durableRuns === true,
728
+ }, null, 2));
729
+ }
730
+ else {
731
+ const durable = started.config.durableRuns === true ? " (persisted)" : "";
732
+ process.stdout.write(`Accepted eval run ${started.runId}${durable} — ${started.summary.total} case(s)\n`);
733
+ process.stdout.write(`Status: ${CLI_COMMAND_NAME} eval status ${started.runId}${statusFlags}\n`);
734
+ process.stdout.write(`Poll: ${pollPath}\n`);
735
+ }
736
+ return 0;
737
+ }
738
+ /**
739
+ * `eval status [runId]` — fetch one batch (or list recent) on the deployment /
740
+ * `--url` target. Exit `0` when the batch is completed with all cases passing,
741
+ * `1` when failed / any case failed / unknown, `2` for usage errors, `3` when
742
+ * the batch is still running (for poll loops after `--no-wait`).
743
+ */
744
+ export function cmdEvalStatus(runId, options) {
745
+ return __awaiter(this, void 0, void 0, function* () {
746
+ const mode = resolveEvalTargetMode(options);
747
+ if (typeof mode === "object") {
748
+ process.stderr.write(`${mode.error}\n`);
749
+ return 2;
750
+ }
751
+ if (mode === "local") {
752
+ process.stderr.write("eval status requires --prod or --url (not the default local target)\n");
753
+ return 2;
754
+ }
755
+ if (options.list === true || options.noWait === true) {
756
+ process.stderr.write("eval status does not accept --list or --no-wait\n");
757
+ return 2;
758
+ }
759
+ const target = yield resolveEvalTarget(options);
760
+ if (typeof target === "number") {
761
+ return target;
762
+ }
763
+ const auth = {
764
+ bearerToken: options.bearerToken,
765
+ headers: target.headers,
766
+ };
767
+ try {
768
+ if (runId === undefined || runId === "") {
769
+ const { runs, activeRunId } = yield listRemoteEvalRuns({
770
+ baseUrl: target.agentUrl,
771
+ auth,
772
+ fetchImpl: options.fetchImpl,
773
+ });
774
+ if (options.json) {
775
+ console.log(JSON.stringify({ runs, activeRunId }, null, 2));
776
+ }
777
+ else if (runs.length === 0) {
778
+ process.stdout.write("No eval runs on this agent.\n");
779
+ }
780
+ else {
781
+ if (activeRunId !== undefined) {
782
+ process.stdout.write(`active: ${activeRunId}\n`);
783
+ }
784
+ for (const run of runs) {
785
+ process.stdout.write(`${formatEvalRunSummaryLine(run)}\n`);
786
+ }
787
+ }
788
+ return 0;
789
+ }
790
+ const snap = yield getRemoteEvalRun({
589
791
  baseUrl: target.agentUrl,
590
- filterIds: options.evalIds === undefined || options.evalIds.length === 0
591
- ? undefined
592
- : options.evalIds,
593
- tags: options.tags === undefined || options.tags.length === 0
594
- ? undefined
595
- : options.tags,
596
- timeoutMs: options.timeoutMs,
597
- bearerToken: options.bearerToken,
598
- headers: target.headers,
599
- verbose: Boolean(options.verbose) || stream,
600
- onEvent: progress === undefined ? undefined : (e) => progress.onEvent(e),
792
+ runId,
793
+ auth,
794
+ fetchImpl: options.fetchImpl,
601
795
  });
602
- if (results.length === 0) {
603
- process.stderr.write("No matching evals found.\n");
604
- return 2;
796
+ if (options.json) {
797
+ console.log(JSON.stringify(snap, null, 2));
798
+ }
799
+ else {
800
+ process.stdout.write(`${formatEvalRunSummaryLine(snap)}\n`);
801
+ if (snap.error !== undefined && snap.error !== "") {
802
+ process.stdout.write(`error: ${snap.error}\n`);
803
+ }
804
+ for (const c of snap.cases) {
805
+ const mark = c.status !== "done" ? c.status : c.ok === true ? "PASS" : "FAIL";
806
+ const dur = c.durationMs === undefined
807
+ ? ""
808
+ : ` (${(c.durationMs / 1000).toFixed(1)}s)`;
809
+ process.stdout.write(` ${mark} ${c.id}${dur}\n`);
810
+ if (c.error !== undefined && c.error !== "") {
811
+ process.stdout.write(` error: ${c.error}\n`);
812
+ }
813
+ }
814
+ }
815
+ if (snap.status === "running") {
816
+ return 3;
605
817
  }
606
- return printEvalResults(results, options);
818
+ const failed = snap.status === "failed" || snap.cases.some((c) => c.ok !== true);
819
+ return failed ? 1 : 0;
820
+ }
821
+ catch (error) {
822
+ process.stderr.write(`${sanitizeCustomerError(error instanceof Error ? error.message : String(error))}\n`);
823
+ return 1;
607
824
  }
608
825
  finally {
609
- progress === null || progress === void 0 ? void 0 : progress.close();
610
826
  if (target.close !== undefined) {
611
827
  yield target.close();
612
828
  }
613
829
  }
614
830
  });
615
831
  }
616
- function printEvalResults(results, options) {
832
+ function formatEvalRunSummaryLine(run) {
833
+ const { passed, failed, total, done } = run.summary;
834
+ const durable = run.config.durableRuns === true ? " persisted" : "";
835
+ return `${run.runId} ${run.status} ${done}/${total} done (${passed} passed, ${failed} failed)${durable}`;
836
+ }
837
+ function listLocalEvals(projectRoot, options, filterIds, tags) {
838
+ return __awaiter(this, void 0, void 0, function* () {
839
+ const { evals } = yield discoverEvals(projectRoot);
840
+ const listed = filterDiscoveredEvals(evals, { filterIds, tags });
841
+ return printListedEvals(listed.map((e) => { var _a; return ({
842
+ id: e.id,
843
+ fileId: e.fileId,
844
+ path: e.path,
845
+ description: e.definition.description,
846
+ tags: (_a = e.definition.tags) !== null && _a !== void 0 ? _a : [],
847
+ }); }), options, `No evals under ${projectRoot}/evals`);
848
+ });
849
+ }
850
+ function printListedEvals(listed, options, emptyMessage) {
851
+ if (options.json) {
852
+ console.log(JSON.stringify(listed, null, 2));
853
+ }
854
+ else if (listed.length === 0) {
855
+ process.stdout.write(`${emptyMessage}\n`);
856
+ }
857
+ else {
858
+ for (const e of listed) {
859
+ const tagSuffix = e.tags.length > 0 ? ` [${e.tags.join(", ")}]` : "";
860
+ const desc = e.description !== undefined ? ` — ${e.description}` : "";
861
+ process.stdout.write(`${e.id}${tagSuffix}${desc}\n`);
862
+ }
863
+ }
864
+ return 0;
865
+ }
866
+ /**
867
+ * Remote batches don't stream turn events to the CLI; print run/case progress
868
+ * (and case logs once they appear on the snapshot) instead.
869
+ */
870
+ function createRemoteEvalProgress(enabled) {
871
+ if (!enabled) {
872
+ return undefined;
873
+ }
874
+ let announced = false;
875
+ let lastSummaryKey = "";
876
+ const seenCaseKeys = new Set();
877
+ return {
878
+ onSnapshot(snap) {
879
+ var _a, _b;
880
+ if (!announced) {
881
+ announced = true;
882
+ const durable = snap.config.durableRuns === true ? " (persisted)" : "";
883
+ process.stderr.write(`eval run: ${snap.runId}${durable}\n`);
884
+ }
885
+ const summaryKey = `${snap.status}:${snap.summary.done}:${snap.summary.passed}:${snap.summary.failed}`;
886
+ if (summaryKey !== lastSummaryKey) {
887
+ lastSummaryKey = summaryKey;
888
+ const { done, total, passed, failed } = snap.summary;
889
+ process.stderr.write(`eval progress: ${done}/${total} done (${passed} passed, ${failed} failed) [${snap.status}]\n`);
890
+ }
891
+ for (const c of snap.cases) {
892
+ if (c.status !== "done") {
893
+ continue;
894
+ }
895
+ const caseKey = `${c.id}:${c.ok === true ? "pass" : "fail"}:${(_a = c.durationMs) !== null && _a !== void 0 ? _a : 0}`;
896
+ if (seenCaseKeys.has(caseKey)) {
897
+ continue;
898
+ }
899
+ seenCaseKeys.add(caseKey);
900
+ process.stderr.write(` eval ${c.id}: ${c.ok === true ? "PASS" : "FAIL"}${c.error !== undefined ? ` — ${c.error}` : ""}\n`);
901
+ for (const line of (_b = c.logs) !== null && _b !== void 0 ? _b : []) {
902
+ process.stderr.write(` ${line}\n`);
903
+ }
904
+ }
905
+ },
906
+ };
907
+ }
908
+ function printEvalResults(results, options, batch) {
617
909
  const passed = results.filter((r) => r.ok).length;
618
910
  const failed = results.length - passed;
911
+ const batchFailed = (batch === null || batch === void 0 ? void 0 : batch.status) === "failed";
912
+ const ok = failed === 0 && !batchFailed;
913
+ if ((batch === null || batch === void 0 ? void 0 : batch.error) !== undefined && batch.error !== "" && !options.json) {
914
+ // Always surface harness-level failures (not only --verbose).
915
+ process.stderr.write(`eval run error: ${batch.error}\n`);
916
+ }
619
917
  if (options.json) {
620
- console.log(JSON.stringify({ ok: failed === 0, passed, failed, results }, null, 2));
918
+ console.log(JSON.stringify(Object.assign(Object.assign(Object.assign({ ok,
919
+ passed,
920
+ failed,
921
+ results }, ((batch === null || batch === void 0 ? void 0 : batch.runId) === undefined ? {} : { runId: batch.runId })), ((batch === null || batch === void 0 ? void 0 : batch.status) === undefined ? {} : { status: batch.status })), ((batch === null || batch === void 0 ? void 0 : batch.error) === undefined || batch.error === ""
922
+ ? {}
923
+ : { error: batch.error })), null, 2));
621
924
  }
622
925
  else {
623
926
  for (const r of results) {
@@ -638,7 +941,7 @@ function printEvalResults(results, options) {
638
941
  }
639
942
  process.stdout.write(`\n${passed} passed, ${failed} failed, ${results.length} total\n`);
640
943
  }
641
- return failed === 0 ? 0 : 1;
944
+ return ok ? 0 : 1;
642
945
  }
643
946
  /**
644
947
  * `logs` — follow deploy progress (`--prod`) then runtime agent logs.
@@ -0,0 +1,64 @@
1
+ /**
2
+ * `agentkit mcp` — stdio ↔ streamable-HTTP proxy for an agent's MCP endpoint.
3
+ *
4
+ * Every served agent is an MCP server at `<base>/v1/mcp` (hosted deployments
5
+ * run in single mode, so the endpoint sits directly on the engine base URL).
6
+ * MCP clients that spawn stdio servers (Cursor, Claude Code, …) can reach it
7
+ * through this command: newline-delimited JSON-RPC on stdin/stdout, one POST
8
+ * per message to the remote endpoint.
9
+ *
10
+ * Targets:
11
+ * - `--prod [--slug <slug>]` — the team's hosted deployment. Short-lived
12
+ * `engineAccess` credentials are minted through the management API with the
13
+ * signed-in Cursor account, re-minted near expiry and once on auth-shaped
14
+ * failures. No durable secret ever lands in a config file.
15
+ * - `--url <baseUrl>` — a running server (local `serve` mount or self-hosted
16
+ * base URL), with optional `--bearer-token`.
17
+ *
18
+ * `agentkit mcp install` writes the matching entry into `~/.cursor/mcp.json`
19
+ * so the agent shows up as an MCP server in Cursor:
20
+ *
21
+ * { "mcpServers": { "weather-agent": {
22
+ * "command": "agentkit",
23
+ * "args": ["mcp", "--prod", "--slug", "weather-agent"] } } }
24
+ *
25
+ * stdout is reserved for the MCP wire in serve mode; all logging goes to
26
+ * stderr.
27
+ */
28
+ import { resolveProdTarget } from "./resolve-prod-target.js";
29
+ export interface McpCliOptions {
30
+ dir: string;
31
+ cwd?: string;
32
+ /** Hosted deployment slug (with `--prod`); defaults to the `--dir` basename. */
33
+ slug?: string;
34
+ team?: string;
35
+ apiKey?: string;
36
+ /** Base URL of a running agent (mutually exclusive with `--prod`). */
37
+ url?: string;
38
+ prod?: boolean;
39
+ bearerToken?: string;
40
+ /** `install`: server name for the mcp.json entry (defaults to the slug). */
41
+ name?: string;
42
+ /** `install`: print the entry instead of writing ~/.cursor/mcp.json. */
43
+ print?: boolean;
44
+ /** `install`: machine-readable output. */
45
+ json?: boolean;
46
+ /** Injected seams for tests. */
47
+ fetchImpl?: typeof fetch;
48
+ resolveProdTargetImpl?: typeof resolveProdTarget;
49
+ stdin?: NodeJS.ReadableStream;
50
+ stdout?: {
51
+ write(chunk: string): unknown;
52
+ };
53
+ err?: (text: string) => void;
54
+ now?: () => number;
55
+ sleep?: (ms: number) => Promise<void>;
56
+ }
57
+ export declare function cmdMcp(subcommand: string | undefined, options: McpCliOptions): Promise<number>;
58
+ export declare function cmdMcpServe(options: McpCliOptions): Promise<number>;
59
+ export declare function cmdMcpInstall(options: McpCliOptions): Promise<number>;
60
+ /** `~/.cursor/mcp.json` — the user-level Cursor MCP config. */
61
+ export declare function cursorMcpJsonPath(home?: string): string;
62
+ /** Agent base URL → MCP endpoint URL (idempotent when already pointed at it). */
63
+ export declare function joinMcpPath(baseUrl: string): string;
64
+ //# sourceMappingURL=cli-mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-mcp.d.ts","sourceRoot":"","sources":["../../src/internal/cli-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAMH,OAAO,EAGL,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AA0BlC,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gCAAgC;IAChC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,iBAAiB,CAAC;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC9B,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC3C,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,wBAAsB,MAAM,CAC1B,UAAU,EAAE,MAAM,G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