autotel-genai 0.6.0 → 0.6.2

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 (38) hide show
  1. package/README.md +6 -2
  2. package/dist/agent/index.cjs +1 -1
  3. package/dist/agent/index.d.cts +2 -2
  4. package/dist/agent/index.d.ts +2 -2
  5. package/dist/agent/index.js +1 -1
  6. package/dist/{agent-gI7KbR4Q.cjs → agent-CpucMj6w.cjs} +18 -14
  7. package/dist/{agent-C9ww7o3H.js → agent-DYs6JLN5.js} +18 -14
  8. package/dist/agent-security-BFryrFbk.d.cts +367 -0
  9. package/dist/agent-security-CWkxz1j3.d.ts +367 -0
  10. package/dist/ai-sdk-bridge.cjs +1 -1
  11. package/dist/ai-sdk-bridge.d.cts +6 -5
  12. package/dist/ai-sdk-bridge.d.ts +6 -5
  13. package/dist/ai-sdk-bridge.js +1 -1
  14. package/dist/{attributes-D2ugZS_C.cjs → attributes-BbHetlqB.cjs} +23 -19
  15. package/dist/{attributes-DmV7B6dn.js → attributes-CVOD1BG1.js} +23 -19
  16. package/dist/events.cjs +6 -5
  17. package/dist/events.js +6 -5
  18. package/dist/{index-B4Qh_eVm.d.ts → index-CCECca0b.d.ts} +18 -250
  19. package/dist/{index-CB26RNKN.d.cts → index-CzA5zqGK.d.cts} +82 -17
  20. package/dist/{index-CcygHaEj.d.cts → index-PH_ymlyO.d.cts} +18 -250
  21. package/dist/{index-CfzmE066.d.ts → index-ZYigQnta.d.ts} +82 -17
  22. package/dist/index.cjs +3 -3
  23. package/dist/index.d.cts +3 -3
  24. package/dist/index.d.ts +3 -3
  25. package/dist/index.js +3 -3
  26. package/dist/observer/index.cjs +1 -1
  27. package/dist/observer/index.d.cts +1 -1
  28. package/dist/observer/index.d.ts +1 -1
  29. package/dist/observer/index.js +1 -1
  30. package/dist/{observer-Bqe_gIb2.js → observer-CZWloojM.js} +191 -39
  31. package/dist/{observer-D8JVyCP6.cjs → observer-DdR8r0Ht.cjs} +195 -43
  32. package/dist/trace.cjs +12 -15
  33. package/dist/trace.js +8 -11
  34. package/dist/values-CLNajs9_.js +41 -0
  35. package/dist/values-m4hAgUuq.cjs +83 -0
  36. package/package.json +3 -3
  37. package/dist/agent-security-BHdP6ZPG.d.cts +0 -115
  38. package/dist/agent-security-BHdP6ZPG.d.ts +0 -115
package/README.md CHANGED
@@ -254,7 +254,8 @@ const honeyToken = createHoneyTokenTool({
254
254
  ### Vercel AI SDK
255
255
 
256
256
  Register `autotelTelemetry()` once and every `generateText` / `streamText` /
257
- `embed` call streams a canonical `gen_ai.*` span tree. Live, as it runs:
257
+ `generateObject` / `streamObject` / `embed` call streams a canonical `gen_ai.*`
258
+ span tree. Live, as it runs:
258
259
 
259
260
  ```ts
260
261
  import { registerTelemetry } from 'ai';
@@ -279,7 +280,10 @@ on every `chat` span:
279
280
  It is push-based and concurrency-safe (every event carries the SDK `callId`),
280
281
  and it pulls in **no** dependency on `ai`. The returned object satisfies the
281
282
  `Telemetry` interface structurally, so the snippet above type-checks as-is.
282
- `rerank` has no canonical `gen_ai` operation and is intentionally not mapped.
283
+ Embeddings open on `onEmbedStart` so span duration is the real model call.
284
+ `runtimeContext.userId` / `sessionId` become `user.id` /
285
+ `gen_ai.conversation.id`; other keys are dropped. `rerank` has no canonical
286
+ `gen_ai` operation and is intentionally not mapped.
283
287
 
284
288
  **Nested traces.** It implements the SDK's `executeTool` / `executeLanguageModelCall`
285
289
  context runners, so a tool whose `execute` calls `generateText`. And the
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_agent_security = require('../agent-security-kfpXuwL4.cjs');
3
- const require_agent = require('../agent-gI7KbR4Q.cjs');
3
+ const require_agent = require('../agent-CpucMj6w.cjs');
4
4
 
5
5
  exports.AGENT_AUDIT_SCHEMA_VERSION = require_agent.AGENT_AUDIT_SCHEMA_VERSION;
6
6
  exports.AGENT_PLAN_RISK_ATTR = require_agent.AGENT_PLAN_RISK_ATTR;
@@ -1,4 +1,4 @@
1
- import { $ as AgentActionMetadata, A as verifyEventEnvelopeHash, At as AGENT_AUDIT_SCHEMA_VERSION, B as defineAgentToolCall, C as CrossAgentSecurityEvent, Ct as PrivacyProfileName, D as withScopedTool, Dt as HashPayloadOptions, E as detectCrossAgentPattern, Et as ToolStatus, F as RevokeAgentIdentityInput, G as DelegateToAgentInput, H as recordPolicyDecision, I as RotateAgentIdentityInput, J as recordAgentHandoff, K as RecordAgentHandoffMetadata, L as createAgentIdentityRegistry, M as resolvePrivacyProfile, N as sanitizeAuditPayload, O as CreateSignedEventEnvelopeOptions, Ot as canonicalizeForHash, P as ProvisionAgentIdentityInput, Q as AgentActionFactory, R as withAgentSession, S as CrossAgentEvent, St as PrivacyProfile, T as crossAgentDetectionsToSecurityEvents, Tt as ToolCallMetadata, U as withAgentAction, V as recordDecisionBasis, W as withAgentToolCall, X as setAgentAttributes, Y as flattenAgentAttributes, Z as createAgentAuditMetadata, _ as RecordEvalRunIdentityInput, _t as AiLifecycleStage, a as AgentPlanRiskVerdict, at as AgentHandler, b as CrossAgentMonitorOptions, bt as PolicyDecision, c as recordPlanRiskAssessment, ct as AgentIdentityRegistry, d as querySpansForEvalIncident, dt as AgentOutcome, et as AgentActionOptions, f as spansToCrossAgentEvents, ft as AgentSessionActionMetadata, g as EVAL_IDENTITY_ATTR, gt as AgentToolCallOptions, h as createHoneyTokenTool, ht as AgentToolCallActionMetadata, i as AgentPlanClassifierResult, it as AgentEventKind, j as PrivacyProfileInput, k as createSignedEventEnvelope, kt as hashPayload, l as runAgentPlanClassifier, lt as AgentIdentityStatus, m as HoneyTokenToolOptions, mt as AgentSessionStatus, n as AgentPlanClassifier, nt as AgentAuditEventEnvelope, o as RecordPlanRiskAssessmentOptions, ot as AgentIdentity, p as HoneyTokenToolDefinition, pt as AgentSessionMetadata, q as delegateToAgent, r as AgentPlanClassifierInput, rt as AgentDecisionMetadata, s as heuristicPlanRiskClassifier, st as AgentIdentityRecord, t as AGENT_PLAN_RISK_ATTR, tt as AgentAiMetadata, u as EvalIncidentQueryResult, ut as AgentMetadataInput, v as recordEvalRunIdentity, vt as DelegationContext, w as DetectCrossAgentPatternOptions, wt as ScopedToolDefinition, x as CrossAgentDetection, xt as PolicyMetadata, y as CrossAgentMonitor, yt as GovernanceMetadata, z as defineAgentAction } from "../index-CcygHaEj.cjs";
1
+ import { $ as canonicalizeForHash, A as verifyEventEnvelopeHash, B as defineAgentToolCall, C as CrossAgentSecurityEvent, D as withScopedTool, E as detectCrossAgentPattern, F as RevokeAgentIdentityInput, G as DelegateToAgentInput, H as recordPolicyDecision, I as RotateAgentIdentityInput, J as recordAgentHandoff, K as RecordAgentHandoffMetadata, L as createAgentIdentityRegistry, M as resolvePrivacyProfile, N as sanitizeAuditPayload, O as CreateSignedEventEnvelopeOptions, P as ProvisionAgentIdentityInput, Q as HashPayloadOptions, R as withAgentSession, S as CrossAgentEvent, T as crossAgentDetectionsToSecurityEvents, U as withAgentAction, V as recordDecisionBasis, W as withAgentToolCall, X as setAgentAttributes, Y as flattenAgentAttributes, Z as createAgentAuditMetadata, _ as RecordEvalRunIdentityInput, a as AgentPlanRiskVerdict, b as CrossAgentMonitorOptions, c as recordPlanRiskAssessment, d as querySpansForEvalIncident, et as hashPayload, f as spansToCrossAgentEvents, g as EVAL_IDENTITY_ATTR, h as createHoneyTokenTool, i as AgentPlanClassifierResult, j as PrivacyProfileInput, k as createSignedEventEnvelope, l as runAgentPlanClassifier, m as HoneyTokenToolOptions, n as AgentPlanClassifier, o as RecordPlanRiskAssessmentOptions, p as HoneyTokenToolDefinition, q as delegateToAgent, r as AgentPlanClassifierInput, s as heuristicPlanRiskClassifier, t as AGENT_PLAN_RISK_ATTR, tt as AGENT_AUDIT_SCHEMA_VERSION, u as EvalIncidentQueryResult, v as recordEvalRunIdentity, w as DetectCrossAgentPatternOptions, x as CrossAgentDetection, y as CrossAgentMonitor, z as defineAgentAction } from "../index-PH_ymlyO.cjs";
2
2
  import { a as TokenUsage, i as ModelPricing } from "../cost-C1FkUNG1.cjs";
3
- import { C as recordPlanStep, D as agentContextFromSpan, E as AgentContext, S as recordMemoryAccess, T as tryRecordHumanApproval, _ as recordActionRiskClass, a as AgentInputProvenance, b as recordHumanApproval, c as AgentSecurityRecordOptions, d as RecordHumanApprovalInput, f as RecordInputProvenanceInput, g as deriveActionRiskClass, h as RecordRenderOutputInput, i as AgentConsentOutcome, l as RecordActiveScopesInput, m as RecordPlanStepInput, n as ActionRiskHints, o as AgentMemoryOperation, p as RecordMemoryAccessInput, r as AgentActionRiskClass, s as AgentOutputFormat, t as AGENT_SECURITY_ATTR, u as RecordControllerInput, v as recordActiveScopes, w as recordRenderOutput, x as recordInputProvenance, y as recordControllerId } from "../agent-security-BHdP6ZPG.cjs";
3
+ import { $ as ScopedToolDefinition, A as AgentAuditEventEnvelope, B as AgentSessionActionMetadata, C as recordPlanStep, D as AgentActionMetadata, E as AgentActionFactory, F as AgentIdentityRecord, G as AiLifecycleStage, H as AgentSessionStatus, I as AgentIdentityRegistry, J as GovernanceMetadata, K as DelegationContext, L as AgentIdentityStatus, M as AgentEventKind, N as AgentHandler, O as AgentActionOptions, P as AgentIdentity, Q as PrivacyProfileName, R as AgentMetadataInput, S as recordMemoryAccess, T as tryRecordHumanApproval, U as AgentToolCallActionMetadata, V as AgentSessionMetadata, W as AgentToolCallOptions, X as PolicyMetadata, Y as PolicyDecision, Z as PrivacyProfile, _ as recordActionRiskClass, a as AgentInputProvenance, b as recordHumanApproval, c as AgentSecurityRecordOptions, d as RecordHumanApprovalInput, et as ToolCallMetadata, f as RecordInputProvenanceInput, g as deriveActionRiskClass, h as RecordRenderOutputInput, i as AgentConsentOutcome, j as AgentDecisionMetadata, k as AgentAiMetadata, l as RecordActiveScopesInput, m as RecordPlanStepInput, n as ActionRiskHints, nt as AgentContext, o as AgentMemoryOperation, p as RecordMemoryAccessInput, r as AgentActionRiskClass, rt as agentContextFromSpan, s as AgentOutputFormat, t as AGENT_SECURITY_ATTR, tt as ToolStatus, u as RecordControllerInput, v as recordActiveScopes, w as recordRenderOutput, x as recordInputProvenance, y as recordControllerId, z as AgentOutcome } from "../agent-security-BFryrFbk.cjs";
4
4
  export { AGENT_AUDIT_SCHEMA_VERSION, AGENT_PLAN_RISK_ATTR, AGENT_SECURITY_ATTR, type ActionRiskHints, type AgentActionFactory, type AgentActionMetadata, type AgentActionOptions, type AgentActionRiskClass, type AgentAiMetadata, type AgentAuditEventEnvelope, 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, type DelegateToAgentInput, type DelegationContext, type DetectCrossAgentPatternOptions, EVAL_IDENTITY_ATTR, type EvalIncidentQueryResult, type GovernanceMetadata, type HashPayloadOptions, type HoneyTokenToolDefinition, type HoneyTokenToolOptions, type ModelPricing, type PolicyDecision, type PolicyMetadata, type PrivacyProfile, type PrivacyProfileInput, type PrivacyProfileName, type ProvisionAgentIdentityInput, type RecordActiveScopesInput, type RecordAgentHandoffMetadata, type RecordControllerInput, type RecordEvalRunIdentityInput, type RecordHumanApprovalInput, type RecordInputProvenanceInput, type RecordMemoryAccessInput, type RecordPlanRiskAssessmentOptions, type RecordPlanStepInput, type RecordRenderOutputInput, type RevokeAgentIdentityInput, type RotateAgentIdentityInput, type ScopedToolDefinition, type TokenUsage, type ToolCallMetadata, type ToolStatus, agentContextFromSpan, canonicalizeForHash, createAgentAuditMetadata, createAgentIdentityRegistry, createHoneyTokenTool, createSignedEventEnvelope, crossAgentDetectionsToSecurityEvents, defineAgentAction, defineAgentToolCall, delegateToAgent, deriveActionRiskClass, detectCrossAgentPattern, flattenAgentAttributes, hashPayload, heuristicPlanRiskClassifier, querySpansForEvalIncident, recordActionRiskClass, recordActiveScopes, recordAgentHandoff, recordControllerId, recordDecisionBasis, recordEvalRunIdentity, recordHumanApproval, recordInputProvenance, recordMemoryAccess, recordPlanRiskAssessment, recordPlanStep, recordPolicyDecision, recordRenderOutput, resolvePrivacyProfile, runAgentPlanClassifier, sanitizeAuditPayload, setAgentAttributes, spansToCrossAgentEvents, tryRecordHumanApproval, verifyEventEnvelopeHash, withAgentAction, withAgentSession, withAgentToolCall, withScopedTool };
@@ -1,4 +1,4 @@
1
- import { $ as AgentActionMetadata, A as verifyEventEnvelopeHash, At as AGENT_AUDIT_SCHEMA_VERSION, B as defineAgentToolCall, C as CrossAgentSecurityEvent, Ct as PrivacyProfileName, D as withScopedTool, Dt as HashPayloadOptions, E as detectCrossAgentPattern, Et as ToolStatus, F as RevokeAgentIdentityInput, G as DelegateToAgentInput, H as recordPolicyDecision, I as RotateAgentIdentityInput, J as recordAgentHandoff, K as RecordAgentHandoffMetadata, L as createAgentIdentityRegistry, M as resolvePrivacyProfile, N as sanitizeAuditPayload, O as CreateSignedEventEnvelopeOptions, Ot as canonicalizeForHash, P as ProvisionAgentIdentityInput, Q as AgentActionFactory, R as withAgentSession, S as CrossAgentEvent, St as PrivacyProfile, T as crossAgentDetectionsToSecurityEvents, Tt as ToolCallMetadata, U as withAgentAction, V as recordDecisionBasis, W as withAgentToolCall, X as setAgentAttributes, Y as flattenAgentAttributes, Z as createAgentAuditMetadata, _ as RecordEvalRunIdentityInput, _t as AiLifecycleStage, a as AgentPlanRiskVerdict, at as AgentHandler, b as CrossAgentMonitorOptions, bt as PolicyDecision, c as recordPlanRiskAssessment, ct as AgentIdentityRegistry, d as querySpansForEvalIncident, dt as AgentOutcome, et as AgentActionOptions, f as spansToCrossAgentEvents, ft as AgentSessionActionMetadata, g as EVAL_IDENTITY_ATTR, gt as AgentToolCallOptions, h as createHoneyTokenTool, ht as AgentToolCallActionMetadata, i as AgentPlanClassifierResult, it as AgentEventKind, j as PrivacyProfileInput, k as createSignedEventEnvelope, kt as hashPayload, l as runAgentPlanClassifier, lt as AgentIdentityStatus, m as HoneyTokenToolOptions, mt as AgentSessionStatus, n as AgentPlanClassifier, nt as AgentAuditEventEnvelope, o as RecordPlanRiskAssessmentOptions, ot as AgentIdentity, p as HoneyTokenToolDefinition, pt as AgentSessionMetadata, q as delegateToAgent, r as AgentPlanClassifierInput, rt as AgentDecisionMetadata, s as heuristicPlanRiskClassifier, st as AgentIdentityRecord, t as AGENT_PLAN_RISK_ATTR, tt as AgentAiMetadata, u as EvalIncidentQueryResult, ut as AgentMetadataInput, v as recordEvalRunIdentity, vt as DelegationContext, w as DetectCrossAgentPatternOptions, wt as ScopedToolDefinition, x as CrossAgentDetection, xt as PolicyMetadata, y as CrossAgentMonitor, yt as GovernanceMetadata, z as defineAgentAction } from "../index-B4Qh_eVm.js";
1
+ import { $ as canonicalizeForHash, A as verifyEventEnvelopeHash, B as defineAgentToolCall, C as CrossAgentSecurityEvent, D as withScopedTool, E as detectCrossAgentPattern, F as RevokeAgentIdentityInput, G as DelegateToAgentInput, H as recordPolicyDecision, I as RotateAgentIdentityInput, J as recordAgentHandoff, K as RecordAgentHandoffMetadata, L as createAgentIdentityRegistry, M as resolvePrivacyProfile, N as sanitizeAuditPayload, O as CreateSignedEventEnvelopeOptions, P as ProvisionAgentIdentityInput, Q as HashPayloadOptions, R as withAgentSession, S as CrossAgentEvent, T as crossAgentDetectionsToSecurityEvents, U as withAgentAction, V as recordDecisionBasis, W as withAgentToolCall, X as setAgentAttributes, Y as flattenAgentAttributes, Z as createAgentAuditMetadata, _ as RecordEvalRunIdentityInput, a as AgentPlanRiskVerdict, b as CrossAgentMonitorOptions, c as recordPlanRiskAssessment, d as querySpansForEvalIncident, et as hashPayload, f as spansToCrossAgentEvents, g as EVAL_IDENTITY_ATTR, h as createHoneyTokenTool, i as AgentPlanClassifierResult, j as PrivacyProfileInput, k as createSignedEventEnvelope, l as runAgentPlanClassifier, m as HoneyTokenToolOptions, n as AgentPlanClassifier, o as RecordPlanRiskAssessmentOptions, p as HoneyTokenToolDefinition, q as delegateToAgent, r as AgentPlanClassifierInput, s as heuristicPlanRiskClassifier, t as AGENT_PLAN_RISK_ATTR, tt as AGENT_AUDIT_SCHEMA_VERSION, u as EvalIncidentQueryResult, v as recordEvalRunIdentity, w as DetectCrossAgentPatternOptions, x as CrossAgentDetection, y as CrossAgentMonitor, z as defineAgentAction } from "../index-CCECca0b.js";
2
2
  import { a as TokenUsage, i as ModelPricing } from "../cost-C1FkUNG1.js";
3
- import { C as recordPlanStep, D as agentContextFromSpan, E as AgentContext, S as recordMemoryAccess, T as tryRecordHumanApproval, _ as recordActionRiskClass, a as AgentInputProvenance, b as recordHumanApproval, c as AgentSecurityRecordOptions, d as RecordHumanApprovalInput, f as RecordInputProvenanceInput, g as deriveActionRiskClass, h as RecordRenderOutputInput, i as AgentConsentOutcome, l as RecordActiveScopesInput, m as RecordPlanStepInput, n as ActionRiskHints, o as AgentMemoryOperation, p as RecordMemoryAccessInput, r as AgentActionRiskClass, s as AgentOutputFormat, t as AGENT_SECURITY_ATTR, u as RecordControllerInput, v as recordActiveScopes, w as recordRenderOutput, x as recordInputProvenance, y as recordControllerId } from "../agent-security-BHdP6ZPG.js";
3
+ import { $ as ScopedToolDefinition, A as AgentAuditEventEnvelope, B as AgentSessionActionMetadata, C as recordPlanStep, D as AgentActionMetadata, E as AgentActionFactory, F as AgentIdentityRecord, G as AiLifecycleStage, H as AgentSessionStatus, I as AgentIdentityRegistry, J as GovernanceMetadata, K as DelegationContext, L as AgentIdentityStatus, M as AgentEventKind, N as AgentHandler, O as AgentActionOptions, P as AgentIdentity, Q as PrivacyProfileName, R as AgentMetadataInput, S as recordMemoryAccess, T as tryRecordHumanApproval, U as AgentToolCallActionMetadata, V as AgentSessionMetadata, W as AgentToolCallOptions, X as PolicyMetadata, Y as PolicyDecision, Z as PrivacyProfile, _ as recordActionRiskClass, a as AgentInputProvenance, b as recordHumanApproval, c as AgentSecurityRecordOptions, d as RecordHumanApprovalInput, et as ToolCallMetadata, f as RecordInputProvenanceInput, g as deriveActionRiskClass, h as RecordRenderOutputInput, i as AgentConsentOutcome, j as AgentDecisionMetadata, k as AgentAiMetadata, l as RecordActiveScopesInput, m as RecordPlanStepInput, n as ActionRiskHints, nt as AgentContext, o as AgentMemoryOperation, p as RecordMemoryAccessInput, r as AgentActionRiskClass, rt as agentContextFromSpan, s as AgentOutputFormat, t as AGENT_SECURITY_ATTR, tt as ToolStatus, u as RecordControllerInput, v as recordActiveScopes, w as recordRenderOutput, x as recordInputProvenance, y as recordControllerId, z as AgentOutcome } from "../agent-security-CWkxz1j3.js";
4
4
  export { AGENT_AUDIT_SCHEMA_VERSION, AGENT_PLAN_RISK_ATTR, AGENT_SECURITY_ATTR, type ActionRiskHints, type AgentActionFactory, type AgentActionMetadata, type AgentActionOptions, type AgentActionRiskClass, type AgentAiMetadata, type AgentAuditEventEnvelope, 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, type DelegateToAgentInput, type DelegationContext, type DetectCrossAgentPatternOptions, EVAL_IDENTITY_ATTR, type EvalIncidentQueryResult, type GovernanceMetadata, type HashPayloadOptions, type HoneyTokenToolDefinition, type HoneyTokenToolOptions, type ModelPricing, type PolicyDecision, type PolicyMetadata, type PrivacyProfile, type PrivacyProfileInput, type PrivacyProfileName, type ProvisionAgentIdentityInput, type RecordActiveScopesInput, type RecordAgentHandoffMetadata, type RecordControllerInput, type RecordEvalRunIdentityInput, type RecordHumanApprovalInput, type RecordInputProvenanceInput, type RecordMemoryAccessInput, type RecordPlanRiskAssessmentOptions, type RecordPlanStepInput, type RecordRenderOutputInput, type RevokeAgentIdentityInput, type RotateAgentIdentityInput, type ScopedToolDefinition, type TokenUsage, type ToolCallMetadata, type ToolStatus, agentContextFromSpan, canonicalizeForHash, createAgentAuditMetadata, createAgentIdentityRegistry, createHoneyTokenTool, createSignedEventEnvelope, crossAgentDetectionsToSecurityEvents, defineAgentAction, defineAgentToolCall, delegateToAgent, deriveActionRiskClass, detectCrossAgentPattern, flattenAgentAttributes, hashPayload, heuristicPlanRiskClassifier, querySpansForEvalIncident, recordActionRiskClass, recordActiveScopes, recordAgentHandoff, recordControllerId, recordDecisionBasis, recordEvalRunIdentity, recordHumanApproval, recordInputProvenance, recordMemoryAccess, recordPlanRiskAssessment, recordPlanStep, recordPolicyDecision, recordRenderOutput, resolvePrivacyProfile, runAgentPlanClassifier, sanitizeAuditPayload, setAgentAttributes, spansToCrossAgentEvents, 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-CUDUKOEK.js";
2
- import { A as createAgentAuditMetadata, C as defineAgentToolCall, D as withAgentToolCall, E as withAgentAction, M as hashPayload, N as AGENT_AUDIT_SCHEMA_VERSION, O as flattenAgentAttributes, S as defineAgentAction, T as recordPolicyDecision, _ as sanitizeAuditPayload, a as querySpansForEvalIncident, b as delegateToAgent, c as EVAL_IDENTITY_ATTR, d as crossAgentDetectionsToSecurityEvents, f as detectCrossAgentPattern, g as resolvePrivacyProfile, h as verifyEventEnvelopeHash, i as runAgentPlanClassifier, j as canonicalizeForHash, k as setAgentAttributes, l as recordEvalRunIdentity, m as createSignedEventEnvelope, n as heuristicPlanRiskClassifier, o as spansToCrossAgentEvents, p as withScopedTool, r as recordPlanRiskAssessment, s as createHoneyTokenTool, t as AGENT_PLAN_RISK_ATTR, u as CrossAgentMonitor, v as createAgentIdentityRegistry, w as recordDecisionBasis, x as recordAgentHandoff, y as withAgentSession } from "../agent-C9ww7o3H.js";
2
+ import { A as createAgentAuditMetadata, C as defineAgentToolCall, D as withAgentToolCall, E as withAgentAction, M as hashPayload, N as AGENT_AUDIT_SCHEMA_VERSION, O as flattenAgentAttributes, S as defineAgentAction, T as recordPolicyDecision, _ as sanitizeAuditPayload, a as querySpansForEvalIncident, b as delegateToAgent, c as EVAL_IDENTITY_ATTR, d as crossAgentDetectionsToSecurityEvents, f as detectCrossAgentPattern, g as resolvePrivacyProfile, h as verifyEventEnvelopeHash, i as runAgentPlanClassifier, j as canonicalizeForHash, k as setAgentAttributes, l as recordEvalRunIdentity, m as createSignedEventEnvelope, n as heuristicPlanRiskClassifier, o as spansToCrossAgentEvents, p as withScopedTool, r as recordPlanRiskAssessment, s as createHoneyTokenTool, t as AGENT_PLAN_RISK_ATTR, u as CrossAgentMonitor, v as createAgentIdentityRegistry, w as recordDecisionBasis, x as recordAgentHandoff, y as withAgentSession } from "../agent-DYs6JLN5.js";
3
3
 
4
4
  export { AGENT_AUDIT_SCHEMA_VERSION, AGENT_PLAN_RISK_ATTR, AGENT_SECURITY_ATTR, CrossAgentMonitor, EVAL_IDENTITY_ATTR, agentContextFromSpan, canonicalizeForHash, createAgentAuditMetadata, createAgentIdentityRegistry, createHoneyTokenTool, createSignedEventEnvelope, crossAgentDetectionsToSecurityEvents, defineAgentAction, defineAgentToolCall, delegateToAgent, deriveActionRiskClass, detectCrossAgentPattern, flattenAgentAttributes, hashPayload, heuristicPlanRiskClassifier, querySpansForEvalIncident, recordActionRiskClass, recordActiveScopes, recordAgentHandoff, recordControllerId, recordDecisionBasis, recordEvalRunIdentity, recordHumanApproval, recordInputProvenance, recordMemoryAccess, recordPlanRiskAssessment, recordPlanStep, recordPolicyDecision, recordRenderOutput, resolvePrivacyProfile, runAgentPlanClassifier, sanitizeAuditPayload, setAgentAttributes, spansToCrossAgentEvents, tryRecordHumanApproval, verifyEventEnvelopeHash, withAgentAction, withAgentSession, withAgentToolCall, withScopedTool };
@@ -1,5 +1,6 @@
1
1
  const require_cost = require('./cost.cjs');
2
- const require_attributes = require('./attributes-D2ugZS_C.cjs');
2
+ const require_attributes = require('./attributes-BbHetlqB.cjs');
3
+ const require_values = require('./values-m4hAgUuq.cjs');
3
4
  const require_agent_security = require('./agent-security-kfpXuwL4.cjs');
4
5
  let autotel = require("autotel");
5
6
  let autotel_audit = require("autotel-audit");
@@ -758,11 +759,10 @@ const PRIVACY_PROFILES = {
758
759
  }
759
760
  };
760
761
  function maskValue(value) {
761
- if (typeof value !== "string") {
762
- return "<masked>";
763
- }
764
- if (value.length <= 6) return "***";
765
- return `${value.slice(0, 3)}***${value.slice(-3)}`;
762
+ const text = require_values.asString(value);
763
+ if (text === undefined) return "<masked>";
764
+ if (text.length <= 6) return "***";
765
+ return `${text.slice(0, 3)}***${text.slice(-3)}`;
766
766
  }
767
767
  function matches(patterns, key) {
768
768
  return patterns?.some((pattern) => pattern.test(key)) ?? false;
@@ -787,19 +787,23 @@ function sanitizeNode(value, profile, keyPath) {
787
787
  if (matches(profile.maskKeys, lowered)) {
788
788
  return maskValue(value);
789
789
  }
790
- if (typeof value === "string") {
791
- return truncateString(value, profile.maxStringLength);
790
+ const text = require_values.asString(value);
791
+ if (text !== undefined) {
792
+ return truncateString(text, profile.maxStringLength);
792
793
  }
793
794
  if (Array.isArray(value)) {
794
795
  return value.map((entry, index) => sanitizeNode(entry, profile, `${keyPath}[${index}]`));
795
796
  }
796
- if (value && typeof value === "object") {
797
- return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, sanitizeNode(entry, profile, keyPath ? `${keyPath}.${key}` : key)]));
798
- }
799
- if (typeof value === "bigint") {
800
- return value.toString(10);
797
+ const record = require_values.asRecord(value);
798
+ if (record) {
799
+ const out = {};
800
+ for (const [key, entry] of Object.entries(record)) {
801
+ out[key] = sanitizeNode(entry, profile, keyPath ? `${keyPath}.${key}` : key);
802
+ }
803
+ return out;
801
804
  }
802
- return value;
805
+ if (typeof value === "bigint") return value.toString(10);
806
+ return require_values.asNumber(value) ?? require_values.asBoolean(value) ?? (value === null ? null : undefined);
803
807
  }
804
808
  function resolvePrivacyProfile(profile = "strict") {
805
809
  return typeof profile === "string" ? PRIVACY_PROFILES[profile] : profile;
@@ -1,5 +1,6 @@
1
1
  import { estimateLLMCost } from "./cost.js";
2
- import { i as genAiResponseAttributes, r as genAiRequestAttributes, s as genAiUsageAttributes } from "./attributes-DmV7B6dn.js";
2
+ import { i as genAiResponseAttributes, r as genAiRequestAttributes, s as genAiUsageAttributes } from "./attributes-CVOD1BG1.js";
3
+ import { i as asString, n as asNumber, r as asRecord, t as asBoolean } from "./values-CLNajs9_.js";
3
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-CUDUKOEK.js";
4
5
  import { createNoopRequestLogger, createStructuredError, getRequestLoggerSafe } from "autotel";
5
6
  import { forceKeepAuditEvent, securityEvent, withAudit } from "autotel-audit";
@@ -758,11 +759,10 @@ const PRIVACY_PROFILES = {
758
759
  }
759
760
  };
760
761
  function maskValue(value) {
761
- if (typeof value !== "string") {
762
- return "<masked>";
763
- }
764
- if (value.length <= 6) return "***";
765
- return `${value.slice(0, 3)}***${value.slice(-3)}`;
762
+ const text = asString(value);
763
+ if (text === undefined) return "<masked>";
764
+ if (text.length <= 6) return "***";
765
+ return `${text.slice(0, 3)}***${text.slice(-3)}`;
766
766
  }
767
767
  function matches(patterns, key) {
768
768
  return patterns?.some((pattern) => pattern.test(key)) ?? false;
@@ -787,19 +787,23 @@ function sanitizeNode(value, profile, keyPath) {
787
787
  if (matches(profile.maskKeys, lowered)) {
788
788
  return maskValue(value);
789
789
  }
790
- if (typeof value === "string") {
791
- return truncateString(value, profile.maxStringLength);
790
+ const text = asString(value);
791
+ if (text !== undefined) {
792
+ return truncateString(text, profile.maxStringLength);
792
793
  }
793
794
  if (Array.isArray(value)) {
794
795
  return value.map((entry, index) => sanitizeNode(entry, profile, `${keyPath}[${index}]`));
795
796
  }
796
- if (value && typeof value === "object") {
797
- return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, sanitizeNode(entry, profile, keyPath ? `${keyPath}.${key}` : key)]));
798
- }
799
- if (typeof value === "bigint") {
800
- return value.toString(10);
797
+ const record = asRecord(value);
798
+ if (record) {
799
+ const out = {};
800
+ for (const [key, entry] of Object.entries(record)) {
801
+ out[key] = sanitizeNode(entry, profile, keyPath ? `${keyPath}.${key}` : key);
802
+ }
803
+ return out;
801
804
  }
802
- return value;
805
+ if (typeof value === "bigint") return value.toString(10);
806
+ return asNumber(value) ?? asBoolean(value) ?? (value === null ? null : undefined);
803
807
  }
804
808
  function resolvePrivacyProfile(profile = "strict") {
805
809
  return typeof profile === "string" ? PRIVACY_PROFILES[profile] : profile;
@@ -0,0 +1,367 @@
1
+ import { a as TokenUsage, i as ModelPricing } from "./cost-C1FkUNG1.cjs";
2
+ import { m as GenAiProviderName } from "./semconv-B8OQQKbC.cjs";
3
+ import { RequestLogger } from "autotel";
4
+ import { OnMissingContext } from "autotel-audit";
5
+ //#region src/agent/context.d.ts
6
+ interface AgentContext {
7
+ traceId: string;
8
+ spanId: string;
9
+ correlationId: string;
10
+ setAttribute(key: string, value: string | number | boolean): void;
11
+ setAttributes(attrs: Record<string, string | number | boolean | string[] | number[] | boolean[]>): void;
12
+ }
13
+ declare const MISSING_CONTEXT_MESSAGE: string;
14
+ declare function resolveContextSafe(ctx?: AgentContext): AgentContext | null;
15
+ declare function resolveContext(ctx?: AgentContext): AgentContext;
16
+ /** Warn (once per action) that an agent action is running without a trace context. */
17
+ declare function warnMissingContextOnce(action: string): void;
18
+ /** A no-op {@link AgentContext} whose attribute setters do nothing. */
19
+ declare function noopAgentContext(): AgentContext;
20
+ /** Adapt an OpenTelemetry span (or span-like object) to {@link AgentContext}. */
21
+ declare function agentContextFromSpan(span: {
22
+ spanContext(): {
23
+ traceId: string;
24
+ spanId: string;
25
+ };
26
+ setAttribute(key: string, value: string | number | boolean): void;
27
+ setAttributes(attrs: Record<string, string | number | boolean | string[] | number[] | boolean[]>): void;
28
+ }): AgentContext;
29
+ declare function toAttributeValue(value: unknown): string | number | boolean | string[] | number[] | boolean[] | undefined;
30
+ //#endregion
31
+ //#region src/agent/types.d.ts
32
+ /**
33
+ * Free-form metadata a caller attaches to a GenAI operation. Serialized onto a
34
+ * span or an event, so it holds what JSON can carry.
35
+ */
36
+ type GenAiMetadata = {
37
+ [key: string]: string | number | boolean | null | GenAiMetadata | Array<GenAiMetadata | string | number | boolean | null>;
38
+ };
39
+ type PolicyDecision = 'permit' | 'deny' | 'challenge' | 'observe' | 'error';
40
+ type ToolStatus = 'planned' | 'complete' | 'error' | 'blocked';
41
+ type AgentOutcome = 'success' | 'failure';
42
+ type AgentEventKind = 'action' | 'tool_call' | 'policy_decision' | 'handoff';
43
+ type AiLifecycleStage = 'plan' | 'design' | 'develop' | 'deploy' | 'operate' | 'monitor' | 'decommission';
44
+ type AgentIdentityStatus = 'active' | 'rotated' | 'revoked' | 'expired';
45
+ type AgentSessionStatus = 'active' | 'completed' | 'failed' | 'revoked' | 'expired';
46
+ type PrivacyProfileName = 'strict' | 'pci' | 'healthcare';
47
+ interface AgentIdentity {
48
+ id: string;
49
+ version?: string;
50
+ framework?: string;
51
+ model?: string;
52
+ role?: string;
53
+ sessionId?: string;
54
+ conversationId?: string;
55
+ }
56
+ interface DelegationContext {
57
+ parentIdentity: string;
58
+ scope?: string | string[];
59
+ tokenId?: string;
60
+ delegationId?: string;
61
+ authorityLineage?: string[];
62
+ authorityLineageHash?: string;
63
+ depth?: number;
64
+ issuedAt?: string | Date;
65
+ expiresAt?: string | Date;
66
+ }
67
+ interface ToolCallMetadata {
68
+ name: string;
69
+ callId?: string;
70
+ input?: unknown;
71
+ inputHash?: string;
72
+ output?: unknown;
73
+ outputHash?: string;
74
+ status?: ToolStatus;
75
+ executionMs?: number;
76
+ }
77
+ /**
78
+ * LLM call metadata for an agent action. When present on a tool call or action,
79
+ * autotel-genai records canonical OpenTelemetry GenAI attributes on the span —
80
+ * `gen_ai.request.model`, `gen_ai.usage.input_tokens` / `output_tokens`, and the
81
+ * estimated `gen_ai.usage.cost.usd`. Token usage is usually known only after the
82
+ * call; supply it via `usage` if known up front, or via the `extractUsage`
83
+ * option to pull it from the handler's result.
84
+ */
85
+ interface AgentAiMetadata {
86
+ /** Model id, e.g. `gpt-4o`, `claude-sonnet-4`, `@cf/meta/llama-3.1-8b-instruct-fp8`. */
87
+ model: string;
88
+ /**
89
+ * `gen_ai.operation.name` — `chat` | `text_completion` | `embeddings` |
90
+ * `invoke_agent` | `execute_tool` | custom.
91
+ */
92
+ operation?: string;
93
+ /** `gen_ai.provider.name` — e.g. `openai`, `anthropic`, `gcp.gemini`. */
94
+ provider?: GenAiProviderName;
95
+ /** Model the provider actually served (`gen_ai.response.model`). */
96
+ responseModel?: string;
97
+ /** Provider response id (`gen_ai.response.id`). */
98
+ responseId?: string;
99
+ /** Token counts, if known up front (otherwise use `AgentActionOptions.extractUsage`). */
100
+ usage?: TokenUsage;
101
+ /** Provider finish reasons, e.g. `['stop']`. */
102
+ finishReasons?: string[];
103
+ /** Per-call pricing override/extension for cost estimation. */
104
+ pricing?: Record<string, ModelPricing>;
105
+ }
106
+ interface PolicyMetadata {
107
+ decision: PolicyDecision;
108
+ policyId?: string;
109
+ riskScore?: number;
110
+ reason?: string;
111
+ }
112
+ interface GovernanceMetadata {
113
+ reviewRequired?: boolean;
114
+ reviewerId?: string;
115
+ controlId?: string | string[];
116
+ documentationUrl?: string;
117
+ lifecycleStage?: AiLifecycleStage;
118
+ framework?: string;
119
+ }
120
+ interface AgentSessionMetadata {
121
+ status?: AgentSessionStatus;
122
+ startedAt?: string | Date;
123
+ endedAt?: string | Date;
124
+ delegatedBy?: string;
125
+ }
126
+ interface AgentSessionActionMetadata extends AgentActionMetadata {
127
+ session?: AgentSessionMetadata;
128
+ }
129
+ interface AgentDecisionMetadata {
130
+ summary: string;
131
+ inputHash?: string;
132
+ policyIds?: string[];
133
+ justificationCodes?: string[];
134
+ evidenceIds?: string[];
135
+ reviewRequired?: boolean;
136
+ confidence?: number;
137
+ }
138
+ interface AgentActionMetadata {
139
+ action: string;
140
+ resource?: string;
141
+ actorId?: string;
142
+ category?: string;
143
+ outcome?: AgentOutcome;
144
+ schemaVersion?: string;
145
+ eventKind?: AgentEventKind;
146
+ agent: AgentIdentity;
147
+ delegation?: DelegationContext;
148
+ tool?: ToolCallMetadata;
149
+ ai?: AgentAiMetadata;
150
+ policy?: PolicyMetadata;
151
+ governance?: GovernanceMetadata;
152
+ session?: AgentSessionMetadata;
153
+ decision?: AgentDecisionMetadata;
154
+ reasoningSummary?: string;
155
+ }
156
+ interface AgentActionOptions {
157
+ ctx?: AgentContext;
158
+ emitNow?: boolean;
159
+ forceKeep?: boolean;
160
+ logger?: RequestLogger;
161
+ /**
162
+ * Behaviour when no trace context can be resolved. Defaults to `warn`
163
+ * (best-effort: run the action un-audited, warn once). Agent audit is
164
+ * observability — a missing context must never crash the wrapped tool call.
165
+ * See {@link OnMissingContext}.
166
+ */
167
+ onMissingContext?: OnMissingContext;
168
+ /**
169
+ * Pull token usage from the handler's result, for actions carrying
170
+ * {@link AgentAiMetadata}. Called once after the handler resolves; the
171
+ * returned usage drives the recorded GenAI token + cost attributes. Most LLM
172
+ * SDKs expose this on the response (e.g. `res.usage`).
173
+ */
174
+ extractUsage?: (result: unknown) => TokenUsage | undefined;
175
+ }
176
+ interface AgentToolCallOptions extends AgentActionOptions {
177
+ hashResult?: boolean;
178
+ }
179
+ type AgentHandler<T> = (ctx: AgentContext, logger: RequestLogger) => T | Promise<T>;
180
+ /** Action metadata that always carries tool details (for tool-call wrappers). */
181
+ type AgentToolCallActionMetadata = AgentActionMetadata & {
182
+ tool: ToolCallMetadata;
183
+ };
184
+ /**
185
+ * Factory used by `defineAgentAction` / `defineAgentToolCall`. Mirrors the
186
+ * `trace()` factory shape: receive the audit context, return the handler that
187
+ * runs per call. `logger` may be ignored.
188
+ */
189
+ type AgentActionFactory<TArgs extends unknown[], TResult> = (ctx: AgentContext, logger: RequestLogger) => (...args: TArgs) => TResult | Promise<TResult>;
190
+ /**
191
+ * Metadata for a defined wrapper: either a static object or a function of the
192
+ * call arguments (so call-specific fields like `tool.input` can be hashed).
193
+ */
194
+ type AgentMetadataInput<TArgs extends unknown[], TMetadata> = TMetadata | ((...args: TArgs) => TMetadata);
195
+ interface PrivacyProfile {
196
+ name: string;
197
+ hashKeys?: RegExp[];
198
+ dropKeys?: RegExp[];
199
+ maskKeys?: RegExp[];
200
+ maxStringLength?: number;
201
+ }
202
+ interface AgentIdentityRecord {
203
+ agent: AgentIdentity;
204
+ scopes: string[];
205
+ status: AgentIdentityStatus;
206
+ tokenId?: string;
207
+ tokenHash?: string;
208
+ delegatedBy?: string;
209
+ provisionedAt: string;
210
+ rotatedAt?: string;
211
+ revokedAt?: string;
212
+ revocationReason?: string;
213
+ expiresAt?: string;
214
+ metadata?: GenAiMetadata;
215
+ }
216
+ interface AgentIdentityRegistry {
217
+ provisionIdentity(input: {
218
+ agent: AgentIdentity;
219
+ scopes?: string[];
220
+ tokenId?: string;
221
+ delegatedBy?: string;
222
+ provisionedAt?: string | Date;
223
+ expiresAt?: string | Date;
224
+ metadata?: GenAiMetadata;
225
+ }): AgentIdentityRecord;
226
+ rotateIdentity(agentId: string, input?: {
227
+ scopes?: string[];
228
+ tokenId?: string;
229
+ delegatedBy?: string;
230
+ rotatedAt?: string | Date;
231
+ expiresAt?: string | Date;
232
+ metadata?: GenAiMetadata;
233
+ }): AgentIdentityRecord;
234
+ revokeIdentity(agentId: string, input: {
235
+ reason: string;
236
+ revokedAt?: string | Date;
237
+ }): AgentIdentityRecord;
238
+ getIdentity(agentId: string): AgentIdentityRecord | undefined;
239
+ getIdentityStatus(agentId: string, at?: string): AgentIdentityStatus | undefined;
240
+ assertUsable(agentId: string, at?: string): AgentIdentityRecord;
241
+ assertScopes(agentId: string, requiredScopes: string[]): AgentIdentityRecord;
242
+ issueDelegation(agentId: string, input: {
243
+ parentIdentity: string;
244
+ scope?: string | string[];
245
+ tokenId?: string;
246
+ delegationId?: string;
247
+ authorityLineage?: string[];
248
+ issuedAt?: string | Date;
249
+ expiresAt?: string | Date;
250
+ }): DelegationContext;
251
+ list(): AgentIdentityRecord[];
252
+ }
253
+ interface ScopedToolDefinition<TInput> {
254
+ action: string;
255
+ resource?: string;
256
+ category?: string;
257
+ agent: AgentIdentity;
258
+ delegation?: DelegationContext;
259
+ tool: Pick<ToolCallMetadata, 'name' | 'callId'>;
260
+ requiredScopes?: string[];
261
+ policyId?: string;
262
+ riskScore?: number;
263
+ reviewRequired?: boolean;
264
+ governance?: GovernanceMetadata;
265
+ decision?: AgentDecisionMetadata;
266
+ privacyProfile?: PrivacyProfileName | PrivacyProfile;
267
+ identityRegistry?: AgentIdentityRegistry;
268
+ }
269
+ interface AgentAuditEventEnvelope {
270
+ schemaVersion: string;
271
+ emittedAt: string;
272
+ eventHash: string;
273
+ previousEventHash?: string;
274
+ signature?: string;
275
+ metadata: AgentActionMetadata;
276
+ evidence?: unknown;
277
+ }
278
+ //#endregion
279
+ //#region src/agent/agent-security.d.ts
280
+ /** Canonical agent security attribute keys (Google SAIF / human-control aligned). */
281
+ declare const AGENT_SECURITY_ATTR: {
282
+ readonly controllerId: "agent.controller.id";
283
+ readonly inputProvenance: "agent.input.provenance";
284
+ readonly actionRiskClass: "agent.action.risk_class";
285
+ readonly consentRequired: "agent.consent.required";
286
+ readonly consentOutcome: "agent.consent.outcome";
287
+ readonly scopeActive: "agent.scope.active";
288
+ readonly memoryOperation: "agent.memory.operation";
289
+ readonly memoryIsolationKey: "agent.memory.isolation_key";
290
+ readonly memoryContentHash: "agent.memory.content_hash";
291
+ readonly planStepIndex: "agent.plan.step_index";
292
+ readonly planToolIntents: "agent.plan.tool_intents";
293
+ readonly planPolicyIds: "agent.plan.policy_ids";
294
+ readonly outputFormat: "agent.output.format";
295
+ readonly outputContainsUrl: "agent.output.contains_url";
296
+ readonly outputUrlCount: "agent.output.url_count";
297
+ };
298
+ type AgentInputProvenance = 'user_direct' | 'user_voice' | 'rag' | 'memory' | 'tool_result' | 'external_untrusted';
299
+ type AgentActionRiskClass = 'read' | 'write' | 'destructive' | 'financial' | 'exfiltration_capable';
300
+ type AgentConsentOutcome = 'approved' | 'denied' | 'timeout' | 'revoked';
301
+ type AgentMemoryOperation = 'read' | 'write' | 'delete' | 'search';
302
+ type AgentOutputFormat = 'text' | 'markdown' | 'html' | 'json' | 'mixed';
303
+ interface AgentSecurityRecordOptions {
304
+ ctx?: AgentContext;
305
+ }
306
+ interface RecordControllerInput extends AgentSecurityRecordOptions {
307
+ /** Controlling human user id — hashed before emission unless already a digest. */
308
+ controllerId: string;
309
+ /** Pass a stable per-deployment salt to `hashIdentifier`. */
310
+ hashSalt?: string;
311
+ /** When false, emit the id as given (must not be raw PII). Default true. */
312
+ hash?: boolean;
313
+ }
314
+ interface RecordInputProvenanceInput extends AgentSecurityRecordOptions {
315
+ provenance: AgentInputProvenance;
316
+ }
317
+ interface RecordHumanApprovalInput extends AgentSecurityRecordOptions {
318
+ toolCallId: string;
319
+ toolName?: string;
320
+ approved: boolean;
321
+ required?: boolean;
322
+ controllerId?: string;
323
+ hashSalt?: string;
324
+ }
325
+ interface RecordActiveScopesInput extends AgentSecurityRecordOptions {
326
+ scopes: string[];
327
+ }
328
+ interface RecordMemoryAccessInput extends AgentSecurityRecordOptions {
329
+ operation: AgentMemoryOperation;
330
+ isolationKey: string;
331
+ contentHash?: string;
332
+ }
333
+ interface RecordPlanStepInput extends AgentSecurityRecordOptions {
334
+ stepIndex: number;
335
+ toolIntents?: string[];
336
+ policyIds?: string[];
337
+ summary?: string;
338
+ }
339
+ interface RecordRenderOutputInput extends AgentSecurityRecordOptions {
340
+ format?: AgentOutputFormat;
341
+ containsUrl?: boolean;
342
+ urlCount?: number;
343
+ }
344
+ interface ActionRiskHints {
345
+ readOnlyHint?: boolean;
346
+ destructiveHint?: boolean;
347
+ openWorldHint?: boolean;
348
+ untrustedContentHint?: boolean;
349
+ financial?: boolean;
350
+ exfiltrationCapable?: boolean;
351
+ }
352
+ /**
353
+ * Derive a coarse action risk class from MCP tool hints or explicit overrides.
354
+ */
355
+ declare function deriveActionRiskClass(hints: ActionRiskHints, override?: AgentActionRiskClass): AgentActionRiskClass;
356
+ declare function recordControllerId(input: RecordControllerInput): void;
357
+ declare function recordInputProvenance(input: RecordInputProvenanceInput): void;
358
+ declare function recordHumanApproval(input: RecordHumanApprovalInput): void;
359
+ declare function recordActiveScopes(input: RecordActiveScopesInput): void;
360
+ declare function recordActionRiskClass(riskClass: AgentActionRiskClass, options?: AgentSecurityRecordOptions): void;
361
+ declare function recordMemoryAccess(input: RecordMemoryAccessInput): void;
362
+ declare function recordPlanStep(input: RecordPlanStepInput): void;
363
+ declare function recordRenderOutput(input: RecordRenderOutputInput): void;
364
+ /** Best-effort variant — no throw when trace context is missing. */
365
+ declare function tryRecordHumanApproval(input: RecordHumanApprovalInput): boolean;
366
+ //#endregion
367
+ export { ScopedToolDefinition as $, AgentAuditEventEnvelope as A, AgentSessionActionMetadata as B, recordPlanStep as C, AgentActionMetadata as D, AgentActionFactory as E, AgentIdentityRecord as F, AiLifecycleStage as G, AgentSessionStatus as H, AgentIdentityRegistry as I, GovernanceMetadata as J, DelegationContext as K, AgentIdentityStatus as L, AgentEventKind as M, AgentHandler as N, AgentActionOptions as O, AgentIdentity as P, PrivacyProfileName as Q, AgentMetadataInput as R, recordMemoryAccess as S, tryRecordHumanApproval as T, AgentToolCallActionMetadata as U, AgentSessionMetadata as V, AgentToolCallOptions as W, PolicyMetadata as X, PolicyDecision as Y, PrivacyProfile as Z, recordActionRiskClass as _, AgentInputProvenance as a, recordHumanApproval as b, AgentSecurityRecordOptions as c, RecordHumanApprovalInput as d, ToolCallMetadata as et, RecordInputProvenanceInput as f, deriveActionRiskClass as g, RecordRenderOutputInput as h, AgentConsentOutcome as i, AgentDecisionMetadata as j, AgentAiMetadata as k, RecordActiveScopesInput as l, RecordPlanStepInput as m, ActionRiskHints as n, AgentContext as nt, AgentMemoryOperation as o, RecordMemoryAccessInput as p, GenAiMetadata as q, AgentActionRiskClass as r, agentContextFromSpan as rt, AgentOutputFormat as s, AGENT_SECURITY_ATTR as t, ToolStatus as tt, RecordControllerInput as u, recordActiveScopes as v, recordRenderOutput as w, recordInputProvenance as x, recordControllerId as y, AgentOutcome as z };