@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
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
6
6
|
import type { Model } from "@oh-my-pi/pi-ai";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import type { SessionManager } from "
|
|
7
|
+
import type { ModelRegistry } from "$c/config/model-registry";
|
|
8
|
+
import { theme } from "$c/modes/theme/theme";
|
|
9
|
+
import type { SessionManager } from "$c/session/session-manager";
|
|
10
10
|
import type {
|
|
11
11
|
AppendEntryHandler,
|
|
12
12
|
BranchHandler,
|
|
@@ -40,7 +40,7 @@ import type {
|
|
|
40
40
|
export type HookErrorListener = (error: HookError) => void;
|
|
41
41
|
|
|
42
42
|
// Re-export execCommand for backward compatibility
|
|
43
|
-
export { execCommand } from "
|
|
43
|
+
export { execCommand } from "$c/exec/exec";
|
|
44
44
|
|
|
45
45
|
/** No-op UI context used when no UI is available */
|
|
46
46
|
const noOpUIContext: HookUIContext = {
|
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
9
9
|
import type { ImageContent, Message, Model, TextContent, ToolResultMessage } from "@oh-my-pi/pi-ai";
|
|
10
10
|
import type { Component, TUI } from "@oh-my-pi/pi-tui";
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
11
|
+
import type { ModelRegistry } from "$c/config/model-registry";
|
|
12
|
+
import type { ExecOptions, ExecResult } from "$c/exec/exec";
|
|
13
|
+
import type { Theme } from "$c/modes/theme/theme";
|
|
14
|
+
import type { EditToolDetails } from "$c/patch";
|
|
15
|
+
import type { CompactionPreparation, CompactionResult } from "$c/session/compaction/index";
|
|
16
|
+
import type { HookMessage } from "$c/session/messages";
|
|
16
17
|
import type {
|
|
17
18
|
BranchSummaryEntry,
|
|
18
19
|
CompactionEntry,
|
|
19
20
|
ReadonlySessionManager,
|
|
20
21
|
SessionEntry,
|
|
21
22
|
SessionManager,
|
|
22
|
-
} from "
|
|
23
|
-
import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "
|
|
24
|
-
import type { EditToolDetails } from "../tools/patch";
|
|
23
|
+
} from "$c/session/session-manager";
|
|
24
|
+
import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "$c/tools/index";
|
|
25
25
|
|
|
26
26
|
// Re-export for backward compatibility
|
|
27
|
-
export type { ExecOptions, ExecResult } from "
|
|
27
|
+
export type { ExecOptions, ExecResult } from "$c/exec/exec";
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* UI context for hooks to request interactive UI from the harness.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { lstatSync, symlinkSync, unlinkSync } from "node:fs";
|
|
1
2
|
import { mkdir } from "node:fs/promises";
|
|
2
3
|
import { join, resolve } from "node:path";
|
|
3
|
-
import { getAgentDir } from "
|
|
4
|
+
import { getAgentDir } from "$c/config";
|
|
4
5
|
import type { InstalledPlugin } from "./types";
|
|
5
6
|
|
|
6
7
|
const PLUGINS_DIR = join(getAgentDir(), "plugins");
|
|
@@ -176,7 +177,6 @@ export async function linkPlugin(localPath: string): Promise<void> {
|
|
|
176
177
|
|
|
177
178
|
// Remove existing if present
|
|
178
179
|
try {
|
|
179
|
-
const { unlinkSync, lstatSync } = await import("fs");
|
|
180
180
|
const stat = lstatSync(linkPath);
|
|
181
181
|
if (stat.isSymbolicLink() || stat.isDirectory()) {
|
|
182
182
|
unlinkSync(linkPath);
|
|
@@ -186,6 +186,5 @@ export async function linkPlugin(localPath: string): Promise<void> {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
// Create symlink using fs instead of shell command
|
|
189
|
-
const { symlinkSync } = await import("fs");
|
|
190
189
|
symlinkSync(absolutePath, linkPath);
|
|
191
190
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { CONFIG_DIR_NAME, getConfigDirPaths } from "
|
|
3
|
+
import { CONFIG_DIR_NAME, getConfigDirPaths } from "$c/config";
|
|
4
4
|
|
|
5
5
|
// =============================================================================
|
|
6
6
|
// Plugin Directory Paths
|
|
@@ -2,13 +2,12 @@ import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
|
2
2
|
import { realpath } from "node:fs/promises";
|
|
3
3
|
import { basename, join } from "node:path";
|
|
4
4
|
import { logger } from "@oh-my-pi/pi-utils";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import type {
|
|
8
|
-
import type { Skill as CapabilitySkill, SkillFrontmatter as ImportedSkillFrontmatter } from "
|
|
9
|
-
import { loadCapability } from "
|
|
10
|
-
import { parseFrontmatter } from "
|
|
11
|
-
import type { SkillsSettings } from "./settings-manager";
|
|
5
|
+
import { skillCapability } from "$c/capability/skill";
|
|
6
|
+
import type { SourceMeta } from "$c/capability/types";
|
|
7
|
+
import type { SkillsSettings } from "$c/config/settings-manager";
|
|
8
|
+
import type { Skill as CapabilitySkill, SkillFrontmatter as ImportedSkillFrontmatter } from "$c/discovery";
|
|
9
|
+
import { loadCapability } from "$c/discovery";
|
|
10
|
+
import { parseFrontmatter } from "$c/utils/frontmatter";
|
|
12
11
|
|
|
13
12
|
// Re-export SkillFrontmatter for backward compatibility
|
|
14
13
|
export type { ImportedSkillFrontmatter as SkillFrontmatter };
|
|
@@ -169,45 +168,6 @@ function scanDirectoryForSkills(dir: string): LoadSkillsResult {
|
|
|
169
168
|
return { skills, warnings };
|
|
170
169
|
}
|
|
171
170
|
|
|
172
|
-
/**
|
|
173
|
-
* Format skills for inclusion in a system prompt.
|
|
174
|
-
* Uses XML format per Agent Skills standard.
|
|
175
|
-
* See: https://agentskills.io/integrate-skills
|
|
176
|
-
*/
|
|
177
|
-
export function formatSkillsForPrompt(skills: Skill[]): string {
|
|
178
|
-
if (skills.length === 0) {
|
|
179
|
-
return "";
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const lines = [
|
|
183
|
-
"\n\nThe following skills provide specialized instructions for specific tasks.",
|
|
184
|
-
"Use the read tool to load a skill's file when the task matches its description.",
|
|
185
|
-
"",
|
|
186
|
-
"<available_skills>",
|
|
187
|
-
];
|
|
188
|
-
|
|
189
|
-
for (const skill of skills) {
|
|
190
|
-
lines.push(" <skill>");
|
|
191
|
-
lines.push(` <name>${escapeXml(skill.name)}</name>`);
|
|
192
|
-
lines.push(` <description>${escapeXml(skill.description)}</description>`);
|
|
193
|
-
lines.push(` <location>${escapeXml(skill.filePath)}</location>`);
|
|
194
|
-
lines.push(" </skill>");
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
lines.push("</available_skills>");
|
|
198
|
-
|
|
199
|
-
return lines.join("\n");
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function escapeXml(str: string): string {
|
|
203
|
-
return str
|
|
204
|
-
.replace(/&/g, "&")
|
|
205
|
-
.replace(/</g, "<")
|
|
206
|
-
.replace(/>/g, ">")
|
|
207
|
-
.replace(/"/g, """)
|
|
208
|
-
.replace(/'/g, "'");
|
|
209
|
-
}
|
|
210
|
-
|
|
211
171
|
export interface LoadSkillsOptions extends SkillsSettings {
|
|
212
172
|
/** Working directory for project-local skills. Default: process.cwd() */
|
|
213
173
|
cwd?: string;
|
|
@@ -258,13 +218,13 @@ export async function loadSkills(options: LoadSkillsOptions = {}): Promise<LoadS
|
|
|
258
218
|
// Check if skill name matches any of the include patterns
|
|
259
219
|
function matchesIncludePatterns(name: string): boolean {
|
|
260
220
|
if (includeSkills.length === 0) return true;
|
|
261
|
-
return includeSkills.some((pattern) =>
|
|
221
|
+
return includeSkills.some((pattern) => new Bun.Glob(pattern).match(name));
|
|
262
222
|
}
|
|
263
223
|
|
|
264
224
|
// Check if skill name matches any of the ignore patterns
|
|
265
225
|
function matchesIgnorePatterns(name: string): boolean {
|
|
266
226
|
if (ignoredSkills.length === 0) return false;
|
|
267
|
-
return ignoredSkills.some((pattern) =>
|
|
227
|
+
return ignoredSkills.some((pattern) => new Bun.Glob(pattern).match(name));
|
|
268
228
|
}
|
|
269
229
|
|
|
270
230
|
// Filter skills by source and patterns first
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { slashCommandCapability } from "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { slashCommandCapability } from "$c/capability/slash-command";
|
|
2
|
+
import { renderPromptTemplate } from "$c/config/prompt-templates";
|
|
3
|
+
import type { SlashCommand } from "$c/discovery";
|
|
4
|
+
import { loadCapability } from "$c/discovery";
|
|
5
|
+
import { EMBEDDED_COMMAND_TEMPLATES } from "$c/task/commands";
|
|
6
|
+
import { parseFrontmatter } from "$c/utils/frontmatter";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Represents a custom slash command loaded from a file
|
package/src/index.ts
CHANGED
|
@@ -7,41 +7,66 @@ export { StringEnum } from "@oh-my-pi/pi-ai";
|
|
|
7
7
|
export { Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui";
|
|
8
8
|
// Logging
|
|
9
9
|
export { logger } from "@oh-my-pi/pi-utils";
|
|
10
|
-
export {
|
|
10
|
+
export type { FileDiagnosticsResult } from "$c/lsp/index";
|
|
11
|
+
// UI components for extensions
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
ArminComponent,
|
|
14
|
+
AssistantMessageComponent,
|
|
15
|
+
BashExecutionComponent,
|
|
16
|
+
BorderedLoader,
|
|
17
|
+
BranchSummaryMessageComponent,
|
|
18
|
+
CompactionSummaryMessageComponent,
|
|
19
|
+
CustomEditor,
|
|
20
|
+
CustomMessageComponent,
|
|
21
|
+
DynamicBorder,
|
|
22
|
+
FooterComponent,
|
|
23
|
+
HookEditorComponent as ExtensionEditorComponent,
|
|
24
|
+
HookInputComponent as ExtensionInputComponent,
|
|
25
|
+
HookSelectorComponent as ExtensionSelectorComponent,
|
|
26
|
+
LoginDialogComponent,
|
|
27
|
+
ModelSelectorComponent,
|
|
28
|
+
OAuthSelectorComponent,
|
|
29
|
+
type RenderDiffOptions,
|
|
30
|
+
renderDiff,
|
|
31
|
+
SessionSelectorComponent,
|
|
32
|
+
type SettingsCallbacks,
|
|
33
|
+
SettingsSelectorComponent,
|
|
34
|
+
ShowImagesSelectorComponent,
|
|
35
|
+
ThemeSelectorComponent,
|
|
36
|
+
ThinkingSelectorComponent,
|
|
37
|
+
ToolExecutionComponent,
|
|
38
|
+
type ToolExecutionOptions,
|
|
39
|
+
TreeSelectorComponent,
|
|
40
|
+
truncateToVisualLines,
|
|
41
|
+
UserMessageComponent,
|
|
42
|
+
UserMessageSelectorComponent,
|
|
43
|
+
type VisualTruncateResult,
|
|
44
|
+
} from "$c/modes/components/index";
|
|
45
|
+
// Theme utilities for custom tools
|
|
23
46
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
getLanguageFromPath,
|
|
48
|
+
getMarkdownTheme,
|
|
49
|
+
getSelectListTheme,
|
|
50
|
+
getSettingsListTheme,
|
|
51
|
+
highlightCode,
|
|
52
|
+
initTheme,
|
|
53
|
+
Theme,
|
|
54
|
+
type ThemeColor,
|
|
55
|
+
} from "$c/modes/theme/theme";
|
|
56
|
+
export { getAgentDir, VERSION } from "./config";
|
|
57
|
+
export { formatKeyHint, formatKeyHints } from "./config/keybindings";
|
|
58
|
+
export { ModelRegistry } from "./config/model-registry";
|
|
59
|
+
// Prompt templates
|
|
60
|
+
export type { PromptTemplate } from "./config/prompt-templates";
|
|
61
|
+
export {
|
|
62
|
+
type CompactionSettings,
|
|
63
|
+
type ImageSettings,
|
|
64
|
+
type LspSettings,
|
|
65
|
+
type RetrySettings,
|
|
66
|
+
type Settings,
|
|
67
|
+
SettingsManager,
|
|
68
|
+
type SkillsSettings,
|
|
69
|
+
} from "./config/settings-manager";
|
|
45
70
|
// Custom commands
|
|
46
71
|
export type {
|
|
47
72
|
CustomCommand,
|
|
@@ -50,7 +75,7 @@ export type {
|
|
|
50
75
|
CustomCommandSource,
|
|
51
76
|
CustomCommandsLoadResult,
|
|
52
77
|
LoadedCustomCommand,
|
|
53
|
-
} from "./
|
|
78
|
+
} from "./extensibility/custom-commands/types";
|
|
54
79
|
export type {
|
|
55
80
|
AgentToolUpdateCallback,
|
|
56
81
|
CustomTool,
|
|
@@ -63,9 +88,9 @@ export type {
|
|
|
63
88
|
ExecResult,
|
|
64
89
|
LoadedCustomTool,
|
|
65
90
|
RenderResultOptions,
|
|
66
|
-
} from "./
|
|
91
|
+
} from "./extensibility/custom-tools/index";
|
|
67
92
|
// Custom tools
|
|
68
|
-
export { CustomToolLoader, discoverAndLoadCustomTools, loadCustomTools } from "./
|
|
93
|
+
export { CustomToolLoader, discoverAndLoadCustomTools, loadCustomTools } from "./extensibility/custom-tools/index";
|
|
69
94
|
export type {
|
|
70
95
|
AppAction,
|
|
71
96
|
Extension,
|
|
@@ -97,7 +122,7 @@ export type {
|
|
|
97
122
|
UserBashEventResult,
|
|
98
123
|
UserPythonEvent,
|
|
99
124
|
UserPythonEventResult,
|
|
100
|
-
} from "./
|
|
125
|
+
} from "./extensibility/extensions/index";
|
|
101
126
|
// Extension types and utilities
|
|
102
127
|
export {
|
|
103
128
|
discoverAndLoadExtensions,
|
|
@@ -110,14 +135,34 @@ export {
|
|
|
110
135
|
isLsToolResult,
|
|
111
136
|
isReadToolResult,
|
|
112
137
|
isWriteToolResult,
|
|
113
|
-
} from "./
|
|
138
|
+
} from "./extensibility/extensions/index";
|
|
114
139
|
// Hook system types (legacy re-export)
|
|
115
|
-
export type * from "./
|
|
116
|
-
|
|
117
|
-
export {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
140
|
+
export type * from "./extensibility/hooks/index";
|
|
141
|
+
// Skills
|
|
142
|
+
export {
|
|
143
|
+
type LoadSkillsFromDirOptions,
|
|
144
|
+
type LoadSkillsResult,
|
|
145
|
+
loadSkills,
|
|
146
|
+
loadSkillsFromDir,
|
|
147
|
+
type Skill,
|
|
148
|
+
type SkillFrontmatter,
|
|
149
|
+
type SkillWarning,
|
|
150
|
+
} from "./extensibility/skills";
|
|
151
|
+
// Slash commands
|
|
152
|
+
export { type FileSlashCommand, loadSlashCommands as discoverSlashCommands } from "./extensibility/slash-commands";
|
|
153
|
+
// Main entry point
|
|
154
|
+
export { main } from "./main";
|
|
155
|
+
// Run modes for programmatic SDK usage
|
|
156
|
+
export {
|
|
157
|
+
InteractiveMode,
|
|
158
|
+
type InteractiveModeOptions,
|
|
159
|
+
type PrintModeOptions,
|
|
160
|
+
RpcClient,
|
|
161
|
+
type RpcClientOptions,
|
|
162
|
+
type RpcEventListener,
|
|
163
|
+
runPrintMode,
|
|
164
|
+
runRpcMode,
|
|
165
|
+
} from "./modes/index";
|
|
121
166
|
// SDK for programmatic usage
|
|
122
167
|
export {
|
|
123
168
|
// Factory
|
|
@@ -149,7 +194,42 @@ export {
|
|
|
149
194
|
ReadTool,
|
|
150
195
|
type ToolSession,
|
|
151
196
|
WriteTool,
|
|
152
|
-
} from "./
|
|
197
|
+
} from "./sdk";
|
|
198
|
+
export {
|
|
199
|
+
AgentSession,
|
|
200
|
+
type AgentSessionConfig,
|
|
201
|
+
type AgentSessionEvent,
|
|
202
|
+
type AgentSessionEventListener,
|
|
203
|
+
type ModelCycleResult,
|
|
204
|
+
type PromptOptions,
|
|
205
|
+
type SessionStats,
|
|
206
|
+
} from "./session/agent-session";
|
|
207
|
+
// Auth and model registry
|
|
208
|
+
export { type ApiKeyCredential, type AuthCredential, AuthStorage, type OAuthCredential } from "./session/auth-storage";
|
|
209
|
+
// Compaction
|
|
210
|
+
export {
|
|
211
|
+
type BranchPreparation,
|
|
212
|
+
type BranchSummaryResult,
|
|
213
|
+
type CollectEntriesResult,
|
|
214
|
+
type CompactionResult,
|
|
215
|
+
type CutPointResult,
|
|
216
|
+
calculateContextTokens,
|
|
217
|
+
collectEntriesForBranchSummary,
|
|
218
|
+
compact,
|
|
219
|
+
DEFAULT_COMPACTION_SETTINGS,
|
|
220
|
+
estimateTokens,
|
|
221
|
+
type FileOperations,
|
|
222
|
+
findCutPoint,
|
|
223
|
+
findTurnStartIndex,
|
|
224
|
+
type GenerateBranchSummaryOptions,
|
|
225
|
+
generateBranchSummary,
|
|
226
|
+
generateSummary,
|
|
227
|
+
getLastAssistantUsage,
|
|
228
|
+
prepareBranchEntries,
|
|
229
|
+
serializeConversation,
|
|
230
|
+
shouldCompact,
|
|
231
|
+
} from "./session/compaction/index";
|
|
232
|
+
export { convertToLlm } from "./session/messages";
|
|
153
233
|
export {
|
|
154
234
|
type BranchSummaryEntry,
|
|
155
235
|
buildSessionContext,
|
|
@@ -171,29 +251,7 @@ export {
|
|
|
171
251
|
SessionManager,
|
|
172
252
|
type SessionMessageEntry,
|
|
173
253
|
type ThinkingLevelChangeEntry,
|
|
174
|
-
} from "./
|
|
175
|
-
export {
|
|
176
|
-
type CompactionSettings,
|
|
177
|
-
type ImageSettings,
|
|
178
|
-
type LspSettings,
|
|
179
|
-
type RetrySettings,
|
|
180
|
-
type Settings,
|
|
181
|
-
SettingsManager,
|
|
182
|
-
type SkillsSettings,
|
|
183
|
-
} from "./core/settings-manager";
|
|
184
|
-
// Skills
|
|
185
|
-
export {
|
|
186
|
-
formatSkillsForPrompt,
|
|
187
|
-
type LoadSkillsFromDirOptions,
|
|
188
|
-
type LoadSkillsResult,
|
|
189
|
-
loadSkills,
|
|
190
|
-
loadSkillsFromDir,
|
|
191
|
-
type Skill,
|
|
192
|
-
type SkillFrontmatter,
|
|
193
|
-
type SkillWarning,
|
|
194
|
-
} from "./core/skills";
|
|
195
|
-
// Slash commands
|
|
196
|
-
export { type FileSlashCommand, loadSlashCommands as discoverSlashCommands } from "./core/slash-commands";
|
|
254
|
+
} from "./session/session-manager";
|
|
197
255
|
// Tools (detail types and utilities)
|
|
198
256
|
export {
|
|
199
257
|
type BashToolDetails,
|
|
@@ -217,64 +275,5 @@ export {
|
|
|
217
275
|
truncateLine,
|
|
218
276
|
truncateTail,
|
|
219
277
|
type WriteToolDetails,
|
|
220
|
-
} from "./
|
|
221
|
-
export type { FileDiagnosticsResult } from "./core/tools/lsp/index";
|
|
222
|
-
// Main entry point
|
|
223
|
-
export { main } from "./main";
|
|
224
|
-
// Run modes for programmatic SDK usage
|
|
225
|
-
export {
|
|
226
|
-
InteractiveMode,
|
|
227
|
-
type InteractiveModeOptions,
|
|
228
|
-
type PrintModeOptions,
|
|
229
|
-
RpcClient,
|
|
230
|
-
type RpcClientOptions,
|
|
231
|
-
type RpcEventListener,
|
|
232
|
-
runPrintMode,
|
|
233
|
-
runRpcMode,
|
|
234
|
-
} from "./modes/index";
|
|
235
|
-
// UI components for extensions
|
|
236
|
-
export {
|
|
237
|
-
ArminComponent,
|
|
238
|
-
AssistantMessageComponent,
|
|
239
|
-
BashExecutionComponent,
|
|
240
|
-
BorderedLoader,
|
|
241
|
-
BranchSummaryMessageComponent,
|
|
242
|
-
CompactionSummaryMessageComponent,
|
|
243
|
-
CustomEditor,
|
|
244
|
-
CustomMessageComponent,
|
|
245
|
-
DynamicBorder,
|
|
246
|
-
FooterComponent,
|
|
247
|
-
HookEditorComponent as ExtensionEditorComponent,
|
|
248
|
-
HookInputComponent as ExtensionInputComponent,
|
|
249
|
-
HookSelectorComponent as ExtensionSelectorComponent,
|
|
250
|
-
LoginDialogComponent,
|
|
251
|
-
ModelSelectorComponent,
|
|
252
|
-
OAuthSelectorComponent,
|
|
253
|
-
type RenderDiffOptions,
|
|
254
|
-
renderDiff,
|
|
255
|
-
SessionSelectorComponent,
|
|
256
|
-
type SettingsCallbacks,
|
|
257
|
-
SettingsSelectorComponent,
|
|
258
|
-
ShowImagesSelectorComponent,
|
|
259
|
-
ThemeSelectorComponent,
|
|
260
|
-
ThinkingSelectorComponent,
|
|
261
|
-
ToolExecutionComponent,
|
|
262
|
-
type ToolExecutionOptions,
|
|
263
|
-
TreeSelectorComponent,
|
|
264
|
-
truncateToVisualLines,
|
|
265
|
-
UserMessageComponent,
|
|
266
|
-
UserMessageSelectorComponent,
|
|
267
|
-
type VisualTruncateResult,
|
|
268
|
-
} from "./modes/interactive/components/index";
|
|
269
|
-
// Theme utilities for custom tools
|
|
270
|
-
export {
|
|
271
|
-
getLanguageFromPath,
|
|
272
|
-
getMarkdownTheme,
|
|
273
|
-
getSelectListTheme,
|
|
274
|
-
getSettingsListTheme,
|
|
275
|
-
highlightCode,
|
|
276
|
-
initTheme,
|
|
277
|
-
Theme,
|
|
278
|
-
type ThemeColor,
|
|
279
|
-
} from "./modes/interactive/theme/theme";
|
|
278
|
+
} from "./tools/index";
|
|
280
279
|
export { getShellConfig } from "./utils/shell";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol handler for agent:// URLs.
|
|
3
|
+
*
|
|
4
|
+
* Resolves agent output IDs to artifact files in the session directory.
|
|
5
|
+
*
|
|
6
|
+
* URL forms:
|
|
7
|
+
* - agent://<id> - Full output content
|
|
8
|
+
* - agent://<id>/<path> - JSON extraction via path form
|
|
9
|
+
* - agent://<id>?q=<query> - JSON extraction via query form
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import * as fs from "node:fs";
|
|
13
|
+
import * as path from "node:path";
|
|
14
|
+
import { applyQuery, pathToQuery } from "./json-query";
|
|
15
|
+
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
|
16
|
+
|
|
17
|
+
export interface AgentProtocolOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Returns the artifacts directory path, or null if no session.
|
|
20
|
+
* Artifacts directory is the session file path without .jsonl extension.
|
|
21
|
+
*/
|
|
22
|
+
getArtifactsDir: () => string | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* List available output IDs in artifacts directory.
|
|
27
|
+
*/
|
|
28
|
+
function listAvailableOutputs(artifactsDir: string): string[] {
|
|
29
|
+
try {
|
|
30
|
+
const files = fs.readdirSync(artifactsDir);
|
|
31
|
+
return files.filter((f) => f.endsWith(".md")).map((f) => f.replace(".md", ""));
|
|
32
|
+
} catch {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Handler for agent:// URLs.
|
|
39
|
+
*
|
|
40
|
+
* Resolves output IDs like "reviewer_0" to their artifact files,
|
|
41
|
+
* with optional JSON extraction.
|
|
42
|
+
*/
|
|
43
|
+
export class AgentProtocolHandler implements ProtocolHandler {
|
|
44
|
+
readonly scheme = "agent";
|
|
45
|
+
|
|
46
|
+
constructor(private readonly options: AgentProtocolOptions) {}
|
|
47
|
+
|
|
48
|
+
async resolve(url: InternalUrl): Promise<InternalResource> {
|
|
49
|
+
const artifactsDir = this.options.getArtifactsDir();
|
|
50
|
+
if (!artifactsDir) {
|
|
51
|
+
throw new Error("No session - agent outputs unavailable");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!fs.existsSync(artifactsDir)) {
|
|
55
|
+
throw new Error("No artifacts directory found");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Extract output ID from host
|
|
59
|
+
const outputId = url.rawHost || url.hostname;
|
|
60
|
+
if (!outputId) {
|
|
61
|
+
throw new Error("agent:// URL requires an output ID: agent://<id>");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Check for conflicting extraction methods
|
|
65
|
+
const urlPath = url.pathname;
|
|
66
|
+
const queryParam = url.searchParams.get("q");
|
|
67
|
+
const hasPathExtraction = urlPath && urlPath !== "/" && urlPath !== "";
|
|
68
|
+
const hasQueryExtraction = queryParam !== null && queryParam !== "";
|
|
69
|
+
|
|
70
|
+
if (hasPathExtraction && hasQueryExtraction) {
|
|
71
|
+
throw new Error("agent:// URL cannot combine path extraction with ?q=");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Load the output file
|
|
75
|
+
const outputPath = path.join(artifactsDir, `${outputId}.md`);
|
|
76
|
+
if (!fs.existsSync(outputPath)) {
|
|
77
|
+
const available = listAvailableOutputs(artifactsDir);
|
|
78
|
+
const availableStr = available.length > 0 ? available.join(", ") : "none";
|
|
79
|
+
throw new Error(`Not found: ${outputId}\nAvailable: ${availableStr}`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const rawContent = await Bun.file(outputPath).text();
|
|
83
|
+
const notes: string[] = [];
|
|
84
|
+
|
|
85
|
+
// Handle extraction
|
|
86
|
+
let content = rawContent;
|
|
87
|
+
let contentType: InternalResource["contentType"] = "text/markdown";
|
|
88
|
+
|
|
89
|
+
if (hasPathExtraction || hasQueryExtraction) {
|
|
90
|
+
// Parse JSON
|
|
91
|
+
let jsonValue: unknown;
|
|
92
|
+
try {
|
|
93
|
+
jsonValue = JSON.parse(rawContent);
|
|
94
|
+
} catch (err) {
|
|
95
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
96
|
+
throw new Error(`Output ${outputId} is not valid JSON: ${message}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Convert path to query if needed
|
|
100
|
+
const query = hasPathExtraction ? pathToQuery(urlPath) : queryParam!;
|
|
101
|
+
|
|
102
|
+
if (query) {
|
|
103
|
+
const extracted = applyQuery(jsonValue, query);
|
|
104
|
+
try {
|
|
105
|
+
content = JSON.stringify(extracted, null, 2) ?? "null";
|
|
106
|
+
} catch {
|
|
107
|
+
content = String(extracted);
|
|
108
|
+
}
|
|
109
|
+
notes.push(`Extracted: ${query}`);
|
|
110
|
+
} else {
|
|
111
|
+
// Empty path/query means return full JSON
|
|
112
|
+
content = JSON.stringify(jsonValue, null, 2);
|
|
113
|
+
}
|
|
114
|
+
contentType = "application/json";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
url: url.href,
|
|
119
|
+
content,
|
|
120
|
+
contentType,
|
|
121
|
+
size: Buffer.byteLength(content, "utf-8"),
|
|
122
|
+
sourcePath: outputPath,
|
|
123
|
+
notes,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|