@goodtiming/baton-sdk 0.6.6 → 0.6.8
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 +5 -1
- package/dist/index.cjs +18 -13
- 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 +18 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,7 +171,7 @@ Each affected event says so, in its own field (`result_capture: "off"`), rather
|
|
|
171
171
|
|
|
172
172
|
**What is still captured, and it is deliberate:** the tool name, the duration, and whether the call failed — so failure detection, pairing and timing all keep working. The message of an error your handler **throws** is withheld too: thrown messages often echo the data a call was handling.
|
|
173
173
|
|
|
174
|
-
**What it does not withhold:** the message of a failed resource or prompt request. `resource_list_error`, `resource_read_error`, `prompt_list_error` and `prompt_get_error` keep it under `"off"`, so `withBaton` and `createBaton` print a warning saying so when you set the mode (see [Resources and prompts](#resources-and-prompts)).
|
|
174
|
+
**What it does not withhold:** the message of a failed tool list, resource or prompt request. `tool_list_error`, `resource_list_error`, `resource_read_error`, `prompt_list_error` and `prompt_get_error` keep it under `"off"`, so `withBaton` and `createBaton` print a warning saying so when you set the mode (see [Tool listings](#tool-listings) and [Resources and prompts](#resources-and-prompts)).
|
|
175
175
|
|
|
176
176
|
**What it costs you:** anything that needs to read a response body. A call that returns `200` with a useless body can no longer be detected, and those calls sit outside the denominator of body-level analysis rather than counting as passes or failures.
|
|
177
177
|
|
|
@@ -248,6 +248,10 @@ that response held and how long it took. No tool name, description or schema
|
|
|
248
248
|
is on these events. They carry the principal your `resolvePrincipal` hook
|
|
249
249
|
returns ([Who is calling](#who-is-calling)).
|
|
250
250
|
|
|
251
|
+
A failed listing's `tool_list_error` carries the message that was thrown, and
|
|
252
|
+
`resultCaptureMode: "off"` does not withhold it. That message can be your own
|
|
253
|
+
text, from a `tools/list` handler you set on the server.
|
|
254
|
+
|
|
251
255
|
## Turning capture off entirely
|
|
252
256
|
|
|
253
257
|
Not the same thing as **Not capturing responses at all**: that one keeps the signal and drops the response bodies, this one emits nothing at all. It also belongs to a different person — `resultCaptureMode` is set by whoever WRAPS the server, in code; this is set by whoever RUNS it, in the environment.
|
package/dist/index.cjs
CHANGED
|
@@ -103,7 +103,7 @@ __export(index_exports, {
|
|
|
103
103
|
module.exports = __toCommonJS(index_exports);
|
|
104
104
|
|
|
105
105
|
// src/version.ts
|
|
106
|
-
var SDK_VERSION = "ts-0.6.
|
|
106
|
+
var SDK_VERSION = "ts-0.6.8";
|
|
107
107
|
|
|
108
108
|
// src/events.ts
|
|
109
109
|
var import_zod = require("zod");
|
|
@@ -703,9 +703,11 @@ var PROCESS_DROPS = new DropCounts();
|
|
|
703
703
|
|
|
704
704
|
// src/sequence.ts
|
|
705
705
|
var lastSequence = 0;
|
|
706
|
+
function nowMicros() {
|
|
707
|
+
return Math.floor((performance.timeOrigin + performance.now()) * 1e3);
|
|
708
|
+
}
|
|
706
709
|
function nextClockSequence() {
|
|
707
|
-
|
|
708
|
-
lastSequence = Math.max(lastSequence + 1, nowMicros);
|
|
710
|
+
lastSequence = Math.max(lastSequence + 1, nowMicros());
|
|
709
711
|
return lastSequence;
|
|
710
712
|
}
|
|
711
713
|
|
|
@@ -2678,17 +2680,20 @@ var BatonHandle = class {
|
|
|
2678
2680
|
};
|
|
2679
2681
|
|
|
2680
2682
|
// src/integrations/mcp/sessionCounter.ts
|
|
2683
|
+
var SESSION_CAP = 4096;
|
|
2681
2684
|
var SessionCounter = class {
|
|
2682
2685
|
counters = /* @__PURE__ */ new Map();
|
|
2683
|
-
/** A per-call session is numbered by the clock: a counter would
|
|
2684
|
-
*
|
|
2686
|
+
/** A per-call session is numbered by the clock: a counter would fill with
|
|
2687
|
+
* sessions that never come back and push out live ones. */
|
|
2685
2688
|
nextFor(session) {
|
|
2686
|
-
return session.perCall ? nextClockSequence() : this.next(session.sessionId);
|
|
2689
|
+
return session.perCall ? nextClockSequence() : this.next(session.sessionId, session.origin === "observed");
|
|
2687
2690
|
}
|
|
2688
|
-
next(sessionId) {
|
|
2689
|
-
const
|
|
2690
|
-
const next =
|
|
2691
|
+
next(sessionId, observed) {
|
|
2692
|
+
const previous = this.counters.get(sessionId) ?? 0;
|
|
2693
|
+
const next = observed ? Math.max(previous + 1, nowMicros()) : previous + 1;
|
|
2694
|
+
this.counters.delete(sessionId);
|
|
2691
2695
|
this.counters.set(sessionId, next);
|
|
2696
|
+
if (this.counters.size > SESSION_CAP) this.counters.delete(this.counters.keys().next().value);
|
|
2692
2697
|
return next;
|
|
2693
2698
|
}
|
|
2694
2699
|
};
|
|
@@ -2701,8 +2706,8 @@ var ServerCounter = class extends SessionCounter {
|
|
|
2701
2706
|
shared;
|
|
2702
2707
|
ownSessionId;
|
|
2703
2708
|
ownSequence = 0;
|
|
2704
|
-
next(sessionId) {
|
|
2705
|
-
return sessionId === this.ownSessionId ? ++this.ownSequence : this.shared.next(sessionId);
|
|
2709
|
+
next(sessionId, observed) {
|
|
2710
|
+
return sessionId === this.ownSessionId ? ++this.ownSequence : this.shared.next(sessionId, observed);
|
|
2706
2711
|
}
|
|
2707
2712
|
};
|
|
2708
2713
|
|
|
@@ -3797,7 +3802,7 @@ function install(server, supplied, resolved, { sentSurfaces, warned: warned3, co
|
|
|
3797
3802
|
session_id: sessionId,
|
|
3798
3803
|
session_id_origin: "minted",
|
|
3799
3804
|
consent_token: config.consentToken,
|
|
3800
|
-
sequence_number: counter2.next(sessionId),
|
|
3805
|
+
sequence_number: counter2.next(sessionId, false),
|
|
3801
3806
|
captured_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3802
3807
|
payload: {
|
|
3803
3808
|
surface_hash: digest,
|
|
@@ -3951,7 +3956,7 @@ function warnAboutSettings(config) {
|
|
|
3951
3956
|
}
|
|
3952
3957
|
if (config.resultCaptureMode === WITHHELD) {
|
|
3953
3958
|
warn(
|
|
3954
|
-
'baton: resultCaptureMode "off" does not withhold the message of a failed resource or prompt request. resource_list_error, resource_read_error, prompt_list_error and prompt_get_error carry that message, which can
|
|
3959
|
+
'baton: resultCaptureMode "off" does not withhold the message of a failed tool list, resource or prompt request. tool_list_error, resource_list_error, resource_read_error, prompt_list_error and prompt_get_error carry that message, which can include text your handler or middleware threw. Throw a message that does not quote what your code fetched.'
|
|
3955
3960
|
);
|
|
3956
3961
|
}
|
|
3957
3962
|
}
|