Repository navigation
Expand file tree
/
Copy pathCargo.toml
More file actions
221 lines (201 loc) · 10 KB
/
Copy pathCargo.toml
File metadata and controls
221 lines (201 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
[package]
name = "codetrial"
version = "0.1.0"
edition = "2024"
rust-version = "1.98"
license = "MIT"
[lints]
workspace = true
# The gate already runs `cargo clippy -- -D warnings`, and an editor running a
# bare `cargo clippy` used to disagree with it: warnings there, a red gate here,
# and the difference only visible after a push. Stating the level in the
# manifest makes every caller agree, the gate included.
#
# `unsafe_code` is forbidden rather than denied. There is none in this crate --
# every match for the word is a Content-Security-Policy string or a comment --
# and `forbid` is what stops a local `#[allow]` from quietly reintroducing it.
[workspace.lints.rust]
unsafe_code = "forbid"
# A `pub` item nothing outside the crate can name is a promise nobody can use.
unreachable_pub = "deny"
unused_lifetimes = "deny"
unused_must_use = "deny"
unfulfilled_lint_expectations = "deny"
# The four restriction lints below had no match outside test code when they
# were added, so denying them costs nothing and keeps it that way: a request
# or a data packet that reaches an `unwrap` or a `panic!` takes the interview
# down with it, and `dbg!` and `todo!` are leftovers. A startup invariant
# says why with `expect`, which stays allowed. Test code is exempt through
# clippy.toml for unit tests and a crate attribute in each tests/*.rs.
[workspace.lints.clippy]
all = "deny"
dbg_macro = "deny"
panic = "deny"
todo = "deny"
unwrap_used = "deny"
# `missing_debug_implementations` stays off on purpose: a type holding a
# credential has no `Debug` so that nothing can log it, and its doc comment says
# so. The lint would ask for exactly the derive that policy forbids.
# A suppression names the lint it silences and says why, and `expect` is the
# form that tells on itself once the lint stops firing.
allow_attributes = "deny"
allow_attributes_without_reason = "deny"
# Ownership that reads at the call site.
clone_on_ref_ptr = "deny"
redundant_clone = "deny"
string_add = "deny"
fn_params_excessive_bools = "deny"
# Signatures that promise nothing they do not use.
unnecessary_wraps = "deny"
panic_in_result_fn = "deny"
wildcard_imports = "deny"
semicolon_if_nothing_returned = "deny"
cast_sign_loss = "deny"
# A guard held across an await blocks the executor; a dropped future never runs
# and a forgotten guard never releases what it holds.
await_holding_lock = "deny"
let_underscore_future = "deny"
mem_forget = "deny"
[workspace.lints.rustdoc]
broken_intra_doc_links = "deny"
private_intra_doc_links = "deny"
[dependencies]
chrono = { version = "0.4.45", default-features = false, features = ["std"] }
axum = { version = "0.8.9", default-features = false, features = ["http1", "json", "original-uri", "query", "tokio"] }
base64 = "0.23.1"
futures-util = { version = "0.3.34", default-features = false, features = ["sink", "std"] }
# reqwest's proxy matcher and connectors, so the Gemini Live socket follows
# the same HTTPS_PROXY and NO_PROXY rules as every HTTP call. reqwest already
# builds these features.
hyper-util = { version = "0.1.21", default-features = false, features = ["client-legacy", "client-proxy", "tokio"] }
jpeg-encoder = "0.7.1"
livekit = { version = "0.10.0", features = ["rustls-tls-webpki-roots"] }
ring = "0.17.14"
# Mozilla's roots compiled in, one rustls configuration shared by this HTTP
# client and the Gemini WebSocket, so the binary verifies every host it talks
# to without asking the machine for a CA store: docs/install.md promises
# nothing is required beyond the binary. The trade is that a CA an
# organization installs locally, a TLS-inspecting proxy's for one, is not
# trusted.
#
# Direct dependencies track their latest release so Dependabot can deliver
# security fixes. That builds two majors of reqwest (LiveKit is on 0.12) and of
# tower-http (reqwest 0.13 is on 0.6); they collapse when LiveKit and reqwest
# move, and pinning back here would also block their security updates.
reqwest = { version = "0.13.5", default-features = false, features = ["json", "form", "query", "rustls-no-provider"] }
rustls = { version = "0.23.46", default-features = false, features = ["ring", "std", "tls12"] }
webpki-roots = "1.0.10"
rusqlite = { version = "0.41.1", default-features = false, features = ["bundled"] }
rust-embed = { version = "8.13.0", features = ["include-exclude"] }
serde_json = "1.0.154"
serde = { version = "1.0.229", features = ["derive"] }
tokio = { version = "1.54.1", features = ["fs", "macros", "net", "rt-multi-thread", "sync", "time"] }
tokio-tungstenite = { version = "0.30.0", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] }
tokio-util = "0.7.20"
tower-http = { version = "0.7.1", default-features = false, features = ["compression-gzip"] }
tower-service = "0.3.3"
tree-sitter = "=0.27.1"
tree-sitter-c = "=0.24.2"
tree-sitter-cpp = "=0.23.4"
tree-sitter-java = "=0.23.5"
tree-sitter-javascript = "=0.25.0"
tree-sitter-python = "=0.25.0"
# Change keys gives the file that replaces the config an owner-only DACL, and
# `unsafe_code` is forbidden here, so the Windows security calls come through
# this crate's safe wrappers.
[target.'cfg(windows)'.dependencies]
windows-permissions = "0.2.4"
# Only the tests need these. `livekit-protocol` unifies with LiveKit; HMAC and
# SHA-256 remain independent fixture implementations.
#
# `livekit-protocol` buys the generated `Deserialize`, which decodes an Egress request body exactly
# as the server does, so a hand-written body is checked against the real message
# instead of against a list of field names copied out of it.
[dev-dependencies]
# Independent implementations verify production signatures and digest fixtures.
hmac = "0.13.0"
sha2 = "0.11.1"
# Borrowed socket inspection for real loopback transport fixtures.
socket2 = "0.6.5"
livekit-protocol = "0.8.2"
# LiveKit's transport, reached directly to check the vendored proxy path.
livekit-net = "0.1.4"
# The paused clock, so the Live socket's keepalive and idle limits are tested
# at their real values instead of waiting them out; signals, so the serving
# fixture can treat TERM as a stop request.
tokio = { version = "1.54.1", features = ["signal", "test-util"] }
# The continuity fixture installs a logger to read the SDK's queue-overflow
# line; the SDK already depends on this crate.
log = "0.4.34"
# scripts/hook-check holds every `cargo build` to the git hooks being in
# effect; its build.rs says why it is a member of its own. `vendor/` holds path
# dependencies, not members, and `desktop/` is a crate of its own with its own
# lockfile that the root's builds must not need WebKitGTK to compile.
[workspace]
members = ["scripts/hook-check"]
default-members = [".", "scripts/hook-check"]
exclude = ["vendor", "desktop"]
# Release archives distribute the executable, not a debugging target. Cargo
# already omits debug information in this profile; omit linker symbols too.
#
# The trade is deliberate and worth stating, because it is not free: a panic
# backtrace out of a release archive is now hex addresses with no function
# names. `strip = "debuginfo"` would keep the symbol table, but debuginfo is
# already absent here, so it would buy nothing. Anyone chasing a crash builds
# without this or reproduces against a debug build.
[profile.release]
strip = "symbols"
# Dependencies are optimized even in a dev build, because `make web` runs one
# and the agent's realtime path goes through them: the JPEG codec, the LiveKit
# SDK, TLS, protobuf. Unoptimized, one 720p frame took 138ms to encode against
# 6.8ms optimized, and that frame is encoded once a second while Gemini is
# mid-conversation.
#
# `debug-assertions` and `overflow-checks` off as well, because opt-level alone
# left most of the gap: 150ms, then 109ms with opt-level, then 54ms with these.
# The cost is that a dependency's own internal assertions stop firing here. That
# is an acceptable trade for third-party code this crate does not edit, and it
# does not reach this crate -- the override is `package."*"`, so codetrial keeps
# the dev defaults, assertions included.
#
# 54ms is still eight times the release figure, and chasing the rest (opt-level
# 3, codegen-units) costs a full dependency rebuild for less than this bought.
# It stops mattering at that point regardless: the encode runs on a blocking
# thread now, so what is left no longer stalls the executor.
#
# Only the dependencies, so a rebuild after an edit costs what it did before.
# They are built once and cached; the price is a single slower first build.
[profile.dev.package."*"]
opt-level = 2
debug-assertions = false
overflow-checks = false
# `cargo test` builds under the test profile, which does not inherit the package
# override above, so the same line is needed here or the suite measures an
# unoptimized codec that no deployment runs.
[profile.test.package."*"]
opt-level = 2
debug-assertions = false
overflow-checks = false
# Exempted from the two overrides above, which are about codec speed and have
# nothing to say about a crate that only reads files. `rust-embed` splits on
# `debug_assertions` to decide whether assets live in `.rodata` or are read from
# disk, and it splits twice: once in the derived code, which sees this crate's
# setting, and once in the library, which sees its own. Turning it off for
# dependencies alone makes the two disagree, and the build fails on a
# `Filenames::Dynamic` the library compiled away.
#
# Forcing agreement here rather than with the `debug-embed` feature, which is
# the other way to make both sides pick the same branch. That way costs 38 MB of
# `__const` in every one of the eleven test binaries, measured, and again on
# every cargo-mutants rebuild, which is the exact link time the profile settings
# above exist to buy back. Release builds embed either way: `debug_assertions`
# is off there, and no feature is involved.
[profile.dev.package.rust-embed]
debug-assertions = true
[profile.test.package.rust-embed]
debug-assertions = true
# Move both WebSocket callers to one transport with patched certificate roots.
# Each vendor README records the upstream condition for removing its patch.
[patch.crates-io]
livekit-net = { path = "vendor/livekit-net" }
tokio-tungstenite = { path = "vendor/tokio-tungstenite" }