Documentation
¶
Overview ¶
Package tutorstub is the stub of tutor in api's dev mode (R66; R146 spec): it stands behind the ports through which api calls tutor — the readings of a sheet, a workbook page and an essay, the assessment of an essay and the tutor's words — so that a run of the path on the dev projects calls no provider and costs nothing. Admission and the prices stay tutor's own, on the real table, by the gate the dev mode builds with the stub's adapter (admission.StubAdapters); only the calls are the stub's.
The stub reads a sheet by the shape of its crop: wider than tall is the right value, taller than wide a wrong one — the slot's first trap value, or the first value its check holds not right —, and square is illegible. It reads each filled box of a workbook page the same way, by the shape of the box's crop, and admits that reading itself wherever the gate admits a sheet's, for the same category and route: tutor v0.1.42 admits it nowhere (В72). It finds the values by module-kit's verdict on the instance, the key with it, which the stub alone is given: tutor sees the open view (R67 spec). It reads an essay by the shape of the sheet's crop too — wider than tall a text of its own, taller than wide a blank sheet, square illegible —, assesses the text every criterion met but the last, and admits both calls itself where the gate admits a sheet's reading, as it admits a workbook page. Its words — a rung's questions, the praise after a correct answer and the feedback on an essay — are its own, which pass the leak check and the form check. Each call spends what tutor expects a call of its kind to cost on its route, so that the quota runs out as on the models.
On an own key a call ends by how the key ends, as a provider would refuse it (KeyRefused and the endings beside it): api hands the stub the key's value beside the call, which tutor takes from the route alone, and the stub reads its ending and keeps nothing of it.
api takes the stub off a deployment alone: the configuration refuses it there, as R32 refuses the emulator of the sign-in service.
Index ¶
- Constants
- type Gate
- type Stub
- func (s *Stub) AssessEssay(ctx context.Context, r tutor.RubricAssessment, own string) tutor.RubricAssessed
- func (s *Stub) CorrectWords(category formatv0.AgeCategory, ownKeyProvider string) bool
- func (s *Stub) ReadEssay(ctx context.Context, r tutor.EssayReading, task formatv0.Task, own string) tutor.EssayRead
- func (s *Stub) ReadSheet(ctx context.Context, r tutor.SheetReading, task formatv0.Task, own string) tutor.SheetRead
- func (s *Stub) ReadWorkbook(ctx context.Context, r tutor.WorkbookReading, task formatv0.Task, own string) tutor.WorkbookRead
- func (s *Stub) Reads(call tutor.Call, category formatv0.AgeCategory, ownKeyProvider string) bool
- func (s *Stub) TellCorrectWords(ctx context.Context, c tutor.CorrectRequest, own string) tutor.CorrectAnswer
- func (s *Stub) TellWords(ctx context.Context, w tutor.WordsRequest, own string) tutor.WordsAnswer
- func (s *Stub) Words(withWork bool, category formatv0.AgeCategory, ownKeyProvider string) bool
Constants ¶
const ( KeyRefused = "-refused" KeyLimit = "-limit" KeyLimitOwner = "-limit-owner" KeyLimitTier = "-limit-tier" KeyLimitBalance = "-limit-balance" KeyLimitPayment = "-limit-payment" )
The endings of a synthetic own key that a call of AI on the stub reads, past the checks of the request's form, as a provider would answer it (the 2026-11-15 amendment to R66): the key refused, or a limit — named by none of tutor's reasons, or by one; the ceiling of the tier with when access returns, as tutor's adapter of Claude gives it (the 2026-11-16 amendment to R66). A key that ends in none of them calls the stub as platform AI does. README.md names them for app; CheckOwnKey takes them all.
const Model = "stub"
Model is the model the stub's usage names in the log's line ai_usage, so that no line of it is taken for a model's.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gate ¶
type Gate interface {
Reads(call tutor.Call, category formatv0.AgeCategory, ownKeyProvider string) bool
Words(withWork bool, category formatv0.AgeCategory, ownKeyProvider string) bool
CorrectWords(category formatv0.AgeCategory, ownKeyProvider string) bool
Price(call tutor.Call, route tutor.Route) tutor.CallPrice
}
Gate is what the stub asks of the gate of admission: whether a reading and the tutor's words are admitted, and what a call is expected to cost.
type Stub ¶
type Stub struct {
// contains filtered or unexported fields
}
Stub reads sheets, workbook pages and essays, assesses essays and words the tutor's words in place of tutor.
func (*Stub) AssessEssay ¶ added in v0.1.49
func (s *Stub) AssessEssay(ctx context.Context, r tutor.RubricAssessment, own string) tutor.RubricAssessed
AssessEssay assesses the text of r by the criteria of its rubric as the stub does: every criterion met but the last, each with the stub's synthetic evidence, and the stub's feedback in the language of r — English for a language it has no words of —, which passes the leak check and words.Feedback against any text, since it quotes none (the author's decision of 2026-11-15). Of tutor's checks before its call the stub keeps those of the request's form: no text, no criterion or a blank one, no topic, no style, or a language words.Feedback cannot check, fails, as does a request whose context ended, every criterion without a mark. Past those checks an own key of an ending of the stub's, own being its value, is refused by it. The call spends the expected price of CallRubric on the route, which tutor v0.1.35 does not give: none, so the quota keeps its reserve by the value of the kind as spent (R12, R82).
func (*Stub) CorrectWords ¶ added in v0.1.45
func (s *Stub) CorrectWords(category formatv0.AgeCategory, ownKeyProvider string) bool
CorrectWords says whether the tutor's words after a correct answer are admitted, as the gate says.
func (*Stub) ReadEssay ¶ added in v0.1.49
func (s *Stub) ReadEssay(ctx context.Context, r tutor.EssayReading, task formatv0.Task, own string) tutor.EssayRead
ReadEssay reads the essay of r, on task, by the shape of the crop of its sheet, as ReadSheet reads a sheet: wider than tall the stub's text, essayText; taller than wide a blank sheet, UNREADABLE_BLANK; square illegible, UNREADABLE_ILLEGIBLE (the author's decision of 2026-11-15). One reader reads it, as tutor's one model does, and the observation is of the one answer slot bound to the sheet, a value with no crop box, as tutor's. Of tutor's checks before its call the stub keeps those of the request's form: a task that is no handwriting sheet, has no slot bound to the sheet, more than one, or a slot bound otherwise, no open view of the task, a crop that is no PNG or is larger than maxCropSide on a side, and a request whose context ended, fail. Past those checks an own key of an ending of the stub's, own being its value, is refused by it. The call spends the expected price of CallEssay on the route, which tutor v0.1.35 does not give: none, so the quota keeps its reserve by the value of the kind as spent (R12, R82).
func (*Stub) ReadSheet ¶
func (s *Stub) ReadSheet(ctx context.Context, r tutor.SheetReading, task formatv0.Task, own string) tutor.SheetRead
ReadSheet reads the crop of r by its shape, on task, the instance whose open view r holds: both readers read the same, so module-kit joins them as they are. A value stands with the crop box of the whole crop, in thousandths, and a reason with none, as an observation has them (R53 spec). A task with no answer slot bound anywhere, a crop that is no PNG, or a request whose context ended while the stub looked for a value, fails, as tutor's reading does. Past those checks an own key of an ending of the stub's is refused by it, own being its value.
func (*Stub) ReadWorkbook ¶ added in v0.1.49
func (s *Stub) ReadWorkbook(ctx context.Context, r tutor.WorkbookReading, task formatv0.Task, own string) tutor.WorkbookRead
ReadWorkbook reads the filled boxes of the workbook page of r, on task, the instance whose open view r holds, each by the shape of its crop as ReadSheet reads a sheet's: wider than tall the box's right value, taller than wide a wrong one, square illegible. The observation holds every box of the page in the task's order, a box that sent no crop unreadable, blank, and a value with no crop box, as tutor's does; both readers read the same. Of tutor's checks before its call the stub keeps those of the request's form: a task that is no workbook page, a crop of a place the page has no box of or of one box twice, more than maxBoxes crops, or a crop that is no PNG or is larger than maxBoxSide on a side fails, as does a request whose context ended while the stub looked for the values. A page with no crop goes to no model and spends nothing, as tutor's does; past those checks an own key of an ending of the stub's, own being its value, is refused by it. The call spends the expected price of CallWorkbook on the route, which tutor v0.1.35 does not give: none, so the quota keeps its reserve by the value of the kind as spent (R12, R81).
func (*Stub) Reads ¶ added in v0.1.49
Reads says whether the reading by the call of the kind is admitted for a learner of category, on the route of ownKeyProvider: the reading of a workbook page, of an essay and the essay's assessment wherever the gate admits a sheet's, CallSheet, for the same category and route, since no entry of tutor v0.1.35 admits any of the three (В72; the 2026-11-15 amendments to R66); and any other kind as the gate says.
func (*Stub) TellCorrectWords ¶ added in v0.1.45
func (s *Stub) TellCorrectWords(ctx context.Context, c tutor.CorrectRequest, own string) tutor.CorrectAnswer
TellCorrectWords words the stub's praise in the language of c — of a step of the work when the work went, of the option chosen when it did not — with a question on the technique that helped as its last sentence, or, when the task names no technique, on how the answer was found, as tutor's prompt asks (R112 tutor). They hold no number and tell no sex, so they pass the leak check and words.Correct. A language the stub has no words of gets English. Of tutor's checks before its call the stub keeps those of the request's form: no task, no style, no language, or a crop that is no PNG fails with no usage; the words of the task and the size of the crop it does not read. The call spends the expected price of CallCorrect, with the work or without it. Past those checks an own key of an ending of the stub's, own being its value, is refused by it.
func (*Stub) TellWords ¶
func (s *Stub) TellWords(ctx context.Context, w tutor.WordsRequest, own string) tutor.WordsAnswer
TellWords words a question of the stub's own in the language of w: the first one of its list that w has not asked yet, so "explain differently" gets other words, and, once all were asked, the list again from its start. A language the stub has no list of gets English, which the form check turns down into the rung's fallback text. An own key of an ending of the stub's, own being its value, is refused by it.