jonsoc 1.1.48 → 1.1.50
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/bin/jonsoc +17 -9
- package/package.json +8 -142
- package/postinstall.mjs +15 -0
- package/AGENTS.md +0 -27
- package/Dockerfile +0 -18
- package/PUBLISHING_GUIDE.md +0 -151
- package/README.md +0 -58
- package/bunfig.toml +0 -7
- package/package.json.placeholder +0 -11
- package/parsers-config.ts +0 -253
- package/script/build.ts +0 -115
- package/script/publish-registries.ts +0 -197
- package/script/publish.ts +0 -110
- package/script/schema.ts +0 -47
- package/script/seed-e2e.ts +0 -50
- package/src/acp/README.md +0 -164
- package/src/acp/agent.ts +0 -1437
- package/src/acp/session.ts +0 -105
- package/src/acp/types.ts +0 -22
- package/src/agent/agent.ts +0 -347
- 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 -44
- package/src/auth/index.ts +0 -73
- package/src/brand/index.ts +0 -89
- package/src/bun/index.ts +0 -139
- 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 -405
- package/src/cli/cmd/cmd.ts +0 -7
- package/src/cli/cmd/debug/agent.ts +0 -166
- package/src/cli/cmd/debug/config.ts +0 -16
- package/src/cli/cmd/debug/file.ts +0 -97
- package/src/cli/cmd/debug/index.ts +0 -48
- package/src/cli/cmd/debug/lsp.ts +0 -52
- package/src/cli/cmd/debug/ripgrep.ts +0 -87
- package/src/cli/cmd/debug/scrap.ts +0 -16
- package/src/cli/cmd/debug/skill.ts +0 -16
- package/src/cli/cmd/debug/snapshot.ts +0 -52
- package/src/cli/cmd/export.ts +0 -88
- package/src/cli/cmd/generate.ts +0 -38
- package/src/cli/cmd/github.ts +0 -1548
- package/src/cli/cmd/import.ts +0 -99
- package/src/cli/cmd/mcp.ts +0 -765
- package/src/cli/cmd/models.ts +0 -77
- package/src/cli/cmd/pr.ts +0 -112
- package/src/cli/cmd/run.ts +0 -395
- package/src/cli/cmd/serve.ts +0 -20
- package/src/cli/cmd/session.ts +0 -135
- package/src/cli/cmd/stats.ts +0 -402
- package/src/cli/cmd/tui/app.tsx +0 -923
- package/src/cli/cmd/tui/attach.ts +0 -39
- 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 -162
- package/src/cli/cmd/tui/component/dialog-error-log.tsx +0 -155
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
- package/src/cli/cmd/tui/component/dialog-model.tsx +0 -234
- package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -256
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -114
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -87
- package/src/cli/cmd/tui/component/dialog-status.tsx +0 -164
- 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/dynamic-layout.tsx +0 -86
- package/src/cli/cmd/tui/component/inspector-overlay.tsx +0 -247
- package/src/cli/cmd/tui/component/logo.tsx +0 -88
- package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -653
- package/src/cli/cmd/tui/component/prompt/frecency.tsx +0 -89
- package/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
- package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1347
- 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.tsx +0 -153
- 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/error-log.tsx +0 -56
- package/src/cli/cmd/tui/context/exit.tsx +0 -26
- package/src/cli/cmd/tui/context/helper.tsx +0 -25
- package/src/cli/cmd/tui/context/inspector.tsx +0 -57
- package/src/cli/cmd/tui/context/keybind.tsx +0 -108
- package/src/cli/cmd/tui/context/kv.tsx +0 -53
- package/src/cli/cmd/tui/context/layout.tsx +0 -240
- package/src/cli/cmd/tui/context/local.tsx +0 -402
- package/src/cli/cmd/tui/context/prompt.tsx +0 -18
- package/src/cli/cmd/tui/context/route.tsx +0 -51
- package/src/cli/cmd/tui/context/sdk.tsx +0 -94
- package/src/cli/cmd/tui/context/sync.tsx +0 -449
- 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/carbonfox.json +0 -248
- 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/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 -242
- package/src/cli/cmd/tui/context/theme/jonsoc.json +0 -245
- package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
- package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -237
- 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 -249
- 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 -1153
- package/src/cli/cmd/tui/event.ts +0 -48
- package/src/cli/cmd/tui/hooks/use-command-registry.tsx +0 -184
- package/src/cli/cmd/tui/routes/home.tsx +0 -198
- 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 -91
- package/src/cli/cmd/tui/routes/session/git-commit.tsx +0 -59
- package/src/cli/cmd/tui/routes/session/git-history.tsx +0 -122
- package/src/cli/cmd/tui/routes/session/header.tsx +0 -185
- package/src/cli/cmd/tui/routes/session/index.tsx +0 -2363
- package/src/cli/cmd/tui/routes/session/navigator-ui.tsx +0 -214
- package/src/cli/cmd/tui/routes/session/navigator.tsx +0 -1124
- package/src/cli/cmd/tui/routes/session/panel-explorer.tsx +0 -553
- package/src/cli/cmd/tui/routes/session/panel-viewer.tsx +0 -386
- package/src/cli/cmd/tui/routes/session/permission.tsx +0 -501
- package/src/cli/cmd/tui/routes/session/question.tsx +0 -507
- package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -365
- package/src/cli/cmd/tui/routes/session/vcs-diff-viewer.tsx +0 -37
- package/src/cli/cmd/tui/routes/ui-settings.tsx +0 -449
- package/src/cli/cmd/tui/thread.ts +0 -172
- package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -90
- 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 -384
- package/src/cli/cmd/tui/ui/dialog.tsx +0 -170
- package/src/cli/cmd/tui/ui/link.tsx +0 -28
- package/src/cli/cmd/tui/ui/spinner.ts +0 -375
- package/src/cli/cmd/tui/ui/toast.tsx +0 -100
- package/src/cli/cmd/tui/util/clipboard.ts +0 -255
- 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 -152
- package/src/cli/cmd/uninstall.ts +0 -362
- package/src/cli/cmd/upgrade.ts +0 -73
- package/src/cli/cmd/web.ts +0 -81
- package/src/cli/error.ts +0 -57
- package/src/cli/network.ts +0 -53
- package/src/cli/ui.ts +0 -119
- 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 -99
- package/src/config/config.ts +0 -1404
- package/src/config/markdown.ts +0 -93
- package/src/env/index.ts +0 -26
- package/src/file/ignore.ts +0 -83
- package/src/file/index.ts +0 -432
- package/src/file/ripgrep.ts +0 -407
- package/src/file/time.ts +0 -69
- package/src/file/watcher.ts +0 -127
- package/src/flag/flag.ts +0 -80
- package/src/format/formatter.ts +0 -357
- package/src/format/index.ts +0 -137
- package/src/global/index.ts +0 -58
- package/src/id/id.ts +0 -83
- package/src/ide/index.ts +0 -76
- package/src/index.ts +0 -208
- package/src/installation/index.ts +0 -258
- 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 -2046
- package/src/mcp/auth.ts +0 -135
- package/src/mcp/index.ts +0 -934
- package/src/mcp/oauth-callback.ts +0 -200
- package/src/mcp/oauth-provider.ts +0 -155
- package/src/patch/index.ts +0 -680
- package/src/permission/arity.ts +0 -163
- package/src/permission/index.ts +0 -210
- package/src/permission/next.ts +0 -280
- package/src/plugin/codex.ts +0 -500
- package/src/plugin/copilot.ts +0 -283
- package/src/plugin/index.ts +0 -135
- package/src/project/bootstrap.ts +0 -35
- package/src/project/instance.ts +0 -91
- package/src/project/project.ts +0 -371
- package/src/project/state.ts +0 -66
- package/src/project/vcs.ts +0 -151
- package/src/provider/auth.ts +0 -147
- package/src/provider/models-macro.ts +0 -14
- package/src/provider/models.ts +0 -114
- package/src/provider/provider.ts +0 -1220
- package/src/provider/sdk/openai-compatible/src/README.md +0 -5
- package/src/provider/sdk/openai-compatible/src/index.ts +0 -2
- package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +0 -100
- package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +0 -303
- package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +0 -22
- package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +0 -18
- package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +0 -22
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +0 -207
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +0 -1732
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +0 -177
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +0 -1
- package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +0 -88
- package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +0 -128
- package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +0 -115
- package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +0 -65
- package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +0 -104
- package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +0 -103
- package/src/provider/transform.ts +0 -742
- package/src/pty/index.ts +0 -241
- package/src/question/index.ts +0 -176
- package/src/scheduler/index.ts +0 -61
- package/src/server/error.ts +0 -36
- package/src/server/event.ts +0 -7
- package/src/server/mdns.ts +0 -59
- package/src/server/routes/config.ts +0 -92
- package/src/server/routes/experimental.ts +0 -208
- package/src/server/routes/file.ts +0 -227
- package/src/server/routes/global.ts +0 -135
- package/src/server/routes/mcp.ts +0 -225
- package/src/server/routes/permission.ts +0 -68
- package/src/server/routes/project.ts +0 -82
- package/src/server/routes/provider.ts +0 -165
- package/src/server/routes/pty.ts +0 -169
- package/src/server/routes/question.ts +0 -98
- package/src/server/routes/session.ts +0 -939
- package/src/server/routes/tui.ts +0 -379
- package/src/server/server.ts +0 -663
- package/src/session/compaction.ts +0 -225
- package/src/session/index.ts +0 -498
- package/src/session/llm.ts +0 -288
- package/src/session/message-v2.ts +0 -740
- package/src/session/message.ts +0 -189
- package/src/session/processor.ts +0 -406
- package/src/session/prompt/anthropic-20250930.txt +0 -168
- package/src/session/prompt/anthropic.txt +0 -172
- package/src/session/prompt/anthropic_spoof.txt +0 -1
- package/src/session/prompt/beast.txt +0 -149
- package/src/session/prompt/build-switch.txt +0 -5
- package/src/session/prompt/codex_header.txt +0 -81
- package/src/session/prompt/copilot-gpt-5.txt +0 -145
- package/src/session/prompt/gemini.txt +0 -157
- 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 -111
- package/src/session/prompt.ts +0 -1815
- package/src/session/retry.ts +0 -90
- package/src/session/revert.ts +0 -121
- package/src/session/status.ts +0 -76
- package/src/session/summary.ts +0 -150
- package/src/session/system.ts +0 -156
- package/src/session/todo.ts +0 -37
- package/src/share/share-next.ts +0 -204
- package/src/share/share.ts +0 -95
- package/src/shell/shell.ts +0 -67
- package/src/skill/index.ts +0 -1
- package/src/skill/skill.ts +0 -135
- package/src/snapshot/index.ts +0 -236
- package/src/storage/storage.ts +0 -227
- package/src/tool/apply_patch.ts +0 -279
- package/src/tool/apply_patch.txt +0 -33
- package/src/tool/bash.ts +0 -258
- package/src/tool/bash.txt +0 -115
- 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 -645
- package/src/tool/edit.txt +0 -10
- package/src/tool/external-directory.ts +0 -32
- package/src/tool/glob.ts +0 -77
- package/src/tool/glob.txt +0 -6
- package/src/tool/grep.ts +0 -154
- package/src/tool/grep.txt +0 -8
- package/src/tool/invalid.ts +0 -17
- package/src/tool/ls.ts +0 -121
- package/src/tool/ls.txt +0 -1
- package/src/tool/lsp.ts +0 -96
- package/src/tool/lsp.txt +0 -19
- package/src/tool/multiedit.ts +0 -46
- package/src/tool/multiedit.txt +0 -41
- package/src/tool/plan-enter.txt +0 -14
- package/src/tool/plan-exit.txt +0 -13
- package/src/tool/plan.ts +0 -130
- package/src/tool/question.ts +0 -33
- package/src/tool/question.txt +0 -10
- package/src/tool/read.ts +0 -202
- package/src/tool/read.txt +0 -12
- package/src/tool/registry.ts +0 -162
- package/src/tool/skill.ts +0 -82
- package/src/tool/task.ts +0 -188
- 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 -88
- package/src/tool/truncation.ts +0 -106
- package/src/tool/webfetch.ts +0 -182
- package/src/tool/webfetch.txt +0 -13
- package/src/tool/websearch.ts +0 -150
- package/src/tool/websearch.txt +0 -14
- package/src/tool/write.ts +0 -80
- 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 -93
- package/src/util/fn.ts +0 -11
- package/src/util/format.ts +0 -20
- package/src/util/iife.ts +0 -3
- package/src/util/keybind.ts +0 -103
- 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 -66
- 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 -56
- package/src/worktree/index.ts +0 -524
- package/sst-env.d.ts +0 -9
- package/test/acp/agent-interface.test.ts +0 -51
- package/test/acp/event-subscription.test.ts +0 -436
- package/test/agent/agent.test.ts +0 -638
- package/test/bun.test.ts +0 -53
- package/test/cli/cmd/tui/fileref.test.ts +0 -30
- package/test/cli/github-action.test.ts +0 -129
- package/test/cli/github-remote.test.ts +0 -80
- package/test/cli/tui/navigator_logic.test.ts +0 -99
- package/test/cli/tui/transcript.test.ts +0 -297
- package/test/cli/ui.test.ts +0 -80
- package/test/config/agent-color.test.ts +0 -66
- package/test/config/config.test.ts +0 -1613
- package/test/config/fixtures/empty-frontmatter.md +0 -4
- package/test/config/fixtures/frontmatter.md +0 -28
- package/test/config/fixtures/no-frontmatter.md +0 -1
- package/test/config/markdown.test.ts +0 -192
- package/test/file/ignore.test.ts +0 -10
- package/test/file/path-traversal.test.ts +0 -198
- 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/mcp/oauth-browser.test.ts +0 -261
- package/test/patch/patch.test.ts +0 -348
- package/test/permission/arity.test.ts +0 -33
- package/test/permission/next.test.ts +0 -690
- package/test/permission-task.test.ts +0 -319
- package/test/plugin/codex.test.ts +0 -123
- package/test/preload.ts +0 -67
- package/test/project/project.test.ts +0 -120
- package/test/provider/amazon-bedrock.test.ts +0 -268
- package/test/provider/gitlab-duo.test.ts +0 -286
- package/test/provider/provider.test.ts +0 -2149
- package/test/provider/transform.test.ts +0 -1631
- package/test/question/question.test.ts +0 -300
- package/test/scheduler.test.ts +0 -73
- package/test/server/session-list.test.ts +0 -39
- package/test/server/session-select.test.ts +0 -78
- package/test/session/compaction.test.ts +0 -293
- package/test/session/llm.test.ts +0 -90
- package/test/session/message-v2.test.ts +0 -786
- 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/apply_patch.test.ts +0 -499
- package/test/tool/bash.test.ts +0 -320
- package/test/tool/external-directory.test.ts +0 -126
- package/test/tool/fixtures/large-image.png +0 -0
- package/test/tool/fixtures/models-api.json +0 -33453
- package/test/tool/grep.test.ts +0 -109
- package/test/tool/question.test.ts +0 -105
- package/test/tool/read.test.ts +0 -332
- package/test/tool/registry.test.ts +0 -76
- package/test/tool/truncation.test.ts +0 -159
- package/test/util/filesystem.test.ts +0 -39
- package/test/util/format.test.ts +0 -59
- package/test/util/iife.test.ts +0 -36
- package/test/util/lazy.test.ts +0 -50
- package/test/util/lock.test.ts +0 -72
- package/test/util/timeout.test.ts +0 -21
- package/test/util/wildcard.test.ts +0 -75
- package/tsconfig.json +0 -16
package/src/cli/cmd/tui/event.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { BusEvent } from "@/bus/bus-event"
|
|
2
|
-
import { Bus } from "@/bus"
|
|
3
|
-
import z from "zod"
|
|
4
|
-
|
|
5
|
-
export const TuiEvent = {
|
|
6
|
-
PromptAppend: BusEvent.define("tui.prompt.append", z.object({ text: z.string() })),
|
|
7
|
-
CommandExecute: BusEvent.define(
|
|
8
|
-
"tui.command.execute",
|
|
9
|
-
z.object({
|
|
10
|
-
command: z.union([
|
|
11
|
-
z.enum([
|
|
12
|
-
"session.list",
|
|
13
|
-
"session.new",
|
|
14
|
-
"session.share",
|
|
15
|
-
"session.interrupt",
|
|
16
|
-
"session.compact",
|
|
17
|
-
"session.page.up",
|
|
18
|
-
"session.page.down",
|
|
19
|
-
"session.line.up",
|
|
20
|
-
"session.line.down",
|
|
21
|
-
"session.half.page.up",
|
|
22
|
-
"session.half.page.down",
|
|
23
|
-
"session.first",
|
|
24
|
-
"session.last",
|
|
25
|
-
"prompt.clear",
|
|
26
|
-
"prompt.submit",
|
|
27
|
-
"agent.cycle",
|
|
28
|
-
]),
|
|
29
|
-
z.string(),
|
|
30
|
-
]),
|
|
31
|
-
}),
|
|
32
|
-
),
|
|
33
|
-
ToastShow: BusEvent.define(
|
|
34
|
-
"tui.toast.show",
|
|
35
|
-
z.object({
|
|
36
|
-
title: z.string().optional(),
|
|
37
|
-
message: z.string(),
|
|
38
|
-
variant: z.enum(["info", "success", "warning", "error"]),
|
|
39
|
-
duration: z.number().default(5000).optional().describe("Duration in milliseconds"),
|
|
40
|
-
}),
|
|
41
|
-
),
|
|
42
|
-
SessionSelect: BusEvent.define(
|
|
43
|
-
"tui.session.select",
|
|
44
|
-
z.object({
|
|
45
|
-
sessionID: z.string().regex(/^ses/).describe("Session ID to navigate to"),
|
|
46
|
-
}),
|
|
47
|
-
),
|
|
48
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { useCommandDialog, type CommandOption } from "../component/dialog-command"
|
|
2
|
-
import { useLayout } from "../context/layout"
|
|
3
|
-
import { useKV } from "../context/kv"
|
|
4
|
-
import { useRoute } from "../context/route"
|
|
5
|
-
import { useSync } from "../context/sync"
|
|
6
|
-
import { useTheme } from "../context/theme"
|
|
7
|
-
import { useToast } from "../ui/toast"
|
|
8
|
-
import { useLocal } from "../context/local"
|
|
9
|
-
import { useSDK } from "../context/sdk"
|
|
10
|
-
import { useInspector } from "../context/inspector"
|
|
11
|
-
import type { Route } from "../context/route"
|
|
12
|
-
|
|
13
|
-
// Define all command groups
|
|
14
|
-
export type CommandGroup =
|
|
15
|
-
| "layout" // Panel toggles, /ui
|
|
16
|
-
| "navigation" // Home, session switching
|
|
17
|
-
| "session" // Share, rename, timeline, etc.
|
|
18
|
-
| "display" // Timestamps, thinking, conceal, etc.
|
|
19
|
-
| "system" // Tips, help, etc.
|
|
20
|
-
|
|
21
|
-
// Command definitions by group
|
|
22
|
-
const COMMAND_DEFINITIONS: Record<CommandGroup, (ctx: CommandContext) => CommandOption[]> = {
|
|
23
|
-
layout: (ctx) => [
|
|
24
|
-
{
|
|
25
|
-
title: ctx.layout.getPanelByType("explorer")?.visible ? "Hide navigator" : "Show navigator",
|
|
26
|
-
value: "session.navigator.toggle",
|
|
27
|
-
keybind: "navigator_toggle",
|
|
28
|
-
category: "Session",
|
|
29
|
-
onSelect: (dialog) => {
|
|
30
|
-
ctx.layout.togglePanel("explorer")
|
|
31
|
-
dialog.clear()
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
title: ctx.layout.getPanelByType("viewer")?.visible ? "Hide file viewer" : "Show file viewer",
|
|
36
|
-
value: "session.viewer.toggle",
|
|
37
|
-
category: "Session",
|
|
38
|
-
onSelect: (dialog) => {
|
|
39
|
-
ctx.layout.togglePanel("viewer")
|
|
40
|
-
dialog.clear()
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
title: ctx.navigatorTab() === "git" ? "Keep file explorer on" : "Keep git controls on",
|
|
45
|
-
value: "session.navigator.git.toggle",
|
|
46
|
-
category: "Session",
|
|
47
|
-
onSelect: (dialog) => {
|
|
48
|
-
ctx.toggleNavigatorTab()
|
|
49
|
-
dialog.clear()
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
title: "Configure UI Layout",
|
|
54
|
-
value: "session.ui_settings",
|
|
55
|
-
category: "Session",
|
|
56
|
-
slash: {
|
|
57
|
-
name: "ui",
|
|
58
|
-
aliases: ["layout", "configure"],
|
|
59
|
-
},
|
|
60
|
-
onSelect: (dialog) => {
|
|
61
|
-
dialog.clear()
|
|
62
|
-
ctx.navigate({
|
|
63
|
-
type: "ui-settings",
|
|
64
|
-
returnTo: ctx.returnTo,
|
|
65
|
-
})
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
|
|
70
|
-
navigation: (ctx) => [
|
|
71
|
-
// Navigation commands go here
|
|
72
|
-
],
|
|
73
|
-
|
|
74
|
-
session: (ctx) => [
|
|
75
|
-
// Session-specific commands go here (share, rename, etc.)
|
|
76
|
-
],
|
|
77
|
-
|
|
78
|
-
display: (ctx) => [
|
|
79
|
-
// Display toggle commands go here
|
|
80
|
-
],
|
|
81
|
-
|
|
82
|
-
system: (ctx) => [
|
|
83
|
-
{
|
|
84
|
-
title: ctx.inspector?.enabled() ? "Disable element inspector" : "Enable element inspector",
|
|
85
|
-
value: "app.inspector.toggle",
|
|
86
|
-
keybind: "inspector_toggle",
|
|
87
|
-
category: "System",
|
|
88
|
-
onSelect: (dialog) => {
|
|
89
|
-
ctx.inspector?.setEnabled((prev) => !prev)
|
|
90
|
-
dialog.clear()
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
interface CommandContext {
|
|
97
|
-
layout: ReturnType<typeof useLayout>
|
|
98
|
-
kv: ReturnType<typeof useKV>
|
|
99
|
-
navigate: ReturnType<typeof useRoute>["navigate"]
|
|
100
|
-
returnTo: Route
|
|
101
|
-
navigatorTab: () => "explorer" | "git"
|
|
102
|
-
toggleNavigatorTab: () => void
|
|
103
|
-
inspector?: ReturnType<typeof useInspector>
|
|
104
|
-
sync?: ReturnType<typeof useSync>
|
|
105
|
-
theme?: ReturnType<typeof useTheme>
|
|
106
|
-
toast?: ReturnType<typeof useToast>
|
|
107
|
-
local?: ReturnType<typeof useLocal>
|
|
108
|
-
sdk?: ReturnType<typeof useSDK>
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Validate that commands are only registered from allowed locations
|
|
112
|
-
const VALID_REGISTRATION_LOCATIONS = [
|
|
113
|
-
"routes/home.tsx",
|
|
114
|
-
"routes/session/index.tsx",
|
|
115
|
-
"hooks/use-command-registry.tsx", // Only this hook should register commands
|
|
116
|
-
]
|
|
117
|
-
|
|
118
|
-
export function useCommandRegistry(options: {
|
|
119
|
-
groups: CommandGroup[]
|
|
120
|
-
returnTo: Route
|
|
121
|
-
additionalCommands?: CommandOption[]
|
|
122
|
-
}) {
|
|
123
|
-
const command = useCommandDialog()
|
|
124
|
-
const layout = useLayout()
|
|
125
|
-
const kv = useKV()
|
|
126
|
-
const { navigate } = useRoute()
|
|
127
|
-
const [navigatorTab, setNavigatorTab] = kv.signal<"explorer" | "git">("navigator_tab", "explorer")
|
|
128
|
-
|
|
129
|
-
const toggleNavigatorTab = () => {
|
|
130
|
-
setNavigatorTab((prev) => (prev === "git" ? "explorer" : "git"))
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const inspector = useInspector()
|
|
134
|
-
|
|
135
|
-
const ctx: CommandContext = {
|
|
136
|
-
layout,
|
|
137
|
-
kv,
|
|
138
|
-
navigate,
|
|
139
|
-
returnTo: options.returnTo,
|
|
140
|
-
navigatorTab: () => navigatorTab(),
|
|
141
|
-
toggleNavigatorTab,
|
|
142
|
-
inspector,
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Build command list from groups
|
|
146
|
-
const commands = options.groups.flatMap((group) => {
|
|
147
|
-
const definitions = COMMAND_DEFINITIONS[group]
|
|
148
|
-
if (!definitions) {
|
|
149
|
-
console.error(`[CommandRegistry] Unknown command group: ${group}`)
|
|
150
|
-
return []
|
|
151
|
-
}
|
|
152
|
-
return definitions(ctx)
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
// Add any additional commands
|
|
156
|
-
if (options.additionalCommands) {
|
|
157
|
-
commands.push(...options.additionalCommands)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Register all commands at once
|
|
161
|
-
command.register(() => commands)
|
|
162
|
-
|
|
163
|
-
return {
|
|
164
|
-
// Expose context helpers for additional commands
|
|
165
|
-
layout,
|
|
166
|
-
kv,
|
|
167
|
-
navigate,
|
|
168
|
-
navigatorTab: () => navigatorTab(),
|
|
169
|
-
toggleNavigatorTab,
|
|
170
|
-
toggleNavigator: () => layout.togglePanel("explorer"),
|
|
171
|
-
toggleSidebar: () => layout.togglePanel("viewer"),
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Utility to prevent direct command registration outside the registry
|
|
176
|
-
export function validateCommandRegistration(location: string): boolean {
|
|
177
|
-
const isValid = VALID_REGISTRATION_LOCATIONS.some((valid) => location.includes(valid))
|
|
178
|
-
if (!isValid) {
|
|
179
|
-
console.warn(
|
|
180
|
-
`[CommandRegistry] Commands should not be registered from ${location}. ` + `Use useCommandRegistry() instead.`,
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
return isValid
|
|
184
|
-
}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { Prompt, type PromptRef } from "@tui/component/prompt"
|
|
2
|
-
import { type MouseEvent } from "@opentui/core"
|
|
3
|
-
import { useTerminalDimensions } from "@opentui/solid"
|
|
4
|
-
import { batch, createEffect, createMemo, createSignal, Match, onMount, Show, Switch } from "solid-js"
|
|
5
|
-
import { useTheme } from "@tui/context/theme"
|
|
6
|
-
import { useKeybind } from "@tui/context/keybind"
|
|
7
|
-
import { Logo } from "../component/logo"
|
|
8
|
-
import { Tips } from "../component/tips"
|
|
9
|
-
import { Locale } from "@/util/locale"
|
|
10
|
-
import { useSync } from "../context/sync"
|
|
11
|
-
import { Toast, useToast } from "../ui/toast"
|
|
12
|
-
import { useArgs } from "../context/args"
|
|
13
|
-
import { useDirectory } from "../context/directory"
|
|
14
|
-
import { useRouteData } from "@tui/context/route"
|
|
15
|
-
import { usePromptRef } from "../context/prompt"
|
|
16
|
-
import { Installation } from "@/installation"
|
|
17
|
-
import { useKV } from "../context/kv"
|
|
18
|
-
import { useCommandDialog } from "../component/dialog-command"
|
|
19
|
-
import { ExplorerPanel } from "./session/panel-explorer"
|
|
20
|
-
import { FileViewerPanel } from "./session/panel-viewer"
|
|
21
|
-
import { DynamicLayout } from "@tui/component/dynamic-layout"
|
|
22
|
-
import { useLayout } from "@tui/context/layout"
|
|
23
|
-
import { useCommandRegistry } from "../hooks/use-command-registry"
|
|
24
|
-
|
|
25
|
-
// TODO: what is the best way to do this?
|
|
26
|
-
let once = false
|
|
27
|
-
|
|
28
|
-
export function Home() {
|
|
29
|
-
const sync = useSync()
|
|
30
|
-
const kv = useKV()
|
|
31
|
-
const { theme } = useTheme()
|
|
32
|
-
const route = useRouteData("home")
|
|
33
|
-
const promptRef = usePromptRef()
|
|
34
|
-
const command = useCommandDialog()
|
|
35
|
-
const toast = useToast()
|
|
36
|
-
const layout = useLayout()
|
|
37
|
-
const [selectedFilePath, setSelectedFilePath] = createSignal<string | null>(null)
|
|
38
|
-
const mcp = createMemo(() => Object.keys(sync.data.mcp).length > 0)
|
|
39
|
-
const mcpError = createMemo(() => {
|
|
40
|
-
return Object.values(sync.data.mcp).some((x) => x.status === "failed")
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
const connectedMcpCount = createMemo(() => {
|
|
44
|
-
return Object.values(sync.data.mcp).filter((x) => x.status === "connected").length
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
const isFirstTimeUser = createMemo(() => sync.data.session.length === 0)
|
|
48
|
-
const tipsHidden = createMemo(() => kv.get("tips_hidden", false))
|
|
49
|
-
const showTips = createMemo(() => {
|
|
50
|
-
// Don't show tips for first-time users
|
|
51
|
-
if (isFirstTimeUser()) return false
|
|
52
|
-
return !tipsHidden()
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const dimensions = useTerminalDimensions()
|
|
56
|
-
|
|
57
|
-
const closeNavigator = () => {
|
|
58
|
-
// Just focus the prompt, layout controls visibility now
|
|
59
|
-
promptRef.current?.focus()
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Register commands through centralized registry
|
|
63
|
-
useCommandRegistry({
|
|
64
|
-
groups: ["layout", "system"], // Include layout and system commands
|
|
65
|
-
returnTo: { type: "home" },
|
|
66
|
-
additionalCommands: [
|
|
67
|
-
{
|
|
68
|
-
title: tipsHidden() ? "Show tips" : "Hide tips",
|
|
69
|
-
value: "tips.toggle",
|
|
70
|
-
keybind: "tips_toggle",
|
|
71
|
-
category: "System",
|
|
72
|
-
onSelect: (dialog) => {
|
|
73
|
-
kv.set("tips_hidden", !tipsHidden())
|
|
74
|
-
dialog.clear()
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
const Hint = (
|
|
81
|
-
<Show when={connectedMcpCount() > 0}>
|
|
82
|
-
<box flexShrink={0} flexDirection="row" gap={1}>
|
|
83
|
-
<text fg={theme.text}>
|
|
84
|
-
<Switch>
|
|
85
|
-
<Match when={mcpError()}>
|
|
86
|
-
<span style={{ fg: theme.error }}>•</span> mcp errors{" "}
|
|
87
|
-
<span style={{ fg: theme.textMuted }}>ctrl+x s</span>
|
|
88
|
-
</Match>
|
|
89
|
-
<Match when={true}>
|
|
90
|
-
<span style={{ fg: theme.success }}>•</span>{" "}
|
|
91
|
-
{Locale.pluralize(connectedMcpCount(), "{} mcp server", "{} mcp servers")}
|
|
92
|
-
</Match>
|
|
93
|
-
</Switch>
|
|
94
|
-
</text>
|
|
95
|
-
</box>
|
|
96
|
-
</Show>
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
let prompt: PromptRef
|
|
100
|
-
const args = useArgs()
|
|
101
|
-
onMount(() => {
|
|
102
|
-
if (once) return
|
|
103
|
-
if (route.initialPrompt) {
|
|
104
|
-
prompt.set(route.initialPrompt)
|
|
105
|
-
once = true
|
|
106
|
-
} else if (args.prompt) {
|
|
107
|
-
prompt.set({ input: args.prompt, parts: [] })
|
|
108
|
-
once = true
|
|
109
|
-
prompt.submit()
|
|
110
|
-
}
|
|
111
|
-
})
|
|
112
|
-
const directory = useDirectory()
|
|
113
|
-
|
|
114
|
-
const keybind = useKeybind()
|
|
115
|
-
|
|
116
|
-
// Reactive panel widths that update when layout store changes
|
|
117
|
-
const explorerWidth = createMemo(() => {
|
|
118
|
-
const panel = layout.getPanelByType("explorer")
|
|
119
|
-
if (!panel?.visible) return 0
|
|
120
|
-
return Math.floor(dimensions().width * ((panel.width || 20) / 100))
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
const viewerWidth = createMemo(() => {
|
|
124
|
-
const panel = layout.getPanelByType("viewer")
|
|
125
|
-
if (!panel?.visible) return 0
|
|
126
|
-
return Math.floor(dimensions().width * ((panel.width || 30) / 100))
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
return (
|
|
130
|
-
<DynamicLayout
|
|
131
|
-
explorer={
|
|
132
|
-
<ExplorerPanel
|
|
133
|
-
width={explorerWidth()}
|
|
134
|
-
onSelect={(path, type) => {
|
|
135
|
-
if (type === "file") {
|
|
136
|
-
setSelectedFilePath(path)
|
|
137
|
-
}
|
|
138
|
-
}}
|
|
139
|
-
/>
|
|
140
|
-
}
|
|
141
|
-
chat={
|
|
142
|
-
<box height="100%" flexDirection="column" onMouseUp={() => promptRef.current?.focus()}>
|
|
143
|
-
<box flexGrow={1} justifyContent="center" alignItems="center" paddingLeft={2} paddingRight={2} gap={1}>
|
|
144
|
-
<box height={3} />
|
|
145
|
-
<Logo />
|
|
146
|
-
<box width="100%" maxWidth={75} zIndex={1000} paddingTop={1}>
|
|
147
|
-
<Prompt
|
|
148
|
-
ref={(r) => {
|
|
149
|
-
prompt = r
|
|
150
|
-
promptRef.set(r)
|
|
151
|
-
}}
|
|
152
|
-
hint={Hint}
|
|
153
|
-
/>
|
|
154
|
-
</box>
|
|
155
|
-
<box height={3} width="100%" maxWidth={75} alignItems="center" paddingTop={2}>
|
|
156
|
-
<Show when={showTips()}>
|
|
157
|
-
<Tips />
|
|
158
|
-
</Show>
|
|
159
|
-
</box>
|
|
160
|
-
<Toast />
|
|
161
|
-
</box>
|
|
162
|
-
<box
|
|
163
|
-
paddingTop={1}
|
|
164
|
-
paddingBottom={1}
|
|
165
|
-
paddingLeft={2}
|
|
166
|
-
paddingRight={2}
|
|
167
|
-
flexDirection="row"
|
|
168
|
-
flexShrink={0}
|
|
169
|
-
gap={2}
|
|
170
|
-
>
|
|
171
|
-
<text fg={theme.textMuted}>{directory()}</text>
|
|
172
|
-
<box gap={1} flexDirection="row" flexShrink={0}>
|
|
173
|
-
<Show when={mcp()}>
|
|
174
|
-
<text fg={theme.text}>
|
|
175
|
-
<Switch>
|
|
176
|
-
<Match when={mcpError()}>
|
|
177
|
-
<span style={{ fg: theme.error }}>⊙ </span>
|
|
178
|
-
</Match>
|
|
179
|
-
<Match when={true}>
|
|
180
|
-
<span style={{ fg: connectedMcpCount() > 0 ? theme.success : theme.textMuted }}>⊙ </span>
|
|
181
|
-
</Match>
|
|
182
|
-
</Switch>
|
|
183
|
-
{connectedMcpCount()} MCP
|
|
184
|
-
</text>
|
|
185
|
-
<text fg={theme.textMuted}>/status</text>
|
|
186
|
-
</Show>
|
|
187
|
-
</box>
|
|
188
|
-
<box flexGrow={1} />
|
|
189
|
-
<box flexShrink={0}>
|
|
190
|
-
<text fg={theme.textMuted}>{Installation.VERSION}</text>
|
|
191
|
-
</box>
|
|
192
|
-
</box>
|
|
193
|
-
</box>
|
|
194
|
-
}
|
|
195
|
-
viewer={<FileViewerPanel width={viewerWidth()} filePath={selectedFilePath()} />}
|
|
196
|
-
/>
|
|
197
|
-
)
|
|
198
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { createMemo, onMount } from "solid-js"
|
|
2
|
-
import { useSync } from "@tui/context/sync"
|
|
3
|
-
import { DialogSelect, type DialogSelectOption } from "@tui/ui/dialog-select"
|
|
4
|
-
import type { TextPart } from "@jonsoc/sdk/v2"
|
|
5
|
-
import { Locale } from "@/util/locale"
|
|
6
|
-
import { useSDK } from "@tui/context/sdk"
|
|
7
|
-
import { useRoute } from "@tui/context/route"
|
|
8
|
-
import { useDialog } from "../../ui/dialog"
|
|
9
|
-
import type { PromptInfo } from "@tui/component/prompt/history"
|
|
10
|
-
|
|
11
|
-
export function DialogForkFromTimeline(props: { sessionID: string; onMove: (messageID: string) => void }) {
|
|
12
|
-
const sync = useSync()
|
|
13
|
-
const dialog = useDialog()
|
|
14
|
-
const sdk = useSDK()
|
|
15
|
-
const route = useRoute()
|
|
16
|
-
|
|
17
|
-
onMount(() => {
|
|
18
|
-
dialog.setSize("large")
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
const options = createMemo((): DialogSelectOption<string>[] => {
|
|
22
|
-
const messages = sync.data.message[props.sessionID] ?? []
|
|
23
|
-
const result = [] as DialogSelectOption<string>[]
|
|
24
|
-
for (const message of messages) {
|
|
25
|
-
if (message.role !== "user") continue
|
|
26
|
-
const part = (sync.data.part[message.id] ?? []).find(
|
|
27
|
-
(x) => x.type === "text" && !x.synthetic && !x.ignored,
|
|
28
|
-
) as TextPart
|
|
29
|
-
if (!part) continue
|
|
30
|
-
result.push({
|
|
31
|
-
title: part.text.replace(/\n/g, " "),
|
|
32
|
-
value: message.id,
|
|
33
|
-
footer: Locale.time(message.time.created),
|
|
34
|
-
onSelect: async (dialog) => {
|
|
35
|
-
const forked = await sdk.client.session.fork({
|
|
36
|
-
sessionID: props.sessionID,
|
|
37
|
-
messageID: message.id,
|
|
38
|
-
})
|
|
39
|
-
const parts = sync.data.part[message.id] ?? []
|
|
40
|
-
const initialPrompt = parts.reduce(
|
|
41
|
-
(agg, part) => {
|
|
42
|
-
if (part.type === "text") {
|
|
43
|
-
if (!part.synthetic) agg.input += part.text
|
|
44
|
-
}
|
|
45
|
-
if (part.type === "file") agg.parts.push(part)
|
|
46
|
-
return agg
|
|
47
|
-
},
|
|
48
|
-
{ input: "", parts: [] as PromptInfo["parts"] },
|
|
49
|
-
)
|
|
50
|
-
route.navigate({
|
|
51
|
-
sessionID: forked.data!.id,
|
|
52
|
-
type: "session",
|
|
53
|
-
initialPrompt,
|
|
54
|
-
})
|
|
55
|
-
dialog.clear()
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
result.reverse()
|
|
60
|
-
return result
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
return <DialogSelect onMove={(option) => props.onMove(option.value)} title="Fork from message" options={options()} />
|
|
64
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { createMemo } from "solid-js"
|
|
2
|
-
import { useSync } from "@tui/context/sync"
|
|
3
|
-
import { DialogSelect } from "@tui/ui/dialog-select"
|
|
4
|
-
import { useSDK } from "@tui/context/sdk"
|
|
5
|
-
import { useRoute } from "@tui/context/route"
|
|
6
|
-
import { Clipboard } from "@tui/util/clipboard"
|
|
7
|
-
import type { PromptInfo } from "@tui/component/prompt/history"
|
|
8
|
-
|
|
9
|
-
export function DialogMessage(props: {
|
|
10
|
-
messageID: string
|
|
11
|
-
sessionID: string
|
|
12
|
-
setPrompt?: (prompt: PromptInfo) => void
|
|
13
|
-
}) {
|
|
14
|
-
const sync = useSync()
|
|
15
|
-
const sdk = useSDK()
|
|
16
|
-
const message = createMemo(() => sync.data.message[props.sessionID]?.find((x) => x.id === props.messageID))
|
|
17
|
-
const route = useRoute()
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<DialogSelect
|
|
21
|
-
title="Message Actions"
|
|
22
|
-
options={[
|
|
23
|
-
{
|
|
24
|
-
title: "Revert",
|
|
25
|
-
value: "session.revert",
|
|
26
|
-
description: "undo messages and file changes",
|
|
27
|
-
onSelect: (dialog) => {
|
|
28
|
-
const msg = message()
|
|
29
|
-
if (!msg) return
|
|
30
|
-
|
|
31
|
-
sdk.client.session.revert({
|
|
32
|
-
sessionID: props.sessionID,
|
|
33
|
-
messageID: msg.id,
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
if (props.setPrompt) {
|
|
37
|
-
const parts = sync.data.part[msg.id]
|
|
38
|
-
const promptInfo = parts.reduce(
|
|
39
|
-
(agg, part) => {
|
|
40
|
-
if (part.type === "text") {
|
|
41
|
-
if (!part.synthetic) agg.input += part.text
|
|
42
|
-
}
|
|
43
|
-
if (part.type === "file") agg.parts.push(part)
|
|
44
|
-
return agg
|
|
45
|
-
},
|
|
46
|
-
{ input: "", parts: [] as PromptInfo["parts"] },
|
|
47
|
-
)
|
|
48
|
-
props.setPrompt(promptInfo)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
dialog.clear()
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
title: "Copy",
|
|
56
|
-
value: "message.copy",
|
|
57
|
-
description: "message text to clipboard",
|
|
58
|
-
onSelect: async (dialog) => {
|
|
59
|
-
const msg = message()
|
|
60
|
-
if (!msg) return
|
|
61
|
-
|
|
62
|
-
const parts = sync.data.part[msg.id]
|
|
63
|
-
const text = parts.reduce((agg, part) => {
|
|
64
|
-
if (part.type === "text" && !part.synthetic) {
|
|
65
|
-
agg += part.text
|
|
66
|
-
}
|
|
67
|
-
return agg
|
|
68
|
-
}, "")
|
|
69
|
-
|
|
70
|
-
await Clipboard.copy(text)
|
|
71
|
-
dialog.clear()
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
title: "Fork",
|
|
76
|
-
value: "session.fork",
|
|
77
|
-
description: "create a new session",
|
|
78
|
-
onSelect: async (dialog) => {
|
|
79
|
-
const result = await sdk.client.session.fork({
|
|
80
|
-
sessionID: props.sessionID,
|
|
81
|
-
messageID: props.messageID,
|
|
82
|
-
})
|
|
83
|
-
const initialPrompt = (() => {
|
|
84
|
-
const msg = message()
|
|
85
|
-
if (!msg) return undefined
|
|
86
|
-
const parts = sync.data.part[msg.id]
|
|
87
|
-
return parts.reduce(
|
|
88
|
-
(agg, part) => {
|
|
89
|
-
if (part.type === "text") {
|
|
90
|
-
if (!part.synthetic) agg.input += part.text
|
|
91
|
-
}
|
|
92
|
-
if (part.type === "file") agg.parts.push(part)
|
|
93
|
-
return agg
|
|
94
|
-
},
|
|
95
|
-
{ input: "", parts: [] as PromptInfo["parts"] },
|
|
96
|
-
)
|
|
97
|
-
})()
|
|
98
|
-
route.navigate({
|
|
99
|
-
sessionID: result.data!.id,
|
|
100
|
-
type: "session",
|
|
101
|
-
initialPrompt,
|
|
102
|
-
})
|
|
103
|
-
dialog.clear()
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
]}
|
|
107
|
-
/>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { DialogSelect } from "@tui/ui/dialog-select"
|
|
2
|
-
import { useRoute } from "@tui/context/route"
|
|
3
|
-
|
|
4
|
-
export function DialogSubagent(props: { sessionID: string }) {
|
|
5
|
-
const route = useRoute()
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<DialogSelect
|
|
9
|
-
title="Subagent Actions"
|
|
10
|
-
options={[
|
|
11
|
-
{
|
|
12
|
-
title: "Open",
|
|
13
|
-
value: "subagent.view",
|
|
14
|
-
description: "the subagent's session",
|
|
15
|
-
onSelect: (dialog) => {
|
|
16
|
-
route.navigate({
|
|
17
|
-
type: "session",
|
|
18
|
-
sessionID: props.sessionID,
|
|
19
|
-
})
|
|
20
|
-
dialog.clear()
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
]}
|
|
24
|
-
/>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createMemo, onMount } from "solid-js"
|
|
2
|
-
import { useSync } from "@tui/context/sync"
|
|
3
|
-
import { DialogSelect, type DialogSelectOption } from "@tui/ui/dialog-select"
|
|
4
|
-
import type { TextPart } from "@jonsoc/sdk/v2"
|
|
5
|
-
import { Locale } from "@/util/locale"
|
|
6
|
-
import { DialogMessage } from "./dialog-message"
|
|
7
|
-
import { useDialog } from "../../ui/dialog"
|
|
8
|
-
import type { PromptInfo } from "../../component/prompt/history"
|
|
9
|
-
|
|
10
|
-
export function DialogTimeline(props: {
|
|
11
|
-
sessionID: string
|
|
12
|
-
onMove: (messageID: string) => void
|
|
13
|
-
setPrompt?: (prompt: PromptInfo) => void
|
|
14
|
-
}) {
|
|
15
|
-
const sync = useSync()
|
|
16
|
-
const dialog = useDialog()
|
|
17
|
-
|
|
18
|
-
onMount(() => {
|
|
19
|
-
dialog.setSize("large")
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const options = createMemo((): DialogSelectOption<string>[] => {
|
|
23
|
-
const messages = sync.data.message[props.sessionID] ?? []
|
|
24
|
-
const result = [] as DialogSelectOption<string>[]
|
|
25
|
-
for (const message of messages) {
|
|
26
|
-
if (message.role !== "user") continue
|
|
27
|
-
const part = (sync.data.part[message.id] ?? []).find(
|
|
28
|
-
(x) => x.type === "text" && !x.synthetic && !x.ignored,
|
|
29
|
-
) as TextPart
|
|
30
|
-
if (!part) continue
|
|
31
|
-
result.push({
|
|
32
|
-
title: part.text.replace(/\n/g, " "),
|
|
33
|
-
value: message.id,
|
|
34
|
-
footer: Locale.time(message.time.created),
|
|
35
|
-
onSelect: (dialog) => {
|
|
36
|
-
dialog.replace(() => (
|
|
37
|
-
<DialogMessage messageID={message.id} sessionID={props.sessionID} setPrompt={props.setPrompt} />
|
|
38
|
-
))
|
|
39
|
-
},
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
result.reverse()
|
|
43
|
-
return result
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
return <DialogSelect onMove={(option) => props.onMove(option.value)} title="Timeline" options={options()} />
|
|
47
|
-
}
|