Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): strip OSC/ANSI escapes from OpenCode CLI inventory and stored agent selections #7755

ClosedImBIOS(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7755/headopened View on GitHub

Showing 8 changed files with 79 additions and 6 deletions (loading 5).

x
0 of 8 viewed, 8 left
6 additions and 3 deletionsapps/server/src/provider/Layers/OpenCodeAdapter.tsModified
View file
@@ -25,6 +25,7 @@
import * as Stream from "effect/Stream";
import type { OpencodeClient, Part, PermissionRequest, QuestionRequest } from "@opencode-ai/sdk/v2";
import { getModelSelectionStringOptionValue } from "@t3tools/shared/model";
+import { sanitizeTerminalValue } from "@t3tools/shared/stripTerminalEscapes";
​
import { resolveAttachmentPath } from "../../attachmentStore.ts";
import { ServerConfig } from "../../config.ts";
@@ -1472,12 +1473,14 @@
- const agent = getModelSelectionStringOptionValue(modelSelection, "agent");
- const variant = getModelSelectionStringOptionValue(modelSelection, "variant");
+ const rawAgent = getModelSelectionStringOptionValue(modelSelection, "agent");
+ const rawVariant = getModelSelectionStringOptionValue(modelSelection, "variant");
+ const agent = rawAgent ? sanitizeTerminalValue(rawAgent) : undefined;
+ const variant = rawVariant ? sanitizeTerminalValue(rawVariant) : undefined;
context.activeTurnId = turnId;
context.activeAgent = agent ?? (input.interactionMode === "plan" ? "plan" : undefined);
- context.activeVariant = variant;
+ context.activeVariant = variant || undefined;
yield* updateProviderSession(
context,
11 additions and 3 deletionsapps/server/src/provider/Layers/OpenCodeProvider.tsModified
View file