chore: bump deps
This commit is contained in:
76
Cargo.lock
generated
76
Cargo.lock
generated
@@ -70,7 +70,7 @@ dependencies = [
|
|||||||
"napi",
|
"napi",
|
||||||
"rand 0.9.4",
|
"rand 0.9.4",
|
||||||
"rayon",
|
"rayon",
|
||||||
"sha3",
|
"sha3 0.12.0",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.11.0",
|
"sha2 0.11.0",
|
||||||
"sha3",
|
"sha3 0.12.0",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
@@ -531,7 +531,7 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
"hex",
|
"hex",
|
||||||
"serde",
|
"serde",
|
||||||
"sha3",
|
"sha3 0.11.0",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
@@ -2320,6 +2320,17 @@ dependencies = [
|
|||||||
"regex-syntax",
|
"regex-syntax",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fancy-regex"
|
||||||
|
version = "0.18.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e1e1dacd0d2082dfcf1351c4bdd566bbe89a2b263235a2b50058f1e130a47277"
|
||||||
|
dependencies = [
|
||||||
|
"bit-set 0.8.0",
|
||||||
|
"regex-automata",
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fast-float2"
|
name = "fast-float2"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
@@ -3988,25 +3999,25 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jsonschema"
|
name = "jsonschema"
|
||||||
version = "0.46.2"
|
version = "0.47.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "50180452e7808015fe083eae3efcf1ec98b89b45dd8cc204f7b4a6b7b81ea675"
|
checksum = "281c43ff06dcb331e9356d30e38853d559ce3d0a3f693e0b0e102667dec14fb1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"bytecount",
|
"bytecount",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
"email_address",
|
"email_address",
|
||||||
"fancy-regex 0.17.0",
|
"fancy-regex 0.18.0",
|
||||||
"fraction",
|
"fraction",
|
||||||
"getrandom 0.3.4",
|
"getrandom 0.3.4",
|
||||||
"idna",
|
"idna",
|
||||||
"itoa",
|
"itoa",
|
||||||
|
"jsonschema-regex",
|
||||||
"num-cmp",
|
"num-cmp",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"referencing",
|
"referencing",
|
||||||
"regex",
|
"regex",
|
||||||
"regex-syntax",
|
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rustls",
|
"rustls",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -4015,6 +4026,15 @@ dependencies = [
|
|||||||
"uuid-simd",
|
"uuid-simd",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jsonschema-regex"
|
||||||
|
version = "0.47.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee0b351864e7ffbc5db9273daf7fa1b4d5177b0946713d667ca571b83c0b4045"
|
||||||
|
dependencies = [
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kamadak-exif"
|
name = "kamadak-exif"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
@@ -4273,16 +4293,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "llm_adapter"
|
name = "llm_adapter"
|
||||||
version = "0.2.7"
|
version = "0.2.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "332397a6ccde5ac47fc32b29a2eed447135eb4ff6fd05ffb88dfe937ea9c8211"
|
checksum = "b5edfe10ad51d5301468a395532cb0068caac1057fbda942edebe423fe585509"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"jsonschema",
|
"jsonschema",
|
||||||
"schemars",
|
"schemars",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.9",
|
"sha2 0.11.0",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
"ureq",
|
"ureq",
|
||||||
"url",
|
"url",
|
||||||
@@ -4290,9 +4310,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "llm_runtime"
|
name = "llm_runtime"
|
||||||
version = "0.2.5"
|
version = "0.2.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "804da5b8087fe2ec5d48f4b0716d5cf3639d6feb1c4242a6364ccdb7ef5bfa61"
|
checksum = "2705eff96fcd8e21cb9f23245da8f6da260133dfaa9e6280840f426a6290cb9e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jsonschema",
|
"jsonschema",
|
||||||
"llm_adapter",
|
"llm_adapter",
|
||||||
@@ -6095,14 +6115,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "referencing"
|
name = "referencing"
|
||||||
version = "0.46.2"
|
version = "0.47.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "acb0c66c7b78c1da928bee668b5cc638c678642ff587faff6e6222f797be9d4c"
|
checksum = "348e860aeb0b7bd035778fd11dd9cd5290d32e4aed3b8f2274a00287a9fd362b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"fluent-uri",
|
"fluent-uri",
|
||||||
"getrandom 0.3.4",
|
"getrandom 0.3.4",
|
||||||
"hashbrown 0.16.1",
|
"hashbrown 0.17.1",
|
||||||
"itoa",
|
"itoa",
|
||||||
"micromap",
|
"micromap",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
@@ -6497,11 +6517,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "schemars"
|
name = "schemars"
|
||||||
version = "0.8.22"
|
version = "1.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615"
|
checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dyn-clone",
|
"dyn-clone",
|
||||||
|
"ref-cast",
|
||||||
"schemars_derive",
|
"schemars_derive",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -6509,9 +6530,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "schemars_derive"
|
name = "schemars_derive"
|
||||||
version = "0.8.22"
|
version = "1.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d"
|
checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -6757,6 +6778,17 @@ dependencies = [
|
|||||||
"keccak",
|
"keccak",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha3"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bc9bad02c26382724b2d2692c6f179285e4b54eeecd7968f52a50059c3c11759"
|
||||||
|
dependencies = [
|
||||||
|
"digest 0.11.3",
|
||||||
|
"keccak",
|
||||||
|
"sponge-cursor",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sharded-slab"
|
name = "sharded-slab"
|
||||||
version = "0.1.7"
|
version = "0.1.7"
|
||||||
@@ -6924,6 +6956,12 @@ dependencies = [
|
|||||||
"der",
|
"der",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sponge-cursor"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3a0219bd7d979d58245a4f41f695e1ac9f8befdffadd7f61f1bae9e39abc6620"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlx"
|
name = "sqlx"
|
||||||
version = "0.8.6"
|
version = "0.8.6"
|
||||||
|
|||||||
@@ -78,12 +78,12 @@ resolver = "3"
|
|||||||
rayon = "1.10"
|
rayon = "1.10"
|
||||||
rubato = "0.16"
|
rubato = "0.16"
|
||||||
safefetch = "0.1.0"
|
safefetch = "0.1.0"
|
||||||
schemars = "0.8"
|
schemars = "1.2"
|
||||||
screencapturekit = "0.3"
|
screencapturekit = "0.3"
|
||||||
serde = "1"
|
serde = "1"
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
sha2 = "0.11"
|
sha2 = "0.11"
|
||||||
sha3 = "0.11"
|
sha3 = "0.12"
|
||||||
sqlx = { version = "0.8", default-features = false, features = [
|
sqlx = { version = "0.8", default-features = false, features = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"macros",
|
"macros",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ homedir = { workspace = true }
|
|||||||
image = { workspace = true }
|
image = { workspace = true }
|
||||||
infer = { workspace = true }
|
infer = { workspace = true }
|
||||||
instant-xml = "0.7.5"
|
instant-xml = "0.7.5"
|
||||||
jsonschema = "0.46"
|
jsonschema = "0.47"
|
||||||
libwebp-sys = "0.9.6"
|
libwebp-sys = "0.9.6"
|
||||||
little_exif = { workspace = true }
|
little_exif = { workspace = true }
|
||||||
llm_adapter = { workspace = true, features = ["schema", "ureq-client"] }
|
llm_adapter = { workspace = true, features = ["schema", "ureq-client"] }
|
||||||
|
|||||||
10
packages/backend/native/index.d.ts
vendored
10
packages/backend/native/index.d.ts
vendored
@@ -574,7 +574,7 @@ export interface ModelConditionsContract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelRegistryMatchRequest {
|
export interface ModelRegistryMatchRequest {
|
||||||
backendKind: 'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | 'gemini_vertex' | 'fal' | 'anthropic_vertex'
|
backendKind: 'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | 'gemini_vertex' | 'fal' | 'anthropic_vertex' | 'deepseek' | 'kimi' | 'opencode_go' | 'opencode_zen'
|
||||||
cond: ModelConditionsContract
|
cond: ModelConditionsContract
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ export interface ModelRegistryMatchResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelRegistryResolveRequest {
|
export interface ModelRegistryResolveRequest {
|
||||||
backendKind?: 'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | 'gemini_vertex' | 'fal' | 'anthropic_vertex'
|
backendKind?: 'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | 'gemini_vertex' | 'fal' | 'anthropic_vertex' | 'deepseek' | 'kimi' | 'opencode_go' | 'opencode_zen'
|
||||||
modelId: string
|
modelId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,11 +594,11 @@ export interface ModelRegistryResolveResponse {
|
|||||||
|
|
||||||
export interface ModelRegistryRouteContract {
|
export interface ModelRegistryRouteContract {
|
||||||
protocol?: 'openai_chat' | 'openai_responses' | 'openai_images' | 'anthropic' | 'gemini' | 'fal_image'
|
protocol?: 'openai_chat' | 'openai_responses' | 'openai_images' | 'anthropic' | 'gemini' | 'fal_image'
|
||||||
requestLayer?: 'anthropic' | 'chat_completions' | 'cloudflare_workers_ai' | 'responses' | 'openai_images' | 'fal' | 'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'
|
requestLayer?: 'anthropic' | 'chat_completions' | 'chat_completions_no_v1' | 'cloudflare_workers_ai' | 'responses' | 'openai_images' | 'fal' | 'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelRegistryVariantContract {
|
export interface ModelRegistryVariantContract {
|
||||||
backendKind: 'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | 'gemini_vertex' | 'fal' | 'anthropic_vertex'
|
backendKind: 'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | 'gemini_vertex' | 'fal' | 'anthropic_vertex' | 'deepseek' | 'kimi' | 'opencode_go' | 'opencode_zen'
|
||||||
canonicalKey: string
|
canonicalKey: string
|
||||||
rawModelId: string
|
rawModelId: string
|
||||||
displayName?: string
|
displayName?: string
|
||||||
@@ -606,7 +606,7 @@ export interface ModelRegistryVariantContract {
|
|||||||
legacyAliases?: Array<string>
|
legacyAliases?: Array<string>
|
||||||
capabilities: Array<CapabilityModelCapability>
|
capabilities: Array<CapabilityModelCapability>
|
||||||
protocol?: 'openai_chat' | 'openai_responses' | 'openai_images' | 'anthropic' | 'gemini' | 'fal_image'
|
protocol?: 'openai_chat' | 'openai_responses' | 'openai_images' | 'anthropic' | 'gemini' | 'fal_image'
|
||||||
requestLayer?: 'anthropic' | 'chat_completions' | 'cloudflare_workers_ai' | 'responses' | 'openai_images' | 'fal' | 'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'
|
requestLayer?: 'anthropic' | 'chat_completions' | 'chat_completions_no_v1' | 'cloudflare_workers_ai' | 'responses' | 'openai_images' | 'fal' | 'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'
|
||||||
routeOverrides?: Record<string, ModelRegistryRouteContract>
|
routeOverrides?: Record<string, ModelRegistryRouteContract>
|
||||||
behaviorFlags?: Array<string>
|
behaviorFlags?: Array<string>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use jsonschema::Draft;
|
use jsonschema::Draft;
|
||||||
use napi::{Error, Result, Status};
|
use napi::{Error, Result, Status};
|
||||||
use schemars::{JsonSchema, r#gen::SchemaSettings};
|
use schemars::{JsonSchema, generate::SchemaSettings};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
@@ -61,15 +61,18 @@ fn mark_property_nullable(schema: &mut Value, property: &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn mark_definition_property_nullable(schema: &mut Value, definition: &str, property: &str) {
|
fn mark_definition_property_nullable(schema: &mut Value, definition: &str, property: &str) {
|
||||||
if let Some(property_schema) = schema
|
for definitions_key in ["definitions", "$defs"] {
|
||||||
.get_mut("definitions")
|
if let Some(property_schema) = schema
|
||||||
.and_then(Value::as_object_mut)
|
.get_mut(definitions_key)
|
||||||
.and_then(|definitions| definitions.get_mut(definition))
|
.and_then(Value::as_object_mut)
|
||||||
.and_then(|schema| schema.get_mut("properties"))
|
.and_then(|definitions| definitions.get_mut(definition))
|
||||||
.and_then(Value::as_object_mut)
|
.and_then(|schema| schema.get_mut("properties"))
|
||||||
.and_then(|properties| properties.get_mut(property))
|
.and_then(Value::as_object_mut)
|
||||||
{
|
.and_then(|properties| properties.get_mut(property))
|
||||||
mark_schema_nullable(property_schema);
|
{
|
||||||
|
mark_schema_nullable(property_schema);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ pub struct RequestedModelMatchResponse {
|
|||||||
pub struct ModelRegistryResolveRequest {
|
pub struct ModelRegistryResolveRequest {
|
||||||
#[napi(
|
#[napi(
|
||||||
ts_type = "'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | \
|
ts_type = "'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | \
|
||||||
'gemini_vertex' | 'fal' | 'anthropic_vertex'"
|
'gemini_vertex' | 'fal' | 'anthropic_vertex' | 'deepseek' | 'kimi' | 'opencode_go' | 'opencode_zen'"
|
||||||
)]
|
)]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub backend_kind: Option<String>,
|
pub backend_kind: Option<String>,
|
||||||
@@ -333,7 +333,7 @@ pub struct ModelRegistryResolveRequest {
|
|||||||
pub struct ModelRegistryMatchRequest {
|
pub struct ModelRegistryMatchRequest {
|
||||||
#[napi(
|
#[napi(
|
||||||
ts_type = "'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | \
|
ts_type = "'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | \
|
||||||
'gemini_vertex' | 'fal' | 'anthropic_vertex'"
|
'gemini_vertex' | 'fal' | 'anthropic_vertex' | 'deepseek' | 'kimi' | 'opencode_go' | 'opencode_zen'"
|
||||||
)]
|
)]
|
||||||
pub backend_kind: String,
|
pub backend_kind: String,
|
||||||
pub cond: ModelConditionsContract,
|
pub cond: ModelConditionsContract,
|
||||||
@@ -346,7 +346,7 @@ pub struct ModelRegistryMatchRequest {
|
|||||||
pub struct ModelRegistryVariantContract {
|
pub struct ModelRegistryVariantContract {
|
||||||
#[napi(
|
#[napi(
|
||||||
ts_type = "'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | \
|
ts_type = "'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | \
|
||||||
'gemini_vertex' | 'fal' | 'anthropic_vertex'"
|
'gemini_vertex' | 'fal' | 'anthropic_vertex' | 'deepseek' | 'kimi' | 'opencode_go' | 'opencode_zen'"
|
||||||
)]
|
)]
|
||||||
pub backend_kind: String,
|
pub backend_kind: String,
|
||||||
pub canonical_key: String,
|
pub canonical_key: String,
|
||||||
@@ -361,8 +361,8 @@ pub struct ModelRegistryVariantContract {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub protocol: Option<String>,
|
pub protocol: Option<String>,
|
||||||
#[napi(
|
#[napi(
|
||||||
ts_type = "'anthropic' | 'chat_completions' | 'cloudflare_workers_ai' | 'responses' | 'openai_images' | 'fal' | \
|
ts_type = "'anthropic' | 'chat_completions' | 'chat_completions_no_v1' | 'cloudflare_workers_ai' | 'responses' | \
|
||||||
'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'"
|
'openai_images' | 'fal' | 'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'"
|
||||||
)]
|
)]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub request_layer: Option<String>,
|
pub request_layer: Option<String>,
|
||||||
@@ -381,8 +381,8 @@ pub struct ModelRegistryRouteContract {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub protocol: Option<String>,
|
pub protocol: Option<String>,
|
||||||
#[napi(
|
#[napi(
|
||||||
ts_type = "'anthropic' | 'chat_completions' | 'cloudflare_workers_ai' | 'responses' | 'openai_images' | 'fal' | \
|
ts_type = "'anthropic' | 'chat_completions' | 'chat_completions_no_v1' | 'cloudflare_workers_ai' | 'responses' | \
|
||||||
'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'"
|
'openai_images' | 'fal' | 'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'"
|
||||||
)]
|
)]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub request_layer: Option<String>,
|
pub request_layer: Option<String>,
|
||||||
|
|||||||
@@ -111,6 +111,80 @@ mod tests {
|
|||||||
assert_eq!(response.variant.unwrap().raw_model_id, "gemini-embedding-001");
|
assert_eq!(response.variant.unwrap().raw_model_id, "gemini-embedding-001");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_resolve_deepseek_provider_variants() {
|
||||||
|
let response = llm_resolve_model_registry_variant(ModelRegistryResolveRequest {
|
||||||
|
backend_kind: Some("deepseek".to_string()),
|
||||||
|
model_id: "deepseek-v4-pro".to_string(),
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let variant = response.variant.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(variant.raw_model_id, "deepseek-v4-pro");
|
||||||
|
assert_eq!(variant.request_layer.as_deref(), Some("chat_completions_no_v1"));
|
||||||
|
|
||||||
|
let legacy = llm_resolve_model_registry_variant(ModelRegistryResolveRequest {
|
||||||
|
backend_kind: Some("deepseek".to_string()),
|
||||||
|
model_id: "deepseek-chat".to_string(),
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(legacy.matched_by.as_deref(), Some("legacy_alias"));
|
||||||
|
assert_eq!(legacy.variant.unwrap().raw_model_id, "deepseek-v4-flash");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_resolve_kimi_provider_default_model() {
|
||||||
|
let response = llm_resolve_model_registry_variant(ModelRegistryResolveRequest {
|
||||||
|
backend_kind: Some("kimi".to_string()),
|
||||||
|
model_id: "kimi-k2.7-code-highspeed".to_string(),
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let variant = response.variant.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(variant.raw_model_id, "kimi-k2.7-code-highspeed");
|
||||||
|
assert_eq!(variant.protocol.as_deref(), Some("openai_chat"));
|
||||||
|
assert_eq!(variant.request_layer.as_deref(), Some("chat_completions"));
|
||||||
|
assert_eq!(
|
||||||
|
variant.behavior_flags.as_deref(),
|
||||||
|
Some(&["omit_tool_choice".to_string(), "reasoning_supported".to_string()][..])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_resolve_opencode_go_prefixed_alias() {
|
||||||
|
let response = llm_resolve_model_registry_variant(ModelRegistryResolveRequest {
|
||||||
|
backend_kind: Some("opencode_go".to_string()),
|
||||||
|
model_id: "opencode-go/kimi-k2.7-code".to_string(),
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let variant = response.variant.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(response.matched_by.as_deref(), Some("alias"));
|
||||||
|
assert_eq!(variant.backend_kind, "opencode_go");
|
||||||
|
assert_eq!(variant.raw_model_id, "kimi-k2.7-code");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_match_opencode_zen_default_variant() {
|
||||||
|
let response = llm_match_model_registry(ModelRegistryMatchRequest {
|
||||||
|
backend_kind: "opencode_zen".to_string(),
|
||||||
|
cond: ModelConditionsContract {
|
||||||
|
input_types: Some(vec!["text".to_string()]),
|
||||||
|
attachment_kinds: None,
|
||||||
|
attachment_source_kinds: None,
|
||||||
|
has_remote_attachments: None,
|
||||||
|
model_id: None,
|
||||||
|
output_type: Some("text".to_string()),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let variant = response.variant.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(variant.raw_model_id, "kimi-k2.7-code");
|
||||||
|
assert_eq!(variant.backend_kind, "opencode_zen");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_resolve_gemini_embedding_2() {
|
fn should_resolve_gemini_embedding_2() {
|
||||||
let response = llm_resolve_model_registry_variant(ModelRegistryResolveRequest {
|
let response = llm_resolve_model_registry_variant(ModelRegistryResolveRequest {
|
||||||
|
|||||||
@@ -107,28 +107,31 @@ test.serial('should sign and verify a user session jwt', async t => {
|
|||||||
t.true(signed.expiresAt.getTime() > Date.now());
|
t.true(signed.expiresAt.getTime() > Date.now());
|
||||||
});
|
});
|
||||||
|
|
||||||
test.serial('should use application session ttl for jwt expiration', async t => {
|
test.serial(
|
||||||
const defaultSigned = t.context.jwtSession.sign(
|
'should use application session ttl for jwt expiration',
|
||||||
t.context.user.id,
|
async t => {
|
||||||
t.context.sessionId
|
const defaultSigned = t.context.jwtSession.sign(
|
||||||
);
|
t.context.user.id,
|
||||||
assertSignedTtl(t, defaultSigned, DEFAULT_SESSION_TTL);
|
t.context.sessionId
|
||||||
|
);
|
||||||
|
assertSignedTtl(t, defaultSigned, DEFAULT_SESSION_TTL);
|
||||||
|
|
||||||
const ttl = 120;
|
const ttl = 120;
|
||||||
t.context.config.override({
|
t.context.config.override({
|
||||||
auth: {
|
auth: {
|
||||||
session: {
|
session: {
|
||||||
ttl,
|
ttl,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
});
|
|
||||||
|
|
||||||
const configuredSigned = t.context.jwtSession.sign(
|
const configuredSigned = t.context.jwtSession.sign(
|
||||||
t.context.user.id,
|
t.context.user.id,
|
||||||
t.context.sessionId
|
t.context.sessionId
|
||||||
);
|
);
|
||||||
assertSignedTtl(t, configuredSigned, ttl);
|
assertSignedTtl(t, configuredSigned, ttl);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test.serial('should reject invalid jwt cases', async t => {
|
test.serial('should reject invalid jwt cases', async t => {
|
||||||
const cases: Array<{ name: string; token: string }> = [
|
const cases: Array<{ name: string; token: string }> = [
|
||||||
|
|||||||
@@ -507,6 +507,7 @@ export type LlmBackendConfig = {
|
|||||||
request_layer?:
|
request_layer?:
|
||||||
| 'anthropic'
|
| 'anthropic'
|
||||||
| 'chat_completions'
|
| 'chat_completions'
|
||||||
|
| 'chat_completions_no_v1'
|
||||||
| 'cloudflare_workers_ai'
|
| 'cloudflare_workers_ai'
|
||||||
| 'responses'
|
| 'responses'
|
||||||
| 'openai_images'
|
| 'openai_images'
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export const RustRequestMiddlewareValues = [
|
|||||||
'clamp_max_tokens',
|
'clamp_max_tokens',
|
||||||
'tool_schema_rewrite',
|
'tool_schema_rewrite',
|
||||||
'openai_request_compat',
|
'openai_request_compat',
|
||||||
|
'omit_tool_choice',
|
||||||
] as const;
|
] as const;
|
||||||
export type RustRequestMiddleware =
|
export type RustRequestMiddleware =
|
||||||
(typeof RustRequestMiddlewareValues)[number];
|
(typeof RustRequestMiddlewareValues)[number];
|
||||||
|
|||||||
Reference in New Issue
Block a user