aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / crates / aien-runtime / src / compose.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | //! The compose bridge (NEXT-PHASE-1 cut 1b): omega COMPOSITION-2 through |
| 17 | //! aien-omega-compose. A goal becomes one proposed file change, checked, |
| 18 | //! recorded in the Cortex journal and committed (or refused) by AEGIS. |
| 19 | //! One composition home per process, opened on first use and kept open: the |
| 20 | //! Cortex journal takes an exclusive writer lock. |
| 21 | //! |
| 22 | //! Lifted out of `spine.rs`, which keeps the runtime daemon's step loop. |
| 23 | |
| 24 | mod bridge; |
| 25 | |
| 26 | // The bridge: a goal in, one proposed, checked and recorded file change (or |
| 27 | // a refusal) out, with the operator commands on the same compose home. |
| 28 | pub use bridge::{ComposeBridge, ComposeProposer, Generation}; |
| 29 | |
| 30 | // Reading a model reply as a file proposal (the approval path re-checks one). |
| 31 | pub use bridge::{check_file_proposal, parse_file_proposal, FileProposal}; |
| 32 | |
| 33 | // Settings read from the environment: at daemon start (aien-cli, server.rs) |
| 34 | // and, for the budgets, again when a compose home opens. Public so the env |
| 35 | // tests check every accepted and refused value through these functions. |
| 36 | pub use bridge::{ |
| 37 | authorize_desk_at_start_from_env, authorize_desk_setting, authorize_requires_desk_from_env, |
| 38 | compose_budgets_from_env, compose_dir_from_env, compose_doc_max_tokens_from_env, |
| 39 | ComposeBudgets, AUTHORIZE_DESK_ENV, |
| 40 | }; |
| 41 | |
| 42 | // The digest a generation record carries for a token id list. |
| 43 | pub use bridge::token_ids_sha256; |
| 44 | |
| 45 | // For the daemon (server.rs) and the approval and effect paths only. |
| 46 | pub(crate) use bridge::{ |
| 47 | authorize_mac_line, check_desk_key_at_start, classify_target, compose_assistant_prefix, |
| 48 | record_view, wall_clock_reason, ComposeHome, TargetClass, COMPOSE_ASSISTANT_PREFIX, |
| 49 | }; |
| 50 | |
| 51 | /// The exact bytes the bridge hands the model and the proposal it makes of a |
| 52 | /// reply, for offline re-derivation tools that reproduce a recorded run |
| 53 | /// without a compose home (examples/np1_reference.rs, np1_edit_merge.rs, |
| 54 | /// qwen3_8b_specverify.rs) and for the prompt-size measurements. They |
| 55 | /// reproduce; they do not run a task: callers and tests run tasks through |
| 56 | /// [`ComposeBridge`](crate::compose::ComposeBridge). |
| 57 | pub mod rederive { |
| 58 | pub use super::bridge::{ |
| 59 | classify_destination, compose_assistant_prefix, corrective_retry_prompt, edit_proposal, |
| 60 | new_document_block, proposal_prompt, retry_prompt, task_decision, task_prompt, |
| 61 | ProposalKind, TargetClass, TaskPrompt, COMPOSE_ASSISTANT_PREFIX, |
| 62 | }; |
| 63 | } |