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
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// Copyright (c) 2026 2youg1 and the sprawling contributors
//! The window and the ceiling the city would register for each row of a
//! model table the person left empty, each with the rung that answered
//! (`crates/wire/spec/Answer/ModelFigures.lean` ยง8-97, wire D58).
//!
//! Read shapes only: the ladder is `gateway::Figures::resolve`, the one
//! the pick point calls, so a page that draws these draws what a pick
//! with empty boxes registers rather than a second guess at it.
use kernel::{Ceiling, ModelTag, Window};
use serde::{Deserialize, Serialize};
/// One row of the table, as the page asks about it.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct FiguresAsked {
pub id: String,
/// The window the provider's own list stated for this row; absent
/// for a row the person named and the list did not carry.
pub context_tokens: Option<Window>,
/// The ceiling the provider's own list stated for this row.
pub max_output_tokens: Option<Ceiling>,
/// The role this row is to fill: the earlier registration of the
/// same model under this tag is a rung of its own.
pub tag: Option<ModelTag>,
}
/// Every row asked about, in the order asked.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct ModelFiguresAnswer {
pub models: Vec<FiguresLine>,
}
/// What one row would be registered with.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct FiguresLine {
pub id: String,
/// Absent when no rung states a window: the window is unknown and
/// the context reminder stays silent.
pub window: Option<WindowLine>,
/// Absent only when the policy default itself is zero, a state the
/// policy module's own test forbids.
pub ceiling: Option<CeilingLine>,
}
/// A window and the rung that stated it.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct WindowLine {
pub tokens: Window,
pub from: FigureFrom,
}
/// The ceiling a call would be made with.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum CeilingLine {
/// A figure every request states, and who stated it.
Sent { tokens: Ceiling, from: FigureFrom },
/// Nobody stated one on a face that takes none: the request leaves
/// the field out and the provider applies its own default.
ProviderDefault,
}
/// Who stated a figure, spelled as `model_selected` records it
/// (`window_from`, `ceiling_from`).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum FigureFrom {
/// A figure the person entered.
Person,
/// The provider's own model list.
Upstream,
/// What this tag was registered with when it last pointed at this
/// same model.
Registered,
/// The pinned catalogue or the preset table.
Preset,
/// The city's policy default; never the source of a window.
Policy,
}