@armoriq/sdk-dev 0.6.10 → 0.8.0

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 (96) hide show
  1. package/README.md +168 -1
  2. package/dist/_version.d.ts +1 -1
  3. package/dist/_version.d.ts.map +1 -1
  4. package/dist/_version.js +1 -1
  5. package/dist/_version.js.map +1 -1
  6. package/dist/cli/commands/auth.d.ts +12 -0
  7. package/dist/cli/commands/auth.d.ts.map +1 -1
  8. package/dist/cli/commands/auth.js +522 -49
  9. package/dist/cli/commands/auth.js.map +1 -1
  10. package/dist/client.d.ts +8 -15
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js +20 -18
  13. package/dist/client.js.map +1 -1
  14. package/dist/config.d.ts +0 -17
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +1 -19
  17. package/dist/config.js.map +1 -1
  18. package/dist/index.d.ts +3 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +8 -14
  21. package/dist/index.js.map +1 -1
  22. package/dist/integrations/google_adk.d.ts +155 -7
  23. package/dist/integrations/google_adk.d.ts.map +1 -1
  24. package/dist/integrations/google_adk.js +727 -46
  25. package/dist/integrations/google_adk.js.map +1 -1
  26. package/dist/integrations/langchain.d.ts +48 -2
  27. package/dist/integrations/langchain.d.ts.map +1 -1
  28. package/dist/integrations/langchain.js +528 -33
  29. package/dist/integrations/langchain.js.map +1 -1
  30. package/dist/integrations/strands.d.ts +65 -1
  31. package/dist/integrations/strands.d.ts.map +1 -1
  32. package/dist/integrations/strands.js +456 -36
  33. package/dist/integrations/strands.js.map +1 -1
  34. package/dist/models.d.ts +2 -2
  35. package/dist/models.d.ts.map +1 -1
  36. package/dist/observability/content-capture.d.ts +103 -0
  37. package/dist/observability/content-capture.d.ts.map +1 -0
  38. package/dist/observability/content-capture.js +423 -0
  39. package/dist/observability/content-capture.js.map +1 -0
  40. package/dist/observability/index.d.ts +6 -7
  41. package/dist/observability/index.d.ts.map +1 -1
  42. package/dist/observability/index.js +18 -27
  43. package/dist/observability/index.js.map +1 -1
  44. package/dist/observability/otel-config.d.ts +47 -0
  45. package/dist/observability/otel-config.d.ts.map +1 -0
  46. package/dist/observability/otel-config.js +268 -0
  47. package/dist/observability/otel-config.js.map +1 -0
  48. package/dist/observability/otel-export-ceiling.d.ts +96 -0
  49. package/dist/observability/otel-export-ceiling.d.ts.map +1 -0
  50. package/dist/observability/otel-export-ceiling.js +271 -0
  51. package/dist/observability/otel-export-ceiling.js.map +1 -0
  52. package/dist/observability/otel-runtime.d.ts +103 -0
  53. package/dist/observability/otel-runtime.d.ts.map +1 -0
  54. package/dist/observability/otel-runtime.js +680 -0
  55. package/dist/observability/otel-runtime.js.map +1 -0
  56. package/dist/observability/otel-session.d.ts +168 -0
  57. package/dist/observability/otel-session.d.ts.map +1 -0
  58. package/dist/observability/otel-session.js +630 -0
  59. package/dist/observability/otel-session.js.map +1 -0
  60. package/dist/observability/otel-shutdown.d.ts +17 -0
  61. package/dist/observability/otel-shutdown.d.ts.map +1 -0
  62. package/dist/observability/otel-shutdown.js +54 -0
  63. package/dist/observability/otel-shutdown.js.map +1 -0
  64. package/dist/observability/policy-lease.d.ts +22 -0
  65. package/dist/observability/policy-lease.d.ts.map +1 -0
  66. package/dist/observability/policy-lease.js +102 -0
  67. package/dist/observability/policy-lease.js.map +1 -0
  68. package/dist/plan_builder.d.ts +5 -4
  69. package/dist/plan_builder.d.ts.map +1 -1
  70. package/dist/plan_builder.js +14 -15
  71. package/dist/plan_builder.js.map +1 -1
  72. package/dist/session.d.ts +61 -93
  73. package/dist/session.d.ts.map +1 -1
  74. package/dist/session.js +388 -804
  75. package/dist/session.js.map +1 -1
  76. package/dist/token_usage.d.ts +11 -18
  77. package/dist/token_usage.d.ts.map +1 -1
  78. package/dist/token_usage.js +29 -94
  79. package/dist/token_usage.js.map +1 -1
  80. package/dist/tool_name.d.ts +18 -0
  81. package/dist/tool_name.d.ts.map +1 -0
  82. package/dist/tool_name.js +29 -0
  83. package/dist/tool_name.js.map +1 -0
  84. package/dist/tool_push.d.ts +28 -0
  85. package/dist/tool_push.d.ts.map +1 -0
  86. package/dist/tool_push.js +151 -0
  87. package/dist/tool_push.js.map +1 -0
  88. package/dist/tool_registry.d.ts +100 -0
  89. package/dist/tool_registry.d.ts.map +1 -0
  90. package/dist/tool_registry.js +440 -0
  91. package/dist/tool_registry.js.map +1 -0
  92. package/dist/tool_schema.d.ts +22 -0
  93. package/dist/tool_schema.d.ts.map +1 -0
  94. package/dist/tool_schema.js +163 -0
  95. package/dist/tool_schema.js.map +1 -0
  96. package/package.json +12 -7
@@ -0,0 +1,423 @@
1
+ "use strict";
2
+ /**
3
+ * One policy-aware content projector for every native OTel producer.
4
+ *
5
+ * Adapters pass values, never pre-redacted strings. This module bounds and
6
+ * removes unsafe data before an SDK span receives it, independent of the
7
+ * destination vendor.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.CONTENT_ATTRIBUTE_KEYS = exports.CONTENT_NOT_PROVIDED_BY_ADAPTER = exports.METADATA_CONTENT_PLACEHOLDER = exports.ATTR_CONTENT_TRUNCATED = exports.ATTR_REDACTION_APPLIED = void 0;
11
+ exports.bufferTelemetryContent = bufferTelemetryContent;
12
+ exports.projectTelemetryContent = projectTelemetryContent;
13
+ exports.reboundCapturedJson = reboundCapturedJson;
14
+ exports.trustedContentDiagnostics = trustedContentDiagnostics;
15
+ exports.rememberSpanContentDiagnostics = rememberSpanContentDiagnostics;
16
+ exports.spanContentDiagnostics = spanContentDiagnostics;
17
+ const ENHANCED = { maxBytes: 2 * 1024, maxDepth: 4, maxItems: 20, maxString: 512 };
18
+ const DEBUG = { maxBytes: 8 * 1024, maxDepth: 8, maxItems: 100, maxString: 2 * 1024 };
19
+ const PLACEHOLDER = '[Not captured - organization capture mode: metadata]';
20
+ const OFF_PLACEHOLDER = '[Not captured - organization observability is off]';
21
+ const EXTERNAL_DISABLED = '[Not captured - organization external content capture is disabled]';
22
+ const INTERNAL_DISABLED = '[Not captured - organization content capture is disabled]';
23
+ const UNAVAILABLE = '[Not captured - observability policy authority unavailable]';
24
+ const NOT_PROVIDED = '[Not provided by adapter]';
25
+ const SENSITIVE_KEY = /(?:api[_-]?key|auth(?:orization)?|bearer|cookie|credential|password|passphrase|secret|private[_-]?key|token|signature|session(?:_|-)?id)/i;
26
+ const SECRET = /(?:\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b|\b(?:ak|sk|pk|rk|ghp|github_pat)_[A-Za-z0-9_-]{8,}\b|-----BEGIN [A-Z0-9 ]+-----|\bBearer\s+[A-Za-z0-9._~+/-]{8,}\b)/ig;
27
+ const EMAIL = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/ig;
28
+ const SSN = /(?:^|\D)\d{3}[- ]?\d{2}[- ]?\d{4}(?:$|\D)/g;
29
+ const PHONE_OR_CARD = /\+?\d(?:[ .()-]*\d){8,18}/g;
30
+ const SIGNED_URL = /https?:\/\/[^\s"'<>]*(?:[?&](?:x-amz-signature|signature|sig|token|access_token)=)[^\s"'<>]*/ig;
31
+ // Matches the Python SDK's armoriq_sdk/observability/redaction.py _STUDENT_GRADE.
32
+ const STUDENT_GRADE = /\bstudent(?:\s+[a-z0-9][a-z0-9 .'-]{0,63})?\s+(?:received|earned|got|was\s+awarded)\s+(?:a\s+)?grade\s+[a-f][+-]?(?![a-z0-9])/gi;
33
+ function numericPersonalIdentifier(candidate) {
34
+ const digits = candidate.replace(/\D/g, '');
35
+ if (digits.length >= 10 && digits.length <= 15)
36
+ return true;
37
+ if (digits.length < 13 || digits.length > 19)
38
+ return false;
39
+ let sum = 0;
40
+ let alternate = false;
41
+ for (let index = digits.length - 1; index >= 0; index -= 1) {
42
+ let digit = Number(digits[index]);
43
+ if (alternate && (digit *= 2) > 9)
44
+ digit -= 9;
45
+ sum += digit;
46
+ alternate = !alternate;
47
+ }
48
+ return sum % 10 === 0;
49
+ }
50
+ function redactString(input, limits, state) {
51
+ // SECRET must run before STUDENT_GRADE: STUDENT_GRADE's identifier group
52
+ // allows letters, digits, dots, and hyphens, so a credential-shaped token
53
+ // (e.g. a JWT) sitting between "student" and "received/earned/... grade X"
54
+ // would otherwise get consumed into [REDACTED:STUDENT_GRADE] before SECRET
55
+ // ever saw it, losing the more specific credential signal.
56
+ let value = input.replace(SECRET, () => { state.redacted = true; return '[REDACTED:SECRET]'; });
57
+ // STUDENT_GRADE must run before SSN/PHONE_OR_CARD: a numeric student ID of
58
+ // 9+ contiguous digits (e.g. "student 482134567 received grade B") would
59
+ // otherwise get consumed by those digit-only checks first, mangling the
60
+ // phrase so STUDENT_GRADE no longer matches and the grade disclosure leaks.
61
+ value = value.replace(STUDENT_GRADE, () => { state.redacted = true; return '[REDACTED:STUDENT_GRADE]'; });
62
+ value = value
63
+ .replace(SIGNED_URL, () => { state.redacted = true; return '[REDACTED:SIGNED_URL]'; })
64
+ .replace(EMAIL, () => { state.redacted = true; return '[REDACTED:EMAIL]'; })
65
+ .replace(SSN, (match) => { state.redacted = true; return match.replace(/\d/g, 'X').replace(/X+/g, '[REDACTED:PII]'); });
66
+ value = value.replace(PHONE_OR_CARD, (match) => {
67
+ if (!numericPersonalIdentifier(match))
68
+ return match;
69
+ state.redacted = true;
70
+ return '[REDACTED:PII]';
71
+ });
72
+ if (value.length > limits.maxString) {
73
+ state.truncated = true;
74
+ return `${value.slice(0, Math.max(0, limits.maxString - 14))}[TRUNCATED]`;
75
+ }
76
+ return value;
77
+ }
78
+ function project(value, limits, state, depth, key) {
79
+ if (key && SENSITIVE_KEY.test(key)) {
80
+ state.redacted = true;
81
+ return '[REDACTED:SECRET]';
82
+ }
83
+ if (value === null || value === undefined)
84
+ return value ?? null;
85
+ if (typeof value === 'string')
86
+ return redactString(value, limits, state);
87
+ if (typeof value === 'boolean')
88
+ return value;
89
+ if (typeof value === 'number')
90
+ return Number.isFinite(value) ? value : '[INVALID_NUMBER]';
91
+ if (typeof value === 'bigint')
92
+ return '[BIGINT]';
93
+ if (typeof value === 'symbol' || typeof value === 'function')
94
+ return `[${typeof value}]`;
95
+ if (typeof value !== 'object')
96
+ return String(value);
97
+ if (state.seen.has(value))
98
+ return '[CIRCULAR]';
99
+ if (depth >= limits.maxDepth) {
100
+ state.truncated = true;
101
+ return '[TRUNCATED:MAX_DEPTH]';
102
+ }
103
+ state.seen.add(value);
104
+ if (Array.isArray(value)) {
105
+ const values = value.slice(0, limits.maxItems).map((item) => project(item, limits, state, depth + 1));
106
+ if (value.length > limits.maxItems) {
107
+ values.push('[TRUNCATED:ARRAY_ITEMS]');
108
+ state.truncated = true;
109
+ }
110
+ return values;
111
+ }
112
+ const result = {};
113
+ const entries = Object.entries(value);
114
+ for (const [childKey, child] of entries.slice(0, limits.maxItems)) {
115
+ result[childKey] = project(child, limits, state, depth + 1, childKey);
116
+ }
117
+ if (entries.length > limits.maxItems) {
118
+ result.__truncated__ = 'MAX_OBJECT_KEYS';
119
+ state.truncated = true;
120
+ }
121
+ return result;
122
+ }
123
+ /**
124
+ * Truncates to at most `maxBytes` UTF-8 bytes without splitting a code point.
125
+ * `String.prototype.slice` counts UTF-16 code units, which undercounts
126
+ * multibyte text by up to 3x -- the reason a byte ceiling has to be enforced
127
+ * on the encoded buffer rather than on string length.
128
+ */
129
+ function sliceUtf8(value, maxBytes) {
130
+ if (maxBytes <= 0)
131
+ return '';
132
+ if (Buffer.byteLength(value, 'utf8') <= maxBytes)
133
+ return value;
134
+ const buffer = Buffer.from(value, 'utf8');
135
+ let end = maxBytes;
136
+ // Never cut inside a multi-byte sequence: back off to the last lead byte.
137
+ while (end > 0 && (buffer[end] & 0xc0) === 0x80)
138
+ end -= 1;
139
+ let sliced = buffer.subarray(0, end).toString('utf8');
140
+ // A lone high surrogate can survive the decode; drop it.
141
+ if (sliced.length > 0 && /[\uD800-\uDBFF]$/.test(sliced))
142
+ sliced = sliced.slice(0, -1);
143
+ return sliced;
144
+ }
145
+ function stringify(value, limits, state) {
146
+ let result;
147
+ try {
148
+ result = JSON.stringify(project(value, limits, state, 0));
149
+ }
150
+ catch {
151
+ state.redacted = true;
152
+ result = '"[UNSERIALIZABLE]"';
153
+ }
154
+ if (Buffer.byteLength(result, 'utf8') <= limits.maxBytes)
155
+ return result;
156
+ state.truncated = true;
157
+ // The wrapper object and JSON escaping both add bytes after slicing, so
158
+ // budget the preview down until the encoded result actually fits.
159
+ let budget = Math.floor(limits.maxBytes / 2);
160
+ let encoded = JSON.stringify({ __truncated__: 'MAX_BYTES', preview: sliceUtf8(result, budget) });
161
+ while (budget > 0 && Buffer.byteLength(encoded, 'utf8') > limits.maxBytes) {
162
+ budget = Math.floor(budget / 2);
163
+ encoded = JSON.stringify({ __truncated__: 'MAX_BYTES', preview: sliceUtf8(result, budget) });
164
+ }
165
+ return encoded;
166
+ }
167
+ /**
168
+ * Remove secrets and cap content before it enters an in-memory pending buffer.
169
+ * Values stay structured so the final authority projector serializes each
170
+ * semantic role exactly once.
171
+ */
172
+ function bufferTelemetryContent(content) {
173
+ const buffered = {};
174
+ let redacted = false;
175
+ let truncated = false;
176
+ for (const key of ['input', 'output', 'toolArguments', 'toolResult', 'errorSummary']) {
177
+ if (!Object.prototype.hasOwnProperty.call(content, key))
178
+ continue;
179
+ const value = content[key];
180
+ if (value === undefined) {
181
+ buffered[key] = undefined;
182
+ continue;
183
+ }
184
+ const state = { redacted: false, truncated: false, seen: new WeakSet() };
185
+ const encoded = stringify(value, DEBUG, state);
186
+ try {
187
+ buffered[key] = JSON.parse(encoded);
188
+ }
189
+ catch {
190
+ buffered[key] = '[UNSERIALIZABLE]';
191
+ state.redacted = true;
192
+ }
193
+ redacted ||= state.redacted;
194
+ truncated ||= state.truncated;
195
+ }
196
+ return Object.freeze({ content: Object.freeze(buffered), redacted, truncated });
197
+ }
198
+ function placeholder(authority) {
199
+ if (authority.reasonCode === 'capture_mode_off')
200
+ return OFF_PLACEHOLDER;
201
+ if (authority.reasonCode === 'capture_mode_metadata')
202
+ return PLACEHOLDER;
203
+ if (authority.reasonCode === 'external_content_disabled')
204
+ return EXTERNAL_DISABLED;
205
+ if (authority.reasonCode === 'organization_content_disabled')
206
+ return INTERNAL_DISABLED;
207
+ return UNAVAILABLE;
208
+ }
209
+ /**
210
+ * SDK-owned capture provenance keys. These record that the SDK's own
211
+ * projector redacted or truncated captured content; they are never trusted
212
+ * from a public span attribute (which any framework or caller can forge).
213
+ */
214
+ exports.ATTR_REDACTION_APPLIED = 'armoriq.observability.redaction.applied';
215
+ exports.ATTR_CONTENT_TRUNCATED = 'armoriq.observability.content.truncated';
216
+ /**
217
+ * Projects optional structured input/output/tool values. Metadata output is a
218
+ * deliberate placeholder, so dashboards explain why user content is absent.
219
+ */
220
+ function projectTelemetryContent(content, authority) {
221
+ const attrs = {
222
+ 'armoriq.observability.capture.mode': authority.mode,
223
+ };
224
+ const canCapture = authority.contentAllowed && (authority.mode === 'enhanced' || authority.mode === 'debug');
225
+ const hasInput = Object.prototype.hasOwnProperty.call(content, 'input');
226
+ const hasOutput = Object.prototype.hasOwnProperty.call(content, 'output');
227
+ const hasToolArguments = Object.prototype.hasOwnProperty.call(content, 'toolArguments');
228
+ const hasToolResult = Object.prototype.hasOwnProperty.call(content, 'toolResult');
229
+ if (!canCapture) {
230
+ if (hasInput) {
231
+ attrs['gen_ai.input.messages'] = placeholder(authority);
232
+ attrs['armoriq.observability.content.input.state'] = 'not_captured';
233
+ }
234
+ if (hasOutput) {
235
+ attrs['gen_ai.output.messages'] = placeholder(authority);
236
+ attrs['armoriq.observability.content.output.state'] = 'not_captured';
237
+ }
238
+ if (hasToolArguments) {
239
+ attrs['armoriq.observability.content.tool_arguments.state'] = 'not_captured';
240
+ attrs['armoriq.observability.content.tool_arguments.reason_code'] = authority.reasonCode;
241
+ }
242
+ if (hasToolResult) {
243
+ attrs['armoriq.observability.content.tool_result.state'] = 'not_captured';
244
+ attrs['armoriq.observability.content.tool_result.reason_code'] = authority.reasonCode;
245
+ }
246
+ attrs['armoriq.observability.content.reason_code'] = authority.reasonCode;
247
+ return Object.freeze({ attributes: Object.freeze(attrs), redacted: false, truncated: false });
248
+ }
249
+ const limits = authority.mode === 'debug' ? DEBUG : ENHANCED;
250
+ const state = { redacted: false, truncated: false, seen: new WeakSet() };
251
+ const serialize = (value) => {
252
+ // Independent fields may deliberately share the same object. Scope cycle
253
+ // tracking to one serialized field so output is not falsely circular.
254
+ const fieldState = { redacted: false, truncated: false, seen: new WeakSet() };
255
+ const encoded = stringify(value, limits, fieldState);
256
+ state.redacted ||= fieldState.redacted;
257
+ state.truncated ||= fieldState.truncated;
258
+ return encoded;
259
+ };
260
+ const projectField = (present, value, attribute, stateAttribute, reasonAttribute) => {
261
+ if (!present)
262
+ return;
263
+ if (value === undefined) {
264
+ attrs[attribute] = NOT_PROVIDED;
265
+ attrs[stateAttribute] = 'not_provided_by_adapter';
266
+ attrs[reasonAttribute] = 'not_provided_by_adapter';
267
+ return;
268
+ }
269
+ attrs[attribute] = serialize(value);
270
+ attrs[stateAttribute] = 'captured';
271
+ };
272
+ projectField(hasInput, content.input, 'gen_ai.input.messages', 'armoriq.observability.content.input.state', 'armoriq.observability.content.input.reason_code');
273
+ projectField(hasOutput, content.output, 'gen_ai.output.messages', 'armoriq.observability.content.output.state', 'armoriq.observability.content.output.reason_code');
274
+ projectField(hasToolArguments, content.toolArguments, 'gen_ai.tool.call.arguments', 'armoriq.observability.content.tool_arguments.state', 'armoriq.observability.content.tool_arguments.reason_code');
275
+ projectField(hasToolResult, content.toolResult, 'gen_ai.tool.call.result', 'armoriq.observability.content.tool_result.state', 'armoriq.observability.content.tool_result.reason_code');
276
+ if (Object.prototype.hasOwnProperty.call(content, 'errorSummary')) {
277
+ if (content.errorSummary === undefined) {
278
+ attrs['armoriq.observability.error.summary.state'] = 'not_provided_by_adapter';
279
+ attrs['armoriq.observability.error.summary.reason_code'] = 'not_provided_by_adapter';
280
+ }
281
+ else {
282
+ attrs['armoriq.observability.error.summary'] = serialize(content.errorSummary);
283
+ attrs['armoriq.observability.error.summary.state'] = 'captured';
284
+ }
285
+ }
286
+ attrs['armoriq.observability.content.reason_code'] = 'captured';
287
+ if (state.redacted)
288
+ attrs[exports.ATTR_REDACTION_APPLIED] = true;
289
+ if (state.truncated)
290
+ attrs[exports.ATTR_CONTENT_TRUNCATED] = true;
291
+ return Object.freeze({ attributes: Object.freeze(attrs), redacted: state.redacted, truncated: state.truncated });
292
+ }
293
+ /**
294
+ * Re-bounds an already-serialized content attribute against `mode`'s limits.
295
+ * Used at export time when the current ceiling's mode differs from whatever
296
+ * mode a span's content was originally captured under, so a debug-captured
297
+ * value can't retain debug's looser size/depth/item/string allowances once
298
+ * the ceiling has downgraded to enhanced. Not valid JSON (e.g. a
299
+ * not-provided-by-adapter placeholder) is returned unchanged.
300
+ */
301
+ function reboundCapturedJson(json, mode) {
302
+ let parsed;
303
+ try {
304
+ parsed = JSON.parse(json);
305
+ }
306
+ catch {
307
+ return { value: json, truncated: false, redacted: false };
308
+ }
309
+ const limits = mode === 'debug' ? DEBUG : ENHANCED;
310
+ const state = { redacted: false, truncated: false, seen: new WeakSet() };
311
+ return { value: stringify(parsed, limits, state), truncated: state.truncated, redacted: state.redacted };
312
+ }
313
+ exports.METADATA_CONTENT_PLACEHOLDER = PLACEHOLDER;
314
+ exports.CONTENT_NOT_PROVIDED_BY_ADAPTER = NOT_PROVIDED;
315
+ /**
316
+ * Every attribute key this module -- or its internal-ingest mirror keys
317
+ * assigned by `ArmorIQTelemetryRuntime.safeAttributesWithAuthority` in
318
+ * otel-runtime.ts (`armoriq.content.input` / `armoriq.content.output`) --
319
+ * ever writes to carry content or content-state metadata on a span.
320
+ *
321
+ * This is the one list of "what counts as content-scoped" on an already-built
322
+ * span. The export-time ceiling (otel-export-ceiling.ts) clears exactly this
323
+ * set before re-deriving it under whatever policy is current at export time,
324
+ * so a span-creation change to this contract cannot silently drift out of
325
+ * sync with what purge-on-downgrade clears.
326
+ */
327
+ exports.CONTENT_ATTRIBUTE_KEYS = Object.freeze([
328
+ 'gen_ai.input.messages',
329
+ 'gen_ai.output.messages',
330
+ 'gen_ai.tool.call.arguments',
331
+ 'gen_ai.tool.call.result',
332
+ 'armoriq.content.input',
333
+ 'armoriq.content.output',
334
+ 'armoriq.observability.content.input.state',
335
+ 'armoriq.observability.content.input.reason_code',
336
+ 'armoriq.observability.content.output.state',
337
+ 'armoriq.observability.content.output.reason_code',
338
+ 'armoriq.observability.content.tool_arguments.state',
339
+ 'armoriq.observability.content.tool_arguments.reason_code',
340
+ 'armoriq.observability.content.tool_result.state',
341
+ 'armoriq.observability.content.tool_result.reason_code',
342
+ 'armoriq.observability.content.reason_code',
343
+ exports.ATTR_REDACTION_APPLIED,
344
+ exports.ATTR_CONTENT_TRUNCATED,
345
+ 'armoriq.observability.error.summary',
346
+ 'armoriq.observability.error.summary.state',
347
+ 'armoriq.observability.error.summary.reason_code',
348
+ ]);
349
+ /**
350
+ * The content-bearing subset of `CONTENT_ATTRIBUTE_KEYS`: keys that carry
351
+ * actual captured user content (not state/reason-code metadata). A capture
352
+ * diagnostic is only meaningful while at least one of these survives on the
353
+ * span; once every one is purged (a downgrade withheld the content) the
354
+ * redaction/truncation facts describe nothing and must not be restored.
355
+ */
356
+ const CONTENT_BEARING_KEYS = Object.freeze([
357
+ 'gen_ai.input.messages',
358
+ 'gen_ai.output.messages',
359
+ 'gen_ai.tool.call.arguments',
360
+ 'gen_ai.tool.call.result',
361
+ 'armoriq.content.input',
362
+ 'armoriq.content.output',
363
+ ]);
364
+ /**
365
+ * Private, per-span capture provenance kept off the public OTel attribute
366
+ * namespace. A public span attribute can be forged by any framework adapter or
367
+ * caller, so the two diagnostic flags are never trusted from `span.attributes`
368
+ * at export time; they are read back only from this SDK-owned record.
369
+ *
370
+ * Keyed by the span object itself (the Node SDK hands the same `Span` instance
371
+ * to processors and exporters as a `ReadableSpan`), so the provenance has the
372
+ * span's lifetime and survives the processor to exporter hand-off without a
373
+ * global registry. A `WeakMap` -- rather than a property on `span.attributes`
374
+ * -- is required because the export ceiling rewrites that attribute object
375
+ * wholesale (`writeAttributes` in otel-export-ceiling.ts), which would clobber
376
+ * any stash placed inside it.
377
+ */
378
+ const spanDiagnostics = new WeakMap();
379
+ /**
380
+ * The capture facts a trusted source (a prior governance pass or the SDK's own
381
+ * private buffer) asserts, restricted to what still describes live content.
382
+ * Returns an empty record once no content-bearing key survives in `governed`,
383
+ * so a withheld-content downgrade drops the diagnostics rather than leaving a
384
+ * flag that refers to content no longer present.
385
+ */
386
+ function trustedContentDiagnostics(source, governed) {
387
+ if (!CONTENT_BEARING_KEYS.some((key) => Object.prototype.hasOwnProperty.call(governed, key))) {
388
+ return {};
389
+ }
390
+ const result = {};
391
+ if (source[exports.ATTR_REDACTION_APPLIED] === true)
392
+ result[exports.ATTR_REDACTION_APPLIED] = true;
393
+ if (source[exports.ATTR_CONTENT_TRUNCATED] === true)
394
+ result[exports.ATTR_CONTENT_TRUNCATED] = true;
395
+ return result;
396
+ }
397
+ /**
398
+ * Record the SDK-owned capture diagnostics carried by `governed` privately on
399
+ * the span, so a later export-time re-governance can restore them without
400
+ * trusting the public attribute. Discards them when captured content did not
401
+ * survive. Fails open (records nothing) for an unsupported span object.
402
+ */
403
+ function rememberSpanContentDiagnostics(span, governed) {
404
+ if (!span || (typeof span !== 'object' && typeof span !== 'function'))
405
+ return;
406
+ try {
407
+ spanDiagnostics.set(span, trustedContentDiagnostics(governed, governed));
408
+ }
409
+ catch {
410
+ // Telemetry stays fail-open: an unusable span key never restores diagnostics.
411
+ }
412
+ }
413
+ /**
414
+ * The capture diagnostics privately recorded for this span that still describe
415
+ * live content in `governed`. Never reads the public span attributes.
416
+ */
417
+ function spanContentDiagnostics(span, governed) {
418
+ if (!span || (typeof span !== 'object' && typeof span !== 'function'))
419
+ return {};
420
+ const source = spanDiagnostics.get(span) ?? {};
421
+ return trustedContentDiagnostics(source, governed);
422
+ }
423
+ //# sourceMappingURL=content-cap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,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;QAC7F,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,MAAM,GAAyB,EAAE,CAAC;IACxC,IAAI,MAAM,CAAC,8BAAsB,CAAC,KAAK,IAAI;QAAE,MAAM,CAAC,8BAAsB,CAAC,GAAG,IAAI,CAAC;IACnF,IAAI,MAAM,CAAC,8BAAsB,CAAC,KAAK,IAAI;QAAE,MAAM,CAAC,8BAAsB,CAAC,GAAG,IAAI,CAAC;IACnF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,8BAA8B,CAAC,IAA+B,EAAE,QAA2C;IACzH,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,UAAU,CAAC;QAAE,OAAO;IAC9E,IAAI,CAAC;QACH,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3E,CAAC;IAAC,MAAM,CAAC;QACP,8EAA8E;IAChF,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,IAA+B,EAAE,QAA2C;IACjH,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,UAAU,CAAC;QAAE,OAAO,EAAE,CAAC;IACjF,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/C,OAAO,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACrD,CAAC"}
@@ -4,12 +4,11 @@
4
4
  * This module is the contract the peer chokepoint subagent and downstream
5
5
  * consumers import from. Every export here is a stable, documented surface.
6
6
  */
7
- export { ObservabilityRecorder, type ObservabilityConfig } from './recorder';
8
- export { ObservabilityShipper, type ShipperConfig } from './shipper';
9
7
  export { computeCostUsd, MODEL_PRICES, type ModelPrice } from './model-prices';
10
- export type { TraceRecord, SpanRecord, SpanKind, SpanStatus, SpanAttributes, PolicyCallAttributes, GenerationAttributes, EventAttributes, SessionRecord, IngestPayload, IngestBatch, TraceContext, PolicyDecision, PolicySource, PolicyEnforcementAction, EnforcementAction, EventLevel, } from './schema';
11
- export { isValidTraceRecord, isValidSpanRecord, isValidSpanAttributes, isValidPolicyCallAttributes, isValidGenerationAttributes, isValidEventAttributes, isValidIngestBatch, isValidIngestPayload, isValidUuid, } from './schema';
12
- export { startTrace, recordSpan, recordPolicyCall, recordGeneration, recordEvent, openSpan, closeSpan, endTrace, flushObservability, } from './handle';
13
- export { __setObservabilitySinkForTests } from './recorder';
14
- export type { SinkEvent, ObservabilitySink } from './recorder';
8
+ export { resolveOtelConfig, lowerCaptureMode, CAPTURE_RANK, type CaptureMode, type OtelExporterMode, type OtelProtocol, type ObservabilityOptions, type ResolvedOtelConfig, } from './otel-config';
9
+ export { ArmorIQTelemetryRuntime, type AttributeContext, type TelemetryRuntimeOptions, type TelemetryAttributes, type TelemetryAttributeValue, } from './otel-runtime';
10
+ export { parsePolicyLease, fallbackPolicyLease, isLeaseCurrent, type PolicyLease } from './policy-lease';
11
+ export { projectTelemetryContent, METADATA_CONTENT_PLACEHOLDER, type ContentReasonCode, type ContentCaptureAuthority, type TelemetryContent, type ProjectedTelemetryContent, } from './content-capture';
12
+ export { __ownedTelemetryRuntimeCountForTests } from './otel-shutdown';
13
+ export { OtelSession, type OtelSessionOptions, type OtelTerminalStatus, type SpanHandle, type PlanInput, type PolicyInput, type PolicyResult, type ToolResult, type RootInput, type ModelInput, type ModelOutput, } from './otel-session';
15
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,qBAAqB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE/E,YAAY,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,GACX,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,GACZ,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC"}
@@ -6,34 +6,25 @@
6
6
  * consumers import from. Every export here is a stable, documented surface.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.__setObservabilitySinkForTests = exports.flushObservability = exports.endTrace = exports.closeSpan = exports.openSpan = exports.recordEvent = exports.recordGeneration = exports.recordPolicyCall = exports.recordSpan = exports.startTrace = exports.isValidUuid = exports.isValidIngestPayload = exports.isValidIngestBatch = exports.isValidEventAttributes = exports.isValidGenerationAttributes = exports.isValidPolicyCallAttributes = exports.isValidSpanAttributes = exports.isValidSpanRecord = exports.isValidTraceRecord = exports.MODEL_PRICES = exports.computeCostUsd = exports.ObservabilityShipper = exports.ObservabilityRecorder = void 0;
10
- var recorder_1 = require("./recorder");
11
- Object.defineProperty(exports, "ObservabilityRecorder", { enumerable: true, get: function () { return recorder_1.ObservabilityRecorder; } });
12
- var shipper_1 = require("./shipper");
13
- Object.defineProperty(exports, "ObservabilityShipper", { enumerable: true, get: function () { return shipper_1.ObservabilityShipper; } });
9
+ exports.OtelSession = exports.__ownedTelemetryRuntimeCountForTests = exports.METADATA_CONTENT_PLACEHOLDER = exports.projectTelemetryContent = exports.isLeaseCurrent = exports.fallbackPolicyLease = exports.parsePolicyLease = exports.ArmorIQTelemetryRuntime = exports.CAPTURE_RANK = exports.lowerCaptureMode = exports.resolveOtelConfig = exports.MODEL_PRICES = exports.computeCostUsd = void 0;
14
10
  var model_prices_1 = require("./model-prices");
15
11
  Object.defineProperty(exports, "computeCostUsd", { enumerable: true, get: function () { return model_prices_1.computeCostUsd; } });
16
12
  Object.defineProperty(exports, "MODEL_PRICES", { enumerable: true, get: function () { return model_prices_1.MODEL_PRICES; } });
17
- var schema_1 = require("./schema");
18
- Object.defineProperty(exports, "isValidTraceRecord", { enumerable: true, get: function () { return schema_1.isValidTraceRecord; } });
19
- Object.defineProperty(exports, "isValidSpanRecord", { enumerable: true, get: function () { return schema_1.isValidSpanRecord; } });
20
- Object.defineProperty(exports, "isValidSpanAttributes", { enumerable: true, get: function () { return schema_1.isValidSpanAttributes; } });
21
- Object.defineProperty(exports, "isValidPolicyCallAttributes", { enumerable: true, get: function () { return schema_1.isValidPolicyCallAttributes; } });
22
- Object.defineProperty(exports, "isValidGenerationAttributes", { enumerable: true, get: function () { return schema_1.isValidGenerationAttributes; } });
23
- Object.defineProperty(exports, "isValidEventAttributes", { enumerable: true, get: function () { return schema_1.isValidEventAttributes; } });
24
- Object.defineProperty(exports, "isValidIngestBatch", { enumerable: true, get: function () { return schema_1.isValidIngestBatch; } });
25
- Object.defineProperty(exports, "isValidIngestPayload", { enumerable: true, get: function () { return schema_1.isValidIngestPayload; } });
26
- Object.defineProperty(exports, "isValidUuid", { enumerable: true, get: function () { return schema_1.isValidUuid; } });
27
- var handle_1 = require("./handle");
28
- Object.defineProperty(exports, "startTrace", { enumerable: true, get: function () { return handle_1.startTrace; } });
29
- Object.defineProperty(exports, "recordSpan", { enumerable: true, get: function () { return handle_1.recordSpan; } });
30
- Object.defineProperty(exports, "recordPolicyCall", { enumerable: true, get: function () { return handle_1.recordPolicyCall; } });
31
- Object.defineProperty(exports, "recordGeneration", { enumerable: true, get: function () { return handle_1.recordGeneration; } });
32
- Object.defineProperty(exports, "recordEvent", { enumerable: true, get: function () { return handle_1.recordEvent; } });
33
- Object.defineProperty(exports, "openSpan", { enumerable: true, get: function () { return handle_1.openSpan; } });
34
- Object.defineProperty(exports, "closeSpan", { enumerable: true, get: function () { return handle_1.closeSpan; } });
35
- Object.defineProperty(exports, "endTrace", { enumerable: true, get: function () { return handle_1.endTrace; } });
36
- Object.defineProperty(exports, "flushObservability", { enumerable: true, get: function () { return handle_1.flushObservability; } });
37
- var recorder_2 = require("./recorder");
38
- Object.defineProperty(exports, "__setObservabilitySinkForTests", { enumerable: true, get: function () { return recorder_2.__setObservabilitySinkForTests; } });
13
+ var otel_config_1 = require("./otel-config");
14
+ Object.defineProperty(exports, "resolveOtelConfig", { enumerable: true, get: function () { return otel_config_1.resolveOtelConfig; } });
15
+ Object.defineProperty(exports, "lowerCaptureMode", { enumerable: true, get: function () { return otel_config_1.lowerCaptureMode; } });
16
+ Object.defineProperty(exports, "CAPTURE_RANK", { enumerable: true, get: function () { return otel_config_1.CAPTURE_RANK; } });
17
+ var otel_runtime_1 = require("./otel-runtime");
18
+ Object.defineProperty(exports, "ArmorIQTelemetryRuntime", { enumerable: true, get: function () { return otel_runtime_1.ArmorIQTelemetryRuntime; } });
19
+ var policy_lease_1 = require("./policy-lease");
20
+ Object.defineProperty(exports, "parsePolicyLease", { enumerable: true, get: function () { return policy_lease_1.parsePolicyLease; } });
21
+ Object.defineProperty(exports, "fallbackPolicyLease", { enumerable: true, get: function () { return policy_lease_1.fallbackPolicyLease; } });
22
+ Object.defineProperty(exports, "isLeaseCurrent", { enumerable: true, get: function () { return policy_lease_1.isLeaseCurrent; } });
23
+ var content_capture_1 = require("./content-capture");
24
+ Object.defineProperty(exports, "projectTelemetryContent", { enumerable: true, get: function () { return content_capture_1.projectTelemetryContent; } });
25
+ Object.defineProperty(exports, "METADATA_CONTENT_PLACEHOLDER", { enumerable: true, get: function () { return content_capture_1.METADATA_CONTENT_PLACEHOLDER; } });
26
+ var otel_shutdown_1 = require("./otel-shutdown");
27
+ Object.defineProperty(exports, "__ownedTelemetryRuntimeCountForTests", { enumerable: true, get: function () { return otel_shutdown_1.__ownedTelemetryRuntimeCountForTests; } });
28
+ var otel_session_1 = require("./otel-session");
29
+ Object.defineProperty(exports, "OtelSession", { enumerable: true, get: function () { return otel_session_1.OtelSession; } });
39
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,uCAA6E;AAApE,iHAAA,qBAAqB,OAAA;AAC9B,qCAAqE;AAA5D,+GAAA,oBAAoB,OAAA;AAC7B,+CAA+E;AAAtE,8GAAA,cAAc,OAAA;AAAE,4GAAA,YAAY,OAAA;AAsBrC,mCAUkB;AAThB,4GAAA,kBAAkB,OAAA;AAClB,2GAAA,iBAAiB,OAAA;AACjB,+GAAA,qBAAqB,OAAA;AACrB,qHAAA,2BAA2B,OAAA;AAC3B,qHAAA,2BAA2B,OAAA;AAC3B,gHAAA,sBAAsB,OAAA;AACtB,4GAAA,kBAAkB,OAAA;AAClB,8GAAA,oBAAoB,OAAA;AACpB,qGAAA,WAAW,OAAA;AAGb,mCAUkB;AAThB,oGAAA,UAAU,OAAA;AACV,oGAAA,UAAU,OAAA;AACV,0GAAA,gBAAgB,OAAA;AAChB,0GAAA,gBAAgB,OAAA;AAChB,qGAAA,WAAW,OAAA;AACX,kGAAA,QAAQ,OAAA;AACR,mGAAA,SAAS,OAAA;AACT,kGAAA,QAAQ,OAAA;AACR,4GAAA,kBAAkB,OAAA;AAGpB,uCAA4D;AAAnD,0HAAA,8BAA8B,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+CAA+E;AAAtE,8GAAA,cAAc,OAAA;AAAE,4GAAA,YAAY,OAAA;AAErC,6CASuB;AARrB,gHAAA,iBAAiB,OAAA;AACjB,+GAAA,gBAAgB,OAAA;AAChB,2GAAA,YAAY,OAAA;AAQd,+CAMwB;AALtB,uHAAA,uBAAuB,OAAA;AAMzB,+CAAyG;AAAhG,gHAAA,gBAAgB,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAC9D,qDAO2B;AANzB,0HAAA,uBAAuB,OAAA;AACvB,+HAAA,4BAA4B,OAAA;AAM9B,iDAAuE;AAA9D,qIAAA,oCAAoC,OAAA;AAC7C,+CAYwB;AAXtB,2GAAA,WAAW,OAAA"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Immutable, fail-safe OpenTelemetry configuration.
3
+ *
4
+ * The public contract intentionally follows standard OTLP environment
5
+ * variables. It never identifies or configures a specific external vendor.
6
+ */
7
+ import type { TracerProvider } from '@opentelemetry/api';
8
+ export type CaptureMode = 'off' | 'metadata' | 'enhanced' | 'debug';
9
+ export type OtelExporterMode = 'armoriq' | 'external' | 'provider';
10
+ export type OtelProtocol = 'http/protobuf';
11
+ export interface ObservabilityOptions {
12
+ enabled?: boolean;
13
+ exporter?: OtelExporterMode;
14
+ /** Explicit complete OTLP traces endpoint. */
15
+ endpoint?: string;
16
+ /** Explicit OTLP base endpoint; `/v1/traces` is appended. */
17
+ baseEndpoint?: string;
18
+ headers?: Readonly<Record<string, string>>;
19
+ protocol?: OtelProtocol;
20
+ timeoutMillis?: number;
21
+ resourceAttributes?: Readonly<Record<string, string>>;
22
+ tracerProvider?: TracerProvider;
23
+ captureMode?: CaptureMode;
24
+ serviceName?: string;
25
+ /** Explicit caller-owned user identity for external OTel export. */
26
+ userId?: string;
27
+ }
28
+ export interface ResolvedOtelConfig {
29
+ readonly enabled: boolean;
30
+ readonly exporter: OtelExporterMode;
31
+ readonly endpoint?: string;
32
+ readonly headers: Readonly<Record<string, string>>;
33
+ readonly protocol: OtelProtocol;
34
+ readonly timeoutMillis: number;
35
+ readonly resourceAttributes: Readonly<Record<string, string>>;
36
+ readonly tracerProvider?: TracerProvider;
37
+ readonly captureMode: CaptureMode;
38
+ readonly serviceName: string;
39
+ readonly disabledReason?: string;
40
+ }
41
+ /** Returns an externally safe value, or no value when it could identify a person. */
42
+ export declare function sanitizeExternalTelemetryValue(value: string, maxLength?: number): string | undefined;
43
+ /** Resolve without network I/O. No returned object is mutable by a caller. */
44
+ export declare function resolveOtelConfig(options?: ObservabilityOptions): ResolvedOtelConfig;
45
+ export declare const CAPTURE_RANK: Readonly<Record<CaptureMode, number>>;
46
+ export declare function lowerCaptureMode(left: CaptureMode, right: CaptureMode): CaptureMode;
47
+ //# sourceMappingURL=otel-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otel-config.d.ts","sourceRoot":"","sources":["../../src/observability/otel-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AACnE,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,Q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