Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs-site/src/content/docs/es/guides/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ La integración administrada de OpenCode controla dos bloques: `provider.opencod

Ambos fragmentos se construyen a partir de los metadatos del modelo canónico efectivo, al igual que la exportación de Kilo y el lanzador `ocx opencode`. Una anulación explícita personalizada siempre gana, y una escalera que se vacía permanece vacía; una escalera de razonamiento o predeterminada nunca se inventa para un modelo que no declara ninguno. Un límite de contexto autorizado se lleva con un presupuesto de salida al lado: un valor de salida conocido - explícito o de metadatos de catálogo - gana, de lo contrario el esquema requerido 32000 reserva sujeta al contexto, y sin un contexto autorizado se omite todo el bloque de límite. Las capacidades, escalas de esfuerzo, valores predeterminados y un límite de entrada opcional aparecen solo cuando se conocen; el objeto de capacidades nativas del bloque V2 requiere un valor de herramientas conocido, por lo que cuando se desconoce el soporte de la herramienta se omite por completo en lugar de escribirse parcialmente, y la modalidad heredada permanece. Tampoco añade un esfuerzo seleccionable. Las variantes seleccionables anulan el valor predeterminado por modelo: `none` incluido, que se ofrece solo cuando la escalera declarada del propio modelo lo contiene. Sea lo que sea que el cliente seleccione, la política de razonamiento ascendente del proxy aún rige la solicitud que la abandona.

El soporte de DSH administrado tiene un piso de compatibilidad de **DSH 0.1.0-rc.6**. DSH 0.1.7+ lee las rutas del proveedor desde `[id=llm-pi-ai].config.providers.opencodex` en el parche de perfil de escritorio, `$DSH_HOME/profiles/desktop/cordis.patch.yml`, que recarga DSH en caliente. OpenCodex escribe esa fila cuando existe el perfil de escritorio y su parche. Si existe `$DSH_HOME/profiles/desktop/package.json` pero falta `cordis.patch.yml`, Aplicar se niega: cree `cordis.patch.yml` que contiene `[]` (el parche vacío que DSH escribe para un nuevo perfil), luego habilite la integración nuevamente. Solo cuando no hay perfil de Escritorio, OpenCodex usa `llm-pi-ai.providers.opencodex` en `$DSH_HOME/settings.yaml`. OpenCodex solo posee ese fragmento de proveedor: Aplicarlo y Actualizarlo, Desactivarlo lo elimina y Restaurar devuelve una instantánea grabada. Estas operaciones no cambian el modelo predeterminado del usuario o el proveedor nativo `deepseek-official`. La integración DSH administrada es actualmente solo loopback y nunca escribe una credencial real.
El soporte de DSH administrado tiene un piso de compatibilidad de **DSH 0.1.0-rc.6**. DSH 0.1.7+ lee las rutas del proveedor desde `[id=llm-pi-ai].config.providers.opencodex` en el parche de perfil de escritorio, `$DSH_HOME/profiles/desktop/cordis.patch.yml`, que recarga DSH en caliente. OpenCodex escribe esa fila cuando existe el perfil de escritorio y su parche. Si existe `$DSH_HOME/profiles/desktop/package.json` pero falta `cordis.patch.yml`, Aplicar se niega: cree `cordis.patch.yml` que contiene `[]` (el parche vacío que DSH escribe para un nuevo perfil), luego habilite la integración nuevamente. Solo cuando no hay perfil de Escritorio, OpenCodex usa `llm-pi-ai.providers.opencodex` en `$DSH_HOME/settings.yaml`. OpenCodex solo posee ese fragmento de proveedor: Aplicarlo y Actualizarlo, Desactivarlo lo elimina y Restaurar devuelve una instantánea grabada. Estas operaciones no cambian el modelo predeterminado del usuario o el proveedor nativo `deepseek-official`. La integración DSH administrada es actualmente solo loopback y nunca escribe una credencial real. Con el proxy en ejecución, la sincronización explícita y la actualización en segundo plano del catálogo actualizan el bloque de DSH ya conectado.

MiniMax Code sigue `MINIMAX_DATA_DIR`, luego `MAVIS_DATA_DIR`, antes de caer de nuevo a `~/.minimax`. Su bloque administrado posee solo `custom_provider.opencodex`. No cambia `defaultModel`, la fuente de credenciales MiniMax seleccionada o el inicio de sesión MiniMax del usuario. Elija una entrada `custom_provider:opencodex/<provider/model>` en MCode después de conectarla. La actualización de la integración también actualiza las ventanas de contexto autorizadas por modelo y las opciones de esfuerzo de razonamiento; se omiten las capacidades desconocidas y se conserva el esfuerzo actual de MCode.

Expand Down
1 change: 1 addition & 0 deletions docs-site/src/content/docs/guides/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ fragment: Apply and Refresh replace it, Disable removes it, and Restore puts bac
snapshot. These operations do not change the user's default model or the native
`deepseek-official` provider.
The managed DSH integration is currently loopback-only and never writes a real credential.
With a live proxy, explicit sync and background catalog refresh update an already-connected DSH block.

MiniMax Code follows `MINIMAX_DATA_DIR`, then `MAVIS_DATA_DIR`, before falling
back to `~/.minimax`. Its managed block owns only `custom_provider.opencodex`.
Expand Down
4 changes: 2 additions & 2 deletions src/cli/sync-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ export async function runSyncCommand(deps: CliDispatchDeps): Promise<number> {
if (live) {
try {
const config = deps.loadConfig();
const { refreshOwnedCatalogIntegrations } = await import("../integrations/catalog-refresh");
const { catalogRefreshClientIds, refreshOwnedCatalogIntegrations } = await import("../integrations/catalog-refresh");
results.push(...await refreshOwnedCatalogIntegrations({
models: async () => {
const { loadExportModels } = await import("../server/management/model-rows");
return loadExportModels(config);
},
config,
port: live.port,
}, ["mcode", "raycast", "omo", "cline", "commandcode", "droid", "opencode", "kilo", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "hermes", "t3code"]));
}, catalogRefreshClientIds("cliSync")));
} catch (error) {
console.warn(`Client integrations were not refreshed: ${error instanceof Error ? error.message : String(error)}`);
}
Expand Down
20 changes: 19 additions & 1 deletion src/integrations/catalog-refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,28 @@ import {
type OwnedIntegrationRefreshOutcome,
} from "./owned-refresh";

const CATALOG_REFRESH_CLIENTS: readonly IntegrationClientId[] = [
"mcode", "pi", "aside", "raycast", "omo", "cline", "commandcode", "dsh", "droid",
"opencode", "kilo", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "gentle-shell", "hermes", "t3code",
];

const CATALOG_REFRESH_EXCLUSIONS = {
catalog: ["mcode", "cline"],
serverSync: ["gentle-shell"],
unattended: ["cline", "gentle-shell"],
// The CLI delegates Pi and Aside to the serving proxy.
cliSync: ["pi", "aside", "gentle-shell"],
} satisfies Record<string, readonly IntegrationClientId[]>;

export function catalogRefreshClientIds(mode: keyof typeof CATALOG_REFRESH_EXCLUSIONS): IntegrationClientId[] {
const excluded: readonly IntegrationClientId[] = CATALOG_REFRESH_EXCLUSIONS[mode];
return CATALOG_REFRESH_CLIENTS.filter(clientId => !excluded.includes(clientId));
}

/** Refresh only previously connected clients; a refused file never blocks its peers. */
export async function refreshOwnedCatalogIntegrations(
input: Omit<OwnedIntegrationRefreshInput, "clientId">,
clientIds: readonly IntegrationClientId[] = ["pi", "aside", "raycast", "omo", "commandcode", "droid", "opencode", "kilo", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "gentle-shell", "hermes", "t3code"],
clientIds: readonly IntegrationClientId[] = catalogRefreshClientIds("catalog"),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
options: { refreshOnly?: boolean; admit?: () => boolean } = {},
): Promise<OwnedIntegrationRefreshOutcome[]> {
// Client files are shared with the live proxy a sibling instance runs beside; their entries
Expand Down
6 changes: 2 additions & 4 deletions src/server/management/config-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export async function syncEnabledClientIntegrations(
}

if (stale()) return out;
const { refreshOwnedCatalogIntegrations } = await import("../../integrations/catalog-refresh");
const { catalogRefreshClientIds, refreshOwnedCatalogIntegrations } = await import("../../integrations/catalog-refresh");
const refreshOwned = deps.refreshOwnedCatalogIntegrations ?? refreshOwnedCatalogIntegrations;
out.push(...await refreshOwned({
models: async () => {
Expand All @@ -351,9 +351,7 @@ export async function syncEnabledClientIntegrations(
},
config,
port,
}, unattended
? ["mcode", "pi", "aside", "raycast", "omo", "commandcode", "droid", "opencode", "kilo", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "hermes", "t3code"]
: ["mcode", "pi", "aside", "raycast", "omo", "cline", "commandcode", "droid", "opencode", "kilo", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "hermes", "t3code"],
}, catalogRefreshClientIds(unattended ? "unattended" : "serverSync"),
...unattended ? [{ refreshOnly: true, admit }] as const : []));

return out;
Expand Down
2 changes: 1 addition & 1 deletion structure/clients/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ their existing visibility rules.
## Owned catalog convergence

Visibility, selected-model and preset writes refresh already-owned catalog contributions (including OpenCode, Kilo and
Command Code) after persisting the selection. Explicit sync also refreshes owned OpenCode, Kilo, Command Code and default-profile Hermes blocks. The shared catalog-refresh
Command Code) after persisting the selection. The shared catalog-refresh list includes DeepSeek Harness (`dsh`) for catalog changes, explicit sync and unattended refresh. Mode exclusions preserve server ownership of Pi and Aside and omit Cline from unattended refresh. Explicit sync also refreshes owned OpenCode, Kilo, Command Code and default-profile Hermes blocks. The shared catalog-refresh
fan-out loads the filtered roster lazily once, leaves unowned clients alone, and reports each
refusal independently. Existing coordinated writers retain all no-clobber and ownership checks. A background catalog auto-refresh that changes the served set calls `syncEnabledClientIntegrations` unattended from `src/server/background-lifecycle.ts`: it refreshes only an existing Grok fence, a Desktop gateway profile that is still selected and byte-identical to the last applied write (keeping its static, hybrid or discovery mode), and owned file and Aside blocks without a first apply; it skips Cline, includes Hermes (its managed `providers.opencodex` range is patched byte-wise and a hand-edited or never-connected block is never claimed), honours the hub and sibling gate, and the coordinated writer's synchronous `guard` refuses any write once the scheduler generation has stopped or the owner captured for that delivery has revoked fan-out admission or released its lease; a later delivery may select a surviving owner. Each write also requires the projection's configuration snapshot to remain current, ignoring only Desktop's applied fingerprint and timestamp; Grok rechecks its complete fence and refuses symlinked config or backup paths inside the synchronous injector, then revalidates admission and unchanged regular-file bytes in the no-follow writer's pre-rename hook without copying a backup.
Implicit refresh operations use distinct flight keys: overlapping desired catalogs return busy rather than joining a write of a different catalog and reporting false success. An implicit refresh of an owned file client whose home was removed afterwards is left alone: `refreshOwnedIntegration` in `src/integrations/owned-refresh.ts` returns `null` for the writer's `not_installed` refusal, exactly as for a never-connected client, so a model toggle or sync no longer reports "<client> is not installed" for a client the user uninstalled. The ownership record is kept, so a reinstall resumes refreshing, and explicit enable still refuses with `not_installed`. Aside keeps its per-profile report. `tests/clients/sync-client-integrations.test.ts` covers the left-alone and Aside-report cases; `tests/clients/integrations-writer.test.ts` covers the explicit-enable refusal.
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/cli-dispatch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe("dispatchCommand exit codes", () => {
}
});

test("sync refreshes already-owned OpenCode and Kilo after publishing the Codex catalog", async () => {
test("sync refreshes already-owned OpenCode, Kilo and DSH after publishing the Codex catalog", async () => {
const syncModule = await import("../../src/codex/sync");
const catalogModule = await import("../../src/integrations/catalog-refresh");
const asideModule = await import("../../src/cli/aside-profiles");
Expand All @@ -203,7 +203,7 @@ describe("dispatchCommand exit codes", () => {
expect(code).toBe(0);
expect(order).toEqual(["catalog", "refresh"]);
expect(refresh).toHaveBeenCalledTimes(1);
expect(refresh.mock.calls[0]![1]).toEqual(["mcode", "raycast", "omo", "cline", "commandcode", "droid", "opencode", "kilo", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "hermes", "t3code"]);
expect(refresh.mock.calls[0]![1]).toEqual(["mcode", "raycast", "omo", "cline", "commandcode", "dsh", "droid", "opencode", "kilo", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "hermes", "t3code"]);
// #8287: Pi refreshes through the serving proxy instead of the local fan-out.
expect(pi).toHaveBeenCalledTimes(1);
} finally {
Expand Down
21 changes: 21 additions & 0 deletions tests/clients/integrations-dsh-profile-patch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { DSH_PROFILE_PROVIDER_PATH, type ExportModel } from "../../src/clients/config-export";
import { refreshOwnedCatalogIntegrations } from "../../src/integrations/catalog-refresh";
import { INTEGRATION_CLIENTS } from "../../src/integrations/registry";
import { defaultIntegrationIO } from "../../src/integrations/config-io";
import { previewIntegration } from "../../src/integrations/mutation-plan";
Expand Down Expand Up @@ -155,6 +156,26 @@ describe("DSH Desktop profile patch", () => {
expect(Object.keys(providers)).toEqual(["mine", "opencodex"]);
});

test("automatic catalog refresh updates the owned DSH Desktop profile", async () => {
installDesktop(LIVED_IN);
expect(applyIntegration(input()).ok).toBe(true);
expect(existsSync(settingsPath())).toBe(false);
const minePath = ["[id=llm-pi-ai]", "config", "providers", "mine"];
const userProvider = readPath(parsedStore(), minePath);
expect(userProvider).toEqual({
api: "openai-completions",
baseURL: "http://127.0.0.1:9999/v1",
});

const outcomes = await refreshOwnedCatalogIntegrations(input({ models: MORE_MODELS }));

const models = readPath(parsedStore(), [...DSH_PROFILE_PROVIDER_PATH, "models"]) as Array<{ id: string }>;
expect(models.map(model => model.id)).toEqual(MORE_MODELS.map(model => model.namespaced));
expect(outcomes).toEqual([{ client: "dsh", ok: true, changed: true }]);
expect(readPath(parsedStore(), minePath)).toEqual(userProvider);
expect(existsSync(settingsPath())).toBe(false);
});

test("a refresh rewrites only our provider, after DSH added a row of its own", () => {
installDesktop(LIVED_IN);
expect(applyIntegration(input()).ok).toBe(true);
Expand Down
10 changes: 10 additions & 0 deletions tests/clients/integrations-writer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { buildClientContribution, type ExportModel } from "../../src/clients/config-export";
import { refreshOwnedCatalogIntegrations } from "../../src/integrations/catalog-refresh";
import { assertIntegrationWriteOwnership, fileIO, type IntegrationIO } from "../../src/integrations/config-io";
import { canonicalContribution, fingerprint } from "../../src/integrations/ownership";
import { protectedContributionFingerprint } from "../../src/integrations/ownership-policy";
Expand Down Expand Up @@ -997,6 +998,15 @@ describe("OMP source preservation", () => {
});

describe("DSH source preservation", () => {
test("the default catalog refresh updates an already-owned DSH block", async () => {
const path = installDsh();
const first = input({ clientId: "dsh" });
expect(applyIntegration(first).ok).toBe(true);
const models = [...MODELS, { namespaced: "openai/new-model", provider: "openai", id: "new-model" }];
expect(await refreshOwnedCatalogIntegrations({ ...first, models })).toEqual([{ client: "dsh", ok: true, changed: true }]);
expect(readFileSync(path, "utf8")).toContain("openai/new-model");
});

test("preserves defaults, namespaces, providers, comments, and formatting through refresh and disable", () => {
const configPath = installDsh();
const original = [
Expand Down
11 changes: 7 additions & 4 deletions tests/clients/pi-sync-owner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { join } from "node:path";
import { buildClientConfig } from "../../src/clients/config-export";
import type { ExportModel, PiGeneratedConfig } from "../../src/clients/config-export/contracts";
import { PI_SYNC_ROUTE, refreshPiThroughServer } from "../../src/cli/pi-sync";
import { catalogRefreshClientIds } from "../../src/integrations/catalog-refresh";
import { createIntegrationStateStore, type IntegrationStateStore } from "../../src/integrations/store";
import { handleManagementAPI } from "../../src/server/management-api";
import { PI_SYNC_PATH, setIntegrationMutationFlightTestHooks, setIntegrationPathTestHooks } from "../../src/server/management/integration-routes";
Expand Down Expand Up @@ -82,10 +83,12 @@ describe("ocx sync refreshes Pi through the serving proxy", () => {

test("the CLI's local refresh list no longer rebuilds Pi", () => {
const source = readFileSync(repoPath("src", "cli", "sync-command.ts"), "utf8");
const list = /refreshOwnedCatalogIntegrations\([\s\S]*?\}, \[([^\]]*)\]\)/.exec(source)?.[1] ?? "";
expect(list).toContain('"mcode"');
expect(list).not.toContain('"pi"');
expect(source).toContain("refreshPiThroughServer");
expect(source).toMatch(/refreshOwnedCatalogIntegrations\(\{[\s\S]*?\},\s*catalogRefreshClientIds\("cliSync"\)\)/);
const list = catalogRefreshClientIds("cliSync");
expect(list).toContain("mcode");
expect(list).toContain("dsh");
expect(list).not.toContain("pi");
expect(source).toMatch(/await refreshPiThroughServer\(/);
expect(PI_SYNC_ROUTE).toBe(PI_SYNC_PATH);
});
});
Expand Down
7 changes: 6 additions & 1 deletion tests/clients/sync-client-integrations-unattended.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@ afterEach(() => {
});

describe("unattended native and file client admission", () => {
test.each([false, true])("owned DeepSeek Harness joins file sync (unattended=%s)", async background => {
await syncEnabledClientIntegrations(12345, config, deps(), background ? unattended : {});
expect(refresh.mock.calls[0]?.[1]).toContain("dsh");
});

test("no Desktop marker skips discovery, and file clients exclude Cline with a fresh admit", async () => {
const fetch = mock(async () => models);
expect(await syncEnabledClientIntegrations(12345, config, deps(fetch), unattended)).toEqual([]);
expect(fetch).not.toHaveBeenCalled(); expect(writer).not.toHaveBeenCalled();
const args = refresh.mock.calls[0]!;
expect(args[1]).toEqual(["mcode", "pi", "aside", "raycast", "omo", "commandcode", "droid", "opencode", "kilo", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "hermes", "t3code"]);
expect(args[1]).toEqual(["mcode", "pi", "aside", "raycast", "omo", "commandcode", "dsh", "droid", "opencode", "kilo", "qoder", "qoder-cn", "workbuddy", "workbuddy-ai", "hermes", "t3code"]);
expect(args[2]?.refreshOnly).toBe(true); expect(args[2]?.admit?.()).toBe(true);
config.runtimeRole = "hub"; persist(); expect(args[2]?.admit?.()).toBe(false);
config.unauthenticatedLoopbackListener = { enabled: true, port: 12346 }; persist();
Expand Down
Loading
Loading