From 9d457f73d9918a5a2551076b0ab47a903f10c63f Mon Sep 17 00:00:00 2001 From: can1357 Date: Mon, 8 Jun 2026 18:53:15 +0200 Subject: [PATCH] test: migrated test imports to package subpath exports - Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths. --- crates/pi-natives/src/ast.rs | 11 +- crates/pi-shell/src/shell.rs | 3 +- .../agent/test/append-only-context.test.ts | 4 +- packages/agent/test/harmony-leak.test.ts | 6 +- packages/agent/test/yield.test.ts | 2 +- packages/ai/CHANGELOG.md | 6 +- packages/ai/test/abort-source-tracker.test.ts | 2 +- packages/ai/test/abortable-iterator.test.ts | 2 +- packages/ai/test/anthropic-client.test.ts | 4 +- .../test/anthropic-many-image-resize.test.ts | 4 +- packages/ai/test/anthropic-oauth.test.ts | 8 +- .../ai/test/anthropic-stream-envelope.test.ts | 6 +- .../ai/test/anthropic-stream-timeout.test.ts | 6 +- packages/ai/test/api-registry.test.ts | 4 +- .../ai/test/auth-broker-refresher.test.ts | 4 +- .../ai/test/auth-broker-remote-store.test.ts | 2 +- .../test/auth-broker-snapshot-cache.test.ts | 2 +- packages/ai/test/auth-broker-wire.test.ts | 4 +- .../auth-gateway-anthropic-messages.test.ts | 6 +- .../ai/test/auth-gateway-cache-key.test.ts | 2 +- .../test/auth-gateway-classify-error.test.ts | 2 +- .../ai/test/auth-gateway-openai-chat.test.ts | 4 +- .../auth-gateway-openai-responses.test.ts | 8 +- .../ai/test/auth-gateway-pi-native.test.ts | 6 +- .../test/auth-storage-api-key-login.test.ts | 8 +- .../auth-storage-broker-no-sentinel.test.ts | 4 +- .../auth-storage-check-credentials.test.ts | 4 +- .../test/auth-storage-codex-selection.test.ts | 8 +- .../test/auth-storage-config-override.test.ts | 2 +- ...-storage-credential-disabled-event.test.ts | 4 +- .../auth-storage-credential-origin.test.ts | 2 +- .../ai/test/auth-storage-email-dedupe.test.ts | 2 +- .../auth-storage-force-refresh-rotate.test.ts | 4 +- .../auth-storage-oauth-refresh-race.test.ts | 4 +- .../ai/test/auth-storage-refresh-skew.test.ts | 4 +- .../ai/test/auth-storage-usage-cache.test.ts | 6 +- packages/ai/test/aws-credentials.test.ts | 2 +- packages/ai/test/aws-eventstream.test.ts | 2 +- packages/ai/test/aws-sigv4.test.ts | 2 +- .../azure-openai-responses-stream.test.ts | 7 +- .../test/callback-server-manual-input.test.ts | 4 +- .../ai/test/claude-ratelimit-headers.test.ts | 4 +- packages/ai/test/claude-usage-headers.test.ts | 4 +- packages/ai/test/claude-usage-retry.test.ts | 4 +- packages/ai/test/cursor-exec-handlers.test.ts | 6 +- .../test/deepseek-reasoning-content.test.ts | 6 +- packages/ai/test/event-stream.test.ts | 4 +- packages/ai/test/firepass.live.ts | 6 +- packages/ai/test/firepass.test.ts | 6 +- .../github-copilot-anthropic-auth.test.ts | 8 +- packages/ai/test/github-copilot-error.test.ts | 2 +- .../ai/test/github-copilot-headers.test.ts | 6 +- packages/ai/test/github-copilot-login.test.ts | 2 +- .../test/github-copilot-model-limits.test.ts | 8 +- packages/ai/test/github-copilot-oauth.test.ts | 2 +- .../github-copilot-openai-base-url.test.ts | 8 +- .../ai/test/github-copilot-reasoning.test.ts | 10 +- .../ai/test/google-antigravity-usage.test.ts | 4 +- .../google-gemini-cli-3x-thinking.test.ts | 4 +- .../test/google-gemini-cli-alignment.test.ts | 10 +- packages/ai/test/google-tool-choice.test.ts | 4 +- .../ai/test/google-vertex-discovery.test.ts | 6 +- packages/ai/test/issue-1203-repro.test.ts | 6 +- packages/ai/test/issue-1270-repro.test.ts | 6 +- packages/ai/test/issue-1373-repro.test.ts | 6 +- packages/ai/test/issue-1399-repro.test.ts | 6 +- packages/ai/test/issue-1417-repro.test.ts | 6 +- packages/ai/test/issue-1617-repro.test.ts | 2 +- packages/ai/test/issue-1776-repro.test.ts | 6 +- packages/ai/test/issue-1838-repro.test.ts | 6 +- packages/ai/test/issue-1846-repro.test.ts | 10 +- packages/ai/test/issue-1849-repro.test.ts | 4 +- packages/ai/test/issue-2080-repro.test.ts | 6 +- packages/ai/test/issue-772-repro.test.ts | 5 +- packages/ai/test/issue-826-repro.test.ts | 6 +- packages/ai/test/issue-830-repro.test.ts | 10 +- packages/ai/test/issue-847-repro.test.ts | 2 +- packages/ai/test/issue-883-repro.test.ts | 6 +- packages/ai/test/issue-887-repro.test.ts | 2 +- packages/ai/test/issue-911-repro.test.ts | 6 +- packages/ai/test/issue-957-repro.test.ts | 4 +- packages/ai/test/issue-959-repro.test.ts | 6 +- .../ai/test/issue-967-vision-guard.test.ts | 16 +- packages/ai/test/issue-969-repro.test.ts | 8 +- packages/ai/test/issue-976-repro.test.ts | 4 +- packages/ai/test/kagi-login.test.ts | 2 +- packages/ai/test/kilo-login.test.ts | 2 +- packages/ai/test/minimax-code-login.test.ts | 2 +- packages/ai/test/mock-provider.test.ts | 6 +- packages/ai/test/model-cache.test.ts | 4 +- packages/ai/test/models-cost.test.ts | 4 +- .../models-json-no-local-endpoints.test.ts | 2 +- packages/ai/test/nanogpt-login.test.ts | 2 +- packages/ai/test/nanogpt-model-limits.test.ts | 4 +- packages/ai/test/oauth-deepseek.test.ts | 4 +- packages/ai/test/ollama-cloud-login.test.ts | 2 +- .../ai/test/ollama-cloud-provider.test.ts | 6 +- packages/ai/test/ollama-provider.test.ts | 8 +- packages/ai/test/openai-codex-usage.test.ts | 2 +- .../ai/test/openai-completions-compat.test.ts | 8 +- ...enai-completions-disable-reasoning.test.ts | 6 +- .../openai-completions-progress-chunk.test.ts | 6 +- .../test/openai-first-event-timeout.test.ts | 12 +- .../openai-responses-cache-affinity.test.ts | 6 +- .../openai-responses-developer-role.test.ts | 4 +- .../openai-responses-history-payload.test.ts | 2 +- ...i-responses-omit-max-output-tokens.test.ts | 6 +- .../openai-responses-system-prompt.test.ts | 6 +- packages/ai/test/openrouter-login.test.ts | 6 +- .../parse-streaming-json-throttled.test.ts | 2 +- packages/ai/test/pi-native-client.test.ts | 4 +- .../ai/test/provider-fetch-override.test.ts | 8 +- packages/ai/test/provider-registry.test.ts | 14 +- packages/ai/test/provider-response.test.ts | 8 +- packages/ai/test/raw-sse-sdk-capture.test.ts | 16 +- packages/ai/test/register-builtins.test.ts | 6 +- packages/ai/test/remote-auth-store.test.ts | 4 +- packages/ai/test/request-debug.test.ts | 10 +- .../service-tier-premium-requests.test.ts | 2 +- packages/ai/test/sse-debug.test.ts | 4 +- .../ai/test/stream-markup-healing.test.ts | 10 +- .../ai/test/stream-timeout-defaults.test.ts | 2 +- packages/ai/test/stream.test.ts | 2 +- packages/ai/test/synthetic-login.test.ts | 2 +- packages/ai/test/utils-responses-id.test.ts | 2 +- packages/ai/test/wafer.live.ts | 6 +- packages/ai/test/wafer.test.ts | 13 +- packages/ai/test/xai-oauth-bundle.test.ts | 4 +- .../ai/test/xai-oauth-effort-strip.test.ts | 2 +- packages/ai/test/xiaomi-oauth.test.ts | 2 +- .../test/xiaomi-tp-login-integration.test.ts | 5 +- packages/ai/test/zenmux-login.test.ts | 2 +- packages/ai/test/zenmux-provider.test.ts | 8 +- packages/coding-agent/CHANGELOG.md | 2 + packages/coding-agent/package.json | 20 +++ .../component.ts} | 58 ++---- .../src/modes/components/status-line/index.ts | 1 + .../src/modes/components/status-line/types.ts | 31 +++- packages/coding-agent/test/acp-agent.test.ts | 16 +- .../coding-agent/test/acp-builtins.test.ts | 14 +- .../test/acp-client-bridge.test.ts | 2 +- .../test/acp-event-mapper.test.ts | 8 +- .../test/acp-initialize-conformance.test.ts | 8 +- .../test/acp-lazy-startup.test.ts | 16 +- .../test/acp-mcp-isolation.test.ts | 12 +- .../test/agent-session-mcp-discovery.test.ts | 8 +- .../test/agent-session-role-thinking.test.ts | 8 +- .../test/agent-session-ssh-refresh.test.ts | 18 +- .../agent-session-tool-rebuild-skip.test.ts | 8 +- .../test/agent-storage-sqlite-compat.test.ts | 2 +- .../test/auth-broker-import.test.ts | 2 +- .../test/auth-broker-snapshot-cache.test.ts | 4 +- .../test/auto-thinking-classifier.test.ts | 2 +- .../test/autoresearch-state.test.ts | 18 +- .../test/autoresearch-tools.test.ts | 16 +- .../test/bash-acp-terminal.test.ts | 6 +- .../test/bash-failure-result.test.ts | 4 +- .../coding-agent/test/checkpoint-rpc-qa.ts | 4 +- .../coding-agent/test/cli-cwd-flag.test.ts | 4 +- .../test/cli-hide-thinking-flag.test.ts | 2 +- .../coding-agent/test/cli/completions.test.ts | 2 +- .../coding-agent/test/client-prompts.test.ts | 4 +- .../test/client-resources.test.ts | 4 +- .../test/commit-agentic-attribution.test.ts | 12 +- .../test/commit-command-exit.test.ts | 6 +- ...mmit-model-selection-role-thinking.test.ts | 2 +- .../test/commit-shared-llm.test.ts | 5 +- packages/coding-agent/test/compaction.test.ts | 4 +- packages/coding-agent/test/config-cli.test.ts | 4 +- .../test/core/js-executor.test.ts | 4 +- .../core/js-static-import-rewrite.test.ts | 2 +- .../test/core/js-tool-bridge.test.ts | 2 +- .../test/core/js-workflow-helpers.test.ts | 4 +- .../test/custom-editor-keybindings.test.ts | 2 +- .../test/dap-write-sink-flush.typecheck.ts | 2 +- .../test/debug/dap-launch-failures.test.ts | 19 +- .../test/debug/log-formatting.test.ts | 2 +- .../test/debug/log-viewer.test.ts | 2 +- .../test/debug/protocol-probe.test.ts | 6 +- .../test/debug/raw-sse-buffer.test.ts | 6 +- .../test/debug/raw-sse-pretty.test.ts | 2 +- .../test/debug/raw-sse-report-bundle.test.ts | 4 +- .../test/debug/terminal-info.test.ts | 6 +- ...agent-discovery-disabled-providers.test.ts | 8 +- .../test/discovery/agent-fields.test.ts | 2 +- .../test/edit/file-snapshot-store.test.ts | 2 +- .../test/emoji-autocomplete.test.ts | 6 +- .../test/eval/agent-bridge.test.ts | 16 +- .../export/html-template-developer.test.ts | 2 +- .../html-template-script-substitution.test.ts | 2 +- .../custom-commands/ci-green.test.ts | 12 +- .../custom-commands/review.test.ts | 10 +- .../legacy-pi-ai-type-remap.test.ts | 4 +- .../legacy-pi-bunfs-root.test.ts | 2 +- .../legacy-pi-inplace-load.test.ts | 2 +- .../test/extensibility/typebox-remap.test.ts | 7 +- .../test/extensibility/typebox-shim.test.ts | 2 +- .../extension-flag-initial-message.test.ts | 12 +- packages/coding-agent/test/file-lock.test.ts | 2 +- .../coding-agent/test/gallery-cli.test.ts | 10 +- .../test/git-process-config.test.ts | 2 +- .../test/history-storage-search.test.ts | 2 +- .../test/history-storage-session.test.ts | 2 +- .../history-storage-sqlite-compat.test.ts | 2 +- .../coding-agent/test/image-b64poly.test.ts | 2 +- .../test/image-input-normalization.test.ts | 2 +- .../coding-agent/test/initial-message.test.ts | 4 +- .../test/input-controller-keybindings.test.ts | 4 +- .../test/input-controller-suspend.test.ts | 4 +- .../interactive-mode-editor-component.test.ts | 12 +- .../test/interactive-mode-lsp-startup.test.ts | 16 +- .../test/interactive-mode-plan-review.test.ts | 12 +- .../test/interactive-mode-resume-mode.test.ts | 4 +- .../test/interactive-mode-todo-clear.test.ts | 12 +- .../interactive-mode-working-accent.test.ts | 12 +- .../test/internal-urls/mcp-protocol.test.ts | 6 +- .../internal-urls/memory-protocol.test.ts | 2 +- .../test/issue-1401-repro.test.ts | 2 +- .../test/issue-1423-repro.test.ts | 4 +- .../test/issue-1606-repro.test.ts | 6 +- .../test/issue-1940-repro.test.ts | 4 +- .../coding-agent/test/issue-816-repro.test.ts | 10 +- .../coding-agent/test/issue-845-repro.test.ts | 2 +- .../coding-agent/test/issue-905-repro.test.ts | 4 +- .../coding-agent/test/issue-953-repro.test.ts | 6 +- .../coding-agent/test/issue-956-repro.test.ts | 6 +- .../test/keybindings-display.test.ts | 2 +- .../test/keybindings-migration.test.ts | 2 +- .../coding-agent/test/marketplace/cli.test.ts | 2 +- .../test/marketplace/project-scope.test.ts | 10 +- .../marketplace/slash-install-parser.test.ts | 5 +- .../test/mcp-http-transport.test.ts | 6 +- .../test/mcp-manager-oauth-refresh.test.ts | 6 +- .../mcp-manager-subscription-action.test.ts | 2 +- .../test/mcp-reconnect-storm.test.ts | 4 +- .../coding-agent/test/mcp-reconnect.test.ts | 8 +- .../test/mcp-render-status.test.ts | 4 +- .../coding-agent/test/mcp-roots-list.test.ts | 2 +- .../test/mcp-stdio-transport.test.ts | 2 +- packages/coding-agent/test/mcp-test-utils.ts | 2 +- .../coding-agent/test/mcp-timeout.test.ts | 2 +- .../test/mcp-tool-ordering.test.ts | 2 +- .../test/memories/instructions.test.ts | 4 +- .../test/memories/isolation.test.ts | 2 +- .../test/memory-session-storage.test.ts | 2 +- .../test/model-id-affixes.test.ts | 2 +- .../test/model-registry-create.test.ts | 6 +- .../components/session-selector-scope.test.ts | 6 +- .../session-selector-scrollbar.test.ts | 6 +- .../session-selector-status.test.ts | 6 +- .../session-selector-viewport.test.ts | 6 +- .../components/transcript-container.test.ts | 10 +- .../tree-selector-developer.test.ts | 6 +- .../components/tree-selector-overflow.test.ts | 6 +- .../components/user-message-keywords.test.ts | 12 +- .../command-controller-hotkeys.test.ts | 2 +- .../input-controller-tool-expansion.test.ts | 4 +- .../session-selector-delete.test.ts | 6 +- .../test/modes/image-references.test.ts | 2 +- .../modes/internal-url-autocomplete.test.ts | 14 +- .../test/modes/magic-keywords.test.ts | 4 +- .../test/modes/markdown-prose.test.ts | 2 +- .../test/modes/orchestrate.test.ts | 12 +- .../modes/theme/settings-list-theme.test.ts | 2 +- .../test/modes/theme/shimmer.test.ts | 6 +- .../coding-agent/test/modes/workflow.test.ts | 4 +- packages/coding-agent/test/oauth-flow.test.ts | 4 +- .../coding-agent/test/otel-export-probe.ts | 7 +- .../coding-agent/test/plugin-command.test.ts | 2 +- .../test/prompt-action-autocomplete.test.ts | 4 +- .../test/read-tool-group-freeze.test.ts | 8 +- .../coding-agent/test/read-tool-group.test.ts | 11 +- .../repro-issue-1020-ctx-shutdown.test.ts | 6 +- .../role-thinking-helper-propagation.test.ts | 4 +- .../test/sdk-mcp-discovery.test.ts | 2 +- .../test/secrets-obfuscator.test.ts | 4 +- .../coding-agent/test/session-color.test.ts | 2 +- .../coding-agent/test/session-ranking.test.ts | 7 +- .../coding-agent/test/session-storage.test.ts | 2 +- .../test/session/blob-store.test.ts | 4 +- .../test/session/session-status.test.ts | 4 +- .../test/setup-wizard-sign-in.test.ts | 4 +- .../coding-agent/test/setup-wizard.test.ts | 16 +- .../test/silent-abort-overlay-render.test.ts | 10 +- .../test/silent-abort-print-mode.test.ts | 8 +- .../test/slash-command-format.test.ts | 6 +- .../slash-commands/issue-943-type-repro.ts | 2 +- .../test/ssh/connection-manager.test.ts | 2 +- .../test/status-line-cache-hit.test.ts | 6 +- .../test/status-line-context-cache.test.ts | 10 +- .../test/status-line-overflow.test.ts | 14 +- .../test/status-line-path.test.ts | 7 +- .../test/status-line-settings-cache.test.ts | 8 +- .../test/status-text-sanitization.test.ts | 2 +- .../test/streaming-output.test.ts | 2 +- .../test/streaming-preview-height.test.ts | 2 +- .../test/task/autoload-skills.test.ts | 25 +-- .../task/executor-subagent-reminders.test.ts | 36 ++-- .../test/task/executor-wall-clock.test.ts | 18 +- .../test/task/executor-warnings.test.ts | 2 +- .../test/task/subagent-lsp.test.ts | 30 ++-- .../coding-agent/test/task/worktree.test.ts | 4 +- .../test/telemetry-export.test.ts | 2 +- .../coding-agent/test/theme-islight.test.ts | 2 +- .../test/theme-spinner-frames.test.ts | 2 +- .../coding-agent/test/tiny-device.test.ts | 2 +- packages/coding-agent/test/tiny-dtype.test.ts | 2 +- packages/coding-agent/test/tiny-text.test.ts | 2 +- .../test/tiny-title-generator.test.ts | 26 ++- .../coding-agent/test/tiny-worker-env.test.ts | 2 +- .../coding-agent/test/title-generator.test.ts | 2 +- .../test/tool-discovery/initial-tools.test.ts | 6 +- .../test/tool-discovery/persistence.test.ts | 9 +- .../test/tool-discovery/subagent.test.ts | 7 +- .../test/tool-discovery/tool-index.test.ts | 4 +- .../test/tool-execution-args.test.ts | 2 +- .../test/tool-live-region-scrollback.test.ts | 10 +- .../test/tools/bash-command-fixup.test.ts | 2 +- .../test/tools/bash-interceptor.test.ts | 6 +- .../test/tools/bash-skill-urls.test.ts | 8 +- .../test/tools/browser-op-tracking.test.ts | 6 +- .../tools/browser-stealth-targets.test.ts | 4 +- .../tools/browser-tab-worker-startup.test.ts | 4 +- .../coding-agent/test/tools/edit-diff.test.ts | 2 +- .../test/tools/find-renderer.test.ts | 4 +- .../test/tools/find-validate-paths.test.ts | 12 +- .../test/tools/grouped-file-output.test.ts | 8 +- .../test/tools/memory-renderer.test.ts | 8 +- .../test/tools/plan-mode-guard-local.test.ts | 6 +- .../test/tools/read-renderer.test.ts | 4 +- .../coding-agent/test/tools/review.test.ts | 6 +- .../test/tools/search-internal-urls.test.ts | 2 +- .../test/tools/search-path-lists.test.ts | 13 +- .../test/tools/search-renderer.test.ts | 4 +- .../test/tools/search-tool-bm25.test.ts | 8 +- .../coding-agent/test/tools/sqlite.test.ts | 10 +- .../test/tools/strip-output-notice.test.ts | 2 +- .../tools/task-agent-capabilities.test.ts | 12 +- .../test/tools/task-async-fallback.test.ts | 12 +- .../test/tools/task-repair-args.test.ts | 4 +- .../test/tools/task-simple-mode.test.ts | 10 +- .../test/tools/tool-output-hyperlinks.test.ts | 2 +- .../web-scrapers/youtube-parallel.test.ts | 6 +- .../test/tools/web-search-codex.test.ts | 4 +- .../test/tools/web-search-exa.test.ts | 4 +- .../test/tools/web-search-gemini.test.ts | 2 +- .../test/tools/web-search-kagi.test.ts | 6 +- .../test/tools/web-search-parallel.test.ts | 6 +- .../test/tools/web-search-searxng.test.ts | 4 +- .../test/tools/web-search-tavily.test.ts | 4 +- .../test/tools/yield-extraction.test.ts | 4 +- .../transcript-streaming-commit-repro.test.ts | 2 +- .../tui-tree-list-collapsed-lines.test.ts | 2 +- packages/coding-agent/test/update-cli.test.ts | 2 +- .../coding-agent/test/utils/clipboard.test.ts | 2 +- .../test/utils/enhanced-paste.test.ts | 2 +- .../test/utils/image-resize.test.ts | 2 +- packages/coding-agent/test/utils/jj.test.ts | 2 +- packages/coding-agent/test/utils/open.test.ts | 2 +- .../test/web/search/abort-and-timeout.test.ts | 20 +-- .../test/web/search/codex-broker.test.ts | 6 +- .../write-streaming-preview-expand.test.ts | 2 +- packages/mnemopi/package.json | 11 +- packages/mnemopi/test/ab-toggles.test.ts | 2 +- packages/mnemopi/test/annotations.test.ts | 4 +- .../test/beam-consolidate-unit.test.ts | 8 +- packages/mnemopi/test/beam-e3-e4-e6.test.ts | 2 +- packages/mnemopi/test/beam-helpers.test.ts | 2 +- packages/mnemopi/test/beam-index.test.ts | 2 +- packages/mnemopi/test/beam-parity.test.ts | 2 +- .../mnemopi/test/beam-recall-unit.test.ts | 6 +- packages/mnemopi/test/beam-store.test.ts | 8 +- packages/mnemopi/test/binary-vectors.test.ts | 2 +- .../test/c25-deltasync-allowlist.test.ts | 4 +- .../mnemopi/test/cli-errors-parity.test.ts | 2 +- .../mnemopi/test/cli-stats-parity.test.ts | 6 +- packages/mnemopi/test/cli.test.ts | 4 +- .../mnemopi/test/configurable-scoring.test.ts | 4 +- .../test/consolidate-fact-concurrency.test.ts | 4 +- .../consolidate-fact-id-collision.test.ts | 4 +- .../consolidate-fact-sibling-races.test.ts | 4 +- .../mnemopi/test/content-sanitizer.test.ts | 2 +- packages/mnemopi/test/degrade-vector.test.ts | 4 +- packages/mnemopi/test/diagnose.test.ts | 4 +- .../e5a-vector-voice-dense-rewire.test.ts | 4 +- .../test/embeddings-multilingual.test.ts | 2 +- packages/mnemopi/test/entities.test.ts | 2 +- .../test/extraction-integration.test.ts | 8 +- .../mnemopi/test/extraction-wiring.test.ts | 4 +- packages/mnemopi/test/extraction.test.ts | 15 +- packages/mnemopi/test/foundation.test.ts | 4 +- packages/mnemopi/test/graph-tools.test.ts | 4 +- .../test/identity-memory-parity.test.ts | 4 +- .../issue-1832-embedding-population.test.ts | 11 +- packages/mnemopi/test/llm-backends.test.ts | 2 +- packages/mnemopi/test/local-llm.test.ts | 12 +- packages/mnemopi/test/mcp-server.test.ts | 4 +- packages/mnemopi/test/memory-banks.test.ts | 2 +- packages/mnemopi/test/memory-facade.test.ts | 4 +- .../test/migrate-triplestore-split.test.ts | 6 +- .../mnemopi/test/optional-embeddings.test.ts | 8 +- packages/mnemopi/test/orchestrator.test.ts | 8 +- .../test/orphan-vec-episodes-cleanup.test.ts | 2 +- packages/mnemopi/test/patterns.test.ts | 7 +- packages/mnemopi/test/plugins.test.ts | 2 +- .../mnemopi/test/polyphonic-recall.test.ts | 10 +- .../test/pre-experiment-fidelity.test.ts | 2 +- .../mnemopi/test/proactive-linking.test.ts | 4 +- .../test/provider-all-15-tools-parity.test.ts | 2 +- .../test/provider-all-15-tools.test.ts | 2 +- .../mnemopi/test/query-cache-synonyms.test.ts | 4 +- .../mnemopi/test/recall-diagnostics.test.ts | 6 +- .../test/recall-precision-regressions.test.ts | 2 +- packages/mnemopi/test/recovery.test.ts | 2 +- packages/mnemopi/test/setup.ts | 10 +- packages/mnemopi/test/shmr.test.ts | 4 +- packages/mnemopi/test/streaming.test.ts | 4 +- .../test/telemetry-env-followups.test.ts | 2 +- packages/mnemopi/test/temporal-parser.test.ts | 2 +- packages/mnemopi/test/temporal-recall.test.ts | 4 +- packages/mnemopi/test/text-utilities.test.ts | 6 +- .../mnemopi/test/triples-data-dir.test.ts | 2 +- .../mnemopi/test/typed-memory-aaak.test.ts | 4 +- .../test/veracity-consolidation.test.ts | 2 +- .../mnemopi/test/weibull-mmr-intent.test.ts | 11 +- packages/stats/test/behavior-backfill.test.ts | 4 +- packages/stats/test/db-cost.test.ts | 4 +- packages/stats/test/db-range.test.ts | 6 +- .../test/priority-premium-requests.test.ts | 6 +- packages/stats/test/user-metrics.test.ts | 2 +- packages/tui/test/editor.test.ts | 2 +- packages/tui/test/issue-848-repro.test.ts | 2 +- packages/tui/test/markdown.test.ts | 8 +- .../test/process-terminal-render-harness.ts | 2 +- packages/tui/test/render-stress-harness.ts | 8 +- .../tui/test/render-stress-oracles.test.ts | 2 +- packages/tui/test/render-stress-scheduler.ts | 2 +- packages/tui/test/scroll-view.test.ts | 4 +- packages/tui/test/select-list.test.ts | 4 +- packages/tui/test/settings-list.test.ts | 4 +- packages/tui/test/wrap-ansi.test.ts | 2 +- .../typescript-edit-benchmark/package.json | 11 ++ .../test/runner.test.ts | 10 +- .../test/verify.test.ts | 2 +- packages/utils/test/color.test.ts | 2 +- .../utils/test/dirs-python-gateway.test.ts | 4 +- packages/utils/test/env.test.ts | 2 +- packages/utils/test/fetch-retry.test.ts | 2 +- packages/utils/test/format.test.ts | 2 +- packages/utils/test/install-id.test.ts | 10 +- packages/utils/test/issue-935-repro.test.ts | 2 +- .../test/logger-error-serialization.test.ts | 2 +- packages/utils/test/peek-file.test.ts | 2 +- packages/utils/test/ring.test.ts | 2 +- packages/utils/test/sanitize-text.test.ts | 2 +- packages/utils/test/spacing.test.ts | 6 +- packages/utils/test/stream.test.ts | 4 +- scripts/fix-test-imports.ts | 168 ++++++++++++++++++ 458 files changed, 1531 insertions(+), 1181 deletions(-) rename packages/coding-agent/src/modes/components/{status-line.ts => status-line/component.ts} (94%) create mode 100644 scripts/fix-test-imports.ts diff --git a/crates/pi-natives/src/ast.rs b/crates/pi-natives/src/ast.rs index 541b4ab32..ccde8daa1 100644 --- a/crates/pi-natives/src/ast.rs +++ b/crates/pi-natives/src/ast.rs @@ -819,10 +819,15 @@ pub fn ast_match(options: AstMatchOptions<'_>) -> task::Promise .then(left.byte_end.cmp(&right.byte_end)) }); - let visible_matches = - all_matches.into_iter().skip(normalized_offset as usize).collect::>(); + let visible_matches = all_matches + .into_iter() + .skip(normalized_offset as usize) + .collect::>(); let limit_reached = visible_matches.len() > normalized_limit as usize; - let matches = visible_matches.into_iter().take(normalized_limit as usize).collect::>(); + let matches = visible_matches + .into_iter() + .take(normalized_limit as usize) + .collect::>(); Ok(AstMatchResult { matches, diff --git a/crates/pi-shell/src/shell.rs b/crates/pi-shell/src/shell.rs index 15117353d..111ad77dd 100644 --- a/crates/pi-shell/src/shell.rs +++ b/crates/pi-shell/src/shell.rs @@ -2290,8 +2290,7 @@ mod tests { .stdout(std::process::Stdio::null()) .stderr(std::process::Stdio::null()) .status() - .map(|status| status.success()) - .unwrap_or(false); + .is_ok_and(|status| status.success()); if !python_ok { eprintln!("skipping nohup_builtin_does_not_mask_sighup: python3 unavailable"); return; diff --git a/packages/agent/test/append-only-context.test.ts b/packages/agent/test/append-only-context.test.ts index 945fe4cac..b46988663 100644 --- a/packages/agent/test/append-only-context.test.ts +++ b/packages/agent/test/append-only-context.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; +import { AppendOnlyContextManager, AppendOnlyLog, StablePrefix } from "@oh-my-pi/pi-agent-core/append-only-context"; +import type { AgentContext, AgentTool } from "@oh-my-pi/pi-agent-core/types"; import type { Message, Tool } from "@oh-my-pi/pi-ai"; -import { AppendOnlyContextManager, AppendOnlyLog, StablePrefix } from "../src/append-only-context"; -import type { AgentContext, AgentTool } from "../src/types"; // --------------------------------------------------------------------------- // Helpers diff --git a/packages/agent/test/harmony-leak.test.ts b/packages/agent/test/harmony-leak.test.ts index bd3d785c6..9588ec570 100644 --- a/packages/agent/test/harmony-leak.test.ts +++ b/packages/agent/test/harmony-leak.test.ts @@ -1,6 +1,4 @@ import { describe, expect, it } from "bun:test"; -import type { AssistantMessage, Model, ToolCall } from "@oh-my-pi/pi-ai"; -import { getBundledModel } from "@oh-my-pi/pi-ai"; import { createHarmonyAuditEvent, detectHarmonyLeak, @@ -9,7 +7,9 @@ import { isHarmonyLeakMitigationTarget, recoverHarmonyToolCall, signalListLabel, -} from "../src/harmony-leak"; +} from "@oh-my-pi/pi-agent-core/harmony-leak"; +import type { AssistantMessage, Model, ToolCall } from "@oh-my-pi/pi-ai"; +import { getBundledModel } from "@oh-my-pi/pi-ai"; import corpus from "./fixtures/harmony-leak-corpus.json" with { type: "json" }; import { createAssistantMessage } from "./helpers"; diff --git a/packages/agent/test/yield.test.ts b/packages/agent/test/yield.test.ts index f5d89ad4b..abb6142d0 100644 --- a/packages/agent/test/yield.test.ts +++ b/packages/agent/test/yield.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; import { scheduler } from "node:timers/promises"; -import { ExponentialYield, yieldIfDue } from "../src/utils/yield"; +import { ExponentialYield, yieldIfDue } from "@oh-my-pi/pi-agent-core/utils/yield"; const YIELD_INTERVAL_MS = 50; const YIELD_CLOCK_STEP_MS = 60_000; diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index 2dc3b0223..42db66086 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -2,11 +2,15 @@ ## [Unreleased] +### Breaking Changes + +- Renamed the OAuth subpath export `@oh-my-pi/pi-ai/utils/oauth` → `@oh-my-pi/pi-ai/oauth` (and `@oh-my-pi/pi-ai/utils/oauth/*` → `@oh-my-pi/pi-ai/oauth/*`, e.g. `oauth/types`, `oauth/callback-server`, `oauth/openai-codex`) after relocating the OAuth implementation out of `utils/oauth/` into `registry/oauth/`. The high-level OAuth API (`getOAuthProviders`, `refreshOAuthToken`, `getOAuthApiKey`, `registerOAuthProvider`, `unregisterOAuthProviders`, `getOAuthProvider`) and the `OAuth*` types stay exported from the package root, unchanged. + ### Changed - Changed Anthropic retry handling to avoid retrying 4xx responses other than 408 and 429 - Optimized the Anthropic `cch` attestation patch to locate the billing-header placeholder with native `Buffer.indexOf` (memmem) instead of a hand-rolled byte loop. The marker sits ~99% through the body (`messages` serializes before `system`), so the old scan walked almost the entire payload; output bytes are unchanged but the patch is ~7.5x faster (563µs -> 75µs on a 1MB body). -- Refactored provider configuration to a single-source registry (`provider-registry/`). The `KnownProvider`/`OAuthProvider` type unions, `PROVIDER_DESCRIPTORS`, `DEFAULT_MODEL_PER_PROVIDER`, the `serviceProviderMap` env-key fallbacks, the `/login` provider list (`builtInOAuthProviders`), and the `refreshOAuthToken`/`AuthStorage.login` dispatch are all derived from it. Thin provider-specific login flows are now inlined into the provider def file; heavier provider-local oauth flows live adjacent under `provider-registry/providers/oauth/`; only shared oauth infra / streaming helpers remain in `utils/oauth/`. Adding a provider that reuses an existing wire API is now one new provider def plus one registry entry in the common case. Exposes `PROVIDER_REGISTRY`, `getProviderDefinition`, `ProviderDefinition`, and `PASTE_CODE_LOGIN_PROVIDERS`. +- Refactored provider configuration to a single-source registry (`registry/`, renamed from `provider-registry/` with its `providers/` subdir flattened up). The `KnownProvider`/`OAuthProvider` type unions, `PROVIDER_DESCRIPTORS`, `DEFAULT_MODEL_PER_PROVIDER`, the `serviceProviderMap` env-key fallbacks, the `/login` provider list (`builtInOAuthProviders`), and the `refreshOAuthToken`/`AuthStorage.login` dispatch are all derived from it. Provider defs live directly under `registry/`; thin provider-specific login flows are inlined into the def file, while heavier provider-local OAuth flows and the shared OAuth flow infra (`callback-server`, `pkce`, `google-oauth-shared`, `types`, runtime `index`) now live together under `registry/oauth/` (previously split across `provider-registry/providers/oauth/` and `utils/oauth/`). The non-OAuth API-key paste/validation helpers (`api-key-login`, `api-key-validation`) sit beside the defs in `registry/`. Adding a provider that reuses an existing wire API is now one new provider def plus one registry entry in the common case. Exposes `PROVIDER_REGISTRY`, `getProviderDefinition`, `ProviderDefinition`, and `PASTE_CODE_LOGIN_PROVIDERS`. ### Fixed diff --git a/packages/ai/test/abort-source-tracker.test.ts b/packages/ai/test/abort-source-tracker.test.ts index 6500795cd..d9b0b9def 100644 --- a/packages/ai/test/abort-source-tracker.test.ts +++ b/packages/ai/test/abort-source-tracker.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { createAbortSourceTracker } from "../src/utils/abort"; +import { createAbortSourceTracker } from "@oh-my-pi/pi-ai/utils/abort"; /** * Defends the contract `AssistantMessageEventStream` providers depend on: caller diff --git a/packages/ai/test/abortable-iterator.test.ts b/packages/ai/test/abortable-iterator.test.ts index ed95a9879..4afbeb3b5 100644 --- a/packages/ai/test/abortable-iterator.test.ts +++ b/packages/ai/test/abortable-iterator.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { iterateUntilAbort } from "../src/utils/abortable-iterator"; +import { iterateUntilAbort } from "@oh-my-pi/pi-ai/utils/abortable-iterator"; function makeSource(handlers: { next: () => Promise>; onReturn?: () => void }): AsyncIterable { return { diff --git a/packages/ai/test/anthropic-client.test.ts b/packages/ai/test/anthropic-client.test.ts index 64eb086f3..259b13b8a 100644 --- a/packages/ai/test/anthropic-client.test.ts +++ b/packages/ai/test/anthropic-client.test.ts @@ -3,8 +3,8 @@ import { AnthropicApiError, AnthropicConnectionTimeoutError, AnthropicMessagesClient, -} from "../src/providers/anthropic-client"; -import type { MessageCreateParamsStreaming } from "../src/providers/anthropic-wire"; +} from "@oh-my-pi/pi-ai/providers/anthropic-client"; +import type { MessageCreateParamsStreaming } from "@oh-my-pi/pi-ai/providers/anthropic-wire"; const params: MessageCreateParamsStreaming = { model: "claude-sonnet-4-5", diff --git a/packages/ai/test/anthropic-many-image-resize.test.ts b/packages/ai/test/anthropic-many-image-resize.test.ts index 91b13effd..493f34464 100644 --- a/packages/ai/test/anthropic-many-image-resize.test.ts +++ b/packages/ai/test/anthropic-many-image-resize.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { streamAnthropic } from "../src/providers/anthropic"; -import type { AssistantMessage, Context, ImageContent, Model, TextContent, Usage } from "../src/types"; +import { streamAnthropic } from "@oh-my-pi/pi-ai/providers/anthropic"; +import type { AssistantMessage, Context, ImageContent, Model, TextContent, Usage } from "@oh-my-pi/pi-ai/types"; const RED_1X1_PNG_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC"; diff --git a/packages/ai/test/anthropic-oauth.test.ts b/packages/ai/test/anthropic-oauth.test.ts index c4a29cd5a..6b6e91c50 100644 --- a/packages/ai/test/anthropic-oauth.test.ts +++ b/packages/ai/test/anthropic-oauth.test.ts @@ -1,6 +1,10 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { AnthropicOAuthFlow, refreshAnthropicToken } from "../src/registry/oauth/anthropic"; -import { buildAnthropicAuthConfig, buildAnthropicSearchHeaders, buildAnthropicUrl } from "../src/utils/anthropic-auth"; +import { AnthropicOAuthFlow, refreshAnthropicToken } from "@oh-my-pi/pi-ai/registry/oauth/anthropic"; +import { + buildAnthropicAuthConfig, + buildAnthropicSearchHeaders, + buildAnthropicUrl, +} from "@oh-my-pi/pi-ai/utils/anthropic-auth"; import { withEnv } from "./helpers"; const originalFetch = global.fetch; diff --git a/packages/ai/test/anthropic-stream-envelope.test.ts b/packages/ai/test/anthropic-stream-envelope.test.ts index 01f45758b..006e96839 100644 --- a/packages/ai/test/anthropic-stream-envelope.test.ts +++ b/packages/ai/test/anthropic-stream-envelope.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; import { scheduler } from "node:timers/promises"; -import { streamAnthropic } from "../src/providers/anthropic"; -import { AnthropicMessages } from "../src/providers/anthropic-client"; -import type { AssistantMessageEvent, Context, Model, ProviderSessionState } from "../src/types"; +import { streamAnthropic } from "@oh-my-pi/pi-ai/providers/anthropic"; +import { AnthropicMessages } from "@oh-my-pi/pi-ai/providers/anthropic-client"; +import type { AssistantMessageEvent, Context, Model, ProviderSessionState } from "@oh-my-pi/pi-ai/types"; const model: Model<"anthropic-messages"> = { id: "claude-sonnet-4-5", diff --git a/packages/ai/test/anthropic-stream-timeout.test.ts b/packages/ai/test/anthropic-stream-timeout.test.ts index 4b001ffee..422a94235 100644 --- a/packages/ai/test/anthropic-stream-timeout.test.ts +++ b/packages/ai/test/anthropic-stream-timeout.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { streamAnthropic } from "../src/providers/anthropic"; -import type { AnthropicMessagesClientLike } from "../src/providers/anthropic-client"; -import type { Context, Model } from "../src/types"; +import { streamAnthropic } from "@oh-my-pi/pi-ai/providers/anthropic"; +import type { AnthropicMessagesClientLike } from "@oh-my-pi/pi-ai/providers/anthropic-client"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; import { waitForDelayOrAbort } from "./helpers"; const originalFetch = global.fetch; diff --git a/packages/ai/test/api-registry.test.ts b/packages/ai/test/api-registry.test.ts index f62840076..5491de1a4 100644 --- a/packages/ai/test/api-registry.test.ts +++ b/packages/ai/test/api-registry.test.ts @@ -5,8 +5,8 @@ import { getCustomApi, registerCustomApi, unregisterCustomApis, -} from "../src/api-registry"; -import type { AssistantMessageEventStream } from "../src/types"; +} from "@oh-my-pi/pi-ai/api-registry"; +import type { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/types"; afterEach(() => { clearCustomApis(); diff --git a/packages/ai/test/auth-broker-refresher.test.ts b/packages/ai/test/auth-broker-refresher.test.ts index 30c5b2652..82787da9b 100644 --- a/packages/ai/test/auth-broker-refresher.test.ts +++ b/packages/ai/test/auth-broker-refresher.test.ts @@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { AuthBrokerRefresher, AuthStorage, SqliteAuthCredentialStore } from "../src"; -import * as oauthUtils from "../src/registry/oauth"; +import { AuthBrokerRefresher, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai"; +import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; const ANTHROPIC_ENV = ["ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN"] as const; const savedEnv: Partial> = {}; diff --git a/packages/ai/test/auth-broker-remote-store.test.ts b/packages/ai/test/auth-broker-remote-store.test.ts index 50be18938..cf553eed4 100644 --- a/packages/ai/test/auth-broker-remote-store.test.ts +++ b/packages/ai/test/auth-broker-remote-store.test.ts @@ -11,7 +11,7 @@ import { type SnapshotResponse, SqliteAuthCredentialStore, startAuthBroker, -} from "../src"; +} from "@oh-my-pi/pi-ai"; const ANTHROPIC_ENV = ["ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN"] as const; const savedEnv: Partial> = {}; diff --git a/packages/ai/test/auth-broker-snapshot-cache.test.ts b/packages/ai/test/auth-broker-snapshot-cache.test.ts index 9480472c6..51532b4d8 100644 --- a/packages/ai/test/auth-broker-snapshot-cache.test.ts +++ b/packages/ai/test/auth-broker-snapshot-cache.test.ts @@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { readAuthBrokerSnapshotCache, type SnapshotResponse, writeAuthBrokerSnapshotCache } from "../src"; +import { readAuthBrokerSnapshotCache, type SnapshotResponse, writeAuthBrokerSnapshotCache } from "@oh-my-pi/pi-ai"; const TOKEN = "broker-cache-token"; const URL = "http://127.0.0.1:8765"; diff --git a/packages/ai/test/auth-broker-wire.test.ts b/packages/ai/test/auth-broker-wire.test.ts index 5e39be6da..60fb2f349 100644 --- a/packages/ai/test/auth-broker-wire.test.ts +++ b/packages/ai/test/auth-broker-wire.test.ts @@ -11,8 +11,8 @@ import { type SnapshotStreamEvent, SqliteAuthCredentialStore, startAuthBroker, -} from "../src"; -import * as oauthUtils from "../src/registry/oauth"; +} from "@oh-my-pi/pi-ai"; +import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; const ANTHROPIC_ENV = ["ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN"] as const; const savedEnv: Partial> = {}; diff --git a/packages/ai/test/auth-gateway-anthropic-messages.test.ts b/packages/ai/test/auth-gateway-anthropic-messages.test.ts index 98679149f..94ca9e06c 100644 --- a/packages/ai/test/auth-gateway-anthropic-messages.test.ts +++ b/packages/ai/test/auth-gateway-anthropic-messages.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { encodeResponse, encodeStream, parseRequest } from "../src/providers/anthropic-messages-server"; -import type { AssistantMessage, AssistantMessageEvent, ToolResultMessage } from "../src/types"; -import { AssistantMessageEventStream } from "../src/utils/event-stream"; +import { encodeResponse, encodeStream, parseRequest } from "@oh-my-pi/pi-ai/providers/anthropic-messages-server"; +import type { AssistantMessage, AssistantMessageEvent, ToolResultMessage } from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; function emptyUsage(): AssistantMessage["usage"] { return { diff --git a/packages/ai/test/auth-gateway-cache-key.test.ts b/packages/ai/test/auth-gateway-cache-key.test.ts index 4f6a55bca..9d98b28cc 100644 --- a/packages/ai/test/auth-gateway-cache-key.test.ts +++ b/packages/ai/test/auth-gateway-cache-key.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { resolvePromptCacheKey } from "../src/auth-gateway/http"; +import { resolvePromptCacheKey } from "@oh-my-pi/pi-ai/auth-gateway/http"; describe("resolvePromptCacheKey", () => { it("prefers body.prompt_cache_key over everything else", () => { diff --git a/packages/ai/test/auth-gateway-classify-error.test.ts b/packages/ai/test/auth-gateway-classify-error.test.ts index d780b266f..e55fdf602 100644 --- a/packages/ai/test/auth-gateway-classify-error.test.ts +++ b/packages/ai/test/auth-gateway-classify-error.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { classifyGatewayError } from "../src/auth-gateway/server"; +import { classifyGatewayError } from "@oh-my-pi/pi-ai/auth-gateway/server"; describe("auth-gateway classifyGatewayError", () => { it("honours an explicit numeric `status` property on the error", () => { diff --git a/packages/ai/test/auth-gateway-openai-chat.test.ts b/packages/ai/test/auth-gateway-openai-chat.test.ts index 4db5db89f..9ce5a92be 100644 --- a/packages/ai/test/auth-gateway-openai-chat.test.ts +++ b/packages/ai/test/auth-gateway-openai-chat.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { encodeResponse, encodeStream, parseRequest } from "../src/providers/openai-chat-server"; -import type { AssistantMessage, AssistantMessageEvent, AssistantMessageEventStream } from "../src/types"; +import { encodeResponse, encodeStream, parseRequest } from "@oh-my-pi/pi-ai/providers/openai-chat-server"; +import type { AssistantMessage, AssistantMessageEvent, AssistantMessageEventStream } from "@oh-my-pi/pi-ai/types"; function makeEventStream(events: AssistantMessageEvent[], final: AssistantMessage): AssistantMessageEventStream { async function* iter() { diff --git a/packages/ai/test/auth-gateway-openai-responses.test.ts b/packages/ai/test/auth-gateway-openai-responses.test.ts index 091928abf..d002caf86 100644 --- a/packages/ai/test/auth-gateway-openai-responses.test.ts +++ b/packages/ai/test/auth-gateway-openai-responses.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; -import { Effort } from "../src/effort"; -import { encodeResponse, encodeStream, parseRequest } from "../src/providers/openai-responses-server"; -import type { AssistantMessage } from "../src/types"; -import { AssistantMessageEventStream } from "../src/utils/event-stream"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { encodeResponse, encodeStream, parseRequest } from "@oh-my-pi/pi-ai/providers/openai-responses-server"; +import type { AssistantMessage } from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; function zeroUsage(): AssistantMessage["usage"] { return { diff --git a/packages/ai/test/auth-gateway-pi-native.test.ts b/packages/ai/test/auth-gateway-pi-native.test.ts index 5f3a77a76..38e2d9ab9 100644 --- a/packages/ai/test/auth-gateway-pi-native.test.ts +++ b/packages/ai/test/auth-gateway-pi-native.test.ts @@ -1,13 +1,13 @@ import { describe, expect, it } from "bun:test"; -import { Effort } from "../src/effort"; -import { encodeStream, formatError, parseRequest } from "../src/providers/pi-native-server"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { encodeStream, formatError, parseRequest } from "@oh-my-pi/pi-ai/providers/pi-native-server"; import type { AssistantMessage, AssistantMessageEvent, AssistantMessageEventStream, Context, Usage, -} from "../src/types"; +} from "@oh-my-pi/pi-ai/types"; function makeEventStream(events: AssistantMessageEvent[], final: AssistantMessage): AssistantMessageEventStream { async function* iter() { diff --git a/packages/ai/test/auth-storage-api-key-login.test.ts b/packages/ai/test/auth-storage-api-key-login.test.ts index 4ad5b714c..7023aad92 100644 --- a/packages/ai/test/auth-storage-api-key-login.test.ts +++ b/packages/ai/test/auth-storage-api-key-login.test.ts @@ -4,10 +4,10 @@ import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; -import * as deepseekModule from "../src/registry/deepseek"; -import * as kagiModule from "../src/registry/kagi"; -import * as ollamaCloudModule from "../src/registry/ollama-cloud"; +import { AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; +import * as deepseekModule from "@oh-my-pi/pi-ai/registry/deepseek"; +import * as kagiModule from "@oh-my-pi/pi-ai/registry/kagi"; +import * as ollamaCloudModule from "@oh-my-pi/pi-ai/registry/ollama-cloud"; function countCredentialRows(dbPath: string, provider: string): number { const db = new Database(dbPath, { readonly: true }); diff --git a/packages/ai/test/auth-storage-broker-no-sentinel.test.ts b/packages/ai/test/auth-storage-broker-no-sentinel.test.ts index 5a0742eda..b26a1a2f4 100644 --- a/packages/ai/test/auth-storage-broker-no-sentinel.test.ts +++ b/packages/ai/test/auth-storage-broker-no-sentinel.test.ts @@ -7,8 +7,8 @@ import { AuthStorage, REMOTE_REFRESH_SENTINEL, SqliteAuthCredentialStore, -} from "../src/auth-storage"; -import * as oauthUtils from "../src/registry/oauth"; +} from "@oh-my-pi/pi-ai/auth-storage"; +import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; describe("AuthStorage broker sentinel refresh", () => { let tempDir = ""; diff --git a/packages/ai/test/auth-storage-check-credentials.test.ts b/packages/ai/test/auth-storage-check-credentials.test.ts index e2f408669..3ad0ae274 100644 --- a/packages/ai/test/auth-storage-check-credentials.test.ts +++ b/packages/ai/test/auth-storage-check-credentials.test.ts @@ -29,8 +29,8 @@ import { type CompletionProbeInput, REMOTE_REFRESH_SENTINEL, type StoredAuthCredential, -} from "../src/auth-storage"; -import * as claudeUsage from "../src/usage/claude"; +} from "@oh-my-pi/pi-ai/auth-storage"; +import * as claudeUsage from "@oh-my-pi/pi-ai/usage/claude"; function oauthRow(id: number, email: string, opts?: { expired?: boolean }): StoredAuthCredential { const credential: AuthCredential = { diff --git a/packages/ai/test/auth-storage-codex-selection.test.ts b/packages/ai/test/auth-storage-codex-selection.test.ts index bf88b27a3..e98fd6443 100644 --- a/packages/ai/test/auth-storage-codex-selection.test.ts +++ b/packages/ai/test/auth-storage-codex-selection.test.ts @@ -2,10 +2,10 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; -import * as oauthUtils from "../src/registry/oauth"; -import type { OAuthCredentials } from "../src/registry/oauth/types"; -import type { UsageLimit, UsageProvider, UsageReport } from "../src/usage"; +import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; +import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; +import type { OAuthCredentials } from "@oh-my-pi/pi-ai/registry/oauth/types"; +import type { UsageLimit, UsageProvider, UsageReport } from "@oh-my-pi/pi-ai/usage"; const WEEK_MS = 7 * 24 * 60 * 60 * 1000; const HOUR_MS = 60 * 60 * 1000; diff --git a/packages/ai/test/auth-storage-config-override.test.ts b/packages/ai/test/auth-storage-config-override.test.ts index 16e140255..ad7f1a15d 100644 --- a/packages/ai/test/auth-storage-config-override.test.ts +++ b/packages/ai/test/auth-storage-config-override.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; +import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; import { withEnv } from "./helpers"; const SUPPRESS_ANTHROPIC_ENV = { diff --git a/packages/ai/test/auth-storage-credential-disabled-event.test.ts b/packages/ai/test/auth-storage-credential-disabled-event.test.ts index f4b6dabf5..6574ad57e 100644 --- a/packages/ai/test/auth-storage-credential-disabled-event.test.ts +++ b/packages/ai/test/auth-storage-credential-disabled-event.test.ts @@ -5,8 +5,8 @@ import { AuthStorage, type CredentialDisabledEvent, type StoredAuthCredential, -} from "../src/auth-storage"; -import * as oauthUtils from "../src/registry/oauth"; +} from "@oh-my-pi/pi-ai/auth-storage"; +import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; // Env vars short-circuit AuthStorage.getApiKey before the OAuth refresh path runs; suppress // them for every test in this file so the credential-disable code path can be exercised. diff --git a/packages/ai/test/auth-storage-credential-origin.test.ts b/packages/ai/test/auth-storage-credential-origin.test.ts index cbb50e26d..546e8e9d4 100644 --- a/packages/ai/test/auth-storage-credential-origin.test.ts +++ b/packages/ai/test/auth-storage-credential-origin.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; +import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; import { withEnv } from "./helpers"; // Clear every env var the providers under test alias, so ambient shell / ~/.env diff --git a/packages/ai/test/auth-storage-email-dedupe.test.ts b/packages/ai/test/auth-storage-email-dedupe.test.ts index e0ae13523..268a55912 100644 --- a/packages/ai/test/auth-storage-email-dedupe.test.ts +++ b/packages/ai/test/auth-storage-email-dedupe.test.ts @@ -3,7 +3,7 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { AuthStorage, type OAuthCredential, SqliteAuthCredentialStore } from "../src/auth-storage"; +import { AuthStorage, type OAuthCredential, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; const LEGACY_TIMESTAMP = 1_700_000_000; diff --git a/packages/ai/test/auth-storage-force-refresh-rotate.test.ts b/packages/ai/test/auth-storage-force-refresh-rotate.test.ts index ed3389fb4..1ae31a67b 100644 --- a/packages/ai/test/auth-storage-force-refresh-rotate.test.ts +++ b/packages/ai/test/auth-storage-force-refresh-rotate.test.ts @@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; -import { registerOAuthProvider, unregisterOAuthProviders } from "../src/registry/oauth"; +import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; +import { registerOAuthProvider, unregisterOAuthProviders } from "@oh-my-pi/pi-ai/registry/oauth"; const PROVIDER = "unit-rotate-oauth"; const SOURCE = "auth-storage-force-refresh-rotate-test"; diff --git a/packages/ai/test/auth-storage-oauth-refresh-race.test.ts b/packages/ai/test/auth-storage-oauth-refresh-race.test.ts index c2bbf9ded..637d35bbe 100644 --- a/packages/ai/test/auth-storage-oauth-refresh-race.test.ts +++ b/packages/ai/test/auth-storage-oauth-refresh-race.test.ts @@ -7,8 +7,8 @@ import { AuthStorage, type CredentialDisabledEvent, SqliteAuthCredentialStore, -} from "../src/auth-storage"; -import * as oauthUtils from "../src/registry/oauth"; +} from "@oh-my-pi/pi-ai/auth-storage"; +import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; import { withEnv } from "./helpers"; const SUPPRESS_ANTHROPIC_ENV = { diff --git a/packages/ai/test/auth-storage-refresh-skew.test.ts b/packages/ai/test/auth-storage-refresh-skew.test.ts index 3ff8fc04b..9e5e37e66 100644 --- a/packages/ai/test/auth-storage-refresh-skew.test.ts +++ b/packages/ai/test/auth-storage-refresh-skew.test.ts @@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; -import { registerOAuthProvider, unregisterOAuthProviders } from "../src/registry/oauth"; +import { type AuthCredentialStore, AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; +import { registerOAuthProvider, unregisterOAuthProviders } from "@oh-my-pi/pi-ai/registry/oauth"; describe("AuthStorage OAuth refresh skew", () => { let tempDir = ""; diff --git a/packages/ai/test/auth-storage-usage-cache.test.ts b/packages/ai/test/auth-storage-usage-cache.test.ts index fcb2d87a6..219d49f33 100644 --- a/packages/ai/test/auth-storage-usage-cache.test.ts +++ b/packages/ai/test/auth-storage-usage-cache.test.ts @@ -16,9 +16,9 @@ import { type AuthCredentialStore, AuthStorage, type StoredAuthCredential, -} from "../src/auth-storage"; -import type { UsageLimit, UsageReport } from "../src/usage"; -import * as claudeUsage from "../src/usage/claude"; +} from "@oh-my-pi/pi-ai/auth-storage"; +import type { UsageLimit, UsageReport } from "@oh-my-pi/pi-ai/usage"; +import * as claudeUsage from "@oh-my-pi/pi-ai/usage/claude"; function anthropicReports(reports: UsageReport[] | null): UsageReport[] { return (reports ?? []).filter(r => r.provider === "anthropic"); diff --git a/packages/ai/test/aws-credentials.test.ts b/packages/ai/test/aws-credentials.test.ts index 851c4bc58..5fd483868 100644 --- a/packages/ai/test/aws-credentials.test.ts +++ b/packages/ai/test/aws-credentials.test.ts @@ -6,7 +6,7 @@ import { clearAwsCredentialCache, resolveAwsCredentials, tokenizeCredentialProcessCommand, -} from "../src/providers/aws-credentials"; +} from "@oh-my-pi/pi-ai/providers/aws-credentials"; // `credential_process` integration coverage. Drives a real `Bun.spawn` // against a fixture script so the JSON envelope contract, exit-code diff --git a/packages/ai/test/aws-eventstream.test.ts b/packages/ai/test/aws-eventstream.test.ts index 347660ca1..b75cb1cb2 100644 --- a/packages/ai/test/aws-eventstream.test.ts +++ b/packages/ai/test/aws-eventstream.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { crc32, decodeEventStream, decodeMessage } from "../src/providers/aws-eventstream"; +import { crc32, decodeEventStream, decodeMessage } from "@oh-my-pi/pi-ai/providers/aws-eventstream"; // ---- Frame builder (mirrors @smithy/eventstream-codec but in-process so the // test owns the bytes). The decoder is the production code; we encode here for diff --git a/packages/ai/test/aws-sigv4.test.ts b/packages/ai/test/aws-sigv4.test.ts index bcb661f19..2b4d70d1d 100644 --- a/packages/ai/test/aws-sigv4.test.ts +++ b/packages/ai/test/aws-sigv4.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { formatAmzDate, getSigningKey, signRequest, toHex } from "../src/providers/aws-sigv4"; +import { formatAmzDate, getSigningKey, signRequest, toHex } from "@oh-my-pi/pi-ai/providers/aws-sigv4"; // Canonical AWS SigV4 test vectors. Sourced from the // `aws-sig-v4-test-suite` published with the SigV4 spec. diff --git a/packages/ai/test/azure-openai-responses-stream.test.ts b/packages/ai/test/azure-openai-responses-stream.test.ts index 416cbb044..ca44715f9 100644 --- a/packages/ai/test/azure-openai-responses-stream.test.ts +++ b/packages/ai/test/azure-openai-responses-stream.test.ts @@ -1,6 +1,9 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { type AzureOpenAIResponsesOptions, streamAzureOpenAIResponses } from "../src/providers/azure-openai-responses"; -import type { Context, Model, Tool } from "../src/types"; +import { + type AzureOpenAIResponsesOptions, + streamAzureOpenAIResponses, +} from "@oh-my-pi/pi-ai/providers/azure-openai-responses"; +import type { Context, Model, Tool } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/callback-server-manual-input.test.ts b/packages/ai/test/callback-server-manual-input.test.ts index 1ad15a2e6..04e76fee9 100644 --- a/packages/ai/test/callback-server-manual-input.test.ts +++ b/packages/ai/test/callback-server-manual-input.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { OAuthCallbackFlow } from "../src/registry/oauth/callback-server"; -import type { OAuthCredentials } from "../src/registry/oauth/types"; +import { OAuthCallbackFlow } from "@oh-my-pi/pi-ai/registry/oauth/callback-server"; +import type { OAuthCredentials } from "@oh-my-pi/pi-ai/registry/oauth/types"; class TestCallbackFlow extends OAuthCallbackFlow { async generateAuthUrl(_state: string, redirectUri: string): Promise<{ url: string; instructions?: string }> { diff --git a/packages/ai/test/claude-ratelimit-headers.test.ts b/packages/ai/test/claude-ratelimit-headers.test.ts index e9d2188dc..4b31abb53 100644 --- a/packages/ai/test/claude-ratelimit-headers.test.ts +++ b/packages/ai/test/claude-ratelimit-headers.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import type { UsageLimit, UsageReport } from "../src/usage"; -import { parseClaudeRateLimitHeaders } from "../src/usage/claude"; +import type { UsageLimit, UsageReport } from "@oh-my-pi/pi-ai/usage"; +import { parseClaudeRateLimitHeaders } from "@oh-my-pi/pi-ai/usage/claude"; const NOW = 1_780_400_000_000; diff --git a/packages/ai/test/claude-usage-headers.test.ts b/packages/ai/test/claude-usage-headers.test.ts index a20dc6a1f..3aab042ad 100644 --- a/packages/ai/test/claude-usage-headers.test.ts +++ b/packages/ai/test/claude-usage-headers.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import type { UsageFetchContext } from "../src/usage"; -import { claudeUsageProvider } from "../src/usage/claude"; +import type { UsageFetchContext } from "@oh-my-pi/pi-ai/usage"; +import { claudeUsageProvider } from "@oh-my-pi/pi-ai/usage/claude"; function getHeaderCaseInsensitive( headers: Headers | Record> | string[][] | undefined, diff --git a/packages/ai/test/claude-usage-retry.test.ts b/packages/ai/test/claude-usage-retry.test.ts index 91c11141f..52377a412 100644 --- a/packages/ai/test/claude-usage-retry.test.ts +++ b/packages/ai/test/claude-usage-retry.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import type { UsageFetchContext } from "../src/usage"; -import { claudeUsageProvider } from "../src/usage/claude"; +import type { UsageFetchContext } from "@oh-my-pi/pi-ai/usage"; +import { claudeUsageProvider } from "@oh-my-pi/pi-ai/usage/claude"; const VALID_PAYLOAD = { five_hour: { utilization: 42, resets_at: new Date(Date.now() + 5 * 60_000).toISOString() }, diff --git a/packages/ai/test/cursor-exec-handlers.test.ts b/packages/ai/test/cursor-exec-handlers.test.ts index b0ec0af0b..a11c9563c 100644 --- a/packages/ai/test/cursor-exec-handlers.test.ts +++ b/packages/ai/test/cursor-exec-handlers.test.ts @@ -4,9 +4,9 @@ import { buildCursorSystemPromptJsons, resolveExecHandler, streamCursor, -} from "../src/providers/cursor"; -import type { AgentRunRequest } from "../src/providers/cursor/gen/agent_pb"; -import type { Context, Model } from "../src/types"; +} from "@oh-my-pi/pi-ai/providers/cursor"; +import type { AgentRunRequest } from "@oh-my-pi/pi-ai/providers/cursor/gen/agent_pb"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const cursorModel: Model<"cursor-agent"> = { id: "cursor-composer-2.5", diff --git a/packages/ai/test/deepseek-reasoning-content.test.ts b/packages/ai/test/deepseek-reasoning-content.test.ts index 180885e4d..b8aebf8cf 100644 --- a/packages/ai/test/deepseek-reasoning-content.test.ts +++ b/packages/ai/test/deepseek-reasoning-content.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { convertMessages, detectCompat } from "../src/providers/openai-completions"; -import type { AssistantMessage, Model, ThinkingContent, ToolCall } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { convertMessages, detectCompat } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { AssistantMessage, Model, ThinkingContent, ToolCall } from "@oh-my-pi/pi-ai/types"; function deepseekModel(overrides: Partial>): Model<"openai-completions"> { return { diff --git a/packages/ai/test/event-stream.test.ts b/packages/ai/test/event-stream.test.ts index ff701ff44..0d9c97a8b 100644 --- a/packages/ai/test/event-stream.test.ts +++ b/packages/ai/test/event-stream.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import type { AssistantMessage } from "../src/types"; -import { AssistantMessageEventStream } from "../src/utils/event-stream"; +import type { AssistantMessage } from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; function createPartial(text = ""): AssistantMessage { return { diff --git a/packages/ai/test/firepass.live.ts b/packages/ai/test/firepass.live.ts index 058492ba1..2a678ef70 100644 --- a/packages/ai/test/firepass.live.ts +++ b/packages/ai/test/firepass.live.ts @@ -8,9 +8,9 @@ * 2. The PR #1199 P2 fix (xhigh → max) actually clears the wire — without * the mapping Fireworks 400s the request. */ -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const apiKey = process.env.FIREPASS_API_KEY; if (!apiKey) { diff --git a/packages/ai/test/firepass.test.ts b/packages/ai/test/firepass.test.ts index fdfa5a2c7..b6b8a9e72 100644 --- a/packages/ai/test/firepass.test.ts +++ b/packages/ai/test/firepass.test.ts @@ -7,9 +7,9 @@ * form at request time. */ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/github-copilot-anthropic-auth.test.ts b/packages/ai/test/github-copilot-anthropic-auth.test.ts index bdb37ca7d..b1918e458 100644 --- a/packages/ai/test/github-copilot-anthropic-auth.test.ts +++ b/packages/ai/test/github-copilot-anthropic-auth.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { buildAnthropicClientOptions, streamAnthropic } from "../src/providers/anthropic"; -import { OPENCODE_HEADERS } from "../src/registry/oauth/github-copilot"; -import type { Context, Model } from "../src/types"; -import { buildAnthropicUrl } from "../src/utils/anthropic-auth"; +import { buildAnthropicClientOptions, streamAnthropic } from "@oh-my-pi/pi-ai/providers/anthropic"; +import { OPENCODE_HEADERS } from "@oh-my-pi/pi-ai/registry/oauth/github-copilot"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; +import { buildAnthropicUrl } from "@oh-my-pi/pi-ai/utils/anthropic-auth"; const originalFetch = global.fetch; diff --git a/packages/ai/test/github-copilot-error.test.ts b/packages/ai/test/github-copilot-error.test.ts index fe451f7cb..e7fce6edb 100644 --- a/packages/ai/test/github-copilot-error.test.ts +++ b/packages/ai/test/github-copilot-error.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { rewriteCopilotError } from "../src/utils/http-inspector"; +import { rewriteCopilotError } from "@oh-my-pi/pi-ai/utils/http-inspector"; function errorWithStatus(status: number): Error { const err = new Error(`${status} Unauthorized`); diff --git a/packages/ai/test/github-copilot-headers.test.ts b/packages/ai/test/github-copilot-headers.test.ts index d0257e3b1..f293a50f6 100644 --- a/packages/ai/test/github-copilot-headers.test.ts +++ b/packages/ai/test/github-copilot-headers.test.ts @@ -1,13 +1,13 @@ import { describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; import { buildCopilotDynamicHeaders, getCopilotInitiatorOverride, getCopilotPremiumMultiplier, hasCopilotVisionInput, inferCopilotInitiator, -} from "../src/providers/github-copilot-headers"; -import type { Message } from "../src/types"; +} from "@oh-my-pi/pi-ai/providers/github-copilot-headers"; +import type { Message } from "@oh-my-pi/pi-ai/types"; describe("inferCopilotInitiator", () => { it("returns 'user' when there are no messages", () => { diff --git a/packages/ai/test/github-copilot-login.test.ts b/packages/ai/test/github-copilot-login.test.ts index 2f80b17d7..5f2ca2faa 100644 --- a/packages/ai/test/github-copilot-login.test.ts +++ b/packages/ai/test/github-copilot-login.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { loginGitHubCopilot } from "../src/registry/oauth/github-copilot"; +import { loginGitHubCopilot } from "@oh-my-pi/pi-ai/registry/oauth/github-copilot"; const originalFetch = global.fetch; const FAST_POLL_OPTIONS = { pollIntervalFloorMs: 0, pollIntervalScaleMs: 1 } as const; diff --git a/packages/ai/test/github-copilot-model-limits.test.ts b/packages/ai/test/github-copilot-model-limits.test.ts index 07d76ee87..20e6248e5 100644 --- a/packages/ai/test/github-copilot-model-limits.test.ts +++ b/packages/ai/test/github-copilot-model-limits.test.ts @@ -2,10 +2,10 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { Effort } from "../src/effort"; -import { createModelManager } from "../src/model-manager"; -import { getBundledModel } from "../src/models"; -import { githubCopilotModelManagerOptions } from "../src/provider-models/openai-compat"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { createModelManager } from "@oh-my-pi/pi-ai/model-manager"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { githubCopilotModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; const originalFetch = global.fetch; diff --git a/packages/ai/test/github-copilot-oauth.test.ts b/packages/ai/test/github-copilot-oauth.test.ts index ca3b43cc8..36a44ee84 100644 --- a/packages/ai/test/github-copilot-oauth.test.ts +++ b/packages/ai/test/github-copilot-oauth.test.ts @@ -3,7 +3,7 @@ import { getGitHubCopilotBaseUrl, normalizeGitHubCopilotEnterpriseDomain, parseGitHubCopilotApiKey, -} from "../src/registry/oauth/github-copilot"; +} from "@oh-my-pi/pi-ai/registry/oauth/github-copilot"; describe("GitHub Copilot OAuth helpers", () => { it("treats github.com as the public Copilot host", () => { diff --git a/packages/ai/test/github-copilot-openai-base-url.test.ts b/packages/ai/test/github-copilot-openai-base-url.test.ts index 65d9f6520..930e33188 100644 --- a/packages/ai/test/github-copilot-openai-base-url.test.ts +++ b/packages/ai/test/github-copilot-openai-base-url.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import { streamOpenAIResponses } from "../src/providers/openai-responses"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import { streamOpenAIResponses } from "@oh-my-pi/pi-ai/providers/openai-responses"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/github-copilot-reasoning.test.ts b/packages/ai/test/github-copilot-reasoning.test.ts index 28746c85d..c8b5adac8 100644 --- a/packages/ai/test/github-copilot-reasoning.test.ts +++ b/packages/ai/test/github-copilot-reasoning.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from "bun:test"; -import { Effort } from "../src/effort"; -import { getBundledModel } from "../src/models"; -import { streamAnthropic } from "../src/providers/anthropic"; -import { streamOpenAIResponses } from "../src/providers/openai-responses"; -import type { Context, Model } from "../src/types"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamAnthropic } from "@oh-my-pi/pi-ai/providers/anthropic"; +import { streamOpenAIResponses } from "@oh-my-pi/pi-ai/providers/openai-responses"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const testContext: Context = { messages: [{ role: "user", content: "hello", timestamp: Date.now() }], diff --git a/packages/ai/test/google-antigravity-usage.test.ts b/packages/ai/test/google-antigravity-usage.test.ts index 4fdec1ae0..fac79ba27 100644 --- a/packages/ai/test/google-antigravity-usage.test.ts +++ b/packages/ai/test/google-antigravity-usage.test.ts @@ -5,8 +5,8 @@ * different model entries, and handles mixed-case tier names. */ import { describe, expect, it } from "bun:test"; -import type { UsageFetchContext, UsageFetchParams } from "../src/usage"; -import { antigravityUsageProvider } from "../src/usage/google-antigravity"; +import type { UsageFetchContext, UsageFetchParams } from "@oh-my-pi/pi-ai/usage"; +import { antigravityUsageProvider } from "@oh-my-pi/pi-ai/usage/google-antigravity"; const accessTokenFixture = (() => { const header = Buffer.from(JSON.stringify({ alg: "none", typ: "JWT" })).toString("base64url"); diff --git a/packages/ai/test/google-gemini-cli-3x-thinking.test.ts b/packages/ai/test/google-gemini-cli-3x-thinking.test.ts index 9e1caf756..117e3aba5 100644 --- a/packages/ai/test/google-gemini-cli-3x-thinking.test.ts +++ b/packages/ai/test/google-gemini-cli-3x-thinking.test.ts @@ -1,9 +1,9 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; import { Effort } from "@oh-my-pi/pi-ai"; import { enrichModelThinking } from "@oh-my-pi/pi-ai/model-thinking"; +import { streamSimple } from "@oh-my-pi/pi-ai/stream"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; import { hookFetch } from "@oh-my-pi/pi-utils"; -import { streamSimple } from "../src/stream"; -import type { Context, Model } from "../src/types"; interface GeminiCliThinkingConfig { thinkingLevel?: string; diff --git a/packages/ai/test/google-gemini-cli-alignment.test.ts b/packages/ai/test/google-gemini-cli-alignment.test.ts index e27572491..a2367454c 100644 --- a/packages/ai/test/google-gemini-cli-alignment.test.ts +++ b/packages/ai/test/google-gemini-cli-alignment.test.ts @@ -1,15 +1,15 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { hookFetch } from "@oh-my-pi/pi-utils"; -import * as geminiCliProvider from "../src/providers/google-gemini-cli"; +import * as geminiCliProvider from "@oh-my-pi/pi-ai/providers/google-gemini-cli"; import { ANTIGRAVITY_SYSTEM_INSTRUCTION, buildRequest, parseGeminiCliCredentials, shouldRefreshGeminiCliCredentials, streamGoogleGeminiCli, -} from "../src/providers/google-gemini-cli"; -import { getOAuthApiKey } from "../src/registry/oauth"; -import type { Context, Model, TJsonSchema } from "../src/types"; +} from "@oh-my-pi/pi-ai/providers/google-gemini-cli"; +import { getOAuthApiKey } from "@oh-my-pi/pi-ai/registry/oauth"; +import type { Context, Model, TJsonSchema } from "@oh-my-pi/pi-ai/types"; +import { hookFetch } from "@oh-my-pi/pi-utils"; function createModel(provider: "google-gemini-cli" | "google-antigravity"): Model<"google-gemini-cli"> { return { diff --git a/packages/ai/test/google-tool-choice.test.ts b/packages/ai/test/google-tool-choice.test.ts index f8fd5e09a..aeac29875 100644 --- a/packages/ai/test/google-tool-choice.test.ts +++ b/packages/ai/test/google-tool-choice.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { buildGoogleGenerateContentParams } from "@oh-my-pi/pi-ai/providers/google-shared"; +import { mapGoogleToolChoice } from "@oh-my-pi/pi-ai/stream"; import type { Context, Tool, ToolChoice } from "@oh-my-pi/pi-ai/types"; -import { buildGoogleGenerateContentParams } from "../src/providers/google-shared"; -import { mapGoogleToolChoice } from "../src/stream"; describe("mapGoogleToolChoice (F7)", () => { it("returns string passthrough for auto/none/any", () => { diff --git a/packages/ai/test/google-vertex-discovery.test.ts b/packages/ai/test/google-vertex-discovery.test.ts index 7a4471f87..f7c2780b2 100644 --- a/packages/ai/test/google-vertex-discovery.test.ts +++ b/packages/ai/test/google-vertex-discovery.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { resolveProviderModels } from "../src/model-manager"; -import { googleVertexModelManagerOptions } from "../src/provider-models/google"; -import { MODELS_DEV_PROVIDER_DESCRIPTORS, mapModelsDevToModels } from "../src/provider-models/openai-compat"; +import { resolveProviderModels } from "@oh-my-pi/pi-ai/model-manager"; +import { googleVertexModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/google"; +import { MODELS_DEV_PROVIDER_DESCRIPTORS, mapModelsDevToModels } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; const googleVertexModelsDevPayload = { "google-vertex": { diff --git a/packages/ai/test/issue-1203-repro.test.ts b/packages/ai/test/issue-1203-repro.test.ts index 48a856013..0a6b3fc52 100644 --- a/packages/ai/test/issue-1203-repro.test.ts +++ b/packages/ai/test/issue-1203-repro.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/issue-1270-repro.test.ts b/packages/ai/test/issue-1270-repro.test.ts index 00d3914e1..1169b6b0c 100644 --- a/packages/ai/test/issue-1270-repro.test.ts +++ b/packages/ai/test/issue-1270-repro.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { __resetVertexTokenCache } from "../src/providers/google-auth"; -import { streamGoogleVertex } from "../src/providers/google-vertex"; -import type { Model } from "../src/types"; +import { __resetVertexTokenCache } from "@oh-my-pi/pi-ai/providers/google-auth"; +import { streamGoogleVertex } from "@oh-my-pi/pi-ai/providers/google-vertex"; +import type { Model } from "@oh-my-pi/pi-ai/types"; const OAUTH_TOKEN_URL = "https://oauth2.googleapis.com/token"; const METADATA_TOKEN_URL = "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"; diff --git a/packages/ai/test/issue-1373-repro.test.ts b/packages/ai/test/issue-1373-repro.test.ts index 88e855f4e..ce0e65111 100644 --- a/packages/ai/test/issue-1373-repro.test.ts +++ b/packages/ai/test/issue-1373-repro.test.ts @@ -1,7 +1,7 @@ import { afterAll, beforeAll, describe, expect, it } from "bun:test"; -import { Effort } from "../src/effort"; -import { streamBedrock } from "../src/providers/amazon-bedrock"; -import type { Context, Model } from "../src/types"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { streamBedrock } from "@oh-my-pi/pi-ai/providers/amazon-bedrock"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalSkipAuth = process.env.AWS_BEDROCK_SKIP_AUTH; diff --git a/packages/ai/test/issue-1399-repro.test.ts b/packages/ai/test/issue-1399-repro.test.ts index f03e74a90..fc523c553 100644 --- a/packages/ai/test/issue-1399-repro.test.ts +++ b/packages/ai/test/issue-1399-repro.test.ts @@ -2,10 +2,10 @@ import { describe, expect, it } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; +import { streamBedrock } from "@oh-my-pi/pi-ai/providers/amazon-bedrock"; +import { clearAwsCredentialCache } from "@oh-my-pi/pi-ai/providers/aws-credentials"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; import { hookFetch } from "@oh-my-pi/pi-utils"; -import { streamBedrock } from "../src/providers/amazon-bedrock"; -import { clearAwsCredentialCache } from "../src/providers/aws-credentials"; -import type { Context, Model } from "../src/types"; const model: Model<"bedrock-converse-stream"> = { id: "zai.glm-5", diff --git a/packages/ai/test/issue-1417-repro.test.ts b/packages/ai/test/issue-1417-repro.test.ts index 4ffa72f4c..ed1ffea12 100644 --- a/packages/ai/test/issue-1417-repro.test.ts +++ b/packages/ai/test/issue-1417-repro.test.ts @@ -2,9 +2,9 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { readModelCache } from "../src/model-cache"; -import { resolveProviderModels } from "../src/model-manager"; -import type { Model } from "../src/types"; +import { readModelCache } from "@oh-my-pi/pi-ai/model-cache"; +import { resolveProviderModels } from "@oh-my-pi/pi-ai/model-manager"; +import type { Model } from "@oh-my-pi/pi-ai/types"; const TTL_MS = 24 * 60 * 60 * 1000; diff --git a/packages/ai/test/issue-1617-repro.test.ts b/packages/ai/test/issue-1617-repro.test.ts index 84e546340..6caf43635 100644 --- a/packages/ai/test/issue-1617-repro.test.ts +++ b/packages/ai/test/issue-1617-repro.test.ts @@ -19,7 +19,7 @@ import { type ModelsDevModel, opencodeGoModelManagerOptions, opencodeZenModelManagerOptions, -} from "../src/provider-models/openai-compat"; +} from "@oh-my-pi/pi-ai/provider-models/openai-compat"; const OPENCODE_ZEN_BASE = "https://opencode.ai/zen/v1"; const OPENCODE_GO_BASE = "https://opencode.ai/zen/go/v1"; diff --git a/packages/ai/test/issue-1776-repro.test.ts b/packages/ai/test/issue-1776-repro.test.ts index 0a32dcdd8..f929221ff 100644 --- a/packages/ai/test/issue-1776-repro.test.ts +++ b/packages/ai/test/issue-1776-repro.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/issue-1838-repro.test.ts b/packages/ai/test/issue-1838-repro.test.ts index a7df4c00a..12e51a374 100644 --- a/packages/ai/test/issue-1838-repro.test.ts +++ b/packages/ai/test/issue-1838-repro.test.ts @@ -33,9 +33,9 @@ * own native format and would reject the extra key. */ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { AssistantMessage, Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { AssistantMessage, Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/issue-1846-repro.test.ts b/packages/ai/test/issue-1846-repro.test.ts index d508991b1..39df0d735 100644 --- a/packages/ai/test/issue-1846-repro.test.ts +++ b/packages/ai/test/issue-1846-repro.test.ts @@ -1,11 +1,11 @@ import { Database } from "bun:sqlite"; import { afterEach, describe, expect, it, vi } from "bun:test"; -import { AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; -import { xiaomiModelManagerOptions } from "../src/provider-models/openai-compat"; -import { convertMessages, detectCompat } from "../src/providers/openai-completions"; -import { getOAuthProviders } from "../src/registry/oauth"; -import type { AssistantMessage, Model, ThinkingContent, ToolCall } from "../src/types"; +import { AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; +import { xiaomiModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; +import { convertMessages, detectCompat } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import { getOAuthProviders } from "@oh-my-pi/pi-ai/registry/oauth"; +import type { AssistantMessage, Model, ThinkingContent, ToolCall } from "@oh-my-pi/pi-ai/types"; const TP_KEY = "tp-ci1p8t1w4e1sbxgyc8v65tnrjbzro287igmvyf25van9mt76"; const SGP_BASE_URL = "https://token-plan-sgp.xiaomimimo.com/v1"; diff --git a/packages/ai/test/issue-1849-repro.test.ts b/packages/ai/test/issue-1849-repro.test.ts index 105e4539e..63a912fd7 100644 --- a/packages/ai/test/issue-1849-repro.test.ts +++ b/packages/ai/test/issue-1849-repro.test.ts @@ -13,12 +13,12 @@ * generator regenerates. */ import { describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; import { clampFireworksKimiMaxTokens, FIREWORKS_KIMI_MAX_TOKENS, isFireworksKimiK2ModelId, -} from "../src/provider-models/openai-compat"; +} from "@oh-my-pi/pi-ai/provider-models/openai-compat"; describe("Fireworks Kimi K2 maxTokens cap (#1849)", () => { it("recognizes Kimi K2.x public and wire ids", () => { diff --git a/packages/ai/test/issue-2080-repro.test.ts b/packages/ai/test/issue-2080-repro.test.ts index e3d6c3dbe..36f9c657f 100644 --- a/packages/ai/test/issue-2080-repro.test.ts +++ b/packages/ai/test/issue-2080-repro.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/issue-772-repro.test.ts b/packages/ai/test/issue-772-repro.test.ts index 13fb334f5..76594649d 100644 --- a/packages/ai/test/issue-772-repro.test.ts +++ b/packages/ai/test/issue-772-repro.test.ts @@ -1,9 +1,8 @@ import { describe, expect, it } from "bun:test"; +import { xiaomiModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; +import { loginXiaomi } from "@oh-my-pi/pi-ai/registry/oauth/xiaomi"; import { hookFetch } from "@oh-my-pi/pi-utils"; -import { xiaomiModelManagerOptions } from "../src/provider-models/openai-compat"; -import { loginXiaomi } from "../src/registry/oauth/xiaomi"; - const TOKEN_PLAN_SGP_HOST = "token-plan-sgp.xiaomimimo.com"; const STANDARD_HOST = "api.xiaomimimo.com"; diff --git a/packages/ai/test/issue-826-repro.test.ts b/packages/ai/test/issue-826-repro.test.ts index dd78aeda0..7cb629cdf 100644 --- a/packages/ai/test/issue-826-repro.test.ts +++ b/packages/ai/test/issue-826-repro.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { Effort } from "../src/effort"; -import { streamAnthropic } from "../src/providers/anthropic"; -import type { Context, Model, Tool } from "../src/types"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { streamAnthropic } from "@oh-my-pi/pi-ai/providers/anthropic"; +import type { Context, Model, Tool } from "@oh-my-pi/pi-ai/types"; const baseModel: Model<"anthropic-messages"> = { id: "claude-sonnet-4-5", diff --git a/packages/ai/test/issue-830-repro.test.ts b/packages/ai/test/issue-830-repro.test.ts index 08444bf4c..4a6e53cb1 100644 --- a/packages/ai/test/issue-830-repro.test.ts +++ b/packages/ai/test/issue-830-repro.test.ts @@ -1,9 +1,9 @@ import { describe, expect, test } from "bun:test"; -import { DEFAULT_MODEL_PER_PROVIDER, PROVIDER_DESCRIPTORS } from "../src/provider-models/descriptors"; -import { MODELS_DEV_PROVIDER_DESCRIPTORS } from "../src/provider-models/openai-compat"; -import { getOAuthProviders } from "../src/registry/oauth"; -import { getEnvApiKey } from "../src/stream"; -import type { OpenAICompat } from "../src/types"; +import { DEFAULT_MODEL_PER_PROVIDER, PROVIDER_DESCRIPTORS } from "@oh-my-pi/pi-ai/provider-models/descriptors"; +import { MODELS_DEV_PROVIDER_DESCRIPTORS } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; +import { getOAuthProviders } from "@oh-my-pi/pi-ai/registry/oauth"; +import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream"; +import type { OpenAICompat } from "@oh-my-pi/pi-ai/types"; describe("deepseek built-in provider (issue #830)", () => { test("registers built-in runtime descriptor with DEEPSEEK_API_KEY env discovery", () => { diff --git a/packages/ai/test/issue-847-repro.test.ts b/packages/ai/test/issue-847-repro.test.ts index 684792ee2..fccf56034 100644 --- a/packages/ai/test/issue-847-repro.test.ts +++ b/packages/ai/test/issue-847-repro.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, test, vi } from "bun:test"; -import { ollamaModelManagerOptions } from "../src/provider-models/openai-compat"; +import { ollamaModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; const originalFetch = global.fetch; diff --git a/packages/ai/test/issue-883-repro.test.ts b/packages/ai/test/issue-883-repro.test.ts index 236a99f2b..c0710ecb0 100644 --- a/packages/ai/test/issue-883-repro.test.ts +++ b/packages/ai/test/issue-883-repro.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { convertMessages, detectCompat } from "../src/providers/openai-completions"; -import type { AssistantMessage, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { convertMessages, detectCompat } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { AssistantMessage, Model } from "@oh-my-pi/pi-ai/types"; function deepseekModel(overrides: Partial>): Model<"openai-completions"> { return { diff --git a/packages/ai/test/issue-887-repro.test.ts b/packages/ai/test/issue-887-repro.test.ts index 6e512b28c..463a3e56d 100644 --- a/packages/ai/test/issue-887-repro.test.ts +++ b/packages/ai/test/issue-887-repro.test.ts @@ -13,7 +13,7 @@ import { MODELS_DEV_PROVIDER_DESCRIPTORS, type ModelsDevModel, opencodeGoModelManagerOptions, -} from "../src/provider-models/openai-compat"; +} from "@oh-my-pi/pi-ai/provider-models/openai-compat"; const OPENCODE_GO_BASE = "https://opencode.ai/zen/go/v1"; diff --git a/packages/ai/test/issue-911-repro.test.ts b/packages/ai/test/issue-911-repro.test.ts index 4ca61123f..f039c8e58 100644 --- a/packages/ai/test/issue-911-repro.test.ts +++ b/packages/ai/test/issue-911-repro.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/issue-957-repro.test.ts b/packages/ai/test/issue-957-repro.test.ts index 019b499ba..d26e1f9ea 100644 --- a/packages/ai/test/issue-957-repro.test.ts +++ b/packages/ai/test/issue-957-repro.test.ts @@ -2,8 +2,8 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; -import * as kimiOauth from "../src/registry/oauth/kimi"; +import { AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; +import * as kimiOauth from "@oh-my-pi/pi-ai/registry/oauth/kimi"; const originalFetch = global.fetch; diff --git a/packages/ai/test/issue-959-repro.test.ts b/packages/ai/test/issue-959-repro.test.ts index e652e06a1..87fe2219c 100644 --- a/packages/ai/test/issue-959-repro.test.ts +++ b/packages/ai/test/issue-959-repro.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/issue-967-vision-guard.test.ts b/packages/ai/test/issue-967-vision-guard.test.ts index c6a127dc6..607b7d9bf 100644 --- a/packages/ai/test/issue-967-vision-guard.test.ts +++ b/packages/ai/test/issue-967-vision-guard.test.ts @@ -1,15 +1,15 @@ import { describe, expect, it } from "bun:test"; -import { convertAnthropicMessages } from "../src/providers/anthropic"; -import { convertMessages as convertGoogleMessages } from "../src/providers/google-shared"; -import { convertCodexResponsesMessages } from "../src/providers/openai-codex-responses"; -import { convertMessages as convertOpenAICompletionsMessages } from "../src/providers/openai-completions"; -import type { ResolvedOpenAICompat } from "../src/providers/openai-completions-compat"; +import { convertAnthropicMessages } from "@oh-my-pi/pi-ai/providers/anthropic"; +import { convertMessages as convertGoogleMessages } from "@oh-my-pi/pi-ai/providers/google-shared"; +import { convertCodexResponsesMessages } from "@oh-my-pi/pi-ai/providers/openai-codex-responses"; +import { convertMessages as convertOpenAICompletionsMessages } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { ResolvedOpenAICompat } from "@oh-my-pi/pi-ai/providers/openai-completions-compat"; import { appendResponsesToolResultMessages, convertResponsesInputContent, -} from "../src/providers/openai-responses-shared"; -import { NON_VISION_IMAGE_PLACEHOLDER } from "../src/providers/vision-guard"; -import type { Api, AssistantMessage, Context, Model, ToolResultMessage, Usage } from "../src/types"; +} from "@oh-my-pi/pi-ai/providers/openai-responses-shared"; +import { NON_VISION_IMAGE_PLACEHOLDER } from "@oh-my-pi/pi-ai/providers/vision-guard"; +import type { Api, AssistantMessage, Context, Model, ToolResultMessage, Usage } from "@oh-my-pi/pi-ai/types"; const emptyUsage: Usage = { input: 0, diff --git a/packages/ai/test/issue-969-repro.test.ts b/packages/ai/test/issue-969-repro.test.ts index 9f42a85bb..c33749f92 100644 --- a/packages/ai/test/issue-969-repro.test.ts +++ b/packages/ai/test/issue-969-repro.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { Effort } from "../src/effort"; -import { getSupportedEfforts } from "../src/model-thinking"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { getSupportedEfforts } from "@oh-my-pi/pi-ai/model-thinking"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/issue-976-repro.test.ts b/packages/ai/test/issue-976-repro.test.ts index 5e088d0f9..743358a06 100644 --- a/packages/ai/test/issue-976-repro.test.ts +++ b/packages/ai/test/issue-976-repro.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { buildRequest } from "../src/providers/google-gemini-cli"; -import type { Context, Model } from "../src/types"; +import { buildRequest } from "@oh-my-pi/pi-ai/providers/google-gemini-cli"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; function createModel(): Model<"google-gemini-cli"> { return { diff --git a/packages/ai/test/kagi-login.test.ts b/packages/ai/test/kagi-login.test.ts index a73d7beca..1bbe75f6c 100644 --- a/packages/ai/test/kagi-login.test.ts +++ b/packages/ai/test/kagi-login.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { loginKagi } from "../src/registry/kagi"; +import { loginKagi } from "@oh-my-pi/pi-ai/registry/kagi"; describe("kagi login", () => { it("opens Kagi API settings and prompts for key", async () => { diff --git a/packages/ai/test/kilo-login.test.ts b/packages/ai/test/kilo-login.test.ts index 315cd7df9..23e22d91d 100644 --- a/packages/ai/test/kilo-login.test.ts +++ b/packages/ai/test/kilo-login.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { loginKilo } from "../src/registry/kilo"; +import { loginKilo } from "@oh-my-pi/pi-ai/registry/kilo"; const originalFetch = global.fetch; diff --git a/packages/ai/test/minimax-code-login.test.ts b/packages/ai/test/minimax-code-login.test.ts index 3ec6ca8bf..754783112 100644 --- a/packages/ai/test/minimax-code-login.test.ts +++ b/packages/ai/test/minimax-code-login.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; +import { loginMiniMaxCode, loginMiniMaxCodeCn } from "@oh-my-pi/pi-ai/registry/oauth/minimax-code"; import { hookFetch } from "@oh-my-pi/pi-utils"; -import { loginMiniMaxCode, loginMiniMaxCodeCn } from "../src/registry/oauth/minimax-code"; describe("MiniMax Coding Plan login", () => { it("opens the international platform and validates against the international API", async () => { diff --git a/packages/ai/test/mock-provider.test.ts b/packages/ai/test/mock-provider.test.ts index bdd189b3a..249b6edf8 100644 --- a/packages/ai/test/mock-provider.test.ts +++ b/packages/ai/test/mock-provider.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, test } from "bun:test"; -import { clearCustomApis, getCustomApi } from "../src/api-registry"; +import { clearCustomApis, getCustomApi } from "@oh-my-pi/pi-ai/api-registry"; import { createMockModel, isMockModel, @@ -8,8 +8,8 @@ import { type MockModel, registerMockApi, streamMock, -} from "../src/providers/mock"; -import type { AssistantMessage, AssistantMessageEvent, Context, ToolCall } from "../src/types"; +} from "@oh-my-pi/pi-ai/providers/mock"; +import type { AssistantMessage, AssistantMessageEvent, Context, ToolCall } from "@oh-my-pi/pi-ai/types"; afterEach(() => { clearCustomApis(); diff --git a/packages/ai/test/model-cache.test.ts b/packages/ai/test/model-cache.test.ts index 7ebd3a45f..25353f68a 100644 --- a/packages/ai/test/model-cache.test.ts +++ b/packages/ai/test/model-cache.test.ts @@ -3,8 +3,8 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { readModelCache, writeModelCache } from "../src/model-cache"; -import type { Model } from "../src/types"; +import { readModelCache, writeModelCache } from "@oh-my-pi/pi-ai/model-cache"; +import type { Model } from "@oh-my-pi/pi-ai/types"; const TTL_MS = 24 * 60 * 60 * 1000; diff --git a/packages/ai/test/models-cost.test.ts b/packages/ai/test/models-cost.test.ts index 07b80d523..b8787fa49 100644 --- a/packages/ai/test/models-cost.test.ts +++ b/packages/ai/test/models-cost.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { calculateCost, getBundledModel } from "../src/models"; -import type { Usage } from "../src/types"; +import { calculateCost, getBundledModel } from "@oh-my-pi/pi-ai/models"; +import type { Usage } from "@oh-my-pi/pi-ai/types"; describe("calculateCost", () => { it("keeps token-based calculation for GitHub Copilot models", () => { diff --git a/packages/ai/test/models-json-no-local-endpoints.test.ts b/packages/ai/test/models-json-no-local-endpoints.test.ts index 614bb135b..0757d26a6 100644 --- a/packages/ai/test/models-json-no-local-endpoints.test.ts +++ b/packages/ai/test/models-json-no-local-endpoints.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; +import type { Model } from "@oh-my-pi/pi-ai/types"; import MODELS_JSON from "../src/models.json" with { type: "json" }; -import type { Model } from "../src/types"; // Pins the invariant: the committed `models.json` must never carry a // local/self-hosted provider's catalog. Those providers default to an endpoint diff --git a/packages/ai/test/nanogpt-login.test.ts b/packages/ai/test/nanogpt-login.test.ts index f67bea46d..0b301b18d 100644 --- a/packages/ai/test/nanogpt-login.test.ts +++ b/packages/ai/test/nanogpt-login.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { loginNanoGPT } from "../src/registry/nanogpt"; +import { loginNanoGPT } from "@oh-my-pi/pi-ai/registry/nanogpt"; const originalFetch = global.fetch; diff --git a/packages/ai/test/nanogpt-model-limits.test.ts b/packages/ai/test/nanogpt-model-limits.test.ts index 0270b18ff..512a74970 100644 --- a/packages/ai/test/nanogpt-model-limits.test.ts +++ b/packages/ai/test/nanogpt-model-limits.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { Effort } from "../src/effort"; -import { nanoGptModelManagerOptions } from "../src/provider-models/openai-compat"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { nanoGptModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; const originalFetch = global.fetch; diff --git a/packages/ai/test/oauth-deepseek.test.ts b/packages/ai/test/oauth-deepseek.test.ts index acc1e3676..3ecf301be 100644 --- a/packages/ai/test/oauth-deepseek.test.ts +++ b/packages/ai/test/oauth-deepseek.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { loginDeepSeek, normalizeDeepSeekApiKey } from "../src/registry/deepseek"; -import type { OAuthController } from "../src/registry/oauth/types"; +import { loginDeepSeek, normalizeDeepSeekApiKey } from "@oh-my-pi/pi-ai/registry/deepseek"; +import type { OAuthController } from "@oh-my-pi/pi-ai/registry/oauth/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/ollama-cloud-login.test.ts b/packages/ai/test/ollama-cloud-login.test.ts index 90fc695ab..a6b1a2b54 100644 --- a/packages/ai/test/ollama-cloud-login.test.ts +++ b/packages/ai/test/ollama-cloud-login.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { loginOllamaCloud } from "../src/registry/ollama-cloud"; +import { loginOllamaCloud } from "@oh-my-pi/pi-ai/registry/ollama-cloud"; describe("ollama cloud login", () => { it("opens Ollama Cloud key settings and trims the pasted key", async () => { diff --git a/packages/ai/test/ollama-cloud-provider.test.ts b/packages/ai/test/ollama-cloud-provider.test.ts index cf5c6c383..033b7b8de 100644 --- a/packages/ai/test/ollama-cloud-provider.test.ts +++ b/packages/ai/test/ollama-cloud-provider.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, test, vi } from "bun:test"; -import { ollamaCloudModelManagerOptions } from "../src/provider-models/ollama"; -import { completeSimple, getEnvApiKey, stream, streamSimple } from "../src/stream"; -import type { Context, Model, Tool } from "../src/types"; +import { ollamaCloudModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/ollama"; +import { completeSimple, getEnvApiKey, stream, streamSimple } from "@oh-my-pi/pi-ai/stream"; +import type { Context, Model, Tool } from "@oh-my-pi/pi-ai/types"; const originalApiKey = Bun.env.OLLAMA_CLOUD_API_KEY; const originalFetch = global.fetch; diff --git a/packages/ai/test/ollama-provider.test.ts b/packages/ai/test/ollama-provider.test.ts index 4fa4866c2..ccf7ec666 100644 --- a/packages/ai/test/ollama-provider.test.ts +++ b/packages/ai/test/ollama-provider.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, test, vi } from "bun:test"; -import { Effort } from "../src/effort"; -import { ollamaModelManagerOptions } from "../src/provider-models/openai-compat"; -import { streamOllama } from "../src/providers/ollama"; -import type { Context, Model, Tool } from "../src/types"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { ollamaModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; +import { streamOllama } from "@oh-my-pi/pi-ai/providers/ollama"; +import type { Context, Model, Tool } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/openai-codex-usage.test.ts b/packages/ai/test/openai-codex-usage.test.ts index 626646402..f7f927a9d 100644 --- a/packages/ai/test/openai-codex-usage.test.ts +++ b/packages/ai/test/openai-codex-usage.test.ts @@ -7,7 +7,7 @@ * widget lose per-model visibility. */ import { describe, expect, it } from "bun:test"; -import { openaiCodexUsageProvider } from "../src/usage/openai-codex"; +import { openaiCodexUsageProvider } from "@oh-my-pi/pi-ai/usage/openai-codex"; const accessTokenFixture = (() => { const header = Buffer.from(JSON.stringify({ alg: "none", typ: "JWT" })).toString("base64url"); diff --git a/packages/ai/test/openai-completions-compat.test.ts b/packages/ai/test/openai-completions-compat.test.ts index da047b421..c26b35bc4 100644 --- a/packages/ai/test/openai-completions-compat.test.ts +++ b/packages/ai/test/openai-completions-compat.test.ts @@ -1,13 +1,13 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; import { applyOpenRouterRoutingVariant, convertMessages, detectCompat, streamOpenAICompletions, -} from "../src/providers/openai-completions"; -import { type ResolvedOpenAICompat, resolveOpenAICompat } from "../src/providers/openai-completions-compat"; -import type { AssistantMessage, Context, Model, OpenAICompat } from "../src/types"; +} from "@oh-my-pi/pi-ai/providers/openai-completions"; +import { type ResolvedOpenAICompat, resolveOpenAICompat } from "@oh-my-pi/pi-ai/providers/openai-completions-compat"; +import type { AssistantMessage, Context, Model, OpenAICompat } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/openai-completions-disable-reasoning.test.ts b/packages/ai/test/openai-completions-disable-reasoning.test.ts index 629a74887..4d3e4d19c 100644 --- a/packages/ai/test/openai-completions-disable-reasoning.test.ts +++ b/packages/ai/test/openai-completions-disable-reasoning.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { Effort } from "../src/effort"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { Effort } from "@oh-my-pi/pi-ai/effort"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/openai-completions-progress-chunk.test.ts b/packages/ai/test/openai-completions-progress-chunk.test.ts index 7d6a7766f..db4b1058d 100644 --- a/packages/ai/test/openai-completions-progress-chunk.test.ts +++ b/packages/ai/test/openai-completions-progress-chunk.test.ts @@ -1,11 +1,11 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; import { getOpenAICompletionsStreamIdleTimeoutFallbackMs, isOpenAICompletionsProgressChunk, streamOpenAICompletions, -} from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +} from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/openai-first-event-timeout.test.ts b/packages/ai/test/openai-first-event-timeout.test.ts index d23dc868f..4886cf79c 100644 --- a/packages/ai/test/openai-first-event-timeout.test.ts +++ b/packages/ai/test/openai-first-event-timeout.test.ts @@ -1,10 +1,10 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamAzureOpenAIResponses } from "../src/providers/azure-openai-responses"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import { streamOpenAIResponses } from "../src/providers/openai-responses"; -import { streamSimple } from "../src/stream"; -import type { Context, Model, TextContent } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamAzureOpenAIResponses } from "@oh-my-pi/pi-ai/providers/azure-openai-responses"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import { streamOpenAIResponses } from "@oh-my-pi/pi-ai/providers/openai-responses"; +import { streamSimple } from "@oh-my-pi/pi-ai/stream"; +import type { Context, Model, TextContent } from "@oh-my-pi/pi-ai/types"; import { waitForDelayOrAbort } from "./helpers"; const originalFetch = global.fetch; diff --git a/packages/ai/test/openai-responses-cache-affinity.test.ts b/packages/ai/test/openai-responses-cache-affinity.test.ts index 9d9622502..8cd6d2fc7 100644 --- a/packages/ai/test/openai-responses-cache-affinity.test.ts +++ b/packages/ai/test/openai-responses-cache-affinity.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { type OpenAIResponsesOptions, streamOpenAIResponses } from "../src/providers/openai-responses"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { type OpenAIResponsesOptions, streamOpenAIResponses } from "@oh-my-pi/pi-ai/providers/openai-responses"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; const model = getBundledModel("openai", "gpt-5-mini") as Model<"openai-responses">; diff --git a/packages/ai/test/openai-responses-developer-role.test.ts b/packages/ai/test/openai-responses-developer-role.test.ts index e4f028a2c..6789f2e3b 100644 --- a/packages/ai/test/openai-responses-developer-role.test.ts +++ b/packages/ai/test/openai-responses-developer-role.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { supportsDeveloperRole } from "../src/providers/openai-responses"; -import type { Model } from "../src/types"; +import { supportsDeveloperRole } from "@oh-my-pi/pi-ai/providers/openai-responses"; +import type { Model } from "@oh-my-pi/pi-ai/types"; describe("supportsDeveloperRole", () => { it("returns true for openai provider with official API base URL", () => { diff --git a/packages/ai/test/openai-responses-history-payload.test.ts b/packages/ai/test/openai-responses-history-payload.test.ts index 4b86ab9d1..6b5020d1d 100644 --- a/packages/ai/test/openai-responses-history-payload.test.ts +++ b/packages/ai/test/openai-responses-history-payload.test.ts @@ -3,7 +3,7 @@ import { getBundledModel } from "@oh-my-pi/pi-ai/models"; import { streamOpenAICodexResponses } from "@oh-my-pi/pi-ai/providers/openai-codex-responses"; import { type OpenAIResponsesOptions, streamOpenAIResponses } from "@oh-my-pi/pi-ai/providers/openai-responses"; import type { Context, Model, ProviderSessionState } from "@oh-my-pi/pi-ai/types"; -import { createOpenAIResponsesHistoryPayload, truncateResponseItemId } from "../src/utils"; +import { createOpenAIResponsesHistoryPayload, truncateResponseItemId } from "@oh-my-pi/pi-ai/utils"; function createAbortedSignal(): AbortSignal { const controller = new AbortController(); diff --git a/packages/ai/test/openai-responses-omit-max-output-tokens.test.ts b/packages/ai/test/openai-responses-omit-max-output-tokens.test.ts index a5dcb1537..423ffa78d 100644 --- a/packages/ai/test/openai-responses-omit-max-output-tokens.test.ts +++ b/packages/ai/test/openai-responses-omit-max-output-tokens.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamSimple } from "../src/stream"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamSimple } from "@oh-my-pi/pi-ai/stream"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/openai-responses-system-prompt.test.ts b/packages/ai/test/openai-responses-system-prompt.test.ts index 0f459da8e..970d6567f 100644 --- a/packages/ai/test/openai-responses-system-prompt.test.ts +++ b/packages/ai/test/openai-responses-system-prompt.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAIResponses } from "../src/providers/openai-responses"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAIResponses } from "@oh-my-pi/pi-ai/providers/openai-responses"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/openrouter-login.test.ts b/packages/ai/test/openrouter-login.test.ts index ec22d8e1c..f98dd21c2 100644 --- a/packages/ai/test/openrouter-login.test.ts +++ b/packages/ai/test/openrouter-login.test.ts @@ -1,8 +1,8 @@ import { Database } from "bun:sqlite"; import { afterEach, describe, expect, test, vi } from "bun:test"; -import { AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; -import { getOAuthProviders } from "../src/registry/oauth"; -import { getEnvApiKey } from "../src/stream"; +import { AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; +import { getOAuthProviders } from "@oh-my-pi/pi-ai/registry/oauth"; +import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream"; const originalOpenRouterApiKey = Bun.env.OPENROUTER_API_KEY; const originalFetch = global.fetch; diff --git a/packages/ai/test/parse-streaming-json-throttled.test.ts b/packages/ai/test/parse-streaming-json-throttled.test.ts index 9cd74ab6b..efe81683c 100644 --- a/packages/ai/test/parse-streaming-json-throttled.test.ts +++ b/packages/ai/test/parse-streaming-json-throttled.test.ts @@ -3,7 +3,7 @@ import { parseStreamingJson, parseStreamingJsonThrottled, STREAMING_JSON_PARSE_MIN_GROWTH, -} from "../src/utils/json-parse"; +} from "@oh-my-pi/pi-ai/utils/json-parse"; describe("parseStreamingJsonThrottled (F5)", () => { it("parses the first non-empty buffer even when growth is below the threshold", () => { diff --git a/packages/ai/test/pi-native-client.test.ts b/packages/ai/test/pi-native-client.test.ts index 2c8627454..9ccb9e38f 100644 --- a/packages/ai/test/pi-native-client.test.ts +++ b/packages/ai/test/pi-native-client.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, mock, spyOn } from "bun:test"; -import { streamPiNative } from "../src/providers/pi-native-client"; -import type { AssistantMessage, AssistantMessageEvent, Context, FetchImpl, Model } from "../src/types"; +import { streamPiNative } from "@oh-my-pi/pi-ai/providers/pi-native-client"; +import type { AssistantMessage, AssistantMessageEvent, Context, FetchImpl, Model } from "@oh-my-pi/pi-ai/types"; function sseBytes(events: AssistantMessageEvent[]): Uint8Array { const encoder = new TextEncoder(); diff --git a/packages/ai/test/provider-fetch-override.test.ts b/packages/ai/test/provider-fetch-override.test.ts index d16ddca8a..fdf174ed2 100644 --- a/packages/ai/test/provider-fetch-override.test.ts +++ b/packages/ai/test/provider-fetch-override.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import { streamOpenAIResponses } from "../src/providers/openai-responses"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import { streamOpenAIResponses } from "@oh-my-pi/pi-ai/providers/openai-responses"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/provider-registry.test.ts b/packages/ai/test/provider-registry.test.ts index ad6d9aa49..cd4391778 100644 --- a/packages/ai/test/provider-registry.test.ts +++ b/packages/ai/test/provider-registry.test.ts @@ -1,17 +1,17 @@ import { Database } from "bun:sqlite"; import { afterEach, describe, expect, test, vi } from "bun:test"; -import { AuthStorage, SqliteAuthCredentialStore } from "../src/auth-storage"; -import { DEFAULT_MODEL_PER_PROVIDER, PROVIDER_DESCRIPTORS } from "../src/provider-models/descriptors"; -import { PASTE_CODE_LOGIN_PROVIDERS } from "../src/registry"; +import { AuthStorage, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai/auth-storage"; +import { DEFAULT_MODEL_PER_PROVIDER, PROVIDER_DESCRIPTORS } from "@oh-my-pi/pi-ai/provider-models/descriptors"; +import { PASTE_CODE_LOGIN_PROVIDERS } from "@oh-my-pi/pi-ai/registry"; import { getOAuthProviders, refreshOAuthToken, registerOAuthProvider, unregisterOAuthProviders, -} from "../src/registry/oauth"; -import * as anthropicOauth from "../src/registry/oauth/anthropic"; -import type { OAuthCredentials, OAuthProvider } from "../src/registry/oauth/types"; -import { getEnvApiKey } from "../src/stream"; +} from "@oh-my-pi/pi-ai/registry/oauth"; +import * as anthropicOauth from "@oh-my-pi/pi-ai/registry/oauth/anthropic"; +import type { OAuthCredentials, OAuthProvider } from "@oh-my-pi/pi-ai/registry/oauth/types"; +import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream"; const FIXTURE_SOURCE = "provider-registry-test"; const ENV_KEYS = ["ZENMUX_API_KEY", "EXA_API_KEY"] as const; diff --git a/packages/ai/test/provider-response.test.ts b/packages/ai/test/provider-response.test.ts index f4d3cb393..14d4571fe 100644 --- a/packages/ai/test/provider-response.test.ts +++ b/packages/ai/test/provider-response.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamSimple } from "../src/stream"; -import type { Context, Model, ProviderResponseMetadata } from "../src/types"; -import { normalizeProviderResponse, notifyProviderResponse } from "../src/utils/provider-response"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamSimple } from "@oh-my-pi/pi-ai/stream"; +import type { Context, Model, ProviderResponseMetadata } from "@oh-my-pi/pi-ai/types"; +import { normalizeProviderResponse, notifyProviderResponse } from "@oh-my-pi/pi-ai/utils/provider-response"; describe("provider response metadata", () => { it("normalizes response status, headers, and request id", () => { diff --git a/packages/ai/test/raw-sse-sdk-capture.test.ts b/packages/ai/test/raw-sse-sdk-capture.test.ts index 02ab86e03..9df20c855 100644 --- a/packages/ai/test/raw-sse-sdk-capture.test.ts +++ b/packages/ai/test/raw-sse-sdk-capture.test.ts @@ -1,12 +1,12 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamAnthropic } from "../src/providers/anthropic"; -import type { AnthropicMessagesClientLike } from "../src/providers/anthropic-client"; -import type { RawMessageStreamEvent } from "../src/providers/anthropic-wire"; -import { streamAzureOpenAIResponses } from "../src/providers/azure-openai-responses"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import { streamOpenAIResponses } from "../src/providers/openai-responses"; -import type { Context, Model, RawSseEvent } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamAnthropic } from "@oh-my-pi/pi-ai/providers/anthropic"; +import type { AnthropicMessagesClientLike } from "@oh-my-pi/pi-ai/providers/anthropic-client"; +import type { RawMessageStreamEvent } from "@oh-my-pi/pi-ai/providers/anthropic-wire"; +import { streamAzureOpenAIResponses } from "@oh-my-pi/pi-ai/providers/azure-openai-responses"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import { streamOpenAIResponses } from "@oh-my-pi/pi-ai/providers/openai-responses"; +import type { Context, Model, RawSseEvent } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/register-builtins.test.ts b/packages/ai/test/register-builtins.test.ts index 8e6628786..9f7a6a389 100644 --- a/packages/ai/test/register-builtins.test.ts +++ b/packages/ai/test/register-builtins.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { setBedrockProviderModule, streamBedrock } from "../src/providers/register-builtins"; -import type { AssistantMessage, Context, Model } from "../src/types"; -import type { AssistantMessageEventStream } from "../src/utils/event-stream"; +import { setBedrockProviderModule, streamBedrock } from "@oh-my-pi/pi-ai/providers/register-builtins"; +import type { AssistantMessage, Context, Model } from "@oh-my-pi/pi-ai/types"; +import type { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; function createModel(): Model<"bedrock-converse-stream"> { return { diff --git a/packages/ai/test/remote-auth-store.test.ts b/packages/ai/test/remote-auth-store.test.ts index 6ce28b976..e1a6e2be6 100644 --- a/packages/ai/test/remote-auth-store.test.ts +++ b/packages/ai/test/remote-auth-store.test.ts @@ -10,8 +10,8 @@ import { RemoteAuthCredentialStore, SqliteAuthCredentialStore, startAuthBroker, -} from "../src"; -import * as oauthUtils from "../src/registry/oauth"; +} from "@oh-my-pi/pi-ai"; +import * as oauthUtils from "@oh-my-pi/pi-ai/registry/oauth"; const ANTHROPIC_ENV = ["ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN"] as const; const savedEnv: Partial> = {}; diff --git a/packages/ai/test/request-debug.test.ts b/packages/ai/test/request-debug.test.ts index dbe482054..22bbf57e7 100644 --- a/packages/ai/test/request-debug.test.ts +++ b/packages/ai/test/request-debug.test.ts @@ -2,12 +2,12 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; +import { clearCustomApis, registerCustomApi } from "@oh-my-pi/pi-ai/api-registry"; +import { stream } from "@oh-my-pi/pi-ai/stream"; +import type { AssistantMessage, FetchImpl, Model } from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { wrapFetchForRequestDebug } from "@oh-my-pi/pi-ai/utils/request-debug"; import { hookFetch } from "@oh-my-pi/pi-utils"; -import { clearCustomApis, registerCustomApi } from "../src/api-registry"; -import { stream } from "../src/stream"; -import type { AssistantMessage, FetchImpl, Model } from "../src/types"; -import { AssistantMessageEventStream } from "../src/utils/event-stream"; -import { wrapFetchForRequestDebug } from "../src/utils/request-debug"; const enc = new TextEncoder(); diff --git a/packages/ai/test/service-tier-premium-requests.test.ts b/packages/ai/test/service-tier-premium-requests.test.ts index ca4bb1f7c..43216b83b 100644 --- a/packages/ai/test/service-tier-premium-requests.test.ts +++ b/packages/ai/test/service-tier-premium-requests.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { getPriorityPremiumRequests, resolveServiceTier, shouldSendServiceTier } from "../src/types"; +import { getPriorityPremiumRequests, resolveServiceTier, shouldSendServiceTier } from "@oh-my-pi/pi-ai/types"; describe("getPriorityPremiumRequests", () => { it("counts priority tier as one premium request on OpenAI", () => { diff --git a/packages/ai/test/sse-debug.test.ts b/packages/ai/test/sse-debug.test.ts index bc839265b..00dc71881 100644 --- a/packages/ai/test/sse-debug.test.ts +++ b/packages/ai/test/sse-debug.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import type { RawSseEvent } from "../src/types"; -import { notifyRawSseEvent } from "../src/utils/sse-debug"; +import type { RawSseEvent } from "@oh-my-pi/pi-ai/types"; +import { notifyRawSseEvent } from "@oh-my-pi/pi-ai/utils/sse-debug"; describe("notifyRawSseEvent", () => { it("dispatches diagnostic events without cloning raw lines", () => { diff --git a/packages/ai/test/stream-markup-healing.test.ts b/packages/ai/test/stream-markup-healing.test.ts index 79b6b74b5..c7e6facac 100644 --- a/packages/ai/test/stream-markup-healing.test.ts +++ b/packages/ai/test/stream-markup-healing.test.ts @@ -1,9 +1,9 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import { stream } from "../src/stream"; -import type { Context, Model, Tool, ToolCall } from "../src/types"; -import { getStreamMarkupHealingPattern, StreamMarkupHealing } from "../src/utils/stream-markup-healing"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import { stream } from "@oh-my-pi/pi-ai/stream"; +import type { Context, Model, Tool, ToolCall } from "@oh-my-pi/pi-ai/types"; +import { getStreamMarkupHealingPattern, StreamMarkupHealing } from "@oh-my-pi/pi-ai/utils/stream-markup-healing"; const originalFetch = global.fetch; diff --git a/packages/ai/test/stream-timeout-defaults.test.ts b/packages/ai/test/stream-timeout-defaults.test.ts index ee22a94e4..3a75fb814 100644 --- a/packages/ai/test/stream-timeout-defaults.test.ts +++ b/packages/ai/test/stream-timeout-defaults.test.ts @@ -5,7 +5,7 @@ import { getStreamFirstEventTimeoutMs, getStreamIdleTimeoutMs, iterateWithIdleTimeout, -} from "../src/utils/idle-iterator"; +} from "@oh-my-pi/pi-ai/utils/idle-iterator"; /** * Per-provider fallback overrides on the stream-watchdog helpers. diff --git a/packages/ai/test/stream.test.ts b/packages/ai/test/stream.test.ts index 3d5325d42..16b08a72d 100644 --- a/packages/ai/test/stream.test.ts +++ b/packages/ai/test/stream.test.ts @@ -5,11 +5,11 @@ import * as os from "node:os"; import * as path from "node:path"; import { Effort } from "@oh-my-pi/pi-ai"; import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { __resetVertexTokenCache } from "@oh-my-pi/pi-ai/providers/google-auth"; import { complete, getEnvApiKey, stream } from "@oh-my-pi/pi-ai/stream"; import type { Api, Context, ImageContent, Model, OptionsForApi, Tool, ToolResultMessage } from "@oh-my-pi/pi-ai/types"; import { $which } from "@oh-my-pi/pi-utils"; import * as z from "zod/v4"; -import { __resetVertexTokenCache } from "../src/providers/google-auth"; import { e2eApiKey, resolveApiKey } from "./oauth"; // Resolve OAuth tokens at module level (async, runs before tests) diff --git a/packages/ai/test/synthetic-login.test.ts b/packages/ai/test/synthetic-login.test.ts index 00f225de9..2820360dd 100644 --- a/packages/ai/test/synthetic-login.test.ts +++ b/packages/ai/test/synthetic-login.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { loginSynthetic } from "../src/registry/synthetic"; +import { loginSynthetic } from "@oh-my-pi/pi-ai/registry/synthetic"; const originalFetch = global.fetch; diff --git a/packages/ai/test/utils-responses-id.test.ts b/packages/ai/test/utils-responses-id.test.ts index 2b2066780..c400c7709 100644 --- a/packages/ai/test/utils-responses-id.test.ts +++ b/packages/ai/test/utils-responses-id.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { normalizeResponsesToolCallId } from "../src/utils"; +import { normalizeResponsesToolCallId } from "@oh-my-pi/pi-ai/utils"; describe("normalizeResponsesToolCallId", () => { it("preserves existing item prefix when truncating oversized ids", () => { diff --git a/packages/ai/test/wafer.live.ts b/packages/ai/test/wafer.live.ts index f8dcd8caa..33f7fd323 100644 --- a/packages/ai/test/wafer.live.ts +++ b/packages/ai/test/wafer.live.ts @@ -7,9 +7,9 @@ * `model` field preserved verbatim (`GLM-5.1`, not lowercased) and a non-empty * assistant text returned. */ -import { getBundledModel } from "../src/models"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const apiKey = process.env.WAFER_PASS_API_KEY ?? process.env.WAFER_SERVERLESS_API_KEY; if (!apiKey) { diff --git a/packages/ai/test/wafer.test.ts b/packages/ai/test/wafer.test.ts index 29e9b491f..a7deb0100 100644 --- a/packages/ai/test/wafer.test.ts +++ b/packages/ai/test/wafer.test.ts @@ -11,11 +11,14 @@ * the case-sensitive id pass-through against the wire. */ import { afterEach, describe, expect, it } from "bun:test"; -import { createModelManager } from "../src/model-manager"; -import { getBundledModel } from "../src/models"; -import { waferPassModelManagerOptions, waferServerlessModelManagerOptions } from "../src/provider-models/openai-compat"; -import { streamOpenAICompletions } from "../src/providers/openai-completions"; -import type { Context, Model } from "../src/types"; +import { createModelManager } from "@oh-my-pi/pi-ai/model-manager"; +import { getBundledModel } from "@oh-my-pi/pi-ai/models"; +import { + waferPassModelManagerOptions, + waferServerlessModelManagerOptions, +} from "@oh-my-pi/pi-ai/provider-models/openai-compat"; +import { streamOpenAICompletions } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; const originalFetch = global.fetch; diff --git a/packages/ai/test/xai-oauth-bundle.test.ts b/packages/ai/test/xai-oauth-bundle.test.ts index 824b2babe..c688ca1fc 100644 --- a/packages/ai/test/xai-oauth-bundle.test.ts +++ b/packages/ai/test/xai-oauth-bundle.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; +import { buildXaiOAuthStaticSeed } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; +import type { Model } from "@oh-my-pi/pi-ai/types"; import MODELS_JSON from "../src/models.json" with { type: "json" }; -import { buildXaiOAuthStaticSeed } from "../src/provider-models/openai-compat"; -import type { Model } from "../src/types"; // Pins the invariant: bundled `models.json` carries every entry the runtime // curated catalog (XAI_OAUTH_CURATED_MODELS, surfaced via diff --git a/packages/ai/test/xai-oauth-effort-strip.test.ts b/packages/ai/test/xai-oauth-effort-strip.test.ts index 11b49542f..2239abadb 100644 --- a/packages/ai/test/xai-oauth-effort-strip.test.ts +++ b/packages/ai/test/xai-oauth-effort-strip.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; +import { modelOmitsReasoningEffort } from "@oh-my-pi/pi-ai/model-thinking"; import { getBundledModel } from "@oh-my-pi/pi-ai/models"; -import { modelOmitsReasoningEffort } from "../src/model-thinking"; // Pins fix #2 of the compaction effort-override bug. Before this fix, // `resolveOpenAiReasoningEffort` called `requireSupportedEffort` which threw diff --git a/packages/ai/test/xiaomi-oauth.test.ts b/packages/ai/test/xiaomi-oauth.test.ts index 00d9859bb..11ffcbb21 100644 --- a/packages/ai/test/xiaomi-oauth.test.ts +++ b/packages/ai/test/xiaomi-oauth.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { loginXiaomi } from "../src/registry/oauth/xiaomi"; +import { loginXiaomi } from "@oh-my-pi/pi-ai/registry/oauth/xiaomi"; const originalFetch = global.fetch; diff --git a/packages/ai/test/xiaomi-tp-login-integration.test.ts b/packages/ai/test/xiaomi-tp-login-integration.test.ts index ffc1d8dce..fe1fdb6a0 100644 --- a/packages/ai/test/xiaomi-tp-login-integration.test.ts +++ b/packages/ai/test/xiaomi-tp-login-integration.test.ts @@ -14,11 +14,10 @@ */ import { describe, expect, it } from "bun:test"; +import { xiaomiModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; +import { loginXiaomi } from "@oh-my-pi/pi-ai/registry/oauth/xiaomi"; import { hookFetch } from "@oh-my-pi/pi-utils"; -import { xiaomiModelManagerOptions } from "../src/provider-models/openai-compat"; -import { loginXiaomi } from "../src/registry/oauth/xiaomi"; - // Realistic tp- key (same format as user's key, but a dummy value for testing) const TP_KEY = "tp-ci1p8t1w4e1sbxgyc8v65tnrjbzro287igmvyf25van9mt76"; diff --git a/packages/ai/test/zenmux-login.test.ts b/packages/ai/test/zenmux-login.test.ts index fed5e046a..7186c3b05 100644 --- a/packages/ai/test/zenmux-login.test.ts +++ b/packages/ai/test/zenmux-login.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { loginZenMux } from "../src/registry/zenmux"; +import { loginZenMux } from "@oh-my-pi/pi-ai/registry/zenmux"; const originalFetch = global.fetch; diff --git a/packages/ai/test/zenmux-provider.test.ts b/packages/ai/test/zenmux-provider.test.ts index 8ca85c978..e11bf9af5 100644 --- a/packages/ai/test/zenmux-provider.test.ts +++ b/packages/ai/test/zenmux-provider.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, test, vi } from "bun:test"; -import { DEFAULT_MODEL_PER_PROVIDER, PROVIDER_DESCRIPTORS } from "../src/provider-models/descriptors"; -import { zenmuxModelManagerOptions } from "../src/provider-models/openai-compat"; -import { getOAuthProviders } from "../src/registry/oauth"; -import { getEnvApiKey } from "../src/stream"; +import { DEFAULT_MODEL_PER_PROVIDER, PROVIDER_DESCRIPTORS } from "@oh-my-pi/pi-ai/provider-models/descriptors"; +import { zenmuxModelManagerOptions } from "@oh-my-pi/pi-ai/provider-models/openai-compat"; +import { getOAuthProviders } from "@oh-my-pi/pi-ai/registry/oauth"; +import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream"; const originalZenMuxApiKey = Bun.env.ZENMUX_API_KEY; const originalFetch = global.fetch; diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 9d188f40d..5dc396c78 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -15,6 +15,7 @@ ### Changed +- Updated pi-ai OAuth imports to the renamed `@oh-my-pi/pi-ai/oauth` subpath (was `@oh-my-pi/pi-ai/utils/oauth`) across the login UI, MCP OAuth flow, model registry, setup wizard, and web-search Codex auth. The legacy-plugin specifier shim drops its `pi-ai/oauth` → `pi-ai/utils/oauth` subpath rewrite, since the canonical `@oh-my-pi/pi-ai/oauth` export now resolves directly. - Changed forced self-updates for Homebrew installs to run `brew reinstall` and for mise installs to run `mise install --force` after `mise upgrade` when `--force` is requested - Changed TTSR rule bucketing and matching so rules with only `astCondition` are treated as TTSR rules and evaluated in the interrupt flow using reconstructed edit/write source snapshots - Normalized image content before it enters model context so attached images are downscaled and preprocessed for prompts, steering messages, follow-ups, and custom agent messages @@ -35,6 +36,7 @@ ### Fixed +- Fixed package subpath exports for status-line, setup-wizard, tool-discovery, and gallery fixture modules so rewritten test imports resolve through `@oh-my-pi/pi-coding-agent`. - Fixed runtime model provider discovery so extension-registered providers are now refreshed after extension load and extension-supplied models appear without restarting - Fixed task-row shimmer timing so every running description starts its highlight on the first character together and reaches the last character together, regardless of text length. - Fixed the `eval` tool's `read`/`write`/`append` helpers (both Python and JS backends) treating `local://` (and other internal-URL) paths as plain filesystem paths. `pathlib.Path`/`path.resolve` collapse `local://x.md` to `local:/x.md`, so `write("local://x.md", …)` created a junk `local:` directory under the cwd instead of writing where `read local://x.md` resolves. The helpers now substitute injected on-disk roots for known schemes (currently `local://`, pinned to the session's own `local://` root), reject path traversal and unknown `scheme://` paths, and leave plain paths resolving against the cwd. diff --git a/packages/coding-agent/package.json b/packages/coding-agent/package.json index 2711909fc..61d0c5a74 100644 --- a/packages/coding-agent/package.json +++ b/packages/coding-agent/package.json @@ -133,6 +133,14 @@ "types": "./src/cli/*.ts", "import": "./src/cli/*.ts" }, + "./cli/gallery-fixtures": { + "types": "./src/cli/gallery-fixtures/index.ts", + "import": "./src/cli/gallery-fixtures/index.ts" + }, + "./cli/gallery-fixtures/*": { + "types": "./src/cli/gallery-fixtures/*.ts", + "import": "./src/cli/gallery-fixtures/*.ts" + }, "./cli/commands/*": { "types": "./src/cli/commands/*.ts", "import": "./src/cli/commands/*.ts" @@ -441,6 +449,14 @@ "types": "./src/modes/controllers/*.ts", "import": "./src/modes/controllers/*.ts" }, + "./modes/setup-wizard": { + "types": "./src/modes/setup-wizard/index.ts", + "import": "./src/modes/setup-wizard/index.ts" + }, + "./modes/setup-wizard/*": { + "types": "./src/modes/setup-wizard/*.ts", + "import": "./src/modes/setup-wizard/*.ts" + }, "./modes/rpc/*": { "types": "./src/modes/rpc/*.ts", "import": "./src/modes/rpc/*.ts" @@ -498,6 +514,10 @@ "types": "./src/task/*.ts", "import": "./src/task/*.ts" }, + "./tool-discovery/*": { + "types": "./src/tool-discovery/*.ts", + "import": "./src/tool-discovery/*.ts" + }, "./tools": { "types": "./src/tools/index.ts", "import": "./src/tools/index.ts" diff --git a/packages/coding-agent/src/modes/components/status-line.ts b/packages/coding-agent/src/modes/components/status-line/component.ts similarity index 94% rename from packages/coding-agent/src/modes/components/status-line.ts rename to packages/coding-agent/src/modes/components/status-line/component.ts index 03799e2ef..63e34d120 100644 --- a/packages/coding-agent/src/modes/components/status-line.ts +++ b/packages/coding-agent/src/modes/components/status-line/component.ts @@ -4,46 +4,24 @@ import { estimateTokens } from "@oh-my-pi/pi-agent-core/compaction"; import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; import { formatCount, getProjectDir } from "@oh-my-pi/pi-utils"; import { $ } from "bun"; -import { settings } from "../../config/settings"; -import type { StatusLinePreset, StatusLineSegmentId, StatusLineSeparatorStyle } from "../../config/settings-schema"; -import { theme } from "../../modes/theme/theme"; -import type { AgentSession } from "../../session/agent-session"; -import * as git from "../../utils/git"; -import { getSessionAccentAnsi, getSessionAccentHex } from "../../utils/session-color"; -import { sanitizeStatusText } from "../shared"; -import { computeNonMessageTokens } from "../utils/context-usage"; -import { - canReuseCachedPr, - createPrCacheContext, - isSamePrCacheContext, - type PrCacheContext, -} from "./status-line/git-utils"; -import { getPreset } from "./status-line/presets"; -import { renderSegment, type SegmentContext } from "./status-line/segments"; -import { getSeparator } from "./status-line/separators"; -import { calculateTokensPerSecond } from "./status-line/token-rate"; - -export interface StatusLineSegmentOptions { - model?: { showThinkingLevel?: boolean }; - path?: { abbreviate?: boolean; maxLength?: number; stripWorkPrefix?: boolean }; - git?: { showBranch?: boolean; showStaged?: boolean; showUnstaged?: boolean; showUntracked?: boolean }; - time?: { format?: "12h" | "24h"; showSeconds?: boolean }; -} - -export interface StatusLineSettings { - preset?: StatusLinePreset; - leftSegments?: StatusLineSegmentId[]; - rightSegments?: StatusLineSegmentId[]; - separator?: StatusLineSeparatorStyle; - segmentOptions?: StatusLineSegmentOptions; - showHookStatus?: boolean; - sessionAccent?: boolean; -} - -export type EffectiveStatusLineSettings = Required< - Pick -> & - StatusLineSettings; +import { settings } from "../../../config/settings"; +import type { AgentSession } from "../../../session/agent-session"; +import * as git from "../../../utils/git"; +import { getSessionAccentAnsi, getSessionAccentHex } from "../../../utils/session-color"; +import { sanitizeStatusText } from "../../shared"; +import { theme } from "../../theme/theme"; +import { computeNonMessageTokens } from "../../utils/context-usage"; +import { canReuseCachedPr, createPrCacheContext, isSamePrCacheContext, type PrCacheContext } from "./git-utils"; +import { getPreset } from "./presets"; +import { renderSegment, type SegmentContext } from "./segments"; +import { getSeparator } from "./separators"; +import { calculateTokensPerSecond } from "./token-rate"; +import type { + EffectiveStatusLineSettings, + StatusLineSegmentId, + StatusLineSegmentOptions, + StatusLineSettings, +} from "./types"; // ═══════════════════════════════════════════════════════════════════════════ // Per-message token cache diff --git a/packages/coding-agent/src/modes/components/status-line/index.ts b/packages/coding-agent/src/modes/components/status-line/index.ts index 79207227d..4719d6ee8 100644 --- a/packages/coding-agent/src/modes/components/status-line/index.ts +++ b/packages/coding-agent/src/modes/components/status-line/index.ts @@ -1,3 +1,4 @@ +export * from "./component"; export * from "./presets"; export * from "./segments"; export * from "./separators"; diff --git a/packages/coding-agent/src/modes/components/status-line/types.ts b/packages/coding-agent/src/modes/components/status-line/types.ts index 274598d96..a6bb971d5 100644 --- a/packages/coding-agent/src/modes/components/status-line/types.ts +++ b/packages/coding-agent/src/modes/components/status-line/types.ts @@ -1,14 +1,29 @@ import type { StatusLinePreset, StatusLineSegmentId, StatusLineSeparatorStyle } from "../../../config/settings-schema"; import type { AgentSession } from "../../../session/agent-session"; -import type { StatusLineSegmentOptions, StatusLineSettings } from "../status-line"; -export type { - StatusLinePreset, - StatusLineSegmentId, - StatusLineSegmentOptions, - StatusLineSeparatorStyle, - StatusLineSettings, -}; +export type { StatusLinePreset, StatusLineSegmentId, StatusLineSeparatorStyle }; + +export interface StatusLineSegmentOptions { + model?: { showThinkingLevel?: boolean }; + path?: { abbreviate?: boolean; maxLength?: number; stripWorkPrefix?: boolean }; + git?: { showBranch?: boolean; showStaged?: boolean; showUnstaged?: boolean; showUntracked?: boolean }; + time?: { format?: "12h" | "24h"; showSeconds?: boolean }; +} + +export interface StatusLineSettings { + preset?: StatusLinePreset; + leftSegments?: StatusLineSegmentId[]; + rightSegments?: StatusLineSegmentId[]; + separator?: StatusLineSeparatorStyle; + segmentOptions?: StatusLineSegmentOptions; + showHookStatus?: boolean; + sessionAccent?: boolean; +} + +export type EffectiveStatusLineSettings = Required< + Pick +> & + StatusLineSettings; // ═══════════════════════════════════════════════════════════════════════════ // Segment Rendering diff --git a/packages/coding-agent/test/acp-agent.test.ts b/packages/coding-agent/test/acp-agent.test.ts index 597c3c643..85d56324e 100644 --- a/packages/coding-agent/test/acp-agent.test.ts +++ b/packages/coding-agent/test/acp-agent.test.ts @@ -18,13 +18,17 @@ import { zSessionNotification, } from "@agentclientprotocol/sdk/dist/schema/zod.gen.js"; import type { Model } from "@oh-my-pi/pi-ai"; +import { resetSettingsForTest, Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import { + ACP_BOOTSTRAP_RACE_GUARD_MS, + AcpAgent, + createAcpExtensionUiContext, +} from "@oh-my-pi/pi-coding-agent/modes/acp/acp-agent"; +import type { PlanModeState } from "@oh-my-pi/pi-coding-agent/plan-mode/state"; +import type { AgentSession, AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { SILENT_ABORT_MARKER } from "@oh-my-pi/pi-coding-agent/session/messages"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { getConfigRootDir, setAgentDir } from "@oh-my-pi/pi-utils"; -import { resetSettingsForTest, Settings } from "../src/config/settings"; -import { ACP_BOOTSTRAP_RACE_GUARD_MS, AcpAgent, createAcpExtensionUiContext } from "../src/modes/acp/acp-agent"; -import type { PlanModeState } from "../src/plan-mode/state"; -import type { AgentSession, AgentSessionEvent } from "../src/session/agent-session"; -import { SILENT_ABORT_MARKER } from "../src/session/messages"; -import { SessionManager } from "../src/session/session-manager"; import { expectAcpStructure } from "./helpers/acp-schema"; const TEST_MODELS: Model[] = [ diff --git a/packages/coding-agent/test/acp-builtins.test.ts b/packages/coding-agent/test/acp-builtins.test.ts index 48f2112ed..9e35757cf 100644 --- a/packages/coding-agent/test/acp-builtins.test.ts +++ b/packages/coding-agent/test/acp-builtins.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it, spyOn } from "bun:test"; -import { Settings } from "../src/config/settings"; -import type { AgentSession } from "../src/session/agent-session"; -import type { SessionManager } from "../src/session/session-manager"; -import { executeAcpBuiltinSlashCommand } from "../src/slash-commands/acp-builtins"; +import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import type { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { executeAcpBuiltinSlashCommand } from "@oh-my-pi/pi-coding-agent/slash-commands/acp-builtins"; interface FakeAcpBuiltinSession { fastMode: boolean; @@ -689,7 +689,7 @@ describe("wave 5 — adapters and polish", () => { it("/mcp add foo --url https://example.com --token X --scope project: outputs success or propagates write error", async () => { // Uses project scope so it writes to /tmp/project/.omp/mcp.json which test infra controls. // We verify the command either reports success or a meaningful error (not a parse error). - const mcpModule = await import("../src/mcp/config-writer"); + const mcpModule = await import("@oh-my-pi/pi-coding-agent/mcp/config-writer"); const spy = spyOn(mcpModule, "addMCPServer").mockResolvedValue(undefined); try { const { output, runtime } = createRuntime(); @@ -727,7 +727,7 @@ describe("wave 5 — adapters and polish", () => { // /ssh add — spy on addSSHHost it("/ssh add foo --host x --user y --scope user: calls addSSHHost", async () => { - const sshModule = await import("../src/ssh/config-writer"); + const sshModule = await import("@oh-my-pi/pi-coding-agent/ssh/config-writer"); const spy = spyOn(sshModule, "addSSHHost").mockResolvedValue(undefined); try { const { output, runtime } = createRuntime(); @@ -835,7 +835,7 @@ describe("wave 5 — adapters and polish", () => { // /marketplace discover bulleted list it("/marketplace discover: output is bulleted with ' - ' token", async () => { - const { MarketplaceManager } = await import("../src/extensibility/plugins/marketplace"); + const { MarketplaceManager } = await import("@oh-my-pi/pi-coding-agent/extensibility/plugins/marketplace"); const discoverSpy = spyOn(MarketplaceManager.prototype, "listAvailablePlugins").mockResolvedValue([ { name: "hello", version: "1.0.0", description: "A greeting plugin" } as never, { name: "world", version: "2.0.0", description: undefined } as never, diff --git a/packages/coding-agent/test/acp-client-bridge.test.ts b/packages/coding-agent/test/acp-client-bridge.test.ts index 62946af23..4f86ea012 100644 --- a/packages/coding-agent/test/acp-client-bridge.test.ts +++ b/packages/coding-agent/test/acp-client-bridge.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; import type { AgentSideConnection, RequestPermissionRequest } from "@agentclientprotocol/sdk"; -import { createAcpClientBridge } from "../src/modes/acp/acp-client-bridge"; +import { createAcpClientBridge } from "@oh-my-pi/pi-coding-agent/modes/acp/acp-client-bridge"; describe("ACP client bridge permission requests", () => { it("forwards pending tool-call status to session/request_permission", async () => { diff --git a/packages/coding-agent/test/acp-event-mapper.test.ts b/packages/coding-agent/test/acp-event-mapper.test.ts index c6c10e1cb..1cab03a00 100644 --- a/packages/coding-agent/test/acp-event-mapper.test.ts +++ b/packages/coding-agent/test/acp-event-mapper.test.ts @@ -5,14 +5,14 @@ import path from "node:path"; import type { AgentSideConnection, SessionNotification } from "@agentclientprotocol/sdk"; import { zSessionNotification } from "@agentclientprotocol/sdk/dist/schema/zod.gen.js"; import type { Model } from "@oh-my-pi/pi-ai"; -import { AcpAgent } from "../src/modes/acp/acp-agent"; +import { AcpAgent } from "@oh-my-pi/pi-coding-agent/modes/acp/acp-agent"; import { buildToolCallStartUpdate, mapAgentSessionEventToAcpSessionUpdates, normalizeReplayToolArguments, -} from "../src/modes/acp/acp-event-mapper"; -import type { AgentSession, AgentSessionEvent } from "../src/session/agent-session"; -import { SessionManager } from "../src/session/session-manager"; +} from "@oh-my-pi/pi-coding-agent/modes/acp/acp-event-mapper"; +import type { AgentSession, AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { expectAcpStructure, expectAcpStructureRejects } from "./helpers/acp-schema"; function makeAssistantMessage(text: string) { diff --git a/packages/coding-agent/test/acp-initialize-conformance.test.ts b/packages/coding-agent/test/acp-initialize-conformance.test.ts index f70c386e5..eddd6bee6 100644 --- a/packages/coding-agent/test/acp-initialize-conformance.test.ts +++ b/packages/coding-agent/test/acp-initialize-conformance.test.ts @@ -10,11 +10,11 @@ import * as path from "node:path"; import type { AgentSideConnection, InitializeRequest } from "@agentclientprotocol/sdk"; import { zInitializeResponse } from "@agentclientprotocol/sdk/dist/schema/zod.gen.js"; import type { Model } from "@oh-my-pi/pi-ai"; +import { AcpAgent } from "@oh-my-pi/pi-coding-agent/modes/acp/acp-agent"; +import { ACP_TERMINAL_AUTH_FLAG, prepareAcpTerminalAuthArgs } from "@oh-my-pi/pi-coding-agent/modes/acp/terminal-auth"; +import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { getConfigRootDir, setAgentDir, VERSION } from "@oh-my-pi/pi-utils"; -import { AcpAgent } from "../src/modes/acp/acp-agent"; -import { ACP_TERMINAL_AUTH_FLAG, prepareAcpTerminalAuthArgs } from "../src/modes/acp/terminal-auth"; -import type { AgentSession } from "../src/session/agent-session"; -import { SessionManager } from "../src/session/session-manager"; import { expectAcpStructure } from "./helpers/acp-schema"; const TEST_MODELS: Model[] = [ diff --git a/packages/coding-agent/test/acp-lazy-startup.test.ts b/packages/coding-agent/test/acp-lazy-startup.test.ts index 2833ae51b..afdabaee0 100644 --- a/packages/coding-agent/test/acp-lazy-startup.test.ts +++ b/packages/coding-agent/test/acp-lazy-startup.test.ts @@ -11,12 +11,12 @@ import { type SessionNotification, } from "@agentclientprotocol/sdk"; import type { Model } from "@oh-my-pi/pi-ai"; +import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import { createAcpConnection } from "@oh-my-pi/pi-coding-agent/modes/acp/acp-mode"; +import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { TempDir } from "@oh-my-pi/pi-utils"; -import { Settings } from "../src/config/settings"; -import { createAcpConnection } from "../src/modes/acp/acp-mode"; -import type { AgentSession } from "../src/session/agent-session"; -import { AuthStorage } from "../src/session/auth-storage"; -import { SessionManager } from "../src/session/session-manager"; const TEST_MODEL: Model = { id: "claude-sonnet-4-20250514", @@ -156,7 +156,7 @@ async function closeTransport(writable: WritableStream): Promise describe("ACP lazy startup", () => { it("keeps ACP background jobs disabled by default and preserves explicit opt-ins", async () => { - const { runRootCommand } = await import("../src/main"); + const { runRootCommand } = await import("@oh-my-pi/pi-coding-agent/main"); type ObservedBackgroundSettings = { asyncEnabled: boolean; @@ -314,8 +314,8 @@ describe("ACP lazy startup", () => { const authStorage = await AuthStorage.create(path.join(cwd, "auth.db")); try { const settings = Settings.isolated({ "marketplace.autoUpdate": "off" }); - const { runRootCommand } = await import("../src/main"); - const { createAgentSession } = await import("../src/sdk"); + const { runRootCommand } = await import("@oh-my-pi/pi-coding-agent/main"); + const { createAgentSession } = await import("@oh-my-pi/pi-coding-agent/sdk"); let session: AgentSession | undefined; const stopped = runRootCommand( diff --git a/packages/coding-agent/test/acp-mcp-isolation.test.ts b/packages/coding-agent/test/acp-mcp-isolation.test.ts index 926bf53c3..abef4c4f2 100644 --- a/packages/coding-agent/test/acp-mcp-isolation.test.ts +++ b/packages/coding-agent/test/acp-mcp-isolation.test.ts @@ -16,13 +16,13 @@ import { describe, expect, it } from "bun:test"; import * as fs from "node:fs"; import * as os from "node:os"; import * as path from "node:path"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import { createAcpSessionFactory } from "@oh-my-pi/pi-coding-agent/main"; +import type { CreateAgentSessionOptions, CreateAgentSessionResult } from "@oh-my-pi/pi-coding-agent/sdk"; +import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { Snowflake } from "@oh-my-pi/pi-utils"; -import { ModelRegistry } from "../src/config/model-registry"; -import { Settings } from "../src/config/settings"; -import { createAcpSessionFactory } from "../src/main"; -import type { CreateAgentSessionOptions, CreateAgentSessionResult } from "../src/sdk"; -import type { AgentSession } from "../src/session/agent-session"; -import { AuthStorage } from "../src/session/auth-storage"; describe("createAcpSessionFactory MCP isolation (issue #1234)", () => { it("forces enableMCP=false even when baseOptions opts in", async () => { diff --git a/packages/coding-agent/test/agent-session-mcp-discovery.test.ts b/packages/coding-agent/test/agent-session-mcp-discovery.test.ts index 4d3eed103..3c5d66ddf 100644 --- a/packages/coding-agent/test/agent-session-mcp-discovery.test.ts +++ b/packages/coding-agent/test/agent-session-mcp-discovery.test.ts @@ -4,11 +4,11 @@ import * as os from "node:os"; import * as path from "node:path"; import { Agent, type AgentTool, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import { Effort, type Model } from "@oh-my-pi/pi-ai"; +import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import type { CustomTool } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import * as z from "zod/v4"; -import { Settings } from "../src/config/settings"; -import type { CustomTool } from "../src/extensibility/custom-tools/types"; -import { AgentSession } from "../src/session/agent-session"; -import { SessionManager } from "../src/session/session-manager"; function createModel(): Model<"openai-responses"> { return { diff --git a/packages/coding-agent/test/agent-session-role-thinking.test.ts b/packages/coding-agent/test/agent-session-role-thinking.test.ts index 19df05517..c7b002ff4 100644 --- a/packages/coding-agent/test/agent-session-role-thinking.test.ts +++ b/packages/coding-agent/test/agent-session-role-thinking.test.ts @@ -2,14 +2,18 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import * as path from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { Effort, getBundledModel } from "@oh-my-pi/pi-ai"; +import * as autoThinkingClassifier from "@oh-my-pi/pi-coding-agent/auto-thinking/classifier"; import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { + AUTO_THINKING, + clampAutoThinkingEffort, + resolveProvisionalAutoLevel, +} from "@oh-my-pi/pi-coding-agent/thinking"; import { TempDir } from "@oh-my-pi/pi-utils"; -import * as autoThinkingClassifier from "../src/auto-thinking/classifier"; -import { AUTO_THINKING, clampAutoThinkingEffort, resolveProvisionalAutoLevel } from "../src/thinking"; import { createAssistantMessage } from "./helpers/agent-session-setup"; describe("AgentSession role model thinking behavior", () => { diff --git a/packages/coding-agent/test/agent-session-ssh-refresh.test.ts b/packages/coding-agent/test/agent-session-ssh-refresh.test.ts index 663c57688..ed74523a1 100644 --- a/packages/coding-agent/test/agent-session-ssh-refresh.test.ts +++ b/packages/coding-agent/test/agent-session-ssh-refresh.test.ts @@ -1,16 +1,16 @@ import { afterEach, describe, expect, it, spyOn } from "bun:test"; import { Agent, type AgentTool } from "@oh-my-pi/pi-agent-core"; import type { Model } from "@oh-my-pi/pi-ai"; +import { reset as resetCapabilities } from "@oh-my-pi/pi-coding-agent/capability"; +import { type SSHHost, sshCapability } from "@oh-my-pi/pi-coding-agent/capability/ssh"; +import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; +import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { addSSHHost, removeSSHHost, updateSSHHost } from "@oh-my-pi/pi-coding-agent/ssh/config-writer"; +import * as connectionManager from "@oh-my-pi/pi-coding-agent/ssh/connection-manager"; +import { loadSshTool, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { getSSHConfigPath, TempDir } from "@oh-my-pi/pi-utils"; -import { reset as resetCapabilities } from "../src/capability"; -import { type SSHHost, sshCapability } from "../src/capability/ssh"; -import { Settings } from "../src/config/settings"; -import { loadCapability } from "../src/discovery"; -import { AgentSession } from "../src/session/agent-session"; -import { SessionManager } from "../src/session/session-manager"; -import { addSSHHost, removeSSHHost, updateSSHHost } from "../src/ssh/config-writer"; -import * as connectionManager from "../src/ssh/connection-manager"; -import { loadSshTool, type ToolSession } from "../src/tools"; function createModel(): Model<"openai-responses"> { return { diff --git a/packages/coding-agent/test/agent-session-tool-rebuild-skip.test.ts b/packages/coding-agent/test/agent-session-tool-rebuild-skip.test.ts index 42b921a93..18e5066fb 100644 --- a/packages/coding-agent/test/agent-session-tool-rebuild-skip.test.ts +++ b/packages/coding-agent/test/agent-session-tool-rebuild-skip.test.ts @@ -1,11 +1,11 @@ import { afterEach, describe, expect, it, setSystemTime } from "bun:test"; import { Agent, type AgentTool } from "@oh-my-pi/pi-agent-core"; import type { Model } from "@oh-my-pi/pi-ai"; +import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import type { CustomTool } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import * as z from "zod/v4"; -import { Settings } from "../src/config/settings"; -import type { CustomTool } from "../src/extensibility/custom-tools/types"; -import { AgentSession } from "../src/session/agent-session"; -import { SessionManager } from "../src/session/session-manager"; // Cache-stability invariant: when MCP servers reconnect with byte-identical tool // definitions, `refreshMCPTools` must not rebuild the system prompt. A rebuild diff --git a/packages/coding-agent/test/agent-storage-sqlite-compat.test.ts b/packages/coding-agent/test/agent-storage-sqlite-compat.test.ts index 83d946ebc..7bd59320b 100644 --- a/packages/coding-agent/test/agent-storage-sqlite-compat.test.ts +++ b/packages/coding-agent/test/agent-storage-sqlite-compat.test.ts @@ -3,7 +3,7 @@ import { afterEach, describe, expect, it } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { AgentStorage } from "../src/session/agent-storage"; +import { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage"; import { readTableSql } from "./helpers/sqlite-inspect"; const LEGACY_TIMESTAMP = 1_700_000_000; diff --git a/packages/coding-agent/test/auth-broker-import.test.ts b/packages/coding-agent/test/auth-broker-import.test.ts index 877210325..8f21357bc 100644 --- a/packages/coding-agent/test/auth-broker-import.test.ts +++ b/packages/coding-agent/test/auth-broker-import.test.ts @@ -3,8 +3,8 @@ import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import { type AuthBrokerServerHandle, AuthStorage, SqliteAuthCredentialStore, startAuthBroker } from "@oh-my-pi/pi-ai"; +import { runAuthBrokerCommand } from "@oh-my-pi/pi-coding-agent/cli/auth-broker-cli"; import { getAgentDbPath, setAgentDir } from "@oh-my-pi/pi-utils"; -import { runAuthBrokerCommand } from "../src/cli/auth-broker-cli"; const ORIGINAL_STDOUT_WRITE = process.stdout.write.bind(process.stdout); diff --git a/packages/coding-agent/test/auth-broker-snapshot-cache.test.ts b/packages/coding-agent/test/auth-broker-snapshot-cache.test.ts index 7dba4027c..510f1b94c 100644 --- a/packages/coding-agent/test/auth-broker-snapshot-cache.test.ts +++ b/packages/coding-agent/test/auth-broker-snapshot-cache.test.ts @@ -3,12 +3,12 @@ import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import { type AuthBrokerServerHandle, AuthStorage, SqliteAuthCredentialStore, startAuthBroker } from "@oh-my-pi/pi-ai"; -import { discoverAuthStorage } from "../src/sdk"; +import { discoverAuthStorage } from "@oh-my-pi/pi-coding-agent/sdk"; import { readAuthBrokerSnapshotCache, type SnapshotResponse, writeAuthBrokerSnapshotCache, -} from "../src/session/auth-storage"; +} from "@oh-my-pi/pi-coding-agent/session/auth-storage"; const ENV_KEYS = [ "OMP_AUTH_BROKER_URL", diff --git a/packages/coding-agent/test/auto-thinking-classifier.test.ts b/packages/coding-agent/test/auto-thinking-classifier.test.ts index e472420c2..8d712ef3c 100644 --- a/packages/coding-agent/test/auto-thinking-classifier.test.ts +++ b/packages/coding-agent/test/auto-thinking-classifier.test.ts @@ -1,13 +1,13 @@ import { describe, expect, it } from "bun:test"; import { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import { Effort, getBundledModel } from "@oh-my-pi/pi-ai"; +import { parseDifficultyBucket, parseDifficultyLevel } from "@oh-my-pi/pi-coding-agent/auto-thinking/classifier"; import { AUTO_THINKING, clampAutoThinkingEffort, parseConfiguredThinkingLevel, parseThinkingLevel, } from "@oh-my-pi/pi-coding-agent/thinking"; -import { parseDifficultyBucket, parseDifficultyLevel } from "../src/auto-thinking/classifier"; describe("auto thinking classifier helpers", () => { it("parses configured thinking without widening provider-facing thinking selectors", () => { diff --git a/packages/coding-agent/test/autoresearch-state.test.ts b/packages/coding-agent/test/autoresearch-state.test.ts index d44a02fbc..08f3dcb71 100644 --- a/packages/coding-agent/test/autoresearch-state.test.ts +++ b/packages/coding-agent/test/autoresearch-state.test.ts @@ -2,8 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import * as fs from "node:fs"; import * as os from "node:os"; import * as path from "node:path"; -import { Snowflake } from "@oh-my-pi/pi-utils"; -import { createAutoresearchExtension } from "../src/autoresearch/index"; +import { createAutoresearchExtension } from "@oh-my-pi/pi-coding-agent/autoresearch"; import { buildExperimentState, computeConfidence, @@ -11,11 +10,16 @@ import { findBaselineRunNumber, findBestKeptMetric, reconstructControlState, -} from "../src/autoresearch/state"; -import { AutoresearchStorage } from "../src/autoresearch/storage"; -import type { ExperimentResult } from "../src/autoresearch/types"; -import type { ExtensionAPI, ExtensionCommandContext, RegisteredCommand } from "../src/extensibility/extensions"; -import * as git from "../src/utils/git"; +} from "@oh-my-pi/pi-coding-agent/autoresearch/state"; +import { AutoresearchStorage } from "@oh-my-pi/pi-coding-agent/autoresearch/storage"; +import type { ExperimentResult } from "@oh-my-pi/pi-coding-agent/autoresearch/types"; +import type { + ExtensionAPI, + ExtensionCommandContext, + RegisteredCommand, +} from "@oh-my-pi/pi-coding-agent/extensibility/extensions"; +import * as git from "@oh-my-pi/pi-coding-agent/utils/git"; +import { Snowflake } from "@oh-my-pi/pi-utils"; afterEach(() => { vi.restoreAllMocks(); diff --git a/packages/coding-agent/test/autoresearch-tools.test.ts b/packages/coding-agent/test/autoresearch-tools.test.ts index 32b2ce59a..7bc7d34b7 100644 --- a/packages/coding-agent/test/autoresearch-tools.test.ts +++ b/packages/coding-agent/test/autoresearch-tools.test.ts @@ -3,16 +3,16 @@ import * as fs from "node:fs"; import * as os from "node:os"; import * as path from "node:path"; import type { ImageContent, TextContent } from "@oh-my-pi/pi-ai"; +import { createSessionRuntime } from "@oh-my-pi/pi-coding-agent/autoresearch/state"; +import { openAutoresearchStorage } from "@oh-my-pi/pi-coding-agent/autoresearch/storage"; +import { createInitExperimentTool } from "@oh-my-pi/pi-coding-agent/autoresearch/tools/init-experiment"; +import { createLogExperimentTool } from "@oh-my-pi/pi-coding-agent/autoresearch/tools/log-experiment"; +import { createRunExperimentTool } from "@oh-my-pi/pi-coding-agent/autoresearch/tools/run-experiment"; +import { createUpdateNotesTool } from "@oh-my-pi/pi-coding-agent/autoresearch/tools/update-notes"; +import type { LogDetails, RunDetails } from "@oh-my-pi/pi-coding-agent/autoresearch/types"; +import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent/extensibility/extensions"; import { Snowflake } from "@oh-my-pi/pi-utils"; import { $ } from "bun"; -import { createSessionRuntime } from "../src/autoresearch/state"; -import { openAutoresearchStorage } from "../src/autoresearch/storage"; -import { createInitExperimentTool } from "../src/autoresearch/tools/init-experiment"; -import { createLogExperimentTool } from "../src/autoresearch/tools/log-experiment"; -import { createRunExperimentTool } from "../src/autoresearch/tools/run-experiment"; -import { createUpdateNotesTool } from "../src/autoresearch/tools/update-notes"; -import type { LogDetails, RunDetails } from "../src/autoresearch/types"; -import type { ExtensionAPI, ExtensionContext } from "../src/extensibility/extensions"; afterEach(() => { vi.restoreAllMocks(); diff --git a/packages/coding-agent/test/bash-acp-terminal.test.ts b/packages/coding-agent/test/bash-acp-terminal.test.ts index 0323dec17..b9aad742f 100644 --- a/packages/coding-agent/test/bash-acp-terminal.test.ts +++ b/packages/coding-agent/test/bash-acp-terminal.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, mock, spyOn } from "bun:test"; -import type { ClientBridge, ClientBridgeTerminalHandle } from "../src/session/client-bridge"; -import type { ToolSession } from "../src/tools"; -import { BashTool } from "../src/tools/bash"; +import type { ClientBridge, ClientBridgeTerminalHandle } from "@oh-my-pi/pi-coding-agent/session/client-bridge"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; +import { BashTool } from "@oh-my-pi/pi-coding-agent/tools/bash"; function makeSession(bridge: ClientBridge): ToolSession { return { diff --git a/packages/coding-agent/test/bash-failure-result.test.ts b/packages/coding-agent/test/bash-failure-result.test.ts index b75be6c90..0e8523ebd 100644 --- a/packages/coding-agent/test/bash-failure-result.test.ts +++ b/packages/coding-agent/test/bash-failure-result.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import type { ToolSession } from "../src/tools"; -import { BashTool } from "../src/tools/bash"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; +import { BashTool } from "@oh-my-pi/pi-coding-agent/tools/bash"; function makeSession(): ToolSession { return { diff --git a/packages/coding-agent/test/checkpoint-rpc-qa.ts b/packages/coding-agent/test/checkpoint-rpc-qa.ts index 277569196..ad65599a2 100644 --- a/packages/coding-agent/test/checkpoint-rpc-qa.ts +++ b/packages/coding-agent/test/checkpoint-rpc-qa.ts @@ -2,13 +2,13 @@ import * as fs from "node:fs"; import * as os from "node:os"; import * as path from "node:path"; import type { AgentEvent, AgentMessage } from "@oh-my-pi/pi-agent-core"; -import { RpcClient } from "../src/modes/rpc/rpc-client"; +import { RpcClient } from "@oh-my-pi/pi-coding-agent/modes/rpc/rpc-client"; import { type BranchSummaryEntry, type CustomMessageEntry, parseSessionEntries, type SessionMessageEntry, -} from "../src/session/session-manager"; +} from "@oh-my-pi/pi-coding-agent/session/session-manager"; function extractText(message: AgentMessage): string { if (message.role !== "assistant") return ""; diff --git a/packages/coding-agent/test/cli-cwd-flag.test.ts b/packages/coding-agent/test/cli-cwd-flag.test.ts index 0f131f153..c61ac34e4 100644 --- a/packages/coding-agent/test/cli-cwd-flag.test.ts +++ b/packages/coding-agent/test/cli-cwd-flag.test.ts @@ -2,9 +2,9 @@ import { afterEach, describe, expect, it } from "bun:test"; import * as fs from "node:fs"; import * as os from "node:os"; import * as path from "node:path"; +import { parseArgs } from "@oh-my-pi/pi-coding-agent/cli/args"; +import { applyStartupCwd } from "@oh-my-pi/pi-coding-agent/cli/startup-cwd"; import { getProjectDir, normalizePathForComparison, setProjectDir } from "@oh-my-pi/pi-utils"; -import { parseArgs } from "../src/cli/args"; -import { applyStartupCwd } from "../src/cli/startup-cwd"; const originalProjectDir = getProjectDir(); diff --git a/packages/coding-agent/test/cli-hide-thinking-flag.test.ts b/packages/coding-agent/test/cli-hide-thinking-flag.test.ts index 4b4dcf949..a58634a1c 100644 --- a/packages/coding-agent/test/cli-hide-thinking-flag.test.ts +++ b/packages/coding-agent/test/cli-hide-thinking-flag.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; import { Effort } from "@oh-my-pi/pi-ai"; -import { parseArgs } from "../src/cli/args"; +import { parseArgs } from "@oh-my-pi/pi-coding-agent/cli/args"; describe("parseArgs — --hide-thinking flag", () => { it("parses --hide-thinking as a boolean flag", () => { diff --git a/packages/coding-agent/test/cli/completions.test.ts b/packages/coding-agent/test/cli/completions.test.ts index 491279d85..2dcf3a17c 100644 --- a/packages/coding-agent/test/cli/completions.test.ts +++ b/packages/coding-agent/test/cli/completions.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; import * as path from "node:path"; +import { buildSpec, type CompletionSpec, generateCompletion } from "@oh-my-pi/pi-coding-agent/cli/completion-gen"; import type { CliConfig, CommandCtor } from "@oh-my-pi/pi-utils/cli"; -import { buildSpec, type CompletionSpec, generateCompletion } from "../../src/cli/completion-gen"; const repoRoot = path.resolve(import.meta.dir, "..", "..", "..", ".."); const cliEntry = path.join(repoRoot, "packages", "coding-agent", "src", "cli.ts"); diff --git a/packages/coding-agent/test/client-prompts.test.ts b/packages/coding-agent/test/client-prompts.test.ts index b0c272f67..a21b47986 100644 --- a/packages/coding-agent/test/client-prompts.test.ts +++ b/packages/coding-agent/test/client-prompts.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { getPrompt, listPrompts, serverSupportsPrompts } from "../src/mcp/client"; -import type { MCPGetPromptResult, MCPPrompt, MCPPromptsListResult } from "../src/mcp/types"; +import { getPrompt, listPrompts, serverSupportsPrompts } from "@oh-my-pi/pi-coding-agent/mcp/client"; +import type { MCPGetPromptResult, MCPPrompt, MCPPromptsListResult } from "@oh-my-pi/pi-coding-agent/mcp/types"; import { createMockConnection, createMockTransport } from "./mcp-test-utils"; describe("listPrompts", () => { diff --git a/packages/coding-agent/test/client-resources.test.ts b/packages/coding-agent/test/client-resources.test.ts index 72f2d647e..d3ac976fb 100644 --- a/packages/coding-agent/test/client-resources.test.ts +++ b/packages/coding-agent/test/client-resources.test.ts @@ -7,7 +7,7 @@ import { serverSupportsResources, subscribeToResources, unsubscribeFromResources, -} from "../src/mcp/client"; +} from "@oh-my-pi/pi-coding-agent/mcp/client"; import type { MCPResource, MCPResourceReadResult, @@ -15,7 +15,7 @@ import type { MCPResourceTemplate, MCPResourceTemplatesListResult, MCPTransport, -} from "../src/mcp/types"; +} from "@oh-my-pi/pi-coding-agent/mcp/types"; import { createMockConnection, createMockTransport } from "./mcp-test-utils"; describe("listResources", () => { diff --git a/packages/coding-agent/test/commit-agentic-attribution.test.ts b/packages/coding-agent/test/commit-agentic-attribution.test.ts index 6b16b8246..820c7cbb8 100644 --- a/packages/coding-agent/test/commit-agentic-attribution.test.ts +++ b/packages/coding-agent/test/commit-agentic-attribution.test.ts @@ -1,11 +1,11 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; import { getBundledModel } from "@oh-my-pi/pi-ai"; -import { runCommitAgentSession } from "../src/commit/agentic/agent"; -import * as toolsModule from "../src/commit/agentic/tools"; -import { Settings } from "../src/config/settings"; -import type { CreateAgentSessionResult } from "../src/sdk"; -import * as sdkModule from "../src/sdk"; -import type { PromptOptions } from "../src/session/agent-session"; +import { runCommitAgentSession } from "@oh-my-pi/pi-coding-agent/commit/agentic/agent"; +import * as toolsModule from "@oh-my-pi/pi-coding-agent/commit/agentic/tools"; +import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import type { CreateAgentSessionResult } from "@oh-my-pi/pi-coding-agent/sdk"; +import * as sdkModule from "@oh-my-pi/pi-coding-agent/sdk"; +import type { PromptOptions } from "@oh-my-pi/pi-coding-agent/session/agent-session"; describe("commit agent prompt attribution", () => { afterEach(() => { diff --git a/packages/coding-agent/test/commit-command-exit.test.ts b/packages/coding-agent/test/commit-command-exit.test.ts index 5b2a88dc6..f75247049 100644 --- a/packages/coding-agent/test/commit-command-exit.test.ts +++ b/packages/coding-agent/test/commit-command-exit.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; +import CommitCommand from "@oh-my-pi/pi-coding-agent/commands/commit"; +import * as commitModule from "@oh-my-pi/pi-coding-agent/commit"; +import * as themeModule from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { postmortem } from "@oh-my-pi/pi-utils"; -import CommitCommand from "../src/commands/commit"; -import * as commitModule from "../src/commit"; -import * as themeModule from "../src/modes/theme/theme"; describe("omp commit command lifecycle (issue #1041)", () => { afterEach(() => { diff --git a/packages/coding-agent/test/commit-model-selection-role-thinking.test.ts b/packages/coding-agent/test/commit-model-selection-role-thinking.test.ts index f5cffc8f5..498ce011d 100644 --- a/packages/coding-agent/test/commit-model-selection-role-thinking.test.ts +++ b/packages/coding-agent/test/commit-model-selection-role-thinking.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; import { Effort, getBundledModel } from "@oh-my-pi/pi-ai"; -import { resolvePrimaryModel, resolveSmolModel } from "../src/commit/model-selection"; +import { resolvePrimaryModel, resolveSmolModel } from "@oh-my-pi/pi-coding-agent/commit/model-selection"; function getModelOrThrow(id: string) { const model = getBundledModel("anthropic", id); diff --git a/packages/coding-agent/test/commit-shared-llm.test.ts b/packages/coding-agent/test/commit-shared-llm.test.ts index f30f54f9f..64be9b8f1 100644 --- a/packages/coding-agent/test/commit-shared-llm.test.ts +++ b/packages/coding-agent/test/commit-shared-llm.test.ts @@ -1,6 +1,9 @@ import { describe, expect, it } from "bun:test"; import type { AssistantMessage } from "@oh-my-pi/pi-ai"; -import { createConventionalAnalysisTool, parseConventionalAnalysisResponse } from "../src/commit/shared-llm"; +import { + createConventionalAnalysisTool, + parseConventionalAnalysisResponse, +} from "@oh-my-pi/pi-coding-agent/commit/shared-llm"; describe("commit shared LLM parsing", () => { it("ignores harmless extra fields in conventional analysis tool output", () => { diff --git a/packages/coding-agent/test/compaction.test.ts b/packages/coding-agent/test/compaction.test.ts index 453a51a84..1b733df5d 100644 --- a/packages/coding-agent/test/compaction.test.ts +++ b/packages/coding-agent/test/compaction.test.ts @@ -15,7 +15,6 @@ import * as ai from "@oh-my-pi/pi-ai"; import { getBundledModel } from "@oh-my-pi/pi-ai/models"; import { encodeTextSignatureV1 } from "@oh-my-pi/pi-ai/providers/openai-responses-shared"; import type { AssistantMessage, Model, ProviderPayload, Usage } from "@oh-my-pi/pi-ai/types"; -import { hookFetch } from "@oh-my-pi/pi-utils"; import { buildSessionContext, type CompactionEntry, @@ -25,7 +24,8 @@ import { type SessionEntry, type SessionMessageEntry, type ThinkingLevelChangeEntry, -} from "../src/session/session-manager"; +} from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { hookFetch } from "@oh-my-pi/pi-utils"; import { e2eApiKey } from "./utilities"; // ============================================================================ diff --git a/packages/coding-agent/test/config-cli.test.ts b/packages/coding-agent/test/config-cli.test.ts index 62cba399a..bcd7f7b96 100644 --- a/packages/coding-agent/test/config-cli.test.ts +++ b/packages/coding-agent/test/config-cli.test.ts @@ -2,9 +2,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; +import { runConfigCommand } from "@oh-my-pi/pi-coding-agent/cli/config-cli"; +import { resetSettingsForTest } from "@oh-my-pi/pi-coding-agent/config/settings"; import { getConfigRootDir, setAgentDir } from "@oh-my-pi/pi-utils"; -import { runConfigCommand } from "../src/cli/config-cli"; -import { resetSettingsForTest } from "../src/config/settings"; let testAgentDir = ""; const originalAgentDir = process.env.PI_CODING_AGENT_DIR; diff --git a/packages/coding-agent/test/core/js-executor.test.ts b/packages/coding-agent/test/core/js-executor.test.ts index 7776bfbb2..c8757c7c7 100644 --- a/packages/coding-agent/test/core/js-executor.test.ts +++ b/packages/coding-agent/test/core/js-executor.test.ts @@ -2,11 +2,11 @@ import { afterAll, afterEach, beforeAll, describe, expect, it, setDefaultTimeout import * as path from "node:path"; import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core"; import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import { disposeAllVmContexts } from "@oh-my-pi/pi-coding-agent/eval/js/context-manager"; +import { executeJs, type JsResult } from "@oh-my-pi/pi-coding-agent/eval/js/executor"; import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { TempDir } from "@oh-my-pi/pi-utils"; import * as z from "zod/v4"; -import { disposeAllVmContexts } from "../../src/eval/js/context-manager"; -import { executeJs, type JsResult } from "../../src/eval/js/executor"; // JS eval cold-starts a Bun worker; under --isolate + high CI concurrency that startup // can exceed Bun's 5s default per-test timeout, flaking the suite. Give the worker-backed diff --git a/packages/coding-agent/test/core/js-static-import-rewrite.test.ts b/packages/coding-agent/test/core/js-static-import-rewrite.test.ts index 1bb41310d..4771caee4 100644 --- a/packages/coding-agent/test/core/js-static-import-rewrite.test.ts +++ b/packages/coding-agent/test/core/js-static-import-rewrite.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { rewriteImports, wrapCode } from "../../src/eval/js/context-manager"; +import { rewriteImports, wrapCode } from "@oh-my-pi/pi-coding-agent/eval/js/context-manager"; // Test fixtures embed user-supplied `import(...)` syntax that the rewriter must // transform. The strings are split so static-analysis heuristics don't read them diff --git a/packages/coding-agent/test/core/js-tool-bridge.test.ts b/packages/coding-agent/test/core/js-tool-bridge.test.ts index 811463622..9b4b747b6 100644 --- a/packages/coding-agent/test/core/js-tool-bridge.test.ts +++ b/packages/coding-agent/test/core/js-tool-bridge.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it, vi } from "bun:test"; import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core"; import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import { callSessionTool } from "@oh-my-pi/pi-coding-agent/eval/js/tool-bridge"; import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import * as z from "zod/v4"; -import { callSessionTool } from "../../src/eval/js/tool-bridge"; function createTool( name: string, diff --git a/packages/coding-agent/test/core/js-workflow-helpers.test.ts b/packages/coding-agent/test/core/js-workflow-helpers.test.ts index d8592165a..9beb785b9 100644 --- a/packages/coding-agent/test/core/js-workflow-helpers.test.ts +++ b/packages/coding-agent/test/core/js-workflow-helpers.test.ts @@ -1,10 +1,10 @@ import { afterAll, beforeAll, describe, expect, it, setDefaultTimeout } from "bun:test"; import * as path from "node:path"; import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import { disposeAllVmContexts } from "@oh-my-pi/pi-coding-agent/eval/js/context-manager"; +import { executeJs, type JsResult } from "@oh-my-pi/pi-coding-agent/eval/js/executor"; import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; import { TempDir } from "@oh-my-pi/pi-utils"; -import { disposeAllVmContexts } from "../../src/eval/js/context-manager"; -import { executeJs, type JsResult } from "../../src/eval/js/executor"; // JS eval cold-starts a Bun worker; under --isolate + high CI concurrency that startup // can exceed Bun's 5s default per-test timeout, flaking the suite. Give the worker-backed diff --git a/packages/coding-agent/test/custom-editor-keybindings.test.ts b/packages/coding-agent/test/custom-editor-keybindings.test.ts index 04647e4bf..9009f86c2 100644 --- a/packages/coding-agent/test/custom-editor-keybindings.test.ts +++ b/packages/coding-agent/test/custom-editor-keybindings.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from "bun:test"; +import { CustomEditor, extractBracketedImagePastePath } from "@oh-my-pi/pi-coding-agent/modes/components/custom-editor"; import { defaultEditorTheme } from "../../tui/test/test-themes"; -import { CustomEditor, extractBracketedImagePastePath } from "../src/modes/components/custom-editor"; function ctrl(key: string): string { return String.fromCharCode(key.toLowerCase().charCodeAt(0) & 31); diff --git a/packages/coding-agent/test/dap-write-sink-flush.typecheck.ts b/packages/coding-agent/test/dap-write-sink-flush.typecheck.ts index 08efa692e..02bffbb19 100644 --- a/packages/coding-agent/test/dap-write-sink-flush.typecheck.ts +++ b/packages/coding-agent/test/dap-write-sink-flush.typecheck.ts @@ -1,4 +1,4 @@ -import type { DapClient } from "../src/dap/client"; +import type { DapClient } from "@oh-my-pi/pi-coding-agent/dap/client"; // Type-only import forces standard TypeScript to check src/dap/client.ts, // including the socketToSink() implementation against DapWriteSink.flush(). diff --git a/packages/coding-agent/test/debug/dap-launch-failures.test.ts b/packages/coding-agent/test/debug/dap-launch-failures.test.ts index 9d5802860..5ec7abaab 100644 --- a/packages/coding-agent/test/debug/dap-launch-failures.test.ts +++ b/packages/coding-agent/test/debug/dap-launch-failures.test.ts @@ -2,13 +2,18 @@ import { afterEach, describe, expect, it, spyOn, vi } from "bun:test"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { Settings } from "../../src/config/settings"; -import * as dapModule from "../../src/dap"; -import { DapClient } from "../../src/dap/client"; -import { DapSessionManager } from "../../src/dap/session"; -import type { DapCapabilities, DapClientState, DapEventMessage, DapResolvedAdapter } from "../../src/dap/types"; -import type { ToolSession } from "../../src/tools"; -import { DebugTool } from "../../src/tools/debug"; +import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import * as dapModule from "@oh-my-pi/pi-coding-agent/dap"; +import { DapClient } from "@oh-my-pi/pi-coding-agent/dap/client"; +import { DapSessionManager } from "@oh-my-pi/pi-coding-agent/dap/session"; +import type { + DapCapabilities, + DapClientState, + DapEventMessage, + DapResolvedAdapter, +} from "@oh-my-pi/pi-coding-agent/dap/types"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; +import { DebugTool } from "@oh-my-pi/pi-coding-agent/tools/debug"; const TEST_ADAPTER: DapResolvedAdapter = { name: "lldb-dap", diff --git a/packages/coding-agent/test/debug/log-formatting.test.ts b/packages/coding-agent/test/debug/log-formatting.test.ts index c0df00f5f..76d4997e9 100644 --- a/packages/coding-agent/test/debug/log-formatting.test.ts +++ b/packages/coding-agent/test/debug/log-formatting.test.ts @@ -3,7 +3,7 @@ import { formatDebugLogExpandedLines, formatDebugLogLine, parseDebugLogTimestampMs, -} from "../../src/debug/log-formatting"; +} from "@oh-my-pi/pi-coding-agent/debug/log-formatting"; describe("formatDebugLogLine", () => { it("strips ANSI codes and carriage returns", () => { diff --git a/packages/coding-agent/test/debug/log-viewer.test.ts b/packages/coding-agent/test/debug/log-viewer.test.ts index 16bce1360..d32b5de96 100644 --- a/packages/coding-agent/test/debug/log-viewer.test.ts +++ b/packages/coding-agent/test/debug/log-viewer.test.ts @@ -4,7 +4,7 @@ import { DebugLogViewerModel, LOAD_OLDER_LABEL, SESSION_BOUNDARY_WARNING, -} from "../../src/debug/log-viewer"; +} from "@oh-my-pi/pi-coding-agent/debug/log-viewer"; describe("DebugLogViewerModel", () => { const describeRow = (row: { kind: string; logIndex?: number }): string => { diff --git a/packages/coding-agent/test/debug/protocol-probe.test.ts b/packages/coding-agent/test/debug/protocol-probe.test.ts index 20bea256d..2eabac540 100644 --- a/packages/coding-agent/test/debug/protocol-probe.test.ts +++ b/packages/coding-agent/test/debug/protocol-probe.test.ts @@ -1,12 +1,12 @@ import { afterEach, beforeAll, describe, expect, it } from "bun:test"; -import { getImageDimensions, ImageBudget, ImageProtocol, TERMINAL } from "@oh-my-pi/pi-tui"; import { buildLargeTextLines, buildSampleImage, encodeRgbPng, ProtocolProbeComponent, -} from "../../src/debug/protocol-probe"; -import { initTheme } from "../../src/modes/theme/theme"; +} from "@oh-my-pi/pi-coding-agent/debug/protocol-probe"; +import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { getImageDimensions, ImageBudget, ImageProtocol, TERMINAL } from "@oh-my-pi/pi-tui"; beforeAll(async () => { // buildLargeTextLines styles the OSC 66 span through the global theme singleton. diff --git a/packages/coding-agent/test/debug/raw-sse-buffer.test.ts b/packages/coding-agent/test/debug/raw-sse-buffer.test.ts index 56008eab7..510810c35 100644 --- a/packages/coding-agent/test/debug/raw-sse-buffer.test.ts +++ b/packages/coding-agent/test/debug/raw-sse-buffer.test.ts @@ -1,6 +1,10 @@ import { describe, expect, it } from "bun:test"; import type { Model } from "@oh-my-pi/pi-ai"; -import { RawSseDebugBuffer, rawSseRecordLines, resolveRawSseDebugBuffer } from "../../src/debug/raw-sse-buffer"; +import { + RawSseDebugBuffer, + rawSseRecordLines, + resolveRawSseDebugBuffer, +} from "@oh-my-pi/pi-coding-agent/debug/raw-sse-buffer"; const model: Model<"anthropic-messages"> = { id: "claude-test", diff --git a/packages/coding-agent/test/debug/raw-sse-pretty.test.ts b/packages/coding-agent/test/debug/raw-sse-pretty.test.ts index 2dc12e11e..5a29c0b8e 100644 --- a/packages/coding-agent/test/debug/raw-sse-pretty.test.ts +++ b/packages/coding-agent/test/debug/raw-sse-pretty.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { expandPrettyDataLines } from "../../src/debug/raw-sse"; +import { expandPrettyDataLines } from "@oh-my-pi/pi-coding-agent/debug/raw-sse"; // Wide enough that `truncateToWidth` would clip the payload in the viewer; matches // what real Codex `response.output_item.done` frames look like on the wire. diff --git a/packages/coding-agent/test/debug/raw-sse-report-bundle.test.ts b/packages/coding-agent/test/debug/raw-sse-report-bundle.test.ts index bb43fdb58..3137d9e1a 100644 --- a/packages/coding-agent/test/debug/raw-sse-report-bundle.test.ts +++ b/packages/coding-agent/test/debug/raw-sse-report-bundle.test.ts @@ -3,9 +3,9 @@ import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import type { Model } from "@oh-my-pi/pi-ai"; +import { RawSseDebugBuffer } from "@oh-my-pi/pi-coding-agent/debug/raw-sse-buffer"; +import { createReportBundle } from "@oh-my-pi/pi-coding-agent/debug/report-bundle"; import { getConfigRootDir, setAgentDir } from "@oh-my-pi/pi-utils"; -import { RawSseDebugBuffer } from "../../src/debug/raw-sse-buffer"; -import { createReportBundle } from "../../src/debug/report-bundle"; const model: Model<"anthropic-messages"> = { id: "claude-test", diff --git a/packages/coding-agent/test/debug/terminal-info.test.ts b/packages/coding-agent/test/debug/terminal-info.test.ts index fdc69144d..b937efbc5 100644 --- a/packages/coding-agent/test/debug/terminal-info.test.ts +++ b/packages/coding-agent/test/debug/terminal-info.test.ts @@ -1,6 +1,10 @@ import { describe, expect, it } from "bun:test"; +import { + collectTerminalState, + formatTerminalState, + type TerminalStateInfo, +} from "@oh-my-pi/pi-coding-agent/debug/terminal-info"; import { TERMINAL } from "@oh-my-pi/pi-tui"; -import { collectTerminalState, formatTerminalState, type TerminalStateInfo } from "../../src/debug/terminal-info"; const sample: TerminalStateInfo = { detectedId: "kitty", diff --git a/packages/coding-agent/test/discovery/agent-discovery-disabled-providers.test.ts b/packages/coding-agent/test/discovery/agent-discovery-disabled-providers.test.ts index cdca0d86a..4efe97225 100644 --- a/packages/coding-agent/test/discovery/agent-discovery-disabled-providers.test.ts +++ b/packages/coding-agent/test/discovery/agent-discovery-disabled-providers.test.ts @@ -6,10 +6,10 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import * as fs from "node:fs"; import * as os from "node:os"; import * as path from "node:path"; -import { disableProvider, enableProvider } from "../../src/capability"; -import { clearCache as clearFsCache } from "../../src/capability/fs"; -import { clearClaudePluginRootsCache } from "../../src/discovery/helpers"; -import { discoverAgents } from "../../src/task/discovery"; +import { disableProvider, enableProvider } from "@oh-my-pi/pi-coding-agent/capability"; +import { clearCache as clearFsCache } from "@oh-my-pi/pi-coding-agent/capability/fs"; +import { clearClaudePluginRootsCache } from "@oh-my-pi/pi-coding-agent/discovery/helpers"; +import { discoverAgents } from "@oh-my-pi/pi-coding-agent/task/discovery"; const PLUGIN_AGENT_MD = [ "---", diff --git a/packages/coding-agent/test/discovery/agent-fields.test.ts b/packages/coding-agent/test/discovery/agent-fields.test.ts index 56a3e8974..34371f7b2 100644 --- a/packages/coding-agent/test/discovery/agent-fields.test.ts +++ b/packages/coding-agent/test/discovery/agent-fields.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; import { Effort } from "@oh-my-pi/pi-ai"; -import { parseAgentFields } from "../../src/discovery/helpers"; +import { parseAgentFields } from "@oh-my-pi/pi-coding-agent/discovery/helpers"; describe("parseAgentFields", () => { test("parses blocking from boolean frontmatter", () => { diff --git a/packages/coding-agent/test/edit/file-snapshot-store.test.ts b/packages/coding-agent/test/edit/file-snapshot-store.test.ts index 978f4a23e..7d0def8ee 100644 --- a/packages/coding-agent/test/edit/file-snapshot-store.test.ts +++ b/packages/coding-agent/test/edit/file-snapshot-store.test.ts @@ -3,7 +3,7 @@ import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import type { InMemorySnapshotStore } from "@oh-my-pi/hashline"; -import { canonicalSnapshotKey, getFileSnapshotStore } from "../../src/edit/file-snapshot-store"; +import { canonicalSnapshotKey, getFileSnapshotStore } from "@oh-my-pi/pi-coding-agent/edit/file-snapshot-store"; interface SessionOwner { fileSnapshotStore?: InMemorySnapshotStore; diff --git a/packages/coding-agent/test/emoji-autocomplete.test.ts b/packages/coding-agent/test/emoji-autocomplete.test.ts index 0d02b61f9..e0d71ea20 100644 --- a/packages/coding-agent/test/emoji-autocomplete.test.ts +++ b/packages/coding-agent/test/emoji-autocomplete.test.ts @@ -1,5 +1,9 @@ import { describe, expect, it } from "bun:test"; -import { applyEmojiCompletion, getEmojiSuggestions, tryEmojiInlineReplace } from "../src/modes/emoji-autocomplete"; +import { + applyEmojiCompletion, + getEmojiSuggestions, + tryEmojiInlineReplace, +} from "@oh-my-pi/pi-coding-agent/modes/emoji-autocomplete"; describe("emoji autocomplete", () => { describe("getEmojiSuggestions", () => { diff --git a/packages/coding-agent/test/eval/agent-bridge.test.ts b/packages/coding-agent/test/eval/agent-bridge.test.ts index 87b401d1a..832dd7fba 100644 --- a/packages/coding-agent/test/eval/agent-bridge.test.ts +++ b/packages/coding-agent/test/eval/agent-bridge.test.ts @@ -1,12 +1,12 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { Settings } from "../../src/config/settings"; -import { runEvalAgent } from "../../src/eval/agent-bridge"; -import type { LocalProtocolOptions } from "../../src/internal-urls"; -import type { MCPManager } from "../../src/mcp"; -import * as taskDiscovery from "../../src/task/discovery"; -import * as taskExecutor from "../../src/task/executor"; -import type { AgentDefinition, SingleResult } from "../../src/task/types"; -import type { ToolSession } from "../../src/tools"; +import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; +import { runEvalAgent } from "@oh-my-pi/pi-coding-agent/eval/agent-bridge"; +import type { LocalProtocolOptions } from "@oh-my-pi/pi-coding-agent/internal-urls"; +import type { MCPManager } from "@oh-my-pi/pi-coding-agent/mcp"; +import * as taskDiscovery from "@oh-my-pi/pi-coding-agent/task/discovery"; +import * as taskExecutor from "@oh-my-pi/pi-coding-agent/task/executor"; +import type { AgentDefinition, SingleResult } from "@oh-my-pi/pi-coding-agent/task/types"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools"; function createResult(): SingleResult { return { diff --git a/packages/coding-agent/test/export/html-template-developer.test.ts b/packages/coding-agent/test/export/html-template-developer.test.ts index b1f1916aa..6d15bbb4f 100644 --- a/packages/coding-agent/test/export/html-template-developer.test.ts +++ b/packages/coding-agent/test/export/html-template-developer.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { TEMPLATE } from "../../src/export/html/template.generated"; +import { TEMPLATE } from "@oh-my-pi/pi-coding-agent/export/html/template.generated"; describe("HTML export template developer message support", () => { it("renders developer-role messages in the main feed", () => { diff --git a/packages/coding-agent/test/export/html-template-script-substitution.test.ts b/packages/coding-agent/test/export/html-template-script-substitution.test.ts index f4446ff73..2c37cc1eb 100644 --- a/packages/coding-agent/test/export/html-template-script-substitution.test.ts +++ b/packages/coding-agent/test/export/html-template-script-substitution.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { TEMPLATE } from "../../src/export/html/template.generated"; +import { TEMPLATE } from "@oh-my-pi/pi-coding-agent/export/html/template.generated"; // Regression: `String.prototype.replace(string, string)` treats `$'`, `$&`, // `$$`, `$n`, etc. as substitution patterns. The inlined `