@theoremjs/studio 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.
- package/browser-connection.d.ts +1 -2
- package/package.json +4 -4
- package/page/assets/{BottomSheet-v4keekfB.js → BottomSheet-gvxs6HLX.js} +1 -1
- package/page/assets/{ConsoleFrame-CHnnxxNA.js → ConsoleFrame-DjKftiM3.js} +1 -1
- package/page/assets/{DateInput-CYFXY_3W.js → DateInput-BpXRJu6W.js} +1 -1
- package/page/assets/{MenuBottomSheet-BR8JYBqn.js → MenuBottomSheet-C-aSCSIv.js} +1 -1
- package/page/assets/{PowerSearchBottomSheet-DSkpQQys.js → PowerSearchBottomSheet-CadUl0hQ.js} +1 -1
- package/page/assets/{RankedBars-C_arZO1h.js → RankedBars-BqvXkuhw.js} +1 -1
- package/page/assets/{SchemaFields-DvOp5_M3.js → SchemaFields-BA_tTlTT.js} +1 -1
- package/page/assets/{TokenizerBottomSheet-DjiTJgA9.js → TokenizerBottomSheet-BVgCEcFv.js} +1 -1
- package/page/assets/{ToolResultCharts-t1kqy-J6.js → ToolResultCharts-Ju_2APDe.js} +1 -1
- package/page/assets/{Toolbar-CkD1V_z_.js → Toolbar-Bodaemo6.js} +1 -1
- package/page/assets/{TraceInspector-CGGxz_g-.js → TraceInspector-CCjkzWyI.js} +2 -2
- package/page/assets/TraceOverview-BtC8GQVd.js +57 -0
- package/page/assets/{_virtual_studio-type-sources-CuPTbB69.js → _virtual_studio-type-sources-CdnMqL-n.js} +115 -66
- package/page/assets/browser-connection-8HG8E7-I.js +1 -0
- package/page/assets/browser-engine-nrFEmQVr.js +16 -0
- package/page/assets/{browser-transport-Dq9itWDy.js → browser-transport-C4b9Cns1.js} +2 -2
- package/page/assets/compile--gO-Z1FH.js +4 -0
- package/page/assets/{encode-files-Dc2wHsb6.js → encode-files-7UPrYBrF.js} +1 -1
- package/page/assets/{export-agent-Y0Y8mdbB.js → export-agent-CJU4yuZq.js} +1 -1
- package/page/assets/{getRadiusAndStrokeWidthFromDot-bzD-VA8b.js → getRadiusAndStrokeWidthFromDot-Ecj-jR5D.js} +1 -1
- package/page/assets/{guardrail-health-BGyQi_jA.js → guardrail-health-DFvepe74.js} +2 -2
- package/page/assets/{guardrail-tester-DbR85sml.js → guardrail-tester-D0nvciLt.js} +1 -1
- package/page/assets/{index-Cfhzi3KD.js → index-DdfSX5Od.js} +18 -18
- package/page/assets/{json-code-D2imJbsd.js → json-code-ChVouP8g.js} +1 -1
- package/page/assets/{labels-provider-CTjEbRdu.js → labels-provider-BO_XYaPQ.js} +1 -1
- package/page/assets/{live-messages-Bp_b714P.js → live-messages-BrXwocbM.js} +1 -1
- package/page/assets/{prompt-row-eETPWTfK.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-D4bn5YDU.js → schema-dtr41Lr7.js} +2 -2
- package/page/assets/shaped-data-9kDvR1de.js +25 -0
- package/page/assets/{stub-CZ_Xswg8.js → stub-B275bXj-.js} +1 -1
- package/page/assets/{studio-code-pane-lxwvQgJE.js → studio-code-pane-epOb7YCi.js} +3 -3
- package/page/assets/{studio-console-BNOXf-xr.js → studio-console-KObtCJyc.js} +1 -1
- package/page/assets/{studio-decision-C9oxa1xo.js → studio-decision-CJWMloET.js} +1 -1
- package/page/assets/{studio-embedding-D8rA6MOH.js → studio-embedding-CGKFrG_-.js} +1 -1
- package/page/assets/{studio-host-console-XPl__wj7.js → studio-host-console-C5oeUj4u.js} +2 -2
- package/page/assets/studio-labels-EVPkcfTG.js +3 -0
- package/page/assets/{studio-live-B3gN-hIU.js → studio-live-B6Iy_esj.js} +1 -1
- package/page/assets/{studio-map-Cf2DHvn2.js → studio-map-DnuXEuzm.js} +1 -1
- package/page/assets/{studio-trace-replay-BCOqVguH.js → studio-trace-replay-Dxc3ePxC.js} +1 -1
- package/page/assets/{studio-type-checker-BWW15y7M.js → studio-type-checker-Cg2BuLET.js} +1 -1
- package/page/assets/{tool-schema-BMNs-MyH.js → tool-schema-D6i-fwc5.js} +1 -1
- package/page/assets/{trace-record-CS_K7b8l.js → trace-record-DFHRIoSR.js} +1 -1
- package/page/assets/tree-DXvClIpQ.js +3 -0
- package/page/assets/{turn-client-8TS8z-jZ.js → turn-client-Cl1P1QP9.js} +2 -2
- package/page/assets/types-Bl2lxigr.js +1 -0
- package/page/assets/{use-one-call-Ch9fKeMJ.js → use-one-call-BKua0dRg.js} +1 -1
- package/page/assets/{useDismissSearchOnTouchDrag-DJ9Di3hZ.js → useDismissSearchOnTouchDrag-lH0YZH1H.js} +1 -1
- package/page/assets/{workspace-CCtOtOGD.js → workspace-BpEiFb5f.js} +1 -1
- package/page/index.html +17 -17
- package/page/assets/TraceOverview-C3RFiWfu.js +0 -57
- package/page/assets/browser-connection-UWxIyv6u.js +0 -1
- package/page/assets/browser-engine-Ds0-ThtZ.js +0 -16
- package/page/assets/compile-NWqVUG3a.js +0 -4
- package/page/assets/reader-C8mnJAB6.js +0 -5
- package/page/assets/registry-DJBxNVIO.js +0 -1
- package/page/assets/shaped-data-yrTrXPh4.js +0 -25
- package/page/assets/studio-labels-CUJQgb-k.js +0 -3
- package/page/assets/tree-D6WoHLJe.js +0 -3
- package/page/assets/types-D9SHTHld.js +0 -1
|
@@ -4843,7 +4843,7 @@ export { createKernelScope, defaultKernelScope } from './src/kernel/scope.js';
|
|
|
4843
4843
|
export type { AwaitingUserInput, StageAffordance, StageApplyInput, StageApplyOutput, StageApplyWarning, StageApplyWarningCode, StageContext, StageEventExtra, StageHandler, StageMutate, StageResult, } from './src/kernel/stages.js';
|
|
4844
4844
|
export { applyStageResult, STAGE_AFFORDANCE_MATRIX, STAGE_AFFORDANCES, stageAllowsAffordance, stageEventFields, } from './src/kernel/stages.js';
|
|
4845
4845
|
export type { MediaTurnBehaviourSpec, ProfileTurnBehaviourSpec, ProfileTurnResumptionSpec, TurnContinueFrom, TurnStop, } from './src/kernel/stop.js';
|
|
4846
|
-
export { AUTO_CONTINUE_DELAY_MS, DEFAULT_ALLOW_CONTINUE, DEFAULT_AUTO_CONTINUE, GenerationStopError, isContinueStopKind, isGenerationStopError, isResumeableStop, isUserCancelledStop, profileAllowsInject, profileAllowsSteering, profileTurnResumption, shouldAutoContinue, turnStopFromClientStreamEnd,
|
|
4846
|
+
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';
|
|
4847
4847
|
export { systemLinesProblem } from './src/kernel/system-lines.js';
|
|
4848
4848
|
export type { ToolBackground, ToolBackgroundCall, ToolBackgroundHandle, ToolBackgroundService, ToolBackgroundSettled, ToolSteerReceipt, ToolSteerRefusal, } from './src/kernel/tools/background.js';
|
|
4849
4849
|
export { authorizeToolReplay } from './src/kernel/tools/execute.js';
|
|
@@ -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';
|
|
@@ -5314,14 +5318,14 @@ export interface ProviderLimits {
|
|
|
5314
5318
|
export declare const providerLimitsSchema: z.ZodType<ProviderLimits>;
|
|
5315
5319
|
`,"file:///node_modules/@theoremjs/agents/src/kernel/types.d.ts":`import type { ProviderCheckpoint, ProviderContinuationPolicy } from './checkpoint.js';
|
|
5316
5320
|
import type { JsonObject } from './json.js';
|
|
5317
|
-
import type {
|
|
5321
|
+
import type { CompactionMeter, CompactionOutcome, CompactionTiming, ContextSender, ContinueStopKind, FieldMeta, KeySlot, KeyVault, LiveActivityHandling, LiveEndSensitivity, LiveStartSensitivity, MediaInputKind, ProfileType, SpeechAudioFormat, StreamMode, SummaryMode, ThinkingLevel, ToolLoadTier, TurnStage, TurnStopKind } from './schema.js';
|
|
5318
5322
|
import type { StageHandler } from './stages.js';
|
|
5319
5323
|
import type { ToolBackgroundService } from './tools/background.js';
|
|
5320
5324
|
import type { GateDecision } from './tools/gate-answer.js';
|
|
5321
5325
|
import type { PageToolExecution, ToolExecutionCoordinator, ToolOperationOutcome } from './tools/operation.js';
|
|
5322
5326
|
import type { AgentCall, AgentCallHook, AgentCallRequest, AgentToolDef, AgentToolInput, AgentToolOutput, HostProfileToolsSpec, InvokeToolRequest, InvokeToolResume, InvokeToolStepCall, InvokeToolStepRequest, LiveProfileToolsSpec, ModelToolResult, PageAnswer, ProfileToolsSpec, RegisteredTool, ToolCallEvent, ToolFailure, ToolGate, ToolLoadContext, ToolPolicy, TurnToolSnapshot, WireFunctionTool } from './tools/types.js';
|
|
5323
5327
|
import type { AttemptReason, CallDone, CompactionFailure, CompactionResult, CompactionSignal, DoneFields, GroundingEvent, InjectedMessages, InteractionMediaPart, InteractionMediaRefPart, InteractionPart, InteractionTextPart, InvalidField, ModelEvent, ProviderEvidence, RemovedItem, SessionEnded, SessionEvent, SessionEventKind, SessionEventOf, Source, TurnCost, TurnEvent, TurnEventOf, TurnEventType, TurnGroundingCount, TurnHistoryMessage, TurnResponse, TurnTokenSide, TurnTokens } from './turn-events.js';
|
|
5324
|
-
export type { AgentCall, AgentCallHook, AgentCallRequest, AgentToolDef, AgentToolInput, AgentToolOutput, AttemptReason,
|
|
5328
|
+
export type { AgentCall, AgentCallHook, AgentCallRequest, AgentToolDef, AgentToolInput, AgentToolOutput, AttemptReason, CallDone, CompactionFailure, CompactionMeter, CompactionOutcome, CompactionResult, CompactionSignal, CompactionTiming, ContinueStopKind, DoneFields, FieldMeta, GroundingEvent, HostProfileToolsSpec, InjectedMessages, InteractionMediaPart, InteractionMediaRefPart, InteractionPart, InteractionTextPart, InvalidField, InvokeToolRequest, InvokeToolResume, InvokeToolStepCall, InvokeToolStepRequest, KeySlot, KeyVault, LiveActivityHandling, LiveEndSensitivity, LiveProfileToolsSpec, LiveStartSensitivity, MediaInputKind, ModelEvent, ProfileToolsSpec, ProfileType, ProviderEvidence, RegisteredTool, RemovedItem, SessionEnded, SessionEvent, SessionEventKind, SessionEventOf, Source, SpeechAudioFormat, StreamMode, SummaryMode, ThinkingLevel, ToolCallEvent, ToolFailure, ToolGate, ToolLoadContext, ToolLoadTier, ToolPolicy, TurnCost, TurnEvent, TurnEventOf, TurnEventType, TurnGroundingCount, TurnHistoryMessage, TurnResponse, TurnStage, TurnStopKind, TurnTokenSide, TurnTokens, TurnToolSnapshot, WireFunctionTool, };
|
|
5325
5329
|
/** A host-chosen key naming one model binding in a profile's \`models\`. */
|
|
5326
5330
|
export type ModelId = string;
|
|
5327
5331
|
/** The id of a provider-side tool such as web search. */
|
|
@@ -5381,26 +5385,12 @@ export interface ProfileImageSpec {
|
|
|
5381
5385
|
/**
|
|
5382
5386
|
* Whether the model may write text alongside its images; with some providers this also sends the
|
|
5383
5387
|
* system instruction and history.
|
|
5384
|
-
*
|
|
5385
|
-
* @remarks Also request interleaved text with the images (Google: text + image
|
|
5386
|
-
* \`response_format\`).
|
|
5387
5388
|
*/
|
|
5388
5389
|
includeText?: boolean;
|
|
5389
5390
|
}
|
|
5390
5391
|
import type { DecisionModelBinding, ModelBinding } from './protocols/binding.js';
|
|
5391
5392
|
import type { ProviderHostOptions } from './protocols/runtime.js';
|
|
5392
5393
|
export type { DecisionModelBinding, ModelBinding };
|
|
5393
|
-
/**
|
|
5394
|
-
* OpenRouter prompt-cache policy (\`models.*.options.cache\`).
|
|
5395
|
-
*
|
|
5396
|
-
* - \`automatic\` — top-level \`cache_control\`; breakpoint advances with the conversation.
|
|
5397
|
-
* - \`system\` — explicit breakpoint on the system instruction only.
|
|
5398
|
-
*/
|
|
5399
|
-
export interface CacheSpec {
|
|
5400
|
-
mode: CacheMode;
|
|
5401
|
-
/** Ephemeral TTL. Omit → provider default (typically 5m on Anthropic). */
|
|
5402
|
-
ttl?: CacheTtl;
|
|
5403
|
-
}
|
|
5404
5394
|
/** What a compaction trigger sees when it decides whether to compact. */
|
|
5405
5395
|
export interface CompactionTriggerContext {
|
|
5406
5396
|
tokens: number;
|
|
@@ -5698,21 +5688,20 @@ export interface LiveVadSpec {
|
|
|
5698
5688
|
}
|
|
5699
5689
|
/**
|
|
5700
5690
|
* Context window compression for a live session: once the context reaches the
|
|
5701
|
-
* trigger, the mechanism shrinks it. Without it,
|
|
5702
|
-
* 15 minutes and audio-video sessions at 2.
|
|
5691
|
+
* trigger, the mechanism shrinks it. Without it, a provider may end a long session.
|
|
5703
5692
|
*/
|
|
5704
5693
|
export interface LiveContextCompressionSpec {
|
|
5705
5694
|
/**
|
|
5706
5695
|
* The context size, in tokens, that starts trimming.
|
|
5707
5696
|
*
|
|
5708
5697
|
* @remarks Context tokens, counted before a turn, that start compression. A whole number above 0.
|
|
5709
|
-
* Omit →
|
|
5698
|
+
* Omit → the provider's default.
|
|
5710
5699
|
*/
|
|
5711
5700
|
triggerTokens?: number;
|
|
5712
5701
|
/**
|
|
5713
5702
|
* Trims by dropping the oldest turns; the system instruction stays.
|
|
5714
5703
|
*
|
|
5715
|
-
* @remarks Drops the oldest turns; the system instruction stays.
|
|
5704
|
+
* @remarks Drops the oldest turns; the system instruction stays.
|
|
5716
5705
|
*/
|
|
5717
5706
|
slidingWindow: LiveSlidingWindowSpec;
|
|
5718
5707
|
}
|
|
@@ -5722,7 +5711,7 @@ export interface LiveSlidingWindowSpec {
|
|
|
5722
5711
|
* The context size, in tokens, to trim down to; below the trigger.
|
|
5723
5712
|
*
|
|
5724
5713
|
* @remarks Tokens to keep after compressing. A whole number above 0, below \`triggerTokens\`. Omit
|
|
5725
|
-
* → provider default
|
|
5714
|
+
* → the provider's default.
|
|
5726
5715
|
*/
|
|
5727
5716
|
targetTokens?: number;
|
|
5728
5717
|
}
|
|
@@ -6298,7 +6287,7 @@ export interface ImageResponseFormat {
|
|
|
6298
6287
|
type: 'image';
|
|
6299
6288
|
mimeType?: string;
|
|
6300
6289
|
aspectRatio?: string;
|
|
6301
|
-
/**
|
|
6290
|
+
/** Each protocol sends it under its provider's own name for it. */
|
|
6302
6291
|
resolution?: string;
|
|
6303
6292
|
quality?: string;
|
|
6304
6293
|
background?: string;
|
|
@@ -6915,10 +6904,6 @@ export declare function profileAllowsInject(profile: {
|
|
|
6915
6904
|
type: string;
|
|
6916
6905
|
turnBehaviour?: ProfileTurnBehaviourSpec;
|
|
6917
6906
|
}): boolean;
|
|
6918
|
-
/** OpenAI-compatible normalized \`finish_reason\` (+ optional \`native_finish_reason\`). */
|
|
6919
|
-
export declare function turnStopFromOpenAiFinishReason(finishReason: string | null | undefined, nativeFinishReason?: string | null): TurnStop;
|
|
6920
|
-
/** Gemini Interactions terminal \`status\`. */
|
|
6921
|
-
export declare function turnStopFromInteractionStatus(status: string | null | undefined): TurnStop;
|
|
6922
6907
|
/** \`null\` when \`sawTerminal\`, so the host keeps the provider's stop. */
|
|
6923
6908
|
export declare function turnStopFromClientStreamEnd(opts: {
|
|
6924
6909
|
abortedByUser: boolean;
|
|
@@ -6968,8 +6953,7 @@ export interface ReasoningOrigin {
|
|
|
6968
6953
|
apiId?: string;
|
|
6969
6954
|
}
|
|
6970
6955
|
/**
|
|
6971
|
-
* Signed reasoning a model wrote, kept word for word
|
|
6972
|
-
* \`reasoning_details\`. It goes back only to the protocol that wrote it, or one extended from it;
|
|
6956
|
+
* Signed reasoning a model wrote, kept word for word. It goes back only to the protocol that wrote it, or one extended from it;
|
|
6973
6957
|
* \`data\` is that protocol's own shape, checked against its \`reasoning\` schema.
|
|
6974
6958
|
*/
|
|
6975
6959
|
export interface ReasoningPart {
|
|
@@ -7040,7 +7024,7 @@ export type TurnTokenSide = (typeof TURN_TOKEN_SIDES)[number];
|
|
|
7040
7024
|
export interface TurnCost {
|
|
7041
7025
|
/** What the provider charged, in US dollars. */
|
|
7042
7026
|
usd: number;
|
|
7043
|
-
/** What the upstream model vendor charged the provider, when
|
|
7027
|
+
/** What the upstream model vendor charged the provider, when the provider reports it. */
|
|
7044
7028
|
upstreamUsd?: number;
|
|
7045
7029
|
/**
|
|
7046
7030
|
* Set on a sum (\`sumTokens\`) when some summed calls reported a cost and
|
|
@@ -7069,7 +7053,7 @@ export interface TurnTokens {
|
|
|
7069
7053
|
output: number;
|
|
7070
7054
|
/** Reasoning share of \`output\`. */
|
|
7071
7055
|
thinking?: number;
|
|
7072
|
-
/**
|
|
7056
|
+
/** Share of \`input\` that the provider's own tools added, such as their results. */
|
|
7073
7057
|
toolUse?: number;
|
|
7074
7058
|
/** Share of \`input\` read from provider cache (cache hit). */
|
|
7075
7059
|
cached?: number;
|
|
@@ -7104,7 +7088,7 @@ export interface TurnTokens {
|
|
|
7104
7088
|
}
|
|
7105
7089
|
/** A provider response's identity, as the wire sent it. Live sends neither field. */
|
|
7106
7090
|
export interface TurnResponse {
|
|
7107
|
-
/**
|
|
7091
|
+
/** The provider's id for the response. */
|
|
7108
7092
|
id?: string;
|
|
7109
7093
|
model?: string;
|
|
7110
7094
|
}
|
|
@@ -7115,11 +7099,11 @@ export interface Source {
|
|
|
7115
7099
|
title: string;
|
|
7116
7100
|
uri: string;
|
|
7117
7101
|
type: SourceType;
|
|
7118
|
-
/**
|
|
7102
|
+
/** The place's id, when the source is a place on a map. */
|
|
7119
7103
|
placeId?: string;
|
|
7120
7104
|
}
|
|
7121
7105
|
export declare const sourceSchema: z.ZodType<Source>;
|
|
7122
|
-
/**
|
|
7106
|
+
/** Search metadata a provider grounded its answer on. Sources travel as \`citation\` events. */
|
|
7123
7107
|
export interface GroundingEvent {
|
|
7124
7108
|
metadata?: Record<string, unknown>;
|
|
7125
7109
|
chunks?: unknown[];
|
|
@@ -7163,7 +7147,7 @@ export type ProviderEvidence = (EvidenceBase & {
|
|
|
7163
7147
|
resumable: boolean;
|
|
7164
7148
|
}) | (EvidenceBase & {
|
|
7165
7149
|
kind: 'provider_step';
|
|
7166
|
-
/** The provider's own step type
|
|
7150
|
+
/** The provider's own name for the step type. */
|
|
7167
7151
|
step: string;
|
|
7168
7152
|
});
|
|
7169
7153
|
/** A session the provider ended after warning it would. */
|
|
@@ -7336,8 +7320,7 @@ export interface ToolCallRequest extends ToolEventBase {
|
|
|
7336
7320
|
*/
|
|
7337
7321
|
arguments: Record<string, unknown>;
|
|
7338
7322
|
/**
|
|
7339
|
-
* On a step's first call: the signed reasoning the model wrote before the step's calls
|
|
7340
|
-
* thought signature, OpenRouter's \`reasoning_details\`). It goes back on the assistant message
|
|
7323
|
+
* On a step's first call: the signed reasoning the model wrote before the step's calls. It goes back on the assistant message
|
|
7341
7324
|
* holding the step's calls, word for word; a host keeping its own history keeps it there.
|
|
7342
7325
|
*/
|
|
7343
7326
|
reasoning?: ReasoningPart[];
|
|
@@ -7845,14 +7828,6 @@ export type CompactionTiming = (typeof COMPACTION_TIMINGS)[number];
|
|
|
7845
7828
|
export declare const COMPACTION_OUTCOMES: readonly ["compacted", "deferred", "dropped"];
|
|
7846
7829
|
/** One of {@linkcode COMPACTION_OUTCOMES}. */
|
|
7847
7830
|
export type CompactionOutcome = (typeof COMPACTION_OUTCOMES)[number];
|
|
7848
|
-
/** Which part of the prompt is cached: the whole request (\`automatic\`) or the system instruction only (\`system\`). */
|
|
7849
|
-
export declare const CACHE_MODES: readonly ["automatic", "system"];
|
|
7850
|
-
/** One of {@linkcode CACHE_MODES}. */
|
|
7851
|
-
export type CacheMode = (typeof CACHE_MODES)[number];
|
|
7852
|
-
/** How long a provider keeps a cached prompt. */
|
|
7853
|
-
export declare const CACHE_TTLS: readonly ["5m", "1h"];
|
|
7854
|
-
/** One of {@linkcode CACHE_TTLS}. */
|
|
7855
|
-
export type CacheTtl = (typeof CACHE_TTLS)[number];
|
|
7856
7831
|
/** Why a turn stopped, as \`done.stop.kind\` reports it. */
|
|
7857
7832
|
export declare const TURN_STOP_KINDS: readonly ["completed", "length", "tool", "gate", "filtered", "provider_error", "cancelled", "stream_incomplete", "step_limit", "answer_missing", "interrupted", "generation_complete"];
|
|
7858
7833
|
/** One of {@linkcode TURN_STOP_KINDS}. */
|
|
@@ -7935,10 +7910,8 @@ export type ToolType = (typeof TOOL_TYPES)[number];
|
|
|
7935
7910
|
export type CustomToolType = Exclude<ToolType, 'builtin'>;
|
|
7936
7911
|
/**
|
|
7937
7912
|
* The package's complete media-input vocabulary: \`assertMediaMime\` refuses any MIME not
|
|
7938
|
-
* here, so hosts keep no second table. Rows follow
|
|
7939
|
-
* lists (verified 2026-09-12),
|
|
7940
|
-
* \`application/rtf\` are not on Google's list. OpenAI-compat adapters forward the MIME
|
|
7941
|
-
* verbatim and add no rows. Provider alias essences (\`image/jpg\`, \`video/mov\`, …) are rows;
|
|
7913
|
+
* here, so hosts keep no second table. Rows follow the widest provider's documented
|
|
7914
|
+
* lists (verified 2026-09-12), plus TypeScript, \`application/xml\` and \`application/rtf\`. Provider alias essences (\`image/jpg\`, \`video/mov\`, …) are rows;
|
|
7942
7915
|
* \`resolveInputParts\` canonicalizes \`image/jpg\` to \`image/jpeg\` on the wire.
|
|
7943
7916
|
*/
|
|
7944
7917
|
export declare const MEDIA_INPUT_KINDS: Record<string, MediaInputKind>;
|
|
@@ -8559,7 +8532,7 @@ export { applySpans, blobAt, mergeSpans, OMIT_CANARY, OMIT_INJECTION, OMIT_PROMP
|
|
|
8559
8532
|
`,"file:///node_modules/@theoremjs/agents/src/guardrails/labels.d.ts":`/** Values that fill a label template's \`{param}\` placeholders. */
|
|
8560
8533
|
export type LabelParams = Record<string, string | number>;
|
|
8561
8534
|
/** Keys are stable API. */
|
|
8562
|
-
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"];
|
|
8563
8536
|
/** One of {@linkcode LABEL_KEYS}. */
|
|
8564
8537
|
export type LabelKey = (typeof LABEL_KEYS)[number];
|
|
8565
8538
|
/**
|
|
@@ -9003,8 +8976,8 @@ export interface CreatePkceFlowOptions extends OAuthTransportOptions {
|
|
|
9003
8976
|
/** Skips discovery. */
|
|
9004
8977
|
preResolved?: OAuthEndpoints;
|
|
9005
8978
|
/**
|
|
9006
|
-
* Parameters
|
|
9007
|
-
*
|
|
8979
|
+
* Parameters an authorization server reads beyond the standard ones, such as one it needs
|
|
8980
|
+
* before it issues a refresh token. A name the
|
|
9008
8981
|
* flow sets itself is refused.
|
|
9009
8982
|
*/
|
|
9010
8983
|
authorizationParams?: Readonly<Record<string, string>>;
|
|
@@ -10183,8 +10156,8 @@ export interface AgentToolOutput {
|
|
|
10183
10156
|
/** What the called agent cited; the caller's turn cites them too. */
|
|
10184
10157
|
sources?: Source[];
|
|
10185
10158
|
}
|
|
10186
|
-
/** A channel of an agent tool's input
|
|
10187
|
-
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';
|
|
10188
10161
|
/**
|
|
10189
10162
|
* A tool whose call runs one turn of another registered agent. That agent is a
|
|
10190
10163
|
* standalone profile; the tool is how another agent's model calls it. Its input
|
|
@@ -10216,13 +10189,15 @@ export interface AgentToolDef extends ToolBase {
|
|
|
10216
10189
|
*/
|
|
10217
10190
|
fieldText?: Partial<Record<keyof AgentToolInput, string>>;
|
|
10218
10191
|
/**
|
|
10219
|
-
* Fields
|
|
10220
|
-
*
|
|
10221
|
-
*
|
|
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.
|
|
10222
10196
|
*
|
|
10223
|
-
* @remarks Fields the calling model fills
|
|
10224
|
-
* \`hostInput\` and turns them into the
|
|
10225
|
-
* 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.
|
|
10226
10201
|
*/
|
|
10227
10202
|
hostFields?: Record<string, z.ZodType>;
|
|
10228
10203
|
/**
|
|
@@ -11369,7 +11344,25 @@ export interface OpenRouterConnection {
|
|
|
11369
11344
|
export declare const openRouterProvider: Provider<OpenRouterConnection, string>;
|
|
11370
11345
|
`,"file:///node_modules/@theoremjs/agents/src/providers/openrouter/protocol.d.ts":`import { type JsonObject } from '../../kernel/json.js';
|
|
11371
11346
|
import { type Protocol } from '../../kernel/protocols/mod.js';
|
|
11372
|
-
|
|
11347
|
+
/** What is cached: the whole request (\`automatic\`) or the system instruction only (\`system\`). */
|
|
11348
|
+
export declare const CACHE_MODES: readonly ["automatic", "system"];
|
|
11349
|
+
/** One of {@linkcode CACHE_MODES}. */
|
|
11350
|
+
export type CacheMode = (typeof CACHE_MODES)[number];
|
|
11351
|
+
/** How long OpenRouter's upstream keeps a cached prompt. */
|
|
11352
|
+
export declare const CACHE_TTLS: readonly ["5m", "1h"];
|
|
11353
|
+
/** One of {@linkcode CACHE_TTLS}. */
|
|
11354
|
+
export type CacheTtl = (typeof CACHE_TTLS)[number];
|
|
11355
|
+
/**
|
|
11356
|
+
* Prompt-cache policy (\`models.*.options.cache\`).
|
|
11357
|
+
*
|
|
11358
|
+
* - \`automatic\` — top-level \`cache_control\`; breakpoint advances with the conversation.
|
|
11359
|
+
* - \`system\` — explicit breakpoint on the system instruction only.
|
|
11360
|
+
*/
|
|
11361
|
+
export interface CacheSpec {
|
|
11362
|
+
mode: CacheMode;
|
|
11363
|
+
/** How long the cache lives. Omit → the upstream's default, typically 5 minutes on Anthropic. */
|
|
11364
|
+
ttl?: CacheTtl;
|
|
11365
|
+
}
|
|
11373
11366
|
/** What an \`openRouterOpenAi\` binding sets in \`options\`. */
|
|
11374
11367
|
export interface OpenRouterOptions {
|
|
11375
11368
|
cache?: CacheSpec;
|
|
@@ -11419,7 +11412,7 @@ export declare const openRouterDecisions: Protocol<Record<string, never>>;
|
|
|
11419
11412
|
`,"file:///node_modules/@theoremjs/agents/src/providers/open-ai/protocol.d.ts":`import { type Protocol } from '../../kernel/protocols/mod.js';
|
|
11420
11413
|
/** OpenAI Chat Completions: the shape most compatible servers speak. */
|
|
11421
11414
|
export declare const openAi: Protocol<Record<string, never>>;
|
|
11422
|
-
`,"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';
|
|
11423
11416
|
/** What registering \`localProvider\` takes as \`connection\`. */
|
|
11424
11417
|
export interface LocalConnection {
|
|
11425
11418
|
baseUrl: string;
|
|
@@ -11433,6 +11426,37 @@ export interface OllamaEmbeddingsOptions {
|
|
|
11433
11426
|
dimensions?: number;
|
|
11434
11427
|
}
|
|
11435
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>;
|
|
11436
11460
|
`,"file:///node_modules/@theoremjs/agents/src/providers/gemini/provider.d.ts":`import { type Provider } from '../../kernel/protocols/provider.js';
|
|
11437
11461
|
/** What registering \`geminiProvider\` takes as \`connection\`. */
|
|
11438
11462
|
export interface GeminiConnection {
|
|
@@ -12235,6 +12259,7 @@ import type { HandlerEvents } from './handler-events.js';
|
|
|
12235
12259
|
import { type McpSessionCache } from './mcp-sessions.js';
|
|
12236
12260
|
import type { ToolOperationClaim } from './operation.js';
|
|
12237
12261
|
import { type JsonSchema } from './schema.js';
|
|
12262
|
+
import { type SchemaIssue } from './schema-issues.js';
|
|
12238
12263
|
import { type ToolStageSupport } from './stage-run.js';
|
|
12239
12264
|
import type { HttpToolDef, McpToolDef, ModelToolResult, ToolAuthConfig, ToolBodyOutcome, ToolContext, ToolFailure, ToolGate } from './types.js';
|
|
12240
12265
|
export type AuthResolveResult = {
|
|
@@ -12283,7 +12308,7 @@ export declare function parseToolOutput<T>(schema: {
|
|
|
12283
12308
|
} | {
|
|
12284
12309
|
success: false;
|
|
12285
12310
|
error: {
|
|
12286
|
-
|
|
12311
|
+
issues: readonly SchemaIssue[];
|
|
12287
12312
|
};
|
|
12288
12313
|
};
|
|
12289
12314
|
}, responseData: unknown): {
|
|
@@ -12292,7 +12317,7 @@ export declare function parseToolOutput<T>(schema: {
|
|
|
12292
12317
|
} | {
|
|
12293
12318
|
success: false;
|
|
12294
12319
|
error: {
|
|
12295
|
-
|
|
12320
|
+
issues: readonly SchemaIssue[];
|
|
12296
12321
|
};
|
|
12297
12322
|
};
|
|
12298
12323
|
/**
|
|
@@ -12503,6 +12528,30 @@ export declare function emitGateSettlement(args: {
|
|
|
12503
12528
|
toolName: string;
|
|
12504
12529
|
labels: LabelOverrides | undefined;
|
|
12505
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;
|
|
12506
12555
|
`,"file:///node_modules/@theoremjs/agents/src/kernel/tools/handler-events.d.ts":`import type { ToolBoundary } from '../../guardrails/boundaries.js';
|
|
12507
12556
|
import type { Provenance, ResolvedGuardrailPolicy } from '../../guardrails/types.js';
|
|
12508
12557
|
import type { TurnEvent } from '../types.js';
|
|
@@ -13477,7 +13526,7 @@ export declare function sumEventTokens(events: readonly TurnEvent[]): TurnTokens
|
|
|
13477
13526
|
export declare function sumTurnTokens(events: readonly TurnEvent[]): TurnTokens | undefined;
|
|
13478
13527
|
/**
|
|
13479
13528
|
* A side is \`estimated\` when any call estimated it. Cost is \`partial\` when some call reported none;
|
|
13480
|
-
* a missing \`upstreamUsd\` is not missing data
|
|
13529
|
+
* a missing \`upstreamUsd\` is not missing data, since a provider may report it for some calls only.
|
|
13481
13530
|
*/
|
|
13482
13531
|
export declare function sumTokens(calls: TurnTokens[]): TurnTokens | undefined;
|
|
13483
13532
|
`,"file:///node_modules/@theoremjs/agents/src/kernel/engine/live-ingress.d.ts":`import type { LiveIngressSpec, Profile } 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};
|