bincode-cli 1.0.1
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.
- package/AGENTS.md +27 -0
- package/README.md +15 -0
- package/bin/bincode +98 -0
- package/bunfig.toml +4 -0
- package/package.json +124 -0
- package/parsers-config.ts +239 -0
- package/script/build.ts +167 -0
- package/script/postinstall.mjs +206 -0
- package/script/publish.ts +99 -0
- package/script/schema.ts +47 -0
- package/src/acp/README.md +164 -0
- package/src/acp/agent.ts +1051 -0
- package/src/acp/session.ts +101 -0
- package/src/acp/types.ts +22 -0
- package/src/agent/agent.ts +398 -0
- package/src/agent/generate.txt +75 -0
- package/src/agent/prompt/compaction.txt +12 -0
- package/src/agent/prompt/explore.txt +18 -0
- package/src/agent/prompt/summary.txt +10 -0
- package/src/agent/prompt/title.txt +36 -0
- package/src/auth/bineric-login.ts +506 -0
- package/src/auth/index.ts +70 -0
- package/src/bun/index.ts +114 -0
- package/src/bus/bus-event.ts +43 -0
- package/src/bus/global.ts +10 -0
- package/src/bus/index.ts +105 -0
- package/src/cli/auth-check.ts +61 -0
- package/src/cli/bootstrap.ts +21 -0
- package/src/cli/cmd/acp.ts +88 -0
- package/src/cli/cmd/agent.ts +256 -0
- package/src/cli/cmd/auth.ts +436 -0
- package/src/cli/cmd/cmd.ts +7 -0
- package/src/cli/cmd/debug/config.ts +15 -0
- package/src/cli/cmd/debug/file.ts +91 -0
- package/src/cli/cmd/debug/index.ts +43 -0
- package/src/cli/cmd/debug/lsp.ts +48 -0
- package/src/cli/cmd/debug/ripgrep.ts +83 -0
- package/src/cli/cmd/debug/scrap.ts +15 -0
- package/src/cli/cmd/debug/skill.ts +15 -0
- package/src/cli/cmd/debug/snapshot.ts +48 -0
- package/src/cli/cmd/export.ts +88 -0
- package/src/cli/cmd/generate.ts +38 -0
- package/src/cli/cmd/github.ts +1399 -0
- package/src/cli/cmd/import.ts +98 -0
- package/src/cli/cmd/login.ts +112 -0
- package/src/cli/cmd/logout.ts +38 -0
- package/src/cli/cmd/mcp.ts +654 -0
- package/src/cli/cmd/models.ts +77 -0
- package/src/cli/cmd/pr.ts +112 -0
- package/src/cli/cmd/run.ts +368 -0
- package/src/cli/cmd/serve.ts +31 -0
- package/src/cli/cmd/session.ts +106 -0
- package/src/cli/cmd/stats.ts +298 -0
- package/src/cli/cmd/tui/app.tsx +669 -0
- package/src/cli/cmd/tui/attach.ts +30 -0
- package/src/cli/cmd/tui/component/border.tsx +21 -0
- package/src/cli/cmd/tui/component/dialog-agent.tsx +31 -0
- package/src/cli/cmd/tui/component/dialog-command.tsx +123 -0
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +86 -0
- package/src/cli/cmd/tui/component/dialog-model.tsx +223 -0
- package/src/cli/cmd/tui/component/dialog-provider.tsx +224 -0
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +102 -0
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +31 -0
- package/src/cli/cmd/tui/component/dialog-status.tsx +162 -0
- package/src/cli/cmd/tui/component/dialog-tag.tsx +44 -0
- package/src/cli/cmd/tui/component/dialog-theme-list.tsx +50 -0
- package/src/cli/cmd/tui/component/logo.tsx +32 -0
- package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +560 -0
- package/src/cli/cmd/tui/component/prompt/history.tsx +108 -0
- package/src/cli/cmd/tui/component/prompt/index.tsx +1052 -0
- package/src/cli/cmd/tui/context/args.tsx +14 -0
- package/src/cli/cmd/tui/context/directory.ts +13 -0
- package/src/cli/cmd/tui/context/exit.tsx +23 -0
- package/src/cli/cmd/tui/context/helper.tsx +25 -0
- package/src/cli/cmd/tui/context/keybind.tsx +101 -0
- package/src/cli/cmd/tui/context/kv.tsx +49 -0
- package/src/cli/cmd/tui/context/local.tsx +339 -0
- package/src/cli/cmd/tui/context/prompt.tsx +18 -0
- package/src/cli/cmd/tui/context/route.tsx +46 -0
- package/src/cli/cmd/tui/context/sdk.tsx +74 -0
- package/src/cli/cmd/tui/context/sync.tsx +372 -0
- package/src/cli/cmd/tui/context/theme/aura.json +69 -0
- package/src/cli/cmd/tui/context/theme/ayu.json +80 -0
- package/src/cli/cmd/tui/context/theme/bincode.json +245 -0
- package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +233 -0
- package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +233 -0
- package/src/cli/cmd/tui/context/theme/catppuccin.json +112 -0
- package/src/cli/cmd/tui/context/theme/cobalt2.json +228 -0
- package/src/cli/cmd/tui/context/theme/cursor.json +249 -0
- package/src/cli/cmd/tui/context/theme/dracula.json +219 -0
- package/src/cli/cmd/tui/context/theme/everforest.json +241 -0
- package/src/cli/cmd/tui/context/theme/flexoki.json +237 -0
- package/src/cli/cmd/tui/context/theme/github.json +233 -0
- package/src/cli/cmd/tui/context/theme/gruvbox.json +95 -0
- package/src/cli/cmd/tui/context/theme/kanagawa.json +77 -0
- package/src/cli/cmd/tui/context/theme/lucent-orng.json +227 -0
- package/src/cli/cmd/tui/context/theme/material.json +235 -0
- package/src/cli/cmd/tui/context/theme/matrix.json +77 -0
- package/src/cli/cmd/tui/context/theme/mercury.json +252 -0
- package/src/cli/cmd/tui/context/theme/monokai.json +221 -0
- package/src/cli/cmd/tui/context/theme/nightowl.json +221 -0
- package/src/cli/cmd/tui/context/theme/nord.json +223 -0
- package/src/cli/cmd/tui/context/theme/one-dark.json +84 -0
- package/src/cli/cmd/tui/context/theme/orng.json +245 -0
- package/src/cli/cmd/tui/context/theme/palenight.json +222 -0
- package/src/cli/cmd/tui/context/theme/rosepine.json +234 -0
- package/src/cli/cmd/tui/context/theme/solarized.json +223 -0
- package/src/cli/cmd/tui/context/theme/synthwave84.json +226 -0
- package/src/cli/cmd/tui/context/theme/tokyonight.json +243 -0
- package/src/cli/cmd/tui/context/theme/vercel.json +245 -0
- package/src/cli/cmd/tui/context/theme/vesper.json +218 -0
- package/src/cli/cmd/tui/context/theme/zenburn.json +223 -0
- package/src/cli/cmd/tui/context/theme.tsx +1109 -0
- package/src/cli/cmd/tui/event.ts +40 -0
- package/src/cli/cmd/tui/routes/home.tsx +105 -0
- package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +64 -0
- package/src/cli/cmd/tui/routes/session/dialog-message.tsx +109 -0
- package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +26 -0
- package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +47 -0
- package/src/cli/cmd/tui/routes/session/footer.tsx +88 -0
- package/src/cli/cmd/tui/routes/session/header.tsx +141 -0
- package/src/cli/cmd/tui/routes/session/index.tsx +1888 -0
- package/src/cli/cmd/tui/routes/session/sidebar.tsx +321 -0
- package/src/cli/cmd/tui/spawn.ts +60 -0
- package/src/cli/cmd/tui/thread.ts +120 -0
- package/src/cli/cmd/tui/ui/dialog-alert.tsx +57 -0
- package/src/cli/cmd/tui/ui/dialog-confirm.tsx +83 -0
- package/src/cli/cmd/tui/ui/dialog-help.tsx +38 -0
- package/src/cli/cmd/tui/ui/dialog-prompt.tsx +77 -0
- package/src/cli/cmd/tui/ui/dialog-select.tsx +330 -0
- package/src/cli/cmd/tui/ui/dialog.tsx +170 -0
- package/src/cli/cmd/tui/ui/spinner.ts +368 -0
- package/src/cli/cmd/tui/ui/toast.tsx +100 -0
- package/src/cli/cmd/tui/util/clipboard.ts +127 -0
- package/src/cli/cmd/tui/util/editor.ts +32 -0
- package/src/cli/cmd/tui/util/terminal.ts +114 -0
- package/src/cli/cmd/tui/worker.ts +63 -0
- package/src/cli/cmd/uninstall.ts +344 -0
- package/src/cli/cmd/upgrade.ts +67 -0
- package/src/cli/cmd/web.ts +84 -0
- package/src/cli/error.ts +55 -0
- package/src/cli/ui.ts +84 -0
- package/src/cli/upgrade.ts +25 -0
- package/src/command/index.ts +80 -0
- package/src/command/template/initialize.txt +10 -0
- package/src/command/template/review.txt +97 -0
- package/src/config/config.ts +995 -0
- package/src/config/markdown.ts +41 -0
- package/src/env/index.ts +26 -0
- package/src/file/ignore.ts +83 -0
- package/src/file/index.ts +328 -0
- package/src/file/ripgrep.ts +393 -0
- package/src/file/time.ts +64 -0
- package/src/file/watcher.ts +103 -0
- package/src/flag/flag.ts +46 -0
- package/src/format/formatter.ts +315 -0
- package/src/format/index.ts +137 -0
- package/src/global/index.ts +52 -0
- package/src/id/id.ts +73 -0
- package/src/ide/index.ts +76 -0
- package/src/index.ts +217 -0
- package/src/installation/index.ts +196 -0
- package/src/lsp/client.ts +229 -0
- package/src/lsp/index.ts +485 -0
- package/src/lsp/language.ts +116 -0
- package/src/lsp/server.ts +1895 -0
- package/src/mcp/auth.ts +135 -0
- package/src/mcp/index.ts +654 -0
- package/src/mcp/oauth-callback.ts +200 -0
- package/src/mcp/oauth-provider.ts +154 -0
- package/src/patch/index.ts +622 -0
- package/src/permission/index.ts +199 -0
- package/src/plugin/index.ts +101 -0
- package/src/project/bootstrap.ts +31 -0
- package/src/project/instance.ts +78 -0
- package/src/project/project.ts +221 -0
- package/src/project/state.ts +65 -0
- package/src/project/vcs.ts +76 -0
- package/src/provider/auth.ts +143 -0
- package/src/provider/models-macro.ts +11 -0
- package/src/provider/models.ts +106 -0
- package/src/provider/provider.ts +1071 -0
- package/src/provider/sdk/openai-compatible/src/README.md +5 -0
- package/src/provider/sdk/openai-compatible/src/index.ts +2 -0
- package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +101 -0
- package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +303 -0
- package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +22 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +18 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +22 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +207 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +1713 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +177 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +1 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +88 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +128 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +115 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +65 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +104 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +103 -0
- package/src/provider/transform.ts +455 -0
- package/src/pty/index.ts +231 -0
- package/src/server/error.ts +36 -0
- package/src/server/project.ts +79 -0
- package/src/server/server.ts +2642 -0
- package/src/server/tui.ts +71 -0
- package/src/session/compaction.ts +223 -0
- package/src/session/index.ts +458 -0
- package/src/session/llm.ts +201 -0
- package/src/session/message-v2.ts +659 -0
- package/src/session/message.ts +189 -0
- package/src/session/processor.ts +409 -0
- package/src/session/prompt/anthropic-20250930.txt +166 -0
- package/src/session/prompt/anthropic.txt +104 -0
- package/src/session/prompt/anthropic_spoof.txt +1 -0
- package/src/session/prompt/beast.txt +147 -0
- package/src/session/prompt/build-switch.txt +5 -0
- package/src/session/prompt/codex.txt +318 -0
- package/src/session/prompt/copilot-gpt-5.txt +143 -0
- package/src/session/prompt/gemini.txt +155 -0
- package/src/session/prompt/max-steps.txt +16 -0
- package/src/session/prompt/plan-reminder-anthropic.txt +67 -0
- package/src/session/prompt/plan.txt +26 -0
- package/src/session/prompt/polaris.txt +106 -0
- package/src/session/prompt/qwen.txt +109 -0
- package/src/session/prompt.ts +1446 -0
- package/src/session/retry.ts +86 -0
- package/src/session/revert.ts +108 -0
- package/src/session/status.ts +76 -0
- package/src/session/summary.ts +194 -0
- package/src/session/system.ts +120 -0
- package/src/session/todo.ts +37 -0
- package/src/share/share-next.ts +194 -0
- package/src/share/share.ts +87 -0
- package/src/shell/shell.ts +67 -0
- package/src/skill/index.ts +1 -0
- package/src/skill/skill.ts +83 -0
- package/src/snapshot/index.ts +197 -0
- package/src/storage/storage.ts +226 -0
- package/src/tool/bash.ts +306 -0
- package/src/tool/bash.txt +158 -0
- package/src/tool/batch.ts +175 -0
- package/src/tool/batch.txt +24 -0
- package/src/tool/codesearch.ts +138 -0
- package/src/tool/codesearch.txt +12 -0
- package/src/tool/edit.ts +675 -0
- package/src/tool/edit.txt +10 -0
- package/src/tool/glob.ts +65 -0
- package/src/tool/glob.txt +6 -0
- package/src/tool/grep.ts +121 -0
- package/src/tool/grep.txt +8 -0
- package/src/tool/invalid.ts +17 -0
- package/src/tool/ls.ts +110 -0
- package/src/tool/ls.txt +1 -0
- package/src/tool/lsp-diagnostics.ts +26 -0
- package/src/tool/lsp-diagnostics.txt +1 -0
- package/src/tool/lsp-hover.ts +31 -0
- package/src/tool/lsp-hover.txt +1 -0
- package/src/tool/lsp.ts +87 -0
- package/src/tool/lsp.txt +19 -0
- package/src/tool/multiedit.ts +46 -0
- package/src/tool/multiedit.txt +41 -0
- package/src/tool/patch.ts +233 -0
- package/src/tool/patch.txt +1 -0
- package/src/tool/read.ts +219 -0
- package/src/tool/read.txt +12 -0
- package/src/tool/registry.ts +162 -0
- package/src/tool/skill.ts +100 -0
- package/src/tool/task.ts +136 -0
- package/src/tool/task.txt +60 -0
- package/src/tool/todo.ts +39 -0
- package/src/tool/todoread.txt +14 -0
- package/src/tool/todowrite.txt +167 -0
- package/src/tool/tool.ts +71 -0
- package/src/tool/webfetch.ts +187 -0
- package/src/tool/webfetch.txt +13 -0
- package/src/tool/websearch.ts +150 -0
- package/src/tool/websearch.txt +11 -0
- package/src/tool/write.ts +110 -0
- package/src/tool/write.txt +8 -0
- package/src/util/archive.ts +16 -0
- package/src/util/color.ts +19 -0
- package/src/util/context.ts +25 -0
- package/src/util/defer.ts +12 -0
- package/src/util/eventloop.ts +20 -0
- package/src/util/filesystem.ts +83 -0
- package/src/util/fn.ts +11 -0
- package/src/util/iife.ts +3 -0
- package/src/util/keybind.ts +102 -0
- package/src/util/lazy.ts +11 -0
- package/src/util/locale.ts +81 -0
- package/src/util/lock.ts +98 -0
- package/src/util/log.ts +180 -0
- package/src/util/queue.ts +32 -0
- package/src/util/rpc.ts +42 -0
- package/src/util/scrap.ts +10 -0
- package/src/util/signal.ts +12 -0
- package/src/util/timeout.ts +14 -0
- package/src/util/token.ts +7 -0
- package/src/util/wildcard.ts +54 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { useDialog } from "@tui/ui/dialog"
|
|
2
|
+
import { DialogSelect } from "@tui/ui/dialog-select"
|
|
3
|
+
import { useRoute } from "@tui/context/route"
|
|
4
|
+
import { useSync } from "@tui/context/sync"
|
|
5
|
+
import { createEffect, createMemo, createSignal, onMount } from "solid-js"
|
|
6
|
+
import { Locale } from "@/util/locale"
|
|
7
|
+
import { Keybind } from "@/util/keybind"
|
|
8
|
+
import { useTheme } from "../context/theme"
|
|
9
|
+
import { useSDK } from "../context/sdk"
|
|
10
|
+
import { DialogSessionRename } from "./dialog-session-rename"
|
|
11
|
+
import "opentui-spinner/solid"
|
|
12
|
+
|
|
13
|
+
export function DialogSessionList() {
|
|
14
|
+
const dialog = useDialog()
|
|
15
|
+
const sync = useSync()
|
|
16
|
+
const { theme } = useTheme()
|
|
17
|
+
const route = useRoute()
|
|
18
|
+
const sdk = useSDK()
|
|
19
|
+
|
|
20
|
+
const [toDelete, setToDelete] = createSignal<string>()
|
|
21
|
+
|
|
22
|
+
const deleteKeybind = "ctrl+d"
|
|
23
|
+
|
|
24
|
+
const currentSessionID = createMemo(() => (route.data.type === "session" ? route.data.sessionID : undefined))
|
|
25
|
+
|
|
26
|
+
const spinnerFrames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
|
27
|
+
|
|
28
|
+
const options = createMemo(() => {
|
|
29
|
+
const today = new Date().toDateString()
|
|
30
|
+
return sync.data.session
|
|
31
|
+
.filter((x) => x.parentID === undefined)
|
|
32
|
+
.toSorted((a, b) => b.time.updated - a.time.updated)
|
|
33
|
+
.map((x) => {
|
|
34
|
+
const date = new Date(x.time.updated)
|
|
35
|
+
let category = date.toDateString()
|
|
36
|
+
if (category === today) {
|
|
37
|
+
category = "Today"
|
|
38
|
+
}
|
|
39
|
+
const isDeleting = toDelete() === x.id
|
|
40
|
+
const status = sync.data.session_status?.[x.id]
|
|
41
|
+
const isWorking = status?.type === "busy"
|
|
42
|
+
return {
|
|
43
|
+
title: isDeleting ? `Press ${deleteKeybind} again to confirm` : x.title,
|
|
44
|
+
bg: isDeleting ? theme.error : undefined,
|
|
45
|
+
value: x.id,
|
|
46
|
+
category,
|
|
47
|
+
footer: Locale.time(x.time.updated),
|
|
48
|
+
gutter: isWorking ? <spinner frames={spinnerFrames} interval={80} color={theme.primary} /> : undefined,
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
.slice(0, 150)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
createEffect(() => {
|
|
55
|
+
console.log("session count", sync.data.session.length)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
onMount(() => {
|
|
59
|
+
dialog.setSize("large")
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<DialogSelect
|
|
64
|
+
title="Sessions"
|
|
65
|
+
options={options()}
|
|
66
|
+
current={currentSessionID()}
|
|
67
|
+
onMove={() => {
|
|
68
|
+
setToDelete(undefined)
|
|
69
|
+
}}
|
|
70
|
+
onSelect={(option) => {
|
|
71
|
+
route.navigate({
|
|
72
|
+
type: "session",
|
|
73
|
+
sessionID: option.value,
|
|
74
|
+
})
|
|
75
|
+
dialog.clear()
|
|
76
|
+
}}
|
|
77
|
+
keybind={[
|
|
78
|
+
{
|
|
79
|
+
keybind: Keybind.parse(deleteKeybind)[0],
|
|
80
|
+
title: "delete",
|
|
81
|
+
onTrigger: async (option) => {
|
|
82
|
+
if (toDelete() === option.value) {
|
|
83
|
+
sdk.client.session.delete({
|
|
84
|
+
sessionID: option.value,
|
|
85
|
+
})
|
|
86
|
+
setToDelete(undefined)
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
setToDelete(option.value)
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
keybind: Keybind.parse("ctrl+r")[0],
|
|
94
|
+
title: "rename",
|
|
95
|
+
onTrigger: async (option) => {
|
|
96
|
+
dialog.replace(() => <DialogSessionRename session={option.value} />)
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
]}
|
|
100
|
+
/>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DialogPrompt } from "@tui/ui/dialog-prompt"
|
|
2
|
+
import { useDialog } from "@tui/ui/dialog"
|
|
3
|
+
import { useSync } from "@tui/context/sync"
|
|
4
|
+
import { createMemo } from "solid-js"
|
|
5
|
+
import { useSDK } from "../context/sdk"
|
|
6
|
+
|
|
7
|
+
interface DialogSessionRenameProps {
|
|
8
|
+
session: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function DialogSessionRename(props: DialogSessionRenameProps) {
|
|
12
|
+
const dialog = useDialog()
|
|
13
|
+
const sync = useSync()
|
|
14
|
+
const sdk = useSDK()
|
|
15
|
+
const session = createMemo(() => sync.session.get(props.session))
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<DialogPrompt
|
|
19
|
+
title="Rename Session"
|
|
20
|
+
value={session()?.title}
|
|
21
|
+
onConfirm={(value) => {
|
|
22
|
+
sdk.client.session.update({
|
|
23
|
+
sessionID: props.session,
|
|
24
|
+
title: value,
|
|
25
|
+
})
|
|
26
|
+
dialog.clear()
|
|
27
|
+
}}
|
|
28
|
+
onCancel={() => dialog.clear()}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { TextAttributes } from "@opentui/core"
|
|
2
|
+
import { useTheme } from "../context/theme"
|
|
3
|
+
import { useSync } from "@tui/context/sync"
|
|
4
|
+
import { For, Match, Switch, Show, createMemo } from "solid-js"
|
|
5
|
+
|
|
6
|
+
export type DialogStatusProps = {}
|
|
7
|
+
|
|
8
|
+
export function DialogStatus() {
|
|
9
|
+
const sync = useSync()
|
|
10
|
+
const { theme } = useTheme()
|
|
11
|
+
|
|
12
|
+
const enabledFormatters = createMemo(() => sync.data.formatter.filter((f) => f.enabled))
|
|
13
|
+
|
|
14
|
+
const plugins = createMemo(() => {
|
|
15
|
+
const list = sync.data.config.plugin ?? []
|
|
16
|
+
const result = list.map((value) => {
|
|
17
|
+
if (value.startsWith("file://")) {
|
|
18
|
+
const path = value.substring("file://".length)
|
|
19
|
+
const parts = path.split("/")
|
|
20
|
+
const filename = parts.pop() || path
|
|
21
|
+
if (!filename.includes(".")) return { name: filename }
|
|
22
|
+
const basename = filename.split(".")[0]
|
|
23
|
+
if (basename === "index") {
|
|
24
|
+
const dirname = parts.pop()
|
|
25
|
+
const name = dirname || basename
|
|
26
|
+
return { name }
|
|
27
|
+
}
|
|
28
|
+
return { name: basename }
|
|
29
|
+
}
|
|
30
|
+
const index = value.lastIndexOf("@")
|
|
31
|
+
if (index <= 0) return { name: value, version: "latest" }
|
|
32
|
+
const name = value.substring(0, index)
|
|
33
|
+
const version = value.substring(index + 1)
|
|
34
|
+
return { name, version }
|
|
35
|
+
})
|
|
36
|
+
return result.toSorted((a, b) => a.name.localeCompare(b.name))
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<box paddingLeft={2} paddingRight={2} gap={1} paddingBottom={1}>
|
|
41
|
+
<box flexDirection="row" justifyContent="space-between">
|
|
42
|
+
<text fg={theme.text} attributes={TextAttributes.BOLD}>
|
|
43
|
+
Status
|
|
44
|
+
</text>
|
|
45
|
+
<text fg={theme.textMuted}>esc</text>
|
|
46
|
+
</box>
|
|
47
|
+
<Show when={Object.keys(sync.data.mcp).length > 0} fallback={<text fg={theme.text}>No MCP Servers</text>}>
|
|
48
|
+
<box>
|
|
49
|
+
<text fg={theme.text}>{Object.keys(sync.data.mcp).length} MCP Servers</text>
|
|
50
|
+
<For each={Object.entries(sync.data.mcp)}>
|
|
51
|
+
{([key, item]) => (
|
|
52
|
+
<box flexDirection="row" gap={1}>
|
|
53
|
+
<text
|
|
54
|
+
flexShrink={0}
|
|
55
|
+
style={{
|
|
56
|
+
fg: (
|
|
57
|
+
{
|
|
58
|
+
connected: theme.success,
|
|
59
|
+
failed: theme.error,
|
|
60
|
+
disabled: theme.textMuted,
|
|
61
|
+
needs_auth: theme.warning,
|
|
62
|
+
needs_client_registration: theme.error,
|
|
63
|
+
} as Record<string, typeof theme.success>
|
|
64
|
+
)[item.status],
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
•
|
|
68
|
+
</text>
|
|
69
|
+
<text fg={theme.text} wrapMode="word">
|
|
70
|
+
<b>{key}</b>{" "}
|
|
71
|
+
<span style={{ fg: theme.textMuted }}>
|
|
72
|
+
<Switch fallback={item.status}>
|
|
73
|
+
<Match when={item.status === "connected"}>Connected</Match>
|
|
74
|
+
<Match when={item.status === "failed" && item}>{(val) => val().error}</Match>
|
|
75
|
+
<Match when={item.status === "disabled"}>Disabled in configuration</Match>
|
|
76
|
+
<Match when={(item.status as string) === "needs_auth"}>
|
|
77
|
+
Needs authentication (run: bincode mcp auth {key})
|
|
78
|
+
</Match>
|
|
79
|
+
<Match when={(item.status as string) === "needs_client_registration" && item}>
|
|
80
|
+
{(val) => (val() as { error: string }).error}
|
|
81
|
+
</Match>
|
|
82
|
+
</Switch>
|
|
83
|
+
</span>
|
|
84
|
+
</text>
|
|
85
|
+
</box>
|
|
86
|
+
)}
|
|
87
|
+
</For>
|
|
88
|
+
</box>
|
|
89
|
+
</Show>
|
|
90
|
+
{sync.data.lsp.length > 0 && (
|
|
91
|
+
<box>
|
|
92
|
+
<text fg={theme.text}>{sync.data.lsp.length} LSP Servers</text>
|
|
93
|
+
<For each={sync.data.lsp}>
|
|
94
|
+
{(item) => (
|
|
95
|
+
<box flexDirection="row" gap={1}>
|
|
96
|
+
<text
|
|
97
|
+
flexShrink={0}
|
|
98
|
+
style={{
|
|
99
|
+
fg: {
|
|
100
|
+
connected: theme.success,
|
|
101
|
+
error: theme.error,
|
|
102
|
+
}[item.status],
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
•
|
|
106
|
+
</text>
|
|
107
|
+
<text fg={theme.text} wrapMode="word">
|
|
108
|
+
<b>{item.id}</b> <span style={{ fg: theme.textMuted }}>{item.root}</span>
|
|
109
|
+
</text>
|
|
110
|
+
</box>
|
|
111
|
+
)}
|
|
112
|
+
</For>
|
|
113
|
+
</box>
|
|
114
|
+
)}
|
|
115
|
+
<Show when={enabledFormatters().length > 0} fallback={<text fg={theme.text}>No Formatters</text>}>
|
|
116
|
+
<box>
|
|
117
|
+
<text fg={theme.text}>{enabledFormatters().length} Formatters</text>
|
|
118
|
+
<For each={enabledFormatters()}>
|
|
119
|
+
{(item) => (
|
|
120
|
+
<box flexDirection="row" gap={1}>
|
|
121
|
+
<text
|
|
122
|
+
flexShrink={0}
|
|
123
|
+
style={{
|
|
124
|
+
fg: theme.success,
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
•
|
|
128
|
+
</text>
|
|
129
|
+
<text wrapMode="word" fg={theme.text}>
|
|
130
|
+
<b>{item.name}</b>
|
|
131
|
+
</text>
|
|
132
|
+
</box>
|
|
133
|
+
)}
|
|
134
|
+
</For>
|
|
135
|
+
</box>
|
|
136
|
+
</Show>
|
|
137
|
+
<Show when={plugins().length > 0} fallback={<text fg={theme.text}>No Plugins</text>}>
|
|
138
|
+
<box>
|
|
139
|
+
<text fg={theme.text}>{plugins().length} Plugins</text>
|
|
140
|
+
<For each={plugins()}>
|
|
141
|
+
{(item) => (
|
|
142
|
+
<box flexDirection="row" gap={1}>
|
|
143
|
+
<text
|
|
144
|
+
flexShrink={0}
|
|
145
|
+
style={{
|
|
146
|
+
fg: theme.success,
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
•
|
|
150
|
+
</text>
|
|
151
|
+
<text wrapMode="word" fg={theme.text}>
|
|
152
|
+
<b>{item.name}</b>
|
|
153
|
+
{item.version && <span style={{ fg: theme.textMuted }}> @{item.version}</span>}
|
|
154
|
+
</text>
|
|
155
|
+
</box>
|
|
156
|
+
)}
|
|
157
|
+
</For>
|
|
158
|
+
</box>
|
|
159
|
+
</Show>
|
|
160
|
+
</box>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createMemo, createResource } from "solid-js"
|
|
2
|
+
import { DialogSelect } from "@tui/ui/dialog-select"
|
|
3
|
+
import { useDialog } from "@tui/ui/dialog"
|
|
4
|
+
import { useSDK } from "@tui/context/sdk"
|
|
5
|
+
import { createStore } from "solid-js/store"
|
|
6
|
+
|
|
7
|
+
export function DialogTag(props: { onSelect?: (value: string) => void }) {
|
|
8
|
+
const sdk = useSDK()
|
|
9
|
+
const dialog = useDialog()
|
|
10
|
+
|
|
11
|
+
const [store] = createStore({
|
|
12
|
+
filter: "",
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const [files] = createResource(
|
|
16
|
+
() => [store.filter],
|
|
17
|
+
async () => {
|
|
18
|
+
const result = await sdk.client.find.files({
|
|
19
|
+
query: store.filter,
|
|
20
|
+
})
|
|
21
|
+
if (result.error) return []
|
|
22
|
+
const sliced = (result.data ?? []).slice(0, 5)
|
|
23
|
+
return sliced
|
|
24
|
+
},
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
const options = createMemo(() =>
|
|
28
|
+
(files() ?? []).map((file) => ({
|
|
29
|
+
value: file,
|
|
30
|
+
title: file,
|
|
31
|
+
})),
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<DialogSelect
|
|
36
|
+
title="Autocomplete"
|
|
37
|
+
options={options()}
|
|
38
|
+
onSelect={(option) => {
|
|
39
|
+
props.onSelect?.(option.value)
|
|
40
|
+
dialog.clear()
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { DialogSelect, type DialogSelectRef } from "../ui/dialog-select"
|
|
2
|
+
import { useTheme } from "../context/theme"
|
|
3
|
+
import { useDialog } from "../ui/dialog"
|
|
4
|
+
import { onCleanup, onMount } from "solid-js"
|
|
5
|
+
|
|
6
|
+
export function DialogThemeList() {
|
|
7
|
+
const theme = useTheme()
|
|
8
|
+
const options = Object.keys(theme.all())
|
|
9
|
+
.sort((a, b) => a.localeCompare(b, undefined, { sensitivity: "base" }))
|
|
10
|
+
.map((value) => ({
|
|
11
|
+
title: value,
|
|
12
|
+
value: value,
|
|
13
|
+
}))
|
|
14
|
+
const dialog = useDialog()
|
|
15
|
+
let confirmed = false
|
|
16
|
+
let ref: DialogSelectRef<string>
|
|
17
|
+
const initial = theme.selected
|
|
18
|
+
|
|
19
|
+
onCleanup(() => {
|
|
20
|
+
if (!confirmed) theme.set(initial)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<DialogSelect
|
|
25
|
+
title="Themes"
|
|
26
|
+
options={options}
|
|
27
|
+
current={initial}
|
|
28
|
+
onMove={(opt) => {
|
|
29
|
+
theme.set(opt.value)
|
|
30
|
+
}}
|
|
31
|
+
onSelect={(opt) => {
|
|
32
|
+
theme.set(opt.value)
|
|
33
|
+
confirmed = true
|
|
34
|
+
dialog.clear()
|
|
35
|
+
}}
|
|
36
|
+
ref={(r) => {
|
|
37
|
+
ref = r
|
|
38
|
+
}}
|
|
39
|
+
onFilter={(query) => {
|
|
40
|
+
if (query.length === 0) {
|
|
41
|
+
theme.set(initial)
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const first = ref.filtered[0]
|
|
46
|
+
if (first) theme.set(first.value)
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TextAttributes } from "@opentui/core"
|
|
2
|
+
import { For } from "solid-js"
|
|
3
|
+
import { useTheme } from "@tui/context/theme"
|
|
4
|
+
|
|
5
|
+
const LOGO_LEFT = [
|
|
6
|
+
` `,
|
|
7
|
+
`█▀▀▄ █ █▄░░█`,
|
|
8
|
+
`█▀▀▄ █ █░▀▄█`,
|
|
9
|
+
`▀▀▀ ▀ ▀░░▀▀`
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
const LOGO_RIGHT = [` ▄ `, `█▀▀▀ █▀▀█ █▀▀█ █▀▀█`, `█░░░ █░░█ █░░█ █▀▀▀`, `▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀`]
|
|
13
|
+
|
|
14
|
+
export function Logo() {
|
|
15
|
+
const { theme } = useTheme()
|
|
16
|
+
return (
|
|
17
|
+
<box>
|
|
18
|
+
<For each={LOGO_LEFT}>
|
|
19
|
+
{(line, index) => (
|
|
20
|
+
<box flexDirection="row" gap={1}>
|
|
21
|
+
<text fg={theme.textMuted} selectable={false}>
|
|
22
|
+
{line}
|
|
23
|
+
</text>
|
|
24
|
+
<text fg={theme.text} attributes={TextAttributes.BOLD} selectable={false}>
|
|
25
|
+
{LOGO_RIGHT[index()]}
|
|
26
|
+
</text>
|
|
27
|
+
</box>
|
|
28
|
+
)}
|
|
29
|
+
</For>
|
|
30
|
+
</box>
|
|
31
|
+
)
|
|
32
|
+
}
|