@niadra/sdk 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +15 -6
  3. package/dist/ai-sdk.cjs +3 -4
  4. package/dist/ai-sdk.cjs.map +1 -1
  5. package/dist/ai-sdk.d.cts +3 -3
  6. package/dist/ai-sdk.d.ts +3 -3
  7. package/dist/ai-sdk.js +3 -4
  8. package/dist/ai-sdk.js.map +1 -1
  9. package/dist/anthropic.cjs +1 -1
  10. package/dist/anthropic.cjs.map +1 -1
  11. package/dist/anthropic.d.cts +4 -4
  12. package/dist/anthropic.d.ts +4 -4
  13. package/dist/anthropic.js +1 -1
  14. package/dist/anthropic.js.map +1 -1
  15. package/dist/bedrock.cjs +1 -1
  16. package/dist/bedrock.cjs.map +1 -1
  17. package/dist/bedrock.d.cts +4 -4
  18. package/dist/bedrock.d.ts +4 -4
  19. package/dist/bedrock.js +1 -1
  20. package/dist/bedrock.js.map +1 -1
  21. package/dist/cli.js +107 -51
  22. package/dist/cli.js.map +1 -1
  23. package/dist/{client-DsIxZxZk.d.cts → client-B_ip8T2o.d.cts} +69 -14
  24. package/dist/{client-DsIxZxZk.d.ts → client-B_ip8T2o.d.ts} +69 -14
  25. package/dist/cloudflare-agents.cjs +1 -1
  26. package/dist/cloudflare-agents.cjs.map +1 -1
  27. package/dist/cloudflare-agents.d.cts +3 -3
  28. package/dist/cloudflare-agents.d.ts +3 -3
  29. package/dist/cloudflare-agents.js +1 -1
  30. package/dist/cloudflare-agents.js.map +1 -1
  31. package/dist/elevenlabs.cjs +1 -1
  32. package/dist/elevenlabs.cjs.map +1 -1
  33. package/dist/elevenlabs.d.cts +5 -5
  34. package/dist/elevenlabs.d.ts +5 -5
  35. package/dist/elevenlabs.js +1 -1
  36. package/dist/elevenlabs.js.map +1 -1
  37. package/dist/genkit.cjs +1 -1
  38. package/dist/genkit.cjs.map +1 -1
  39. package/dist/genkit.d.cts +3 -3
  40. package/dist/genkit.d.ts +3 -3
  41. package/dist/genkit.js +1 -1
  42. package/dist/genkit.js.map +1 -1
  43. package/dist/google-adk.cjs +1 -1
  44. package/dist/google-adk.cjs.map +1 -1
  45. package/dist/google-adk.d.cts +3 -3
  46. package/dist/google-adk.d.ts +3 -3
  47. package/dist/google-adk.js +1 -1
  48. package/dist/google-adk.js.map +1 -1
  49. package/dist/google-genai.cjs +1 -1
  50. package/dist/google-genai.cjs.map +1 -1
  51. package/dist/google-genai.d.cts +4 -4
  52. package/dist/google-genai.d.ts +4 -4
  53. package/dist/google-genai.js +1 -1
  54. package/dist/google-genai.js.map +1 -1
  55. package/dist/index.cjs +106 -48
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.d.cts +6 -8
  58. package/dist/index.d.ts +6 -8
  59. package/dist/index.js +106 -48
  60. package/dist/index.js.map +1 -1
  61. package/dist/{intercept-D7qFCaRb.d.ts → intercept-CBaPK_-k.d.ts} +1 -1
  62. package/dist/{intercept-0_lJE6k1.d.cts → intercept-CxmBLfoj.d.cts} +1 -1
  63. package/dist/langchain.cjs +3 -4
  64. package/dist/langchain.cjs.map +1 -1
  65. package/dist/langchain.d.cts +3 -3
  66. package/dist/langchain.d.ts +3 -3
  67. package/dist/langchain.js +3 -4
  68. package/dist/langchain.js.map +1 -1
  69. package/dist/livekit.cjs +1 -1
  70. package/dist/livekit.cjs.map +1 -1
  71. package/dist/livekit.d.cts +3 -3
  72. package/dist/livekit.d.ts +3 -3
  73. package/dist/livekit.js +1 -1
  74. package/dist/livekit.js.map +1 -1
  75. package/dist/llamaindex.cjs +1 -1
  76. package/dist/llamaindex.cjs.map +1 -1
  77. package/dist/llamaindex.d.cts +3 -3
  78. package/dist/llamaindex.d.ts +3 -3
  79. package/dist/llamaindex.js +1 -1
  80. package/dist/llamaindex.js.map +1 -1
  81. package/dist/mastra.cjs +3 -4
  82. package/dist/mastra.cjs.map +1 -1
  83. package/dist/mastra.d.cts +3 -3
  84. package/dist/mastra.d.ts +3 -3
  85. package/dist/mastra.js +3 -4
  86. package/dist/mastra.js.map +1 -1
  87. package/dist/openai-agents.cjs +1 -1
  88. package/dist/openai-agents.cjs.map +1 -1
  89. package/dist/openai-agents.d.cts +3 -3
  90. package/dist/openai-agents.d.ts +3 -3
  91. package/dist/openai-agents.js +1 -1
  92. package/dist/openai-agents.js.map +1 -1
  93. package/dist/retell.cjs +1 -1
  94. package/dist/retell.cjs.map +1 -1
  95. package/dist/retell.d.cts +5 -5
  96. package/dist/retell.d.ts +5 -5
  97. package/dist/retell.js +1 -1
  98. package/dist/retell.js.map +1 -1
  99. package/dist/{shared-Bb5B59Bu.d.ts → shared-BLkAbvuf.d.ts} +1 -1
  100. package/dist/{shared-DTPWVlWm.d.cts → shared-DEkF2Y_z.d.cts} +1 -1
  101. package/dist/strands.cjs +1 -1
  102. package/dist/strands.cjs.map +1 -1
  103. package/dist/strands.d.cts +3 -3
  104. package/dist/strands.d.ts +3 -3
  105. package/dist/strands.js +1 -1
  106. package/dist/strands.js.map +1 -1
  107. package/dist/twilio.d.cts +4 -4
  108. package/dist/twilio.d.ts +4 -4
  109. package/dist/vapi.cjs +1 -1
  110. package/dist/vapi.cjs.map +1 -1
  111. package/dist/vapi.d.cts +5 -5
  112. package/dist/vapi.d.ts +5 -5
  113. package/dist/vapi.js +1 -1
  114. package/dist/vapi.js.map +1 -1
  115. package/dist/voltagent.cjs +1 -1
  116. package/dist/voltagent.cjs.map +1 -1
  117. package/dist/voltagent.d.cts +3 -3
  118. package/dist/voltagent.d.ts +3 -3
  119. package/dist/voltagent.js +1 -1
  120. package/dist/voltagent.js.map +1 -1
  121. package/dist/{webhook-1ozGyksG.d.ts → webhook-BaraTaA9.d.ts} +1 -1
  122. package/dist/{webhook-CG4om_DK.d.cts → webhook-CuR0Wckd.d.cts} +1 -1
  123. package/dist/whatsapp.d.cts +2 -2
  124. package/dist/whatsapp.d.ts +2 -2
  125. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ConstraintsBlock, H as HardConstraint, N as NiadraError, a as ClaimRecord, b as ClaimCategory, I as InternalText, s as shingles, c as Niadra, R as Resolvers, d as ContextResponse, M as Mode, T as TurnPins, e as RawBinding, f as ContextResult, g as ModelUsage, L as Logger, S as SubjectKind, h as Handle, O as ObjectRef } from './client-DsIxZxZk.cjs';
2
- export { A as AGENT_MEMORY_TOOL_DEFINITIONS, i as AGENT_MEMORY_TOOL_NAMES, j as ActionEvent, k as ActionInfo, l as Actions, m as Admin, n as AgentMemoryBlock, o as AgentMemoryParams, p as AgentMemoryResult, q as AgentMemorySearchRequest, r as AgentMemorySearchResponse, t as AgentMemorySource, u as AgentNote, v as AgentNoteKind, w as AgentNoteOrigin, x as AgentNoteProposal, y as AgentNoteStatus, z as AgentNoteVisibility, B as AgentSession, D as AgentState, E as AgentStateConflict, F as AgentStateHandle, G as AgentStateMeta, J as AgentStateMetaPage, K as AgentStateReadRequest, P as AgentStateScope, Q as AgentStateWrite, U as AgentStateWriteResult, V as AgentTurnOptions, W as AnchorEvidence, X as Api, Y as ArmComparison, Z as ArmOutcomes, _ as AskedAttribute, $ as AssertionMethod, a0 as AssertionOutcome, a1 as AssertionStats, a2 as Attribute, a3 as AttributeEntry, a4 as AttributionReport, a5 as AttributionRow, a6 as AttributionTotal, a7 as Backing, a8 as BackingReport, a9 as BackingSources, aa as BatchItem, ab as BatchRequest, ac as BatchResponse, ad as BiFile, ae as BiUpload, af as BiUploadRequest, ag as BlobError, ah as BlobStore, ai as BlockSubject, aj as BoundArg, ak as BoundTools, al as BudgetBlock, am as BudgetCut, an as BudgetPack, ao as BudgetUse, ap as CacheDirectives, aq as CacheOptions, ar as CallCapture, as as CaseClosed, at as CaseOpened, au as Change, av as ChangePage, aw as ChangeSinceSeen, ax as ChannelState, ay as CheckBatchRequest, az as CheckBatchResponse, aA as CheckOptions, aB as CheckRequest, aC as CheckResult, aD as ClaimCheck, aE as ClaimCheckOptions, aF as ClaimContractSummary, aG as ClaimEvidence, aH as ClaimEvidenceRef, aI as ClaimKind, aJ as ClaimOutputs, aK as ClaimParams, aL as ClaimRelease, aM as ClaimRequest, aN as ClaimValue, aO as ClaimVerdict, aP as ClaimVia, aQ as Claimed, aR as ClientOptions, aS as Closes, aT as Commitment, aU as CommitmentDecided, aV as CommitmentDecidedDetail, aW as CommitmentMade, aX as CommitmentMadeDetail, aY as CommitmentRef, aZ as CommitmentWithdrawn, a_ as CommitmentWithdrawnDetail, a$ as CompanyRule, b0 as Conflict, b1 as ConflictCounts, b2 as ConstraintOrigin, b3 as ConstraintsRequest, b4 as ContactBudget, b5 as ContactBudgetUse, b6 as ContactClaims, b7 as ContactCount, b8 as ContactGateway, b9 as ContactKey, ba as ContactKeys, bb as ContactMade, bc as ContactMadeDetail, bd as ContactTokenParams, be as ContactTokenRefusal, bf as Content, bg as ContentMarker, bh as ContentMode, bi as ContentRelease, bj as ContentReleaseResult, bk as ContentResolver, bl as ContextFormat, bm as ContextOptions, bn as ContextPack, bo as ContextParams, bp as ContextRequest, bq as ContextSource, br as ContextStamp, bs as ContextUseEntry, bt as Conversation, bu as ConversationAction, bv as ConversationEndedItem, bw as ConversationEvent, bx as ConversationParams, by as CoordinationBlock, bz as CoordinationOverview, bA as CoordinationReport, bB as CoordinationReportPage, bC as CorrectParams, bD as CorrectionAction, bE as CorrectionRequest, bF as CounterfactualCase, bG as CounterfactualEngaged, bH as CounterfactualEngagement, bI as CounterfactualRunCreate, bJ as CounterfactualRunPage, bK as CreateAgentNoteRequest, bL as DEFAULT_CACHE, bM as DEFAULT_QUEUE, bN as DEFAULT_TIMEOUTS, bO as DEFAULT_VOICE, bP as DELETE, bQ as DataIssue, bR as DataIssuePage, bS as Declarations, bT as DeclareRequest, bU as DeclareResult, bV as DeliveryPath, bW as Detect, bX as DriftChanges, bY as Effect, bZ as EffectCount, b_ as EffectDeclared, b$ as EffectDetail, c0 as EffectKind, c1 as EffectReserve, c2 as EffectSeen, c3 as EffectSettle, c4 as EffectState, c5 as EffectStatus, c6 as Engaged, c7 as EpisodeOut, c8 as Erasure, c9 as EventItem, ca as EventKind, cb as Evidence, cc as ExperimentReport, cd as ExperimentResult, ce as ExportPackage, cf as FAIL_CLOSED, cg as FactHistory, ch as FactOut, ci as Feature, cj as Feedback, ck as FeedbackAction, cl as FeedbackParams, cm as FeedbackRequest, cn as Fetched, co as FieldCoverage, cp as FieldState, cq as ForgetTarget, cr as GatewayOptions, cs as Guard, ct as GuardLike, cu as GuardOptions, cv as Guarded, cw as HandleType, cx as Handoff, cy as HandoffContext, cz as HandoffCreate, cA as HandoffDeclared, cB as HandoffDetail, cC as HandoffItem, cD as HandoffOutcome, cE as HandoffPackage, cF as HandoffParams, cG as HeartbeatItem, cH as HistoryFilters, cI as HistoryItem, cJ as HistoryItemKind, cK as IdentifyItem, cL as IdentifyParams, cM as IdentityCalibration, cN as Include, cO as Inference, cP as InferenceCorrection, cQ as InferencePage, cR as IngestStatus, cS as InterestState, cT as InterleavingReport, cU as InterleavingRow, cV as InterleavingTotal, cW as InternalText, cX as ItemError, cY as ItemVersion, cZ as KeyIdentity, c_ as LeaseDeclared, c$ as LeaseDetail, d0 as LegalHold, d1 as LegalHoldCreate, d2 as LegalHoldRelease, d3 as LiveTurn, d4 as Lock, d5 as MAX_BATCH_ITEMS, d6 as MAX_EVENT_TEXT, d7 as MAX_MEDIA_BYTES, d8 as MediaUpload, d9 as MediaUploadRequest, da as MediaUploadResponse, db as MemorySeen, dc as NOT_FOUND, dd as Natures, de as Negation, df as NiadraAPIError, dg as NiadraAbortError, dh as NiadraAuthenticationError, di as NiadraConfigError, dj as NiadraConnectionError, dk as NiadraContactTokenError, dl as NiadraPermissionError, dm as NiadraRateLimitError, dn as NiadraReplayRefusedError, dp as NiadraTimeoutError, dq as NiadraValidationError, dr as Notification, ds as NotificationPage, dt as ObjectCoverage, du as ObjectPush, dv as ObjectPushRequest, dw as ObjectPushResponse, dx as ObjectRead, dy as ObjectSnapshotResponse, dz as ObjectTimeline, dA as ObjectTimelineParams, dB as Observation, dC as OpenItemOut, dD as OpenItemRequest, dE as OpenObject, dF as OpenParams, dG as OpenedItem, dH as Origin, dI as OutcomeLink, dJ as OutcomePage, dK as OutcomeRequest, dL as OutcomeState, dM as Owner, dN as OwnershipClaim, dO as OwnershipCount, dP as PERSONAL_DATA_TOOL_ERROR, dQ as PackGuard, dR as PackLayer, dS as PackSection, dT as PackSlot, dU as PackSlotDerived, dV as PackStamp, dW as PowerRequest, dX as PowerResult, dY as Preference, dZ as PrefetchParams, d_ as PrefetchRequest, d$ as Presented, e0 as PresentedItem, e1 as PreviousValue, e2 as Problem, e3 as ProfileMatch, e4 as ProfileMemory, e5 as PromiseRef, e6 as PromoteRequest, e7 as PromoteResponse, e8 as ProposalStatus, e9 as Provenance, ea as QueueOptions, eb as ReadingResult, ec as ReconcileRequest, ed as ReconcileResult, ee as ReconciledLine, ef as RecordedToolOptions, eg as Recurrence, eh as Refetch, ei as RefreshRelease, ej as RefreshReleased, ek as RefreshRequest, el as RefreshRequestPage, em as Refusal, en as ReleaseDetail, eo as RememberParams, ep as RememberResult, eq as Rendered, er as ReplayAssertion, es as ReplayBlocker, et as ReplayCase, eu as ReplayCaseRequest, ev as ReplayHistoryEntry, ew as ReplayResult, ex as RequestOptions, ey as Resolved, ez as Resolver, eA as Result, eB as ResultObjects, eC as ReviewRequest, eD as ReviewRequestCreate, eE as ReviewRequestPage, eF as ReviewResolution, eG as Scenario, eH as ScenarioCreate, eI as ScenarioFromReport, eJ as ScenarioPage, eK as ScenarioRun, eL as ScenarioRunCreate, eM as ScenarioRunSummary, eN as ScenarioUpdate, eO as ScenarioVerdict, eP as SdkProfile, eQ as SearchRequest, eR as SearchResponse, eS as Seen, eT as SeenTokens, eU as ShadowRequest, eV as ShadowRun, eW as Shown, eX as SlotChannelRank, eY as SlotWhy, eZ as SoftConstraint, e_ as SourceCoverage, e$ as Speaker, f0 as SpeakerRef, f1 as StateMode, f2 as StateReadRequest, f3 as StateReadResponse, f4 as StateRef, f5 as StateVerifyRequest, f6 as StateVerifyResponse, f7 as StateView, f8 as StateViewRequest, f9 as StateWrite, fa as Subject, fb as SubjectToken, fc as SubjectTokenRequest, fd as Suppression, fe as SuppressionAdded, ff as SuppressionAddedDetail, fg as SuppressionLifted, fh as SuppressionLiftedDetail, fi as SuppressionPage, fj as SuppressionSalt, fk as TOOL_DEFINITIONS, fl as TOOL_NAMES, fm as TargetModel, fn as Task, fo as TaskAction, fp as TaskEndedItem, fq as TaskEvent, fr as TaskLockDeclared, fs as TaskLockDetail, ft as TaskParams, fu as TimeWindow, fv as TimelineRequest, fw as TimelineResponse, fx as Timeouts, fy as TimerState, fz as Timestamp, fA as Timings, fB as ToolBinding, fC as ToolCapabilities, fD as ToolDefinition, fE as ToolOptions, fF as TrackEvent, fG as TraitOut, fH as TurnAgent, fI as TurnBlob, fJ as TurnBuild, fK as TurnCall, fL as TurnCompilerPins, fM as TurnConstraints, fN as TurnCoordination, fO as TurnCost, fP as TurnEffect, fQ as TurnFlag, fR as TurnFrame, fS as TurnIndexEntry, fT as TurnIndexPage, fU as TurnKind, fV as TurnObservation, fW as TurnOptions, fX as TurnOutput, fY as TurnParams, fZ as TurnProvenance, f_ as TurnRead, f$ as TurnRecord, g0 as TurnRecorder, g1 as TurnRecordingOptions, g2 as TurnRecordingSummary, g3 as TurnSearchRequest, g4 as TurnSearchResponse, g5 as TurnSummary, g6 as TurnTokens, g7 as TurnView, g8 as TurnsRequest, g9 as TurnsResponse, ga as TypeCoverage, gb as TypeFingerprintRequest, gc as TypeFingerprintResponse, gd as UnbackedValue, ge as UnmetDemand, gf as UnmetDemandPage, gg as Unwatch, gh as UploadParams, gi as ValueEvidence, gj as ValueKind, gk as ValueState, gl as Verdict, gm as Verification, gn as VerificationResult, go as VerifyCheck, gp as VerifyItem, gq as VerifyMethod, gr as VerifyParams, gs as View, gt as Visibility, gu as VoiceInfo, gv as VoiceOptions, gw as Watch, gx as WhereExpression, gy as WorkingState, gz as WriteResult, gA as checkBacking, gB as consoleLogger, gC as currentCall, gD as currentTurn, gE as guardStream, gF as guardText, gG as recipientHash, gH as renderLive, gI as renderSuffix, gJ as silentLogger, gK as tool, gL as verifyContactToken, gM as violatesGuard } from './client-DsIxZxZk.cjs';
1
+ import { C as ConstraintsBlock, H as HardConstraint, N as NiadraError, a as ClaimRecord, b as ClaimCategory, I as InternalText, s as shingles, c as Niadra, R as Resolvers, d as ContextResponse, M as Mode, T as TurnPins, e as ContextResult, f as ModelUsage, L as Logger, S as SubjectKind, g as Handle, O as ObjectRef } from './client-B_ip8T2o.cjs';
2
+ export { A as AGENT_MEMORY_TOOL_DEFINITIONS, h as AGENT_MEMORY_TOOL_NAMES, i as ActionEvent, j as ActionInfo, k as Actions, l as Admin, m as AgentMemoryBlock, n as AgentMemoryParams, o as AgentMemoryResult, p as AgentMemorySearchRequest, q as AgentMemorySearchResponse, r as AgentMemorySource, t as AgentNote, u as AgentNoteKind, v as AgentNoteOrigin, w as AgentNoteProposal, x as AgentNoteStatus, y as AgentNoteVisibility, z as AgentSession, B as AgentState, D as AgentStateConflict, E as AgentStateHandle, F as AgentStateMeta, G as AgentStateMetaPage, J as AgentStateReadRequest, K as AgentStateScope, P as AgentStateWrite, Q as AgentStateWriteResult, U as AgentTurnOptions, V as AnchorEvidence, W as Api, X as ArmComparison, Y as ArmOutcomes, Z as AskedAttribute, _ as AssertionMethod, $ as AssertionOutcome, a0 as AssertionStats, a1 as Attribute, a2 as AttributeEntry, a3 as AttributionReport, a4 as AttributionRow, a5 as AttributionTotal, a6 as Backing, a7 as BackingReport, a8 as BackingSources, a9 as BatchItem, aa as BatchRequest, ab as BatchResponse, ac as BiFile, ad as BiUpload, ae as BiUploadRequest, af as BlobError, ag as BlobStore, ah as BlockSubject, ai as BoundArg, aj as BoundTools, ak as BudgetBlock, al as BudgetCut, am as BudgetPack, an as BudgetUse, ao as CacheDirectives, ap as CacheOptions, aq as CallCapture, ar as CaseClosed, as as CaseOpened, at as Change, au as ChangePage, av as ChangeSinceSeen, aw as ChannelState, ax as CheckBatchRequest, ay as CheckBatchResponse, az as CheckOptions, aA as CheckRequest, aB as CheckResult, aC as ClaimCheck, aD as ClaimCheckOptions, aE as ClaimContractSummary, aF as ClaimEvidence, aG as ClaimEvidenceRef, aH as ClaimKind, aI as ClaimOutputs, aJ as ClaimParams, aK as ClaimRelease, aL as ClaimRequest, aM as ClaimValue, aN as ClaimVerdict, aO as ClaimVia, aP as Claimed, aQ as ClientOptions, aR as Closes, aS as Commitment, aT as CommitmentDecided, aU as CommitmentDecidedDetail, aV as CommitmentMade, aW as CommitmentMadeDetail, aX as CommitmentRef, aY as CommitmentWithdrawn, aZ as CommitmentWithdrawnDetail, a_ as CompanyRule, a$ as Conflict, b0 as ConflictCounts, b1 as ConstraintOrigin, b2 as ConstraintsRequest, b3 as ContactBudget, b4 as ContactBudgetUse, b5 as ContactClaims, b6 as ContactCount, b7 as ContactGateway, b8 as ContactKey, b9 as ContactKeys, ba as ContactMade, bb as ContactMadeDetail, bc as ContactTokenParams, bd as ContactTokenRefusal, be as Content, bf as ContentMarker, bg as ContentMode, bh as ContentRelease, bi as ContentReleaseResult, bj as ContentResolver, bk as ContextFormat, bl as ContextOptions, bm as ContextPack, bn as ContextParams, bo as ContextRequest, bp as ContextSource, bq as ContextStamp, br as ContextUseEntry, bs as Conversation, bt as ConversationAction, bu as ConversationEndedItem, bv as ConversationEvent, bw as ConversationParams, bx as CoordinationBlock, by as CoordinationOverview, bz as CoordinationReport, bA as CoordinationReportPage, bB as CorrectParams, bC as CorrectionAction, bD as CorrectionRequest, bE as CounterfactualCase, bF as CounterfactualEngaged, bG as CounterfactualEngagement, bH as CounterfactualRunCreate, bI as CounterfactualRunPage, bJ as CreateAgentNoteRequest, bK as DEFAULT_CACHE, bL as DEFAULT_QUEUE, bM as DEFAULT_TIMEOUTS, bN as DEFAULT_VOICE, bO as DELETE, bP as DataIssue, bQ as DataIssuePage, bR as Declarations, bS as DeclareRequest, bT as DeclareResult, bU as DeliveryPath, bV as DerivedState, bW as Detect, bX as DriftChanges, bY as Effect, bZ as EffectCount, b_ as EffectDeclared, b$ as EffectDetail, c0 as EffectKind, c1 as EffectReserve, c2 as EffectSeen, c3 as EffectSettle, c4 as EffectState, c5 as EffectStatus, c6 as Engaged, c7 as EpisodeOut, c8 as Erasure, c9 as EventItem, ca as EventKind, cb as Evidence, cc as ExperimentReport, cd as ExperimentResult, ce as ExportPackage, cf as FAIL_CLOSED, cg as FactHistory, ch as FactOut, ci as Feature, cj as Feedback, ck as FeedbackAction, cl as FeedbackParams, cm as FeedbackRequest, cn as Fetched, co as FieldCoverage, cp as FieldState, cq as ForgetTarget, cr as GatewayOptions, cs as Guard, ct as GuardLike, cu as GuardOptions, cv as Guarded, cw as HandleType, cx as Handoff, cy as HandoffContext, cz as HandoffCreate, cA as HandoffDeclared, cB as HandoffDetail, cC as HandoffItem, cD as HandoffOutcome, cE as HandoffPackage, cF as HandoffParams, cG as HeartbeatItem, cH as HistoryFilters, cI as HistoryItem, cJ as HistoryItemKind, cK as IdentifyItem, cL as IdentifyParams, cM as IdentityCalibration, cN as Include, cO as Inference, cP as InferenceCorrection, cQ as InferencePage, cR as IngestStatus, cS as InterestState, cT as InterleavingReport, cU as InterleavingRow, cV as InterleavingTotal, cW as InternalText, cX as ItemError, cY as ItemVersion, cZ as KeyIdentity, c_ as LeaseDeclared, c$ as LeaseDetail, d0 as LegalHold, d1 as LegalHoldCreate, d2 as LegalHoldRelease, d3 as LiveTurn, d4 as Lock, d5 as MAX_BATCH_ITEMS, d6 as MAX_EVENT_TEXT, d7 as MAX_MEDIA_BYTES, d8 as MediaUpload, d9 as MediaUploadRequest, da as MediaUploadResponse, db as MemorySeen, dc as NOT_FOUND, dd as Natures, de as Negation, df as NiadraAPIError, dg as NiadraAbortError, dh as NiadraAuthenticationError, di as NiadraConfigError, dj as NiadraConnectionError, dk as NiadraContactTokenError, dl as NiadraPermissionError, dm as NiadraRateLimitError, dn as NiadraReplayRefusedError, dp as NiadraTimeoutError, dq as NiadraValidationError, dr as Notification, ds as NotificationPage, dt as ObjectCoverage, du as ObjectPush, dv as ObjectPushRequest, dw as ObjectPushResponse, dx as ObjectRead, dy as ObjectSnapshotResponse, dz as ObjectTimeline, dA as ObjectTimelineParams, dB as Observation, dC as OpenItemOut, dD as OpenItemRequest, dE as OpenObject, dF as OpenParams, dG as OpenedItem, dH as Origin, dI as OutcomeLink, dJ as OutcomePage, dK as OutcomeRequest, dL as OutcomeState, dM as Owner, dN as OwnershipClaim, dO as OwnershipCount, dP as PERSONAL_DATA_TOOL_ERROR, dQ as PackGuard, dR as PackLayer, dS as PackSection, dT as PackSlot, dU as PackSlotDerived, dV as PackStamp, dW as PowerRequest, dX as PowerResult, dY as Preference, dZ as PrefetchParams, d_ as PrefetchRequest, d$ as Presented, e0 as PresentedItem, e1 as PreviousValue, e2 as Problem, e3 as ProfileMatch, e4 as ProfileMemory, e5 as PromiseRef, e6 as PromoteRequest, e7 as PromoteResponse, e8 as ProposalStatus, e9 as Provenance, ea as QueueOptions, eb as ReadingResult, ec as ReconcileRequest, ed as ReconcileResult, ee as ReconciledLine, ef as RecordedToolOptions, eg as Recurrence, eh as Refetch, ei as RefreshRelease, ej as RefreshReleased, ek as RefreshRequest, el as RefreshRequestPage, em as Refusal, en as ReleaseDetail, eo as RememberParams, ep as RememberResult, eq as Rendered, er as ReplayAssertion, es as ReplayBlocker, et as ReplayCase, eu as ReplayCaseRequest, ev as ReplayHistoryEntry, ew as ReplayResult, ex as RequestOptions, ey as Resolved, ez as Resolver, eA as Result, eB as ResultObjects, eC as ReviewRequest, eD as ReviewRequestCreate, eE as ReviewRequestPage, eF as ReviewResolution, eG as Scenario, eH as ScenarioCreate, eI as ScenarioFromReport, eJ as ScenarioPage, eK as ScenarioRun, eL as ScenarioRunCreate, eM as ScenarioRunSummary, eN as ScenarioUpdate, eO as ScenarioVerdict, eP as SdkProfile, eQ as SearchRequest, eR as SearchResponse, eS as Seen, eT as SeenTokens, eU as ShadowRequest, eV as ShadowRun, eW as Shown, eX as ShownValue, eY as SlotChannelRank, eZ as SlotWhy, e_ as SoftConstraint, e$ as SourceCoverage, f0 as Speaker, f1 as SpeakerRef, f2 as StateMode, f3 as StateReadRequest, f4 as StateReadResponse, f5 as StateRef, f6 as StateVerifyRequest, f7 as StateVerifyResponse, f8 as StateView, f9 as StateViewRequest, fa as StateWrite, fb as Subject, fc as SubjectToken, fd as SubjectTokenRequest, fe as Suppression, ff as SuppressionAdded, fg as SuppressionAddedDetail, fh as SuppressionLifted, fi as SuppressionLiftedDetail, fj as SuppressionPage, fk as SuppressionSalt, fl as TOOL_DEFINITIONS, fm as TOOL_NAMES, fn as TargetModel, fo as Task, fp as TaskAction, fq as TaskEndedItem, fr as TaskEvent, fs as TaskLockDeclared, ft as TaskLockDetail, fu as TaskParams, fv as TimeWindow, fw as TimelineRequest, fx as TimelineResponse, fy as Timeouts, fz as TimerState, fA as Timestamp, fB as Timings, fC as ToolBinding, fD as ToolCapabilities, fE as ToolDefinition, fF as ToolOptions, fG as TrackEvent, fH as TraitOut, fI as TurnAgent, fJ as TurnBlob, fK as TurnBuild, fL as TurnCall, fM as TurnCompilerPins, fN as TurnConstraints, fO as TurnCoordination, fP as TurnCost, fQ as TurnEffect, fR as TurnFlag, fS as TurnFrame, fT as TurnIndexEntry, fU as TurnIndexPage, fV as TurnKind, fW as TurnObservation, fX as TurnOptions, fY as TurnOutput, fZ as TurnParams, f_ as TurnProvenance, f$ as TurnRead, g0 as TurnRecord, g1 as TurnRecorder, g2 as TurnRecordingOptions, g3 as TurnRecordingSummary, g4 as TurnSearchRequest, g5 as TurnSearchResponse, g6 as TurnSummary, g7 as TurnTokens, g8 as TurnView, g9 as TurnsRequest, ga as TurnsResponse, gb as TypeCoverage, gc as TypeFingerprintRequest, gd as TypeFingerprintResponse, ge as UnbackedValue, gf as UnmetDemand, gg as UnmetDemandPage, gh as Unwatch, gi as UploadParams, gj as ValueEvidence, gk as ValueKind, gl as ValueState, gm as Verdict, gn as Verification, go as VerificationResult, gp as VerifyCheck, gq as VerifyItem, gr as VerifyMethod, gs as VerifyParams, gt as View, gu as Visibility, gv as VoiceInfo, gw as VoiceOptions, gx as Watch, gy as WhereExpression, gz as WorkingState, gA as WriteResult, gB as checkBacking, gC as consoleLogger, gD as currentCall, gE as currentTurn, gF as guardStream, gG as guardText, gH as recipientHash, gI as renderLive, gJ as renderSuffix, gK as silentLogger, gL as tool, gM as verifyContactToken, gN as violatesGuard } from './client-B_ip8T2o.cjs';
3
3
 
4
4
  /**
5
5
  * The constraints block rendered for one tool call (`spec/constraints.md`, sections 6 and 7): what the
@@ -991,9 +991,9 @@ declare class Replayer {
991
991
  * only positions and overlaps to `POST /v1/measure/counterfactual-runs`, which answers with the report.
992
992
  *
993
993
  * The records come through the replay case route, so only turns that can be replayed are read. The element is
994
- * `constraints` (the whole block), `hard`, `size` (its attributes) or `exclude`. The binding comes from
995
- * `bindings`, the tool's own `binding` or the SDK profile; a result's objects are read with the binding's
996
- * `results`, or else with the tool's `provenance`. It behaves as the Python SDK's `Counterfactual`.
994
+ * `constraints` (the whole block), `hard`, `size` (its attributes) or `exclude`. The binding is the one the space's
995
+ * `tool-bindings` document gives the tool for this source, from the SDK profile; a result's objects are read with
996
+ * the binding's `results`, or else with the tool's `provenance`. It behaves as the Python SDK's `Counterfactual`.
997
997
  */
998
998
 
999
999
  type Element = "constraints" | "hard" | "size" | "exclude";
@@ -1015,8 +1015,6 @@ interface CounterfactualRun {
1015
1015
  interface CounterfactualOptions {
1016
1016
  /** Reads values kept by pointer; by default the client's content resolver. */
1017
1017
  read?: (pointer: string) => Promise<string>;
1018
- /** A tool's binding, by tool name. */
1019
- bindings?: Readonly<Record<string, RawBinding>>;
1020
1018
  /** Tools that may run again as they are. */
1021
1019
  safe?: readonly string[];
1022
1020
  }
@@ -1195,6 +1193,6 @@ declare function baseURLFromKey(key: ParsedApiKey): string;
1195
1193
  */
1196
1194
  declare function uuidv7(now?: number): string;
1197
1195
 
1198
- declare const VERSION = "0.7.0";
1196
+ declare const VERSION = "0.9.0";
1199
1197
 
1200
1198
  export { ClaimCategory, ClaimRecord, type Binding as ConstraintBinding, type BindingArg as ConstraintBindingArg, type Call$1 as ConstraintCall, type Rendering as ConstraintRendering, ConstraintsBlock, type Honored as ConstraintsHonored, ContextResponse, ContextResult, Counterfactual, type Element as CounterfactualElement, type CounterfactualOptions, type CounterfactualRun, type CounterfactualRunOptions, type ExposureTokenRefusal, Handle, HardConstraint, Logger, type Logic, ModelUsage, Niadra, NiadraDestinationError, NiadraError, NiadraExposureTokenError, ObjectRef, type ParsedApiKey, type ReplayAgent, type ReplayInput, Mode as ReplayMode, type RunOptions as ReplayOptions, type ReplayRun, Replayer, ResolverWorker, Resolvers, type SessionSource, SubjectKind, TurnPins, VERSION, type WrapSession, baseURLFromKey, canonicalDestination, canonicalJson, index as claims, exposureToken, expr, handles, honored as honoredConstraints, injectContext, derive$1 as introspect, jsonDigest, modelUsage, overlapAtK, parseApiKey, parseExposureToken, pinDifferences, providerOf, render as renderConstraints, satisfies as satisfiesConstraint, suppressionKey, toObjectRef, tokenCounts, useAsyncLocalStorage, uuidv7, wrap };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ConstraintsBlock, H as HardConstraint, N as NiadraError, a as ClaimRecord, b as ClaimCategory, I as InternalText, s as shingles, c as Niadra, R as Resolvers, d as ContextResponse, M as Mode, T as TurnPins, e as RawBinding, f as ContextResult, g as ModelUsage, L as Logger, S as SubjectKind, h as Handle, O as ObjectRef } from './client-DsIxZxZk.js';
2
- export { A as AGENT_MEMORY_TOOL_DEFINITIONS, i as AGENT_MEMORY_TOOL_NAMES, j as ActionEvent, k as ActionInfo, l as Actions, m as Admin, n as AgentMemoryBlock, o as AgentMemoryParams, p as AgentMemoryResult, q as AgentMemorySearchRequest, r as AgentMemorySearchResponse, t as AgentMemorySource, u as AgentNote, v as AgentNoteKind, w as AgentNoteOrigin, x as AgentNoteProposal, y as AgentNoteStatus, z as AgentNoteVisibility, B as AgentSession, D as AgentState, E as AgentStateConflict, F as AgentStateHandle, G as AgentStateMeta, J as AgentStateMetaPage, K as AgentStateReadRequest, P as AgentStateScope, Q as AgentStateWrite, U as AgentStateWriteResult, V as AgentTurnOptions, W as AnchorEvidence, X as Api, Y as ArmComparison, Z as ArmOutcomes, _ as AskedAttribute, $ as AssertionMethod, a0 as AssertionOutcome, a1 as AssertionStats, a2 as Attribute, a3 as AttributeEntry, a4 as AttributionReport, a5 as AttributionRow, a6 as AttributionTotal, a7 as Backing, a8 as BackingReport, a9 as BackingSources, aa as BatchItem, ab as BatchRequest, ac as BatchResponse, ad as BiFile, ae as BiUpload, af as BiUploadRequest, ag as BlobError, ah as BlobStore, ai as BlockSubject, aj as BoundArg, ak as BoundTools, al as BudgetBlock, am as BudgetCut, an as BudgetPack, ao as BudgetUse, ap as CacheDirectives, aq as CacheOptions, ar as CallCapture, as as CaseClosed, at as CaseOpened, au as Change, av as ChangePage, aw as ChangeSinceSeen, ax as ChannelState, ay as CheckBatchRequest, az as CheckBatchResponse, aA as CheckOptions, aB as CheckRequest, aC as CheckResult, aD as ClaimCheck, aE as ClaimCheckOptions, aF as ClaimContractSummary, aG as ClaimEvidence, aH as ClaimEvidenceRef, aI as ClaimKind, aJ as ClaimOutputs, aK as ClaimParams, aL as ClaimRelease, aM as ClaimRequest, aN as ClaimValue, aO as ClaimVerdict, aP as ClaimVia, aQ as Claimed, aR as ClientOptions, aS as Closes, aT as Commitment, aU as CommitmentDecided, aV as CommitmentDecidedDetail, aW as CommitmentMade, aX as CommitmentMadeDetail, aY as CommitmentRef, aZ as CommitmentWithdrawn, a_ as CommitmentWithdrawnDetail, a$ as CompanyRule, b0 as Conflict, b1 as ConflictCounts, b2 as ConstraintOrigin, b3 as ConstraintsRequest, b4 as ContactBudget, b5 as ContactBudgetUse, b6 as ContactClaims, b7 as ContactCount, b8 as ContactGateway, b9 as ContactKey, ba as ContactKeys, bb as ContactMade, bc as ContactMadeDetail, bd as ContactTokenParams, be as ContactTokenRefusal, bf as Content, bg as ContentMarker, bh as ContentMode, bi as ContentRelease, bj as ContentReleaseResult, bk as ContentResolver, bl as ContextFormat, bm as ContextOptions, bn as ContextPack, bo as ContextParams, bp as ContextRequest, bq as ContextSource, br as ContextStamp, bs as ContextUseEntry, bt as Conversation, bu as ConversationAction, bv as ConversationEndedItem, bw as ConversationEvent, bx as ConversationParams, by as CoordinationBlock, bz as CoordinationOverview, bA as CoordinationReport, bB as CoordinationReportPage, bC as CorrectParams, bD as CorrectionAction, bE as CorrectionRequest, bF as CounterfactualCase, bG as CounterfactualEngaged, bH as CounterfactualEngagement, bI as CounterfactualRunCreate, bJ as CounterfactualRunPage, bK as CreateAgentNoteRequest, bL as DEFAULT_CACHE, bM as DEFAULT_QUEUE, bN as DEFAULT_TIMEOUTS, bO as DEFAULT_VOICE, bP as DELETE, bQ as DataIssue, bR as DataIssuePage, bS as Declarations, bT as DeclareRequest, bU as DeclareResult, bV as DeliveryPath, bW as Detect, bX as DriftChanges, bY as Effect, bZ as EffectCount, b_ as EffectDeclared, b$ as EffectDetail, c0 as EffectKind, c1 as EffectReserve, c2 as EffectSeen, c3 as EffectSettle, c4 as EffectState, c5 as EffectStatus, c6 as Engaged, c7 as EpisodeOut, c8 as Erasure, c9 as EventItem, ca as EventKind, cb as Evidence, cc as ExperimentReport, cd as ExperimentResult, ce as ExportPackage, cf as FAIL_CLOSED, cg as FactHistory, ch as FactOut, ci as Feature, cj as Feedback, ck as FeedbackAction, cl as FeedbackParams, cm as FeedbackRequest, cn as Fetched, co as FieldCoverage, cp as FieldState, cq as ForgetTarget, cr as GatewayOptions, cs as Guard, ct as GuardLike, cu as GuardOptions, cv as Guarded, cw as HandleType, cx as Handoff, cy as HandoffContext, cz as HandoffCreate, cA as HandoffDeclared, cB as HandoffDetail, cC as HandoffItem, cD as HandoffOutcome, cE as HandoffPackage, cF as HandoffParams, cG as HeartbeatItem, cH as HistoryFilters, cI as HistoryItem, cJ as HistoryItemKind, cK as IdentifyItem, cL as IdentifyParams, cM as IdentityCalibration, cN as Include, cO as Inference, cP as InferenceCorrection, cQ as InferencePage, cR as IngestStatus, cS as InterestState, cT as InterleavingReport, cU as InterleavingRow, cV as InterleavingTotal, cW as InternalText, cX as ItemError, cY as ItemVersion, cZ as KeyIdentity, c_ as LeaseDeclared, c$ as LeaseDetail, d0 as LegalHold, d1 as LegalHoldCreate, d2 as LegalHoldRelease, d3 as LiveTurn, d4 as Lock, d5 as MAX_BATCH_ITEMS, d6 as MAX_EVENT_TEXT, d7 as MAX_MEDIA_BYTES, d8 as MediaUpload, d9 as MediaUploadRequest, da as MediaUploadResponse, db as MemorySeen, dc as NOT_FOUND, dd as Natures, de as Negation, df as NiadraAPIError, dg as NiadraAbortError, dh as NiadraAuthenticationError, di as NiadraConfigError, dj as NiadraConnectionError, dk as NiadraContactTokenError, dl as NiadraPermissionError, dm as NiadraRateLimitError, dn as NiadraReplayRefusedError, dp as NiadraTimeoutError, dq as NiadraValidationError, dr as Notification, ds as NotificationPage, dt as ObjectCoverage, du as ObjectPush, dv as ObjectPushRequest, dw as ObjectPushResponse, dx as ObjectRead, dy as ObjectSnapshotResponse, dz as ObjectTimeline, dA as ObjectTimelineParams, dB as Observation, dC as OpenItemOut, dD as OpenItemRequest, dE as OpenObject, dF as OpenParams, dG as OpenedItem, dH as Origin, dI as OutcomeLink, dJ as OutcomePage, dK as OutcomeRequest, dL as OutcomeState, dM as Owner, dN as OwnershipClaim, dO as OwnershipCount, dP as PERSONAL_DATA_TOOL_ERROR, dQ as PackGuard, dR as PackLayer, dS as PackSection, dT as PackSlot, dU as PackSlotDerived, dV as PackStamp, dW as PowerRequest, dX as PowerResult, dY as Preference, dZ as PrefetchParams, d_ as PrefetchRequest, d$ as Presented, e0 as PresentedItem, e1 as PreviousValue, e2 as Problem, e3 as ProfileMatch, e4 as ProfileMemory, e5 as PromiseRef, e6 as PromoteRequest, e7 as PromoteResponse, e8 as ProposalStatus, e9 as Provenance, ea as QueueOptions, eb as ReadingResult, ec as ReconcileRequest, ed as ReconcileResult, ee as ReconciledLine, ef as RecordedToolOptions, eg as Recurrence, eh as Refetch, ei as RefreshRelease, ej as RefreshReleased, ek as RefreshRequest, el as RefreshRequestPage, em as Refusal, en as ReleaseDetail, eo as RememberParams, ep as RememberResult, eq as Rendered, er as ReplayAssertion, es as ReplayBlocker, et as ReplayCase, eu as ReplayCaseRequest, ev as ReplayHistoryEntry, ew as ReplayResult, ex as RequestOptions, ey as Resolved, ez as Resolver, eA as Result, eB as ResultObjects, eC as ReviewRequest, eD as ReviewRequestCreate, eE as ReviewRequestPage, eF as ReviewResolution, eG as Scenario, eH as ScenarioCreate, eI as ScenarioFromReport, eJ as ScenarioPage, eK as ScenarioRun, eL as ScenarioRunCreate, eM as ScenarioRunSummary, eN as ScenarioUpdate, eO as ScenarioVerdict, eP as SdkProfile, eQ as SearchRequest, eR as SearchResponse, eS as Seen, eT as SeenTokens, eU as ShadowRequest, eV as ShadowRun, eW as Shown, eX as SlotChannelRank, eY as SlotWhy, eZ as SoftConstraint, e_ as SourceCoverage, e$ as Speaker, f0 as SpeakerRef, f1 as StateMode, f2 as StateReadRequest, f3 as StateReadResponse, f4 as StateRef, f5 as StateVerifyRequest, f6 as StateVerifyResponse, f7 as StateView, f8 as StateViewRequest, f9 as StateWrite, fa as Subject, fb as SubjectToken, fc as SubjectTokenRequest, fd as Suppression, fe as SuppressionAdded, ff as SuppressionAddedDetail, fg as SuppressionLifted, fh as SuppressionLiftedDetail, fi as SuppressionPage, fj as SuppressionSalt, fk as TOOL_DEFINITIONS, fl as TOOL_NAMES, fm as TargetModel, fn as Task, fo as TaskAction, fp as TaskEndedItem, fq as TaskEvent, fr as TaskLockDeclared, fs as TaskLockDetail, ft as TaskParams, fu as TimeWindow, fv as TimelineRequest, fw as TimelineResponse, fx as Timeouts, fy as TimerState, fz as Timestamp, fA as Timings, fB as ToolBinding, fC as ToolCapabilities, fD as ToolDefinition, fE as ToolOptions, fF as TrackEvent, fG as TraitOut, fH as TurnAgent, fI as TurnBlob, fJ as TurnBuild, fK as TurnCall, fL as TurnCompilerPins, fM as TurnConstraints, fN as TurnCoordination, fO as TurnCost, fP as TurnEffect, fQ as TurnFlag, fR as TurnFrame, fS as TurnIndexEntry, fT as TurnIndexPage, fU as TurnKind, fV as TurnObservation, fW as TurnOptions, fX as TurnOutput, fY as TurnParams, fZ as TurnProvenance, f_ as TurnRead, f$ as TurnRecord, g0 as TurnRecorder, g1 as TurnRecordingOptions, g2 as TurnRecordingSummary, g3 as TurnSearchRequest, g4 as TurnSearchResponse, g5 as TurnSummary, g6 as TurnTokens, g7 as TurnView, g8 as TurnsRequest, g9 as TurnsResponse, ga as TypeCoverage, gb as TypeFingerprintRequest, gc as TypeFingerprintResponse, gd as UnbackedValue, ge as UnmetDemand, gf as UnmetDemandPage, gg as Unwatch, gh as UploadParams, gi as ValueEvidence, gj as ValueKind, gk as ValueState, gl as Verdict, gm as Verification, gn as VerificationResult, go as VerifyCheck, gp as VerifyItem, gq as VerifyMethod, gr as VerifyParams, gs as View, gt as Visibility, gu as VoiceInfo, gv as VoiceOptions, gw as Watch, gx as WhereExpression, gy as WorkingState, gz as WriteResult, gA as checkBacking, gB as consoleLogger, gC as currentCall, gD as currentTurn, gE as guardStream, gF as guardText, gG as recipientHash, gH as renderLive, gI as renderSuffix, gJ as silentLogger, gK as tool, gL as verifyContactToken, gM as violatesGuard } from './client-DsIxZxZk.js';
1
+ import { C as ConstraintsBlock, H as HardConstraint, N as NiadraError, a as ClaimRecord, b as ClaimCategory, I as InternalText, s as shingles, c as Niadra, R as Resolvers, d as ContextResponse, M as Mode, T as TurnPins, e as ContextResult, f as ModelUsage, L as Logger, S as SubjectKind, g as Handle, O as ObjectRef } from './client-B_ip8T2o.js';
2
+ export { A as AGENT_MEMORY_TOOL_DEFINITIONS, h as AGENT_MEMORY_TOOL_NAMES, i as ActionEvent, j as ActionInfo, k as Actions, l as Admin, m as AgentMemoryBlock, n as AgentMemoryParams, o as AgentMemoryResult, p as AgentMemorySearchRequest, q as AgentMemorySearchResponse, r as AgentMemorySource, t as AgentNote, u as AgentNoteKind, v as AgentNoteOrigin, w as AgentNoteProposal, x as AgentNoteStatus, y as AgentNoteVisibility, z as AgentSession, B as AgentState, D as AgentStateConflict, E as AgentStateHandle, F as AgentStateMeta, G as AgentStateMetaPage, J as AgentStateReadRequest, K as AgentStateScope, P as AgentStateWrite, Q as AgentStateWriteResult, U as AgentTurnOptions, V as AnchorEvidence, W as Api, X as ArmComparison, Y as ArmOutcomes, Z as AskedAttribute, _ as AssertionMethod, $ as AssertionOutcome, a0 as AssertionStats, a1 as Attribute, a2 as AttributeEntry, a3 as AttributionReport, a4 as AttributionRow, a5 as AttributionTotal, a6 as Backing, a7 as BackingReport, a8 as BackingSources, a9 as BatchItem, aa as BatchRequest, ab as BatchResponse, ac as BiFile, ad as BiUpload, ae as BiUploadRequest, af as BlobError, ag as BlobStore, ah as BlockSubject, ai as BoundArg, aj as BoundTools, ak as BudgetBlock, al as BudgetCut, am as BudgetPack, an as BudgetUse, ao as CacheDirectives, ap as CacheOptions, aq as CallCapture, ar as CaseClosed, as as CaseOpened, at as Change, au as ChangePage, av as ChangeSinceSeen, aw as ChannelState, ax as CheckBatchRequest, ay as CheckBatchResponse, az as CheckOptions, aA as CheckRequest, aB as CheckResult, aC as ClaimCheck, aD as ClaimCheckOptions, aE as ClaimContractSummary, aF as ClaimEvidence, aG as ClaimEvidenceRef, aH as ClaimKind, aI as ClaimOutputs, aJ as ClaimParams, aK as ClaimRelease, aL as ClaimRequest, aM as ClaimValue, aN as ClaimVerdict, aO as ClaimVia, aP as Claimed, aQ as ClientOptions, aR as Closes, aS as Commitment, aT as CommitmentDecided, aU as CommitmentDecidedDetail, aV as CommitmentMade, aW as CommitmentMadeDetail, aX as CommitmentRef, aY as CommitmentWithdrawn, aZ as CommitmentWithdrawnDetail, a_ as CompanyRule, a$ as Conflict, b0 as ConflictCounts, b1 as ConstraintOrigin, b2 as ConstraintsRequest, b3 as ContactBudget, b4 as ContactBudgetUse, b5 as ContactClaims, b6 as ContactCount, b7 as ContactGateway, b8 as ContactKey, b9 as ContactKeys, ba as ContactMade, bb as ContactMadeDetail, bc as ContactTokenParams, bd as ContactTokenRefusal, be as Content, bf as ContentMarker, bg as ContentMode, bh as ContentRelease, bi as ContentReleaseResult, bj as ContentResolver, bk as ContextFormat, bl as ContextOptions, bm as ContextPack, bn as ContextParams, bo as ContextRequest, bp as ContextSource, bq as ContextStamp, br as ContextUseEntry, bs as Conversation, bt as ConversationAction, bu as ConversationEndedItem, bv as ConversationEvent, bw as ConversationParams, bx as CoordinationBlock, by as CoordinationOverview, bz as CoordinationReport, bA as CoordinationReportPage, bB as CorrectParams, bC as CorrectionAction, bD as CorrectionRequest, bE as CounterfactualCase, bF as CounterfactualEngaged, bG as CounterfactualEngagement, bH as CounterfactualRunCreate, bI as CounterfactualRunPage, bJ as CreateAgentNoteRequest, bK as DEFAULT_CACHE, bL as DEFAULT_QUEUE, bM as DEFAULT_TIMEOUTS, bN as DEFAULT_VOICE, bO as DELETE, bP as DataIssue, bQ as DataIssuePage, bR as Declarations, bS as DeclareRequest, bT as DeclareResult, bU as DeliveryPath, bV as DerivedState, bW as Detect, bX as DriftChanges, bY as Effect, bZ as EffectCount, b_ as EffectDeclared, b$ as EffectDetail, c0 as EffectKind, c1 as EffectReserve, c2 as EffectSeen, c3 as EffectSettle, c4 as EffectState, c5 as EffectStatus, c6 as Engaged, c7 as EpisodeOut, c8 as Erasure, c9 as EventItem, ca as EventKind, cb as Evidence, cc as ExperimentReport, cd as ExperimentResult, ce as ExportPackage, cf as FAIL_CLOSED, cg as FactHistory, ch as FactOut, ci as Feature, cj as Feedback, ck as FeedbackAction, cl as FeedbackParams, cm as FeedbackRequest, cn as Fetched, co as FieldCoverage, cp as FieldState, cq as ForgetTarget, cr as GatewayOptions, cs as Guard, ct as GuardLike, cu as GuardOptions, cv as Guarded, cw as HandleType, cx as Handoff, cy as HandoffContext, cz as HandoffCreate, cA as HandoffDeclared, cB as HandoffDetail, cC as HandoffItem, cD as HandoffOutcome, cE as HandoffPackage, cF as HandoffParams, cG as HeartbeatItem, cH as HistoryFilters, cI as HistoryItem, cJ as HistoryItemKind, cK as IdentifyItem, cL as IdentifyParams, cM as IdentityCalibration, cN as Include, cO as Inference, cP as InferenceCorrection, cQ as InferencePage, cR as IngestStatus, cS as InterestState, cT as InterleavingReport, cU as InterleavingRow, cV as InterleavingTotal, cW as InternalText, cX as ItemError, cY as ItemVersion, cZ as KeyIdentity, c_ as LeaseDeclared, c$ as LeaseDetail, d0 as LegalHold, d1 as LegalHoldCreate, d2 as LegalHoldRelease, d3 as LiveTurn, d4 as Lock, d5 as MAX_BATCH_ITEMS, d6 as MAX_EVENT_TEXT, d7 as MAX_MEDIA_BYTES, d8 as MediaUpload, d9 as MediaUploadRequest, da as MediaUploadResponse, db as MemorySeen, dc as NOT_FOUND, dd as Natures, de as Negation, df as NiadraAPIError, dg as NiadraAbortError, dh as NiadraAuthenticationError, di as NiadraConfigError, dj as NiadraConnectionError, dk as NiadraContactTokenError, dl as NiadraPermissionError, dm as NiadraRateLimitError, dn as NiadraReplayRefusedError, dp as NiadraTimeoutError, dq as NiadraValidationError, dr as Notification, ds as NotificationPage, dt as ObjectCoverage, du as ObjectPush, dv as ObjectPushRequest, dw as ObjectPushResponse, dx as ObjectRead, dy as ObjectSnapshotResponse, dz as ObjectTimeline, dA as ObjectTimelineParams, dB as Observation, dC as OpenItemOut, dD as OpenItemRequest, dE as OpenObject, dF as OpenParams, dG as OpenedItem, dH as Origin, dI as OutcomeLink, dJ as OutcomePage, dK as OutcomeRequest, dL as OutcomeState, dM as Owner, dN as OwnershipClaim, dO as OwnershipCount, dP as PERSONAL_DATA_TOOL_ERROR, dQ as PackGuard, dR as PackLayer, dS as PackSection, dT as PackSlot, dU as PackSlotDerived, dV as PackStamp, dW as PowerRequest, dX as PowerResult, dY as Preference, dZ as PrefetchParams, d_ as PrefetchRequest, d$ as Presented, e0 as PresentedItem, e1 as PreviousValue, e2 as Problem, e3 as ProfileMatch, e4 as ProfileMemory, e5 as PromiseRef, e6 as PromoteRequest, e7 as PromoteResponse, e8 as ProposalStatus, e9 as Provenance, ea as QueueOptions, eb as ReadingResult, ec as ReconcileRequest, ed as ReconcileResult, ee as ReconciledLine, ef as RecordedToolOptions, eg as Recurrence, eh as Refetch, ei as RefreshRelease, ej as RefreshReleased, ek as RefreshRequest, el as RefreshRequestPage, em as Refusal, en as ReleaseDetail, eo as RememberParams, ep as RememberResult, eq as Rendered, er as ReplayAssertion, es as ReplayBlocker, et as ReplayCase, eu as ReplayCaseRequest, ev as ReplayHistoryEntry, ew as ReplayResult, ex as RequestOptions, ey as Resolved, ez as Resolver, eA as Result, eB as ResultObjects, eC as ReviewRequest, eD as ReviewRequestCreate, eE as ReviewRequestPage, eF as ReviewResolution, eG as Scenario, eH as ScenarioCreate, eI as ScenarioFromReport, eJ as ScenarioPage, eK as ScenarioRun, eL as ScenarioRunCreate, eM as ScenarioRunSummary, eN as ScenarioUpdate, eO as ScenarioVerdict, eP as SdkProfile, eQ as SearchRequest, eR as SearchResponse, eS as Seen, eT as SeenTokens, eU as ShadowRequest, eV as ShadowRun, eW as Shown, eX as ShownValue, eY as SlotChannelRank, eZ as SlotWhy, e_ as SoftConstraint, e$ as SourceCoverage, f0 as Speaker, f1 as SpeakerRef, f2 as StateMode, f3 as StateReadRequest, f4 as StateReadResponse, f5 as StateRef, f6 as StateVerifyRequest, f7 as StateVerifyResponse, f8 as StateView, f9 as StateViewRequest, fa as StateWrite, fb as Subject, fc as SubjectToken, fd as SubjectTokenRequest, fe as Suppression, ff as SuppressionAdded, fg as SuppressionAddedDetail, fh as SuppressionLifted, fi as SuppressionLiftedDetail, fj as SuppressionPage, fk as SuppressionSalt, fl as TOOL_DEFINITIONS, fm as TOOL_NAMES, fn as TargetModel, fo as Task, fp as TaskAction, fq as TaskEndedItem, fr as TaskEvent, fs as TaskLockDeclared, ft as TaskLockDetail, fu as TaskParams, fv as TimeWindow, fw as TimelineRequest, fx as TimelineResponse, fy as Timeouts, fz as TimerState, fA as Timestamp, fB as Timings, fC as ToolBinding, fD as ToolCapabilities, fE as ToolDefinition, fF as ToolOptions, fG as TrackEvent, fH as TraitOut, fI as TurnAgent, fJ as TurnBlob, fK as TurnBuild, fL as TurnCall, fM as TurnCompilerPins, fN as TurnConstraints, fO as TurnCoordination, fP as TurnCost, fQ as TurnEffect, fR as TurnFlag, fS as TurnFrame, fT as TurnIndexEntry, fU as TurnIndexPage, fV as TurnKind, fW as TurnObservation, fX as TurnOptions, fY as TurnOutput, fZ as TurnParams, f_ as TurnProvenance, f$ as TurnRead, g0 as TurnRecord, g1 as TurnRecorder, g2 as TurnRecordingOptions, g3 as TurnRecordingSummary, g4 as TurnSearchRequest, g5 as TurnSearchResponse, g6 as TurnSummary, g7 as TurnTokens, g8 as TurnView, g9 as TurnsRequest, ga as TurnsResponse, gb as TypeCoverage, gc as TypeFingerprintRequest, gd as TypeFingerprintResponse, ge as UnbackedValue, gf as UnmetDemand, gg as UnmetDemandPage, gh as Unwatch, gi as UploadParams, gj as ValueEvidence, gk as ValueKind, gl as ValueState, gm as Verdict, gn as Verification, go as VerificationResult, gp as VerifyCheck, gq as VerifyItem, gr as VerifyMethod, gs as VerifyParams, gt as View, gu as Visibility, gv as VoiceInfo, gw as VoiceOptions, gx as Watch, gy as WhereExpression, gz as WorkingState, gA as WriteResult, gB as checkBacking, gC as consoleLogger, gD as currentCall, gE as currentTurn, gF as guardStream, gG as guardText, gH as recipientHash, gI as renderLive, gJ as renderSuffix, gK as silentLogger, gL as tool, gM as verifyContactToken, gN as violatesGuard } from './client-B_ip8T2o.js';
3
3
 
4
4
  /**
5
5
  * The constraints block rendered for one tool call (`spec/constraints.md`, sections 6 and 7): what the
@@ -991,9 +991,9 @@ declare class Replayer {
991
991
  * only positions and overlaps to `POST /v1/measure/counterfactual-runs`, which answers with the report.
992
992
  *
993
993
  * The records come through the replay case route, so only turns that can be replayed are read. The element is
994
- * `constraints` (the whole block), `hard`, `size` (its attributes) or `exclude`. The binding comes from
995
- * `bindings`, the tool's own `binding` or the SDK profile; a result's objects are read with the binding's
996
- * `results`, or else with the tool's `provenance`. It behaves as the Python SDK's `Counterfactual`.
994
+ * `constraints` (the whole block), `hard`, `size` (its attributes) or `exclude`. The binding is the one the space's
995
+ * `tool-bindings` document gives the tool for this source, from the SDK profile; a result's objects are read with
996
+ * the binding's `results`, or else with the tool's `provenance`. It behaves as the Python SDK's `Counterfactual`.
997
997
  */
998
998
 
999
999
  type Element = "constraints" | "hard" | "size" | "exclude";
@@ -1015,8 +1015,6 @@ interface CounterfactualRun {
1015
1015
  interface CounterfactualOptions {
1016
1016
  /** Reads values kept by pointer; by default the client's content resolver. */
1017
1017
  read?: (pointer: string) => Promise<string>;
1018
- /** A tool's binding, by tool name. */
1019
- bindings?: Readonly<Record<string, RawBinding>>;
1020
1018
  /** Tools that may run again as they are. */
1021
1019
  safe?: readonly string[];
1022
1020
  }
@@ -1195,6 +1193,6 @@ declare function baseURLFromKey(key: ParsedApiKey): string;
1195
1193
  */
1196
1194
  declare function uuidv7(now?: number): string;
1197
1195
 
1198
- declare const VERSION = "0.7.0";
1196
+ declare const VERSION = "0.9.0";
1199
1197
 
1200
1198
  export { ClaimCategory, ClaimRecord, type Binding as ConstraintBinding, type BindingArg as ConstraintBindingArg, type Call$1 as ConstraintCall, type Rendering as ConstraintRendering, ConstraintsBlock, type Honored as ConstraintsHonored, ContextResponse, ContextResult, Counterfactual, type Element as CounterfactualElement, type CounterfactualOptions, type CounterfactualRun, type CounterfactualRunOptions, type ExposureTokenRefusal, Handle, HardConstraint, Logger, type Logic, ModelUsage, Niadra, NiadraDestinationError, NiadraError, NiadraExposureTokenError, ObjectRef, type ParsedApiKey, type ReplayAgent, type ReplayInput, Mode as ReplayMode, type RunOptions as ReplayOptions, type ReplayRun, Replayer, ResolverWorker, Resolvers, type SessionSource, SubjectKind, TurnPins, VERSION, type WrapSession, baseURLFromKey, canonicalDestination, canonicalJson, index as claims, exposureToken, expr, handles, honored as honoredConstraints, injectContext, derive$1 as introspect, jsonDigest, modelUsage, overlapAtK, parseApiKey, parseExposureToken, pinDifferences, providerOf, render as renderConstraints, satisfies as satisfiesConstraint, suppressionKey, toObjectRef, tokenCounts, useAsyncLocalStorage, uuidv7, wrap };
package/dist/index.js CHANGED
@@ -516,7 +516,7 @@ function internalRecord(span, ref, act) {
516
516
  }
517
517
 
518
518
  // src/version.ts
519
- var VERSION = "0.7.0";
519
+ var VERSION = "0.9.0";
520
520
 
521
521
  // src/transport.ts
522
522
  var RETRYABLE_WRITE_STATUS = /* @__PURE__ */ new Set([408, 421, 429, 500, 502, 503, 504]);
@@ -2902,6 +2902,11 @@ ${change.field}`)) out.push({ ref, field: change.field, value: change.now, claim
2902
2902
  for (const s of constraints.soft ?? []) said.push([s.attr, s.value]);
2903
2903
  for (const a of constraints.attributes ?? []) said.push([a.name, a.value]);
2904
2904
  for (const [attr, value] of said) out.push({ ref: null, field: attr.split(".").pop() ?? attr, value, claimSafe: true });
2905
+ for (const shown of constraints.already_presented ?? []) {
2906
+ for (const [field, n] of Object.entries(shown.values ?? {})) {
2907
+ out.push({ ref: shown.ref, field, value: n.v, claimSafe: n.claim_safe, role: n.role ?? null });
2908
+ }
2909
+ }
2905
2910
  }
2906
2911
  return out;
2907
2912
  }
@@ -3268,7 +3273,7 @@ function thenable(value) {
3268
3273
  function tool(name, fn, options = {}) {
3269
3274
  const isAsync = isAsyncFunction(fn);
3270
3275
  function bindingOf(frame) {
3271
- return options.binding ?? (options.served ?? frame?.profile.bindings)?.(name) ?? null;
3276
+ return (options.served ?? frame?.profile.bindings)?.(name) ?? null;
3272
3277
  }
3273
3278
  function masks(frame) {
3274
3279
  return options.maskOutput ?? bindingOf(frame)?.capabilities?.mask_output ?? false;
@@ -3383,8 +3388,7 @@ function tool(name, fn, options = {}) {
3383
3388
  const marker = {
3384
3389
  name,
3385
3390
  dryRun: options.dryRun ?? false,
3386
- provenance: options.provenance ?? null,
3387
- binding: options.binding ?? null
3391
+ provenance: options.provenance ?? null
3388
3392
  };
3389
3393
  Object.defineProperty(wrapped, RECORDED, { value: marker });
3390
3394
  return wrapped;
@@ -3646,6 +3650,7 @@ function claimsOf(frame, claims, logger) {
3646
3650
 
3647
3651
  // src/queue.ts
3648
3652
  var HEARTBEAT_WINDOW_MS = 6e4;
3653
+ var MAX_PAUSE_MS = 6e4;
3649
3654
  var EventQueue = class {
3650
3655
  constructor(send, options, logger, now = Date.now) {
3651
3656
  this.send = send;
@@ -3666,6 +3671,8 @@ var EventQueue = class {
3666
3671
  droppedSinceWarning = 0;
3667
3672
  windowStart;
3668
3673
  sentInWindow = 0;
3674
+ pauseMs = 0;
3675
+ resumeAt = 0;
3669
3676
  /** Items waiting to be sent, not counting a batch already in flight. */
3670
3677
  get size() {
3671
3678
  return this.items.length;
@@ -3701,10 +3708,16 @@ var EventQueue = class {
3701
3708
  return run;
3702
3709
  }
3703
3710
  /**
3704
- * Starts a flush without waiting for it. Item failures are logged and settled inside the
3705
- * drain, so only an unexpected error reaches this catch.
3711
+ * Starts a flush without waiting for it: once the pause after a failed batch ends, or at once with
3712
+ * `now` (a caller waits for an item). Item failures are logged and settled inside the drain, so only
3713
+ * an unexpected error reaches this catch.
3706
3714
  */
3707
- flushInBackground() {
3715
+ flushInBackground(now = false) {
3716
+ const paused = this.resumeAt - this.now();
3717
+ if (!now && paused > 0) {
3718
+ this.schedule(paused);
3719
+ return;
3720
+ }
3708
3721
  this.flush().catch((error) => {
3709
3722
  this.logger.error(`event flush failed: ${toNiadraError(error).message}`);
3710
3723
  });
@@ -3721,24 +3734,36 @@ var EventQueue = class {
3721
3734
  while (this.items.length > 0) {
3722
3735
  const batch = this.items.splice(0, this.options.maxBatchSize);
3723
3736
  const heartbeat = this.heartbeat();
3724
- const wire = batch.map((pending) => pending.item);
3725
- if (heartbeat) wire.push(heartbeat);
3726
- await this.sendBatch(batch, wire, report);
3737
+ if (heartbeat) batch.push({ item: heartbeat });
3738
+ if (!await this.sendBatch(batch, report)) break;
3727
3739
  }
3728
3740
  return report;
3729
3741
  }
3730
- async sendBatch(batch, wire, report) {
3742
+ /** Sends one batch; `false` when it went back to the queue and the queue pauses. */
3743
+ async sendBatch(batch, report) {
3744
+ const wire = batch.map((pending) => pending.item);
3731
3745
  let response;
3732
3746
  try {
3733
3747
  response = await this.send(wire);
3734
3748
  } catch (error) {
3735
3749
  const failure = toNiadraError(error);
3736
- report.failed += batch.length;
3737
3750
  report.errors.push(failure);
3738
- this.logger.warn(`dropped ${batch.length} events after retries: ${failure.message}`);
3751
+ if (isTransient(failure)) {
3752
+ for (const pending of batch) pending.settle?.(failure);
3753
+ this.requeue(batch);
3754
+ this.pauseMs = Math.min(MAX_PAUSE_MS, Math.max(this.options.flushIntervalMs, this.pauseMs * 2));
3755
+ this.resumeAt = this.now() + this.pauseMs;
3756
+ this.logger.warn(`could not deliver ${batch.length} events, will retry: ${failure.message}`);
3757
+ this.schedule(this.pauseMs);
3758
+ return false;
3759
+ }
3760
+ report.failed += batch.length;
3761
+ this.logger.warn(`dropped ${batch.length} events refused by the API: ${failure.message}`);
3739
3762
  for (const pending of batch) pending.settle?.(failure);
3740
- return;
3763
+ return true;
3741
3764
  }
3765
+ this.pauseMs = 0;
3766
+ this.resumeAt = 0;
3742
3767
  const rejected = /* @__PURE__ */ new Map();
3743
3768
  for (const itemError of response.errors) {
3744
3769
  const detail = itemError.detail ? `: ${itemError.detail}` : "";
@@ -3749,6 +3774,7 @@ var EventQueue = class {
3749
3774
  this.logger.warn(`server rejected ${rejected.size} of ${wire.length} items (${codes2})`);
3750
3775
  }
3751
3776
  batch.forEach((pending, index) => {
3777
+ if (pending.item.type === "heartbeat") return;
3752
3778
  const error = rejected.get(index) ?? null;
3753
3779
  if (error) {
3754
3780
  report.failed++;
@@ -3759,6 +3785,17 @@ var EventQueue = class {
3759
3785
  }
3760
3786
  pending.settle?.(error);
3761
3787
  });
3788
+ return true;
3789
+ }
3790
+ /** Puts a batch back at the front, keeping only what still fits; what does not is dropped. */
3791
+ requeue(batch) {
3792
+ const room = Math.max(0, this.options.maxQueueSize - this.items.length);
3793
+ const lost = batch.slice(room);
3794
+ this.items.unshift(...batch.slice(0, room));
3795
+ if (lost.length > 0) {
3796
+ this.logger.warn(`event queue is full; dropped ${lost.length} events`);
3797
+ for (const pending of lost) pending.settle?.(new NiadraError("event queue is full"));
3798
+ }
3762
3799
  }
3763
3800
  /**
3764
3801
  * Once a minute, the next batch carries the number of items sent in the previous window.
@@ -3809,7 +3846,7 @@ function unref(timer) {
3809
3846
  var MAX_TURNS = 50;
3810
3847
  var COMPRESSED_ROOM = 4 * 1024 * 1024 - 64 * 1024;
3811
3848
  var DECODED_ROOM = 16 * 1024 * 1024 - 256 * 1024;
3812
- var MAX_PAUSE_MS = 6e4;
3849
+ var MAX_PAUSE_MS2 = 6e4;
3813
3850
  var encoder2 = new TextEncoder();
3814
3851
  async function encode(records) {
3815
3852
  const raw = encoder2.encode(JSON.stringify({ turns: records }));
@@ -3968,7 +4005,7 @@ var TurnSender = class {
3968
4005
  }
3969
4006
  if (isTransient(error)) {
3970
4007
  this.queue.requeue(batch.frames);
3971
- this.pause = Math.min(MAX_PAUSE_MS, Math.max(this.intervalMs, this.pause * 2));
4008
+ this.pause = Math.min(MAX_PAUSE_MS2, Math.max(this.intervalMs, this.pause * 2));
3972
4009
  this.resumeAt = this.now() + this.pause;
3973
4010
  this.logger.warn(`could not deliver ${batch.frames.length} turns, will retry (${toNiadraError(error).name})`);
3974
4011
  return false;
@@ -4434,7 +4471,10 @@ var SuppressionCopy = class {
4434
4471
  }
4435
4472
  this.saltValue = salt;
4436
4473
  }
4437
- /** Applies one page, in order. `true` when more pages follow. */
4474
+ /**
4475
+ * Applies one page, in order. `true` when more pages follow: a full page. Every page carries the cursor to
4476
+ * read from next, the last one too, which the next read starts from.
4477
+ */
4438
4478
  apply(page) {
4439
4479
  if (page.salt_id !== this.saltValue?.salt_id) {
4440
4480
  this.saltValue = null;
@@ -4449,8 +4489,9 @@ var SuppressionCopy = class {
4449
4489
  }
4450
4490
  this.cursor = page.next_cursor ?? this.cursor;
4451
4491
  this.absent = false;
4452
- if (!page.next_cursor) this.readAt = this.now();
4453
- return Boolean(page.next_cursor);
4492
+ const more = Boolean(page.next_cursor) && page.items.length >= PAGE;
4493
+ if (!more) this.readAt = this.now();
4494
+ return more;
4454
4495
  }
4455
4496
  /** A 404: the space keeps no list. Anything else: the copy stays as it is. */
4456
4497
  failed(error) {
@@ -4675,7 +4716,7 @@ var ContactGateway = class {
4675
4716
 
4676
4717
  // src/outbox.ts
4677
4718
  var CAPACITY = 1e3;
4678
- var MAX_PAUSE_MS2 = 6e4;
4719
+ var MAX_PAUSE_MS3 = 6e4;
4679
4720
  var Outbox = class {
4680
4721
  constructor(logger, intervalMs = 1e3, now = Date.now) {
4681
4722
  this.logger = logger;
@@ -4743,7 +4784,7 @@ var Outbox = class {
4743
4784
  answer = await write.send();
4744
4785
  } catch (error) {
4745
4786
  if (isTransient(error)) {
4746
- this.pause = Math.min(MAX_PAUSE_MS2, Math.max(this.intervalMs, this.pause * 2));
4787
+ this.pause = Math.min(MAX_PAUSE_MS3, Math.max(this.intervalMs, this.pause * 2));
4747
4788
  this.resumeAt = this.now() + this.pause;
4748
4789
  return false;
4749
4790
  }
@@ -5526,6 +5567,11 @@ var ContextCache = class {
5526
5567
  }
5527
5568
  return true;
5528
5569
  }
5570
+ /** Milliseconds since the server last sent or confirmed the pack held for `key`; `null` when none is held. */
5571
+ age(key2) {
5572
+ const entry = this.entries.get(key2);
5573
+ return entry ? this.now() - entry.confirmedAt : null;
5574
+ }
5529
5575
  /** The cached pack's ETag, without touching the order of eviction. */
5530
5576
  etag(key2) {
5531
5577
  return this.entries.get(key2)?.response.etag ?? null;
@@ -5748,7 +5794,7 @@ function mergeNotModified(cached, fresh) {
5748
5794
  coordination: fresh.coordination ?? cached.coordination ?? null
5749
5795
  };
5750
5796
  }
5751
- function resultFrom(response, source, error = null) {
5797
+ function resultFrom(response, source, error = null, ageMs = 0) {
5752
5798
  const holdout = response.path === "holdout";
5753
5799
  const text2 = holdout ? "" : response.text ?? "";
5754
5800
  const pack = holdout ? null : response.pack ?? null;
@@ -5757,10 +5803,10 @@ function resultFrom(response, source, error = null) {
5757
5803
  state: response.state ?? null,
5758
5804
  coordination: response.coordination ?? null
5759
5805
  };
5760
- return { text: text2, suffix: renderSuffix(response), variables: response.variables, pack, source, response, error, ...blocks2 };
5806
+ return { text: text2, suffix: renderSuffix(response), variables: response.variables, pack, source, ageMs, response, error, ...blocks2 };
5761
5807
  }
5762
5808
  function emptyResult(error) {
5763
- return { text: "", suffix: "", variables: {}, pack: null, source: "none", response: null, error, constraints: null, state: null, coordination: null };
5809
+ return { text: "", suffix: "", variables: {}, pack: null, source: "none", ageMs: null, response: null, error, constraints: null, state: null, coordination: null };
5764
5810
  }
5765
5811
  function renderSuffix(response) {
5766
5812
  if (response.path === "holdout") return "";
@@ -8554,19 +8600,29 @@ var Niadra = class _Niadra {
8554
8600
  */
8555
8601
  async mayContact(handle, purpose, options = {}) {
8556
8602
  if (this.core && this.suppressions.due()) {
8557
- const read = this.suppressions.read(
8558
- {
8559
- salt: () => this.api.suppressionSalt({ timeout: this.timeouts.navigation }),
8560
- page: (cursor, limit3) => this.api.suppressions({ cursor, limit: limit3 }, { timeout: this.timeouts.navigation })
8561
- },
8562
- this.suppressions.held ? this.timeouts.write : this.timeouts.navigation
8563
- );
8603
+ const read = this.readSuppressions(this.suppressions.held ? this.timeouts.write : this.timeouts.navigation);
8564
8604
  if (!this.suppressions.held) await read;
8565
8605
  }
8566
8606
  const checkOptions = { channel: options.channel ?? null };
8567
8607
  if (options.failOpen !== void 0) checkOptions.failOpen = options.failOpen;
8568
8608
  return this.suppressions.mayContact(handle, purpose, checkOptions);
8569
8609
  }
8610
+ readSuppressions(budgetMs) {
8611
+ return this.suppressions.read(
8612
+ {
8613
+ salt: () => this.api.suppressionSalt({ timeout: this.timeouts.navigation }),
8614
+ page: (cursor, limit3) => this.api.suppressions({ cursor, limit: limit3 }, { timeout: this.timeouts.navigation })
8615
+ },
8616
+ budgetMs
8617
+ );
8618
+ }
8619
+ /**
8620
+ * Reads the local copy of the suppression list in the background when it is due: a check that Niadra does not
8621
+ * answer falls back on it, so an opt-out holds through an outage.
8622
+ */
8623
+ keepSuppressions() {
8624
+ if (this.core && this.suppressions.due()) void this.readSuppressions(this.timeouts.write);
8625
+ }
8570
8626
  /**
8571
8627
  * The build a turn runs on, for `conversation.turn({ build })`: each prompt's version, the digest of the
8572
8628
  * corpus the agent consults (computed by you, never the files), the model, your context assembler's version
@@ -8640,7 +8696,10 @@ var Niadra = class _Niadra {
8640
8696
  states: this.states,
8641
8697
  contract: () => this.currentContract(),
8642
8698
  internalText: this.internalText,
8643
- check: (request, timeoutMs) => this.api.check(request, { timeout: timeoutMs }),
8699
+ check: (request, timeoutMs) => {
8700
+ if (request.direction === "outbound") this.keepSuppressions();
8701
+ return this.api.check(request, { timeout: timeoutMs });
8702
+ },
8644
8703
  claim: (request, timeoutMs) => this.api.claim(request, {}, { timeout: timeoutMs }),
8645
8704
  verifyClaim: (ref, field, value, options) => this.verifyClaim(ref, field, value, options),
8646
8705
  enabled: this.enabled,
@@ -8754,21 +8813,21 @@ var Niadra = class _Niadra {
8754
8813
  }
8755
8814
  const key2 = cacheKey(request);
8756
8815
  const hit = cache.lookup(key2);
8757
- if (hit?.freshness === "fresh") return resultFrom(delivered(hit.response, cache.take(key2)), "cache");
8816
+ if (hit?.freshness === "fresh") return resultFrom(delivered(hit.response, cache.take(key2)), "cache", null, cache.age(key2));
8758
8817
  if (hit?.freshness === "stale") {
8759
8818
  this.revalidate(core, cache, key2, scope, request, timeout, options.headers).catch((error) => {
8760
8819
  this.logger.debug(`background context refresh failed: ${describe(toNiadraError(error))}`);
8761
8820
  });
8762
- return resultFrom(delivered(hit.response, cache.take(key2)), "stale");
8821
+ return resultFrom(delivered(hit.response, cache.take(key2)), "stale", null, cache.age(key2));
8763
8822
  }
8764
8823
  try {
8765
8824
  const pending = this.revalidate(core, cache, key2, scope, request, timeout, options.headers);
8766
8825
  const { response, source } = await abortable(pending, options.signal);
8767
- return resultFrom(delivered(response, cache.take(key2)), source);
8826
+ return resultFrom(delivered(response, cache.take(key2)), source, null, source === "network" ? 0 : cache.age(key2));
8768
8827
  } catch (error) {
8769
8828
  const failure = toNiadraError(error);
8770
8829
  const fallback2 = cache.lookup(key2);
8771
- return this.contextFailure(failure, fallback2 ? delivered(fallback2.response, cache.take(key2)) : null);
8830
+ return this.contextFailure(failure, fallback2 ? delivered(fallback2.response, cache.take(key2)) : null, cache.age(key2));
8772
8831
  }
8773
8832
  }
8774
8833
  /**
@@ -8790,11 +8849,11 @@ var Niadra = class _Niadra {
8790
8849
  const failure = toNiadraError(error);
8791
8850
  this.observeAuth(failure, key2);
8792
8851
  const fallback2 = cache && key2 ? cache.lookup(key2) : null;
8793
- return this.contextFailure(failure, cache && key2 && fallback2 ? delivered(fallback2.response, cache.take(key2)) : null);
8852
+ return this.contextFailure(failure, cache && key2 && fallback2 ? delivered(fallback2.response, cache.take(key2)) : null, key2 ? cache?.age(key2) ?? null : null);
8794
8853
  }
8795
8854
  if (!cache || !key2 || !scope) return resultFrom(response, "network");
8796
8855
  if (response.degraded && !response.not_modified && cached) {
8797
- return resultFrom(delivered({ ...cached.response, slots: response.slots ?? null }, cache.take(key2)), "fallback");
8856
+ return resultFrom(delivered({ ...cached.response, slots: response.slots ?? null }, cache.take(key2)), "fallback", null, cache.age(key2));
8798
8857
  }
8799
8858
  const merged = response.not_modified && cached ? mergeNotModified(cached.response, response) : response;
8800
8859
  cache.store(key2, scope, withoutSlots(merged), generation);
@@ -9296,11 +9355,11 @@ var Niadra = class _Niadra {
9296
9355
  }
9297
9356
  });
9298
9357
  }
9299
- contextFailure(error, fallback2) {
9358
+ contextFailure(error, fallback2, ageMs = null) {
9300
9359
  if (this.strict) throw error;
9301
9360
  if (fallback2) {
9302
9361
  this.logger.warn(`context request failed, serving the last good pack: ${describe(error)}`);
9303
- return resultFrom(fallback2, "fallback", error);
9362
+ return resultFrom(fallback2, "fallback", error, ageMs);
9304
9363
  }
9305
9364
  this.logger.warn(`context unavailable: ${describe(error)}`);
9306
9365
  return emptyResult(error);
@@ -9401,11 +9460,11 @@ var Niadra = class _Niadra {
9401
9460
  });
9402
9461
  }
9403
9462
  const response = compose(delivered(hit.response, cache.take(key2)), chosen2);
9404
- return resultFrom(response, opening.length > 0 ? "network" : hit.freshness === "fresh" ? "cache" : "stale");
9463
+ return resultFrom(response, opening.length > 0 ? "network" : hit.freshness === "fresh" ? "cache" : "stale", null, cache.age(key2));
9405
9464
  } catch (error) {
9406
9465
  const failure = toNiadraError(error);
9407
9466
  const fallback2 = cache.lookup(key2);
9408
- return this.contextFailure(failure, fallback2 ? delivered(fallback2.response, cache.take(key2)) : null);
9467
+ return this.contextFailure(failure, fallback2 ? delivered(fallback2.response, cache.take(key2)) : null, cache.age(key2));
9409
9468
  }
9410
9469
  }
9411
9470
  /** Starts one read of a line in the background. */
@@ -9548,7 +9607,7 @@ var Niadra = class _Niadra {
9548
9607
  else resolve({ ok: false, idempotency_key: key2, error });
9549
9608
  };
9550
9609
  core.queue.push(item, settle2);
9551
- core.queue.flushInBackground();
9610
+ core.queue.flushInBackground(true);
9552
9611
  });
9553
9612
  }
9554
9613
  async endScope(item, scope) {
@@ -11568,7 +11627,8 @@ var Counterfactual = class {
11568
11627
  const fn = this.tools[tool2];
11569
11628
  if (fn === void 0) throw new NiadraError(`no function for the tool ${tool2}: pass it in tools`);
11570
11629
  if (!Number.isInteger(k) || k < 1 || k > MAX_K) throw new RangeError(`k must be 1 to ${String(MAX_K)}`);
11571
- await this.niadra.profile();
11630
+ const raw = await this.served(tool2);
11631
+ if (raw === null) throw new NiadraError(`the space binds no tool ${tool2} for this key's source: see its tool-bindings`);
11572
11632
  const ids = [...turnIds];
11573
11633
  if ((options.scenarioIds ?? []).length > 0) {
11574
11634
  const found2 = await this.niadra.callRoute({ method: "GET", path: "/v1/scenarios", query: { ids: (options.scenarioIds ?? []).join(","), limit: 50 } });
@@ -11586,7 +11646,7 @@ var Counterfactual = class {
11586
11646
  continue;
11587
11647
  }
11588
11648
  for (const call of calls(record, tool2)) {
11589
- const found2 = await this.case(record, call, fn, element, k);
11649
+ const found2 = await this.case(record, call, fn, raw, element, k);
11590
11650
  if (found2 === null) run.untouched++;
11591
11651
  else run.cases.push(found2);
11592
11652
  }
@@ -11596,17 +11656,15 @@ var Counterfactual = class {
11596
11656
  run.report = await this.niadra.callRoute({ method: "POST", path: "/v1/measure/counterfactual-runs", body: report });
11597
11657
  return run;
11598
11658
  }
11599
- async case(record, call, fn, element, k) {
11659
+ async case(record, call, fn, raw, element, k) {
11600
11660
  const base = { turn_id: record.turn_id, call_id: call.call_id };
11601
11661
  const tool2 = String(call.name);
11602
11662
  const wrapped = recordedTool(fn);
11603
- const raw = this.options.bindings?.[tool2] ?? wrapped?.binding ?? await this.served(tool2);
11604
11663
  let block;
11605
11664
  let args;
11606
11665
  try {
11607
11666
  block = await this.value(record, blockBlob(record, call));
11608
11667
  args = { ...await this.value(record, call.args) };
11609
- if (raw === null) throw new BlobError("the tool has no binding");
11610
11668
  } catch {
11611
11669
  return { ...base, status: "infrastructure_error", dry_run: false };
11612
11670
  }