From 1e0dd1189cb7dbc28cd90fbe346455803a6fa0b1 Mon Sep 17 00:00:00 2001 From: Omar Iqbal Naru Date: Fri, 21 Aug 2026 19:41:54 +0500 Subject: [PATCH 1/2] fix(core): register custom api under non-reserved name for omp 17.4.0 omp 17.4.0's host registry rejects registerCustomApi calls under built-in api names ("Cannot register custom API '': built-in API names are reserved"). The provider and its models registered under "openai-completions", so the extension failed to load. Register under "commandcode-custom" instead (matches the published npm build) and restore the real wire api via apiForModelId before dispatching to the native compat stream inside the transport router. The host's model registry also stores provider-supplied compat under model.compatConfig internally, only copying it back to model.compat inside its own dispatch-time patches. Since the transport router calls the native compat stream directly, it must read compatConfig itself or requests crash with 'baseCompat is undefined' before any network call. Verified against a local mock Provider API server with the extension linked into omp 17.4.0: model discovery lists all Command Code models, and a streamed chat completion sends the resolved x-cmd-zdr header and Authorization header end to end. --- index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index 72ae558..79349bd 100644 --- a/index.ts +++ b/index.ts @@ -19,6 +19,7 @@ import { getConfiguredApiKey } from "./src/api-key.ts" import { createStreamCommandCode } from "./src/core.ts" import { calculateCommandCodeCost } from "./src/cost.ts" import { + apiForModelId, baseUrlForModel, DEFAULT_MODELS_URL, DEFAULT_PROVIDER_API_BASE, @@ -51,7 +52,7 @@ function createProviderConfig( name: "Command Code", baseUrl: apiBase, apiKey: getConfiguredApiKey() ?? "$COMMANDCODE_API_KEY", - api: "openai-completions", + api: "commandcode-custom", streamSimple: streamCommandCode, headers, oauth: { @@ -63,7 +64,7 @@ function createProviderConfig( models: models.map((model) => ({ id: model.id, name: model.name, - api: model.api, + api: "commandcode-custom", baseUrl: baseUrlForModel(apiBase, model.api), reasoning: model.reasoning, ...(thinkingMetadataForModel(model.id) ?? {}), @@ -108,7 +109,12 @@ export default async function (pi: ExtensionAPI) { }) const transport = createCommandCodeTransportRouter({ createStream: () => new AssistantMessageEventStream(), - streamProvider: streamNativeProvider, + streamProvider: (model, context, options) => + streamNativeProvider( + { ...model, api: apiForModelId(model.id), compat: model.compatConfig ?? model.compat }, + context, + options, + ), streamGenerate, }) From 0d6202aec7fac14912d9baa3de5deaf716207292 Mon Sep 17 00:00:00 2001 From: Omar Iqbal Naru Date: Fri, 21 Aug 2026 19:42:14 +0500 Subject: [PATCH 2/2] docs(release): note omp custom api registration fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3cd9b..d01c553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Add optional zero-data-retention headers through `COMMANDCODE_ZDR=1`. - Refresh GPT-5.6 Terra and Luna display prices after their temporary 50% promotion ended, and display the current DeepSeek V4 off-peak rates for its time-dependent pricing. - Add isolated live E2E profiles for separate Go-plan and Provider-API credentials, including an explicit selected-transport assertion and packed-package validation. +- Fix extension load failure on newer pi hosts that reject registering a custom API under a built-in name (`openai-completions`); register under `commandcode-custom` instead and restore the real wire API before native compat dispatch. ## 0.5.1 - 2026-08-11