autotel-genai 0.8.0 → 0.9.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 (56) hide show
  1. package/README.md +127 -3
  2. package/dist/agent/index.cjs +1 -1
  3. package/dist/agent/index.d.cts +3 -3
  4. package/dist/agent/index.d.ts +3 -3
  5. package/dist/agent/index.js +1 -1
  6. package/dist/{agent-BtA_RKiI.js → agent-BaaC6IUD.js} +1 -1
  7. package/dist/{agent-BlO5Zmnl.cjs → agent-DavvAWIG.cjs} +1 -1
  8. package/dist/{agent-security-D_m3bUtS.d.cts → agent-security-BjM1QOTr.d.cts} +2 -2
  9. package/dist/{agent-security-BFx9kEbA.d.ts → agent-security-D9NfzH7I.d.ts} +2 -2
  10. package/dist/ai-sdk-bridge.cjs +1 -1
  11. package/dist/ai-sdk-bridge.d.cts +3 -3
  12. package/dist/ai-sdk-bridge.d.ts +3 -3
  13. package/dist/ai-sdk-bridge.js +1 -1
  14. package/dist/{attributes-E6Q-xXtL.js → attributes-0Y1Tuidm.js} +6 -0
  15. package/dist/{attributes-BvAXlXyS.d.cts → attributes-B8K6NxiM.d.cts} +17 -1
  16. package/dist/{attributes-uoNIHNSt.d.ts → attributes-BNl903D-.d.ts} +17 -1
  17. package/dist/{attributes-C5CvvaLY.cjs → attributes-D62j2B2U.cjs} +6 -0
  18. package/dist/{cost-BiGrdrt6.d.cts → cost-BcW9kEgp.d.cts} +55 -1
  19. package/dist/{cost-BiGrdrt6.d.ts → cost-BcW9kEgp.d.ts} +55 -1
  20. package/dist/cost.cjs +59 -3
  21. package/dist/cost.d.cts +2 -2
  22. package/dist/cost.d.ts +2 -2
  23. package/dist/cost.js +57 -3
  24. package/dist/{events-iFMD2E30.d.ts → events-B1Kqejbc.d.cts} +22 -2
  25. package/dist/events-B1l3riel.cjs +534 -0
  26. package/dist/{events-DgZpgDHl.d.cts → events-CdjXIatQ.d.ts} +22 -2
  27. package/dist/events-DhkQuc2S.js +481 -0
  28. package/dist/events.cjs +7 -148
  29. package/dist/events.d.cts +2 -2
  30. package/dist/events.d.ts +2 -2
  31. package/dist/events.js +2 -144
  32. package/dist/{index-ClhR1smo.d.cts → index-C27Y-PcB.d.cts} +1 -1
  33. package/dist/{index-B89YY8XB.d.ts → index-czlGka94.d.ts} +5 -5
  34. package/dist/{index-D_POIOI3.d.ts → index-nnJ4pvQy.d.ts} +1 -1
  35. package/dist/{index-C_-SJFpV.d.cts → index-q9JnZtRX.d.cts} +5 -5
  36. package/dist/index.cjs +11 -4
  37. package/dist/index.d.cts +93 -8
  38. package/dist/index.d.ts +93 -8
  39. package/dist/index.js +7 -7
  40. package/dist/observer/index.cjs +1 -1
  41. package/dist/observer/index.d.cts +1 -1
  42. package/dist/observer/index.d.ts +1 -1
  43. package/dist/observer/index.js +1 -1
  44. package/dist/{observer-BZbTOC93.cjs → observer-Dp-nmI1J.cjs} +2 -2
  45. package/dist/{observer-CxlBo2Eh.js → observer-tpNaVA2X.js} +2 -2
  46. package/dist/{semconv-Dyevkkza.d.ts → semconv-m_Y-ve_N.d.cts} +28 -1
  47. package/dist/{semconv-Dyevkkza.d.cts → semconv-m_Y-ve_N.d.ts} +28 -1
  48. package/dist/semconv.cjs +28 -0
  49. package/dist/semconv.d.cts +2 -2
  50. package/dist/semconv.d.ts +2 -2
  51. package/dist/semconv.js +28 -1
  52. package/dist/trace.cjs +4 -2
  53. package/dist/trace.d.cts +3 -3
  54. package/dist/trace.d.ts +3 -3
  55. package/dist/trace.js +5 -3
  56. package/package.json +4 -4
package/README.md CHANGED
@@ -68,7 +68,7 @@ export const chat = traceGenAI({
68
68
  | **Cost** | `autotel-genai/cost` | `estimateLLMCost`, `recordLLMCost`, `MODEL_PRICING` (cache-read/write aware) |
69
69
  | **Metrics** | `autotel-genai/metrics` | `genAiMetricViews()` re-buckets the canonical histograms |
70
70
  | **Attributes** | `autotel-genai` | typed builders → canonical attribute maps |
71
- | **Events** | `autotel-genai/events` | opt-in content + `inference.operation.details` / `evaluation.result` |
71
+ | **Events** | `autotel-genai/events` | opt-in content (binary redacted, size-capped) + `inference.operation.details` / `evaluation.result` |
72
72
  | **Trace** | `autotel-genai/trace` | `traceGenAI()`, `recordGenAiResponse/Usage` |
73
73
  | **Guard** | `autotel-genai/guard` | inline cost/token/loop kill-switch: `createGenAiBudget`, `createGenAiGuard`, `parseGuardRules` |
74
74
  | **Streaming** | `autotel-genai/streaming` | TTFC, throughput, inter-chunk distribution: `createStreamTimer`, `recordStreamTiming` |
@@ -88,6 +88,36 @@ recordLLMCost(ctx, 'claude-sonnet-4', {
88
88
  });
89
89
  ```
90
90
 
91
+ **Server-side tools are money too.** Web search, code interpreter and file
92
+ search are billed per call, outside the token counts. An agent that searches on
93
+ every step can spend more there than on tokens, and a cost built from tokens
94
+ alone will never show it:
95
+
96
+ ```ts
97
+ recordLLMCost(ctx, 'claude-sonnet-4', {
98
+ inputTokens: 4000,
99
+ serverToolCalls: { web_search: 12 }, // SERVER_TOOL_PRICING_PER_1K
100
+ });
101
+ ```
102
+
103
+ A tool with no price is left out of the figure rather than guessed at zero, and
104
+ named on the span as `gen_ai.usage.cost.unpriced_tools` so the gap is visible.
105
+
106
+ **Cache accounting.** By default cache reads are treated as a subset of
107
+ `inputTokens` (what OpenAI and Anthropic report directly) and cache writes as
108
+ additive. Gateways and normalised usage objects do not all agree; where yours
109
+ reports cache tokens separately, say so — getting it backwards subtracts a pool
110
+ that was never in the input, understating exactly the calls that cost most:
111
+
112
+ ```ts
113
+ recordLLMCost(ctx, model, { ...usage, cacheTokensExclusive: true });
114
+ ```
115
+
116
+ **Where the numbers came from.** `tokenSource: 'observed' | 'estimated'` labels
117
+ the counts as `autotel.evidence.tokens`. A locally counted token and a
118
+ provider-reported one are the same number on a span; unlabelled, a guess reads
119
+ as an invoice.
120
+
91
121
  ### Metrics
92
122
 
93
123
  ```ts
@@ -170,8 +200,8 @@ throughput, and an inter-chunk gap distribution `{min,p10,median,avg,p90,max}`).
170
200
 
171
201
  ### Content capture & warnings
172
202
 
173
- `setGenAiContent` now gates input/output independently and base64-encodes binary
174
- (image/audio/file) parts instead of letting `JSON.stringify` corrupt them:
203
+ `setGenAiContent` gates input and output independently, replaces inline binary
204
+ with a placeholder, and caps what is left:
175
205
 
176
206
  ```ts
177
207
  import { setGenAiContent, recordModelWarnings } from 'autotel-genai';
@@ -185,6 +215,46 @@ setGenAiContent(
185
215
  recordModelWarnings(ctx, result.warnings); // surface provider warnings vendors only log
186
216
  ```
187
217
 
218
+ **Binary is redacted, not recorded.** A multimodal prompt carries its images,
219
+ audio and PDFs inline as base64. Serialised verbatim, one such call is a
220
+ megabyte-scale span attribute that collectors truncate mid-string and nobody
221
+ reads. The bytes were never the interesting part, so they are replaced by a
222
+ placeholder that says what stood there:
223
+
224
+ ```jsonc
225
+ // gen_ai.input.messages
226
+ [
227
+ {
228
+ "role": "user",
229
+ "parts": [
230
+ { "type": "text", "content": "what is in this photo?" },
231
+ { "type": "input_image", "data": "[base64 image/png redacted]" },
232
+ ],
233
+ },
234
+ ]
235
+ ```
236
+
237
+ Recognition is contextual: a bare alphanumeric string must be 1KB before it is
238
+ suspected, but under a key that means binary (`data`, `image_url`,
239
+ `inline_data`) or beside a `mediaType` / `format` hint, 64 bytes is enough. An
240
+ explicit `text/*` media type settles it the other way and nothing is touched.
241
+
242
+ Whatever survives is capped at `DEFAULT_MAX_CONTENT_BYTES` (200KB) per
243
+ attribute. Both are declared rather than silent — a cut attribute gains
244
+ `<attribute>.original_size` and the span is labelled `autotel.evidence.input =
245
+ 'truncated'` (or `'redacted'`), so a reader can tell a short prompt from a
246
+ prompt you only kept the front of.
247
+
248
+ ```ts
249
+ setGenAiContent(ctx, content, {
250
+ redactBinary: false, // only when the payload itself is under investigation
251
+ maxContentBytes: 0, // 0 or less: no cap
252
+ });
253
+ ```
254
+
255
+ `redactBinaryContent()` and `truncateUtf8()` are exported for payloads that
256
+ never reach a span — an event body, a log line, your own exporter.
257
+
188
258
  ### Agents & tools
189
259
 
190
260
  ```ts
@@ -457,6 +527,60 @@ synchronously, so they nest under the request span you already opened, reach
457
527
  every `init()` destination, pass through your `spanEnrichers` (including
458
528
  `langfuseCompatibility`), and get priced.
459
529
 
530
+ ### Prompt versions
531
+
532
+ `gen_ai.prompt.name` alone cannot tell you which edit moved the numbers. Stamp
533
+ the version too, and cost, latency and evaluation score become splittable by
534
+ prompt change in whatever backend holds the spans:
535
+
536
+ ```ts
537
+ traceGenAI({
538
+ provider: 'openai',
539
+ model: 'gpt-4o',
540
+ workflow: {
541
+ promptName: 'initial-router',
542
+ promptVersion: 7, // or your registry's own id
543
+ promptLabel: 'production',
544
+ promptHash: 'sha256:…', // when there is no registry to version it
545
+ },
546
+ });
547
+ ```
548
+
549
+ ### Grouping traces into sessions
550
+
551
+ A conversation is more than one trace. Two canonical attributes already carry
552
+ that, and neither is GenAI-specific:
553
+
554
+ - `gen_ai.conversation.id` — the thread this call belongs to.
555
+ - `session.id` — the visit it happened in, set by autotel core's `setSession()`
556
+ or stamped on every browser span by `autotel-web`.
557
+
558
+ Set them and total cost per session, traces per conversation, and
559
+ session-level latency are ordinary queries. This is the same hierarchy vendor
560
+ LLM-analytics products sell as `$ai_session_id`; here it is spec, so it works
561
+ wherever the spans land.
562
+
563
+ ### Sending the same spans to PostHog
564
+
565
+ PostHog ingests plain OTLP: `PostHogSpanProcessor` from `@posthog/ai/otel`
566
+ forwards any span carrying `gen_ai.*` attributes and assembles its `$ai_*`
567
+ event server-side. Because this package emits canonical names, no mapping layer
568
+ is needed — add the processor and the spans you already have become LLM
569
+ analytics:
570
+
571
+ ```ts
572
+ import { NodeSDK } from '@opentelemetry/sdk-node';
573
+ import { PostHogSpanProcessor } from '@posthog/ai/otel';
574
+
575
+ const sdk = new NodeSDK({
576
+ spanProcessors: [new PostHogSpanProcessor({ projectToken: 'phc_…' })],
577
+ });
578
+ ```
579
+
580
+ `src/posthog-contract.test.ts` pins that agreement, so it cannot quietly stop
581
+ being true. For the browser half — session, replay and person joined in both
582
+ directions — see `autotel-posthog`.
583
+
460
584
  ## Semantic conventions
461
585
 
462
586
  Aligned to the `semantic-conventions-genai` snapshot. Span names follow the
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_agent_security = require('../agent-security-CMVIlhbh.cjs');
3
- const require_agent = require('../agent-BlO5Zmnl.cjs');
3
+ const require_agent = require('../agent-DavvAWIG.cjs');
4
4
 
5
5
  exports.AGENT_AUDIT_SCHEMA_VERSION = require_agent.AGENT_AUDIT_SCHEMA_VERSION;
6
6
  exports.AGENT_OUTCOME_LABEL = require_agent.AGENT_OUTCOME_LABEL;
@@ -1,4 +1,4 @@
1
- import { $ as withScopedTool, A as TOOL_CALL_ID_LABEL, B as HoneyTokenToolOptions, C as SEQUENCE_RULES, Ct as hashPayload, D as SequenceSecurityEvent, E as SequenceRule, F as spansToSequenceEvents, G as CrossAgentMonitor, H as EVAL_IDENTITY_ATTR, I as EvalIncidentQueryResult, J as CrossAgentEvent, K as CrossAgentMonitorOptions, L as querySpansForEvalIncident, M as detectSequences, N as emitSequenceDetections, O as SequenceSeverity, P as sequenceDetectionsToSecurityEvents, Q as detectCrossAgentPattern, R as spansToCrossAgentEvents, S as POLICY_DECISION_LABEL, St as canonicalizeForHash, T as SequenceEvent, U as RecordEvalRunIdentityInput, V as createHoneyTokenTool, W as recordEvalRunIdentity, X as DetectCrossAgentPatternOptions, Y as CrossAgentSecurityEvent, Z as crossAgentDetectionsToSecurityEvents, _ as sequenceRulesToSigma, _t as recordAgentHandoff, a as AgentPlanRiskVerdict, at as RotateAgentIdentityInput, b as DETECTION_EVENT, bt as createAgentAuditMetadata, c as recordPlanRiskAssessment, ct as defineAgentAction, d as DETECTION_DISPOSITION_EVENT, dt as recordPolicyDecision, et as CreateSignedEventEnvelopeOptions, f as DetectionDispositionStatus, ft as withAgentAction, g as sequenceRuleToSigma, gt as delegateToAgent, h as SigmaDocument, ht as RecordAgentHandoffMetadata, i as AgentPlanClassifierResult, it as RevokeAgentIdentityInput, j as TOOL_NAME_LABEL, k as SequenceSpanLike, l as runAgentPlanClassifier, lt as defineAgentToolCall, m as recordDetectionDisposition, mt as DelegateToAgentInput, n as AgentPlanClassifier, nt as verifyEventEnvelopeHash, o as RecordPlanRiskAssessmentOptions, ot as createAgentIdentityRegistry, p as RecordDetectionDispositionInput, pt as withAgentToolCall, q as CrossAgentDetection, r as AgentPlanClassifierInput, rt as ProvisionAgentIdentityInput, s as heuristicPlanRiskClassifier, st as withAgentSession, t as AGENT_PLAN_RISK_ATTR, tt as createSignedEventEnvelope, u as DETECTION_DISPOSITION_ATTR, ut as recordDecisionBasis, v as AGENT_OUTCOME_LABEL, vt as flattenAgentAttributes, w as SequenceDetection, wt as AGENT_AUDIT_SCHEMA_VERSION, x as EmitSequenceDetectionsOptions, xt as HashPayloadOptions, y as DETECTION_ATTR, yt as setAgentAttributes, z as HoneyTokenToolDefinition } from "../index-ClhR1smo.cjs";
2
- import { a as TokenUsage, i as ModelPricing } from "../cost-BiGrdrt6.cjs";
3
- import { $ as PrivacyProfileName, A as AgentAiMetadata, B as AgentOutcome, C as recordMemoryAccess, D as AgentActionFactory, E as tryRecordHumanApproval, F as AgentIdentity, G as AgentToolCallOptions, H as AgentSessionMetadata, I as AgentIdentityRecord, K as AiLifecycleStage, L as AgentIdentityRegistry, M as AgentDecisionMetadata, N as AgentEventKind, O as AgentActionMetadata, P as AgentHandler, Q as PrivacyProfile, R as AgentIdentityStatus, S as recordInputProvenance, T as recordRenderOutput, U as AgentSessionStatus, V as AgentSessionActionMetadata, W as AgentToolCallActionMetadata, X as PolicyDecision, Y as GovernanceMetadata, Z as PolicyMetadata, _ as deriveActionRiskClass, a as AgentConsentOutcome, at as resolvePrivacyProfile, b as recordControllerId, c as AgentOutputFormat, ct as AgentContext, d as RecordControllerInput, et as ScopedToolDefinition, f as RecordHumanApprovalInput, g as RecordRenderOutputInput, h as RecordPlanStepInput, i as AgentConsentEvidence, it as SanitizationEvidence, j as AgentAuditEventEnvelope, k as AgentActionOptions, l as AgentSecurityRecordOptions, lt as agentContextFromSpan, m as RecordMemoryAccessInput, n as ActionRiskHints, nt as ToolStatus, o as AgentInputProvenance, ot as sanitizeAuditPayload, p as RecordInputProvenanceInput, q as DelegationContext, r as AgentActionRiskClass, rt as PrivacyProfileInput, s as AgentMemoryOperation, st as sanitizeAuditPayloadWithEvidence, t as AGENT_SECURITY_ATTR, tt as ToolCallMetadata, u as RecordActiveScopesInput, v as recordActionRiskClass, w as recordPlanStep, x as recordHumanApproval, y as recordActiveScopes, z as AgentMetadataInput } from "../agent-security-D_m3bUtS.cjs";
1
+ import { $ as withScopedTool, A as TOOL_CALL_ID_LABEL, B as HoneyTokenToolOptions, C as SEQUENCE_RULES, Ct as hashPayload, D as SequenceSecurityEvent, E as SequenceRule, F as spansToSequenceEvents, G as CrossAgentMonitor, H as EVAL_IDENTITY_ATTR, I as EvalIncidentQueryResult, J as CrossAgentEvent, K as CrossAgentMonitorOptions, L as querySpansForEvalIncident, M as detectSequences, N as emitSequenceDetections, O as SequenceSeverity, P as sequenceDetectionsToSecurityEvents, Q as detectCrossAgentPattern, R as spansToCrossAgentEvents, S as POLICY_DECISION_LABEL, St as canonicalizeForHash, T as SequenceEvent, U as RecordEvalRunIdentityInput, V as createHoneyTokenTool, W as recordEvalRunIdentity, X as DetectCrossAgentPatternOptions, Y as CrossAgentSecurityEvent, Z as crossAgentDetectionsToSecurityEvents, _ as sequenceRulesToSigma, _t as recordAgentHandoff, a as AgentPlanRiskVerdict, at as RotateAgentIdentityInput, b as DETECTION_EVENT, bt as createAgentAuditMetadata, c as recordPlanRiskAssessment, ct as defineAgentAction, d as DETECTION_DISPOSITION_EVENT, dt as recordPolicyDecision, et as CreateSignedEventEnvelopeOptions, f as DetectionDispositionStatus, ft as withAgentAction, g as sequenceRuleToSigma, gt as delegateToAgent, h as SigmaDocument, ht as RecordAgentHandoffMetadata, i as AgentPlanClassifierResult, it as RevokeAgentIdentityInput, j as TOOL_NAME_LABEL, k as SequenceSpanLike, l as runAgentPlanClassifier, lt as defineAgentToolCall, m as recordDetectionDisposition, mt as DelegateToAgentInput, n as AgentPlanClassifier, nt as verifyEventEnvelopeHash, o as RecordPlanRiskAssessmentOptions, ot as createAgentIdentityRegistry, p as RecordDetectionDispositionInput, pt as withAgentToolCall, q as CrossAgentDetection, r as AgentPlanClassifierInput, rt as ProvisionAgentIdentityInput, s as heuristicPlanRiskClassifier, st as withAgentSession, t as AGENT_PLAN_RISK_ATTR, tt as createSignedEventEnvelope, u as DETECTION_DISPOSITION_ATTR, ut as recordDecisionBasis, v as AGENT_OUTCOME_LABEL, vt as flattenAgentAttributes, w as SequenceDetection, wt as AGENT_AUDIT_SCHEMA_VERSION, x as EmitSequenceDetectionsOptions, xt as HashPayloadOptions, y as DETECTION_ATTR, yt as setAgentAttributes, z as HoneyTokenToolDefinition } from "../index-C27Y-PcB.cjs";
2
+ import { i as ModelPricing, o as TokenUsage } from "../cost-BcW9kEgp.cjs";
3
+ import { $ as PrivacyProfileName, A as AgentAiMetadata, B as AgentOutcome, C as recordMemoryAccess, D as AgentActionFactory, E as tryRecordHumanApproval, F as AgentIdentity, G as AgentToolCallOptions, H as AgentSessionMetadata, I as AgentIdentityRecord, K as AiLifecycleStage, L as AgentIdentityRegistry, M as AgentDecisionMetadata, N as AgentEventKind, O as AgentActionMetadata, P as AgentHandler, Q as PrivacyProfile, R as AgentIdentityStatus, S as recordInputProvenance, T as recordRenderOutput, U as AgentSessionStatus, V as AgentSessionActionMetadata, W as AgentToolCallActionMetadata, X as PolicyDecision, Y as GovernanceMetadata, Z as PolicyMetadata, _ as deriveActionRiskClass, a as AgentConsentOutcome, at as resolvePrivacyProfile, b as recordControllerId, c as AgentOutputFormat, ct as AgentContext, d as RecordControllerInput, et as ScopedToolDefinition, f as RecordHumanApprovalInput, g as RecordRenderOutputInput, h as RecordPlanStepInput, i as AgentConsentEvidence, it as SanitizationEvidence, j as AgentAuditEventEnvelope, k as AgentActionOptions, l as AgentSecurityRecordOptions, lt as agentContextFromSpan, m as RecordMemoryAccessInput, n as ActionRiskHints, nt as ToolStatus, o as AgentInputProvenance, ot as sanitizeAuditPayload, p as RecordInputProvenanceInput, q as DelegationContext, r as AgentActionRiskClass, rt as PrivacyProfileInput, s as AgentMemoryOperation, st as sanitizeAuditPayloadWithEvidence, t as AGENT_SECURITY_ATTR, tt as ToolCallMetadata, u as RecordActiveScopesInput, v as recordActionRiskClass, w as recordPlanStep, x as recordHumanApproval, y as recordActiveScopes, z as AgentMetadataInput } from "../agent-security-BjM1QOTr.cjs";
4
4
  export { AGENT_AUDIT_SCHEMA_VERSION, AGENT_OUTCOME_LABEL, AGENT_PLAN_RISK_ATTR, AGENT_SECURITY_ATTR, type ActionRiskHints, type AgentActionFactory, type AgentActionMetadata, type AgentActionOptions, type AgentActionRiskClass, type AgentAiMetadata, type AgentAuditEventEnvelope, type AgentConsentEvidence, type AgentConsentOutcome, type AgentContext, type AgentDecisionMetadata, type AgentEventKind, type AgentHandler, type AgentIdentity, type AgentIdentityRecord, type AgentIdentityRegistry, type AgentIdentityStatus, type AgentInputProvenance, type AgentMemoryOperation, type AgentMetadataInput, type AgentOutcome, type AgentOutputFormat, type AgentPlanClassifier, type AgentPlanClassifierInput, type AgentPlanClassifierResult, type AgentPlanRiskVerdict, type AgentSecurityRecordOptions, type AgentSessionActionMetadata, type AgentSessionMetadata, type AgentSessionStatus, type AgentToolCallActionMetadata, type AgentToolCallOptions, type AiLifecycleStage, type CreateSignedEventEnvelopeOptions, type CrossAgentDetection, type CrossAgentEvent, CrossAgentMonitor, type CrossAgentMonitorOptions, type CrossAgentSecurityEvent, DETECTION_ATTR, DETECTION_DISPOSITION_ATTR, DETECTION_DISPOSITION_EVENT, DETECTION_EVENT, type DelegateToAgentInput, type DelegationContext, type DetectCrossAgentPatternOptions, type DetectionDispositionStatus, EVAL_IDENTITY_ATTR, type EmitSequenceDetectionsOptions, type EvalIncidentQueryResult, type GovernanceMetadata, type HashPayloadOptions, type HoneyTokenToolDefinition, type HoneyTokenToolOptions, type ModelPricing, POLICY_DECISION_LABEL, type PolicyDecision, type PolicyMetadata, type PrivacyProfile, type PrivacyProfileInput, type PrivacyProfileName, type ProvisionAgentIdentityInput, type RecordActiveScopesInput, type RecordAgentHandoffMetadata, type RecordControllerInput, type RecordDetectionDispositionInput, type RecordEvalRunIdentityInput, type RecordHumanApprovalInput, type RecordInputProvenanceInput, type RecordMemoryAccessInput, type RecordPlanRiskAssessmentOptions, type RecordPlanStepInput, type RecordRenderOutputInput, type RevokeAgentIdentityInput, type RotateAgentIdentityInput, SEQUENCE_RULES, type SanitizationEvidence, type ScopedToolDefinition, type SequenceDetection, type SequenceEvent, type SequenceRule, type SequenceSecurityEvent, type SequenceSeverity, type SequenceSpanLike, type SigmaDocument, TOOL_CALL_ID_LABEL, TOOL_NAME_LABEL, type TokenUsage, type ToolCallMetadata, type ToolStatus, agentContextFromSpan, canonicalizeForHash, createAgentAuditMetadata, createAgentIdentityRegistry, createHoneyTokenTool, createSignedEventEnvelope, crossAgentDetectionsToSecurityEvents, defineAgentAction, defineAgentToolCall, delegateToAgent, deriveActionRiskClass, detectCrossAgentPattern, detectSequences, emitSequenceDetections, flattenAgentAttributes, hashPayload, heuristicPlanRiskClassifier, querySpansForEvalIncident, recordActionRiskClass, recordActiveScopes, recordAgentHandoff, recordControllerId, recordDecisionBasis, recordDetectionDisposition, recordEvalRunIdentity, recordHumanApproval, recordInputProvenance, recordMemoryAccess, recordPlanRiskAssessment, recordPlanStep, recordPolicyDecision, recordRenderOutput, resolvePrivacyProfile, runAgentPlanClassifier, sanitizeAuditPayload, sanitizeAuditPayloadWithEvidence, sequenceDetectionsToSecurityEvents, sequenceRuleToSigma, sequenceRulesToSigma, setAgentAttributes, spansToCrossAgentEvents, spansToSequenceEvents, tryRecordHumanApproval, verifyEventEnvelopeHash, withAgentAction, withAgentSession, withAgentToolCall, withScopedTool };
@@ -1,4 +1,4 @@
1
- import { $ as withScopedTool, A as TOOL_CALL_ID_LABEL, B as HoneyTokenToolOptions, C as SEQUENCE_RULES, Ct as hashPayload, D as SequenceSecurityEvent, E as SequenceRule, F as spansToSequenceEvents, G as CrossAgentMonitor, H as EVAL_IDENTITY_ATTR, I as EvalIncidentQueryResult, J as CrossAgentEvent, K as CrossAgentMonitorOptions, L as querySpansForEvalIncident, M as detectSequences, N as emitSequenceDetections, O as SequenceSeverity, P as sequenceDetectionsToSecurityEvents, Q as detectCrossAgentPattern, R as spansToCrossAgentEvents, S as POLICY_DECISION_LABEL, St as canonicalizeForHash, T as SequenceEvent, U as RecordEvalRunIdentityInput, V as createHoneyTokenTool, W as recordEvalRunIdentity, X as DetectCrossAgentPatternOptions, Y as CrossAgentSecurityEvent, Z as crossAgentDetectionsToSecurityEvents, _ as sequenceRulesToSigma, _t as recordAgentHandoff, a as AgentPlanRiskVerdict, at as RotateAgentIdentityInput, b as DETECTION_EVENT, bt as createAgentAuditMetadata, c as recordPlanRiskAssessment, ct as defineAgentAction, d as DETECTION_DISPOSITION_EVENT, dt as recordPolicyDecision, et as CreateSignedEventEnvelopeOptions, f as DetectionDispositionStatus, ft as withAgentAction, g as sequenceRuleToSigma, gt as delegateToAgent, h as SigmaDocument, ht as RecordAgentHandoffMetadata, i as AgentPlanClassifierResult, it as RevokeAgentIdentityInput, j as TOOL_NAME_LABEL, k as SequenceSpanLike, l as runAgentPlanClassifier, lt as defineAgentToolCall, m as recordDetectionDisposition, mt as DelegateToAgentInput, n as AgentPlanClassifier, nt as verifyEventEnvelopeHash, o as RecordPlanRiskAssessmentOptions, ot as createAgentIdentityRegistry, p as RecordDetectionDispositionInput, pt as withAgentToolCall, q as CrossAgentDetection, r as AgentPlanClassifierInput, rt as ProvisionAgentIdentityInput, s as heuristicPlanRiskClassifier, st as withAgentSession, t as AGENT_PLAN_RISK_ATTR, tt as createSignedEventEnvelope, u as DETECTION_DISPOSITION_ATTR, ut as recordDecisionBasis, v as AGENT_OUTCOME_LABEL, vt as flattenAgentAttributes, w as SequenceDetection, wt as AGENT_AUDIT_SCHEMA_VERSION, x as EmitSequenceDetectionsOptions, xt as HashPayloadOptions, y as DETECTION_ATTR, yt as setAgentAttributes, z as HoneyTokenToolDefinition } from "../index-D_POIOI3.js";
2
- import { a as TokenUsage, i as ModelPricing } from "../cost-BiGrdrt6.js";
3
- import { $ as PrivacyProfileName, A as AgentAiMetadata, B as AgentOutcome, C as recordMemoryAccess, D as AgentActionFactory, E as tryRecordHumanApproval, F as AgentIdentity, G as AgentToolCallOptions, H as AgentSessionMetadata, I as AgentIdentityRecord, K as AiLifecycleStage, L as AgentIdentityRegistry, M as AgentDecisionMetadata, N as AgentEventKind, O as AgentActionMetadata, P as AgentHandler, Q as PrivacyProfile, R as AgentIdentityStatus, S as recordInputProvenance, T as recordRenderOutput, U as AgentSessionStatus, V as AgentSessionActionMetadata, W as AgentToolCallActionMetadata, X as PolicyDecision, Y as GovernanceMetadata, Z as PolicyMetadata, _ as deriveActionRiskClass, a as AgentConsentOutcome, at as resolvePrivacyProfile, b as recordControllerId, c as AgentOutputFormat, ct as AgentContext, d as RecordControllerInput, et as ScopedToolDefinition, f as RecordHumanApprovalInput, g as RecordRenderOutputInput, h as RecordPlanStepInput, i as AgentConsentEvidence, it as SanitizationEvidence, j as AgentAuditEventEnvelope, k as AgentActionOptions, l as AgentSecurityRecordOptions, lt as agentContextFromSpan, m as RecordMemoryAccessInput, n as ActionRiskHints, nt as ToolStatus, o as AgentInputProvenance, ot as sanitizeAuditPayload, p as RecordInputProvenanceInput, q as DelegationContext, r as AgentActionRiskClass, rt as PrivacyProfileInput, s as AgentMemoryOperation, st as sanitizeAuditPayloadWithEvidence, t as AGENT_SECURITY_ATTR, tt as ToolCallMetadata, u as RecordActiveScopesInput, v as recordActionRiskClass, w as recordPlanStep, x as recordHumanApproval, y as recordActiveScopes, z as AgentMetadataInput } from "../agent-security-BFx9kEbA.js";
1
+ import { $ as withScopedTool, A as TOOL_CALL_ID_LABEL, B as HoneyTokenToolOptions, C as SEQUENCE_RULES, Ct as hashPayload, D as SequenceSecurityEvent, E as SequenceRule, F as spansToSequenceEvents, G as CrossAgentMonitor, H as EVAL_IDENTITY_ATTR, I as EvalIncidentQueryResult, J as CrossAgentEvent, K as CrossAgentMonitorOptions, L as querySpansForEvalIncident, M as detectSequences, N as emitSequenceDetections, O as SequenceSeverity, P as sequenceDetectionsToSecurityEvents, Q as detectCrossAgentPattern, R as spansToCrossAgentEvents, S as POLICY_DECISION_LABEL, St as canonicalizeForHash, T as SequenceEvent, U as RecordEvalRunIdentityInput, V as createHoneyTokenTool, W as recordEvalRunIdentity, X as DetectCrossAgentPatternOptions, Y as CrossAgentSecurityEvent, Z as crossAgentDetectionsToSecurityEvents, _ as sequenceRulesToSigma, _t as recordAgentHandoff, a as AgentPlanRiskVerdict, at as RotateAgentIdentityInput, b as DETECTION_EVENT, bt as createAgentAuditMetadata, c as recordPlanRiskAssessment, ct as defineAgentAction, d as DETECTION_DISPOSITION_EVENT, dt as recordPolicyDecision, et as CreateSignedEventEnvelopeOptions, f as DetectionDispositionStatus, ft as withAgentAction, g as sequenceRuleToSigma, gt as delegateToAgent, h as SigmaDocument, ht as RecordAgentHandoffMetadata, i as AgentPlanClassifierResult, it as RevokeAgentIdentityInput, j as TOOL_NAME_LABEL, k as SequenceSpanLike, l as runAgentPlanClassifier, lt as defineAgentToolCall, m as recordDetectionDisposition, mt as DelegateToAgentInput, n as AgentPlanClassifier, nt as verifyEventEnvelopeHash, o as RecordPlanRiskAssessmentOptions, ot as createAgentIdentityRegistry, p as RecordDetectionDispositionInput, pt as withAgentToolCall, q as CrossAgentDetection, r as AgentPlanClassifierInput, rt as ProvisionAgentIdentityInput, s as heuristicPlanRiskClassifier, st as withAgentSession, t as AGENT_PLAN_RISK_ATTR, tt as createSignedEventEnvelope, u as DETECTION_DISPOSITION_ATTR, ut as recordDecisionBasis, v as AGENT_OUTCOME_LABEL, vt as flattenAgentAttributes, w as SequenceDetection, wt as AGENT_AUDIT_SCHEMA_VERSION, x as EmitSequenceDetectionsOptions, xt as HashPayloadOptions, y as DETECTION_ATTR, yt as setAgentAttributes, z as HoneyTokenToolDefinition } from "../index-nnJ4pvQy.js";
2
+ import { i as ModelPricing, o as TokenUsage } from "../cost-BcW9kEgp.js";
3
+ import { $ as PrivacyProfileName, A as AgentAiMetadata, B as AgentOutcome, C as recordMemoryAccess, D as AgentActionFactory, E as tryRecordHumanApproval, F as AgentIdentity, G as AgentToolCallOptions, H as AgentSessionMetadata, I as AgentIdentityRecord, K as AiLifecycleStage, L as AgentIdentityRegistry, M as AgentDecisionMetadata, N as AgentEventKind, O as AgentActionMetadata, P as AgentHandler, Q as PrivacyProfile, R as AgentIdentityStatus, S as recordInputProvenance, T as recordRenderOutput, U as AgentSessionStatus, V as AgentSessionActionMetadata, W as AgentToolCallActionMetadata, X as PolicyDecision, Y as GovernanceMetadata, Z as PolicyMetadata, _ as deriveActionRiskClass, a as AgentConsentOutcome, at as resolvePrivacyProfile, b as recordControllerId, c as AgentOutputFormat, ct as AgentContext, d as RecordControllerInput, et as ScopedToolDefinition, f as RecordHumanApprovalInput, g as RecordRenderOutputInput, h as RecordPlanStepInput, i as AgentConsentEvidence, it as SanitizationEvidence, j as AgentAuditEventEnvelope, k as AgentActionOptions, l as AgentSecurityRecordOptions, lt as agentContextFromSpan, m as RecordMemoryAccessInput, n as ActionRiskHints, nt as ToolStatus, o as AgentInputProvenance, ot as sanitizeAuditPayload, p as RecordInputProvenanceInput, q as DelegationContext, r as AgentActionRiskClass, rt as PrivacyProfileInput, s as AgentMemoryOperation, st as sanitizeAuditPayloadWithEvidence, t as AGENT_SECURITY_ATTR, tt as ToolCallMetadata, u as RecordActiveScopesInput, v as recordActionRiskClass, w as recordPlanStep, x as recordHumanApproval, y as recordActiveScopes, z as AgentMetadataInput } from "../agent-security-D9NfzH7I.js";
4
4
  export { AGENT_AUDIT_SCHEMA_VERSION, AGENT_OUTCOME_LABEL, AGENT_PLAN_RISK_ATTR, AGENT_SECURITY_ATTR, type ActionRiskHints, type AgentActionFactory, type AgentActionMetadata, type AgentActionOptions, type AgentActionRiskClass, type AgentAiMetadata, type AgentAuditEventEnvelope, type AgentConsentEvidence, type AgentConsentOutcome, type AgentContext, type AgentDecisionMetadata, type AgentEventKind, type AgentHandler, type AgentIdentity, type AgentIdentityRecord, type AgentIdentityRegistry, type AgentIdentityStatus, type AgentInputProvenance, type AgentMemoryOperation, type AgentMetadataInput, type AgentOutcome, type AgentOutputFormat, type AgentPlanClassifier, type AgentPlanClassifierInput, type AgentPlanClassifierResult, type AgentPlanRiskVerdict, type AgentSecurityRecordOptions, type AgentSessionActionMetadata, type AgentSessionMetadata, type AgentSessionStatus, type AgentToolCallActionMetadata, type AgentToolCallOptions, type AiLifecycleStage, type CreateSignedEventEnvelopeOptions, type CrossAgentDetection, type CrossAgentEvent, CrossAgentMonitor, type CrossAgentMonitorOptions, type CrossAgentSecurityEvent, DETECTION_ATTR, DETECTION_DISPOSITION_ATTR, DETECTION_DISPOSITION_EVENT, DETECTION_EVENT, type DelegateToAgentInput, type DelegationContext, type DetectCrossAgentPatternOptions, type DetectionDispositionStatus, EVAL_IDENTITY_ATTR, type EmitSequenceDetectionsOptions, type EvalIncidentQueryResult, type GovernanceMetadata, type HashPayloadOptions, type HoneyTokenToolDefinition, type HoneyTokenToolOptions, type ModelPricing, POLICY_DECISION_LABEL, type PolicyDecision, type PolicyMetadata, type PrivacyProfile, type PrivacyProfileInput, type PrivacyProfileName, type ProvisionAgentIdentityInput, type RecordActiveScopesInput, type RecordAgentHandoffMetadata, type RecordControllerInput, type RecordDetectionDispositionInput, type RecordEvalRunIdentityInput, type RecordHumanApprovalInput, type RecordInputProvenanceInput, type RecordMemoryAccessInput, type RecordPlanRiskAssessmentOptions, type RecordPlanStepInput, type RecordRenderOutputInput, type RevokeAgentIdentityInput, type RotateAgentIdentityInput, SEQUENCE_RULES, type SanitizationEvidence, type ScopedToolDefinition, type SequenceDetection, type SequenceEvent, type SequenceRule, type SequenceSecurityEvent, type SequenceSeverity, type SequenceSpanLike, type SigmaDocument, TOOL_CALL_ID_LABEL, TOOL_NAME_LABEL, type TokenUsage, type ToolCallMetadata, type ToolStatus, agentContextFromSpan, canonicalizeForHash, createAgentAuditMetadata, createAgentIdentityRegistry, createHoneyTokenTool, createSignedEventEnvelope, crossAgentDetectionsToSecurityEvents, defineAgentAction, defineAgentToolCall, delegateToAgent, deriveActionRiskClass, detectCrossAgentPattern, detectSequences, emitSequenceDetections, flattenAgentAttributes, hashPayload, heuristicPlanRiskClassifier, querySpansForEvalIncident, recordActionRiskClass, recordActiveScopes, recordAgentHandoff, recordControllerId, recordDecisionBasis, recordDetectionDisposition, recordEvalRunIdentity, recordHumanApproval, recordInputProvenance, recordMemoryAccess, recordPlanRiskAssessment, recordPlanStep, recordPolicyDecision, recordRenderOutput, resolvePrivacyProfile, runAgentPlanClassifier, sanitizeAuditPayload, sanitizeAuditPayloadWithEvidence, sequenceDetectionsToSecurityEvents, sequenceRuleToSigma, sequenceRulesToSigma, setAgentAttributes, spansToCrossAgentEvents, spansToSequenceEvents, tryRecordHumanApproval, verifyEventEnvelopeHash, withAgentAction, withAgentSession, withAgentToolCall, withScopedTool };
@@ -1,4 +1,4 @@
1
1
  import { a as recordControllerId, c as recordMemoryAccess, d as tryRecordHumanApproval, i as recordActiveScopes, l as recordPlanStep, n as deriveActionRiskClass, o as recordHumanApproval, p as agentContextFromSpan, r as recordActionRiskClass, s as recordInputProvenance, t as AGENT_SECURITY_ATTR, u as recordRenderOutput } from "../agent-security-kh3WYZWN.js";
2
- import { A as createSignedEventEnvelope, B as defineAgentToolCall, C as createHoneyTokenTool, D as crossAgentDetectionsToSecurityEvents, E as CrossAgentMonitor, F as createAgentIdentityRegistry, G as flattenAgentAttributes, H as recordPolicyDecision, I as withAgentSession, J as canonicalizeForHash, K as setAgentAttributes, L as delegateToAgent, M as resolvePrivacyProfile, N as sanitizeAuditPayload, O as detectCrossAgentPattern, P as sanitizeAuditPayloadWithEvidence, R as recordAgentHandoff, S as spansToCrossAgentEvents, T as recordEvalRunIdentity, U as withAgentAction, V as recordDecisionBasis, W as withAgentToolCall, X as AGENT_AUDIT_SCHEMA_VERSION, Y as hashPayload, _ as detectSequences, a as DETECTION_DISPOSITION_ATTR, b as spansToSequenceEvents, c as sequenceRuleToSigma, d as DETECTION_ATTR, f as DETECTION_EVENT, g as TOOL_NAME_LABEL, h as TOOL_CALL_ID_LABEL, i as runAgentPlanClassifier, j as verifyEventEnvelopeHash, k as withScopedTool, l as sequenceRulesToSigma, m as SEQUENCE_RULES, n as heuristicPlanRiskClassifier, o as DETECTION_DISPOSITION_EVENT, p as POLICY_DECISION_LABEL, q as createAgentAuditMetadata, r as recordPlanRiskAssessment, s as recordDetectionDisposition, t as AGENT_PLAN_RISK_ATTR, u as AGENT_OUTCOME_LABEL, v as emitSequenceDetections, w as EVAL_IDENTITY_ATTR, x as querySpansForEvalIncident, y as sequenceDetectionsToSecurityEvents, z as defineAgentAction } from "../agent-BtA_RKiI.js";
2
+ import { A as createSignedEventEnvelope, B as defineAgentToolCall, C as createHoneyTokenTool, D as crossAgentDetectionsToSecurityEvents, E as CrossAgentMonitor, F as createAgentIdentityRegistry, G as flattenAgentAttributes, H as recordPolicyDecision, I as withAgentSession, J as canonicalizeForHash, K as setAgentAttributes, L as delegateToAgent, M as resolvePrivacyProfile, N as sanitizeAuditPayload, O as detectCrossAgentPattern, P as sanitizeAuditPayloadWithEvidence, R as recordAgentHandoff, S as spansToCrossAgentEvents, T as recordEvalRunIdentity, U as withAgentAction, V as recordDecisionBasis, W as withAgentToolCall, X as AGENT_AUDIT_SCHEMA_VERSION, Y as hashPayload, _ as detectSequences, a as DETECTION_DISPOSITION_ATTR, b as spansToSequenceEvents, c as sequenceRuleToSigma, d as DETECTION_ATTR, f as DETECTION_EVENT, g as TOOL_NAME_LABEL, h as TOOL_CALL_ID_LABEL, i as runAgentPlanClassifier, j as verifyEventEnvelopeHash, k as withScopedTool, l as sequenceRulesToSigma, m as SEQUENCE_RULES, n as heuristicPlanRiskClassifier, o as DETECTION_DISPOSITION_EVENT, p as POLICY_DECISION_LABEL, q as createAgentAuditMetadata, r as recordPlanRiskAssessment, s as recordDetectionDisposition, t as AGENT_PLAN_RISK_ATTR, u as AGENT_OUTCOME_LABEL, v as emitSequenceDetections, w as EVAL_IDENTITY_ATTR, x as querySpansForEvalIncident, y as sequenceDetectionsToSecurityEvents, z as defineAgentAction } from "../agent-BaaC6IUD.js";
3
3
 
4
4
  export { AGENT_AUDIT_SCHEMA_VERSION, AGENT_OUTCOME_LABEL, AGENT_PLAN_RISK_ATTR, AGENT_SECURITY_ATTR, CrossAgentMonitor, DETECTION_ATTR, DETECTION_DISPOSITION_ATTR, DETECTION_DISPOSITION_EVENT, DETECTION_EVENT, EVAL_IDENTITY_ATTR, POLICY_DECISION_LABEL, SEQUENCE_RULES, TOOL_CALL_ID_LABEL, TOOL_NAME_LABEL, agentContextFromSpan, canonicalizeForHash, createAgentAuditMetadata, createAgentIdentityRegistry, createHoneyTokenTool, createSignedEventEnvelope, crossAgentDetectionsToSecurityEvents, defineAgentAction, defineAgentToolCall, delegateToAgent, deriveActionRiskClass, detectCrossAgentPattern, detectSequences, emitSequenceDetections, flattenAgentAttributes, hashPayload, heuristicPlanRiskClassifier, querySpansForEvalIncident, recordActionRiskClass, recordActiveScopes, recordAgentHandoff, recordControllerId, recordDecisionBasis, recordDetectionDisposition, recordEvalRunIdentity, recordHumanApproval, recordInputProvenance, recordMemoryAccess, recordPlanRiskAssessment, recordPlanStep, recordPolicyDecision, recordRenderOutput, resolvePrivacyProfile, runAgentPlanClassifier, sanitizeAuditPayload, sanitizeAuditPayloadWithEvidence, sequenceDetectionsToSecurityEvents, sequenceRuleToSigma, sequenceRulesToSigma, setAgentAttributes, spansToCrossAgentEvents, spansToSequenceEvents, tryRecordHumanApproval, verifyEventEnvelopeHash, withAgentAction, withAgentSession, withAgentToolCall, withScopedTool };
@@ -1,6 +1,6 @@
1
1
  import { GEN_AI_OPERATION, genAiSpanName } from "./semconv.js";
2
2
  import { estimateLLMCost } from "./cost.js";
3
- import { i as genAiResponseAttributes, r as genAiRequestAttributes, s as genAiUsageAttributes } from "./attributes-E6Q-xXtL.js";
3
+ import { i as genAiResponseAttributes, r as genAiRequestAttributes, s as genAiUsageAttributes } from "./attributes-0Y1Tuidm.js";
4
4
  import { i as asString, n as asNumber, r as asRecord, t as asBoolean } from "./values-CLNajs9_.js";
5
5
  import { _ as warnMissingContextOnce, a as recordControllerId, c as recordMemoryAccess, d as tryRecordHumanApproval, f as MISSING_CONTEXT_MESSAGE, g as toAttributeValue, h as resolveContextSafe, i as recordActiveScopes, l as recordPlanStep, m as resolveContext, n as deriveActionRiskClass, o as recordHumanApproval, r as recordActionRiskClass, s as recordInputProvenance, t as AGENT_SECURITY_ATTR, u as recordRenderOutput } from "./agent-security-kh3WYZWN.js";
6
6
  import { createNoopRequestLogger, createStructuredError, getRequestLoggerSafe, trace } from "autotel";
@@ -1,6 +1,6 @@
1
1
  const require_semconv = require('./semconv.cjs');
2
2
  const require_cost = require('./cost.cjs');
3
- const require_attributes = require('./attributes-C5CvvaLY.cjs');
3
+ const require_attributes = require('./attributes-D62j2B2U.cjs');
4
4
  const require_values = require('./values-m4hAgUuq.cjs');
5
5
  const require_agent_security = require('./agent-security-CMVIlhbh.cjs');
6
6
  let autotel = require("autotel");
@@ -1,5 +1,5 @@
1
- import { a as TokenUsage, i as ModelPricing } from "./cost-BiGrdrt6.cjs";
2
- import { m as GenAiProviderName } from "./semconv-Dyevkkza.cjs";
1
+ import { i as ModelPricing, o as TokenUsage } from "./cost-BcW9kEgp.cjs";
2
+ import { h as GenAiProviderName } from "./semconv-m_Y-ve_N.cjs";
3
3
  import { RequestLogger } from "autotel";
4
4
  import { OnMissingContext } from "autotel-audit";
5
5
  //#region src/agent/context.d.ts
@@ -1,5 +1,5 @@
1
- import { a as TokenUsage, i as ModelPricing } from "./cost-BiGrdrt6.js";
2
- import { m as GenAiProviderName } from "./semconv-Dyevkkza.js";
1
+ import { i as ModelPricing, o as TokenUsage } from "./cost-BcW9kEgp.js";
2
+ import { h as GenAiProviderName } from "./semconv-m_Y-ve_N.js";
3
3
  import { RequestLogger } from "autotel";
4
4
  import { OnMissingContext } from "autotel-audit";
5
5
  //#region src/agent/context.d.ts
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_semconv = require('./semconv.cjs');
3
3
  const require_cost = require('./cost.cjs');
4
- const require_attributes = require('./attributes-C5CvvaLY.cjs');
4
+ const require_attributes = require('./attributes-D62j2B2U.cjs');
5
5
 
6
6
  //#region src/ai-sdk-bridge.ts
7
7
  /** Legacy AI SDK (`LegacyOpenTelemetry`) attribute keys we understand. */
@@ -1,6 +1,6 @@
1
- import { a as TokenUsage, t as EstimateCostOptions } from "./cost-BiGrdrt6.cjs";
2
- import { m as GenAiProviderName } from "./semconv-Dyevkkza.cjs";
3
- import { n as GenAiAttributeMap } from "./attributes-BvAXlXyS.cjs";
1
+ import { o as TokenUsage, t as EstimateCostOptions } from "./cost-BcW9kEgp.cjs";
2
+ import { h as GenAiProviderName } from "./semconv-m_Y-ve_N.cjs";
3
+ import { n as GenAiAttributeMap } from "./attributes-B8K6NxiM.cjs";
4
4
  import { TraceContext } from "autotel";
5
5
  import { Attributes } from "@opentelemetry/api";
6
6
  //#region src/ai-sdk-bridge.d.ts
@@ -1,6 +1,6 @@
1
- import { a as TokenUsage, t as EstimateCostOptions } from "./cost-BiGrdrt6.js";
2
- import { m as GenAiProviderName } from "./semconv-Dyevkkza.js";
3
- import { n as GenAiAttributeMap } from "./attributes-uoNIHNSt.js";
1
+ import { o as TokenUsage, t as EstimateCostOptions } from "./cost-BcW9kEgp.js";
2
+ import { h as GenAiProviderName } from "./semconv-m_Y-ve_N.js";
3
+ import { n as GenAiAttributeMap } from "./attributes-BNl903D-.js";
4
4
  import { Attributes } from "@opentelemetry/api";
5
5
  import { TraceContext } from "autotel";
6
6
  //#region src/ai-sdk-bridge.d.ts
@@ -1,6 +1,6 @@
1
1
  import { GEN_AI, GEN_AI_PROVIDER } from "./semconv.js";
2
2
  import { estimateLLMCost } from "./cost.js";
3
- import { s as genAiUsageAttributes } from "./attributes-E6Q-xXtL.js";
3
+ import { s as genAiUsageAttributes } from "./attributes-0Y1Tuidm.js";
4
4
 
5
5
  //#region src/ai-sdk-bridge.ts
6
6
  /** Legacy AI SDK (`LegacyOpenTelemetry`) attribute keys we understand. */
@@ -1,4 +1,5 @@
1
1
  import { GEN_AI } from "./semconv.js";
2
+ import { evidenceAttribute } from "autotel/evidence";
2
3
 
3
4
  //#region src/attributes.ts
4
5
  /**
@@ -75,6 +76,8 @@ function genAiUsageAttributes(input) {
75
76
  set(attrs, GEN_AI.USAGE_CACHE_CREATION_INPUT_TOKENS, input.cacheCreationInputTokens);
76
77
  set(attrs, GEN_AI.USAGE_COST_USD, input.costUsd);
77
78
  set(attrs, GEN_AI.USAGE_COST_UNPRICED_MODEL, input.unpricedModel);
79
+ set(attrs, GEN_AI.USAGE_COST_UNPRICED_TOOLS, input.unpricedServerTools);
80
+ set(attrs, evidenceAttribute("tokens"), input.tokenSource);
78
81
  set(attrs, GEN_AI.USAGE_COST, input.costUsd);
79
82
  return built(attrs);
80
83
  }
@@ -124,6 +127,9 @@ function genAiWorkflowAttributes(input) {
124
127
  const attrs = new Map();
125
128
  set(attrs, GEN_AI.WORKFLOW_NAME, input.workflowName);
126
129
  set(attrs, GEN_AI.PROMPT_NAME, input.promptName);
130
+ set(attrs, GEN_AI.PROMPT_VERSION, input.promptVersion);
131
+ set(attrs, GEN_AI.PROMPT_LABEL, input.promptLabel);
132
+ set(attrs, GEN_AI.PROMPT_HASH, input.promptHash);
127
133
  return built(attrs);
128
134
  }
129
135
 
@@ -1,4 +1,4 @@
1
- import { f as GenAiOperationName, g as GenAiToolType, m as GenAiProviderName, p as GenAiOutputType } from "./semconv-Dyevkkza.cjs";
1
+ import { _ as GenAiToolType, h as GenAiProviderName, m as GenAiOutputType, p as GenAiOperationName } from "./semconv-m_Y-ve_N.cjs";
2
2
  //#region src/attributes.d.ts
3
3
  /**
4
4
  * OpenTelemetry span attribute value — primitives and homogeneous arrays.
@@ -53,6 +53,16 @@ interface GenAiUsageInput {
53
53
  costUsd?: number;
54
54
  /** Model id that has no pricing, set in place of a cost (autotel extension). */
55
55
  unpricedModel?: string;
56
+ /**
57
+ * Server-side tools whose per-call charge is missing from `costUsd` because
58
+ * no price table covers them (autotel extension).
59
+ */
60
+ unpricedServerTools?: string[];
61
+ /**
62
+ * Where the token counts came from. Recorded as `autotel.evidence.tokens`, so
63
+ * a locally estimated count is never read as one the provider reported.
64
+ */
65
+ tokenSource?: 'observed' | 'estimated';
56
66
  }
57
67
  declare function genAiUsageAttributes(input: GenAiUsageInput): GenAiAttributeMap;
58
68
  /** Agent inputs. */
@@ -100,6 +110,12 @@ declare function genAiMemoryAttributes(input: GenAiMemoryInput): GenAiAttributeM
100
110
  interface GenAiWorkflowInput {
101
111
  workflowName?: string;
102
112
  promptName?: string;
113
+ /** Which version of the named prompt ran — number, or a registry's own id. */
114
+ promptVersion?: string | number;
115
+ /** The moving label the version was resolved through, e.g. `production`. */
116
+ promptLabel?: string;
117
+ /** Digest of the rendered template, where there is no registry to version it. */
118
+ promptHash?: string;
103
119
  }
104
120
  declare function genAiWorkflowAttributes(input: GenAiWorkflowInput): GenAiAttributeMap;
105
121
  //#endregion
@@ -1,4 +1,4 @@
1
- import { f as GenAiOperationName, g as GenAiToolType, m as GenAiProviderName, p as GenAiOutputType } from "./semconv-Dyevkkza.js";
1
+ import { _ as GenAiToolType, h as GenAiProviderName, m as GenAiOutputType, p as GenAiOperationName } from "./semconv-m_Y-ve_N.js";
2
2
  //#region src/attributes.d.ts
3
3
  /**
4
4
  * OpenTelemetry span attribute value — primitives and homogeneous arrays.
@@ -53,6 +53,16 @@ interface GenAiUsageInput {
53
53
  costUsd?: number;
54
54
  /** Model id that has no pricing, set in place of a cost (autotel extension). */
55
55
  unpricedModel?: string;
56
+ /**
57
+ * Server-side tools whose per-call charge is missing from `costUsd` because
58
+ * no price table covers them (autotel extension).
59
+ */
60
+ unpricedServerTools?: string[];
61
+ /**
62
+ * Where the token counts came from. Recorded as `autotel.evidence.tokens`, so
63
+ * a locally estimated count is never read as one the provider reported.
64
+ */
65
+ tokenSource?: 'observed' | 'estimated';
56
66
  }
57
67
  declare function genAiUsageAttributes(input: GenAiUsageInput): GenAiAttributeMap;
58
68
  /** Agent inputs. */
@@ -100,6 +110,12 @@ declare function genAiMemoryAttributes(input: GenAiMemoryInput): GenAiAttributeM
100
110
  interface GenAiWorkflowInput {
101
111
  workflowName?: string;
102
112
  promptName?: string;
113
+ /** Which version of the named prompt ran — number, or a registry's own id. */
114
+ promptVersion?: string | number;
115
+ /** The moving label the version was resolved through, e.g. `production`. */
116
+ promptLabel?: string;
117
+ /** Digest of the rendered template, where there is no registry to version it. */
118
+ promptHash?: string;
103
119
  }
104
120
  declare function genAiWorkflowAttributes(input: GenAiWorkflowInput): GenAiAttributeMap;
105
121
  //#endregion
@@ -1,4 +1,5 @@
1
1
  const require_semconv = require('./semconv.cjs');
2
+ let autotel_evidence = require("autotel/evidence");
2
3
 
3
4
  //#region src/attributes.ts
4
5
  /**
@@ -75,6 +76,8 @@ function genAiUsageAttributes(input) {
75
76
  set(attrs, require_semconv.GEN_AI.USAGE_CACHE_CREATION_INPUT_TOKENS, input.cacheCreationInputTokens);
76
77
  set(attrs, require_semconv.GEN_AI.USAGE_COST_USD, input.costUsd);
77
78
  set(attrs, require_semconv.GEN_AI.USAGE_COST_UNPRICED_MODEL, input.unpricedModel);
79
+ set(attrs, require_semconv.GEN_AI.USAGE_COST_UNPRICED_TOOLS, input.unpricedServerTools);
80
+ set(attrs, (0, autotel_evidence.evidenceAttribute)("tokens"), input.tokenSource);
78
81
  set(attrs, require_semconv.GEN_AI.USAGE_COST, input.costUsd);
79
82
  return built(attrs);
80
83
  }
@@ -124,6 +127,9 @@ function genAiWorkflowAttributes(input) {
124
127
  const attrs = new Map();
125
128
  set(attrs, require_semconv.GEN_AI.WORKFLOW_NAME, input.workflowName);
126
129
  set(attrs, require_semconv.GEN_AI.PROMPT_NAME, input.promptName);
130
+ set(attrs, require_semconv.GEN_AI.PROMPT_VERSION, input.promptVersion);
131
+ set(attrs, require_semconv.GEN_AI.PROMPT_LABEL, input.promptLabel);
132
+ set(attrs, require_semconv.GEN_AI.PROMPT_HASH, input.promptHash);
127
133
  return built(attrs);
128
134
  }
129
135
 
@@ -20,7 +20,31 @@ interface ModelPricing {
20
20
  * input; most other providers do not bill cache writes separately.
21
21
  */
22
22
  cacheWritePer1M?: number;
23
+ /**
24
+ * USD per 1,000 calls to a server-side tool, keyed by tool name. Overrides
25
+ * {@link SERVER_TOOL_PRICING_PER_1K} for this model.
26
+ */
27
+ serverToolPer1K?: Record<string, number>;
23
28
  }
29
+ /**
30
+ * USD per 1,000 calls for provider-hosted tools **that are billed per call**.
31
+ * Approximate public list prices at the time of writing and, like
32
+ * {@link MODEL_PRICING}, a convenience default rather than a billing source of
33
+ * truth.
34
+ *
35
+ * An agent that searches the web on every step can spend more here than on
36
+ * tokens, and a cost built from token counts alone will never show it.
37
+ *
38
+ * The unit is the entry requirement. A tool billed by container session
39
+ * (OpenAI's code interpreter), by execution time (Anthropic's), or bundled free
40
+ * alongside another tool has no per-call price, and inventing one is worse than
41
+ * having none: 100 calls inside a single session priced per call overstates the
42
+ * bill by two orders of magnitude, and a confident wrong number is harder to
43
+ * catch than a missing one. Such tools stay out of this table and surface
44
+ * through {@link unpricedServerTools} instead — a caller who knows their own
45
+ * contract can still price one via `ModelPricing.serverToolPer1K`.
46
+ */
47
+ declare const SERVER_TOOL_PRICING_PER_1K: Record<string, number>;
24
48
  /**
25
49
  * Token counts for a single GenAI call. Field names mirror the canonical
26
50
  * `gen_ai.usage.*` attributes.
@@ -42,6 +66,29 @@ interface TokenUsage {
42
66
  cacheReadInputTokens?: number;
43
67
  /** `gen_ai.usage.cache_creation.input_tokens` — billed in addition. */
44
68
  cacheCreationInputTokens?: number;
69
+ /**
70
+ * Whether the provider reports cache tokens *in addition to* `inputTokens`
71
+ * rather than as a subset of it. Defaults to `false` (subset), which is what
72
+ * OpenAI and Anthropic do directly.
73
+ *
74
+ * Gateways and normalised usage objects — Bedrock, the Vercel AI SDK — do not
75
+ * all agree, and getting it backwards subtracts a pool that was never in the
76
+ * input, understating the bill on exactly the calls that cost the most.
77
+ */
78
+ cacheTokensExclusive?: boolean;
79
+ /**
80
+ * Calls to provider-hosted tools, keyed by tool name — `web_search`,
81
+ * `code_interpreter`, `file_search`. Billed per call, priced from
82
+ * {@link SERVER_TOOL_PRICING_PER_1K}.
83
+ */
84
+ serverToolCalls?: Record<string, number>;
85
+ /**
86
+ * Where the token counts came from: `observed` when the provider reported
87
+ * them, `estimated` when they were counted or guessed locally. Recorded as
88
+ * `autotel.evidence.tokens`, because an estimated count and a reported one
89
+ * look identical once they are both just numbers on a span.
90
+ */
91
+ tokenSource?: 'observed' | 'estimated';
45
92
  }
46
93
  interface EstimateCostOptions {
47
94
  /** Override or extend {@link MODEL_PRICING}. Keys are matched first. */
@@ -55,6 +102,13 @@ interface EstimateCostOptions {
55
102
  * (`claude-sonnet-4-6-20251101`) resolve to a base entry (`claude-sonnet-4-6`).
56
103
  */
57
104
  declare const MODEL_PRICING: Record<string, ModelPricing>;
105
+ /**
106
+ * Server-side tools in `usage` that no price table covers, so their charge is
107
+ * absent from {@link estimateLLMCost}'s figure. Empty when everything priced —
108
+ * including when the model itself has no pricing, since then there is no cost
109
+ * to be incomplete.
110
+ */
111
+ declare function unpricedServerTools(model: string, usage: TokenUsage, options?: EstimateCostOptions): string[];
58
112
  /**
59
113
  * Estimate the USD cost of a GenAI call. Returns `undefined` when the model has
60
114
  * no known pricing (supply one via `options.pricing`).
@@ -75,4 +129,4 @@ declare function estimateLLMCost(model: string, usage: TokenUsage, options?: Est
75
129
  */
76
130
  declare function recordLLMCost(ctx: Pick<TraceContext, 'setAttribute'>, model: string, usage: TokenUsage, options?: EstimateCostOptions): number | undefined;
77
131
  //#endregion
78
- export { TokenUsage as a, ModelPricing as i, GEN_AI_COST_ATTRIBUTE as n, estimateLLMCost as o, MODEL_PRICING as r, recordLLMCost as s, EstimateCostOptions as t };
132
+ export { SERVER_TOOL_PRICING_PER_1K as a, recordLLMCost as c, ModelPricing as i, unpricedServerTools as l, GEN_AI_COST_ATTRIBUTE as n, TokenUsage as o, MODEL_PRICING as r, estimateLLMCost as s, EstimateCostOptions as t };
@@ -20,7 +20,31 @@ interface ModelPricing {
20
20
  * input; most other providers do not bill cache writes separately.
21
21
  */
22
22
  cacheWritePer1M?: number;
23
+ /**
24
+ * USD per 1,000 calls to a server-side tool, keyed by tool name. Overrides
25
+ * {@link SERVER_TOOL_PRICING_PER_1K} for this model.
26
+ */
27
+ serverToolPer1K?: Record<string, number>;
23
28
  }
29
+ /**
30
+ * USD per 1,000 calls for provider-hosted tools **that are billed per call**.
31
+ * Approximate public list prices at the time of writing and, like
32
+ * {@link MODEL_PRICING}, a convenience default rather than a billing source of
33
+ * truth.
34
+ *
35
+ * An agent that searches the web on every step can spend more here than on
36
+ * tokens, and a cost built from token counts alone will never show it.
37
+ *
38
+ * The unit is the entry requirement. A tool billed by container session
39
+ * (OpenAI's code interpreter), by execution time (Anthropic's), or bundled free
40
+ * alongside another tool has no per-call price, and inventing one is worse than
41
+ * having none: 100 calls inside a single session priced per call overstates the
42
+ * bill by two orders of magnitude, and a confident wrong number is harder to
43
+ * catch than a missing one. Such tools stay out of this table and surface
44
+ * through {@link unpricedServerTools} instead — a caller who knows their own
45
+ * contract can still price one via `ModelPricing.serverToolPer1K`.
46
+ */
47
+ declare const SERVER_TOOL_PRICING_PER_1K: Record<string, number>;
24
48
  /**
25
49
  * Token counts for a single GenAI call. Field names mirror the canonical
26
50
  * `gen_ai.usage.*` attributes.
@@ -42,6 +66,29 @@ interface TokenUsage {
42
66
  cacheReadInputTokens?: number;
43
67
  /** `gen_ai.usage.cache_creation.input_tokens` — billed in addition. */
44
68
  cacheCreationInputTokens?: number;
69
+ /**
70
+ * Whether the provider reports cache tokens *in addition to* `inputTokens`
71
+ * rather than as a subset of it. Defaults to `false` (subset), which is what
72
+ * OpenAI and Anthropic do directly.
73
+ *
74
+ * Gateways and normalised usage objects — Bedrock, the Vercel AI SDK — do not
75
+ * all agree, and getting it backwards subtracts a pool that was never in the
76
+ * input, understating the bill on exactly the calls that cost the most.
77
+ */
78
+ cacheTokensExclusive?: boolean;
79
+ /**
80
+ * Calls to provider-hosted tools, keyed by tool name — `web_search`,
81
+ * `code_interpreter`, `file_search`. Billed per call, priced from
82
+ * {@link SERVER_TOOL_PRICING_PER_1K}.
83
+ */
84
+ serverToolCalls?: Record<string, number>;
85
+ /**
86
+ * Where the token counts came from: `observed` when the provider reported
87
+ * them, `estimated` when they were counted or guessed locally. Recorded as
88
+ * `autotel.evidence.tokens`, because an estimated count and a reported one
89
+ * look identical once they are both just numbers on a span.
90
+ */
91
+ tokenSource?: 'observed' | 'estimated';
45
92
  }
46
93
  interface EstimateCostOptions {
47
94
  /** Override or extend {@link MODEL_PRICING}. Keys are matched first. */
@@ -55,6 +102,13 @@ interface EstimateCostOptions {
55
102
  * (`claude-sonnet-4-6-20251101`) resolve to a base entry (`claude-sonnet-4-6`).
56
103
  */
57
104
  declare const MODEL_PRICING: Record<string, ModelPricing>;
105
+ /**
106
+ * Server-side tools in `usage` that no price table covers, so their charge is
107
+ * absent from {@link estimateLLMCost}'s figure. Empty when everything priced —
108
+ * including when the model itself has no pricing, since then there is no cost
109
+ * to be incomplete.
110
+ */
111
+ declare function unpricedServerTools(model: string, usage: TokenUsage, options?: EstimateCostOptions): string[];
58
112
  /**
59
113
  * Estimate the USD cost of a GenAI call. Returns `undefined` when the model has
60
114
  * no known pricing (supply one via `options.pricing`).
@@ -75,4 +129,4 @@ declare function estimateLLMCost(model: string, usage: TokenUsage, options?: Est
75
129
  */
76
130
  declare function recordLLMCost(ctx: Pick<TraceContext, 'setAttribute'>, model: string, usage: TokenUsage, options?: EstimateCostOptions): number | undefined;
77
131
  //#endregion
78
- export { TokenUsage as a, ModelPricing as i, GEN_AI_COST_ATTRIBUTE as n, estimateLLMCost as o, MODEL_PRICING as r, recordLLMCost as s, EstimateCostOptions as t };
132
+ export { SERVER_TOOL_PRICING_PER_1K as a, recordLLMCost as c, ModelPricing as i, unpricedServerTools as l, GEN_AI_COST_ATTRIBUTE as n, TokenUsage as o, MODEL_PRICING as r, estimateLLMCost as s, EstimateCostOptions as t };