@cursor/july 0.1.62 → 0.1.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/AGENTS.md +4 -5
  2. package/README.md +23 -11
  3. package/dist/bin/agent-serve.js +11 -2
  4. package/dist/channels/github/api.d.ts +2 -0
  5. package/dist/channels/github/api.d.ts.map +1 -1
  6. package/dist/channels/github/api.js +2 -1
  7. package/dist/channels/github/binding.d.ts +7 -0
  8. package/dist/channels/github/binding.d.ts.map +1 -1
  9. package/dist/channels/github/binding.js +4 -0
  10. package/dist/channels/github/checks.d.ts +99 -0
  11. package/dist/channels/github/checks.d.ts.map +1 -0
  12. package/dist/channels/github/checks.js +108 -0
  13. package/dist/channels/github/cursor-account.d.ts +4 -4
  14. package/dist/channels/github/cursor-account.d.ts.map +1 -1
  15. package/dist/channels/github/cursor-account.js +7 -5
  16. package/dist/channels/github/index.d.ts +1 -0
  17. package/dist/channels/github/index.d.ts.map +1 -1
  18. package/dist/channels/github/index.js +1 -0
  19. package/dist/channels/github/types.d.ts +8 -0
  20. package/dist/channels/github/types.d.ts.map +1 -1
  21. package/dist/channels/slack/channel-watch.d.ts +2 -1
  22. package/dist/channels/slack/channel-watch.d.ts.map +1 -1
  23. package/dist/channels/slack/channel-watch.js +7 -3
  24. package/dist/channels/slack/dispatch.d.ts +9 -0
  25. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  26. package/dist/channels/slack/dispatch.js +41 -21
  27. package/dist/channels/slack/manifest.d.ts +2 -2
  28. package/dist/channels/slack/manifest.d.ts.map +1 -1
  29. package/dist/channels/slack/manifest.js +14 -11
  30. package/dist/channels/slack/nudge-store.d.ts +16 -0
  31. package/dist/channels/slack/nudge-store.d.ts.map +1 -1
  32. package/dist/channels/slack/nudge-store.js +53 -0
  33. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  34. package/dist/channels/slack/slack-channel.js +4 -1
  35. package/dist/channels/slack/types.d.ts +24 -7
  36. package/dist/channels/slack/types.d.ts.map +1 -1
  37. package/dist/connections.d.ts +17 -5
  38. package/dist/connections.d.ts.map +1 -1
  39. package/dist/connections.js +17 -5
  40. package/dist/docs/404.html +2 -2
  41. package/dist/docs/ab.html +3 -3
  42. package/dist/docs/assets/{app.B-biogkN.js → app.CdbcFD8T.js} +1 -1
  43. package/dist/docs/assets/chunks/@localSearchIndexroot.DQad--_z.js +1 -0
  44. package/dist/docs/assets/chunks/{VPLocalSearchBox.DZqKtFZS.js → VPLocalSearchBox.D_NKImM7.js} +1 -1
  45. package/dist/docs/assets/chunks/{theme.BwC5zP2r.js → theme.CMvz7cu9.js} +2 -2
  46. package/dist/docs/assets/{concepts.md.CqOsxbMU.js → concepts.md.BXAm6G-C.js} +1 -1
  47. package/dist/docs/assets/{guides_mcp-oauth.md.C7G7IykG.js → guides_mcp-oauth.md.CzEB6RaG.js} +1 -1
  48. package/dist/docs/assets/{reference_agent-config.md.DHkkvcEZ.js → reference_agent-config.md.BZnEKfEc.js} +3 -4
  49. package/dist/docs/assets/{reference_agent-config.md.DHkkvcEZ.lean.js → reference_agent-config.md.BZnEKfEc.lean.js} +1 -1
  50. package/dist/docs/assets/{reference_connections.md.CSQiNzre.js → reference_connections.md.Cu3N-S3Q.js} +26 -9
  51. package/dist/docs/assets/reference_connections.md.Cu3N-S3Q.lean.js +1 -0
  52. package/dist/docs/assets/{reference_sessions.md.DBVFi2Sx.js → reference_sessions.md.B0DdlM-K.js} +1 -1
  53. package/dist/docs/assets/{reference_tools.md.kJfJAP2m.js → reference_tools.md.DTg_kEsx.js} +2 -2
  54. package/dist/docs/assets/{reference_tools.md.kJfJAP2m.lean.js → reference_tools.md.DTg_kEsx.lean.js} +1 -1
  55. package/dist/docs/assets/troubleshooting.md.DQ-hYuZT.js +1 -0
  56. package/dist/docs/building-with-agents.html +3 -3
  57. package/dist/docs/concepts.html +5 -5
  58. package/dist/docs/deployment.html +3 -3
  59. package/dist/docs/evals.html +3 -3
  60. package/dist/docs/example-agents/approval-buddy.html +3 -3
  61. package/dist/docs/example-agents/benny.html +3 -3
  62. package/dist/docs/example-agents/bugbot.html +3 -3
  63. package/dist/docs/example-agents/codebase-wiki.html +3 -3
  64. package/dist/docs/example-agents/codeowners-review.html +3 -3
  65. package/dist/docs/example-agents/concierge.html +3 -3
  66. package/dist/docs/example-agents/fsd.html +3 -3
  67. package/dist/docs/example-agents/index.html +3 -3
  68. package/dist/docs/example-agents/knowledge-base.html +3 -3
  69. package/dist/docs/example-agents/oncall.html +3 -3
  70. package/dist/docs/example-agents/security-reviewer.html +3 -3
  71. package/dist/docs/example-agents/slack-agent.html +3 -3
  72. package/dist/docs/example-agents/weather-agent.html +3 -3
  73. package/dist/docs/guides/agent-to-agent.html +3 -3
  74. package/dist/docs/guides/cloud-runtime.html +3 -3
  75. package/dist/docs/guides/convert-automation.html +3 -3
  76. package/dist/docs/guides/github.html +3 -3
  77. package/dist/docs/guides/human-in-the-loop.html +3 -3
  78. package/dist/docs/guides/mcp-oauth.html +5 -5
  79. package/dist/docs/guides/opentelemetry.html +3 -3
  80. package/dist/docs/guides/slack.html +3 -3
  81. package/dist/docs/guides/webhooks.html +3 -3
  82. package/dist/docs/hashmap.json +1 -1
  83. package/dist/docs/hillclimbing.html +3 -3
  84. package/dist/docs/index.html +3 -3
  85. package/dist/docs/quickstart.html +3 -3
  86. package/dist/docs/reference/agent-config.html +5 -6
  87. package/dist/docs/reference/artifacts.html +3 -3
  88. package/dist/docs/reference/channels.html +3 -3
  89. package/dist/docs/reference/cli.html +3 -3
  90. package/dist/docs/reference/connections.html +28 -11
  91. package/dist/docs/reference/hooks.html +3 -3
  92. package/dist/docs/reference/http-api.html +3 -3
  93. package/dist/docs/reference/instructions.html +3 -3
  94. package/dist/docs/reference/playground.html +3 -3
  95. package/dist/docs/reference/project-layout.html +3 -3
  96. package/dist/docs/reference/prompt.html +3 -3
  97. package/dist/docs/reference/schedules.html +3 -3
  98. package/dist/docs/reference/sessions.html +5 -5
  99. package/dist/docs/reference/skills.html +3 -3
  100. package/dist/docs/reference/subagents.html +3 -3
  101. package/dist/docs/reference/tools.html +5 -5
  102. package/dist/docs/scaffolding-agents.html +3 -3
  103. package/dist/docs/storage.html +3 -3
  104. package/dist/docs/templates/agentic-owners.html +3 -3
  105. package/dist/docs/templates/demo.html +3 -3
  106. package/dist/docs/templates/pr-autofixer.html +3 -3
  107. package/dist/docs/templates/security-reviewer.html +3 -3
  108. package/dist/docs/templates/triage.html +3 -3
  109. package/dist/docs/troubleshooting.html +5 -5
  110. package/dist/files-backends/agent-store-presigned-url.js +1 -1
  111. package/dist/index.d.ts +2 -2
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +1 -1
  114. package/dist/internal/advertise-tools.d.ts +79 -0
  115. package/dist/internal/advertise-tools.d.ts.map +1 -0
  116. package/dist/internal/advertise-tools.js +185 -0
  117. package/dist/internal/cli-deploy.d.ts.map +1 -1
  118. package/dist/internal/cli-deploy.js +7 -1
  119. package/dist/internal/cli-manifest.d.ts +19 -0
  120. package/dist/internal/cli-manifest.d.ts.map +1 -0
  121. package/dist/internal/cli-manifest.js +49 -0
  122. package/dist/internal/cli-slack.d.ts.map +1 -1
  123. package/dist/internal/cli-slack.js +9 -1
  124. package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -1
  125. package/dist/internal/convert-automation/convert-workflow.js +2 -10
  126. package/dist/internal/cursor/account-mcp.d.ts +29 -3
  127. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  128. package/dist/internal/cursor/account-mcp.js +147 -67
  129. package/dist/internal/cursor/backend-client.d.ts +11 -6
  130. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  131. package/dist/internal/cursor/backend-client.js +32 -10
  132. package/dist/internal/cursor-account-mcp-auth.d.ts +11 -0
  133. package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
  134. package/dist/internal/cursor-account-mcp-auth.js +69 -0
  135. package/dist/internal/cursor-agent-template.d.ts +9 -0
  136. package/dist/internal/cursor-agent-template.d.ts.map +1 -0
  137. package/dist/internal/cursor-agent-template.js +37 -0
  138. package/dist/internal/deploy-client.d.ts +1 -0
  139. package/dist/internal/deploy-client.d.ts.map +1 -1
  140. package/dist/internal/deploy-client.js +18 -2
  141. package/dist/internal/deploy-manifest.d.ts +76 -0
  142. package/dist/internal/deploy-manifest.d.ts.map +1 -0
  143. package/dist/internal/deploy-manifest.js +117 -0
  144. package/dist/internal/deployment-scm-event-stream.d.ts +116 -0
  145. package/dist/internal/deployment-scm-event-stream.d.ts.map +1 -0
  146. package/dist/internal/deployment-scm-event-stream.js +474 -0
  147. package/dist/internal/discovery.d.ts.map +1 -1
  148. package/dist/internal/discovery.js +111 -10
  149. package/dist/internal/init-project.d.ts.map +1 -1
  150. package/dist/internal/init-project.js +12 -123
  151. package/dist/internal/init-scaffold.d.ts +8 -0
  152. package/dist/internal/init-scaffold.d.ts.map +1 -0
  153. package/dist/internal/init-scaffold.js +168 -0
  154. package/dist/internal/inline-stdio-mcp.d.ts +2 -0
  155. package/dist/internal/inline-stdio-mcp.d.ts.map +1 -1
  156. package/dist/internal/inline-stdio-mcp.js +10 -8
  157. package/dist/internal/json-schema.d.ts +7 -0
  158. package/dist/internal/json-schema.d.ts.map +1 -1
  159. package/dist/internal/json-schema.js +18 -3
  160. package/dist/internal/mcp-endpoint.js +7 -7
  161. package/dist/internal/mcp-host.d.ts +18 -0
  162. package/dist/internal/mcp-host.d.ts.map +1 -1
  163. package/dist/internal/mcp-host.js +43 -5
  164. package/dist/internal/mcp-oauth.d.ts +22 -0
  165. package/dist/internal/mcp-oauth.d.ts.map +1 -1
  166. package/dist/internal/mcp-oauth.js +40 -1
  167. package/dist/internal/package-inline-stdio.d.ts.map +1 -1
  168. package/dist/internal/package-inline-stdio.js +5 -5
  169. package/dist/internal/review-comments.d.ts +97 -0
  170. package/dist/internal/review-comments.d.ts.map +1 -1
  171. package/dist/internal/review-comments.js +151 -0
  172. package/dist/internal/sanitize-mcp-tool-name.d.ts +20 -0
  173. package/dist/internal/sanitize-mcp-tool-name.d.ts.map +1 -0
  174. package/dist/internal/sanitize-mcp-tool-name.js +30 -0
  175. package/dist/internal/sdk-runner.d.ts +1 -1
  176. package/dist/internal/sdk-runner.d.ts.map +1 -1
  177. package/dist/internal/sdk-runner.js +36 -13
  178. package/dist/internal/server.d.ts.map +1 -1
  179. package/dist/internal/server.js +18 -0
  180. package/dist/internal/session-engine.d.ts +66 -0
  181. package/dist/internal/session-engine.d.ts.map +1 -1
  182. package/dist/internal/session-engine.js +428 -110
  183. package/dist/internal/shallow-clone.d.ts +170 -0
  184. package/dist/internal/shallow-clone.d.ts.map +1 -0
  185. package/dist/internal/shallow-clone.js +412 -0
  186. package/dist/internal/slack-provision-client.d.ts +2 -0
  187. package/dist/internal/slack-provision-client.d.ts.map +1 -1
  188. package/dist/internal/slack-provision-client.js +1 -0
  189. package/dist/internal/terminal-style.d.ts +18 -0
  190. package/dist/internal/terminal-style.d.ts.map +1 -1
  191. package/dist/internal/terminal-style.js +46 -1
  192. package/dist/internal/turn-lease-store.d.ts +44 -0
  193. package/dist/internal/turn-lease-store.d.ts.map +1 -0
  194. package/dist/internal/turn-lease-store.js +139 -0
  195. package/dist/internal/workspace.d.ts +14 -0
  196. package/dist/internal/workspace.d.ts.map +1 -1
  197. package/dist/internal/workspace.js +33 -0
  198. package/dist/playground/assets/index-77uhu5Kr.css +1 -0
  199. package/dist/playground/assets/index-D4buox4m.js +85 -0
  200. package/dist/playground/index.html +2 -2
  201. package/dist/storage-protocol.d.ts +122 -0
  202. package/dist/storage-protocol.d.ts.map +1 -0
  203. package/dist/storage-protocol.js +173 -0
  204. package/dist/storage.d.ts +2 -72
  205. package/dist/storage.d.ts.map +1 -1
  206. package/dist/storage.js +2 -82
  207. package/dist/tools.d.ts +7 -0
  208. package/dist/tools.d.ts.map +1 -1
  209. package/dist/types.d.ts +141 -6
  210. package/dist/types.d.ts.map +1 -1
  211. package/docs/concepts.md +4 -4
  212. package/docs/guides/mcp-oauth.md +3 -1
  213. package/docs/reference/agent-config.md +11 -12
  214. package/docs/reference/connections.md +108 -10
  215. package/docs/reference/sessions.md +2 -2
  216. package/docs/reference/tools.md +14 -0
  217. package/docs/troubleshooting.md +3 -2
  218. package/package.json +7 -2
  219. package/skills/create-agent/SKILL.md +12 -9
  220. package/skills/debug/SKILL.md +2 -1
  221. package/skills/framework-map/SKILL.md +6 -6
  222. package/skills/mcp-auth/SKILL.md +8 -6
  223. package/src/bin/agent-serve.ts +12 -2
  224. package/src/channels/github/api.ts +6 -1
  225. package/src/channels/github/binding.ts +21 -0
  226. package/src/channels/github/checks.ts +179 -0
  227. package/src/channels/github/cursor-account.ts +9 -6
  228. package/src/channels/github/index.ts +1 -0
  229. package/src/channels/github/types.ts +8 -0
  230. package/src/channels/slack/channel-watch.ts +6 -3
  231. package/src/channels/slack/dispatch.ts +40 -3
  232. package/src/channels/slack/manifest.ts +9 -10
  233. package/src/channels/slack/nudge-store.ts +56 -0
  234. package/src/channels/slack/slack-channel.ts +3 -0
  235. package/src/channels/slack/types.ts +24 -7
  236. package/src/connections.ts +17 -5
  237. package/src/index.ts +5 -0
  238. package/src/internal/advertise-tools.ts +278 -0
  239. package/src/internal/cli-deploy.ts +11 -1
  240. package/src/internal/cli-manifest.ts +63 -0
  241. package/src/internal/cli-slack.ts +10 -1
  242. package/src/internal/convert-automation/convert-workflow.ts +2 -11
  243. package/src/internal/cursor/account-mcp.ts +208 -73
  244. package/src/internal/cursor/backend-client.ts +45 -11
  245. package/src/internal/cursor-account-mcp-auth.ts +83 -0
  246. package/src/internal/cursor-agent-template.ts +46 -0
  247. package/src/internal/deploy-client.ts +25 -6
  248. package/src/internal/deploy-manifest.ts +161 -0
  249. package/src/internal/deployment-scm-event-stream.ts +593 -0
  250. package/src/internal/discovery.ts +132 -3
  251. package/src/internal/init-project.ts +18 -153
  252. package/src/internal/init-scaffold.ts +176 -0
  253. package/src/internal/inline-stdio-mcp.ts +13 -0
  254. package/src/internal/json-schema.ts +24 -3
  255. package/src/internal/mcp-endpoint.ts +6 -0
  256. package/src/internal/mcp-host.ts +70 -9
  257. package/src/internal/mcp-oauth.ts +55 -1
  258. package/src/internal/package-inline-stdio.ts +5 -1
  259. package/src/internal/review-comments.ts +245 -0
  260. package/src/internal/sanitize-mcp-tool-name.ts +33 -0
  261. package/src/internal/sdk-runner.ts +50 -11
  262. package/src/internal/server.ts +19 -0
  263. package/src/internal/session-engine.ts +392 -19
  264. package/src/internal/shallow-clone.ts +595 -0
  265. package/src/internal/slack-provision-client.ts +3 -0
  266. package/src/internal/terminal-style.ts +67 -1
  267. package/src/internal/turn-lease-store.ts +147 -0
  268. package/src/internal/workspace.ts +33 -0
  269. package/src/storage-protocol.ts +247 -0
  270. package/src/storage.ts +16 -110
  271. package/src/tools.ts +7 -0
  272. package/src/types.ts +149 -7
  273. package/templates/agentic-owners/agent/agent.ts +3 -0
  274. package/templates/demo/agent/agent.ts +3 -0
  275. package/templates/pr-autofixer/agent/lib/drive-schemas.ts +4 -1
  276. package/templates/security-reviewer/agent/agent.ts +3 -0
  277. package/templates/triage/agent/agent.ts +3 -0
  278. package/dist/docs/assets/chunks/@localSearchIndexroot.5ozYNf74.js +0 -1
  279. package/dist/docs/assets/reference_connections.md.CSQiNzre.lean.js +0 -1
  280. package/dist/docs/assets/troubleshooting.md.CuVztCKs.js +0 -1
  281. package/dist/playground/assets/index-B4rcOgeP.css +0 -1
  282. package/dist/playground/assets/index-DXcY42Jv.js +0 -85
  283. /package/dist/docs/assets/{concepts.md.CqOsxbMU.lean.js → concepts.md.BXAm6G-C.lean.js} +0 -0
  284. /package/dist/docs/assets/{guides_mcp-oauth.md.C7G7IykG.lean.js → guides_mcp-oauth.md.CzEB6RaG.lean.js} +0 -0
  285. /package/dist/docs/assets/{reference_sessions.md.DBVFi2Sx.lean.js → reference_sessions.md.B0DdlM-K.lean.js} +0 -0
  286. /package/dist/docs/assets/{troubleshooting.md.CuVztCKs.lean.js → troubleshooting.md.DQ-hYuZT.lean.js} +0 -0
package/src/types.ts CHANGED
@@ -347,9 +347,13 @@ export interface AgentLocalOptions {
347
347
  /**
348
348
  * Default local harness cwd parent. Absolute, or relative to the agent
349
349
  * project root. Each session uses `<cwd>/<sessionId>` unless a per-send
350
- * {@link SendMessageOptions.workspaceDir} overrides it. Prefer a path
351
- * outside large monorepos so Cursor `project` settings do not inherit
352
- * ambient `AGENTS.md` / `.cursor` rules.
350
+ * {@link SendMessageOptions.workspaceDir} overrides it.
351
+ *
352
+ * When omitted, a project nested in another git repo (a monorepo package)
353
+ * defaults to `~/.cache/agent-serve/<dir>` so Cursor does not load the
354
+ * enclosing checkout's AGENTS.md, rules, skills, or MCP servers. A
355
+ * standalone git root keeps the in-project session workspace. Point this
356
+ * at a checkout when the agent must inherit that tree.
353
357
  */
354
358
  cwd?: string;
355
359
  /**
@@ -428,7 +432,17 @@ export type ToolResultValue =
428
432
  */
429
433
  export type ToolExecuteResult =
430
434
  | ToolResultValue
431
- | { content: ToolResultContent[]; isError?: boolean };
435
+ | {
436
+ content: ToolResultContent[];
437
+ isError?: boolean;
438
+ /**
439
+ * Structured result for tools that declare an `outputSchema`: MCP
440
+ * clients require `structuredContent` on calls to schema-declaring
441
+ * tools. Plain-object returns get it filled in automatically; the
442
+ * envelope form (needed for images or `isError`) sets it here.
443
+ */
444
+ structuredContent?: JsonObject;
445
+ };
432
446
 
433
447
  /** Repo-agnostic GitHub client on the agent-serve host. */
434
448
  export interface HostGitHubClient {
@@ -456,6 +470,7 @@ export interface HostMcpToolInfo {
456
470
  name: string;
457
471
  description?: string;
458
472
  inputSchema?: JsonObject;
473
+ outputSchema?: JsonObject;
459
474
  }
460
475
 
461
476
  export interface HostMcpCallResult {
@@ -514,9 +529,11 @@ export interface HostContext {
514
529
  */
515
530
  reminders?: ReminderHostApi;
516
531
  /**
517
- * Slack ask-dedupe / optional nudge helpers. Always present on a live
518
- * {@link SessionEngine} host. Mid-turn nudge inject is not used; busy
519
- * Slack follow-ups coalesce and drain at turn boundaries.
532
+ * Slack ask-dedupe / nudge helpers. Always present on a live
533
+ * {@link SessionEngine} host. A busy Slack thread's follow-ups queue here
534
+ * and reach the running agent at its next tool boundary, via the workspace
535
+ * carrier hook; whatever the carrier does not reach in time still drains
536
+ * into the boundary turn, deduped by source ts.
520
537
  */
521
538
  slackNudges?: SlackNudgeHostApi;
522
539
  /**
@@ -859,6 +876,13 @@ export interface ToolConfig<TInput> {
859
876
  * JSON object.
860
877
  */
861
878
  inputSchema?: z.ZodType<TInput> | JsonSchemaObject;
879
+ /**
880
+ * JSON Schema for the tool's structured output (`Tool.outputSchema` from
881
+ * the MCP spec), as a zod schema (converted, never validated against) or a
882
+ * plain JSON Schema object. Advertised when declared and omitted
883
+ * otherwise — results are not validated against it.
884
+ */
885
+ outputSchema?: z.ZodTypeAny | JsonSchemaObject;
862
886
  /**
863
887
  * When true (or when the predicate returns true), the host parks the
864
888
  * in-flight tool call until a human approves or denies via
@@ -887,6 +911,7 @@ export interface ToolDefinition extends BrandedDefinition<"tool"> {
887
911
  readonly description: string;
888
912
  readonly execution?: ToolExecution;
889
913
  readonly inputSchema?: z.ZodTypeAny | JsonSchemaObject;
914
+ readonly outputSchema?: z.ZodTypeAny | JsonSchemaObject;
890
915
  readonly needsApproval?: ToolNeedsApproval<never>;
891
916
  readonly execute?: (
892
917
  input: never,
@@ -1034,6 +1059,8 @@ export function isSymbolicConnectionTransport(
1034
1059
  export type InlineStdioToolConfig = {
1035
1060
  description: string;
1036
1061
  inputSchema?: z.ZodTypeAny | JsonSchemaObject;
1062
+ /** Output JSON Schema (zod converted, never validated); advertised when declared. */
1063
+ outputSchema?: z.ZodTypeAny | JsonSchemaObject;
1037
1064
  execute: (input: JsonObject) => unknown | Promise<unknown>;
1038
1065
  };
1039
1066
 
@@ -1078,6 +1105,76 @@ export type ConnectionConfig = (
1078
1105
  * cloud-native account connectors provisioned by the platform.
1079
1106
  */
1080
1107
  hostOnly?: boolean;
1108
+ /**
1109
+ * Per-session auth: called at turn-build time with the session's
1110
+ * {@link SessionInfo}, returning headers merged over the transport's
1111
+ * static `headers` for that session's use of this connection. This is
1112
+ * how a multi-tenant agent injects the caller's identity — it derives
1113
+ * who the session is for host-side and mints a tenant-scoped
1114
+ * credential; the model never sees a tenant parameter and can never
1115
+ * choose the tenant.
1116
+ *
1117
+ * Derive the identity from durable session facts — `session.auth`,
1118
+ * `session.id`, or your channel's own session state. Do **not** key it
1119
+ * off `session.continuationKey`: the HTTP channel rotates the
1120
+ * continuation key after every accepted follow-up, so a tenant mapping
1121
+ * keyed on it silently breaks mid-conversation. (Channels that mint
1122
+ * stable, parseable tokens by design are the exception.)
1123
+ *
1124
+ * Works attached or advertised. Advertised connections
1125
+ * ({@link advertiseTools}) open per-operation clients with the
1126
+ * evaluated headers. Attached connections ride the turn's SDK
1127
+ * `mcpServers`, passed on every send rather than pinned on the cached
1128
+ * per-session agent handle, so every turn — follow-ups, reminder
1129
+ * wakes — runs on headers evaluated for that turn. The cost: when any
1130
+ * attached connection has `auth`, *all* of the agent's attached
1131
+ * connections are configured per send, so the harness opens fresh MCP
1132
+ * clients for them each turn (stdio servers respawn per turn — avoid
1133
+ * pairing an auth'd connection with a stateful stdio server), and
1134
+ * workspace prewarm omits auth'd connections rather than attaching
1135
+ * them without an identity.
1136
+ *
1137
+ * HTTP/SSE transports only, not combinable with `oauth: true`
1138
+ * (discovery rejects both). A callback that throws fails the turn: a
1139
+ * turn never silently runs without the connection's identity. Cloud
1140
+ * turns are refused (cloud-runtime agents fail discovery). `host.mcp`
1141
+ * calls from server tools keep the static headers only.
1142
+ */
1143
+ auth?: ConnectionAuthProvider;
1144
+ /**
1145
+ * Advertise this connection's tools by name instead of leaving them
1146
+ * behind the MCP meta-tools: at turn-build time the engine lists the
1147
+ * connection's tools and synthesizes a named 1:1 passthrough server
1148
+ * tool per entry — the server's own names, descriptions, and live
1149
+ * schemas — merged into the authored `agent/tools/` catalog. The raw
1150
+ * connection is then not attached to the model (it stays available on
1151
+ * `host.mcp`), so each tool appears exactly once.
1152
+ *
1153
+ * Fail-closed: a `listTools` failure, an invalid tool name, or a name
1154
+ * collision (with an authored tool or another advertised connection)
1155
+ * fails the turn — a turn never silently runs with a shrunken toolset.
1156
+ * Local runtime only, like all server tools: a `runtime: "cloud"` agent
1157
+ * fails discovery, and hybrid per-send cloud sessions refuse the turn.
1158
+ * Not combinable with {@link hostOnly} (advertising puts the tools in
1159
+ * the model's toolset; hostOnly means off the model — discovery rejects
1160
+ * the pair). The listing runs once per turn; point this at endpoints
1161
+ * that can answer `tools/list` cheaply.
1162
+ */
1163
+ advertiseTools?: boolean;
1164
+ };
1165
+
1166
+ /**
1167
+ * Per-session connection auth on {@link ConnectionConfig.auth}: session →
1168
+ * headers merged over the transport's static headers for that session's
1169
+ * turns. See the field docs for the fail-closed semantics.
1170
+ */
1171
+ export type ConnectionAuthProvider = (
1172
+ session: SessionInfo
1173
+ ) => ConnectionAuthResult | Promise<ConnectionAuthResult>;
1174
+
1175
+ /** What a {@link ConnectionAuthProvider} returns. */
1176
+ export type ConnectionAuthResult = {
1177
+ headers: Record<string, string>;
1081
1178
  };
1082
1179
 
1083
1180
  /** True when the connection authors tools instead of a spawn/URL/peer. */
@@ -1271,7 +1368,27 @@ export type SessionEventPayload =
1271
1368
  type: "turn.completed";
1272
1369
  data: { result?: string; usage?: TurnUsage; cost?: TurnCost };
1273
1370
  }
1371
+ | {
1372
+ /**
1373
+ * The harness accepted the turn and named the run. Emitted once the
1374
+ * send lands, so a channel can show the request id while the turn is
1375
+ * still going rather than after it. Quote it verbatim when correlating
1376
+ * with backend logs — never abbreviated.
1377
+ */
1378
+ type: "turn.bound";
1379
+ data: { requestId: string };
1380
+ }
1274
1381
  | { type: "turn.failed"; data: { message: string } }
1382
+ | {
1383
+ /**
1384
+ * A Slack follow-up queued mid-turn reached the running agent: the
1385
+ * workspace carrier moved it from `pending/` to `delivered/` at a tool
1386
+ * boundary. Channels use this to reposition a live progress message
1387
+ * below the follow-up, which Slack cannot do any other way.
1388
+ */
1389
+ type: "nudge.delivered";
1390
+ data: Record<string, never>;
1391
+ }
1275
1392
  | { type: "session.waiting"; data: Record<string, never> }
1276
1393
  | { type: "session.completed"; data: Record<string, never> }
1277
1394
  | { type: "session.failed"; data: { message: string } };
@@ -2356,6 +2473,8 @@ export interface DiscoveredTool {
2356
2473
  description: string;
2357
2474
  /** JSON Schema advertised to the model. */
2358
2475
  inputSchema: JsonSchemaObject;
2476
+ /** Output JSON Schema, advertised only when the tool declares one. */
2477
+ outputSchema?: JsonSchemaObject;
2359
2478
  /** Where the tool body runs. Defaults to `"server"`. */
2360
2479
  execution: ToolExecution;
2361
2480
  /**
@@ -2388,6 +2507,10 @@ export interface DiscoveredConnection {
2388
2507
  transport: ConnectionTransport;
2389
2508
  description?: string;
2390
2509
  hostOnly?: boolean;
2510
+ /** Per-session auth from {@link ConnectionConfig.auth} (http/sse only). */
2511
+ auth?: ConnectionAuthProvider;
2512
+ /** Advertise-by-name from {@link ConnectionConfig.advertiseTools}. */
2513
+ advertiseTools?: boolean;
2391
2514
  }
2392
2515
 
2393
2516
  export interface DiscoveredChannel {
@@ -2533,6 +2656,7 @@ export interface AgentProjectInfo {
2533
2656
  name: string;
2534
2657
  transport: string;
2535
2658
  hostOnly?: boolean;
2659
+ advertiseTools?: boolean;
2536
2660
  /**
2537
2661
  * Present only for `cursorAccount` connections: the connector-name
2538
2662
  * allowlist, or `"*"` for every connected server. Structured twin of the
@@ -2624,10 +2748,28 @@ export interface RunnerTurnRequest {
2624
2748
  customTools: Record<string, SDKCustomTool>;
2625
2749
  /** MCP servers from `agent/mcp-connections/`. */
2626
2750
  mcpServers: Record<string, ConnectionTransport>;
2751
+ /**
2752
+ * Configure {@link mcpServers} on every send instead of once on the
2753
+ * cached SDK agent handle. Set when an attached connection has
2754
+ * per-session `auth`: its headers are re-evaluated at turn-build time,
2755
+ * and a handle-pinned copy would keep the first turn's credentials until
2756
+ * the handle recycles. The SDK builds the send's MCP session from exactly
2757
+ * this set (fresh clients each turn — stdio servers respawn per turn),
2758
+ * and the create/resume/prewarm options carry no `mcpServers` at all, so
2759
+ * the local executor cache key stays stable while credentials rotate.
2760
+ * Local runtime only; cloud turns with such connections are refused.
2761
+ */
2762
+ perSendMcpServers?: boolean;
2627
2763
  subagents: RunnerSubagent[];
2628
2764
  onUpdate: (update: RunnerUpdate) => void | Promise<void>;
2629
2765
  /** Called once the SDK agent is open so the engine can persist its id. */
2630
2766
  onSdkAgentId?: (sdkAgentId: string) => void | Promise<void>;
2767
+ /**
2768
+ * Called once the harness names the run, before it produces anything.
2769
+ * Surfaces the request id while the turn is still running rather than at
2770
+ * its end.
2771
+ */
2772
+ onRequestId?: (requestId: string) => void | Promise<void>;
2631
2773
  /**
2632
2774
  * Abort the in-flight run when signalled. The engine aborts this when a
2633
2775
  * follow-up message preempts the current turn; the runner maps it to
@@ -1,3 +1,5 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
1
3
  import { defineAgent } from "@cursor/july";
2
4
 
3
5
  export default defineAgent({
@@ -11,5 +13,6 @@ export default defineAgent({
11
13
  tools: ["read", "grep", "glob", "ls"],
12
14
  local: {
13
15
  sandbox: true,
16
+ cwd: join(homedir(), ".cache", "agent-serve", "agentic-owners"),
14
17
  },
15
18
  });
@@ -1,3 +1,5 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
1
3
  import { defineAgent } from "@cursor/july";
2
4
 
3
5
  export default defineAgent({
@@ -11,5 +13,6 @@ export default defineAgent({
11
13
  tools: ["read", "grep"],
12
14
  local: {
13
15
  sandbox: true,
16
+ cwd: join(homedir(), ".cache", "agent-serve", "demo"),
14
17
  },
15
18
  });
@@ -1,6 +1,9 @@
1
1
  import { z } from "zod";
2
2
 
3
- export const driveStartBodySchema = z.object({
3
+ export const driveStartBodySchema: z.ZodObject<{
4
+ pr: z.ZodString;
5
+ hint: z.ZodOptional<z.ZodString>;
6
+ }> = z.object({
4
7
  pr: z
5
8
  .string()
6
9
  .describe(
@@ -1,3 +1,5 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
1
3
  import { defineAgent } from "@cursor/july";
2
4
 
3
5
  export default defineAgent({
@@ -11,5 +13,6 @@ export default defineAgent({
11
13
  tools: ["read", "grep"],
12
14
  local: {
13
15
  sandbox: true,
16
+ cwd: join(homedir(), ".cache", "agent-serve", "security-reviewer"),
14
17
  },
15
18
  });
@@ -1,3 +1,5 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
1
3
  import { defineAgent } from "@cursor/july";
2
4
 
3
5
  export default defineAgent({
@@ -11,5 +13,6 @@ export default defineAgent({
11
13
  tools: ["read", "grep", "glob", "ls"],
12
14
  local: {
13
15
  sandbox: true,
16
+ cwd: join(homedir(), ".cache", "agent-serve", "triage"),
14
17
  },
15
18
  });