@matatbread/matbot-plugin-api 0.3.2 → 0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/types.ts +26 -2
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "node",
5
5
  "browser"
6
6
  ],
7
- "version": "0.3.2",
7
+ "version": "0.3.3",
8
8
  "engines": {
9
9
  "node": ">=24.0.0"
10
10
  },
package/src/types.ts CHANGED
@@ -62,9 +62,30 @@ export interface UsageRecord {
62
62
  usage: Usage;
63
63
  }
64
64
 
65
+ /**
66
+ * Opaque, provider-specific round-trip metadata attached to a tool-call — captured from a completion,
67
+ * persisted, and re-sent verbatim when the call is replayed in history (e.g. a Gemini 3 "thought
68
+ * signature", which every historical `functionCall` must carry or the request 400s). The harness never
69
+ * interprets it: it stores, renders, or elides it. Empty by default — a provider package augments its
70
+ * OWN slice from its own module (namespaced by provider family, so slices from different providers in a
71
+ * mixed-provider session never collide), so adding a provider that needs round-trip state touches NO
72
+ * core code:
73
+ *
74
+ * declare module '@matatbread/matbot-plugin-api' {
75
+ * interface ProviderMeta { google?: { thoughtSignature?: string } }
76
+ * }
77
+ *
78
+ * A single session interleaves tool-calls from many providers, so this must be an open, additive union
79
+ * (interface augmentation) — a generic type parameter can bind only one provider per instantiation and
80
+ * so could not type a heterogeneous transcript.
81
+ */
82
+ export interface ProviderMeta {}
83
+
65
84
  export type CompletionEvent =
66
85
  | { type: 'text-delta'; delta: string }
67
- | { type: 'tool-call'; id: string; name: string; input: unknown }
86
+ | { type: 'tool-call'; id: string; name: string; input: unknown;
87
+ /** Provider-specific round-trip metadata for this call, opaque to the harness — see `ProviderMeta`. */
88
+ meta?: ProviderMeta }
68
89
  | { type: 'tool-result'; id: string; result: unknown }
69
90
  | { type: 'thinking'; delta: string }
70
91
  | { type: 'thinking-block'; thinking: string; signature: string }
@@ -99,7 +120,10 @@ export type MessageContent = (
99
120
  | { type: 'image-url'; url: string; detail?: 'low' | 'high' | 'auto' }
100
121
  | { type: 'document'; data: string; mimeType: MimeType; name?: string }
101
122
  | { type: 'audio'; data: string; mimeType: MimeType }
102
- | { type: 'tool-call'; id: string; name: string; input: unknown }
123
+ | { type: 'tool-call'; id: string; name: string; input: unknown;
124
+ /** Provider-specific round-trip metadata, persisted and re-sent verbatim on replay — see
125
+ * `ProviderMeta` and the `tool-call` `CompletionEvent`. */
126
+ meta?: ProviderMeta }
103
127
  | { type: 'tool-result'; id: string; result: unknown; isError?: boolean;
104
128
  /**
105
129
  * Accounting addendum: completions the tool itself ran (e.g. `single_turn`, `dream_time`'s ranker/