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
10 changes: 8 additions & 2 deletions docs-site/src/content/docs/es/guides/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,14 @@ Usa `--model` solo con `ocx connect antigravity` para fijar el modelo predetermi

Conectar registra lo que reemplazó. Desconectar restaura los bytes originales cuando el archivo no ha
cambiado y, en caso contrario, revierte solo las entradas propias de OpenCodex y conserva tus otras
ediciones. El bloque marcado de `agy` en un perfil de shell se elimina entero, incluida cualquier edición
hecha dentro de él. Un enlace simbólico de un perfil de `agy` debe apuntar a otro perfil compatible
ediciones. Antigravity puede restaurar la configuración aunque se reordenen las claves JSON y conserva
el archivo y el registro de restauración si hay un conflicto con un ajuste gestionado.
Para resolver un conflicto de Antigravity, repón el valor que aplicó OpenCodex y vuelve a intentarlo.
Si OpenCodex muestra `agy-profile-restore-required`, abre el perfil de shell indicado en el error.
Recupera de una copia el bloque completo de `agy`, incluidas las dos líneas de marcador y la función
entre ellas, y vuelve a intentar la desconexión o la desinstalación. OpenCodex elimina el bloque entero
y conserva los cambios que quedan fuera. También puedes restaurar el perfil original guardado, lo que
reemplaza las ediciones posteriores. Un enlace simbólico de un perfil de `agy` debe apuntar a otro perfil compatible
de la misma familia de shells dentro de tu directorio personal. El archivo de configuración de
Antigravity debe resolverse a la ruta exacta `~/.antigravity/settings.json`. Reinicia Antigravity, o
abre una terminal nueva para `agy`, para aplicar un cambio. Al desconectar, `agy` omite los perfiles
Expand Down
9 changes: 7 additions & 2 deletions docs-site/src/content/docs/guides/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1245,8 +1245,13 @@ ocx disconnect antigravity # or: ocx disconnect agy
Use `--model` only with `ocx connect antigravity` to set the desktop app's default model.

Connect records what it replaced. Disconnect puts the original bytes back when the file is unchanged, and
otherwise reverts only OpenCodex's own entries and keeps your other edits. The marked `agy` block in a
shell profile is removed whole, including any edit made inside it. An `agy` profile symlink must resolve
otherwise reverts only OpenCodex's own entries and keeps your other edits. Antigravity can restore
settings after JSON keys are reordered and keeps the file and restore record when a managed setting conflicts.
To resolve an Antigravity conflict, put the managed setting back to the value OpenCodex applied and
retry. If OpenCodex reports `agy-profile-restore-required`, open the shell profile named in the error.
Restore the complete `agy` block from a copy, including both marker lines and the function between
them, then retry disconnect or uninstall. OpenCodex removes the whole block and keeps edits outside
it. You can also restore the saved original profile, which replaces any later edits. An `agy` profile symlink must resolve
to another supported profile for the same shell family under your home. Antigravity settings must resolve
to the exact `~/.antigravity/settings.json` path. Restart Antigravity, or open a new terminal for `agy`,
to apply a change. During disconnect, `agy` skips profiles without a restore record if they cannot be
Expand Down
15 changes: 14 additions & 1 deletion gui/src/i18n/gateway-clients-copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copy for the Antigravity and agy connect tab. One row per key, columns in the order of
* `locales`, kept apart from the per-locale files like remote-link-diagnostics-copy.ts. The
* server sends a code for every note, override and refusal; this table is what the user reads.
* Only file paths and the text of an I/O error are shown as sent.
* File paths and diagnostics without a specific translation can be shown as sent.
*/
type Locale = "en" | "ko" | "de" | "fr" | "zh" | "zh-TW" | "ru" | "ja" | "tr" | "vi" | "pt";
const locales: readonly Locale[] = ["en", "ko", "de", "fr", "zh", "zh-TW", "ru", "ja", "tr", "vi", "pt"];
Expand Down Expand Up @@ -47,6 +47,19 @@ const rows = {
refusedIo: ["Could not write the client files:","클라이언트 파일을 쓰지 못했어요:","Die Clientdateien konnten nicht geschrieben werden:","Impossible d’écrire les fichiers du client :","无法写入客户端文件:","無法寫入用戶端檔案:","Не удалось записать файлы клиента:","クライアントのファイルを書き込めませんでした:","İstemci dosyaları yazılamadı:","Không ghi được các tệp của máy khách:","Não foi possível gravar os arquivos do cliente:"],
refused: ["The proxy refused the change:","프록시가 변경을 거부했어요:","Der Proxy hat die Änderung abgelehnt:","Le proxy a refusé la modification :","代理拒绝了此更改:","代理拒絕了此變更:","Прокси отклонил изменение:","プロキシが変更を拒否しました:","Proxy değişikliği reddetti:","Proxy đã từ chối thay đổi:","O proxy recusou a alteração:"],
actionFailed: ["Could not confirm whether the change was applied. Check the client status before trying again.","변경이 적용됐는지 확인하지 못했어요. 다시 시도하기 전에 클라이언트 상태를 확인하세요.","Es ließ sich nicht bestätigen, ob die Änderung übernommen wurde. Prüfen Sie den Client-Status, bevor Sie es erneut versuchen.","Impossible de confirmer si la modification a été appliquée. Vérifiez l’état du client avant de réessayer.","无法确认更改是否已生效。请先检查客户端状态再重试。","無法確認變更是否已生效。請先檢查用戶端狀態再重試。","Не удалось подтвердить, применено ли изменение. Проверьте состояние клиента, прежде чем повторять попытку.","変更が適用されたか確認できませんでした。再試行する前にクライアントの状態を確認してください。","Değişikliğin uygulanıp uygulanmadığı doğrulanamadı. Yeniden denemeden önce istemci durumunu kontrol edin.","Không xác nhận được thay đổi đã được áp dụng hay chưa. Hãy kiểm tra trạng thái client trước khi thử lại.","Não foi possível confirmar se a alteração foi aplicada. Verifique o status do cliente antes de tentar novamente."],
refusedAgyProfile: [
"OpenCodex could not verify the agy profile at {path}. Restore the complete marked agy block or the saved original profile, then retry.",
"OpenCodex가 {path}의 agy 프로필을 확인하지 못했어요. 마커가 포함된 agy 블록 전체나 저장된 원본 프로필을 복원한 뒤 다시 시도하세요.",
"OpenCodex konnte das agy-Profil unter {path} nicht überprüfen. Stellen Sie den vollständigen markierten agy-Block oder das gesicherte Originalprofil wieder her und versuchen Sie es erneut.",
"OpenCodex n’a pas pu vérifier le profil agy dans {path}. Rétablissez le bloc agy complet avec ses marqueurs ou le profil d’origine sauvegardé, puis réessayez.",
"OpenCodex 无法验证 {path} 中的 agy 配置文件。请恢复带标记的完整 agy 配置块或已保存的原始配置文件,然后重试。",
"OpenCodex 無法驗證 {path} 中的 agy 設定檔。請還原帶有標記的完整 agy 區塊或已儲存的原始設定檔,然後重試。",
"OpenCodex не удалось проверить профиль agy по пути {path}. Восстановите весь блок agy вместе с маркерами или сохранённый исходный профиль и повторите попытку.",
"OpenCodex は {path} の agy プロファイルを確認できませんでした。マーカーを含む agy ブロック全体か、保存された元のプロファイルを復元してから、もう一度お試しください。",
"OpenCodex, {path} konumundaki agy profilini doğrulayamadı. İşaretleyicileriyle birlikte agy bloğunun tamamını veya kaydedilmiş özgün profili geri yükleyip yeniden deneyin.",
"OpenCodex không xác minh được hồ sơ agy tại {path}. Hãy khôi phục toàn bộ khối agy cùng các dấu đánh dấu hoặc hồ sơ gốc đã lưu, rồi thử lại.",
"O OpenCodex não conseguiu verificar o perfil do agy em {path}. Restaure o bloco completo do agy com seus marcadores ou o perfil original salvo e tente novamente.",
],
} satisfies Record<string, Row>;

export type GatewayClientsCopyKey = `gatewayClients.${keyof typeof rows}`;
Expand Down
13 changes: 10 additions & 3 deletions gui/src/pages/integrations/GatewayClientsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,26 @@ const NOTE_KEYS: Record<GatewayNoteCode, TKey | null> = {
const REFUSAL_KEYS: Record<string, TKey> = {
"requires-admission-token": "gatewayClients.refusedCredential",
"invalid-model": "gatewayClients.refusedModel",
"unsupported-file": "gatewayClients.refusedFile",
};

const APPLY_HINT: Record<GatewayClientId, TKey> = {
antigravity: "gatewayClients.hintAntigravity",
agy: "gatewayClients.hintAgy",
};

interface OutcomeView { tone: "ok" | "err"; keys: TKey[]; detail: string | null }
interface OutcomeView { tone: "ok" | "err"; keys: TKey[]; detail: string | null; vars?: Record<string, string> }

function describeOutcome(id: GatewayClientId, action: GatewayClientAction, outcome: GatewayClientActionOutcome): OutcomeView {
if (!outcome.reached) return { tone: "err", keys: ["gatewayClients.actionFailed"], detail: null };
if (!outcome.ok) {
if (outcome.code === "agy-profile-restore-required") {
return outcome.profilePath
? { tone: "err", keys: ["gatewayClients.refusedAgyProfile"], detail: null, vars: { path: outcome.profilePath } }
: { tone: "err", keys: ["gatewayClients.actionFailed"], detail: null };
}
if (id === "antigravity" && outcome.code === "unsupported-file") {
return { tone: "err", keys: ["gatewayClients.refusedFile"], detail: null };
Comment on lines +71 to +72

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Distinguish settings conflicts from JSON parsing failures

When a user edits a managed Antigravity setting after connecting, the new conflict check in antigravity.ts returns unsupported-file even though the settings remain valid JSON. This branch consequently displays “settings.json could not be read as a JSON object” and discards the server message identifying the conflicting setting. Dashboard users are told to fix JSON that is already valid instead of restoring the managed value needed to retry disconnect. Give conflicts a distinct refusal code and translated recovery guidance, including the affected setting. This also keeps dashboard behavior aligned with the management API as required by gui/AGENTS.md.

AGENTS.md reference: gui/AGENTS.md:L10-L10

Useful? React with 👍 / 👎.

}
const known = outcome.code ? REFUSAL_KEYS[outcome.code] : undefined;
if (known) return { tone: "err", keys: [known], detail: null };
// The text of an I/O error is the operating system's; any other unexpected refusal is shown as sent.
Expand Down Expand Up @@ -173,7 +180,7 @@ function GatewayClientCard({

{result && (
<Notice tone={result.tone}>
{result.keys.map(key => t(key)).join(" ")}
{result.keys.map(key => t(key, result.vars)).join(" ")}
{result.detail && <> <code>{result.detail}</code></>}
</Notice>
)}
Expand Down
8 changes: 5 additions & 3 deletions gui/src/pages/integrations/gateway-clients-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ export interface GatewayClientStatus {

/**
* `reached` is false when the request never produced a readable answer from the proxy. A refusal
* carries `code` (and `message` for an I/O error, whose text is the operating system's);
* carries a `code`, with a home-relative `profilePath` for agy restore refusals;
* a success carries what was done: `changed` and, for a disconnect, `restore`.
*/
export interface GatewayClientActionOutcome {
reached: boolean;
ok: boolean;
code: string | null;
message: string | null;
profilePath: string | null;
changed: boolean;
restore: "exact" | "path-wise" | "none" | null;
}
Expand Down Expand Up @@ -65,16 +66,17 @@ export async function runGatewayClientAction(
headers: { "Content-Type": "application/json" },
body: JSON.stringify(model ? { model } : {}),
});
const body = await response.json() as { ok?: unknown; code?: unknown; message?: unknown; changed?: unknown; restore?: unknown };
const body = await response.json() as { ok?: unknown; code?: unknown; message?: unknown; profilePath?: unknown; changed?: unknown; restore?: unknown };
return {
reached: true,
ok: response.ok && body.ok === true,
code: typeof body.code === "string" ? body.code : null,
message: typeof body.message === "string" && body.message ? body.message : null,
profilePath: typeof body.profilePath === "string" && body.profilePath.startsWith("~/") ? body.profilePath : null,
changed: body.changed === true,
restore: typeof body.restore === "string" && RESTORES.has(body.restore) ? body.restore as GatewayClientActionOutcome["restore"] : null,
};
} catch {
return { reached: false, ok: false, code: null, message: null, changed: false, restore: null };
return { reached: false, ok: false, code: null, message: null, profilePath: null, changed: false, restore: null };
}
}
27 changes: 24 additions & 3 deletions gui/tests/gateway-clients-page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,35 @@ test("an untouched model field sends no model, so the current one is kept", asyn

test("a refusal is translated from its code, and an I/O error keeps the system text", async () => {
actionResponse = () => json({ ok: false, code: "unsupported-file", message: "settings.json is not a JSON object; left untouched." }, 409);
clients[0]!.state = "connected";
await mount();
await act(async () => { button(card("agy"), "Disconnect").click(); });
await act(async () => { button(card("antigravity"), "Disconnect").click(); });
await settle();
expect(requests.find(request => request.method === "POST")?.url).toBe(`${apiBase}/api/gateway-clients/agy/disconnect`);
expect(card("agy").querySelector(".notice-err")?.textContent).toBe("settings.json could not be read as a JSON object, so OpenCodex left it untouched. Fix the file, then try again.");
expect(requests.find(request => request.method === "POST")?.url).toBe(`${apiBase}/api/gateway-clients/antigravity/disconnect`);
expect(card("antigravity").querySelector(".notice-err")?.textContent).toBe("settings.json could not be read as a JSON object, so OpenCodex left it untouched. Fix the file, then try again.");

actionResponse = () => json({ ok: false, code: "io-error", message: "EACCES: permission denied" }, 409);
await act(async () => { button(card("agy"), "Disconnect").click(); });
await settle();
expect(card("agy").querySelector(".notice-err code")?.textContent).toBe("EACCES: permission denied");
});

test("agy disconnect shows the affected shell profile and recovery instructions", async () => {
clients[1]!.state = "drifted";
actionResponse = () => json({
ok: false,
code: "agy-profile-restore-required",
profilePath: "~/.zshrc",
message: "Server diagnostic that must stay hidden.",
}, 409);
await mount();
const agy = card("agy");
await act(async () => { button(agy, "Disconnect").click(); });
await settle();

expect(requests.find(request => request.method === "POST")?.url).toBe(`${apiBase}/api/gateway-clients/agy/disconnect`);
expect(agy.querySelector(".notice-err")?.textContent).toBe(
"OpenCodex could not verify the agy profile at ~/.zshrc. Restore the complete marked agy block or the saved original profile, then retry.",
);
expect(button(agy, "Disconnect").disabled).toBe(false);
});
1 change: 1 addition & 0 deletions scripts/test-layout/layout-clients.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"windows-config-root-integration-writers.test.ts": "windows",
"windows-cli-config-root-startup.test.ts": "windows",
"t3code-client-lifecycle.test.ts": "clients",
"gateway-client-restore.test.ts": "clients",
"gateway-client-safety.test.ts": "clients",
"gateway-clients.test.ts": "clients",
"gateway-client-command.test.ts": "cli",
Expand Down
Loading
Loading