opsveritas-sdk 0.3.2 → 0.3.4
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 +1 -1
- package/dist/index.js +19 -0
- package/dist/index.mjs +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ By design the SDK sends **metadata only, plus a short output snippet** — never
|
|
|
43
43
|
| Sent | Detail |
|
|
44
44
|
|------|--------|
|
|
45
45
|
| ✅ Metadata | agent name, status, timestamps, duration, token counts, model, cost, tool-call count |
|
|
46
|
-
| ⚠️ Output snippet | first
|
|
46
|
+
| ⚠️ Output snippet | first ~3,000 chars of the response (`output_summary`) — powers silent-failure detection |
|
|
47
47
|
| ⚠️ Error message | the exception text, if a call fails |
|
|
48
48
|
| ❌ Prompts / inputs | **never sent** — only token counts |
|
|
49
49
|
|
package/dist/index.js
CHANGED
|
@@ -358,6 +358,20 @@ async function trace(agentName, fn, options) {
|
|
|
358
358
|
// src/wrap.ts
|
|
359
359
|
var PATCHED = /* @__PURE__ */ Symbol("opsveritas.patched");
|
|
360
360
|
var OUTPUT_SUMMARY_MAX = 3e3;
|
|
361
|
+
var TOOL_INPUT_TEXT_FIELDS = ["body", "content", "text", "summary", "message", "output"];
|
|
362
|
+
function extractToolInputText(input) {
|
|
363
|
+
if (!input || typeof input !== "object") return void 0;
|
|
364
|
+
const obj = input;
|
|
365
|
+
for (const field of TOOL_INPUT_TEXT_FIELDS) {
|
|
366
|
+
const v = obj[field];
|
|
367
|
+
if (typeof v === "string" && v.trim()) return v;
|
|
368
|
+
}
|
|
369
|
+
try {
|
|
370
|
+
return JSON.stringify(obj);
|
|
371
|
+
} catch {
|
|
372
|
+
return void 0;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
361
375
|
function extractOutput(resp) {
|
|
362
376
|
if (!resp) return void 0;
|
|
363
377
|
const choices = resp.choices;
|
|
@@ -369,6 +383,11 @@ function extractOutput(resp) {
|
|
|
369
383
|
if (Array.isArray(blocks)) {
|
|
370
384
|
const tb = blocks.find((b) => b.type === "text");
|
|
371
385
|
if (typeof tb?.text === "string" && tb.text.trim()) return tb.text.slice(0, OUTPUT_SUMMARY_MAX);
|
|
386
|
+
const toolBlock = blocks.find((b) => b.type === "tool_use");
|
|
387
|
+
if (toolBlock) {
|
|
388
|
+
const s = extractToolInputText(toolBlock.input);
|
|
389
|
+
if (s) return s.slice(0, OUTPUT_SUMMARY_MAX);
|
|
390
|
+
}
|
|
372
391
|
}
|
|
373
392
|
return void 0;
|
|
374
393
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -326,6 +326,20 @@ async function trace(agentName, fn, options) {
|
|
|
326
326
|
// src/wrap.ts
|
|
327
327
|
var PATCHED = /* @__PURE__ */ Symbol("opsveritas.patched");
|
|
328
328
|
var OUTPUT_SUMMARY_MAX = 3e3;
|
|
329
|
+
var TOOL_INPUT_TEXT_FIELDS = ["body", "content", "text", "summary", "message", "output"];
|
|
330
|
+
function extractToolInputText(input) {
|
|
331
|
+
if (!input || typeof input !== "object") return void 0;
|
|
332
|
+
const obj = input;
|
|
333
|
+
for (const field of TOOL_INPUT_TEXT_FIELDS) {
|
|
334
|
+
const v = obj[field];
|
|
335
|
+
if (typeof v === "string" && v.trim()) return v;
|
|
336
|
+
}
|
|
337
|
+
try {
|
|
338
|
+
return JSON.stringify(obj);
|
|
339
|
+
} catch {
|
|
340
|
+
return void 0;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
329
343
|
function extractOutput(resp) {
|
|
330
344
|
if (!resp) return void 0;
|
|
331
345
|
const choices = resp.choices;
|
|
@@ -337,6 +351,11 @@ function extractOutput(resp) {
|
|
|
337
351
|
if (Array.isArray(blocks)) {
|
|
338
352
|
const tb = blocks.find((b) => b.type === "text");
|
|
339
353
|
if (typeof tb?.text === "string" && tb.text.trim()) return tb.text.slice(0, OUTPUT_SUMMARY_MAX);
|
|
354
|
+
const toolBlock = blocks.find((b) => b.type === "tool_use");
|
|
355
|
+
if (toolBlock) {
|
|
356
|
+
const s = extractToolInputText(toolBlock.input);
|
|
357
|
+
if (s) return s.slice(0, OUTPUT_SUMMARY_MAX);
|
|
358
|
+
}
|
|
340
359
|
}
|
|
341
360
|
return void 0;
|
|
342
361
|
}
|