autotel-genai 0.7.1 → 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 (58) hide show
  1. package/README.md +127 -3
  2. package/dist/agent/index.cjs +2 -2
  3. package/dist/agent/index.d.cts +3 -3
  4. package/dist/agent/index.d.ts +3 -3
  5. package/dist/agent/index.js +2 -2
  6. package/dist/{agent-CbiBywpx.js → agent-BaaC6IUD.js} +15 -9
  7. package/dist/{agent-C13hoGHA.cjs → agent-DavvAWIG.cjs} +14 -8
  8. package/dist/{agent-security-w2MvbC0P.d.cts → agent-security-BjM1QOTr.d.cts} +2 -2
  9. package/dist/{agent-security-BiBsh8C2.cjs → agent-security-CMVIlhbh.cjs} +3 -0
  10. package/dist/{agent-security-C3Li4KJP.d.ts → agent-security-D9NfzH7I.d.ts} +2 -2
  11. package/dist/{agent-security-CoPcRMRZ.js → agent-security-kh3WYZWN.js} +3 -0
  12. package/dist/ai-sdk-bridge.cjs +1 -1
  13. package/dist/ai-sdk-bridge.d.cts +3 -3
  14. package/dist/ai-sdk-bridge.d.ts +3 -3
  15. package/dist/ai-sdk-bridge.js +1 -1
  16. package/dist/{attributes-CVOD1BG1.js → attributes-0Y1Tuidm.js} +7 -0
  17. package/dist/{attributes-BHxFjXSS.d.cts → attributes-B8K6NxiM.d.cts} +19 -1
  18. package/dist/{attributes-DyCFltYK.d.ts → attributes-BNl903D-.d.ts} +19 -1
  19. package/dist/{attributes-BbHetlqB.cjs → attributes-D62j2B2U.cjs} +7 -0
  20. package/dist/{cost-BiGrdrt6.d.ts → cost-BcW9kEgp.d.cts} +55 -1
  21. package/dist/{cost-BiGrdrt6.d.cts → cost-BcW9kEgp.d.ts} +55 -1
  22. package/dist/cost.cjs +59 -3
  23. package/dist/cost.d.cts +2 -2
  24. package/dist/cost.d.ts +2 -2
  25. package/dist/cost.js +57 -3
  26. package/dist/{events-RGl-M4u9.d.cts → events-B1Kqejbc.d.cts} +22 -2
  27. package/dist/events-B1l3riel.cjs +534 -0
  28. package/dist/{events-DpASz90I.d.ts → events-CdjXIatQ.d.ts} +22 -2
  29. package/dist/events-DhkQuc2S.js +481 -0
  30. package/dist/events.cjs +7 -148
  31. package/dist/events.d.cts +2 -2
  32. package/dist/events.d.ts +2 -2
  33. package/dist/events.js +2 -144
  34. package/dist/{index-X0fC3Awl.d.cts → index-C27Y-PcB.d.cts} +9 -2
  35. package/dist/{index-DHTvEdQU.d.ts → index-czlGka94.d.ts} +5 -5
  36. package/dist/{index-D3AP7rKi.d.ts → index-nnJ4pvQy.d.ts} +9 -2
  37. package/dist/{index-B8iUAAc_.d.cts → index-q9JnZtRX.d.cts} +5 -5
  38. package/dist/index.cjs +11 -4
  39. package/dist/index.d.cts +93 -8
  40. package/dist/index.d.ts +93 -8
  41. package/dist/index.js +7 -7
  42. package/dist/observer/index.cjs +1 -1
  43. package/dist/observer/index.d.cts +1 -1
  44. package/dist/observer/index.d.ts +1 -1
  45. package/dist/observer/index.js +1 -1
  46. package/dist/{observer-CfBphhYi.cjs → observer-Dp-nmI1J.cjs} +3 -3
  47. package/dist/{observer-BZJgHII2.js → observer-tpNaVA2X.js} +3 -3
  48. package/dist/{semconv-B8OQQKbC.d.cts → semconv-m_Y-ve_N.d.cts} +34 -1
  49. package/dist/{semconv-B8OQQKbC.d.ts → semconv-m_Y-ve_N.d.ts} +34 -1
  50. package/dist/semconv.cjs +34 -0
  51. package/dist/semconv.d.cts +2 -2
  52. package/dist/semconv.d.ts +2 -2
  53. package/dist/semconv.js +34 -1
  54. package/dist/trace.cjs +7 -3
  55. package/dist/trace.d.cts +3 -3
  56. package/dist/trace.d.ts +3 -3
  57. package/dist/trace.js +8 -4
  58. 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
- const require_agent_security = require('../agent-security-BiBsh8C2.cjs');
3
- const require_agent = require('../agent-C13hoGHA.cjs');
2
+ const require_agent_security = require('../agent-security-CMVIlhbh.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-X0fC3Awl.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-w2MvbC0P.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-D3AP7rKi.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-C3Li4KJP.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
- 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-CoPcRMRZ.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-CbiBywpx.js";
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-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,8 +1,9 @@
1
+ import { GEN_AI_OPERATION, genAiSpanName } from "./semconv.js";
1
2
  import { estimateLLMCost } from "./cost.js";
2
- import { i as genAiResponseAttributes, r as genAiRequestAttributes, s as genAiUsageAttributes } from "./attributes-CVOD1BG1.js";
3
+ import { i as genAiResponseAttributes, r as genAiRequestAttributes, s as genAiUsageAttributes } from "./attributes-0Y1Tuidm.js";
3
4
  import { i as asString, n as asNumber, r as asRecord, t as asBoolean } from "./values-CLNajs9_.js";
4
- 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-CoPcRMRZ.js";
5
- import { createNoopRequestLogger, createStructuredError, getRequestLoggerSafe } from "autotel";
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
+ import { createNoopRequestLogger, createStructuredError, getRequestLoggerSafe, trace } from "autotel";
6
7
  import { forceKeepAuditEvent, securityEvent, withAudit } from "autotel-audit";
7
8
  import { createHash } from "node:crypto";
8
9
  import { SECURITY_ATTR } from "autotel/security-schema";
@@ -62,11 +63,11 @@ function sanitizeTool(tool) {
62
63
  if (!tool) return undefined;
63
64
  return {
64
65
  name: tool.name,
65
- ...tool.callId !== undefined && { callId: tool.callId },
66
- ...tool.inputHash !== undefined && { inputHash: tool.inputHash },
67
- ...tool.outputHash !== undefined && { outputHash: tool.outputHash },
66
+ ...tool.callId !== undefined && { call_id: tool.callId },
67
+ ...tool.inputHash !== undefined && { input_hash: tool.inputHash },
68
+ ...tool.outputHash !== undefined && { output_hash: tool.outputHash },
68
69
  ...tool.status !== undefined && { status: tool.status },
69
- ...tool.executionMs !== undefined && { executionMs: tool.executionMs }
70
+ ...tool.executionMs !== undefined && { execution_ms: tool.executionMs }
70
71
  };
71
72
  }
72
73
  function sanitizeGovernance(governance) {
@@ -310,7 +311,8 @@ function recordAiTelemetry(ctx, ai, usage) {
310
311
  const cost = estimateLLMCost(ai.model, usage, ai.pricing ? { pricing: ai.pricing } : undefined);
311
312
  Object.assign(attrs, genAiUsageAttributes({
312
313
  ...usage,
313
- costUsd: cost
314
+ costUsd: cost,
315
+ unpricedModel: cost === undefined ? ai.model : undefined
314
316
  }));
315
317
  }
316
318
  ctx.setAttributes(attrs);
@@ -424,6 +426,10 @@ function defineAgentToolCall(metadata, factory, options = {}) {
424
426
  };
425
427
  }
426
428
  async function withAgentToolCall(metadata, fn, options = {}) {
429
+ if (options.ctx) return runAgentToolCall(metadata, fn, options);
430
+ return trace.run(genAiSpanName(GEN_AI_OPERATION.EXECUTE_TOOL, metadata.tool.name), () => runAgentToolCall(metadata, fn, options));
431
+ }
432
+ async function runAgentToolCall(metadata, fn, options = {}) {
427
433
  const start = Date.now();
428
434
  const normalized = normalizeMetadata({
429
435
  ...metadata,
@@ -1337,7 +1343,7 @@ function correlationValue(event, prefix) {
1337
1343
  * up on an anchor as soon as one candidate is out of range, which is only sound
1338
1344
  * if everything after it is further out still.
1339
1345
  *
1340
- * ponytail: restarts the walk at every event matching step 0, so worst case is
1346
+ * Restarts the walk at every event matching step 0, so worst case is
1341
1347
  * O(events² × steps). Sessions are tens to low hundreds of steps, and the
1342
1348
  * single-pass alternative is wrong: anchoring greedily on the first candidate
1343
1349
  * abandons a real chain whenever that candidate's window expires first.
@@ -1,7 +1,8 @@
1
+ const require_semconv = require('./semconv.cjs');
1
2
  const require_cost = require('./cost.cjs');
2
- const require_attributes = require('./attributes-BbHetlqB.cjs');
3
+ const require_attributes = require('./attributes-D62j2B2U.cjs');
3
4
  const require_values = require('./values-m4hAgUuq.cjs');
4
- const require_agent_security = require('./agent-security-BiBsh8C2.cjs');
5
+ const require_agent_security = require('./agent-security-CMVIlhbh.cjs');
5
6
  let autotel = require("autotel");
6
7
  let autotel_audit = require("autotel-audit");
7
8
  let node_crypto = require("node:crypto");
@@ -62,11 +63,11 @@ function sanitizeTool(tool) {
62
63
  if (!tool) return undefined;
63
64
  return {
64
65
  name: tool.name,
65
- ...tool.callId !== undefined && { callId: tool.callId },
66
- ...tool.inputHash !== undefined && { inputHash: tool.inputHash },
67
- ...tool.outputHash !== undefined && { outputHash: tool.outputHash },
66
+ ...tool.callId !== undefined && { call_id: tool.callId },
67
+ ...tool.inputHash !== undefined && { input_hash: tool.inputHash },
68
+ ...tool.outputHash !== undefined && { output_hash: tool.outputHash },
68
69
  ...tool.status !== undefined && { status: tool.status },
69
- ...tool.executionMs !== undefined && { executionMs: tool.executionMs }
70
+ ...tool.executionMs !== undefined && { execution_ms: tool.executionMs }
70
71
  };
71
72
  }
72
73
  function sanitizeGovernance(governance) {
@@ -310,7 +311,8 @@ function recordAiTelemetry(ctx, ai, usage) {
310
311
  const cost = require_cost.estimateLLMCost(ai.model, usage, ai.pricing ? { pricing: ai.pricing } : undefined);
311
312
  Object.assign(attrs, require_attributes.genAiUsageAttributes({
312
313
  ...usage,
313
- costUsd: cost
314
+ costUsd: cost,
315
+ unpricedModel: cost === undefined ? ai.model : undefined
314
316
  }));
315
317
  }
316
318
  ctx.setAttributes(attrs);
@@ -424,6 +426,10 @@ function defineAgentToolCall(metadata, factory, options = {}) {
424
426
  };
425
427
  }
426
428
  async function withAgentToolCall(metadata, fn, options = {}) {
429
+ if (options.ctx) return runAgentToolCall(metadata, fn, options);
430
+ return autotel.trace.run(require_semconv.genAiSpanName(require_semconv.GEN_AI_OPERATION.EXECUTE_TOOL, metadata.tool.name), () => runAgentToolCall(metadata, fn, options));
431
+ }
432
+ async function runAgentToolCall(metadata, fn, options = {}) {
427
433
  const start = Date.now();
428
434
  const normalized = normalizeMetadata({
429
435
  ...metadata,
@@ -1337,7 +1343,7 @@ function correlationValue(event, prefix) {
1337
1343
  * up on an anchor as soon as one candidate is out of range, which is only sound
1338
1344
  * if everything after it is further out still.
1339
1345
  *
1340
- * ponytail: restarts the walk at every event matching step 0, so worst case is
1346
+ * Restarts the walk at every event matching step 0, so worst case is
1341
1347
  * O(events² × steps). Sessions are tens to low hundreds of steps, and the
1342
1348
  * single-pass alternative is wrong: anchoring greedily on the first candidate
1343
1349
  * abandons a real chain whenever that candidate's window expires first.
@@ -1,5 +1,5 @@
1
- import { a as TokenUsage, i as ModelPricing } from "./cost-BiGrdrt6.cjs";
2
- import { m as GenAiProviderName } from "./semconv-B8OQQKbC.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
@@ -168,6 +168,9 @@ function recordHumanApproval(input) {
168
168
  if (input.toolName) {
169
169
  attrs["tool.name"] = input.toolName;
170
170
  }
171
+ if (!input.approved) {
172
+ attrs["tool.status"] = "blocked";
173
+ }
171
174
  if (input.controllerId) {
172
175
  attrs[AGENT_SECURITY_ATTR.controllerId] = (0, autotel_audit.hashIdentifier)(input.controllerId, { salt: input.hashSalt });
173
176
  }
@@ -1,5 +1,5 @@
1
- import { a as TokenUsage, i as ModelPricing } from "./cost-BiGrdrt6.js";
2
- import { m as GenAiProviderName } from "./semconv-B8OQQKbC.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
@@ -168,6 +168,9 @@ function recordHumanApproval(input) {
168
168
  if (input.toolName) {
169
169
  attrs["tool.name"] = input.toolName;
170
170
  }
171
+ if (!input.approved) {
172
+ attrs["tool.status"] = "blocked";
173
+ }
171
174
  if (input.controllerId) {
172
175
  attrs[AGENT_SECURITY_ATTR.controllerId] = hashIdentifier(input.controllerId, { salt: input.hashSalt });
173
176
  }
@@ -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-BbHetlqB.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-B8OQQKbC.cjs";
3
- import { n as GenAiAttributeMap } from "./attributes-BHxFjXSS.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-B8OQQKbC.js";
3
- import { n as GenAiAttributeMap } from "./attributes-DyCFltYK.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-CVOD1BG1.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
  /**
@@ -74,6 +75,9 @@ function genAiUsageAttributes(input) {
74
75
  set(attrs, GEN_AI.USAGE_CACHE_READ_INPUT_TOKENS, input.cacheReadInputTokens);
75
76
  set(attrs, GEN_AI.USAGE_CACHE_CREATION_INPUT_TOKENS, input.cacheCreationInputTokens);
76
77
  set(attrs, GEN_AI.USAGE_COST_USD, input.costUsd);
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);
77
81
  set(attrs, GEN_AI.USAGE_COST, input.costUsd);
78
82
  return built(attrs);
79
83
  }
@@ -123,6 +127,9 @@ function genAiWorkflowAttributes(input) {
123
127
  const attrs = new Map();
124
128
  set(attrs, GEN_AI.WORKFLOW_NAME, input.workflowName);
125
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);
126
133
  return built(attrs);
127
134
  }
128
135
 
@@ -1,4 +1,4 @@
1
- import { f as GenAiOperationName, g as GenAiToolType, m as GenAiProviderName, p as GenAiOutputType } from "./semconv-B8OQQKbC.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.
@@ -51,6 +51,18 @@ interface GenAiUsageInput {
51
51
  cacheCreationInputTokens?: number;
52
52
  /** Estimated USD cost (autotel extension). */
53
53
  costUsd?: number;
54
+ /** Model id that has no pricing, set in place of a cost (autotel extension). */
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';
54
66
  }
55
67
  declare function genAiUsageAttributes(input: GenAiUsageInput): GenAiAttributeMap;
56
68
  /** Agent inputs. */
@@ -98,6 +110,12 @@ declare function genAiMemoryAttributes(input: GenAiMemoryInput): GenAiAttributeM
98
110
  interface GenAiWorkflowInput {
99
111
  workflowName?: string;
100
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;
101
119
  }
102
120
  declare function genAiWorkflowAttributes(input: GenAiWorkflowInput): GenAiAttributeMap;
103
121
  //#endregion
@@ -1,4 +1,4 @@
1
- import { f as GenAiOperationName, g as GenAiToolType, m as GenAiProviderName, p as GenAiOutputType } from "./semconv-B8OQQKbC.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.
@@ -51,6 +51,18 @@ interface GenAiUsageInput {
51
51
  cacheCreationInputTokens?: number;
52
52
  /** Estimated USD cost (autotel extension). */
53
53
  costUsd?: number;
54
+ /** Model id that has no pricing, set in place of a cost (autotel extension). */
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';
54
66
  }
55
67
  declare function genAiUsageAttributes(input: GenAiUsageInput): GenAiAttributeMap;
56
68
  /** Agent inputs. */
@@ -98,6 +110,12 @@ declare function genAiMemoryAttributes(input: GenAiMemoryInput): GenAiAttributeM
98
110
  interface GenAiWorkflowInput {
99
111
  workflowName?: string;
100
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;
101
119
  }
102
120
  declare function genAiWorkflowAttributes(input: GenAiWorkflowInput): GenAiAttributeMap;
103
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
  /**
@@ -74,6 +75,9 @@ function genAiUsageAttributes(input) {
74
75
  set(attrs, require_semconv.GEN_AI.USAGE_CACHE_READ_INPUT_TOKENS, input.cacheReadInputTokens);
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);
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);
77
81
  set(attrs, require_semconv.GEN_AI.USAGE_COST, input.costUsd);
78
82
  return built(attrs);
79
83
  }
@@ -123,6 +127,9 @@ function genAiWorkflowAttributes(input) {
123
127
  const attrs = new Map();
124
128
  set(attrs, require_semconv.GEN_AI.WORKFLOW_NAME, input.workflowName);
125
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);
126
133
  return built(attrs);
127
134
  }
128
135