Expand description
HTTP API for predictive typing (/api/predict/*): the system-wide inline
autocomplete brain.
GET /api/predict/config→ the normalizedPredictConfig(defaults applied) so the desktop settings tab and theapps-store/predictoverlay both read one shape in a single call.PUT /api/predict/config→ persist the config blob.POST /api/predict/complete→ given the caret context, return a single inline suggestion. Enforces the app allowlist + the secure-field denylist here (Core decides what runs), then hands the model call to the Gateway viaPredictHost::call_side_model(the same path/btwuses).
Pure logic (prompt assembly, denylist, cleanup) lives in the crate root.
The router is built with its own state (PredictCtx) inside this crate so it
returns a state-less, mergeable Router<()>. Routes are declared relative to
/api/predict (Core nests this service at that prefix behind the Predict-App
gate), while the OpenAPI annotations keep the full external paths.
Structs§
- Complete
Body POST /api/predict/completerequest body.contextis the text immediately before the caret (the model context).appis the focused process name (for the allowlist).controlis the focused control’s localized type (for the secure-field denylist).agent_idoptionally overrides the model.- Complete
Response POST /api/predict/completeresponse.suggestionis empty when there is nothing to suggest OR the request was refused (disabled / app not allowed / secure field / no context) —reasonsays which, for diagnostics.- Predict
Ctx - Router state for the predict HTTP surface: the
PredictHostthat inverts the kernel couplings (enabled flag, preferences, agent-bound model, default model, Gateway side-model call). Cloneable so the router bakes a concrete state and returnsRouter<()>.
Functions§
- complete
POST /api/predict/complete— return one inline suggestion for the caret context. Always 200 with a (possibly empty) suggestion; refusals carry areasonrather than an error status, so the dumb overlay never has to branch on HTTP codes.- get_
config GET /api/predict/config— the normalized predictive-typing config.- openapi
- The OpenAPI sub-document for the predict surface, merged into Core’s spec.
- put_
config PUT /api/predict/config— persist the predictive-typing config.- routes
- Build the
/api/predict/*router with its own state baked in, returning a state-lessRouter<()>the host nests at/api/predictbehind the App gate.