1#![allow(dead_code)]
6
7use serde::Serialize;
8
9#[derive(Debug, Serialize)]
12pub struct IRProgram {
13 pub node_type: &'static str,
14 pub source_line: u32,
15 pub source_column: u32,
16 pub personas: Vec<IRPersona>,
17 pub contexts: Vec<IRContext>,
18 pub anchors: Vec<IRAnchor>,
19 pub tools: Vec<IRToolSpec>,
20 pub memories: Vec<IRMemory>,
21 pub types: Vec<IRType>,
22 pub flows: Vec<IRFlow>,
23 pub runs: Vec<IRRun>,
24 pub imports: Vec<IRImport>,
25 pub agents: Vec<IRAgent>,
26 pub shields: Vec<IRShield>,
27 pub windows: Vec<IRWindow>,
29 pub daemons: Vec<IRDaemon>,
30 pub ots_specs: Vec<IROts>,
31 pub pix_specs: Vec<IRPix>,
32 pub ledger_specs: Vec<IRLedger>,
36 pub corpus_specs: Vec<IRCorpus>,
37 pub psyche_specs: Vec<IRPsyche>,
38 pub mandate_specs: Vec<IRMandate>,
39 pub lambda_data_specs: Vec<IRLambdaData>,
40 pub compute_specs: Vec<IRCompute>,
41 pub axonstore_specs: Vec<IRAxonStore>,
42 pub endpoints: Vec<IRAxonEndpoint>,
43 #[serde(skip)]
59 pub extensions: Vec<IRExtension>,
60 pub dataspace_specs: Vec<IRDataspace>,
71 pub resources: Vec<IRResource>,
73 pub fabrics: Vec<IRFabric>,
74 pub manifests: Vec<IRManifest>,
75 pub observations: Vec<IRObserve>,
76 pub intention_tree: Option<IRIntentionTree>,
80 pub reconciles: Vec<IRReconcile>,
82 pub leases: Vec<IRLease>,
83 pub ensembles: Vec<IREnsemble>,
84 pub sessions: Vec<IRSession>,
86 pub topologies: Vec<IRTopology>,
87 pub immunes: Vec<IRImmune>,
89 pub reflexes: Vec<IRReflex>,
90 pub heals: Vec<IRHeal>,
91 pub components: Vec<IRComponent>,
93 pub views: Vec<IRView>,
94 pub channels: Vec<IRChannel>,
96 pub sockets: Vec<IRSocket>,
100 #[serde(skip)]
108 pub observables: Vec<IRObservable>,
109 #[serde(default, skip_serializing_if = "Vec::is_empty")]
114 pub witnesses: Vec<IRWitness>,
115 #[serde(default, skip_serializing_if = "Vec::is_empty")]
123 pub upstreams: Vec<IRUpstream>,
124 #[serde(default, skip_serializing_if = "Vec::is_empty")]
128 pub cors_policies: Vec<IRCors>,
129 #[serde(default, skip_serializing_if = "Vec::is_empty")]
132 pub caches: Vec<IRCache>,
133 #[serde(default, skip_serializing_if = "Vec::is_empty")]
138 pub credentials: Vec<IRCredential>,
139 #[serde(default, skip_serializing_if = "Vec::is_empty")]
145 pub savants: Vec<IRSavant>,
146 #[serde(default, skip_serializing_if = "Vec::is_empty")]
151 pub documents: Vec<IRDocument>,
152 #[serde(default, skip_serializing_if = "Vec::is_empty")]
157 pub deliveries: Vec<IRDeliver>,
158 #[serde(default, skip_serializing_if = "Vec::is_empty")]
161 pub synths: Vec<IRSynth>,
162 #[serde(default, skip_serializing_if = "Vec::is_empty")]
165 pub scopes: Vec<IRScope>,
166 pub effects: Vec<IREffectDeclaration>,
182}
183
184impl IRProgram {
185 pub fn new() -> Self {
186 IRProgram {
187 node_type: "program",
188 source_line: 1,
189 source_column: 1,
190 personas: Vec::new(),
191 contexts: Vec::new(),
192 anchors: Vec::new(),
193 tools: Vec::new(),
194 memories: Vec::new(),
195 types: Vec::new(),
196 flows: Vec::new(),
197 runs: Vec::new(),
198 imports: Vec::new(),
199 agents: Vec::new(),
200 shields: Vec::new(),
201 windows: Vec::new(),
202 daemons: Vec::new(),
203 ots_specs: Vec::new(),
204 pix_specs: Vec::new(),
205 ledger_specs: Vec::new(),
206 corpus_specs: Vec::new(),
207 psyche_specs: Vec::new(),
208 mandate_specs: Vec::new(),
209 lambda_data_specs: Vec::new(),
210 compute_specs: Vec::new(),
211 axonstore_specs: Vec::new(),
212 endpoints: Vec::new(),
213 extensions: Vec::new(),
214 dataspace_specs: Vec::new(),
215 resources: Vec::new(),
216 fabrics: Vec::new(),
217 manifests: Vec::new(),
218 observations: Vec::new(),
219 intention_tree: None,
220 reconciles: Vec::new(),
221 leases: Vec::new(),
222 ensembles: Vec::new(),
223 sessions: Vec::new(),
224 topologies: Vec::new(),
225 immunes: Vec::new(),
226 reflexes: Vec::new(),
227 heals: Vec::new(),
228 components: Vec::new(),
229 views: Vec::new(),
230 channels: Vec::new(),
231 sockets: Vec::new(),
232 observables: Vec::new(),
233 witnesses: Vec::new(),
234 upstreams: Vec::new(),
235 cors_policies: Vec::new(),
236 caches: Vec::new(),
237 credentials: Vec::new(),
238 savants: Vec::new(),
239 documents: Vec::new(),
240 deliveries: Vec::new(),
241 synths: Vec::new(),
242 scopes: Vec::new(),
243 effects: Vec::new(),
244 }
245 }
246}
247
248#[derive(Debug, Clone, Serialize)]
250pub struct IRYield {
251 pub node_type: &'static str,
252 pub source_line: u32,
253 pub source_column: u32,
254 pub value_expr: String,
255 pub value_kind: String,
256}
257
258#[derive(Debug, Clone, Serialize)]
260pub struct IRPauliTerm {
261 pub coefficient: f64,
262 pub pauli: String,
263}
264
265#[derive(Debug, Clone, Serialize)]
267pub struct IRObservable {
268 pub node_type: &'static str,
269 pub source_line: u32,
270 pub source_column: u32,
271 pub name: String,
272 #[serde(skip_serializing_if = "Option::is_none")]
273 pub qubits: Option<i64>,
274 pub terms: Vec<IRPauliTerm>,
275}
276
277#[derive(Debug, Clone, Serialize)]
282pub struct IRWitness {
283 pub node_type: &'static str,
284 pub source_line: u32,
285 pub source_column: u32,
286 pub name: String,
287 pub claim: String,
288 pub baseline: String,
289 pub metric: String,
290 pub threshold: f64,
291 pub data: String,
292}
293
294#[derive(Debug, Serialize, Default)]
305pub struct IREffectDeclaration {
306 pub node_type: &'static str,
307 pub source_line: u32,
308 pub source_column: u32,
309 pub name: String,
310 pub operations: Vec<IREffectOperation>,
311}
312
313impl IREffectDeclaration {
314 pub fn new() -> Self {
315 Self {
316 node_type: "effect_declaration",
317 source_line: 0,
318 source_column: 0,
319 name: String::new(),
320 operations: Vec::new(),
321 }
322 }
323}
324
325#[derive(Debug, Serialize, Default)]
326pub struct IREffectOperation {
327 pub node_type: &'static str,
328 pub source_line: u32,
329 pub source_column: u32,
330 pub name: String,
331 pub type_parameters: Vec<String>,
332 pub parameter_names: Vec<String>,
333 pub parameter_types: Vec<String>,
334 pub return_type: String,
335}
336
337impl IREffectOperation {
338 pub fn new() -> Self {
339 Self {
340 node_type: "effect_operation",
341 source_line: 0,
342 source_column: 0,
343 name: String::new(),
344 type_parameters: Vec::new(),
345 parameter_names: Vec::new(),
346 parameter_types: Vec::new(),
347 return_type: String::new(),
348 }
349 }
350}
351
352#[derive(Debug, Clone, Serialize)]
358pub struct IRResource {
359 pub node_type: &'static str,
360 pub source_line: u32,
361 pub source_column: u32,
362 pub name: String,
363 pub kind: String,
364 pub endpoint: String,
365 pub capacity: Option<i64>,
366 pub lifetime: String, pub certainty_floor: Option<f64>, pub shield_ref: String,
369}
370
371impl IRResource {
372 pub fn new(name: String, line: u32, column: u32) -> Self {
373 IRResource {
374 node_type: "resource",
375 source_line: line,
376 source_column: column,
377 name,
378 kind: String::new(),
379 endpoint: String::new(),
380 capacity: None,
381 lifetime: "affine".to_string(),
382 certainty_floor: None,
383 shield_ref: String::new(),
384 }
385 }
386}
387
388#[derive(Debug, Clone, Serialize)]
392pub struct IRFabric {
393 pub node_type: &'static str,
394 pub source_line: u32,
395 pub source_column: u32,
396 pub name: String,
397 pub provider: String,
398 pub region: String,
399 pub zones: Option<i64>,
400 pub ephemeral: Option<bool>,
401 pub shield_ref: String,
402}
403
404#[derive(Debug, Clone, Serialize)]
408pub struct IRManifest {
409 pub node_type: &'static str,
410 pub source_line: u32,
411 pub source_column: u32,
412 pub name: String,
413 pub resources: Vec<String>,
414 pub fabric_ref: String,
415 pub region: String,
416 pub zones: Option<i64>,
417 pub compliance: Vec<String>,
418}
419
420#[derive(Debug, Clone, Serialize)]
431#[serde(untagged)]
432pub enum IRIntentionOperation {
433 Manifest(IRManifest),
434 Observe(IRObserve),
435}
436
437#[derive(Debug, Clone, Serialize)]
440pub struct IRIntentionTree {
441 pub node_type: &'static str,
442 pub source_line: u32,
443 pub source_column: u32,
444 pub operations: Vec<IRIntentionOperation>,
445}
446
447#[derive(Debug, Clone, Serialize)]
449pub struct IRObserve {
450 pub node_type: &'static str,
451 pub source_line: u32,
452 pub source_column: u32,
453 pub name: String,
454 pub target: String,
455 pub sources: Vec<String>,
456 pub quorum: Option<i64>,
457 pub timeout: String,
458 pub on_partition: String,
459 pub certainty_floor: Option<f64>,
460}
461
462#[derive(Debug, Clone, Serialize)]
466pub struct IRReconcile {
467 pub node_type: &'static str,
468 pub source_line: u32,
469 pub source_column: u32,
470 pub name: String,
471 pub observe_ref: String,
472 pub threshold: Option<f64>,
473 pub tolerance: Option<f64>,
474 pub on_drift: String,
475 pub shield_ref: String,
476 pub mandate_ref: String,
477 pub max_retries: i64,
478}
479
480#[derive(Debug, Clone, Serialize)]
482pub struct IRLease {
483 pub node_type: &'static str,
484 pub source_line: u32,
485 pub source_column: u32,
486 pub name: String,
487 pub resource_ref: String,
488 pub duration: String,
489 pub acquire: String,
490 pub on_expire: String,
491}
492
493#[derive(Debug, Clone, Serialize)]
495pub struct IREnsemble {
496 pub node_type: &'static str,
497 pub source_line: u32,
498 pub source_column: u32,
499 pub name: String,
500 pub observations: Vec<String>,
501 pub quorum: Option<i64>,
502 pub aggregation: String,
503 pub certainty_mode: String,
504}
505
506#[derive(Debug, Clone, Serialize)]
511pub struct IRSessionStep {
512 pub node_type: &'static str,
513 pub source_line: u32,
514 pub source_column: u32,
515 pub op: String,
516 pub message_type: String,
517 #[serde(skip_serializing_if = "Vec::is_empty", default)]
520 pub branches: Vec<IRSessionBranch>,
521 #[serde(skip_serializing_if = "String::is_empty", default)]
525 pub binder: String,
526 #[serde(skip_serializing_if = "std::ops::Not::not", default)]
529 pub resumable: bool,
530}
531
532#[derive(Debug, Clone, Serialize)]
534pub struct IRSessionBranch {
535 pub node_type: &'static str,
536 pub label: String,
537 pub steps: Vec<IRSessionStep>,
538}
539
540#[derive(Debug, Clone, Serialize)]
542pub struct IRSessionRole {
543 pub node_type: &'static str,
544 pub source_line: u32,
545 pub source_column: u32,
546 pub name: String,
547 pub steps: Vec<IRSessionStep>,
548}
549
550#[derive(Debug, Clone, Serialize)]
552pub struct IRSession {
553 pub node_type: &'static str,
554 pub source_line: u32,
555 pub source_column: u32,
556 pub name: String,
557 pub roles: Vec<IRSessionRole>,
558}
559
560#[derive(Debug, Clone, Serialize)]
562pub struct IRTopologyEdge {
563 pub node_type: &'static str,
564 pub source_line: u32,
565 pub source_column: u32,
566 pub source: String,
567 pub target: String,
568 pub session_ref: String,
569}
570
571#[derive(Debug, Clone, Serialize)]
573pub struct IRTopology {
574 pub node_type: &'static str,
575 pub source_line: u32,
576 pub source_column: u32,
577 pub name: String,
578 pub nodes: Vec<String>,
579 pub edges: Vec<IRTopologyEdge>,
580}
581
582#[derive(Debug, Clone, Serialize)]
586pub struct IRImmune {
587 pub node_type: &'static str,
588 pub source_line: u32,
589 pub source_column: u32,
590 pub name: String,
591 pub watch: Vec<String>,
592 pub sensitivity: Option<f64>,
593 pub baseline: String,
594 pub window: i64,
595 pub scope: String,
596 pub tau: String,
597 pub decay: String,
598}
599
600#[derive(Debug, Clone, Serialize)]
602pub struct IRReflex {
603 pub node_type: &'static str,
604 pub source_line: u32,
605 pub source_column: u32,
606 pub name: String,
607 pub trigger: String,
608 pub on_level: String,
609 pub action: String,
610 pub scope: String,
611 pub sla: String,
612}
613
614#[derive(Debug, Clone, Serialize)]
616pub struct IRHeal {
617 pub node_type: &'static str,
618 pub source_line: u32,
619 pub source_column: u32,
620 pub name: String,
621 pub source: String,
622 pub on_level: String,
623 pub mode: String,
624 pub scope: String,
625 pub review_sla: String,
626 pub shield_ref: String,
627 pub max_patches: i64,
628}
629
630#[derive(Debug, Clone, Serialize)]
634pub struct IRComponent {
635 pub node_type: &'static str,
636 pub source_line: u32,
637 pub source_column: u32,
638 pub name: String,
639 pub renders: String,
640 pub via_shield: String,
641 pub on_interact: String,
642 pub render_hint: String,
643}
644
645#[derive(Debug, Clone, Serialize)]
647pub struct IRView {
648 pub node_type: &'static str,
649 pub source_line: u32,
650 pub source_column: u32,
651 pub name: String,
652 pub title: String,
653 pub components: Vec<String>,
654 pub route: String,
655}
656
657#[derive(Debug, Serialize)]
660pub struct IRImport {
661 pub node_type: &'static str,
662 pub source_line: u32,
663 pub source_column: u32,
664 pub module_path: Vec<String>,
665 pub names: Vec<String>,
666}
667
668#[derive(Debug, Clone, Serialize)]
671pub struct IRPersona {
672 pub node_type: &'static str,
673 pub source_line: u32,
674 pub source_column: u32,
675 pub name: String,
676 pub domain: Vec<String>,
677 pub tone: String,
678 pub confidence_threshold: Option<f64>,
679 pub cite_sources: Option<bool>,
680 pub refuse_if: Vec<String>,
681 pub language: String,
682 pub description: String,
683}
684
685#[derive(Debug, Clone, Serialize)]
688pub struct IRContext {
689 pub node_type: &'static str,
690 pub source_line: u32,
691 pub source_column: u32,
692 pub name: String,
693 pub memory_scope: String,
694 pub language: String,
695 pub depth: String,
696 pub max_tokens: Option<i64>,
697 pub temperature: Option<f64>,
698 pub cite_sources: Option<bool>,
699 #[serde(default, skip_serializing_if = "Option::is_none")]
702 pub now_tz: Option<String>,
703}
704
705#[derive(Debug, Clone, Serialize)]
708pub struct IRAnchor {
709 pub node_type: &'static str,
710 pub source_line: u32,
711 pub source_column: u32,
712 pub name: String,
713 pub description: String,
714 pub require: String,
715 pub reject: Vec<String>,
716 pub enforce: String,
717 pub confidence_floor: Option<f64>,
718 pub unknown_response: String,
719 pub on_violation: String,
720 pub on_violation_target: String,
721}
722
723#[derive(Debug, Clone, Serialize, PartialEq)]
731pub struct IRToolParam {
732 pub name: String,
733 pub type_name: String,
734 pub optional: bool,
735}
736
737#[derive(Debug, Clone, Serialize, PartialEq)]
742pub struct IRNamedArg {
743 pub name: String,
744 pub value: String,
745 pub value_kind: String,
751}
752
753#[derive(Debug, Serialize)]
754pub struct IRToolSpec {
755 pub node_type: &'static str,
756 pub source_line: u32,
757 pub source_column: u32,
758 pub name: String,
759 pub provider: String,
760 pub max_results: Option<i64>,
761 pub filter_expr: String,
762 pub timeout: String,
763 pub runtime: String,
764 pub sandbox: Option<bool>,
765 pub input_schema: Vec<String>,
766 pub output_schema: String,
767 pub parameters: Vec<IRToolParam>,
773 pub output_type: Option<String>,
777 #[serde(default, skip_serializing_if = "String::is_empty")]
783 pub secret: String,
784 #[serde(default, skip_serializing_if = "String::is_empty")]
791 pub secret_partition: String,
792 pub effect_row: Vec<String>,
793 #[serde(skip_serializing_if = "Option::is_none")]
798 pub target: Option<String>,
799 #[serde(skip_serializing_if = "Option::is_none")]
800 pub risk: Option<String>,
801 #[serde(skip_serializing_if = "Vec::is_empty")]
802 pub argv: Vec<String>,
803 #[serde(default, skip_serializing_if = "String::is_empty")]
807 pub cache: String,
808 #[serde(skip_serializing_if = "Option::is_none")]
814 pub scrape: Option<IRScrapeSpec>,
815}
816
817#[derive(Debug, Serialize)]
822pub struct IRScrapeSpec {
823 pub node_type: &'static str,
824 #[serde(skip_serializing_if = "Option::is_none")]
825 pub engine: Option<String>,
826 #[serde(skip_serializing_if = "Option::is_none")]
827 pub impersonate: Option<String>,
828 #[serde(skip_serializing_if = "Option::is_none")]
829 pub render_wait: Option<String>,
830 #[serde(default, skip_serializing_if = "String::is_empty")]
831 pub proxy: String,
832 #[serde(skip_serializing_if = "Option::is_none")]
833 pub respect_robots: Option<bool>,
834 #[serde(default, skip_serializing_if = "Vec::is_empty")]
835 pub extract: Vec<String>,
836 #[serde(skip_serializing_if = "Option::is_none")]
837 pub adaptive: Option<bool>,
838 #[serde(skip_serializing_if = "Option::is_none")]
839 pub similarity_floor: Option<f64>,
840 #[serde(default, skip_serializing_if = "String::is_empty")]
841 pub follow: String,
842 #[serde(skip_serializing_if = "Option::is_none")]
843 pub max_depth: Option<i64>,
844 #[serde(skip_serializing_if = "Option::is_none")]
845 pub max_pages: Option<i64>,
846 #[serde(skip_serializing_if = "Option::is_none")]
847 pub concurrency: Option<i64>,
848 #[serde(default, skip_serializing_if = "String::is_empty")]
849 pub politeness: String,
850 #[serde(default, skip_serializing_if = "String::is_empty")]
851 pub checkpoint: String,
852}
853
854#[derive(Debug, Serialize)]
857pub struct IRMemory {
858 pub node_type: &'static str,
859 pub source_line: u32,
860 pub source_column: u32,
861 pub name: String,
862 pub store: String,
863 pub backend: String,
864 pub retrieval: String,
865 pub decay: String,
866}
867
868#[derive(Debug, Clone, Serialize)]
871pub struct IRTypeField {
872 pub node_type: &'static str,
873 pub source_line: u32,
874 pub source_column: u32,
875 pub name: String,
876 pub type_name: String,
877 pub generic_param: String,
878 pub optional: bool,
879}
880
881#[derive(Debug, Serialize)]
882pub struct IRType {
883 pub node_type: &'static str,
884 pub source_line: u32,
885 pub source_column: u32,
886 pub name: String,
887 pub fields: Vec<IRTypeField>,
888 pub range_min: Option<f64>,
889 pub range_max: Option<f64>,
890 pub where_expression: String,
891 pub compliance: Vec<String>,
893}
894
895#[derive(Debug, Clone, Serialize)]
898pub struct IRParameter {
899 pub node_type: &'static str,
900 pub source_line: u32,
901 pub source_column: u32,
902 pub name: String,
903 pub type_name: String,
904 pub generic_param: String,
905 pub optional: bool,
906}
907
908#[derive(Debug, Clone, Serialize)]
909pub struct IRDataEdge {
910 pub node_type: &'static str,
911 pub source_line: u32,
912 pub source_column: u32,
913 pub source_step: String,
914 pub target_step: String,
915 pub type_name: String,
916}
917
918#[derive(Debug, Clone, Serialize)]
919pub struct IRStep {
920 pub node_type: &'static str,
921 pub source_line: u32,
922 pub source_column: u32,
923 pub name: String,
924 pub persona_ref: String,
925 pub given: String,
926 pub ask: String,
927 pub use_tool: Option<serde_json::Value>,
928 pub probe: Option<serde_json::Value>,
929 pub reason: Option<serde_json::Value>,
930 pub weave: Option<serde_json::Value>,
931 pub output_type: String,
932 pub confidence_floor: Option<f64>,
933 pub navigate_ref: String,
934 pub apply_ref: String,
935 #[serde(default, skip_serializing_if = "Option::is_none")]
940 pub requires_context: Option<u32>,
941 #[serde(default, skip_serializing_if = "Option::is_none")]
946 pub now_tz: Option<String>,
947 pub body: Vec<serde_json::Value>,
948}
949
950#[derive(Debug, Clone, Serialize)]
951pub struct IRFlow {
952 pub node_type: &'static str,
953 pub source_line: u32,
954 pub source_column: u32,
955 pub name: String,
956 pub parameters: Vec<IRParameter>,
957 pub return_type_name: String,
958 pub return_type_generic: String,
959 pub return_type_optional: bool,
960 pub steps: Vec<IRFlowNode>,
961 pub edges: Vec<IRDataEdge>,
962 pub execution_levels: Vec<Vec<String>>,
963}
964
965#[derive(Debug, Clone, Serialize)]
968pub struct IRRun {
969 pub node_type: &'static str,
970 pub source_line: u32,
971 pub source_column: u32,
972 pub flow_name: String,
973 pub arguments: Vec<String>,
974 pub persona_name: String,
975 pub context_name: String,
976 pub anchor_names: Vec<String>,
977 pub on_failure: String,
978 pub on_failure_params: Vec<Vec<String>>,
979 pub output_to: String,
980 pub effort: String,
981 pub resolved_flow: Option<IRFlow>,
982 pub resolved_persona: Option<IRPersona>,
983 pub resolved_context: Option<IRContext>,
984 pub resolved_anchors: Vec<IRAnchor>,
985}
986
987#[derive(Debug, Clone, Serialize)]
990pub struct IRLambdaData {
991 pub node_type: &'static str,
992 pub source_line: u32,
993 pub source_column: u32,
994 pub name: String,
995 pub ontology: String, pub certainty: f64, pub temporal_frame_start: String, pub temporal_frame_end: String, pub provenance: String, pub derivation: String, }
1002
1003#[derive(Debug, Clone, Serialize)]
1004pub struct IRLambdaDataApply {
1005 pub node_type: &'static str,
1006 pub source_line: u32,
1007 pub source_column: u32,
1008 pub lambda_data_name: String, pub target: String, pub output_type: String, }
1012
1013#[derive(Debug, Clone, Serialize)]
1018#[serde(untagged)]
1019pub enum IRFlowNode {
1020 Step(IRStep),
1021 Probe(IRProbe),
1022 Reason(IRReasonStep),
1023 Validate(IRValidateStep),
1024 Refine(IRRefineStep),
1025 Weave(IRWeaveStep),
1026 UseTool(IRUseToolStep),
1027 Remember(IRRememberStep),
1028 Recall(IRRecallStep),
1029 Conditional(IRConditional),
1030 ForIn(IRForIn),
1031 Let(IRLetBinding),
1032 Return(IRReturnStep),
1033 Break(IRBreakStep),
1038 Continue(IRContinueStep),
1042 LambdaDataApply(IRLambdaDataApply),
1043 Par(IRParallelBlock),
1044 Hibernate(IRHibernateStep),
1045 Deliberate(IRDeliberateBlock),
1046 Consensus(IRConsensusBlock),
1047 Forge(IRForgeBlock),
1048 Grad(IRGradStep),
1050 Focus(IRFocusStep),
1051 Associate(IRAssociateStep),
1052 Aggregate(IRAggregateStep),
1053 Explore(IRExploreStep),
1054 Ingest(IRIngestStep),
1055 ShieldApply(IRShieldApplyStep),
1056 Stream(IRStreamBlock),
1057 Navigate(IRNavigateStep),
1058 Drill(IRDrillStep),
1059 Trail(IRTrailStep),
1060 Corroborate(IRCorroborateStep),
1061 OtsApply(IROtsApplyStep),
1062 MandateApply(IRMandateApplyStep),
1063 ComputeApply(IRComputeApplyStep),
1064 Listen(IRListenStep),
1065 DaemonStep(IRDaemonStepNode),
1066 Emit(IREmit),
1068 Mint(IRMintStep),
1070 Rotate(IRRotateStep),
1072 Publish(IRPublish),
1074 Discover(IRDiscover),
1076 Persist(IRPersistStep),
1077 Retrieve(IRRetrieveStep),
1078 Mutate(IRMutateStep),
1079 Purge(IRPurgeStep),
1080 Transact(IRTransactBlock),
1081 Warden(IRWarden),
1083 Quant(IRQuant),
1085 Yield(IRYield),
1087 Run(IRRun),
1090}
1091
1092#[derive(Debug, Clone, Serialize)]
1093pub struct IRProbe {
1094 pub node_type: &'static str,
1095 pub source_line: u32,
1096 pub source_column: u32,
1097 pub target: String,
1098}
1099
1100#[derive(Debug, Clone, Serialize)]
1101pub struct IRReasonStep {
1102 pub node_type: &'static str,
1103 pub source_line: u32,
1104 pub source_column: u32,
1105 pub strategy: String,
1106 pub target: String,
1107}
1108
1109#[derive(Debug, Clone, Serialize)]
1110pub struct IRValidateStep {
1111 pub node_type: &'static str,
1112 pub source_line: u32,
1113 pub source_column: u32,
1114 pub target: String,
1115 pub rule: String,
1116}
1117
1118#[derive(Debug, Clone, Serialize)]
1119pub struct IRRefineStep {
1120 pub node_type: &'static str,
1121 pub source_line: u32,
1122 pub source_column: u32,
1123 pub target: String,
1124 pub strategy: String,
1125}
1126
1127#[derive(Debug, Clone, Serialize)]
1128pub struct IRWeaveStep {
1129 pub node_type: &'static str,
1130 pub source_line: u32,
1131 pub source_column: u32,
1132 pub sources: Vec<String>,
1133 pub target: String,
1134 pub format_type: String,
1135 pub priority: Vec<String>,
1136 pub style: String,
1137}
1138
1139#[derive(Debug, Clone, Serialize)]
1140pub struct IRUseToolStep {
1141 pub node_type: &'static str,
1142 pub source_line: u32,
1143 pub source_column: u32,
1144 pub tool_name: String,
1145 pub argument: String,
1146 pub named_args: Vec<IRNamedArg>,
1151}
1152
1153#[derive(Debug, Clone, Serialize)]
1154pub struct IRRememberStep {
1155 pub node_type: &'static str,
1156 pub source_line: u32,
1157 pub source_column: u32,
1158 pub expression: String,
1159 pub memory_target: String,
1160}
1161
1162#[derive(Debug, Clone, Serialize)]
1163pub struct IRRecallStep {
1164 pub node_type: &'static str,
1165 pub source_line: u32,
1166 pub source_column: u32,
1167 pub query: String,
1168 pub memory_source: String,
1169}
1170
1171#[derive(Debug, Clone, Serialize)]
1176#[serde(tag = "kind", rename_all = "snake_case")]
1177pub enum IRExpr {
1178 Lit { lit: IRExprLit },
1180 Ref { path: String },
1182 Unary { op: String, operand: Box<IRExpr> },
1184 Binary {
1186 op: String,
1187 lhs: Box<IRExpr>,
1188 rhs: Box<IRExpr>,
1189 },
1190 Call {
1193 builtin: String,
1194 args: Vec<IRExpr>,
1195 },
1196 Field {
1198 base: Box<IRExpr>,
1199 field: String,
1200 },
1201 Index {
1203 base: Box<IRExpr>,
1204 index: Box<IRExpr>,
1205 },
1206}
1207
1208#[derive(Debug, Clone, Serialize)]
1210#[serde(tag = "ty", rename_all = "snake_case")]
1211pub enum IRExprLit {
1212 Int { value: i64 },
1213 Float { value: f64 },
1214 Bool { value: bool },
1215 Str { value: String },
1216}
1217
1218#[derive(Debug, Clone, Serialize)]
1219pub struct IRConditional {
1220 pub node_type: &'static str,
1221 pub source_line: u32,
1222 pub source_column: u32,
1223 pub condition: String,
1224 pub comparison_op: String,
1225 pub comparison_value: String,
1226 pub then_body: Vec<IRFlowNode>,
1227 pub else_body: Vec<IRFlowNode>,
1228 pub conditions: Vec<(String, String, String)>,
1229 pub conjunctor: String,
1230 #[serde(skip_serializing_if = "Option::is_none")]
1234 pub cond: Option<IRExpr>,
1235}
1236
1237#[derive(Debug, Clone, Serialize)]
1238pub struct IRForIn {
1239 pub node_type: &'static str,
1240 pub source_line: u32,
1241 pub source_column: u32,
1242 pub variable: String,
1243 pub iterable: String,
1244 pub body: Vec<IRFlowNode>,
1245}
1246
1247#[derive(Debug, Clone, Serialize)]
1248pub struct IRLetBinding {
1249 pub node_type: &'static str,
1250 pub source_line: u32,
1251 pub source_column: u32,
1252 pub target: String,
1253 pub value: String,
1254 pub value_kind: String,
1257 #[serde(skip_serializing_if = "Option::is_none")]
1262 pub value_ast: Option<IRExpr>,
1263}
1264
1265#[derive(Debug, Clone, Serialize)]
1266pub struct IRReturnStep {
1267 pub node_type: &'static str,
1268 pub source_line: u32,
1269 pub source_column: u32,
1270 pub value_expr: String,
1271}
1272
1273#[derive(Debug, Clone, Serialize)]
1277pub struct IRBreakStep {
1278 pub node_type: &'static str,
1279 pub source_line: u32,
1280 pub source_column: u32,
1281}
1282
1283#[derive(Debug, Clone, Serialize)]
1287pub struct IRContinueStep {
1288 pub node_type: &'static str,
1289 pub source_line: u32,
1290 pub source_column: u32,
1291}
1292
1293#[derive(Debug, Clone, Serialize)]
1294pub struct IRParallelBlock {
1295 pub node_type: &'static str,
1296 pub source_line: u32,
1297 pub source_column: u32,
1298 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1304 pub branches: Vec<Vec<IRFlowNode>>,
1305}
1306
1307#[derive(Debug, Clone, Serialize)]
1308pub struct IRHibernateStep {
1309 pub node_type: &'static str,
1310 pub source_line: u32,
1311 pub source_column: u32,
1312 pub event_name: String,
1313 pub timeout: String,
1314}
1315
1316#[derive(Debug, Clone, Serialize)]
1317pub struct IRDeliberateBlock {
1318 pub node_type: &'static str,
1319 pub source_line: u32,
1320 pub source_column: u32,
1321}
1322
1323#[derive(Debug, Clone, Serialize)]
1324pub struct IRConsensusBlock {
1325 pub node_type: &'static str,
1326 pub source_line: u32,
1327 pub source_column: u32,
1328}
1329
1330#[derive(Debug, Clone, Serialize, Default)]
1336pub struct IRForgeBlock {
1337 pub node_type: &'static str,
1338 pub source_line: u32,
1339 pub source_column: u32,
1340 #[serde(default, skip_serializing_if = "String::is_empty")]
1341 pub name: String,
1342 #[serde(default, skip_serializing_if = "String::is_empty")]
1343 pub seed: String,
1344 #[serde(default, skip_serializing_if = "String::is_empty")]
1345 pub output_type: String,
1346 #[serde(default, skip_serializing_if = "String::is_empty")]
1347 pub mode: String,
1348 #[serde(default, skip_serializing_if = "is_default_novelty")]
1349 pub novelty: f64,
1350 #[serde(default, skip_serializing_if = "is_one_i64")]
1351 pub depth: i64,
1352 #[serde(default, skip_serializing_if = "is_one_i64")]
1353 pub branches: i64,
1354 #[serde(default, skip_serializing_if = "String::is_empty")]
1355 pub constraints_ref: String,
1356}
1357
1358fn is_default_novelty(v: &f64) -> bool {
1359 (*v - 0.5).abs() < f64::EPSILON
1360}
1361fn is_one_i64(v: &i64) -> bool {
1362 *v == 1
1363}
1364
1365#[derive(Debug, Clone, Serialize)]
1372pub struct IRGradStep {
1373 pub node_type: &'static str,
1374 pub source_line: u32,
1375 pub source_column: u32,
1376 pub target: String,
1378 pub wrt: Vec<String>,
1379 pub output: String,
1381 pub original: Option<IRExpr>,
1382 pub derivatives: Vec<IRExpr>,
1383}
1384
1385#[derive(Debug, Clone, Serialize)]
1386pub struct IRFocusStep {
1387 pub node_type: &'static str,
1388 pub source_line: u32,
1389 pub source_column: u32,
1390 pub expression: String,
1391 pub where_expr: String,
1393 pub select: Vec<String>,
1395 pub output: String,
1397}
1398
1399#[derive(Debug, Clone, Serialize)]
1400pub struct IRAssociateStep {
1401 pub node_type: &'static str,
1402 pub source_line: u32,
1403 pub source_column: u32,
1404 pub left: String,
1405 pub right: String,
1406 pub using_field: String,
1407 pub output: String,
1409}
1410
1411#[derive(Debug, Clone, Serialize)]
1412pub struct IRAggregateStep {
1413 pub node_type: &'static str,
1414 pub source_line: u32,
1415 pub source_column: u32,
1416 pub target: String,
1417 pub group_by: Vec<String>,
1418 pub alias: String,
1419 pub compute: Vec<String>,
1422 pub where_expr: String,
1424}
1425
1426#[derive(Debug, Clone, Serialize)]
1427pub struct IRExploreStep {
1428 pub node_type: &'static str,
1429 pub source_line: u32,
1430 pub source_column: u32,
1431 pub target: String,
1432 pub limit: Option<i64>,
1433 pub output: String,
1435}
1436
1437#[derive(Debug, Clone, Serialize)]
1438pub struct IRIngestStep {
1439 pub node_type: &'static str,
1440 pub source_line: u32,
1441 pub source_column: u32,
1442 pub source: String,
1443 pub target: String,
1444 pub format: String,
1448 pub max_bytes: Option<u64>,
1451 pub max_rows: Option<u64>,
1452}
1453
1454#[derive(Debug, Clone, Serialize)]
1455pub struct IRShieldApplyStep {
1456 pub node_type: &'static str,
1457 pub source_line: u32,
1458 pub source_column: u32,
1459 pub shield_name: String,
1460 pub target: String,
1461 pub output_type: String,
1462}
1463
1464#[derive(Debug, Clone, Serialize)]
1465pub struct IRStreamBlock {
1466 pub node_type: &'static str,
1467 pub source_line: u32,
1468 pub source_column: u32,
1469}
1470
1471#[derive(Debug, Clone, Serialize)]
1472pub struct IRNavigateStep {
1473 pub node_type: &'static str,
1474 pub source_line: u32,
1475 pub source_column: u32,
1476 pub pix_ref: String,
1477 pub corpus_ref: String,
1478 pub query: String,
1479 pub trail_enabled: bool,
1480 pub output_name: String,
1481 #[serde(default, skip_serializing_if = "String::is_empty")]
1483 pub seed: String,
1484 #[serde(default, skip_serializing_if = "Option::is_none")]
1486 pub budget: Option<i64>,
1487 #[serde(default, skip_serializing_if = "String::is_empty")]
1494 pub where_expr: String,
1495}
1496
1497#[derive(Debug, Clone, Serialize)]
1498pub struct IRDrillStep {
1499 pub node_type: &'static str,
1500 pub source_line: u32,
1501 pub source_column: u32,
1502 pub pix_ref: String,
1503 pub subtree_path: String,
1504 pub query: String,
1505 pub output_name: String,
1506}
1507
1508#[derive(Debug, Clone, Serialize)]
1509pub struct IRTrailStep {
1510 pub node_type: &'static str,
1511 pub source_line: u32,
1512 pub source_column: u32,
1513 pub navigate_ref: String,
1514}
1515
1516#[derive(Debug, Clone, Serialize)]
1517pub struct IRCorroborateStep {
1518 pub node_type: &'static str,
1519 pub source_line: u32,
1520 pub source_column: u32,
1521 pub navigate_ref: String,
1522 pub output_name: String,
1523}
1524
1525#[derive(Debug, Clone, Serialize)]
1526pub struct IROtsApplyStep {
1527 pub node_type: &'static str,
1528 pub source_line: u32,
1529 pub source_column: u32,
1530 pub ots_name: String,
1531 pub target: String,
1532 pub output_type: String,
1533}
1534
1535#[derive(Debug, Clone, Serialize)]
1536pub struct IRMandateApplyStep {
1537 pub node_type: &'static str,
1538 pub source_line: u32,
1539 pub source_column: u32,
1540 pub mandate_name: String,
1541 pub target: String,
1542 pub output_type: String,
1543}
1544
1545#[derive(Debug, Clone, Serialize)]
1546pub struct IRComputeApplyStep {
1547 pub node_type: &'static str,
1548 pub source_line: u32,
1549 pub source_column: u32,
1550 pub compute_name: String,
1551 pub arguments: Vec<String>,
1552 pub output_name: String,
1553}
1554
1555#[derive(Debug, Clone, Serialize)]
1556pub struct IRListenStep {
1557 pub node_type: &'static str,
1558 pub source_line: u32,
1559 pub source_column: u32,
1560 pub channel: String,
1561 pub channel_is_ref: bool,
1564 pub event_alias: String,
1565 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1569 pub body: Vec<IRFlowNode>,
1570}
1571
1572#[derive(Debug, Clone, Serialize)]
1573pub struct IRDaemonStepNode {
1574 pub node_type: &'static str,
1575 pub source_line: u32,
1576 pub source_column: u32,
1577 pub daemon_ref: String,
1578}
1579
1580#[derive(Debug, Clone, Serialize)]
1581pub struct IRPersistStep {
1582 pub node_type: &'static str,
1583 pub source_line: u32,
1584 pub source_column: u32,
1585 pub store_name: String,
1586 pub fields: Vec<(String, String)>,
1590}
1591
1592#[derive(Debug, Clone, Serialize)]
1593pub struct IRRetrieveStep {
1594 pub node_type: &'static str,
1595 pub source_line: u32,
1596 pub source_column: u32,
1597 pub store_name: String,
1598 pub where_expr: String,
1599 pub alias: String,
1600 #[serde(skip_serializing_if = "String::is_empty", default)]
1605 pub order_by: String,
1606 #[serde(skip_serializing_if = "String::is_empty", default)]
1608 pub limit_expr: String,
1609 #[serde(skip_serializing_if = "String::is_empty", default)]
1615 pub aggregate: String,
1616 #[serde(skip_serializing_if = "String::is_empty", default)]
1618 pub group_by: String,
1619 #[serde(skip_serializing_if = "String::is_empty", default)]
1622 pub cache: String,
1623}
1624
1625#[derive(Debug, Clone, Serialize)]
1626pub struct IRMutateStep {
1627 pub node_type: &'static str,
1628 pub source_line: u32,
1629 pub source_column: u32,
1630 pub store_name: String,
1631 pub where_expr: String,
1632 pub fields: Vec<(String, String)>,
1636}
1637
1638#[derive(Debug, Clone, Serialize)]
1639pub struct IRPurgeStep {
1640 pub node_type: &'static str,
1641 pub source_line: u32,
1642 pub source_column: u32,
1643 pub store_name: String,
1644 pub where_expr: String,
1645}
1646
1647#[derive(Debug, Clone, Serialize)]
1648pub struct IRTransactBlock {
1649 pub node_type: &'static str,
1650 pub source_line: u32,
1651 pub source_column: u32,
1652}
1653
1654#[derive(Debug, Clone, Serialize)]
1659pub struct IRWarden {
1660 pub node_type: &'static str,
1661 pub source_line: u32,
1662 pub source_column: u32,
1663 pub target: String,
1664 pub scope_ref: String,
1665 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1667 pub body: Vec<IRFlowNode>,
1668}
1669
1670#[derive(Debug, Clone, Serialize)]
1672pub struct IRScope {
1673 pub node_type: &'static str,
1674 pub source_line: u32,
1675 pub source_column: u32,
1676 pub name: String,
1677 pub targets: Vec<String>,
1678 pub depth: String,
1679 pub approver: String,
1680}
1681
1682#[derive(Debug, Clone, Serialize)]
1687pub struct IRQuant {
1688 pub node_type: &'static str,
1689 pub source_line: u32,
1690 pub source_column: u32,
1691 #[serde(default, skip_serializing_if = "Option::is_none")]
1693 pub encoding: Option<String>,
1694 #[serde(default, skip_serializing_if = "Option::is_none")]
1696 pub observable: Option<String>,
1697 #[serde(default, skip_serializing_if = "Option::is_none")]
1699 pub qubits: Option<i64>,
1700 #[serde(default, skip_serializing_if = "Option::is_none")]
1702 pub depth: Option<i64>,
1703 #[serde(default, skip_serializing_if = "Option::is_none")]
1705 pub bandwidth: Option<f64>,
1706 #[serde(default, skip_serializing_if = "Option::is_none")]
1709 pub reupload: Option<i64>,
1710 pub effect: String,
1712 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1714 pub body: Vec<IRFlowNode>,
1715}
1716
1717#[derive(Debug, Clone, Serialize)]
1720pub struct IRAgent {
1721 pub node_type: &'static str,
1722 pub source_line: u32,
1723 pub source_column: u32,
1724 pub name: String,
1725 pub goal: String,
1726 pub tools: Vec<String>,
1727 pub memory_ref: String,
1728 pub strategy: String,
1729 pub on_stuck: String,
1730 pub shield_ref: String,
1731 pub max_iterations: Option<i64>,
1732 pub max_tokens: Option<i64>,
1733 pub max_time: String,
1734 pub max_cost: Option<f64>,
1735}
1736
1737#[derive(Debug, Clone, Serialize)]
1741pub struct IRWindow {
1742 pub node_type: &'static str,
1743 pub source_line: u32,
1744 pub source_column: u32,
1745 pub name: String,
1746 pub timezone: String,
1747 pub allow: Vec<IRWindowSpan>,
1748 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1752 pub exclude: Vec<String>,
1753 pub on_outside: String,
1754}
1755
1756#[derive(Debug, Clone, Serialize)]
1758pub struct IRWindowSpan {
1759 pub day_start: String,
1760 pub day_end: String,
1761 pub hour_start: i64,
1762 pub hour_end: i64,
1763}
1764
1765#[derive(Debug, Clone, Serialize)]
1769pub struct IRBudget {
1770 pub node_type: &'static str,
1771 pub source_line: u32,
1772 pub source_column: u32,
1773 pub quotas: Vec<IRBudgetQuota>,
1774 pub on_exhausted: String,
1778}
1779
1780#[derive(Debug, Clone, Serialize)]
1782pub struct IRBudgetQuota {
1783 pub kind: String,
1785 pub limit: i64,
1787 pub period: String,
1789 pub effect: String,
1791}
1792
1793#[derive(Debug, Clone, Serialize)]
1794pub struct IRShield {
1795 pub node_type: &'static str,
1796 pub source_line: u32,
1797 pub source_column: u32,
1798 pub name: String,
1799 pub scan: Vec<String>,
1800 pub strategy: String,
1801 pub on_breach: String,
1802 pub severity: String,
1803 pub quarantine: String,
1804 pub max_retries: i64,
1807 pub confidence_threshold: f64,
1808 pub allow_tools: Vec<String>,
1809 pub deny_tools: Vec<String>,
1810 pub sandbox: bool,
1811 pub redact: Vec<String>,
1812 pub log: String,
1813 pub deflect_message: String,
1814 #[serde(skip)]
1817 pub taint: String,
1818 pub compliance: Vec<String>,
1820 #[serde(skip_serializing_if = "String::is_empty")]
1824 pub sign: String,
1825}
1826
1827#[derive(Debug, Clone, Serialize)]
1828pub struct IRPix {
1829 pub node_type: &'static str,
1830 pub source_line: u32,
1831 pub source_column: u32,
1832 pub name: String,
1833 pub source: String,
1834 pub depth: Option<i64>,
1835 pub branching: Option<i64>,
1836 pub model: String,
1837}
1838
1839#[derive(Debug, Clone, Serialize)]
1845pub struct IRLedger {
1846 pub node_type: &'static str,
1847 pub source_line: u32,
1848 pub source_column: u32,
1849 pub name: String,
1850 pub source: String,
1851 pub depth: Option<i64>,
1852 pub branching: Option<i64>,
1853 pub model: String,
1854}
1855
1856#[derive(Debug, Clone, Serialize)]
1857pub struct IRPsyche {
1858 pub node_type: &'static str,
1859 pub source_line: u32,
1860 pub source_column: u32,
1861 pub name: String,
1862 pub dimensions: Vec<String>,
1863 pub manifold_noise: Option<f64>,
1864 pub manifold_momentum: Option<f64>,
1865 pub safety_constraints: Vec<String>,
1866 pub quantum_enabled: Option<bool>,
1867 pub inference_mode: String,
1868}
1869
1870#[derive(Debug, Clone, Serialize)]
1871pub struct IRCorpus {
1872 pub node_type: &'static str,
1873 pub source_line: u32,
1874 pub source_column: u32,
1875 pub name: String,
1876 pub documents: Vec<String>,
1877 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1880 pub relations: Vec<IRCorpusRelation>,
1881 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
1884 pub adaptive: bool,
1885 pub mcp_server: String,
1886 pub mcp_resource_uri: String,
1887 #[serde(default, skip_serializing_if = "Option::is_none")]
1892 pub store_source: Option<IRCorpusStoreSource>,
1893}
1894
1895#[derive(Debug, Clone, Serialize)]
1897pub struct IRCorpusRelation {
1898 pub etype: String,
1899 pub from: String,
1900 pub to: String,
1901 pub weight: f64,
1902}
1903
1904#[derive(Debug, Clone, Serialize)]
1910pub struct IRCorpusStoreSource {
1911 pub doc_store: String,
1912 pub doc_id: String,
1913 pub doc_title: String,
1914 pub edge_store: String,
1915 pub edge_from: String,
1916 pub edge_to: String,
1917 pub edge_type: String,
1918 pub edge_weight: String,
1919}
1920
1921#[derive(Debug, Clone, Serialize)]
1927pub struct IRDataspaceColumn {
1928 pub name: String,
1929 pub column_type: String,
1930}
1931
1932#[derive(Debug, Clone, Serialize)]
1933pub struct IRDataspace {
1934 pub node_type: &'static str,
1935 pub source_line: u32,
1936 pub source_column: u32,
1937 pub name: String,
1938 pub columns: Vec<IRDataspaceColumn>,
1940}
1941
1942#[derive(Debug, Clone, Serialize)]
1943pub struct IROts {
1944 pub node_type: &'static str,
1945 pub source_line: u32,
1946 pub source_column: u32,
1947 pub name: String,
1948 pub teleology: String,
1949 pub homotopy_search: String,
1950 pub loss_function: String,
1951}
1952
1953#[derive(Debug, Clone, Serialize)]
1954pub struct IRMandate {
1955 pub node_type: &'static str,
1956 pub source_line: u32,
1957 pub source_column: u32,
1958 pub name: String,
1959 pub constraint: String,
1960 pub kp: Option<f64>,
1961 pub ki: Option<f64>,
1962 pub kd: Option<f64>,
1963 pub tolerance: Option<f64>,
1964 pub max_steps: Option<i64>,
1965 pub on_violation: String,
1966}
1967
1968#[derive(Debug, Clone, Serialize)]
1969pub struct IRCompute {
1970 pub node_type: &'static str,
1971 pub source_line: u32,
1972 pub source_column: u32,
1973 pub name: String,
1974 pub shield_ref: String,
1975}
1976
1977#[derive(Debug, Clone, Serialize)]
1978pub struct IRDaemon {
1979 pub node_type: &'static str,
1980 pub source_line: u32,
1981 pub source_column: u32,
1982 pub name: String,
1983 pub goal: String,
1984 pub tools: Vec<String>,
1985 pub memory_ref: String,
1986 pub strategy: String,
1987 pub on_stuck: String,
1988 pub shield_ref: String,
1989 #[serde(default, skip_serializing_if = "String::is_empty")]
1993 pub window_ref: String,
1994 #[serde(default, skip_serializing_if = "Option::is_none")]
1998 pub budget: Option<IRBudget>,
1999 pub max_tokens: Option<i64>,
2000 pub max_time: String,
2001 pub max_cost: Option<f64>,
2002 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2008 pub listeners: Vec<IRListenStep>,
2009 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2014 pub requires_capabilities: Vec<String>,
2015}
2016
2017#[derive(Debug, Clone, Serialize)]
2025pub struct IRSavant {
2026 pub node_type: &'static str,
2027 pub source_line: u32,
2028 pub source_column: u32,
2029 pub name: String,
2030 pub domain: String,
2031 #[serde(default, skip_serializing_if = "Option::is_none")]
2032 pub cognition: Option<IRSavantCognition>,
2033 #[serde(default, skip_serializing_if = "Option::is_none")]
2034 pub memory: Option<IRSavantMemory>,
2035 #[serde(default, skip_serializing_if = "Option::is_none")]
2036 pub budget: Option<IRSavantBudget>,
2037 pub mandates: Vec<IRSavantMandate>,
2038}
2039
2040#[derive(Debug, Clone, Serialize)]
2043pub struct IRSavantCognition {
2044 pub depth: String,
2046 #[serde(default, skip_serializing_if = "Option::is_none")]
2048 pub entropic_threshold: Option<f64>,
2049 pub divergence: String,
2051}
2052
2053#[derive(Debug, Clone, Serialize)]
2055pub struct IRSavantMemory {
2056 pub backend: String,
2058 pub corpus_graph: bool,
2061 pub isolation_level: String,
2063}
2064
2065#[derive(Debug, Clone, Serialize)]
2068pub struct IRSavantBudget {
2069 #[serde(default, skip_serializing_if = "Option::is_none")]
2071 pub max_iterations: Option<i64>,
2072 #[serde(default, skip_serializing_if = "Option::is_none")]
2074 pub max_tool_synth: Option<i64>,
2075}
2076
2077#[derive(Debug, Clone, Serialize)]
2079pub struct IRSavantMandate {
2080 pub name: String,
2081 pub objective: String,
2082 pub output_type: String,
2083}
2084
2085#[derive(Debug, Clone, Serialize)]
2092pub struct IRDocument {
2093 pub node_type: &'static str,
2094 pub source_line: u32,
2095 pub source_column: u32,
2096 pub name: String,
2097 pub target: String,
2099 #[serde(default, skip_serializing_if = "String::is_empty")]
2100 pub template: String,
2101 #[serde(default, skip_serializing_if = "String::is_empty")]
2102 pub provenance: String,
2103 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2105 pub effect_row: Vec<String>,
2106 #[serde(default, skip_serializing_if = "String::is_empty")]
2112 pub epistemic_mode: String,
2113 pub blocks: Vec<IRDocBlock>,
2114}
2115
2116#[derive(Debug, Clone, Serialize)]
2119pub struct IRDocBlock {
2120 pub kind: String,
2121 pub fields: Vec<IRDocField>,
2122 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2123 pub children: Vec<IRDocBlock>,
2124}
2125
2126#[derive(Debug, Clone, Serialize)]
2130pub struct IRDocField {
2131 pub name: String,
2132 pub kind: &'static str,
2134 #[serde(default, skip_serializing_if = "String::is_empty")]
2135 pub value: String,
2136 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2137 pub items: Vec<String>,
2138}
2139
2140#[derive(Debug, Clone, Serialize)]
2147pub struct IRDeliver {
2148 pub node_type: &'static str,
2149 pub source_line: u32,
2150 pub source_column: u32,
2151 pub name: String,
2152 pub target: String,
2154 #[serde(default, skip_serializing_if = "String::is_empty")]
2157 pub provenance: String,
2158 #[serde(default, skip_serializing_if = "String::is_empty")]
2161 pub secret: String,
2162 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2164 pub effect_row: Vec<String>,
2165 #[serde(default, skip_serializing_if = "String::is_empty")]
2170 pub epistemic_mode: String,
2171 pub ops: Vec<IRDeliverOp>,
2172}
2173
2174#[derive(Debug, Clone, Serialize)]
2180pub struct IRDeliverOp {
2181 pub kind: String,
2183 pub fields: Vec<IRDocField>,
2184}
2185
2186#[derive(Debug, Clone, Serialize)]
2190pub struct IRSynth {
2191 pub node_type: &'static str,
2192 pub source_line: u32,
2193 pub source_column: u32,
2194 pub name: String,
2195 pub target: String,
2196 pub risk: String,
2197 #[serde(default, skip_serializing_if = "String::is_empty")]
2198 pub language: String,
2199 pub sandbox: String,
2200 pub review: String,
2202 #[serde(default, skip_serializing_if = "Option::is_none")]
2203 pub max_lines: Option<i64>,
2204}
2205
2206#[derive(Debug, Clone, Serialize)]
2214pub struct IRExtensionMember {
2215 pub name: String,
2216 #[serde(default, skip_serializing_if = "Option::is_none")]
2217 pub semantics: Option<String>,
2218 #[serde(default, skip_serializing_if = "Option::is_none")]
2219 pub default_confidence: Option<f64>,
2220}
2221
2222#[derive(Debug, Clone, Serialize)]
2229pub struct IRExtension {
2230 pub node_type: &'static str,
2231 pub source_line: u32,
2232 pub source_column: u32,
2233 pub name: String,
2234 pub category: String,
2235 pub members: Vec<IRExtensionMember>,
2236}
2237
2238#[derive(Debug, Clone, Serialize)]
2239pub struct IRAxonStore {
2240 pub node_type: &'static str,
2241 pub source_line: u32,
2242 pub source_column: u32,
2243 pub name: String,
2244 pub backend: String,
2245 pub connection: String,
2246 pub confidence_floor: Option<f64>,
2247 pub isolation: String,
2248 pub on_breach: String,
2249 pub capability: String,
2252 #[serde(default, skip_serializing_if = "String::is_empty")]
2258 pub class: String,
2259 #[serde(default, skip_serializing_if = "Option::is_none")]
2267 pub column_schema: Option<IRStoreColumnSchema>,
2268}
2269
2270#[derive(Debug, Clone, Serialize)]
2274#[serde(tag = "form", rename_all = "snake_case")]
2275pub enum IRStoreColumnSchema {
2276 Inline { columns: Vec<IRStoreColumn> },
2277 ManifestRef { qualified_name: String },
2278 EnvVar { var_name: String },
2279}
2280
2281#[derive(Debug, Clone, Serialize)]
2285pub struct IRStoreColumn {
2286 pub name: String,
2287 pub col_type: String,
2288 #[serde(default, skip_serializing_if = "is_false")]
2289 pub primary_key: bool,
2290 #[serde(default, skip_serializing_if = "is_false")]
2291 pub auto_increment: bool,
2292 #[serde(default, skip_serializing_if = "is_false")]
2293 pub not_null: bool,
2294 #[serde(default, skip_serializing_if = "is_false")]
2295 pub unique: bool,
2296 #[serde(default, skip_serializing_if = "String::is_empty")]
2297 pub default_value: String,
2298 #[serde(default, skip_serializing_if = "is_false")]
2304 pub identity: bool,
2305 #[serde(default, skip_serializing_if = "is_false")]
2313 pub indexed: bool,
2314 #[serde(default, skip_serializing_if = "Option::is_none")]
2322 pub json_shape: Option<String>,
2323}
2324
2325#[inline]
2326fn is_false(b: &bool) -> bool {
2327 !*b
2328}
2329
2330#[derive(Debug, Clone, Serialize)]
2331pub struct IRAxonEndpoint {
2332 pub node_type: &'static str,
2333 pub source_line: u32,
2334 pub source_column: u32,
2335 pub name: String,
2336 pub method: String,
2337 pub path: String,
2338 pub body_type: String,
2339 pub execute_flow: String,
2340 pub output_type: String,
2341 pub shield_ref: String,
2342 pub retries: i64,
2344 pub timeout: String,
2345 pub compliance: Vec<String>,
2347 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2356 pub path_params: Vec<String>,
2357 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2363 pub query_params: Vec<IRTypeField>,
2364 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2373 pub requires_capabilities: Vec<String>,
2374 #[serde(default, skip_serializing_if = "String::is_empty")]
2380 pub cors_ref: String,
2381 #[serde(default, skip_serializing_if = "is_false")]
2388 pub public: bool,
2389}
2390
2391#[derive(Debug, Clone, Serialize)]
2400pub struct IRChannel {
2401 pub node_type: &'static str,
2402 pub source_line: u32,
2403 pub source_column: u32,
2404 pub name: String,
2405 pub message: String, pub qos: String,
2407 pub lifetime: String,
2408 pub persistence: String,
2409 pub shield_ref: String,
2410 #[serde(skip_serializing_if = "String::is_empty")]
2417 pub egress_sign: String,
2418}
2419
2420#[derive(Debug, Clone, Serialize)]
2425pub struct IRSocket {
2426 pub node_type: &'static str,
2427 pub source_line: u32,
2428 pub source_column: u32,
2429 pub name: String,
2430 pub protocol: String,
2431 pub backpressure_credit: Option<i64>,
2432 pub reconnect: bool,
2433 pub legal_basis: Option<String>,
2434}
2435
2436#[derive(Debug, Clone, Serialize)]
2442pub struct IRUpstream {
2443 pub node_type: &'static str,
2444 pub source_line: u32,
2445 pub source_column: u32,
2446 pub name: String,
2447 pub transport: String,
2448 pub protocol: String,
2449 pub role: String,
2450 pub resolve: String,
2451 pub secret: String,
2452 pub auth_kind: String,
2453 #[serde(default, skip_serializing_if = "Option::is_none")]
2454 pub auth_name: Option<String>,
2455 #[serde(default, skip_serializing_if = "Option::is_none")]
2456 pub auth_prefix: Option<String>,
2457 pub map: Vec<IRUpstreamMapRule>,
2458 #[serde(default, skip_serializing_if = "Option::is_none")]
2459 pub reconnect: Option<IRUpstreamReconnect>,
2460 #[serde(default, skip_serializing_if = "Option::is_none")]
2461 pub overflow: Option<String>,
2462 #[serde(default, skip_serializing_if = "Option::is_none")]
2463 pub backpressure_credit: Option<i64>,
2464 #[serde(default, skip_serializing_if = "Option::is_none")]
2467 pub preset: Option<String>,
2468}
2469
2470#[derive(Debug, Clone, Serialize)]
2472pub struct IRUpstreamMapRule {
2473 pub node_type: &'static str,
2474 pub direction: String,
2475 pub message: String,
2476 pub framing: String,
2477 #[serde(default, skip_serializing_if = "Option::is_none")]
2478 pub tag: Option<String>,
2479 #[serde(default, skip_serializing_if = "Option::is_none")]
2480 pub when_field: Option<String>,
2481 #[serde(default, skip_serializing_if = "Option::is_none")]
2482 pub when_value: Option<String>,
2483}
2484
2485#[derive(Debug, Clone, Serialize)]
2488pub struct IRUpstreamReconnect {
2489 pub backoff_ms: i64,
2490 pub max_attempts: i64,
2491 pub on_exhausted: String,
2492}
2493
2494#[derive(Debug, Clone, Serialize)]
2502pub struct IRCors {
2503 pub node_type: &'static str,
2504 pub source_line: u32,
2505 pub source_column: u32,
2506 pub name: String,
2507 pub allow_origins: Vec<String>,
2508 pub allow_methods: Vec<String>,
2509 pub allow_headers: Vec<String>,
2510 pub allow_credentials: bool,
2511 #[serde(default, skip_serializing_if = "Option::is_none")]
2515 pub max_age: Option<String>,
2516 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2517 pub expose_headers: Vec<String>,
2518}
2519
2520#[derive(Debug, Clone, Serialize)]
2527pub struct IRCache {
2528 pub node_type: &'static str,
2529 pub source_line: u32,
2530 pub source_column: u32,
2531 pub name: String,
2532 #[serde(default, skip_serializing_if = "String::is_empty")]
2534 pub backend: String,
2535 #[serde(default, skip_serializing_if = "Option::is_none")]
2538 pub ttl: Option<String>,
2539 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2541 pub key_params: Vec<String>,
2542 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2544 pub default_policy: bool,
2545 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2547 pub apply_to_effects: Vec<String>,
2548 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2550 pub invalidate_on: Vec<String>,
2551}
2552
2553#[derive(Debug, Clone, Serialize)]
2559pub struct IREmit {
2560 pub node_type: &'static str,
2561 pub source_line: u32,
2562 pub source_column: u32,
2563 pub channel_ref: String,
2564 pub value_ref: String,
2565 pub value_is_channel: bool,
2566}
2567
2568#[derive(Debug, Clone, Serialize)]
2573pub struct IRCredential {
2574 pub node_type: &'static str,
2575 pub source_line: u32,
2576 pub source_column: u32,
2577 pub name: String,
2578 pub ttl_secs: u64,
2581 pub grants: Vec<String>,
2584}
2585
2586#[derive(Debug, Clone, Serialize)]
2591pub struct IRMintStep {
2592 pub node_type: &'static str,
2593 pub source_line: u32,
2594 pub source_column: u32,
2595 pub credential_ref: String,
2596 pub binding: String,
2597}
2598
2599#[derive(Debug, Clone, Serialize)]
2607pub struct IRRotateStep {
2608 pub node_type: &'static str,
2609 pub source_line: u32,
2610 pub source_column: u32,
2611 pub store_ref: String,
2612 #[serde(default, skip_serializing_if = "String::is_empty")]
2614 pub where_expr: String,
2615 pub tool_ref: String,
2616 pub binding: String,
2617}
2618
2619#[derive(Debug, Clone, Serialize)]
2621pub struct IRPublish {
2622 pub node_type: &'static str,
2623 pub source_line: u32,
2624 pub source_column: u32,
2625 pub channel_ref: String,
2626 pub shield_ref: String,
2627 #[serde(skip_serializing_if = "String::is_empty")]
2633 pub sign: String,
2634}
2635
2636#[derive(Debug, Clone, Serialize)]
2638pub struct IRDiscover {
2639 pub node_type: &'static str,
2640 pub source_line: u32,
2641 pub source_column: u32,
2642 pub capability_ref: String,
2643 pub alias: String,
2644}