deadpipe 2.0.0 → 2.0.1

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.mts CHANGED
@@ -65,6 +65,9 @@ interface PromptTelemetry {
65
65
  prompt_hash?: string;
66
66
  tool_schema_hash?: string;
67
67
  system_prompt_hash?: string;
68
+ input_preview?: string;
69
+ output_preview?: string;
70
+ system_prompt_preview?: string;
68
71
  status?: StatusType;
69
72
  }
70
73
  interface TrackOptions {
@@ -130,6 +133,8 @@ declare class PromptTracker {
130
133
  private promptHash;
131
134
  private toolSchemaHash;
132
135
  private systemPromptHash;
136
+ private messages;
137
+ private systemPrompt;
133
138
  private startTime;
134
139
  private firstTokenTime;
135
140
  private endTime;
package/dist/index.d.ts CHANGED
@@ -65,6 +65,9 @@ interface PromptTelemetry {
65
65
  prompt_hash?: string;
66
66
  tool_schema_hash?: string;
67
67
  system_prompt_hash?: string;
68
+ input_preview?: string;
69
+ output_preview?: string;
70
+ system_prompt_preview?: string;
68
71
  status?: StatusType;
69
72
  }
70
73
  interface TrackOptions {
@@ -130,6 +133,8 @@ declare class PromptTracker {
130
133
  private promptHash;
131
134
  private toolSchemaHash;
132
135
  private systemPromptHash;
136
+ private messages;
137
+ private systemPrompt;
133
138
  private startTime;
134
139
  private firstTokenTime;
135
140
  private endTime;
package/dist/index.js CHANGED
@@ -240,6 +240,9 @@ var PromptTracker = class {
240
240
  promptHash;
241
241
  toolSchemaHash;
242
242
  systemPromptHash;
243
+ // Context for previews
244
+ messages;
245
+ systemPrompt;
243
246
  // Timing
244
247
  startTime = null;
245
248
  firstTokenTime = null;
@@ -263,6 +266,8 @@ var PromptTracker = class {
263
266
  this.promptHash = options.messages ? hashMessages(options.messages) : void 0;
264
267
  this.toolSchemaHash = hashTools(options.tools);
265
268
  this.systemPromptHash = options.systemPrompt ? hashContentSync(options.systemPrompt) : void 0;
269
+ this.messages = options.messages;
270
+ this.systemPrompt = options.systemPrompt;
266
271
  this.telemetry = {
267
272
  prompt_id: this.promptId,
268
273
  provider: this.provider,
@@ -304,6 +309,20 @@ var PromptTracker = class {
304
309
  this.telemetry.output_length = content?.length ?? 0;
305
310
  this.telemetry.empty_output = !content || content.trim().length === 0;
306
311
  this.telemetry.truncated = extracted.finishReason === "length";
312
+ const MAX_PREVIEW_LENGTH = 2e3;
313
+ if (content) {
314
+ this.telemetry.output_preview = content.length > MAX_PREVIEW_LENGTH ? content.substring(0, MAX_PREVIEW_LENGTH) + "..." : content;
315
+ }
316
+ if (this.messages && this.messages.length > 0) {
317
+ const userMessages = this.messages.filter((m) => m.role === "user");
318
+ if (userMessages.length > 0) {
319
+ const lastUserMsg = userMessages[userMessages.length - 1].content;
320
+ this.telemetry.input_preview = lastUserMsg.length > MAX_PREVIEW_LENGTH ? lastUserMsg.substring(0, MAX_PREVIEW_LENGTH) + "..." : lastUserMsg;
321
+ }
322
+ }
323
+ if (this.systemPrompt) {
324
+ this.telemetry.system_prompt_preview = this.systemPrompt.length > MAX_PREVIEW_LENGTH ? this.systemPrompt.substring(0, MAX_PREVIEW_LENGTH) + "..." : this.systemPrompt;
325
+ }
307
326
  this.telemetry.tool_call_flag = extracted.toolCalls.length > 0;
308
327
  this.telemetry.tool_calls_count = extracted.toolCalls.length;
309
328
  if (content) {
package/dist/index.mjs CHANGED
@@ -207,6 +207,9 @@ var PromptTracker = class {
207
207
  promptHash;
208
208
  toolSchemaHash;
209
209
  systemPromptHash;
210
+ // Context for previews
211
+ messages;
212
+ systemPrompt;
210
213
  // Timing
211
214
  startTime = null;
212
215
  firstTokenTime = null;
@@ -230,6 +233,8 @@ var PromptTracker = class {
230
233
  this.promptHash = options.messages ? hashMessages(options.messages) : void 0;
231
234
  this.toolSchemaHash = hashTools(options.tools);
232
235
  this.systemPromptHash = options.systemPrompt ? hashContentSync(options.systemPrompt) : void 0;
236
+ this.messages = options.messages;
237
+ this.systemPrompt = options.systemPrompt;
233
238
  this.telemetry = {
234
239
  prompt_id: this.promptId,
235
240
  provider: this.provider,
@@ -271,6 +276,20 @@ var PromptTracker = class {
271
276
  this.telemetry.output_length = content?.length ?? 0;
272
277
  this.telemetry.empty_output = !content || content.trim().length === 0;
273
278
  this.telemetry.truncated = extracted.finishReason === "length";
279
+ const MAX_PREVIEW_LENGTH = 2e3;
280
+ if (content) {
281
+ this.telemetry.output_preview = content.length > MAX_PREVIEW_LENGTH ? content.substring(0, MAX_PREVIEW_LENGTH) + "..." : content;
282
+ }
283
+ if (this.messages && this.messages.length > 0) {
284
+ const userMessages = this.messages.filter((m) => m.role === "user");
285
+ if (userMessages.length > 0) {
286
+ const lastUserMsg = userMessages[userMessages.length - 1].content;
287
+ this.telemetry.input_preview = lastUserMsg.length > MAX_PREVIEW_LENGTH ? lastUserMsg.substring(0, MAX_PREVIEW_LENGTH) + "..." : lastUserMsg;
288
+ }
289
+ }
290
+ if (this.systemPrompt) {
291
+ this.telemetry.system_prompt_preview = this.systemPrompt.length > MAX_PREVIEW_LENGTH ? this.systemPrompt.substring(0, MAX_PREVIEW_LENGTH) + "..." : this.systemPrompt;
292
+ }
274
293
  this.telemetry.tool_call_flag = extracted.toolCalls.length > 0;
275
294
  this.telemetry.tool_calls_count = extracted.toolCalls.length;
276
295
  if (content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deadpipe",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "LLM observability that answers: Is this prompt behaving the same as when it was last safe?",
5
5
  "keywords": [
6
6
  "llm",