@goodtiming/baton-sdk 1.3.2 → 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/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const SDK_VERSION = "ts-1.3.2";
3
+ declare const SDK_VERSION = "ts-1.3.3";
4
4
 
5
5
  /**
6
6
  * Zod schemas + TS types for the Baton event stream per SPEC §11.4.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const SDK_VERSION = "ts-1.3.2";
3
+ declare const SDK_VERSION = "ts-1.3.3";
4
4
 
5
5
  /**
6
6
  * Zod schemas + TS types for the Baton event stream per SPEC §11.4.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var SDK_VERSION = "ts-1.3.2";
2
+ var SDK_VERSION = "ts-1.3.3";
3
3
 
4
4
  // src/events.ts
5
5
  import { z } from "zod";
@@ -4048,6 +4048,22 @@ var wired = /* @__PURE__ */ new WeakSet();
4048
4048
  var CLEAN_OUTCOME = { failed: false, raised: false, result: void 0 };
4049
4049
  var INTENT_PARAM_NAMES = [USER_GOAL_PARAM_NAME, ...RETIRED_PARAM_NAMES];
4050
4050
  var callSlots = new asyncHooks.AsyncLocalStorage();
4051
+ function listedFieldsOf(tool) {
4052
+ const { title, annotations, outputSchema } = tool;
4053
+ return {
4054
+ ...typeof title === "string" ? { title } : {},
4055
+ ...jsonField("annotations", annotations),
4056
+ ...jsonField("outputSchema", outputSchema)
4057
+ };
4058
+ }
4059
+ function jsonField(key, value) {
4060
+ try {
4061
+ const copy = jsonObjectCopy(value);
4062
+ return copy === void 0 ? {} : { [key]: copy };
4063
+ } catch {
4064
+ return {};
4065
+ }
4066
+ }
4051
4067
  var SurfaceState = class {
4052
4068
  constructor(serverMeta, sentSurfaces, fromRegistry) {
4053
4069
  this.serverMeta = serverMeta;
@@ -4112,23 +4128,20 @@ var SurfaceState = class {
4112
4128
  }
4113
4129
  /** `inputSchemaJson` is already converted — by `ctx.vendorToolJsonSchema`,
4114
4130
  * which picks the spelling THIS SDK major puts on the wire. */
4115
- noteTool(name, inputSchemaJson, description, outputSchemaJson) {
4131
+ noteTool(name, inputSchemaJson, description, listed) {
4116
4132
  const before = this.rawTools.get(name);
4117
- if (before !== void 0 && before.tool.description === (description ?? null)) {
4118
- const sameInput = before.tool.inputSchema === inputSchemaJson || JSON.stringify(before.tool.inputSchema) === JSON.stringify(inputSchemaJson);
4119
- if (sameInput && JSON.stringify(before.tool.outputSchema) === JSON.stringify(outputSchemaJson)) return;
4120
- }
4121
- const tool = { name, description: description ?? null, inputSchema: inputSchemaJson };
4122
- const outputSchema = jsonObjectCopy(outputSchemaJson);
4123
- if (outputSchema !== void 0) tool.outputSchema = outputSchema;
4124
- this.rawTools.set(name, { disabled: before?.disabled ?? false, tool });
4133
+ const listedJson = JSON.stringify(listed);
4134
+ if (before !== void 0 && before.tool.description === (description ?? null) && before.listedJson === listedJson) {
4135
+ if (before.tool.inputSchema === inputSchemaJson || JSON.stringify(before.tool.inputSchema) === JSON.stringify(inputSchemaJson)) return;
4136
+ }
4137
+ const tool = { name, description: description ?? null, inputSchema: inputSchemaJson, ...listed };
4138
+ this.rawTools.set(name, { disabled: before?.disabled ?? false, tool, listedJson });
4125
4139
  this.changed();
4126
4140
  }
4127
- setOutputSchema(name, outputSchemaJson) {
4141
+ /** An McpServer `update()` that kept the input schema. */
4142
+ noteListing(name, description, listed) {
4128
4143
  const tool = this.rawTools.get(name)?.tool;
4129
- if (tool === void 0) return;
4130
- const description = typeof tool.description === "string" ? tool.description : void 0;
4131
- this.noteTool(name, tool.inputSchema, description, outputSchemaJson);
4144
+ if (tool !== void 0) this.noteTool(name, tool.inputSchema, description, listed);
4132
4145
  }
4133
4146
  pruneTool(name) {
4134
4147
  if (this.rawTools.delete(name)) this.changed();
@@ -4478,7 +4491,7 @@ function captureAndInject(name, entry, ctx) {
4478
4491
  if (!entry || typeof entry !== "object") return;
4479
4492
  const mutable = entry;
4480
4493
  const vendorSchema = ctx.vendorToolJsonSchema(name, mutable.inputSchema);
4481
- ctx.surfaceState.noteTool(name, vendorSchema, mutable.description, ctx.vendorOutputJsonSchema(entry));
4494
+ ctx.surfaceState.noteTool(name, vendorSchema, mutable.description, ctx.vendorListedFields(entry));
4482
4495
  if (declaresParam(vendorSchema, USER_GOAL_PARAM_NAME)) ctx.dropSubagentClause(name);
4483
4496
  const isV2 = typeof mutable.executor === "function";
4484
4497
  try {
@@ -4701,8 +4714,8 @@ function toolInfos(tools, skip) {
4701
4714
  try {
4702
4715
  name = isRecord(tool) ? tool.name : void 0;
4703
4716
  if (typeof name !== "string") continue;
4704
- const { description, inputSchema: inputSchema2, outputSchema } = tool;
4705
- infos.push({ name, description, inputSchema: inputSchema2, outputSchema });
4717
+ const { description, inputSchema: inputSchema2 } = tool;
4718
+ infos.push({ name, description, inputSchema: inputSchema2, listed: listedFieldsOf(tool) });
4706
4719
  } catch (err) {
4707
4720
  if (typeof name === "string") skip(name, err);
4708
4721
  }
@@ -4710,7 +4723,7 @@ function toolInfos(tools, skip) {
4710
4723
  return infos;
4711
4724
  }
4712
4725
  function readToolList(tools, ctx, surface, skip) {
4713
- for (const { name, inputSchema: inputSchema2, description, outputSchema } of tools) {
4726
+ for (const { name, inputSchema: inputSchema2, description, listed } of tools) {
4714
4727
  try {
4715
4728
  const schema = isRecord(inputSchema2) ? inputSchema2 : null;
4716
4729
  if (surface) {
@@ -4718,7 +4731,7 @@ function readToolList(tools, ctx, surface, skip) {
4718
4731
  name,
4719
4732
  schema ?? EMPTY_OBJECT_JSON_SCHEMA,
4720
4733
  typeof description === "string" ? description : void 0,
4721
- isRecord(outputSchema) ? outputSchema : void 0
4734
+ listed
4722
4735
  );
4723
4736
  }
4724
4737
  const dispositions = declaredIntentParams(schema);
@@ -5147,8 +5160,13 @@ function wireEntry(name, entry, ctx) {
5147
5160
  }
5148
5161
  if (u.paramsSchema !== void 0) {
5149
5162
  captureAndInject(nameRef.current, entry, ctx);
5150
- } else if (u.outputSchema !== void 0) {
5151
- ctx.surfaceState.setOutputSchema(nameRef.current, ctx.vendorOutputJsonSchema(entry));
5163
+ } else {
5164
+ const { description } = entry;
5165
+ ctx.surfaceState.noteListing(
5166
+ nameRef.current,
5167
+ typeof description === "string" ? description : void 0,
5168
+ ctx.vendorListedFields(entry)
5169
+ );
5152
5170
  }
5153
5171
  if (typeof u.enabled === "boolean") {
5154
5172
  ctx.surfaceState.setToolEnabled(nameRef.current, u.enabled);
@@ -5334,13 +5352,13 @@ function install(server, supplied, resolved, { sentSurfaces, warned: warned4, co
5334
5352
  return EMPTY_OBJECT_JSON_SCHEMA;
5335
5353
  }
5336
5354
  };
5337
- const vendorOutputJsonSchema = (entry) => {
5355
+ const vendorListedFields = (entry) => {
5338
5356
  try {
5339
- const tool = entry;
5340
- if (!isV2Server) return toolOutputJsonSchema(tool.outputSchema);
5341
- return isRecord(tool.outputSchemaJson) ? tool.outputSchemaJson : void 0;
5357
+ if (!isRecord(entry)) return {};
5358
+ const outputSchema = isV2Server ? entry.outputSchemaJson : toolOutputJsonSchema(entry.outputSchema);
5359
+ return listedFieldsOf({ title: entry.title, annotations: entry.annotations, outputSchema });
5342
5360
  } catch {
5343
- return void 0;
5361
+ return {};
5344
5362
  }
5345
5363
  };
5346
5364
  installValidationProbe(server);
@@ -5362,7 +5380,7 @@ function install(server, supplied, resolved, { sentSurfaces, warned: warned4, co
5362
5380
  captureSettings: config.captureSettings,
5363
5381
  perCaller: void 0,
5364
5382
  vendorToolJsonSchema,
5365
- vendorOutputJsonSchema,
5383
+ vendorListedFields,
5366
5384
  bustSchemaMemo,
5367
5385
  dropSubagentClause,
5368
5386
  servedInstructions: () => lowLevel._instructions,