feat: add OMP (Oh My Pi) provider compatibility

Support OMP as a host alongside pi:
- Convert OMP's array-format system prompts to string via systemPromptToText
- Guard against OMP passing the literal env-var name as the API key value
- Add ~/.omp/agent/auth.json to default auth path lookup
- Fix --list-models output to check both stdout and stderr
- Add OMP compatibility smoke test with isolated temp HOME and mock server
- Deduplicate usage section in README, add OMP install and usage docs
This commit is contained in:
AlexVagrant
2026-05-28 04:12:35 -04:00
committed by wh.huajieyu
parent b850558199
commit c2497ed098
9 changed files with 303 additions and 37 deletions
+3 -2
View File
@@ -12,7 +12,7 @@
* Models are fetched from Command Code's Provider API at startup.
*/
import { calculateCost, createAssistantMessageEventStream } from "@mariozechner/pi-ai"
import { AssistantMessageEventStream, calculateCost } from "@mariozechner/pi-ai"
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent"
import { COMMAND_CODE_CLI_VERSION, createStreamCommandCode, DEFAULT_API_BASE } from "./src/core.ts"
@@ -23,7 +23,7 @@ const API_BASE = process.env.COMMANDCODE_API_BASE ?? DEFAULT_API_BASE
const MODELS_URL = process.env.COMMANDCODE_MODELS_URL ?? DEFAULT_MODELS_URL
const streamCommandCode = createStreamCommandCode({
createStream: createAssistantMessageEventStream,
createStream: () => new AssistantMessageEventStream(),
calculateCost,
apiBase: API_BASE,
})
@@ -33,6 +33,7 @@ const streamCommandCode = createStreamCommandCode({
// ---------------------------------------------------------------------------
export default async function (pi: ExtensionAPI) {
const models = await fetchCommandCodeModels({ url: MODELS_URL })
pi.registerProvider("commandcode", {