diff options
| author | David Hill <[email protected]> | 2025-12-12 22:50:50 +0000 |
|---|---|---|
| committer | David Hill <[email protected]> | 2025-12-12 22:50:50 +0000 |
| commit | dbc84ff4c347aa446e18b80ef1811c5fd9c886f9 (patch) | |
| tree | d4b4640a6f90ad62b57d6942a2fe3fef232f86bf /packages/util | |
| parent | c11ea3fd923957d8f6c94878e69babdbad194e31 (diff) | |
| parent | 3c3a0f8afbc1325ab53985995826f5ccf6c80737 (diff) | |
| download | opencode-dbc84ff4c347aa446e18b80ef1811c5fd9c886f9.tar.gz opencode-dbc84ff4c347aa446e18b80ef1811c5fd9c886f9.zip | |
Merge branch 'dev' of https://github.com/sst/opencode into dev
Diffstat (limited to 'packages/util')
| -rw-r--r-- | packages/util/package.json | 2 | ||||
| -rw-r--r-- | packages/util/src/sanitize.ts | 28 | ||||
| -rw-r--r-- | packages/util/src/shell.ts | 13 |
3 files changed, 1 insertions, 42 deletions
diff --git a/packages/util/package.json b/packages/util/package.json index 496987ebb..43a5f7bb3 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@opencode-ai/util", - "version": "1.0.150", + "version": "1.0.152", "private": true, "type": "module", "exports": { diff --git a/packages/util/src/sanitize.ts b/packages/util/src/sanitize.ts deleted file mode 100644 index 4bb762393..000000000 --- a/packages/util/src/sanitize.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Part } from "@opencode-ai/sdk/v2/client" - -export const sanitize = (text: string | undefined, remove?: RegExp) => (remove ? text?.replace(remove, "") : text) ?? "" - -export const sanitizePart = (part: Part, remove: RegExp | undefined) => { - if (part.type === "text") { - part.text = sanitize(part.text, remove) - } else if (part.type === "reasoning") { - part.text = sanitize(part.text, remove) - } else if (part.type === "tool") { - if (part.state.status === "completed" || part.state.status === "error") { - for (const key in part.state.metadata) { - if (typeof part.state.metadata[key] === "string") { - part.state.metadata[key] = sanitize(part.state.metadata[key] as string, remove) - } - } - for (const key in part.state.input) { - if (typeof part.state.input[key] === "string") { - part.state.input[key] = sanitize(part.state.input[key] as string, remove) - } - } - if ("error" in part.state) { - part.state.error = sanitize(part.state.error as string, remove) - } - } - } - return part -} diff --git a/packages/util/src/shell.ts b/packages/util/src/shell.ts deleted file mode 100644 index e23ba0199..000000000 --- a/packages/util/src/shell.ts +++ /dev/null @@ -1,13 +0,0 @@ -export function shell() { - const s = process.env.SHELL - if (s) return s - if (process.platform === "darwin") { - return "/bin/zsh" - } - if (process.platform === "win32") { - return process.env.COMSPEC || "cmd.exe" - } - const bash = Bun.which("bash") - if (bash) return bash - return "bash" -} |
