Skip to content

Public /host and /status cannot be typechecked by a consumer without Bun typings #623

Done

Description

@abogartz

Defer until #601 merges

The public /host and /status entry points are TypeScript source and their transitive
graph references Bun globals, so an external consumer cannot typecheck against them
without installing @types/bun and adding bun to compilerOptions.types. This
contradicts the documented Node support ("Node hosts do not need a Bun process bridge").

Do not start this before #601 lands: ./host exists only on that branch, so a pin written
against main today has nothing to check.

Measured

A consumer file consisting of

import { readMemoryCommand, type MemoryHost } from 'opencode-self-improvement/host';
export const h: Pick<MemoryHost, 'apiVersion'> = { apiVersion: '0.1.0' };
export const cmd = readMemoryCommand('repo-init');

with target: ESNext, module/moduleResolution: NodeNext, strict, skipLibCheck,
allowImportingTsExtensions, types: ["node"]:

node_modules/opencode-self-improvement/src/host/services.ts(16,10): error TS2868: Cannot find name 'Bun' …
node_modules/opencode-self-improvement/src/runtime/setup.ts(97,14): error TS2868: Cannot find name 'Bun' …
node_modules/opencode-self-improvement/src/runtime/setup.ts(97,43): error TS2868: Cannot find name 'Bun' …

Adding @types/bun clears all three. skipLibCheck does not help because the published
surface is .ts, not declarations.

Independently confirmed by the first outside adapter
(WhollyMindless/dsh-self-improvement, #621): its tsconfig.json carries
"types": ["node", "bun"] and its README states the requirement as a known packaging
cost.

The two reference sites are readMemoryCommand using Bun.file and the setup-time
typeof Bun === "undefined" ? undefined : Bun.version probe.

Candidate fix, and the guard that should ship with it

  • readMemoryCommand reads the shipped command text through node:fs/promises.
  • The Bun-version probe reads Bun off a typed globalThis cast rather than naming the
    global.

The pin worth having is the one the package-boundary runner already writes: its generated
consumer tsconfig.json currently declares types: ["bun"]. Switching that generated
consumer to ["node"] turns the whole check into the regression guard — a future Bun
reference anywhere in the public graph fails bun run test:adapter-package instead of
being discovered by a downstream adapter. Unexecuted: neither the fix nor the
types: ["node"] variant has been run, so the fixer must confirm the consumer graph has no
other Bun dependency before proposing it.

Acceptance

  • tsc of a public-entry consumer with types: ["node"] passes, from an installed
    package rather than the checkout.
  • The boundary runner's consumer declares types: ["node"], and reintroducing a Bun
    reference in the public graph makes that runner fail.
  • The external adapter's README sentence about needing Bun declarations becomes false, and
    its types array can drop bun.

Activity

  1. WhollyMindless commented on Nov 30, 2026

    @WhollyMindless
    Contributor

    Note

    🤖 gpt-6-astra responding on behalf of WhollyMindless

    The fix is implemented in existing PR #601 at b9021795, with the downstream dsh update pushed at 972e611. It stays on the branch that provides the public entry points; no additional PR or engine release was created.

    • readMemoryCommand uses node:fs/promises, fixing its Node runtime failure as well as the declaration dependency.
    • Setup reads the optional Bun version through typed globalThis, preserving the existing warning behavior.
    • The package runner typechecks the installed, unchanged host/status consumer with NodeNext and types: ["node"] before installing native SDKs or Bun declarations. Before the production fix, this check failed on all three reported Bun references.
    • Fresh Bun and plain Node processes run that consumer through command reads, setup, gated writes, restart recall/injection, project isolation, status and disposal. Node uses a scoped tsx import and asserts that no Bun global exists. CI runs this package check on Node 22.19.0 on Linux and Windows.
    • Dsh now pins this engine revision, removes @types/bun and "bun" from its configuration, and updates its installation documentation. Removing the workaround against the old pin reproduced the three errors; the new pin passes both adapter and test typechecks.

    Local validation: the complete package check passes; the full engine rerun passes 2,150 tests, 35 skips. The first full run had a store-lock/teardown failure in lock-narrowing.test.ts; it passed alone and on the full rerun. Dsh passes 9 native/package tests and 12 installed CLI scenarios on Node 24.15.0.

    The implementation is ready for review, with CI and #601's merge still pending. The npm release numbered 0.41.1 still lacks these entry points; this does not claim a registry release or resolve the separate compatibility-policy questions.

  2. abogartz-opencode-self-improvement commented on Dec 1, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.42.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions