From 98e550cb75c98c4c77b32e8c80f5a3d591a65611 Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 03:24:48 +0100 Subject: [PATCH 01/10] fix(external-grants): own atomic profile admission and append agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- .../src/api/client_v0/external_grants.rs | 68 ++++++++++++++++++- .../external-grant-admission-atomicity.json | 1 + 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 release-notes/external-grant-admission-atomicity.json diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants.rs b/crates/fractal-api-core/src/api/client_v0/external_grants.rs index 1b0378cd726..f0b9ecbea6b 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants.rs @@ -51,6 +51,10 @@ impl Profile { } fn assistant_profile(source: &Value) -> Result<(), ApiError> { + #[cfg(test)] + if tests::SERVICE_PROFILE.get() && Profile::stored(source)? == Profile::Service { + return Ok(()); + } Profile::stored(source)?.issuable() } @@ -65,7 +69,7 @@ fn digest_only(source: &Value) -> Result<(), ApiError> { } // Issuance-only scan: authentication retains its existing indexed lookup and reads. -// TRANSITIONS serializes completion; several grants of the same profile are allowed. +// append owns the admission lock; several grants of the same profile are allowed. fn admit_profile(state: &AppState, source: &Value) -> Result<(), ApiError> { let profile = Profile::stored(source)?; let principal = principal(source)?; @@ -111,6 +115,10 @@ pub const SCOPES: &[&str] = &[ // against concurrent writers in the authoritative store. pub static TRANSITIONS: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(()); +// Synchronous because append never awaits. Callers may already hold TRANSITIONS: +// always acquire that outer lifecycle lock first, never from inside admission. +static ADMISSIONS: std::sync::Mutex<()> = std::sync::Mutex::new(()); + pub fn owning_person(state: &AppState) -> Result<&str, ApiError> { state.owning_person.as_deref() .filter(|person| person.starts_with("person/") && person.matches('/').count() == 1 && person.len() > 7) @@ -140,6 +148,13 @@ pub fn latest(state: &AppState, subject: &str, kind: &str) -> Result) -> Result { + // Subject fences do not serialize grants on independent subjects for one + // principal. Keep the cross-subject scan and authoritative append indivisible. + let _admission = if kind == GRANTED { + Some(ADMISSIONS.lock().map_err(|_| ApiError::internal("external grant admission lock poisoned"))?) + } else { + None + }; if matches!(kind, BEGUN | GRANTED | POLICY | REVOKED) { assistant_profile(&value)?; digest_only(&value)?; @@ -277,6 +292,57 @@ pub fn authorize_route(session: &ClientSession, request: &Request) -> Resu mod tests { use super::*; + // Only the current fixture thread can exercise the reserved profile through + // the real mutation/session boundary. Production issuable() stays closed. + thread_local! { + pub(super) static SERVICE_PROFILE: std::cell::Cell = const { std::cell::Cell::new(false) }; + } + + fn concurrent_grants(profiles: [&str; 2]) -> (usize, usize) { + let root = tempfile::tempdir().unwrap(); + let mut state = crate::api::tests_shared::state(root.path()); + state.owning_person = Some("person/owner".into()); + let barrier = std::sync::Barrier::new(2); + let results = std::thread::scope(|scope| { + let handles = profiles.into_iter().enumerate().map(|(index, profile)| { + let state = &state; + let barrier = &barrier; + scope.spawn(move || { + SERVICE_PROFILE.set(true); + let id = if index == 0 { "111111111111111111111111" } else { "222222222222222222222222" }; + let source = json!({"profile":profile,"grant_id":id,"principal":PRINCIPAL, + "issuer":"person/owner","session_actor":format!("{PRINCIPAL}/session/{id}"), + "expires_at_unix_ms":u64::MAX,"minimal_read_mode":"approval-once", + "disclosure_consent":true,"scopes":["read.assistant.summary"], + "credential_hash":credential_digest(id)}); + let subject = subject(id).unwrap(); + let begun = append(state, subject.clone(), BEGUN, "person/owner", source.clone(), None).unwrap(); + barrier.wait(); + append(state, subject, GRANTED, "person/owner", source, Some(&begun)) + }) + }).collect::>(); + handles.into_iter().map(|handle| handle.join().unwrap()).collect::>() + }); + let admitted = results.iter().filter(|result| result.is_ok()).count(); + let usable = std::thread::spawn(move || { + SERVICE_PROFILE.set(true); + results.iter().filter_map(|result| result.as_ref().ok()) + .filter(|grant| session(&state, grant, "http").is_ok()).count() + }).join().unwrap(); + (admitted, usable) + } + + #[test] + fn concurrent_opposite_profiles_have_exactly_one_usable_grant() { + assert_eq!(concurrent_grants(["assistant", "service"]), (1, 1)); + } + + #[test] + fn concurrent_same_profile_grants_remain_usable() { + assert_eq!(concurrent_grants(["assistant", "assistant"]), (2, 2)); + assert_eq!(concurrent_grants(["service", "service"]), (2, 2)); + } + #[test] fn persisted_active_profiles_are_checked_at_grant_admission() { let root = tempfile::tempdir().unwrap(); diff --git a/release-notes/external-grant-admission-atomicity.json b/release-notes/external-grant-admission-atomicity.json new file mode 100644 index 00000000000..d2ec8c4255d --- /dev/null +++ b/release-notes/external-grant-admission-atomicity.json @@ -0,0 +1 @@ +{"version":1,"summary":"Make external-grant profile admission and append one owned critical section","replay":{"status":"none","detail":"Existing grant claims retain their meanings; no migration or replay change."},"schema":{"status":"none","detail":"No schema or registry change."},"rules":{"status":"none","detail":"The existing cross-profile admission rule is now atomic across independent grant subjects. Multiple same-profile grants remain allowed; service issuance stays disabled."},"compatibility":{"status":"none","detail":"Existing lifecycle and approval-once TRANSITIONS critical sections remain unchanged. Admission uses an inner synchronous lock and never awaits or acquires the outer lifecycle lock."},"downtime":{"status":"none","detail":"No deployment or activation change."},"manual":{"status":"none","detail":"No operator action required."},"recovery":{"status":"none","detail":"Existing expiry and append-only revocation remain unchanged; no recovery action required."},"commits":[]} From 5ec504caa58d7dc20738e0d4167490005e4a8d84 Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 06:20:02 +0100 Subject: [PATCH 02/10] perf(external-grants): index and prefilter principal admission history agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- .../src/api/client_v0/external_grants.rs | 81 +++- crates/fractal-store/src/store.rs | 5 +- crates/fractal-store/src/store/runtime.rs | 128 ++++++ crates/fractal/tests/daemon_cost.rs | 2 + .../tests/daemon_cost/assistant_admission.rs | 395 ++++++++++++++++++ docs/st3/compatibility.md | 33 ++ docs/st3/large-value-sites.json | 272 ++++++------ docs/st3/large-values.md | 20 + .../external-grant-admission-index.json | 12 + 9 files changed, 807 insertions(+), 141 deletions(-) create mode 100644 crates/fractal/tests/daemon_cost/assistant_admission.rs create mode 100644 release-notes/external-grant-admission-index.json diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants.rs b/crates/fractal-api-core/src/api/client_v0/external_grants.rs index f0b9ecbea6b..f9c4bb13d62 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants.rs @@ -70,15 +70,30 @@ fn digest_only(source: &Value) -> Result<(), ApiError> { // Issuance-only scan: authentication retains its existing indexed lookup and reads. // append owns the admission lock; several grants of the same profile are allowed. +// Filter revoked/expired history before loading claim bodies into Rust. Expiry +// uses the latest policy, not the original grant. Keep malformed missing fields +// in the result so the existing validation below still reports them. +const ADMISSION_QUERY: &str = + "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 + AND (?5 IS NULL OR NOT EXISTS (SELECT 1 FROM claims AS revoked WHERE revoked.subject=claims.subject AND revoked.kind=?3)) + AND (?5 IS NULL OR COALESCE( + (SELECT CASE WHEN json_type(policy.body,'$.fields') IS NULL THEN 1 ELSE + COALESCE(json_type(policy.body,'$.fields.expires_at_unix_ms')='integer' + AND json_extract(policy.body,'$.fields.expires_at_unix_ms')>?5,0) END + FROM claims AS policy WHERE policy.subject=claims.subject AND policy.kind=?4 ORDER BY policy.store_index DESC LIMIT 1), + CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE + COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' + AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END))"; fn admit_profile(state: &AppState, source: &Value) -> Result<(), ApiError> { let profile = Profile::stored(source)?; let principal = principal(source)?; + // Without a valid owner the old scan must still surface its configuration + // error before examining expiry; do not prefilter those rows. + let expiry_cut = owning_person(state).ok().map(|_| client_now_ms() as u64); let ids = { let connection = state.store.readers.get(); - let mut query = connection.prepare( - "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2" - ).map_err(ApiError::internal)?; - query.query_map(rusqlite::params![GRANTED, principal], |row| row.get::<_, String>(0)) + let mut query = connection.prepare(/* sqlite-large-value: allow-for-now lv-h99f1a302c7b1 owner=fractal_api_core::api::client_v0::external_grants TODO=trace-statement-and-value-representation */ ADMISSION_QUERY).map_err(ApiError::internal)?; + query.query_map(rusqlite::params![GRANTED, principal, REVOKED, POLICY, expiry_cut], |row| row.get::<_, String>(0)) .map_err(ApiError::internal)?.collect::, _>>().map_err(ApiError::internal)? }; for id in ids { @@ -332,6 +347,54 @@ mod tests { (admitted, usable) } + #[test] + fn admission_sql_filters_only_inactive_effective_policies() { + let connection = rusqlite::Connection::open_in_memory().unwrap(); + connection.execute_batch( + "CREATE TABLE claims(id TEXT,subject TEXT,kind TEXT,body TEXT,store_index INTEGER PRIMARY KEY); + CREATE INDEX principal_scan ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')); + CREATE INDEX subject_kind ON claims(subject,kind,store_index);" + ).unwrap(); + let fixtures = [ + ("expired", json!({"fields":{"expires_at_unix_ms":99}}), None, false), + ("live", json!({"fields":{"expires_at_unix_ms":101}}), None, true), + ("boundary", json!({"fields":{"expires_at_unix_ms":100}}), None, false), + ("max", json!({"fields":{"expires_at_unix_ms":u64::MAX}}), None, true), + ("negative", json!({"fields":{"expires_at_unix_ms":-1}}), None, false), + ("string", json!({"fields":{"expires_at_unix_ms":"101"}}), None, false), + ("float", json!({"fields":{"expires_at_unix_ms":101.0}}), None, false), + ("absent-expiry", json!({"fields":{}}), None, false), + // Missing fields must still reach fields() and its existing error. + ("absent-fields", json!({}), None, true), + ("renewed", json!({"fields":{"expires_at_unix_ms":99}}), + Some(json!({"fields":{"expires_at_unix_ms":101}})), true), + ("shortened", json!({"fields":{"expires_at_unix_ms":101}}), + Some(json!({"fields":{"expires_at_unix_ms":99}})), false), + ("invalid-policy", json!({"fields":{"expires_at_unix_ms":99}}), + Some(json!({})), true), + ]; + let mut expected = Vec::new(); + for (id, grant, policy, included) in fixtures { + connection.execute("INSERT INTO claims(id,subject,kind,body) VALUES(?1,?1,?2,?3)", + rusqlite::params![id, GRANTED, grant.to_string()]).unwrap(); + if let Some(policy) = policy { + connection.execute("INSERT INTO claims(id,subject,kind,body) VALUES(?1,?2,?3,?4)", + rusqlite::params![format!("{id}-policy"), id, POLICY, policy.to_string()]).unwrap(); + } + if included { expected.push(id.to_owned()); } + } + let mut found = connection.prepare(ADMISSION_QUERY).unwrap() + .query_map(rusqlite::params![GRANTED, PRINCIPAL, REVOKED, POLICY, 100_u64], + |row| row.get::<_, String>(0)).unwrap().collect::, _>>().unwrap(); + found.sort(); + expected.sort(); + assert_eq!(found, expected); + let unfiltered = connection.prepare(ADMISSION_QUERY).unwrap() + .query_map(rusqlite::params![GRANTED, PRINCIPAL, REVOKED, POLICY, Option::::None], + |row| row.get::<_, String>(0)).unwrap().collect::, _>>().unwrap(); + assert_eq!(unfiltered.len(), 12, "invalid owner configuration must not hide validation errors"); + } + #[test] fn concurrent_opposite_profiles_have_exactly_one_usable_grant() { assert_eq!(concurrent_grants(["assistant", "service"]), (1, 1)); @@ -368,8 +431,16 @@ mod tests { state.store.append_claim(&ClaimInput { subject: service_subject, kind: REVOKED.into(), actor: Some("person/owner".into()), fields: BTreeMap::new(), evidence: vec![grant.id.clone()], - expected_subject: Some(Some(grant.id)), idempotency_key: None, + expected_subject: Some(Some(grant.id.clone())), idempotency_key: None, }).unwrap(); + let candidates = { + let connection = state.store.readers.get(); + connection.prepare(ADMISSION_QUERY).unwrap() + .query_map(rusqlite::params![GRANTED, PRINCIPAL, REVOKED, POLICY, client_now_ms() as u64], |row| row.get::<_, String>(0)) + .unwrap().collect::, _>>().unwrap() + }; + assert_eq!(candidates.len(), 2); + assert!(!candidates.contains(&grant.id), "revoked history must not reach the admission loop"); assert!(append(&state, next, GRANTED, "person/owner", source, None).is_ok()); } diff --git a/crates/fractal-store/src/store.rs b/crates/fractal-store/src/store.rs index 17b56ee1577..221793024b0 100644 --- a/crates/fractal-store/src/store.rs +++ b/crates/fractal-store/src/store.rs @@ -780,7 +780,7 @@ pub struct AgentWorkQueue { /// Fractal's projection tables, and the indexes its folds read the claim log through. The /// graph creates its own tables first; see `smallclaims::store::SCHEMA`. -const SCHEMA: &str = /* sqlite-large-value: allow-for-now lv-h22c8c670811c owner=fractal_store::store TODO=chunk-or-reference-variable-columns */ r#" +const SCHEMA: &str = /* sqlite-large-value: allow-for-now lv-hb9696ca837f7 owner=fractal_store::store TODO=chunk-or-reference-variable-columns */ r#" -- An unmanaged member's staging check needs tagged claims, not its runtime history. CREATE INDEX IF NOT EXISTS claims_owned_set_subject_index ON claims(subject) WHERE json_extract(body,'$.owned_set') IS NOT NULL; @@ -930,6 +930,9 @@ WHERE kind='custom.client.pairing-completed'; CREATE INDEX IF NOT EXISTS claims_assistant_v1_credential_index ON claims(json_extract(body, '$.fields.credential_hash'), store_index) WHERE kind='custom.client.assistant.v1.granted'; +-- Match parameterized admission by kind and effective principal, including legacy ChatGPT grants. +CREATE INDEX IF NOT EXISTS claims_assistant_v1_principal_index +ON claims(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')); -- A runtime incarnation's claims about a subject by acceptance time, so when a session began -- and last changed are two seeks instead of a read of every claim the subject has. The -- expression is INCARNATION_OF_CLAIM, which queries repeat so the planner uses this index. diff --git a/crates/fractal-store/src/store/runtime.rs b/crates/fractal-store/src/store/runtime.rs index c25edbe01f1..95bfe580810 100644 --- a/crates/fractal-store/src/store/runtime.rs +++ b/crates/fractal-store/src/store/runtime.rs @@ -830,6 +830,134 @@ impl FractalRuntime { mod schema_install_tests { use super::*; + #[test] + fn assistant_principal_index_installs_on_existing_claims_and_reopens_without_ddl() { + const GRANTED: &str = "custom.client.assistant.v1.granted"; + const REVOKED: &str = "custom.client.assistant.v1.revoked"; + const POLICY: &str = "custom.client.assistant.v1.policy"; + const INDEX: &str = "claims_assistant_v1_principal_index"; + const SELECT: &str = "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2"; + const ACTIVE: &str = + "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 + AND (?5 IS NULL OR NOT EXISTS (SELECT 1 FROM claims AS revoked WHERE revoked.subject=claims.subject AND revoked.kind=?3)) + AND (?5 IS NULL OR COALESCE( + (SELECT CASE WHEN json_type(policy.body,'$.fields') IS NULL THEN 1 ELSE + COALESCE(json_type(policy.body,'$.fields.expires_at_unix_ms')='integer' + AND json_extract(policy.body,'$.fields.expires_at_unix_ms')>?5,0) END + FROM claims AS policy WHERE policy.subject=claims.subject AND policy.kind=?4 ORDER BY policy.store_index DESC LIMIT 1), + CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE + COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' + AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END))"; + + fn snapshot(connection: &Connection) -> Vec> { + connection + .prepare("SELECT * FROM claims ORDER BY store_index") + .unwrap() + .query_map([], |row| { + (0..row.as_ref().column_count()).map(|column| row.get(column)).collect() + }) + .unwrap() + .collect::>() + .unwrap() + } + + fn plan(connection: &Connection, sql: &str, active: bool) -> Vec { + let parameters: Vec<&dyn rusqlite::ToSql> = if active { + vec![&GRANTED, &"assistant/chatgpt", &REVOKED, &POLICY, &100_u64] + } else { + vec![&GRANTED, &"assistant/chatgpt"] + }; + connection + .prepare(&format!("EXPLAIN QUERY PLAN {sql}")) + .unwrap() + .query_map(parameters.as_slice(), |row| row.get(3)) + .unwrap() + .collect::>() + .unwrap() + } + + // These supported stores need additive DDL, not a data or version conversion. + for version in [18, 19, fractal_schema::STORAGE_VERSION] { + let directory = tempfile::tempdir().unwrap(); + let path = directory.path().join("claims.sqlite"); + let connection = Connection::open(&path).unwrap(); + connection.execute_batch(smallclaims::store::SCHEMA).unwrap(); + install_initial_schema(&connection, true).unwrap(); + connection.execute_batch("DROP INDEX claims_assistant_v1_principal_index;").unwrap(); + connection.pragma_update(None, "user_version", version).unwrap(); + connection.execute( + "INSERT INTO batches(id,origin,replica_sequence,hash,accepted_at_unix_ms) VALUES('batch','node',1,'hash','1')", + [], + ).unwrap(); + for (id, subject, kind, body) in [ + ("legacy", "custom/client/legacy", GRANTED, r#"{"fields":{"expires_at_unix_ms":200}}"#), + ("chatgpt", "custom/client/chatgpt", GRANTED, r#"{"fields":{"principal":"assistant/chatgpt","expires_at_unix_ms":50}}"#), + ("mcp", "custom/client/mcp", GRANTED, r#"{"fields":{"principal":"assistant/mcp","expires_at_unix_ms":200}}"#), + ("policy", "custom/client/chatgpt", POLICY, r#"{"fields":{"expires_at_unix_ms":200}}"#), + ("revoked", "custom/client/legacy", REVOKED, r#"{"fields":{}}"#), + ("unrelated", "custom/test/unrelated", "custom.test.recorded", r#"{"fields":{}}"#), + ] { + connection.execute( + "INSERT INTO claims(id,batch_id,subject,kind,origin,body,predecessors,accepted_at_unix_ms) VALUES(?1,'batch',?2,?3,'node',?4,'[]','1')", + params![id, subject, kind, body], + ).unwrap(); + } + let before = snapshot(&connection); + let plans_before = [plan(&connection, SELECT, false), plan(&connection, ACTIVE, true)]; + assert!(plans_before.iter().flatten().all(|detail| !detail.contains(INDEX))); + drop(connection); + + let connection = Connection::open(&path).unwrap(); + migrate_schema(&connection).unwrap(); + install_initial_schema(&connection, false).unwrap(); + assert_eq!(snapshot(&connection), before, "version {version}: claim bytes"); + assert_eq!( + connection.pragma_query_value(None, "user_version", |row| row.get::<_, u32>(0)).unwrap(), + version, + ); + for (sql, active, previous) in [(SELECT, false, &plans_before[0]), (ACTIVE, true, &plans_before[1])] { + let current = plan(&connection, sql, active); + eprintln!("assistant admission version={version} active={active} before={previous:?} after={current:?}"); + assert!( + current.iter().any(|detail| detail.contains("SEARCH") && detail.contains(INDEX) + && detail.contains("kind=?") && detail.contains("=?")), + "version {version}: before={previous:?}; after={current:?}", + ); + } + for (principal, mut expected) in [ + ("assistant/chatgpt", vec!["chatgpt".to_owned(), "legacy".to_owned()]), + ("assistant/mcp", vec!["mcp".to_owned()]), + ] { + let mut found = connection.prepare(SELECT).unwrap() + .query_map(params![GRANTED, principal], |row| row.get::<_, String>(0)) + .unwrap().collect::>>().unwrap(); + found.sort(); + expected.sort(); + assert_eq!(found, expected); + } + let active = connection.prepare(ACTIVE).unwrap() + .query_map(params![GRANTED, "assistant/chatgpt", REVOKED, POLICY, 100_u64], |row| row.get::<_, String>(0)) + .unwrap().collect::>>().unwrap(); + assert_eq!(active, vec!["chatgpt"]); + let unfiltered = connection.prepare(ACTIVE).unwrap() + .query_map(params![GRANTED, "assistant/chatgpt", REVOKED, POLICY, Option::::None], |row| row.get::<_, String>(0)) + .unwrap().collect::>>().unwrap(); + assert_eq!(unfiltered.len(), 2, "no cutoff preserves unfiltered validation candidates"); + let cookie: u32 = connection.pragma_query_value(None, "schema_version", |row| row.get(0)).unwrap(); + drop(connection); + + let connection = Connection::open(&path).unwrap(); + migrate_schema(&connection).unwrap(); + install_initial_schema(&connection, false).unwrap(); + assert_eq!(snapshot(&connection), before); + assert_eq!( + connection.pragma_query_value(None, "schema_version", |row| row.get::<_, u32>(0)).unwrap(), + cookie, + "an unchanged reopen must not rebuild the index", + ); + } + } + #[test] fn complete_runtime_schema_does_not_take_a_held_writer_lock() { let directory = tempfile::tempdir().unwrap(); diff --git a/crates/fractal/tests/daemon_cost.rs b/crates/fractal/tests/daemon_cost.rs index 84715be0dd1..c96558399d2 100644 --- a/crates/fractal/tests/daemon_cost.rs +++ b/crates/fractal/tests/daemon_cost.rs @@ -45,6 +45,8 @@ //! - `ST_BENCH_DIR` keeps generated stores for the next run, as for `daemon_bench`. //! - `ST_COST_REPORT` writes the measurements as JSON to that path. +mod assistant_admission; + use fractal_daemon::ConversationReadsStore; use fractal_daemon::CustomStore; use fractal_daemon::AdhocWorkStore; diff --git a/crates/fractal/tests/daemon_cost/assistant_admission.rs b/crates/fractal/tests/daemon_cost/assistant_admission.rs new file mode 100644 index 00000000000..5fb7dcfbef2 --- /dev/null +++ b/crates/fractal/tests/daemon_cost/assistant_admission.rs @@ -0,0 +1,395 @@ +//! Opt-in, real HTTP/Unix daemon measurement (not a router oneshot or mocked daemon). +//! Run this same test source on 98e550cb and on PR3-B, sequentially on dev5: +//! ```sh +//! ST_ADMISSION_VARIANT=baseline cargo test --release -p fractal --test integration daemon_cost::assistant_admission::authenticated_get_during_pairing -- --exact --nocapture --test-threads=1 +//! ST_ADMISSION_VARIANT=indexed cargo test --release -p fractal --test integration daemon_cost::assistant_admission::authenticated_get_during_pairing -- --exact --nocapture --test-threads=1 +//! ``` +//! Copy only this file and its `mod assistant_admission;` registration to the A worktree. +//! The baseline must actually be built from 98e550cb: dropping an index on PR3-B does not +//! restore A's admission query. Use distinct CARGO_TARGET_DIR paths for the two worktrees: +//! Cargo freshness can otherwise reuse the baseline's artifacts for the indexed checkout. +//! ST_ADMISSION_HISTORY (default 10000) is expired grants PER principal; ST_ADMISSION_SAMPLES +//! (default 200) is measured GET/completion pairs PER read mode. Setup and proof creation are +//! outside timing. Each pair starts behind a barrier, with no sleeps, polling, retries or timers. +//! ST_ADMISSION_REPORT optionally saves the complete JSON report. Run on dev5; hardware is +//! observed from uname/lscpu in the report, not inferred from an environment label. +//! The index DDL timing is a synthetic startup migration probe on the populated disposable +//! real store, not total daemon startup or cold-disk startup. Latencies use the real daemon's +//! bound sockets, bearer middleware, grant lookup, projection and durable approval consumption. + +use std::{collections::BTreeMap, path::PathBuf, sync::Arc, time::{Instant, SystemTime, UNIX_EPOCH}}; + +use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD}; +use fractal_daemon::{api::{self, AppState}, client::Client, model::ClaimInput, store::Store}; +use fractal_daemon::{AttentionListStore as _, EvidenceStore as _, SeatsStore as _}; +use fractal_daemon::api::client_v0::assistant::authorization::{ReadPayload, request_digest, signing_bytes, HEADER}; +use ring::{rand::SystemRandom, signature::{Ed25519KeyPair, KeyPair as _}}; +use serde_json::{Value, json}; +use tokio::sync::Barrier; + +const OWNER: &str = "person/admission-bench"; +const NODE: &str = "admission-bench"; +const GRANTED: &str = "custom.client.assistant.v1.granted"; +const INDEX: &str = "claims_assistant_v1_principal_index"; +const CREATE_INDEX: &str = "CREATE INDEX claims_assistant_v1_principal_index ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'))"; +const A_QUERY: &str = "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2"; +const INDEXED_QUERY: &str = + "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 + AND (?5 IS NULL OR NOT EXISTS (SELECT 1 FROM claims AS revoked WHERE revoked.subject=claims.subject AND revoked.kind=?3)) + AND (?5 IS NULL OR COALESCE( + (SELECT CASE WHEN json_type(policy.body,'$.fields') IS NULL THEN 1 ELSE + COALESCE(json_type(policy.body,'$.fields.expires_at_unix_ms')='integer' + AND json_extract(policy.body,'$.fields.expires_at_unix_ms')>?5,0) END + FROM claims AS policy WHERE policy.subject=claims.subject AND policy.kind=?4 ORDER BY policy.store_index DESC LIMIT 1), + CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE + COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' + AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END))"; +const PATH: &str = "/v1/client/assistant/summary"; + +fn number(name: &str, default: usize) -> usize { + let value = std::env::var(name).map_or(default, |s| s.parse().expect("positive integer setting")); + assert!(value > 0, "{name} must be positive"); + value +} + +fn value(response: Value) -> Value { + response.get("value").cloned().unwrap_or(response) +} + +fn key() -> Ed25519KeyPair { + let encoded = Ed25519KeyPair::generate_pkcs8(&SystemRandom::new()).unwrap(); + Ed25519KeyPair::from_pkcs8(encoded.as_ref()).unwrap() +} + +async fn begin(owner: &Client, mode: &str) -> Value { + value(owner.post("/v1/client/pairings", &json!({ + "api_version":"st3.client.v0", "device_name":"Admission measurement", + "assistant_id":"assistant/chatgpt", "scopes":["read.assistant.summary","read.assistant.attention","read.assistant.missions","read.assistant.agents"], + "expires_in_seconds":3600, "disclosure_consent":true, + "consent_evidence":"Disposable synthetic benchmark owner consent", "minimal_read_mode":mode, + })).await.unwrap()) +} + +async fn complete(http: &reqwest::Client, base: &str, challenge: &Value) -> Value { + let id = challenge["pairing_id"].as_str().unwrap().trim_start_matches("pairing/"); + let response = http.post(format!("{base}/v1/client/pairings/{id}/complete")) + .json(&json!({"api_version":"st3.client.v0", "code":challenge["code"], + "device_public_key":"BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc", "key_storage":"software"})) + .send().await.unwrap(); + let status = response.status(); + let body: Value = response.json().await.unwrap(); + assert!(status.is_success(), "completion {status}: {body}"); + value(body) +} + +fn proof(paired: &Value, signer: &Ed25519KeyPair, sequence: usize) -> String { + let parameters = BTreeMap::new(); + let payload = ReadPayload { + issuer:"scg/admission-bench".into(), identity:"chatgpt".into(), assistant_id:"assistant/chatgpt".into(), + grant_id:paired["grant"]["id"].as_str().unwrap().into(), + policy_revision:paired["grant"]["policy_revision"].as_u64().unwrap(), key_id:"approval-key/admission-bench".into(), + approval_id:format!("approval/admission-{sequence}"), execution_id:format!("execution/admission-{sequence}"), + projection:"summary".into(), max_response_bytes:4096, + request_digest:request_digest(PATH, ¶meters).unwrap(), parameters, + expires_at_unix_ms:u64::try_from(SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis()).unwrap() + 60_000, + nonce:uuid::Uuid::new_v4().to_string(), + }; + let signature = URL_SAFE_NO_PAD.encode(signer.sign(signing_bytes(&payload).unwrap().as_bytes()).as_ref()); + URL_SAFE_NO_PAD.encode(serde_json::to_vec(&json!({"payload":payload,"signature":signature})).unwrap()) +} + +fn explain(connection: &rusqlite::Connection, query: &str) -> Vec { + let mut statement = connection.prepare(&format!("EXPLAIN QUERY PLAN {query}")).unwrap(); + let mut rows = if query == A_QUERY { + statement.query(rusqlite::params![GRANTED, "assistant/chatgpt"]).unwrap() + } else { + statement.query(rusqlite::params![GRANTED, "assistant/chatgpt", "custom.client.assistant.v1.revoked", + "custom.client.assistant.v1.policy", + u64::try_from(SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis()).unwrap()]).unwrap() + }; + let mut plan = Vec::new(); + while let Some(row) = rows.next().unwrap() { plan.push(row.get::<_, String>(3).unwrap()); } + plan +} + +fn p95(samples: &mut [f64]) -> f64 { + samples.sort_by(f64::total_cmp); + samples[(samples.len() * 95).div_ceil(100) - 1] +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 8)] +async fn authenticated_get_during_pairing() { + let Ok(variant) = std::env::var("ST_ADMISSION_VARIANT") else { return }; + assert!(matches!(variant.as_str(), "baseline" | "indexed")); + assert!(fractal_daemon::test_support::optimized_build(), "use --release"); + let indexed = variant == "indexed"; + let history = number("ST_ADMISSION_HISTORY", 10_000); + let samples = number("ST_ADMISSION_SAMPLES", 200); + let root = tempfile::tempdir().unwrap(); + let database = root.path().join("admission.sqlite"); + let store = Arc::new(Store::open(&database, NODE).unwrap()); + store.bind_fleet(super::super::daemon_bench::FLEET).unwrap(); + store.set_node_key(Arc::new(smallclaims::fleet::MemberKey::generate().unwrap().0)).unwrap(); + let state = AppState { + seat_admission:Default::default(), owning_person:Some(OWNER.into()), store:store.clone(), + notify:Arc::new(tokio::sync::Notify::new()), event_notify:tokio::sync::watch::channel(0).0, + node:NODE.into(), state_dir:root.path().into(), pty_root:root.path().join("pty"), pty_binary:PathBuf::from("pty"), + fleet_id:None, configured_peers:vec![], client_relay:None, native_session_home:None, + planner_default:Default::default(), harness_question_sink:None, assistant_receipts:Default::default(), private_notes:Default::default(), + }; + api::start_operation_report(&state); + // Match run_up/daemon_load: the generic lists do not own the independent + // attention/summary and agent-roster publication workers. + let mut roster_publications = store.subscribe_agent_roster(); + let mut attention_publications = store.subscribe_attention_list(); + api::start_agent_roster(&state); + api::start_attention_list(&state); + api::start_published_lists(&state); + // Observe the workers' real publication watches, not an HTTP retry or a + // synchronous test-only fold. Subscribe before starting to avoid lost wakes. + roster_publications.wait_for(|_| store.published_agent_roster(u64::MAX, false).is_some()) + .await.expect("the daemon publishes its initial agent roster"); + attention_publications.wait_for(|_| store.published_attention_list().is_some()) + .await.expect("the daemon publishes its initial attention view"); + let socket = root.path().join("owner.sock"); + let reserved = api::reserve_unix_socket(&socket, None).await.unwrap(); + let (ready_tx, ready_rx) = tokio::sync::oneshot::channel(); + let local_app = api::router(state.clone()); + let local = tokio::spawn(async move { + api::serve_reserved_unix_with_ready(reserved, local_app, None, || { ready_tx.send(()).unwrap(); }).await.unwrap(); + }); + ready_rx.await.unwrap(); + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let base = format!("http://{}", listener.local_addr().unwrap()); + let fabric_app = api::fabric_router(state.clone()); + let fabric = tokio::spawn(async move { axum::serve(listener, fabric_app).await.unwrap(); }); + let owner = Client::unix_as(&socket, OWNER).unwrap(); + let http = reqwest::Client::builder().no_proxy().build().unwrap(); + let signer = key(); + let mut sessions = Vec::new(); + for mode in ["approval-once", "caller-bound-allow"] { + let mut paired = complete(&http, &base, &begin(&owner, mode).await).await; + if mode == "approval-once" { + let id = paired["grant"]["id"].as_str().unwrap().trim_start_matches("assistant-grant/"); + let trust = value(owner.post(&format!("/v1/client/assistant/grants/{id}/read-trust"), &json!({ + "api_version":"st3.client.v0", "issuer":"scg/admission-bench", "key_id":"approval-key/admission-bench", + "attestor_public_key":URL_SAFE_NO_PAD.encode(signer.public_key().as_ref()), + "shim_public_key":URL_SAFE_NO_PAD.encode(key().public_key().as_ref()), + "default_response_bytes":4096, "max_response_bytes":16_384, + })).await.unwrap()); + paired["grant"] = trust; + } + sessions.push((mode, paired)); + } + // Synthetic expired grants retain valid production field shapes, native Store envelopes, + // origin/actor and per-subject indexes. They are never service-profile fixtures and never + // authorize a request. Grant history is deliberately nonempty for BOTH principals. + let template_subject = format!("custom/client/assistant-v1-{}", sessions[0].1["grant"]["id"].as_str().unwrap().trim_start_matches("assistant-grant/")); + let template = store.claims_for_subject_kind_at(&template_subject, GRANTED, None, true, 1).unwrap().claims.pop().unwrap(); + let fixture_store = store.clone(); + tokio::task::spawn_blocking(move || { + for principal in ["assistant/chatgpt", "assistant/mcp"] { + for row in 0..history { + let id = format!("history-{}-{row}", principal.trim_start_matches("assistant/")); + let mut fields = template.body["fields"].clone(); + fields["principal"] = json!(principal); + fields["grant_id"] = json!(format!("assistant-grant/{id}")); + fields["session_actor"] = json!(format!("{principal}/session/assistant-grant/{id}")); + fields["expires_at_unix_ms"] = json!(1); + fields["credential_hash"] = json!(hex::encode(ring::digest::digest(&ring::digest::SHA256, id.as_bytes()).as_ref())); + fixture_store.append_claim(&ClaimInput { subject:format!("custom/client/assistant-v1-{id}"), kind:GRANTED.into(), + actor:Some(OWNER.into()), fields:serde_json::from_value(fields).unwrap(), evidence:vec![], expected_subject:None, idempotency_key:None }).unwrap(); + } + } + }).await.unwrap(); + let connection = rusqlite::Connection::open(&database).unwrap(); + let query = if indexed { INDEXED_QUERY } else { A_QUERY }; + let index_exists: bool = connection.query_row("SELECT EXISTS(SELECT 1 FROM sqlite_master WHERE type='index' AND name=?1)", [INDEX], |r| r.get(0)).unwrap(); + assert_eq!(index_exists, indexed, "build baseline on 98e550cb; indexed on PR3-B"); + let (before, after, build_ms) = if indexed { + connection.execute_batch("DROP INDEX claims_assistant_v1_principal_index").unwrap(); + let before = explain(&connection, query); + let started = Instant::now(); + connection.execute_batch(CREATE_INDEX).unwrap(); + let elapsed = started.elapsed().as_secs_f64() * 1000.0; + let after = explain(&connection, query); + assert!(after.iter().any(|line| line.contains(INDEX)), "{after:?}"); + (before, after, Some(elapsed)) + } else { (explain(&connection, query), Vec::new(), None) }; + let total_rows: u64 = connection.query_row("SELECT count(*) FROM claims", [], |r| r.get(0)).unwrap(); + let mut principal_rows = BTreeMap::new(); + for principal in ["assistant/chatgpt", "assistant/mcp"] { + let count: u64 = connection.query_row("SELECT count(*) FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2", rusqlite::params![GRANTED,principal], |r| r.get(0)).unwrap(); + principal_rows.insert(principal, count); + } + drop(connection); + api::wait_published_lists_at_least(&store, store.index().unwrap()).await.unwrap(); + let mut measurements = Vec::new(); + for (mode, paired) in sessions { + let credential = paired["credential"].as_str().unwrap(); + let mut get_ms = Vec::with_capacity(samples); + let mut completion_ms = Vec::with_capacity(samples); + // One unmeasured warm GET, with a distinct one-use proof. + let warm = http.get(format!("{base}{PATH}")).bearer_auth(credential); + let warm = if mode == "approval-once" { warm.header(HEADER, proof(&paired, &signer, samples + 1)) } else { warm }; + let response = warm.send().await.unwrap(); + assert!(response.status().is_success(), "warm GET: {}", response.text().await.unwrap()); + for sequence in 0..samples { + let challenge = begin(&owner, mode).await; + let get = http.get(format!("{base}{PATH}")).bearer_auth(credential); + let get = if mode == "approval-once" { get.header(HEADER, proof(&paired, &signer, sequence)) } else { get }; + let barrier = Barrier::new(2); + let read = async { + barrier.wait().await; + let started = Instant::now(); + let response = get.send().await.unwrap(); + let status = response.status(); + let body = response.bytes().await.unwrap(); + let elapsed = started.elapsed().as_secs_f64() * 1000.0; + assert!(status.is_success(), "GET {status}: {}", String::from_utf8_lossy(&body)); + elapsed + }; + let pairing = async { + barrier.wait().await; + let started = Instant::now(); + let completed = complete(&http, &base, &challenge).await; + (started.elapsed().as_secs_f64() * 1000.0, completed) + }; + let (read_ms, (pair_ms, completed)) = tokio::join!(read, pairing); + get_ms.push(read_ms); + completion_ms.push(pair_ms); + // Keep live-grant count stable; revocation is owner HTTP, outside both samples. + let id = completed["grant"]["id"].as_str().unwrap().trim_start_matches("assistant-grant/"); + let _: Value = owner.post(&format!("/v1/client/assistant/grants/{id}/revoke"), &json!({})).await.unwrap(); + } + state.assistant_receipts.flush().await.unwrap(); + let get_p95 = p95(&mut get_ms); + let completion_p95 = p95(&mut completion_ms); + measurements.push(json!({"mode":mode,"get_samples":get_ms.len(),"completion_samples":completion_ms.len(), + "get_p95_ms":get_p95,"completion_p95_ms":completion_p95,"q39_budget_ms":100,"q39_pass":get_p95 <= 100.0, + "get_ms":get_ms,"completion_ms":completion_ms})); + } + let hardware = |program: &str, args: &[&str]| { + let output = std::process::Command::new(program).args(args).output().unwrap(); + assert!(output.status.success()); + String::from_utf8(output.stdout).unwrap() + }; + let final_connection = rusqlite::Connection::open(&database).unwrap(); + let final_rows: u64 = final_connection.query_row("SELECT count(*) FROM claims", [], |r| r.get(0)).unwrap(); + let report = json!({"variant":variant,"baseline_revision":"98e550cb75", "hardware_uname":hardware("uname", &["-a"]), + "hardware_lscpu":hardware("lscpu", &["-J"]),"hardware_hostname":hardware("hostname", &[]), + "expected_host":"dev5, AMD Ryzen 9 9955HX, 16 cores / 32 threads (verify observed hardware)", + "history_grants_per_principal":history,"initial_total_claim_rows":total_rows,"initial_granted_rows_by_principal":principal_rows, + "final_total_claim_rows":final_rows,"admission_query":query, + "explain_without_index":before,"explain_with_index":after,"synthetic_startup_index_build_ms":build_ms, + "measurements":measurements}); + println!("ADMISSION_MEASUREMENT {}", serde_json::to_string_pretty(&report).unwrap()); + if let Some(path) = std::env::var_os("ST_ADMISSION_REPORT") { std::fs::write(path, serde_json::to_vec_pretty(&report).unwrap()).unwrap(); } + local.abort(); + fabric.abort(); + if indexed { + assert!(report["measurements"].as_array().unwrap().iter().all(|row| row["q39_pass"] == true), "q39: authenticated GET p95 must be <=100ms; see report"); + } +} + +/// Synthetic large-store index build, independent of the HTTP latency fixture: +/// ```sh +/// ST_ADMISSION_INDEX_BUILD=1 cargo test --release -p fractal --test integration daemon_cost::assistant_admission::synthetic_large_store_index_build -- --exact --nocapture --test-threads=1 +/// ``` +/// ST_ADMISSION_INDEX_ROWS defaults to 1,000,000 total claims. ST_ADMISSION_INDEX_REPORT +/// optionally saves JSON. Run on the indexed branch. This measures the exact startup index +/// CREATE DDL, not full Store::open, cold-disk startup, admission, or signature verification. +#[test] +fn synthetic_large_store_index_build() { + if std::env::var_os("ST_ADMISSION_INDEX_BUILD").is_none() { return; } + assert!(fractal_daemon::test_support::optimized_build(), "use --release"); + let rows = number("ST_ADMISSION_INDEX_ROWS", 1_000_000); + let root = tempfile::tempdir().unwrap(); + let database = root.path().join("synthetic-index.sqlite"); + let store = Store::open(&database, NODE).unwrap(); + // Obtain a real Store-authored envelope and the real migrated schema. The SQL copies + // below are intentionally synthetic, not independently signed or admission-authoritative. + // Never reopen this fixture as a source of replicated/authenticated claims. + let template = store.append_claim(&ClaimInput { + subject:"custom/admission-index/template".into(), + kind:"custom.admission-index.fixture".into(), actor:Some(OWNER.into()), + fields:serde_json::from_value(json!({"principal":"assistant/chatgpt", + "expires_at_unix_ms":1,"fixture_payload":"synthetic large-store index build only"})).unwrap(), + evidence:vec![], expected_subject:None, idempotency_key:None, + }).unwrap(); + drop(store); + let mut connection = rusqlite::Connection::open(&database).unwrap(); + // Native claims triggers retain their real digest implementation during the + // synthetic population, just as on production/checkpoint writer connections. + smallclaims::store::configure_projection_writer(&connection).unwrap(); + let installed: bool = connection.query_row( + "SELECT EXISTS(SELECT 1 FROM sqlite_master WHERE type='index' AND name=?1)", + [INDEX], |row| row.get(0), + ).unwrap(); + assert!(installed, "run the large-store index probe on the indexed branch"); + connection.execute_batch("DROP INDEX claims_assistant_v1_principal_index").unwrap(); + // Copy every native required column rather than depending on a second claims schema. + // The native autoincrement store_index, claim ID and subject must remain unique. + let columns = { + let mut statement = connection.prepare("PRAGMA table_info(claims)").unwrap(); + statement.query_map([], |row| row.get::<_, String>(1)).unwrap() + .collect::, _>>().unwrap() + }; + let quote = |name: &str| format!("\"{}\"", name.replace('"', "\"\"")); + let copied = columns.iter().filter(|name| name.as_str() != "store_index").collect::>(); + let destinations = copied.iter().map(|name| quote(name)).collect::>().join(","); + let expressions = copied.iter().map(|name| match name.as_str() { + "id" => "'synthetic-index-claim/' || sequence.n".to_owned(), + "subject" => "'custom/admission-index/row-' || sequence.n".to_owned(), + "kind" => format!("'{GRANTED}'"), + "body" => "json_set(template.body,'$.subject','custom/admission-index/row-' || sequence.n,\ + '$.kind','custom.client.assistant.v1.granted','$.fields.principal',\ + CASE WHEN sequence.n % 2=0 THEN 'assistant/chatgpt' ELSE 'assistant/mcp' END)".to_owned(), + _ => format!("template.{}", quote(name)), + }).collect::>().join(","); + let transaction = connection.transaction().unwrap(); + if rows > 1 { + transaction.execute(&format!( + "WITH RECURSIVE sequence(n) AS (SELECT 1 UNION ALL SELECT n+1 FROM sequence WHERE n= 'subscription/watch/' AND subject < 'subscription/watch0'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_root_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.root_mission_run')) WHERE kind='mission-run.created'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_generation_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.current_generation')) WHERE kind='mission-run.created'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_generation_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='run-generation.created'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_proposal_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='revision-proposal.created'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.revision')) WHERE kind='mission-run.created'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_generation_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.revision')) WHERE kind='run-generation.created'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_proposal_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.candidate_revision')) WHERE kind='revision-proposal.created'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_generation_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.generation')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_owner_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.owner_run')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_origin_step_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.origin_step')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_recipient_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.person')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "message_index_open", "table_pattern": "message_index", "key_expression_and_predicate": "(closed, created_index)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_native_delivery_identity_v2", "table_pattern": "local_native_delivery_receipts_v2", "key_expression_and_predicate": "(session_id, native_id, actor, origin, store_index)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_native_delivery_owner_cut_v2", "table_pattern": "local_native_delivery_receipts_v2", "key_expression_and_predicate": "(actor, store_index)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_revisions_claim_index", "table_pattern": "mission_revisions", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_definitions_claim_index", "table_pattern": "mission_definitions", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_mission_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, created_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_requester_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(requester)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_collection_latest_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, created_at_unix_ms DESC, id DESC)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_collection_live_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, status) WHERE status IN ('running','standing')", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_root_page_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(root_run_id, created_at_unix_ms, id)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_open_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(created_at_unix_ms, id) WHERE status NOT IN ('completed','failed','cancelled')", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "run_generations_run_index", "table_pattern": "run_generations", "key_expression_and_predicate": "(run_id, created_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_run_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(run_id, generation_id, step_path)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_generation_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(generation_id)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_definition_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(definition_hash, run_id, generation_id)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_parent_step_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(parent_step_run) WHERE parent_step_run IS NOT NULL", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_assignee_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(assignee, status)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_lease_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(lease_owner) WHERE lease_owner IS NOT NULL", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_single_agent_offer_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(available_to, run_id) WHERE CASE WHEN json_valid(available_to) THEN json_array_length(available_to)=1 ELSE 0 END", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_available_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(run_id) WHERE available_to!='[]'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_open_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(created_at_unix_ms, step_path) WHERE status NOT IN ('completed','failed','cancelled')", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_subject_kind_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, kind, id)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_subject_id_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, id)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_after_store_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(after_store_index)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_time_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(observed_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_dedupe_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(dedupe_key) WHERE dedupe_key IS NOT NULL", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_timeline_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), id) WHERE kind='harness.timeline'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_roster_frontier_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(id, after_store_index) WHERE kind='harness.timeline' AND subject LIKE 'agent/%'", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "client_diagnostic_receipts_time_index", "table_pattern": "client_diagnostic_receipts", "key_expression_and_predicate": "(accepted_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "client_diagnostic_receipts_device_time_index", "table_pattern": "client_diagnostic_receipts", "key_expression_and_predicate": "(device, accepted_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_subscription_mission_deferrals_deadline_index", "table_pattern": "local_subscription_mission_deferrals", "key_expression_and_predicate": "(not_before_unix_ms)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_usage_responses_age_index", "table_pattern": "local_usage_responses", "key_expression_and_predicate": "(observed_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "revision_proposals_run_index", "table_pattern": "revision_proposals", "key_expression_and_predicate": "(run_id)", "value_size_proven": false}, - {"site": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "revision_proposals_generation_index", "table_pattern": "revision_proposals", "key_expression_and_predicate": "(source_generation_id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "desired", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES claims(id)", "value_size_proven": false}, {"name": "body", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "member", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "owner_run", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "owner_generation", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "owner_step", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_run_requests", "columns": [{"name": "operation_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "request_hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "message_index", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "created_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "closed", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_native_delivery_receipts_v2", "columns": [{"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY REFERENCES claims(id) ON DELETE CASCADE", "value_size_proven": false}, {"name": "claim_hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "session_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "native_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "origin", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "store_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "capabilities", "columns": [{"name": "secret_hash", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "expires_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "used", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_revisions", "columns": [{"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "state", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "body", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES claims(id)", "value_size_proven": false}, {"name": "created_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_definitions", "columns": [{"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "state", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES claims(id)", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_runs", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "initial_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "current_generation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "root_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "root_run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "parent_step_run", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "workspace", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "requester", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "inputs", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "mode", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "phase", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_run_deadlines", "columns": [{"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "timeout_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "deadline_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_run_after", "columns": [{"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "after_run", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "run_generations", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "predecessor_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "reason", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "step_runs", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "generation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES run_generations(id)", "value_size_proven": false}, {"name": "step_path", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "definition_hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "attempt", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "assignee", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "available_to", "declared_type": "TEXT", "declaration": "TEXT NOT NULL DEFAULT '[]'", "value_size_proven": false}, {"name": "agentless", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 1", "value_size_proven": false}, {"name": "title", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "goals", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "worker_reported", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "lease_owner", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "lease_incarnation", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "lease_expires_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "blocked_reason", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "not_before_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "activated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "readiness_epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "constraints", "declared_type": "TEXT", "declaration": "TEXT NOT NULL DEFAULT '[]'", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_harness_question_generations", "columns": [{"name": "question", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "generation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_owners", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_bindings", "columns": [{"name": "token", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_argv_bindings", "columns": [{"name": "token", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "member", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_leases", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "provider", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "session", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "sequence", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "pid", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "process_token", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "token", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "revoked", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_work_lease_renewals", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "attempt", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "lease_owner", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "lease_incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "lease_expires_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_observations", "columns": [{"name": "id", "declared_type": "INTEGER", "declaration": "INTEGER PRIMARY KEY AUTOINCREMENT", "value_size_proven": false}, {"name": "after_store_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "body", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "dedupe_key", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "request_digest", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "observed_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "client_diagnostic_receipts", "columns": [{"name": "device", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "event_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "accepted_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_subscription_mission_deferrals", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "request", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "not_before_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "attempts", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_usage_spend", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "model", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "account", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "owner_run", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "owner_step", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "host", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "input_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "output_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cache_write_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cache_write_1h_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cached_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "total_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cost_microusd", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "reported_cost_microusd", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "unpriced_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "observed_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_usage_provenance", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "slot", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "pricing", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_limit_stops", "columns": [{"name": "account", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "episode", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "seat", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "stopped_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_seat_accounts", "columns": [{"name": "seat", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "account", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "chosen_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_usage_responses", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "source_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "observed_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_latest_slots", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "slot", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "published_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "published_fields", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "pending_local_id", "declared_type": "INTEGER", "declaration": "INTEGER", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "claims_stored", "columns": [{"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "writer", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "since_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "claims", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "bytes", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "revision_proposals", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "source_generation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES run_generations(id)", "value_size_proven": false}, {"name": "candidate_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "reason", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "cutover", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "compatible_steps", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "reviewers", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "approvals", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "preview_hash", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "successor_generation_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "planning_sessions", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "request_ref", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "workspace", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "requester", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "planner", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "planner_spec_json", "declared_type": "TEXT", "declaration": "TEXT NOT NULL DEFAULT '{\"provider\":\"codex\"}'", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "target_run_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "source_generation_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "published_revision", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "planning_candidates", "columns": [{"name": "session_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES planning_sessions(id)", "value_size_proven": false}, {"name": "variant", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "revision", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "markdown_ref", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "kdl_ref", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "mission_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "submitted_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "planning_previews", "columns": [{"name": "session_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES planning_sessions(id)", "value_size_proven": false}, {"name": "variant", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "candidate_revision", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "store_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "graph", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "diff", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "mission_response", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_owned_set_subject_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject) WHERE json_extract(body,'$.owned_set') IS NOT NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_terminal_history_index", "table_pattern": "claims", "key_expression_and_predicate": "(store_index) WHERE kind IN ('mission-run.state','step-run.state','work.failed') AND json_extract(body,'$.fields.status') IN ('failed','cancelled','completed')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_terminal_capability_hash_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.capability_hash'), store_index) WHERE kind='custom.client.terminal-attached'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_receipt_actor_key_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.receipt.actor_key'), origin, subject) WHERE kind='harness-question.resolved' AND actor IS NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_to_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.to'), subject) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_report_to_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.report_to'), subject) WHERE kind IN ('mission-run.created','mission-run.report-to')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_from_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.from'), store_index) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_legacy_to_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.to'), store_index) WHERE kind='message.sent' AND json_type(body, '$.fields') IS NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_legacy_from_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.from'), store_index) WHERE kind='message.sent' AND json_type(body, '$.fields') IS NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_resume_host_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.host'), subject) WHERE kind='runtime.action.requested' AND json_extract(body,'$.fields.action')='resume'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_actor_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(actor, length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind IN ('work.progress', 'work.submitted')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_from_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.from'), length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_to_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.to'), length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_timeline_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind='harness.timeline' AND json_extract(body, '$.fields.entry_type') IN ('message','content','tool_call','tool_result')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_actor_work_activity_index", "table_pattern": "claims", "key_expression_and_predicate": "(actor, json_extract(body, '$.fields.claim_incarnation'), store_index) WHERE kind IN ('work.claimed', 'work.progress')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_appeared_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.subagent_id')) WHERE kind='subagent.appeared'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_renewed_max_lease_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.subagent_id'), CAST(json_extract(body, '$.fields.lease_expires_at_unix_ms') AS INTEGER)) WHERE kind='subagent.renewed'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_ended_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.subagent_id')) WHERE kind='subagent.ended'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_appeared_lease_index", "table_pattern": "claims", "key_expression_and_predicate": "(CAST(json_extract(body, '$.fields.lease_expires_at_unix_ms') AS INTEGER)) WHERE kind='subagent.appeared'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_renewed_lease_index", "table_pattern": "claims", "key_expression_and_predicate": "(CAST(json_extract(body, '$.fields.lease_expires_at_unix_ms') AS INTEGER)) WHERE kind='subagent.renewed'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_timeline_incarnation_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, kind, json_extract(body, '$.fields.incarnation_id'), store_index) WHERE kind='harness.timeline'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_finished_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.request')) WHERE kind IN ( 'subscription.mission-started', 'subscription.mission-failed', 'subscription.mission-request-cancelled' )", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_delivery_key_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.delivery_key')) WHERE kind='subscription.mission-requested'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_started_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.mission_run')) WHERE kind='subscription.mission-started'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_mission_resource_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.mission'), json_extract(body, '$.fields.resource')) WHERE kind='subscription.mission-requested'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_authored_pull_request_url_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.facts.url')) WHERE kind='resource.observed' AND subject LIKE 'resource/mission-run/%/pull-request'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_authored_pull_request_number_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.facts.repository'), json_extract(body, '$.fields.facts.number')) WHERE kind='resource.observed' AND subject LIKE 'resource/mission-run/%/pull-request'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_deferred_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.request'), store_index) WHERE kind='subscription.mission-deferred'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_deferred_deadline_index", "table_pattern": "claims", "key_expression_and_predicate": "(CAST(json_extract(body, '$.fields.not_before_unix_ms') AS INTEGER)) WHERE kind='subscription.mission-deferred'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_schedule_started_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.request')) WHERE kind='schedule.work-started'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_to_order_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.to'), store_index) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_current_view_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, store_index) WHERE kind='intent.desired' OR json_extract(body, '$.fields.status') NOT IN ('stopped', 'absent', 'exited') OR json_extract(body, '$.status') NOT IN ('stopped', 'absent', 'exited')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.reviewer'), store_index) WHERE kind='gate.requested' AND json_extract(body, '$.fields.reviewer') IS NOT NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_reassignment_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.request'), subject) WHERE kind='gate.reviewer-reassigned'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_reassignment_reviewer_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.reviewer'), json_extract(body, '$.fields.request')) WHERE kind='gate.reviewer-reassigned'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_answer_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.request'), subject) WHERE kind='gate.result'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_episode_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.owner'), json_extract(body, '$.fields.reviewer'), json_extract(body, '$.fields.attempt'), json_extract(body, '$.fields.mission_revision'), json_extract(body, '$.fields.step_definition')) WHERE kind='gate.requested' AND json_extract(body, '$.fields.reviewer') IS NOT NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_runtime_subject_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, store_index) WHERE kind='runtime.observed'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_client_pairing_actor_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.session_actor')) WHERE kind='custom.client.pairing-completed'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_assistant_v1_credential_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.credential_hash'), store_index) WHERE kind='custom.client.assistant.v1.granted'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_assistant_v1_principal_index", "table_pattern": "claims", "key_expression_and_predicate": "(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'))", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_incarnation_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END), length(accepted_at_unix_ms), accepted_at_unix_ms ) WHERE json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) IS NOT NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_incarnation_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END), length(accepted_at_unix_ms), accepted_at_unix_ms ) WHERE kind='harness.observed' AND json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) IS NOT NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_episode_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.ownership_sequence'), json_extract(body, '$.fields.transition_sequence'), length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.observed'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_unnamed_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.observed' AND (json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) IS NULL OR typeof(json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END))!='text')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_claude_attachment_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END), store_index ) WHERE kind='harness.diagnostic' AND json_extract(body, '$.fields.code') IN ('claude-channel-unattached','claude-channel-attached')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_state_incarnation_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, CASE WHEN json_type(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END)='text' THEN json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) END, length(accepted_at_unix_ms), accepted_at_unix_ms ) WHERE kind='harness.observed' AND json_type(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.state' ELSE '$.fields.state' END)='text'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_auth_incarnation_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.observed' AND json_type(body, '$.fields.provider_auth') IN ('true','false')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_auth_diagnostic_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.diagnostic' AND json_extract(body, '$.fields.code') IN ('provider-auth-expired','provider-auth-restored')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_login_candidate_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject) WHERE (kind='harness.observed' AND ( json_type(body, '$.fields.provider_auth')='false' OR json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.reason' ELSE '$.fields.reason' END)='providerAuth' OR json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.state' ELSE '$.fields.state' END)='needs-login')) OR (kind='harness.diagnostic' AND json_extract(body, '$.fields.code')='provider-auth-expired')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_owner_step_index", "table_pattern": "desired", "key_expression_and_predicate": "(owner_step, subject)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_owner_run_index", "table_pattern": "desired", "key_expression_and_predicate": "(owner_run, subject)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_claim_index", "table_pattern": "desired", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_agent_subject_index", "table_pattern": "desired", "key_expression_and_predicate": "(subject) WHERE kind='agent'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_agent_host_index", "table_pattern": "desired", "key_expression_and_predicate": "(json_extract(member, '$.host'), subject) WHERE kind='agent'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_message_subject_index", "table_pattern": "desired", "key_expression_and_predicate": "(subject) WHERE kind='message'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_watch_agent_index", "table_pattern": "desired", "key_expression_and_predicate": "(substr(substr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), instr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), '/') + 1), instr(substr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), instr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), '/') + 1), '/') + 1)) WHERE subject >= 'subscription/watch/' AND subject < 'subscription/watch0'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_root_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.root_mission_run')) WHERE kind='mission-run.created'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_generation_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.current_generation')) WHERE kind='mission-run.created'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_generation_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='run-generation.created'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_proposal_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='revision-proposal.created'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.revision')) WHERE kind='mission-run.created'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_generation_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.revision')) WHERE kind='run-generation.created'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_proposal_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.candidate_revision')) WHERE kind='revision-proposal.created'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_generation_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.generation')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_owner_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.owner_run')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_origin_step_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.origin_step')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_recipient_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.person')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "message_index_open", "table_pattern": "message_index", "key_expression_and_predicate": "(closed, created_index)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_native_delivery_identity_v2", "table_pattern": "local_native_delivery_receipts_v2", "key_expression_and_predicate": "(session_id, native_id, actor, origin, store_index)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_native_delivery_owner_cut_v2", "table_pattern": "local_native_delivery_receipts_v2", "key_expression_and_predicate": "(actor, store_index)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_revisions_claim_index", "table_pattern": "mission_revisions", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_definitions_claim_index", "table_pattern": "mission_definitions", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_mission_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, created_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_requester_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(requester)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_collection_latest_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, created_at_unix_ms DESC, id DESC)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_collection_live_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, status) WHERE status IN ('running','standing')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_root_page_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(root_run_id, created_at_unix_ms, id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_open_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(created_at_unix_ms, id) WHERE status NOT IN ('completed','failed','cancelled')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "run_generations_run_index", "table_pattern": "run_generations", "key_expression_and_predicate": "(run_id, created_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_run_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(run_id, generation_id, step_path)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_generation_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(generation_id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_definition_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(definition_hash, run_id, generation_id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_parent_step_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(parent_step_run) WHERE parent_step_run IS NOT NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_assignee_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(assignee, status)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_lease_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(lease_owner) WHERE lease_owner IS NOT NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_single_agent_offer_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(available_to, run_id) WHERE CASE WHEN json_valid(available_to) THEN json_array_length(available_to)=1 ELSE 0 END", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_available_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(run_id) WHERE available_to!='[]'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_open_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(created_at_unix_ms, step_path) WHERE status NOT IN ('completed','failed','cancelled')", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_subject_kind_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, kind, id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_subject_id_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_after_store_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(after_store_index)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_time_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(observed_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_dedupe_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(dedupe_key) WHERE dedupe_key IS NOT NULL", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_timeline_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), id) WHERE kind='harness.timeline'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_roster_frontier_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(id, after_store_index) WHERE kind='harness.timeline' AND subject LIKE 'agent/%'", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "client_diagnostic_receipts_time_index", "table_pattern": "client_diagnostic_receipts", "key_expression_and_predicate": "(accepted_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "client_diagnostic_receipts_device_time_index", "table_pattern": "client_diagnostic_receipts", "key_expression_and_predicate": "(device, accepted_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_subscription_mission_deferrals_deadline_index", "table_pattern": "local_subscription_mission_deferrals", "key_expression_and_predicate": "(not_before_unix_ms)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_usage_responses_age_index", "table_pattern": "local_usage_responses", "key_expression_and_predicate": "(observed_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "revision_proposals_run_index", "table_pattern": "revision_proposals", "key_expression_and_predicate": "(run_id)", "value_size_proven": false}, + {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "revision_proposals_generation_index", "table_pattern": "revision_proposals", "key_expression_and_predicate": "(source_generation_id)", "value_size_proven": false}, {"site": "lv-h7792d6e9101c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_runtime_id_subject_index", "table_pattern": "claims", "key_expression_and_predicate": "({RUNTIME_ID_FIELD}, subject, store_index) WHERE {ACTUAL_STATE_CLAIM} AND typeof({RUNTIME_ID_FIELD})='text'", "value_size_proven": false}, {"site": "lv-h7792d6e9101c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_actual_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE {ACTUAL_STATE_CLAIM}", "value_size_proven": false}, {"site": "lv-h7792d6e9101c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_runtime_origin_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, origin, length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='runtime.observed'", "value_size_proven": false}, @@ -923,6 +924,7 @@ {"id": "lv-h1b6e1f9abd79", "path": "crates/fractal-api-core/src/api/client_push/tests.rs", "kind": "sql-template", "fingerprint": "fdcbfdd1abff3814f2b09fa3cce20d1b963541f1badd2f887675afe9896c0250", "owner": "fractal_api_core::api::client_push::tests", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 349, "excerpt": "DROP TABLE local_push_registrations"}, {"id": "lv-h1bf70a74e357", "path": "crates/fractal-api-core/src/api/client_push/tests.rs", "kind": "sql-template", "fingerprint": "0a87b6ca1c3206e8e53b141ed709386caa959f2c69d6f181138e4850400b77ea", "owner": "fractal_api_core::api::client_push::tests", "todo": "prepare-body-and-predecessor-values", "disposition": "allow-for-now", "line_hint": 219, "excerpt": "UPDATE claims SET origin='foreign-member' WHERE subject=?1"}, {"id": "lv-h2ac955b61469", "path": "crates/fractal-api-core/src/api/client_push/tests.rs", "kind": "sql-template", "fingerprint": "affb99d1b03c4f420bd38607d6e066885296c940ee119b70002f8d6c5b933049", "owner": "fractal_api_core::api::client_push::tests", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 399, "excerpt": "CREATE TRIGGER push_failure BEFORE INSERT ON local_push_registrations BEGIN SELECT RAISE(ABORT,'{TOKEN}'); END;"}, + {"id": "lv-h99f1a302c7b1", "path": "crates/fractal-api-core/src/api/client_v0/external_grants.rs", "kind": "unresolved-sql-sink", "fingerprint": "e43321ad215ad6548370e6aa528d88374c2734277a245c0589a162c3666a7909", "owner": "fractal_api_core::api::client_v0::external_grants", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 95, "excerpt": "ADMISSION_QUERY"}, {"id": "lv-he7d3ed99394d", "path": "crates/fractal-api-core/src/api/client_v0/raw_terminal/lease.rs", "kind": "unresolved-sql-sink", "fingerprint": "8c5bb4cddd6b8d6685308f20bf7367d763a4a9e5cb44eb0b0f7c687994135151", "owner": "fractal_api_core::api::client_v0::raw_terminal::lease", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 75, "excerpt": "& query , params ! [ subject , kind ] , | row | { Ok ( ( row . get ( 0 ) ? , row . get ( 1 ) ? ) ) }"}, {"id": "lv-h314a3080bc73", "path": "crates/fractal-api-core/src/api/client_v0/related_runs.rs", "kind": "unresolved-sql-sink", "fingerprint": "47622b87da9e8d2f6d3972c9459402094f347c5d8e58e7fee498393d6c3f2b4b", "owner": "fractal_api_core::api::client_v0::related_runs", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 33, "excerpt": "RELATED"}, {"id": "lv-h5747b91e24d9", "path": "crates/fractal-api-core/src/api/client_v0/summary.rs", "kind": "unresolved-sql-sink", "fingerprint": "aba95403b0b732c2a12e7b98379d7a878c4c576d5ea990774ea22738f001ddcc", "owner": "fractal_api_core::api::client_v0::summary", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 71, "excerpt": "state , session , & internal"}, @@ -1951,7 +1953,6 @@ {"id": "lv-h20950ed4b5dc", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "5d869aba23919ebabbf18885e6d7deebf69a7298969b72ec41ca59a8ecc6015c", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 20254, "excerpt": "& work_wake_history_query ( complete )"}, {"id": "lv-h20ede67dacaa", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "6d5b306c813337790dcc59d3ea0244058138d994c293b1d1b62b4d21f61d94ca", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 1608, "excerpt": "params ! [ subject , store_index ] , | row | row . get : : < _ , u64 > ( 0 )"}, {"id": "lv-h518e0bfb7ccb", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "cb1e349434ed46ec91aff46ff49e260a10ee9290d17983beff6d16108dcda3c4", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 11867, "excerpt": "& format ! ( \"SELECT claims.id, claims.origin, claims.kind FROM claims INDEXED BY claims_actual_accepted_index JOIN batches ON batches.id=claims.batch_id WHERE claims.subject=?1 AND +claims.store_inde"}, - {"id": "lv-h22c8c670811c", "path": "crates/fractal-store/src/store.rs", "kind": "sql-template", "fingerprint": "9630d07c20f6a6d1e638ea3b963e3b7d598498adadaf17e78ad3b0a2df790033", "owner": "fractal_store::store", "todo": "chunk-or-reference-variable-columns", "disposition": "allow-for-now", "line_hint": 754, "excerpt": " -- An unmanaged member's staging check needs tagged claims, not its runtime history. CREATE INDEX IF NOT EXISTS claims_owned_set_subject_index ON claims(subject) WHERE json_extract(body,'$.owned_set'"}, {"id": "lv-h26214094cec7", "path": "crates/fractal-store/src/store.rs", "kind": "sql-template", "fingerprint": "a07b2af24ca5ab021fe4b21e8353c58beb343552ea83e0a6b54c50510d16194e", "owner": "fractal_store::store", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 10422, "excerpt": "UPDATE step_runs SET updated_at_unix_ms=?2, activated_at_unix_ms=CASE WHEN ?3='ready' THEN ?2 ELSE activated_at_unix_ms END WHERE subject=?1"}, {"id": "lv-h26512c176d95", "path": "crates/fractal-store/src/store.rs", "kind": "sql-template", "fingerprint": "c40c825e3f560b060d1f8d9c67e790832cd2ec75806dde3bb03626c07da15aee", "owner": "fractal_store::store", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 17987, "excerpt": "UPDATE step_runs SET assignee=?2, available_to='[]', status='ready', lease_owner=NULL, lease_incarnation=NULL, lease_expires_at_unix_ms=NULL, readiness_epoch=?3, updated_at_unix_ms=?4 WHERE subject=?1"}, {"id": "lv-h27486c82727c", "path": "crates/fractal-store/src/store.rs", "kind": "sql-template", "fingerprint": "9bbb118568a2871f011bcf539a4d106bd062dd77ec81e1f6bfd7b03c780f2b8d", "owner": "fractal_store::store", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 10121, "excerpt": "UPDATE run_generations SET created_at_unix_ms=?2,updated_at_unix_ms=?2 WHERE id=?1"}, @@ -2112,6 +2113,7 @@ {"id": "lv-hb73bd4f2f38c", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "700d14798fd37c5da5b5389e3903a51a34c8c957866a0dd94482dfcc246b196b", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 8862, "excerpt": "& canonical_sql ( \"SELECT json_extract(body, '$.fields.session_id') FROM claims WHERE subject=?1 AND kind='harness.session-file' AND json_extract(body, '$.fields.incarnation_id')=?2 AND json_extract(b"}, {"id": "lv-hb7b64cc10c51", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "7a41ee06927a48e907a8b303d67368f1f76113a73b7efcaf20c658e641deaac8", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 1838, "excerpt": "params ! [ subject , at_index . unwrap_or ( i64 : : MAX as u64 ) ] , | row | row . get : : < _ , String > ( 0 ) ,"}, {"id": "lv-hb922e5825674", "path": "crates/fractal-store/src/store.rs", "kind": "sql-template", "fingerprint": "a521c5dad40bb69aa774c45feb4115e928e9636649863fd2f9284a6b6dd95c5c", "owner": "fractal_store::store", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 15155, "excerpt": "DELETE FROM mission_runs WHERE id=?1"}, + {"id": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "kind": "sql-template", "fingerprint": "0be5ad06badeb1870cc630ed6799adfebd3bffbdf2b2e4a85fb44b0a04b15ad6", "owner": "fractal_store::store", "todo": "chunk-or-reference-variable-columns", "disposition": "allow-for-now", "line_hint": 783, "excerpt": " -- An unmanaged member's staging check needs tagged claims, not its runtime history. CREATE INDEX IF NOT EXISTS claims_owned_set_subject_index ON claims(subject) WHERE json_extract(body,'$.owned_set'"}, {"id": "lv-hba4b0d735af8", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "68c5253450e4ab064ffddaaa91ab3fd123bd25dce5fca8c4f4b63ed02e14e26d", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 11818, "excerpt": "params ! [ subject , at_index ] , | row | { row . get : : < _ , String > ( 0 ) }"}, {"id": "lv-hba707764f720", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "746038271c3a30a5efca3979d788db5d87a588acb47362b3cb27a9a3d4c1d0ce", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 18333, "excerpt": "& canonical_sql ( \"SELECT kind, body, accepted_at_unix_ms FROM claims WHERE subject=?1 AND kind IN ('work.progress','work.submitted','step-run.carried') ORDER BY CANONICAL_DESC(claims)\" , )"}, {"id": "lv-hba80f02be5e7", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "f0cf159db9d7e30d00dd58f281267eb75687e6eaea2c416eddf5df095accc440", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 8212, "excerpt": "& canonical_sql ( \"SELECT body FROM claims WHERE subject=?1 AND kind='resource.observed' ORDER BY CANONICAL_DESC(claims)\" ) ,"}, diff --git a/docs/st3/large-values.md b/docs/st3/large-values.md index 1d40a495128..e9dc44959dc 100644 --- a/docs/st3/large-values.md +++ b/docs/st3/large-values.md @@ -475,3 +475,23 @@ current publication rejects for-each syntax. The UPDATE binds body, mission-ID and revision TEXT values; no production writer changes. The maintainer must preserve this historical regression through referenced storage/reclamation work. Inline storage here proves neither encoded size nor execution-cost bounds. + +## Assistant principal admission index review + +`fractal_store::store` owns schema site `lv-hb9696ca837f7`, replacing +`lv-h22c8c670811c`. The added principal admission index retains claim-kind TEXT +and the effective principal JSON field inline; absent principals use the fixed +`assistant/chatgpt` key. The composite seek changes neither claim bodies nor +admission semantics. These keys remain variable-size, and SQLite maintains them +on insertion and deletion; indexed lookup is not a byte-size or startup-cost +proof. The producer maintainer retains `chunk-or-reference-variable-columns` +responsibility while preserving effective-principal matching and claim authority. + +`fractal_api_core::api::client_v0::external_grants` owns the conservative +read-only sink `lv-h99f1a302c7b1`. Its prepared admission query binds fixed claim +kinds, an assistant principal and an optional expiry cutoff, then returns claim +IDs after revocation and latest-policy filtering. It adds no writer or body copy; +principal, subject and claim-ID TEXT keys remain variable-size. The producer +maintainer retains `trace-statement-and-value-representation` responsibility for +these bindings and returned identifiers; fewer candidates and indexed seeks do +not establish encoded-size or execution-cost bounds. diff --git a/release-notes/external-grant-admission-index.json b/release-notes/external-grant-admission-index.json new file mode 100644 index 00000000000..79b4bd3f2c3 --- /dev/null +++ b/release-notes/external-grant-admission-index.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "summary": "Index external-grant admission by principal and exclude revoked or effectively expired history before claim hydration", + "replay": {"status": "none", "detail": "No claim rewrite, projection replay or history removal. The SQL expiry filter uses the latest policy, retains missing-fields validation candidates, and preserves legacy absent-principal ChatGPT grants."}, + "schema": {"status": "changed", "detail": "Schema-on-open adds claims_assistant_v1_principal_index on claims(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')). This additive derived access path changes neither STORAGE_VERSION (20), RULES_VERSION (26), the registry nor shared projection digests. Existing supported stores install the index automatically; subsequent opens reuse it."}, + "rules": {"status": "none", "detail": "Profile admission, grant lifecycle, approval-once consumption, issuer checks and retention semantics are unchanged. Multiple same-profile grants remain allowed; service issuance remains disabled."}, + "compatibility": {"status": "none", "detail": "On dev5 (AMD Ryzen 9 9955HX, 16 cores/32 threads, Linux x86_64), real bound daemon APIs with bearer authentication and one concurrent pairing completion per GET were measured against exact baseline 98e550cb75. With 10000 expired grants per principal and 200 samples per mode, approval-once GET p95 improved from 965.184401 ms to 54.153648 ms; caller-bound-allow improved from 933.049170 ms to 46.173346 ms. Both indexed modes pass q39 <=100 ms. These are in-process production routers over Unix/TCP sockets, not an external daemon-process startup benchmark. SQL work still scales with matching principal history; the index avoids unrelated principals and inactive records no longer hydrate into Rust."}, + "downtime": {"status": "changed", "detail": "The first store open missing the index waits synchronously for its construction. Exact index CREATE DDL on a synthetic 1000000-claim real Store schema took 1524.850241 ms (about 1.525 s) on dev5, AMD Ryzen 9 9955HX, 16 cores/32 threads, Linux 6.18.51 x86_64. Main database size grew from 1421651968 to 1481170944 bytes. This measures index-build startup work only, not complete restart-to-API time or cold-disk startup; allow additional first-open delay according to local history and hardware. Later opens do not rebuild the index."}, + "manual": {"status": "none", "detail": "No operator SQL, data conversion, credential reissue or manual migration is required. Allow the first open to finish index construction."}, + "recovery": {"status": "none", "detail": "Claims and signed bodies are unchanged. Previous binaries can ignore the additional index, which SQLite continues maintaining. An interrupted first-open index build can be completed by normal subsequent schema-on-open installation; no history deletion or repair SQL is needed."}, + "commits": [] +} From c1365c450e836c02e5fc92ee7af0973b225adb33 Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 06:53:41 +0100 Subject: [PATCH 03/10] test(external-grants): prove prefilter admission equivalence agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- .../src/api/client_v0/external_grants.rs | 116 +++++++++++++++++- .../tests/daemon_cost/assistant_admission.rs | 2 +- docs/st3/compatibility.md | 6 +- .../external-grant-admission-index.json | 6 +- 4 files changed, 121 insertions(+), 9 deletions(-) diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants.rs b/crates/fractal-api-core/src/api/client_v0/external_grants.rs index f9c4bb13d62..a4e43670642 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants.rs @@ -84,12 +84,20 @@ const ADMISSION_QUERY: &str = CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END))"; +fn admission_now_ms() -> u128 { + #[cfg(test)] + if let Some(now) = tests::ADMISSION_NOW.get() { + return now; + } + client_now_ms() +} + fn admit_profile(state: &AppState, source: &Value) -> Result<(), ApiError> { let profile = Profile::stored(source)?; let principal = principal(source)?; // Without a valid owner the old scan must still surface its configuration // error before examining expiry; do not prefilter those rows. - let expiry_cut = owning_person(state).ok().map(|_| client_now_ms() as u64); + let expiry_cut = owning_person(state).ok().map(|_| admission_now_ms() as u64); let ids = { let connection = state.store.readers.get(); let mut query = connection.prepare(/* sqlite-large-value: allow-for-now lv-h99f1a302c7b1 owner=fractal_api_core::api::client_v0::external_grants TODO=trace-statement-and-value-representation */ ADMISSION_QUERY).map_err(ApiError::internal)?; @@ -105,7 +113,7 @@ fn admit_profile(state: &AppState, source: &Value) -> Result<(), ApiError> { } let policy = effective(state, &grant)?; let active = fields(&policy)?; - if active["expires_at_unix_ms"].as_u64().map(u128::from).unwrap_or(0) > client_now_ms() { + if active["expires_at_unix_ms"].as_u64().map(u128::from).unwrap_or(0) > admission_now_ms() { profile.compatible(Profile::stored(fields(&grant)?)?)?; profile.compatible(Profile::stored(active)?)?; } @@ -311,6 +319,7 @@ mod tests { // the real mutation/session boundary. Production issuable() stays closed. thread_local! { pub(super) static SERVICE_PROFILE: std::cell::Cell = const { std::cell::Cell::new(false) }; + pub(super) static ADMISSION_NOW: std::cell::Cell> = const { std::cell::Cell::new(None) }; } fn concurrent_grants(profiles: [&str; 2]) -> (usize, usize) { @@ -347,6 +356,109 @@ mod tests { (admitted, usable) } + // 98e550cb's Rust-only admission, retained independently as the differential + // oracle. Only its wall clock is substituted so expiry == now is exact. + fn rust_only_admission(state: &AppState, source: &Value) -> Result<(), ApiError> { + let profile = Profile::stored(source)?; + let principal = principal(source)?; + let ids = { + let connection = state.store.readers.get(); + let mut query = connection.prepare( + "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2" + ).map_err(ApiError::internal)?; + query.query_map(rusqlite::params![GRANTED, principal], |row| row.get::<_, String>(0)) + .map_err(ApiError::internal)?.collect::, _>>().map_err(ApiError::internal)? + }; + for id in ids { + let grant = state.store.claim_by_id(&id).map_err(ApiError::internal)? + .ok_or_else(|| forbidden("external grant is absent"))?; + if grant.origin != state.store.origin() || grant.actor.as_deref() != Some(owning_person(state)?) + || latest(state, &grant.subject, REVOKED)?.is_some() { + continue; + } + let policy = effective(state, &grant)?; + let active = fields(&policy)?; + if active["expires_at_unix_ms"].as_u64().map(u128::from).unwrap_or(0) > admission_now_ms() { + profile.compatible(Profile::stored(fields(&grant)?)?)?; + profile.compatible(Profile::stored(active)?)?; + } + } + Ok(()) + } + + #[test] + fn prefiltered_admission_matches_rust_only_reference() { + struct Clock; + impl Drop for Clock { + fn drop(&mut self) { ADMISSION_NOW.set(None); } + } + ADMISSION_NOW.set(Some(100)); + let _clock = Clock; + let cases = [ + ("live", json!({"expires_at_unix_ms":101}), vec![], 0, false, true), + ("expired", json!({"expires_at_unix_ms":99}), vec![], 0, false, false), + ("equal-boundary", json!({"expires_at_unix_ms":100}), vec![], 0, false, false), + ("null-expiry", json!({"expires_at_unix_ms":null}), vec![], 0, false, false), + ("missing-expiry", json!({}), vec![], 0, false, false), + ("replicated-revoke", json!({"expires_at_unix_ms":101}), vec![], 1, true, false), + ("revoke-of-revoke", json!({"expires_at_unix_ms":101}), vec![], 2, false, false), + ("several-policies-live", json!({"expires_at_unix_ms":99}), vec![102, 98, 101], 0, false, true), + ("several-policies-expired", json!({"expires_at_unix_ms":101}), vec![99, 102, 100], 0, false, false), + ("unrelated-principal", json!({"expires_at_unix_ms":101}), vec![], 0, false, false), + ("legacy-default-principal", json!({"expires_at_unix_ms":101}), vec![], 0, false, true), + ]; + for (name, mut source, policies, revokes, replicated, denied) in cases { + let root = tempfile::tempdir().unwrap(); + let mut state = crate::api::tests_shared::state(root.path()); + state.owning_person = Some("person/owner".into()); + source["profile"] = json!("service"); + if name != "legacy-default-principal" { + source["principal"] = json!(if name == "unrelated-principal" { MCP_PRINCIPAL } else { PRINCIPAL }); + } + let subject = format!("custom/client/differential-{name}"); + let append_fixture = |store: &Store, kind: &str, value: Value, previous: Option<&ClaimRecord>| { + store.append_claim(&ClaimInput { + subject:subject.clone(), kind:kind.into(), actor:Some("person/owner".into()), + fields:serde_json::from_value(value).unwrap(), + evidence:previous.map(|claim| vec![claim.id.clone()]).unwrap_or_default(), + expected_subject:None, idempotency_key:None, + }).unwrap() + }; + let mut previous = append_fixture(&state.store, GRANTED, source.clone(), None); + for expiry in policies { + let mut policy = source.clone(); + policy["expires_at_unix_ms"] = json!(expiry); + previous = append_fixture(&state.store, POLICY, policy, Some(&previous)); + } + if replicated { + let peer = Store::open_memory("peer").unwrap(); + let revoke = append_fixture(&peer, REVOKED, source.clone(), None); + state.store.import_replication("peer", &peer.export_replication(0).unwrap()).unwrap(); + let imported = latest(&state, &subject, REVOKED).unwrap().unwrap(); + assert_eq!(imported.id, revoke.id); + assert_eq!(imported.origin, "peer"); + } else { + for _ in 0..revokes { + // The second revoke cites the first revoke, not the grant: + // neither reader may interpret that as restoring authority. + previous = append_fixture(&state.store, REVOKED, source.clone(), Some(&previous)); + } + } + for owner in [Some("person/owner"), None] { + state.owning_person = owner.map(str::to_owned); + for profile in ["assistant", "service"] { + let candidate = json!({"profile":profile,"principal":PRINCIPAL}); + let old = rust_only_admission(&state, &candidate).map_err(|error| error.code); + let new = admit_profile(&state, &candidate).map_err(|error| error.code); + assert_eq!(new, old, "{name}: owner={owner:?}, profile={profile}"); + if owner.is_some() { + assert_eq!(new.is_err(), denied && profile == "assistant", "{name}: expected decision"); + } + } + } + } + } + #[test] fn admission_sql_filters_only_inactive_effective_policies() { let connection = rusqlite::Connection::open_in_memory().unwrap(); diff --git a/crates/fractal/tests/daemon_cost/assistant_admission.rs b/crates/fractal/tests/daemon_cost/assistant_admission.rs index 5fb7dcfbef2..f2c94c35cba 100644 --- a/crates/fractal/tests/daemon_cost/assistant_admission.rs +++ b/crates/fractal/tests/daemon_cost/assistant_admission.rs @@ -27,7 +27,7 @@ use ring::{rand::SystemRandom, signature::{Ed25519KeyPair, KeyPair as _}}; use serde_json::{Value, json}; use tokio::sync::Barrier; -const OWNER: &str = "person/admission-bench"; +const OWNER: &str = "person/bench-operator"; const NODE: &str = "admission-bench"; const GRANTED: &str = "custom.client.assistant.v1.granted"; const INDEX: &str = "claims_assistant_v1_principal_index"; diff --git a/docs/st3/compatibility.md b/docs/st3/compatibility.md index e3f513c4f5a..786b096374d 100644 --- a/docs/st3/compatibility.md +++ b/docs/st3/compatibility.md @@ -148,8 +148,8 @@ This derived access path does not change `STORAGE_VERSION` (20), replication digests: row formats, vocabulary, shared projections and retention semantics are unchanged. It follows the schema-on-open index installation used for the assistant mission-run collection indexes. The first open builds the -index synchronously over retained claims. On dev5 (AMD Ryzen 9 9955HX, -16 cores/32 threads, Linux x86_64), exact index creation on a synthetic +index synchronously over retained claims. On a 16-core x86_64 benchmark host +(AMD Ryzen 9 9955HX, 32 threads, Linux), exact index creation on a synthetic 1,000,000-claim real Store schema took 1.525 seconds and grew the main database by 59,518,976 bytes. This measures index-build work, not complete daemon startup or cold-disk restart time; local history and hardware determine first-open delay. @@ -160,7 +160,7 @@ Admission excludes revoked and effectively expired history in SQL while preserving the latest-policy and malformed-fields validation semantics. SQL work still scales with matching principal history, but inactive records no longer hydrate into Rust. With 10,000 expired grants per principal and concurrent pairing -completions, real authenticated summary GET p95 on dev5 was 54.154 ms +completions, real authenticated summary GET p95 on that benchmark host was 54.154 ms (approval-once) and 46.173 ms (caller-bound-allow), compared with 965.184 ms and 933.049 ms on baseline `98e550cb75` (200 samples per mode). Both indexed modes meet q39's 100 ms budget. The opt-in `daemon_cost::assistant_admission` tests use diff --git a/release-notes/external-grant-admission-index.json b/release-notes/external-grant-admission-index.json index 79b4bd3f2c3..ff04823e236 100644 --- a/release-notes/external-grant-admission-index.json +++ b/release-notes/external-grant-admission-index.json @@ -4,9 +4,9 @@ "replay": {"status": "none", "detail": "No claim rewrite, projection replay or history removal. The SQL expiry filter uses the latest policy, retains missing-fields validation candidates, and preserves legacy absent-principal ChatGPT grants."}, "schema": {"status": "changed", "detail": "Schema-on-open adds claims_assistant_v1_principal_index on claims(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')). This additive derived access path changes neither STORAGE_VERSION (20), RULES_VERSION (26), the registry nor shared projection digests. Existing supported stores install the index automatically; subsequent opens reuse it."}, "rules": {"status": "none", "detail": "Profile admission, grant lifecycle, approval-once consumption, issuer checks and retention semantics are unchanged. Multiple same-profile grants remain allowed; service issuance remains disabled."}, - "compatibility": {"status": "none", "detail": "On dev5 (AMD Ryzen 9 9955HX, 16 cores/32 threads, Linux x86_64), real bound daemon APIs with bearer authentication and one concurrent pairing completion per GET were measured against exact baseline 98e550cb75. With 10000 expired grants per principal and 200 samples per mode, approval-once GET p95 improved from 965.184401 ms to 54.153648 ms; caller-bound-allow improved from 933.049170 ms to 46.173346 ms. Both indexed modes pass q39 <=100 ms. These are in-process production routers over Unix/TCP sockets, not an external daemon-process startup benchmark. SQL work still scales with matching principal history; the index avoids unrelated principals and inactive records no longer hydrate into Rust."}, - "downtime": {"status": "changed", "detail": "The first store open missing the index waits synchronously for its construction. Exact index CREATE DDL on a synthetic 1000000-claim real Store schema took 1524.850241 ms (about 1.525 s) on dev5, AMD Ryzen 9 9955HX, 16 cores/32 threads, Linux 6.18.51 x86_64. Main database size grew from 1421651968 to 1481170944 bytes. This measures index-build startup work only, not complete restart-to-API time or cold-disk startup; allow additional first-open delay according to local history and hardware. Later opens do not rebuild the index."}, + "compatibility": {"status": "none", "detail": "On a 16-core x86_64 benchmark host (AMD Ryzen 9 9955HX, 32 threads, Linux), real bound daemon APIs with bearer authentication and one concurrent pairing completion per GET were measured against exact baseline 98e550cb75. With 10000 expired grants per principal and 200 samples per mode, approval-once GET p95 improved from 965.184401 ms to 54.153648 ms; caller-bound-allow improved from 933.049170 ms to 46.173346 ms. Both indexed modes pass q39 <=100 ms. These are in-process production routers over Unix/TCP sockets, not an external daemon-process startup benchmark. SQL work still scales with matching principal history; the index avoids unrelated principals and inactive records no longer hydrate into Rust."}, + "downtime": {"status": "changed", "detail": "The first store open missing the index waits synchronously for its construction. Exact index CREATE DDL on a synthetic 1000000-claim real Store schema took 1524.850241 ms (about 1.525 s) on a 16-core x86_64 benchmark host (AMD Ryzen 9 9955HX, 32 threads, Linux 6.18.51). This is one measurement on that host, not a guaranteed rate of 1.5 seconds per million rows or a startup-time guarantee. Main database size grew from 1421651968 to 1481170944 bytes. This measures index-build startup work only, not complete restart-to-API time or cold-disk startup; allow additional first-open delay according to local history and hardware. Later opens do not rebuild the index."}, "manual": {"status": "none", "detail": "No operator SQL, data conversion, credential reissue or manual migration is required. Allow the first open to finish index construction."}, - "recovery": {"status": "none", "detail": "Claims and signed bodies are unchanged. Previous binaries can ignore the additional index, which SQLite continues maintaining. An interrupted first-open index build can be completed by normal subsequent schema-on-open installation; no history deletion or repair SQL is needed."}, + "recovery": {"status": "none", "detail": "Claims and signed bodies are unchanged. A binary rollback leaves the index in place: previous binaries can ignore it, and SQLite keeps maintaining it on writes. An interrupted first-open index build can be completed by normal subsequent schema-on-open installation; no history deletion or repair SQL is needed."}, "commits": [] } From 0f1f0ebb700025828d711ed1bdc30ba38bfebffb Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 08:24:44 +0100 Subject: [PATCH 04/10] fix(external-grants): suspend fleet-wide mixed-profile conflicts agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- .../Sources/FractalClient/Models.swift | 19 +- .../fractal-client/Models.generated.ts | 22 ++ .../fractal-client/ReadSchema.generated.ts | 1 + .../fractal-client/Schema.generated.ts | 59 +++- crates/fractal-api-core/src/api.rs | 2 + .../src/api/client_v0/external_grants.rs | 137 +++++++- .../external_grants/conflict_tests.rs | 302 ++++++++++++++++++ .../templates/Models.swift.in | 19 +- .../templates/generated.rs.in | 35 ++ .../templates/lib.rs.in | 1 + crates/fractal-client/src/generated.rs | 35 ++ crates/fractal-client/src/lib.rs | 1 + crates/smallclaims/src/store.rs | 49 +++ .../src/store/membership_query_tests.rs | 115 +++++++ .../client-v0/schemas/client-v0.schema.json | 32 ++ docs/st3/large-value-sites.json | 9 + docs/st3/principals-and-grants.md | 28 +- .../external-grant-profile-conflict.json | 33 ++ 18 files changed, 867 insertions(+), 32 deletions(-) create mode 100644 crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs create mode 100644 release-notes/external-grant-profile-conflict.json diff --git a/clients/swift/FractalClient/Sources/FractalClient/Models.swift b/clients/swift/FractalClient/Sources/FractalClient/Models.swift index ebde03f65ae..a874bcb628c 100644 --- a/clients/swift/FractalClient/Sources/FractalClient/Models.swift +++ b/clients/swift/FractalClient/Sources/FractalClient/Models.swift @@ -153,6 +153,7 @@ public enum ErrorCode: Codable, Sendable, Equatable { case peerTooOld case validationFailed case idempotencyConflict + case grantProfileConflict case agentsPublicationRowTooLarge case attentionMigrated case invalidAnswer, notAnswerable @@ -243,6 +244,7 @@ public enum ErrorCode: Codable, Sendable, Equatable { case "peer-too-old": .peerTooOld case "validation-failed": .validationFailed case "idempotency-conflict": .idempotencyConflict + case "grant-profile-conflict": .grantProfileConflict case "stale-fence": .staleFence case "issuer-required": .issuerRequired case "invalid-answer": .invalidAnswer; case "not-answerable": .notAnswerable @@ -333,6 +335,7 @@ public enum ErrorCode: Codable, Sendable, Equatable { case .peerTooOld: "peer-too-old" case .validationFailed: "validation-failed" case .idempotencyConflict: "idempotency-conflict" + case .grantProfileConflict: "grant-profile-conflict" case .staleFence: "stale-fence" case .issuerRequired: "issuer-required" case .invalidAnswer: "invalid-answer"; case .notAnswerable: "not-answerable" @@ -1485,7 +1488,21 @@ public struct AssistantGrant: Codable, Sendable { public let kind, id, sessionActor, deviceID, keyID, issuer, expiresAt, consentEvidence: String; public let principal: AssistantPrincipal; public let senderClass: AssistantSenderClass; public let scopes: [AssistantScope]; public let policyRevision: UInt64; public let minimalReadMode: AssistantMinimalReadMode; public let recipientAllowlist: [String]; public let disclosureConsent, revoked: Bool /// Owner-provisioned SCG read pins; absent means every assistant read is denied. public let readTrust: AssistantReadTrust? - enum CodingKeys: String, CodingKey { case kind, id, sessionActor = "session_actor", deviceID = "device_id", keyID = "key_id", issuer, expiresAt = "expires_at", consentEvidence = "consent_evidence", principal, senderClass = "sender_class", scopes, policyRevision = "policy_revision", minimalReadMode = "minimal_read_mode", recipientAllowlist = "recipient_allowlist", disclosureConsent = "disclosure_consent", revoked, readTrust = "read_trust" } + public let conflict: GrantProfileConflictWitness? + public let clearedConflicts: [ClearedGrantProfileConflictWitness]? + enum CodingKeys: String, CodingKey { case kind, id, sessionActor = "session_actor", deviceID = "device_id", keyID = "key_id", issuer, expiresAt = "expires_at", consentEvidence = "consent_evidence", principal, senderClass = "sender_class", scopes, policyRevision = "policy_revision", minimalReadMode = "minimal_read_mode", recipientAllowlist = "recipient_allowlist", disclosureConsent = "disclosure_consent", revoked, readTrust = "read_trust", conflict, clearedConflicts = "cleared_conflicts" } +} +public enum ExternalGrantProfile: String, Codable, Sendable { case assistant, service } +public enum GrantProfileConflictCause: String, Codable, Sendable { case revoked, expired } +public struct GrantProfileWitness: Codable, Sendable { + public let grantID: String?; public let origin: String; public let profile: ExternalGrantProfile + enum CodingKeys: String, CodingKey { case grantID = "grant_id", origin, profile } +} +public struct GrantProfileConflictWitness: Codable, Sendable { + public let grants: [GrantProfileWitness] +} +public struct ClearedGrantProfileConflictWitness: Codable, Sendable { + public let grants: [GrantProfileWitness]; public let cause: GrantProfileConflictCause } public struct AssistantGrantPolicy: Codable, Sendable { public let apiVersion, consentEvidence: String; public let scopes: [AssistantScope]; public let expiresInSeconds: UInt64?; public let disclosureConsent: Bool; public let minimalReadMode: AssistantMinimalReadMode; public let recipientAllowlist: [String]? diff --git a/clients/typescript/fractal-client/Models.generated.ts b/clients/typescript/fractal-client/Models.generated.ts index 0a60db76f32..61f1d0cee69 100644 --- a/clients/typescript/fractal-client/Models.generated.ts +++ b/clients/typescript/fractal-client/Models.generated.ts @@ -793,6 +793,8 @@ export type AssistantConversationTimelineRequest = { }; export type AssistantGrant = { + cleared_conflicts?: Array; + conflict?: (GrantProfileConflictWitness | null); consent_evidence: string; device_id: Id; disclosure_consent: boolean; @@ -1237,6 +1239,11 @@ export type Capability = { version: number; }; +export type ClearedGrantProfileConflictWitness = { + cause: GrantProfileConflictCause; + grants: Array; +}; + export type ClientConnection = { actor: string; client?: string | null; @@ -1852,6 +1859,7 @@ export type ErrorCode = ( | "peer-too-old" | "validation-failed" | "idempotency-conflict" + | "grant-profile-conflict" | "legacy-action-receipt-untrusted" | "issuer-required" | "suspend-authored-session-selection" @@ -1926,6 +1934,8 @@ export type ExchangeTransport = { fabric_route?: string; }; +export type ExternalGrantProfile = "assistant" | "service"; + export type FabricGrant = { detail?: string; peer?: string; @@ -1986,6 +1996,18 @@ export type GlassTab = { export type GoldenResourceSet = Array; +export type GrantProfileConflictCause = "revoked" | "expired"; + +export type GrantProfileConflictWitness = { + grants: Array; +}; + +export type GrantProfileWitness = { + grant_id: string | null; + origin: string; + profile: ExternalGrantProfile; +}; + export type HarnessAnswerInput = { positions: Array; }; diff --git a/clients/typescript/fractal-client/ReadSchema.generated.ts b/clients/typescript/fractal-client/ReadSchema.generated.ts index 82a4e23314b..f1ea7df9c79 100644 --- a/clients/typescript/fractal-client/ReadSchema.generated.ts +++ b/clients/typescript/fractal-client/ReadSchema.generated.ts @@ -1698,6 +1698,7 @@ export const ErrorCode = /*#__PURE__*/ (() => openEnum([ "peer-too-old", "validation-failed", "idempotency-conflict", + "grant-profile-conflict", "legacy-action-receipt-untrusted", "issuer-required", "suspend-authored-session-selection", diff --git a/clients/typescript/fractal-client/Schema.generated.ts b/clients/typescript/fractal-client/Schema.generated.ts index d0dc340e5f9..adca8cad969 100644 --- a/clients/typescript/fractal-client/Schema.generated.ts +++ b/clients/typescript/fractal-client/Schema.generated.ts @@ -494,7 +494,41 @@ export const AssistantScope = /*#__PURE__*/ (() => Schema.Literals([ export type AssistantScope = typeof AssistantScope.Type export type AssistantScopeEncoded = typeof AssistantScope.Encoded +export const GrantProfileConflictCause = /*#__PURE__*/ (() => Schema.Literals(["revoked","expired"]).annotate({ identifier: "GrantProfileConflictCause" }))() +export type GrantProfileConflictCause = typeof GrantProfileConflictCause.Type +export type GrantProfileConflictCauseEncoded = typeof GrantProfileConflictCause.Encoded + +export const ExternalGrantProfile = /*#__PURE__*/ (() => Schema.Literals(["assistant","service"]).annotate({ identifier: "ExternalGrantProfile" }))() +export type ExternalGrantProfile = typeof ExternalGrantProfile.Type +export type ExternalGrantProfileEncoded = typeof ExternalGrantProfile.Encoded + +export const GrantProfileWitness = /*#__PURE__*/ (() => Schema.Struct({ + /** Grant ID; null only for legacy local fixtures without an ID. */ + "grant_id": Schema.OptionFromNullOr(Schema.String).annotate({ description: "Grant ID; null only for legacy local fixtures without an ID." }), + "origin": Schema.String, + "profile": ExternalGrantProfile +}).annotate({ identifier: "GrantProfileWitness" }))() +export type GrantProfileWitness = typeof GrantProfileWitness.Type +export type GrantProfileWitnessEncoded = typeof GrantProfileWitness.Encoded + +export const ClearedGrantProfileConflictWitness = /*#__PURE__*/ (() => Schema.Struct({ + "cause": GrantProfileConflictCause, + "grants": Schema.Array(GrantProfileWitness) +}).annotate({ identifier: "ClearedGrantProfileConflictWitness" }))() +export type ClearedGrantProfileConflictWitness = typeof ClearedGrantProfileConflictWitness.Type +export type ClearedGrantProfileConflictWitnessEncoded = typeof ClearedGrantProfileConflictWitness.Encoded + +export const GrantProfileConflictWitness = /*#__PURE__*/ (() => Schema.Struct({ + "grants": Schema.Array(GrantProfileWitness) +}).annotate({ identifier: "GrantProfileConflictWitness" }))() +export type GrantProfileConflictWitness = typeof GrantProfileConflictWitness.Type +export type GrantProfileConflictWitnessEncoded = typeof GrantProfileConflictWitness.Encoded + export const AssistantGrant = /*#__PURE__*/ (() => Schema.Struct({ + /** Revoked or expired opposite-profile witnesses; emitted only when conflict is null. */ + "cleared_conflicts": optionalKey(Schema.Array(ClearedGrantProfileConflictWitness)).annotate({ description: "Revoked or expired opposite-profile witnesses; emitted only when conflict is null." }), + /** Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers. */ + "conflict": Schema.OptionFromOptionalNullOr(GrantProfileConflictWitness, NULL_NONE).annotate({ description: "Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers." }), "consent_evidence": Schema.String.check(Schema.isMinCodePoints(1)).check(Schema.isMaxCodePoints(512)), "device_id": Id, "disclosure_consent": Schema.Boolean, @@ -902,23 +936,25 @@ export const Envelope = /*#__PURE__*/ (() => Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "request_id": RequestId, "snapshot": Snapshot, - "value": Schema.Union([Schema.Struct({ "notes": Schema.Array(DirectiveNote), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "capabilities": Schema.Array(Capability), "event_cursor": Cursor, "grant_expires_at": optionalKey(Timestamp), "grant_id": optionalKey(Id), "grant_kind": optionalKey(Schema.Literals(["person","assistant"])), "kind": Schema.Literal("capabilities"), "limits": Schema.Struct({ "default_assistant_response_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(4096))), "max_arrangement_body_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_folders": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_key_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_name_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_operations": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_placements": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_resource_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangements": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_assistant_response_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(16384))), "max_event_items": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "max_glass_body_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_glass_depth": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_glass_nodes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_glasses": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), /** The longest message body in UTF-8 bytes this daemon takes; absent on older daemons, which take 4096. */ + "value": Schema.Union([Schema.Struct({ "notes": Schema.Array(DirectiveNote), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "capabilities": Schema.Array(Capability), "event_cursor": Cursor, "grant_expires_at": optionalKey(Timestamp), "grant_id": optionalKey(Id), "grant_kind": optionalKey(Schema.Literals(["person","assistant"])), "kind": Schema.Literal("capabilities"), "limits": Schema.Struct({ "default_assistant_response_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(4096))), "max_arrangement_body_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_folders": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_key_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_name_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_operations": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_placements": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangement_resource_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_arrangements": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_assistant_response_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(16384))), "max_event_items": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "max_glass_body_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_glass_depth": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_glass_nodes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "max_glasses": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), /** The longest message body in UTF-8 bytes this daemon takes; absent on older daemons, which take 4096. */ "max_message_bytes": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))).annotate({ description: "The longest message body in UTF-8 bytes this daemon takes; absent on older daemons, which take 4096." }), "max_page_items": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "max_response_bytes": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1024)), "max_wait_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)) }), /** Compile-time build identity of the responding daemon; absent on older servers. */ -"machine_version": optionalKey(Schema.String).annotate({ description: "Compile-time build identity of the responding daemon; absent on older servers." }), "minimal_read_mode": optionalKey(AssistantMinimalReadMode), "oldest_event_cursor": Cursor, "policy_revision": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "principal": optionalKey(AssistantPrincipal), "schemas": Schema.Array(Schema.String.check(Schema.isPattern(URI_REFERENCE, { expected: "an RFC 3986 URI reference" }))).check(Schema.isMinLength(1)), "sender_class": optionalKey(AssistantSenderClass), "session_actor": Id, "transport": Schema.Literals(["unix","fabric-loopback"]), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "actions": Schema.Array(PrivateNotesAction).check(Schema.isMaxLength(1)), "data": PrivateNotesData, "family": Schema.Literal("private-notes"), "live": Schema.Null, "ref": PrivateNotesUri, "schema": Schema.Literal("fractal.private-notes@1"), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "bytes": Schema.Array(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(255))), "changed_at_unix_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))), "latest": optionalKey(Schema.Boolean), "name": optionalKey(Schema.String), "owner": optionalKey(Schema.String), "reference": Schema.String, "size": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))), "version": optionalKey(Schema.String), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "has_more": Schema.Boolean, "history": Schema.Boolean, "items": Schema.Array(DocumentItem), "limit": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "next_cursor": Schema.OptionFromOptionalNullOr(Schema.String, NULL_NONE), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), SchedulesPage, Schema.Struct({ "complete": Schema.Boolean, "references": Schema.Array(DocumentReference), "subject": Schema.String, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "conflicts": Schema.Array(Schema.String), "desired": Schema.suspend(() => CanonicalNode), "desired_revision": Revision, "desired_token": Schema.String.check(Schema.isMinCodePoints(1)), "kdl": Schema.String, "kind": Schema.Literal("subject-definition"), "subject": Schema.String.check(Schema.isPattern(new RegExp("^agent/[^\\s]+$", "u"))), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "declaration": Schema.Record(Schema.String, Schema.Unknown), "kind": Schema.Literal("publication-definition"), "revision": Revision, "subject": Schema.String.check(Schema.isPattern(new RegExp("^(agent|mission|schedule)/[^\\s]+$", "u"))), "token": Schema.String.check(Schema.isMinCodePoints(1)), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ /** Contains removed loop shapes that the current parser rejects. */ -"legacy": Schema.Boolean.annotate({ description: "Contains removed loop shapes that the current parser rejects." }), "mission": Schema.String.check(Schema.isPattern(new RegExp("^mission/[^\\s]+$", "u"))), "published_at": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "revision": Revision, "text": Schema.String, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "agent_id": AgentId, /** Agent declaration supplying the workspace; reached through unambiguous stop predecessors. */ +"machine_version": optionalKey(Schema.String).annotate({ description: "Compile-time build identity of the responding daemon; absent on older servers." }), "minimal_read_mode": optionalKey(AssistantMinimalReadMode), "oldest_event_cursor": Cursor, "policy_revision": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))), "principal": optionalKey(AssistantPrincipal), "schemas": Schema.Array(Schema.String.check(Schema.isPattern(URI_REFERENCE, { expected: "an RFC 3986 URI reference" }))).check(Schema.isMinLength(1)), "sender_class": optionalKey(AssistantSenderClass), "session_actor": Id, "transport": Schema.Literals(["unix","fabric-loopback"]), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "actions": Schema.Array(PrivateNotesAction).check(Schema.isMaxLength(1)), "data": PrivateNotesData, "family": Schema.Literal("private-notes"), "live": Schema.Null, "ref": PrivateNotesUri, "schema": Schema.Literal("fractal.private-notes@1"), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "bytes": Schema.Array(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(255))), "changed_at_unix_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))), "latest": optionalKey(Schema.Boolean), "name": optionalKey(Schema.String), "owner": optionalKey(Schema.String), "reference": Schema.String, "size": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))), "version": optionalKey(Schema.String), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "has_more": Schema.Boolean, "history": Schema.Boolean, "items": Schema.Array(DocumentItem), "limit": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "next_cursor": Schema.OptionFromOptionalNullOr(Schema.String, NULL_NONE), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), SchedulesPage, Schema.Struct({ "complete": Schema.Boolean, "references": Schema.Array(DocumentReference), "subject": Schema.String, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "conflicts": Schema.Array(Schema.String), "desired": Schema.suspend(() => CanonicalNode), "desired_revision": Revision, "desired_token": Schema.String.check(Schema.isMinCodePoints(1)), "kdl": Schema.String, "kind": Schema.Literal("subject-definition"), "subject": Schema.String.check(Schema.isPattern(new RegExp("^agent/[^\\s]+$", "u"))), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "declaration": Schema.Record(Schema.String, Schema.Unknown), "kind": Schema.Literal("publication-definition"), "revision": Revision, "subject": Schema.String.check(Schema.isPattern(new RegExp("^(agent|mission|schedule)/[^\\s]+$", "u"))), "token": Schema.String.check(Schema.isMinCodePoints(1)), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ /** Contains removed loop shapes that the current parser rejects. */ +"legacy": Schema.Boolean.annotate({ description: "Contains removed loop shapes that the current parser rejects." }), "mission": Schema.String.check(Schema.isPattern(new RegExp("^mission/[^\\s]+$", "u"))), "published_at": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "revision": Revision, "text": Schema.String, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "agent_id": AgentId, /** Agent declaration supplying the workspace; reached through unambiguous stop predecessors. */ "declaration_token": Schema.String.annotate({ description: "Agent declaration supplying the workspace; reached through unambiguous stop predecessors." }), /** Selected desired claim, including a stop when the seat is retired. */ "desired_token": Schema.String.annotate({ description: "Selected desired claim, including a stop when the seat is retired." }), "host_id": HostId, "kind": Schema.Literal("agent-workspace"), /** Declared workspace directory on host_id, not the API gateway's filesystem or the harness's internal state directory. */ -"workspace": Schema.String.annotate({ description: "Declared workspace directory on host_id, not the API gateway's filesystem or the harness's internal state directory." }), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.String.check(Schema.makeFilter((value: string) => !new RegExp("^(?:resources|ordered-memberships|assistant\\.(?:attention|missions|agents))$", "u").test(value), { expected: "a string not matching ^(?:resources|ordered-memberships|assistant\\.(?:attention|missions|agents))$" })), "filters": Schema.Record(Schema.String, Schema.String), "items": Schema.Array(Resource), "kind": Schema.Literal("page"), "page": PageInfo, "replicated": optionalKey(ReplicatedNotice), "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("ordered-memberships"), "filters": Schema.Record(Schema.String, Schema.String), "items": Schema.Array(OrderedMembership), "kind": Schema.Literal("page"), "page": PageInfo, "replicated": optionalKey(ReplicatedNotice), "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("resources"), "filters": Schema.Record(Schema.String, Schema.String), "items": Schema.Array(ResourceObservation), "kind": Schema.Literal("page"), "page": PageInfo, "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Resource, Schema.Struct({ /** Present when conversation-blocks.v1 is negotiated; each field names its value, source and as_of */ -"header": optionalKey(ConversationHeader), "items": Schema.Array(TimelineEntry), "kind": Schema.Literal("timeline-page"), "page": PageInfo, "session_id": Id, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ /** Present when conversation-blocks.v1 is negotiated; each field names its value, source and as_of */ -"header": optionalKey(ConversationHeader), "items": Schema.Array(TimelineEntry).check(Schema.isMaxLength(200)), "kind": Schema.Literal("conversation-changes"), "next_cursor": Cursor, "session_id": Id, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "host_id": Id, "incomplete_sources": Schema.Array(Schema.String), "indexed_at": Timestamp, "items": Schema.Array(ConversationSearchHit).check(Schema.isMaxLength(200)), "kind": Schema.Literal("conversation-search"), "page": PageInfo, "refreshing": Schema.Boolean, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "has_more": Schema.Boolean, "items": Schema.Array(ProjectionEvent).check(Schema.isMaxLength(500)), "kind": Schema.Literal("event-page"), "oldest_cursor": Cursor, "resume_cursor": Cursor, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "action_id": Id, "affected_ids": Schema.Array(Id).check(Schema.isUnique()), "arrangement_revision": optionalKey(Revision), "harness_answer": optionalKey(HarnessAnswerResult), "kind": Schema.Literal("action-result"), "membership_revision": optionalKey(Revision), "operation_id": Id, "private_notes": optionalKey(PrivateNotesFence), "snapshot_id": Id, "status": Schema.Literals(["accepted","completed","rejected"]), "terminal_attachment": Schema.OptionFromOptionalNullOr(TerminalAttachment, NULL_NONE), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "acknowledged_event_ids": Schema.Array(ClientDiagnosticUuid).check(Schema.isMaxLength(32)), "accounts": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), PairingChallenge, PairedSession, Schema.Struct({ "consent_evidence": Schema.String.check(Schema.isMinCodePoints(1)).check(Schema.isMaxCodePoints(512)), "device_id": Id, "disclosure_consent": Schema.Boolean, "expires_at": Timestamp, "id": Id, /** Daemon-configured owning person, sealed by the authoritative grant-issuer member at trusted-local begin. */ +"workspace": Schema.String.annotate({ description: "Declared workspace directory on host_id, not the API gateway's filesystem or the harness's internal state directory." }), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.String.check(Schema.makeFilter((value: string) => !new RegExp("^(?:resources|ordered-memberships|assistant\\.(?:attention|missions|agents))$", "u").test(value), { expected: "a string not matching ^(?:resources|ordered-memberships|assistant\\.(?:attention|missions|agents))$" })), "filters": Schema.Record(Schema.String, Schema.String), "items": Schema.Array(Resource), "kind": Schema.Literal("page"), "page": PageInfo, "replicated": optionalKey(ReplicatedNotice), "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("ordered-memberships"), "filters": Schema.Record(Schema.String, Schema.String), "items": Schema.Array(OrderedMembership), "kind": Schema.Literal("page"), "page": PageInfo, "replicated": optionalKey(ReplicatedNotice), "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("resources"), "filters": Schema.Record(Schema.String, Schema.String), "items": Schema.Array(ResourceObservation), "kind": Schema.Literal("page"), "page": PageInfo, "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Resource, Schema.Struct({ /** Present when conversation-blocks.v1 is negotiated; each field names its value, source and as_of */ +"header": optionalKey(ConversationHeader), "items": Schema.Array(TimelineEntry), "kind": Schema.Literal("timeline-page"), "page": PageInfo, "session_id": Id, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ /** Present when conversation-blocks.v1 is negotiated; each field names its value, source and as_of */ +"header": optionalKey(ConversationHeader), "items": Schema.Array(TimelineEntry).check(Schema.isMaxLength(200)), "kind": Schema.Literal("conversation-changes"), "next_cursor": Cursor, "session_id": Id, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "host_id": Id, "incomplete_sources": Schema.Array(Schema.String), "indexed_at": Timestamp, "items": Schema.Array(ConversationSearchHit).check(Schema.isMaxLength(200)), "kind": Schema.Literal("conversation-search"), "page": PageInfo, "refreshing": Schema.Boolean, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "has_more": Schema.Boolean, "items": Schema.Array(ProjectionEvent).check(Schema.isMaxLength(500)), "kind": Schema.Literal("event-page"), "oldest_cursor": Cursor, "resume_cursor": Cursor, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "action_id": Id, "affected_ids": Schema.Array(Id).check(Schema.isUnique()), "arrangement_revision": optionalKey(Revision), "harness_answer": optionalKey(HarnessAnswerResult), "kind": Schema.Literal("action-result"), "membership_revision": optionalKey(Revision), "operation_id": Id, "private_notes": optionalKey(PrivateNotesFence), "snapshot_id": Id, "status": Schema.Literals(["accepted","completed","rejected"]), "terminal_attachment": Schema.OptionFromOptionalNullOr(TerminalAttachment, NULL_NONE), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "acknowledged_event_ids": Schema.Array(ClientDiagnosticUuid).check(Schema.isMaxLength(32)), "accounts": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), PairingChallenge, PairedSession, Schema.Struct({ /** Revoked or expired opposite-profile witnesses; emitted only when conflict is null. */ +"cleared_conflicts": optionalKey(Schema.Array(ClearedGrantProfileConflictWitness)).annotate({ description: "Revoked or expired opposite-profile witnesses; emitted only when conflict is null." }), /** Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers. */ +"conflict": Schema.OptionFromOptionalNullOr(GrantProfileConflictWitness, NULL_NONE).annotate({ description: "Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers." }), "consent_evidence": Schema.String.check(Schema.isMinCodePoints(1)).check(Schema.isMaxCodePoints(512)), "device_id": Id, "disclosure_consent": Schema.Boolean, "expires_at": Timestamp, "id": Id, /** Daemon-configured owning person, sealed by the authoritative grant-issuer member at trusted-local begin. */ "issuer": PersonId, /** SHA-256 of the canonical device public-key string; never a credential digest. */ "key_id": Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-f]{64}$", "u"))).annotate({ description: "SHA-256 of the canonical device public-key string; never a credential digest." }), "kind": Schema.Literal("assistant-grant"), "minimal_read_mode": AssistantMinimalReadMode, "policy_revision": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "principal": AssistantPrincipal, /** Owner-provisioned public pins for SCG read proofs. Absent means every assistant read is denied. */ "read_trust": optionalKey(AssistantReadTrust), /** Stored policy metadata; does not restrict message.send. write.assistant.messages permits any existing agent recipient, never a person. */ -"recipient_allowlist": Schema.Array(Schema.String.check(Schema.isPattern(new RegExp("^agent/.+$", "u")))).annotate({ description: "Stored policy metadata; does not restrict message.send. write.assistant.messages permits any existing agent recipient, never a person." }), "revoked": Schema.Boolean, "scopes": Schema.Array(AssistantScope).check(Schema.isMinLength(1)).check(Schema.isUnique()), "sender_class": AssistantSenderClass, "session_actor": Schema.String.check(Schema.isPattern(new RegExp("^assistant/(?:chatgpt|mcp)/session/.+$", "u"))), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "as_of": Timestamp, "counts": Schema.Struct({ "agent_states": Schema.Record(Schema.String, Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))), "attention": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "mission_states": Schema.Record(Schema.String, Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))) }), "kind": Schema.Literal("assistant-summary"), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("assistant.attention"), "filters": Schema.Record(Schema.String, Schema.Never), "items": Schema.Array(AssistantAttentionItem), "kind": Schema.Literal("page"), "page": PageInfo, "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("assistant.missions"), "filters": Schema.Record(Schema.String, Schema.Never), "items": Schema.Array(AssistantMissionItem), "kind": Schema.Literal("page"), "page": PageInfo, "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("assistant.agents"), "filters": Schema.Record(Schema.String, Schema.Never), "items": Schema.Array(AssistantAgentItem), "kind": Schema.Literal("page"), "page": PageInfo, "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), AssistantContentPage, Schema.Struct({ "columns": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "cursor": Schema.Struct({ "blinking": Schema.Boolean, "column": Schema.Int, "row": Schema.Int, "style": Schema.Literals(["block","underline","bar"]), "visible": Schema.Boolean }), "facts": optionalKey(TerminalFacts), "kind": Schema.Literal("terminal-screen"), "lines": Schema.Array(TerminalLine), "modes": TerminalModes, /** Fence for the next input or resize. */ +"recipient_allowlist": Schema.Array(Schema.String.check(Schema.isPattern(new RegExp("^agent/.+$", "u")))).annotate({ description: "Stored policy metadata; does not restrict message.send. write.assistant.messages permits any existing agent recipient, never a person." }), "revoked": Schema.Boolean, "scopes": Schema.Array(AssistantScope).check(Schema.isMinLength(1)).check(Schema.isUnique()), "sender_class": AssistantSenderClass, "session_actor": Schema.String.check(Schema.isPattern(new RegExp("^assistant/(?:chatgpt|mcp)/session/.+$", "u"))), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "as_of": Timestamp, "counts": Schema.Struct({ "agent_states": Schema.Record(Schema.String, Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))), "attention": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "mission_states": Schema.Record(Schema.String, Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))) }), "kind": Schema.Literal("assistant-summary"), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("assistant.attention"), "filters": Schema.Record(Schema.String, Schema.Never), "items": Schema.Array(AssistantAttentionItem), "kind": Schema.Literal("page"), "page": PageInfo, "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("assistant.missions"), "filters": Schema.Record(Schema.String, Schema.Never), "items": Schema.Array(AssistantMissionItem), "kind": Schema.Literal("page"), "page": PageInfo, "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("assistant.agents"), "filters": Schema.Record(Schema.String, Schema.Never), "items": Schema.Array(AssistantAgentItem), "kind": Schema.Literal("page"), "page": PageInfo, "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), AssistantContentPage, Schema.Struct({ "columns": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "cursor": Schema.Struct({ "blinking": Schema.Boolean, "column": Schema.Int, "row": Schema.Int, "style": Schema.Literals(["block","underline","bar"]), "visible": Schema.Boolean }), "facts": optionalKey(TerminalFacts), "kind": Schema.Literal("terminal-screen"), "lines": Schema.Array(TerminalLine), "modes": TerminalModes, /** Fence for the next input or resize. */ "next_sequence": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).annotate({ description: "Fence for the next input or resize." }), "relay": optionalKey(TerminalRelay), /** Digest of the rest of the screen: equal revisions mean equal screens. */ -"revision": Schema.String.check(Schema.isMinCodePoints(1)).pipe(Schema.brand("st3/ScreenRevision")).annotate({ description: "Digest of the rest of the screen: equal revisions mean equal screens." }), "rows": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "runtime_incarnation": Schema.String, "terminal_id": TerminalId, "title": Schema.String, "truncated": Schema.Boolean, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "complete": Schema.Boolean, "items": Schema.Array(StatusTransition).check(Schema.isMaxLength(200)), "kind": Schema.Literal("status-history"), "retained_from": Timestamp, "seat": AgentId, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "agent_id": Id, "current_work_ids": Schema.Array(Id), "kind": Schema.Literal("agent-queue"), "move_count": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "moves": Schema.Array(AgentQueueMove), "next_work_id": Schema.OptionFromNullOr(Id), "runs": Schema.Array(AgentQueueRun), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), AgentRelatedRuns, Schema.Struct({ /** Every declared account in name order, so each panel lists the same accounts. Absent on older servers. */ -"accounts": optionalKey(Schema.Array(UsageAccount)).annotate({ description: "Every declared account in name order, so each panel lists the same accounts. Absent on older servers." }), "agent_messages": optionalKey(AgentMessageEstimate), "limits": optionalKey(Schema.Array(UsageLimit)), "rows": Schema.Array(UsageRow), "since_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "until_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "cleanup_command": Schema.String, "count": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "threshold_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "as_of_unix_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), /** Where a person reads the exported observation history, from the daemon's [observations.otlp] ui_url. Absent when none is configured. */ -"otel_ui_url": optionalKey(Schema.String).annotate({ description: "Where a person reads the exported observation history, from the daemon's [observations.otlp] ui_url. Absent when none is configured." }), "rows": Schema.Array(SloRow), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "id": Schema.String, "samples": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "since_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "steps": Schema.Array(Schema.NullOr(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100)))), "until_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) })], { mode: "oneOf" }) +"revision": Schema.String.check(Schema.isMinCodePoints(1)).pipe(Schema.brand("st3/ScreenRevision")).annotate({ description: "Digest of the rest of the screen: equal revisions mean equal screens." }), "rows": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "runtime_incarnation": Schema.String, "terminal_id": TerminalId, "title": Schema.String, "truncated": Schema.Boolean, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "complete": Schema.Boolean, "items": Schema.Array(StatusTransition).check(Schema.isMaxLength(200)), "kind": Schema.Literal("status-history"), "retained_from": Timestamp, "seat": AgentId, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "agent_id": Id, "current_work_ids": Schema.Array(Id), "kind": Schema.Literal("agent-queue"), "move_count": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "moves": Schema.Array(AgentQueueMove), "next_work_id": Schema.OptionFromNullOr(Id), "runs": Schema.Array(AgentQueueRun), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), AgentRelatedRuns, Schema.Struct({ /** Every declared account in name order, so each panel lists the same accounts. Absent on older servers. */ +"accounts": optionalKey(Schema.Array(UsageAccount)).annotate({ description: "Every declared account in name order, so each panel lists the same accounts. Absent on older servers." }), "agent_messages": optionalKey(AgentMessageEstimate), "limits": optionalKey(Schema.Array(UsageLimit)), "rows": Schema.Array(UsageRow), "since_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "until_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "cleanup_command": Schema.String, "count": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "threshold_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "as_of_unix_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), /** Where a person reads the exported observation history, from the daemon's [observations.otlp] ui_url. Absent when none is configured. */ +"otel_ui_url": optionalKey(Schema.String).annotate({ description: "Where a person reads the exported observation history, from the daemon's [observations.otlp] ui_url. Absent when none is configured." }), "rows": Schema.Array(SloRow), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "id": Schema.String, "samples": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "since_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "steps": Schema.Array(Schema.NullOr(Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100)))), "until_ms": Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) })], { mode: "oneOf" }) }).annotate({ identifier: "Envelope" }))() export type Envelope = typeof Envelope.Type export type EnvelopeEncoded = typeof Envelope.Encoded @@ -1000,6 +1036,7 @@ export const ErrorEnvelope = /*#__PURE__*/ (() => Schema.Union([ Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("peer-too-old"), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("validation-failed"), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("idempotency-conflict"), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), + Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("grant-profile-conflict"), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("legacy-action-receipt-untrusted"), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("issuer-required"), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("suspend-authored-session-selection"), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), @@ -1042,7 +1079,7 @@ export const ErrorEnvelope = /*#__PURE__*/ (() => Schema.Union([ Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("invalid-answer"), "details": HarnessInvalidAnswerDetails, "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("not-answerable"), "details": HarnessNotAnswerableDetails, "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": Schema.Literal("internal"), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }), - Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": unknownCase(["recipient-retired","agents-publication-row-too-large","identity-cycle","identity-occupied","identity-retired-source","identity-cross-kind","identity-unknown","lifecycle-unavailable","retirement-upgrade-required","retire-revision-mismatch","retire-incarnation-mismatch","invalid-custody-successor","custody-pending","attention-migrated","arrangement-exists","arrangement-folder-exists","arrangement-retired","arrangement-limit","arrangement-folder-deleted","arrangement-cycle","arrangement-body-too-large","arrangement-owner-forbidden","invalid-arrangement-subject","invalid-arrangement-action","invalid-arrangement-operations","invalid-arrangement-folder","invalid-arrangement-name","invalid-arrangement-key","invalid-arrangement-version","invalid-arrangement-body","unsupported-membership-container","membership-owner-forbidden","invalid-membership-member","invalid-membership-bucket","invalid-membership-key","invalid-membership-operations","membership-edit-too-large","invalid-subject-reference","not-found","forbidden","unsupported-capability","peer-too-old","validation-failed","idempotency-conflict","legacy-action-receipt-untrusted","issuer-required","suspend-authored-session-selection","stale-fence","cursor-gap","page-cursor-expired","agent-roster-not-ready","agent-roster-cut-not-ready","message-selectors-not-ready","rate-limited","runtime-not-local","runtime-authority-indeterminate","runtime-list-not-ready","runtime-list-ended","remote-unavailable","terminal-unavailable","inventory-unavailable","terminal-ended","timeline-history-incomplete","projection-detail-too-large","projection-detail-invalid-source","conversation-content-invalidated","transcript-unavailable","blob-too-large","unsupported-media-type","blob-content-mismatch","blob-quota-exceeded","blob-not-found","blob-expired","message-too-large","message-store-full","long-message-signature-unsupported","response-budget-exceeded","content-not-text","invalid-document-reference","document-not-synced","private-notes-unreachable","private-notes-carrier-conflict","private-notes-indeterminate","invalid-answer","not-answerable","internal"]), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }) + Schema.Struct({ "api_version": Schema.Literals(["st3.client.v0","fractal.client.v0"]), "applied": optionalKey(Schema.Literals(["none","unknown"])), "code": unknownCase(["recipient-retired","agents-publication-row-too-large","identity-cycle","identity-occupied","identity-retired-source","identity-cross-kind","identity-unknown","lifecycle-unavailable","retirement-upgrade-required","retire-revision-mismatch","retire-incarnation-mismatch","invalid-custody-successor","custody-pending","attention-migrated","arrangement-exists","arrangement-folder-exists","arrangement-retired","arrangement-limit","arrangement-folder-deleted","arrangement-cycle","arrangement-body-too-large","arrangement-owner-forbidden","invalid-arrangement-subject","invalid-arrangement-action","invalid-arrangement-operations","invalid-arrangement-folder","invalid-arrangement-name","invalid-arrangement-key","invalid-arrangement-version","invalid-arrangement-body","unsupported-membership-container","membership-owner-forbidden","invalid-membership-member","invalid-membership-bucket","invalid-membership-key","invalid-membership-operations","membership-edit-too-large","invalid-subject-reference","not-found","forbidden","unsupported-capability","peer-too-old","validation-failed","idempotency-conflict","grant-profile-conflict","legacy-action-receipt-untrusted","issuer-required","suspend-authored-session-selection","stale-fence","cursor-gap","page-cursor-expired","agent-roster-not-ready","agent-roster-cut-not-ready","message-selectors-not-ready","rate-limited","runtime-not-local","runtime-authority-indeterminate","runtime-list-not-ready","runtime-list-ended","remote-unavailable","terminal-unavailable","inventory-unavailable","terminal-ended","timeline-history-incomplete","projection-detail-too-large","projection-detail-invalid-source","conversation-content-invalidated","transcript-unavailable","blob-too-large","unsupported-media-type","blob-content-mismatch","blob-quota-exceeded","blob-not-found","blob-expired","message-too-large","message-store-full","long-message-signature-unsupported","response-budget-exceeded","content-not-text","invalid-document-reference","document-not-synced","private-notes-unreachable","private-notes-carrier-conflict","private-notes-indeterminate","invalid-answer","not-answerable","internal"]), "details": Schema.StructWithRest(Schema.Struct({ "applied": optionalKey(Schema.Literals(["none","unknown"])), "refusal": optionalKey(MessageSendRefusal) }), [Schema.Record(Schema.String, Schema.Unknown)]), "error_version": Schema.Literals(["st3.client.error.v0","fractal.client.error.v0"]), "message": Schema.String, "request_id": Id, "retry_after_ms": optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.decodeTo(Schema.Duration.check(durationMillisRange), wholeUnits(1)))), "retryable": Schema.Boolean }) ], { mode: "oneOf" }).annotate({ identifier: "ErrorEnvelope" }))() export type ErrorEnvelope = typeof ErrorEnvelope.Type export type ErrorEnvelopeEncoded = typeof ErrorEnvelope.Encoded diff --git a/crates/fractal-api-core/src/api.rs b/crates/fractal-api-core/src/api.rs index e8991a938c8..853d4868794 100644 --- a/crates/fractal-api-core/src/api.rs +++ b/crates/fractal-api-core/src/api.rs @@ -474,6 +474,7 @@ impl ApiError { | "stale-subject" | "stale-fence" | "idempotency-conflict" + | "grant-profile-conflict" | "private-notes-carrier-conflict" | "owned-set-refused" | "set-managed-subject" @@ -1993,6 +1994,7 @@ pub fn client_error_code(code: Option<&str>) -> String { | "peer-too-old" | "validation-failed" | "idempotency-conflict" + | "grant-profile-conflict" | "invalid-answer" | "not-answerable" | "idempotency-key-expired" diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants.rs b/crates/fractal-api-core/src/api/client_v0/external_grants.rs index f9c4bb13d62..e1140d4cbce 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants.rs @@ -68,11 +68,10 @@ fn digest_only(source: &Value) -> Result<(), ApiError> { Ok(()) } -// Issuance-only scan: authentication retains its existing indexed lookup and reads. +// Admission and authentication share the principal-indexed active-grant fold. // append owns the admission lock; several grants of the same profile are allowed. // Filter revoked/expired history before loading claim bodies into Rust. Expiry -// uses the latest policy, not the original grant. Keep malformed missing fields -// in the result so the existing validation below still reports them. +// uses the latest policy, not the original grant. const ADMISSION_QUERY: &str = "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 AND (?5 IS NULL OR NOT EXISTS (SELECT 1 FROM claims AS revoked WHERE revoked.subject=claims.subject AND revoked.kind=?3)) @@ -84,30 +83,112 @@ const ADMISSION_QUERY: &str = CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END))"; -fn admit_profile(state: &AppState, source: &Value) -> Result<(), ApiError> { - let profile = Profile::stored(source)?; - let principal = principal(source)?; - // Without a valid owner the old scan must still surface its configuration - // error before examining expiry; do not prefilter those rows. - let expiry_cut = owning_person(state).ok().map(|_| client_now_ms() as u64); +fn candidate_grants(state: &AppState, principal: &str, expiry_cut: Option) -> Result, ApiError> { + let owner = owning_person(state)?; let ids = { let connection = state.store.readers.get(); let mut query = connection.prepare(/* sqlite-large-value: allow-for-now lv-h99f1a302c7b1 owner=fractal_api_core::api::client_v0::external_grants TODO=trace-statement-and-value-representation */ ADMISSION_QUERY).map_err(ApiError::internal)?; query.query_map(rusqlite::params![GRANTED, principal, REVOKED, POLICY, expiry_cut], |row| row.get::<_, String>(0)) .map_err(ApiError::internal)?.collect::, _>>().map_err(ApiError::internal)? }; + let mut active = Vec::new(); for id in ids { let grant = state.store.claim_by_id(&id).map_err(ApiError::internal)? .ok_or_else(|| forbidden("external grant is absent"))?; - if grant.origin != state.store.origin() || grant.actor.as_deref() != Some(owning_person(state)?) - || latest(state, &grant.subject, REVOKED)?.is_some() { + if grant.actor.as_deref() != Some(owner) + || (expiry_cut.is_some() && latest(state, &grant.subject, REVOKED)?.is_some()) { continue; } let policy = effective(state, &grant)?; - let active = fields(&policy)?; - if active["expires_at_unix_ms"].as_u64().map(u128::from).unwrap_or(0) > client_now_ms() { - profile.compatible(Profile::stored(fields(&grant)?)?)?; - profile.compatible(Profile::stored(active)?)?; + let foreign = grant.origin != state.store.origin(); + // Custom fields are open at replication admission. Actor/origin strings + // alone therefore confer no authority to suspend another credential. + // Only well-formed owner grants carried by a signed, admitted issuer + // count; policies must have the same provenance and immutable identity. + if foreign && (!valid_foreign_grant(state, &grant, &policy)? + || !state.store.claim_has_authenticated_member_writer(&grant.id).map_err(ApiError::internal)? + || (policy.id != grant.id && !state.store.claim_has_authenticated_member_writer(&policy.id).map_err(ApiError::internal)?)) { + continue; + } + let source = fields(&policy)?; + if expiry_cut.is_none_or(|now| unexpired(source, now)) { + let profile = Profile::stored(fields(&grant)?)?; + profile.compatible(Profile::stored(source)?)?; + active.push((grant, profile)); + } + } + Ok(active) +} + +fn unexpired(source: &Value, now: u64) -> bool { + source["expires_at_unix_ms"].as_u64().is_some_and(|expires| expires > now) +} + +fn valid_foreign_grant(state: &AppState, grant: &ClaimRecord, policy: &ClaimRecord) -> Result { + let validate = || -> Result<(), ApiError> { + let original = fields(grant)?; + let source = fields(policy)?; + let principal = principal(original)?; + let id = original["grant_id"].as_str().ok_or_else(|| forbidden("grant ID absent"))?; + if subject(id)? != grant.subject || policy.origin != grant.origin + || policy.actor.as_deref() != Some(owning_person(state)?) + || self::principal(source)? != principal + || ["grant_id", "session_actor", "issuer", "profile"].iter().any(|key| source[*key] != original[*key]) + || source["issuer"] != owning_person(state)? + || source["session_actor"].as_str().and_then(|actor| actor.strip_prefix(principal)) + .and_then(|suffix| suffix.strip_prefix("/session/")) != Some(id) + || !matches!(source["minimal_read_mode"].as_str(), Some("approval-once" | "caller-bound-allow")) + || source["disclosure_consent"] != true + || !original["credential_hash"].as_str().is_some_and(|digest| digest.len() == 64 + && digest.bytes().all(|byte| byte.is_ascii_hexdigit())) + || !source["scopes"].as_array().is_some_and(|scopes| + scopes.iter().all(|scope| scope.as_str().is_some_and(|scope| SCOPES.contains(&scope)))) { + return Err(forbidden("invalid foreign external grant")); + } + digest_only(original)?; + digest_only(source)?; + Profile::stored(original)?.compatible(Profile::stored(source)?)?; + Ok(()) + }; + Ok(validate().is_ok()) +} + +fn witness(grant: &ClaimRecord, profile: Profile) -> Value { + json!({"grant_id":fields(grant).ok().and_then(|source| source.get("grant_id")), + "origin":grant.origin,"profile":match profile { Profile::Assistant => "assistant", Profile::Service => "service" }}) +} + +fn conflict_error(witness: Value) -> ApiError { + ApiError { + status: StatusCode::CONFLICT, + code: "grant-profile-conflict".into(), + message: "principal has active grants of opposite profiles; revoke one to clear the conflict".into(), + details: Box::new(serde_json::Map::from_iter([("conflict".into(), witness)])), + } +} + +#[cfg(test)] +pub fn profile_conflict(state: &AppState, granted: &ClaimRecord) -> Result, ApiError> { + profile_conflict_at(state, granted, client_now_ms() as u64) +} + +fn profile_conflict_at(state: &AppState, granted: &ClaimRecord, now: u64) -> Result, ApiError> { + let active = candidate_grants(state, principal(fields(granted)?)?, Some(now))?; + let Some((grant, profile)) = active.iter().find(|(grant, _)| grant.id == granted.id) else { + return Ok(None); + }; + Ok(active.iter().find(|(_, other)| other != profile).map(|(other, other_profile)| + json!({"grants":[witness(grant, *profile),witness(other, *other_profile)]}))) +} + +fn admit_profile(state: &AppState, source: &Value) -> Result<(), ApiError> { + let profile = Profile::stored(source)?; + for (grant, other) in candidate_grants(state, principal(source)?, Some(client_now_ms() as u64))? { + if profile != other { + return Err(conflict_error(json!({"grants":[ + {"grant_id":source["grant_id"],"origin":state.store.origin(), + "profile":match profile { Profile::Assistant => "assistant", Profile::Service => "service" }}, + witness(&grant, other)]}))); } } Ok(()) @@ -235,6 +316,23 @@ pub fn projection(state: &AppState, granted: &ClaimRecord) -> Result Result { + let now = client_now_ms() as u64; + if let Some(witness) = profile_conflict_at(state, granted, now)? { + return Err(conflict_error(witness)); + } let policy = effective(state, granted)?; let source = fields(&policy)?; let principal = principal(source)?; @@ -268,7 +370,7 @@ pub fn session(state: &AppState, granted: &ClaimRecord, transport: &'static str) return Err(forbidden("assistant requests require the authoritative grant issuer")); } if latest(state, &granted.subject, REVOKED)?.is_some() - || source["expires_at_unix_ms"].as_u64().map(u128::from).unwrap_or(0) <= client_now_ms() + || !unexpired(source, now) || source["issuer"] != owning_person(state)? || !matches!(source["minimal_read_mode"].as_str(), Some("approval-once" | "caller-bound-allow")) || source["disclosure_consent"] != true { return Err(forbidden("assistant grant was revoked, expired, or has invalid policy")); @@ -303,6 +405,9 @@ pub fn authorize_route(session: &ClientSession, request: &Request) -> Resu Ok(()) } +#[cfg(test)] +mod conflict_tests; + #[cfg(test)] mod tests { use super::*; diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs b/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs new file mode 100644 index 00000000000..3e262da596e --- /dev/null +++ b/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs @@ -0,0 +1,302 @@ +use super::*; +use fractal_client::ErrorCode; +use smallclaims::fleet::MemberKey; +use std::sync::Arc; + +const FLEET: &str = "86700000-0000-4000-8000-000000000001"; +const OWNER: &str = "person/owner"; +const ASSISTANT_ID: &str = "111111111111111111111111"; +const SERVICE_ID: &str = "222222222222222222222222"; + +// This override is thread-local: the reserved service profile remains closed in +// production, and another test thread cannot accidentally inherit the fixture. +struct ServiceFixture; +impl ServiceFixture { + fn enable() -> Self { + assert!(!tests::SERVICE_PROFILE.replace(true)); + Self + } +} +impl Drop for ServiceFixture { + fn drop(&mut self) { + tests::SERVICE_PROFILE.set(false); + } +} + +fn member(root: &std::path::Path, name: &str) -> AppState { + let mut state = crate::api::tests_shared::state(root); + state.store = Arc::new(Store::open_memory(name).unwrap()); + state.node = name.into(); + state.owning_person = Some(OWNER.into()); + state.fleet_id = Some(FLEET.into()); + state.store.bind_fleet(FLEET).unwrap(); + state +} + +fn replicate(from: &AppState, to: &AppState) { + let exchange = from.store.export_replication_exchange_answering( + FLEET, &to.store.replication_inventory().unwrap(), + &to.store.replication_signature_requests().unwrap(), + ).unwrap(); + to.store.receive_replication_exchange(from.store.origin(), FLEET, &exchange).unwrap(); + to.store.validate_replication_backlog().unwrap(); + to.store.project_replication_backlog().unwrap(); +} + +fn admitted_pair(root: &std::path::Path) -> (AppState, AppState) { + let a = member(root, "alder"); + let b = member(root, "birch"); + let anchor = Arc::new(MemberKey::generate().unwrap().0); + let peer = Arc::new(MemberKey::generate().unwrap().0); + for (state, key) in [(&a, &anchor), (&b, &peer)] { + state.store.pin_fleet_anchor(anchor.public()).unwrap(); + state.store.set_member_key(Some(key.clone())).unwrap(); + } + a.store.admit_fleet_anchor(FLEET, anchor.public(), "listening").unwrap(); + raw_claim(&a, "host/birch", "fleet.member-admitted", OWNER, json!({ + "fleet_id":FLEET,"member_key":peer.public(),"via":"invite","mode":"listening" + })); + replicate(&a, &b); + assert!(matches!(b.store.fleet_membership().unwrap().state("birch"), + smallclaims::fleet::MemberState::Current(_))); + (a, b) +} + +fn grant_fields(id: &str, profile: &str) -> Value { + json!({"profile":profile,"grant_id":id,"principal":PRINCIPAL, + "issuer":OWNER,"session_actor":format!("{PRINCIPAL}/session/{id}"), + "expires_at_unix_ms":u64::MAX,"minimal_read_mode":"approval-once", + "disclosure_consent":true,"scopes":["read.assistant.summary"], + "credential_hash":credential_digest(id)}) +} + +fn issue(state: &AppState, id: &str, profile: &str) -> Result { + let source = grant_fields(id, profile); + let subject = subject(id).unwrap(); + let begun = append(state, subject.clone(), BEGUN, OWNER, source.clone(), None)?; + append(state, subject, GRANTED, OWNER, source, Some(&begun)) +} + +fn raw_claim(state: &AppState, subject: &str, kind: &str, actor: &str, source: Value) -> ClaimRecord { + state.store.append_claim(&ClaimInput { + subject:subject.into(),kind:kind.into(),actor:Some(actor.into()), + fields:serde_json::from_value(source).unwrap(),evidence:Vec::new(), + expected_subject:None,idempotency_key:None, + }).unwrap() +} + +fn authenticate_id(state: &AppState, id: &str) -> Result, ApiError> { + authenticate(state, &credential_digest(id), "http") +} + +fn assert_conflict(error: &ApiError) { + let typed: ErrorCode = serde_json::from_value(json!(error.code)).unwrap(); + assert_eq!(typed, ErrorCode::GrantProfileConflict); + assert_eq!(error.status, StatusCode::CONFLICT); +} + +fn assert_witness(value: &Value) { + let rows = value["grants"].as_array().unwrap(); + assert_eq!(rows.len(), 2); + for (id, origin, profile) in [(ASSISTANT_ID, "alder", "assistant"), + (SERVICE_ID, "birch", "service")] { + assert!(rows.contains(&json!({"grant_id":id,"origin":origin,"profile":profile})), + "missing grant witness: {value}"); + } +} + +#[test] +fn disconnected_opposite_profiles_conflict_on_both_members_and_revocation_recovers() { + let _service = ServiceFixture::enable(); + let root = tempfile::tempdir().unwrap(); + let (a, b) = admitted_pair(root.path()); + let assistant = issue(&a, ASSISTANT_ID, "assistant").unwrap(); + let service = issue(&b, SERVICE_ID, "service").unwrap(); + assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some()); + assert!(authenticate_id(&b, SERVICE_ID).unwrap().is_some()); + replicate(&a, &b); + replicate(&b, &a); + for state in [&a, &b] { + for grant in [&assistant, &service] { + assert!(state.store.claim_has_authenticated_member_writer(&grant.id).unwrap()); + let error = authenticate_id(state, fields(grant).unwrap()["grant_id"].as_str().unwrap()) + .err().expect("both credentials must be suspended on either member"); + assert_conflict(&error); + assert_witness(&Value::Object((*error.details).clone())["conflict"]); + assert_witness(&profile_conflict(state, grant).unwrap().unwrap()); + assert_witness(&projection(state, grant).unwrap()["conflict"]); + } + } + append(&b, service.subject.clone(), REVOKED, OWNER, + fields(&service).unwrap().clone(), Some(&service)).unwrap(); + replicate(&b, &a); + for state in [&a, &b] { + for grant in [&assistant, &service] { + assert!(profile_conflict(state, grant).unwrap().is_none()); + assert!(projection(state, grant).unwrap()["conflict"].is_null()); + } + assert!(authenticate_id(state, SERVICE_ID).is_err()); + let inspected = projection(state, &assistant).unwrap(); + let cleared = inspected["cleared_conflicts"].as_array().unwrap(); + assert_eq!(cleared.len(), 1); + assert_eq!(cleared[0]["cause"], "revoked"); + assert_witness(&cleared[0]); + } + assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some()); + let foreign = authenticate_id(&b, ASSISTANT_ID).err().unwrap(); + assert_eq!(foreign.code, "forbidden"); + assert!(foreign.message.contains("authoritative grant issuer")); +} + +#[test] +fn expiry_boundary_clears_conflict_and_disconnected_reissue_recomputes_it() { + let _service = ServiceFixture::enable(); + let root = tempfile::tempdir().unwrap(); + let (a, b) = admitted_pair(root.path()); + let assistant = issue(&a, ASSISTANT_ID, "assistant").unwrap(); + let service = issue(&b, SERVICE_ID, "service").unwrap(); + // Birch never receives Alder's assistant grant: it remains a disconnected + // issuer even as Alder receives its grants and policy transitions. + replicate(&b, &a); + assert_witness(&profile_conflict(&a, &assistant).unwrap().unwrap()); + + let mut policy = fields(&service).unwrap().clone(); + policy["expires_at_unix_ms"] = json!(100_u64); + append(&b, service.subject.clone(), POLICY, OWNER, policy, Some(&service)).unwrap(); + replicate(&b, &a); + for (now, expected_count, conflicted) in [(99_u64, 2, true), (100, 1, false), (101, 1, false)] { + let candidates = candidate_grants(&a, PRINCIPAL, Some(now)).unwrap(); + assert_eq!(candidates.len(), expected_count, "SQL/Rust expiry boundary at {now}"); + assert_eq!(candidates.iter().any(|(grant, _)| grant.id == service.id), conflicted); + assert_eq!(profile_conflict_at(&a, &assistant, now).unwrap().is_some(), conflicted); + assert_eq!(profile_conflict_at(&a, &service, now).unwrap().is_some(), conflicted); + assert_eq!(unexpired(fields(&effective(&a, &service).unwrap()).unwrap(), now), conflicted); + } + assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some()); + let inspected = projection(&a, &assistant).unwrap(); + assert!(inspected["conflict"].is_null()); + let cleared = inspected["cleared_conflicts"].as_array().unwrap(); + assert_eq!(cleared.len(), 1); + assert_eq!(cleared[0]["cause"], "expired"); + assert_witness(&cleared[0]); + + let replacement_id = "333333333333333333333333"; + let replacement = issue(&b, replacement_id, "service").unwrap(); + replicate(&b, &a); + let witness = profile_conflict(&a, &assistant).unwrap().unwrap(); + let rows = witness["grants"].as_array().unwrap(); + assert_eq!(rows.len(), 2); + assert!(rows.contains(&json!({"grant_id":ASSISTANT_ID,"origin":"alder","profile":"assistant"}))); + assert!(rows.contains(&json!({"grant_id":replacement_id,"origin":"birch","profile":"service"}))); + assert!(!rows.iter().any(|row| row["grant_id"] == SERVICE_ID)); + assert!(profile_conflict(&a, &service).unwrap().is_none()); + assert!(profile_conflict(&a, &replacement).unwrap().is_some()); + for id in [ASSISTANT_ID, replacement_id] { + assert_conflict(&authenticate_id(&a, id).err().unwrap()); + } + let inspected = projection(&a, &assistant).unwrap(); + assert_eq!(inspected["conflict"], witness); + assert!(inspected["cleared_conflicts"].is_null()); +} + +#[test] +fn same_profile_foreign_grants_do_not_conflict_or_authenticate_on_the_wrong_member() { + let root = tempfile::tempdir().unwrap(); + let (a, b) = admitted_pair(root.path()); + let first = issue(&a, ASSISTANT_ID, "assistant").unwrap(); + let second = issue(&b, SERVICE_ID, "assistant").unwrap(); + replicate(&a, &b); + replicate(&b, &a); + for state in [&a, &b] { + for grant in [&first, &second] { + assert!(profile_conflict(state, grant).unwrap().is_none()); + } + } + assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some()); + assert!(authenticate_id(&b, SERVICE_ID).unwrap().is_some()); + assert_eq!(authenticate_id(&a, SERVICE_ID).err().unwrap().code, "forbidden"); + assert_eq!(authenticate_id(&b, ASSISTANT_ID).err().unwrap().code, "forbidden"); +} + +#[test] +fn admission_refuses_a_known_authenticated_foreign_opposite_profile() { + let _service = ServiceFixture::enable(); + let root = tempfile::tempdir().unwrap(); + let (a, b) = admitted_pair(root.path()); + issue(&b, SERVICE_ID, "service").unwrap(); + replicate(&b, &a); + let error = issue(&a, ASSISTANT_ID, "assistant").err().unwrap(); + assert_conflict(&error); + assert_witness(&Value::Object((*error.details).clone())["conflict"]); + assert!(latest(&a, &subject(ASSISTANT_ID).unwrap(), GRANTED).unwrap().is_none()); +} + +#[test] +fn malformed_authenticated_foreign_grants_cannot_suspend_a_local_credential() { + let root = tempfile::tempdir().unwrap(); + // Each case is independently a signed admitted writer's claim, rather than + // an unsigned claim rejected before it can exercise the conflict scanner. + for invalid in ["profile", "grant_id", "principal", "issuer", "session_actor", + "minimal_read_mode", "disclosure_consent", "scopes", "credential_hash", "actor"] { + let (a, b) = admitted_pair(root.path()); + let local = issue(&a, ASSISTANT_ID, "assistant").unwrap(); + let mut source = grant_fields(SERVICE_ID, "service"); + if invalid != "actor" { + source[invalid] = Value::Null; + } + let foreign = raw_claim(&b, &subject(SERVICE_ID).unwrap(), GRANTED, + if invalid == "actor" { "person/attacker" } else { OWNER }, source); + replicate(&b, &a); + assert!(a.store.claim_by_id(&foreign.id).unwrap().is_some(), "{invalid}"); + assert!(a.store.claim_has_authenticated_member_writer(&foreign.id).unwrap(), "{invalid}"); + assert!(profile_conflict(&a, &local).unwrap().is_none(), "{invalid}"); + assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some(), "{invalid}"); + } +} + +#[test] +fn foreign_policy_with_mismatched_identity_cannot_suspend_a_local_credential() { + let _service = ServiceFixture::enable(); + let root = tempfile::tempdir().unwrap(); + let (a, b) = admitted_pair(root.path()); + let local = issue(&a, ASSISTANT_ID, "assistant").unwrap(); + let foreign = issue(&b, SERVICE_ID, "service").unwrap(); + let mut policy = fields(&foreign).unwrap().clone(); + policy["session_actor"] = json!("assistant/chatgpt/session/333333333333333333333333"); + raw_claim(&b, &foreign.subject, POLICY, OWNER, policy); + replicate(&b, &a); + assert!(profile_conflict(&a, &local).unwrap().is_none()); + assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some()); +} + +#[test] +fn unverifiable_foreign_grant_cannot_suspend_a_local_credential() { + let root = tempfile::tempdir().unwrap(); + // Legacy replication projects unsigned envelopes. Mere visibility and an + // owner-shaped actor are not sufficient provenance for a conflict witness. + let a = member(root.path(), "alder"); + let b = member(root.path(), "birch"); + let local = issue(&a, ASSISTANT_ID, "assistant").unwrap(); + let foreign = raw_claim(&b, &subject(SERVICE_ID).unwrap(), GRANTED, OWNER, + grant_fields(SERVICE_ID, "service")); + replicate(&b, &a); + assert!(a.store.claim_by_id(&foreign.id).unwrap().is_some()); + assert!(!a.store.claim_has_authenticated_member_writer(&foreign.id).unwrap()); + assert!(profile_conflict(&a, &local).unwrap().is_none()); + assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some()); +} + +#[test] +fn admission_scan_uses_the_real_principal_index() { + let root = tempfile::tempdir().unwrap(); + let state = member(root.path(), "alder"); + issue(&state, ASSISTANT_ID, "assistant").unwrap(); + let connection = state.store.readers.get(); + let mut query = connection.prepare(/* sqlite-large-value: allow-for-now lv-hf4201606586b owner=fractal_api_core::api::client_v0::external_grants::conflict_tests TODO=trace-statement-and-value-representation */ &format!("EXPLAIN QUERY PLAN {ADMISSION_QUERY}")).unwrap(); + let plan = query.query_map(rusqlite::params![GRANTED, PRINCIPAL, REVOKED, POLICY, + Some(client_now_ms() as u64)], |row| row.get::<_, String>(3)).unwrap() + .collect::, _>>().unwrap(); + println!("external grant admission query plan:\n{}", plan.join("\n")); + assert!(plan.iter().any(|step| step.contains("claims_assistant_v1_principal_index")), + "principal admission must use its production index: {plan:?}"); +} diff --git a/crates/fractal-client-codegen/templates/Models.swift.in b/crates/fractal-client-codegen/templates/Models.swift.in index ddebf7a3d54..ac6f5cf5a62 100644 --- a/crates/fractal-client-codegen/templates/Models.swift.in +++ b/crates/fractal-client-codegen/templates/Models.swift.in @@ -153,6 +153,7 @@ public enum ErrorCode: Codable, Sendable, Equatable { case peerTooOld case validationFailed case idempotencyConflict + case grantProfileConflict case agentsPublicationRowTooLarge case attentionMigrated case invalidAnswer, notAnswerable @@ -243,6 +244,7 @@ public enum ErrorCode: Codable, Sendable, Equatable { case "peer-too-old": .peerTooOld case "validation-failed": .validationFailed case "idempotency-conflict": .idempotencyConflict + case "grant-profile-conflict": .grantProfileConflict case "stale-fence": .staleFence case "issuer-required": .issuerRequired case "invalid-answer": .invalidAnswer; case "not-answerable": .notAnswerable @@ -333,6 +335,7 @@ public enum ErrorCode: Codable, Sendable, Equatable { case .peerTooOld: "peer-too-old" case .validationFailed: "validation-failed" case .idempotencyConflict: "idempotency-conflict" + case .grantProfileConflict: "grant-profile-conflict" case .staleFence: "stale-fence" case .issuerRequired: "issuer-required" case .invalidAnswer: "invalid-answer"; case .notAnswerable: "not-answerable" @@ -1427,7 +1430,21 @@ public struct AssistantGrant: Codable, Sendable { public let kind, id, sessionActor, deviceID, keyID, issuer, expiresAt, consentEvidence: String; public let principal: AssistantPrincipal; public let senderClass: AssistantSenderClass; public let scopes: [AssistantScope]; public let policyRevision: UInt64; public let minimalReadMode: AssistantMinimalReadMode; public let recipientAllowlist: [String]; public let disclosureConsent, revoked: Bool /// Owner-provisioned SCG read pins; absent means every assistant read is denied. public let readTrust: AssistantReadTrust? - enum CodingKeys: String, CodingKey { case kind, id, sessionActor = "session_actor", deviceID = "device_id", keyID = "key_id", issuer, expiresAt = "expires_at", consentEvidence = "consent_evidence", principal, senderClass = "sender_class", scopes, policyRevision = "policy_revision", minimalReadMode = "minimal_read_mode", recipientAllowlist = "recipient_allowlist", disclosureConsent = "disclosure_consent", revoked, readTrust = "read_trust" } + public let conflict: GrantProfileConflictWitness? + public let clearedConflicts: [ClearedGrantProfileConflictWitness]? + enum CodingKeys: String, CodingKey { case kind, id, sessionActor = "session_actor", deviceID = "device_id", keyID = "key_id", issuer, expiresAt = "expires_at", consentEvidence = "consent_evidence", principal, senderClass = "sender_class", scopes, policyRevision = "policy_revision", minimalReadMode = "minimal_read_mode", recipientAllowlist = "recipient_allowlist", disclosureConsent = "disclosure_consent", revoked, readTrust = "read_trust", conflict, clearedConflicts = "cleared_conflicts" } +} +public enum ExternalGrantProfile: String, Codable, Sendable { case assistant, service } +public enum GrantProfileConflictCause: String, Codable, Sendable { case revoked, expired } +public struct GrantProfileWitness: Codable, Sendable { + public let grantID: String?; public let origin: String; public let profile: ExternalGrantProfile + enum CodingKeys: String, CodingKey { case grantID = "grant_id", origin, profile } +} +public struct GrantProfileConflictWitness: Codable, Sendable { + public let grants: [GrantProfileWitness] +} +public struct ClearedGrantProfileConflictWitness: Codable, Sendable { + public let grants: [GrantProfileWitness]; public let cause: GrantProfileConflictCause } public struct AssistantGrantPolicy: Codable, Sendable { public let apiVersion, consentEvidence: String; public let scopes: [AssistantScope]; public let expiresInSeconds: UInt64?; public let disclosureConsent: Bool; public let minimalReadMode: AssistantMinimalReadMode; public let recipientAllowlist: [String]? diff --git a/crates/fractal-client-codegen/templates/generated.rs.in b/crates/fractal-client-codegen/templates/generated.rs.in index b23666338e7..3df01ac2da0 100644 --- a/crates/fractal-client-codegen/templates/generated.rs.in +++ b/crates/fractal-client-codegen/templates/generated.rs.in @@ -134,6 +134,7 @@ pub enum ErrorCode { PeerTooOld, ValidationFailed, IdempotencyConflict, + GrantProfileConflict, LegacyActionReceiptUntrusted, IssuerRequired, SuspendAuthoredSessionSelection, @@ -4324,6 +4325,40 @@ pub struct AssistantGrant { pub revoked: bool, #[serde(default, skip_serializing_if = "Option::is_none")] pub read_trust: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conflict: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cleared_conflicts: Option>, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] +#[serde(rename_all = "kebab-case")] +pub enum ExternalGrantProfile { + Assistant, + Service, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] +#[serde(rename_all = "kebab-case")] +pub enum GrantProfileConflictCause { + Revoked, + Expired, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] +#[serde(deny_unknown_fields)] +pub struct GrantProfileWitness { + pub grant_id: Option, + pub origin: String, + pub profile: ExternalGrantProfile, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] +#[serde(deny_unknown_fields)] +pub struct GrantProfileConflictWitness { + pub grants: Vec, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] +#[serde(deny_unknown_fields)] +pub struct ClearedGrantProfileConflictWitness { + pub grants: Vec, + pub cause: GrantProfileConflictCause, } #[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] #[serde(deny_unknown_fields)] diff --git a/crates/fractal-client-codegen/templates/lib.rs.in b/crates/fractal-client-codegen/templates/lib.rs.in index 0f0ca7259e4..a801826b95c 100644 --- a/crates/fractal-client-codegen/templates/lib.rs.in +++ b/crates/fractal-client-codegen/templates/lib.rs.in @@ -1192,6 +1192,7 @@ fn render_message(code: Option<&ErrorCode>, message: &str, human: bool) -> Strin | ErrorCode::LegacyActionReceiptUntrusted | ErrorCode::RuntimeNotLocal | ErrorCode::PrivateNotesCarrierConflict + | ErrorCode::GrantProfileConflict | ErrorCode::PrivateNotesUnreachable | ErrorCode::PrivateNotesIndeterminate | ErrorCode::ArrangementExists diff --git a/crates/fractal-client/src/generated.rs b/crates/fractal-client/src/generated.rs index cb8a786636d..068871294d3 100644 --- a/crates/fractal-client/src/generated.rs +++ b/crates/fractal-client/src/generated.rs @@ -134,6 +134,7 @@ pub enum ErrorCode { PeerTooOld, ValidationFailed, IdempotencyConflict, + GrantProfileConflict, LegacyActionReceiptUntrusted, IssuerRequired, SuspendAuthoredSessionSelection, @@ -5155,6 +5156,40 @@ pub struct AssistantGrant { pub revoked: bool, #[serde(default, skip_serializing_if = "Option::is_none")] pub read_trust: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conflict: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cleared_conflicts: Option>, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] +#[serde(rename_all = "kebab-case")] +pub enum ExternalGrantProfile { + Assistant, + Service, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] +#[serde(rename_all = "kebab-case")] +pub enum GrantProfileConflictCause { + Revoked, + Expired, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] +#[serde(deny_unknown_fields)] +pub struct GrantProfileWitness { + pub grant_id: Option, + pub origin: String, + pub profile: ExternalGrantProfile, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] +#[serde(deny_unknown_fields)] +pub struct GrantProfileConflictWitness { + pub grants: Vec, +} +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] +#[serde(deny_unknown_fields)] +pub struct ClearedGrantProfileConflictWitness { + pub grants: Vec, + pub cause: GrantProfileConflictCause, } #[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] #[serde(deny_unknown_fields)] diff --git a/crates/fractal-client/src/lib.rs b/crates/fractal-client/src/lib.rs index e13b116fda1..4f1001ea92c 100644 --- a/crates/fractal-client/src/lib.rs +++ b/crates/fractal-client/src/lib.rs @@ -1278,6 +1278,7 @@ fn render_message(code: Option<&ErrorCode>, message: &str, human: bool) -> Strin | ErrorCode::LegacyActionReceiptUntrusted | ErrorCode::RuntimeNotLocal | ErrorCode::PrivateNotesCarrierConflict + | ErrorCode::GrantProfileConflict | ErrorCode::PrivateNotesUnreachable | ErrorCode::PrivateNotesIndeterminate | ErrorCode::ArrangementExists diff --git a/crates/smallclaims/src/store.rs b/crates/smallclaims/src/store.rs index 0d5ecbf05fd..6aa7182a434 100644 --- a/crates/smallclaims/src/store.rs +++ b/crates/smallclaims/src/store.rs @@ -2935,6 +2935,55 @@ impl Store { Ok(false) } + /// Whether an accepted copy was signed by a keyed fleet member acting as its origin. + /// Requires a valid record in a validated envelope, a signature key authorized for that + /// writer's sequence, and a cryptographically valid signature in this store's fleet/shard + /// domain. Legacy and unkeyed writers do not authenticate provenance. Reads only sealed + /// membership; this query never seals local batches or scans the replication log. + pub fn claim_has_authenticated_member_writer(&self, claim_id: &str) -> Result { + self.read_snapshot(|_| { + let membership = self.fleet_membership_sealed()?; + let connection = self.readers.get(); + let Some(fleet_id) = self.signing_fleet_id(&connection)? else { + return Ok(false); + }; + let shard = fleet_meta(&connection, "shard_id")?; + let mut statement = connection.prepare_cached( + "SELECT records.writer, records.sequence, records.envelope_hash, + signatures.member_key, signatures.signature + FROM replica_records AS records + JOIN claims ON claims.id=records.claim_id AND claims.origin=records.writer + JOIN replica_envelopes AS envelopes + USING (writer, sequence, envelope_hash) + JOIN replica_envelope_signatures AS signatures + USING (writer, sequence, envelope_hash) + WHERE records.claim_id=?1 AND records.state='valid' + AND envelopes.receipt_state='validated'", + )?; + let rows = statement.query_map([claim_id], |row| { + Ok(( + row.get::<_, String>(0)?, + row.get::<_, u64>(1)?, + row.get::<_, String>(2)?, + row.get::<_, String>(3)?, + row.get::<_, String>(4)?, + )) + })?; + for row in rows { + let (writer, sequence, hash, key, signature) = row?; + if matches!( + membership.window(&writer, sequence), + crate::fleet::Window::Keyed(keys) if keys.contains(&key) + ) && VerifiedEnvelopeSignature::verify( + shard.as_deref(), &fleet_id, &writer, sequence, &hash, &key, &signature, + ).is_some() { + return Ok(true); + } + } + Ok(false) + }) + } + /// Envelopes this node admitted before it knew that their writer is keyed or that their /// incarnation had ended. Admission decisions are not revisited, so these stay admitted; diff --git a/crates/smallclaims/src/store/membership_query_tests.rs b/crates/smallclaims/src/store/membership_query_tests.rs index 8022ac07543..3ba1abe2dcf 100644 --- a/crates/smallclaims/src/store/membership_query_tests.rs +++ b/crates/smallclaims/src/store/membership_query_tests.rs @@ -356,3 +356,118 @@ fn sealed_fleet_cache_tracks_batch_signers_after_envelope_identity_changes() { ); } } + +fn cache_member_window(store: &Store, key: &str, start: u64) { + let mut anchor = admitted("anchor", "birch", key, "anchor", "birch", start.max(1)); + anchor.fields.insert("writer_floor".into(), serde_json::json!(start.saturating_sub(1))); + anchor.signers.insert(key.into()); + let membership = Membership::fold(Some(key), &[anchor]); + assert!(membership.counts("anchor"), "the synthetic keyed window must have a valid anchor"); + let generation = fleet_generation(&store.readers.get()).unwrap(); + *store.membership_cache.lock().unwrap() = Some((generation, membership)); +} + +fn authenticated_member_fixture() -> (Store, String, Arc) { + const FLEET: &str = "3e7a9c41-5d2b-4f86-b0c3-9a1e6d4f2b58"; + let source = Store::open_memory("birch", Arc::new(super::runtime::Plain)).unwrap(); + source.bind_fleet(FLEET).unwrap(); + let key = Arc::new(crate::fleet::MemberKey::generate().unwrap().0); + source.load_member_key(Some(key.clone())).unwrap(); + let claim = source.append_claim(&ClaimInput { + subject: "note/provenance".into(), + kind: "example.note".into(), + actor: None, + fields: BTreeMap::new(), + evidence: Vec::new(), + expected_subject: None, + idempotency_key: None, + }).unwrap(); + let target = Store::open_memory("cedar", Arc::new(super::runtime::Plain)).unwrap(); + target.bind_fleet(FLEET).unwrap(); + let exchange = source.export_replication_exchange( + FLEET, &target.replication_inventory().unwrap(), + ).unwrap(); + target.receive_replication_exchange("birch", FLEET, &exchange).unwrap(); + assert_eq!(target.validate_replication_backlog().unwrap().valid, 1); + target.project_replication_backlog().unwrap(); + assert!(target.claim_by_id(&claim.id).unwrap().is_some()); + // Membership folding is tested above. Pin a sealed keyed window so these controls + // exercise provenance itself, including its warm request-path cache. + cache_member_window(&target, key.public(), 0); + (target, claim.id, key) +} + +#[test] +fn authenticated_member_writer_accepts_a_foreign_origin_from_sealed_membership() { + let (store, claim, _) = authenticated_member_fixture(); + assert!(!store.claim_has_authenticated_self_writer(&claim).unwrap()); + for _ in 0..3 { + assert!(store.claim_has_authenticated_member_writer(&claim).unwrap()); + } + assert!(!store.claim_has_authenticated_member_writer("missing").unwrap()); +} + +#[test] +fn authenticated_member_writer_rejects_legacy_wrong_key_and_outside_window() { + let (store, claim, key) = authenticated_member_fixture(); + assert!(store.claim_has_authenticated_member_writer(&claim).unwrap()); + let generation = fleet_generation(&store.readers.get()).unwrap(); + *store.membership_cache.lock().unwrap() = Some((generation, Membership::default())); + assert!(!store.claim_has_authenticated_member_writer(&claim).unwrap()); + let other = crate::fleet::MemberKey::generate().unwrap().0; + cache_member_window(&store, other.public(), 0); + assert!(!store.claim_has_authenticated_member_writer(&claim).unwrap()); + cache_member_window(&store, key.public(), u64::MAX); + assert!(!store.claim_has_authenticated_member_writer(&claim).unwrap()); +} + +#[test] +fn authenticated_member_writer_requires_origin_valid_record_validated_envelope_and_signature() { + for sql in [ + /* sqlite-large-value: allow-for-now lv-h908d794ad3e8 owner=smallclaims::store::membership_query_tests TODO=prepare-body-and-predecessor-values */ + "UPDATE claims SET origin='forged-origin'", + /* sqlite-large-value: allow-for-now lv-h6ff49ec4f026 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + "UPDATE replica_records SET state='invalid'", + /* sqlite-large-value: allow-for-now lv-ha41272fe6b10 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + "UPDATE replica_envelopes SET receipt_state='pending'", + /* sqlite-large-value: allow-for-now lv-hbea4b67b6a13 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + "DELETE FROM replica_envelope_signatures", + /* sqlite-large-value: allow-for-now lv-h9e7e7a841384 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + "UPDATE replica_envelope_signatures SET signature='invalid'", + /* sqlite-large-value: allow-for-now lv-hc8361ab9b858 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + "UPDATE replica_envelope_signatures SET envelope_hash='other-envelope'", + ] { + let (store, claim, key) = authenticated_member_fixture(); + store.connection.write().execute_batch(/* sqlite-large-value: allow-for-now lv-h622f4fdd0f6d owner=smallclaims::store::membership_query_tests TODO=trace-statement-and-value-representation */ sql).unwrap(); + cache_member_window(&store, key.public(), 0); + assert!(!store.claim_has_authenticated_member_writer(&claim).unwrap(), "{sql}"); + } +} + +#[test] +fn authenticated_member_writer_rejects_wrong_fleet_and_shard_signature_domains() { + for shard in [None, Some("another-shard")] { + let (store, claim, key) = authenticated_member_fixture(); + let connection = store.connection.write(); + let (sequence, hash): (u64, String) = connection.query_row( + "SELECT sequence, envelope_hash FROM replica_records WHERE claim_id=?1", + [&claim], |row| Ok((row.get(0)?, row.get(1)?)), + ).unwrap(); + let signature = key.sign(&crate::fleet::envelope_signature_message_in( + shard, + if shard.is_some() { + "3e7a9c41-5d2b-4f86-b0c3-9a1e6d4f2b58" + } else { + "another-fleet" + }, + "birch", sequence, &hash, + )); + connection.execute( + /* sqlite-large-value: allow-for-now lv-hf3e2d678372b owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + "UPDATE replica_envelope_signatures SET signature=?1", [&signature], + ).unwrap(); + drop(connection); + cache_member_window(&store, key.public(), 0); + assert!(!store.claim_has_authenticated_member_writer(&claim).unwrap()); + } +} diff --git a/docs/st3/client-v0/schemas/client-v0.schema.json b/docs/st3/client-v0/schemas/client-v0.schema.json index 53f3563731f..305de428cdb 100644 --- a/docs/st3/client-v0/schemas/client-v0.schema.json +++ b/docs/st3/client-v0/schemas/client-v0.schema.json @@ -592,6 +592,7 @@ "peer-too-old", "validation-failed", "idempotency-conflict", + "grant-profile-conflict", "legacy-action-receipt-untrusted", "issuer-required", "suspend-authored-session-selection", @@ -3816,6 +3817,35 @@ "write.assistant.answers" ] }, "AssistantMinimalReadMode": { "enum": ["approval-once", "caller-bound-allow"] }, + "ExternalGrantProfile": { "enum": ["assistant", "service"] }, + "GrantProfileConflictCause": { "enum": ["revoked", "expired"] }, + "GrantProfileWitness": { + "type": "object", + "additionalProperties": false, + "required": ["grant_id", "origin", "profile"], + "properties": { + "grant_id": { "type": ["string", "null"], "description": "Grant ID; null only for legacy local fixtures without an ID." }, + "origin": { "type": "string" }, + "profile": { "$ref": "#/$defs/ExternalGrantProfile" } + } + }, + "GrantProfileConflictWitness": { + "type": "object", + "additionalProperties": false, + "required": ["grants"], + "properties": { + "grants": { "type": "array", "items": { "$ref": "#/$defs/GrantProfileWitness" } } + } + }, + "ClearedGrantProfileConflictWitness": { + "type": "object", + "additionalProperties": false, + "required": ["grants", "cause"], + "properties": { + "grants": { "type": "array", "items": { "$ref": "#/$defs/GrantProfileWitness" } }, + "cause": { "$ref": "#/$defs/GrantProfileConflictCause" } + } + }, "AssistantGrant": { "type": "object", "additionalProperties": false, @@ -3837,6 +3867,8 @@ "disclosure_consent": { "type": "boolean" }, "consent_evidence": { "type": "string", "minLength": 1, "maxLength": 512 }, "revoked": { "type": "boolean" }, + "conflict": { "anyOf": [{ "$ref": "#/$defs/GrantProfileConflictWitness" }, { "type": "null" }], "description": "Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers." }, + "cleared_conflicts": { "type": "array", "items": { "$ref": "#/$defs/ClearedGrantProfileConflictWitness" }, "description": "Revoked or expired opposite-profile witnesses; emitted only when conflict is null." }, "read_trust": { "$ref": "#/$defs/AssistantReadTrust", "description": "Owner-provisioned public pins for SCG read proofs. Absent means every assistant read is denied." } } }, diff --git a/docs/st3/large-value-sites.json b/docs/st3/large-value-sites.json index 380f9415f40..1bb7a6a3beb 100644 --- a/docs/st3/large-value-sites.json +++ b/docs/st3/large-value-sites.json @@ -798,6 +798,15 @@ {"id": "flow-h39d714b2bc13", "path": "crates/smallclaims/src/store/checkpoint_trim.rs", "function": "trim_checkpoint_from", "owner": "smallclaims::store::checkpoint_trim", "fingerprint": "344fc686f5b0778d9f534c322d46e20e2a21066b09d5acfc1c01c0cf88ad607a", "todo": "stage-generation-and-keyed-reclamation", "disposition": "allow-for-now", "description": "Exact-adoption/trim publication and durable cleanup must be separated without bypassing certification."} ], "sites": [ + {"id":"lv-hf4201606586b","path":"crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs","kind":"unresolved-sql-sink","fingerprint":"412c0c2f9ba50d78b84d6a1f379e285a435a7c6c05e777851130e01716e85c3c","owner":"fractal_api_core::api::client_v0::external_grants::conflict_tests","todo":"trace-statement-and-value-representation","disposition":"allow-for-now","line_hint":295,"excerpt":"& format ! ( \"EXPLAIN QUERY PLAN {ADMISSION_QUERY}\" )"}, + {"id":"lv-h622f4fdd0f6d","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"unresolved-sql-sink","fingerprint":"4ec7c53222c8a758c722e2111541035ce700d5ae7bd0898c5f1b1a743e6450fd","owner":"smallclaims::store::membership_query_tests","todo":"trace-statement-and-value-representation","disposition":"allow-for-now","line_hint":432,"excerpt":"sql"}, + {"id":"lv-h6ff49ec4f026","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"77379a14bb57c713620fd58bbdc380648a7d4228bbda0e58474916d971a24bad","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":425,"excerpt":"UPDATE replica_records SET state='invalid'"}, + {"id":"lv-h908d794ad3e8","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"5facd844161e6200be26cba65f6ea644e1238917f9a484d28577aa6deb8e905d","owner":"smallclaims::store::membership_query_tests","todo":"prepare-body-and-predecessor-values","disposition":"allow-for-now","line_hint":424,"excerpt":"UPDATE claims SET origin='forged-origin'"}, + {"id":"lv-h9e7e7a841384","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"701329c99c19076f8b477e2f84c40f1a2ece7974203ef799364c1f2382fd1875","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":428,"excerpt":"UPDATE replica_envelope_signatures SET signature='invalid'"}, + {"id":"lv-ha41272fe6b10","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"5427c45f190aa6981cd95fcddb43cdb335d88c69516ecb47c398627fc59c2f71","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":426,"excerpt":"UPDATE replica_envelopes SET receipt_state='pending'"}, + {"id":"lv-hbea4b67b6a13","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"309875e8abb2bc3a99eb38ecee4c711cb76b3289ec093bfbbc7fb20330b57bac","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":427,"excerpt":"DELETE FROM replica_envelope_signatures"}, + {"id":"lv-hc8361ab9b858","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"e55b2d5107f04e028d035bbb48904b58e786391c869a4b3a77d380d2543beb0c","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":429,"excerpt":"UPDATE replica_envelope_signatures SET envelope_hash='other-envelope'"}, + {"id":"lv-hf3e2d678372b","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"a650ee653ab427324395872e5e14688cc5d5b4a85d2c17aaafcdc2177d7f40c5","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":457,"excerpt":"UPDATE replica_envelope_signatures SET signature=?1"}, {"id": "lv-h2d6ca7ff29ef", "path": "crates/fractal-store/src/store/notice_authority.rs", "kind": "sql-template", "fingerprint": "bffb6dc7a37c0f4dc2b8f7d9c9f4330331b47cda2278c2dc99116326e0060fa7", "owner": "fractal_store::store::notice_authority", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 86, "excerpt": "INSERT OR IGNORE INTO custom_dependencies VALUES(?1,?2,'[]','')"}, {"id": "lv-h6b344b76fae0", "path": "crates/fractal-store/src/store/notice_authority.rs", "kind": "sql-template", "fingerprint": "d413e887f4063a27a07b744cd1decd88fd76b81bcf87ca8bf4bd66434e18ef3b", "owner": "fractal_store::store::notice_authority", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 61, "excerpt": "CREATE TRIGGER {name} BEFORE {action} ON {table} WHEN ({relevant}) AND ({changed}) BEGIN INSERT INTO local_custom_dirty SELECT subject FROM custom_sources WHERE subject LIKE 'custom/attention/%' ON CO"}, {"id": "lv-h80b0a7485e7e", "path": "crates/fractal-store/src/store/notice_authority.rs", "kind": "sql-template", "fingerprint": "8dc3b720253389a4c76f2c322c03a8f44a29cd7331786ca96608bdcbc12eb19d", "owner": "fractal_store::store::notice_authority", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 135, "excerpt": "INSERT INTO local_custom_dirty SELECT subject FROM custom_sources WHERE subject LIKE 'custom/attention/%' ON CONFLICT(subject) DO NOTHING"}, diff --git a/docs/st3/principals-and-grants.md b/docs/st3/principals-and-grants.md index d5c4d70f00f..de4b43e9188 100644 --- a/docs/st3/principals-and-grants.md +++ b/docs/st3/principals-and-grants.md @@ -113,9 +113,31 @@ The claim-backed external-grant core is `crates/fractal-api-core/src/api/client_v0/external_grants.rs`. Its closed profiles keep `assistant/chatgpt` and `assistant/mcp` in the same assistant profile; service issuance is disabled and service has no assistant route or disclosure rights. -Several active grants of a principal's own profile are allowed, but a different -active profile is refused. Historical `custom.client.assistant.v1.*` claim kinds -and absent-principal legacy ChatGPT grants retain their existing meaning. +Several active grants of a principal's own profile are allowed. Admission refuses +a known opposite-profile grant, including one replicated from another issuer. +If disconnected issuers create opposite-profile grants, authentication suspends +every conflicting grant with `grant-profile-conflict`; there is no winner. +Inspect exposes a `conflict.grants` witness with both grant IDs, origins and +profiles. Once an owner's revoke replicates (or the opposite grant expires), +the remaining grant works again on its authoritative issuer; replication never +makes foreign credentials authenticate on another member. +While opposite-profile records remain visible, inspect also computes +`cleared_conflicts` witnesses naming the `revoked` or `expired` clearing cause. +Conflict state is never persisted. Admission and authentication use the same +millisecond clock and strict `expires_at_unix_ms > now` active boundary; a newly +issued opposite-profile grant reintroduces the conflict by computation. + +Only well-formed foreign grants attributed to the configured concrete owner +count as witnesses. Their grant and effective policy must have matching immutable +identity/profile, and each must have validated envelope provenance signed by a +key in its writer's admitted fleet membership window. Legacy unsigned, +unverifiable and malformed custom claims do not gain suspension authority merely +by naming an owner or origin. This intentionally favors verifiable issuer claims +over allowing arbitrary replicated custom fields to deny service. The fold uses +the principal expression index and removes expired/revoked history in SQL on +every admission/authentication/inspect read, including after replication catches +up. Historical `custom.client.assistant.v1.*` claim kinds and absent-principal +legacy ChatGPT grants retain their existing meaning. Claims persist credential/code digests, never bearer tokens or pairing codes; grant projections expose neither credential material nor its digests. diff --git a/release-notes/external-grant-profile-conflict.json b/release-notes/external-grant-profile-conflict.json new file mode 100644 index 00000000000..884a071764a --- /dev/null +++ b/release-notes/external-grant-profile-conflict.json @@ -0,0 +1,33 @@ +{ + "version": 1, + "summary": "Suspend external-grant authentication when replicated grants assign opposite profiles to one principal", + "replay": { + "status": "changed", + "detail": "Existing append-only grant and revocation claims are read without rewriting history. Active opposite-profile grants conflict regardless of replication arrival order; revoked and expired grants do not contribute to the conflict." + }, + "schema": { + "status": "changed", + "detail": "Adds the typed client error grant-profile-conflict (GrantProfileConflict in Rust), returned as HTTP 409, plus optional AssistantGrant conflict and cleared_conflicts projection witnesses with typed assistant/service profiles and revoked/expired causes. No grant claim shape or storage migration changes." + }, + "rules": { + "status": "changed", + "detail": "If a principal has active grants in both assistant and service profiles, all of that principal's external grants are suspended, not just the losing or newest profile. Multiple same-profile grants remain allowed. Authentication resumes after replicated append-only revocations or expiry remove the opposite-profile conflict from the local view; service issuance remains disabled. Inspect computes active witnesses and cleared_conflicts witnesses with revoked or expired causes; no conflict state is persisted." + }, + "compatibility": { + "status": "changed", + "detail": "Conflict admission counts only well-formed foreign owner grants and matching effective policies with authenticated envelope provenance from a keyed, admitted fleet writer. Unverifiable or malformed replicated custom claims cannot acquire suspension authority by naming an owner. Tokens remain issuer-local. Older members do not enforce this suspension rule, so upgrade all serving members before relying on it." + }, + "downtime": { + "status": "changed", + "detail": "No migration downtime is required. Affected people cannot authenticate with any external grant while a profile conflict remains visible; a partition can extend this interruption until revocations replicate. Unaffected people retain existing authentication behavior." + }, + "manual": { + "status": "changed", + "detail": "For a conflicted principal, choose the intended profile and append revocations for every active grant in the opposite profile. Let those revocations replicate to each serving issuer; do not delete claims or replace tokens to resolve the conflict." + }, + "recovery": { + "status": "changed", + "detail": "After revocations replicate, remaining otherwise-valid grants in the intended profile can authenticate again without reissuance. Expiry of every remaining active opposite-profile grant also clears the conflict; expired and revoked grants remain unusable. If authentication is still suspended on an issuer after revocation, restore replication so it receives the revocations; restarting or changing claim arrival order does not resolve the conflict." + }, + "commits": [] +} From 0c5875e750e2a2b25cc4c7435a837a5982a7c211 Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 08:28:51 +0100 Subject: [PATCH 05/10] test(external-grants): measure q39 with verified foreign grants agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- .../tests/daemon_cost/assistant_admission.rs | 74 +++++++++++++++++-- 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/crates/fractal/tests/daemon_cost/assistant_admission.rs b/crates/fractal/tests/daemon_cost/assistant_admission.rs index 5fb7dcfbef2..3270fde11e8 100644 --- a/crates/fractal/tests/daemon_cost/assistant_admission.rs +++ b/crates/fractal/tests/daemon_cost/assistant_admission.rs @@ -1,5 +1,5 @@ //! Opt-in, real HTTP/Unix daemon measurement (not a router oneshot or mocked daemon). -//! Run this same test source on 98e550cb and on PR3-B, sequentially on dev5: +//! Run this same test source on the named revisions, sequentially on the same host: //! ```sh //! ST_ADMISSION_VARIANT=baseline cargo test --release -p fractal --test integration daemon_cost::assistant_admission::authenticated_get_during_pairing -- --exact --nocapture --test-threads=1 //! ST_ADMISSION_VARIANT=indexed cargo test --release -p fractal --test integration daemon_cost::assistant_admission::authenticated_get_during_pairing -- --exact --nocapture --test-threads=1 @@ -11,8 +11,9 @@ //! ST_ADMISSION_HISTORY (default 10000) is expired grants PER principal; ST_ADMISSION_SAMPLES //! (default 200) is measured GET/completion pairs PER read mode. Setup and proof creation are //! outside timing. Each pair starts behind a barrier, with no sleeps, polling, retries or timers. -//! ST_ADMISSION_REPORT optionally saves the complete JSON report. Run on dev5; hardware is -//! observed from uname/lscpu in the report, not inferred from an environment label. +//! ST_ADMISSION_FOREIGN_ACTIVE optionally adds verified same-profile active foreign grants +//! (default 0; use 3 for the provenance-check scenario). ST_ADMISSION_REPORT optionally +//! saves the complete JSON report. Hardware is observed from uname/lscpu, not inferred. //! The index DDL timing is a synthetic startup migration probe on the populated disposable //! real store, not total daemon startup or cold-disk startup. Latencies use the real daemon's //! bound sockets, bearer middleware, grant lookup, projection and durable approval consumption. @@ -27,8 +28,8 @@ use ring::{rand::SystemRandom, signature::{Ed25519KeyPair, KeyPair as _}}; use serde_json::{Value, json}; use tokio::sync::Barrier; -const OWNER: &str = "person/admission-bench"; -const NODE: &str = "admission-bench"; +const OWNER: &str = "person/bench-operator"; +const NODE: &str = "benchmark-member"; const GRANTED: &str = "custom.client.assistant.v1.granted"; const INDEX: &str = "claims_assistant_v1_principal_index"; const CREATE_INDEX: &str = "CREATE INDEX claims_assistant_v1_principal_index ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'))"; @@ -117,6 +118,55 @@ fn p95(samples: &mut [f64]) -> f64 { samples[(samples.len() * 95).div_ceil(100) - 1] } +// Real signed membership and replication, outside measured requests. Merely +// copying origin text would not exercise the authentication provenance check. +fn foreign_same_profile(store: &Store, anchor: Arc, template: &Value, count: usize) { + let fleet = super::super::daemon_bench::FLEET; + store.pin_fleet_anchor(anchor.public()).unwrap(); + store.set_member_key(Some(anchor.clone())).unwrap(); + store.admit_fleet_anchor(fleet, anchor.public(), "listening").unwrap(); + let peer = Store::open_memory("benchmark-peer").unwrap(); + peer.bind_fleet(fleet).unwrap(); + let key = Arc::new(smallclaims::fleet::MemberKey::generate().unwrap().0); + peer.pin_fleet_anchor(anchor.public()).unwrap(); + peer.set_member_key(Some(key.clone())).unwrap(); + store.append_claim(&ClaimInput { + subject:"host/benchmark-peer".into(), kind:"fleet.member-admitted".into(), + actor:Some(OWNER.into()), fields:serde_json::from_value(json!({ + "fleet_id":fleet,"member_key":key.public(),"via":"invite","mode":"listening" + })).unwrap(), evidence:vec![], expected_subject:None, idempotency_key:None, + }).unwrap(); + let sync = |from: &Store, to: &Store| { + let exchange = from.export_replication_exchange_answering( + fleet, &to.replication_inventory().unwrap(), &to.replication_signature_requests().unwrap(), + ).unwrap(); + to.receive_replication_exchange(from.origin(), fleet, &exchange).unwrap(); + to.validate_replication_backlog().unwrap(); + to.project_replication_backlog().unwrap(); + }; + sync(store, &peer); + let mut ids = Vec::new(); + for row in 0..count { + let id = format!("{:024x}", row + 1); + let mut fields = template.clone(); + fields["grant_id"] = json!(id); + fields["session_actor"] = json!(format!("assistant/chatgpt/session/{id}")); + fields["expires_at_unix_ms"] = json!(u64::MAX); + fields["credential_hash"] = json!(hex::encode(ring::digest::digest(&ring::digest::SHA256, id.as_bytes()).as_ref())); + let grant = peer.append_claim(&ClaimInput { + subject:format!("custom/client/assistant-v1-{id}"), kind:GRANTED.into(), + actor:Some(OWNER.into()), fields:serde_json::from_value(fields).unwrap(), + evidence:vec![], expected_subject:None, idempotency_key:None, + }).unwrap(); + ids.push(grant.id); + } + sync(&peer, store); + for id in ids { + assert!(store.claim_has_authenticated_member_writer(&id).unwrap(), + "the foreign-grant scenario must exercise verified provenance"); + } +} + #[tokio::test(flavor = "multi_thread", worker_threads = 8)] async fn authenticated_get_during_pairing() { let Ok(variant) = std::env::var("ST_ADMISSION_VARIANT") else { return }; @@ -125,11 +175,14 @@ async fn authenticated_get_during_pairing() { let indexed = variant == "indexed"; let history = number("ST_ADMISSION_HISTORY", 10_000); let samples = number("ST_ADMISSION_SAMPLES", 200); + let foreign_active: usize = std::env::var("ST_ADMISSION_FOREIGN_ACTIVE") + .map_or(0, |value| value.parse().expect("nonnegative foreign grant count")); let root = tempfile::tempdir().unwrap(); let database = root.path().join("admission.sqlite"); let store = Arc::new(Store::open(&database, NODE).unwrap()); store.bind_fleet(super::super::daemon_bench::FLEET).unwrap(); - store.set_node_key(Arc::new(smallclaims::fleet::MemberKey::generate().unwrap().0)).unwrap(); + let node_key = Arc::new(smallclaims::fleet::MemberKey::generate().unwrap().0); + store.set_node_key(node_key.clone()).unwrap(); let state = AppState { seat_admission:Default::default(), owning_person:Some(OWNER.into()), store:store.clone(), notify:Arc::new(tokio::sync::Notify::new()), event_notify:tokio::sync::watch::channel(0).0, @@ -186,6 +239,9 @@ async fn authenticated_get_during_pairing() { // authorize a request. Grant history is deliberately nonempty for BOTH principals. let template_subject = format!("custom/client/assistant-v1-{}", sessions[0].1["grant"]["id"].as_str().unwrap().trim_start_matches("assistant-grant/")); let template = store.claims_for_subject_kind_at(&template_subject, GRANTED, None, true, 1).unwrap().claims.pop().unwrap(); + if foreign_active > 0 { + foreign_same_profile(&store, node_key, &template.body["fields"], foreign_active); + } let fixture_store = store.clone(); tokio::task::spawn_blocking(move || { for principal in ["assistant/chatgpt", "assistant/mcp"] { @@ -278,7 +334,8 @@ async fn authenticated_get_during_pairing() { let final_rows: u64 = final_connection.query_row("SELECT count(*) FROM claims", [], |r| r.get(0)).unwrap(); let report = json!({"variant":variant,"baseline_revision":"98e550cb75", "hardware_uname":hardware("uname", &["-a"]), "hardware_lscpu":hardware("lscpu", &["-J"]),"hardware_hostname":hardware("hostname", &[]), - "expected_host":"dev5, AMD Ryzen 9 9955HX, 16 cores / 32 threads (verify observed hardware)", + "host_description":"Observed local benchmark host; no prescribed hardware identity", + "fixture_person_ids":[OWNER],"verified_foreign_same_profile_active_grants":foreign_active, "history_grants_per_principal":history,"initial_total_claim_rows":total_rows,"initial_granted_rows_by_principal":principal_rows, "final_total_claim_rows":final_rows,"admission_query":query, "explain_without_index":before,"explain_with_index":after,"synthetic_startup_index_build_ms":build_ms, @@ -386,7 +443,8 @@ fn synthetic_large_store_index_build() { "explain_without_index":before,"explain_with_index":after, "hardware_uname":hardware("uname", &["-a"]), "hardware_hostname":hardware("hostname", &[]),"hardware_lscpu":hardware("lscpu", &["-J"]), - "expected_host":"dev5, AMD Ryzen 9 9955HX, 16 cores / 32 threads (verify observed hardware)", + "host_description":"Observed local benchmark host; no prescribed hardware identity", + "fixture_person_ids":[OWNER], }); println!("ADMISSION_INDEX_BUILD {}", serde_json::to_string_pretty(&report).unwrap()); if let Some(path) = std::env::var_os("ST_ADMISSION_INDEX_REPORT") { From 7a9009d615eeee9ca0572958f78dbcace021a9df Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 08:35:55 +0100 Subject: [PATCH 06/10] fix(delivery): retain request-history seek after admission index agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- .../src/api/client_v0/external_grants.rs | 11 ++++++++--- crates/fractal-delivery/src/store/delivery.rs | 5 ++++- crates/fractal-delivery/src/store/tests.rs | 2 +- .../fractal/tests/daemon_cost/assistant_admission.rs | 10 +++++----- docs/st3/compatibility.md | 8 +++++++- release-notes/external-grant-admission-index.json | 4 ++-- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants.rs b/crates/fractal-api-core/src/api/client_v0/external_grants.rs index a4e43670642..ae44187565c 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants.rs @@ -406,14 +406,18 @@ mod tests { ("several-policies-expired", json!({"expires_at_unix_ms":101}), vec![99, 102, 100], 0, false, false), ("unrelated-principal", json!({"expires_at_unix_ms":101}), vec![], 0, false, false), ("legacy-default-principal", json!({"expires_at_unix_ms":101}), vec![], 0, false, true), + ("null-principal", json!({"expires_at_unix_ms":101}), vec![], 0, false, true), + ("mcp-principal", json!({"expires_at_unix_ms":101}), vec![], 0, false, true), ]; for (name, mut source, policies, revokes, replicated, denied) in cases { let root = tempfile::tempdir().unwrap(); let mut state = crate::api::tests_shared::state(root.path()); state.owning_person = Some("person/owner".into()); source["profile"] = json!("service"); - if name != "legacy-default-principal" { - source["principal"] = json!(if name == "unrelated-principal" { MCP_PRINCIPAL } else { PRINCIPAL }); + if name == "null-principal" { + source["principal"] = Value::Null; + } else if name != "legacy-default-principal" { + source["principal"] = json!(if matches!(name, "unrelated-principal" | "mcp-principal") { MCP_PRINCIPAL } else { PRINCIPAL }); } let subject = format!("custom/client/differential-{name}"); let append_fixture = |store: &Store, kind: &str, value: Value, previous: Option<&ClaimRecord>| { @@ -447,7 +451,8 @@ mod tests { for owner in [Some("person/owner"), None] { state.owning_person = owner.map(str::to_owned); for profile in ["assistant", "service"] { - let candidate = json!({"profile":profile,"principal":PRINCIPAL}); + let principal = if name == "mcp-principal" { MCP_PRINCIPAL } else { PRINCIPAL }; + let candidate = json!({"profile":profile,"principal":principal}); let old = rust_only_admission(&state, &candidate).map_err(|error| error.code); let new = admit_profile(&state, &candidate).map_err(|error| error.code); assert_eq!(new, old, "{name}: owner={owner:?}, profile={profile}"); diff --git a/crates/fractal-delivery/src/store/delivery.rs b/crates/fractal-delivery/src/store/delivery.rs index 672e27e928b..7a9c20fe1dd 100644 --- a/crates/fractal-delivery/src/store/delivery.rs +++ b/crates/fractal-delivery/src/store/delivery.rs @@ -935,8 +935,11 @@ impl DeliveryStore for Store { if let Some((deadline, attempts)) = local { return Ok(Some((deadline as u128, attempts))); } + // Pin the request seek, like the other plan-sensitive history reads: + // without ANALYZE, adding a kind-leading index can make SQLite prefer + // a generic subject/kind scan that decodes every deferred request. let count: u32 = connection.query_row( - "SELECT COUNT(*) FROM claims + "SELECT COUNT(*) FROM claims INDEXED BY claims_subscription_deferred_request_index WHERE subject=?1 AND kind='subscription.mission-deferred' AND json_extract(body, '$.fields.request')=?2", params![subject, request], diff --git a/crates/fractal-delivery/src/store/tests.rs b/crates/fractal-delivery/src/store/tests.rs index 3c2ae535a28..3694eeef623 100644 --- a/crates/fractal-delivery/src/store/tests.rs +++ b/crates/fractal-delivery/src/store/tests.rs @@ -92,7 +92,7 @@ fn subscription_retry_queries_use_history_indexes() { let connection = store.readers.get(); let request_plan: String = connection .query_row( - "EXPLAIN QUERY PLAN SELECT COUNT(*) FROM claims + "EXPLAIN QUERY PLAN SELECT COUNT(*) FROM claims INDEXED BY claims_subscription_deferred_request_index WHERE subject=?1 AND kind='subscription.mission-deferred' AND json_extract(body, '$.fields.request')=?2", params![subject, "request-a"], diff --git a/crates/fractal/tests/daemon_cost/assistant_admission.rs b/crates/fractal/tests/daemon_cost/assistant_admission.rs index f2c94c35cba..bf589f829ca 100644 --- a/crates/fractal/tests/daemon_cost/assistant_admission.rs +++ b/crates/fractal/tests/daemon_cost/assistant_admission.rs @@ -1,5 +1,5 @@ //! Opt-in, real HTTP/Unix daemon measurement (not a router oneshot or mocked daemon). -//! Run this same test source on 98e550cb and on PR3-B, sequentially on dev5: +//! Run this same test source on 98e550cb and on PR3-B, sequentially on one host: //! ```sh //! ST_ADMISSION_VARIANT=baseline cargo test --release -p fractal --test integration daemon_cost::assistant_admission::authenticated_get_during_pairing -- --exact --nocapture --test-threads=1 //! ST_ADMISSION_VARIANT=indexed cargo test --release -p fractal --test integration daemon_cost::assistant_admission::authenticated_get_during_pairing -- --exact --nocapture --test-threads=1 @@ -11,8 +11,8 @@ //! ST_ADMISSION_HISTORY (default 10000) is expired grants PER principal; ST_ADMISSION_SAMPLES //! (default 200) is measured GET/completion pairs PER read mode. Setup and proof creation are //! outside timing. Each pair starts behind a barrier, with no sleeps, polling, retries or timers. -//! ST_ADMISSION_REPORT optionally saves the complete JSON report. Run on dev5; hardware is -//! observed from uname/lscpu in the report, not inferred from an environment label. +//! ST_ADMISSION_REPORT optionally saves the complete JSON report. Hardware is observed +//! from uname/lscpu in the report, not inferred from an environment label. //! The index DDL timing is a synthetic startup migration probe on the populated disposable //! real store, not total daemon startup or cold-disk startup. Latencies use the real daemon's //! bound sockets, bearer middleware, grant lookup, projection and durable approval consumption. @@ -278,7 +278,7 @@ async fn authenticated_get_during_pairing() { let final_rows: u64 = final_connection.query_row("SELECT count(*) FROM claims", [], |r| r.get(0)).unwrap(); let report = json!({"variant":variant,"baseline_revision":"98e550cb75", "hardware_uname":hardware("uname", &["-a"]), "hardware_lscpu":hardware("lscpu", &["-J"]),"hardware_hostname":hardware("hostname", &[]), - "expected_host":"dev5, AMD Ryzen 9 9955HX, 16 cores / 32 threads (verify observed hardware)", + "expected_host":"same otherwise-idle host for both variants (verify observed hardware)", "history_grants_per_principal":history,"initial_total_claim_rows":total_rows,"initial_granted_rows_by_principal":principal_rows, "final_total_claim_rows":final_rows,"admission_query":query, "explain_without_index":before,"explain_with_index":after,"synthetic_startup_index_build_ms":build_ms, @@ -386,7 +386,7 @@ fn synthetic_large_store_index_build() { "explain_without_index":before,"explain_with_index":after, "hardware_uname":hardware("uname", &["-a"]), "hardware_hostname":hardware("hostname", &[]),"hardware_lscpu":hardware("lscpu", &["-J"]), - "expected_host":"dev5, AMD Ryzen 9 9955HX, 16 cores / 32 threads (verify observed hardware)", + "expected_host":"same otherwise-idle host for both variants (verify observed hardware)", }); println!("ADMISSION_INDEX_BUILD {}", serde_json::to_string_pretty(&report).unwrap()); if let Some(path) = std::env::var_os("ST_ADMISSION_INDEX_REPORT") { diff --git a/docs/st3/compatibility.md b/docs/st3/compatibility.md index 786b096374d..903053bd11a 100644 --- a/docs/st3/compatibility.md +++ b/docs/st3/compatibility.md @@ -149,7 +149,7 @@ replication digests: row formats, vocabulary, shared projections and retention semantics are unchanged. It follows the schema-on-open index installation used for the assistant mission-run collection indexes. The first open builds the index synchronously over retained claims. On a 16-core x86_64 benchmark host -(AMD Ryzen 9 9955HX, 32 threads, Linux), exact index creation on a synthetic +(32 threads, Linux), exact index creation on a synthetic 1,000,000-claim real Store schema took 1.525 seconds and grew the main database by 59,518,976 bytes. This measures index-build work, not complete daemon startup or cold-disk restart time; local history and hardware determine first-open delay. @@ -167,6 +167,12 @@ meet q39's 100 ms budget. The opt-in `daemon_cost::assistant_admission` tests us production daemon routers over bound Unix/TCP sockets, real bearer middleware, and distinct build directories for the baseline and indexed worktrees. +Subscription deferral counts keep their request-history index explicitly selected, +following the existing plan-sensitive history-query convention. Without `ANALYZE`, +SQLite's default estimates can select a subject/kind history scan after an unrelated +kind-leading index is added; request filtering must remain an index seek rather +than decoding every deferral for that subscription. + Use CLI and the terminal UI from the same release source. Current client version scope is: | Client | Version/evidence boundary | diff --git a/release-notes/external-grant-admission-index.json b/release-notes/external-grant-admission-index.json index ff04823e236..ef545f40a58 100644 --- a/release-notes/external-grant-admission-index.json +++ b/release-notes/external-grant-admission-index.json @@ -4,8 +4,8 @@ "replay": {"status": "none", "detail": "No claim rewrite, projection replay or history removal. The SQL expiry filter uses the latest policy, retains missing-fields validation candidates, and preserves legacy absent-principal ChatGPT grants."}, "schema": {"status": "changed", "detail": "Schema-on-open adds claims_assistant_v1_principal_index on claims(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')). This additive derived access path changes neither STORAGE_VERSION (20), RULES_VERSION (26), the registry nor shared projection digests. Existing supported stores install the index automatically; subsequent opens reuse it."}, "rules": {"status": "none", "detail": "Profile admission, grant lifecycle, approval-once consumption, issuer checks and retention semantics are unchanged. Multiple same-profile grants remain allowed; service issuance remains disabled."}, - "compatibility": {"status": "none", "detail": "On a 16-core x86_64 benchmark host (AMD Ryzen 9 9955HX, 32 threads, Linux), real bound daemon APIs with bearer authentication and one concurrent pairing completion per GET were measured against exact baseline 98e550cb75. With 10000 expired grants per principal and 200 samples per mode, approval-once GET p95 improved from 965.184401 ms to 54.153648 ms; caller-bound-allow improved from 933.049170 ms to 46.173346 ms. Both indexed modes pass q39 <=100 ms. These are in-process production routers over Unix/TCP sockets, not an external daemon-process startup benchmark. SQL work still scales with matching principal history; the index avoids unrelated principals and inactive records no longer hydrate into Rust."}, - "downtime": {"status": "changed", "detail": "The first store open missing the index waits synchronously for its construction. Exact index CREATE DDL on a synthetic 1000000-claim real Store schema took 1524.850241 ms (about 1.525 s) on a 16-core x86_64 benchmark host (AMD Ryzen 9 9955HX, 32 threads, Linux 6.18.51). This is one measurement on that host, not a guaranteed rate of 1.5 seconds per million rows or a startup-time guarantee. Main database size grew from 1421651968 to 1481170944 bytes. This measures index-build startup work only, not complete restart-to-API time or cold-disk startup; allow additional first-open delay according to local history and hardware. Later opens do not rebuild the index."}, + "compatibility": {"status": "none", "detail": "On a 16-core x86_64 benchmark host (32 threads, Linux), real bound daemon APIs with bearer authentication and one concurrent pairing completion per GET were measured against exact baseline 98e550cb75. With 10000 expired grants per principal and 200 samples per mode, approval-once GET p95 improved from 965.184401 ms to 54.153648 ms; caller-bound-allow improved from 933.049170 ms to 46.173346 ms. Both indexed modes pass q39 <=100 ms. These are in-process production routers over Unix/TCP sockets, not an external daemon-process startup benchmark. SQL work still scales with matching principal history; the index avoids unrelated principals and inactive records no longer hydrate into Rust. Subscription deferral counts explicitly retain their request-history seek, avoiding a generic subject/kind history scan under SQLite's default estimates."}, + "downtime": {"status": "changed", "detail": "The first store open missing the index waits synchronously for its construction. Exact index CREATE DDL on a synthetic 1000000-claim real Store schema took 1524.850241 ms (about 1.525 s) on a 16-core x86_64 benchmark host (32 threads, Linux 6.18.51). This is one measurement on that host, not a guaranteed rate of 1.5 seconds per million rows or a startup-time guarantee. Main database size grew from 1421651968 to 1481170944 bytes. This measures index-build startup work only, not complete restart-to-API time or cold-disk startup; allow additional first-open delay according to local history and hardware. Later opens do not rebuild the index."}, "manual": {"status": "none", "detail": "No operator SQL, data conversion, credential reissue or manual migration is required. Allow the first open to finish index construction."}, "recovery": {"status": "none", "detail": "Claims and signed bodies are unchanged. A binary rollback leaves the index in place: previous binaries can ignore it, and SQLite keeps maintaining it on writes. An interrupted first-open index build can be completed by normal subsequent schema-on-open installation; no history deletion or repair SQL is needed."}, "commits": [] From d374cbecbeb146d77c6fb79b80f40894140fa15c Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 09:07:19 +0100 Subject: [PATCH 07/10] fix(external-grants): authenticate lifecycle overlays and opt in witnesses agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- .../Sources/FractalClient/Client.swift | 2 +- .../fractal-client/Client.generated.ts | 4 +- .../fractal-client/Schema.generated.ts | 14 +-- .../src/api/client_v0/assistant.rs | 91 ++++++++++++++- .../src/api/client_v0/external_grants.rs | 103 ++++++++++++----- .../external_grants/conflict_tests.rs | 107 ++++++++++++++++-- .../templates/Client.swift.in | 2 +- .../templates/Client.ts.in | 4 +- .../templates/lib.rs.in | 5 + crates/fractal-client/src/lib.rs | 13 +++ .../tests/daemon_cost/assistant_admission.rs | 42 +++++-- crates/smallclaims/src/store.rs | 38 ++++++- .../src/store/membership_query_tests.rs | 90 ++++++++++++++- .../client-v0/schemas/client-v0.schema.json | 4 +- docs/st3/client-v0/schemas/operations.json | 2 +- docs/st3/large-value-sites.json | 5 + docs/st3/principals-and-grants.md | 27 +++-- .../external-grant-profile-conflict.json | 4 +- 18 files changed, 470 insertions(+), 87 deletions(-) diff --git a/clients/swift/FractalClient/Sources/FractalClient/Client.swift b/clients/swift/FractalClient/Sources/FractalClient/Client.swift index 4ba33db7e92..ecfa16a4a92 100644 --- a/clients/swift/FractalClient/Sources/FractalClient/Client.swift +++ b/clients/swift/FractalClient/Sources/FractalClient/Client.swift @@ -437,7 +437,7 @@ public actor FractalClient { public func beginPairing(deviceName: String, personID: String) async throws -> Envelope { try await post("v1/client/pairings", PersonPairingBegin(apiVersion: fractalClientAPIVersion, deviceName: deviceName, personID: personID)) } public func beginPairing(_ request: PairingBegin) async throws -> Envelope { try await post("v1/client/pairings", request) } public func completePairing(pairingID: String, code: String, devicePublicKey: String) async throws -> Envelope { try await post("v1/client/pairings/\(pairingID.replacingOccurrences(of: "pairing/", with: ""))/complete", PairingComplete(apiVersion: fractalClientAPIVersion, code: code, devicePublicKey: devicePublicKey)) } - public func assistantGrant(_ id: String) async throws -> Envelope { try await get("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)") } + public func assistantGrant(_ id: String, witness: Bool = false) async throws -> Envelope { try await get("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)", query: witness ? [.init(name: "witness", value: "1")] : []) } public func assistantGrantRevoke(_ id: String) async throws -> Envelope { try await post("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)/revoke", [String: String]()) } public func assistantGrantPolicy(_ id: String, _ policy: AssistantGrantPolicy) async throws -> Envelope { try await post("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)/policy", policy) } public func assistantGrantReadTrust(_ id: String, _ trust: AssistantReadTrustRequest) async throws -> Envelope { try await post("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)/read-trust", trust) } diff --git a/clients/typescript/fractal-client/Client.generated.ts b/clients/typescript/fractal-client/Client.generated.ts index 5e7eb2a1444..28a2f6808eb 100644 --- a/clients/typescript/fractal-client/Client.generated.ts +++ b/clients/typescript/fractal-client/Client.generated.ts @@ -482,8 +482,8 @@ export class FractalClient { return this.request('POST', `/v1/client/pairings/${encodeURIComponent(routedId(id))}/complete`, request, undefined, undefined, requestOptions); } - async assistantGrant(id: string): Promise> { - return this.request('GET', `/v1/client/assistant/grants/${encodeURIComponent(id)}`); + async assistantGrant(id: string, options: { witness?: boolean } = {}): Promise> { + return this.request('GET', `/v1/client/assistant/grants/${encodeURIComponent(id)}${query({ witness: options.witness ? 1 : undefined })}`); } async assistantGrantRevoke(id: string): Promise> { return this.request('POST', `/v1/client/assistant/grants/${encodeURIComponent(id)}/revoke`, {}); diff --git a/clients/typescript/fractal-client/Schema.generated.ts b/clients/typescript/fractal-client/Schema.generated.ts index adca8cad969..e9413268804 100644 --- a/clients/typescript/fractal-client/Schema.generated.ts +++ b/clients/typescript/fractal-client/Schema.generated.ts @@ -525,10 +525,10 @@ export type GrantProfileConflictWitness = typeof GrantProfileConflictWitness.Typ export type GrantProfileConflictWitnessEncoded = typeof GrantProfileConflictWitness.Encoded export const AssistantGrant = /*#__PURE__*/ (() => Schema.Struct({ - /** Revoked or expired opposite-profile witnesses; emitted only when conflict is null. */ - "cleared_conflicts": optionalKey(Schema.Array(ClearedGrantProfileConflictWitness)).annotate({ description: "Revoked or expired opposite-profile witnesses; emitted only when conflict is null." }), - /** Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers. */ - "conflict": Schema.OptionFromOptionalNullOr(GrantProfileConflictWitness, NULL_NONE).annotate({ description: "Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers." }), + /** Revoked or expired opposite-profile witnesses; emitted only on grant inspection with witness=1 when conflict is null. */ + "cleared_conflicts": optionalKey(Schema.Array(ClearedGrantProfileConflictWitness)).annotate({ description: "Revoked or expired opposite-profile witnesses; emitted only on grant inspection with witness=1 when conflict is null." }), + /** Current opposite-profile conflict, or null when no active conflict exists. Present only on grant inspection with witness=1; omitted from default inspection, pairing and mutation responses. */ + "conflict": Schema.OptionFromOptionalNullOr(GrantProfileConflictWitness, NULL_NONE).annotate({ description: "Current opposite-profile conflict, or null when no active conflict exists. Present only on grant inspection with witness=1; omitted from default inspection, pairing and mutation responses." }), "consent_evidence": Schema.String.check(Schema.isMinCodePoints(1)).check(Schema.isMaxCodePoints(512)), "device_id": Id, "disclosure_consent": Schema.Boolean, @@ -944,9 +944,9 @@ export const Envelope = /*#__PURE__*/ (() => Schema.Struct({ "desired_token": Schema.String.annotate({ description: "Selected desired claim, including a stop when the seat is retired." }), "host_id": HostId, "kind": Schema.Literal("agent-workspace"), /** Declared workspace directory on host_id, not the API gateway's filesystem or the harness's internal state directory. */ "workspace": Schema.String.annotate({ description: "Declared workspace directory on host_id, not the API gateway's filesystem or the harness's internal state directory." }), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.String.check(Schema.makeFilter((value: string) => !new RegExp("^(?:resources|ordered-memberships|assistant\\.(?:attention|missions|agents))$", "u").test(value), { expected: "a string not matching ^(?:resources|ordered-memberships|assistant\\.(?:attention|missions|agents))$" })), "filters": Schema.Record(Schema.String, Schema.String), "items": Schema.Array(Resource), "kind": Schema.Literal("page"), "page": PageInfo, "replicated": optionalKey(ReplicatedNotice), "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("ordered-memberships"), "filters": Schema.Record(Schema.String, Schema.String), "items": Schema.Array(OrderedMembership), "kind": Schema.Literal("page"), "page": PageInfo, "replicated": optionalKey(ReplicatedNotice), "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "collection": Schema.Literal("resources"), "filters": Schema.Record(Schema.String, Schema.String), "items": Schema.Array(ResourceObservation), "kind": Schema.Literal("page"), "page": PageInfo, "sync": optionalKey(SyncNotice), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Resource, Schema.Struct({ /** Present when conversation-blocks.v1 is negotiated; each field names its value, source and as_of */ "header": optionalKey(ConversationHeader), "items": Schema.Array(TimelineEntry), "kind": Schema.Literal("timeline-page"), "page": PageInfo, "session_id": Id, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ /** Present when conversation-blocks.v1 is negotiated; each field names its value, source and as_of */ -"header": optionalKey(ConversationHeader), "items": Schema.Array(TimelineEntry).check(Schema.isMaxLength(200)), "kind": Schema.Literal("conversation-changes"), "next_cursor": Cursor, "session_id": Id, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "host_id": Id, "incomplete_sources": Schema.Array(Schema.String), "indexed_at": Timestamp, "items": Schema.Array(ConversationSearchHit).check(Schema.isMaxLength(200)), "kind": Schema.Literal("conversation-search"), "page": PageInfo, "refreshing": Schema.Boolean, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "has_more": Schema.Boolean, "items": Schema.Array(ProjectionEvent).check(Schema.isMaxLength(500)), "kind": Schema.Literal("event-page"), "oldest_cursor": Cursor, "resume_cursor": Cursor, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "action_id": Id, "affected_ids": Schema.Array(Id).check(Schema.isUnique()), "arrangement_revision": optionalKey(Revision), "harness_answer": optionalKey(HarnessAnswerResult), "kind": Schema.Literal("action-result"), "membership_revision": optionalKey(Revision), "operation_id": Id, "private_notes": optionalKey(PrivateNotesFence), "snapshot_id": Id, "status": Schema.Literals(["accepted","completed","rejected"]), "terminal_attachment": Schema.OptionFromOptionalNullOr(TerminalAttachment, NULL_NONE), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "acknowledged_event_ids": Schema.Array(ClientDiagnosticUuid).check(Schema.isMaxLength(32)), "accounts": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), PairingChallenge, PairedSession, Schema.Struct({ /** Revoked or expired opposite-profile witnesses; emitted only when conflict is null. */ -"cleared_conflicts": optionalKey(Schema.Array(ClearedGrantProfileConflictWitness)).annotate({ description: "Revoked or expired opposite-profile witnesses; emitted only when conflict is null." }), /** Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers. */ -"conflict": Schema.OptionFromOptionalNullOr(GrantProfileConflictWitness, NULL_NONE).annotate({ description: "Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers." }), "consent_evidence": Schema.String.check(Schema.isMinCodePoints(1)).check(Schema.isMaxCodePoints(512)), "device_id": Id, "disclosure_consent": Schema.Boolean, "expires_at": Timestamp, "id": Id, /** Daemon-configured owning person, sealed by the authoritative grant-issuer member at trusted-local begin. */ +"header": optionalKey(ConversationHeader), "items": Schema.Array(TimelineEntry).check(Schema.isMaxLength(200)), "kind": Schema.Literal("conversation-changes"), "next_cursor": Cursor, "session_id": Id, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "host_id": Id, "incomplete_sources": Schema.Array(Schema.String), "indexed_at": Timestamp, "items": Schema.Array(ConversationSearchHit).check(Schema.isMaxLength(200)), "kind": Schema.Literal("conversation-search"), "page": PageInfo, "refreshing": Schema.Boolean, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "has_more": Schema.Boolean, "items": Schema.Array(ProjectionEvent).check(Schema.isMaxLength(500)), "kind": Schema.Literal("event-page"), "oldest_cursor": Cursor, "resume_cursor": Cursor, "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "action_id": Id, "affected_ids": Schema.Array(Id).check(Schema.isUnique()), "arrangement_revision": optionalKey(Revision), "harness_answer": optionalKey(HarnessAnswerResult), "kind": Schema.Literal("action-result"), "membership_revision": optionalKey(Revision), "operation_id": Id, "private_notes": optionalKey(PrivateNotesFence), "snapshot_id": Id, "status": Schema.Literals(["accepted","completed","rejected"]), "terminal_attachment": Schema.OptionFromOptionalNullOr(TerminalAttachment, NULL_NONE), "accounts": Schema.optionalKey(Schema.Never), "acknowledged_event_ids": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), Schema.Struct({ "acknowledged_event_ids": Schema.Array(ClientDiagnosticUuid).check(Schema.isMaxLength(32)), "accounts": Schema.optionalKey(Schema.Never), "action_id": Schema.optionalKey(Schema.Never), "actions": Schema.optionalKey(Schema.Never), "affected_ids": Schema.optionalKey(Schema.Never), "agent_id": Schema.optionalKey(Schema.Never), "agent_messages": Schema.optionalKey(Schema.Never), "arrangement_revision": Schema.optionalKey(Schema.Never), "as_of": Schema.optionalKey(Schema.Never), "as_of_unix_ms": Schema.optionalKey(Schema.Never), "bytes": Schema.optionalKey(Schema.Never), "capabilities": Schema.optionalKey(Schema.Never), "changed_at_unix_ms": Schema.optionalKey(Schema.Never), "cleanup_command": Schema.optionalKey(Schema.Never), "cleared_conflicts": Schema.optionalKey(Schema.Never), "collection": Schema.optionalKey(Schema.Never), "columns": Schema.optionalKey(Schema.Never), "complete": Schema.optionalKey(Schema.Never), "conflict": Schema.optionalKey(Schema.Never), "conflicts": Schema.optionalKey(Schema.Never), "consent_evidence": Schema.optionalKey(Schema.Never), "count": Schema.optionalKey(Schema.Never), "counts": Schema.optionalKey(Schema.Never), "current_work_ids": Schema.optionalKey(Schema.Never), "cursor": Schema.optionalKey(Schema.Never), "data": Schema.optionalKey(Schema.Never), "declaration": Schema.optionalKey(Schema.Never), "declaration_token": Schema.optionalKey(Schema.Never), "desired": Schema.optionalKey(Schema.Never), "desired_revision": Schema.optionalKey(Schema.Never), "desired_token": Schema.optionalKey(Schema.Never), "device_id": Schema.optionalKey(Schema.Never), "disclosure_consent": Schema.optionalKey(Schema.Never), "event_cursor": Schema.optionalKey(Schema.Never), "expires_at": Schema.optionalKey(Schema.Never), "facts": Schema.optionalKey(Schema.Never), "family": Schema.optionalKey(Schema.Never), "filters": Schema.optionalKey(Schema.Never), "grant_expires_at": Schema.optionalKey(Schema.Never), "grant_id": Schema.optionalKey(Schema.Never), "grant_kind": Schema.optionalKey(Schema.Never), "harness_answer": Schema.optionalKey(Schema.Never), "has_more": Schema.optionalKey(Schema.Never), "header": Schema.optionalKey(Schema.Never), "history": Schema.optionalKey(Schema.Never), "host_id": Schema.optionalKey(Schema.Never), "id": Schema.optionalKey(Schema.Never), "incomplete_sources": Schema.optionalKey(Schema.Never), "indexed_at": Schema.optionalKey(Schema.Never), "issuer": Schema.optionalKey(Schema.Never), "items": Schema.optionalKey(Schema.Never), "kdl": Schema.optionalKey(Schema.Never), "key_id": Schema.optionalKey(Schema.Never), "kind": Schema.optionalKey(Schema.Never), "latest": Schema.optionalKey(Schema.Never), "legacy": Schema.optionalKey(Schema.Never), "limit": Schema.optionalKey(Schema.Never), "limits": Schema.optionalKey(Schema.Never), "lines": Schema.optionalKey(Schema.Never), "live": Schema.optionalKey(Schema.Never), "machine_version": Schema.optionalKey(Schema.Never), "membership_revision": Schema.optionalKey(Schema.Never), "minimal_read_mode": Schema.optionalKey(Schema.Never), "mission": Schema.optionalKey(Schema.Never), "modes": Schema.optionalKey(Schema.Never), "move_count": Schema.optionalKey(Schema.Never), "moves": Schema.optionalKey(Schema.Never), "name": Schema.optionalKey(Schema.Never), "next_cursor": Schema.optionalKey(Schema.Never), "next_sequence": Schema.optionalKey(Schema.Never), "next_work_id": Schema.optionalKey(Schema.Never), "notes": Schema.optionalKey(Schema.Never), "oldest_cursor": Schema.optionalKey(Schema.Never), "oldest_event_cursor": Schema.optionalKey(Schema.Never), "operation_id": Schema.optionalKey(Schema.Never), "otel_ui_url": Schema.optionalKey(Schema.Never), "owner": Schema.optionalKey(Schema.Never), "page": Schema.optionalKey(Schema.Never), "policy_revision": Schema.optionalKey(Schema.Never), "principal": Schema.optionalKey(Schema.Never), "private_notes": Schema.optionalKey(Schema.Never), "published_at": Schema.optionalKey(Schema.Never), "read_trust": Schema.optionalKey(Schema.Never), "recipient_allowlist": Schema.optionalKey(Schema.Never), "ref": Schema.optionalKey(Schema.Never), "reference": Schema.optionalKey(Schema.Never), "references": Schema.optionalKey(Schema.Never), "refreshing": Schema.optionalKey(Schema.Never), "relay": Schema.optionalKey(Schema.Never), "replicated": Schema.optionalKey(Schema.Never), "resume_cursor": Schema.optionalKey(Schema.Never), "retained_from": Schema.optionalKey(Schema.Never), "revision": Schema.optionalKey(Schema.Never), "revoked": Schema.optionalKey(Schema.Never), "rows": Schema.optionalKey(Schema.Never), "runs": Schema.optionalKey(Schema.Never), "runtime_incarnation": Schema.optionalKey(Schema.Never), "samples": Schema.optionalKey(Schema.Never), "schema": Schema.optionalKey(Schema.Never), "schemas": Schema.optionalKey(Schema.Never), "scopes": Schema.optionalKey(Schema.Never), "seat": Schema.optionalKey(Schema.Never), "sender_class": Schema.optionalKey(Schema.Never), "session_actor": Schema.optionalKey(Schema.Never), "session_id": Schema.optionalKey(Schema.Never), "since_ms": Schema.optionalKey(Schema.Never), "size": Schema.optionalKey(Schema.Never), "snapshot_id": Schema.optionalKey(Schema.Never), "status": Schema.optionalKey(Schema.Never), "steps": Schema.optionalKey(Schema.Never), "subject": Schema.optionalKey(Schema.Never), "sync": Schema.optionalKey(Schema.Never), "terminal_attachment": Schema.optionalKey(Schema.Never), "terminal_id": Schema.optionalKey(Schema.Never), "text": Schema.optionalKey(Schema.Never), "threshold_ms": Schema.optionalKey(Schema.Never), "title": Schema.optionalKey(Schema.Never), "token": Schema.optionalKey(Schema.Never), "transport": Schema.optionalKey(Schema.Never), "truncated": Schema.optionalKey(Schema.Never), "until_ms": Schema.optionalKey(Schema.Never), "version": Schema.optionalKey(Schema.Never), "workspace": Schema.optionalKey(Schema.Never) }), PairingChallenge, PairedSession, Schema.Struct({ /** Revoked or expired opposite-profile witnesses; emitted only on grant inspection with witness=1 when conflict is null. */ +"cleared_conflicts": optionalKey(Schema.Array(ClearedGrantProfileConflictWitness)).annotate({ description: "Revoked or expired opposite-profile witnesses; emitted only on grant inspection with witness=1 when conflict is null." }), /** Current opposite-profile conflict, or null when no active conflict exists. Present only on grant inspection with witness=1; omitted from default inspection, pairing and mutation responses. */ +"conflict": Schema.OptionFromOptionalNullOr(GrantProfileConflictWitness, NULL_NONE).annotate({ description: "Current opposite-profile conflict, or null when no active conflict exists. Present only on grant inspection with witness=1; omitted from default inspection, pairing and mutation responses." }), "consent_evidence": Schema.String.check(Schema.isMinCodePoints(1)).check(Schema.isMaxCodePoints(512)), "device_id": Id, "disclosure_consent": Schema.Boolean, "expires_at": Timestamp, "id": Id, /** Daemon-configured owning person, sealed by the authoritative grant-issuer member at trusted-local begin. */ "issuer": PersonId, /** SHA-256 of the canonical device public-key string; never a credential digest. */ "key_id": Schema.String.check(Schema.isPattern(new RegExp("^[0-9a-f]{64}$", "u"))).annotate({ description: "SHA-256 of the canonical device public-key string; never a credential digest." }), "kind": Schema.Literal("assistant-grant"), "minimal_read_mode": AssistantMinimalReadMode, "policy_revision": Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)), "principal": AssistantPrincipal, /** Owner-provisioned public pins for SCG read proofs. Absent means every assistant read is denied. */ "read_trust": optionalKey(AssistantReadTrust), /** Stored policy metadata; does not restrict message.send. write.assistant.messages permits any existing agent recipient, never a person. */ diff --git a/crates/fractal-api-client-v0/src/api/client_v0/assistant.rs b/crates/fractal-api-client-v0/src/api/client_v0/assistant.rs index 7997c4adfce..659b65c08a0 100644 --- a/crates/fractal-api-client-v0/src/api/client_v0/assistant.rs +++ b/crates/fractal-api-client-v0/src/api/client_v0/assistant.rs @@ -6,6 +6,7 @@ pub use native::propose; pub use authorization::{ReadReceipt, finish as finish_read, pin as pin_read_trust, read as read_projection}; pub use fractal_api_core::api::client_v0::assistant::*; pub use fractal_api_core::api::client_v0::assistant::{PRINCIPAL, append, authenticate, authorize_route, device_resources, trusted_issuer}; +use fractal_api_core::api::client_v0::external_grants::{projection_with_witness, revoked}; pub mod authorization; pub mod native; pub mod reads; @@ -182,12 +183,22 @@ async fn complete_inner(state: &AppState, id: &str, request: &PairingComplete, "grant":projection})))) } +#[derive(Default, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct AssistantGrantQuery { + witness: Option, +} + pub async fn inspect(State(state): State, Extension(session): Extension, - AxumPath(id): AxumPath) -> Result, ApiError> { + AxumPath(id): AxumPath, Query(query): Query) -> Result, ApiError> { trusted_issuer(&state, &session)?; let granted = latest(&state, &subject(&id)?, GRANTED)? .ok_or_else(|| ApiError::not_found("assistant grant does not exist"))?; - Ok(Json(projection(&state, &granted)?)) + Ok(Json(if query.witness.as_deref() == Some("1") { + projection_with_witness(&state, &granted)? + } else { + projection(&state, &granted)? + })) } async fn revoke_inner(State(state): State, Extension(session): Extension, @@ -200,7 +211,7 @@ async fn revoke_inner(State(state): State, Extension(session): Extensi if granted.origin != state.store.origin() { return Err(forbidden("assistant revocation must run on its authoritative issuer")); } - if latest(&state, &subject, REVOKED)?.is_none() { + if !revoked(&state, &granted)? { let previous = effective(&state, &granted)?; append(&state, subject, REVOKED, issuer, json!({"version":1,"grant_id":fields(&granted)?["grant_id"], "principal":principal(fields(&granted)?)?,"issuer":issuer,"transport":session.transport, @@ -226,7 +237,7 @@ async fn update_policy_inner(State(state): State, Extension(session): if granted.origin != state.store.origin() { return Err(forbidden("assistant policy must change on its authoritative issuer")); } - if latest(&state, &subject, REVOKED)?.is_some() { return Err(forbidden("assistant grant was revoked")); } + if revoked(&state, &granted)? { return Err(forbidden("assistant grant was revoked")); } let previous = effective(&state, &granted)?; // Policy changes must not revive an expired grant: fail closed instead of extending it. if fields(&previous)?["expires_at_unix_ms"].as_u64().map(u128::from).unwrap_or(0) <= client_now_ms() { @@ -280,6 +291,73 @@ mod tests { &request, "fabric-loopback").await.unwrap().unwrap().0 } + // Frozen pre-witness shape, independent of today's generated grant model. + #[derive(Deserialize)] + #[serde(deny_unknown_fields)] + #[allow(dead_code)] + struct LegacyAssistantGrant { + kind: String, + id: String, + principal: String, + sender_class: String, + session_actor: String, + device_id: String, + key_id: String, + issuer: String, + scopes: Vec, + expires_at: String, + policy_revision: u64, + minimal_read_mode: String, + recipient_allowlist: Vec, + disclosure_consent: bool, + consent_evidence: String, + revoked: bool, + read_trust: Option, + } + + #[tokio::test] + async fn grant_responses_preserve_strict_legacy_shape_unless_inspect_opts_in() { + use axum::{body::{Body, to_bytes}, http::Request}; + use tower::ServiceExt; + + let root = tempfile::tempdir().unwrap(); + let state = state(root.path()); + let paired = paired(&state).await; + serde_json::from_value::(paired["grant"].clone()).unwrap(); + let id = paired["grant"]["id"].as_str().unwrap(); + let app = super::super::super::router_for_transport(state.clone(), ClientTransportBoundary::Unix, &[crate::api::client_v0::routes]); + for query in ["", "?witness=0", "?witness=true", "?witness=1"] { + let mut request = Request::builder() + .uri(format!("/v1/client/assistant/grants/{}{query}", urlencoding::encode(id))) + .header(LOCAL_PERSON_HEADER, ISSUER).body(Body::empty()).unwrap(); + request.extensions_mut().insert(super::super::super::LocalPeer { pid: 8, peer_process: None, ancestor: None }); + let response = app.clone().oneshot(request).await.unwrap(); + assert_eq!(response.status(), StatusCode::OK); + let body: Value = serde_json::from_slice(&to_bytes(response.into_body(), usize::MAX).await.unwrap()).unwrap(); + let grant = body["value"].clone(); + if query == "?witness=1" { + assert_eq!(grant["conflict"], Value::Null); + assert!(grant["cleared_conflicts"].is_array()); + assert!(serde_json::from_value::(grant).is_err()); + } else { + serde_json::from_value::(grant).unwrap(); + } + } + let policy = serde_json::from_value(json!({ + "api_version": CLIENT_API_VERSION, "scopes": SCOPES[..4], + "disclosure_consent": true, "consent_evidence": "owner approved renewal", + "minimal_read_mode": "approval-once" + })).unwrap(); + let Json(changed) = update_policy(State(state.clone()), + Extension(ClientSession::local(Some(ISSUER)).unwrap()), + AxumPath(id.into()), Json(policy)).await.unwrap(); + serde_json::from_value::(changed).unwrap(); + let Json(revoked) = revoke(State(state), + Extension(ClientSession::local(Some(ISSUER)).unwrap()), + AxumPath(id.into())).await.unwrap(); + serde_json::from_value::(revoked).unwrap(); + } + #[tokio::test] async fn supported_principals_bind_grants_to_the_same_owner_and_origin() { for principal in [PRINCIPAL, MCP_PRINCIPAL] { @@ -368,7 +446,8 @@ mod tests { value["principal"] = json!(replacement); value["session_actor"] = json!(format!("{replacement}/session/{}", paired["grant"]["id"].as_str().unwrap())); append(&state, granted.subject.clone(), POLICY, ISSUER, value, Some(&granted)).unwrap(); - assert!(authenticate(&state, &credential_digest(paired["credential"].as_str().unwrap()), "fabric-loopback").is_err()); + let session = authenticate(&state, &credential_digest(paired["credential"].as_str().unwrap()), "fabric-loopback").unwrap().unwrap(); + assert_eq!(session.authority_actor, principal); } } } @@ -618,7 +697,7 @@ mod tests { assert_eq!(fs::metadata(&profile).unwrap().permissions().mode() & 0o777,0o600); assert!(!root.path().join("devices.json").exists()); let Json(grant)=inspect(State(state),Extension(ClientSession::local(Some(ISSUER)).unwrap()), - AxumPath(device.session.grant.id)).await.unwrap(); + AxumPath(device.session.grant.id), Query(AssistantGrantQuery::default())).await.unwrap(); assert_eq!(grant["principal"],PRINCIPAL); server.abort(); } diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants.rs b/crates/fractal-api-core/src/api/client_v0/external_grants.rs index e1140d4cbce..cabce38fef0 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants.rs @@ -70,25 +70,36 @@ fn digest_only(source: &Value) -> Result<(), ApiError> { // Admission and authentication share the principal-indexed active-grant fold. // append owns the admission lock; several grants of the same profile are allowed. -// Filter revoked/expired history before loading claim bodies into Rust. Expiry -// uses the latest policy, not the original grant. +// Expired base grants without issuer policies are pruned in SQL. A policy +// candidate must reach the authenticated fold: SQL cannot verify its signature. +// Foreign revocations likewise reach Rust. Local revocations can be prefiltered +// only when their origin, owner and immutable grant identity match. const ADMISSION_QUERY: &str = "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 - AND (?5 IS NULL OR NOT EXISTS (SELECT 1 FROM claims AS revoked WHERE revoked.subject=claims.subject AND revoked.kind=?3)) - AND (?5 IS NULL OR COALESCE( - (SELECT CASE WHEN json_type(policy.body,'$.fields') IS NULL THEN 1 ELSE - COALESCE(json_type(policy.body,'$.fields.expires_at_unix_ms')='integer' - AND json_extract(policy.body,'$.fields.expires_at_unix_ms')>?5,0) END - FROM claims AS policy WHERE policy.subject=claims.subject AND policy.kind=?4 ORDER BY policy.store_index DESC LIMIT 1), - CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE + AND (?5 IS NULL OR origin<>?6 OR NOT EXISTS ( + SELECT 1 FROM claims AS revoked WHERE revoked.subject=claims.subject AND revoked.kind=?3 + AND revoked.origin=claims.origin AND revoked.actor=claims.actor + AND (json_type(revoked.body,'$.fields.principal') IS NULL OR json_extract(revoked.body,'$.fields.principal') IN ('assistant/chatgpt','assistant/mcp')) + AND (json_type(revoked.body,'$.fields.profile') IS NULL OR json_extract(revoked.body,'$.fields.profile') IN ('assistant','service')) + AND json_extract(revoked.body,'$.fields.issuer') IS json_extract(claims.body,'$.fields.issuer') + AND json_extract(revoked.body,'$.fields.grant_id') IS json_extract(claims.body,'$.fields.grant_id') + AND COALESCE(json_extract(revoked.body,'$.fields.principal'),'assistant/chatgpt')=COALESCE(json_extract(claims.body,'$.fields.principal'),'assistant/chatgpt') + AND COALESCE(json_extract(revoked.body,'$.fields.profile'),'assistant')=COALESCE(json_extract(claims.body,'$.fields.profile'),'assistant'))) + AND (?5 IS NULL OR EXISTS ( + SELECT 1 FROM claims AS policy WHERE policy.subject=claims.subject AND policy.kind=?4 AND policy.origin=claims.origin) + OR CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' - AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END))"; + AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END)"; + +#[cfg(feature = "test-support")] +pub const fn admission_query_for_test() -> &'static str { ADMISSION_QUERY } + fn candidate_grants(state: &AppState, principal: &str, expiry_cut: Option) -> Result, ApiError> { let owner = owning_person(state)?; let ids = { let connection = state.store.readers.get(); let mut query = connection.prepare(/* sqlite-large-value: allow-for-now lv-h99f1a302c7b1 owner=fractal_api_core::api::client_v0::external_grants TODO=trace-statement-and-value-representation */ ADMISSION_QUERY).map_err(ApiError::internal)?; - query.query_map(rusqlite::params![GRANTED, principal, REVOKED, POLICY, expiry_cut], |row| row.get::<_, String>(0)) + query.query_map(rusqlite::params![GRANTED, principal, REVOKED, POLICY, expiry_cut, state.store.origin()], |row| row.get::<_, String>(0)) .map_err(ApiError::internal)?.collect::, _>>().map_err(ApiError::internal)? }; let mut active = Vec::new(); @@ -96,7 +107,7 @@ fn candidate_grants(state: &AppState, principal: &str, expiry_cut: Option) let grant = state.store.claim_by_id(&id).map_err(ApiError::internal)? .ok_or_else(|| forbidden("external grant is absent"))?; if grant.actor.as_deref() != Some(owner) - || (expiry_cut.is_some() && latest(state, &grant.subject, REVOKED)?.is_some()) { + || (expiry_cut.is_some() && revoked(state, &grant)?) { continue; } let policy = effective(state, &grant)?; @@ -106,8 +117,7 @@ fn candidate_grants(state: &AppState, principal: &str, expiry_cut: Option) // Only well-formed owner grants carried by a signed, admitted issuer // count; policies must have the same provenance and immutable identity. if foreign && (!valid_foreign_grant(state, &grant, &policy)? - || !state.store.claim_has_authenticated_member_writer(&grant.id).map_err(ApiError::internal)? - || (policy.id != grant.id && !state.store.claim_has_authenticated_member_writer(&policy.id).map_err(ApiError::internal)?)) { + || !state.store.claim_has_authenticated_member_writer(&grant.id).map_err(ApiError::internal)?) { continue; } let source = fields(&policy)?; @@ -299,8 +309,43 @@ pub fn audit(state: &AppState, operation: &str, actor: &str, transport: &str, Ok(()) } +// Ignore unauthoritative overlays, including a newer malformed policy. Walk +// backwards to the last valid issuer transition rather than dropping the grant. +fn transition(state: &AppState, granted: &ClaimRecord, kind: &str) -> Result, ApiError> { + let mut before = None; + loop { + let page = state.store.claims_for_subject_kind_at(&granted.subject, kind, before, true, 32) + .map_err(ApiError::internal)?; + for candidate in page.claims { + if candidate.origin != granted.origin || candidate.actor.as_deref() != Some(owning_person(state)?) { + continue; + } + let (Ok(original), Ok(source)) = (fields(granted), fields(&candidate)) else { continue }; + let consistent = principal(source).ok().zip(principal(original).ok()).is_some_and(|(a, b)| a == b) + && Profile::stored(source).ok().zip(Profile::stored(original).ok()).is_some_and(|(a, b)| a == b) + && ["grant_id", "issuer"].iter().all(|key| source[*key] == original[*key]); + if !consistent || source["issuer"] != owning_person(state)? { continue; } + if kind == POLICY && (!valid_foreign_grant(state, granted, &candidate)? + || source["expires_at_unix_ms"].as_u64().is_none()) { + continue; + } + if granted.origin != state.store.origin() + && !state.store.claim_has_authenticated_member_writer(&candidate.id).map_err(ApiError::internal)? { + continue; + } + return Ok(Some(candidate)); + } + let Some(cursor) = page.next_cursor else { return Ok(None) }; + before = Some(cursor); + } +} + +pub fn revoked(state: &AppState, granted: &ClaimRecord) -> Result { + Ok(transition(state, granted, REVOKED)?.is_some()) +} + pub fn effective(state: &AppState, granted: &ClaimRecord) -> Result { - Ok(latest(state, &granted.subject, POLICY)?.unwrap_or_else(|| granted.clone())) + Ok(transition(state, granted, POLICY)?.unwrap_or_else(|| granted.clone())) } pub fn projection(state: &AppState, granted: &ClaimRecord) -> Result { let policy = effective(state, granted)?; @@ -308,7 +353,7 @@ pub fn projection(state: &AppState, granted: &ClaimRecord) -> Result Result Result { + let mut value = projection(state, granted)?; + let policy = effective(state, granted)?; + let source = fields(&policy)?; let now = client_now_ms() as u64; value["conflict"] = profile_conflict_at(state, granted, now)?.unwrap_or(Value::Null); if value["conflict"].is_null() { @@ -324,8 +376,7 @@ pub fn projection(state: &AppState, granted: &ClaimRecord) -> Result(0)).unwrap().collect::, _>>().unwrap(); found.sort(); expected.sort(); assert_eq!(found, expected); let unfiltered = connection.prepare(ADMISSION_QUERY).unwrap() - .query_map(rusqlite::params![GRANTED, PRINCIPAL, REVOKED, POLICY, Option::::None], + .query_map(rusqlite::params![GRANTED, PRINCIPAL, REVOKED, POLICY, Option::::None, "local"], |row| row.get::<_, String>(0)).unwrap().collect::, _>>().unwrap(); assert_eq!(unfiltered.len(), 12, "invalid owner configuration must not hide validation errors"); } @@ -535,13 +586,13 @@ mod tests { assert!(latest(&state, &next, GRANTED).unwrap().is_none()); state.store.append_claim(&ClaimInput { subject: service_subject, kind: REVOKED.into(), actor: Some("person/owner".into()), - fields: BTreeMap::new(), evidence: vec![grant.id.clone()], + fields: serde_json::from_value(fields(&grant).unwrap().clone()).unwrap(), evidence: vec![grant.id.clone()], expected_subject: Some(Some(grant.id.clone())), idempotency_key: None, }).unwrap(); let candidates = { let connection = state.store.readers.get(); connection.prepare(ADMISSION_QUERY).unwrap() - .query_map(rusqlite::params![GRANTED, PRINCIPAL, REVOKED, POLICY, client_now_ms() as u64], |row| row.get::<_, String>(0)) + .query_map(rusqlite::params![GRANTED, PRINCIPAL, REVOKED, POLICY, client_now_ms() as u64, state.store.origin()], |row| row.get::<_, String>(0)) .unwrap().collect::, _>>().unwrap() }; assert_eq!(candidates.len(), 2); diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs b/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs index 3e262da596e..3b894fca786 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs @@ -124,7 +124,7 @@ fn disconnected_opposite_profiles_conflict_on_both_members_and_revocation_recove assert_conflict(&error); assert_witness(&Value::Object((*error.details).clone())["conflict"]); assert_witness(&profile_conflict(state, grant).unwrap().unwrap()); - assert_witness(&projection(state, grant).unwrap()["conflict"]); + assert_witness(&projection_with_witness(state, grant).unwrap()["conflict"]); } } append(&b, service.subject.clone(), REVOKED, OWNER, @@ -133,10 +133,10 @@ fn disconnected_opposite_profiles_conflict_on_both_members_and_revocation_recove for state in [&a, &b] { for grant in [&assistant, &service] { assert!(profile_conflict(state, grant).unwrap().is_none()); - assert!(projection(state, grant).unwrap()["conflict"].is_null()); + assert!(projection_with_witness(state, grant).unwrap()["conflict"].is_null()); } assert!(authenticate_id(state, SERVICE_ID).is_err()); - let inspected = projection(state, &assistant).unwrap(); + let inspected = projection_with_witness(state, &assistant).unwrap(); let cleared = inspected["cleared_conflicts"].as_array().unwrap(); assert_eq!(cleared.len(), 1); assert_eq!(cleared[0]["cause"], "revoked"); @@ -173,7 +173,7 @@ fn expiry_boundary_clears_conflict_and_disconnected_reissue_recomputes_it() { assert_eq!(unexpired(fields(&effective(&a, &service).unwrap()).unwrap(), now), conflicted); } assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some()); - let inspected = projection(&a, &assistant).unwrap(); + let inspected = projection_with_witness(&a, &assistant).unwrap(); assert!(inspected["conflict"].is_null()); let cleared = inspected["cleared_conflicts"].as_array().unwrap(); assert_eq!(cleared.len(), 1); @@ -194,7 +194,7 @@ fn expiry_boundary_clears_conflict_and_disconnected_reissue_recomputes_it() { for id in [ASSISTANT_ID, replacement_id] { assert_conflict(&authenticate_id(&a, id).err().unwrap()); } - let inspected = projection(&a, &assistant).unwrap(); + let inspected = projection_with_witness(&a, &assistant).unwrap(); assert_eq!(inspected["conflict"], witness); assert!(inspected["cleared_conflicts"].is_null()); } @@ -245,7 +245,7 @@ fn malformed_authenticated_foreign_grants_cannot_suspend_a_local_credential() { source[invalid] = Value::Null; } let foreign = raw_claim(&b, &subject(SERVICE_ID).unwrap(), GRANTED, - if invalid == "actor" { "person/attacker" } else { OWNER }, source); + if invalid == "actor" { "person/intruder" } else { OWNER }, source); replicate(&b, &a); assert!(a.store.claim_by_id(&foreign.id).unwrap().is_some(), "{invalid}"); assert!(a.store.claim_has_authenticated_member_writer(&foreign.id).unwrap(), "{invalid}"); @@ -255,7 +255,7 @@ fn malformed_authenticated_foreign_grants_cannot_suspend_a_local_credential() { } #[test] -fn foreign_policy_with_mismatched_identity_cannot_suspend_a_local_credential() { +fn foreign_policy_with_mismatched_identity_cannot_clear_a_conflict() { let _service = ServiceFixture::enable(); let root = tempfile::tempdir().unwrap(); let (a, b) = admitted_pair(root.path()); @@ -265,7 +265,96 @@ fn foreign_policy_with_mismatched_identity_cannot_suspend_a_local_credential() { policy["session_actor"] = json!("assistant/chatgpt/session/333333333333333333333333"); raw_claim(&b, &foreign.subject, POLICY, OWNER, policy); replicate(&b, &a); - assert!(profile_conflict(&a, &local).unwrap().is_none()); + assert!(profile_conflict(&a, &local).unwrap().is_some()); + assert_conflict(&authenticate_id(&a, ASSISTANT_ID).err().unwrap()); +} + +#[test] +fn wrong_origin_revocation_and_expired_policy_cannot_clear_conflict() { + let _service = ServiceFixture::enable(); + let root = tempfile::tempdir().unwrap(); + for kind in [REVOKED, POLICY] { + let (a, b) = admitted_pair(root.path()); + let local = issue(&a, ASSISTANT_ID, "assistant").unwrap(); + let foreign = issue(&b, SERVICE_ID, "service").unwrap(); + replicate(&a, &b); + replicate(&b, &a); + let mut overlay = fields(&foreign).unwrap().clone(); + if kind == POLICY { + overlay["expires_at_unix_ms"] = json!(1_u64); + } + // An admitted, signed writer with an owner-shaped actor still cannot + // mutate another member's grant lifecycle. + let malicious = raw_claim(&a, &foreign.subject, kind, OWNER, overlay); + replicate(&a, &b); + for state in [&a, &b] { + assert!(state.store.claim_has_authenticated_member_writer(&malicious.id).unwrap()); + assert_eq!(effective(state, &foreign).unwrap().id, foreign.id); + assert_witness(&profile_conflict(state, &local).unwrap().unwrap()); + for id in [ASSISTANT_ID, SERVICE_ID] { + assert_conflict(&authenticate_id(state, id).err().unwrap()); + } + let inspected = projection_with_witness(state, &local).unwrap(); + assert!(inspected["conflict"].is_object()); + assert!(inspected["cleared_conflicts"].is_null()); + } + } +} + +#[test] +fn malformed_same_origin_expired_policy_keeps_the_last_valid_live_policy() { + let _service = ServiceFixture::enable(); + let root = tempfile::tempdir().unwrap(); + let (a, b) = admitted_pair(root.path()); + let local = issue(&a, ASSISTANT_ID, "assistant").unwrap(); + let foreign = issue(&b, SERVICE_ID, "service").unwrap(); + let mut live = fields(&foreign).unwrap().clone(); + live["policy_revision"] = json!(2); + let live = append(&b, foreign.subject.clone(), POLICY, OWNER, live, Some(&foreign)).unwrap(); + let mut malformed = fields(&live).unwrap().clone(); + malformed["expires_at_unix_ms"] = json!(1_u64); + malformed["session_actor"] = json!("assistant/chatgpt/session/not-this-grant"); + raw_claim(&b, &foreign.subject, POLICY, OWNER, malformed); + replicate(&a, &b); + replicate(&b, &a); + for state in [&a, &b] { + assert_eq!(effective(state, &foreign).unwrap().id, live.id); + assert_witness(&profile_conflict(state, &local).unwrap().unwrap()); + assert_conflict(&authenticate_id(state, ASSISTANT_ID).err().unwrap()); + } +} + +#[test] +fn signed_revocation_arriving_before_its_grant_converges_without_conflict() { + let root = tempfile::tempdir().unwrap(); + let (a, b) = admitted_pair(root.path()); + let local = issue(&a, ASSISTANT_ID, "assistant").unwrap(); + replicate(&a, &b); + let source = grant_fields(SERVICE_ID, "service"); + let subject = subject(SERVICE_ID).unwrap(); + // Replicated custom lifecycle claims are open data. Import the authentic + // revocation first, while its grant is absent, then import that grant. + let revoked = raw_claim(&b, &subject, REVOKED, OWNER, source.clone()); + replicate(&b, &a); + assert!(latest(&a, &subject, GRANTED).unwrap().is_none()); + assert!(a.store.claim_by_id(&revoked.id).unwrap().is_some()); + assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some()); + let granted = raw_claim(&b, &subject, GRANTED, OWNER, source); + replicate(&b, &a); + for state in [&a, &b] { + let revoked = state.store.claim_by_id(&revoked.id).unwrap().unwrap(); + let granted = state.store.claim_by_id(&granted.id).unwrap().unwrap(); + assert!(revoked.store_index < granted.store_index); + assert!(state.store.claim_has_authenticated_member_writer(&revoked.id).unwrap()); + assert!(state.store.claim_has_authenticated_member_writer(&granted.id).unwrap()); + assert!(profile_conflict(state, &local).unwrap().is_none()); + assert!(profile_conflict(state, &granted).unwrap().is_none()); + let inspected = projection_with_witness(state, &local).unwrap(); + let cleared = inspected["cleared_conflicts"].as_array().unwrap(); + assert_eq!(cleared.len(), 1); + assert_eq!(cleared[0]["cause"], "revoked"); + assert_witness(&cleared[0]); + } assert!(authenticate_id(&a, ASSISTANT_ID).unwrap().is_some()); } @@ -294,7 +383,7 @@ fn admission_scan_uses_the_real_principal_index() { let connection = state.store.readers.get(); let mut query = connection.prepare(/* sqlite-large-value: allow-for-now lv-hf4201606586b owner=fractal_api_core::api::client_v0::external_grants::conflict_tests TODO=trace-statement-and-value-representation */ &format!("EXPLAIN QUERY PLAN {ADMISSION_QUERY}")).unwrap(); let plan = query.query_map(rusqlite::params![GRANTED, PRINCIPAL, REVOKED, POLICY, - Some(client_now_ms() as u64)], |row| row.get::<_, String>(3)).unwrap() + Some(client_now_ms() as u64), state.store.origin()], |row| row.get::<_, String>(3)).unwrap() .collect::, _>>().unwrap(); println!("external grant admission query plan:\n{}", plan.join("\n")); assert!(plan.iter().any(|step| step.contains("claims_assistant_v1_principal_index")), diff --git a/crates/fractal-client-codegen/templates/Client.swift.in b/crates/fractal-client-codegen/templates/Client.swift.in index cf0251cacd9..dd2f94a1bf3 100644 --- a/crates/fractal-client-codegen/templates/Client.swift.in +++ b/crates/fractal-client-codegen/templates/Client.swift.in @@ -299,7 +299,7 @@ public actor FractalClient { public func beginPairing(deviceName: String, personID: String) async throws -> Envelope { try await post("v1/client/pairings", PersonPairingBegin(apiVersion: fractalClientAPIVersion, deviceName: deviceName, personID: personID)) } public func beginPairing(_ request: PairingBegin) async throws -> Envelope { try await post("v1/client/pairings", request) } public func completePairing(pairingID: String, code: String, devicePublicKey: String) async throws -> Envelope { try await post("v1/client/pairings/\(pairingID.replacingOccurrences(of: "pairing/", with: ""))/complete", PairingComplete(apiVersion: fractalClientAPIVersion, code: code, devicePublicKey: devicePublicKey)) } - public func assistantGrant(_ id: String) async throws -> Envelope { try await get("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)") } + public func assistantGrant(_ id: String, witness: Bool = false) async throws -> Envelope { try await get("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)", query: witness ? [.init(name: "witness", value: "1")] : []) } public func assistantGrantRevoke(_ id: String) async throws -> Envelope { try await post("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)/revoke", [String: String]()) } public func assistantGrantPolicy(_ id: String, _ policy: AssistantGrantPolicy) async throws -> Envelope { try await post("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)/policy", policy) } public func assistantGrantReadTrust(_ id: String, _ trust: AssistantReadTrustRequest) async throws -> Envelope { try await post("v1/client/assistant/grants/\(id.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed.subtracting(CharacterSet(charactersIn: "/"))) ?? id)/read-trust", trust) } diff --git a/crates/fractal-client-codegen/templates/Client.ts.in b/crates/fractal-client-codegen/templates/Client.ts.in index 54253b63f42..f99b064142e 100644 --- a/crates/fractal-client-codegen/templates/Client.ts.in +++ b/crates/fractal-client-codegen/templates/Client.ts.in @@ -482,8 +482,8 @@ export class FractalClient { return this.request('POST', `/v1/client/pairings/${encodeURIComponent(routedId(id))}/complete`, request, undefined, undefined, requestOptions); } - async assistantGrant(id: string): Promise> { - return this.request('GET', `/v1/client/assistant/grants/${encodeURIComponent(id)}`); + async assistantGrant(id: string, options: { witness?: boolean } = {}): Promise> { + return this.request('GET', `/v1/client/assistant/grants/${encodeURIComponent(id)}${query({ witness: options.witness ? 1 : undefined })}`); } async assistantGrantRevoke(id: string): Promise> { return this.request('POST', `/v1/client/assistant/grants/${encodeURIComponent(id)}/revoke`, {}); diff --git a/crates/fractal-client-codegen/templates/lib.rs.in b/crates/fractal-client-codegen/templates/lib.rs.in index a801826b95c..87be4939449 100644 --- a/crates/fractal-client-codegen/templates/lib.rs.in +++ b/crates/fractal-client-codegen/templates/lib.rs.in @@ -2063,6 +2063,11 @@ impl Client { pub async fn assistant_grant(&self, id: &str) -> Result, ClientError> { self.get(&format!("/v1/client/assistant/grants/{}", percent_encode_segment(id.strip_prefix("assistant-grant/").unwrap_or(id)))).await } + /// Inspect with optional conflict witnesses; the default method retains the legacy wire shape. + pub async fn assistant_grant_with_witness(&self, id: &str, witness: bool) -> Result, ClientError> { + let query = if witness { "?witness=1" } else { "" }; + self.get(&format!("/v1/client/assistant/grants/{}{query}", percent_encode_segment(id.strip_prefix("assistant-grant/").unwrap_or(id)))).await + } pub async fn assistant_grant_revoke(&self, id: &str) -> Result, ClientError> { self.post(&format!("/v1/client/assistant/grants/{}/revoke", percent_encode_segment(id.strip_prefix("assistant-grant/").unwrap_or(id))), &serde_json::json!({})).await } diff --git a/crates/fractal-client/src/lib.rs b/crates/fractal-client/src/lib.rs index 4f1001ea92c..5f66ff24e64 100644 --- a/crates/fractal-client/src/lib.rs +++ b/crates/fractal-client/src/lib.rs @@ -3706,6 +3706,19 @@ impl Client { )) .await } + /// Inspect with optional conflict witnesses; the default method retains the legacy wire shape. + pub async fn assistant_grant_with_witness( + &self, + id: &str, + witness: bool, + ) -> Result, ClientError> { + let query = if witness { "?witness=1" } else { "" }; + self.get(&format!( + "/v1/client/assistant/grants/{}{query}", + percent_encode_segment(id.strip_prefix("assistant-grant/").unwrap_or(id)) + )) + .await + } pub async fn assistant_grant_revoke( &self, id: &str, diff --git a/crates/fractal/tests/daemon_cost/assistant_admission.rs b/crates/fractal/tests/daemon_cost/assistant_admission.rs index 3270fde11e8..4fb7b61b472 100644 --- a/crates/fractal/tests/daemon_cost/assistant_admission.rs +++ b/crates/fractal/tests/daemon_cost/assistant_admission.rs @@ -34,17 +34,7 @@ const GRANTED: &str = "custom.client.assistant.v1.granted"; const INDEX: &str = "claims_assistant_v1_principal_index"; const CREATE_INDEX: &str = "CREATE INDEX claims_assistant_v1_principal_index ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'))"; const A_QUERY: &str = "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2"; -const INDEXED_QUERY: &str = - "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 - AND (?5 IS NULL OR NOT EXISTS (SELECT 1 FROM claims AS revoked WHERE revoked.subject=claims.subject AND revoked.kind=?3)) - AND (?5 IS NULL OR COALESCE( - (SELECT CASE WHEN json_type(policy.body,'$.fields') IS NULL THEN 1 ELSE - COALESCE(json_type(policy.body,'$.fields.expires_at_unix_ms')='integer' - AND json_extract(policy.body,'$.fields.expires_at_unix_ms')>?5,0) END - FROM claims AS policy WHERE policy.subject=claims.subject AND policy.kind=?4 ORDER BY policy.store_index DESC LIMIT 1), - CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE - COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' - AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END))"; +const INDEXED_QUERY: &str = api::client_v0::external_grants::admission_query_for_test(); const PATH: &str = "/v1/client/assistant/summary"; fn number(name: &str, default: usize) -> usize { @@ -106,7 +96,7 @@ fn explain(connection: &rusqlite::Connection, query: &str) -> Vec { } else { statement.query(rusqlite::params![GRANTED, "assistant/chatgpt", "custom.client.assistant.v1.revoked", "custom.client.assistant.v1.policy", - u64::try_from(SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis()).unwrap()]).unwrap() + u64::try_from(SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis()).unwrap(), NODE]).unwrap() }; let mut plan = Vec::new(); while let Some(row) = rows.next().unwrap() { plan.push(row.get::<_, String>(3).unwrap()); } @@ -278,6 +268,32 @@ async fn authenticated_get_during_pairing() { let count: u64 = connection.query_row("SELECT count(*) FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2", rusqlite::params![GRANTED,principal], |r| r.get(0)).unwrap(); principal_rows.insert(principal, count); } + // Isolate indexed SQL from claim/policy loading, provenance and locks. + // Diagnostic work stays outside HTTP samples; no request-path cache. + let mut diagnostics = Vec::new(); + if indexed { for _ in 0..8 { + let started = Instant::now(); + let candidate_ids = connection.prepare(query).unwrap().query_map(rusqlite::params![ + GRANTED,"assistant/chatgpt","custom.client.assistant.v1.revoked","custom.client.assistant.v1.policy", + u64::try_from(SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis()).unwrap(),NODE + ], |row| row.get::<_, String>(0)).unwrap().collect::, _>>().unwrap(); + let candidate_sql_ms = started.elapsed().as_secs_f64() * 1000.0; + let credential = sessions[0].1["credential"].as_str().unwrap(); + let digest = hex::encode(ring::digest::digest(&ring::digest::SHA256, credential.as_bytes()).as_ref()); + let started = Instant::now(); + assert!(api::client_v0::external_grants::authenticate(&state, &digest, "http").unwrap().is_some()); + diagnostics.push(json!({"candidate_count":candidate_ids.len(),"candidate_sql_ms":candidate_sql_ms, + "direct_auth_ms":started.elapsed().as_secs_f64()*1000.0})); + }} + let inspected = store.claims_for_subject_kind_at(&template_subject, GRANTED, None, true, 1).unwrap().claims.pop().unwrap(); + let started = Instant::now(); + api::client_v0::external_grants::projection(&state, &inspected).unwrap(); + let legacy_projection_ms = started.elapsed().as_secs_f64()*1000.0; + let started = Instant::now(); + api::client_v0::external_grants::projection_with_witness(&state, &inspected).unwrap(); + let witness_projection_ms = started.elapsed().as_secs_f64()*1000.0; + println!("ADMISSION_DIAGNOSTICS {}", json!({"plan":explain(&connection, query),"samples":diagnostics, + "legacy_projection_ms":legacy_projection_ms,"witness_projection_ms":witness_projection_ms})); drop(connection); api::wait_published_lists_at_least(&store, store.index().unwrap()).await.unwrap(); let mut measurements = Vec::new(); @@ -338,6 +354,8 @@ async fn authenticated_get_during_pairing() { "fixture_person_ids":[OWNER],"verified_foreign_same_profile_active_grants":foreign_active, "history_grants_per_principal":history,"initial_total_claim_rows":total_rows,"initial_granted_rows_by_principal":principal_rows, "final_total_claim_rows":final_rows,"admission_query":query, + "conflict_fold_diagnostics":diagnostics, + "legacy_projection_ms":legacy_projection_ms,"witness_projection_ms":witness_projection_ms, "explain_without_index":before,"explain_with_index":after,"synthetic_startup_index_build_ms":build_ms, "measurements":measurements}); println!("ADMISSION_MEASUREMENT {}", serde_json::to_string_pretty(&report).unwrap()); diff --git a/crates/smallclaims/src/store.rs b/crates/smallclaims/src/store.rs index 6aa7182a434..8b2a2e15a1a 100644 --- a/crates/smallclaims/src/store.rs +++ b/crates/smallclaims/src/store.rs @@ -878,6 +878,9 @@ pub struct Store { admission_schema_digest: std::sync::OnceLock, /// The membership last folded, and the `fleet_generation` it was folded at. pub membership_cache: Mutex>, + /// Request-only sealed folds, which may omit local batches not yet sealed. + /// Never used by the sealing path's `membership_cache` fast path. + sealed_membership_cache: Mutex>, /// Where the scan for signatures missing on admitted envelopes stands. signature_backfill: Mutex, /// Read-only sealed view; never populated with the client's local-signer fallback. @@ -1336,6 +1339,7 @@ impl Store { admission: Mutex::new(()), admission_schema_digest: std::sync::OnceLock::new(), membership_cache: Mutex::new(None), + sealed_membership_cache: Mutex::new(None), fleet_authority: std::sync::OnceLock::new(), admitted_fleet_generation: AtomicI64::new(i64::MIN), signature_backfill: Mutex::default(), @@ -2636,8 +2640,13 @@ impl Store { { return Ok(membership.clone()); } - // Do not populate the sealing path's cache with a fold that can omit local batches. - fleet_membership_tx(&connection) + // Keep cold request folds separate: they can omit unsealed local batches, + // so publishing them into membership_cache would bypass the sealing path. + sealed_membership_tx( + &connection, + &mut self.sealed_membership_cache.lock() + .unwrap_or_else(PoisonError::into_inner), + ) }) } @@ -2936,9 +2945,10 @@ impl Store { } /// Whether an accepted copy was signed by a keyed fleet member acting as its origin. - /// Requires a valid record in a validated envelope, a signature key authorized for that - /// writer's sequence, and a cryptographically valid signature in this store's fleet/shard - /// domain. Legacy and unkeyed writers do not authenticate provenance. Reads only sealed + /// Requires a valid record in a validated or degraded envelope, a signature key authorized + /// for that writer's sequence, and a cryptographically valid signature in this store's + /// fleet/shard domain. Invalid sibling records do not disqualify a valid record in a + /// degraded envelope. Legacy and unkeyed writers do not authenticate provenance. Reads only sealed /// membership; this query never seals local batches or scans the replication log. pub fn claim_has_authenticated_member_writer(&self, claim_id: &str) -> Result { self.read_snapshot(|_| { @@ -2958,7 +2968,7 @@ impl Store { JOIN replica_envelope_signatures AS signatures USING (writer, sequence, envelope_hash) WHERE records.claim_id=?1 AND records.state='valid' - AND envelopes.receipt_state='validated'", + AND envelopes.receipt_state IN ('validated', 'degraded')", )?; let rows = statement.query_map([claim_id], |row| { Ok(( @@ -3327,6 +3337,22 @@ fn fleet_generation(connection: &Connection) -> Result { .query_row(/* sqlite-large-value: allow-for-now lv-h339ecb1b2413 owner=smallclaims::store TODO=trace-statement-and-value-representation */ [], |row| row.get(0))?) } +// The caller holds one snapshot for both the generation read and membership fold. +fn sealed_membership_tx( + connection: &Connection, + cache: &mut Option<(i64, crate::fleet::Membership)>, +) -> Result { + let generation = fleet_generation(connection)?; + if let Some((cached_generation, membership)) = cache.as_ref() + && *cached_generation == generation + { + return Ok(membership.clone()); + } + let membership = fleet_membership_tx(connection)?; + *cache = Some((generation, membership.clone())); + Ok(membership) +} + // The caller holds a read snapshot. Unlike the client view this has no local signer; // Membership::fold and FleetView::from_membership use no clock or expiry state. fn sealed_fleet_view_tx( diff --git a/crates/smallclaims/src/store/membership_query_tests.rs b/crates/smallclaims/src/store/membership_query_tests.rs index 3ba1abe2dcf..da53fc5fb3b 100644 --- a/crates/smallclaims/src/store/membership_query_tests.rs +++ b/crates/smallclaims/src/store/membership_query_tests.rs @@ -357,6 +357,71 @@ fn sealed_fleet_cache_tracks_batch_signers_after_envelope_identity_changes() { } } +#[test] +fn sealed_membership_cache_reuses_cold_folds_and_recomputes_on_generation_changes() { + let mut connection = fixture(); + connection.execute_batch(/* sqlite-large-value: allow-for-now lv-hf348da4e378d owner=smallclaims::store::membership_query_tests TODO=trace-statement-and-value-representation */ &fleet_generation_schema()).unwrap(); + let anchor = admitted("anchor", "birch", "anchor-key", "anchor", "birch", 3); + insert_claim(&connection, &anchor); + let mut cache = None; + connection.trace(Some(|sql| { + if sql.starts_with("SELECT claims.id, claims.kind, claims.subject, claims.body,") { + STATEMENTS.with(|count| count.set(count.get() + 1)); + } + })); + STATEMENTS.with(|count| count.set(0)); + // Even an empty fold with local unsealed claims must be cached. + for _ in 0..8 { + assert!(!sealed_membership_tx(&connection, &mut cache).unwrap().counts("anchor")); + } + STATEMENTS.with(|count| assert_eq!(count.get(), 1)); + let unsealed_generation = cache.as_ref().unwrap().0; + envelope(&connection, &anchor, "sealed", &["anchor-key"]); + for _ in 0..8 { + assert!(sealed_membership_tx(&connection, &mut cache).unwrap().counts("anchor")); + } + assert!(cache.as_ref().unwrap().0 > unsealed_generation); + STATEMENTS.with(|count| assert_eq!(count.get(), 2)); + connection.execute(/* sqlite-large-value: allow-for-now lv-hbea4b67b6a13 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ "DELETE FROM replica_envelope_signatures", []).unwrap(); + for _ in 0..8 { + assert!(!sealed_membership_tx(&connection, &mut cache).unwrap().counts("anchor")); + } + STATEMENTS.with(|count| assert_eq!(count.get(), 3)); + connection.trace(None); +} + +#[test] +fn sealed_membership_request_cache_does_not_bypass_local_batch_sealing() { + let store = Store::open_memory("birch", Arc::new(super::runtime::Plain)).unwrap(); + store.bind_fleet("3e7a9c41-5d2b-4f86-b0c3-9a1e6d4f2b58").unwrap(); + let key = Arc::new(crate::fleet::MemberKey::generate().unwrap().0); + store.load_member_key(Some(key.clone())).unwrap(); + store.pin_fleet_anchor(key.public()).unwrap(); + let mut anchor = admitted("anchor", "birch", key.public(), "anchor", "birch", 1); + anchor.fields.insert( + "fleet_id".into(), + serde_json::json!("3e7a9c41-5d2b-4f86-b0c3-9a1e6d4f2b58"), + ); + let claim = store.append_claim(&ClaimInput { + subject: anchor.subject, + kind: anchor.kind, + actor: None, + fields: anchor.fields, + evidence: Vec::new(), + expected_subject: None, + idempotency_key: None, + }).unwrap(); + assert!(store.membership_cache.lock().unwrap().is_none()); + assert!(store.sealed_membership_cache.lock().unwrap().is_none()); + for _ in 0..3 { + assert!(!store.fleet_membership_sealed().unwrap().counts(&claim.id)); + } + assert!(store.sealed_membership_cache.lock().unwrap().is_some()); + assert!(store.membership_cache.lock().unwrap().is_none()); + assert!(store.fleet_membership().unwrap().counts(&claim.id)); + assert!(store.fleet_membership_sealed().unwrap().counts(&claim.id)); +} + fn cache_member_window(store: &Store, key: &str, start: u64) { let mut anchor = admitted("anchor", "birch", key, "anchor", "birch", start.max(1)); anchor.fields.insert("writer_floor".into(), serde_json::json!(start.saturating_sub(1))); @@ -407,6 +472,23 @@ fn authenticated_member_writer_accepts_a_foreign_origin_from_sealed_membership() assert!(!store.claim_has_authenticated_member_writer("missing").unwrap()); } +#[test] +fn authenticated_member_writer_accepts_valid_records_in_a_degraded_envelope() { + let (store, claim, key) = authenticated_member_fixture(); + store.connection.write().execute( + /* sqlite-large-value: allow-for-now lv-h6d03218a7182 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + "UPDATE replica_envelopes SET receipt_state='degraded'", [], + ).unwrap(); + cache_member_window(&store, key.public(), 0); + assert!(store.claim_has_authenticated_member_writer(&claim).unwrap()); + store.connection.write().execute( + /* sqlite-large-value: allow-for-now lv-h9e7e7a841384 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + "UPDATE replica_envelope_signatures SET signature='invalid'", [], + ).unwrap(); + cache_member_window(&store, key.public(), 0); + assert!(!store.claim_has_authenticated_member_writer(&claim).unwrap()); +} + #[test] fn authenticated_member_writer_rejects_legacy_wrong_key_and_outside_window() { let (store, claim, key) = authenticated_member_fixture(); @@ -422,17 +504,19 @@ fn authenticated_member_writer_rejects_legacy_wrong_key_and_outside_window() { } #[test] -fn authenticated_member_writer_requires_origin_valid_record_validated_envelope_and_signature() { +fn authenticated_member_writer_requires_origin_valid_record_admitted_envelope_and_signature() { for sql in [ /* sqlite-large-value: allow-for-now lv-h908d794ad3e8 owner=smallclaims::store::membership_query_tests TODO=prepare-body-and-predecessor-values */ "UPDATE claims SET origin='forged-origin'", /* sqlite-large-value: allow-for-now lv-h6ff49ec4f026 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ "UPDATE replica_records SET state='invalid'", + /* sqlite-large-value: allow-for-now lv-h98f2eff88ab2 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + "UPDATE replica_records SET state='pending'", /* sqlite-large-value: allow-for-now lv-ha41272fe6b10 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ "UPDATE replica_envelopes SET receipt_state='pending'", - /* sqlite-large-value: allow-for-now lv-hbea4b67b6a13 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + /* sqlite-large-value: allow-for-now lv-h93f4bed1c2b4 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ "DELETE FROM replica_envelope_signatures", - /* sqlite-large-value: allow-for-now lv-h9e7e7a841384 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ + /* sqlite-large-value: allow-for-now lv-h1c91a0dec004 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ "UPDATE replica_envelope_signatures SET signature='invalid'", /* sqlite-large-value: allow-for-now lv-hc8361ab9b858 owner=smallclaims::store::membership_query_tests TODO=chunk-or-reference-exact-wire-values */ "UPDATE replica_envelope_signatures SET envelope_hash='other-envelope'", diff --git a/docs/st3/client-v0/schemas/client-v0.schema.json b/docs/st3/client-v0/schemas/client-v0.schema.json index 305de428cdb..61e3217de5d 100644 --- a/docs/st3/client-v0/schemas/client-v0.schema.json +++ b/docs/st3/client-v0/schemas/client-v0.schema.json @@ -3867,8 +3867,8 @@ "disclosure_consent": { "type": "boolean" }, "consent_evidence": { "type": "string", "minLength": 1, "maxLength": 512 }, "revoked": { "type": "boolean" }, - "conflict": { "anyOf": [{ "$ref": "#/$defs/GrantProfileConflictWitness" }, { "type": "null" }], "description": "Current opposite-profile conflict, or null when no active conflict exists. Absent on older servers." }, - "cleared_conflicts": { "type": "array", "items": { "$ref": "#/$defs/ClearedGrantProfileConflictWitness" }, "description": "Revoked or expired opposite-profile witnesses; emitted only when conflict is null." }, + "conflict": { "anyOf": [{ "$ref": "#/$defs/GrantProfileConflictWitness" }, { "type": "null" }], "description": "Current opposite-profile conflict, or null when no active conflict exists. Present only on grant inspection with witness=1; omitted from default inspection, pairing and mutation responses." }, + "cleared_conflicts": { "type": "array", "items": { "$ref": "#/$defs/ClearedGrantProfileConflictWitness" }, "description": "Revoked or expired opposite-profile witnesses; emitted only on grant inspection with witness=1 when conflict is null." }, "read_trust": { "$ref": "#/$defs/AssistantReadTrust", "description": "Owner-provisioned public pins for SCG read proofs. Absent means every assistant read is denied." } } }, diff --git a/docs/st3/client-v0/schemas/operations.json b/docs/st3/client-v0/schemas/operations.json index 0c9fe829703..321ffab52e5 100644 --- a/docs/st3/client-v0/schemas/operations.json +++ b/docs/st3/client-v0/schemas/operations.json @@ -135,7 +135,7 @@ { "id": "action.submit", "method": "POST", "path": "/v1/client/actions", "request": "ActionRequest", "response": "ActionResult" }, { "id": "pairing.begin", "method": "POST", "path": "/v1/client/pairings", "request": "PairingBegin", "response": "PairingChallenge", "local_only": true }, { "id": "pairing.complete", "method": "POST", "path": "/v1/client/pairings/{id}/complete", "request": "PairingComplete", "response": "PairedSession" }, - { "id": "assistant.grant.get", "method": "GET", "path": "/v1/client/assistant/grants/{id}", "response": "AssistantGrant", "local_only": true, "actor": "daemon-configured-owner", "capability": "assistant.grants.v1" }, + { "id": "assistant.grant.get", "method": "GET", "path": "/v1/client/assistant/grants/{id}", "response": "AssistantGrant", "local_only": true, "actor": "daemon-configured-owner", "capability": "assistant.grants.v1", "query": { "witness": "optional; only 1 opts into conflict and cleared_conflicts fields. Omitted or any other value retains the pre-witness response shape. Opt-in applies only to inspection, never pairing or grant mutations; 409 errors may carry conflict witnesses independently." } }, { "id": "assistant.grant.revoke", "method": "POST", "path": "/v1/client/assistant/grants/{id}/revoke", "response": "AssistantGrant", "local_only": true, "actor": "daemon-configured-owner", "capability": "assistant.grants.v1" }, { "id": "assistant.grant.policy", "method": "POST", "path": "/v1/client/assistant/grants/{id}/policy", "request": "AssistantGrantPolicy", "response": "AssistantGrant", "local_only": true, "actor": "daemon-configured-owner", "capability": "assistant.grants.v1" }, { "id": "assistant.grant.read-trust", "method": "POST", "path": "/v1/client/assistant/grants/{id}/read-trust", "request": "AssistantReadTrustRequest", "response": "AssistantGrant", "local_only": true, "actor": "daemon-configured-owner", "capability": "assistant.grants.v1", "increments_policy_revision": true }, diff --git a/docs/st3/large-value-sites.json b/docs/st3/large-value-sites.json index 1bb7a6a3beb..ed399befe88 100644 --- a/docs/st3/large-value-sites.json +++ b/docs/st3/large-value-sites.json @@ -798,6 +798,11 @@ {"id": "flow-h39d714b2bc13", "path": "crates/smallclaims/src/store/checkpoint_trim.rs", "function": "trim_checkpoint_from", "owner": "smallclaims::store::checkpoint_trim", "fingerprint": "344fc686f5b0778d9f534c322d46e20e2a21066b09d5acfc1c01c0cf88ad607a", "todo": "stage-generation-and-keyed-reclamation", "disposition": "allow-for-now", "description": "Exact-adoption/trim publication and durable cleanup must be separated without bypassing certification."} ], "sites": [ + {"id":"lv-h1c91a0dec004","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"701329c99c19076f8b477e2f84c40f1a2ece7974203ef799364c1f2382fd1875","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":517,"excerpt":"UPDATE replica_envelope_signatures SET signature='invalid'"}, + {"id":"lv-h6d03218a7182","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"9832c5a9904e935c7d7a9c2554db48b6c0173e6a2776085f9b183724794ffa3e","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":479,"excerpt":"UPDATE replica_envelopes SET receipt_state='degraded'"}, + {"id":"lv-h93f4bed1c2b4","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"309875e8abb2bc3a99eb38ecee4c711cb76b3289ec093bfbbc7fb20330b57bac","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":515,"excerpt":"DELETE FROM replica_envelope_signatures"}, + {"id":"lv-h98f2eff88ab2","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"a425d1008a65ca301d0a04b451621d9b1641c6739d812d23fe0c37819f712672","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":511,"excerpt":"UPDATE replica_records SET state='pending'"}, + {"id":"lv-hf348da4e378d","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"unresolved-sql-sink","fingerprint":"275c4c4da97210df1e7bfe33129bee3db036859980da47101d33c19e6caa7b4a","owner":"smallclaims::store::membership_query_tests","todo":"trace-statement-and-value-representation","disposition":"allow-for-now","line_hint":363,"excerpt":"& fleet_generation_schema ( )"}, {"id":"lv-hf4201606586b","path":"crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs","kind":"unresolved-sql-sink","fingerprint":"412c0c2f9ba50d78b84d6a1f379e285a435a7c6c05e777851130e01716e85c3c","owner":"fractal_api_core::api::client_v0::external_grants::conflict_tests","todo":"trace-statement-and-value-representation","disposition":"allow-for-now","line_hint":295,"excerpt":"& format ! ( \"EXPLAIN QUERY PLAN {ADMISSION_QUERY}\" )"}, {"id":"lv-h622f4fdd0f6d","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"unresolved-sql-sink","fingerprint":"4ec7c53222c8a758c722e2111541035ce700d5ae7bd0898c5f1b1a743e6450fd","owner":"smallclaims::store::membership_query_tests","todo":"trace-statement-and-value-representation","disposition":"allow-for-now","line_hint":432,"excerpt":"sql"}, {"id":"lv-h6ff49ec4f026","path":"crates/smallclaims/src/store/membership_query_tests.rs","kind":"sql-template","fingerprint":"77379a14bb57c713620fd58bbdc380648a7d4228bbda0e58474916d971a24bad","owner":"smallclaims::store::membership_query_tests","todo":"chunk-or-reference-exact-wire-values","disposition":"allow-for-now","line_hint":425,"excerpt":"UPDATE replica_records SET state='invalid'"}, diff --git a/docs/st3/principals-and-grants.md b/docs/st3/principals-and-grants.md index de4b43e9188..aa31f6e55ab 100644 --- a/docs/st3/principals-and-grants.md +++ b/docs/st3/principals-and-grants.md @@ -117,7 +117,7 @@ Several active grants of a principal's own profile are allowed. Admission refuse a known opposite-profile grant, including one replicated from another issuer. If disconnected issuers create opposite-profile grants, authentication suspends every conflicting grant with `grant-profile-conflict`; there is no winner. -Inspect exposes a `conflict.grants` witness with both grant IDs, origins and +Inspect with `?witness=1` exposes a `conflict.grants` witness with both grant IDs, origins and profiles. Once an owner's revoke replicates (or the opposite grant expires), the remaining grant works again on its authoritative issuer; replication never makes foreign credentials authenticate on another member. @@ -129,15 +129,28 @@ issued opposite-profile grant reintroduces the conflict by computation. Only well-formed foreign grants attributed to the configured concrete owner count as witnesses. Their grant and effective policy must have matching immutable -identity/profile, and each must have validated envelope provenance signed by a +identity/profile, and each must have authenticated envelope provenance signed by a key in its writer's admitted fleet membership window. Legacy unsigned, unverifiable and malformed custom claims do not gain suspension authority merely by naming an owner or origin. This intentionally favors verifiable issuer claims -over allowing arbitrary replicated custom fields to deny service. The fold uses -the principal expression index and removes expired/revoked history in SQL on -every admission/authentication/inspect read, including after replication catches -up. Historical `custom.client.assistant.v1.*` claim kinds and absent-principal -legacy ChatGPT grants retain their existing meaning. +over allowing arbitrary replicated custom fields to deny service. A valid record +in a degraded envelope still counts when its signature and writer window verify; +an unrelated rejected record cannot hide the grant. + +Only transitions from the grant's own origin, by its owner, with consistent +immutable identity can revoke it or change its effective policy. Foreign +transitions additionally require authenticated provenance. Invalid overlays are +ignored; the last valid policy (or original grant) stays in force. This applies to +local grants too: an unauthorized newer overlay no longer replaces their policy. +The principal expression index prunes expired base grants without issuer policy +candidates, and matching local revocations, before the authenticated Rust fold. +Foreign revocations and policy candidates reach Rust because SQL cannot verify +signatures. The sealed membership fold has a separate generation-keyed cache: +request-side cold folds populate it without populating the sealing-path cache. +Every admission/authentication/witness read recomputes conflict, including after +replication catches up. Default grant responses preserve their pre-witness shape +for old strict clients. Historical `custom.client.assistant.v1.*` claim kinds and +absent-principal legacy ChatGPT grants retain their existing meaning. Claims persist credential/code digests, never bearer tokens or pairing codes; grant projections expose neither credential material nor its digests. diff --git a/release-notes/external-grant-profile-conflict.json b/release-notes/external-grant-profile-conflict.json index 884a071764a..ecfa30f5fc5 100644 --- a/release-notes/external-grant-profile-conflict.json +++ b/release-notes/external-grant-profile-conflict.json @@ -7,7 +7,7 @@ }, "schema": { "status": "changed", - "detail": "Adds the typed client error grant-profile-conflict (GrantProfileConflict in Rust), returned as HTTP 409, plus optional AssistantGrant conflict and cleared_conflicts projection witnesses with typed assistant/service profiles and revoked/expired causes. No grant claim shape or storage migration changes." + "detail": "Adds the typed client error grant-profile-conflict (GrantProfileConflict in Rust), returned as HTTP 409, plus inspect-only ?witness=1 opt-in conflict and cleared_conflicts witnesses with typed assistant/service profiles and revoked/expired causes. Default grant responses retain their previous shape for old strict clients. No grant claim shape or storage migration changes." }, "rules": { "status": "changed", @@ -15,7 +15,7 @@ }, "compatibility": { "status": "changed", - "detail": "Conflict admission counts only well-formed foreign owner grants and matching effective policies with authenticated envelope provenance from a keyed, admitted fleet writer. Unverifiable or malformed replicated custom claims cannot acquire suspension authority by naming an owner. Tokens remain issuer-local. Older members do not enforce this suspension rule, so upgrade all serving members before relying on it." + "detail": "Conflict admission counts only well-formed foreign owner grants with authenticated envelope provenance from a keyed, admitted fleet writer, including valid records in degraded envelopes. Policies and revocations count only from the grant's own origin and owner with consistent immutable identity; foreign transitions also require authenticated provenance. Invalid overlays are ignored, retaining the last valid policy. This restriction also applies to local grants. Request-side sealed membership folds populate a separate generation-keyed cache without weakening local sealing. Tokens remain issuer-local. Older members do not enforce suspension, so upgrade all serving members before relying on it." }, "downtime": { "status": "changed", From 1a20821768bb1247e08cf4bfe138856671d66ae2 Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 10:09:43 +0100 Subject: [PATCH 08/10] perf(external-grants): bound expiry and revocation conflict probes agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- .../src/api/client_v0/external_grants.rs | 25 ++++++++++++------- .../external_grants/conflict_tests.rs | 4 +++ docs/st3/principals-and-grants.md | 4 +++ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants.rs b/crates/fractal-api-core/src/api/client_v0/external_grants.rs index cabce38fef0..3f830136a50 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants.rs @@ -74,22 +74,29 @@ fn digest_only(source: &Value) -> Result<(), ApiError> { // candidate must reach the authenticated fold: SQL cannot verify its signature. // Foreign revocations likewise reach Rust. Local revocations can be prefiltered // only when their origin, owner and immutable grant identity match. +// Materialize issuer-policy subjects once per principal, not once per expired +// grant. CASE gates revocation probes behind expiry eligibility. Pin the +// subject/kind index: the principal expression index is a quadratic revoke plan. const ADMISSION_QUERY: &str = "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 - AND (?5 IS NULL OR origin<>?6 OR NOT EXISTS ( - SELECT 1 FROM claims AS revoked WHERE revoked.subject=claims.subject AND revoked.kind=?3 + AND (?5 IS NULL OR CASE WHEN + (CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE + COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' + AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END) + OR (origin,subject) IN ( + SELECT policy.origin,policy.subject FROM claims AS policy + WHERE policy.kind=?4 AND COALESCE(json_extract(policy.body,'$.fields.principal'),'assistant/chatgpt')=?2) + THEN origin<>?6 OR NOT EXISTS ( + SELECT 1 FROM claims AS revoked INDEXED BY claims_subject_kind_accepted_index + WHERE revoked.subject=claims.subject AND revoked.kind=?3 AND revoked.origin=claims.origin AND revoked.actor=claims.actor AND (json_type(revoked.body,'$.fields.principal') IS NULL OR json_extract(revoked.body,'$.fields.principal') IN ('assistant/chatgpt','assistant/mcp')) AND (json_type(revoked.body,'$.fields.profile') IS NULL OR json_extract(revoked.body,'$.fields.profile') IN ('assistant','service')) AND json_extract(revoked.body,'$.fields.issuer') IS json_extract(claims.body,'$.fields.issuer') AND json_extract(revoked.body,'$.fields.grant_id') IS json_extract(claims.body,'$.fields.grant_id') AND COALESCE(json_extract(revoked.body,'$.fields.principal'),'assistant/chatgpt')=COALESCE(json_extract(claims.body,'$.fields.principal'),'assistant/chatgpt') - AND COALESCE(json_extract(revoked.body,'$.fields.profile'),'assistant')=COALESCE(json_extract(claims.body,'$.fields.profile'),'assistant'))) - AND (?5 IS NULL OR EXISTS ( - SELECT 1 FROM claims AS policy WHERE policy.subject=claims.subject AND policy.kind=?4 AND policy.origin=claims.origin) - OR CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE - COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' - AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END)"; + AND COALESCE(json_extract(revoked.body,'$.fields.profile'),'assistant')=COALESCE(json_extract(claims.body,'$.fields.profile'),'assistant')) + ELSE 0 END)"; #[cfg(feature = "test-support")] pub const fn admission_query_for_test() -> &'static str { ADMISSION_QUERY } @@ -509,7 +516,7 @@ mod tests { connection.execute_batch( "CREATE TABLE claims(id TEXT,subject TEXT,kind TEXT,body TEXT,origin TEXT DEFAULT 'local',actor TEXT DEFAULT 'person/owner',store_index INTEGER PRIMARY KEY); CREATE INDEX principal_scan ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')); - CREATE INDEX subject_kind ON claims(subject,kind,store_index);" + CREATE INDEX claims_subject_kind_accepted_index ON claims(subject,kind,store_index);" ).unwrap(); let fixtures = [ ("expired", json!({"fields":{"expires_at_unix_ms":99}}), None, false), diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs b/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs index 3b894fca786..4b22d2bf96d 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs @@ -388,4 +388,8 @@ fn admission_scan_uses_the_real_principal_index() { println!("external grant admission query plan:\n{}", plan.join("\n")); assert!(plan.iter().any(|step| step.contains("claims_assistant_v1_principal_index")), "principal admission must use its production index: {plan:?}"); + assert!(plan.iter().any(|step| step.contains("revoked USING INDEX claims_subject_kind_accepted_index")), + "revocation must seek by subject rather than scan the principal: {plan:?}"); + assert!(plan.iter().any(|step| step.contains("LIST SUBQUERY")), + "issuer-policy candidates must be materialized once: {plan:?}"); } diff --git a/docs/st3/principals-and-grants.md b/docs/st3/principals-and-grants.md index aa31f6e55ab..aca88e2504f 100644 --- a/docs/st3/principals-and-grants.md +++ b/docs/st3/principals-and-grants.md @@ -144,6 +144,10 @@ ignored; the last valid policy (or original grant) stays in force. This applies local grants too: an unauthorized newer overlay no longer replaces their policy. The principal expression index prunes expired base grants without issuer policy candidates, and matching local revocations, before the authenticated Rust fold. +The SQL materializes matching-principal issuer-policy subjects once, gates +revocation checks behind expiry eligibility, and pins the existing subject/kind +revocation index. This avoids a correlated policy lookup per expired grant and a +quadratic principal-wide revocation plan as completion/revocation history grows. Foreign revocations and policy candidates reach Rust because SQL cannot verify signatures. The sealed membership fold has a separate generation-keyed cache: request-side cold folds populate it without populating the sealing-path cache. From 13da93859c819be61f44899d025eacd8319716e2 Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 11:46:30 +0100 Subject: [PATCH 09/10] Seek active external grants through principal expiry ranges agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- .../src/api/client_v0/external_grants.rs | 43 ++- .../external_grants/conflict_tests.rs | 5 +- crates/fractal-store/src/store.rs | 6 +- crates/fractal-store/src/store/runtime.rs | 72 +++-- .../tests/daemon_cost/assistant_admission.rs | 8 +- docs/st3/large-value-sites.json | 273 +++++++++--------- docs/st3/large-values.md | 8 +- docs/st3/principals-and-grants.md | 7 +- .../external-grant-profile-conflict.json | 4 +- 9 files changed, 236 insertions(+), 190 deletions(-) diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants.rs b/crates/fractal-api-core/src/api/client_v0/external_grants.rs index 3f830136a50..7411993f99b 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants.rs @@ -74,29 +74,41 @@ fn digest_only(source: &Value) -> Result<(), ApiError> { // candidate must reach the authenticated fold: SQL cannot verify its signature. // Foreign revocations likewise reach Rust. Local revocations can be prefiltered // only when their origin, owner and immutable grant identity match. -// Materialize issuer-policy subjects once per principal, not once per expired -// grant. CASE gates revocation probes behind expiry eligibility. Pin the -// subject/kind index: the principal expression index is a quadratic revoke plan. +// UNION builds only candidate IDs: indexed expiry ranges prune expired base +// bodies, and the issuer-policy branch preserves renewals for verification. +// Pin revocation's subject/kind index, never its principal-wide expression index. const ADMISSION_QUERY: &str = - "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 - AND (?5 IS NULL OR CASE WHEN - (CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE - COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' - AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END) - OR (origin,subject) IN ( - SELECT policy.origin,policy.subject FROM claims AS policy - WHERE policy.kind=?4 AND COALESCE(json_extract(policy.body,'$.fields.principal'),'assistant/chatgpt')=?2) - THEN origin<>?6 OR NOT EXISTS ( + "WITH eligible(id) AS ( + SELECT id FROM claims INDEXED BY claims_assistant_v1_principal_index + WHERE ?5 IS NULL AND kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 + UNION + SELECT id FROM claims + WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 + AND json_extract(body,'$.fields.expires_at_unix_ms')>?5 + AND json_type(body,'$.fields.expires_at_unix_ms')='integer' + UNION + SELECT id FROM claims + WHERE ?5 IS NOT NULL AND kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 + AND json_extract(body,'$.fields.expires_at_unix_ms') IS NULL AND json_type(body,'$.fields') IS NULL + UNION + SELECT granted.id FROM claims AS policy INDEXED BY claims_assistant_v1_principal_index + JOIN claims AS granted INDEXED BY claims_subject_kind_accepted_index + ON granted.subject=policy.subject AND granted.kind=?1 + WHERE ?5 IS NOT NULL AND policy.kind=?4 AND policy.origin=granted.origin + AND COALESCE(json_extract(policy.body,'$.fields.principal'),'assistant/chatgpt')=?2 + AND COALESCE(json_extract(granted.body,'$.fields.principal'),'assistant/chatgpt')=?2) + SELECT claims.id FROM eligible JOIN claims ON claims.id=eligible.id + WHERE ?5 IS NULL OR claims.origin<>?6 OR NOT EXISTS ( SELECT 1 FROM claims AS revoked INDEXED BY claims_subject_kind_accepted_index WHERE revoked.subject=claims.subject AND revoked.kind=?3 AND revoked.origin=claims.origin AND revoked.actor=claims.actor + AND json_extract(revoked.body,'$.fields.issuer')=revoked.actor AND (json_type(revoked.body,'$.fields.principal') IS NULL OR json_extract(revoked.body,'$.fields.principal') IN ('assistant/chatgpt','assistant/mcp')) AND (json_type(revoked.body,'$.fields.profile') IS NULL OR json_extract(revoked.body,'$.fields.profile') IN ('assistant','service')) AND json_extract(revoked.body,'$.fields.issuer') IS json_extract(claims.body,'$.fields.issuer') AND json_extract(revoked.body,'$.fields.grant_id') IS json_extract(claims.body,'$.fields.grant_id') AND COALESCE(json_extract(revoked.body,'$.fields.principal'),'assistant/chatgpt')=COALESCE(json_extract(claims.body,'$.fields.principal'),'assistant/chatgpt') - AND COALESCE(json_extract(revoked.body,'$.fields.profile'),'assistant')=COALESCE(json_extract(claims.body,'$.fields.profile'),'assistant')) - ELSE 0 END)"; + AND COALESCE(json_extract(revoked.body,'$.fields.profile'),'assistant')=COALESCE(json_extract(claims.body,'$.fields.profile'),'assistant'))"; #[cfg(feature = "test-support")] pub const fn admission_query_for_test() -> &'static str { ADMISSION_QUERY } @@ -515,7 +527,8 @@ mod tests { let connection = rusqlite::Connection::open_in_memory().unwrap(); connection.execute_batch( "CREATE TABLE claims(id TEXT,subject TEXT,kind TEXT,body TEXT,origin TEXT DEFAULT 'local',actor TEXT DEFAULT 'person/owner',store_index INTEGER PRIMARY KEY); - CREATE INDEX principal_scan ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')); + CREATE INDEX claims_assistant_v1_principal_index ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')); + CREATE INDEX claims_assistant_v1_principal_expiry_index ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'),json_extract(body,'$.fields.expires_at_unix_ms')); CREATE INDEX claims_subject_kind_accepted_index ON claims(subject,kind,store_index);" ).unwrap(); let fixtures = [ diff --git a/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs b/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs index 4b22d2bf96d..409ad44979b 100644 --- a/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs +++ b/crates/fractal-api-core/src/api/client_v0/external_grants/conflict_tests.rs @@ -390,6 +390,7 @@ fn admission_scan_uses_the_real_principal_index() { "principal admission must use its production index: {plan:?}"); assert!(plan.iter().any(|step| step.contains("revoked USING INDEX claims_subject_kind_accepted_index")), "revocation must seek by subject rather than scan the principal: {plan:?}"); - assert!(plan.iter().any(|step| step.contains("LIST SUBQUERY")), - "issuer-policy candidates must be materialized once: {plan:?}"); + assert!(plan.iter().any(|step| step.contains("claims_assistant_v1_principal_expiry_index") + && step.contains(">?")), + "expired grant bodies must be pruned by an index range: {plan:?}"); } diff --git a/crates/fractal-store/src/store.rs b/crates/fractal-store/src/store.rs index 221793024b0..ab989319e23 100644 --- a/crates/fractal-store/src/store.rs +++ b/crates/fractal-store/src/store.rs @@ -780,7 +780,7 @@ pub struct AgentWorkQueue { /// Fractal's projection tables, and the indexes its folds read the claim log through. The /// graph creates its own tables first; see `smallclaims::store::SCHEMA`. -const SCHEMA: &str = /* sqlite-large-value: allow-for-now lv-hb9696ca837f7 owner=fractal_store::store TODO=chunk-or-reference-variable-columns */ r#" +const SCHEMA: &str = /* sqlite-large-value: allow-for-now lv-h7e7937d8fad1 owner=fractal_store::store TODO=chunk-or-reference-variable-columns */ r#" -- An unmanaged member's staging check needs tagged claims, not its runtime history. CREATE INDEX IF NOT EXISTS claims_owned_set_subject_index ON claims(subject) WHERE json_extract(body,'$.owned_set') IS NOT NULL; @@ -933,6 +933,10 @@ WHERE kind='custom.client.assistant.v1.granted'; -- Match parameterized admission by kind and effective principal, including legacy ChatGPT grants. CREATE INDEX IF NOT EXISTS claims_assistant_v1_principal_index ON claims(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')); +-- Seek live base grants without loading expired JSON bodies on each authentication. +CREATE INDEX IF NOT EXISTS claims_assistant_v1_principal_expiry_index +ON claims(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'), + json_extract(body,'$.fields.expires_at_unix_ms')); -- A runtime incarnation's claims about a subject by acceptance time, so when a session began -- and last changed are two seeks instead of a read of every claim the subject has. The -- expression is INCARNATION_OF_CLAIM, which queries repeat so the planner uses this index. diff --git a/crates/fractal-store/src/store/runtime.rs b/crates/fractal-store/src/store/runtime.rs index 95bfe580810..1a20a44be0c 100644 --- a/crates/fractal-store/src/store/runtime.rs +++ b/crates/fractal-store/src/store/runtime.rs @@ -836,18 +836,42 @@ mod schema_install_tests { const REVOKED: &str = "custom.client.assistant.v1.revoked"; const POLICY: &str = "custom.client.assistant.v1.policy"; const INDEX: &str = "claims_assistant_v1_principal_index"; + const EXPIRY_INDEX: &str = "claims_assistant_v1_principal_expiry_index"; const SELECT: &str = "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2"; + // Keep this differential reference identical to the production constant; + // the API-core real-Store plan test covers that constant directly. const ACTIVE: &str = - "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 - AND (?5 IS NULL OR NOT EXISTS (SELECT 1 FROM claims AS revoked WHERE revoked.subject=claims.subject AND revoked.kind=?3)) - AND (?5 IS NULL OR COALESCE( - (SELECT CASE WHEN json_type(policy.body,'$.fields') IS NULL THEN 1 ELSE - COALESCE(json_type(policy.body,'$.fields.expires_at_unix_ms')='integer' - AND json_extract(policy.body,'$.fields.expires_at_unix_ms')>?5,0) END - FROM claims AS policy WHERE policy.subject=claims.subject AND policy.kind=?4 ORDER BY policy.store_index DESC LIMIT 1), - CASE WHEN json_type(body,'$.fields') IS NULL THEN 1 ELSE - COALESCE(json_type(body,'$.fields.expires_at_unix_ms')='integer' - AND json_extract(body,'$.fields.expires_at_unix_ms')>?5,0) END))"; + "WITH eligible(id) AS ( + SELECT id FROM claims INDEXED BY claims_assistant_v1_principal_index + WHERE ?5 IS NULL AND kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 + UNION + SELECT id FROM claims + WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 + AND json_extract(body,'$.fields.expires_at_unix_ms')>?5 + AND json_type(body,'$.fields.expires_at_unix_ms')='integer' + UNION + SELECT id FROM claims + WHERE ?5 IS NOT NULL AND kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2 + AND json_extract(body,'$.fields.expires_at_unix_ms') IS NULL AND json_type(body,'$.fields') IS NULL + UNION + SELECT granted.id FROM claims AS policy INDEXED BY claims_assistant_v1_principal_index + JOIN claims AS granted INDEXED BY claims_subject_kind_accepted_index + ON granted.subject=policy.subject AND granted.kind=?1 + WHERE ?5 IS NOT NULL AND policy.kind=?4 AND policy.origin=granted.origin + AND COALESCE(json_extract(policy.body,'$.fields.principal'),'assistant/chatgpt')=?2 + AND COALESCE(json_extract(granted.body,'$.fields.principal'),'assistant/chatgpt')=?2) + SELECT claims.id FROM eligible JOIN claims ON claims.id=eligible.id + WHERE ?5 IS NULL OR claims.origin<>?6 OR NOT EXISTS ( + SELECT 1 FROM claims AS revoked INDEXED BY claims_subject_kind_accepted_index + WHERE revoked.subject=claims.subject AND revoked.kind=?3 + AND revoked.origin=claims.origin AND revoked.actor=claims.actor + AND json_extract(revoked.body,'$.fields.issuer')=revoked.actor + AND (json_type(revoked.body,'$.fields.principal') IS NULL OR json_extract(revoked.body,'$.fields.principal') IN ('assistant/chatgpt','assistant/mcp')) + AND (json_type(revoked.body,'$.fields.profile') IS NULL OR json_extract(revoked.body,'$.fields.profile') IN ('assistant','service')) + AND json_extract(revoked.body,'$.fields.issuer') IS json_extract(claims.body,'$.fields.issuer') + AND json_extract(revoked.body,'$.fields.grant_id') IS json_extract(claims.body,'$.fields.grant_id') + AND COALESCE(json_extract(revoked.body,'$.fields.principal'),'assistant/chatgpt')=COALESCE(json_extract(claims.body,'$.fields.principal'),'assistant/chatgpt') + AND COALESCE(json_extract(revoked.body,'$.fields.profile'),'assistant')=COALESCE(json_extract(claims.body,'$.fields.profile'),'assistant'))"; fn snapshot(connection: &Connection) -> Vec> { connection @@ -863,7 +887,7 @@ mod schema_install_tests { fn plan(connection: &Connection, sql: &str, active: bool) -> Vec { let parameters: Vec<&dyn rusqlite::ToSql> = if active { - vec![&GRANTED, &"assistant/chatgpt", &REVOKED, &POLICY, &100_u64] + vec![&GRANTED, &"assistant/chatgpt", &REVOKED, &POLICY, &100_u64, &"node"] } else { vec![&GRANTED, &"assistant/chatgpt"] }; @@ -883,28 +907,28 @@ mod schema_install_tests { let connection = Connection::open(&path).unwrap(); connection.execute_batch(smallclaims::store::SCHEMA).unwrap(); install_initial_schema(&connection, true).unwrap(); - connection.execute_batch("DROP INDEX claims_assistant_v1_principal_index;").unwrap(); + connection.execute_batch("DROP INDEX claims_assistant_v1_principal_index; DROP INDEX claims_assistant_v1_principal_expiry_index;").unwrap(); connection.pragma_update(None, "user_version", version).unwrap(); connection.execute( "INSERT INTO batches(id,origin,replica_sequence,hash,accepted_at_unix_ms) VALUES('batch','node',1,'hash','1')", [], ).unwrap(); for (id, subject, kind, body) in [ - ("legacy", "custom/client/legacy", GRANTED, r#"{"fields":{"expires_at_unix_ms":200}}"#), - ("chatgpt", "custom/client/chatgpt", GRANTED, r#"{"fields":{"principal":"assistant/chatgpt","expires_at_unix_ms":50}}"#), - ("mcp", "custom/client/mcp", GRANTED, r#"{"fields":{"principal":"assistant/mcp","expires_at_unix_ms":200}}"#), - ("policy", "custom/client/chatgpt", POLICY, r#"{"fields":{"expires_at_unix_ms":200}}"#), - ("revoked", "custom/client/legacy", REVOKED, r#"{"fields":{}}"#), + ("legacy", "custom/client/legacy", GRANTED, r#"{"fields":{"issuer":"person/owner","expires_at_unix_ms":200}}"#), + ("chatgpt", "custom/client/chatgpt", GRANTED, r#"{"fields":{"issuer":"person/owner","principal":"assistant/chatgpt","expires_at_unix_ms":50}}"#), + ("mcp", "custom/client/mcp", GRANTED, r#"{"fields":{"issuer":"person/owner","principal":"assistant/mcp","expires_at_unix_ms":200}}"#), + ("policy", "custom/client/chatgpt", POLICY, r#"{"fields":{"issuer":"person/owner","expires_at_unix_ms":200}}"#), + ("revoked", "custom/client/legacy", REVOKED, r#"{"fields":{"issuer":"person/owner"}}"#), ("unrelated", "custom/test/unrelated", "custom.test.recorded", r#"{"fields":{}}"#), ] { connection.execute( - "INSERT INTO claims(id,batch_id,subject,kind,origin,body,predecessors,accepted_at_unix_ms) VALUES(?1,'batch',?2,?3,'node',?4,'[]','1')", + "INSERT INTO claims(id,batch_id,subject,kind,origin,actor,body,predecessors,accepted_at_unix_ms) VALUES(?1,'batch',?2,?3,'node','person/owner',?4,'[]','1')", params![id, subject, kind, body], ).unwrap(); } let before = snapshot(&connection); - let plans_before = [plan(&connection, SELECT, false), plan(&connection, ACTIVE, true)]; - assert!(plans_before.iter().flatten().all(|detail| !detail.contains(INDEX))); + let plans_before = [plan(&connection, SELECT, false)]; + assert!(plans_before.iter().flatten().all(|detail| !detail.contains(INDEX) && !detail.contains(EXPIRY_INDEX))); drop(connection); let connection = Connection::open(&path).unwrap(); @@ -915,7 +939,7 @@ mod schema_install_tests { connection.pragma_query_value(None, "user_version", |row| row.get::<_, u32>(0)).unwrap(), version, ); - for (sql, active, previous) in [(SELECT, false, &plans_before[0]), (ACTIVE, true, &plans_before[1])] { + for (sql, active, previous) in [(SELECT, false, &plans_before[0]), (ACTIVE, true, &plans_before[0])] { let current = plan(&connection, sql, active); eprintln!("assistant admission version={version} active={active} before={previous:?} after={current:?}"); assert!( @@ -924,6 +948,8 @@ mod schema_install_tests { "version {version}: before={previous:?}; after={current:?}", ); } + assert!(plan(&connection, ACTIVE, true).iter().any(|step| + step.contains(EXPIRY_INDEX) && step.contains(">?"))); for (principal, mut expected) in [ ("assistant/chatgpt", vec!["chatgpt".to_owned(), "legacy".to_owned()]), ("assistant/mcp", vec!["mcp".to_owned()]), @@ -936,11 +962,11 @@ mod schema_install_tests { assert_eq!(found, expected); } let active = connection.prepare(ACTIVE).unwrap() - .query_map(params![GRANTED, "assistant/chatgpt", REVOKED, POLICY, 100_u64], |row| row.get::<_, String>(0)) + .query_map(params![GRANTED, "assistant/chatgpt", REVOKED, POLICY, 100_u64, "node"], |row| row.get::<_, String>(0)) .unwrap().collect::>>().unwrap(); assert_eq!(active, vec!["chatgpt"]); let unfiltered = connection.prepare(ACTIVE).unwrap() - .query_map(params![GRANTED, "assistant/chatgpt", REVOKED, POLICY, Option::::None], |row| row.get::<_, String>(0)) + .query_map(params![GRANTED, "assistant/chatgpt", REVOKED, POLICY, Option::::None, "node"], |row| row.get::<_, String>(0)) .unwrap().collect::>>().unwrap(); assert_eq!(unfiltered.len(), 2, "no cutoff preserves unfiltered validation candidates"); let cookie: u32 = connection.pragma_query_value(None, "schema_version", |row| row.get(0)).unwrap(); diff --git a/crates/fractal/tests/daemon_cost/assistant_admission.rs b/crates/fractal/tests/daemon_cost/assistant_admission.rs index 4fb7b61b472..dbf64be1efa 100644 --- a/crates/fractal/tests/daemon_cost/assistant_admission.rs +++ b/crates/fractal/tests/daemon_cost/assistant_admission.rs @@ -31,8 +31,8 @@ use tokio::sync::Barrier; const OWNER: &str = "person/bench-operator"; const NODE: &str = "benchmark-member"; const GRANTED: &str = "custom.client.assistant.v1.granted"; -const INDEX: &str = "claims_assistant_v1_principal_index"; -const CREATE_INDEX: &str = "CREATE INDEX claims_assistant_v1_principal_index ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'))"; +const INDEX: &str = "claims_assistant_v1_principal_expiry_index"; +const CREATE_INDEX: &str = "CREATE INDEX claims_assistant_v1_principal_expiry_index ON claims(kind,COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'),json_extract(body,'$.fields.expires_at_unix_ms'))"; const A_QUERY: &str = "SELECT id FROM claims WHERE kind=?1 AND COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt')=?2"; const INDEXED_QUERY: &str = api::client_v0::external_grants::admission_query_for_test(); const PATH: &str = "/v1/client/assistant/summary"; @@ -253,7 +253,7 @@ async fn authenticated_get_during_pairing() { let index_exists: bool = connection.query_row("SELECT EXISTS(SELECT 1 FROM sqlite_master WHERE type='index' AND name=?1)", [INDEX], |r| r.get(0)).unwrap(); assert_eq!(index_exists, indexed, "build baseline on 98e550cb; indexed on PR3-B"); let (before, after, build_ms) = if indexed { - connection.execute_batch("DROP INDEX claims_assistant_v1_principal_index").unwrap(); + connection.execute_batch("DROP INDEX claims_assistant_v1_principal_expiry_index").unwrap(); let before = explain(&connection, query); let started = Instant::now(); connection.execute_batch(CREATE_INDEX).unwrap(); @@ -402,7 +402,7 @@ fn synthetic_large_store_index_build() { [INDEX], |row| row.get(0), ).unwrap(); assert!(installed, "run the large-store index probe on the indexed branch"); - connection.execute_batch("DROP INDEX claims_assistant_v1_principal_index").unwrap(); + connection.execute_batch("DROP INDEX claims_assistant_v1_principal_expiry_index").unwrap(); // Copy every native required column rather than depending on a second claims schema. // The native autoincrement store_index, claim ID and subject must remain unique. let columns = { diff --git a/docs/st3/large-value-sites.json b/docs/st3/large-value-sites.json index ed399befe88..37439fc7d76 100644 --- a/docs/st3/large-value-sites.json +++ b/docs/st3/large-value-sites.json @@ -385,141 +385,142 @@ {"site": "lv-h932a52c91553", "path": "crates/fractal-store/src/store/work_summaries_ivm.rs", "table_pattern": "local_work_summary_clock", "columns": [{"name": "singleton", "declared_type": "INTEGER", "declaration": "INTEGER PRIMARY KEY CHECK(singleton=1)", "value_size_proven": false}, {"name": "through_ms", "declared_type": "BLOB", "declaration": "BLOB NOT NULL CHECK(length(through_ms)=16)", "value_size_proven": false}], "unresolved_template": false}, {"site": "lv-h932a52c91553", "path": "crates/fractal-store/src/store/work_summaries_ivm.rs", "table_pattern": "local_work_summaries", "columns": [{"name": "key", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "attempt", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "progress", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "progress_at", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "completion", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "next_at", "declared_type": "BLOB", "declaration": "BLOB CHECK(next_at IS NULL OR length(next_at)=16)", "value_size_proven": false}], "unresolved_template": false}, {"site": "lv-h932a52c91553", "path": "crates/fractal-store/src/store/work_summaries_ivm.rs", "index_pattern": "local_work_summaries_deadline", "table_pattern": "local_work_summaries", "key_expression_and_predicate": "(next_at,key) WHERE next_at IS NOT NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "desired", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES claims(id)", "value_size_proven": false}, {"name": "body", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "member", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "owner_run", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "owner_generation", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "owner_step", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_run_requests", "columns": [{"name": "operation_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "request_hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "message_index", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "created_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "closed", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_native_delivery_receipts_v2", "columns": [{"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY REFERENCES claims(id) ON DELETE CASCADE", "value_size_proven": false}, {"name": "claim_hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "session_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "native_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "origin", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "store_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "capabilities", "columns": [{"name": "secret_hash", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "expires_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "used", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_revisions", "columns": [{"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "state", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "body", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES claims(id)", "value_size_proven": false}, {"name": "created_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_definitions", "columns": [{"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "state", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES claims(id)", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_runs", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "initial_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "current_generation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "root_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "root_run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "parent_step_run", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "workspace", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "requester", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "inputs", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "mode", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "phase", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_run_deadlines", "columns": [{"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "timeout_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "deadline_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_run_after", "columns": [{"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "after_run", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "run_generations", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "predecessor_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "reason", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "step_runs", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "generation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES run_generations(id)", "value_size_proven": false}, {"name": "step_path", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "definition_hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "attempt", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "assignee", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "available_to", "declared_type": "TEXT", "declaration": "TEXT NOT NULL DEFAULT '[]'", "value_size_proven": false}, {"name": "agentless", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 1", "value_size_proven": false}, {"name": "title", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "goals", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "worker_reported", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "lease_owner", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "lease_incarnation", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "lease_expires_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "blocked_reason", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "not_before_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "activated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "readiness_epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "constraints", "declared_type": "TEXT", "declaration": "TEXT NOT NULL DEFAULT '[]'", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_harness_question_generations", "columns": [{"name": "question", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "generation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_owners", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_bindings", "columns": [{"name": "token", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_argv_bindings", "columns": [{"name": "token", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "member", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_leases", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "provider", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "session", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "sequence", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "pid", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "process_token", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "token", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "revoked", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_work_lease_renewals", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "attempt", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "lease_owner", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "lease_incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "lease_expires_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_observations", "columns": [{"name": "id", "declared_type": "INTEGER", "declaration": "INTEGER PRIMARY KEY AUTOINCREMENT", "value_size_proven": false}, {"name": "after_store_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "body", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "dedupe_key", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "request_digest", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "observed_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "client_diagnostic_receipts", "columns": [{"name": "device", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "event_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "accepted_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_subscription_mission_deferrals", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "request", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "not_before_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "attempts", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_usage_spend", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "model", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "account", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "owner_run", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "owner_step", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "host", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "input_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "output_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cache_write_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cache_write_1h_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cached_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "total_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cost_microusd", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "reported_cost_microusd", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "unpriced_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "observed_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_usage_provenance", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "slot", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "pricing", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_limit_stops", "columns": [{"name": "account", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "episode", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "seat", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "stopped_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_seat_accounts", "columns": [{"name": "seat", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "account", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "chosen_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_usage_responses", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "source_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "observed_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_latest_slots", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "slot", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "published_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "published_fields", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "pending_local_id", "declared_type": "INTEGER", "declaration": "INTEGER", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "claims_stored", "columns": [{"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "writer", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "since_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "claims", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "bytes", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "revision_proposals", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "source_generation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES run_generations(id)", "value_size_proven": false}, {"name": "candidate_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "reason", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "cutover", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "compatible_steps", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "reviewers", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "approvals", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "preview_hash", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "successor_generation_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "planning_sessions", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "request_ref", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "workspace", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "requester", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "planner", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "planner_spec_json", "declared_type": "TEXT", "declaration": "TEXT NOT NULL DEFAULT '{\"provider\":\"codex\"}'", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "target_run_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "source_generation_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "published_revision", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "planning_candidates", "columns": [{"name": "session_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES planning_sessions(id)", "value_size_proven": false}, {"name": "variant", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "revision", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "markdown_ref", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "kdl_ref", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "mission_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "submitted_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "table_pattern": "planning_previews", "columns": [{"name": "session_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES planning_sessions(id)", "value_size_proven": false}, {"name": "variant", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "candidate_revision", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "store_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "graph", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "diff", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "mission_response", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_owned_set_subject_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject) WHERE json_extract(body,'$.owned_set') IS NOT NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_terminal_history_index", "table_pattern": "claims", "key_expression_and_predicate": "(store_index) WHERE kind IN ('mission-run.state','step-run.state','work.failed') AND json_extract(body,'$.fields.status') IN ('failed','cancelled','completed')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_terminal_capability_hash_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.capability_hash'), store_index) WHERE kind='custom.client.terminal-attached'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_receipt_actor_key_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.receipt.actor_key'), origin, subject) WHERE kind='harness-question.resolved' AND actor IS NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_to_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.to'), subject) WHERE kind='message.sent'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_report_to_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.report_to'), subject) WHERE kind IN ('mission-run.created','mission-run.report-to')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_from_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.from'), store_index) WHERE kind='message.sent'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_legacy_to_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.to'), store_index) WHERE kind='message.sent' AND json_type(body, '$.fields') IS NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_legacy_from_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.from'), store_index) WHERE kind='message.sent' AND json_type(body, '$.fields') IS NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_resume_host_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.host'), subject) WHERE kind='runtime.action.requested' AND json_extract(body,'$.fields.action')='resume'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_actor_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(actor, length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind IN ('work.progress', 'work.submitted')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_from_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.from'), length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind='message.sent'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_to_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.to'), length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind='message.sent'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_timeline_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind='harness.timeline' AND json_extract(body, '$.fields.entry_type') IN ('message','content','tool_call','tool_result')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_actor_work_activity_index", "table_pattern": "claims", "key_expression_and_predicate": "(actor, json_extract(body, '$.fields.claim_incarnation'), store_index) WHERE kind IN ('work.claimed', 'work.progress')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_appeared_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.subagent_id')) WHERE kind='subagent.appeared'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_renewed_max_lease_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.subagent_id'), CAST(json_extract(body, '$.fields.lease_expires_at_unix_ms') AS INTEGER)) WHERE kind='subagent.renewed'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_ended_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.subagent_id')) WHERE kind='subagent.ended'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_appeared_lease_index", "table_pattern": "claims", "key_expression_and_predicate": "(CAST(json_extract(body, '$.fields.lease_expires_at_unix_ms') AS INTEGER)) WHERE kind='subagent.appeared'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_renewed_lease_index", "table_pattern": "claims", "key_expression_and_predicate": "(CAST(json_extract(body, '$.fields.lease_expires_at_unix_ms') AS INTEGER)) WHERE kind='subagent.renewed'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_timeline_incarnation_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, kind, json_extract(body, '$.fields.incarnation_id'), store_index) WHERE kind='harness.timeline'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_finished_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.request')) WHERE kind IN ( 'subscription.mission-started', 'subscription.mission-failed', 'subscription.mission-request-cancelled' )", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_delivery_key_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.delivery_key')) WHERE kind='subscription.mission-requested'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_started_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.mission_run')) WHERE kind='subscription.mission-started'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_mission_resource_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.mission'), json_extract(body, '$.fields.resource')) WHERE kind='subscription.mission-requested'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_authored_pull_request_url_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.facts.url')) WHERE kind='resource.observed' AND subject LIKE 'resource/mission-run/%/pull-request'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_authored_pull_request_number_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.facts.repository'), json_extract(body, '$.fields.facts.number')) WHERE kind='resource.observed' AND subject LIKE 'resource/mission-run/%/pull-request'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_deferred_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.request'), store_index) WHERE kind='subscription.mission-deferred'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_deferred_deadline_index", "table_pattern": "claims", "key_expression_and_predicate": "(CAST(json_extract(body, '$.fields.not_before_unix_ms') AS INTEGER)) WHERE kind='subscription.mission-deferred'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_schedule_started_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.request')) WHERE kind='schedule.work-started'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_to_order_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.to'), store_index) WHERE kind='message.sent'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_current_view_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, store_index) WHERE kind='intent.desired' OR json_extract(body, '$.fields.status') NOT IN ('stopped', 'absent', 'exited') OR json_extract(body, '$.status') NOT IN ('stopped', 'absent', 'exited')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.reviewer'), store_index) WHERE kind='gate.requested' AND json_extract(body, '$.fields.reviewer') IS NOT NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_reassignment_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.request'), subject) WHERE kind='gate.reviewer-reassigned'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_reassignment_reviewer_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.reviewer'), json_extract(body, '$.fields.request')) WHERE kind='gate.reviewer-reassigned'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_answer_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.request'), subject) WHERE kind='gate.result'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_episode_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.owner'), json_extract(body, '$.fields.reviewer'), json_extract(body, '$.fields.attempt'), json_extract(body, '$.fields.mission_revision'), json_extract(body, '$.fields.step_definition')) WHERE kind='gate.requested' AND json_extract(body, '$.fields.reviewer') IS NOT NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_runtime_subject_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, store_index) WHERE kind='runtime.observed'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_client_pairing_actor_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.session_actor')) WHERE kind='custom.client.pairing-completed'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_assistant_v1_credential_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.credential_hash'), store_index) WHERE kind='custom.client.assistant.v1.granted'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_assistant_v1_principal_index", "table_pattern": "claims", "key_expression_and_predicate": "(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'))", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_incarnation_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END), length(accepted_at_unix_ms), accepted_at_unix_ms ) WHERE json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) IS NOT NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_incarnation_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END), length(accepted_at_unix_ms), accepted_at_unix_ms ) WHERE kind='harness.observed' AND json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) IS NOT NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_episode_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.ownership_sequence'), json_extract(body, '$.fields.transition_sequence'), length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.observed'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_unnamed_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.observed' AND (json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) IS NULL OR typeof(json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END))!='text')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_claude_attachment_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END), store_index ) WHERE kind='harness.diagnostic' AND json_extract(body, '$.fields.code') IN ('claude-channel-unattached','claude-channel-attached')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_state_incarnation_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, CASE WHEN json_type(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END)='text' THEN json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) END, length(accepted_at_unix_ms), accepted_at_unix_ms ) WHERE kind='harness.observed' AND json_type(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.state' ELSE '$.fields.state' END)='text'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_auth_incarnation_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.observed' AND json_type(body, '$.fields.provider_auth') IN ('true','false')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_auth_diagnostic_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.diagnostic' AND json_extract(body, '$.fields.code') IN ('provider-auth-expired','provider-auth-restored')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_login_candidate_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject) WHERE (kind='harness.observed' AND ( json_type(body, '$.fields.provider_auth')='false' OR json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.reason' ELSE '$.fields.reason' END)='providerAuth' OR json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.state' ELSE '$.fields.state' END)='needs-login')) OR (kind='harness.diagnostic' AND json_extract(body, '$.fields.code')='provider-auth-expired')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_owner_step_index", "table_pattern": "desired", "key_expression_and_predicate": "(owner_step, subject)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_owner_run_index", "table_pattern": "desired", "key_expression_and_predicate": "(owner_run, subject)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_claim_index", "table_pattern": "desired", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_agent_subject_index", "table_pattern": "desired", "key_expression_and_predicate": "(subject) WHERE kind='agent'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_agent_host_index", "table_pattern": "desired", "key_expression_and_predicate": "(json_extract(member, '$.host'), subject) WHERE kind='agent'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_message_subject_index", "table_pattern": "desired", "key_expression_and_predicate": "(subject) WHERE kind='message'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_watch_agent_index", "table_pattern": "desired", "key_expression_and_predicate": "(substr(substr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), instr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), '/') + 1), instr(substr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), instr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), '/') + 1), '/') + 1)) WHERE subject >= 'subscription/watch/' AND subject < 'subscription/watch0'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_root_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.root_mission_run')) WHERE kind='mission-run.created'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_generation_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.current_generation')) WHERE kind='mission-run.created'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_generation_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='run-generation.created'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_proposal_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='revision-proposal.created'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.revision')) WHERE kind='mission-run.created'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_generation_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.revision')) WHERE kind='run-generation.created'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_proposal_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.candidate_revision')) WHERE kind='revision-proposal.created'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_generation_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.generation')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_owner_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.owner_run')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_origin_step_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.origin_step')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_recipient_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.person')) WHERE kind='work.person-asked'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "message_index_open", "table_pattern": "message_index", "key_expression_and_predicate": "(closed, created_index)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_native_delivery_identity_v2", "table_pattern": "local_native_delivery_receipts_v2", "key_expression_and_predicate": "(session_id, native_id, actor, origin, store_index)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_native_delivery_owner_cut_v2", "table_pattern": "local_native_delivery_receipts_v2", "key_expression_and_predicate": "(actor, store_index)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_revisions_claim_index", "table_pattern": "mission_revisions", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_definitions_claim_index", "table_pattern": "mission_definitions", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_mission_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, created_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_requester_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(requester)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_collection_latest_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, created_at_unix_ms DESC, id DESC)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_collection_live_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, status) WHERE status IN ('running','standing')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_root_page_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(root_run_id, created_at_unix_ms, id)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_open_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(created_at_unix_ms, id) WHERE status NOT IN ('completed','failed','cancelled')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "run_generations_run_index", "table_pattern": "run_generations", "key_expression_and_predicate": "(run_id, created_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_run_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(run_id, generation_id, step_path)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_generation_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(generation_id)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_definition_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(definition_hash, run_id, generation_id)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_parent_step_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(parent_step_run) WHERE parent_step_run IS NOT NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_assignee_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(assignee, status)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_lease_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(lease_owner) WHERE lease_owner IS NOT NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_single_agent_offer_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(available_to, run_id) WHERE CASE WHEN json_valid(available_to) THEN json_array_length(available_to)=1 ELSE 0 END", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_available_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(run_id) WHERE available_to!='[]'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_open_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(created_at_unix_ms, step_path) WHERE status NOT IN ('completed','failed','cancelled')", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_subject_kind_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, kind, id)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_subject_id_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, id)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_after_store_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(after_store_index)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_time_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(observed_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_dedupe_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(dedupe_key) WHERE dedupe_key IS NOT NULL", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_timeline_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), id) WHERE kind='harness.timeline'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_roster_frontier_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(id, after_store_index) WHERE kind='harness.timeline' AND subject LIKE 'agent/%'", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "client_diagnostic_receipts_time_index", "table_pattern": "client_diagnostic_receipts", "key_expression_and_predicate": "(accepted_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "client_diagnostic_receipts_device_time_index", "table_pattern": "client_diagnostic_receipts", "key_expression_and_predicate": "(device, accepted_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_subscription_mission_deferrals_deadline_index", "table_pattern": "local_subscription_mission_deferrals", "key_expression_and_predicate": "(not_before_unix_ms)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_usage_responses_age_index", "table_pattern": "local_usage_responses", "key_expression_and_predicate": "(observed_at_unix_ms)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "revision_proposals_run_index", "table_pattern": "revision_proposals", "key_expression_and_predicate": "(run_id)", "value_size_proven": false}, - {"site": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "index_pattern": "revision_proposals_generation_index", "table_pattern": "revision_proposals", "key_expression_and_predicate": "(source_generation_id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "desired", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES claims(id)", "value_size_proven": false}, {"name": "body", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "member", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "owner_run", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "owner_generation", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "owner_step", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_run_requests", "columns": [{"name": "operation_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "request_hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "message_index", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "created_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "closed", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_native_delivery_receipts_v2", "columns": [{"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY REFERENCES claims(id) ON DELETE CASCADE", "value_size_proven": false}, {"name": "claim_hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "session_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "native_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "origin", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "store_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "capabilities", "columns": [{"name": "secret_hash", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "expires_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "used", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_revisions", "columns": [{"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "state", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "body", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES claims(id)", "value_size_proven": false}, {"name": "created_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_definitions", "columns": [{"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "state", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "claim_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES claims(id)", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_runs", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "initial_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "current_generation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "root_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "root_run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "parent_step_run", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "workspace", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "requester", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "inputs", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "mode", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "phase", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_run_deadlines", "columns": [{"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "timeout_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "deadline_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "mission_run_after", "columns": [{"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "after_run", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "run_generations", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "predecessor_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "reason", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "step_runs", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "generation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES run_generations(id)", "value_size_proven": false}, {"name": "step_path", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "definition_hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "attempt", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "assignee", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "available_to", "declared_type": "TEXT", "declaration": "TEXT NOT NULL DEFAULT '[]'", "value_size_proven": false}, {"name": "agentless", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 1", "value_size_proven": false}, {"name": "title", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "goals", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "worker_reported", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "lease_owner", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "lease_incarnation", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "lease_expires_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "blocked_reason", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "not_before_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "activated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "readiness_epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "constraints", "declared_type": "TEXT", "declaration": "TEXT NOT NULL DEFAULT '[]'", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_harness_question_generations", "columns": [{"name": "question", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "generation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_owners", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_bindings", "columns": [{"name": "token", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_argv_bindings", "columns": [{"name": "token", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "member", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_mailbox_leases", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "component", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "provider", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "session", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "sequence", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "pid", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "process_token", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "token", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "epoch", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "revoked", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_work_lease_renewals", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "attempt", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "lease_owner", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "lease_incarnation", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "lease_expires_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_observations", "columns": [{"name": "id", "declared_type": "INTEGER", "declaration": "INTEGER PRIMARY KEY AUTOINCREMENT", "value_size_proven": false}, {"name": "after_store_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "body", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "dedupe_key", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "request_digest", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "observed_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "client_diagnostic_receipts", "columns": [{"name": "device", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "event_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "accepted_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_subscription_mission_deferrals", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "request", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "not_before_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "attempts", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_usage_spend", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "incarnation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "model", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "account", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "owner_run", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "owner_step", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "host", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "input_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "output_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cache_write_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cache_write_1h_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cached_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "total_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "cost_microusd", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "reported_cost_microusd", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "unpriced_tokens", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL DEFAULT 0", "value_size_proven": false}, {"name": "observed_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_usage_provenance", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "slot", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "pricing", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_limit_stops", "columns": [{"name": "account", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "episode", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "seat", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "stopped_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_seat_accounts", "columns": [{"name": "seat", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "account", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "chosen_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_usage_responses", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "source_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "observed_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "local_latest_slots", "columns": [{"name": "subject", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "slot", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "published_at_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "published_fields", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "pending_local_id", "declared_type": "INTEGER", "declaration": "INTEGER", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "claims_stored", "columns": [{"name": "kind", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "writer", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "since_unix_ms", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "claims", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "bytes", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "revision_proposals", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "run_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES mission_runs(id)", "value_size_proven": false}, {"name": "source_generation_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES run_generations(id)", "value_size_proven": false}, {"name": "candidate_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "actor", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "reason", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "cutover", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "compatible_steps", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "reviewers", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "approvals", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "preview_hash", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "successor_generation_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "planning_sessions", "columns": [{"name": "id", "declared_type": "TEXT", "declaration": "TEXT PRIMARY KEY", "value_size_proven": false}, {"name": "mission_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "request_ref", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "workspace", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "requester", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "planner", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "planner_spec_json", "declared_type": "TEXT", "declaration": "TEXT NOT NULL DEFAULT '{\"provider\":\"codex\"}'", "value_size_proven": false}, {"name": "status", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "target_run_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "source_generation_id", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "published_revision", "declared_type": "TEXT", "declaration": "TEXT", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "updated_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "planning_candidates", "columns": [{"name": "session_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES planning_sessions(id)", "value_size_proven": false}, {"name": "variant", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "revision", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "markdown_ref", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "kdl_ref", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "mission_revision", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "submitted_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "table_pattern": "planning_previews", "columns": [{"name": "session_id", "declared_type": "TEXT", "declaration": "TEXT NOT NULL REFERENCES planning_sessions(id)", "value_size_proven": false}, {"name": "variant", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "candidate_revision", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "hash", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "store_index", "declared_type": "INTEGER", "declaration": "INTEGER NOT NULL", "value_size_proven": false}, {"name": "graph", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "diff", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "mission_response", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}, {"name": "created_at_unix_ms", "declared_type": "TEXT", "declaration": "TEXT NOT NULL", "value_size_proven": false}], "unresolved_template": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_owned_set_subject_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject) WHERE json_extract(body,'$.owned_set') IS NOT NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_terminal_history_index", "table_pattern": "claims", "key_expression_and_predicate": "(store_index) WHERE kind IN ('mission-run.state','step-run.state','work.failed') AND json_extract(body,'$.fields.status') IN ('failed','cancelled','completed')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_terminal_capability_hash_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.capability_hash'), store_index) WHERE kind='custom.client.terminal-attached'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_receipt_actor_key_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.receipt.actor_key'), origin, subject) WHERE kind='harness-question.resolved' AND actor IS NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_to_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.to'), subject) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_report_to_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.report_to'), subject) WHERE kind IN ('mission-run.created','mission-run.report-to')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_from_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.from'), store_index) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_legacy_to_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.to'), store_index) WHERE kind='message.sent' AND json_type(body, '$.fields') IS NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_legacy_from_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.from'), store_index) WHERE kind='message.sent' AND json_type(body, '$.fields') IS NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_resume_host_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.host'), subject) WHERE kind='runtime.action.requested' AND json_extract(body,'$.fields.action')='resume'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_actor_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(actor, length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind IN ('work.progress', 'work.submitted')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_from_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.from'), length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_to_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.to'), length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_timeline_activity_time_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), length(accepted_at_unix_ms), accepted_at_unix_ms, store_index) WHERE kind='harness.timeline' AND json_extract(body, '$.fields.entry_type') IN ('message','content','tool_call','tool_result')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_actor_work_activity_index", "table_pattern": "claims", "key_expression_and_predicate": "(actor, json_extract(body, '$.fields.claim_incarnation'), store_index) WHERE kind IN ('work.claimed', 'work.progress')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_appeared_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.subagent_id')) WHERE kind='subagent.appeared'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_renewed_max_lease_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.subagent_id'), CAST(json_extract(body, '$.fields.lease_expires_at_unix_ms') AS INTEGER)) WHERE kind='subagent.renewed'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_ended_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.subagent_id')) WHERE kind='subagent.ended'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_appeared_lease_index", "table_pattern": "claims", "key_expression_and_predicate": "(CAST(json_extract(body, '$.fields.lease_expires_at_unix_ms') AS INTEGER)) WHERE kind='subagent.appeared'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subagent_renewed_lease_index", "table_pattern": "claims", "key_expression_and_predicate": "(CAST(json_extract(body, '$.fields.lease_expires_at_unix_ms') AS INTEGER)) WHERE kind='subagent.renewed'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_timeline_incarnation_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, kind, json_extract(body, '$.fields.incarnation_id'), store_index) WHERE kind='harness.timeline'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_finished_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.request')) WHERE kind IN ( 'subscription.mission-started', 'subscription.mission-failed', 'subscription.mission-request-cancelled' )", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_delivery_key_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.delivery_key')) WHERE kind='subscription.mission-requested'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_started_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.mission_run')) WHERE kind='subscription.mission-started'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_mission_resource_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.mission'), json_extract(body, '$.fields.resource')) WHERE kind='subscription.mission-requested'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_authored_pull_request_url_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.facts.url')) WHERE kind='resource.observed' AND subject LIKE 'resource/mission-run/%/pull-request'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_authored_pull_request_number_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.facts.repository'), json_extract(body, '$.fields.facts.number')) WHERE kind='resource.observed' AND subject LIKE 'resource/mission-run/%/pull-request'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_deferred_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.request'), store_index) WHERE kind='subscription.mission-deferred'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_subscription_deferred_deadline_index", "table_pattern": "claims", "key_expression_and_predicate": "(CAST(json_extract(body, '$.fields.not_before_unix_ms') AS INTEGER)) WHERE kind='subscription.mission-deferred'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_schedule_started_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.request')) WHERE kind='schedule.work-started'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_message_to_order_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.to'), store_index) WHERE kind='message.sent'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_current_view_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, store_index) WHERE kind='intent.desired' OR json_extract(body, '$.fields.status') NOT IN ('stopped', 'absent', 'exited') OR json_extract(body, '$.status') NOT IN ('stopped', 'absent', 'exited')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.reviewer'), store_index) WHERE kind='gate.requested' AND json_extract(body, '$.fields.reviewer') IS NOT NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_reassignment_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.request'), subject) WHERE kind='gate.reviewer-reassigned'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_reassignment_reviewer_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.reviewer'), json_extract(body, '$.fields.request')) WHERE kind='gate.reviewer-reassigned'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_answer_request_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.request'), subject) WHERE kind='gate.result'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_human_gate_episode_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.owner'), json_extract(body, '$.fields.reviewer'), json_extract(body, '$.fields.attempt'), json_extract(body, '$.fields.mission_revision'), json_extract(body, '$.fields.step_definition')) WHERE kind='gate.requested' AND json_extract(body, '$.fields.reviewer') IS NOT NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_runtime_subject_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, store_index) WHERE kind='runtime.observed'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_client_pairing_actor_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.session_actor')) WHERE kind='custom.client.pairing-completed'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_assistant_v1_credential_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.credential_hash'), store_index) WHERE kind='custom.client.assistant.v1.granted'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_assistant_v1_principal_index", "table_pattern": "claims", "key_expression_and_predicate": "(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'))", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_assistant_v1_principal_expiry_index", "table_pattern": "claims", "key_expression_and_predicate": "(kind, COALESCE(json_extract(body,'$.fields.principal'),'assistant/chatgpt'), json_extract(body,'$.fields.expires_at_unix_ms'))", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_incarnation_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END), length(accepted_at_unix_ms), accepted_at_unix_ms ) WHERE json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) IS NOT NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_incarnation_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END), length(accepted_at_unix_ms), accepted_at_unix_ms ) WHERE kind='harness.observed' AND json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) IS NOT NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_episode_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.ownership_sequence'), json_extract(body, '$.fields.transition_sequence'), length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.observed'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_unnamed_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.observed' AND (json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) IS NULL OR typeof(json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END))!='text')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_claude_attachment_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END), store_index ) WHERE kind='harness.diagnostic' AND json_extract(body, '$.fields.code') IN ('claude-channel-unattached','claude-channel-attached')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_state_incarnation_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "( subject, CASE WHEN json_type(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END)='text' THEN json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.incarnation_id' ELSE '$.fields.incarnation_id' END) END, length(accepted_at_unix_ms), accepted_at_unix_ms ) WHERE kind='harness.observed' AND json_type(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.state' ELSE '$.fields.state' END)='text'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_auth_incarnation_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.observed' AND json_type(body, '$.fields.provider_auth') IN ('true','false')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_auth_diagnostic_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='harness.diagnostic' AND json_extract(body, '$.fields.code') IN ('provider-auth-expired','provider-auth-restored')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_harness_login_candidate_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject) WHERE (kind='harness.observed' AND ( json_type(body, '$.fields.provider_auth')='false' OR json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.reason' ELSE '$.fields.reason' END)='providerAuth' OR json_extract(body, CASE WHEN json_type(body, '$.fields') IS NULL THEN '$.state' ELSE '$.fields.state' END)='needs-login')) OR (kind='harness.diagnostic' AND json_extract(body, '$.fields.code')='provider-auth-expired')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_owner_step_index", "table_pattern": "desired", "key_expression_and_predicate": "(owner_step, subject)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_owner_run_index", "table_pattern": "desired", "key_expression_and_predicate": "(owner_run, subject)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_claim_index", "table_pattern": "desired", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_agent_subject_index", "table_pattern": "desired", "key_expression_and_predicate": "(subject) WHERE kind='agent'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_agent_host_index", "table_pattern": "desired", "key_expression_and_predicate": "(json_extract(member, '$.host'), subject) WHERE kind='agent'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_message_subject_index", "table_pattern": "desired", "key_expression_and_predicate": "(subject) WHERE kind='message'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "desired_watch_agent_index", "table_pattern": "desired", "key_expression_and_predicate": "(substr(substr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), instr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), '/') + 1), instr(substr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), instr(substr(substr(subject, 20), instr(substr(subject, 20), '/') + 1), '/') + 1), '/') + 1)) WHERE subject >= 'subscription/watch/' AND subject < 'subscription/watch0'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_root_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.root_mission_run')) WHERE kind='mission-run.created'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_generation_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.current_generation')) WHERE kind='mission-run.created'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_generation_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='run-generation.created'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_proposal_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='revision-proposal.created'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_run_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.revision')) WHERE kind='mission-run.created'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_generation_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.revision')) WHERE kind='run-generation.created'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_proposal_revision_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.candidate_revision')) WHERE kind='revision-proposal.created'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_generation_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.generation')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_run_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.run')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_owner_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.owner_run')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_origin_step_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.origin_step')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_person_ask_recipient_index", "table_pattern": "claims", "key_expression_and_predicate": "(json_extract(body, '$.fields.person')) WHERE kind='work.person-asked'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "message_index_open", "table_pattern": "message_index", "key_expression_and_predicate": "(closed, created_index)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_native_delivery_identity_v2", "table_pattern": "local_native_delivery_receipts_v2", "key_expression_and_predicate": "(session_id, native_id, actor, origin, store_index)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_native_delivery_owner_cut_v2", "table_pattern": "local_native_delivery_receipts_v2", "key_expression_and_predicate": "(actor, store_index)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_revisions_claim_index", "table_pattern": "mission_revisions", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_definitions_claim_index", "table_pattern": "mission_definitions", "key_expression_and_predicate": "(claim_id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_mission_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, created_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_requester_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(requester)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_collection_latest_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, created_at_unix_ms DESC, id DESC)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_collection_live_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(mission_id, status) WHERE status IN ('running','standing')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_root_page_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(root_run_id, created_at_unix_ms, id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_open_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(created_at_unix_ms, id) WHERE status NOT IN ('completed','failed','cancelled')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "run_generations_run_index", "table_pattern": "run_generations", "key_expression_and_predicate": "(run_id, created_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_run_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(run_id, generation_id, step_path)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_generation_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(generation_id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_definition_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(definition_hash, run_id, generation_id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "mission_runs_parent_step_index", "table_pattern": "mission_runs", "key_expression_and_predicate": "(parent_step_run) WHERE parent_step_run IS NOT NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_assignee_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(assignee, status)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_lease_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(lease_owner) WHERE lease_owner IS NOT NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_single_agent_offer_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(available_to, run_id) WHERE CASE WHEN json_valid(available_to) THEN json_array_length(available_to)=1 ELSE 0 END", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_available_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(run_id) WHERE available_to!='[]'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "step_runs_open_index", "table_pattern": "step_runs", "key_expression_and_predicate": "(created_at_unix_ms, step_path) WHERE status NOT IN ('completed','failed','cancelled')", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_subject_kind_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, kind, id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_subject_id_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_after_store_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(after_store_index)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_time_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(observed_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_dedupe_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(dedupe_key) WHERE dedupe_key IS NOT NULL", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_timeline_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(subject, json_extract(body, '$.fields.incarnation_id'), id) WHERE kind='harness.timeline'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_observations_roster_frontier_index", "table_pattern": "local_observations", "key_expression_and_predicate": "(id, after_store_index) WHERE kind='harness.timeline' AND subject LIKE 'agent/%'", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "client_diagnostic_receipts_time_index", "table_pattern": "client_diagnostic_receipts", "key_expression_and_predicate": "(accepted_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "client_diagnostic_receipts_device_time_index", "table_pattern": "client_diagnostic_receipts", "key_expression_and_predicate": "(device, accepted_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_subscription_mission_deferrals_deadline_index", "table_pattern": "local_subscription_mission_deferrals", "key_expression_and_predicate": "(not_before_unix_ms)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "local_usage_responses_age_index", "table_pattern": "local_usage_responses", "key_expression_and_predicate": "(observed_at_unix_ms)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "revision_proposals_run_index", "table_pattern": "revision_proposals", "key_expression_and_predicate": "(run_id)", "value_size_proven": false}, + {"site": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "index_pattern": "revision_proposals_generation_index", "table_pattern": "revision_proposals", "key_expression_and_predicate": "(source_generation_id)", "value_size_proven": false}, {"site": "lv-h7792d6e9101c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_runtime_id_subject_index", "table_pattern": "claims", "key_expression_and_predicate": "({RUNTIME_ID_FIELD}, subject, store_index) WHERE {ACTUAL_STATE_CLAIM} AND typeof({RUNTIME_ID_FIELD})='text'", "value_size_proven": false}, {"site": "lv-h7792d6e9101c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_actual_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE {ACTUAL_STATE_CLAIM}", "value_size_proven": false}, {"site": "lv-h7792d6e9101c", "path": "crates/fractal-store/src/store.rs", "index_pattern": "claims_runtime_origin_accepted_index", "table_pattern": "claims", "key_expression_and_predicate": "(subject, origin, length(accepted_at_unix_ms), accepted_at_unix_ms) WHERE kind='runtime.observed'", "value_size_proven": false}, @@ -2127,7 +2128,7 @@ {"id": "lv-hb73bd4f2f38c", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "700d14798fd37c5da5b5389e3903a51a34c8c957866a0dd94482dfcc246b196b", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 8862, "excerpt": "& canonical_sql ( \"SELECT json_extract(body, '$.fields.session_id') FROM claims WHERE subject=?1 AND kind='harness.session-file' AND json_extract(body, '$.fields.incarnation_id')=?2 AND json_extract(b"}, {"id": "lv-hb7b64cc10c51", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "7a41ee06927a48e907a8b303d67368f1f76113a73b7efcaf20c658e641deaac8", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 1838, "excerpt": "params ! [ subject , at_index . unwrap_or ( i64 : : MAX as u64 ) ] , | row | row . get : : < _ , String > ( 0 ) ,"}, {"id": "lv-hb922e5825674", "path": "crates/fractal-store/src/store.rs", "kind": "sql-template", "fingerprint": "a521c5dad40bb69aa774c45feb4115e928e9636649863fd2f9284a6b6dd95c5c", "owner": "fractal_store::store", "todo": "bound-or-reference-values-and-reclamation", "disposition": "allow-for-now", "line_hint": 15155, "excerpt": "DELETE FROM mission_runs WHERE id=?1"}, - {"id": "lv-hb9696ca837f7", "path": "crates/fractal-store/src/store.rs", "kind": "sql-template", "fingerprint": "0be5ad06badeb1870cc630ed6799adfebd3bffbdf2b2e4a85fb44b0a04b15ad6", "owner": "fractal_store::store", "todo": "chunk-or-reference-variable-columns", "disposition": "allow-for-now", "line_hint": 783, "excerpt": " -- An unmanaged member's staging check needs tagged claims, not its runtime history. CREATE INDEX IF NOT EXISTS claims_owned_set_subject_index ON claims(subject) WHERE json_extract(body,'$.owned_set'"}, + {"id": "lv-h7e7937d8fad1", "path": "crates/fractal-store/src/store.rs", "kind": "sql-template", "fingerprint": "05c4b601885836e66c3fea007a185bdc60754cd8f0317128d594d4f14d6aefaa", "owner": "fractal_store::store", "todo": "chunk-or-reference-variable-columns", "disposition": "allow-for-now", "line_hint": 783, "excerpt": " -- An unmanaged member's staging check needs tagged claims, not its runtime history. CREATE INDEX IF NOT EXISTS claims_owned_set_subject_index ON claims(subject) WHERE json_extract(body,'$.owned_set'"}, {"id": "lv-hba4b0d735af8", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "68c5253450e4ab064ffddaaa91ab3fd123bd25dce5fca8c4f4b63ed02e14e26d", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 11818, "excerpt": "params ! [ subject , at_index ] , | row | { row . get : : < _ , String > ( 0 ) }"}, {"id": "lv-hba707764f720", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "746038271c3a30a5efca3979d788db5d87a588acb47362b3cb27a9a3d4c1d0ce", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 18333, "excerpt": "& canonical_sql ( \"SELECT kind, body, accepted_at_unix_ms FROM claims WHERE subject=?1 AND kind IN ('work.progress','work.submitted','step-run.carried') ORDER BY CANONICAL_DESC(claims)\" , )"}, {"id": "lv-hba80f02be5e7", "path": "crates/fractal-store/src/store.rs", "kind": "unresolved-sql-sink", "fingerprint": "f0cf159db9d7e30d00dd58f281267eb75687e6eaea2c416eddf5df095accc440", "owner": "fractal_store::store", "todo": "trace-statement-and-value-representation", "disposition": "allow-for-now", "line_hint": 8212, "excerpt": "& canonical_sql ( \"SELECT body FROM claims WHERE subject=?1 AND kind='resource.observed' ORDER BY CANONICAL_DESC(claims)\" ) ,"}, diff --git a/docs/st3/large-values.md b/docs/st3/large-values.md index e9dc44959dc..12e42083776 100644 --- a/docs/st3/large-values.md +++ b/docs/st3/large-values.md @@ -478,11 +478,11 @@ Inline storage here proves neither encoded size nor execution-cost bounds. ## Assistant principal admission index review -`fractal_store::store` owns schema site `lv-hb9696ca837f7`, replacing -`lv-h22c8c670811c`. The added principal admission index retains claim-kind TEXT +`fractal_store::store` owns schema site `lv-h7e7937d8fad1`, replacing +`lv-hb9696ca837f7`. The principal admission indexes retain claim-kind TEXT and the effective principal JSON field inline; absent principals use the fixed -`assistant/chatgpt` key. The composite seek changes neither claim bodies nor -admission semantics. These keys remain variable-size, and SQLite maintains them +`assistant/chatgpt` key. The added expiry suffix supports live-grant range seeks. +These indexes change neither claim bodies nor admission semantics. Keys remain variable-size, and SQLite maintains them on insertion and deletion; indexed lookup is not a byte-size or startup-cost proof. The producer maintainer retains `chunk-or-reference-variable-columns` responsibility while preserving effective-principal matching and claim authority. diff --git a/docs/st3/principals-and-grants.md b/docs/st3/principals-and-grants.md index aca88e2504f..b72752ddc8a 100644 --- a/docs/st3/principals-and-grants.md +++ b/docs/st3/principals-and-grants.md @@ -144,9 +144,10 @@ ignored; the last valid policy (or original grant) stays in force. This applies local grants too: an unauthorized newer overlay no longer replaces their policy. The principal expression index prunes expired base grants without issuer policy candidates, and matching local revocations, before the authenticated Rust fold. -The SQL materializes matching-principal issuer-policy subjects once, gates -revocation checks behind expiry eligibility, and pins the existing subject/kind -revocation index. This avoids a correlated policy lookup per expired grant and a +The SQL unions indexed live-expiry ranges, legacy records, and matching-principal +issuer-policy subjects. The additive principal/expiry index avoids parsing expired +grant bodies on authentication; the original principal index remains in use for +policy candidates. Revocations use the existing subject/kind index, avoiding a quadratic principal-wide revocation plan as completion/revocation history grows. Foreign revocations and policy candidates reach Rust because SQL cannot verify signatures. The sealed membership fold has a separate generation-keyed cache: diff --git a/release-notes/external-grant-profile-conflict.json b/release-notes/external-grant-profile-conflict.json index ecfa30f5fc5..87a18b477d3 100644 --- a/release-notes/external-grant-profile-conflict.json +++ b/release-notes/external-grant-profile-conflict.json @@ -7,7 +7,7 @@ }, "schema": { "status": "changed", - "detail": "Adds the typed client error grant-profile-conflict (GrantProfileConflict in Rust), returned as HTTP 409, plus inspect-only ?witness=1 opt-in conflict and cleared_conflicts witnesses with typed assistant/service profiles and revoked/expired causes. Default grant responses retain their previous shape for old strict clients. No grant claim shape or storage migration changes." + "detail": "Adds the typed client error grant-profile-conflict (GrantProfileConflict in Rust), returned as HTTP 409, plus inspect-only ?witness=1 opt-in conflict and cleared_conflicts witnesses with typed assistant/service profiles and revoked/expired causes. Default grant responses retain their previous shape for old strict clients. Adds a principal/expiry expression index at store open without rewriting grant claims." }, "rules": { "status": "changed", @@ -19,7 +19,7 @@ }, "downtime": { "status": "changed", - "detail": "No migration downtime is required. Affected people cannot authenticate with any external grant while a profile conflict remains visible; a partition can extend this interruption until revocations replicate. Unaffected people retain existing authentication behavior." + "detail": "No migration downtime is required, but the first store open builds the additive principal/expiry index over existing claims; its duration depends on retained history. Affected people cannot authenticate with any external grant while a profile conflict remains visible; a partition can extend this interruption until revocations replicate. Unaffected people retain existing authentication behavior." }, "manual": { "status": "changed", From b2599521ce6da1c9372f038a8b9725e3b2ec2803 Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 14:00:07 +0100 Subject: [PATCH 10/10] Accept covering expiry index for principal-only migration probe agent-identity: agent/dotfiles/st-delegation-2 agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- crates/fractal-store/src/store/runtime.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/fractal-store/src/store/runtime.rs b/crates/fractal-store/src/store/runtime.rs index 1a20a44be0c..f6cc02c6135 100644 --- a/crates/fractal-store/src/store/runtime.rs +++ b/crates/fractal-store/src/store/runtime.rs @@ -943,7 +943,8 @@ mod schema_install_tests { let current = plan(&connection, sql, active); eprintln!("assistant admission version={version} active={active} before={previous:?} after={current:?}"); assert!( - current.iter().any(|detail| detail.contains("SEARCH") && detail.contains(INDEX) + current.iter().any(|detail| detail.contains("SEARCH") + && (detail.contains(INDEX) || (!active && detail.contains(EXPIRY_INDEX))) && detail.contains("kind=?") && detail.contains("=?")), "version {version}: before={previous:?}; after={current:?}", );