Skip to main content

qontinui_types/
lib.rs

1//! # qontinui-types
2//!
3//! Canonical DTO types shared across the Qontinui stack.
4//!
5//! Rust is the **single source of truth**. TypeScript and Python bindings are
6//! generated from the JSON Schemas emitted by `schemars` on these types; see
7//! `qontinui-schemas/scripts/` and the `just generate-types` task.
8//!
9//! ## Conventions
10//!
11//! - Every field that is optional on the wire uses
12//!   `#[serde(default, skip_serializing_if = "Option::is_none")]` so absence and
13//!   `null` are distinguishable and round-trip faithfully.
14//! - Dates and times are ISO 8601 `String`s. Do **not** introduce
15//!   `chrono::DateTime<Utc>` here — it complicates JSON Schema output and
16//!   couples the DTO layer to a particular chrono version. The types crate is a
17//!   wire-format layer, not a domain model.
18//! - UUIDs are `String`s (wire-format), not `uuid::Uuid`. Same reason.
19//! - Polymorphic step arrays use `Vec<serde_json::Value>`. JSON Schema emits
20//!   `{ "type": "array", "items": {} }` → `unknown[]` in TS, `list[Any]` in
21//!   Python. Typed step discriminated unions are a future migration (Wave 4).
22//!
23//! Drift between these Rust sources and the checked-in TS/Python bindings is
24//! caught in CI by `.github/workflows/schema-drift.yml`, which regenerates
25//! the bindings on every PR touching `rust/src/**` and fails if `git diff`
26//! reports any non-timestamp change. The codegen toolchain (Tauri Linux deps,
27//! datamodel-code-generator version) is pinned in that workflow — bump the
28//! pins deliberately when upstream output changes.
29//!
30//! ## The functional-spec-contract v0 artifact set (frozen 2026-06-13)
31//!
32//! Three modules form the keystone contract for the website → mobile
33//! regeneration program (`2026-06-13-functional-spec-contract.md`):
34//!
35//! - [`functional_spec`] — **Artifact 1**, the backend-agnostic [`functional_spec::FunctionalSpec`]
36//!   that comprehension writes and generation reads. Its `ui_states` / `navigation`
37//!   reuse [`ir`]`::{IrState, IrTransition}` (a literal type-level superset of the IR).
38//! - [`completeness_verdict`] — **Artifact 2**, the Completeness Rubric +
39//!   [`completeness_verdict::CompletenessVerdict`]. Borrows the `DriftVerdict` field
40//!   vocabulary and embeds [`spec_check::SpecCheckResult`] for the UI dimension.
41//! - [`priorities_profile`] — **Artifact 3**, the [`priorities_profile::Profile`] that
42//!   parameterizes the generators.
43//!
44//! **v0 stability contract:** the `specVersion` / `profileVersion` fields are `"0"`.
45//! Until they bump to `"1"`, changes are **additive-only** — new optional fields and
46//! new enum variants only, never a rename, removal, or type change of an existing
47//! field. (`deny_unknown_fields` is deliberately omitted on these three so a reader
48//! tolerates a forward document.) Downstream plans #1 (app-gen), #2 (backend-gen),
49//! and #3 (comprehension) build against this frozen interface in parallel.
50
51pub mod accessibility;
52pub mod ai_workflows;
53pub mod app_events;
54pub mod apps;
55pub mod canonical_hash;
56/// Completeness **evaluation** — the deterministic rubric walk that turns a
57/// [`functional_spec::FunctionalSpec`] + coverage evidence into a
58/// [`completeness_verdict::CompletenessVerdict`] (node enumeration + gap diff +
59/// per-section breakdown). The verify-phase rubric the website→mobile slice proves.
60pub mod completeness_eval;
61/// Completeness Rubric + Verdict — Artifact 2 of the functional-spec-contract
62/// keystone. Scores a generated app against the [`functional_spec`] in spec
63/// units; embeds [`spec_check`] for the UI dimension and borrows the
64/// `DriftVerdict` field vocabulary. See
65/// `2026-06-13-functional-spec-contract.md`.
66pub mod completeness_verdict;
67pub mod config;
68pub mod constraints;
69/// Canonical `DEV-*` dev-event outcome signatures (effect-side classification).
70/// Companion to [`dev_states`]; same `UB-*`-style plain-enum template.
71pub mod dev_signatures;
72/// Canonical dev-environment state vocabulary (cause-side context) for the
73/// dev-event cause-effect ledger. Plain Rust enum mirroring the
74/// [`ui_bridge_diagnostics`] `UB-*` pattern — intentionally no DB, not codegen'd
75/// to TS/Python. See `plans/2026-06-07-twin-dev-event-cause-effect-ledger.md`.
76pub mod dev_states;
77pub mod discovery;
78/// Shared operation→endpoint derivation for the website→mobile regeneration program.
79/// The single deterministic rule the app-generator (#1) and backend-generator (#2)
80/// both call so the generated app's data layer and the generated backend's routes
81/// agree without a runtime handoff. See `2026-06-14-app-generator-ir-inversion.md` /
82/// `2026-06-14-backend-generator-from-spec.md` (the reconciliation block).
83pub mod endpoint_for;
84pub mod execution;
85pub mod federation;
86pub mod findings;
87/// Functional Spec — Artifact 1 of the functional-spec-contract keystone: the
88/// backend-agnostic contract between comprehension and generation. Reuses
89/// [`ir`]`::{IrState, IrTransition}` for the `ui_states`/`navigation` section.
90/// See `2026-06-13-functional-spec-contract.md`.
91pub mod functional_spec;
92pub mod geometry;
93pub mod git_ops;
94pub mod ir;
95pub mod mcp_config;
96pub mod memory;
97pub mod orchestration_config;
98/// Priorities Profile — Artifact 3 of the functional-spec-contract keystone:
99/// the declarative, gate-checkable generator parameterization. See
100/// `2026-06-13-functional-spec-contract.md`.
101pub mod priorities_profile;
102pub mod process_management;
103pub mod rag;
104pub mod runner;
105pub mod scheduler;
106pub mod sdk_features;
107pub mod spec_api_events;
108pub mod spec_check;
109pub mod state_machine;
110pub mod targets;
111pub mod task_run;
112pub mod terminal;
113pub mod text_norm;
114pub mod ticket_system;
115pub mod tree_events;
116pub mod ui_bridge;
117/// Canonical UI Bridge diagnostic code enum. **Generated** from
118/// `ui-bridge/diagnostics/codes.json` by `ui-bridge/scripts/gen-diagnostics.ts`
119/// — not from a `schemars` Rust source like the rest of this crate. Hand-edits
120/// are overwritten; drift is gated by ui-bridge's `diagnostics:check`.
121pub mod ui_bridge_diagnostics;
122pub mod verification;
123pub mod worker_output;
124pub mod workflow;
125pub mod workflow_step;
126
127/// Rust-only cross-crate runner↔supervisor types.
128///
129/// See `wire/mod.rs` for the strictness convention. NOT generated to TS or
130/// Python — these types only ever flow between Rust crates inside this
131/// workspace.
132pub mod wire;
133
134// =========================================================================
135// Forward-compat device-namespace aliases — unified-devices-registry rollout
136// =========================================================================
137//
138// The unified-devices plan renames `Runner` → `Device` across the qontinui
139// ecosystem. This 0.2.0 release ships **only the forward-compat aliases**:
140// the underlying Rust types remain named `Runner*`, with `Device*` aliases
141// added so new consumer code can write `qontinui_types::device::*` against
142// this release.
143//
144// The actual rename direction-flip (move struct defs from `runner` to
145// `device`, reverse the alias direction) is deferred to a coordinated
146// future PR after every consumer has migrated to `device::*` imports and
147// the runner-side `schema_export.rs` registers Device-named schemars
148// titles. Doing the flip prematurely would drift the codegen output
149// (schemars emits the Rust struct's actual name as the schema title)
150// against the runner's hardcoded `add!("Runner", qrn::Runner)` calls.
151//
152// Removed (along with the reverse `runner::*` aliases) once the flip
153// lands. The aliases are additive public API; semver-wise this is a
154// minor bump (0.1.x → 0.2.0).
155pub mod device {
156    pub use crate::runner::*;
157    pub type Device = crate::runner::Runner;
158    pub type DeviceStatus = crate::runner::RunnerStatus;
159    pub type DeviceCrash = crate::runner::RunnerCrash;
160    pub type DeviceUiError = crate::runner::RunnerUiError;
161}