diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx index a59fad7b..07e1a1eb 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx @@ -3,6 +3,7 @@ import { useSync } from "@tui/context/sync" import { DialogSelect } from "@tui/ui/dialog-select" import { useSDK } from "@tui/context/sdk" import { useRoute } from "@tui/context/route" +import { Clipboard } from "@tui/util/clipboard" import type { PromptInfo } from "@tui/component/prompt/history" export function DialogMessage(props: { @@ -54,6 +55,26 @@ export function DialogMessage(props: { dialog.clear() }, }, + { + title: "Copy", + value: "message.copy", + description: "copy message text to clipboard", + onSelect: async (dialog) => { + const msg = message() + if (!msg) return + + const parts = sync.data.part[msg.id] + const text = parts.reduce((agg, part) => { + if (part.type === "text" && !part.synthetic) { + agg += part.text + } + return agg + }, "") + + await Clipboard.copy(text) + dialog.clear() + }, + }, { title: "Fork", value: "session.fork", diff --git a/packages/plugin/package.json b/packages/plugin/package.json index 43002ca6..b2a3c93f 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -24,4 +24,4 @@ "typescript": "catalog:", "@typescript/native-preview": "catalog:" } -} \ No newline at end of file +} diff --git a/packages/sdk/js/package.json b/packages/sdk/js/package.json index 88658a1e..d2b5e444 100644 --- a/packages/sdk/js/package.json +++ b/packages/sdk/js/package.json @@ -26,4 +26,4 @@ "publishConfig": { "directory": "dist" } -} \ No newline at end of file +}