1pub const LANGUAGE_VERSION: &str = "vibe-0.1";
10
11pub const HOST_VERSION: &str = "vibe-host-0.1";
13
14mod accel;
15mod ast;
16mod ast_query;
17mod bind;
18mod budget;
19pub mod bytecode;
20pub mod capability_schema;
21pub mod catalog;
22mod cbor_ast;
23#[path = "check.rs"]
24mod check;
25mod degrade;
26mod diagnose;
27mod effects;
28mod error;
29mod eval;
30mod grammar;
31mod lex;
32mod lexicon_pin;
33mod parse;
34mod span;
35pub mod session;
36mod types;
37mod unicode_ident;
38mod value;
39
40pub mod animation;
41pub mod ast_merge;
42pub mod conditioning;
43pub mod cosmic;
44pub mod crypto;
45pub mod dag;
46pub mod decompiler;
47pub mod deontic_interrupt;
48pub mod extension_registry;
49pub mod frame_morphism;
50pub mod hid;
51pub mod law_package;
52pub mod locale;
53pub mod metamodel;
54pub mod module_system;
55pub mod observer;
56pub mod physics;
57pub mod presentation;
58pub mod pretty;
59pub mod projectional;
60pub mod quantity;
61pub mod reactive_cell;
62pub mod reflection;
63pub mod replay_clock;
64pub mod sheaf;
65pub mod stdlib_v2;
66pub mod task_scheduler;
67pub mod tick_policy;
68pub mod topology_decl;
69pub mod translate;
70pub mod trivia;
71pub mod vocab;
72pub mod web_runtime;
73
74pub use accel::{
75 add_f64_slices, cell_batch_cap, detect_available_tier, CELL_BATCH_NATIVE, CELL_BATCH_WASM,
76};
77pub use ast::{
78 Arg, ArmBody, BinOp, BindDecl, BindResolve, Block, CapSpec, CellDecl, ColorLit, ConstDecl,
79 EffectClass, EnumDecl, EnumVariant, Expr, ExprKind, FieldDecl, FieldRepresentation,
80 FieldSupport, FunctionDecl, HookDecl, ImportDecl, Item, LawDecl, Literal, LocaleDecl, MatchArm,
81 MaterialDecl, ModalKind, ModuleDecl, NamedArg, Param, Pattern, PrefixDecl, PresentDecl,
82 Program, Stmt, TypeExpr, UnOp,
83};
84pub use ast_query::{
85 builtin_policies, check_custom_policies, check_policies, function_has_budget, hook_has_budget,
86 parse_query, run_policies, Policy, PolicyViolation, QueryPattern,
87};
88pub use bind::{AccelerationTier, Host, HostEnvironment, LocalHost};
89pub use budget::{Budget, SENTINEL_BYTES};
90pub use cbor_ast::{
91 call_cbor_ld, compress_iri, decode, decode_value_cbor_ld, derive_provider_namespace, encode,
92 encode_value_cbor_ld, expand_term, ingest_json_with_provider_ns, DecodeError,
93 DEFAULT_CONTEXT_IRI, TAG_CBOR_LD_COMPRESSED, TAG_CBOR_LD_UNCOMPRESSED, TAG_VIBE_AST,
94 TAG_VIBE_DISCLOSURE_DENIED, TAG_VIBE_DURATION, TAG_VIBE_INSTANT, TAG_VIBE_IRI,
95 TAG_VIBE_QUANTITY, TAG_VIBE_QUIN_REF,
96};
97pub use check::{
98 check_cell, check_program, check_program_all, check_program_with_vocab, CheckResult,
99 MAX_DIAGNOSTICS,
100};
101pub use dag::{
102 ControlUnit, DagEdge, DagError, DagNode, DagPipeline, ExecutionState, JudgeClaim, JudgeFrame,
103 NodeEffect, NodeStatus, RouterStrategy, MAX_DAG_EDGES, MAX_DAG_NODES, MAX_JUDGE_CLAIMS,
104 MAX_NODE_IO,
105};
106pub use degrade::{gpu_missing, llm_missing};
107pub use deontic_interrupt::{
108 AgentSandbox, DeonticInterrupt, InterruptType, LeaseError, Phase, PhaseLeaser,
109 MAX_CAPS_PER_PHASE, MAX_PHASES, MAX_SANDBOX_AGENTS,
110};
111pub use diagnose::{diagnose, DiagnoseReport};
112pub use error::{DiagCode, Diagnostic};
113pub use eval::{populate_import_aliases, Engine, Env};
114pub use grammar::{DIAGNOSTIC_SCHEMA_JSON, EBNF, GBNF, SOURCE_SCHEMA_JSON};
115pub use lexicon_pin::{
116 alias_migrate_report, alias_rows_suggested_fix, apply_upgrade_map, diagnose_lexicon_pin,
117 living_rewritten_as_artifact, missing_pack_report, parse_alias_rows_json,
118 parse_lexicon_pin_from_source, parse_pack_manifest_json, AliasRow, LexiconFraming, LexiconPin,
119 PackManifest, EXAMPLE_PIN, HELD_OPEN_PACK, LEXICON_MANIFEST_ID,
120};
121pub use parse::{parse_cell, parse_program};
122pub use topology_decl::{
123 parse_geometry_blocks, parse_geometry_or_topology, BoundaryDecl, GeometryDecl,
124 HarbouredGraphDecl, TopologyInvokeDescriptor,
125};
126pub use projectional::{
127 apply_edit, apply_edits, make_binary, make_call, make_field, make_float, make_ident, make_int,
128 make_law, make_material, make_member, make_string, project_program, Edit, ProjectOptions,
129};
130pub use reactive_cell::{ReactiveCell, ReactiveCellError, ReactiveCellGraph};
131pub use reflection::{
132 ReflectionConfig, ReflectionEngine, ReflectionLoop, ReflectionResult, StageResult,
133};
134pub use span::Span;
135pub use unicode_ident::{
136 could_be_unicode_ident_start, is_bidi_control, is_xid_continue, is_xid_start,
137 validate_identifier, IdentifierPolicyError, MAX_IDENT_LEN,
138};
139pub use value::{
140 CausalRelation, ConservationQuantity, ConservationResult, DisclosureBoundary, Duration,
141 EnumValue, FieldRef, Frame, Instant, MaterialRef, Miscibility, Mixture, MixturePhase, Pose,
142 Quantity, QuinRef, SpeciesRef, TimeScale, Transform, Value, WorldLine,
143};
144
145pub fn eval_cell<H: Host>(src: &str, host: &mut H, env: &mut Env) -> Result<Value, Diagnostic> {
147 let expr = parse_cell(src)?;
148 check_cell(&expr)?;
149 let mut engine = Engine::new(host, Budget::default());
150 engine.eval_expr(&expr, env)
151}
152
153pub fn load_program(src: &str) -> Result<Program, Diagnostic> {
155 let program = parse_program(src)?;
156 check_program(&program)?;
157 Ok(program)
158}
159
160pub fn eval_function<H: Host>(
163 program: &Program,
164 name: &str,
165 args: Vec<Value>,
166 host: &mut H,
167 env: &mut Env,
168) -> Result<Value, Diagnostic> {
169 populate_import_aliases(env, &program.imports)?;
170 let mut engine = Engine::with_program(host, Budget::default(), program);
171 engine.call_function(program, name, args, env)
172}
173
174pub fn dispatch_hook<H: Host>(
180 program: &Program,
181 path: &[String],
182 args: Vec<Value>,
183 host: &mut H,
184 env: &mut Env,
185) -> Result<Value, Diagnostic> {
186 populate_import_aliases(env, &program.imports)?;
187 let mut engine = Engine::with_program(host, Budget::default(), program);
188 engine.call_hook(program, path, args, env)
189}