@oh-my-pi/pi-coding-agent 8.1.0 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/docs/session.md +111 -46
- package/examples/custom-tools/hello/index.ts +1 -1
- package/examples/custom-tools/todo/index.ts +3 -4
- package/examples/extensions/api-demo.ts +0 -1
- package/examples/extensions/chalk-logger.ts +2 -3
- package/examples/extensions/hello.ts +0 -1
- package/examples/extensions/pirate.ts +0 -1
- package/examples/extensions/plan-mode.ts +15 -16
- package/examples/extensions/todo.ts +3 -4
- package/examples/extensions/tools.ts +1 -2
- package/examples/extensions/with-deps/index.ts +0 -1
- package/examples/hooks/auto-commit-on-exit.ts +1 -2
- package/examples/hooks/confirm-destructive.ts +0 -1
- package/examples/hooks/custom-compaction.ts +1 -2
- package/examples/hooks/dirty-repo-guard.ts +0 -1
- package/examples/hooks/file-trigger.ts +3 -4
- package/examples/hooks/git-checkpoint.ts +0 -1
- package/examples/hooks/handoff.ts +3 -4
- package/examples/hooks/permission-gate.ts +1 -2
- package/examples/hooks/protected-paths.ts +1 -2
- package/examples/hooks/qna.ts +2 -3
- package/examples/hooks/snake.ts +4 -5
- package/examples/hooks/status-line.ts +0 -1
- package/examples/sdk/01-minimal.ts +2 -3
- package/examples/sdk/02-custom-model.ts +2 -3
- package/examples/sdk/03-custom-prompt.ts +3 -4
- package/examples/sdk/04-skills.ts +2 -3
- package/examples/sdk/06-extensions.ts +1 -2
- package/examples/sdk/06-hooks.ts +6 -7
- package/examples/sdk/07-context-files.ts +0 -1
- package/examples/sdk/08-prompt-templates.ts +0 -1
- package/examples/sdk/08-slash-commands.ts +0 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +0 -1
- package/examples/sdk/10-settings.ts +0 -1
- package/examples/sdk/11-sessions.ts +0 -1
- package/package.json +51 -23
- package/scripts/format-prompts.ts +0 -1
- package/src/capability/context-file.ts +2 -3
- package/src/capability/extension-module.ts +2 -3
- package/src/capability/extension.ts +2 -3
- package/src/capability/fs.ts +20 -21
- package/src/capability/hook.ts +2 -3
- package/src/capability/index.ts +15 -16
- package/src/capability/instruction.ts +2 -3
- package/src/capability/mcp.ts +2 -3
- package/src/capability/prompt.ts +2 -3
- package/src/capability/rule.ts +2 -3
- package/src/capability/settings.ts +1 -2
- package/src/capability/skill.ts +2 -3
- package/src/capability/slash-command.ts +2 -3
- package/src/capability/ssh.ts +2 -3
- package/src/capability/system-prompt.ts +2 -3
- package/src/capability/tool.ts +2 -3
- package/src/cli/args.ts +5 -6
- package/src/cli/config-cli.ts +6 -7
- package/src/cli/file-processor.ts +19 -17
- package/src/cli/jupyter-cli.ts +105 -0
- package/src/cli/list-models.ts +10 -11
- package/src/cli/plugin-cli.ts +20 -21
- package/src/cli/session-picker.ts +2 -3
- package/src/cli/setup-cli.ts +2 -3
- package/src/cli/stats-cli.ts +2 -3
- package/src/cli/update-cli.ts +25 -22
- package/src/commit/agentic/agent.ts +21 -23
- package/src/commit/agentic/fallback.ts +9 -9
- package/src/commit/agentic/index.ts +30 -38
- package/src/commit/agentic/state.ts +1 -6
- package/src/commit/agentic/tools/analyze-file.ts +15 -15
- package/src/commit/agentic/tools/git-file-diff.ts +3 -3
- package/src/commit/agentic/tools/git-hunk.ts +7 -7
- package/src/commit/agentic/tools/git-overview.ts +5 -5
- package/src/commit/agentic/tools/index.ts +14 -14
- package/src/commit/agentic/tools/propose-changelog.ts +6 -6
- package/src/commit/agentic/tools/propose-commit.ts +8 -8
- package/src/commit/agentic/tools/recent-commits.ts +2 -2
- package/src/commit/agentic/tools/split-commit.ts +19 -23
- package/src/commit/agentic/topo-sort.ts +1 -1
- package/src/commit/agentic/trivial.ts +3 -3
- package/src/commit/agentic/validation.ts +12 -12
- package/src/commit/analysis/conventional.ts +7 -11
- package/src/commit/analysis/index.ts +4 -4
- package/src/commit/analysis/scope.ts +4 -4
- package/src/commit/analysis/summary.ts +7 -9
- package/src/commit/analysis/validation.ts +1 -1
- package/src/commit/changelog/detect.ts +6 -6
- package/src/commit/changelog/generate.ts +7 -9
- package/src/commit/changelog/index.ts +13 -13
- package/src/commit/changelog/parse.ts +2 -2
- package/src/commit/cli.ts +1 -1
- package/src/commit/git/diff.ts +3 -3
- package/src/commit/git/index.ts +19 -24
- package/src/commit/index.ts +1 -1
- package/src/commit/map-reduce/index.ts +9 -9
- package/src/commit/map-reduce/map-phase.ts +19 -34
- package/src/commit/map-reduce/reduce-phase.ts +9 -11
- package/src/commit/message.ts +2 -2
- package/src/commit/model-selection.ts +3 -7
- package/src/commit/pipeline.ts +20 -22
- package/src/commit/utils/exclusions.ts +3 -3
- package/src/config/file-lock.ts +17 -7
- package/src/config/keybindings.ts +6 -8
- package/src/config/model-registry.ts +55 -37
- package/src/config/model-resolver.ts +18 -19
- package/src/config/prompt-templates.ts +11 -11
- package/src/config/settings-manager.ts +50 -34
- package/src/config.ts +60 -62
- package/src/cursor.ts +11 -9
- package/src/discovery/agents-md.ts +11 -12
- package/src/discovery/builtin.ts +68 -73
- package/src/discovery/claude.ts +41 -42
- package/src/discovery/cline.ts +11 -12
- package/src/discovery/codex.ts +52 -53
- package/src/discovery/cursor.ts +9 -10
- package/src/discovery/gemini.ts +17 -22
- package/src/discovery/github.ts +13 -14
- package/src/discovery/helpers.ts +35 -34
- package/src/discovery/index.ts +16 -18
- package/src/discovery/mcp-json.ts +8 -9
- package/src/discovery/ssh.ts +8 -9
- package/src/discovery/vscode.ts +4 -5
- package/src/discovery/windsurf.ts +6 -7
- package/src/exa/company.ts +1 -2
- package/src/exa/index.ts +2 -3
- package/src/exa/linkedin.ts +1 -2
- package/src/exa/mcp-client.ts +14 -16
- package/src/exa/render.ts +10 -11
- package/src/exa/researcher.ts +1 -2
- package/src/exa/search.ts +1 -2
- package/src/exa/types.ts +0 -1
- package/src/exa/websets.ts +1 -2
- package/src/exec/bash-executor.ts +3 -4
- package/src/exec/exec.ts +0 -1
- package/src/export/custom-share.ts +5 -6
- package/src/export/html/index.ts +24 -21
- package/src/export/ttsr.ts +2 -3
- package/src/extensibility/custom-commands/bundled/review/index.ts +7 -8
- package/src/extensibility/custom-commands/loader.ts +17 -14
- package/src/extensibility/custom-commands/types.ts +1 -2
- package/src/extensibility/custom-tools/loader.ts +10 -11
- package/src/extensibility/custom-tools/types.ts +6 -7
- package/src/extensibility/custom-tools/wrapper.ts +2 -3
- package/src/extensibility/extensions/loader.ts +75 -53
- package/src/extensibility/extensions/runner.ts +11 -12
- package/src/extensibility/extensions/types.ts +19 -26
- package/src/extensibility/extensions/wrapper.ts +3 -4
- package/src/extensibility/hooks/index.ts +1 -1
- package/src/extensibility/hooks/loader.ts +8 -9
- package/src/extensibility/hooks/runner.ts +7 -8
- package/src/extensibility/hooks/tool-wrapper.ts +0 -1
- package/src/extensibility/hooks/types.ts +10 -17
- package/src/extensibility/plugins/doctor.ts +3 -3
- package/src/extensibility/plugins/installer.ts +27 -27
- package/src/extensibility/plugins/loader.ts +59 -56
- package/src/extensibility/plugins/manager.ts +211 -171
- package/src/extensibility/plugins/parser.ts +1 -1
- package/src/extensibility/plugins/paths.ts +8 -8
- package/src/extensibility/skills.ts +63 -60
- package/src/extensibility/slash-commands.ts +10 -10
- package/src/index.ts +46 -46
- package/src/internal-urls/agent-protocol.ts +21 -11
- package/src/internal-urls/artifact-protocol.ts +17 -13
- package/src/internal-urls/router.ts +1 -2
- package/src/internal-urls/rule-protocol.ts +3 -4
- package/src/internal-urls/skill-protocol.ts +3 -4
- package/src/ipy/executor.ts +14 -10
- package/src/ipy/gateway-coordinator.ts +79 -90
- package/src/ipy/kernel.ts +32 -30
- package/src/ipy/modules.ts +13 -13
- package/src/lsp/client.ts +21 -10
- package/src/lsp/clients/biome-client.ts +1 -2
- package/src/lsp/clients/index.ts +3 -3
- package/src/lsp/clients/lsp-linter-client.ts +4 -5
- package/src/lsp/config.ts +15 -15
- package/src/lsp/edits.ts +4 -5
- package/src/lsp/index.ts +43 -44
- package/src/lsp/lspmux.ts +8 -8
- package/src/lsp/render.ts +10 -16
- package/src/lsp/utils.ts +3 -3
- package/src/main.ts +55 -34
- package/src/mcp/client.ts +2 -3
- package/src/mcp/config.ts +5 -6
- package/src/mcp/json-rpc.ts +0 -1
- package/src/mcp/loader.ts +3 -4
- package/src/mcp/manager.ts +17 -18
- package/src/mcp/tool-bridge.ts +4 -9
- package/src/mcp/tool-cache.ts +2 -3
- package/src/mcp/transports/http.ts +2 -4
- package/src/mcp/transports/stdio.ts +1 -2
- package/src/migrations.ts +60 -49
- package/src/modes/components/armin.ts +4 -5
- package/src/modes/components/assistant-message.ts +6 -6
- package/src/modes/components/bash-execution.ts +7 -8
- package/src/modes/components/bordered-loader.ts +3 -3
- package/src/modes/components/branch-summary-message.ts +3 -3
- package/src/modes/components/compaction-summary-message.ts +3 -3
- package/src/modes/components/countdown-timer.ts +0 -1
- package/src/modes/components/custom-message.ts +5 -5
- package/src/modes/components/diff.ts +1 -1
- package/src/modes/components/dynamic-border.ts +2 -2
- package/src/modes/components/extensions/extension-dashboard.ts +6 -7
- package/src/modes/components/extensions/extension-list.ts +2 -3
- package/src/modes/components/extensions/inspector-panel.ts +3 -4
- package/src/modes/components/extensions/state-manager.ts +25 -26
- package/src/modes/components/extensions/types.ts +1 -2
- package/src/modes/components/footer.ts +47 -43
- package/src/modes/components/history-search.ts +2 -2
- package/src/modes/components/hook-editor.ts +3 -4
- package/src/modes/components/hook-input.ts +2 -3
- package/src/modes/components/hook-message.ts +5 -5
- package/src/modes/components/hook-selector.ts +2 -3
- package/src/modes/components/keybinding-hints.ts +2 -3
- package/src/modes/components/login-dialog.ts +2 -2
- package/src/modes/components/model-selector.ts +12 -12
- package/src/modes/components/oauth-selector.ts +2 -2
- package/src/modes/components/plugin-settings.ts +20 -20
- package/src/modes/components/python-execution.ts +7 -8
- package/src/modes/components/queue-mode-selector.ts +3 -3
- package/src/modes/components/read-tool-group.ts +2 -2
- package/src/modes/components/session-selector.ts +4 -4
- package/src/modes/components/settings-defs.ts +77 -69
- package/src/modes/components/settings-selector.ts +16 -16
- package/src/modes/components/show-images-selector.ts +2 -2
- package/src/modes/components/status-line/segments.ts +4 -4
- package/src/modes/components/status-line/separators.ts +1 -1
- package/src/modes/components/status-line/types.ts +2 -2
- package/src/modes/components/status-line-segment-editor.ts +7 -8
- package/src/modes/components/status-line.ts +12 -12
- package/src/modes/components/theme-selector.ts +8 -7
- package/src/modes/components/thinking-selector.ts +4 -4
- package/src/modes/components/todo-display.ts +2 -2
- package/src/modes/components/todo-reminder.ts +4 -4
- package/src/modes/components/tool-execution.ts +11 -16
- package/src/modes/components/tree-selector.ts +11 -11
- package/src/modes/components/ttsr-notification.ts +5 -5
- package/src/modes/components/user-message-selector.ts +1 -1
- package/src/modes/components/user-message.ts +1 -1
- package/src/modes/components/visual-truncate.ts +0 -1
- package/src/modes/components/welcome.ts +4 -4
- package/src/modes/controllers/command-controller.ts +46 -47
- package/src/modes/controllers/event-controller.ts +16 -20
- package/src/modes/controllers/extension-ui-controller.ts +40 -46
- package/src/modes/controllers/input-controller.ts +17 -18
- package/src/modes/controllers/selector-controller.ts +103 -91
- package/src/modes/index.ts +3 -3
- package/src/modes/interactive-mode.ts +27 -29
- package/src/modes/print-mode.ts +12 -13
- package/src/modes/rpc/rpc-client.ts +7 -8
- package/src/modes/rpc/rpc-mode.ts +24 -25
- package/src/modes/rpc/rpc-types.ts +3 -4
- package/src/modes/theme/mermaid-cache.ts +2 -2
- package/src/modes/theme/theme.ts +128 -53
- package/src/modes/types.ts +10 -10
- package/src/modes/utils/ui-helpers.ts +17 -17
- package/src/patch/applicator.ts +18 -19
- package/src/patch/diff.ts +1 -2
- package/src/patch/fuzzy.ts +1 -2
- package/src/patch/index.ts +10 -11
- package/src/patch/normalize.ts +4 -4
- package/src/patch/normative.ts +1 -2
- package/src/patch/parser.ts +8 -9
- package/src/patch/shared.ts +12 -13
- package/src/sdk.ts +60 -63
- package/src/session/agent-session.ts +83 -84
- package/src/session/agent-storage.ts +11 -11
- package/src/session/artifacts.ts +8 -9
- package/src/session/auth-storage.ts +25 -29
- package/src/session/compaction/branch-summarization.ts +7 -10
- package/src/session/compaction/compaction.ts +8 -19
- package/src/session/compaction/utils.ts +6 -9
- package/src/session/history-storage.ts +10 -10
- package/src/session/messages.ts +4 -5
- package/src/session/session-manager.ts +76 -65
- package/src/session/session-storage.ts +57 -69
- package/src/session/storage-migration.ts +2 -3
- package/src/session/streaming-output.ts +2 -2
- package/src/ssh/connection-manager.ts +43 -50
- package/src/ssh/ssh-executor.ts +2 -2
- package/src/ssh/sshfs-mount.ts +11 -18
- package/src/system-prompt.ts +27 -34
- package/src/task/agents.ts +45 -30
- package/src/task/commands.ts +6 -7
- package/src/task/discovery.ts +39 -76
- package/src/task/executor.ts +14 -15
- package/src/task/index.ts +33 -36
- package/src/task/output-manager.ts +3 -4
- package/src/task/parallel.ts +0 -1
- package/src/task/render.ts +19 -20
- package/src/task/subprocess-tool-registry.ts +1 -2
- package/src/task/worker-protocol.ts +3 -3
- package/src/task/worker.ts +32 -38
- package/src/task/worktree.ts +19 -19
- package/src/tools/ask.ts +8 -9
- package/src/tools/bash-interceptor.ts +1 -5
- package/src/tools/bash.ts +19 -18
- package/src/tools/calculator.ts +12 -12
- package/src/tools/complete.ts +3 -4
- package/src/tools/context.ts +2 -2
- package/src/tools/fetch.ts +23 -26
- package/src/tools/find.ts +15 -16
- package/src/tools/gemini-image.ts +14 -14
- package/src/tools/grep.ts +27 -27
- package/src/tools/index.ts +78 -56
- package/src/tools/list-limit.ts +1 -1
- package/src/tools/ls.ts +7 -7
- package/src/tools/notebook.ts +5 -5
- package/src/tools/output-meta.ts +3 -4
- package/src/tools/output-utils.ts +1 -1
- package/src/tools/path-utils.ts +5 -5
- package/src/tools/python.ts +36 -37
- package/src/tools/read.ts +23 -23
- package/src/tools/render-utils.ts +8 -9
- package/src/tools/renderers.ts +6 -7
- package/src/tools/review.ts +8 -11
- package/src/tools/ssh.ts +31 -30
- package/src/tools/todo-write.ts +13 -13
- package/src/tools/tool-errors.ts +3 -3
- package/src/tools/tool-result.ts +3 -8
- package/src/tools/write.ts +11 -16
- package/src/tui/code-cell.ts +3 -9
- package/src/tui/file-list.ts +3 -4
- package/src/tui/output-block.ts +1 -2
- package/src/tui/status-line.ts +2 -3
- package/src/tui/tree-list.ts +2 -3
- package/src/tui/types.ts +1 -2
- package/src/tui/utils.ts +2 -3
- package/src/utils/changelog.ts +9 -10
- package/src/utils/clipboard.ts +11 -11
- package/src/utils/file-mentions.ts +4 -10
- package/src/utils/frontmatter.ts +6 -3
- package/src/utils/fuzzy.ts +2 -2
- package/src/utils/image-convert.ts +1 -1
- package/src/utils/image-resize.ts +1 -1
- package/src/utils/mime.ts +2 -2
- package/src/utils/shell-snapshot.ts +11 -13
- package/src/utils/shell.ts +4 -5
- package/src/utils/title-generator.ts +8 -9
- package/src/utils/tools-manager.ts +23 -23
- package/src/vendor/photon/index.js +1099 -1059
- package/src/vendor/photon/photon_rs_bg.wasm +0 -0
- package/src/web/scrapers/artifacthub.ts +1 -1
- package/src/web/scrapers/arxiv.ts +2 -2
- package/src/web/scrapers/bluesky.ts +2 -2
- package/src/web/scrapers/cheatsh.ts +1 -1
- package/src/web/scrapers/chocolatey.ts +2 -2
- package/src/web/scrapers/choosealicense.ts +5 -5
- package/src/web/scrapers/cisa-kev.ts +1 -1
- package/src/web/scrapers/crossref.ts +2 -2
- package/src/web/scrapers/devto.ts +3 -3
- package/src/web/scrapers/discogs.ts +3 -4
- package/src/web/scrapers/discourse.ts +1 -1
- package/src/web/scrapers/dockerhub.ts +1 -1
- package/src/web/scrapers/fdroid.ts +2 -2
- package/src/web/scrapers/firefox-addons.ts +3 -3
- package/src/web/scrapers/flathub.ts +1 -1
- package/src/web/scrapers/github.ts +3 -3
- package/src/web/scrapers/gitlab.ts +4 -4
- package/src/web/scrapers/hackernews.ts +2 -2
- package/src/web/scrapers/huggingface.ts +1 -1
- package/src/web/scrapers/iacr.ts +2 -2
- package/src/web/scrapers/index.ts +0 -1
- package/src/web/scrapers/jetbrains-marketplace.ts +1 -1
- package/src/web/scrapers/lemmy.ts +2 -2
- package/src/web/scrapers/maven.ts +2 -2
- package/src/web/scrapers/mdn.ts +2 -4
- package/src/web/scrapers/metacpan.ts +2 -2
- package/src/web/scrapers/musicbrainz.ts +1 -2
- package/src/web/scrapers/npm.ts +1 -1
- package/src/web/scrapers/nuget.ts +2 -2
- package/src/web/scrapers/nvd.ts +3 -3
- package/src/web/scrapers/ollama.ts +7 -9
- package/src/web/scrapers/opencorporates.ts +2 -2
- package/src/web/scrapers/openlibrary.ts +6 -6
- package/src/web/scrapers/orcid.ts +0 -1
- package/src/web/scrapers/osv.ts +2 -2
- package/src/web/scrapers/packagist.ts +1 -1
- package/src/web/scrapers/pubmed.ts +1 -2
- package/src/web/scrapers/rawg.ts +2 -2
- package/src/web/scrapers/readthedocs.ts +1 -2
- package/src/web/scrapers/repology.ts +2 -2
- package/src/web/scrapers/rfc.ts +1 -1
- package/src/web/scrapers/searchcode.ts +2 -2
- package/src/web/scrapers/semantic-scholar.ts +1 -1
- package/src/web/scrapers/snapcraft.ts +2 -2
- package/src/web/scrapers/sourcegraph.ts +1 -1
- package/src/web/scrapers/spdx.ts +3 -3
- package/src/web/scrapers/spotify.ts +0 -1
- package/src/web/scrapers/twitter.ts +1 -1
- package/src/web/scrapers/types.ts +1 -2
- package/src/web/scrapers/utils.ts +5 -5
- package/src/web/scrapers/wikidata.ts +3 -3
- package/src/web/scrapers/youtube.ts +9 -14
- package/src/web/search/auth.ts +4 -9
- package/src/web/search/index.ts +11 -21
- package/src/web/search/providers/anthropic.ts +3 -9
- package/src/web/search/providers/exa.ts +6 -10
- package/src/web/search/providers/perplexity.ts +5 -5
- package/src/web/search/render.ts +16 -18
- package/scripts/generate-wasm-b64.ts +0 -24
- package/src/commit/map-reduce/.map-phase.ts.kate-swp +0 -0
- package/src/task/.executor.ts.kate-swp +0 -0
- package/src/vendor/photon/photon_rs_bg.wasm.b64.js +0 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
2
|
-
import type { SettingsManager, StatusLineSettings } from "@oh-my-pi/pi-coding-agent/config/settings-manager";
|
|
3
|
-
import { getSelectListTheme, getSettingsListTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
4
2
|
import {
|
|
5
3
|
Container,
|
|
6
4
|
matchesKey,
|
|
@@ -14,6 +12,8 @@ import {
|
|
|
14
12
|
type TabBarTheme,
|
|
15
13
|
Text,
|
|
16
14
|
} from "@oh-my-pi/pi-tui";
|
|
15
|
+
import type { SettingsManager, StatusLineSettings } from "../../config/settings-manager";
|
|
16
|
+
import { getSelectListTheme, getSettingsListTheme, theme } from "../../modes/theme/theme";
|
|
17
17
|
import { DynamicBorder } from "./dynamic-border";
|
|
18
18
|
import { PluginSettingsComponent } from "./plugin-settings";
|
|
19
19
|
import { getSettingsForTab, type SettingDef } from "./settings-defs";
|
|
@@ -22,10 +22,10 @@ import { StatusLineSegmentEditorComponent } from "./status-line-segment-editor";
|
|
|
22
22
|
|
|
23
23
|
function getTabBarTheme(): TabBarTheme {
|
|
24
24
|
return {
|
|
25
|
-
label:
|
|
26
|
-
activeTab:
|
|
27
|
-
inactiveTab:
|
|
28
|
-
hint:
|
|
25
|
+
label: text => theme.bold(theme.fg("accent", text)),
|
|
26
|
+
activeTab: text => theme.bold(theme.bg("selectedBg", theme.fg("text", text))),
|
|
27
|
+
inactiveTab: text => theme.fg("muted", text),
|
|
28
|
+
hint: text => theme.fg("dim", text),
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -74,19 +74,19 @@ class SelectSubmenu extends Container {
|
|
|
74
74
|
this.selectList = new SelectList(options, Math.min(options.length, 10), getSelectListTheme());
|
|
75
75
|
|
|
76
76
|
// Pre-select current value
|
|
77
|
-
const currentIndex = options.findIndex(
|
|
77
|
+
const currentIndex = options.findIndex(o => o.value === currentValue);
|
|
78
78
|
if (currentIndex !== -1) {
|
|
79
79
|
this.selectList.setSelectedIndex(currentIndex);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
this.selectList.onSelect =
|
|
82
|
+
this.selectList.onSelect = item => {
|
|
83
83
|
onSelect(item.value);
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
this.selectList.onCancel = onCancel;
|
|
87
87
|
|
|
88
88
|
if (onSelectionChange) {
|
|
89
|
-
this.selectList.onSelectionChange =
|
|
89
|
+
this.selectList.onSelectionChange = item => {
|
|
90
90
|
onSelectionChange(item.value);
|
|
91
91
|
// Update preview after the preview callback has applied changes
|
|
92
92
|
this.updatePreview();
|
|
@@ -307,12 +307,12 @@ export class SettingsSelectorComponent extends Container {
|
|
|
307
307
|
|
|
308
308
|
// Special case: inject runtime options
|
|
309
309
|
if (def.id === "thinkingLevel") {
|
|
310
|
-
options = this.context.availableThinkingLevels.map(
|
|
311
|
-
const baseOpt = def.getOptions(this.settingsManager).find(
|
|
310
|
+
options = this.context.availableThinkingLevels.map(level => {
|
|
311
|
+
const baseOpt = def.getOptions(this.settingsManager).find(o => o.value === level);
|
|
312
312
|
return baseOpt || { value: level, label: level };
|
|
313
313
|
});
|
|
314
314
|
} else if (def.id === "theme") {
|
|
315
|
-
options = this.context.availableThemes.map(
|
|
315
|
+
options = this.context.availableThemes.map(t => ({ value: t, label: t }));
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
// Preview handlers
|
|
@@ -323,7 +323,7 @@ export class SettingsSelectorComponent extends Container {
|
|
|
323
323
|
onPreview = this.callbacks.onThemePreview;
|
|
324
324
|
onPreviewCancel = () => this.callbacks.onThemePreview?.(currentValue);
|
|
325
325
|
} else if (def.id === "statusLinePreset") {
|
|
326
|
-
onPreview =
|
|
326
|
+
onPreview = value => {
|
|
327
327
|
const presetDef = getPreset((value as StatusLineSettings["preset"]) ?? "default");
|
|
328
328
|
this.callbacks.onStatusLinePreview?.({
|
|
329
329
|
preset: value as StatusLineSettings["preset"],
|
|
@@ -345,7 +345,7 @@ export class SettingsSelectorComponent extends Container {
|
|
|
345
345
|
this.updateStatusPreview();
|
|
346
346
|
};
|
|
347
347
|
} else if (def.id === "statusLineSeparator") {
|
|
348
|
-
onPreview =
|
|
348
|
+
onPreview = value => {
|
|
349
349
|
this.callbacks.onStatusLinePreview?.({
|
|
350
350
|
separator: value as StatusLineSettings["separator"],
|
|
351
351
|
});
|
|
@@ -370,7 +370,7 @@ export class SettingsSelectorComponent extends Container {
|
|
|
370
370
|
def.description,
|
|
371
371
|
options,
|
|
372
372
|
currentValue,
|
|
373
|
-
|
|
373
|
+
value => {
|
|
374
374
|
// Persist to SettingsManager
|
|
375
375
|
def.set(this.settingsManager, value);
|
|
376
376
|
// Notify for side effects
|
|
@@ -454,7 +454,7 @@ export class SettingsSelectorComponent extends Container {
|
|
|
454
454
|
10,
|
|
455
455
|
getSettingsListTheme(),
|
|
456
456
|
(id, newValue) => {
|
|
457
|
-
const def = defs.find(
|
|
457
|
+
const def = defs.find(d => d.id === id);
|
|
458
458
|
if (!def) return;
|
|
459
459
|
|
|
460
460
|
// Persist to SettingsManager based on type
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getSelectListTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
2
1
|
import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui";
|
|
2
|
+
import { getSelectListTheme } from "../../modes/theme/theme";
|
|
3
3
|
import { DynamicBorder } from "./dynamic-border";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -25,7 +25,7 @@ export class ShowImagesSelectorComponent extends Container {
|
|
|
25
25
|
// Preselect current value
|
|
26
26
|
this.selectList.setSelectedIndex(currentValue ? 0 : 1);
|
|
27
27
|
|
|
28
|
-
this.selectList.onSelect =
|
|
28
|
+
this.selectList.onSelect = item => {
|
|
29
29
|
onSelect(item.value === "yes");
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { theme } from "
|
|
3
|
-
import { shortenPath } from "
|
|
1
|
+
import * as os from "node:os";
|
|
2
|
+
import { theme } from "../../../modes/theme/theme";
|
|
3
|
+
import { shortenPath } from "../../../tools/render-utils";
|
|
4
4
|
import type { RenderedSegment, SegmentContext, StatusLineSegment, StatusLineSegmentId } from "./types";
|
|
5
5
|
|
|
6
6
|
export type { SegmentContext } from "./types";
|
|
@@ -286,7 +286,7 @@ const sessionSegment: StatusLineSegment = {
|
|
|
286
286
|
const hostnameSegment: StatusLineSegment = {
|
|
287
287
|
id: "hostname",
|
|
288
288
|
render(_ctx) {
|
|
289
|
-
const name =
|
|
289
|
+
const name = os.hostname().split(".")[0];
|
|
290
290
|
return { content: withIcon(theme.icon.host, name), visible: true };
|
|
291
291
|
},
|
|
292
292
|
};
|
|
@@ -4,8 +4,8 @@ import type {
|
|
|
4
4
|
StatusLineSegmentOptions,
|
|
5
5
|
StatusLineSeparatorStyle,
|
|
6
6
|
StatusLineSettings,
|
|
7
|
-
} from "
|
|
8
|
-
import type { AgentSession } from "
|
|
7
|
+
} from "../../../config/settings-manager";
|
|
8
|
+
import type { AgentSession } from "../../../session/agent-session";
|
|
9
9
|
|
|
10
10
|
// Re-export types from settings-manager (single source of truth)
|
|
11
11
|
export type {
|
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
* - Shift+J/K: Reorder segment within column
|
|
9
9
|
* - Live preview shown in the actual status line above
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
import type { StatusLineSegmentId } from "@oh-my-pi/pi-coding-agent/config/settings-manager";
|
|
13
|
-
import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
14
11
|
import { Container, matchesKey } from "@oh-my-pi/pi-tui";
|
|
12
|
+
import type { StatusLineSegmentId } from "../../config/settings-manager";
|
|
13
|
+
import { theme } from "../../modes/theme/theme";
|
|
15
14
|
import { ALL_SEGMENT_IDS } from "./status-line/segments";
|
|
16
15
|
|
|
17
16
|
// Segment display names and short descriptions
|
|
@@ -93,7 +92,7 @@ export class StatusLineSegmentEditorComponent extends Container {
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
private getSegmentsForColumn(column: Column): SegmentState[] {
|
|
96
|
-
return this.segments.filter(
|
|
95
|
+
return this.segments.filter(s => s.column === column).sort((a, b) => a.order - b.order);
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
private getCurrentColumnSegments(): SegmentState[] {
|
|
@@ -101,8 +100,8 @@ export class StatusLineSegmentEditorComponent extends Container {
|
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
private triggerPreview(): void {
|
|
104
|
-
const left = this.getSegmentsForColumn("left").map(
|
|
105
|
-
const right = this.getSegmentsForColumn("right").map(
|
|
103
|
+
const left = this.getSegmentsForColumn("left").map(s => s.id);
|
|
104
|
+
const right = this.getSegmentsForColumn("right").map(s => s.id);
|
|
106
105
|
this.callbacks.onPreview?.(left, right);
|
|
107
106
|
}
|
|
108
107
|
|
|
@@ -236,8 +235,8 @@ export class StatusLineSegmentEditorComponent extends Container {
|
|
|
236
235
|
this.triggerPreview();
|
|
237
236
|
}
|
|
238
237
|
} else if (matchesKey(data, "enter") || matchesKey(data, "return") || data === "\n") {
|
|
239
|
-
const left = this.getSegmentsForColumn("left").map(
|
|
240
|
-
const right = this.getSegmentsForColumn("right").map(
|
|
238
|
+
const left = this.getSegmentsForColumn("left").map(s => s.id);
|
|
239
|
+
const right = this.getSegmentsForColumn("right").map(s => s.id);
|
|
241
240
|
this.callbacks.onSave(left, right);
|
|
242
241
|
} else if (matchesKey(data, "escape") || matchesKey(data, "esc")) {
|
|
243
242
|
this.callbacks.onCancel();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
1
3
|
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
|
2
|
-
import type { StatusLineSegmentOptions, StatusLineSettings } from "@oh-my-pi/pi-coding-agent/config/settings-manager";
|
|
3
|
-
import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
4
|
-
import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session";
|
|
5
4
|
import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui";
|
|
6
5
|
import { $ } from "bun";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import type { StatusLineSegmentOptions, StatusLineSettings } from "../../config/settings-manager";
|
|
7
|
+
import { theme } from "../../modes/theme/theme";
|
|
8
|
+
import type { AgentSession } from "../../session/agent-session";
|
|
9
9
|
import { getPreset } from "./status-line/presets";
|
|
10
10
|
import { renderSegment, type SegmentContext } from "./status-line/segments";
|
|
11
11
|
import { getSeparator } from "./status-line/separators";
|
|
@@ -26,11 +26,11 @@ function sanitizeStatusText(text: string): string {
|
|
|
26
26
|
async function findGitHeadPath(): Promise<string | null> {
|
|
27
27
|
let dir = process.cwd();
|
|
28
28
|
while (true) {
|
|
29
|
-
const gitHeadPath = join(dir, ".git", "HEAD");
|
|
29
|
+
const gitHeadPath = path.join(dir, ".git", "HEAD");
|
|
30
30
|
if (await Bun.file(gitHeadPath).exists()) {
|
|
31
31
|
return gitHeadPath;
|
|
32
32
|
}
|
|
33
|
-
const parent = dirname(dir);
|
|
33
|
+
const parent = path.dirname(dir);
|
|
34
34
|
if (parent === dir) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
@@ -46,7 +46,7 @@ export class StatusLineComponent implements Component {
|
|
|
46
46
|
private session: AgentSession;
|
|
47
47
|
private settings: StatusLineSettings = {};
|
|
48
48
|
private cachedBranch: string | null | undefined = undefined;
|
|
49
|
-
private gitWatcher: FSWatcher | null = null;
|
|
49
|
+
private gitWatcher: fs.FSWatcher | null = null;
|
|
50
50
|
private onBranchChange: (() => void) | null = null;
|
|
51
51
|
private autoCompactEnabled: boolean = true;
|
|
52
52
|
private hookStatuses: Map<string, string> = new Map();
|
|
@@ -98,11 +98,11 @@ export class StatusLineComponent implements Component {
|
|
|
98
98
|
this.gitWatcher = null;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
findGitHeadPath().then(
|
|
101
|
+
findGitHeadPath().then(gitHeadPath => {
|
|
102
102
|
if (!gitHeadPath) return;
|
|
103
103
|
|
|
104
104
|
try {
|
|
105
|
-
this.gitWatcher = watch(gitHeadPath, () => {
|
|
105
|
+
this.gitWatcher = fs.watch(gitHeadPath, () => {
|
|
106
106
|
this.cachedBranch = undefined;
|
|
107
107
|
if (this.onBranchChange) {
|
|
108
108
|
this.onBranchChange();
|
|
@@ -132,7 +132,7 @@ export class StatusLineComponent implements Component {
|
|
|
132
132
|
|
|
133
133
|
// Note: synchronous call to async function - will return undefined on first call
|
|
134
134
|
// This is acceptable since it's a cached value that will update on next render
|
|
135
|
-
findGitHeadPath().then(async
|
|
135
|
+
findGitHeadPath().then(async gitHeadPath => {
|
|
136
136
|
if (!gitHeadPath) {
|
|
137
137
|
this.cachedBranch = null;
|
|
138
138
|
return;
|
|
@@ -222,7 +222,7 @@ export class StatusLineComponent implements Component {
|
|
|
222
222
|
const lastAssistantMessage = state.messages
|
|
223
223
|
.slice()
|
|
224
224
|
.reverse()
|
|
225
|
-
.find(
|
|
225
|
+
.find(m => m.role === "assistant" && m.stopReason !== "aborted") as AssistantMessage | undefined;
|
|
226
226
|
|
|
227
227
|
const contextTokens = lastAssistantMessage
|
|
228
228
|
? lastAssistantMessage.usage.input +
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { getAvailableThemes, getSelectListTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
2
1
|
import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui";
|
|
2
|
+
import { getSelectListTheme } from "../../modes/theme/theme";
|
|
3
3
|
import { DynamicBorder } from "./dynamic-border";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Component that renders a theme selector
|
|
6
|
+
* Component that renders a theme selector.
|
|
7
|
+
* Themes must be pre-loaded and passed to the constructor.
|
|
7
8
|
*/
|
|
8
9
|
export class ThemeSelectorComponent extends Container {
|
|
9
10
|
private selectList: SelectList;
|
|
@@ -11,6 +12,7 @@ export class ThemeSelectorComponent extends Container {
|
|
|
11
12
|
|
|
12
13
|
constructor(
|
|
13
14
|
currentTheme: string,
|
|
15
|
+
themes: string[],
|
|
14
16
|
onSelect: (themeName: string) => void,
|
|
15
17
|
onCancel: () => void,
|
|
16
18
|
onPreview: (themeName: string) => void,
|
|
@@ -18,9 +20,8 @@ export class ThemeSelectorComponent extends Container {
|
|
|
18
20
|
super();
|
|
19
21
|
this.onPreview = onPreview;
|
|
20
22
|
|
|
21
|
-
//
|
|
22
|
-
const
|
|
23
|
-
const themeItems: SelectItem[] = themes.map((name) => ({
|
|
23
|
+
// Create select items from provided themes
|
|
24
|
+
const themeItems: SelectItem[] = themes.map(name => ({
|
|
24
25
|
value: name,
|
|
25
26
|
label: name,
|
|
26
27
|
description: name === currentTheme ? "(current)" : undefined,
|
|
@@ -38,7 +39,7 @@ export class ThemeSelectorComponent extends Container {
|
|
|
38
39
|
this.selectList.setSelectedIndex(currentIndex);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
this.selectList.onSelect =
|
|
42
|
+
this.selectList.onSelect = item => {
|
|
42
43
|
onSelect(item.value);
|
|
43
44
|
};
|
|
44
45
|
|
|
@@ -46,7 +47,7 @@ export class ThemeSelectorComponent extends Container {
|
|
|
46
47
|
onCancel();
|
|
47
48
|
};
|
|
48
49
|
|
|
49
|
-
this.selectList.onSelectionChange =
|
|
50
|
+
this.selectList.onSelectionChange = item => {
|
|
50
51
|
this.onPreview(item.value);
|
|
51
52
|
};
|
|
52
53
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
2
|
-
import { getSelectListTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
3
2
|
import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui";
|
|
3
|
+
import { getSelectListTheme } from "../../modes/theme/theme";
|
|
4
4
|
import { DynamicBorder } from "./dynamic-border";
|
|
5
5
|
|
|
6
6
|
const LEVEL_DESCRIPTIONS: Record<ThinkingLevel, string> = {
|
|
@@ -26,7 +26,7 @@ export class ThinkingSelectorComponent extends Container {
|
|
|
26
26
|
) {
|
|
27
27
|
super();
|
|
28
28
|
|
|
29
|
-
const thinkingLevels: SelectItem[] = availableLevels.map(
|
|
29
|
+
const thinkingLevels: SelectItem[] = availableLevels.map(level => ({
|
|
30
30
|
value: level,
|
|
31
31
|
label: level,
|
|
32
32
|
description: LEVEL_DESCRIPTIONS[level],
|
|
@@ -39,12 +39,12 @@ export class ThinkingSelectorComponent extends Container {
|
|
|
39
39
|
this.selectList = new SelectList(thinkingLevels, thinkingLevels.length, getSelectListTheme());
|
|
40
40
|
|
|
41
41
|
// Preselect current level
|
|
42
|
-
const currentIndex = thinkingLevels.findIndex(
|
|
42
|
+
const currentIndex = thinkingLevels.findIndex(item => item.value === currentLevel);
|
|
43
43
|
if (currentIndex !== -1) {
|
|
44
44
|
this.selectList.setSelectedIndex(currentIndex);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
this.selectList.onSelect =
|
|
47
|
+
this.selectList.onSelect = item => {
|
|
48
48
|
onSelect(item.value as ThinkingLevel);
|
|
49
49
|
};
|
|
50
50
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
|
-
import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
3
|
-
import type { TodoItem } from "@oh-my-pi/pi-coding-agent/modes/types";
|
|
4
2
|
import { Text } from "@oh-my-pi/pi-tui";
|
|
5
3
|
import { logger } from "@oh-my-pi/pi-utils";
|
|
4
|
+
import { theme } from "../../modes/theme/theme";
|
|
5
|
+
import type { TodoItem } from "../../modes/types";
|
|
6
6
|
|
|
7
7
|
const TODO_FILE_NAME = "todos.json";
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
2
|
-
import type { TodoItem } from "@oh-my-pi/pi-coding-agent/tools/todo-write";
|
|
3
1
|
import { Box, Container, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
2
|
+
import { theme } from "../../modes/theme/theme";
|
|
3
|
+
import type { TodoItem } from "../../tools/todo-write";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Component that renders a todo completion reminder notification.
|
|
@@ -20,7 +20,7 @@ export class TodoReminderComponent extends Container {
|
|
|
20
20
|
|
|
21
21
|
this.addChild(new Spacer(1));
|
|
22
22
|
|
|
23
|
-
this.box = new Box(1, 1,
|
|
23
|
+
this.box = new Box(1, 1, t => theme.inverse(theme.fg("warning", t)));
|
|
24
24
|
this.addChild(this.box);
|
|
25
25
|
|
|
26
26
|
this.rebuild();
|
|
@@ -36,7 +36,7 @@ export class TodoReminderComponent extends Container {
|
|
|
36
36
|
this.box.addChild(new Text(header, 0, 0));
|
|
37
37
|
this.box.addChild(new Spacer(1));
|
|
38
38
|
|
|
39
|
-
const todoList = this.todos.map(
|
|
39
|
+
const todoList = this.todos.map(t => ` ${theme.checkbox.unchecked} ${t.content}`).join("\n");
|
|
40
40
|
this.box.addChild(new Text(theme.italic(todoList), 0, 0));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
import type { AgentTool } from "@oh-my-pi/pi-agent-core";
|
|
2
|
-
import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
3
|
-
import {
|
|
4
|
-
computeEditDiff,
|
|
5
|
-
computePatchDiff,
|
|
6
|
-
type EditDiffError,
|
|
7
|
-
type EditDiffResult,
|
|
8
|
-
} from "@oh-my-pi/pi-coding-agent/patch";
|
|
9
|
-
import { BASH_DEFAULT_PREVIEW_LINES } from "@oh-my-pi/pi-coding-agent/tools/bash";
|
|
10
|
-
import { PYTHON_DEFAULT_PREVIEW_LINES } from "@oh-my-pi/pi-coding-agent/tools/python";
|
|
11
|
-
import { toolRenderers } from "@oh-my-pi/pi-coding-agent/tools/renderers";
|
|
12
|
-
import { convertToPng } from "@oh-my-pi/pi-coding-agent/utils/image-convert";
|
|
13
2
|
import {
|
|
14
3
|
Box,
|
|
15
4
|
Container,
|
|
@@ -22,6 +11,12 @@ import {
|
|
|
22
11
|
type TUI,
|
|
23
12
|
} from "@oh-my-pi/pi-tui";
|
|
24
13
|
import { sanitizeText } from "@oh-my-pi/pi-utils";
|
|
14
|
+
import { theme } from "../../modes/theme/theme";
|
|
15
|
+
import { computeEditDiff, computePatchDiff, type EditDiffError, type EditDiffResult } from "../../patch";
|
|
16
|
+
import { BASH_DEFAULT_PREVIEW_LINES } from "../../tools/bash";
|
|
17
|
+
import { PYTHON_DEFAULT_PREVIEW_LINES } from "../../tools/python";
|
|
18
|
+
import { toolRenderers } from "../../tools/renderers";
|
|
19
|
+
import { convertToPng } from "../../utils/image-convert";
|
|
25
20
|
import { renderDiff } from "./diff";
|
|
26
21
|
|
|
27
22
|
// Preview line limit for bash when not expanded
|
|
@@ -41,7 +36,7 @@ function formatCompactValue(value: unknown, maxLength: number): string {
|
|
|
41
36
|
} else if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
42
37
|
rendered = String(value);
|
|
43
38
|
} else if (Array.isArray(value)) {
|
|
44
|
-
const previewItems = value.slice(0, 3).map(
|
|
39
|
+
const previewItems = value.slice(0, 3).map(item => formatCompactValue(item, maxLength));
|
|
45
40
|
rendered = `[${previewItems.join(", ")}${value.length > 3 ? ", ..." : ""}]`;
|
|
46
41
|
} else if (typeof value === "object") {
|
|
47
42
|
try {
|
|
@@ -218,7 +213,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
218
213
|
computePatchDiff({ path, op, rename, diff }, this.cwd, {
|
|
219
214
|
fuzzyThreshold: this.editFuzzyThreshold,
|
|
220
215
|
allowFuzzy: this.editAllowFuzzy,
|
|
221
|
-
}).then(
|
|
216
|
+
}).then(result => {
|
|
222
217
|
if (this.editDiffArgsKey === argsKey) {
|
|
223
218
|
this.editDiffPreview = result;
|
|
224
219
|
this.updateDisplay();
|
|
@@ -244,7 +239,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
244
239
|
this.editDiffArgsKey = argsKey;
|
|
245
240
|
|
|
246
241
|
// Compute diff async
|
|
247
|
-
computeEditDiff(path, oldText, newText, this.cwd, true, all, this.editFuzzyThreshold).then(
|
|
242
|
+
computeEditDiff(path, oldText, newText, this.cwd, true, all, this.editFuzzyThreshold).then(result => {
|
|
248
243
|
// Only update if args haven't changed since we started
|
|
249
244
|
if (this.editDiffArgsKey === argsKey) {
|
|
250
245
|
this.editDiffPreview = result;
|
|
@@ -308,7 +303,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
308
303
|
// Convert async - catch errors from WASM processing
|
|
309
304
|
const index = i;
|
|
310
305
|
convertToPng(img.data, img.mimeType)
|
|
311
|
-
.then(
|
|
306
|
+
.then(converted => {
|
|
312
307
|
if (converted) {
|
|
313
308
|
this.convertedImages.set(index, converted);
|
|
314
309
|
this.updateDisplay();
|
|
@@ -634,7 +629,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
634
629
|
const displayLines = lines.slice(-maxLines);
|
|
635
630
|
const remaining = lines.length - displayLines.length;
|
|
636
631
|
text += ` ${theme.fg("dim", `(${lines.length} lines)`)}`;
|
|
637
|
-
text += `\n${displayLines.map(
|
|
632
|
+
text += `\n${displayLines.map(line => theme.fg("toolOutput", line)).join("\n")}`;
|
|
638
633
|
if (remaining > 0) {
|
|
639
634
|
text += theme.fg("dim", `\n${theme.format.ellipsis} (${remaining} earlier lines) (ctrl+o to expand)`);
|
|
640
635
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
2
|
-
import type { SessionTreeNode } from "@oh-my-pi/pi-coding-agent/session/session-manager";
|
|
3
|
-
import { shortenPath } from "@oh-my-pi/pi-coding-agent/tools/render-utils";
|
|
4
1
|
import {
|
|
5
2
|
type Component,
|
|
6
3
|
Container,
|
|
@@ -11,6 +8,9 @@ import {
|
|
|
11
8
|
TruncatedText,
|
|
12
9
|
truncateToWidth,
|
|
13
10
|
} from "@oh-my-pi/pi-tui";
|
|
11
|
+
import { theme } from "../../modes/theme/theme";
|
|
12
|
+
import type { SessionTreeNode } from "../../session/session-manager";
|
|
13
|
+
import { shortenPath } from "../../tools/render-utils";
|
|
14
14
|
import { DynamicBorder } from "./dynamic-border";
|
|
15
15
|
|
|
16
16
|
/** Gutter info: position (displayIndent where connector was) and whether to show │ */
|
|
@@ -71,7 +71,7 @@ class TreeList implements Component {
|
|
|
71
71
|
this.applyFilter();
|
|
72
72
|
|
|
73
73
|
// Start with current leaf selected
|
|
74
|
-
const leafIndex = this.filteredNodes.findIndex(
|
|
74
|
+
const leafIndex = this.filteredNodes.findIndex(n => n.node.entry.id === currentLeafId);
|
|
75
75
|
if (leafIndex !== -1) {
|
|
76
76
|
this.selectedIndex = leafIndex;
|
|
77
77
|
} else {
|
|
@@ -236,7 +236,7 @@ class TreeList implements Component {
|
|
|
236
236
|
|
|
237
237
|
const searchTokens = this.searchQuery.toLowerCase().split(/\s+/).filter(Boolean);
|
|
238
238
|
|
|
239
|
-
this.filteredNodes = this.flatNodes.filter(
|
|
239
|
+
this.filteredNodes = this.flatNodes.filter(flatNode => {
|
|
240
240
|
const entry = flatNode.node.entry;
|
|
241
241
|
const isCurrentLeaf = entry.id === this.currentLeafId;
|
|
242
242
|
|
|
@@ -289,7 +289,7 @@ class TreeList implements Component {
|
|
|
289
289
|
// Apply search filter
|
|
290
290
|
if (searchTokens.length > 0) {
|
|
291
291
|
const nodeText = this.getSearchableText(flatNode.node).toLowerCase();
|
|
292
|
-
return searchTokens.every(
|
|
292
|
+
return searchTokens.every(token => nodeText.includes(token));
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
return true;
|
|
@@ -297,7 +297,7 @@ class TreeList implements Component {
|
|
|
297
297
|
|
|
298
298
|
// Try to preserve cursor on the same node after filtering
|
|
299
299
|
if (previouslySelectedId) {
|
|
300
|
-
const newIndex = this.filteredNodes.findIndex(
|
|
300
|
+
const newIndex = this.filteredNodes.findIndex(n => n.node.entry.id === previouslySelectedId);
|
|
301
301
|
if (newIndex !== -1) {
|
|
302
302
|
this.selectedIndex = newIndex;
|
|
303
303
|
return;
|
|
@@ -442,7 +442,7 @@ class TreeList implements Component {
|
|
|
442
442
|
const posInLevel = i % 3;
|
|
443
443
|
|
|
444
444
|
// Check if there's a gutter at this level
|
|
445
|
-
const gutter = flatNode.gutters.find(
|
|
445
|
+
const gutter = flatNode.gutters.find(g => g.position === level);
|
|
446
446
|
if (gutter) {
|
|
447
447
|
if (posInLevel === 0) {
|
|
448
448
|
prefixChars.push(gutter.show ? theme.tree.vertical : " ");
|
|
@@ -537,7 +537,7 @@ class TreeList implements Component {
|
|
|
537
537
|
? entry.content
|
|
538
538
|
: entry.content
|
|
539
539
|
.filter((c): c is { type: "text"; text: string } => c.type === "text")
|
|
540
|
-
.map(
|
|
540
|
+
.map(c => c.text)
|
|
541
541
|
.join("");
|
|
542
542
|
result = theme.fg("customMessageLabel", `[${entry.customType}]: `) + normalize(content);
|
|
543
543
|
break;
|
|
@@ -713,7 +713,7 @@ class TreeList implements Component {
|
|
|
713
713
|
this.onLabelEdit(selected.node.entry.id, selected.node.label);
|
|
714
714
|
}
|
|
715
715
|
} else {
|
|
716
|
-
const hasControlChars = [...keyData].some(
|
|
716
|
+
const hasControlChars = [...keyData].some(ch => {
|
|
717
717
|
const code = ch.charCodeAt(0);
|
|
718
718
|
return code < 32 || code === 0x7f || (code >= 0x80 && code <= 0x9f);
|
|
719
719
|
});
|
|
@@ -764,7 +764,7 @@ class LabelInput implements Component {
|
|
|
764
764
|
const indent = " ";
|
|
765
765
|
const availableWidth = width - indent.length;
|
|
766
766
|
lines.push(truncateToWidth(`${indent}${theme.fg("muted", "Label (empty to remove):")}`, width));
|
|
767
|
-
lines.push(...this.input.render(availableWidth).map(
|
|
767
|
+
lines.push(...this.input.render(availableWidth).map(line => truncateToWidth(`${indent}${line}`, width)));
|
|
768
768
|
lines.push(truncateToWidth(`${indent}${theme.fg("dim", "enter: save esc: cancel")}`, width));
|
|
769
769
|
return lines;
|
|
770
770
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Rule } from "@oh-my-pi/pi-coding-agent/capability/rule";
|
|
2
|
-
import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
3
1
|
import { Box, Container, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
2
|
+
import type { Rule } from "../../capability/rule";
|
|
3
|
+
import { theme } from "../../modes/theme/theme";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Component that renders a TTSR (Time Traveling Stream Rules) notification.
|
|
@@ -18,7 +18,7 @@ export class TtsrNotificationComponent extends Container {
|
|
|
18
18
|
this.addChild(new Spacer(1));
|
|
19
19
|
|
|
20
20
|
// Use inverse warning color for yellow background effect
|
|
21
|
-
this.box = new Box(1, 1,
|
|
21
|
+
this.box = new Box(1, 1, t => theme.inverse(theme.fg("warning", t)));
|
|
22
22
|
this.addChild(this.box);
|
|
23
23
|
|
|
24
24
|
this.rebuild();
|
|
@@ -39,7 +39,7 @@ export class TtsrNotificationComponent extends Container {
|
|
|
39
39
|
this.box.clear();
|
|
40
40
|
|
|
41
41
|
// Build header: warning symbol + rule name + rewind icon
|
|
42
|
-
const ruleNames = this.rules.map(
|
|
42
|
+
const ruleNames = this.rules.map(r => theme.bold(r.name)).join(", ");
|
|
43
43
|
const label = this.rules.length === 1 ? "rule" : "rules";
|
|
44
44
|
const header = `${theme.icon.warning} Injecting ${label}: ${ruleNames}`;
|
|
45
45
|
|
|
@@ -70,7 +70,7 @@ export class TtsrNotificationComponent extends Container {
|
|
|
70
70
|
|
|
71
71
|
// Show expand hint if collapsed and there's more content
|
|
72
72
|
if (!this._expanded) {
|
|
73
|
-
const hasMoreContent = this.rules.some(
|
|
73
|
+
const hasMoreContent = this.rules.some(r => {
|
|
74
74
|
const desc = r.description || r.content;
|
|
75
75
|
return desc && desc.split("\n").length > 2;
|
|
76
76
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
2
1
|
import { type Component, Container, matchesKey, Spacer, Text, truncateToWidth } from "@oh-my-pi/pi-tui";
|
|
2
|
+
import { theme } from "../../modes/theme/theme";
|
|
3
3
|
import { DynamicBorder } from "./dynamic-border";
|
|
4
4
|
|
|
5
5
|
interface UserMessageItem {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getMarkdownTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
2
1
|
import { Container, Markdown, Spacer } from "@oh-my-pi/pi-tui";
|
|
2
|
+
import { getMarkdownTheme, theme } from "../../modes/theme/theme";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Component that renders a user message
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { APP_NAME } from "@oh-my-pi/pi-coding-agent/config";
|
|
2
|
-
import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
|
3
1
|
import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui";
|
|
2
|
+
import { APP_NAME } from "../../config";
|
|
3
|
+
import { theme } from "../../modes/theme/theme";
|
|
4
4
|
|
|
5
5
|
export interface RecentSession {
|
|
6
6
|
name: string;
|
|
@@ -65,14 +65,14 @@ export class WelcomeComponent implements Component {
|
|
|
65
65
|
const piLogo = ["▀████████████▀", " ╘███ ███ ", " ███ ███ ", " ███ ███ ", " ▄███▄ ▄███▄ "];
|
|
66
66
|
|
|
67
67
|
// Apply gradient to logo
|
|
68
|
-
const logoColored = piLogo.map(
|
|
68
|
+
const logoColored = piLogo.map(line => this.gradientLine(line));
|
|
69
69
|
|
|
70
70
|
// Left column - centered content
|
|
71
71
|
const leftLines = [
|
|
72
72
|
"",
|
|
73
73
|
this.centerText(theme.bold("Welcome back!"), leftCol),
|
|
74
74
|
"",
|
|
75
|
-
...logoColored.map(
|
|
75
|
+
...logoColored.map(l => this.centerText(l, leftCol)),
|
|
76
76
|
"",
|
|
77
77
|
this.centerText(theme.fg("muted", this.modelName), leftCol),
|
|
78
78
|
this.centerText(theme.fg("borderMuted", this.providerName), leftCol),
|