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
//! `oino-models`: the pi 1.4.0 model registry, `models.json`, model resolution, `auth.json`
//! storage and virtual models for Oino.
//!
//! Providers are WASM components: this crate never streams. It stores provider
//! *registrations* (extension-api §4.4) and their models, merges `models.json` and config
//! overrides exactly in pi's order, resolves credentials per request (core passes them to the
//! component as `StreamOptions.apiKey`/`headers`) and resolves `--model`/`--models`/defaults.
//! It has no async runtime; OAuth refresh is an injected [`OAuthRefresher`] future.
//!
//! # API map
//!
//! | Item | pi equivalent | Purpose |
//! |---|---|---|
//! | [`ModelRegistry`] | `ModelRegistry` / `ModelRuntime` | shared catalog + auth (`Arc<RwLock>`) |
//! | [`ProviderRegistration`], [`ProviderConfigOverride`] | native provider, `registerProvider(name, config)` | provider data |
//! | [`ModelsJson`] | `ModelConfig` | `models.json` load with pi diagnostics |
//! | [`AuthStorage`], [`AuthCredential`] | `AuthStorage`, `Credential` | `auth.json` with locking, runtime keys |
//! | [`auth::oauth`] | `auth/resolve.ts` | OAuth expiry + locked refresh |
//! | [`config_value`] | `resolve-config-value.ts` | `literal \| $ENV \| ${ENV} \| !command` |
//! | [`resolver`] | `model-resolver.ts`, `cycleModel` | `--model`, scopes, initial model, restore, cycling |
//! | [`virtual_models`] | `virtual-models.ts` | definitions, route wire types, validation, branch state |
//! | [`auth_check`] | `cli/auth-check.ts` | `oino auth check` (exit 0/1/2) |
//! | [`ModelCache`] | `models-store.json` | `<agent>/cache/models/<provider>.json` |
//! | [`auth::guidance`] | `auth-guidance.ts` | "No API key found …" texts |
//!
//! # Deviations from pi
//!
//! - No built-in catalog: models come from registrations (static or `list-models`) and
//! `models.json`. A model is *available* only when its provider has credentials **and** a loaded
//! component implements its API ([`ModelRegistry::diagnostics`] lists the others).
//! - Config overrides keep the provider component's registration (pi replaces a native provider).
//! - Registration `authHeader` is informational; `Authorization: Bearer` is injected only for
//! `models.json`/override `authHeader: true`, like pi.
//! - Credential order follows pi's code: `--api-key` > `auth.json` > `models.json`/override
//! `apiKey` > registration `authEnv` (runtime.md §13 lists env before `apiKey`; pi's docs and
//! code put `apiKey` first).
//! - `models.json` `compat` is only checked for being an object; JSON syntax errors use
//! `serde_json` wording; `oauth: "radius"` validates but has no flow in core.
//! - Virtual router state equal to the current state is not re-stored (no object identity
//! across WASM).
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;