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
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { useDialog } from "@tui/ui/dialog"
|
|
2
|
-
import { DialogSelect } from "@tui/ui/dialog-select"
|
|
3
|
-
import { createMemo, createSignal } from "solid-js"
|
|
4
|
-
import { Locale } from "@/util/locale"
|
|
5
|
-
import { useTheme } from "../context/theme"
|
|
6
|
-
import { useKeybind } from "../context/keybind"
|
|
7
|
-
import { usePromptStash, type StashEntry } from "./prompt/stash"
|
|
8
|
-
|
|
9
|
-
function getRelativeTime(timestamp: number): string {
|
|
10
|
-
const now = Date.now()
|
|
11
|
-
const diff = now - timestamp
|
|
12
|
-
const seconds = Math.floor(diff / 1000)
|
|
13
|
-
const minutes = Math.floor(seconds / 60)
|
|
14
|
-
const hours = Math.floor(minutes / 60)
|
|
15
|
-
const days = Math.floor(hours / 24)
|
|
16
|
-
|
|
17
|
-
if (seconds < 60) return "just now"
|
|
18
|
-
if (minutes < 60) return `${minutes}m ago`
|
|
19
|
-
if (hours < 24) return `${hours}h ago`
|
|
20
|
-
if (days < 7) return `${days}d ago`
|
|
21
|
-
return Locale.datetime(timestamp)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function getStashPreview(input: string, maxLength: number = 50): string {
|
|
25
|
-
const firstLine = input.split("\n")[0].trim()
|
|
26
|
-
return Locale.truncate(firstLine, maxLength)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function DialogStash(props: { onSelect: (entry: StashEntry) => void }) {
|
|
30
|
-
const dialog = useDialog()
|
|
31
|
-
const stash = usePromptStash()
|
|
32
|
-
const { theme } = useTheme()
|
|
33
|
-
const keybind = useKeybind()
|
|
34
|
-
|
|
35
|
-
const [toDelete, setToDelete] = createSignal<number>()
|
|
36
|
-
|
|
37
|
-
const options = createMemo(() => {
|
|
38
|
-
const entries = stash.list()
|
|
39
|
-
// Show most recent first
|
|
40
|
-
return entries
|
|
41
|
-
.map((entry, index) => {
|
|
42
|
-
const isDeleting = toDelete() === index
|
|
43
|
-
const lineCount = (entry.input.match(/\n/g)?.length ?? 0) + 1
|
|
44
|
-
return {
|
|
45
|
-
title: isDeleting ? `Press ${keybind.print("stash_delete")} again to confirm` : getStashPreview(entry.input),
|
|
46
|
-
bg: isDeleting ? theme.error : undefined,
|
|
47
|
-
value: index,
|
|
48
|
-
description: getRelativeTime(entry.timestamp),
|
|
49
|
-
footer: lineCount > 1 ? `~${lineCount} lines` : undefined,
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
.toReversed()
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<DialogSelect
|
|
57
|
-
title="Stash"
|
|
58
|
-
options={options()}
|
|
59
|
-
onMove={() => {
|
|
60
|
-
setToDelete(undefined)
|
|
61
|
-
}}
|
|
62
|
-
onSelect={(option) => {
|
|
63
|
-
const entries = stash.list()
|
|
64
|
-
const entry = entries[option.value]
|
|
65
|
-
if (entry) {
|
|
66
|
-
stash.remove(option.value)
|
|
67
|
-
props.onSelect(entry)
|
|
68
|
-
}
|
|
69
|
-
dialog.clear()
|
|
70
|
-
}}
|
|
71
|
-
keybind={[
|
|
72
|
-
{
|
|
73
|
-
keybind: keybind.all.stash_delete?.[0],
|
|
74
|
-
title: "delete",
|
|
75
|
-
onTrigger: (option) => {
|
|
76
|
-
if (toDelete() === option.value) {
|
|
77
|
-
stash.remove(option.value)
|
|
78
|
-
setToDelete(undefined)
|
|
79
|
-
return
|
|
80
|
-
}
|
|
81
|
-
setToDelete(option.value)
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
]}
|
|
85
|
-
/>
|
|
86
|
-
)
|
|
87
|
-
}
|
|
@@ -1,164 +0,0 @@
|
|
|
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
|
-
import { Installation } from "@/installation"
|
|
6
|
-
|
|
7
|
-
export type DialogStatusProps = {}
|
|
8
|
-
|
|
9
|
-
export function DialogStatus() {
|
|
10
|
-
const sync = useSync()
|
|
11
|
-
const { theme } = useTheme()
|
|
12
|
-
|
|
13
|
-
const enabledFormatters = createMemo(() => sync.data.formatter.filter((f) => f.enabled))
|
|
14
|
-
|
|
15
|
-
const plugins = createMemo(() => {
|
|
16
|
-
const list = sync.data.config.plugin ?? []
|
|
17
|
-
const result = list.map((value) => {
|
|
18
|
-
if (value.startsWith("file://")) {
|
|
19
|
-
const path = value.substring("file://".length)
|
|
20
|
-
const parts = path.split("/")
|
|
21
|
-
const filename = parts.pop() || path
|
|
22
|
-
if (!filename.includes(".")) return { name: filename }
|
|
23
|
-
const basename = filename.split(".")[0]
|
|
24
|
-
if (basename === "index") {
|
|
25
|
-
const dirname = parts.pop()
|
|
26
|
-
const name = dirname || basename
|
|
27
|
-
return { name }
|
|
28
|
-
}
|
|
29
|
-
return { name: basename }
|
|
30
|
-
}
|
|
31
|
-
const index = value.lastIndexOf("@")
|
|
32
|
-
if (index <= 0) return { name: value, version: "latest" }
|
|
33
|
-
const name = value.substring(0, index)
|
|
34
|
-
const version = value.substring(index + 1)
|
|
35
|
-
return { name, version }
|
|
36
|
-
})
|
|
37
|
-
return result.toSorted((a, b) => a.name.localeCompare(b.name))
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<box paddingLeft={2} paddingRight={2} gap={1} paddingBottom={1}>
|
|
42
|
-
<box flexDirection="row" justifyContent="space-between">
|
|
43
|
-
<text fg={theme.text} attributes={TextAttributes.BOLD}>
|
|
44
|
-
Status
|
|
45
|
-
</text>
|
|
46
|
-
<text fg={theme.textMuted}>esc</text>
|
|
47
|
-
</box>
|
|
48
|
-
<text fg={theme.textMuted}>JonsOC v{Installation.VERSION}</text>
|
|
49
|
-
<Show when={Object.keys(sync.data.mcp).length > 0} fallback={<text fg={theme.text}>No MCP Servers</text>}>
|
|
50
|
-
<box>
|
|
51
|
-
<text fg={theme.text}>{Object.keys(sync.data.mcp).length} MCP Servers</text>
|
|
52
|
-
<For each={Object.entries(sync.data.mcp)}>
|
|
53
|
-
{([key, item]) => (
|
|
54
|
-
<box flexDirection="row" gap={1}>
|
|
55
|
-
<text
|
|
56
|
-
flexShrink={0}
|
|
57
|
-
style={{
|
|
58
|
-
fg: (
|
|
59
|
-
{
|
|
60
|
-
connected: theme.success,
|
|
61
|
-
failed: theme.error,
|
|
62
|
-
disabled: theme.textMuted,
|
|
63
|
-
needs_auth: theme.warning,
|
|
64
|
-
needs_client_registration: theme.error,
|
|
65
|
-
} as Record<string, typeof theme.success>
|
|
66
|
-
)[item.status],
|
|
67
|
-
}}
|
|
68
|
-
>
|
|
69
|
-
•
|
|
70
|
-
</text>
|
|
71
|
-
<text fg={theme.text} wrapMode="word">
|
|
72
|
-
<b>{key}</b>{" "}
|
|
73
|
-
<span style={{ fg: theme.textMuted }}>
|
|
74
|
-
<Switch fallback={item.status}>
|
|
75
|
-
<Match when={item.status === "connected"}>Connected</Match>
|
|
76
|
-
<Match when={item.status === "failed" && item}>{(val) => val().error}</Match>
|
|
77
|
-
<Match when={item.status === "disabled"}>Disabled in configuration</Match>
|
|
78
|
-
<Match when={(item.status as string) === "needs_auth"}>
|
|
79
|
-
Needs authentication (run: jonsoc mcp auth {key})
|
|
80
|
-
</Match>
|
|
81
|
-
<Match when={(item.status as string) === "needs_client_registration" && item}>
|
|
82
|
-
{(val) => (val() as { error: string }).error}
|
|
83
|
-
</Match>
|
|
84
|
-
</Switch>
|
|
85
|
-
</span>
|
|
86
|
-
</text>
|
|
87
|
-
</box>
|
|
88
|
-
)}
|
|
89
|
-
</For>
|
|
90
|
-
</box>
|
|
91
|
-
</Show>
|
|
92
|
-
{sync.data.lsp.length > 0 && (
|
|
93
|
-
<box>
|
|
94
|
-
<text fg={theme.text}>{sync.data.lsp.length} LSP Servers</text>
|
|
95
|
-
<For each={sync.data.lsp}>
|
|
96
|
-
{(item) => (
|
|
97
|
-
<box flexDirection="row" gap={1}>
|
|
98
|
-
<text
|
|
99
|
-
flexShrink={0}
|
|
100
|
-
style={{
|
|
101
|
-
fg: {
|
|
102
|
-
connected: theme.success,
|
|
103
|
-
error: theme.error,
|
|
104
|
-
}[item.status],
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
•
|
|
108
|
-
</text>
|
|
109
|
-
<text fg={theme.text} wrapMode="word">
|
|
110
|
-
<b>{item.id}</b> <span style={{ fg: theme.textMuted }}>{item.root}</span>
|
|
111
|
-
</text>
|
|
112
|
-
</box>
|
|
113
|
-
)}
|
|
114
|
-
</For>
|
|
115
|
-
</box>
|
|
116
|
-
)}
|
|
117
|
-
<Show when={enabledFormatters().length > 0} fallback={<text fg={theme.text}>No Formatters</text>}>
|
|
118
|
-
<box>
|
|
119
|
-
<text fg={theme.text}>{enabledFormatters().length} Formatters</text>
|
|
120
|
-
<For each={enabledFormatters()}>
|
|
121
|
-
{(item) => (
|
|
122
|
-
<box flexDirection="row" gap={1}>
|
|
123
|
-
<text
|
|
124
|
-
flexShrink={0}
|
|
125
|
-
style={{
|
|
126
|
-
fg: theme.success,
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
129
|
-
•
|
|
130
|
-
</text>
|
|
131
|
-
<text wrapMode="word" fg={theme.text}>
|
|
132
|
-
<b>{item.name}</b>
|
|
133
|
-
</text>
|
|
134
|
-
</box>
|
|
135
|
-
)}
|
|
136
|
-
</For>
|
|
137
|
-
</box>
|
|
138
|
-
</Show>
|
|
139
|
-
<Show when={plugins().length > 0} fallback={<text fg={theme.text}>No Plugins</text>}>
|
|
140
|
-
<box>
|
|
141
|
-
<text fg={theme.text}>{plugins().length} Plugins</text>
|
|
142
|
-
<For each={plugins()}>
|
|
143
|
-
{(item) => (
|
|
144
|
-
<box flexDirection="row" gap={1}>
|
|
145
|
-
<text
|
|
146
|
-
flexShrink={0}
|
|
147
|
-
style={{
|
|
148
|
-
fg: theme.success,
|
|
149
|
-
}}
|
|
150
|
-
>
|
|
151
|
-
•
|
|
152
|
-
</text>
|
|
153
|
-
<text wrapMode="word" fg={theme.text}>
|
|
154
|
-
<b>{item.name}</b>
|
|
155
|
-
{item.version && <span style={{ fg: theme.textMuted }}> @{item.version}</span>}
|
|
156
|
-
</text>
|
|
157
|
-
</box>
|
|
158
|
-
)}
|
|
159
|
-
</For>
|
|
160
|
-
</box>
|
|
161
|
-
</Show>
|
|
162
|
-
</box>
|
|
163
|
-
)
|
|
164
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { createMemo, For, Show } from "solid-js"
|
|
2
|
-
import { useLayout, type PanelType, type PanelPosition } from "@tui/context/layout"
|
|
3
|
-
import { useTheme } from "@tui/context/theme"
|
|
4
|
-
import { useTerminalDimensions } from "@opentui/solid"
|
|
5
|
-
import type { JSX } from "solid-js"
|
|
6
|
-
|
|
7
|
-
interface DynamicLayoutProps {
|
|
8
|
-
chat: JSX.Element
|
|
9
|
-
explorer: JSX.Element
|
|
10
|
-
viewer: JSX.Element
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function DynamicLayout(props: DynamicLayoutProps) {
|
|
14
|
-
const layout = useLayout()
|
|
15
|
-
const { theme } = useTheme()
|
|
16
|
-
const dimensions = useTerminalDimensions()
|
|
17
|
-
|
|
18
|
-
const totalWidth = createMemo(() => {
|
|
19
|
-
const dims = dimensions()
|
|
20
|
-
return dims?.width ? dims.width - 4 : 80
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
const getPanelWidth = (position: PanelPosition) => {
|
|
24
|
-
const panel = layout.getPanelAt(position)
|
|
25
|
-
if (!panel || !panel.visible) return 0
|
|
26
|
-
const total = totalWidth()
|
|
27
|
-
|
|
28
|
-
// Calculate total width of all visible panels for normalization
|
|
29
|
-
const visiblePanels = layout.panels.filter((p) => p.visible)
|
|
30
|
-
const totalVisibleWidth = visiblePanels.reduce((sum, p) => sum + p.width, 0)
|
|
31
|
-
|
|
32
|
-
// Normalize width so visible panels fill 100% of available space
|
|
33
|
-
if (totalVisibleWidth === 0) return 0
|
|
34
|
-
const normalizedWidth = (panel.width / totalVisibleWidth) * 100
|
|
35
|
-
return Math.floor((total * normalizedWidth) / 100)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const getPanelContent = (type: PanelType) => {
|
|
39
|
-
switch (type) {
|
|
40
|
-
case "chat":
|
|
41
|
-
return props.chat
|
|
42
|
-
case "explorer":
|
|
43
|
-
return props.explorer
|
|
44
|
-
case "viewer":
|
|
45
|
-
return props.viewer
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const safeDimensions = createMemo(() => {
|
|
50
|
-
const dims = dimensions()
|
|
51
|
-
return {
|
|
52
|
-
width: dims?.width ?? 80,
|
|
53
|
-
height: dims?.height ?? 24,
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<box width={safeDimensions().width} height={safeDimensions().height} flexDirection="row">
|
|
59
|
-
<For each={[0, 1, 2]}>
|
|
60
|
-
{(position) => {
|
|
61
|
-
const panel = createMemo(() => layout.getPanelAt(position as PanelPosition))
|
|
62
|
-
const width = createMemo(() => getPanelWidth(position as PanelPosition))
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<>
|
|
66
|
-
{/* Thin border between panels using line character */}
|
|
67
|
-
<Show
|
|
68
|
-
when={position > 0 && layout.getPanelAt((position - 1) as PanelPosition)?.visible && panel()?.visible}
|
|
69
|
-
>
|
|
70
|
-
<box width={1} height="100%">
|
|
71
|
-
<text fg={theme.border}>{"│\n".repeat(safeDimensions().height)}</text>
|
|
72
|
-
</box>
|
|
73
|
-
</Show>
|
|
74
|
-
|
|
75
|
-
<Show when={panel()?.visible}>
|
|
76
|
-
<box width={width()} height="100%">
|
|
77
|
-
{getPanelContent(panel()!.type)}
|
|
78
|
-
</box>
|
|
79
|
-
</Show>
|
|
80
|
-
</>
|
|
81
|
-
)
|
|
82
|
-
}}
|
|
83
|
-
</For>
|
|
84
|
-
</box>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { useRenderer, useTerminalDimensions } from "@opentui/solid"
|
|
2
|
-
import { RGBA, type Renderable, ScrollBoxRenderable } from "@opentui/core"
|
|
3
|
-
import { createEffect, createMemo, Show, createSignal } from "solid-js"
|
|
4
|
-
import { useInspector } from "../context/inspector"
|
|
5
|
-
import { useTheme } from "../context/theme"
|
|
6
|
-
import { Clipboard } from "@tui/util/clipboard"
|
|
7
|
-
import { useToast } from "../ui/toast"
|
|
8
|
-
|
|
9
|
-
// Get absolute position
|
|
10
|
-
// renderable.x/y already recursively include all parent offsets and scroll translations
|
|
11
|
-
function getAbsolutePosition(renderable: Renderable): { x: number; y: number } {
|
|
12
|
-
return { x: renderable.x, y: renderable.y }
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Check if point is inside renderable bounds
|
|
16
|
-
function isPointInside(renderable: Renderable, px: number, py: number): boolean {
|
|
17
|
-
const pos = getAbsolutePosition(renderable)
|
|
18
|
-
return px >= pos.x && px < pos.x + renderable.width && py >= pos.y && py < pos.y + renderable.height
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Find the topmost element at position (excluding the overlay itself)
|
|
22
|
-
function findElementAtPositionTree(root: Renderable, x: number, y: number, excludeId?: string): Renderable | null {
|
|
23
|
-
let found: Renderable | null = null
|
|
24
|
-
let foundArea = Infinity
|
|
25
|
-
|
|
26
|
-
function traverse(renderable: Renderable) {
|
|
27
|
-
// Skip if this is the element to exclude
|
|
28
|
-
if (excludeId && renderable.id === excludeId) return
|
|
29
|
-
|
|
30
|
-
// Check if point is inside this renderable
|
|
31
|
-
if (isPointInside(renderable, x, y)) {
|
|
32
|
-
const area = renderable.width * renderable.height
|
|
33
|
-
// Prefer smaller elements (more specific)
|
|
34
|
-
if (area < foundArea) {
|
|
35
|
-
found = renderable
|
|
36
|
-
foundArea = area
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Check children (recurse into all children)
|
|
41
|
-
for (const child of renderable.getChildren()) {
|
|
42
|
-
traverse(child)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Start traversal from root's children (skip root itself)
|
|
47
|
-
for (const child of root.getChildren()) {
|
|
48
|
-
traverse(child)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return found
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Normalize margin/padding values to numbers
|
|
55
|
-
function normalizeSpacing(value: string | number | null | undefined): number {
|
|
56
|
-
if (typeof value === "number") return value
|
|
57
|
-
if (typeof value === "string" && value.endsWith("%")) return 0 // Can't easily calc %
|
|
58
|
-
if (value === "auto") return 0
|
|
59
|
-
return 0
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Build a path from root to this element for context
|
|
63
|
-
function getElementPath(renderable: Renderable): string {
|
|
64
|
-
const parts: string[] = []
|
|
65
|
-
let current: Renderable | null = renderable
|
|
66
|
-
|
|
67
|
-
while (current) {
|
|
68
|
-
// Skip auto-generated IDs, use type instead
|
|
69
|
-
const isAutoGen = /^box-\d+$|^text-\d+$/.test(current.id)
|
|
70
|
-
const name = isAutoGen ? current.constructor.name.replace("Renderable", "") : current.id
|
|
71
|
-
parts.unshift(name)
|
|
72
|
-
current = current.parent
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return parts.join(" > ")
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Get element info for display
|
|
79
|
-
function getElementInfo(renderable: Renderable) {
|
|
80
|
-
const pos = getAbsolutePosition(renderable)
|
|
81
|
-
const path = getElementPath(renderable)
|
|
82
|
-
|
|
83
|
-
// Try to find a meaningful name
|
|
84
|
-
const isAutoGen = /^box-\d+$|^text-\d+$/.test(renderable.id)
|
|
85
|
-
const displayName = isAutoGen ? path.split(" > ").pop() || renderable.id : renderable.id
|
|
86
|
-
|
|
87
|
-
// Get source location if available
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
|
-
const source = (
|
|
90
|
-
renderable as unknown as { __source?: { fileName?: string; lineNumber?: number; componentName?: string } }
|
|
91
|
-
).__source
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
id: renderable.id,
|
|
95
|
-
displayName,
|
|
96
|
-
path,
|
|
97
|
-
type: renderable.constructor.name,
|
|
98
|
-
x: pos.x,
|
|
99
|
-
y: pos.y,
|
|
100
|
-
width: renderable.width,
|
|
101
|
-
height: renderable.height,
|
|
102
|
-
source,
|
|
103
|
-
margin: {
|
|
104
|
-
top: normalizeSpacing(renderable.marginTop),
|
|
105
|
-
right: normalizeSpacing(renderable.marginRight),
|
|
106
|
-
bottom: normalizeSpacing(renderable.marginBottom),
|
|
107
|
-
left: normalizeSpacing(renderable.marginLeft),
|
|
108
|
-
},
|
|
109
|
-
padding: {
|
|
110
|
-
top: normalizeSpacing(renderable.paddingTop),
|
|
111
|
-
right: normalizeSpacing(renderable.paddingRight),
|
|
112
|
-
bottom: normalizeSpacing(renderable.paddingBottom),
|
|
113
|
-
left: normalizeSpacing(renderable.paddingLeft),
|
|
114
|
-
},
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function InspectorOverlay() {
|
|
119
|
-
const inspector = useInspector()
|
|
120
|
-
const { theme } = useTheme()
|
|
121
|
-
const dimensions = useTerminalDimensions()
|
|
122
|
-
const renderer = useRenderer()
|
|
123
|
-
const toast = useToast()
|
|
124
|
-
|
|
125
|
-
const [hoveredElement, setHoveredElement] = createSignal<Renderable | null>(null)
|
|
126
|
-
|
|
127
|
-
const isEnabled = () => inspector.enabled()
|
|
128
|
-
|
|
129
|
-
// Colors for different visual elements - more transparent
|
|
130
|
-
const colors = createMemo(() => ({
|
|
131
|
-
content: theme.primary,
|
|
132
|
-
padding: theme.warning,
|
|
133
|
-
margin: theme.info,
|
|
134
|
-
text: theme.text,
|
|
135
|
-
panelBg: RGBA.fromInts(30, 30, 30, 220), // 80% opacity dark background
|
|
136
|
-
overlayBg: RGBA.fromInts(0, 0, 0, 51), // 20% opacity = 80% transparent
|
|
137
|
-
border: theme.border,
|
|
138
|
-
marginBg: RGBA.fromInts(255, 140, 0, 25), // Orange - more transparent
|
|
139
|
-
paddingBg: RGBA.fromInts(255, 215, 0, 25), // Yellow - more transparent
|
|
140
|
-
contentBg: RGBA.fromInts(0, 255, 127, 15), // Green - more transparent
|
|
141
|
-
marginBorder: RGBA.fromInts(255, 140, 0, 120),
|
|
142
|
-
paddingBorder: RGBA.fromInts(255, 215, 0, 120),
|
|
143
|
-
contentBorder: RGBA.fromInts(0, 255, 127, 120),
|
|
144
|
-
}))
|
|
145
|
-
|
|
146
|
-
createEffect(() => {
|
|
147
|
-
if (!isEnabled()) {
|
|
148
|
-
inspector.setHoveredInfo(null)
|
|
149
|
-
setHoveredElement(null)
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
const mouse = () => inspector.mousePos()
|
|
154
|
-
const dims = () => dimensions()
|
|
155
|
-
|
|
156
|
-
// Find element under cursor (manually traverse to skip the overlay)
|
|
157
|
-
const findElementAtPosition = (x: number, y: number): Renderable | null => {
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
-
return findElementAtPositionTree(renderer.root as any, x, y, "inspector-overlay")
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Get element info for display
|
|
163
|
-
const elementInfo = createMemo(() => {
|
|
164
|
-
const el = hoveredElement()
|
|
165
|
-
if (!el) return null
|
|
166
|
-
return getElementInfo(el)
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
return (
|
|
170
|
-
<Show when={isEnabled()}>
|
|
171
|
-
<box
|
|
172
|
-
id="inspector-overlay"
|
|
173
|
-
position="absolute"
|
|
174
|
-
top={0}
|
|
175
|
-
left={0}
|
|
176
|
-
width={dims().width}
|
|
177
|
-
height={dims().height}
|
|
178
|
-
zIndex={9999}
|
|
179
|
-
backgroundColor={colors().overlayBg}
|
|
180
|
-
onMouseMove={(e) => {
|
|
181
|
-
inspector.setMousePos({ x: e.x, y: e.y })
|
|
182
|
-
const el = findElementAtPosition(e.x, e.y)
|
|
183
|
-
setHoveredElement(el)
|
|
184
|
-
}}
|
|
185
|
-
onMouseUp={async () => {
|
|
186
|
-
const el = hoveredElement()
|
|
187
|
-
if (el) {
|
|
188
|
-
const info = getElementInfo(el)
|
|
189
|
-
// Build source info string
|
|
190
|
-
const sourceInfo = info.source
|
|
191
|
-
? `${info.source.componentName || info.displayName} ${info.width}x${info.height} ${info.source.fileName}:${info.source.lineNumber}`
|
|
192
|
-
: `${info.displayName} ${info.width}x${info.height}`
|
|
193
|
-
await Clipboard.copy(sourceInfo)
|
|
194
|
-
.then(() => toast.show({ message: `Copied: ${info.displayName}`, variant: "info" }))
|
|
195
|
-
.catch(() => toast.show({ message: "Failed to copy", variant: "error" }))
|
|
196
|
-
}
|
|
197
|
-
inspector.setEnabled(false)
|
|
198
|
-
}}
|
|
199
|
-
>
|
|
200
|
-
{/* Element highlight - exact element bounds */}
|
|
201
|
-
<Show when={elementInfo()}>
|
|
202
|
-
{(info) => (
|
|
203
|
-
<box
|
|
204
|
-
position="absolute"
|
|
205
|
-
top={info().y}
|
|
206
|
-
left={info().x}
|
|
207
|
-
width={info().width}
|
|
208
|
-
height={info().height}
|
|
209
|
-
border={["left", "right", "top", "bottom"]}
|
|
210
|
-
borderColor={colors().contentBorder}
|
|
211
|
-
backgroundColor={colors().contentBg}
|
|
212
|
-
/>
|
|
213
|
-
)}
|
|
214
|
-
</Show>
|
|
215
|
-
|
|
216
|
-
{/* Position tooltip near cursor */}
|
|
217
|
-
<Show when={mouse().y > 4 && elementInfo()}>
|
|
218
|
-
{(info) => {
|
|
219
|
-
const source = info().source
|
|
220
|
-
const displayText = source
|
|
221
|
-
? `${source.componentName || info().displayName} ${info().width}x${info().height}`
|
|
222
|
-
: `${info().displayName} ${info().width}x${info().height}`
|
|
223
|
-
const sourceText = source ? `${source.fileName}:${source.lineNumber}` : ""
|
|
224
|
-
|
|
225
|
-
return (
|
|
226
|
-
<box
|
|
227
|
-
position="absolute"
|
|
228
|
-
top={mouse().y - 2}
|
|
229
|
-
left={Math.min(mouse().x + 2, dims().width - 20)}
|
|
230
|
-
paddingLeft={1}
|
|
231
|
-
paddingRight={1}
|
|
232
|
-
backgroundColor={theme.backgroundElement}
|
|
233
|
-
border={["left", "right", "top", "bottom"]}
|
|
234
|
-
borderColor={theme.border}
|
|
235
|
-
>
|
|
236
|
-
<text fg={theme.primary}>{displayText}</text>
|
|
237
|
-
<Show when={sourceText}>
|
|
238
|
-
<text fg={theme.textMuted}>{sourceText}</text>
|
|
239
|
-
</Show>
|
|
240
|
-
</box>
|
|
241
|
-
)
|
|
242
|
-
}}
|
|
243
|
-
</Show>
|
|
244
|
-
</box>
|
|
245
|
-
</Show>
|
|
246
|
-
)
|
|
247
|
-
}
|