@theoremjs/studio 0.3.4-next.548.gbb156b2 → 0.3.4-next.550.gf20b9cd
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/README.md +54 -14
- package/agreement.js +22 -7
- package/compile.js +3 -1
- package/cookbooks/catalog.d.ts +18 -0
- package/cookbooks/catalog.js +84 -8
- package/cookbooks/mod.d.ts +1 -1
- package/draft.d.ts +2 -0
- package/mod.d.ts +1 -1
- package/package.json +4 -4
- package/page/assets/Banner-Bvkdyf59.js +2 -0
- package/page/assets/BottomSheet-Dbh6A5Vl.js +1 -0
- package/page/assets/{Card-Ghe4ozhC.js → Card-DruykyeB.js} +1 -1
- package/page/assets/CheckboxInput-CFZ_Wq8-.js +2 -0
- package/page/assets/CodeBlock-CfVOtDeO.js +52 -0
- package/page/assets/CollapsibleGroup-FIawJRo4.js +1 -0
- package/page/assets/ConsoleFrame-BTL67qHr.js +3 -0
- package/page/assets/ContextMenu-BngxR9na.js +2 -0
- package/page/assets/DateInput-B1ICJtHn.js +1 -0
- package/page/assets/{Dialog-BDUExlk_.js → Dialog-Sd04KQS2.js} +1 -1
- package/page/assets/EmptyState-C_uF9Wyj.js +1 -0
- package/page/assets/HoverCard-DMyWUvwP.js +1 -0
- package/page/assets/Icon-BqkS-pIq.js +3 -0
- package/page/assets/IconButton-DVUFx-8p.js +1 -0
- package/page/assets/ListItem-QF7KFt0h.js +1 -0
- package/page/assets/MenuBottomSheet-C4fG_GyZ.js +1 -0
- package/page/assets/MenuBottomSheetActionList-3L0HS4Kf.js +1 -0
- package/page/assets/SchemaFields-BT2XCbid.js +1 -0
- package/page/assets/ScrollableArea-BHfY7sWH.js +1 -0
- package/page/assets/SegmentedControlItem-BBGRPrxp.js +1 -0
- package/page/assets/{Text-BsiAsowd.js → Text-BOqCfzZC.js} +2 -2
- package/page/assets/{TimestampHoverCard-CCnmnVlQ.js → TimestampHoverCard-CDCVpEWM.js} +1 -1
- package/page/assets/{ToolResultCharts-DQc5tTgc.js → ToolResultCharts-rJr0Ksno.js} +1 -1
- package/page/assets/Tooltip-BWs5DLrM.js +1 -0
- package/page/assets/TraceInspector-DQI_wNzL.js +1 -0
- package/page/assets/{TraceOverview-DqhP_wzg.js → TraceOverview-DmfmwSR6.js} +2 -2
- package/page/assets/{_virtual_studio-type-sources-CvOETQ24.js → _virtual_studio-type-sources-CxP3L28S.js} +139 -77
- package/page/assets/browser-engine-B1PxEekk.js +11 -0
- package/page/assets/browser-transport-BOHBmYvp.js +47 -0
- package/page/assets/{embedding-space-view-BU2AjjAx.js → embedding-space-view-CN0VHXXH.js} +1 -1
- package/page/assets/{export-agent-D-Rj6FQy.js → export-agent-BvEVKW_C.js} +1 -1
- package/page/assets/fieldParts-B7DYLgh4.js +1 -0
- package/page/assets/focusableSelector-DXZeMU85.js +1 -0
- package/page/assets/{guardrail-tester-lZGPnEIR.js → guardrail-tester-08T-hMFL.js} +2 -2
- package/page/assets/index-eSb7kilv.js +146 -0
- package/page/assets/isRenderable-DHkzpAoQ.js +1 -0
- package/page/assets/{labels-provider-BObUoNKa.js → labels-provider-DkA22zkP.js} +1 -1
- package/page/assets/{live-messages-DuLSkEdL.js → live-messages-DmTC8qc8.js} +1 -1
- package/page/assets/plainDate-BHiJcj7o.js +1 -0
- package/page/assets/reader-DoTXxl0W.js +7 -0
- package/page/assets/{stub-kLwOLu-h.js → stub-CKo_lxer.js} +1 -1
- package/page/assets/studio-code-pane-CEG07Zk7.js +8 -0
- package/page/assets/{studio-console-DgsrR6Qy.js → studio-console-udt4MmTi.js} +1 -1
- package/page/assets/studio-decision-tocwLzxr.js +1 -0
- package/page/assets/studio-embedding-DQ84xzlj.js +2 -0
- package/page/assets/studio-host-console-BJOUpXHR.js +2 -0
- package/page/assets/studio-labels-Zqd84hcs.js +3 -0
- package/page/assets/studio-live-BmuHpeF4.js +5 -0
- package/page/assets/{studio-map-D7QZ6RAm.js → studio-map-qP_i4hWG.js} +1 -1
- package/page/assets/{studio-trace-replay-BSts3p2O.js → studio-trace-replay-JUMs6EMA.js} +2 -2
- package/page/assets/{studio-type-checker-BNljIXdE.js → studio-type-checker-B_CHmWnf.js} +1 -1
- package/page/assets/{tool-schema--CLE7o0H.js → tool-schema-CWGccblZ.js} +5 -5
- package/page/assets/{trace-patterns-CS99kExN.js → trace-patterns-D6TbkLLr.js} +1 -1
- package/page/assets/tree-B7VVMg1s.js +3 -0
- package/page/assets/{turn-client-DXtNeRHG.js → turn-client-CoLR6hrl.js} +1 -1
- package/page/assets/types-CL44MvsT.js +1 -0
- package/page/assets/{use-one-call-TAgOAnMo.js → use-one-call-BKeMtY5F.js} +1 -1
- package/page/assets/use-second-ticker-GWBt83pd.css +1 -0
- package/page/assets/use-trace-records-B1vrKQmA.js +1 -0
- package/page/assets/useAdaptivePresentation-Bma4-u1a.js +1 -0
- package/page/assets/useAnnounce-DTSHZvjg.js +1 -0
- package/page/assets/useClipboard-CbN9bb4J.js +1 -0
- package/page/assets/useDevWarning-Z9SoixOP.js +1 -0
- package/page/assets/useFocusReturnVisibility-BHKv5Jwr.js +1 -0
- package/page/assets/useMenuPress-DLG1QOiE.js +1 -0
- package/page/assets/useResolvedRequired-DbsOcDqy.js +1 -0
- package/page/assets/useScrollableArea-DuF_pz9m.js +1 -0
- package/page/assets/useTooltip-c097gL_-.js +1 -0
- package/page/assets/{workspace-Cb6PICiw.js → workspace-NGa3jjDc.js} +1 -1
- package/page/index.html +45 -38
- package/read-source.js +5 -4
- package/read-studio.mjs +99 -0
- package/requirements.d.ts +3 -0
- package/requirements.js +10 -0
- package/server/alerts.d.ts +23 -0
- package/server/alerts.js +82 -0
- package/server/draft-handler.d.ts +3 -0
- package/server/draft-handler.js +5 -1
- package/server/events.d.ts +38 -0
- package/server/events.js +95 -0
- package/server/handler.d.ts +11 -3
- package/server/handler.js +64 -8
- package/server/project-source.d.ts +6 -3
- package/server/project-source.js +45 -4
- package/server/project.js +25 -3
- package/server/save-session.d.ts +2 -0
- package/server/save-session.js +7 -1
- package/server/serve.d.ts +1 -1
- package/server/serve.js +174 -18
- package/server/test-key.d.ts +19 -2
- package/server/test-key.js +51 -74
- package/server/watch.d.ts +8 -0
- package/server/watch.js +16 -5
- package/start.mjs +95 -5
- package/ui/built/theme.css +2 -2
- package/ui/built/theme.css.d.ts +2 -2
- package/ui/built/theorem-studio.d.ts +2 -2
- package/ui/built/theorem-studio.js +3 -3
- package/ui/built/theorem-studio.variants.d.ts +2 -2
- package/ui/lib/page-errors.d.ts +13 -0
- package/ui/lib/page-errors.js +31 -0
- package/ui/profile-editor.js +1 -1
- package/ui/studio-runner.d.ts +1 -1
- package/ui/studio-runner.js +7 -3
- package/ui/studio-screen.js +23 -11
- package/page/assets/Banner-BP1TXM0J.js +0 -2
- package/page/assets/BottomSheet-BQPskY35.js +0 -1
- package/page/assets/CheckboxInput-C9kbVyhK.js +0 -2
- package/page/assets/CodeBlock-Kjgv83A6.js +0 -52
- package/page/assets/CollapsibleGroup-Bfnp4Aaz.js +0 -1
- package/page/assets/ConsoleFrame-Da49DUMV.js +0 -3
- package/page/assets/ContextMenu-DGeuOuIz.js +0 -2
- package/page/assets/DateInput-BJt-UTCy.js +0 -1
- package/page/assets/EmptyState-C8W4JKBZ.js +0 -1
- package/page/assets/HoverCard-C6thuzrf.js +0 -1
- package/page/assets/Icon-ZfFwTt8n.js +0 -3
- package/page/assets/IconButton-CG5klqF1.js +0 -1
- package/page/assets/ScrollableArea-C8AVuqnt.js +0 -1
- package/page/assets/Section-DJ97F7QE.js +0 -1
- package/page/assets/SegmentedControlItem-BLuJOusN.js +0 -1
- package/page/assets/Tooltip-CTEuMRLe.js +0 -1
- package/page/assets/TraceInspector-Cn7_V-2C.js +0 -1
- package/page/assets/browser-engine-BUuO2-Ve.js +0 -11
- package/page/assets/browser-transport-FDq0Q4Fx.js +0 -47
- package/page/assets/fieldParts-Cs6Amprh.js +0 -1
- package/page/assets/index-Bk_jhM4_.js +0 -145
- package/page/assets/reader-DJB6MzQf.js +0 -7
- package/page/assets/studio-code-pane-D7R84b_Y.js +0 -8
- package/page/assets/studio-decision-uyaB9Oo3.js +0 -1
- package/page/assets/studio-embedding-tRaNKz_n.js +0 -2
- package/page/assets/studio-host-console-DzpUuYer.js +0 -2
- package/page/assets/studio-labels-CByQ2z3Y.js +0 -3
- package/page/assets/studio-live-CWeuAs3g.js +0 -5
- package/page/assets/tree-CDqNZ8w-.js +0 -3
- package/page/assets/types-DTbqRZ5l.js +0 -1
- package/page/assets/use-second-ticker-CnxaP3LD.css +0 -1
- package/page/assets/use-trace-records-CZNBjTS0.js +0 -1
- package/page/assets/useAdaptivePresentation-BY_zvjIp.js +0 -1
- package/page/assets/useClipboard-B1amtN2V.js +0 -1
- package/page/assets/useDevWarning-Cna3kqg1.js +0 -1
- package/page/assets/useScrollableArea-vxuztwym.js +0 -1
- package/page/assets/useTooltip-rxACYEAC.js +0 -1
- /package/page/assets/{use-second-ticker-VX91zrxj.js → use-second-ticker-DhbZ0Soz.js} +0 -0
|
@@ -4735,8 +4735,8 @@ export { PROFILE_GRAPH, profileGraphFacet, spineFacetsForProfileType, } from './
|
|
|
4735
4735
|
export type { RuntimeAbilities } from './src/kernel/protocols/binding.js';
|
|
4736
4736
|
export { checkBinding, commonModelSettingsSchema, decisionModelBindingSchema, keySlotSchema, keySlotsOf, modelBindingSchema, } from './src/kernel/protocols/binding.js';
|
|
4737
4737
|
export { providerLimitsSchema } from './src/kernel/protocols/limits.js';
|
|
4738
|
-
export type { CallSetup, ProtocolCall } from './src/kernel/protocols/runtime.js';
|
|
4739
|
-
export { callProtocol, plainWebSocket } from './src/kernel/protocols/runtime.js';
|
|
4738
|
+
export type { CallSetup, KeyCheck, ProtocolCall } from './src/kernel/protocols/runtime.js';
|
|
4739
|
+
export { callProtocol, checkKey, plainWebSocket } from './src/kernel/protocols/runtime.js';
|
|
4740
4740
|
export type { AttachmentFacts, AttachmentRules } from './src/kernel/registry/attachments.js';
|
|
4741
4741
|
export { assertTurnAttachments, attachmentIssueCopy, attachmentIssues, attachmentIssueText, attachmentsRefused, base64Bytes, maxBytesForMime, requireMediaLimits, resolveMediaLimits, sanitizeCsvText, sanitizeTurnBlobs, } from './src/kernel/registry/attachments.js';
|
|
4742
4742
|
export type { MediaInputChannel } from './src/kernel/registry/catalog.js';
|
|
@@ -4877,6 +4877,15 @@ export interface ProviderDefinition<C = unknown, K = unknown> {
|
|
|
4877
4877
|
/** Only where the API reports no cost. */
|
|
4878
4878
|
prices?: PriceTable;
|
|
4879
4879
|
serves(connection: C): Serve<K>[];
|
|
4880
|
+
/**
|
|
4881
|
+
* How to ask the provider whether it takes a key: a GET to \`path\` on where it serves \`protocol\`,
|
|
4882
|
+
* signed as a call is. It must answer 2xx for a key that works and 400, 401 or 403 for one
|
|
4883
|
+
* that does not. \`checkKey\` sends it.
|
|
4884
|
+
*/
|
|
4885
|
+
check?: {
|
|
4886
|
+
protocol: Protocol;
|
|
4887
|
+
path: string;
|
|
4888
|
+
};
|
|
4880
4889
|
}
|
|
4881
4890
|
/** A provider as defined; register it to use it. */
|
|
4882
4891
|
export type Provider<C = unknown, K = unknown> = Readonly<ProviderDefinition<C, K>>;
|
|
@@ -4919,6 +4928,11 @@ export interface ProviderRegistry {
|
|
|
4919
4928
|
/** Every protocol the registered providers serve, with the protocols they extend. */
|
|
4920
4929
|
protocols(): Protocol[];
|
|
4921
4930
|
}
|
|
4931
|
+
/** Where a provider serves a protocol; a config error when it does not. */
|
|
4932
|
+
export declare function served(provider: {
|
|
4933
|
+
id: string;
|
|
4934
|
+
serves: readonly Serve[];
|
|
4935
|
+
}, protocol: string): Serve;
|
|
4922
4936
|
export declare function createProviderRegistry(): ProviderRegistry;
|
|
4923
4937
|
`,"file:///node_modules/@theoremjs/agents/src/kernel/protocols/protocol.d.ts":`import { z } from 'zod';
|
|
4924
4938
|
import { TheoremError } from '../../guardrails/error.js';
|
|
@@ -5236,6 +5250,7 @@ export interface ProfileImageSpec {
|
|
|
5236
5250
|
includeText?: boolean;
|
|
5237
5251
|
}
|
|
5238
5252
|
import type { DecisionModelBinding, ModelBinding } from './protocols/binding.js';
|
|
5253
|
+
import type { ProviderHostOptions } from './protocols/runtime.js';
|
|
5239
5254
|
export type { DecisionModelBinding, ModelBinding };
|
|
5240
5255
|
/**
|
|
5241
5256
|
* OpenRouter prompt-cache policy (\`models.*.options.cache\`).
|
|
@@ -6003,6 +6018,24 @@ export interface TurnRequest {
|
|
|
6003
6018
|
*/
|
|
6004
6019
|
onAgentCall?: AgentCallHook;
|
|
6005
6020
|
}
|
|
6021
|
+
/**
|
|
6022
|
+
* How an application runs its turns: the one value its own call sites, its web handler and the
|
|
6023
|
+
* studio all use, so they cannot run a turn differently. An app that calls \`runTurn\` itself
|
|
6024
|
+
* writes \`runTurn(await wiring.prepare(turn), wiring.provider)\`.
|
|
6025
|
+
*/
|
|
6026
|
+
export interface TurnWiring {
|
|
6027
|
+
/** Registers the application's profiles and tools. Called once, before the first turn. */
|
|
6028
|
+
register?: () => void | Promise<void>;
|
|
6029
|
+
/** The keys, network and limits each model call runs on. */
|
|
6030
|
+
provider?: ProviderHostOptions;
|
|
6031
|
+
/**
|
|
6032
|
+
* The turn the application runs, from the one it is given: the profile, the input with the
|
|
6033
|
+
* conversation's history, and the application's context as \`host\`. Set what the application
|
|
6034
|
+
* sets per turn, such as \`system\`, \`credentials\`, \`onStage\`, \`onAgentCall\`, \`path\` and
|
|
6035
|
+
* \`metadata\`. Text, image and speech turns run through it.
|
|
6036
|
+
*/
|
|
6037
|
+
prepare?: (turn: NormalizedTurnRequest) => TurnRequest | Promise<TurnRequest>;
|
|
6038
|
+
}
|
|
6006
6039
|
/** A profile projected for a client, with its secrets and server-only fields removed. */
|
|
6007
6040
|
export interface ProjectedProfile extends ProfileModelFields {
|
|
6008
6041
|
id: string;
|
|
@@ -7597,7 +7630,8 @@ import type { KeySlot } from '../types.js';
|
|
|
7597
7630
|
export type KeyCredential = string | JsonObject;
|
|
7598
7631
|
export interface CredentialContext {
|
|
7599
7632
|
providerId: string;
|
|
7600
|
-
|
|
7633
|
+
/** The model the call is for. Absent for a key check, which calls no model. */
|
|
7634
|
+
apiId?: string;
|
|
7601
7635
|
keySlot: KeySlot;
|
|
7602
7636
|
signal?: AbortSignal;
|
|
7603
7637
|
}
|
|
@@ -8738,6 +8772,90 @@ declare function contentOf(record: TraceRecord, value: TraceAttributeValue | und
|
|
|
8738
8772
|
declare function inlineContent(record: TraceRecord, value: unknown): unknown;
|
|
8739
8773
|
export type { TraceRecord };
|
|
8740
8774
|
export { buildRecord, contentOf, inlineContent, TRACE_SCHEMA_URL };
|
|
8775
|
+
`,"file:///node_modules/@theoremjs/agents/src/kernel/protocols/runtime.d.ts":`import { type Wait } from '../../providers/shared/retry.js';
|
|
8776
|
+
import { type JsonObject } from '../json.js';
|
|
8777
|
+
import type { KeyVault } from '../registry/vault.js';
|
|
8778
|
+
import type { DecisionResult, KeySlot } from '../types.js';
|
|
8779
|
+
import { type DecisionModelBinding, type ModelBinding } from './binding.js';
|
|
8780
|
+
import type { ProviderLimits } from './limits.js';
|
|
8781
|
+
import type { DecisionCall, EmbeddingCall, EmbeddingResult, ModelProfileType, ProtocolOperations } from './protocol.js';
|
|
8782
|
+
import { type RegisteredProvider } from './provider.js';
|
|
8783
|
+
/** Opens a WebSocket with the headers and subprotocols a sign-in put on it. */
|
|
8784
|
+
export type OpenWebSocket = (url: string, init: {
|
|
8785
|
+
headers: Headers;
|
|
8786
|
+
protocols: string[];
|
|
8787
|
+
}) => Promise<WebSocket>;
|
|
8788
|
+
/**
|
|
8789
|
+
* The runtime's own WebSocket. It takes no headers, so a sign-in that needs them is refused; a host
|
|
8790
|
+
* that can send them passes \`openWebSocket\`.
|
|
8791
|
+
*/
|
|
8792
|
+
export declare function plainWebSocket(provider: string): OpenWebSocket;
|
|
8793
|
+
/** What a host lends every provider call: its keys, its network, its clock, and its budgets. */
|
|
8794
|
+
export interface ProviderHostOptions {
|
|
8795
|
+
/** Overrides the model's own \`limits\`, one field at a time. */
|
|
8796
|
+
limits?: ProviderLimits;
|
|
8797
|
+
vault?: KeyVault;
|
|
8798
|
+
fetch?: typeof fetch;
|
|
8799
|
+
wait?: Wait;
|
|
8800
|
+
openWebSocket?: OpenWebSocket;
|
|
8801
|
+
}
|
|
8802
|
+
/** One call's setup: a checked binding on its registered provider, and the host's means. */
|
|
8803
|
+
export interface CallSetup {
|
|
8804
|
+
provider: RegisteredProvider;
|
|
8805
|
+
binding: ModelBinding | DecisionModelBinding;
|
|
8806
|
+
profileType: ModelProfileType;
|
|
8807
|
+
vault?: KeyVault;
|
|
8808
|
+
fetch?: typeof fetch;
|
|
8809
|
+
wait?: Wait;
|
|
8810
|
+
/** Milliseconds the call has left; a retry never waits past it, so the real cause is reported. */
|
|
8811
|
+
timeLeft?(): number;
|
|
8812
|
+
openWebSocket?: OpenWebSocket;
|
|
8813
|
+
limits?: ProviderLimits;
|
|
8814
|
+
signal?: AbortSignal;
|
|
8815
|
+
tapUpstream?(row: JsonObject): void;
|
|
8816
|
+
/** Hands the wire rows to the stream as \`raw\` events, for looking around. */
|
|
8817
|
+
rawRows?: boolean;
|
|
8818
|
+
/** Told the slot and key each attempt signs with, so the caller can redact it and key its state. */
|
|
8819
|
+
onKey?(slot: KeySlot | undefined, key: unknown): void;
|
|
8820
|
+
}
|
|
8821
|
+
/** What a provider said about a key when asked with its \`check\`. */
|
|
8822
|
+
export interface KeyCheck {
|
|
8823
|
+
provider: string;
|
|
8824
|
+
slot?: KeySlot;
|
|
8825
|
+
/**
|
|
8826
|
+
* \`accepted\`: the provider answered 2xx. \`refused\`: it answered 400, 401 or 403, or the key is
|
|
8827
|
+
* not one the provider takes. \`unreachable\`: no answer in time, or another status. \`empty\`: the
|
|
8828
|
+
* slot holds no key. \`unchecked\`: the provider declares no \`check\`.
|
|
8829
|
+
*/
|
|
8830
|
+
state: 'accepted' | 'refused' | 'unreachable' | 'empty' | 'unchecked';
|
|
8831
|
+
status?: number;
|
|
8832
|
+
/** The provider's own words on a refusal, with the key taken out. */
|
|
8833
|
+
said?: string;
|
|
8834
|
+
}
|
|
8835
|
+
/**
|
|
8836
|
+
* Asks a registered provider whether it takes a key, with the GET its definition's \`check\`
|
|
8837
|
+
* names: \`key\` when given, else \`slot\` (by default its key slot) in \`vault\`. One request, never retried; the key is
|
|
8838
|
+
* not kept or logged.
|
|
8839
|
+
*/
|
|
8840
|
+
export declare function checkKey(provider: RegisteredProvider, options?: {
|
|
8841
|
+
key?: unknown;
|
|
8842
|
+
vault?: KeyVault;
|
|
8843
|
+
/** The slot to read, when a model names its own. Default: the provider's \`keySlot\`. */
|
|
8844
|
+
slot?: string;
|
|
8845
|
+
fetch?: typeof fetch;
|
|
8846
|
+
signal?: AbortSignal;
|
|
8847
|
+
timeoutMs?: number;
|
|
8848
|
+
}): Promise<KeyCheck>;
|
|
8849
|
+
/**
|
|
8850
|
+
* One binding's call, as the kernel runs it: the protocol's operations with the kernel's retries,
|
|
8851
|
+
* ids, origins, and prices around them.
|
|
8852
|
+
*/
|
|
8853
|
+
/** What the kernel runs for one binding. */
|
|
8854
|
+
export type ProtocolCall = Required<Omit<ProtocolOperations, 'decide'>> & {
|
|
8855
|
+
decide(request: DecisionCall): Promise<DecisionResult>;
|
|
8856
|
+
embed(request: EmbeddingCall): Promise<EmbeddingResult>;
|
|
8857
|
+
};
|
|
8858
|
+
export declare function callProtocol(setup: CallSetup): ProtocolCall;
|
|
8741
8859
|
`,"file:///node_modules/@theoremjs/agents/src/kernel/protocols/binding.d.ts":`import { z } from 'zod';
|
|
8742
8860
|
import { type JsonObject } from '../json.js';
|
|
8743
8861
|
import { type KeySlot } from '../schema.js';
|
|
@@ -8805,6 +8923,24 @@ export declare function protocolOf(provider: RegisteredProvider, binding: ModelB
|
|
|
8805
8923
|
* binding with its options parsed; changes nothing in place.
|
|
8806
8924
|
*/
|
|
8807
8925
|
export declare function checkBinding<B extends ModelBinding | DecisionModelBinding>(provider: RegisteredProvider, binding: B, profileType: ModelProfileType, runtime?: RuntimeAbilities): B;
|
|
8926
|
+
`,"file:///node_modules/@theoremjs/agents/src/providers/shared/retry.d.ts":`/** How a retry waits; a host or test may pass its own. The signal ends the wait early. */
|
|
8927
|
+
export type Wait = (ms: number, signal?: AbortSignal | null) => Promise<void>;
|
|
8928
|
+
/** All the waiting one call may do between tries; a wait that would pass it sends the last answer back. */
|
|
8929
|
+
export declare const WAIT_BUDGET_MS = 5000;
|
|
8930
|
+
export declare const waitDefault: Wait;
|
|
8931
|
+
export declare function isTransientHttp(status: number): boolean;
|
|
8932
|
+
/** A rejected send that never got a response: a network failure, by \`networkError\`'s rule. An abort, a timeout, or any other kind is not. */
|
|
8933
|
+
export declare function isTransientThrown(err: unknown): boolean;
|
|
8934
|
+
export declare function backoffMs(attempt: number): number;
|
|
8935
|
+
/** \`retry-after-ms\`, else \`Retry-After\` in seconds or as a date; undefined when absent or unreadable. */
|
|
8936
|
+
export declare function retryAfterMs(headers: Headers, now?: number): number | undefined;
|
|
8937
|
+
/**
|
|
8938
|
+
* Retries a transient status (408, 429, 5xx gateway) or a network failure while the waits stay
|
|
8939
|
+
* within five seconds in all, at most four times. Each wait is the response's \`Retry-After\` when it gives one, else
|
|
8940
|
+
* 1s, 2s, 4s then 8s; a wait that would pass the five seconds, or the call's own time left, is not
|
|
8941
|
+
* taken, and the last answer or error goes back as it came. An abort ends the wait.
|
|
8942
|
+
*/
|
|
8943
|
+
export declare function retryTransient(send: typeof fetch, wait?: Wait, timeLeft?: () => number): typeof fetch;
|
|
8808
8944
|
`,"file:///node_modules/@theoremjs/agents/src/kernel/tools/types.d.ts":`import type { z } from 'zod';
|
|
8809
8945
|
import type { TurnDestinations } from '../../guardrails/destinations.js';
|
|
8810
8946
|
import type { ResolveHost } from '../../guardrails/network.js';
|
|
@@ -9338,80 +9474,6 @@ export interface ModelToolResult {
|
|
|
9338
9474
|
/** Directive signals found in the content; raises the turn's taint. */
|
|
9339
9475
|
suspicious?: GuardrailHit[];
|
|
9340
9476
|
}
|
|
9341
|
-
`,"file:///node_modules/@theoremjs/agents/src/kernel/protocols/runtime.d.ts":`import { type Wait } from '../../providers/shared/retry.js';
|
|
9342
|
-
import { type JsonObject } from '../json.js';
|
|
9343
|
-
import type { KeyVault } from '../registry/vault.js';
|
|
9344
|
-
import type { DecisionResult, KeySlot } from '../types.js';
|
|
9345
|
-
import { type DecisionModelBinding, type ModelBinding } from './binding.js';
|
|
9346
|
-
import type { ProviderLimits } from './limits.js';
|
|
9347
|
-
import type { DecisionCall, EmbeddingCall, EmbeddingResult, ModelProfileType, ProtocolOperations } from './protocol.js';
|
|
9348
|
-
import type { RegisteredProvider } from './provider.js';
|
|
9349
|
-
/** Opens a WebSocket with the headers and subprotocols a sign-in put on it. */
|
|
9350
|
-
export type OpenWebSocket = (url: string, init: {
|
|
9351
|
-
headers: Headers;
|
|
9352
|
-
protocols: string[];
|
|
9353
|
-
}) => Promise<WebSocket>;
|
|
9354
|
-
/**
|
|
9355
|
-
* The runtime's own WebSocket. It takes no headers, so a sign-in that needs them is refused; a host
|
|
9356
|
-
* that can send them passes \`openWebSocket\`.
|
|
9357
|
-
*/
|
|
9358
|
-
export declare function plainWebSocket(provider: string): OpenWebSocket;
|
|
9359
|
-
/** What a host lends every provider call: its keys, its network, its clock, and its budgets. */
|
|
9360
|
-
export interface ProviderHostOptions {
|
|
9361
|
-
/** Overrides the model's own \`limits\`, one field at a time. */
|
|
9362
|
-
limits?: ProviderLimits;
|
|
9363
|
-
vault?: KeyVault;
|
|
9364
|
-
fetch?: typeof fetch;
|
|
9365
|
-
wait?: Wait;
|
|
9366
|
-
openWebSocket?: OpenWebSocket;
|
|
9367
|
-
}
|
|
9368
|
-
/** One call's setup: a checked binding on its registered provider, and the host's means. */
|
|
9369
|
-
export interface CallSetup {
|
|
9370
|
-
provider: RegisteredProvider;
|
|
9371
|
-
binding: ModelBinding | DecisionModelBinding;
|
|
9372
|
-
profileType: ModelProfileType;
|
|
9373
|
-
vault?: KeyVault;
|
|
9374
|
-
fetch?: typeof fetch;
|
|
9375
|
-
wait?: Wait;
|
|
9376
|
-
/** Milliseconds the call has left; a retry never waits past it, so the real cause is reported. */
|
|
9377
|
-
timeLeft?(): number;
|
|
9378
|
-
openWebSocket?: OpenWebSocket;
|
|
9379
|
-
limits?: ProviderLimits;
|
|
9380
|
-
signal?: AbortSignal;
|
|
9381
|
-
tapUpstream?(row: JsonObject): void;
|
|
9382
|
-
/** Hands the wire rows to the stream as \`raw\` events, for looking around. */
|
|
9383
|
-
rawRows?: boolean;
|
|
9384
|
-
/** Told the slot and key each attempt signs with, so the caller can redact it and key its state. */
|
|
9385
|
-
onKey?(slot: KeySlot | undefined, key: unknown): void;
|
|
9386
|
-
}
|
|
9387
|
-
/**
|
|
9388
|
-
* One binding's call, as the kernel runs it: the protocol's operations with the kernel's retries,
|
|
9389
|
-
* ids, origins, and prices around them.
|
|
9390
|
-
*/
|
|
9391
|
-
/** What the kernel runs for one binding. */
|
|
9392
|
-
export type ProtocolCall = Required<Omit<ProtocolOperations, 'decide'>> & {
|
|
9393
|
-
decide(request: DecisionCall): Promise<DecisionResult>;
|
|
9394
|
-
embed(request: EmbeddingCall): Promise<EmbeddingResult>;
|
|
9395
|
-
};
|
|
9396
|
-
export declare function callProtocol(setup: CallSetup): ProtocolCall;
|
|
9397
|
-
`,"file:///node_modules/@theoremjs/agents/src/providers/shared/retry.d.ts":`/** How a retry waits; a host or test may pass its own. The signal ends the wait early. */
|
|
9398
|
-
export type Wait = (ms: number, signal?: AbortSignal | null) => Promise<void>;
|
|
9399
|
-
/** All the waiting one call may do between tries; a wait that would pass it sends the last answer back. */
|
|
9400
|
-
export declare const WAIT_BUDGET_MS = 5000;
|
|
9401
|
-
export declare const waitDefault: Wait;
|
|
9402
|
-
export declare function isTransientHttp(status: number): boolean;
|
|
9403
|
-
/** A rejected send that never got a response: a network failure, by \`networkError\`'s rule. An abort, a timeout, or any other kind is not. */
|
|
9404
|
-
export declare function isTransientThrown(err: unknown): boolean;
|
|
9405
|
-
export declare function backoffMs(attempt: number): number;
|
|
9406
|
-
/** \`retry-after-ms\`, else \`Retry-After\` in seconds or as a date; undefined when absent or unreadable. */
|
|
9407
|
-
export declare function retryAfterMs(headers: Headers, now?: number): number | undefined;
|
|
9408
|
-
/**
|
|
9409
|
-
* Retries a transient status (408, 429, 5xx gateway) or a network failure while the waits stay
|
|
9410
|
-
* within five seconds in all, at most four times. Each wait is the response's \`Retry-After\` when it gives one, else
|
|
9411
|
-
* 1s, 2s, 4s then 8s; a wait that would pass the five seconds, or the call's own time left, is not
|
|
9412
|
-
* taken, and the last answer or error goes back as it came. An abort ends the wait.
|
|
9413
|
-
*/
|
|
9414
|
-
export declare function retryTransient(send: typeof fetch, wait?: Wait, timeLeft?: () => number): typeof fetch;
|
|
9415
9477
|
`,"file:///node_modules/@theoremjs/agents/src/kernel/stages.d.ts":`import type { SpanHandle } from '../observability/trace-span.js';
|
|
9416
9478
|
import type { StageApplyWarningCode, TurnStage } from './schema.js';
|
|
9417
9479
|
import type { TurnStop } from './stop.js';
|