@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.cjs +45 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +45 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
56
|
+
var SDK_VERSION = "ts-1.3.3";
|
|
57
57
|
|
|
58
58
|
// src/events.ts
|
|
59
59
|
var import_zod = require("zod");
|
|
@@ -4102,6 +4102,22 @@ var wired = /* @__PURE__ */ new WeakSet();
|
|
|
4102
4102
|
var CLEAN_OUTCOME = { failed: false, raised: false, result: void 0 };
|
|
4103
4103
|
var INTENT_PARAM_NAMES = [USER_GOAL_PARAM_NAME, ...RETIRED_PARAM_NAMES];
|
|
4104
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
|
+
}
|
|
4105
4121
|
var SurfaceState = class {
|
|
4106
4122
|
constructor(serverMeta, sentSurfaces, fromRegistry) {
|
|
4107
4123
|
this.serverMeta = serverMeta;
|
|
@@ -4166,23 +4182,20 @@ var SurfaceState = class {
|
|
|
4166
4182
|
}
|
|
4167
4183
|
/** `inputSchemaJson` is already converted — by `ctx.vendorToolJsonSchema`,
|
|
4168
4184
|
* which picks the spelling THIS SDK major puts on the wire. */
|
|
4169
|
-
noteTool(name, inputSchemaJson, description,
|
|
4185
|
+
noteTool(name, inputSchemaJson, description, listed) {
|
|
4170
4186
|
const before = this.rawTools.get(name);
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
if (
|
|
4174
|
-
}
|
|
4175
|
-
const tool = { name, description: description ?? null, inputSchema: inputSchemaJson };
|
|
4176
|
-
|
|
4177
|
-
if (outputSchema !== void 0) tool.outputSchema = outputSchema;
|
|
4178
|
-
this.rawTools.set(name, { disabled: before?.disabled ?? false, tool });
|
|
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;
|
|
4190
|
+
}
|
|
4191
|
+
const tool = { name, description: description ?? null, inputSchema: inputSchemaJson, ...listed };
|
|
4192
|
+
this.rawTools.set(name, { disabled: before?.disabled ?? false, tool, listedJson });
|
|
4179
4193
|
this.changed();
|
|
4180
4194
|
}
|
|
4181
|
-
|
|
4195
|
+
/** An McpServer `update()` that kept the input schema. */
|
|
4196
|
+
noteListing(name, description, listed) {
|
|
4182
4197
|
const tool = this.rawTools.get(name)?.tool;
|
|
4183
|
-
if (tool
|
|
4184
|
-
const description = typeof tool.description === "string" ? tool.description : void 0;
|
|
4185
|
-
this.noteTool(name, tool.inputSchema, description, outputSchemaJson);
|
|
4198
|
+
if (tool !== void 0) this.noteTool(name, tool.inputSchema, description, listed);
|
|
4186
4199
|
}
|
|
4187
4200
|
pruneTool(name) {
|
|
4188
4201
|
if (this.rawTools.delete(name)) this.changed();
|
|
@@ -4532,7 +4545,7 @@ function captureAndInject(name, entry, ctx) {
|
|
|
4532
4545
|
if (!entry || typeof entry !== "object") return;
|
|
4533
4546
|
const mutable = entry;
|
|
4534
4547
|
const vendorSchema = ctx.vendorToolJsonSchema(name, mutable.inputSchema);
|
|
4535
|
-
ctx.surfaceState.noteTool(name, vendorSchema, mutable.description, ctx.
|
|
4548
|
+
ctx.surfaceState.noteTool(name, vendorSchema, mutable.description, ctx.vendorListedFields(entry));
|
|
4536
4549
|
if (declaresParam(vendorSchema, USER_GOAL_PARAM_NAME)) ctx.dropSubagentClause(name);
|
|
4537
4550
|
const isV2 = typeof mutable.executor === "function";
|
|
4538
4551
|
try {
|
|
@@ -4755,8 +4768,8 @@ function toolInfos(tools, skip) {
|
|
|
4755
4768
|
try {
|
|
4756
4769
|
name = isRecord(tool) ? tool.name : void 0;
|
|
4757
4770
|
if (typeof name !== "string") continue;
|
|
4758
|
-
const { description, inputSchema: inputSchema2
|
|
4759
|
-
infos.push({ name, description, inputSchema: inputSchema2,
|
|
4771
|
+
const { description, inputSchema: inputSchema2 } = tool;
|
|
4772
|
+
infos.push({ name, description, inputSchema: inputSchema2, listed: listedFieldsOf(tool) });
|
|
4760
4773
|
} catch (err) {
|
|
4761
4774
|
if (typeof name === "string") skip(name, err);
|
|
4762
4775
|
}
|
|
@@ -4764,7 +4777,7 @@ function toolInfos(tools, skip) {
|
|
|
4764
4777
|
return infos;
|
|
4765
4778
|
}
|
|
4766
4779
|
function readToolList(tools, ctx, surface, skip) {
|
|
4767
|
-
for (const { name, inputSchema: inputSchema2, description,
|
|
4780
|
+
for (const { name, inputSchema: inputSchema2, description, listed } of tools) {
|
|
4768
4781
|
try {
|
|
4769
4782
|
const schema = isRecord(inputSchema2) ? inputSchema2 : null;
|
|
4770
4783
|
if (surface) {
|
|
@@ -4772,7 +4785,7 @@ function readToolList(tools, ctx, surface, skip) {
|
|
|
4772
4785
|
name,
|
|
4773
4786
|
schema ?? EMPTY_OBJECT_JSON_SCHEMA,
|
|
4774
4787
|
typeof description === "string" ? description : void 0,
|
|
4775
|
-
|
|
4788
|
+
listed
|
|
4776
4789
|
);
|
|
4777
4790
|
}
|
|
4778
4791
|
const dispositions = declaredIntentParams(schema);
|
|
@@ -5201,8 +5214,13 @@ function wireEntry(name, entry, ctx) {
|
|
|
5201
5214
|
}
|
|
5202
5215
|
if (u.paramsSchema !== void 0) {
|
|
5203
5216
|
captureAndInject(nameRef.current, entry, ctx);
|
|
5204
|
-
} else
|
|
5205
|
-
|
|
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
|
+
);
|
|
5206
5224
|
}
|
|
5207
5225
|
if (typeof u.enabled === "boolean") {
|
|
5208
5226
|
ctx.surfaceState.setToolEnabled(nameRef.current, u.enabled);
|
|
@@ -5388,13 +5406,13 @@ function install(server, supplied, resolved, { sentSurfaces, warned: warned4, co
|
|
|
5388
5406
|
return EMPTY_OBJECT_JSON_SCHEMA;
|
|
5389
5407
|
}
|
|
5390
5408
|
};
|
|
5391
|
-
const
|
|
5409
|
+
const vendorListedFields = (entry) => {
|
|
5392
5410
|
try {
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
return
|
|
5411
|
+
if (!isRecord(entry)) return {};
|
|
5412
|
+
const outputSchema = isV2Server ? entry.outputSchemaJson : toolOutputJsonSchema(entry.outputSchema);
|
|
5413
|
+
return listedFieldsOf({ title: entry.title, annotations: entry.annotations, outputSchema });
|
|
5396
5414
|
} catch {
|
|
5397
|
-
return
|
|
5415
|
+
return {};
|
|
5398
5416
|
}
|
|
5399
5417
|
};
|
|
5400
5418
|
installValidationProbe(server);
|
|
@@ -5416,7 +5434,7 @@ function install(server, supplied, resolved, { sentSurfaces, warned: warned4, co
|
|
|
5416
5434
|
captureSettings: config.captureSettings,
|
|
5417
5435
|
perCaller: void 0,
|
|
5418
5436
|
vendorToolJsonSchema,
|
|
5419
|
-
|
|
5437
|
+
vendorListedFields,
|
|
5420
5438
|
bustSchemaMemo,
|
|
5421
5439
|
dropSubagentClause,
|
|
5422
5440
|
servedInstructions: () => lowLevel._instructions,
|