pi 0.87 made the session transcript canonical for provider context: the
context handed to a custom provider's stream no longer carries
`systemPrompt` and `tools`; they live on the leading system message
(`sections` + `toolsAdded`). streamQoder still read the removed fields,
so every request went out with `system: ""` and `tools: []` - the model
saw no prompt and no tools and answered that it cannot access files.
- resolve the prompt with getCurrentSystemPrompt(messages) and the tool
list with getCurrentTools(messages)
- give tool parameters a root `type: "object"`: Qoder's upstream rejects
a union root ("schema must be a JSON Schema of 'type: \"object\"', got
'type: null'"), e.g. the agent-browser Electron tool, which failed the
whole request with a 400
- bump the pi-ai / pi-coding-agent devDependencies to ^0.87.1 and cover
the transcript prompt/tools path with a regression test
OMP rewrites @earendil-works/pi-ai/compat to a bundle without
registerApiProvider, which broke static import at install/load.
Probe the export at runtime; stock pi still registers qoder-api for
global streamSimple, while OMP relies on registerProvider(streamSimple).
Pi 0.84+ no longer registers custom APIs from registerProvider.streamSimple,
so a later agent-loop path threw No API provider registered for api: qoder-api.
- Resolve the real Qoder identity (userID/email/name/machineID) from the
job token at request time. OMP keeps login credentials in its own
agent.db, not in ~/.pi/agent/auth.json, so a cache miss sent uid
"qoder-user" and Qoder CN rejected it with "Login expired" (105).
- Normalize the system prompt to a plain string. OMP supplies it as a
single-element content array which Qoder's MessagesInputDto#content
(String) rejects with 400 "Execution failed: set property" on qwen models.
- Drop the modifyModels hook. OMP (Bun) structuredClones the whole model
catalog before invoking it, and its bundled catalog is not cloneable,
which removed qoder from `omp models`.
- Make the build script cross-platform: use esbuild on PATH instead of a
Unix-style ./node_modules path that fails on Windows cmd.exe.
The "files" field in package.json only includes "dist" and "README.md",
so src/index.ts is not available in the published npm package.
This was introduced in commit 1b110a6 ("fix index") which changed
the path from the correct "./dist/index.js" to "./src/index.ts".
When assistant messages contain only tool_calls (no text/thinking), transform.ts
was setting content to null. Qoder's gateway drops these null-content assistant
messages, orphaning the following tool_result and causing upstream rejections:
- dmodel (OpenAI): 'tool must follow a message with tool_calls'
- ultimate (Anthropic): 'unexpected tool_use_id in tool_result blocks'
Analysis of 28 historical sessions showed 100% failure rate on dmodel and 75%
on ultimate for this pattern, while auto/GLM5.2 (GLM upstream) tolerated it.
Fix: inject a single-space placeholder when tool_calls are present but content
is empty, so the gateway preserves the assistant message and tool pairing stays
valid.
Also fixes pre-existing lint formatting in stream.ts and package.json.
Adds regression test for the full assistant+toolResult pairing scenario.
The custom ctx.ui.custom login menu stole focus from pi's built-in
LoginDialog, so onPrompt never received keystrokes and PAT login
silently failed with 'No API key found'. Drive login via the provided
onPrompt/onAuth/onProgress callbacks instead, and drop login-ui.ts and
the now-unused pi-tui dependency. Also clears remaining lint warnings
by removing any-casts in models/oauth/stream/transform.