app/tools.rs
1//! App-owned external tool-port contracts.
2//!
3//! These ports describe narrow capabilities the deterministic app may call.
4//! Constructing a request is not authority for an agent to perform the side
5//! effect directly: message tools can draft under review, reservation tools can
6//! draft updates, and payment/provider traits remain behind app policy and human
7//! review gates.
8//!
9//! ```
10//! use app::tools::{draft_update, messaging};
11//! use domain::{entities, message, workflow};
12//! use uuid::Uuid;
13//!
14//! let draft_request = messaging::draft::Request {
15//! channel: messaging::DeliveryChannel::Portal,
16//! recipient: messaging::Recipient::Manager(
17//! entities::ManagerId::try_new("gm-fixture")?,
18//! ),
19//! body: messaging::message_body::Body::try_new(
20//! "Internal review task: verify vaccine evidence before any customer send.",
21//! )?,
22//! review: messaging::ReviewPolicy::ManagerApprovalRequired,
23//! };
24//!
25//! assert_eq!(draft_request.review, messaging::ReviewPolicy::ManagerApprovalRequired);
26//!
27//! let reservation_update = draft_update::Request {
28//! reservation_id: entities::reservation::Id(Uuid::from_u128(0x123)),
29//! proposed_status: entities::reservation::Status::SpecialReview,
30//! rationale: draft_update::Rationale::ManagerReviewRequired,
31//! };
32//!
33//! // The port models a draft/update proposal; it is not a provider/PMS write.
34//! assert_eq!(reservation_update.proposed_status, entities::reservation::Status::SpecialReview);
35//!
36//! let internal_task = workflow::task::Title::try_new("Review ambiguous boarding vaccine proof")?;
37//! assert_eq!(
38//! internal_task.into_inner(),
39//! "Review ambiguous boarding vaccine proof",
40//! );
41//! # Ok::<(), Box<dyn std::error::Error>>(())
42//! ```
43use async_trait::async_trait;
44use nutype::nutype;
45use serde::{Deserialize, Serialize};
46
47use domain::entities::{Customer, CustomerId, LocationId, Pet, PetId, Reservation, reservation};
48use domain::money::Money;
49use domain::workflow;
50
51/// Shared tool errors returned when an agent helper cannot safely complete.
52pub mod error;
53
54pub use error::{Error, ExternalFailure, Resource, ResourceId, Result};
55
56#[async_trait]
57/// Read-only customer/reservation evidence store exposed to app workflows.
58///
59/// Implementations fetch source-grounded customer, pet, and reservation records
60/// for deterministic workflow evaluation. The trait is a read boundary: returned
61/// facts may be summarized or used to prepare review packets, but callers must
62/// use separate draft/review ports for any customer message, booking update, or
63/// provider-system write.
64pub trait CustomerStore: Send + Sync {
65 /// Fetches the customer record identified by `id` as app-owned evidence.
66 ///
67 /// The returned customer can ground triage, retention, or communication
68 /// drafts. A missing record should surface as [`Error::NotFound`], and this
69 /// read must not create, edit, merge, or contact the customer.
70 async fn get_customer(&self, id: CustomerId) -> Result<Customer>;
71 /// Fetches the pet profile identified by `id` for policy and care-context checks.
72 ///
73 /// The result may inform vaccine, temperament, service-line, or daily-care
74 /// review packets. It is evidence only; it must not change pet profile fields
75 /// or treat incomplete data as permission to invent missing facts.
76 async fn get_pet(&self, id: PetId) -> Result<Pet>;
77 /// Fetches the reservation identified by `id` for source-grounded workflow state.
78 ///
79 /// The result may drive booking triage, daily updates, checkout completion,
80 /// or retention follow-up decisions. It must not confirm, cancel, check in,
81 /// check out, or otherwise mutate the reservation.
82 async fn get_reservation(&self, id: reservation::Id) -> Result<Reservation>;
83}
84
85#[async_trait]
86/// Reservation-system port for read checks and review-held draft updates.
87///
88/// This trait separates source availability checks and draft reservation updates
89/// from live provider/PMS mutation. Implementations may consult external systems
90/// or create internal draft records, but workflow code must still apply review
91/// gates before any booking promise, status change, deposit, or customer message.
92pub trait ReservationSystem: Send + Sync {
93 /// Checks capacity/policy availability without confirming a booking.
94 ///
95 /// The request carries location, optional reservation context, and service
96 /// notes. The outcome should identify available/unavailable/review-required
97 /// evidence, including any capacity snapshot id, and must not reserve space
98 /// unless the implementation explicitly models that as a review-safe hold.
99 async fn check_availability(
100 &self,
101 request: availability::Request,
102 ) -> Result<availability::Outcome>;
103 /// Persists a proposed reservation status change as a draft for review.
104 ///
105 /// The returned draft id identifies the review artifact. Implementations must
106 /// not write the proposed status to the provider/PMS or represent the draft as
107 /// a customer-visible booking decision before the required app/human gates run.
108 async fn draft_reservation_update(
109 &self,
110 request: draft_update::Request,
111 ) -> Result<draft_update::draft::Id>;
112}
113
114#[async_trait]
115/// Structured agent runtime used only after deterministic app context is built.
116///
117/// Implementations execute a model/tool runner against typed input and return a
118/// typed workflow result for validation. The runtime is not a shortcut around
119/// source evidence, review gates, or blocked live actions.
120pub trait AgentRuntime: Send + Sync {
121 /// Runs one typed agent call for a workflow event and input packet.
122 ///
123 /// The call returns a structured workflow result for the app validator to
124 /// accept or reject. Even successful output remains draft/evidence until the
125 /// owning workflow applies policy gates.
126 async fn run_structured<TIn, TOut>(
127 &self,
128 event: workflow::Event,
129 input: TIn,
130 ) -> Result<workflow::Result<TOut>>
131 where
132 TIn: Send + Sync + Serialize,
133 TOut: Send + Sync + for<'de> Deserialize<'de>;
134}
135
136/// Read-only availability checks that inform drafts without confirming bookings.
137pub mod availability {
138 use super::*;
139
140 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
141 /// Availability lookup input for a location/service request.
142 ///
143 /// This packet supplies enough source context for an adapter to check capacity
144 /// or policy hard-stops while keeping the workflow in read/draft mode.
145 pub struct Request {
146 /// Resort/location whose capacity or policy should be checked.
147 pub location_id: LocationId,
148 /// Reservation context when the check is for an existing booking workflow.
149 pub reservation_id: Option<reservation::Id>,
150 /// Staff/customer service notes that clarify requested dates, service line,
151 /// pet constraints, or missing information for the availability check.
152 pub service_notes: ServiceNotes,
153 }
154
155 #[nutype(
156 sanitize(trim),
157 validate(not_empty, len_char_max = 1000),
158 derive(
159 Debug,
160 Clone,
161 PartialEq,
162 Eq,
163 PartialOrd,
164 Ord,
165 Hash,
166 Serialize,
167 Deserialize
168 )
169 )]
170 pub struct ServiceNotes(String);
171
172 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
173 /// Availability decision returned to the app as source evidence, not a booking promise.
174 pub struct Outcome {
175 /// Deterministic availability result and the evidence required to explain it.
176 pub decision: Decision,
177 }
178
179 impl Outcome {
180 /// Reports whether capacity was found without implying customer-visible confirmation.
181 pub fn is_available(&self) -> bool {
182 matches!(self.decision, Decision::Available { .. })
183 }
184 }
185
186 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
187 /// Availability result used to decide whether staff may review a draft offer.
188 pub enum Decision {
189 /// Capacity evidence exists for a reviewable booking offer.
190 Available {
191 /// Why the adapter considers the requested service/date capacity available.
192 reason: SuccessReason,
193 /// Snapshot or hold identifier staff can inspect before relying on the result.
194 capacity_snapshot_id: CapacitySnapshotId,
195 },
196 /// Capacity or policy evidence prevents a safe draft offer without review.
197 Unavailable {
198 /// Reason the workflow should deny, defer, or escalate the draft offer.
199 reason: DenialReason,
200 },
201 }
202
203 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
204 /// Positive availability evidence reasons.
205 pub enum SuccessReason {
206 /// A capacity snapshot or review-safe hold exists for staff to evaluate.
207 CapacityHeld,
208 }
209
210 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
211 /// Negative or escalation availability evidence reasons.
212 pub enum DenialReason {
213 /// Source capacity data shows no safe space/service availability.
214 CapacityUnavailable,
215 /// A deterministic policy rule blocks the requested booking path.
216 PolicyHardStop,
217 /// Staff/customer information is incomplete, so the workflow cannot infer availability.
218 MissingRequiredInformation,
219 /// The adapter found ambiguity that requires staff or manager review.
220 RequiresHumanReview,
221 }
222
223 #[nutype(
224 sanitize(trim),
225 validate(not_empty, len_char_max = 120),
226 derive(
227 Debug,
228 Clone,
229 PartialEq,
230 Eq,
231 PartialOrd,
232 Ord,
233 Hash,
234 Serialize,
235 Deserialize
236 )
237 )]
238 pub struct CapacitySnapshotId(String);
239}
240
241/// Draft reservation-update requests held for staff review before provider writes.
242pub mod draft_update {
243 use super::*;
244
245 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
246 /// Input contract for building the workflow packet from source-grounded records.
247 pub struct Request {
248 /// Source-derived Reservation id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
249 pub reservation_id: reservation::Id,
250 /// Source-derived Proposed status retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
251 pub proposed_status: reservation::Status,
252 /// Source-derived Rationale retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
253 pub rationale: Rationale,
254 }
255
256 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
257 /// Decision taxonomy for rationale in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
258 pub enum Rationale {
259 /// Represents capacity unavailable in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
260 CapacityUnavailable,
261 /// Represents policy hard stop in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
262 PolicyHardStop,
263 /// Represents missing required information in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
264 MissingRequiredInformation,
265 /// Represents manager review required in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
266 ManagerReviewRequired,
267 /// Represents customer accepted offer in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
268 CustomerAcceptedOffer,
269 }
270
271 pub use draft::Id as Draft;
272
273 /// Draft payloads produced for review instead of direct customer/provider actions.
274 pub mod draft {
275 use super::*;
276
277 #[nutype(
278 sanitize(trim),
279 validate(not_empty, len_char_max = 120),
280 derive(
281 Debug,
282 Clone,
283 PartialEq,
284 Eq,
285 PartialOrd,
286 Ord,
287 Hash,
288 Serialize,
289 Deserialize
290 )
291 )]
292 pub struct Id(String);
293 }
294}
295/// Provider portal lookups exposed as read-only agent context.
296pub mod portal {
297 use super::*;
298
299 #[async_trait]
300 /// Read-only provider lookup port for turning external identifiers into reviewable app evidence.
301 pub trait Lookup: Send + Sync {
302 /// Resolves the request into source-grounded lookup evidence without editing provider records or contacting customers.
303 async fn lookup(&self, request: lookup::Request) -> Result<lookup::Outcome>;
304 }
305
306 /// Lookup requests and outcomes for pulling provider context into review packets.
307 pub mod lookup {
308 use super::*;
309
310 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
311 /// Input contract for building the workflow packet from source-grounded records.
312 pub struct Request {
313 /// Source-derived Provider retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
314 pub provider: Provider,
315 /// Source-derived Account retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
316 pub account: AccountId,
317 /// Source-derived Criteria retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
318 pub criteria: Criteria,
319 /// Source-derived Include retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
320 pub include: Vec<Include>,
321 }
322
323 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
324 /// Outcome carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
325 pub struct Outcome {
326 /// Source-derived Provider retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
327 pub provider: Provider,
328 /// Source-derived Matched retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
329 pub matched: Match,
330 }
331
332 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
333 /// Decision taxonomy for match in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
334 pub enum Match {
335 /// Represents customer in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
336 Customer(CustomerId),
337 /// Represents pet in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
338 Pet(PetId),
339 /// Represents reservation in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
340 Reservation(reservation::Id),
341 /// Represents not found in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
342 NotFound,
343 /// Source-derived Candidates retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
344 Ambiguous {
345 /// Candidates carried by this variant.
346 candidates: Vec<ExternalRecordId>,
347 },
348 }
349
350 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
351 /// Decision taxonomy for criteria in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
352 pub enum Criteria {
353 /// Represents customer in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
354 Customer(CustomerId),
355 /// Represents pet in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
356 Pet(PetId),
357 /// Represents reservation in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
358 Reservation(reservation::Id),
359 /// Represents external in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
360 External(ExternalRecordId),
361 }
362 }
363
364 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
365 /// Decision taxonomy for provider in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
366 pub enum Provider {
367 /// Represents gingr in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
368 Gingr,
369 /// Represents pms in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
370 Pms,
371 }
372
373 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
374 /// Decision taxonomy for include in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
375 pub enum Include {
376 /// Represents customer contact in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
377 CustomerContact,
378 /// Represents pet profile in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
379 PetProfile,
380 /// Represents reservation ledger in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
381 ReservationLedger,
382 }
383
384 #[nutype(
385 sanitize(trim),
386 validate(not_empty, len_char_max = 120),
387 derive(
388 Debug,
389 Clone,
390 PartialEq,
391 Eq,
392 PartialOrd,
393 Ord,
394 Hash,
395 Serialize,
396 Deserialize
397 )
398 )]
399 pub struct AccountId(String);
400
401 #[nutype(
402 sanitize(trim),
403 validate(not_empty, len_char_max = 160),
404 derive(
405 Debug,
406 Clone,
407 PartialEq,
408 Eq,
409 PartialOrd,
410 Ord,
411 Hash,
412 Serialize,
413 Deserialize
414 )
415 )]
416 pub struct ExternalRecordId(String);
417}
418
419/// Payment helper contracts that keep authorizations, refunds, and deposits auditable.
420pub mod payment {
421 use super::*;
422
423 #[async_trait]
424 /// Defines the behavior required from a gateway participant in the tools workflow.
425 pub trait Gateway: Send + Sync {
426 /// Evaluates whether a payment operation is policy-authorized without moving money or changing invoices.
427 async fn authorize(
428 &self,
429 request: authorization::Request,
430 ) -> Result<authorization::provider::Result>;
431 /// Resolves the request into source-grounded lookup evidence without editing provider records or contacting customers.
432 async fn refund(&self, request: refund::Request) -> Result<refund::provider::Result>;
433 /// Records a reviewed deposit artifact after authorization while keeping payment movement behind explicit policy gates.
434 async fn record_deposit(
435 &self,
436 request: deposit::RecordRequest,
437 ) -> Result<deposit::RecordResult>;
438 }
439
440 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
441 /// Decision taxonomy for subject in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
442 pub enum Subject {
443 /// Represents reservation deposit in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
444 ReservationDeposit(reservation::Id),
445 /// Represents reservation balance in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
446 ReservationBalance(reservation::Id),
447 /// Represents customer account in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
448 CustomerAccount(CustomerId),
449 }
450
451 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
452 /// Decision taxonomy for capture policy in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
453 pub enum CapturePolicy {
454 /// Represents authorize only in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
455 AuthorizeOnly,
456 /// Represents capture immediately in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
457 CaptureImmediately,
458 }
459
460 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
461 /// Decision taxonomy for review reason in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
462 pub enum ReviewReason {
463 /// Uses amount mismatch as source-grounded evidence for the deterministic decision.
464 AmountMismatch,
465 /// Uses duplicate risk as source-grounded evidence for the deterministic decision.
466 DuplicateRisk,
467 /// Uses provider ambiguity as source-grounded evidence for the deterministic decision.
468 ProviderAmbiguity,
469 }
470
471 #[nutype(
472 sanitize(trim),
473 validate(not_empty, len_char_max = 160),
474 derive(
475 Debug,
476 Clone,
477 PartialEq,
478 Eq,
479 PartialOrd,
480 Ord,
481 Hash,
482 Serialize,
483 Deserialize
484 )
485 )]
486 pub struct IdempotencyKey(String);
487
488 /// Payment authorization drafts that require explicit review before money movement.
489 pub mod authorization {
490 use super::*;
491
492 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
493 /// Input contract for building the workflow packet from source-grounded records.
494 pub struct Request {
495 /// Source-derived Subject retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
496 pub subject: Subject,
497 /// Source-derived Amount retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
498 pub amount: Money,
499 /// Source-derived Capture policy retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
500 pub capture_policy: CapturePolicy,
501 /// Source-derived Idempotency key retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
502 pub idempotency_key: IdempotencyKey,
503 }
504
505 /// Provider-facing result types kept separate from staff-review requests.
506 pub mod provider {
507 use super::*;
508
509 pub use authorization_id::Id as AuthorizationId;
510
511 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
512 /// Decision taxonomy for result in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
513 pub enum Result {
514 /// Represents authorized in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
515 Authorized {
516 /// Source-derived Authorization id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
517 authorization_id: AuthorizationId,
518 /// Source-derived Amount retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
519 amount: Money,
520 },
521 /// Represents declined in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
522 Declined {
523 /// Source-derived Reason retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
524 reason: DeclineReason,
525 },
526 /// Represents requires human review in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
527 RequiresHumanReview {
528 /// Source-derived Reason retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
529 reason: ReviewReason,
530 },
531 }
532
533 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
534 /// Decision taxonomy for decline reason in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
535 pub enum DeclineReason {
536 /// Uses card declined as source-grounded evidence for the deterministic decision.
537 CardDeclined,
538 /// Uses insufficient funds as source-grounded evidence for the deterministic decision.
539 InsufficientFunds,
540 /// Uses provider unavailable as source-grounded evidence for the deterministic decision.
541 ProviderUnavailable,
542 /// Uses requires customer action as source-grounded evidence for the deterministic decision.
543 RequiresCustomerAction,
544 }
545
546 /// Validated authorization identifiers returned by payment providers.
547 pub mod authorization_id {
548 use super::*;
549
550 #[nutype(
551 sanitize(trim),
552 validate(not_empty, len_char_max = 160),
553 derive(
554 Debug,
555 Clone,
556 PartialEq,
557 Eq,
558 PartialOrd,
559 Ord,
560 Hash,
561 Serialize,
562 Deserialize
563 )
564 )]
565 pub struct Id(String);
566 }
567 }
568 }
569
570 /// Refund requests and provider receipts that keep payment exceptions reviewable.
571 pub mod refund {
572 use super::*;
573
574 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
575 /// Input contract for building the workflow packet from source-grounded records.
576 pub struct Request {
577 /// Source-derived Payment reference retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
578 pub payment_reference: domain::payment::Reference,
579 /// Source-derived Amount retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
580 pub amount: Money,
581 /// Source-derived Reason retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
582 pub reason: Reason,
583 /// Source-derived Idempotency key retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
584 pub idempotency_key: IdempotencyKey,
585 }
586
587 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
588 /// Decision taxonomy for reason in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
589 pub enum Reason {
590 /// Uses reservation canceled as source-grounded evidence for the deterministic decision.
591 ReservationCanceled,
592 /// Uses service not rendered as source-grounded evidence for the deterministic decision.
593 ServiceNotRendered,
594 /// Uses manager approved adjustment as source-grounded evidence for the deterministic decision.
595 ManagerApprovedAdjustment,
596 }
597
598 /// Provider-facing result types kept separate from staff-review requests.
599 pub mod provider {
600 use super::*;
601
602 pub use refund_id::Id as RefundId;
603
604 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
605 /// Decision taxonomy for result in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
606 pub enum Result {
607 /// Source-derived Refund id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
608 Accepted {
609 /// Refund id carried by this variant.
610 refund_id: RefundId,
611 },
612 /// Source-derived Reason retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
613 Rejected {
614 /// Reason carried by this variant.
615 reason: RejectionReason,
616 },
617 }
618
619 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
620 /// Decision taxonomy for rejection reason in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
621 pub enum RejectionReason {
622 /// Uses payment not found as source-grounded evidence for the deterministic decision.
623 PaymentNotFound,
624 /// Uses already refunded as source-grounded evidence for the deterministic decision.
625 AlreadyRefunded,
626 /// Uses outside refund window as source-grounded evidence for the deterministic decision.
627 OutsideRefundWindow,
628 /// Uses provider rejected as source-grounded evidence for the deterministic decision.
629 ProviderRejected,
630 }
631
632 /// Validated refund identifiers returned by payment providers.
633 pub mod refund_id {
634 use super::*;
635
636 #[nutype(
637 sanitize(trim),
638 validate(not_empty, len_char_max = 160),
639 derive(
640 Debug,
641 Clone,
642 PartialEq,
643 Eq,
644 PartialOrd,
645 Ord,
646 Hash,
647 Serialize,
648 Deserialize
649 )
650 )]
651 pub struct Id(String);
652 }
653 }
654 }
655
656 /// Deposit-recording requests that make payment handoffs explicit and auditable.
657 pub mod deposit {
658 use super::*;
659
660 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
661 /// Record request carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
662 pub struct RecordRequest {
663 /// Source-derived Reservation id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
664 pub reservation_id: reservation::Id,
665 /// Source-derived Payment reference retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
666 pub payment_reference: domain::payment::Reference,
667 /// Source-derived Amount retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
668 pub amount: Money,
669 }
670
671 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
672 /// Record result carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
673 pub struct RecordResult {
674 /// Source-derived Reservation id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
675 pub reservation_id: reservation::Id,
676 /// Source-derived Deposit status retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
677 pub deposit_status: domain::payment::DepositStatus,
678 }
679 }
680}
681
682/// Customer-message drafting contracts that never send without staff approval.
683pub mod messaging {
684 use super::*;
685
686 #[async_trait]
687 /// Defines the behavior required from a drafting participant in the tools workflow.
688 pub trait Drafting: Send + Sync {
689 /// Resolves the request into source-grounded lookup evidence without editing provider records or contacting customers.
690 async fn draft_message(&self, request: draft::Request) -> Result<draft::Result>;
691 }
692
693 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
694 /// Decision taxonomy for delivery channel in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
695 pub enum DeliveryChannel {
696 /// Represents email in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
697 Email,
698 /// Represents sms in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
699 Sms,
700 /// Represents portal in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
701 Portal,
702 }
703
704 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
705 /// Decision taxonomy for recipient in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
706 pub enum Recipient {
707 /// Represents customer in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
708 Customer(CustomerId),
709 /// Represents staff in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
710 Staff(domain::entities::StaffId),
711 /// Represents manager in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
712 Manager(domain::entities::ManagerId),
713 }
714
715 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
716 /// Decision taxonomy for review policy in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
717 pub enum ReviewPolicy {
718 /// Represents draft only in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
719 DraftOnly,
720 /// Represents manager approval required in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
721 ManagerApprovalRequired,
722 }
723
724 /// Draft payloads produced for review instead of direct customer/provider actions.
725 pub mod draft {
726 use super::*;
727
728 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
729 /// Input contract for building the workflow packet from source-grounded records.
730 pub struct Request {
731 /// Source-derived Channel retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
732 pub channel: DeliveryChannel,
733 /// Source-derived Recipient retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
734 pub recipient: Recipient,
735 /// Source-derived Body retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
736 pub body: message_body::Body,
737 /// Source-derived Review retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
738 pub review: ReviewPolicy,
739 }
740
741 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
742 /// Result carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
743 pub struct Result {
744 /// Source-derived Draft id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
745 pub draft_id: draft_update::draft::Id,
746 /// Source-derived Status retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
747 pub status: Status,
748 }
749
750 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
751 /// Decision taxonomy for status in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
752 pub enum Status {
753 /// Labels work as drafted for queueing, review, and downstream agent context.
754 Drafted,
755 /// Labels work as drafted requires review for queueing, review, and downstream agent context.
756 DraftedRequiresReview,
757 }
758 }
759
760 /// Validated message bodies bounded for safe staff review.
761 pub mod message_body {
762 use super::*;
763
764 #[nutype(
765 sanitize(trim),
766 validate(not_empty, len_char_max = 4000),
767 derive(
768 Debug,
769 Clone,
770 PartialEq,
771 Eq,
772 PartialOrd,
773 Ord,
774 Hash,
775 Serialize,
776 Deserialize
777 )
778 )]
779 pub struct Body(String);
780 }
781}
782/// Document intake and OCR helpers that turn uploads into reviewable evidence.
783pub mod documents {
784 use super::*;
785
786 /// Document records and intake results used as source evidence.
787 pub mod document {
788 use super::*;
789
790 #[async_trait]
791 /// Defines the behavior required from a intake participant in the tools workflow.
792 pub trait Intake: Send + Sync {
793 /// Resolves the request into source-grounded lookup evidence without editing provider records or contacting customers.
794 async fn intake_document(&self, request: IntakeRequest) -> Result<IntakeResult>;
795 /// Resolves the request into source-grounded lookup evidence without editing provider records or contacting customers.
796 async fn extract_ocr(&self, request: super::ocr::Request)
797 -> Result<super::ocr::Result>;
798 }
799
800 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
801 /// Intake request carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
802 pub struct IntakeRequest {
803 /// Source-derived Document retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
804 pub document: reference::Ref,
805 /// Source-derived Source retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
806 pub source: Source,
807 /// Source-derived Expected content retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
808 pub expected_content: ExpectedContent,
809 }
810
811 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
812 /// Intake result carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
813 pub struct IntakeResult {
814 /// Source-derived Document retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
815 pub document: reference::Ref,
816 /// Source-derived Classification retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
817 pub classification: Classification,
818 }
819
820 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
821 /// Decision taxonomy for source in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
822 pub enum Source {
823 /// Represents customer upload in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
824 CustomerUpload,
825 /// Represents staff scan in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
826 StaffScan,
827 /// Represents portal import in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
828 PortalImport,
829 }
830
831 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
832 /// Decision taxonomy for expected content in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
833 pub enum ExpectedContent {
834 /// Represents vaccine proof in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
835 VaccineProof,
836 /// Represents medication instructions in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
837 MedicationInstructions,
838 /// Represents boarding agreement in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
839 BoardingAgreement,
840 /// Represents incident report in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
841 IncidentReport,
842 }
843
844 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
845 /// Decision taxonomy for classification in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
846 pub enum Classification {
847 /// Represents matches expected content in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
848 MatchesExpectedContent,
849 /// Represents mismatch in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
850 Mismatch,
851 /// Represents unreadable in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
852 Unreadable,
853 }
854
855 /// Stable document references carried through extraction and review packets.
856 pub mod reference {
857 use super::*;
858
859 #[nutype(
860 sanitize(trim),
861 validate(not_empty, len_char_max = 240),
862 derive(
863 Debug,
864 Clone,
865 PartialEq,
866 Eq,
867 PartialOrd,
868 Ord,
869 Hash,
870 Serialize,
871 Deserialize
872 )
873 )]
874 pub struct Ref(String);
875 }
876 }
877
878 /// OCR extraction requests that supply evidence without making policy decisions.
879 pub mod ocr {
880 use super::*;
881
882 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
883 /// Input contract for building the workflow packet from source-grounded records.
884 pub struct Request {
885 /// Source-derived Document retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
886 pub document: super::document::reference::Ref,
887 /// Source-derived Expected content retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
888 pub expected_content: super::document::ExpectedContent,
889 }
890
891 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
892 /// Decision taxonomy for result in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
893 pub enum Result {
894 /// Source-derived Text retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
895 Extracted {
896 /// Text carried by this variant.
897 text: extracted_text::Text,
898 },
899 /// Source-derived Reason retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
900 NeedsHumanReview {
901 /// Reason carried by this variant.
902 reason: ReviewReason,
903 },
904 }
905
906 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
907 /// Decision taxonomy for review reason in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
908 pub enum ReviewReason {
909 /// Uses low confidence as source-grounded evidence for the deterministic decision.
910 LowConfidence,
911 /// Uses ambiguous dates as source-grounded evidence for the deterministic decision.
912 AmbiguousDates,
913 /// Uses missing required fields as source-grounded evidence for the deterministic decision.
914 MissingRequiredFields,
915 }
916
917 /// Validated OCR text snippets attached to review packets.
918 pub mod extracted_text {
919 use super::*;
920
921 #[nutype(
922 sanitize(trim),
923 validate(not_empty, len_char_max = 8000),
924 derive(
925 Debug,
926 Clone,
927 PartialEq,
928 Eq,
929 PartialOrd,
930 Ord,
931 Hash,
932 Serialize,
933 Deserialize
934 )
935 )]
936 pub struct Text(String);
937 }
938 }
939}
940
941/// Media snapshot helpers that provide visual context without live device control.
942pub mod media {
943 use super::*;
944
945 #[async_trait]
946 /// Defines the behavior required from a capture participant in the tools workflow.
947 pub trait Capture: Send + Sync {
948 /// Resolves the request into source-grounded lookup evidence without editing provider records or contacting customers.
949 async fn request_snapshot(&self, request: SnapshotRequest) -> Result<SnapshotResult>;
950 }
951
952 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
953 /// Snapshot request carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
954 pub struct SnapshotRequest {
955 /// Source-derived Location id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
956 pub location_id: LocationId,
957 /// Source-derived Camera id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
958 pub camera_id: CameraId,
959 /// Source-derived Purpose retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
960 pub purpose: CapturePurpose,
961 }
962
963 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
964 /// Decision taxonomy for snapshot result in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
965 pub enum SnapshotResult {
966 /// Source-derived Media ref retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
967 Captured {
968 /// Media ref carried by this variant.
969 media_ref: Ref,
970 },
971 /// Source-derived Reason retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
972 Unavailable {
973 /// Reason carried by this variant.
974 reason: UnavailableReason,
975 },
976 }
977
978 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
979 /// Decision taxonomy for capture purpose in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
980 pub enum CapturePurpose {
981 /// Represents pet status check in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
982 PetStatusCheck(PetId),
983 /// Represents facility safety check in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
984 FacilitySafetyCheck,
985 /// Represents incident review in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
986 IncidentReview(reservation::Id),
987 }
988
989 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
990 /// Decision taxonomy for unavailable reason in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
991 pub enum UnavailableReason {
992 /// Uses camera offline as source-grounded evidence for the deterministic decision.
993 CameraOffline,
994 /// Uses permission denied as source-grounded evidence for the deterministic decision.
995 PermissionDenied,
996 /// Uses retention expired as source-grounded evidence for the deterministic decision.
997 RetentionExpired,
998 }
999
1000 #[nutype(
1001 sanitize(trim),
1002 validate(not_empty, len_char_max = 120),
1003 derive(
1004 Debug,
1005 Clone,
1006 PartialEq,
1007 Eq,
1008 PartialOrd,
1009 Ord,
1010 Hash,
1011 Serialize,
1012 Deserialize
1013 )
1014 )]
1015 pub struct CameraId(String);
1016
1017 #[nutype(
1018 sanitize(trim),
1019 validate(not_empty, len_char_max = 240),
1020 derive(
1021 Debug,
1022 Clone,
1023 PartialEq,
1024 Eq,
1025 PartialOrd,
1026 Ord,
1027 Hash,
1028 Serialize,
1029 Deserialize
1030 )
1031 )]
1032 pub struct Ref(String);
1033}
1034
1035/// Hermes task and schedule drafts used to queue staff work safely.
1036pub mod hermes {
1037 use super::*;
1038
1039 #[async_trait]
1040 /// Defines the behavior required from a automation hooks participant in the tools workflow.
1041 pub trait AutomationHooks: Send + Sync {
1042 /// Creates an internal task draft for staff review rather than directly assigning labor or changing schedules.
1043 async fn draft_task(
1044 &self,
1045 request: task::DraftRequest,
1046 ) -> Result<task::kanban::DraftResult>;
1047 /// Creates a schedule-change draft for manager review rather than mutating staff rosters.
1048 async fn draft_schedule(
1049 &self,
1050 request: schedule::DraftRequest,
1051 ) -> Result<schedule::DraftResult>;
1052 }
1053
1054 /// Internal task drafts that route work to staff instead of mutating provider records.
1055 pub mod task {
1056 use super::*;
1057
1058 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1059 /// Draft request carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
1060 pub struct DraftRequest {
1061 /// Source-derived Title retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1062 pub title: workflow::task::Title,
1063 /// Source-derived Body retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1064 pub body: workflow::task::Body,
1065 /// Source-derived Queue retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1066 pub queue: QueueName,
1067 /// Source-derived Trigger retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1068 pub trigger: Trigger,
1069 }
1070
1071 /// Kanban task records returned after staff-work items are drafted.
1072 pub mod kanban {
1073 use super::*;
1074
1075 pub use task_id::Id as TaskId;
1076
1077 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1078 /// Draft result carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
1079 pub struct DraftResult {
1080 /// Source-derived Task id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1081 pub task_id: TaskId,
1082 /// Source-derived Status retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1083 pub status: DraftStatus,
1084 }
1085
1086 /// Validated task identifiers for Hermes/kanban work items.
1087 pub mod task_id {
1088 use super::*;
1089
1090 #[nutype(
1091 sanitize(trim),
1092 validate(not_empty, len_char_max = 160),
1093 derive(
1094 Debug,
1095 Clone,
1096 PartialEq,
1097 Eq,
1098 PartialOrd,
1099 Ord,
1100 Hash,
1101 Serialize,
1102 Deserialize
1103 )
1104 )]
1105 pub struct Id(String);
1106 }
1107 }
1108 }
1109
1110 /// Schedule drafts that coordinate staff work without starting unattended automation.
1111 pub mod schedule {
1112 use super::*;
1113
1114 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1115 /// Draft request carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
1116 pub struct DraftRequest {
1117 /// Source-derived Name retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1118 pub name: Name,
1119 /// Source-derived Cadence retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1120 pub cadence: Cadence,
1121 /// Source-derived Queue retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1122 pub queue: QueueName,
1123 }
1124
1125 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1126 /// Draft result carried by the agent tool workflow; it exposes tightly-scoped read/draft helpers agents can call behind review gates.
1127 pub struct DraftResult {
1128 /// Source-derived Schedule id retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1129 pub schedule_id: Id,
1130 /// Source-derived Status retained for audit, reviewer explanation, or agent context; callers must not invent or mutate it.
1131 pub status: DraftStatus,
1132 }
1133
1134 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1135 /// Decision taxonomy for cadence in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
1136 pub enum Cadence {
1137 /// Represents daily in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1138 Daily,
1139 /// Represents hourly in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1140 Hourly,
1141 /// Represents manual only in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1142 ManualOnly,
1143 }
1144
1145 #[nutype(
1146 sanitize(trim),
1147 validate(not_empty, len_char_max = 160),
1148 derive(
1149 Debug,
1150 Clone,
1151 PartialEq,
1152 Eq,
1153 PartialOrd,
1154 Ord,
1155 Hash,
1156 Serialize,
1157 Deserialize
1158 )
1159 )]
1160 pub struct Name(String);
1161
1162 #[nutype(
1163 sanitize(trim),
1164 validate(not_empty, len_char_max = 160),
1165 derive(
1166 Debug,
1167 Clone,
1168 PartialEq,
1169 Eq,
1170 PartialOrd,
1171 Ord,
1172 Hash,
1173 Serialize,
1174 Deserialize
1175 )
1176 )]
1177 pub struct Id(String);
1178 }
1179
1180 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1181 /// Decision taxonomy for trigger in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
1182 pub enum Trigger {
1183 /// Represents workflow review in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1184 WorkflowReview,
1185 /// Represents operations brief in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1186 OperationsBrief,
1187 /// Represents integration failure in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1188 IntegrationFailure,
1189 }
1190
1191 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1192 /// Decision taxonomy for draft status in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
1193 pub enum DraftStatus {
1194 /// Labels work as drafted for queueing, review, and downstream agent context.
1195 Drafted,
1196 /// Labels work as drafted requires review for queueing, review, and downstream agent context.
1197 DraftedRequiresReview,
1198 }
1199
1200 #[nutype(
1201 sanitize(trim),
1202 validate(not_empty, len_char_max = 120),
1203 derive(
1204 Debug,
1205 Clone,
1206 PartialEq,
1207 Eq,
1208 PartialOrd,
1209 Ord,
1210 Hash,
1211 Serialize,
1212 Deserialize
1213 )
1214 )]
1215 pub struct QueueName(String);
1216}
1217
1218#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1219/// Decision taxonomy for external tool candidate in the agent tool workflow; each value carries operational meaning for source-grounded routing and review.
1220pub enum ExternalToolCandidate {
1221 /// Represents gingr portal in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1222 GingrPortal,
1223 /// Represents payment provider in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1224 PaymentProvider,
1225 /// Represents sms provider in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1226 SmsProvider,
1227 /// Represents email provider in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1228 EmailProvider,
1229 /// Represents file storage in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1230 FileStorage,
1231 /// Represents ocr or document ai in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1232 OcrOrDocumentAi,
1233 /// Represents camera or webcam provider in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1234 CameraOrWebcamProvider,
1235 /// Represents hermes kanban in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1236 HermesKanban,
1237 /// Represents hermes cron or webhook in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1238 HermesCronOrWebhook,
1239 /// Represents postgres in the agent tool decision model so the app can choose the correct evidence, review, or draft path without taking live action.
1240 Postgres,
1241}