The next release adds public exports for the prompt-async-gate primitives
(promptAsyncAfterSessionIdle, promptAfterSessionIdle,
releasePromptAsyncReservation, DEFAULT_PROMPT_ASYNC_POST_DISPATCH_HOLD_MS)
and introduces new safety semantics that affect 13+ internal hook callers.
Per semver, adding public exports mandates a MINOR bump from 4.1.x.
No public API removals or breaking signature changes, so this is NOT MAJOR.
Closes pre-publish-review version-bump consensus
Co-authored-by: api-surface (deep / gpt-5.3-codex high)
Default `bun test` recurses into every directory and would pick up
`web/e2e/*.spec.ts` once the marketing site lands. Explicitly listing
the existing test roots (matching script/run-ci-tests.ts TEST_ROOTS)
keeps plugin tests isolated from web E2E tests without needing a
`testPathIgnorePatterns` that bunfig.toml does not support yet.
Root cause: bun build --target bun inlines top-level
var { spawn } = globalThis.Bun;
for every file that contains 'import { spawn } from "bun"'. On Node/Electron
where globalThis.Bun is undefined, this crashes with
Cannot destructure property 'spawn' of 'globalThis.Bun' as it is undefined.
26 source files had this import; the bundled output had 25 top-level destructures.
Fix:
- Add src/shared/bun-spawn-shim.ts: a thin wrapper that
- delegates to Bun.spawn/spawnSync when globalThis.Bun is present (real Bun)
- falls back to static ESM imports of node:child_process otherwise
- uses static 'import { spawn } from "node:child_process"' so Bun bundler
does NOT emit any globalThis.Bun destructures for this module
- Replace all 26 'from "bun"' spawn/spawnSync imports with relative paths to shim
- Replace 4 direct Bun.spawn() call sites with shim's spawn()
- Remove src/electron-compat.ts and script/prepend-electron-shim.ts (no longer needed)
- Update src/electron-compat.test.ts to assert 0 top-level globalThis.Bun destructures
Verification: grep -c '} = globalThis.Bun;' dist/index.js → 0 (was 25)
All 5921 tests pass (1 pre-existing timeout failure unrelated to this change).
Fixes#3797
On Node/Electron, globalThis.Bun is undefined. The Bun bundler emits top-level
var { spawn } = globalThis.Bun;
destructures from its internal modules, causing 'Cannot destructure property
of undefined' before any plugin hook is reached (25 occurrences in dist/index.js).
Fix:
- Add src/electron-compat.ts: a side-effect module that populates globalThis.Bun
with node:child_process-backed spawn/spawnSync shims when Bun is unavailable
- Add script/prepend-electron-shim.ts: post-build script that prepends the shim
code to dist/index.js, guaranteeing it runs BEFORE the top-level destructures
(Bun bundler does not preserve import side-effect evaluation order reliably)
- Update build script to run prepend-shim after bundling
- Add src/electron-compat.test.ts verifying shim position in dist
The shim only activates when globalThis.Bun is absent (real Bun runtime is
unaffected). Spawn-dependent features degrade gracefully at call time.
Fixes#3797 (follow-up to #3795/#3796)
After the package was renamed from oh-my-opencode to oh-my-openagent,
the bin entry only had 'oh-my-opencode'. Users running:
npm install -g oh-my-openagent
could not invoke 'oh-my-openagent' from the command line.
Add 'oh-my-openagent' as a second bin entry pointing to the same
bin/oh-my-opencode.js entry point. Both aliases now work.
Fixes#3482
When oh-my-openagent is loaded by opencode 1.4.6+, both sides ship zod v4
but as two separate instances. zod v4 uses instance-identity checks
(schema._zod.def) that fail across module boundaries, causing:
TypeError: undefined is not an object (evaluating 'n._zod.def')
Fix:
- Add --external zod to the plugin bundle build command so the plugin
resolves zod from opencode's runtime instead of embedding its own copy
- Move zod from dependencies to peerDependencies (^4.0.0) so package
managers know to deduplicate on a single shared instance
- Keep zod in devDependencies so local build/test continues to work
The plugin dist/index.js no longer contains node_modules/zod/v4 internals.
Fixes#3479
opencode 1.3.16 bundles zod v3 internally and accesses _zod.def in
toJsonSchema. When oh-my-openagent installed zod v4, schemas from our
plugin caused a TypeError crash on any tool execution.
We only use basic z.* APIs with no v4-specific features, so pinning
to ^3.24.0 is safe and restores full compatibility.