@goodtiming/baton-sdk 1.3.1 → 1.3.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.
package/README.md CHANGED
@@ -57,7 +57,7 @@ Sending to your own collector instead, or trying the package before you have a k
57
57
  withBaton(server, { dsn: process.env.BATON_DSN, tools: TOOLS }); // or tools: () => TOOLS
58
58
  ```
59
59
 
60
- Baton reads `tools` once per `withBaton` or `createBaton`, and never calls your `tools/list` handler itself. It also needs `tools` to leave its subagent sentence out of the instructions when a tool declares its own `user_goal`.
60
+ Baton reads `tools` once per `withBaton` or `createBaton`, and never calls your `tools/list` handler itself. It also needs `tools` to leave its subagent sentence out of the instructions when a tool declares its own `user_goal`. The snapshot of your tools comes from the lists you serve, never from `tools`, so a server sends none until it has served its whole list in one page.
61
61
  - If your list has a tool with the report tool's name, yours is kept, Baton's report tool is not added, and the instructions stop naming it; the handle's `annotationToolName` still does. Until Baton has seen that list, a call to that name reaches Baton's report tool, so pass `tools` or set `annotationToolName` to another name.
62
62
  - Baton has no tool registry to check a call against here, so `failure_kind` is never `unknown_tool`, `invalid_argument` or `output_schema_mismatch`. Such a failure is recorded as an error with no `failure_kind`.
63
63
 
package/dist/index.cjs CHANGED
@@ -53,7 +53,7 @@ __export(index_exports, {
53
53
  module.exports = __toCommonJS(index_exports);
54
54
 
55
55
  // src/version.ts
56
- var SDK_VERSION = "ts-1.3.1";
56
+ var SDK_VERSION = "ts-1.3.3";
57
57
 
58
58
  // src/events.ts
59
59
  var import_zod = require("zod");
@@ -287,7 +287,8 @@ var PromptListErrorPayloadSchema = import_zod.z.object({
287
287
  var ToolListStartPayloadSchema = import_zod.z.object({}).strict();
288
288
  var ToolListEndPayloadSchema = import_zod.z.object({
289
289
  count: import_zod.z.number().int(),
290
- ...timingShape
290
+ ...timingShape,
291
+ surface_hash: import_zod.z.string().nullable().optional()
291
292
  }).strict();
292
293
  var ToolListErrorPayloadSchema = import_zod.z.object({
293
294
  ...failureShape
@@ -507,6 +508,9 @@ function isPlainObject(value) {
507
508
  function isRecord(value) {
508
509
  return typeof value === "object" && value !== null && !Array.isArray(value);
509
510
  }
511
+ function jsonObjectCopy(value) {
512
+ return isRecord(value) ? JSON.parse(JSON.stringify(value)) : void 0;
513
+ }
510
514
 
511
515
  // src/scrub.ts
512
516
  var DEPTH_LIMIT = 10;
@@ -3085,12 +3089,14 @@ function standardInputJsonSchema(schema) {
3085
3089
  }
3086
3090
  }
3087
3091
  function toolInputJsonSchema(inputSchema2) {
3088
- const objSchema = normalizeObjectSchema(inputSchema2);
3089
- if (!objSchema) return EMPTY_OBJECT_JSON_SCHEMA;
3090
- return toJsonSchemaCompat(objSchema, {
3091
- strictUnions: true,
3092
- pipeStrategy: "input"
3093
- });
3092
+ return toolJsonSchema(inputSchema2, "input") ?? EMPTY_OBJECT_JSON_SCHEMA;
3093
+ }
3094
+ function toolOutputJsonSchema(outputSchema) {
3095
+ return outputSchema ? toolJsonSchema(outputSchema, "output") : void 0;
3096
+ }
3097
+ function toolJsonSchema(schema, pipeStrategy) {
3098
+ const objSchema = normalizeObjectSchema(schema);
3099
+ return objSchema ? toJsonSchemaCompat(objSchema, { strictUnions: true, pipeStrategy }) : void 0;
3094
3100
  }
3095
3101
 
3096
3102
  // src/integrations/mcp/safeScrub.ts
@@ -4051,6 +4057,9 @@ function assembleSurface(serverMeta, tools) {
4051
4057
  tools
4052
4058
  };
4053
4059
  }
4060
+ function isWholeList(cursor, nextCursor) {
4061
+ return (cursor === void 0 || cursor === null) && (nextCursor === void 0 || nextCursor === null);
4062
+ }
4054
4063
  var SENT_SURFACES_CAP = 256;
4055
4064
  var SentSurfaces = class {
4056
4065
  hashes = /* @__PURE__ */ new Set();
@@ -4093,13 +4102,31 @@ var wired = /* @__PURE__ */ new WeakSet();
4093
4102
  var CLEAN_OUTCOME = { failed: false, raised: false, result: void 0 };
4094
4103
  var INTENT_PARAM_NAMES = [USER_GOAL_PARAM_NAME, ...RETIRED_PARAM_NAMES];
4095
4104
  var callSlots = new asyncHooks.AsyncLocalStorage();
4105
+ function listedFieldsOf(tool) {
4106
+ const { title, annotations, outputSchema } = tool;
4107
+ return {
4108
+ ...typeof title === "string" ? { title } : {},
4109
+ ...jsonField("annotations", annotations),
4110
+ ...jsonField("outputSchema", outputSchema)
4111
+ };
4112
+ }
4113
+ function jsonField(key, value) {
4114
+ try {
4115
+ const copy = jsonObjectCopy(value);
4116
+ return copy === void 0 ? {} : { [key]: copy };
4117
+ } catch {
4118
+ return {};
4119
+ }
4120
+ }
4096
4121
  var SurfaceState = class {
4097
- constructor(serverMeta, sentSurfaces) {
4122
+ constructor(serverMeta, sentSurfaces, fromRegistry) {
4098
4123
  this.serverMeta = serverMeta;
4099
4124
  this.sentSurfaces = sentSurfaces;
4125
+ this.fromRegistry = fromRegistry;
4100
4126
  }
4101
4127
  serverMeta;
4102
4128
  sentSurfaces;
4129
+ fromRegistry;
4103
4130
  /** Every tool this install has seen, keyed by its CURRENT name. `disabled`
4104
4131
  * is tracked alongside rather than pruned, so re-enabling costs nothing and
4105
4132
  * — crucially — never needs a re-capture, which would re-read Baton's own
@@ -4107,20 +4134,71 @@ var SurfaceState = class {
4107
4134
  rawTools = /* @__PURE__ */ new Map();
4108
4135
  dirty = false;
4109
4136
  servedOverlayId = null;
4137
+ listed = false;
4138
+ /** `null` when this version of the surface could not be captured. */
4139
+ captured;
4140
+ /** The surface each low-level request was served, keyed by the request,
4141
+ * which every seam passes on as it came. Kept apart from the current
4142
+ * surface, which another listing can change before this one's end is sent:
4143
+ * `surfaceAtList.test.ts`, "gives two listings that finish together each its own hash". */
4144
+ listedSurfaces = /* @__PURE__ */ new WeakMap();
4145
+ get hasSurface() {
4146
+ return this.fromRegistry || this.listed;
4147
+ }
4148
+ /** A low-level Server served `request` its whole list, which then is the
4149
+ * surface: `surfaceAtList.test.ts`, "snapshots each list as served". */
4150
+ servedList(request, names) {
4151
+ this.listed = true;
4152
+ for (const name of [...this.rawTools.keys()]) {
4153
+ if (!names.has(name)) this.pruneTool(name);
4154
+ }
4155
+ const surface = this.capture();
4156
+ if (surface !== null) this.listedSurfaces.set(request, surface);
4157
+ }
4158
+ /** The surface a `tools/list` request was served, when it got the whole list. */
4159
+ surfaceListed(request, served) {
4160
+ const listed = this.listedSurfaces.get(request);
4161
+ if (listed !== void 0) return listed;
4162
+ const cursor = isRecord(request.params) ? request.params.cursor : void 0;
4163
+ const whole = isWholeList(cursor, isRecord(served) ? served.nextCursor : void 0);
4164
+ return this.fromRegistry && whole ? this.capture() : null;
4165
+ }
4166
+ /** The surface as it stands, and its hash; built once per change, so a
4167
+ * surface that cannot be hashed is reported once, not on every request. */
4168
+ capture() {
4169
+ if (this.captured !== void 0) return this.captured;
4170
+ try {
4171
+ const snapshot = this.buildSnapshot();
4172
+ this.captured = { snapshot, digest: surfaceHash(snapshot) };
4173
+ } catch (err) {
4174
+ stderrLine(`baton: surface snapshot capture failed: ${printable(err)}`);
4175
+ this.captured = null;
4176
+ }
4177
+ return this.captured;
4178
+ }
4179
+ changed() {
4180
+ this.dirty = true;
4181
+ this.captured = void 0;
4182
+ }
4110
4183
  /** `inputSchemaJson` is already converted — by `ctx.vendorToolJsonSchema`,
4111
4184
  * which picks the spelling THIS SDK major puts on the wire. */
4112
- noteTool(name, inputSchemaJson, description) {
4185
+ noteTool(name, inputSchemaJson, description, listed) {
4113
4186
  const before = this.rawTools.get(name);
4114
- const tool = { name, description: description ?? null, inputSchema: inputSchemaJson };
4115
- if (before !== void 0 && before.tool.description === tool.description) {
4116
- const same = before.tool.inputSchema === inputSchemaJson || JSON.stringify(before.tool.inputSchema) === JSON.stringify(inputSchemaJson);
4117
- if (same) return;
4187
+ const listedJson = JSON.stringify(listed);
4188
+ if (before !== void 0 && before.tool.description === (description ?? null) && before.listedJson === listedJson) {
4189
+ if (before.tool.inputSchema === inputSchemaJson || JSON.stringify(before.tool.inputSchema) === JSON.stringify(inputSchemaJson)) return;
4118
4190
  }
4119
- this.rawTools.set(name, { disabled: before?.disabled ?? false, tool });
4120
- this.dirty = true;
4191
+ const tool = { name, description: description ?? null, inputSchema: inputSchemaJson, ...listed };
4192
+ this.rawTools.set(name, { disabled: before?.disabled ?? false, tool, listedJson });
4193
+ this.changed();
4194
+ }
4195
+ /** An McpServer `update()` that kept the input schema. */
4196
+ noteListing(name, description, listed) {
4197
+ const tool = this.rawTools.get(name)?.tool;
4198
+ if (tool !== void 0) this.noteTool(name, tool.inputSchema, description, listed);
4121
4199
  }
4122
4200
  pruneTool(name) {
4123
- if (this.rawTools.delete(name)) this.dirty = true;
4201
+ if (this.rawTools.delete(name)) this.changed();
4124
4202
  }
4125
4203
  /** Follow a `update({name})` rename, keeping the snapshot keyed the way
4126
4204
  * `tools/list` now renders it. */
@@ -4129,7 +4207,7 @@ var SurfaceState = class {
4129
4207
  if (!entry) return;
4130
4208
  this.rawTools.delete(from);
4131
4209
  this.rawTools.set(to, { ...entry, tool: { ...entry.tool, name: to } });
4132
- this.dirty = true;
4210
+ this.changed();
4133
4211
  }
4134
4212
  /** Both majors filter `tools/list` on `tool.enabled`, so a disabled tool is
4135
4213
  * not part of the surface a client sees and must not be part of the one we
@@ -4139,7 +4217,7 @@ var SurfaceState = class {
4139
4217
  const entry = this.rawTools.get(name);
4140
4218
  if (!entry || entry.disabled === !enabled) return;
4141
4219
  entry.disabled = !enabled;
4142
- this.dirty = true;
4220
+ this.changed();
4143
4221
  }
4144
4222
  buildSnapshot() {
4145
4223
  const names = [...this.rawTools.keys()].sort().filter((n) => !this.rawTools.get(n).disabled);
@@ -4414,6 +4492,7 @@ function stripIntentParams(params, ctx) {
4414
4492
  return stripped;
4415
4493
  }
4416
4494
  async function maybeEmitSurfaceSnapshot(ctx) {
4495
+ if (!ctx.surfaceState.hasSurface) return;
4417
4496
  const overlayId = ctx.perCaller?.serverOverlay?.id ?? null;
4418
4497
  if (overlayId !== ctx.surfaceState.servedOverlayId) {
4419
4498
  ctx.surfaceState.servedOverlayId = overlayId;
@@ -4421,17 +4500,13 @@ async function maybeEmitSurfaceSnapshot(ctx) {
4421
4500
  }
4422
4501
  if (!ctx.surfaceState.dirty) return;
4423
4502
  ctx.surfaceState.dirty = false;
4424
- let snapshot;
4425
- let digest;
4426
- try {
4427
- snapshot = ctx.surfaceState.buildSnapshot();
4428
- digest = surfaceHash(snapshot);
4429
- } catch (err) {
4430
- stderrLine(`baton: surface snapshot capture failed: ${String(err)}`);
4431
- return;
4432
- }
4503
+ const surface = ctx.surfaceState.capture();
4504
+ if (surface !== null) await sendSurface(ctx, surface);
4505
+ }
4506
+ async function sendSurface(ctx, { snapshot, digest }) {
4507
+ const overlayId = ctx.perCaller?.serverOverlay?.id ?? null;
4433
4508
  const sent = ctx.surfaceState.sentSurfaces;
4434
- if (sent.wasSent(digest, overlayId)) return;
4509
+ if (sent.wasSent(digest, overlayId)) return digest;
4435
4510
  sent.mark(digest, overlayId);
4436
4511
  const seam = buildSeamAugmentations({
4437
4512
  injectedToolNames: ctx.annotationToolName ? [ctx.annotationToolName] : [],
@@ -4448,6 +4523,16 @@ async function maybeEmitSurfaceSnapshot(ctx) {
4448
4523
  });
4449
4524
  if (ctx.captureSettings !== void 0) seam.server_overlay = overlayId;
4450
4525
  await ctx.emitSurface(ctx.fallbackSessionId, digest, { ...snapshot, seam_augmentations: seam });
4526
+ return digest;
4527
+ }
4528
+ async function listedSurfaceFields(ctx, request, served) {
4529
+ try {
4530
+ const surface = isRecord(request) ? ctx.surfaceState.surfaceListed(request, served) : null;
4531
+ return surface === null ? {} : { surface_hash: await sendSurface(ctx, surface) };
4532
+ } catch (err) {
4533
+ stderrLine(`baton: surface snapshot capture failed: ${printable(err)}`);
4534
+ return {};
4535
+ }
4451
4536
  }
4452
4537
  function declaredIntentParams(vendorSchema) {
4453
4538
  const declared2 = {};
@@ -4460,7 +4545,7 @@ function captureAndInject(name, entry, ctx) {
4460
4545
  if (!entry || typeof entry !== "object") return;
4461
4546
  const mutable = entry;
4462
4547
  const vendorSchema = ctx.vendorToolJsonSchema(name, mutable.inputSchema);
4463
- ctx.surfaceState.noteTool(name, vendorSchema, mutable.description);
4548
+ ctx.surfaceState.noteTool(name, vendorSchema, mutable.description, ctx.vendorListedFields(entry));
4464
4549
  if (declaresParam(vendorSchema, USER_GOAL_PARAM_NAME)) ctx.dropSubagentClause(name);
4465
4550
  const isV2 = typeof mutable.executor === "function";
4466
4551
  try {
@@ -4574,10 +4659,6 @@ function installLowLevelToolSeams(lowLevel, ctx, annotationTool, known, warnOnce
4574
4659
  const name = reportTool2?.name;
4575
4660
  if (name !== void 0 && tools.some((tool) => tool.name === name)) leaveReportNameToVendor(name);
4576
4661
  };
4577
- const read = (tools, { surface }) => {
4578
- if (surface) takeReportNameIfListed(tools);
4579
- readToolList(tools, ctx, surface, skipNote);
4580
- };
4581
4662
  const learn = (tools) => {
4582
4663
  keepGoalIfDeclared(tools);
4583
4664
  for (const tool of tools) {
@@ -4605,8 +4686,8 @@ function installLowLevelToolSeams(lowLevel, ctx, annotationTool, known, warnOnce
4605
4686
  );
4606
4687
  }
4607
4688
  }
4608
- read(known.givenTools, { surface: true });
4609
- read([...known.served.values()], { surface: false });
4689
+ takeReportNameIfListed(known.givenTools);
4690
+ readToolList([...known.givenTools, ...known.served.values()], ctx, false, skipNote);
4610
4691
  };
4611
4692
  installRequestSeam(lowLevel, TOOLS_LIST_METHOD, LOW_LEVEL_LIST_SEAM, (handler) => async (...args) => {
4612
4693
  catchUp();
@@ -4616,8 +4697,14 @@ function installLowLevelToolSeams(lowLevel, ctx, annotationTool, known, warnOnce
4616
4697
  if (listed === null) return result;
4617
4698
  const tools = toolInfos(listed, skipTool);
4618
4699
  learn(tools);
4619
- read(tools, { surface: true });
4620
- const firstPage = args[0]?.params?.cursor === void 0;
4700
+ takeReportNameIfListed(tools);
4701
+ readToolList(tools, ctx, true, skipNote);
4702
+ const request = args[0];
4703
+ const cursor = isRecord(request) && isRecord(request.params) ? request.params.cursor : void 0;
4704
+ if (isRecord(request) && isWholeList(cursor, result.nextCursor)) {
4705
+ ctx.surfaceState.servedList(request, new Set(tools.map((tool) => tool.name)));
4706
+ }
4707
+ const firstPage = cursor === void 0 || cursor === null;
4621
4708
  return servedToolList(result, listed, ctx, firstPage && reportTool2 ? listedReportTool : void 0);
4622
4709
  } catch (err) {
4623
4710
  stderrLine(`baton: tools/list capture failed; serving the vendor's own result: ${printable(err)}`);
@@ -4681,7 +4768,8 @@ function toolInfos(tools, skip) {
4681
4768
  try {
4682
4769
  name = isRecord(tool) ? tool.name : void 0;
4683
4770
  if (typeof name !== "string") continue;
4684
- infos.push({ name, description: tool.description, inputSchema: tool.inputSchema });
4771
+ const { description, inputSchema: inputSchema2 } = tool;
4772
+ infos.push({ name, description, inputSchema: inputSchema2, listed: listedFieldsOf(tool) });
4685
4773
  } catch (err) {
4686
4774
  if (typeof name === "string") skip(name, err);
4687
4775
  }
@@ -4689,11 +4777,16 @@ function toolInfos(tools, skip) {
4689
4777
  return infos;
4690
4778
  }
4691
4779
  function readToolList(tools, ctx, surface, skip) {
4692
- for (const { name, inputSchema: inputSchema2, description } of tools) {
4780
+ for (const { name, inputSchema: inputSchema2, description, listed } of tools) {
4693
4781
  try {
4694
4782
  const schema = isRecord(inputSchema2) ? inputSchema2 : null;
4695
4783
  if (surface) {
4696
- ctx.surfaceState.noteTool(name, schema ?? EMPTY_OBJECT_JSON_SCHEMA, typeof description === "string" ? description : void 0);
4784
+ ctx.surfaceState.noteTool(
4785
+ name,
4786
+ schema ?? EMPTY_OBJECT_JSON_SCHEMA,
4787
+ typeof description === "string" ? description : void 0,
4788
+ listed
4789
+ );
4697
4790
  }
4698
4791
  const dispositions = declaredIntentParams(schema);
4699
4792
  if (dispositions[USER_GOAL_PARAM_NAME] === "native") ctx.dropSubagentClause(name);
@@ -4729,7 +4822,7 @@ function installLifecycleSeam(lowLevel, ctx, spec) {
4729
4822
  const requestParams = request?.params ?? {};
4730
4823
  const extra = args[1];
4731
4824
  const opened = await openLifecycleCall(ctx, spec, requestParams, extra);
4732
- const fire = async (schema, payload) => {
4825
+ const fire = async (schema, payload, unscrubbed = {}) => {
4733
4826
  if (opened === null) return;
4734
4827
  await emit(
4735
4828
  ctx.sink,
@@ -4737,7 +4830,7 @@ function installLifecycleSeam(lowLevel, ctx, spec) {
4737
4830
  ...opened.common,
4738
4831
  sequence_number: ctx.counter.nextFor(opened.session),
4739
4832
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
4740
- payload: scrubLifecyclePayload(ctx, { ...opened.subject, ...payload })
4833
+ payload: { ...scrubLifecyclePayload(ctx, { ...opened.subject, ...payload }), ...unscrubbed }
4741
4834
  })
4742
4835
  );
4743
4836
  };
@@ -4748,10 +4841,15 @@ function installLifecycleSeam(lowLevel, ctx, spec) {
4748
4841
  const served = await handler(...args);
4749
4842
  if (isInputRequired(served)) return served;
4750
4843
  const result = opened !== null && spec.rewriteResult !== void 0 ? spec.rewriteResult(ctx, served, opened.caller) : served;
4751
- await fire(spec.schemas.end, {
4752
- ...spec.countKey === void 0 ? {} : { count: countOf(result, spec.countKey) },
4753
- duration_ms: elapsed()
4754
- });
4844
+ const duration = elapsed();
4845
+ await fire(
4846
+ spec.schemas.end,
4847
+ {
4848
+ ...spec.countKey === void 0 ? {} : { count: countOf(result, spec.countKey) },
4849
+ duration_ms: duration
4850
+ },
4851
+ await spec.endFields?.(ctx, request, served)
4852
+ );
4755
4853
  return result;
4756
4854
  } catch (err) {
4757
4855
  await fire(spec.schemas.error, {
@@ -4871,7 +4969,8 @@ var LIFECYCLE_SPECS = [
4871
4969
  },
4872
4970
  countKey: "tools",
4873
4971
  startParams: NO_PARAMS,
4874
- rewriteResult: (ctx, result, caller) => ctx.perCaller?.toolsFor(result, caller) ?? result
4972
+ rewriteResult: (ctx, result, caller) => ctx.perCaller?.toolsFor(result, caller) ?? result,
4973
+ endFields: listedSurfaceFields
4875
4974
  }
4876
4975
  ];
4877
4976
  function installLifecycleSeams(lowLevel, ctx) {
@@ -5115,6 +5214,13 @@ function wireEntry(name, entry, ctx) {
5115
5214
  }
5116
5215
  if (u.paramsSchema !== void 0) {
5117
5216
  captureAndInject(nameRef.current, entry, ctx);
5217
+ } else {
5218
+ const { description } = entry;
5219
+ ctx.surfaceState.noteListing(
5220
+ nameRef.current,
5221
+ typeof description === "string" ? description : void 0,
5222
+ ctx.vendorListedFields(entry)
5223
+ );
5118
5224
  }
5119
5225
  if (typeof u.enabled === "boolean") {
5120
5226
  ctx.surfaceState.setToolEnabled(nameRef.current, u.enabled);
@@ -5240,7 +5346,7 @@ function install(server, supplied, resolved, { sentSurfaces, warned: warned4, co
5240
5346
  const counter2 = new ServerCounter(sharedCounter, fallbackSessionId);
5241
5347
  const tenantId = resolveTenantId(config.tenantId, config.vendorId);
5242
5348
  const serverMeta = buildServerMeta(lowLevel);
5243
- const surfaceState = new SurfaceState(serverMeta, sentSurfaces);
5349
+ const surfaceState = new SurfaceState(serverMeta, sentSurfaces, shape === "mcpServer");
5244
5350
  const emitSurface = async (sessionId, digest, snapshot) => {
5245
5351
  await emit(
5246
5352
  sink,
@@ -5300,6 +5406,15 @@ function install(server, supplied, resolved, { sentSurfaces, warned: warned4, co
5300
5406
  return EMPTY_OBJECT_JSON_SCHEMA;
5301
5407
  }
5302
5408
  };
5409
+ const vendorListedFields = (entry) => {
5410
+ try {
5411
+ if (!isRecord(entry)) return {};
5412
+ const outputSchema = isV2Server ? entry.outputSchemaJson : toolOutputJsonSchema(entry.outputSchema);
5413
+ return listedFieldsOf({ title: entry.title, annotations: entry.annotations, outputSchema });
5414
+ } catch {
5415
+ return {};
5416
+ }
5417
+ };
5303
5418
  installValidationProbe(server);
5304
5419
  const ctx = {
5305
5420
  sink,
@@ -5319,6 +5434,7 @@ function install(server, supplied, resolved, { sentSurfaces, warned: warned4, co
5319
5434
  captureSettings: config.captureSettings,
5320
5435
  perCaller: void 0,
5321
5436
  vendorToolJsonSchema,
5437
+ vendorListedFields,
5322
5438
  bustSchemaMemo,
5323
5439
  dropSubagentClause,
5324
5440
  servedInstructions: () => lowLevel._instructions,
@@ -5807,7 +5923,7 @@ var Serving = class {
5807
5923
  annotationToolName: report?.tool.name ?? "",
5808
5924
  injectsGoal: (name) => known.dispositions.get(name)?.[USER_GOAL_PARAM_NAME] === "injected"
5809
5925
  });
5810
- const whole = firstPage && (result.nextCursor === void 0 || result.nextCursor === null) ? surface : null;
5926
+ const whole = isWholeList(request.params.cursor, result.nextCursor) ? surface : null;
5811
5927
  return {
5812
5928
  answer: { ...answer, result: listed },
5813
5929
  surface: whole,