opencode-deepseek-peak 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,110 @@
1
+ import type { Plugin } from "@opencode/plugin/tui"
2
+ import { createT, LANG_META, type LangCode } from "../i18n.js"
3
+ import type { TuiSettings } from "../types.js"
4
+
5
+ const nextTick = () => new Promise<void>((resolve) => setTimeout(resolve, 0))
6
+
7
+ /**
8
+ * Native sections menu: each pick applies and persists immediately, then the
9
+ * menu reopens (the host closes the dialog before the next select). Cancelling
10
+ * exits the menu.
11
+ */
12
+ export function openSettingsMenu(
13
+ context: Plugin.Context,
14
+ settings: TuiSettings,
15
+ update: (mutation: (draft: TuiSettings) => void) => Promise<void>,
16
+ lang: () => LangCode,
17
+ ): void {
18
+ const t = createT(lang)
19
+ const onOff = (value: boolean) => (value ? t("settings.on") : t("settings.off"))
20
+
21
+ const pickBool = (title: string, current: boolean) =>
22
+ context.ui.dialog.select<boolean>({
23
+ title,
24
+ options: [
25
+ { title: t("settings.on"), value: true },
26
+ { title: t("settings.off"), value: false },
27
+ ],
28
+ current,
29
+ })
30
+
31
+ void (async () => {
32
+ while (true) {
33
+ const choice = await context.ui.dialog.select<string>({
34
+ title: t("settings.title"),
35
+ options: [
36
+ { title: `${t("settings.toast")}: ${onOff(settings.toast)}`, value: "toast" },
37
+ { title: `${t("settings.footer")}: ${onOff(settings.indicator)}`, value: "indicator" },
38
+ { title: `${t("settings.sidebar")}: ${onOff(settings.sidebarIndicator !== false)}`, value: "sidebar" },
39
+ { title: `${t("settings.evidence")}: ${onOff(settings.sidebarEvidence !== false)}`, value: "evidence" },
40
+ {
41
+ title: `${t("settings.frequency")}: ${settings.toastEveryRequest ? t("frequency.every") : t("frequency.change")}`,
42
+ value: "frequency",
43
+ },
44
+ {
45
+ title: `${t("settings.lang")}: ${LANG_META.find((meta) => meta.code === lang())?.label ?? lang()}`,
46
+ value: "lang",
47
+ },
48
+ ],
49
+ })
50
+ if (choice === undefined) return
51
+
52
+ if (choice === "toast") {
53
+ const picked = await pickBool(t("settings.toast"), settings.toast)
54
+ if (picked !== undefined) {
55
+ await update((draft) => {
56
+ draft.toast = picked
57
+ })
58
+ }
59
+ } else if (choice === "indicator") {
60
+ const picked = await pickBool(t("settings.footer"), settings.indicator)
61
+ if (picked !== undefined) {
62
+ await update((draft) => {
63
+ draft.indicator = picked
64
+ })
65
+ }
66
+ } else if (choice === "sidebar") {
67
+ const picked = await pickBool(t("settings.sidebar"), settings.sidebarIndicator !== false)
68
+ if (picked !== undefined) {
69
+ await update((draft) => {
70
+ draft.sidebarIndicator = picked
71
+ })
72
+ }
73
+ } else if (choice === "evidence") {
74
+ const picked = await pickBool(t("settings.evidence"), settings.sidebarEvidence !== false)
75
+ if (picked !== undefined) {
76
+ await update((draft) => {
77
+ draft.sidebarEvidence = picked
78
+ })
79
+ }
80
+ } else if (choice === "frequency") {
81
+ const picked = await context.ui.dialog.select<"change" | "every">({
82
+ title: t("settings.frequency"),
83
+ options: [
84
+ { title: t("frequency.change"), value: "change" },
85
+ { title: t("frequency.every"), value: "every" },
86
+ ],
87
+ current: settings.toastEveryRequest ? "every" : "change",
88
+ })
89
+ if (picked !== undefined) {
90
+ await update((draft) => {
91
+ draft.toastEveryRequest = picked === "every"
92
+ })
93
+ }
94
+ } else if (choice === "lang") {
95
+ const picked = await context.ui.dialog.select<LangCode>({
96
+ title: t("settings.lang"),
97
+ options: LANG_META.map((meta) => ({ title: meta.label, value: meta.code })),
98
+ current: lang(),
99
+ })
100
+ if (picked !== undefined) {
101
+ await update((draft) => {
102
+ draft.lang = picked
103
+ })
104
+ }
105
+ }
106
+
107
+ await nextTick()
108
+ }
109
+ })()
110
+ }
package/tui/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import mod from "./../dist/tui.js"
2
+
3
+ export default {
4
+ id: "opencode-deepseek-peak-tui",
5
+ setup: mod.setup,
6
+ }