@cursor/july 0.1.2 → 0.1.3

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 (174) hide show
  1. package/AGENTS.md +16 -5
  2. package/README.md +8 -9
  3. package/dist/bin/agent-serve.d.ts +3 -1
  4. package/dist/bin/agent-serve.d.ts.map +1 -1
  5. package/dist/bin/agent-serve.js +389 -152
  6. package/dist/docs/404.html +2 -2
  7. package/dist/docs/ab.html +3 -3
  8. package/dist/docs/assets/{app.Oje4vhlk.js → app.BR0RbIdx.js} +1 -1
  9. package/dist/docs/assets/chunks/@localSearchIndexroot.DtIOQzGj.js +1 -0
  10. package/dist/docs/assets/chunks/{VPLocalSearchBox.H5XZ2zCB.js → VPLocalSearchBox.qjsVTneI.js} +1 -1
  11. package/dist/docs/assets/chunks/{theme.CTR_TuaE.js → theme.2Kg8jIp_.js} +2 -2
  12. package/dist/docs/assets/{quickstart.md.CfU8_uTC.js → quickstart.md.BU6Iwi_9.js} +18 -6
  13. package/dist/docs/assets/{reference_cli.md.DA730zCu.js → reference_cli.md.Bv6pOxcF.js} +11 -6
  14. package/dist/docs/assets/{reference_cli.md.DA730zCu.lean.js → reference_cli.md.Bv6pOxcF.lean.js} +1 -1
  15. package/dist/docs/building-with-agents.html +3 -3
  16. package/dist/docs/concepts.html +3 -3
  17. package/dist/docs/deployment.html +3 -3
  18. package/dist/docs/evals.html +3 -3
  19. package/dist/docs/guides/agent-to-agent.html +3 -3
  20. package/dist/docs/guides/cloud-runtime.html +3 -3
  21. package/dist/docs/guides/github.html +3 -3
  22. package/dist/docs/guides/human-in-the-loop.html +3 -3
  23. package/dist/docs/guides/slack.html +3 -3
  24. package/dist/docs/guides/webhooks.html +3 -3
  25. package/dist/docs/hashmap.json +1 -1
  26. package/dist/docs/hillclimbing.html +3 -3
  27. package/dist/docs/index.html +3 -3
  28. package/dist/docs/quickstart.html +22 -10
  29. package/dist/docs/reference/agent-config.html +3 -3
  30. package/dist/docs/reference/channels.html +3 -3
  31. package/dist/docs/reference/cli.html +14 -9
  32. package/dist/docs/reference/connections.html +3 -3
  33. package/dist/docs/reference/hooks.html +3 -3
  34. package/dist/docs/reference/http-api.html +3 -3
  35. package/dist/docs/reference/instructions.html +3 -3
  36. package/dist/docs/reference/playground.html +3 -3
  37. package/dist/docs/reference/project-layout.html +3 -3
  38. package/dist/docs/reference/schedules.html +3 -3
  39. package/dist/docs/reference/sessions.html +3 -3
  40. package/dist/docs/reference/skills.html +3 -3
  41. package/dist/docs/reference/subagents.html +3 -3
  42. package/dist/docs/reference/tools.html +3 -3
  43. package/dist/docs/scaffolding-agents.html +3 -3
  44. package/dist/docs/storage.html +3 -3
  45. package/dist/docs/troubleshooting.html +3 -3
  46. package/dist/internal/chat-client.d.ts +29 -3
  47. package/dist/internal/chat-client.d.ts.map +1 -1
  48. package/dist/internal/chat-client.js +180 -27
  49. package/dist/internal/cli-ax.d.ts +75 -2
  50. package/dist/internal/cli-ax.d.ts.map +1 -1
  51. package/dist/internal/cli-ax.js +600 -52
  52. package/dist/internal/cli-cursor.d.ts.map +1 -1
  53. package/dist/internal/cli-cursor.js +8 -36
  54. package/dist/internal/cli-deploy.d.ts +59 -3
  55. package/dist/internal/cli-deploy.d.ts.map +1 -1
  56. package/dist/internal/cli-deploy.js +316 -38
  57. package/dist/internal/cursor/credentials.d.ts +9 -0
  58. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  59. package/dist/internal/cursor/credentials.js +12 -0
  60. package/dist/internal/deploy-client.d.ts +9 -1
  61. package/dist/internal/deploy-client.d.ts.map +1 -1
  62. package/dist/internal/deploy-client.js +23 -3
  63. package/dist/internal/deploy-source.d.ts +35 -0
  64. package/dist/internal/deploy-source.d.ts.map +1 -0
  65. package/dist/internal/deploy-source.js +118 -0
  66. package/dist/internal/discovery.d.ts +11 -0
  67. package/dist/internal/discovery.d.ts.map +1 -1
  68. package/dist/internal/discovery.js +43 -14
  69. package/dist/internal/eval-run-store.d.ts.map +1 -1
  70. package/dist/internal/eval-run-store.js +2 -1
  71. package/dist/internal/eval-runner.d.ts +2 -0
  72. package/dist/internal/eval-runner.d.ts.map +1 -1
  73. package/dist/internal/eval-runner.js +2 -0
  74. package/dist/internal/event-mapper.d.ts +54 -1
  75. package/dist/internal/event-mapper.d.ts.map +1 -1
  76. package/dist/internal/event-mapper.js +151 -41
  77. package/dist/internal/init-project.d.ts +88 -1
  78. package/dist/internal/init-project.d.ts.map +1 -1
  79. package/dist/internal/init-project.js +221 -31
  80. package/dist/internal/install-cursor-skills.d.ts +64 -0
  81. package/dist/internal/install-cursor-skills.d.ts.map +1 -0
  82. package/dist/internal/install-cursor-skills.js +274 -0
  83. package/dist/internal/logs-client.d.ts +60 -0
  84. package/dist/internal/logs-client.d.ts.map +1 -0
  85. package/dist/internal/logs-client.js +311 -0
  86. package/dist/internal/open-browser.d.ts +5 -0
  87. package/dist/internal/open-browser.d.ts.map +1 -0
  88. package/dist/internal/open-browser.js +34 -0
  89. package/dist/internal/playground/toolchain.d.ts.map +1 -1
  90. package/dist/internal/playground/toolchain.js +16 -11
  91. package/dist/internal/playground-proxy.d.ts +69 -0
  92. package/dist/internal/playground-proxy.d.ts.map +1 -0
  93. package/dist/internal/playground-proxy.js +468 -0
  94. package/dist/internal/prompt-context.d.ts +35 -0
  95. package/dist/internal/prompt-context.d.ts.map +1 -0
  96. package/dist/internal/prompt-context.js +71 -0
  97. package/dist/internal/request-headers.d.ts +11 -0
  98. package/dist/internal/request-headers.d.ts.map +1 -0
  99. package/dist/internal/request-headers.js +14 -0
  100. package/dist/internal/resolve-prod-target.d.ts +42 -0
  101. package/dist/internal/resolve-prod-target.d.ts.map +1 -0
  102. package/dist/internal/resolve-prod-target.js +111 -0
  103. package/dist/internal/run-client.d.ts +2 -2
  104. package/dist/internal/run-client.d.ts.map +1 -1
  105. package/dist/internal/run-client.js +38 -23
  106. package/dist/internal/server.d.ts.map +1 -1
  107. package/dist/internal/server.js +10 -4
  108. package/dist/internal/session-engine.d.ts +1 -1
  109. package/dist/internal/session-engine.d.ts.map +1 -1
  110. package/dist/internal/session-engine.js +21 -6
  111. package/dist/internal/sessions-client.d.ts +21 -0
  112. package/dist/internal/sessions-client.d.ts.map +1 -0
  113. package/dist/internal/sessions-client.js +168 -0
  114. package/dist/internal/stream-progress.d.ts.map +1 -1
  115. package/dist/internal/stream-progress.js +31 -3
  116. package/dist/internal/terminal-style.d.ts +22 -0
  117. package/dist/internal/terminal-style.d.ts.map +1 -0
  118. package/dist/internal/terminal-style.js +49 -0
  119. package/dist/internal/trajectory.d.ts +10 -5
  120. package/dist/internal/trajectory.d.ts.map +1 -1
  121. package/dist/internal/trajectory.js +82 -10
  122. package/dist/internal/workspace.d.ts +11 -0
  123. package/dist/internal/workspace.d.ts.map +1 -1
  124. package/dist/internal/workspace.js +38 -4
  125. package/dist/playground/assets/index-D-vo2lV_.css +1 -0
  126. package/dist/playground/assets/index-x60b9q2j.js +312 -0
  127. package/dist/playground/index.html +2 -2
  128. package/dist/types.d.ts +26 -1
  129. package/dist/types.d.ts.map +1 -1
  130. package/docs/quickstart.md +22 -7
  131. package/docs/reference/cli.md +51 -3
  132. package/package.json +3 -1
  133. package/skills/ab/SKILL.md +8 -8
  134. package/skills/create-agent/SKILL.md +28 -22
  135. package/skills/debug/SKILL.md +11 -11
  136. package/skills/evals/SKILL.md +16 -16
  137. package/skills/framework-map/SKILL.md +6 -6
  138. package/skills/github/SKILL.md +13 -13
  139. package/skills/hillclimb/SKILL.md +10 -10
  140. package/skills/setup-slack/SKILL.md +13 -13
  141. package/src/bin/agent-serve.ts +422 -188
  142. package/src/internal/chat-client.ts +252 -37
  143. package/src/internal/cli-ax.ts +722 -72
  144. package/src/internal/cli-cursor.ts +14 -42
  145. package/src/internal/cli-deploy.ts +428 -49
  146. package/src/internal/cursor/credentials.ts +14 -0
  147. package/src/internal/deploy-client.ts +45 -4
  148. package/src/internal/deploy-source.ts +133 -0
  149. package/src/internal/discovery.ts +53 -16
  150. package/src/internal/eval-run-store.ts +2 -1
  151. package/src/internal/eval-runner.ts +5 -0
  152. package/src/internal/event-mapper.ts +222 -42
  153. package/src/internal/init-project.ts +333 -51
  154. package/src/internal/install-cursor-skills.ts +327 -0
  155. package/src/internal/logs-client.ts +442 -0
  156. package/src/internal/open-browser.ts +41 -0
  157. package/src/internal/playground/toolchain.ts +15 -13
  158. package/src/internal/playground-proxy.ts +576 -0
  159. package/src/internal/prompt-context.ts +95 -0
  160. package/src/internal/request-headers.ts +23 -0
  161. package/src/internal/resolve-prod-target.ts +150 -0
  162. package/src/internal/run-client.ts +39 -36
  163. package/src/internal/server.ts +12 -3
  164. package/src/internal/session-engine.ts +22 -3
  165. package/src/internal/sessions-client.ts +182 -0
  166. package/src/internal/stream-progress.ts +36 -2
  167. package/src/internal/terminal-style.ts +74 -0
  168. package/src/internal/trajectory.ts +91 -13
  169. package/src/internal/workspace.ts +42 -4
  170. package/src/types.ts +42 -6
  171. package/dist/docs/assets/chunks/@localSearchIndexroot.zwQ9RCQ7.js +0 -1
  172. package/dist/playground/assets/index-B1Qc9h2u.css +0 -1
  173. package/dist/playground/assets/index-CpDYCj8W.js +0 -79
  174. /package/dist/docs/assets/{quickstart.md.CfU8_uTC.lean.js → quickstart.md.BU6Iwi_9.lean.js} +0 -0
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Tiny ANSI helpers for CLI progress output. Respects `NO_COLOR` and
3
+ * only enables when the target stream is a TTY.
4
+ */
5
+
6
+ import { clearScreenDown, cursorTo } from "node:readline";
7
+
8
+ export interface TerminalPalette {
9
+ dim: (s: string) => string;
10
+ bold: (s: string) => string;
11
+ cyan: (s: string) => string;
12
+ green: (s: string) => string;
13
+ red: (s: string) => string;
14
+ magenta: (s: string) => string;
15
+ yellow: (s: string) => string;
16
+ }
17
+
18
+ const IDENTITY = (s: string): string => s;
19
+
20
+ const PLAIN: TerminalPalette = {
21
+ dim: IDENTITY,
22
+ bold: IDENTITY,
23
+ cyan: IDENTITY,
24
+ green: IDENTITY,
25
+ red: IDENTITY,
26
+ magenta: IDENTITY,
27
+ yellow: IDENTITY,
28
+ };
29
+
30
+ export function colorEnabledFor(
31
+ stream: NodeJS.WriteStream = process.stdout
32
+ ): boolean {
33
+ return stream.isTTY === true && process.env.NO_COLOR === undefined;
34
+ }
35
+
36
+ export function makePalette(enabled: boolean): TerminalPalette {
37
+ if (!enabled) {
38
+ return PLAIN;
39
+ }
40
+ const wrap =
41
+ (code: string) =>
42
+ (s: string): string =>
43
+ `\u001b[${code}m${s}\u001b[0m`;
44
+ return {
45
+ dim: wrap("2"),
46
+ bold: wrap("1"),
47
+ cyan: wrap("36"),
48
+ green: wrap("32"),
49
+ red: wrap("31"),
50
+ magenta: wrap("35"),
51
+ yellow: wrap("33"),
52
+ };
53
+ }
54
+
55
+ /** Palette for human-facing stdout (init summaries, next steps). */
56
+ export function stdoutPalette(): TerminalPalette {
57
+ return makePalette(colorEnabledFor(process.stdout));
58
+ }
59
+
60
+ /** Palette for human-facing stderr (login progress, warnings). */
61
+ export function stderrPalette(): TerminalPalette {
62
+ return makePalette(colorEnabledFor(process.stderr));
63
+ }
64
+
65
+ /** Wipe the terminal before a `dev` Enter-to-restart cycle. */
66
+ export function clearTerminal(
67
+ stream: NodeJS.WriteStream = process.stdout
68
+ ): void {
69
+ if (stream.isTTY !== true) {
70
+ return;
71
+ }
72
+ cursorTo(stream, 0, 0);
73
+ clearScreenDown(stream);
74
+ }
@@ -17,6 +17,16 @@ export interface TrajectoryToolCall {
17
17
  isError: boolean;
18
18
  /** Present when the tool required human approval before execute. */
19
19
  approvalDecision?: "approve" | "deny";
20
+ /** Parent task/subagent call id when this tool ran inside a subagent. */
21
+ parentCallId?: string;
22
+ }
23
+
24
+ export interface TrajectorySubagent {
25
+ callId: string;
26
+ name?: string;
27
+ description?: string;
28
+ /** Nested tool calls streamed while this subagent was running. */
29
+ toolCalls: TrajectoryToolCall[];
20
30
  }
21
31
 
22
32
  export interface TrajectoryTurn {
@@ -25,7 +35,7 @@ export interface TrajectoryTurn {
25
35
  assistantText: string;
26
36
  reasoningText?: string;
27
37
  toolCalls: TrajectoryToolCall[];
28
- subagents: Array<{ callId: string; name?: string; description?: string }>;
38
+ subagents: TrajectorySubagent[];
29
39
  usage?: TurnUsage;
30
40
  result?: string;
31
41
  failed: boolean;
@@ -95,12 +105,20 @@ export function buildTrajectory(events: SessionEvent[]): Trajectory {
95
105
  break;
96
106
  }
97
107
  case "message.completed": {
108
+ // Nested subagent text must not overwrite the parent turn reply.
109
+ if (event.data.parentCallId !== undefined) {
110
+ break;
111
+ }
98
112
  if (event.turnId !== undefined && event.data.text !== "") {
99
113
  ensureTurn(event.turnId).assistantText = event.data.text;
100
114
  }
101
115
  break;
102
116
  }
103
117
  case "reasoning.appended": {
118
+ // Nested subagent thinking stays off the parent turn transcript.
119
+ if (event.data.parentCallId !== undefined) {
120
+ break;
121
+ }
104
122
  if (event.turnId !== undefined) {
105
123
  ensureTurn(event.turnId).reasoningText = event.data.text;
106
124
  }
@@ -112,14 +130,28 @@ export function buildTrajectory(events: SessionEvent[]): Trajectory {
112
130
  }
113
131
  const turn = ensureTurn(event.turnId);
114
132
  for (const call of event.data.calls) {
133
+ const parentCallId = call.parentCallId ?? event.data.parentCallId;
134
+ // Keep bare top-level `task` in toolCalls so evals like
135
+ // `calledTool("task")` / `notCalledTool("task")` keep working.
136
+ // Nested progress also appears under `subagents`.
115
137
  const entry: TrajectoryToolCall = {
116
138
  callId: call.callId,
117
139
  toolName: call.toolName,
118
140
  isError: false,
119
- ...(call.args === undefined ? {} : { args: call.args }),
141
+ args: call.args,
142
+ parentCallId,
120
143
  };
121
144
  pendingCalls.set(call.callId, entry);
122
- turn.toolCalls.push(entry);
145
+ if (parentCallId !== undefined) {
146
+ let sub = turn.subagents.find((s) => s.callId === parentCallId);
147
+ if (sub === undefined) {
148
+ sub = { callId: parentCallId, toolCalls: [] };
149
+ turn.subagents.push(sub);
150
+ }
151
+ sub.toolCalls.push(entry);
152
+ } else {
153
+ turn.toolCalls.push(entry);
154
+ }
123
155
  }
124
156
  break;
125
157
  }
@@ -141,24 +173,49 @@ export function buildTrajectory(events: SessionEvent[]): Trajectory {
141
173
  pending.isError = event.data.isError;
142
174
  pending.toolName = event.data.toolName;
143
175
  } else if (event.turnId !== undefined) {
144
- ensureTurn(event.turnId).toolCalls.push({
176
+ const turn = ensureTurn(event.turnId);
177
+ const entry: TrajectoryToolCall = {
145
178
  callId: event.data.callId,
146
179
  toolName: event.data.toolName,
147
180
  output: event.data.output,
148
181
  isError: event.data.isError,
149
- });
182
+ parentCallId: event.data.parentCallId,
183
+ };
184
+ if (event.data.parentCallId !== undefined) {
185
+ let sub = turn.subagents.find(
186
+ (s) => s.callId === event.data.parentCallId
187
+ );
188
+ if (sub === undefined) {
189
+ sub = {
190
+ callId: event.data.parentCallId,
191
+ toolCalls: [],
192
+ };
193
+ turn.subagents.push(sub);
194
+ }
195
+ sub.toolCalls.push(entry);
196
+ } else {
197
+ turn.toolCalls.push(entry);
198
+ }
150
199
  }
151
200
  break;
152
201
  }
153
202
  case "subagent.called": {
154
203
  if (event.turnId !== undefined) {
155
- ensureTurn(event.turnId).subagents.push({
156
- callId: event.data.callId,
157
- ...(event.data.name === undefined ? {} : { name: event.data.name }),
158
- ...(event.data.description === undefined
159
- ? {}
160
- : { description: event.data.description }),
161
- });
204
+ const turn = ensureTurn(event.turnId);
205
+ const existing = turn.subagents.find(
206
+ (s) => s.callId === event.data.callId
207
+ );
208
+ if (existing !== undefined) {
209
+ existing.name = event.data.name;
210
+ existing.description = event.data.description;
211
+ } else {
212
+ turn.subagents.push({
213
+ callId: event.data.callId,
214
+ name: event.data.name,
215
+ description: event.data.description,
216
+ toolCalls: [],
217
+ });
218
+ }
162
219
  }
163
220
  break;
164
221
  }
@@ -202,7 +259,13 @@ export function buildTrajectory(events: SessionEvent[]): Trajectory {
202
259
 
203
260
  const turns = turnOrder.map((id) => turnsById.get(id)!);
204
261
  const turnsFailed = turns.filter((t) => t.failed).length;
205
- const toolCallCount = turns.reduce((n, t) => n + t.toolCalls.length, 0);
262
+ const toolCallCount = turns.reduce(
263
+ (n, t) =>
264
+ n +
265
+ t.toolCalls.length +
266
+ t.subagents.reduce((m, s) => m + s.toolCalls.length, 0),
267
+ 0
268
+ );
206
269
  const lastGood = [...turns].reverse().find((t) => t.assistantText !== "");
207
270
  return {
208
271
  sessionId,
@@ -270,6 +333,21 @@ export function formatTrajectoryText(trajectory: Trajectory): string {
270
333
  lines.push(` ${truncate(stringify(call.output), 160)}`);
271
334
  }
272
335
  }
336
+ for (const sub of turn.subagents) {
337
+ const label = sub.name ?? "subagent";
338
+ const detail =
339
+ sub.description !== undefined
340
+ ? ` — ${truncate(sub.description, 80)}`
341
+ : "";
342
+ lines.push(` task ${label}${detail}`);
343
+ for (const call of sub.toolCalls) {
344
+ const mark = call.isError ? "✗" : "→";
345
+ lines.push(` ${mark} ${call.toolName}${formatArgs(call.args)}`);
346
+ if (call.output !== undefined) {
347
+ lines.push(` ${truncate(stringify(call.output), 160)}`);
348
+ }
349
+ }
350
+ }
273
351
  if (turn.assistantText.length > 0) {
274
352
  lines.push(` agent: ${truncate(turn.assistantText, 400)}`);
275
353
  }
@@ -15,6 +15,7 @@ import type {
15
15
  ResolvedAgent,
16
16
  } from "../types.js";
17
17
  import { parseFrontmatter, serializeFrontmatter } from "./frontmatter.js";
18
+ import { buildIdentitySection } from "./prompt-context.js";
18
19
 
19
20
  export interface MaterializeWorkspaceOptions {
20
21
  agent: ResolvedAgent;
@@ -31,6 +32,41 @@ export function agentToolScriptPath(toolName: string): string {
31
32
  return `.agent-serve/tools/${toolName}.sh`;
32
33
  }
33
34
 
35
+ /**
36
+ * Always-on identity line prepended when composing instructions. Sourced from
37
+ * {@link ResolvedAgent.name} (`defineAgent({ name })`, else package/dir name)
38
+ * so agents know who they are without restating it in authored prose.
39
+ */
40
+ export function buildIdentityPreamble(name: string): string {
41
+ const trimmed = name.trim();
42
+ if (trimmed === "") {
43
+ return "";
44
+ }
45
+ return `You are ${trimmed}. That is your name; use it when people ask who you are.`;
46
+ }
47
+
48
+ /**
49
+ * Prepend {@link buildIdentityPreamble} to authored instructions. Used when
50
+ * loading `instructions.md` / `.ts` / dir into {@link ResolvedAgent.instructions}.
51
+ */
52
+ export function withIdentityPreamble(
53
+ name: string,
54
+ instructions: string | undefined
55
+ ): string | undefined {
56
+ const preamble = buildIdentityPreamble(name);
57
+ const body = instructions?.trim() ?? "";
58
+ if (preamble === "" && body === "") {
59
+ return undefined;
60
+ }
61
+ if (preamble === "") {
62
+ return body === "" ? undefined : body;
63
+ }
64
+ if (body === "") {
65
+ return preamble;
66
+ }
67
+ return `${preamble}\n\n${body}`;
68
+ }
69
+
34
70
  /**
35
71
  * Markdown catalog of agent-side tools for AGENTS.md / cloud first prompt.
36
72
  *
@@ -96,12 +132,14 @@ export async function materializeWorkspace(
96
132
  const agentToolsSection = buildAgentToolsCatalog(agent.tools, {
97
133
  includeScripts: false,
98
134
  });
99
- const agentsMd = [agent.instructions?.trim() ?? "", agentToolsSection]
135
+ const agentsMd = [
136
+ agent.instructions?.trim() ?? "",
137
+ buildIdentitySection(agent),
138
+ agentToolsSection,
139
+ ]
100
140
  .filter((part) => part !== "")
101
141
  .join("\n\n");
102
- if (agentsMd !== "") {
103
- await writeFile(join(workspaceDir, "AGENTS.md"), agentsMd, "utf8");
104
- }
142
+ await writeFile(join(workspaceDir, "AGENTS.md"), agentsMd, "utf8");
105
143
 
106
144
  for (const tool of agent.tools) {
107
145
  if (tool.execution !== "agent" || tool.script === undefined) {
package/src/types.ts CHANGED
@@ -588,6 +588,11 @@ export interface ActionCall {
588
588
  callId: string;
589
589
  toolName: string;
590
590
  args?: unknown;
591
+ /**
592
+ * When set, this tool call belongs to a nested subagent turn whose
593
+ * parent `task` tool call id is `parentCallId`.
594
+ */
595
+ parentCallId?: string;
591
596
  }
592
597
 
593
598
  /** Human decision for a parked {@link ToolConfig.needsApproval} tool call. */
@@ -622,14 +627,30 @@ export type SessionEventPayload =
622
627
  | { type: "turn.started"; data: Record<string, never> }
623
628
  | { type: "step.started"; data: { stepId: number } }
624
629
  | { type: "step.completed"; data: { stepId: number; durationMs: number } }
625
- | { type: "reasoning.appended"; data: { delta: string; text: string } }
626
- | { type: "reasoning.completed"; data: { durationMs?: number } }
627
- | { type: "message.appended"; data: { delta: string; text: string } }
630
+ | {
631
+ type: "reasoning.appended";
632
+ data: { delta: string; text: string; parentCallId?: string };
633
+ }
634
+ | {
635
+ type: "reasoning.completed";
636
+ data: { durationMs?: number; parentCallId?: string };
637
+ }
638
+ | {
639
+ type: "message.appended";
640
+ data: { delta: string; text: string; parentCallId?: string };
641
+ }
628
642
  | {
629
643
  type: "message.completed";
630
- data: { text: string; finishReason: "stop" | "tool_call" };
644
+ data: {
645
+ text: string;
646
+ finishReason: "stop" | "tool_call";
647
+ parentCallId?: string;
648
+ };
649
+ }
650
+ | {
651
+ type: "actions.requested";
652
+ data: { calls: ActionCall[]; parentCallId?: string };
631
653
  }
632
- | { type: "actions.requested"; data: { calls: ActionCall[] } }
633
654
  | {
634
655
  /**
635
656
  * A server tool with {@link ToolConfig.needsApproval} is parked until
@@ -641,6 +662,7 @@ export type SessionEventPayload =
641
662
  callId: string;
642
663
  toolName: string;
643
664
  args?: unknown;
665
+ parentCallId?: string;
644
666
  };
645
667
  }
646
668
  | {
@@ -650,6 +672,7 @@ export type SessionEventPayload =
650
672
  toolName: string;
651
673
  decision: ApprovalDecision;
652
674
  by?: string;
675
+ parentCallId?: string;
653
676
  };
654
677
  }
655
678
  | {
@@ -659,6 +682,7 @@ export type SessionEventPayload =
659
682
  toolName: string;
660
683
  output?: unknown;
661
684
  isError: boolean;
685
+ parentCallId?: string;
662
686
  };
663
687
  }
664
688
  | {
@@ -1551,7 +1575,10 @@ export interface ResolvedAgent {
1551
1575
  name: string;
1552
1576
  description?: string;
1553
1577
  model?: ModelSetting;
1554
- /** Composed system prompt (instructions.md / instructions.ts / agent.ts). */
1578
+ /**
1579
+ * Composed system prompt: identity preamble from {@link name}, then
1580
+ * authored `instructions.md` / `.ts` / dir (or inline `agent.ts`).
1581
+ */
1555
1582
  instructions?: string;
1556
1583
  /** Execution runtime. Root agents default to `"local"`. */
1557
1584
  runtime: AgentRuntime;
@@ -1776,6 +1803,15 @@ export interface ServeOptions {
1776
1803
  * {@link authToken}. Authored `auth` arrays still win.
1777
1804
  */
1778
1805
  allowAnonymous?: boolean;
1806
+ /**
1807
+ * Allow {@link allowAnonymous} together with
1808
+ * `githubChannel({ cursorAccount })`. Without this opt-in, `serve` refuses
1809
+ * to start because every admitted anonymous caller could drive sessions
1810
+ * that hold the signed-in account's repo-scoped GitHub credential. Set it
1811
+ * only when the network boundary already authenticates callers (e.g. an
1812
+ * SSO/Okta proxy in front of the host).
1813
+ */
1814
+ allowAnonymousCursorGithub?: boolean;
1779
1815
  /**
1780
1816
  * Public base URL where this server is reachable from outside the host
1781
1817
  * (e.g. `https://agents.example.com`). Used to resolve peer