reef-core 0.4.0

Provider-neutral primitives for building LLM agents: run lifecycle, transcript, tools, hooks
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
//! Provider-neutral lifecycle identity and terminal facts.

use std::{
    error::Error,
    fmt::{self, Display, Formatter},
    num::NonZeroU64,
};

/// Identifies how a started lifecycle scope ended.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum Outcome {
    /// The scope finished its normal success path.
    Completed,
    /// The consumer or an explicit run stop ended the scope.
    Stopped,
    /// Parent cancellation or a deadline ended the scope.
    Cancelled,
    /// An execution or contract error ended the scope.
    ///
    /// This variant says only *that* something failed. For a Run, the reason is
    /// one call away and is worth reaching for before reporting anything:
    /// [`Terminal::failure_kind`](crate::runtime::run::Terminal::failure_kind)
    /// classifies it and [`Terminal::failure`](crate::runtime::run::Terminal::failure)
    /// returns the error, whose
    /// [`source`](std::error::Error::source) chain reaches the provider or
    /// hook error underneath.
    Failed,
}

/// Explains why a lifecycle coordinate could not be constructed.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum CoordError {
    /// The containing session identity was empty.
    EmptySessionId,
    /// The containing run identity was empty.
    EmptyRunId,
    /// A per-turn step number exceeded its run-wide step number.
    #[non_exhaustive]
    StepExceedsStepInRun {
        /// The one-based step number within the turn.
        step: NonZeroU64,
        /// The one-based step number across the run.
        step_in_run: NonZeroU64,
    },
    /// The model-assigned tool-call identity was empty.
    EmptyCallId,
    /// The effective tool name was empty.
    EmptyToolName,
}

impl Display for CoordError {
    fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
        match self {
            Self::EmptySessionId => formatter.write_str("session ID must not be empty"),
            Self::EmptyRunId => formatter.write_str("run ID must not be empty"),
            Self::StepExceedsStepInRun { step, step_in_run } => write!(
                formatter,
                "step {step} must not exceed run-wide step {step_in_run}"
            ),
            Self::EmptyCallId => formatter.write_str("tool-call ID must not be empty"),
            Self::EmptyToolName => formatter.write_str("tool name must not be empty"),
        }
    }
}

impl Error for CoordError {}

/// The complete, internally consistent numeric location of a step.
///
/// This reusable value carries the required parent turn and both views of the
/// step number. Its private fields prevent external code from forging an
/// inconsistent location.
///
/// ```compile_fail
/// use std::num::NonZeroU64;
/// use reef_core::value::lifecycle;
/// let one = NonZeroU64::new(1).unwrap();
/// let _forged = lifecycle::StepIndex { turn: one, step: one, step_in_run: one };
/// ```
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct StepIndex {
    turn: NonZeroU64,
    step: NonZeroU64,
    step_in_run: NonZeroU64,
}

impl StepIndex {
    /// Creates a step location below `turn`.
    ///
    /// # Errors
    ///
    /// Returns [`CoordError::StepExceedsStepInRun`] when the per-turn step
    /// number exceeds the run-wide step number.
    pub fn new(
        turn: NonZeroU64,
        step: NonZeroU64,
        step_in_run: NonZeroU64,
    ) -> Result<Self, CoordError> {
        if step > step_in_run {
            return Err(CoordError::StepExceedsStepInRun { step, step_in_run });
        }
        Ok(Self {
            turn,
            step,
            step_in_run,
        })
    }

    /// Returns the one-based parent turn number.
    #[must_use]
    pub const fn turn(self) -> NonZeroU64 {
        self.turn
    }

    /// Returns the one-based step number within the turn.
    #[must_use]
    pub const fn step_in_turn(self) -> NonZeroU64 {
        self.step
    }

    /// Returns the one-based step number across the run.
    #[must_use]
    pub const fn step_in_run(self) -> NonZeroU64 {
        self.step_in_run
    }
}

#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
struct GenerationPosition {
    step: StepIndex,
    generation: NonZeroU64,
}

#[derive(Clone, Debug, Eq, Hash, PartialEq)]
struct ToolCallPosition {
    generation: GenerationPosition,
    call_id: String,
    tool_name: String,
}

#[derive(Clone, Debug, Eq, Hash, PartialEq)]
enum Layer {
    Run,
    Turn(NonZeroU64),
    Step(StepIndex),
    Generation(GenerationPosition),
    ToolCall(ToolCallPosition),
}

/// Locates one valid point in a run's execution hierarchy.
///
/// Each constructor names the complete hierarchy for its layer. Layer numbers use
/// [`NonZeroU64`], and a [`StepIndex`] guarantees that a step's run-wide number
/// cannot precede its per-turn number. A tool call is always nested below a real
/// model generation.
///
/// ```
/// use std::num::NonZeroU64;
/// use reef_core::value::lifecycle;
/// let one = NonZeroU64::new(1).unwrap();
/// let step = lifecycle::StepIndex::new(one, one, one).unwrap();
/// let coord = lifecycle::Coord::at_tool_call(
///     "session-2".into(), "run-7".into(), step, one,
///     "call-1".into(), "grep".into(),
/// ).unwrap();
/// assert_eq!(coord.to_string(), "run-7/turn-1/step-1/gen-1/call-call-1");
/// ```
///
/// Zero cannot be supplied as a layer number.
///
/// ```compile_fail
/// use reef_core::value::lifecycle;
/// let _ = lifecycle::Coord::at_turn("session".into(), "run".into(), 0);
/// ```
///
/// The former unchecked builder surface is intentionally unavailable.
///
/// ```compile_fail
/// use reef_core::value::lifecycle;
/// let run = lifecycle::Coord::at_run("session".into(), "run".into()).unwrap();
/// let _ = run.with_generation(1);
/// ```
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct Coord {
    session_id: String,
    run_id: String,
    layer: Layer,
}

impl Coord {
    /// Creates a coordinate at a run boundary, outside all nested layers.
    ///
    /// # Errors
    ///
    /// Returns [`CoordError::EmptySessionId`] or [`CoordError::EmptyRunId`] when
    /// the corresponding identity is empty.
    pub fn at_run(session_id: String, run_id: String) -> Result<Self, CoordError> {
        Self::from_parts(session_id, run_id, Layer::Run)
    }

    /// Creates a coordinate in a turn.
    ///
    /// # Errors
    ///
    /// Returns an error when a containing identity is empty.
    pub fn at_turn(
        session_id: String,
        run_id: String,
        turn: NonZeroU64,
    ) -> Result<Self, CoordError> {
        Self::from_parts(session_id, run_id, Layer::Turn(turn))
    }

    /// Creates a coordinate at `step`.
    ///
    /// # Errors
    ///
    /// Returns an error when a containing identity is empty.
    pub fn at_step(
        session_id: String,
        run_id: String,
        step: StepIndex,
    ) -> Result<Self, CoordError> {
        Self::from_parts(session_id, run_id, Layer::Step(step))
    }

    /// Creates a coordinate in a real model generation below `step`.
    ///
    /// # Errors
    ///
    /// Returns an error when a containing identity is empty.
    pub fn at_generation(
        session_id: String,
        run_id: String,
        step: StepIndex,
        generation: NonZeroU64,
    ) -> Result<Self, CoordError> {
        let position = GenerationPosition { step, generation };
        Self::from_parts(session_id, run_id, Layer::Generation(position))
    }

    /// Creates a coordinate in a tool call below a real model generation.
    ///
    /// # Errors
    ///
    /// Returns an error when a containing identity, call identity, or tool name
    /// is empty.
    pub fn at_tool_call(
        session_id: String,
        run_id: String,
        step: StepIndex,
        generation: NonZeroU64,
        call_id: String,
        tool_name: String,
    ) -> Result<Self, CoordError> {
        if call_id.is_empty() {
            return Err(CoordError::EmptyCallId);
        }
        if tool_name.is_empty() {
            return Err(CoordError::EmptyToolName);
        }
        let position = ToolCallPosition {
            generation: GenerationPosition { step, generation },
            call_id,
            tool_name,
        };
        Self::from_parts(session_id, run_id, Layer::ToolCall(position))
    }

    fn from_parts(session_id: String, run_id: String, layer: Layer) -> Result<Self, CoordError> {
        if session_id.is_empty() {
            return Err(CoordError::EmptySessionId);
        }
        if run_id.is_empty() {
            return Err(CoordError::EmptyRunId);
        }
        Ok(Self {
            session_id,
            run_id,
            layer,
        })
    }

    /// Returns the containing session identity.
    #[must_use]
    pub fn session_id(&self) -> &str {
        &self.session_id
    }

    /// Returns the containing run identity.
    #[must_use]
    pub fn run_id(&self) -> &str {
        &self.run_id
    }

    /// Returns the turn number, or zero at the run boundary.
    #[must_use]
    pub const fn turn(&self) -> u64 {
        match &self.layer {
            Layer::Run => 0,
            Layer::Turn(turn) => turn.get(),
            Layer::Step(step) => step.turn.get(),
            Layer::Generation(generation) => generation.step.turn.get(),
            Layer::ToolCall(tool_call) => tool_call.generation.step.turn.get(),
        }
    }

    /// Returns the step number within the turn, or zero outside a step.
    #[must_use]
    pub const fn step_in_turn(&self) -> u64 {
        match &self.layer {
            Layer::Run | Layer::Turn(_) => 0,
            Layer::Step(step) => step.step.get(),
            Layer::Generation(generation) => generation.step.step.get(),
            Layer::ToolCall(tool_call) => tool_call.generation.step.step.get(),
        }
    }

    /// Returns the step number across the run, or zero outside a step.
    #[must_use]
    pub const fn step_in_run(&self) -> u64 {
        match &self.layer {
            Layer::Run | Layer::Turn(_) => 0,
            Layer::Step(step) => step.step_in_run.get(),
            Layer::Generation(generation) => generation.step.step_in_run.get(),
            Layer::ToolCall(tool_call) => tool_call.generation.step.step_in_run.get(),
        }
    }

    /// Returns the generation number, or zero outside a generation.
    #[must_use]
    pub const fn generation(&self) -> u64 {
        match &self.layer {
            Layer::Run | Layer::Turn(_) | Layer::Step(_) => 0,
            Layer::Generation(generation) => generation.generation.get(),
            Layer::ToolCall(tool_call) => tool_call.generation.generation.get(),
        }
    }

    /// Returns the model-assigned tool-call identity, or an empty string outside a call.
    #[must_use]
    pub fn call_id(&self) -> &str {
        match &self.layer {
            Layer::ToolCall(tool_call) => &tool_call.call_id,
            _ => "",
        }
    }

    /// Returns the effective tool name, or an empty string outside a call.
    #[must_use]
    pub fn tool_name(&self) -> &str {
        match &self.layer {
            Layer::ToolCall(tool_call) => &tool_call.tool_name,
            _ => "",
        }
    }
}

impl Display for Coord {
    fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
        formatter.write_str(&self.run_id)?;
        if self.turn() > 0 {
            write!(formatter, "/turn-{}", self.turn())?;
        }
        if self.step_in_turn() > 0 {
            write!(formatter, "/step-{}", self.step_in_turn())?;
        }
        if self.generation() > 0 {
            write!(formatter, "/gen-{}", self.generation())?;
        }
        if !self.call_id().is_empty() {
            write!(formatter, "/call-{}", self.call_id())?;
        }
        Ok(())
    }
}

/// The serialized form of [`Outcome`] and [`Coord`] (ADR-019 D5).
///
/// A coordinate travels as the eight values its accessors return, with the same
/// absence encoding they use: `0` for a layer number outside its layer, `""` for
/// a call identity or tool name outside a call. The private layer enum is
/// deliberately not the wire shape. A reader of the public API sees the
/// accessors, so the wire shows the same thing, and a future dimension arrives as
/// one more accessor and therefore as one more field rather than as a new variant.
///
/// Reading one dispatches back to the `at_*` constructors, so a coordinate that
/// no constructor could have produced — a step without a run-wide step, a tool
/// name without a call identity, a generation below no step — is refused by name
/// rather than rebuilt.
///
/// This leaves [`Display`] untouched: that is the run-relative path and omits
/// `session_id`, while this is the complete structural projection and includes
/// it. Two frozen contracts, neither derived from the other.
#[cfg(feature = "serde")]
mod serde_impl {
    use std::fmt::{self, Formatter};
    use std::num::NonZeroU64;

    use serde_core::de::{
        Deserialize, Deserializer, EnumAccess, Error as DeError, MapAccess, SeqAccess,
        VariantAccess, Visitor,
    };
    use serde_core::ser::{Serialize, SerializeStruct, Serializer};

    use super::{Coord, Outcome, StepIndex};
    use crate::wire::{self, IdentifierSeed};

    const OUTCOME_NAME: &str = "Outcome";
    const OUTCOME_VARIANTS: &[&str] = &["completed", "stopped", "canceled", "failed"];
    const COORD_FIELDS: &[&str] = &[
        "session_id",
        "run_id",
        "turn",
        "step",
        "step_in_run",
        "generation",
        "call_id",
        "tool_name",
    ];

    /// Names the refusal a caller sees when the eight numbers do not describe a
    /// point any constructor can reach.
    struct InvalidLayer;

    impl fmt::Display for InvalidLayer {
        fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
            formatter.write_str(
                "coordinate layer values do not describe a run, turn, step, generation or tool call",
            )
        }
    }

    // -- Outcome -------------------------------------------------------------

    impl Serialize for Outcome {
        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
        where
            S: Serializer,
        {
            let (index, tag) = match self {
                Self::Completed => (0, "completed"),
                Self::Stopped => (1, "stopped"),
                Self::Cancelled => (2, "canceled"),
                Self::Failed => (3, "failed"),
            };
            serializer.serialize_unit_variant(OUTCOME_NAME, index, tag)
        }
    }

    impl<'de> Deserialize<'de> for Outcome {
        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
        where
            D: Deserializer<'de>,
        {
            deserializer.deserialize_enum(OUTCOME_NAME, OUTCOME_VARIANTS, OutcomeVisitor)
        }
    }

    struct OutcomeVisitor;

    impl<'de> Visitor<'de> for OutcomeVisitor {
        type Value = Outcome;

        fn expecting(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
            formatter.write_str("a lifecycle outcome")
        }

        fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error>
        where
            A: EnumAccess<'de>,
        {
            let (tag, variant) = data.variant_seed(IdentifierSeed(OUTCOME_VARIANTS))?;
            variant.unit_variant()?;
            match tag.0.as_str() {
                "completed" => Ok(Outcome::Completed),
                "stopped" => Ok(Outcome::Stopped),
                "canceled" => Ok(Outcome::Cancelled),
                "failed" => Ok(Outcome::Failed),
                unknown => Err(A::Error::unknown_variant(unknown, OUTCOME_VARIANTS)),
            }
        }
    }

    // -- Coord ---------------------------------------------------------------

    impl Serialize for Coord {
        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
        where
            S: Serializer,
        {
            let mut record = serializer.serialize_struct("Coord", 8)?;
            record.serialize_field("session_id", self.session_id())?;
            record.serialize_field("run_id", self.run_id())?;
            record.serialize_field("turn", &self.turn())?;
            record.serialize_field("step", &self.step_in_turn())?;
            record.serialize_field("step_in_run", &self.step_in_run())?;
            record.serialize_field("generation", &self.generation())?;
            record.serialize_field("call_id", self.call_id())?;
            record.serialize_field("tool_name", self.tool_name())?;
            record.end()
        }
    }

    impl<'de> Deserialize<'de> for Coord {
        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
        where
            D: Deserializer<'de>,
        {
            deserializer.deserialize_struct("Coord", COORD_FIELDS, CoordVisitor)
        }
    }

    /// The eight flat values a coordinate travels as, before they are checked.
    struct Flat {
        session_id: String,
        run_id: String,
        turn: u64,
        step: u64,
        step_in_run: u64,
        generation: u64,
        call_id: String,
        tool_name: String,
    }

    impl Flat {
        /// Dispatches the eight values back to the constructor that owns their
        /// shape.
        ///
        /// Every accepted combination is one arm and everything else is the
        /// refusal arm. Writing it as a single match over the whole tuple rather
        /// than as a chain of conditions is what makes "no other combination is
        /// legal" a property of the code instead of a claim about it.
        fn build<E>(self) -> Result<Coord, E>
        where
            E: DeError,
        {
            let Self {
                session_id,
                run_id,
                turn,
                step,
                step_in_run,
                generation,
                call_id,
                tool_name,
            } = self;
            let built = match (
                NonZeroU64::new(turn),
                NonZeroU64::new(step),
                NonZeroU64::new(step_in_run),
                NonZeroU64::new(generation),
                call_id.is_empty(),
                tool_name.is_empty(),
            ) {
                (None, None, None, None, true, true) => Coord::at_run(session_id, run_id),
                (Some(turn), None, None, None, true, true) => {
                    Coord::at_turn(session_id, run_id, turn)
                }
                (Some(turn), Some(step), Some(step_in_run), None, true, true) => {
                    StepIndex::new(turn, step, step_in_run)
                        .and_then(|index| Coord::at_step(session_id, run_id, index))
                }
                (Some(turn), Some(step), Some(step_in_run), Some(generation), true, true) => {
                    StepIndex::new(turn, step, step_in_run).and_then(|index| {
                        Coord::at_generation(session_id, run_id, index, generation)
                    })
                }
                (Some(turn), Some(step), Some(step_in_run), Some(generation), false, false) => {
                    StepIndex::new(turn, step, step_in_run).and_then(|index| {
                        Coord::at_tool_call(
                            session_id, run_id, index, generation, call_id, tool_name,
                        )
                    })
                }
                _ => return Err(E::custom(InvalidLayer)),
            };
            built.map_err(E::custom)
        }
    }

    struct CoordVisitor;

    impl<'de> Visitor<'de> for CoordVisitor {
        type Value = Coord;

        fn expecting(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
            formatter.write_str("a lifecycle coordinate")
        }

        fn visit_seq<A>(self, mut sequence: A) -> Result<Self::Value, A::Error>
        where
            A: SeqAccess<'de>,
        {
            let session_id = wire::element(&mut sequence, 0)?;
            let run_id = wire::element(&mut sequence, 1)?;
            let turn = wire::element(&mut sequence, 2)?;
            let step = wire::element(&mut sequence, 3)?;
            let step_in_run = wire::element(&mut sequence, 4)?;
            let generation = wire::element(&mut sequence, 5)?;
            let call_id = wire::element(&mut sequence, 6)?;
            let tool_name = wire::element(&mut sequence, 7)?;
            wire::end(&mut sequence, 8)?;
            Flat {
                session_id,
                run_id,
                turn,
                step,
                step_in_run,
                generation,
                call_id,
                tool_name,
            }
            .build()
        }

        fn visit_map<A>(self, mut entries: A) -> Result<Self::Value, A::Error>
        where
            A: MapAccess<'de>,
        {
            let mut session_id = None;
            let mut run_id = None;
            let mut turn = None;
            let mut step = None;
            let mut step_in_run = None;
            let mut generation = None;
            let mut call_id = None;
            let mut tool_name = None;
            while let Some(field) = entries.next_key_seed(IdentifierSeed(COORD_FIELDS))? {
                match field.0.as_str() {
                    "session_id" => {
                        wire::accept(&mut session_id, entries.next_value()?, "session_id")?;
                    }
                    "run_id" => wire::accept(&mut run_id, entries.next_value()?, "run_id")?,
                    "turn" => wire::accept(&mut turn, entries.next_value()?, "turn")?,
                    "step" => wire::accept(&mut step, entries.next_value()?, "step")?,
                    "step_in_run" => {
                        wire::accept(&mut step_in_run, entries.next_value()?, "step_in_run")?;
                    }
                    "generation" => {
                        wire::accept(&mut generation, entries.next_value()?, "generation")?;
                    }
                    "call_id" => wire::accept(&mut call_id, entries.next_value()?, "call_id")?,
                    "tool_name" => {
                        wire::accept(&mut tool_name, entries.next_value()?, "tool_name")?;
                    }
                    unknown => return Err(A::Error::unknown_field(unknown, COORD_FIELDS)),
                }
            }
            Flat {
                session_id: wire::require(session_id, "session_id")?,
                run_id: wire::require(run_id, "run_id")?,
                turn: wire::require(turn, "turn")?,
                step: wire::require(step, "step")?,
                step_in_run: wire::require(step_in_run, "step_in_run")?,
                generation: wire::require(generation, "generation")?,
                call_id: wire::require(call_id, "call_id")?,
                tool_name: wire::require(tool_name, "tool_name")?,
            }
            .build()
        }
    }
}