@cursor/july 0.1.83 → 0.1.84

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 (93) hide show
  1. package/dist/docs/404.html +1 -1
  2. package/dist/docs/ab.html +2 -2
  3. package/dist/docs/assets/{app.6THHGRH-.js → app.kqdC1N7p.js} +1 -1
  4. package/dist/docs/assets/chunks/@localSearchIndexroot.BqhvUA76.js +1 -0
  5. package/dist/docs/assets/chunks/{VPLocalSearchBox.BpHB9ulP.js → VPLocalSearchBox.DXDE2WgG.js} +1 -1
  6. package/dist/docs/assets/chunks/{theme.DBJvJznv.js → theme.DFYqbyta.js} +2 -2
  7. package/dist/docs/building-with-agents.html +2 -2
  8. package/dist/docs/concepts.html +2 -2
  9. package/dist/docs/deployment.html +2 -2
  10. package/dist/docs/evals.html +2 -2
  11. package/dist/docs/example-agents/approval-buddy.html +2 -2
  12. package/dist/docs/example-agents/benny.html +2 -2
  13. package/dist/docs/example-agents/bugbot.html +2 -2
  14. package/dist/docs/example-agents/codebase-wiki.html +2 -2
  15. package/dist/docs/example-agents/codeowners-review.html +2 -2
  16. package/dist/docs/example-agents/concierge.html +2 -2
  17. package/dist/docs/example-agents/fsd.html +2 -2
  18. package/dist/docs/example-agents/index.html +2 -2
  19. package/dist/docs/example-agents/knowledge-base.html +2 -2
  20. package/dist/docs/example-agents/oncall.html +2 -2
  21. package/dist/docs/example-agents/security-reviewer.html +2 -2
  22. package/dist/docs/example-agents/slack-agent.html +2 -2
  23. package/dist/docs/example-agents/weather-agent.html +2 -2
  24. package/dist/docs/guides/agent-to-agent.html +2 -2
  25. package/dist/docs/guides/cloud-runtime.html +2 -2
  26. package/dist/docs/guides/convert-automation.html +2 -2
  27. package/dist/docs/guides/github.html +2 -2
  28. package/dist/docs/guides/human-in-the-loop.html +2 -2
  29. package/dist/docs/guides/mcp-oauth.html +2 -2
  30. package/dist/docs/guides/opentelemetry.html +2 -2
  31. package/dist/docs/guides/slack.html +2 -2
  32. package/dist/docs/guides/webhooks.html +2 -2
  33. package/dist/docs/hillclimbing.html +2 -2
  34. package/dist/docs/index.html +2 -2
  35. package/dist/docs/quickstart.html +2 -2
  36. package/dist/docs/reference/agent-config.html +2 -2
  37. package/dist/docs/reference/artifacts.html +2 -2
  38. package/dist/docs/reference/channels.html +2 -2
  39. package/dist/docs/reference/cli.html +2 -2
  40. package/dist/docs/reference/connections.html +2 -2
  41. package/dist/docs/reference/hooks.html +2 -2
  42. package/dist/docs/reference/http-api.html +2 -2
  43. package/dist/docs/reference/instructions.html +2 -2
  44. package/dist/docs/reference/playground.html +2 -2
  45. package/dist/docs/reference/project-layout.html +2 -2
  46. package/dist/docs/reference/prompt.html +2 -2
  47. package/dist/docs/reference/schedules.html +2 -2
  48. package/dist/docs/reference/sessions.html +2 -2
  49. package/dist/docs/reference/skills.html +2 -2
  50. package/dist/docs/reference/subagents.html +2 -2
  51. package/dist/docs/reference/tools.html +2 -2
  52. package/dist/docs/scaffolding-agents.html +2 -2
  53. package/dist/docs/storage.html +2 -2
  54. package/dist/docs/templates/agentic-owners.html +2 -2
  55. package/dist/docs/templates/demo.html +2 -2
  56. package/dist/docs/templates/pr-autofixer.html +2 -2
  57. package/dist/docs/templates/security-reviewer.html +2 -2
  58. package/dist/docs/templates/triage.html +2 -2
  59. package/dist/docs/troubleshooting.html +2 -2
  60. package/dist/internal/discovery.d.ts.map +1 -1
  61. package/dist/internal/discovery.js +16 -1
  62. package/dist/internal/event-mapper.d.ts +7 -1
  63. package/dist/internal/event-mapper.d.ts.map +1 -1
  64. package/dist/internal/event-mapper.js +8 -8
  65. package/dist/internal/http-channel.d.ts.map +1 -1
  66. package/dist/internal/http-channel.js +1 -1
  67. package/dist/internal/mcp-endpoint.js +9 -0
  68. package/dist/internal/prompt-context.d.ts +4 -1
  69. package/dist/internal/prompt-context.d.ts.map +1 -1
  70. package/dist/internal/prompt-context.js +20 -2
  71. package/dist/internal/review-comments.js +15 -7
  72. package/dist/internal/session-engine.d.ts +28 -0
  73. package/dist/internal/session-engine.d.ts.map +1 -1
  74. package/dist/internal/session-engine.js +99 -42
  75. package/dist/internal/tool-policy.d.ts +50 -0
  76. package/dist/internal/tool-policy.d.ts.map +1 -0
  77. package/dist/internal/tool-policy.js +51 -0
  78. package/dist/tools.d.ts +16 -2
  79. package/dist/tools.d.ts.map +1 -1
  80. package/dist/types.d.ts +67 -0
  81. package/dist/types.d.ts.map +1 -1
  82. package/package.json +1 -1
  83. package/src/internal/discovery.ts +20 -0
  84. package/src/internal/event-mapper.ts +10 -1
  85. package/src/internal/http-channel.ts +1 -0
  86. package/src/internal/mcp-endpoint.ts +9 -0
  87. package/src/internal/prompt-context.ts +25 -2
  88. package/src/internal/review-comments.ts +17 -7
  89. package/src/internal/session-engine.ts +120 -31
  90. package/src/internal/tool-policy.ts +92 -0
  91. package/src/tools.ts +19 -0
  92. package/src/types.ts +73 -0
  93. package/dist/docs/assets/chunks/@localSearchIndexroot.D9uScPWb.js +0 -1
@@ -64,6 +64,7 @@ export interface ToolResultDescription {
64
64
  }
65
65
  export declare class TurnEventMapper {
66
66
  private readonly emit;
67
+ private readonly isStubbed;
67
68
  private textAccumulator;
68
69
  private reasoningAccumulator;
69
70
  private usageTotal;
@@ -71,7 +72,12 @@ export declare class TurnEventMapper {
71
72
  private summaryTitle;
72
73
  /** Per-parent-call accumulators for nested subagent streams. */
73
74
  private readonly nested;
74
- constructor(emit: (payload: SessionEventPayload) => void);
75
+ /**
76
+ * @param isStubbed Reports whether a finished tool call was answered by the
77
+ * host rather than executed. The harness reports an answered call exactly
78
+ * like a real one, so the engine is the only place that knows.
79
+ */
80
+ constructor(emit: (payload: SessionEventPayload) => void, isStubbed?: (callId: string) => boolean);
75
81
  /** Per-turn token usage summed across model steps. */
76
82
  get usage(): TurnUsage | undefined;
77
83
  /** The final assistant text block of the turn, when one was produced. */
@@ -1 +1 @@
1
- {"version":3,"file":"event-mapper.d.ts","sourceRoot":"","sources":["../../src/internal/event-map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,OAAO,CAAC,sBAAsB;IAgE9B,OAAO,CAAC,eAAe;IAkCvB,OAAO,CAAC,iBAAiB;IA4BzB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,wBAAwB;CAejC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,mBAAmB,CA6CxE;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,qBAAqB,CA4B5E"}
@@ -13,8 +13,14 @@ function asToolCallDelta(update) {
13
13
  return update;
14
14
  }
15
15
  export class TurnEventMapper {
16
- constructor(emit) {
16
+ /**
17
+ * @param isStubbed Reports whether a finished tool call was answered by the
18
+ * host rather than executed. The harness reports an answered call exactly
19
+ * like a real one, so the engine is the only place that knows.
20
+ */
21
+ constructor(emit, isStubbed = () => false) {
17
22
  this.emit = emit;
23
+ this.isStubbed = isStubbed;
18
24
  this.textAccumulator = "";
19
25
  this.reasoningAccumulator = "";
20
26
  /** Per-parent-call accumulators for nested subagent streams. */
@@ -210,13 +216,7 @@ export class TurnEventMapper {
210
216
  const result = describeToolResult(toolCall);
211
217
  this.emit({
212
218
  type: "action.result",
213
- data: {
214
- callId,
215
- toolName: description.toolName,
216
- output: result.output,
217
- isError: result.isError,
218
- parentCallId,
219
- },
219
+ data: Object.assign(Object.assign({ callId, toolName: description.toolName, output: result.output, isError: result.isError }, (this.isStubbed(callId) ? { stubbed: true } : {})), { parentCallId }),
220
220
  });
221
221
  if (description.subagent !== undefined && parentCallId === undefined) {
222
222
  this.flushNestedAssistantText(callId, "stop");
@@ -1 +1 @@
1
- {"version":3,"file":"http-channel.d.ts","sourceRoot":"","sources":["../../src/internal/http-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAEV,WAAW,EACX,UAAU,EACV,qBAAqB,EAErB,aAAa,EACd,MAAM,aAAa,CAAC;AAQrB,OAAO,KAAK,E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AAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAc9C"}
@@ -53,7 +53,7 @@ export function buildHttpChannelRoutes(args) {
53
53
  // Per-session cloud attach (create only). Eval harness uses this to pin
54
54
  // fixture repos without putting them on the agent's default cloud.repos.
55
55
  const cloud = readCloudOptions(body.cloud);
56
- const session = yield engine.send(HTTP_CHANNEL_ID, message, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ auth: ctx.auth }, (body.state === undefined ? {} : { state: body.state })), (typeof body.title === "string" ? { title: body.title } : {})), (body.purpose === "eval" ? { purpose: "eval" } : {})), (workspaceFiles === undefined ? {} : { workspaceFiles })), (cloud === undefined ? {} : { cloud })));
56
+ const session = yield engine.send(HTTP_CHANNEL_ID, message, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ auth: ctx.auth }, (body.state === undefined ? {} : { state: body.state })), (typeof body.title === "string" ? { title: body.title } : {})), (body.purpose === "eval" ? { purpose: "eval" } : {})), (body.dryRun === true ? { dryRun: true } : {})), (workspaceFiles === undefined ? {} : { workspaceFiles })), (cloud === undefined ? {} : { cloud })));
57
57
  return jsonResponse({
58
58
  ok: true,
59
59
  sessionId: session.id,
@@ -215,6 +215,15 @@ function buildConnectionBridgeMcpServer(engine, sessionId, connectionName) {
215
215
  if (reason !== undefined) {
216
216
  return errorResult(reason);
217
217
  }
218
+ // The one tool path that never reaches `executeServerTool`, so it asks
219
+ // the policy itself.
220
+ const answer = engine.bridgedCallAnswer({
221
+ sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : "",
222
+ toolName: request.params.name,
223
+ });
224
+ if (answer.answered) {
225
+ return sdkResultToMcpResult(answer.result);
226
+ }
218
227
  try {
219
228
  const result = yield engine.host.mcp.callTool(connectionName, request.params.name, (_a = request.params.arguments) !== null && _a !== void 0 ? _a : {});
220
229
  return Object.assign(Object.assign({
@@ -21,7 +21,10 @@ export interface SessionContextInput {
21
21
  */
22
22
  channelKind?: string;
23
23
  environment: PromptEnvironment;
24
- /** Injectable clock for tests; defaults to now. */
24
+ /**
25
+ * Injectable clock for tests; defaults to the mocked prompt time when
26
+ * `CURSOR_SDK_MOCK_PROMPT_TIME` is set, then to now.
27
+ */
25
28
  now?: Date;
26
29
  }
27
30
  export declare function buildSessionContextBlock(input: SessionContextInput): string;
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-context.d.ts","sourceRoot":"","sources":["../../src/internal/prompt-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,uBAAuB,cAAc,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAEzE,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAC,GACjD,MAAM,CAWR;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,mDAAmD;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAc3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,GAAG,aAAa,CAAC,GAC9D,MAAM,GAAG,SAAS,CAepB"}
1
+ {"version":3,"file":"prompt-context.d.ts","sourceRoot":"","sources":["../../src/internal/prompt-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,uBAAuB,cAAc,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAEzE,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAC,GACjD,MAAM,CAWR;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,iBAAiB,CAAC;IAC/B;;;OAGG;IACH,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAqBD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAe3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,GAAG,aAAa,CAAC,GAC9D,MAAM,GAAG,SAAS,CAepB"}
@@ -21,14 +21,32 @@ export function buildIdentitySection(agent) {
21
21
  `${intro} You run as a persistent service: messages reach you through channels (such as Slack, GitHub, webhooks, or a web playground), and each conversation is a session that can continue across multiple turns.`,
22
22
  ].join("\n");
23
23
  }
24
+ /**
25
+ * Development-only override for the wall clock rendered into prompt content.
26
+ * Same variable the Cursor SDK harness reads for its prompt clock (the
27
+ * user-message <timestamp> prefix and user_info date), so one knob keeps the
28
+ * session context block and the harness-rendered clock consistent. Read on
29
+ * every render so a simulation harness can advance the instant between
30
+ * sessions. Never affects runtime clocks (schedules, reminders) or tools.
31
+ */
32
+ const MOCK_PROMPT_TIME_ENV = "CURSOR_SDK_MOCK_PROMPT_TIME";
33
+ function readMockPromptTimeFromEnv() {
34
+ const raw = process.env[MOCK_PROMPT_TIME_ENV];
35
+ if (raw === undefined || raw === "") {
36
+ return undefined;
37
+ }
38
+ const parsed = new Date(raw);
39
+ return Number.isNaN(parsed.getTime()) ? undefined : parsed;
40
+ }
24
41
  export function buildSessionContextBlock(input) {
25
- var _a;
42
+ var _a, _b;
43
+ const now = (_b = (_a = input.now) !== null && _a !== void 0 ? _a : readMockPromptTimeFromEnv()) !== null && _b !== void 0 ? _b : new Date();
26
44
  const lines = [
27
45
  "<agentkit_context>",
28
46
  `session: ${input.sessionId}`,
29
47
  `channel: ${input.channelId}`,
30
48
  `environment: ${input.environment}`,
31
- `time: ${((_a = input.now) !== null && _a !== void 0 ? _a : new Date()).toISOString()}`,
49
+ `time: ${now.toISOString()}`,
32
50
  "</agentkit_context>",
33
51
  ];
34
52
  const presence = channelPresenceLine(input);
@@ -441,10 +441,13 @@ function postReviewViaHostGithub(github, args) {
441
441
  /**
442
442
  * Ids of the inline comments a just-created review owns.
443
443
  *
444
- * `pulls.createReview` returns the review, not its comments, so they come
445
- * from the review-scoped listing. Scoping to the review matters: the
446
- * PR-wide list is ordered oldest-first and runs to thousands on a busy PR,
447
- * so the comments we just created are the ones a page cap would drop.
444
+ * `pulls.createReview` returns the review, not its comments.
445
+ * `listCommentsForReview` either omits those rows or returns them with
446
+ * `line` / `original_line` unset, so the line filter drops every id, the
447
+ * store records no findings, and the next run cannot judge or resolve
448
+ * those threads. Read the PR-wide list instead and keep only this
449
+ * review's rows. Newest-first so a busy PR's older comments cannot push
450
+ * ours past the page cap.
448
451
  * Best-effort: any failure yields an empty list, which costs the next run
449
452
  * its prior findings rather than risking a wrong id. Never throws — the
450
453
  * review is already posted by this point.
@@ -460,22 +463,27 @@ function readPostedComments(args) {
460
463
  const posted = [];
461
464
  for (let page = 1; page <= REVIEW_COMMENTS_MAX_PAGES; page++) {
462
465
  (_a = args.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
463
- const response = yield args.octokit.rest.pulls.listCommentsForReview({
466
+ const response = yield args.octokit.rest.pulls.listReviewComments({
464
467
  owner: args.owner,
465
468
  repo: args.repo,
466
469
  pull_number: args.prNumber,
467
- review_id: args.reviewId,
470
+ sort: "created",
471
+ direction: "desc",
468
472
  per_page: REVIEW_COMMENTS_PAGE_SIZE,
469
473
  page,
470
474
  });
471
475
  for (const comment of response.data) {
476
+ if (comment.pull_request_review_id !== args.reviewId) {
477
+ continue;
478
+ }
472
479
  const line = (_b = comment.original_line) !== null && _b !== void 0 ? _b : comment.line;
473
480
  if (line === null || line === undefined) {
474
481
  continue;
475
482
  }
476
483
  posted.push({ id: comment.id, file: comment.path, line });
477
484
  }
478
- if (response.data.length < REVIEW_COMMENTS_PAGE_SIZE) {
485
+ if (posted.length >= args.expected ||
486
+ response.data.length < REVIEW_COMMENTS_PAGE_SIZE) {
479
487
  break;
480
488
  }
481
489
  }
@@ -132,6 +132,15 @@ export declare class SessionEngine {
132
132
  private readonly activeTurns;
133
133
  /** Context used by the cloud turn's HTTP MCP callbacks. */
134
134
  private readonly activeToolContexts;
135
+ /**
136
+ * Tool call ids the host answered instead of running, per session.
137
+ *
138
+ * The mapper emits the result event from the harness's view of a finished
139
+ * call, which cannot tell an answered call from a real one — so the decision
140
+ * point records the id here and the mapper stamps the event from it.
141
+ * Registered only while a turn can invoke a tool.
142
+ */
143
+ private readonly stubbedCallIds;
135
144
  /**
136
145
  * Delivered-nudge count per session at the last tool boundary. The carrier
137
146
  * drains out-of-process, so a growing count is how the engine learns a
@@ -498,6 +507,25 @@ export declare class SessionEngine {
498
507
  * an exception.
499
508
  */
500
509
  callTool(toolName: string, input?: unknown, options?: CallToolOptions): Promise<ToolCallOutcome>;
510
+ /**
511
+ * Whether a dry run answers a bridged MCP call, for the cloud host bridge —
512
+ * the one tool path that does not reach {@link executeServerTool}, because
513
+ * it forwards to `host.mcp` instead of invoking a tool body.
514
+ *
515
+ * A bridged tool carries no `defineTool`, so it declares no effect, and the
516
+ * policy reads an undeclared tool as a write. In a dry run that answers
517
+ * bridged reads too; resolving effects from a server's own listing is the
518
+ * next unit's work.
519
+ */
520
+ bridgedCallAnswer(args: {
521
+ sessionId: string;
522
+ toolName: string;
523
+ }): {
524
+ answered: true;
525
+ result: SDKCustomToolResult;
526
+ } | {
527
+ answered: false;
528
+ };
501
529
  private appendEvent;
502
530
  private queueDispatch;
503
531
  private dispatchEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"session-engine.d.ts","sourceRoot":"","sources":["../../src/internal/session-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAiB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAShD,OAAO,EACL,mBAAmB,EACnB,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAW1C,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEtB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAIxB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAG1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,YAAY,EAKjB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,KAAK,eAAe,EAGpB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAMpE,OAAO,EAEL,KAAK,eAAe,EAIrB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAAE,KAAK,mBAAmB,EAAiB,MAAM,gBAAgB,CAAC;AAMzE,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAS7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAUzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAA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IAc3B,sEAAsE;IACtE,OAAO,CAAC,YAAY;IA6BpB;;;;;;;;;;;OAWG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgB3C;YAEa,cAAc;IA4F5B;;;;;;;;OAQG;IACG,mBAAmB,CACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAMpC;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,4BAA4B;IAqBpC,OAAO,CAAC,kBAAkB;YAkBZ,gCAAgC;YAgBhC,sBAAsB;YAWtB,yBAAyB;IAmBvC;;;;;OAKG;YACW,kBAAkB;IAYhC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAO/C;IAED,2EAA2E;IAC3E,mBAAmB,IAAI,mBAAmB,CAEzC;IAED,yEAAyE;IACnE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAc3B;CACF;AAgCD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,SAAS,GAAG,SAAS,EAC9B,KAAK,EAAE,SAAS,GAAG,SAAS,GAC3B,SAAS,GAAG,SAAS,CAuBvB"}
@@ -54,6 +54,7 @@ import { sessionExternalLinks } from "./session-links.js";
54
54
  import { SessionStore } from "./session-store.js";
55
55
  import { syncSkillsToStore } from "./skills-sync.js";
56
56
  import { StorageCoordinator } from "./storage-coordinator.js";
57
+ import { decideToolCall } from "./tool-policy.js";
57
58
  import { normalizeToolResult, toolCallErrorMessage } from "./tool-result.js";
58
59
  import { estimateTurnCostFromApi, roundCostUsd, } from "./turn-cost.js";
59
60
  import { TurnGovernor } from "./turn-governor.js";
@@ -124,6 +125,15 @@ export class SessionEngine {
124
125
  this.activeTurns = new Map();
125
126
  /** Context used by the cloud turn's HTTP MCP callbacks. */
126
127
  this.activeToolContexts = new Map();
128
+ /**
129
+ * Tool call ids the host answered instead of running, per session.
130
+ *
131
+ * The mapper emits the result event from the harness's view of a finished
132
+ * call, which cannot tell an answered call from a real one — so the decision
133
+ * point records the id here and the mapper stamps the event from it.
134
+ * Registered only while a turn can invoke a tool.
135
+ */
136
+ this.stubbedCallIds = new Map();
127
137
  /**
128
138
  * Delivered-nudge count per session at the last tool boundary. The carrier
129
139
  * drains out-of-process, so a growing count is how the engine learns a
@@ -530,24 +540,7 @@ export class SessionEngine {
530
540
  const now = new Date().toISOString();
531
541
  const channelState = this.initialChannelState(channelId, sendOptions.state);
532
542
  const purpose = sendOptions.purpose === "eval" ? "eval" : "live";
533
- let record = {
534
- sessionId: newSessionId(),
535
- channelId,
536
- mode: (_d = sendOptions.mode) !== null && _d !== void 0 ? _d : "chat",
537
- purpose,
538
- continuationKey: (_e = sendOptions.continuationToken) !== null && _e !== void 0 ? _e : newContinuationKey(),
539
- auth,
540
- title: sendOptions.title,
541
- channelState,
542
- workspaceOverride: sendOptions.workspaceDir,
543
- pendingWorkspaceFiles: sendOptions.workspaceFiles,
544
- pendingImages: sendOptions.images,
545
- cloudOverride: sendOptions.cloud,
546
- sdkAgentId: sendOptions.sdkAgentId,
547
- turnCount: 0,
548
- createdAt: now,
549
- updatedAt: now,
550
- };
543
+ let record = Object.assign(Object.assign({ sessionId: newSessionId(), channelId, mode: (_d = sendOptions.mode) !== null && _d !== void 0 ? _d : "chat", purpose }, (sendOptions.dryRun === true ? { dryRun: true } : {})), { continuationKey: (_e = sendOptions.continuationToken) !== null && _e !== void 0 ? _e : newContinuationKey(), auth, title: sendOptions.title, channelState, workspaceOverride: sendOptions.workspaceDir, pendingWorkspaceFiles: sendOptions.workspaceFiles, pendingImages: sendOptions.images, cloudOverride: sendOptions.cloud, sdkAgentId: sendOptions.sdkAgentId, turnCount: 0, createdAt: now, updatedAt: now });
551
544
  yield this.sessions.save(record);
552
545
  (_a = this.storage) === null || _a === void 0 ? void 0 : _a.sessionRecord(record);
553
546
  yield this.appendEvent(record.sessionId, {
@@ -1130,7 +1123,10 @@ export class SessionEngine {
1130
1123
  this.logger(`[agent-sdk] failed to record event for ${sessionId}: ${describeError(error)}`);
1131
1124
  }
1132
1125
  };
1133
- const mapper = new TurnEventMapper(emit);
1126
+ // Read by closure, so the mapper still sees it while draining after the
1127
+ // registry entry below is gone.
1128
+ const stubbed = new Set();
1129
+ const mapper = new TurnEventMapper(emit, (callId) => stubbed.has(callId));
1134
1130
  // Take a turn slot before any work happens. When every slot is busy the
1135
1131
  // turn waits FIFO — durable `turn.queued` marks the wait — and a
1136
1132
  // preempting follow-up (or interrupt) resolves the wait as cancelled
@@ -1214,11 +1210,13 @@ export class SessionEngine {
1214
1210
  }
1215
1211
  }), signal, pendingImages);
1216
1212
  this.activeToolContexts.set(sessionId, { record, turnId, emit });
1213
+ this.stubbedCallIds.set(sessionId, stubbed);
1217
1214
  try {
1218
1215
  outcome = yield this.runner.runTurn(request);
1219
1216
  }
1220
1217
  finally {
1221
1218
  this.activeToolContexts.delete(sessionId);
1219
+ this.stubbedCallIds.delete(sessionId);
1222
1220
  }
1223
1221
  }
1224
1222
  catch (error) {
@@ -1752,6 +1750,7 @@ export class SessionEngine {
1752
1750
  executeServerTool(args) {
1753
1751
  return __awaiter(this, void 0, void 0, function* () {
1754
1752
  var _a;
1753
+ var _b;
1755
1754
  const execute = args.tool.definition.execute;
1756
1755
  if (args.tool.execution !== "server" || typeof execute !== "function") {
1757
1756
  return toolErrorResult(`Tool "${args.tool.name}" is not a server tool.`);
@@ -1760,7 +1759,7 @@ export class SessionEngine {
1760
1759
  if (!validation.ok) {
1761
1760
  return toolErrorResult(`Invalid input for tool "${args.tool.name}": ${validation.message}`);
1762
1761
  }
1763
- const toolCallId = (_a = args.toolCallId) !== null && _a !== void 0 ? _a : newToolCallId(args.tool.name);
1762
+ const toolCallId = (_b = args.toolCallId) !== null && _b !== void 0 ? _b : newToolCallId(args.tool.name);
1764
1763
  const toolCtx = {
1765
1764
  toolCallId,
1766
1765
  session: this.sessionInfo(args.record),
@@ -1776,6 +1775,19 @@ export class SessionEngine {
1776
1775
  emit: args.emit,
1777
1776
  };
1778
1777
  try {
1778
+ // Before the approval gate: a dry run is unattended, so parking a write
1779
+ // for a human would hang the turn rather than answer it.
1780
+ const decision = decideToolCall({
1781
+ dryRun: args.record.dryRun === true,
1782
+ effect: args.tool.definition.effect,
1783
+ dryRunResult: args.tool.definition.dryRunResult,
1784
+ input: validation.value,
1785
+ });
1786
+ if (decision.kind === "answer") {
1787
+ (_a = this.stubbedCallIds.get(args.record.sessionId)) === null || _a === void 0 ? void 0 : _a.add(toolCallId);
1788
+ this.logger(`[session] tool ${args.tool.name} answered by host (${toolCallId})`);
1789
+ return normalizeToolResult(decision.result);
1790
+ }
1779
1791
  const needsGate = yield evaluateNeedsApproval(args.tool.definition.needsApproval, validation.value);
1780
1792
  if (needsGate) {
1781
1793
  const decision = yield this.parkForApproval({
@@ -1994,10 +2006,20 @@ export class SessionEngine {
1994
2006
  data: { calls: [{ callId, toolName, args: validation.value }] },
1995
2007
  });
1996
2008
  }
2009
+ // A separate body from the model path, so it asks the same policy: a
2010
+ // session-bound `POST /v1/tools/:name`, `call --session`, or
2011
+ // `handle.callTool` performs a write just as readily.
2012
+ const decision = decideToolCall({
2013
+ dryRun: (record === null || record === void 0 ? void 0 : record.dryRun) === true,
2014
+ effect: tool.definition.effect,
2015
+ dryRunResult: tool.definition.dryRunResult,
2016
+ input: validation.value,
2017
+ });
1997
2018
  const started = Date.now();
1998
2019
  this.logger(`[session] tool ${toolName} start (direct ${callId})`);
1999
2020
  let result;
2000
2021
  let isError;
2022
+ const stubbed = decision.kind === "answer";
2001
2023
  const live = record;
2002
2024
  const emit = live === undefined
2003
2025
  ? undefined
@@ -2005,26 +2027,33 @@ export class SessionEngine {
2005
2027
  void this.appendEvent(live.sessionId, Object.assign(Object.assign({}, payload), { turnId: callId })).catch(() => { });
2006
2028
  };
2007
2029
  try {
2008
- result = normalizeToolResult(yield execute(validation.value, {
2009
- toolCallId: callId,
2010
- session,
2011
- workspaceDir,
2012
- stateRoot: this.stateRoot,
2013
- host: this.hostForSession(record === null || record === void 0 ? void 0 : record.sessionId),
2014
- // Scratch calls have no real session; their facade stays unbound.
2015
- artifacts: record === undefined
2016
- ? this.artifactsApi()
2017
- : this.artifactsApi({
2018
- sessionId: record.sessionId,
2019
- turnId: callId,
2020
- }),
2021
- send: (channelId, message, sendOptions = {}) => this.send(channelId, message, Object.assign(Object.assign({}, sendOptions), { auth: sendOptions.auth !== undefined
2022
- ? sendOptions.auth
2023
- : session.auth })),
2024
- getSession: (channelId, sessionId) => this.getChannelSession(channelId, sessionId),
2025
- emit,
2026
- }));
2027
- isError = isErrorEnvelope(result);
2030
+ if (decision.kind === "answer") {
2031
+ this.logger(`[session] tool ${toolName} answered by host (direct ${callId})`);
2032
+ result = normalizeToolResult(decision.result);
2033
+ isError = false;
2034
+ }
2035
+ else {
2036
+ result = normalizeToolResult(yield execute(validation.value, {
2037
+ toolCallId: callId,
2038
+ session,
2039
+ workspaceDir,
2040
+ stateRoot: this.stateRoot,
2041
+ host: this.hostForSession(record === null || record === void 0 ? void 0 : record.sessionId),
2042
+ // Scratch calls have no real session; their facade stays unbound.
2043
+ artifacts: record === undefined
2044
+ ? this.artifactsApi()
2045
+ : this.artifactsApi({
2046
+ sessionId: record.sessionId,
2047
+ turnId: callId,
2048
+ }),
2049
+ send: (channelId, message, sendOptions = {}) => this.send(channelId, message, Object.assign(Object.assign({}, sendOptions), { auth: sendOptions.auth !== undefined
2050
+ ? sendOptions.auth
2051
+ : session.auth })),
2052
+ getSession: (channelId, sessionId) => this.getChannelSession(channelId, sessionId),
2053
+ emit,
2054
+ }));
2055
+ isError = isErrorEnvelope(result);
2056
+ }
2028
2057
  }
2029
2058
  catch (error) {
2030
2059
  this.logger(`[session] tool ${toolName} failed (direct ${callId}): ${describeError(error)}`);
@@ -2051,7 +2080,8 @@ export class SessionEngine {
2051
2080
  yield this.appendEvent(record.sessionId, {
2052
2081
  type: "action.result",
2053
2082
  turnId: callId,
2054
- data: { callId, toolName, output: result, isError },
2083
+ data: Object.assign({ callId,
2084
+ toolName, output: result, isError }, (stubbed ? { stubbed: true } : {})),
2055
2085
  });
2056
2086
  }
2057
2087
  const errorMessage = isError ? toolCallErrorMessage(result) : undefined;
@@ -2062,6 +2092,33 @@ export class SessionEngine {
2062
2092
  durationMs }, (errorMessage === undefined ? {} : { errorMessage })), (record === undefined ? {} : { sessionId: record.sessionId }));
2063
2093
  });
2064
2094
  }
2095
+ /**
2096
+ * Whether a dry run answers a bridged MCP call, for the cloud host bridge —
2097
+ * the one tool path that does not reach {@link executeServerTool}, because
2098
+ * it forwards to `host.mcp` instead of invoking a tool body.
2099
+ *
2100
+ * A bridged tool carries no `defineTool`, so it declares no effect, and the
2101
+ * policy reads an undeclared tool as a write. In a dry run that answers
2102
+ * bridged reads too; resolving effects from a server's own listing is the
2103
+ * next unit's work.
2104
+ */
2105
+ bridgedCallAnswer(args) {
2106
+ var _a;
2107
+ // Read off the in-flight turn's context rather than the session store:
2108
+ // the bridge already refuses a call with no active turn, so the record is
2109
+ // in memory. That keeps this free for the sessions that are not dry runs,
2110
+ // which is every session today.
2111
+ const record = (_a = this.activeToolContexts.get(args.sessionId)) === null || _a === void 0 ? void 0 : _a.record;
2112
+ const decision = decideToolCall({
2113
+ dryRun: (record === null || record === void 0 ? void 0 : record.dryRun) === true,
2114
+ effect: undefined,
2115
+ });
2116
+ if (decision.kind === "run") {
2117
+ return { answered: false };
2118
+ }
2119
+ this.logger(`[session] bridged tool ${args.toolName} answered by host (${args.sessionId})`);
2120
+ return { answered: true, result: normalizeToolResult(decision.result) };
2121
+ }
2065
2122
  // ==========================================================================
2066
2123
  // Events: append, dispatch to channel handlers + hooks
2067
2124
  // ==========================================================================
@@ -2609,7 +2666,7 @@ export class SessionEngine {
2609
2666
  this.coalesceDrains.has(sessionId));
2610
2667
  }
2611
2668
  sessionInfo(record) {
2612
- return Object.assign(Object.assign(Object.assign({ id: record.sessionId, channelId: record.channelId, mode: record.mode, purpose: record.purpose === "eval" ? "eval" : "live", auth: record.auth, continuationKey: record.continuationKey }, (record.abs === undefined ? {} : { abs: record.abs })), (record.title === undefined ? {} : { title: record.title })), (record.sdkAgentId === undefined
2669
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id: record.sessionId, channelId: record.channelId, mode: record.mode, purpose: record.purpose === "eval" ? "eval" : "live" }, (record.dryRun === true ? { dryRun: true } : {})), { auth: record.auth, continuationKey: record.continuationKey }), (record.abs === undefined ? {} : { abs: record.abs })), (record.title === undefined ? {} : { title: record.title })), (record.sdkAgentId === undefined
2613
2670
  ? {}
2614
2671
  : { sdkAgentId: record.sdkAgentId }));
2615
2672
  }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The one decision every tool call passes through.
3
+ *
4
+ * A tool body can be reached by more than one path — the model's own calls on
5
+ * a local turn, a cloud turn's calls over the MCP endpoint, a direct
6
+ * `callTool`, the host connection bridge. Each of those is a separate code
7
+ * path, and a guarantee that holds on some of them is not a guarantee. So the
8
+ * decision lives here, in one pure function, and every path asks it rather
9
+ * than re-implementing it.
10
+ */
11
+ import type { ToolEffect, ToolEffectDeclaration, ToolExecuteResult } from "../types.js";
12
+ /** What the host does with one tool call. */
13
+ export type ToolDecision =
14
+ /** Run the tool body. */
15
+ {
16
+ kind: "run";
17
+ }
18
+ /** Do not run it; return this to the model instead. */
19
+ | {
20
+ kind: "answer";
21
+ result: ToolExecuteResult;
22
+ };
23
+ /** What a policy decision needs to know about the call. */
24
+ export interface ToolCallFacts {
25
+ /** The session answers writes instead of running them. */
26
+ dryRun: boolean;
27
+ /** The tool's declaration, if it made one. */
28
+ effect: ToolEffectDeclaration<never> | undefined;
29
+ /** What a stubbed write should answer with, if the tool supplied one. */
30
+ dryRunResult?: ToolExecuteResult | ((input: never) => ToolExecuteResult);
31
+ /**
32
+ * Validated input, as the tool body would receive it. Only read by a
33
+ * per-call `effect` predicate and by a `dryRunResult` function, so a caller
34
+ * with neither — a bridged MCP tool, which carries no declaration at all —
35
+ * can omit it.
36
+ */
37
+ input?: unknown;
38
+ }
39
+ /**
40
+ * The effect of one specific call.
41
+ *
42
+ * Undeclared resolves to `"write"`. A dry run promises that nothing outside
43
+ * the session changed, and it cannot promise that about a tool it knows
44
+ * nothing about — so the unknown case is the one that costs a stubbed read
45
+ * rather than the one that leaks a real write.
46
+ */
47
+ export declare function resolveEffect(effect: ToolEffectDeclaration<never> | undefined, input: unknown): ToolEffect;
48
+ /** Decide what to do with one tool call. Pure; no I/O, no session state. */
49
+ export declare function decideToolCall(facts: ToolCallFacts): ToolDecision;
50
+ //# sourceMappingURL=tool-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-policy.d.ts","sourceRoot":"","sources":["../../src/internal/tool-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,6CAA6C;AAC7C,MAAM,MAAM,YAAY;AACtB,yBAAyB;AACvB;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE;AACjB,uDAAuD;GACrD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAElD,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,MAAM,EAAE,OAAO,CAAC;IAChB,8CAA8C;IAC9C,MAAM,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IACjD,yEAAyE;IACzE,YAAY,CAAC,EAAE,iBAAiB,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,iBAAiB,CAAC,CAAC;IACzE;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAUD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAAG,SAAS,EAChD,KAAK,EAAE,OAAO,GACb,UAAU,CAIZ;AAED,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAWjE"}