ag-session 0.19.6

Agentty is an ADE (Agentic Development Environment) for structured, controllable AI-assisted software development.
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
//! Programmatic session orchestration facade and host backend port.

use std::sync::Arc;

use ag_protocol::{TurnPrompt, TurnPromptAttachment};
use async_trait::async_trait;

use crate::error::SessionError;
use crate::model::{ReviewRequest, Session, SessionId};
use crate::{AcceptTaskPlanRequest, CreateTaskRequest, SubmitTaskRequest, Task};

/// Creation strategy for a new session.
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub enum CreateSessionMode {
    /// Creates a regular session with an eagerly materialized worktree.
    #[default]
    Regular,
    /// Creates a draft whose worktree is materialized on first send.
    Draft,
    /// Creates a regular session that runs on the in-process
    /// [`crate::AgentKind::Harness`] with its default model.
    Harness,
}

/// Explicit input for creating one session.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CreateSessionRequest {
    /// Existing session whose launch settings should be copied.
    ///
    /// When absent, the host resolves the owning project's current defaults.
    pub inherit_from_session_id: Option<SessionId>,
    /// Determines whether the session is regular, deferred, or harness-backed.
    pub mode: CreateSessionMode,
    /// Project that owns the new session.
    pub project_id: i64,
}

/// One structured response to a persisted clarification question.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct QuestionAnswer {
    /// User response paired with `question`.
    pub answer: String,
    /// Exact persisted question text being answered.
    pub question: String,
}

/// Structured input for resuming one session from clarification questions.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AnswerQuestionsRequest {
    /// Ordered question and answer pairs for the current question set.
    pub answers: Vec<QuestionAnswer>,
    /// Local images referenced by `[Image #n]` placeholders in `answers`,
    /// delivered with the reply turn like prompt attachments. The caller
    /// keeps the files when the request fails, so it can retry with them.
    pub attachments: Vec<TurnPromptAttachment>,
}

/// Idempotent turn submitted to one session.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DurableMessageRequest {
    /// Agent-facing prompt.
    pub message: String,
    /// Stable operation identifier reused when delivery is retried.
    pub operation_id: String,
    /// Whether the machine-authored prompt is shown in the human transcript.
    pub visibility: DurableMessageVisibility,
}

/// Transcript treatment for one durable prompt.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum DurableMessageVisibility {
    /// Deliver generated context without displaying it as user chat.
    #[default]
    Hidden,
    /// Display the submitted instruction in session history.
    Visible,
}

/// Host implementation boundary for session persistence and workflows.
///
/// The trait is object-safe so agent loops and background workflows can hold a
/// programmatic session capability without depending on a concrete frontend.
#[async_trait]
pub trait SessionBackend: Send + Sync {
    /// Reserves generation without waiting for model completion.
    async fn generate_graph_proposal(
        &self,
        request: crate::GenerateGraphProposalRequest,
    ) -> Result<(), SessionError> {
        let _ = request;
        Err(SessionError::Operation(
            "Host does not support graph proposals".into(),
        ))
    }

    /// Reads retained state without generating or launching work.
    async fn get_graph_proposal(
        &self,
        id: &str,
    ) -> Result<Option<crate::GraphProposalState>, SessionError> {
        let _ = id;
        Err(SessionError::Operation(
            "Host does not support graph proposals".into(),
        ))
    }

    /// Applies an explicit action to the exact inspected version.
    async fn act_on_graph_proposal(
        &self,
        id: &str,
        version: u32,
        action: crate::GraphProposalAction,
    ) -> Result<(), SessionError> {
        let _ = (id, version, action);
        Err(SessionError::Operation(
            "Host does not support graph proposals".into(),
        ))
    }

    /// Reads durable progress without launching or retrying work.
    async fn get_execution_graph(
        &self,
        graph_id: &str,
    ) -> Result<Option<crate::ExecutionGraphProgress>, SessionError> {
        let _ = graph_id;

        Err(SessionError::Operation(
            "Host does not support execution graphs".into(),
        ))
    }

    /// Closes graph admission durably, then signals its owned workers.
    async fn cancel_execution_graph(
        &self,
        request: crate::GraphControlRequest,
    ) -> Result<(), SessionError> {
        let _ = request;

        Err(SessionError::Operation(
            "Host does not support execution graphs".into(),
        ))
    }

    /// Explicitly restarts dispatch without replaying admitted executions.
    async fn resume_execution_graph(
        &self,
        request: crate::ResumeExecutionGraphRequest,
    ) -> Result<(), SessionError> {
        let _ = request;

        Err(SessionError::Operation(
            "Host does not support execution graphs".into(),
        ))
    }

    /// Authorizes one new attempt against an exact failed/question execution.
    async fn continue_execution_graph_node(
        &self,
        request: crate::ContinueGraphNodeRequest,
    ) -> Result<(), SessionError> {
        let _ = request;

        Err(SessionError::Operation(
            "Host does not support execution graphs".into(),
        ))
    }

    /// Saves and starts a static graph. Existing admitted nodes are never
    /// replayed. Named budgets are fixed at first launch and their spending is
    /// recorded durably, so relaunching never replenishes them.
    async fn start_execution_graph(
        &self,
        request: StartExecutionGraphRequest,
    ) -> Result<(), SessionError> {
        let _ = request;

        Err(SessionError::Operation(
            "Host does not support execution graphs".into(),
        ))
    }

    /// Records explicit acceptance of an exact graph output and wakes ready
    /// dependents. Model output must never call this trusted host boundary.
    async fn accept_execution_graph_result(
        &self,
        reference: crate::GraphResultRef,
    ) -> Result<(), SessionError> {
        let _ = reference;

        Err(SessionError::Operation(
            "Host does not support execution graphs".into(),
        ))
    }
    /// Admits a role-bound attempt with its own isolated conversation.
    async fn submit_agent_task(
        &self,
        session_id: &SessionId,
        request: crate::SubmitAgentTaskRequest,
    ) -> Result<(), SessionError> {
        let _ = (session_id, request);

        Err(SessionError::Operation(
            "Host does not support role-aware tasks".to_string(),
        ))
    }

    /// Reads isolated task responses without exposing host storage types.
    async fn get_agent_task_history(
        &self,
        task_id: &str,
    ) -> Result<Option<crate::TaskAgentHistory>, SessionError> {
        let _ = task_id;

        Err(SessionError::Operation(
            "Host does not support role-aware tasks".to_string(),
        ))
    }

    /// Explicitly accepts a standalone Planner response by producing version.
    async fn accept_agent_plan(
        &self,
        _session_id: &SessionId,
        _request: AcceptTaskPlanRequest,
    ) -> Result<(), SessionError> {
        Err(SessionError::Operation(
            "Host does not support plan acceptance".into(),
        ))
    }

    /// Persists an outcome without execution. Older hosts may omit support.
    async fn create_task(
        &self,
        _session_id: &SessionId,
        _request: CreateTaskRequest,
    ) -> Result<(), SessionError> {
        Err(SessionError::Operation(
            "Host does not support tasks".to_string(),
        ))
    }

    /// Lists a session's tasks, including unattempted and completed outcomes.
    async fn list_tasks(&self, _session_id: &SessionId) -> Result<Vec<Task>, SessionError> {
        Err(SessionError::Operation(
            "Host does not support tasks".to_string(),
        ))
    }

    /// Admits an explicit task attempt. Older hosts may omit task support.
    async fn submit_task(
        &self,
        _session_id: &SessionId,
        _request: SubmitTaskRequest,
    ) -> Result<(), SessionError> {
        Err(SessionError::Operation(
            "Host does not support tasks".to_string(),
        ))
    }

    /// Loads the desired outcome and retained attempt history.
    async fn get_task(&self, _task_id: &str) -> Result<Option<Task>, SessionError> {
        Err(SessionError::Operation(
            "Host does not support tasks".to_string(),
        ))
    }

    /// Explicitly accepts the task outcome after all attempts have settled.
    async fn complete_task(&self, _task_id: &str) -> Result<(), SessionError> {
        Err(SessionError::Operation(
            "Host does not support tasks".to_string(),
        ))
    }

    /// Creates one session and returns its stable identifier.
    async fn create_session(
        &self,
        request: CreateSessionRequest,
    ) -> Result<SessionId, SessionError>;

    /// Loads one complete session aggregate, including settings and messages.
    async fn get_session(&self, session_id: &SessionId) -> Result<Option<Session>, SessionError>;

    /// Sends one text message, starting, resuming, or queueing as appropriate.
    async fn send_message(
        &self,
        session_id: &SessionId,
        message: String,
    ) -> Result<(), SessionError>;

    /// Submits a durable turn without entering the lossy live-chat
    /// queue used while an ordinary user turn is active.
    async fn submit_durable_message(
        &self,
        session_id: &SessionId,
        request: DurableMessageRequest,
    ) -> Result<(), SessionError>;

    /// Answers the complete current clarification-question set.
    async fn answer_questions(
        &self,
        session_id: &SessionId,
        request: AnswerQuestionsRequest,
    ) -> Result<(), SessionError>;

    /// Cancels one session through the host lifecycle workflow.
    async fn cancel_session(&self, session_id: &SessionId) -> Result<(), SessionError>;

    /// Requests merge processing for one review-ready session.
    async fn merge_session(&self, session_id: &SessionId) -> Result<(), SessionError>;

    /// Queues publication of one session branch and creates or refreshes its
    /// review request.
    async fn create_review_request(
        &self,
        session_id: &SessionId,
    ) -> Result<ReviewRequest, SessionError>;
}

/// Stable programmatic facade for session lifecycle operations.
#[derive(Clone)]
pub struct SessionService {
    backend: Arc<dyn SessionBackend>,
}

/// Explicit static-graph launch, separate from ordinary chat.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct StartExecutionGraphRequest {
    /// Validated immutable snapshot to save before admitting nodes.
    pub graph: crate::ExecutionGraph,
    /// Provider calls shared by nodes naming the same budget, including
    /// repairs. These limits cannot be replenished by redelivering an
    /// active launch.
    pub provider_call_limits: std::collections::BTreeMap<String, usize>,
}

impl SessionService {
    /// Generates a proposal through the host's bounded worker workflow.
    ///
    /// # Errors
    /// Returns admission, permissions, or persistence errors.
    pub async fn generate_graph_proposal(
        &self,
        request: crate::GenerateGraphProposalRequest,
    ) -> Result<(), SessionError> {
        self.backend.generate_graph_proposal(request).await
    }

    /// Queries pending, restored, or approved state without execution.
    ///
    /// # Errors
    /// Returns query delivery or persistence errors.
    pub async fn get_graph_proposal(
        &self,
        id: &str,
    ) -> Result<Option<crate::GraphProposalState>, SessionError> {
        self.backend.get_graph_proposal(id).await
    }

    /// Answers the complete question set on an exact proposal version.
    ///
    /// # Errors
    /// Returns stale-version, incomplete-answer, or generation-limit errors.
    pub async fn answer_graph_proposal(
        &self,
        id: &str,
        version: u32,
        answers: Vec<String>,
    ) -> Result<(), SessionError> {
        self.backend
            .act_on_graph_proposal(id, version, crate::GraphProposalAction::Answer(answers))
            .await
    }

    /// Regenerates within the original captured generation ceiling.
    ///
    /// # Errors
    /// Returns stale-version, approved-proposal, or exhausted-limit errors.
    pub async fn regenerate_graph_proposal(
        &self,
        id: &str,
        version: u32,
    ) -> Result<(), SessionError> {
        self.backend
            .act_on_graph_proposal(id, version, crate::GraphProposalAction::Regenerate)
            .await
    }

    /// Regenerates with user feedback, including its images, added to the
    /// generation history, within the original captured generation ceiling.
    ///
    /// # Errors
    /// Returns stale-version, empty-feedback, approved-proposal, or
    /// exhausted-limit errors.
    pub async fn revise_graph_proposal(
        &self,
        id: &str,
        version: u32,
        feedback: TurnPrompt,
    ) -> Result<(), SessionError> {
        self.backend
            .act_on_graph_proposal(id, version, crate::GraphProposalAction::Revise(feedback))
            .await
    }

    /// Approves the exact preview before dispatch. Redelivery never dispatches.
    ///
    /// # Errors
    /// Returns stale-version, resolution, permissions, or publication errors.
    pub async fn approve_graph_proposal(&self, id: &str, version: u32) -> Result<(), SessionError> {
        self.backend
            .act_on_graph_proposal(id, version, crate::GraphProposalAction::Approve)
            .await
    }

    /// Cancels a pending proposal and any active generating utility.
    ///
    /// # Errors
    /// Returns stale-version or already-approved errors.
    pub async fn cancel_graph_proposal(&self, id: &str, version: u32) -> Result<(), SessionError> {
        self.backend
            .act_on_graph_proposal(id, version, crate::GraphProposalAction::Cancel)
            .await
    }

    /// Reads graph/node progress and immutable execution history.
    ///
    /// # Errors
    /// Returns failed persistence or query delivery errors.
    pub async fn get_execution_graph(
        &self,
        graph_id: &str,
    ) -> Result<Option<crate::ExecutionGraphProgress>, SessionError> {
        self.backend.get_execution_graph(graph_id).await
    }

    /// Permanently cancels this graph without canceling unrelated session work.
    ///
    /// # Errors
    /// Rejects missing/stale graphs and failed durable cancellation.
    pub async fn cancel_execution_graph(
        &self,
        request: crate::GraphControlRequest,
    ) -> Result<(), SessionError> {
        self.backend.cancel_execution_graph(request).await
    }

    /// Resumes dispatch explicitly; failed nodes still require a new action.
    ///
    /// # Errors
    /// Rejects canceled/stale graphs, graphs without recorded launch limits,
    /// or ineligible sessions.
    pub async fn resume_execution_graph(
        &self,
        request: crate::ResumeExecutionGraphRequest,
    ) -> Result<(), SessionError> {
        self.backend.resume_execution_graph(request).await
    }

    /// Retries a failed node or answers its exact settled clarification set.
    ///
    /// # Errors
    /// Rejects stale sources, partial answers, conflicting action identities,
    /// canceled graphs, and failed persistence or delivery.
    pub async fn continue_execution_graph_node(
        &self,
        request: crate::ContinueGraphNodeRequest,
    ) -> Result<(), SessionError> {
        self.backend.continue_execution_graph_node(request).await
    }

    /// Starts an explicit static graph without waiting for model execution.
    ///
    /// # Errors
    /// Rejects unsupported profiles, stale/conflicting identities, missing
    /// budgets, ineligible sessions, and failed persistence or delivery.
    pub async fn start_execution_graph(
        &self,
        request: StartExecutionGraphRequest,
    ) -> Result<(), SessionError> {
        self.backend.start_execution_graph(request).await
    }

    /// Accepts one exact validated output and releases its acceptance gate.
    ///
    /// # Errors
    /// Rejects stale or unvalidated references and failed persistence.
    pub async fn accept_execution_graph_result(
        &self,
        reference: crate::GraphResultRef,
    ) -> Result<(), SessionError> {
        self.backend.accept_execution_graph_result(reference).await
    }

    /// Accepts a standalone Planner version from durable task history.
    ///
    /// # Errors
    /// Returns an error for stale/ineligible versions or failed persistence.
    pub async fn accept_agent_plan(
        &self,
        session_id: &SessionId,
        request: AcceptTaskPlanRequest,
    ) -> Result<(), SessionError> {
        self.backend.accept_agent_plan(session_id, request).await
    }

    /// Creates an owned session capability backed by a shared host handle.
    pub fn new(backend: Arc<dyn SessionBackend>) -> Self {
        Self { backend }
    }

    /// Admits an isolated role-bound attempt, acknowledging durable admission.
    /// Identical redeliveries do not execute again. Task completion is
    /// explicit.
    ///
    /// # Errors
    /// Returns an error for invalid input, unaccepted implementation plans,
    /// conflicting identity, or a session unable to accept work.
    pub async fn submit_agent_task(
        &self,
        session_id: &SessionId,
        request: crate::SubmitAgentTaskRequest,
    ) -> Result<(), SessionError> {
        self.backend.submit_agent_task(session_id, request).await
    }

    /// Reads the task's own responses. Attempt status remains authoritative.
    ///
    /// # Errors
    /// Returns an error when the host cannot load the isolated conversation.
    pub async fn get_agent_task_history(
        &self,
        task_id: &str,
    ) -> Result<Option<crate::TaskAgentHistory>, SessionError> {
        self.backend.get_agent_task_history(task_id).await
    }

    /// Persists a task with zero attempts in an existing session, regardless
    /// of its execution status. Does not start work or change session state.
    /// Identical creation requests preserve the task and its history.
    ///
    /// # Errors
    /// Returns an error for empty inputs, conflicting identity, a missing
    /// session, or a host that cannot persist tasks.
    pub async fn create_task(
        &self,
        session_id: &SessionId,
        request: CreateTaskRequest,
    ) -> Result<(), SessionError> {
        self.backend.create_task(session_id, request).await
    }

    /// Lists all tasks owned by a session in creation order, including their
    /// attempt histories in one snapshot. Equal timestamps retain insertion
    /// order. Returns an empty list for a missing session or one without tasks.
    ///
    /// # Errors
    /// Returns an error when the host cannot read tasks.
    pub async fn list_tasks(&self, session_id: &SessionId) -> Result<Vec<Task>, SessionError> {
        self.backend.list_tasks(session_id).await
    }

    /// Admits one task attempt through the existing serialized session worker.
    /// Creates the task atomically if it does not already exist.
    /// Acceptance does not wait for execution or imply task completion.
    /// Identical deliveries are acknowledged without running again.
    ///
    /// # Errors
    /// Returns an error for conflicting identity, an unavailable host, a
    /// completed task, or a session that cannot accept a new durable turn.
    pub async fn submit_task(
        &self,
        session_id: &SessionId,
        request: SubmitTaskRequest,
    ) -> Result<(), SessionError> {
        self.backend.submit_task(session_id, request).await
    }

    /// Loads a task and all its attempts from durable storage.
    ///
    /// # Errors
    /// Returns an error when the host cannot read tasks.
    pub async fn get_task(&self, task_id: &str) -> Result<Option<Task>, SessionError> {
        self.backend.get_task(task_id).await
    }

    /// Explicitly accepts the outcome. Successful model execution alone never
    /// completes a task. Repeated completion retains its original timestamp.
    ///
    /// # Errors
    /// Returns an error if the task is missing, an attempt is unfinished, or
    /// the host cannot persist completion.
    pub async fn complete_task(&self, task_id: &str) -> Result<(), SessionError> {
        self.backend.complete_task(task_id).await
    }

    /// Creates one session and returns its stable identifier.
    ///
    /// # Errors
    /// Returns an error when the host cannot create the requested session.
    pub async fn create_session(
        &self,
        request: CreateSessionRequest,
    ) -> Result<SessionId, SessionError> {
        self.backend.create_session(request).await
    }

    /// Loads one complete session aggregate by identifier.
    ///
    /// # Errors
    /// Returns an error when persisted data cannot be loaded or decoded.
    pub async fn get_session(
        &self,
        session_id: &SessionId,
    ) -> Result<Option<Session>, SessionError> {
        self.backend.get_session(session_id).await
    }

    /// Sends a text message to one session.
    ///
    /// # Errors
    /// Returns an error when the session cannot accept or enqueue the message.
    pub async fn send_message(
        &self,
        session_id: &SessionId,
        message: impl Into<String> + Send,
    ) -> Result<(), SessionError> {
        self.backend.send_message(session_id, message.into()).await
    }

    /// Submits one durable turn directly to the serialized worker.
    ///
    /// # Errors
    /// Returns an error when the session is busy or cannot accept the turn.
    pub async fn submit_durable_message(
        &self,
        session_id: &SessionId,
        request: DurableMessageRequest,
    ) -> Result<(), SessionError> {
        self.backend
            .submit_durable_message(session_id, request)
            .await
    }

    /// Answers the complete current clarification-question set.
    ///
    /// # Errors
    /// Returns an error when the answers are stale, incomplete, or cannot be
    /// enqueued as a follow-up turn.
    pub async fn answer_questions(
        &self,
        session_id: &SessionId,
        request: AnswerQuestionsRequest,
    ) -> Result<(), SessionError> {
        self.backend.answer_questions(session_id, request).await
    }

    /// Cancels one session through its host lifecycle workflow.
    ///
    /// # Errors
    /// Returns an error when the session does not exist or cannot be canceled
    /// in its current state.
    pub async fn cancel_session(&self, session_id: &SessionId) -> Result<(), SessionError> {
        self.backend.cancel_session(session_id).await
    }

    /// Requests merge processing for one session.
    ///
    /// # Errors
    /// Returns an error when the session is not mergeable or queueing fails.
    pub async fn merge_session(&self, session_id: &SessionId) -> Result<(), SessionError> {
        self.backend.merge_session(session_id).await
    }

    /// Queues publication of one session and creates or refreshes its review
    /// request.
    ///
    /// # Errors
    /// Returns an error when queueing, branch publication, forge access, or
    /// persistence fails.
    pub async fn create_review_request(
        &self,
        session_id: &SessionId,
    ) -> Result<ReviewRequest, SessionError> {
        self.backend.create_review_request(session_id).await
    }
}

#[cfg(test)]
#[path = "service_test.rs"]
mod tests;