@theoremjs/studio 0.3.4-next.484.g20d8b9d → 0.3.4-next.522.g9e684cd

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 (95) hide show
  1. package/README.md +3 -3
  2. package/compile.d.ts +1 -1
  3. package/compile.js +44 -2
  4. package/draft.d.ts +55 -2
  5. package/draft.js +14 -0
  6. package/example.js +5 -2
  7. package/map-line.d.ts +12 -0
  8. package/map-line.js +98 -0
  9. package/map.d.ts +1 -1
  10. package/map.js +0 -1
  11. package/mod.d.ts +1 -1
  12. package/mod.js +1 -1
  13. package/package.json +4 -4
  14. package/page/assets/{Banner-G4u0gVOw.js → Banner-UZW6WFTG.js} +2 -2
  15. package/page/assets/{ConsoleFrame-BZqxUndX.js → ConsoleFrame-C6ZxuLse.js} +3 -3
  16. package/page/assets/{ContextMenu-DEnGmVYR.js → ContextMenu-ClIUDzvK.js} +2 -2
  17. package/page/assets/{ToolResultCharts-BWBYDar4.js → ToolResultCharts-COgqvWEu.js} +1 -1
  18. package/page/assets/{TraceInspector-B0cUdNg5.js → TraceInspector-D2unePaa.js} +1 -1
  19. package/page/assets/{TraceOverview-Bjqg7laD.js → TraceOverview-CCA1iUNg.js} +2 -2
  20. package/page/assets/{_virtual_studio-type-sources-DBS0HldZ.js → _virtual_studio-type-sources-DfyVGpe8.js} +93 -61
  21. package/page/assets/browser-engine-CRGnAh9x.js +11 -0
  22. package/page/assets/browser-transport-CgmN-3Ia.js +47 -0
  23. package/page/assets/{compile-egress-BSxOdX4K.js → compile-egress-BRGW9qfO.js} +2 -2
  24. package/page/assets/{crypto-iT_LZ8Et.js → crypto-BoqeX_71.js} +1 -1
  25. package/page/assets/{egress-automata-B5ZGE1mT.js → egress-automata-SiHQTP1i.js} +1 -1
  26. package/page/assets/{encode-files-8AFMw7Er.js → encode-files-DFrbgXms.js} +1 -1
  27. package/page/assets/{export-agent-Cxamh6fg.js → export-agent-U8qRBuhg.js} +3 -3
  28. package/page/assets/{guardrail-tester-Lubrp5dY.js → guardrail-tester-DASanQyo.js} +2 -2
  29. package/page/assets/host-patterns-cSf1U25G.js +1 -0
  30. package/page/assets/index-C9rhrCGT.css +1 -0
  31. package/page/assets/index-CGN6iWF2.js +101 -0
  32. package/page/assets/{labels-provider-BSiD6Lrb.js → labels-provider-Gus3heEH.js} +1 -1
  33. package/page/assets/{live-ingress-lDUGPwth.js → live-ingress-qi-y5uvH.js} +1 -1
  34. package/page/assets/{live-messages-BwMauTVi.js → live-messages-cl-CI8gZ.js} +1 -1
  35. package/page/assets/reader-IkImpzZF.js +7 -0
  36. package/page/assets/shaped-data-CITXsEfw.js +21 -0
  37. package/page/assets/{stub-_DAX3TnJ.js → stub-Ccyi1ZiM.js} +2 -2
  38. package/page/assets/studio-code-pane-AoMu0cGy.js +8 -0
  39. package/page/assets/{studio-console-C-rWlbSY.js → studio-console-JNYkyQ0E.js} +1 -1
  40. package/page/assets/{studio-decision-CCpYdeOV.js → studio-decision-BRJuvgS3.js} +1 -1
  41. package/page/assets/{studio-embedding-BM1yTK8B.js → studio-embedding-D-r2kuz3.js} +1 -1
  42. package/page/assets/studio-host-console-HoLSpRVk.js +2 -0
  43. package/page/assets/{studio-labels-CBBymwHa.js → studio-labels-CBcjlfH4.js} +1 -1
  44. package/page/assets/studio-live-DtywUIK2.js +5 -0
  45. package/page/assets/studio-map-BIJ-S7br.js +1 -0
  46. package/page/assets/studio-trace-replay-BuOKQwlj.js +2 -0
  47. package/page/assets/{studio-type-checker-B4qvn-WC.js → studio-type-checker-C8qG2W9D.js} +1 -1
  48. package/page/assets/tool-schema-DDkOMTMz.js +17 -0
  49. package/page/assets/{trace-record-D4xAUHLZ.js → trace-record-Dqvj9bhx.js} +1 -1
  50. package/page/assets/tree-jmLWUWxQ.js +3 -0
  51. package/page/assets/{turn-client-D_bUUpER.js → turn-client-DSatougR.js} +2 -2
  52. package/page/assets/types-4jMDDudJ.js +1 -0
  53. package/page/assets/{use-one-call-DWpPEFdQ.js → use-one-call-BcTU9gJ9.js} +1 -1
  54. package/page/assets/workspace-B2bnm5qv.js +1 -0
  55. package/page/index.html +19 -19
  56. package/read-source.js +10 -1
  57. package/registrations.d.ts +6 -0
  58. package/run-payload.d.ts +1 -1
  59. package/runtime.d.ts +1 -1
  60. package/runtime.js +1 -1
  61. package/server/draft-decide.d.ts +1 -4
  62. package/server/draft-decide.js +1 -1
  63. package/server/draft-replies.js +2 -2
  64. package/source.js +1 -1
  65. package/tools.js +3 -0
  66. package/types.d.ts +6 -0
  67. package/ui/brand-icons.d.ts +2 -2
  68. package/ui/brand-icons.js +6 -4
  69. package/ui/lib/tree-map-layout.d.ts +120 -18
  70. package/ui/lib/tree-map-layout.js +1292 -190
  71. package/ui/map-token.css +25 -0
  72. package/ui/node-icon.js +1 -4
  73. package/ui/profile-editor.js +22 -6
  74. package/ui/read-map.css +1 -24
  75. package/ui/read-map.js +52 -4
  76. package/ui/studio-map.js +1 -3
  77. package/ui/tree-map.css +9 -0
  78. package/ui/tree-map.d.ts +27 -6
  79. package/ui/tree-map.js +215 -75
  80. package/page/assets/browser-engine-CaPsakbj.js +0 -11
  81. package/page/assets/browser-transport-BEha0XY8.js +0 -47
  82. package/page/assets/host-patterns-C9RMP16Q.js +0 -1
  83. package/page/assets/index-C3n9ogf7.js +0 -101
  84. package/page/assets/index-Cbs7B46A.css +0 -1
  85. package/page/assets/reader-oVJF5Iqk.js +0 -7
  86. package/page/assets/shaped-data-Bc6u4pow.js +0 -16
  87. package/page/assets/studio-code-pane-BqHsqd7P.js +0 -8
  88. package/page/assets/studio-host-console-D8_OCbZG.js +0 -2
  89. package/page/assets/studio-live-CgYci_ts.js +0 -5
  90. package/page/assets/studio-map-QDBMJ6x3.js +0 -1
  91. package/page/assets/studio-trace-replay-BIRuiVjZ.js +0 -2
  92. package/page/assets/tool-schema-CvHbJyis.js +0 -18
  93. package/page/assets/tree-DtF83caH.js +0 -3
  94. package/page/assets/types-Bc3MMW0P.js +0 -1
  95. package/page/assets/workspace-ILHOuESH.js +0 -1
@@ -4416,9 +4416,6 @@ interface HostMatcher {
4416
4416
  }
4417
4417
  /** Bumped whenever the compiled table's layout or meaning changes. */
4418
4418
  declare const PATTERN_COMPILER_VERSION = 3;
4419
- /** The most patterns one detector takes, and the longest each may be once written as a regular expression. */
4420
- declare const MAX_PATTERNS = 64;
4421
- declare const MAX_PATTERN_LENGTH = 1024;
4422
4419
  /** The patterns as a compiled table records them. */
4423
4420
  declare function patternSources(patterns: readonly HostPattern[]): PatternSource[];
4424
4421
  /** What is wrong with one pattern, or \`undefined\` when it runs. */
@@ -4439,7 +4436,7 @@ declare function listsPatterns(detect: unknown): boolean;
4439
4436
  /** \`patterns\`, valid, ready to run. */
4440
4437
  declare function matchersOf(patterns: readonly HostPattern[]): readonly HostMatcher[];
4441
4438
  export type { AutomatonData, CompiledPatterns, HostMatcher, HostPattern, PatternSource };
4442
- export { listsPatterns, MAX_PATTERN_LENGTH, MAX_PATTERNS, matchersOf, PATTERN_COMPILER_VERSION, patternListProblem, patternProblem, patternSources, patternsProblem, };
4439
+ export { listsPatterns, matchersOf, PATTERN_COMPILER_VERSION, patternListProblem, patternProblem, patternSources, patternsProblem, };
4443
4440
  `,"file:///node_modules/@theoremjs/agents/src/guardrails/detectors.d.ts":`/** labels-exempt-file: authoring labels, descriptions and profile-registration diagnostics for detectors — not runtime user or model copy (P2) */
4444
4441
  import { type Boundary } from './boundaries.js';
4445
4442
  import { type CompiledPatterns, type HostMatcher, type HostPattern } from './host-patterns.js';
@@ -4712,7 +4709,7 @@ export { guardrailFromHits, guardrailFromVerdict, guardrailTurnEvent, projectGua
4712
4709
  export { hitFromSpan, projectGuardrailEvent, } from './src/guardrails/hits.js';
4713
4710
  export type { ClientLabelKey, LabelKey, LabelOverrides, LabelParams, } from './src/guardrails/labels.js';
4714
4711
  export { CLIENT_LABEL_KEYS, LABEL_KEYS, labelDefault, labelText, overrideLabels, resetLabels, } from './src/guardrails/labels.js';
4715
- export type { AdvisoryLevel, BlockedReplyOnBlock, BlockedReplySpec, CanaryGateResult, CanaryGateSession, CanaryStreamGate, DestinationGate, DestinationVerdict, Directive, DirectiveSignal, GivenUrls, GuardedToolText, GuardrailAction, GuardrailContext, GuardrailEvent, GuardrailHit, GuardrailStage, HostGuardrailsSpec, InspectedToolArguments, LiveHeldOutput, LiveOutboundBatchResult, LiveOutboundGateSession, NameAllow, NetworkGuardrailSpec, OutboundPayload, ProfileGuardrailsSpec, ProgressiveYieldGate, ProgressiveYieldGateOptions, ProgressiveYieldResult, Provenance, QuotaGuardrailSpec, ResolvedGuardrailPolicy, ScanText, SensitiveGroup, SensitiveSelection, SensitiveSwitches, Severity, TaintGate, TaintGuardrailSpec, ToolOrigin, TrustLevel, TurnDestinations, TurnTaint, UrlAllow, Verdict, } from './src/guardrails/mod.js';
4712
+ export type { AdvisoryLevel, BlockedReplyOnBlock, BlockedReplySpec, CanaryGateResult, CanaryGateSession, CanaryStreamGate, DecisionDisclosureEnforcer, DecisionDisclosureVerdict, DecisionGuardrailsSpec, DestinationGate, DestinationVerdict, Directive, DirectiveSignal, GivenUrls, GuardedToolText, GuardrailAction, GuardrailContext, GuardrailEvent, GuardrailHit, GuardrailStage, HostGuardrailsSpec, InspectedToolArguments, LiveHeldOutput, LiveOutboundBatchResult, LiveOutboundGateSession, NameAllow, NetworkGuardrailSpec, OutboundPayload, ProfileGuardrailsSpec, ProgressiveYieldGate, ProgressiveYieldGateOptions, ProgressiveYieldResult, Provenance, QuotaGuardrailSpec, ResolvedGuardrailPolicy, ScanText, SensitiveGroup, SensitiveSelection, SensitiveSwitches, Severity, TaintGate, TaintGuardrailSpec, ToolOrigin, TrustLevel, TurnDestinations, TurnTaint, UrlAllow, Verdict, } from './src/guardrails/mod.js';
4716
4713
  export { ADVISORY_LEVELS, abortLiveOutboundTurn, addGivenDestinations, addHistoryDestinations, addRequestDestinations, addResultDestinations, BLOCKED_REPLY_ON_BLOCK, bindCanary, checkDestinationGate, checkTaintGate, composeToolText, createCanaryGateSession, createCanaryStreamGate, createLiveOutboundGateSession, createOutboundProgressiveGate, createProgressiveYieldGate, DESTINATION_GATES, DIRECTIVE_SIGNALS, directives, EGRESS_RULES, eventHasCanary, filterCanaryGatedEvents, finalizeLiveOutboundTurn, GUARDRAIL_STAGES, guardToolFailureText, guardToolResult, hitRules, inspectToolArguments, isRemoteOrigin, isSuspicious, isTainted, mintCanary, OMIT_CANARY, processLiveOutboundBatch, recordTaint, redactCanary, resolveGuardrailPolicy, SEVERITIES, scanTextForCanaryLeak, scanTextOf, TAINT_GATES, TOOL_CLOSE, TOOL_ORIGINS, TRUST_LEVELS, textForScan, toolCallEvent, turnDestinations, wrapToolData, wrapUserData, } from './src/guardrails/mod.js';
4717
4714
  export type { DnsOverHttpsOptions, GuardedFetchOptions, ResolveHost, } from './src/guardrails/network.js';
4718
4715
  export { assertSafeUrl, dnsOverHttpsResolver, fetchGuarded, isLocalhostName, isPrivateOrLocalAddress, } from './src/guardrails/network.js';
@@ -4737,7 +4734,7 @@ export type { ProfileGraphEditor, ProfileGraphFacet, ProfileGraphFacetId, Profil
4737
4734
  export { PROFILE_GRAPH, profileGraphFacet, spineFacetsForProfileType, } from './src/kernel/profile-graph.js';
4738
4735
  export type { RuntimeAbilities } from './src/kernel/protocols/binding.js';
4739
4736
  export { checkBinding, commonModelSettingsSchema, decisionModelBindingSchema, keySlotSchema, keySlotsOf, modelBindingSchema, } from './src/kernel/protocols/binding.js';
4740
- export { providerLimitsSchema, resolveProviderLimits } from './src/kernel/protocols/limits.js';
4737
+ export { providerLimitsSchema } from './src/kernel/protocols/limits.js';
4741
4738
  export type { CallSetup, ProtocolCall } from './src/kernel/protocols/runtime.js';
4742
4739
  export { callProtocol, plainWebSocket } from './src/kernel/protocols/runtime.js';
4743
4740
  export type { AttachmentFacts, AttachmentRules } from './src/kernel/registry/attachments.js';
@@ -4795,15 +4792,15 @@ export { bearer, createProviderRegistry, defineProvider, endpointUrlSchema, head
4795
4792
  export type { OpenWebSocket, ProviderHostOptions } from '../kernel/protocols/runtime.js';
4796
4793
  export type { CredentialContext, CredentialResolver, KeyCredential, KeyVault, } from '../kernel/registry/vault.js';
4797
4794
  export { embeddingModelLimits } from './embedding-limits.js';
4798
- export { geminiEmbedding } from './gemini/embedding-protocol.js';
4795
+ export { geminiEmbeddings } from './gemini/embeddings-protocol.js';
4799
4796
  export { geminiInteractions } from './gemini/interactions-protocol.js';
4800
4797
  export { geminiLive } from './gemini/live-protocol.js';
4801
4798
  export { geminiProvider } from './gemini/provider.js';
4802
- export { ollamaEmbedding } from './local/embedding-protocol.js';
4799
+ export { ollamaEmbeddings } from './local/embeddings-protocol.js';
4803
4800
  export { localProvider } from './local/provider.js';
4804
4801
  export { openAi } from './open-ai/protocol.js';
4805
4802
  export { openRouterDecisions } from './openrouter/decisions-protocol.js';
4806
- export { openRouterEmbedding } from './openrouter/embedding-protocol.js';
4803
+ export { openRouterEmbeddings } from './openrouter/embeddings-protocol.js';
4807
4804
  export { openRouterImages } from './openrouter/images-protocol.js';
4808
4805
  export { openRouterOpenAi } from './openrouter/protocol.js';
4809
4806
  export { openRouterProvider } from './openrouter/provider.js';
@@ -5178,20 +5175,19 @@ export declare function extendProtocol<O, S, E = JsonObject>(base: Protocol<O, S
5178
5175
  /** Whether something \`writer\` wrote may go back to \`target\`: the writer is in its lineage. */
5179
5176
  export declare function carriesTo(writer: string, target: Pick<Protocol, 'lineage'>): boolean;
5180
5177
  `,"file:///node_modules/@theoremjs/agents/src/kernel/protocols/limits.d.ts":`import { z } from 'zod';
5181
- /** The budgets every provider call runs under; a host may tighten or loosen each. */
5178
+ /** The budgets a provider call runs under. Each one left out is no limit: the provider's own applies. */
5182
5179
  export interface ProviderLimits {
5183
- operationTimeoutMs: number;
5184
- connectTimeoutMs: number;
5185
- liveStepTimeoutMs: number;
5186
- maxWireRecordBytes: number;
5187
- maxWireResponseBytes: number;
5188
- maxEventBytes: number;
5189
- maxStepBytes: number;
5190
- maxStepEvents: number;
5191
- maxPendingToolCalls: number;
5180
+ operationTimeoutMs?: number;
5181
+ connectTimeoutMs?: number;
5182
+ liveStepTimeoutMs?: number;
5183
+ maxWireRecordBytes?: number;
5184
+ maxWireResponseBytes?: number;
5185
+ maxEventBytes?: number;
5186
+ maxStepBytes?: number;
5187
+ maxStepEvents?: number;
5188
+ maxPendingToolCalls?: number;
5192
5189
  }
5193
5190
  export declare const providerLimitsSchema: z.ZodType<ProviderLimits>;
5194
- export declare function resolveProviderLimits(overrides?: Partial<ProviderLimits>): ProviderLimits;
5195
5191
  `,"file:///node_modules/@theoremjs/agents/src/kernel/types.d.ts":`import type { ProviderCheckpoint, ProviderContinuationPolicy } from './checkpoint.js';
5196
5192
  import type { JsonObject } from './json.js';
5197
5193
  import type { CacheMode, CacheTtl, CompactionMeter, CompactionOutcome, CompactionTiming, ContextSender, ContinueStopKind, FieldMeta, KeySlot, KeyVault, LiveActivityHandling, LiveEndSensitivity, LiveStartSensitivity, MediaInputKind, ProfileType, SpeechAudioFormat, StreamMode, SummaryMode, ThinkingLevel, ToolLoadTier, TurnStage, TurnStopKind } from './schema.js';
@@ -5652,8 +5648,10 @@ export interface DecisionRequest {
5652
5648
  state: Exclude<DecisionJson, null>;
5653
5649
  questions: Record<string, DecisionQuestion>;
5654
5650
  /**
5655
- * Images by reference. Write a reference as a string where its image belongs, in \`state\`, in a
5656
- * question's instructions, or in its criteria; the provider puts the image there.
5651
+ * Images by reference. Write a reference in a string where its image belongs, in \`state\`, in a
5652
+ * question's instructions, or in its criteria, as the whole string or inside it; the model reads
5653
+ * the image in its place, once for each use. Keys are never read. Only the images some string
5654
+ * references are sent, so pick references that cannot occur in your text by accident.
5657
5655
  */
5658
5656
  assets?: Record<string, DecisionAsset>;
5659
5657
  signal?: AbortSignal;
@@ -6857,6 +6855,8 @@ export interface CompactionFailure {
6857
6855
  stop?: TurnStopKind;
6858
6856
  /** The error it reported, when it reported one. */
6859
6857
  error?: ErrorKind;
6858
+ /** Why it failed, for the builder only: \`forClient\` strips it for a visitor. */
6859
+ errorInternal?: string;
6860
6860
  /** It completed without a summary. */
6861
6861
  empty?: true;
6862
6862
  /** Nothing in \`toCompact\` was left for it to read, so it did not run. */
@@ -7898,7 +7898,7 @@ export { applySpans, blobAt, mergeSpans, OMIT_CANARY, OMIT_INJECTION, OMIT_SENSI
7898
7898
  `,"file:///node_modules/@theoremjs/agents/src/guardrails/labels.d.ts":`/** Values that fill a label template's \`{param}\` placeholders. */
7899
7899
  export type LabelParams = Record<string, string | number>;
7900
7900
  /** Keys are stable API. */
7901
- export declare const LABEL_KEYS: readonly ["provider.decision_failed", "provider.decision_unavailable", "provider.decision_model_missing", "provider.decision_ended", "provider.decision_images_off", "provider.decision_box_model", "provider.budget_exhausted", "provider.adapter_version", "provider.adapter_methods", "provider.adapter_schemas", "provider.fallback_slot", "provider.model_fallback_slot", "provider.host_model", "provider.turn_profile", "provider.model_binding_missing", "provider.session_closed", "provider.settled_call", "provider.session_unavailable", "provider.live_input", "provider.tool_cancel_missing", "provider.kernel_gate", "provider.event_invalid", "provider.response_identity", "provider.credential_resolution", "provider.credential_shape", "provider.stored_continuation", "provider.continuation_mismatch", "provider.continuation_contract", "provider.stateless_history", "provider.events_after_completion", "provider.duplicate_call", "provider.tool_cancel_live", "provider.complete_unavailable", "provider.parallel_tools", "provider.binding_identity", "provider.profile_type", "provider.event_type", "provider.feature", "provider.input_kind", "provider.output_kind", "provider.builtin", "provider.credential_missing", "provider.profile_configuration", "continue.instruction", "canary.bind_note", "user_data.note", "context.note", "taint.blocked", "taint.reason_steered", "taint.reason_tainted", "taint.destination_blocked", "taint.destination_confirm", "advisory.notice_elevated", "advisory.notice_high", "advisory.guidance", "attachments.too_many_files", "attachments.too_many_of_kind", "attachments.file_too_large", "attachments.turn_too_large", "attachments.not_accepted", "attachments.mime_not_allowed", "input.too_long", "attachments.limits_unconfigured", "quota.exhausted", "quota.busy", "error.config", "error.request", "error.input", "error.action", "error.auth", "error.rate_limit", "error.busy", "error.unsupported", "error.unavailable", "error.bad_response", "error.network", "error.timeout", "error.safety", "error.blocked", "error.declined", "error.failed", "error.cancelled", "error.internal", "repair.default_guidance", "repair.items_guidance", "repair.prompt_header", "repair.prompt_intro", "repair.prompt_instructions", "repair.history_heading", "repair.section_previous_output", "repair.section_validator_rejection", "repair.section_repair_guidance", "repair.section_instructions", "compaction.request", "compaction.tool_call", "compaction.tool_result", "decision.box_image", "detect.blocked", "detect.call_blocked", "detect.output_blocked", "detect.shown_blocked", "detect.hint.ids", "detect.hint.financial", "detect.hint.network", "detect.hint.credentials", "detect.hint.injection", "detect.hint.tool_instructions", "detect.hint.canary_leak", "detect.hint.prompt_leak", "detect.hint.marker_leak", "detect.hint.ungiven_images", "detect.hint.ungiven_links", "detect.hint.tool_leak", "detect.hint.own", "egress.default_repair_guidance", "egress.refusal", "egress.refusal_cut", "egress.rejection", "egress.rejection_found", "egress.hint_unscannable", "egress.hint_provider_tool_leak", "thought.omitted_image", "thought.omitted_link", "thought.omitted_instructions", "session.abandon_gated", "session.tool_denied", "session.tool_aborted", "session.sign_in", "sign_in.link", "sign_in.pending", "sign_in.done", "sign_in.declined", "sign_in.expired", "sign_in.out_of_scope", "session.gate_expired", "session.provider_state_unowned", "session.conversation_unknown", "session.turn_ended", "session.gate_pending", "session.part_skipped", "live.session_ended", "voice.unsupported", "voice.permission", "voice.unavailable", "voice.failed", "voice.empty", "stop.cancelled", "stop.interrupted", "stop.length", "stop.filtered", "stop.provider_error", "stop.stream_incomplete", "stop.step_limit", "composer.model", "composer.effort", "tool.awaiting_user", "tool.completed_hidden", "tool.t2_loader_needs_snapshot", "tool.t2_loader_shape", "tool.t2_loader_output_invalid", "tool.execution_uncertain", "tool.input_invalid", "tool.input_invalid_after_mutate", "tool.output_invalid_after_mutate", "tool.handler_no_output", "tool.did_not_run", "tool.page_no_answer", "tool.page_timed_out", "tool.output_invalid", "tool.not_loaded_t2", "tool.wait_unknown", "tool.wait_cycle", "tool.not_visible", "tool.builtin_not_enabled", "tool.provider_native", "tool.not_registered", "tool.builtin_needs_snapshot", "tool.not_allowed", "tool.not_eligible", "tool.unsupported_type", "tool.agent_call_limit", "tool.agent_failed", "tool.activity_failed", "protocol.not_served", "protocol.profile_type", "protocol.options", "protocol.option_clash", "protocol.base_options", "protocol.id_clash", "protocol.ws_headers", "protocol.builtin_unwritten", "protocol.provider_missing", "protocol.connection", "protocol.part_schema", "protocol.part_invalid", "protocol.key_invalid", "protocol.no_key", "protocol.reply_shape", "protocol.endpoint_url", "protocol.endpoint_host", "protocol.http", "protocol.no_operation", "protocol.definition", "protocol.provider_id_clash", "protocol.history_needed"];
7901
+ export declare const LABEL_KEYS: readonly ["provider.decision_failed", "provider.decision_unavailable", "provider.decision_model_missing", "provider.decision_ended", "provider.decision_images_off", "provider.decision_box_model", "provider.budget_exhausted", "provider.adapter_version", "provider.adapter_methods", "provider.adapter_schemas", "provider.fallback_slot", "provider.model_fallback_slot", "provider.host_model", "provider.turn_profile", "provider.model_binding_missing", "provider.session_closed", "provider.settled_call", "provider.session_unavailable", "provider.live_input", "provider.tool_cancel_missing", "provider.kernel_gate", "provider.event_invalid", "provider.response_identity", "provider.credential_resolution", "provider.credential_shape", "provider.stored_continuation", "provider.continuation_mismatch", "provider.continuation_contract", "provider.stateless_history", "provider.events_after_completion", "provider.duplicate_call", "provider.tool_cancel_live", "provider.complete_unavailable", "provider.parallel_tools", "provider.binding_identity", "provider.profile_type", "provider.event_type", "provider.feature", "provider.input_kind", "provider.output_kind", "provider.builtin", "provider.credential_missing", "provider.profile_configuration", "continue.instruction", "canary.bind_note", "user_data.note", "context.note", "taint.blocked", "taint.reason_steered", "taint.reason_tainted", "taint.destination_blocked", "taint.destination_confirm", "advisory.notice_elevated", "advisory.notice_high", "advisory.guidance", "attachments.too_many_files", "attachments.too_many_of_kind", "attachments.file_too_large", "attachments.turn_too_large", "attachments.not_accepted", "attachments.mime_not_allowed", "attachments.limits_unconfigured", "quota.exhausted", "quota.busy", "error.config", "error.request", "error.input", "error.action", "error.auth", "error.rate_limit", "error.busy", "error.unsupported", "error.unavailable", "error.bad_response", "error.network", "error.timeout", "error.safety", "error.blocked", "error.declined", "error.failed", "error.cancelled", "error.internal", "repair.default_guidance", "repair.items_guidance", "repair.prompt_header", "repair.prompt_intro", "repair.prompt_instructions", "repair.history_heading", "repair.section_previous_output", "repair.section_validator_rejection", "repair.section_repair_guidance", "repair.section_instructions", "structured.answer_tool", "structured.answer_missing", "compaction.request", "compaction.tool_call", "compaction.tool_result", "decision.box_image", "detect.blocked", "detect.call_blocked", "detect.output_blocked", "detect.shown_blocked", "detect.hint.ids", "detect.hint.financial", "detect.hint.network", "detect.hint.credentials", "detect.hint.injection", "detect.hint.tool_instructions", "detect.hint.canary_leak", "detect.hint.prompt_leak", "detect.hint.marker_leak", "detect.hint.ungiven_images", "detect.hint.ungiven_links", "detect.hint.tool_leak", "detect.hint.own", "egress.default_repair_guidance", "egress.refusal", "egress.refusal_cut", "egress.rejection", "egress.rejection_found", "egress.hint_unscannable", "egress.hint_provider_tool_leak", "thought.omitted_image", "thought.omitted_link", "thought.omitted_instructions", "session.abandon_gated", "session.tool_denied", "session.tool_aborted", "session.sign_in", "sign_in.link", "sign_in.pending", "sign_in.done", "sign_in.declined", "sign_in.expired", "sign_in.out_of_scope", "session.gate_expired", "session.provider_state_unowned", "session.conversation_unknown", "session.turn_ended", "session.gate_pending", "session.part_skipped", "live.session_ended", "voice.unsupported", "voice.permission", "voice.unavailable", "voice.failed", "voice.empty", "stop.cancelled", "stop.interrupted", "stop.length", "stop.filtered", "stop.provider_error", "stop.stream_incomplete", "stop.step_limit", "composer.model", "composer.effort", "tool.awaiting_user", "tool.completed_hidden", "tool.t2_loader_needs_snapshot", "tool.t2_loader_shape", "tool.t2_loader_output_invalid", "tool.execution_uncertain", "tool.input_invalid", "tool.input_invalid_after_mutate", "tool.output_invalid_after_mutate", "tool.handler_no_output", "tool.did_not_run", "tool.page_no_answer", "tool.page_timed_out", "tool.output_invalid", "tool.not_loaded_t2", "tool.wait_unknown", "tool.wait_cycle", "tool.not_visible", "tool.builtin_not_enabled", "tool.provider_native", "tool.not_registered", "tool.builtin_needs_snapshot", "tool.not_allowed", "tool.not_eligible", "tool.unsupported_type", "tool.agent_call_limit", "tool.agent_failed", "tool.activity_failed", "protocol.not_served", "protocol.profile_type", "protocol.options", "protocol.option_clash", "protocol.base_options", "protocol.id_clash", "protocol.ws_headers", "protocol.builtin_unwritten", "protocol.provider_missing", "protocol.connection", "protocol.part_schema", "protocol.part_invalid", "protocol.key_invalid", "protocol.no_key", "protocol.reply_shape", "protocol.endpoint_url", "protocol.endpoint_host", "protocol.http", "protocol.no_operation", "protocol.definition", "protocol.provider_id_clash", "protocol.history_needed"];
7902
7902
  /** One of {@linkcode LABEL_KEYS}. */
7903
7903
  export type LabelKey = (typeof LABEL_KEYS)[number];
7904
7904
  /**
@@ -7907,7 +7907,7 @@ export type LabelKey = (typeof LABEL_KEYS)[number];
7907
7907
  * puts into history. Only these overrides travel to the browser; the rest
7908
7908
  * (repair prompts, canary, taint, egress) stay on the host.
7909
7909
  */
7910
- export declare const CLIENT_LABEL_KEYS: readonly ["attachments.too_many_files", "attachments.too_many_of_kind", "attachments.file_too_large", "attachments.turn_too_large", "attachments.not_accepted", "attachments.mime_not_allowed", "input.too_long", "attachments.limits_unconfigured", "detect.blocked", "error.config", "error.request", "error.input", "error.action", "error.auth", "error.rate_limit", "error.busy", "error.unsupported", "error.unavailable", "error.bad_response", "error.network", "error.timeout", "error.safety", "error.blocked", "error.declined", "error.failed", "error.cancelled", "error.internal", "session.abandon_gated", "session.tool_denied", "session.sign_in", "session.gate_expired", "session.turn_ended", "session.gate_pending", "session.part_skipped", "live.session_ended", "tool.awaiting_user", "tool.completed_hidden", "tool.execution_uncertain", "voice.unsupported", "voice.permission", "voice.unavailable", "voice.failed", "voice.empty", "stop.cancelled", "stop.interrupted", "stop.length", "stop.filtered", "stop.provider_error", "stop.stream_incomplete", "stop.step_limit", "composer.model", "composer.effort"];
7910
+ export declare const CLIENT_LABEL_KEYS: readonly ["attachments.too_many_files", "attachments.too_many_of_kind", "attachments.file_too_large", "attachments.turn_too_large", "attachments.not_accepted", "attachments.mime_not_allowed", "attachments.limits_unconfigured", "detect.blocked", "error.config", "error.request", "error.input", "error.action", "error.auth", "error.rate_limit", "error.busy", "error.unsupported", "error.unavailable", "error.bad_response", "error.network", "error.timeout", "error.safety", "error.blocked", "error.declined", "error.failed", "error.cancelled", "error.internal", "session.abandon_gated", "session.tool_denied", "session.sign_in", "session.gate_expired", "session.turn_ended", "session.gate_pending", "session.part_skipped", "live.session_ended", "tool.awaiting_user", "tool.completed_hidden", "tool.execution_uncertain", "voice.unsupported", "voice.permission", "voice.unavailable", "voice.failed", "voice.empty", "stop.cancelled", "stop.interrupted", "stop.length", "stop.filtered", "stop.provider_error", "stop.stream_incomplete", "stop.step_limit", "composer.model", "composer.effort"];
7911
7911
  /** One of {@linkcode CLIENT_LABEL_KEYS}. */
7912
7912
  export type ClientLabelKey = (typeof CLIENT_LABEL_KEYS)[number];
7913
7913
  /** Host-supplied replacement templates, \`{param}\` placeholders included. */
@@ -8715,6 +8715,7 @@ export { buildRecord, contentOf, inlineContent, TRACE_SCHEMA_URL };
8715
8715
  `,"file:///node_modules/@theoremjs/agents/src/kernel/protocols/binding.d.ts":`import { z } from 'zod';
8716
8716
  import { type JsonObject } from '../json.js';
8717
8717
  import { type KeySlot } from '../schema.js';
8718
+ import { type ProviderLimits } from './limits.js';
8718
8719
  import { type ModelProfileType, type Protocol } from './protocol.js';
8719
8720
  import type { RegisteredProvider } from './provider.js';
8720
8721
  /** A vault slot name. */
@@ -8745,9 +8746,10 @@ export interface ModelBinding extends z.infer<typeof commonModelSettingsSchema>
8745
8746
  keySlot?: string;
8746
8747
  fallbackKeySlot?: string;
8747
8748
  options?: JsonObject;
8749
+ limits?: ProviderLimits;
8748
8750
  }
8749
8751
  /** A decision profile's model: no generation settings, and a time limit. */
8750
- export interface DecisionModelBinding extends Pick<ModelBinding, 'protocol' | 'provider' | 'apiId' | 'keySlot' | 'fallbackKeySlot' | 'options'> {
8752
+ export interface DecisionModelBinding extends Pick<ModelBinding, 'protocol' | 'provider' | 'apiId' | 'keySlot' | 'fallbackKeySlot' | 'options' | 'limits'> {
8751
8753
  timeoutMs?: number;
8752
8754
  }
8753
8755
  export declare const modelBindingSchema: z.ZodType<ModelBinding>;
@@ -8942,12 +8944,25 @@ export interface ToolOutputHooks<TOut = unknown> {
8942
8944
  /** For a tool whose result names pictures by address; function tools return the bytes themselves as \`parts\`. */
8943
8945
  export interface ToolImageHooks<TOut = unknown> {
8944
8946
  /**
8945
- * The https addresses of pictures in \`output\` the model should see, at most \`MAX_TOOL_IMAGES\`
8946
- * of them. After the result passes the output guard, the kernel fetches each one through the
8947
- * profile's network policy, without the tool's credentials, and hands the model the image as a
8948
- * part; one it cannot fetch is an \`images_unfetched\` warning, never a failed call.
8947
+ * The https addresses of pictures in \`output\` the model should see. After the result passes the
8948
+ * output guard, the kernel fetches each one through the profile's network policy, without the
8949
+ * tool's credentials, and hands the model the image as a part; one it cannot fetch is an
8950
+ * \`images_unfetched\` warning, never a failed call.
8949
8951
  */
8950
8952
  images?: (output: TOut) => string[];
8953
+ /** How many of those pictures the kernel fetches, how large, and how slowly. Left out, there is no limit. */
8954
+ imageLimits?: ToolImageLimits;
8955
+ }
8956
+ /** Each limit left out is no limit. A picture past one is left out, not cut. */
8957
+ export interface ToolImageLimits {
8958
+ /** The most pictures one call hands the model; the first ones named are kept. */
8959
+ count?: number;
8960
+ /** The largest picture fetched. */
8961
+ bytes?: number;
8962
+ /** The most one call hands the model in all. */
8963
+ totalBytes?: number;
8964
+ /** How long each picture may take. */
8965
+ timeoutMs?: number;
8951
8966
  }
8952
8967
  export interface FunctionToolDef<TIn = unknown, TOut = unknown> extends ToolBase, ToolHostHooks<TIn>, ToolOutputHooks<TOut> {
8953
8968
  type: 'function';
@@ -9005,6 +9020,8 @@ export interface HttpToolDef<TIn = unknown, TOut = unknown> extends ToolBase, To
9005
9020
  };
9006
9021
  /** The service's own limit for one key; the kernel keeps this tool's requests within it. */
9007
9022
  limit?: HttpToolLimit;
9023
+ /** The most of a response body the kernel reads; past it the call fails \`response_too_large\`. Left out, there is no limit. */
9024
+ maxResponseBytes?: number;
9008
9025
  /**
9009
9026
  * How long the service may take to answer, its body read included. Past it the call
9010
9027
  * fails \`timeout\` and frees its place in the limit. Left out, a call waits as long as
@@ -9025,6 +9042,17 @@ export interface McpToolDef<TIn = unknown, TOut = unknown> extends ToolBase, Too
9025
9042
  mcpToolName: string;
9026
9043
  headers?: Record<string, string>;
9027
9044
  auth?: ToolAuthConfig;
9045
+ /** The most of a response body the kernel reads; past it the call fails \`response_too_large\`. Left out, there is no limit. */
9046
+ maxResponseBytes?: number;
9047
+ /** How long and how many of this tool's server sessions the kernel keeps. Left out, there is no limit. */
9048
+ session?: McpSessionLimits;
9049
+ }
9050
+ /** The sessions an MCP tool keeps: each field left out is no limit. */
9051
+ export interface McpSessionLimits {
9052
+ /** How long a session may sit unused before the next call opens a new one, in milliseconds. */
9053
+ idleMs?: number;
9054
+ /** The most sessions the tool keeps open; past it the least recently used is dropped. */
9055
+ max?: number;
9028
9056
  }
9029
9057
  /**
9030
9058
  * What an agent tool call carries: the text, and whatever else the called
@@ -9289,7 +9317,7 @@ import { type JsonObject } from '../json.js';
9289
9317
  import type { KeyVault } from '../registry/vault.js';
9290
9318
  import type { DecisionResult, KeySlot } from '../types.js';
9291
9319
  import { type DecisionModelBinding, type ModelBinding } from './binding.js';
9292
- import { type ProviderLimits } from './limits.js';
9320
+ import type { ProviderLimits } from './limits.js';
9293
9321
  import type { DecisionCall, EmbeddingCall, EmbeddingResult, ModelProfileType, ProtocolOperations } from './protocol.js';
9294
9322
  import type { RegisteredProvider } from './provider.js';
9295
9323
  /** Opens a WebSocket with the headers and subprotocols a sign-in put on it. */
@@ -9304,7 +9332,8 @@ export type OpenWebSocket = (url: string, init: {
9304
9332
  export declare function plainWebSocket(provider: string): OpenWebSocket;
9305
9333
  /** What a host lends every provider call: its keys, its network, its clock, and its budgets. */
9306
9334
  export interface ProviderHostOptions {
9307
- limits?: Partial<ProviderLimits>;
9335
+ /** Overrides the model's own \`limits\`, one field at a time. */
9336
+ limits?: ProviderLimits;
9308
9337
  vault?: KeyVault;
9309
9338
  fetch?: typeof fetch;
9310
9339
  wait?: Wait;
@@ -9652,7 +9681,7 @@ declare function kindOfHttpStatus(status: number): ErrorKind;
9652
9681
  declare function errorCopyText(copy: ErrorCopies, labels?: LabelOverrides): string;
9653
9682
  /** Pass the profile's \`labels\`, or the profile's wording is skipped. */
9654
9683
  declare function publicError(err: unknown, labels?: LabelOverrides): string;
9655
- /** Raw diagnostic for hosts, traces, and logs; never shown to end users. */
9684
+ /** Raw diagnostic for hosts, traces, and logs; never shown to end users. Each cause that says something new follows on its own line. */
9656
9685
  declare function describeError(err: unknown): string;
9657
9686
  type ProducedError = TurnEventOf<'error'> & {
9658
9687
  errorInternal: string;
@@ -9866,12 +9895,12 @@ export declare const openRouterOpenAi: Protocol<OpenRouterOptions>;
9866
9895
  `,"file:///node_modules/@theoremjs/agents/src/providers/openrouter/images-protocol.d.ts":`import { type Protocol } from '../../kernel/protocols/mod.js';
9867
9896
  /** OpenRouter's image generation: \`/images\`, or the chat path with its image tool when text is wanted too. */
9868
9897
  export declare const openRouterImages: Protocol<Record<string, never>>;
9869
- `,"file:///node_modules/@theoremjs/agents/src/providers/openrouter/embedding-protocol.d.ts":`import { type Protocol } from '../../kernel/protocols/mod.js';
9870
- /** What an \`openRouterEmbedding\` binding sets in \`options\`. */
9871
- export interface OpenRouterEmbeddingOptions {
9898
+ `,"file:///node_modules/@theoremjs/agents/src/providers/openrouter/embeddings-protocol.d.ts":`import { type Protocol } from '../../kernel/protocols/mod.js';
9899
+ /** What an \`openRouterEmbeddings\` binding sets in \`options\`. */
9900
+ export interface OpenRouterEmbeddingsOptions {
9872
9901
  encodingFormat?: 'float' | 'base64';
9873
9902
  }
9874
- export declare const openRouterEmbedding: Protocol<OpenRouterEmbeddingOptions>;
9903
+ export declare const openRouterEmbeddings: Protocol<OpenRouterEmbeddingsOptions>;
9875
9904
  `,"file:///node_modules/@theoremjs/agents/src/providers/openrouter/decisions-protocol.d.ts":`import { type Protocol } from '../../kernel/protocols/mod.js';
9876
9905
  /**
9877
9906
  * OpenRouter's decision API: questions about a state, answered in one call. It takes no options:
@@ -9888,13 +9917,13 @@ export interface LocalConnection {
9888
9917
  }
9889
9918
  /** A server on your machine or network that speaks OpenAI's chat API: Ollama, llama.cpp, vLLM, LM Studio. */
9890
9919
  export declare const localProvider: Provider<LocalConnection, string>;
9891
- `,"file:///node_modules/@theoremjs/agents/src/providers/local/embedding-protocol.d.ts":`import { type Protocol } from '../../kernel/protocols/mod.js';
9892
- /** What an \`ollamaEmbedding\` binding sets in \`options\`. */
9893
- export interface OllamaEmbeddingOptions {
9920
+ `,"file:///node_modules/@theoremjs/agents/src/providers/local/embeddings-protocol.d.ts":`import { type Protocol } from '../../kernel/protocols/mod.js';
9921
+ /** What an \`ollamaEmbeddings\` binding sets in \`options\`. */
9922
+ export interface OllamaEmbeddingsOptions {
9894
9923
  truncate?: boolean;
9895
9924
  dimensions?: number;
9896
9925
  }
9897
- export declare const ollamaEmbedding: Protocol<OllamaEmbeddingOptions>;
9926
+ export declare const ollamaEmbeddings: Protocol<OllamaEmbeddingsOptions>;
9898
9927
  `,"file:///node_modules/@theoremjs/agents/src/providers/gemini/provider.d.ts":`import { type Provider } from '../../kernel/protocols/provider.js';
9899
9928
  /** What registering \`geminiProvider\` takes as \`connection\`. */
9900
9929
  export interface GeminiConnection {
@@ -9913,14 +9942,14 @@ export interface GeminiInteractionsOptions {
9913
9942
  }
9914
9943
  /** Gemini's Interactions API: text, images, and speech, all at \`/interactions\`. */
9915
9944
  export declare const geminiInteractions: Protocol<GeminiInteractionsOptions>;
9916
- `,"file:///node_modules/@theoremjs/agents/src/providers/gemini/embedding-protocol.d.ts":`import type { Protocol } from '../../kernel/protocols/protocol.js';
9917
- /** What a \`geminiEmbedding\` binding sets in \`options\`. */
9918
- export interface GeminiEmbeddingOptions {
9945
+ `,"file:///node_modules/@theoremjs/agents/src/providers/gemini/embeddings-protocol.d.ts":`import type { Protocol } from '../../kernel/protocols/protocol.js';
9946
+ /** What a \`geminiEmbeddings\` binding sets in \`options\`. */
9947
+ export interface GeminiEmbeddingsOptions {
9919
9948
  /** For \`gemini-embedding-001\`; Gemini Embedding 2 refuses it and reads the request's \`task\` from the text. */
9920
9949
  taskType?: 'RETRIEVAL_QUERY' | 'RETRIEVAL_DOCUMENT' | 'SEMANTIC_SIMILARITY' | 'CLASSIFICATION' | 'CLUSTERING' | 'QUESTION_ANSWERING' | 'FACT_VERIFICATION' | 'CODE_RETRIEVAL_QUERY';
9921
9950
  outputDimensionality?: 768 | 1536 | 3072;
9922
9951
  }
9923
- export declare const geminiEmbedding: Protocol<GeminiEmbeddingOptions>;
9952
+ export declare const geminiEmbeddings: Protocol<GeminiEmbeddingsOptions>;
9924
9953
  `,"file:///node_modules/@theoremjs/agents/src/providers/embedding-limits.d.ts":`import type { ModelBinding } from '../kernel/protocols/binding.js';
9925
9954
  import type { EmbeddingModelLimits, Protocol } from '../kernel/protocols/protocol.js';
9926
9955
  /**
@@ -10639,14 +10668,19 @@ export { createToolRegistry };
10639
10668
  * Sessions for MCP servers that refuse a call without one. A session is a cache, not state: it
10640
10669
  * lives in memory on one tool registry, is never persisted, and losing it costs one reopen.
10641
10670
  */
10671
+ import type { McpSessionLimits } from './types.js';
10642
10672
  export type McpSession = {
10643
10673
  id: string;
10644
10674
  protocolVersion: string;
10645
10675
  };
10676
+ /** The tool a session is used for, and that tool's own \`session\` limits. */
10677
+ export interface McpSessionUse extends McpSessionLimits {
10678
+ tool: string;
10679
+ }
10646
10680
  export interface McpSessionCache {
10647
- get(key: string): McpSession | undefined;
10681
+ get(key: string, use: McpSessionUse): McpSession | undefined;
10648
10682
  /** Parallel callers for one key share a single \`open\`. */
10649
- open(key: string, open: () => Promise<McpSession>): Promise<McpSession>;
10683
+ open(key: string, use: McpSessionUse, open: () => Promise<McpSession>): Promise<McpSession>;
10650
10684
  /** Only drops the session if it's still \`id\`, so a late expiry can't evict a newer one. */
10651
10685
  drop(key: string, id: string): void;
10652
10686
  clear(): void;
@@ -10797,8 +10831,6 @@ export declare function refusedCredentialOutcome(tool: {
10797
10831
  name: string;
10798
10832
  auth?: ToolAuthConfig;
10799
10833
  }, refusal: CredentialRefusal | undefined, carried: boolean, ctx: ToolContext, base: ToolCallBase): Generator<TurnEvent, ToolBodyOutcome | undefined>;
10800
- /** The most of a tool's response body the kernel reads; past it the call fails instead of exhausting the host's memory. */
10801
- export declare const MAX_TOOL_RESPONSE_BYTES: number;
10802
10834
  /** Every string in \`value\` with the credential replaced. */
10803
10835
  export declare function omitSecret(value: unknown, secret: string): unknown;
10804
10836
  /** A failure's message and details with the credential replaced. */
@@ -11549,6 +11581,8 @@ interface Detection {
11549
11581
  text?: string;
11550
11582
  /** Every match, each named for its detector. */
11551
11583
  hits: GuardrailHit[];
11584
+ /** Why a host's \`find\` failed, for the builder only: it reaches \`guardrail.errorInternal\`. */
11585
+ errorInternal?: string;
11552
11586
  }
11553
11587
  declare function stronger(left: DetectOutcome, right: DetectOutcome | 'ignore'): DetectOutcome;
11554
11588
  /**
@@ -11578,8 +11612,6 @@ declare const SCOPED: readonly ["canary_leak", "prompt_leak"];
11578
11612
  declare function isScoped(detector: Detector): detector is (typeof SCOPED)[number];
11579
11613
  /** The host's own detectors that read \`boundary\`. */
11580
11614
  declare function hostAt(boundary: Boundary, detect: ResolvedDetect): HostDetector[];
11581
- /** Refuses a text the person or host sent that is over \`MAX_INBOUND_CHARS\`; \`where\` names it for the log. */
11582
- declare function refuseOverlong(text: string, where: string): void;
11583
11615
  /** Reads \`text\` as it crosses \`boundary\` under the profile's resolved matrix. */
11584
11616
  declare function detectAt(text: string, boundary: Boundary, detect: ResolvedDetect, scope?: DetectScope): Detection;
11585
11617
  /** The detectors that read \`boundary\`: every one not set to \`ignore\`. */
@@ -11630,7 +11662,7 @@ declare function storedHostSpans(text: string, detect?: ResolvedDetect): RedactS
11630
11662
  interface BoundaryReader {
11631
11663
  /** The text to let through, or \`''\` once a match blocks: the caller reads \`found().action\`. */
11632
11664
  read(text: string): string;
11633
- found(): Pick<Detection, 'action' | 'hits'>;
11665
+ found(): Pick<Detection, 'action' | 'hits' | 'errorInternal'>;
11634
11666
  }
11635
11667
  /** A reader for everything crossing \`boundary\` in one request. */
11636
11668
  declare function boundaryReader(boundary: Boundary, detect: ResolvedDetect): BoundaryReader;
@@ -11638,9 +11670,9 @@ declare function boundaryReader(boundary: Boundary, detect: ResolvedDetect): Bou
11638
11670
  * The guardrail event for what was found at a boundary, or \`undefined\` when nothing matched.
11639
11671
  * \`stage\` is the boundary's own unless the text was read as it streamed.
11640
11672
  */
11641
- declare function detectEvent(boundary: Boundary, found: Pick<Detection, 'action' | 'hits'>, provenance?: Provenance, stage?: GuardrailStage): GuardrailEvent | undefined;
11673
+ declare function detectEvent(boundary: Boundary, found: Pick<Detection, 'action' | 'hits' | 'errorInternal'>, provenance?: Provenance, stage?: GuardrailStage): GuardrailEvent | undefined;
11642
11674
  export type { BoundaryReader, Detection, DetectOutcome, DetectScope, Release, StoredSides, StreamRead, Stretch, };
11643
- export { boundaryReader, detectAt, detectEvent, detectorsAt, detectReads, detectRelease, hostAt, isScoped, leakScopeOf, redactDetectors, refuseOverlong, scopeOf, storedHostSpans, storedSpans, stronger, };
11675
+ export { boundaryReader, detectAt, detectEvent, detectorsAt, detectReads, detectRelease, hostAt, isScoped, leakScopeOf, redactDetectors, scopeOf, storedHostSpans, storedSpans, stronger, };
11644
11676
  `,"file:///node_modules/@theoremjs/agents/src/guardrails/egress.d.ts":`import type { ModelEvent } from '../kernel/types.js';
11645
11677
  import type { ResolvedDetect } from './detectors.js';
11646
11678
  import type { GuardrailContext, GuardrailHit } from './types.js';
@@ -11790,7 +11822,7 @@ import type { TraceSink } from '../../observability/trace-sink.js';
11790
11822
  import type { ProviderHostOptions } from '../protocols/runtime.js';
11791
11823
  import type { KernelRegistry } from '../registry/kernel-registry.js';
11792
11824
  import type { DecisionProfile, DecisionRequest, DecisionResult } from '../types.js';
11793
- /** Where the provider takes decision requests, as its preset states. */
11825
+ /** Each decision failure code, and the error kind it reads as. */
11794
11826
  declare const DECISION_ERROR_KINDS: {
11795
11827
  readonly invalid_request: "request";
11796
11828
  readonly authentication: "auth";
@@ -11823,8 +11855,8 @@ export declare function validateDecisionRequest(request: Omit<DecisionRequest, '
11823
11855
  questions: unknown;
11824
11856
  }, profile: DecisionProfile): asserts request is DecisionRequest;
11825
11857
  /**
11826
- * Exactly one decision request, traced however it ends. An ambiguous POST is never retried,
11827
- * and a trace write failure never changes the decision's outcome.
11858
+ * One decision, traced however it ends. A transient failure (408, 429, a 5xx gateway or a network
11859
+ * error) is retried within five seconds; a trace write failure never changes the decision's outcome.
11828
11860
  */
11829
11861
  export declare function runDecisionInRegistry(registry: KernelRegistry, request: DecisionRequest, options: RunDecisionOptions): Promise<DecisionResult>;
11830
11862
  export {};
@@ -12163,7 +12195,7 @@ declare function sanitizeProjectId(id: string | undefined): string | undefined;
12163
12195
  */
12164
12196
  declare function sanitizeHistory(history: TurnHistoryMessage[], reader: BoundaryReader): TurnHistoryMessage[];
12165
12197
  /** The error a turn ends on when a detector set to \`block\` matched at \`boundary\`. */
12166
- declare function requestRefused(boundary: Boundary): TheoremError;
12198
+ declare function requestRefused(boundary: Boundary, reason?: string): TheoremError;
12167
12199
  /** A turn request read at each boundary it crosses. */
12168
12200
  interface SanitizedTurnRequest {
12169
12201
  request: NormalizedTurnRequest;
@@ -12231,7 +12263,7 @@ export { errorCopiesSchema, errorKindSchema, guardrailEventSchema } from './even
12231
12263
  export { guardrailFromHits, guardrailFromVerdict, guardrailTurnEvent, projectGuardrailTurnEvent, } from './events.js';
12232
12264
  export { hitFromSpan, projectGuardrailEvent, } from './hits.js';
12233
12265
  export type { CompiledPatterns, HostPattern } from './host-patterns.js';
12234
- export { listsPatterns, MAX_PATTERN_LENGTH, MAX_PATTERNS, patternListProblem, } from './host-patterns.js';
12266
+ export { listsPatterns, patternListProblem, } from './host-patterns.js';
12235
12267
  export { injectionSpans } from './injection.js';
12236
12268
  export type { ClientLabelKey, LabelKey, LabelOverrides, LabelParams } from './labels.js';
12237
12269
  export { CLIENT_LABEL_KEYS, LABEL_KEYS, labelCatalogRows, labelDefault, labelText, overrideLabels, resetLabels, validateLabelOverrides, } from './labels.js';
@@ -12256,7 +12288,7 @@ export type { Directive, DirectiveSignal } from './tool-directives.js';
12256
12288
  export { advisoryLevel, DIRECTIVE_SIGNALS, directives } from './tool-directives.js';
12257
12289
  export type { GuardedToolText, InspectedToolArguments } from './tool-result.js';
12258
12290
  export { checkTaintGate, composeToolText, guardToolFailureText, guardToolResult, inspectToolArguments, isRemoteOrigin, isSuspicious, isTainted, recordTaint, TOOL_CLOSE, toolCallEvent, wrapToolData, } from './tool-result.js';
12259
- export type { AdvisoryLevel, BlockedReplyOnBlock, BlockedReplySpec, DestinationGate, GuardrailAction, GuardrailContext, GuardrailEvent, GuardrailHit, GuardrailStage, HostGuardrailsSpec, NetworkGuardrailSpec, OutboundPayload, ProfileGuardrailsSpec, Provenance, QuotaGuardrailSpec, ResolvedBlockedReply, ResolvedGuardrailPolicy, Severity, TaintGate, TaintGuardrailSpec, ToolOrigin, TrustLevel, TurnTaint, Verdict, } from './types.js';
12291
+ export type { AdvisoryLevel, BlockedReplyOnBlock, BlockedReplySpec, DecisionDisclosureEnforcer, DecisionDisclosureVerdict, DecisionGuardrailsSpec, DestinationGate, GuardrailAction, GuardrailContext, GuardrailEvent, GuardrailHit, GuardrailStage, HostGuardrailsSpec, NetworkGuardrailSpec, OutboundPayload, ProfileGuardrailsSpec, Provenance, QuotaGuardrailSpec, ResolvedBlockedReply, ResolvedGuardrailPolicy, Severity, TaintGate, TaintGuardrailSpec, ToolOrigin, TrustLevel, TurnTaint, Verdict, } from './types.js';
12260
12292
  export { ADVISORY_LEVELS, BLOCKED_REPLY_ON_BLOCK, DESTINATION_GATES, GUARDRAIL_STAGES, SEVERITIES, TAINT_GATES, TOOL_ORIGINS, TRUST_LEVELS, } from './types.js';
12261
12293
  `,"file:///node_modules/@theoremjs/agents/src/guardrails/tool-result.d.ts":`import type { ToolBoundary } from './boundaries.js';
12262
12294
  import { type DetectScope } from './detect-at.js';
@@ -12430,8 +12462,8 @@ declare const CARD_CANDIDATE: RegExp;
12430
12462
  interface SensitivePattern {
12431
12463
  group: SensitiveGroup;
12432
12464
  pattern: RegExp;
12433
- /** Whether a match at \`at\` of \`text\` counts. */
12434
- hit?: (match: string, text: string, at: number) => boolean;
12465
+ /** Whether a match at \`at\` of \`text\` counts; \`lower\` is \`text\` in lower case. */
12466
+ hit?: (match: string, text: string, at: number, lower?: () => string) => boolean;
12435
12467
  }
12436
12468
  /** Every pattern, with its group. */
12437
12469
  declare const SENSITIVE_PATTERNS: readonly SensitivePattern[];