Skip to content

The open source coding agent.

TypeScript

Use structuredClone instead of remeda's clone (#14351)

Michael Hart8ad60b1ec200
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx
index c40534e7ec2..c1198039d66 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx
@@ -3,7 +3,6 @@ import { Global } from "@/global"
import { Filesystem } from "@/util/filesystem"
import { onMount } from "solid-js"
import { createStore, produce } from "solid-js/store"
-import { clone } from "remeda"
import { createSimpleContext } from "../../context/helper"
import { appendFile, writeFile } from "fs/promises"
import type { AgentPart, FilePart, TextPart } from "@opencode-ai/sdk/v2"
@@ -83,7 +82,7 @@ export const { use: usePromptHistory, provider: PromptHistoryProvider } = create
return store.history.at(store.index)
},
append(item: PromptInfo) {
- const entry = clone(item)
+ const entry = structuredClone(item)
let trimmed = false
setStore(
produce((draft) => {
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/stash.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/stash.tsx
index d4dc138d893..4a831b2735b 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/stash.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/stash.tsx
@@ -3,7 +3,6 @@ import { Global } from "@/global"
import { Filesystem } from "@/util/filesystem"
import { onMount } from "solid-js"
import { createStore, produce } from "solid-js/store"
-import { clone } from "remeda"
import { createSimpleContext } from "../../context/helper"
import { appendFile, writeFile } from "fs/promises"
import type { PromptInfo } from "./history"
@@ -53,7 +52,7 @@ export const { use: usePromptStash, provider: PromptStashProvider } = createSimp
return store.entries
},
push(entry: Omit<StashEntry, "timestamp">) {
- const stash = clone({ ...entry, timestamp: Date.now() })
+ const stash = structuredClone({ ...entry, timestamp: Date.now() })
let trimmed = false
setStore(
produce((draft) => {