diff --git a/core/continuum-core/tests/generated_barrel_sync.rs b/core/continuum-core/tests/generated_barrel_sync.rs index 4fa043495e..7bc1b7144d 100644 --- a/core/continuum-core/tests/generated_barrel_sync.rs +++ b/core/continuum-core/tests/generated_barrel_sync.rs @@ -8,8 +8,8 @@ //! that materializes a TypeScript binding when `cargo test` runs the //! type's `export_bindings_*` test (which ts-rs auto-generates). //! -//! The per-module `index.ts` barrel — generated by -//! `generator/generate-rust-bindings.ts` — is what consuming TypeScript +//! The per-module `index.ts` barrel (edited by hand since its generator, +//! `generator/generate-rust-bindings.ts`, was removed) is what consuming TypeScript //! imports from. If a new `.ts` file lands without the barrel being //! regenerated, the type is invisible to TS consumers even though the //! file exists on disk. That's exactly what regressed on PR #1129 @@ -35,9 +35,9 @@ //! //! # Failure recovery //! -//! When this fails: run `npx tsx generator/generate-rust-bindings.ts` -//! from `src/`, commit the regenerated barrel(s), retry. The failure -//! message names every offending module + the specific files that drift. +//! When this fails: add or remove the module's `export type { X } from './X';` line +//! (and the master `protocol/typescript/index.ts` line naming it), commit, retry. The +//! failure message names every offending module + the specific files that drift. use std::collections::BTreeSet; use std::fs; @@ -190,8 +190,8 @@ fn render_drift(reports: &[ModuleDrift]) -> String { out.push_str( "protocol/typescript barrel drift detected. The auto-generated \ per-module index.ts files are out of sync with the .ts files \ - on disk. Run `npx tsx generator/generate-rust-bindings.ts` \ - from `src/`, commit the regenerated barrels, and retry.\n\n", + on disk. Add or remove each file's `export type { X } from './X';` \ + line (and its master index.ts line), commit, and retry.\n\n", ); for r in reports.iter().filter(|r| !r.is_clean()) { out.push_str(&format!("module `{}`:\n", r.module)); diff --git a/core/source-hygiene/src/lib.rs b/core/source-hygiene/src/lib.rs index 3edfbdc153..ecf3ac23d4 100644 --- a/core/source-hygiene/src/lib.rs +++ b/core/source-hygiene/src/lib.rs @@ -46,6 +46,7 @@ pub mod tenant_neutrality; pub mod time_bounds; pub mod test_mod_singularity; pub mod tls_stack; +pub mod ts_bindings; pub mod subprocess_spawn; pub mod unwrap_justification; pub mod vendor_pin; diff --git a/core/source-hygiene/src/ts_bindings.rs b/core/source-hygiene/src/ts_bindings.rs new file mode 100644 index 0000000000..aa0b3c6694 --- /dev/null +++ b/core/source-hygiene/src/ts_bindings.rs @@ -0,0 +1,185 @@ +//! Every committed TypeScript binding is one a Rust type still exports. +//! +//! ts-rs writes `protocol/typescript//.ts` when a crate's tests run, and the CI drift +//! step (`git diff --exit-code protocol/typescript/`) catches a regenerated binding that changed. +//! A binding whose type was DELETED is never regenerated, so it stays committed behind a green +//! check, with its barrel line, and every TypeScript client still sees the dead type. On 2026-11-03, +//! 38 such files were committed (the threat classifier's, the cargo tool's, the base-model ladder's), +//! and #5726 was about to add six more. This rule counts them; the count may only fall. + +use std::collections::BTreeSet; + +/// The `protocol/typescript/`-relative files a Rust source's `export_to` attributes name. +/// A path ending in `/` is ts-rs's directory form: the file is the next item's name plus `.ts`. +pub fn exported_bindings(source: &str) -> BTreeSet { + let mut out = BTreeSet::new(); + let mut rest = source; + while let Some(at) = rest.find("export_to") { + rest = &rest[at + "export_to".len()..]; + let Some(literal) = rest.trim_start().strip_prefix('=').map(str::trim_start) else { continue }; + let Some(literal) = literal.strip_prefix('"') else { continue }; + let Some(end) = literal.find('"') else { continue }; + let path = &literal[..end]; + let Some((_, rel)) = path.split_once("protocol/typescript/") else { continue }; + match rel.ends_with('/') || rel.is_empty() { + false => { + out.insert(rel.to_string()); + } + true => { + if let Some(name) = next_item_name(&literal[end + 1..]) { + out.insert(format!("{rel}{name}.ts")); + } + } + } + } + out +} + +/// The name of the first `struct`, `enum` or `type` item after an attribute. `after` starts inside +/// the `export_to` attribute, so the rest of it is skipped by bracket depth, and so is every later +/// attribute however many lines it spans, and every `//` comment. A doc line saying "the struct for +/// X" or a continuation line saying `tag = "type"` never names a binding (Fable on #5730). +fn next_item_name(after: &str) -> Option { + let (mut depth, mut in_string) = (1_usize, false); // inside the `#[ts(...)]` holding export_to + let (mut word, mut after_keyword) = (String::new(), false); + let mut chars = after.chars().peekable(); + while let Some(c) = chars.next() { + let ident = c.is_alphanumeric() || c == '_'; + if depth == 0 && ident { + word.push(c); + continue; + } + // A word ended: the item's name is the word after its keyword. + if !word.is_empty() { + if after_keyword { + return Some(word); + } + after_keyword = matches!(word.as_str(), "struct" | "enum" | "type"); + word.clear(); + } + if depth > 0 { + match c { + '"' => in_string = !in_string, + '[' if !in_string => depth += 1, + ']' if !in_string => depth -= 1, + _ => {} + } + } else if c == '#' && chars.peek() == Some(&'[') { + chars.next(); + depth = 1; + } else if c == '/' && chars.peek() == Some(&'/') { + for skipped in chars.by_ref() { + if skipped == '\n' { + break; + } + } + } + } + None +} + +/// Committed bindings no Rust type exports. Barrels (`index.ts`) are kept in step with their +/// directory by `continuum-core`'s `generated_barrel_sync`, so they are not bindings here. +pub fn orphans(committed: &BTreeSet, exported: &BTreeSet) -> Vec { + committed.iter().filter(|f| !f.ends_with("index.ts") && !exported.contains(*f)).cloned().collect() +} + +#[cfg(test)] +mod tests { + use super::*; + use std::path::Path; + + /// Every `.rs` file under `dir`, skipping build output and vendored trees. + fn rust_files(dir: &Path, out: &mut Vec) { + let Ok(entries) = std::fs::read_dir(dir) else { return }; + for entry in entries.flatten() { + let path = entry.path(); + let name = entry.file_name(); + if path.is_dir() { + if !matches!(name.to_str(), Some("target" | "vendor" | "node_modules" | ".git")) { + rust_files(&path, out); + } + } else if path.extension().is_some_and(|e| e == "rs") { + out.push(path); + } + } + } + + /// Every `.ts` file under `protocol/typescript/`, relative to it. + fn committed_bindings(root: &Path) -> BTreeSet { + fn walk(base: &Path, dir: &Path, out: &mut BTreeSet) { + let Ok(entries) = std::fs::read_dir(dir) else { return }; + for entry in entries.flatten() { + let path = entry.path(); + if path.is_dir() { + walk(base, &path, out); + } else if path.extension().is_some_and(|e| e == "ts") { + if let Ok(rel) = path.strip_prefix(base) { + out.insert(rel.to_string_lossy().replace('\\', "/")); + } + } + } + } + let base = root.join("protocol/typescript"); + let mut out = BTreeSet::new(); + walk(&base, &base, &mut out); + out + } + + // what this catches: the parser missing a form ts-rs accepts, which would report a live + // binding as an orphan (and invite deleting it) or hide a real one. + #[test] + fn both_export_forms_are_read() { + let src = r#" + #[ts(export, export_to = "../../../protocol/typescript/rag/LlmMessage.ts")] + pub struct LlmMessage; + #[ts(export, export_to = "../../../protocol/typescript/genome/")] + /// The struct for one tier of a type's memory. + #[serde(rename_all = "camelCase")] + pub enum Tier { A } + #[ts(export, export_to = "bindings/Local.ts")] + pub struct Local; + #[ts(export, export_to = "../../../protocol/typescript/scene/", + rename = "Wire")] + #[serde( + tag = "type", + content = "value", + )] + // the enum's wire shape: a struct of one field per variant + pub(crate) enum Event { A(T) } + "#; + let got = exported_bindings(src); + let want: BTreeSet = ["rag/LlmMessage.ts", "genome/Tier.ts", "scene/Event.ts"].map(String::from).into(); + assert_eq!(got, want); + let committed: BTreeSet = ["rag/LlmMessage.ts", "rag/index.ts", "rag/RagContext.ts"].map(String::from).into(); + assert_eq!(orphans(&committed, &got), vec!["rag/RagContext.ts".to_string()]); + } + + // what this catches: a deleted ts-rs type leaving its binding committed (the drift step + // cannot see it). Each deletion lowers the count; a new orphan raises it and fails. + #[test] + fn no_committed_binding_outlives_its_type() { + let root = crate::repo_root().expect("the audited tree has a workspace root"); + let mut sources = Vec::new(); + for top in ["core", "client", "apps"] { + rust_files(&root.join(top), &mut sources); + } + assert!(!sources.is_empty(), "no Rust sources under {}: the scan read nothing", root.display()); + let exported: BTreeSet = sources + .iter() + .filter_map(|p| std::fs::read_to_string(p).ok()) + .flat_map(|s| exported_bindings(&s)) + .collect(); + let committed = committed_bindings(&root); + assert!(!committed.is_empty(), "no bindings under protocol/typescript: the scan read nothing"); + let found = orphans(&committed, &exported); + for f in found.iter().take(8) { + eprintln!(" orphan binding: protocol/typescript/{f}"); + } + crate::ratchet::hold("orphan_ts_bindings", found.len(), || { + "A committed protocol/typescript binding has no Rust type exporting it. When you delete \ + a ts-rs type, delete its .ts file and its barrel line in the same change." + .to_string() + }); + } +} diff --git a/protocol/typescript/ContentTypes.ts b/protocol/typescript/ContentTypes.ts deleted file mode 100644 index 31fda56968..0000000000 --- a/protocol/typescript/ContentTypes.ts +++ /dev/null @@ -1,400 +0,0 @@ -/** - * AUTO-GENERATED by generate-content-types.ts — DO NOT EDIT - * - * Source of truth: system/recipes/*.json - * Regenerate: npx tsx generator/generate-content-types.ts - * - * 28 content types from 28 recipe files - */ - -/** - * All valid content type IDs — derived from recipe uniqueId fields. - * Adding a new content type: create a recipe JSON, run the generator. - */ -export type ContentType = 'academy-training' | 'ai-debate-club' | 'browser' | 'canvas' | 'chat' | 'coding' | 'creative-writing' | 'diagnostics-log' | 'diagnostics' | 'dm' | 'factory' | 'gan' | 'general-chat' | 'grid-overview' | 'help' | 'inference-sample' | 'live' | 'logs' | 'multi-persona-chat' | 'newsroom' | 'outreach' | 'persona' | 'profile' | 'research' | 'settings' | 'terminal' | 'training-dashboard' | 'universe'; - -/** - * All content type IDs as a runtime array (for validation, iteration). - */ -export const CONTENT_TYPES: ContentType[] = [ - 'academy-training', - 'ai-debate-club', - 'browser', - 'canvas', - 'chat', - 'coding', - 'creative-writing', - 'diagnostics-log', - 'diagnostics', - 'dm', - 'factory', - 'gan', - 'general-chat', - 'grid-overview', - 'help', - 'inference-sample', - 'live', - 'logs', - 'multi-persona-chat', - 'newsroom', - 'outreach', - 'persona', - 'profile', - 'research', - 'settings', - 'terminal', - 'training-dashboard', - 'universe', -]; - -/** - * Content type configuration — generated from recipe metadata. - */ -export type EntityType = 'room' | 'user' | 'activity' | null; - -export interface ContentTypeConfig { - widget: string; - displayName: string; - icon: string; - /** URL prefix — verb/noun pattern: /chat, /live, /profile */ - view: string; - requiresEntity: boolean; - entityType: EntityType; - hasRightPanel: boolean; - /** Right panel widget tag — from recipe layout. null = no right panel. */ - rightPanelWidget: string | null; - /** Room uniqueId for right panel chat — from recipe layout config */ - rightPanelRoom: string | null; -} - -export const CONTENT_TYPE_CONFIGS: Record = { - 'academy-training': { - widget: 'chat-widget', - displayName: 'Academy Training', - icon: '📄', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'ai-debate-club': { - widget: 'chat', - displayName: 'AI Debate Club', - icon: '📄', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'browser': { - widget: 'web-view-widget', - displayName: 'Browser', - icon: '🌐', - view: 'browser', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'canvas': { - widget: 'drawing-canvas-widget', - displayName: 'Canvas', - icon: '🎯', - view: 'canvas', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: 'chat-widget', - rightPanelRoom: 'canvas', - }, - 'chat': { - widget: 'chat-widget', - displayName: 'Chat', - icon: '💬', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'coding': { - widget: 'chat-widget', - displayName: 'Code', - icon: '📄', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'creative-writing': { - widget: 'chat-widget', - displayName: 'Writing', - icon: '📄', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'diagnostics-log': { - widget: 'log-viewer-widget', - displayName: 'Log', - icon: '📋', - view: 'logs', - requiresEntity: true, - entityType: null, - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'diagnostics': { - widget: 'diagnostics-widget', - displayName: 'Diagnostics', - icon: '🔍', - view: 'diagnostics', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'dm': { - widget: 'chat-widget', - displayName: 'DM', - icon: '✉️', - view: 'dm', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'factory': { - widget: 'factory-widget', - displayName: 'Factory', - icon: '📄', - view: 'factory', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: 'factory-stats-widget', - rightPanelRoom: null, - }, - 'gan': { - widget: 'gan-widget', - displayName: 'GAN Training', - icon: '📄', - view: 'gan', - requiresEntity: false, - entityType: null, - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'general-chat': { - widget: 'chat-widget', - displayName: 'General Chat', - icon: '📄', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'grid-overview': { - widget: 'grid-overview-widget', - displayName: 'Grid', - icon: '🖥️', - view: 'grid', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'help': { - widget: 'help-widget', - displayName: 'Help', - icon: '❓', - view: 'help', - requiresEntity: false, - entityType: null, - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'inference-sample': { - widget: 'inference-sample-widget', - displayName: 'Inference', - icon: '🔬', - view: 'inference', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'live': { - widget: 'live-widget', - displayName: 'Live', - icon: '📹', - view: 'live', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'logs': { - widget: 'log-viewer-widget', - displayName: 'Logs', - icon: '📄', - view: 'logs', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: 'chat-widget', - rightPanelRoom: 'help', - }, - 'multi-persona-chat': { - widget: 'chat-widget', - displayName: 'Multi-Persona Chat', - icon: '📄', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'newsroom': { - widget: 'chat-widget', - displayName: 'Newsroom', - icon: '📄', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'outreach': { - widget: 'chat-widget', - displayName: 'Outreach', - icon: '📄', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'persona': { - widget: 'persona-brain-widget', - displayName: 'Persona', - icon: '🤖', - view: 'persona', - requiresEntity: true, - entityType: 'user', - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'profile': { - widget: 'user-profile-widget', - displayName: 'Profile', - icon: '👤', - view: 'profile', - requiresEntity: true, - entityType: 'user', - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'research': { - widget: 'chat-widget', - displayName: 'Research', - icon: '📄', - view: 'chat', - requiresEntity: true, - entityType: 'room', - hasRightPanel: false, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'settings': { - widget: 'settings-widget', - displayName: 'Settings', - icon: '⚙️', - view: 'settings', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: 'settings-assistant', - rightPanelRoom: null, - }, - 'terminal': { - widget: 'terminal-widget', - displayName: 'Terminal', - icon: '💻', - view: 'terminal', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'training-dashboard': { - widget: 'training-dashboard-widget', - displayName: 'Training', - icon: '🧪', - view: 'training', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: null, - rightPanelRoom: null, - }, - 'universe': { - widget: 'universe-widget', - displayName: 'Universe', - icon: '📄', - view: 'universe', - requiresEntity: false, - entityType: null, - hasRightPanel: true, - rightPanelWidget: 'chat-widget', - rightPanelRoom: 'universe', - }, -}; - -/** - * Type guard: is this string a valid content type? - */ -export function isContentType(value: string): value is ContentType { - return CONTENT_TYPES.includes(value as ContentType); -} - -/** - * Get config for a content type, or undefined if not registered. - */ -export function getContentTypeConfig(type: string): ContentTypeConfig | undefined { - return CONTENT_TYPE_CONFIGS[type as ContentType]; -} - -/** - * Get icon for a content type. - */ -export function getContentTypeIcon(type: string): string { - return CONTENT_TYPE_CONFIGS[type as ContentType]?.icon || '📄'; -} diff --git a/protocol/typescript/ai/ModelCapability.ts b/protocol/typescript/ai/ModelCapability.ts deleted file mode 100644 index 5634c2efdb..0000000000 --- a/protocol/typescript/ai/ModelCapability.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Model capabilities - */ -export type ModelCapability = "text-generation" | "text-completion" | "chat" | "audio-generation" | "audio-transcription" | "image-generation" | "image-analysis" | "video-generation" | "video-analysis" | "embeddings" | "multimodal" | "tool-use"; diff --git a/protocol/typescript/ai/index.ts b/protocol/typescript/ai/index.ts index 4e62b283d6..34728a1b6d 100644 --- a/protocol/typescript/ai/index.ts +++ b/protocol/typescript/ai/index.ts @@ -16,7 +16,6 @@ export type { HealthState } from './HealthState'; export type { HealthStatus } from './HealthStatus'; export type { ImageInput } from './ImageInput'; export type { MessageContent } from './MessageContent'; -export type { ModelCapability } from './ModelCapability'; export type { ModelInfo } from './ModelInfo'; export type { NativeToolSpec } from './NativeToolSpec'; export type { ResponseFormat } from './ResponseFormat'; diff --git a/protocol/typescript/ai_inference/InferenceStatus.ts b/protocol/typescript/ai_inference/InferenceStatus.ts deleted file mode 100644 index 5f46ea0143..0000000000 --- a/protocol/typescript/ai_inference/InferenceStatus.ts +++ /dev/null @@ -1,32 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The gateway's live model-residency snapshot — the `ai/inference/status` - * payload. `active_model` is THE field that matters for correctness: the - * gateway serves a single resident model and IGNORES the per-request `model`, - * so only the active model actually answers. `loaded`/`loading` describe the - * rest of the residency set; `gguf_variant`/`context_length` describe the - * active model's shape (the live context window — task #46's "context window - * comes from the engine, not a hardcoded per-tier cap"). - */ -export type InferenceStatus = { -/** - * The single model serving right now; `null`/absent when the engine is empty. - */ -activeModel?: string, -/** - * Models resident in memory (the gateway can switch among these). - */ -loaded: Array, -/** - * Models currently mid-load. - */ -loading: Array, -/** - * GGUF quantization variant of the active model, when it is a GGUF. - */ -ggufVariant?: string, -/** - * The active model's context window in tokens, when the gateway reports it. - */ -contextLength?: number, }; diff --git a/protocol/typescript/ai_inference/LocalModel.ts b/protocol/typescript/ai_inference/LocalModel.ts deleted file mode 100644 index 9770c265f4..0000000000 --- a/protocol/typescript/ai_inference/LocalModel.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * One model the gateway can LOAD — discovered on disk (HF cache + the models - * dir). `id` is the identifier `ai/inference/load` accepts; `display_name` and - * `source` are for humans + UIs choosing from the catalog. This is the - * loadable set, distinct from the SERVING set returned by `/v1/models`. - */ -export type LocalModel = { -/** - * The hub identifier / load id (what `load`/`unload` take as `model`). - */ -id: string, -/** - * Human-friendly name for catalogs + pickers. - */ -displayName: string, -/** - * Where the gateway found it — `hf_cache`, `models_dir`, `lmstudio`, … - */ -source: string, }; diff --git a/protocol/typescript/cargo/CargoBuildParams.ts b/protocol/typescript/cargo/CargoBuildParams.ts deleted file mode 100644 index b8cc367537..0000000000 --- a/protocol/typescript/cargo/CargoBuildParams.ts +++ /dev/null @@ -1,38 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Params for `cargo/build`. - * - * All fields optional. With no params, runs `cargo build` at the - * process cwd in debug mode. Typical persona usage: - * `{ package: "continuum-core", features: "metal,accelerate" }`. - */ -export type CargoBuildParams = { -/** - * Workspace package to build (cargo's `--package` flag). - * Omit to build the whole workspace. - */ -package?: string, -/** - * Cargo features, comma-separated (cargo's `--features` flag). - * e.g. `"metal,accelerate"`. - */ -features?: string, -/** - * Build in release mode (`--release`). Default: false. - */ -release: boolean, -/** - * Working directory to run cargo in. Default: process cwd. - * Must be a path the substrate is allowed to invoke cargo - * within — typically the continuum-core workspace root or a - * persona-managed worktree. - */ -workingDir?: string, -/** - * Max wall-clock for the entire cargo invocation in - * milliseconds. Default: 300_000 (5 minutes). The substrate - * caps this at 900_000 (15 minutes); higher values are - * silently clamped. - */ -timeoutMs?: number, }; diff --git a/protocol/typescript/cargo/CargoBuildResult.ts b/protocol/typescript/cargo/CargoBuildResult.ts deleted file mode 100644 index 4a77c76a70..0000000000 --- a/protocol/typescript/cargo/CargoBuildResult.ts +++ /dev/null @@ -1,22 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CargoMessage } from "./CargoMessage"; - -/** - * Result of `cargo/build`. Structured errors + warnings parsed from - * cargo's `--message-format=json` output stream. - * - * `errors.len() == 0 && success == true` is the happy path. If - * `success == false` but `errors.is_empty()`, something killed - * cargo (timeout, signal, IPC error) — see `error` for details. - */ -export type CargoBuildResult = { success: boolean, errors: Array, warnings: Array, -/** - * Cargo's exit code (None on timeout / signal / spawn failure). - */ -exitCode?: number, durationMs: number, -/** - * Substrate-level error (timeout, spawn failure, etc.). When - * set, the cargo run didn't complete normally — `errors` may - * be empty even though `success == false`. - */ -error?: string, }; diff --git a/protocol/typescript/cargo/CargoMessage.ts b/protocol/typescript/cargo/CargoMessage.ts deleted file mode 100644 index f18a5f9ffb..0000000000 --- a/protocol/typescript/cargo/CargoMessage.ts +++ /dev/null @@ -1,30 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CargoSpan } from "./CargoSpan"; - -/** - * One compiler diagnostic from cargo's JSON output stream. Mirrors - * rustc's diagnostic shape, flattened for the wire. - * - * Per cargo's stable `--message-format=json` contract — when - * cargo's output shape changes, this struct's parser updates with - * it but the wire shape here stays stable for TS consumers. - */ -export type CargoMessage = { -/** - * `"error"`, `"warning"`, `"note"`, `"help"`. - */ -level: string, message: string, -/** - * Rust error code (e.g. `"E0382"`), when present. - */ -code?: string, -/** - * Primary span: the location the diagnostic anchors to. Absent - * for diagnostics that don't have a single anchor (e.g. - * linker errors). - */ -primarySpan?: CargoSpan, -/** - * Help text or rendered suggestions from rustc, when present. - */ -rendered?: string, }; diff --git a/protocol/typescript/cargo/CargoSpan.ts b/protocol/typescript/cargo/CargoSpan.ts deleted file mode 100644 index 0466b1ad24..0000000000 --- a/protocol/typescript/cargo/CargoSpan.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * File location of a compiler diagnostic span. 1-indexed lines + - * columns, matching rustc's convention. - */ -export type CargoSpan = { -/** - * File path relative to the cargo invocation's working dir. - */ -fileName: string, lineStart: number, lineEnd: number, columnStart: number, columnEnd: number, }; diff --git a/protocol/typescript/cargo/CargoTestParams.ts b/protocol/typescript/cargo/CargoTestParams.ts deleted file mode 100644 index 1efadad58d..0000000000 --- a/protocol/typescript/cargo/CargoTestParams.ts +++ /dev/null @@ -1,42 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Params for `cargo/test`. - * - * All fields optional. With no params, runs `cargo test` at the - * process cwd in debug mode against the whole workspace. Typical - * persona usage when iterating: `{ package: "continuum-core", - * filter: "modules::chat::", features: "metal,accelerate" }`. - */ -export type CargoTestParams = { -/** - * Workspace package to test (cargo's `--package` flag). - */ -package?: string, -/** - * Test name filter passed to libtest after `--` (e.g. - * `"modules::chat::"` to run all chat module tests). - */ -filter?: string, -/** - * Cargo features (cargo's `--features` flag). - */ -features?: string, -/** - * `--lib` flag — restrict to library tests, skip integration - * tests. Default: false (run everything). - */ -libOnly: boolean, -/** - * Build + run in release mode. - */ -release: boolean, -/** - * Working directory. Default: process cwd. - */ -workingDir?: string, -/** - * Max wall-clock in milliseconds. Default: 600_000 (10 - * minutes). Capped at 1_800_000 (30 minutes). - */ -timeoutMs?: number, }; diff --git a/protocol/typescript/cargo/CargoTestResult.ts b/protocol/typescript/cargo/CargoTestResult.ts deleted file mode 100644 index 5fdd8afc9d..0000000000 --- a/protocol/typescript/cargo/CargoTestResult.ts +++ /dev/null @@ -1,24 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CargoMessage } from "./CargoMessage"; - -/** - * Result of `cargo/test`. Aggregate counts + structured failures - * parsed from cargo + libtest's human-readable output. - * - * `success` reflects libtest's overall verdict (compiles + zero - * failed tests). Build errors that prevent any tests from running - * surface in `build_errors` (mirrors `CargoBuildResult.errors`). - * Per-test failures surface in `failures`. - */ -export type CargoTestResult = { success: boolean, passed: number, failed: number, ignored: number, measured: number, -/** - * Names of failing tests, in the order libtest reported them. - * Empty when all tests passed. - */ -failures: Array, -/** - * Build-time errors that prevented tests from compiling. When - * non-empty, `passed/failed/ignored/measured` are all 0 and - * `success` is false. - */ -buildErrors: Array, exitCode?: number, durationMs: number, error?: string, }; diff --git a/protocol/typescript/cognition/AdversarialPatternDecline.ts b/protocol/typescript/cognition/AdversarialPatternDecline.ts deleted file mode 100644 index 9e77e2e26f..0000000000 --- a/protocol/typescript/cognition/AdversarialPatternDecline.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreatEvidence } from "./ThreatEvidence"; -import type { ThreatPatternKind } from "./ThreatPatternKind"; -import type { ThreatSeverity } from "./ThreatSeverity"; - -export type AdversarialPatternDecline = { frameId: string, detectorId: string, pattern: ThreatPatternKind, severity: ThreatSeverity, evidence: Array, }; diff --git a/protocol/typescript/cognition/AuditEntry.ts b/protocol/typescript/cognition/AuditEntry.ts deleted file mode 100644 index f39f4189ed..0000000000 --- a/protocol/typescript/cognition/AuditEntry.ts +++ /dev/null @@ -1,46 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AuditEntryKind } from "./AuditEntryKind"; - -/** - * One audit log entry. Append-only — entries are written once, never - * modified. The `chain_hash` is computed from the entry's content + the - * previous entry's chain_hash, forming the tamper-detection chain. - * - * The `payload` field is a free-form JSON value — each kind has its - * own payload shape that downstream tooling decodes. Keeping the wire - * format open-ended means new audit kinds can ship without a schema - * migration; tooling that doesn't recognize a kind just records the - * raw JSON. - */ -export type AuditEntry = { -/** - * Monotonic sequence number. Starts at 0 for the genesis entry. - * Verifier asserts seq == prev_seq + 1 — gap detection. - */ -seq: number, -/** - * Unix-ms timestamp the entry was recorded. Caller's clock — - * verifier asserts monotonic-non-decreasing across entries. - */ -timestampMs: number, -/** - * Which event kind this entry records. - */ -kind: AuditEntryKind, -/** - * Free-form JSON payload for this entry. Shape per-kind; the - * recorder doesn't validate the inner shape (downstream tooling - * does). On the TS wire it surfaces as `unknown` — consumers - * narrow by `kind`. - */ -payload: unknown, -/** - * Hex-encoded SHA-256 chain hash: - * `sha256(seq || timestamp_ms || kind || payload || prev_chain_hash)`. - * Genesis entry's prev_chain_hash is the all-zeros string of length 64. - */ -chainHash: string, -/** - * The hash of the previous entry. Genesis = "0" * 64. - */ -prevChainHash: string, }; diff --git a/protocol/typescript/cognition/AuditEntryKind.ts b/protocol/typescript/cognition/AuditEntryKind.ts deleted file mode 100644 index 512404db54..0000000000 --- a/protocol/typescript/cognition/AuditEntryKind.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The four kinds of events the audit-recorder pins to disk per - * MODULE-CATALOG's subscription list. New kinds extend this enum; - * adding a kind is a non-breaking change to the wire format because - * it's serialized as a tagged string (`kind: "refusal"`). - * - * Today's set: - * - * - `Refusal` — a turn / dispatch / inference call was refused with a - * typed reason. Composes with the residency gate's `ResidencyBlock` - * (#1338) — every Block emits a Refusal audit entry. - * - `GovernorOverride` — the substrate governor overrode a module's - * own lease request (e.g. lowered concurrency below what the module - * asked for, evicted a working-set entry the module wanted to keep). - * - `FederationPolicyDrift` — a peer node's federation policy diverged - * from our local policy. The drift gets logged; resolution is a - * policy concern. - * - `AccessDenied` — the MMU-style genome permission table denied a - * read / write / execute. Compartmentalization audit trail. - */ -export type AuditEntryKind = "refusal" | "governor-override" | "federation-policy-drift" | "access-denied"; diff --git a/protocol/typescript/cognition/HostProbeError.ts b/protocol/typescript/cognition/HostProbeError.ts deleted file mode 100644 index fa58f88ce0..0000000000 --- a/protocol/typescript/cognition/HostProbeError.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Why a [`detect_host_capability`] call failed. Loud-fail so the operator - * sees exactly what the probe couldn't classify and can fix the tier - * table. - */ -export type ProbeError = { "kind": "unknownGpuDevice", platform: string, device_name: string, } | { "kind": "unsupportedPlatform", platform: string, }; diff --git a/protocol/typescript/cognition/ThreatDetectionReport.ts b/protocol/typescript/cognition/ThreatDetectionReport.ts deleted file mode 100644 index 623b7fec0f..0000000000 --- a/protocol/typescript/cognition/ThreatDetectionReport.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreatSignal } from "./ThreatSignal"; - -export type ThreatDetectionReport = { frameId: string, signals: Array, }; diff --git a/protocol/typescript/cognition/ThreatEvidence.ts b/protocol/typescript/cognition/ThreatEvidence.ts deleted file mode 100644 index 40f264bcfc..0000000000 --- a/protocol/typescript/cognition/ThreatEvidence.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ThreatEvidence = { excerpt: string, byteStart: number, byteEnd: number, }; diff --git a/protocol/typescript/cognition/ThreatFrame.ts b/protocol/typescript/cognition/ThreatFrame.ts deleted file mode 100644 index f13b4f5b3a..0000000000 --- a/protocol/typescript/cognition/ThreatFrame.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreatFrameKind } from "./ThreatFrameKind"; - -export type ThreatFrame = { frameId: string, kind: ThreatFrameKind, source: string, text: string, }; diff --git a/protocol/typescript/cognition/ThreatFrameKind.ts b/protocol/typescript/cognition/ThreatFrameKind.ts deleted file mode 100644 index 3530e1bb70..0000000000 --- a/protocol/typescript/cognition/ThreatFrameKind.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ThreatFrameKind = "chat-message" | "tool-request" | "memory-write" | "federation-message" | "media-transcript" | "runtime-frame"; diff --git a/protocol/typescript/cognition/ThreatPatternKind.ts b/protocol/typescript/cognition/ThreatPatternKind.ts deleted file mode 100644 index 81813e5811..0000000000 --- a/protocol/typescript/cognition/ThreatPatternKind.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ThreatPatternKind = "prompt-injection" | "tool-escalation" | "credential-exfiltration" | "memory-poisoning" | "consent-bypass" | "resource-exhaustion" | "unknown"; diff --git a/protocol/typescript/cognition/ThreatRefusalAuditPayload.ts b/protocol/typescript/cognition/ThreatRefusalAuditPayload.ts deleted file mode 100644 index 0ac2a19f2d..0000000000 --- a/protocol/typescript/cognition/ThreatRefusalAuditPayload.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AdversarialPatternDecline } from "./AdversarialPatternDecline"; -import type { ThreatDetectionReport } from "./ThreatDetectionReport"; - -export type ThreatRefusalAuditPayload = { reason: string, decline: AdversarialPatternDecline, report: ThreatDetectionReport, }; diff --git a/protocol/typescript/cognition/ThreatSeverity.ts b/protocol/typescript/cognition/ThreatSeverity.ts deleted file mode 100644 index 9d0f7cd5be..0000000000 --- a/protocol/typescript/cognition/ThreatSeverity.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ThreatSeverity = "low" | "medium" | "high" | "critical"; diff --git a/protocol/typescript/cognition/ThreatSignal.ts b/protocol/typescript/cognition/ThreatSignal.ts deleted file mode 100644 index cf8cd6f3a0..0000000000 --- a/protocol/typescript/cognition/ThreatSignal.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ThreatEvidence } from "./ThreatEvidence"; -import type { ThreatPatternKind } from "./ThreatPatternKind"; -import type { ThreatSeverity } from "./ThreatSeverity"; - -export type ThreatSignal = { detectorId: string, pattern: ThreatPatternKind, severity: ThreatSeverity, confidence: number, evidence: Array, }; diff --git a/protocol/typescript/cognition/index.ts b/protocol/typescript/cognition/index.ts index 677ae7a9eb..a236cc0fe5 100644 --- a/protocol/typescript/cognition/index.ts +++ b/protocol/typescript/cognition/index.ts @@ -8,12 +8,9 @@ export type { AdaptiveThroughputPlan } from './AdaptiveThroughputPlan'; export type { AdaptiveThroughputRequest } from './AdaptiveThroughputRequest'; export type { AdmitInboxMessageParams } from './AdmitInboxMessageParams'; export type { AdmitInboxMessageResult } from './AdmitInboxMessageResult'; -export type { AdversarialPatternDecline } from './AdversarialPatternDecline'; export type { AIDecisionContext } from './AIDecisionContext'; export type { AIGatingDecision } from './AIGatingDecision'; export type { AIGatingDecisionFactors } from './AIGatingDecisionFactors'; -export type { AuditEntry } from './AuditEntry'; -export type { AuditEntryKind } from './AuditEntryKind'; export type { BenchmarkObserveParams } from './BenchmarkObserveParams'; export type { BenchmarkObserveResult } from './BenchmarkObserveResult'; export type { BenchmarkProvenance } from './BenchmarkProvenance'; @@ -90,7 +87,6 @@ export type { PersonaRosterEntry } from './PersonaRosterEntry'; export type { PersonaTurnPlan } from './PersonaTurnPlan'; export type { PlaybackDetail } from './PlaybackDetail'; export type { PlaybackPage } from './PlaybackPage'; -export type { ProbeError } from './HostProbeError'; export type { ProposalRating } from './ProposalRating'; export type { RateProposalsRequest } from './RateProposalsRequest'; export type { RateProposalsResponse } from './RateProposalsResponse'; @@ -134,14 +130,6 @@ export type { SiliconResidencyRequirement } from './SiliconResidencyRequirement' export type { SyncAdaptersRequest } from './SyncAdaptersRequest'; export type { SyncAdaptersResult } from './SyncAdaptersResult'; export type { TargetSilicon } from './TargetSilicon'; -export type { ThreatDetectionReport } from './ThreatDetectionReport'; -export type { ThreatEvidence } from './ThreatEvidence'; -export type { ThreatFrame } from './ThreatFrame'; -export type { ThreatFrameKind } from './ThreatFrameKind'; -export type { ThreatPatternKind } from './ThreatPatternKind'; -export type { ThreatRefusalAuditPayload } from './ThreatRefusalAuditPayload'; -export type { ThreatSeverity } from './ThreatSeverity'; -export type { ThreatSignal } from './ThreatSignal'; export type { ThroughputJob } from './ThroughputJob'; export type { ThroughputLaneBudget } from './ThroughputLaneBudget'; export type { ThroughputLease } from './ThroughputLease'; diff --git a/protocol/typescript/comms/EndpointId.ts b/protocol/typescript/comms/EndpointId.ts deleted file mode 100644 index 75967f32d4..0000000000 --- a/protocol/typescript/comms/EndpointId.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type EndpointId = string; diff --git a/protocol/typescript/genome/PeerId.ts b/protocol/typescript/genome/PeerId.ts deleted file mode 100644 index d8f7afb714..0000000000 --- a/protocol/typescript/genome/PeerId.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Stable per-peer identifier for federated recall. UUID-shaped - * (transparent on the wire as a string), typed wrapper distinct - * from PersonaId + ArtifactId so the type system catches swapped - * arguments at call sites that take both (e.g. - * `RecallScope::Federation { peers, .. }`). - */ -export type PeerId = string; diff --git a/protocol/typescript/genome/PersonaId.ts b/protocol/typescript/genome/PersonaId.ts deleted file mode 100644 index fddaaad6bc..0000000000 --- a/protocol/typescript/genome/PersonaId.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Stable per-persona identifier. UUID-shaped so it can't be confused - * with `ArtifactId` (same primitive, different type — the type system - * catches swapped arguments). See module docstring for the rehoming - * plan. - */ -export type PersonaId = string; diff --git a/protocol/typescript/genome/index.ts b/protocol/typescript/genome/index.ts index 4cf119a99b..6def00137b 100644 --- a/protocol/typescript/genome/index.ts +++ b/protocol/typescript/genome/index.ts @@ -18,8 +18,6 @@ export type { OutcomeWindow } from './OutcomeWindow'; export type { PageKind } from './PageKind'; export type { PageOffset } from './PageOffset'; export type { PageRef } from './PageRef'; -export type { PeerId } from './PeerId'; -export type { PersonaId } from './PersonaId'; export type { RankedPool } from './RankedPool'; export type { RecallBudget } from './RecallBudget'; export type { RecallContext } from './RecallContext'; diff --git a/protocol/typescript/index.ts b/protocol/typescript/index.ts index 4fb512488a..717c8bed1a 100644 --- a/protocol/typescript/index.ts +++ b/protocol/typescript/index.ts @@ -16,7 +16,6 @@ export type { HealthState } from './ai'; export type { HealthStatus } from './ai'; export type { ImageInput } from './ai'; export type { MessageContent } from './ai'; -export type { ModelCapability } from './ai'; export type { ModelInfo } from './ai'; export type { NativeToolSpec } from './ai'; export type { ResponseFormat } from './ai'; @@ -36,9 +35,6 @@ export type { AIGatingDecision } from './cognition'; export type { AIGatingDecisionFactors } from './cognition'; export type { AdaptiveThroughputPlan } from './cognition'; export type { AdaptiveThroughputRequest } from './cognition'; -export type { AdversarialPatternDecline } from './cognition'; -export type { AuditEntry } from './cognition'; -export type { AuditEntryKind } from './cognition'; export type { EmbedToolsRequest } from './cognition'; export type { EmbedToolsResponse } from './cognition'; export type { GatingConversationMessage } from './cognition'; @@ -51,7 +47,6 @@ export type { GenerateResponseAdmissionPolicy } from './cognition'; export type { GenerateResponseRequest } from './cognition'; export type { GenerateResponseResult } from './cognition'; export type { HostCapability } from './cognition'; -export type { ProbeError } from './cognition'; export type { HwCapabilityTier } from './cognition'; export type { LocalOrCloudPolicy } from './cognition'; export type { MediaItemLite } from './cognition'; @@ -89,14 +84,6 @@ export type { SharedRagSourcePlan } from './cognition'; export type { ShouldRespondRequest } from './cognition'; export type { SiliconResidencyRequirement } from './cognition'; export type { TargetSilicon } from './cognition'; -export type { ThreatDetectionReport } from './cognition'; -export type { ThreatEvidence } from './cognition'; -export type { ThreatFrame } from './cognition'; -export type { ThreatFrameKind } from './cognition'; -export type { ThreatPatternKind } from './cognition'; -export type { ThreatRefusalAuditPayload } from './cognition'; -export type { ThreatSeverity } from './cognition'; -export type { ThreatSignal } from './cognition'; export type { ThroughputJob } from './cognition'; export type { ThroughputLaneBudget } from './cognition'; export type { ThroughputLease } from './cognition'; @@ -145,8 +132,6 @@ export type { OutcomeWindow } from './genome'; export type { PageKind } from './genome'; export type { PageOffset } from './genome'; export type { PageRef } from './genome'; -export type { PeerId } from './genome'; -export type { PersonaId } from './genome'; export type { RankedPool } from './genome'; export type { RecallBudget } from './genome'; export type { RecallContext } from './genome'; @@ -255,6 +240,4 @@ export type { TopProcess } from './system'; export * from './voice'; export type { AvatarState } from './AvatarState'; export type { CallMessage } from './CallMessage'; -export type { ContentType } from './ContentTypes'; -export type { EntityType } from './ContentTypes'; export type { VideoPixelFormat } from './VideoPixelFormat'; diff --git a/protocol/typescript/inference/ModelRegistry.ts b/protocol/typescript/inference/ModelRegistry.ts deleted file mode 100644 index 077d3548e5..0000000000 --- a/protocol/typescript/inference/ModelRegistry.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ModelRegistryEntry } from "./ModelRegistryEntry"; - -/** - * Full model registry — mirrors `src/shared/models.json` SSOT shape. - * Extra fields (`personas`, `auto_download`, `chat_templates`) are - * silently ignored by serde for the in-Rust subset we consume here. - */ -export type ModelRegistry = { models: { [key in string]: ModelRegistryEntry }, }; diff --git a/protocol/typescript/inference/ModelRegistryEntry.ts b/protocol/typescript/inference/ModelRegistryEntry.ts deleted file mode 100644 index a7646e83b3..0000000000 --- a/protocol/typescript/inference/ModelRegistryEntry.ts +++ /dev/null @@ -1,59 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Single source of truth for local model metadata. - * - * Model registry entry deserialized from src/shared/models.json (embedded at - * compile time). TypeScript gets these types via ts-rs — NO hand-written - * duplicates. - * - * **Schema mirrors `src/shared/ModelRegistry.ts`'s `ModelSpec`** so both - * runtimes read the same JSON. Field names use the new SSOT shape - * (`hf_repo`, `min_ram_gb`); legacy aliases (`repo`, `min_memory_gb`) - * kept via `serde(alias = ...)` so any third-party consumer of the old - * embedded JSON keeps working until it migrates. - */ -export type ModelRegistryEntry = { -/** - * HuggingFace repo ID (canonical source). - * New SSOT field name; `repo` accepted as legacy alias. - */ -hf_repo: string, -/** - * Model kind: "chat-llm", "vision-llm", "embedding", "stt", "tts", "vad". - * Optional for back-compat with the legacy schema. - */ -kind?: string, -/** - * Serialization format: "gguf" or "safetensors" - */ -format?: string, -/** - * Model architecture: "qwen2", "llama", "phi", etc. - */ -architecture?: string, -/** - * Files belonging to this model (relative to repo root). - */ -files?: Array, -/** - * Approximate disk footprint in GB. - */ -size_gb?: number, -/** - * Minimum host RAM in GB to run this model. - * New SSOT field name; `min_memory_gb` accepted as legacy alias. - */ -min_ram_gb?: number, -/** - * Human-readable description - */ -description?: string, -/** - * Chat template name: "qwen2", "llama3", "chatml" - */ -chat_template?: string, -/** - * Whether this model is auto-loaded at startup (informational). - */ -auto_load?: boolean, }; diff --git a/protocol/typescript/inference/index.ts b/protocol/typescript/inference/index.ts index 8ceaec84df..bb2b54dc63 100644 --- a/protocol/typescript/inference/index.ts +++ b/protocol/typescript/inference/index.ts @@ -2,5 +2,3 @@ // Source: generator/generate-rust-bindings.ts // Re-generate: npx tsx generator/generate-rust-bindings.ts -export type { ModelRegistry } from './ModelRegistry'; -export type { ModelRegistryEntry } from './ModelRegistryEntry'; diff --git a/protocol/typescript/persona/BaseModelPolicy.ts b/protocol/typescript/persona/BaseModelPolicy.ts deleted file mode 100644 index b59768daa8..0000000000 --- a/protocol/typescript/persona/BaseModelPolicy.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BaseModelRung } from "./BaseModelRung"; -import type { PegReason } from "./PegReason"; -import type { RungPolicy } from "./RungPolicy"; - -/** - * What base model a citizen thinks on. ONE decision, one place. - */ -export type BaseModelPolicy = { "mode": "pegged", model: string, vram_budget_gb: number, reason: PegReason, } | { "mode": "adaptive", ladder: Array, floor: string, -/** - * What to do with a rung her genome was never forged for. - */ -rungs: RungPolicy, }; diff --git a/protocol/typescript/persona/BaseModelRung.ts b/protocol/typescript/persona/BaseModelRung.ts deleted file mode 100644 index 9e4d531422..0000000000 --- a/protocol/typescript/persona/BaseModelRung.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * One rung of an [`BaseModelPolicy::Adaptive`] ladder: a model that applies when the host - * has at least `min_vram_gb`. - * - * Structurally identical to the existing catalog `ModelPreference` (this is deliberately - * the same shape, so the catalog's ladders port over unchanged rather than growing a - * parallel encoding of "which model at which size"). - */ -export type BaseModelRung = { -/** - * Minimum total host VRAM (GB) for this rung to apply. - */ -minVramGb: number, -/** - * The model id this rung selects. - */ -model: string, -/** - * VRAM this persona needs when thinking on this model. - */ -vramBudgetGb: number, }; diff --git a/protocol/typescript/persona/PegReason.ts b/protocol/typescript/persona/PegReason.ts deleted file mode 100644 index 8b4bcc40a2..0000000000 --- a/protocol/typescript/persona/PegReason.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * WHY a citizen is pegged — carried so a refusal can explain itself, and so the - * measurement peg can be told apart from a durable one when a lease expires. - */ -export type PegReason = { "kind": "measurement", run_id: string, } | { "kind": "training", job_id: string, } | { "kind": "genomeBound" } | { "kind": "operator" }; diff --git a/protocol/typescript/persona/RungPolicy.ts b/protocol/typescript/persona/RungPolicy.ts deleted file mode 100644 index b7e86afff6..0000000000 --- a/protocol/typescript/persona/RungPolicy.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * What a rung with no adapter means for this citizen. - */ -export type RungPolicy = "requireGenome" | "allowBare"; diff --git a/protocol/typescript/tool_parsing/DecodedToolName.ts b/protocol/typescript/tool_parsing/DecodedToolName.ts deleted file mode 100644 index ad3b952560..0000000000 --- a/protocol/typescript/tool_parsing/DecodedToolName.ts +++ /dev/null @@ -1,14 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The decoded canonical name and whether decoding changed the input. - */ -export type DecodedToolName = { -/** - * The canonical, slash-namespaced tool name. - */ -decoded: string, -/** - * True when `decoded` differs from the supplied `name` (i.e. a fixup applied). - */ -changed: boolean, }; diff --git a/protocol/typescript/tool_parsing/EncodedToolName.ts b/protocol/typescript/tool_parsing/EncodedToolName.ts deleted file mode 100644 index a73328d92c..0000000000 --- a/protocol/typescript/tool_parsing/EncodedToolName.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The encoded, API-safe tool name. - */ -export type EncodedToolName = { -/** - * The tool name with slashes replaced by underscores (API transmission form). - */ -encoded: string, }; diff --git a/protocol/typescript/tool_parsing/ToolCorrectParams.ts b/protocol/typescript/tool_parsing/ToolCorrectParams.ts deleted file mode 100644 index 5986c39e63..0000000000 --- a/protocol/typescript/tool_parsing/ToolCorrectParams.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * One tool call to correct: its (possibly mangled) name and string parameters. - */ -export type ToolCorrectParams = { -/** - * The model-produced tool name (may be an alias or mis-namespaced form). - */ -tool_name: string, -/** - * The parameters as the model emitted them (string values). Corrected param - * keys (e.g. `query -> pattern`) are reported in the result. - */ -parameters: { [key in string]: string }, }; diff --git a/protocol/typescript/tool_parsing/ToolNameParams.ts b/protocol/typescript/tool_parsing/ToolNameParams.ts deleted file mode 100644 index 27f8ab38f6..0000000000 --- a/protocol/typescript/tool_parsing/ToolNameParams.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A single tool name — shared by `decode-name` and `encode-name`, which both take - * exactly one name and differ only in direction (compression principle: one - * contract for the two halves of the codec, like `system/*`'s `SystemQuery`). - */ -export type ToolNameParams = { -/** - * The tool name to decode (any model variant) or encode (canonical form). - */ -name: string, }; diff --git a/protocol/typescript/tool_parsing/ToolParseParams.ts b/protocol/typescript/tool_parsing/ToolParseParams.ts deleted file mode 100644 index 3e98c96c04..0000000000 --- a/protocol/typescript/tool_parsing/ToolParseParams.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * What to parse, and which model family produced it. - */ -export type ToolParseParams = { -/** - * The raw model response text, possibly containing tool-call blocks in any - * supported format (XML, Hermes ``, DeepSeek, etc.). - */ -response_text: string, -/** - * The model family hint (e.g. "hermes", "deepseek", "llama"). When omitted, - * generic multi-format parsing with truncation recovery is used. - */ -model_family?: string, }; diff --git a/protocol/typescript/tool_parsing/ToolRegisterParams.ts b/protocol/typescript/tool_parsing/ToolRegisterParams.ts deleted file mode 100644 index 0ee65b70bf..0000000000 --- a/protocol/typescript/tool_parsing/ToolRegisterParams.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The canonical tool names to register (e.g. `["code/write", "code/read"]`). - */ -export type ToolRegisterParams = { -/** - * Canonical, slash-namespaced tool names to add to the codec's table. - */ -tools: Array, }; diff --git a/protocol/typescript/tool_parsing/ToolRegistrationReport.ts b/protocol/typescript/tool_parsing/ToolRegistrationReport.ts deleted file mode 100644 index 759816663c..0000000000 --- a/protocol/typescript/tool_parsing/ToolRegistrationReport.ts +++ /dev/null @@ -1,14 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * How many names were registered in this call, and the codec's running total. - */ -export type ToolRegistrationReport = { -/** - * Number of names supplied in this call. - */ -registered: number, -/** - * Total distinct names the codec now knows. - */ -total: number, };