chad-code 1.3.1 → 1.3.2
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/README.md +55 -6
- package/package.json +36 -98
- package/AGENTS.md +0 -27
- package/Dockerfile +0 -18
- package/README.npm.md +0 -64
- package/bunfig.toml +0 -7
- package/eslint.config.js +0 -29
- package/parsers-config.ts +0 -253
- package/script/build.ts +0 -167
- package/script/publish-registries.ts +0 -187
- package/script/publish.ts +0 -93
- package/script/schema.ts +0 -47
- package/src/acp/README.md +0 -164
- package/src/acp/agent.ts +0 -1086
- package/src/acp/session.ts +0 -101
- package/src/acp/types.ts +0 -22
- package/src/agent/agent.ts +0 -253
- package/src/agent/generate.txt +0 -75
- package/src/agent/prompt/compaction.txt +0 -12
- package/src/agent/prompt/explore.txt +0 -18
- package/src/agent/prompt/summary.txt +0 -11
- package/src/agent/prompt/title.txt +0 -36
- package/src/auth/index.ts +0 -70
- package/src/bun/index.ts +0 -130
- package/src/bus/bus-event.ts +0 -43
- package/src/bus/global.ts +0 -10
- package/src/bus/index.ts +0 -105
- package/src/cli/bootstrap.ts +0 -17
- package/src/cli/cmd/acp.ts +0 -69
- package/src/cli/cmd/agent.ts +0 -257
- package/src/cli/cmd/auth.ts +0 -132
- package/src/cli/cmd/cmd.ts +0 -7
- package/src/cli/cmd/debug/agent.ts +0 -28
- package/src/cli/cmd/debug/config.ts +0 -15
- package/src/cli/cmd/debug/file.ts +0 -91
- package/src/cli/cmd/debug/index.ts +0 -45
- package/src/cli/cmd/debug/lsp.ts +0 -48
- package/src/cli/cmd/debug/ripgrep.ts +0 -83
- package/src/cli/cmd/debug/scrap.ts +0 -15
- package/src/cli/cmd/debug/skill.ts +0 -15
- package/src/cli/cmd/debug/snapshot.ts +0 -48
- package/src/cli/cmd/export.ts +0 -88
- package/src/cli/cmd/generate.ts +0 -38
- package/src/cli/cmd/github.ts +0 -32
- package/src/cli/cmd/import.ts +0 -98
- package/src/cli/cmd/mcp.ts +0 -670
- package/src/cli/cmd/models.ts +0 -42
- package/src/cli/cmd/pr.ts +0 -112
- package/src/cli/cmd/run.ts +0 -374
- package/src/cli/cmd/serve.ts +0 -16
- package/src/cli/cmd/session.ts +0 -135
- package/src/cli/cmd/stats.ts +0 -402
- package/src/cli/cmd/tui/app.tsx +0 -705
- package/src/cli/cmd/tui/attach.ts +0 -32
- package/src/cli/cmd/tui/component/border.tsx +0 -21
- package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-command.tsx +0 -124
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
- package/src/cli/cmd/tui/component/dialog-model.tsx +0 -232
- package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -228
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -115
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -86
- package/src/cli/cmd/tui/component/dialog-status.tsx +0 -162
- package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
- package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
- package/src/cli/cmd/tui/component/did-you-know.tsx +0 -85
- package/src/cli/cmd/tui/component/logo.tsx +0 -43
- package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -654
- package/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
- package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1078
- package/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
- package/src/cli/cmd/tui/component/textarea-keybindings.ts +0 -73
- package/src/cli/cmd/tui/component/tips.ts +0 -92
- package/src/cli/cmd/tui/component/todo-item.tsx +0 -32
- package/src/cli/cmd/tui/context/args.tsx +0 -14
- package/src/cli/cmd/tui/context/directory.ts +0 -13
- package/src/cli/cmd/tui/context/exit.tsx +0 -23
- package/src/cli/cmd/tui/context/helper.tsx +0 -25
- package/src/cli/cmd/tui/context/keybind.tsx +0 -101
- package/src/cli/cmd/tui/context/kv.tsx +0 -49
- package/src/cli/cmd/tui/context/local.tsx +0 -392
- package/src/cli/cmd/tui/context/prompt.tsx +0 -18
- package/src/cli/cmd/tui/context/route.tsx +0 -46
- package/src/cli/cmd/tui/context/sdk.tsx +0 -75
- package/src/cli/cmd/tui/context/sync.tsx +0 -384
- package/src/cli/cmd/tui/context/theme/aura.json +0 -69
- package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
- package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +0 -233
- package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
- package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
- package/src/cli/cmd/tui/context/theme/chad.json +0 -245
- package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
- package/src/cli/cmd/tui/context/theme/cursor.json +0 -249
- package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
- package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
- package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
- package/src/cli/cmd/tui/context/theme/github.json +0 -233
- package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -95
- package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
- package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -227
- package/src/cli/cmd/tui/context/theme/material.json +0 -235
- package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
- package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
- package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
- package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
- package/src/cli/cmd/tui/context/theme/nord.json +0 -223
- package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
- package/src/cli/cmd/tui/context/theme/orng.json +0 -245
- package/src/cli/cmd/tui/context/theme/osaka-jade.json +0 -93
- package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
- package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
- package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
- package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
- package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
- package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
- package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
- package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
- package/src/cli/cmd/tui/context/theme.tsx +0 -1137
- package/src/cli/cmd/tui/event.ts +0 -46
- package/src/cli/cmd/tui/routes/home.tsx +0 -138
- package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +0 -64
- package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -109
- package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +0 -26
- package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -47
- package/src/cli/cmd/tui/routes/session/footer.tsx +0 -88
- package/src/cli/cmd/tui/routes/session/header.tsx +0 -125
- package/src/cli/cmd/tui/routes/session/index.tsx +0 -1814
- package/src/cli/cmd/tui/routes/session/permission.tsx +0 -416
- package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -318
- package/src/cli/cmd/tui/spawn.ts +0 -48
- package/src/cli/cmd/tui/thread.ts +0 -111
- package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -57
- package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -83
- package/src/cli/cmd/tui/ui/dialog-export-options.tsx +0 -204
- package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -38
- package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -77
- package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -345
- package/src/cli/cmd/tui/ui/dialog.tsx +0 -171
- package/src/cli/cmd/tui/ui/link.tsx +0 -28
- package/src/cli/cmd/tui/ui/spinner.ts +0 -368
- package/src/cli/cmd/tui/ui/toast.tsx +0 -100
- package/src/cli/cmd/tui/util/clipboard.ts +0 -127
- package/src/cli/cmd/tui/util/editor.ts +0 -32
- package/src/cli/cmd/tui/util/signal.ts +0 -7
- package/src/cli/cmd/tui/util/terminal.ts +0 -114
- package/src/cli/cmd/tui/util/transcript.ts +0 -98
- package/src/cli/cmd/tui/worker.ts +0 -68
- package/src/cli/cmd/uninstall.ts +0 -344
- package/src/cli/cmd/upgrade.ts +0 -67
- package/src/cli/cmd/web.ts +0 -73
- package/src/cli/error.ts +0 -56
- package/src/cli/network.ts +0 -53
- package/src/cli/ui.ts +0 -87
- package/src/cli/upgrade.ts +0 -25
- package/src/command/index.ts +0 -131
- package/src/command/template/initialize.txt +0 -10
- package/src/command/template/review.txt +0 -97
- package/src/config/config.ts +0 -1124
- package/src/config/markdown.ts +0 -41
- package/src/env/index.ts +0 -26
- package/src/file/ignore.ts +0 -83
- package/src/file/index.ts +0 -411
- package/src/file/ripgrep.ts +0 -402
- package/src/file/time.ts +0 -64
- package/src/file/watcher.ts +0 -117
- package/src/flag/flag.ts +0 -52
- package/src/format/formatter.ts +0 -359
- package/src/format/index.ts +0 -137
- package/src/global/index.ts +0 -55
- package/src/id/id.ts +0 -73
- package/src/ide/index.ts +0 -77
- package/src/index.ts +0 -159
- package/src/installation/index.ts +0 -198
- package/src/lsp/client.ts +0 -252
- package/src/lsp/index.ts +0 -485
- package/src/lsp/language.ts +0 -119
- package/src/lsp/server.ts +0 -2023
- package/src/mcp/auth.ts +0 -135
- package/src/mcp/index.ts +0 -874
- package/src/mcp/oauth-callback.ts +0 -200
- package/src/mcp/oauth-provider.ts +0 -154
- package/src/patch/index.ts +0 -622
- package/src/permission/arity.ts +0 -163
- package/src/permission/index.ts +0 -210
- package/src/permission/next.ts +0 -268
- package/src/plugin/index.ts +0 -106
- package/src/project/bootstrap.ts +0 -31
- package/src/project/instance.ts +0 -78
- package/src/project/project.ts +0 -263
- package/src/project/state.ts +0 -65
- package/src/project/vcs.ts +0 -76
- package/src/provider/auth.ts +0 -143
- package/src/provider/models-macro.ts +0 -4
- package/src/provider/models.ts +0 -77
- package/src/provider/provider.ts +0 -516
- package/src/provider/transform.ts +0 -114
- package/src/pty/index.ts +0 -212
- package/src/server/error.ts +0 -36
- package/src/server/mdns.ts +0 -57
- package/src/server/project.ts +0 -79
- package/src/server/server.ts +0 -2866
- package/src/server/tui.ts +0 -71
- package/src/session/compaction.ts +0 -225
- package/src/session/index.ts +0 -469
- package/src/session/llm.ts +0 -213
- package/src/session/message-v2.ts +0 -742
- package/src/session/message.ts +0 -189
- package/src/session/processor.ts +0 -402
- package/src/session/prompt/anthropic-20250930.txt +0 -166
- package/src/session/prompt/anthropic.txt +0 -105
- package/src/session/prompt/anthropic_spoof.txt +0 -1
- package/src/session/prompt/beast.txt +0 -147
- package/src/session/prompt/build-switch.txt +0 -5
- package/src/session/prompt/codex.txt +0 -318
- package/src/session/prompt/copilot-gpt-5.txt +0 -143
- package/src/session/prompt/gemini.txt +0 -155
- package/src/session/prompt/max-steps.txt +0 -16
- package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
- package/src/session/prompt/plan.txt +0 -26
- package/src/session/prompt/qwen.txt +0 -109
- package/src/session/prompt.ts +0 -1621
- package/src/session/retry.ts +0 -90
- package/src/session/revert.ts +0 -108
- package/src/session/status.ts +0 -76
- package/src/session/summary.ts +0 -194
- package/src/session/system.ts +0 -108
- package/src/session/todo.ts +0 -37
- package/src/share/share-next.ts +0 -194
- package/src/share/share.ts +0 -23
- package/src/shell/shell.ts +0 -67
- package/src/skill/index.ts +0 -1
- package/src/skill/skill.ts +0 -124
- package/src/snapshot/index.ts +0 -197
- package/src/storage/storage.ts +0 -226
- package/src/tool/bash.ts +0 -262
- package/src/tool/bash.txt +0 -116
- package/src/tool/batch.ts +0 -175
- package/src/tool/batch.txt +0 -24
- package/src/tool/codesearch.ts +0 -132
- package/src/tool/codesearch.txt +0 -12
- package/src/tool/edit.ts +0 -655
- package/src/tool/edit.txt +0 -10
- package/src/tool/glob.ts +0 -75
- package/src/tool/glob.txt +0 -6
- package/src/tool/grep.ts +0 -132
- package/src/tool/grep.txt +0 -8
- package/src/tool/invalid.ts +0 -17
- package/src/tool/ls.ts +0 -119
- package/src/tool/ls.txt +0 -1
- package/src/tool/lsp.ts +0 -94
- package/src/tool/lsp.txt +0 -19
- package/src/tool/multiedit.ts +0 -46
- package/src/tool/multiedit.txt +0 -41
- package/src/tool/patch.ts +0 -210
- package/src/tool/patch.txt +0 -1
- package/src/tool/read.ts +0 -191
- package/src/tool/read.txt +0 -12
- package/src/tool/registry.ts +0 -137
- package/src/tool/skill.ts +0 -77
- package/src/tool/task.ts +0 -167
- package/src/tool/task.txt +0 -60
- package/src/tool/todo.ts +0 -53
- package/src/tool/todoread.txt +0 -14
- package/src/tool/todowrite.txt +0 -167
- package/src/tool/tool.ts +0 -73
- package/src/tool/webfetch.ts +0 -182
- package/src/tool/webfetch.txt +0 -13
- package/src/tool/websearch.ts +0 -144
- package/src/tool/websearch.txt +0 -11
- package/src/tool/write.ts +0 -84
- package/src/tool/write.txt +0 -8
- package/src/util/archive.ts +0 -16
- package/src/util/color.ts +0 -19
- package/src/util/context.ts +0 -25
- package/src/util/defer.ts +0 -12
- package/src/util/eventloop.ts +0 -20
- package/src/util/filesystem.ts +0 -83
- package/src/util/fn.ts +0 -11
- package/src/util/iife.ts +0 -3
- package/src/util/keybind.ts +0 -102
- package/src/util/lazy.ts +0 -18
- package/src/util/locale.ts +0 -81
- package/src/util/lock.ts +0 -98
- package/src/util/log.ts +0 -180
- package/src/util/queue.ts +0 -32
- package/src/util/rpc.ts +0 -42
- package/src/util/scrap.ts +0 -10
- package/src/util/signal.ts +0 -12
- package/src/util/timeout.ts +0 -14
- package/src/util/token.ts +0 -7
- package/src/util/wildcard.ts +0 -54
- package/src/worktree/index.ts +0 -217
- package/sst-env.d.ts +0 -9
- package/test/agent/agent.test.ts +0 -448
- package/test/bun.test.ts +0 -53
- package/test/cli/github-action.test.ts +0 -129
- package/test/cli/github-remote.test.ts +0 -80
- package/test/cli/tui/transcript.test.ts +0 -297
- package/test/config/agent-color.test.ts +0 -66
- package/test/config/config.test.ts +0 -870
- package/test/config/markdown.test.ts +0 -89
- package/test/file/ignore.test.ts +0 -10
- package/test/file/path-traversal.test.ts +0 -115
- package/test/fixture/fixture.ts +0 -45
- package/test/fixture/lsp/fake-lsp-server.js +0 -77
- package/test/ide/ide.test.ts +0 -82
- package/test/keybind.test.ts +0 -421
- package/test/lsp/client.test.ts +0 -95
- package/test/mcp/headers.test.ts +0 -153
- package/test/patch/patch.test.ts +0 -348
- package/test/permission/arity.test.ts +0 -33
- package/test/permission/next.test.ts +0 -652
- package/test/preload.ts +0 -63
- package/test/project/project.test.ts +0 -120
- package/test/provider/amazon-bedrock.test.ts +0 -236
- package/test/provider/provider.test.ts +0 -2127
- package/test/provider/transform.test.ts +0 -980
- package/test/server/session-select.test.ts +0 -78
- package/test/session/compaction.test.ts +0 -251
- package/test/session/message-v2.test.ts +0 -570
- package/test/session/retry.test.ts +0 -131
- package/test/session/revert-compact.test.ts +0 -285
- package/test/session/session.test.ts +0 -71
- package/test/skill/skill.test.ts +0 -185
- package/test/snapshot/snapshot.test.ts +0 -939
- package/test/tool/__snapshots__/tool.test.ts.snap +0 -9
- package/test/tool/bash.test.ts +0 -232
- package/test/tool/grep.test.ts +0 -109
- package/test/tool/patch.test.ts +0 -261
- package/test/tool/read.test.ts +0 -167
- package/test/util/iife.test.ts +0 -36
- package/test/util/lazy.test.ts +0 -50
- package/test/util/timeout.test.ts +0 -21
- package/test/util/wildcard.test.ts +0 -55
- package/tsconfig.json +0 -16
- /package/{script/postinstall.mjs → postinstall.mjs} +0 -0
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Message,
|
|
3
|
-
Agent,
|
|
4
|
-
Provider,
|
|
5
|
-
Session,
|
|
6
|
-
Part,
|
|
7
|
-
Config,
|
|
8
|
-
Todo,
|
|
9
|
-
Command,
|
|
10
|
-
PermissionRequest,
|
|
11
|
-
LspStatus,
|
|
12
|
-
McpStatus,
|
|
13
|
-
McpResource,
|
|
14
|
-
FormatterStatus,
|
|
15
|
-
SessionStatus,
|
|
16
|
-
ProviderListResponse,
|
|
17
|
-
ProviderAuthMethod,
|
|
18
|
-
VcsInfo,
|
|
19
|
-
} from "@opencode-ai/sdk/v2"
|
|
20
|
-
import { createStore, produce, reconcile } from "solid-js/store"
|
|
21
|
-
import { useSDK } from "@tui/context/sdk"
|
|
22
|
-
import { Binary } from "@opencode-ai/util/binary"
|
|
23
|
-
import { createSimpleContext } from "./helper"
|
|
24
|
-
import type { Snapshot } from "@/snapshot"
|
|
25
|
-
import { useExit } from "./exit"
|
|
26
|
-
import { useArgs } from "./args"
|
|
27
|
-
import { batch, onMount } from "solid-js"
|
|
28
|
-
import { Log } from "@/util/log"
|
|
29
|
-
import type { Path } from "@opencode-ai/sdk"
|
|
30
|
-
|
|
31
|
-
export const { use: useSync, provider: SyncProvider } = createSimpleContext({
|
|
32
|
-
name: "Sync",
|
|
33
|
-
init: () => {
|
|
34
|
-
const [store, setStore] = createStore<{
|
|
35
|
-
status: "loading" | "partial" | "complete"
|
|
36
|
-
provider: Provider[]
|
|
37
|
-
provider_default: Record<string, string>
|
|
38
|
-
provider_next: ProviderListResponse
|
|
39
|
-
provider_auth: Record<string, ProviderAuthMethod[]>
|
|
40
|
-
agent: Agent[]
|
|
41
|
-
command: Command[]
|
|
42
|
-
permission: {
|
|
43
|
-
[sessionID: string]: PermissionRequest[]
|
|
44
|
-
}
|
|
45
|
-
config: Config
|
|
46
|
-
session: Session[]
|
|
47
|
-
session_status: {
|
|
48
|
-
[sessionID: string]: SessionStatus
|
|
49
|
-
}
|
|
50
|
-
session_diff: {
|
|
51
|
-
[sessionID: string]: Snapshot.FileDiff[]
|
|
52
|
-
}
|
|
53
|
-
todo: {
|
|
54
|
-
[sessionID: string]: Todo[]
|
|
55
|
-
}
|
|
56
|
-
message: {
|
|
57
|
-
[sessionID: string]: Message[]
|
|
58
|
-
}
|
|
59
|
-
part: {
|
|
60
|
-
[messageID: string]: Part[]
|
|
61
|
-
}
|
|
62
|
-
lsp: LspStatus[]
|
|
63
|
-
mcp: {
|
|
64
|
-
[key: string]: McpStatus
|
|
65
|
-
}
|
|
66
|
-
mcp_resource: {
|
|
67
|
-
[key: string]: McpResource
|
|
68
|
-
}
|
|
69
|
-
formatter: FormatterStatus[]
|
|
70
|
-
vcs: VcsInfo | undefined
|
|
71
|
-
path: Path
|
|
72
|
-
}>({
|
|
73
|
-
provider_next: {
|
|
74
|
-
all: [],
|
|
75
|
-
default: {},
|
|
76
|
-
connected: [],
|
|
77
|
-
},
|
|
78
|
-
provider_auth: {},
|
|
79
|
-
config: {},
|
|
80
|
-
status: "loading",
|
|
81
|
-
agent: [],
|
|
82
|
-
permission: {},
|
|
83
|
-
command: [],
|
|
84
|
-
provider: [],
|
|
85
|
-
provider_default: {},
|
|
86
|
-
session: [],
|
|
87
|
-
session_status: {},
|
|
88
|
-
session_diff: {},
|
|
89
|
-
todo: {},
|
|
90
|
-
message: {},
|
|
91
|
-
part: {},
|
|
92
|
-
lsp: [],
|
|
93
|
-
mcp: {},
|
|
94
|
-
mcp_resource: {},
|
|
95
|
-
formatter: [],
|
|
96
|
-
vcs: undefined,
|
|
97
|
-
path: { state: "", config: "", worktree: "", directory: "" },
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
const sdk = useSDK()
|
|
101
|
-
|
|
102
|
-
sdk.event.listen((e) => {
|
|
103
|
-
const event = e.details
|
|
104
|
-
switch (event.type) {
|
|
105
|
-
case "server.instance.disposed":
|
|
106
|
-
bootstrap()
|
|
107
|
-
break
|
|
108
|
-
case "permission.replied": {
|
|
109
|
-
const requests = store.permission[event.properties.sessionID]
|
|
110
|
-
if (!requests) break
|
|
111
|
-
const match = Binary.search(requests, event.properties.requestID, (r) => r.id)
|
|
112
|
-
if (!match.found) break
|
|
113
|
-
setStore(
|
|
114
|
-
"permission",
|
|
115
|
-
event.properties.sessionID,
|
|
116
|
-
produce((draft) => {
|
|
117
|
-
draft.splice(match.index, 1)
|
|
118
|
-
}),
|
|
119
|
-
)
|
|
120
|
-
break
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
case "permission.asked": {
|
|
124
|
-
const request = event.properties
|
|
125
|
-
const requests = store.permission[request.sessionID]
|
|
126
|
-
if (!requests) {
|
|
127
|
-
setStore("permission", request.sessionID, [request])
|
|
128
|
-
break
|
|
129
|
-
}
|
|
130
|
-
const match = Binary.search(requests, request.id, (r) => r.id)
|
|
131
|
-
if (match.found) {
|
|
132
|
-
setStore("permission", request.sessionID, match.index, reconcile(request))
|
|
133
|
-
break
|
|
134
|
-
}
|
|
135
|
-
setStore(
|
|
136
|
-
"permission",
|
|
137
|
-
request.sessionID,
|
|
138
|
-
produce((draft) => {
|
|
139
|
-
draft.splice(match.index, 0, request)
|
|
140
|
-
}),
|
|
141
|
-
)
|
|
142
|
-
break
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
case "todo.updated":
|
|
146
|
-
setStore("todo", event.properties.sessionID, event.properties.todos)
|
|
147
|
-
break
|
|
148
|
-
|
|
149
|
-
case "session.diff":
|
|
150
|
-
setStore("session_diff", event.properties.sessionID, event.properties.diff)
|
|
151
|
-
break
|
|
152
|
-
|
|
153
|
-
case "session.deleted": {
|
|
154
|
-
const result = Binary.search(store.session, event.properties.info.id, (s) => s.id)
|
|
155
|
-
if (result.found) {
|
|
156
|
-
setStore(
|
|
157
|
-
"session",
|
|
158
|
-
produce((draft) => {
|
|
159
|
-
draft.splice(result.index, 1)
|
|
160
|
-
}),
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
break
|
|
164
|
-
}
|
|
165
|
-
case "session.updated": {
|
|
166
|
-
const result = Binary.search(store.session, event.properties.info.id, (s) => s.id)
|
|
167
|
-
if (result.found) {
|
|
168
|
-
setStore("session", result.index, reconcile(event.properties.info))
|
|
169
|
-
break
|
|
170
|
-
}
|
|
171
|
-
setStore(
|
|
172
|
-
"session",
|
|
173
|
-
produce((draft) => {
|
|
174
|
-
draft.splice(result.index, 0, event.properties.info)
|
|
175
|
-
}),
|
|
176
|
-
)
|
|
177
|
-
break
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
case "session.status": {
|
|
181
|
-
setStore("session_status", event.properties.sessionID, event.properties.status)
|
|
182
|
-
break
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
case "message.updated": {
|
|
186
|
-
const messages = store.message[event.properties.info.sessionID]
|
|
187
|
-
if (!messages) {
|
|
188
|
-
setStore("message", event.properties.info.sessionID, [event.properties.info])
|
|
189
|
-
break
|
|
190
|
-
}
|
|
191
|
-
const result = Binary.search(messages, event.properties.info.id, (m) => m.id)
|
|
192
|
-
if (result.found) {
|
|
193
|
-
setStore("message", event.properties.info.sessionID, result.index, reconcile(event.properties.info))
|
|
194
|
-
break
|
|
195
|
-
}
|
|
196
|
-
setStore(
|
|
197
|
-
"message",
|
|
198
|
-
event.properties.info.sessionID,
|
|
199
|
-
produce((draft) => {
|
|
200
|
-
draft.splice(result.index, 0, event.properties.info)
|
|
201
|
-
if (draft.length > 100) draft.shift()
|
|
202
|
-
}),
|
|
203
|
-
)
|
|
204
|
-
break
|
|
205
|
-
}
|
|
206
|
-
case "message.removed": {
|
|
207
|
-
const messages = store.message[event.properties.sessionID]
|
|
208
|
-
const result = Binary.search(messages, event.properties.messageID, (m) => m.id)
|
|
209
|
-
if (result.found) {
|
|
210
|
-
setStore(
|
|
211
|
-
"message",
|
|
212
|
-
event.properties.sessionID,
|
|
213
|
-
produce((draft) => {
|
|
214
|
-
draft.splice(result.index, 1)
|
|
215
|
-
}),
|
|
216
|
-
)
|
|
217
|
-
}
|
|
218
|
-
break
|
|
219
|
-
}
|
|
220
|
-
case "message.part.updated": {
|
|
221
|
-
const parts = store.part[event.properties.part.messageID]
|
|
222
|
-
if (!parts) {
|
|
223
|
-
setStore("part", event.properties.part.messageID, [event.properties.part])
|
|
224
|
-
break
|
|
225
|
-
}
|
|
226
|
-
const result = Binary.search(parts, event.properties.part.id, (p) => p.id)
|
|
227
|
-
if (result.found) {
|
|
228
|
-
setStore("part", event.properties.part.messageID, result.index, reconcile(event.properties.part))
|
|
229
|
-
break
|
|
230
|
-
}
|
|
231
|
-
setStore(
|
|
232
|
-
"part",
|
|
233
|
-
event.properties.part.messageID,
|
|
234
|
-
produce((draft) => {
|
|
235
|
-
draft.splice(result.index, 0, event.properties.part)
|
|
236
|
-
}),
|
|
237
|
-
)
|
|
238
|
-
break
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
case "message.part.removed": {
|
|
242
|
-
const parts = store.part[event.properties.messageID]
|
|
243
|
-
const result = Binary.search(parts, event.properties.partID, (p) => p.id)
|
|
244
|
-
if (result.found)
|
|
245
|
-
setStore(
|
|
246
|
-
"part",
|
|
247
|
-
event.properties.messageID,
|
|
248
|
-
produce((draft) => {
|
|
249
|
-
draft.splice(result.index, 1)
|
|
250
|
-
}),
|
|
251
|
-
)
|
|
252
|
-
break
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
case "lsp.updated": {
|
|
256
|
-
sdk.client.lsp.status().then((x) => setStore("lsp", x.data!))
|
|
257
|
-
break
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
case "vcs.branch.updated": {
|
|
261
|
-
setStore("vcs", { branch: event.properties.branch })
|
|
262
|
-
break
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
})
|
|
266
|
-
|
|
267
|
-
const exit = useExit()
|
|
268
|
-
const args = useArgs()
|
|
269
|
-
|
|
270
|
-
async function bootstrap() {
|
|
271
|
-
console.log("bootstrapping")
|
|
272
|
-
const start = Date.now() - 30 * 24 * 60 * 60 * 1000
|
|
273
|
-
const sessionListPromise = sdk.client.session
|
|
274
|
-
.list({ start: start })
|
|
275
|
-
.then((x) => setStore("session", reconcile((x.data ?? []).toSorted((a, b) => a.id.localeCompare(b.id)))))
|
|
276
|
-
|
|
277
|
-
// blocking - include session.list when continuing a session
|
|
278
|
-
const blockingRequests: Promise<unknown>[] = [
|
|
279
|
-
sdk.client.config.providers({}, { throwOnError: true }).then((x) => {
|
|
280
|
-
batch(() => {
|
|
281
|
-
setStore("provider", reconcile(x.data!.providers))
|
|
282
|
-
setStore("provider_default", reconcile(x.data!.default))
|
|
283
|
-
})
|
|
284
|
-
}),
|
|
285
|
-
sdk.client.provider.list({}, { throwOnError: true }).then((x) => {
|
|
286
|
-
batch(() => {
|
|
287
|
-
setStore("provider_next", reconcile(x.data!))
|
|
288
|
-
})
|
|
289
|
-
}),
|
|
290
|
-
sdk.client.app.agents({}, { throwOnError: true }).then((x) => setStore("agent", reconcile(x.data ?? []))),
|
|
291
|
-
sdk.client.config.get({}, { throwOnError: true }).then((x) => setStore("config", reconcile(x.data!))),
|
|
292
|
-
...(args.continue ? [sessionListPromise] : []),
|
|
293
|
-
]
|
|
294
|
-
|
|
295
|
-
await Promise.all(blockingRequests)
|
|
296
|
-
.then(() => {
|
|
297
|
-
if (store.status !== "complete") setStore("status", "partial")
|
|
298
|
-
// non-blocking
|
|
299
|
-
Promise.all([
|
|
300
|
-
...(args.continue ? [] : [sessionListPromise]),
|
|
301
|
-
sdk.client.command.list().then((x) => setStore("command", reconcile(x.data ?? []))),
|
|
302
|
-
sdk.client.lsp.status().then((x) => setStore("lsp", reconcile(x.data!))),
|
|
303
|
-
sdk.client.mcp.status().then((x) => setStore("mcp", reconcile(x.data!))),
|
|
304
|
-
sdk.client.experimental.resource.list().then((x) => setStore("mcp_resource", reconcile(x.data ?? {}))),
|
|
305
|
-
sdk.client.formatter.status().then((x) => setStore("formatter", reconcile(x.data!))),
|
|
306
|
-
sdk.client.session.status().then((x) => {
|
|
307
|
-
setStore("session_status", reconcile(x.data!))
|
|
308
|
-
}),
|
|
309
|
-
sdk.client.provider.auth().then((x) => setStore("provider_auth", reconcile(x.data ?? {}))),
|
|
310
|
-
sdk.client.vcs.get().then((x) => setStore("vcs", reconcile(x.data))),
|
|
311
|
-
sdk.client.path.get().then((x) => setStore("path", reconcile(x.data!))),
|
|
312
|
-
]).then(() => {
|
|
313
|
-
setStore("status", "complete")
|
|
314
|
-
})
|
|
315
|
-
})
|
|
316
|
-
.catch(async (e) => {
|
|
317
|
-
Log.Default.error("tui bootstrap failed", {
|
|
318
|
-
error: e instanceof Error ? e.message : String(e),
|
|
319
|
-
name: e instanceof Error ? e.name : undefined,
|
|
320
|
-
stack: e instanceof Error ? e.stack : undefined,
|
|
321
|
-
})
|
|
322
|
-
await exit(e)
|
|
323
|
-
})
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
onMount(() => {
|
|
327
|
-
bootstrap()
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
const fullSyncedSessions = new Set<string>()
|
|
331
|
-
const result = {
|
|
332
|
-
data: store,
|
|
333
|
-
set: setStore,
|
|
334
|
-
get status() {
|
|
335
|
-
return store.status
|
|
336
|
-
},
|
|
337
|
-
get ready() {
|
|
338
|
-
return store.status !== "loading"
|
|
339
|
-
},
|
|
340
|
-
session: {
|
|
341
|
-
get(sessionID: string) {
|
|
342
|
-
const match = Binary.search(store.session, sessionID, (s) => s.id)
|
|
343
|
-
if (match.found) return store.session[match.index]
|
|
344
|
-
return undefined
|
|
345
|
-
},
|
|
346
|
-
status(sessionID: string) {
|
|
347
|
-
const session = result.session.get(sessionID)
|
|
348
|
-
if (!session) return "idle"
|
|
349
|
-
if (session.time.compacting) return "compacting"
|
|
350
|
-
const messages = store.message[sessionID] ?? []
|
|
351
|
-
const last = messages.at(-1)
|
|
352
|
-
if (!last) return "idle"
|
|
353
|
-
if (last.role === "user") return "working"
|
|
354
|
-
return last.time.completed ? "idle" : "working"
|
|
355
|
-
},
|
|
356
|
-
async sync(sessionID: string) {
|
|
357
|
-
if (fullSyncedSessions.has(sessionID)) return
|
|
358
|
-
const [session, messages, todo, diff] = await Promise.all([
|
|
359
|
-
sdk.client.session.get({ sessionID }, { throwOnError: true }),
|
|
360
|
-
sdk.client.session.messages({ sessionID, limit: 100 }),
|
|
361
|
-
sdk.client.session.todo({ sessionID }),
|
|
362
|
-
sdk.client.session.diff({ sessionID }),
|
|
363
|
-
])
|
|
364
|
-
setStore(
|
|
365
|
-
produce((draft) => {
|
|
366
|
-
const match = Binary.search(draft.session, sessionID, (s) => s.id)
|
|
367
|
-
if (match.found) draft.session[match.index] = session.data!
|
|
368
|
-
if (!match.found) draft.session.splice(match.index, 0, session.data!)
|
|
369
|
-
draft.todo[sessionID] = todo.data ?? []
|
|
370
|
-
draft.message[sessionID] = messages.data!.map((x) => x.info)
|
|
371
|
-
for (const message of messages.data!) {
|
|
372
|
-
draft.part[message.info.id] = message.parts
|
|
373
|
-
}
|
|
374
|
-
draft.session_diff[sessionID] = diff.data ?? []
|
|
375
|
-
}),
|
|
376
|
-
)
|
|
377
|
-
fullSyncedSessions.add(sessionID)
|
|
378
|
-
},
|
|
379
|
-
},
|
|
380
|
-
bootstrap,
|
|
381
|
-
}
|
|
382
|
-
return result
|
|
383
|
-
},
|
|
384
|
-
})
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://opencode.ai/theme.json",
|
|
3
|
-
"defs": {
|
|
4
|
-
"darkBg": "#0f0f0f",
|
|
5
|
-
"darkBgPanel": "#15141b",
|
|
6
|
-
"darkBorder": "#2d2d2d",
|
|
7
|
-
"darkFgMuted": "#6d6d6d",
|
|
8
|
-
"darkFg": "#edecee",
|
|
9
|
-
"purple": "#a277ff",
|
|
10
|
-
"pink": "#f694ff",
|
|
11
|
-
"blue": "#82e2ff",
|
|
12
|
-
"red": "#ff6767",
|
|
13
|
-
"orange": "#ffca85",
|
|
14
|
-
"cyan": "#61ffca",
|
|
15
|
-
"green": "#9dff65"
|
|
16
|
-
},
|
|
17
|
-
"theme": {
|
|
18
|
-
"primary": "purple",
|
|
19
|
-
"secondary": "pink",
|
|
20
|
-
"accent": "purple",
|
|
21
|
-
"error": "red",
|
|
22
|
-
"warning": "orange",
|
|
23
|
-
"success": "cyan",
|
|
24
|
-
"info": "purple",
|
|
25
|
-
"text": "darkFg",
|
|
26
|
-
"textMuted": "darkFgMuted",
|
|
27
|
-
"background": "darkBg",
|
|
28
|
-
"backgroundPanel": "darkBgPanel",
|
|
29
|
-
"backgroundElement": "darkBgPanel",
|
|
30
|
-
"border": "darkBorder",
|
|
31
|
-
"borderActive": "darkFgMuted",
|
|
32
|
-
"borderSubtle": "darkBorder",
|
|
33
|
-
"diffAdded": "cyan",
|
|
34
|
-
"diffRemoved": "red",
|
|
35
|
-
"diffContext": "darkFgMuted",
|
|
36
|
-
"diffHunkHeader": "darkFgMuted",
|
|
37
|
-
"diffHighlightAdded": "cyan",
|
|
38
|
-
"diffHighlightRemoved": "red",
|
|
39
|
-
"diffAddedBg": "#354933",
|
|
40
|
-
"diffRemovedBg": "#3f191a",
|
|
41
|
-
"diffContextBg": "darkBgPanel",
|
|
42
|
-
"diffLineNumber": "darkBorder",
|
|
43
|
-
"diffAddedLineNumberBg": "#162620",
|
|
44
|
-
"diffRemovedLineNumberBg": "#26161a",
|
|
45
|
-
"markdownText": "darkFg",
|
|
46
|
-
"markdownHeading": "purple",
|
|
47
|
-
"markdownLink": "pink",
|
|
48
|
-
"markdownLinkText": "purple",
|
|
49
|
-
"markdownCode": "cyan",
|
|
50
|
-
"markdownBlockQuote": "darkFgMuted",
|
|
51
|
-
"markdownEmph": "orange",
|
|
52
|
-
"markdownStrong": "purple",
|
|
53
|
-
"markdownHorizontalRule": "darkFgMuted",
|
|
54
|
-
"markdownListItem": "purple",
|
|
55
|
-
"markdownListEnumeration": "purple",
|
|
56
|
-
"markdownImage": "pink",
|
|
57
|
-
"markdownImageText": "purple",
|
|
58
|
-
"markdownCodeBlock": "darkFg",
|
|
59
|
-
"syntaxComment": "darkFgMuted",
|
|
60
|
-
"syntaxKeyword": "pink",
|
|
61
|
-
"syntaxFunction": "purple",
|
|
62
|
-
"syntaxVariable": "purple",
|
|
63
|
-
"syntaxString": "cyan",
|
|
64
|
-
"syntaxNumber": "green",
|
|
65
|
-
"syntaxType": "purple",
|
|
66
|
-
"syntaxOperator": "pink",
|
|
67
|
-
"syntaxPunctuation": "darkFg"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://opencode.ai/theme.json",
|
|
3
|
-
"defs": {
|
|
4
|
-
"darkBg": "#0B0E14",
|
|
5
|
-
"darkBgAlt": "#0D1017",
|
|
6
|
-
"darkLine": "#11151C",
|
|
7
|
-
"darkPanel": "#0F131A",
|
|
8
|
-
"darkFg": "#BFBDB6",
|
|
9
|
-
"darkFgMuted": "#565B66",
|
|
10
|
-
"darkGutter": "#6C7380",
|
|
11
|
-
"darkTag": "#39BAE6",
|
|
12
|
-
"darkFunc": "#FFB454",
|
|
13
|
-
"darkEntity": "#59C2FF",
|
|
14
|
-
"darkString": "#AAD94C",
|
|
15
|
-
"darkRegexp": "#95E6CB",
|
|
16
|
-
"darkMarkup": "#F07178",
|
|
17
|
-
"darkKeyword": "#FF8F40",
|
|
18
|
-
"darkSpecial": "#E6B673",
|
|
19
|
-
"darkComment": "#ACB6BF",
|
|
20
|
-
"darkConstant": "#D2A6FF",
|
|
21
|
-
"darkOperator": "#F29668",
|
|
22
|
-
"darkAdded": "#7FD962",
|
|
23
|
-
"darkRemoved": "#F26D78",
|
|
24
|
-
"darkAccent": "#E6B450",
|
|
25
|
-
"darkError": "#D95757",
|
|
26
|
-
"darkIndentActive": "#6C7380"
|
|
27
|
-
},
|
|
28
|
-
"theme": {
|
|
29
|
-
"primary": "darkEntity",
|
|
30
|
-
"secondary": "darkConstant",
|
|
31
|
-
"accent": "darkAccent",
|
|
32
|
-
"error": "darkError",
|
|
33
|
-
"warning": "darkSpecial",
|
|
34
|
-
"success": "darkAdded",
|
|
35
|
-
"info": "darkTag",
|
|
36
|
-
"text": "darkFg",
|
|
37
|
-
"textMuted": "darkFgMuted",
|
|
38
|
-
"background": "darkBg",
|
|
39
|
-
"backgroundPanel": "darkPanel",
|
|
40
|
-
"backgroundElement": "darkBgAlt",
|
|
41
|
-
"border": "darkGutter",
|
|
42
|
-
"borderActive": "darkIndentActive",
|
|
43
|
-
"borderSubtle": "darkLine",
|
|
44
|
-
"diffAdded": "darkAdded",
|
|
45
|
-
"diffRemoved": "darkRemoved",
|
|
46
|
-
"diffContext": "darkComment",
|
|
47
|
-
"diffHunkHeader": "darkComment",
|
|
48
|
-
"diffHighlightAdded": "darkString",
|
|
49
|
-
"diffHighlightRemoved": "darkMarkup",
|
|
50
|
-
"diffAddedBg": "#20303b",
|
|
51
|
-
"diffRemovedBg": "#37222c",
|
|
52
|
-
"diffContextBg": "darkPanel",
|
|
53
|
-
"diffLineNumber": "darkGutter",
|
|
54
|
-
"diffAddedLineNumberBg": "#1b2b34",
|
|
55
|
-
"diffRemovedLineNumberBg": "#2d1f26",
|
|
56
|
-
"markdownText": "darkFg",
|
|
57
|
-
"markdownHeading": "darkConstant",
|
|
58
|
-
"markdownLink": "darkEntity",
|
|
59
|
-
"markdownLinkText": "darkTag",
|
|
60
|
-
"markdownCode": "darkString",
|
|
61
|
-
"markdownBlockQuote": "darkSpecial",
|
|
62
|
-
"markdownEmph": "darkSpecial",
|
|
63
|
-
"markdownStrong": "darkFunc",
|
|
64
|
-
"markdownHorizontalRule": "darkFgMuted",
|
|
65
|
-
"markdownListItem": "darkEntity",
|
|
66
|
-
"markdownListEnumeration": "darkTag",
|
|
67
|
-
"markdownImage": "darkEntity",
|
|
68
|
-
"markdownImageText": "darkTag",
|
|
69
|
-
"markdownCodeBlock": "darkFg",
|
|
70
|
-
"syntaxComment": "darkComment",
|
|
71
|
-
"syntaxKeyword": "darkKeyword",
|
|
72
|
-
"syntaxFunction": "darkFunc",
|
|
73
|
-
"syntaxVariable": "darkEntity",
|
|
74
|
-
"syntaxString": "darkString",
|
|
75
|
-
"syntaxNumber": "darkConstant",
|
|
76
|
-
"syntaxType": "darkSpecial",
|
|
77
|
-
"syntaxOperator": "darkOperator",
|
|
78
|
-
"syntaxPunctuation": "darkFg"
|
|
79
|
-
}
|
|
80
|
-
}
|