@theoremjs/studio 0.3.1 → 0.3.3

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 (41) hide show
  1. package/README.md +1 -0
  2. package/package.json +3 -3
  3. package/page/assets/{Banner-ChigGVCM.js → Banner-Buiul23B.js} +2 -2
  4. package/page/assets/{ContextMenu-BcXTDSnA.js → ContextMenu-Dw9_F5b0.js} +2 -2
  5. package/page/assets/{ToolResultCharts-DsbzvrBK.js → ToolResultCharts-CVlI3NkJ.js} +1 -1
  6. package/page/assets/{TraceInspector-B34qMQJH.js → TraceInspector-TusXx3zZ.js} +1 -1
  7. package/page/assets/{TraceOverview-Drp2Sl4p.js → TraceOverview-DrHQgMQO.js} +1 -1
  8. package/page/assets/{_virtual_studio-type-sources-B0u0_Vhq.js → _virtual_studio-type-sources-BwZOives.js} +49 -18
  9. package/page/assets/browser-engine-BTOR18GA.js +11 -0
  10. package/page/assets/{browser-transport-Bn77Eq5d.js → browser-transport-BEFsWdzI.js} +3 -3
  11. package/page/assets/{compile-egress-CGwmX2BX.js → compile-egress-BSxOdX4K.js} +1 -1
  12. package/page/assets/{encode-files-Dq98bb-f.js → encode-files-Bc3HJyAh.js} +1 -1
  13. package/page/assets/{export-agent-wlS68_dE.js → export-agent-BnlMWFTv.js} +1 -1
  14. package/page/assets/{guardrail-tester-BHcoZE5K.js → guardrail-tester-DRsOgbwK.js} +1 -1
  15. package/page/assets/host-patterns-C9RMP16Q.js +1 -0
  16. package/page/assets/{index-BmHkdZXS.js → index-D2T8e_8Q.js} +6 -6
  17. package/page/assets/{live-ingress-DsA4_80F.js → live-ingress-lDUGPwth.js} +1 -1
  18. package/page/assets/{live-messages-B19ZuTGI.js → live-messages-BYi31jQk.js} +1 -1
  19. package/page/assets/{reader-CN15b9m8.js → reader-B0gVhfoZ.js} +1 -1
  20. package/page/assets/{shaped-data-BO_JTcQq.js → shaped-data-BcarWqd5.js} +2 -2
  21. package/page/assets/{stub-DDddt29Y.js → stub-DEZDrr-l.js} +1 -1
  22. package/page/assets/{studio-code-pane-BSXwNg0B.js → studio-code-pane-PndbSO1v.js} +3 -3
  23. package/page/assets/{studio-console-C1hyAfeb.js → studio-console-e6kqu38F.js} +1 -1
  24. package/page/assets/{studio-decision-CZDF06ic.js → studio-decision-DFM0psog.js} +1 -1
  25. package/page/assets/{studio-embedding-SqSYd_e1.js → studio-embedding-4qgdJ4gh.js} +1 -1
  26. package/page/assets/{studio-host-console-BlbRUrR_.js → studio-host-console-DajI604W.js} +2 -2
  27. package/page/assets/{studio-live-Dd0AEV_k.js → studio-live-B1a0aWbl.js} +1 -1
  28. package/page/assets/{studio-map-BIIZcltt.js → studio-map-CdrEm07d.js} +1 -1
  29. package/page/assets/{studio-type-checker-Cp6IxLBp.js → studio-type-checker-DosSRFbd.js} +1 -1
  30. package/page/assets/tool-schema-BrqSc6vO.js +18 -0
  31. package/page/assets/{trace-record-C-XxCjSg.js → trace-record-C3zNksA_.js} +1 -1
  32. package/page/assets/{tree-D1IYOD_9.js → tree-DeO1319a.js} +1 -1
  33. package/page/assets/{turn-client-BMBqw-ho.js → turn-client-DwVPS3TX.js} +1 -1
  34. package/page/assets/types-EVrOoUBG.js +1 -0
  35. package/page/assets/{use-one-call-BtrXMol7.js → use-one-call-9e3o5vH-.js} +1 -1
  36. package/page/assets/{workspace-BMzjmPeQ.js → workspace-Ck0o-_fd.js} +1 -1
  37. package/page/index.html +15 -15
  38. package/page/assets/browser-engine-rJc_aHJo.js +0 -9
  39. package/page/assets/host-patterns-DCz9Cmrt.js +0 -1
  40. package/page/assets/tool-schema-BF2BK9h8.js +0 -18
  41. package/page/assets/types-CBmpjaet.js +0 -1
@@ -4717,7 +4717,7 @@ export { ADVISORY_LEVELS, abortLiveOutboundTurn, addGivenDestinations, addHistor
4717
4717
  export type { DnsOverHttpsOptions, GuardedFetchOptions, ResolveHost, } from './src/guardrails/network.js';
4718
4718
  export { assertSafeUrl, dnsOverHttpsResolver, fetchGuarded, isLocalhostName, isPrivateOrLocalAddress, } from './src/guardrails/network.js';
4719
4719
  export type { QuotaSlotStatus } from './src/guardrails/quota.js';
4720
- export { clientIp, quotaExhausted, releaseSlot, resetSlots, skipQuota, takeSlot, } from './src/guardrails/quota.js';
4720
+ export { clientIp, quotaBusy, quotaExhausted, releaseSlot, resetSlots, skipQuota, takeSlot, } from './src/guardrails/quota.js';
4721
4721
  export type { SanitizedTurnRequest } from './src/guardrails/sanitize.js';
4722
4722
  export { sanitizeProjectId, sanitizeTurnRequest, sanitizeTurnRequestWithEvents, } from './src/guardrails/sanitize.js';
4723
4723
  export type { ProviderStateRebuilt } from './src/kernel/checkpoint.js';
@@ -4763,6 +4763,8 @@ export type { MediaTurnBehaviourSpec, ProfileTurnBehaviourSpec, ProfileTurnResum
4763
4763
  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';
4764
4764
  export { authorizeToolReplay } from './src/kernel/tools/execute.js';
4765
4765
  export { GATE_DECISIONS, type GateDecision } from './src/kernel/tools/gate-answer.js';
4766
+ export type { MemoryToolExecutionOptions } from './src/kernel/tools/memory-execution.js';
4767
+ export { createMemoryToolExecution } from './src/kernel/tools/memory-execution.js';
4766
4768
  export type { CredentialQuery, McpProtocolVersion, McpRpcResponse, ToolRegistry, } from './src/kernel/tools/mod.js';
4767
4769
  export { askUserTool, buildHttpToolTarget, createToolRegistry, credentialPlacement, executeHttpTool, executeMcpTool, formatToolResult, isUnsupportedMcpProtocolError, MCP_PROTOCOL_VERSIONS, parseMcpRpcResponse, prepareTurnToolSnapshot, registerHarnessTools, resolveToolAuth, UncheckedOutput, uncheckedOutput, withCredentialQuery, } from './src/kernel/tools/mod.js';
4768
4770
  export type { BeginToolOperationResult, PageToolDispatch, PageToolExecution, SavedToolInvocation, TerminalToolEvent, ToolExecutionCoordinator, ToolOperationClaim, ToolOperationIdentity, ToolOperationOutcome, ToolOperationUncertainty, } from './src/kernel/tools/operation.js';
@@ -7022,6 +7024,12 @@ export type TurnEvent = {
7022
7024
  injected?: {
7023
7025
  id: string;
7024
7026
  }[];
7027
+ /**
7028
+ * An inject at this stage dropped a draft the user never got: of the reply text since the
7029
+ * turn began or its last \`attempt\`, only the first \`released\` characters stay the reply.
7030
+ * {@linkcode keptReply} drops the rest.
7031
+ */
7032
+ released?: number;
7025
7033
  }
7026
7034
  /**
7027
7035
  * A tool call the model is still writing: the next piece of its arguments' JSON text, in order,
@@ -7102,8 +7110,9 @@ export declare const TURN_EVENT_SCHEMAS: {
7102
7110
  };
7103
7111
  /**
7104
7112
  * \`events\` without the replies a retry threw away: each \`attempt\` drops the text, media and
7105
- * structured output before it, back to the turn's start or its last \`done\`. Tool calls, thoughts
7106
- * and everything else stay, since they happened.
7113
+ * structured output before it, back to the turn's start or its last \`done\`. A \`stage\` event with
7114
+ * \`released\` keeps only that much of the reply's text, and drops what followed it. Tool calls,
7115
+ * thoughts and everything else stay, since they happened.
7107
7116
  */
7108
7117
  export declare function keptReply(events: readonly TurnEvent[]): TurnEvent[];
7109
7118
  `,"file:///node_modules/@theoremjs/agents/src/kernel/schema.d.ts":`import { BLOCKED_REPLY_ON_BLOCK, type BlockedReplyOnBlock } from '../guardrails/types.js';
@@ -7227,7 +7236,7 @@ export declare const AWAITING_USER_INPUT_KINDS: readonly ["confirm", "choice", "
7227
7236
  /** One of {@linkcode AWAITING_USER_INPUT_KINDS}. */
7228
7237
  export type AwaitingUserInputKind = (typeof AWAITING_USER_INPUT_KINDS)[number];
7229
7238
  /** Why a stage handler's result was partly or wholly ignored. */
7230
- export declare const STAGE_APPLY_WARNING_CODES: readonly ["affordance_not_allowed", "inject_not_allowed", "inject_rejected_max_steps", "inject_invalid_messages", "inject_id_invalid", "deny_invalid", "confirm_invalid", "mutate_invalid", "label_failed_invalid", "abort_invalid", "wait_for_invalid", "unknown_field", "result_invalid"];
7239
+ export declare const STAGE_APPLY_WARNING_CODES: readonly ["affordance_not_allowed", "inject_not_allowed", "inject_rejected_max_steps", "inject_invalid_messages", "inject_id_invalid", "inject_released_invalid", "deny_invalid", "confirm_invalid", "mutate_invalid", "label_failed_invalid", "abort_invalid", "wait_for_invalid", "unknown_field", "result_invalid"];
7231
7240
  /** One of {@linkcode STAGE_APPLY_WARNING_CODES}. */
7232
7241
  export type StageApplyWarningCode = (typeof STAGE_APPLY_WARNING_CODES)[number];
7233
7242
  /** The \`status\` of a tool output that asks the user a question. */
@@ -7880,7 +7889,7 @@ export { applySpans, blobAt, mergeSpans, OMIT_CANARY, OMIT_INJECTION, OMIT_SENSI
7880
7889
  `,"file:///node_modules/@theoremjs/agents/src/guardrails/labels.d.ts":`/** Values that fill a label template's \`{param}\` placeholders. */
7881
7890
  export type LabelParams = Record<string, string | number>;
7882
7891
  /** Keys are stable API. */
7883
- 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", "error.config", "error.request", "error.input", "error.action", "error.auth", "error.rate_limit", "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"];
7892
+ 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"];
7884
7893
  /** One of {@linkcode LABEL_KEYS}. */
7885
7894
  export type LabelKey = (typeof LABEL_KEYS)[number];
7886
7895
  /**
@@ -7889,7 +7898,7 @@ export type LabelKey = (typeof LABEL_KEYS)[number];
7889
7898
  * puts into history. Only these overrides travel to the browser; the rest
7890
7899
  * (repair prompts, canary, taint, egress) stay on the host.
7891
7900
  */
7892
- 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.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"];
7901
+ 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"];
7893
7902
  /** One of {@linkcode CLIENT_LABEL_KEYS}. */
7894
7903
  export type ClientLabelKey = (typeof CLIENT_LABEL_KEYS)[number];
7895
7904
  /** Host-supplied replacement templates, \`{param}\` placeholders included. */
@@ -8024,7 +8033,7 @@ export type { ErrorCopies, ErrorCopy };
8024
8033
  * the builder in code and traces (\`errorKind\`, \`error.type\`), the user through
8025
8034
  * the kind's wording (\`error.<kind>\` in the labels).
8026
8035
  */
8027
- export declare const ERROR_KINDS: readonly ["config", "request", "input", "action", "auth", "rate_limit", "unsupported", "unavailable", "bad_response", "network", "timeout", "safety", "blocked", "declined", "failed", "cancelled", "internal"];
8036
+ export declare const ERROR_KINDS: readonly ["config", "request", "input", "action", "auth", "rate_limit", "busy", "unsupported", "unavailable", "bad_response", "network", "timeout", "safety", "blocked", "declined", "failed", "cancelled", "internal"];
8028
8037
  /** Why an operation failed; the user's wording and the HTTP status follow from it. */
8029
8038
  export type ErrorKind = (typeof ERROR_KINDS)[number];
8030
8039
  /** Options for a \`TheoremError\`: the cause and, optionally, wording for the user. */
@@ -9312,6 +9321,7 @@ export type Wait = (ms: number, signal?: AbortSignal | null) => Promise<void>;
9312
9321
  export declare const WAIT_BUDGET_MS = 5000;
9313
9322
  export declare const waitDefault: Wait;
9314
9323
  export declare function isTransientHttp(status: number): boolean;
9324
+ /** A rejected send that never got a response: a network failure, by \`networkError\`'s rule. An abort, a timeout, or any other kind is not. */
9315
9325
  export declare function isTransientThrown(err: unknown): boolean;
9316
9326
  export declare function backoffMs(attempt: number): number;
9317
9327
  /** \`retry-after-ms\`, else \`Retry-After\` in seconds or as a date; undefined when absent or unreadable. */
@@ -9380,6 +9390,13 @@ export interface StageResult {
9380
9390
  * non-string id refuses the inject whole.
9381
9391
  */
9382
9392
  injectId?: string;
9393
+ /**
9394
+ * With \`inject\`, at \`post_tool\` or \`before_end\`: how many characters of the attempt's reply text,
9395
+ * as the turn gave it, the user already has. The rest is a draft they never got: it leaves the
9396
+ * turn's history and its reply when the inject lands, so the model answers everything afresh
9397
+ * after the part they have. Left out, they have all of it.
9398
+ */
9399
+ released?: number;
9383
9400
  abort?: boolean | {
9384
9401
  reason?: string;
9385
9402
  };
@@ -9430,6 +9447,8 @@ export interface StageApplyInput {
9430
9447
  export interface InjectUnit {
9431
9448
  id?: string;
9432
9449
  messages: TurnHistoryMessage[];
9450
+ /** {@linkcode StageResult.released}: the reply text the user has when this inject lands. */
9451
+ released?: number;
9433
9452
  }
9434
9453
  /** A stage handler's result after validation: the parts the turn will act on. */
9435
9454
  export interface StageApplyOutput {
@@ -9464,16 +9483,18 @@ export type StageEventExtra = {
9464
9483
  injected?: {
9465
9484
  id: string;
9466
9485
  }[];
9486
+ released?: number;
9467
9487
  };
9468
9488
  /** Build a stream \`stage\` event. Unknown extra keys are not copied. */
9469
9489
  export declare function stageEventFields(stage: TurnStage, extra?: Partial<StageEventExtra>): TurnEventOf<'stage'>;
9470
9490
  export declare function injectMessages(units: readonly InjectUnit[]): TurnHistoryMessage[];
9471
9491
  /**
9472
9492
  * The \`stage\` event recording that \`units\` landed, naming the ones the host
9473
- * named; \`undefined\` when none was named. Emit it where the messages land,
9474
- * never before: an inject that never lands is never reported.
9493
+ * named, and the reply text the user has when they dropped a draft (\`released\`);
9494
+ * \`undefined\` when there is neither. Emit it where the messages land, never
9495
+ * before: an inject that never lands is never reported.
9475
9496
  */
9476
- export declare function injectedStageEvent(stage: TurnStage, units: readonly InjectUnit[], extra?: Pick<StageEventExtra, 'callId' | 'toolName'>): TurnEventOf<'stage'> | undefined;
9497
+ export declare function injectedStageEvent(stage: TurnStage, units: readonly InjectUnit[], extra?: Pick<StageEventExtra, 'callId' | 'toolName' | 'released'>): TurnEventOf<'stage'> | undefined;
9477
9498
  export declare function injectWouldExceedMaxSteps(stepCount: number, maxSteps: number | undefined): boolean;
9478
9499
  export interface RunStageArgs extends StageCallBag {
9479
9500
  stage: TurnStage;
@@ -9516,8 +9537,8 @@ export declare function uncheckedOutput(value: unknown): UncheckedOutput;
9516
9537
  `,"file:///node_modules/@theoremjs/agents/src/kernel/tools/operation.d.ts":`import { z } from 'zod';
9517
9538
  import { TheoremError } from '../../guardrails/error.js';
9518
9539
  import { type JsonObject, type JsonValue } from '../json.js';
9540
+ import type { InjectUnit } from '../stages.js';
9519
9541
  import type { GateReference, TurnEventOf } from '../turn-events.js';
9520
- import type { TurnHistoryMessage } from '../types.js';
9521
9542
  import type { ModelToolResult, PageAnswer, ToolFailure } from './types.js';
9522
9543
  export type TerminalToolEvent = TurnEventOf<'tool'> & {
9523
9544
  tool: Extract<TurnEventOf<'tool'>['tool'], {
@@ -9558,10 +9579,7 @@ export interface ToolOperationOutcome {
9558
9579
  aborted?: boolean | {
9559
9580
  reason?: string;
9560
9581
  };
9561
- pendingInject?: {
9562
- id?: string;
9563
- messages: TurnHistoryMessage[];
9564
- }[];
9582
+ pendingInject?: InjectUnit[];
9565
9583
  };
9566
9584
  }
9567
9585
  export type ToolOperationUncertainty = 'execution_interrupted' | 'settlement_write_failed' | 'worker_lost';
@@ -9601,7 +9619,7 @@ declare function isTimeoutError(err: unknown): boolean;
9601
9619
  declare function throwIfAborted(signal?: AbortSignal): void;
9602
9620
  /** Anything that is not a \`TheoremError\` or an abort escaped every boundary that names kinds: a THEOREM bug. */
9603
9621
  declare function errorKind(err: unknown): ErrorKind;
9604
- /** The error kind for an HTTP status: 401, 402 and 403 are \`auth\`; 408, 504 and 524 \`timeout\`; 429 \`rate_limit\`; 500 and above \`unavailable\`; the rest \`unsupported\`. */
9622
+ /** The error kind for an HTTP status: 401, 402 and 403 are \`auth\`; 408, 504 and 524 \`timeout\`; 429 \`rate_limit\`; 503 and 529 (overloaded) \`busy\`; 500 and above \`unavailable\`; the rest \`unsupported\`. */
9605
9623
  declare function kindOfHttpStatus(status: number): ErrorKind;
9606
9624
  /** The named reasons an error carries, one line each, in the profile's wording. */
9607
9625
  declare function errorCopyText(copy: ErrorCopies, labels?: LabelOverrides): string;
@@ -11627,6 +11645,17 @@ declare function hitRules(hits: GuardrailHit[]): string[];
11627
11645
  declare function boundaryNote({ canary, labels, }: Pick<GuardrailContext, 'canary' | 'labels'>): string | undefined;
11628
11646
  export type { EventLeak, LeakScope };
11629
11647
  export { boundaryNote, eventLeak, eventPromptLeakHits, hitRules, isPromptLeakHit, promptEchoHits, promptLeakReason, WITHHELD_REASON, };
11648
+ `,"file:///node_modules/@theoremjs/agents/src/kernel/tools/memory-execution.d.ts":`import { type ToolExecutionCoordinator } from './operation.js';
11649
+ export interface MemoryToolExecutionOptions {
11650
+ /** The most operations it holds. A full coordinator refuses dispatch and keeps what it has. */
11651
+ maxOperations?: number;
11652
+ }
11653
+ /**
11654
+ * A coordinator that keeps claims and outcomes in process memory.
11655
+ * Use one per turn or per process when nothing needs to resume after a restart.
11656
+ * A host that resumes across requests or workers supplies its own \`ToolExecutionCoordinator\`.
11657
+ */
11658
+ export declare function createMemoryToolExecution(options?: MemoryToolExecutionOptions): ToolExecutionCoordinator;
11630
11659
  `,"file:///node_modules/@theoremjs/agents/src/kernel/scope.d.ts":`import type { TraceSink } from '../observability/trace-sink.js';
11631
11660
  import { type RunDecisionOptions } from './engine/decision.js';
11632
11661
  import { type RunEmbeddingOptions } from './engine/embedding.js';
@@ -12128,10 +12157,12 @@ declare function takeSlot(profile: Profile, ip: string, now: number): QuotaSlotS
12128
12157
  declare function releaseSlot(profile: Profile, ip: string): void;
12129
12158
  /** \`undefined\` when the profile has no quota configured. */
12130
12159
  declare function quotaExhausted(profile: Profile): TheoremError | undefined;
12160
+ /** A turn already holds this client's slot (\`takeSlot\` returned \`busy\`): worded by the labels' \`quota.busy\`. */
12161
+ declare function quotaBusy(profile: Profile): TheoremError;
12131
12162
  /** Clears all process-local quota counters; intended for tests or host resets. */
12132
12163
  declare function resetSlots(): void;
12133
12164
  export type { QuotaSlotStatus };
12134
- export { clientIp, quotaExhausted, releaseSlot, resetSlots, skipQuota, takeSlot };
12165
+ export { clientIp, quotaBusy, quotaExhausted, releaseSlot, resetSlots, skipQuota, takeSlot };
12135
12166
  `,"file:///node_modules/@theoremjs/agents/src/guardrails/mod.d.ts":`/**
12136
12167
  * Inbound and outbound guardrail primitives: sanitization, injection, and sensitive detection,
12137
12168
  * canary egress gates, the detectors, and public error mapping. App-specific policy copy stays host-owned.
@@ -12169,7 +12200,7 @@ export type { ProgressiveYieldGate, ProgressiveYieldGateOptions, ProgressiveYiel
12169
12200
  export { createOutboundProgressiveGate, createProgressiveYieldGate } from './progressive-yield.js';
12170
12201
  export { PROMPT_ECHO_WORDS, scanTextForPromptEcho } from './prompt-echo.js';
12171
12202
  export type { QuotaSlotStatus } from './quota.js';
12172
- export { clientIp, quotaExhausted, releaseSlot, resetSlots, skipQuota, takeSlot, } from './quota.js';
12203
+ export { clientIp, quotaBusy, quotaExhausted, releaseSlot, resetSlots, skipQuota, takeSlot, } from './quota.js';
12173
12204
  export type { GuardrailRule } from './rules.js';
12174
12205
  export { DETECT_RULES, detectRule, EGRESS_RULES, NETWORK_RULES, TOOL_RULES, } from './rules.js';
12175
12206
  export type { SanitizedTurnRequest } from './sanitize.js';