capability-example 0.1.0

A framework for managing skill tree growth and configuration using automated and manual strategies, ideal for AI-driven environments.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
// ---------------- [ File: capability-example/src/grower_example.rs ]
crate::ix!();

#[derive(
    Debug,
    Clone,
    PartialEq,
    Getters,
    Builder,
    Serialize,
    Deserialize,
    SaveLoad,
)]
#[builder(pattern = "owned", setter(into))]
#[getset(get = "pub")]
pub struct GrowerModel {
    grower_inputs:                         GrowerInputs,

    #[serde(alias="maybe_ungrown_justified_grower_tree_configuration")]
    justified_grower_tree_configuration:   JustifiedGrowerTreeConfiguration,

    #[serde(alias="maybe_ungrown_justified_string_skeleton")]
    justified_string_skeleton:             JustifiedStringSkeleton,

    #[serde(alias="maybe_ungrown_stripped_string_skeleton")]
    stripped_string_skeleton:              StrippedStringSkeleton,

    #[serde(alias="maybe_ungrown_core_string_skeleton")]
    core_string_skeleton:                  CoreStringSkeleton,

    #[serde(alias="maybe_ungrown_annotated_leaf_holder_expansions")]
    annotated_leaf_holder_expansions:      AnnotatedLeafHolderExpansions,
}

impl GrowerModel {

    // we don't want to lose anything the AI generates for us so will need to handle partial file
    // persistence elegantly in case of any error
    //
    pub async fn new(
        seed:   PartiallyGrownModel,
        client: &GrowerLanguageModelClient,
    ) -> Result<Self,GrowerModelGenerationError> {

        seed.validate();
        let justified_grower_tree_configuration = seed.maybe_grow_justified_tree_configuration(client).await?;
        let justified_string_skeleton           = seed.maybe_grow_justified_string_skeleton(client).await?;
        let stripped_string_skeleton            = StrippedStringSkeleton::from(justified_string_skeleton.clone());
        let core_string_skeleton                = seed.maybe_grow_core_string_skeleton(client).await?;
        let annotated_leaf_holder_expansions    = seed.maybe_grow_annotated_leaf_holder_expansions(client).await?;

        Ok(Self {
            grower_inputs: seed.grower_inputs().clone().unwrap(),
            justified_grower_tree_configuration,
            justified_string_skeleton,
            stripped_string_skeleton,
            core_string_skeleton,
            annotated_leaf_holder_expansions,
        })
    }

    /// Finalize a fully valid partial model into a complete `GrowerModel` with no generation steps.
    /// Returns an error if the partial is not actually valid.
    #[instrument(level = "trace", skip_all)]
    pub fn finalize_from_valid_partial(
        partial: PartiallyGrownModel,
    ) -> Result<Self, GrowerModelGenerationError> {
        // Ensure it's really complete
        partial.validate().map_err(GrowerModelGenerationError::InvalidPartial)?;

        // Now just extract everything
        let grower_inputs = partial
            .grower_inputs()
            .clone()
            .expect("Validation guarantees grower_inputs is present");
        let justified_grower_tree_configuration = partial
            .maybe_ungrown_justified_grower_tree_configuration()
            .clone()
            .expect("Validation guarantees this is present");
        let justified_string_skeleton = partial
            .maybe_ungrown_justified_string_skeleton()
            .clone()
            .expect("Validation guarantees this is present");
        let stripped_string_skeleton = partial
            .maybe_ungrown_stripped_string_skeleton()
            .clone()
            .expect("Validation guarantees this is present");
        let core_string_skeleton = partial
            .maybe_ungrown_core_string_skeleton()
            .clone()
            .expect("Validation guarantees this is present");
        let annotated_leaf_holder_expansions = partial
            .maybe_ungrown_annotated_leaf_holder_expansions()
            .clone()
            .expect("Validation guarantees this is present");

        Ok(GrowerModel {
            grower_inputs,
            justified_grower_tree_configuration,
            justified_string_skeleton,
            stripped_string_skeleton,
            core_string_skeleton,
            annotated_leaf_holder_expansions,
        })
    }

    /// Displays the queries that each generation routine will execute, logging them via `tracing`.
    pub async fn show_all_generation_queries(&self) {
        trace!("Preparing to show all generation queries for GrowerModel");

        let query_cfg = Self::grower_tree_configuration_generation_query_string(
            self.grower_inputs(),
        );
        info!("GrowerTreeConfiguration query:\n{query_cfg}");

        let query_skel = Self::string_skeleton_generation_query_string(
            self.grower_inputs(),
            self.justified_grower_tree_configuration(),
        );
        info!("StringSkeleton query:\n{query_skel}");

        let query_core = Self::core_string_skeleton_generation_query_string(
            self.grower_inputs(),
            self.justified_grower_tree_configuration(),
            self.stripped_string_skeleton(),
        );
        info!("CoreStringSkeleton query:\n{query_core}");

        let query_leaf = Self::annotated_leaf_holder_expansions_generation_query_string(
            self.grower_inputs(),
            self.justified_grower_tree_configuration(),
            self.core_string_skeleton(),
        );
        info!("AnnotatedLeafHolderExpansions query:\n{query_leaf}");

        trace!("Done showing all generation queries for GrowerModel");
    }
}

impl PartiallyGrownModel {

    pub async fn maybe_grow_justified_tree_configuration(
        &self,
        client: &GrowerLanguageModelClient,
    ) -> Result<JustifiedGrowerTreeConfiguration, GrowerModelGenerationError> {
        trace!("maybe_grow_justified_tree_configuration called with partial: {:?}", self);
        match &self.maybe_ungrown_justified_grower_tree_configuration() {
            Some(cfg) => {
                debug!("maybe_ungrown_justified_grower_tree_configuration already present");
                Ok(cfg.clone())
            }
            None => {
                debug!("maybe_ungrown_justified_grower_tree_configuration not present, generating now");
                let generated = match GrowerModel::generate_grower_tree_configuration(
                    client, 
                    self.grower_inputs().as_ref().unwrap()
                ).await {
                    Ok(g) => g,
                    Err(e) => {
                        GrowerModel::handle_grower_tree_configuration_generation_error(
                            e,
                            client,
                            self.grower_inputs().as_ref().unwrap()
                        ).await?
                    }
                };
                Ok(generated)
            }
        }
    }

    pub async fn maybe_grow_justified_string_skeleton(
        &self,
        client: &GrowerLanguageModelClient,
    ) -> Result<JustifiedStringSkeleton, GrowerModelGenerationError> {
        trace!("maybe_grow_justified_string_skeleton called with partial: {:?}", self);
        match &self.maybe_ungrown_justified_string_skeleton() {
            Some(skel) => {
                debug!("maybe_ungrown_justified_string_skeleton already present");
                Ok(skel.clone())
            }
            None => {
                debug!("maybe_ungrown_justified_string_skeleton not present, generating now");
                let tree_conf = self
                    .maybe_ungrown_justified_grower_tree_configuration()
                    .as_ref()
                    .expect("Validation should have prevented missing JustifiedGrowerTreeConfiguration");

                let generated = match GrowerModel::generate_string_skeleton(
                    client,
                    self.grower_inputs().as_ref().unwrap(),
                    tree_conf
                ).await {
                    Ok(g) => g,
                    Err(e) => {
                        GrowerModel::handle_string_skeleton_generation_error(
                            e,
                            client,
                            self.grower_inputs().as_ref().unwrap(),
                            tree_conf
                        ).await?
                    }
                };
                Ok(generated)
            }
        }
    }

    pub async fn maybe_grow_core_string_skeleton(
        &self,
        client: &GrowerLanguageModelClient,
    ) -> Result<CoreStringSkeleton, GrowerModelGenerationError> {
        trace!("maybe_grow_core_string_skeleton called with partial: {:?}", self);
        match &self.maybe_ungrown_core_string_skeleton() {
            Some(exp) => {
                debug!("maybe_ungrown_core_string_skeleton already present");
                Ok(exp.clone())
            }
            None => {
                debug!("maybe_ungrown_core_string_skeleton not present, generating now");
                let tree_conf = self
                    .maybe_ungrown_justified_grower_tree_configuration()
                    .as_ref()
                    .expect("Validation should have prevented missing JustifiedGrowerTreeConfiguration");
                let skeleton = self
                    .maybe_ungrown_justified_string_skeleton()
                    .as_ref()
                    .expect("Validation should have prevented missing JustifiedStringSkeleton");
                let stripped = StrippedStringSkeleton::from(skeleton.clone());

                let generated = match GrowerModel::generate_core_string_skeleton(
                    client,
                    self.grower_inputs().as_ref().unwrap(),
                    tree_conf,
                    &stripped
                ).await {
                    Ok(g) => g,
                    Err(e) => {
                        GrowerModel::handle_core_string_skeleton_generation_error(
                            e,
                            client,
                            self.grower_inputs().as_ref().unwrap(),
                            tree_conf,
                            skeleton,
                            &stripped
                        ).await?
                    }
                };
                Ok(generated)
            }
        }
    }

    pub async fn maybe_grow_annotated_leaf_holder_expansions(
        &self,
        client: &GrowerLanguageModelClient,
    ) -> Result<AnnotatedLeafHolderExpansions, GrowerModelGenerationError> {
        trace!("maybe_grow_annotated_leaf_holder_expansions called with partial: {:?}", self);
        match &self.maybe_ungrown_annotated_leaf_holder_expansions() {
            Some(exp) => {
                debug!("maybe_ungrown_annotated_leaf_holder_expansions already present");
                Ok(exp.clone())
            }
            None => {
                debug!("maybe_ungrown_annotated_leaf_holder_expansions not present, generating now");
                let tree_conf = self
                    .maybe_ungrown_justified_grower_tree_configuration()
                    .as_ref()
                    .expect("Validation should have prevented missing JustifiedGrowerTreeConfiguration");
                let skeleton = self
                    .maybe_ungrown_justified_string_skeleton()
                    .as_ref()
                    .expect("Validation should have prevented missing JustifiedStringSkeleton");
                let stripped = StrippedStringSkeleton::from(skeleton.clone());
                let core_string_skeleton = self
                    .maybe_ungrown_core_string_skeleton()
                    .as_ref()
                    .expect("Validation should have prevented missing CoreStringSkeleton");

                let generated = match GrowerModel::generate_annotated_leaf_holder_expansions(
                    client,
                    self.grower_inputs().as_ref().unwrap(),
                    tree_conf,
                    &stripped,
                    core_string_skeleton
                ).await {
                    Ok(g) => g,
                    Err(e) => {
                        GrowerModel::handle_annotated_leaf_holder_expansion_generation_error(
                            e,
                            client,
                            self.grower_inputs().as_ref().unwrap(),
                            tree_conf,
                            skeleton,
                            &stripped,
                            core_string_skeleton
                        ).await?
                    }
                };
                Ok(generated)
            }
        }
    }
}

#[cfg(test)]
#[disable]
mod verify_show_all_generation_queries {
    use super::*;
    use std::collections::HashMap;

    #[traced_test]
    async fn it_displays_all_generation_queries_without_error() {
        trace!("Starting test: it_displays_all_generation_queries_without_error");

        // 1) Prepare GrowerInputs
        let grower_inputs = GrowerInputsBuilder::default()
            .target(CLASSIC_SKILL)
            .global_environment_descriptor(YOU_ARE_HERE.to_string())
            .sub_environments(
                CLASSIC_SUB_ENVIRONMENTS
                    .iter()
                    .map(|s| s.to_string())
                    .collect::<Vec<_>>()
            )
            .neighbors(
                CLASSIC_SKILL_NEIGHBORS
                    .iter()
                    .map(|s| s.to_string())
                    .collect::<Vec<_>>()
            )
            .build()
            .expect("Failed to build GrowerInputs for test");

        // 2) Build a non-trivial GrowerTreeConfiguration
        let level_skipping_config = LevelSkippingConfigurationBuilder::default()
            .leaf_probability_per_level(vec![0.15, 0.3])
            .build()
            .expect("Failed building LevelSkippingConfiguration");

        let weighted_branching_config = WeightedBranchingConfigurationBuilder::default()
            .mean(3)
            .variance(1)
            .build()
            .expect("Failed building WeightedBranchingConfiguration");

        let tree_level_specific_config = TreeLevelSpecificConfigurationBuilder::default()
            .breadth_per_level(vec![2, 4])
            .density_per_level(vec![2, 3])
            .build()
            .expect("Failed building TreeLevelSpecificConfiguration");

        let capstone_config = CapstoneGenerationConfigurationBuilder::default()
            .mode(CapstoneMode::Probabilistic)
            .probability(0.2)
            .build()
            .expect("Failed building CapstoneGenerationConfiguration");

        let ai_conf = AiTreeBranchingConfidenceConfigurationBuilder::default()
            .base_factor(2)
            .factor_multiplier(1.5)
            .build()
            .expect("Failed building AiTreeBranchingConfidenceConfiguration");

        let tree_config = GrowerTreeConfigurationBuilder::default()
            .depth(3)
            .breadth(2)
            .density(2)
            .leaf_granularity(0.8)
            .balance_symmetry(0.4)
            .complexity(ConfigurationComplexity::Balanced)
            .level_specific(Some(tree_level_specific_config))
            .weighted_branching(Some(weighted_branching_config))
            .level_skipping(Some(level_skipping_config))
            .capstone(Some(capstone_config))
            .ordering(Some(SubBranchOrdering::Alphabetical))
            .ai_confidence(Some(ai_conf))
            .aggregator_preference(0.7)
            .allow_early_leaves(true)
            .partial_subbranch_probability(0.3)
            .tree_expansion_policy(
                TreeExpansionPolicy::Weighted(
                    WeightedNodeVariantPolicyBuilder::default()
                        .aggregator_weight(0.4)
                        .dispatch_weight(0.4)
                        .leaf_holder_weight(0.2)
                        .build()
                        .expect("Failed building WeightedNodeVariantPolicy")
                )
            )
            .aggregator_depth_limit(Some(5))
            .dispatch_depth_limit(Some(4))
            .leaf_min_depth(Some(1))
            .build()
            .expect("Failed to build GrowerTreeConfiguration");

        // 2a) Supply the matching Justification & Confidence fields
        //
        // NOTE: Each sub-configuration is also a custom type, so the macro
        //       generates fields like `mean_justification`, `variance_justification`,
        //       or `enum_variant_justification` (for enums).
        //
        //       If e.g. `ConfigurationComplexity` is an enum, the macro typically
        //       generates:
        //          pub struct ConfigurationComplexityJustification {
        //              enum_variant_justification: String
        //          }
        //       so you must fill in `enum_variant_justification: "...".to_string()`
        //
        //       If e.g. `WeightedBranchingConfiguration` is a struct with fields
        //       `mean`, `variance`, you get:
        //          pub struct WeightedBranchingConfigurationJustification {
        //              mean_justification: String,
        //              variance_justification: String,
        //          }
        //
        //       Similarly for each nested type's confidence struct.

        let justified_grower_tree_configuration = JustifiedGrowerTreeConfigurationBuilder::default()
            .item(tree_config)
            .justification(
                GrowerTreeConfigurationJustification {
                    // Top-level fields match your original struct fields:
                    depth_justification: "Depth=3 => moderate hierarchy.".to_string(),
                    breadth_justification: "Breadth=2 => keep it simpler at each level.".to_string(),
                    density_justification: "Density=2 => each leaf node spawns 2 variants.".to_string(),
                    leaf_granularity_justification: "0.8 => quite detailed leaves but not too big.".to_string(),
                    balance_symmetry_justification: "0.4 => partial symmetry only.".to_string(),

                    // If `ConfigurationComplexity` is an enum => single field named `enum_variant_justification`:
                    complexity_justification: ConfigurationComplexityJustification {
                        enum_variant_justification: "Using Balanced variant for middle-of-the-road complexity.".to_string(),
                    },

                    // If `TreeLevelSpecificConfiguration` is a struct with fields
                    // like `breadth_per_level: Vec<u32>`, `density_per_level: Vec<u32>`,
                    // then the macro typically generates:
                    //   pub struct TreeLevelSpecificConfigurationJustification {
                    //       breadth_per_level_justification: String,
                    //       density_per_level_justification: String,
                    //   }
                    level_specific_justification: TreeLevelSpecificConfigurationJustification {
                        breadth_per_level_justification: "Level 0 => 2, Level 1 => 4 sub-branches".to_string(),
                        density_per_level_justification: "Level 0 => density=2, Level 1 => density=3".to_string(),
                    },

                    // WeightedBranchingConfiguration => a struct with `mean`, `variance` => each gets `_justification`:
                    weighted_branching_justification: WeightedBranchingConfigurationJustification {
                        mean_justification: "Mean=3 => typical branching factor.".to_string(),
                        variance_justification: "Variance=1 => slight randomness in branching.".to_string(),
                    },

                    // LevelSkippingConfiguration => a struct with e.g. `leaf_probability_per_level: Vec<f32>` => single string:
                    level_skipping_justification: LevelSkippingConfigurationJustification {
                        leaf_probability_per_level_justification: "At Level0 => p=0.15, Level1 => p=0.3 => some skipping.".to_string(),
                    },

                    // CapstoneGenerationConfiguration => might have `mode` + `probability` => each becomes `_justification`:
                    capstone_justification: CapstoneGenerationConfigurationJustification {
                        mode_justification: CapstoneModeJustification {
                            enum_variant_justification: "Probabilistic => not always a capstone leaf.".to_string(),
                        },
                        probability_justification: "p=0.2 => about 1 in 5 leaves becomes capstone.".to_string(),
                    },

                    // If `SubBranchOrdering` is an enum => `enum_variant_justification`
                    ordering_justification: SubBranchOrderingJustification {
                        enum_variant_justification: "Alphabetical ordering for sub-branches.".to_string(),
                    },

                    // AiTreeBranchingConfidenceConfiguration => struct with fields base_factor, factor_multiplier => each -> `_justification`
                    ai_confidence_justification: AiTreeBranchingConfidenceConfigurationJustification {
                        base_factor_justification: "Base=2 => expansions double in certain contexts.".to_string(),
                        factor_multiplier_justification: "1.5 => expansions ramp up more if AI is sure.".to_string(),
                    },

                    aggregator_preference_justification: "0.7 => aggregator nodes favored frequently.".to_string(),
                    allow_early_leaves_justification: "true => sub-branches can terminate earlier.".to_string(),
                    partial_subbranch_probability_justification: "0.3 => some sub-branches appear optionally.".to_string(),

                    // TreeExpansionPolicy => if it's an enum => single `enum_variant_justification`, if struct => fields:
                    tree_expansion_policy_justification: TreeExpansionPolicyJustification {
                        enum_variant_justification: "Weighted aggregator=0.4, dispatch=0.4, leaf=0.2 => variety.".to_string(),
                    },

                    aggregator_depth_limit_justification: "No aggregator deeper than level=5.".to_string(),
                    dispatch_depth_limit_justification: "Stop dispatch deeper than level=4.".to_string(),
                    leaf_min_depth_justification: "Leaf-holders not before depth=1.".to_string(),
                }
            )
            .confidence(
                GrowerTreeConfigurationConfidence {
                    depth_confidence: 0.95,
                    breadth_confidence: 0.9,
                    density_confidence: 0.85,
                    leaf_granularity_confidence: 0.88,
                    balance_symmetry_confidence: 0.7,

                    // If `ConfigurationComplexity` is an enum => single field: `enum_variant_confidence: f32`
                    complexity_confidence: ConfigurationComplexityConfidence {
                        enum_variant_confidence: 0.8,
                    },

                    // If `TreeLevelSpecificConfiguration` is a struct with e.g. 2 numeric fields => each gets `_confidence`:
                    level_specific_confidence: TreeLevelSpecificConfigurationConfidence {
                        breadth_per_level_confidence: 0.92,
                        density_per_level_confidence: 0.86,
                    },

                    // WeightedBranching => `mean_confidence`, `variance_confidence`
                    weighted_branching_confidence: WeightedBranchingConfigurationConfidence {
                        mean_confidence: 0.77,
                        variance_confidence: 0.75,
                    },

                    // LevelSkipping => single field: `leaf_probability_per_level_confidence`
                    level_skipping_confidence: LevelSkippingConfigurationConfidence {
                        leaf_probability_per_level_confidence: 0.65,
                    },

                    // Capstone => `mode_confidence`, `probability_confidence`
                    capstone_confidence: CapstoneGenerationConfigurationConfidence {
                        mode_confidence: CapstoneModeConfidence {
                            enum_variant_confidence: 0.6,
                        },
                        probability_confidence: 0.4,
                    },

                    // If `SubBranchOrdering` is an enum => `enum_variant_confidence`
                    ordering_confidence: SubBranchOrderingConfidence {
                        enum_variant_confidence: 0.9,
                    },

                    // AiTreeBranchingConfidence => `base_factor_confidence`, `factor_multiplier_confidence`
                    ai_confidence_confidence: AiTreeBranchingConfidenceConfigurationConfidence {
                        base_factor_confidence: 0.8,
                        factor_multiplier_confidence: 0.75,
                    },

                    aggregator_preference_confidence: 0.88,
                    allow_early_leaves_confidence: 0.82,
                    partial_subbranch_probability_confidence: 0.75,

                    tree_expansion_policy_confidence: TreeExpansionPolicyConfidence {
                        enum_variant_confidence: 0.85,
                    },

                    aggregator_depth_limit_confidence: 0.7,
                    dispatch_depth_limit_confidence: 0.65,
                    leaf_min_depth_confidence: 0.6,
                }
            )
            .build()
            .expect("Failed to build JustifiedGrowerTreeConfiguration");

        // 3) Build a somewhat detailed StringSkeleton
        let mut root_children = HashMap::new();
        root_children.insert(
            "AggregatorBranch".to_string(),
            DispatchChildSpecBuilder::default()
                .branch_selection_likelihood(100)
                .build()
                .expect("Failed building DispatchChildSpec")
        );
        root_children.insert(
            "LeafBranch".to_string(),
            DispatchChildSpecBuilder::default()
                .branch_selection_likelihood(100)
                .build()
                .expect("Failed building leaf_holder DispatchChildSpec")
        );

        let root_node = StringSkeletonNode::Dispatch {
            name: "RootDispatch".to_string(),
            ordering: Some(SubBranchOrdering::Alphabetical),
            children: root_children,
        };

        let mut aggregator_children = HashMap::new();
        aggregator_children.insert(
            "SubAggregator".to_string(),
            AggregateChildSpecBuilder::default()
                .psome_likelihood(80)
                .optional(false)
                .build()
                .expect("Failed building aggregator child spec")
        );

        let aggregator_node = StringSkeletonNode::Aggregate {
            name: "AggregatorBranch".to_string(),
            ordering: None,
            children: aggregator_children,
        };

        let leaf_node = StringSkeletonNode::LeafHolder {
            name: "LeafBranch".to_string(),
            ordering: None,
            n_leaves: 10,
            capstone: false,
        };

        let mut skel_map = HashMap::new();
        skel_map.insert("root".to_string(), root_node);
        skel_map.insert("AggregatorBranch".to_string(), aggregator_node);
        skel_map.insert("LeafBranch".to_string(), leaf_node);

        let string_skeleton = StringSkeletonBuilder::default()
            .map(skel_map)
            .build()
            .expect("Failed to build StringSkeleton");

        // 3a) Provide the correct single-string justification + single-float confidence for `map`
        let justified_string_skeleton = JustifiedStringSkeletonBuilder::default()
            .item(string_skeleton)
            .justification(
                StringSkeletonJustification {
                    map_justification: "Multiple branches illustrate distinct skill pathways.".to_string(),
                }
            )
            .confidence(
                StringSkeletonConfidence {
                    map_confidence: 0.85,
                }
            )
            .build()
            .expect("Failed to build JustifiedStringSkeleton");

        // 4) Convert to StrippedStringSkeleton
        let stripped_string_skeleton = StrippedStringSkeleton::from(&justified_string_skeleton);

        // 5) Build a CoreStringSkeleton
        let core_aggregate_node = CoreSkeletalAggregateNodeBuilder::default()
            .name("CoreAggregateExample".to_string())
            .descriptor("An aggregator example in the core skeleton".to_string())
            .children(vec![])
            .build()
            .expect("Failed building CoreSkeletalAggregateNode");

        let core_dispatch_node = CoreSkeletalDispatchNodeBuilder::default()
            .name("CoreDispatchExample".to_string())
            .descriptor("A dispatch example in the core skeleton".to_string())
            .children(vec![])
            .build()
            .expect("Failed building CoreSkeletalDispatchNode");

        let core_leaf_node = CoreSkeletalLeafHolderNodeBuilder::default()
            .name("CoreLeafHolderExample".to_string())
            .descriptor("A leaf holder example in the core skeleton".to_string())
            .leaves(vec!["leaf_a".to_string(), "leaf_b".to_string(), "leaf_c".to_string()])
            .build()
            .expect("Failed building CoreSkeletalLeafHolderNode");

        let core_string_skeleton = CoreStringSkeletonBuilder::default()
            .dispatch_nodes(vec![core_dispatch_node])
            .aggregate_nodes(vec![core_aggregate_node])
            .leaf_holder_nodes(vec![core_leaf_node])
            .build()
            .expect("Failed to build CoreStringSkeleton");

        // 6) Build AnnotatedLeafHolderExpansions
        let annotated_leaf_holder_node = AnnotatedLeafHolderNodeBuilder::default()
            .leaf_holder_name("CoreLeafHolderExample".to_string())
            .annotated_leaves(vec![
                AnnotatedLeafBuilder::default()
                    .leaf_name("leaf_a".to_string())
                    .leaf_descriptor("This is an advanced skill technique.".to_string())
                    .build()
                    .expect("Failed building leaf_a"),
                AnnotatedLeafBuilder::default()
                    .leaf_name("leaf_b".to_string())
                    .leaf_descriptor("A specialized sub-skill extension.".to_string())
                    .build()
                    .expect("Failed building leaf_b"),
            ])
            .build()
            .expect("Failed building AnnotatedLeafHolderNode");

        let annotated_leaf_holder_expansions = AnnotatedLeafHolderExpansionsBuilder::default()
            .annotated_leaf_holders(vec![annotated_leaf_holder_node])
            .build()
            .expect("Failed to build AnnotatedLeafHolderExpansions");

        // 7) Finally, build the GrowerModel
        let model = GrowerModel {
            grower_inputs,
            justified_grower_tree_configuration,
            justified_string_skeleton,
            stripped_string_skeleton,
            core_string_skeleton,
            annotated_leaf_holder_expansions,
        };

        // 8) Invoke the method under test
        model.show_all_generation_queries().await;

        assert!(false);
    }
}