hezarfen_backend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! The table of capabilities the **backend** serves — the operations a |
| 2 | //! service calls over the bridge's client-initiated `CapabilityRequest` shape |
| 3 | //! (`hab/2`'s third request kind), and each one's scope. |
| 4 | //! |
| 5 | //! There is one table per capability family, and this module is the walk over |
| 6 | //! them: [`crate::ai::insight`] serves ZEKA's storage surface, |
| 7 | //! [`crate::ai::podcast`] serves the podcast job's state reports. Both answer |
| 8 | //! the same frame, both are dispatched from the same place — the bridge's |
| 9 | //! capability dispatcher in `ai::server` — and neither owns the other's |
| 10 | //! names: a name neither table holds is `unknown_capability`, with no prefix |
| 11 | //! match and no fallback, exactly as the two tables' own doc comments say. |
| 12 | //! |
| 13 | //! The scope decides one thing only: whether the bridge resolves the frame's |
| 14 | //! school before the operation runs. A [`Scope::School`] operation runs against |
| 15 | //! the named school's own database — the frame's school is the *only* tenancy |
| 16 | //! input, and a school id that matches nothing is `unknown_school`, never a |
| 17 | //! fallback to another school or to the control database. |
| 18 | |
| 19 | use Value; |
| 20 | |
| 21 | use cratepodcast; |
| 22 | use crateAI_PODCAST_REPORT_CAPABILITY; |
| 23 | use crateDatabase; |
| 24 | use crateResolvedTenant; |
| 25 | |
| 26 | pub use crateScope; |
| 27 | |
| 28 | /// The refusal shape every backend-served capability answers with: a flat, |
| 29 | /// stable code and a message that names the field or reason. Same alias as |
| 30 | /// [`crate::ai::insight::Refusal`] — one vocabulary across families. |
| 31 | pub type Refusal = ; |
| 32 | |
| 33 | /// Every capability the podcast family serves, and its scope. One entry today; |
| 34 | /// a table rather than a match arm so the walk in [`scope_of`] and the |
| 35 | /// dispatch in [`serve`] are structurally the same decision, and a second |
| 36 | /// podcast operation is one added row. |
| 37 | pub const PODCAST_SERVED: & = &; |
| 38 | |
| 39 | /// The scope of one backend-served capability, or `None` if no family serves |
| 40 | /// it. Matched exactly, family by family, in a fixed order. |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | /// Run one backend-served capability. The caller (the bridge) resolves the |
| 51 | /// school *before* this is called, from [`scope_of`]'s answer — a |
| 52 | /// [`Scope::Deployment`] operation gets `None`, and a [`Scope::School`] one |
| 53 | /// always gets the tenant. |
| 54 | pub async |
| 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 |