1use chrono::Utc;
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4use uuid::Uuid;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
7pub struct GoalId(pub Uuid);
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
10pub struct DecisionId(pub Uuid);
11
12#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
13pub struct CommitmentId(pub Uuid);
14
15#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
16pub struct DreamId(pub Uuid);
17
18#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
19pub struct FederationId(pub Uuid);
20
21#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
22pub struct StakeholderId(pub Uuid);
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
25pub struct PathId(pub Uuid);
26
27#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
28pub struct Timestamp(pub i64);
29
30impl Timestamp {
31 pub fn now() -> Self {
32 Self(Utc::now().timestamp_nanos_opt().unwrap_or(0))
33 }
34
35 pub fn from_nanos(nanos: i64) -> Self {
36 Self(nanos)
37 }
38
39 pub fn as_nanos(&self) -> i64 {
40 self.0
41 }
42
43 pub fn days_from_now(days: f64) -> Self {
44 Self(Self::now().0 + (days * 86_400.0 * 1e9) as i64)
45 }
46}
47
48#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
49pub enum GoalStatus {
50 Draft,
51 Active,
52 Blocked,
53 Paused,
54 Completed,
55 Abandoned,
56 Superseded,
57 Reborn,
58}
59
60#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
61pub enum Priority {
62 Critical,
63 High,
64 Medium,
65 Low,
66 Someday,
67}
68
69#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
70pub enum DecisionStatus {
71 Pending,
72 Deliberating,
73 Crystallized,
74 Regretted,
75 Recrystallized,
76}
77
78#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
79pub enum CommitmentStatus {
80 Active,
81 AtRisk,
82 Renegotiating,
83 Fulfilled,
84 Broken,
85 Released,
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
89pub enum GoalRelationship {
90 ParentChild {
91 parent: GoalId,
92 child: GoalId,
93 },
94 Dependency {
95 dependent: GoalId,
96 on: GoalId,
97 strength: f64,
98 },
99 Alliance {
100 goals: (GoalId, GoalId),
101 synergy: f64,
102 },
103 Rivalry {
104 goals: (GoalId, GoalId),
105 contested: Vec<String>,
106 },
107 Romance {
108 goals: (GoalId, GoalId),
109 emergent_value: String,
110 },
111 Nemesis {
112 goals: (GoalId, GoalId),
113 reason: String,
114 },
115 Successor {
116 predecessor: GoalId,
117 successor: GoalId,
118 },
119}
120
121#[derive(Debug, Clone, Serialize, Deserialize)]
122pub enum BlockerType {
123 ResourceUnavailable { resource: String },
124 DependencyBlocked { goal: GoalId },
125 DeadlineMiss { deadline: Timestamp },
126 ExternalEvent { event: String },
127 SkillGap { skill: String },
128 ApprovalPending { approver: StakeholderId },
129 TechnicalDebt { description: String },
130 Unknown { signals: Vec<String> },
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
134pub enum CausalityType {
135 Enables,
136 Constrains,
137 Suggests,
138 Requires,
139 Precludes,
140}
141
142#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
143pub enum EntanglementType {
144 Sequential,
145 Parallel,
146 Inverse,
147 Resonant,
148 Dependent,
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
152pub struct Goal {
153 pub id: GoalId,
154 pub title: String,
155 pub description: String,
156 pub soul: GoalSoul,
157 pub status: GoalStatus,
158 pub created_at: Timestamp,
159 pub activated_at: Option<Timestamp>,
160 pub completed_at: Option<Timestamp>,
161 pub deadline: Option<Timestamp>,
162 pub parent: Option<GoalId>,
163 pub children: Vec<GoalId>,
164 pub dependencies: Vec<GoalId>,
165 pub dependents: Vec<GoalId>,
166 pub relationships: Vec<GoalRelationship>,
167 pub priority: Priority,
168 pub progress: Progress,
169 pub feelings: GoalFeelings,
170 pub physics: GoalPhysics,
171 pub blockers: Vec<Blocker>,
172 pub decisions: Vec<DecisionId>,
173 pub commitments: Vec<CommitmentId>,
174 pub dreams: Vec<DreamId>,
175 pub tags: Vec<String>,
176 pub metadata: HashMap<String, serde_json::Value>,
177 pub provenance: GoalProvenance,
178 pub metamorphosis: Option<GoalMetamorphosis>,
179 pub previous_life: Option<PreviousLife>,
180}
181
182#[derive(Debug, Clone, Serialize, Deserialize)]
183pub struct GoalSoul {
184 pub intention: String,
185 pub significance: String,
186 pub success_criteria: Vec<SuccessCriterion>,
187 pub emotional_weight: f64,
188 pub values: Vec<String>,
189}
190
191#[derive(Debug, Clone, Serialize, Deserialize)]
192pub struct SuccessCriterion {
193 pub id: Uuid,
194 pub description: String,
195 pub measurable: bool,
196 pub metric: Option<String>,
197 pub target: Option<f64>,
198 pub achieved: bool,
199 pub achieved_at: Option<Timestamp>,
200}
201
202#[derive(Debug, Clone, Serialize, Deserialize)]
203pub struct Progress {
204 pub percentage: f64,
205 pub history: Vec<ProgressPoint>,
206 pub velocity: f64,
207 pub eta: Option<Timestamp>,
208}
209
210impl Progress {
211 pub fn new() -> Self {
212 Self {
213 percentage: 0.0,
214 history: Vec::new(),
215 velocity: 0.0,
216 eta: None,
217 }
218 }
219}
220
221impl Default for Progress {
222 fn default() -> Self {
223 Self::new()
224 }
225}
226
227#[derive(Debug, Clone, Serialize, Deserialize)]
228pub struct ProgressPoint {
229 pub timestamp: Timestamp,
230 pub percentage: f64,
231 pub note: Option<String>,
232}
233
234#[derive(Debug, Clone, Serialize, Deserialize)]
235pub struct GoalFeelings {
236 pub urgency: f64,
237 pub neglect: f64,
238 pub confidence: f64,
239 pub alignment: f64,
240 pub vitality: f64,
241 pub last_calculated: Timestamp,
242}
243
244#[derive(Debug, Clone, Serialize, Deserialize)]
245pub struct GoalPhysics {
246 pub momentum: f64,
247 pub gravity: f64,
248 pub inertia: f64,
249 pub energy: f64,
250 pub last_calculated: Timestamp,
251}
252
253#[derive(Debug, Clone, Serialize, Deserialize)]
254pub struct Blocker {
255 pub id: Uuid,
256 pub blocker_type: BlockerType,
257 pub description: String,
258 pub severity: f64,
259 pub identified_at: Timestamp,
260 pub resolved_at: Option<Timestamp>,
261 pub resolution: Option<String>,
262}
263
264#[derive(Debug, Clone, Serialize, Deserialize)]
265pub struct GoalProvenance {
266 pub origin: ProvenanceOrigin,
267 pub user_request: Option<String>,
268 pub session_id: Option<String>,
269 pub creation_context: HashMap<String, String>,
270}
271
272#[derive(Debug, Clone, Serialize, Deserialize)]
273pub enum ProvenanceOrigin {
274 UserRequest,
275 Decomposition { parent: GoalId },
276 Reincarnation { previous: GoalId },
277 Dream { dream: DreamId },
278 Federation { federation: FederationId },
279 System,
280}
281
282#[derive(Debug, Clone, Serialize, Deserialize)]
283pub struct GoalMetamorphosis {
284 pub stages: Vec<MetamorphicStage>,
285 pub current_stage: usize,
286 pub invariant_soul: GoalSoul,
287}
288
289#[derive(Debug, Clone, Serialize, Deserialize)]
290pub struct MetamorphosisSignal {
291 pub goal_id: GoalId,
292 pub should_transform: bool,
293 pub reason: String,
294 pub recommended_change: ScopeChange,
295}
296
297#[derive(Debug, Clone, Serialize, Deserialize)]
298pub struct MetamorphosisPrediction {
299 pub goal_id: GoalId,
300 pub confidence: f64,
301 pub next_change: ScopeChange,
302 pub rationale: String,
303}
304
305#[derive(Debug, Clone, Serialize, Deserialize)]
306pub struct MetamorphicStage {
307 pub stage_number: usize,
308 pub title: String,
309 pub description: String,
310 pub entered_at: Timestamp,
311 pub scope_change: ScopeChange,
312}
313
314#[derive(Debug, Clone, Serialize, Deserialize)]
315pub enum ScopeChange {
316 Expansion {
317 factor: f64,
318 reason: String,
319 },
320 Contraction {
321 factor: f64,
322 reason: String,
323 },
324 Pivot {
325 new_direction: String,
326 reason: String,
327 },
328 Refinement {
329 clarification: String,
330 },
331}
332
333#[derive(Debug, Clone, Serialize, Deserialize)]
334pub struct PreviousLife {
335 pub original_id: GoalId,
336 pub death_cause: String,
337 pub lessons_learned: Vec<String>,
338 pub karma: GoalKarma,
339}
340
341#[derive(Debug, Clone, Serialize, Deserialize)]
342pub struct GoalKarma {
343 pub failures: Vec<String>,
344 pub near_successes: Vec<String>,
345 pub requirements_for_success: Vec<String>,
346 pub invested_energy: f64,
347}
348
349#[derive(Debug, Clone, Serialize, Deserialize)]
350pub struct Decision {
351 pub id: DecisionId,
352 pub question: DecisionQuestion,
353 pub status: DecisionStatus,
354 pub crystallized_at: Option<Timestamp>,
355 pub chosen: Option<DecisionPath>,
356 pub shadows: Vec<CrystalShadow>,
357 pub reasoning: DecisionReasoning,
358 pub decider: Decider,
359 pub affected_goals: Vec<GoalId>,
360 pub caused_by: Option<DecisionId>,
361 pub causes: Vec<DecisionId>,
362 pub reversibility: Reversibility,
363 pub consequences: Vec<Consequence>,
364 pub regret_score: f64,
365 pub regret_updated_at: Option<Timestamp>,
366}
367
368#[derive(Debug, Clone, Serialize, Deserialize)]
369pub struct DecisionQuestion {
370 pub question: String,
371 pub context: String,
372 pub constraints: Vec<String>,
373 pub asked_at: Timestamp,
374}
375
376#[derive(Debug, Clone, Serialize, Deserialize)]
377pub struct DecisionPath {
378 pub id: PathId,
379 pub name: String,
380 pub description: String,
381 pub pros: Vec<String>,
382 pub cons: Vec<String>,
383 pub estimated_effort: Option<f64>,
384 pub estimated_risk: Option<f64>,
385}
386
387impl Default for DecisionPath {
388 fn default() -> Self {
389 Self {
390 id: PathId(Uuid::new_v4()),
391 name: String::new(),
392 description: String::new(),
393 pros: Vec::new(),
394 cons: Vec::new(),
395 estimated_effort: None,
396 estimated_risk: None,
397 }
398 }
399}
400
401#[derive(Debug, Clone, Serialize, Deserialize)]
402pub struct CrystalShadow {
403 pub path: DecisionPath,
404 pub rejection_reason: String,
405 pub counterfactual: Option<CounterfactualProjection>,
406 pub resurrection_cost: f64,
407}
408
409#[derive(Debug, Clone, Serialize, Deserialize)]
410pub struct CounterfactualProjection {
411 pub projected_at: Timestamp,
412 pub timeline: Vec<ProjectedEvent>,
413 pub final_state: String,
414 pub confidence: f64,
415}
416
417#[derive(Debug, Clone, Serialize, Deserialize)]
418pub struct ProjectedEvent {
419 pub time_offset_days: f64,
420 pub event: String,
421 pub probability: f64,
422 pub impact: String,
423}
424
425#[derive(Debug, Clone, Serialize, Deserialize)]
426pub struct DecisionReasoning {
427 pub rationale: String,
428 pub factors_considered: Vec<String>,
429 pub weights: HashMap<String, f64>,
430 pub confidence: f64,
431}
432
433impl Default for DecisionReasoning {
434 fn default() -> Self {
435 Self {
436 rationale: String::new(),
437 factors_considered: Vec::new(),
438 weights: HashMap::new(),
439 confidence: 0.5,
440 }
441 }
442}
443
444#[derive(Debug, Clone, Serialize, Deserialize)]
445pub enum Decider {
446 User {
447 name: Option<String>,
448 },
449 Agent {
450 agent_id: String,
451 },
452 Consensus {
453 participants: Vec<StakeholderId>,
454 },
455 Delegation {
456 from: StakeholderId,
457 to: StakeholderId,
458 },
459}
460
461#[derive(Debug, Clone, Serialize, Deserialize)]
462pub struct Reversibility {
463 pub is_reversible: bool,
464 pub reversal_cost: f64,
465 pub reversal_window: Option<Timestamp>,
466 pub cascade_count: usize,
467}
468
469impl Default for Reversibility {
470 fn default() -> Self {
471 Self {
472 is_reversible: true,
473 reversal_cost: 0.2,
474 reversal_window: None,
475 cascade_count: 0,
476 }
477 }
478}
479
480#[derive(Debug, Clone, Serialize, Deserialize)]
481pub struct Consequence {
482 pub observed_at: Timestamp,
483 pub description: String,
484 pub was_predicted: bool,
485 pub impact: Impact,
486}
487
488#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
489pub enum Impact {
490 Positive,
491 Negative,
492 Neutral,
493 Mixed,
494}
495
496#[derive(Debug, Clone, Serialize, Deserialize)]
497pub struct Commitment {
498 pub id: CommitmentId,
499 pub promise: Promise,
500 pub made_to: Stakeholder,
501 pub made_at: Timestamp,
502 pub due: Option<Timestamp>,
503 pub status: CommitmentStatus,
504 pub weight: f64,
505 pub inertia: f64,
506 pub breaking_cost: BreakingCost,
507 pub goal: Option<GoalId>,
508 pub entanglements: Vec<CommitmentEntanglement>,
509 pub fulfillment: Option<CommitmentFulfillment>,
510 pub renegotiations: Vec<Renegotiation>,
511}
512
513#[derive(Debug, Clone, Default, Serialize, Deserialize)]
514pub struct Promise {
515 pub description: String,
516 pub deliverables: Vec<String>,
517 pub conditions: Vec<String>,
518}
519
520#[derive(Debug, Clone, Serialize, Deserialize)]
521pub struct Stakeholder {
522 pub id: StakeholderId,
523 pub name: String,
524 pub role: String,
525 pub importance: f64,
526}
527
528impl Default for Stakeholder {
529 fn default() -> Self {
530 Self {
531 id: StakeholderId(Uuid::new_v4()),
532 name: String::new(),
533 role: "stakeholder".to_string(),
534 importance: 0.5,
535 }
536 }
537}
538
539#[derive(Debug, Clone, Serialize, Deserialize)]
540pub struct BreakingCost {
541 pub trust_damage: f64,
542 pub relationship_impact: f64,
543 pub reputation_cost: f64,
544 pub energy_to_break: f64,
545 pub cascading_effects: Vec<String>,
546}
547
548#[derive(Debug, Clone, Serialize, Deserialize)]
549pub struct CommitmentEntanglement {
550 pub with: CommitmentId,
551 pub entanglement_type: EntanglementType,
552 pub strength: f64,
553}
554
555#[derive(Debug, Clone, Serialize, Deserialize)]
556pub struct CommitmentFulfillment {
557 pub fulfilled_at: Timestamp,
558 pub how_delivered: String,
559 pub energy_released: f64,
560 pub trust_gained: f64,
561}
562
563#[derive(Debug, Clone, Serialize, Deserialize)]
564pub struct Renegotiation {
565 pub renegotiated_at: Timestamp,
566 pub original: Promise,
567 pub new: Promise,
568 pub reason: String,
569 pub accepted: bool,
570 pub trust_impact: f64,
571}
572
573#[derive(Debug, Clone, Serialize, Deserialize)]
574pub struct Dream {
575 pub id: DreamId,
576 pub goal_id: GoalId,
577 pub dreamt_at: Timestamp,
578 pub scenario: CompletionScenario,
579 pub obstacles: Vec<DreamObstacle>,
580 pub insights: Vec<DreamInsight>,
581 pub discovered_goals: Vec<GoalSeed>,
582 pub confidence: f64,
583 pub accuracy: Option<DreamAccuracy>,
584}
585
586#[derive(Debug, Clone, Serialize, Deserialize)]
587pub struct CompletionScenario {
588 pub vision: String,
589 pub feeling: String,
590 pub world_changes: Vec<String>,
591 pub stakeholder_reactions: HashMap<String, String>,
592}
593
594#[derive(Debug, Clone, Serialize, Deserialize)]
595pub struct DreamObstacle {
596 pub description: String,
597 pub severity: f64,
598 pub timing: String,
599 pub mitigation: Option<String>,
600}
601
602#[derive(Debug, Clone, Serialize, Deserialize)]
603pub struct DreamInsight {
604 pub insight: String,
605 pub actionable: bool,
606 pub action: Option<String>,
607}
608
609#[derive(Debug, Clone, Serialize, Deserialize)]
610pub struct GoalSeed {
611 pub title: String,
612 pub description: String,
613 pub parent: GoalId,
614 pub reason: String,
615}
616
617#[derive(Debug, Clone, Serialize, Deserialize)]
618pub struct DreamAccuracy {
619 pub assessed_at: Timestamp,
620 pub accuracy_score: f64,
621 pub correct_predictions: Vec<String>,
622 pub incorrect_predictions: Vec<String>,
623}
624
625#[derive(Debug, Clone, Serialize, Deserialize)]
626pub struct Federation {
627 pub id: FederationId,
628 pub goal_id: GoalId,
629 pub created_at: Timestamp,
630 pub members: Vec<FederationMember>,
631 pub coordinator: Option<String>,
632 pub last_sync: Timestamp,
633 pub sync_status: SyncStatus,
634 pub collective_dreams: Vec<CollectiveDream>,
635}
636
637#[derive(Debug, Clone, Serialize, Deserialize)]
638pub struct FederationMember {
639 pub agent_id: String,
640 pub joined_at: Timestamp,
641 pub owned_goals: Vec<GoalId>,
642 pub progress: f64,
643 pub status: MemberStatus,
644 pub last_active: Timestamp,
645}
646
647#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
648pub enum MemberStatus {
649 Active,
650 Inactive,
651 Blocked,
652 Left,
653}
654
655#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
656pub enum SyncStatus {
657 Synced,
658 Pending,
659 Conflict,
660 Error,
661}
662
663#[derive(Debug, Clone, Serialize, Deserialize)]
664pub struct CollectiveDream {
665 pub id: DreamId,
666 pub participants: Vec<String>,
667 pub individual_dreams: HashMap<String, Dream>,
668 pub synthesis: DreamSynthesis,
669 pub coherence_score: f64,
670}
671
672#[derive(Debug, Clone, Serialize, Deserialize)]
673pub struct DreamSynthesis {
674 pub unified_vision: String,
675 pub themes: Vec<String>,
676 pub conflicts: Vec<String>,
677 pub resolutions: Vec<String>,
678 pub emergent_goals: Vec<GoalSeed>,
679}
680
681#[derive(Debug, Clone, Serialize, Deserialize)]
682pub struct GoalTree {
683 pub root: GoalId,
684 pub nodes: HashMap<GoalId, GoalTreeNode>,
685 pub edges: Vec<(GoalId, GoalId)>,
686}
687
688#[derive(Debug, Clone, Serialize, Deserialize)]
689pub struct GoalTreeNode {
690 pub goal: Goal,
691 pub depth: usize,
692}
693
694#[derive(Debug, Clone, Serialize, Deserialize)]
695pub struct IntentionSingularity {
696 pub unified_vision: String,
697 pub goal_positions: HashMap<GoalId, IntentionPosition>,
698 pub themes: Vec<String>,
699 pub tension_lines: Vec<TensionLine>,
700 pub golden_path: Vec<GoalId>,
701 pub center: IntentionCenter,
702}
703
704impl Default for IntentionSingularity {
705 fn default() -> Self {
706 Self {
707 unified_vision: String::new(),
708 goal_positions: HashMap::new(),
709 themes: Vec::new(),
710 tension_lines: Vec::new(),
711 golden_path: Vec::new(),
712 center: IntentionCenter {
713 urgency: 0.0,
714 confidence: 0.0,
715 momentum: 0.0,
716 },
717 }
718 }
719}
720
721#[derive(Debug, Clone, Serialize, Deserialize)]
722pub struct IntentionPosition {
723 pub goal_id: GoalId,
724 pub centrality: f64,
725 pub alignment_angle: f64,
726 pub gravitational_pull: f64,
727 pub drift_risk: f64,
728}
729
730#[derive(Debug, Clone, Serialize, Deserialize)]
731pub struct IntentionCenter {
732 pub urgency: f64,
733 pub confidence: f64,
734 pub momentum: f64,
735}
736
737#[derive(Debug, Clone, Serialize, Deserialize)]
738pub struct TensionLine {
739 pub a: GoalId,
740 pub b: GoalId,
741 pub magnitude: f64,
742 pub reason: String,
743}
744
745#[derive(Debug, Clone, Serialize, Deserialize)]
746pub struct DecisionChain {
747 pub root: DecisionId,
748 pub descendants: Vec<DecisionId>,
749 pub causality: Vec<CausalLink>,
750 pub cascade_analysis: CascadeAnalysis,
751}
752
753#[derive(Debug, Clone, Serialize, Deserialize)]
754pub struct CausalLink {
755 pub from: DecisionId,
756 pub to: DecisionId,
757 pub causality_type: CausalityType,
758 pub strength: f64,
759}
760
761#[derive(Debug, Clone, Default, Serialize, Deserialize)]
762pub struct CascadeAnalysis {
763 pub total_nodes: usize,
764 pub max_depth: usize,
765}
766
767#[derive(Debug, Clone, Serialize, Deserialize)]
768pub struct DecisionArchaeology {
769 pub artifact: String,
770 pub strata: Vec<ArchaeologicalStratum>,
771 pub cumulative_impact: String,
772 pub insights: Vec<String>,
773}
774
775#[derive(Debug, Clone, Serialize, Deserialize)]
776pub struct ArchaeologicalStratum {
777 pub depth: usize,
778 pub decision: DecisionId,
779 pub age: String,
780 pub impact_on_artifact: String,
781 pub context_at_time: String,
782 pub was_reasonable: bool,
783 pub modern_assessment: String,
784}
785
786#[derive(Debug, Clone, Serialize, Deserialize)]
787pub struct BlockerProphecy {
788 pub goal_id: GoalId,
789 pub predicted_blocker: Blocker,
790 pub prediction_confidence: f64,
791 pub days_until_materialization: f64,
792 pub evidence: Vec<String>,
793 pub recommended_actions: Vec<String>,
794}
795
796#[derive(Debug, Clone, Serialize, Deserialize)]
797pub struct ProgressEcho {
798 pub goal_id: GoalId,
799 pub source_milestone: Milestone,
800 pub echo_strength: f64,
801 pub estimated_arrival_secs: u64,
802 pub carried_information: Vec<String>,
803 pub confidence: f64,
804}
805
806#[derive(Debug, Clone, Serialize, Deserialize)]
807pub struct Milestone {
808 pub name: String,
809 pub description: String,
810}
811
812#[derive(Debug, Clone, Serialize, Deserialize)]
813pub struct DecisionProphecy {
814 pub question: DecisionQuestion,
815 pub paths: Vec<ProphecyPath>,
816 pub confidence: f64,
817 pub sources: Vec<String>,
818 pub warnings: Vec<String>,
819}
820
821#[derive(Debug, Clone, Serialize, Deserialize)]
822pub struct ProphecyPath {
823 pub path: DecisionPath,
824 pub timeline: Vec<ProjectedEvent>,
825 pub final_state: String,
826 pub risk_profile: String,
827 pub opportunity_profile: String,
828}
829
830#[derive(Debug, Clone, Serialize, Deserialize)]
831pub struct CommitmentInventory {
832 pub total_count: usize,
833 pub active_count: usize,
834 pub total_weight: f64,
835 pub sustainable_weight: f64,
836 pub is_overloaded: bool,
837 pub by_stakeholder: HashMap<String, usize>,
838}
839
840#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
841pub enum UrgentItemType {
842 Goal,
843 Commitment,
844 Decision,
845}
846
847#[derive(Debug, Clone, Serialize, Deserialize)]
848pub struct UrgentItem {
849 pub item_type: UrgentItemType,
850 pub id: Uuid,
851 pub deadline: Timestamp,
852 pub urgency: f64,
853}
854
855#[derive(Debug, Clone, Serialize, Deserialize)]
856pub struct GoalSoulArchive {
857 pub original_id: GoalId,
858 pub soul: GoalSoul,
859 pub death_record: GoalDeath,
860 pub karma: GoalKarma,
861 pub reincarnation_potential: f64,
862 pub trigger_conditions: Vec<String>,
863}
864
865#[derive(Debug, Clone, Serialize, Deserialize)]
866pub struct GoalDeath {
867 pub cause: String,
868 pub timestamp: Timestamp,
869}
870
871#[derive(Debug, Clone, Default, Serialize, Deserialize)]
872pub struct MergeReport {
873 pub goals_merged: usize,
874 pub decisions_merged: usize,
875 pub commitments_merged: usize,
876 pub dreams_merged: usize,
877 pub federations_merged: usize,
878 pub souls_merged: usize,
879}
880
881#[derive(Debug, Clone, Default)]
882pub struct GoalFilter {
883 pub status: Option<Vec<GoalStatus>>,
884 pub priority: Option<Vec<Priority>>,
885 pub parent: Option<GoalId>,
886 pub has_deadline: Option<bool>,
887 pub deadline_before: Option<Timestamp>,
888 pub deadline_after: Option<Timestamp>,
889 pub tags: Option<Vec<String>>,
890 pub created_after: Option<Timestamp>,
891 pub min_progress: Option<f64>,
892 pub max_progress: Option<f64>,
893 pub min_momentum: Option<f64>,
894 pub limit: Option<usize>,
895}
896
897#[derive(Debug, Clone, Default)]
898pub struct ReincarnationUpdates {
899 pub title: Option<String>,
900 pub description: Option<String>,
901 pub lessons_learned: Option<Vec<String>>,
902}
903
904#[derive(Debug, Clone, Default)]
905pub struct CreateGoalRequest {
906 pub title: String,
907 pub description: String,
908 pub intention: String,
909 pub significance: Option<String>,
910 pub success_criteria: Option<Vec<SuccessCriterion>>,
911 pub emotional_weight: Option<f64>,
912 pub values: Option<Vec<String>>,
913 pub priority: Option<Priority>,
914 pub deadline: Option<Timestamp>,
915 pub parent: Option<GoalId>,
916 pub dependencies: Option<Vec<GoalId>>,
917 pub tags: Option<Vec<String>>,
918 pub metadata: Option<HashMap<String, serde_json::Value>>,
919 pub origin: Option<ProvenanceOrigin>,
920 pub user_request: Option<String>,
921 pub session_id: Option<String>,
922 pub context: Option<HashMap<String, String>>,
923}
924
925#[derive(Debug, Clone, Default)]
926pub struct CreateDecisionRequest {
927 pub question: String,
928 pub context: Option<String>,
929 pub constraints: Option<Vec<String>>,
930 pub goals: Option<Vec<GoalId>>,
931 pub caused_by: Option<DecisionId>,
932 pub decider: Option<Decider>,
933}
934
935#[derive(Debug, Clone, Default)]
936pub struct CreateCommitmentRequest {
937 pub promise: Promise,
938 pub stakeholder: Stakeholder,
939 pub due: Option<Timestamp>,
940 pub goal: Option<GoalId>,
941}
942
943#[derive(Debug, Clone, Default)]
944pub struct UpdateGoalRequest {
945 pub title: Option<String>,
946 pub description: Option<String>,
947 pub deadline: Option<Option<Timestamp>>,
948 pub priority: Option<Priority>,
949 pub tags: Option<Vec<String>>,
950 pub metadata: Option<HashMap<String, serde_json::Value>>,
951 pub intention: Option<String>,
952 pub significance: Option<String>,
953 pub emotional_weight: Option<f64>,
954}
955
956#[derive(Debug, Clone, Default)]
957pub struct UpdateCommitmentRequest {
958 pub promise: Option<Promise>,
959 pub due: Option<Option<Timestamp>>,
960 pub goal: Option<Option<GoalId>>,
961}
962
963#[derive(Debug, Clone, Serialize, Deserialize)]
964pub struct ProgressForecast {
965 pub goal_id: GoalId,
966 pub current_percentage: f64,
967 pub current_velocity: f64,
968 pub projected_milestones: Vec<ForecastMilestone>,
969 pub estimated_completion: Option<Timestamp>,
970 pub confidence: f64,
971 pub risk_factors: Vec<String>,
972}
973
974#[derive(Debug, Clone, Serialize, Deserialize)]
975pub struct ForecastMilestone {
976 pub percentage: f64,
977 pub estimated_at: Timestamp,
978 pub confidence: f64,
979}
980
981#[derive(Debug, Clone, Serialize, Deserialize)]
982pub struct MomentumReport {
983 pub total_goals: usize,
984 pub average_momentum: f64,
985 pub momentum_distribution: MomentumDistribution,
986 pub top_momentum: Vec<GoalMomentumEntry>,
987 pub stalled: Vec<GoalMomentumEntry>,
988 pub accelerating: Vec<GoalMomentumEntry>,
989 pub decelerating: Vec<GoalMomentumEntry>,
990}
991
992#[derive(Debug, Clone, Serialize, Deserialize)]
993pub struct MomentumDistribution {
994 pub high: usize,
995 pub medium: usize,
996 pub low: usize,
997 pub zero: usize,
998}
999
1000#[derive(Debug, Clone, Serialize, Deserialize)]
1001pub struct GoalMomentumEntry {
1002 pub goal_id: GoalId,
1003 pub title: String,
1004 pub momentum: f64,
1005 pub velocity: f64,
1006 pub progress: f64,
1007}
1008
1009#[derive(Debug, Clone, Serialize, Deserialize)]
1010pub struct GravityField {
1011 pub total_goals: usize,
1012 pub field_center: GravityCenter,
1013 pub wells: Vec<GravityWell>,
1014 pub total_pull: f64,
1015 pub dominant_attractor: Option<GoalId>,
1016}
1017
1018#[derive(Debug, Clone, Serialize, Deserialize)]
1019pub struct GravityCenter {
1020 pub weighted_urgency: f64,
1021 pub weighted_priority: f64,
1022 pub weighted_momentum: f64,
1023}
1024
1025#[derive(Debug, Clone, Serialize, Deserialize)]
1026pub struct GravityWell {
1027 pub goal_id: GoalId,
1028 pub title: String,
1029 pub gravity: f64,
1030 pub pull_radius: f64,
1031 pub captured_goals: Vec<GoalId>,
1032}
1033
1034#[derive(Debug, Clone, Serialize, Deserialize)]
1035pub struct FederationHealthEntry {
1036 pub federation_id: FederationId,
1037 pub goal_id: GoalId,
1038 pub member_count: usize,
1039 pub sync_age_hours: f64,
1040 pub issues: Vec<String>,
1041}
1042
1043#[derive(Debug, Clone, Serialize, Deserialize)]
1044pub struct GoalHealthReport {
1045 pub total_active: usize,
1046 pub total_blocked: usize,
1047 pub stalled: Vec<GoalId>,
1048 pub neglected: Vec<GoalId>,
1049 pub deadline_risk: Vec<GoalId>,
1050 pub blocked: Vec<GoalId>,
1051 pub thriving: Vec<GoalId>,
1052}
1053
1054#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1059pub enum ConsensusStatus {
1060 Open,
1061 Deliberating,
1062 Synthesizing,
1063 Voting,
1064 Crystallized,
1065 Deadlocked,
1066}
1067
1068#[derive(Debug, Clone, Serialize, Deserialize)]
1069pub struct DecisionConsensus {
1070 pub decision_id: DecisionId,
1071 pub stakeholders: Vec<ConsensusParticipant>,
1072 pub deliberation: Vec<DeliberationRound>,
1073 pub synthesis: Option<Synthesis>,
1074 pub votes: HashMap<StakeholderId, String>,
1075 pub alignment_score: f64,
1076 pub status: ConsensusStatus,
1077 pub started_at: Timestamp,
1078 pub crystallized_at: Option<Timestamp>,
1079}
1080
1081#[derive(Debug, Clone, Serialize, Deserialize)]
1082pub struct ConsensusParticipant {
1083 pub id: StakeholderId,
1084 pub role: String,
1085 pub initial_position: String,
1086 pub concerns: Vec<String>,
1087 pub requirements: Vec<String>,
1088 pub flexibility: f64,
1089}
1090
1091#[derive(Debug, Clone, Serialize, Deserialize)]
1092pub struct DeliberationRound {
1093 pub round_number: usize,
1094 pub statements: Vec<ConsensusStatement>,
1095 pub alignment_delta: f64,
1096 pub emerged_common_ground: Vec<CommonGround>,
1097 pub recorded_at: Timestamp,
1098}
1099
1100#[derive(Debug, Clone, Serialize, Deserialize)]
1101pub struct ConsensusStatement {
1102 pub stakeholder_id: StakeholderId,
1103 pub position: String,
1104 pub supporting_arguments: Vec<String>,
1105 pub concessions: Vec<String>,
1106}
1107
1108#[derive(Debug, Clone, Serialize, Deserialize)]
1109pub struct CommonGround {
1110 pub description: String,
1111 pub agreed_by: Vec<StakeholderId>,
1112 pub strength: f64,
1113}
1114
1115#[derive(Debug, Clone, Serialize, Deserialize)]
1116pub struct Synthesis {
1117 pub proposal: String,
1118 pub incorporates_from: Vec<StakeholderId>,
1119 pub addresses_concerns: Vec<String>,
1120 pub confidence: f64,
1121 pub proposed_at: Timestamp,
1122}