Connector lane speaks model-connector v4: delete codex-connector and its v2 port, typed refusals, failures and usage, controller_work.v19
The v2 CodexConnectorInferencePort and the codex-connector dependency are deleted. ConnectorInferencePort speaks model-connector v4 to claude-connector, maps every Refusal and FailureKind to a typed InferenceFaultClass and reports Usage as TokenUsage. The SDK prefix claims a model only when the sidecar is configured, and open_inference refuses a sidecar that would take a connector model. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c43eb54962
commit
12f4f17ccf
14 changed files with 1290 additions and 411 deletions
459
Cargo.lock
generated
459
Cargo.lock
generated
|
|
@ -52,6 +52,15 @@ version = "1.0.104"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
|
||||
|
||||
[[package]]
|
||||
name = "ar_archive_writer"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "523e5e187fff36fcb8d1d19ccf0ca4ca43ec3d158316057f66dc6f72716bc5ec"
|
||||
dependencies = [
|
||||
"object",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.92"
|
||||
|
|
@ -82,10 +91,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.23.1"
|
||||
name = "base64ct"
|
||||
version = "1.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"
|
||||
checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
|
|
@ -172,20 +181,10 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "codex-connector"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/GameCult/CodexConnector.git?rev=68fe94b9475823de92ed766a97ea962d48723708#68fe94b9475823de92ed766a97ea962d48723708"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"base64 0.23.1",
|
||||
"rand_core 0.6.4",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"thiserror",
|
||||
"zeroize",
|
||||
]
|
||||
name = "const-oid"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
|
|
@ -238,7 +237,7 @@ source = "git+https://github.com/GameCult/CultLib.git?rev=85f7024a35ea42cf9f0a01
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"cultcache-rs-derive",
|
||||
"cultcache-rs-derive 0.1.0",
|
||||
"fs2",
|
||||
"redb",
|
||||
"rmp-serde",
|
||||
|
|
@ -249,6 +248,26 @@ dependencies = [
|
|||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cultcache-rs"
|
||||
version = "0.3.1"
|
||||
source = "git+https://github.com/GameCult/CultLib.git?rev=a4eae9056152335662f1115f97bf35fb00ab6d23#a4eae9056152335662f1115f97bf35fb00ab6d23"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"cultcache-rs-derive 0.2.0",
|
||||
"fs2",
|
||||
"redb",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"serde_json",
|
||||
"serde_stacker",
|
||||
"stacker",
|
||||
"uuid",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cultcache-rs-derive"
|
||||
version = "0.1.0"
|
||||
|
|
@ -259,6 +278,78 @@ dependencies = [
|
|||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cultcache-rs-derive"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/GameCult/CultLib.git?rev=a4eae9056152335662f1115f97bf35fb00ab6d23#a4eae9056152335662f1115f97bf35fb00ab6d23"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cultnet-rs"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/GameCult/CultLib.git?rev=a4eae9056152335662f1115f97bf35fb00ab6d23#a4eae9056152335662f1115f97bf35fb00ab6d23"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"anyhow",
|
||||
"base64",
|
||||
"chrono",
|
||||
"cultcache-rs 0.3.1",
|
||||
"ed25519-dalek",
|
||||
"hmac",
|
||||
"rand 0.9.5",
|
||||
"rmp-serde",
|
||||
"rmpv",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"socket2 0.5.10",
|
||||
"uuid",
|
||||
"windows-sys 0.61.2",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curve25519-dalek"
|
||||
version = "4.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures 0.2.17",
|
||||
"curve25519-dalek-derive",
|
||||
"digest",
|
||||
"fiat-crypto",
|
||||
"rustc_version",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curve25519-dalek-derive"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
|
|
@ -267,6 +358,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
|||
dependencies = [
|
||||
"block-buffer",
|
||||
"crypto-common",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -280,6 +372,36 @@ dependencies = [
|
|||
"syn 3.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dyn-clone"
|
||||
version = "1.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
|
||||
|
||||
[[package]]
|
||||
name = "ed25519"
|
||||
version = "2.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
|
||||
dependencies = [
|
||||
"pkcs8",
|
||||
"signature",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ed25519-dalek"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"ed25519",
|
||||
"serde",
|
||||
"sha2",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.14"
|
||||
|
|
@ -296,6 +418,12 @@ version = "2.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
|
||||
|
||||
[[package]]
|
||||
name = "fiat-crypto"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.11"
|
||||
|
|
@ -404,6 +532,18 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi 5.3.0",
|
||||
"wasip2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.4.3"
|
||||
|
|
@ -413,7 +553,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"r-efi 6.0.0",
|
||||
"rand_core 0.10.1",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
|
@ -434,9 +574,9 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"async-trait",
|
||||
"chrono",
|
||||
"codex-connector",
|
||||
"cultcache-rs",
|
||||
"cultcache-rs 0.1.0",
|
||||
"ghostlight-persona-projection",
|
||||
"model-connector",
|
||||
"reqwest",
|
||||
"rmp-serde",
|
||||
"rmpv",
|
||||
|
|
@ -475,6 +615,15 @@ dependencies = [
|
|||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
|
||||
dependencies = [
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.5.0"
|
||||
|
|
@ -556,7 +705,7 @@ version = "0.1.20"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"base64",
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
|
|
@ -567,7 +716,7 @@ dependencies = [
|
|||
"libc",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"socket2 0.6.5",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
|
|
@ -789,6 +938,26 @@ dependencies = [
|
|||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "model-connector"
|
||||
version = "0.1.0"
|
||||
source = "git+https://eureka.gamecult.org/forge/GameCult/ModelConnector.git?rev=edf2f8e03cbb61df385b9b145b46f676ce3b70d5#edf2f8e03cbb61df385b9b145b46f676ce3b70d5"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"base64",
|
||||
"cultnet-rs",
|
||||
"rand_core 0.6.4",
|
||||
"rmp-serde",
|
||||
"rmpv",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"thiserror",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
|
|
@ -798,6 +967,15 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.39.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.4"
|
||||
|
|
@ -845,6 +1023,16 @@ version = "0.2.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
|
||||
dependencies = [
|
||||
"der",
|
||||
"spki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polyval"
|
||||
version = "0.6.2"
|
||||
|
|
@ -866,6 +1054,15 @@ dependencies = [
|
|||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||
dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.107"
|
||||
|
|
@ -875,6 +1072,16 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "psm"
|
||||
version = "0.1.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622"
|
||||
dependencies = [
|
||||
"ar_archive_writer",
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quinn"
|
||||
version = "0.11.11"
|
||||
|
|
@ -888,7 +1095,7 @@ dependencies = [
|
|||
"quinn-udp",
|
||||
"rustc-hash",
|
||||
"rustls",
|
||||
"socket2",
|
||||
"socket2 0.6.5",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
|
|
@ -904,7 +1111,7 @@ dependencies = [
|
|||
"bytes",
|
||||
"getrandom 0.4.3",
|
||||
"lru-slab",
|
||||
"rand",
|
||||
"rand 0.10.2",
|
||||
"rand_pcg",
|
||||
"ring",
|
||||
"rustc-hash",
|
||||
|
|
@ -926,7 +1133,7 @@ dependencies = [
|
|||
"cfg_aliases",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"socket2",
|
||||
"socket2 0.6.5",
|
||||
"tracing",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
|
@ -940,12 +1147,28 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "5.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"
|
||||
dependencies = [
|
||||
"rand_chacha",
|
||||
"rand_core 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.10.2"
|
||||
|
|
@ -957,6 +1180,16 @@ dependencies = [
|
|||
"rand_core 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
|
|
@ -966,6 +1199,15 @@ dependencies = [
|
|||
"getrandom 0.2.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
|
||||
dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.10.1"
|
||||
|
|
@ -999,13 +1241,33 @@ dependencies = [
|
|||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ref-cast"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3"
|
||||
dependencies = [
|
||||
"ref-cast-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ref-cast-impl"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"base64",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
|
|
@ -1080,6 +1342,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "7a4e1d4b9b938a26d2996af33229f0ca0956c652c1375067f0b45291c1df8417"
|
||||
dependencies = [
|
||||
"rmp",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1088,6 +1352,15 @@ version = "2.1.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
||||
dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "1.1.4"
|
||||
|
|
@ -1148,12 +1421,43 @@ version = "1.0.23"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e"
|
||||
dependencies = [
|
||||
"dyn-clone",
|
||||
"ref-cast",
|
||||
"schemars_derive",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schemars_derive"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde_derive_internals",
|
||||
"syn 3.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.229"
|
||||
|
|
@ -1194,6 +1498,17 @@ dependencies = [
|
|||
"syn 3.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive_internals"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.151"
|
||||
|
|
@ -1207,6 +1522,17 @@ dependencies = [
|
|||
"zmij",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_stacker"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4936375d50c4be7eff22293a9344f8e46f323ed2b3c243e52f89138d9bb0f4a"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_core",
|
||||
"stacker",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_urlencoded"
|
||||
version = "0.7.1"
|
||||
|
|
@ -1246,6 +1572,15 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
|
||||
dependencies = [
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.12"
|
||||
|
|
@ -1258,6 +1593,16 @@ version = "1.15.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.5"
|
||||
|
|
@ -1268,12 +1613,35 @@ dependencies = [
|
|||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spki"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
||||
|
||||
[[package]]
|
||||
name = "stacker"
|
||||
version = "0.1.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"psm",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.6.1"
|
||||
|
|
@ -1392,7 +1760,7 @@ dependencies = [
|
|||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"socket2 0.6.5",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
|
@ -1613,6 +1981,15 @@ version = "0.11.1+wasi-snapshot-preview1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||
|
||||
[[package]]
|
||||
name = "wasip2"
|
||||
version = "1.0.4+wasi-0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487"
|
||||
dependencies = [
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.127"
|
||||
|
|
@ -1882,6 +2259,12 @@ version = "0.52.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.57.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
|
||||
|
||||
[[package]]
|
||||
name = "writeable"
|
||||
version = "0.6.4"
|
||||
|
|
@ -1911,6 +2294,26 @@ dependencies = [
|
|||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cba8a86aee14fc8cc6c208af60854b3d4ab7185a9a369a12c648faa2716ff42a"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f89bca3b96ceb3cfcb4572790402f977442270d252b9a8504ebc258760c55f94"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerofrom"
|
||||
version = "0.1.8"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ version = "0.1.0"
|
|||
anyhow = "1"
|
||||
async-trait = "0.1"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
codex-connector = { git = "https://github.com/GameCult/CodexConnector.git", rev = "68fe94b9475823de92ed766a97ea962d48723708" }
|
||||
model-connector = { git = "https://eureka.gamecult.org/forge/GameCult/ModelConnector.git", rev = "edf2f8e03cbb61df385b9b145b46f676ce3b70d5" }
|
||||
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "85f7024a35ea42cf9f0a0199a064526427150191", package = "cultcache-rs" }
|
||||
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] }
|
||||
rmp-serde = "1.3"
|
||||
|
|
|
|||
|
|
@ -341,6 +341,9 @@ fn lane_fault(error: &ControllerOpenError) -> &'static str {
|
|||
"--key-file is unreadable, empty, or not one run of visible ASCII"
|
||||
}
|
||||
ControllerOpenError::SharedModelPrefix { .. } => "two inference lanes claim one model prefix",
|
||||
ControllerOpenError::SidecarClaimsConnectorModel { .. } => {
|
||||
"the SDK sidecar prefix claims a connector model"
|
||||
}
|
||||
ControllerOpenError::EmptyModelPrefix { .. } => "an inference lane's model prefix is empty",
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ license.workspace = true
|
|||
[dependencies]
|
||||
async-trait.workspace = true
|
||||
chrono.workspace = true
|
||||
codex-connector.workspace = true
|
||||
model-connector.workspace = true
|
||||
cultcache-rs.workspace = true
|
||||
ghostlight-persona-projection = { path = "../ghostlight-persona-projection" }
|
||||
reqwest.workspace = true
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -33,7 +33,7 @@ use super::{
|
|||
SubjectId, SubjectKind, WorldId, WorldPatch, WorldPhase, WorldSnapshot,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use codex_connector::CodexInputItem;
|
||||
use model_connector::InputItem;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
|
@ -349,7 +349,7 @@ pub(super) struct ElaborationCapture {
|
|||
}
|
||||
|
||||
pub(super) enum ElaborationLoopEvaluation {
|
||||
Continue { conversation: Vec<CodexInputItem> },
|
||||
Continue { conversation: Vec<InputItem> },
|
||||
Complete { capture: ElaborationCapture },
|
||||
}
|
||||
|
||||
|
|
@ -1135,7 +1135,7 @@ pub(super) fn evaluate_elaboration_loop(
|
|||
budget: usize,
|
||||
) -> Result<ElaborationLoopEvaluation, ControllerError> {
|
||||
check_refusals(refusals, completed.len())?;
|
||||
let mut conversation = vec![CodexInputItem::UserText {
|
||||
let mut conversation = vec![InputItem::UserText {
|
||||
text: prompt.to_owned(),
|
||||
}];
|
||||
let mut fold = DraftFold::default();
|
||||
|
|
@ -1155,7 +1155,7 @@ pub(super) fn evaluate_elaboration_loop(
|
|||
match event {
|
||||
InferenceEvent::Text(text) => {
|
||||
if !text.is_empty() {
|
||||
conversation.push(CodexInputItem::AssistantText { text: text.clone() });
|
||||
conversation.push(InputItem::AssistantText { text: text.clone() });
|
||||
}
|
||||
}
|
||||
InferenceEvent::ToolCall {
|
||||
|
|
@ -1164,13 +1164,13 @@ pub(super) fn evaluate_elaboration_loop(
|
|||
arguments,
|
||||
} => {
|
||||
called_tool = true;
|
||||
conversation.push(CodexInputItem::ToolCall {
|
||||
conversation.push(InputItem::ToolCall {
|
||||
call_id: call_id.clone(),
|
||||
name: name.clone(),
|
||||
arguments: arguments.clone(),
|
||||
});
|
||||
let result = fold.apply(name, arguments);
|
||||
conversation.push(CodexInputItem::ToolResult {
|
||||
conversation.push(InputItem::ToolResult {
|
||||
call_id: call_id.clone(),
|
||||
output: result,
|
||||
});
|
||||
|
|
@ -1187,7 +1187,7 @@ pub(super) fn evaluate_elaboration_loop(
|
|||
"a refusal follows a round that submitted nothing".into(),
|
||||
));
|
||||
}
|
||||
conversation.push(CodexInputItem::UserText {
|
||||
conversation.push(InputItem::UserText {
|
||||
text: render_refusal(&refusal.mismatches),
|
||||
});
|
||||
fold = DraftFold::default();
|
||||
|
|
@ -1439,7 +1439,7 @@ pub(super) fn elaboration_request(
|
|||
round: usize,
|
||||
model: &str,
|
||||
instructions: &str,
|
||||
input: Vec<CodexInputItem>,
|
||||
input: Vec<InputItem>,
|
||||
) -> Result<InferenceRequest, ControllerError> {
|
||||
tool_request(
|
||||
command_id,
|
||||
|
|
@ -2035,7 +2035,7 @@ fn seed_request(
|
|||
command_id: CommandId,
|
||||
round: usize,
|
||||
model: &str,
|
||||
input: Vec<CodexInputItem>,
|
||||
input: Vec<InputItem>,
|
||||
) -> Result<InferenceRequest, ControllerError> {
|
||||
tool_request(
|
||||
command_id,
|
||||
|
|
@ -2213,7 +2213,7 @@ mod tests {
|
|||
let recomputed: Vec<String> = conversation
|
||||
.iter()
|
||||
.filter_map(|item| match item {
|
||||
CodexInputItem::ToolResult { output, .. } => Some(output.clone()),
|
||||
InputItem::ToolResult { output, .. } => Some(output.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
|
|
@ -2389,13 +2389,13 @@ mod tests {
|
|||
.unwrap() else {
|
||||
panic!("a refused round finalized instead of reopening");
|
||||
};
|
||||
let CodexInputItem::UserText { text } = conversation.last().unwrap() else {
|
||||
let InputItem::UserText { text } = conversation.last().unwrap() else {
|
||||
panic!("the refusal is not the next user turn");
|
||||
};
|
||||
assert!(text.contains("The world refused the patch you submitted"));
|
||||
assert!(text.contains(&render_mismatch(&Mismatch::NoCanonicalChange)));
|
||||
assert!(
|
||||
matches!(&conversation[1], CodexInputItem::ToolCall { name, .. } if name == "declare_place"),
|
||||
matches!(&conversation[1], InputItem::ToolCall { name, .. } if name == "declare_place"),
|
||||
"the refused round's calls left the conversation"
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use super::controllers::{
|
|||
call_id_is_valid, tool_name_is_valid, unix_ms,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use codex_connector::CodexInputItem;
|
||||
use model_connector::InputItem;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
|
@ -334,9 +334,9 @@ fn lower_request(prepared: &PreparedInference, prefix: &str) -> Result<Value, In
|
|||
let mut messages = vec![json!({"role": "system", "content": request.instructions})];
|
||||
for item in &request.input {
|
||||
messages.push(match item {
|
||||
CodexInputItem::UserText { text } => json!({"role": "user", "content": text}),
|
||||
CodexInputItem::AssistantText { text } => json!({"role": "assistant", "content": text}),
|
||||
CodexInputItem::ToolCall {
|
||||
InputItem::UserText { text } => json!({"role": "user", "content": text}),
|
||||
InputItem::AssistantText { text } => json!({"role": "assistant", "content": text}),
|
||||
InputItem::ToolCall {
|
||||
call_id,
|
||||
name,
|
||||
arguments,
|
||||
|
|
@ -349,11 +349,18 @@ fn lower_request(prepared: &PreparedInference, prefix: &str) -> Result<Value, In
|
|||
"function": {"name": name, "arguments": arguments},
|
||||
}],
|
||||
}),
|
||||
CodexInputItem::ToolResult { call_id, output } => json!({
|
||||
InputItem::ToolResult { call_id, output } => json!({
|
||||
"role": "tool",
|
||||
"tool_call_id": call_id,
|
||||
"content": output,
|
||||
}),
|
||||
// Ghostlight replays no provider state, and an OpenAI-compatible
|
||||
// server has no place for one.
|
||||
InputItem::ReasoningState { .. } => {
|
||||
return Err(InferenceFault::integrity_violation(
|
||||
"a local request carried provider reasoning state",
|
||||
));
|
||||
}
|
||||
});
|
||||
}
|
||||
let mut tools = Vec::with_capacity(request.tools.len());
|
||||
|
|
@ -379,9 +386,7 @@ fn lower_request(prepared: &PreparedInference, prefix: &str) -> Result<Value, In
|
|||
body["tools"] = json!(tools);
|
||||
body["parallel_tool_calls"] = json!(request.parallel_tool_calls);
|
||||
}
|
||||
if let Some(max_tokens) = request.max_output_tokens {
|
||||
body["max_tokens"] = json!(max_tokens);
|
||||
}
|
||||
body["max_tokens"] = json!(request.max_output_tokens);
|
||||
Ok(body)
|
||||
}
|
||||
|
||||
|
|
@ -570,7 +575,7 @@ mod tests {
|
|||
use crate::patch::{RECORD_GAP_PATCH_TOOL, SUBMIT_PATCH_TOOL, patch_tools};
|
||||
use crate::sdk_inference::{DEFAULT_SDK_MODEL_PREFIX, RoutedInferencePort, SdkBinding};
|
||||
use crate::CommandId;
|
||||
use codex_connector::CodexToolDefinition;
|
||||
use model_connector::ToolDefinition;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::{Mutex, OnceLock};
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
|
|
@ -822,7 +827,7 @@ mod tests {
|
|||
InferencePurpose::Elaboration,
|
||||
TEST_MODEL,
|
||||
"Author the shortfall.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: prompt.into(),
|
||||
}],
|
||||
patch_tools(),
|
||||
|
|
@ -889,18 +894,18 @@ mod tests {
|
|||
TEST_MODEL,
|
||||
"Only reply once every item is accounted for.",
|
||||
vec![
|
||||
CodexInputItem::UserText {
|
||||
InputItem::UserText {
|
||||
text: "Open the gate.".into(),
|
||||
},
|
||||
CodexInputItem::AssistantText {
|
||||
InputItem::AssistantText {
|
||||
text: "Checking the ledger.".into(),
|
||||
},
|
||||
CodexInputItem::ToolCall {
|
||||
InputItem::ToolCall {
|
||||
call_id: "call-9".into(),
|
||||
name: RECORD_GAP_PATCH_TOOL.into(),
|
||||
arguments: r#"{"detail":"no ledger entry"}"#.into(),
|
||||
},
|
||||
CodexInputItem::ToolResult {
|
||||
InputItem::ToolResult {
|
||||
call_id: "call-9".into(),
|
||||
output: "gap recorded".into(),
|
||||
},
|
||||
|
|
@ -1005,7 +1010,7 @@ mod tests {
|
|||
InferencePurpose::Elaboration,
|
||||
TEST_MODEL,
|
||||
"Author the shortfall.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Author the shortfall.".into(),
|
||||
}],
|
||||
patch_tools(),
|
||||
|
|
@ -1083,10 +1088,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1119,10 +1124,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1194,10 +1199,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1232,10 +1237,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1400,7 +1405,7 @@ mod tests {
|
|||
InferencePurpose::Elaboration,
|
||||
TEST_MODEL,
|
||||
"Author the shortfall.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Author the shortfall.".into(),
|
||||
}],
|
||||
patch_tools(),
|
||||
|
|
@ -1428,10 +1433,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1460,7 +1465,7 @@ mod tests {
|
|||
InferencePurpose::Elaboration,
|
||||
TEST_MODEL,
|
||||
"Author the shortfall.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Author the shortfall.".into(),
|
||||
}],
|
||||
patch_tools(),
|
||||
|
|
@ -1493,10 +1498,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1526,10 +1531,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1558,10 +1563,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1588,10 +1593,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1624,10 +1629,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Say something true.".into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -2054,8 +2059,8 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
"hosted/deepseek-chat",
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText { text: "Say something true.".into() }],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
vec![InputItem::UserText { text: "Say something true.".into() }],
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape { max_output_tokens: 1_200, parallel_tool_calls: false },
|
||||
)
|
||||
.expect("the request builds");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use super::{
|
|||
AffordanceId, CommandId, ControllerAssignment, ControllerId, EdgeId, EntityId, LensWeights,
|
||||
NewController, SubjectId, SubjectKind, SubjectState, WorldId,
|
||||
};
|
||||
use codex_connector::CodexToolDefinition;
|
||||
use model_connector::ToolDefinition;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
|
@ -6726,7 +6726,7 @@ pub(crate) const PATCH_TOOLS: &[PatchTool] = &[
|
|||
|
||||
/// The catalog. Fixed per build: it reads `PATCH_TOOLS` and nothing else — not
|
||||
/// world state, not a snapshot, not a config.
|
||||
pub(crate) fn patch_tools() -> Vec<CodexToolDefinition> {
|
||||
pub(crate) fn patch_tools() -> Vec<ToolDefinition> {
|
||||
PATCH_TOOLS
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use super::controllers::{
|
|||
tool_name_is_valid, unix_ms,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use codex_connector::CodexInputItem;
|
||||
use model_connector::{InputItem, ReasoningEffort};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::collections::BTreeMap;
|
||||
|
|
@ -29,10 +29,6 @@ use tokio::sync::Mutex as AsyncMutex;
|
|||
/// largest request either transport carries is the same grouped cell.
|
||||
pub(super) const MAX_SIDECAR_FRAME_BYTES: usize = 1_052_672;
|
||||
|
||||
/// The reasoning-effort values the SDK's own `EffortLevel` admits. A request
|
||||
/// carrying anything else is refused rather than silently mis-mapped.
|
||||
const SDK_EFFORT_LEVELS: [&str; 5] = ["low", "medium", "high", "xhigh", "max"];
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(tag = "kind", rename_all = "snake_case")]
|
||||
pub(super) enum SidecarFrame {
|
||||
|
|
@ -379,9 +375,9 @@ struct SdkInferenceReceipt {
|
|||
const SDK_RECEIPT_SCHEMA: &str = "ghostlight.sdk_inference_receipt.v1";
|
||||
|
||||
/// The model-name prefix that names the SDK transport when nothing configures
|
||||
/// one. It holds even with no SDK port built, so a `claude-`prefixed lane on a
|
||||
/// connector-only deployment is refused at open instead of quietly reaching the
|
||||
/// wrong backend.
|
||||
/// one. It claims a model only when the sidecar is configured; the connector
|
||||
/// serves `claude-` models on its own, and `open_inference` refuses a sidecar
|
||||
/// whose prefix would take a connector model.
|
||||
pub const DEFAULT_SDK_MODEL_PREFIX: &str = "claude";
|
||||
|
||||
/// Everything the SDK sidecar needs to open, gathered so `open_inference` takes
|
||||
|
|
@ -551,15 +547,8 @@ pub(super) fn lower_query(
|
|||
turn_cap: u32,
|
||||
) -> Result<SidecarFrame, InferenceFault> {
|
||||
let request = &prepared.invocation.request;
|
||||
if let Some(effort) = request.reasoning_effort.as_deref()
|
||||
&& !SDK_EFFORT_LEVELS.contains(&effort)
|
||||
{
|
||||
return Err(InferenceFault::integrity_violation(
|
||||
"the requested reasoning effort has no SDK counterpart",
|
||||
));
|
||||
}
|
||||
let mut items = request.input.iter();
|
||||
let Some(CodexInputItem::UserText { text: prompt }) = items.next() else {
|
||||
let Some(InputItem::UserText { text: prompt }) = items.next() else {
|
||||
return Err(InferenceFault::integrity_violation(
|
||||
"an SDK request must open with exactly one user text item",
|
||||
));
|
||||
|
|
@ -567,17 +556,22 @@ pub(super) fn lower_query(
|
|||
let mut transcript = Vec::new();
|
||||
for item in items {
|
||||
match item {
|
||||
CodexInputItem::AssistantText { text } => transcript.push(format!("assistant: {text}")),
|
||||
CodexInputItem::ToolCall {
|
||||
InputItem::AssistantText { text } => transcript.push(format!("assistant: {text}")),
|
||||
InputItem::ToolCall {
|
||||
name, arguments, ..
|
||||
} => transcript.push(format!("tool call {name}: {arguments}")),
|
||||
CodexInputItem::ToolResult { output, .. } => {
|
||||
InputItem::ToolResult { output, .. } => {
|
||||
transcript.push(format!("tool result: {output}"))
|
||||
}
|
||||
// A later user turn is a kernel refusal reopening the session; the
|
||||
// transcript is already a textual replay of the conversation, so
|
||||
// it rides there like every other turn.
|
||||
CodexInputItem::UserText { text } => transcript.push(format!("user: {text}")),
|
||||
InputItem::UserText { text } => transcript.push(format!("user: {text}")),
|
||||
InputItem::ReasoningState { .. } => {
|
||||
return Err(InferenceFault::integrity_violation(
|
||||
"an SDK request carried provider reasoning state",
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(SidecarFrame::Query {
|
||||
|
|
@ -595,8 +589,16 @@ pub(super) fn lower_query(
|
|||
parameters_json: tool.parameters_json.clone(),
|
||||
})
|
||||
.collect(),
|
||||
effort: request.reasoning_effort.clone(),
|
||||
max_output_tokens: request.max_output_tokens,
|
||||
effort: request.reasoning_effort.map(|effort| {
|
||||
match effort {
|
||||
ReasoningEffort::Low => "low",
|
||||
ReasoningEffort::Medium => "medium",
|
||||
ReasoningEffort::High => "high",
|
||||
ReasoningEffort::Max => "max",
|
||||
}
|
||||
.to_owned()
|
||||
}),
|
||||
max_output_tokens: Some(request.max_output_tokens),
|
||||
turn_cap,
|
||||
})
|
||||
}
|
||||
|
|
@ -769,8 +771,10 @@ impl RoutedInferencePort {
|
|||
.filter(|(prefix, _)| model.starts_with(prefix.as_str()))
|
||||
.max_by_key(|(prefix, _)| prefix.len())
|
||||
.map(|(prefix, port)| (prefix.len(), port));
|
||||
let sdk_claim = model
|
||||
.starts_with(&self.sdk_model_prefix)
|
||||
// The SDK prefix claims only when the sidecar is configured: the
|
||||
// connector serves `claude-` models too, so an unconfigured sidecar
|
||||
// must leave them to it.
|
||||
let sdk_claim = (self.sdk.is_some() && model.starts_with(&self.sdk_model_prefix))
|
||||
.then_some(self.sdk_model_prefix.len());
|
||||
match (local_claim, sdk_claim) {
|
||||
(Some((local_len, local_port)), Some(sdk_len)) => {
|
||||
|
|
@ -831,7 +835,7 @@ mod tests {
|
|||
RECORD_GAP_PATCH_TOOL, SUBMIT_PATCH_TOOL, kernel_speak_entry, patch_tools,
|
||||
};
|
||||
use crate::{AffordanceId, AffordanceSnapshot};
|
||||
use codex_connector::CodexToolDefinition;
|
||||
use model_connector::ToolDefinition;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
const TEST_RUNTIME: &str = "ghostlight-sdk-test";
|
||||
|
|
@ -912,7 +916,7 @@ mod tests {
|
|||
InferencePurpose::Elaboration,
|
||||
TEST_MODEL,
|
||||
"Author the shortfall.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: prompt.into(),
|
||||
}],
|
||||
patch_tools(),
|
||||
|
|
@ -932,10 +936,10 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
TEST_MODEL,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: prompt.into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens: 1_200,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -1346,7 +1350,7 @@ mod tests {
|
|||
InferencePurpose::OperationalAgent,
|
||||
TEST_MODEL,
|
||||
"Use only the supplied tools.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: "Hold the bridge.".into(),
|
||||
}],
|
||||
catalog_tools("", &granted),
|
||||
|
|
@ -1442,10 +1446,21 @@ mod tests {
|
|||
open_inference(None, Some(sdk()), None, None, &models("gpt-5.6-terra").each()),
|
||||
Err(ControllerOpenError::UnroutableModel { .. })
|
||||
));
|
||||
// The connector alone serves `claude-` models.
|
||||
assert!(
|
||||
open_inference(Some(connector()), None, None, None, &models("claude-haiku-5-5").each()).is_ok()
|
||||
);
|
||||
// A sidecar whose prefix would take a model the connector serves is
|
||||
// refused at open, not left to steal the route.
|
||||
assert!(matches!(
|
||||
open_inference(Some(connector()), None, None, None, &models("claude-opus-5").each()),
|
||||
Err(ControllerOpenError::UnroutableModel { .. })
|
||||
open_inference(Some(connector()), Some(sdk()), None, None, &models("claude-haiku-5-5").each()),
|
||||
Err(ControllerOpenError::SidecarClaimsConnectorModel { .. })
|
||||
));
|
||||
// The same sidecar beside the connector is fine for a model the
|
||||
// connector does not serve.
|
||||
assert!(
|
||||
open_inference(Some(connector()), Some(sdk()), None, None, &models("claude-opus-5").each()).is_ok()
|
||||
);
|
||||
assert!(matches!(
|
||||
open_inference(
|
||||
None,
|
||||
|
|
@ -1795,13 +1810,6 @@ mod tests {
|
|||
assert_names_no(&fault, CANARY);
|
||||
}
|
||||
|
||||
// An effort the SDK has no counterpart for.
|
||||
let port = SdkInferencePort::new(ScriptedLink::new(Vec::new()), TEST_RUNTIME);
|
||||
let mut prepared = prose_prepared(&port, "Say something true.");
|
||||
prepared.invocation.request.reasoning_effort = Some(CANARY.into());
|
||||
let fault = lower_query(1, &prepared, 1).expect_err("an unmapped effort lowered");
|
||||
assert_names_no(&fault, CANARY);
|
||||
|
||||
// A model no backend claims, prepared and inferred through the router.
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
let entry = directory.path().join("main.js");
|
||||
|
|
@ -1824,8 +1832,8 @@ mod tests {
|
|||
InferencePurpose::Persona,
|
||||
CANARY,
|
||||
"Respond only in natural prose.",
|
||||
vec![CodexInputItem::UserText { text: "Say something true.".into() }],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
vec![InputItem::UserText { text: "Say something true.".into() }],
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape { max_output_tokens: 1_200, parallel_tool_calls: false },
|
||||
)
|
||||
.expect("the request builds");
|
||||
|
|
@ -1840,25 +1848,27 @@ mod tests {
|
|||
// `lower_query` reads the provider request off the prepared value, so
|
||||
// the shapes it must refuse are written there directly. Nothing here
|
||||
// asserts a digest; the identity tests own that.
|
||||
let build = |input: Vec<CodexInputItem>, effort: Option<&str>| {
|
||||
let build = |input: Vec<InputItem>, effort: Option<ReasoningEffort>| {
|
||||
let mut prepared = prose_prepared(&port, "Say something true.");
|
||||
prepared.invocation.request.input = input;
|
||||
prepared.invocation.request.reasoning_effort = effort.map(str::to_owned);
|
||||
prepared.invocation.request.reasoning_effort = effort;
|
||||
prepared
|
||||
};
|
||||
let user = |text: &str| CodexInputItem::UserText { text: text.into() };
|
||||
let user = |text: &str| InputItem::UserText { text: text.into() };
|
||||
|
||||
// Every effort the SDK admits passes; anything else is refused.
|
||||
for effort in SDK_EFFORT_LEVELS {
|
||||
// Every typed effort lowers.
|
||||
for effort in [
|
||||
ReasoningEffort::Low,
|
||||
ReasoningEffort::Medium,
|
||||
ReasoningEffort::High,
|
||||
ReasoningEffort::Max,
|
||||
] {
|
||||
assert!(lower_query(1, &build(vec![user("go")], Some(effort)), 1).is_ok());
|
||||
}
|
||||
let fault = lower_query(1, &build(vec![user("go")], Some("blistering")), 1)
|
||||
.expect_err("an unmapped effort lowered");
|
||||
assert!(fault.integrity_was_violated(), "{fault:?}");
|
||||
|
||||
// The first item must be user text.
|
||||
for input in [
|
||||
vec![CodexInputItem::AssistantText { text: "no".into() }],
|
||||
vec![InputItem::AssistantText { text: "no".into() }],
|
||||
Vec::new(),
|
||||
] {
|
||||
let fault = lower_query(1, &build(input, None), 1)
|
||||
|
|
@ -1881,20 +1891,20 @@ mod tests {
|
|||
&build(
|
||||
vec![
|
||||
user("go"),
|
||||
CodexInputItem::AssistantText {
|
||||
InputItem::AssistantText {
|
||||
text: "thinking".into(),
|
||||
},
|
||||
CodexInputItem::ToolCall {
|
||||
InputItem::ToolCall {
|
||||
call_id: "call-0".into(),
|
||||
name: "record_gap".into(),
|
||||
arguments: "{}".into(),
|
||||
},
|
||||
CodexInputItem::ToolResult {
|
||||
InputItem::ToolResult {
|
||||
call_id: "call-0".into(),
|
||||
output: "gap recorded".into(),
|
||||
},
|
||||
],
|
||||
Some("medium"),
|
||||
Some(ReasoningEffort::Medium),
|
||||
),
|
||||
4,
|
||||
)
|
||||
|
|
@ -1930,15 +1940,27 @@ mod tests {
|
|||
#[tokio::test]
|
||||
async fn soul_routing_refuses_rather_than_falling_back() {
|
||||
assert_eq!(DEFAULT_SDK_MODEL_PREFIX, "claude");
|
||||
let connector_only = RoutedInferencePort::new(
|
||||
Some(Arc::new(SdkInferencePort::new(
|
||||
let stand_in = || {
|
||||
Arc::new(SdkInferencePort::new(
|
||||
ScriptedLink::new(Vec::new()),
|
||||
TEST_RUNTIME,
|
||||
)) as Arc<dyn InferencePort>),
|
||||
)) as Arc<dyn InferencePort>
|
||||
};
|
||||
// A connector with no sidecar serves `claude-` models itself.
|
||||
let connector = stand_in();
|
||||
let connector_only = RoutedInferencePort::new(
|
||||
Some(Arc::clone(&connector)),
|
||||
None,
|
||||
DEFAULT_SDK_MODEL_PREFIX,
|
||||
Vec::new(),
|
||||
);
|
||||
assert!(Arc::ptr_eq(
|
||||
connector_only.route(TEST_MODEL).unwrap(),
|
||||
&connector
|
||||
));
|
||||
// A sidecar on a prefix that does not match, and no connector: the
|
||||
// model has no owner and routes nowhere.
|
||||
let connector_only = RoutedInferencePort::new(None, Some(stand_in()), "sdk/", Vec::new());
|
||||
assert!(connector_only.route(TEST_MODEL).is_none());
|
||||
let prepared =
|
||||
PreparedInference::prepare(TEST_RUNTIME, 4_102_444_800_000, prose_request("Say it.")).unwrap();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use super::{
|
|||
DecisionOpportunity, EntityId, KernelError, Mismatch, RefKind, Statement, SubjectId,
|
||||
SubjectKind, Target, WorldPatch, WorldSnapshot,
|
||||
};
|
||||
use codex_connector::{CodexInputItem, CodexToolDefinition};
|
||||
use model_connector::{InputItem, ToolDefinition};
|
||||
use serde_json::Value;
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ pub enum TableError {
|
|||
/// `PATCH_TOOLS`; which names a particular agent gets is policy, and policy
|
||||
/// belongs to the caller — `PLAY_TOOLS` is Dungeon's, pinned in Cut 8, not
|
||||
/// this module's.
|
||||
pub fn authoring_tools(names: &[&str]) -> Result<Vec<CodexToolDefinition>, TableError> {
|
||||
pub fn authoring_tools(names: &[&str]) -> Result<Vec<ToolDefinition>, TableError> {
|
||||
let catalog = patch::patch_tools();
|
||||
names
|
||||
.iter()
|
||||
|
|
@ -220,7 +220,7 @@ fn subject_opportunity<'a>(
|
|||
/// turn; that is the controller lane's own vocabulary, and
|
||||
/// `decode_actor_call` has no arm for either, so offering them here would
|
||||
/// hand the play agent a tool `decode_actor_call` always refuses (PA.f55).
|
||||
pub fn actor_tools(prefix: &str, snapshot: &WorldSnapshot, subject: SubjectId) -> Vec<CodexToolDefinition> {
|
||||
pub fn actor_tools(prefix: &str, snapshot: &WorldSnapshot, subject: SubjectId) -> Vec<ToolDefinition> {
|
||||
match subject_opportunity(snapshot, subject) {
|
||||
Some((_, granted)) => controllers::affordance_tools(prefix, &granted),
|
||||
None => Vec::new(),
|
||||
|
|
@ -1038,8 +1038,8 @@ impl InferenceRequest {
|
|||
round: usize,
|
||||
model: &str,
|
||||
instructions: &str,
|
||||
input: Vec<CodexInputItem>,
|
||||
tools: Vec<CodexToolDefinition>,
|
||||
input: Vec<InputItem>,
|
||||
tools: Vec<ToolDefinition>,
|
||||
max_output_tokens: u32,
|
||||
) -> Result<InferenceRequest, ControllerError> {
|
||||
tool_request(
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
//! own vocabulary. Both spell a property the same way because both spell it
|
||||
//! here. Nothing in this module reads world state, a snapshot, or a config.
|
||||
|
||||
use codex_connector::CodexToolDefinition;
|
||||
use model_connector::ToolDefinition;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
pub(super) fn tool(name: &str, description: &str, schema: Value) -> CodexToolDefinition {
|
||||
CodexToolDefinition {
|
||||
pub(super) fn tool(name: &str, description: &str, schema: Value) -> ToolDefinition {
|
||||
ToolDefinition {
|
||||
name: name.into(),
|
||||
description: description.into(),
|
||||
parameters_json: serde_json::to_string(&schema)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use crate::controllers::{
|
|||
};
|
||||
use async_trait::async_trait;
|
||||
use chrono::Utc;
|
||||
use codex_connector::CodexProviderRequest;
|
||||
use model_connector::ProviderRequest;
|
||||
use cultcache_rs::{CacheBackingStore, CultCacheEnvelope, OwnedRedbMessagePackBackingStore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
|
@ -197,10 +197,10 @@ fn hex(digest: &[u8]) -> String {
|
|||
/// id from the world it ran in, so keying on them would tie a recorded run to
|
||||
/// one world's random identity. Everything else the provider is sent
|
||||
/// (model, instructions, input, tools, shape) is in the digest.
|
||||
fn content_digest(request: &CodexProviderRequest) -> Result<String, InferenceFault> {
|
||||
fn content_digest(request: &ProviderRequest) -> Result<String, InferenceFault> {
|
||||
// Exhaustive on purpose: a field added upstream must be placed in the key
|
||||
// or left out here by name before this compiles.
|
||||
let CodexProviderRequest {
|
||||
let ProviderRequest {
|
||||
schema_id,
|
||||
request_id: _request_id, // names the call, not what it asks
|
||||
conversation_id: _conversation_id, // names the call, not what it asks
|
||||
|
|
@ -208,16 +208,12 @@ fn content_digest(request: &CodexProviderRequest) -> Result<String, InferenceFau
|
|||
instructions,
|
||||
input,
|
||||
reasoning_effort,
|
||||
reasoning_summary,
|
||||
service_tier,
|
||||
output_format_name,
|
||||
previous_response_id,
|
||||
cache_retention,
|
||||
tools,
|
||||
tool_choice,
|
||||
parallel_tool_calls,
|
||||
output_schema_json,
|
||||
max_output_tokens,
|
||||
prompt_cache_key,
|
||||
} = request;
|
||||
let bytes = rmp_serde::to_vec(&(
|
||||
schema_id,
|
||||
|
|
@ -225,16 +221,12 @@ fn content_digest(request: &CodexProviderRequest) -> Result<String, InferenceFau
|
|||
instructions,
|
||||
input,
|
||||
reasoning_effort,
|
||||
reasoning_summary,
|
||||
service_tier,
|
||||
output_format_name,
|
||||
previous_response_id,
|
||||
cache_retention,
|
||||
tools,
|
||||
tool_choice,
|
||||
parallel_tool_calls,
|
||||
output_schema_json,
|
||||
max_output_tokens,
|
||||
prompt_cache_key,
|
||||
))
|
||||
.map_err(|_| InferenceFault::new("a provider request could not be measured"))?;
|
||||
Ok(hex(&Sha256::digest(bytes)))
|
||||
|
|
@ -601,14 +593,10 @@ impl RecordingInferencePort {
|
|||
}
|
||||
|
||||
/// The most this request can cost: its serialized bytes plus its output
|
||||
/// allowance. A request with no output allowance has no bound, so it
|
||||
/// cannot be held under a cap.
|
||||
/// allowance. The v4 request type cannot omit the allowance, so every
|
||||
/// request has a bound.
|
||||
fn bound(request: &PreparedInference) -> Result<u64, InferenceFault> {
|
||||
let allowance = request
|
||||
.invocation
|
||||
.request
|
||||
.max_output_tokens
|
||||
.ok_or_else(InferenceFault::budget_exhausted)?;
|
||||
let allowance = request.invocation.request.max_output_tokens;
|
||||
let payload = serde_json::to_vec(&request.invocation.request)
|
||||
.map_err(|_| InferenceFault::new("a provider request could not be measured"))?;
|
||||
Ok((payload.len() as u64).saturating_add(u64::from(allowance)))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::CommandId;
|
|||
use crate::controllers::{
|
||||
InferenceFaultClass, InferenceFaultDisposition, RequestShape, tool_request,
|
||||
};
|
||||
use codex_connector::{CodexInputItem, CodexToolDefinition};
|
||||
use model_connector::{InputItem, ToolDefinition};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
const MODEL: &str = "hosted/test-model";
|
||||
|
|
@ -73,10 +73,10 @@ fn request_for(command: CommandId, prompt: &str, max_output_tokens: u32) -> Infe
|
|||
InferencePurpose::Persona,
|
||||
MODEL,
|
||||
"Respond only in prose.",
|
||||
vec![CodexInputItem::UserText {
|
||||
vec![InputItem::UserText {
|
||||
text: prompt.into(),
|
||||
}],
|
||||
Vec::<CodexToolDefinition>::new(),
|
||||
Vec::<ToolDefinition>::new(),
|
||||
RequestShape {
|
||||
max_output_tokens,
|
||||
parallel_tool_calls: false,
|
||||
|
|
@ -100,13 +100,7 @@ fn bound_of(prepared: &PreparedInference) -> u64 {
|
|||
.expect("a provider request serializes")
|
||||
.len() as u64;
|
||||
payload
|
||||
+ u64::from(
|
||||
prepared
|
||||
.invocation
|
||||
.request
|
||||
.max_output_tokens
|
||||
.expect("an allowance"),
|
||||
)
|
||||
+ u64::from(prepared.invocation.request.max_output_tokens)
|
||||
}
|
||||
|
||||
fn reply(text: &str, receipt: &str) -> InferenceOutput {
|
||||
|
|
@ -276,17 +270,6 @@ async fn cap_refuses_before_the_provider_is_called() {
|
|||
.await
|
||||
.expect("a call that fits the cap is made");
|
||||
assert_eq!(inner.calls(), 1);
|
||||
|
||||
// A request with no output allowance has no bound and is refused.
|
||||
let mut open_ended = prepared_for("open ended", 1_200);
|
||||
open_ended.invocation.request.max_output_tokens = None;
|
||||
let unbounded = recording(&inner, &store, "run-open", u64::MAX);
|
||||
let fault = unbounded
|
||||
.infer(open_ended)
|
||||
.await
|
||||
.expect_err("no allowance, no bound");
|
||||
assert_eq!(fault.class(), InferenceFaultClass::BudgetExhausted);
|
||||
assert_eq!(inner.calls(), 1);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
@ -969,20 +952,20 @@ async fn usage_one_token_over_the_bound_faults_and_stores_no_record() {
|
|||
#[test]
|
||||
fn the_replay_key_covers_what_the_request_asks_and_not_what_names_it() {
|
||||
let base = prepared_for("key", 1_200).invocation.request.clone();
|
||||
let digest = |edit: &dyn Fn(&mut CodexProviderRequest)| {
|
||||
let digest = |edit: &dyn Fn(&mut ProviderRequest)| {
|
||||
let mut request = base.clone();
|
||||
edit(&mut request);
|
||||
content_digest(&request).unwrap()
|
||||
};
|
||||
let same = digest(&|_| {});
|
||||
assert_eq!(same, content_digest(&base).unwrap());
|
||||
let changes: Vec<(&str, Box<dyn Fn(&mut CodexProviderRequest)>)> = vec![
|
||||
let changes: Vec<(&str, Box<dyn Fn(&mut ProviderRequest)>)> = vec![
|
||||
("model", Box::new(|r| r.model.push('x'))),
|
||||
("instructions", Box::new(|r| r.instructions.push('x'))),
|
||||
(
|
||||
"tools",
|
||||
Box::new(|r| {
|
||||
r.tools.push(CodexToolDefinition {
|
||||
r.tools.push(ToolDefinition {
|
||||
name: "t".into(),
|
||||
description: "d".into(),
|
||||
parameters_json: "{}".into(),
|
||||
|
|
@ -991,57 +974,41 @@ fn the_replay_key_covers_what_the_request_asks_and_not_what_names_it() {
|
|||
),
|
||||
(
|
||||
"input",
|
||||
Box::new(|r| r.input.push(CodexInputItem::UserText { text: "x".into() })),
|
||||
Box::new(|r| r.input.push(InputItem::UserText { text: "x".into() })),
|
||||
),
|
||||
(
|
||||
"max_output_tokens",
|
||||
Box::new(|r| r.max_output_tokens = Some(1)),
|
||||
Box::new(|r| r.max_output_tokens = 1),
|
||||
),
|
||||
(
|
||||
"reasoning_effort",
|
||||
Box::new(|r| r.reasoning_effort = Some("low".into())),
|
||||
),
|
||||
(
|
||||
"service_tier",
|
||||
Box::new(|r| r.service_tier = Some("flex".into())),
|
||||
Box::new(|r| r.reasoning_effort = Some(model_connector::ReasoningEffort::High)),
|
||||
),
|
||||
(
|
||||
"output_schema_json",
|
||||
Box::new(|r| r.output_schema_json = Some("{}".into())),
|
||||
),
|
||||
(
|
||||
"previous_response_id",
|
||||
Box::new(|r| r.previous_response_id = Some("p".into())),
|
||||
),
|
||||
(
|
||||
"parallel_tool_calls",
|
||||
Box::new(|r| r.parallel_tool_calls = !r.parallel_tool_calls),
|
||||
),
|
||||
("schema_id", Box::new(|r| r.schema_id.push_str(".v2"))),
|
||||
(
|
||||
"reasoning_summary",
|
||||
Box::new(|r| r.reasoning_summary = Some("auto".into())),
|
||||
),
|
||||
(
|
||||
"output_format_name",
|
||||
Box::new(|r| r.output_format_name = Some("persona_reply".into())),
|
||||
),
|
||||
(
|
||||
"tool_choice",
|
||||
Box::new(|r| {
|
||||
r.tool_choice = match r.tool_choice {
|
||||
codex_connector::CodexToolChoice::Auto => {
|
||||
codex_connector::CodexToolChoice::Required
|
||||
model_connector::ToolChoice::Auto => {
|
||||
model_connector::ToolChoice::Required
|
||||
}
|
||||
codex_connector::CodexToolChoice::Required => {
|
||||
codex_connector::CodexToolChoice::Auto
|
||||
model_connector::ToolChoice::Required => {
|
||||
model_connector::ToolChoice::Auto
|
||||
}
|
||||
}
|
||||
}),
|
||||
),
|
||||
(
|
||||
"prompt_cache_key",
|
||||
Box::new(|r| r.prompt_cache_key = Some("ghostlight-persona-1".into())),
|
||||
"cache_retention",
|
||||
Box::new(|r| r.cache_retention = Some(model_connector::CacheRetention::Short)),
|
||||
),
|
||||
];
|
||||
for (field, change) in changes {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ impl InferencePort for ScriptedPort {
|
|||
let sequence = self.calls.fetch_add(1, Ordering::SeqCst);
|
||||
let wire = &request.invocation.request;
|
||||
let bound = serde_json::to_vec(wire).unwrap().len() as u64
|
||||
+ u64::from(wire.max_output_tokens.unwrap());
|
||||
+ u64::from(wire.max_output_tokens);
|
||||
self.bounds.lock().unwrap().push(bound);
|
||||
if let Some(fault) = self.faults.lock().unwrap().pop_front() {
|
||||
return Err(fault);
|
||||
|
|
|
|||
Loading…
Reference in a new issue