Fixes premature AI API response truncation by propagating inference
parameters through the entire probe → storage → runtime → API call chain.
Root cause: Ollama defaults num_predict to 128 tokens and num_ctx to
4096, silently truncating output and context. We never overrode these.
Changes:
- IAiModelSettings: add numPredict, maxCompletionTokens fields
- IDroneModelConfig: moved from gadget-drone to @gadget/api (shared),
expanded with numPredict, numCtx, maxCompletionTokens params
- IAiModelConfig.params: add numPredict, numCtx, maxCompletionTokens
- IAiModelProbeResult.settings: add numPredict, maxCompletionTokens
- AiModelSettingsSchema (Mongoose): add numPredict, maxCompletionTokens
- Ollama extractSettings(): extract num_predict from model parameters
- Ollama generate()/chat(): pass options: { num_ctx, num_predict }
- OpenAI all three create() calls: add max_completion_tokens
- web-cli.ts onProviderProbe(): compute numPredict (-1 for Ollama)
and maxCompletionTokens (contextWindow for OpenAI) during probe
- agent.ts main + subagent loops: read model settings from provider
cached models, build IDroneModelConfig with stored params
- ai.ts: remove local IDroneModelConfig, import from @gadget/api
- chat-session.ts: add new params to title generation call
- Tests: update all fixtures with new params, all 19 tests pass
Defaults when model settings unavailable:
- numPredict: -1 (Ollama unlimited - generate until natural stop)
- numCtx: 131072 (128k - covers most modern models)
- maxCompletionTokens: 16384 (16k - reasonable OpenAI default)
User Settings will enable User to enter a Persona, or a description of
the User, to be included in the system prompt. This helps calibrate the
agent to better assist the User, and work with the User in ways that
work best for each individual User of the system.
- Resolve duplicate DroneStatus enum (import from @gadget/api)
- Fix IAiProvider interface conflict with DB→runtime mapper
- Add callId to ToolCallMessage and ChatToolCallSchema
- Fix ChatTurnStats schema field name (thinkingTokenCount)
- Add provider/selectedModel to ChatSession interface and model
- Implement CodeSession.onSubmitPrompt() to create ChatTurn and send work orders
- Add drone/chat session tracking to CodeSession
- Add unit tests for CodeSession (9 tests, all passing)
We want to speak only one language when dealing with AI content to
minimize the number of maps, transforms, and copies. This initiative
isn't done, this is a checkpoint along the way while conducting
experiments.
Moved all Mongoose model interfaces to @gadget/api to commonize the data
structures being passed around the system as JSON objects via HTTP and
Socket.IO.