@nyte-ai/schema 0.0.0-stage → 0.0.19
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/LICENSE +21 -0
- package/THIRD-PARTY-NOTICES.md +866 -0
- package/dist/chunks/browser-0byq2fja.js +50 -0
- package/dist/chunks/browser-0chm3654.js +125 -0
- package/dist/chunks/browser-0g0z3617.js +47 -0
- package/dist/chunks/browser-0khex2b1.js +33 -0
- package/dist/chunks/browser-0sbkxgkx.js +115 -0
- package/dist/chunks/browser-0xr6c36r.js +106 -0
- package/dist/chunks/browser-1nqahr9q.js +239 -0
- package/dist/chunks/browser-1sfp0bcx.js +73 -0
- package/dist/chunks/browser-3exd93gm.js +50 -0
- package/dist/chunks/browser-40enyw9r.js +75 -0
- package/dist/chunks/browser-4et7qtz3.js +7 -0
- package/dist/chunks/browser-6e1madxa.js +83 -0
- package/dist/chunks/browser-6yby604e.js +96 -0
- package/dist/chunks/browser-7195qf3t.js +14 -0
- package/dist/chunks/browser-8ancsy4m.js +118 -0
- package/dist/chunks/browser-9ystjh78.js +0 -0
- package/dist/chunks/browser-b519jtez.js +102 -0
- package/dist/chunks/browser-bg1esaw0.js +82 -0
- package/dist/chunks/browser-ebr6k189.js +120 -0
- package/dist/chunks/browser-ekbecx9r.js +73 -0
- package/dist/chunks/browser-fd3accdr.js +159 -0
- package/dist/chunks/browser-g5khdcap.js +170 -0
- package/dist/chunks/browser-h5k4hqfq.js +244 -0
- package/dist/chunks/browser-h86zs54a.js +65 -0
- package/dist/chunks/browser-hp9ze9ga.js +185 -0
- package/dist/chunks/browser-hq5q56sf.js +79 -0
- package/dist/chunks/browser-j150etqf.js +101 -0
- package/dist/chunks/browser-j629a6wa.js +17 -0
- package/dist/chunks/browser-jgxe05s4.js +301 -0
- package/dist/chunks/browser-k20f6cvv.js +0 -0
- package/dist/chunks/browser-m0wzr0g8.js +5 -0
- package/dist/chunks/browser-mzfc0v5j.js +58 -0
- package/dist/chunks/browser-p691tcac.js +139 -0
- package/dist/chunks/browser-pdv675va.js +135 -0
- package/dist/chunks/browser-pvfshqyk.js +36 -0
- package/dist/chunks/browser-qkxe0fwp.js +6 -0
- package/dist/chunks/browser-qncc807c.js +66 -0
- package/dist/chunks/browser-r87w64mz.js +32 -0
- package/dist/chunks/browser-s2xe7c21.js +82 -0
- package/dist/chunks/browser-sgst60b0.js +293 -0
- package/dist/chunks/browser-sgwxbek9.js +37 -0
- package/dist/chunks/browser-v70eq512.js +215 -0
- package/dist/chunks/browser-vzc3r2r3.js +64 -0
- package/dist/chunks/browser-xensz05x.js +172 -0
- package/dist/chunks/browser-ynj8v9ad.js +35 -0
- package/dist/chunks/browser-ypez6s7v.js +52 -0
- package/dist/src/browser.d.ts +64 -0
- package/dist/src/browser.js +26 -0
- package/dist/src/configuration.d.ts +26 -0
- package/dist/src/configuration.js +17 -0
- package/dist/src/connection.d.ts +189 -0
- package/dist/src/connection.js +35 -0
- package/dist/src/declaration.d.ts +12 -0
- package/dist/src/declaration.js +1 -0
- package/dist/src/errors.d.ts +56 -0
- package/dist/src/errors.js +23 -0
- package/dist/src/events.d.ts +1752 -0
- package/dist/src/events.js +36 -0
- package/dist/src/files.d.ts +130 -0
- package/dist/src/files.js +49 -0
- package/dist/src/git.d.ts +280 -0
- package/dist/src/git.js +66 -0
- package/dist/src/github.d.ts +174 -0
- package/dist/src/github.js +31 -0
- package/dist/src/heads.d.ts +255 -0
- package/dist/src/heads.js +48 -0
- package/dist/src/hooks.d.ts +201 -0
- package/dist/src/hooks.js +28 -0
- package/dist/src/host.d.ts +137 -0
- package/dist/src/host.js +49 -0
- package/dist/src/ids.d.ts +66 -0
- package/dist/src/ids.js +67 -0
- package/dist/src/index.d.ts +30 -0
- package/dist/src/index.js +783 -0
- package/dist/src/jobs.d.ts +152 -0
- package/dist/src/jobs.js +34 -0
- package/dist/src/json.d.ts +24 -0
- package/dist/src/json.js +21 -0
- package/dist/src/mcp.d.ts +212 -0
- package/dist/src/mcp.js +34 -0
- package/dist/src/messages.d.ts +114 -0
- package/dist/src/messages.js +28 -0
- package/dist/src/model/index.d.ts +6 -0
- package/dist/src/model/index.js +61 -0
- package/dist/src/model/message.d.ts +178 -0
- package/dist/src/model/message.js +7 -0
- package/dist/src/model/model.d.ts +154 -0
- package/dist/src/model/model.js +11 -0
- package/dist/src/model/text.d.ts +6 -0
- package/dist/src/model/text.js +10 -0
- package/dist/src/model/tool.d.ts +36 -0
- package/dist/src/model/tool.js +1 -0
- package/dist/src/model/transcript.d.ts +34 -0
- package/dist/src/model/transcript.js +37 -0
- package/dist/src/model/typed.d.ts +6 -0
- package/dist/src/model/typed.js +8 -0
- package/dist/src/models.d.ts +198 -0
- package/dist/src/models.js +47 -0
- package/dist/src/parts.d.ts +364 -0
- package/dist/src/parts.js +35 -0
- package/dist/src/patch.d.ts +21 -0
- package/dist/src/patch.js +11 -0
- package/dist/src/plugins.d.ts +36 -0
- package/dist/src/plugins.js +9 -0
- package/dist/src/primitives.d.ts +83 -0
- package/dist/src/primitives.js +26 -0
- package/dist/src/runs.d.ts +433 -0
- package/dist/src/runs.js +39 -0
- package/dist/src/schema.d.ts +14 -0
- package/dist/src/schema.js +8 -0
- package/dist/src/serial.d.ts +18 -0
- package/dist/src/serial.js +39 -0
- package/dist/src/sessions.d.ts +578 -0
- package/dist/src/sessions.js +74 -0
- package/dist/src/store.d.ts +830 -0
- package/dist/src/store.js +33 -0
- package/dist/src/tools.d.ts +76 -0
- package/dist/src/tools.js +24 -0
- package/dist/src/views.d.ts +3105 -0
- package/dist/src/views.js +50 -0
- package/dist/src/wire/base64.d.ts +2 -0
- package/dist/src/wire/base64.js +6 -0
- package/dist/src/wire/nullable.d.ts +2 -0
- package/dist/src/wire/nullable.js +6 -0
- package/dist/src/wire/operations/browser.d.ts +535 -0
- package/dist/src/wire/operations/browser.js +12 -0
- package/dist/src/wire/operations/fields.d.ts +54 -0
- package/dist/src/wire/operations/fields.js +30 -0
- package/dist/src/wire/operations/files.d.ts +244 -0
- package/dist/src/wire/operations/files.js +13 -0
- package/dist/src/wire/operations/git.d.ts +513 -0
- package/dist/src/wire/operations/git.js +15 -0
- package/dist/src/wire/operations/github.d.ts +172 -0
- package/dist/src/wire/operations/github.js +12 -0
- package/dist/src/wire/operations/host.d.ts +1031 -0
- package/dist/src/wire/operations/host.js +27 -0
- package/dist/src/wire/operations/index.d.ts +7103 -0
- package/dist/src/wire/operations/index.js +40 -0
- package/dist/src/wire/operations/session.d.ts +3779 -0
- package/dist/src/wire/operations/session.js +25 -0
- package/dist/src/wire/operations/workspace.d.ts +842 -0
- package/dist/src/wire/operations/workspace.js +24 -0
- package/dist/src/workspaces.d.ts +119 -0
- package/dist/src/workspaces.js +38 -0
- package/package.json +51 -3
- package/README.md +0 -3
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
typed2
|
|
3
|
+
} from "../../chunks/browser-qkxe0fwp.js";
|
|
4
|
+
import {
|
|
5
|
+
TextSignatureV1Schema2
|
|
6
|
+
} from "../../chunks/browser-7195qf3t.js";
|
|
7
|
+
import {
|
|
8
|
+
MODEL_THINKING_LEVELS2,
|
|
9
|
+
MODEL_MODES2,
|
|
10
|
+
ModelSchema2
|
|
11
|
+
} from "../../chunks/browser-v70eq512.js";
|
|
12
|
+
import {
|
|
13
|
+
contentText2,
|
|
14
|
+
getSystemMessageText2,
|
|
15
|
+
renderSystemMessageUpdate2
|
|
16
|
+
} from "../../chunks/browser-0khex2b1.js";
|
|
17
|
+
import"../../chunks/browser-9ystjh78.js";
|
|
18
|
+
import {
|
|
19
|
+
createInitialSystemMessage2,
|
|
20
|
+
normalizeContext2,
|
|
21
|
+
getInitialSystemMessage2,
|
|
22
|
+
withoutInitialSystemMessage2,
|
|
23
|
+
getCurrentTools2,
|
|
24
|
+
getCurrentSystemMessage2,
|
|
25
|
+
getCurrentSystemPrompt2,
|
|
26
|
+
collapseSystemMessages2,
|
|
27
|
+
resolveTranscript2,
|
|
28
|
+
toToolDeclaration2,
|
|
29
|
+
declarationsEqual2,
|
|
30
|
+
getToolStateChanges2,
|
|
31
|
+
getDeclaredTools2,
|
|
32
|
+
hasToolRedefinitions2,
|
|
33
|
+
hasNonAdditiveToolChanges2,
|
|
34
|
+
resolveTranscriptTools2
|
|
35
|
+
} from "../../chunks/browser-g5khdcap.js";
|
|
36
|
+
export {
|
|
37
|
+
MODEL_MODES2 as MODEL_MODES,
|
|
38
|
+
MODEL_THINKING_LEVELS2 as MODEL_THINKING_LEVELS,
|
|
39
|
+
ModelSchema2 as ModelSchema,
|
|
40
|
+
TextSignatureV1Schema2 as TextSignatureV1Schema,
|
|
41
|
+
collapseSystemMessages2 as collapseSystemMessages,
|
|
42
|
+
contentText2 as contentText,
|
|
43
|
+
createInitialSystemMessage2 as createInitialSystemMessage,
|
|
44
|
+
declarationsEqual2 as declarationsEqual,
|
|
45
|
+
getCurrentSystemMessage2 as getCurrentSystemMessage,
|
|
46
|
+
getCurrentSystemPrompt2 as getCurrentSystemPrompt,
|
|
47
|
+
getCurrentTools2 as getCurrentTools,
|
|
48
|
+
getDeclaredTools2 as getDeclaredTools,
|
|
49
|
+
getInitialSystemMessage2 as getInitialSystemMessage,
|
|
50
|
+
getSystemMessageText2 as getSystemMessageText,
|
|
51
|
+
getToolStateChanges2 as getToolStateChanges,
|
|
52
|
+
hasNonAdditiveToolChanges2 as hasNonAdditiveToolChanges,
|
|
53
|
+
hasToolRedefinitions2 as hasToolRedefinitions,
|
|
54
|
+
normalizeContext2 as normalizeContext,
|
|
55
|
+
renderSystemMessageUpdate2 as renderSystemMessageUpdate,
|
|
56
|
+
resolveTranscript2 as resolveTranscript,
|
|
57
|
+
resolveTranscriptTools2 as resolveTranscriptTools,
|
|
58
|
+
toToolDeclaration2 as toToolDeclaration,
|
|
59
|
+
typed2 as typed,
|
|
60
|
+
withoutInitialSystemMessage2 as withoutInitialSystemMessage
|
|
61
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
2
|
+
[key: string]: JsonValue;
|
|
3
|
+
};
|
|
4
|
+
import { Type } from "typebox";
|
|
5
|
+
import type { Api, ProviderId } from "./model.ts";
|
|
6
|
+
import type { Tool, ToolReference } from "./tool.ts";
|
|
7
|
+
export interface TextSignatureV1 {
|
|
8
|
+
v: 1;
|
|
9
|
+
id: string;
|
|
10
|
+
phase?: "commentary" | "final_answer";
|
|
11
|
+
}
|
|
12
|
+
export declare const TextSignatureV1Schema: Type.TUnsafe<TextSignatureV1>;
|
|
13
|
+
export interface TextContent {
|
|
14
|
+
type: "text";
|
|
15
|
+
text: string;
|
|
16
|
+
textSignature?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ThinkingContent {
|
|
19
|
+
type: "thinking";
|
|
20
|
+
thinking: string;
|
|
21
|
+
thinkingSignature?: string;
|
|
22
|
+
redacted?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ImageContent {
|
|
25
|
+
type: "image";
|
|
26
|
+
data: string;
|
|
27
|
+
mimeType: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ToolCall {
|
|
30
|
+
type: "toolCall";
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
arguments: Record<string, unknown>;
|
|
34
|
+
thoughtSignature?: string;
|
|
35
|
+
namespace?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Set when the call's finished arguments text was not a JSON object, for example because the
|
|
38
|
+
* response hit its output limit mid-call. `arguments` is then `{}`; this describes the problem
|
|
39
|
+
* and includes the text the model sent. Tool argument validation fails with it.
|
|
40
|
+
*/
|
|
41
|
+
argumentsError?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface Usage {
|
|
44
|
+
input: number;
|
|
45
|
+
output: number;
|
|
46
|
+
cacheRead: number;
|
|
47
|
+
cacheWrite: number;
|
|
48
|
+
cacheWrite1h?: number;
|
|
49
|
+
reasoning?: number;
|
|
50
|
+
totalTokens: number;
|
|
51
|
+
cost: {
|
|
52
|
+
input: number;
|
|
53
|
+
output: number;
|
|
54
|
+
cacheRead: number;
|
|
55
|
+
cacheWrite: number;
|
|
56
|
+
total: number;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export type StopReason = "pending" | "stop" | "length" | "toolUse" | "error" | "aborted" | "deferred";
|
|
60
|
+
export interface DeferredHandle {
|
|
61
|
+
provider: string;
|
|
62
|
+
modelId: string;
|
|
63
|
+
api: string;
|
|
64
|
+
id: string;
|
|
65
|
+
expiresAt?: number;
|
|
66
|
+
pollAfterMs?: number;
|
|
67
|
+
data?: JsonValue;
|
|
68
|
+
}
|
|
69
|
+
export interface DiagnosticErrorInfo {
|
|
70
|
+
name?: string;
|
|
71
|
+
message: string;
|
|
72
|
+
stack?: string;
|
|
73
|
+
code?: string | number;
|
|
74
|
+
}
|
|
75
|
+
export interface AssistantMessageDiagnostic {
|
|
76
|
+
type: string;
|
|
77
|
+
timestamp: number;
|
|
78
|
+
error?: DiagnosticErrorInfo;
|
|
79
|
+
details?: Record<string, unknown>;
|
|
80
|
+
}
|
|
81
|
+
export interface SystemMessage {
|
|
82
|
+
role: "system";
|
|
83
|
+
content: string | TextContent[];
|
|
84
|
+
sections?: Record<string, string | null>;
|
|
85
|
+
toolsAdded?: Tool[];
|
|
86
|
+
toolsRemoved?: ToolReference[];
|
|
87
|
+
timestamp: number;
|
|
88
|
+
}
|
|
89
|
+
export interface UserMessage {
|
|
90
|
+
role: "user";
|
|
91
|
+
content: string | (TextContent | ImageContent)[];
|
|
92
|
+
timestamp: number;
|
|
93
|
+
}
|
|
94
|
+
export interface AssistantMessage {
|
|
95
|
+
role: "assistant";
|
|
96
|
+
content: (TextContent | ThinkingContent | ToolCall)[];
|
|
97
|
+
api: Api;
|
|
98
|
+
provider: ProviderId;
|
|
99
|
+
model: string;
|
|
100
|
+
responseModel?: string;
|
|
101
|
+
responseId?: string;
|
|
102
|
+
diagnostics?: AssistantMessageDiagnostic[];
|
|
103
|
+
usage: Usage;
|
|
104
|
+
stopReason: StopReason;
|
|
105
|
+
deferred?: DeferredHandle;
|
|
106
|
+
errorMessage?: string;
|
|
107
|
+
rawStopReason?: string;
|
|
108
|
+
endTurn?: boolean;
|
|
109
|
+
timestamp: number;
|
|
110
|
+
}
|
|
111
|
+
export interface ToolResultMessage<TDetails = unknown> {
|
|
112
|
+
role: "toolResult";
|
|
113
|
+
toolCallId: string;
|
|
114
|
+
toolName: string;
|
|
115
|
+
content: (TextContent | ImageContent)[];
|
|
116
|
+
details?: TDetails;
|
|
117
|
+
structuredContent?: JsonValue;
|
|
118
|
+
title?: string;
|
|
119
|
+
usage?: Usage;
|
|
120
|
+
addedToolNames?: string[];
|
|
121
|
+
isError: boolean;
|
|
122
|
+
timestamp: number;
|
|
123
|
+
}
|
|
124
|
+
export type Message = SystemMessage | UserMessage | AssistantMessage | ToolResultMessage;
|
|
125
|
+
export type AssistantMessageEvent = {
|
|
126
|
+
type: "start";
|
|
127
|
+
partial: AssistantMessage;
|
|
128
|
+
} | {
|
|
129
|
+
type: "text_start";
|
|
130
|
+
contentIndex: number;
|
|
131
|
+
partial: AssistantMessage;
|
|
132
|
+
} | {
|
|
133
|
+
type: "text_delta";
|
|
134
|
+
contentIndex: number;
|
|
135
|
+
delta: string;
|
|
136
|
+
partial: AssistantMessage;
|
|
137
|
+
} | {
|
|
138
|
+
type: "text_end";
|
|
139
|
+
contentIndex: number;
|
|
140
|
+
content: string;
|
|
141
|
+
partial: AssistantMessage;
|
|
142
|
+
} | {
|
|
143
|
+
type: "thinking_start";
|
|
144
|
+
contentIndex: number;
|
|
145
|
+
partial: AssistantMessage;
|
|
146
|
+
} | {
|
|
147
|
+
type: "thinking_delta";
|
|
148
|
+
contentIndex: number;
|
|
149
|
+
delta: string;
|
|
150
|
+
partial: AssistantMessage;
|
|
151
|
+
} | {
|
|
152
|
+
type: "thinking_end";
|
|
153
|
+
contentIndex: number;
|
|
154
|
+
content: string;
|
|
155
|
+
partial: AssistantMessage;
|
|
156
|
+
} | {
|
|
157
|
+
type: "toolcall_start";
|
|
158
|
+
contentIndex: number;
|
|
159
|
+
partial: AssistantMessage;
|
|
160
|
+
} | {
|
|
161
|
+
type: "toolcall_delta";
|
|
162
|
+
contentIndex: number;
|
|
163
|
+
delta: string;
|
|
164
|
+
partial: AssistantMessage;
|
|
165
|
+
} | {
|
|
166
|
+
type: "toolcall_end";
|
|
167
|
+
contentIndex: number;
|
|
168
|
+
toolCall: ToolCall;
|
|
169
|
+
partial: AssistantMessage;
|
|
170
|
+
} | {
|
|
171
|
+
type: "done";
|
|
172
|
+
reason: Extract<StopReason, "stop" | "length" | "toolUse" | "deferred">;
|
|
173
|
+
message: AssistantMessage;
|
|
174
|
+
} | {
|
|
175
|
+
type: "error";
|
|
176
|
+
reason: Extract<StopReason, "aborted" | "error">;
|
|
177
|
+
error: AssistantMessage;
|
|
178
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
export declare const MODEL_THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
3
|
+
export type ThinkingLevel = Exclude<ModelThinkingLevel, "off">;
|
|
4
|
+
export type ModelThinkingLevel = (typeof MODEL_THINKING_LEVELS)[number];
|
|
5
|
+
export type ThinkingLevelMap = Partial<Record<ModelThinkingLevel, string | null>>;
|
|
6
|
+
export declare const MODEL_MODES: readonly ["fast"];
|
|
7
|
+
export type ModelMode = (typeof MODEL_MODES)[number];
|
|
8
|
+
export type KnownApi = "openai-completions" | "mistral-conversations" | "openai-responses" | "azure-openai-responses" | "openai-codex-responses" | "anthropic-messages" | "bedrock-converse-stream" | "google-generative-ai" | "google-vertex" | "pi-messages";
|
|
9
|
+
export type Api = KnownApi | (string & {});
|
|
10
|
+
export type KnownProvider = "amazon-bedrock" | "ant-ling" | "anthropic" | "google" | "google-vertex" | "openai" | "azure-openai-responses" | "openai-codex" | "radius" | "nvidia" | "deepseek" | "github-copilot" | "xai" | "groq" | "cerebras" | "openrouter" | "vercel-ai-gateway" | "zai" | "zai-coding-cn" | "mistral" | "minimax" | "minimax-cn" | "moonshotai" | "moonshotai-cn" | "huggingface" | "fireworks" | "together" | "baseten" | "opencode" | "opencode-go" | "kimi-coding" | "cloudflare-workers-ai" | "cloudflare-ai-gateway" | "qwen-token-plan" | "qwen-token-plan-cn" | "qwen-token-plan-individual" | "xiaomi" | "xiaomi-token-plan-cn" | "xiaomi-token-plan-ams" | "xiaomi-token-plan-sgp";
|
|
11
|
+
export type ProviderId = KnownProvider | string;
|
|
12
|
+
export type ChatTemplateKwargValue = string | number | boolean | null | {
|
|
13
|
+
$var: "thinking.enabled" | "thinking.effort" | "thinking.budget";
|
|
14
|
+
omitWhenOff?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type ThinkingTokenBudgetField = "thinking_token_budget" | "thinking_budget" | "thinking_budget_tokens";
|
|
17
|
+
export type SessionAffinityFormat = "openai" | "openai-nosession" | "openrouter";
|
|
18
|
+
export type CacheRetention = "none" | "short" | "long";
|
|
19
|
+
export type ModelPromptCache = Partial<Record<Exclude<CacheRetention, "none">, number>>;
|
|
20
|
+
export interface AnthropicAllowedFallbackModel {
|
|
21
|
+
provider: ProviderId;
|
|
22
|
+
model: string;
|
|
23
|
+
cost: ModelCost;
|
|
24
|
+
}
|
|
25
|
+
export interface ModelCostRates {
|
|
26
|
+
input: number;
|
|
27
|
+
output: number;
|
|
28
|
+
cacheRead: number;
|
|
29
|
+
cacheWrite: number;
|
|
30
|
+
}
|
|
31
|
+
export interface ModelCostTier extends ModelCostRates {
|
|
32
|
+
inputTokensAbove: number;
|
|
33
|
+
}
|
|
34
|
+
export interface ModelCost extends ModelCostRates {
|
|
35
|
+
tiers?: ModelCostTier[];
|
|
36
|
+
}
|
|
37
|
+
export interface OpenAICompletionsCompat {
|
|
38
|
+
supportsStore?: boolean;
|
|
39
|
+
supportsDeveloperRole?: boolean;
|
|
40
|
+
supportsReasoningEffort?: boolean;
|
|
41
|
+
supportsUsageInStreaming?: boolean;
|
|
42
|
+
supportsFinishReason?: boolean;
|
|
43
|
+
maxTokensField?: "max_completion_tokens" | "max_tokens";
|
|
44
|
+
requiresToolResultName?: boolean;
|
|
45
|
+
requiresAssistantAfterToolResult?: boolean;
|
|
46
|
+
requiresThinkingAsText?: boolean;
|
|
47
|
+
requiresReasoningContentOnAssistantMessages?: boolean;
|
|
48
|
+
thinkingFormat?: "openai" | "openrouter" | "deepseek" | "together" | "baseten" | "zai" | "qwen" | "chat-template" | "qwen-chat-template" | "string-thinking" | "ant-ling";
|
|
49
|
+
chatTemplateKwargs?: Record<string, ChatTemplateKwargValue>;
|
|
50
|
+
chatTemplateArgs?: Record<string, ChatTemplateKwargValue>;
|
|
51
|
+
openRouterRouting?: OpenRouterRouting;
|
|
52
|
+
vercelGatewayRouting?: VercelGatewayRouting;
|
|
53
|
+
zaiToolStream?: boolean;
|
|
54
|
+
thinkingTokenBudgetField?: ThinkingTokenBudgetField;
|
|
55
|
+
supportsThinkingTokenBudget?: boolean;
|
|
56
|
+
supportsOpenAIGrammarTools?: boolean;
|
|
57
|
+
supportsMidConvoSystemMessages?: boolean;
|
|
58
|
+
supportsMidConvoToolAdditions?: boolean;
|
|
59
|
+
supportsStrictMode?: boolean;
|
|
60
|
+
cacheControlFormat?: "anthropic";
|
|
61
|
+
sendSessionAffinityHeaders?: boolean;
|
|
62
|
+
deferredToolsMode?: "kimi";
|
|
63
|
+
sessionAffinityFormat?: SessionAffinityFormat;
|
|
64
|
+
supportsLongCacheRetention?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface OpenAIResponsesCompat {
|
|
67
|
+
supportsDeveloperRole?: boolean;
|
|
68
|
+
supportsMidConvoSystemMessages?: boolean;
|
|
69
|
+
sessionAffinityFormat?: SessionAffinityFormat;
|
|
70
|
+
supportsLongCacheRetention?: boolean;
|
|
71
|
+
supportsStrictMode?: boolean;
|
|
72
|
+
supportsOpenAIGrammarTools?: boolean;
|
|
73
|
+
supportsAdditionalTools?: boolean;
|
|
74
|
+
supportsToolSearch?: boolean;
|
|
75
|
+
supportsExplicitPromptCacheMode?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export interface AnthropicMessagesCompat {
|
|
78
|
+
supportsEagerToolInputStreaming?: boolean;
|
|
79
|
+
supportsLongCacheRetention?: boolean;
|
|
80
|
+
sendSessionAffinityHeaders?: boolean;
|
|
81
|
+
supportsCacheControlOnTools?: boolean;
|
|
82
|
+
supportsTemperature?: boolean;
|
|
83
|
+
forceAdaptiveThinking?: boolean;
|
|
84
|
+
allowEmptySignature?: boolean;
|
|
85
|
+
supportsStrictTools?: boolean;
|
|
86
|
+
supportsMidConvoSystemMessages?: boolean;
|
|
87
|
+
supportsMidConvoToolChanges?: boolean;
|
|
88
|
+
allowedFallbackModels?: AnthropicAllowedFallbackModel[];
|
|
89
|
+
supportsToolReferences?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface BedrockCompat {
|
|
92
|
+
supportsStrictMode?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface OpenRouterRouting {
|
|
95
|
+
allow_fallbacks?: boolean;
|
|
96
|
+
require_parameters?: boolean;
|
|
97
|
+
data_collection?: "deny" | "allow";
|
|
98
|
+
zdr?: boolean;
|
|
99
|
+
enforce_distillable_text?: boolean;
|
|
100
|
+
order?: string[];
|
|
101
|
+
only?: string[];
|
|
102
|
+
ignore?: string[];
|
|
103
|
+
quantizations?: string[];
|
|
104
|
+
sort?: string | {
|
|
105
|
+
by?: string;
|
|
106
|
+
partition?: string | null;
|
|
107
|
+
};
|
|
108
|
+
max_price?: {
|
|
109
|
+
prompt?: number | string;
|
|
110
|
+
completion?: number | string;
|
|
111
|
+
image?: number | string;
|
|
112
|
+
audio?: number | string;
|
|
113
|
+
request?: number | string;
|
|
114
|
+
};
|
|
115
|
+
preferred_min_throughput?: number | {
|
|
116
|
+
p50?: number;
|
|
117
|
+
p75?: number;
|
|
118
|
+
p90?: number;
|
|
119
|
+
p99?: number;
|
|
120
|
+
};
|
|
121
|
+
preferred_max_latency?: number | {
|
|
122
|
+
p50?: number;
|
|
123
|
+
p75?: number;
|
|
124
|
+
p90?: number;
|
|
125
|
+
p99?: number;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export interface VercelGatewayRouting {
|
|
129
|
+
only?: string[];
|
|
130
|
+
order?: string[];
|
|
131
|
+
}
|
|
132
|
+
export interface Model<TApi extends Api> {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
api: TApi;
|
|
136
|
+
provider: ProviderId;
|
|
137
|
+
baseUrl: string;
|
|
138
|
+
reasoning: boolean;
|
|
139
|
+
modes?: ModelMode[];
|
|
140
|
+
variant?: {
|
|
141
|
+
mode: ModelMode;
|
|
142
|
+
base: string;
|
|
143
|
+
};
|
|
144
|
+
thinkingLevelMap?: ThinkingLevelMap;
|
|
145
|
+
promptCache?: ModelPromptCache;
|
|
146
|
+
input: ("text" | "image")[];
|
|
147
|
+
cost: ModelCost;
|
|
148
|
+
contextWindow: number;
|
|
149
|
+
maxTokens: number;
|
|
150
|
+
samplingParams?: Record<string, unknown>;
|
|
151
|
+
headers?: Record<string, string>;
|
|
152
|
+
compat?: TApi extends "openai-completions" ? OpenAICompletionsCompat : TApi extends "openai-responses" | "azure-openai-responses" | "openai-codex-responses" ? OpenAIResponsesCompat : TApi extends "anthropic-messages" ? AnthropicMessagesCompat : TApi extends "bedrock-converse-stream" ? BedrockCompat : never;
|
|
153
|
+
}
|
|
154
|
+
export declare const ModelSchema: Type.TUnsafe<Model<Api>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MODEL_THINKING_LEVELS2,
|
|
3
|
+
MODEL_MODES2,
|
|
4
|
+
ModelSchema2
|
|
5
|
+
} from "../../chunks/browser-v70eq512.js";
|
|
6
|
+
import"../../chunks/browser-qkxe0fwp.js";
|
|
7
|
+
export {
|
|
8
|
+
MODEL_MODES2 as MODEL_MODES,
|
|
9
|
+
MODEL_THINKING_LEVELS2 as MODEL_THINKING_LEVELS,
|
|
10
|
+
ModelSchema2 as ModelSchema
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ImageContent, SystemMessage, TextContent, ThinkingContent, ToolCall } from "./message.ts";
|
|
2
|
+
type Content = TextContent | ImageContent | ThinkingContent | ToolCall;
|
|
3
|
+
export declare function contentText(content: string | readonly Content[], separator?: string): string;
|
|
4
|
+
export declare function getSystemMessageText(message: SystemMessage): string;
|
|
5
|
+
export declare function renderSystemMessageUpdate(message: SystemMessage): string;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
contentText2,
|
|
3
|
+
getSystemMessageText2,
|
|
4
|
+
renderSystemMessageUpdate2
|
|
5
|
+
} from "../../chunks/browser-0khex2b1.js";
|
|
6
|
+
export {
|
|
7
|
+
contentText2 as contentText,
|
|
8
|
+
getSystemMessageText2 as getSystemMessageText,
|
|
9
|
+
renderSystemMessageUpdate2 as renderSystemMessageUpdate
|
|
10
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TSchema } from "typebox";
|
|
2
|
+
import type { JsonValue, Message } from "./message.ts";
|
|
3
|
+
import type { Api, ProviderId } from "./model.ts";
|
|
4
|
+
export type GrammarFormat = "openai_lark" | "openai_regex";
|
|
5
|
+
export type GrammarVariants = Partial<Record<GrammarFormat, string>>;
|
|
6
|
+
export type ConstrainedSamplingConfig = {
|
|
7
|
+
type: "json_schema";
|
|
8
|
+
strict: "prefer" | "require";
|
|
9
|
+
} | {
|
|
10
|
+
type: "grammar";
|
|
11
|
+
variants: GrammarVariants;
|
|
12
|
+
};
|
|
13
|
+
export type ToolKind = "read" | "edit" | "delete" | "move" | "search" | "execute" | "fetch" | "think" | "other";
|
|
14
|
+
export interface Tool<TParameters extends TSchema = TSchema> {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
parameters: TParameters;
|
|
18
|
+
kind?: ToolKind;
|
|
19
|
+
constrainedSampling?: false | ConstrainedSamplingConfig;
|
|
20
|
+
}
|
|
21
|
+
export interface ToolReference {
|
|
22
|
+
name: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ProviderCheckpointMaterial {
|
|
25
|
+
type: "provider";
|
|
26
|
+
provider: ProviderId;
|
|
27
|
+
api: Api;
|
|
28
|
+
model: string;
|
|
29
|
+
data: JsonValue;
|
|
30
|
+
}
|
|
31
|
+
export interface Context {
|
|
32
|
+
systemPrompt?: string;
|
|
33
|
+
checkpoint?: ProviderCheckpointMaterial;
|
|
34
|
+
messages: Message[];
|
|
35
|
+
tools?: Tool[];
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../chunks/browser-9ystjh78.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Message, SystemMessage } from "./message.ts";
|
|
2
|
+
import type { Context, ProviderCheckpointMaterial, Tool, ToolReference } from "./tool.ts";
|
|
3
|
+
declare const transcriptContextBrand: unique symbol;
|
|
4
|
+
export interface TranscriptContext {
|
|
5
|
+
messages: Message[];
|
|
6
|
+
checkpoint?: ProviderCheckpointMaterial;
|
|
7
|
+
readonly [transcriptContextBrand]: true;
|
|
8
|
+
}
|
|
9
|
+
export declare function createInitialSystemMessage(systemPrompt: string | undefined, tools: Tool[] | undefined): SystemMessage | undefined;
|
|
10
|
+
export declare function normalizeContext(context: Context): TranscriptContext;
|
|
11
|
+
export type TranscriptMessages = readonly Message[];
|
|
12
|
+
export declare function getInitialSystemMessage(messages: TranscriptMessages): SystemMessage | undefined;
|
|
13
|
+
export declare function withoutInitialSystemMessage(messages: Message[]): Message[];
|
|
14
|
+
export declare function getCurrentTools(messages: TranscriptMessages): Tool[];
|
|
15
|
+
export declare function getCurrentSystemMessage(messages: TranscriptMessages): SystemMessage | undefined;
|
|
16
|
+
export declare function getCurrentSystemPrompt(messages: TranscriptMessages): string;
|
|
17
|
+
export declare function collapseSystemMessages(context: TranscriptContext): TranscriptContext;
|
|
18
|
+
export declare function resolveTranscript(context: TranscriptContext, supportsMidConvoSystemMessages: boolean | undefined): TranscriptContext;
|
|
19
|
+
export declare function toToolDeclaration(tool: Tool): Tool;
|
|
20
|
+
export declare function declarationsEqual(left: Tool, right: Tool): boolean;
|
|
21
|
+
export interface ToolStateChanges {
|
|
22
|
+
toolsAdded: Tool[];
|
|
23
|
+
toolsRemoved: ToolReference[];
|
|
24
|
+
}
|
|
25
|
+
export declare function getToolStateChanges(previous: readonly Tool[], current: readonly Tool[]): ToolStateChanges;
|
|
26
|
+
export declare function getDeclaredTools(messages: TranscriptMessages): Tool[];
|
|
27
|
+
export declare function hasToolRedefinitions(messages: TranscriptMessages): boolean;
|
|
28
|
+
export declare function hasNonAdditiveToolChanges(messages: TranscriptMessages): boolean;
|
|
29
|
+
export interface TranscriptTools {
|
|
30
|
+
requestTools: Tool[];
|
|
31
|
+
anchorsAdditions: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare function resolveTranscriptTools(messages: TranscriptMessages, supportsToolAdditions: boolean): TranscriptTools;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createInitialSystemMessage2,
|
|
3
|
+
normalizeContext2,
|
|
4
|
+
getInitialSystemMessage2,
|
|
5
|
+
withoutInitialSystemMessage2,
|
|
6
|
+
getCurrentTools2,
|
|
7
|
+
getCurrentSystemMessage2,
|
|
8
|
+
getCurrentSystemPrompt2,
|
|
9
|
+
collapseSystemMessages2,
|
|
10
|
+
resolveTranscript2,
|
|
11
|
+
toToolDeclaration2,
|
|
12
|
+
declarationsEqual2,
|
|
13
|
+
getToolStateChanges2,
|
|
14
|
+
getDeclaredTools2,
|
|
15
|
+
hasToolRedefinitions2,
|
|
16
|
+
hasNonAdditiveToolChanges2,
|
|
17
|
+
resolveTranscriptTools2
|
|
18
|
+
} from "../../chunks/browser-g5khdcap.js";
|
|
19
|
+
import"../../chunks/browser-0khex2b1.js";
|
|
20
|
+
export {
|
|
21
|
+
collapseSystemMessages2 as collapseSystemMessages,
|
|
22
|
+
createInitialSystemMessage2 as createInitialSystemMessage,
|
|
23
|
+
declarationsEqual2 as declarationsEqual,
|
|
24
|
+
getCurrentSystemMessage2 as getCurrentSystemMessage,
|
|
25
|
+
getCurrentSystemPrompt2 as getCurrentSystemPrompt,
|
|
26
|
+
getCurrentTools2 as getCurrentTools,
|
|
27
|
+
getDeclaredTools2 as getDeclaredTools,
|
|
28
|
+
getInitialSystemMessage2 as getInitialSystemMessage,
|
|
29
|
+
getToolStateChanges2 as getToolStateChanges,
|
|
30
|
+
hasNonAdditiveToolChanges2 as hasNonAdditiveToolChanges,
|
|
31
|
+
hasToolRedefinitions2 as hasToolRedefinitions,
|
|
32
|
+
normalizeContext2 as normalizeContext,
|
|
33
|
+
resolveTranscript2 as resolveTranscript,
|
|
34
|
+
resolveTranscriptTools2 as resolveTranscriptTools,
|
|
35
|
+
toToolDeclaration2 as toToolDeclaration,
|
|
36
|
+
withoutInitialSystemMessage2 as withoutInitialSystemMessage
|
|
37
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import type { Static, TProperties, TSchema, TUnsafe } from "typebox";
|
|
3
|
+
type Proof<S extends TSchema, T> = [Static<S>] extends [T] ? [T] extends [Static<S>] ? S : never : never;
|
|
4
|
+
export declare const typed: <T>() => <S extends TSchema>(schema: Proof<S, T>) => TUnsafe<T>;
|
|
5
|
+
export declare const object: <P extends TProperties>(properties: P) => Type.TObject<P>;
|
|
6
|
+
export {};
|