@oh-my-pi/pi-coding-agent 6.9.69 → 8.0.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 +219 -51
- package/README.md +1 -1
- package/docs/hooks.md +2 -2
- package/docs/sdk.md +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/package.json +10 -10
- package/scripts/format-prompts.ts +143 -0
- package/scripts/generate-template.ts +1 -1
- package/src/cli/args.ts +3 -3
- package/src/cli/config-cli.ts +4 -4
- package/src/cli/file-processor.ts +3 -3
- package/src/cli/list-models.ts +2 -2
- package/src/cli/plugin-cli.ts +3 -3
- package/src/cli/session-picker.ts +2 -2
- package/src/cli/setup-cli.ts +2 -2
- package/src/cli/stats-cli.ts +1 -1
- package/src/cli/update-cli.ts +2 -2
- package/src/{core → config}/keybindings.ts +1 -1
- package/src/{core → config}/model-registry.ts +8 -1
- package/src/{core → config}/model-resolver.ts +3 -3
- package/src/{core → config}/prompt-templates.ts +2 -2
- package/src/{core → config}/settings-manager.ts +6 -6
- package/src/{core/cursor/exec-bridge.ts → cursor.ts} +4 -4
- package/src/discovery/agents-md.ts +4 -4
- package/src/discovery/builtin.ts +17 -17
- package/src/discovery/claude.ts +12 -12
- package/src/discovery/cline.ts +6 -6
- package/src/discovery/codex.ts +21 -21
- package/src/discovery/cursor.ts +9 -9
- package/src/discovery/gemini.ts +9 -9
- package/src/discovery/github.ts +6 -6
- package/src/discovery/helpers.ts +4 -4
- package/src/discovery/index.ts +16 -16
- package/src/discovery/mcp-json.ts +4 -4
- package/src/discovery/ssh.ts +4 -4
- package/src/discovery/vscode.ts +4 -4
- package/src/discovery/windsurf.ts +6 -6
- package/src/{core/tools/exa → exa}/company.ts +2 -3
- package/src/{core/tools/exa → exa}/index.ts +2 -2
- package/src/{core/tools/exa → exa}/linkedin.ts +2 -3
- package/src/{core/tools/exa → exa}/mcp-client.ts +2 -2
- package/src/{core/tools/exa → exa}/render.ts +3 -3
- package/src/{core/tools/exa → exa}/researcher.ts +1 -1
- package/src/{core/tools/exa → exa}/search.ts +2 -10
- package/src/{core/tools/exa → exa}/websets.ts +1 -1
- package/src/{core → exec}/bash-executor.ts +23 -7
- package/src/{core → export}/custom-share.ts +1 -1
- package/src/{core/export-html → export/html}/index.ts +3 -3
- package/src/{core → export}/ttsr.ts +2 -2
- package/src/{core → extensibility}/custom-commands/bundled/review/index.ts +4 -4
- package/src/{core → extensibility}/custom-commands/loader.ts +3 -3
- package/src/{core → extensibility}/custom-commands/types.ts +1 -1
- package/src/{core → extensibility}/custom-tools/loader.ts +9 -9
- package/src/{core → extensibility}/custom-tools/types.ts +6 -6
- package/src/{core → extensibility}/custom-tools/wrapper.ts +1 -1
- package/src/{core → extensibility}/extensions/loader.ts +8 -8
- package/src/{core → extensibility}/extensions/runner.ts +3 -3
- package/src/{core → extensibility}/extensions/types.ts +15 -15
- package/src/{core → extensibility}/extensions/wrapper.ts +1 -1
- package/src/{core → extensibility}/hooks/index.ts +1 -1
- package/src/{core → extensibility}/hooks/loader.ts +7 -7
- package/src/{core → extensibility}/hooks/runner.ts +4 -4
- package/src/{core → extensibility}/hooks/types.ts +9 -9
- package/src/{core → extensibility}/plugins/doctor.ts +1 -1
- package/src/{core → extensibility}/plugins/installer.ts +2 -3
- package/src/{core → extensibility}/plugins/paths.ts +1 -1
- package/src/{core → extensibility}/skills.ts +8 -48
- package/src/{core → extensibility}/slash-commands.ts +6 -6
- package/src/index.ts +127 -128
- package/src/internal-urls/agent-protocol.ts +126 -0
- package/src/internal-urls/artifact-protocol.ts +93 -0
- package/src/internal-urls/index.ts +28 -0
- package/src/internal-urls/json-query.ts +126 -0
- package/src/internal-urls/router.ts +69 -0
- package/src/internal-urls/rule-protocol.ts +56 -0
- package/src/internal-urls/skill-protocol.ts +112 -0
- package/src/internal-urls/types.ts +48 -0
- package/src/{core/python-executor.ts → ipy/executor.ts} +74 -13
- package/src/{core/python-gateway-coordinator.ts → ipy/gateway-coordinator.ts} +40 -270
- package/src/{core/python-kernel.ts → ipy/kernel.ts} +38 -10
- package/src/{core/python-prelude.py → ipy/prelude.py} +201 -8
- package/src/ipy/prelude.ts +3 -0
- package/src/{core/tools/lsp → lsp}/client.ts +7 -6
- package/src/{core/tools/lsp → lsp}/clients/biome-client.ts +1 -1
- package/src/{core/tools/lsp → lsp}/clients/index.ts +1 -1
- package/src/{core/tools/lsp → lsp}/clients/lsp-linter-client.ts +4 -4
- package/src/{core/tools/lsp → lsp}/config.ts +1 -1
- package/src/{core/tools/lsp → lsp}/index.ts +29 -17
- package/src/{core/tools/lsp → lsp}/render.ts +2 -2
- package/src/{core/tools/lsp → lsp}/types.ts +14 -16
- package/src/{core/tools/lsp → lsp}/utils.ts +1 -1
- package/src/main.ts +12 -12
- package/src/{core/mcp → mcp}/config.ts +8 -8
- package/src/{core/mcp → mcp}/loader.ts +5 -6
- package/src/{core/mcp → mcp}/manager.ts +2 -2
- package/src/{core/mcp → mcp}/tool-bridge.ts +35 -6
- package/src/{core/mcp → mcp}/tool-cache.ts +1 -1
- package/src/{core/mcp → mcp}/transports/http.ts +7 -1
- package/src/{core/mcp → mcp}/transports/stdio.ts +1 -1
- package/src/{core/mcp → mcp}/types.ts +1 -1
- package/src/migrations.ts +2 -2
- package/src/modes/{interactive/components → components}/armin.ts +1 -1
- package/src/modes/{interactive/components → components}/assistant-message.ts +1 -1
- package/src/modes/{interactive/components → components}/bash-execution.ts +37 -29
- package/src/modes/{interactive/components → components}/bordered-loader.ts +1 -1
- package/src/modes/{interactive/components → components}/branch-summary-message.ts +2 -2
- package/src/modes/{interactive/components → components}/compaction-summary-message.ts +2 -2
- package/src/modes/{interactive/components → components}/custom-message.ts +3 -3
- package/src/modes/{interactive/components → components}/diff.ts +1 -1
- package/src/modes/{interactive/components → components}/dynamic-border.ts +1 -1
- package/src/modes/{interactive/components → components}/extensions/extension-dashboard.ts +3 -3
- package/src/modes/{interactive/components → components}/extensions/extension-list.ts +2 -2
- package/src/modes/{interactive/components → components}/extensions/inspector-panel.ts +1 -1
- package/src/modes/{interactive/components → components}/extensions/state-manager.ts +11 -17
- package/src/modes/{interactive/components → components}/extensions/types.ts +1 -1
- package/src/modes/{interactive/components → components}/footer.ts +3 -3
- package/src/modes/{interactive/components → components}/history-search.ts +2 -2
- package/src/modes/{interactive/components → components}/hook-editor.ts +1 -1
- package/src/modes/{interactive/components → components}/hook-input.ts +1 -1
- package/src/modes/{interactive/components → components}/hook-message.ts +3 -3
- package/src/modes/{interactive/components → components}/hook-selector.ts +1 -1
- package/src/modes/{interactive/components → components}/keybinding-hints.ts +2 -2
- package/src/modes/{interactive/components → components}/login-dialog.ts +1 -1
- package/src/modes/{interactive/components → components}/model-selector.ts +5 -5
- package/src/modes/{interactive/components → components}/oauth-selector.ts +2 -2
- package/src/modes/{interactive/components → components}/plugin-settings.ts +3 -3
- package/src/modes/{interactive/components → components}/python-execution.ts +35 -24
- package/src/modes/{interactive/components → components}/queue-mode-selector.ts +1 -1
- package/src/modes/{interactive/components → components}/read-tool-group.ts +2 -2
- package/src/modes/{interactive/components → components}/session-selector.ts +3 -3
- package/src/modes/{interactive/components → components}/settings-defs.ts +2 -2
- package/src/modes/{interactive/components → components}/settings-selector.ts +2 -2
- package/src/modes/{interactive/components → components}/show-images-selector.ts +1 -1
- package/src/modes/{interactive/components → components}/status-line/segments.ts +2 -2
- package/src/modes/{interactive/components → components}/status-line/separators.ts +1 -1
- package/src/modes/{interactive/components → components}/status-line/types.ts +2 -2
- package/src/modes/{interactive/components → components}/status-line-segment-editor.ts +2 -2
- package/src/modes/{interactive/components → components}/status-line.ts +3 -3
- package/src/modes/{interactive/components → components}/theme-selector.ts +1 -1
- package/src/modes/{interactive/components → components}/thinking-selector.ts +1 -1
- package/src/modes/{interactive/components → components}/todo-display.ts +3 -4
- package/src/modes/{interactive/components → components}/todo-reminder.ts +2 -2
- package/src/modes/{interactive/components → components}/tool-execution.ts +8 -8
- package/src/modes/{interactive/components → components}/tree-selector.ts +3 -3
- package/src/modes/{interactive/components → components}/ttsr-notification.ts +2 -2
- package/src/modes/{interactive/components → components}/user-message-selector.ts +1 -1
- package/src/modes/{interactive/components → components}/user-message.ts +1 -1
- package/src/modes/{interactive/components → components}/welcome.ts +2 -2
- package/src/modes/{interactive/controllers → controllers}/command-controller.ts +381 -30
- package/src/modes/{interactive/controllers → controllers}/event-controller.ts +9 -9
- package/src/modes/{interactive/controllers → controllers}/extension-ui-controller.ts +8 -8
- package/src/modes/{interactive/controllers → controllers}/input-controller.ts +61 -13
- package/src/modes/{interactive/controllers → controllers}/selector-controller.ts +16 -16
- package/src/modes/index.ts +1 -1
- package/src/modes/{interactive/interactive-mode.ts → interactive-mode.ts} +20 -15
- package/src/modes/print-mode.ts +1 -1
- package/src/modes/rpc/rpc-client.ts +3 -3
- package/src/modes/rpc/rpc-mode.ts +3 -3
- package/src/modes/rpc/rpc-types.ts +3 -3
- package/src/modes/{interactive/theme → theme}/theme.ts +1 -1
- package/src/modes/{interactive/types.ts → types.ts} +10 -10
- package/src/modes/{interactive/utils → utils}/ui-helpers.ts +20 -27
- package/src/{core/tools/patch → patch}/applicator.ts +1 -1
- package/src/{core/tools/patch → patch}/diff.ts +1 -1
- package/src/{core/tools/patch → patch}/index.ts +31 -36
- package/src/{core/tools/patch → patch}/shared.ts +9 -6
- package/src/prompts/agents/explore.md +83 -46
- package/src/prompts/agents/init.md +9 -4
- package/src/prompts/agents/plan.md +8 -7
- package/src/prompts/agents/reviewer.md +36 -18
- package/src/prompts/agents/task.md +4 -4
- package/src/prompts/compaction/branch-summary-preamble.md +0 -1
- package/src/prompts/review-request.md +0 -1
- package/src/prompts/system/custom-system-prompt.md +2 -14
- package/src/prompts/system/file-operations.md +0 -2
- package/src/prompts/system/system-prompt.md +182 -171
- package/src/prompts/system/web-search.md +26 -0
- package/src/prompts/tools/ask.md +31 -24
- package/src/prompts/tools/bash.md +20 -17
- package/src/prompts/tools/calculator.md +9 -5
- package/src/prompts/tools/fetch.md +16 -0
- package/src/prompts/tools/find.md +15 -5
- package/src/prompts/tools/gemini-image.md +21 -6
- package/src/prompts/tools/grep.md +28 -12
- package/src/prompts/tools/lsp.md +35 -14
- package/src/prompts/tools/patch.md +39 -41
- package/src/prompts/tools/python.md +59 -77
- package/src/prompts/tools/read.md +23 -22
- package/src/prompts/tools/replace.md +19 -12
- package/src/prompts/tools/ssh.md +21 -28
- package/src/prompts/tools/task.md +54 -44
- package/src/prompts/tools/todo-write.md +52 -163
- package/src/prompts/tools/web-search.md +16 -9
- package/src/prompts/tools/write.md +13 -2
- package/src/{core/sdk.ts → sdk.ts} +65 -34
- package/src/{core → session}/agent-session.ts +157 -41
- package/src/{core → session}/agent-storage.ts +2 -2
- package/src/session/artifacts.ts +110 -0
- package/src/{core → session}/auth-storage.ts +525 -203
- package/src/{core → session}/compaction/branch-summarization.ts +5 -5
- package/src/{core → session}/compaction/compaction.ts +6 -6
- package/src/{core → session}/compaction/utils.ts +3 -3
- package/src/{core → session}/history-storage.ts +1 -1
- package/src/{core → session}/messages.ts +6 -8
- package/src/{core → session}/session-manager.ts +2 -2
- package/src/{core → session}/storage-migration.ts +2 -2
- package/src/session/streaming-output.ts +177 -0
- package/src/{core/ssh → ssh}/connection-manager.ts +1 -1
- package/src/{core/ssh → ssh}/ssh-executor.ts +19 -4
- package/src/{core/ssh → ssh}/sshfs-mount.ts +1 -1
- package/src/{core/system-prompt.ts → system-prompt.ts} +8 -37
- package/src/{core/tools/task → task}/agents.ts +8 -8
- package/src/{core/tools/task → task}/commands.ts +5 -6
- package/src/{core/tools/task → task}/discovery.ts +3 -3
- package/src/{core/tools/task → task}/executor.ts +34 -44
- package/src/{core/tools/task → task}/index.ts +206 -50
- package/src/{core/tools/task → task}/render.ts +80 -23
- package/src/{core/tools/task → task}/subprocess-tool-registry.ts +1 -1
- package/src/task/template.ts +47 -0
- package/src/{core/tools/task → task}/types.ts +19 -27
- package/src/{core/tools/task → task}/worker-protocol.ts +8 -4
- package/src/{core/tools/task → task}/worker.ts +34 -29
- package/src/task/worktree.ts +166 -0
- package/src/{core/tools → tools}/ask.ts +13 -21
- package/src/{core/tools → tools}/bash-interceptor.ts +1 -1
- package/src/{core/tools → tools}/bash.ts +61 -63
- package/src/{core/tools → tools}/calculator.ts +4 -4
- package/src/{core/tools → tools}/complete.ts +1 -1
- package/src/{core/tools → tools}/context.ts +2 -2
- package/src/{core/tools/web-fetch.ts → tools/fetch.ts} +97 -76
- package/src/{core/tools → tools}/find.ts +96 -107
- package/src/{core/tools → tools}/gemini-image.ts +420 -29
- package/src/{core/tools → tools}/grep.ts +155 -164
- package/src/{core/tools → tools}/index.ts +63 -56
- package/src/tools/list-limit.ts +40 -0
- package/src/{core/tools → tools}/ls.ts +44 -35
- package/src/{core/tools → tools}/notebook.ts +3 -3
- package/src/tools/output-meta.ts +443 -0
- package/src/tools/output-utils.ts +63 -0
- package/src/{core/tools → tools}/python.ts +106 -89
- package/src/tools/read.ts +882 -0
- package/src/{core/tools → tools}/render-utils.ts +1 -1
- package/src/{core/tools → tools}/renderers.ts +8 -10
- package/src/{core/tools → tools}/review.ts +2 -2
- package/src/{core/tools → tools}/ssh.ts +56 -59
- package/src/{core/tools → tools}/todo-write.ts +12 -23
- package/src/tools/tool-errors.ts +95 -0
- package/src/tools/tool-result.ts +92 -0
- package/src/{core/tools → tools}/truncate.ts +2 -2
- package/src/{core/tools → tools}/write.ts +15 -13
- package/src/utils/changelog.ts +1 -1
- package/src/{core → utils}/file-mentions.ts +4 -4
- package/src/utils/image-convert.ts +1 -1
- package/src/utils/image-resize.ts +1 -1
- package/src/utils/shell.ts +1 -1
- package/src/{core → utils}/title-generator.ts +4 -4
- package/src/utils/tools-manager.ts +1 -1
- package/src/{core/tools/web-scrapers → web/scrapers}/choosealicense.ts +1 -1
- package/src/{core/tools/web-scrapers → web/scrapers}/twitter.ts +3 -2
- package/src/{core/tools/web-scrapers → web/scrapers}/types.ts +4 -2
- package/src/{core/tools/web-scrapers → web/scrapers}/utils.ts +1 -1
- package/src/{core/tools/web-scrapers → web/scrapers}/youtube.ts +14 -13
- package/src/{core/tools/web-search → web/search}/auth.ts +4 -4
- package/src/{core/tools/web-search → web/search}/index.ts +22 -71
- package/src/{core/tools/web-search → web/search}/providers/anthropic.ts +7 -10
- package/src/{core/tools/web-search → web/search}/providers/exa.ts +2 -2
- package/src/{core/tools/web-search → web/search}/providers/perplexity.ts +4 -16
- package/src/{core/tools/web-search → web/search}/render.ts +3 -3
- package/scripts/migrate-sessions.sh +0 -93
- package/src/core/index.ts +0 -56
- package/src/core/python-prelude.ts +0 -3
- package/src/core/ssh-executor.ts +0 -5
- package/src/core/streaming-output.ts +0 -115
- package/src/core/tools/output.ts +0 -519
- package/src/core/tools/read.ts +0 -717
- package/src/core/tools/task/template.ts +0 -37
- package/src/prompts/tools/output.md +0 -47
- package/src/prompts/tools/web-fetch.md +0 -9
- /package/src/{core/tools/exa → exa}/types.ts +0 -0
- /package/src/{core → exec}/exec.ts +0 -0
- /package/src/{core/export-html → export/html}/template.css +0 -0
- /package/src/{core/export-html → export/html}/template.generated.ts +0 -0
- /package/src/{core/export-html → export/html}/template.html +0 -0
- /package/src/{core/export-html → export/html}/template.js +0 -0
- /package/src/{core/export-html → export/html}/template.macro.ts +0 -0
- /package/src/{core/export-html → export/html}/vendor/highlight.min.js +0 -0
- /package/src/{core/export-html → export/html}/vendor/marked.min.js +0 -0
- /package/src/{core → extensibility}/custom-commands/index.ts +0 -0
- /package/src/{core → extensibility}/custom-tools/index.ts +0 -0
- /package/src/{core → extensibility}/extensions/index.ts +0 -0
- /package/src/{core → extensibility}/hooks/tool-wrapper.ts +0 -0
- /package/src/{core → extensibility}/plugins/index.ts +0 -0
- /package/src/{core → extensibility}/plugins/loader.ts +0 -0
- /package/src/{core → extensibility}/plugins/manager.ts +0 -0
- /package/src/{core → extensibility}/plugins/parser.ts +0 -0
- /package/src/{core → extensibility}/plugins/types.ts +0 -0
- /package/src/{core/python-modules.ts → ipy/modules.ts} +0 -0
- /package/src/{core/tools/lsp → lsp}/defaults.json +0 -0
- /package/src/{core/tools/lsp → lsp}/edits.ts +0 -0
- /package/src/{core/tools/lsp → lsp}/lspmux.ts +0 -0
- /package/src/{core/tools/lsp → lsp}/rust-analyzer.ts +0 -0
- /package/src/{core/mcp → mcp}/client.ts +0 -0
- /package/src/{core/mcp → mcp}/index.ts +0 -0
- /package/src/{core/mcp → mcp}/json-rpc.ts +0 -0
- /package/src/{core/mcp → mcp}/transports/index.ts +0 -0
- /package/src/modes/{interactive/components → components}/countdown-timer.ts +0 -0
- /package/src/modes/{interactive/components → components}/custom-editor.ts +0 -0
- /package/src/modes/{interactive/components → components}/extensions/index.ts +0 -0
- /package/src/modes/{interactive/components → components}/index.ts +0 -0
- /package/src/modes/{interactive/components → components}/status-line/index.ts +0 -0
- /package/src/modes/{interactive/components → components}/status-line/presets.ts +0 -0
- /package/src/modes/{interactive/components → components}/visual-truncate.ts +0 -0
- /package/src/modes/{interactive/theme → theme}/dark.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/alabaster.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/amethyst.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/anthracite.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/basalt.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/birch.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-abyss.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-arctic.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-aurora.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-catppuccin.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-cavern.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-copper.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-cosmos.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-cyberpunk.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-dracula.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-eclipse.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-ember.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-equinox.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-forest.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-github.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-gruvbox.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-lavender.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-lunar.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-midnight.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-monochrome.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-monokai.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-nebula.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-nord.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-ocean.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-one.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-rainforest.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-reef.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-retro.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-rose-pine.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-sakura.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-slate.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-solarized.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-solstice.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-starfall.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-sunset.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-swamp.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-synthwave.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-taiga.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-terminal.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-tokyo-night.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-tundra.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-twilight.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/dark-volcanic.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/graphite.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/index.ts +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-arctic.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-aurora-day.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-canyon.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-catppuccin.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-cirrus.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-coral.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-cyberpunk.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-dawn.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-dunes.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-eucalyptus.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-forest.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-frost.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-github.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-glacier.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-gruvbox.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-haze.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-honeycomb.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-lagoon.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-lavender.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-meadow.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-mint.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-monochrome.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-ocean.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-one.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-opal.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-orchard.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-paper.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-prism.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-retro.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-sand.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-savanna.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-solarized.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-soleil.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-sunset.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-synthwave.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-tokyo-night.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-wetland.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/light-zenith.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/limestone.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/mahogany.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/marble.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/obsidian.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/onyx.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/pearl.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/porcelain.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/quartz.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/sandstone.json +0 -0
- /package/src/modes/{interactive/theme → theme}/defaults/titanium.json +0 -0
- /package/src/modes/{interactive/theme → theme}/light.json +0 -0
- /package/src/modes/{interactive/theme → theme}/theme-schema.json +0 -0
- /package/src/{core/tools/patch → patch}/fuzzy.ts +0 -0
- /package/src/{core/tools/patch → patch}/normalize.ts +0 -0
- /package/src/{core/tools/patch → patch}/normative.ts +0 -0
- /package/src/{core/tools/patch → patch}/parser.ts +0 -0
- /package/src/{core/tools/patch → patch}/types.ts +0 -0
- /package/src/{core → session}/compaction/index.ts +0 -0
- /package/src/{core → session}/session-storage.ts +0 -0
- /package/src/{core/tools/task → task}/name-generator.ts +0 -0
- /package/src/{core/tools/task → task}/omp-command.ts +0 -0
- /package/src/{core/tools/task → task}/parallel.ts +0 -0
- /package/src/{core/tools → tools}/jtd-to-json-schema.ts +0 -0
- /package/src/{core/tools → tools}/path-utils.ts +0 -0
- /package/src/{core → utils}/event-bus.ts +0 -0
- /package/src/{core → utils}/frontmatter.ts +0 -0
- /package/src/{core → utils}/terminal-notify.ts +0 -0
- /package/src/{core → utils}/timings.ts +0 -0
- /package/src/{core → utils}/utils.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/artifacthub.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/arxiv.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/aur.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/biorxiv.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/bluesky.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/brew.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/cheatsh.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/chocolatey.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/cisa-kev.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/clojars.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/coingecko.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/crates-io.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/crossref.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/devto.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/discogs.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/discourse.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/dockerhub.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/fdroid.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/firefox-addons.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/flathub.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/github-gist.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/github.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/gitlab.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/go-pkg.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/hackage.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/hackernews.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/hex.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/huggingface.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/iacr.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/index.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/jetbrains-marketplace.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/lemmy.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/lobsters.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/mastodon.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/maven.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/mdn.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/metacpan.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/musicbrainz.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/npm.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/nuget.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/nvd.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/ollama.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/open-vsx.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/opencorporates.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/openlibrary.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/orcid.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/osv.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/packagist.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/pub-dev.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/pubmed.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/pypi.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/rawg.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/readthedocs.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/reddit.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/repology.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/rfc.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/rubygems.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/searchcode.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/sec-edgar.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/semantic-scholar.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/snapcraft.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/sourcegraph.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/spdx.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/spotify.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/stackoverflow.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/terraform.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/tldr.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/vimeo.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/vscode-marketplace.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/w3c.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/wikidata.ts +0 -0
- /package/src/{core/tools/web-scrapers → web/scrapers}/wikipedia.ts +0 -0
- /package/src/{core/tools/web-search → web/search}/types.ts +0 -0
|
@@ -2,22 +2,22 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
|
2
2
|
import type { OAuthProvider } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
4
4
|
import { Input, Loader, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
5
|
-
import { getAgentDbPath } from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
5
|
+
import { getAgentDbPath } from "$c/config";
|
|
6
|
+
import { disableProvider, enableProvider } from "$c/discovery";
|
|
7
|
+
import { AssistantMessageComponent } from "$c/modes/components/assistant-message";
|
|
8
|
+
import { ExtensionDashboard } from "$c/modes/components/extensions";
|
|
9
|
+
import { HistorySearchComponent } from "$c/modes/components/history-search";
|
|
10
|
+
import { ModelSelectorComponent } from "$c/modes/components/model-selector";
|
|
11
|
+
import { OAuthSelectorComponent } from "$c/modes/components/oauth-selector";
|
|
12
|
+
import { SessionSelectorComponent } from "$c/modes/components/session-selector";
|
|
13
|
+
import { SettingsSelectorComponent } from "$c/modes/components/settings-selector";
|
|
14
|
+
import { ToolExecutionComponent } from "$c/modes/components/tool-execution";
|
|
15
|
+
import { TreeSelectorComponent } from "$c/modes/components/tree-selector";
|
|
16
|
+
import { UserMessageSelectorComponent } from "$c/modes/components/user-message-selector";
|
|
17
|
+
import { getAvailableThemes, getSymbolTheme, setSymbolPreset, setTheme, theme } from "$c/modes/theme/theme";
|
|
18
|
+
import type { InteractiveModeContext } from "$c/modes/types";
|
|
19
|
+
import { SessionManager } from "$c/session/session-manager";
|
|
20
|
+
import { setPreferredImageProvider, setPreferredWebSearchProvider } from "$c/tools/index";
|
|
21
21
|
|
|
22
22
|
export class SelectorController {
|
|
23
23
|
constructor(private ctx: InteractiveModeContext) {}
|
package/src/modes/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Run modes for the coding agent.
|
|
3
3
|
*/
|
|
4
|
-
export { InteractiveMode, type InteractiveModeOptions } from "./interactive
|
|
4
|
+
export { InteractiveMode, type InteractiveModeOptions } from "./interactive-mode";
|
|
5
5
|
export { type PrintModeOptions, runPrintMode } from "./print-mode";
|
|
6
6
|
export { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from "./rpc/rpc-client";
|
|
7
7
|
export { runRpcMode } from "./rpc/rpc-mode";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import * as path from "node:path";
|
|
7
7
|
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
8
|
-
import type { AssistantMessage, ImageContent, Message } from "@oh-my-pi/pi-ai";
|
|
8
|
+
import type { AssistantMessage, ImageContent, Message, UsageReport } from "@oh-my-pi/pi-ai";
|
|
9
9
|
import type { Component, Loader, SlashCommand } from "@oh-my-pi/pi-tui";
|
|
10
10
|
import {
|
|
11
11
|
CombinedAutocompleteProvider,
|
|
@@ -18,16 +18,16 @@ import {
|
|
|
18
18
|
} from "@oh-my-pi/pi-tui";
|
|
19
19
|
import { logger, postmortem } from "@oh-my-pi/pi-utils";
|
|
20
20
|
import chalk from "chalk";
|
|
21
|
-
import
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import type {
|
|
27
|
-
import {
|
|
28
|
-
import type {
|
|
29
|
-
import {
|
|
30
|
-
import { setTerminalTitle } from "
|
|
21
|
+
import { KeybindingsManager } from "$c/config/keybindings";
|
|
22
|
+
import type { SettingsManager } from "$c/config/settings-manager";
|
|
23
|
+
import type { ExtensionUIContext } from "$c/extensibility/extensions/index";
|
|
24
|
+
import type { CompactOptions } from "$c/extensibility/extensions/types";
|
|
25
|
+
import { loadSlashCommands } from "$c/extensibility/slash-commands";
|
|
26
|
+
import type { AgentSession, AgentSessionEvent } from "$c/session/agent-session";
|
|
27
|
+
import { HistoryStorage } from "$c/session/history-storage";
|
|
28
|
+
import type { SessionContext, SessionManager } from "$c/session/session-manager";
|
|
29
|
+
import { getRecentSessions } from "$c/session/session-manager";
|
|
30
|
+
import { setTerminalTitle } from "$c/utils/title-generator";
|
|
31
31
|
import type { AssistantMessageComponent } from "./components/assistant-message";
|
|
32
32
|
import type { BashExecutionComponent } from "./components/bash-execution";
|
|
33
33
|
import { CustomEditor } from "./components/custom-editor";
|
|
@@ -124,7 +124,7 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
124
124
|
private readonly changelogMarkdown: string | undefined;
|
|
125
125
|
public readonly lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined =
|
|
126
126
|
undefined;
|
|
127
|
-
public mcpManager?: import("
|
|
127
|
+
public mcpManager?: import("$c/mcp/index").MCPManager;
|
|
128
128
|
private readonly toolUiContextSetter: (uiContext: ExtensionUIContext, hasUI: boolean) => void;
|
|
129
129
|
|
|
130
130
|
private readonly commandController: CommandController;
|
|
@@ -140,7 +140,7 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
140
140
|
changelogMarkdown: string | undefined = undefined,
|
|
141
141
|
setToolUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void = () => {},
|
|
142
142
|
lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined = undefined,
|
|
143
|
-
mcpManager?: import("
|
|
143
|
+
mcpManager?: import("$c/mcp/index").MCPManager,
|
|
144
144
|
) {
|
|
145
145
|
this.session = session;
|
|
146
146
|
this.sessionManager = session.sessionManager;
|
|
@@ -187,6 +187,7 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
187
187
|
{ name: "share", description: "Share session as a secret GitHub gist" },
|
|
188
188
|
{ name: "copy", description: "Copy last agent message to clipboard" },
|
|
189
189
|
{ name: "session", description: "Show session info and stats" },
|
|
190
|
+
{ name: "usage", description: "Show provider usage and limits" },
|
|
190
191
|
{ name: "extensions", description: "Open Extension Control Center dashboard" },
|
|
191
192
|
{ name: "status", description: "Alias for /extensions" },
|
|
192
193
|
{ name: "changelog", description: "Show changelog entries" },
|
|
@@ -395,7 +396,7 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
395
396
|
|
|
396
397
|
private formatTodoLine(todo: TodoItem, prefix: string): string {
|
|
397
398
|
const checkbox = theme.checkbox;
|
|
398
|
-
const label = todo.
|
|
399
|
+
const label = todo.content;
|
|
399
400
|
switch (todo.status) {
|
|
400
401
|
case "completed":
|
|
401
402
|
return theme.fg("success", `${prefix}${checkbox.checked} ${chalk.strikethrough(todo.content)}`);
|
|
@@ -498,7 +499,7 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
498
499
|
}
|
|
499
500
|
|
|
500
501
|
this.stop();
|
|
501
|
-
|
|
502
|
+
await postmortem.quit(0);
|
|
502
503
|
}
|
|
503
504
|
|
|
504
505
|
async checkShutdownRequested(): Promise<void> {
|
|
@@ -613,6 +614,10 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
613
614
|
this.commandController.handleSessionCommand();
|
|
614
615
|
}
|
|
615
616
|
|
|
617
|
+
handleUsageCommand(reports?: UsageReport[] | null): Promise<void> {
|
|
618
|
+
return this.commandController.handleUsageCommand(reports);
|
|
619
|
+
}
|
|
620
|
+
|
|
616
621
|
handleChangelogCommand(): void {
|
|
617
622
|
this.commandController.handleChangelogCommand();
|
|
618
623
|
}
|
package/src/modes/print-mode.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import type { AgentEvent, AgentMessage, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
8
8
|
import type { ImageContent } from "@oh-my-pi/pi-ai";
|
|
9
9
|
import { createSanitizerStream, createSplitterStream, createTextDecoderStream, ptree } from "@oh-my-pi/pi-utils";
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type { CompactionResult } from "
|
|
10
|
+
import type { BashResult } from "$c/exec/bash-executor";
|
|
11
|
+
import type { SessionStats } from "$c/session/agent-session";
|
|
12
|
+
import type { CompactionResult } from "$c/session/compaction/index";
|
|
13
13
|
import type { RpcCommand, RpcResponse, RpcSessionState } from "./rpc-types";
|
|
14
14
|
|
|
15
15
|
/** Distributive Omit that works with union types */
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
import { readLines } from "@oh-my-pi/pi-utils";
|
|
15
15
|
import { nanoid } from "nanoid";
|
|
16
|
-
import type {
|
|
17
|
-
import type
|
|
18
|
-
import
|
|
16
|
+
import type { ExtensionUIContext, ExtensionUIDialogOptions } from "$c/extensibility/extensions/index";
|
|
17
|
+
import { type Theme, theme } from "$c/modes/theme/theme";
|
|
18
|
+
import type { AgentSession } from "$c/session/agent-session";
|
|
19
19
|
import type {
|
|
20
20
|
RpcCommand,
|
|
21
21
|
RpcExtensionUIRequest,
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import type { AgentMessage, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
9
9
|
import type { ImageContent, Model } from "@oh-my-pi/pi-ai";
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type { CompactionResult } from "
|
|
10
|
+
import type { BashResult } from "$c/exec/bash-executor";
|
|
11
|
+
import type { SessionStats } from "$c/session/agent-session";
|
|
12
|
+
import type { CompactionResult } from "$c/session/compaction/index";
|
|
13
13
|
|
|
14
14
|
// ============================================================================
|
|
15
15
|
// RPC Commands (stdin)
|
|
@@ -6,7 +6,7 @@ import { type Static, Type } from "@sinclair/typebox";
|
|
|
6
6
|
import { TypeCompiler } from "@sinclair/typebox/compiler";
|
|
7
7
|
import chalk from "chalk";
|
|
8
8
|
import { highlight, supportsLanguage } from "cli-highlight";
|
|
9
|
-
import { getCustomThemesDir } from "
|
|
9
|
+
import { getCustomThemesDir } from "$c/config";
|
|
10
10
|
// Embed theme JSON files at build time
|
|
11
11
|
import darkThemeJson from "./dark.json" with { type: "json" };
|
|
12
12
|
import { defaultThemes } from "./defaults";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
2
|
-
import type { AssistantMessage, ImageContent, Message } from "@oh-my-pi/pi-ai";
|
|
2
|
+
import type { AssistantMessage, ImageContent, Message, UsageReport } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import type { Component, Container, Loader, Spacer, Text, TUI } from "@oh-my-pi/pi-tui";
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
4
|
+
import type { KeybindingsManager } from "$c/config/keybindings";
|
|
5
|
+
import type { SettingsManager } from "$c/config/settings-manager";
|
|
6
|
+
import type { ExtensionUIContext } from "$c/extensibility/extensions/index";
|
|
7
|
+
import type { CompactOptions } from "$c/extensibility/extensions/types";
|
|
8
|
+
import type { MCPManager } from "$c/mcp/index";
|
|
9
|
+
import type { AgentSession, AgentSessionEvent } from "$c/session/agent-session";
|
|
10
|
+
import type { HistoryStorage } from "$c/session/history-storage";
|
|
11
|
+
import type { SessionContext, SessionManager } from "$c/session/session-manager";
|
|
12
12
|
import type { AssistantMessageComponent } from "./components/assistant-message";
|
|
13
13
|
import type { BashExecutionComponent } from "./components/bash-execution";
|
|
14
14
|
import type { CustomEditor } from "./components/custom-editor";
|
|
@@ -28,7 +28,6 @@ export type CompactionQueuedMessage = {
|
|
|
28
28
|
export type TodoItem = {
|
|
29
29
|
id: string;
|
|
30
30
|
content: string;
|
|
31
|
-
activeForm: string;
|
|
32
31
|
status: "pending" | "in_progress" | "completed";
|
|
33
32
|
};
|
|
34
33
|
|
|
@@ -134,6 +133,7 @@ export interface InteractiveModeContext {
|
|
|
134
133
|
handleShareCommand(): Promise<void>;
|
|
135
134
|
handleCopyCommand(): Promise<void>;
|
|
136
135
|
handleSessionCommand(): void;
|
|
136
|
+
handleUsageCommand(reports?: UsageReport[] | null): Promise<void>;
|
|
137
137
|
handleChangelogCommand(): void;
|
|
138
138
|
handleHotkeysCommand(): void;
|
|
139
139
|
handleDumpCommand(): Promise<void>;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { AssistantMessage, Message } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import { Spacer, Text, TruncatedText } from "@oh-my-pi/pi-tui";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import type { CompactionQueuedMessage, InteractiveModeContext } from "../types";
|
|
4
|
+
import { AssistantMessageComponent } from "$c/modes/components/assistant-message";
|
|
5
|
+
import { BashExecutionComponent } from "$c/modes/components/bash-execution";
|
|
6
|
+
import { BranchSummaryMessageComponent } from "$c/modes/components/branch-summary-message";
|
|
7
|
+
import { CompactionSummaryMessageComponent } from "$c/modes/components/compaction-summary-message";
|
|
8
|
+
import { CustomMessageComponent } from "$c/modes/components/custom-message";
|
|
9
|
+
import { DynamicBorder } from "$c/modes/components/dynamic-border";
|
|
10
|
+
import { PythonExecutionComponent } from "$c/modes/components/python-execution";
|
|
11
|
+
import { ReadToolGroupComponent } from "$c/modes/components/read-tool-group";
|
|
12
|
+
import { ToolExecutionComponent } from "$c/modes/components/tool-execution";
|
|
13
|
+
import { UserMessageComponent } from "$c/modes/components/user-message";
|
|
14
|
+
import { theme } from "$c/modes/theme/theme";
|
|
15
|
+
import type { CompactionQueuedMessage, InteractiveModeContext } from "$c/modes/types";
|
|
16
|
+
import type { CustomMessage } from "$c/session/messages";
|
|
17
|
+
import type { SessionContext } from "$c/session/session-manager";
|
|
19
18
|
|
|
20
19
|
type TextBlock = { type: "text"; text: string };
|
|
21
20
|
|
|
@@ -75,12 +74,9 @@ export class UiHelpers {
|
|
|
75
74
|
if (message.output) {
|
|
76
75
|
component.appendOutput(message.output);
|
|
77
76
|
}
|
|
78
|
-
component.setComplete(
|
|
79
|
-
message.
|
|
80
|
-
|
|
81
|
-
message.truncated ? ({ truncated: true } as TruncationResult) : undefined,
|
|
82
|
-
message.fullOutputPath,
|
|
83
|
-
);
|
|
77
|
+
component.setComplete(message.exitCode, message.cancelled, {
|
|
78
|
+
truncation: message.meta?.truncation,
|
|
79
|
+
});
|
|
84
80
|
this.ctx.chatContainer.addChild(component);
|
|
85
81
|
break;
|
|
86
82
|
}
|
|
@@ -89,12 +85,9 @@ export class UiHelpers {
|
|
|
89
85
|
if (message.output) {
|
|
90
86
|
component.appendOutput(message.output);
|
|
91
87
|
}
|
|
92
|
-
component.setComplete(
|
|
93
|
-
message.
|
|
94
|
-
|
|
95
|
-
message.truncated ? ({ truncated: true } as TruncationResult) : undefined,
|
|
96
|
-
message.fullOutputPath,
|
|
97
|
-
);
|
|
88
|
+
component.setComplete(message.exitCode, message.cancelled, {
|
|
89
|
+
truncation: message.meta?.truncation,
|
|
90
|
+
});
|
|
98
91
|
this.ctx.chatContainer.addChild(component);
|
|
99
92
|
break;
|
|
100
93
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { mkdirSync, unlinkSync } from "node:fs";
|
|
9
9
|
import { dirname } from "node:path";
|
|
10
|
-
import { resolveToCwd } from "
|
|
10
|
+
import { resolveToCwd } from "$c/tools/path-utils";
|
|
11
11
|
import { DEFAULT_FUZZY_THRESHOLD, findContextLine, findMatch, seekSequence } from "./fuzzy";
|
|
12
12
|
import {
|
|
13
13
|
adjustIndentation,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as Diff from "diff";
|
|
9
|
-
import { resolveToCwd } from "
|
|
9
|
+
import { resolveToCwd } from "$c/tools/path-utils";
|
|
10
10
|
import { previewPatch } from "./applicator";
|
|
11
11
|
import { DEFAULT_FUZZY_THRESHOLD, findMatch } from "./fuzzy";
|
|
12
12
|
import { adjustIndentation, normalizeToLF, stripBom } from "./normalize";
|
|
@@ -12,18 +12,19 @@ import { mkdir } from "node:fs/promises";
|
|
|
12
12
|
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
13
13
|
import { StringEnum } from "@oh-my-pi/pi-ai";
|
|
14
14
|
import { Type } from "@sinclair/typebox";
|
|
15
|
-
import
|
|
16
|
-
import replaceDescription from "../../../prompts/tools/replace.md" with { type: "text" };
|
|
17
|
-
import { renderPromptTemplate } from "../../prompt-templates";
|
|
18
|
-
import type { ToolSession } from "../index";
|
|
15
|
+
import { renderPromptTemplate } from "$c/config/prompt-templates";
|
|
19
16
|
import {
|
|
20
17
|
createLspWritethrough,
|
|
21
18
|
type FileDiagnosticsResult,
|
|
22
19
|
flushLspWritethroughBatch,
|
|
23
20
|
type WritethroughCallback,
|
|
24
21
|
writethroughNoop,
|
|
25
|
-
} from "
|
|
26
|
-
import
|
|
22
|
+
} from "$c/lsp/index";
|
|
23
|
+
import patchDescription from "$c/prompts/tools/patch.md" with { type: "text" };
|
|
24
|
+
import replaceDescription from "$c/prompts/tools/replace.md" with { type: "text" };
|
|
25
|
+
import type { ToolSession } from "$c/tools/index";
|
|
26
|
+
import { outputMeta } from "$c/tools/output-meta";
|
|
27
|
+
import { resolveToCwd } from "$c/tools/path-utils";
|
|
27
28
|
import { applyPatch } from "./applicator";
|
|
28
29
|
import { generateDiffString, generateUnifiedDiffString, replaceText } from "./diff";
|
|
29
30
|
import { DEFAULT_FUZZY_THRESHOLD, findMatch } from "./fuzzy";
|
|
@@ -90,30 +91,24 @@ export { ApplyPatchError, EditMatchError, ParseError } from "./types";
|
|
|
90
91
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
91
92
|
|
|
92
93
|
const replaceEditSchema = Type.Object({
|
|
93
|
-
path: Type.String({ description: "
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}),
|
|
97
|
-
newText: Type.String({ description: "New text to replace the old text with" }),
|
|
98
|
-
all: Type.Optional(Type.Boolean({ description: "Replace all occurrences instead of requiring unique match" })),
|
|
94
|
+
path: Type.String({ description: "File path (relative or absolute)" }),
|
|
95
|
+
old_text: Type.String({ description: "Text to find (fuzzy whitespace matching enabled)" }),
|
|
96
|
+
new_text: Type.String({ description: "Replacement text" }),
|
|
97
|
+
all: Type.Optional(Type.Boolean({ description: "Replace all occurrences (default: unique match required)" })),
|
|
99
98
|
});
|
|
100
99
|
|
|
101
100
|
const patchEditSchema = Type.Object({
|
|
102
|
-
path: Type.String({ description: "
|
|
101
|
+
path: Type.String({ description: "File path" }),
|
|
103
102
|
op: Type.Optional(
|
|
104
103
|
StringEnum(["create", "delete", "update"], {
|
|
105
|
-
description: "
|
|
106
|
-
}),
|
|
107
|
-
),
|
|
108
|
-
rename: Type.Optional(Type.String({ description: "New path, if moving" })),
|
|
109
|
-
diff: Type.Optional(
|
|
110
|
-
Type.String({
|
|
111
|
-
description: "Diff hunk(s) for update. Full content for create.",
|
|
104
|
+
description: "Operation (default: update)",
|
|
112
105
|
}),
|
|
113
106
|
),
|
|
107
|
+
rename: Type.Optional(Type.String({ description: "New path for move" })),
|
|
108
|
+
diff: Type.Optional(Type.String({ description: "Diff hunks (update) or full content (create)" })),
|
|
114
109
|
});
|
|
115
110
|
|
|
116
|
-
export type ReplaceParams = { path: string;
|
|
111
|
+
export type ReplaceParams = { path: string; old_text: string; new_text: string; all?: boolean };
|
|
117
112
|
export type PatchParams = { path: string; op?: string; rename?: string; diff?: string };
|
|
118
113
|
|
|
119
114
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -331,10 +326,10 @@ export class EditTool implements AgentTool<TInput> {
|
|
|
331
326
|
const flushedDiagnostics = await flushLspWritethroughBatch(batchRequest.id, this.session.cwd, signal);
|
|
332
327
|
diagnostics ??= flushedDiagnostics;
|
|
333
328
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
329
|
+
|
|
330
|
+
const meta = outputMeta()
|
|
331
|
+
.diagnostics(diagnostics?.summary ?? "", diagnostics?.messages ?? [])
|
|
332
|
+
.get();
|
|
338
333
|
|
|
339
334
|
return {
|
|
340
335
|
content: [{ type: "text", text: resultText }],
|
|
@@ -344,6 +339,7 @@ export class EditTool implements AgentTool<TInput> {
|
|
|
344
339
|
diagnostics,
|
|
345
340
|
op,
|
|
346
341
|
rename: effRename,
|
|
342
|
+
meta,
|
|
347
343
|
},
|
|
348
344
|
$normative: normative,
|
|
349
345
|
};
|
|
@@ -352,14 +348,14 @@ export class EditTool implements AgentTool<TInput> {
|
|
|
352
348
|
// ─────────────────────────────────────────────────────────────────
|
|
353
349
|
// Replace mode execution
|
|
354
350
|
// ─────────────────────────────────────────────────────────────────
|
|
355
|
-
const { path,
|
|
351
|
+
const { path, old_text, new_text, all } = params as ReplaceParams;
|
|
356
352
|
|
|
357
353
|
if (path.endsWith(".ipynb")) {
|
|
358
354
|
throw new Error("Cannot edit Jupyter notebooks with the Edit tool. Use the NotebookEdit tool instead.");
|
|
359
355
|
}
|
|
360
356
|
|
|
361
|
-
if (
|
|
362
|
-
throw new Error("
|
|
357
|
+
if (old_text.length === 0) {
|
|
358
|
+
throw new Error("old_text must not be empty.");
|
|
363
359
|
}
|
|
364
360
|
|
|
365
361
|
const absolutePath = resolveToCwd(path, this.session.cwd);
|
|
@@ -373,8 +369,8 @@ export class EditTool implements AgentTool<TInput> {
|
|
|
373
369
|
const { bom, text: content } = stripBom(rawContent);
|
|
374
370
|
const originalEnding = detectLineEnding(content);
|
|
375
371
|
const normalizedContent = normalizeToLF(content);
|
|
376
|
-
const normalizedOldText = normalizeToLF(
|
|
377
|
-
const normalizedNewText = normalizeToLF(
|
|
372
|
+
const normalizedOldText = normalizeToLF(old_text);
|
|
373
|
+
const normalizedNewText = normalizeToLF(new_text);
|
|
378
374
|
|
|
379
375
|
const result = replaceText(normalizedContent, normalizedOldText, normalizedNewText, {
|
|
380
376
|
fuzzy: this.allowFuzzy,
|
|
@@ -415,19 +411,18 @@ export class EditTool implements AgentTool<TInput> {
|
|
|
415
411
|
const diagnostics = await this.writethrough(absolutePath, finalContent, signal, file, batchRequest);
|
|
416
412
|
const diffResult = generateDiffString(normalizedContent, result.content);
|
|
417
413
|
|
|
418
|
-
|
|
414
|
+
const resultText =
|
|
419
415
|
result.count > 1
|
|
420
416
|
? `Successfully replaced ${result.count} occurrences in ${path}.`
|
|
421
417
|
: `Successfully replaced text in ${path}.`;
|
|
422
418
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
419
|
+
const meta = outputMeta()
|
|
420
|
+
.diagnostics(diagnostics?.summary ?? "", diagnostics?.messages ?? [])
|
|
421
|
+
.get();
|
|
427
422
|
|
|
428
423
|
return {
|
|
429
424
|
content: [{ type: "text", text: resultText }],
|
|
430
|
-
details: { diff: diffResult.diff, firstChangedLine: diffResult.firstChangedLine, diagnostics },
|
|
425
|
+
details: { diff: diffResult.diff, firstChangedLine: diffResult.firstChangedLine, diagnostics, meta },
|
|
431
426
|
};
|
|
432
427
|
}
|
|
433
428
|
}
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import type { ToolCallContext } from "@oh-my-pi/pi-agent-core";
|
|
6
6
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
7
7
|
import { Text } from "@oh-my-pi/pi-tui";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import type
|
|
8
|
+
import type { RenderResultOptions } from "$c/extensibility/custom-tools/types";
|
|
9
|
+
import type { FileDiagnosticsResult } from "$c/lsp/index";
|
|
10
|
+
import { renderDiff as renderDiffColored } from "$c/modes/components/diff";
|
|
11
|
+
import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme";
|
|
12
|
+
import type { OutputMeta } from "$c/tools/output-meta";
|
|
12
13
|
import {
|
|
13
14
|
formatExpandHint,
|
|
14
15
|
formatStatusIcon,
|
|
@@ -16,8 +17,8 @@ import {
|
|
|
16
17
|
shortenPath,
|
|
17
18
|
ToolUIKit,
|
|
18
19
|
truncateDiffByHunk,
|
|
19
|
-
} from "
|
|
20
|
-
import type { RenderCallOptions } from "
|
|
20
|
+
} from "$c/tools/render-utils";
|
|
21
|
+
import type { RenderCallOptions } from "$c/tools/renderers";
|
|
21
22
|
import type { DiffError, DiffResult, Operation } from "./types";
|
|
22
23
|
|
|
23
24
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -55,6 +56,8 @@ export interface EditToolDetails {
|
|
|
55
56
|
op?: Operation;
|
|
56
57
|
/** New path after move/rename (patch mode only) */
|
|
57
58
|
rename?: string;
|
|
59
|
+
/** Structured output metadata */
|
|
60
|
+
meta?: OutputMeta;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
// ═══════════════════════════════════════════════════════════════════════════
|