opsveritas-sdk 0.1.0 → 0.1.2

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.js CHANGED
@@ -241,6 +241,20 @@ async function trace(agentName, fn, options) {
241
241
 
242
242
  // src/wrap.ts
243
243
  var PATCHED = /* @__PURE__ */ Symbol("opsveritas.patched");
244
+ function extractOutput(resp) {
245
+ if (!resp) return void 0;
246
+ const choices = resp.choices;
247
+ if (Array.isArray(choices) && choices[0]) {
248
+ const content = choices[0].message?.content;
249
+ if (typeof content === "string" && content.trim()) return content.slice(0, 300);
250
+ }
251
+ const blocks = resp.content;
252
+ if (Array.isArray(blocks)) {
253
+ const tb = blocks.find((b) => b.type === "text");
254
+ if (typeof tb?.text === "string" && tb.text.trim()) return tb.text.slice(0, 300);
255
+ }
256
+ return void 0;
257
+ }
244
258
  function patchOpenAI(client, opts) {
245
259
  const completions = client.chat?.completions;
246
260
  if (!completions || completions[PATCHED]) return;
@@ -283,6 +297,7 @@ function patchOpenAI(client, opts) {
283
297
  tool_calls: toolCalls,
284
298
  cost_usd,
285
299
  error_message: errorMessage ?? null,
300
+ output_summary: extractOutput(resp),
286
301
  user_id: opts.userId
287
302
  });
288
303
  }
@@ -331,6 +346,7 @@ function patchAnthropic(client, opts) {
331
346
  tool_calls: toolCalls,
332
347
  cost_usd,
333
348
  error_message: errorMessage ?? null,
349
+ output_summary: extractOutput(resp),
334
350
  user_id: opts.userId
335
351
  });
336
352
  }
@@ -376,6 +392,7 @@ function patchGemini(client, opts) {
376
392
  output_tokens,
377
393
  cost_usd,
378
394
  error_message: errorMessage ?? null,
395
+ output_summary: extractOutput(resp),
379
396
  user_id: opts.userId
380
397
  });
381
398
  }
package/dist/index.mjs CHANGED
@@ -210,6 +210,20 @@ async function trace(agentName, fn, options) {
210
210
 
211
211
  // src/wrap.ts
212
212
  var PATCHED = /* @__PURE__ */ Symbol("opsveritas.patched");
213
+ function extractOutput(resp) {
214
+ if (!resp) return void 0;
215
+ const choices = resp.choices;
216
+ if (Array.isArray(choices) && choices[0]) {
217
+ const content = choices[0].message?.content;
218
+ if (typeof content === "string" && content.trim()) return content.slice(0, 300);
219
+ }
220
+ const blocks = resp.content;
221
+ if (Array.isArray(blocks)) {
222
+ const tb = blocks.find((b) => b.type === "text");
223
+ if (typeof tb?.text === "string" && tb.text.trim()) return tb.text.slice(0, 300);
224
+ }
225
+ return void 0;
226
+ }
213
227
  function patchOpenAI(client, opts) {
214
228
  const completions = client.chat?.completions;
215
229
  if (!completions || completions[PATCHED]) return;
@@ -252,6 +266,7 @@ function patchOpenAI(client, opts) {
252
266
  tool_calls: toolCalls,
253
267
  cost_usd,
254
268
  error_message: errorMessage ?? null,
269
+ output_summary: extractOutput(resp),
255
270
  user_id: opts.userId
256
271
  });
257
272
  }
@@ -300,6 +315,7 @@ function patchAnthropic(client, opts) {
300
315
  tool_calls: toolCalls,
301
316
  cost_usd,
302
317
  error_message: errorMessage ?? null,
318
+ output_summary: extractOutput(resp),
303
319
  user_id: opts.userId
304
320
  });
305
321
  }
@@ -345,6 +361,7 @@ function patchGemini(client, opts) {
345
361
  output_tokens,
346
362
  cost_usd,
347
363
  error_message: errorMessage ?? null,
364
+ output_summary: extractOutput(resp),
348
365
  user_id: opts.userId
349
366
  });
350
367
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "opsveritas-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Monitor your AI agents with 2 lines of code",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/index.js",
11
- "require": "./dist/index.cjs",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js",
12
12
  "types": "./dist/index.d.ts"
13
13
  }
14
14
  },