@theoremjs/agents 0.3.5-next.906.g6f050f4 → 0.3.5-next.911.g193d75c

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 (48) hide show
  1. package/README.md +3 -3
  2. package/esm/mod.d.ts +1 -1
  3. package/esm/mod.js +1 -1
  4. package/esm/src/guardrails/labels.d.ts +1 -1
  5. package/esm/src/guardrails/labels.js +4 -0
  6. package/esm/src/guardrails/sanitize.js +1 -1
  7. package/esm/src/interface/history.js +2 -2
  8. package/esm/src/kernel/auth/types.d.ts +2 -2
  9. package/esm/src/kernel/engine/runner/steps.js +0 -5
  10. package/esm/src/kernel/engine/usage.d.ts +1 -1
  11. package/esm/src/kernel/engine/usage.js +1 -1
  12. package/esm/src/kernel/field-docs.js +2 -2
  13. package/esm/src/kernel/interaction-parts.d.ts +0 -2
  14. package/esm/src/kernel/interaction-parts.js +0 -10
  15. package/esm/src/kernel/mod.d.ts +3 -3
  16. package/esm/src/kernel/mod.js +3 -3
  17. package/esm/src/kernel/registry/profiles.js +2 -1
  18. package/esm/src/kernel/schema.d.ts +2 -12
  19. package/esm/src/kernel/schema.js +3 -9
  20. package/esm/src/kernel/stop.d.ts +0 -4
  21. package/esm/src/kernel/stop.js +0 -50
  22. package/esm/src/kernel/tools/events.js +3 -2
  23. package/esm/src/kernel/tools/execute.js +5 -4
  24. package/esm/src/kernel/tools/remote.d.ts +3 -2
  25. package/esm/src/kernel/tools/remote.js +4 -3
  26. package/esm/src/kernel/tools/schema-issues.d.ts +24 -0
  27. package/esm/src/kernel/tools/schema-issues.js +28 -0
  28. package/esm/src/kernel/tools/stage-run.js +2 -1
  29. package/esm/src/kernel/tools/types.d.ts +10 -8
  30. package/esm/src/kernel/turn-events.d.ts +8 -10
  31. package/esm/src/kernel/types.d.ts +7 -22
  32. package/esm/src/observability/trace-catalog.js +6 -9
  33. package/esm/src/providers/built-in.d.ts +2 -0
  34. package/esm/src/providers/built-in.js +11 -0
  35. package/esm/src/providers/google/interactions/framing.d.ts +2 -1
  36. package/esm/src/providers/google/interactions/framing.js +15 -8
  37. package/esm/src/providers/google/interactions/status.d.ts +3 -0
  38. package/esm/src/providers/google/interactions/status.js +23 -0
  39. package/esm/src/providers/google/interactions/steps.js +1 -1
  40. package/esm/src/providers/mod.d.ts +5 -1
  41. package/esm/src/providers/mod.js +4 -1
  42. package/esm/src/providers/open-ai/finish-reason.d.ts +3 -0
  43. package/esm/src/providers/open-ai/finish-reason.js +27 -0
  44. package/esm/src/providers/open-ai/protocol.js +1 -1
  45. package/esm/src/providers/openrouter/images-protocol.js +1 -1
  46. package/esm/src/providers/openrouter/protocol.d.ts +19 -1
  47. package/esm/src/providers/openrouter/protocol.js +4 -1
  48. package/package.json +1 -1
package/README.md CHANGED
@@ -460,13 +460,13 @@ Named exports from the root barrel (same symbols hosts get from `@theoremjs/agen
460
460
  | Runner | `runTurn`, `runSession`, `runDecision`, `runEmbedding`, `validateDecisionRequest`, `RunSessionOptions`, `SignInGatePolicy`, `LiveLines`, `LiveLine`, `LiveLineRole`, `RunDecisionOptions`, `DecisionError`, `prepareLiveInboundText`, `liveIngressEnabled`, `liveIngressEnabledFromSpec`, `liveIngressChannelDefault`, `hasAnyLiveIngress`, `assertLiveIngress`, `assertLiveIngressConfigured`, `LiveIngressChannel` |
461
461
  | Attachments | `attachmentIssues`, `attachmentIssueCopy`, `attachmentIssueText`, `attachmentsRefused`, `assertTurnAttachments`, `base64Bytes`, `maxBytesForMime`, `requireMediaLimits`, `resolveMediaLimits`, `sanitizeCsvText`, `sanitizeTurnBlobs`, `embeddingMediaIssues`, `embeddingRules`, `AttachmentFacts`, `AttachmentRules`, `EmbeddingRules` |
462
462
  | Catalog | `clampThinkingLevel`, `clampThinkingLevelForApiId`, `mediaChannelForMime`, `MediaInputChannel`, `mediaKindForMime`, `mimeAllowed`, `mimeEssence`, `modelEntryByApiId`, `requireModelBinding` |
463
- | Schema | `PROFILE_FIELDS`, `PROFILE_GRAPH`, `PROFILE_TYPES`, `PROFILE_ID_MAX_CHARS`, `PROFILE_HANDLE_MAX_CHARS`, `EXTRA_FIELDS`, `REQUEST_FIELDS`, `API_EXPORTS`, `fieldMeta`, `catalogPathFor`, `DYNAMIC_FIELD_PARENTS`, `spineFacetsForProfileType`, `profileGraphFacet`, `ProfileGraphFacet`, `ProfileGraphFacetId`, `ProfileGraphEditor`, `ProfileGraphRole`, `THINKING_LEVELS`, `KEY_SLOT_NAME`, `isKeySlotName`, `MEDIA_INPUT_KINDS`, `MEDIA_INPUT_KIND_VALUES`, `MEDIA_WILDCARDS`, `ATTACHMENT_ACCEPT_MIMES`, `IMAGE_ATTACHMENT_ACCEPT_MIMES`, `VOICE_ACCEPT_MIMES`, `SUMMARY_MODES`, `STREAM_MODES`, `SPEECH_AUDIO_FORMATS`, `COMPACTION_METERS`, `COMPACTION_OUTCOMES`, `COMPACTION_TIMINGS`, `CACHE_MODES`, `CACHE_TTLS`, `TURN_STAGES`, `TURN_INJECT_STAGES`, `TURN_STOP_KINDS`, `CONTINUE_STOP_KINDS`, `TOOL_GATE_KINDS`, `AWAITING_USER_INPUT_KINDS`, `AWAITING_USER_INPUT_STATUS`, `TOOL_LOAD_TIERS`, `TOOL_ACCESS`, `TOOL_PERMISSION`, `TOOL_TYPES`, `AUTH_UNAUTHENTICATED_POLICIES`, `HTTP_METHODS`, `STUDIO_AUTH_TYPES`, `TOOL_AUTH_TYPES`, `AuthUnauthenticatedPolicy`, `CustomToolType`, `HttpMethod`, `StudioAuthType`, `ToolAccess`, `ToolAuthType`, `ToolPermission`, `ToolType`, `LIVE_ACTIVITY_HANDLINGS`, `LIVE_START_SENSITIVITIES`, `LIVE_END_SENSITIVITIES` |
463
+ | Schema | `PROFILE_FIELDS`, `PROFILE_GRAPH`, `PROFILE_TYPES`, `PROFILE_ID_MAX_CHARS`, `PROFILE_HANDLE_MAX_CHARS`, `EXTRA_FIELDS`, `REQUEST_FIELDS`, `API_EXPORTS`, `fieldMeta`, `catalogPathFor`, `DYNAMIC_FIELD_PARENTS`, `spineFacetsForProfileType`, `profileGraphFacet`, `ProfileGraphFacet`, `ProfileGraphFacetId`, `ProfileGraphEditor`, `ProfileGraphRole`, `THINKING_LEVELS`, `KEY_SLOT_NAME`, `isKeySlotName`, `MEDIA_INPUT_KINDS`, `MEDIA_INPUT_KIND_VALUES`, `MEDIA_WILDCARDS`, `ATTACHMENT_ACCEPT_MIMES`, `IMAGE_ATTACHMENT_ACCEPT_MIMES`, `VOICE_ACCEPT_MIMES`, `SUMMARY_MODES`, `STREAM_MODES`, `SPEECH_AUDIO_FORMATS`, `COMPACTION_METERS`, `COMPACTION_OUTCOMES`, `COMPACTION_TIMINGS`, `TURN_STAGES`, `TURN_INJECT_STAGES`, `TURN_STOP_KINDS`, `CONTINUE_STOP_KINDS`, `TOOL_GATE_KINDS`, `AWAITING_USER_INPUT_KINDS`, `AWAITING_USER_INPUT_STATUS`, `TOOL_LOAD_TIERS`, `TOOL_ACCESS`, `TOOL_PERMISSION`, `TOOL_TYPES`, `AUTH_UNAUTHENTICATED_POLICIES`, `HTTP_METHODS`, `STUDIO_AUTH_TYPES`, `TOOL_AUTH_TYPES`, `AuthUnauthenticatedPolicy`, `CustomToolType`, `HttpMethod`, `StudioAuthType`, `ToolAccess`, `ToolAuthType`, `ToolPermission`, `ToolType`, `LIVE_ACTIVITY_HANDLINGS`, `LIVE_START_SENSITIVITIES`, `LIVE_END_SENSITIVITIES` |
464
464
  | Scope | `KernelScope`, `createKernelScope`, `defaultKernelScope`, `KernelRegistry`, `createKernelRegistry` |
465
465
  | Profiles | `ProfileDefinition`, `ProfileDefinitionBase`, `TextProfileDefinition`, `ImageProfileDefinition`, `SpeechProfileDefinition`, `TranscriptionProfileDefinition`, `LiveProfileDefinition`, `HostProfileDefinition`, `DecisionProfileDefinition`, `EmbeddingProfileDefinition`, `ProfileRegistry`, `createProfileRegistry`, `clearProfiles`, `defineProfile`, `getProfile`, `hasProfile`, `listProfiles`, `registerProfile`, `registerProfiles`, `projectProfile`, `resolveTurn`, `pickModel`, `resolveTurnSystemPrompt`, `systemLinesProblem` |
466
466
  | Tools | `ToolContext`, `GateReference`, `gateReferenceSchema`, `ToolRegistry`, `assertToolSettings`, `createToolRegistry`, `registerTool`, `registerTools`, `invokeTool`, `invokeToolStep`, `runTool`, `runToolStep`, `SettledToolCall`, `ToolCallResult`, `ToolStepCallResult`, `GATE_DECISIONS`, `GateDecision`, `askUserTool`, `registerHarnessTools`, `getTool`, `hasTool`, `requireTool`, `listTools`, `resetTools`, `formatToolResult`, `prepareTurnToolSnapshot`, `buildHttpToolTarget`, `executeHttpTool`, `executeMcpTool`, `parseMcpRpcResponse`, `isUnsupportedMcpProtocolError`, `MCP_PROTOCOL_VERSIONS`, `mcpRequestMeta`, `McpProtocolVersion`, `resolveToolAuth`, `credentialPlacement`, `withCredentialQuery`, `CredentialQuery`, `uncheckedOutput`, `UncheckedOutput`, `McpRpcResponse`, `ModelToolResult`, `PageAnswer` |
467
467
  | Tool execution | `ToolBackground`, `ToolBackgroundCall`, `ToolBackgroundHandle`, `ToolBackgroundService`, `ToolBackgroundSettled`, `ToolSteerReceipt`, `ToolSteerRefusal`, `ToolOperationReply`, `toolOperationReplySchema`, `BackgroundToolEvent`, `ToolExecutionCoordinator`, `createMemoryToolExecution`, `MemoryToolExecutionOptions`, `authorizeToolReplay`, `BeginToolOperationResult`, `ToolOperationClaim`, `ToolOperationIdentity`, `ToolOperationOutcome`, `ToolOperationUncertainty`, `toolOperationOutcomeSchema`, `SavedToolInvocation`, `savedToolInvocationSchema`, `toolInvocationHash`, `TerminalToolEvent`, `PageToolDispatch`, `PageToolExecution` |
468
468
  | Structured | `SchemaRegistry`, `createSchemaRegistry`, `getStructured`, `registerStructured` |
469
- | Stop / resume | `ProfileTurnBehaviourSpec`, `MediaTurnBehaviourSpec`, `ProfileTurnResumptionSpec`, `TurnContinueFrom`, `TurnStop`, `TurnStopKind`, `ContinueStopKind`, `StepLimitMode`, `CONTINUE_STOP_KINDS`, `AUTO_CONTINUE_DELAY_MS`, `DEFAULT_ALLOW_CONTINUE`, `DEFAULT_AUTO_CONTINUE`, `GenerationStopError`, `isContinueStopKind`, `isGenerationStopError`, `isResumeableStop`, `isUserCancelledStop`, `profileAllowsSteering`, `profileAllowsInject`, `profileTurnResumption`, `shouldAutoContinue`, `turnStopFromClientStreamEnd`, `turnStopFromInteractionStatus`, `turnStopFromOpenAiFinishReason` |
469
+ | Stop / resume | `ProfileTurnBehaviourSpec`, `MediaTurnBehaviourSpec`, `ProfileTurnResumptionSpec`, `TurnContinueFrom`, `TurnStop`, `TurnStopKind`, `ContinueStopKind`, `StepLimitMode`, `CONTINUE_STOP_KINDS`, `AUTO_CONTINUE_DELAY_MS`, `DEFAULT_ALLOW_CONTINUE`, `DEFAULT_AUTO_CONTINUE`, `GenerationStopError`, `isContinueStopKind`, `isGenerationStopError`, `isResumeableStop`, `isUserCancelledStop`, `profileAllowsSteering`, `profileAllowsInject`, `profileTurnResumption`, `shouldAutoContinue`, `turnStopFromClientStreamEnd` |
470
470
  | Stages (target foundation) | `TURN_STAGES`, `TURN_INJECT_STAGES`, `STAGE_AFFORDANCES`, `STAGE_AFFORDANCE_MATRIX`, `TOOL_GATE_KINDS`, `AWAITING_USER_INPUT_KINDS`, `AWAITING_USER_INPUT_STATUS`, `applyStageResult`, `awaitingUserInputSchema`, `toolGateSchema`, `isTurnStage`, `isTurnInjectStage`, `isToolGateKind`, `isAwaitingUserInput`, `stageAllowsAffordance`, `stageEventFields`, `profileAllowsInject`, `StageAffordance`, `StageContext`, `StageResult`, `StageMutate`, `StageHandler`, `StageApplyInput`, `StageApplyOutput`, `StageApplyWarning`, `StageApplyWarningCode`, `StageEventExtra`, `AwaitingUserInput`, `ToolGate` — contract [`docs/contracts/stages.md`](https://github.com/masudl-hub/theoremai/blob/main/docs/contracts/stages.md) |
471
471
  | Turn events | `TURN_EVENT_SCHEMAS` (each kind's schema, for a wire parser), `turnEventSchema`, `turnHistoryMessageSchema`, `turnToolSnapshotSchema`, `reasoningPartSchema`, `historyHash`, `turnDoneOf`, `keptReply` (a turn's events without the replies a retry threw away), `z` (the zod these schemas are built with; compose them with it, since two copies of zod do not mix) — the event types themselves come through `export type *` from `src/kernel/types.ts` |
472
472
  | Observability | `memorySink`, `noopSink`, `readTraceparent`, `writeTrace`, `buildRecord`, `traceRecordSchema`, `contentOf`, `inlineContent`, `toOtlpJson`, `startTrace`, `traceContent`, `traceBytes`, `traceJson`, `registerTraceDestination`, `requireTraceDestination`, `getTraceDestination`, `listTraceDestinationIds`, `clearTraceDestinations`, `isTraceSink`, `resolveTraceWriter`, `resolveObservabilityPolicy`, `traceSpanMeta`, `traceAttributeMeta`, `traceEventMeta`, `traceEventAttributeMeta`, `TRACE_ATTRIBUTE_GROUPS`, `TRACE_STATUS`, `TRACE_FIELDS`, `TRACE_SPAN_TYPES`, `TraceSpanMeta`, `TraceSpanType`, `TraceAttributeMeta`, `TraceEventMeta`, `TraceOptionMeta`, `TraceAttributeGroup`, `TraceValueFormat`, `TraceRecord`, `TraceSink`, `TraceWriteContext`, `TraceSpan`, `TraceSpanEvent`, `TraceSpanKind`, `TraceSpanLink`, `TraceSpanStatus`, `TraceAttributes`, `TraceAttributeValue`, `TraceContent`, `TraceBytes`, `TraceJson`, `TraceTree`, `SpanHandle`, `SpanOptions`, `SpanLinkInput`, `TraceClock`, `ProfileObservabilitySpec`, `ResolvedObservabilityPolicy`, `ResolvedTraceInclude`, `ResolvedTraceScrub`, `TraceIncludeSpec`, `TraceScrubSpec`, `ScrubSwitch`, `ResolvedScrubSwitch`, `OtlpTraceRequest`, `OtlpSpan`, `OtlpKeyValue`, `OtlpAnyValue` (file sink: `@theoremjs/agents/observability/jsonl` → `jsonlSink`, `JsonlSinkOptions`) |
@@ -506,7 +506,7 @@ live_sessions = "registered provider via runSession; host owns mic, camera, and
506
506
  session_memory_in_kernel = false
507
507
  ```
508
508
 
509
- **Facts and policy.** Provider wire shapes and protocol metadata may ship in `@theoremjs/agents/providers`. Product policy may not ship: prompts, personas, end-user copy, demo apps, and channel behaviour. Every string that a user or a model reads is either supplied by the host or is an overridable default in the kernel labels (`overrideLabels`). Behavioural defaults are typed profile-schema fields. Optional packages, such as `studio/`, are inert extras. If you delete one, no kernel behaviour changes.
509
+ **Facts and policy.** Provider wire shapes and protocol metadata may ship in `@theoremjs/agents/providers`, and only there: the kernel makes no claim about a provider or a model. Product policy may not ship: prompts, personas, end-user copy, demo apps, and channel behaviour. Every string that a user or a model reads is either supplied by the host or is an overridable default in the kernel labels (`overrideLabels`). Behavioural defaults are typed profile-schema fields. Optional packages, such as `studio/`, are inert extras. If you delete one, no kernel behaviour changes.
510
510
 
511
511
  Four properties are invariant. Where a test or a lint checks one, the table names it.
512
512
 
package/esm/mod.d.ts CHANGED
@@ -63,7 +63,7 @@ export { createKernelScope, defaultKernelScope } from './src/kernel/scope.js';
63
63
  export type { AwaitingUserInput, StageAffordance, StageApplyInput, StageApplyOutput, StageApplyWarning, StageApplyWarningCode, StageContext, StageEventExtra, StageHandler, StageMutate, StageResult, } from './src/kernel/stages.js';
64
64
  export { applyStageResult, STAGE_AFFORDANCE_MATRIX, STAGE_AFFORDANCES, stageAllowsAffordance, stageEventFields, } from './src/kernel/stages.js';
65
65
  export type { MediaTurnBehaviourSpec, ProfileTurnBehaviourSpec, ProfileTurnResumptionSpec, TurnContinueFrom, TurnStop, } from './src/kernel/stop.js';
66
- export { AUTO_CONTINUE_DELAY_MS, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, turnStopFromInteractionStatus, turnStopFromOpenAiFinishReason, } from './src/kernel/stop.js';
66
+ export { AUTO_CONTINUE_DELAY_MS, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, } from './src/kernel/stop.js';
67
67
  export { systemLinesProblem } from './src/kernel/system-lines.js';
68
68
  export type { ToolBackground, ToolBackgroundCall, ToolBackgroundHandle, ToolBackgroundService, ToolBackgroundSettled, ToolSteerReceipt, ToolSteerRefusal, } from './src/kernel/tools/background.js';
69
69
  export { authorizeToolReplay } from './src/kernel/tools/execute.js';
package/esm/mod.js CHANGED
@@ -39,7 +39,7 @@ export { resolveTurnSystemPrompt } from './src/kernel/registry/system-prompt.js'
39
39
  export { API_EXPORTS, ATTACHMENT_ACCEPT_MIMES, AUTH_UNAUTHENTICATED_POLICIES, AWAITING_USER_INPUT_KINDS, AWAITING_USER_INPUT_STATUS, COMPACTION_METERS, COMPACTION_OUTCOMES, COMPACTION_TIMINGS, CONTINUE_STOP_KINDS, catalogPathFor, DYNAMIC_FIELD_PARENTS, EXTRA_FIELDS, fieldMeta, HTTP_METHODS, IMAGE_ATTACHMENT_ACCEPT_MIMES, isKeySlotName, isToolGateKind, isTurnInjectStage, isTurnStage, KEY_SLOT_NAME, LIVE_ACTIVITY_HANDLINGS, LIVE_END_SENSITIVITIES, LIVE_START_SENSITIVITIES, MEDIA_INPUT_KIND_VALUES, MEDIA_INPUT_KINDS, MEDIA_WILDCARDS, PROFILE_FIELDS, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, PROFILE_TYPES, REQUEST_FIELDS, SPEECH_AUDIO_FORMATS, STREAM_MODES, STUDIO_AUTH_TYPES, SUMMARY_MODES, THINKING_LEVELS, TOOL_ACCESS, TOOL_AUTH_TYPES, TOOL_GATE_KINDS, TOOL_LOAD_TIERS, TOOL_PERMISSION, TOOL_TYPES, TURN_INJECT_STAGES, TURN_STAGES, TURN_STOP_KINDS, VOICE_ACCEPT_MIMES, } from './src/kernel/schema.js';
40
40
  export { createKernelScope, defaultKernelScope } from './src/kernel/scope.js';
41
41
  export { applyStageResult, STAGE_AFFORDANCE_MATRIX, STAGE_AFFORDANCES, stageAllowsAffordance, stageEventFields, } from './src/kernel/stages.js';
42
- export { AUTO_CONTINUE_DELAY_MS, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, turnStopFromInteractionStatus, turnStopFromOpenAiFinishReason, } from './src/kernel/stop.js';
42
+ export { AUTO_CONTINUE_DELAY_MS, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, } from './src/kernel/stop.js';
43
43
  export { systemLinesProblem } from './src/kernel/system-lines.js';
44
44
  export { authorizeToolReplay } from './src/kernel/tools/execute.js';
45
45
  export { GATE_DECISIONS } from './src/kernel/tools/gate-answer.js';
@@ -1,7 +1,7 @@
1
1
  /** Values that fill a label template's `{param}` placeholders. */
2
2
  export type LabelParams = Record<string, string | number>;
3
3
  /** Keys are stable API. */
4
- 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", "turn.media_refused_image", "turn.media_refused_video", "turn.media_refused_file", "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.conflict", "error.not_found", "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.cut_off_guidance", "repair.reply_cut_off", "repair.call_cut_off", "repair.call_cut_off_guidance", "repair.nothing_written", "repair.nothing_written_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", "structured.cut_off", "structured.not_json", "compaction.request", "compaction.tool_call", "compaction.tool_result", "compaction.tool_files", "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.email", "detect.hint.phone", "detect.hint.bank_account", "detect.hint.injection", "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.full", "session.busy", "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", "stop.answer_missing", "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.hook_failed", "tool.input_invalid_after_mutate", "tool.output_invalid_after_mutate", "tool.handler_no_output", "tool.did_not_run", "tool.unreachable", "tool.page_no_answer", "tool.page_timed_out", "tool.output_invalid", "tool.not_loaded_t2", "tool.wait_unknown", "tool.wait_cycle", "tool.after_field", "tool.background_field", "tool.background_started", "tool.late_result", "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"];
4
+ 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", "turn.media_refused_image", "turn.media_refused_video", "turn.media_refused_file", "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.conflict", "error.not_found", "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.cut_off_guidance", "repair.reply_cut_off", "repair.call_cut_off", "repair.call_cut_off_guidance", "repair.nothing_written", "repair.nothing_written_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", "structured.cut_off", "structured.not_json", "compaction.request", "compaction.tool_call", "compaction.tool_result", "compaction.tool_files", "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.email", "detect.hint.phone", "detect.hint.bank_account", "detect.hint.injection", "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.full", "session.busy", "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", "stop.answer_missing", "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_host_fields", "tool.hook_failed", "tool.input_invalid_after_mutate", "tool.output_invalid_after_mutate", "tool.handler_no_output", "tool.did_not_run", "tool.unreachable", "tool.page_no_answer", "tool.page_timed_out", "tool.output_invalid", "tool.not_loaded_t2", "tool.wait_unknown", "tool.wait_cycle", "tool.after_field", "tool.background_field", "tool.background_started", "tool.late_result", "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"];
5
5
  /** One of {@linkcode LABEL_KEYS}. */
6
6
  export type LabelKey = (typeof LABEL_KEYS)[number];
7
7
  /**
@@ -186,6 +186,7 @@ export const LABEL_KEYS = [
186
186
  'tool.t2_loader_output_invalid',
187
187
  'tool.execution_uncertain',
188
188
  'tool.input_invalid',
189
+ 'tool.input_host_fields',
189
190
  'tool.hook_failed',
190
191
  'tool.input_invalid_after_mutate',
191
192
  'tool.output_invalid_after_mutate',
@@ -539,6 +540,7 @@ const DEFAULTS = {
539
540
  'tool.t2_loader_output_invalid': 'T2 loader output validation failed after promotion',
540
541
  'tool.execution_uncertain': 'This action has an unresolved execution. Check the destination before trying it again.',
541
542
  'tool.input_invalid': 'Tool input validation failed',
543
+ 'tool.input_host_fields': 'Your call to {tool} sent {fields}, which {tool} does not take. Call it again without them.',
542
544
  'tool.hook_failed': 'This tool call did not run: the app hit an error before it could start.',
543
545
  'tool.did_not_run': "Tool '{tool}' did not run.",
544
546
  'tool.unreachable': "Sorry, a tool couldn't be reached. Please try again.",
@@ -769,6 +771,7 @@ export const LABEL_NOTES = {
769
771
  'tool.t2_loader_output_invalid': "Told to the model when the T2 loader's output fails its schema after promotion.",
770
772
  'tool.execution_uncertain': 'Shown when a tool operation has no confirmed outcome and cannot execute again.',
771
773
  'tool.input_invalid': "Told to the model when a tool call's input fails the tool's input schema.",
774
+ 'tool.input_host_fields': 'Told to the model when its call sends input fields marked exposeToModel: false, which the host fills. Takes {tool} and {fields}.',
772
775
  'tool.hook_failed': "Told to the model when a host hook threw before a tool call could start. The hook's own error goes to the host as hook_failed.",
773
776
  'tool.did_not_run': 'Given by runTool and runToolStep for a call that never settled when the invoke gave no error of its own. Takes {tool}.',
774
777
  'tool.unreachable': 'Shown to the user when a tool call never reached its host. Takes {tool}.',
@@ -873,6 +876,7 @@ const LABEL_PLACEHOLDERS = {
873
876
  'tool.builtin_not_enabled': TOOL,
874
877
  'tool.provider_native': TOOL,
875
878
  'tool.not_registered': TOOL,
879
+ 'tool.input_host_fields': ['tool', 'fields'],
876
880
  'tool.builtin_needs_snapshot': TOOL,
877
881
  'tool.not_allowed': ['tool', 'profile'],
878
882
  'tool.not_eligible': TOOL,
@@ -93,7 +93,7 @@ function sanitizeHistory(history, reader) {
93
93
  ...(m.tool_call_id ? { tool_call_id: m.tool_call_id } : {}),
94
94
  ...(m.name ? { name: m.name } : {}),
95
95
  ...(m.metadata ? { metadata: m.metadata } : {}),
96
- // why: Google refuses a call from the current turn replayed without its thought signature, so a reply resumed after a gate needs it.
96
+ // why: a provider may refuse a call from the current turn replayed without its signed reasoning, so a reply resumed after a gate needs it.
97
97
  ...(m.reasoning ? { reasoning: m.reasoning } : {}),
98
98
  };
99
99
  });
@@ -109,8 +109,8 @@ function settledToolContent(call) {
109
109
  }
110
110
  /**
111
111
  * One model step's settled calls: a single assistant message holding every call
112
- * the step made, with the reasoning written before them, then each result. Google replays a
113
- * step's calls only this way. With `gated: 'open'`, a
112
+ * the step made, with the reasoning written before them, then each result, as a provider
113
+ * reads a step's calls back. With `gated: 'open'`, a
114
114
  * call waiting on its gate joins the message too, left without a result.
115
115
  */
116
116
  function appendToolStepToHistory(history, calls, gated = 'omit') {
@@ -106,8 +106,8 @@ export interface CreatePkceFlowOptions extends OAuthTransportOptions {
106
106
  /** Skips discovery. */
107
107
  preResolved?: OAuthEndpoints;
108
108
  /**
109
- * Parameters a provider reads beyond the standard ones (e.g. Google's
110
- * `access_type: 'offline'`, without which it issues no refresh token). A name the
109
+ * Parameters an authorization server reads beyond the standard ones, such as one it needs
110
+ * before it issues a refresh token. A name the
111
111
  * flow sets itself is refused.
112
112
  */
113
113
  authorizationParams?: Readonly<Record<string, string>>;
@@ -423,11 +423,6 @@ function toolResultMessage(call, result) {
423
423
  ...(result.parts && result.parts.length > 0 ? { parts: result.parts } : {}),
424
424
  };
425
425
  }
426
- /**
427
- * One step's calls as one assistant message, the way the model made them.
428
- * Providers read a step's calls together, then their results: Google rejects
429
- * a call replayed after an earlier call's result (probe 25/09/2026).
430
- */
431
426
  /** Record the approved read-back in portable history. */
432
427
  function recordToolModelResult(state, call, modelResult) {
433
428
  state.currentHistory.push(toolResultMessage(call, modelResult));
@@ -31,6 +31,6 @@ export declare function sumEventTokens(events: readonly TurnEvent[]): TurnTokens
31
31
  export declare function sumTurnTokens(events: readonly TurnEvent[]): TurnTokens | undefined;
32
32
  /**
33
33
  * A side is `estimated` when any call estimated it. Cost is `partial` when some call reported none;
34
- * a missing `upstreamUsd` is not missing data (OpenRouter reports it only for BYOK).
34
+ * a missing `upstreamUsd` is not missing data, since a provider may report it for some calls only.
35
35
  */
36
36
  export declare function sumTokens(calls: TurnTokens[]): TurnTokens | undefined;
@@ -111,7 +111,7 @@ export function sumTurnTokens(events) {
111
111
  }
112
112
  /**
113
113
  * A side is `estimated` when any call estimated it. Cost is `partial` when some call reported none;
114
- * a missing `upstreamUsd` is not missing data (OpenRouter reports it only for BYOK).
114
+ * a missing `upstreamUsd` is not missing data, since a provider may report it for some calls only.
115
115
  */
116
116
  export function sumTokens(calls) {
117
117
  if (calls.length === 0)
@@ -220,7 +220,7 @@ export const FIELD_DOCS = {
220
220
  'live.vad.silenceDurationMs': "How long a silence, in milliseconds, ends the user's speech.",
221
221
  'live.vad.startSensitivity': 'How readily the session decides the user has started speaking.',
222
222
  'live.voice': 'The voice the model speaks in.',
223
- 'local.baseUrl': 'Where your local model server listens, such as Ollama, llama.cpp or vLLM. The browser calls it directly.',
223
+ 'local.baseUrl': 'Where your local model server listens. The browser calls it directly.',
224
224
  models: 'The trained AI systems that turn input into results. Each entry binds a local name to an upstream model and its call settings.',
225
225
  'models.*': 'One model: how to reach it and the settings sent with it.',
226
226
  'models.*.allowEffortSelect': 'Lets a turn pick an effort; needs two or more efforts.',
@@ -321,7 +321,7 @@ export const FIELD_DOCS = {
321
321
  'registerTool.fieldText': 'What the calling model reads on a field of an agent tool input, such as text. A field the profile does not take is refused when the tool registers.',
322
322
  'registerTool.handler': 'Your function that runs the tool; it can also yield progress as it goes.',
323
323
  'registerTool.headers': "Headers sent with every request to the tool's own origin, never once a redirect leaves it.",
324
- 'registerTool.hostFields': 'Fields the calling model fills on an agent tool that only the host reads. onAgentCall gets them as hostInput and turns them into what the agent is sent; the agent never sees them. A name the input already has is refused when the tool registers.',
324
+ 'registerTool.hostFields': 'Fields on an agent tool that only the host reads. The calling model fills them, or the host does when a field is marked exposeToModel: false. onAgentCall gets them as hostInput and turns them into what the agent is sent; the agent never sees them. A name the input already has is refused when the tool registers.',
325
325
  'registerTool.hostOnly': 'Channels the called profile takes that the calling model cannot fill on an agent tool; only onAgentCall sends them. A channel the profile does not take is refused when the tool registers.',
326
326
  'registerTool.imageLimits': 'How many of those pictures the kernel fetches, how large, and how slowly.',
327
327
  'registerTool.images': 'The https addresses of pictures in the output the model should see. The kernel fetches each one through the profile network policy, without the tool credentials.',
@@ -1,6 +1,4 @@
1
1
  import type { InteractionMediaRefPart, InteractionPart, TurnHistoryMessage } from './types.js';
2
- /** `toGoogleValue` snake-cases `mimeType` to the documented Interactions `mime_type`. */
3
- export declare function wireInteractionPart(part: InteractionPart): Record<string, string>;
4
2
  /** True for a part that is media referenced by `uri` rather than carried as data. */
5
3
  export declare function isMediaRefPart(part: InteractionPart): part is InteractionMediaRefPart;
6
4
  /**
@@ -1,13 +1,3 @@
1
- /** `toGoogleValue` snake-cases `mimeType` to the documented Interactions `mime_type`. */
2
- export function wireInteractionPart(part) {
3
- if (part.type === 'text') {
4
- return { type: 'text', text: part.text };
5
- }
6
- if ('uri' in part) {
7
- return { type: part.type, mimeType: part.mimeType, uri: part.uri };
8
- }
9
- return { type: part.type, mimeType: part.mimeType, data: part.data };
10
- }
11
1
  /** True for a part that is media referenced by `uri` rather than carried as data. */
12
2
  export function isMediaRefPart(part) {
13
3
  return part.type !== 'text' && 'uri' in part;
@@ -20,7 +20,7 @@ export type { LiveLine, LiveLineRole, LiveLines, RunSessionOptions, SignInGatePo
20
20
  export type { TokenCount, TokenEstimator } from './engine/token-estimate.js';
21
21
  export { loadTokenEstimator, TOKEN_TEXT_ENCODING, } from './engine/token-estimate.js';
22
22
  export { sumTokens } from './engine/usage.js';
23
- export { isMediaRefPart, wireInteractionPart } from './interaction-parts.js';
23
+ export { isMediaRefPart } from './interaction-parts.js';
24
24
  export type { JsonObject, JsonValue } from './json.js';
25
25
  export { jsonObjectSchema, jsonValueSchema } from './json.js';
26
26
  export type { ProfileGraphEditor, ProfileGraphFacet, ProfileGraphFacetId, ProfileGraphRole, } from './profile-graph.js';
@@ -52,13 +52,13 @@ export { createSchemaRegistry } from './registry/schemas.js';
52
52
  export { resolveTurnSystemPrompt } from './registry/system-prompt.js';
53
53
  export type { CredentialContext, CredentialResolver, KeyCredential } from './registry/vault.js';
54
54
  export type { AuthUnauthenticatedPolicy, CustomToolType, HttpMethod, StudioAuthType, ToolAccess, ToolAuthType, ToolPermission, ToolType, } from './schema.js';
55
- export { API_EXPORTS, ATTACHMENT_ACCEPT_MIMES, AUTH_UNAUTHENTICATED_POLICIES, AWAITING_USER_INPUT_KINDS, AWAITING_USER_INPUT_STATUS, CACHE_MODES, CACHE_TTLS, COMPACTION_METERS, COMPACTION_OUTCOMES, COMPACTION_TIMINGS, CONTINUE_STOP_KINDS, catalogPathFor, EXTRA_FIELDS, fieldMeta, HTTP_METHODS, IMAGE_ATTACHMENT_ACCEPT_MIMES, isKeySlotName, isToolGateKind, isTurnInjectStage, isTurnStage, KEY_SLOT_NAME, MEDIA_INPUT_KIND_VALUES, MEDIA_INPUT_KINDS, MEDIA_WILDCARDS, PROFILE_FIELDS, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, PROFILE_TYPES, REQUEST_FIELDS, SPEECH_AUDIO_FORMATS, STREAM_MODES, STUDIO_AUTH_TYPES, SUMMARY_MODES, THINKING_LEVELS, TOOL_ACCESS, TOOL_AUTH_TYPES, TOOL_GATE_KINDS, TOOL_LOAD_TIERS, TOOL_PERMISSION, TOOL_TYPES, TURN_INJECT_STAGES, TURN_STAGES, TURN_STOP_KINDS, VOICE_ACCEPT_MIMES, } from './schema.js';
55
+ export { API_EXPORTS, ATTACHMENT_ACCEPT_MIMES, AUTH_UNAUTHENTICATED_POLICIES, AWAITING_USER_INPUT_KINDS, AWAITING_USER_INPUT_STATUS, COMPACTION_METERS, COMPACTION_OUTCOMES, COMPACTION_TIMINGS, CONTINUE_STOP_KINDS, catalogPathFor, EXTRA_FIELDS, fieldMeta, HTTP_METHODS, IMAGE_ATTACHMENT_ACCEPT_MIMES, isKeySlotName, isToolGateKind, isTurnInjectStage, isTurnStage, KEY_SLOT_NAME, MEDIA_INPUT_KIND_VALUES, MEDIA_INPUT_KINDS, MEDIA_WILDCARDS, PROFILE_FIELDS, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, PROFILE_TYPES, REQUEST_FIELDS, SPEECH_AUDIO_FORMATS, STREAM_MODES, STUDIO_AUTH_TYPES, SUMMARY_MODES, THINKING_LEVELS, TOOL_ACCESS, TOOL_AUTH_TYPES, TOOL_GATE_KINDS, TOOL_LOAD_TIERS, TOOL_PERMISSION, TOOL_TYPES, TURN_INJECT_STAGES, TURN_STAGES, TURN_STOP_KINDS, VOICE_ACCEPT_MIMES, } from './schema.js';
56
56
  export type { KernelScope } from './scope.js';
57
57
  export { createKernelScope, defaultKernelScope } from './scope.js';
58
58
  export type { AwaitingUserInput, StageAffordance, StageApplyInput, StageApplyOutput, StageApplyWarning, StageApplyWarningCode, StageContext, StageEventExtra, StageHandler, StageMutate, StageResult, } from './stages.js';
59
59
  export { applyStageResult, STAGE_AFFORDANCE_MATRIX, STAGE_AFFORDANCES, stageAllowsAffordance, stageEventFields, } from './stages.js';
60
60
  export type { MediaTurnBehaviourSpec, ProfileTurnBehaviourSpec, ProfileTurnResumptionSpec, TurnContinueFrom, TurnStop, } from './stop.js';
61
- export { AUTO_CONTINUE_DELAY_MS, CONTINUE_INSTRUCTION_TYPES, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, turnStopFromInteractionStatus, turnStopFromOpenAiFinishReason, } from './stop.js';
61
+ export { AUTO_CONTINUE_DELAY_MS, CONTINUE_INSTRUCTION_TYPES, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, } from './stop.js';
62
62
  export type { SystemReadingLine } from './system-lines.js';
63
63
  export { systemLinesProblem, systemReading } from './system-lines.js';
64
64
  export { systemPromptProblem } from './system-parts.js';
@@ -13,7 +13,7 @@ export { DecisionError, validateDecisionRequest } from './engine/decision.js';
13
13
  export { assertLiveIngress, assertLiveIngressConfigured, hasAnyLiveIngress, liveIngressChannelDefault, liveIngressEnabled, liveIngressEnabledFromSpec, } from './engine/live-ingress.js';
14
14
  export { loadTokenEstimator, TOKEN_TEXT_ENCODING, } from './engine/token-estimate.js';
15
15
  export { sumTokens } from './engine/usage.js';
16
- export { isMediaRefPart, wireInteractionPart } from './interaction-parts.js';
16
+ export { isMediaRefPart } from './interaction-parts.js';
17
17
  export { jsonObjectSchema, jsonValueSchema } from './json.js';
18
18
  export { PROFILE_GRAPH, profileGraphFacet, spineFacetsForProfileType, } from './profile-graph.js';
19
19
  export { unsetValue } from './profile-presence.js';
@@ -31,10 +31,10 @@ export { createProfileRegistry, defineProfile } from './registry/profiles.js';
31
31
  export { projectProfileObject, requireModelProfile } from './registry/resolve.js';
32
32
  export { createSchemaRegistry } from './registry/schemas.js';
33
33
  export { resolveTurnSystemPrompt } from './registry/system-prompt.js';
34
- export { API_EXPORTS, ATTACHMENT_ACCEPT_MIMES, AUTH_UNAUTHENTICATED_POLICIES, AWAITING_USER_INPUT_KINDS, AWAITING_USER_INPUT_STATUS, CACHE_MODES, CACHE_TTLS, COMPACTION_METERS, COMPACTION_OUTCOMES, COMPACTION_TIMINGS, CONTINUE_STOP_KINDS, catalogPathFor, EXTRA_FIELDS, fieldMeta, HTTP_METHODS, IMAGE_ATTACHMENT_ACCEPT_MIMES, isKeySlotName, isToolGateKind, isTurnInjectStage, isTurnStage, KEY_SLOT_NAME, MEDIA_INPUT_KIND_VALUES, MEDIA_INPUT_KINDS, MEDIA_WILDCARDS, PROFILE_FIELDS, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, PROFILE_TYPES, REQUEST_FIELDS, SPEECH_AUDIO_FORMATS, STREAM_MODES, STUDIO_AUTH_TYPES, SUMMARY_MODES, THINKING_LEVELS, TOOL_ACCESS, TOOL_AUTH_TYPES, TOOL_GATE_KINDS, TOOL_LOAD_TIERS, TOOL_PERMISSION, TOOL_TYPES, TURN_INJECT_STAGES, TURN_STAGES, TURN_STOP_KINDS, VOICE_ACCEPT_MIMES, } from './schema.js';
34
+ export { API_EXPORTS, ATTACHMENT_ACCEPT_MIMES, AUTH_UNAUTHENTICATED_POLICIES, AWAITING_USER_INPUT_KINDS, AWAITING_USER_INPUT_STATUS, COMPACTION_METERS, COMPACTION_OUTCOMES, COMPACTION_TIMINGS, CONTINUE_STOP_KINDS, catalogPathFor, EXTRA_FIELDS, fieldMeta, HTTP_METHODS, IMAGE_ATTACHMENT_ACCEPT_MIMES, isKeySlotName, isToolGateKind, isTurnInjectStage, isTurnStage, KEY_SLOT_NAME, MEDIA_INPUT_KIND_VALUES, MEDIA_INPUT_KINDS, MEDIA_WILDCARDS, PROFILE_FIELDS, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, PROFILE_TYPES, REQUEST_FIELDS, SPEECH_AUDIO_FORMATS, STREAM_MODES, STUDIO_AUTH_TYPES, SUMMARY_MODES, THINKING_LEVELS, TOOL_ACCESS, TOOL_AUTH_TYPES, TOOL_GATE_KINDS, TOOL_LOAD_TIERS, TOOL_PERMISSION, TOOL_TYPES, TURN_INJECT_STAGES, TURN_STAGES, TURN_STOP_KINDS, VOICE_ACCEPT_MIMES, } from './schema.js';
35
35
  export { createKernelScope, defaultKernelScope } from './scope.js';
36
36
  export { applyStageResult, STAGE_AFFORDANCE_MATRIX, STAGE_AFFORDANCES, stageAllowsAffordance, stageEventFields, } from './stages.js';
37
- export { AUTO_CONTINUE_DELAY_MS, CONTINUE_INSTRUCTION_TYPES, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, turnStopFromInteractionStatus, turnStopFromOpenAiFinishReason, } from './stop.js';
37
+ export { AUTO_CONTINUE_DELAY_MS, CONTINUE_INSTRUCTION_TYPES, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd, } from './stop.js';
38
38
  export { systemLinesProblem, systemReading } from './system-lines.js';
39
39
  export { systemPromptProblem } from './system-parts.js';
40
40
  export { activityLabelProblem } from './tools/activity-label.js';
@@ -13,6 +13,7 @@ import { CONTEXT_SENDERS, CONTINUE_STOP_KINDS, IMAGE_ATTACHMENT_ACCEPT_MIMES, PR
13
13
  import { isContinueStopKind } from '../stop.js';
14
14
  import { assertSystemLines, systemLinesProblem } from '../system-lines.js';
15
15
  import { profileToolAllow, profileToolsSpec } from '../tools/resolve.js';
16
+ import { issuePath } from '../tools/schema-issues.js';
16
17
  import { isTurnMediaRef } from './attachments.js';
17
18
  import { mediaKindForMime, mimeAllowed, profileInputs } from './catalog.js';
18
19
  import { optionValues, profileOption } from './options.js';
@@ -65,7 +66,7 @@ function defineTranscriptionProfile(input) {
65
66
  function assertBindingData(profileId, modelId, binding, schema) {
66
67
  const parsed = schema.safeParse(binding);
67
68
  if (!parsed.success)
68
- throw new TheoremError('config', `Profile ${profileId} model '${modelId}': ${parsed.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`).join('; ')}`);
69
+ throw new TheoremError('config', `Profile ${profileId} model '${modelId}': ${parsed.error.issues.map((issue) => `${issuePath(issue.path)}: ${issue.message}`).join('; ')}`);
69
70
  }
70
71
  function validateDecisionBinding(profileId, modelId, binding) {
71
72
  assertBindingData(profileId, modelId, binding, decisionModelBindingSchema);
@@ -73,14 +73,6 @@ export type CompactionTiming = (typeof COMPACTION_TIMINGS)[number];
73
73
  export declare const COMPACTION_OUTCOMES: readonly ["compacted", "deferred", "dropped"];
74
74
  /** One of {@linkcode COMPACTION_OUTCOMES}. */
75
75
  export type CompactionOutcome = (typeof COMPACTION_OUTCOMES)[number];
76
- /** Which part of the prompt is cached: the whole request (`automatic`) or the system instruction only (`system`). */
77
- export declare const CACHE_MODES: readonly ["automatic", "system"];
78
- /** One of {@linkcode CACHE_MODES}. */
79
- export type CacheMode = (typeof CACHE_MODES)[number];
80
- /** How long a provider keeps a cached prompt. */
81
- export declare const CACHE_TTLS: readonly ["5m", "1h"];
82
- /** One of {@linkcode CACHE_TTLS}. */
83
- export type CacheTtl = (typeof CACHE_TTLS)[number];
84
76
  /** Why a turn stopped, as `done.stop.kind` reports it. */
85
77
  export declare const TURN_STOP_KINDS: readonly ["completed", "length", "tool", "gate", "filtered", "provider_error", "cancelled", "stream_incomplete", "step_limit", "answer_missing", "interrupted", "generation_complete"];
86
78
  /** One of {@linkcode TURN_STOP_KINDS}. */
@@ -163,10 +155,8 @@ export type ToolType = (typeof TOOL_TYPES)[number];
163
155
  export type CustomToolType = Exclude<ToolType, 'builtin'>;
164
156
  /**
165
157
  * The package's complete media-input vocabulary: `assertMediaMime` refuses any MIME not
166
- * here, so hosts keep no second table. Rows follow Google Interactions / Live's documented
167
- * lists (verified 2026-09-12), the widest provider; TypeScript, `application/xml` and
168
- * `application/rtf` are not on Google's list. OpenAI-compat adapters forward the MIME
169
- * verbatim and add no rows. Provider alias essences (`image/jpg`, `video/mov`, …) are rows;
158
+ * here, so hosts keep no second table. Rows follow the widest provider's documented
159
+ * lists (verified 2026-09-12), plus TypeScript, `application/xml` and `application/rtf`. Provider alias essences (`image/jpg`, `video/mov`, …) are rows;
170
160
  * `resolveInputParts` canonicalizes `image/jpg` to `image/jpeg` on the wire.
171
161
  */
172
162
  export declare const MEDIA_INPUT_KINDS: Record<string, MediaInputKind>;
@@ -130,10 +130,6 @@ export const COMPACTION_OUTCOMES = [
130
130
  /** The compactor failed over `maxTokens`, so the compacted messages were dropped. */
131
131
  'dropped',
132
132
  ];
133
- /** Which part of the prompt is cached: the whole request (`automatic`) or the system instruction only (`system`). */
134
- export const CACHE_MODES = ['automatic', 'system'];
135
- /** How long a provider keeps a cached prompt. */
136
- export const CACHE_TTLS = ['5m', '1h'];
137
133
  /** Why a turn stopped, as `done.stop.kind` reports it. */
138
134
  export const TURN_STOP_KINDS = [
139
135
  /** The model finished its reply. */
@@ -336,10 +332,8 @@ export const STUDIO_AUTH_TYPES = [
336
332
  ];
337
333
  /**
338
334
  * The package's complete media-input vocabulary: `assertMediaMime` refuses any MIME not
339
- * here, so hosts keep no second table. Rows follow Google Interactions / Live's documented
340
- * lists (verified 2026-09-12), the widest provider; TypeScript, `application/xml` and
341
- * `application/rtf` are not on Google's list. OpenAI-compat adapters forward the MIME
342
- * verbatim and add no rows. Provider alias essences (`image/jpg`, `video/mov`, …) are rows;
335
+ * here, so hosts keep no second table. Rows follow the widest provider's documented
336
+ * lists (verified 2026-09-12), plus TypeScript, `application/xml` and `application/rtf`. Provider alias essences (`image/jpg`, `video/mov`, …) are rows;
343
337
  * `resolveInputParts` canonicalizes `image/jpg` to `image/jpeg` on the wire.
344
338
  */
345
339
  export const MEDIA_INPUT_KINDS = {
@@ -906,7 +900,7 @@ export const EXTRA_FIELDS = withFieldDocs({
906
900
  unset: 'The input is only what the profile takes',
907
901
  },
908
902
  'registerTool.hostOnly': {
909
- ...field("Array<'attachments' | 'voice' | 'options'>"),
903
+ ...field("Array<'attachments' | 'voice' | 'options' | 'speech'>"),
910
904
  unset: 'The model can fill every channel the profile takes',
911
905
  },
912
906
  'registerTool.auth': {
@@ -126,10 +126,6 @@ export declare function profileAllowsInject(profile: {
126
126
  type: string;
127
127
  turnBehaviour?: ProfileTurnBehaviourSpec;
128
128
  }): boolean;
129
- /** OpenAI-compatible normalized `finish_reason` (+ optional `native_finish_reason`). */
130
- export declare function turnStopFromOpenAiFinishReason(finishReason: string | null | undefined, nativeFinishReason?: string | null): TurnStop;
131
- /** Gemini Interactions terminal `status`. */
132
- export declare function turnStopFromInteractionStatus(status: string | null | undefined): TurnStop;
133
129
  /** `null` when `sawTerminal`, so the host keeps the provider's stop. */
134
130
  export declare function turnStopFromClientStreamEnd(opts: {
135
131
  abortedByUser: boolean;
@@ -87,56 +87,6 @@ export function profileAllowsInject(profile) {
87
87
  }
88
88
  return false;
89
89
  }
90
- /** OpenAI-compatible normalized `finish_reason` (+ optional `native_finish_reason`). */
91
- export function turnStopFromOpenAiFinishReason(finishReason, nativeFinishReason) {
92
- const native = nativeFinishReason?.trim() || finishReason?.trim() || undefined;
93
- const effective = (nativeFinishReason || finishReason || '').toLowerCase();
94
- if (!effective)
95
- return { kind: 'stream_incomplete', native };
96
- if (effective === 'network_error' || effective.includes('network')) {
97
- return { kind: 'provider_error', native };
98
- }
99
- return openAiFinishKind((finishReason || '').toLowerCase(), effective, native);
100
- }
101
- function openAiFinishKind(finish, effective, native) {
102
- if (finish === 'stop') {
103
- return /error|fail/.test(effective)
104
- ? { kind: 'provider_error', native }
105
- : { kind: 'completed', native };
106
- }
107
- // probed 2026-11-04: OpenRouter ends a call the output limit cut off with `tool_calls`; only the upstream's own reason says `length`.
108
- if (finish === 'length' || effective === 'length')
109
- return { kind: 'length', native };
110
- if (finish === 'tool_calls' || finish === 'tool-calls')
111
- return { kind: 'tool', native };
112
- if (finish === 'content_filter' || finish === 'content-filter') {
113
- return { kind: 'filtered', native };
114
- }
115
- return { kind: 'provider_error', native };
116
- }
117
- /** Gemini Interactions terminal `status`. */
118
- export function turnStopFromInteractionStatus(status) {
119
- const s = (status || '').toLowerCase();
120
- const native = status || undefined;
121
- switch (s) {
122
- case 'completed':
123
- return { kind: 'completed', native };
124
- case 'incomplete':
125
- case 'budget_exceeded':
126
- return { kind: 'length', native };
127
- case 'requires_action':
128
- return { kind: 'tool', native };
129
- case 'cancelled':
130
- return { kind: 'cancelled', native };
131
- case 'failed':
132
- return { kind: 'provider_error', native };
133
- case 'in_progress':
134
- case 'queued':
135
- return { kind: 'stream_incomplete', native };
136
- default:
137
- return { kind: 'stream_incomplete', native };
138
- }
139
- }
140
90
  /** `null` when `sawTerminal`, so the host keeps the provider's stop. */
141
91
  export function turnStopFromClientStreamEnd(opts) {
142
92
  if (opts.sawTerminal)
@@ -9,6 +9,7 @@ import { isRecord } from '../util/record.js';
9
9
  import { fillActivityLabel, toolNameInWords } from './activity-label.js';
10
10
  import { formatToolFailureForModel, formatToolResult } from './model-text.js';
11
11
  import { inputForModel } from './model-view.js';
12
+ import { issuePath, schemaIssueDetails } from './schema-issues.js';
12
13
  export function toolEvent(base, patch) {
13
14
  return {
14
15
  type: 'tool',
@@ -95,7 +96,7 @@ export function* sourceEvents(base, sources, output) {
95
96
  if (parsed.success)
96
97
  cited.push(parsed.data);
97
98
  else
98
- invalid.push(`[${String(index)}] ${parsed.error.issues.map((i) => `${i.path.join('.') || 'source'}: ${i.message}`).join('; ')}`);
99
+ invalid.push(`[${String(index)}] ${parsed.error.issues.map((i) => `${issuePath(i.path) || 'source'}: ${i.message}`).join('; ')}`);
99
100
  });
100
101
  if (invalid.length > 0) {
101
102
  yield sourcesInvalid(base, `sources not cited: ${invalid.join(' | ')}`); // labels-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
@@ -155,7 +156,7 @@ export function startToolExecution(tool, rawInput, ctx) {
155
156
  code: 'invalid_input',
156
157
  kind: 'bad_response',
157
158
  message: labelText('tool.input_invalid', {}, ctx.profile.labels),
158
- details: parsed.error.flatten(),
159
+ details: schemaIssueDetails(parsed.error.issues),
159
160
  },
160
161
  };
161
162
  }
@@ -27,6 +27,7 @@ import { plainToolInput } from './schema.js';
27
27
  import { CredentialRefusedError, signedInFetch } from './signed-in-fetch.js';
28
28
  import { emitGateSettlement, runPostToolStages, runPreToolPipeline, } from './stage-run.js';
29
29
  export { checkPermission, isGateResumeGranted, isResumeContinuation, permissionGranted, } from './permission.js';
30
+ import { schemaIssueDetails } from './schema-issues.js';
30
31
  import { UncheckedOutput } from './unchecked-output.js';
31
32
  export function originOfTool(tool, tools) {
32
33
  if (tool.type === 'agent')
@@ -184,7 +185,7 @@ function applyT2LoaderPromotion(tools, tool, checkedData, ctx, snapshot) {
184
185
  code: 'invalid_output',
185
186
  kind: 'bad_response',
186
187
  message: labelText('tool.t2_loader_output_invalid', {}, ctx.profile.labels),
187
- details: rechecked.error.flatten(),
188
+ details: schemaIssueDetails(rechecked.error.issues),
188
189
  },
189
190
  };
190
191
  }
@@ -453,7 +454,7 @@ function makeReproject(parse, project, labels) {
453
454
  code: 'invalid_output',
454
455
  kind: 'bad_response',
455
456
  message: labelText('tool.output_invalid_after_mutate', {}, labels),
456
- details: checked.error.flatten(),
457
+ details: schemaIssueDetails(checked.error.issues),
457
458
  },
458
459
  };
459
460
  }
@@ -617,7 +618,7 @@ agent, beginBody) {
617
618
  code: 'invalid_output',
618
619
  kind: 'bad_response',
619
620
  message: labelText('tool.output_invalid', {}, ctx.profile.labels),
620
- details: checked.error.flatten(),
621
+ details: schemaIssueDetails(checked.error.issues),
621
622
  });
622
623
  }
623
624
  const promoted = applyT2LoaderPromotion(tools, tool, checked.data, ctx, snapshot);
@@ -719,7 +720,7 @@ function hostFieldsFailure(args, tool, input) {
719
720
  return {
720
721
  code: 'invalid_input',
721
722
  kind: 'bad_response',
722
- message: labelText('tool.input_invalid', {}, args.profile.labels),
723
+ message: labelText('tool.input_host_fields', { tool: args.name, fields: notInputs.join(', ') }, args.profile.labels),
723
724
  details: { notInputs },
724
725
  };
725
726
  }
@@ -6,6 +6,7 @@ import type { HandlerEvents } from './handler-events.js';
6
6
  import { type McpSessionCache } from './mcp-sessions.js';
7
7
  import type { ToolOperationClaim } from './operation.js';
8
8
  import { type JsonSchema } from './schema.js';
9
+ import { type SchemaIssue } from './schema-issues.js';
9
10
  import { type ToolStageSupport } from './stage-run.js';
10
11
  import type { HttpToolDef, McpToolDef, ModelToolResult, ToolAuthConfig, ToolBodyOutcome, ToolContext, ToolFailure, ToolGate } from './types.js';
11
12
  export type AuthResolveResult = {
@@ -54,7 +55,7 @@ export declare function parseToolOutput<T>(schema: {
54
55
  } | {
55
56
  success: false;
56
57
  error: {
57
- flatten: () => unknown;
58
+ issues: readonly SchemaIssue[];
58
59
  };
59
60
  };
60
61
  }, responseData: unknown): {
@@ -63,7 +64,7 @@ export declare function parseToolOutput<T>(schema: {
63
64
  } | {
64
65
  success: false;
65
66
  error: {
66
- flatten: () => unknown;
67
+ issues: readonly SchemaIssue[];
67
68
  };
68
69
  };
69
70
  /**
@@ -10,6 +10,7 @@ import { createMcpSessionCache, isMcpSessionId, mcpSessionKey, } from './mcp-ses
10
10
  import { outputForModel } from './model-view.js';
11
11
  import { checkPermission, gateDetails } from './permission.js';
12
12
  import { assertFixedEndpointOrigin } from './schema.js';
13
+ import { issuePath, schemaIssueDetails } from './schema-issues.js';
13
14
  import { runPreToolPipeline } from './stage-run.js';
14
15
  /** `url` with the credential set in its query parameter; `url` itself is left as it was. */
15
16
  export function withCredentialQuery(url, query) {
@@ -632,7 +633,7 @@ async function* sendHttpRequest(tool, targetUrl, body, { authHeaders, secret },
632
633
  code: 'invalid_output',
633
634
  kind: 'bad_response',
634
635
  message: 'HTTP response did not match tool output schema', // labels-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
635
- details: checked.error.flatten(),
636
+ details: schemaIssueDetails(checked.error.issues),
636
637
  };
637
638
  return failureOutcome(failure, false);
638
639
  }
@@ -1017,7 +1018,7 @@ function extractMcpOutput(tool, result) {
1017
1018
  function structuredMismatch(issues) {
1018
1019
  const shown = issues
1019
1020
  .slice(0, 3)
1020
- .map((issue) => `${issue.path.map(String).join('.') || '(root)'}: ${issue.message}`);
1021
+ .map((issue) => `${issuePath(issue.path) || '(root)'}: ${issue.message}`);
1021
1022
  const more = issues.length > 3 ? ` (+${String(issues.length - 3)} more)` : '';
1022
1023
  return {
1023
1024
  code: 'mcp_structured_mismatch',
@@ -1073,7 +1074,7 @@ function interpretMcpRpc(tool, negotiated) {
1073
1074
  code: 'invalid_output',
1074
1075
  kind: 'bad_response',
1075
1076
  message: 'MCP output schema validation failed', // labels-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
1076
- details: checked.error.flatten(),
1077
+ details: schemaIssueDetails(checked.error.issues),
1077
1078
  },
1078
1079
  ...withWarning,
1079
1080
  };