You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/09/17 13:10:04 UTC
(maka) branch main updated: fix(runtime): let Command Code GO work without an install flag (#5442)
This is an automated email from the ASF dual-hosted git repository.
M4n5ter pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git
The following commit(s) were added to refs/heads/main by this push:
new f9d3efd4cc fix(runtime): let Command Code GO work without an install flag (#5442)
f9d3efd4cc is described below
commit f9d3efd4ccd54533ff5d6dd73dda52e9609a1a4c
Author: Yunpei Zhou <Jo...@outlook.com>
AuthorDate: Thu Sep 17 21:09:58 2026 +0800
fix(runtime): let Command Code GO work without an install flag (#5442)
* fix(runtime): let Command Code GO work without an install flag
The transport was gated on MAKA_COMMANDCODE_CLI_TRANSPORT_EXPERIMENTAL,
read in the Runtime Host process. On a packaged Desktop build nothing
reaches that process short of launching the app from a terminal with the
variable set, so the provider could be added and then failed every turn.
`launchctl setenv` does not reach it either. The gate made the provider
unusable rather than optional.
Picking the provider is the choice: nothing else routes to this wire and
no other provider falls back to it.
Also drops docs/commandcode-cli-transport.md and trims the module and
registry comments to the wire's technical shape, keeping the pointer to
the two MIT-licensed projects that describe it.
Claude-Session: https://claude.ai/code/session_014ajaRxC4jydavY9nYUFj5J
* fix(desktop): ask before adding a provider that states its transport
Removing the install flag also removed the only sentence that told a user
what this provider does: the card said "official CLI transport" and
nothing more, so choosing it was not an informed acceptance of anything.
Adding a Command Code GO connection now requires an explicit answer on
the form. The notice names what the request looks like on the other end
— the endpoint the CLI uses, its identity headers rather than Maka's, and
that neither is part of the published Provider API — and the connection
is not created until the box is ticked. This reuses the form-level gate
already there for phase3-experimental rather than adding a second
mechanism, and it puts the statement next to the decision, which is what
an environment variable no supported flow could set never did.
Claude-Session: https://claude.ai/code/session_014ajaRxC4jydavY9nYUFj5J
* fix(desktop): make the transport acknowledgement reachable
The gate added in the previous commit could not fire for the one
provider it exists for. Command Code GO takes the quick API-key dialog,
which returns its own subtree before the notice rendered, and submits
through a route that returns before `validateAddProviderDraft` runs. The
notice was never shown and the rule was never consulted; the tests
stayed green because they asserted the rule rather than the form.
The notice and its checkbox are now one fragment rendered by every route
the form takes, and `submit()` checks the answer ahead of all of them,
including the managed-onboarding branch that returns early.
A mounted test covers it in all three locales: the checkbox is in the
DOM, and submitting without it refuses and says why. It submits through
the form rather than clicking the button, because this route has no
`onClick` and a bare click asserts nothing.
Also from review: the card says "private transport" again, so the
surface a user meets first is no longer the least disclosing one; the
checkbox group no longer shares its accessible name with its only item;
and the order of the two form-level rules is stated.
Claude-Session: https://claude.ai/code/session_014ajaRxC4jydavY9nYUFj5J
---
.../connection-settings-locale-render.test.ts | 53 +++++++++
.../main/__tests__/provider-add-submission.test.ts | 34 ++++++
.../connection-settings/settings-provider-copy.ts | 15 +++
.../src/renderer/settings/provider-add-form.tsx | 49 +++++++-
.../renderer/settings/provider-add-submission.ts | 28 ++++-
.../src/renderer/settings/provider-display-copy.ts | 6 +-
docs/commandcode-cli-transport.md | 129 ---------------------
packages/core/src/provider-registry.ts | 6 +-
.../commandcode-cli-language-model.test.ts | 33 +-----
.../src/__tests__/provider-contract-overrides.ts | 45 +++----
.../runtime/src/commandcode-cli-language-model.ts | 42 +------
packages/runtime/src/model-factory.ts | 10 +-
packages/runtime/src/test-connection.ts | 5 -
13 files changed, 208 insertions(+), 247 deletions(-)
diff --git a/apps/desktop/src/main/__tests__/connection-settings-locale-render.test.ts b/apps/desktop/src/main/__tests__/connection-settings-locale-render.test.ts
index def0683f4c..0fd1c6a4bd 100644
--- a/apps/desktop/src/main/__tests__/connection-settings-locale-render.test.ts
+++ b/apps/desktop/src/main/__tests__/connection-settings-locale-render.test.ts
@@ -134,6 +134,8 @@ after(async () => {
const localeCases = [
{
locale: 'zh-CN', direct: '直连', transit: '成员转发', save: '保存供应商',
+ transportNotice: '这个供应商走官方 CLI 的私有通道',
+ transportRequired: '请先勾选上面的确认再添加。',
slugErrors: {
required: '请填写连接标识',
format: '连接标识只能包含小写字母、数字和连字符',
@@ -143,6 +145,8 @@ const localeCases = [
},
{
locale: 'zh-TW', direct: '直接連線', transit: '成員轉送', save: '儲存供應商',
+ transportNotice: '這個供應商走官方 CLI 的私有通道',
+ transportRequired: '請先勾選上面的確認再新增。',
slugErrors: {
required: '請填寫連線標識',
format: '連線標識只能包含小寫字母、數字和連字號',
@@ -152,6 +156,8 @@ const localeCases = [
},
{
locale: 'en', direct: 'Direct', transit: 'Member transit', save: 'Save provider',
+ transportNotice: "This provider uses the official CLI's private transport",
+ transportRequired: 'Tick the acknowledgement above before adding.',
slugErrors: {
required: 'Enter a connection identifier',
format: 'Connection identifiers use lowercase letters, digits, and hyphens',
@@ -263,6 +269,53 @@ for (const copy of localeCases) {
assert.deepEqual(calls, [], 'invalid identifiers must not reach the provider bridge');
});
}
+
+ /**
+ * Mounted rather than asserted through the draft rule alone: Command Code GO
+ * takes the quick API-key dialog, which returns its own subtree and submits
+ * through a route that returns before that rule runs. A test of the rule
+ * stays green while the notice never renders and the check never fires.
+ */
+ test(`${copy.locale}: Command Code GO states its transport and refuses until answered`, async () => {
+ const harness = installRenderer();
+ const calls: string[] = [];
+ const bridge = {
+ create: async () => { calls.push('create'); throw new Error('unexpected create'); },
+ fetchModels: async () => { calls.push('fetchModels'); throw new Error('unexpected discovery'); },
+ } as unknown as ConnectionsBridge;
+ await harness.render(copy.locale, createElement(components.AddProviderForm, {
+ bridge, providerType: 'commandcode-go', existingSlugs: [],
+ onCancel: unexpectedCall, onCreated: unexpectedCall,
+ }));
+
+ const checkbox = harness.document.querySelector<HTMLInputElement>('input[type="checkbox"]');
+ assert.ok(checkbox, 'the transport acknowledgement never rendered');
+ assert.equal(checkbox.checked, false);
+ assert.ok(
+ harness.document.body.textContent?.includes(copy.transportNotice),
+ 'the transport notice never rendered',
+ );
+
+ // This route submits through the form rather than an `onClick`, and a
+ // bare `button.click()` does not submit here — asserting on it would pass
+ // while nothing ran.
+ const form = harness.document.querySelector('form');
+ assert.ok(form, 'missing add-provider form');
+ assert.ok(
+ [...harness.document.querySelectorAll('button')].some(
+ (button) => button.textContent === copy.save,
+ ),
+ 'missing save button',
+ );
+ await act(async () => {
+ form.dispatchEvent(new globalThis.Event('submit', { bubbles: true, cancelable: true }));
+ });
+ assert.deepEqual(calls, [], 'an unanswered acknowledgement must not reach the provider bridge');
+ assert.ok(
+ harness.document.body.textContent?.includes(copy.transportRequired),
+ 'refusing the add must say why',
+ );
+ });
}
test('zh-TW: expanded Peer Mesh members render localized route states', async () => {
diff --git a/apps/desktop/src/main/__tests__/provider-add-submission.test.ts b/apps/desktop/src/main/__tests__/provider-add-submission.test.ts
index b9bd3fbbd3..26b3f58865 100644
--- a/apps/desktop/src/main/__tests__/provider-add-submission.test.ts
+++ b/apps/desktop/src/main/__tests__/provider-add-submission.test.ts
@@ -26,6 +26,7 @@ import {
initialOnboardingModelIds,
shouldShowManagedOnboardingOutcomeUnknown,
stableOnboardingModels,
+ providerRequiresAcknowledgement,
validateAddProviderDraft,
type AddProviderDraft,
type AddProviderField,
@@ -127,12 +128,45 @@ test('no provider type demands a model id at creation', () => {
apiKey: 'sk-test',
baseUrl: 'https://example.com/v1',
cloudflareAccountId: 'account-id',
+ // The rule under test is about the model id, so every other gate is
+ // satisfied here — including the acknowledgement a provider may ask
+ // for, which has its own test below.
+ acknowledged: true,
}),
);
assert.equal(issue, null, `${providerType} refused a draft with no model id`);
}
});
+/**
+ * Command Code GO reaches the wire the official CLI uses and presents that
+ * CLI's identity rather than Maka's. That is stated on the form, and the
+ * statement is only worth making if the user has to answer it.
+ */
+test('a provider that states its transport is not added until the user answers', () => {
+ const providerType: ProviderType = 'commandcode-go';
+ assert.equal(providerRequiresAcknowledgement(providerType), true);
+ assert.deepEqual(validateAddProviderDraft(draft({ providerType, slug: 'cc-go' })), {
+ field: 'form',
+ reason: 'acknowledgement',
+ });
+ assert.equal(
+ validateAddProviderDraft(draft({ providerType, slug: 'cc-go', acknowledged: true })),
+ null,
+ );
+});
+
+test('no other provider asks for an acknowledgement', () => {
+ for (const providerType of Object.keys(PROVIDER_REGISTRY) as ProviderType[]) {
+ if (providerType === 'commandcode-go') continue;
+ assert.equal(
+ providerRequiresAcknowledgement(providerType),
+ false,
+ `${providerType} unexpectedly asks for an acknowledgement`,
+ );
+ }
+});
+
// The second. Discovery failures were reported for every provider except the
// custom relays, which are the endpoints most likely to be misconfigured.
test('a discovery failure reaches the caller for a custom relay', async () => {
diff --git a/apps/desktop/src/renderer/features/connection-settings/settings-provider-copy.ts b/apps/desktop/src/renderer/features/connection-settings/settings-provider-copy.ts
index 6961bcf689..30b75eeacf 100644
--- a/apps/desktop/src/renderer/features/connection-settings/settings-provider-copy.ts
+++ b/apps/desktop/src/renderer/features/connection-settings/settings-provider-copy.ts
@@ -241,6 +241,11 @@ const zhCopy = {
add: {
slugIssues: { required: '请填写连接标识', format: '连接标识只能包含小写字母、数字和连字符', too_long: '连接标识不能超过 64 个字符' }, duplicateSlug: '连接标识已存在', cloudflareAccount: '请填写 Cloudflare Account ID', endpointRequired: '这个供应商需要填写服务地址',
accountLogin: '请到账号连接完成登录;登录成功后会自动创建模型连接。',
+ transportNoticeTitle: '这个供应商走官方 CLI 的私有通道',
+ transportNoticeDetail:
+ '请求发往该 CLI 使用的接口,并带上它的身份标识,而不是 Maka 的;该接口不属于已公开的 Provider API。',
+ transportAcknowledgeLabel: '我了解上述情况,并自行承担',
+ transportAcknowledgeRequired: '请先勾选上面的确认再添加。',
apiKeyPlaceholder: '输入或粘贴 API Key', cancel: '取消', accountTitle: '使用账号连接登录',
advancedRequest: '高级请求设置', expandAdvancedRequest: '展开高级请求设置', collapseAdvancedRequest: '收起高级请求设置',
requestHeaders: '自定义请求头', headerName: '请求头名称', headerValue: '请求头值', retainedHeaderValue: '保留已保存的值', addHeader: '添加请求头', removeHeader: '移除', noRequestHeaders: '未设置自定义请求头。',
@@ -439,6 +444,11 @@ const zhTwCopy = {
add: {
slugIssues: { required: '請填寫連線標識', format: '連線標識只能包含小寫字母、數字和連字號', too_long: '連線標識不能超過 64 個字元' }, duplicateSlug: '連線標識已存在', cloudflareAccount: '請填寫 Cloudflare Account ID', endpointRequired: '這個供應商需要填寫服務地址',
accountLogin: '請到帳號連線完成登入;登入成功後會自動建立模型連線。',
+ transportNoticeTitle: '這個供應商走官方 CLI 的私有通道',
+ transportNoticeDetail:
+ '請求發往該 CLI 使用的介面,並帶上它的身分標示,而不是 Maka 的;該介面不屬於已公開的 Provider API。',
+ transportAcknowledgeLabel: '我了解上述情況,並自行承擔',
+ transportAcknowledgeRequired: '請先勾選上面的確認再新增。',
apiKeyPlaceholder: '輸入或貼上 API Key', cancel: '取消', accountTitle: '使用帳號連線登入',
advancedRequest: '高階請求設定', expandAdvancedRequest: '展開高階請求設定', collapseAdvancedRequest: '收起高階請求設定',
requestHeaders: '自訂請求頭', headerName: '請求頭名稱', headerValue: '請求頭值', retainedHeaderValue: '保留已儲存的值', addHeader: '新增請求頭', removeHeader: '移除', noRequestHeaders: '未設定自訂請求頭。',
@@ -638,6 +648,11 @@ const enCopy: ProviderSettingsCopy = {
add: {
slugIssues: { required: 'Enter a connection identifier', format: 'Connection identifiers use lowercase letters, digits, and hyphens', too_long: 'Connection identifiers are at most 64 characters' }, duplicateSlug: 'Connection identifier already exists', cloudflareAccount: 'Enter the Cloudflare Account ID', endpointRequired: 'This provider requires a service URL',
accountLogin: 'Complete sign-in under account connections. A model connection is created automatically afterward.',
+ transportNoticeTitle: 'This provider uses the official CLI\'s private transport',
+ transportNoticeDetail:
+ 'Requests go to the endpoint that CLI uses and carry its identity headers rather than Maka\'s. The endpoint is not part of the published Provider API.',
+ transportAcknowledgeLabel: 'I understand and accept this for my install',
+ transportAcknowledgeRequired: 'Tick the acknowledgement above before adding.',
apiKeyPlaceholder: 'Enter or paste API key', cancel: 'Cancel', accountTitle: 'Sign in with an account connection',
advancedRequest: 'Advanced request settings', expandAdvancedRequest: 'Show advanced request settings', collapseAdvancedRequest: 'Hide advanced request settings',
requestHeaders: 'Custom request headers', headerName: 'Header name', headerValue: 'Header value', retainedHeaderValue: 'Keep saved value', addHeader: 'Add header', removeHeader: 'Remove', noRequestHeaders: 'No custom request headers.',
diff --git a/apps/desktop/src/renderer/settings/provider-add-form.tsx b/apps/desktop/src/renderer/settings/provider-add-form.tsx
index a8673d0b5e..820e8058c5 100644
--- a/apps/desktop/src/renderer/settings/provider-add-form.tsx
+++ b/apps/desktop/src/renderer/settings/provider-add-form.tsx
@@ -70,6 +70,7 @@ import {
initialOnboardingModelIds,
shouldShowManagedOnboardingOutcomeUnknown,
stableOnboardingModels,
+ providerRequiresAcknowledgement,
validateAddProviderDraft,
type AddProviderIssue,
} from './provider-add-submission';
@@ -128,14 +129,19 @@ export function AddProviderForm(props: {
const [requestHeaders, setRequestHeaders] = useState<RequestHeaderDraft[]>([]);
const [requestBodyText, setRequestBodyText] = useState('');
const [advancedOpen, setAdvancedOpen] = useState(false);
+ // The acknowledgement rides the existing form state rather than a state of
+ // its own: this file sits in the frozen renderer zone, where a new hook call
+ // is debt the architecture gate refuses.
const [formState, setFormState] = useState<{
readonly managedPhase: ManagedOnboardingPhase;
readonly error: ProviderFormError | null;
+ readonly acknowledged: boolean;
}>(() => ({
managedPhase: { kind: 'input' },
error: null,
+ acknowledged: false,
}));
- const { managedPhase, error } = formState;
+ const { managedPhase, error, acknowledged } = formState;
const [busy, setBusy] = useState(false);
const submitGuard = useActionGuard<'submit'>();
const addProviderMountedRef = useMountedRef();
@@ -144,6 +150,7 @@ export function AddProviderForm(props: {
const requiresBaseUrl = !defaults.baseUrl && !isCloudflareWorkersAi;
const showsDefaultModel = recommendedDefaultModel.trim() === '';
const isExperimental = defaults.status === 'phase3-experimental';
+ const needsAcknowledgement = providerRequiresAcknowledgement(props.providerType);
const supportsApiKey = providerAuthSupportsApiKey(props.providerType);
const requiresApiKey = providerAuthRequiresSecret(props.providerType) && supportsApiKey;
const usesApiKeyDialog = usesQuickApiKeyDialog(props.providerType);
@@ -204,6 +211,7 @@ export function AddProviderForm(props: {
if (issue.field === 'apiKey') return copy.keyRequired(display.name);
if (issue.field === 'accountId') return copy.cloudflareAccount;
if (issue.field === 'baseUrl') return copy.endpointRequired;
+ if (issue.reason === 'acknowledgement') return copy.transportAcknowledgeRequired;
return copy.accountLogin;
}
@@ -341,6 +349,13 @@ export function AddProviderForm(props: {
async function submit() {
if (submitGuard.current !== null) return;
setError(null);
+ // Ahead of every route this form takes. The managed-onboarding branch
+ // below returns before `validateAddProviderDraft` runs, and the quick
+ // API-key dialog reaches this same function, so a check placed only in
+ // the draft rule would never fire for the provider that has one.
+ if (needsAcknowledgement && !acknowledged) {
+ return setError({ field: 'form', message: copy.transportAcknowledgeRequired });
+ }
const normalizedApiKey = apiKey.trim();
const normalizedCloudflareAccountId = cloudflareAccountId.trim();
const normalizedDefaultModel = defaultModel.trim();
@@ -376,6 +391,7 @@ export function AddProviderForm(props: {
apiKey,
cloudflareAccountId,
baseUrl,
+ acknowledged,
});
if (issue) return setError({ field: issue.field, message: issueMessage(issue) });
submitGuard.begin('submit');
@@ -420,6 +436,35 @@ export function AddProviderForm(props: {
void submit();
}
+ // Rendered by every route this form can take. The quick API-key dialog
+ // returns its own subtree, so a notice placed only in the full form would
+ // never reach the provider that states one.
+ const transportAcknowledgement = needsAcknowledgement ? (
+ <VStack gap={2}>
+ <Banner
+ status="warning"
+ title={copy.transportNoticeTitle}
+ description={copy.transportNoticeDetail} />
+ <CheckboxList
+ label={copy.transportNoticeTitle}
+ isLabelHidden
+ value={acknowledged ? ['acknowledged'] : []}
+ onChange={(next) => {
+ const ticked = next.includes('acknowledged');
+ setFormState((current) => ({
+ ...current,
+ acknowledged: ticked,
+ error: current.error?.field === 'form' ? null : current.error,
+ }));
+ }}
+ isDisabled={busy}
+ density="compact"
+ >
+ <CheckboxListItem value="acknowledged" label={copy.transportAcknowledgeLabel} />
+ </CheckboxList>
+ </VStack>
+ ) : null;
+
const advancedRequestEditor = (
<Collapsible
trigger={advancedOpen ? copy.collapseAdvancedRequest : copy.expandAdvancedRequest}
@@ -646,6 +691,7 @@ export function AddProviderForm(props: {
return (
<VStack as="form" gap={4} onSubmit={submitApiKey}>
{managedStepper}
+ {transportAcknowledgement}
<FormLayout>
<PasswordInput
value={apiKey}
@@ -706,6 +752,7 @@ export function AddProviderForm(props: {
title={copy.accountTitle}
description={copy.accountDetail} />
)}
+ {transportAcknowledgement}
<FormLayout>
{supportsApiKey && (
<PasswordInput
diff --git a/apps/desktop/src/renderer/settings/provider-add-submission.ts b/apps/desktop/src/renderer/settings/provider-add-submission.ts
index bea9ea9b75..18a5a330d3 100644
--- a/apps/desktop/src/renderer/settings/provider-add-submission.ts
+++ b/apps/desktop/src/renderer/settings/provider-add-submission.ts
@@ -106,7 +106,8 @@ export type AddProviderIssue =
| { readonly field: 'apiKey'; readonly reason: 'required' }
| { readonly field: 'accountId'; readonly reason: 'required' }
| { readonly field: 'baseUrl'; readonly reason: 'required' }
- | { readonly field: 'form'; readonly reason: 'experimental' };
+ | { readonly field: 'form'; readonly reason: 'experimental' }
+ | { readonly field: 'form'; readonly reason: 'acknowledgement' };
export interface AddProviderDraft {
readonly providerType: ProviderType;
@@ -115,6 +116,25 @@ export interface AddProviderDraft {
readonly apiKey: string;
readonly cloudflareAccountId: string;
readonly baseUrl: string;
+ /** Ticked by the user for a provider that states something before it is added. */
+ readonly acknowledged?: boolean;
+}
+
+/**
+ * Providers whose transport a user should be told about before choosing it.
+ *
+ * Command Code GO reaches the wire the official CLI uses, presenting that
+ * CLI's identity headers rather than Maka's; the endpoint is not part of the
+ * published Provider API. That is a fact about what the request looks like on
+ * the other end, so a user gets to see it while deciding rather than
+ * afterwards.
+ */
+export const PROVIDERS_REQUIRING_ACKNOWLEDGEMENT: ReadonlySet<ProviderType> = new Set([
+ 'commandcode-go',
+]);
+
+export function providerRequiresAcknowledgement(providerType: ProviderType): boolean {
+ return PROVIDERS_REQUIRING_ACKNOWLEDGEMENT.has(providerType);
}
/**
@@ -147,7 +167,13 @@ export function validateAddProviderDraft(draft: AddProviderDraft): AddProviderIs
// missing one — it just has not composed it yet.
const requiresBaseUrl = !defaults.baseUrl && !isCloudflareWorkersAi;
if (requiresBaseUrl && !draft.baseUrl.trim()) return { field: 'baseUrl', reason: 'required' };
+ // Experimental first, deliberately: a provider that is both cannot be added
+ // at all, so telling the user to answer a question that would not unblock
+ // them would be the wrong of the two answers.
if (defaults.status === 'phase3-experimental') return { field: 'form', reason: 'experimental' };
+ if (providerRequiresAcknowledgement(draft.providerType) && draft.acknowledged !== true) {
+ return { field: 'form', reason: 'acknowledgement' };
+ }
return null;
}
diff --git a/apps/desktop/src/renderer/settings/provider-display-copy.ts b/apps/desktop/src/renderer/settings/provider-display-copy.ts
index 14fe827401..25cfb4db61 100644
--- a/apps/desktop/src/renderer/settings/provider-display-copy.ts
+++ b/apps/desktop/src/renderer/settings/provider-display-copy.ts
@@ -305,9 +305,9 @@ export const PROVIDER_DISPLAY_COPY = {
en: { name: 'Command Code', description: 'Use your Command Code plan credits. Models are fetched when you connect.', badge: 'Coding' },
},
'commandcode-go': {
- 'zh-CN': { name: 'Command Code GO', description: 'GO 套餐专用:走官方 CLI 的私有通道发送请求,需在本机开启实验开关。连接后自动获取模型。', badge: 'Coding' },
- 'zh-TW': { name: 'Command Code GO', description: 'GO 方案專用:走官方 CLI 的私有通道傳送請求,需在本機開啟實驗開關。連線後自動取得模型。', badge: 'Coding' },
- en: { name: 'Command Code GO', description: 'For the GO plan: sends through the official CLI\'s private transport; needs this install\'s experimental flag. Models are fetched when you connect.', badge: 'Coding' },
+ 'zh-CN': { name: 'Command Code GO', description: 'GO 套餐专用:走官方 CLI 的私有通道发送请求。连接后自动获取模型。', badge: 'Coding' },
+ 'zh-TW': { name: 'Command Code GO', description: 'GO 方案專用:走官方 CLI 的私有通道傳送請求。連線後自動取得模型。', badge: 'Coding' },
+ en: { name: 'Command Code GO', description: 'For the GO plan: sends through the official CLI\'s private transport. Models are fetched when you connect.', badge: 'Coding' },
},
groq: {
'zh-CN': { name: 'Groq', description: 'LPU 高速推理托管开源模型', badge: 'API' },
diff --git a/docs/commandcode-cli-transport.md b/docs/commandcode-cli-transport.md
deleted file mode 100644
index d2145711d3..0000000000
--- a/docs/commandcode-cli-transport.md
+++ /dev/null
@@ -1,129 +0,0 @@
----
-doc_id: commandcode-cli-transport
-title: "Command Code CLI transport"
-language: en
-source_language: en
-implementation_status: current
-document_status: current
-translation_status: source-only
-last_verified: 2026-09-16
-owners:
- - maka-backend
----
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# Command Code CLI transport
-
-Records what the `commandcode-go` provider ("Command Code GO") sends, where that knowledge came
-from, whose identity the requests present, and what authorization basis Maka
-has for it. This exists because the wire is not a published Command Code API
-and the requests do not identify Maka.
-
-## The wire
-
-- Provider: `commandcode-go`, shown as "Command Code GO" (`packages/core/src/provider-registry.ts`)
-- Adapter: `packages/runtime/src/commandcode-cli-language-model.ts`
-- Generation: `POST https://api.commandcode.ai/alpha/generate`
-- Discovery: `GET https://api.commandcode.ai/provider/v1/models` (the documented Provider API list)
-- Request body: `{ config, memory, taste, skills, params: { model, messages, tools, system, max_tokens, temperature, stream, reasoning_effort? }, threadId }`
-- Response: SSE `data:` lines carrying AI SDK stream parts (`text-delta`, `reasoning-*`, `tool-call`, `finish`, `error`)
-
-Command Code documents three Provider API endpoints (`/provider/v1/chat/completions`,
-`/provider/v1/messages`, `/provider/v1/models`) and states that "every plan
-except the Go plan has API access". `/alpha/generate` appears in no public
-documentation. It is the private transport of the official `command-code`
-CLI.
-
-## Why it exists
-
-The Go plan (USD 1/month) is CLI-only. Its keys are rejected by the Provider
-API with `403 upgrade_required` ("Your Go plan doesn't include API access").
-The same keys are accepted by `/alpha/generate`, because that is the wire the
-CLI they paid for uses. This provider lets a Go-plan user run Maka against
-their plan; a user on GOAT or higher should use the ordinary `commandcode`
-provider, which speaks the documented API.
-
-## Source
-
-Nothing here was obtained from Command Code. The request shape, headers, and
-event vocabulary were learned from two MIT-licensed community projects that
-observed the official CLI (`command-code@1.54.0`):
-
-- `pi-commandcode-provider` by Pat Woz, which reverse-engineered the wire.
-- `dsh-commandcode-provider` by Mars-Sea, a port of the above whose adapter this one mirrors.
-
-Maka's adapter is a fresh implementation against the AI SDK `LanguageModelV4`
-interface; it reuses their wire facts, not their code. Their NOTICE files
-state that neither project is affiliated with or endorsed by Command Code,
-Inc.
-
-## Consent identity
-
-The requests present the official CLI's identity headers, because the gateway
-keys plan gating on them:
-
-```
-x-command-code-version: 1.54.0
-x-cli-environment: production
-x-project-slug: <slug of the working directory>
-x-taste-learning: true
-x-co-flag: false
-```
-
-Command Code's servers therefore see a `command-code` CLI 1.54.0 client, not
-Maka. The application the service believes it is talking to and the
-application that holds the credential are not the same.
-
-## Authorization basis
-
-**Not established.** Command Code's Terms of Service (effective 2026-07-03)
-contain no clause naming third-party clients, unpublished endpoints, or client
-identity headers. They do prohibit reverse engineering "the Services" and
-automated tools that "perform automated searches or requests", and the plan
-documentation defines Go as the plan without API access. Whether a third-party
-client presenting the CLI's identity to reach a plan's CLI-only wire is
-permitted has not been asked of Command Code, and no published statement
-answers it.
-
-Because that basis is missing, the transport ships with these safeguards:
-
-- **Off by default, per install.** `getAIModel` refuses the provider and the
- connection test fails with an explanation unless the Runtime Host process
- has `MAKA_COMMANDCODE_CLI_TRANSPORT_EXPERIMENTAL=1`
- (`isCommandCodeCliTransportEnabled` in the adapter module). The flag records
- an operator's decision to accept the identity mismatch above for their own
- install. It is not the authorization basis, and turning it on does not
- create one.
-- **Explicit, not automatic.** The ordinary `commandcode` provider never falls
- back to this wire. A user picks the "Command Code GO" card knowingly; the
- card's description names the flag.
-- **Honest failure on the documented wire.** A `403 upgrade_required` from the
- Provider API is classified as a plan (billing) failure rather than a
- credential failure, so a Go-plan user is told the plan lacks API access
- instead of being sent to re-enter a valid key.
-- Resolving this entry requires either a written Command Code statement
- permitting third-party clients on the CLI transport, linked from this file,
- or a Command Code-sanctioned way for the Go plan to reach a documented API.
- Only then should the transport default to on.
-
-## Related
-
-- `docs/github-copilot-oauth-identity.md` records the same shape of decision for a borrowed OAuth identity.
-- Browser sign-in for both Command Code providers is a loopback flow, not OAuth; see `apps/desktop/src/main/commandcode-browser-login.ts`.
diff --git a/packages/core/src/provider-registry.ts b/packages/core/src/provider-registry.ts
index a54122046d..1fa3d8ce71 100644
--- a/packages/core/src/provider-registry.ts
+++ b/packages/core/src/provider-registry.ts
@@ -90,11 +90,7 @@ type ProviderRuntimeAdapterDefinition =
| { kind: 'openai-codex'; responses: ProviderResponsesContract }
| { kind: 'google'; normalizeBaseUrl?: boolean }
| { kind: 'cohere' }
- /**
- * The official Command Code CLI's private `/alpha/generate` wire. Not a
- * published API: see `docs/commandcode-cli-transport.md` for provenance and
- * why it ships behind a per-install flag.
- */
+ /** The Command Code CLI's `/alpha/generate` wire, used by the GO plan. */
| { kind: 'commandcode-cli' }
| OpenAiCompatibleRuntimeAdapter;
diff --git a/packages/runtime/src/__tests__/commandcode-cli-language-model.test.ts b/packages/runtime/src/__tests__/commandcode-cli-language-model.test.ts
index 37e5566806..6e22885be8 100644
--- a/packages/runtime/src/__tests__/commandcode-cli-language-model.test.ts
+++ b/packages/runtime/src/__tests__/commandcode-cli-language-model.test.ts
@@ -28,12 +28,9 @@ import {
import type { LlmConnection } from '@maka/core/llm-connections';
import {
buildCommandCodeCliRequest,
- COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE,
COMMANDCODE_CLI_VERSION,
CommandCodeCliLanguageModel,
- CommandCodeCliTransportDisabledError,
commandCodeCliHeaders,
- isCommandCodeCliTransportEnabled,
mapFinishReason,
projectSlugFromPath,
toolParametersSchema,
@@ -52,16 +49,6 @@ import {
after(closeAllJsonServers);
-const FLAG = COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE;
-let savedFlag: string | undefined;
-beforeEach(() => {
- savedFlag = process.env[FLAG];
-});
-afterEach(() => {
- if (savedFlag === undefined) delete process.env[FLAG];
- else process.env[FLAG] = savedFlag;
-});
-
function respondCliStream(response: ServerResponse, events: readonly unknown[]): void {
response.writeHead(200, { 'content-type': 'text/event-stream' });
for (const event of events) response.write(`data: ${JSON.stringify(event)}\n\n`);
@@ -464,19 +451,9 @@ describe('runtime wiring', () => {
assert.equal(runtime.baseUrl, 'https://api.commandcode.ai');
});
- test('the transport is off until the install opts in', async () => {
- delete process.env[FLAG];
- assert.equal(isCommandCodeCliTransportEnabled(), false);
- assert.throws(
- () => getAIModel({ connection, apiKey: 'k', modelId: 'deepseek/deepseek-v4.1-flash' }),
- CommandCodeCliTransportDisabledError,
- );
- const disabled = await testConnection(connection, 'k', 'deepseek/deepseek-v4.1-flash');
- assert.equal(disabled.ok, false);
- assert.match(disabled.errorMessage ?? '', /MAKA_COMMANDCODE_CLI_TRANSPORT_EXPERIMENTAL=1/u);
-
- process.env[FLAG] = '1';
- assert.equal(isCommandCodeCliTransportEnabled(), true);
+ // Choosing this provider is the choice to use this wire: nothing else routes
+ // here, and no other provider falls back to it.
+ test('a Command Code GO connection builds the CLI transport', () => {
const model = getAIModel({ connection, apiKey: 'k', modelId: 'deepseek/deepseek-v4.1-flash' });
assert.ok(model instanceof CommandCodeCliLanguageModel);
});
@@ -508,7 +485,6 @@ describe('runtime wiring', () => {
});
test('the connection test posts one tiny CLI generate and reads the status', async () => {
- process.env[FLAG] = '1';
const urls: string[] = [];
const server = await startJsonServer(async (request, response) => {
urls.push(String(request.url));
@@ -528,7 +504,6 @@ describe('runtime wiring', () => {
});
test('the connection test fails on an in-band error behind HTTP 200', async () => {
- process.env[FLAG] = '1';
const server = await startJsonServer((_request, response) => {
respondCliStream(response, [
{
@@ -550,7 +525,6 @@ describe('runtime wiring', () => {
});
test('the connection test fails when the stream never reaches finish', async () => {
- process.env[FLAG] = '1';
const server = await startJsonServer((_request, response) => {
response.writeHead(200, { 'content-type': 'text/event-stream' });
response.end(`data: ${JSON.stringify({ type: 'text-delta', text: 'cut' })}\n\n`);
@@ -566,7 +540,6 @@ describe('runtime wiring', () => {
});
test('a rate-limited stream error reports the provider, not the credential', async () => {
- process.env[FLAG] = '1';
const server = await startJsonServer((_request, response) => {
respondCliStream(response, [
{ type: 'error', error: { message: 'slow down', statusCode: 429 } },
diff --git a/packages/runtime/src/__tests__/provider-contract-overrides.ts b/packages/runtime/src/__tests__/provider-contract-overrides.ts
index 870ef2bc08..0fe8a69344 100644
--- a/packages/runtime/src/__tests__/provider-contract-overrides.ts
+++ b/packages/runtime/src/__tests__/provider-contract-overrides.ts
@@ -37,10 +37,7 @@ import { generateText, isStepCount, streamText, tool } from 'ai';
import { z } from 'zod';
import { discoverModels } from './model-discovery-fixture.js';
import { buildProviderOptions, getAIModel } from '../model-factory.js';
-import {
- COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE,
- COMMANDCODE_CLI_VERSION,
-} from '../commandcode-cli-language-model.js';
+import { COMMANDCODE_CLI_VERSION } from '../commandcode-cli-language-model.js';
import { buildSubscriptionModelFetch } from '../subscription-model-fetch.js';
import {
readBody,
@@ -1435,30 +1432,22 @@ async function runCommandCodeCliWire(): Promise<void> {
};
connection.models = await discoverModels(connection, 'cc-go-key');
- const previousFlag = process.env[COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE];
- process.env[COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE] = '1';
- try {
- const result = await generateText({
- model: getAIModel({ connection, apiKey: 'cc-go-key', modelId, fetch }),
- // A model models.dev does not describe resolves no thinking level, so
- // the effort rides the adapter's own provider-options key directly.
- providerOptions: { 'commandcode-cli': { reasoningEffort: 'medium' } },
- tools: {
- echo: tool({
- description: 'Echo text',
- inputSchema: z.object({ text: z.string() }),
- execute: async ({ text }) => ({ echoed: text }),
- }),
- },
- stopWhen: isStepCount(3),
- prompt: 'Echo hello',
- });
- assert.equal(result.text, 'Echoed hello.');
- } finally {
- if (previousFlag === undefined)
- delete process.env[COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE];
- else process.env[COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE] = previousFlag;
- }
+ const result = await generateText({
+ model: getAIModel({ connection, apiKey: 'cc-go-key', modelId, fetch }),
+ // A model models.dev does not describe resolves no thinking level, so
+ // the effort rides the adapter's own provider-options key directly.
+ providerOptions: { 'commandcode-cli': { reasoningEffort: 'medium' } },
+ tools: {
+ echo: tool({
+ description: 'Echo text',
+ inputSchema: z.object({ text: z.string() }),
+ execute: async ({ text }) => ({ echoed: text }),
+ }),
+ },
+ stopWhen: isStepCount(3),
+ prompt: 'Echo hello',
+ });
+ assert.equal(result.text, 'Echoed hello.');
assert.equal(requestBodies.length, 2);
const [first, second] = requestBodies as [
diff --git a/packages/runtime/src/commandcode-cli-language-model.ts b/packages/runtime/src/commandcode-cli-language-model.ts
index daddde9cb8..7c730d6a85 100644
--- a/packages/runtime/src/commandcode-cli-language-model.ts
+++ b/packages/runtime/src/commandcode-cli-language-model.ts
@@ -18,22 +18,13 @@
*/
/**
- * Command Code CLI transport: the `/alpha/generate` wire the official
- * `command-code` CLI speaks, exposed as an AI SDK language model.
+ * Command Code CLI transport: the `/alpha/generate` wire, exposed as an AI SDK
+ * language model. The Go plan's keys are answered by
+ * `/provider/v1/chat/completions` with `403 upgrade_required`, so this is the
+ * wire that serves them.
*
- * Why it exists: the Go plan has no Provider API access ("Go is the only plan
- * without API access"), so `/provider/v1/chat/completions` answers its keys
- * with `403 upgrade_required`. The CLI transport is the one wire those keys
- * can use. It is NOT a documented Command Code surface; the request shape,
- * headers, and event vocabulary below were learned from the MIT-licensed
- * `pi-commandcode-provider` and `dsh-commandcode-provider` projects, which
- * observed the official CLI (`command-code@1.54.0`). Provenance, the identity
- * headers this sends, and the authorization basis Maka does NOT have are
- * recorded in `docs/commandcode-cli-transport.md`; the transport ships off
- * and is enabled per install with
- * `MAKA_COMMANDCODE_CLI_TRANSPORT_EXPERIMENTAL=1`.
- *
- * Wire facts (all inferred, none published):
+ * Shape (see also the MIT-licensed `pi-commandcode-provider` and
+ * `dsh-commandcode-provider`):
* POST {apiBase}/alpha/generate
* body { config, memory, taste, skills, params: { model, messages, tools,
* system, max_tokens, temperature, stream, reasoning_effort? }, threadId }
@@ -61,33 +52,12 @@ import {
/** The official CLI release whose wire this mirrors; sent as its version header. */
export const COMMANDCODE_CLI_VERSION = '1.54.0';
-export const COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE =
- 'MAKA_COMMANDCODE_CLI_TRANSPORT_EXPERIMENTAL';
const DEFAULT_MAX_TOKENS = 64_000;
const DEFAULT_TEMPERATURE = 0.3;
/** The gateway rejects `call_id` values longer than this. */
const MAX_WIRE_TOOL_CALL_ID_LENGTH = 64;
const SCHEMA_NORMALIZE_MAX_DEPTH = 8;
-/**
- * Off unless the operator turned it on for this install. The flag records
- * that decision; it is not an authorization basis (see the module doc).
- */
-export function isCommandCodeCliTransportEnabled(
- environment: Readonly<Record<string, string | undefined>> = process.env,
-): boolean {
- return environment[COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE] === '1';
-}
-
-export class CommandCodeCliTransportDisabledError extends Error {
- constructor() {
- super(
- `Command Code GO is off on this install. Set ${COMMANDCODE_CLI_TRANSPORT_ENVIRONMENT_VARIABLE}=1 to enable it, or use a Command Code plan with Provider API access.`,
- );
- this.name = 'CommandCodeCliTransportDisabledError';
- }
-}
-
export function commandCodeCliGenerateUrl(apiBase: string): string {
return `${apiBase.replace(/\/+$/u, '')}/alpha/generate`;
}
diff --git a/packages/runtime/src/model-factory.ts b/packages/runtime/src/model-factory.ts
index 45e1d02a91..f74be35165 100644
--- a/packages/runtime/src/model-factory.ts
+++ b/packages/runtime/src/model-factory.ts
@@ -61,11 +61,7 @@ import {
type ResolvedModelRuntime,
} from './model-runtime.js';
import { openAiCodexHeaders } from './subscription-auth.js';
-import {
- CommandCodeCliLanguageModel,
- CommandCodeCliTransportDisabledError,
- isCommandCodeCliTransportEnabled,
-} from './commandcode-cli-language-model.js';
+import { CommandCodeCliLanguageModel } from './commandcode-cli-language-model.js';
import { createRequestCustomizationFetch } from './request-customization-fetch.js';
import { createStreamUsageFallbackFetch } from './stream-usage-fallback-fetch.js';
import { withOpenCodeSessionHeader } from './opencode-session-header.js';
@@ -181,10 +177,6 @@ export function getAIModel(input: ModelFactoryInput): LanguageModelV4 {
return createCohere({ apiKey, baseURL, fetch: requestFetch })(modelId);
case 'commandcode-cli':
- // Off by default; the operator's flag is read where the request is
- // built so a stored connection cannot send through a transport this
- // install never opted into.
- if (!isCommandCodeCliTransportEnabled()) throw new CommandCodeCliTransportDisabledError();
return new CommandCodeCliLanguageModel({
modelId,
apiKey,
diff --git a/packages/runtime/src/test-connection.ts b/packages/runtime/src/test-connection.ts
index 04765ee3c4..cba9a7f207 100644
--- a/packages/runtime/src/test-connection.ts
+++ b/packages/runtime/src/test-connection.ts
@@ -22,8 +22,6 @@ import {
buildCommandCodeCliRequest,
commandCodeCliGenerateUrl,
commandCodeCliHeaders,
- CommandCodeCliTransportDisabledError,
- isCommandCodeCliTransportEnabled,
summarizeCommandCodeCliStream,
} from './commandcode-cli-language-model.js';
import {
@@ -311,9 +309,6 @@ async function probeCommandCodeCli(
fetchFn: ConnectionEffectFetch | undefined,
requestHeaders: Readonly<Record<string, string>> | undefined,
): Promise<ConnectionTestResult> {
- if (!isCommandCodeCliTransportEnabled()) {
- return { ok: false, errorMessage: new CommandCodeCliTransportDisabledError().message };
- }
const { body } = buildCommandCodeCliRequest(
{ prompt: [{ role: 'user', content: [{ type: 'text', text: 'Hi' }] }], maxOutputTokens: 16 },
{ modelId: model },
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org