Commit Graph

122 Commits

Author SHA1 Message Date
omp-eval c8b37c8d2e fix(plugins): return bare Kitty delete sequences from legacy pi-tui shim
Upstream Pi's deleteKittyImage/deleteAllKittyImages return unwrapped control
sequences; legacy callers such as pi-sprite wrap tmux passthrough themselves.
Aliasing OMP's auto-wrapping encodeKittyDeleteImage (and hand-wrapping
deleteAllKittyImages) double-wrapped under tmux, so the outer terminal dropped
the delete command. Match the upstream bare-sequence contract and pin it in
the regression test.
2026-07-26 15:41:31 +02:00
can1357 5905ec0430 Merge PR #6507: fix(plugins): restore pi-sprite legacy compatibility (@roboomp) 2026-07-26 15:41:31 +02:00
can1357 e1b607f9ee Merge PR #6584: fix(coding-agent): re-export estimateTokens from legacy pi shim (@roboomp) 2026-07-26 15:41:30 +02:00
roboomp 52b5e7f838 fix(coding-agent): restored legacy pi automode compatibility
Restored the historical clampThinkingLevel export through the legacy pi-ai shim and exposed ModelRegistry.getApiKeyAndHeaders for extension request authentication.

Added compatibility and auth result regression coverage.

Fixes #6648
2026-07-25 22:14:11 +00:00
roboomp 7f1da393df fix(coding-agent): re-export estimateTokens from legacy pi shim
Legacy pi's @earendil-works/pi-coding-agent re-exported estimateTokens
from its coding-agent package root. In omp it lives in
@oh-my-pi/pi-agent-core/compaction and the coding-agent barrel does not
forward it, so the shim's `export * from "../index"` left it off the
surface. A named import tripped Bun's static export check during plugin
validation (e.g. `omp plugin install pi-blackhole`).

Re-export estimateTokens from the shim and pin it with a regression test.

Fixes #6583
2026-07-25 05:35:08 +00:00
roboomp c5685a0080 fix(plugins): restored pi-sprite legacy compatibility
- Added the legacy createExtensionRuntime adapter with fresh pre-bind state.

- Restored terminal capability and Kitty image deletion helpers required by pi-sprite.

- Covered package-root imports and runtime behavior with regression tests.

Fixes #6506
2026-07-24 11:18:20 +00:00
can1357 be94acbf71 fix(extensions): handle TypeScript import-equals require specifiers
Collect TSImportEqualsDeclaration/TSExternalModuleReference targets so
legacy .ts/.cts extensions using `import x = require("pkg")` get their
bare dependencies pinned like plain require() calls. Fold of the #6256
follow-up (comicchang/oh-my-pi@1e54b68) requested on #6324.
2026-07-23 11:37:12 +02:00
Jeff Scott Ward 0b9adcb4c8 fix(extensions): resolve transitive CJS deps
Preserve runtime package resolution in compiled binaries across CommonJS
dependency graphs and mixed-module packages.

Refs #6173
Co-authored-by: Comic Chang <comicchang@gmail.com>
2026-07-22 19:38:23 -04:00
Comic Chang 1ede6ae628 fix(extensions): load legacy plugins in compiled binaries 2026-07-22 18:42:14 -04:00
can1357 b9072f1991 fix(extensibility): validate Type.Unsafe against the draft-2020-12 upgraded schema
Aligns the shim's runtime safeParse/__validator with the wire/tool-call
path, so legacy draft-07 documents (tuple items) accept the same values
validateToolArguments does. Adds a regression test.
2026-07-22 21:13:21 +02:00
roboomp 040c1d5891 fix(extensibility): validated unsafe schemas at runtime
Used the shared JSON Schema validator for Type.Unsafe so direct safeParse calls and composed shim schemas reject invalid values while preserving valid input identity.

Added direct and composed runtime regression assertions.
2026-07-21 22:42:09 +00:00
roboomp 49e63c1f2c fix(extensibility): added Type.Unsafe to typebox shim
Preserved raw JSON Schema documents while keeping the shim validator identity-based, allowing provider wire conversion and runtime argument validation to consume MCP input schemas.

Added direct shim and remapped-extension regression coverage.

Fixes #6221
2026-07-21 22:34:44 +00:00
can1357 1bf08608a4 Merge PR #4964: fix(cli): resolve bundled extension imports (@roboomp)
# Conflicts:
#	packages/coding-agent/src/extensibility/plugins/legacy-pi-compat.ts
#	packages/coding-agent/src/main.ts
#	packages/coding-agent/src/prompts/system/workflow-notice.md
#	packages/coding-agent/test/extensibility/legacy-pi-bundled-virtual.test.ts
2026-07-20 22:53:16 +02:00
roboomp 5082763d49 fix(extensibility): guarantee string getPackageDir in compiled shim builds
omp's canonical getPackageDir() returns undefined inside a bun --compile
binary (import.meta.dir is /$bunfs/root, no owning package.json — issue
#1423). Re-exporting it directly broke pi's string-valued contract:
legacy extensions doing path.join(getPackageDir(), ...) crashed at
runtime in the shipped binary, the primary distribution.

Wrap the canonical helper so the shim always returns a string, falling
back to the executable's directory in compiled mode (where the binary is
the install root). PI_PACKAGE_DIR and dev/source/npm-dist walk-up still
win. Test covers the compiled-mode fallback via isCompiledBinary spy.

Fixes #5968
2026-07-18 06:50:00 +00:00
roboomp 4a25993682 fix(extensibility): re-export getPackageDir/getProjectDir from legacy pi shim
The legacy pi compatibility shim only forwarded getAgentDir (via
`export * from "../index"`). getProjectDir and getPackageDir were absent,
so any pi extension importing either from @earendil-works/pi-coding-agent
failed Bun's static export check during extension validation and the
install was rolled back.

Re-export getProjectDir from @oh-my-pi/pi-utils and getPackageDir from
omp's canonical config helper (returns the coding-agent package root,
matching pi semantics).

Fixes #5968
2026-07-18 06:41:55 +00:00
can1357 0f26558d03 chore: reformat 2026-07-17 07:40:21 +02:00
can1357 cf434411f6 merge PR #5744 via eval/pr-5744: fix(tui): reinstated host stdin listeners removed during tool load 2026-07-17 04:40:04 +02:00
can1357 5d3ad91900 fix(plugins): preserve CommonJS ESM interop 2026-07-17 04:18:10 +02:00
can1357 9a413bf812 fix(coding-agent): restore flowing stdin after guarded load 2026-07-17 03:57:12 +02:00
roboomp d2aeaeced6 fix(tui): reinstated host stdin listeners removed during tool load
The host guard's stdin restore only dropped listeners a module added; a
module that removed a snapshot listener (e.g. a factory calling
process.stdin.removeAllListeners("data") when a subagent re-runs preloaded
factories against a live parent TUI) permanently stripped ProcessTerminal's
input handler. Reconcile each guarded event back to the pre-load snapshot:
when membership changed, removeAllListeners then re-add the snapshot in
order, restoring both additions dropped and removals reinstated. Snapshot
via rawListeners so once-wrapped handlers round-trip intact.

Fixes #5618
2026-07-16 19:48:08 +00:00
roboomp 1fea9b149f fix(tui): guarded stdin against custom-tool import hijack
Custom tool/extension/hook/plugin modules under ~/.claude/tools are
evaluated with live side effects during createAgentSession. A module that
attaches a stdin consumer at import time — an MCP StdioServerTransport
built at module top level, or a bare process.stdin.resume() — steals
Bun's single stdin reader, so the TUI receives exactly one data event and
goes permanently deaf after the first keypress. Under tmux the terminal's
automatic DA1 reply is that one event, so the first user keystroke is
already dead: the input-deafness reported in #5378/#5618.

Broadened the loader's withExitGuard (renamed withHostGuard) to also
snapshot and restore process.stdin around third-party module evaluation:
any data/readable/end/close/error listener the module adds is removed, and
the stream's paused and raw-mode state is restored to the pre-load
snapshot. The exit guard already fenced process.exit; stdin is the same
class of host-state hijack.

Fixes #5618
2026-07-16 19:35:43 +00:00
roboomp 8f15dbf106 fix(plugins): preserved commonjs sibling requires
- Added a graph-owned CommonJS evaluator with shared module.exports and cycle-aware caching.

- Covered sibling require interop across ESM-imported CommonJS modules.

Fixes #5658
2026-07-16 06:11:32 +00:00
roboomp 83c7e69306 test(plugins): covered native addon commonjs wrapping
- Exercised a graph-owned CommonJS dependency whose native addon require is pinned before synchronous wrapping.

Fixes #5658
2026-07-16 05:58:40 +00:00
roboomp 2cf0c402f9 fix(plugins): refreshed commonjs helpers on reload
- Rebuilt synchronous CommonJS wrappers from current source for every legacy extension load.

- Added a same-process helper edit regression.

Fixes #5658
2026-07-16 05:53:19 +00:00
roboomp 33340f82ce fix(plugins): restored legacy commonjs compatibility
- Added DefaultPackageManager discovery compatibility for legacy extensions.

- Loaded graph-owned CommonJS modules through synchronous default bridges.

Fixes #5658
2026-07-16 05:41:35 +00:00
roboomp 24960899ac fix(coding-agent): lazily loaded compiled extension modules
Generated per-module loaders instead of eagerly evaluating the entire bundled compatibility graph during extension bootstrap.

This prevents appserver startup from cycling through its own retained command modules before the Unix socket is created.

Fixes #5568
2026-07-15 10:54:13 +00:00
roboomp 7881fce976 fix(plugins): preserved native commonjs helper loading
Kept synchronous require() targets on Bun’s native loader while retaining hooks for native-addon rewrites.

Added regression coverage for ESM extensions loading CommonJS helper files.

Fixes #5373
2026-07-14 19:22:00 +00:00
can1357 f9f6ed9e8d feat(coding-agent): replaced legacy pi/ role alias prefix with
- Replaced legacy `pi/` role alias prefix with canonical `@` syntax across model resolution, documentation, and tests.
- Added support for bare `*` default alias and multiple alias prefix detection with custom role resolution in `resolveConfiguredRolePattern()`.
- Enhanced thinking suffix parsing to accept unambiguous abbreviations (minimum 2 characters) for effort and level selectors.
- Extended `resolveCliModel()` and `filterAvailableModelsByEnabledPatterns()` to accept settings parameter for role alias resolution from `--model` flag.
2026-07-13 23:26:33 +02:00
roboomp 459682cc63 fix(plugins): skipped invalid custom tool entries
Validated custom tool factory results before registering plugin-provided tools so one malformed feature entry is reported and skipped instead of crashing startup.

Added regression coverage for null entries and mixed valid/null factory arrays.

Fixes #5189
2026-07-11 14:31:07 +00:00
can1357 33c161d9dd refactor(coding-agent): restructured plugin system and build logic
- Migrated legacy static bundled-module registry to a dynamic Bun-based in-memory plugin system.
- Removed over 4,000 lines of manually maintained registry files to reduce maintenance overhead.
- Implemented CJS absolute path rewriting and native-addon load hooks to improve FFI dependency resolution.
- Standardized binary build processes by centralizing compilation logic into shared utilities.
2026-07-11 07:33:22 +02:00
roboomp 1966d041f0 fix(cli): registered bundled namespace resolver
Registered the bundled virtual resolver on the omp-legacy-pi-bundled namespace while keeping the file-namespace scheme fallback for build-time resolution.

Updated the regression test to cover registry-key resolver inputs.

Fixes #4954
2026-07-09 18:30:25 +00:00
roboomp db0e81a221 fix(cli): resolved bundled extension imports
Routed bundled virtual specifiers through Bun's plugin namespace so compiled-binary extensions can import @oh-my-pi value exports.

Surfaced extension load failures during session startup.

Fixes #4954
2026-07-09 18:17:24 +00:00
roboomp 47c172c70a fix(coding-agent): handled json imports in plugin validator
- Left JSON files imported with import attributes on Bun's native loader instead of registering them with the legacy source rewrite hook.
- Added a regression test for loadLegacyPiModule loading a JSON import-attribute target.

Fixes #4687
2026-07-06 08:17:32 +00:00
can1357 d803b6b541 style: formatted evaluator test additions with biome 2026-07-05 12:45:42 +02:00
can1357 3e1808e2b5 fix(agent): handle installed legacy dependency reloads 2026-07-05 12:44:17 +02:00
can1357 b3ee269e4e Merge PR #4568: fix(agent): reload edited legacy Pi modules (@roboomp) 2026-07-05 12:44:17 +02:00
can1357 4225f4bc44 fix legacy resource loader forwarding 2026-07-05 12:44:16 +02:00
can1357 dec882a766 Merge PR #4569: fix(agent): restore legacy DefaultResourceLoader shim (@roboomp) 2026-07-05 12:44:16 +02:00
can1357 2eb5995bc5 fix(coding-agent): complete legacy pi-ai catalog re-exports 2026-07-05 12:44:16 +02:00
roboomp 4f8b0394ca fix(agent): restored legacy DefaultResourceLoader shim
Added a DefaultResourceLoader compatibility adapter for legacy pi package-root imports and translated resourceLoader into OMP session discovery options so noExtensions/noSkills are preserved for subagents.

Added a regression test covering the loader snapshot and createAgentSession translation path.

Fixes #4567
2026-07-05 02:57:52 +00:00
roboomp 45deb2098d fix(agent): reloaded legacy bare dependency children
Included ESM extension-local bare dependency entries in the legacy extension graph so their relative children receive the same mtime cache-bust rewrite as extension source modules.

Skipped CommonJS dependency entries to preserve native Bun CJS default import behavior.

Added a regression test for a local node_modules ESM dependency whose unchanged entry re-exports an edited helper.

Fixes #4565
2026-07-05 02:53:28 +00:00
roboomp 5203fce696 fix(coding-agent): re-exported relocated catalog symbols from legacy pi-ai shim
`calculateCost`, `modelsAreEqual`, and `getBundledProviders` moved from the
`@oh-my-pi/pi-ai` barrel to `@oh-my-pi/pi-catalog/models` in the catalog
split (1b9d9d0851). The legacy-extension pi-ai root shim already bridged
`getBundledModel`/`getBundledModels` back under their old `getModel`/
`getModels` names but never re-exported the other relocated symbols, so any
legacy extension importing `calculateCost` from `@oh-my-pi/pi-ai` failed
plugin validation at install time with `Export named 'calculateCost' not
found in module '.../legacy-pi-ai-shim.ts'`.

Bridge all three symbols through the shim so pre-split legacy extensions
load again. Add regression tests that load fixtures importing
`calculateCost`, `modelsAreEqual`, and `getBundledProviders` from
`@oh-my-pi/pi-ai` and assert identity against the catalog implementations.

Fixes #4584
2026-07-05 02:03:41 +00:00
roboomp 65cd063d90 fix(agent): refreshed legacy pi graph hooks
Collected the current extension graph on every load and registered supplemental Bun hooks for modules added after the first import.

Preserved exact-path filters by tracking covered realpaths per entry instead of widening hooks to unrelated files.

Added a regression test for an entry-only extension that later adds helper and leaf modules, then reloads an edited leaf.

Fixes #4565
2026-07-04 20:56:38 +00:00
roboomp 2049c72b94 fix(agent): propagated mtime through legacy extension graph
Threaded the current load's mtime tag through rewriteExtensionPackageImports, rewriteExtensionBareImports, and a new relative-graph pass so ./helper.ts, #alias/*, and extension-local bare deps all rekey per reload.

Added a toGraphImportSpecifier helper that emits bare POSIX paths with ?mtime on POSIX and keeps file:// URLs on Windows/bundled targets, matching the entry loader.

Added a regression test covering same-process relative-helper reload freshness through the public loader.

Fixes #4565
2026-07-04 20:44:56 +00:00
roboomp d510851593 fix(agent): reloaded edited legacy pi modules
Loaded legacy Pi extension entries through raw POSIX filesystem specifiers so Bun keys the cache-busting mtime query.

Allowed the extension graph onLoad hook to match and normalize the mtime query before rewriting source.

Added a regression test covering same-process reload freshness and clean fileURLToPath-derived paths.

Fixes #4565
2026-07-04 20:26:27 +00:00
can1357 12bbf4a090 merge PR #1706 (+exit-guard port): fix(coding-agent): guard custom tool process exits during load (@roboomp) 2026-07-02 10:30:58 +02:00
PR Evaluator a76a33476a fix(coding-agent): guard custom tool loads with the shared exit guard
Replaces the bespoke batch-scoped process.exit interceptor with the
withExitGuard convention main established for extension/hook/plugin
loaders (500c39aa2): guard the module import and factory invocation so
a synchronous process.exit()/process.reallyExit() from a custom tool
becomes an ExtensionExitError handled as a recoverable load error,
while host exit paths stay untouched outside the guarded windows.
Tests cover the import-time exit (issue #1704 repro) and factory-time
exit; both would kill the test process without the guard.
2026-07-02 10:24:21 +02:00
can1357 00563b01dd Merge PR #3809: fix(plugins): restore legacy tool factory shim (@roboomp) 2026-07-01 21:42:26 +02:00
can1357 ef7636805b feat(coding-agent): removed canonical model variant selection and tracking
- Removed the canonical model variant indexing, selection, and tracking logic from the model registry and resolver.
- Eliminated the `canonical` sub-command, tab view, search tokens, and equivalence configuration structures from the CLI and model selector components.
- Refined model identification, lookup, and provider fallback resolution to bind exclusively to standard, raw model IDs.
- Relocated the equivalence utility script within the catalog package to support script-only policy generation.
2026-07-01 05:22:42 +02:00
roboomp 661f867bf9 fix(plugins): kept relative paths from legacy find ops
Custom legacy FindOperations may return paths already relative to the supplied cwd. Only relativize absolute matches so remote or sandbox backends keep emitting usable results.

Fixes #3808
2026-06-29 13:54:42 +00:00