@theoremjs/studio 0.3.5-next.907.g49f9ef9 → 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.
- package/package.json +4 -4
- package/page/assets/{BottomSheet-DJ9cb5VC.js → BottomSheet-gvxs6HLX.js} +1 -1
- package/page/assets/{ConsoleFrame-CrkDuz92.js → ConsoleFrame-DjKftiM3.js} +1 -1
- package/page/assets/{DateInput-D_kPjzMj.js → DateInput-BpXRJu6W.js} +1 -1
- package/page/assets/{MenuBottomSheet-B6ylzErW.js → MenuBottomSheet-C-aSCSIv.js} +1 -1
- package/page/assets/{PowerSearchBottomSheet-_QAApNi8.js → PowerSearchBottomSheet-CadUl0hQ.js} +1 -1
- package/page/assets/{RankedBars-DFNp1J7P.js → RankedBars-BqvXkuhw.js} +1 -1
- package/page/assets/{SchemaFields-Bnse-WrK.js → SchemaFields-BA_tTlTT.js} +1 -1
- package/page/assets/{TokenizerBottomSheet-CFzmh_oP.js → TokenizerBottomSheet-BVgCEcFv.js} +1 -1
- package/page/assets/{ToolResultCharts-BwBVFDBV.js → ToolResultCharts-Ju_2APDe.js} +1 -1
- package/page/assets/{Toolbar-C5dAAZpA.js → Toolbar-Bodaemo6.js} +1 -1
- package/page/assets/{TraceInspector-BvH3QZkb.js → TraceInspector-CCjkzWyI.js} +2 -2
- package/page/assets/{TraceOverview-CqDj_hQK.js → TraceOverview-BtC8GQVd.js} +1 -1
- package/page/assets/{_virtual_studio-type-sources-eJav4ja9.js → _virtual_studio-type-sources-CdnMqL-n.js} +77 -16
- package/page/assets/browser-connection-8HG8E7-I.js +1 -0
- package/page/assets/browser-engine-nrFEmQVr.js +16 -0
- package/page/assets/{browser-transport-DgVZiZ-t.js → browser-transport-C4b9Cns1.js} +2 -2
- package/page/assets/compile--gO-Z1FH.js +4 -0
- package/page/assets/{encode-files-BY9Pg5LN.js → encode-files-7UPrYBrF.js} +1 -1
- package/page/assets/{export-agent-BeXD1eV-.js → export-agent-CJU4yuZq.js} +1 -1
- package/page/assets/{getRadiusAndStrokeWidthFromDot-BrBnbwsB.js → getRadiusAndStrokeWidthFromDot-Ecj-jR5D.js} +1 -1
- package/page/assets/{guardrail-health-Bb4E1WZU.js → guardrail-health-DFvepe74.js} +2 -2
- package/page/assets/{guardrail-tester-o6E552V3.js → guardrail-tester-D0nvciLt.js} +1 -1
- package/page/assets/{index-C-fxwEsY.js → index-DdfSX5Od.js} +18 -18
- package/page/assets/{json-code-BcVmPEws.js → json-code-ChVouP8g.js} +1 -1
- package/page/assets/{labels-provider-DlvOtCm7.js → labels-provider-BO_XYaPQ.js} +1 -1
- package/page/assets/{live-messages-Csldhc_K.js → live-messages-BrXwocbM.js} +1 -1
- package/page/assets/{prompt-row-DMhSHwaK.js → prompt-row-D7xmJLxc.js} +1 -1
- package/page/assets/reader-CfENH3jS.js +5 -0
- package/page/assets/registry-BOVP_lQO.js +1 -0
- package/page/assets/{schema-B3Tv1Fpx.js → schema-dtr41Lr7.js} +2 -2
- package/page/assets/{shaped-data-Dp2yZFfd.js → shaped-data-9kDvR1de.js} +8 -8
- package/page/assets/{stub-BlSgwV6N.js → stub-B275bXj-.js} +1 -1
- package/page/assets/{studio-code-pane-C39Jn0aZ.js → studio-code-pane-epOb7YCi.js} +3 -3
- package/page/assets/{studio-console-D7AL_5Jk.js → studio-console-KObtCJyc.js} +1 -1
- package/page/assets/{studio-decision-DZy88Msx.js → studio-decision-CJWMloET.js} +1 -1
- package/page/assets/{studio-embedding-CPuNB8Cx.js → studio-embedding-CGKFrG_-.js} +1 -1
- package/page/assets/{studio-host-console-C4Waj0p6.js → studio-host-console-C5oeUj4u.js} +2 -2
- package/page/assets/studio-labels-EVPkcfTG.js +3 -0
- package/page/assets/{studio-live-DreXKuYt.js → studio-live-B6Iy_esj.js} +1 -1
- package/page/assets/{studio-map-BM9X_QWw.js → studio-map-DnuXEuzm.js} +1 -1
- package/page/assets/{studio-trace-replay-OT4Dv2jU.js → studio-trace-replay-Dxc3ePxC.js} +1 -1
- package/page/assets/{studio-type-checker-DfOTBf8z.js → studio-type-checker-Cg2BuLET.js} +1 -1
- package/page/assets/{tool-schema-BSpmtaaV.js → tool-schema-D6i-fwc5.js} +1 -1
- package/page/assets/{trace-record-DGajv3HL.js → trace-record-DFHRIoSR.js} +1 -1
- package/page/assets/tree-DXvClIpQ.js +3 -0
- package/page/assets/{turn-client-CdXgO5_p.js → turn-client-Cl1P1QP9.js} +2 -2
- package/page/assets/types-Bl2lxigr.js +1 -0
- package/page/assets/{use-one-call-JqYC-s7k.js → use-one-call-BKua0dRg.js} +1 -1
- package/page/assets/{useDismissSearchOnTouchDrag-BIu0LXgG.js → useDismissSearchOnTouchDrag-lH0YZH1H.js} +1 -1
- package/page/assets/{workspace-Cb2ALxS2.js → workspace-BpEiFb5f.js} +1 -1
- package/page/index.html +17 -17
- package/page/assets/browser-connection-EIPuJ9Z-.js +0 -1
- package/page/assets/browser-engine-Z4OjlXXG.js +0 -16
- package/page/assets/compile-C8OL7ghD.js +0 -4
- package/page/assets/reader-nH_7s6ie.js +0 -5
- package/page/assets/registry-DT8TxCzH.js +0 -1
- package/page/assets/studio-labels-jMBxTLIr.js +0 -3
- package/page/assets/tree-VPRvFY4g.js +0 -3
- package/page/assets/types-Dxa9Ol2S.js +0 -1
|
@@ -4883,13 +4883,17 @@ export { geminiEmbeddings } from './gemini/embeddings-protocol.js';
|
|
|
4883
4883
|
export { geminiInteractions } from './gemini/interactions-protocol.js';
|
|
4884
4884
|
export { geminiLive } from './gemini/live-protocol.js';
|
|
4885
4885
|
export { geminiProvider } from './gemini/provider.js';
|
|
4886
|
+
export { wireInteractionPart } from './google/interactions/framing.js';
|
|
4887
|
+
export { turnStopFromInteractionStatus } from './google/interactions/status.js';
|
|
4886
4888
|
export { ollamaEmbeddings } from './local/embeddings-protocol.js';
|
|
4887
4889
|
export { localProvider } from './local/provider.js';
|
|
4890
|
+
export { turnStopFromOpenAiFinishReason } from './open-ai/finish-reason.js';
|
|
4888
4891
|
export { openAi } from './open-ai/protocol.js';
|
|
4889
4892
|
export { openRouterDecisions } from './openrouter/decisions-protocol.js';
|
|
4890
4893
|
export { openRouterEmbeddings } from './openrouter/embeddings-protocol.js';
|
|
4891
4894
|
export { openRouterImages } from './openrouter/images-protocol.js';
|
|
4892
|
-
export {
|
|
4895
|
+
export type { CacheMode, CacheSpec, CacheTtl } from './openrouter/protocol.js';
|
|
4896
|
+
export { CACHE_MODES, CACHE_TTLS, openRouterOpenAi } from './openrouter/protocol.js';
|
|
4893
4897
|
export { openRouterProvider } from './openrouter/provider.js';
|
|
4894
4898
|
export type { OpenRouterTranscriptionsOptions } from './openrouter/transcriptions-protocol.js';
|
|
4895
4899
|
export { openRouterTranscriptions } from './openrouter/transcriptions-protocol.js';
|
|
@@ -8528,7 +8532,7 @@ export { applySpans, blobAt, mergeSpans, OMIT_CANARY, OMIT_INJECTION, OMIT_PROMP
|
|
|
8528
8532
|
`,"file:///node_modules/@theoremjs/agents/src/guardrails/labels.d.ts":`/** Values that fill a label template's \`{param}\` placeholders. */
|
|
8529
8533
|
export type LabelParams = Record<string, string | number>;
|
|
8530
8534
|
/** Keys are stable API. */
|
|
8531
|
-
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"];
|
|
8535
|
+
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"];
|
|
8532
8536
|
/** One of {@linkcode LABEL_KEYS}. */
|
|
8533
8537
|
export type LabelKey = (typeof LABEL_KEYS)[number];
|
|
8534
8538
|
/**
|
|
@@ -10152,8 +10156,8 @@ export interface AgentToolOutput {
|
|
|
10152
10156
|
/** What the called agent cited; the caller's turn cites them too. */
|
|
10153
10157
|
sources?: Source[];
|
|
10154
10158
|
}
|
|
10155
|
-
/** A channel of an agent tool's input
|
|
10156
|
-
export type AgentToolChannel = 'attachments' | 'voice' | 'options';
|
|
10159
|
+
/** A channel of an agent tool's input: one the called profile's \`inputs\` declares, or \`speech\` on a speech profile. */
|
|
10160
|
+
export type AgentToolChannel = 'attachments' | 'voice' | 'options' | 'speech';
|
|
10157
10161
|
/**
|
|
10158
10162
|
* A tool whose call runs one turn of another registered agent. That agent is a
|
|
10159
10163
|
* standalone profile; the tool is how another agent's model calls it. Its input
|
|
@@ -10185,13 +10189,15 @@ export interface AgentToolDef extends ToolBase {
|
|
|
10185
10189
|
*/
|
|
10186
10190
|
fieldText?: Partial<Record<keyof AgentToolInput, string>>;
|
|
10187
10191
|
/**
|
|
10188
|
-
* Fields
|
|
10189
|
-
*
|
|
10190
|
-
*
|
|
10192
|
+
* Fields on an agent tool that only the host reads. The calling model fills them, or the host
|
|
10193
|
+
* does when a field is marked exposeToModel: false. onAgentCall gets them as hostInput and turns
|
|
10194
|
+
* them into what the agent is sent; the agent never sees them. A name the input already has is
|
|
10195
|
+
* refused when the tool registers.
|
|
10191
10196
|
*
|
|
10192
|
-
* @remarks Fields the calling model fills
|
|
10193
|
-
* \`hostInput\` and turns them into the
|
|
10194
|
-
* input
|
|
10197
|
+
* @remarks Fields only the host reads. The calling model fills them, or the host when a field is
|
|
10198
|
+
* marked \`exposeToModel: false\`. \`onAgentCall\` gets them as \`hostInput\` and turns them into the
|
|
10199
|
+
* agent's input; they are never sent to the agent. A name the input already has is refused, and a
|
|
10200
|
+
* call without the hook is a config error.
|
|
10195
10201
|
*/
|
|
10196
10202
|
hostFields?: Record<string, z.ZodType>;
|
|
10197
10203
|
/**
|
|
@@ -11339,11 +11345,11 @@ export declare const openRouterProvider: Provider<OpenRouterConnection, string>;
|
|
|
11339
11345
|
`,"file:///node_modules/@theoremjs/agents/src/providers/openrouter/protocol.d.ts":`import { type JsonObject } from '../../kernel/json.js';
|
|
11340
11346
|
import { type Protocol } from '../../kernel/protocols/mod.js';
|
|
11341
11347
|
/** What is cached: the whole request (\`automatic\`) or the system instruction only (\`system\`). */
|
|
11342
|
-
declare const CACHE_MODES: readonly ["automatic", "system"];
|
|
11348
|
+
export declare const CACHE_MODES: readonly ["automatic", "system"];
|
|
11343
11349
|
/** One of {@linkcode CACHE_MODES}. */
|
|
11344
11350
|
export type CacheMode = (typeof CACHE_MODES)[number];
|
|
11345
11351
|
/** How long OpenRouter's upstream keeps a cached prompt. */
|
|
11346
|
-
declare const CACHE_TTLS: readonly ["5m", "1h"];
|
|
11352
|
+
export declare const CACHE_TTLS: readonly ["5m", "1h"];
|
|
11347
11353
|
/** One of {@linkcode CACHE_TTLS}. */
|
|
11348
11354
|
export type CacheTtl = (typeof CACHE_TTLS)[number];
|
|
11349
11355
|
/**
|
|
@@ -11388,7 +11394,6 @@ export interface OpenRouterRouting {
|
|
|
11388
11394
|
}
|
|
11389
11395
|
/** Chat Completions with OpenRouter's caching, routing, web search, citations, and reasoning. */
|
|
11390
11396
|
export declare const openRouterOpenAi: Protocol<OpenRouterOptions>;
|
|
11391
|
-
export {};
|
|
11392
11397
|
`,"file:///node_modules/@theoremjs/agents/src/providers/openrouter/images-protocol.d.ts":`import { type Protocol } from '../../kernel/protocols/mod.js';
|
|
11393
11398
|
/** OpenRouter's image generation: \`/images\`, or the chat path with its image tool when text is wanted too. */
|
|
11394
11399
|
export declare const openRouterImages: Protocol<Record<string, never>>;
|
|
@@ -11407,7 +11412,7 @@ export declare const openRouterDecisions: Protocol<Record<string, never>>;
|
|
|
11407
11412
|
`,"file:///node_modules/@theoremjs/agents/src/providers/open-ai/protocol.d.ts":`import { type Protocol } from '../../kernel/protocols/mod.js';
|
|
11408
11413
|
/** OpenAI Chat Completions: the shape most compatible servers speak. */
|
|
11409
11414
|
export declare const openAi: Protocol<Record<string, never>>;
|
|
11410
|
-
`,"file:///node_modules/@theoremjs/agents/src/providers/local/provider.d.ts":`import { type Provider } from '../../kernel/protocols/provider.js';
|
|
11415
|
+
`,"file:///node_modules/@theoremjs/agents/src/providers/open-ai/finish-reason.d.ts":"import type { TurnStop } from '../../kernel/turn-events.js';\n/** OpenAI-compatible normalized `finish_reason` (+ optional `native_finish_reason`). */\nexport declare function turnStopFromOpenAiFinishReason(finishReason: string | null | undefined, nativeFinishReason?: string | null): TurnStop;\n","file:///node_modules/@theoremjs/agents/src/providers/local/provider.d.ts":`import { type Provider } from '../../kernel/protocols/provider.js';
|
|
11411
11416
|
/** What registering \`localProvider\` takes as \`connection\`. */
|
|
11412
11417
|
export interface LocalConnection {
|
|
11413
11418
|
baseUrl: string;
|
|
@@ -11421,6 +11426,37 @@ export interface OllamaEmbeddingsOptions {
|
|
|
11421
11426
|
dimensions?: number;
|
|
11422
11427
|
}
|
|
11423
11428
|
export declare const ollamaEmbeddings: Protocol<OllamaEmbeddingsOptions>;
|
|
11429
|
+
`,"file:///node_modules/@theoremjs/agents/src/providers/google/interactions/status.d.ts":`import type { TurnStop } from '../../../kernel/turn-events.js';
|
|
11430
|
+
/** The stop an Interactions \`status\` reports when the call ends. */
|
|
11431
|
+
export declare function turnStopFromInteractionStatus(status: string | null | undefined): TurnStop;
|
|
11432
|
+
`,"file:///node_modules/@theoremjs/agents/src/providers/google/interactions/framing.d.ts":`import { z } from 'zod';
|
|
11433
|
+
import type { InteractionPart, ModelRequest, TurnHistoryMessage } from '../../../kernel/types.js';
|
|
11434
|
+
/** A turn as Interactions frames it: the request, plus whether Google keeps it and what it continues. */
|
|
11435
|
+
export type InteractionsRequest = ModelRequest & {
|
|
11436
|
+
store?: boolean;
|
|
11437
|
+
previousInteractionId?: string;
|
|
11438
|
+
/** What came after the stored interaction, sent in place of the whole history. */
|
|
11439
|
+
continuation?: TurnHistoryMessage[];
|
|
11440
|
+
};
|
|
11441
|
+
export declare function camelToSnake(key: string): string;
|
|
11442
|
+
export declare function toGoogleValue(value: unknown): unknown;
|
|
11443
|
+
/** A part in camel case; \`toGoogleValue\` snake-cases \`mimeType\` to the documented \`mime_type\`. */
|
|
11444
|
+
export declare function wireInteractionPart(part: InteractionPart): Record<string, string>;
|
|
11445
|
+
export declare function userInputStep(parts: InteractionPart[]): Record<string, unknown>;
|
|
11446
|
+
/** A thought's signature, for the tool call at \`call\` in the same assistant message. */
|
|
11447
|
+
export declare const thoughtSignature: z.ZodType<{
|
|
11448
|
+
call: number;
|
|
11449
|
+
signature: string;
|
|
11450
|
+
}>;
|
|
11451
|
+
export declare function historySteps(msg: TurnHistoryMessage): Record<string, unknown>[];
|
|
11452
|
+
export declare function historyStep(msg: TurnHistoryMessage): Record<string, unknown>;
|
|
11453
|
+
export declare function jsonResponseFormat(schema: Record<string, unknown>): unknown[];
|
|
11454
|
+
export declare function attachResponseFormat(req: InteractionsRequest, camel: Record<string, unknown>): void;
|
|
11455
|
+
export declare function attachSpeechConfig(req: InteractionsRequest, generationConfig: Record<string, unknown>): void;
|
|
11456
|
+
export declare function inputStepsFromRequest(req: InteractionsRequest): Record<string, unknown>[];
|
|
11457
|
+
export declare function applyOptionalRequestFields(req: InteractionsRequest, camel: Record<string, unknown>): void;
|
|
11458
|
+
export declare function baseInteractionsBody(req: InteractionsRequest): Record<string, unknown>;
|
|
11459
|
+
export declare function toInteractionsBody(req: InteractionsRequest): Record<string, unknown>;
|
|
11424
11460
|
`,"file:///node_modules/@theoremjs/agents/src/providers/gemini/provider.d.ts":`import { type Provider } from '../../kernel/protocols/provider.js';
|
|
11425
11461
|
/** What registering \`geminiProvider\` takes as \`connection\`. */
|
|
11426
11462
|
export interface GeminiConnection {
|
|
@@ -12223,6 +12259,7 @@ import type { HandlerEvents } from './handler-events.js';
|
|
|
12223
12259
|
import { type McpSessionCache } from './mcp-sessions.js';
|
|
12224
12260
|
import type { ToolOperationClaim } from './operation.js';
|
|
12225
12261
|
import { type JsonSchema } from './schema.js';
|
|
12262
|
+
import { type SchemaIssue } from './schema-issues.js';
|
|
12226
12263
|
import { type ToolStageSupport } from './stage-run.js';
|
|
12227
12264
|
import type { HttpToolDef, McpToolDef, ModelToolResult, ToolAuthConfig, ToolBodyOutcome, ToolContext, ToolFailure, ToolGate } from './types.js';
|
|
12228
12265
|
export type AuthResolveResult = {
|
|
@@ -12271,7 +12308,7 @@ export declare function parseToolOutput<T>(schema: {
|
|
|
12271
12308
|
} | {
|
|
12272
12309
|
success: false;
|
|
12273
12310
|
error: {
|
|
12274
|
-
|
|
12311
|
+
issues: readonly SchemaIssue[];
|
|
12275
12312
|
};
|
|
12276
12313
|
};
|
|
12277
12314
|
}, responseData: unknown): {
|
|
@@ -12280,7 +12317,7 @@ export declare function parseToolOutput<T>(schema: {
|
|
|
12280
12317
|
} | {
|
|
12281
12318
|
success: false;
|
|
12282
12319
|
error: {
|
|
12283
|
-
|
|
12320
|
+
issues: readonly SchemaIssue[];
|
|
12284
12321
|
};
|
|
12285
12322
|
};
|
|
12286
12323
|
/**
|
|
@@ -12491,6 +12528,30 @@ export declare function emitGateSettlement(args: {
|
|
|
12491
12528
|
toolName: string;
|
|
12492
12529
|
labels: LabelOverrides | undefined;
|
|
12493
12530
|
}): AsyncGenerator<TurnEvent, string | undefined>;
|
|
12531
|
+
`,"file:///node_modules/@theoremjs/agents/src/kernel/tools/schema-issues.d.ts":`/**
|
|
12532
|
+
* Where a schema refused a value, as text. Every issue keeps its whole path.
|
|
12533
|
+
*
|
|
12534
|
+
* why: zod's \`flatten()\` keys each issue by the first segment of its path and drops the rest,
|
|
12535
|
+
* so a bad key inside \`action.save\` read as a bad \`action\`.
|
|
12536
|
+
*
|
|
12537
|
+
* @module
|
|
12538
|
+
*/
|
|
12539
|
+
/** One schema issue: the place in the value, and what was wrong there. */
|
|
12540
|
+
export type SchemaIssue = {
|
|
12541
|
+
readonly path: readonly PropertyKey[];
|
|
12542
|
+
readonly message: string;
|
|
12543
|
+
};
|
|
12544
|
+
/** A failure's \`details\` when a schema refuses a value. */
|
|
12545
|
+
export type SchemaIssueDetails = {
|
|
12546
|
+
/** Issues on the value itself. */
|
|
12547
|
+
formErrors: string[];
|
|
12548
|
+
/** Issues by top-level field. A line names the place below that field first: \`save.from: …\`. */
|
|
12549
|
+
fieldErrors: Record<string, string[]>;
|
|
12550
|
+
};
|
|
12551
|
+
/** A path as dotted text; empty at the root. */
|
|
12552
|
+
export declare function issuePath(path: readonly PropertyKey[]): string;
|
|
12553
|
+
/** The details of a refused value, keyed like zod's \`flatten()\` but with no part of a path lost. */
|
|
12554
|
+
export declare function schemaIssueDetails(issues: readonly SchemaIssue[]): SchemaIssueDetails;
|
|
12494
12555
|
`,"file:///node_modules/@theoremjs/agents/src/kernel/tools/handler-events.d.ts":`import type { ToolBoundary } from '../../guardrails/boundaries.js';
|
|
12495
12556
|
import type { Provenance, ResolvedGuardrailPolicy } from '../../guardrails/types.js';
|
|
12496
12557
|
import type { TurnEvent } from '../types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e,d as t,x as n}from"./schemas-D7cgkv3L.js";import{H as r}from"./tool-schema-D6i-fwc5.js";import{$a as i,$t as a,Ai as o,Cn as s,Gi as c,Ji as l,Pa as u,Pi as d,Qt as ee,Ra as te,Sa as ne,Sn as f,Tn as p,Wa as re,Xi as ie,Y as ae,Yi as oe,bi as m,bn as se,io as ce,ki as le,ma as ue,nn as de,oa as h,ro as g,wi as fe,xa as pe,xi as me,xn as _,zt as he}from"./shaped-data-9kDvR1de.js";import{c as v}from"./host-patterns-F-KZIzkF.js";import{A as ge,C as _e,O as ve,T as ye,_ as y,y as be}from"./schema-dtr41Lr7.js";import{a as xe,n as Se}from"./live-ingress-OuSlQ6q7.js";var Ce=2,we=4,Te=3,Ee=/(^|,)(\s*)("?)(?:([=@])|([+-])(?![0-9."]))/gm,De=/^[A-Za-z0-9+/]*={0,2}$/,Oe=new Set([`text/csv`,`text/plain`,`text/markdown`]);function b(e){let{maxFiles:t,maxBytes:n,maxTurnBytes:r,limitsByMime:i}=e;if(t&&n&&r)return{maxFiles:t,maxBytes:n,maxTurnBytes:r,limitsByMime:i}}function ke(e,t){if(t.limitsByMime){let n=p(e);if(t.limitsByMime[n])return t.limitsByMime[n];let[r]=n.split(`/`),i=`${r}/*`;if(t.limitsByMime[i])return t.limitsByMime[i]}return t.maxBytes}function x(e){return`uri`in e}function Ae(e){if(e.type===`speech`)throw new v(`request`,`Profile ${e.id} (speech) does not accept media input`);if(e.type===`live`)throw new v(`request`,`Profile ${e.id} (live) does not accept turn attachment input`);if(e.type===`host`||e.type===`decision`||e.type===`embedding`)throw new v(`request`,`Profile ${e.id} (${e.type}) does not accept turn input`);let t=b(e.inputs??{});if(!t)throw new v(`config`,`Profile ${e.id} must set maxFiles, maxBytes, and maxTurnBytes`);return t}function je(e){let t=0;return e.endsWith(`==`)?t=Ce:e.endsWith(`=`)&&(t=1),Math.floor(e.length*Te/we)-t}function Me(e){try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(e)}catch{return new TextDecoder(`latin1`).decode(e)}}function Ne(e){return e.replace(Ee,(e,...t)=>{let[n,r,i,a,o]=t;return`${n}${r}${i}'${a??``}${o??``}`})}function Pe(e,t,n){let r=Me(t);return e===`text/csv`&&(r=Ne(r)),new TextEncoder().encode(n.read(r))}function S(e,t){return t?{...e,fileName:t}:e}function C(e,t,n){return t.filter(t=>!_(e,t.mimeType)).map(e=>S({code:`mime_not_allowed`,params:{mimeType:e.mimeType,channel:n}},e.name))}function Fe(e,t){let n=[];e.length>t.maxFiles&&n.push({code:`too_many_files`,params:{maxFiles:t.maxFiles}});let r=0;for(let i of e){if(i.sizeBytes===void 0)continue;let e=ke(i.mimeType,t);i.sizeBytes>e&&n.push(S({code:`file_too_large`,params:{maxBytes:e}},i.name)),r+=i.sizeBytes}return r>t.maxTurnBytes&&n.push({code:`turn_too_large`,params:{maxTurnBytes:t.maxTurnBytes}}),n}function Ie(e,t,n){let r=[];return t.length>0&&!e.attachments&&r.push({code:`attachments_not_accepted`,params:{channel:`attachment`}}),n.length>0&&!e.voice&&r.push({code:`voice_not_accepted`,params:{channel:`voice`}}),r.length>0||t.length===0&&n.length===0?r:(e.attachments&&r.push(...C(e.attachments,t,`attachment`)),e.voice&&r.push(...C(e.voice,n,`voice`)),e.limits?[...r,...Fe([...t,...n],e.limits)]:[...r,{code:`limits_unconfigured`}])}var Le={mime_not_allowed:`attachments.mime_not_allowed`,too_many_files:`attachments.too_many_files`,too_many_of_kind:`attachments.too_many_of_kind`,file_too_large:`attachments.file_too_large`,turn_too_large:`attachments.turn_too_large`,attachments_not_accepted:`attachments.not_accepted`,voice_not_accepted:`attachments.not_accepted`,limits_unconfigured:`attachments.limits_unconfigured`};function Re(e){let t={};for(let[n,r]of Object.entries(e.params??{}))r!==void 0&&(t[n]=r);return e.fileName!==void 0&&(t.fileName=e.fileName),{key:Le[e.code],params:t}}function ze(e,t){let n=Re(e);return g(n.key,n.params,t)}function w(e){return new v(`input`,`attachments refused: ${e.map(e=>e.code).join(`, `)}`,{copy:e.map(Re)})}function T(e){if(!De.test(e))throw new v(`request`,`attachment data must be base64`);return je(e)}function E(e){let t={mimeType:e.mimeType,name:e.name};return x(e)||(t.sizeBytes=T(e.data)),t}function Be(e,t,n){if(!Ve(t,n))return;let r=Ae(e),i=Ie({attachments:f(e,`attachments`),voice:f(e,`voice`),limits:r},(t??[]).map(E),(n??[]).map(E));if(i.length>0)throw w(i)}function D(e,t){if(x(e))return e;let{mimeType:n,data:r}=e;if(!Oe.has(p(n)))return e;let i=Pe(n,pe(r),t);return{...e,data:ne(i)}}function Ve(e,t){return(e?.length??0)>0||(t?.length??0)>0}function He(e,t,n,r){return Be(e,t,n),{attachments:t?.length?t.map(e=>D(e,r.attachment)):t,voice:n?.length?n.map(e=>D(e,r.voice)):n}}function O(e){let t=Object.keys(e);return t.length===1?t[0]:void 0}function k(e){return e==null}function A(e){return k(e)||typeof e!=`object`||Array.isArray(e)?null:e}function j(e){let t=A(e);return!t||t.type!==void 0&&t.type!==`object`?null:t}function M(e){let t=e.required;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}function N(e){let t=e.properties;return A(t)??{}}function Ue(e,t){return e?`${e}.${t}`:t}function P(e,t){t.push({path:e,error:`required field '${e}' is missing`})}async function We(e,t,n,r,i,a){if(!n)return;let o;try{o=await n(t,r)}catch(e){a.push(e),o={isValid:!1}}o.isValid||i.push({path:e,error:o.error||o.finding||`Validation failed for '${e}'`})}async function Ge(e){let{path:t,propSchema:n,child:r,isRequired:i,fields:a,options:o,failures:s,crashes:c}=e;if(k(r)){i&&P(t,s);return}await We(t,r,a?.[t],o,s,c);let l=j(n),u=l?A(r):null;l&&u&&await F(l,u,t,a,o,s,c)}async function F(e,t,n,r,i,a,o){let s=N(e),c=new Set(M(e)),l=new Set([...Object.keys(s),...c]),u=A(t);for(let e of l)await Ge({path:Ue(n,e),propSchema:s[e],child:u?.[e],isRequired:c.has(e),fields:r,options:i,failures:a,crashes:o})}async function Ke(e,t,n,r,i=[]){let a=j(e);if(!a)throw new v(`config`,`structured validation requires a JSON Schema object root`);let o=[];if(!A(t)){for(let e of M(a))P(e,o);return o}return await F(a,t,``,n,r,o,i),o}function qe(e,t){let n=e;for(let e of t.split(`.`)){let t=j(n);if(!t)return!1;let r=N(t);if(!Object.hasOwn(r,e)&&!M(t).includes(e))return!1;n=r[e]}return!0}function Je(e){return e.map(e=>e.error).join(`; `)}function I(e,t){let n=e;for(let e of t.split(`.`))n=A(n)?.[e];return n}function L(e,t,n){let[r,...i]=t.split(`.`),a=A(e)??{};return r===void 0?e:{...a,[r]:i.length?L(a[r],i.join(`.`),n):n}}async function Ye(e,t,n,r=[]){let i=[];for(let[a,o]of Object.entries(t??{})){let t=I(e,a);if(Array.isArray(t))for(let[e,s]of t.entries()){let t;try{t=await o.check(s,n)}catch(e){r.push(e),t={isValid:!1}}t.isValid||i.push({path:a,index:e,item:s,reason:t.error||t.finding||`Validation failed for '${a}'`,onFail:o.onFail})}}return i}function R(e,t){let n=e;for(let e of t.split(`.`)){let t=j(n);if(!t)return;n=N(t)[e]}let r=A(n);if(r?.type===`array`)return A(r.items)??void 0}function Xe(e,t,n,r){if(!n.provider?.trim()||!n.apiId?.trim())throw new v(`config`,g(`provider.binding_identity`))}function Ze(e){B(e.id,e.models),Y(e.id,e.observability),zt(e.id,e.inputs);for(let[t,n]of Object.entries(e.models))H(e.id,t,n);return{type:`embedding`,id:e.id,identity:{handle:e.identity.handle},models:e.models,defaultModel:V(e.id,e),allowModelSelect:e.allowModelSelect,inputs:e.inputs,guardrails:e.guardrails,observability:e.observability,labels:e.labels}}function Qe(e){B(e.id,e.models),q(e.id,e.guardrails),Y(e.id,e.observability);for(let[t,n]of Object.entries(e.models))H(e.id,t,n);if(`text`in e.inputs&&e.inputs.text!==!1)throw new v(`config`,`Profile ${e.id}: a transcription takes a voice clip, so inputs.text must be false`);return{type:`transcription`,id:e.id,identity:{handle:e.identity.handle},...W(e),providerContinuation:void 0,maxSteps:void 0,inputs:{...e.inputs,text:!1},guardrails:e.guardrails,observability:e.observability,labels:e.labels}}function z(e,t,n,r){let i=r.safeParse(n);if(!i.success)throw new v(`config`,`Profile ${e} model '${t}': ${i.error.issues.map(e=>`${ae(e.path)}: ${e.message}`).join(`; `)}`)}function $e(e,t,n){if(z(e,t,n,a),Xe(e,t,n,`decision`),`retry`in n)throw new v(`config`,`Profile ${e} model '${t}': a decision binding takes no retry; a decision retries only a transient failure, by the kernel's rule`);if(n.timeoutMs!==void 0&&(!Number.isFinite(n.timeoutMs)||n.timeoutMs<=0))throw new v(`config`,`Profile ${e} model '${t}' timeoutMs must be > 0`)}function et(e){let t=e.models?O(e.models):void 0;if(!t)throw new v(`config`,`Profile ${e.id}: type 'decision' must declare exactly one model`);$e(e.id,t,e.models[t])}function tt(e){if(e.inputs.state!==`json`)throw new v(`config`,`Profile ${e.id}: decision inputs.state must be 'json'`);let t=e.inputs.maxStateBytes;if(t!==void 0&&!(Number.isInteger(t)&&t>0))throw new v(`config`,`Profile ${e.id}: decision inputs.maxStateBytes must be a positive integer`);if(!e.decision.contract.trim())throw new v(`config`,`Profile ${e.id}: decision.contract must be non-empty`)}function nt(e){return et(e),tt(e),Y(e.id,e.observability),{...e,identity:{handle:e.identity.handle}}}function rt(e){return e===void 0?{}:{parallel:e}}function it(e){return at(e.id,e.tools),Y(e.id,e.observability),{type:`host`,id:e.id,tools:{allow:e.tools.allow,...rt(e.tools.parallel)},guardrails:e.guardrails,observability:e.observability,labels:e.labels}}function at(e,t){if(!Array.isArray(t.allow))throw new v(`config`,`Profile ${e}: type 'host' must set tools.allow`)}function B(e,t){if(Object.keys(t).length===0)throw new v(`config`,`Profile ${e} must declare at least one model`)}function V(e,t){let n=t.defaultModel??O(t.models);if(!n)throw new v(`config`,`Profile ${e} must set defaultModel when more than one model is declared`);if(!t.models[n])throw new v(`config`,`Profile ${e} defaultModel '${n}' is not declared`);return n}function H(e,t,n){U(e,t,n),z(e,t,n,de),U(e,t,n)}function U(e,t,n){let r=n.efforts;if(!r||Object.keys(r).length===0){if(n.defaultEffort||n.allowEffortSelect)throw new v(`config`,`Profile ${e} model '${t}': defaultEffort and allowEffortSelect require efforts`);return}for(let[n,i]of Object.entries(r))if(!d.includes(i))throw new v(`config`,`Profile ${e} model '${t}' effort '${n}': '${i}' is not a thinking level (${d.join(`, `)})`);let i=Object.keys(r),a=n.defaultEffort??(i.length===1?i[0]:void 0);if(!a)throw new v(`config`,`Profile ${e} model '${t}' must set defaultEffort when more than one effort is declared`);if(!r[a])throw new v(`config`,`Profile ${e} model '${t}' defaultEffort '${a}' is not declared`);if(n.allowEffortSelect&&i.length<2)throw new v(`config`,`Profile ${e} model '${t}' allowEffortSelect requires at least two efforts`)}function W(e){return{providerContinuation:e.providerContinuation?ue.parse(e.providerContinuation):{},models:e.models,defaultModel:V(e.id,e),allowModelSelect:e.allowModelSelect,maxSteps:e.maxSteps}}function G(e,t,n){if(n?.length){for(let r of n)if(!he(r))throw new v(`config`,`Profile ${e}: turnBehaviour.resumption.${t} may only include ContinueStopKind (${me.join(` | `)}); got '${r}'`)}}function ot(e,t){t&&(G(e,`allowContinue`,t.allowContinue),G(e,`autoContinue`,t.autoContinue))}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function st(e,t){let n=[e];for(let e of t)n=n.flatMap(t=>K(t)?e===`*`?Object.values(t):[t[e]]:[]);return n}var ct=Object.entries(le).filter(([,e])=>e.required===!0).map(([e,t])=>[e,t.profileTypes]).sort(([e],[t])=>e.split(`.`).length-t.split(`.`).length);function lt(e){if(!K(e))throw new v(`config`,`Profile definition must be an object`);let t=typeof e.id==`string`&&e.id.trim()?e.id:void 0;if(!t)throw new v(`config`,`Profile definition must set id`);if(!o.find(t=>t===e.type))throw new v(`config`,`Profile ${t}: type must be one of ${o.join(`, `)}`)}function ut(e){let t=e.identity?.handle,n=[[`id`,e.id,64],[`identity.handle`,typeof t==`string`?t:``,32]];for(let[t,r,i]of n)if(!(Array.from(r).length<=i))throw new v(`config`,`Profile ${e.id.slice(0,64)}: ${t} must be at most ${i} characters`)}function dt(e){let{id:t,type:n}=e,r=e;for(let[e,i]of ct){if(i&&!i.includes(n))continue;let a=oe(e),o=st(r,a.slice(0,-1)),s=a[a.length-1];if(o.some(e=>{if(!K(e))return!1;let t=e[s];return t==null||t===``}))throw new v(`config`,`Profile ${t}: type '${n}' must set ${a.join(`.`)}`)}}function ft(e){let{id:t,type:n}=e;if(n!==`live`&&ie(`inputs`).includes(n)&&e.inputs==null)throw new v(`config`,`Profile ${t}: type '${n}' must set inputs`)}function pt(e){let[t]=l(e);if(!t)return;let{offValue:n,reason:r}=t.scope,i=n===void 0?``:` (other than ${n})`;throw new v(`config`,`Profile ${e.id}: type '${e.type}' must not set ${t.path}${i} — ${r}`)}function mt(e,t){let n=t.turnBehaviour;ot(e,n?.resumption)}function ht(e,t){let n=t=>new v(`config`,`Profile ${e}: ${t}`),r=t?.maxRetries;if(r!==void 0&&(!Number.isInteger(r)||r<0))throw n(`outputs.validation.maxRetries must be a non-negative integer`)}function q(e,t){let n=t=>new v(`config`,`Profile ${e}: ${t}`),r=Object.keys(t??{}).find(e=>!J.includes(e));if(r!==void 0)throw n(`guardrails.${r} is not a setting; it takes ${J.join(`, `)}`);_t(t?.blockedReply,n)}var J=[`quota`,`detect`,`blockedReply`,`network`,`taint`],gt=[`onBlock`,`maxRetries`];function _t(e,t){if(e===void 0)return;let n=Object.keys(e).find(e=>!gt.includes(e));if(n!==void 0)throw t(`guardrails.blockedReply.${n} is not a setting; it takes onBlock and maxRetries`);let{onBlock:r,maxRetries:i}=e;if(r!==void 0&&!u.includes(r))throw t(`guardrails.blockedReply.onBlock must be one of ${u.join(`, `)}`);if(i!==void 0&&(!Number.isInteger(i)||i<0))throw t(`guardrails.blockedReply.maxRetries must be a non-negative integer`)}function vt(e){let t=e.guardrails?.detect,n=e.type===`host`?h(`guardrails.detect`,t,te):h(`guardrails.detect`,t);if(n!==void 0)throw new v(`config`,`Profile ${e.id}: ${n}`)}function Y(e,t){try{let n=xe(t);if(!Number.isFinite(n.retainForDays))throw new v(`config`,`Profile ${e}: observability.retainForDays must be a finite number`);if(n.rotateAfterMiB<=0||!Number.isFinite(n.rotateAfterMiB))throw new v(`config`,`Profile ${e}: observability.rotateAfterMiB must be a positive number`)}catch(t){if(t instanceof v&&t.message.startsWith(`Profile `))throw t;let n=t instanceof Error?t.message:String(t);throw new v(re(t),`Profile ${e}: ${n}`,{cause:t})}}function yt(e){if(e.type===`host`||e.type===`decision`||e.type===`speech`||e.type===`transcription`||e.type===`embedding`)return;let{options:t,system:n}=e.identity,r=n??``;_e(r,`Profile ${e.id} identity.system`);let i=ye(r,t,e.inputs?.options);if(i)throw new v(`config`,`Profile ${e.id} identity.system: ${i}`)}function X(e){let t=bt(e),[n]=c(e);if(n)throw new v(`config`,`Profile ${e.id}: ${n.path} ${n.message}`);return t}function bt(e){lt(e);for(let t of[`key`,`fallbackKey`,`protocol`,`provider`])if(t in e)throw new v(`config`,g(`provider.profile_configuration`,{profile:e.id,field:t}));pt(e),ft(e),dt(e),ut(e),e.labels&&ce(e.labels,`Profile ${e.id}`);for(let t of i)if(e.labels?.[t]!==void 0)throw new v(`config`,`Profile ${e.id}: labels '${t}' is a host line, which a profile cannot change; set it with overrideLabels`);if(yt(e),vt(e),e.type===`host`)return it(e);if(e.type===`decision`)return nt(e);if(e.type===`embedding`)return Ze(e);if(e.type===`transcription`)return Qe(e);B(e.id,e.models),mt(e.id,e),q(e.id,e.guardrails),e.type===`text`&&ht(e.id,e.outputs?.validation),Y(e.id,e.observability);for(let[t,n]of Object.entries(e.models))H(e.id,t,n);let t=e.type===`speech`?{handle:e.identity.handle}:{handle:e.identity.handle,options:e.identity.options,system:e.identity.system},n=e.guardrails,r=e.observability,a=e.labels,o=W(e),s;switch(e.type){case`text`:s={type:`text`,id:e.id,identity:t,...o,tools:e.tools,inputs:e.inputs,outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:a};break;case`image`:s={type:`image`,id:e.id,identity:t,...o,image:e.image,tools:e.tools,inputs:e.inputs,outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:a},Et(s.id,s.inputs.attachments?.accept),Tt(s.id,s.image);break;case`speech`:s={type:`speech`,id:e.id,identity:t,...o,speech:e.speech,outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:a};break;case`live`:s={type:`live`,id:e.id,identity:t,...o,live:e.live,inputs:e.inputs,tools:{allow:e.tools.allow,...rt(e.tools.parallel)},turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:a},Se(s),Ot(s.id,s.live.contextCompression),Dt(s);break;default:throw new v(`config`,`Unknown profile type '${String(e)}'`)}return Ct(s),xt(s),St(s),s}function xt(e){let{maxSteps:t}=e;if(!(t===void 0||Number.isInteger(t)&&t>0))throw new v(`config`,`Profile ${e.id}: maxSteps must be a whole number of 1 or more; leave it out for the default of 20`)}function St(e){if(e.type===`text`&&e.turnBehaviour?.atStepLimit===`answer`&&e.maxSteps===1)throw new v(`config`,`Profile ${e.id}: turnBehaviour.atStepLimit 'answer' with maxSteps 1 leaves no step that can call a tool`)}function Ct(e){if(e.type===`live`)return;let t=e.outputs?.structured;if(!t||typeof t==`string`)return;let n=ge(e,t.by);if(!n)throw new v(`config`,`Profile ${e.id}: outputs.structured.by '${t.by}' is not one of the profile's options`);let r=ve(n),i=Object.keys(t.map).filter(e=>!r.includes(e));if(i.length)throw new v(`config`,`Profile ${e.id}: outputs.structured.map maps ${i.join(`, `)}, not a choice of option '${t.by}'`)}var wt={n:{ok:e=>Number.isInteger(e)&&e>=1,rule:`a whole number of 1 or more`},seed:{ok:Number.isInteger,rule:`a whole number`},outputCompression:{ok:e=>Number.isInteger(e)&&e>=0&&e<=100,rule:`a whole number from 0 to 100`}};function Tt(e,t){for(let[n,{ok:r,rule:i}]of Object.entries(wt)){let a=t[n];if(a!==void 0&&!r(a))throw new v(`config`,`Profile ${e}: image.${n} must be ${i}`)}t.references?.forEach((t,n)=>{let r=`Profile ${e}: image.references[${n}]`;if(se(t.mimeType)!==`image`)throw new v(`config`,`${r} must be an image, not '${t.mimeType}'`);if(!(x(t)?t.uri:t.data))throw new v(`config`,`${r} needs its bytes or its uri`)})}function Et(e,t){let n=t?.filter(e=>!_(fe,e));if(n?.length)throw new v(`config`,`Profile ${e}: an image profile's attachments take images, video, and PDF only, not ${n.join(`, `)}`)}function Dt(e){let{greeting:t,resumed:n,sessionResumption:r}=e.live,i=`Profile ${e.id} live`;if(t!==void 0&&(typeof t!=`string`||!t.trim()))throw new v(`config`,`${i}.greeting must be a prompt; leave it out to wait`);if(!n)return;if(typeof n.prompt!=`string`||!n.prompt.trim())throw new v(`config`,`${i}.resumed.prompt must be a prompt`);let{afterMs:a}=n;if(a!==void 0&&!(Number.isFinite(a)&&a>=0))throw new v(`config`,`${i}.resumed.afterMs must be 0 or more milliseconds`);if(!r)throw new v(`config`,`${i}.resumed needs live.sessionResumption: without it no call resumes`)}function Ot(e,t){if(!t)return;let n=`Profile ${e} live.contextCompression`,r=t.triggerTokens,i=t.slidingWindow.targetTokens;if(Z(`${n}.triggerTokens`,r),Z(`${n}.slidingWindow.targetTokens`,i),r!==void 0&&i!==void 0&&i>=r)throw new v(`config`,`${n}: slidingWindow.targetTokens must be below triggerTokens`)}function Z(e,t){if(!(t===void 0||Number.isInteger(t)&&t>0))throw new v(`config`,`${e} must be a whole number above 0`)}function kt(e,t,n,r){let i=`Profile ${t.id} model ${n} compaction`;if(At(i,r),jt(i,r),r.profile===void 0){if(t.type!==`text`||t.inputs.text===!1)throw new v(`config`,`${i}: a profile that compacts itself must be a text profile that takes text`);return}let a=e.get(r.profile);if(!a)throw new v(`config`,`${i}: compaction profile '${r.profile}' must be registered before '${t.id}'`);if(a.type!==`text`||a.inputs.text===!1)throw new v(`config`,`${i}: compaction profile '${r.profile}' must be a text profile that takes text`)}function At(e,t){if(t.maxTokens<=0)throw new v(`config`,`${e}: maxTokens must be > 0`);if(t.compactAt<=0||t.compactAt>=1)throw new v(`config`,`${e}: compactAt must be in (0, 1)`)}function jt(e,t){if(t.previousExchanges<0)throw new v(`config`,`${e}: previousExchanges must be >= 0`);if(t.previousExchanges<1&&t.previousExchanges>=t.compactAt)throw new v(`config`,`${e}: previousExchanges as fraction (${t.previousExchanges}) must be < compactAt (${t.compactAt})`);if(t.previousExchanges>1&&!Number.isInteger(t.previousExchanges))throw new v(`config`,`${e}: previousExchanges >= 1 must be an integer`)}function Mt(e,t){for(let n of y(t))if(e.get(n)?.type===`builtin`)throw new v(`config`,t.type===`host`?`Profile ${t.id} lists builtin '${n}' in tools.allow — type 'host' never runs a model`:`Profile ${t.id} lists builtin '${n}' in tools.allow — declare it on models.*.builtInTools instead`)}function Nt(e,t){let n=be(t)?.t2Loader;if(n){if(!y(t).includes(n))throw new v(`config`,`Profile ${t.id} tools.t2Loader '${n}' must also be listed in tools.allow`);if(e.get(n)?.type!==`function`)throw new v(`config`,`Profile ${t.id} tools.t2Loader '${n}' must be a registered type: 'function' tool`)}}function*Pt(e){for(let[t,n]of Object.entries(e.models))for(let e of n.builtInTools??[])yield{modelId:t,id:e}}function Ft(e,t){for(let{modelId:n,id:r}of Pt(t))if(e.get(r)?.type!==`builtin`)throw new v(`config`,`Profile ${t.id} model '${n}' lists '${r}' in builtInTools — not a registered builtin`)}function Q(e){let t=e.type===`text`?e.outputs?.structured:void 0;return t?typeof t==`string`?[t]:[...new Set([...Object.values(t.map),t.fallback])]:[]}function It(e,t){return t?.type===`text`?Q(t).flatMap(t=>{let n=e.find(t);return n?[n.jsonSchema]:[]}):[]}function Lt(e,t){let n=Q(t).map(n=>{let r=e.find(n);if(!r)throw new v(`config`,`Profile ${t.id}: outputs.structured names '${n}', which is not a registered schema; register it before the profile`);return r}),r=t.type===`text`?t.outputs?.validation:void 0,i=Object.keys(r?.fields??{}),a=Object.keys(r?.items??{});if(!i.length&&!a.length)return;if(!n.length)throw new v(`config`,`Profile ${t.id}: outputs.validation checks a structured reply, so it needs outputs.structured`);let o=a.filter(e=>!n.some(t=>R(t.jsonSchema,e)));if(o.length)throw new v(`config`,`Profile ${t.id}: outputs.validation.items has ${o.join(`, `)}, which no structured schema reaches as a list with an items schema`);let s=i.filter(e=>!n.some(t=>qe(t.jsonSchema,e)));if(s.length)throw new v(`config`,`Profile ${t.id}: outputs.validation.fields has ${s.join(`, `)}, which no structured schema reaches through object properties`)}function Rt(e){let t=s(e)?.context;if(!t)return;let n=m;if(t.from.length===0||t.from.some(e=>!n.includes(e)))throw new v(`config`,`Profile ${e.id}: inputs.context.from must list ${m.join(` or `)}`);if(!(Number.isInteger(t.maxChars)&&t.maxChars>0))throw new v(`config`,`Profile ${e.id}: inputs.context.maxChars must be a positive integer`)}function zt(e,t){if(!t)return;let{attachments:n,voice:r,maxFiles:i,maxBytes:a,maxTurnBytes:o,limitsByMime:s}=t,c={maxFiles:i,maxBytes:a,maxTurnBytes:o};if((n||r)&&Object.values(c).some(e=>e===void 0))throw new v(`config`,`Profile ${e} must set maxFiles, maxBytes, and maxTurnBytes`);for(let[e,t]of Object.entries(s??{}))c[`limitsByMime['${e}']`]=t;for(let[t,n]of Object.entries(c))if(n!==void 0&&!(Number.isInteger(n)&&n>0))throw new v(`config`,`Profile ${e}: inputs.${t} must be a positive integer`)}function Bt(e,t,n){let r=new Map,i=i=>{let a=X(i),o=n&&a.type!==`host`?{...a,models:Object.fromEntries(Object.entries(a.models).map(([e,t])=>[e,ee(n.require(t.provider,t.apiId),t,a.type)]))}:a;if(Mt(e,o),Nt(e,o),o.type!==`host`&&o.type!==`decision`&&o.type!==`embedding`){Ft(e,o),zt(o.id,s(o)),Rt(o),Lt(t,o);for(let[e,t]of Object.entries(o.models))t.compaction&&kt(r,o,e,t.compaction)}r.set(o.id,o)};return{register:i,registerMany(e){for(let t of e)i(t)},get(e){let t=r.get(e);if(!t)throw new v(`config`,`Unknown profile '${e}'`);return t},find:e=>r.get(e),has:e=>r.has(e),list:()=>[...r.values()],clear:()=>r.clear()}}function Vt(e){let t=e?.trim()??``;if(t.startsWith(`AIza`))return`gemini`;if(t.startsWith(`sk-or-`))return`openrouter`}function Ht(e){let t;try{t=new URL(e.baseUrl)}catch{throw new v(`config`,`Enter a valid localhost URL.`)}if(![`http:`,`https:`].includes(t.protocol)||![`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname)||t.username||t.password||t.search||t.hash)throw new v(`config`,`Use a localhost URL without credentials, query parameters or a fragment.`);return{baseUrl:t.href.replace(/\/$/,``),fetch:(e,n)=>new URL(e instanceof Request?e.url:String(e)).origin===t.origin?fetch(e,{...n,redirect:`error`,credentials:`omit`}):Promise.reject(new v(`blocked`,`Local requests must stay on the configured origin.`))}}var Ut=n({data:t(n({id:e().min(1)}))});async function Wt(e,t){let n=Ht(e);if(!n?.fetch)throw new v(`config`,`Enter a local endpoint.`);let r=await n.fetch(`${n.baseUrl}/v1/models`,{signal:t,headers:{Accept:`application/json`}});if(!r.ok)throw new v(`network`,`Local model list returned HTTP ${r.status}.`);let i=Ut.safeParse(await r.json());if(!i.success)throw new v(`request`,`The endpoint returned an invalid model list.`);return[...new Set(i.data.data.map(e=>e.id))]}var Gt=`https://openrouter.ai/api/v1/models`,Kt=`https://openrouter.ai/api/v1/embeddings/models`,qt=[{id:`gemini-embedding-2-preview`,label:`Gemini Embeddings 2 (preview)`},{id:`gemini-embedding-001`,label:`Gemini Embedding 001`}],Jt=[{id:`liquid/lfm-2.5-embedding-350m:free`,label:`Liquid LFM 2.5 Embedding 350M (free)`},{id:`nvidia/nemotron-3-embed-1b:free`,label:`NVIDIA Nemotron 3 Embed 1B (free)`},{id:`nvidia/llama-nemotron-embed-vl-1b-v2:free`,label:`NVIDIA Llama Nemotron Embed VL 1B v2 (free)`}],Yt={text:`text`,image:`image`,speech:`speech`,transcription:`transcription`,live:void 0,embedding:void 0},Xt=n({data:t(n({id:e().min(1),name:e().optional(),architecture:n({output_modalities:t(e()).optional()}).optional()}))}),Zt=n({data:t(n({id:e().min(1),name:e().optional()}))}),Qt=n({models:t(n({name:e().min(1),displayName:e().optional(),supportedGenerationMethods:t(e()).optional()})).optional(),nextPageToken:e().optional()}),$t=5;async function $(e,t,n){let r=await fetch(t,{...n,redirect:`error`,credentials:`omit`});if(r.status===400||r.status===401||r.status===403)throw new v(`auth`,`${e} refused the key.`);if(!r.ok)throw new v(`network`,`${e} model list returned HTTP ${r.status}.`);return await r.json()}async function en(e,t,n,r){let i=n?.trim();if(t===`embedding`&&!i)return[...e===`openrouter`?Jt:qt];if(e===`openrouter`)return await tn(t,i,r);if(!i)throw new v(`auth`,`Choose a key to list Gemini models.`);return await rn(t,i,r)}async function tn(e,t,n){let r={signal:n,headers:{Accept:`application/json`,...t?{Authorization:[`Bearer`,t].join(` `)}:{}}};if(e===`embedding`){let e=Zt.safeParse(await $(`OpenRouter`,Kt,r));if(!e.success)throw new v(`bad_response`,`OpenRouter returned an invalid embedding model list.`);return e.data.data.map(e=>({id:e.id,label:e.name??e.id}))}let i=Yt[e];if(!i)return[];let a=Xt.safeParse(await $(`OpenRouter`,`${Gt}?output_modalities=${i}`,r));if(!a.success)throw new v(`bad_response`,`OpenRouter returned an invalid model list.`);return a.data.data.filter(e=>e.architecture?.output_modalities?.includes(i)??!0).map(e=>({id:e.id,label:e.name??e.id}))}var nn={live:`bidiGenerateContent`,embedding:`embedContent`};async function rn(e,t,n){let i=nn[e]??`generateContent`,a=[],o;for(let e=0;e<$t;e++){let e=new URL(r);e.searchParams.set(`pageSize`,`1000`),o&&e.searchParams.set(`pageToken`,o);let s=Qt.safeParse(await $(`Google`,e.href,{signal:n,headers:{Accept:`application/json`,"x-goog-api-key":t}}));if(!s.success)throw new v(`bad_response`,`Google returned an invalid model list.`);for(let e of s.data.models??[]){if(!e.supportedGenerationMethods?.includes(i))continue;let t=e.name.replace(/^models\//,``);a.push({id:t,label:e.displayName??t})}if(o=s.data.nextPageToken,!o)break}return a}function an(e){return[...new Set([e.key,e.fallbackKey,...Object.values(e.models??{}).flatMap(e=>[e.keySlot,e.fallbackKeySlot])].filter(e=>!!e))]}function on(e,t){return Object.fromEntries(e.map(e=>[e,Object.hasOwn(t,e)?t[e]:void 0]))}export{He as C,b as S,ze as _,an as a,T as b,X as c,Ke as d,Je as f,O as g,L as h,Ht as i,It as l,I as m,Wt as n,on as o,R as p,en as r,Bt as s,Vt as t,Ye as u,Ie as v,x,w as y};
|