@armoriq/sdk-dev 0.7.0 → 0.8.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/_version.d.ts +1 -1
- package/dist/_version.js +1 -1
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.js +68 -13
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/orgs.js +1 -1
- package/dist/cli/commands/orgs.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +4 -3
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/state.d.ts +3 -3
- package/dist/cli/state.d.ts.map +1 -1
- package/dist/cli/state.js +24 -12
- package/dist/cli/state.js.map +1 -1
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +26 -6
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/strands.d.ts +20 -1
- package/dist/integrations/strands.d.ts.map +1 -1
- package/dist/integrations/strands.js +43 -8
- package/dist/integrations/strands.js.map +1 -1
- package/dist/observability/content-capture.d.ts +28 -0
- package/dist/observability/content-capture.d.ts.map +1 -1
- package/dist/observability/content-capture.js +91 -7
- package/dist/observability/content-capture.js.map +1 -1
- package/dist/observability/otel-config.js +1 -1
- package/dist/observability/otel-config.js.map +1 -1
- package/dist/observability/otel-export-ceiling.d.ts.map +1 -1
- package/dist/observability/otel-export-ceiling.js +7 -0
- package/dist/observability/otel-export-ceiling.js.map +1 -1
- package/dist/observability/otel-runtime.d.ts.map +1 -1
- package/dist/observability/otel-runtime.js +14 -2
- package/dist/observability/otel-runtime.js.map +1 -1
- package/dist/observability/otel-session.d.ts.map +1 -1
- package/dist/observability/otel-session.js +9 -0
- package/dist/observability/otel-session.js.map +1 -1
- package/dist/token_usage.d.ts +23 -0
- package/dist/token_usage.d.ts.map +1 -1
- package/dist/token_usage.js +107 -26
- package/dist/token_usage.js.map +1 -1
- package/package.json +1 -1
- package/dist/observability/handle.d.ts +0 -41
- package/dist/observability/handle.d.ts.map +0 -1
- package/dist/observability/handle.js +0 -54
- package/dist/observability/handle.js.map +0 -1
- package/dist/observability/recorder.d.ts +0 -245
- package/dist/observability/recorder.d.ts.map +0 -1
- package/dist/observability/recorder.js +0 -475
- package/dist/observability/recorder.js.map +0 -1
- package/dist/observability/schema.d.ts +0 -163
- package/dist/observability/schema.d.ts.map +0 -1
- package/dist/observability/schema.js +0 -291
- package/dist/observability/schema.js.map +0 -1
- package/dist/observability/shipper.d.ts +0 -84
- package/dist/observability/shipper.d.ts.map +0 -1
- package/dist/observability/shipper.js +0 -206
- package/dist/observability/shipper.js.map +0 -1
- package/dist/observability/trace-summary.d.ts +0 -34
- package/dist/observability/trace-summary.d.ts.map +0 -1
- package/dist/observability/trace-summary.js +0 -108
- package/dist/observability/trace-summary.js.map +0 -1
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Trace-level tag/output-summary derivation.
|
|
4
|
-
*
|
|
5
|
-
* A trace's own `tags`/`attributes.output` are never populated by callers
|
|
6
|
-
* today (every chokepoint only passes freeform `attributes` at
|
|
7
|
-
* `startTrace()` time, before any child span exists) — so without this
|
|
8
|
-
* module every trace ships with `tags: []` and no output summary, even
|
|
9
|
-
* though the information needed to compute both already lives on the
|
|
10
|
-
* trace's own spans by the time `endTrace()` runs.
|
|
11
|
-
*
|
|
12
|
-
* This is intentionally derived, not caller-supplied: it's computed once,
|
|
13
|
-
* in one place (`ObservabilityRecorder.endTrace`), from the same in-memory
|
|
14
|
-
* `spans` array the recorder already holds — no new public API surface,
|
|
15
|
-
* no risk of callers drifting from each other's tagging conventions.
|
|
16
|
-
*
|
|
17
|
-
* Kept deliberately conservative and low-cardinality (per the dashboard's
|
|
18
|
-
* TAGS column contract): product + distinct tool names + one decision
|
|
19
|
-
* verdict, nothing free-text or unbounded.
|
|
20
|
-
*/
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.deriveTraceSummary = deriveTraceSummary;
|
|
23
|
-
const MAX_TOOL_TAGS = 8;
|
|
24
|
-
function isPolicyCallAttributes(attrs) {
|
|
25
|
-
return attrs.kind === 'policy_call';
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Distinct tool names referenced by any span on the trace. Reads
|
|
29
|
-
* `attributes.toolName` off `kind: 'span'` container spans (the shape
|
|
30
|
-
* `iap.check`/`tool.report`/generic tool spans use) — this covers every
|
|
31
|
-
* known emitter without needing parent/child span-kind coupling.
|
|
32
|
-
*/
|
|
33
|
-
function collectToolNames(spans) {
|
|
34
|
-
const names = new Set();
|
|
35
|
-
for (const span of spans) {
|
|
36
|
-
const toolName = span.attributes.toolName;
|
|
37
|
-
if (typeof toolName === 'string' && toolName.length > 0) {
|
|
38
|
-
names.add(toolName);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return Array.from(names).slice(0, MAX_TOOL_TAGS);
|
|
42
|
-
}
|
|
43
|
-
function collectDecisionCounts(spans) {
|
|
44
|
-
const counts = { allow: 0, deny: 0, other: 0, total: 0 };
|
|
45
|
-
for (const span of spans) {
|
|
46
|
-
if (!isPolicyCallAttributes(span.attributes))
|
|
47
|
-
continue;
|
|
48
|
-
counts.total += 1;
|
|
49
|
-
if (span.attributes.decision === 'allow')
|
|
50
|
-
counts.allow += 1;
|
|
51
|
-
else if (span.attributes.decision === 'deny')
|
|
52
|
-
counts.deny += 1;
|
|
53
|
-
else
|
|
54
|
-
counts.other += 1;
|
|
55
|
-
}
|
|
56
|
-
return counts;
|
|
57
|
-
}
|
|
58
|
-
/** Overall verdict tag for the trace: 'allowed' | 'blocked' | 'mixed'. */
|
|
59
|
-
function decisionVerdict(counts) {
|
|
60
|
-
if (counts.total === 0)
|
|
61
|
-
return null;
|
|
62
|
-
if (counts.deny > 0 && counts.deny < counts.total)
|
|
63
|
-
return 'mixed';
|
|
64
|
-
if (counts.deny === counts.total)
|
|
65
|
-
return 'blocked';
|
|
66
|
-
if (counts.other > 0)
|
|
67
|
-
return 'mixed';
|
|
68
|
-
return 'allowed';
|
|
69
|
-
}
|
|
70
|
-
/** Concise, non-sensitive outcome summary, e.g. "5 checks · all allowed". */
|
|
71
|
-
function outputSummary(counts) {
|
|
72
|
-
if (counts.total === 0)
|
|
73
|
-
return null;
|
|
74
|
-
const noun = counts.total === 1 ? 'check' : 'checks';
|
|
75
|
-
if (counts.deny === 0 && counts.other === 0) {
|
|
76
|
-
return `${counts.total} ${noun} · all allowed`;
|
|
77
|
-
}
|
|
78
|
-
if (counts.deny === counts.total) {
|
|
79
|
-
return `${counts.total} ${noun} · all blocked`;
|
|
80
|
-
}
|
|
81
|
-
const parts = [];
|
|
82
|
-
if (counts.deny > 0)
|
|
83
|
-
parts.push(`${counts.deny} blocked`);
|
|
84
|
-
if (counts.other > 0)
|
|
85
|
-
parts.push(`${counts.other} pending`);
|
|
86
|
-
return `${counts.total} ${noun} · ${parts.join(', ')}`;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Derive `{ tags, output }` for a trace from its accumulated spans. Pure
|
|
90
|
-
* and read-only — never mutates `spans`. Callers merge the result onto the
|
|
91
|
-
* trace record themselves (see `ObservabilityRecorder.endTrace`), preserving
|
|
92
|
-
* any tags/output the caller already set explicitly.
|
|
93
|
-
*/
|
|
94
|
-
function deriveTraceSummary(spans, product) {
|
|
95
|
-
const tags = [];
|
|
96
|
-
if (product)
|
|
97
|
-
tags.push(product);
|
|
98
|
-
tags.push(...collectToolNames(spans));
|
|
99
|
-
const counts = collectDecisionCounts(spans);
|
|
100
|
-
const verdict = decisionVerdict(counts);
|
|
101
|
-
if (verdict)
|
|
102
|
-
tags.push(verdict);
|
|
103
|
-
return {
|
|
104
|
-
tags,
|
|
105
|
-
output: outputSummary(counts),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=trace-summary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trace-summary.js","sourceRoot":"","sources":["../../src/observability/trace-summary.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;AAoFH,gDAgBC;AAhGD,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,SAAS,sBAAsB,CAAC,KAA+B;IAC7D,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,KAA4B;IACpD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAI,IAAI,CAAC,UAAqC,CAAC,QAAQ,CAAC;QACtE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxD,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;AACnD,CAAC;AASD,SAAS,qBAAqB,CAAC,KAA4B;IACzD,MAAM,MAAM,GAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACzE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC;YAAE,SAAS;QACvD,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;QAClB,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,KAAK,OAAO;YAAE,MAAM,CAAC,KAAK,I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