@goodtiming/baton-sdk 0.5.5 → 0.5.6

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-0.5.5";
3
+ declare const SDK_VERSION = "ts-0.5.6";
4
4
 
5
5
  /**
6
6
  * Zod schemas + TS types for the Baton event stream per SPEC §11.4.
@@ -101,7 +101,6 @@ declare const AnnotationPayloadSchema: z.ZodObject<{
101
101
  workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
102
102
  suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
103
103
  context: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
104
- intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
105
104
  tool_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
106
105
  }, z.core.$strict>;
107
106
  type AnnotationPayload = z.infer<typeof AnnotationPayloadSchema>;
@@ -445,7 +444,6 @@ declare const AnnotationEventSchema: z.ZodObject<{
445
444
  workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
446
445
  suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
447
446
  context: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
448
- intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
449
447
  tool_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
450
448
  }, z.core.$strict>;
451
449
  event_id: z.ZodDefault<z.ZodUUID>;
@@ -1199,7 +1197,6 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1199
1197
  workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1200
1198
  suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1201
1199
  context: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1202
- intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1203
1200
  tool_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1204
1201
  }, z.core.$strict>;
1205
1202
  event_id: z.ZodDefault<z.ZodUUID>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const SDK_VERSION = "ts-0.5.5";
3
+ declare const SDK_VERSION = "ts-0.5.6";
4
4
 
5
5
  /**
6
6
  * Zod schemas + TS types for the Baton event stream per SPEC §11.4.
@@ -101,7 +101,6 @@ declare const AnnotationPayloadSchema: z.ZodObject<{
101
101
  workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
102
102
  suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
103
103
  context: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
104
- intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
105
104
  tool_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
106
105
  }, z.core.$strict>;
107
106
  type AnnotationPayload = z.infer<typeof AnnotationPayloadSchema>;
@@ -445,7 +444,6 @@ declare const AnnotationEventSchema: z.ZodObject<{
445
444
  workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
446
445
  suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
447
446
  context: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
448
- intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
449
447
  tool_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
450
448
  }, z.core.$strict>;
451
449
  event_id: z.ZodDefault<z.ZodUUID>;
@@ -1199,7 +1197,6 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1199
1197
  workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1200
1198
  suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1201
1199
  context: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1202
- intent_source: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1203
1200
  tool_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1204
1201
  }, z.core.$strict>;
1205
1202
  event_id: z.ZodDefault<z.ZodUUID>;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var SDK_VERSION = "ts-0.5.5";
2
+ var SDK_VERSION = "ts-0.5.6";
3
3
 
4
4
  // src/events.ts
5
5
  import { z } from "zod";
@@ -110,7 +110,6 @@ var AnnotationPayloadSchema = z.object({
110
110
  workflow: z.string().nullable().default(null),
111
111
  suggested_improvement: z.string().nullable().default(null),
112
112
  context: z.record(z.string(), z.unknown()).nullable().default(null),
113
- intent_source: z.string().nullable().default(null),
114
113
  tool_name: z.string().nullable().default(null)
115
114
  }).strict();
116
115
  var SurfaceSnapshotPayloadSchema = z.object({
@@ -1673,18 +1672,6 @@ var BatonHandle = class {
1673
1672
  }
1674
1673
  };
1675
1674
 
1676
- // src/integrations/mcp/proactiveTracker.ts
1677
- var ProactiveTracker = class {
1678
- emitted = /* @__PURE__ */ new Set();
1679
- /** Claim the session's proactive slot. Returns true exactly once per
1680
- * session (the caller should then emit); false if already claimed. */
1681
- claim(sessionId) {
1682
- if (this.emitted.has(sessionId)) return false;
1683
- this.emitted.add(sessionId);
1684
- return true;
1685
- }
1686
- };
1687
-
1688
1675
  // src/integrations/mcp/sessionCounter.ts
1689
1676
  var SessionCounter = class {
1690
1677
  counters = /* @__PURE__ */ new Map();
@@ -1979,7 +1966,6 @@ async function openCall(ctx, toolName, extra, params, registered = true) {
1979
1966
  const scrubbedIntent = scrubOrNull(ctx.scrubber, rawIntent, USER_GOAL_PARAM_NAME);
1980
1967
  const scrubbedExpected = scrubOrNull(ctx.scrubber, rawExpected, EXPECTED_RESULT_PARAM_NAME);
1981
1968
  const scrubbedWorkflow = scrubOrNull(ctx.scrubber, rawWorkflow, OVERALL_TASK_PARAM_NAME);
1982
- const callId = uuid7();
1983
1969
  const principal = await resolveCallPrincipal(
1984
1970
  ctx.resolvePrincipal,
1985
1971
  { extra, toolName, arguments: params }
@@ -1989,36 +1975,21 @@ async function openCall(ctx, toolName, extra, params, registered = true) {
1989
1975
  vendor_id: ctx.vendorId,
1990
1976
  session_id: sessionId,
1991
1977
  consent_token: ctx.consentToken,
1992
- // Every `...common` site is an event with a caller. `surface_snapshot`
1993
- // is deliberately not among them: it describes the SERVER and is captured
1994
- // outside any call, so it has no caller, transport or client to name.
1978
+ // Every `...common` site is an event of this call, so `call_id` rides in
1979
+ // it. `surface_snapshot` is deliberately not among them: it describes the
1980
+ // SERVER and is captured outside any call, so it has no caller, transport
1981
+ // or client to name.
1995
1982
  principal,
1996
1983
  transport_observed: observeTransport(extra),
1997
1984
  session_id_origin: origin,
1998
1985
  client_observed: observeClient(extra, ctx),
1999
- runtime_meta: scrubbedMeta
1986
+ runtime_meta: scrubbedMeta,
1987
+ call_id: uuid7()
2000
1988
  };
2001
- if (scrubbedIntent !== null && ctx.tracker.claim(sessionId)) {
2002
- await emit(
2003
- ctx.sink,
2004
- () => AnnotationEventSchema.parse({
2005
- ...common,
2006
- sequence_number: ctx.counter.next(sessionId),
2007
- captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2008
- payload: {
2009
- intent: scrubbedIntent,
2010
- expected_outcome: scrubbedExpected,
2011
- intent_source: INTENT_SOURCE_PARAM,
2012
- tool_name: toolName
2013
- }
2014
- })
2015
- );
2016
- }
2017
1989
  await emit(
2018
1990
  ctx.sink,
2019
1991
  () => ToolCallStartEventSchema.parse({
2020
1992
  ...common,
2021
- call_id: callId,
2022
1993
  sequence_number: ctx.counter.next(sessionId),
2023
1994
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2024
1995
  payload: {
@@ -2032,7 +2003,7 @@ async function openCall(ctx, toolName, extra, params, registered = true) {
2032
2003
  }
2033
2004
  })
2034
2005
  );
2035
- return { common, callId, sessionId };
2006
+ return { common, sessionId };
2036
2007
  }
2037
2008
  function batonWrap(nameRef, original, ctx) {
2038
2009
  return async (...callArgs) => {
@@ -2041,7 +2012,7 @@ function batonWrap(nameRef, original, ctx) {
2041
2012
  if (slot) slot.innerFired = true;
2042
2013
  const extra = callArgs[callArgs.length - 1];
2043
2014
  const params = (callArgs.length > 1 ? callArgs[0] : void 0) ?? {};
2044
- const { common, callId, sessionId } = await openCall(ctx, toolName, extra, params);
2015
+ const { common, sessionId } = await openCall(ctx, toolName, extra, params);
2045
2016
  const terminate = async (build, replacement) => {
2046
2017
  if (!slot) {
2047
2018
  await emit(ctx.sink, build);
@@ -2067,7 +2038,6 @@ function batonWrap(nameRef, original, ctx) {
2067
2038
  await parkFailure(
2068
2039
  () => ToolCallErrorEventSchema.parse({
2069
2040
  ...common,
2070
- call_id: callId,
2071
2041
  sequence_number: ctx.counter.next(sessionId),
2072
2042
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2073
2043
  payload: {
@@ -2103,7 +2073,6 @@ function batonWrap(nameRef, original, ctx) {
2103
2073
  await parkFailure(
2104
2074
  () => ToolCallErrorEventSchema.parse({
2105
2075
  ...common,
2106
- call_id: callId,
2107
2076
  sequence_number: ctx.counter.next(sessionId),
2108
2077
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2109
2078
  payload: {
@@ -2134,7 +2103,6 @@ function batonWrap(nameRef, original, ctx) {
2134
2103
  await parkSuccess(
2135
2104
  () => ToolCallEndEventSchema.parse({
2136
2105
  ...common,
2137
- call_id: callId,
2138
2106
  sequence_number: ctx.counter.next(sessionId),
2139
2107
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2140
2108
  payload: {
@@ -2151,7 +2119,6 @@ function batonWrap(nameRef, original, ctx) {
2151
2119
  // CALLER saw fail, which is a success the product invented.
2152
2120
  (outcome) => ToolCallErrorEventSchema.parse({
2153
2121
  ...common,
2154
- call_id: callId,
2155
2122
  sequence_number: ctx.counter.next(sessionId),
2156
2123
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2157
2124
  payload: {
@@ -2545,7 +2512,7 @@ async function emitRequestSideFailure(outcome, args, toolEntry, ctx) {
2545
2512
  const entry = toolEntry(toolName);
2546
2513
  if (entry != null && dispatchTarget(entry)?.[BATON_WRAPPED] !== true) return;
2547
2514
  const params = { ...request?.params?.arguments ?? {} };
2548
- const { common, callId, sessionId } = await openCall(
2515
+ const { common, sessionId } = await openCall(
2549
2516
  ctx,
2550
2517
  toolName,
2551
2518
  args[1],
@@ -2557,7 +2524,6 @@ async function emitRequestSideFailure(outcome, args, toolEntry, ctx) {
2557
2524
  ctx.sink,
2558
2525
  () => ToolCallErrorEventSchema.parse({
2559
2526
  ...common,
2560
- call_id: callId,
2561
2527
  sequence_number: ctx.counter.next(sessionId),
2562
2528
  captured_at: (/* @__PURE__ */ new Date()).toISOString(),
2563
2529
  payload: {
@@ -2767,7 +2733,6 @@ function install(server, supplied, resolved, emittedSurfaceHashes) {
2767
2733
  return { type: "object", properties: {} };
2768
2734
  }
2769
2735
  };
2770
- const tracker = new ProactiveTracker();
2771
2736
  const ctx = {
2772
2737
  sink,
2773
2738
  counter: counter2,
@@ -2785,7 +2750,6 @@ function install(server, supplied, resolved, emittedSurfaceHashes) {
2785
2750
  vendorToolJsonSchema,
2786
2751
  bustSchemaMemo,
2787
2752
  dropSubagentClause,
2788
- tracker,
2789
2753
  surfaceState,
2790
2754
  emitSurface
2791
2755
  };