From cb5bbbf382d219f73c3be92c41763b7e227958e3 Mon Sep 17 00:00:00 2001 From: can1357 Date: Fri, 23 Jan 2026 12:05:24 +0100 Subject: [PATCH] refactor(coding-agent): flattened directory structure, eliminated core/ folder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Eliminated core/ directory (252 files, 23 subdirs → distributed) - Reduced max nesting from 9 levels to 5 levels - Promoted tool subdirs to top level: exa/, lsp/, patch/, task/, web/ - Merged web-scrapers/ + web-search/ into web/{scrapers,search}/ - Flattened modes/interactive/ to modes/ - Split execution/ into: ipy/ (python), exec/ (bash), ssh/ - Renamed ipy/python-*.ts to ipy/*.ts (executor, kernel, etc.) - Flattened cursor/exec-bridge.ts to cursor.ts - Created logical groupings: config/, session/, extensibility/, export/ - Updated all imports across 500+ files --- packages/coding-agent/DEVELOPMENT.md | 381 +++++++++------ packages/coding-agent/src/cli/args.ts | 2 +- packages/coding-agent/src/cli/config-cli.ts | 6 +- .../coding-agent/src/cli/file-processor.ts | 2 +- packages/coding-agent/src/cli/list-models.ts | 2 +- packages/coding-agent/src/cli/plugin-cli.ts | 4 +- .../coding-agent/src/cli/session-picker.ts | 4 +- packages/coding-agent/src/cli/setup-cli.ts | 2 +- packages/coding-agent/src/cli/update-cli.ts | 2 +- .../src/{core => config}/keybindings.ts | 0 .../src/{core => config}/model-registry.ts | 2 +- .../src/{core => config}/model-resolver.ts | 0 .../src/{core => config}/prompt-templates.ts | 2 +- .../src/{core => config}/settings-manager.ts | 4 +- packages/coding-agent/src/core/index.ts | 71 --- .../coding-agent/src/core/python-prelude.ts | 3 - .../coding-agent/src/core/ssh-executor.ts | 5 - .../{core/cursor/exec-bridge.ts => cursor.ts} | 2 +- .../coding-agent/src/discovery/builtin.ts | 2 +- packages/coding-agent/src/discovery/cline.ts | 2 +- packages/coding-agent/src/discovery/codex.ts | 2 +- packages/coding-agent/src/discovery/cursor.ts | 2 +- packages/coding-agent/src/discovery/github.ts | 2 +- .../coding-agent/src/discovery/helpers.ts | 2 +- .../coding-agent/src/discovery/windsurf.ts | 2 +- .../src/{core/tools => }/exa/company.ts | 2 +- .../src/{core/tools => }/exa/index.ts | 4 +- .../src/{core/tools => }/exa/linkedin.ts | 2 +- .../src/{core/tools => }/exa/mcp-client.ts | 4 +- .../src/{core/tools => }/exa/render.ts | 6 +- .../src/{core/tools => }/exa/researcher.ts | 2 +- .../src/{core/tools => }/exa/search.ts | 2 +- .../src/{core/tools => }/exa/types.ts | 0 .../src/{core/tools => }/exa/websets.ts | 2 +- .../src/{core => exec}/bash-executor.ts | 2 +- .../coding-agent/src/{core => exec}/exec.ts | 0 .../src/{core => export}/custom-share.ts | 0 .../export-html => export/html}/index.ts | 4 +- .../export-html => export/html}/template.css | 0 .../src/export/html/template.generated.ts | 2 + .../export-html => export/html}/template.html | 0 .../export-html => export/html}/template.js | 0 .../html}/template.macro.ts | 0 .../html}/vendor/highlight.min.js | 0 .../html}/vendor/marked.min.js | 0 .../coding-agent/src/{core => export}/ttsr.ts | 2 +- .../custom-commands/bundled/review/index.ts | 6 +- .../custom-commands/index.ts | 0 .../custom-commands/loader.ts | 2 +- .../custom-commands/types.ts | 2 +- .../custom-tools/index.ts | 0 .../custom-tools/loader.ts | 10 +- .../custom-tools/types.ts | 12 +- .../custom-tools/wrapper.ts | 2 +- .../extensions/index.ts | 0 .../extensions/loader.ts | 8 +- .../extensions/runner.ts | 6 +- .../extensions/types.ts | 30 +- .../extensions/wrapper.ts | 2 +- .../{core => extensibility}/hooks/index.ts | 2 +- .../{core => extensibility}/hooks/loader.ts | 4 +- .../{core => extensibility}/hooks/runner.ts | 8 +- .../hooks/tool-wrapper.ts | 0 .../{core => extensibility}/hooks/types.ts | 24 +- .../{core => extensibility}/plugins/doctor.ts | 2 +- .../{core => extensibility}/plugins/index.ts | 0 .../plugins/installer.ts | 0 .../{core => extensibility}/plugins/loader.ts | 0 .../plugins/manager.ts | 0 .../{core => extensibility}/plugins/parser.ts | 0 .../{core => extensibility}/plugins/paths.ts | 0 .../{core => extensibility}/plugins/types.ts | 0 .../src/{core => extensibility}/skills.ts | 4 +- .../{core => extensibility}/slash-commands.ts | 6 +- packages/coding-agent/src/index.ts | 452 +++++++++--------- .../internal-urls/agent-protocol.ts | 0 .../internal-urls/artifact-protocol.ts | 0 .../src/{core => }/internal-urls/index.ts | 0 .../{core => }/internal-urls/json-query.ts | 0 .../src/{core => }/internal-urls/router.ts | 0 .../{core => }/internal-urls/rule-protocol.ts | 0 .../internal-urls/skill-protocol.ts | 2 +- .../src/{core => }/internal-urls/types.ts | 0 .../python-executor.ts => ipy/executor.ts} | 4 +- .../gateway-coordinator.ts} | 0 .../{core/python-kernel.ts => ipy/kernel.ts} | 8 +- .../python-modules.ts => ipy/modules.ts} | 0 .../python-prelude.py => ipy/prelude.py} | 0 packages/coding-agent/src/ipy/prelude.ts | 3 + .../src/{core/tools => }/lsp/client.ts | 2 +- .../tools => }/lsp/clients/biome-client.ts | 2 +- .../src/{core/tools => }/lsp/clients/index.ts | 2 +- .../lsp/clients/lsp-linter-client.ts | 8 +- .../src/{core/tools => }/lsp/config.ts | 0 .../src/{core/tools => }/lsp/defaults.json | 0 .../src/{core/tools => }/lsp/edits.ts | 0 .../src/{core/tools => }/lsp/index.ts | 10 +- .../src/{core/tools => }/lsp/lspmux.ts | 0 .../src/{core/tools => }/lsp/render.ts | 4 +- .../src/{core/tools => }/lsp/rust-analyzer.ts | 0 .../src/{core/tools => }/lsp/types.ts | 0 .../src/{core/tools => }/lsp/utils.ts | 2 +- packages/coding-agent/src/main.ts | 24 +- .../coding-agent/src/{core => }/mcp/client.ts | 0 .../coding-agent/src/{core => }/mcp/config.ts | 10 +- .../coding-agent/src/{core => }/mcp/index.ts | 0 .../src/{core => }/mcp/json-rpc.ts | 0 .../coding-agent/src/{core => }/mcp/loader.ts | 4 +- .../src/{core => }/mcp/manager.ts | 4 +- .../src/{core => }/mcp/tool-bridge.ts | 2 +- .../src/{core => }/mcp/tool-cache.ts | 2 +- .../src/{core => }/mcp/transports/http.ts | 2 +- .../src/{core => }/mcp/transports/index.ts | 0 .../src/{core => }/mcp/transports/stdio.ts | 2 +- .../coding-agent/src/{core => }/mcp/types.ts | 2 +- packages/coding-agent/src/migrations.ts | 4 +- .../{interactive => }/components/armin.ts | 2 +- .../components/assistant-message.ts | 2 +- .../components/bash-execution.ts | 6 +- .../components/bordered-loader.ts | 2 +- .../components/branch-summary-message.ts | 4 +- .../components/compaction-summary-message.ts | 4 +- .../components/countdown-timer.ts | 0 .../components/custom-editor.ts | 0 .../components/custom-message.ts | 6 +- .../{interactive => }/components/diff.ts | 2 +- .../components/dynamic-border.ts | 2 +- .../extensions/extension-dashboard.ts | 6 +- .../components/extensions/extension-list.ts | 2 +- .../components/extensions/index.ts | 0 .../components/extensions/inspector-panel.ts | 2 +- .../components/extensions/state-manager.ts | 0 .../components/extensions/types.ts | 0 .../{interactive => }/components/footer.ts | 6 +- .../components/history-search.ts | 4 +- .../components/hook-editor.ts | 2 +- .../components/hook-input.ts | 2 +- .../components/hook-message.ts | 6 +- .../components/hook-selector.ts | 2 +- .../{interactive => }/components/index.ts | 0 .../components/keybinding-hints.ts | 4 +- .../components/login-dialog.ts | 2 +- .../components/model-selector.ts | 8 +- .../components/oauth-selector.ts | 4 +- .../components/plugin-settings.ts | 6 +- .../components/python-execution.ts | 6 +- .../components/queue-mode-selector.ts | 2 +- .../components/read-tool-group.ts | 4 +- .../components/session-selector.ts | 4 +- .../components/settings-defs.ts | 2 +- .../components/settings-selector.ts | 4 +- .../components/show-images-selector.ts | 2 +- .../components/status-line-segment-editor.ts | 4 +- .../components/status-line.ts | 6 +- .../components/status-line/index.ts | 0 .../components/status-line/presets.ts | 0 .../components/status-line/segments.ts | 4 +- .../components/status-line/separators.ts | 2 +- .../components/status-line/types.ts | 4 +- .../components/theme-selector.ts | 2 +- .../components/thinking-selector.ts | 2 +- .../components/todo-display.ts | 4 +- .../components/todo-reminder.ts | 4 +- .../components/tool-execution.ts | 10 +- .../components/tree-selector.ts | 6 +- .../components/ttsr-notification.ts | 2 +- .../components/user-message-selector.ts | 2 +- .../components/user-message.ts | 2 +- .../components/visual-truncate.ts | 0 .../{interactive => }/components/welcome.ts | 2 +- .../controllers/command-controller.ts | 24 +- .../controllers/event-controller.ts | 18 +- .../controllers/extension-ui-controller.ts | 22 +- .../controllers/input-controller.ts | 8 +- .../controllers/selector-controller.ts | 28 +- packages/coding-agent/src/modes/index.ts | 2 +- .../{interactive => }/interactive-mode.ts | 24 +- packages/coding-agent/src/modes/print-mode.ts | 2 +- .../coding-agent/src/modes/rpc/rpc-client.ts | 6 +- .../coding-agent/src/modes/rpc/rpc-mode.ts | 6 +- .../coding-agent/src/modes/rpc/rpc-types.ts | 6 +- .../modes/{interactive => }/theme/dark.json | 0 .../theme/defaults/alabaster.json | 0 .../theme/defaults/amethyst.json | 0 .../theme/defaults/anthracite.json | 0 .../theme/defaults/basalt.json | 0 .../theme/defaults/birch.json | 0 .../theme/defaults/dark-abyss.json | 0 .../theme/defaults/dark-arctic.json | 0 .../theme/defaults/dark-aurora.json | 0 .../theme/defaults/dark-catppuccin.json | 0 .../theme/defaults/dark-cavern.json | 0 .../theme/defaults/dark-copper.json | 0 .../theme/defaults/dark-cosmos.json | 0 .../theme/defaults/dark-cyberpunk.json | 0 .../theme/defaults/dark-dracula.json | 0 .../theme/defaults/dark-eclipse.json | 0 .../theme/defaults/dark-ember.json | 0 .../theme/defaults/dark-equinox.json | 0 .../theme/defaults/dark-forest.json | 0 .../theme/defaults/dark-github.json | 0 .../theme/defaults/dark-gruvbox.json | 0 .../theme/defaults/dark-lavender.json | 0 .../theme/defaults/dark-lunar.json | 0 .../theme/defaults/dark-midnight.json | 0 .../theme/defaults/dark-monochrome.json | 0 .../theme/defaults/dark-monokai.json | 0 .../theme/defaults/dark-nebula.json | 0 .../theme/defaults/dark-nord.json | 0 .../theme/defaults/dark-ocean.json | 0 .../theme/defaults/dark-one.json | 0 .../theme/defaults/dark-rainforest.json | 0 .../theme/defaults/dark-reef.json | 0 .../theme/defaults/dark-retro.json | 0 .../theme/defaults/dark-rose-pine.json | 0 .../theme/defaults/dark-sakura.json | 0 .../theme/defaults/dark-slate.json | 0 .../theme/defaults/dark-solarized.json | 0 .../theme/defaults/dark-solstice.json | 0 .../theme/defaults/dark-starfall.json | 0 .../theme/defaults/dark-sunset.json | 0 .../theme/defaults/dark-swamp.json | 0 .../theme/defaults/dark-synthwave.json | 0 .../theme/defaults/dark-taiga.json | 0 .../theme/defaults/dark-terminal.json | 0 .../theme/defaults/dark-tokyo-night.json | 0 .../theme/defaults/dark-tundra.json | 0 .../theme/defaults/dark-twilight.json | 0 .../theme/defaults/dark-volcanic.json | 0 .../theme/defaults/graphite.json | 0 .../{interactive => }/theme/defaults/index.ts | 0 .../theme/defaults/light-arctic.json | 0 .../theme/defaults/light-aurora-day.json | 0 .../theme/defaults/light-canyon.json | 0 .../theme/defaults/light-catppuccin.json | 0 .../theme/defaults/light-cirrus.json | 0 .../theme/defaults/light-coral.json | 0 .../theme/defaults/light-cyberpunk.json | 0 .../theme/defaults/light-dawn.json | 0 .../theme/defaults/light-dunes.json | 0 .../theme/defaults/light-eucalyptus.json | 0 .../theme/defaults/light-forest.json | 0 .../theme/defaults/light-frost.json | 0 .../theme/defaults/light-github.json | 0 .../theme/defaults/light-glacier.json | 0 .../theme/defaults/light-gruvbox.json | 0 .../theme/defaults/light-haze.json | 0 .../theme/defaults/light-honeycomb.json | 0 .../theme/defaults/light-lagoon.json | 0 .../theme/defaults/light-lavender.json | 0 .../theme/defaults/light-meadow.json | 0 .../theme/defaults/light-mint.json | 0 .../theme/defaults/light-monochrome.json | 0 .../theme/defaults/light-ocean.json | 0 .../theme/defaults/light-one.json | 0 .../theme/defaults/light-opal.json | 0 .../theme/defaults/light-orchard.json | 0 .../theme/defaults/light-paper.json | 0 .../theme/defaults/light-prism.json | 0 .../theme/defaults/light-retro.json | 0 .../theme/defaults/light-sand.json | 0 .../theme/defaults/light-savanna.json | 0 .../theme/defaults/light-solarized.json | 0 .../theme/defaults/light-soleil.json | 0 .../theme/defaults/light-sunset.json | 0 .../theme/defaults/light-synthwave.json | 0 .../theme/defaults/light-tokyo-night.json | 0 .../theme/defaults/light-wetland.json | 0 .../theme/defaults/light-zenith.json | 0 .../theme/defaults/limestone.json | 0 .../theme/defaults/mahogany.json | 0 .../theme/defaults/marble.json | 0 .../theme/defaults/obsidian.json | 0 .../theme/defaults/onyx.json | 0 .../theme/defaults/pearl.json | 0 .../theme/defaults/porcelain.json | 0 .../theme/defaults/quartz.json | 0 .../theme/defaults/sandstone.json | 0 .../theme/defaults/titanium.json | 0 .../modes/{interactive => }/theme/light.json | 0 .../{interactive => }/theme/theme-schema.json | 0 .../modes/{interactive => }/theme/theme.ts | 0 .../src/modes/{interactive => }/types.ts | 16 +- .../{interactive => }/utils/ui-helpers.ts | 28 +- .../src/{core/tools => }/patch/applicator.ts | 2 +- .../src/{core/tools => }/patch/diff.ts | 2 +- .../src/{core/tools => }/patch/fuzzy.ts | 0 .../src/{core/tools => }/patch/index.ts | 10 +- .../src/{core/tools => }/patch/normalize.ts | 0 .../src/{core/tools => }/patch/normative.ts | 0 .../src/{core/tools => }/patch/parser.ts | 0 .../src/{core/tools => }/patch/shared.ts | 14 +- .../src/{core/tools => }/patch/types.ts | 0 packages/coding-agent/src/{core => }/sdk.ts | 60 +-- .../src/{core => session}/agent-session.ts | 69 +-- .../src/{core => session}/agent-storage.ts | 2 +- .../src/{core => session}/artifacts.ts | 0 .../src/{core => session}/auth-storage.ts | 0 .../compaction/branch-summarization.ts | 10 +- .../compaction/compaction.ts | 6 +- .../src/{core => session}/compaction/index.ts | 0 .../src/{core => session}/compaction/utils.ts | 2 +- .../src/{core => session}/history-storage.ts | 0 .../src/{core => session}/messages.ts | 4 +- .../src/{core => session}/session-manager.ts | 0 .../src/{core => session}/session-storage.ts | 0 .../{core => session}/storage-migration.ts | 2 +- .../src/{core => session}/streaming-output.ts | 2 +- .../src/{core => }/ssh/connection-manager.ts | 0 .../src/{core => }/ssh/ssh-executor.ts | 2 +- .../src/{core => }/ssh/sshfs-mount.ts | 0 .../src/{core => }/system-prompt.ts | 6 +- .../src/{core/tools => }/task/agents.ts | 4 +- .../src/{core/tools => }/task/commands.ts | 4 +- .../src/{core/tools => }/task/discovery.ts | 2 +- .../src/{core/tools => }/task/executor.ts | 22 +- .../src/{core/tools => }/task/index.ts | 8 +- .../{core/tools => }/task/name-generator.ts | 0 .../src/{core/tools => }/task/omp-command.ts | 0 .../src/{core/tools => }/task/parallel.ts | 0 .../src/{core/tools => }/task/render.ts | 8 +- .../task/subprocess-tool-registry.ts | 2 +- .../src/{core/tools => }/task/template.ts | 0 .../src/{core/tools => }/task/types.ts | 0 .../{core/tools => }/task/worker-protocol.ts | 6 +- .../src/{core/tools => }/task/worker.ts | 29 +- .../src/{core/tools => }/task/worktree.ts | 0 .../coding-agent/src/{core => }/tools/ask.ts | 6 +- .../src/{core => }/tools/bash-interceptor.ts | 2 +- .../coding-agent/src/{core => }/tools/bash.ts | 14 +- .../src/{core => }/tools/calculator.ts | 6 +- .../src/{core => }/tools/complete.ts | 2 +- .../src/{core => }/tools/context.ts | 4 +- .../src/{core => }/tools/fetch.ts | 18 +- .../coding-agent/src/{core => }/tools/find.ts | 10 +- .../src/{core => }/tools/gemini-image.ts | 6 +- .../coding-agent/src/{core => }/tools/grep.ts | 12 +- .../src/{core => }/tools/index.ts | 88 ++-- .../{core => }/tools/jtd-to-json-schema.ts | 0 .../src/{core => }/tools/list-limit.ts | 2 +- .../coding-agent/src/{core => }/tools/ls.ts | 8 +- .../src/{core => }/tools/notebook.ts | 6 +- .../src/{core => tools}/output-meta.ts | 6 +- .../src/{core => }/tools/output-utils.ts | 2 +- .../src/{core => }/tools/path-utils.ts | 0 .../src/{core => }/tools/python.ts | 18 +- .../coding-agent/src/{core => }/tools/read.ts | 12 +- .../src/{core => }/tools/render-utils.ts | 2 +- .../src/{core => }/tools/renderers.ts | 12 +- .../src/{core => }/tools/review.ts | 4 +- .../coding-agent/src/{core => }/tools/ssh.ts | 16 +- .../src/{core => }/tools/todo-write.ts | 8 +- .../src/{core => tools}/tool-errors.ts | 0 .../src/{core => }/tools/tool-result.ts | 6 +- .../src/{core => }/tools/truncate.ts | 0 .../src/{core => }/tools/write.ts | 14 +- .../src/{core => utils}/event-bus.ts | 0 .../src/{core => utils}/file-mentions.ts | 8 +- .../src/{core => utils}/frontmatter.ts | 0 packages/coding-agent/src/utils/shell.ts | 2 +- .../src/{core => utils}/terminal-notify.ts | 0 .../src/{core => utils}/timings.ts | 0 .../src/{core => utils}/title-generator.ts | 6 +- .../coding-agent/src/{core => utils}/utils.ts | 0 .../scrapers}/artifacthub.ts | 0 .../web-scrapers => web/scrapers}/arxiv.ts | 0 .../web-scrapers => web/scrapers}/aur.ts | 0 .../web-scrapers => web/scrapers}/biorxiv.ts | 0 .../web-scrapers => web/scrapers}/bluesky.ts | 0 .../web-scrapers => web/scrapers}/brew.ts | 0 .../web-scrapers => web/scrapers}/cheatsh.ts | 0 .../scrapers}/chocolatey.ts | 0 .../scrapers}/choosealicense.ts | 2 +- .../web-scrapers => web/scrapers}/cisa-kev.ts | 0 .../web-scrapers => web/scrapers}/clojars.ts | 0 .../scrapers}/coingecko.ts | 0 .../scrapers}/crates-io.ts | 0 .../web-scrapers => web/scrapers}/crossref.ts | 0 .../web-scrapers => web/scrapers}/devto.ts | 0 .../web-scrapers => web/scrapers}/discogs.ts | 0 .../scrapers}/discourse.ts | 0 .../scrapers}/dockerhub.ts | 0 .../web-scrapers => web/scrapers}/fdroid.ts | 0 .../scrapers}/firefox-addons.ts | 0 .../web-scrapers => web/scrapers}/flathub.ts | 0 .../scrapers}/github-gist.ts | 0 .../web-scrapers => web/scrapers}/github.ts | 0 .../web-scrapers => web/scrapers}/gitlab.ts | 0 .../web-scrapers => web/scrapers}/go-pkg.ts | 0 .../web-scrapers => web/scrapers}/hackage.ts | 0 .../scrapers}/hackernews.ts | 0 .../web-scrapers => web/scrapers}/hex.ts | 0 .../scrapers}/huggingface.ts | 0 .../web-scrapers => web/scrapers}/iacr.ts | 0 .../web-scrapers => web/scrapers}/index.ts | 0 .../scrapers}/jetbrains-marketplace.ts | 0 .../web-scrapers => web/scrapers}/lemmy.ts | 0 .../web-scrapers => web/scrapers}/lobsters.ts | 0 .../web-scrapers => web/scrapers}/mastodon.ts | 0 .../web-scrapers => web/scrapers}/maven.ts | 0 .../web-scrapers => web/scrapers}/mdn.ts | 0 .../web-scrapers => web/scrapers}/metacpan.ts | 0 .../scrapers}/musicbrainz.ts | 0 .../web-scrapers => web/scrapers}/npm.ts | 0 .../web-scrapers => web/scrapers}/nuget.ts | 0 .../web-scrapers => web/scrapers}/nvd.ts | 0 .../web-scrapers => web/scrapers}/ollama.ts | 0 .../web-scrapers => web/scrapers}/open-vsx.ts | 0 .../scrapers}/opencorporates.ts | 0 .../scrapers}/openlibrary.ts | 0 .../web-scrapers => web/scrapers}/orcid.ts | 0 .../web-scrapers => web/scrapers}/osv.ts | 0 .../scrapers}/packagist.ts | 0 .../web-scrapers => web/scrapers}/pub-dev.ts | 0 .../web-scrapers => web/scrapers}/pubmed.ts | 0 .../web-scrapers => web/scrapers}/pypi.ts | 0 .../web-scrapers => web/scrapers}/rawg.ts | 0 .../scrapers}/readthedocs.ts | 0 .../web-scrapers => web/scrapers}/reddit.ts | 0 .../web-scrapers => web/scrapers}/repology.ts | 0 .../web-scrapers => web/scrapers}/rfc.ts | 0 .../web-scrapers => web/scrapers}/rubygems.ts | 0 .../scrapers}/searchcode.ts | 0 .../scrapers}/sec-edgar.ts | 0 .../scrapers}/semantic-scholar.ts | 0 .../scrapers}/snapcraft.ts | 0 .../scrapers}/sourcegraph.ts | 0 .../web-scrapers => web/scrapers}/spdx.ts | 0 .../web-scrapers => web/scrapers}/spotify.ts | 0 .../scrapers}/stackoverflow.ts | 0 .../scrapers}/terraform.ts | 0 .../web-scrapers => web/scrapers}/tldr.ts | 0 .../web-scrapers => web/scrapers}/twitter.ts | 2 +- .../web-scrapers => web/scrapers}/types.ts | 2 +- .../web-scrapers => web/scrapers}/utils.ts | 0 .../web-scrapers => web/scrapers}/vimeo.ts | 0 .../scrapers}/vscode-marketplace.ts | 0 .../web-scrapers => web/scrapers}/w3c.ts | 0 .../web-scrapers => web/scrapers}/wikidata.ts | 0 .../scrapers}/wikipedia.ts | 0 .../web-scrapers => web/scrapers}/youtube.ts | 2 +- .../tools/web-search => web/search}/auth.ts | 6 +- .../tools/web-search => web/search}/index.ts | 21 +- .../search}/providers/anthropic.ts | 6 +- .../search}/providers/exa.ts | 4 +- .../search}/providers/perplexity.ts | 4 +- .../tools/web-search => web/search}/render.ts | 6 +- .../tools/web-search => web/search}/types.ts | 0 .../test/agent-session-branching.test.ts | 12 +- .../test/agent-session-compaction.test.ts | 12 +- .../test/agent-session-concurrent.test.ts | 10 +- .../coding-agent/test/block-images.test.ts | 6 +- .../test/compaction-hooks-example.test.ts | 2 +- .../test/compaction-hooks.test.ts | 16 +- .../test/compaction-thinking-model.test.ts | 12 +- packages/coding-agent/test/compaction.test.ts | 4 +- .../test/core/apply-patch-adverserial.test.ts | 2 +- .../test/core/apply-patch-regression.test.ts | 2 +- .../test/core/apply-patch.test.ts | 9 +- .../test/core/python-executor-display.test.ts | 4 +- .../core/python-executor-lifecycle.test.ts | 6 +- .../test/core/python-executor-mapping.test.ts | 4 +- .../core/python-executor-per-call.test.ts | 6 +- .../test/core/python-executor-session.test.ts | 4 +- .../core/python-executor-streaming.test.ts | 6 +- .../test/core/python-executor-timeout.test.ts | 4 +- .../core/python-executor.lifecycle.test.ts | 4 +- .../test/core/python-executor.result.test.ts | 4 +- .../test/core/python-executor.test.ts | 11 +- .../test/core/python-kernel-display.test.ts | 2 +- .../test/core/python-kernel-env.test.ts | 4 +- .../test/core/python-kernel-session.test.ts | 6 +- .../test/core/python-kernel-ws.test.ts | 2 +- .../test/core/python-kernel.lifecycle.test.ts | 2 +- .../test/core/python-kernel.test.ts | 4 +- .../test/core/python-modules.test.ts | 2 +- .../test/core/python-prelude.test.ts | 4 +- .../test/core/settings-manager-python.test.ts | 2 +- .../test/core/system-prompt.python.test.ts | 2 +- .../test/discovery/helpers.test.ts | 2 +- packages/coding-agent/test/edit-diff.test.ts | 2 +- .../test/extensions-discovery.test.ts | 2 +- .../test/extensions-runner.test.ts | 10 +- .../test/interactive-mode-status.test.ts | 6 +- .../coding-agent/test/model-registry.test.ts | 4 +- .../coding-agent/test/model-resolver.test.ts | 2 +- .../test/prompt-templates.test.ts | 2 +- .../test/python-tool-settings.test.ts | 8 +- packages/coding-agent/test/sdk-skills.test.ts | 6 +- .../session-manager/build-context.test.ts | 2 +- .../session-manager/file-operations.test.ts | 2 +- .../test/session-manager/labels.test.ts | 2 +- .../test/session-manager/migration.test.ts | 2 +- .../session-manager/rewrite-tool-call.test.ts | 2 +- .../test/session-manager/save-entry.test.ts | 2 +- .../session-manager/tree-traversal.test.ts | 2 +- .../test/settings-manager.test.ts | 4 +- packages/coding-agent/test/skills.test.ts | 2 +- .../test/streaming-edit-abort.test.ts | 10 +- .../test/streaming-render-debug.ts | 4 +- .../coding-agent/test/system-prompt.test.ts | 2 +- .../coding-agent/test/test-theme-colors.ts | 2 +- packages/coding-agent/test/tools.test.ts | 16 +- .../coding-agent/test/tools/index.test.ts | 2 +- .../test/tools/lsp-batching.test.ts | 4 +- .../test/tools/python-execution.test.ts | 6 +- .../test/tools/python-fallback.test.ts | 6 +- .../test/tools/python-renderer.test.ts | 4 +- .../test/tools/python-tool-mode.test.ts | 2 +- .../coding-agent/test/tools/python.test.ts | 6 +- .../test/tools/schema-validation.test.ts | 2 +- .../test/tools/task-template.test.ts | 2 +- .../test/tools/web-scrapers/academic.test.ts | 8 +- .../test/tools/web-scrapers/business.test.ts | 4 +- .../tools/web-scrapers/dev-platforms.test.ts | 8 +- .../tools/web-scrapers/documentation.test.ts | 4 +- .../tools/web-scrapers/finance-media.test.ts | 6 +- .../tools/web-scrapers/git-hosting.test.ts | 4 +- .../test/tools/web-scrapers/media.test.ts | 6 +- .../web-scrapers/package-managers-2.test.ts | 12 +- .../web-scrapers/package-managers.test.ts | 12 +- .../web-scrapers/package-registries.test.ts | 12 +- .../test/tools/web-scrapers/research.test.ts | 6 +- .../test/tools/web-scrapers/security.test.ts | 4 +- .../web-scrapers/social-extended.test.ts | 4 +- .../test/tools/web-scrapers/social.test.ts | 6 +- .../tools/web-scrapers/stackexchange.test.ts | 2 +- .../test/tools/web-scrapers/standards.test.ts | 6 +- .../test/tools/web-scrapers/wikipedia.test.ts | 2 +- .../test/tools/web-scrapers/youtube.test.ts | 2 +- packages/coding-agent/test/utilities.ts | 12 +- 531 files changed, 1316 insertions(+), 1322 deletions(-) rename packages/coding-agent/src/{core => config}/keybindings.ts (100%) rename packages/coding-agent/src/{core => config}/model-registry.ts (99%) rename packages/coding-agent/src/{core => config}/model-resolver.ts (100%) rename packages/coding-agent/src/{core => config}/prompt-templates.ts (99%) rename packages/coding-agent/src/{core => config}/settings-manager.ts (99%) delete mode 100644 packages/coding-agent/src/core/index.ts delete mode 100644 packages/coding-agent/src/core/python-prelude.ts delete mode 100644 packages/coding-agent/src/core/ssh-executor.ts rename packages/coding-agent/src/{core/cursor/exec-bridge.ts => cursor.ts} (99%) rename packages/coding-agent/src/{core/tools => }/exa/company.ts (96%) rename packages/coding-agent/src/{core/tools => }/exa/index.ts (93%) rename packages/coding-agent/src/{core/tools => }/exa/linkedin.ts (96%) rename packages/coding-agent/src/{core/tools => }/exa/mcp-client.ts (98%) rename packages/coding-agent/src/{core/tools => }/exa/render.ts (98%) rename packages/coding-agent/src/{core/tools => }/exa/researcher.ts (97%) rename packages/coding-agent/src/{core/tools => }/exa/search.ts (99%) rename packages/coding-agent/src/{core/tools => }/exa/types.ts (100%) rename packages/coding-agent/src/{core/tools => }/exa/websets.ts (98%) rename packages/coding-agent/src/{core => exec}/bash-executor.ts (97%) rename packages/coding-agent/src/{core => exec}/exec.ts (100%) rename packages/coding-agent/src/{core => export}/custom-share.ts (100%) rename packages/coding-agent/src/{core/export-html => export/html}/index.ts (98%) rename packages/coding-agent/src/{core/export-html => export/html}/template.css (100%) create mode 100644 packages/coding-agent/src/export/html/template.generated.ts rename packages/coding-agent/src/{core/export-html => export/html}/template.html (100%) rename packages/coding-agent/src/{core/export-html => export/html}/template.js (100%) rename packages/coding-agent/src/{core/export-html => export/html}/template.macro.ts (100%) rename packages/coding-agent/src/{core/export-html => export/html}/vendor/highlight.min.js (100%) rename packages/coding-agent/src/{core/export-html => export/html}/vendor/marked.min.js (100%) rename packages/coding-agent/src/{core => export}/ttsr.ts (98%) rename packages/coding-agent/src/{core => extensibility}/custom-commands/bundled/review/index.ts (98%) rename packages/coding-agent/src/{core => extensibility}/custom-commands/index.ts (100%) rename packages/coding-agent/src/{core => extensibility}/custom-commands/loader.ts (99%) rename packages/coding-agent/src/{core => extensibility}/custom-commands/types.ts (99%) rename packages/coding-agent/src/{core => extensibility}/custom-tools/index.ts (100%) rename packages/coding-agent/src/{core => extensibility}/custom-tools/loader.ts (96%) rename packages/coding-agent/src/{core => extensibility}/custom-tools/types.ts (94%) rename packages/coding-agent/src/{core => extensibility}/custom-tools/wrapper.ts (97%) rename packages/coding-agent/src/{core => extensibility}/extensions/index.ts (100%) rename packages/coding-agent/src/{core => extensibility}/extensions/loader.ts (98%) rename packages/coding-agent/src/{core => extensibility}/extensions/runner.ts (98%) rename packages/coding-agent/src/{core => extensibility}/extensions/types.ts (97%) rename packages/coding-agent/src/{core => extensibility}/extensions/wrapper.ts (98%) rename packages/coding-agent/src/{core => extensibility}/hooks/index.ts (94%) rename packages/coding-agent/src/{core => extensibility}/hooks/loader.ts (98%) rename packages/coding-agent/src/{core => extensibility}/hooks/runner.ts (98%) rename packages/coding-agent/src/{core => extensibility}/hooks/tool-wrapper.ts (100%) rename packages/coding-agent/src/{core => extensibility}/hooks/types.ts (97%) rename packages/coding-agent/src/{core => extensibility}/plugins/doctor.ts (97%) rename packages/coding-agent/src/{core => extensibility}/plugins/index.ts (100%) rename packages/coding-agent/src/{core => extensibility}/plugins/installer.ts (100%) rename packages/coding-agent/src/{core => extensibility}/plugins/loader.ts (100%) rename packages/coding-agent/src/{core => extensibility}/plugins/manager.ts (100%) rename packages/coding-agent/src/{core => extensibility}/plugins/parser.ts (100%) rename packages/coding-agent/src/{core => extensibility}/plugins/paths.ts (100%) rename packages/coding-agent/src/{core => extensibility}/plugins/types.ts (100%) rename packages/coding-agent/src/{core => extensibility}/skills.ts (98%) rename packages/coding-agent/src/{core => extensibility}/slash-commands.ts (96%) rename packages/coding-agent/src/{core => }/internal-urls/agent-protocol.ts (100%) rename packages/coding-agent/src/{core => }/internal-urls/artifact-protocol.ts (100%) rename packages/coding-agent/src/{core => }/internal-urls/index.ts (100%) rename packages/coding-agent/src/{core => }/internal-urls/json-query.ts (100%) rename packages/coding-agent/src/{core => }/internal-urls/router.ts (100%) rename packages/coding-agent/src/{core => }/internal-urls/rule-protocol.ts (100%) rename packages/coding-agent/src/{core => }/internal-urls/skill-protocol.ts (98%) rename packages/coding-agent/src/{core => }/internal-urls/types.ts (100%) rename packages/coding-agent/src/{core/python-executor.ts => ipy/executor.ts} (99%) rename packages/coding-agent/src/{core/python-gateway-coordinator.ts => ipy/gateway-coordinator.ts} (100%) rename packages/coding-agent/src/{core/python-kernel.ts => ipy/kernel.ts} (99%) rename packages/coding-agent/src/{core/python-modules.ts => ipy/modules.ts} (100%) rename packages/coding-agent/src/{core/python-prelude.py => ipy/prelude.py} (100%) create mode 100644 packages/coding-agent/src/ipy/prelude.ts rename packages/coding-agent/src/{core/tools => }/lsp/client.ts (99%) rename packages/coding-agent/src/{core/tools => }/lsp/clients/biome-client.ts (99%) rename packages/coding-agent/src/{core/tools => }/lsp/clients/index.ts (94%) rename packages/coding-agent/src/{core/tools => }/lsp/clients/lsp-linter-client.ts (92%) rename packages/coding-agent/src/{core/tools => }/lsp/config.ts (100%) rename packages/coding-agent/src/{core/tools => }/lsp/defaults.json (100%) rename packages/coding-agent/src/{core/tools => }/lsp/edits.ts (100%) rename packages/coding-agent/src/{core/tools => }/lsp/index.ts (99%) rename packages/coding-agent/src/{core/tools => }/lsp/lspmux.ts (100%) rename packages/coding-agent/src/{core/tools => }/lsp/render.ts (99%) rename packages/coding-agent/src/{core/tools => }/lsp/rust-analyzer.ts (100%) rename packages/coding-agent/src/{core/tools => }/lsp/types.ts (100%) rename packages/coding-agent/src/{core/tools => }/lsp/utils.ts (99%) rename packages/coding-agent/src/{core => }/mcp/client.ts (100%) rename packages/coding-agent/src/{core => }/mcp/config.ts (94%) rename packages/coding-agent/src/{core => }/mcp/index.ts (100%) rename packages/coding-agent/src/{core => }/mcp/json-rpc.ts (100%) rename packages/coding-agent/src/{core => }/mcp/loader.ts (96%) rename packages/coding-agent/src/{core => }/mcp/manager.ts (98%) rename packages/coding-agent/src/{core => }/mcp/tool-bridge.ts (99%) rename packages/coding-agent/src/{core => }/mcp/tool-cache.ts (98%) rename packages/coding-agent/src/{core => }/mcp/transports/http.ts (99%) rename packages/coding-agent/src/{core => }/mcp/transports/index.ts (100%) rename packages/coding-agent/src/{core => }/mcp/transports/stdio.ts (99%) rename packages/coding-agent/src/{core => }/mcp/types.ts (99%) rename packages/coding-agent/src/modes/{interactive => }/components/armin.ts (99%) rename packages/coding-agent/src/modes/{interactive => }/components/assistant-message.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/components/bash-execution.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/components/bordered-loader.ts (94%) rename packages/coding-agent/src/modes/{interactive => }/components/branch-summary-message.ts (89%) rename packages/coding-agent/src/modes/{interactive => }/components/compaction-summary-message.ts (90%) rename packages/coding-agent/src/modes/{interactive => }/components/countdown-timer.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/components/custom-editor.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/components/custom-message.ts (93%) rename packages/coding-agent/src/modes/{interactive => }/components/diff.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/dynamic-border.ts (92%) rename packages/coding-agent/src/modes/{interactive => }/components/extensions/extension-dashboard.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/components/extensions/extension-list.ts (99%) rename packages/coding-agent/src/modes/{interactive => }/components/extensions/index.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/components/extensions/inspector-panel.ts (99%) rename packages/coding-agent/src/modes/{interactive => }/components/extensions/state-manager.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/components/extensions/types.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/components/footer.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/history-search.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/components/hook-editor.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/components/hook-input.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/components/hook-message.ts (93%) rename packages/coding-agent/src/modes/{interactive => }/components/hook-selector.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/index.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/components/keybinding-hints.ts (94%) rename packages/coding-agent/src/modes/{interactive => }/components/login-dialog.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/model-selector.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/oauth-selector.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/components/plugin-settings.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/python-execution.ts (96%) rename packages/coding-agent/src/modes/{interactive => }/components/queue-mode-selector.ts (95%) rename packages/coding-agent/src/modes/{interactive => }/components/read-tool-group.ts (96%) rename packages/coding-agent/src/modes/{interactive => }/components/session-selector.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/settings-defs.ts (99%) rename packages/coding-agent/src/modes/{interactive => }/components/settings-selector.ts (99%) rename packages/coding-agent/src/modes/{interactive => }/components/show-images-selector.ts (94%) rename packages/coding-agent/src/modes/{interactive => }/components/status-line-segment-editor.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/status-line.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/status-line/index.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/components/status-line/presets.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/components/status-line/segments.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/status-line/separators.ts (95%) rename packages/coding-agent/src/modes/{interactive => }/components/status-line/types.ts (96%) rename packages/coding-agent/src/modes/{interactive => }/components/theme-selector.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/thinking-selector.ts (95%) rename packages/coding-agent/src/modes/{interactive => }/components/todo-display.ts (95%) rename packages/coding-agent/src/modes/{interactive => }/components/todo-reminder.ts (91%) rename packages/coding-agent/src/modes/{interactive => }/components/tool-execution.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/tree-selector.ts (99%) rename packages/coding-agent/src/modes/{interactive => }/components/ttsr-notification.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/components/user-message-selector.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/components/user-message.ts (85%) rename packages/coding-agent/src/modes/{interactive => }/components/visual-truncate.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/components/welcome.ts (99%) rename packages/coding-agent/src/modes/{interactive => }/controllers/command-controller.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/controllers/event-controller.ts (95%) rename packages/coding-agent/src/modes/{interactive => }/controllers/extension-ui-controller.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/controllers/input-controller.ts (98%) rename packages/coding-agent/src/modes/{interactive => }/controllers/selector-controller.ts (94%) rename packages/coding-agent/src/modes/{interactive => }/interactive-mode.ts (97%) rename packages/coding-agent/src/modes/{interactive => }/theme/dark.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/alabaster.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/amethyst.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/anthracite.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/basalt.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/birch.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-abyss.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-arctic.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-aurora.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-catppuccin.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-cavern.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-copper.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-cosmos.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-cyberpunk.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-dracula.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-eclipse.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-ember.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-equinox.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-forest.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-github.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-gruvbox.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-lavender.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-lunar.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-midnight.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-monochrome.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-monokai.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-nebula.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-nord.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-ocean.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-one.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-rainforest.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-reef.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-retro.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-rose-pine.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-sakura.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-slate.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-solarized.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-solstice.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-starfall.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-sunset.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-swamp.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-synthwave.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-taiga.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-terminal.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-tokyo-night.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-tundra.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-twilight.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/dark-volcanic.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/graphite.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/index.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-arctic.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-aurora-day.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-canyon.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-catppuccin.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-cirrus.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-coral.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-cyberpunk.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-dawn.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-dunes.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-eucalyptus.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-forest.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-frost.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-github.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-glacier.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-gruvbox.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-haze.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-honeycomb.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-lagoon.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-lavender.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-meadow.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-mint.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-monochrome.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-ocean.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-one.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-opal.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-orchard.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-paper.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-prism.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-retro.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-sand.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-savanna.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-solarized.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-soleil.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-sunset.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-synthwave.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-tokyo-night.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-wetland.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/light-zenith.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/limestone.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/mahogany.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/marble.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/obsidian.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/onyx.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/pearl.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/porcelain.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/quartz.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/sandstone.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/defaults/titanium.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/light.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/theme-schema.json (100%) rename packages/coding-agent/src/modes/{interactive => }/theme/theme.ts (100%) rename packages/coding-agent/src/modes/{interactive => }/types.ts (92%) rename packages/coding-agent/src/modes/{interactive => }/utils/ui-helpers.ts (93%) rename packages/coding-agent/src/{core/tools => }/patch/applicator.ts (99%) rename packages/coding-agent/src/{core/tools => }/patch/diff.ts (99%) rename packages/coding-agent/src/{core/tools => }/patch/fuzzy.ts (100%) rename packages/coding-agent/src/{core/tools => }/patch/index.ts (98%) rename packages/coding-agent/src/{core/tools => }/patch/normalize.ts (100%) rename packages/coding-agent/src/{core/tools => }/patch/normative.ts (100%) rename packages/coding-agent/src/{core/tools => }/patch/parser.ts (100%) rename packages/coding-agent/src/{core/tools => }/patch/shared.ts (95%) rename packages/coding-agent/src/{core/tools => }/patch/types.ts (100%) rename packages/coding-agent/src/{core => }/sdk.ts (95%) rename packages/coding-agent/src/{core => session}/agent-session.ts (98%) rename packages/coding-agent/src/{core => session}/agent-storage.ts (99%) rename packages/coding-agent/src/{core => session}/artifacts.ts (100%) rename packages/coding-agent/src/{core => session}/auth-storage.ts (100%) rename packages/coding-agent/src/{core => session}/compaction/branch-summarization.ts (98%) rename packages/coding-agent/src/{core => session}/compaction/compaction.ts (99%) rename packages/coding-agent/src/{core => session}/compaction/index.ts (100%) rename packages/coding-agent/src/{core => session}/compaction/utils.ts (98%) rename packages/coding-agent/src/{core => session}/history-storage.ts (100%) rename packages/coding-agent/src/{core => session}/messages.ts (98%) rename packages/coding-agent/src/{core => session}/session-manager.ts (100%) rename packages/coding-agent/src/{core => session}/session-storage.ts (100%) rename packages/coding-agent/src/{core => session}/storage-migration.ts (99%) rename packages/coding-agent/src/{core => session}/streaming-output.ts (98%) rename packages/coding-agent/src/{core => }/ssh/connection-manager.ts (100%) rename packages/coding-agent/src/{core => }/ssh/ssh-executor.ts (98%) rename packages/coding-agent/src/{core => }/ssh/sshfs-mount.ts (100%) rename packages/coding-agent/src/{core => }/system-prompt.ts (99%) rename packages/coding-agent/src/{core/tools => }/task/agents.ts (96%) rename packages/coding-agent/src/{core/tools => }/task/commands.ts (96%) rename packages/coding-agent/src/{core/tools => }/task/discovery.ts (98%) rename packages/coding-agent/src/{core/tools => }/task/executor.ts (97%) rename packages/coding-agent/src/{core/tools => }/task/index.ts (99%) rename packages/coding-agent/src/{core/tools => }/task/name-generator.ts (100%) rename packages/coding-agent/src/{core/tools => }/task/omp-command.ts (100%) rename packages/coding-agent/src/{core/tools => }/task/parallel.ts (100%) rename packages/coding-agent/src/{core/tools => }/task/render.ts (99%) rename packages/coding-agent/src/{core/tools => }/task/subprocess-tool-registry.ts (97%) rename packages/coding-agent/src/{core/tools => }/task/template.ts (100%) rename packages/coding-agent/src/{core/tools => }/task/types.ts (100%) rename packages/coding-agent/src/{core/tools => }/task/worker-protocol.ts (93%) rename packages/coding-agent/src/{core/tools => }/task/worker.ts (97%) rename packages/coding-agent/src/{core/tools => }/task/worktree.ts (100%) rename packages/coding-agent/src/{core => }/tools/ask.ts (98%) rename packages/coding-agent/src/{core => }/tools/bash-interceptor.ts (98%) rename packages/coding-agent/src/{core => }/tools/bash.ts (95%) rename packages/coding-agent/src/{core => }/tools/calculator.ts (98%) rename packages/coding-agent/src/{core => }/tools/complete.ts (98%) rename packages/coding-agent/src/{core => }/tools/context.ts (85%) rename packages/coding-agent/src/{core => }/tools/fetch.ts (98%) rename packages/coding-agent/src/{core => }/tools/find.ts (97%) rename packages/coding-agent/src/{core => }/tools/gemini-image.ts (99%) rename packages/coding-agent/src/{core => }/tools/grep.ts (98%) rename packages/coding-agent/src/{core => }/tools/index.ts (90%) rename packages/coding-agent/src/{core => }/tools/jtd-to-json-schema.ts (100%) rename packages/coding-agent/src/{core => }/tools/list-limit.ts (95%) rename packages/coding-agent/src/{core => }/tools/ls.ts (97%) rename packages/coding-agent/src/{core => }/tools/notebook.ts (98%) rename packages/coding-agent/src/{core => tools}/output-meta.ts (98%) rename packages/coding-agent/src/{core => }/tools/output-utils.ts (96%) rename packages/coding-agent/src/{core => }/tools/path-utils.ts (100%) rename packages/coding-agent/src/{core => }/tools/python.ts (98%) rename packages/coding-agent/src/{core => }/tools/read.ts (98%) rename packages/coding-agent/src/{core => }/tools/render-utils.ts (99%) rename packages/coding-agent/src/{core => }/tools/renderers.ts (86%) rename packages/coding-agent/src/{core => }/tools/review.ts (97%) rename packages/coding-agent/src/{core => }/tools/ssh.ts (94%) rename packages/coding-agent/src/{core => }/tools/todo-write.ts (96%) rename packages/coding-agent/src/{core => tools}/tool-errors.ts (100%) rename packages/coding-agent/src/{core => }/tools/tool-result.ts (93%) rename packages/coding-agent/src/{core => }/tools/truncate.ts (100%) rename packages/coding-agent/src/{core => }/tools/write.ts (96%) rename packages/coding-agent/src/{core => utils}/event-bus.ts (100%) rename packages/coding-agent/src/{core => utils}/file-mentions.ts (96%) rename packages/coding-agent/src/{core => utils}/frontmatter.ts (100%) rename packages/coding-agent/src/{core => utils}/terminal-notify.ts (100%) rename packages/coding-agent/src/{core => utils}/timings.ts (100%) rename packages/coding-agent/src/{core => utils}/title-generator.ts (95%) rename packages/coding-agent/src/{core => utils}/utils.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/artifacthub.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/arxiv.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/aur.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/biorxiv.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/bluesky.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/brew.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/cheatsh.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/chocolatey.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/choosealicense.ts (98%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/cisa-kev.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/clojars.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/coingecko.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/crates-io.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/crossref.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/devto.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/discogs.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/discourse.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/dockerhub.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/fdroid.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/firefox-addons.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/flathub.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/github-gist.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/github.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/gitlab.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/go-pkg.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/hackage.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/hackernews.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/hex.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/huggingface.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/iacr.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/index.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/jetbrains-marketplace.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/lemmy.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/lobsters.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/mastodon.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/maven.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/mdn.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/metacpan.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/musicbrainz.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/npm.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/nuget.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/nvd.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/ollama.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/open-vsx.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/opencorporates.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/openlibrary.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/orcid.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/osv.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/packagist.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/pub-dev.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/pubmed.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/pypi.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/rawg.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/readthedocs.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/reddit.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/repology.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/rfc.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/rubygems.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/searchcode.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/sec-edgar.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/semantic-scholar.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/snapcraft.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/sourcegraph.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/spdx.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/spotify.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/stackoverflow.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/terraform.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/tldr.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/twitter.ts (98%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/types.ts (99%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/utils.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/vimeo.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/vscode-marketplace.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/w3c.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/wikidata.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/wikipedia.ts (100%) rename packages/coding-agent/src/{core/tools/web-scrapers => web/scrapers}/youtube.ts (99%) rename packages/coding-agent/src/{core/tools/web-search => web/search}/auth.ts (98%) rename packages/coding-agent/src/{core/tools/web-search => web/search}/index.ts (97%) rename packages/coding-agent/src/{core/tools/web-search => web/search}/providers/anthropic.ts (97%) rename packages/coding-agent/src/{core/tools/web-search => web/search}/providers/exa.ts (96%) rename packages/coding-agent/src/{core/tools/web-search => web/search}/providers/perplexity.ts (97%) rename packages/coding-agent/src/{core/tools/web-search => web/search}/render.ts (98%) rename packages/coding-agent/src/{core/tools/web-search => web/search}/types.ts (100%) diff --git a/packages/coding-agent/DEVELOPMENT.md b/packages/coding-agent/DEVELOPMENT.md index ef4fb1336..fa1ad708f 100644 --- a/packages/coding-agent/DEVELOPMENT.md +++ b/packages/coding-agent/DEVELOPMENT.md @@ -15,14 +15,14 @@ The coding-agent is structured into distinct layers: ▼ ┌─────────────────────────────────────────────────────────────┐ │ Mode Layer │ -│ modes/interactive/ modes/print-mode.ts modes/rpc/ │ +│ modes/interactive-mode.ts modes/print-mode.ts modes/rpc/│ └─────────────────────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ Core Layer │ -│ core/agent-session.ts, core/sdk.ts (SDK wrapper) │ -│ core/session-manager.ts, core/model-resolver.ts, etc. │ +│ session/agent-session.ts, sdk.ts (SDK wrapper) │ +│ session/session-manager.ts, config/model-resolver.ts, etc.│ └─────────────────────────────────────────────────────────────┘ │ ▼ @@ -43,6 +43,9 @@ src/ ├── index.ts # Public API exports (SDK) ├── config.ts # APP_NAME, VERSION, paths (getAgentDir, etc.) ├── migrations.ts # Session/config migration logic +├── sdk.ts # SDK wrapper for programmatic usage +├── system-prompt.ts # buildSystemPrompt(), loadProjectContextFiles() +├── cursor.ts # Cursor exec bridge (flattened from execution/cursor/) ├── cli/ # CLI-specific utilities │ ├── args.ts # parseArgs(), printHelp(), Args interface @@ -66,6 +69,13 @@ src/ │ ├── system-prompt.ts # System prompt capability │ └── tool.ts # Tool capability +├── config/ # Configuration management +│ ├── keybindings.ts # Keybinding configuration +│ ├── model-registry.ts # Model registry and configuration +│ ├── model-resolver.ts # resolveModelScope(), restoreModelFromSession() +│ ├── prompt-templates.ts # Prompt template loading and rendering +│ └── settings-manager.ts # SettingsManager class - user preferences + ├── discovery/ # Extension discovery from multiple sources │ ├── index.ts # Main discovery orchestration │ ├── builtin.ts # Built-in extensions @@ -80,41 +90,30 @@ src/ │ ├── windsurf.ts # Windsurf discovery │ └── helpers.ts # Discovery helper functions -├── prompts/ # Prompt templates -│ ├── system-prompt.md # Main system prompt -│ ├── task.md # Task agent prompt -│ ├── init.md # Initialization prompt -│ ├── compaction-*.md # Compaction prompts -│ └── tools/ # Tool-specific prompts +├── exa/ # Exa MCP tools (22 tools) +│ ├── index.ts # Exa tools exports +│ ├── company.ts # Company search +│ ├── linkedin.ts # LinkedIn search +│ ├── mcp-client.ts # MCP client for Exa +│ ├── render.ts # Exa result rendering +│ ├── researcher.ts # Research tools +│ ├── search.ts # Search tools +│ ├── types.ts # Exa types +│ └── websets.ts # Websets tools -├── core/ # Core business logic (mode-agnostic) -│ ├── index.ts # Core exports -│ ├── agent-session.ts # AgentSession class - THE central abstraction -│ ├── sdk.ts # SDK wrapper for programmatic usage -│ ├── auth-storage.ts # AuthStorage class - API keys and OAuth tokens +├── exec/ # Bash/shell execution │ ├── bash-executor.ts # executeBash() with streaming, abort -│ ├── event-bus.ts # Event bus for tool communication -│ ├── exec.ts # Process execution utilities -│ ├── file-mentions.ts # File mention detection -│ ├── keybindings.ts # Keybinding configuration -│ ├── logger.ts # Winston-based logging -│ ├── messages.ts # BashExecutionMessage, messageTransformer -│ ├── model-registry.ts # Model registry and configuration -│ ├── model-resolver.ts # resolveModelScope(), restoreModelFromSession() -│ ├── prompt-templates.ts # Prompt template loading and rendering -│ ├── session-manager.ts # SessionManager class - JSONL persistence -│ ├── settings-manager.ts # SettingsManager class - user preferences -│ ├── skills.ts # loadSkills(), skill discovery from multiple locations -│ ├── slash-commands.ts # loadSlashCommands() from ~/.omp/agent/commands/ -│ ├── system-prompt.ts # buildSystemPrompt(), loadProjectContextFiles() -│ ├── terminal-notify.ts # Terminal notification utilities -│ ├── timings.ts # Performance timing utilities -│ ├── title-generator.ts # Session title generation +│ └── exec.ts # Process execution utilities + +├── export/ # Export functionality +│ ├── custom-share.ts # Custom sharing │ ├── ttsr.ts # Text-to-speech/speech-to-text utilities -│ ├── utils.ts # Generic utilities -│ │ -│ ├── compaction/ # Context compaction system -│ │ └── index.ts # Compaction logic, summary generation +│ └── html/ # Session export to HTML +│ └── index.ts # HTML export logic + +├── extensibility/ # Extension and customization systems +│ ├── skills.ts # loadSkills(), skill discovery +│ ├── slash-commands.ts # loadSlashCommands() │ │ │ ├── custom-commands/ # Custom command loading system │ │ └── types.ts # CustomCommand types @@ -122,114 +121,213 @@ src/ │ ├── custom-tools/ # Custom tool loading system │ │ ├── index.ts # Custom tool exports │ │ ├── types.ts # CustomToolFactory, CustomToolDefinition -│ │ ├── loader.ts # loadCustomTools() from multiple locations +│ │ ├── loader.ts # loadCustomTools() │ │ └── wrapper.ts # Tool wrapper utilities │ │ -│ ├── export-html/ # Session export to HTML -│ │ └── (export logic) -│ │ │ ├── extensions/ # Extension system -│ │ └── (extension loading and execution) +│ │ ├── index.ts # Extension exports +│ │ ├── types.ts # Extension types +│ │ ├── loader.ts # Extension loading +│ │ ├── runner.ts # Extension event dispatch +│ │ └── wrapper.ts # Extension wrappers │ │ -│ ├── hooks/ # Hook system for extending behavior +│ ├── hooks/ # Hook system │ │ ├── index.ts # Hook exports │ │ ├── types.ts # HookAPI, HookContext, event types -│ │ ├── loader.ts # loadHooks() from multiple locations -│ │ ├── runner.ts # runHook() event dispatch -│ │ └── tool-wrapper.ts # wrapToolsWithHooks() for tool_call events +│ │ ├── loader.ts # loadHooks() +│ │ └── runner.ts # runHook() event dispatch │ │ -│ ├── mcp/ # MCP (Model Context Protocol) integration -│ │ └── (MCP client/server logic) -│ │ -│ ├── plugins/ # Plugin system -│ │ └── (plugin loading and management) -│ │ -│ └── tools/ # Built-in tool implementations -│ ├── index.ts # Tool exports, BUILTIN_TOOLS, createTools -│ ├── ask.ts # User input tool -│ ├── bash.ts # Bash command execution -│ ├── bash-interceptor.ts # Bash command interception -│ ├── context.ts # Tool context utilities -│ ├── edit.ts # Surgical file editing -│ ├── edit-diff.ts # Diff-based editing -│ ├── find.ts # File search by glob -│ ├── gemini-image.ts # Gemini image generation -│ ├── git.ts # Git operations -│ ├── grep.ts # Content search (regex/literal) -│ ├── ls.ts # Directory listing -│ ├── notebook.ts # Jupyter notebook editing -│ ├── output.ts # Output/logging tool -│ ├── read.ts # File reading (text and images) -│ ├── review.ts # Code review tools -│ ├── rulebook.ts # Rulebook tool -│ ├── write.ts # File writing -│ ├── fetch.ts # URL content fetching -│ ├── exa/ # Exa MCP tools (22 tools) -│ ├── lsp/ # LSP integration tools -│ ├── task/ # Task/subagent spawning -│ ├── web-search/ # Web search tools -│ ├── path-utils.ts # Path resolution utilities -│ ├── renderers.ts # Tool output renderers -│ ├── render-utils.ts # Rendering utilities -│ └── truncate.ts # Output truncation utilities +│ └── plugins/ # Plugin system +│ └── (plugin loading and management) + +├── internal-urls/ # Internal URL protocol handlers +│ ├── index.ts # Router and exports +│ ├── rule-protocol.ts # Rule protocol handler +│ └── skill-protocol.ts # Skill protocol handler + +├── ipy/ # Python/Jupyter execution +│ ├── executor.ts # executePython(), kernel execution +│ ├── gateway-coordinator.ts # Gateway coordination +│ ├── kernel.ts # PythonKernel class +│ ├── modules.ts # Python module discovery +│ ├── prelude.ts # Python prelude (TS bindings) +│ └── prelude.py # Python prelude script + +├── lsp/ # LSP integration +│ ├── index.ts # LSP exports +│ ├── client.ts # LSP client +│ ├── config.ts # LSP configuration +│ ├── render.ts # LSP result rendering +│ ├── utils.ts # LSP utilities +│ └── clients/ # Language-specific clients +│ ├── index.ts # Client exports +│ ├── biome-client.ts # Biome LSP +│ └── lsp-linter-client.ts # Generic linter + +├── mcp/ # MCP (Model Context Protocol) integration +│ ├── index.ts # MCP exports +│ ├── config.ts # MCP configuration +│ ├── loader.ts # MCP server loading +│ ├── manager.ts # MCPManager class +│ ├── tool-bridge.ts # Tool bridging +│ ├── tool-cache.ts # Tool caching +│ ├── types.ts # MCP types +│ └── transports/ # MCP transports +│ ├── http.ts # HTTP transport +│ └── stdio.ts # Stdio transport ├── modes/ # Run mode implementations -│ ├── index.ts # Re-exports InteractiveMode, runPrintMode, runRpcMode, RpcClient -│ ├── print-mode.ts # Non-interactive: process messages, print output, exit +│ ├── index.ts # Re-exports InteractiveMode, runPrintMode, runRpcMode +│ ├── interactive-mode.ts # InteractiveMode class (main TUI) +│ ├── print-mode.ts # Non-interactive mode +│ ├── types.ts # Mode types │ │ -│ ├── rpc/ # RPC mode for programmatic control -│ │ ├── rpc-mode.ts # runRpcMode() - JSON stdin/stdout protocol -│ │ ├── rpc-types.ts # RpcCommand, RpcResponse, RpcSessionState types -│ │ └── rpc-client.ts # RpcClient class for spawning/controlling agent +│ ├── components/ # TUI components +│ │ ├── index.ts # Component exports +│ │ ├── assistant-message.ts # Agent response rendering +│ │ ├── bash-execution.ts # Bash output display +│ │ ├── custom-editor.ts # Multi-line input editor +│ │ ├── dynamic-border.ts # Adaptive border rendering +│ │ ├── footer.ts # Status bar / footer +│ │ ├── hook-input.ts # Hook input dialog +│ │ ├── hook-selector.ts # Hook selection UI +│ │ ├── login-dialog.ts # OAuth login dialog +│ │ ├── model-selector.ts # Model picker +│ │ ├── session-selector.ts # Session browser for --resume +│ │ ├── theme-selector.ts # Theme picker +│ │ ├── thinking-selector.ts # Thinking level picker +│ │ ├── tool-execution.ts # Tool call/result rendering +│ │ ├── user-message.ts # User message rendering +│ │ ├── status-line/ # Status line components +│ │ └── extensions/ # Extension UI components │ │ -│ └── interactive/ # Interactive TUI mode -│ ├── interactive-mode.ts # InteractiveMode class -│ │ -│ ├── components/ # TUI components -│ │ ├── assistant-message.ts # Agent response rendering -│ │ ├── bash-execution.ts # Bash output display -│ │ ├── compaction.ts # Compaction status display -│ │ ├── countdown-timer.ts # Reusable countdown for dialogs -│ │ ├── custom-editor.ts # Multi-line input editor -│ │ ├── dynamic-border.ts # Adaptive border rendering -│ │ ├── footer.ts # Status bar / footer -│ │ ├── hook-input.ts # Hook input dialog -│ │ ├── hook-selector.ts # Hook selection UI -│ │ ├── index.ts # Component exports -│ │ ├── login-dialog.ts # OAuth login dialog -│ │ ├── model-selector.ts # Model picker -│ │ ├── oauth-selector.ts # OAuth provider picker -│ │ ├── queue-mode-selector.ts # Message queue mode picker -│ │ ├── session-selector.ts # Session browser for --resume -│ │ ├── show-images-selector.ts # Image display toggle -│ │ ├── theme-selector.ts # Theme picker -│ │ ├── thinking-selector.ts # Thinking level picker -│ │ ├── tool-execution.ts # Tool call/result rendering -│ │ ├── user-message-selector.ts # Message selector for /branch -│ │ └── user-message.ts # User message rendering -│ │ -│ └── theme/ -│ ├── theme.ts # Theme loading, getEditorTheme(), etc. -│ ├── dark.json -│ ├── light.json -│ └── theme-schema.json +│ ├── controllers/ # TUI controllers +│ │ ├── command-controller.ts # Command handling +│ │ ├── event-controller.ts # Event handling +│ │ ├── input-controller.ts # Input handling +│ │ └── selector-controller.ts # Selector handling +│ │ +│ ├── theme/ # Theme system +│ │ ├── theme.ts # Theme loading, getEditorTheme() +│ │ └── defaults/ # Default themes +│ │ +│ ├── utils/ # Mode utilities +│ │ └── ui-helpers.ts # UI helper functions +│ │ +│ └── rpc/ # RPC mode for programmatic control +│ ├── rpc-mode.ts # runRpcMode() - JSON stdin/stdout protocol +│ ├── rpc-types.ts # RpcCommand, RpcResponse types +│ └── rpc-client.ts # RpcClient class -└── utils/ # Generic utilities - ├── changelog.ts # parseChangelog(), getNewEntries() - ├── clipboard.ts # copyToClipboard() - ├── fuzzy.ts # Fuzzy string matching - ├── image-convert.ts # Image format conversion - ├── image-magick.ts # ImageMagick integration - ├── image-resize.ts # Image resizing utilities - ├── mime.ts # MIME type detection - ├── shell.ts # getShellConfig() - ├── shell-snapshot.ts # Shell state snapshotting - └── tools-manager.ts # ensureTool() - download fd, etc. +├── patch/ # File patching/editing +│ ├── index.ts # EditTool and exports +│ ├── applicator.ts # Patch application +│ ├── diff.ts # Diff utilities +│ ├── shared.ts # Shared utilities +│ └── render.ts # Patch rendering + +├── prompts/ # Prompt templates +│ ├── system/ # System prompts +│ ├── agents/ # Agent-specific prompts +│ ├── compaction/ # Compaction prompts +│ └── tools/ # Tool-specific prompts + +├── session/ # Session management +│ ├── agent-session.ts # AgentSession class - THE central abstraction +│ ├── agent-storage.ts # Agent storage utilities +│ ├── auth-storage.ts # AuthStorage class - API keys and OAuth +│ ├── artifacts.ts # Artifact management +│ ├── history-storage.ts # History storage +│ ├── messages.ts # Message types and transformers +│ ├── session-manager.ts # SessionManager class - JSONL persistence +│ ├── session-storage.ts # Session storage utilities +│ ├── storage-migration.ts # Storage migration +│ ├── streaming-output.ts # Streaming output handling +│ └── compaction/ # Context compaction system +│ └── index.ts # Compaction logic, summary generation + +├── ssh/ # SSH execution +│ ├── connection-manager.ts # SSH connection management +│ ├── ssh-executor.ts # executeSSH() with streaming +│ └── sshfs-mount.ts # SSHFS mounting + +├── task/ # Task/subagent spawning +│ ├── index.ts # TaskTool exports +│ ├── agents.ts # Agent definitions +│ ├── commands.ts # Task commands +│ ├── discovery.ts # Task discovery +│ ├── executor.ts # Task execution +│ ├── render.ts # Task rendering +│ ├── subprocess-tool-registry.ts # Subprocess tool registry +│ ├── worker-protocol.ts # Worker protocol +│ └── worker.ts # Task worker + +├── tools/ # Built-in tool implementations +│ ├── index.ts # Tool exports, BUILTIN_TOOLS, createTools +│ ├── ask.ts # User input tool +│ ├── bash.ts # Bash command execution +│ ├── bash-interceptor.ts # Bash command interception +│ ├── calculator.ts # Calculator tool +│ ├── complete.ts # Completion tool +│ ├── context.ts # Tool context utilities +│ ├── fetch.ts # URL content fetching +│ ├── find.ts # File search by glob +│ ├── gemini-image.ts # Gemini image generation +│ ├── grep.ts # Content search (regex/literal) +│ ├── ls.ts # Directory listing +│ ├── notebook.ts # Jupyter notebook editing +│ ├── output-meta.ts # Output metadata +│ ├── output-utils.ts # Output utilities +│ ├── path-utils.ts # Path resolution utilities +│ ├── python.ts # Python tool (delegates to ipy/) +│ ├── read.ts # File reading (text and images) +│ ├── renderers.ts # Tool output renderers +│ ├── render-utils.ts # Rendering utilities +│ ├── review.ts # Code review tools +│ ├── ssh.ts # SSH tool (delegates to ssh/) +│ ├── todo-write.ts # Todo management +│ ├── tool-errors.ts # Tool error types +│ ├── tool-result.ts # Tool result utilities +│ ├── truncate.ts # Output truncation utilities +│ └── write.ts # File writing + +├── utils/ # Generic utilities +│ ├── changelog.ts # parseChangelog(), getNewEntries() +│ ├── event-bus.ts # Event bus for tool communication +│ ├── file-mentions.ts # File mention detection +│ ├── frontmatter.ts # Frontmatter parsing +│ ├── image-convert.ts # Image format conversion +│ ├── image-resize.ts # Image resizing utilities +│ ├── mime.ts # MIME type detection +│ ├── shell.ts # getShellConfig() +│ ├── terminal-notify.ts # Terminal notification utilities +│ ├── timings.ts # Performance timing utilities +│ ├── title-generator.ts # Session title generation +│ ├── tools-manager.ts # ensureTool() - download fd, etc. +│ └── utils.ts # Generic utilities + +├── vendor/ # Vendored dependencies +│ └── photon/ # Photon image processing + +└── web/ # Web tools (merged web-scrapers + web-search) + ├── scrapers/ # Web scraping + │ ├── index.ts # Scraper exports + │ ├── types.ts # Scraper types + │ ├── utils.ts # Scraper utilities + │ └── (domain-specific scrapers) + └── search/ # Web search + ├── index.ts # WebSearchTool exports + ├── auth.ts # Search auth + ├── render.ts # Search result rendering + └── providers/ # Search providers + ├── anthropic.ts # Anthropic search + ├── exa.ts # Exa search + └── perplexity.ts # Perplexity search ``` ## Key Abstractions -### AgentSession (core/agent-session.ts) +### AgentSession (session/agent-session.ts) The central abstraction that wraps the SDK Agent with: @@ -245,11 +343,11 @@ The central abstraction that wraps the SDK Agent with: All three modes (interactive, print, rpc) use AgentSession. -### SDK (core/sdk.ts) +### SDK (sdk.ts) Wrapper around `@oh-my-pi/pi-agent-core` that provides a simplified interface for creating and managing agents programmatically. Used by AgentSession and available as a public API through index.ts exports. -### InteractiveMode (modes/interactive/interactive-mode.ts) +### InteractiveMode (modes/interactive-mode.ts) Handles TUI rendering and user interaction: @@ -268,7 +366,7 @@ Headless operation via JSON protocol over stdin/stdout: The RPC mode exposes the full AgentSession API via JSON commands. See [docs/rpc.md](docs/rpc.md) for protocol documentation. -### SessionManager (core/session-manager.ts) +### SessionManager (session/session-manager.ts) Handles session persistence: @@ -277,7 +375,7 @@ Handles session persistence: - Message loading/saving - Model/thinking level persistence -### SettingsManager (core/settings-manager.ts) +### SettingsManager (config/settings-manager.ts) Handles user preferences: @@ -290,13 +388,12 @@ Handles user preferences: - Thinking budgets (`thinkingBudgets` setting for custom token budgets per level) - Image blocking (`blockImages` setting to prevent images from being sent to LLM) -### Hook System (core/hooks/) +### Hook System (extensibility/hooks/) Extensibility layer for intercepting agent behavior: - **loader.ts**: Discovers and loads hooks from `~/.omp/agent/hooks/`, `.omp/hooks/`, and CLI - **runner.ts**: Dispatches events to registered hooks -- **tool-wrapper.ts**: Wraps tools to emit `tool_call` and `tool_result` events - **types.ts**: Event types (`session`, `tool_call`, `tool_result`, `message`, `error`, `user_bash`) See [docs/hooks.md](docs/hooks.md) for full documentation. @@ -305,7 +402,7 @@ See [docs/hooks.md](docs/hooks.md) for full documentation. The extension system uses a shared runtime pattern: -1. **ExtensionRuntime** (`core/extensions/types.ts`): Shared state and action handlers for all extensions +1. **ExtensionRuntime** (`extensibility/extensions/types.ts`): Shared state and action handlers for all extensions 2. **Extension**: Per-extension registration data (handlers, tools, commands, shortcuts) 3. **ExtensionAPI**: Per-extension API that writes registrations to Extension and delegates actions to runtime 4. **ExtensionRunner**: Orchestrates event dispatch and provides context to handlers @@ -316,7 +413,7 @@ Key extension events: - `user_bash`: Intercept `!`/`!!` commands for custom execution (e.g., remote SSH) - `session_shutdown`: Cleanup notification before exit -### Custom Tools (core/custom-tools/) +### Custom Tools (extensibility/custom-tools/) System for adding LLM-callable tools: @@ -325,7 +422,7 @@ System for adding LLM-callable tools: See [docs/custom-tools.md](docs/custom-tools.md) for full documentation. -### Skills (core/skills.ts) +### Skills (extensibility/skills.ts) On-demand capability packages: @@ -412,15 +509,15 @@ Tools like `fd` and `rg` are auto-downloaded to `~/.omp/bin/` (migrated from `~/ ### Adding a New Tool -1. Create tool factory in `core/tools/` following existing patterns (e.g., `createMyTool(session: ToolSession)`) -2. Export factory and types from `core/tools/index.ts` -3. Add to `BUILTIN_TOOLS` map in `core/tools/index.ts` +1. Create tool factory in `tools/` following existing patterns (e.g., `createMyTool(session: ToolSession)`) +2. Export factory and types from `tools/index.ts` +3. Add to `BUILTIN_TOOLS` map in `tools/index.ts` 4. Add tool prompt template to `prompts/tools/` if needed 5. Tool will automatically be included in system prompt ### Adding a New Hook Event -1. Add event type to hook event types in `core/hooks/types.ts` +1. Add event type to hook event types in `extensibility/hooks/types.ts` 2. Add emission point in relevant code (AgentSession, tool wrapper, etc.) 3. Update `docs/hooks.md` with the new event type @@ -434,7 +531,7 @@ Tools like `fd` and `rg` are auto-downloaded to `~/.omp/bin/` (migrated from `~/ ### Adding a New Selector -1. Create component in `modes/interactive/components/` +1. Create component in `modes/components/` 2. Use `showSelector()` helper in `interactive-mode.ts`: ```typescript @@ -474,7 +571,7 @@ private showMySelector(): void { ### Adding a New Keybinding -1. Add the action name to `AppAction` type in `core/keybindings.ts` +1. Add the action name to `AppAction` type in `config/keybindings.ts` 2. Add default binding to `DEFAULT_APP_KEYBINDINGS` 3. Add to `APP_ACTIONS` array 4. Handle the action in `CustomEditor` or `InteractiveMode` diff --git a/packages/coding-agent/src/cli/args.ts b/packages/coding-agent/src/cli/args.ts index fd10d62e8..7b944458e 100644 --- a/packages/coding-agent/src/cli/args.ts +++ b/packages/coding-agent/src/cli/args.ts @@ -5,7 +5,7 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import chalk from "chalk"; import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "$c/config"; -import { BUILTIN_TOOLS } from "$c/core/tools/index"; +import { BUILTIN_TOOLS } from "$c/tools/index"; export type Mode = "text" | "json" | "rpc"; diff --git a/packages/coding-agent/src/cli/config-cli.ts b/packages/coding-agent/src/cli/config-cli.ts index 57ed445b4..57326da62 100644 --- a/packages/coding-agent/src/cli/config-cli.ts +++ b/packages/coding-agent/src/cli/config-cli.ts @@ -7,9 +7,9 @@ import chalk from "chalk"; import { APP_NAME, getAgentDir } from "$c/config"; -import { SettingsManager } from "$c/core/settings-manager"; -import { SETTINGS_DEFS, type SettingDef } from "$c/modes/interactive/components/settings-defs"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { SettingsManager } from "$c/config/settings-manager"; +import { SETTINGS_DEFS, type SettingDef } from "$c/modes/components/settings-defs"; +import { theme } from "$c/modes/theme/theme"; // ============================================================================= // Types diff --git a/packages/coding-agent/src/cli/file-processor.ts b/packages/coding-agent/src/cli/file-processor.ts index 7b6f47b5f..b5b8b960c 100644 --- a/packages/coding-agent/src/cli/file-processor.ts +++ b/packages/coding-agent/src/cli/file-processor.ts @@ -6,7 +6,7 @@ import { existsSync, readFileSync, statSync } from "node:fs"; import { resolve } from "node:path"; import type { ImageContent } from "@oh-my-pi/pi-ai"; import chalk from "chalk"; -import { resolveReadPath } from "$c/core/tools/path-utils"; +import { resolveReadPath } from "$c/tools/path-utils"; import { formatDimensionNote, resizeImage } from "$c/utils/image-resize"; import { detectSupportedImageMimeTypeFromFile } from "$c/utils/mime"; diff --git a/packages/coding-agent/src/cli/list-models.ts b/packages/coding-agent/src/cli/list-models.ts index 955d1bc0e..aaf0be1c6 100644 --- a/packages/coding-agent/src/cli/list-models.ts +++ b/packages/coding-agent/src/cli/list-models.ts @@ -3,7 +3,7 @@ */ import type { Api, Model } from "@oh-my-pi/pi-ai"; -import type { ModelRegistry } from "$c/core/model-registry"; +import type { ModelRegistry } from "$c/config/model-registry"; import { fuzzyFilter } from "$c/utils/fuzzy"; /** diff --git a/packages/coding-agent/src/cli/plugin-cli.ts b/packages/coding-agent/src/cli/plugin-cli.ts index 4a624d343..f33f78a6c 100644 --- a/packages/coding-agent/src/cli/plugin-cli.ts +++ b/packages/coding-agent/src/cli/plugin-cli.ts @@ -6,8 +6,8 @@ import chalk from "chalk"; import { APP_NAME } from "$c/config"; -import { PluginManager, parseSettingValue, validateSetting } from "$c/core/plugins/index"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { PluginManager, parseSettingValue, validateSetting } from "$c/extensibility/plugins/index"; +import { theme } from "$c/modes/theme/theme"; // ============================================================================= // Types diff --git a/packages/coding-agent/src/cli/session-picker.ts b/packages/coding-agent/src/cli/session-picker.ts index 839ad6ed1..d591d9f40 100644 --- a/packages/coding-agent/src/cli/session-picker.ts +++ b/packages/coding-agent/src/cli/session-picker.ts @@ -3,8 +3,8 @@ */ import { ProcessTerminal, TUI } from "@oh-my-pi/pi-tui"; -import type { SessionInfo } from "$c/core/session-manager"; -import { SessionSelectorComponent } from "$c/modes/interactive/components/session-selector"; +import { SessionSelectorComponent } from "$c/modes/components/session-selector"; +import type { SessionInfo } from "$c/session/session-manager"; /** Show TUI session selector and return selected session path or null if cancelled */ export async function selectSession(sessions: SessionInfo[]): Promise { diff --git a/packages/coding-agent/src/cli/setup-cli.ts b/packages/coding-agent/src/cli/setup-cli.ts index a9c0ddf63..e5e0765d0 100644 --- a/packages/coding-agent/src/cli/setup-cli.ts +++ b/packages/coding-agent/src/cli/setup-cli.ts @@ -7,7 +7,7 @@ import { $ } from "bun"; import chalk from "chalk"; import { APP_NAME } from "$c/config"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; export type SetupComponent = "python"; diff --git a/packages/coding-agent/src/cli/update-cli.ts b/packages/coding-agent/src/cli/update-cli.ts index 0dbc3e127..0d865ec4e 100644 --- a/packages/coding-agent/src/cli/update-cli.ts +++ b/packages/coding-agent/src/cli/update-cli.ts @@ -12,7 +12,7 @@ import { Readable } from "node:stream"; import { pipeline } from "node:stream/promises"; import chalk from "chalk"; import { APP_NAME, VERSION } from "$c/config"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; /** * Detect if we're running as a Bun compiled binary. diff --git a/packages/coding-agent/src/core/keybindings.ts b/packages/coding-agent/src/config/keybindings.ts similarity index 100% rename from packages/coding-agent/src/core/keybindings.ts rename to packages/coding-agent/src/config/keybindings.ts diff --git a/packages/coding-agent/src/core/model-registry.ts b/packages/coding-agent/src/config/model-registry.ts similarity index 99% rename from packages/coding-agent/src/core/model-registry.ts rename to packages/coding-agent/src/config/model-registry.ts index 37c3fbaf3..45af40c6f 100644 --- a/packages/coding-agent/src/core/model-registry.ts +++ b/packages/coding-agent/src/config/model-registry.ts @@ -14,7 +14,7 @@ import { import { logger } from "@oh-my-pi/pi-utils"; import { type Static, Type } from "@sinclair/typebox"; import AjvModule from "ajv"; -import type { AuthStorage } from "./auth-storage"; +import type { AuthStorage } from "$c/session/auth-storage"; const Ajv = (AjvModule as any).default || AjvModule; diff --git a/packages/coding-agent/src/core/model-resolver.ts b/packages/coding-agent/src/config/model-resolver.ts similarity index 100% rename from packages/coding-agent/src/core/model-resolver.ts rename to packages/coding-agent/src/config/model-resolver.ts diff --git a/packages/coding-agent/src/core/prompt-templates.ts b/packages/coding-agent/src/config/prompt-templates.ts similarity index 99% rename from packages/coding-agent/src/core/prompt-templates.ts rename to packages/coding-agent/src/config/prompt-templates.ts index 2073f7acf..957b54b6d 100644 --- a/packages/coding-agent/src/core/prompt-templates.ts +++ b/packages/coding-agent/src/config/prompt-templates.ts @@ -2,7 +2,7 @@ import { join, resolve } from "node:path"; import { logger } from "@oh-my-pi/pi-utils"; import Handlebars from "handlebars"; import { CONFIG_DIR_NAME, getPromptsDir } from "$c/config"; -import { parseFrontmatter } from "./frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; /** * Represents a prompt template loaded from a markdown file diff --git a/packages/coding-agent/src/core/settings-manager.ts b/packages/coding-agent/src/config/settings-manager.ts similarity index 99% rename from packages/coding-agent/src/core/settings-manager.ts rename to packages/coding-agent/src/config/settings-manager.ts index fd825c550..d082eea04 100644 --- a/packages/coding-agent/src/core/settings-manager.ts +++ b/packages/coding-agent/src/config/settings-manager.ts @@ -4,8 +4,8 @@ import { logger } from "@oh-my-pi/pi-utils"; import { type Settings as SettingsItem, settingsCapability } from "$c/capability/settings"; import { getAgentDbPath, getAgentDir } from "$c/config"; import { loadCapability } from "$c/discovery"; -import type { SymbolPreset } from "$c/modes/interactive/theme/theme"; -import { AgentStorage } from "./agent-storage"; +import type { SymbolPreset } from "$c/modes/theme/theme"; +import { AgentStorage } from "$c/session/agent-storage"; export interface CompactionSettings { enabled?: boolean; // default: true diff --git a/packages/coding-agent/src/core/index.ts b/packages/coding-agent/src/core/index.ts deleted file mode 100644 index 683c7b13c..000000000 --- a/packages/coding-agent/src/core/index.ts +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Core modules shared between all run modes. - */ - -export { - AgentSession, - type AgentSessionConfig, - type AgentSessionEvent, - type AgentSessionEventListener, - type ModelCycleResult, - type PromptOptions, - type SessionStats, -} from "./agent-session"; -export { ArtifactManager } from "./artifacts"; -export { type BashExecutorOptions, type BashResult, executeBash } from "./bash-executor"; -export type { CompactionResult } from "./compaction/index"; -export { - discoverAndLoadExtensions, - type ExtensionAPI, - type ExtensionCommandContext, - type ExtensionContext, - type ExtensionFactory, - ExtensionRunner, - type ExtensionUIContext, - type ExtensionUIDialogOptions, - loadExtensionFromFactory, - type ToolDefinition, -} from "./extensions/index"; -export { HistoryStorage } from "./history-storage"; -export { - createMCPManager, - discoverAndLoadMCPTools, - loadAllMCPConfigs, - type MCPConfigFile, - type MCPLoadResult, - MCPManager, - type MCPServerConfig, - type MCPServerConnection, - MCPToolCache, - type MCPToolDefinition, - type MCPToolDetails, - type MCPToolsLoadResult, - type MCPTransport, -} from "./mcp/index"; -export { - type DiagnosticMeta, - type LimitsMeta, - type OutputMeta, - OutputMetaBuilder, - outputMeta, - type SourceMeta, - type TruncationMeta, - type TruncationOptions, - wrapToolsWithMetaNotice, - wrapToolWithMetaNotice, -} from "./output-meta"; -export { - buildRemoteCommand, - closeAllConnections, - closeConnection, - ensureConnection, - getControlDir, - getControlPathTemplate, - type SSHConnectionTarget, -} from "./ssh/connection-manager"; -export { executeSSH, type SSHExecutorOptions, type SSHResult } from "./ssh/ssh-executor"; -export { hasSshfs, isMounted, mountRemote, unmountAll, unmountRemote } from "./ssh/sshfs-mount"; -export { OutputSink, type OutputSinkOptions, type OutputSummary } from "./streaming-output"; -export { type ErrorEntry, MultiError, renderError, ToolError } from "./tool-errors"; - -export * as utils from "./utils"; diff --git a/packages/coding-agent/src/core/python-prelude.ts b/packages/coding-agent/src/core/python-prelude.ts deleted file mode 100644 index 8621ca60d..000000000 --- a/packages/coding-agent/src/core/python-prelude.ts +++ /dev/null @@ -1,3 +0,0 @@ -import pythonPrelude from "./python-prelude.py" with { type: "text" }; - -export const PYTHON_PRELUDE = pythonPrelude; diff --git a/packages/coding-agent/src/core/ssh-executor.ts b/packages/coding-agent/src/core/ssh-executor.ts deleted file mode 100644 index dce8a7c93..000000000 --- a/packages/coding-agent/src/core/ssh-executor.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Backwards-compatible re-export for SSH execution. - */ - -export { executeSSH, type SSHExecutorOptions, type SSHResult } from "./ssh/ssh-executor"; diff --git a/packages/coding-agent/src/core/cursor/exec-bridge.ts b/packages/coding-agent/src/cursor.ts similarity index 99% rename from packages/coding-agent/src/core/cursor/exec-bridge.ts rename to packages/coding-agent/src/cursor.ts index 9bee30bf8..6244b4095 100644 --- a/packages/coding-agent/src/core/cursor/exec-bridge.ts +++ b/packages/coding-agent/src/cursor.ts @@ -8,7 +8,7 @@ import type { AgentToolUpdateCallback, } from "@oh-my-pi/pi-agent-core"; import type { CursorMcpCall, CursorExecHandlers as ICursorExecHandlers, ToolResultMessage } from "@oh-my-pi/pi-ai"; -import { resolveToCwd } from "$c/core/tools/path-utils"; +import { resolveToCwd } from "$c/tools/path-utils"; interface CursorExecBridgeOptions { cwd: string; diff --git a/packages/coding-agent/src/discovery/builtin.ts b/packages/coding-agent/src/discovery/builtin.ts index 4314ac479..07944df4d 100644 --- a/packages/coding-agent/src/discovery/builtin.ts +++ b/packages/coding-agent/src/discovery/builtin.ts @@ -22,7 +22,7 @@ import { type SlashCommand, slashCommandCapability } from "$c/capability/slash-c import { type SystemPrompt, systemPromptCapability } from "$c/capability/system-prompt"; import { type CustomTool, toolCapability } from "$c/capability/tool"; import type { LoadContext, LoadResult } from "$c/capability/types"; -import { parseFrontmatter } from "$c/core/frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; import { createSourceMeta, discoverExtensionModulePaths, diff --git a/packages/coding-agent/src/discovery/cline.ts b/packages/coding-agent/src/discovery/cline.ts index 5df3e641d..0b9f880df 100644 --- a/packages/coding-agent/src/discovery/cline.ts +++ b/packages/coding-agent/src/discovery/cline.ts @@ -11,7 +11,7 @@ import { registerProvider } from "$c/capability/index"; import type { Rule } from "$c/capability/rule"; import { ruleCapability } from "$c/capability/rule"; import type { LoadContext, LoadResult } from "$c/capability/types"; -import { parseFrontmatter } from "$c/core/frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; import { createSourceMeta, loadFilesFromDir } from "./helpers"; const PROVIDER_ID = "cline"; diff --git a/packages/coding-agent/src/discovery/codex.ts b/packages/coding-agent/src/discovery/codex.ts index 4b5fb4c0e..bed43e46b 100644 --- a/packages/coding-agent/src/discovery/codex.ts +++ b/packages/coding-agent/src/discovery/codex.ts @@ -30,7 +30,7 @@ import { slashCommandCapability } from "$c/capability/slash-command"; import type { CustomTool } from "$c/capability/tool"; import { toolCapability } from "$c/capability/tool"; import type { LoadContext, LoadResult } from "$c/capability/types"; -import { parseFrontmatter } from "$c/core/frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; import { createSourceMeta, discoverExtensionModulePaths, diff --git a/packages/coding-agent/src/discovery/cursor.ts b/packages/coding-agent/src/discovery/cursor.ts index 202b37430..1db18c21d 100644 --- a/packages/coding-agent/src/discovery/cursor.ts +++ b/packages/coding-agent/src/discovery/cursor.ts @@ -22,7 +22,7 @@ import { ruleCapability } from "$c/capability/rule"; import type { Settings } from "$c/capability/settings"; import { settingsCapability } from "$c/capability/settings"; import type { LoadContext, LoadResult } from "$c/capability/types"; -import { parseFrontmatter } from "$c/core/frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; import { createSourceMeta, expandEnvVarsDeep, diff --git a/packages/coding-agent/src/discovery/github.ts b/packages/coding-agent/src/discovery/github.ts index fe7823400..d34d2e718 100644 --- a/packages/coding-agent/src/discovery/github.ts +++ b/packages/coding-agent/src/discovery/github.ts @@ -18,7 +18,7 @@ import { readFile } from "$c/capability/fs"; import { registerProvider } from "$c/capability/index"; import { type Instruction, instructionCapability } from "$c/capability/instruction"; import type { LoadContext, LoadResult, SourceMeta } from "$c/capability/types"; -import { parseFrontmatter } from "$c/core/frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; import { calculateDepth, createSourceMeta, getProjectPath, loadFilesFromDir } from "./helpers"; const PROVIDER_ID = "github"; diff --git a/packages/coding-agent/src/discovery/helpers.ts b/packages/coding-agent/src/discovery/helpers.ts index 6915ad6e8..62f2ac250 100644 --- a/packages/coding-agent/src/discovery/helpers.ts +++ b/packages/coding-agent/src/discovery/helpers.ts @@ -8,7 +8,7 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import { readDirEntries, readFile } from "$c/capability/fs"; import type { Skill, SkillFrontmatter } from "$c/capability/skill"; import type { LoadContext, LoadResult, SourceMeta } from "$c/capability/types"; -import { parseFrontmatter } from "$c/core/frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; const VALID_THINKING_LEVELS: readonly string[] = ["off", "minimal", "low", "medium", "high", "xhigh"]; const UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g; diff --git a/packages/coding-agent/src/discovery/windsurf.ts b/packages/coding-agent/src/discovery/windsurf.ts index 5b7db28ba..c2d8cfe12 100644 --- a/packages/coding-agent/src/discovery/windsurf.ts +++ b/packages/coding-agent/src/discovery/windsurf.ts @@ -16,7 +16,7 @@ import { registerProvider } from "$c/capability/index"; import { type MCPServer, mcpCapability } from "$c/capability/mcp"; import { type Rule, ruleCapability } from "$c/capability/rule"; import type { LoadContext, LoadResult } from "$c/capability/types"; -import { parseFrontmatter } from "$c/core/frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; import { createSourceMeta, expandEnvVarsDeep, diff --git a/packages/coding-agent/src/core/tools/exa/company.ts b/packages/coding-agent/src/exa/company.ts similarity index 96% rename from packages/coding-agent/src/core/tools/exa/company.ts rename to packages/coding-agent/src/exa/company.ts index e9764666f..24f71b141 100644 --- a/packages/coding-agent/src/core/tools/exa/company.ts +++ b/packages/coding-agent/src/exa/company.ts @@ -5,7 +5,7 @@ */ import { Type } from "@sinclair/typebox"; -import type { CustomTool } from "$c/core/custom-tools/types"; +import type { CustomTool } from "$c/extensibility/custom-tools/types"; import { callExaTool, findApiKey, formatSearchResults, isSearchResponse } from "./mcp-client"; import type { ExaRenderDetails } from "./types"; diff --git a/packages/coding-agent/src/core/tools/exa/index.ts b/packages/coding-agent/src/exa/index.ts similarity index 93% rename from packages/coding-agent/src/core/tools/exa/index.ts rename to packages/coding-agent/src/exa/index.ts index bfbb16ede..6008a7d44 100644 --- a/packages/coding-agent/src/core/tools/exa/index.ts +++ b/packages/coding-agent/src/exa/index.ts @@ -9,8 +9,8 @@ * - 14 websets tools (CRUD, items, search, enrichment, monitor) */ -import type { CustomTool } from "$c/core/custom-tools/types"; -import type { ExaSettings } from "$c/core/settings-manager"; +import type { ExaSettings } from "$c/config/settings-manager"; +import type { CustomTool } from "$c/extensibility/custom-tools/types"; import { companyTool } from "./company"; import { linkedinTool } from "./linkedin"; import { researcherTools } from "./researcher"; diff --git a/packages/coding-agent/src/core/tools/exa/linkedin.ts b/packages/coding-agent/src/exa/linkedin.ts similarity index 96% rename from packages/coding-agent/src/core/tools/exa/linkedin.ts rename to packages/coding-agent/src/exa/linkedin.ts index 4e1ee2b5b..0f96e409e 100644 --- a/packages/coding-agent/src/core/tools/exa/linkedin.ts +++ b/packages/coding-agent/src/exa/linkedin.ts @@ -5,7 +5,7 @@ */ import { Type } from "@sinclair/typebox"; -import type { CustomTool } from "$c/core/custom-tools/types"; +import type { CustomTool } from "$c/extensibility/custom-tools/types"; import { callExaTool, findApiKey, formatSearchResults, isSearchResponse } from "./mcp-client"; import type { ExaRenderDetails } from "./types"; diff --git a/packages/coding-agent/src/core/tools/exa/mcp-client.ts b/packages/coding-agent/src/exa/mcp-client.ts similarity index 98% rename from packages/coding-agent/src/core/tools/exa/mcp-client.ts rename to packages/coding-agent/src/exa/mcp-client.ts index a22e8a512..b7375478a 100644 --- a/packages/coding-agent/src/core/tools/exa/mcp-client.ts +++ b/packages/coding-agent/src/exa/mcp-client.ts @@ -8,8 +8,8 @@ import { existsSync, readFileSync } from "node:fs"; import { homedir } from "node:os"; import { logger } from "@oh-my-pi/pi-utils"; import type { TSchema } from "@sinclair/typebox"; -import type { CustomTool, CustomToolResult } from "$c/core/custom-tools/types"; -import { callMCP } from "$c/core/mcp/json-rpc"; +import type { CustomTool, CustomToolResult } from "$c/extensibility/custom-tools/types"; +import { callMCP } from "$c/mcp/json-rpc"; import type { ExaRenderDetails, ExaSearchResponse, diff --git a/packages/coding-agent/src/core/tools/exa/render.ts b/packages/coding-agent/src/exa/render.ts similarity index 98% rename from packages/coding-agent/src/core/tools/exa/render.ts rename to packages/coding-agent/src/exa/render.ts index e23b6a879..b01ccc4f6 100644 --- a/packages/coding-agent/src/core/tools/exa/render.ts +++ b/packages/coding-agent/src/exa/render.ts @@ -7,7 +7,8 @@ import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { Theme } from "$c/modes/theme/theme"; import { formatCount, formatExpandHint, @@ -18,8 +19,7 @@ import { PREVIEW_LIMITS, TRUNCATE_LENGTHS, truncate, -} from "$c/core/tools/render-utils"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +} from "$c/tools/render-utils"; import type { ExaRenderDetails } from "./types"; const COLLAPSED_PREVIEW_LINES = PREVIEW_LIMITS.COLLAPSED_LINES; diff --git a/packages/coding-agent/src/core/tools/exa/researcher.ts b/packages/coding-agent/src/exa/researcher.ts similarity index 97% rename from packages/coding-agent/src/core/tools/exa/researcher.ts rename to packages/coding-agent/src/exa/researcher.ts index a07995d2c..f93b46bb4 100644 --- a/packages/coding-agent/src/core/tools/exa/researcher.ts +++ b/packages/coding-agent/src/exa/researcher.ts @@ -5,7 +5,7 @@ */ import { Type } from "@sinclair/typebox"; -import type { CustomTool } from "$c/core/custom-tools/types"; +import type { CustomTool } from "$c/extensibility/custom-tools/types"; import { callExaTool, findApiKey } from "./mcp-client"; import type { ExaRenderDetails } from "./types"; diff --git a/packages/coding-agent/src/core/tools/exa/search.ts b/packages/coding-agent/src/exa/search.ts similarity index 99% rename from packages/coding-agent/src/core/tools/exa/search.ts rename to packages/coding-agent/src/exa/search.ts index 0f3b4fc72..971c6f7c7 100644 --- a/packages/coding-agent/src/core/tools/exa/search.ts +++ b/packages/coding-agent/src/exa/search.ts @@ -6,7 +6,7 @@ import { StringEnum } from "@oh-my-pi/pi-ai"; import { Type } from "@sinclair/typebox"; -import type { CustomTool } from "$c/core/custom-tools/types"; +import type { CustomTool } from "$c/extensibility/custom-tools/types"; import { callExaTool, findApiKey, formatSearchResults, isSearchResponse } from "./mcp-client"; import type { ExaRenderDetails } from "./types"; diff --git a/packages/coding-agent/src/core/tools/exa/types.ts b/packages/coding-agent/src/exa/types.ts similarity index 100% rename from packages/coding-agent/src/core/tools/exa/types.ts rename to packages/coding-agent/src/exa/types.ts diff --git a/packages/coding-agent/src/core/tools/exa/websets.ts b/packages/coding-agent/src/exa/websets.ts similarity index 98% rename from packages/coding-agent/src/core/tools/exa/websets.ts rename to packages/coding-agent/src/exa/websets.ts index bab27dd8c..aa8ed051b 100644 --- a/packages/coding-agent/src/core/tools/exa/websets.ts +++ b/packages/coding-agent/src/exa/websets.ts @@ -5,7 +5,7 @@ */ import { Type } from "@sinclair/typebox"; -import type { CustomTool } from "$c/core/custom-tools/types"; +import type { CustomTool } from "$c/extensibility/custom-tools/types"; import { callWebsetsTool, findApiKey } from "./mcp-client"; import type { ExaRenderDetails } from "./types"; diff --git a/packages/coding-agent/src/core/bash-executor.ts b/packages/coding-agent/src/exec/bash-executor.ts similarity index 97% rename from packages/coding-agent/src/core/bash-executor.ts rename to packages/coding-agent/src/exec/bash-executor.ts index 968fece12..a4f5ee29c 100644 --- a/packages/coding-agent/src/core/bash-executor.ts +++ b/packages/coding-agent/src/exec/bash-executor.ts @@ -5,9 +5,9 @@ */ import { cspawn, Exception, ptree } from "@oh-my-pi/pi-utils"; +import { OutputSink } from "$c/session/streaming-output"; import { getShellConfig } from "$c/utils/shell"; import { getOrCreateSnapshot, getSnapshotSourceCommand } from "$c/utils/shell-snapshot"; -import { OutputSink } from "./streaming-output"; export interface BashExecutorOptions { cwd?: string; diff --git a/packages/coding-agent/src/core/exec.ts b/packages/coding-agent/src/exec/exec.ts similarity index 100% rename from packages/coding-agent/src/core/exec.ts rename to packages/coding-agent/src/exec/exec.ts diff --git a/packages/coding-agent/src/core/custom-share.ts b/packages/coding-agent/src/export/custom-share.ts similarity index 100% rename from packages/coding-agent/src/core/custom-share.ts rename to packages/coding-agent/src/export/custom-share.ts diff --git a/packages/coding-agent/src/core/export-html/index.ts b/packages/coding-agent/src/export/html/index.ts similarity index 98% rename from packages/coding-agent/src/core/export-html/index.ts rename to packages/coding-agent/src/export/html/index.ts index f43ed4e89..61e593a43 100644 --- a/packages/coding-agent/src/core/export-html/index.ts +++ b/packages/coding-agent/src/export/html/index.ts @@ -2,8 +2,8 @@ import { existsSync, writeFileSync } from "node:fs"; import { basename } from "node:path"; import type { AgentState } from "@oh-my-pi/pi-agent-core"; import { APP_NAME } from "$c/config"; -import { SessionManager } from "$c/core/session-manager"; -import { getResolvedThemeColors, getThemeExportColors } from "$c/modes/interactive/theme/theme"; +import { getResolvedThemeColors, getThemeExportColors } from "$c/modes/theme/theme"; +import { SessionManager } from "$c/session/session-manager"; // Pre-generated template (created by scripts/generate-template.ts at publish time) import { TEMPLATE } from "./template.generated"; diff --git a/packages/coding-agent/src/core/export-html/template.css b/packages/coding-agent/src/export/html/template.css similarity index 100% rename from packages/coding-agent/src/core/export-html/template.css rename to packages/coding-agent/src/export/html/template.css diff --git a/packages/coding-agent/src/export/html/template.generated.ts b/packages/coding-agent/src/export/html/template.generated.ts new file mode 100644 index 000000000..6b923f776 --- /dev/null +++ b/packages/coding-agent/src/export/html/template.generated.ts @@ -0,0 +1,2 @@ +// Auto-generated by scripts/generate-template.ts - DO NOT EDIT +export const TEMPLATE = "\n\n\n \n \n Session Export\n \n \n\n\n \n
\n
\n \n
\n
\n
\n
\n
\n \"\"\n
\n
\n\n \n \n \n \n\n\n"; diff --git a/packages/coding-agent/src/core/export-html/template.html b/packages/coding-agent/src/export/html/template.html similarity index 100% rename from packages/coding-agent/src/core/export-html/template.html rename to packages/coding-agent/src/export/html/template.html diff --git a/packages/coding-agent/src/core/export-html/template.js b/packages/coding-agent/src/export/html/template.js similarity index 100% rename from packages/coding-agent/src/core/export-html/template.js rename to packages/coding-agent/src/export/html/template.js diff --git a/packages/coding-agent/src/core/export-html/template.macro.ts b/packages/coding-agent/src/export/html/template.macro.ts similarity index 100% rename from packages/coding-agent/src/core/export-html/template.macro.ts rename to packages/coding-agent/src/export/html/template.macro.ts diff --git a/packages/coding-agent/src/core/export-html/vendor/highlight.min.js b/packages/coding-agent/src/export/html/vendor/highlight.min.js similarity index 100% rename from packages/coding-agent/src/core/export-html/vendor/highlight.min.js rename to packages/coding-agent/src/export/html/vendor/highlight.min.js diff --git a/packages/coding-agent/src/core/export-html/vendor/marked.min.js b/packages/coding-agent/src/export/html/vendor/marked.min.js similarity index 100% rename from packages/coding-agent/src/core/export-html/vendor/marked.min.js rename to packages/coding-agent/src/export/html/vendor/marked.min.js diff --git a/packages/coding-agent/src/core/ttsr.ts b/packages/coding-agent/src/export/ttsr.ts similarity index 98% rename from packages/coding-agent/src/core/ttsr.ts rename to packages/coding-agent/src/export/ttsr.ts index b215c3e21..780d6d018 100644 --- a/packages/coding-agent/src/core/ttsr.ts +++ b/packages/coding-agent/src/export/ttsr.ts @@ -8,7 +8,7 @@ import { logger } from "@oh-my-pi/pi-utils"; import type { Rule } from "$c/capability/rule"; -import type { TtsrSettings } from "./settings-manager"; +import type { TtsrSettings } from "$c/config/settings-manager"; interface TtsrEntry { rule: Rule; diff --git a/packages/coding-agent/src/core/custom-commands/bundled/review/index.ts b/packages/coding-agent/src/extensibility/custom-commands/bundled/review/index.ts similarity index 98% rename from packages/coding-agent/src/core/custom-commands/bundled/review/index.ts rename to packages/coding-agent/src/extensibility/custom-commands/bundled/review/index.ts index bf79b7b3a..d6bc57861 100644 --- a/packages/coding-agent/src/core/custom-commands/bundled/review/index.ts +++ b/packages/coding-agent/src/extensibility/custom-commands/bundled/review/index.ts @@ -12,9 +12,9 @@ * multiple reviewer agents based on diff weight and locality. */ -import type { CustomCommand, CustomCommandAPI } from "$c/core/custom-commands/types"; -import type { HookCommandContext } from "$c/core/hooks/types"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { CustomCommand, CustomCommandAPI } from "$c/extensibility/custom-commands/types"; +import type { HookCommandContext } from "$c/extensibility/hooks/types"; import reviewRequestTemplate from "$c/prompts/review-request.md" with { type: "text" }; // ───────────────────────────────────────────────────────────────────────────── diff --git a/packages/coding-agent/src/core/custom-commands/index.ts b/packages/coding-agent/src/extensibility/custom-commands/index.ts similarity index 100% rename from packages/coding-agent/src/core/custom-commands/index.ts rename to packages/coding-agent/src/extensibility/custom-commands/index.ts diff --git a/packages/coding-agent/src/core/custom-commands/loader.ts b/packages/coding-agent/src/extensibility/custom-commands/loader.ts similarity index 99% rename from packages/coding-agent/src/core/custom-commands/loader.ts rename to packages/coding-agent/src/extensibility/custom-commands/loader.ts index d761aa2be..d60885c38 100644 --- a/packages/coding-agent/src/core/custom-commands/loader.ts +++ b/packages/coding-agent/src/extensibility/custom-commands/loader.ts @@ -10,7 +10,7 @@ import * as path from "node:path"; import { logger } from "@oh-my-pi/pi-utils"; import * as typebox from "@sinclair/typebox"; import { getAgentDir, getConfigDirs } from "$c/config"; -import { execCommand } from "$c/core/exec"; +import { execCommand } from "$c/exec/exec"; import * as piCodingAgent from "$c/index"; import { ReviewCommand } from "./bundled/review"; import type { diff --git a/packages/coding-agent/src/core/custom-commands/types.ts b/packages/coding-agent/src/extensibility/custom-commands/types.ts similarity index 99% rename from packages/coding-agent/src/core/custom-commands/types.ts rename to packages/coding-agent/src/extensibility/custom-commands/types.ts index 72c634f5b..083ea6c74 100644 --- a/packages/coding-agent/src/core/custom-commands/types.ts +++ b/packages/coding-agent/src/extensibility/custom-commands/types.ts @@ -6,7 +6,7 @@ * arbitrary logic with full access to the hook context. */ -import type { ExecOptions, ExecResult, HookCommandContext } from "$c/core/hooks/types"; +import type { ExecOptions, ExecResult, HookCommandContext } from "$c/extensibility/hooks/types"; // Re-export for custom commands to use export type { ExecOptions, ExecResult, HookCommandContext }; diff --git a/packages/coding-agent/src/core/custom-tools/index.ts b/packages/coding-agent/src/extensibility/custom-tools/index.ts similarity index 100% rename from packages/coding-agent/src/core/custom-tools/index.ts rename to packages/coding-agent/src/extensibility/custom-tools/index.ts diff --git a/packages/coding-agent/src/core/custom-tools/loader.ts b/packages/coding-agent/src/extensibility/custom-tools/loader.ts similarity index 96% rename from packages/coding-agent/src/core/custom-tools/loader.ts rename to packages/coding-agent/src/extensibility/custom-tools/loader.ts index 8aeca3a2d..ff1f16929 100644 --- a/packages/coding-agent/src/core/custom-tools/loader.ts +++ b/packages/coding-agent/src/extensibility/custom-tools/loader.ts @@ -9,14 +9,14 @@ import * as path from "node:path"; import { logger } from "@oh-my-pi/pi-utils"; import * as typebox from "@sinclair/typebox"; import { toolCapability } from "$c/capability/tool"; -import type { ExecOptions } from "$c/core/exec"; -import { execCommand } from "$c/core/exec"; -import type { HookUIContext } from "$c/core/hooks/types"; -import { getAllPluginToolPaths } from "$c/core/plugins/loader"; import { type CustomTool, loadCapability } from "$c/discovery"; import { expandPath } from "$c/discovery/helpers"; +import type { ExecOptions } from "$c/exec/exec"; +import { execCommand } from "$c/exec/exec"; +import type { HookUIContext } from "$c/extensibility/hooks/types"; +import { getAllPluginToolPaths } from "$c/extensibility/plugins/loader"; import * as piCodingAgent from "$c/index"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; import type { CustomToolAPI, CustomToolFactory, LoadedCustomTool, ToolLoadError } from "./types"; /** diff --git a/packages/coding-agent/src/core/custom-tools/types.ts b/packages/coding-agent/src/extensibility/custom-tools/types.ts similarity index 94% rename from packages/coding-agent/src/core/custom-tools/types.ts rename to packages/coding-agent/src/extensibility/custom-tools/types.ts index 303cc79b7..ea19934b1 100644 --- a/packages/coding-agent/src/core/custom-tools/types.ts +++ b/packages/coding-agent/src/extensibility/custom-tools/types.ts @@ -9,11 +9,11 @@ import type { AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agen import type { Model } from "@oh-my-pi/pi-ai"; import type { Component } from "@oh-my-pi/pi-tui"; import type { Static, TSchema } from "@sinclair/typebox"; -import type { ExecOptions, ExecResult } from "$c/core/exec"; -import type { HookUIContext } from "$c/core/hooks/types"; -import type { ModelRegistry } from "$c/core/model-registry"; -import type { ReadonlySessionManager } from "$c/core/session-manager"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { ModelRegistry } from "$c/config/model-registry"; +import type { ExecOptions, ExecResult } from "$c/exec/exec"; +import type { HookUIContext } from "$c/extensibility/hooks/types"; +import type { Theme } from "$c/modes/theme/theme"; +import type { ReadonlySessionManager } from "$c/session/session-manager"; /** Alias for clarity */ export type CustomToolUIContext = HookUIContext; @@ -22,7 +22,7 @@ export type CustomToolUIContext = HookUIContext; export type { AgentToolResult, AgentToolUpdateCallback }; // Re-export for backward compatibility -export type { ExecOptions, ExecResult } from "$c/core/exec"; +export type { ExecOptions, ExecResult } from "$c/exec/exec"; /** API passed to custom tool factory (stable across session changes) */ export interface CustomToolAPI { diff --git a/packages/coding-agent/src/core/custom-tools/wrapper.ts b/packages/coding-agent/src/extensibility/custom-tools/wrapper.ts similarity index 97% rename from packages/coding-agent/src/core/custom-tools/wrapper.ts rename to packages/coding-agent/src/extensibility/custom-tools/wrapper.ts index f121b5428..c322eeb43 100644 --- a/packages/coding-agent/src/core/custom-tools/wrapper.ts +++ b/packages/coding-agent/src/extensibility/custom-tools/wrapper.ts @@ -5,7 +5,7 @@ import type { AgentTool, AgentToolResult, AgentToolUpdateCallback, RenderResultOptions } from "@oh-my-pi/pi-agent-core"; import type { Component } from "@oh-my-pi/pi-tui"; import type { Static, TSchema } from "@sinclair/typebox"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { Theme } from "$c/modes/theme/theme"; import type { CustomTool, CustomToolContext, LoadedCustomTool } from "./types"; export class CustomToolAdapter diff --git a/packages/coding-agent/src/core/extensions/index.ts b/packages/coding-agent/src/extensibility/extensions/index.ts similarity index 100% rename from packages/coding-agent/src/core/extensions/index.ts rename to packages/coding-agent/src/extensibility/extensions/index.ts diff --git a/packages/coding-agent/src/core/extensions/loader.ts b/packages/coding-agent/src/extensibility/extensions/loader.ts similarity index 98% rename from packages/coding-agent/src/core/extensions/loader.ts rename to packages/coding-agent/src/extensibility/extensions/loader.ts index 573d4dbb8..5150841ee 100644 --- a/packages/coding-agent/src/core/extensions/loader.ts +++ b/packages/coding-agent/src/extensibility/extensions/loader.ts @@ -11,13 +11,13 @@ import { logger } from "@oh-my-pi/pi-utils"; import type { TSchema } from "@sinclair/typebox"; import * as TypeBox from "@sinclair/typebox"; import { type ExtensionModule, extensionModuleCapability } from "$c/capability/extension-module"; -import { EventBus } from "$c/core/event-bus"; -import type { ExecOptions } from "$c/core/exec"; -import { execCommand } from "$c/core/exec"; -import type { CustomMessage } from "$c/core/messages"; import { loadCapability } from "$c/discovery"; import { expandPath, getExtensionNameFromPath } from "$c/discovery/helpers"; +import type { ExecOptions } from "$c/exec/exec"; +import { execCommand } from "$c/exec/exec"; import * as piCodingAgent from "$c/index"; +import type { CustomMessage } from "$c/session/messages"; +import { EventBus } from "$c/utils/event-bus"; import type { Extension, ExtensionAPI, diff --git a/packages/coding-agent/src/core/extensions/runner.ts b/packages/coding-agent/src/extensibility/extensions/runner.ts similarity index 98% rename from packages/coding-agent/src/core/extensions/runner.ts rename to packages/coding-agent/src/extensibility/extensions/runner.ts index 2c955154b..a6f3bb121 100644 --- a/packages/coding-agent/src/core/extensions/runner.ts +++ b/packages/coding-agent/src/extensibility/extensions/runner.ts @@ -6,9 +6,9 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Model } from "@oh-my-pi/pi-ai"; import type { KeyId } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; -import type { ModelRegistry } from "$c/core/model-registry"; -import type { SessionManager } from "$c/core/session-manager"; -import { type Theme, theme } from "$c/modes/interactive/theme/theme"; +import type { ModelRegistry } from "$c/config/model-registry"; +import { type Theme, theme } from "$c/modes/theme/theme"; +import type { SessionManager } from "$c/session/session-manager"; import type { BeforeAgentStartEvent, BeforeAgentStartEventResult, diff --git a/packages/coding-agent/src/core/extensions/types.ts b/packages/coding-agent/src/extensibility/extensions/types.ts similarity index 97% rename from packages/coding-agent/src/core/extensions/types.ts rename to packages/coding-agent/src/extensibility/extensions/types.ts index 78508cc8b..f4db1f5b2 100644 --- a/packages/coding-agent/src/core/extensions/types.ts +++ b/packages/coding-agent/src/extensibility/extensions/types.ts @@ -12,28 +12,28 @@ import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLe import type { ImageContent, Model, TextContent, ToolResultMessage } from "@oh-my-pi/pi-ai"; import type { AutocompleteItem, Component, EditorComponent, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui"; import type { Static, TSchema } from "@sinclair/typebox"; -import type { BashResult } from "$c/core/bash-executor"; -import type { CompactionPreparation, CompactionResult } from "$c/core/compaction"; -import type { EventBus } from "$c/core/event-bus"; -import type { ExecOptions, ExecResult } from "$c/core/exec"; -import type { KeybindingsManager } from "$c/core/keybindings"; -import type { CustomMessage } from "$c/core/messages"; -import type { ModelRegistry } from "$c/core/model-registry"; -import type { PythonResult } from "$c/core/python-executor"; +import type { KeybindingsManager } from "$c/config/keybindings"; +import type { ModelRegistry } from "$c/config/model-registry"; +import type { BashResult } from "$c/exec/bash-executor"; +import type { ExecOptions, ExecResult } from "$c/exec/exec"; +import type * as piCodingAgent from "$c/index"; +import type { PythonResult } from "$c/ipy/executor"; +import type { Theme } from "$c/modes/theme/theme"; +import type { EditToolDetails } from "$c/patch"; +import type { CompactionPreparation, CompactionResult } from "$c/session/compaction"; +import type { CustomMessage } from "$c/session/messages"; import type { BranchSummaryEntry, CompactionEntry, ReadonlySessionManager, SessionEntry, SessionManager, -} from "$c/core/session-manager"; -import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "$c/core/tools"; -import type { EditToolDetails } from "$c/core/tools/patch"; -import type * as piCodingAgent from "$c/index"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +} from "$c/session/session-manager"; +import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "$c/tools"; +import type { EventBus } from "$c/utils/event-bus"; -export type { ExecOptions, ExecResult } from "$c/core/exec"; -export type { AppAction, KeybindingsManager } from "$c/core/keybindings"; +export type { AppAction, KeybindingsManager } from "$c/config/keybindings"; +export type { ExecOptions, ExecResult } from "$c/exec/exec"; export type { AgentToolResult, AgentToolUpdateCallback }; // ============================================================================ diff --git a/packages/coding-agent/src/core/extensions/wrapper.ts b/packages/coding-agent/src/extensibility/extensions/wrapper.ts similarity index 98% rename from packages/coding-agent/src/core/extensions/wrapper.ts rename to packages/coding-agent/src/extensibility/extensions/wrapper.ts index 741e3059a..0f09d311b 100644 --- a/packages/coding-agent/src/core/extensions/wrapper.ts +++ b/packages/coding-agent/src/extensibility/extensions/wrapper.ts @@ -5,7 +5,7 @@ import type { AgentTool, AgentToolContext, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, TextContent } from "@oh-my-pi/pi-ai"; import type { Static, TSchema } from "@sinclair/typebox"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { Theme } from "$c/modes/theme/theme"; import type { ExtensionRunner } from "./runner"; import type { RegisteredTool, ToolCallEventResult, ToolResultEventResult } from "./types"; diff --git a/packages/coding-agent/src/core/hooks/index.ts b/packages/coding-agent/src/extensibility/hooks/index.ts similarity index 94% rename from packages/coding-agent/src/core/hooks/index.ts rename to packages/coding-agent/src/extensibility/hooks/index.ts index 3cba5aeac..3dc809e26 100644 --- a/packages/coding-agent/src/core/hooks/index.ts +++ b/packages/coding-agent/src/extensibility/hooks/index.ts @@ -1,5 +1,5 @@ // biome-ignore assist/source/organizeImports: biome is not smart -export type { ReadonlySessionManager, UsageStatistics } from "$c/core/session-manager"; +export type { ReadonlySessionManager, UsageStatistics } from "$c/session/session-manager"; export { discoverAndLoadHooks, loadHooks, diff --git a/packages/coding-agent/src/core/hooks/loader.ts b/packages/coding-agent/src/extensibility/hooks/loader.ts similarity index 98% rename from packages/coding-agent/src/core/hooks/loader.ts rename to packages/coding-agent/src/extensibility/hooks/loader.ts index d1cce69e0..06078699a 100644 --- a/packages/coding-agent/src/core/hooks/loader.ts +++ b/packages/coding-agent/src/extensibility/hooks/loader.ts @@ -6,12 +6,12 @@ import * as path from "node:path"; import { logger } from "@oh-my-pi/pi-utils"; import * as typebox from "@sinclair/typebox"; import { hookCapability } from "$c/capability/hook"; -import type { HookMessage } from "$c/core/messages"; -import type { SessionManager } from "$c/core/session-manager"; import type { Hook } from "$c/discovery"; import { loadCapability } from "$c/discovery"; import { expandPath } from "$c/discovery/helpers"; import * as piCodingAgent from "$c/index"; +import type { HookMessage } from "$c/session/messages"; +import type { SessionManager } from "$c/session/session-manager"; import { execCommand } from "./runner"; import type { ExecOptions, HookAPI, HookFactory, HookMessageRenderer, RegisteredCommand } from "./types"; diff --git a/packages/coding-agent/src/core/hooks/runner.ts b/packages/coding-agent/src/extensibility/hooks/runner.ts similarity index 98% rename from packages/coding-agent/src/core/hooks/runner.ts rename to packages/coding-agent/src/extensibility/hooks/runner.ts index b568889ad..f1ae1676c 100644 --- a/packages/coding-agent/src/core/hooks/runner.ts +++ b/packages/coding-agent/src/extensibility/hooks/runner.ts @@ -4,9 +4,9 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { Model } from "@oh-my-pi/pi-ai"; -import type { ModelRegistry } from "$c/core/model-registry"; -import type { SessionManager } from "$c/core/session-manager"; -import { theme } from "$c/modes/interactive/theme/theme"; +import type { ModelRegistry } from "$c/config/model-registry"; +import { theme } from "$c/modes/theme/theme"; +import type { SessionManager } from "$c/session/session-manager"; import type { AppendEntryHandler, BranchHandler, @@ -40,7 +40,7 @@ import type { export type HookErrorListener = (error: HookError) => void; // Re-export execCommand for backward compatibility -export { execCommand } from "$c/core/exec"; +export { execCommand } from "$c/exec/exec"; /** No-op UI context used when no UI is available */ const noOpUIContext: HookUIContext = { diff --git a/packages/coding-agent/src/core/hooks/tool-wrapper.ts b/packages/coding-agent/src/extensibility/hooks/tool-wrapper.ts similarity index 100% rename from packages/coding-agent/src/core/hooks/tool-wrapper.ts rename to packages/coding-agent/src/extensibility/hooks/tool-wrapper.ts diff --git a/packages/coding-agent/src/core/hooks/types.ts b/packages/coding-agent/src/extensibility/hooks/types.ts similarity index 97% rename from packages/coding-agent/src/core/hooks/types.ts rename to packages/coding-agent/src/extensibility/hooks/types.ts index e42b6c09e..45d5f1976 100644 --- a/packages/coding-agent/src/core/hooks/types.ts +++ b/packages/coding-agent/src/extensibility/hooks/types.ts @@ -8,29 +8,23 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Message, Model, TextContent, ToolResultMessage } from "@oh-my-pi/pi-ai"; import type { Component, TUI } from "@oh-my-pi/pi-tui"; -import type { CompactionPreparation, CompactionResult } from "$c/core/compaction/index"; -import type { ExecOptions, ExecResult } from "$c/core/exec"; -import type { HookMessage } from "$c/core/messages"; -import type { ModelRegistry } from "$c/core/model-registry"; +import type { ModelRegistry } from "$c/config/model-registry"; +import type { ExecOptions, ExecResult } from "$c/exec/exec"; +import type { Theme } from "$c/modes/theme/theme"; +import type { EditToolDetails } from "$c/patch"; +import type { CompactionPreparation, CompactionResult } from "$c/session/compaction/index"; +import type { HookMessage } from "$c/session/messages"; import type { BranchSummaryEntry, CompactionEntry, ReadonlySessionManager, SessionEntry, SessionManager, -} from "$c/core/session-manager"; -import type { - BashToolDetails, - FindToolDetails, - GrepToolDetails, - LsToolDetails, - ReadToolDetails, -} from "$c/core/tools/index"; -import type { EditToolDetails } from "$c/core/tools/patch"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +} from "$c/session/session-manager"; +import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "$c/tools/index"; // Re-export for backward compatibility -export type { ExecOptions, ExecResult } from "$c/core/exec"; +export type { ExecOptions, ExecResult } from "$c/exec/exec"; /** * UI context for hooks to request interactive UI from the harness. diff --git a/packages/coding-agent/src/core/plugins/doctor.ts b/packages/coding-agent/src/extensibility/plugins/doctor.ts similarity index 97% rename from packages/coding-agent/src/core/plugins/doctor.ts rename to packages/coding-agent/src/extensibility/plugins/doctor.ts index b89672f96..9280ef612 100644 --- a/packages/coding-agent/src/core/plugins/doctor.ts +++ b/packages/coding-agent/src/extensibility/plugins/doctor.ts @@ -1,4 +1,4 @@ -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; import type { DoctorCheck } from "./types"; export async function runDoctorChecks(): Promise { diff --git a/packages/coding-agent/src/core/plugins/index.ts b/packages/coding-agent/src/extensibility/plugins/index.ts similarity index 100% rename from packages/coding-agent/src/core/plugins/index.ts rename to packages/coding-agent/src/extensibility/plugins/index.ts diff --git a/packages/coding-agent/src/core/plugins/installer.ts b/packages/coding-agent/src/extensibility/plugins/installer.ts similarity index 100% rename from packages/coding-agent/src/core/plugins/installer.ts rename to packages/coding-agent/src/extensibility/plugins/installer.ts diff --git a/packages/coding-agent/src/core/plugins/loader.ts b/packages/coding-agent/src/extensibility/plugins/loader.ts similarity index 100% rename from packages/coding-agent/src/core/plugins/loader.ts rename to packages/coding-agent/src/extensibility/plugins/loader.ts diff --git a/packages/coding-agent/src/core/plugins/manager.ts b/packages/coding-agent/src/extensibility/plugins/manager.ts similarity index 100% rename from packages/coding-agent/src/core/plugins/manager.ts rename to packages/coding-agent/src/extensibility/plugins/manager.ts diff --git a/packages/coding-agent/src/core/plugins/parser.ts b/packages/coding-agent/src/extensibility/plugins/parser.ts similarity index 100% rename from packages/coding-agent/src/core/plugins/parser.ts rename to packages/coding-agent/src/extensibility/plugins/parser.ts diff --git a/packages/coding-agent/src/core/plugins/paths.ts b/packages/coding-agent/src/extensibility/plugins/paths.ts similarity index 100% rename from packages/coding-agent/src/core/plugins/paths.ts rename to packages/coding-agent/src/extensibility/plugins/paths.ts diff --git a/packages/coding-agent/src/core/plugins/types.ts b/packages/coding-agent/src/extensibility/plugins/types.ts similarity index 100% rename from packages/coding-agent/src/core/plugins/types.ts rename to packages/coding-agent/src/extensibility/plugins/types.ts diff --git a/packages/coding-agent/src/core/skills.ts b/packages/coding-agent/src/extensibility/skills.ts similarity index 98% rename from packages/coding-agent/src/core/skills.ts rename to packages/coding-agent/src/extensibility/skills.ts index e68366631..50831c562 100644 --- a/packages/coding-agent/src/core/skills.ts +++ b/packages/coding-agent/src/extensibility/skills.ts @@ -4,10 +4,10 @@ import { basename, join } from "node:path"; import { logger } from "@oh-my-pi/pi-utils"; import { skillCapability } from "$c/capability/skill"; import type { SourceMeta } from "$c/capability/types"; +import type { SkillsSettings } from "$c/config/settings-manager"; import type { Skill as CapabilitySkill, SkillFrontmatter as ImportedSkillFrontmatter } from "$c/discovery"; import { loadCapability } from "$c/discovery"; -import { parseFrontmatter } from "./frontmatter"; -import type { SkillsSettings } from "./settings-manager"; +import { parseFrontmatter } from "$c/utils/frontmatter"; // Re-export SkillFrontmatter for backward compatibility export type { ImportedSkillFrontmatter as SkillFrontmatter }; diff --git a/packages/coding-agent/src/core/slash-commands.ts b/packages/coding-agent/src/extensibility/slash-commands.ts similarity index 96% rename from packages/coding-agent/src/core/slash-commands.ts rename to packages/coding-agent/src/extensibility/slash-commands.ts index 3b6ef5132..47049aed7 100644 --- a/packages/coding-agent/src/core/slash-commands.ts +++ b/packages/coding-agent/src/extensibility/slash-commands.ts @@ -1,9 +1,9 @@ import { slashCommandCapability } from "$c/capability/slash-command"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; import type { SlashCommand } from "$c/discovery"; import { loadCapability } from "$c/discovery"; -import { parseFrontmatter } from "./frontmatter"; -import { renderPromptTemplate } from "./prompt-templates"; -import { EMBEDDED_COMMAND_TEMPLATES } from "./tools/task/commands"; +import { EMBEDDED_COMMAND_TEMPLATES } from "$c/task/commands"; +import { parseFrontmatter } from "$c/utils/frontmatter"; /** * Represents a custom slash command loaded from a file diff --git a/packages/coding-agent/src/index.ts b/packages/coding-agent/src/index.ts index baaa7d46d..b1f9562a8 100644 --- a/packages/coding-agent/src/index.ts +++ b/packages/coding-agent/src/index.ts @@ -7,230 +7,7 @@ export { StringEnum } from "@oh-my-pi/pi-ai"; export { Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; // Logging export { logger } from "@oh-my-pi/pi-utils"; -export { getAgentDir, VERSION } from "./config"; -export { - AgentSession, - type AgentSessionConfig, - type AgentSessionEvent, - type AgentSessionEventListener, - type ModelCycleResult, - type PromptOptions, - type SessionStats, -} from "./core/agent-session"; -// Auth and model registry -export { type ApiKeyCredential, type AuthCredential, AuthStorage, type OAuthCredential } from "./core/auth-storage"; -// Compaction -export { - type BranchPreparation, - type BranchSummaryResult, - type CollectEntriesResult, - type CompactionResult, - type CutPointResult, - calculateContextTokens, - collectEntriesForBranchSummary, - compact, - DEFAULT_COMPACTION_SETTINGS, - estimateTokens, - type FileOperations, - findCutPoint, - findTurnStartIndex, - type GenerateBranchSummaryOptions, - generateBranchSummary, - generateSummary, - getLastAssistantUsage, - prepareBranchEntries, - serializeConversation, - shouldCompact, -} from "./core/compaction/index"; -// Custom commands -export type { - CustomCommand, - CustomCommandAPI, - CustomCommandFactory, - CustomCommandSource, - CustomCommandsLoadResult, - LoadedCustomCommand, -} from "./core/custom-commands/types"; -export type { - AgentToolUpdateCallback, - CustomTool, - CustomToolAPI, - CustomToolContext, - CustomToolFactory, - CustomToolSessionEvent, - CustomToolsLoadResult, - CustomToolUIContext, - ExecResult, - LoadedCustomTool, - RenderResultOptions, -} from "./core/custom-tools/index"; -// Custom tools -export { CustomToolLoader, discoverAndLoadCustomTools, loadCustomTools } from "./core/custom-tools/index"; -export type { - AppAction, - Extension, - ExtensionActions, - ExtensionAPI, - ExtensionCommandContext, - ExtensionCommandContextActions, - ExtensionContext, - ExtensionContextActions, - ExtensionError, - ExtensionEvent, - ExtensionFactory, - ExtensionFlag, - ExtensionHandler, - ExtensionShortcut, - ExtensionUIContext, - ExtensionUIDialogOptions, - InputEvent, - InputEventResult, - KeybindingsManager, - LoadExtensionsResult, - MessageRenderer, - MessageRenderOptions, - RegisteredCommand, - ToolResultEvent, - TurnEndEvent, - TurnStartEvent, - UserBashEvent, - UserBashEventResult, - UserPythonEvent, - UserPythonEventResult, -} from "./core/extensions/index"; -// Extension types and utilities -export { - discoverAndLoadExtensions, - ExtensionRunner, - ExtensionRuntime, - isBashToolResult, - isEditToolResult, - isFindToolResult, - isGrepToolResult, - isLsToolResult, - isReadToolResult, - isWriteToolResult, -} from "./core/extensions/index"; -// Hook system types (legacy re-export) -export type * from "./core/hooks/index"; -export { formatKeyHint, formatKeyHints } from "./core/keybindings"; -export { convertToLlm } from "./core/messages"; -export { ModelRegistry } from "./core/model-registry"; -// Prompt templates -export type { PromptTemplate } from "./core/prompt-templates"; -// SDK for programmatic usage -export { - // Factory - BashTool, - // Tool factories - BUILTIN_TOOLS, - type BuildSystemPromptOptions, - buildSystemPrompt, - type CreateAgentSessionOptions, - type CreateAgentSessionResult, - createAgentSession, - createTools, - // Discovery - discoverAuthStorage, - discoverContextFiles, - discoverCustomTSCommands, - discoverExtensions, - discoverMCPServers, - discoverModels, - discoverPromptTemplates, - discoverSkills, - EditTool, - FindTool, - GrepTool, - LsTool, - loadSettings, - loadSshTool, - PythonTool, - ReadTool, - type ToolSession, - WriteTool, -} from "./core/sdk"; -export { - type BranchSummaryEntry, - buildSessionContext, - type CompactionEntry, - CURRENT_SESSION_VERSION, - type CustomEntry, - type CustomMessageEntry, - type FileEntry, - getLatestCompactionEntry, - type ModelChangeEntry, - migrateSessionEntries, - type NewSessionOptions, - parseSessionEntries, - type SessionContext, - type SessionEntry, - type SessionEntryBase, - type SessionHeader, - type SessionInfo, - SessionManager, - type SessionMessageEntry, - type ThinkingLevelChangeEntry, -} from "./core/session-manager"; -export { - type CompactionSettings, - type ImageSettings, - type LspSettings, - type RetrySettings, - type Settings, - SettingsManager, - type SkillsSettings, -} from "./core/settings-manager"; -// Skills -export { - type LoadSkillsFromDirOptions, - type LoadSkillsResult, - loadSkills, - loadSkillsFromDir, - type Skill, - type SkillFrontmatter, - type SkillWarning, -} from "./core/skills"; -// Slash commands -export { type FileSlashCommand, loadSlashCommands as discoverSlashCommands } from "./core/slash-commands"; -// Tools (detail types and utilities) -export { - type BashToolDetails, - DEFAULT_MAX_BYTES, - DEFAULT_MAX_LINES, - type FindOperations, - type FindToolDetails, - type FindToolOptions, - formatSize, - type GrepOperations, - type GrepToolDetails, - type GrepToolOptions, - type LsOperations, - type LsToolDetails, - type LsToolOptions, - type PythonToolDetails, - type ReadToolDetails, - type TruncationOptions, - type TruncationResult, - truncateHead, - truncateLine, - truncateTail, - type WriteToolDetails, -} from "./core/tools/index"; -export type { FileDiagnosticsResult } from "./core/tools/lsp/index"; -// Main entry point -export { main } from "./main"; -// Run modes for programmatic SDK usage -export { - InteractiveMode, - type InteractiveModeOptions, - type PrintModeOptions, - RpcClient, - type RpcClientOptions, - type RpcEventListener, - runPrintMode, - runRpcMode, -} from "./modes/index"; +export type { FileDiagnosticsResult } from "$c/lsp/index"; // UI components for extensions export { ArminComponent, @@ -264,7 +41,7 @@ export { UserMessageComponent, UserMessageSelectorComponent, type VisualTruncateResult, -} from "./modes/interactive/components/index"; +} from "$c/modes/components/index"; // Theme utilities for custom tools export { getLanguageFromPath, @@ -275,5 +52,228 @@ export { initTheme, Theme, type ThemeColor, -} from "./modes/interactive/theme/theme"; +} from "$c/modes/theme/theme"; +export { getAgentDir, VERSION } from "./config"; +export { formatKeyHint, formatKeyHints } from "./config/keybindings"; +export { ModelRegistry } from "./config/model-registry"; +// Prompt templates +export type { PromptTemplate } from "./config/prompt-templates"; +export { + type CompactionSettings, + type ImageSettings, + type LspSettings, + type RetrySettings, + type Settings, + SettingsManager, + type SkillsSettings, +} from "./config/settings-manager"; +// Custom commands +export type { + CustomCommand, + CustomCommandAPI, + CustomCommandFactory, + CustomCommandSource, + CustomCommandsLoadResult, + LoadedCustomCommand, +} from "./extensibility/custom-commands/types"; +export type { + AgentToolUpdateCallback, + CustomTool, + CustomToolAPI, + CustomToolContext, + CustomToolFactory, + CustomToolSessionEvent, + CustomToolsLoadResult, + CustomToolUIContext, + ExecResult, + LoadedCustomTool, + RenderResultOptions, +} from "./extensibility/custom-tools/index"; +// Custom tools +export { CustomToolLoader, discoverAndLoadCustomTools, loadCustomTools } from "./extensibility/custom-tools/index"; +export type { + AppAction, + Extension, + ExtensionActions, + ExtensionAPI, + ExtensionCommandContext, + ExtensionCommandContextActions, + ExtensionContext, + ExtensionContextActions, + ExtensionError, + ExtensionEvent, + ExtensionFactory, + ExtensionFlag, + ExtensionHandler, + ExtensionShortcut, + ExtensionUIContext, + ExtensionUIDialogOptions, + InputEvent, + InputEventResult, + KeybindingsManager, + LoadExtensionsResult, + MessageRenderer, + MessageRenderOptions, + RegisteredCommand, + ToolResultEvent, + TurnEndEvent, + TurnStartEvent, + UserBashEvent, + UserBashEventResult, + UserPythonEvent, + UserPythonEventResult, +} from "./extensibility/extensions/index"; +// Extension types and utilities +export { + discoverAndLoadExtensions, + ExtensionRunner, + ExtensionRuntime, + isBashToolResult, + isEditToolResult, + isFindToolResult, + isGrepToolResult, + isLsToolResult, + isReadToolResult, + isWriteToolResult, +} from "./extensibility/extensions/index"; +// Hook system types (legacy re-export) +export type * from "./extensibility/hooks/index"; +// Skills +export { + type LoadSkillsFromDirOptions, + type LoadSkillsResult, + loadSkills, + loadSkillsFromDir, + type Skill, + type SkillFrontmatter, + type SkillWarning, +} from "./extensibility/skills"; +// Slash commands +export { type FileSlashCommand, loadSlashCommands as discoverSlashCommands } from "./extensibility/slash-commands"; +// Main entry point +export { main } from "./main"; +// Run modes for programmatic SDK usage +export { + InteractiveMode, + type InteractiveModeOptions, + type PrintModeOptions, + RpcClient, + type RpcClientOptions, + type RpcEventListener, + runPrintMode, + runRpcMode, +} from "./modes/index"; +// SDK for programmatic usage +export { + // Factory + BashTool, + // Tool factories + BUILTIN_TOOLS, + type BuildSystemPromptOptions, + buildSystemPrompt, + type CreateAgentSessionOptions, + type CreateAgentSessionResult, + createAgentSession, + createTools, + // Discovery + discoverAuthStorage, + discoverContextFiles, + discoverCustomTSCommands, + discoverExtensions, + discoverMCPServers, + discoverModels, + discoverPromptTemplates, + discoverSkills, + EditTool, + FindTool, + GrepTool, + LsTool, + loadSettings, + loadSshTool, + PythonTool, + ReadTool, + type ToolSession, + WriteTool, +} from "./sdk"; +export { + AgentSession, + type AgentSessionConfig, + type AgentSessionEvent, + type AgentSessionEventListener, + type ModelCycleResult, + type PromptOptions, + type SessionStats, +} from "./session/agent-session"; +// Auth and model registry +export { type ApiKeyCredential, type AuthCredential, AuthStorage, type OAuthCredential } from "./session/auth-storage"; +// Compaction +export { + type BranchPreparation, + type BranchSummaryResult, + type CollectEntriesResult, + type CompactionResult, + type CutPointResult, + calculateContextTokens, + collectEntriesForBranchSummary, + compact, + DEFAULT_COMPACTION_SETTINGS, + estimateTokens, + type FileOperations, + findCutPoint, + findTurnStartIndex, + type GenerateBranchSummaryOptions, + generateBranchSummary, + generateSummary, + getLastAssistantUsage, + prepareBranchEntries, + serializeConversation, + shouldCompact, +} from "./session/compaction/index"; +export { convertToLlm } from "./session/messages"; +export { + type BranchSummaryEntry, + buildSessionContext, + type CompactionEntry, + CURRENT_SESSION_VERSION, + type CustomEntry, + type CustomMessageEntry, + type FileEntry, + getLatestCompactionEntry, + type ModelChangeEntry, + migrateSessionEntries, + type NewSessionOptions, + parseSessionEntries, + type SessionContext, + type SessionEntry, + type SessionEntryBase, + type SessionHeader, + type SessionInfo, + SessionManager, + type SessionMessageEntry, + type ThinkingLevelChangeEntry, +} from "./session/session-manager"; +// Tools (detail types and utilities) +export { + type BashToolDetails, + DEFAULT_MAX_BYTES, + DEFAULT_MAX_LINES, + type FindOperations, + type FindToolDetails, + type FindToolOptions, + formatSize, + type GrepOperations, + type GrepToolDetails, + type GrepToolOptions, + type LsOperations, + type LsToolDetails, + type LsToolOptions, + type PythonToolDetails, + type ReadToolDetails, + type TruncationOptions, + type TruncationResult, + truncateHead, + truncateLine, + truncateTail, + type WriteToolDetails, +} from "./tools/index"; export { getShellConfig } from "./utils/shell"; diff --git a/packages/coding-agent/src/core/internal-urls/agent-protocol.ts b/packages/coding-agent/src/internal-urls/agent-protocol.ts similarity index 100% rename from packages/coding-agent/src/core/internal-urls/agent-protocol.ts rename to packages/coding-agent/src/internal-urls/agent-protocol.ts diff --git a/packages/coding-agent/src/core/internal-urls/artifact-protocol.ts b/packages/coding-agent/src/internal-urls/artifact-protocol.ts similarity index 100% rename from packages/coding-agent/src/core/internal-urls/artifact-protocol.ts rename to packages/coding-agent/src/internal-urls/artifact-protocol.ts diff --git a/packages/coding-agent/src/core/internal-urls/index.ts b/packages/coding-agent/src/internal-urls/index.ts similarity index 100% rename from packages/coding-agent/src/core/internal-urls/index.ts rename to packages/coding-agent/src/internal-urls/index.ts diff --git a/packages/coding-agent/src/core/internal-urls/json-query.ts b/packages/coding-agent/src/internal-urls/json-query.ts similarity index 100% rename from packages/coding-agent/src/core/internal-urls/json-query.ts rename to packages/coding-agent/src/internal-urls/json-query.ts diff --git a/packages/coding-agent/src/core/internal-urls/router.ts b/packages/coding-agent/src/internal-urls/router.ts similarity index 100% rename from packages/coding-agent/src/core/internal-urls/router.ts rename to packages/coding-agent/src/internal-urls/router.ts diff --git a/packages/coding-agent/src/core/internal-urls/rule-protocol.ts b/packages/coding-agent/src/internal-urls/rule-protocol.ts similarity index 100% rename from packages/coding-agent/src/core/internal-urls/rule-protocol.ts rename to packages/coding-agent/src/internal-urls/rule-protocol.ts diff --git a/packages/coding-agent/src/core/internal-urls/skill-protocol.ts b/packages/coding-agent/src/internal-urls/skill-protocol.ts similarity index 98% rename from packages/coding-agent/src/core/internal-urls/skill-protocol.ts rename to packages/coding-agent/src/internal-urls/skill-protocol.ts index 21a4f0e5a..c3bc37a96 100644 --- a/packages/coding-agent/src/core/internal-urls/skill-protocol.ts +++ b/packages/coding-agent/src/internal-urls/skill-protocol.ts @@ -9,7 +9,7 @@ */ import * as path from "node:path"; -import type { Skill } from "$c/core/skills"; +import type { Skill } from "$c/extensibility/skills"; import type { InternalResource, InternalUrl, ProtocolHandler } from "./types"; export interface SkillProtocolOptions { diff --git a/packages/coding-agent/src/core/internal-urls/types.ts b/packages/coding-agent/src/internal-urls/types.ts similarity index 100% rename from packages/coding-agent/src/core/internal-urls/types.ts rename to packages/coding-agent/src/internal-urls/types.ts diff --git a/packages/coding-agent/src/core/python-executor.ts b/packages/coding-agent/src/ipy/executor.ts similarity index 99% rename from packages/coding-agent/src/core/python-executor.ts rename to packages/coding-agent/src/ipy/executor.ts index 403b5e782..a87266869 100644 --- a/packages/coding-agent/src/core/python-executor.ts +++ b/packages/coding-agent/src/ipy/executor.ts @@ -6,8 +6,8 @@ import { type KernelExecuteResult, type PreludeHelper, PythonKernel, -} from "./python-kernel"; -import { OutputSink } from "./streaming-output"; +} from "$c/ipy/kernel"; +import { OutputSink } from "$c/session/streaming-output"; export type PythonKernelMode = "session" | "per-call"; export interface PythonExecutorOptions { diff --git a/packages/coding-agent/src/core/python-gateway-coordinator.ts b/packages/coding-agent/src/ipy/gateway-coordinator.ts similarity index 100% rename from packages/coding-agent/src/core/python-gateway-coordinator.ts rename to packages/coding-agent/src/ipy/gateway-coordinator.ts diff --git a/packages/coding-agent/src/core/python-kernel.ts b/packages/coding-agent/src/ipy/kernel.ts similarity index 99% rename from packages/coding-agent/src/core/python-kernel.ts rename to packages/coding-agent/src/ipy/kernel.ts index 35a02aa29..53b05dbd7 100644 --- a/packages/coding-agent/src/core/python-kernel.ts +++ b/packages/coding-agent/src/ipy/kernel.ts @@ -5,10 +5,10 @@ import { $, type Subprocess } from "bun"; import { nanoid } from "nanoid"; import { getShellConfig, killProcessTree } from "$c/utils/shell"; import { getOrCreateSnapshot } from "$c/utils/shell-snapshot"; -import { acquireSharedGateway, releaseSharedGateway } from "./python-gateway-coordinator"; -import { loadPythonModules } from "./python-modules"; -import { PYTHON_PRELUDE } from "./python-prelude"; -import { htmlToBasicMarkdown } from "./tools/web-scrapers/types"; +import { htmlToBasicMarkdown } from "$c/web/scrapers/types"; +import { acquireSharedGateway, releaseSharedGateway } from "./gateway-coordinator"; +import { loadPythonModules } from "./modules"; +import { PYTHON_PRELUDE } from "./prelude"; const TEXT_ENCODER = new TextEncoder(); const TEXT_DECODER = new TextDecoder(); diff --git a/packages/coding-agent/src/core/python-modules.ts b/packages/coding-agent/src/ipy/modules.ts similarity index 100% rename from packages/coding-agent/src/core/python-modules.ts rename to packages/coding-agent/src/ipy/modules.ts diff --git a/packages/coding-agent/src/core/python-prelude.py b/packages/coding-agent/src/ipy/prelude.py similarity index 100% rename from packages/coding-agent/src/core/python-prelude.py rename to packages/coding-agent/src/ipy/prelude.py diff --git a/packages/coding-agent/src/ipy/prelude.ts b/packages/coding-agent/src/ipy/prelude.ts new file mode 100644 index 000000000..47a300d47 --- /dev/null +++ b/packages/coding-agent/src/ipy/prelude.ts @@ -0,0 +1,3 @@ +import pythonPrelude from "./prelude.py" with { type: "text" }; + +export const PYTHON_PRELUDE = pythonPrelude; diff --git a/packages/coding-agent/src/core/tools/lsp/client.ts b/packages/coding-agent/src/lsp/client.ts similarity index 99% rename from packages/coding-agent/src/core/tools/lsp/client.ts rename to packages/coding-agent/src/lsp/client.ts index 53fbe68f4..6fd7eca64 100644 --- a/packages/coding-agent/src/core/tools/lsp/client.ts +++ b/packages/coding-agent/src/lsp/client.ts @@ -1,6 +1,6 @@ import * as fs from "node:fs"; import { logger } from "@oh-my-pi/pi-utils"; -import { ToolAbortError, throwIfAborted } from "$c/core/tool-errors"; +import { ToolAbortError, throwIfAborted } from "$c/tools/tool-errors"; import { applyWorkspaceEdit } from "./edits"; import { getLspmuxCommand, isLspmuxSupported } from "./lspmux"; import type { diff --git a/packages/coding-agent/src/core/tools/lsp/clients/biome-client.ts b/packages/coding-agent/src/lsp/clients/biome-client.ts similarity index 99% rename from packages/coding-agent/src/core/tools/lsp/clients/biome-client.ts rename to packages/coding-agent/src/lsp/clients/biome-client.ts index 2919b1fd4..69dd56d96 100644 --- a/packages/coding-agent/src/core/tools/lsp/clients/biome-client.ts +++ b/packages/coding-agent/src/lsp/clients/biome-client.ts @@ -4,7 +4,7 @@ */ import path from "node:path"; -import type { Diagnostic, DiagnosticSeverity, LinterClient, ServerConfig } from "$c/core/tools/lsp/types"; +import type { Diagnostic, DiagnosticSeverity, LinterClient, ServerConfig } from "$c/lsp/types"; // ============================================================================= // Biome JSON Output Types diff --git a/packages/coding-agent/src/core/tools/lsp/clients/index.ts b/packages/coding-agent/src/lsp/clients/index.ts similarity index 94% rename from packages/coding-agent/src/core/tools/lsp/clients/index.ts rename to packages/coding-agent/src/lsp/clients/index.ts index bb06ee13b..7b66e2375 100644 --- a/packages/coding-agent/src/core/tools/lsp/clients/index.ts +++ b/packages/coding-agent/src/lsp/clients/index.ts @@ -8,7 +8,7 @@ export { BiomeClient } from "./biome-client"; export { LspLinterClient } from "./lsp-linter-client"; -import type { LinterClient, ServerConfig } from "$c/core/tools/lsp/types"; +import type { LinterClient, ServerConfig } from "$c/lsp/types"; import { LspLinterClient } from "./lsp-linter-client"; // Cache of linter clients by server name + cwd diff --git a/packages/coding-agent/src/core/tools/lsp/clients/lsp-linter-client.ts b/packages/coding-agent/src/lsp/clients/lsp-linter-client.ts similarity index 92% rename from packages/coding-agent/src/core/tools/lsp/clients/lsp-linter-client.ts rename to packages/coding-agent/src/lsp/clients/lsp-linter-client.ts index 99d99adfc..409d88d16 100644 --- a/packages/coding-agent/src/core/tools/lsp/clients/lsp-linter-client.ts +++ b/packages/coding-agent/src/lsp/clients/lsp-linter-client.ts @@ -3,10 +3,10 @@ * Uses the Language Server Protocol for formatting and diagnostics. */ -import { getOrCreateClient, notifySaved, sendRequest, syncContent } from "$c/core/tools/lsp/client"; -import { applyTextEditsToString } from "$c/core/tools/lsp/edits"; -import type { Diagnostic, LinterClient, LspClient, ServerConfig, TextEdit } from "$c/core/tools/lsp/types"; -import { fileToUri } from "$c/core/tools/lsp/utils"; +import { getOrCreateClient, notifySaved, sendRequest, syncContent } from "$c/lsp/client"; +import { applyTextEditsToString } from "$c/lsp/edits"; +import type { Diagnostic, LinterClient, LspClient, ServerConfig, TextEdit } from "$c/lsp/types"; +import { fileToUri } from "$c/lsp/utils"; /** Default formatting options for LSP */ const DEFAULT_FORMAT_OPTIONS = { diff --git a/packages/coding-agent/src/core/tools/lsp/config.ts b/packages/coding-agent/src/lsp/config.ts similarity index 100% rename from packages/coding-agent/src/core/tools/lsp/config.ts rename to packages/coding-agent/src/lsp/config.ts diff --git a/packages/coding-agent/src/core/tools/lsp/defaults.json b/packages/coding-agent/src/lsp/defaults.json similarity index 100% rename from packages/coding-agent/src/core/tools/lsp/defaults.json rename to packages/coding-agent/src/lsp/defaults.json diff --git a/packages/coding-agent/src/core/tools/lsp/edits.ts b/packages/coding-agent/src/lsp/edits.ts similarity index 100% rename from packages/coding-agent/src/core/tools/lsp/edits.ts rename to packages/coding-agent/src/lsp/edits.ts diff --git a/packages/coding-agent/src/core/tools/lsp/index.ts b/packages/coding-agent/src/lsp/index.ts similarity index 99% rename from packages/coding-agent/src/core/tools/lsp/index.ts rename to packages/coding-agent/src/lsp/index.ts index 27fba1b6b..32d3bd12f 100644 --- a/packages/coding-agent/src/core/tools/lsp/index.ts +++ b/packages/coding-agent/src/lsp/index.ts @@ -4,12 +4,12 @@ import path from "node:path"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { logger, once, untilAborted } from "@oh-my-pi/pi-utils"; import type { BunFile } from "bun"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { throwIfAborted } from "$c/core/tool-errors"; -import type { ToolSession } from "$c/core/tools/index"; -import { resolveToCwd } from "$c/core/tools/path-utils"; -import { type Theme, theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import { type Theme, theme } from "$c/modes/theme/theme"; import lspDescription from "$c/prompts/tools/lsp.md" with { type: "text" }; +import type { ToolSession } from "$c/tools/index"; +import { resolveToCwd } from "$c/tools/path-utils"; +import { throwIfAborted } from "$c/tools/tool-errors"; import { ensureFileOpen, getActiveClients, diff --git a/packages/coding-agent/src/core/tools/lsp/lspmux.ts b/packages/coding-agent/src/lsp/lspmux.ts similarity index 100% rename from packages/coding-agent/src/core/tools/lsp/lspmux.ts rename to packages/coding-agent/src/lsp/lspmux.ts diff --git a/packages/coding-agent/src/core/tools/lsp/render.ts b/packages/coding-agent/src/lsp/render.ts similarity index 99% rename from packages/coding-agent/src/core/tools/lsp/render.ts rename to packages/coding-agent/src/lsp/render.ts index f4706a849..c05d0d72c 100644 --- a/packages/coding-agent/src/core/tools/lsp/render.ts +++ b/packages/coding-agent/src/lsp/render.ts @@ -11,8 +11,8 @@ import type { AgentToolResult, RenderResultOptions } from "@oh-my-pi/pi-agent-core"; import { Text } from "@oh-my-pi/pi-tui"; import { highlight, supportsLanguage } from "cli-highlight"; -import { formatExpandHint, formatMoreItems, TRUNCATE_LENGTHS, truncate } from "$c/core/tools/render-utils"; -import { getLanguageFromPath, type Theme } from "$c/modes/interactive/theme/theme"; +import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme"; +import { formatExpandHint, formatMoreItems, TRUNCATE_LENGTHS, truncate } from "$c/tools/render-utils"; import type { LspParams, LspToolDetails } from "./types"; // ============================================================================= diff --git a/packages/coding-agent/src/core/tools/lsp/rust-analyzer.ts b/packages/coding-agent/src/lsp/rust-analyzer.ts similarity index 100% rename from packages/coding-agent/src/core/tools/lsp/rust-analyzer.ts rename to packages/coding-agent/src/lsp/rust-analyzer.ts diff --git a/packages/coding-agent/src/core/tools/lsp/types.ts b/packages/coding-agent/src/lsp/types.ts similarity index 100% rename from packages/coding-agent/src/core/tools/lsp/types.ts rename to packages/coding-agent/src/lsp/types.ts diff --git a/packages/coding-agent/src/core/tools/lsp/utils.ts b/packages/coding-agent/src/lsp/utils.ts similarity index 99% rename from packages/coding-agent/src/core/tools/lsp/utils.ts rename to packages/coding-agent/src/lsp/utils.ts index ac85faa31..46cfbbc08 100644 --- a/packages/coding-agent/src/core/tools/lsp/utils.ts +++ b/packages/coding-agent/src/lsp/utils.ts @@ -1,5 +1,5 @@ import path from "node:path"; -import { type Theme, theme } from "$c/modes/interactive/theme/theme"; +import { type Theme, theme } from "$c/modes/theme/theme"; import type { Diagnostic, DiagnosticSeverity, diff --git a/packages/coding-agent/src/main.ts b/packages/coding-agent/src/main.ts index 451767801..9737294f6 100644 --- a/packages/coding-agent/src/main.ts +++ b/packages/coding-agent/src/main.ts @@ -11,6 +11,7 @@ import { createInterface } from "node:readline/promises"; import { type ImageContent, supportsXhigh } from "@oh-my-pi/pi-ai"; import { postmortem } from "@oh-my-pi/pi-utils"; import chalk from "chalk"; +import { initTheme, stopThemeWatcher } from "$c/modes/theme/theme"; import { type Args, parseArgs, printHelp } from "./cli/args"; import { parseConfigArgs, printConfigHelp, runConfigCommand } from "./cli/config-cli"; import { processFileArguments } from "./cli/file-processor"; @@ -21,21 +22,20 @@ import { parseSetupArgs, printSetupHelp, runSetupCommand } from "./cli/setup-cli import { parseStatsArgs, printStatsHelp, runStatsCommand } from "./cli/stats-cli"; import { parseUpdateArgs, printUpdateHelp, runUpdateCommand } from "./cli/update-cli"; import { findConfigFile, getModelsPath, VERSION } from "./config"; -import type { AgentSession } from "./core/agent-session"; -import { exportFromFile } from "./core/export-html/index"; -import type { ExtensionUIContext } from "./core/index"; -import type { ModelRegistry } from "./core/model-registry"; -import { parseModelPattern, parseModelString, resolveModelScope, type ScopedModel } from "./core/model-resolver"; -import { type CreateAgentSessionOptions, createAgentSession, discoverAuthStorage, discoverModels } from "./core/sdk"; -import { type SessionInfo, SessionManager } from "./core/session-manager"; -import { SettingsManager } from "./core/settings-manager"; -import { resolvePromptInput } from "./core/system-prompt"; -import { printTimings, time } from "./core/timings"; +import type { ModelRegistry } from "./config/model-registry"; +import { parseModelPattern, parseModelString, resolveModelScope, type ScopedModel } from "./config/model-resolver"; +import { SettingsManager } from "./config/settings-manager"; import { initializeWithSettings } from "./discovery"; +import { exportFromFile } from "./export/html/index"; +import type { ExtensionUIContext } from "./extensibility/extensions/types"; import { runMigrations, showDeprecationWarnings } from "./migrations"; import { InteractiveMode, runPrintMode, runRpcMode } from "./modes/index"; -import { initTheme, stopThemeWatcher } from "./modes/interactive/theme/theme"; +import { type CreateAgentSessionOptions, createAgentSession, discoverAuthStorage, discoverModels } from "./sdk"; +import type { AgentSession } from "./session/agent-session"; +import { type SessionInfo, SessionManager } from "./session/session-manager"; +import { resolvePromptInput } from "./system-prompt"; import { getChangelogPath, getNewEntries, parseChangelog } from "./utils/changelog"; +import { printTimings, time } from "./utils/timings"; async function checkForNewVersion(currentVersion: string): Promise { try { @@ -85,7 +85,7 @@ async function runInteractiveMode( initialMessages: string[], setExtensionUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined, - mcpManager: import("./core/mcp/index").MCPManager | undefined, + mcpManager: import("./mcp/index").MCPManager | undefined, initialMessage?: string, initialImages?: ImageContent[], ): Promise { diff --git a/packages/coding-agent/src/core/mcp/client.ts b/packages/coding-agent/src/mcp/client.ts similarity index 100% rename from packages/coding-agent/src/core/mcp/client.ts rename to packages/coding-agent/src/mcp/client.ts diff --git a/packages/coding-agent/src/core/mcp/config.ts b/packages/coding-agent/src/mcp/config.ts similarity index 94% rename from packages/coding-agent/src/core/mcp/config.ts rename to packages/coding-agent/src/mcp/config.ts index b5d0b5934..225325af0 100644 --- a/packages/coding-agent/src/core/mcp/config.ts +++ b/packages/coding-agent/src/mcp/config.ts @@ -24,7 +24,7 @@ export interface LoadMCPConfigsResult { /** Extracted Exa API keys (if any were filtered) */ exaApiKeys: string[]; /** Source metadata for each server */ - sources: Record; + sources: Record; } /** @@ -90,7 +90,7 @@ export async function loadAllMCPConfigs(cwd: string, options?: LoadMCPConfigsOpt // Convert to legacy format and preserve source metadata const configs: Record = {}; - const sources: Record = {}; + const sources: Record = {}; for (const server of servers) { configs[server.name] = convertToLegacyConfig(server); sources[server.name] = server._source; @@ -180,7 +180,7 @@ export interface ExaFilterResult { /** Extracted Exa API keys (if any) */ exaApiKeys: string[]; /** Source metadata for remaining servers */ - sources: Record; + sources: Record; } /** @@ -189,10 +189,10 @@ export interface ExaFilterResult { */ export function filterExaMCPServers( configs: Record, - sources: Record, + sources: Record, ): ExaFilterResult { const filtered: Record = {}; - const filteredSources: Record = {}; + const filteredSources: Record = {}; const exaApiKeys: string[] = []; for (const [name, config] of Object.entries(configs)) { diff --git a/packages/coding-agent/src/core/mcp/index.ts b/packages/coding-agent/src/mcp/index.ts similarity index 100% rename from packages/coding-agent/src/core/mcp/index.ts rename to packages/coding-agent/src/mcp/index.ts diff --git a/packages/coding-agent/src/core/mcp/json-rpc.ts b/packages/coding-agent/src/mcp/json-rpc.ts similarity index 100% rename from packages/coding-agent/src/core/mcp/json-rpc.ts rename to packages/coding-agent/src/mcp/json-rpc.ts diff --git a/packages/coding-agent/src/core/mcp/loader.ts b/packages/coding-agent/src/mcp/loader.ts similarity index 96% rename from packages/coding-agent/src/core/mcp/loader.ts rename to packages/coding-agent/src/mcp/loader.ts index 63a6aaf4d..517cdf585 100644 --- a/packages/coding-agent/src/core/mcp/loader.ts +++ b/packages/coding-agent/src/mcp/loader.ts @@ -5,8 +5,8 @@ */ import { logger } from "@oh-my-pi/pi-utils"; -import { AgentStorage } from "$c/core/agent-storage"; -import type { LoadedCustomTool } from "$c/core/custom-tools/types"; +import type { LoadedCustomTool } from "$c/extensibility/custom-tools/types"; +import { AgentStorage } from "$c/session/agent-storage"; import { type MCPLoadResult, MCPManager } from "./manager"; import { MCPToolCache } from "./tool-cache"; diff --git a/packages/coding-agent/src/core/mcp/manager.ts b/packages/coding-agent/src/mcp/manager.ts similarity index 98% rename from packages/coding-agent/src/core/mcp/manager.ts rename to packages/coding-agent/src/mcp/manager.ts index 7f668058f..4332b8a55 100644 --- a/packages/coding-agent/src/core/mcp/manager.ts +++ b/packages/coding-agent/src/mcp/manager.ts @@ -7,7 +7,7 @@ import { logger } from "@oh-my-pi/pi-utils"; import type { TSchema } from "@sinclair/typebox"; -import type { CustomTool } from "$c/core/custom-tools/types"; +import type { CustomTool } from "$c/extensibility/custom-tools/types"; import { connectToServer, disconnectServer, listTools } from "./client"; import { loadAllMCPConfigs, validateServerConfig } from "./config"; import type { MCPToolDetails } from "./tool-bridge"; @@ -15,7 +15,7 @@ import { DeferredMCPTool, MCPTool } from "./tool-bridge"; import type { MCPToolCache } from "./tool-cache"; import type { MCPServerConfig, MCPServerConnection, MCPToolDefinition } from "./types"; -type SourceMeta = import("../../capability/types").SourceMeta; +type SourceMeta = import("../capability/types").SourceMeta; type ToolLoadResult = { connection: MCPServerConnection; diff --git a/packages/coding-agent/src/core/mcp/tool-bridge.ts b/packages/coding-agent/src/mcp/tool-bridge.ts similarity index 99% rename from packages/coding-agent/src/core/mcp/tool-bridge.ts rename to packages/coding-agent/src/mcp/tool-bridge.ts index 1a6d8f724..9326b9131 100644 --- a/packages/coding-agent/src/core/mcp/tool-bridge.ts +++ b/packages/coding-agent/src/mcp/tool-bridge.ts @@ -7,7 +7,7 @@ import type { AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import type { TSchema } from "@sinclair/typebox"; import type { SourceMeta } from "$c/capability/types"; -import type { CustomTool, CustomToolContext, CustomToolResult } from "$c/core/custom-tools/types"; +import type { CustomTool, CustomToolContext, CustomToolResult } from "$c/extensibility/custom-tools/types"; import { callTool } from "./client"; import type { MCPContent, MCPServerConnection, MCPToolDefinition } from "./types"; diff --git a/packages/coding-agent/src/core/mcp/tool-cache.ts b/packages/coding-agent/src/mcp/tool-cache.ts similarity index 98% rename from packages/coding-agent/src/core/mcp/tool-cache.ts rename to packages/coding-agent/src/mcp/tool-cache.ts index eb2228720..fd476b04d 100644 --- a/packages/coding-agent/src/core/mcp/tool-cache.ts +++ b/packages/coding-agent/src/mcp/tool-cache.ts @@ -5,7 +5,7 @@ */ import { logger } from "@oh-my-pi/pi-utils"; -import type { AgentStorage } from "$c/core/agent-storage"; +import type { AgentStorage } from "$c/session/agent-storage"; import type { MCPServerConfig, MCPToolDefinition } from "./types"; const CACHE_VERSION = 1; diff --git a/packages/coding-agent/src/core/mcp/transports/http.ts b/packages/coding-agent/src/mcp/transports/http.ts similarity index 99% rename from packages/coding-agent/src/core/mcp/transports/http.ts rename to packages/coding-agent/src/mcp/transports/http.ts index 92daf93cd..892f1b782 100644 --- a/packages/coding-agent/src/core/mcp/transports/http.ts +++ b/packages/coding-agent/src/mcp/transports/http.ts @@ -11,7 +11,7 @@ import type { MCPHttpServerConfig, MCPSseServerConfig, MCPTransport, -} from "$c/core/mcp/types"; +} from "$c/mcp/types"; /** Generate unique request ID */ function generateId(): string { diff --git a/packages/coding-agent/src/core/mcp/transports/index.ts b/packages/coding-agent/src/mcp/transports/index.ts similarity index 100% rename from packages/coding-agent/src/core/mcp/transports/index.ts rename to packages/coding-agent/src/mcp/transports/index.ts diff --git a/packages/coding-agent/src/core/mcp/transports/stdio.ts b/packages/coding-agent/src/mcp/transports/stdio.ts similarity index 99% rename from packages/coding-agent/src/core/mcp/transports/stdio.ts rename to packages/coding-agent/src/mcp/transports/stdio.ts index 560700cee..88b77394c 100644 --- a/packages/coding-agent/src/core/mcp/transports/stdio.ts +++ b/packages/coding-agent/src/mcp/transports/stdio.ts @@ -6,7 +6,7 @@ */ import { type Subprocess, spawn } from "bun"; -import type { JsonRpcResponse, MCPStdioServerConfig, MCPTransport } from "$c/core/mcp/types"; +import type { JsonRpcResponse, MCPStdioServerConfig, MCPTransport } from "$c/mcp/types"; /** Generate unique request ID */ function generateId(): string { diff --git a/packages/coding-agent/src/core/mcp/types.ts b/packages/coding-agent/src/mcp/types.ts similarity index 99% rename from packages/coding-agent/src/core/mcp/types.ts rename to packages/coding-agent/src/mcp/types.ts index 27e15bfe2..9f2d642d8 100644 --- a/packages/coding-agent/src/core/mcp/types.ts +++ b/packages/coding-agent/src/mcp/types.ts @@ -218,7 +218,7 @@ export interface MCPServerConnection { /** Cached tools (populated on demand) */ tools?: MCPToolDefinition[]; /** Source metadata (for display) */ - _source?: import("../../capability/types").SourceMeta; + _source?: import("../capability/types").SourceMeta; } /** MCP tool with server context */ diff --git a/packages/coding-agent/src/migrations.ts b/packages/coding-agent/src/migrations.ts index 9682af27a..f0d8b9af0 100644 --- a/packages/coding-agent/src/migrations.ts +++ b/packages/coding-agent/src/migrations.ts @@ -6,9 +6,9 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, w import { join } from "node:path"; import { logger } from "@oh-my-pi/pi-utils"; import chalk from "chalk"; +import { AgentStorage } from "$c/session/agent-storage"; +import type { AuthCredential } from "$c/session/auth-storage"; import { getAgentDbPath, getAgentDir, getBinDir } from "./config"; -import { AgentStorage } from "./core/agent-storage"; -import type { AuthCredential } from "./core/auth-storage"; /** * Migrate legacy oauth.json and settings.json apiKeys to agent.db. diff --git a/packages/coding-agent/src/modes/interactive/components/armin.ts b/packages/coding-agent/src/modes/components/armin.ts similarity index 99% rename from packages/coding-agent/src/modes/interactive/components/armin.ts rename to packages/coding-agent/src/modes/components/armin.ts index fcfa8ac2a..d27c37480 100644 --- a/packages/coding-agent/src/modes/interactive/components/armin.ts +++ b/packages/coding-agent/src/modes/components/armin.ts @@ -3,7 +3,7 @@ */ import type { Component, TUI } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; // XBM image: 31x36 pixels, LSB first, 1=background, 0=foreground const WIDTH = 31; diff --git a/packages/coding-agent/src/modes/interactive/components/assistant-message.ts b/packages/coding-agent/src/modes/components/assistant-message.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/components/assistant-message.ts rename to packages/coding-agent/src/modes/components/assistant-message.ts index 591cc9edb..3e6c2b25a 100644 --- a/packages/coding-agent/src/modes/interactive/components/assistant-message.ts +++ b/packages/coding-agent/src/modes/components/assistant-message.ts @@ -1,6 +1,6 @@ import type { AssistantMessage } from "@oh-my-pi/pi-ai"; import { Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import { getMarkdownTheme, theme } from "$c/modes/interactive/theme/theme"; +import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; /** * Component that renders a complete assistant message diff --git a/packages/coding-agent/src/modes/interactive/components/bash-execution.ts b/packages/coding-agent/src/modes/components/bash-execution.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/components/bash-execution.ts rename to packages/coding-agent/src/modes/components/bash-execution.ts index 9043227f5..cc945ff06 100644 --- a/packages/coding-agent/src/modes/interactive/components/bash-execution.ts +++ b/packages/coding-agent/src/modes/components/bash-execution.ts @@ -4,9 +4,9 @@ import { Container, Loader, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; import stripAnsi from "strip-ansi"; -import type { TruncationMeta } from "$c/core/output-meta"; -import { formatSize } from "$c/core/tools/truncate"; -import { getSymbolTheme, theme } from "$c/modes/interactive/theme/theme"; +import { getSymbolTheme, theme } from "$c/modes/theme/theme"; +import type { TruncationMeta } from "$c/tools/output-meta"; +import { formatSize } from "$c/tools/truncate"; import { DynamicBorder } from "./dynamic-border"; import { truncateToVisualLines } from "./visual-truncate"; diff --git a/packages/coding-agent/src/modes/interactive/components/bordered-loader.ts b/packages/coding-agent/src/modes/components/bordered-loader.ts similarity index 94% rename from packages/coding-agent/src/modes/interactive/components/bordered-loader.ts rename to packages/coding-agent/src/modes/components/bordered-loader.ts index 6f8552820..00e2d6346 100644 --- a/packages/coding-agent/src/modes/interactive/components/bordered-loader.ts +++ b/packages/coding-agent/src/modes/components/bordered-loader.ts @@ -1,5 +1,5 @@ import { CancellableLoader, Container, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { Theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** Loader wrapped with borders for hook UI */ diff --git a/packages/coding-agent/src/modes/interactive/components/branch-summary-message.ts b/packages/coding-agent/src/modes/components/branch-summary-message.ts similarity index 89% rename from packages/coding-agent/src/modes/interactive/components/branch-summary-message.ts rename to packages/coding-agent/src/modes/components/branch-summary-message.ts index 21cd69d6e..9142856ce 100644 --- a/packages/coding-agent/src/modes/interactive/components/branch-summary-message.ts +++ b/packages/coding-agent/src/modes/components/branch-summary-message.ts @@ -1,6 +1,6 @@ import { Box, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import type { BranchSummaryMessage } from "$c/core/messages"; -import { getMarkdownTheme, theme } from "$c/modes/interactive/theme/theme"; +import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; +import type { BranchSummaryMessage } from "$c/session/messages"; /** * Component that renders a branch summary message with collapsed/expanded state. diff --git a/packages/coding-agent/src/modes/interactive/components/compaction-summary-message.ts b/packages/coding-agent/src/modes/components/compaction-summary-message.ts similarity index 90% rename from packages/coding-agent/src/modes/interactive/components/compaction-summary-message.ts rename to packages/coding-agent/src/modes/components/compaction-summary-message.ts index 17b1dca28..1c1104329 100644 --- a/packages/coding-agent/src/modes/interactive/components/compaction-summary-message.ts +++ b/packages/coding-agent/src/modes/components/compaction-summary-message.ts @@ -1,6 +1,6 @@ import { Box, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import type { CompactionSummaryMessage } from "$c/core/messages"; -import { getMarkdownTheme, theme } from "$c/modes/interactive/theme/theme"; +import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; +import type { CompactionSummaryMessage } from "$c/session/messages"; /** * Component that renders a compaction message with collapsed/expanded state. diff --git a/packages/coding-agent/src/modes/interactive/components/countdown-timer.ts b/packages/coding-agent/src/modes/components/countdown-timer.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/components/countdown-timer.ts rename to packages/coding-agent/src/modes/components/countdown-timer.ts diff --git a/packages/coding-agent/src/modes/interactive/components/custom-editor.ts b/packages/coding-agent/src/modes/components/custom-editor.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/components/custom-editor.ts rename to packages/coding-agent/src/modes/components/custom-editor.ts diff --git a/packages/coding-agent/src/modes/interactive/components/custom-message.ts b/packages/coding-agent/src/modes/components/custom-message.ts similarity index 93% rename from packages/coding-agent/src/modes/interactive/components/custom-message.ts rename to packages/coding-agent/src/modes/components/custom-message.ts index f38e0ec8b..30f76c7d7 100644 --- a/packages/coding-agent/src/modes/interactive/components/custom-message.ts +++ b/packages/coding-agent/src/modes/components/custom-message.ts @@ -1,9 +1,9 @@ import type { TextContent } from "@oh-my-pi/pi-ai"; import type { Component } from "@oh-my-pi/pi-tui"; import { Box, Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import type { MessageRenderer } from "$c/core/extensions/types"; -import type { CustomMessage } from "$c/core/messages"; -import { getMarkdownTheme, theme } from "$c/modes/interactive/theme/theme"; +import type { MessageRenderer } from "$c/extensibility/extensions/types"; +import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; +import type { CustomMessage } from "$c/session/messages"; /** * Component that renders a custom message entry from extensions. diff --git a/packages/coding-agent/src/modes/interactive/components/diff.ts b/packages/coding-agent/src/modes/components/diff.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/diff.ts rename to packages/coding-agent/src/modes/components/diff.ts index 678de74aa..0f02ecf86 100644 --- a/packages/coding-agent/src/modes/interactive/components/diff.ts +++ b/packages/coding-agent/src/modes/components/diff.ts @@ -1,5 +1,5 @@ import * as Diff from "diff"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; /** * Parse diff line to extract prefix, line number, and content. diff --git a/packages/coding-agent/src/modes/interactive/components/dynamic-border.ts b/packages/coding-agent/src/modes/components/dynamic-border.ts similarity index 92% rename from packages/coding-agent/src/modes/interactive/components/dynamic-border.ts rename to packages/coding-agent/src/modes/components/dynamic-border.ts index b5e8d56dc..e84e36081 100644 --- a/packages/coding-agent/src/modes/interactive/components/dynamic-border.ts +++ b/packages/coding-agent/src/modes/components/dynamic-border.ts @@ -1,5 +1,5 @@ import type { Component } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; /** * Dynamic border component that adjusts to viewport width. diff --git a/packages/coding-agent/src/modes/interactive/components/extensions/extension-dashboard.ts b/packages/coding-agent/src/modes/components/extensions/extension-dashboard.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/components/extensions/extension-dashboard.ts rename to packages/coding-agent/src/modes/components/extensions/extension-dashboard.ts index 57a609aba..e3690577f 100644 --- a/packages/coding-agent/src/modes/interactive/components/extensions/extension-dashboard.ts +++ b/packages/coding-agent/src/modes/components/extensions/extension-dashboard.ts @@ -13,9 +13,9 @@ */ import { type Component, Container, matchesKey, Spacer, Text, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; -import type { SettingsManager } from "$c/core/settings-manager"; -import { DynamicBorder } from "$c/modes/interactive/components/dynamic-border"; -import { theme } from "$c/modes/interactive/theme/theme"; +import type { SettingsManager } from "$c/config/settings-manager"; +import { DynamicBorder } from "$c/modes/components/dynamic-border"; +import { theme } from "$c/modes/theme/theme"; import { ExtensionList } from "./extension-list"; import { InspectorPanel } from "./inspector-panel"; import { applyFilter, createInitialState, filterByProvider, refreshState, toggleProvider } from "./state-manager"; diff --git a/packages/coding-agent/src/modes/interactive/components/extensions/extension-list.ts b/packages/coding-agent/src/modes/components/extensions/extension-list.ts similarity index 99% rename from packages/coding-agent/src/modes/interactive/components/extensions/extension-list.ts rename to packages/coding-agent/src/modes/components/extensions/extension-list.ts index b2141ba09..dc2befece 100644 --- a/packages/coding-agent/src/modes/interactive/components/extensions/extension-list.ts +++ b/packages/coding-agent/src/modes/components/extensions/extension-list.ts @@ -8,7 +8,7 @@ import { type Component, matchesKey, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; import { isProviderEnabled } from "$c/discovery"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; import { applyFilter } from "./state-manager"; import type { Extension, ExtensionKind, ExtensionState } from "./types"; diff --git a/packages/coding-agent/src/modes/interactive/components/extensions/index.ts b/packages/coding-agent/src/modes/components/extensions/index.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/components/extensions/index.ts rename to packages/coding-agent/src/modes/components/extensions/index.ts diff --git a/packages/coding-agent/src/modes/interactive/components/extensions/inspector-panel.ts b/packages/coding-agent/src/modes/components/extensions/inspector-panel.ts similarity index 99% rename from packages/coding-agent/src/modes/interactive/components/extensions/inspector-panel.ts rename to packages/coding-agent/src/modes/components/extensions/inspector-panel.ts index 9ee177011..3a8ffc7ea 100644 --- a/packages/coding-agent/src/modes/interactive/components/extensions/inspector-panel.ts +++ b/packages/coding-agent/src/modes/components/extensions/inspector-panel.ts @@ -6,7 +6,7 @@ import { homedir } from "node:os"; import { type Component, truncateToWidth, wrapTextWithAnsi } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; import type { Extension, ExtensionState } from "./types"; export class InspectorPanel implements Component { diff --git a/packages/coding-agent/src/modes/interactive/components/extensions/state-manager.ts b/packages/coding-agent/src/modes/components/extensions/state-manager.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/components/extensions/state-manager.ts rename to packages/coding-agent/src/modes/components/extensions/state-manager.ts diff --git a/packages/coding-agent/src/modes/interactive/components/extensions/types.ts b/packages/coding-agent/src/modes/components/extensions/types.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/components/extensions/types.ts rename to packages/coding-agent/src/modes/components/extensions/types.ts diff --git a/packages/coding-agent/src/modes/interactive/components/footer.ts b/packages/coding-agent/src/modes/components/footer.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/footer.ts rename to packages/coding-agent/src/modes/components/footer.ts index 478b5adab..1b59e73d7 100644 --- a/packages/coding-agent/src/modes/interactive/components/footer.ts +++ b/packages/coding-agent/src/modes/components/footer.ts @@ -2,9 +2,9 @@ import { existsSync, type FSWatcher, readFileSync, watch } from "node:fs"; import type { AssistantMessage } from "@oh-my-pi/pi-ai"; import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; import { dirname, join } from "path"; -import type { AgentSession } from "$c/core/agent-session"; -import { shortenPath } from "$c/core/tools/render-utils"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; +import type { AgentSession } from "$c/session/agent-session"; +import { shortenPath } from "$c/tools/render-utils"; /** * Sanitize text for display in a single-line status. diff --git a/packages/coding-agent/src/modes/interactive/components/history-search.ts b/packages/coding-agent/src/modes/components/history-search.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/components/history-search.ts rename to packages/coding-agent/src/modes/components/history-search.ts index 5e0042158..753004f20 100644 --- a/packages/coding-agent/src/modes/interactive/components/history-search.ts +++ b/packages/coding-agent/src/modes/components/history-search.ts @@ -8,8 +8,8 @@ import { truncateToWidth, visibleWidth, } from "@oh-my-pi/pi-tui"; -import type { HistoryEntry, HistoryStorage } from "$c/core/history-storage"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; +import type { HistoryEntry, HistoryStorage } from "$c/session/history-storage"; import { DynamicBorder } from "./dynamic-border"; class HistoryResultsList implements Component { diff --git a/packages/coding-agent/src/modes/interactive/components/hook-editor.ts b/packages/coding-agent/src/modes/components/hook-editor.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/components/hook-editor.ts rename to packages/coding-agent/src/modes/components/hook-editor.ts index 99ef3ab28..6f41010d0 100644 --- a/packages/coding-agent/src/modes/interactive/components/hook-editor.ts +++ b/packages/coding-agent/src/modes/components/hook-editor.ts @@ -8,7 +8,7 @@ import * as os from "node:os"; import * as path from "node:path"; import { Container, Editor, matchesKey, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; import { nanoid } from "nanoid"; -import { getEditorTheme, theme } from "$c/modes/interactive/theme/theme"; +import { getEditorTheme, theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; export class HookEditorComponent extends Container { diff --git a/packages/coding-agent/src/modes/interactive/components/hook-input.ts b/packages/coding-agent/src/modes/components/hook-input.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/components/hook-input.ts rename to packages/coding-agent/src/modes/components/hook-input.ts index 0981c7f67..a8f88c0b0 100644 --- a/packages/coding-agent/src/modes/interactive/components/hook-input.ts +++ b/packages/coding-agent/src/modes/components/hook-input.ts @@ -3,7 +3,7 @@ */ import { Container, Input, matchesKey, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; import { CountdownTimer } from "./countdown-timer"; import { DynamicBorder } from "./dynamic-border"; diff --git a/packages/coding-agent/src/modes/interactive/components/hook-message.ts b/packages/coding-agent/src/modes/components/hook-message.ts similarity index 93% rename from packages/coding-agent/src/modes/interactive/components/hook-message.ts rename to packages/coding-agent/src/modes/components/hook-message.ts index 026fb0403..7c4f04e0c 100644 --- a/packages/coding-agent/src/modes/interactive/components/hook-message.ts +++ b/packages/coding-agent/src/modes/components/hook-message.ts @@ -1,9 +1,9 @@ import type { TextContent } from "@oh-my-pi/pi-ai"; import type { Component } from "@oh-my-pi/pi-tui"; import { Box, Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import type { HookMessageRenderer } from "$c/core/hooks/types"; -import type { HookMessage } from "$c/core/messages"; -import { getMarkdownTheme, theme } from "$c/modes/interactive/theme/theme"; +import type { HookMessageRenderer } from "$c/extensibility/hooks/types"; +import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; +import type { HookMessage } from "$c/session/messages"; /** * Component that renders a custom message entry from hooks. diff --git a/packages/coding-agent/src/modes/interactive/components/hook-selector.ts b/packages/coding-agent/src/modes/components/hook-selector.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/hook-selector.ts rename to packages/coding-agent/src/modes/components/hook-selector.ts index 049cb8347..483670d06 100644 --- a/packages/coding-agent/src/modes/interactive/components/hook-selector.ts +++ b/packages/coding-agent/src/modes/components/hook-selector.ts @@ -4,7 +4,7 @@ */ import { Container, matchesKey, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; import { CountdownTimer } from "./countdown-timer"; import { DynamicBorder } from "./dynamic-border"; diff --git a/packages/coding-agent/src/modes/interactive/components/index.ts b/packages/coding-agent/src/modes/components/index.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/components/index.ts rename to packages/coding-agent/src/modes/components/index.ts diff --git a/packages/coding-agent/src/modes/interactive/components/keybinding-hints.ts b/packages/coding-agent/src/modes/components/keybinding-hints.ts similarity index 94% rename from packages/coding-agent/src/modes/interactive/components/keybinding-hints.ts rename to packages/coding-agent/src/modes/components/keybinding-hints.ts index c1fd7e964..fcee38c93 100644 --- a/packages/coding-agent/src/modes/interactive/components/keybinding-hints.ts +++ b/packages/coding-agent/src/modes/components/keybinding-hints.ts @@ -3,8 +3,8 @@ */ import { type EditorAction, getEditorKeybindings, type KeyId } from "@oh-my-pi/pi-tui"; -import type { AppAction, KeybindingsManager } from "$c/core/keybindings"; -import { theme } from "$c/modes/interactive/theme/theme"; +import type { AppAction, KeybindingsManager } from "$c/config/keybindings"; +import { theme } from "$c/modes/theme/theme"; /** * Format keys array as display string (e.g., ["ctrl+c", "escape"] -> "ctrl+c/escape"). diff --git a/packages/coding-agent/src/modes/interactive/components/login-dialog.ts b/packages/coding-agent/src/modes/components/login-dialog.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/login-dialog.ts rename to packages/coding-agent/src/modes/components/login-dialog.ts index e2ee64455..c6663acc6 100644 --- a/packages/coding-agent/src/modes/interactive/components/login-dialog.ts +++ b/packages/coding-agent/src/modes/components/login-dialog.ts @@ -1,7 +1,7 @@ import { getOAuthProviders } from "@oh-my-pi/pi-ai"; import { Container, getEditorKeybindings, Input, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; import { $ } from "bun"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/interactive/components/model-selector.ts b/packages/coding-agent/src/modes/components/model-selector.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/model-selector.ts rename to packages/coding-agent/src/modes/components/model-selector.ts index 92520d70f..23da6d3a7 100644 --- a/packages/coding-agent/src/modes/interactive/components/model-selector.ts +++ b/packages/coding-agent/src/modes/components/model-selector.ts @@ -11,10 +11,10 @@ import { type TUI, visibleWidth, } from "@oh-my-pi/pi-tui"; -import type { ModelRegistry } from "$c/core/model-registry"; -import { parseModelString } from "$c/core/model-resolver"; -import type { SettingsManager } from "$c/core/settings-manager"; -import { type ThemeColor, theme } from "$c/modes/interactive/theme/theme"; +import type { ModelRegistry } from "$c/config/model-registry"; +import { parseModelString } from "$c/config/model-resolver"; +import type { SettingsManager } from "$c/config/settings-manager"; +import { type ThemeColor, theme } from "$c/modes/theme/theme"; import { fuzzyFilter } from "$c/utils/fuzzy"; import { DynamicBorder } from "./dynamic-border"; diff --git a/packages/coding-agent/src/modes/interactive/components/oauth-selector.ts b/packages/coding-agent/src/modes/components/oauth-selector.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/components/oauth-selector.ts rename to packages/coding-agent/src/modes/components/oauth-selector.ts index 8859e4fe4..ddca37765 100644 --- a/packages/coding-agent/src/modes/interactive/components/oauth-selector.ts +++ b/packages/coding-agent/src/modes/components/oauth-selector.ts @@ -1,7 +1,7 @@ import { getOAuthProviders, type OAuthProviderInfo } from "@oh-my-pi/pi-ai"; import { Container, matchesKey, Spacer, TruncatedText } from "@oh-my-pi/pi-tui"; -import type { AuthStorage } from "$c/core/auth-storage"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; +import type { AuthStorage } from "$c/session/auth-storage"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/interactive/components/plugin-settings.ts b/packages/coding-agent/src/modes/components/plugin-settings.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/plugin-settings.ts rename to packages/coding-agent/src/modes/components/plugin-settings.ts index 400cf5be2..c7880acce 100644 --- a/packages/coding-agent/src/modes/interactive/components/plugin-settings.ts +++ b/packages/coding-agent/src/modes/components/plugin-settings.ts @@ -18,9 +18,9 @@ import { Spacer, Text, } from "@oh-my-pi/pi-tui"; -import { PluginManager } from "$c/core/plugins/manager"; -import type { InstalledPlugin, PluginSettingSchema } from "$c/core/plugins/types"; -import { getSelectListTheme, getSettingsListTheme, theme } from "$c/modes/interactive/theme/theme"; +import { PluginManager } from "$c/extensibility/plugins/manager"; +import type { InstalledPlugin, PluginSettingSchema } from "$c/extensibility/plugins/types"; +import { getSelectListTheme, getSettingsListTheme, theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; // ============================================================================= diff --git a/packages/coding-agent/src/modes/interactive/components/python-execution.ts b/packages/coding-agent/src/modes/components/python-execution.ts similarity index 96% rename from packages/coding-agent/src/modes/interactive/components/python-execution.ts rename to packages/coding-agent/src/modes/components/python-execution.ts index 2384114d4..24667200f 100644 --- a/packages/coding-agent/src/modes/interactive/components/python-execution.ts +++ b/packages/coding-agent/src/modes/components/python-execution.ts @@ -5,9 +5,9 @@ import { Container, Loader, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; import stripAnsi from "strip-ansi"; -import type { TruncationMeta } from "$c/core/output-meta"; -import { formatSize } from "$c/core/tools/truncate"; -import { getSymbolTheme, highlightCode, theme } from "$c/modes/interactive/theme/theme"; +import { getSymbolTheme, highlightCode, theme } from "$c/modes/theme/theme"; +import type { TruncationMeta } from "$c/tools/output-meta"; +import { formatSize } from "$c/tools/truncate"; import { DynamicBorder } from "./dynamic-border"; import { truncateToVisualLines } from "./visual-truncate"; diff --git a/packages/coding-agent/src/modes/interactive/components/queue-mode-selector.ts b/packages/coding-agent/src/modes/components/queue-mode-selector.ts similarity index 95% rename from packages/coding-agent/src/modes/interactive/components/queue-mode-selector.ts rename to packages/coding-agent/src/modes/components/queue-mode-selector.ts index 6d2a10e2b..6e47360fd 100644 --- a/packages/coding-agent/src/modes/interactive/components/queue-mode-selector.ts +++ b/packages/coding-agent/src/modes/components/queue-mode-selector.ts @@ -1,5 +1,5 @@ import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui"; -import { getSelectListTheme } from "$c/modes/interactive/theme/theme"; +import { getSelectListTheme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/interactive/components/read-tool-group.ts b/packages/coding-agent/src/modes/components/read-tool-group.ts similarity index 96% rename from packages/coding-agent/src/modes/interactive/components/read-tool-group.ts rename to packages/coding-agent/src/modes/components/read-tool-group.ts index 1daf007ae..190979c58 100644 --- a/packages/coding-agent/src/modes/interactive/components/read-tool-group.ts +++ b/packages/coding-agent/src/modes/components/read-tool-group.ts @@ -1,7 +1,7 @@ import type { Component } from "@oh-my-pi/pi-tui"; import { Container, Text } from "@oh-my-pi/pi-tui"; -import { shortenPath } from "$c/core/tools/render-utils"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; +import { shortenPath } from "$c/tools/render-utils"; import type { ToolExecutionHandle } from "./tool-execution"; type ReadRenderArgs = { diff --git a/packages/coding-agent/src/modes/interactive/components/session-selector.ts b/packages/coding-agent/src/modes/components/session-selector.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/session-selector.ts rename to packages/coding-agent/src/modes/components/session-selector.ts index 52fe0ba09..b24f67c58 100644 --- a/packages/coding-agent/src/modes/interactive/components/session-selector.ts +++ b/packages/coding-agent/src/modes/components/session-selector.ts @@ -8,8 +8,8 @@ import { truncateToWidth, visibleWidth, } from "@oh-my-pi/pi-tui"; -import type { SessionInfo } from "$c/core/session-manager"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; +import type { SessionInfo } from "$c/session/session-manager"; import { fuzzyFilter } from "$c/utils/fuzzy"; import { DynamicBorder } from "./dynamic-border"; diff --git a/packages/coding-agent/src/modes/interactive/components/settings-defs.ts b/packages/coding-agent/src/modes/components/settings-defs.ts similarity index 99% rename from packages/coding-agent/src/modes/interactive/components/settings-defs.ts rename to packages/coding-agent/src/modes/components/settings-defs.ts index e302ff144..2f3bea185 100644 --- a/packages/coding-agent/src/modes/interactive/components/settings-defs.ts +++ b/packages/coding-agent/src/modes/components/settings-defs.ts @@ -20,7 +20,7 @@ import type { StatusLineSeparatorStyle, SymbolPreset, WebSearchProviderOption, -} from "$c/core/settings-manager"; +} from "$c/config/settings-manager"; import { getPreset } from "./status-line/presets"; // Setting value types diff --git a/packages/coding-agent/src/modes/interactive/components/settings-selector.ts b/packages/coding-agent/src/modes/components/settings-selector.ts similarity index 99% rename from packages/coding-agent/src/modes/interactive/components/settings-selector.ts rename to packages/coding-agent/src/modes/components/settings-selector.ts index aef2e1686..698bd5b6b 100644 --- a/packages/coding-agent/src/modes/interactive/components/settings-selector.ts +++ b/packages/coding-agent/src/modes/components/settings-selector.ts @@ -12,8 +12,8 @@ import { type TabBarTheme, Text, } from "@oh-my-pi/pi-tui"; -import type { SettingsManager, StatusLineSettings } from "$c/core/settings-manager"; -import { getSelectListTheme, getSettingsListTheme, theme } from "$c/modes/interactive/theme/theme"; +import type { SettingsManager, StatusLineSettings } from "$c/config/settings-manager"; +import { getSelectListTheme, getSettingsListTheme, theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; import { PluginSettingsComponent } from "./plugin-settings"; import { getSettingsForTab, type SettingDef } from "./settings-defs"; diff --git a/packages/coding-agent/src/modes/interactive/components/show-images-selector.ts b/packages/coding-agent/src/modes/components/show-images-selector.ts similarity index 94% rename from packages/coding-agent/src/modes/interactive/components/show-images-selector.ts rename to packages/coding-agent/src/modes/components/show-images-selector.ts index 6d67e585b..543621446 100644 --- a/packages/coding-agent/src/modes/interactive/components/show-images-selector.ts +++ b/packages/coding-agent/src/modes/components/show-images-selector.ts @@ -1,5 +1,5 @@ import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui"; -import { getSelectListTheme } from "$c/modes/interactive/theme/theme"; +import { getSelectListTheme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/interactive/components/status-line-segment-editor.ts b/packages/coding-agent/src/modes/components/status-line-segment-editor.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/status-line-segment-editor.ts rename to packages/coding-agent/src/modes/components/status-line-segment-editor.ts index 50553ce4f..49e6fe151 100644 --- a/packages/coding-agent/src/modes/interactive/components/status-line-segment-editor.ts +++ b/packages/coding-agent/src/modes/components/status-line-segment-editor.ts @@ -10,8 +10,8 @@ */ import { Container, matchesKey } from "@oh-my-pi/pi-tui"; -import type { StatusLineSegmentId } from "$c/core/settings-manager"; -import { theme } from "$c/modes/interactive/theme/theme"; +import type { StatusLineSegmentId } from "$c/config/settings-manager"; +import { theme } from "$c/modes/theme/theme"; import { ALL_SEGMENT_IDS } from "./status-line/segments"; // Segment display names and short descriptions diff --git a/packages/coding-agent/src/modes/interactive/components/status-line.ts b/packages/coding-agent/src/modes/components/status-line.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/status-line.ts rename to packages/coding-agent/src/modes/components/status-line.ts index 46315b183..eaee2a9ad 100644 --- a/packages/coding-agent/src/modes/interactive/components/status-line.ts +++ b/packages/coding-agent/src/modes/components/status-line.ts @@ -3,9 +3,9 @@ import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui" import { $ } from "bun"; import { type FSWatcher, watch } from "fs"; import { dirname, join } from "path"; -import type { AgentSession } from "$c/core/agent-session"; -import type { StatusLineSegmentOptions, StatusLineSettings } from "$c/core/settings-manager"; -import { theme } from "$c/modes/interactive/theme/theme"; +import type { StatusLineSegmentOptions, StatusLineSettings } from "$c/config/settings-manager"; +import { theme } from "$c/modes/theme/theme"; +import type { AgentSession } from "$c/session/agent-session"; import { getPreset } from "./status-line/presets"; import { renderSegment, type SegmentContext } from "./status-line/segments"; import { getSeparator } from "./status-line/separators"; diff --git a/packages/coding-agent/src/modes/interactive/components/status-line/index.ts b/packages/coding-agent/src/modes/components/status-line/index.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/components/status-line/index.ts rename to packages/coding-agent/src/modes/components/status-line/index.ts diff --git a/packages/coding-agent/src/modes/interactive/components/status-line/presets.ts b/packages/coding-agent/src/modes/components/status-line/presets.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/components/status-line/presets.ts rename to packages/coding-agent/src/modes/components/status-line/presets.ts diff --git a/packages/coding-agent/src/modes/interactive/components/status-line/segments.ts b/packages/coding-agent/src/modes/components/status-line/segments.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/status-line/segments.ts rename to packages/coding-agent/src/modes/components/status-line/segments.ts index 283d17732..4688b6315 100644 --- a/packages/coding-agent/src/modes/interactive/components/status-line/segments.ts +++ b/packages/coding-agent/src/modes/components/status-line/segments.ts @@ -1,6 +1,6 @@ import { hostname as osHostname } from "node:os"; -import { shortenPath } from "$c/core/tools/render-utils"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; +import { shortenPath } from "$c/tools/render-utils"; import type { RenderedSegment, SegmentContext, StatusLineSegment, StatusLineSegmentId } from "./types"; export type { SegmentContext } from "./types"; diff --git a/packages/coding-agent/src/modes/interactive/components/status-line/separators.ts b/packages/coding-agent/src/modes/components/status-line/separators.ts similarity index 95% rename from packages/coding-agent/src/modes/interactive/components/status-line/separators.ts rename to packages/coding-agent/src/modes/components/status-line/separators.ts index 50e135c9c..c1a68e026 100644 --- a/packages/coding-agent/src/modes/interactive/components/status-line/separators.ts +++ b/packages/coding-agent/src/modes/components/status-line/separators.ts @@ -1,4 +1,4 @@ -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { Theme } from "$c/modes/theme/theme"; import type { SeparatorDef, StatusLineSeparatorStyle } from "./types"; function trimSep(value: string): string { diff --git a/packages/coding-agent/src/modes/interactive/components/status-line/types.ts b/packages/coding-agent/src/modes/components/status-line/types.ts similarity index 96% rename from packages/coding-agent/src/modes/interactive/components/status-line/types.ts rename to packages/coding-agent/src/modes/components/status-line/types.ts index 7b1c28989..9c0a72e39 100644 --- a/packages/coding-agent/src/modes/interactive/components/status-line/types.ts +++ b/packages/coding-agent/src/modes/components/status-line/types.ts @@ -1,11 +1,11 @@ -import type { AgentSession } from "$c/core/agent-session"; import type { StatusLinePreset, StatusLineSegmentId, StatusLineSegmentOptions, StatusLineSeparatorStyle, StatusLineSettings, -} from "$c/core/settings-manager"; +} from "$c/config/settings-manager"; +import type { AgentSession } from "$c/session/agent-session"; // Re-export types from settings-manager (single source of truth) export type { diff --git a/packages/coding-agent/src/modes/interactive/components/theme-selector.ts b/packages/coding-agent/src/modes/components/theme-selector.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/theme-selector.ts rename to packages/coding-agent/src/modes/components/theme-selector.ts index fa52e6c6c..24f2e78dc 100644 --- a/packages/coding-agent/src/modes/interactive/components/theme-selector.ts +++ b/packages/coding-agent/src/modes/components/theme-selector.ts @@ -1,5 +1,5 @@ import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui"; -import { getAvailableThemes, getSelectListTheme } from "$c/modes/interactive/theme/theme"; +import { getAvailableThemes, getSelectListTheme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/interactive/components/thinking-selector.ts b/packages/coding-agent/src/modes/components/thinking-selector.ts similarity index 95% rename from packages/coding-agent/src/modes/interactive/components/thinking-selector.ts rename to packages/coding-agent/src/modes/components/thinking-selector.ts index c520cb1f8..4348aacf4 100644 --- a/packages/coding-agent/src/modes/interactive/components/thinking-selector.ts +++ b/packages/coding-agent/src/modes/components/thinking-selector.ts @@ -1,6 +1,6 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui"; -import { getSelectListTheme } from "$c/modes/interactive/theme/theme"; +import { getSelectListTheme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; const LEVEL_DESCRIPTIONS: Record = { diff --git a/packages/coding-agent/src/modes/interactive/components/todo-display.ts b/packages/coding-agent/src/modes/components/todo-display.ts similarity index 95% rename from packages/coding-agent/src/modes/interactive/components/todo-display.ts rename to packages/coding-agent/src/modes/components/todo-display.ts index 493e94cd1..54fbd5947 100644 --- a/packages/coding-agent/src/modes/interactive/components/todo-display.ts +++ b/packages/coding-agent/src/modes/components/todo-display.ts @@ -1,8 +1,8 @@ import * as path from "node:path"; import { Text } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; -import { theme } from "$c/modes/interactive/theme/theme"; -import type { TodoItem } from "$c/modes/interactive/types"; +import { theme } from "$c/modes/theme/theme"; +import type { TodoItem } from "$c/modes/types"; const TODO_FILE_NAME = "todos.json"; diff --git a/packages/coding-agent/src/modes/interactive/components/todo-reminder.ts b/packages/coding-agent/src/modes/components/todo-reminder.ts similarity index 91% rename from packages/coding-agent/src/modes/interactive/components/todo-reminder.ts rename to packages/coding-agent/src/modes/components/todo-reminder.ts index 7ae70b3f2..7a79a8b5c 100644 --- a/packages/coding-agent/src/modes/interactive/components/todo-reminder.ts +++ b/packages/coding-agent/src/modes/components/todo-reminder.ts @@ -1,6 +1,6 @@ import { Box, Container, Spacer, Text } from "@oh-my-pi/pi-tui"; -import type { TodoItem } from "$c/core/tools/todo-write"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; +import type { TodoItem } from "$c/tools/todo-write"; /** * Component that renders a todo completion reminder notification. diff --git a/packages/coding-agent/src/modes/interactive/components/tool-execution.ts b/packages/coding-agent/src/modes/components/tool-execution.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/tool-execution.ts rename to packages/coding-agent/src/modes/components/tool-execution.ts index 5872f7dc6..d62a70f50 100644 --- a/packages/coding-agent/src/modes/interactive/components/tool-execution.ts +++ b/packages/coding-agent/src/modes/components/tool-execution.ts @@ -11,11 +11,11 @@ import { type TUI, } from "@oh-my-pi/pi-tui"; import { sanitizeText } from "@oh-my-pi/pi-utils"; -import { BASH_DEFAULT_PREVIEW_LINES } from "$c/core/tools/bash"; -import { computeEditDiff, computePatchDiff, type EditDiffError, type EditDiffResult } from "$c/core/tools/patch"; -import { PYTHON_DEFAULT_PREVIEW_LINES } from "$c/core/tools/python"; -import { toolRenderers } from "$c/core/tools/renderers"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; +import { computeEditDiff, computePatchDiff, type EditDiffError, type EditDiffResult } from "$c/patch"; +import { BASH_DEFAULT_PREVIEW_LINES } from "$c/tools/bash"; +import { PYTHON_DEFAULT_PREVIEW_LINES } from "$c/tools/python"; +import { toolRenderers } from "$c/tools/renderers"; import { convertToPng } from "$c/utils/image-convert"; import { renderDiff } from "./diff"; diff --git a/packages/coding-agent/src/modes/interactive/components/tree-selector.ts b/packages/coding-agent/src/modes/components/tree-selector.ts similarity index 99% rename from packages/coding-agent/src/modes/interactive/components/tree-selector.ts rename to packages/coding-agent/src/modes/components/tree-selector.ts index c62c07461..8e6a2dc07 100644 --- a/packages/coding-agent/src/modes/interactive/components/tree-selector.ts +++ b/packages/coding-agent/src/modes/components/tree-selector.ts @@ -8,9 +8,9 @@ import { TruncatedText, truncateToWidth, } from "@oh-my-pi/pi-tui"; -import type { SessionTreeNode } from "$c/core/session-manager"; -import { shortenPath } from "$c/core/tools/render-utils"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; +import type { SessionTreeNode } from "$c/session/session-manager"; +import { shortenPath } from "$c/tools/render-utils"; import { DynamicBorder } from "./dynamic-border"; /** Gutter info: position (displayIndent where connector was) and whether to show │ */ diff --git a/packages/coding-agent/src/modes/interactive/components/ttsr-notification.ts b/packages/coding-agent/src/modes/components/ttsr-notification.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/components/ttsr-notification.ts rename to packages/coding-agent/src/modes/components/ttsr-notification.ts index 2f7f078b7..78416628b 100644 --- a/packages/coding-agent/src/modes/interactive/components/ttsr-notification.ts +++ b/packages/coding-agent/src/modes/components/ttsr-notification.ts @@ -1,6 +1,6 @@ import { Box, Container, Spacer, Text } from "@oh-my-pi/pi-tui"; import type { Rule } from "$c/capability/rule"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; /** * Component that renders a TTSR (Time Traveling Stream Rules) notification. diff --git a/packages/coding-agent/src/modes/interactive/components/user-message-selector.ts b/packages/coding-agent/src/modes/components/user-message-selector.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/components/user-message-selector.ts rename to packages/coding-agent/src/modes/components/user-message-selector.ts index b03e85dbb..68f2f1914 100644 --- a/packages/coding-agent/src/modes/interactive/components/user-message-selector.ts +++ b/packages/coding-agent/src/modes/components/user-message-selector.ts @@ -1,5 +1,5 @@ import { type Component, Container, matchesKey, Spacer, Text, truncateToWidth } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; interface UserMessageItem { diff --git a/packages/coding-agent/src/modes/interactive/components/user-message.ts b/packages/coding-agent/src/modes/components/user-message.ts similarity index 85% rename from packages/coding-agent/src/modes/interactive/components/user-message.ts rename to packages/coding-agent/src/modes/components/user-message.ts index 71c53d6bc..3bc5f40df 100644 --- a/packages/coding-agent/src/modes/interactive/components/user-message.ts +++ b/packages/coding-agent/src/modes/components/user-message.ts @@ -1,5 +1,5 @@ import { Container, Markdown, Spacer } from "@oh-my-pi/pi-tui"; -import { getMarkdownTheme, theme } from "$c/modes/interactive/theme/theme"; +import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; /** * Component that renders a user message diff --git a/packages/coding-agent/src/modes/interactive/components/visual-truncate.ts b/packages/coding-agent/src/modes/components/visual-truncate.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/components/visual-truncate.ts rename to packages/coding-agent/src/modes/components/visual-truncate.ts diff --git a/packages/coding-agent/src/modes/interactive/components/welcome.ts b/packages/coding-agent/src/modes/components/welcome.ts similarity index 99% rename from packages/coding-agent/src/modes/interactive/components/welcome.ts rename to packages/coding-agent/src/modes/components/welcome.ts index 147b63102..55ea7805c 100644 --- a/packages/coding-agent/src/modes/interactive/components/welcome.ts +++ b/packages/coding-agent/src/modes/components/welcome.ts @@ -1,6 +1,6 @@ import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; import { APP_NAME } from "$c/config"; -import { theme } from "$c/modes/interactive/theme/theme"; +import { theme } from "$c/modes/theme/theme"; export interface RecentSession { name: string; diff --git a/packages/coding-agent/src/modes/interactive/controllers/command-controller.ts b/packages/coding-agent/src/modes/controllers/command-controller.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/controllers/command-controller.ts rename to packages/coding-agent/src/modes/controllers/command-controller.ts index b8330d116..22fcd337e 100644 --- a/packages/coding-agent/src/modes/interactive/controllers/command-controller.ts +++ b/packages/coding-agent/src/modes/controllers/command-controller.ts @@ -6,18 +6,18 @@ import { Loader, Markdown, Spacer, Text, visibleWidth } from "@oh-my-pi/pi-tui"; import { $ } from "bun"; import { nanoid } from "nanoid"; import { getDebugLogPath } from "$c/config"; -import { loadCustomShare } from "$c/core/custom-share"; -import type { CompactOptions } from "$c/core/extensions/types"; -import { createCompactionSummaryMessage } from "$c/core/messages"; -import { outputMeta } from "$c/core/output-meta"; -import { getGatewayStatus } from "$c/core/python-gateway-coordinator"; -import { ArminComponent } from "$c/modes/interactive/components/armin"; -import { BashExecutionComponent } from "$c/modes/interactive/components/bash-execution"; -import { BorderedLoader } from "$c/modes/interactive/components/bordered-loader"; -import { DynamicBorder } from "$c/modes/interactive/components/dynamic-border"; -import { PythonExecutionComponent } from "$c/modes/interactive/components/python-execution"; -import { getMarkdownTheme, getSymbolTheme, theme } from "$c/modes/interactive/theme/theme"; -import type { InteractiveModeContext } from "$c/modes/interactive/types"; +import { loadCustomShare } from "$c/export/custom-share"; +import type { CompactOptions } from "$c/extensibility/extensions/types"; +import { getGatewayStatus } from "$c/ipy/gateway-coordinator"; +import { ArminComponent } from "$c/modes/components/armin"; +import { BashExecutionComponent } from "$c/modes/components/bash-execution"; +import { BorderedLoader } from "$c/modes/components/bordered-loader"; +import { DynamicBorder } from "$c/modes/components/dynamic-border"; +import { PythonExecutionComponent } from "$c/modes/components/python-execution"; +import { getMarkdownTheme, getSymbolTheme, theme } from "$c/modes/theme/theme"; +import type { InteractiveModeContext } from "$c/modes/types"; +import { createCompactionSummaryMessage } from "$c/session/messages"; +import { outputMeta } from "$c/tools/output-meta"; import { getChangelogPath, parseChangelog } from "$c/utils/changelog"; import { copyToClipboard } from "$c/utils/clipboard"; diff --git a/packages/coding-agent/src/modes/interactive/controllers/event-controller.ts b/packages/coding-agent/src/modes/controllers/event-controller.ts similarity index 95% rename from packages/coding-agent/src/modes/interactive/controllers/event-controller.ts rename to packages/coding-agent/src/modes/controllers/event-controller.ts index 04d28c03f..d0e5819bb 100644 --- a/packages/coding-agent/src/modes/interactive/controllers/event-controller.ts +++ b/packages/coding-agent/src/modes/controllers/event-controller.ts @@ -1,13 +1,13 @@ import { Loader, Text } from "@oh-my-pi/pi-tui"; -import type { AgentSessionEvent } from "$c/core/agent-session"; -import { detectNotificationProtocol, isNotificationSuppressed, sendNotification } from "$c/core/terminal-notify"; -import { AssistantMessageComponent } from "$c/modes/interactive/components/assistant-message"; -import { ReadToolGroupComponent } from "$c/modes/interactive/components/read-tool-group"; -import { TodoReminderComponent } from "$c/modes/interactive/components/todo-reminder"; -import { ToolExecutionComponent } from "$c/modes/interactive/components/tool-execution"; -import { TtsrNotificationComponent } from "$c/modes/interactive/components/ttsr-notification"; -import { getSymbolTheme, theme } from "$c/modes/interactive/theme/theme"; -import type { InteractiveModeContext, TodoItem } from "$c/modes/interactive/types"; +import { AssistantMessageComponent } from "$c/modes/components/assistant-message"; +import { ReadToolGroupComponent } from "$c/modes/components/read-tool-group"; +import { TodoReminderComponent } from "$c/modes/components/todo-reminder"; +import { ToolExecutionComponent } from "$c/modes/components/tool-execution"; +import { TtsrNotificationComponent } from "$c/modes/components/ttsr-notification"; +import { getSymbolTheme, theme } from "$c/modes/theme/theme"; +import type { InteractiveModeContext, TodoItem } from "$c/modes/types"; +import type { AgentSessionEvent } from "$c/session/agent-session"; +import { detectNotificationProtocol, isNotificationSuppressed, sendNotification } from "$c/utils/terminal-notify"; export class EventController { private lastReadGroup: ReadToolGroupComponent | undefined = undefined; diff --git a/packages/coding-agent/src/modes/interactive/controllers/extension-ui-controller.ts b/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/controllers/extension-ui-controller.ts rename to packages/coding-agent/src/modes/controllers/extension-ui-controller.ts index b6d9b8984..2f58276e9 100644 --- a/packages/coding-agent/src/modes/interactive/controllers/extension-ui-controller.ts +++ b/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts @@ -1,26 +1,20 @@ import type { Component, TUI } from "@oh-my-pi/pi-tui"; import { Spacer, Text } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; +import { KeybindingsManager } from "$c/config/keybindings"; import type { ExtensionActions, ExtensionCommandContextActions, ExtensionContextActions, ExtensionError, ExtensionUIContext, -} from "$c/core/extensions/index"; -import { KeybindingsManager } from "$c/core/keybindings"; -import { setTerminalTitle } from "$c/core/title-generator"; -import { HookEditorComponent } from "$c/modes/interactive/components/hook-editor"; -import { HookInputComponent } from "$c/modes/interactive/components/hook-input"; -import { HookSelectorComponent } from "$c/modes/interactive/components/hook-selector"; -import { - getAvailableThemesWithPaths, - getThemeByName, - setTheme, - type Theme, - theme, -} from "$c/modes/interactive/theme/theme"; -import type { InteractiveModeContext } from "$c/modes/interactive/types"; +} from "$c/extensibility/extensions/index"; +import { HookEditorComponent } from "$c/modes/components/hook-editor"; +import { HookInputComponent } from "$c/modes/components/hook-input"; +import { HookSelectorComponent } from "$c/modes/components/hook-selector"; +import { getAvailableThemesWithPaths, getThemeByName, setTheme, type Theme, theme } from "$c/modes/theme/theme"; +import type { InteractiveModeContext } from "$c/modes/types"; +import { setTerminalTitle } from "$c/utils/title-generator"; export class ExtensionUiController { constructor(private ctx: InteractiveModeContext) {} diff --git a/packages/coding-agent/src/modes/interactive/controllers/input-controller.ts b/packages/coding-agent/src/modes/controllers/input-controller.ts similarity index 98% rename from packages/coding-agent/src/modes/interactive/controllers/input-controller.ts rename to packages/coding-agent/src/modes/controllers/input-controller.ts index 93e634da3..d8dba39e6 100644 --- a/packages/coding-agent/src/modes/interactive/controllers/input-controller.ts +++ b/packages/coding-agent/src/modes/controllers/input-controller.ts @@ -5,12 +5,12 @@ import * as os from "node:os"; import * as path from "node:path"; import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import { nanoid } from "nanoid"; -import type { AgentSessionEvent } from "$c/core/agent-session"; -import { generateSessionTitle, setTerminalTitle } from "$c/core/title-generator"; -import { theme } from "$c/modes/interactive/theme/theme"; -import type { InteractiveModeContext } from "$c/modes/interactive/types"; +import { theme } from "$c/modes/theme/theme"; +import type { InteractiveModeContext } from "$c/modes/types"; +import type { AgentSessionEvent } from "$c/session/agent-session"; import { readImageFromClipboard } from "$c/utils/clipboard"; import { resizeImage } from "$c/utils/image-resize"; +import { generateSessionTitle, setTerminalTitle } from "$c/utils/title-generator"; interface Expandable { setExpanded(expanded: boolean): void; diff --git a/packages/coding-agent/src/modes/interactive/controllers/selector-controller.ts b/packages/coding-agent/src/modes/controllers/selector-controller.ts similarity index 94% rename from packages/coding-agent/src/modes/interactive/controllers/selector-controller.ts rename to packages/coding-agent/src/modes/controllers/selector-controller.ts index 3984d1c50..dd38aac14 100644 --- a/packages/coding-agent/src/modes/interactive/controllers/selector-controller.ts +++ b/packages/coding-agent/src/modes/controllers/selector-controller.ts @@ -3,21 +3,21 @@ import type { OAuthProvider } from "@oh-my-pi/pi-ai"; import type { Component } from "@oh-my-pi/pi-tui"; import { Input, Loader, Spacer, Text } from "@oh-my-pi/pi-tui"; import { getAgentDbPath } from "$c/config"; -import { SessionManager } from "$c/core/session-manager"; -import { setPreferredImageProvider, setPreferredWebSearchProvider } from "$c/core/tools/index"; import { disableProvider, enableProvider } from "$c/discovery"; -import { AssistantMessageComponent } from "$c/modes/interactive/components/assistant-message"; -import { ExtensionDashboard } from "$c/modes/interactive/components/extensions"; -import { HistorySearchComponent } from "$c/modes/interactive/components/history-search"; -import { ModelSelectorComponent } from "$c/modes/interactive/components/model-selector"; -import { OAuthSelectorComponent } from "$c/modes/interactive/components/oauth-selector"; -import { SessionSelectorComponent } from "$c/modes/interactive/components/session-selector"; -import { SettingsSelectorComponent } from "$c/modes/interactive/components/settings-selector"; -import { ToolExecutionComponent } from "$c/modes/interactive/components/tool-execution"; -import { TreeSelectorComponent } from "$c/modes/interactive/components/tree-selector"; -import { UserMessageSelectorComponent } from "$c/modes/interactive/components/user-message-selector"; -import { getAvailableThemes, getSymbolTheme, setSymbolPreset, setTheme, theme } from "$c/modes/interactive/theme/theme"; -import type { InteractiveModeContext } from "$c/modes/interactive/types"; +import { AssistantMessageComponent } from "$c/modes/components/assistant-message"; +import { ExtensionDashboard } from "$c/modes/components/extensions"; +import { HistorySearchComponent } from "$c/modes/components/history-search"; +import { ModelSelectorComponent } from "$c/modes/components/model-selector"; +import { OAuthSelectorComponent } from "$c/modes/components/oauth-selector"; +import { SessionSelectorComponent } from "$c/modes/components/session-selector"; +import { SettingsSelectorComponent } from "$c/modes/components/settings-selector"; +import { ToolExecutionComponent } from "$c/modes/components/tool-execution"; +import { TreeSelectorComponent } from "$c/modes/components/tree-selector"; +import { UserMessageSelectorComponent } from "$c/modes/components/user-message-selector"; +import { getAvailableThemes, getSymbolTheme, setSymbolPreset, setTheme, theme } from "$c/modes/theme/theme"; +import type { InteractiveModeContext } from "$c/modes/types"; +import { SessionManager } from "$c/session/session-manager"; +import { setPreferredImageProvider, setPreferredWebSearchProvider } from "$c/tools/index"; export class SelectorController { constructor(private ctx: InteractiveModeContext) {} diff --git a/packages/coding-agent/src/modes/index.ts b/packages/coding-agent/src/modes/index.ts index b43f6194e..23ff796ea 100644 --- a/packages/coding-agent/src/modes/index.ts +++ b/packages/coding-agent/src/modes/index.ts @@ -1,7 +1,7 @@ /** * Run modes for the coding agent. */ -export { InteractiveMode, type InteractiveModeOptions } from "./interactive/interactive-mode"; +export { InteractiveMode, type InteractiveModeOptions } from "./interactive-mode"; export { type PrintModeOptions, runPrintMode } from "./print-mode"; export { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener } from "./rpc/rpc-client"; export { runRpcMode } from "./rpc/rpc-mode"; diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive-mode.ts similarity index 97% rename from packages/coding-agent/src/modes/interactive/interactive-mode.ts rename to packages/coding-agent/src/modes/interactive-mode.ts index f6ea88f0f..c33a568b4 100644 --- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive-mode.ts @@ -18,16 +18,16 @@ import { } from "@oh-my-pi/pi-tui"; import { logger, postmortem } from "@oh-my-pi/pi-utils"; import chalk from "chalk"; -import type { AgentSession, AgentSessionEvent } from "$c/core/agent-session"; -import type { ExtensionUIContext } from "$c/core/extensions/index"; -import type { CompactOptions } from "$c/core/extensions/types"; -import { HistoryStorage } from "$c/core/history-storage"; -import { KeybindingsManager } from "$c/core/keybindings"; -import type { SessionContext, SessionManager } from "$c/core/session-manager"; -import { getRecentSessions } from "$c/core/session-manager"; -import type { SettingsManager } from "$c/core/settings-manager"; -import { loadSlashCommands } from "$c/core/slash-commands"; -import { setTerminalTitle } from "$c/core/title-generator"; +import { KeybindingsManager } from "$c/config/keybindings"; +import type { SettingsManager } from "$c/config/settings-manager"; +import type { ExtensionUIContext } from "$c/extensibility/extensions/index"; +import type { CompactOptions } from "$c/extensibility/extensions/types"; +import { loadSlashCommands } from "$c/extensibility/slash-commands"; +import type { AgentSession, AgentSessionEvent } from "$c/session/agent-session"; +import { HistoryStorage } from "$c/session/history-storage"; +import type { SessionContext, SessionManager } from "$c/session/session-manager"; +import { getRecentSessions } from "$c/session/session-manager"; +import { setTerminalTitle } from "$c/utils/title-generator"; import type { AssistantMessageComponent } from "./components/assistant-message"; import type { BashExecutionComponent } from "./components/bash-execution"; import { CustomEditor } from "./components/custom-editor"; @@ -124,7 +124,7 @@ export class InteractiveMode implements InteractiveModeContext { private readonly changelogMarkdown: string | undefined; public readonly lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined = undefined; - public mcpManager?: import("../../core/mcp/index").MCPManager; + public mcpManager?: import("$c/mcp/index").MCPManager; private readonly toolUiContextSetter: (uiContext: ExtensionUIContext, hasUI: boolean) => void; private readonly commandController: CommandController; @@ -140,7 +140,7 @@ export class InteractiveMode implements InteractiveModeContext { changelogMarkdown: string | undefined = undefined, setToolUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void = () => {}, lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined = undefined, - mcpManager?: import("../../core/mcp/index").MCPManager, + mcpManager?: import("$c/mcp/index").MCPManager, ) { this.session = session; this.sessionManager = session.sessionManager; diff --git a/packages/coding-agent/src/modes/print-mode.ts b/packages/coding-agent/src/modes/print-mode.ts index 37e16a981..e1561d2be 100644 --- a/packages/coding-agent/src/modes/print-mode.ts +++ b/packages/coding-agent/src/modes/print-mode.ts @@ -7,7 +7,7 @@ */ import type { AssistantMessage, ImageContent } from "@oh-my-pi/pi-ai"; -import type { AgentSession } from "$c/core/agent-session"; +import type { AgentSession } from "$c/session/agent-session"; /** * Options for print mode. diff --git a/packages/coding-agent/src/modes/rpc/rpc-client.ts b/packages/coding-agent/src/modes/rpc/rpc-client.ts index 7dd662216..0a9d8e289 100644 --- a/packages/coding-agent/src/modes/rpc/rpc-client.ts +++ b/packages/coding-agent/src/modes/rpc/rpc-client.ts @@ -7,9 +7,9 @@ import type { AgentEvent, AgentMessage, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ImageContent } from "@oh-my-pi/pi-ai"; import { createSanitizerStream, createSplitterStream, createTextDecoderStream, ptree } from "@oh-my-pi/pi-utils"; -import type { SessionStats } from "$c/core/agent-session"; -import type { BashResult } from "$c/core/bash-executor"; -import type { CompactionResult } from "$c/core/compaction/index"; +import type { BashResult } from "$c/exec/bash-executor"; +import type { SessionStats } from "$c/session/agent-session"; +import type { CompactionResult } from "$c/session/compaction/index"; import type { RpcCommand, RpcResponse, RpcSessionState } from "./rpc-types"; /** Distributive Omit that works with union types */ diff --git a/packages/coding-agent/src/modes/rpc/rpc-mode.ts b/packages/coding-agent/src/modes/rpc/rpc-mode.ts index e6596766a..bfa6cdaab 100644 --- a/packages/coding-agent/src/modes/rpc/rpc-mode.ts +++ b/packages/coding-agent/src/modes/rpc/rpc-mode.ts @@ -13,9 +13,9 @@ import { readLines } from "@oh-my-pi/pi-utils"; import { nanoid } from "nanoid"; -import type { AgentSession } from "$c/core/agent-session"; -import type { ExtensionUIContext, ExtensionUIDialogOptions } from "$c/core/extensions/index"; -import { type Theme, theme } from "$c/modes/interactive/theme/theme"; +import type { ExtensionUIContext, ExtensionUIDialogOptions } from "$c/extensibility/extensions/index"; +import { type Theme, theme } from "$c/modes/theme/theme"; +import type { AgentSession } from "$c/session/agent-session"; import type { RpcCommand, RpcExtensionUIRequest, diff --git a/packages/coding-agent/src/modes/rpc/rpc-types.ts b/packages/coding-agent/src/modes/rpc/rpc-types.ts index 073816b02..ee37f46da 100644 --- a/packages/coding-agent/src/modes/rpc/rpc-types.ts +++ b/packages/coding-agent/src/modes/rpc/rpc-types.ts @@ -7,9 +7,9 @@ import type { AgentMessage, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Model } from "@oh-my-pi/pi-ai"; -import type { SessionStats } from "$c/core/agent-session"; -import type { BashResult } from "$c/core/bash-executor"; -import type { CompactionResult } from "$c/core/compaction/index"; +import type { BashResult } from "$c/exec/bash-executor"; +import type { SessionStats } from "$c/session/agent-session"; +import type { CompactionResult } from "$c/session/compaction/index"; // ============================================================================ // RPC Commands (stdin) diff --git a/packages/coding-agent/src/modes/interactive/theme/dark.json b/packages/coding-agent/src/modes/theme/dark.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/dark.json rename to packages/coding-agent/src/modes/theme/dark.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/alabaster.json b/packages/coding-agent/src/modes/theme/defaults/alabaster.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/alabaster.json rename to packages/coding-agent/src/modes/theme/defaults/alabaster.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/amethyst.json b/packages/coding-agent/src/modes/theme/defaults/amethyst.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/amethyst.json rename to packages/coding-agent/src/modes/theme/defaults/amethyst.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/anthracite.json b/packages/coding-agent/src/modes/theme/defaults/anthracite.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/anthracite.json rename to packages/coding-agent/src/modes/theme/defaults/anthracite.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/basalt.json b/packages/coding-agent/src/modes/theme/defaults/basalt.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/basalt.json rename to packages/coding-agent/src/modes/theme/defaults/basalt.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/birch.json b/packages/coding-agent/src/modes/theme/defaults/birch.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/birch.json rename to packages/coding-agent/src/modes/theme/defaults/birch.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-abyss.json b/packages/coding-agent/src/modes/theme/defaults/dark-abyss.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-abyss.json rename to packages/coding-agent/src/modes/theme/defaults/dark-abyss.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-arctic.json b/packages/coding-agent/src/modes/theme/defaults/dark-arctic.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-arctic.json rename to packages/coding-agent/src/modes/theme/defaults/dark-arctic.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-aurora.json b/packages/coding-agent/src/modes/theme/defaults/dark-aurora.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-aurora.json rename to packages/coding-agent/src/modes/theme/defaults/dark-aurora.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-catppuccin.json b/packages/coding-agent/src/modes/theme/defaults/dark-catppuccin.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-catppuccin.json rename to packages/coding-agent/src/modes/theme/defaults/dark-catppuccin.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-cavern.json b/packages/coding-agent/src/modes/theme/defaults/dark-cavern.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-cavern.json rename to packages/coding-agent/src/modes/theme/defaults/dark-cavern.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-copper.json b/packages/coding-agent/src/modes/theme/defaults/dark-copper.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-copper.json rename to packages/coding-agent/src/modes/theme/defaults/dark-copper.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-cosmos.json b/packages/coding-agent/src/modes/theme/defaults/dark-cosmos.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-cosmos.json rename to packages/coding-agent/src/modes/theme/defaults/dark-cosmos.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-cyberpunk.json b/packages/coding-agent/src/modes/theme/defaults/dark-cyberpunk.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-cyberpunk.json rename to packages/coding-agent/src/modes/theme/defaults/dark-cyberpunk.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-dracula.json b/packages/coding-agent/src/modes/theme/defaults/dark-dracula.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-dracula.json rename to packages/coding-agent/src/modes/theme/defaults/dark-dracula.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-eclipse.json b/packages/coding-agent/src/modes/theme/defaults/dark-eclipse.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-eclipse.json rename to packages/coding-agent/src/modes/theme/defaults/dark-eclipse.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-ember.json b/packages/coding-agent/src/modes/theme/defaults/dark-ember.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-ember.json rename to packages/coding-agent/src/modes/theme/defaults/dark-ember.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-equinox.json b/packages/coding-agent/src/modes/theme/defaults/dark-equinox.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-equinox.json rename to packages/coding-agent/src/modes/theme/defaults/dark-equinox.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-forest.json b/packages/coding-agent/src/modes/theme/defaults/dark-forest.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-forest.json rename to packages/coding-agent/src/modes/theme/defaults/dark-forest.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-github.json b/packages/coding-agent/src/modes/theme/defaults/dark-github.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-github.json rename to packages/coding-agent/src/modes/theme/defaults/dark-github.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-gruvbox.json b/packages/coding-agent/src/modes/theme/defaults/dark-gruvbox.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-gruvbox.json rename to packages/coding-agent/src/modes/theme/defaults/dark-gruvbox.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-lavender.json b/packages/coding-agent/src/modes/theme/defaults/dark-lavender.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-lavender.json rename to packages/coding-agent/src/modes/theme/defaults/dark-lavender.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-lunar.json b/packages/coding-agent/src/modes/theme/defaults/dark-lunar.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-lunar.json rename to packages/coding-agent/src/modes/theme/defaults/dark-lunar.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-midnight.json b/packages/coding-agent/src/modes/theme/defaults/dark-midnight.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-midnight.json rename to packages/coding-agent/src/modes/theme/defaults/dark-midnight.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-monochrome.json b/packages/coding-agent/src/modes/theme/defaults/dark-monochrome.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-monochrome.json rename to packages/coding-agent/src/modes/theme/defaults/dark-monochrome.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-monokai.json b/packages/coding-agent/src/modes/theme/defaults/dark-monokai.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-monokai.json rename to packages/coding-agent/src/modes/theme/defaults/dark-monokai.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-nebula.json b/packages/coding-agent/src/modes/theme/defaults/dark-nebula.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-nebula.json rename to packages/coding-agent/src/modes/theme/defaults/dark-nebula.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-nord.json b/packages/coding-agent/src/modes/theme/defaults/dark-nord.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-nord.json rename to packages/coding-agent/src/modes/theme/defaults/dark-nord.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-ocean.json b/packages/coding-agent/src/modes/theme/defaults/dark-ocean.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-ocean.json rename to packages/coding-agent/src/modes/theme/defaults/dark-ocean.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-one.json b/packages/coding-agent/src/modes/theme/defaults/dark-one.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-one.json rename to packages/coding-agent/src/modes/theme/defaults/dark-one.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-rainforest.json b/packages/coding-agent/src/modes/theme/defaults/dark-rainforest.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-rainforest.json rename to packages/coding-agent/src/modes/theme/defaults/dark-rainforest.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-reef.json b/packages/coding-agent/src/modes/theme/defaults/dark-reef.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-reef.json rename to packages/coding-agent/src/modes/theme/defaults/dark-reef.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-retro.json b/packages/coding-agent/src/modes/theme/defaults/dark-retro.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-retro.json rename to packages/coding-agent/src/modes/theme/defaults/dark-retro.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-rose-pine.json b/packages/coding-agent/src/modes/theme/defaults/dark-rose-pine.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-rose-pine.json rename to packages/coding-agent/src/modes/theme/defaults/dark-rose-pine.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-sakura.json b/packages/coding-agent/src/modes/theme/defaults/dark-sakura.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-sakura.json rename to packages/coding-agent/src/modes/theme/defaults/dark-sakura.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-slate.json b/packages/coding-agent/src/modes/theme/defaults/dark-slate.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-slate.json rename to packages/coding-agent/src/modes/theme/defaults/dark-slate.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-solarized.json b/packages/coding-agent/src/modes/theme/defaults/dark-solarized.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-solarized.json rename to packages/coding-agent/src/modes/theme/defaults/dark-solarized.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-solstice.json b/packages/coding-agent/src/modes/theme/defaults/dark-solstice.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-solstice.json rename to packages/coding-agent/src/modes/theme/defaults/dark-solstice.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-starfall.json b/packages/coding-agent/src/modes/theme/defaults/dark-starfall.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-starfall.json rename to packages/coding-agent/src/modes/theme/defaults/dark-starfall.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-sunset.json b/packages/coding-agent/src/modes/theme/defaults/dark-sunset.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-sunset.json rename to packages/coding-agent/src/modes/theme/defaults/dark-sunset.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-swamp.json b/packages/coding-agent/src/modes/theme/defaults/dark-swamp.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-swamp.json rename to packages/coding-agent/src/modes/theme/defaults/dark-swamp.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-synthwave.json b/packages/coding-agent/src/modes/theme/defaults/dark-synthwave.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-synthwave.json rename to packages/coding-agent/src/modes/theme/defaults/dark-synthwave.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-taiga.json b/packages/coding-agent/src/modes/theme/defaults/dark-taiga.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-taiga.json rename to packages/coding-agent/src/modes/theme/defaults/dark-taiga.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-terminal.json b/packages/coding-agent/src/modes/theme/defaults/dark-terminal.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-terminal.json rename to packages/coding-agent/src/modes/theme/defaults/dark-terminal.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-tokyo-night.json b/packages/coding-agent/src/modes/theme/defaults/dark-tokyo-night.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-tokyo-night.json rename to packages/coding-agent/src/modes/theme/defaults/dark-tokyo-night.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-tundra.json b/packages/coding-agent/src/modes/theme/defaults/dark-tundra.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-tundra.json rename to packages/coding-agent/src/modes/theme/defaults/dark-tundra.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-twilight.json b/packages/coding-agent/src/modes/theme/defaults/dark-twilight.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-twilight.json rename to packages/coding-agent/src/modes/theme/defaults/dark-twilight.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/dark-volcanic.json b/packages/coding-agent/src/modes/theme/defaults/dark-volcanic.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/dark-volcanic.json rename to packages/coding-agent/src/modes/theme/defaults/dark-volcanic.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/graphite.json b/packages/coding-agent/src/modes/theme/defaults/graphite.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/graphite.json rename to packages/coding-agent/src/modes/theme/defaults/graphite.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/index.ts b/packages/coding-agent/src/modes/theme/defaults/index.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/index.ts rename to packages/coding-agent/src/modes/theme/defaults/index.ts diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-arctic.json b/packages/coding-agent/src/modes/theme/defaults/light-arctic.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-arctic.json rename to packages/coding-agent/src/modes/theme/defaults/light-arctic.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-aurora-day.json b/packages/coding-agent/src/modes/theme/defaults/light-aurora-day.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-aurora-day.json rename to packages/coding-agent/src/modes/theme/defaults/light-aurora-day.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-canyon.json b/packages/coding-agent/src/modes/theme/defaults/light-canyon.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-canyon.json rename to packages/coding-agent/src/modes/theme/defaults/light-canyon.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-catppuccin.json b/packages/coding-agent/src/modes/theme/defaults/light-catppuccin.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-catppuccin.json rename to packages/coding-agent/src/modes/theme/defaults/light-catppuccin.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-cirrus.json b/packages/coding-agent/src/modes/theme/defaults/light-cirrus.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-cirrus.json rename to packages/coding-agent/src/modes/theme/defaults/light-cirrus.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-coral.json b/packages/coding-agent/src/modes/theme/defaults/light-coral.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-coral.json rename to packages/coding-agent/src/modes/theme/defaults/light-coral.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-cyberpunk.json b/packages/coding-agent/src/modes/theme/defaults/light-cyberpunk.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-cyberpunk.json rename to packages/coding-agent/src/modes/theme/defaults/light-cyberpunk.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-dawn.json b/packages/coding-agent/src/modes/theme/defaults/light-dawn.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-dawn.json rename to packages/coding-agent/src/modes/theme/defaults/light-dawn.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-dunes.json b/packages/coding-agent/src/modes/theme/defaults/light-dunes.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-dunes.json rename to packages/coding-agent/src/modes/theme/defaults/light-dunes.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-eucalyptus.json b/packages/coding-agent/src/modes/theme/defaults/light-eucalyptus.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-eucalyptus.json rename to packages/coding-agent/src/modes/theme/defaults/light-eucalyptus.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-forest.json b/packages/coding-agent/src/modes/theme/defaults/light-forest.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-forest.json rename to packages/coding-agent/src/modes/theme/defaults/light-forest.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-frost.json b/packages/coding-agent/src/modes/theme/defaults/light-frost.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-frost.json rename to packages/coding-agent/src/modes/theme/defaults/light-frost.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-github.json b/packages/coding-agent/src/modes/theme/defaults/light-github.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-github.json rename to packages/coding-agent/src/modes/theme/defaults/light-github.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-glacier.json b/packages/coding-agent/src/modes/theme/defaults/light-glacier.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-glacier.json rename to packages/coding-agent/src/modes/theme/defaults/light-glacier.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-gruvbox.json b/packages/coding-agent/src/modes/theme/defaults/light-gruvbox.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-gruvbox.json rename to packages/coding-agent/src/modes/theme/defaults/light-gruvbox.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-haze.json b/packages/coding-agent/src/modes/theme/defaults/light-haze.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-haze.json rename to packages/coding-agent/src/modes/theme/defaults/light-haze.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-honeycomb.json b/packages/coding-agent/src/modes/theme/defaults/light-honeycomb.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-honeycomb.json rename to packages/coding-agent/src/modes/theme/defaults/light-honeycomb.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-lagoon.json b/packages/coding-agent/src/modes/theme/defaults/light-lagoon.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-lagoon.json rename to packages/coding-agent/src/modes/theme/defaults/light-lagoon.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-lavender.json b/packages/coding-agent/src/modes/theme/defaults/light-lavender.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-lavender.json rename to packages/coding-agent/src/modes/theme/defaults/light-lavender.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-meadow.json b/packages/coding-agent/src/modes/theme/defaults/light-meadow.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-meadow.json rename to packages/coding-agent/src/modes/theme/defaults/light-meadow.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-mint.json b/packages/coding-agent/src/modes/theme/defaults/light-mint.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-mint.json rename to packages/coding-agent/src/modes/theme/defaults/light-mint.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-monochrome.json b/packages/coding-agent/src/modes/theme/defaults/light-monochrome.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-monochrome.json rename to packages/coding-agent/src/modes/theme/defaults/light-monochrome.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-ocean.json b/packages/coding-agent/src/modes/theme/defaults/light-ocean.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-ocean.json rename to packages/coding-agent/src/modes/theme/defaults/light-ocean.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-one.json b/packages/coding-agent/src/modes/theme/defaults/light-one.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-one.json rename to packages/coding-agent/src/modes/theme/defaults/light-one.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-opal.json b/packages/coding-agent/src/modes/theme/defaults/light-opal.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-opal.json rename to packages/coding-agent/src/modes/theme/defaults/light-opal.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-orchard.json b/packages/coding-agent/src/modes/theme/defaults/light-orchard.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-orchard.json rename to packages/coding-agent/src/modes/theme/defaults/light-orchard.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-paper.json b/packages/coding-agent/src/modes/theme/defaults/light-paper.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-paper.json rename to packages/coding-agent/src/modes/theme/defaults/light-paper.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-prism.json b/packages/coding-agent/src/modes/theme/defaults/light-prism.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-prism.json rename to packages/coding-agent/src/modes/theme/defaults/light-prism.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-retro.json b/packages/coding-agent/src/modes/theme/defaults/light-retro.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-retro.json rename to packages/coding-agent/src/modes/theme/defaults/light-retro.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-sand.json b/packages/coding-agent/src/modes/theme/defaults/light-sand.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-sand.json rename to packages/coding-agent/src/modes/theme/defaults/light-sand.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-savanna.json b/packages/coding-agent/src/modes/theme/defaults/light-savanna.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-savanna.json rename to packages/coding-agent/src/modes/theme/defaults/light-savanna.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-solarized.json b/packages/coding-agent/src/modes/theme/defaults/light-solarized.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-solarized.json rename to packages/coding-agent/src/modes/theme/defaults/light-solarized.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-soleil.json b/packages/coding-agent/src/modes/theme/defaults/light-soleil.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-soleil.json rename to packages/coding-agent/src/modes/theme/defaults/light-soleil.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-sunset.json b/packages/coding-agent/src/modes/theme/defaults/light-sunset.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-sunset.json rename to packages/coding-agent/src/modes/theme/defaults/light-sunset.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-synthwave.json b/packages/coding-agent/src/modes/theme/defaults/light-synthwave.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-synthwave.json rename to packages/coding-agent/src/modes/theme/defaults/light-synthwave.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-tokyo-night.json b/packages/coding-agent/src/modes/theme/defaults/light-tokyo-night.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-tokyo-night.json rename to packages/coding-agent/src/modes/theme/defaults/light-tokyo-night.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-wetland.json b/packages/coding-agent/src/modes/theme/defaults/light-wetland.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-wetland.json rename to packages/coding-agent/src/modes/theme/defaults/light-wetland.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/light-zenith.json b/packages/coding-agent/src/modes/theme/defaults/light-zenith.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/light-zenith.json rename to packages/coding-agent/src/modes/theme/defaults/light-zenith.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/limestone.json b/packages/coding-agent/src/modes/theme/defaults/limestone.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/limestone.json rename to packages/coding-agent/src/modes/theme/defaults/limestone.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/mahogany.json b/packages/coding-agent/src/modes/theme/defaults/mahogany.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/mahogany.json rename to packages/coding-agent/src/modes/theme/defaults/mahogany.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/marble.json b/packages/coding-agent/src/modes/theme/defaults/marble.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/marble.json rename to packages/coding-agent/src/modes/theme/defaults/marble.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/obsidian.json b/packages/coding-agent/src/modes/theme/defaults/obsidian.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/obsidian.json rename to packages/coding-agent/src/modes/theme/defaults/obsidian.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/onyx.json b/packages/coding-agent/src/modes/theme/defaults/onyx.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/onyx.json rename to packages/coding-agent/src/modes/theme/defaults/onyx.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/pearl.json b/packages/coding-agent/src/modes/theme/defaults/pearl.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/pearl.json rename to packages/coding-agent/src/modes/theme/defaults/pearl.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/porcelain.json b/packages/coding-agent/src/modes/theme/defaults/porcelain.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/porcelain.json rename to packages/coding-agent/src/modes/theme/defaults/porcelain.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/quartz.json b/packages/coding-agent/src/modes/theme/defaults/quartz.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/quartz.json rename to packages/coding-agent/src/modes/theme/defaults/quartz.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/sandstone.json b/packages/coding-agent/src/modes/theme/defaults/sandstone.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/sandstone.json rename to packages/coding-agent/src/modes/theme/defaults/sandstone.json diff --git a/packages/coding-agent/src/modes/interactive/theme/defaults/titanium.json b/packages/coding-agent/src/modes/theme/defaults/titanium.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/defaults/titanium.json rename to packages/coding-agent/src/modes/theme/defaults/titanium.json diff --git a/packages/coding-agent/src/modes/interactive/theme/light.json b/packages/coding-agent/src/modes/theme/light.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/light.json rename to packages/coding-agent/src/modes/theme/light.json diff --git a/packages/coding-agent/src/modes/interactive/theme/theme-schema.json b/packages/coding-agent/src/modes/theme/theme-schema.json similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/theme-schema.json rename to packages/coding-agent/src/modes/theme/theme-schema.json diff --git a/packages/coding-agent/src/modes/interactive/theme/theme.ts b/packages/coding-agent/src/modes/theme/theme.ts similarity index 100% rename from packages/coding-agent/src/modes/interactive/theme/theme.ts rename to packages/coding-agent/src/modes/theme/theme.ts diff --git a/packages/coding-agent/src/modes/interactive/types.ts b/packages/coding-agent/src/modes/types.ts similarity index 92% rename from packages/coding-agent/src/modes/interactive/types.ts rename to packages/coding-agent/src/modes/types.ts index f43f1cdf1..b717c5697 100644 --- a/packages/coding-agent/src/modes/interactive/types.ts +++ b/packages/coding-agent/src/modes/types.ts @@ -1,14 +1,14 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, ImageContent, Message, UsageReport } from "@oh-my-pi/pi-ai"; import type { Component, Container, Loader, Spacer, Text, TUI } from "@oh-my-pi/pi-tui"; -import type { AgentSession, AgentSessionEvent } from "$c/core/agent-session"; -import type { ExtensionUIContext } from "$c/core/extensions/index"; -import type { CompactOptions } from "$c/core/extensions/types"; -import type { HistoryStorage } from "$c/core/history-storage"; -import type { KeybindingsManager } from "$c/core/keybindings"; -import type { MCPManager } from "$c/core/mcp/index"; -import type { SessionContext, SessionManager } from "$c/core/session-manager"; -import type { SettingsManager } from "$c/core/settings-manager"; +import type { KeybindingsManager } from "$c/config/keybindings"; +import type { SettingsManager } from "$c/config/settings-manager"; +import type { ExtensionUIContext } from "$c/extensibility/extensions/index"; +import type { CompactOptions } from "$c/extensibility/extensions/types"; +import type { MCPManager } from "$c/mcp/index"; +import type { AgentSession, AgentSessionEvent } from "$c/session/agent-session"; +import type { HistoryStorage } from "$c/session/history-storage"; +import type { SessionContext, SessionManager } from "$c/session/session-manager"; import type { AssistantMessageComponent } from "./components/assistant-message"; import type { BashExecutionComponent } from "./components/bash-execution"; import type { CustomEditor } from "./components/custom-editor"; diff --git a/packages/coding-agent/src/modes/interactive/utils/ui-helpers.ts b/packages/coding-agent/src/modes/utils/ui-helpers.ts similarity index 93% rename from packages/coding-agent/src/modes/interactive/utils/ui-helpers.ts rename to packages/coding-agent/src/modes/utils/ui-helpers.ts index bbe9a640f..27fbb17a6 100644 --- a/packages/coding-agent/src/modes/interactive/utils/ui-helpers.ts +++ b/packages/coding-agent/src/modes/utils/ui-helpers.ts @@ -1,20 +1,20 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, Message } from "@oh-my-pi/pi-ai"; import { Spacer, Text, TruncatedText } from "@oh-my-pi/pi-tui"; -import type { CustomMessage } from "$c/core/messages"; -import type { SessionContext } from "$c/core/session-manager"; -import { AssistantMessageComponent } from "$c/modes/interactive/components/assistant-message"; -import { BashExecutionComponent } from "$c/modes/interactive/components/bash-execution"; -import { BranchSummaryMessageComponent } from "$c/modes/interactive/components/branch-summary-message"; -import { CompactionSummaryMessageComponent } from "$c/modes/interactive/components/compaction-summary-message"; -import { CustomMessageComponent } from "$c/modes/interactive/components/custom-message"; -import { DynamicBorder } from "$c/modes/interactive/components/dynamic-border"; -import { PythonExecutionComponent } from "$c/modes/interactive/components/python-execution"; -import { ReadToolGroupComponent } from "$c/modes/interactive/components/read-tool-group"; -import { ToolExecutionComponent } from "$c/modes/interactive/components/tool-execution"; -import { UserMessageComponent } from "$c/modes/interactive/components/user-message"; -import { theme } from "$c/modes/interactive/theme/theme"; -import type { CompactionQueuedMessage, InteractiveModeContext } from "$c/modes/interactive/types"; +import { AssistantMessageComponent } from "$c/modes/components/assistant-message"; +import { BashExecutionComponent } from "$c/modes/components/bash-execution"; +import { BranchSummaryMessageComponent } from "$c/modes/components/branch-summary-message"; +import { CompactionSummaryMessageComponent } from "$c/modes/components/compaction-summary-message"; +import { CustomMessageComponent } from "$c/modes/components/custom-message"; +import { DynamicBorder } from "$c/modes/components/dynamic-border"; +import { PythonExecutionComponent } from "$c/modes/components/python-execution"; +import { ReadToolGroupComponent } from "$c/modes/components/read-tool-group"; +import { ToolExecutionComponent } from "$c/modes/components/tool-execution"; +import { UserMessageComponent } from "$c/modes/components/user-message"; +import { theme } from "$c/modes/theme/theme"; +import type { CompactionQueuedMessage, InteractiveModeContext } from "$c/modes/types"; +import type { CustomMessage } from "$c/session/messages"; +import type { SessionContext } from "$c/session/session-manager"; type TextBlock = { type: "text"; text: string }; diff --git a/packages/coding-agent/src/core/tools/patch/applicator.ts b/packages/coding-agent/src/patch/applicator.ts similarity index 99% rename from packages/coding-agent/src/core/tools/patch/applicator.ts rename to packages/coding-agent/src/patch/applicator.ts index c7c38c7fa..5f0bbd525 100644 --- a/packages/coding-agent/src/core/tools/patch/applicator.ts +++ b/packages/coding-agent/src/patch/applicator.ts @@ -7,7 +7,7 @@ import { mkdirSync, unlinkSync } from "node:fs"; import { dirname } from "node:path"; -import { resolveToCwd } from "$c/core/tools/path-utils"; +import { resolveToCwd } from "$c/tools/path-utils"; import { DEFAULT_FUZZY_THRESHOLD, findContextLine, findMatch, seekSequence } from "./fuzzy"; import { adjustIndentation, diff --git a/packages/coding-agent/src/core/tools/patch/diff.ts b/packages/coding-agent/src/patch/diff.ts similarity index 99% rename from packages/coding-agent/src/core/tools/patch/diff.ts rename to packages/coding-agent/src/patch/diff.ts index 20b866300..431fecea5 100644 --- a/packages/coding-agent/src/core/tools/patch/diff.ts +++ b/packages/coding-agent/src/patch/diff.ts @@ -6,7 +6,7 @@ */ import * as Diff from "diff"; -import { resolveToCwd } from "$c/core/tools/path-utils"; +import { resolveToCwd } from "$c/tools/path-utils"; import { previewPatch } from "./applicator"; import { DEFAULT_FUZZY_THRESHOLD, findMatch } from "./fuzzy"; import { adjustIndentation, normalizeToLF, stripBom } from "./normalize"; diff --git a/packages/coding-agent/src/core/tools/patch/fuzzy.ts b/packages/coding-agent/src/patch/fuzzy.ts similarity index 100% rename from packages/coding-agent/src/core/tools/patch/fuzzy.ts rename to packages/coding-agent/src/patch/fuzzy.ts diff --git a/packages/coding-agent/src/core/tools/patch/index.ts b/packages/coding-agent/src/patch/index.ts similarity index 98% rename from packages/coding-agent/src/core/tools/patch/index.ts rename to packages/coding-agent/src/patch/index.ts index 65971fc4f..6ebad5845 100644 --- a/packages/coding-agent/src/core/tools/patch/index.ts +++ b/packages/coding-agent/src/patch/index.ts @@ -12,19 +12,19 @@ import { mkdir } from "node:fs/promises"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; import { Type } from "@sinclair/typebox"; -import { outputMeta } from "$c/core/output-meta"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import type { ToolSession } from "$c/core/tools/index"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; import { createLspWritethrough, type FileDiagnosticsResult, flushLspWritethroughBatch, type WritethroughCallback, writethroughNoop, -} from "$c/core/tools/lsp/index"; -import { resolveToCwd } from "$c/core/tools/path-utils"; +} from "$c/lsp/index"; import patchDescription from "$c/prompts/tools/patch.md" with { type: "text" }; import replaceDescription from "$c/prompts/tools/replace.md" with { type: "text" }; +import type { ToolSession } from "$c/tools/index"; +import { outputMeta } from "$c/tools/output-meta"; +import { resolveToCwd } from "$c/tools/path-utils"; import { applyPatch } from "./applicator"; import { generateDiffString, generateUnifiedDiffString, replaceText } from "./diff"; import { DEFAULT_FUZZY_THRESHOLD, findMatch } from "./fuzzy"; diff --git a/packages/coding-agent/src/core/tools/patch/normalize.ts b/packages/coding-agent/src/patch/normalize.ts similarity index 100% rename from packages/coding-agent/src/core/tools/patch/normalize.ts rename to packages/coding-agent/src/patch/normalize.ts diff --git a/packages/coding-agent/src/core/tools/patch/normative.ts b/packages/coding-agent/src/patch/normative.ts similarity index 100% rename from packages/coding-agent/src/core/tools/patch/normative.ts rename to packages/coding-agent/src/patch/normative.ts diff --git a/packages/coding-agent/src/core/tools/patch/parser.ts b/packages/coding-agent/src/patch/parser.ts similarity index 100% rename from packages/coding-agent/src/core/tools/patch/parser.ts rename to packages/coding-agent/src/patch/parser.ts diff --git a/packages/coding-agent/src/core/tools/patch/shared.ts b/packages/coding-agent/src/patch/shared.ts similarity index 95% rename from packages/coding-agent/src/core/tools/patch/shared.ts rename to packages/coding-agent/src/patch/shared.ts index 60aa189be..54d15d5bb 100644 --- a/packages/coding-agent/src/core/tools/patch/shared.ts +++ b/packages/coding-agent/src/patch/shared.ts @@ -5,9 +5,11 @@ import type { ToolCallContext } from "@oh-my-pi/pi-agent-core"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { OutputMeta } from "$c/core/output-meta"; -import type { FileDiagnosticsResult } from "$c/core/tools/lsp/index"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { FileDiagnosticsResult } from "$c/lsp/index"; +import { renderDiff as renderDiffColored } from "$c/modes/components/diff"; +import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme"; +import type { OutputMeta } from "$c/tools/output-meta"; import { formatExpandHint, formatStatusIcon, @@ -15,10 +17,8 @@ import { shortenPath, ToolUIKit, truncateDiffByHunk, -} from "$c/core/tools/render-utils"; -import type { RenderCallOptions } from "$c/core/tools/renderers"; -import { renderDiff as renderDiffColored } from "$c/modes/interactive/components/diff"; -import { getLanguageFromPath, type Theme } from "$c/modes/interactive/theme/theme"; +} from "$c/tools/render-utils"; +import type { RenderCallOptions } from "$c/tools/renderers"; import type { DiffError, DiffResult, Operation } from "./types"; // ═══════════════════════════════════════════════════════════════════════════ diff --git a/packages/coding-agent/src/core/tools/patch/types.ts b/packages/coding-agent/src/patch/types.ts similarity index 100% rename from packages/coding-agent/src/core/tools/patch/types.ts rename to packages/coding-agent/src/patch/types.ts diff --git a/packages/coding-agent/src/core/sdk.ts b/packages/coding-agent/src/sdk.ts similarity index 95% rename from packages/coding-agent/src/core/sdk.ts rename to packages/coding-agent/src/sdk.ts index f268e8427..cda886c22 100644 --- a/packages/coding-agent/src/core/sdk.ts +++ b/packages/coding-agent/src/sdk.ts @@ -36,17 +36,22 @@ import chalk from "chalk"; import { loadCapability } from "$c/capability/index"; import { type Rule, ruleCapability } from "$c/capability/rule"; import { getAgentDir, getConfigDirPaths } from "$c/config"; -import "../discovery"; +import "./discovery"; +import { CursorExecHandlers } from "$c/cursor"; import { initializeWithSettings } from "$c/discovery"; -import { AgentSession } from "./agent-session"; -import { AuthStorage } from "./auth-storage"; -import { CursorExecHandlers } from "./cursor/exec-bridge"; +import { TtsrManager } from "$c/export/ttsr"; +import { disposeAllKernelSessions } from "$c/ipy/executor"; +import { closeAllConnections } from "$c/ssh/connection-manager"; +import { unmountAll } from "$c/ssh/sshfs-mount"; +import { ModelRegistry } from "./config/model-registry"; +import { formatModelString, parseModelString } from "./config/model-resolver"; +import { loadPromptTemplates as loadPromptTemplatesInternal, type PromptTemplate } from "./config/prompt-templates"; +import { type Settings, SettingsManager, type SkillsSettings } from "./config/settings-manager"; import { type CustomCommandsLoadResult, loadCustomCommands as loadCustomCommandsInternal, -} from "./custom-commands/index"; -import type { CustomTool, CustomToolContext, CustomToolSessionEvent } from "./custom-tools/types"; -import { EventBus } from "./event-bus"; +} from "./extensibility/custom-commands/index"; +import type { CustomTool, CustomToolContext, CustomToolSessionEvent } from "./extensibility/custom-tools/types"; import { discoverAndLoadExtensions, type ExtensionContext, @@ -59,7 +64,9 @@ import { loadExtensions, type ToolDefinition, wrapRegisteredTools, -} from "./extensions/index"; +} from "./extensibility/extensions/index"; +import { loadSkills as loadSkillsInternal, type Skill, type SkillWarning } from "./extensibility/skills"; +import { type FileSlashCommand, loadSlashCommands as loadSlashCommandsInternal } from "./extensibility/slash-commands"; import { AgentProtocolHandler, ArtifactProtocolHandler, @@ -68,24 +75,15 @@ import { SkillProtocolHandler, } from "./internal-urls"; import { discoverAndLoadMCPTools, type MCPManager, type MCPToolsLoadResult } from "./mcp/index"; -import { convertToLlm } from "./messages"; -import { ModelRegistry } from "./model-registry"; -import { formatModelString, parseModelString } from "./model-resolver"; -import { wrapToolsWithMetaNotice } from "./output-meta"; -import { loadPromptTemplates as loadPromptTemplatesInternal, type PromptTemplate } from "./prompt-templates"; -import { disposeAllKernelSessions } from "./python-executor"; -import { SessionManager } from "./session-manager"; -import { type Settings, SettingsManager, type SkillsSettings } from "./settings-manager"; -import { loadSkills as loadSkillsInternal, type Skill, type SkillWarning } from "./skills"; -import { type FileSlashCommand, loadSlashCommands as loadSlashCommandsInternal } from "./slash-commands"; -import { closeAllConnections } from "./ssh/connection-manager"; -import { unmountAll } from "./ssh/sshfs-mount"; -import { migrateJsonStorage } from "./storage-migration"; +import { AgentSession } from "./session/agent-session"; +import { AuthStorage } from "./session/auth-storage"; +import { convertToLlm } from "./session/messages"; +import { SessionManager } from "./session/session-manager"; +import { migrateJsonStorage } from "./session/storage-migration"; import { buildSystemPrompt as buildSystemPromptInternal, loadProjectContextFiles as loadContextFilesInternal, } from "./system-prompt"; -import { time } from "./timings"; import { ToolContextStore } from "./tools/context"; import { getGeminiImageTools } from "./tools/gemini-image"; import { @@ -107,7 +105,9 @@ import { WriteTool, warmupLspServers, } from "./tools/index"; -import { TtsrManager } from "./ttsr"; +import { wrapToolsWithMetaNotice } from "./tools/output-meta"; +import { EventBus } from "./utils/event-bus"; +import { time } from "./utils/timings"; // Types export interface CreateAgentSessionOptions { @@ -201,20 +201,20 @@ export interface CreateAgentSessionResult { // Re-exports -export type { CustomCommand, CustomCommandFactory } from "./custom-commands/types"; -export type { CustomTool, CustomToolFactory } from "./custom-tools/types"; +export type { PromptTemplate } from "$c/config/prompt-templates"; +export type { Settings, SkillsSettings } from "$c/config/settings-manager"; +export type { CustomCommand, CustomCommandFactory } from "$c/extensibility/custom-commands/types"; +export type { CustomTool, CustomToolFactory } from "$c/extensibility/custom-tools/types"; export type { ExtensionAPI, ExtensionCommandContext, ExtensionContext, ExtensionFactory, ToolDefinition, -} from "./extensions/index"; +} from "$c/extensibility/extensions/index"; +export type { Skill } from "$c/extensibility/skills"; +export type { FileSlashCommand } from "$c/extensibility/slash-commands"; export type { MCPManager, MCPServerConfig, MCPServerConnection, MCPToolsLoadResult } from "./mcp/index"; -export type { PromptTemplate } from "./prompt-templates"; -export type { Settings, SkillsSettings } from "./settings-manager"; -export type { Skill } from "./skills"; -export type { FileSlashCommand } from "./slash-commands"; export type { Tool } from "./tools/index"; export { diff --git a/packages/coding-agent/src/core/agent-session.ts b/packages/coding-agent/src/session/agent-session.ts similarity index 98% rename from packages/coding-agent/src/core/agent-session.ts rename to packages/coding-agent/src/session/agent-session.ts index 395719f1f..c2254b231 100644 --- a/packages/coding-agent/src/core/agent-session.ts +++ b/packages/coding-agent/src/session/agent-session.ts @@ -30,21 +30,19 @@ import { abortableSleep, logger } from "@oh-my-pi/pi-utils"; import { YAML } from "bun"; import type { Rule } from "$c/capability/rule"; import { getAgentDbPath } from "$c/config"; -import { theme } from "$c/modes/interactive/theme/theme"; -import ttsrInterruptTemplate from "$c/prompts/system/ttsr-interrupt.md" with { type: "text" }; -import { type BashResult, executeBash as executeBashCommand } from "./bash-executor"; +import type { ModelRegistry } from "$c/config/model-registry"; +import { parseModelString } from "$c/config/model-resolver"; import { - type CompactionResult, - calculateContextTokens, - collectEntriesForBranchSummary, - compact, - estimateTokens, - generateBranchSummary, - prepareCompaction, - shouldCompact, -} from "./compaction/index"; -import type { LoadedCustomCommand } from "./custom-commands/index"; -import { exportSessionToHtml } from "./export-html/index"; + expandPromptTemplate, + type PromptTemplate, + parseCommandArgs, + renderPromptTemplate, +} from "$c/config/prompt-templates"; +import type { SettingsManager, SkillsSettings } from "$c/config/settings-manager"; +import { type BashResult, executeBash as executeBashCommand } from "$c/exec/bash-executor"; +import { exportSessionToHtml } from "$c/export/html/index"; +import type { TtsrManager } from "$c/export/ttsr"; +import type { LoadedCustomCommand } from "$c/extensibility/custom-commands/index"; import type { ExtensionCommandContext, ExtensionRunner, @@ -56,10 +54,31 @@ import type { TreePreparation, TurnEndEvent, TurnStartEvent, -} from "./extensions"; -import type { CompactOptions, ContextUsage } from "./extensions/types"; -import { extractFileMentions, generateFileMentionMessages } from "./file-mentions"; -import type { HookCommandContext } from "./hooks/types"; +} from "$c/extensibility/extensions"; +import type { CompactOptions, ContextUsage } from "$c/extensibility/extensions/types"; +import type { HookCommandContext } from "$c/extensibility/hooks/types"; +import type { Skill, SkillWarning } from "$c/extensibility/skills"; +import { expandSlashCommand, type FileSlashCommand } from "$c/extensibility/slash-commands"; +import { executePython as executePythonCommand, type PythonResult } from "$c/ipy/executor"; +import { theme } from "$c/modes/theme/theme"; +import { normalizeDiff, normalizeToLF, ParseError, previewPatch, stripBom } from "$c/patch"; +import ttsrInterruptTemplate from "$c/prompts/system/ttsr-interrupt.md" with { type: "text" }; +import { closeAllConnections } from "$c/ssh/connection-manager"; +import { unmountAll } from "$c/ssh/sshfs-mount"; +import { outputMeta } from "$c/tools/output-meta"; +import { resolveToCwd } from "$c/tools/path-utils"; +import type { TodoItem } from "$c/tools/todo-write"; +import { extractFileMentions, generateFileMentionMessages } from "$c/utils/file-mentions"; +import { + type CompactionResult, + calculateContextTokens, + collectEntriesForBranchSummary, + compact, + estimateTokens, + generateBranchSummary, + prepareCompaction, + shouldCompact, +} from "./compaction/index"; import { type BashExecutionMessage, type BranchSummaryMessage, @@ -71,21 +90,7 @@ import { type PythonExecutionMessage, pythonExecutionToText, } from "./messages"; -import type { ModelRegistry } from "./model-registry"; -import { parseModelString } from "./model-resolver"; -import { outputMeta } from "./output-meta"; -import { expandPromptTemplate, type PromptTemplate, parseCommandArgs, renderPromptTemplate } from "./prompt-templates"; -import { executePython as executePythonCommand, type PythonResult } from "./python-executor"; import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, SessionManager } from "./session-manager"; -import type { SettingsManager, SkillsSettings } from "./settings-manager"; -import type { Skill, SkillWarning } from "./skills"; -import { expandSlashCommand, type FileSlashCommand } from "./slash-commands"; -import { closeAllConnections } from "./ssh/connection-manager"; -import { unmountAll } from "./ssh/sshfs-mount"; -import { normalizeDiff, normalizeToLF, ParseError, previewPatch, stripBom } from "./tools/patch"; -import { resolveToCwd } from "./tools/path-utils"; -import type { TodoItem } from "./tools/todo-write"; -import type { TtsrManager } from "./ttsr"; /** Session-specific events that extend the core AgentEvent */ export type AgentSessionEvent = diff --git a/packages/coding-agent/src/core/agent-storage.ts b/packages/coding-agent/src/session/agent-storage.ts similarity index 99% rename from packages/coding-agent/src/core/agent-storage.ts rename to packages/coding-agent/src/session/agent-storage.ts index 660865583..1554bcde9 100644 --- a/packages/coding-agent/src/core/agent-storage.ts +++ b/packages/coding-agent/src/session/agent-storage.ts @@ -3,8 +3,8 @@ import { chmodSync, existsSync, mkdirSync } from "node:fs"; import { dirname } from "node:path"; import { logger } from "@oh-my-pi/pi-utils"; import { getAgentDbPath } from "$c/config"; +import type { Settings } from "$c/config/settings-manager"; import type { AuthCredential } from "./auth-storage"; -import type { Settings } from "./settings-manager"; /** Prepared SQLite statement type from bun:sqlite */ type Statement = ReturnType; diff --git a/packages/coding-agent/src/core/artifacts.ts b/packages/coding-agent/src/session/artifacts.ts similarity index 100% rename from packages/coding-agent/src/core/artifacts.ts rename to packages/coding-agent/src/session/artifacts.ts diff --git a/packages/coding-agent/src/core/auth-storage.ts b/packages/coding-agent/src/session/auth-storage.ts similarity index 100% rename from packages/coding-agent/src/core/auth-storage.ts rename to packages/coding-agent/src/session/auth-storage.ts diff --git a/packages/coding-agent/src/core/compaction/branch-summarization.ts b/packages/coding-agent/src/session/compaction/branch-summarization.ts similarity index 98% rename from packages/coding-agent/src/core/compaction/branch-summarization.ts rename to packages/coding-agent/src/session/compaction/branch-summarization.ts index 794547e77..666255e2c 100644 --- a/packages/coding-agent/src/core/compaction/branch-summarization.ts +++ b/packages/coding-agent/src/session/compaction/branch-summarization.ts @@ -8,16 +8,16 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { Model } from "@oh-my-pi/pi-ai"; import { completeSimple } from "@oh-my-pi/pi-ai"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import branchSummaryPrompt from "$c/prompts/compaction/branch-summary.md" with { type: "text" }; +import branchSummaryPreamble from "$c/prompts/compaction/branch-summary-preamble.md" with { type: "text" }; import { convertToLlm, createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage, -} from "$c/core/messages"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import type { ReadonlySessionManager, SessionEntry } from "$c/core/session-manager"; -import branchSummaryPrompt from "$c/prompts/compaction/branch-summary.md" with { type: "text" }; -import branchSummaryPreamble from "$c/prompts/compaction/branch-summary-preamble.md" with { type: "text" }; +} from "$c/session/messages"; +import type { ReadonlySessionManager, SessionEntry } from "$c/session/session-manager"; import { estimateTokens } from "./compaction"; import { computeFileLists, diff --git a/packages/coding-agent/src/core/compaction/compaction.ts b/packages/coding-agent/src/session/compaction/compaction.ts similarity index 99% rename from packages/coding-agent/src/core/compaction/compaction.ts rename to packages/coding-agent/src/session/compaction/compaction.ts index ac7767db1..8227c042a 100644 --- a/packages/coding-agent/src/core/compaction/compaction.ts +++ b/packages/coding-agent/src/session/compaction/compaction.ts @@ -8,12 +8,12 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, Model, Usage } from "@oh-my-pi/pi-ai"; import { completeSimple } from "@oh-my-pi/pi-ai"; -import { convertToLlm, createBranchSummaryMessage, createCustomMessage } from "$c/core/messages"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import type { CompactionEntry, SessionEntry } from "$c/core/session-manager"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; import compactionSummaryPrompt from "$c/prompts/compaction/compaction-summary.md" with { type: "text" }; import compactionTurnPrefixPrompt from "$c/prompts/compaction/compaction-turn-prefix.md" with { type: "text" }; import compactionUpdateSummaryPrompt from "$c/prompts/compaction/compaction-update-summary.md" with { type: "text" }; +import { convertToLlm, createBranchSummaryMessage, createCustomMessage } from "$c/session/messages"; +import type { CompactionEntry, SessionEntry } from "$c/session/session-manager"; import { computeFileLists, createFileOps, diff --git a/packages/coding-agent/src/core/compaction/index.ts b/packages/coding-agent/src/session/compaction/index.ts similarity index 100% rename from packages/coding-agent/src/core/compaction/index.ts rename to packages/coding-agent/src/session/compaction/index.ts diff --git a/packages/coding-agent/src/core/compaction/utils.ts b/packages/coding-agent/src/session/compaction/utils.ts similarity index 98% rename from packages/coding-agent/src/core/compaction/utils.ts rename to packages/coding-agent/src/session/compaction/utils.ts index d5912a521..b4ba6faa9 100644 --- a/packages/coding-agent/src/core/compaction/utils.ts +++ b/packages/coding-agent/src/session/compaction/utils.ts @@ -4,7 +4,7 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { Message } from "@oh-my-pi/pi-ai"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; import fileOperationsTemplate from "$c/prompts/system/file-operations.md" with { type: "text" }; import summarizationSystemPrompt from "$c/prompts/system/summarization-system.md" with { type: "text" }; diff --git a/packages/coding-agent/src/core/history-storage.ts b/packages/coding-agent/src/session/history-storage.ts similarity index 100% rename from packages/coding-agent/src/core/history-storage.ts rename to packages/coding-agent/src/session/history-storage.ts diff --git a/packages/coding-agent/src/core/messages.ts b/packages/coding-agent/src/session/messages.ts similarity index 98% rename from packages/coding-agent/src/core/messages.ts rename to packages/coding-agent/src/session/messages.ts index 1076bda14..b3eb3d305 100644 --- a/packages/coding-agent/src/core/messages.ts +++ b/packages/coding-agent/src/session/messages.ts @@ -7,8 +7,8 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Message, TextContent } from "@oh-my-pi/pi-ai"; -import type { OutputMeta } from "./output-meta"; -import { formatOutputNotice } from "./output-meta"; +import type { OutputMeta } from "$c/tools/output-meta"; +import { formatOutputNotice } from "$c/tools/output-meta"; export const COMPACTION_SUMMARY_PREFIX = `The conversation history before this point was compacted into the following summary: diff --git a/packages/coding-agent/src/core/session-manager.ts b/packages/coding-agent/src/session/session-manager.ts similarity index 100% rename from packages/coding-agent/src/core/session-manager.ts rename to packages/coding-agent/src/session/session-manager.ts diff --git a/packages/coding-agent/src/core/session-storage.ts b/packages/coding-agent/src/session/session-storage.ts similarity index 100% rename from packages/coding-agent/src/core/session-storage.ts rename to packages/coding-agent/src/session/session-storage.ts diff --git a/packages/coding-agent/src/core/storage-migration.ts b/packages/coding-agent/src/session/storage-migration.ts similarity index 99% rename from packages/coding-agent/src/core/storage-migration.ts rename to packages/coding-agent/src/session/storage-migration.ts index 4b4a3ced3..8a0d63ada 100644 --- a/packages/coding-agent/src/core/storage-migration.ts +++ b/packages/coding-agent/src/session/storage-migration.ts @@ -6,9 +6,9 @@ import { logger } from "@oh-my-pi/pi-utils"; import { getAgentDbPath } from "$c/config"; +import type { Settings } from "$c/config/settings-manager"; import { AgentStorage } from "./agent-storage"; import type { AuthCredential, AuthCredentialEntry, AuthStorageData } from "./auth-storage"; -import type { Settings } from "./settings-manager"; /** Paths configuration for the storage migration process. */ type MigrationPaths = { diff --git a/packages/coding-agent/src/core/streaming-output.ts b/packages/coding-agent/src/session/streaming-output.ts similarity index 98% rename from packages/coding-agent/src/core/streaming-output.ts rename to packages/coding-agent/src/session/streaming-output.ts index f1b3267cc..5034ebd9f 100644 --- a/packages/coding-agent/src/core/streaming-output.ts +++ b/packages/coding-agent/src/session/streaming-output.ts @@ -1,5 +1,5 @@ import { sanitizeText } from "@oh-my-pi/pi-utils"; -import { DEFAULT_MAX_BYTES } from "./tools/truncate"; +import { DEFAULT_MAX_BYTES } from "$c/tools/truncate"; export interface OutputSummary { output: string; diff --git a/packages/coding-agent/src/core/ssh/connection-manager.ts b/packages/coding-agent/src/ssh/connection-manager.ts similarity index 100% rename from packages/coding-agent/src/core/ssh/connection-manager.ts rename to packages/coding-agent/src/ssh/connection-manager.ts diff --git a/packages/coding-agent/src/core/ssh/ssh-executor.ts b/packages/coding-agent/src/ssh/ssh-executor.ts similarity index 98% rename from packages/coding-agent/src/core/ssh/ssh-executor.ts rename to packages/coding-agent/src/ssh/ssh-executor.ts index ce0c31f02..195ead3ad 100644 --- a/packages/coding-agent/src/core/ssh/ssh-executor.ts +++ b/packages/coding-agent/src/ssh/ssh-executor.ts @@ -1,5 +1,5 @@ import { cspawn, logger, ptree } from "@oh-my-pi/pi-utils"; -import { OutputSink } from "$c/core/streaming-output"; +import { OutputSink } from "$c/session/streaming-output"; import { buildRemoteCommand, ensureConnection, ensureHostInfo, type SSHConnectionTarget } from "./connection-manager"; import { hasSshfs, mountRemote } from "./sshfs-mount"; diff --git a/packages/coding-agent/src/core/ssh/sshfs-mount.ts b/packages/coding-agent/src/ssh/sshfs-mount.ts similarity index 100% rename from packages/coding-agent/src/core/ssh/sshfs-mount.ts rename to packages/coding-agent/src/ssh/sshfs-mount.ts diff --git a/packages/coding-agent/src/core/system-prompt.ts b/packages/coding-agent/src/system-prompt.ts similarity index 99% rename from packages/coding-agent/src/core/system-prompt.ts rename to packages/coding-agent/src/system-prompt.ts index 69eec8843..9bb522c72 100644 --- a/packages/coding-agent/src/core/system-prompt.ts +++ b/packages/coding-agent/src/system-prompt.ts @@ -9,12 +9,12 @@ import { $ } from "bun"; import chalk from "chalk"; import { contextFileCapability } from "$c/capability/context-file"; import { systemPromptCapability } from "$c/capability/system-prompt"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { SkillsSettings } from "$c/config/settings-manager"; import { type ContextFile, loadCapability, type SystemPrompt as SystemPromptFile } from "$c/discovery/index"; +import { loadSkills, type Skill } from "$c/extensibility/skills"; import customSystemPromptTemplate from "$c/prompts/system/custom-system-prompt.md" with { type: "text" }; import systemPromptTemplate from "$c/prompts/system/system-prompt.md" with { type: "text" }; -import { renderPromptTemplate } from "./prompt-templates"; -import type { SkillsSettings } from "./settings-manager"; -import { loadSkills, type Skill } from "./skills"; import type { ToolName } from "./tools/index"; interface GitContext { diff --git a/packages/coding-agent/src/core/tools/task/agents.ts b/packages/coding-agent/src/task/agents.ts similarity index 96% rename from packages/coding-agent/src/core/tools/task/agents.ts rename to packages/coding-agent/src/task/agents.ts index a3146b43a..f7c9f0836 100644 --- a/packages/coding-agent/src/core/tools/task/agents.ts +++ b/packages/coding-agent/src/task/agents.ts @@ -4,8 +4,7 @@ * Agents are embedded at build time via Bun's import with { type: "text" }. */ -import { parseFrontmatter } from "$c/core/frontmatter"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; import { parseAgentFields } from "$c/discovery/helpers"; import exploreMd from "$c/prompts/agents/explore.md" with { type: "text" }; // Embed agent markdown files at build time @@ -13,6 +12,7 @@ import agentFrontmatterTemplate from "$c/prompts/agents/frontmatter.md" with { t import planMd from "$c/prompts/agents/plan.md" with { type: "text" }; import reviewerMd from "$c/prompts/agents/reviewer.md" with { type: "text" }; import taskMd from "$c/prompts/agents/task.md" with { type: "text" }; +import { parseFrontmatter } from "$c/utils/frontmatter"; import type { AgentDefinition, AgentSource } from "./types"; interface AgentFrontmatter { diff --git a/packages/coding-agent/src/core/tools/task/commands.ts b/packages/coding-agent/src/task/commands.ts similarity index 96% rename from packages/coding-agent/src/core/tools/task/commands.ts rename to packages/coding-agent/src/task/commands.ts index 0415cb339..ee52cb7c5 100644 --- a/packages/coding-agent/src/core/tools/task/commands.ts +++ b/packages/coding-agent/src/task/commands.ts @@ -6,11 +6,11 @@ import * as path from "node:path"; import { type SlashCommand, slashCommandCapability } from "$c/capability/slash-command"; -import { parseFrontmatter } from "$c/core/frontmatter"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; import { loadCapability } from "$c/discovery"; // Embed command markdown files at build time import initMd from "$c/prompts/agents/init.md" with { type: "text" }; +import { parseFrontmatter } from "$c/utils/frontmatter"; const EMBEDDED_COMMANDS: { name: string; content: string }[] = [ { name: "init.md", content: renderPromptTemplate(initMd) }, diff --git a/packages/coding-agent/src/core/tools/task/discovery.ts b/packages/coding-agent/src/task/discovery.ts similarity index 98% rename from packages/coding-agent/src/core/tools/task/discovery.ts rename to packages/coding-agent/src/task/discovery.ts index f36793f5c..0e3968df3 100644 --- a/packages/coding-agent/src/core/tools/task/discovery.ts +++ b/packages/coding-agent/src/task/discovery.ts @@ -15,8 +15,8 @@ import * as fs from "node:fs"; import * as path from "node:path"; import { findAllNearestProjectConfigDirs, getConfigDirs } from "$c/config"; -import { parseFrontmatter } from "$c/core/frontmatter"; import { parseAgentFields } from "$c/discovery/helpers"; +import { parseFrontmatter } from "$c/utils/frontmatter"; import { loadBundledAgents } from "./agents"; import type { AgentDefinition, AgentSource } from "./types"; diff --git a/packages/coding-agent/src/core/tools/task/executor.ts b/packages/coding-agent/src/task/executor.ts similarity index 97% rename from packages/coding-agent/src/core/tools/task/executor.ts rename to packages/coding-agent/src/task/executor.ts index d50405f89..0771def99 100644 --- a/packages/coding-agent/src/core/tools/task/executor.ts +++ b/packages/coding-agent/src/task/executor.ts @@ -6,16 +6,16 @@ import path from "node:path"; import type { AgentEvent, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; -import type { AuthStorage } from "$c/core/auth-storage"; -import type { EventBus } from "$c/core/event-bus"; -import { callTool } from "$c/core/mcp/client"; -import type { MCPManager } from "$c/core/mcp/manager"; -import type { ModelRegistry } from "$c/core/model-registry"; -import { formatModelString, parseModelPattern } from "$c/core/model-resolver"; -import { checkPythonKernelAvailability } from "$c/core/python-kernel"; -import { LspTool } from "$c/core/tools/lsp/index"; -import type { LspParams } from "$c/core/tools/lsp/types"; -import { PythonTool, type PythonToolParams } from "$c/core/tools/python"; +import type { ModelRegistry } from "$c/config/model-registry"; +import { formatModelString, parseModelPattern } from "$c/config/model-resolver"; +import { checkPythonKernelAvailability } from "$c/ipy/kernel"; +import { LspTool } from "$c/lsp/index"; +import type { LspParams } from "$c/lsp/types"; +import { callTool } from "$c/mcp/client"; +import type { MCPManager } from "$c/mcp/manager"; +import type { AuthStorage } from "$c/session/auth-storage"; +import { PythonTool, type PythonToolParams } from "$c/tools/python"; +import type { EventBus } from "$c/utils/event-bus"; import type { ToolSession } from ".."; import { subprocessToolRegistry } from "./subprocess-tool-registry"; import { @@ -62,7 +62,7 @@ export interface ExecutorOptions { authStorage?: AuthStorage; modelRegistry?: ModelRegistry; settingsManager?: { - serialize: () => import("../../settings-manager").Settings; + serialize: () => import("$c/config/settings-manager").Settings; getPythonToolMode?: () => "ipy-only" | "bash-only" | "both"; getPythonKernelMode?: () => "session" | "per-call"; getPythonSharedGateway?: () => boolean; diff --git a/packages/coding-agent/src/core/tools/task/index.ts b/packages/coding-agent/src/task/index.ts similarity index 99% rename from packages/coding-agent/src/core/tools/task/index.ts rename to packages/coding-agent/src/task/index.ts index 12bcd6c96..5317908a4 100644 --- a/packages/coding-agent/src/core/tools/task/index.ts +++ b/packages/coding-agent/src/task/index.ts @@ -20,10 +20,10 @@ import type { AgentTool, AgentToolResult, AgentToolUpdateCallback } from "@oh-my import type { Usage } from "@oh-my-pi/pi-ai"; import { $ } from "bun"; import { nanoid } from "nanoid"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { formatDuration } from "$c/core/tools/render-utils"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { Theme } from "$c/modes/theme/theme"; import taskDescriptionTemplate from "$c/prompts/tools/task.md" with { type: "text" }; +import { formatDuration } from "$c/tools/render-utils"; import type { ToolSession } from ".."; import { discoverAgents, getAgent } from "./discovery"; import { runSubprocess } from "./executor"; @@ -49,7 +49,7 @@ import { } from "./worktree"; // Import review tools for side effects (registers subagent tool handlers) -import "../review"; +import "../tools/review"; /** Format byte count for display */ function formatBytes(bytes: number): string { diff --git a/packages/coding-agent/src/core/tools/task/name-generator.ts b/packages/coding-agent/src/task/name-generator.ts similarity index 100% rename from packages/coding-agent/src/core/tools/task/name-generator.ts rename to packages/coding-agent/src/task/name-generator.ts diff --git a/packages/coding-agent/src/core/tools/task/omp-command.ts b/packages/coding-agent/src/task/omp-command.ts similarity index 100% rename from packages/coding-agent/src/core/tools/task/omp-command.ts rename to packages/coding-agent/src/task/omp-command.ts diff --git a/packages/coding-agent/src/core/tools/task/parallel.ts b/packages/coding-agent/src/task/parallel.ts similarity index 100% rename from packages/coding-agent/src/core/tools/task/parallel.ts rename to packages/coding-agent/src/task/parallel.ts diff --git a/packages/coding-agent/src/core/tools/task/render.ts b/packages/coding-agent/src/task/render.ts similarity index 99% rename from packages/coding-agent/src/core/tools/task/render.ts rename to packages/coding-agent/src/task/render.ts index 4b660d39e..eded01cbe 100644 --- a/packages/coding-agent/src/core/tools/task/render.ts +++ b/packages/coding-agent/src/task/render.ts @@ -8,7 +8,8 @@ import path from "node:path"; import type { Component } from "@oh-my-pi/pi-tui"; import { Container, Text } from "@oh-my-pi/pi-tui"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { Theme } from "$c/modes/theme/theme"; import { formatBadge, formatDuration, @@ -16,15 +17,14 @@ import { formatStatusIcon, formatTokens, truncate, -} from "$c/core/tools/render-utils"; +} from "$c/tools/render-utils"; import { type FindingPriority, getPriorityInfo, PRIORITY_LABELS, type ReportFindingDetails, type SubmitReviewDetails, -} from "$c/core/tools/review"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +} from "$c/tools/review"; import { subprocessToolRegistry } from "./subprocess-tool-registry"; import type { AgentProgress, SingleResult, TaskParams, TaskToolDetails } from "./types"; diff --git a/packages/coding-agent/src/core/tools/task/subprocess-tool-registry.ts b/packages/coding-agent/src/task/subprocess-tool-registry.ts similarity index 97% rename from packages/coding-agent/src/core/tools/task/subprocess-tool-registry.ts rename to packages/coding-agent/src/task/subprocess-tool-registry.ts index 3c685ee1d..751f1d918 100644 --- a/packages/coding-agent/src/core/tools/task/subprocess-tool-registry.ts +++ b/packages/coding-agent/src/task/subprocess-tool-registry.ts @@ -8,7 +8,7 @@ */ import type { Component } from "@oh-my-pi/pi-tui"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { Theme } from "$c/modes/theme/theme"; /** Event from subprocess tool execution (parsed from JSONL) */ export interface SubprocessToolEvent { diff --git a/packages/coding-agent/src/core/tools/task/template.ts b/packages/coding-agent/src/task/template.ts similarity index 100% rename from packages/coding-agent/src/core/tools/task/template.ts rename to packages/coding-agent/src/task/template.ts diff --git a/packages/coding-agent/src/core/tools/task/types.ts b/packages/coding-agent/src/task/types.ts similarity index 100% rename from packages/coding-agent/src/core/tools/task/types.ts rename to packages/coding-agent/src/task/types.ts diff --git a/packages/coding-agent/src/core/tools/task/worker-protocol.ts b/packages/coding-agent/src/task/worker-protocol.ts similarity index 93% rename from packages/coding-agent/src/core/tools/task/worker-protocol.ts rename to packages/coding-agent/src/task/worker-protocol.ts index 9c4d77cd2..af2cc089b 100644 --- a/packages/coding-agent/src/core/tools/task/worker-protocol.ts +++ b/packages/coding-agent/src/task/worker-protocol.ts @@ -1,7 +1,7 @@ import type { AgentEvent, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; -import type { SerializedAuthStorage } from "$c/core/auth-storage"; -import type { SerializedModelRegistry } from "$c/core/model-registry"; -import type { Settings } from "$c/core/settings-manager"; +import type { SerializedModelRegistry } from "$c/config/model-registry"; +import type { Settings } from "$c/config/settings-manager"; +import type { SerializedAuthStorage } from "$c/session/auth-storage"; /** * MCP tool metadata passed from parent to worker for proxy tool creation. diff --git a/packages/coding-agent/src/core/tools/task/worker.ts b/packages/coding-agent/src/task/worker.ts similarity index 97% rename from packages/coding-agent/src/core/tools/task/worker.ts rename to packages/coding-agent/src/task/worker.ts index deda4db26..dec60180e 100644 --- a/packages/coding-agent/src/core/tools/task/worker.ts +++ b/packages/coding-agent/src/task/worker.ts @@ -17,24 +17,19 @@ import type { AgentEvent, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { Api, Model } from "@oh-my-pi/pi-ai"; import { logger, postmortem, untilAborted } from "@oh-my-pi/pi-utils"; import type { TSchema } from "@sinclair/typebox"; -import type { AgentSessionEvent } from "$c/core/agent-session"; -import { AuthStorage } from "$c/core/auth-storage"; -import type { CustomTool } from "$c/core/custom-tools/types"; -import { ModelRegistry } from "$c/core/model-registry"; -import { parseModelPattern, parseModelString } from "$c/core/model-resolver"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { createAgentSession, discoverAuthStorage, discoverModels } from "$c/core/sdk"; -import { SessionManager } from "$c/core/session-manager"; -import { SettingsManager } from "$c/core/settings-manager"; -import { ToolAbortError } from "$c/core/tool-errors"; -import { type LspToolDetails, lspSchema } from "$c/core/tools/lsp/types"; -import { - getPythonToolDescription, - type PythonToolDetails, - type PythonToolParams, - pythonSchema, -} from "$c/core/tools/python"; +import { ModelRegistry } from "$c/config/model-registry"; +import { parseModelPattern, parseModelString } from "$c/config/model-resolver"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import { SettingsManager } from "$c/config/settings-manager"; +import type { CustomTool } from "$c/extensibility/custom-tools/types"; +import { type LspToolDetails, lspSchema } from "$c/lsp/types"; import lspDescription from "$c/prompts/tools/lsp.md" with { type: "text" }; +import { createAgentSession, discoverAuthStorage, discoverModels } from "$c/sdk"; +import type { AgentSessionEvent } from "$c/session/agent-session"; +import { AuthStorage } from "$c/session/auth-storage"; +import { SessionManager } from "$c/session/session-manager"; +import { getPythonToolDescription, type PythonToolDetails, type PythonToolParams, pythonSchema } from "$c/tools/python"; +import { ToolAbortError } from "$c/tools/tool-errors"; import type { LspToolCallResponse, MCPToolCallResponse, diff --git a/packages/coding-agent/src/core/tools/task/worktree.ts b/packages/coding-agent/src/task/worktree.ts similarity index 100% rename from packages/coding-agent/src/core/tools/task/worktree.ts rename to packages/coding-agent/src/task/worktree.ts diff --git a/packages/coding-agent/src/core/tools/ask.ts b/packages/coding-agent/src/tools/ask.ts similarity index 98% rename from packages/coding-agent/src/core/tools/ask.ts rename to packages/coding-agent/src/tools/ask.ts index 7a81846dd..6422c4d44 100644 --- a/packages/coding-agent/src/core/tools/ask.ts +++ b/packages/coding-agent/src/tools/ask.ts @@ -19,9 +19,9 @@ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallb import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { type Theme, theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import { type Theme, theme } from "$c/modes/theme/theme"; import askDescription from "$c/prompts/tools/ask.md" with { type: "text" }; import type { ToolSession } from "./index"; import { ToolUIKit } from "./render-utils"; diff --git a/packages/coding-agent/src/core/tools/bash-interceptor.ts b/packages/coding-agent/src/tools/bash-interceptor.ts similarity index 98% rename from packages/coding-agent/src/core/tools/bash-interceptor.ts rename to packages/coding-agent/src/tools/bash-interceptor.ts index 27ddcafdb..a228f0232 100644 --- a/packages/coding-agent/src/core/tools/bash-interceptor.ts +++ b/packages/coding-agent/src/tools/bash-interceptor.ts @@ -6,7 +6,7 @@ * the specialized tools instead. */ -import { type BashInterceptorRule, DEFAULT_BASH_INTERCEPTOR_RULES } from "$c/core/settings-manager"; +import { type BashInterceptorRule, DEFAULT_BASH_INTERCEPTOR_RULES } from "$c/config/settings-manager"; export interface InterceptionResult { /** If true, the bash command should be blocked */ diff --git a/packages/coding-agent/src/core/tools/bash.ts b/packages/coding-agent/src/tools/bash.ts similarity index 95% rename from packages/coding-agent/src/core/tools/bash.ts rename to packages/coding-agent/src/tools/bash.ts index a47da5974..10c56674e 100644 --- a/packages/coding-agent/src/core/tools/bash.ts +++ b/packages/coding-agent/src/tools/bash.ts @@ -3,14 +3,14 @@ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallb import type { Component } from "@oh-my-pi/pi-tui"; import { Text, truncateToWidth } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; -import { type BashExecutorOptions, executeBash } from "$c/core/bash-executor"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { OutputMeta } from "$c/core/output-meta"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { ToolError } from "$c/core/tool-errors"; -import { truncateToVisualLines } from "$c/modes/interactive/components/visual-truncate"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import { type BashExecutorOptions, executeBash } from "$c/exec/bash-executor"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import { truncateToVisualLines } from "$c/modes/components/visual-truncate"; +import type { Theme } from "$c/modes/theme/theme"; import bashDescription from "$c/prompts/tools/bash.md" with { type: "text" }; +import type { OutputMeta } from "$c/tools/output-meta"; +import { ToolError } from "$c/tools/tool-errors"; import { checkBashInterception, checkSimpleLsInterception } from "./bash-interceptor"; import type { ToolSession } from "./index"; diff --git a/packages/coding-agent/src/core/tools/calculator.ts b/packages/coding-agent/src/tools/calculator.ts similarity index 98% rename from packages/coding-agent/src/core/tools/calculator.ts rename to packages/coding-agent/src/tools/calculator.ts index 935ebad43..66f8bea26 100644 --- a/packages/coding-agent/src/core/tools/calculator.ts +++ b/packages/coding-agent/src/tools/calculator.ts @@ -3,9 +3,9 @@ import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { Theme } from "$c/modes/theme/theme"; import calculatorDescription from "$c/prompts/tools/calculator.md" with { type: "text" }; import type { ToolSession } from "./index"; import { diff --git a/packages/coding-agent/src/core/tools/complete.ts b/packages/coding-agent/src/tools/complete.ts similarity index 98% rename from packages/coding-agent/src/core/tools/complete.ts rename to packages/coding-agent/src/tools/complete.ts index 476ffb686..c6c575f59 100644 --- a/packages/coding-agent/src/core/tools/complete.ts +++ b/packages/coding-agent/src/tools/complete.ts @@ -9,9 +9,9 @@ import { StringEnum } from "@oh-my-pi/pi-ai"; import type { Static, TObject } from "@sinclair/typebox"; import { Type } from "@sinclair/typebox"; import Ajv, { type ErrorObject, type ValidateFunction } from "ajv"; +import { subprocessToolRegistry } from "$c/task/subprocess-tool-registry"; import type { ToolSession } from "./index"; import { jtdToJsonSchema } from "./jtd-to-json-schema"; -import { subprocessToolRegistry } from "./task/subprocess-tool-registry"; export interface CompleteDetails { data: unknown; diff --git a/packages/coding-agent/src/core/tools/context.ts b/packages/coding-agent/src/tools/context.ts similarity index 85% rename from packages/coding-agent/src/core/tools/context.ts rename to packages/coding-agent/src/tools/context.ts index 932f783f9..d0a440bf7 100644 --- a/packages/coding-agent/src/core/tools/context.ts +++ b/packages/coding-agent/src/tools/context.ts @@ -1,6 +1,6 @@ import type { AgentToolContext, ToolCallContext } from "@oh-my-pi/pi-agent-core"; -import type { CustomToolContext } from "$c/core/custom-tools/types"; -import type { ExtensionUIContext } from "$c/core/extensions/types"; +import type { CustomToolContext } from "$c/extensibility/custom-tools/types"; +import type { ExtensionUIContext } from "$c/extensibility/extensions/types"; declare module "@oh-my-pi/pi-agent-core" { interface AgentToolContext extends CustomToolContext { diff --git a/packages/coding-agent/src/core/tools/fetch.ts b/packages/coding-agent/src/tools/fetch.ts similarity index 98% rename from packages/coding-agent/src/core/tools/fetch.ts rename to packages/coding-agent/src/tools/fetch.ts index 27ccc35f3..532124ba9 100644 --- a/packages/coding-agent/src/core/tools/fetch.ts +++ b/packages/coding-agent/src/tools/fetch.ts @@ -7,21 +7,21 @@ import { ptree } from "@oh-my-pi/pi-utils"; import { type Static, Type } from "@sinclair/typebox"; import { nanoid } from "nanoid"; import { parse as parseHtml } from "node-html-parser"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { OutputMeta } from "$c/core/output-meta"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { ToolAbortError } from "$c/core/tool-errors"; -import { type Theme, theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import { type Theme, theme } from "$c/modes/theme/theme"; import fetchDescription from "$c/prompts/tools/fetch.md" with { type: "text" }; +import type { OutputMeta } from "$c/tools/output-meta"; +import { ToolAbortError } from "$c/tools/tool-errors"; import { ensureTool } from "$c/utils/tools-manager"; +import { specialHandlers } from "$c/web/scrapers/index"; +import type { RenderResult } from "$c/web/scrapers/types"; +import { finalizeOutput, loadPage, MAX_OUTPUT_CHARS } from "$c/web/scrapers/types"; +import { convertWithMarkitdown, fetchBinary } from "$c/web/scrapers/utils"; import type { ToolSession } from "./index"; import { applyListLimit } from "./list-limit"; import { formatExpandHint } from "./render-utils"; import { toolResult } from "./tool-result"; -import { specialHandlers } from "./web-scrapers/index"; -import type { RenderResult } from "./web-scrapers/types"; -import { finalizeOutput, loadPage, MAX_OUTPUT_CHARS } from "./web-scrapers/types"; -import { convertWithMarkitdown, fetchBinary } from "./web-scrapers/utils"; // ============================================================================= // Types and Constants diff --git a/packages/coding-agent/src/core/tools/find.ts b/packages/coding-agent/src/tools/find.ts similarity index 97% rename from packages/coding-agent/src/core/tools/find.ts rename to packages/coding-agent/src/tools/find.ts index 7306dc6ad..e9d576a5f 100644 --- a/packages/coding-agent/src/core/tools/find.ts +++ b/packages/coding-agent/src/tools/find.ts @@ -6,12 +6,12 @@ import { Text } from "@oh-my-pi/pi-tui"; import { ptree, untilAborted } from "@oh-my-pi/pi-utils"; import type { Static } from "@sinclair/typebox"; import { Type } from "@sinclair/typebox"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { OutputMeta } from "$c/core/output-meta"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { ToolAbortError, ToolError, throwIfAborted } from "$c/core/tool-errors"; -import { getLanguageFromPath, type Theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme"; import findDescription from "$c/prompts/tools/find.md" with { type: "text" }; +import type { OutputMeta } from "$c/tools/output-meta"; +import { ToolAbortError, ToolError, throwIfAborted } from "$c/tools/tool-errors"; import { ensureTool } from "$c/utils/tools-manager"; import type { ToolSession } from "./index"; diff --git a/packages/coding-agent/src/core/tools/gemini-image.ts b/packages/coding-agent/src/tools/gemini-image.ts similarity index 99% rename from packages/coding-agent/src/core/tools/gemini-image.ts rename to packages/coding-agent/src/tools/gemini-image.ts index 6c3f738a3..8dfa1dfa9 100644 --- a/packages/coding-agent/src/core/tools/gemini-image.ts +++ b/packages/coding-agent/src/tools/gemini-image.ts @@ -4,12 +4,12 @@ import { StringEnum } from "@oh-my-pi/pi-ai"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { type Static, Type } from "@sinclair/typebox"; import { nanoid } from "nanoid"; -import type { CustomTool } from "$c/core/custom-tools/types"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { CustomTool } from "$c/extensibility/custom-tools/types"; import geminiImageDescription from "$c/prompts/tools/gemini-image.md" with { type: "text" }; import { detectSupportedImageMimeTypeFromFile } from "$c/utils/mime"; +import { getEnv } from "$c/web/search/auth"; import { resolveReadPath } from "./path-utils"; -import { getEnv } from "./web-search/auth"; const DEFAULT_MODEL = "gemini-3-pro-image-preview"; const DEFAULT_OPENROUTER_MODEL = "google/gemini-3-pro-image-preview"; diff --git a/packages/coding-agent/src/core/tools/grep.ts b/packages/coding-agent/src/tools/grep.ts similarity index 98% rename from packages/coding-agent/src/core/tools/grep.ts rename to packages/coding-agent/src/tools/grep.ts index 88c6c07aa..faeac18a4 100644 --- a/packages/coding-agent/src/core/tools/grep.ts +++ b/packages/coding-agent/src/tools/grep.ts @@ -6,14 +6,14 @@ import { Text } from "@oh-my-pi/pi-tui"; import { ptree, readLines } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; import { $ } from "bun"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { OutputMeta } from "$c/core/output-meta"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { ToolAbortError, ToolError } from "$c/core/tool-errors"; -import { untilAborted } from "$c/core/utils"; -import { getLanguageFromPath, type Theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme"; import grepDescription from "$c/prompts/tools/grep.md" with { type: "text" }; +import type { OutputMeta } from "$c/tools/output-meta"; +import { ToolAbortError, ToolError } from "$c/tools/tool-errors"; import { ensureTool } from "$c/utils/tools-manager"; +import { untilAborted } from "$c/utils/utils"; import type { ToolSession } from "./index"; import { applyListLimit } from "./list-limit"; import { resolveToCwd } from "./path-utils"; diff --git a/packages/coding-agent/src/core/tools/index.ts b/packages/coding-agent/src/tools/index.ts similarity index 90% rename from packages/coding-agent/src/core/tools/index.ts rename to packages/coding-agent/src/tools/index.ts index 0f62425ca..7af22bb84 100644 --- a/packages/coding-agent/src/core/tools/index.ts +++ b/packages/coding-agent/src/tools/index.ts @@ -1,15 +1,6 @@ -export { AskTool, type AskToolDetails } from "./ask"; -export { BashTool, type BashToolDetails, type BashToolOptions } from "./bash"; -export { CalculatorTool, type CalculatorToolDetails } from "./calculator"; -export { CompleteTool } from "./complete"; // Exa MCP tools (22 tools) -export { exaTools } from "./exa/index"; -export type { ExaRenderDetails, ExaSearchResponse, ExaSearchResult } from "./exa/types"; -export { FetchTool, type FetchToolDetails } from "./fetch"; -export { type FindOperations, FindTool, type FindToolDetails, type FindToolOptions } from "./find"; -export { setPreferredImageProvider } from "./gemini-image"; -export { type GrepOperations, GrepTool, type GrepToolDetails, type GrepToolOptions } from "./grep"; -export { type LsOperations, LsTool, type LsToolDetails, type LsToolOptions } from "./ls"; +export { exaTools } from "$c/exa/index"; +export type { ExaRenderDetails, ExaSearchResponse, ExaSearchResult } from "$c/exa/types"; export { type FileDiagnosticsResult, type FileFormatResult, @@ -20,25 +11,9 @@ export { type LspWarmupOptions, type LspWarmupResult, warmupLspServers, -} from "./lsp/index"; -export { NotebookTool, type NotebookToolDetails } from "./notebook"; -export { EditTool, type EditToolDetails } from "./patch"; -export { PythonTool, type PythonToolDetails, type PythonToolOptions } from "./python"; -export { ReadTool, type ReadToolDetails } from "./read"; -export { reportFindingTool, type SubmitReviewDetails } from "./review"; -export { loadSshTool, type SSHToolDetails, SshTool } from "./ssh"; -export { BUNDLED_AGENTS, TaskTool } from "./task/index"; -export { type TodoItem, TodoWriteTool, type TodoWriteToolDetails } from "./todo-write"; -export { - DEFAULT_MAX_BYTES, - DEFAULT_MAX_LINES, - formatSize, - type TruncationOptions, - type TruncationResult, - truncateHead, - truncateLine, - truncateTail, -} from "./truncate"; +} from "$c/lsp/index"; +export { EditTool, type EditToolDetails } from "$c/patch"; +export { BUNDLED_AGENTS, TaskTool } from "$c/task/index"; export { companyWebSearchTools, exaWebSearchTools, @@ -56,17 +31,46 @@ export { webSearchCustomTool, webSearchDeepTool, webSearchLinkedinTool, -} from "./web-search/index"; +} from "$c/web/search/index"; +export { AskTool, type AskToolDetails } from "./ask"; +export { BashTool, type BashToolDetails, type BashToolOptions } from "./bash"; +export { CalculatorTool, type CalculatorToolDetails } from "./calculator"; +export { CompleteTool } from "./complete"; +export { FetchTool, type FetchToolDetails } from "./fetch"; +export { type FindOperations, FindTool, type FindToolDetails, type FindToolOptions } from "./find"; +export { setPreferredImageProvider } from "./gemini-image"; +export { type GrepOperations, GrepTool, type GrepToolDetails, type GrepToolOptions } from "./grep"; +export { type LsOperations, LsTool, type LsToolDetails, type LsToolOptions } from "./ls"; +export { NotebookTool, type NotebookToolDetails } from "./notebook"; +export { PythonTool, type PythonToolDetails, type PythonToolOptions } from "./python"; +export { ReadTool, type ReadToolDetails } from "./read"; +export { reportFindingTool, type SubmitReviewDetails } from "./review"; +export { loadSshTool, type SSHToolDetails, SshTool } from "./ssh"; +export { type TodoItem, TodoWriteTool, type TodoWriteToolDetails } from "./todo-write"; +export { + DEFAULT_MAX_BYTES, + DEFAULT_MAX_LINES, + formatSize, + type TruncationOptions, + type TruncationResult, + truncateHead, + truncateLine, + truncateTail, +} from "./truncate"; export { WriteTool, type WriteToolDetails } from "./write"; import type { AgentTool } from "@oh-my-pi/pi-agent-core"; import { logger } from "@oh-my-pi/pi-utils"; -import type { ArtifactManager } from "$c/core/artifacts"; -import type { EventBus } from "$c/core/event-bus"; -import type { InternalUrlRouter } from "$c/core/internal-urls"; -import { getPreludeDocs, warmPythonEnvironment } from "$c/core/python-executor"; -import { checkPythonKernelAvailability } from "$c/core/python-kernel"; -import type { BashInterceptorRule } from "$c/core/settings-manager"; +import type { BashInterceptorRule } from "$c/config/settings-manager"; +import type { InternalUrlRouter } from "$c/internal-urls"; +import { getPreludeDocs, warmPythonEnvironment } from "$c/ipy/executor"; +import { checkPythonKernelAvailability } from "$c/ipy/kernel"; +import { LspTool } from "$c/lsp/index"; +import { EditTool } from "$c/patch"; +import type { ArtifactManager } from "$c/session/artifacts"; +import { TaskTool } from "$c/task/index"; +import type { EventBus } from "$c/utils/event-bus"; +import { WebSearchTool } from "$c/web/search/index"; import { AskTool } from "./ask"; import { BashTool } from "./bash"; import { CalculatorTool } from "./calculator"; @@ -75,16 +79,12 @@ import { FetchTool } from "./fetch"; import { FindTool } from "./find"; import { GrepTool } from "./grep"; import { LsTool } from "./ls"; -import { LspTool } from "./lsp/index"; import { NotebookTool } from "./notebook"; -import { EditTool } from "./patch"; import { PythonTool } from "./python"; import { ReadTool } from "./read"; import { reportFindingTool } from "./review"; import { loadSshTool } from "./ssh"; -import { TaskTool } from "./task/index"; import { TodoWriteTool } from "./todo-write"; -import { WebSearchTool } from "./web-search/index"; import { WriteTool } from "./write"; /** Tool type (AgentTool from pi-ai) */ @@ -117,15 +117,15 @@ export interface ToolSession { /** Get the current session model string, regardless of how it was chosen */ getActiveModelString?: () => string | undefined; /** Auth storage for passing to subagents (avoids re-discovery) */ - authStorage?: import("../auth-storage").AuthStorage; + authStorage?: import("$c/session/auth-storage").AuthStorage; /** Model registry for passing to subagents (avoids re-discovery) */ - modelRegistry?: import("../model-registry").ModelRegistry; + modelRegistry?: import("$c/config/model-registry").ModelRegistry; /** MCP manager for proxying MCP calls through parent */ mcpManager?: import("../mcp/manager").MCPManager; /** Internal URL router for agent:// and skill:// URLs */ internalRouter?: InternalUrlRouter; /** Settings manager for passing to subagents (avoids SQLite access in workers) */ - settingsManager?: { serialize: () => import("../settings-manager").Settings }; + settingsManager?: { serialize: () => import("$c/config/settings-manager").Settings }; /** Settings manager (optional) */ settings?: { getImageAutoResize(): boolean; diff --git a/packages/coding-agent/src/core/tools/jtd-to-json-schema.ts b/packages/coding-agent/src/tools/jtd-to-json-schema.ts similarity index 100% rename from packages/coding-agent/src/core/tools/jtd-to-json-schema.ts rename to packages/coding-agent/src/tools/jtd-to-json-schema.ts diff --git a/packages/coding-agent/src/core/tools/list-limit.ts b/packages/coding-agent/src/tools/list-limit.ts similarity index 95% rename from packages/coding-agent/src/core/tools/list-limit.ts rename to packages/coding-agent/src/tools/list-limit.ts index 52c0920ea..2b0faf6a6 100644 --- a/packages/coding-agent/src/core/tools/list-limit.ts +++ b/packages/coding-agent/src/tools/list-limit.ts @@ -1,4 +1,4 @@ -import type { LimitsMeta } from "$c/core/output-meta"; +import type { LimitsMeta } from "$c/tools/output-meta"; export interface ListLimitResult { items: T[]; diff --git a/packages/coding-agent/src/core/tools/ls.ts b/packages/coding-agent/src/tools/ls.ts similarity index 97% rename from packages/coding-agent/src/core/tools/ls.ts rename to packages/coding-agent/src/tools/ls.ts index eef92e709..0d6d00eb4 100644 --- a/packages/coding-agent/src/core/tools/ls.ts +++ b/packages/coding-agent/src/tools/ls.ts @@ -3,10 +3,10 @@ import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core"; import { type Component, Text } from "@oh-my-pi/pi-tui"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { OutputMeta } from "$c/core/output-meta"; -import { ToolError, throwIfAborted } from "$c/core/tool-errors"; -import { getLanguageFromPath, type Theme } from "$c/modes/interactive/theme/theme"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme"; +import type { OutputMeta } from "$c/tools/output-meta"; +import { ToolError, throwIfAborted } from "$c/tools/tool-errors"; import type { ToolSession } from "./index"; import { applyListLimit } from "./list-limit"; import { resolveToCwd } from "./path-utils"; diff --git a/packages/coding-agent/src/core/tools/notebook.ts b/packages/coding-agent/src/tools/notebook.ts similarity index 98% rename from packages/coding-agent/src/core/tools/notebook.ts rename to packages/coding-agent/src/tools/notebook.ts index 6321a94be..5145742c4 100644 --- a/packages/coding-agent/src/core/tools/notebook.ts +++ b/packages/coding-agent/src/tools/notebook.ts @@ -4,9 +4,9 @@ import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { type Static, Type } from "@sinclair/typebox"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { ToolSession } from "$c/core/sdk"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { Theme } from "$c/modes/theme/theme"; +import type { ToolSession } from "$c/sdk"; import { resolveToCwd } from "./path-utils"; import { formatCount, diff --git a/packages/coding-agent/src/core/output-meta.ts b/packages/coding-agent/src/tools/output-meta.ts similarity index 98% rename from packages/coding-agent/src/core/output-meta.ts rename to packages/coding-agent/src/tools/output-meta.ts index 471e6366c..031c72079 100644 --- a/packages/coding-agent/src/core/output-meta.ts +++ b/packages/coding-agent/src/tools/output-meta.ts @@ -7,10 +7,10 @@ import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, TextContent } from "@oh-my-pi/pi-ai"; -import type { OutputSummary } from "./streaming-output"; +import type { OutputSummary } from "$c/session/streaming-output"; +import type { TruncationResult } from "$c/tools/truncate"; +import { formatSize } from "$c/tools/truncate"; import { renderError } from "./tool-errors"; -import type { TruncationResult } from "./tools/truncate"; -import { formatSize } from "./tools/truncate"; /** * Truncation metadata for the output notice. diff --git a/packages/coding-agent/src/core/tools/output-utils.ts b/packages/coding-agent/src/tools/output-utils.ts similarity index 96% rename from packages/coding-agent/src/core/tools/output-utils.ts rename to packages/coding-agent/src/tools/output-utils.ts index 3490a62ca..249a7b359 100644 --- a/packages/coding-agent/src/core/tools/output-utils.ts +++ b/packages/coding-agent/src/tools/output-utils.ts @@ -1,4 +1,4 @@ -import { ArtifactManager } from "$c/core/artifacts"; +import { ArtifactManager } from "$c/session/artifacts"; import type { ToolSession } from "./index"; export interface TailBuffer { diff --git a/packages/coding-agent/src/core/tools/path-utils.ts b/packages/coding-agent/src/tools/path-utils.ts similarity index 100% rename from packages/coding-agent/src/core/tools/path-utils.ts rename to packages/coding-agent/src/tools/path-utils.ts diff --git a/packages/coding-agent/src/core/tools/python.ts b/packages/coding-agent/src/tools/python.ts similarity index 98% rename from packages/coding-agent/src/core/tools/python.ts rename to packages/coding-agent/src/tools/python.ts index 00cb6ceed..2bc798b6c 100644 --- a/packages/coding-agent/src/core/tools/python.ts +++ b/packages/coding-agent/src/tools/python.ts @@ -4,16 +4,16 @@ import type { ImageContent } from "@oh-my-pi/pi-ai"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; import { type Static, Type } from "@sinclair/typebox"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { OutputMeta } from "$c/core/output-meta"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { executePython, getPreludeDocs, type PythonExecutorOptions } from "$c/core/python-executor"; -import type { PreludeHelper, PythonStatusEvent } from "$c/core/python-kernel"; -import { OutputSink, type OutputSummary } from "$c/core/streaming-output"; -import { ToolAbortError, ToolError } from "$c/core/tool-errors"; -import { truncateToVisualLines } from "$c/modes/interactive/components/visual-truncate"; -import { highlightCode, type Theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import { executePython, getPreludeDocs, type PythonExecutorOptions } from "$c/ipy/executor"; +import type { PreludeHelper, PythonStatusEvent } from "$c/ipy/kernel"; +import { truncateToVisualLines } from "$c/modes/components/visual-truncate"; +import { highlightCode, type Theme } from "$c/modes/theme/theme"; import pythonDescription from "$c/prompts/tools/python.md" with { type: "text" }; +import { OutputSink, type OutputSummary } from "$c/session/streaming-output"; +import type { OutputMeta } from "$c/tools/output-meta"; +import { ToolAbortError, ToolError } from "$c/tools/tool-errors"; import type { ToolSession } from "./index"; import { allocateOutputArtifact, createTailBuffer } from "./output-utils"; import { resolveToCwd } from "./path-utils"; diff --git a/packages/coding-agent/src/core/tools/read.ts b/packages/coding-agent/src/tools/read.ts similarity index 98% rename from packages/coding-agent/src/core/tools/read.ts rename to packages/coding-agent/src/tools/read.ts index dbf2cd07c..b856fc188 100644 --- a/packages/coding-agent/src/core/tools/read.ts +++ b/packages/coding-agent/src/tools/read.ts @@ -7,13 +7,13 @@ import { Text } from "@oh-my-pi/pi-tui"; import { ptree } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; import { CONFIG_DIR_NAME } from "$c/config"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { OutputMeta } from "$c/core/output-meta"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import type { ToolSession } from "$c/core/sdk"; -import { ToolAbortError, ToolError, throwIfAborted } from "$c/core/tool-errors"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { Theme } from "$c/modes/theme/theme"; import readDescription from "$c/prompts/tools/read.md" with { type: "text" }; +import type { ToolSession } from "$c/sdk"; +import type { OutputMeta } from "$c/tools/output-meta"; +import { ToolAbortError, ToolError, throwIfAborted } from "$c/tools/tool-errors"; import { formatDimensionNote, resizeImage } from "$c/utils/image-resize"; import { detectSupportedImageMimeTypeFromFile } from "$c/utils/mime"; import { ensureTool } from "$c/utils/tools-manager"; diff --git a/packages/coding-agent/src/core/tools/render-utils.ts b/packages/coding-agent/src/tools/render-utils.ts similarity index 99% rename from packages/coding-agent/src/core/tools/render-utils.ts rename to packages/coding-agent/src/tools/render-utils.ts index e207a4760..f1017ffe6 100644 --- a/packages/coding-agent/src/core/tools/render-utils.ts +++ b/packages/coding-agent/src/tools/render-utils.ts @@ -6,7 +6,7 @@ */ import { homedir } from "node:os"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { Theme } from "$c/modes/theme/theme"; // ============================================================================= // Standardized Display Constants diff --git a/packages/coding-agent/src/core/tools/renderers.ts b/packages/coding-agent/src/tools/renderers.ts similarity index 86% rename from packages/coding-agent/src/core/tools/renderers.ts rename to packages/coding-agent/src/tools/renderers.ts index c68bf9fec..eecab8144 100644 --- a/packages/coding-agent/src/core/tools/renderers.ts +++ b/packages/coding-agent/src/tools/renderers.ts @@ -5,8 +5,12 @@ */ import type { Component } from "@oh-my-pi/pi-tui"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import { lspToolRenderer } from "$c/lsp/render"; +import type { Theme } from "$c/modes/theme/theme"; +import { editToolRenderer } from "$c/patch"; +import { taskToolRenderer } from "$c/task/render"; +import { webSearchToolRenderer } from "$c/web/search/render"; import { askToolRenderer } from "./ask"; import { bashToolRenderer } from "./bash"; import { calculatorToolRenderer } from "./calculator"; @@ -14,15 +18,11 @@ import { fetchToolRenderer } from "./fetch"; import { findToolRenderer } from "./find"; import { grepToolRenderer } from "./grep"; import { lsToolRenderer } from "./ls"; -import { lspToolRenderer } from "./lsp/render"; import { notebookToolRenderer } from "./notebook"; -import { editToolRenderer } from "./patch"; import { pythonToolRenderer } from "./python"; import { readToolRenderer } from "./read"; import { sshToolRenderer } from "./ssh"; -import { taskToolRenderer } from "./task/render"; import { todoWriteToolRenderer } from "./todo-write"; -import { webSearchToolRenderer } from "./web-search/render"; import { writeToolRenderer } from "./write"; export interface RenderCallOptions { diff --git a/packages/coding-agent/src/core/tools/review.ts b/packages/coding-agent/src/tools/review.ts similarity index 97% rename from packages/coding-agent/src/core/tools/review.ts rename to packages/coding-agent/src/tools/review.ts index d0ea148cf..764e2a0b5 100644 --- a/packages/coding-agent/src/core/tools/review.ts +++ b/packages/coding-agent/src/tools/review.ts @@ -10,7 +10,7 @@ import type { AgentTool } from "@oh-my-pi/pi-agent-core"; import type { Component } from "@oh-my-pi/pi-tui"; import { Container, Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; -import type { Theme, ThemeColor } from "$c/modes/interactive/theme/theme"; +import type { Theme, ThemeColor } from "$c/modes/theme/theme"; export type FindingPriority = "P0" | "P1" | "P2" | "P3"; @@ -151,7 +151,7 @@ export type { ReportFindingDetails }; import path from "node:path"; import { StringEnum } from "@oh-my-pi/pi-ai"; -import { subprocessToolRegistry } from "./task/subprocess-tool-registry"; +import { subprocessToolRegistry } from "$c/task/subprocess-tool-registry"; // Register report_finding handler subprocessToolRegistry.register("report_finding", { diff --git a/packages/coding-agent/src/core/tools/ssh.ts b/packages/coding-agent/src/tools/ssh.ts similarity index 94% rename from packages/coding-agent/src/core/tools/ssh.ts rename to packages/coding-agent/src/tools/ssh.ts index 9a4e7a7fd..2ea228335 100644 --- a/packages/coding-agent/src/core/tools/ssh.ts +++ b/packages/coding-agent/src/tools/ssh.ts @@ -4,16 +4,16 @@ import { Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; import type { SSHHost } from "$c/capability/ssh"; import { sshCapability } from "$c/capability/ssh"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import type { OutputMeta } from "$c/core/output-meta"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import type { SSHHostInfo } from "$c/core/ssh/connection-manager"; -import { ensureHostInfo, getHostInfoForHost } from "$c/core/ssh/connection-manager"; -import { executeSSH } from "$c/core/ssh/ssh-executor"; -import { ToolError } from "$c/core/tool-errors"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; import { loadCapability } from "$c/discovery/index"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { Theme } from "$c/modes/theme/theme"; import sshDescriptionBase from "$c/prompts/tools/ssh.md" with { type: "text" }; +import type { SSHHostInfo } from "$c/ssh/connection-manager"; +import { ensureHostInfo, getHostInfoForHost } from "$c/ssh/connection-manager"; +import { executeSSH } from "$c/ssh/ssh-executor"; +import type { OutputMeta } from "$c/tools/output-meta"; +import { ToolError } from "$c/tools/tool-errors"; import type { ToolSession } from "./index"; import { allocateOutputArtifact, createTailBuffer } from "./output-utils"; import { ToolUIKit } from "./render-utils"; diff --git a/packages/coding-agent/src/core/tools/todo-write.ts b/packages/coding-agent/src/tools/todo-write.ts similarity index 96% rename from packages/coding-agent/src/core/tools/todo-write.ts rename to packages/coding-agent/src/tools/todo-write.ts index 1b0706751..a5a8b04c0 100644 --- a/packages/coding-agent/src/core/tools/todo-write.ts +++ b/packages/coding-agent/src/tools/todo-write.ts @@ -7,11 +7,11 @@ import { Text } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; import chalk from "chalk"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import type { ToolSession } from "$c/core/sdk"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { Theme } from "$c/modes/theme/theme"; import todoWriteDescription from "$c/prompts/tools/todo-write.md" with { type: "text" }; +import type { ToolSession } from "$c/sdk"; const todoWriteSchema = Type.Object({ todos: Type.Array( diff --git a/packages/coding-agent/src/core/tool-errors.ts b/packages/coding-agent/src/tools/tool-errors.ts similarity index 100% rename from packages/coding-agent/src/core/tool-errors.ts rename to packages/coding-agent/src/tools/tool-errors.ts diff --git a/packages/coding-agent/src/core/tools/tool-result.ts b/packages/coding-agent/src/tools/tool-result.ts similarity index 93% rename from packages/coding-agent/src/core/tools/tool-result.ts rename to packages/coding-agent/src/tools/tool-result.ts index d2c6c8783..fecaf0ce1 100644 --- a/packages/coding-agent/src/core/tools/tool-result.ts +++ b/packages/coding-agent/src/tools/tool-result.ts @@ -1,13 +1,13 @@ import type { AgentToolResult } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, TextContent } from "@oh-my-pi/pi-ai"; +import type { OutputSummary } from "$c/session/streaming-output"; import type { OutputMeta, TruncationOptions, TruncationSummaryOptions, TruncationTextOptions, -} from "$c/core/output-meta"; -import { outputMeta } from "$c/core/output-meta"; -import type { OutputSummary } from "$c/core/streaming-output"; +} from "$c/tools/output-meta"; +import { outputMeta } from "$c/tools/output-meta"; import type { TruncationResult } from "./truncate"; type ToolContent = Array; diff --git a/packages/coding-agent/src/core/tools/truncate.ts b/packages/coding-agent/src/tools/truncate.ts similarity index 100% rename from packages/coding-agent/src/core/tools/truncate.ts rename to packages/coding-agent/src/tools/truncate.ts diff --git a/packages/coding-agent/src/core/tools/write.ts b/packages/coding-agent/src/tools/write.ts similarity index 96% rename from packages/coding-agent/src/core/tools/write.ts rename to packages/coding-agent/src/tools/write.ts index 784e1df46..69dadbf20 100644 --- a/packages/coding-agent/src/core/tools/write.ts +++ b/packages/coding-agent/src/tools/write.ts @@ -9,18 +9,18 @@ import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; -import { type OutputMeta, outputMeta } from "$c/core/output-meta"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import type { ToolSession } from "$c/core/sdk"; -import { getLanguageFromPath, highlightCode, type Theme } from "$c/modes/interactive/theme/theme"; -import writeDescription from "$c/prompts/tools/write.md" with { type: "text" }; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; import { createLspWritethrough, type FileDiagnosticsResult, type WritethroughCallback, writethroughNoop, -} from "./lsp/index"; +} from "$c/lsp/index"; +import { getLanguageFromPath, highlightCode, type Theme } from "$c/modes/theme/theme"; +import writeDescription from "$c/prompts/tools/write.md" with { type: "text" }; +import type { ToolSession } from "$c/sdk"; +import { type OutputMeta, outputMeta } from "$c/tools/output-meta"; import { resolveToCwd } from "./path-utils"; import { formatDiagnostics, formatExpandHint, formatStatusIcon, replaceTabs, shortenPath } from "./render-utils"; import type { RenderCallOptions } from "./renderers"; diff --git a/packages/coding-agent/src/core/event-bus.ts b/packages/coding-agent/src/utils/event-bus.ts similarity index 100% rename from packages/coding-agent/src/core/event-bus.ts rename to packages/coding-agent/src/utils/event-bus.ts diff --git a/packages/coding-agent/src/core/file-mentions.ts b/packages/coding-agent/src/utils/file-mentions.ts similarity index 96% rename from packages/coding-agent/src/core/file-mentions.ts rename to packages/coding-agent/src/utils/file-mentions.ts index e1b86ea6b..48828683f 100644 --- a/packages/coding-agent/src/core/file-mentions.ts +++ b/packages/coding-agent/src/utils/file-mentions.ts @@ -8,10 +8,10 @@ import path from "node:path"; import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; -import type { FileMentionMessage } from "./messages"; -import { resolveReadPath } from "./tools/path-utils"; -import { formatAge } from "./tools/render-utils"; -import { DEFAULT_MAX_BYTES, formatSize, truncateHead, truncateStringToBytesFromStart } from "./tools/truncate"; +import type { FileMentionMessage } from "$c/session/messages"; +import { resolveReadPath } from "$c/tools/path-utils"; +import { formatAge } from "$c/tools/render-utils"; +import { DEFAULT_MAX_BYTES, formatSize, truncateHead, truncateStringToBytesFromStart } from "$c/tools/truncate"; /** Regex to match @filepath patterns in text */ const FILE_MENTION_REGEX = /@([^\s@]+)/g; diff --git a/packages/coding-agent/src/core/frontmatter.ts b/packages/coding-agent/src/utils/frontmatter.ts similarity index 100% rename from packages/coding-agent/src/core/frontmatter.ts rename to packages/coding-agent/src/utils/frontmatter.ts diff --git a/packages/coding-agent/src/utils/shell.ts b/packages/coding-agent/src/utils/shell.ts index e16c0e662..a5309ea40 100644 --- a/packages/coding-agent/src/utils/shell.ts +++ b/packages/coding-agent/src/utils/shell.ts @@ -1,7 +1,7 @@ import { constants } from "node:fs"; import { access } from "node:fs/promises"; import { $ } from "bun"; -import { SettingsManager } from "$c/core/settings-manager"; +import { SettingsManager } from "$c/config/settings-manager"; export interface ShellConfig { shell: string; diff --git a/packages/coding-agent/src/core/terminal-notify.ts b/packages/coding-agent/src/utils/terminal-notify.ts similarity index 100% rename from packages/coding-agent/src/core/terminal-notify.ts rename to packages/coding-agent/src/utils/terminal-notify.ts diff --git a/packages/coding-agent/src/core/timings.ts b/packages/coding-agent/src/utils/timings.ts similarity index 100% rename from packages/coding-agent/src/core/timings.ts rename to packages/coding-agent/src/utils/timings.ts diff --git a/packages/coding-agent/src/core/title-generator.ts b/packages/coding-agent/src/utils/title-generator.ts similarity index 95% rename from packages/coding-agent/src/core/title-generator.ts rename to packages/coding-agent/src/utils/title-generator.ts index f422919ba..408e4bcc1 100644 --- a/packages/coding-agent/src/core/title-generator.ts +++ b/packages/coding-agent/src/utils/title-generator.ts @@ -5,10 +5,10 @@ import type { Api, Model } from "@oh-my-pi/pi-ai"; import { completeSimple } from "@oh-my-pi/pi-ai"; import { logger } from "@oh-my-pi/pi-utils"; +import type { ModelRegistry } from "$c/config/model-registry"; +import { parseModelString, SMOL_MODEL_PRIORITY } from "$c/config/model-resolver"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; import titleSystemPrompt from "$c/prompts/system/title-system.md" with { type: "text" }; -import type { ModelRegistry } from "./model-registry"; -import { parseModelString, SMOL_MODEL_PRIORITY } from "./model-resolver"; -import { renderPromptTemplate } from "./prompt-templates"; const TITLE_SYSTEM_PROMPT = renderPromptTemplate(titleSystemPrompt); diff --git a/packages/coding-agent/src/core/utils.ts b/packages/coding-agent/src/utils/utils.ts similarity index 100% rename from packages/coding-agent/src/core/utils.ts rename to packages/coding-agent/src/utils/utils.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/artifacthub.ts b/packages/coding-agent/src/web/scrapers/artifacthub.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/artifacthub.ts rename to packages/coding-agent/src/web/scrapers/artifacthub.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/arxiv.ts b/packages/coding-agent/src/web/scrapers/arxiv.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/arxiv.ts rename to packages/coding-agent/src/web/scrapers/arxiv.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/aur.ts b/packages/coding-agent/src/web/scrapers/aur.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/aur.ts rename to packages/coding-agent/src/web/scrapers/aur.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/biorxiv.ts b/packages/coding-agent/src/web/scrapers/biorxiv.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/biorxiv.ts rename to packages/coding-agent/src/web/scrapers/biorxiv.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/bluesky.ts b/packages/coding-agent/src/web/scrapers/bluesky.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/bluesky.ts rename to packages/coding-agent/src/web/scrapers/bluesky.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/brew.ts b/packages/coding-agent/src/web/scrapers/brew.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/brew.ts rename to packages/coding-agent/src/web/scrapers/brew.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/cheatsh.ts b/packages/coding-agent/src/web/scrapers/cheatsh.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/cheatsh.ts rename to packages/coding-agent/src/web/scrapers/cheatsh.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/chocolatey.ts b/packages/coding-agent/src/web/scrapers/chocolatey.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/chocolatey.ts rename to packages/coding-agent/src/web/scrapers/chocolatey.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/choosealicense.ts b/packages/coding-agent/src/web/scrapers/choosealicense.ts similarity index 98% rename from packages/coding-agent/src/core/tools/web-scrapers/choosealicense.ts rename to packages/coding-agent/src/web/scrapers/choosealicense.ts index d2b665c60..07944af0f 100644 --- a/packages/coding-agent/src/core/tools/web-scrapers/choosealicense.ts +++ b/packages/coding-agent/src/web/scrapers/choosealicense.ts @@ -1,4 +1,4 @@ -import { parseFrontmatter } from "$c/core/frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; import type { RenderResult, SpecialHandler } from "./types"; import { finalizeOutput, loadPage } from "./types"; diff --git a/packages/coding-agent/src/core/tools/web-scrapers/cisa-kev.ts b/packages/coding-agent/src/web/scrapers/cisa-kev.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/cisa-kev.ts rename to packages/coding-agent/src/web/scrapers/cisa-kev.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/clojars.ts b/packages/coding-agent/src/web/scrapers/clojars.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/clojars.ts rename to packages/coding-agent/src/web/scrapers/clojars.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/coingecko.ts b/packages/coding-agent/src/web/scrapers/coingecko.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/coingecko.ts rename to packages/coding-agent/src/web/scrapers/coingecko.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/crates-io.ts b/packages/coding-agent/src/web/scrapers/crates-io.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/crates-io.ts rename to packages/coding-agent/src/web/scrapers/crates-io.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/crossref.ts b/packages/coding-agent/src/web/scrapers/crossref.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/crossref.ts rename to packages/coding-agent/src/web/scrapers/crossref.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/devto.ts b/packages/coding-agent/src/web/scrapers/devto.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/devto.ts rename to packages/coding-agent/src/web/scrapers/devto.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/discogs.ts b/packages/coding-agent/src/web/scrapers/discogs.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/discogs.ts rename to packages/coding-agent/src/web/scrapers/discogs.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/discourse.ts b/packages/coding-agent/src/web/scrapers/discourse.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/discourse.ts rename to packages/coding-agent/src/web/scrapers/discourse.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/dockerhub.ts b/packages/coding-agent/src/web/scrapers/dockerhub.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/dockerhub.ts rename to packages/coding-agent/src/web/scrapers/dockerhub.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/fdroid.ts b/packages/coding-agent/src/web/scrapers/fdroid.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/fdroid.ts rename to packages/coding-agent/src/web/scrapers/fdroid.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/firefox-addons.ts b/packages/coding-agent/src/web/scrapers/firefox-addons.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/firefox-addons.ts rename to packages/coding-agent/src/web/scrapers/firefox-addons.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/flathub.ts b/packages/coding-agent/src/web/scrapers/flathub.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/flathub.ts rename to packages/coding-agent/src/web/scrapers/flathub.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/github-gist.ts b/packages/coding-agent/src/web/scrapers/github-gist.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/github-gist.ts rename to packages/coding-agent/src/web/scrapers/github-gist.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/github.ts b/packages/coding-agent/src/web/scrapers/github.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/github.ts rename to packages/coding-agent/src/web/scrapers/github.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/gitlab.ts b/packages/coding-agent/src/web/scrapers/gitlab.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/gitlab.ts rename to packages/coding-agent/src/web/scrapers/gitlab.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/go-pkg.ts b/packages/coding-agent/src/web/scrapers/go-pkg.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/go-pkg.ts rename to packages/coding-agent/src/web/scrapers/go-pkg.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/hackage.ts b/packages/coding-agent/src/web/scrapers/hackage.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/hackage.ts rename to packages/coding-agent/src/web/scrapers/hackage.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/hackernews.ts b/packages/coding-agent/src/web/scrapers/hackernews.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/hackernews.ts rename to packages/coding-agent/src/web/scrapers/hackernews.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/hex.ts b/packages/coding-agent/src/web/scrapers/hex.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/hex.ts rename to packages/coding-agent/src/web/scrapers/hex.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/huggingface.ts b/packages/coding-agent/src/web/scrapers/huggingface.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/huggingface.ts rename to packages/coding-agent/src/web/scrapers/huggingface.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/iacr.ts b/packages/coding-agent/src/web/scrapers/iacr.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/iacr.ts rename to packages/coding-agent/src/web/scrapers/iacr.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/index.ts b/packages/coding-agent/src/web/scrapers/index.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/index.ts rename to packages/coding-agent/src/web/scrapers/index.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/jetbrains-marketplace.ts b/packages/coding-agent/src/web/scrapers/jetbrains-marketplace.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/jetbrains-marketplace.ts rename to packages/coding-agent/src/web/scrapers/jetbrains-marketplace.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/lemmy.ts b/packages/coding-agent/src/web/scrapers/lemmy.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/lemmy.ts rename to packages/coding-agent/src/web/scrapers/lemmy.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/lobsters.ts b/packages/coding-agent/src/web/scrapers/lobsters.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/lobsters.ts rename to packages/coding-agent/src/web/scrapers/lobsters.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/mastodon.ts b/packages/coding-agent/src/web/scrapers/mastodon.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/mastodon.ts rename to packages/coding-agent/src/web/scrapers/mastodon.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/maven.ts b/packages/coding-agent/src/web/scrapers/maven.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/maven.ts rename to packages/coding-agent/src/web/scrapers/maven.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/mdn.ts b/packages/coding-agent/src/web/scrapers/mdn.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/mdn.ts rename to packages/coding-agent/src/web/scrapers/mdn.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/metacpan.ts b/packages/coding-agent/src/web/scrapers/metacpan.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/metacpan.ts rename to packages/coding-agent/src/web/scrapers/metacpan.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/musicbrainz.ts b/packages/coding-agent/src/web/scrapers/musicbrainz.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/musicbrainz.ts rename to packages/coding-agent/src/web/scrapers/musicbrainz.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/npm.ts b/packages/coding-agent/src/web/scrapers/npm.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/npm.ts rename to packages/coding-agent/src/web/scrapers/npm.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/nuget.ts b/packages/coding-agent/src/web/scrapers/nuget.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/nuget.ts rename to packages/coding-agent/src/web/scrapers/nuget.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/nvd.ts b/packages/coding-agent/src/web/scrapers/nvd.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/nvd.ts rename to packages/coding-agent/src/web/scrapers/nvd.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/ollama.ts b/packages/coding-agent/src/web/scrapers/ollama.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/ollama.ts rename to packages/coding-agent/src/web/scrapers/ollama.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/open-vsx.ts b/packages/coding-agent/src/web/scrapers/open-vsx.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/open-vsx.ts rename to packages/coding-agent/src/web/scrapers/open-vsx.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/opencorporates.ts b/packages/coding-agent/src/web/scrapers/opencorporates.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/opencorporates.ts rename to packages/coding-agent/src/web/scrapers/opencorporates.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/openlibrary.ts b/packages/coding-agent/src/web/scrapers/openlibrary.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/openlibrary.ts rename to packages/coding-agent/src/web/scrapers/openlibrary.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/orcid.ts b/packages/coding-agent/src/web/scrapers/orcid.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/orcid.ts rename to packages/coding-agent/src/web/scrapers/orcid.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/osv.ts b/packages/coding-agent/src/web/scrapers/osv.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/osv.ts rename to packages/coding-agent/src/web/scrapers/osv.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/packagist.ts b/packages/coding-agent/src/web/scrapers/packagist.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/packagist.ts rename to packages/coding-agent/src/web/scrapers/packagist.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/pub-dev.ts b/packages/coding-agent/src/web/scrapers/pub-dev.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/pub-dev.ts rename to packages/coding-agent/src/web/scrapers/pub-dev.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/pubmed.ts b/packages/coding-agent/src/web/scrapers/pubmed.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/pubmed.ts rename to packages/coding-agent/src/web/scrapers/pubmed.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/pypi.ts b/packages/coding-agent/src/web/scrapers/pypi.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/pypi.ts rename to packages/coding-agent/src/web/scrapers/pypi.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/rawg.ts b/packages/coding-agent/src/web/scrapers/rawg.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/rawg.ts rename to packages/coding-agent/src/web/scrapers/rawg.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/readthedocs.ts b/packages/coding-agent/src/web/scrapers/readthedocs.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/readthedocs.ts rename to packages/coding-agent/src/web/scrapers/readthedocs.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/reddit.ts b/packages/coding-agent/src/web/scrapers/reddit.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/reddit.ts rename to packages/coding-agent/src/web/scrapers/reddit.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/repology.ts b/packages/coding-agent/src/web/scrapers/repology.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/repology.ts rename to packages/coding-agent/src/web/scrapers/repology.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/rfc.ts b/packages/coding-agent/src/web/scrapers/rfc.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/rfc.ts rename to packages/coding-agent/src/web/scrapers/rfc.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/rubygems.ts b/packages/coding-agent/src/web/scrapers/rubygems.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/rubygems.ts rename to packages/coding-agent/src/web/scrapers/rubygems.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/searchcode.ts b/packages/coding-agent/src/web/scrapers/searchcode.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/searchcode.ts rename to packages/coding-agent/src/web/scrapers/searchcode.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/sec-edgar.ts b/packages/coding-agent/src/web/scrapers/sec-edgar.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/sec-edgar.ts rename to packages/coding-agent/src/web/scrapers/sec-edgar.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/semantic-scholar.ts b/packages/coding-agent/src/web/scrapers/semantic-scholar.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/semantic-scholar.ts rename to packages/coding-agent/src/web/scrapers/semantic-scholar.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/snapcraft.ts b/packages/coding-agent/src/web/scrapers/snapcraft.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/snapcraft.ts rename to packages/coding-agent/src/web/scrapers/snapcraft.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/sourcegraph.ts b/packages/coding-agent/src/web/scrapers/sourcegraph.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/sourcegraph.ts rename to packages/coding-agent/src/web/scrapers/sourcegraph.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/spdx.ts b/packages/coding-agent/src/web/scrapers/spdx.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/spdx.ts rename to packages/coding-agent/src/web/scrapers/spdx.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/spotify.ts b/packages/coding-agent/src/web/scrapers/spotify.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/spotify.ts rename to packages/coding-agent/src/web/scrapers/spotify.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/stackoverflow.ts b/packages/coding-agent/src/web/scrapers/stackoverflow.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/stackoverflow.ts rename to packages/coding-agent/src/web/scrapers/stackoverflow.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/terraform.ts b/packages/coding-agent/src/web/scrapers/terraform.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/terraform.ts rename to packages/coding-agent/src/web/scrapers/terraform.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/tldr.ts b/packages/coding-agent/src/web/scrapers/tldr.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/tldr.ts rename to packages/coding-agent/src/web/scrapers/tldr.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/twitter.ts b/packages/coding-agent/src/web/scrapers/twitter.ts similarity index 98% rename from packages/coding-agent/src/core/tools/web-scrapers/twitter.ts rename to packages/coding-agent/src/web/scrapers/twitter.ts index af9c4ecaf..c422e6b74 100644 --- a/packages/coding-agent/src/core/tools/web-scrapers/twitter.ts +++ b/packages/coding-agent/src/web/scrapers/twitter.ts @@ -1,5 +1,5 @@ import { parse as parseHtml } from "node-html-parser"; -import { ToolAbortError } from "$c/core/tool-errors"; +import { ToolAbortError } from "$c/tools/tool-errors"; import type { RenderResult, SpecialHandler } from "./types"; import { finalizeOutput, loadPage } from "./types"; diff --git a/packages/coding-agent/src/core/tools/web-scrapers/types.ts b/packages/coding-agent/src/web/scrapers/types.ts similarity index 99% rename from packages/coding-agent/src/core/tools/web-scrapers/types.ts rename to packages/coding-agent/src/web/scrapers/types.ts index f34984429..a298c1ece 100644 --- a/packages/coding-agent/src/core/tools/web-scrapers/types.ts +++ b/packages/coding-agent/src/web/scrapers/types.ts @@ -2,7 +2,7 @@ * Shared types and utilities for web-fetch handlers */ -import { ToolAbortError } from "$c/core/tool-errors"; +import { ToolAbortError } from "$c/tools/tool-errors"; export interface RenderResult { url: string; diff --git a/packages/coding-agent/src/core/tools/web-scrapers/utils.ts b/packages/coding-agent/src/web/scrapers/utils.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/utils.ts rename to packages/coding-agent/src/web/scrapers/utils.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/vimeo.ts b/packages/coding-agent/src/web/scrapers/vimeo.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/vimeo.ts rename to packages/coding-agent/src/web/scrapers/vimeo.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/vscode-marketplace.ts b/packages/coding-agent/src/web/scrapers/vscode-marketplace.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/vscode-marketplace.ts rename to packages/coding-agent/src/web/scrapers/vscode-marketplace.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/w3c.ts b/packages/coding-agent/src/web/scrapers/w3c.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/w3c.ts rename to packages/coding-agent/src/web/scrapers/w3c.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/wikidata.ts b/packages/coding-agent/src/web/scrapers/wikidata.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/wikidata.ts rename to packages/coding-agent/src/web/scrapers/wikidata.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/wikipedia.ts b/packages/coding-agent/src/web/scrapers/wikipedia.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-scrapers/wikipedia.ts rename to packages/coding-agent/src/web/scrapers/wikipedia.ts diff --git a/packages/coding-agent/src/core/tools/web-scrapers/youtube.ts b/packages/coding-agent/src/web/scrapers/youtube.ts similarity index 99% rename from packages/coding-agent/src/core/tools/web-scrapers/youtube.ts rename to packages/coding-agent/src/web/scrapers/youtube.ts index 4a86eabdb..aa310660f 100644 --- a/packages/coding-agent/src/core/tools/web-scrapers/youtube.ts +++ b/packages/coding-agent/src/web/scrapers/youtube.ts @@ -3,7 +3,7 @@ import { tmpdir } from "node:os"; import path from "node:path"; import { cspawn } from "@oh-my-pi/pi-utils"; import { nanoid } from "nanoid"; -import { throwIfAborted } from "$c/core/tool-errors"; +import { throwIfAborted } from "$c/tools/tool-errors"; import { ensureTool } from "$c/utils/tools-manager"; import type { RenderResult, SpecialHandler } from "./types"; import { finalizeOutput } from "./types"; diff --git a/packages/coding-agent/src/core/tools/web-search/auth.ts b/packages/coding-agent/src/web/search/auth.ts similarity index 98% rename from packages/coding-agent/src/core/tools/web-search/auth.ts rename to packages/coding-agent/src/web/search/auth.ts index 0e6772422..385d5bd0d 100644 --- a/packages/coding-agent/src/core/tools/web-search/auth.ts +++ b/packages/coding-agent/src/web/search/auth.ts @@ -13,9 +13,9 @@ import * as path from "node:path"; import { buildAnthropicHeaders as buildProviderAnthropicHeaders } from "@oh-my-pi/pi-ai"; import { logger } from "@oh-my-pi/pi-utils"; import { getAgentDbPath, getConfigDirPaths } from "$c/config"; -import { AgentStorage } from "$c/core/agent-storage"; -import type { AuthCredential, AuthCredentialEntry, AuthStorageData } from "$c/core/auth-storage"; -import { migrateJsonStorage } from "$c/core/storage-migration"; +import { AgentStorage } from "$c/session/agent-storage"; +import type { AuthCredential, AuthCredentialEntry, AuthStorageData } from "$c/session/auth-storage"; +import { migrateJsonStorage } from "$c/session/storage-migration"; import type { AnthropicAuthConfig, AnthropicOAuthCredential, ModelsJson } from "./types"; const DEFAULT_BASE_URL = "https://api.anthropic.com"; diff --git a/packages/coding-agent/src/core/tools/web-search/index.ts b/packages/coding-agent/src/web/search/index.ts similarity index 97% rename from packages/coding-agent/src/core/tools/web-search/index.ts rename to packages/coding-agent/src/web/search/index.ts index 957d4e796..2363dc11a 100644 --- a/packages/coding-agent/src/core/tools/web-search/index.ts +++ b/packages/coding-agent/src/web/search/index.ts @@ -15,21 +15,16 @@ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; import { Type } from "@sinclair/typebox"; -import type { CustomTool, CustomToolContext, RenderResultOptions } from "$c/core/custom-tools/types"; -import { renderPromptTemplate } from "$c/core/prompt-templates"; -import { - callExaTool, - findApiKey as findExaKey, - formatSearchResults, - isSearchResponse, -} from "$c/core/tools/exa/mcp-client"; -import { renderExaCall, renderExaResult } from "$c/core/tools/exa/render"; -import type { ExaRenderDetails } from "$c/core/tools/exa/types"; -import type { ToolSession } from "$c/core/tools/index"; -import { formatAge } from "$c/core/tools/render-utils"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +import { renderPromptTemplate } from "$c/config/prompt-templates"; +import { callExaTool, findApiKey as findExaKey, formatSearchResults, isSearchResponse } from "$c/exa/mcp-client"; +import { renderExaCall, renderExaResult } from "$c/exa/render"; +import type { ExaRenderDetails } from "$c/exa/types"; +import type { CustomTool, CustomToolContext, RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { Theme } from "$c/modes/theme/theme"; import webSearchSystemPrompt from "$c/prompts/system/web-search.md" with { type: "text" }; import webSearchDescription from "$c/prompts/tools/web-search.md" with { type: "text" }; +import type { ToolSession } from "$c/tools/index"; +import { formatAge } from "$c/tools/render-utils"; import { findAnthropicAuth } from "./auth"; import { searchAnthropic } from "./providers/anthropic"; import { searchExa } from "./providers/exa"; diff --git a/packages/coding-agent/src/core/tools/web-search/providers/anthropic.ts b/packages/coding-agent/src/web/search/providers/anthropic.ts similarity index 97% rename from packages/coding-agent/src/core/tools/web-search/providers/anthropic.ts rename to packages/coding-agent/src/web/search/providers/anthropic.ts index 29658d876..259384aae 100644 --- a/packages/coding-agent/src/core/tools/web-search/providers/anthropic.ts +++ b/packages/coding-agent/src/web/search/providers/anthropic.ts @@ -6,7 +6,7 @@ */ import { applyClaudeToolPrefix, buildAnthropicSystemBlocks, stripClaudeToolPrefix } from "@oh-my-pi/pi-ai"; -import { buildAnthropicHeaders, buildAnthropicUrl, findAnthropicAuth, getEnv } from "$c/core/tools/web-search/auth"; +import { buildAnthropicHeaders, buildAnthropicUrl, findAnthropicAuth, getEnv } from "$c/web/search/auth"; import type { AnthropicApiResponse, AnthropicAuthConfig, @@ -14,8 +14,8 @@ import type { WebSearchCitation, WebSearchResponse, WebSearchSource, -} from "$c/core/tools/web-search/types"; -import { WebSearchProviderError } from "$c/core/tools/web-search/types"; +} from "$c/web/search/types"; +import { WebSearchProviderError } from "$c/web/search/types"; const DEFAULT_MODEL = "claude-haiku-4-5"; const DEFAULT_MAX_TOKENS = 4096; diff --git a/packages/coding-agent/src/core/tools/web-search/providers/exa.ts b/packages/coding-agent/src/web/search/providers/exa.ts similarity index 96% rename from packages/coding-agent/src/core/tools/web-search/providers/exa.ts rename to packages/coding-agent/src/web/search/providers/exa.ts index e9fe6c26a..35ce12d0e 100644 --- a/packages/coding-agent/src/core/tools/web-search/providers/exa.ts +++ b/packages/coding-agent/src/web/search/providers/exa.ts @@ -7,8 +7,8 @@ import { existsSync, readFileSync } from "node:fs"; import { homedir } from "node:os"; -import type { WebSearchResponse, WebSearchSource } from "$c/core/tools/web-search/types"; -import { WebSearchProviderError } from "$c/core/tools/web-search/types"; +import type { WebSearchResponse, WebSearchSource } from "$c/web/search/types"; +import { WebSearchProviderError } from "$c/web/search/types"; const EXA_API_URL = "https://api.exa.ai/search"; diff --git a/packages/coding-agent/src/core/tools/web-search/providers/perplexity.ts b/packages/coding-agent/src/web/search/providers/perplexity.ts similarity index 97% rename from packages/coding-agent/src/core/tools/web-search/providers/perplexity.ts rename to packages/coding-agent/src/web/search/providers/perplexity.ts index 907542931..00c7542f0 100644 --- a/packages/coding-agent/src/core/tools/web-search/providers/perplexity.ts +++ b/packages/coding-agent/src/web/search/providers/perplexity.ts @@ -12,8 +12,8 @@ import type { WebSearchCitation, WebSearchResponse, WebSearchSource, -} from "$c/core/tools/web-search/types"; -import { WebSearchProviderError } from "$c/core/tools/web-search/types"; +} from "$c/web/search/types"; +import { WebSearchProviderError } from "$c/web/search/types"; const PERPLEXITY_API_URL = "https://api.perplexity.ai/chat/completions"; diff --git a/packages/coding-agent/src/core/tools/web-search/render.ts b/packages/coding-agent/src/web/search/render.ts similarity index 98% rename from packages/coding-agent/src/core/tools/web-search/render.ts rename to packages/coding-agent/src/web/search/render.ts index c88005ca9..6d2007ad9 100644 --- a/packages/coding-agent/src/core/tools/web-search/render.ts +++ b/packages/coding-agent/src/web/search/render.ts @@ -6,7 +6,8 @@ import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; -import type { RenderResultOptions } from "$c/core/custom-tools/types"; +import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import type { Theme } from "$c/modes/theme/theme"; import { formatAge, formatCount, @@ -18,8 +19,7 @@ import { PREVIEW_LIMITS, TRUNCATE_LENGTHS, truncate, -} from "$c/core/tools/render-utils"; -import type { Theme } from "$c/modes/interactive/theme/theme"; +} from "$c/tools/render-utils"; import type { WebSearchResponse } from "./types"; const MAX_COLLAPSED_ANSWER_LINES = PREVIEW_LIMITS.COLLAPSED_LINES; diff --git a/packages/coding-agent/src/core/tools/web-search/types.ts b/packages/coding-agent/src/web/search/types.ts similarity index 100% rename from packages/coding-agent/src/core/tools/web-search/types.ts rename to packages/coding-agent/src/web/search/types.ts diff --git a/packages/coding-agent/test/agent-session-branching.test.ts b/packages/coding-agent/test/agent-session-branching.test.ts index 62706793a..69b6e521e 100644 --- a/packages/coding-agent/test/agent-session-branching.test.ts +++ b/packages/coding-agent/test/agent-session-branching.test.ts @@ -14,12 +14,12 @@ import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { getModel } from "@oh-my-pi/pi-ai"; import { nanoid } from "nanoid"; -import { AgentSession } from "$c/core/agent-session"; -import { AuthStorage } from "$c/core/auth-storage"; -import { ModelRegistry } from "$c/core/model-registry"; -import { SessionManager } from "$c/core/session-manager"; -import { SettingsManager } from "$c/core/settings-manager"; -import { createTools, type ToolSession } from "$c/core/tools/index"; +import { ModelRegistry } from "$c/config/model-registry"; +import { SettingsManager } from "$c/config/settings-manager"; +import { AgentSession } from "$c/session/agent-session"; +import { AuthStorage } from "$c/session/auth-storage"; +import { SessionManager } from "$c/session/session-manager"; +import { createTools, type ToolSession } from "$c/tools/index"; import { API_KEY } from "./utilities"; describe.skipIf(!API_KEY)("AgentSession branching", () => { diff --git a/packages/coding-agent/test/agent-session-compaction.test.ts b/packages/coding-agent/test/agent-session-compaction.test.ts index 54aa57e8e..ba4be3896 100644 --- a/packages/coding-agent/test/agent-session-compaction.test.ts +++ b/packages/coding-agent/test/agent-session-compaction.test.ts @@ -14,12 +14,12 @@ import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { getModel } from "@oh-my-pi/pi-ai"; import { nanoid } from "nanoid"; -import { AgentSession, type AgentSessionEvent } from "$c/core/agent-session"; -import { AuthStorage } from "$c/core/auth-storage"; -import { ModelRegistry } from "$c/core/model-registry"; -import { SessionManager } from "$c/core/session-manager"; -import { SettingsManager } from "$c/core/settings-manager"; -import { createTools, type ToolSession } from "$c/core/tools/index"; +import { ModelRegistry } from "$c/config/model-registry"; +import { SettingsManager } from "$c/config/settings-manager"; +import { AgentSession, type AgentSessionEvent } from "$c/session/agent-session"; +import { AuthStorage } from "$c/session/auth-storage"; +import { SessionManager } from "$c/session/session-manager"; +import { createTools, type ToolSession } from "$c/tools/index"; import { API_KEY } from "./utilities"; describe.skipIf(!API_KEY)("AgentSession compaction e2e", () => { diff --git a/packages/coding-agent/test/agent-session-concurrent.test.ts b/packages/coding-agent/test/agent-session-concurrent.test.ts index aca7e4ee3..a0abc942e 100644 --- a/packages/coding-agent/test/agent-session-concurrent.test.ts +++ b/packages/coding-agent/test/agent-session-concurrent.test.ts @@ -9,11 +9,11 @@ import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { type AssistantMessage, type AssistantMessageEvent, EventStream, getModel } from "@oh-my-pi/pi-ai"; import { nanoid } from "nanoid"; -import { AgentSession } from "$c/core/agent-session"; -import { AuthStorage } from "$c/core/auth-storage"; -import { ModelRegistry } from "$c/core/model-registry"; -import { SessionManager } from "$c/core/session-manager"; -import { SettingsManager } from "$c/core/settings-manager"; +import { ModelRegistry } from "$c/config/model-registry"; +import { SettingsManager } from "$c/config/settings-manager"; +import { AgentSession } from "$c/session/agent-session"; +import { AuthStorage } from "$c/session/auth-storage"; +import { SessionManager } from "$c/session/session-manager"; // Mock stream that mimics AssistantMessageEventStream class MockAssistantStream extends EventStream { diff --git a/packages/coding-agent/test/block-images.test.ts b/packages/coding-agent/test/block-images.test.ts index 575e616b3..7ca8a44ad 100644 --- a/packages/coding-agent/test/block-images.test.ts +++ b/packages/coding-agent/test/block-images.test.ts @@ -3,9 +3,9 @@ import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { processFileArguments } from "$c/cli/file-processor"; -import { SettingsManager } from "$c/core/settings-manager"; -import type { ToolSession } from "$c/core/tools/index"; -import { ReadTool } from "$c/core/tools/read"; +import { SettingsManager } from "$c/config/settings-manager"; +import type { ToolSession } from "$c/tools/index"; +import { ReadTool } from "$c/tools/read"; // 1x1 red PNG image as base64 (smallest valid PNG) const TINY_PNG_BASE64 = diff --git a/packages/coding-agent/test/compaction-hooks-example.test.ts b/packages/coding-agent/test/compaction-hooks-example.test.ts index 94cb4c0cd..75ffeb4d1 100644 --- a/packages/coding-agent/test/compaction-hooks-example.test.ts +++ b/packages/coding-agent/test/compaction-hooks-example.test.ts @@ -3,7 +3,7 @@ */ import { describe, expect, it } from "bun:test"; -import type { HookAPI, SessionBeforeCompactEvent, SessionCompactEvent } from "$c/core/hooks/index"; +import type { HookAPI, SessionBeforeCompactEvent, SessionCompactEvent } from "$c/extensibility/hooks/index"; describe("Documentation example", () => { it("custom compaction example should type-check correctly", () => { diff --git a/packages/coding-agent/test/compaction-hooks.test.ts b/packages/coding-agent/test/compaction-hooks.test.ts index 711c940b9..b0ae08b86 100644 --- a/packages/coding-agent/test/compaction-hooks.test.ts +++ b/packages/coding-agent/test/compaction-hooks.test.ts @@ -9,20 +9,20 @@ import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { getModel } from "@oh-my-pi/pi-ai"; import { nanoid } from "nanoid"; -import { AgentSession } from "$c/core/agent-session"; -import { AuthStorage } from "$c/core/auth-storage"; +import { ModelRegistry } from "$c/config/model-registry"; +import { SettingsManager } from "$c/config/settings-manager"; import { HookRunner, type LoadedHook, type SessionBeforeCompactEvent, type SessionCompactEvent, type SessionEvent, -} from "$c/core/hooks/index"; -import { ModelRegistry } from "$c/core/model-registry"; -import { SessionManager } from "$c/core/session-manager"; -import { SettingsManager } from "$c/core/settings-manager"; -import { createTools, type ToolSession } from "$c/core/tools/index"; -import { theme } from "$c/modes/interactive/theme/theme"; +} from "$c/extensibility/hooks/index"; +import { theme } from "$c/modes/theme/theme"; +import { AgentSession } from "$c/session/agent-session"; +import { AuthStorage } from "$c/session/auth-storage"; +import { SessionManager } from "$c/session/session-manager"; +import { createTools, type ToolSession } from "$c/tools/index"; const API_KEY = process.env.ANTHROPIC_OAUTH_TOKEN || process.env.ANTHROPIC_API_KEY; diff --git a/packages/coding-agent/test/compaction-thinking-model.test.ts b/packages/coding-agent/test/compaction-thinking-model.test.ts index d840effba..ef2d97d26 100644 --- a/packages/coding-agent/test/compaction-thinking-model.test.ts +++ b/packages/coding-agent/test/compaction-thinking-model.test.ts @@ -15,12 +15,12 @@ import { join } from "node:path"; import { Agent, type ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import { getModel, type Model } from "@oh-my-pi/pi-ai"; import { nanoid } from "nanoid"; -import { AgentSession } from "$c/core/agent-session"; -import { AuthStorage } from "$c/core/auth-storage"; -import { ModelRegistry } from "$c/core/model-registry"; -import { SessionManager } from "$c/core/session-manager"; -import { SettingsManager } from "$c/core/settings-manager"; -import { createTools, type ToolSession } from "$c/core/tools/index"; +import { ModelRegistry } from "$c/config/model-registry"; +import { SettingsManager } from "$c/config/settings-manager"; +import { AgentSession } from "$c/session/agent-session"; +import { AuthStorage } from "$c/session/auth-storage"; +import { SessionManager } from "$c/session/session-manager"; +import { createTools, type ToolSession } from "$c/tools/index"; import { API_KEY } from "./utilities"; // Check for auth diff --git a/packages/coding-agent/test/compaction.test.ts b/packages/coding-agent/test/compaction.test.ts index a3c8b000b..37367dc8d 100644 --- a/packages/coding-agent/test/compaction.test.ts +++ b/packages/coding-agent/test/compaction.test.ts @@ -13,7 +13,7 @@ import { getLastAssistantUsage, prepareCompaction, shouldCompact, -} from "$c/core/compaction/index"; +} from "$c/session/compaction/index"; import { buildSessionContext, type CompactionEntry, @@ -23,7 +23,7 @@ import { type SessionEntry, type SessionMessageEntry, type ThinkingLevelChangeEntry, -} from "$c/core/session-manager"; +} from "$c/session/session-manager"; // ============================================================================ // Test fixtures diff --git a/packages/coding-agent/test/core/apply-patch-adverserial.test.ts b/packages/coding-agent/test/core/apply-patch-adverserial.test.ts index 7d96a39e0..542eb8dde 100644 --- a/packages/coding-agent/test/core/apply-patch-adverserial.test.ts +++ b/packages/coding-agent/test/core/apply-patch-adverserial.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import { mkdirSync, readFileSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { ApplyPatchError, applyPatch } from "$c/core/tools/patch"; +import { ApplyPatchError, applyPatch } from "$c/patch"; describe("applyPatch adversarial inputs", () => { let tempDir: string; diff --git a/packages/coding-agent/test/core/apply-patch-regression.test.ts b/packages/coding-agent/test/core/apply-patch-regression.test.ts index 2f82264f8..3b0643ee3 100644 --- a/packages/coding-agent/test/core/apply-patch-regression.test.ts +++ b/packages/coding-agent/test/core/apply-patch-regression.test.ts @@ -10,7 +10,7 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import { mkdirSync, readFileSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { applyPatch, findContextLine, seekSequence } from "$c/core/tools/patch"; +import { applyPatch, findContextLine, seekSequence } from "$c/patch"; describe("regression: indentation adjustment for line-based replacements (2B)", () => { let tempDir: string; diff --git a/packages/coding-agent/test/core/apply-patch.test.ts b/packages/coding-agent/test/core/apply-patch.test.ts index 631369a29..06444922d 100644 --- a/packages/coding-agent/test/core/apply-patch.test.ts +++ b/packages/coding-agent/test/core/apply-patch.test.ts @@ -2,14 +2,7 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import { cpSync, mkdirSync, readdirSync, readFileSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { - ApplyPatchError, - applyPatch, - ParseError, - type PatchInput, - parseDiffHunks, - seekSequence, -} from "$c/core/tools/patch"; +import { ApplyPatchError, applyPatch, ParseError, type PatchInput, parseDiffHunks, seekSequence } from "$c/patch"; // ═══════════════════════════════════════════════════════════════════════════ // Legacy parser for test fixtures (*** Begin Patch format) diff --git a/packages/coding-agent/test/core/python-executor-display.test.ts b/packages/coding-agent/test/core/python-executor-display.test.ts index 6a9f8305d..e3b593129 100644 --- a/packages/coding-agent/test/core/python-executor-display.test.ts +++ b/packages/coding-agent/test/core/python-executor-display.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/core/python-executor"; -import type { KernelDisplayOutput, KernelExecuteOptions, KernelExecuteResult } from "$c/core/python-kernel"; +import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; +import type { KernelDisplayOutput, KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-executor-lifecycle.test.ts b/packages/coding-agent/test/core/python-executor-lifecycle.test.ts index 918923b8f..5bbaa9f5a 100644 --- a/packages/coding-agent/test/core/python-executor-lifecycle.test.ts +++ b/packages/coding-agent/test/core/python-executor-lifecycle.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { disposeAllKernelSessions, executePython } from "$c/core/python-executor"; -import type { KernelExecuteResult } from "$c/core/python-kernel"; -import * as pythonKernel from "$c/core/python-kernel"; +import { disposeAllKernelSessions, executePython } from "$c/ipy/executor"; +import type { KernelExecuteResult } from "$c/ipy/kernel"; +import * as pythonKernel from "$c/ipy/kernel"; class FakeKernel { execute = vi.fn(async () => this.result); diff --git a/packages/coding-agent/test/core/python-executor-mapping.test.ts b/packages/coding-agent/test/core/python-executor-mapping.test.ts index e9af38413..87101a4f5 100644 --- a/packages/coding-agent/test/core/python-executor-mapping.test.ts +++ b/packages/coding-agent/test/core/python-executor-mapping.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/core/python-executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/core/python-kernel"; +import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; class FakeKernel implements PythonKernelExecutor { constructor( diff --git a/packages/coding-agent/test/core/python-executor-per-call.test.ts b/packages/coding-agent/test/core/python-executor-per-call.test.ts index 853337d06..0caafba5b 100644 --- a/packages/coding-agent/test/core/python-executor-per-call.test.ts +++ b/packages/coding-agent/test/core/python-executor-per-call.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { executePython } from "$c/core/python-executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/core/python-kernel"; -import { PythonKernel } from "$c/core/python-kernel"; +import { executePython } from "$c/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; +import { PythonKernel } from "$c/ipy/kernel"; interface KernelStub { execute: (code: string, options?: KernelExecuteOptions) => Promise; diff --git a/packages/coding-agent/test/core/python-executor-session.test.ts b/packages/coding-agent/test/core/python-executor-session.test.ts index b067d7f42..e0118d381 100644 --- a/packages/coding-agent/test/core/python-executor-session.test.ts +++ b/packages/coding-agent/test/core/python-executor-session.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { disposeAllKernelSessions, executePython } from "$c/core/python-executor"; -import * as pythonKernel from "$c/core/python-kernel"; +import { disposeAllKernelSessions, executePython } from "$c/ipy/executor"; +import * as pythonKernel from "$c/ipy/kernel"; class FakeKernel { executeCalls = 0; diff --git a/packages/coding-agent/test/core/python-executor-streaming.test.ts b/packages/coding-agent/test/core/python-executor-streaming.test.ts index 2380b922c..130c3f432 100644 --- a/packages/coding-agent/test/core/python-executor-streaming.test.ts +++ b/packages/coding-agent/test/core/python-executor-streaming.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/core/python-executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/core/python-kernel"; -import { DEFAULT_MAX_BYTES } from "$c/core/tools/truncate"; +import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; +import { DEFAULT_MAX_BYTES } from "$c/tools/truncate"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-executor-timeout.test.ts b/packages/coding-agent/test/core/python-executor-timeout.test.ts index 6ae6d766a..1ac2f399f 100644 --- a/packages/coding-agent/test/core/python-executor-timeout.test.ts +++ b/packages/coding-agent/test/core/python-executor-timeout.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/core/python-executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/core/python-kernel"; +import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-executor.lifecycle.test.ts b/packages/coding-agent/test/core/python-executor.lifecycle.test.ts index 31c683c64..18f10a9b2 100644 --- a/packages/coding-agent/test/core/python-executor.lifecycle.test.ts +++ b/packages/coding-agent/test/core/python-executor.lifecycle.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { disposeAllKernelSessions, executePython } from "$c/core/python-executor"; -import { type KernelExecuteOptions, type KernelExecuteResult, PythonKernel } from "$c/core/python-kernel"; +import { disposeAllKernelSessions, executePython } from "$c/ipy/executor"; +import { type KernelExecuteOptions, type KernelExecuteResult, PythonKernel } from "$c/ipy/kernel"; process.env.OMP_PYTHON_SKIP_CHECK = "1"; diff --git a/packages/coding-agent/test/core/python-executor.result.test.ts b/packages/coding-agent/test/core/python-executor.result.test.ts index 040f66f5a..032e47d3f 100644 --- a/packages/coding-agent/test/core/python-executor.result.test.ts +++ b/packages/coding-agent/test/core/python-executor.result.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/core/python-executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/core/python-kernel"; +import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-executor.test.ts b/packages/coding-agent/test/core/python-executor.test.ts index 2d5501d28..a74c0e642 100644 --- a/packages/coding-agent/test/core/python-executor.test.ts +++ b/packages/coding-agent/test/core/python-executor.test.ts @@ -8,14 +8,9 @@ import { type PythonKernelExecutor, resetPreludeDocsCache, warmPythonEnvironment, -} from "$c/core/python-executor"; -import { - type KernelExecuteOptions, - type KernelExecuteResult, - type PreludeHelper, - PythonKernel, -} from "$c/core/python-kernel"; -import { DEFAULT_MAX_BYTES } from "$c/core/tools/truncate"; +} from "$c/ipy/executor"; +import { type KernelExecuteOptions, type KernelExecuteResult, type PreludeHelper, PythonKernel } from "$c/ipy/kernel"; +import { DEFAULT_MAX_BYTES } from "$c/tools/truncate"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-kernel-display.test.ts b/packages/coding-agent/test/core/python-kernel-display.test.ts index 4e28df2aa..9cbb9af16 100644 --- a/packages/coding-agent/test/core/python-kernel-display.test.ts +++ b/packages/coding-agent/test/core/python-kernel-display.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type KernelDisplayOutput, PythonKernel } from "$c/core/python-kernel"; +import { type KernelDisplayOutput, PythonKernel } from "$c/ipy/kernel"; const renderDisplay = ( PythonKernel as unknown as { diff --git a/packages/coding-agent/test/core/python-kernel-env.test.ts b/packages/coding-agent/test/core/python-kernel-env.test.ts index 9079e8b7d..77485f1bd 100644 --- a/packages/coding-agent/test/core/python-kernel-env.test.ts +++ b/packages/coding-agent/test/core/python-kernel-env.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { PythonKernel } from "$c/core/python-kernel"; -import { PYTHON_PRELUDE } from "$c/core/python-prelude"; +import { PythonKernel } from "$c/ipy/kernel"; +import { PYTHON_PRELUDE } from "$c/ipy/prelude"; import * as shell from "$c/utils/shell"; import * as shellSnapshot from "$c/utils/shell-snapshot"; diff --git a/packages/coding-agent/test/core/python-kernel-session.test.ts b/packages/coding-agent/test/core/python-kernel-session.test.ts index a2b53c971..b8d691e46 100644 --- a/packages/coding-agent/test/core/python-kernel-session.test.ts +++ b/packages/coding-agent/test/core/python-kernel-session.test.ts @@ -1,8 +1,8 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { disposeAllKernelSessions, executePython } from "$c/core/python-executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/core/python-kernel"; -import { PythonKernel } from "$c/core/python-kernel"; +import { disposeAllKernelSessions, executePython } from "$c/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; +import { PythonKernel } from "$c/ipy/kernel"; class FakeKernel { executeCalls = 0; diff --git a/packages/coding-agent/test/core/python-kernel-ws.test.ts b/packages/coding-agent/test/core/python-kernel-ws.test.ts index 6e54ae527..69c719efc 100644 --- a/packages/coding-agent/test/core/python-kernel-ws.test.ts +++ b/packages/coding-agent/test/core/python-kernel-ws.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { deserializeWebSocketMessage, type JupyterMessage, serializeWebSocketMessage } from "$c/core/python-kernel"; +import { deserializeWebSocketMessage, type JupyterMessage, serializeWebSocketMessage } from "$c/ipy/kernel"; const encoder = new TextEncoder(); diff --git a/packages/coding-agent/test/core/python-kernel.lifecycle.test.ts b/packages/coding-agent/test/core/python-kernel.lifecycle.test.ts index 4139fa1cd..814285e7d 100644 --- a/packages/coding-agent/test/core/python-kernel.lifecycle.test.ts +++ b/packages/coding-agent/test/core/python-kernel.lifecycle.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { rmSync } from "node:fs"; import { createTempDirSync, type SyncTempDir } from "@oh-my-pi/pi-utils"; import type { Subprocess } from "bun"; -import { PythonKernel } from "$c/core/python-kernel"; +import { PythonKernel } from "$c/ipy/kernel"; type SpawnOptions = Parameters[1]; diff --git a/packages/coding-agent/test/core/python-kernel.test.ts b/packages/coding-agent/test/core/python-kernel.test.ts index 7b7494cc6..d67a14a11 100644 --- a/packages/coding-agent/test/core/python-kernel.test.ts +++ b/packages/coding-agent/test/core/python-kernel.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; -import { type KernelDisplayOutput, PythonKernel } from "$c/core/python-kernel"; -import { PYTHON_PRELUDE } from "$c/core/python-prelude"; +import { type KernelDisplayOutput, PythonKernel } from "$c/ipy/kernel"; +import { PYTHON_PRELUDE } from "$c/ipy/prelude"; type JupyterMessage = { channel: string; diff --git a/packages/coding-agent/test/core/python-modules.test.ts b/packages/coding-agent/test/core/python-modules.test.ts index 708861ab3..decb53aae 100644 --- a/packages/coding-agent/test/core/python-modules.test.ts +++ b/packages/coding-agent/test/core/python-modules.test.ts @@ -2,7 +2,7 @@ import { afterEach, describe, expect, it } from "bun:test"; import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { basename, join, resolve } from "node:path"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { discoverPythonModules, loadPythonModules, type PythonModuleExecutor } from "$c/core/python-modules"; +import { discoverPythonModules, loadPythonModules, type PythonModuleExecutor } from "$c/ipy/modules"; const fixturesDir = resolve(import.meta.dir, "../../test/fixtures/python-modules"); diff --git a/packages/coding-agent/test/core/python-prelude.test.ts b/packages/coding-agent/test/core/python-prelude.test.ts index ba661b661..910a7c1ba 100644 --- a/packages/coding-agent/test/core/python-prelude.test.ts +++ b/packages/coding-agent/test/core/python-prelude.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; import { existsSync } from "node:fs"; import { join } from "node:path"; -import { resetPreludeDocsCache, warmPythonEnvironment } from "$c/core/python-executor"; -import { getPythonToolDescription, PythonTool } from "$c/core/tools/python"; +import { resetPreludeDocsCache, warmPythonEnvironment } from "$c/ipy/executor"; +import { getPythonToolDescription, PythonTool } from "$c/tools/python"; const resolvePythonPath = (): string | null => { const venvPath = process.env.VIRTUAL_ENV; diff --git a/packages/coding-agent/test/core/settings-manager-python.test.ts b/packages/coding-agent/test/core/settings-manager-python.test.ts index afa1dc1d1..a6b58b58c 100644 --- a/packages/coding-agent/test/core/settings-manager-python.test.ts +++ b/packages/coding-agent/test/core/settings-manager-python.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { SettingsManager } from "$c/core/settings-manager"; +import { SettingsManager } from "$c/config/settings-manager"; describe("SettingsManager python settings", () => { it("defaults to both and session", () => { diff --git a/packages/coding-agent/test/core/system-prompt.python.test.ts b/packages/coding-agent/test/core/system-prompt.python.test.ts index 285f0fc92..b29b38ae5 100644 --- a/packages/coding-agent/test/core/system-prompt.python.test.ts +++ b/packages/coding-agent/test/core/system-prompt.python.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { buildSystemPrompt } from "$c/core/system-prompt"; +import { buildSystemPrompt } from "$c/system-prompt"; describe("buildSystemPrompt", () => { it("includes python tool details when enabled", async () => { diff --git a/packages/coding-agent/test/discovery/helpers.test.ts b/packages/coding-agent/test/discovery/helpers.test.ts index f7d2bb2db..4ed210665 100644 --- a/packages/coding-agent/test/discovery/helpers.test.ts +++ b/packages/coding-agent/test/discovery/helpers.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { parseFrontmatter } from "$c/core/frontmatter"; +import { parseFrontmatter } from "$c/utils/frontmatter"; describe("parseFrontmatter", () => { const parse = (content: string) => parseFrontmatter(content, { source: "tests:frontmatter", level: "off" }); diff --git a/packages/coding-agent/test/edit-diff.test.ts b/packages/coding-agent/test/edit-diff.test.ts index 1d45a5b94..755b0dea6 100644 --- a/packages/coding-agent/test/edit-diff.test.ts +++ b/packages/coding-agent/test/edit-diff.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { adjustIndentation, DEFAULT_FUZZY_THRESHOLD, findEditMatch } from "$c/core/tools/patch"; +import { adjustIndentation, DEFAULT_FUZZY_THRESHOLD, findEditMatch } from "$c/patch"; describe("findEditMatch", () => { describe("exact matching", () => { diff --git a/packages/coding-agent/test/extensions-discovery.test.ts b/packages/coding-agent/test/extensions-discovery.test.ts index bdc24f6b8..32402a5e2 100644 --- a/packages/coding-agent/test/extensions-discovery.test.ts +++ b/packages/coding-agent/test/extensions-discovery.test.ts @@ -3,7 +3,7 @@ import * as fs from "node:fs"; import * as path from "node:path"; import { fileURLToPath } from "node:url"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { discoverAndLoadExtensions, loadExtensions } from "$c/core/extensions/loader"; +import { discoverAndLoadExtensions, loadExtensions } from "$c/extensibility/extensions/loader"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); diff --git a/packages/coding-agent/test/extensions-runner.test.ts b/packages/coding-agent/test/extensions-runner.test.ts index af4f02e45..b26f2319d 100644 --- a/packages/coding-agent/test/extensions-runner.test.ts +++ b/packages/coding-agent/test/extensions-runner.test.ts @@ -6,11 +6,11 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { mkdirSync, writeFileSync } from "node:fs"; import { join } from "node:path"; import { createTempDirSync, logger } from "@oh-my-pi/pi-utils"; -import { AuthStorage } from "$c/core/auth-storage"; -import { discoverAndLoadExtensions } from "$c/core/extensions/loader"; -import { ExtensionRunner } from "$c/core/extensions/runner"; -import { ModelRegistry } from "$c/core/model-registry"; -import { SessionManager } from "$c/core/session-manager"; +import { ModelRegistry } from "$c/config/model-registry"; +import { discoverAndLoadExtensions } from "$c/extensibility/extensions/loader"; +import { ExtensionRunner } from "$c/extensibility/extensions/runner"; +import { AuthStorage } from "$c/session/auth-storage"; +import { SessionManager } from "$c/session/session-manager"; describe("ExtensionRunner", () => { let tempDir: ReturnType; diff --git a/packages/coding-agent/test/interactive-mode-status.test.ts b/packages/coding-agent/test/interactive-mode-status.test.ts index 566859d3d..2bd83649c 100644 --- a/packages/coding-agent/test/interactive-mode-status.test.ts +++ b/packages/coding-agent/test/interactive-mode-status.test.ts @@ -1,8 +1,8 @@ import { beforeAll, describe, expect, test, vi } from "bun:test"; import { Container } from "@oh-my-pi/pi-tui"; -import { InteractiveMode } from "$c/modes/interactive/interactive-mode"; -import { initTheme } from "$c/modes/interactive/theme/theme"; -import { UiHelpers } from "$c/modes/interactive/utils/ui-helpers"; +import { InteractiveMode } from "$c/modes/interactive-mode"; +import { initTheme } from "$c/modes/theme/theme"; +import { UiHelpers } from "$c/modes/utils/ui-helpers"; function renderLastLine(container: Container, width = 120): string { const last = container.children[container.children.length - 1]; diff --git a/packages/coding-agent/test/model-registry.test.ts b/packages/coding-agent/test/model-registry.test.ts index 4ea780c72..898ecc1fa 100644 --- a/packages/coding-agent/test/model-registry.test.ts +++ b/packages/coding-agent/test/model-registry.test.ts @@ -3,8 +3,8 @@ import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { nanoid } from "nanoid"; -import { AuthStorage } from "$c/core/auth-storage"; -import { ModelRegistry } from "$c/core/model-registry"; +import { ModelRegistry } from "$c/config/model-registry"; +import { AuthStorage } from "$c/session/auth-storage"; describe("ModelRegistry", () => { let tempDir: string; diff --git a/packages/coding-agent/test/model-resolver.test.ts b/packages/coding-agent/test/model-resolver.test.ts index febc6863f..a8a6dc966 100644 --- a/packages/coding-agent/test/model-resolver.test.ts +++ b/packages/coding-agent/test/model-resolver.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; import type { Model } from "@oh-my-pi/pi-ai"; -import { parseModelPattern } from "$c/core/model-resolver"; +import { parseModelPattern } from "$c/config/model-resolver"; // Mock models for testing const mockModels: Model<"anthropic-messages">[] = [ diff --git a/packages/coding-agent/test/prompt-templates.test.ts b/packages/coding-agent/test/prompt-templates.test.ts index 5a4dd32d3..0f9fc5bd3 100644 --- a/packages/coding-agent/test/prompt-templates.test.ts +++ b/packages/coding-agent/test/prompt-templates.test.ts @@ -9,7 +9,7 @@ */ import { describe, expect, test } from "bun:test"; -import { parseCommandArgs, substituteArgs } from "$c/core/prompt-templates"; +import { parseCommandArgs, substituteArgs } from "$c/config/prompt-templates"; // ============================================================================ // substituteArgs diff --git a/packages/coding-agent/test/python-tool-settings.test.ts b/packages/coding-agent/test/python-tool-settings.test.ts index 1a37be042..84731368a 100644 --- a/packages/coding-agent/test/python-tool-settings.test.ts +++ b/packages/coding-agent/test/python-tool-settings.test.ts @@ -2,10 +2,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { mkdirSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import * as pythonExecutor from "$c/core/python-executor"; -import * as pythonKernel from "$c/core/python-kernel"; -import { createTools, type ToolSession } from "$c/core/tools/index"; -import { PythonTool } from "$c/core/tools/python"; +import * as pythonExecutor from "$c/ipy/executor"; +import * as pythonKernel from "$c/ipy/kernel"; +import { createTools, type ToolSession } from "$c/tools/index"; +import { PythonTool } from "$c/tools/python"; function createSettings(overrides?: Partial): ToolSession["settings"] { return { diff --git a/packages/coding-agent/test/sdk-skills.test.ts b/packages/coding-agent/test/sdk-skills.test.ts index f8ca880e5..a901872e3 100644 --- a/packages/coding-agent/test/sdk-skills.test.ts +++ b/packages/coding-agent/test/sdk-skills.test.ts @@ -2,9 +2,9 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import type { Skill } from "$c/core/sdk"; -import { createAgentSession } from "$c/core/sdk"; -import { SessionManager } from "$c/core/session-manager"; +import type { Skill } from "$c/sdk"; +import { createAgentSession } from "$c/sdk"; +import { SessionManager } from "$c/session/session-manager"; describe("createAgentSession skills option", () => { let tempDir: string; diff --git a/packages/coding-agent/test/session-manager/build-context.test.ts b/packages/coding-agent/test/session-manager/build-context.test.ts index 9247685ba..fde13a22b 100644 --- a/packages/coding-agent/test/session-manager/build-context.test.ts +++ b/packages/coding-agent/test/session-manager/build-context.test.ts @@ -7,7 +7,7 @@ import { type SessionEntry, type SessionMessageEntry, type ThinkingLevelChangeEntry, -} from "$c/core/session-manager"; +} from "$c/session/session-manager"; function msg(id: string, parentId: string | null, role: "user" | "assistant", text: string): SessionMessageEntry { const base = { type: "message" as const, id, parentId, timestamp: "2025-01-01T00:00:00Z" }; diff --git a/packages/coding-agent/test/session-manager/file-operations.test.ts b/packages/coding-agent/test/session-manager/file-operations.test.ts index 558849351..522bf059e 100644 --- a/packages/coding-agent/test/session-manager/file-operations.test.ts +++ b/packages/coding-agent/test/session-manager/file-operations.test.ts @@ -3,7 +3,7 @@ import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { nanoid } from "nanoid"; -import { findMostRecentSession, loadEntriesFromFile } from "$c/core/session-manager"; +import { findMostRecentSession, loadEntriesFromFile } from "$c/session/session-manager"; describe("loadEntriesFromFile", () => { let tempDir: string; diff --git a/packages/coding-agent/test/session-manager/labels.test.ts b/packages/coding-agent/test/session-manager/labels.test.ts index f4d900e81..24588ee8a 100644 --- a/packages/coding-agent/test/session-manager/labels.test.ts +++ b/packages/coding-agent/test/session-manager/labels.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type LabelEntry, SessionManager } from "$c/core/session-manager"; +import { type LabelEntry, SessionManager } from "$c/session/session-manager"; describe("SessionManager labels", () => { it("sets and gets labels", () => { diff --git a/packages/coding-agent/test/session-manager/migration.test.ts b/packages/coding-agent/test/session-manager/migration.test.ts index 3ea216fc0..01bbce065 100644 --- a/packages/coding-agent/test/session-manager/migration.test.ts +++ b/packages/coding-agent/test/session-manager/migration.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type FileEntry, migrateSessionEntries } from "$c/core/session-manager"; +import { type FileEntry, migrateSessionEntries } from "$c/session/session-manager"; describe("migrateSessionEntries", () => { it("should add id/parentId to v1 entries", () => { diff --git a/packages/coding-agent/test/session-manager/rewrite-tool-call.test.ts b/packages/coding-agent/test/session-manager/rewrite-tool-call.test.ts index 8cc2f4ca5..50a4aeca9 100644 --- a/packages/coding-agent/test/session-manager/rewrite-tool-call.test.ts +++ b/packages/coding-agent/test/session-manager/rewrite-tool-call.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; import type { AssistantMessage, ToolCall } from "@oh-my-pi/pi-ai"; -import { SessionManager } from "$c/core/session-manager"; +import { SessionManager } from "$c/session/session-manager"; function buildAssistantMessage(content: AssistantMessage["content"]): AssistantMessage { return { diff --git a/packages/coding-agent/test/session-manager/save-entry.test.ts b/packages/coding-agent/test/session-manager/save-entry.test.ts index ef1af6156..6a1d8254f 100644 --- a/packages/coding-agent/test/session-manager/save-entry.test.ts +++ b/packages/coding-agent/test/session-manager/save-entry.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type CustomEntry, SessionManager } from "$c/core/session-manager"; +import { type CustomEntry, SessionManager } from "$c/session/session-manager"; describe("SessionManager.saveCustomEntry", () => { it("saves custom entries and includes them in tree traversal", () => { diff --git a/packages/coding-agent/test/session-manager/tree-traversal.test.ts b/packages/coding-agent/test/session-manager/tree-traversal.test.ts index ac86dd698..502ff7dcb 100644 --- a/packages/coding-agent/test/session-manager/tree-traversal.test.ts +++ b/packages/coding-agent/test/session-manager/tree-traversal.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type CustomEntry, SessionManager } from "$c/core/session-manager"; +import { type CustomEntry, SessionManager } from "$c/session/session-manager"; import { assistantMsg, userMsg } from "../utilities"; describe("SessionManager append and tree traversal", () => { diff --git a/packages/coding-agent/test/settings-manager.test.ts b/packages/coding-agent/test/settings-manager.test.ts index f10f6037a..453dc1745 100644 --- a/packages/coding-agent/test/settings-manager.test.ts +++ b/packages/coding-agent/test/settings-manager.test.ts @@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { existsSync, mkdirSync, rmSync } from "node:fs"; import { join } from "node:path"; import { getAgentDbPath } from "$c/config"; -import { AgentStorage } from "$c/core/agent-storage"; -import { SettingsManager } from "$c/core/settings-manager"; +import { SettingsManager } from "$c/config/settings-manager"; +import { AgentStorage } from "$c/session/agent-storage"; describe("SettingsManager", () => { let testDir: string; diff --git a/packages/coding-agent/test/skills.test.ts b/packages/coding-agent/test/skills.test.ts index 709cd922d..ab1adcc98 100644 --- a/packages/coding-agent/test/skills.test.ts +++ b/packages/coding-agent/test/skills.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; import { homedir } from "node:os"; import { join, resolve } from "node:path"; -import { loadSkills, loadSkillsFromDir, type Skill } from "$c/core/skills"; +import { loadSkills, loadSkillsFromDir, type Skill } from "$c/extensibility/skills"; const fixturesDir = resolve(__dirname, "fixtures/skills"); const collisionFixturesDir = resolve(__dirname, "fixtures/skills-collision"); diff --git a/packages/coding-agent/test/streaming-edit-abort.test.ts b/packages/coding-agent/test/streaming-edit-abort.test.ts index ed6ccce1a..cbc5e6bee 100644 --- a/packages/coding-agent/test/streaming-edit-abort.test.ts +++ b/packages/coding-agent/test/streaming-edit-abort.test.ts @@ -17,11 +17,11 @@ import { } from "@oh-my-pi/pi-ai"; import { Type } from "@sinclair/typebox"; import { nanoid } from "nanoid"; -import { AgentSession } from "$c/core/agent-session"; -import { AuthStorage } from "$c/core/auth-storage"; -import { ModelRegistry } from "$c/core/model-registry"; -import { SessionManager } from "$c/core/session-manager"; -import { SettingsManager } from "$c/core/settings-manager"; +import { ModelRegistry } from "$c/config/model-registry"; +import { SettingsManager } from "$c/config/settings-manager"; +import { AgentSession } from "$c/session/agent-session"; +import { AuthStorage } from "$c/session/auth-storage"; +import { SessionManager } from "$c/session/session-manager"; class MockAssistantStream extends EventStream { constructor() { diff --git a/packages/coding-agent/test/streaming-render-debug.ts b/packages/coding-agent/test/streaming-render-debug.ts index 6cc2d0f06..b7cca3ae9 100644 --- a/packages/coding-agent/test/streaming-render-debug.ts +++ b/packages/coding-agent/test/streaming-render-debug.ts @@ -9,8 +9,8 @@ import { join } from "node:path"; import type { AssistantMessage } from "@oh-my-pi/pi-ai"; import { ProcessTerminal, TUI } from "@oh-my-pi/pi-tui"; import { sleep } from "bun"; -import { AssistantMessageComponent } from "$c/modes/interactive/components/assistant-message"; -import { initTheme } from "$c/modes/interactive/theme/theme"; +import { AssistantMessageComponent } from "$c/modes/components/assistant-message"; +import { initTheme } from "$c/modes/theme/theme"; // Initialize dark theme with full color support process.env.COLORTERM = "truecolor"; diff --git a/packages/coding-agent/test/system-prompt.test.ts b/packages/coding-agent/test/system-prompt.test.ts index dfe62f8a8..813292634 100644 --- a/packages/coding-agent/test/system-prompt.test.ts +++ b/packages/coding-agent/test/system-prompt.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { buildSystemPrompt } from "$c/core/system-prompt"; +import { buildSystemPrompt } from "$c/system-prompt"; describe("buildSystemPrompt", () => { describe("empty tools", () => { diff --git a/packages/coding-agent/test/test-theme-colors.ts b/packages/coding-agent/test/test-theme-colors.ts index cbd8f8e64..6f1238612 100644 --- a/packages/coding-agent/test/test-theme-colors.ts +++ b/packages/coding-agent/test/test-theme-colors.ts @@ -1,4 +1,4 @@ -import { initTheme, theme } from "$c/modes/interactive/theme/theme"; +import { initTheme, theme } from "$c/modes/theme/theme"; // Initialize with dark theme explicitly process.env.COLORTERM = "truecolor"; diff --git a/packages/coding-agent/test/tools.test.ts b/packages/coding-agent/test/tools.test.ts index 1804cdec5..a6350c9c0 100644 --- a/packages/coding-agent/test/tools.test.ts +++ b/packages/coding-agent/test/tools.test.ts @@ -3,14 +3,14 @@ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { nanoid } from "nanoid"; -import { BashTool } from "$c/core/tools/bash"; -import { FindTool } from "$c/core/tools/find"; -import { GrepTool } from "$c/core/tools/grep"; -import type { ToolSession } from "$c/core/tools/index"; -import { LsTool } from "$c/core/tools/ls"; -import { EditTool } from "$c/core/tools/patch"; -import { ReadTool } from "$c/core/tools/read"; -import { WriteTool } from "$c/core/tools/write"; +import { EditTool } from "$c/patch"; +import { BashTool } from "$c/tools/bash"; +import { FindTool } from "$c/tools/find"; +import { GrepTool } from "$c/tools/grep"; +import type { ToolSession } from "$c/tools/index"; +import { LsTool } from "$c/tools/ls"; +import { ReadTool } from "$c/tools/read"; +import { WriteTool } from "$c/tools/write"; import * as shellModule from "$c/utils/shell"; // Helper to extract text from content blocks diff --git a/packages/coding-agent/test/tools/index.test.ts b/packages/coding-agent/test/tools/index.test.ts index 772ee30dc..2edcf0760 100644 --- a/packages/coding-agent/test/tools/index.test.ts +++ b/packages/coding-agent/test/tools/index.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "$c/core/tools/index"; +import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "$c/tools/index"; process.env.OMP_PYTHON_SKIP_CHECK = "1"; diff --git a/packages/coding-agent/test/tools/lsp-batching.test.ts b/packages/coding-agent/test/tools/lsp-batching.test.ts index 47caa8e92..9461c71b1 100644 --- a/packages/coding-agent/test/tools/lsp-batching.test.ts +++ b/packages/coding-agent/test/tools/lsp-batching.test.ts @@ -1,8 +1,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { join } from "node:path"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import * as lspConfig from "$c/core/tools/lsp/config"; -import { createLspWritethrough } from "$c/core/tools/lsp/index"; +import * as lspConfig from "$c/lsp/config"; +import { createLspWritethrough } from "$c/lsp/index"; describe("createLspWritethrough batching", () => { let tempDir: ReturnType; diff --git a/packages/coding-agent/test/tools/python-execution.test.ts b/packages/coding-agent/test/tools/python-execution.test.ts index d864c27a2..34fccd756 100644 --- a/packages/coding-agent/test/tools/python-execution.test.ts +++ b/packages/coding-agent/test/tools/python-execution.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it, vi } from "bun:test"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import * as pythonExecutor from "$c/core/python-executor"; -import type { ToolSession } from "$c/core/tools/index"; -import { PythonTool } from "$c/core/tools/python"; +import * as pythonExecutor from "$c/ipy/executor"; +import type { ToolSession } from "$c/tools/index"; +import { PythonTool } from "$c/tools/python"; function createSession(cwd: string): ToolSession { return { diff --git a/packages/coding-agent/test/tools/python-fallback.test.ts b/packages/coding-agent/test/tools/python-fallback.test.ts index 68a1eda9a..a9618e3b1 100644 --- a/packages/coding-agent/test/tools/python-fallback.test.ts +++ b/packages/coding-agent/test/tools/python-fallback.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from "bun:test"; -import * as pythonKernelModule from "$c/core/python-kernel"; -import type { ToolSession } from "$c/core/tools/index"; -import { createTools } from "$c/core/tools/index"; +import * as pythonKernelModule from "$c/ipy/kernel"; +import type { ToolSession } from "$c/tools/index"; +import { createTools } from "$c/tools/index"; function createTestSession(overrides: Partial = {}): ToolSession { return { diff --git a/packages/coding-agent/test/tools/python-renderer.test.ts b/packages/coding-agent/test/tools/python-renderer.test.ts index 60d903c92..fd23ed65d 100644 --- a/packages/coding-agent/test/tools/python-renderer.test.ts +++ b/packages/coding-agent/test/tools/python-renderer.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; import stripAnsi from "strip-ansi"; -import { pythonToolRenderer } from "$c/core/tools/python"; -import { getThemeByName } from "$c/modes/interactive/theme/theme"; +import { getThemeByName } from "$c/modes/theme/theme"; +import { pythonToolRenderer } from "$c/tools/python"; describe("pythonToolRenderer", () => { it("renders truncated output when collapsed and full output when expanded", () => { diff --git a/packages/coding-agent/test/tools/python-tool-mode.test.ts b/packages/coding-agent/test/tools/python-tool-mode.test.ts index 42c569cd8..ad110afc5 100644 --- a/packages/coding-agent/test/tools/python-tool-mode.test.ts +++ b/packages/coding-agent/test/tools/python-tool-mode.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { createTools, type ToolSession } from "$c/core/tools/index"; +import { createTools, type ToolSession } from "$c/tools/index"; function createSession(overrides: Partial = {}): ToolSession { return { diff --git a/packages/coding-agent/test/tools/python.test.ts b/packages/coding-agent/test/tools/python.test.ts index ab9c0ec06..975a4a26b 100644 --- a/packages/coding-agent/test/tools/python.test.ts +++ b/packages/coding-agent/test/tools/python.test.ts @@ -1,8 +1,8 @@ import { afterAll, beforeAll, describe, expect, it, vi } from "bun:test"; import { createTempDirSync, type SyncTempDir } from "@oh-my-pi/pi-utils"; -import * as pythonExecutor from "$c/core/python-executor"; -import { createTools, type ToolSession } from "$c/core/tools/index"; -import { PythonTool } from "$c/core/tools/python"; +import * as pythonExecutor from "$c/ipy/executor"; +import { createTools, type ToolSession } from "$c/tools/index"; +import { PythonTool } from "$c/tools/python"; let previousSkipCheck: string | undefined; let tempDir: SyncTempDir; diff --git a/packages/coding-agent/test/tools/schema-validation.test.ts b/packages/coding-agent/test/tools/schema-validation.test.ts index f85294ee7..bbcdd5522 100644 --- a/packages/coding-agent/test/tools/schema-validation.test.ts +++ b/packages/coding-agent/test/tools/schema-validation.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; import { sanitizeSchemaForGoogle } from "@oh-my-pi/pi-ai"; -import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "$c/core/tools/index"; +import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "$c/tools/index"; /** * Problematic JSON Schema features that cause issues with various providers. diff --git a/packages/coding-agent/test/tools/task-template.test.ts b/packages/coding-agent/test/tools/task-template.test.ts index a24ab94d2..07578f39e 100644 --- a/packages/coding-agent/test/tools/task-template.test.ts +++ b/packages/coding-agent/test/tools/task-template.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { renderTemplate } from "$c/core/tools/task/template"; +import { renderTemplate } from "$c/task/template"; describe("renderTemplate", () => { test("renders explicit args", () => { diff --git a/packages/coding-agent/test/tools/web-scrapers/academic.test.ts b/packages/coding-agent/test/tools/web-scrapers/academic.test.ts index 6f54c23dd..cde10147c 100644 --- a/packages/coding-agent/test/tools/web-scrapers/academic.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/academic.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; -import { handleArxiv } from "$c/core/tools/web-scrapers/arxiv"; -import { handleIacr } from "$c/core/tools/web-scrapers/iacr"; -import { handlePubMed } from "$c/core/tools/web-scrapers/pubmed"; -import { handleSemanticScholar } from "$c/core/tools/web-scrapers/semantic-scholar"; +import { handleArxiv } from "$c/web/scrapers/arxiv"; +import { handleIacr } from "$c/web/scrapers/iacr"; +import { handlePubMed } from "$c/web/scrapers/pubmed"; +import { handleSemanticScholar } from "$c/web/scrapers/semantic-scholar"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/business.test.ts b/packages/coding-agent/test/tools/web-scrapers/business.test.ts index 7089c0c5e..183c904d2 100644 --- a/packages/coding-agent/test/tools/web-scrapers/business.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/business.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleOpenCorporates } from "$c/core/tools/web-scrapers/opencorporates"; -import { handleSecEdgar } from "$c/core/tools/web-scrapers/sec-edgar"; +import { handleOpenCorporates } from "$c/web/scrapers/opencorporates"; +import { handleSecEdgar } from "$c/web/scrapers/sec-edgar"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/dev-platforms.test.ts b/packages/coding-agent/test/tools/web-scrapers/dev-platforms.test.ts index b3877431a..4061cb8a1 100644 --- a/packages/coding-agent/test/tools/web-scrapers/dev-platforms.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/dev-platforms.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; -import { handleDevTo } from "$c/core/tools/web-scrapers/devto"; -import { handleGitLab } from "$c/core/tools/web-scrapers/gitlab"; -import { handleHackerNews } from "$c/core/tools/web-scrapers/hackernews"; -import { handleLobsters } from "$c/core/tools/web-scrapers/lobsters"; +import { handleDevTo } from "$c/web/scrapers/devto"; +import { handleGitLab } from "$c/web/scrapers/gitlab"; +import { handleHackerNews } from "$c/web/scrapers/hackernews"; +import { handleLobsters } from "$c/web/scrapers/lobsters"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/documentation.test.ts b/packages/coding-agent/test/tools/web-scrapers/documentation.test.ts index 59353906f..8d0541050 100644 --- a/packages/coding-agent/test/tools/web-scrapers/documentation.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/documentation.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleMDN } from "$c/core/tools/web-scrapers/mdn"; -import { handleReadTheDocs } from "$c/core/tools/web-scrapers/readthedocs"; +import { handleMDN } from "$c/web/scrapers/mdn"; +import { handleReadTheDocs } from "$c/web/scrapers/readthedocs"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/finance-media.test.ts b/packages/coding-agent/test/tools/web-scrapers/finance-media.test.ts index 76c6dc585..51fce596c 100644 --- a/packages/coding-agent/test/tools/web-scrapers/finance-media.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/finance-media.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleArtifactHub } from "$c/core/tools/web-scrapers/artifacthub"; -import { handleCoinGecko } from "$c/core/tools/web-scrapers/coingecko"; -import { handleDiscogs } from "$c/core/tools/web-scrapers/discogs"; +import { handleArtifactHub } from "$c/web/scrapers/artifacthub"; +import { handleCoinGecko } from "$c/web/scrapers/coingecko"; +import { handleDiscogs } from "$c/web/scrapers/discogs"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/git-hosting.test.ts b/packages/coding-agent/test/tools/web-scrapers/git-hosting.test.ts index ba0ca683d..5755c4cb6 100644 --- a/packages/coding-agent/test/tools/web-scrapers/git-hosting.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/git-hosting.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleGitHub } from "$c/core/tools/web-scrapers/github"; -import { handleGitHubGist } from "$c/core/tools/web-scrapers/github-gist"; +import { handleGitHub } from "$c/web/scrapers/github"; +import { handleGitHubGist } from "$c/web/scrapers/github-gist"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/media.test.ts b/packages/coding-agent/test/tools/web-scrapers/media.test.ts index a41af3b76..426f6c56e 100644 --- a/packages/coding-agent/test/tools/web-scrapers/media.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/media.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleHuggingFace } from "$c/core/tools/web-scrapers/huggingface"; -import { handleSpotify } from "$c/core/tools/web-scrapers/spotify"; -import { handleVimeo } from "$c/core/tools/web-scrapers/vimeo"; +import { handleHuggingFace } from "$c/web/scrapers/huggingface"; +import { handleSpotify } from "$c/web/scrapers/spotify"; +import { handleVimeo } from "$c/web/scrapers/vimeo"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/package-managers-2.test.ts b/packages/coding-agent/test/tools/web-scrapers/package-managers-2.test.ts index e88e5b5f7..f27ac23dd 100644 --- a/packages/coding-agent/test/tools/web-scrapers/package-managers-2.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/package-managers-2.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from "bun:test"; -import { handleChocolatey } from "$c/core/tools/web-scrapers/chocolatey"; -import { handleDockerHub } from "$c/core/tools/web-scrapers/dockerhub"; -import { handleHackage } from "$c/core/tools/web-scrapers/hackage"; -import { handleMetaCPAN } from "$c/core/tools/web-scrapers/metacpan"; -import { handleRepology } from "$c/core/tools/web-scrapers/repology"; -import { handleTerraform } from "$c/core/tools/web-scrapers/terraform"; +import { handleChocolatey } from "$c/web/scrapers/chocolatey"; +import { handleDockerHub } from "$c/web/scrapers/dockerhub"; +import { handleHackage } from "$c/web/scrapers/hackage"; +import { handleMetaCPAN } from "$c/web/scrapers/metacpan"; +import { handleRepology } from "$c/web/scrapers/repology"; +import { handleTerraform } from "$c/web/scrapers/terraform"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/package-managers.test.ts b/packages/coding-agent/test/tools/web-scrapers/package-managers.test.ts index 40527a732..3da5c6f5a 100644 --- a/packages/coding-agent/test/tools/web-scrapers/package-managers.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/package-managers.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from "bun:test"; -import { handleAur } from "$c/core/tools/web-scrapers/aur"; -import { handleBrew } from "$c/core/tools/web-scrapers/brew"; -import { handleMaven } from "$c/core/tools/web-scrapers/maven"; -import { handleNuGet } from "$c/core/tools/web-scrapers/nuget"; -import { handlePackagist } from "$c/core/tools/web-scrapers/packagist"; -import { handleRubyGems } from "$c/core/tools/web-scrapers/rubygems"; +import { handleAur } from "$c/web/scrapers/aur"; +import { handleBrew } from "$c/web/scrapers/brew"; +import { handleMaven } from "$c/web/scrapers/maven"; +import { handleNuGet } from "$c/web/scrapers/nuget"; +import { handlePackagist } from "$c/web/scrapers/packagist"; +import { handleRubyGems } from "$c/web/scrapers/rubygems"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/package-registries.test.ts b/packages/coding-agent/test/tools/web-scrapers/package-registries.test.ts index e81ce20c4..ae1f8564e 100644 --- a/packages/coding-agent/test/tools/web-scrapers/package-registries.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/package-registries.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from "bun:test"; -import { handleCratesIo } from "$c/core/tools/web-scrapers/crates-io"; -import { handleGoPkg } from "$c/core/tools/web-scrapers/go-pkg"; -import { handleHex } from "$c/core/tools/web-scrapers/hex"; -import { handleNpm } from "$c/core/tools/web-scrapers/npm"; -import { handlePubDev } from "$c/core/tools/web-scrapers/pub-dev"; -import { handlePyPI } from "$c/core/tools/web-scrapers/pypi"; +import { handleCratesIo } from "$c/web/scrapers/crates-io"; +import { handleGoPkg } from "$c/web/scrapers/go-pkg"; +import { handleHex } from "$c/web/scrapers/hex"; +import { handleNpm } from "$c/web/scrapers/npm"; +import { handlePubDev } from "$c/web/scrapers/pub-dev"; +import { handlePyPI } from "$c/web/scrapers/pypi"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/research.test.ts b/packages/coding-agent/test/tools/web-scrapers/research.test.ts index 9fed4ebd8..2df1cbdda 100644 --- a/packages/coding-agent/test/tools/web-scrapers/research.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/research.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleBiorxiv } from "$c/core/tools/web-scrapers/biorxiv"; -import { handleOpenLibrary } from "$c/core/tools/web-scrapers/openlibrary"; -import { handleWikidata } from "$c/core/tools/web-scrapers/wikidata"; +import { handleBiorxiv } from "$c/web/scrapers/biorxiv"; +import { handleOpenLibrary } from "$c/web/scrapers/openlibrary"; +import { handleWikidata } from "$c/web/scrapers/wikidata"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/security.test.ts b/packages/coding-agent/test/tools/web-scrapers/security.test.ts index 5559553a4..3d61756bd 100644 --- a/packages/coding-agent/test/tools/web-scrapers/security.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/security.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleNvd } from "$c/core/tools/web-scrapers/nvd"; -import { handleOsv } from "$c/core/tools/web-scrapers/osv"; +import { handleNvd } from "$c/web/scrapers/nvd"; +import { handleOsv } from "$c/web/scrapers/osv"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/social-extended.test.ts b/packages/coding-agent/test/tools/web-scrapers/social-extended.test.ts index a476c3477..e66a240f8 100644 --- a/packages/coding-agent/test/tools/web-scrapers/social-extended.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/social-extended.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleBluesky } from "$c/core/tools/web-scrapers/bluesky"; -import { handleMastodon } from "$c/core/tools/web-scrapers/mastodon"; +import { handleBluesky } from "$c/web/scrapers/bluesky"; +import { handleMastodon } from "$c/web/scrapers/mastodon"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/social.test.ts b/packages/coding-agent/test/tools/web-scrapers/social.test.ts index cbf257b04..7b8067f4e 100644 --- a/packages/coding-agent/test/tools/web-scrapers/social.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/social.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleReddit } from "$c/core/tools/web-scrapers/reddit"; -import { handleStackOverflow } from "$c/core/tools/web-scrapers/stackoverflow"; -import { handleTwitter } from "$c/core/tools/web-scrapers/twitter"; +import { handleReddit } from "$c/web/scrapers/reddit"; +import { handleStackOverflow } from "$c/web/scrapers/stackoverflow"; +import { handleTwitter } from "$c/web/scrapers/twitter"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/stackexchange.test.ts b/packages/coding-agent/test/tools/web-scrapers/stackexchange.test.ts index 0ea8347fa..9351b2fc7 100644 --- a/packages/coding-agent/test/tools/web-scrapers/stackexchange.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/stackexchange.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { handleStackOverflow } from "$c/core/tools/web-scrapers/stackoverflow"; +import { handleStackOverflow } from "$c/web/scrapers/stackoverflow"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/standards.test.ts b/packages/coding-agent/test/tools/web-scrapers/standards.test.ts index c60b17c96..523799acb 100644 --- a/packages/coding-agent/test/tools/web-scrapers/standards.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/standards.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleCheatSh } from "$c/core/tools/web-scrapers/cheatsh"; -import { handleRfc } from "$c/core/tools/web-scrapers/rfc"; -import { handleTldr } from "$c/core/tools/web-scrapers/tldr"; +import { handleCheatSh } from "$c/web/scrapers/cheatsh"; +import { handleRfc } from "$c/web/scrapers/rfc"; +import { handleTldr } from "$c/web/scrapers/tldr"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/wikipedia.test.ts b/packages/coding-agent/test/tools/web-scrapers/wikipedia.test.ts index 2672ce91f..96f5ce891 100644 --- a/packages/coding-agent/test/tools/web-scrapers/wikipedia.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/wikipedia.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { handleWikipedia } from "$c/core/tools/web-scrapers/wikipedia"; +import { handleWikipedia } from "$c/web/scrapers/wikipedia"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/youtube.test.ts b/packages/coding-agent/test/tools/web-scrapers/youtube.test.ts index 49e7773fe..a98f342ce 100644 --- a/packages/coding-agent/test/tools/web-scrapers/youtube.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/youtube.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { handleYouTube } from "$c/core/tools/web-scrapers/youtube"; +import { handleYouTube } from "$c/web/scrapers/youtube"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/utilities.ts b/packages/coding-agent/test/utilities.ts index fa2d77091..7966db5be 100644 --- a/packages/coding-agent/test/utilities.ts +++ b/packages/coding-agent/test/utilities.ts @@ -8,12 +8,12 @@ import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { getModel } from "@oh-my-pi/pi-ai"; import { nanoid } from "nanoid"; -import { AgentSession } from "$c/core/agent-session"; -import { AuthStorage } from "$c/core/auth-storage"; -import { ModelRegistry } from "$c/core/model-registry"; -import { SessionManager } from "$c/core/session-manager"; -import { SettingsManager } from "$c/core/settings-manager"; -import { createTools, type ToolSession } from "$c/core/tools/index"; +import { ModelRegistry } from "$c/config/model-registry"; +import { SettingsManager } from "$c/config/settings-manager"; +import { AgentSession } from "$c/session/agent-session"; +import { AuthStorage } from "$c/session/auth-storage"; +import { SessionManager } from "$c/session/session-manager"; +import { createTools, type ToolSession } from "$c/tools/index"; /** * API key for authenticated tests. Tests using this should be wrapped in